Version Description
Polylang 1.2 introduced major internal changes. More than ever, make a database backup before upgrading from 1.1.6 or older! If you are using a version older than 0.8, please ugrade to 0.9.8 before ugrading to 1.5.5
=
Download this release
Release Info
Developer | Chouby |
Plugin | Polylang |
Version | 1.5.5 |
Comparing to | |
See all releases |
Code changes from version 1.5.4 to 1.5.5
- admin/admin-filters-columns.php +5 -4
- admin/admin-filters-post.php +2 -2
- admin/admin-filters-term.php +3 -3
- admin/admin-nav-menu.php +21 -24
- admin/table-string.php +1 -1
- frontend/choose-lang-url.php +6 -4
- frontend/choose-lang.php +8 -1
- include/wpml-compat.php +3 -4
- polylang.php +2 -2
- readme.txt +13 -4
admin/admin-filters-columns.php
CHANGED
@@ -104,7 +104,7 @@ class PLL_Admin_Filters_Columns {
|
|
104 |
* @param int $post_id
|
105 |
*/
|
106 |
public function post_column($column, $post_id) {
|
107 |
-
$inline = defined('DOING_AJAX') && $_REQUEST['action'] == 'inline-save';
|
108 |
$lang = $inline ? $this->model->get_language($_POST['inline_lang_choice']) : $this->model->get_post_language($post_id);
|
109 |
|
110 |
if (false === strpos($column, 'language_') || !$lang)
|
@@ -200,7 +200,7 @@ class PLL_Admin_Filters_Columns {
|
|
200 |
* @param int term_id
|
201 |
*/
|
202 |
public function term_column($empty, $column, $term_id) {
|
203 |
-
$inline = defined('DOING_AJAX') && $_REQUEST['action'] == 'inline-save-tax'
|
204 |
if (false === strpos($column, 'language_') || !($lang = $inline ? $this->model->get_language($_POST['inline_lang_choice']) : $this->model->get_term_language($term_id)))
|
205 |
return;
|
206 |
|
@@ -211,11 +211,12 @@ class PLL_Admin_Filters_Columns {
|
|
211 |
if ($column == $this->get_first_language_column())
|
212 |
printf('<div class="hidden" id="lang_%d">%s</div>', esc_attr($term_id), esc_html($lang->slug));
|
213 |
|
|
|
214 |
// link to edit term (or a translation)
|
215 |
-
if ($id
|
216 |
printf('<a class="%1$s" title="%2$s" href="%3$s"></a>',
|
217 |
$id == $term_id ? 'pll_icon_tick' : 'pll_icon_edit',
|
218 |
-
esc_attr(
|
219 |
esc_url(get_edit_term_link($id, $taxonomy, $post_type))
|
220 |
);
|
221 |
}
|
104 |
* @param int $post_id
|
105 |
*/
|
106 |
public function post_column($column, $post_id) {
|
107 |
+
$inline = defined('DOING_AJAX') && $_REQUEST['action'] == 'inline-save' && isset($_POST['inline_lang_choice']);
|
108 |
$lang = $inline ? $this->model->get_language($_POST['inline_lang_choice']) : $this->model->get_post_language($post_id);
|
109 |
|
110 |
if (false === strpos($column, 'language_') || !$lang)
|
200 |
* @param int term_id
|
201 |
*/
|
202 |
public function term_column($empty, $column, $term_id) {
|
203 |
+
$inline = defined('DOING_AJAX') && $_REQUEST['action'] == 'inline-save-tax' && isset($_POST['inline_lang_choice']);
|
204 |
if (false === strpos($column, 'language_') || !($lang = $inline ? $this->model->get_language($_POST['inline_lang_choice']) : $this->model->get_term_language($term_id)))
|
205 |
return;
|
206 |
|
211 |
if ($column == $this->get_first_language_column())
|
212 |
printf('<div class="hidden" id="lang_%d">%s</div>', esc_attr($term_id), esc_html($lang->slug));
|
213 |
|
214 |
+
$id = ($inline && $lang->slug != $_POST['old_lang']) ? ($language->slug == $lang->slug ? $term_id : 0) : $this->model->get_term($term_id, $language);
|
215 |
// link to edit term (or a translation)
|
216 |
+
if ($id && $term = get_term($id, $taxonomy)) {
|
217 |
printf('<a class="%1$s" title="%2$s" href="%3$s"></a>',
|
218 |
$id == $term_id ? 'pll_icon_tick' : 'pll_icon_edit',
|
219 |
+
esc_attr($term->name),
|
220 |
esc_url(get_edit_term_link($id, $taxonomy, $post_type))
|
221 |
);
|
222 |
}
|
admin/admin-filters-post.php
CHANGED
@@ -319,13 +319,13 @@ class PLL_Admin_Filters_Post extends PLL_Admin_Filters_Post_Base {
|
|
319 |
|
320 |
if (isset($_POST['post_tr_lang']))
|
321 |
$translations = $this->save_translations($post_id, $_POST['post_tr_lang']);
|
|
|
|
|
322 |
}
|
323 |
|
324 |
// attempts to set a default language even if no capability
|
325 |
else
|
326 |
$this->set_default_language($post_id);
|
327 |
-
|
328 |
-
do_action('pll_save_post', $post_id, $post, empty($translations) ? $this->model->get_translations('post', $post_id) : $translations);
|
329 |
}
|
330 |
|
331 |
/*
|
319 |
|
320 |
if (isset($_POST['post_tr_lang']))
|
321 |
$translations = $this->save_translations($post_id, $_POST['post_tr_lang']);
|
322 |
+
|
323 |
+
do_action('pll_save_post', $post_id, $post, empty($translations) ? $this->model->get_translations('post', $post_id) : $translations);
|
324 |
}
|
325 |
|
326 |
// attempts to set a default language even if no capability
|
327 |
else
|
328 |
$this->set_default_language($post_id);
|
|
|
|
|
329 |
}
|
330 |
|
331 |
/*
|
admin/admin-filters-term.php
CHANGED
@@ -271,13 +271,13 @@ class PLL_Admin_Filters_Term {
|
|
271 |
|
272 |
if (isset($_POST['term_tr_lang']))
|
273 |
$translations = $this->save_translations($term_id);
|
|
|
|
|
274 |
}
|
275 |
-
|
276 |
// attempts to set a default language even if no capability
|
277 |
else
|
278 |
$this->set_default_language($term_id, $taxonomy);
|
279 |
-
|
280 |
-
do_action('pll_save_term', $term_id, $taxonomy, empty($translations) ? $this->model->get_translations('term', $term_id) : $translations);
|
281 |
}
|
282 |
|
283 |
/*
|
271 |
|
272 |
if (isset($_POST['term_tr_lang']))
|
273 |
$translations = $this->save_translations($term_id);
|
274 |
+
|
275 |
+
do_action('pll_save_term', $term_id, $taxonomy, empty($translations) ? $this->model->get_translations('term', $term_id) : $translations);
|
276 |
}
|
277 |
+
|
278 |
// attempts to set a default language even if no capability
|
279 |
else
|
280 |
$this->set_default_language($term_id, $taxonomy);
|
|
|
|
|
281 |
}
|
282 |
|
283 |
/*
|
admin/admin-nav-menu.php
CHANGED
@@ -155,23 +155,21 @@ class PLL_Admin_Nav_Menu {
|
|
155 |
|
156 |
// security check
|
157 |
// as 'wp_update_nav_menu_item' can be called from outside WP admin
|
158 |
-
if (
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
update_post_meta($menu_item_db_id, '_pll_menu_item', $options); // allow us to easily identify our nav menu item
|
173 |
}
|
174 |
-
|
175 |
}
|
176 |
|
177 |
/*
|
@@ -198,19 +196,18 @@ class PLL_Admin_Nav_Menu {
|
|
198 |
* @return unmodified $mods
|
199 |
*/
|
200 |
public function update_nav_menu_locations($mods) {
|
201 |
-
if (isset($mods['nav_menu_locations'])) {
|
202 |
-
|
203 |
-
// security check
|
204 |
-
if ( ! current_user_can('edit_theme_options') )
|
205 |
-
wp_die( __( 'Cheatin’ uh?' ) );
|
206 |
|
|
|
207 |
if (isset($_REQUEST['action']) && 'locations' == $_REQUEST['action']) {
|
208 |
-
check_admin_referer(
|
209 |
$this->options['nav_menus'][$this->theme] = array();
|
210 |
}
|
211 |
|
212 |
-
|
213 |
-
|
|
|
|
|
214 |
$this->options['nav_menus'][$this->theme] = array();
|
215 |
}
|
216 |
|
155 |
|
156 |
// security check
|
157 |
// as 'wp_update_nav_menu_item' can be called from outside WP admin
|
158 |
+
if (current_user_can('edit_theme_options')) {
|
159 |
+
check_admin_referer( 'update-nav_menu', 'update-nav-menu-nonce' );
|
160 |
+
|
161 |
+
$options = array('hide_current' => 0,'force_home' => 0 ,'show_flags' => 0 ,'show_names' => 1); // default values
|
162 |
+
// our jQuery form has not been displayed
|
163 |
+
if (empty($_POST['menu-item-pll-detect'][$menu_item_db_id])) {
|
164 |
+
if (!get_post_meta($menu_item_db_id, '_pll_menu_item', true)) // our options were never saved
|
165 |
+
update_post_meta($menu_item_db_id, '_pll_menu_item', $options);
|
166 |
+
}
|
167 |
+
else {
|
168 |
+
foreach ($options as $opt => $v)
|
169 |
+
$options[$opt] = empty($_POST['menu-item-'.$opt][$menu_item_db_id]) ? 0 : 1;
|
170 |
+
update_post_meta($menu_item_db_id, '_pll_menu_item', $options); // allow us to easily identify our nav menu item
|
171 |
+
}
|
|
|
172 |
}
|
|
|
173 |
}
|
174 |
|
175 |
/*
|
196 |
* @return unmodified $mods
|
197 |
*/
|
198 |
public function update_nav_menu_locations($mods) {
|
199 |
+
if (current_user_can('edit_theme_options') && isset($mods['nav_menu_locations'])) {
|
|
|
|
|
|
|
|
|
200 |
|
201 |
+
// Manage Locations tab in Appearance -> Menus
|
202 |
if (isset($_REQUEST['action']) && 'locations' == $_REQUEST['action']) {
|
203 |
+
check_admin_referer('save-menu-locations');
|
204 |
$this->options['nav_menus'][$this->theme] = array();
|
205 |
}
|
206 |
|
207 |
+
// Edit Menus tab in Appearance -> Menus
|
208 |
+
// add the test of $_REQUEST['update-nav-menu-nonce'] to avoid conflict with Vantage theme
|
209 |
+
elseif (isset($_REQUEST['action'], $_REQUEST['update-nav-menu-nonce']) && 'update' == $_REQUEST['action']) {
|
210 |
+
check_admin_referer('update-nav_menu', 'update-nav-menu-nonce');
|
211 |
$this->options['nav_menus'][$this->theme] = array();
|
212 |
}
|
213 |
|
admin/table-string.php
CHANGED
@@ -189,7 +189,7 @@ class PLL_Table_String extends WP_List_Table {
|
|
189 |
foreach ($this->groups as $group) {
|
190 |
printf(
|
191 |
'<option value="%s"%s>%s</option>' . "\n",
|
192 |
-
esc_attr($group),
|
193 |
$this->group_selected == $group ? ' selected="selected"' : '',
|
194 |
esc_html($group)
|
195 |
);
|
189 |
foreach ($this->groups as $group) {
|
190 |
printf(
|
191 |
'<option value="%s"%s>%s</option>' . "\n",
|
192 |
+
esc_attr(urlencode($group)),
|
193 |
$this->group_selected == $group ? ' selected="selected"' : '',
|
194 |
esc_html($group)
|
195 |
);
|
frontend/choose-lang-url.php
CHANGED
@@ -36,10 +36,8 @@ class PLL_Choose_Lang_Url extends PLL_Choose_lang {
|
|
36 |
// http://wordpress.org/support/topic/plugin-polylang-language-homepage-redirection-problem-and-solution-but-incomplete?replies=4#post-2729566
|
37 |
if (str_replace('www.', '', home_url('/')) == trailingslashit((is_ssl() ? 'https://' : 'http://').str_replace('www.', '', $_SERVER['HTTP_HOST']).str_replace(array($this->index, '?'.$_SERVER['QUERY_STRING']), array('', ''), $_SERVER['REQUEST_URI']))) {
|
38 |
// take care to post & page preview http://wordpress.org/support/topic/static-frontpage-url-parameter-url-language-information
|
39 |
-
if (isset($_GET['preview']) && ( (isset($_GET['p']) && $id = $_GET['p']) || (isset($_GET['page_id']) && $id = $_GET['page_id']) ))
|
40 |
-
$
|
41 |
-
return; // don't check the language code in url
|
42 |
-
}
|
43 |
|
44 |
// take care to (unattached) attachments
|
45 |
elseif (isset($_GET['attachment_id']) && $id = $_GET['attachment_id'])
|
@@ -73,6 +71,10 @@ class PLL_Choose_Lang_Url extends PLL_Choose_lang {
|
|
73 |
public function check_language_code_in_url() {
|
74 |
global $wp_query, $post;
|
75 |
|
|
|
|
|
|
|
|
|
76 |
if (is_single() || is_page()) {
|
77 |
if (isset($post->ID) && $this->model->is_translated_post_type($post->post_type))
|
78 |
$language = $this->model->get_post_language((int)$post->ID);
|
36 |
// http://wordpress.org/support/topic/plugin-polylang-language-homepage-redirection-problem-and-solution-but-incomplete?replies=4#post-2729566
|
37 |
if (str_replace('www.', '', home_url('/')) == trailingslashit((is_ssl() ? 'https://' : 'http://').str_replace('www.', '', $_SERVER['HTTP_HOST']).str_replace(array($this->index, '?'.$_SERVER['QUERY_STRING']), array('', ''), $_SERVER['REQUEST_URI']))) {
|
38 |
// take care to post & page preview http://wordpress.org/support/topic/static-frontpage-url-parameter-url-language-information
|
39 |
+
if (isset($_GET['preview']) && ( (isset($_GET['p']) && $id = $_GET['p']) || (isset($_GET['page_id']) && $id = $_GET['page_id']) ))
|
40 |
+
$curlang = ($lg = $this->model->get_post_language($id)) ? $lg : $this->model->get_language($this->options['default_lang']);
|
|
|
|
|
41 |
|
42 |
// take care to (unattached) attachments
|
43 |
elseif (isset($_GET['attachment_id']) && $id = $_GET['attachment_id'])
|
71 |
public function check_language_code_in_url() {
|
72 |
global $wp_query, $post;
|
73 |
|
74 |
+
// don't act for page and post previews as well as (unattached) attachments
|
75 |
+
if (isset($_GET['p']) || isset($_GET['page_id']) || isset($_GET['attachment_id']))
|
76 |
+
return;
|
77 |
+
|
78 |
if (is_single() || is_page()) {
|
79 |
if (isset($post->ID) && $this->model->is_translated_post_type($post->post_type))
|
80 |
$language = $this->model->get_post_language((int)$post->ID);
|
frontend/choose-lang.php
CHANGED
@@ -63,8 +63,15 @@ abstract class PLL_Choose_Lang {
|
|
63 |
*/
|
64 |
protected function maybe_setcookie() {
|
65 |
// check headers have not been sent to avoid ugly error
|
|
|
66 |
if (!headers_sent() && PLL_COOKIE !== false && (!isset($_COOKIE[PLL_COOKIE]) || $_COOKIE[PLL_COOKIE] != $this->curlang->slug))
|
67 |
-
setcookie(
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
}
|
69 |
|
70 |
/*
|
63 |
*/
|
64 |
protected function maybe_setcookie() {
|
65 |
// check headers have not been sent to avoid ugly error
|
66 |
+
// cookie domain must be set to false for localhost (default value for COOKIE_DOMAIN) thanks to Stephen Harris.
|
67 |
if (!headers_sent() && PLL_COOKIE !== false && (!isset($_COOKIE[PLL_COOKIE]) || $_COOKIE[PLL_COOKIE] != $this->curlang->slug))
|
68 |
+
setcookie(
|
69 |
+
PLL_COOKIE,
|
70 |
+
$this->curlang->slug,
|
71 |
+
time() + 31536000 /* 1 year */,
|
72 |
+
COOKIEPATH,
|
73 |
+
2 == $this->options['force_lang'] ? parse_url(get_option('home'), PHP_URL_HOST) : COOKIE_DOMAIN
|
74 |
+
);
|
75 |
}
|
76 |
|
77 |
/*
|
include/wpml-compat.php
CHANGED
@@ -7,7 +7,6 @@
|
|
7 |
* defines two WPML constants once the language has been defined
|
8 |
* the compatibility with WPML is not perfect on admin side as the constants are defined
|
9 |
* in 'setup_theme' by Polylang (based on user info) and 'plugins_loaded' by WPML (based on cookie)
|
10 |
-
* moreover I believe that WPML can set ICL_LANGUAGE_CODE to 'all' which I dont want to do with Polylang
|
11 |
*
|
12 |
* @since 0.9.5
|
13 |
*/
|
@@ -221,18 +220,18 @@ if (!function_exists('icl_t')) {
|
|
221 |
/*
|
222 |
* undocumented function used by NextGen Gallery
|
223 |
* seems to be used to both register and translate a string
|
224 |
-
*
|
225 |
*
|
226 |
* @since 1.0.2
|
227 |
*
|
228 |
* @param string $context the group in which the string is registered, defaults to 'polylang'
|
229 |
* @param string $name a unique name for the string
|
230 |
* @param string $string the string to register
|
231 |
-
* @param bool $bool not used by Polylang
|
232 |
* @return string the translated string in the current language
|
233 |
*/
|
234 |
if (!function_exists('icl_translate')) {
|
235 |
-
function icl_translate($context, $name, $string, $bool) {
|
236 |
$GLOBALS['pll_wpml_compat']->register_string($context, $name, $string);
|
237 |
return pll__($string);
|
238 |
}
|
7 |
* defines two WPML constants once the language has been defined
|
8 |
* the compatibility with WPML is not perfect on admin side as the constants are defined
|
9 |
* in 'setup_theme' by Polylang (based on user info) and 'plugins_loaded' by WPML (based on cookie)
|
|
|
10 |
*
|
11 |
* @since 0.9.5
|
12 |
*/
|
220 |
/*
|
221 |
* undocumented function used by NextGen Gallery
|
222 |
* seems to be used to both register and translate a string
|
223 |
+
* used in PLL_Plugins_Compat for Jetpack with only 3 arguments
|
224 |
*
|
225 |
* @since 1.0.2
|
226 |
*
|
227 |
* @param string $context the group in which the string is registered, defaults to 'polylang'
|
228 |
* @param string $name a unique name for the string
|
229 |
* @param string $string the string to register
|
230 |
+
* @param bool $bool optional, not used by Polylang
|
231 |
* @return string the translated string in the current language
|
232 |
*/
|
233 |
if (!function_exists('icl_translate')) {
|
234 |
+
function icl_translate($context, $name, $string, $bool = false) {
|
235 |
$GLOBALS['pll_wpml_compat']->register_string($context, $name, $string);
|
236 |
return pll__($string);
|
237 |
}
|
polylang.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Polylang
|
4 |
Plugin URI: http://polylang.wordpress.com/
|
5 |
-
Version: 1.5.
|
6 |
Author: Frédéric Demarle
|
7 |
Description: Adds multilingual capability to WordPress
|
8 |
Text Domain: polylang
|
@@ -33,7 +33,7 @@ Domain Path: /languages
|
|
33 |
if (!function_exists('add_action'))
|
34 |
exit();
|
35 |
|
36 |
-
define('POLYLANG_VERSION', '1.5.
|
37 |
define('PLL_MIN_WP_VERSION', '3.5');
|
38 |
|
39 |
define('POLYLANG_BASENAME', plugin_basename(__FILE__)); // plugin name as known by WP
|
2 |
/*
|
3 |
Plugin Name: Polylang
|
4 |
Plugin URI: http://polylang.wordpress.com/
|
5 |
+
Version: 1.5.5
|
6 |
Author: Frédéric Demarle
|
7 |
Description: Adds multilingual capability to WordPress
|
8 |
Text Domain: polylang
|
33 |
if (!function_exists('add_action'))
|
34 |
exit();
|
35 |
|
36 |
+
define('POLYLANG_VERSION', '1.5.5');
|
37 |
define('PLL_MIN_WP_VERSION', '3.5');
|
38 |
|
39 |
define('POLYLANG_BASENAME', plugin_basename(__FILE__)); // plugin name as known by WP
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: Chouby
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CCWWYUUQV8F4E
|
4 |
Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
|
5 |
Requires at least: 3.5
|
6 |
-
Tested up to:
|
7 |
-
Stable tag: 1.5.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Polylang adds multilingual content management support to WordPress.
|
@@ -63,11 +63,20 @@ See http://polylang.wordpress.com/documentation/contribute/
|
|
63 |
|
64 |
== Upgrade Notice ==
|
65 |
|
66 |
-
= 1.5.
|
67 |
-
Polylang 1.2 introduced major internal changes. More than ever, make a database backup before upgrading from 1.1.6 or older! If you are using a version older than 0.8, please ugrade to 0.9.8 before ugrading to 1.5.
|
68 |
|
69 |
== Changelog ==
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
= 1.5.4 (2014-08-13) =
|
72 |
|
73 |
* Add new API functions: pll_get_post_language, pll_get_term_language, pll_translate_string
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CCWWYUUQV8F4E
|
4 |
Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
|
5 |
Requires at least: 3.5
|
6 |
+
Tested up to: 4.0
|
7 |
+
Stable tag: 1.5.5
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Polylang adds multilingual content management support to WordPress.
|
63 |
|
64 |
== Upgrade Notice ==
|
65 |
|
66 |
+
= 1.5.5 =
|
67 |
+
Polylang 1.2 introduced major internal changes. More than ever, make a database backup before upgrading from 1.1.6 or older! If you are using a version older than 0.8, please ugrade to 0.9.8 before ugrading to 1.5.5
|
68 |
|
69 |
== Changelog ==
|
70 |
|
71 |
+
= 1.5.5 (2014-09-10) =
|
72 |
+
|
73 |
+
* Fix: missing argument 4 in icl_translate
|
74 |
+
* Fix: conflict with Vantage theme
|
75 |
+
* Fix: possible issue with cookie domain on 'localhost'
|
76 |
+
* Fix: filtering string translations does not work when the group name contains a space
|
77 |
+
* Fix: Possible 404 error for attachments
|
78 |
+
* Fix: PHP notice when a shared term is not translated in all taxonomies
|
79 |
+
|
80 |
= 1.5.4 (2014-08-13) =
|
81 |
|
82 |
* Add new API functions: pll_get_post_language, pll_get_term_language, pll_translate_string
|