Plugin Directory

Changeset 3338154


Ignore:
Timestamp:
08/02/2025 09:18:11 AM (4 months ago)
Author:
sbouey
Message:

Update to version 1.3.65

Location:
falang
Files:
8 edited
1 copied

Legend:

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

    r3320690 r3338154  
    66Tested up to: 6.8
    77Requires PHP: 5.6
    8 Stable tag: 1.3.64
     8Stable tag: 1.3.65
    99License: GPLv3 or later
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    111111== Changelog ==
    112112
     113* 1.3.65 (2025/08/02)
     114* fix _load_textdomain_just_in_time (thanks to Alexandre Froger)
     115* fix yoast title translation
     116* fix yoast category description (change in wpml-config.xml necessary)
     117* fix yoast graph slug write 2 times
     118* load custom wpml-config.xml in falang root directory
     119
    113120* 1.3.64 (2025/07/01)
    114121* fix yoast title translation (no variable in the title)
  • falang/tags/1.3.65/ext/wpml/wpml-config.php

    r2544178 r3338154  
    5252     *
    5353     * @since 1.3.1
     54     * @update 1.3.65 add custom wpml-config.xml in falang
    5455     */
    5556    public function init() {
     
    7879
    7980        // Custom
    80 //      if ( file_exists( $file = PLL_LOCAL_DIR . '/wpml-config.xml' ) && false !== $xml = simplexml_load_file( $file ) ) {
    81 //          $this->xmls['Polylang'] = $xml;
    82 //      }
     81        if ( file_exists( $file = FALANG_DIR . '/wpml-config.xml' ) && false !== $xml = simplexml_load_file( $file ) ) {
     82            $this->xmls['Falang'] = $xml;
     83        }
    8384
    8485        if ( ! empty( $this->xmls ) ) {
    85 //          add_filter( 'pll_copy_post_metas', array( $this, 'copy_post_metas' ), 20, 2 );
    86 //          add_filter( 'pll_copy_term_metas', array( $this, 'copy_term_metas' ), 20, 2 );
    87 //          add_filter( 'pll_get_post_types', array( $this, 'translate_types' ), 10, 2 );
    88 //          add_filter( 'pll_get_taxonomies', array( $this, 'translate_taxonomies' ), 10, 2 );
    89 
    9086            foreach ( $this->xmls as $context => $xml ) {
    9187                $keys = $xml->xpath( 'admin-texts/key' );
  • falang/tags/1.3.65/src/Falang/Core/Falang_Mo.php

    r2544178 r3338154  
    1616     *
    1717     * @since 1.2
     18     * @update 1.3.65 fix _load_textdomain_just_in_time warning thanks to Alexandre Froger
    1819     */
    1920    public function __construct() {
    2021        //TODO put here or on Falang install
    2122        if ( ! post_type_exists( 'falang_mo' ) ) {
    22             $labels = array( 'name' => __( 'String translations', 'falang' ) );
    23             register_post_type( 'falang_mo', array( 'labels' => $labels, 'rewrite' => false, 'query_var' => false, '_falang' => true ) );
     23            //$labels = array( 'name' => __( 'String translations', 'falang' ) );
     24            //register_post_type( 'falang_mo', array( 'labels' => $labels, 'rewrite' => false, 'query_var' => false, '_falang' => true ) );
     25            if ( ! has_action( 'init', array( __CLASS__, 'initialize_post_type' ) ) ) {
     26                add_action( 'init', array( __CLASS__, 'initialize_post_type' ) );
     27            }
    2428        }
    2529    }
    2630
     31    /**
     32     * init post type use for fixing _load_textdomain_just_in_time
     33     *
     34     * @since 1.3.65
     35     */
     36    public static function initialize_post_type() {
     37        $labels = array( 'name' => __( 'String translations', 'falang' ) );
     38        register_post_type( 'falang_mo', array( 'labels' => $labels, 'rewrite' => false, 'query_var' => false, '_falang' => true ) );
     39    }
    2740
    2841    /**
  • falang/tags/1.3.65/src/Falang/Filter/Site/Yoast.php

    r3320690 r3338154  
    11<?php
    22
    3 
    43namespace Falang\Filter\Site;
    5 
    6 
    7 use Falang\Core\Taxonomy;
    84
    95class Yoast {
     
    5652     * @since 1.3.27 add isset on $data['publisher']['@id'] and  $data['potentialAction'][0]['target']
    5753     * @since 1.3.30 php 8 waring fix $data is an array
     54     * @update 1.3.65 fix double slug in url
    5855     */
    5956    public function wpseo_schema_url($data){
     
    6360        $home_url=home_url('/');
    6461        $home_default =str_replace('/'.Falang()->current_language->slug,'',$home_url);
    65 
     62        $curr_slug = Falang()->current_language->slug;
    6663        if (isset($data['url'])){
    6764            $data['url']=str_replace($home_default, $home_url,$data['url']);
     65            //remove duplicate slug if exist
     66            $data['url'] = str_replace('/'.$curr_slug.'/'.$curr_slug.'/','/'.$curr_slug.'/',$data['url']);
    6867        }
    6968        if (isset($data['@id'])){
    7069            $data['@id']=str_replace($home_default, $home_url,$data['@id']);
     70            $data['@id'] = str_replace('/'.$curr_slug.'/'.$curr_slug.'/','/'.$curr_slug.'/',$data['@id']);
    7171        }
    7272        //additional replacments because some of them were in internal array. Not all links should be changed thats why it's targeting only selected.
     
    122122     * @update 1.3.57 fix from Stamatios Aronis
    123123     * @update 1.3.64 fix yoast title translation (no variable in the title)
     124     * @update 1.3.65 fix yoast title translation (original value was use with separator)
    124125     * */
    125126    private function translate_title($title,$presentation,array $optionNames) {
     
    155156                //1.3.64 change due to improvment
    156157                //nothing to filter use directly the title
    157                 if (strpos($presentation->title, '%%') !== false) {
    158                     $title = wpseo_replace_vars($presentation->title, array("post_title" => $title));
     158                //1.3.65 the title to use is the translated
     159                if (strpos($title, '%%') !== false) {
     160                    $title = wpseo_replace_vars($title, array("post_title" => $title));
    159161                }
    160162
     
    179181     * @param Indexable_Presentation $presentation The presentation of an indexable.
    180182     * @return string The description sentence.
     183     *
     184     * @update 1.3.65 fix category description (need change in wpml-config.xml from yoast)
    181185     */
    182186    public function translate_description($description, $presentation,$optionNames) {
     
    187191
    188192        if ($object_type == 'term'){
    189             //$falang_taxo = new \Falang\Core\Taxonomy($object_id,Falang()->get_model());
    190             $term=get_term($object_id);
    191             $description=term_description($term);
     193            //load the descripion set in options (or register by the string )
     194            $description = falang__($description);
    192195        } else {
    193196            //post, page, product
  • falang/trunk/README.txt

    r3320690 r3338154  
    66Tested up to: 6.8
    77Requires PHP: 5.6
    8 Stable tag: 1.3.64
     8Stable tag: 1.3.65
    99License: GPLv3 or later
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    111111== Changelog ==
    112112
     113* 1.3.65 (2025/08/02)
     114* fix _load_textdomain_just_in_time (thanks to Alexandre Froger)
     115* fix yoast title translation
     116* fix yoast category description (change in wpml-config.xml necessary)
     117* fix yoast graph slug write 2 times
     118* load custom wpml-config.xml in falang root directory
     119
    113120* 1.3.64 (2025/07/01)
    114121* fix yoast title translation (no variable in the title)
  • falang/trunk/ext/wpml/wpml-config.php

    r2544178 r3338154  
    5252     *
    5353     * @since 1.3.1
     54     * @update 1.3.65 add custom wpml-config.xml in falang
    5455     */
    5556    public function init() {
     
    7879
    7980        // Custom
    80 //      if ( file_exists( $file = PLL_LOCAL_DIR . '/wpml-config.xml' ) && false !== $xml = simplexml_load_file( $file ) ) {
    81 //          $this->xmls['Polylang'] = $xml;
    82 //      }
     81        if ( file_exists( $file = FALANG_DIR . '/wpml-config.xml' ) && false !== $xml = simplexml_load_file( $file ) ) {
     82            $this->xmls['Falang'] = $xml;
     83        }
    8384
    8485        if ( ! empty( $this->xmls ) ) {
    85 //          add_filter( 'pll_copy_post_metas', array( $this, 'copy_post_metas' ), 20, 2 );
    86 //          add_filter( 'pll_copy_term_metas', array( $this, 'copy_term_metas' ), 20, 2 );
    87 //          add_filter( 'pll_get_post_types', array( $this, 'translate_types' ), 10, 2 );
    88 //          add_filter( 'pll_get_taxonomies', array( $this, 'translate_taxonomies' ), 10, 2 );
    89 
    9086            foreach ( $this->xmls as $context => $xml ) {
    9187                $keys = $xml->xpath( 'admin-texts/key' );
  • falang/trunk/src/Falang/Core/Falang_Mo.php

    r2544178 r3338154  
    1616     *
    1717     * @since 1.2
     18     * @update 1.3.65 fix _load_textdomain_just_in_time warning thanks to Alexandre Froger
    1819     */
    1920    public function __construct() {
    2021        //TODO put here or on Falang install
    2122        if ( ! post_type_exists( 'falang_mo' ) ) {
    22             $labels = array( 'name' => __( 'String translations', 'falang' ) );
    23             register_post_type( 'falang_mo', array( 'labels' => $labels, 'rewrite' => false, 'query_var' => false, '_falang' => true ) );
     23            //$labels = array( 'name' => __( 'String translations', 'falang' ) );
     24            //register_post_type( 'falang_mo', array( 'labels' => $labels, 'rewrite' => false, 'query_var' => false, '_falang' => true ) );
     25            if ( ! has_action( 'init', array( __CLASS__, 'initialize_post_type' ) ) ) {
     26                add_action( 'init', array( __CLASS__, 'initialize_post_type' ) );
     27            }
    2428        }
    2529    }
    2630
     31    /**
     32     * init post type use for fixing _load_textdomain_just_in_time
     33     *
     34     * @since 1.3.65
     35     */
     36    public static function initialize_post_type() {
     37        $labels = array( 'name' => __( 'String translations', 'falang' ) );
     38        register_post_type( 'falang_mo', array( 'labels' => $labels, 'rewrite' => false, 'query_var' => false, '_falang' => true ) );
     39    }
    2740
    2841    /**
  • falang/trunk/src/Falang/Filter/Site/Yoast.php

    r3320690 r3338154  
    11<?php
    22
    3 
    43namespace Falang\Filter\Site;
    5 
    6 
    7 use Falang\Core\Taxonomy;
    84
    95class Yoast {
     
    5652     * @since 1.3.27 add isset on $data['publisher']['@id'] and  $data['potentialAction'][0]['target']
    5753     * @since 1.3.30 php 8 waring fix $data is an array
     54     * @update 1.3.65 fix double slug in url
    5855     */
    5956    public function wpseo_schema_url($data){
     
    6360        $home_url=home_url('/');
    6461        $home_default =str_replace('/'.Falang()->current_language->slug,'',$home_url);
    65 
     62        $curr_slug = Falang()->current_language->slug;
    6663        if (isset($data['url'])){
    6764            $data['url']=str_replace($home_default, $home_url,$data['url']);
     65            //remove duplicate slug if exist
     66            $data['url'] = str_replace('/'.$curr_slug.'/'.$curr_slug.'/','/'.$curr_slug.'/',$data['url']);
    6867        }
    6968        if (isset($data['@id'])){
    7069            $data['@id']=str_replace($home_default, $home_url,$data['@id']);
     70            $data['@id'] = str_replace('/'.$curr_slug.'/'.$curr_slug.'/','/'.$curr_slug.'/',$data['@id']);
    7171        }
    7272        //additional replacments because some of them were in internal array. Not all links should be changed thats why it's targeting only selected.
     
    122122     * @update 1.3.57 fix from Stamatios Aronis
    123123     * @update 1.3.64 fix yoast title translation (no variable in the title)
     124     * @update 1.3.65 fix yoast title translation (original value was use with separator)
    124125     * */
    125126    private function translate_title($title,$presentation,array $optionNames) {
     
    155156                //1.3.64 change due to improvment
    156157                //nothing to filter use directly the title
    157                 if (strpos($presentation->title, '%%') !== false) {
    158                     $title = wpseo_replace_vars($presentation->title, array("post_title" => $title));
     158                //1.3.65 the title to use is the translated
     159                if (strpos($title, '%%') !== false) {
     160                    $title = wpseo_replace_vars($title, array("post_title" => $title));
    159161                }
    160162
     
    179181     * @param Indexable_Presentation $presentation The presentation of an indexable.
    180182     * @return string The description sentence.
     183     *
     184     * @update 1.3.65 fix category description (need change in wpml-config.xml from yoast)
    181185     */
    182186    public function translate_description($description, $presentation,$optionNames) {
     
    187191
    188192        if ($object_type == 'term'){
    189             //$falang_taxo = new \Falang\Core\Taxonomy($object_id,Falang()->get_model());
    190             $term=get_term($object_id);
    191             $description=term_description($term);
     193            //load the descripion set in options (or register by the string )
     194            $description = falang__($description);
    192195        } else {
    193196            //post, page, product
Note: See TracChangeset for help on using the changeset viewer.