Plugin Directory

Changeset 3389688


Ignore:
Timestamp:
11/04/2025 01:10:58 PM (4 months ago)
Author:
razvan.mo
Message:

tagging version 3.0.3

Location:
translatepress-multilingual
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • translatepress-multilingual/tags/3.0.3/class-translate-press.php

    r3389452 r3389688  
    6868     */
    6969    public function __construct() {
    70         // Early bind to break recursion loop caused by calling get_trp_instance during construction
    71         if ( self::$translate_press === null ) {
    72             self::$translate_press = $this;
    73         }
    74 
    7570        define( 'TRP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    7671        define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
    7772        define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
    7873        define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
    79         define( 'TRP_PLUGIN_VERSION', '3.0.2' );
     74        define( 'TRP_PLUGIN_VERSION', '3.0.3' );
    8075
    8176        wp_cache_add_non_persistent_groups(array('trp'));
     
    108103        require_once TRP_PLUGIN_DIR . 'includes/class-editor-api-regular-strings.php';
    109104        require_once TRP_PLUGIN_DIR . 'includes/class-editor-api-gettext-strings.php';
     105        require_once TRP_PLUGIN_DIR . 'includes/class-translation-manager.php';
    110106        require_once TRP_PLUGIN_DIR . 'includes/class-hooks-loader.php';
    111107        require_once TRP_PLUGIN_DIR . 'includes/class-languages.php';
     
    184180        $this->query                      = new TRP_Query( $this->settings->get_settings() );
    185181        $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.
    187182        $this->translation_manager        = new TRP_Translation_Manager( $this->settings->get_settings() );
    188183        $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  
    4646     * @return bool
    4747     */
    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' ) {
    6460                $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);
    7370    }
    7471
  • translatepress-multilingual/tags/3.0.3/includes/class-woocommerce-emails.php

    r3389452 r3389688  
    245245        WC()->load_plugin_textdomain();
    246246
    247         $this->bootstrap_trp_gettext_for_emails();
     247        $this->bootstrap_trp_gettext_for_email_language( $language );
    248248
    249249        // 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
     
    289289     * gettext translations stored in TranslatePress are applied correctly.
    290290     */
    291     private function bootstrap_trp_gettext_for_emails() {
     291    private function bootstrap_trp_gettext_for_email_language( $language ) {
    292292        $trp             = TRP_Translate_Press::get_trp_instance();
    293293        $gettext_manager = $trp->get_component( 'gettext_manager' );
     
    298298            return;
    299299
    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 
    303300        // Bypass processing_gettext_is_needed usual checks. Otherwise, the below method calls wouldn't go through
    304301        add_filter( 'trp_processing_gettext_is_needed', '__return_true' );
  • translatepress-multilingual/tags/3.0.3/index.php

    r3389452 r3389688  
    44Plugin URI: https://translatepress.com/
    55Description: 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.2
     6Version: 3.0.3
    77Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
    88Author URI: https://cozmoslabs.com/
  • translatepress-multilingual/tags/3.0.3/languages/translatepress-multilingual.pot

    r3389452 r3389688  
    77"Content-Type: text/plain; charset=UTF-8\n"
    88"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"
    1010"X-Poedit-Basepath: ..\n"
    1111"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"
     
    343343msgstr ""
    344344
    345 #: includes/class-machine-translator.php:155, includes/google-translate/class-google-translate-v2-machine-translator.php:190
     345#: includes/class-machine-translator.php:152, includes/google-translate/class-google-translate-v2-machine-translator.php:190
    346346msgid "Please enter your Google Translate key."
    347347msgstr ""
    348348
    349 #: includes/class-machine-translator.php:170, add-ons-pro/deepl/includes/class-deepl-machine-translator.php:386
     349#: includes/class-machine-translator.php:167, add-ons-pro/deepl/includes/class-deepl-machine-translator.php:386
    350350msgid "Please enter your DeepL API key."
    351351msgstr ""
  • translatepress-multilingual/tags/3.0.3/readme.txt

    r3389452 r3389688  
    66Tested up to: 6.8.3
    77Requires PHP: 7.4
    8 Stable tag: 3.0.2
     8Stable tag: 3.0.3
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    143143
    144144== 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
    145148= 3.0.2 =
    146149* Fixed potential security issue due to calling extract on shortcode attribute
  • translatepress-multilingual/trunk/class-translate-press.php

    r3389452 r3389688  
    6868     */
    6969    public function __construct() {
    70         // Early bind to break recursion loop caused by calling get_trp_instance during construction
    71         if ( self::$translate_press === null ) {
    72             self::$translate_press = $this;
    73         }
    74 
    7570        define( 'TRP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    7671        define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
    7772        define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
    7873        define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
    79         define( 'TRP_PLUGIN_VERSION', '3.0.2' );
     74        define( 'TRP_PLUGIN_VERSION', '3.0.3' );
    8075
    8176        wp_cache_add_non_persistent_groups(array('trp'));
     
    108103        require_once TRP_PLUGIN_DIR . 'includes/class-editor-api-regular-strings.php';
    109104        require_once TRP_PLUGIN_DIR . 'includes/class-editor-api-gettext-strings.php';
     105        require_once TRP_PLUGIN_DIR . 'includes/class-translation-manager.php';
    110106        require_once TRP_PLUGIN_DIR . 'includes/class-hooks-loader.php';
    111107        require_once TRP_PLUGIN_DIR . 'includes/class-languages.php';
     
    184180        $this->query                      = new TRP_Query( $this->settings->get_settings() );
    185181        $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.
    187182        $this->translation_manager        = new TRP_Translation_Manager( $this->settings->get_settings() );
    188183        $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  
    4646     * @return bool
    4747     */
    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' ) {
    6460                $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);
    7370    }
    7471
  • translatepress-multilingual/trunk/includes/class-woocommerce-emails.php

    r3389452 r3389688  
    245245        WC()->load_plugin_textdomain();
    246246
    247         $this->bootstrap_trp_gettext_for_emails();
     247        $this->bootstrap_trp_gettext_for_email_language( $language );
    248248
    249249        // 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
     
    289289     * gettext translations stored in TranslatePress are applied correctly.
    290290     */
    291     private function bootstrap_trp_gettext_for_emails() {
     291    private function bootstrap_trp_gettext_for_email_language( $language ) {
    292292        $trp             = TRP_Translate_Press::get_trp_instance();
    293293        $gettext_manager = $trp->get_component( 'gettext_manager' );
     
    298298            return;
    299299
    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 
    303300        // Bypass processing_gettext_is_needed usual checks. Otherwise, the below method calls wouldn't go through
    304301        add_filter( 'trp_processing_gettext_is_needed', '__return_true' );
  • translatepress-multilingual/trunk/index.php

    r3389452 r3389688  
    44Plugin URI: https://translatepress.com/
    55Description: 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.2
     6Version: 3.0.3
    77Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
    88Author URI: https://cozmoslabs.com/
  • translatepress-multilingual/trunk/languages/translatepress-multilingual.pot

    r3389452 r3389688  
    77"Content-Type: text/plain; charset=UTF-8\n"
    88"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"
    1010"X-Poedit-Basepath: ..\n"
    1111"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"
     
    343343msgstr ""
    344344
    345 #: includes/class-machine-translator.php:155, includes/google-translate/class-google-translate-v2-machine-translator.php:190
     345#: includes/class-machine-translator.php:152, includes/google-translate/class-google-translate-v2-machine-translator.php:190
    346346msgid "Please enter your Google Translate key."
    347347msgstr ""
    348348
    349 #: includes/class-machine-translator.php:170, add-ons-pro/deepl/includes/class-deepl-machine-translator.php:386
     349#: includes/class-machine-translator.php:167, add-ons-pro/deepl/includes/class-deepl-machine-translator.php:386
    350350msgid "Please enter your DeepL API key."
    351351msgstr ""
  • translatepress-multilingual/trunk/readme.txt

    r3389452 r3389688  
    66Tested up to: 6.8.3
    77Requires PHP: 7.4
    8 Stable tag: 3.0.2
     8Stable tag: 3.0.3
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    143143
    144144== 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
    145148= 3.0.2 =
    146149* Fixed potential security issue due to calling extract on shortcode attribute
Note: See TracChangeset for help on using the changeset viewer.