Polylang - Version 3.2.8

Version Description

(2022-10-17) =

  • Fix PHP warning when a filtered taxonomy has no query var #1124
  • Fix SQL error when attempting to get objects without languages and no language exist #1126
  • Fix error when term slugs are provided as array in WP_Query #1119, #1132 Props Susanna Hggblom
  • Fix a CSS regression in the wizard causing the default language icon to be removed #1137
Download this release

Release Info

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

Code changes from version 3.2.7 to 3.2.8

css/build/admin.css CHANGED
@@ -30,7 +30,8 @@
30
  width : 10%;
31
  }
32
 
33
- td.column-default_lang .icon-default-lang:before {
 
34
  font-family: 'dashicons';
35
  content: "\f155";
36
  }
30
  width : 10%;
31
  }
32
 
33
+ td.column-default_lang .icon-default-lang:before,
34
+ .pll-wizard-content .icon-default-lang:before {
35
  font-family: 'dashicons';
36
  content: "\f155";
37
  }
css/build/admin.min.css CHANGED
@@ -1 +1 @@
1
- #add-lang select{width:95%}#add-lang label,.pll-legend{margin:.35em 0 .5em}.pll-legend{color:#1d2327;display:block;font-weight:400;padding:2px 0;text-shadow:none}.column-locale,.languages .column-slug{width:15%}.column-default_lang{width:5%}.column-count,.column-flag,.column-term_group{width:10%}td.column-default_lang .icon-default-lang:before{content:"\f155";font-family:dashicons}.pll-icon:before{display:inline-block;text-align:left;width:15px}.pll-circle:before{content:"\25cf"}#pll-about-box p,#pll-recommended p{text-align:justify}#pll-about-box input{float:right;margin:0;padding:0}.stringstranslations .column-context,.stringstranslations .column-name{width:10%}.stringstranslations .column-string{width:33%}.translation label{display:inline-block;vertical-align:top;width:23%}.translation{display:flex}@media screen and (max-width:782px){.translation{display:block}}.translation textarea{display:block}.translation input,.translation textarea{box-sizing:border-box;margin-bottom:4px;width:72%}.pll-settings{margin-top:20px}.pll-settings .plugin-title{width:25%}#wpbody-content .pll-settings .pll-configure tr{display:table-row}#wpbody-content .pll-settings .pll-configure td{display:table-cell}#wpbody-content .pll-settings .pll-configure>td{padding:20px 20px 20px 40px}.pll-configure legend{font-size:14px;font-weight:600;margin-bottom:.5em}.pll-configure td .description{margin-bottom:.5em;margin-top:2px}.pll-configure p.submit{margin-top:20px}.pll-configure .button{margin-right:20px}.pll-configure fieldset{margin-bottom:1.5em}.pll-inline-block-list{margin:0}.pll-inline-block-list li{display:inline-block;margin:0;width:250px}#pll-domains-table td{border:none;-webkit-box-shadow:none;box-shadow:none;padding:2px 2px 2px 1.5em}.pll-settings-url-col{display:inline-block;vertical-align:top;width:49%}#pll-licenses-table td{vertical-align:top}#pll-licenses-table label{font-size:1em;font-weight:600}.pll-configure .pll-deactivate-license{margin:0 0 0 20px}.wp-list-table td[class*=column-language_],.wp-list-table th[class*=column-language_]{box-sizing:content-box;width:1.5em}.pll-dir-rtl input[type=text],.pll-dir-rtl textarea{direction:rtl}.pll-dir-ltr input[type=text],.pll-dir-ltr textarea{direction:ltr}.pll-dir-ltr .tr_lang,.pll-dir-rtl .tr_lang{direction:inherit}#ml_box p{margin-top:1em}#post-translations p{float:left;margin-top:1em}.rtl #post-translations p{float:right}#post-translations table{clear:both;table-layout:fixed;width:100%}#post-translations a{text-decoration:none}#post-translations .pll-column-icon,#post-translations .pll-language-column{width:20px}#post-translations .tr_lang{width:100%}#post-translations td{padding:2px}#post-translations .spinner,#term-translations .spinner{background-position:50%;float:none;margin:0;width:auto}#select-post-language .pll-select-flag{margin-right:10px;padding:4px}.rtl #select-post-language .pll-select-flag{margin-left:10px;margin-right:0;padding:4px}#select-media-language .pll-select-flag{margin-right:10px;padding:4px}.pll-media-edit-column{float:right}.pll-translation-flag{margin-right:14px}#select-add-term-language .pll-select-flag{margin-right:13px;padding:11px}#select-edit-term-language .pll-select-flag{margin-right:4px;padding:11px}#term-translations p{color:#23282d;font-style:normal;font-weight:400;padding:2px}#add-term-translations,#edit-term-translations{width:95%}#term-translations .pll-language-column{line-height:28px;width:20%}#add-term-translations .pll-language-column,#term-translations .pll-edit-column{width:20px}#edit-term-translations .pll-language-column{font-weight:400;padding:15px 10px}.pll_icon_add:before{content:"\f132"}.pll_icon_edit:before{content:"\f464"}[class^=pll_icon_]{font:20px/1 dashicons;vertical-align:middle}#wpadminbar #wp-admin-bar-languages .ab-item img{margin:0 8px 0 2px}#wpadminbar #wp-admin-bar-languages #wp-admin-bar-all .ab-item .ab-icon{float:none;top:4px}#wpadminbar #wp-admin-bar-languages .ab-icon:before{content:"\f326";top:1px}#wp-admin-bar-languages.pll-filtered-languages{background:#a03f3f}#wpadminbar #wp-admin-bar-languages.pll-filtered-languages span.ab-label{color:#fff}.pll-notice.notice{padding-right:38px;position:relative}.pll-notice a.notice-dismiss{text-decoration:none}.pll-notice .button{margin-right:10px}@media screen and (max-width:782px){#wpbody-content .pll-settings .pll-configure>td{padding:20px}#wpbody-content .pll-settings #cb{padding:20px 9px}.pll-inline-block{width:auto}.pll-settings-url-col{display:block;width:100%}#wpbody-content .pll-settings #pll-licenses-table td{display:block}.pll-configure .pll-deactivate-license{margin:10px 0 5px}.translation label{display:block;padding-left:0;width:95%}.translation input,.translation textarea{width:95%}#edit-term-translations .pll-language-name,#select-add-term-language .pll-select-flag,#select-edit-term-language .pll-select-flag{display:none}#edit-term-translations{width:100%}#add-term-translations .pll-language-column{line-height:38px}#edit-term-translations td{padding:8px 10px}#edit-term-translations .pll-edit-column,#edit-term-translations .pll-language-column{width:20px}.term-translations .pll-edit-column,.term-translations .pll-language-column,.term-translations .pll-translation-column{display:table-cell}.term-translations .hidden{display:none}#wpadminbar #wp-admin-bar-languages{display:block}#wpadminbar #wp-admin-bar-languages>.ab-item{text-align:center;width:50px}#wpadminbar #wp-admin-bar-languages>.ab-item .ab-icon:before{font:32px/1 dashicons;top:-1px}#wpadminbar #wp-admin-bar-languages>.ab-item img{margin:19px 0}#wpadminbar #wp-admin-bar-languages #wp-admin-bar-all .ab-item .ab-icon{font-size:20px!important;line-height:20px!important;margin-right:6px}}
1
+ #add-lang select{width:95%}#add-lang label,.pll-legend{margin:.35em 0 .5em}.pll-legend{color:#1d2327;display:block;font-weight:400;padding:2px 0;text-shadow:none}.column-locale,.languages .column-slug{width:15%}.column-default_lang{width:5%}.column-count,.column-flag,.column-term_group{width:10%}.pll-wizard-content .icon-default-lang:before,td.column-default_lang .icon-default-lang:before{content:"\f155";font-family:dashicons}.pll-icon:before{display:inline-block;text-align:left;width:15px}.pll-circle:before{content:"\25cf"}#pll-about-box p,#pll-recommended p{text-align:justify}#pll-about-box input{float:right;margin:0;padding:0}.stringstranslations .column-context,.stringstranslations .column-name{width:10%}.stringstranslations .column-string{width:33%}.translation label{display:inline-block;vertical-align:top;width:23%}.translation{display:flex}@media screen and (max-width:782px){.translation{display:block}}.translation textarea{display:block}.translation input,.translation textarea{box-sizing:border-box;margin-bottom:4px;width:72%}.pll-settings{margin-top:20px}.pll-settings .plugin-title{width:25%}#wpbody-content .pll-settings .pll-configure tr{display:table-row}#wpbody-content .pll-settings .pll-configure td{display:table-cell}#wpbody-content .pll-settings .pll-configure>td{padding:20px 20px 20px 40px}.pll-configure legend{font-size:14px;font-weight:600;margin-bottom:.5em}.pll-configure td .description{margin-bottom:.5em;margin-top:2px}.pll-configure p.submit{margin-top:20px}.pll-configure .button{margin-right:20px}.pll-configure fieldset{margin-bottom:1.5em}.pll-inline-block-list{margin:0}.pll-inline-block-list li{display:inline-block;margin:0;width:250px}#pll-domains-table td{border:none;-webkit-box-shadow:none;box-shadow:none;padding:2px 2px 2px 1.5em}.pll-settings-url-col{display:inline-block;vertical-align:top;width:49%}#pll-licenses-table td{vertical-align:top}#pll-licenses-table label{font-size:1em;font-weight:600}.pll-configure .pll-deactivate-license{margin:0 0 0 20px}.wp-list-table td[class*=column-language_],.wp-list-table th[class*=column-language_]{box-sizing:content-box;width:1.5em}.pll-dir-rtl input[type=text],.pll-dir-rtl textarea{direction:rtl}.pll-dir-ltr input[type=text],.pll-dir-ltr textarea{direction:ltr}.pll-dir-ltr .tr_lang,.pll-dir-rtl .tr_lang{direction:inherit}#ml_box p{margin-top:1em}#post-translations p{float:left;margin-top:1em}.rtl #post-translations p{float:right}#post-translations table{clear:both;table-layout:fixed;width:100%}#post-translations a{text-decoration:none}#post-translations .pll-column-icon,#post-translations .pll-language-column{width:20px}#post-translations .tr_lang{width:100%}#post-translations td{padding:2px}#post-translations .spinner,#term-translations .spinner{background-position:50%;float:none;margin:0;width:auto}#select-post-language .pll-select-flag{margin-right:10px;padding:4px}.rtl #select-post-language .pll-select-flag{margin-left:10px;margin-right:0;padding:4px}#select-media-language .pll-select-flag{margin-right:10px;padding:4px}.pll-media-edit-column{float:right}.pll-translation-flag{margin-right:14px}#select-add-term-language .pll-select-flag{margin-right:13px;padding:11px}#select-edit-term-language .pll-select-flag{margin-right:4px;padding:11px}#term-translations p{color:#23282d;font-style:normal;font-weight:400;padding:2px}#add-term-translations,#edit-term-translations{width:95%}#term-translations .pll-language-column{line-height:28px;width:20%}#add-term-translations .pll-language-column,#term-translations .pll-edit-column{width:20px}#edit-term-translations .pll-language-column{font-weight:400;padding:15px 10px}.pll_icon_add:before{content:"\f132"}.pll_icon_edit:before{content:"\f464"}[class^=pll_icon_]{font:20px/1 dashicons;vertical-align:middle}#wpadminbar #wp-admin-bar-languages .ab-item img{margin:0 8px 0 2px}#wpadminbar #wp-admin-bar-languages #wp-admin-bar-all .ab-item .ab-icon{float:none;top:4px}#wpadminbar #wp-admin-bar-languages .ab-icon:before{content:"\f326";top:1px}#wp-admin-bar-languages.pll-filtered-languages{background:#a03f3f}#wpadminbar #wp-admin-bar-languages.pll-filtered-languages span.ab-label{color:#fff}.pll-notice.notice{padding-right:38px;position:relative}.pll-notice a.notice-dismiss{text-decoration:none}.pll-notice .button{margin-right:10px}@media screen and (max-width:782px){#wpbody-content .pll-settings .pll-configure>td{padding:20px}#wpbody-content .pll-settings #cb{padding:20px 9px}.pll-inline-block{width:auto}.pll-settings-url-col{display:block;width:100%}#wpbody-content .pll-settings #pll-licenses-table td{display:block}.pll-configure .pll-deactivate-license{margin:10px 0 5px}.translation label{display:block;padding-left:0;width:95%}.translation input,.translation textarea{width:95%}#edit-term-translations .pll-language-name,#select-add-term-language .pll-select-flag,#select-edit-term-language .pll-select-flag{display:none}#edit-term-translations{width:100%}#add-term-translations .pll-language-column{line-height:38px}#edit-term-translations td{padding:8px 10px}#edit-term-translations .pll-edit-column,#edit-term-translations .pll-language-column{width:20px}.term-translations .pll-edit-column,.term-translations .pll-language-column,.term-translations .pll-translation-column{display:table-cell}.term-translations .hidden{display:none}#wpadminbar #wp-admin-bar-languages{display:block}#wpadminbar #wp-admin-bar-languages>.ab-item{text-align:center;width:50px}#wpadminbar #wp-admin-bar-languages>.ab-item .ab-icon:before{font:32px/1 dashicons;top:-1px}#wpadminbar #wp-admin-bar-languages>.ab-item img{margin:19px 0}#wpadminbar #wp-admin-bar-languages #wp-admin-bar-all .ab-item .ab-icon{font-size:20px!important;line-height:20px!important;margin-right:6px}}
frontend/frontend-auto-translate.php CHANGED
@@ -112,14 +112,8 @@ class PLL_Frontend_Auto_Translate {
112
  }
