Polylang - Version 2.3.4

Version Description

(2018-03-27) =

  • Pro: Fix conflict with Pods related to translated slugs for custom post types
  • Add Friulian to the predefined languages list
  • Fix conflict (javascript error) with Gtenberg #225
  • Fix conflict on ajax requests introduced by WooCoommerce 3.3.4
  • Fix queries by 'category_name' not auto translated #238
Download this release

Release Info

Developer Chouby
Plugin Icon 128x128 Polylang
Version 2.3.4
Comparing to
See all releases

Code changes from version 2.3.3 to 2.3.4

admin/admin-base.php CHANGED
@@ -115,7 +115,7 @@ class PLL_Admin_Base extends PLL_Base {
115
  // 3 => 1 if loaded in footer
116
  // FIXME: check if I can load more scripts in footer
117
  $scripts = array(
118
- 'post' => array( array( 'post', 'media', 'async-upload', 'edit' ), array( 'jquery', 'wp-ajax-response', 'post', 'jquery-ui-autocomplete' ), 0, 1 ),
119
  'media' => array( array( 'upload' ), array( 'jquery' ), 0, 1 ),
120
  'term' => array( array( 'edit-tags', 'term' ), array( 'jquery', 'wp-ajax-response', 'jquery-ui-autocomplete' ), 0, 1 ),
121
  'user' => array( array( 'profile', 'user-edit' ), array( 'jquery' ), 0, 0 ),
115
  // 3 => 1 if loaded in footer
116
  // FIXME: check if I can load more scripts in footer
117
  $scripts = array(
118
+ 'post' => array( array( 'post', 'media', 'async-upload', 'edit' ), array( 'jquery', 'wp-ajax-response', 'post', 'jquery-ui-autocomplete' ), 0, 0 ),
119
  'media' => array( array( 'upload' ), array( 'jquery' ), 0, 1 ),
120
  'term' => array( array( 'edit-tags', 'term' ), array( 'jquery', 'wp-ajax-response', 'jquery-ui-autocomplete' ), 0, 1 ),
121
  'user' => array( array( 'profile', 'user-edit' ), array( 'jquery' ), 0, 0 ),
frontend/frontend-auto-translate.php CHANGED
@@ -80,7 +80,7 @@ class PLL_Frontend_Auto_Translate {
80
  $arr = array();
81
  if ( ! empty( $qv['category_name'] ) ) {
82
  foreach ( explode( ',', $qv['category_name'] ) as $slug ) {
83
- $arr[] = ( ( $cat = wpcom_vip_get_category_by_slug( $slug ) ) && ( $tr_id = $this->get_term( $cat->term_id ) ) && ! is_wp_error( $tr = get_category( $tr_id ) ) ) ? $tr->slug : $slug;
84
  }
85
 
86
  $qv['category_name'] = implode( ',', $arr );
80
  $arr = array();
81
  if ( ! empty( $qv['category_name'] ) ) {
82
  foreach ( explode( ',', $qv['category_name'] ) as $slug ) {
83
+ $arr[] = $this->get_translated_term_by( 'slug', $slug, 'category' );
84
  }
85
 
86
  $qv['category_name'] = implode( ',', $arr );
include/links-directory.php CHANGED
@@ -8,6 +8,7 @@
8
  * @since 1.2
9
  */
10
  class PLL_Links_Directory extends PLL_Links_Permalinks {
 
11
 
12
  /**
13
  * Constructor
@@ -19,6 +20,8 @@ class PLL_Links_Directory extends PLL_Links_Permalinks {
19
  public function __construct( &$model ) {
20
  parent::__construct( $model );
21
 
 
 
22
  if ( did_action( 'pll_init' ) ) {
23
  $this->init();
24
  } else {
@@ -56,8 +59,12 @@ class PLL_Links_Directory extends PLL_Links_Permalinks {
56
  if ( ! empty( $lang ) ) {
57
  $base = $this->options['rewrite'] ? '' : 'language/';
58
  $slug = $this->options['default_lang'] == $lang->slug && $this->options['hide_default'] ? '' : $base . $lang->slug . '/';
59
- if ( false === strpos( $url, $this->home . '/' . $this->root . $slug ) ) {
60
- return str_replace( $this->home . '/' . $this->root, $this->home . '/' . $this->root . $slug, $url );
 
 
 
 
61
  }
62
  }
63
  return $url;
@@ -80,9 +87,11 @@ class PLL_Links_Directory extends PLL_Links_Permalinks {
80
  }
81
 
82
  if ( ! empty( $languages ) ) {
83
- $pattern = str_replace( '/', '\/', $this->home . '/' . $this->root );
 
 
84
  $pattern = '#' . $pattern . ( $this->options['rewrite'] ? '' : 'language\/' ) . '(' . implode( '|', $languages ) . ')(\/|$)#';
85
- $url = preg_replace( $pattern, $this->home . '/' . $this->root, $url );
86
  }
87
  return $url;
88
  }
@@ -104,7 +113,9 @@ class PLL_Links_Directory extends PLL_Links_Permalinks {
104
  $path = parse_url( $url, PHP_URL_PATH );
105
  }
106
 
107
- $pattern = parse_url( $this->home . '/' . $this->root . ( $this->options['rewrite'] ? '' : 'language/' ), PHP_URL_PATH );
 
 
108
  $pattern = str_replace( '/', '\/', $pattern );
109
  $pattern = '#' . $pattern . '(' . implode( '|', $this->model->get_languages_list( array( 'fields' => 'slug' ) ) ) . ')(\/|$)#';
110
  return preg_match( $pattern, trailingslashit( $path ), $matches ) ? $matches[1] : ''; // $matches[1] is the slug of the requested language
8
  * @since 1.2
9
  */
10
  class PLL_Links_Directory extends PLL_Links_Permalinks {
11
+ protected $home_relative;
12
 
13
  /**
14
  * Constructor
20
  public function __construct( &$model ) {
21
  parent::__construct( $model );
22
 
23
+ $this->home_relative = home_url( '/', 'relative' );
24
+
25
  if ( did_action( 'pll_init' ) ) {
26
  $this->init();
27
  } else {
59
  if ( ! empty( $lang ) ) {
60
  $base = $this->options['rewrite'] ? '' : 'language/';
61
  $slug = $this->options['default_lang'] == $lang->slug && $this->options['hide_default'] ? '' : $base . $lang->slug . '/';
62
+ $root = ( false === strpos( $url, '://' ) ) ? $this->home_relative . $this->root : $this->home . '/' . $this->root;
63
+
64
+ if ( false === strpos( $url, $new = $root . $slug ) ) {
65
+ $pattern = str_replace( '/', '\/', $root );
66
+ $pattern = '#' . $pattern . '#';
67
+ return preg_replace( $pattern, $new, $url, 1 ); // Only once
68
  }
69
  }
70
  return $url;
87
  }
88
 
89
  if ( ! empty( $languages ) ) {
90
+ $root = ( false === strpos( $url, '://' ) ) ? $this->home_relative . $this->root : $this->home . '/' . $this->root;
91
+
92
+ $pattern = str_replace( '/', '\/', $root );
93
  $pattern = '#' . $pattern . ( $this->options['rewrite'] ? '' : 'language\/' ) . '(' . implode( '|', $languages ) . ')(\/|$)#';
94
+ $url = preg_replace( $pattern, $root, $url );
95
  }
96
  return $url;
97
  }
113
  $path = parse_url( $url, PHP_URL_PATH );
114
  }
115
 
116
+ $root = ( false === strpos( $url, '://' ) ) ? $this->home_relative . $this->root : $this->home . '/' . $this->root;
117
+
118
+ $pattern = parse_url( $root . ( $this->options['rewrite'] ? '' : 'language/' ), PHP_URL_PATH );
119
  $pattern = str_replace( '/', '\/', $pattern );
120
  $pattern = '#' . $pattern . '(' . implode( '|', $this->model->get_languages_list( array( 'fields' => 'slug' ) ) ) . ')(\/|$)#';
121
  return preg_match( $pattern, trailingslashit( $path ), $matches ) ? $matches[1] : ''; // $matches[1] is the slug of the requested language
polylang.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  Plugin Name: Polylang
5
  Plugin URI: https://polylang.pro
6
- Version: 2.3.3
7
  Author: Frédéric Demarle
8
  Author uri: https://polylang.pro
9
  Description: Adds multilingual capability to WordPress
@@ -53,7 +53,7 @@ if ( defined( 'POLYLANG_BASENAME' ) ) {
53
  }
54
  } else {
55
  // Go on loading the plugin
56
- define( 'POLYLANG_VERSION', '2.3.3' );
57
  define( 'PLL_MIN_WP_VERSION', '4.4' );
58
 
59
  define( 'POLYLANG_FILE', __FILE__ ); // this file
3
  /**
4
  Plugin Name: Polylang
5
  Plugin URI: https://polylang.pro
6
+ Version: 2.3.4
7
  Author: Frédéric Demarle
8
  Author uri: https://polylang.pro
9
  Description: Adds multilingual capability to WordPress
53
  }
54
  } else {
55
  // Go on loading the plugin
56
+ define( 'POLYLANG_VERSION', '2.3.4' );
57
  define( 'PLL_MIN_WP_VERSION', '4.4' );
58
 
59
  define( 'POLYLANG_FILE', __FILE__ ); // this file
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://polylang.pro
4
  Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
5
  Requires at least: 4.4
6
  Tested up to: 4.9
7
- Stable tag: 2.3.3
8
  License: GPLv2 or later
9
 
10
  Making WordPress multilingual
@@ -76,6 +76,14 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
76
 
77
  == Changelog ==
78
 
 
 
 
 
 
 
 
 
79
  = 2.3.3 (2018-03-15) =
80
 
81
  * Pro: Fix tax query using a term sharing slugs (fix a conflict with Fusion Builder)
4
  Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
5
  Requires at least: 4.4
6
  Tested up to: 4.9
7
+ Stable tag: 2.3.4
8
  License: GPLv2 or later
9
 
10
  Making WordPress multilingual
76
 
77
  == Changelog ==
78
 
79
+ = 2.3.4 (2018-03-27) =
80
+
81
+ * Pro: Fix conflict with Pods related to translated slugs for custom post types
82
+ * Add Friulian to the predefined languages list
83
+ * Fix conflict (javascript error) with Gütenberg #225
84
+ * Fix conflict on ajax requests introduced by WooCoommerce 3.3.4
85
+ * Fix queries by 'category_name' not auto translated #238
86
+
87
  = 2.3.3 (2018-03-15) =
88
 
89
  * Pro: Fix tax query using a term sharing slugs (fix a conflict with Fusion Builder)
settings/languages.php CHANGED
@@ -443,6 +443,13 @@ $languages = array(
443
  'fuc' => array(
444
  'facebook' => 'ff_NG',
445
  ),
 
 
 
 
 
 
 
446
  'fy' => array(
447
  'code' => 'fy',
448
  'locale' => 'fy',
443
  'fuc' => array(
444
  'facebook' => 'ff_NG',
445
  ),
446
+ 'fur' => array(
447
+ 'code' => 'fur',
448
+ 'locale' => 'fur',
449
+ 'name' => 'Furlan',
450
+ 'dir' => 'ltr',
451
+ 'flag' => 'it',
452
+ ),
453
  'fy' => array(
454
  'code' => 'fy',
455
  'locale' => 'fy',