Version Description
(2020-11-03) =
- Pro: Remove useless bulk translate action for ACF fields groups
- Pro: Fix the translation of the CPTUI labels when the language is set from the content
- Fix sitemaps redirected to the default language since WP 5.5.1
- Fix object cache not flushed for sticky posts #601
- Fix blog page broken when trashing a page and the blog page is not translated in all languages
- Fix custom flags ignored in WPML compatibility mode
- Fix breadcrumb for untranslated post types in Yoast SEO
Download this release
Release Info
Developer | Chouby |
Plugin | Polylang |
Version | 2.8.4 |
Comparing to | |
See all releases |
Code changes from version 2.8.3 to 2.8.4
- frontend/frontend-static-pages.php +1 -1
- include/filters.php +14 -0
- include/static-pages.php +1 -1
- integrations/wpseo/wpseo.php +9 -5
- modules/sitemaps/multilingual-sitemaps-provider.php +9 -4
- modules/sitemaps/sitemaps.php +16 -0
- modules/wpml/wpml-legacy-api.php +1 -1
- polylang.php +2 -2
- readme.txt +11 -1
- vendor/composer/ClassLoader.php +1 -1
frontend/frontend-static-pages.php
CHANGED
@@ -75,7 +75,7 @@ class PLL_Frontend_Static_Pages extends PLL_Static_Pages {
|
|
75 |
*/
|
76 |
public function translate_page_on_front( $v ) {
|
77 |
// Don't attempt to translate in a 'switch_blog' action as there is a risk to call this function while initializing the languages cache
|
78 |
-
return isset( $this->curlang->page_on_front ) && ! doing_action( 'switch_blog' ) ? $this->curlang->page_on_front : $v;
|
79 |
}
|
80 |
|
81 |
/**
|
75 |
*/
|
76 |
public function translate_page_on_front( $v ) {
|
77 |
// Don't attempt to translate in a 'switch_blog' action as there is a risk to call this function while initializing the languages cache
|
78 |
+
return isset( $this->curlang->page_on_front ) && ( $this->curlang->page_on_front ) && ! doing_action( 'switch_blog' ) ? $this->curlang->page_on_front : $v;
|
79 |
}
|
80 |
|
81 |
/**
|
include/filters.php
CHANGED
@@ -24,6 +24,11 @@ class PLL_Filters {
|
|
24 |
$this->options = &$polylang->options;
|
25 |
$this->curlang = &$polylang->curlang;
|
26 |
|
|
|
|
|
|
|
|
|
|
|
27 |
// Filters the comments according to the current language
|
28 |
add_action( 'parse_comment_query', array( $this, 'parse_comment_query' ) );
|
29 |
add_filter( 'comments_clauses', array( $this, 'comments_clauses' ), 10, 2 );
|
@@ -55,6 +60,15 @@ class PLL_Filters {
|
|
55 |
add_filter( 'wp_privacy_personal_data_exporters', array( $this, 'register_personal_data_exporter' ), 0 ); // Since WP 4.9.6
|
56 |
}
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
/**
|
59 |
* Get the language to filter a comments query
|
60 |
*
|
24 |
$this->options = &$polylang->options;
|
25 |
$this->curlang = &$polylang->curlang;
|
26 |
|
27 |
+
// Deletes our cache for sticky posts when the list is updated.
|
28 |
+
add_action( 'update_option_sticky_posts', array( $this, 'delete_sticky_posts_cache' ) );
|
29 |
+
add_action( 'add_option_sticky_posts', array( $this, 'delete_sticky_posts_cache' ) );
|
30 |
+
add_action( 'delete_option_sticky_posts', array( $this, 'delete_sticky_posts_cache' ) );
|
31 |
+
|
32 |
// Filters the comments according to the current language
|
33 |
add_action( 'parse_comment_query', array( $this, 'parse_comment_query' ) );
|
34 |
add_filter( 'comments_clauses', array( $this, 'comments_clauses' ), 10, 2 );
|
60 |
add_filter( 'wp_privacy_personal_data_exporters', array( $this, 'register_personal_data_exporter' ), 0 ); // Since WP 4.9.6
|
61 |
}
|
62 |
|
63 |
+
/**
|
64 |
+
* Deletes the cache for multilingual sticky posts.
|
65 |
+
*
|
66 |
+
* @since 2.8.4
|
67 |
+
*/
|
68 |
+
public function delete_sticky_posts_cache() {
|
69 |
+
wp_cache_delete( 'sticky_posts', 'options' );
|
70 |
+
}
|
71 |
+
|
72 |
/**
|
73 |
* Get the language to filter a comments query
|
74 |
*
|
include/static-pages.php
CHANGED
@@ -103,7 +103,7 @@ class PLL_Static_Pages {
|
|
103 |
*/
|
104 |
public function translate_page_for_posts( $v ) {
|
105 |
// Don't attempt to translate in a 'switch_blog' action as there is a risk to call this function while initializing the languages cache
|
106 |
-
return isset( $this->curlang->page_for_posts ) && ! doing_action( 'switch_blog' ) ? $this->curlang->page_for_posts : $v;
|
107 |
}
|
108 |
|
109 |
/**
|
103 |
*/
|
104 |
public function translate_page_for_posts( $v ) {
|
105 |
// Don't attempt to translate in a 'switch_blog' action as there is a risk to call this function while initializing the languages cache
|
106 |
+
return isset( $this->curlang->page_for_posts ) && ( $this->curlang->page_for_posts ) && ! doing_action( 'switch_blog' ) ? $this->curlang->page_for_posts : $v;
|
107 |
}
|
108 |
|
109 |
/**
|
integrations/wpseo/wpseo.php
CHANGED
@@ -411,9 +411,11 @@ class PLL_WPSEO {
|
|
411 |
break;
|
412 |
|
413 |
case 'post-type-archive':
|
414 |
-
|
415 |
-
|
416 |
-
|
|
|
|
|
417 |
break;
|
418 |
|
419 |
case 'user':
|
@@ -447,8 +449,10 @@ class PLL_WPSEO {
|
|
447 |
break;
|
448 |
|
449 |
case 'post-type-archive':
|
450 |
-
|
451 |
-
|
|
|
|
|
452 |
break;
|
453 |
}
|
454 |
}
|
411 |
break;
|
412 |
|
413 |
case 'post-type-archive':
|
414 |
+
if ( pll_is_translated_post_type( $presentation->model->object_sub_type ) ) {
|
415 |
+
$presentation->model->permalink = get_post_type_archive_link( $presentation->model->object_sub_type );
|
416 |
+
$presentation->model->title = WPSEO_Options::get( 'title-ptarchive-' . $presentation->model->object_sub_type );
|
417 |
+
$presentation->model->description = WPSEO_Options::get( 'metadesc-ptarchive-' . $presentation->model->object_sub_type );
|
418 |
+
}
|
419 |
break;
|
420 |
|
421 |
case 'user':
|
449 |
break;
|
450 |
|
451 |
case 'post-type-archive':
|
452 |
+
if ( pll_is_translated_post_type( $indexable->object_sub_type ) ) {
|
453 |
+
$indexable->permalink = get_post_type_archive_link( $indexable->object_sub_type );
|
454 |
+
$indexable->breadcrumb_title = pll__( WPSEO_Options::get( 'bctitle-ptarchive-' . $indexable->object_sub_type ) );
|
455 |
+
}
|
456 |
break;
|
457 |
}
|
458 |
}
|
modules/sitemaps/multilingual-sitemaps-provider.php
CHANGED
@@ -183,18 +183,23 @@ class PLL_Multilingual_Sitemaps_Provider extends WP_Sitemaps_Provider {
|
|
183 |
* @return string The composed URL for a sitemap entry.
|
184 |
*/
|
185 |
public function get_sitemap_url( $name, $page ) {
|
|
|
186 |
$pattern = '#(' . implode( '|', $this->model->get_languages_list( array( 'fields' => 'slug' ) ) ) . ')$#';
|
187 |
if ( preg_match( $pattern, $name, $matches ) ) {
|
188 |
$lang = $this->model->get_language( $matches[1] );
|
189 |
$name = preg_replace( '#(-?' . $lang->slug . ')$#', '', $name );
|
190 |
$url = $this->provider->get_sitemap_url( $name, $page );
|
191 |
-
|
192 |
-
}
|
193 |
-
|
|
|
|
|
|
|
194 |
$url = $this->provider->get_sitemap_url( $name, $page );
|
|
|
195 |
}
|
196 |
|
197 |
-
return $
|
198 |
}
|
199 |
|
200 |
/**
|
183 |
* @return string The composed URL for a sitemap entry.
|
184 |
*/
|
185 |
public function get_sitemap_url( $name, $page ) {
|
186 |
+
// Check if a language was added in $name.
|
187 |
$pattern = '#(' . implode( '|', $this->model->get_languages_list( array( 'fields' => 'slug' ) ) ) . ')$#';
|
188 |
if ( preg_match( $pattern, $name, $matches ) ) {
|
189 |
$lang = $this->model->get_language( $matches[1] );
|
190 |
$name = preg_replace( '#(-?' . $lang->slug . ')$#', '', $name );
|
191 |
$url = $this->provider->get_sitemap_url( $name, $page );
|
192 |
+
return $this->links_model->add_language_to_link( $url, $lang );
|
193 |
+
}
|
194 |
+
|
195 |
+
// If no language is present in $name, we may attempt to get the current sitemap url (e.g. in redirect_canonical() ).
|
196 |
+
if ( get_query_var( 'lang' ) ) {
|
197 |
+
$lang = $this->model->get_language( get_query_var( 'lang' ) );
|
198 |
$url = $this->provider->get_sitemap_url( $name, $page );
|
199 |
+
return $this->links_model->add_language_to_link( $url, $lang );
|
200 |
}
|
201 |
|
202 |
+
return $this->provider->get_sitemap_url( $name, $page );
|
203 |
}
|
204 |
|
205 |
/**
|
modules/sitemaps/sitemaps.php
CHANGED
@@ -73,6 +73,7 @@ class PLL_Sitemaps {
|
|
73 |
add_filter( 'wp_sitemaps_index_entry', array( $this, 'index_entry' ) );
|
74 |
add_filter( 'wp_sitemaps_stylesheet_url', array( $this->links_model, 'site_url' ) );
|
75 |
add_filter( 'wp_sitemaps_stylesheet_index_url', array( $this->links_model, 'site_url' ) );
|
|
|
76 |
}
|
77 |
}
|
78 |
|
@@ -169,4 +170,19 @@ class PLL_Sitemaps {
|
|
169 |
$sitemap_entry['loc'] = $this->links_model->site_url( $sitemap_entry['loc'] );
|
170 |
return $sitemap_entry;
|
171 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
}
|
73 |
add_filter( 'wp_sitemaps_index_entry', array( $this, 'index_entry' ) );
|
74 |
add_filter( 'wp_sitemaps_stylesheet_url', array( $this->links_model, 'site_url' ) );
|
75 |
add_filter( 'wp_sitemaps_stylesheet_index_url', array( $this->links_model, 'site_url' ) );
|
76 |
+
add_filter( 'home_url', array( $this, 'sitemap_url' ) );
|
77 |
}
|
78 |
}
|
79 |
|
170 |
$sitemap_entry['loc'] = $this->links_model->site_url( $sitemap_entry['loc'] );
|
171 |
return $sitemap_entry;
|
172 |
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Makes sure that the sitemap urls are always evaluated on the current domain.
|
176 |
+
*
|
177 |
+
* @since 2.8.4
|
178 |
+
*
|
179 |
+
* @param string $url A sitemap url.
|
180 |
+
* @return string
|
181 |
+
*/
|
182 |
+
public function sitemap_url( $url ) {
|
183 |
+
if ( false !== strpos( $url, '/wp-sitemap' ) ) {
|
184 |
+
$url = $this->links_model->site_url( $url );
|
185 |
+
}
|
186 |
+
return $url;
|
187 |
+
}
|
188 |
}
|
modules/wpml/wpml-legacy-api.php
CHANGED
@@ -83,7 +83,7 @@ if ( ! function_exists( 'icl_get_languages' ) ) {
|
|
83 |
'missing' => empty( $url ) ? 1 : 0,
|
84 |
'translated_name' => '', // Does not exist in Polylang
|
85 |
'language_code' => $lang->slug,
|
86 |
-
'country_flag_url' => $lang->
|
87 |
'url' => ! empty( $url ) ? $url :
|
88 |
( empty( $args['link_empty_to'] ) ? PLL()->links->get_home_url( $lang ) :
|
89 |
str_replace( '{$lang}', $lang->slug, $args['link_empty_to'] ) ),
|
83 |
'missing' => empty( $url ) ? 1 : 0,
|
84 |
'translated_name' => '', // Does not exist in Polylang
|
85 |
'language_code' => $lang->slug,
|
86 |
+
'country_flag_url' => $lang->get_display_flag_url(),
|
87 |
'url' => ! empty( $url ) ? $url :
|
88 |
( empty( $args['link_empty_to'] ) ? PLL()->links->get_home_url( $lang ) :
|
89 |
str_replace( '{$lang}', $lang->slug, $args['link_empty_to'] ) ),
|
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.4
|
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.4' );
|
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,16 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
|
|
78 |
|
79 |
== Changelog ==
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
= 2.8.3 (2020-10-13) =
|
82 |
|
83 |
* Honor install_languages capability to download language packs
|
5 |
Requires at least: 4.9
|
6 |
Tested up to: 5.5
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 2.8.4
|
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.4 (2020-11-03) =
|
82 |
+
|
83 |
+
* Pro: Remove useless bulk translate action for ACF fields groups
|
84 |
+
* Pro: Fix the translation of the CPTUI labels when the language is set from the content
|
85 |
+
* Fix sitemaps redirected to the default language since WP 5.5.1
|
86 |
+
* Fix object cache not flushed for sticky posts #601
|
87 |
+
* Fix blog page broken when trashing a page and the blog page is not translated in all languages
|
88 |
+
* Fix custom flags ignored in WPML compatibility mode
|
89 |
+
* Fix breadcrumb for untranslated post types in Yoast SEO
|
90 |
+
|
91 |
= 2.8.3 (2020-10-13) =
|
92 |
|
93 |
* Honor install_languages capability to download language packs
|
vendor/composer/ClassLoader.php
CHANGED
@@ -60,7 +60,7 @@ class ClassLoader
|
|
60 |
public function getPrefixes()
|
61 |
{
|
62 |
if (!empty($this->prefixesPsr0)) {
|
63 |
-
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
64 |
}
|
65 |
|
66 |
return array();
|
60 |
public function getPrefixes()
|
61 |
{
|
62 |
if (!empty($this->prefixesPsr0)) {
|
63 |
+
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
64 |
}
|
65 |
|
66 |
return array();
|