113
 
114
  // Tag
115
- $arr = array();
116
  if ( ! empty( $qv['tag'] ) ) {
117
- $sep = strpos( $qv['tag'], ',' ) !== false ? ',' : '+'; // Two possible separators for tag slugs
118
- foreach ( explode( $sep, $qv['tag'] ) as $slug ) {
119
- $arr[] = $this->get_translated_term_by( 'slug', $slug, 'post_tag' );
120
- }
121
-
122
- $qv['tag'] = implode( $sep, $arr );
123
  }
124
 
125
  // tag_id can only take one id
@@ -143,14 +137,8 @@ class PLL_Frontend_Auto_Translate {
143
  // According to the codex, this type of query is deprecated as of WP 3.1 but it does not appear in WP 3.5 source code
144
  foreach ( array_intersect( $this->model->get_translated_taxonomies(), get_taxonomies( array( '_builtin' => false ) ) ) as $taxonomy ) {
145
  $tax = get_taxonomy( $taxonomy );
146
- $arr = array();
147
  if ( ! empty( $tax ) && ! empty( $qv[ $tax->query_var ] ) ) {
148
- $sep = strpos( $qv[ $tax->query_var ], ',' ) !== false ? ',' : '+'; // Two possible separators
149
- foreach ( explode( $sep, $qv[ $tax->query_var ] ) as $slug ) {
150
- $arr[] = $this->get_translated_term_by( 'slug', $slug, $taxonomy );
151
- }
152
-
153
- $qv[ $tax->query_var ] = implode( $sep, $arr );
154
  }
155
  }
156
 
@@ -300,4 +288,35 @@ class PLL_Frontend_Auto_Translate {
300
  }
301
  return $term;
302
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
  }
