Polylang - Version 2.1.6

Version Description

(2017-07-17) =

  • Pro: fix duplicate post button not working in PHP 7.1
  • Pro: fix CPTUI untranslated labels on admin
  • Adapt related posts filter to use slug instead of name to follow changes made on Jetpack server ( Props Steve Kaeser )
  • Fix PHP notices when translating CPT and custom tax titles in Yoast SEO
  • Fix PHP warning when all plugins are networked activated
Download this release

Release Info

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

Code changes from version 2.1.5 to 2.1.6

modules/plugins/plugins-compat.php CHANGED
@@ -196,6 +196,25 @@ class PLL_Plugins_Compat {
196
  add_filter( 'wpseo_canonical', array( $this, 'wpseo_canonical' ) );
197
  }
198
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  /**
200
  * Yoast SEO
201
  * Registers strings for custom post types and custom taxonomies titles and meta descriptions
@@ -205,26 +224,41 @@ class PLL_Plugins_Compat {
205
  function wpseo_register_strings() {
206
  $options = get_option( 'wpseo_titles' );
207
  foreach ( get_post_types( array( 'public' => true, '_builtin' => false ) ) as $t ) {
208
- if ( pll_is_translated_post_type( $t ) && ! empty( $options[ 'title-' . $t ] ) ) {
209
- pll_register_string( 'title-' . $t, $options[ 'title-' . $t ], 'wordpress-seo' );
210
- pll_register_string( 'metadesc-' . $t, $options[ 'metadesc-' . $t ], 'wordpress-seo' );
211
  }
212
  }
213
  foreach ( get_post_types( array( 'has_archive' => true, '_builtin' => false ) ) as $t ) {
214
- if ( pll_is_translated_post_type( $t ) && ! empty( $options[ 'title-ptarchive-' . $t ] ) ) {
215
- pll_register_string( 'title-ptarchive-' . $t, $options[ 'title-ptarchive-' . $t ], 'wordpress-seo' );
216
- pll_register_string( 'metadesc-ptarchive-' . $t, $options[ 'metadesc-ptarchive-' . $t ], 'wordpress-seo' );
217
- pll_register_string( 'bctitle-ptarchive-' . $t, $options[ 'bctitle-ptarchive-' . $t ], 'wordpress-seo' );
218
  }
219
  }
220
  foreach ( get_taxonomies( array( 'public' => true, '_builtin' => false ) ) as $t ) {
221
- if ( pll_is_translated_taxonomy( $t ) && ! empty( $options[ 'title-tax-' . $t ] ) ) {
222
- pll_register_string( 'title-tax-' . $t, $options[ 'title-tax-' . $t ], 'wordpress-seo' );
223
- pll_register_string( 'metadesc-tax-' . $t, $options[ 'metadesc-tax-' . $t ], 'wordpress-seo' );
224
  }
225
  }
226
  }
227
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  /**
229
  * Yoast SEO
230
  * Translates strings for custom post types and custom taxonomies titles and meta descriptions
@@ -237,22 +271,18 @@ class PLL_Plugins_Compat {
237
  function wpseo_translate_titles( $options ) {
238
  if ( PLL() instanceof PLL_Frontend ) {
239
  foreach ( get_post_types( array( 'public' => true, '_builtin' => false ) ) as $t ) {
240
- if ( pll_is_translated_post_type( $t ) && ! empty( $options[ 'title-' . $t ] ) ) {
241
- $options[ 'title-' . $t ] = pll__( $options[ 'title-' . $t ] );
242
- $options[ 'metadesc-' . $t ] = pll__( $options[ 'metadesc-' . $t ] );
243
  }
244
  }
245
  foreach ( get_post_types( array( 'has_archive' => true, '_builtin' => false ) ) as $t ) {
246
- if ( pll_is_translated_post_type( $t ) && ! empty( $options[ 'title-ptarchive-' . $t ] ) ) {
247
- $options[ 'title-ptarchive-' . $t ] = pll__( $options[ 'title-ptarchive-' . $t ] );
248
- $options[ 'metadesc-ptarchive-' . $t ] = pll__( $options[ 'metadesc-ptarchive-' . $t ] );
249
- $options[ 'bctitle-ptarchive-' . $t ] = pll__( $options[ 'bctitle-ptarchive-' . $t ] );
250
  }
251
  }
252
  foreach ( get_taxonomies( array( 'public' => true, '_builtin' => false ) ) as $t ) {
253
- if ( pll_is_translated_taxonomy( $t ) && ! empty( $options[ 'title-tax-' . $t ] ) ) {
254
- $options[ 'title-tax-' . $t ] = pll__( $options[ 'title-tax-' . $t ] );
255
- $options[ 'metadesc-tax-' . $t ] = pll__( $options[ 'metadesc-tax-' . $t ] );
256
  }
257
  }
258
  }
@@ -615,7 +645,7 @@ class PLL_Plugins_Compat {
615
  * @return array
616
  */
