Version Description
(2019-11-14) =
- Require PHP 5.6
- Fix PHP warning in WP 5.3
Download this release
Release Info
Developer | Chouby |
Plugin | Polylang |
Version | 2.6.7 |
Comparing to | |
See all releases |
Code changes from version 2.6.6 to 2.6.7
- admin/admin-classic-editor.php +1 -0
- admin/admin-filters-columns.php +1 -1
- admin/admin-filters-media.php +1 -0
- admin/admin-filters-term.php +2 -0
- admin/admin-filters.php +1 -0
- include/class-polylang.php +1 -1
- include/switcher.php +1 -1
- include/walker-dropdown.php +24 -5
- include/walker-list.php +23 -5
- install/install.php +53 -20
- polylang.php +3 -2
- readme.txt +8 -2
admin/admin-classic-editor.php
CHANGED
@@ -81,6 +81,7 @@ class PLL_Admin_Classic_Editor {
|
|
81 |
|
82 |
$dropdown_html = $dropdown->walk(
|
83 |
$this->model->get_languages_list(),
|
|
|
84 |
array(
|
85 |
'name' => $id,
|
86 |
'class' => 'post_lang_choice tags-input',
|
81 |
|
82 |
$dropdown_html = $dropdown->walk(
|
83 |
$this->model->get_languages_list(),
|
84 |
+
-1,
|
85 |
array(
|
86 |
'name' => $id,
|
87 |
'class' => 'post_lang_choice tags-input',
|
admin/admin-filters-columns.php
CHANGED
@@ -188,7 +188,7 @@ class PLL_Admin_Filters_Columns {
|
|
188 |
</div>
|
189 |
</fieldset>',
|
190 |
esc_html__( 'Language', 'polylang' ),
|
191 |
-
$dropdown->walk( $elements, array( 'name' => 'inline_lang_choice', 'id' => '' ) ) // phpcs:ignore WordPress.Security.EscapeOutput
|
192 |
);
|
193 |
}
|
194 |
return $column;
|
188 |
</div>
|
189 |
</fieldset>',
|
190 |
esc_html__( 'Language', 'polylang' ),
|
191 |
+
$dropdown->walk( $elements, -1, array( 'name' => 'inline_lang_choice', 'id' => '' ) ) // phpcs:ignore WordPress.Security.EscapeOutput
|
192 |
);
|
193 |
}
|
194 |
return $column;
|
admin/admin-filters-media.php
CHANGED
@@ -57,6 +57,7 @@ class PLL_Admin_Filters_Media extends PLL_Admin_Filters_Post_Base {
|
|
57 |
'input' => 'html',
|
58 |
'html' => $dropdown->walk(
|
59 |
$this->model->get_languages_list(),
|
|
|
60 |
array(
|
61 |
'name' => sprintf( 'attachments[%d][language]', $post_id ),
|
62 |
'class' => 'media_lang_choice',
|
57 |
'input' => 'html',
|
58 |
'html' => $dropdown->walk(
|
59 |
$this->model->get_languages_list(),
|
60 |
+
-1,
|
61 |
array(
|
62 |
'name' => sprintf( 'attachments[%d][language]', $post_id ),
|
63 |
'class' => 'media_lang_choice',
|
admin/admin-filters-term.php
CHANGED
@@ -79,6 +79,7 @@ class PLL_Admin_Filters_Term {
|
|
79 |
|
80 |
$dropdown_html = $dropdown->walk(
|
81 |
$this->model->get_languages_list(),
|
|
|
82 |
array(
|
83 |
'name' => 'term_lang_choice',
|
84 |
'value' => 'term_id',
|
@@ -145,6 +146,7 @@ class PLL_Admin_Filters_Term {
|
|
145 |
|
146 |
$dropdown_html = $dropdown->walk(
|
147 |
$this->model->get_languages_list(),
|
|
|
148 |
array(
|
149 |
'name' => 'term_lang_choice',
|
150 |
'value' => 'term_id',
|
79 |
|
80 |
$dropdown_html = $dropdown->walk(
|
81 |
$this->model->get_languages_list(),
|
82 |
+
-1,
|
83 |
array(
|
84 |
'name' => 'term_lang_choice',
|
85 |
'value' => 'term_id',
|
146 |
|
147 |
$dropdown_html = $dropdown->walk(
|
148 |
$this->model->get_languages_list(),
|
149 |
+
-1,
|
150 |
array(
|
151 |
'name' => 'term_lang_choice',
|
152 |
'value' => 'term_id',
|
admin/admin-filters.php
CHANGED
@@ -66,6 +66,7 @@ class PLL_Admin_Filters extends PLL_Filters {
|
|
66 |
array( (object) array( 'slug' => 0, 'name' => __( 'All languages', 'polylang' ) ) ),
|
67 |
$this->model->get_languages_list()
|
68 |
),
|
|
|
69 |
array(
|
70 |
'name' => $widget->id . '_lang_choice',
|
71 |
'class' => 'tags-input pll-lang-choice',
|
66 |
array( (object) array( 'slug' => 0, 'name' => __( 'All languages', 'polylang' ) ) ),
|
67 |
$this->model->get_languages_list()
|
68 |
),
|
69 |
+
-1,
|
70 |
array(
|
71 |
'name' => $widget->id . '_lang_choice',
|
72 |
'class' => 'tags-input pll-lang-choice',
|
include/class-polylang.php
CHANGED
@@ -33,7 +33,7 @@ class Polylang {
|
|
33 |
$install = new PLL_Install( POLYLANG_BASENAME );
|
34 |
|
35 |
// Stopping here if we are going to deactivate the plugin ( avoids breaking rewrite rules )
|
36 |
-
if ( $install->is_deactivation() ) {
|
37 |
return;
|
38 |
}
|
39 |
|
33 |
$install = new PLL_Install( POLYLANG_BASENAME );
|
34 |
|
35 |
// Stopping here if we are going to deactivate the plugin ( avoids breaking rewrite rules )
|
36 |
+
if ( $install->is_deactivation() || ! $install->can_activate() ) {
|
37 |
return;
|
38 |
}
|
39 |
|
include/switcher.php
CHANGED
@@ -184,7 +184,7 @@ class PLL_Switcher {
|
|
184 |
* @param string $html html returned/outputted by the template tag
|
185 |
* @param array $args arguments passed to the template tag
|
186 |
*/
|
187 |
-
$out = apply_filters( 'pll_the_languages', $walker->walk( $elements, $args ), $args );
|
188 |
|
189 |
// Javascript to switch the language when using a dropdown list
|
190 |
if ( $args['dropdown'] ) {
|
184 |
* @param string $html html returned/outputted by the template tag
|
185 |
* @param array $args arguments passed to the template tag
|
186 |
*/
|
187 |
+
$out = apply_filters( 'pll_the_languages', $walker->walk( $elements, -1, $args ), $args );
|
188 |
|
189 |
// Javascript to switch the language when using a dropdown list
|
190 |
if ( $args['dropdown'] ) {
|
include/walker-dropdown.php
CHANGED
@@ -52,6 +52,7 @@ class PLL_Walker_Dropdown extends Walker {
|
|
52 |
* Starts the output of the dropdown list
|
53 |
*
|
54 |
* @since 1.2
|
|
|
55 |
*
|
56 |
* List of parameters accepted in $args:
|
57 |
*
|
@@ -63,12 +64,30 @@ class PLL_Walker_Dropdown extends Walker {
|
|
63 |
* class => the class attribute
|
64 |
* disabled => disables the dropdown if set to 1
|
65 |
*
|
66 |
-
* @param array $elements
|
67 |
-
* @param
|
68 |
-
* @
|
|
|
69 |
*/
|
70 |
-
public function walk( $elements, $args
|
71 |
$output = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
$args = wp_parse_args( $args, array( 'value' => 'slug', 'name' => 'lang_choice' ) );
|
73 |
|
74 |
if ( ! empty( $args['flag'] ) ) {
|
@@ -86,7 +105,7 @@ class PLL_Walker_Dropdown extends Walker {
|
|
86 |
isset( $args['id'] ) && ! $args['id'] ? '' : ' id="' . ( empty( $args['id'] ) ? $name : esc_attr( $args['id'] ) ) . '"',
|
87 |
empty( $args['class'] ) ? '' : ' class="' . esc_attr( $args['class'] ) . '"',
|
88 |
disabled( empty( $args['disabled'] ), false, false ),
|
89 |
-
parent::walk( $elements,
|
90 |
);
|
91 |
|
92 |
return $output;
|
52 |
* Starts the output of the dropdown list
|
53 |
*
|
54 |
* @since 1.2
|
55 |
+
* @since 2.6.7 Use $max_depth and ...$args parameters to follow the move of WP 5.3
|
56 |
*
|
57 |
* List of parameters accepted in $args:
|
58 |
*
|
64 |
* class => the class attribute
|
65 |
* disabled => disables the dropdown if set to 1
|
66 |
*
|
67 |
+
* @param array $elements An array of elements.
|
68 |
+
* @param int $max_depth The maximum hierarchical depth.
|
69 |
+
* @param mixed ...$args Additional arguments.
|
70 |
+
* @return string The hierarchical item output.
|
71 |
*/
|
72 |
+
public function walk( $elements, $max_depth, ...$args ) { // // phpcs:ignore WordPressVIPMinimum.Classes.DeclarationCompatibility.DeclarationCompatibility
|
73 |
$output = '';
|
74 |
+
|
75 |
+
if ( is_array( $max_depth ) ) {
|
76 |
+
// Backward compatibility with Polylang < 2.6.7
|
77 |
+
if ( WP_DEBUG ) {
|
78 |
+
trigger_error( // phpcs:ignore WordPress.PHP.DevelopmentFunctions
|
79 |
+
sprintf(
|
80 |
+
'%s was called incorrectly. The method expects an integer as second parameter since Polylang 2.6.7',
|
81 |
+
__METHOD__
|
82 |
+
)
|
83 |
+
);
|
84 |
+
}
|
85 |
+
$args = $max_depth;
|
86 |
+
$max_depth = -1;
|
87 |
+
} else {
|
88 |
+
$args = isset( $args[0] ) ? $args[0] : array();
|
89 |
+
}
|
90 |
+
|
91 |
$args = wp_parse_args( $args, array( 'value' => 'slug', 'name' => 'lang_choice' ) );
|
92 |
|
93 |
if ( ! empty( $args['flag'] ) ) {
|
105 |
isset( $args['id'] ) && ! $args['id'] ? '' : ' id="' . ( empty( $args['id'] ) ? $name : esc_attr( $args['id'] ) ) . '"',
|
106 |
empty( $args['class'] ) ? '' : ' class="' . esc_attr( $args['class'] ) . '"',
|
107 |
disabled( empty( $args['disabled'] ), false, false ),
|
108 |
+
parent::walk( $elements, $max_depth, $args )
|
109 |
);
|
110 |
|
111 |
return $output;
|
include/walker-list.php
CHANGED
@@ -54,12 +54,30 @@ class PLL_Walker_List extends Walker {
|
|
54 |
* Overrides Walker:walk to set depth argument
|
55 |
*
|
56 |
* @since 1.2
|
|
|
57 |
*
|
58 |
-
* @param array $elements
|
59 |
-
* @param
|
60 |
-
* @
|
|
|
61 |
*/
|
62 |
-
public function walk( $elements, $args
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
65 |
}
|
54 |
* Overrides Walker:walk to set depth argument
|
55 |
*
|
56 |
* @since 1.2
|
57 |
+
* @since 2.6.7 Use $max_depth and ...$args parameters to follow the move of WP 5.3
|
58 |
*
|
59 |
+
* @param array $elements An array of elements.
|
60 |
+
* @param int $max_depth The maximum hierarchical depth.
|
61 |
+
* @param mixed ...$args Additional arguments.
|
62 |
+
* @return string The hierarchical item output.
|
63 |
*/
|
64 |
+
public function walk( $elements, $max_depth, ...$args ) { // phpcs:ignore WordPressVIPMinimum.Classes.DeclarationCompatibility.DeclarationCompatibility
|
65 |
+
if ( is_array( $max_depth ) ) {
|
66 |
+
// Backward compatibility with Polylang < 2.6.7
|
67 |
+
if ( WP_DEBUG ) {
|
68 |
+
trigger_error( // phpcs:ignore WordPress.PHP.DevelopmentFunctions
|
69 |
+
sprintf(
|
70 |
+
'%s was called incorrectly. The method expects an integer as second parameter since Polylang 2.6.7',
|
71 |
+
__METHOD__
|
72 |
+
)
|
73 |
+
);
|
74 |
+
}
|
75 |
+
$args = $max_depth;
|
76 |
+
$max_depth = -1;
|
77 |
+
} else {
|
78 |
+
$args = isset( $args[0] ) ? $args[0] : array();
|
79 |
+
}
|
80 |
+
|
81 |
+
return parent::walk( $elements, $max_depth, $args );
|
82 |
}
|
83 |
}
|
install/install.php
CHANGED
@@ -8,33 +8,66 @@
|
|
8 |
class PLL_Install extends PLL_Install_Base {
|
9 |
|
10 |
/**
|
11 |
-
*
|
12 |
*
|
13 |
-
* @since
|
14 |
-
*
|
15 |
-
* @param bool $networkwide
|
16 |
*/
|
17 |
-
public function
|
18 |
global $wp_version;
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
23 |
|
24 |
if ( version_compare( $wp_version, PLL_MIN_WP_VERSION, '<' ) ) {
|
25 |
-
|
26 |
-
|
27 |
-
'<p style = "font-family: sans-serif; font-size: 12px; color: #333; margin: -5px">%s</p>',
|
28 |
-
sprintf(
|
29 |
-
/* translators: %1$s and %2$s are WordPress version numbers */
|
30 |
-
esc_html__( 'You are using WordPress %1$s. Polylang requires at least WordPress %2$s.', 'polylang' ),
|
31 |
-
esc_html( $wp_version ),
|
32 |
-
PLL_MIN_WP_VERSION // phpcs:ignore WordPress.Security.EscapeOutput
|
33 |
-
)
|
34 |
-
)
|
35 |
-
);
|
36 |
}
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
39 |
|
40 |
/**
|
8 |
class PLL_Install extends PLL_Install_Base {
|
9 |
|
10 |
/**
|
11 |
+
* Checks min PHP and WP version, displays a notice if a requirement is not met.
|
12 |
*
|
13 |
+
* @since 2.6.7
|
|
|
|
|
14 |
*/
|
15 |
+
public function can_activate() {
|
16 |
global $wp_version;
|
17 |
|
18 |
+
if ( version_compare( PHP_VERSION, PLL_MIN_PHP_VERSION, '<' ) ) {
|
19 |
+
add_action( 'admin_notices', array( $this, 'php_version_notice' ) );
|
20 |
+
return false;
|
21 |
+
}
|
22 |
|
23 |
if ( version_compare( $wp_version, PLL_MIN_WP_VERSION, '<' ) ) {
|
24 |
+
add_action( 'admin_notices', array( $this, 'wp_version_notice' ) );
|
25 |
+
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
+
|
28 |
+
return true;
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Displays a notice if PHP min version is not met.
|
33 |
+
*
|
34 |
+
* @since 2.6.7
|
35 |
+
*/
|
36 |
+
public function php_version_notice() {
|
37 |
+
load_plugin_textdomain( 'polylang', false, basename( POLYLANG_DIR ) . '/languages' ); // Plugin i18n.
|
38 |
+
|
39 |
+
printf(
|
40 |
+
'<div class="error"><p>%s</p></div>',
|
41 |
+
sprintf(
|
42 |
+
/* translators: 1: Plugin name 2: Current PHP version 3: Required PHP version */
|
43 |
+
esc_html__( '%1$s has deactivated itself because you are using an old PHP version. You are using using PHP %2$s. %1$s requires PHP %3$s.', 'polylang' ),
|
44 |
+
esc_html( POLYLANG ),
|
45 |
+
PHP_VERSION,
|
46 |
+
esc_html( PLL_MIN_PHP_VERSION )
|
47 |
+
)
|
48 |
+
);
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Displays a notice if WP min version is not met.
|
53 |
+
*
|
54 |
+
* @since 2.6.7
|
55 |
+
*/
|
56 |
+
public function wp_version_notice() {
|
57 |
+
global $wp_version;
|
58 |
+
|
59 |
+
load_plugin_textdomain( 'polylang', false, basename( POLYLANG_DIR ) . '/languages' ); // Plugin i18n.
|
60 |
+
|
61 |
+
printf(
|
62 |
+
'<div class="error"><p>%s</p></div>',
|
63 |
+
sprintf(
|
64 |
+
/* translators: 1: Plugin name 2: Current WordPress version 3: Required WordPress version */
|
65 |
+
esc_html__( '%1$s has deactivated itself because you are using an old WordPress version. You are using using WordPress %2$s. %1$s requires at least WordPress %3$s.', 'polylang' ),
|
66 |
+
esc_html( POLYLANG ),
|
67 |
+
esc_html( $wp_version ),
|
68 |
+
esc_html( PLL_MIN_WP_VERSION )
|
69 |
+
)
|
70 |
+
);
|
71 |
}
|
72 |
|
73 |
/**
|
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,8 +51,9 @@ 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
|
58 |
define( 'POLYLANG_BASENAME', plugin_basename( POLYLANG_FILE ) ); // plugin name as known by WP
|
3 |
/**
|
4 |
Plugin Name: Polylang
|
5 |
Plugin URI: https://polylang.pro
|
6 |
+
Version: 2.6.7
|
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.7' );
|
55 |
define( 'PLL_MIN_WP_VERSION', '4.7' );
|
56 |
+
define( 'PLL_MIN_PHP_VERSION', '5.6' );
|
57 |
|
58 |
define( 'POLYLANG_FILE', __FILE__ ); // this file
|
59 |
define( 'POLYLANG_BASENAME', plugin_basename( POLYLANG_FILE ) ); // plugin name as known by WP
|
readme.txt
CHANGED
@@ -4,7 +4,8 @@ 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.3
|
7 |
-
|
|
|
8 |
License: GPLv3 or later
|
9 |
|
10 |
Making WordPress multilingual
|
@@ -41,7 +42,7 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
|
|
41 |
|
42 |
== Installation ==
|
43 |
|
44 |
-
1. Make sure you are using WordPress 4.7 or later and that your server is running PHP 5.
|
45 |
1. If you tried other multilingual plugins, deactivate them before activating Polylang, otherwise, you may get unexpected results!
|
46 |
1. Install and activate the plugin as usual from the 'Plugins' menu in WordPress.
|
47 |
1. Go to the languages settings page and create the languages you need
|
@@ -76,6 +77,11 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
|
|
76 |
|
77 |
== Changelog ==
|
78 |
|
|
|
|
|
|
|
|
|
|
|
79 |
= 2.6.6 (2019-11-12) =
|
80 |
|
81 |
* Pro: Fix wrong ajax url when using one domain per language
|
4 |
Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
|
5 |
Requires at least: 4.7
|
6 |
Tested up to: 5.3
|
7 |
+
Requires PHP: 5.6
|
8 |
+
Stable tag: 2.6.7
|
9 |
License: GPLv3 or later
|
10 |
|
11 |
Making WordPress multilingual
|
42 |
|
43 |
== Installation ==
|
44 |
|
45 |
+
1. Make sure you are using WordPress 4.7 or later and that your server is running PHP 5.6 or later (same requirement as WordPress itself)
|
46 |
1. If you tried other multilingual plugins, deactivate them before activating Polylang, otherwise, you may get unexpected results!
|
47 |
1. Install and activate the plugin as usual from the 'Plugins' menu in WordPress.
|
48 |
1. Go to the languages settings page and create the languages you need
|
77 |
|
78 |
== Changelog ==
|
79 |
|
80 |
+
= 2.6.7 (2019-11-14) =
|
81 |
+
|
82 |
+
* Require PHP 5.6
|
83 |
+
* Fix PHP warning in WP 5.3
|
84 |
+
|
85 |
= 2.6.6 (2019-11-12) =
|
86 |
|
87 |
* Pro: Fix wrong ajax url when using one domain per language
|