Changeset 3389688
- Timestamp:
- 11/04/2025 01:10:58 PM (4 months ago)
- Location:
- translatepress-multilingual
- Files:
-
- 12 edited
- 1 copied
-
tags/3.0.3 (copied) (copied from translatepress-multilingual/trunk)
-
tags/3.0.3/class-translate-press.php (modified) (3 diffs)
-
tags/3.0.3/includes/class-machine-translator.php (modified) (1 diff)
-
tags/3.0.3/includes/class-woocommerce-emails.php (modified) (3 diffs)
-
tags/3.0.3/index.php (modified) (1 diff)
-
tags/3.0.3/languages/translatepress-multilingual.pot (modified) (2 diffs)
-
tags/3.0.3/readme.txt (modified) (2 diffs)
-
trunk/class-translate-press.php (modified) (3 diffs)
-
trunk/includes/class-machine-translator.php (modified) (1 diff)
-
trunk/includes/class-woocommerce-emails.php (modified) (3 diffs)
-
trunk/index.php (modified) (1 diff)
-
trunk/languages/translatepress-multilingual.pot (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
translatepress-multilingual/tags/3.0.3/class-translate-press.php
r3389452 r3389688 68 68 */ 69 69 public function __construct() { 70 // Early bind to break recursion loop caused by calling get_trp_instance during construction71 if ( self::$translate_press === null ) {72 self::$translate_press = $this;73 }74 75 70 define( 'TRP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 76 71 define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); 77 72 define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) ); 78 73 define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' ); 79 define( 'TRP_PLUGIN_VERSION', '3.0. 2' );74 define( 'TRP_PLUGIN_VERSION', '3.0.3' ); 80 75 81 76 wp_cache_add_non_persistent_groups(array('trp')); … … 108 103 require_once TRP_PLUGIN_DIR . 'includes/class-editor-api-regular-strings.php'; 109 104 require_once TRP_PLUGIN_DIR . 'includes/class-editor-api-gettext-strings.php'; 105 require_once TRP_PLUGIN_DIR . 'includes/class-translation-manager.php'; 110 106 require_once TRP_PLUGIN_DIR . 'includes/class-hooks-loader.php'; 111 107 require_once TRP_PLUGIN_DIR . 'includes/class-languages.php'; … … 184 180 $this->query = new TRP_Query( $this->settings->get_settings() ); 185 181 $this->machine_translator_logger = new TRP_Machine_Translator_Logger( $this->settings->get_settings() ); 186 $this->machine_translator = new TRP_Machine_Translator( $this->settings->get_settings() ); // Will be overwritten in init_machine_translation with the actual machine translator class. Use this as replacement until then.187 182 $this->translation_manager = new TRP_Translation_Manager( $this->settings->get_settings() ); 188 183 $this->editor_api_regular_strings = new TRP_Editor_Api_Regular_Strings( $this->settings->get_settings() ); -
translatepress-multilingual/tags/3.0.3/includes/class-machine-translator.php
r3389452 r3389688 46 46 * @return bool 47 47 */ 48 public function is_available( $languages = array() ) { 49 /** 50 * Return false in case it was directly called from parent and not from a derived class (DeepL / Google / TPAI) 51 * Calling this method on the parent class means it was called too early and machine translation is not available at this point 52 */ 53 if ( get_class( $this ) === __CLASS__ ) 54 return false; 55 56 $settings = $this->settings['trp_machine_translation_settings'] ?? array(); 57 $enabled = ( $settings['machine-translation'] ?? '' ) === 'yes'; 58 $is_available = false; 59 60 if ( $enabled ) { 61 $engine = $settings['translation-engine'] ?? null; 62 63 if ( $engine === 'deepl' && get_option( 'trp_license_status' ) !== 'valid' ) { 48 public function is_available( $languages = array() ){ 49 if( !empty( $this->settings['trp_machine_translation_settings']['machine-translation'] ) && 50 $this->settings['trp_machine_translation_settings']['machine-translation'] == 'yes' 51 ) { 52 if ( empty( $languages ) ){ 53 // can be used to simply know if machine translation is available 54 $is_available = true; 55 } 56 57 // If the license is invalid and the translation engine is DeepL,return false 58 $license_status = get_option( 'trp_license_status' ); 59 if ( $license_status !== 'valid' && isset( $this->settings['trp_machine_translation_settings']['translation-engine'] ) && $this->settings['trp_machine_translation_settings']['translation-engine'] === 'deepl' ) { 64 60 $is_available = false; 65 } elseif ( empty( $languages ) ) { 66 $is_available = true; 67 } else { 68 $is_available = $this->check_languages_availability( $languages ); 69 } 70 } 71 72 return apply_filters( 'trp_machine_translator_is_available', $is_available, $languages, $settings ); 61 } 62 63 $is_available = $this->check_languages_availability($languages); 64 65 }else { 66 $is_available = false; 67 } 68 69 return apply_filters('trp_machine_translator_is_available', $is_available); 73 70 } 74 71 -
translatepress-multilingual/tags/3.0.3/includes/class-woocommerce-emails.php
r3389452 r3389688 245 245 WC()->load_plugin_textdomain(); 246 246 247 $this->bootstrap_trp_gettext_for_email s();247 $this->bootstrap_trp_gettext_for_email_language( $language ); 248 248 249 249 // calls necessary because the default additional_content field of an email is localized before this point and stored in a variable in the previous locale … … 289 289 * gettext translations stored in TranslatePress are applied correctly. 290 290 */ 291 private function bootstrap_trp_gettext_for_email s() {291 private function bootstrap_trp_gettext_for_email_language( $language ) { 292 292 $trp = TRP_Translate_Press::get_trp_instance(); 293 293 $gettext_manager = $trp->get_component( 'gettext_manager' ); … … 298 298 return; 299 299 300 if ( !$trp->get_component( 'machine_translator' ) )301 $trp->init_machine_translation(); // Machine translator should be initialized by the get_trp_instance() call. In the case of cron jobs, it is not - so we initialize it here manually.302 303 300 // Bypass processing_gettext_is_needed usual checks. Otherwise, the below method calls wouldn't go through 304 301 add_filter( 'trp_processing_gettext_is_needed', '__return_true' ); -
translatepress-multilingual/tags/3.0.3/index.php
r3389452 r3389688 4 4 Plugin URI: https://translatepress.com/ 5 5 Description: Experience a better way of translating your WordPress site using a visual front-end translation editor, with full support for WooCommerce and site builders. 6 Version: 3.0. 26 Version: 3.0.3 7 7 Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban 8 8 Author URI: https://cozmoslabs.com/ -
translatepress-multilingual/tags/3.0.3/languages/translatepress-multilingual.pot
r3389452 r3389688 7 7 "Content-Type: text/plain; charset=UTF-8\n" 8 8 "Content-Transfer-Encoding: 8bit\n" 9 "POT-Creation-Date: 2025-11-04 08:50+0000\n"9 "POT-Creation-Date: 2025-11-04 12:55+0000\n" 10 10 "X-Poedit-Basepath: ..\n" 11 11 "X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n" … … 343 343 msgstr "" 344 344 345 #: includes/class-machine-translator.php:15 5, includes/google-translate/class-google-translate-v2-machine-translator.php:190345 #: includes/class-machine-translator.php:152, includes/google-translate/class-google-translate-v2-machine-translator.php:190 346 346 msgid "Please enter your Google Translate key." 347 347 msgstr "" 348 348 349 #: includes/class-machine-translator.php:1 70, add-ons-pro/deepl/includes/class-deepl-machine-translator.php:386349 #: includes/class-machine-translator.php:167, add-ons-pro/deepl/includes/class-deepl-machine-translator.php:386 350 350 msgid "Please enter your DeepL API key." 351 351 msgstr "" -
translatepress-multilingual/tags/3.0.3/readme.txt
r3389452 r3389688 6 6 Tested up to: 6.8.3 7 7 Requires PHP: 7.4 8 Stable tag: 3.0. 28 Stable tag: 3.0.3 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 143 143 144 144 == Changelog == 145 = 3.0.3 = 146 * Fixed an issue introduced in the previous update that occurred when using Google Translate as the translation engine 147 145 148 = 3.0.2 = 146 149 * Fixed potential security issue due to calling extract on shortcode attribute -
translatepress-multilingual/trunk/class-translate-press.php
r3389452 r3389688 68 68 */ 69 69 public function __construct() { 70 // Early bind to break recursion loop caused by calling get_trp_instance during construction71 if ( self::$translate_press === null ) {72 self::$translate_press = $this;73 }74 75 70 define( 'TRP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 76 71 define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); 77 72 define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) ); 78 73 define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' ); 79 define( 'TRP_PLUGIN_VERSION', '3.0. 2' );74 define( 'TRP_PLUGIN_VERSION', '3.0.3' ); 80 75 81 76 wp_cache_add_non_persistent_groups(array('trp')); … … 108 103 require_once TRP_PLUGIN_DIR . 'includes/class-editor-api-regular-strings.php'; 109 104 require_once TRP_PLUGIN_DIR . 'includes/class-editor-api-gettext-strings.php'; 105 require_once TRP_PLUGIN_DIR . 'includes/class-translation-manager.php'; 110 106 require_once TRP_PLUGIN_DIR . 'includes/class-hooks-loader.php'; 111 107 require_once TRP_PLUGIN_DIR . 'includes/class-languages.php'; … … 184 180 $this->query = new TRP_Query( $this->settings->get_settings() ); 185 181 $this->machine_translator_logger = new TRP_Machine_Translator_Logger( $this->settings->get_settings() ); 186 $this->machine_translator = new TRP_Machine_Translator( $this->settings->get_settings() ); // Will be overwritten in init_machine_translation with the actual machine translator class. Use this as replacement until then.187 182 $this->translation_manager = new TRP_Translation_Manager( $this->settings->get_settings() ); 188 183 $this->editor_api_regular_strings = new TRP_Editor_Api_Regular_Strings( $this->settings->get_settings() ); -
translatepress-multilingual/trunk/includes/class-machine-translator.php
r3389452 r3389688 46 46 * @return bool 47 47 */ 48 public function is_available( $languages = array() ) { 49 /** 50 * Return false in case it was directly called from parent and not from a derived class (DeepL / Google / TPAI) 51 * Calling this method on the parent class means it was called too early and machine translation is not available at this point 52 */ 53 if ( get_class( $this ) === __CLASS__ ) 54 return false; 55 56 $settings = $this->settings['trp_machine_translation_settings'] ?? array(); 57 $enabled = ( $settings['machine-translation'] ?? '' ) === 'yes'; 58 $is_available = false; 59 60 if ( $enabled ) { 61 $engine = $settings['translation-engine'] ?? null; 62 63 if ( $engine === 'deepl' && get_option( 'trp_license_status' ) !== 'valid' ) { 48 public function is_available( $languages = array() ){ 49 if( !empty( $this->settings['trp_machine_translation_settings']['machine-translation'] ) && 50 $this->settings['trp_machine_translation_settings']['machine-translation'] == 'yes' 51 ) { 52 if ( empty( $languages ) ){ 53 // can be used to simply know if machine translation is available 54 $is_available = true; 55 } 56 57 // If the license is invalid and the translation engine is DeepL,return false 58 $license_status = get_option( 'trp_license_status' ); 59 if ( $license_status !== 'valid' && isset( $this->settings['trp_machine_translation_settings']['translation-engine'] ) && $this->settings['trp_machine_translation_settings']['translation-engine'] === 'deepl' ) { 64 60 $is_available = false; 65 } elseif ( empty( $languages ) ) { 66 $is_available = true; 67 } else { 68 $is_available = $this->check_languages_availability( $languages ); 69 } 70 } 71 72 return apply_filters( 'trp_machine_translator_is_available', $is_available, $languages, $settings ); 61 } 62 63 $is_available = $this->check_languages_availability($languages); 64 65 }else { 66 $is_available = false; 67 } 68 69 return apply_filters('trp_machine_translator_is_available', $is_available); 73 70 } 74 71 -
translatepress-multilingual/trunk/includes/class-woocommerce-emails.php
r3389452 r3389688 245 245 WC()->load_plugin_textdomain(); 246 246 247 $this->bootstrap_trp_gettext_for_email s();247 $this->bootstrap_trp_gettext_for_email_language( $language ); 248 248 249 249 // calls necessary because the default additional_content field of an email is localized before this point and stored in a variable in the previous locale … … 289 289 * gettext translations stored in TranslatePress are applied correctly. 290 290 */ 291 private function bootstrap_trp_gettext_for_email s() {291 private function bootstrap_trp_gettext_for_email_language( $language ) { 292 292 $trp = TRP_Translate_Press::get_trp_instance(); 293 293 $gettext_manager = $trp->get_component( 'gettext_manager' ); … … 298 298 return; 299 299 300 if ( !$trp->get_component( 'machine_translator' ) )301 $trp->init_machine_translation(); // Machine translator should be initialized by the get_trp_instance() call. In the case of cron jobs, it is not - so we initialize it here manually.302 303 300 // Bypass processing_gettext_is_needed usual checks. Otherwise, the below method calls wouldn't go through 304 301 add_filter( 'trp_processing_gettext_is_needed', '__return_true' ); -
translatepress-multilingual/trunk/index.php
r3389452 r3389688 4 4 Plugin URI: https://translatepress.com/ 5 5 Description: Experience a better way of translating your WordPress site using a visual front-end translation editor, with full support for WooCommerce and site builders. 6 Version: 3.0. 26 Version: 3.0.3 7 7 Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban 8 8 Author URI: https://cozmoslabs.com/ -
translatepress-multilingual/trunk/languages/translatepress-multilingual.pot
r3389452 r3389688 7 7 "Content-Type: text/plain; charset=UTF-8\n" 8 8 "Content-Transfer-Encoding: 8bit\n" 9 "POT-Creation-Date: 2025-11-04 08:50+0000\n"9 "POT-Creation-Date: 2025-11-04 12:55+0000\n" 10 10 "X-Poedit-Basepath: ..\n" 11 11 "X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n" … … 343 343 msgstr "" 344 344 345 #: includes/class-machine-translator.php:15 5, includes/google-translate/class-google-translate-v2-machine-translator.php:190345 #: includes/class-machine-translator.php:152, includes/google-translate/class-google-translate-v2-machine-translator.php:190 346 346 msgid "Please enter your Google Translate key." 347 347 msgstr "" 348 348 349 #: includes/class-machine-translator.php:1 70, add-ons-pro/deepl/includes/class-deepl-machine-translator.php:386349 #: includes/class-machine-translator.php:167, add-ons-pro/deepl/includes/class-deepl-machine-translator.php:386 350 350 msgid "Please enter your DeepL API key." 351 351 msgstr "" -
translatepress-multilingual/trunk/readme.txt
r3389452 r3389688 6 6 Tested up to: 6.8.3 7 7 Requires PHP: 7.4 8 Stable tag: 3.0. 28 Stable tag: 3.0.3 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 143 143 144 144 == Changelog == 145 = 3.0.3 = 146 * Fixed an issue introduced in the previous update that occurred when using Google Translate as the translation engine 147 145 148 = 3.0.2 = 146 149 * Fixed potential security issue due to calling extract on shortcode attribute
Note: See TracChangeset
for help on using the changeset viewer.