Polylang - Version 2.7.3

Version Description

(2020-05-26) =

  • Security: Slash metas
  • Pro: Fix categories not savedafter the language has been switched in the block editor
  • Pro: Fix ACF fields stored as integers instead of strings
  • Pro: Fix ACF untranslated posts or terms being copied when creating a new translation
  • Pro: Fix PHP notice with ACF when a repeater or group is included in a flexible content
  • Pro: Fix "DevTools failed to load SourceMap" warning in browser console
  • Update plugin updater to 1.7.1
  • Honor the filter "pll_the_language_link" when the language switcher displays a dropdown #506
  • Fix "Something went wrong" message when quick editing untranslated post types #508
  • Fix wpseo_opengraph deprecated warning #509
Download this release

Release Info

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

Code changes from version 2.7.2 to 2.7.3

admin/admin-base.php CHANGED
@@ -135,20 +135,21 @@ class PLL_Admin_Base extends PLL_Base {
135
 
136
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
137
 
138
- // For each script:
139
- // 0 => the pages on which to load the script
140
- // 1 => the scripts it needs to work
141
- // 2 => 1 if loaded even if languages have not been defined yet, 0 otherwise
142
- // 3 => 1 if loaded in footer
143
- // FIXME: check if I can load more scripts in footer
 
144
  $scripts = array(
145
- 'post' => array( array( 'edit', 'upload' ), array( 'jquery', 'wp-ajax-response' ), 0, 1 ),
146
- 'term' => array( array( 'edit-tags', 'term' ), array( 'jquery', 'wp-ajax-response', 'jquery-ui-autocomplete' ), 0, 1 ),
147
- 'user' => array( array( 'profile', 'user-edit' ), array( 'jquery' ), 0, 0 ),
148
- 'widgets' => array( array( 'widgets' ), array( 'jquery' ), 0, 0 ),
149
  );
150
 
151
  if ( ! empty( $screen->post_type ) && $this->model->is_translated_post_type( $screen->post_type ) ) {
 
 
152
  // Classic editor.
153
  if ( ! method_exists( $screen, 'is_block_editor' ) || ! $screen->is_block_editor() ) {
154
  $scripts['classic-editor'] = array( array( 'post', 'media', 'async-upload' ), array( 'jquery', 'wp-ajax-response', 'post' ), 0, 1 );
@@ -160,6 +161,10 @@ class PLL_Admin_Base extends PLL_Base {
160
  }
161
  }
162
 
 
 
 
 
163
  foreach ( $scripts as $script => $v ) {
164
  if ( in_array( $screen->base, $v[0] ) && ( $v[2] || $this->model->get_languages_list() ) ) {
165
  wp_enqueue_script( 'pll_' . $script, plugins_url( '/js/' . $script . $suffix . '.js', POLYLANG_FILE ), $v[1], POLYLANG_VERSION, $v[3] );
135
 
136
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
137
 
138
+ /*
139
+ * For each script:
140
+ * 0 => the pages on which to load the script
141
+ * 1 => the scripts it needs to work
142
+ * 2 => 1 if loaded even if languages have not been defined yet, 0 otherwise
143
+ * 3 => 1 if loaded in footer
144
+ */
145
  $scripts = array(
146
+ 'user' => array( array( 'profile', 'user-edit' ), array( 'jquery' ), 0, 0 ),
147
+ 'widgets' => array( array( 'widgets' ), array( 'jquery' ), 0, 0 ),
 
 
148
  );
149
 
150
  if ( ! empty( $screen->post_type ) && $this->model->is_translated_post_type( $screen->post_type ) ) {
151
+ $scripts['post'] = array( array( 'edit', 'upload' ), array( 'jquery', 'wp-ajax-response' ), 0, 1 );
152
+
153
  // Classic editor.
154
  if ( ! method_exists( $screen, 'is_block_editor' ) || ! $screen->is_block_editor() ) {
155
  $scripts['classic-editor'] = array( array( 'post', 'media', 'async-upload' ), array( 'jquery', 'wp-ajax-response', 'post' ), 0, 1 );
161
  }
162
  }
163
 
164
+ if ( ! empty( $screen->taxonomy ) && $this->model->is_translated_taxonomy( $screen->taxonomy ) ) {
165
+ $scripts['term'] = array( array( 'edit-tags', 'term' ), array( 'jquery', 'wp-ajax-response', 'jquery-ui-autocomplete' ), 0, 1 );
166
+ }
167
+
168
  foreach ( $scripts as $script => $v ) {
169
  if ( in_array( $screen->base, $v[0] ) && ( $v[2] || $this->model->get_languages_list() ) ) {
170
  wp_enqueue_script( 'pll_' . $script, plugins_url( '/js/' . $script . $suffix . '.js', POLYLANG_FILE ), $v[1], POLYLANG_VERSION, $v[3] );
include/switcher.php CHANGED
@@ -187,13 +187,6 @@ class PLL_Switcher {
187
 
188
  // Javascript to switch the language when using a dropdown list
189
  if ( $args['dropdown'] ) {
190
- $urls = array();
191
-
192
- foreach ( $links->model->get_languages_list() as $language ) {
193
- $url = $links->get_translation_url( $language );
194
- $urls[ $language->slug ] = $args['force_home'] || empty( $url ) ? $links->get_home_url( $language ) : $url;
195
- }
196
-
197
  // Accept only few valid characters for the urls_x variable name ( as the widget id includes '-' which is invalid )
198
  $out .= sprintf(
199
  '<script type="text/javascript">
@@ -205,7 +198,7 @@ class PLL_Switcher {
205
  //]]>
206
  </script>',
207
  'urls_' . preg_replace( '#[^a-zA-Z0-9]#', '', $args['dropdown'] ),
208
- wp_json_encode( $urls ),
209
  esc_js( $args['name'] )
210
  );
211
  }
187
 
188
  // Javascript to switch the language when using a dropdown list
189
  if ( $args['dropdown'] ) {
 
 
 
 
 
 
 
190
  // Accept only few valid characters for the urls_x variable name ( as the widget id includes '-' which is invalid )
191
  $out .= sprintf(
192
  '<script type="text/javascript">
198
  //]]>
199
  </script>',
200
  'urls_' . preg_replace( '#[^a-zA-Z0-9]#', '', $args['dropdown'] ),
201
+ wp_json_encode( wp_list_pluck( $elements, 'url' ) ),
202
  esc_js( $args['name'] )
203
  );
204
  }
install/plugin-updater.php CHANGED
@@ -10,7 +10,7 @@ if ( ! defined( 'ABSPATH' ) ) {
10
  * Modified version with 'polylang' text domain and comments for translators
11
  *
12
  * @author Easy Digital Downloads
13
- * @version 1.7
14
  */
15
  class PLL_Plugin_Updater {
16
 
@@ -203,10 +203,6 @@ class PLL_Plugin_Updater {
203
  $version_info->icons = $this->convert_object_to_array( $version_info->icons );
204
  }
205
 
206
- if ( isset( $version_info->icons ) && ! is_array( $version_info->icons ) ) {
207
- $version_info->icons = $this->convert_object_to_array( $version_info->icons );
208
- }
209
-
210
  if ( isset( $version_info->contributors ) && ! is_array( $version_info->contributors ) ) {
211
  $version_info->contributors = $this->convert_object_to_array( $version_info->contributors );
212
  }
@@ -326,10 +322,8 @@ class PLL_Plugin_Updater {
326
  )
327
  );
328
 
329
- $cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
330
-
331
  // Get the transient where we store the api request for this plugin for 24 hours
332
- $edd_api_request_transient = $this->get_cached_version_info( $cache_key );
333
 
334
  //If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
335
  if ( empty( $edd_api_request_transient ) ) {
@@ -337,7 +331,7 @@ class PLL_Plugin_Updater {
337
  $api_response = $this->api_request( 'plugin_information', $to_send );
338
 
339
  // Expires in 3 hours
340
- $this->set_version_info_cache( $api_response, $cache_key );
341
 
342
  if ( false !== $api_response ) {
343
  $_data = $api_response;
@@ -502,6 +496,9 @@ class PLL_Plugin_Updater {
502
  return $request;
503
  }
504
 
 
 
 
505
  public function show_changelog() {
506
 
507
  global $edd_plugin_data;
@@ -523,9 +520,7 @@ class PLL_Plugin_Updater {
523
  }
524
 
525
  $data = $edd_plugin_data[ $_REQUEST['slug'] ];
526
- $beta = ! empty( $data['beta'] ) ? true : false;
527
- $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' );
528
- $version_info = $this->get_cached_version_info( $cache_key );
529
 
530
  if( false === $version_info ) {
531
 
@@ -546,7 +541,6 @@ class PLL_Plugin_Updater {
546
  $version_info = json_decode( wp_remote_retrieve_body( $request ) );
547
  }
548
 
549
-
550
  if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
551
  $version_info->sections = maybe_unserialize( $version_info->sections );
552
  } else {
@@ -559,17 +553,28 @@ class PLL_Plugin_Updater {
559
  }
560
  }
561
 
562
- $this->set_version_info_cache( $version_info, $cache_key );
563
 
 
 
564
  }
565
 
566
- if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
567
- echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
 
 
 
568
  }
569
 
570
  exit;
571
  }
572
 
 
 
 
 
 
 
573
  public function get_cached_version_info( $cache_key = '' ) {
574
 
575
  if( empty( $cache_key ) ) {
@@ -592,6 +597,12 @@ class PLL_Plugin_Updater {
592
 
593
  }
594
 
 
 
 
 
 
 
595
  public function set_version_info_cache( $value = '', $cache_key = '' ) {
596
 
597
  if( empty( $cache_key ) ) {
@@ -605,6 +616,8 @@ class PLL_Plugin_Updater {
605
 
606
  update_option( $cache_key, $data, 'no' );
607
 
 
 
608
  }
609
 
610
  /**
@@ -618,3 +631,4 @@ class PLL_Plugin_Updater {
618
  }
619
 
620
  }
 
10
  * Modified version with 'polylang' text domain and comments for translators
11
  *
12
  * @author Easy Digital Downloads
13
+ * @version 1.7.1
14
  */
15
  class PLL_Plugin_Updater {
16
 
203
  $version_info->icons = $this->convert_object_to_array( $version_info->icons );
204
  }
205
 
 
 
 
 
206
  if ( isset( $version_info->contributors ) && ! is_array( $version_info->contributors ) ) {
207
  $version_info->contributors = $this->convert_object_to_array( $version_info->contributors );
208
  }
322
  )
323
  );
324
 
 
 
325
  // Get the transient where we store the api request for this plugin for 24 hours
326
+ $edd_api_request_transient = $this->get_cached_version_info();
327
 
328
  //If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
329
  if ( empty( $edd_api_request_transient ) ) {
331
  $api_response = $this->api_request( 'plugin_information', $to_send );
332
 
333
  // Expires in 3 hours
334
+ $this->set_version_info_cache( $api_response );
335
 
336
  if ( false !== $api_response ) {
337
  $_data = $api_response;
496
  return $request;
497
  }
498
 
499
+ /**
500
+ * If available, show the changelog for sites in a multisite install.
501
+ */
502
  public function show_changelog() {
503
 
504
  global $edd_plugin_data;
520
  }
521
 
522
  $data = $edd_plugin_data[ $_REQUEST['slug'] ];
523
+ $version_info = $this->get_cached_version_info();
 
 
524
 
525
  if( false === $version_info ) {
526
 
541
  $version_info = json_decode( wp_remote_retrieve_body( $request ) );
542
  }
543
 
 
544
  if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
545
  $version_info->sections = maybe_unserialize( $version_info->sections );
546
  } else {
553
  }
554
  }
555
 
556
+ $this->set_version_info_cache( $version_info );
557
 
558
+ // Delete the unneeded option
559
+ delete_option( md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $this->beta . '_version_info' ) );
560
  }
561
 
562
+ if ( isset( $version_info->sections ) ) {
563
+ $sections = $this->convert_object_to_array( $version_info->sections );
564
+ if ( ! empty( $sections['changelog'] ) ) {
565
+ echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections['changelog'] ) . '</div>';
566
+ }
567
  }
568
 
569
  exit;
570
  }
571
 
572
+ /**
573
+ * Gets the plugin's cached version information from the database.
574
+ *
575
+ * @param string $cache_key
576
+ * @return boolean|string
577
+ */
578
  public function get_cached_version_info( $cache_key = '' ) {
579
 
580
  if( empty( $cache_key ) ) {
597
 
598
  }
599
 
600
+ /**
601
+ * Adds the plugin version information to the database.
602
+ *
603
+ * @param string $value
604
+ * @param string $cache_key
605
+ */
606
  public function set_version_info_cache( $value = '', $cache_key = '' ) {
607
 
608
  if( empty( $cache_key ) ) {
616
 
617
  update_option( $cache_key, $data, 'no' );
618
 
619
+ // Delete the duplicate option
620
+ delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ) );
621
  }
622
 
623
  /**
631
  }
632
 
633
  }
634
+
modules/plugins/wpseo-ogp.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ use Yoast\WP\SEO\Presenters\Abstract_Indexable_Presenter;
4
+
5
+ /**
6
+ * Creates an Opengraph alternate locale meta tag to be consumed by Yoast SEO
7
+ * Requires Yoast SEO 14.0 or newer.
8
+ *
9
+ * @since 2.7.3
10
+ */
11
+ final class PLL_WPSEO_OGP extends Abstract_Indexable_Presenter {
12
+ /**
13
+ * Facebook locale
14
+ *
15
+ * @var string $locale
16
+ */
17
+ private $locale;
18
+
19
+ /**
20
+ * Constructor
21
+ *
22
+ * @since 2.7.3
23
+ *
24
+ * @param string $locale Facebook locale.
25
+ */
26
+ public function __construct( $locale ) {
27
+ $this->locale = $locale;
28
+ }
29
+
30
+ /**
31
+ * Returns the meta Opengraph alternate locale meta tag
32
+ *
33
+ * @since 2.7.3
34
+ *
35
+ * @return string
36
+ */
37
+ public function present() {
38
+ return sprintf( '<meta property="og:locale:alternate" content="%s" />', esc_attr( $this->get() ) );
39
+ }
40
+
41
+ /**
42
+ * Returns the alternate locale
43
+ *
44
+ * @since 2.7.3
45
+ *
46
+ * @return string
47
+ */
48
+ public function get() {
49
+ return $this->locale;
50
+ }
51
+ }
52
+
modules/plugins/wpseo.php CHANGED
@@ -35,7 +35,11 @@ class PLL_WPSEO {
35
  }
36
 
37
  add_filter( 'pll_home_url_white_list', array( $this, 'wpseo_home_url_white_list' ) );
38
- add_action( 'wpseo_opengraph', array( $this, 'wpseo_ogp' ), 2 );
 
 
 
 
39
  add_filter( 'wpseo_canonical', array( $this, 'wpseo_canonical' ) );
40
  } else {
41
  add_action( 'admin_init', array( $this, 'wpseo_register_strings' ) );
@@ -315,6 +319,26 @@ class PLL_WPSEO {
315
  return array_merge( $arr, array( array( 'file' => 'wordpress-seo' ) ) );
316
  }
317
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
  /**
319
  * Adds opengraph support for translations
320
  *
@@ -325,21 +349,32 @@ class PLL_WPSEO {
325
 
326
  // WPSEO already deals with the locale
327
  if ( did_action( 'pll_init' ) && method_exists( $wpseo_og, 'og_tag' ) ) {
328
- $alternates = array();
329
-
330
- foreach ( PLL()->model->get_languages_list() as $language ) {
331
- if ( PLL()->curlang->slug !== $language->slug && PLL()->links->get_translation_url( $language ) && isset( $language->facebook ) ) {
332
- $alternates[] = $language->facebook;
333
- }
334
  }
 
 
335
 
336
- // There is a risk that 2 languages have the same Facebook locale. So let's make sure to output each locale only once.
337
- $alternates = array_unique( $alternates );
338
-
339
- foreach ( $alternates as $lang ) {
340
- $wpseo_og->og_tag( 'og:locale:alternate', $lang );
 
 
 
 
 
 
 
 
 
 
 
 
341
  }
342
  }
 
343
  }
344
 
345
  /**
35
  }
36
 
37
  add_filter( 'pll_home_url_white_list', array( $this, 'wpseo_home_url_white_list' ) );
38
+ if ( version_compare( WPSEO_VERSION, '14.0', '<' ) ) {
39
+ add_action( 'wpseo_opengraph', array( $this, 'wpseo_ogp' ), 2 );
40
+ } else {
41
+ add_filter( 'wpseo_frontend_presenters', array( $this, 'wpseo_frontend_presenters' ) );
42
+ }
43
  add_filter( 'wpseo_canonical', array( $this, 'wpseo_canonical' ) );
44
  } else {
45
  add_action( 'admin_init', array( $this, 'wpseo_register_strings' ) );
319
  return array_merge( $arr, array( array( 'file' => 'wordpress-seo' ) ) );
320
  }
321
 
322
+ /**
323
+ * Get alternate language codes for Opengraph
324
+ *
325
+ * @since 2.7.3
326
+ *
327
+ * @return array
328
+ */
329
+ protected function get_ogp_alternate_languages() {
330
+ $alternates = array();
331
+
332
+ foreach ( PLL()->model->get_languages_list() as $language ) {
333
+ if ( PLL()->curlang->slug !== $language->slug && PLL()->links->get_translation_url( $language ) && isset( $language->facebook ) ) {
334
+ $alternates[] = $language->facebook;
335
+ }
336
+ }
337
+
338
+ // There is a risk that 2 languages have the same Facebook locale. So let's make sure to output each locale only once.
339
+ return array_unique( $alternates );
340
+ }
341
+
342
  /**
343
  * Adds opengraph support for translations
344
  *
349
 
350
  // WPSEO already deals with the locale
351
  if ( did_action( 'pll_init' ) && method_exists( $wpseo_og, 'og_tag' ) ) {
352
+ foreach ( $this->get_ogp_alternate_languages() as $lang ) {
353
+ $wpseo_og->og_tag( 'og:locale:alternate', $lang );
 
 
 
 
354
  }
355
+ }
356
+ }
357
 
358
+ /**
359
+ * Adds opengraph support for translations
360
+ *
361
+ * @since 2.7.3
362
+ *
363
+ * @param array $presenters An array of objects implementing Abstract_Indexable_Presenter
364
+ * @return array
365
+ */
366
+ public function wpseo_frontend_presenters( $presenters ) {
367
+ $_presenters = array();
368
+
369
+ foreach ( $presenters as $presenter ) {
370
+ $_presenters[] = $presenter;
371
+ if ( $presenter instanceof Yoast\WP\SEO\Presenters\Open_Graph\Locale_Presenter ) {
372
+ foreach ( $this->get_ogp_alternate_languages() as $lang ) {
373
+ $_presenters[] = new PLL_WPSEO_OGP( $lang );
374
+ }
375
  }
376
  }
377
+ return $_presenters;
378
  }
379
 
380
  /**
modules/sync/sync-metas.php CHANGED
@@ -178,7 +178,7 @@ abstract class PLL_Sync_Metas {
178
  $to_copy = $this->get_metas_to_copy( $id, $tr_id, $lang, true );
179
  if ( in_array( $meta_key, $to_copy ) ) {
180
  $meta_value = $this->maybe_translate_value( $meta_value, $meta_key, $id, $tr_id, $lang );
181
- add_metadata( $this->meta_type, $tr_id, $meta_key, is_string( $meta_value ) ? wp_slash( $meta_value ) : $meta_value );
182
  }
183
  }
184
  }
@@ -235,7 +235,7 @@ abstract class PLL_Sync_Metas {
235
  if ( empty( $this->prev_value[ $hash ] ) || $this->prev_value[ $hash ] === $prev_meta->meta_value ) {
236
  $prev_value = $this->maybe_translate_value( $prev_meta->meta_value, $meta_key, $id, $tr_id, $lang );
237
  $meta_value = $this->maybe_translate_value( $meta_value, $meta_key, $id, $tr_id, $lang );
238
- update_metadata( $this->meta_type, $tr_id, $meta_key, is_string( $meta_value ) ? wp_slash( $meta_value ) : $meta_value, $prev_value );
239
  }
240
  }
241
  }
@@ -287,7 +287,7 @@ abstract class PLL_Sync_Metas {
287
  if ( '' !== $value && null !== $value && false !== $value ) { // Same test as WP
288
  $value = $this->maybe_translate_value( $value, $key, $id, $tr_id, $lang );
289
  }
290
- delete_metadata( $this->meta_type, $tr_id, $key, is_string( $value ) ? wp_slash( $value ) : $value );
291
  }
292
  }
293
  }
@@ -320,7 +320,7 @@ abstract class PLL_Sync_Metas {
320
  if ( empty( $metas[ $key ] ) ) {
321
  if ( ! empty( $tr_metas[ $key ] ) ) {
322
  // If the meta key is not present in the source object, delete all values
323
- delete_metadata( $this->meta_type, $to, $key );
324
  }
325
  } else {
326
  if ( ! empty( $tr_metas[ $key ] ) && 1 === count( $metas[ $key ] ) && 1 === count( $tr_metas[ $key ] ) ) {
@@ -328,18 +328,18 @@ abstract class PLL_Sync_Metas {
328
  $value = reset( $metas[ $key ] );
329
  $value = maybe_unserialize( $value );
330
  $to_value = $this->maybe_translate_value( $value, $key, $from, $to, $lang );
331
- update_metadata( $this->meta_type, $to, $key, is_string( $to_value ) ? wp_slash( $to_value ) : $to_value );
332
  } else {
333
  // Multiple custom fields, either in the source or the target
334
  if ( ! empty( $tr_metas[ $key ] ) ) {
335
  // The synchronization of multiple values custom fields is easier if we delete all metas first
336
- delete_metadata( $this->meta_type, $to, $key );
337
  }
338
 
339
  foreach ( $metas[ $key ] as $value ) {
340
  $value = maybe_unserialize( $value );
341
  $to_value = $this->maybe_translate_value( $value, $key, $from, $to, $lang );
342
- add_metadata( $this->meta_type, $to, $key, is_string( $to_value ) ? wp_slash( $to_value ) : $to_value );
343
  }
344
  }
345
  }
178
  $to_copy = $this->get_metas_to_copy( $id, $tr_id, $lang, true );
179
  if ( in_array( $meta_key, $to_copy ) ) {
180
  $meta_value = $this->maybe_translate_value( $meta_value, $meta_key, $id, $tr_id, $lang );
181
+ add_metadata( $this->meta_type, $tr_id, wp_slash( $meta_key ), is_object( $meta_value ) ? $meta_value : wp_slash( $meta_value ) );
182
  }
183
  }
184
  }
235
  if ( empty( $this->prev_value[ $hash ] ) || $this->prev_value[ $hash ] === $prev_meta->meta_value ) {
236
  $prev_value = $this->maybe_translate_value( $prev_meta->meta_value, $meta_key, $id, $tr_id, $lang );
237
  $meta_value = $this->maybe_translate_value( $meta_value, $meta_key, $id, $tr_id, $lang );
238
+ update_metadata( $this->meta_type, $tr_id, wp_slash( $meta_key ), is_object( $meta_value ) ? $meta_value : wp_slash( $meta_value ), $prev_value );
239
  }
240
  }
241
  }
287
  if ( '' !== $value && null !== $value && false !== $value ) { // Same test as WP
288
  $value = $this->maybe_translate_value( $value, $key, $id, $tr_id, $lang );
289
  }
290
+ delete_metadata( $this->meta_type, $tr_id, wp_slash( $key ), is_object( $value ) ? $value : wp_slash( $value ) );
291
  }
292
  }
293
  }
320
  if ( empty( $metas[ $key ] ) ) {
321
  if ( ! empty( $tr_metas[ $key ] ) ) {
322
  // If the meta key is not present in the source object, delete all values
323
+ delete_metadata( $this->meta_type, $to, wp_slash( $key ) );
324
  }
325
  } else {
326
  if ( ! empty( $tr_metas[ $key ] ) && 1 === count( $metas[ $key ] ) && 1 === count( $tr_metas[ $key ] ) ) {
328
  $value = reset( $metas[ $key ] );
329
  $value = maybe_unserialize( $value );
330
  $to_value = $this->maybe_translate_value( $value, $key, $from, $to, $lang );
331
+ update_metadata( $this->meta_type, $to, wp_slash( $key ), is_object( $to_value ) ? $to_value : wp_slash( $to_value ) );
332
  } else {
333
  // Multiple custom fields, either in the source or the target
334
  if ( ! empty( $tr_metas[ $key ] ) ) {
335
  // The synchronization of multiple values custom fields is easier if we delete all metas first
336
+ delete_metadata( $this->meta_type, $to, wp_slash( $key ) );
337
  }
338
 
339
  foreach ( $metas[ $key ] as $value ) {
340
  $value = maybe_unserialize( $value );
341
  $to_value = $this->maybe_translate_value( $value, $key, $from, $to, $lang );
342
+ add_metadata( $this->meta_type, $to, wp_slash( $key ), is_object( $to_value ) ? $to_value : wp_slash( $to_value ) );
343
  }
344
  }
345
  }
polylang.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Polylang
5
  * Plugin URI: https://polylang.pro
6
  * Description: Adds multilingual capability to WordPress
7
- * Version: 2.7.2
8
  * Requires at least: 4.9
9
  * Requires PHP: 5.6
10
  * Author: WP SYNTEX
@@ -55,7 +55,7 @@ if ( defined( 'POLYLANG_BASENAME' ) ) {
55
  }
56
  } else {
57
  // Go on loading the plugin
58
- define( 'POLYLANG_VERSION', '2.7.2' );
59
  define( 'PLL_MIN_WP_VERSION', '4.9' );
60
  define( 'PLL_MIN_PHP_VERSION', '5.6' );
61
 
4
  * Plugin Name: Polylang
5
  * Plugin URI: https://polylang.pro
6
  * Description: Adds multilingual capability to WordPress
7
+ * Version: 2.7.3
8
  * Requires at least: 4.9
9
  * Requires PHP: 5.6
10
  * Author: WP SYNTEX
55
  }
56
  } else {
57
  // Go on loading the plugin
58
+ define( 'POLYLANG_VERSION', '2.7.3' );
59
  define( 'PLL_MIN_WP_VERSION', '4.9' );
60
  define( 'PLL_MIN_PHP_VERSION', '5.6' );
61
 
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.4
7
  Requires PHP: 5.6
8
- Stable tag: 2.7.2
9
  License: GPLv3 or later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -78,6 +78,19 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
78
 
79
  == Changelog ==
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  = 2.7.2 (2020-04-27) =
82
 
83
  * Pro: Re-allow to modify the capability for strings translations
5
  Requires at least: 4.9
6
  Tested up to: 5.4
7
  Requires PHP: 5.6
8
+ Stable tag: 2.7.3
9
  License: GPLv3 or later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
78
 
79
  == Changelog ==
80
 
81
+ = 2.7.3 (2020-05-26) =
82
+
83
+ * Security: Slash metas
84
+ * Pro: Fix categories not savedafter the language has been switched in the block editor
85
+ * Pro: Fix ACF fields stored as integers instead of strings
86
+ * Pro: Fix ACF untranslated posts or terms being copied when creating a new translation
87
+ * Pro: Fix PHP notice with ACF when a repeater or group is included in a flexible content
88
+ * Pro: Fix "DevTools failed to load SourceMap" warning in browser console
89
+ * Update plugin updater to 1.7.1
90
+ * Honor the filter "pll_the_language_link" when the language switcher displays a dropdown #506
91
+ * Fix "Something went wrong" message when quick editing untranslated post types #508
92
+ * Fix wpseo_opengraph deprecated warning #509
93
+
94
  = 2.7.2 (2020-04-27) =
95
 
96
  * Pro: Re-allow to modify the capability for strings translations