Polylang - Version 2.6.3

Version Description

(2019-08-06) =

  • Pro: Fix fatal error when updating an ACF field from frontend
  • Pro: Add action 'pll_post_synchronized'
  • Allow to get the current or default language object using the API. Props Jory Hogeveen. #359
  • Fix empty span in languages switcher widget when showing only flags
  • Fix wpml_register_single_string when updating the original string
Download this release

Release Info

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

Code changes from version 2.6.2 to 2.6.3

frontend/frontend.php CHANGED
@@ -97,6 +97,10 @@ class PLL_Frontend extends PLL_Base {
97
  new PLL_Share_Term_Slug( $this );
98
  }
99
  }
 
 
 
 
100
  }
101
 
102
  /**
97
  new PLL_Share_Term_Slug( $this );
98
  }
99
  }
100
+
101
+ if ( class_exists( 'PLL_Sync_Post' ) ) {
102
+ $this->sync_post = new PLL_Sync_Post( $this );
103
+ }
104
  }
105
 
106
  /**
include/api.php CHANGED
@@ -37,10 +37,13 @@ function pll_the_languages( $args = '' ) {
37
  *
38
  * @since 0.8.1
39
  *
40
- * @param string $field Optional, the language field to return ( see PLL_Language ), defaults to 'slug'
41
- * @return string|bool The requested field for the current language
42
  */
43
  function pll_current_language( $field = 'slug' ) {
 
 
 
44
  return isset( PLL()->curlang->$field ) ? PLL()->curlang->$field : false;
45
  }
46
 
