Plugin Directory

Changeset 3353726


Ignore:
Timestamp:
09/01/2025 08:32:36 AM (3 months ago)
Author:
sbouey
Message:

Update to version 1.3.66

Location:
falang
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • falang/tags/1.3.66/README.txt

    r3338154 r3353726  
    66Tested up to: 6.8
    77Requires PHP: 5.6
    8 Stable tag: 1.3.65
     8Stable tag: 1.3.66
    99License: GPLv3 or later
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    111111== Changelog ==
    112112
     113* 1.3.66 (2025/09/01)
     114* fix theme editor save with slug
     115* fix bug with permalink since woocommerce 10.0.0
     116* fix object injection vulnerability's
     117
    113118* 1.3.65 (2025/08/02)
    114119* fix _load_textdomain_just_in_time (thanks to Alexandre Froger)
  • falang/tags/1.3.66/admin/class-falang-admin.php

    r3291681 r3353726  
    9191     *                add generic filter for service translation (use first in Elementor)
    9292     * @update 1.3.56 wp_nav_menu_item_custom_fields signature change
     93     * @update 1.3.66 add filter for home_url
     94     *                remove the load-post.php and load-post-new.php (done in the home_filter)
    9395     * */
    9496    public function load()
     
    106108        // Priority 5 to make sure filters are there before customize_register is fired
    107109        add_action('wp_loaded', array($this, 'add_filters'), 5);
     110
     111        add_filter('home_url', array($this,'translate_home_url'), 10, 4);
    108112
    109113        //post settings option
     
    181185        // Adds row meta links to the plugin list table aka Documentation and Faq
    182186        add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 2);
    183 
    184         // on load post.php
    185         add_action('load-post.php', array($this, 'admin_post_page'));
    186         add_action('load-post-new.php', array($this, 'admin_post_page'));
    187187
    188188        //on post meta-box-display add js
     
    715715     * @update 1.3.35 support serialised array translation
    716716     * @update 1.3.40 flush directly the rules if needed (necessary when page slulg change)
     717     * @update 1.3.66 fix object injection in unserialize
    717718     */
    718719    public function save_translation_post()
     
    754755            if (strlen($field_value) > 0) {
    755756                if (is_serialized($field_value)){
    756                     $field_value = unserialize(stripslashes(trim($field_value)));
     757                    // Safe to unserialize // https://heera.it/the-dangers-of-phps-unserialize-and-how-to-stay-safe
     758                    if (preg_match('/^[\w:;,.{}()=]+$/', $field_value)) {
     759                        $field_value = unserialize(stripslashes(trim($field_value)), ['allowed_classes' => false]);
     760                        update_post_meta($post_id, $meta_key, $field_value);
     761                    }
    757762                }
    758                 update_post_meta($post_id, $meta_key, $field_value);
    759763            } else {
    760764                delete_post_meta($post_id, $meta_key);
     
    25232527
    25242528
    2525     /* Posts UI
    2526     ----------------------------------------------- */
    2527 
    2528     /**
    2529      * Fire filters on post.php
    2530      *
    2531      * Hook for 'load-post.php'
    2532      *
    2533      * @from 1.2.3
    2534      */
    2535     public function admin_post_page()
    2536     {
    2537 
    2538         $current_screen = get_current_screen();
    2539         $falang_post = new \Falang\Core\Post();
    2540 
    2541         if ($this->model->get_languages_list() && isset($current_screen->post_type) && $falang_post->is_post_type_translatable($current_screen->post_type)) {
    2542 
    2543             // allow translate home url
    2544             add_filter('home_url', array($this, 'translate_home_url'), 10, 4);
    2545 
    2546         }
    2547 
    2548     }
    2549 
    25502529    /**
    25512530     * Translate post slug
     
    27162695
    27172696    /**
    2718      *    Append language slug to home url
    2719      *    Filter for 'home_url'
     2697     *  Append language slug to home url
     2698     *  Filter for 'home_url'
    27202699     *  exist for front too
    27212700     *
    27222701     * @from 1.0
     2702     * @update 1.3.66 translate_home_url is now in the wp_load filter to fix the bug when theme editor save with slug
     2703     *                for default language
     2704     *                the method for load-post.php and load-post-new.php is removed
    27232705     */
    27242706    public function translate_home_url($url, $path, $orig_scheme, $blog_id)
    27252707    {
    27262708        $language = $this->get_current_language();
     2709        $action = null;
     2710        $post_id = null;
    27272711
    27282712        //manage specific language on post/page
     
    27322716        if (isset($_REQUEST['action'])) {
    27332717            $action = $_REQUEST['action'];
     2718        }
     2719
     2720        //only supported action need to rewrite the home url in backend
     2721        //admin_post_page function and edit theme plugin
     2722        if (!isset($action) && 'edit' != $action && 'editpost' != $action && 'edit-theme-plugin-file' != $action ){
     2723            return $url;
    27342724        }
    27352725
  • falang/tags/1.3.66/public/class-falang-public.php

    r3291681 r3353726  
    107107     * @update 1.3.60 pub back the load_strings_translations to load
    108108     * @update 1.3.61 call set language to allow  WPML ICL_LANGUAGE_CODE and ICL_LANGUAGE_NAME define
     109     * @update 1.3.66 remove the fix for theme editor done in class-falang-admin.php (home_url)
    109110     */
    110111    public function load() {
    111         //theme_editor don't like falang with home slug - disable falang for theme editor check
    112         if (isset($_REQUEST['wp_scrape_key'])){
    113             return;
    114         }
    115112
    116113        if ($this->current_language = $this->get_current_language()) {
     
    165162            add_filter( 'widget_display_callback', array( $this, 'widget_display_callback' ), 10, 2 );
    166163            add_filter( 'sidebars_widgets', array( $this, 'sidebars_widgets' ) );
    167 
    168 
    169             //TODO check translate the post and the page.
    170 //          add_filter('the_posts', array($this, 'translate_the_posts'), 10, 2);
    171 //          add_filter('get_pages', array($this, 'translate_the_pages'), 10, 2);
    172164
    173165            $this->add_options_filters();
  • falang/trunk/README.txt

    r3338154 r3353726  
    66Tested up to: 6.8
    77Requires PHP: 5.6
    8 Stable tag: 1.3.65
     8Stable tag: 1.3.66
    99License: GPLv3 or later
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    111111== Changelog ==
    112112
     113* 1.3.66 (2025/09/01)
     114* fix theme editor save with slug
     115* fix bug with permalink since woocommerce 10.0.0
     116* fix object injection vulnerability's
     117
    113118* 1.3.65 (2025/08/02)
    114119* fix _load_textdomain_just_in_time (thanks to Alexandre Froger)
  • falang/trunk/admin/class-falang-admin.php

    r3291681 r3353726  
    9191     *                add generic filter for service translation (use first in Elementor)
    9292     * @update 1.3.56 wp_nav_menu_item_custom_fields signature change
     93     * @update 1.3.66 add filter for home_url
     94     *                remove the load-post.php and load-post-new.php (done in the home_filter)
    9395     * */
    9496    public function load()
     
    106108        // Priority 5 to make sure filters are there before customize_register is fired
    107109        add_action('wp_loaded', array($this, 'add_filters'), 5);
     110
     111        add_filter('home_url', array($this,'translate_home_url'), 10, 4);
    108112
    109113        //post settings option
     
    181185        // Adds row meta links to the plugin list table aka Documentation and Faq
    182186        add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 2);
    183 
    184         // on load post.php
    185         add_action('load-post.php', array($this, 'admin_post_page'));
    186         add_action('load-post-new.php', array($this, 'admin_post_page'));
    187187
    188188        //on post meta-box-display add js
     
    715715     * @update 1.3.35 support serialised array translation
    716716     * @update 1.3.40 flush directly the rules if needed (necessary when page slulg change)
     717     * @update 1.3.66 fix object injection in unserialize
    717718     */
    718719    public function save_translation_post()
     
    754755            if (strlen($field_value) > 0) {
    755756                if (is_serialized($field_value)){
    756                     $field_value = unserialize(stripslashes(trim($field_value)));
     757                    // Safe to unserialize // https://heera.it/the-dangers-of-phps-unserialize-and-how-to-stay-safe
     758                    if (preg_match('/^[\w:;,.{}()=]+$/', $field_value)) {
     759                        $field_value = unserialize(stripslashes(trim($field_value)), ['allowed_classes' => false]);
     760                        update_post_meta($post_id, $meta_key, $field_value);
     761                    }
    757762                }
    758                 update_post_meta($post_id, $meta_key, $field_value);
    759763            } else {
    760764                delete_post_meta($post_id, $meta_key);
     
    25232527
    25242528
    2525     /* Posts UI
    2526     ----------------------------------------------- */
    2527 
    2528     /**
    2529      * Fire filters on post.php
    2530      *
    2531      * Hook for 'load-post.php'
    2532      *
    2533      * @from 1.2.3
    2534      */
    2535     public function admin_post_page()
    2536     {
    2537 
    2538         $current_screen = get_current_screen();
    2539         $falang_post = new \Falang\Core\Post();
    2540 
    2541         if ($this->model->get_languages_list() && isset($current_screen->post_type) && $falang_post->is_post_type_translatable($current_screen->post_type)) {
    2542 
    2543             // allow translate home url
    2544             add_filter('home_url', array($this, 'translate_home_url'), 10, 4);
    2545 
    2546         }
    2547 
    2548     }
    2549 
    25502529    /**
    25512530     * Translate post slug
     
    27162695
    27172696    /**
    2718      *    Append language slug to home url
    2719      *    Filter for 'home_url'
     2697     *  Append language slug to home url
     2698     *  Filter for 'home_url'
    27202699     *  exist for front too
    27212700     *
    27222701     * @from 1.0
     2702     * @update 1.3.66 translate_home_url is now in the wp_load filter to fix the bug when theme editor save with slug
     2703     *                for default language
     2704     *                the method for load-post.php and load-post-new.php is removed
    27232705     */
    27242706    public function translate_home_url($url, $path, $orig_scheme, $blog_id)
    27252707    {
    27262708        $language = $this->get_current_language();
     2709        $action = null;
     2710        $post_id = null;
    27272711
    27282712        //manage specific language on post/page
     
    27322716        if (isset($_REQUEST['action'])) {
    27332717            $action = $_REQUEST['action'];
     2718        }
     2719
     2720        //only supported action need to rewrite the home url in backend
     2721        //admin_post_page function and edit theme plugin
     2722        if (!isset($action) && 'edit' != $action && 'editpost' != $action && 'edit-theme-plugin-file' != $action ){
     2723            return $url;
    27342724        }
    27352725
  • falang/trunk/public/class-falang-public.php

    r3291681 r3353726  
    107107     * @update 1.3.60 pub back the load_strings_translations to load
    108108     * @update 1.3.61 call set language to allow  WPML ICL_LANGUAGE_CODE and ICL_LANGUAGE_NAME define
     109     * @update 1.3.66 remove the fix for theme editor done in class-falang-admin.php (home_url)
    109110     */
    110111    public function load() {
    111         //theme_editor don't like falang with home slug - disable falang for theme editor check
    112         if (isset($_REQUEST['wp_scrape_key'])){
    113             return;
    114         }
    115112
    116113        if ($this->current_language = $this->get_current_language()) {
     
    165162            add_filter( 'widget_display_callback', array( $this, 'widget_display_callback' ), 10, 2 );
    166163            add_filter( 'sidebars_widgets', array( $this, 'sidebars_widgets' ) );
    167 
    168 
    169             //TODO check translate the post and the page.
    170 //          add_filter('the_posts', array($this, 'translate_the_posts'), 10, 2);
    171 //          add_filter('get_pages', array($this, 'translate_the_pages'), 10, 2);
    172164
    173165            $this->add_options_filters();
Note: See TracChangeset for help on using the changeset viewer.