617
  function jetpack_relatedposts_filter_filters( $filters, $post_id ) {
618
- $slug = sanitize_title( pll_get_post_language( $post_id, 'name' ) );
619
  $filters[] = array( 'term' => array( 'taxonomy.language.slug' => $slug ) );
620
  return $filters;
621
  }
196
  add_filter( 'wpseo_canonical', array( $this, 'wpseo_canonical' ) );
197
  }
198
 
199
+ /**
200
+ * Yoast SEO
201
+ * Helper function to register strings for custom post types and custom taxonomies titles and meta descriptions
202
+ *
203
+ * @since 2.1.6
204
+ *
205
+ * @param array $options
206
+ * @param array $titles
207
+ * @return array
208
+ */
209
+ protected function _wpseo_register_strings( $options, $titles ) {
210
+ foreach ( $titles as $title ) {
211
+ if ( ! empty ( $options[ $title ] ) ) {
212
+ pll_register_string( $title, $options[ $title ], 'wordpress-seo' );
213
+ }
214
+ }
215
+ return $options;
216
+ }
217
+
218
  /**
219
  * Yoast SEO
220
  * Registers strings for custom post types and custom taxonomies titles and meta descriptions
224
  function wpseo_register_strings() {
225
  $options = get_option( 'wpseo_titles' );
226
  foreach ( get_post_types( array( 'public' => true, '_builtin' => false ) ) as $t ) {
227
+ if ( pll_is_translated_post_type( $t ) ) {
228
+ $this->_wpseo_register_strings( $options, array( 'title-' . $t, 'metadesc-' . $t ) );
 
229
  }
230
  }
231
  foreach ( get_post_types( array( 'has_archive' => true, '_builtin' => false ) ) as $t ) {
232
+ if ( pll_is_translated_post_type( $t ) ) {
233
+ $this->_wpseo_register_strings( $options, array( 'title-ptarchive-' . $t, 'metadesc-ptarchive-' . $t, 'bctitle-ptarchive-' . $t ) );
 
 
234
  }
235
  }
236
  foreach ( get_taxonomies( array( 'public' => true, '_builtin' => false ) ) as $t ) {
237
+ if ( pll_is_translated_taxonomy( $t ) ) {
238
+ $this->_wpseo_register_strings( $options, array( 'title-tax-' . $t, 'metadesc-tax-' . $t ) );
 
239
  }
240
  }
241
  }
242
 
243
+ /**
244
+ * Yoast SEO
245
+ * Helper function to translate custom post types and custom taxonomies titles and meta descriptions
246
+ *
247
+ * @since 2.1.6
248
+ *
249
+ * @param array $options
250
+ * @param array $titles
251
+ * @return array
252
+ */
253
+ protected function _wpseo_translate_titles( $options, $titles ) {
254
+ foreach ( $titles as $title ) {
255
+ if ( ! empty ( $options[ $title ] ) ) {
256
+ $options[ $title ] = pll__( $options[ $title ] );
257
+ }
258
+ }
259
+ return $options;
260
+ }
261
+
262
  /**
263
  * Yoast SEO
264
  * Translates strings for custom post types and custom taxonomies titles and meta descriptions
271
  function wpseo_translate_titles( $options ) {
272
  if ( PLL() instanceof PLL_Frontend ) {
273
  foreach ( get_post_types( array( 'public' => true, '_builtin' => false ) ) as $t ) {
274
+ if ( pll_is_translated_post_type( $t ) ) {
275
+ $options = $this->_wpseo_translate_titles( $options, array( 'title-' . $t, 'metadesc-' . $t ) );
 
276
  }
277
  }
278
  foreach ( get_post_types( array( 'has_archive' => true, '_builtin' => false ) ) as $t ) {
279
+ if ( pll_is_translated_post_type( $t ) ) {
280
+ $options = $this->_wpseo_translate_titles( $options, array( 'title-ptarchive-' . $t, 'metadesc-ptarchive-' . $t, 'bctitle-ptarchive-' . $t ) );
 
 
281
  }
282
  }
283
  foreach ( get_taxonomies( array( 'public' => true, '_builtin' => false ) ) as $t ) {
284
+ if ( pll_is_translated_taxonomy( $t ) ) {
285
+ $options = $this->_wpseo_translate_titles( $options, array( 'title-tax-' . $t, 'metadesc-tax-' . $t ) );
 
286
  }
287
  }
288
  }
645
  * @return array
646
  */
