Polylang - Version 2.1.1

Version Description

(2017-02-15) =

  • Pro: Add filter 'pll_enable_duplicate_media' for a fine control of automatic media duplication
  • Add filter 'pll_links_model' for the links model class name
  • Trim any starting ^ from modified rewrite rules
  • Pro: Fix wrong count of plugins to udpate
  • Fix slashed strings translations not saved #94
Download this release

Release Info

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

Code changes from version 2.1 to 2.1.1

Files changed (6) hide show
  1. changelog.txt +118 -0
  2. include/links-directory.php +2 -2
  3. include/mo.php +2 -0
  4. include/model.php +11 -0
  5. polylang.php +2 -2
  6. readme.txt +9 -119
changelog.txt CHANGED
@@ -2,6 +2,124 @@
2
 
3
  This file contains only old changelog. See readme.txt for newer versions.
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  = 1.9.3 (2016-06-28) =
6
 
7
  * Pro: Allow to add slashes in url slugs translations
2
 
3
  This file contains only old changelog. See readme.txt for newer versions.
4
 
5
+ = 2.0.12 (2016-12-19) =
6
+
7
+ * Fix plugin not loaded first (introduced in 2.0.11)
8
+ * Fix wrong translations files loaded when the language is set from the content in WP 4.7 #76
9
+ * Fix notice when a tax query has no terms (using EXISTS or NOT EXISTS)
10
+
11
+ = 2.0.11 (2016-12-12) =
12
+
13
+ * Pro: Fix shared term slugs broken by a late change in WP 4.7 #73
14
+ * Pro: Fix media taxonomies lost when creating a media translation when taxonomies sync is activated #72
15
+ * Fix fatal error in customizer when Twenty Seventen is activated and another theme is previewed #71
16
+ * Fix wrong plugin language on admin if user locale is different from site locale in WP 4.7
17
+
18
+ = 2.0.10 (2016-12-05) =
19
+
20
+ * Add support for front page panels of Twenty Seventeen
21
+ * Remove draft posts from the language switcher even when the user is logged in
22
+ * Fix: Make argument 2 of icl_object_id optional
23
+ * Fix a conflict with the Divi theme (#67)
24
+
25
+ = 2.0.9 (2016-11-15) =
26
+
27
+ * Fix javascript error in some ajax requests
28
+
29
+ = 2.0.8 (2016-11-14) =
30
+
31
+ * Disable admin language feature in WP 4.7+
32
+ * Pro: fix case where a media could lose its parent post when translated on the fly by the content duplication
33
+ * Pro: fix on the fly media created at content duplication attached to parent page instead of child page
34
+ * Fix translations input fields not populated in languages metabox when creating a new translation in WP 4.7
35
+ * Fix possibility to delete the translations of the default category in WP 4.7
36
+ * Fix tag search not filtered per language in Quick edit in WP 4.7
37
+ * Fix dropdown language switcher not working for untranslated pages
38
+
39
+ = 2.0.7 (2016-10-18) =
40
+
41
+ * Fix issues with static front pages introduced in version 2.0.6
42
+
43
+ = 2.0.6 (2016-10-17) =
44
+
45
+ * Pro: Fix translated paged slug not working on paged static front page
46
+ * Add support for WPML filter 'wpml_language_form_input_field'
47
+ * Fix PHP notice when using the WPML filter 'wpml_current_language'
48
+ * Fix cases where the admin language filter is not correctly taken into account
49
+ * Fix paged static front pages in plain permalinks
50
+ * Fix paged static front pages for multiple domains (#43)
51
+ * Fix warning occuring when a 3rd party plugin attempts to register anything but a string in the strings translations panel
52
+ * Fix cross domain http request for media when using multiple domains or subdomains
53
+ * Fix error 404 on pages when no language has been created yet
54
+
55
+ = 2.0.5 (2016-09-22) Five years after! =
56
+
57
+ * Pro: Fix conflict with WPBakery Visual Composer
58
+ * Pro: Fix conflict between multiple domains SSO and FORCE_SSL_ADMIN
59
+ * Pro: Fix duplicated fields not displayed in new translation in ACF Pro 5.4+
60
+ * Add Tibetan and Silesian to the predefined languages list
61
+ * Remove duplicated strings from the strings translations (even when they have a different name or group)
62
+ * The languages and translations of custom post types and taxonomies are no more activated by default at activation
63
+ * Allow to deactivate auto translation in secondary by setting 'lang' to an empty value
64
+ * Fix: invalidate the cache of PLL_MO ids when adding a new language
65
+ * Fix: don't filter secondary queries when editing a post in an untranslated post type
66
+
67
+ = 2.0.4 (2016-09-06) =
68
+
69
+ * Add Gujarati to the predefined languages list
70
+ * Fix conflict with Page Builder. Other parts of the conflict are fixed in Page Builder 2.4.14
71
+ * Fix plugins translations incorrectly loaded in WP 4.6
72
+ * Fix error 404 on paged urls when using a non standard port
73
+
74
+ = 2.0.3 (2016-08-16) =
75
+
76
+ * Pro: Fix PHP notice when hiding the language code in url and the language is set from subdomains
77
+ * Pro: Fix one more media being created when the duplicate media in all languages is activated (introduced in 2.0)
78
+ * Pro: Fix shared term slugs not working on PHP 7
79
+ * Pro: Fix Polylang storing integers in some ACF Pro fields where ACF Pro stores strings
80
+ * Pro: Fix ACF Pro custom fields synchronized even when the custom fields synchronization option is deactivated (#40)
81
+ * Fix PHP notice: Undefined variable: original_value in /modules/wpml/wpml-api.php on line 168
82
+ * Fix translations loaded too soon by plugins not correctly reloaded since WP 4.6 (#39)
83
+ * Fix: Remove the delete link for translations of the default category on PHP 7
84
+ * Fix unescaped i18n strings in Lingotek presentation
85
+
86
+ = 2.0.2 (2016-08-03) =
87
+
88
+ * Avoid fatal error when a 3rd party theme or plugin has a malformed wpml-config.xml file: the malformed wpml-config.xml file is simply ignored
89
+
90
+ = 2.0.1 (2016-08-02) =
91
+
92
+ * Fix fatal error on PHP < 5.4 (introduced in 2.0)
93
+ * Fix custom flags not being loaded (introduced in 2.0)
94
+
95
+ = 2.0 (2016-08-02) =
96
+
97
+ * Pro: Improve integration with ACF Pro
98
+ * Pro: Add support for single sign on across multiple domains or subdomains
99
+ * Pro: Add support for browser language detection when using multiple domains
100
+ * Pro: Add support for translation of the static portion of the post permalink structure
101
+ * Pro: Fix deactivated languages appearing in Yoast SEO sitemaps
102
+ * Pro: Fix impossibility to visit a deactivated language when using subdomains or multiple domains (#10)
103
+ * Pro: Fix when sharing slug on the page for posts, only one of them is accessible (#33)
104
+ * Add the possibility to use the language switcher as dropdown in menu
105
+ * Add support for custom logo introduced in WP 4.5 (#6)
106
+ * The backend current language ( PLL()->curlang ) is now equal to the language of current post or term being edited (#19)
107
+ * The sample permalink is now updated when changing the language in the Languages metabox
108
+ * Revamp the wpml-config.xml reader to use simplexml instead of our custom xml parser
109
+ * Improve support for the WPML API (including Hook API introduced in WPML 3.2)
110
+ * Add support for translation of meta titles and descriptions of custom post types and custom taxonomies in Yoast SEO
111
+ * Replace uncached functions by WPCOM VIP functions when available
112
+ * Improve compatibility with WP 4.6
113
+ * Fix parent category wrongly assigned to post when synchronizing children categories (#21)
114
+ * Fix custom fonts not loaded when using multiple domains or subdomains
115
+ * Fix remove_accents() not working for German and Danish (#24)
116
+ * Fix incorrect static front pages urls on backend
117
+ * Fix impossible to directly enter the page number in strings translation table (introduced in 1.9.3)
118
+ * Fix conflict with WP Sweep (needs WP Sweep 1.0.8+)
119
+ * Fix potential performance issue by querying only taxonomies to show in quick edit to filter the category checklist
120
+ * Fix conflict (database error) with ReOrder-posts-within-categories plugin
121
+ * Fix languages per page option not saved
122
+
123
  = 1.9.3 (2016-06-28) =
124
 
125
  * Pro: Allow to add slashes in url slugs translations
include/links-directory.php CHANGED
@@ -204,7 +204,7 @@ class PLL_Links_Directory extends PLL_Links_Permalinks {
204
  * @param string|bool $archive custom post post type archive name or false if it is not a cpt archive
205
  */
206
  if ( isset( $slug ) && apply_filters( 'pll_modify_rewrite_rule', true, array( $key => $rule ), $filter, false ) ) {
207
- $newrules[ $slug . str_replace( $wp_rewrite->root, '', $key ) ] = str_replace(
208
  array( '[8]', '[7]', '[6]', '[5]', '[4]', '[3]', '[2]', '[1]', '?' ),
209
  array( '[9]', '[8]', '[7]', '[6]', '[5]', '[4]', '[3]', '[2]', '?lang=$matches[1]&' ),
210
  $rule
@@ -220,7 +220,7 @@ class PLL_Links_Directory extends PLL_Links_Permalinks {
220
  /** This filter is documented in include/links-directory.php */
221
  if ( apply_filters( 'pll_modify_rewrite_rule', true, array( $key => $rule ), $filter, empty( $matches[1] ) ? false : $matches[1] ) ) {
222
  if ( isset( $slug ) ) {
223
- $newrules[ $slug . str_replace( $wp_rewrite->root, '', $key ) ] = str_replace(
224
  array( '[8]', '[7]', '[6]', '[5]', '[4]', '[3]', '[2]', '[1]', '?' ),
225
  array( '[9]', '[8]', '[7]', '[6]', '[5]', '[4]', '[3]', '[2]', '?lang=$matches[1]&' ),
226
  $rule
204
  * @param string|bool $archive custom post post type archive name or false if it is not a cpt archive
205
  */
206
  if ( isset( $slug ) && apply_filters( 'pll_modify_rewrite_rule', true, array( $key => $rule ), $filter, false ) ) {
207
+ $newrules[ $slug . str_replace( $wp_rewrite->root, '', ltrim( $key, '^' ) ) ] = str_replace(
208
  array( '[8]', '[7]', '[6]', '[5]', '[4]', '[3]', '[2]', '[1]', '?' ),
209
  array( '[9]', '[8]', '[7]', '[6]', '[5]', '[4]', '[3]', '[2]', '?lang=$matches[1]&' ),
210
  $rule
220
  /** This filter is documented in include/links-directory.php */
221
  if ( apply_filters( 'pll_modify_rewrite_rule', true, array( $key => $rule ), $filter, empty( $matches[1] ) ? false : $matches[1] ) ) {
222
  if ( isset( $slug ) ) {
223
+ $newrules[ $slug . str_replace( $wp_rewrite->root, '', ltrim( $key, '^' ) ) ] = str_replace(
224
  array( '[8]', '[7]', '[6]', '[5]', '[4]', '[3]', '[2]', '[1]', '?' ),
225
  array( '[9]', '[8]', '[7]', '[6]', '[5]', '[4]', '[3]', '[2]', '?lang=$matches[1]&' ),
226
  $rule
include/mo.php CHANGED
@@ -39,6 +39,8 @@ class PLL_MO extends MO {
39
  $strings[] = array( $entry->singular, $this->translate( $entry->singular ) );
40
  }
41
 
 
 
42
  if ( empty( $lang->mo_id ) ) {
43
  $post = array(
44
  'post_title' => 'polylang_mo_' . $lang->term_id,
39
  $strings[] = array( $entry->singular, $this->translate( $entry->singular ) );
40
  }
41
 
42
+ $strings = wp_slash( $strings ); // Avoid breaking slashed strings in update_post_meta. See https://codex.wordpress.org/Function_Reference/update_post_meta#Character_Escaping
43
+
44
  if ( empty( $lang->mo_id ) ) {
45
  $post = array(
46
  'post_title' => 'polylang_mo_' . $lang->term_id,
include/model.php CHANGED
@@ -554,6 +554,17 @@ class PLL_Model {
554
  public function get_links_model() {
555
  $c = array( 'Directory', 'Directory', 'Subdomain', 'Domain' );
556
  $class = get_option( 'permalink_structure' ) ? 'PLL_Links_' . $c[ $this->options['force_lang'] ] : 'PLL_Links_Default';
 
 
 
 
 
 
 
 
 
 
 
557
  return new $class( $this );
558
  }
559
 
554
  public function get_links_model() {
555
  $c = array( 'Directory', 'Directory', 'Subdomain', 'Domain' );
556
  $class = get_option( 'permalink_structure' ) ? 'PLL_Links_' . $c[ $this->options['force_lang'] ] : 'PLL_Links_Default';
557
+
558
+ /**
559
+ * Filter the links model class to use
560
+ * /!\ this filter is fired *before* the $polylang object is available
561
+ *
562
+ * @since 2.1.1
563
+ *
564
+ * @param string $class A class name: PLL_Links_Default, PLL_Links_Directory, PLL_Links_Subdomain, PLL_Links_Domain
565
+ */
566
+ $class = apply_filters( 'pll_links_model', $class );
567
+
568
  return new $class( $this );
569
  }
570
 
polylang.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  Plugin Name: Polylang
5
  Plugin URI: https://polylang.pro
6
- Version: 2.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', '2.1' );
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.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.1.1' );
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.7
7
- Stable tag: 2.1
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 (2017-01-25) =
80
 
81
  * Minimum WordPress version is now 4.4
@@ -106,122 +114,4 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
106
  * Fix: unattached media translations not in language switcher
107
  * Fix: Conflict with WP Residence advanced search
108
 
109
- = 2.0.12 (2016-12-19) =
110
-
111
- * Fix plugin not loaded first (introduced in 2.0.11)
112
- * Fix wrong translations files loaded when the language is set from the content in WP 4.7 #76
113
- * Fix notice when a tax query has no terms (using EXISTS or NOT EXISTS)
114
-
115
- = 2.0.11 (2016-12-12) =
116
-
117
- * Pro: Fix shared term slugs broken by a late change in WP 4.7 #73
118
- * Pro: Fix media taxonomies lost when creating a media translation when taxonomies sync is activated #72
119
- * Fix fatal error in customizer when Twenty Seventen is activated and another theme is previewed #71
120
- * Fix wrong plugin language on admin if user locale is different from site locale in WP 4.7
121
-
122
- = 2.0.10 (2016-12-05) =
123
-
124
- * Add support for front page panels of Twenty Seventeen
125
- * Remove draft posts from the language switcher even when the user is logged in
126
- * Fix: Make argument 2 of icl_object_id optional
127
- * Fix a conflict with the Divi theme (#67)
128
-
129
- = 2.0.9 (2016-11-15) =
130
-
131
- * Fix javascript error in some ajax requests
132
-
133
- = 2.0.8 (2016-11-14) =
134
-
135
- * Disable admin language feature in WP 4.7+
136
- * Pro: fix case where a media could lose its parent post when translated on the fly by the content duplication
137
- * Pro: fix on the fly media created at content duplication attached to parent page instead of child page
138
- * Fix translations input fields not populated in languages metabox when creating a new translation in WP 4.7
139
- * Fix possibility to delete the translations of the default category in WP 4.7
140
- * Fix tag search not filtered per language in Quick edit in WP 4.7
141
- * Fix dropdown language switcher not working for untranslated pages
142
-
143
- = 2.0.7 (2016-10-18) =
144
-
145
- * Fix issues with static front pages introduced in version 2.0.6
146
-
147
- = 2.0.6 (2016-10-17) =
148
-
149
- * Pro: Fix translated paged slug not working on paged static front page
150
- * Add support for WPML filter 'wpml_language_form_input_field'
151
- * Fix PHP notice when using the WPML filter 'wpml_current_language'
152
- * Fix cases where the admin language filter is not correctly taken into account
153
- * Fix paged static front pages in plain permalinks
154
- * Fix paged static front pages for multiple domains (#43)
155
- * Fix warning occuring when a 3rd party plugin attempts to register anything but a string in the strings translations panel
156
- * Fix cross domain http request for media when using multiple domains or subdomains
157
- * Fix error 404 on pages when no language has been created yet
158
-
159
- = 2.0.5 (2016-09-22) Five years after! =
160
-
161
- * Pro: Fix conflict with WPBakery Visual Composer
162
- * Pro: Fix conflict between multiple domains SSO and FORCE_SSL_ADMIN
163
- * Pro: Fix duplicated fields not displayed in new translation in ACF Pro 5.4+
164
- * Add Tibetan and Silesian to the predefined languages list
165
- * Remove duplicated strings from the strings translations (even when they have a different name or group)
166
- * The languages and translations of custom post types and taxonomies are no more activated by default at activation
167
- * Allow to deactivate auto translation in secondary by setting 'lang' to an empty value
168
- * Fix: invalidate the cache of PLL_MO ids when adding a new language
169
- * Fix: don't filter secondary queries when editing a post in an untranslated post type
170
-
171
- = 2.0.4 (2016-09-06) =
172
-
173
- * Add Gujarati to the predefined languages list
174
- * Fix conflict with Page Builder. Other parts of the conflict are fixed in Page Builder 2.4.14
175
- * Fix plugins translations incorrectly loaded in WP 4.6
176
- * Fix error 404 on paged urls when using a non standard port
177
-
178
- = 2.0.3 (2016-08-16) =
179
-
180
- * Pro: Fix PHP notice when hiding the language code in url and the language is set from subdomains
181
- * Pro: Fix one more media being created when the duplicate media in all languages is activated (introduced in 2.0)
182
- * Pro: Fix shared term slugs not working on PHP 7
183
- * Pro: Fix Polylang storing integers in some ACF Pro fields where ACF Pro stores strings
184
- * Pro: Fix ACF Pro custom fields synchronized even when the custom fields synchronization option is deactivated (#40)
185
- * Fix PHP notice: Undefined variable: original_value in /modules/wpml/wpml-api.php on line 168
186
- * Fix translations loaded too soon by plugins not correctly reloaded since WP 4.6 (#39)
187
- * Fix: Remove the delete link for translations of the default category on PHP 7
188
- * Fix unescaped i18n strings in Lingotek presentation
189
-
190
- = 2.0.2 (2016-08-03) =
191
-
192
- * Avoid fatal error when a 3rd party theme or plugin has a malformed wpml-config.xml file: the malformed wpml-config.xml file is simply ignored
193
-
194
- = 2.0.1 (2016-08-02) =
195
-
196
- * Fix fatal error on PHP < 5.4 (introduced in 2.0)
197
- * Fix custom flags not being loaded (introduced in 2.0)
198
-
199
- = 2.0 (2016-08-02) =
200
-
201
- * Pro: Improve integration with ACF Pro
202
- * Pro: Add support for single sign on across multiple domains or subdomains
203
- * Pro: Add support for browser language detection when using multiple domains
204
- * Pro: Add support for translation of the static portion of the post permalink structure
205
- * Pro: Fix deactivated languages appearing in Yoast SEO sitemaps
206
- * Pro: Fix impossibility to visit a deactivated language when using subdomains or multiple domains (#10)
207
- * Pro: Fix when sharing slug on the page for posts, only one of them is accessible (#33)
208
- * Add the possibility to use the language switcher as dropdown in menu
209
- * Add support for custom logo introduced in WP 4.5 (#6)
210
- * The backend current language ( PLL()->curlang ) is now equal to the language of current post or term being edited (#19)
211
- * The sample permalink is now updated when changing the language in the Languages metabox
212
- * Revamp the wpml-config.xml reader to use simplexml instead of our custom xml parser
213
- * Improve support for the WPML API (including Hook API introduced in WPML 3.2)
214
- * Add support for translation of meta titles and descriptions of custom post types and custom taxonomies in Yoast SEO
215
- * Replace uncached functions by WPCOM VIP functions when available
216
- * Improve compatibility with WP 4.6
217
- * Fix parent category wrongly assigned to post when synchronizing children categories (#21)
218
- * Fix custom fonts not loaded when using multiple domains or subdomains
219
- * Fix remove_accents() not working for German and Danish (#24)
220
- * Fix incorrect static front pages urls on backend
221
- * Fix impossible to directly enter the page number in strings translation table (introduced in 1.9.3)
222
- * Fix conflict with WP Sweep (needs WP Sweep 1.0.8+)
223
- * Fix potential performance issue by querying only taxonomies to show in quick edit to filter the category checklist
224
- * Fix conflict (database error) with ReOrder-posts-within-categories plugin
225
- * Fix languages per page option not saved
226
-
227
  See [changelog.txt](https://plugins.svn.wordpress.org/polylang/trunk/changelog.txt) for older changelog
4
  Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
5
  Requires at least: 4.4
6
  Tested up to: 4.7
7
+ Stable tag: 2.1.1
8
  License: GPLv2 or later
9
 
10
  Making WordPress multilingual
76
 
77
  == Changelog ==
78
 
79
+ = 2.1.1 (2017-02-15) =
80
+
81
+ * Pro: Add filter 'pll_enable_duplicate_media' for a fine control of automatic media duplication
82
+ * Add filter 'pll_links_model' for the links model class name
83
+ * Trim any starting ^ from modified rewrite rules
84
+ * Pro: Fix wrong count of plugins to udpate
85
+ * Fix slashed strings translations not saved #94
86
+
87
  = 2.1 (2017-01-25) =
88
 
89
  * Minimum WordPress version is now 4.4
114
  * Fix: unattached media translations not in language switcher
115
  * Fix: Conflict with WP Residence advanced search
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  See [changelog.txt](https://plugins.svn.wordpress.org/polylang/trunk/changelog.txt) for older changelog