112
  }
113
 
114
  // Tag
 
115
  if ( ! empty( $qv['tag'] ) ) {
116
+ $qv['tag'] = $this->translate_terms_list( $qv['tag'], 'post_tag' );
 
 
 
 
 
117
  }
118
 
119
  // tag_id can only take one id
137
  // According to the codex, this type of query is deprecated as of WP 3.1 but it does not appear in WP 3.5 source code
138
  foreach ( array_intersect( $this->model->get_translated_taxonomies(), get_taxonomies( array( '_builtin' => false ) ) ) as $taxonomy ) {
139
  $tax = get_taxonomy( $taxonomy );
 
140
  if ( ! empty( $tax ) && ! empty( $qv[ $tax->query_var ] ) ) {
141
+ $qv[ $tax->query_var ] = $this->translate_terms_list( $qv[ $tax->query_var ], $taxonomy );
 
 
 
 
 
142
  }
143
  }
144
 
288
  }
289
  return $term;
290
  }
291
+
292
+ /**
293
+ * Translates a list of term slugs provided either as an array or a string
294
+ * with slugs separated by a comma or a '+'.
295
+ *
296
+ * @since 3.2.8
297
+ *
298
+ * @param string|string[] $query_var The list of term slugs.
299
+ * @param string $taxonomy The taxonomy for terms.
300
+ * @return string|string[] The translated list.
301
+ */
302
+ protected function translate_terms_list( $query_var, $taxonomy ) {
303
+ $slugs = array();
304
+
305
+ if ( is_array( $query_var ) ) {
306
+ $slugs = &$query_var;
307
+ } elseif ( is_string( $query_var ) ) {
308
+ $sep = strpos( $query_var, ',' ) !== false ? ',' : '+'; // Two possible separators.
309
+ $slugs = explode( $sep, $query_var );
310
+ }
311
+
312
+ foreach ( $slugs as &$slug ) {
313
+ $slug = $this->get_translated_term_by( 'slug', $slug, $taxonomy );
314
+ }
315
+
316
+ if ( ! empty( $sep ) ) {
317
+ $query_var = implode( $sep, $slugs );
318
+ }
319
+
320
+ return $query_var;
321
+ }
322
  }