647
  function jetpack_relatedposts_filter_filters( $filters, $post_id ) {
648
+ $slug = sanitize_title( pll_get_post_language( $post_id, 'slug' ) );
649
  $filters[] = array( 'term' => array( 'taxonomy.language.slug' => $slug ) );
650
  return $filters;
651
  }
modules/wpml/wpml-config.php CHANGED
@@ -57,7 +57,7 @@ class PLL_WPML_Config {
57
  // Plugins
58
  // Don't forget sitewide active plugins thanks to Reactorshop http://wordpress.org/support/topic/polylang-and-yoast-seo-plugin/page/2?replies=38#post-4801829
59
  $plugins = ( is_multisite() && $sitewide_plugins = get_site_option( 'active_sitewide_plugins' ) ) && is_array( $sitewide_plugins ) ? array_keys( $sitewide_plugins ) : array();
60
- $plugins = array_merge( $plugins, get_option( 'active_plugins' ) );
61
 
62
  foreach ( $plugins as $plugin ) {
63
  if ( file_exists( $file = WP_PLUGIN_DIR . '/' . dirname( $plugin ) . '/wpml-config.xml' ) && false !== $xml = simplexml_load_file( $file ) ) {
57
  // Plugins
58
  // Don't forget sitewide active plugins thanks to Reactorshop http://wordpress.org/support/topic/polylang-and-yoast-seo-plugin/page/2?replies=38#post-4801829
59
  $plugins = ( is_multisite() && $sitewide_plugins = get_site_option( 'active_sitewide_plugins' ) ) && is_array( $sitewide_plugins ) ? array_keys( $sitewide_plugins ) : array();
60
+ $plugins = array_merge( $plugins, get_option( 'active_plugins', array() ) );
61
 
62
  foreach ( $plugins as $plugin ) {
63
  if ( file_exists( $file = WP_PLUGIN_DIR . '/' . dirname( $plugin ) . '/wpml-config.xml' ) && false !== $xml = simplexml_load_file( $file ) ) {
polylang.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  Plugin Name: Polylang
5
  Plugin URI: https://polylang.pro
6
- Version: 2.1.5
7
  Author: Frédéric Demarle
8
  Author uri: https://polylang.pro
9
  Description: Adds multilingual capability to WordPress
@@ -35,7 +35,7 @@ if ( ! defined( 'ABSPATH' ) ) {
35
  exit; // don't access directly
36
  };
37
 
38
- define( 'POLYLANG_VERSION', '2.1.5' );
39
  define( 'PLL_MIN_WP_VERSION', '4.4' );
40
 
41
  define( 'POLYLANG_FILE', __FILE__ ); // this file
3
  /*
4
  Plugin Name: Polylang
5
  Plugin URI: https://polylang.pro
6
+ Version: 2.1.6
7
  Author: Frédéric Demarle
8
  Author uri: https://polylang.pro
9
  Description: Adds multilingual capability to WordPress
35
  exit; // don't access directly
36
  };
37
 
38
+ define( 'POLYLANG_VERSION', '2.1.6' );
39
  define( 'PLL_MIN_WP_VERSION', '4.4' );
40
 
41
  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.8
7
- Stable tag: 2.1.5
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.1.5 (2017-05-31) =
80
 
81
  * Add compatibility with new media widgets introduced in WP 4.8
4
  Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
5
  Requires at least: 4.4
6
  Tested up to: 4.8
7
+ Stable tag: 2.1.6
8
  License: GPLv2 or later
9
 
10
  Making WordPress multilingual
76
 
77
  == Changelog ==
78
 
79
+ = 2.1.6 (2017-07-17) =
80
+
81
+ * Pro: fix duplicate post button not working in PHP 7.1
82
+ * Pro: fix CPTUI untranslated labels on admin
83
+ * Adapt related posts filter to use slug instead of name to follow changes made on Jetpack server ( Props Steve Kaeser )
84
+ * Fix PHP notices when translating CPT and custom tax titles in Yoast SEO
85
+ * Fix PHP warning when all plugins are networked activated
86
+
87
  = 2.1.5 (2017-05-31) =
88
 
89
  * Add compatibility with new media widgets introduced in WP 4.8