Version Description
(2019-08-27) =
- Pro: Fix a conflict preventing meta synchronization when ACF is active
- Pro: Fix post metas not correctly copied when translating a Beaver Builder page
- Pro: Fix a fatal error when posts made with Elementor are synchronized
- Pro: Fix Prewiew button not working correctly when using one domain per language
- Pro: Fix post synchronization not available for WP CRON and WP CLI
- Fix future posts not available in the autocomplete input field of the languages metabox
- Fix translations files not loaded on REST requests
- Fix deleted term parent not synchronized
Download this release
Release Info
Developer | Chouby |
Plugin | Polylang |
Version | 2.6.4 |
Comparing to | |
See all releases |
Code changes from version 2.6.3 to 2.6.4
- admin/admin.php +7 -4
- include/base.php +5 -0
- include/filters-links.php +5 -4
- include/rest-request.php +4 -4
- include/translated-post.php +13 -3
- modules/sync/sync-metas.php +5 -5
- modules/sync/sync.php +2 -1
- polylang.php +2 -2
- readme.txt +12 -1
admin/admin.php
CHANGED
@@ -137,10 +137,6 @@ class PLL_Admin extends PLL_Admin_Base {
|
|
137 |
$this->share_term_slug = new PLL_Admin_Share_Term_Slug( $this );
|
138 |
}
|
139 |
|
140 |
-
if ( class_exists( 'PLL_Sync_Content' ) ) {
|
141 |
-
$this->sync_content = new PLL_Sync_Content( $this );
|
142 |
-
}
|
143 |
-
|
144 |
// Duplicate content
|
145 |
if ( class_exists( 'PLL_Duplicate' ) ) {
|
146 |
$this->duplicate = new PLL_Duplicate( $this );
|
@@ -154,6 +150,13 @@ class PLL_Admin extends PLL_Admin_Base {
|
|
154 |
if ( pll_use_block_editor_plugin() ) {
|
155 |
$this->block_editor_plugin = new PLL_Block_Editor_Plugin( $this );
|
156 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
}
|
158 |
|
159 |
/**
|
137 |
$this->share_term_slug = new PLL_Admin_Share_Term_Slug( $this );
|
138 |
}
|
139 |
|
|
|
|
|
|
|
|
|
140 |
// Duplicate content
|
141 |
if ( class_exists( 'PLL_Duplicate' ) ) {
|
142 |
$this->duplicate = new PLL_Duplicate( $this );
|
150 |
if ( pll_use_block_editor_plugin() ) {
|
151 |
$this->block_editor_plugin = new PLL_Block_Editor_Plugin( $this );
|
152 |
}
|
153 |
+
|
154 |
+
// FIXME: Specific for WP CRON and WP CLI as the action admin_init is not fired.
|
155 |
+
// Waiting for a better way to handle the cases without loading the complete admin.
|
156 |
+
if ( wp_doing_cron() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
|
157 |
+
$this->maybe_load_sync_post();
|
158 |
+
}
|
159 |
+
|
160 |
}
|
161 |
|
162 |
/**
|
include/base.php
CHANGED
@@ -44,6 +44,11 @@ abstract class PLL_Base {
|
|
44 |
}
|
45 |
|
46 |
if ( $this->model->get_languages_list() ) {
|
|
|
|
|
|
|
|
|
|
|
47 |
// Active languages
|
48 |
if ( class_exists( 'PLL_Active_Languages' ) ) {
|
49 |
$this->active_languages = new PLL_Active_Languages( $this );
|
44 |
}
|
45 |
|
46 |
if ( $this->model->get_languages_list() ) {
|
47 |
+
// Used by content duplicate and post synchronization
|
48 |
+
if ( class_exists( 'PLL_Sync_Content' ) ) {
|
49 |
+
$this->sync_content = new PLL_Sync_Content( $this );
|
50 |
+
}
|
51 |
+
|
52 |
// Active languages
|
53 |
if ( class_exists( 'PLL_Active_Languages' ) ) {
|
54 |
$this->active_languages = new PLL_Active_Languages( $this );
|
include/filters-links.php
CHANGED
@@ -22,7 +22,7 @@ class PLL_Filters_Links {
|
|
22 |
$this->options = &$polylang->options;
|
23 |
$this->curlang = &$polylang->curlang;
|
24 |
|
25 |
-
// Low priority on links filters to come after any other modifications
|
26 |
if ( $this->options['force_lang'] ) {
|
27 |
add_filter( 'post_link', array( $this, 'post_type_link' ), 20, 2 );
|
28 |
add_filter( '_get_page_link', array( $this, '_get_page_link' ), 20, 2 );
|
@@ -35,11 +35,12 @@ class PLL_Filters_Links {
|
|
35 |
add_filter( 'attachment_link', array( $this, 'attachment_link' ), 20, 2 );
|
36 |
}
|
37 |
|
38 |
-
|
|
|
39 |
add_filter( 'preview_post_link', array( $this, 'preview_post_link' ), 20 );
|
40 |
}
|
41 |
|
42 |
-
// Rewrites post types archives links to filter them by language
|
43 |
add_filter( 'post_type_archive_link', array( $this, 'post_type_archive_link' ), 20, 2 );
|
44 |
}
|
45 |
|
@@ -136,7 +137,7 @@ class PLL_Filters_Links {
|
|
136 |
}
|
137 |
|
138 |
/**
|
139 |
-
*
|
140 |
*
|
141 |
* @since 1.6.1
|
142 |
*
|
22 |
$this->options = &$polylang->options;
|
23 |
$this->curlang = &$polylang->curlang;
|
24 |
|
25 |
+
// Low priority on links filters to come after any other modifications.
|
26 |
if ( $this->options['force_lang'] ) {
|
27 |
add_filter( 'post_link', array( $this, 'post_type_link' ), 20, 2 );
|
28 |
add_filter( '_get_page_link', array( $this, '_get_page_link' ), 20, 2 );
|
35 |
add_filter( 'attachment_link', array( $this, 'attachment_link' ), 20, 2 );
|
36 |
}
|
37 |
|
38 |
+
// Keeps the preview post link on default domain when using multiple domains and SSO is not available.
|
39 |
+
if ( 3 === $this->options['force_lang'] && ! class_exists( 'PLL_Xdata_Domain' ) ) {
|
40 |
add_filter( 'preview_post_link', array( $this, 'preview_post_link' ), 20 );
|
41 |
}
|
42 |
|
43 |
+
// Rewrites post types archives links to filter them by language.
|
44 |
add_filter( 'post_type_archive_link', array( $this, 'post_type_archive_link' ), 20, 2 );
|
45 |
}
|
46 |
|
137 |
}
|
138 |
|
139 |
/**
|
140 |
+
* Keeps the preview post link on default domain when using multiple domains
|
141 |
*
|
142 |
* @since 1.6.1
|
143 |
*
|
include/rest-request.php
CHANGED
@@ -29,6 +29,10 @@ class PLL_REST_Request extends PLL_Base {
|
|
29 |
parent::init();
|
30 |
|
31 |
if ( $this->model->get_languages_list() ) {
|
|
|
|
|
|
|
|
|
32 |
$this->filters_links = new PLL_Filters_Links( $this );
|
33 |
|
34 |
// Static front page and page for posts
|
@@ -57,10 +61,6 @@ class PLL_REST_Request extends PLL_Base {
|
|
57 |
$this->translate_slugs = new PLL_Translate_Slugs( $slugs_model, $curlang );
|
58 |
}
|
59 |
|
60 |
-
if ( class_exists( 'PLL_Sync_Content' ) ) {
|
61 |
-
$this->sync_content = new PLL_Sync_Content( $this );
|
62 |
-
}
|
63 |
-
|
64 |
if ( class_exists( 'PLL_Sync_Post_REST' ) ) {
|
65 |
$this->sync_post = new PLL_Sync_Post_REST( $this );
|
66 |
}
|
29 |
parent::init();
|
30 |
|
31 |
if ( $this->model->get_languages_list() ) {
|
32 |
+
|
33 |
+
/** This action is documented in include/class-polylang.php */
|
34 |
+
do_action( 'pll_no_language_defined' ); // To load overridden textdomains.
|
35 |
+
|
36 |
$this->filters_links = new PLL_Filters_Links( $this );
|
37 |
|
38 |
// Static front page and page for posts
|
61 |
$this->translate_slugs = new PLL_Translate_Slugs( $slugs_model, $curlang );
|
62 |
}
|
63 |
|
|
|
|
|
|
|
|
|
64 |
if ( class_exists( 'PLL_Sync_Post_REST' ) ) {
|
65 |
$this->sync_post = new PLL_Sync_Post_REST( $this );
|
66 |
}
|
include/translated-post.php
CHANGED
@@ -179,9 +179,19 @@ class PLL_Translated_Post extends PLL_Translated_Object {
|
|
179 |
return is_user_logged_in() && ( current_user_can( $post_type_object->cap->read_private_posts ) || $user->ID == $post->post_author ); // Comparison must not be strict!
|
180 |
}
|
181 |
|
182 |
-
|
183 |
-
|
184 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
}
|
186 |
|
187 |
return false;
|
179 |
return is_user_logged_in() && ( current_user_can( $post_type_object->cap->read_private_posts ) || $user->ID == $post->post_author ); // Comparison must not be strict!
|
180 |
}
|
181 |
|
182 |
+
// In edit context, show draft and future posts.
|
183 |
+
if ( 'edit' === $context ) {
|
184 |
+
$states = get_post_stati(
|
185 |
+
array(
|
186 |
+
'protected' => true,
|
187 |
+
'show_in_admin_all_list' => true,
|
188 |
+
)
|
189 |
+
);
|
190 |
+
|
191 |
+
if ( in_array( $post->post_status, $states ) ) {
|
192 |
+
$user = wp_get_current_user();
|
193 |
+
return is_user_logged_in() && ( current_user_can( 'edit_posts' ) || $user->ID == $post->post_author ); // Comparison must not be strict!
|
194 |
+
}
|
195 |
}
|
196 |
|
197 |
return false;
|
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, wp_slash( $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, wp_slash( $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, wp_slash( $value ) );
|
291 |
}
|
292 |
}
|
293 |
}
|
@@ -328,7 +328,7 @@ 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, wp_slash( $to_value ) );
|
332 |
} else {
|
333 |
// Multiple custom fields, either in the source or the target
|
334 |
if ( ! empty( $tr_metas[ $key ] ) ) {
|
@@ -339,7 +339,7 @@ abstract class PLL_Sync_Metas {
|
|
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, wp_slash( $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, $meta_key, is_string( $meta_value ) ? wp_slash( $meta_value ) : $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, $meta_key, is_string( $meta_value ) ? wp_slash( $meta_value ) : $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, $key, is_string( $value ) ? wp_slash( $value ) : $value );
|
291 |
}
|
292 |
}
|
293 |
}
|
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 ] ) ) {
|
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 |
}
|
modules/sync/sync.php
CHANGED
@@ -175,7 +175,8 @@ class PLL_Sync {
|
|
175 |
$translations = $this->model->term->get_translations( $term_id );
|
176 |
|
177 |
foreach ( $translations as $lang => $tr_id ) {
|
178 |
-
if ( ! empty( $tr_id ) && $tr_id !== $term_id
|
|
|
179 |
$wpdb->update(
|
180 |
$wpdb->term_taxonomy,
|
181 |
array( 'parent' => isset( $tr_parent ) ? $tr_parent : 0 ),
|
175 |
$translations = $this->model->term->get_translations( $term_id );
|
176 |
|
177 |
foreach ( $translations as $lang => $tr_id ) {
|
178 |
+
if ( ! empty( $tr_id ) && $tr_id !== $term_id ) {
|
179 |
+
$tr_parent = $this->model->term->get_translation( $term->parent, $lang );
|
180 |
$wpdb->update(
|
181 |
$wpdb->term_taxonomy,
|
182 |
array( 'parent' => isset( $tr_parent ) ? $tr_parent : 0 ),
|
polylang.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/**
|
4 |
Plugin Name: Polylang
|
5 |
Plugin URI: https://polylang.pro
|
6 |
-
Version: 2.6.
|
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.
|
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.4
|
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.4' );
|
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.
|
8 |
License: GPLv3 or later
|
9 |
|
10 |
Making WordPress multilingual
|
@@ -76,6 +76,17 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
|
|
76 |
|
77 |
== Changelog ==
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
= 2.6.3 (2019-08-06) =
|
80 |
|
81 |
* Pro: Fix fatal error when updating an ACF field from frontend
|
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.4
|
8 |
License: GPLv3 or later
|
9 |
|
10 |
Making WordPress multilingual
|
76 |
|
77 |
== Changelog ==
|
78 |
|
79 |
+
= 2.6.4 (2019-08-27) =
|
80 |
+
|
81 |
+
* Pro: Fix a conflict preventing meta synchronization when ACF is active
|
82 |
+
* Pro: Fix post metas not correctly copied when translating a Beaver Builder page
|
83 |
+
* Pro: Fix a fatal error when posts made with Elementor are synchronized
|
84 |
+
* Pro: Fix Prewiew button not working correctly when using one domain per language
|
85 |
+
* Pro: Fix post synchronization not available for WP CRON and WP CLI
|
86 |
+
* Fix future posts not available in the autocomplete input field of the languages metabox
|
87 |
+
* Fix translations files not loaded on REST requests
|
88 |
+
* Fix deleted term parent not synchronized
|
89 |
+
|
90 |
= 2.6.3 (2019-08-06) =
|
91 |
|
92 |
* Pro: Fix fatal error when updating an ACF field from frontend
|