Changeset 3159297
- Timestamp:
- 09/28/2024 04:48:33 PM (6 months ago)
- Location:
- fluentc-translation
- Files:
-
- 366 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
fluentc-translation/trunk/fluentc_settings.php
r3148988 r3159297 36 36 <ol> 37 37 <li><?php _e( 'Click the link above to link your site to FluentC', 'fluentc-translation' ); ?></li> 38 <li><?php _e( ' Subscribe toLanguages', 'fluentc-translation' ); ?></li>38 <li><?php _e( 'Configure Languages', 'fluentc-translation' ); ?></li> 39 39 <li><?php _e( 'Add the html tag if you choose to display the languages as dropdown or list', 'fluentc-translation' ); ?></li> 40 40 </ol> 41 <h2>Save your FluentC API Key</h2> 42 <form method="post" action='<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>'> 43 <?php wp_nonce_field( 'fluentc_save_settings_action', 'fluentc_settings_nonce_field' ); ?> 44 <input type="hidden" name="action" value="fluentc_save_settings_action"> 45 <table class="form-table"> 46 <tbody> 47 <tr> 48 <th scope="row"><label for="fluentc_api_key"><?php _e( 'FluentC API Key', 'fluentc-translation' ); ?></label></th> 49 <td><input name="fluentc_api_key" type="text" id="fluentc_api_key" 50 value="<?php echo esc_attr( $this->fluentc_get_settings() ); ?>" class="regular-text"> 51 </td> 52 </tr> 53 </tbody> 54 </table> 55 <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" 56 value="<?php _e( 'Save Changes', 'fluentc-translation' ); ?>"></p> 57 </form> 41 58 <?php } ?> 42 59 </div> … … 54 71 55 72 <div id="tab-3" class="tab-content"> 56 <form method="post" action='<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>'> 73 74 <h2>Save your FluentC API Key</h2> 75 <form method="post" action='<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>'> 57 76 <?php wp_nonce_field( 'fluentc_save_settings_action', 'fluentc_settings_nonce_field' ); ?> 58 77 <input type="hidden" name="action" value="fluentc_save_settings_action"> … … 70 89 value="<?php _e( 'Save Changes', 'fluentc-translation' ); ?>"></p> 71 90 </form> 72 73 91 <?php do_action( 'fluentc_admin_tab_three_page' ); ?> 74 92 <?php do_action( 'fluentc_activation_setup' ); ?> -
fluentc-translation/trunk/fluentc_wordpress_plugin.php
r3156028 r3159297 7 7 * Plugin URI: https://github.com/fluentc/wordpress-plugin 8 8 * Description: A plugin that enables website owners to easily install the FluentC Translation on their WordPress site. 9 * Version: 1.9 9 * Version: 1.9.1 10 10 * Author: FluentC 11 11 * Author URI: https://www.fluentc.ai … … 17 17 define( 'FLUENTC_DIR', __DIR__ ); 18 18 define( 'FLUENTC_SLUG', 'fluentc_translation' ); 19 define( 'FLUENTC_TRANSLATION_VERSION', "1.9 " );19 define( 'FLUENTC_TRANSLATION_VERSION', "1.9.1" ); 20 20 define( 'FLUENTC_TRANSLATION_PLUGIN_DIR', plugin_dir_path(__FILE__) ); 21 21 define( 'FLUENTC_TRANSLATION_PLUGIN_URL', plugin_dir_url(__FILE__) ); -
fluentc-translation/trunk/languages/fluentc-translation.pot
r3126655 r3159297 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: FluentC Translation 1. 5\n"5 "Project-Id-Version: FluentC Translation 1.9.1\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wordpress-plugin\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2024-0 7-14T15:16:24+00:00\n"12 "POT-Creation-Date: 2024-09-26T18:49:13+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.10.0\n" … … 40 40 msgstr "" 41 41 42 #: fluentc_settings.php:244 42 #: fluentc_settings.php:9 43 msgid "FluentC Translation Settings" 44 msgstr "" 45 46 #: fluentc_settings.php:12 43 47 msgid "Manage Account" 44 48 msgstr "" 45 49 46 #: fluentc_settings.php: 24850 #: fluentc_settings.php:14 47 51 msgid "Connect to FluentC" 48 52 msgstr "" 49 53 50 #: fluentc_settings.php:260 54 #: fluentc_settings.php:20 55 msgid "Manage your FluentC translation settings, connect your account, and configure language options." 56 msgstr "" 57 58 #: fluentc_settings.php:24 51 59 msgid "Connect" 52 60 msgstr "" 53 61 54 #: fluentc_settings.php:2 6162 #: fluentc_settings.php:25 55 63 msgid "Languages" 56 64 msgstr "" 57 65 58 #: fluentc_settings.php:26 266 #: fluentc_settings.php:26 59 67 msgid "Advanced" 60 68 msgstr "" 61 69 62 #: fluentc_settings.php: 26563 msgid "To use theFluentC, you need an active subscription."64 msgstr "" 65 66 #: fluentc_settings.php: 27667 msgid "Manage FluentC Account and Languages"68 msgstr "" 69 70 #: fluentc_settings.php: 28070 #: fluentc_settings.php:30 71 msgid "To use FluentC, you need an active subscription." 72 msgstr "" 73 74 #: fluentc_settings.php:32 75 msgid "Manage FluentC Account and Add Languages" 76 msgstr "" 77 78 #: fluentc_settings.php:34 71 79 msgid "Sign Up and Connect to FluentC" 72 80 msgstr "" 73 81 74 #: fluentc_settings.php: 29475 msgid "Three steps have translation on your site"76 msgstr "" 77 78 #: fluentc_settings.php: 29682 #: fluentc_settings.php:35 83 msgid "Three steps to have translation on your site" 84 msgstr "" 85 86 #: fluentc_settings.php:37 79 87 msgid "Click the link above to link your site to FluentC" 80 88 msgstr "" 81 89 82 #: fluentc_settings.php: 29790 #: fluentc_settings.php:38 83 91 msgid "Subscribe to Languages" 84 92 msgstr "" 85 93 86 #: fluentc_settings.php: 29894 #: fluentc_settings.php:39 87 95 msgid "Add the html tag if you choose to display the languages as dropdown or list" 88 96 msgstr "" 89 97 90 #: fluentc_settings.php:315 98 #: fluentc_settings.php:48 99 #: fluentc_settings.php:50 100 msgid "Add Languages in FluentC Dashboard" 101 msgstr "" 102 103 #: fluentc_settings.php:62 91 104 msgid "FluentC API Key" 92 105 msgstr "" 93 106 94 #: fluentc_settings.php: 323107 #: fluentc_settings.php:70 95 108 msgid "Save Changes" 96 109 msgstr "" 97 110 98 #: fluentc_settings.php: 345111 #: fluentc_settings.php:77 99 112 msgid "For any assistance please contact FluentC" 100 113 msgstr "" 101 114 102 #: fluentc_settings.php: 345115 #: fluentc_settings.php:77 103 116 msgid "Help and Support" 104 117 msgstr "" 105 118 106 #: src/actions/class-admin.php:3 47119 #: src/actions/class-admin.php:325 107 120 msgid "<p><strong>FluentC API Key is missing.</strong> Please add your API key in settings to use the FluentC features.</p>" 108 121 msgstr "" 122 123 #: src/actions/class-translationstatus.php:87 124 #: src/actions/class-translationstatus.php:88 125 msgid "Translation Status" 126 msgstr "" 127 128 #: src/actions/class-translationstatus.php:140 129 #: src/actions/class-translationstatus.php:159 130 #: src/actions/class-translationstatus.php:184 131 #: src/actions/class-translationstatus.php:221 132 #: src/actions/class-translationstatus.php:272 133 #: src/actions/class-translationstatus.php:350 134 #: src/actions/class-translationstatus.php:390 135 #: src/actions/class-translationstatus.php:453 136 msgid "You do not have permission to perform this action." 137 msgstr "" 138 139 #: src/actions/class-translationstatus.php:146 140 msgid "Site scan completed successfully." 141 msgstr "" 142 143 #: src/actions/class-translationstatus.php:148 144 msgid "An error occurred during the site scan." 145 msgstr "" 146 147 #: src/actions/class-translationstatus.php:171 148 msgid "URL status updated successfully." 149 msgstr "" 150 151 #: src/actions/class-translationstatus.php:173 152 msgid "An error occurred while updating the URL status." 153 msgstr "" 154 155 #: src/actions/class-translationstatus.php:198 156 msgid "Last scan: %s ago" 157 msgstr "" 158 159 #: src/actions/class-translationstatus.php:202 160 msgid "Last Scan older than 7 days, scan again" 161 msgstr "" 162 163 #: src/actions/class-translationstatus.php:205 164 msgid "No scan has been performed yet" 165 msgstr "" 166 167 #: src/actions/class-translationstatus.php:259 168 msgid "Translation process started." 169 msgstr "" 170 171 #: src/actions/class-translationstatus.php:278 172 msgid "Translation cancelled" 173 msgstr "" 174 175 #: src/actions/class-translationstatus.php:280 176 msgid "An error occurred while cancelling the translation." 177 msgstr "" 178 179 #: src/actions/class-translationstatus.php:294 180 msgid "Original URL" 181 msgstr "" 182 183 #: src/actions/class-translationstatus.php:295 184 msgid "Translations" 185 msgstr "" 186 187 #: src/actions/class-translationstatus.php:306 188 msgid "Translated URL" 189 msgstr "" 190 191 #: src/actions/class-translationstatus.php:307 192 msgid "Language" 193 msgstr "" 194 195 #: src/actions/class-translationstatus.php:308 196 msgid "Status" 197 msgstr "" 198 199 #: src/actions/class-translationstatus.php:325 200 msgid "Translated" 201 msgstr "" 202 203 #: src/actions/class-translationstatus.php:325 204 msgid "Pending" 205 msgstr "" 206 207 #: src/actions/class-translationstatus.php:333 208 msgid "No translations available" 209 msgstr "" 210 211 #: src/actions/class-translationstatus.php:398 212 msgid "Translation Cancelled" 213 msgstr "" 214 215 #: src/actions/class-translationstatus.php:425 216 msgid "Translation In Progress" 217 msgstr "" 218 219 #: src/actions/class-translationstatus.php:429 220 msgid "Translation Completed" 221 msgstr "" 222 223 #: src/actions/class-translationstatus.php:432 224 msgid "Translation Not Started" 225 msgstr "" 226 227 #: src/actions/class-translationstatus.php:435 228 msgid "Last Translation Canceled" 229 msgstr "" 230 231 #: src/templates/translation-status.php:4 232 msgid "FluentC Translation Status" 233 msgstr "" 234 235 #: src/templates/translation-status.php:8 236 msgid "Monitor and manage the translation status of your site pages. Use the buttons below to scan your site for translatable content and initiate translations." 237 msgstr "" 238 239 #: src/templates/translation-status.php:12 240 msgid "Scan your site to see all available pages for translation." 241 msgstr "" 242 243 #: src/templates/translation-status.php:13 244 msgid "Identify Pages for Translation" 245 msgstr "" 246 247 #: src/templates/translation-status.php:15 248 msgid "Translate all pages in selected languages, including updates to existing translations." 249 msgstr "" 250 251 #: src/templates/translation-status.php:16 252 msgid "Translate & Update Site" 253 msgstr "" 254 255 #: src/templates/translation-status.php:19 256 msgid "Cancel Translation" 257 msgstr "" -
fluentc-translation/trunk/readme.txt
r3156028 r3159297 1 === FluentC - AI-Powered Multilingual Website Translaton===1 === FluentC - AI-Powered Translation for WP === 2 2 Contributors: mvpis 3 3 Donate link: https://www.fluentc.ai 4 Tags: translation, multilingual, SEO, WooCommerce, localization4 Tags: translation, multilingual, translate, language switcher, automatic translation 5 5 Requires at least: 4.6 6 6 Tested up to: 6.6.2 7 Stable tag: 1.9 7 Stable tag: 1.9.1 8 8 Requires PHP: 7.3 9 9 License: GPLv2 or later … … 12 12 13 13 == Description == 14 Limited Time Offer: One Free Language for all sites! 15 FluentC revolutionizes WordPress translation with its AI-powered, user-friendly approach. Designed for simplicity and efficiency, FluentC offers automatic translations that are both quick and accurate, making your WordPress site multilingual without the technical hassle. 16 Key Features: 14 **Limited Time Offer: One Free Language for All Sites!** 17 15 18 AI-powered translations for over 130 languages 19 Flat-fee pricing: $25/month per language with unlimited translations 20 SEO-optimized translations to boost your multilingual search rankings 21 No performance impact on your WordPress site 22 Easy setup and minimal configuration required 16 FluentC transforms your WordPress site into a **multilingual powerhouse** with **AI-powered translations** in over 130 languages. It’s designed to be fast, reliable, and easy to use, without the need for technical expertise. Enjoy **SEO-optimized translations** to increase international traffic and sales, all while maintaining top performance on your WordPress site. 23 17 24 FluentC for WooCommerce 25 Seamlessly translate your WooCommerce store: 18 **Key Features:** 19 - **AI-Powered Automatic Translation**: Translate your WordPress site in over 130 languages with AI precision, ensuring high-quality, human-like translations. 20 - **One Free Language with Unlimited Translations**: For a limited time, you can translate your site into one language at no cost. 21 - **Flat-Rate Pricing**: $25/month per additional language with unlimited translations. No hidden fees or word limits. 22 - **SEO-Optimized**: Automatically generates SEO-friendly translations, including **meta tags**, **URL slugs**, and **schema.org data**. 23 - **No Performance Impact**: Translations occur without slowing down your website, ensuring optimal speed even with multiple languages. 24 - **Manual Translation Edits**: Easily fine-tune and manually adjust translations to get them just right for your audience. 25 - **Compatible with Popular Plugins**: Seamless integration with WooCommerce, Yoast SEO, WPForms, Contact Form 7, Elementor, and ACF, ensuring all your site’s elements are translated. 26 26 27 Automatic translation of WooCommerce pages, product categories, and attributes 28 Product metadata synchronization 29 Compatible with popular WooCommerce extensions 27 **FluentC for WooCommerce:** 28 Boost your WooCommerce store’s global reach with automated translations for: 29 - **Product Pages**: Translate product descriptions, categories, attributes, and more. 30 - **SEO Optimization**: FluentC translates WooCommerce schema.org data for improved multilingual SEO. 31 - **Full Metadata Translation**: Ensure your products are accurately translated, including meta keywords and descriptions for improved search engine visibility. 30 32 31 FluentC for Blocks 32 Direct support for WordPress block editor: 33 **Advanced Features**: 34 - **Hreflang Tags**: Automatically generated hreflang tags help search engines index your multilingual pages properly. 35 - **Manual Translation Control**: Take control by manually editing translations without losing context. 33 36 34 Translate core blocks including template parts, headings, buttons, and more 35 Enhanced compatibility with block-enabled themes 37 == Frequently Asked Questions == 38 39 = What does the 'Free Language' offer include? = 40 FluentC offers one free language with unlimited translations for all WordPress sites. This makes FluentC the most affordable option for multilingual WordPress websites. You only pay for additional languages. 41 42 = Will FluentC slow down my site? = 43 No, FluentC is designed to deliver translations without impacting your website’s speed or performance. 44 45 = Is FluentC compatible with WooCommerce? = 46 Yes, FluentC fully supports WooCommerce, including automatic translations for product pages, categories, schema.org data, and product metadata. 47 48 = How does FluentC help with SEO for multilingual sites? = 49 FluentC automatically generates SEO-optimized translations, including translated **meta tags**, **URLs**, and **schema.org microdata**, which helps your site rank higher in search engines across multiple languages. 50 51 = Can I manually adjust translations? = 52 Yes, FluentC allows you to manually edit and adjust translations for precision, giving you complete control over how your content appears in different languages. 53 36 54 37 55 == Installation == … … 43 61 Choose your target languages and configure display settings 44 62 Add the FluentC widget to your site using <div id="fluentc-widget"></div> 45 46 == Frequently Asked Questions ==47 = How does FluentC compare to other translation plugins? =48 FluentC offers:49 50 Unlimited translations at a flat monthly fee51 No impact on site performance52 AI-powered translations for accuracy53 Easy setup and management54 SEO optimization for multilingual sites55 56 = Is FluentC compatible with my theme and plugins? =57 FluentC is designed to work with most WordPress themes and plugins, including WooCommerce and popular page builders.58 = How does FluentC handle content updates? =59 FluentC automatically detects and translates new or updated content, keeping all language versions in sync.60 = Is there a limit to how much content I can translate? =61 No, FluentC offers unlimited translations within your subscription.62 For more FAQs and support, visit FluentC Support.63 63 64 64 == Screenshots == … … 90 90 = 1.7 = 91 91 Upgrade now to unlock advanced translation editing, seamless navigation integration, flexible FluentC block placement, and our game-changing proactive translation technology. Experience a new level of multilingual website management! 92 93 == External Service Integration ==94 FluentC uses an external JavaScript file (https://widget.fluentc.io/fluentcWidgetWordpress.min.js) to provide advanced features and ensure optimal performance. This approach allows for seamless updates and enhanced functionality without impacting your WordPress hosting environment. -
fluentc-translation/trunk/src/actions/class-wordpress.php
r3155849 r3159297 141 141 public function filter_block($block_content, $block) 142 142 { 143 do_action('qm/info', 'Starting filter_block'); 144 do_action('qm/info', 'Original content: ' . substr($block_content, 0, 100) . '...'); 145 143 146 144 if (!$this->should_process_content($block_content)) { 147 145 do_action('qm/info', 'Content not processed: language code missing or content empty'); 148 146 return $block_content; 149 147 } 150 148 151 149 $dom = $this->load_dom($block_content); 152 do_action('qm/info', 'DOM loaded. Root children count: ' . count($dom->root->getChildren())); 153 150 154 151 $texts_to_translate = $entry_map = $entry_skip_map = []; 155 152 156 153 $this->process_dom_elements($dom, $texts_to_translate, $entry_map, $entry_skip_map); 157 do_action('qm/info', 'DOM processed. Texts to translate: ' . count($texts_to_translate) . ', Entry map: ' . count($entry_map) . ', Skip map: ' . count($entry_skip_map)); 158 154 159 155 if (!empty($texts_to_translate)) { 160 156 $this->process_translations($texts_to_translate, $entry_map, $entry_skip_map); … … 163 159 do_action('qm/info', 'No texts to translate'); 164 160 } 165 do_action('qm/info', 'Pre Processed HTML: ' . substr($dom->root->outerHtml(), 0, 600) . '...');161 166 162 $html = $this->get_processed_html($dom); 167 do_action('qm/info', 'Processed HTML: ' . substr($html, 0, 600) . '...');168 163 169 do_action('qm/info', 'Finished filter_block');170 164 return $html ?: $block_content; 171 165 } -
fluentc-translation/trunk/src/fluentc_pll_api.php
r3126655 r3159297 107 107 $args = wp_parse_args( $args, array( 'fields' => 'slug' ) ); 108 108 109 return $fluentc_connect->get_fluentc_languages_list( $args ); 109 $result = $fluentc_connect->get_fluentc_languages_list( $args ); 110 return is_array($result) ? $result : array(); 110 111 } 111 112 -
fluentc-translation/trunk/vendor/composer/installed.json
r3155849 r3159297 117 117 "time": "2024-09-21T22:25:23+00:00", 118 118 "type": "library", 119 "installation-source": " source",119 "installation-source": "dist", 120 120 "autoload": { 121 121 "psr-4": { … … 592 592 { 593 593 "name": "php-http/httplug", 594 "version": "2.4. 0",595 "version_normalized": "2.4. 0.0",594 "version": "2.4.1", 595 "version_normalized": "2.4.1.0", 596 596 "source": { 597 597 "type": "git", 598 598 "url": "https://github.com/php-http/httplug.git", 599 "reference": " 625ad742c360c8ac580fcc647a1541d29e257f67"600 }, 601 "dist": { 602 "type": "zip", 603 "url": "https://api.github.com/repos/php-http/httplug/zipball/ 625ad742c360c8ac580fcc647a1541d29e257f67",604 "reference": " 625ad742c360c8ac580fcc647a1541d29e257f67",599 "reference": "5cad731844891a4c282f3f3e1b582c46839d22f4" 600 }, 601 "dist": { 602 "type": "zip", 603 "url": "https://api.github.com/repos/php-http/httplug/zipball/5cad731844891a4c282f3f3e1b582c46839d22f4", 604 "reference": "5cad731844891a4c282f3f3e1b582c46839d22f4", 605 605 "shasum": "" 606 606 }, … … 615 615 "phpspec/phpspec": "^5.1 || ^6.0 || ^7.0" 616 616 }, 617 "time": "202 3-04-14T15:10:03+00:00",617 "time": "2024-09-23T11:39:58+00:00", 618 618 "type": "library", 619 619 "installation-source": "dist", … … 646 646 "support": { 647 647 "issues": "https://github.com/php-http/httplug/issues", 648 "source": "https://github.com/php-http/httplug/tree/2.4. 0"648 "source": "https://github.com/php-http/httplug/tree/2.4.1" 649 649 }, 650 650 "install-path": "../php-http/httplug" -
fluentc-translation/trunk/vendor/composer/installed.php
r3155849 r3159297 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' cf45b01c58ff2892b642f122caecf86f2d8b0873',6 'reference' => 'ff08d645781809501a5b0e469117ce9029569b3c', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' cf45b01c58ff2892b642f122caecf86f2d8b0873',16 'reference' => 'ff08d645781809501a5b0e469117ce9029569b3c', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', … … 84 84 ), 85 85 'php-http/httplug' => array( 86 'pretty_version' => '2.4. 0',87 'version' => '2.4. 0.0',88 'reference' => ' 625ad742c360c8ac580fcc647a1541d29e257f67',86 'pretty_version' => '2.4.1', 87 'version' => '2.4.1.0', 88 'reference' => '5cad731844891a4c282f3f3e1b582c46839d22f4', 89 89 'type' => 'library', 90 90 'install_path' => __DIR__ . '/../php-http/httplug', -
fluentc-translation/trunk/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Dom/Parser.php
r3156028 r3159297 277 277 */ 278 278 private function setUpAttributes(Content $content, int $size, HtmlNode $node, Options $options, $tag): void 279 { 280 while ( 281 $content->char() != '>' && 282 $content->char() != '/' 283 ) { 284 $space = $content->skipByToken(StringToken::BLANK(), true); 285 if (empty($space)) { 286 try { 287 $content->fastForward(1); 288 } catch (ContentLengthException $exception) { 289 // reached the end of the content 279 { 280 while ( 281 $content->char() != '>' && 282 $content->char() != '/' 283 ) { 284 $space = $content->skipByToken(StringToken::BLANK(), true); 285 if (empty($space)) { 286 try { 287 $content->fastForward(1); 288 } catch (ContentLengthException $exception) { 289 // reached the end of the content 290 break; 291 } 292 continue; 293 } 294 295 $name = $content->copyByToken(StringToken::EQUAL(), true); 296 if ($name == '/') { 290 297 break; 291 298 } 292 continue; 293 } 294 295 $name = $content->copyByToken(StringToken::EQUAL(), true); 296 if ($name == '/') { 297 break; 298 } 299 300 if (empty($name)) { 299 300 if (empty($name)) { 301 $content->skipByToken(StringToken::BLANK()); 302 continue; 303 } 304 301 305 $content->skipByToken(StringToken::BLANK()); 302 continue; 303 } 304 305 $content->skipByToken(StringToken::BLANK()); 306 if ($content->char() == '=') { 307 $content->fastForward(1) 308 ->skipByToken(StringToken::BLANK()); 309 switch ($content->char()) { 310 case '"': 311 $content->fastForward(1); 312 $string = $this->parseComplexAttribute($content, '"', $size); 313 $content->fastForward(1); 314 $node->getTag()->setAttribute($name, $string); 315 break; 316 case "'": 317 $content->fastForward(1); 318 $string = $this->parseComplexAttribute($content, "'", $size); 319 $content->fastForward(1); 320 $node->getTag()->setAttribute($name, $string, false); 321 break; 322 default: 323 $node->getTag()->setAttribute($name, $content->copyByToken(StringToken::ATTR(), true)); 324 break; 325 } 326 } else { 327 // no value attribute 328 if ($options->isStrict()) { 329 // can't have this in strict html 330 $character = $content->getPosition(); 331 throw new StrictException("Tag '$tag' has an attribute '$name' without a value! (character #$character)"); 332 } 333 $node->getTag()->setAttribute($name, null); 334 if ($content->char() != '>') { 335 $content->rewind(1); 306 if ($content->char() == '=') { 307 $content->fastForward(1) 308 ->skipByToken(StringToken::BLANK()); 309 switch ($content->char()) { 310 case '"': 311 $content->fastForward(1); 312 $string = $content->copyUntil('"', true); 313 do { 314 $moreString = $content->copyUntilUnless('"', '=>'); 315 $string .= $moreString; 316 } while (\strlen($moreString) > 0 && $content->getPosition() < $size); 317 $content->fastForward(1); 318 $node->getTag()->setAttribute($name, $string); 319 break; 320 case "'": 321 $content->fastForward(1); 322 $string = $content->copyUntil("'", true); 323 do { 324 $moreString = $content->copyUntilUnless("'", '=>'); 325 $string .= $moreString; 326 } while (\strlen($moreString) > 0 && $content->getPosition() < $size); 327 $content->fastForward(1); 328 $node->getTag()->setAttribute($name, $string, false); 329 break; 330 default: 331 $node->getTag()->setAttribute($name, $content->copyByToken(StringToken::ATTR(), true)); 332 break; 333 } 334 } else { 335 // no value attribute 336 if ($options->isStrict()) { 337 // can't have this in strict html 338 $character = $content->getPosition(); 339 throw new StrictException("Tag '$tag' has an attribute '$name' with out a value! (character #$character)"); 340 } 341 $node->getTag()->setAttribute($name, null); 342 if ($content->char() != '>') { 343 $content->rewind(1); 344 } 336 345 } 337 346 } 338 347 } 339 348 } 340 341 private function parseComplexAttribute(Content $content, string $quote, int $size): string342 {343 $string = '';344 $nestLevel = 0;345 while ($content->getPosition() < $size) {346 $char = $content->char();347 if ($char === $quote && $nestLevel === 0) {348 break;349 }350 $string .= $char;351 if ($char === '{') {352 $nestLevel++;353 } elseif ($char === '}') {354 $nestLevel--;355 }356 $content->fastForward(1);357 }358 return $string;359 }360 } -
fluentc-translation/trunk/vendor/fluentc/php-html-parser/src/PHPHtmlParser/Dom/Tag.php
r3156028 r3159297 174 174 */ 175 175 public function setAttribute(string $key, $value): void 176 {177 // Handle data-* attributes178 if (strpos($key, 'data-') === 0) {179 $this->attr[$key] = AttributeDTO::makeFromPrimitives($value);180 } else {181 $this->attr[strtolower($key)] = AttributeDTO::makeFromPrimitives($value);182 }183 }176 { 177 // Handle data-* attributes 178 if (strpos($key, 'data-') === 0) { 179 $this->attr[$key] = AttributeDTO::makeFromPrimitives($value); 180 } else { 181 $this->attr[strtolower($key)] = AttributeDTO::makeFromPrimitives($value); 182 } 183 } 184 184 185 185 /** … … 373 373 */ 374 374 375 public function makeOpeningTag(): string 376 { 377 $return = '<' . $this->name; 378 379 foreach ($this->attr as $key => $attributeDTO) { 380 $return .= ' ' . $key; 381 382 $value = $attributeDTO->getValue(); 383 if ($value === true || $value === '') { 384 continue; 385 } 386 387 if ($value !== null) { 388 $quote = $this->determineQuote($value); 389 $return .= '=' . $quote . $this->escapeAttributeValue($value, $quote) . $quote; 390 } 391 } 392 393 if ($this->isSelfClosing()) { 394 $return .= ' /'; 395 } 396 397 $return .= '>'; 398 399 return $return; 400 } 401 402 private function determineQuote($value): string 403 { 404 return (strpos($value, '"') !== false && strpos($value, "'") === false) ? "'" : '"'; 405 } 406 407 private function escapeAttributeValue($value, $quote): string 408 { 409 if ($quote === '"') { 410 return str_replace('"', '"', $value); 411 } 412 return str_replace("'", ''', $value); 413 } 375 public function makeOpeningTag(): string 376 { 377 if ($this->isComment()) { 378 return $this->opening . substr($this->name, 3); 379 } 380 381 $return = '<'.$this->name; 382 383 // handle attributes 384 foreach ($this->attr as $key => $attributeDTO) { 385 $return .= ' '.$key; 386 387 // Handle boolean attributes 388 if ($attributeDTO->getValue() === true) { 389 continue; 390 } 391 392 if ($attributeDTO->getValue() !== null && $attributeDTO->getValue() !== '') { 393 $return .= '='.$attributeDTO->getOpeningQuote().$attributeDTO->getValue().$attributeDTO->getClosingQuote(); 394 } 395 } 396 397 // handle void elements 398 if ($this->isSelfClosing()) { 399 $return .= ' /'; 400 } 401 402 $return .= '>'; 403 404 return $return; 405 } 406 414 407 /** 415 408 * Generates the closing tag for this object. -
fluentc-translation/trunk/vendor/php-http/httplug/CHANGELOG.md
r3129167 r3159297 7 7 and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). 8 8 9 ## [2.4.1] - 2024-09-23 10 11 - Updated code to not raise warnings for nullable parameters in PHP 8.4. 9 12 10 13 ## [2.4.0] - 2023-04-14 -
fluentc-translation/trunk/vendor/php-http/httplug/src/Exception/HttpException.php
r3129167 r3159297 27 27 RequestInterface $request, 28 28 ResponseInterface $response, 29 \Exception $previous = null29 ?\Exception $previous = null 30 30 ) { 31 31 parent::__construct($message, $request, $previous); … … 51 51 RequestInterface $request, 52 52 ResponseInterface $response, 53 \Exception $previous = null53 ?\Exception $previous = null 54 54 ) { 55 55 $message = sprintf( -
fluentc-translation/trunk/vendor/php-http/httplug/src/Exception/NetworkException.php
r3129167 r3159297 20 20 * @param string $message 21 21 */ 22 public function __construct($message, RequestInterface $request, \Exception $previous = null)22 public function __construct($message, RequestInterface $request, ?\Exception $previous = null) 23 23 { 24 24 $this->setRequest($request); -
fluentc-translation/trunk/vendor/php-http/httplug/src/Exception/RequestAwareTrait.php
r3129167 r3159297 17 17 } 18 18 19 /**20 * {@inheritdoc}21 */22 19 public function getRequest(): RequestInterface 23 20 { -
fluentc-translation/trunk/vendor/php-http/httplug/src/Exception/RequestException.php
r3129167 r3159297 21 21 * @param string $message 22 22 */ 23 public function __construct($message, RequestInterface $request, \Exception $previous = null)23 public function __construct($message, RequestInterface $request, ?\Exception $previous = null) 24 24 { 25 25 $this->setRequest($request); -
fluentc-translation/trunk/vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php
r3129167 r3159297 19 19 } 20 20 21 /** 22 * {@inheritdoc} 23 */ 24 public function then(callable $onFulfilled = null, callable $onRejected = null) 21 public function then(?callable $onFulfilled = null, ?callable $onRejected = null) 25 22 { 26 23 if (null === $onFulfilled) { … … 35 32 } 36 33 37 /**38 * {@inheritdoc}39 */40 34 public function getState() 41 35 { … … 43 37 } 44 38 45 /**46 * {@inheritdoc}47 */48 39 public function wait($unwrap = true) 49 40 { -
fluentc-translation/trunk/vendor/php-http/httplug/src/Promise/HttpRejectedPromise.php
r3129167 r3159297 18 18 } 19 19 20 /** 21 * {@inheritdoc} 22 */ 23 public function then(callable $onFulfilled = null, callable $onRejected = null) 20 public function then(?callable $onFulfilled = null, ?callable $onRejected = null) 24 21 { 25 22 if (null === $onRejected) { … … 39 36 } 40 37 41 /**42 * {@inheritdoc}43 */44 38 public function getState() 45 39 { … … 47 41 } 48 42 49 /**50 * {@inheritdoc}51 */52 43 public function wait($unwrap = true) 53 44 {
Note: See TracChangeset
for help on using the changeset viewer.