@@ -49,11 +52,20 @@ function pll_current_language( $field = 'slug' ) {
49
  *
50
  * @since 1.0
51
  *
52
- * @param string $field Optional, the language field to return ( see PLL_Language ), defaults to 'slug'
53
- * @return string The requested field for the default language
54
  */
55
  function pll_default_language( $field = 'slug' ) {
56
- return isset( PLL()->options['default_lang'] ) && ( $lang = PLL()->model->get_language( PLL()->options['default_lang'] ) ) && isset( $lang->$field ) ? $lang->$field : false;
 
 
 
 
 
 
 
 
 
57
  }
58
 
59
  /**
37
  *
38
  * @since 0.8.1
39
  *
40
+ * @param string $field Optional, the language field to return ( see PLL_Language ), defaults to 'slug', pass OBJECT constant to get the language object.
41
+ * @return string|PLL_Language|bool The requested field for the current language
42
  */
43
  function pll_current_language( $field = 'slug' ) {
44
+ if ( OBJECT === $field ) {
45
+ return PLL()->curlang;
46
+ }
47
  return isset( PLL()->curlang->$field ) ? PLL()->curlang->$field : false;
48
  }
49
 
52
  *
53
  * @since 1.0
54
  *
55
+ * @param string $field Optional, the language field to return ( see PLL_Language ), defaults to 'slug', pass OBJECT constant to get the language object.
56
+ * @return string|PLL_Language|bool The requested field for the default language
57
  */
58
  function pll_default_language( $field = 'slug' ) {
59
+ if ( isset( PLL()->options['default_lang'] ) ) {
60
+ $lang = PLL()->model->get_language( PLL()->options['default_lang'] );
61
+ if ( $lang ) {
62
+ if ( OBJECT === $field ) {
63
+ return $lang;
64
+ }
65
+ return isset( $lang->$field ) ? $lang->$field : false;
66
+ }
67
+ }
68
+ return false;
69
  }
70
 
71
  /**
include/walker-list.php CHANGED
@@ -26,7 +26,7 @@ class PLL_Walker_List extends Walker {
26
  esc_attr( $element->locale ),
27
  esc_url( $element->url ),
28
  $element->flag,
29
- $args['show_flags'] ? sprintf( '<span style="margin-%1$s:0.3em;">%2$s</span>', is_rtl() ? 'right' : 'left', esc_html( $element->name ) ) : esc_html( $element->name ),
30
  'discard' === $args['item_spacing'] ? '' : "\t",
31
  'discard' === $args['item_spacing'] ? '' : "\n"
32
  );
26
  esc_attr( $element->locale ),
27
  esc_url( $element->url ),
28
  $element->flag,
29
+ $args['show_flags'] && $args['show_names'] ? sprintf( '<span style="margin-%1$s:0.3em;">%2$s</span>', is_rtl() ? 'right' : 'left', esc_html( $element->name ) ) : esc_html( $element->name ),
30
  'discard' === $args['item_spacing'] ? '' : "\t",
31
  'discard' === $args['item_spacing'] ? '' : "\n"
32
  );
modules/wpml/wpml-compat.php CHANGED
@@ -87,12 +87,14 @@ class PLL_WPML_Compat {
87
  if ( $exist_string && $exist_string !== $string ) {
88
  $languages = PLL()->model->get_languages_list();
89
 
90
- // Assign translations of the old string to the new string.
91
  foreach ( $languages as $language ) {
92
- $mo = new PLL_MO();
93
- $mo->import_from_db( $language );
94
- $mo->add_entry( $mo->make_entry( $string, $mo->translate( $exist_string ) ) );
95
- $mo->export_to_db( $language );
 
 
96
  }
97
  $this->unregister_string( $context, $name );
98
  }
87
  if ( $exist_string && $exist_string !== $string ) {
88
  $languages = PLL()->model->get_languages_list();
89
 
90
+ // Assign translations of the old string to the new string, except for the default language.
91
  foreach ( $languages as $language ) {
92
+ if ( pll_default_language() !== $language->slug ) {
93
+ $mo = new PLL_MO();
94
+ $mo->import_from_db( $language );
95
+ $mo->add_entry( $mo->make_entry( $string, $mo->translate( $exist_string ) ) );
96
+ $mo->export_to_db( $language );
97
+ }
98
  }
99
  $this->unregister_string( $context, $name );
100
  }
polylang.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  Plugin Name: Polylang
5
  Plugin URI: https://polylang.pro
6
- Version: 2.6.2
7
  Author: WP SYNTEX
8
  Author uri: https://polylang.pro
9
  Description: Adds multilingual capability to WordPress
@@ -51,7 +51,7 @@ if ( defined( 'POLYLANG_BASENAME' ) ) {
51
  }
52
  } else {
53
  // Go on loading the plugin
54
- define( 'POLYLANG_VERSION', '2.6.2' );
55
  define( 'PLL_MIN_WP_VERSION', '4.7' );
56
 
57
  define( 'POLYLANG_FILE', __FILE__ ); // this file
3
  /**
4
  Plugin Name: Polylang
5
  Plugin URI: https://polylang.pro
6
+ Version: 2.6.3
7
  Author: WP SYNTEX
8
  Author uri: https://polylang.pro
9
  Description: Adds multilingual capability to WordPress
51
  }
52
  } else {
53
  // Go on loading the plugin
54
+ define( 'POLYLANG_VERSION', '2.6.3' );
55
  define( 'PLL_MIN_WP_VERSION', '4.7' );
56
 
57
  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.7
6
  Tested up to: 5.2
7
- Stable tag: 2.6.2
8
  License: GPLv3 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.6.2 (2019-07-16) =
80
 
81
  * Pro: Fix slow admin in case the translations update server can't be reached
4
  Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
5
  Requires at least: 4.7
6
  Tested up to: 5.2
7
+ Stable tag: 2.6.3
8
  License: GPLv3 or later
9
 
10
  Making WordPress multilingual
76
 
77
  == Changelog ==
78
 
79
+ = 2.6.3 (2019-08-06) =
80
+
81
+ * Pro: Fix fatal error when updating an ACF field from frontend
82
+ * Pro: Add action 'pll_post_synchronized'
83
+ * Allow to get the current or default language object using the API. Props Jory Hogeveen. #359
84
+ * Fix empty span in languages switcher widget when showing only flags
85
+ * Fix wpml_register_single_string when updating the original string
86
+
87
  = 2.6.2 (2019-07-16) =
88
 
89
  * Pro: Fix slow admin in case the translations update server can't be reached