Version Description
(2018-06-07) =
- Pro: The Events Calendar: Fix untranslated events shown in all languages
- Avoid displaying edit links of translations of the privacy policy page to non-admin
- Fix draft created when creating a new page on multisite
- Do not prevent using the cache for home when using WP Rocket 3.0.5 or later #236
- Fix language filter applied to wrong queries on admin side
Download this release
Release Info
Developer | Chouby |
Plugin | Polylang |
Version | 2.3.7 |
Comparing to | |
See all releases |
Code changes from version 2.3.6 to 2.3.7
- admin/admin-base.php +1 -10
- admin/admin-filters.php +11 -1
- admin/admin-links.php +8 -0
- include/filters.php +23 -1
- modules/plugins/cache-compat.php +5 -1
- polylang.php +2 -2
- readme.txt +9 -1
admin/admin-base.php
CHANGED
@@ -115,7 +115,7 @@ class PLL_Admin_Base extends PLL_Base {
|
|
115 |
// 3 => 1 if loaded in footer
|
116 |
// FIXME: check if I can load more scripts in footer
|
117 |
$scripts = array(
|
118 |
-
'post' => array( array( 'post', 'media', 'async-upload', 'edit' ), array( 'jquery', 'wp-ajax-response', 'post', 'jquery-ui-autocomplete' ), 0,
|
119 |
'media' => array( array( 'upload' ), array( 'jquery' ), 0, 1 ),
|
120 |
'term' => array( array( 'edit-tags', 'term' ), array( 'jquery', 'wp-ajax-response', 'jquery-ui-autocomplete' ), 0, 1 ),
|
121 |
'user' => array( array( 'profile', 'user-edit' ), array( 'jquery' ), 0, 0 ),
|
@@ -200,15 +200,6 @@ class PLL_Admin_Base extends PLL_Base {
|
|
200 |
public function set_current_language() {
|
201 |
$this->curlang = $this->filter_lang;
|
202 |
|
203 |
-
// POST
|
204 |
-
if ( isset( $_POST['post_lang_choice'] ) && $lang = $this->model->get_language( $_POST['post_lang_choice'] ) ) {
|
205 |
-
$this->curlang = $lang;
|
206 |
-
} elseif ( isset( $_POST['term_lang_choice'] ) && $lang = $this->model->get_language( $_POST['term_lang_choice'] ) ) {
|
207 |
-
$this->curlang = $lang;
|
208 |
-
} elseif ( isset( $_POST['inline_lang_choice'] ) && $lang = $this->model->get_language( $_POST['inline_lang_choice'] ) ) {
|
209 |
-
$this->curlang = $lang;
|
210 |
-
}
|
211 |
-
|
212 |
// Edit Post
|
213 |
if ( isset( $_REQUEST['pll_post_id'] ) && $lang = $this->model->post->get_language( (int) $_REQUEST['pll_post_id'] ) ) {
|
214 |
$this->curlang = $lang;
|
115 |
// 3 => 1 if loaded in footer
|
116 |
// FIXME: check if I can load more scripts in footer
|
117 |
$scripts = array(
|
118 |
+
'post' => array( array( 'post', 'media', 'async-upload', 'edit' ), array( 'jquery', 'wp-ajax-response', 'post', 'jquery-ui-autocomplete' ), 0, 1 ),
|
119 |
'media' => array( array( 'upload' ), array( 'jquery' ), 0, 1 ),
|
120 |
'term' => array( array( 'edit-tags', 'term' ), array( 'jquery', 'wp-ajax-response', 'jquery-ui-autocomplete' ), 0, 1 ),
|
121 |
'user' => array( array( 'profile', 'user-edit' ), array( 'jquery' ), 0, 0 ),
|
200 |
public function set_current_language() {
|
201 |
$this->curlang = $this->filter_lang;
|
202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
// Edit Post
|
204 |
if ( isset( $_REQUEST['pll_post_id'] ) && $lang = $this->model->post->get_language( (int) $_REQUEST['pll_post_id'] ) ) {
|
205 |
$this->curlang = $lang;
|
admin/admin-filters.php
CHANGED
@@ -212,7 +212,17 @@ class PLL_Admin_Filters extends PLL_Filters {
|
|
212 |
* @return string
|
213 |
*/
|
214 |
public function get_locale( $locale ) {
|
215 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
}
|
217 |
|
218 |
/**
|
212 |
* @return string
|
213 |
*/
|
214 |
public function get_locale( $locale ) {
|
215 |
+
if ( isset( $_POST['post_lang_choice'] ) && $lang = $this->model->get_language( $_POST['post_lang_choice'] ) ) {
|
216 |
+
$locale = $lang->locale;
|
217 |
+
} elseif ( isset( $_POST['term_lang_choice'] ) && $lang = $this->model->get_language( $_POST['term_lang_choice'] ) ) {
|
218 |
+
$locale = $lang->locale;
|
219 |
+
} elseif ( isset( $_POST['inline_lang_choice'] ) && $lang = $this->model->get_language( $_POST['inline_lang_choice'] ) ) {
|
220 |
+
$locale = $lang->locale;
|
221 |
+
} elseif ( ! empty( $this->curlang ) ) {
|
222 |
+
$locale = $this->curlang->locale;
|
223 |
+
}
|
224 |
+
|
225 |
+
return $locale;
|
226 |
}
|
227 |
|
228 |
/**
|
admin/admin-links.php
CHANGED
@@ -23,6 +23,14 @@ class PLL_Admin_Links extends PLL_Links {
|
|
23 |
return '';
|
24 |
}
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
if ( 'attachment' == $post_type ) {
|
27 |
$args = array(
|
28 |
'action' => 'translate_media',
|
23 |
return '';
|
24 |
}
|
25 |
|
26 |
+
// Special case for the privacy policy page which is associated to a specific capability
|
27 |
+
if ( 'page' === $post_type_object->name && ! current_user_can( 'manage_privacy_options' ) ) {
|
28 |
+
$privacy_page = get_option( 'wp_page_for_privacy_policy' );
|
29 |
+
if ( $privacy_page && in_array( $post_id, $this->model->post->get_translations( $privacy_page ) ) ) {
|
30 |
+
return '';
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
if ( 'attachment' == $post_type ) {
|
35 |
$args = array(
|
36 |
'action' => 'translate_media',
|
include/filters.php
CHANGED
@@ -46,6 +46,7 @@ class PLL_Filters {
|
|
46 |
|
47 |
// Translates the privacy policy page
|
48 |
add_filter( 'option_wp_page_for_privacy_policy', array( $this, 'translate_page_for_privacy_policy' ), 20 ); // Since WP 4.9.6
|
|
|
49 |
|
50 |
// Personal data exporter
|
51 |
add_filter( 'wp_privacy_personal_data_exporters', array( $this, 'register_personal_data_exporter' ), 0 ); // Since WP 4.9.6
|
@@ -234,7 +235,6 @@ class PLL_Filters {
|
|
234 |
return $output;
|
235 |
}
|
236 |
|
237 |
-
|
238 |
/**
|
239 |
* Prevents deleting all the translations of the default category
|
240 |
*
|
@@ -288,6 +288,28 @@ class PLL_Filters {
|
|
288 |
return empty( $this->curlang ) ? $id : $this->model->post->get( $id, $this->curlang );
|
289 |
}
|
290 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
291 |
/**
|
292 |
* Register our personal data exporter
|
293 |
*
|
46 |
|
47 |
// Translates the privacy policy page
|
48 |
add_filter( 'option_wp_page_for_privacy_policy', array( $this, 'translate_page_for_privacy_policy' ), 20 ); // Since WP 4.9.6
|
49 |
+
add_filter( 'map_meta_cap', array( $this, 'fix_privacy_policy_page_editing' ), 10, 4 );
|
50 |
|
51 |
// Personal data exporter
|
52 |
add_filter( 'wp_privacy_personal_data_exporters', array( $this, 'register_personal_data_exporter' ), 0 ); // Since WP 4.9.6
|
235 |
return $output;
|
236 |
}
|
237 |
|
|
|
238 |
/**
|
239 |
* Prevents deleting all the translations of the default category
|
240 |
*
|
288 |
return empty( $this->curlang ) ? $id : $this->model->post->get( $id, $this->curlang );
|
289 |
}
|
290 |
|
291 |
+
/**
|
292 |
+
* Prevents edit and delete links for the translations of the privacy policy page for non admin
|
293 |
+
*
|
294 |
+
* @since 2.3.7
|
295 |
+
*
|
296 |
+
* @param array $caps The user's actual capabilities.
|
297 |
+
* @param string $cap Capability name.
|
298 |
+
* @param int $user_id The user ID.
|
299 |
+
* @param array $args Adds the context to the cap. The category id.
|
300 |
+
* @return array
|
301 |
+
*/
|
302 |
+
public function fix_privacy_policy_page_editing( $caps, $cap, $user_id, $args ) {
|
303 |
+
if ( in_array( $cap, array( 'edit_page', 'edit_post', 'delete_page', 'delete_post' ) ) ) {
|
304 |
+
$privacy_page = get_option( 'wp_page_for_privacy_policy' );
|
305 |
+
if ( $privacy_page && array_intersect( $args, $this->model->post->get_translations( $privacy_page ) ) ) {
|
306 |
+
$caps = array_merge( $caps, map_meta_cap( 'manage_privacy_options', $user_id ) );
|
307 |
+
}
|
308 |
+
}
|
309 |
+
|
310 |
+
return $caps;
|
311 |
+
}
|
312 |
+
|
313 |
/**
|
314 |
* Register our personal data exporter
|
315 |
*
|
modules/plugins/cache-compat.php
CHANGED
@@ -16,7 +16,11 @@ class PLL_Cache_Compat {
|
|
16 |
if ( PLL_COOKIE ) {
|
17 |
add_action( 'wp_print_footer_scripts', array( $this, 'add_cookie_script' ) );
|
18 |
}
|
19 |
-
|
|
|
|
|
|
|
|
|
20 |
}
|
21 |
|
22 |
/**
|
16 |
if ( PLL_COOKIE ) {
|
17 |
add_action( 'wp_print_footer_scripts', array( $this, 'add_cookie_script' ) );
|
18 |
}
|
19 |
+
|
20 |
+
// Since version 3.0.5, WP Rocket does not serve the cached page if our cookie is not set
|
21 |
+
if ( ! defined( 'WP_ROCKET_VERSION' ) || version_compare( WP_ROCKET_VERSION, '3.0.5', '<' ) ) {
|
22 |
+
add_action( 'wp', array( $this, 'do_not_cache_site_home' ) );
|
23 |
+
}
|
24 |
}
|
25 |
|
26 |
/**
|
polylang.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/**
|
4 |
Plugin Name: Polylang
|
5 |
Plugin URI: https://polylang.pro
|
6 |
-
Version: 2.3.
|
7 |
Author: Frédéric Demarle
|
8 |
Author uri: https://polylang.pro
|
9 |
Description: Adds multilingual capability to WordPress
|
@@ -53,7 +53,7 @@ if ( defined( 'POLYLANG_BASENAME' ) ) {
|
|
53 |
}
|
54 |
} else {
|
55 |
// Go on loading the plugin
|
56 |
-
define( 'POLYLANG_VERSION', '2.3.
|
57 |
define( 'PLL_MIN_WP_VERSION', '4.4' );
|
58 |
|
59 |
define( 'POLYLANG_FILE', __FILE__ ); // this file
|
3 |
/**
|
4 |
Plugin Name: Polylang
|
5 |
Plugin URI: https://polylang.pro
|
6 |
+
Version: 2.3.7
|
7 |
Author: Frédéric Demarle
|
8 |
Author uri: https://polylang.pro
|
9 |
Description: Adds multilingual capability to WordPress
|
53 |
}
|
54 |
} else {
|
55 |
// Go on loading the plugin
|
56 |
+
define( 'POLYLANG_VERSION', '2.3.7' );
|
57 |
define( 'PLL_MIN_WP_VERSION', '4.4' );
|
58 |
|
59 |
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.4
|
6 |
Tested up to: 4.9
|
7 |
-
Stable tag: 2.3.
|
8 |
License: GPLv2 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.3.6 (2018-05-17) =
|
80 |
|
81 |
* Pro: Fix post type archive slug not translated in ACF page link fields
|
4 |
Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
|
5 |
Requires at least: 4.4
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 2.3.7
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Making WordPress multilingual
|
76 |
|
77 |
== Changelog ==
|
78 |
|
79 |
+
= 2.3.7 (2018-06-07) =
|
80 |
+
|
81 |
+
* Pro: The Events Calendar: Fix untranslated events shown in all languages
|
82 |
+
* Avoid displaying edit links of translations of the privacy policy page to non-admin
|
83 |
+
* Fix draft created when creating a new page on multisite
|
84 |
+
* Do not prevent using the cache for home when using WP Rocket 3.0.5 or later #236
|
85 |
+
* Fix language filter applied to wrong queries on admin side
|
86 |
+
|
87 |
= 2.3.6 (2018-05-17) =
|
88 |
|
89 |
* Pro: Fix post type archive slug not translated in ACF page link fields
|