Polylang - Version 2.8.1

Version Description

(2020-08-25) =

  • Pro: Fix fatal error with WP 4.9
  • Fix pll_the_languages() with 'raw' option returning html flag instead of flag url #558
  • Fix compatibility with Duplicate Posts not correcly loaded #557
  • Fix custom flag size in admin bar language switcher #559
  • Fix tag clouds mixed in the classic editor #561
Download this release

Release Info

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

Code changes from version 2.8 to 2.8.1

include/language.php CHANGED
@@ -229,13 +229,36 @@ class PLL_Language {
229
  * @param string $alt optional alt attribute
230
  */
231
  public static function get_flag_html( $flag, $title = '', $alt = '' ) {
232
- return empty( $flag['src'] ) ? '' : sprintf(
233
- '<img src="%s"%s%s%s%s />',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  $flag['src'],
235
- empty( $title ) ? '' : sprintf( ' title="%s"', esc_attr( $title ) ),
236
- empty( $alt ) ? '' : sprintf( ' alt="%s"', esc_attr( $alt ) ),
237
- empty( $flag['width'] ) ? '' : sprintf( ' width="%s"', (int) $flag['width'] ),
238
- empty( $flag['height'] ) ? '' : sprintf( ' height="%s"', (int) $flag['height'] )
 
239
  );
240
  }
241
 
@@ -254,7 +277,7 @@ class PLL_Language {
254
  * @since 2.8
255
  */
256
  public function get_display_flag_url() {
257
- return empty( $this->custom_flag_url ) ? $this->flag : $this->custom_flag_url;
258
  }
259
 
260
  /**
229
  * @param string $alt optional alt attribute
230
  */
231
  public static function get_flag_html( $flag, $title = '', $alt = '' ) {
232
+ if ( empty( $flag['src'] ) ) {
233
+ return '';
234
+ }
235
+
236
+ $title_attr = empty( $title ) ? '' : sprintf( ' title="%s"', esc_attr( $title ) );
237
+ $alt_attr = empty( $alt ) ? '' : sprintf( ' alt="%s"', esc_attr( $alt ) );
238
+ $width_attr = empty( $flag['width'] ) ? '' : sprintf( ' width="%s"', (int) $flag['width'] );
239
+ $height_attr = empty( $flag['height'] ) ? '' : sprintf( ' height="%s"', (int) $flag['height'] );
240
+
241
+ $style = '';
242
+ $sizes = array_intersect_key( $flag, array_flip( array( 'width', 'height' ) ) );
243
+
244
+ if ( ! empty( $sizes ) ) {
245
+ array_walk(
246
+ $sizes,
247
+ function ( &$value, $key ) {
248
+ $value = sprintf( '%s: %dpx;', esc_attr( $key ), (int) $value );
249
+ }
250
+ );
251
+ $style = sprintf( ' style="%s"', implode( ' ', $sizes ) );
252
+ }
253
+
254
+ return sprintf(
255
+ '<img src="%s"%s%s%s%s%s />',
256
  $flag['src'],
257
+ $title_attr,
258
+ $alt_attr,
259
+ $width_attr,
260
+ $height_attr,
261
+ $style
262
  );
263
  }
264
 
277
  * @since 2.8
278
  */
279
  public function get_display_flag_url() {
280
+ return empty( $this->custom_flag_url ) ? $this->flag_url : $this->custom_flag_url;
281
  }
282
 
283
  /**
install/upgrade.php CHANGED
@@ -92,7 +92,7 @@ class PLL_Upgrade {
92
  * @since 1.2
93
  */
94
  public function _upgrade() {
95
- foreach ( array( '0.9', '1.0', '1.1', '1.2', '1.2.1', '1.2.3', '1.3', '1.4', '1.4.1', '1.4.4', '1.5', '1.6', '1.7.4', '1.8', '2.0.8', '2.1', '2.7', '2.8' ) as $version ) {
96
  if ( version_compare( $this->options['version'], $version, '<' ) ) {
97
  call_user_func( array( $this, 'upgrade_' . str_replace( '.', '_', $version ) ) );
98
  }
@@ -635,16 +635,17 @@ class PLL_Upgrade {
635
  }
636
 
637
  /**
638
- * Upgrades if the previous version is < 2.8
639
  *
640
  * Deletes language cache due to:
641
  * - 'redirect_lang' option removed for subdomains and multiple domains in 2.2
642
  * - W3C and Facebook locales added to PLL_Language objects in 2.3
643
  * - flags moved to a different directory in Polylang Pro 2.8
 
644
  *
645
- * @since 2.8
646
  */
647
- protected function upgrade_2_8() {
648
  delete_transient( 'pll_languages_list' );
649
  }
650
  }
92
  * @since 1.2
93
  */
94
  public function _upgrade() {
95
+ foreach ( array( '0.9', '1.0', '1.1', '1.2', '1.2.1', '1.2.3', '1.3', '1.4', '1.4.1', '1.4.4', '1.5', '1.6', '1.7.4', '1.8', '2.0.8', '2.1', '2.7', '2.8.1' ) as $version ) {
96
  if ( version_compare( $this->options['version'], $version, '<' ) ) {
97
  call_user_func( array( $this, 'upgrade_' . str_replace( '.', '_', $version ) ) );
98
  }
635
  }
636
 
637
  /**
638
+ * Upgrades if the previous version is < 2.8.1
639
  *
640
  * Deletes language cache due to:
641
  * - 'redirect_lang' option removed for subdomains and multiple domains in 2.2
642
  * - W3C and Facebook locales added to PLL_Language objects in 2.3
643
  * - flags moved to a different directory in Polylang Pro 2.8
644
+ * - bug of flags url returning html fixed in 2.8.1
645
  *
646
+ * @since 2.8.1
647
  */
648
+ protected function upgrade_2_8_1() {
649
  delete_transient( 'pll_languages_list' );
650
  }
651
  }
integrations/duplicate-post/duplicate-post.php CHANGED
@@ -27,7 +27,7 @@ class PLL_Duplicate_Post {
27
  * @param array|string $taxonomies
28
  * @return array
29
  */
30
- public function duplicate_post_taxonomies_blacklist( $taxonomies ) {
31
  if ( empty( $taxonomies ) ) {
32
  $taxonomies = array(); // As we get an empty string when there is no taxonomy
33
  }
27
  * @param array|string $taxonomies
28
  * @return array
29
  */
30
+ public function taxonomies_blacklist( $taxonomies ) {
31
  if ( empty( $taxonomies ) ) {
32
  $taxonomies = array(); // As we get an empty string when there is no taxonomy
33
  }
js/classic-editor.js CHANGED
@@ -45,9 +45,9 @@
45
  );
46
 
47
  // add an if else condition to allow modifying the tags outputed when switching the language
48
- if ( v = $( '.the-tagcloud' ).css( 'display' ) ) {
49
- $( '.the-tagcloud' ).replaceWith( r );
50
- $( '.the-tagcloud' ).css( 'display', v );
51
  }
52
  else {
53
  $( '#' + id ).after( r );
45
  );
46
 
47
  // add an if else condition to allow modifying the tags outputed when switching the language
48
+ if ( v = $( '#tagcloud-' + tax ).css( 'display' ) ) {
49
+ $( '#tagcloud-' + tax ).replaceWith( r );
50
+ $( '#tagcloud-' + tax ).css( 'display', v );
51
  }
52
  else {
53
  $( '#' + id ).after( r );
js/classic-editor.min.js CHANGED
@@ -1 +1 @@
1
- !function(t){t.ajaxPrefilter(function(a,l,n){"string"==typeof a.data&&-1!==a.url.indexOf("action=ajax-tag-search")&&(lang=t(".post_lang_choice").val())&&(a.data="lang="+lang+"&"+a.data)})}(jQuery),function(t){tagBox.get=function(a){var l=a.substr(a.indexOf("-")+1),n={action:"get-tagcloud",lang:t(".post_lang_choice").val(),tax:l};t.post(ajaxurl,n,function(n,e){0!=n&&"success"==e||(n=wpAjax.broken),n=t("<div />").addClass("the-tagcloud").attr("id","tagcloud-"+l).html(n),t("a",n).click(function(){return tagBox.flushTags(t(this).closest(".inside").children(".tagsdiv"),this),!1}),(v=t(".the-tagcloud").css("display"))?(t(".the-tagcloud").replaceWith(n),t(".the-tagcloud").css("display",v)):t("#"+a).after(n)})}}(jQuery),jQuery(document).ready(function(t){var a=new Array;function l(){t(".tr_lang").each(function(){var a=t(this).attr("id").substring(8),l=t(this).parent().parent().siblings(".pll-edit-column");t(this).autocomplete({minLength:0,source:ajaxurl+"?action=pll_posts_not_translated&post_language="+t(".post_lang_choice").val()+"&translation_language="+a+"&post_type="+t("#post_type").val()+"&_pll_nonce="+t("#_pll_nonce").val(),select:function(n,e){t("#htr_lang_"+a).val(e.item.id),l.html(e.item.link)}}),t(this).blur(function(){t(this).val()||(t("#htr_lang_"+a).val(0),l.html(l.siblings(".hidden").children().clone()))})})}t(".categorydiv").each(function(){var l,n;(l=t(this).attr("id").split("-")).shift(),n=l.join("-"),a.push(n),t("#"+n+"-add-submit").before(t("<input />").attr("type","hidden").attr("id",n+"-lang").attr("name","term_lang_choice").attr("value",t(".post_lang_choice").val()))}),t(".post_lang_choice").change(function(){var n=t(this).val(),e=t(this).children('option[value="'+n+'"]').attr("lang"),i=t('.pll-translation-column > span[lang="'+e+'"]').attr("dir"),s={action:"post_lang_choice",lang:n,post_type:t("#post_type").val(),taxonomies:a,post_id:t("#post_ID").val(),_pll_nonce:t("#_pll_nonce").val()};t.post(ajaxurl,s,function(a){var n=wpAjax.parseAjaxResponse(a,"ajax-response");t.each(n.responses,function(){switch(this.what){case"translations":t(".translations").html(this.data),l();break;case"taxonomy":var a=this.data;t("#"+a+"checklist").html(this.supplemental.all),t("#"+a+"checklist-pop").html(this.supplemental.populars),t("#new"+a+"_parent").replaceWith(this.supplemental.dropdown),t("#"+a+"-lang").val(t(".post_lang_choice").val());break;case"pages":t("#parent_id").html(this.data);break;case"flag":t(".pll-select-flag").html(this.data);break;case"permalink":var n=t("#edit-slug-box");"-1"!=this.data&&n.children().length&&n.html(this.data)}}),t(".tagcloud-link").each(function(){var a=t(this).attr("id");tagBox.get(a)}),t("body").removeClass("pll-dir-rtl").removeClass("pll-dir-ltr").addClass("pll-dir-"+i),t("#content_ifr").contents().find("html").attr("lang",e).attr("dir",i),t("#content_ifr").contents().find("body").attr("dir",i)})}),l()});
1
+ !function(t){t.ajaxPrefilter(function(a,l,n){"string"==typeof a.data&&-1!==a.url.indexOf("action=ajax-tag-search")&&(lang=t(".post_lang_choice").val())&&(a.data="lang="+lang+"&"+a.data)})}(jQuery),function(t){tagBox.get=function(a){var l=a.substr(a.indexOf("-")+1),n={action:"get-tagcloud",lang:t(".post_lang_choice").val(),tax:l};t.post(ajaxurl,n,function(n,e){0!=n&&"success"==e||(n=wpAjax.broken),n=t("<div />").addClass("the-tagcloud").attr("id","tagcloud-"+l).html(n),t("a",n).click(function(){return tagBox.flushTags(t(this).closest(".inside").children(".tagsdiv"),this),!1}),(v=t("#tagcloud-"+l).css("display"))?(t("#tagcloud-"+l).replaceWith(n),t("#tagcloud-"+l).css("display",v)):t("#"+a).after(n)})}}(jQuery),jQuery(document).ready(function(t){var a=new Array;function l(){t(".tr_lang").each(function(){var a=t(this).attr("id").substring(8),l=t(this).parent().parent().siblings(".pll-edit-column");t(this).autocomplete({minLength:0,source:ajaxurl+"?action=pll_posts_not_translated&post_language="+t(".post_lang_choice").val()+"&translation_language="+a+"&post_type="+t("#post_type").val()+"&_pll_nonce="+t("#_pll_nonce").val(),select:function(n,e){t("#htr_lang_"+a).val(e.item.id),l.html(e.item.link)}}),t(this).blur(function(){t(this).val()||(t("#htr_lang_"+a).val(0),l.html(l.siblings(".hidden").children().clone()))})})}t(".categorydiv").each(function(){var l,n;(l=t(this).attr("id").split("-")).shift(),n=l.join("-"),a.push(n),t("#"+n+"-add-submit").before(t("<input />").attr("type","hidden").attr("id",n+"-lang").attr("name","term_lang_choice").attr("value",t(".post_lang_choice").val()))}),t(".post_lang_choice").change(function(){var n=t(this).val(),e=t(this).children('option[value="'+n+'"]').attr("lang"),i=t('.pll-translation-column > span[lang="'+e+'"]').attr("dir"),s={action:"post_lang_choice",lang:n,post_type:t("#post_type").val(),taxonomies:a,post_id:t("#post_ID").val(),_pll_nonce:t("#_pll_nonce").val()};t.post(ajaxurl,s,function(a){var n=wpAjax.parseAjaxResponse(a,"ajax-response");t.each(n.responses,function(){switch(this.what){case"translations":t(".translations").html(this.data),l();break;case"taxonomy":var a=this.data;t("#"+a+"checklist").html(this.supplemental.all),t("#"+a+"checklist-pop").html(this.supplemental.populars),t("#new"+a+"_parent").replaceWith(this.supplemental.dropdown),t("#"+a+"-lang").val(t(".post_lang_choice").val());break;case"pages":t("#parent_id").html(this.data);break;case"flag":t(".pll-select-flag").html(this.data);break;case"permalink":var n=t("#edit-slug-box");"-1"!=this.data&&n.children().length&&n.html(this.data)}}),t(".tagcloud-link").each(function(){var a=t(this).attr("id");tagBox.get(a)}),t("body").removeClass("pll-dir-rtl").removeClass("pll-dir-ltr").addClass("pll-dir-"+i),t("#content_ifr").contents().find("html").attr("lang",e).attr("dir",i),t("#content_ifr").contents().find("body").attr("dir",i)})}),l()});
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: 2.8
14
  * Requires at least: 4.9
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', '2.8' );
57
  define( 'PLL_MIN_WP_VERSION', '4.9' );
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: 2.8.1
14
  * Requires at least: 4.9
15
  * Requires PHP: 5.6
16
  * Author: WP SYNTEX
53
  }
54
  } else {
55
  // Go on loading the plugin
56
+ define( 'POLYLANG_VERSION', '2.8.1' );
57
  define( 'PLL_MIN_WP_VERSION', '4.9' );
58
  define( 'PLL_MIN_PHP_VERSION', '5.6' );
59
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: multilingual, bilingual, translate, translation, language, multilanguage,
5
  Requires at least: 4.9
6
  Tested up to: 5.5
7
  Requires PHP: 5.6
8
- Stable tag: 2.8
9
  License: GPLv3 or later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -78,6 +78,14 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
78
 
79
  == Changelog ==
80
 
 
 
 
 
 
 
 
 
81
  = 2.8 (2020-08-17) =
82
 
83
  * Pro: Add a language switcher block
5
  Requires at least: 4.9
6
  Tested up to: 5.5
7
  Requires PHP: 5.6
8
+ Stable tag: 2.8.1
9
  License: GPLv3 or later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
78
 
79
  == Changelog ==
80
 
81
+ = 2.8.1 (2020-08-25) =
82
+
83
+ * Pro: Fix fatal error with WP 4.9
84
+ * Fix pll_the_languages() with 'raw' option returning html flag instead of flag url #558
85
+ * Fix compatibility with Duplicate Posts not correcly loaded #557
86
+ * Fix custom flag size in admin bar language switcher #559
87
+ * Fix tag clouds mixed in the classic editor #561
88
+
89
  = 2.8 (2020-08-17) =
90
 
91
  * Pro: Add a language switcher block