Polylang - Version 2.0.1

Version Description

(2016-08-02) =

  • Fix fatal error on PHP < 5.4 (introduced in 2.0)
  • Fix custom flags not being loaded (introduced in 2.0)
Download this release

Release Info

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

Code changes from version 2.0 to 2.0.1

frontend/frontend.php CHANGED
@@ -34,8 +34,6 @@ class PLL_Frontend extends PLL_Base {
34
  public function __construct( &$links_model ) {
35
  parent::__construct( $links_model );
36
 
37
- add_filter( 'pll_after_languages_cache', array( $this, 'pll_after_languages_cache' ) );
38
-
39
  add_action( 'pll_language_defined', array( $this, 'pll_language_defined' ), 1 );
40
 
41
  // avoids the language being the queried object when querying multiple taxonomies
@@ -70,22 +68,7 @@ class PLL_Frontend extends PLL_Base {
70
  }
71
 
72
  /**
73
- * Set custom flags
74
- *
75
- * @since 2.0
76
- *
77
- * @param array $languages array of PLL_Language objects
78
- * @return array
79
- */
80
- public function pll_after_languages_cache( $languages ) {
81
- foreach ( $languages as $language ) {
82
- $language->set_custom_flag();
83
- }
84
- return $languages;
85
- }
86
-
87
- /**
88
- * Setups filters and nav menus once the language has been defined
89
  *
90
  * @since 1.2
91
  */
34
  public function __construct( &$links_model ) {
35
  parent::__construct( $links_model );
36
 
 
 
37
  add_action( 'pll_language_defined', array( $this, 'pll_language_defined' ), 1 );
38
 
39
  // avoids the language being the queried object when querying multiple taxonomies
68
  }
69
 
70
  /**
71
+ * setups filters and nav menus once the language has been defined
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  *
73
  * @since 1.2
74
  */
include/model.php CHANGED
@@ -100,6 +100,13 @@ class PLL_Model {
100
  }
101
  }
102
 
 
 
 
 
 
 
 
103
  /**
104
  * Filter the list of languages *after* it is stored in the persistent cache
105
  * /!\ this filter is fired *before* the $polylang object is available
100
  }
101
  }
102
 
103
+ // custom flags
104
+ if ( ! PLL_ADMIN ) {
105
+ foreach ( $languages as $language ) {
106
+ $language->set_custom_flag();
107
+ }
108
+ }
109
+
110
  /**
111
  * Filter the list of languages *after* it is stored in the persistent cache
112
  * /!\ this filter is fired *before* the $polylang object is available
modules/wpml/wpml-config.php CHANGED
@@ -17,7 +17,9 @@ class PLL_WPML_Config {
17
  * @since 1.0
18
  */
19
  public function __construct() {
20
- $this->init();
 
 
21
  }
22
 
23
  /**
@@ -75,7 +77,8 @@ class PLL_WPML_Config {
75
 
76
  foreach ( $this->xmls as $context => $xml ) {
77
  foreach ( $xml->xpath( 'admin-texts/key' ) as $key ) {
78
- $name = (string) $key->attributes()['name'];
 
79
  if ( PLL() instanceof PLL_Frontend ) {
80
  $this->options[ $name ] = $key;
81
  add_filter( 'option_' . $name, array( $this, 'translate_strings' ) );
@@ -99,7 +102,8 @@ class PLL_WPML_Config {
99
  public function copy_post_metas( $metas, $sync ) {
100
  foreach ( $this->xmls as $xml ) {
101
  foreach ( $xml->xpath( 'custom-fields/custom-field' ) as $cf ) {
102
- if ( 'copy' == $cf->attributes()['action'] || ( ! $sync && 'translate' == $cf->attributes()['action'] ) ) {
 
103
  $metas[] = (string) $cf;
104
  } else {
105
  $metas = array_diff( $metas, array( (string) $cf ) );
@@ -121,7 +125,8 @@ class PLL_WPML_Config {
121
  public function translate_types( $types, $hide ) {
122
  foreach ( $this->xmls as $xml ) {
123
  foreach ( $xml->xpath( 'custom-types/custom-type' ) as $pt ) {
124
- if ( 1 == $pt->attributes()['translate'] && ! $hide ) {
 
125
  $types[ (string) $pt ] = (string) $pt;
126
  } else {
127
  unset( $types[ (string) $pt ] ); // The theme/plugin author decided what to do with the post type so don't allow the user to change this
@@ -143,7 +148,8 @@ class PLL_WPML_Config {
143
  public function translate_taxonomies( $taxonomies, $hide ) {
144
  foreach ( $this->xmls as $xml ) {
145
  foreach ( $xml->xpath( 'taxonomies/taxonomy' ) as $tax ) {
146
- if ( 1 == $tax->attributes()['translate'] && ! $hide ) {
 
147
  $taxonomies[ (string) $tax ] = (string) $tax;
148
  } else {
149
  unset( $taxonomies[ (string) $tax ] ); // the theme/plugin author decided what to do with the taxonomy so don't allow the user to change this
@@ -179,13 +185,15 @@ class PLL_WPML_Config {
179
  $children = $key->children();
180
  if ( count( $children ) ) {
181
  foreach ( $children as $child ) {
182
- $name = (string) $child->attributes()['name'];
 
183
  if ( isset( $options[ $name ] ) ) {
184
  $this->register_string_recursive( $context, $options[ $name ], $child );
185
  }
186
  }
187
  } else {
188
- pll_register_string( (string) $key->attributes()['name'], $options, $context );
 
189
  }
190
  }
191
 
@@ -202,7 +210,8 @@ class PLL_WPML_Config {
202
  $children = $key->children();
203
  if ( count( $children ) ) {
204
  foreach ( $children as $child ) {
205
- $name = (string) $child->attributes()['name'];
 
206
  if ( isset( $values[ $name ] ) ) {
207
  $values[ $name ] = $this->translate_strings_recursive( $values[ $name ], $child );
208
  }
17
  * @since 1.0
18
  */
19
  public function __construct() {
20
+ if ( extension_loaded( 'simplexml' ) ) {
21
+ $this->init();
22
+ }
23
  }
24
 
25
  /**
77
 
78
  foreach ( $this->xmls as $context => $xml ) {
79
  foreach ( $xml->xpath( 'admin-texts/key' ) as $key ) {
80
+ $attributes = $key->attributes();
81
+ $name = (string) $attributes['name'];
82
  if ( PLL() instanceof PLL_Frontend ) {
83
  $this->options[ $name ] = $key;
84
  add_filter( 'option_' . $name, array( $this, 'translate_strings' ) );
102
  public function copy_post_metas( $metas, $sync ) {
103
  foreach ( $this->xmls as $xml ) {
104
  foreach ( $xml->xpath( 'custom-fields/custom-field' ) as $cf ) {
105
+ $attributes = $cf->attributes();
106
+ if ( 'copy' == $attributes['action'] || ( ! $sync && 'translate' == $attributes['action'] ) ) {
107
  $metas[] = (string) $cf;
108
  } else {
109
  $metas = array_diff( $metas, array( (string) $cf ) );
125
  public function translate_types( $types, $hide ) {
126
  foreach ( $this->xmls as $xml ) {
127
  foreach ( $xml->xpath( 'custom-types/custom-type' ) as $pt ) {
128
+ $attributes = $pt->attributes();
129
+ if ( 1 == $attributes['translate'] && ! $hide ) {
130
  $types[ (string) $pt ] = (string) $pt;
131
  } else {
132
  unset( $types[ (string) $pt ] ); // The theme/plugin author decided what to do with the post type so don't allow the user to change this
148
  public function translate_taxonomies( $taxonomies, $hide ) {
149
  foreach ( $this->xmls as $xml ) {
150
  foreach ( $xml->xpath( 'taxonomies/taxonomy' ) as $tax ) {
151
+ $attributes = $tax->attributes();
152
+ if ( 1 == $attributes['translate'] && ! $hide ) {
153
  $taxonomies[ (string) $tax ] = (string) $tax;
154
  } else {
155
  unset( $taxonomies[ (string) $tax ] ); // the theme/plugin author decided what to do with the taxonomy so don't allow the user to change this
185
  $children = $key->children();
186
  if ( count( $children ) ) {
187
  foreach ( $children as $child ) {
188
+ $attributes = $child->attributes();
189
+ $name = (string) $attributes['name'];
190
  if ( isset( $options[ $name ] ) ) {
191
  $this->register_string_recursive( $context, $options[ $name ], $child );
192
  }
193
  }
194
  } else {
195
+ $attributes = $key->attributes();
196
+ pll_register_string( (string) $attributes['name'], $options, $context );
197
  }
198
  }
199
 
210
  $children = $key->children();
211
  if ( count( $children ) ) {
212
  foreach ( $children as $child ) {
213
+ $attributes = $child->attributes();
214
+ $name = (string) $attributes['name'];
215
  if ( isset( $values[ $name ] ) ) {
216
  $values[ $name ] = $this->translate_strings_recursive( $values[ $name ], $child );
217
  }
polylang.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  Plugin Name: Polylang
5
  Plugin URI: https://polylang.pro
6
- Version: 2.0
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.0' );
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: 2.0.1
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.0.1' );
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.6
7
- Stable tag: 2.0
8
  License: GPLv2 or later
9
 
10
  Making WordPress multilingual
@@ -77,6 +77,11 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
77
 
78
  == Changelog ==
79
 
 
 
 
 
 
80
  = 2.0 (2016-08-02) =
81
 
82
  * Pro: Improve integration with ACF Pro
4
  Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
5
  Requires at least: 4.0
6
  Tested up to: 4.6
7
+ Stable tag: 2.0.1
8
  License: GPLv2 or later
9
 
10
  Making WordPress multilingual
77
 
78
  == Changelog ==
79
 
80
+ = 2.0.1 (2016-08-02) =
81
+
82
+ * Fix fatal error on PHP < 5.4 (introduced in 2.0)
83
+ * Fix custom flags not being loaded (introduced in 2.0)
84
+
85
  = 2.0 (2016-08-02) =
86
 
87
  * Pro: Improve integration with ACF Pro