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.3
=
Download this release
Release Info
Developer | Chouby |
Plugin | Polylang |
Version | 1.3.1 |
Comparing to | |
See all releases |
Code changes from version 1.3 to 1.3.1
- admin/admin-nav-menu.php +1 -1
- admin/admin.php +1 -1
- admin/settings.php +5 -4
- admin/view-languages.php +5 -2
- include/language.php +1 -4
- include/links-default.php +18 -1
- include/links-directory.php +13 -0
- include/links-domain.php +12 -11
- include/links-subdomain.php +7 -11
- include/model.php +1 -1
- include/upgrade.php +11 -24
- polylang.php +2 -2
- readme.txt +8 -3
admin/admin-nav-menu.php
CHANGED
@@ -245,7 +245,7 @@ class PLL_Admin_Nav_Menu {
|
|
245 |
return;
|
246 |
|
247 |
// get all the menus in the post language
|
248 |
-
$menus = get_terms('nav_menu', array('lang'
|
249 |
$menus = implode(',', $menus);
|
250 |
|
251 |
add_filter('option_nav_menu_options', create_function('$a', "\$a['auto_add'] = array_intersect(\$a['auto_add'], array($menus)); return \$a;"));
|
245 |
return;
|
246 |
|
247 |
// get all the menus in the post language
|
248 |
+
$menus = get_terms('nav_menu', array('lang' => $lang->slug, 'fields' => 'ids', 'hide_empty' => false));
|
249 |
$menus = implode(',', $menus);
|
250 |
|
251 |
add_filter('option_nav_menu_options', create_function('$a', "\$a['auto_add'] = array_intersect(\$a['auto_add'], array($menus)); return \$a;"));
|
admin/admin.php
CHANGED
@@ -48,7 +48,7 @@ class PLL_Admin extends PLL_Base {
|
|
48 |
*/
|
49 |
public function init() {
|
50 |
if (PLL_SETTINGS)
|
51 |
-
$this->settings_page = new PLL_Settings($this->
|
52 |
|
53 |
if (!$this->model->get_languages_list())
|
54 |
return;
|
48 |
*/
|
49 |
public function init() {
|
50 |
if (PLL_SETTINGS)
|
51 |
+
$this->settings_page = new PLL_Settings($this->links_model);
|
52 |
|
53 |
if (!$this->model->get_languages_list())
|
54 |
return;
|
admin/settings.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* @since 1.2
|
7 |
*/
|
8 |
class PLL_Settings {
|
9 |
-
public $model, $options;
|
10 |
protected $strings = array(); // strings to translate
|
11 |
|
12 |
/*
|
@@ -16,9 +16,10 @@ class PLL_Settings {
|
|
16 |
*
|
17 |
* @param object $model instance of PLL_Model
|
18 |
*/
|
19 |
-
public function __construct(&$
|
20 |
-
$this->
|
21 |
-
$this->
|
|
|
22 |
|
23 |
// adds screen options and the about box in the languages admin panel
|
24 |
add_action('load-settings_page_mlang', array(&$this, 'load_page'));
|
6 |
* @since 1.2
|
7 |
*/
|
8 |
class PLL_Settings {
|
9 |
+
public $links_model, $model, $options;
|
10 |
protected $strings = array(); // strings to translate
|
11 |
|
12 |
/*
|
16 |
*
|
17 |
* @param object $model instance of PLL_Model
|
18 |
*/
|
19 |
+
public function __construct(&$links_model) {
|
20 |
+
$this->links_model = &$links_model;
|
21 |
+
$this->model = &$links_model->model;
|
22 |
+
$this->options = &$this->model->options;
|
23 |
|
24 |
// adds screen options and the about box in the languages admin panel
|
25 |
add_action('load-settings_page_mlang', array(&$this, 'load_page'));
|
admin/view-languages.php
CHANGED
@@ -298,10 +298,13 @@ case 'settings': ?><?php
|
|
298 |
);?>
|
299 |
</label>
|
300 |
<p class="description"><?php
|
|
|
|
|
|
|
301 |
printf(
|
302 |
__('Example: %s instead of %s', 'polylang'),
|
303 |
-
'<code>'.esc_html(
|
304 |
-
'<code>'.esc_html(_get_page_link($page_on_front)).'</code>'
|
305 |
); ?>
|
306 |
</p>
|
307 |
</fieldset></td>
|
298 |
);?>
|
299 |
</label>
|
300 |
<p class="description"><?php
|
301 |
+
// that's nice to display the right home urls but don't forget that the page on front may have no language yet
|
302 |
+
$lang = $this->model->get_post_language($page_on_front);
|
303 |
+
$lang = $lang ? $lang : $this->model->get_language($this->options['default_lang']);
|
304 |
printf(
|
305 |
__('Example: %s instead of %s', 'polylang'),
|
306 |
+
'<code>' . esc_html($this->links_model->home_url($lang)) . '</code>',
|
307 |
+
'<code>' . esc_html(_get_page_link($page_on_front)) . '</code>'
|
308 |
); ?>
|
309 |
</p>
|
310 |
</fieldset></td>
|
include/language.php
CHANGED
@@ -97,15 +97,12 @@ class PLL_Language {
|
|
97 |
public function set_home_url() {
|
98 |
$options = get_option('polylang');
|
99 |
|
100 |
-
if ($options['default_lang'] == $this->slug && $options['hide_default'])
|
101 |
-
return $this->home_url = $this->search_url = trailingslashit(get_option('home'));
|
102 |
-
|
103 |
// a static page is used as front page : /!\ don't use get_page_link to avoid infinite loop
|
104 |
// don't use this for search form
|
105 |
if (!$options['redirect_lang'] && ($page_on_front = get_option('page_on_front')) && $id = pll_get_post($page_on_front, $this))
|
106 |
$this->home_url = _get_page_link($id);
|
107 |
|
108 |
-
$link =
|
109 |
|
110 |
// add a trailing slash as done by WP on homepage (otherwise could break the search form when the permalink structure does not include one)
|
111 |
// only for pretty permalinks
|
97 |
public function set_home_url() {
|
98 |
$options = get_option('polylang');
|
99 |
|
|
|
|
|
|
|
100 |
// a static page is used as front page : /!\ don't use get_page_link to avoid infinite loop
|
101 |
// don't use this for search form
|
102 |
if (!$options['redirect_lang'] && ($page_on_front = get_option('page_on_front')) && $id = pll_get_post($page_on_front, $this))
|
103 |
$this->home_url = _get_page_link($id);
|
104 |
|
105 |
+
$link = $GLOBALS['polylang']->links_model->home_url($this);
|
106 |
|
107 |
// add a trailing slash as done by WP on homepage (otherwise could break the search form when the permalink structure does not include one)
|
108 |
// only for pretty permalinks
|
include/links-default.php
CHANGED
@@ -8,7 +8,8 @@
|
|
8 |
* @since 1.2
|
9 |
*/
|
10 |
class PLL_Links_Default {
|
11 |
-
public $model;
|
|
|
12 |
|
13 |
/*
|
14 |
* constructor
|
@@ -19,6 +20,9 @@ class PLL_Links_Default {
|
|
19 |
*/
|
20 |
public function __construct(&$model) {
|
21 |
$this->model = &$model;
|
|
|
|
|
|
|
22 |
}
|
23 |
|
24 |
/*
|
@@ -73,4 +77,17 @@ class PLL_Links_Default {
|
|
73 |
$pattern = '#lang=('.implode('|', $this->model->get_languages_list(array('fields' => 'slug'))).')#';
|
74 |
return preg_match($pattern, trailingslashit($_SERVER['REQUEST_URI']), $matches) ? $matches[1] : ''; // $matches[1] is the slug of the requested language
|
75 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
}
|
8 |
* @since 1.2
|
9 |
*/
|
10 |
class PLL_Links_Default {
|
11 |
+
public $model, $options;
|
12 |
+
protected $home;
|
13 |
|
14 |
/*
|
15 |
* constructor
|
20 |
*/
|
21 |
public function __construct(&$model) {
|
22 |
$this->model = &$model;
|
23 |
+
$this->options = &$model->options;
|
24 |
+
|
25 |
+
$this->home = get_option('home');
|
26 |
}
|
27 |
|
28 |
/*
|
77 |
$pattern = '#lang=('.implode('|', $this->model->get_languages_list(array('fields' => 'slug'))).')#';
|
78 |
return preg_match($pattern, trailingslashit($_SERVER['REQUEST_URI']), $matches) ? $matches[1] : ''; // $matches[1] is the slug of the requested language
|
79 |
}
|
80 |
+
|
81 |
+
/*
|
82 |
+
* returns the home url
|
83 |
+
* links_model interface
|
84 |
+
*
|
85 |
+
* @since 1.3.1
|
86 |
+
*
|
87 |
+
* @param object $lang PLL_Language object
|
88 |
+
* @return string
|
89 |
+
*/
|
90 |
+
public function home_url($lang) {
|
91 |
+
return $this->options['hide_default'] && $lang->slug == $this->options['default_lang'] ? $this->home : get_term_link($lang, 'language');
|
92 |
+
}
|
93 |
}
|
include/links-directory.php
CHANGED
@@ -103,6 +103,19 @@ class PLL_Links_Directory {
|
|
103 |
return preg_match($pattern, trailingslashit($_SERVER['REQUEST_URI']), $matches) ? $matches[1] : ''; // $matches[1] is the slug of the requested language
|
104 |
}
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
/*
|
107 |
* optionaly removes 'language' in permalinks so that we get http://www.myblog/en/ instead of http://www.myblog/language/en/
|
108 |
*
|
103 |
return preg_match($pattern, trailingslashit($_SERVER['REQUEST_URI']), $matches) ? $matches[1] : ''; // $matches[1] is the slug of the requested language
|
104 |
}
|
105 |
|
106 |
+
/*
|
107 |
+
* returns the home url
|
108 |
+
* links_model interface
|
109 |
+
*
|
110 |
+
* @since 1.3.1
|
111 |
+
*
|
112 |
+
* @param object $lang PLL_Language object
|
113 |
+
* @return string
|
114 |
+
*/
|
115 |
+
public function home_url($lang) {
|
116 |
+
return $this->options['hide_default'] && $lang->slug == $this->options['default_lang'] ? $this->home : get_term_link($lang, 'language');
|
117 |
+
}
|
118 |
+
|
119 |
/*
|
120 |
* optionaly removes 'language' in permalinks so that we get http://www.myblog/en/ instead of http://www.myblog/language/en/
|
121 |
*
|
include/links-domain.php
CHANGED
@@ -23,9 +23,6 @@ class PLL_Links_Domain {
|
|
23 |
$this->options = &$model->options;
|
24 |
|
25 |
$this->home = get_option('home');
|
26 |
-
|
27 |
-
// returns the correct language link
|
28 |
-
add_filter('term_link', array(&$this, 'term_link'), 10, 3);
|
29 |
}
|
30 |
|
31 |
/*
|
@@ -87,16 +84,20 @@ class PLL_Links_Domain {
|
|
87 |
}
|
88 |
|
89 |
/*
|
90 |
-
* returns the
|
|
|
91 |
*
|
92 |
-
* @since 1.
|
93 |
*
|
94 |
-
* @param
|
95 |
-
* @
|
96 |
-
* @param string $tax taxonomy name
|
97 |
-
* @return string language home link or unmodified term link
|
98 |
*/
|
99 |
-
function
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
101 |
}
|
102 |
}
|
23 |
$this->options = &$model->options;
|
24 |
|
25 |
$this->home = get_option('home');
|
|
|
|
|
|
|
26 |
}
|
27 |
|
28 |
/*
|
84 |
}
|
85 |
|
86 |
/*
|
87 |
+
* returns the home url
|
88 |
+
* links_model interface
|
89 |
*
|
90 |
+
* @since 1.3.1
|
91 |
*
|
92 |
+
* @param object $lang PLL_Language object
|
93 |
+
* @return string
|
|
|
|
|
94 |
*/
|
95 |
+
function home_url($lang) {
|
96 |
+
if ($lang->slug == $this->options['default_lang'])
|
97 |
+
return $this->home;
|
98 |
+
|
99 |
+
if (!empty($this->options['domains'][$lang->slug]))
|
100 |
+
return $this->options['domains'][$lang->slug];
|
101 |
+
|
102 |
}
|
103 |
}
|
include/links-subdomain.php
CHANGED
@@ -23,9 +23,6 @@ class PLL_Links_Subdomain {
|
|
23 |
$this->options = &$model->options;
|
24 |
|
25 |
$this->home = get_option('home');
|
26 |
-
|
27 |
-
// returns the correct language link
|
28 |
-
add_filter('term_link', array(&$this, 'term_link'), 10, 3);
|
29 |
}
|
30 |
|
31 |
/*
|
@@ -91,16 +88,15 @@ class PLL_Links_Subdomain {
|
|
91 |
}
|
92 |
|
93 |
/*
|
94 |
-
* returns the
|
|
|
95 |
*
|
96 |
-
* @since 1.
|
97 |
*
|
98 |
-
* @param
|
99 |
-
* @
|
100 |
-
* @param string $tax taxonomy name
|
101 |
-
* @return string language home link or unmodified term link
|
102 |
*/
|
103 |
-
function
|
104 |
-
return
|
105 |
}
|
106 |
}
|
23 |
$this->options = &$model->options;
|
24 |
|
25 |
$this->home = get_option('home');
|
|
|
|
|
|
|
26 |
}
|
27 |
|
28 |
/*
|
88 |
}
|
89 |
|
90 |
/*
|
91 |
+
* returns the home url
|
92 |
+
* links_model interface
|
93 |
*
|
94 |
+
* @since 1.3.1
|
95 |
*
|
96 |
+
* @param object $lang PLL_Language object
|
97 |
+
* @return string
|
|
|
|
|
98 |
*/
|
99 |
+
public function home_url($lang) {
|
100 |
+
return $this->add_language_to_link($this->home, $lang);
|
101 |
}
|
102 |
}
|
include/model.php
CHANGED
@@ -738,7 +738,7 @@ class PLL_Model {
|
|
738 |
*/
|
739 |
public function get_terms_args($args) {
|
740 |
if (isset($args['lang'])) {
|
741 |
-
$key = '_' . (is_array($lang) ? implode(',', $lang) : $lang);
|
742 |
$args['cache_domain'] = empty($args['cache_domain']) ? 'pll' . $key : $args['cache_domain'] . $key;
|
743 |
}
|
744 |
|
738 |
*/
|
739 |
public function get_terms_args($args) {
|
740 |
if (isset($args['lang'])) {
|
741 |
+
$key = '_' . (is_array($args['lang']) ? implode(',', $args['lang']) : $args['lang']);
|
742 |
$args['cache_domain'] = empty($args['cache_domain']) ? 'pll' . $key : $args['cache_domain'] . $key;
|
743 |
}
|
744 |
|
include/upgrade.php
CHANGED
@@ -88,7 +88,7 @@ class PLL_Upgrade {
|
|
88 |
* @since 1.2
|
89 |
*/
|
90 |
public function _upgrade() {
|
91 |
-
foreach (array('0.9', '1.0', '1.1', '1.2', '1.2.1', '1.2.3', '1.3') as $version)
|
92 |
if (version_compare($this->options['version'], $version, '<'))
|
93 |
call_user_func(array(&$this, 'upgrade_' . str_replace('.', '_', $version)));
|
94 |
|
@@ -344,33 +344,10 @@ class PLL_Upgrade {
|
|
344 |
/*
|
345 |
* upgrades if the previous version is < 1.3
|
346 |
* moves the user biographies in default language to the 'description' user meta
|
347 |
-
* multisite compatible
|
348 |
*
|
349 |
* @since 1.3
|
350 |
*/
|
351 |
protected function upgrade_1_3() {
|
352 |
-
if (is_multisite()) {
|
353 |
-
foreach ($GLOBALS['wpdb']->get_col("SELECT blog_id FROM $wpdb->blogs") as $blog_id) {
|
354 |
-
switch_to_blog($blog_id);
|
355 |
-
$this->_upgrade_1_3();
|
356 |
-
}
|
357 |
-
restore_current_blog();
|
358 |
-
}
|
359 |
-
else {
|
360 |
-
$this->_upgrade_1_3();
|
361 |
-
}
|
362 |
-
}
|
363 |
-
|
364 |
-
/*
|
365 |
-
* cleans language cache as new properties have been added in PLL_Language
|
366 |
-
* moves the user biographies in default language to the 'description' user meta
|
367 |
-
*
|
368 |
-
* @since 1.3
|
369 |
-
*/
|
370 |
-
protected function _upgrade_1_3() {
|
371 |
-
global $polylang;
|
372 |
-
$polylang->model->clean_languages_cache();
|
373 |
-
|
374 |
$usermeta = 'description_' . $this->options['default_lang'];
|
375 |
$query = new WP_User_Query(array('blog_id' => $GLOBALS['blog_id'], 'meta_key' => $usermeta));
|
376 |
|
@@ -383,6 +360,16 @@ class PLL_Upgrade {
|
|
383 |
}
|
384 |
}
|
385 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
/*
|
387 |
* FIXME don't delete old data in 1.2, just in case...
|
388 |
* ready for a next version
|
88 |
* @since 1.2
|
89 |
*/
|
90 |
public function _upgrade() {
|
91 |
+
foreach (array('0.9', '1.0', '1.1', '1.2', '1.2.1', '1.2.3', '1.3', '1.3.1') as $version)
|
92 |
if (version_compare($this->options['version'], $version, '<'))
|
93 |
call_user_func(array(&$this, 'upgrade_' . str_replace('.', '_', $version)));
|
94 |
|
344 |
/*
|
345 |
* upgrades if the previous version is < 1.3
|
346 |
* moves the user biographies in default language to the 'description' user meta
|
|
|
347 |
*
|
348 |
* @since 1.3
|
349 |
*/
|
350 |
protected function upgrade_1_3() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
$usermeta = 'description_' . $this->options['default_lang'];
|
352 |
$query = new WP_User_Query(array('blog_id' => $GLOBALS['blog_id'], 'meta_key' => $usermeta));
|
353 |
|
360 |
}
|
361 |
}
|
362 |
|
363 |
+
/*
|
364 |
+
* upgrades if the previous version is < 1.3.1
|
365 |
+
* deletes language cache (due to bug correction in home urls)
|
366 |
+
*
|
367 |
+
* @since 1.3.1
|
368 |
+
*/
|
369 |
+
protected function upgrade_1_3_1() {
|
370 |
+
delete_transient('pll_languages_list');
|
371 |
+
}
|
372 |
+
|
373 |
/*
|
374 |
* FIXME don't delete old data in 1.2, just in case...
|
375 |
* ready for a next version
|
polylang.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Polylang
|
4 |
Plugin URI: http://polylang.wordpress.com/
|
5 |
-
Version: 1.3
|
6 |
Author: Frédéric Demarle
|
7 |
Description: Adds multilingual capability to WordPress
|
8 |
Text Domain: polylang
|
@@ -29,7 +29,7 @@ Domain Path: /languages
|
|
29 |
*
|
30 |
*/
|
31 |
|
32 |
-
define('POLYLANG_VERSION', '1.3');
|
33 |
define('PLL_MIN_WP_VERSION', '3.1');
|
34 |
|
35 |
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.3.1
|
6 |
Author: Frédéric Demarle
|
7 |
Description: Adds multilingual capability to WordPress
|
8 |
Text Domain: polylang
|
29 |
*
|
30 |
*/
|
31 |
|
32 |
+
define('POLYLANG_VERSION', '1.3.1');
|
33 |
define('PLL_MIN_WP_VERSION', '3.1');
|
34 |
|
35 |
define('POLYLANG_BASENAME', plugin_basename(__FILE__)); // plugin name as known by WP
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
|
5 |
Requires at least: 3.1
|
6 |
Tested up to: 3.8
|
7 |
-
Stable tag: 1.3
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Polylang adds multilingual content management support to WordPress.
|
@@ -64,12 +64,17 @@ See http://polylang.wordpress.com/documentation/contribute/
|
|
64 |
|
65 |
== Upgrade Notice ==
|
66 |
|
67 |
-
= 1.3 =
|
68 |
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.3
|
69 |
|
70 |
== Changelog ==
|
71 |
|
72 |
-
= 1.3 =
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
* Refresh admin UI for better look in WP 3.8 and more dynamic comportment
|
75 |
* The "Detect browser language" option does now also controls returning visits (based on cookie).
|
4 |
Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
|
5 |
Requires at least: 3.1
|
6 |
Tested up to: 3.8
|
7 |
+
Stable tag: 1.3.1
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Polylang adds multilingual content management support to WordPress.
|
64 |
|
65 |
== Upgrade Notice ==
|
66 |
|
67 |
+
= 1.3.1 =
|
68 |
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.3
|
69 |
|
70 |
== Changelog ==
|
71 |
|
72 |
+
= 1.3.1 (2013-12-13) =
|
73 |
+
|
74 |
+
* Bug correction: fatal error on settings page if a static front page without language is set
|
75 |
+
* Bug correction: wrong home url when using different domains per language
|
76 |
+
|
77 |
+
= 1.3 (2013-12-11) =
|
78 |
|
79 |
* Refresh admin UI for better look in WP 3.8 and more dynamic comportment
|
80 |
* The "Detect browser language" option does now also controls returning visits (based on cookie).
|