Polylang - Version 1.9.2

Version Description

(2016-06-06) =

  • Pro: fix unreachable hierarchical custom post type posts when they are sharing slugs across languages
  • Fix missing argument 3 in icl_t
  • Fix conflict with WooCommerce product variations
Download this release

Release Info

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

Code changes from version 1.9.1 to 1.9.2

admin/admin-filters-post.php CHANGED
@@ -460,7 +460,8 @@ class PLL_Admin_Filters_Post extends PLL_Admin_Filters_Post_Base {
460
  if ( ( $update && current_user_can( $post_type_object->cap->edit_post, $post_id ) ) || ( ! $update && current_user_can( $post_type_object->cap->create_posts ) ) ) {
461
  $this->save_language( $post_id, $post );
462
 
463
- if ( isset( $_POST['post_tr_lang'] ) ) {
 
464
  $translations = $this->save_translations( $post_id, $_POST['post_tr_lang'] );
465
  }
466
 
460
  if ( ( $update && current_user_can( $post_type_object->cap->edit_post, $post_id ) ) || ( ! $update && current_user_can( $post_type_object->cap->create_posts ) ) ) {
461
  $this->save_language( $post_id, $post );
462
 
463
+ // Make sure we are saving translations only for the main post currently being edited and not for other possible post types
464
+ if ( ! empty( $GLOBALS['post_type'] ) && $post->post_type === $GLOBALS['post_type'] && isset( $_POST['post_tr_lang'] ) ) {
465
  $translations = $this->save_translations( $post_id, $_POST['post_tr_lang'] );
466
  }
467
 
modules/sync/admin-sync.php CHANGED
@@ -169,6 +169,7 @@ class PLL_Admin_Sync {
169
  public function copy_post_metas( $from, $to, $lang, $sync = false ) {
170
  // copy or synchronize post metas and allow plugins to do the same
171
  $metas = get_post_custom( $from );
 
172
 
173
  // get public meta keys ( including from translated post in case we just deleted a custom field )
174
  if ( ! $sync || in_array( 'post_meta', $this->options['sync'] ) ) {
@@ -190,11 +191,15 @@ class PLL_Admin_Sync {
190
  * Filter the custom fields to copy or synchronize
191
  *
192
  * @since 0.6
 
193
  *
194
- * @param array $keys list of custom fields names
195
- * @param bool $sync true if it is synchronization, false if it is a copy
 
 
 
196
  */
197
- $keys = array_unique( apply_filters( 'pll_copy_post_metas', empty( $keys ) ? array() : $keys, $sync ) );
198
 
199
  // and now copy / synchronize
200
  foreach ( $keys as $key ) {
169
  public function copy_post_metas( $from, $to, $lang, $sync = false ) {
170
  // copy or synchronize post metas and allow plugins to do the same
171
  $metas = get_post_custom( $from );
172
+ $keys = array();
173
 
174
  // get public meta keys ( including from translated post in case we just deleted a custom field )
175
  if ( ! $sync || in_array( 'post_meta', $this->options['sync'] ) ) {
191
  * Filter the custom fields to copy or synchronize
192
  *
193
  * @since 0.6
194
+ * @since 1.9.2 The `$from`, `$to`, `$lang` parameters were added.
195
  *
196
+ * @param array $keys list of custom fields names
197
+ * @param bool $sync true if it is synchronization, false if it is a copy
198
+ * @param int $from id of the post from which we copy informations
199
+ * @param int $to id of the post to which we paste informations
200
+ * @param string $lang language slug
201
  */
202
+ $keys = array_unique( apply_filters( 'pll_copy_post_metas', $keys, $sync, $from, $to, $lang ) );
203
 
204
  // and now copy / synchronize
205
  foreach ( $keys as $key ) {
modules/wpml/wpml-compat.php CHANGED
@@ -247,13 +247,16 @@ if ( ! function_exists( 'icl_unregister_string' ) ) {
247
  *
248
  * @since 0.9.3
249
  *
250
- * @param string $context not used by Polylang
251
- * @param string $name not used by Polylang
252
- * @param string $string the string to translated
253
  * @return string the translated string in the current language
254
  */
255
  if ( ! function_exists( 'icl_t' ) ) {
256
- function icl_t( $context, $name, $string ) {
 
 
 
257
  return pll__( $string );
258
  }
259
  }
@@ -418,4 +421,22 @@ class PLL_WPML_Compat {
418
  public function get_strings( $strings ) {
419
  return empty( self::$strings ) ? $strings : array_merge( $strings, self::$strings );
420
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
421
  }
247
  *
248
  * @since 0.9.3
249
  *
250
+ * @param string $context the group in which the string is registered
251
+ * @param string $name a unique name for the string
252
+ * @param string $string the string to translate, optional for strings registered with icl_register_string
253
  * @return string the translated string in the current language
254
  */
255
  if ( ! function_exists( 'icl_t' ) ) {
256
+ function icl_t( $context, $name, $string = false ) {
257
+ if ( empty( $string ) ) {
258
+ $string = PLL_WPML_Compat::instance()->get_string_by_context_and_name( $context, $name );
259
+ }
260
  return pll__( $string );
261
  }
262
  }
421
  public function get_strings( $strings ) {
422
  return empty( self::$strings ) ? $strings : array_merge( $strings, self::$strings );
423
  }
424
+
425
+ /**
426
+ * Get a registered string by its context and name
427
+ *
428
+ * @since 1.9.2
429
+ *
430
+ * @param string $context the group in which the string is registered
431
+ * @param string $name a unique name for the string
432
+ * @return bool|string the registered string, false if none was found
433
+ */
434
+ public function get_string_by_context_and_name( $context, $name ) {
435
+ foreach ( self::$strings as $string ) {
436
+ if ( $string['context'] == $context && $string['name'] == $name ) {
437
+ return $string['string'];
438
+ }
439
+ }
440
+ return false;
441
+ }
442
  }
polylang.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  Plugin Name: Polylang
5
  Plugin URI: https://polylang.pro
6
- Version: 1.9.1
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', '1.9.1' );
39
  define( 'PLL_MIN_WP_VERSION', '4.0' );
40
 
41
  define( 'POLYLANG_FILE', __FILE__ ); // this file
3
  /*
4
  Plugin Name: Polylang
5
  Plugin URI: https://polylang.pro
6
+ Version: 1.9.2
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', '1.9.2' );
39
  define( 'PLL_MIN_WP_VERSION', '4.0' );
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.0
6
  Tested up to: 4.5
7
- Stable tag: 1.9.1
8
  License: GPLv2 or later
9
 
10
  Making WordPress multilingual
@@ -60,6 +60,10 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
60
  * If you still have a problem, open a new thread in the [community support forum](http://wordpress.org/support/plugin/polylang).
61
  * [Polylang Pro](https://polylang.pro) users have access to our helpdesk.
62
 
 
 
 
 
63
  = Do you need translation services? =
64
 
65
  * If you want to use professional or automatic translation services, install and activate the [Lingotek Translation](https://wordpress.org/plugins/lingotek-translation/) plugin.
@@ -73,6 +77,12 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
73
 
74
  == Changelog ==
75
 
 
 
 
 
 
 
76
  = 1.9.1 (2016-05-23) =
77
 
78
  * Pro: add compatibility with Beaver Builder
4
  Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
5
  Requires at least: 4.0
6
  Tested up to: 4.5
7
+ Stable tag: 1.9.2
8
  License: GPLv2 or later
9
 
10
  Making WordPress multilingual
60
  * If you still have a problem, open a new thread in the [community support forum](http://wordpress.org/support/plugin/polylang).
61
  * [Polylang Pro](https://polylang.pro) users have access to our helpdesk.
62
 
63
+ = Is Polylang compatible with WooCommerce? =
64
+
65
+ * You need a separate addon to make Polylang and WooCommerce work together. Our Premium addon is currently in beta stage and is available for tests to Polyang Pro users who request it.
66
+
67
  = Do you need translation services? =
68
 
69
  * If you want to use professional or automatic translation services, install and activate the [Lingotek Translation](https://wordpress.org/plugins/lingotek-translation/) plugin.
77
 
78
  == Changelog ==
79
 
80
+ = 1.9.2 (2016-06-06) =
81
+
82
+ * Pro: fix unreachable hierarchical custom post type posts when they are sharing slugs across languages
83
+ * Fix missing argument 3 in icl_t
84
+ * Fix conflict with WooCommerce product variations
85
+
86
  = 1.9.1 (2016-05-23) =
87
 
88
  * Pro: add compatibility with Beaver Builder