Polylang - Version 2.5.4

Version Description

(2019-05-28) =

  • Add Kannada to the predefined languages list
  • Yoast SEO: Fix primary product cat not copied or synchronized
  • WPMU Domain Mapping: Fix incorrect domain used for the theme
  • Fix style-rtl.css not loaded when the language is set from the content #356
  • Fix Jetpack featured pages not working. Props Anis Ladram. #357
  • Fix Call to undefined function wp_generate_attachment_metadata()
Download this release

Release Info

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

Code changes from version 2.5.3 to 2.5.4

frontend/choose-lang.php CHANGED
@@ -60,7 +60,8 @@ abstract class PLL_Choose_Lang {
60
  // See https://wordpress.org/support/topic/detect-browser-language-sometimes-setting-null-language
61
  $this->curlang = ( $curlang instanceof PLL_Language ) ? $curlang : $this->model->get_language( $this->options['default_lang'] );
62
 
63
- $GLOBALS['text_direction'] = $this->curlang->is_rtl ? 'rtl' : 'ltr';
 
64
 
65
  /**
66
  * Fires when the current language is defined
60
  // See https://wordpress.org/support/topic/detect-browser-language-sometimes-setting-null-language
61
  $this->curlang = ( $curlang instanceof PLL_Language ) ? $curlang : $this->model->get_language( $this->options['default_lang'] );
62
 
63
+ $GLOBALS['text_direction'] = $this->curlang->is_rtl ? 'rtl' : 'ltr';
64
+ wp_styles()->text_direction = $GLOBALS['text_direction'];
65
 
66
  /**
67
  * Fires when the current language is defined
include/crud-posts.php CHANGED
@@ -207,8 +207,8 @@ class PLL_CRUD_Posts {
207
  *
208
  * @since 0.9
209
  *
210
- * @param string $file
211
- * @return string unmodified $file
212
  */
213
  public function wp_delete_file( $file ) {
214
  global $wpdb;
@@ -224,9 +224,10 @@ class PLL_CRUD_Posts {
224
  );
225
 
226
  if ( ! empty( $ids ) ) {
227
- // Regenerate intermediate sizes if it's an image ( since we could not prevent WP deleting them before )
 
228
  wp_update_attachment_metadata( $ids[0], wp_generate_attachment_metadata( $ids[0], $file ) );
229
- return ''; // Prevent deleting the main file
230
  }
231
 
232
  return $file;
207
  *
208
  * @since 0.9
209
  *
210
+ * @param string $file Path to the file to delete.
211
+ * @return string Empty or unmodified path.
212
  */
213
  public function wp_delete_file( $file ) {
214
  global $wpdb;
224
  );
225
 
226
  if ( ! empty( $ids ) ) {
227
+ // Regenerate intermediate sizes if it's an image ( since we could not prevent WP deleting them before ).
228
+ require_once ABSPATH . 'wp-admin/includes/image.php'; // In case the file is deleted outside admin.
229
  wp_update_attachment_metadata( $ids[0], wp_generate_attachment_metadata( $ids[0], $file ) );
230
+ return ''; // Prevent deleting the main file.
231
  }
232
 
233
  return $file;
include/links-abstract-domain.php CHANGED
@@ -12,13 +12,14 @@ abstract class PLL_Links_Abstract_Domain extends PLL_Links_Permalinks {
12
  *
13
  * @since 2.0
14
  *
15
- * @param object $model PLL_Model instance
16
  */
17
  public function __construct( &$model ) {
18
  parent::__construct( $model );
19
 
20
- // Avoid cross domain requests ( mainly for custom fonts )
21
  add_filter( 'content_url', array( $this, 'site_url' ) );
 
22
  add_filter( 'plugins_url', array( $this, 'site_url' ) );
23
  add_filter( 'rest_url', array( $this, 'site_url' ) );
24
  add_filter( 'upload_dir', array( $this, 'upload_dir' ) );
12
  *
13
  * @since 2.0
14
  *
15
+ * @param object $model PLL_Model instance.
16
  */
17
  public function __construct( &$model ) {
18
  parent::__construct( $model );
19
 
20
+ // Avoid cross domain requests ( mainly for custom fonts ).
21
  add_filter( 'content_url', array( $this, 'site_url' ) );
22
+ add_filter( 'theme_root_uri', array( $this, 'site_url' ) ); // The above filter is not sufficient with WPMU Domain Mapping.
23
  add_filter( 'plugins_url', array( $this, 'site_url' ) );
24
  add_filter( 'rest_url', array( $this, 'site_url' ) );
25
  add_filter( 'upload_dir', array( $this, 'upload_dir' ) );
modules/plugins/featured-content.php CHANGED
@@ -77,6 +77,7 @@ class PLL_Featured_Content {
77
  'lang' => 0, // avoid language filters
78
  'fields' => 'ids',
79
  'numberposts' => Featured_Content::$max_posts,
 
80
  'tax_query' => array(
81
  array(
82
  'taxonomy' => 'post_tag',
77
  'lang' => 0, // avoid language filters
78
  'fields' => 'ids',
79
  'numberposts' => Featured_Content::$max_posts,
80
+ 'post_type' => Featured_Content::$post_types,
81
  'tax_query' => array(
82
  array(
83
  'taxonomy' => 'post_tag',
modules/plugins/wpseo.php CHANGED
@@ -319,30 +319,40 @@ class PLL_WPSEO {
319
  }
320
 
321
  /**
322
- * Synchronize the primary category
323
  *
324
  * @since 2.3.3
325
  *
326
- * @param array $keys List of custom fields names
327
  * @return array
328
  */
329
  public function copy_post_metas( $keys ) {
330
- $keys[] = '_yoast_wpseo_primary_category';
 
 
 
 
 
 
 
 
 
 
331
  return $keys;
332
  }
333
 
334
  /**
335
- * Translate the primary category during the synchronization process
336
  *
337
  * @since 2.3.3
338
  *
339
- * @param int $value Meta value
340
- * @param string $key Meta key
341
- * @param string $lang Language of target
342
  * @return int
343
  */
344
  public function translate_post_meta( $value, $key, $lang ) {
345
- if ( '_yoast_wpseo_primary_category' === $key ) {
346
  $value = pll_get_term( $value, $lang );
347
  }
348
  return $value;
319
  }
320
 
321
  /**
322
+ * Synchronize the primary term
323
  *
324
  * @since 2.3.3
325
  *
326
+ * @param array $keys List of custom fields names.
327
  * @return array
328
  */
329
  public function copy_post_metas( $keys ) {
330
+ $taxonomies = get_taxonomies(
331
+ array(
332
+ 'hierarchical' => true,
333
+ 'public' => true,
334
+ )
335
+ );
336
+
337
+ foreach ( $taxonomies as $taxonomy ) {
338
+ $keys[] = '_yoast_wpseo_primary_' . $taxonomy;
339
+ }
340
+
341
  return $keys;
342
  }
343
 
344
  /**
345
+ * Translate the primary term during the synchronization process
346
  *
347
  * @since 2.3.3
348
  *
349
+ * @param int $value Meta value.
350
+ * @param string $key Meta key.
351
+ * @param string $lang Language of target.
352
  * @return int
353
  */
354
  public function translate_post_meta( $value, $key, $lang ) {
355
+ if ( false !== strpos( $key, '_yoast_wpseo_primary_' ) ) {
356
  $value = pll_get_term( $value, $lang );
357
  }
358
  return $value;
polylang.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  Plugin Name: Polylang
5
  Plugin URI: https://polylang.pro
6
- Version: 2.5.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.5.3' );
57
  define( 'PLL_MIN_WP_VERSION', '4.7' );
58
 
59
  define( 'POLYLANG_FILE', __FILE__ ); // this file
3
  /**
4
  Plugin Name: Polylang
5
  Plugin URI: https://polylang.pro
6
+ Version: 2.5.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.5.4' );
57
  define( 'PLL_MIN_WP_VERSION', '4.7' );
58
 
59
  define( 'POLYLANG_FILE', __FILE__ ); // this file
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Chouby
3
  Donate link: https://polylang.pro
4
  Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
5
  Requires at least: 4.7
6
- Tested up to: 5.1
7
- Stable tag: 2.5.3
8
  License: GPLv2 or later
9
 
10
  Making WordPress multilingual
@@ -76,6 +76,15 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
76
 
77
  == Changelog ==
78
 
 
 
 
 
 
 
 
 
 
79
  = 2.5.3 (2019-04-16) =
80
 
81
  * Add de_AT and pt_AO to the predefined languages list
3
  Donate link: https://polylang.pro
4
  Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
5
  Requires at least: 4.7
6
+ Tested up to: 5.2
7
+ Stable tag: 2.5.4
8
  License: GPLv2 or later
9
 
10
  Making WordPress multilingual
76
 
77
  == Changelog ==
78
 
79
+ = 2.5.4 (2019-05-28) =
80
+
81
+ * Add Kannada to the predefined languages list
82
+ * Yoast SEO: Fix primary product cat not copied or synchronized
83
+ * WPMU Domain Mapping: Fix incorrect domain used for the theme
84
+ * Fix style-rtl.css not loaded when the language is set from the content #356
85
+ * Fix Jetpack featured pages not working. Props Anis Ladram. #357
86
+ * Fix Call to undefined function wp_generate_attachment_metadata()
87
+
88
  = 2.5.3 (2019-04-16) =
89
 
90
  * Add de_AT and pt_AO to the predefined languages list
settings/languages.php CHANGED
@@ -624,6 +624,11 @@ $languages = array(
624
  'facebook' => 'km_KH',
625
  ),
626
  'kn' => array(
 
 
 
 
 
627
  'facebook' => 'kn_IN',
628
  ),
629
  'ko_KR' => array(
624
  'facebook' => 'km_KH',
625
  ),
626
  'kn' => array(
627
+ 'code' => 'kn',
628
+ 'locale' => 'kn',
629
+ 'name' => 'ಕನ್ನಡ',
630
+ 'dir' => 'ltr',
631
+ 'flag' => 'in',
632
  'facebook' => 'kn_IN',
633
  ),
634
  'ko_KR' => array(