include/model.php CHANGED
@@ -387,13 +387,13 @@ class PLL_Model {
387
  *
388
  * @since 1.7
389
  *
390
- * @return array
391
  */
392
  public function get_filtered_taxonomies_query_vars() {
393
  $query_vars = array();
394
  foreach ( $this->get_filtered_taxonomies() as $filtered_tax ) {
395
  $tax = get_taxonomy( $filtered_tax );
396
- if ( ! empty( $tax ) ) {
397
  $query_vars[] = $tax->query_var;
398
  }
399
  }
@@ -650,6 +650,11 @@ class PLL_Model {
650
  * @return int[]
651
  */
652
  public function get_posts_with_no_lang( $post_types, $limit ) {
 
 
 
 
 
653
  return get_posts(
654
  array(
655
  'numberposts' => $limit,
@@ -660,7 +665,7 @@ class PLL_Model {
660
  'tax_query' => array(
661
  array(
662
  'taxonomy' => 'language',
663
- 'terms' => $this->get_languages_list( array( 'fields' => 'term_id' ) ),
664
  'operator' => 'NOT IN',
665
  ),
666
  ),
@@ -680,6 +685,11 @@ class PLL_Model {
680
  public function get_terms_with_no_lang( $taxonomies, $limit ) {
681
  global $wpdb;
682
 
 
 
 
 
 
683
  $taxonomies = (array) $taxonomies;
684
 
685
  $sql = sprintf(
@@ -690,7 +700,7 @@ class PLL_Model {
690
  )
691
  %s",
692
  implode( "','", array_map( 'esc_sql', $taxonomies ) ),
693
- implode( ',', array_map( 'intval', $this->get_languages_list( array( 'fields' => 'tl_term_taxonomy_id' ) ) ) ),
694
  $limit > 0 ? sprintf( 'LIMIT %d', intval( $limit ) ) : ''
695
  );
696
 
387
  *
388
  * @since 1.7
389
  *
390
+ * @return string[]
391
  */
392
  public function get_filtered_taxonomies_query_vars() {
393
  $query_vars = array();
394
  foreach ( $this->get_filtered_taxonomies() as $filtered_tax ) {
395
  $tax = get_taxonomy( $filtered_tax );
396
+ if ( ! empty( $tax ) && is_string( $tax->query_var ) ) {
397
  $query_vars[] = $tax->query_var;
398
  }
399
  }
650
  * @return int[]
651
  */
652
  public function get_posts_with_no_lang( $post_types, $limit ) {
653
+ $languages = $this->get_languages_list( array( 'fields' => 'term_id' ) );
654
+ if ( empty( $languages ) ) {
655
+ return array(); // Don't report if no languages have been defined yet.
656
+ }
657
+
658
  return get_posts(
659
  array(
660
  'numberposts' => $limit,
665
  'tax_query' => array(
666
  array(
667
  'taxonomy' => 'language',
668
+ 'terms' => $languages,
669
  'operator' => 'NOT IN',
670
  ),
671
  ),
685
  public function get_terms_with_no_lang( $taxonomies, $limit ) {
686
  global $wpdb;
687
 
688
+ $languages = $this->get_languages_list( array( 'fields' => 'tl_term_taxonomy_id' ) );
689
+ if ( empty( $languages ) ) {
690
+ return array(); // Don't report if no languages have been defined yet.
691
+ }
692
+
693
  $taxonomies = (array) $taxonomies;
694
 
695
  $sql = sprintf(
700
  )
701
  %s",
702
  implode( "','", array_map( 'esc_sql', $taxonomies ) ),
703
+ implode( ',', array_map( 'intval', $languages ) ),
704
  $limit > 0 ? sprintf( 'LIMIT %d', intval( $limit ) ) : ''
705
  );
706
 
polylang.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: Polylang
11
  * Plugin URI: https://polylang.pro
12
  * Description: Adds multilingual capability to WordPress
13
- * Version: 3.2.7
14
  * Requires at least: 5.6
15
  * Requires PHP: 5.6
16
  * Author: WP SYNTEX
@@ -53,7 +53,7 @@ if ( defined( 'POLYLANG_VERSION' ) ) {
53
  }
54
  } else {
55
  // Go on loading the plugin
56
- define( 'POLYLANG_VERSION', '3.2.7' );
57
  define( 'PLL_MIN_WP_VERSION', '5.6' );
58
  define( 'PLL_MIN_PHP_VERSION', '5.6' );
59
 
10
  * Plugin Name: Polylang
11
  * Plugin URI: https://polylang.pro
12
  * Description: Adds multilingual capability to WordPress
13
+ * Version: 3.2.8
14
  * Requires at least: 5.6
15
  * Requires PHP: 5.6
16
  * Author: WP SYNTEX
53
  }
54
  } else {
55
  // Go on loading the plugin
56
+ define( 'POLYLANG_VERSION', '3.2.8' );
57
  define( 'PLL_MIN_WP_VERSION', '5.6' );
58
  define( 'PLL_MIN_PHP_VERSION', '5.6' );
59
 
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: Chouby, manooweb, raaaahman, marianne38, sebastienserre, greglone,
3
  Donate link: https://polylang.pro
4
  Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
5
  Requires at least: 5.6
6
- Tested up to: 6.0
7
  Requires PHP: 5.6
8
- Stable tag: 3.2.7
9
  License: GPLv3 or later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -103,7 +103,14 @@ Wherever third party code has been used, credit has been given in the code’s c
103
 
104
  == Changelog ==
105
 
106
- = 3.2.7 (2022-0-20) =
 
 
 
 
 
 
 
107
 
108
  * Work around a WooCommerce 6.9.x bug causing a fatal error in the wizard. #1116
109
 
3
  Donate link: https://polylang.pro
4
  Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
5
  Requires at least: 5.6
6
+ Tested up to: 6.1
7
  Requires PHP: 5.6
8
+ Stable tag: 3.2.8
9
  License: GPLv3 or later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
103
 
104
  == Changelog ==
105
 
106
+ = 3.2.8 (2022-10-17) =
107
+
108
+ * Fix PHP warning when a filtered taxonomy has no query var #1124
109
+ * Fix SQL error when attempting to get objects without languages and no language exist #1126
110
+ * Fix error when term slugs are provided as array in WP_Query #1119, #1132 Props Susanna Häggblom
111
+ * Fix a CSS regression in the wizard causing the default language icon to be removed #1137
112
+
113
+ = 3.2.7 (2022-09-20) =
114
 
115
  * Work around a WooCommerce 6.9.x bug causing a fatal error in the wizard. #1116
116