Changeset 3338154
- Timestamp:
- 08/02/2025 09:18:11 AM (4 months ago)
- Location:
- falang
- Files:
-
- 8 edited
- 1 copied
-
tags/1.3.65 (copied) (copied from falang/trunk)
-
tags/1.3.65/README.txt (modified) (2 diffs)
-
tags/1.3.65/ext/wpml/wpml-config.php (modified) (2 diffs)
-
tags/1.3.65/src/Falang/Core/Falang_Mo.php (modified) (1 diff)
-
tags/1.3.65/src/Falang/Filter/Site/Yoast.php (modified) (7 diffs)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/ext/wpml/wpml-config.php (modified) (2 diffs)
-
trunk/src/Falang/Core/Falang_Mo.php (modified) (1 diff)
-
trunk/src/Falang/Filter/Site/Yoast.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
falang/tags/1.3.65/README.txt
r3320690 r3338154 6 6 Tested up to: 6.8 7 7 Requires PHP: 5.6 8 Stable tag: 1.3.6 48 Stable tag: 1.3.65 9 9 License: GPLv3 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 111 111 == Changelog == 112 112 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 113 120 * 1.3.64 (2025/07/01) 114 121 * fix yoast title translation (no variable in the title) -
falang/tags/1.3.65/ext/wpml/wpml-config.php
r2544178 r3338154 52 52 * 53 53 * @since 1.3.1 54 * @update 1.3.65 add custom wpml-config.xml in falang 54 55 */ 55 56 public function init() { … … 78 79 79 80 // 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 } 83 84 84 85 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 90 86 foreach ( $this->xmls as $context => $xml ) { 91 87 $keys = $xml->xpath( 'admin-texts/key' ); -
falang/tags/1.3.65/src/Falang/Core/Falang_Mo.php
r2544178 r3338154 16 16 * 17 17 * @since 1.2 18 * @update 1.3.65 fix _load_textdomain_just_in_time warning thanks to Alexandre Froger 18 19 */ 19 20 public function __construct() { 20 21 //TODO put here or on Falang install 21 22 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 } 24 28 } 25 29 } 26 30 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 } 27 40 28 41 /** -
falang/tags/1.3.65/src/Falang/Filter/Site/Yoast.php
r3320690 r3338154 1 1 <?php 2 2 3 4 3 namespace Falang\Filter\Site; 5 6 7 use Falang\Core\Taxonomy;8 4 9 5 class Yoast { … … 56 52 * @since 1.3.27 add isset on $data['publisher']['@id'] and $data['potentialAction'][0]['target'] 57 53 * @since 1.3.30 php 8 waring fix $data is an array 54 * @update 1.3.65 fix double slug in url 58 55 */ 59 56 public function wpseo_schema_url($data){ … … 63 60 $home_url=home_url('/'); 64 61 $home_default =str_replace('/'.Falang()->current_language->slug,'',$home_url); 65 62 $curr_slug = Falang()->current_language->slug; 66 63 if (isset($data['url'])){ 67 64 $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']); 68 67 } 69 68 if (isset($data['@id'])){ 70 69 $data['@id']=str_replace($home_default, $home_url,$data['@id']); 70 $data['@id'] = str_replace('/'.$curr_slug.'/'.$curr_slug.'/','/'.$curr_slug.'/',$data['@id']); 71 71 } 72 72 //additional replacments because some of them were in internal array. Not all links should be changed thats why it's targeting only selected. … … 122 122 * @update 1.3.57 fix from Stamatios Aronis 123 123 * @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) 124 125 * */ 125 126 private function translate_title($title,$presentation,array $optionNames) { … … 155 156 //1.3.64 change due to improvment 156 157 //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)); 159 161 } 160 162 … … 179 181 * @param Indexable_Presentation $presentation The presentation of an indexable. 180 182 * @return string The description sentence. 183 * 184 * @update 1.3.65 fix category description (need change in wpml-config.xml from yoast) 181 185 */ 182 186 public function translate_description($description, $presentation,$optionNames) { … … 187 191 188 192 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); 192 195 } else { 193 196 //post, page, product -
falang/trunk/README.txt
r3320690 r3338154 6 6 Tested up to: 6.8 7 7 Requires PHP: 5.6 8 Stable tag: 1.3.6 48 Stable tag: 1.3.65 9 9 License: GPLv3 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 111 111 == Changelog == 112 112 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 113 120 * 1.3.64 (2025/07/01) 114 121 * fix yoast title translation (no variable in the title) -
falang/trunk/ext/wpml/wpml-config.php
r2544178 r3338154 52 52 * 53 53 * @since 1.3.1 54 * @update 1.3.65 add custom wpml-config.xml in falang 54 55 */ 55 56 public function init() { … … 78 79 79 80 // 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 } 83 84 84 85 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 90 86 foreach ( $this->xmls as $context => $xml ) { 91 87 $keys = $xml->xpath( 'admin-texts/key' ); -
falang/trunk/src/Falang/Core/Falang_Mo.php
r2544178 r3338154 16 16 * 17 17 * @since 1.2 18 * @update 1.3.65 fix _load_textdomain_just_in_time warning thanks to Alexandre Froger 18 19 */ 19 20 public function __construct() { 20 21 //TODO put here or on Falang install 21 22 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 } 24 28 } 25 29 } 26 30 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 } 27 40 28 41 /** -
falang/trunk/src/Falang/Filter/Site/Yoast.php
r3320690 r3338154 1 1 <?php 2 2 3 4 3 namespace Falang\Filter\Site; 5 6 7 use Falang\Core\Taxonomy;8 4 9 5 class Yoast { … … 56 52 * @since 1.3.27 add isset on $data['publisher']['@id'] and $data['potentialAction'][0]['target'] 57 53 * @since 1.3.30 php 8 waring fix $data is an array 54 * @update 1.3.65 fix double slug in url 58 55 */ 59 56 public function wpseo_schema_url($data){ … … 63 60 $home_url=home_url('/'); 64 61 $home_default =str_replace('/'.Falang()->current_language->slug,'',$home_url); 65 62 $curr_slug = Falang()->current_language->slug; 66 63 if (isset($data['url'])){ 67 64 $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']); 68 67 } 69 68 if (isset($data['@id'])){ 70 69 $data['@id']=str_replace($home_default, $home_url,$data['@id']); 70 $data['@id'] = str_replace('/'.$curr_slug.'/'.$curr_slug.'/','/'.$curr_slug.'/',$data['@id']); 71 71 } 72 72 //additional replacments because some of them were in internal array. Not all links should be changed thats why it's targeting only selected. … … 122 122 * @update 1.3.57 fix from Stamatios Aronis 123 123 * @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) 124 125 * */ 125 126 private function translate_title($title,$presentation,array $optionNames) { … … 155 156 //1.3.64 change due to improvment 156 157 //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)); 159 161 } 160 162 … … 179 181 * @param Indexable_Presentation $presentation The presentation of an indexable. 180 182 * @return string The description sentence. 183 * 184 * @update 1.3.65 fix category description (need change in wpml-config.xml from yoast) 181 185 */ 182 186 public function translate_description($description, $presentation,$optionNames) { … … 187 191 188 192 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); 192 195 } else { 193 196 //post, page, product
Note: See TracChangeset
for help on using the changeset viewer.