Version Description
(2014-12-14) =
- fix: bugs and inconsistencies compared to WPML in 'icl_get_languages' (should fix a conflict with Avada)
- fix: https issue
- fix: stop displaying an error when adding en_US as new language (translation not downloaded)
- fix: infinite redirect loop on (unattached) attachment links
- fix: impossible to add tags in post quick edit (introduced in 1.5)
- fix: the customizer does not land to the right page when cumulating: static front page + page name in url + default language code not hidden
- fix: read parent theme wpml-config.xml before child theme
- fix: add protection to avoid empty language
- fix: page preview link again
Download this release
Release Info
Developer | Chouby |
Plugin | Polylang |
Version | 1.6.2 |
Comparing to | |
See all releases |
Code changes from version 1.6.1 to 1.6.2
- admin/admin-filters-term.php +44 -1
- admin/admin-filters.php +8 -6
- admin/settings.php +2 -2
- admin/view-languages.php +1 -1
- admin/view-recommended.php +1 -10
- admin/view-translations-term.php +2 -2
- frontend/choose-lang.php +7 -4
- frontend/frontend-links.php +11 -2
- include/links-model.php +2 -2
- include/links.php +19 -0
- include/model.php +4 -1
- include/wpml-compat.php +16 -12
- polylang.php +3 -3
- readme.txt +16 -4
admin/admin-filters-term.php
CHANGED
@@ -53,6 +53,8 @@ class PLL_Admin_Filters_Term {
|
|
53 |
add_action('wp_ajax_polylang-ajax-tag-search', 'wp_ajax_ajax_tag_search'); // take profit of new filter, cache...
|
54 |
|
55 |
add_filter('option_default_category', array(&$this, 'option_default_category'));
|
|
|
|
|
56 |
}
|
57 |
|
58 |
/*
|
@@ -225,7 +227,10 @@ class PLL_Admin_Filters_Term {
|
|
225 |
|
226 |
// quick edit
|
227 |
elseif (isset($_POST['inline_lang_choice'])) {
|
228 |
-
check_ajax_referer(
|
|
|
|
|
|
|
229 |
|
230 |
if (isset($_POST['inline-save-tax']) && $this->model->get_term_language($term_id)->slug != $_POST['inline_lang_choice'])
|
231 |
$this->model->delete_translation('term', $term_id);
|
@@ -605,6 +610,44 @@ class PLL_Admin_Filters_Term {
|
|
605 |
return $value;
|
606 |
}
|
607 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
608 |
/*
|
609 |
* returns html markup for a translation link
|
610 |
*
|
53 |
add_action('wp_ajax_polylang-ajax-tag-search', 'wp_ajax_ajax_tag_search'); // take profit of new filter, cache...
|
54 |
|
55 |
add_filter('option_default_category', array(&$this, 'option_default_category'));
|
56 |
+
|
57 |
+
//add_action('split_shared_term', array(&$this, 'split_shared_term'), 10, 4); // FIXME planned for WP 4.2
|
58 |
}
|
59 |
|
60 |
/*
|
227 |
|
228 |
// quick edit
|
229 |
elseif (isset($_POST['inline_lang_choice'])) {
|
230 |
+
check_ajax_referer(
|
231 |
+
isset($_POST['action']) && 'inline-save' == $_POST['action'] ? 'inlineeditnonce' : 'taxinlineeditnonce', // post quick edit or tag quick edit ?
|
232 |
+
'_inline_edit'
|
233 |
+
);
|
234 |
|
235 |
if (isset($_POST['inline-save-tax']) && $this->model->get_term_language($term_id)->slug != $_POST['inline_lang_choice'])
|
236 |
$this->model->delete_translation('term', $term_id);
|
610 |
return $value;
|
611 |
}
|
612 |
|
613 |
+
/*
|
614 |
+
* FIXME: splitting shared terms is not planned before WP 4.2. It is not clear if all terms will be splitted at once
|
615 |
+
* when splitting a shared, splits translations if these are shared terms too
|
616 |
+
*
|
617 |
+
* @since 1.6.2
|
618 |
+
*
|
619 |
+
* @param int $term_id shared term_id
|
620 |
+
* @param int $new_term_id
|
621 |
+
* @param int $term_taxonomy_id
|
622 |
+
* @param string $taxonomy
|
623 |
+
*/
|
624 |
+
public function split_shared_term($term_id, $new_term_id, $term_taxonomy_id, $taxonomy) {
|
625 |
+
// avoid recursion
|
626 |
+
static $avoid_recursion = false;
|
627 |
+
if ($avoid_recursion)
|
628 |
+
return;
|
629 |
+
|
630 |
+
$avoid_recursion = true;
|
631 |
+
$lang = $this->model->get_term_language($term_id);
|
632 |
+
|
633 |
+
foreach ($this->model->get_translations('term', $term_id) as $key => $tr_id) {
|
634 |
+
if ($lang->slug == $key) {
|
635 |
+
$translations[$key] = $new_term_id;
|
636 |
+
}
|
637 |
+
else {
|
638 |
+
$tr_term = get_term($tr_id, $taxonomy);
|
639 |
+
$translations[$key] = _split_shared_term($tr_id, $tr_term->term_taxonomy_id);
|
640 |
+
|
641 |
+
// hack translation ids sent by the form to avoid overwrite in PLL_Admin_Filters_Term::save_translations
|
642 |
+
if (isset($_POST['term_tr_lang'][$key]) && $_POST['term_tr_lang'][$key] == $tr_id)
|
643 |
+
$_POST['term_tr_lang'][$key] = $translations[$key];
|
644 |
+
}
|
645 |
+
$this->model->set_term_language($translations[$key], $key);
|
646 |
+
}
|
647 |
+
|
648 |
+
$this->model->save_translations('term', $new_term_id, $translations);
|
649 |
+
}
|
650 |
+
|
651 |
/*
|
652 |
* returns html markup for a translation link
|
653 |
*
|
admin/admin-filters.php
CHANGED
@@ -194,12 +194,14 @@ class PLL_Admin_Filters extends PLL_Filters {
|
|
194 |
* @return int
|
195 |
*/
|
196 |
public function update_page_on_front($page_id, $old_id) {
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
$
|
202 |
-
|
|
|
|
|
203 |
}
|
204 |
|
205 |
return $page_id;
|
194 |
* @return int
|
195 |
*/
|
196 |
public function update_page_on_front($page_id, $old_id) {
|
197 |
+
if ($page_id) {
|
198 |
+
$translations = count($this->model->get_translations('post', $page_id));
|
199 |
+
$languages = count($this->model->get_languages_list());
|
200 |
+
|
201 |
+
if ($languages > 1 && $translations != $languages) {
|
202 |
+
$page_id = $old_id;
|
203 |
+
add_settings_error('reading', 'pll_page_on_front_error', __('The chosen static front page must be translated in all languages.', 'polylang'));
|
204 |
+
}
|
205 |
}
|
206 |
|
207 |
return $page_id;
|
admin/settings.php
CHANGED
@@ -170,7 +170,7 @@ class PLL_Settings {
|
|
170 |
PLL_Admin::download_mo($_POST['locale']);
|
171 |
}
|
172 |
|
173 |
-
|
174 |
// attempts to install the language pack
|
175 |
require_once(ABSPATH . 'wp-admin/includes/translation-install.php');
|
176 |
if (!wp_download_language_pack($_POST['locale']))
|
@@ -263,7 +263,7 @@ class PLL_Settings {
|
|
263 |
foreach ($_POST['domains'] as $key => $domain) {
|
264 |
$this->options['domains'][$key] = esc_url_raw(trim($domain));
|
265 |
}
|
266 |
-
$this->options['domains'][$this->options['default_lang']] =
|
267 |
}
|
268 |
|
269 |
foreach (array('browser', 'hide_default', 'redirect_lang', 'media_support') as $key)
|
170 |
PLL_Admin::download_mo($_POST['locale']);
|
171 |
}
|
172 |
|
173 |
+
elseif ('en_US' != $_POST['locale']) {
|
174 |
// attempts to install the language pack
|
175 |
require_once(ABSPATH . 'wp-admin/includes/translation-install.php');
|
176 |
if (!wp_download_language_pack($_POST['locale']))
|
263 |
foreach ($_POST['domains'] as $key => $domain) {
|
264 |
$this->options['domains'][$key] = esc_url_raw(trim($domain));
|
265 |
}
|
266 |
+
$this->options['domains'][$this->options['default_lang']] = $this->links_model->home;
|
267 |
}
|
268 |
|
269 |
foreach (array('browser', 'hide_default', 'redirect_lang', 'media_support') as $key)
|
admin/view-languages.php
CHANGED
@@ -224,7 +224,7 @@ case 'settings': ?><?php
|
|
224 |
'<td><input name="domains[%1$s]" id="pll-domain[%1$s]" type="text" value="%3$s" size="40" aria-required="true" %4$s /></td></tr>',
|
225 |
esc_attr($lg->slug),
|
226 |
esc_attr($lg->name),
|
227 |
-
esc_url($lg->slug == $this->options['default_lang'] ?
|
228 |
!$this->links_model->using_permalinks || $lg->slug == $this->options['default_lang'] ? 'disabled="disabled"' : ''
|
229 |
);
|
230 |
}?>
|
224 |
'<td><input name="domains[%1$s]" id="pll-domain[%1$s]" type="text" value="%3$s" size="40" aria-required="true" %4$s /></td></tr>',
|
225 |
esc_attr($lg->slug),
|
226 |
esc_attr($lg->name),
|
227 |
+
esc_url($lg->slug == $this->options['default_lang'] ? $this->links_model->home : (isset($this->options['domains'][$lg->slug]) ? $this->options['domains'][$lg->slug] : '')),
|
228 |
!$this->links_model->using_permalinks || $lg->slug == $this->options['default_lang'] ? 'disabled="disabled"' : ''
|
229 |
);
|
230 |
}?>
|
admin/view-recommended.php
CHANGED
@@ -1,10 +1 @@
|
|
1 |
-
|
2 |
-
_e('YouTube Localization/Internationalization', 'polylang'); ?>
|
3 |
-
</h4>
|
4 |
-
<p><?php
|
5 |
-
printf(
|
6 |
-
__('If you embed YouTube videos on your site and want the language of video player’s interface to automatically match your site’s current language, %sadd this plugin%s.', 'polylang'),
|
7 |
-
'<a href="http://bitly.com/youtube-wordpress-language-preferences">',
|
8 |
-
'</a>'
|
9 |
-
); ?>
|
10 |
-
</p>
|
1 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/view-translations-term.php
CHANGED
@@ -11,8 +11,8 @@ else {
|
|
11 |
<label><?php _e('Translations', 'polylang');?></label><?php
|
12 |
}?>
|
13 |
<table class="widefat term-translations" id="<?php echo isset($term_id) ? 'edit' : 'add'; ?>-term-translations"><?php
|
14 |
-
// disable the translation input field
|
15 |
-
$disabled = in_array(get_option('default_category'), $this->model->get_translations('term', $term_id));
|
16 |
|
17 |
foreach ($this->model->get_languages_list() as $language) {
|
18 |
if ($language->term_id == $lang->term_id)
|
11 |
<label><?php _e('Translations', 'polylang');?></label><?php
|
12 |
}?>
|
13 |
<table class="widefat term-translations" id="<?php echo isset($term_id) ? 'edit' : 'add'; ?>-term-translations"><?php
|
14 |
+
// disable the translation input field for default category to prevent removal
|
15 |
+
$disabled = isset($term_id) && in_array(get_option('default_category'), $this->model->get_translations('term', $term_id));
|
16 |
|
17 |
foreach ($this->model->get_languages_list() as $language) {
|
18 |
if ($language->term_id == $lang->term_id)
|
frontend/choose-lang.php
CHANGED
@@ -46,11 +46,14 @@ abstract class PLL_Choose_Lang {
|
|
46 |
if (isset($this->curlang))
|
47 |
return;
|
48 |
|
49 |
-
$
|
|
|
|
|
|
|
50 |
$this->maybe_setcookie();
|
51 |
|
52 |
-
$GLOBALS['text_direction'] = $curlang->is_rtl ? 'rtl' : 'ltr';
|
53 |
-
do_action('pll_language_defined', $curlang->slug, $curlang);
|
54 |
}
|
55 |
|
56 |
/*
|
@@ -68,7 +71,7 @@ abstract class PLL_Choose_Lang {
|
|
68 |
$this->curlang->slug,
|
69 |
time() + 31536000 /* 1 year */,
|
70 |
COOKIEPATH,
|
71 |
-
2 == $this->options['force_lang'] ? parse_url(
|
72 |
);
|
73 |
}
|
74 |
|
46 |
if (isset($this->curlang))
|
47 |
return;
|
48 |
|
49 |
+
// final check in case $curlang has an unexpected value
|
50 |
+
// see https://wordpress.org/support/topic/detect-browser-language-sometimes-setting-null-language
|
51 |
+
$this->curlang = ($curlang instanceof PLL_Language) ? $curlang : $this->model->get_language($this->options['default_lang']);
|
52 |
+
|
53 |
$this->maybe_setcookie();
|
54 |
|
55 |
+
$GLOBALS['text_direction'] = $this->curlang->is_rtl ? 'rtl' : 'ltr';
|
56 |
+
do_action('pll_language_defined', $this->curlang->slug, $this->curlang);
|
57 |
}
|
58 |
|
59 |
/*
|
71 |
$this->curlang->slug,
|
72 |
time() + 31536000 /* 1 year */,
|
73 |
COOKIEPATH,
|
74 |
+
2 == $this->options['force_lang'] ? parse_url($this->links_model->home, PHP_URL_HOST) : COOKIE_DOMAIN
|
75 |
);
|
76 |
}
|
77 |
|
frontend/frontend-links.php
CHANGED
@@ -327,8 +327,17 @@ class PLL_Frontend_Links extends PLL_Links {
|
|
327 |
public function check_canonical_url() {
|
328 |
global $wp_query, $post;
|
329 |
|
330 |
-
//
|
331 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
return;
|
333 |
|
334 |
if (is_single() || is_page()) {
|
327 |
public function check_canonical_url() {
|
328 |
global $wp_query, $post;
|
329 |
|
330 |
+
// don't redirect preview link
|
331 |
+
if (is_preview())
|
332 |
+
return;
|
333 |
+
|
334 |
+
// don't redirect mysite.com/?attachment_id= to mysite.com/en/?attachment_id=
|
335 |
+
if (1 == $this->options['force_lang'] && is_attachment() && isset($_GET['attachment_id']))
|
336 |
+
return;
|
337 |
+
|
338 |
+
// if the default language code is not hidden and the static front page url contains the page name
|
339 |
+
// the customizer lands here and the code below would redirect to the list of posts
|
340 |
+
if (isset($_POST['wp_customize'], $_POST['customized']))
|
341 |
return;
|
342 |
|
343 |
if (is_single() || is_page()) {
|
include/links-model.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
*/
|
8 |
abstract class PLL_Links_Model {
|
9 |
public $model, $options;
|
10 |
-
public $home; // used to
|
11 |
public $using_permalinks;
|
12 |
|
13 |
/*
|
@@ -21,7 +21,7 @@ abstract class PLL_Links_Model {
|
|
21 |
$this->model = &$model;
|
22 |
$this->options = &$model->options;
|
23 |
|
24 |
-
$this->home =
|
25 |
}
|
26 |
|
27 |
/*
|
7 |
*/
|
8 |
abstract class PLL_Links_Model {
|
9 |
public $model, $options;
|
10 |
+
public $home; // used to store the home url before it is filtered
|
11 |
public $using_permalinks;
|
12 |
|
13 |
/*
|
21 |
$this->model = &$model;
|
22 |
$this->options = &$model->options;
|
23 |
|
24 |
+
$this->home = home_url();
|
25 |
}
|
26 |
|
27 |
/*
|
include/links.php
CHANGED
@@ -35,6 +35,9 @@ class PLL_Links {
|
|
35 |
add_filter('term_link', array(&$this, 'term_link'), 20, 3);
|
36 |
}
|
37 |
|
|
|
|
|
|
|
38 |
if (3 == $this->options['force_lang'])
|
39 |
add_filter('preview_post_link', array(&$this, 'preview_post_link'), 20);
|
40 |
}
|
@@ -71,6 +74,22 @@ class PLL_Links {
|
|
71 |
return $this->_links[$link] = $post->post_status != 'publish' ? $link : $this->links_model->add_language_to_link($link, $this->model->get_post_language($post->ID));
|
72 |
}
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
/*
|
75 |
* modifies custom posts links
|
76 |
*
|
35 |
add_filter('term_link', array(&$this, 'term_link'), 20, 3);
|
36 |
}
|
37 |
|
38 |
+
if ($this->options['force_lang'] > 1)
|
39 |
+
add_filter('attachment_link', array(&$this, 'attachment_link'), 20, 2);
|
40 |
+
|
41 |
if (3 == $this->options['force_lang'])
|
42 |
add_filter('preview_post_link', array(&$this, 'preview_post_link'), 20);
|
43 |
}
|
74 |
return $this->_links[$link] = $post->post_status != 'publish' ? $link : $this->links_model->add_language_to_link($link, $this->model->get_post_language($post->ID));
|
75 |
}
|
76 |
|
77 |
+
/*
|
78 |
+
* modifies attachment links
|
79 |
+
*
|
80 |
+
* @since 1.6.2
|
81 |
+
*
|
82 |
+
* @param string $link attachment link
|
83 |
+
* @param int $post_id attachment link
|
84 |
+
* @return string modified attachment link
|
85 |
+
*/
|
86 |
+
public function attachment_link($link, $post_id) {
|
87 |
+
if (isset($this->_links[$link]))
|
88 |
+
return $this->_links[$link];
|
89 |
+
|
90 |
+
return $this->_links[$link] = $this->links_model->add_language_to_link($link, $this->model->get_post_language($post_id));
|
91 |
+
}
|
92 |
+
|
93 |
/*
|
94 |
* modifies custom posts links
|
95 |
*
|
include/model.php
CHANGED
@@ -99,9 +99,12 @@ class PLL_Model {
|
|
99 |
* @return bool|object the term associated to the object in the requested taxonomy if exists, false otherwise
|
100 |
*/
|
101 |
public function get_object_term($object_id, $taxonomy) {
|
|
|
|
|
|
|
102 |
$term = get_object_term_cache($object_id, $taxonomy);
|
103 |
|
104 |
-
if (
|
105 |
// query language and translations at the same time
|
106 |
$taxonomies = (false !== strpos($taxonomy, 'term_')) ?
|
107 |
array('term_language', 'term_translations') :
|
99 |
* @return bool|object the term associated to the object in the requested taxonomy if exists, false otherwise
|
100 |
*/
|
101 |
public function get_object_term($object_id, $taxonomy) {
|
102 |
+
if (empty($object_id))
|
103 |
+
return false;
|
104 |
+
|
105 |
$term = get_object_term_cache($object_id, $taxonomy);
|
106 |
|
107 |
+
if (false === $term) {
|
108 |
// query language and translations at the same time
|
109 |
$taxonomies = (false !== strpos($taxonomy, 'term_')) ?
|
110 |
array('term_language', 'term_translations') :
|
include/wpml-compat.php
CHANGED
@@ -52,7 +52,7 @@ if (!function_exists('icl_get_home_url')) {
|
|
52 |
* list of paramaters accepted in $args
|
53 |
*
|
54 |
* skip_missing => wether to skip missing translation or not, 0 or 1, defaults to 0
|
55 |
-
* orderby => 'id', '
|
56 |
* order => 'ASC' or 'DESC', defaults to 'ASC'
|
57 |
* link_empty_to => link to use when the translation is missing {$lang} is replaced by the language code
|
58 |
*
|
@@ -75,21 +75,25 @@ if (!function_exists('icl_get_home_url')) {
|
|
75 |
if (!function_exists('icl_get_languages')) {
|
76 |
function icl_get_languages($args = '') {
|
77 |
global $polylang;
|
78 |
-
if (empty($polylang)
|
79 |
return array();
|
80 |
|
|
|
81 |
$orderby = (isset($args['orderby']) && $args['orderby'] == 'code') ? 'slug' : (isset($args['orderby']) && $args['orderby'] == 'name' ? 'name' : 'id');
|
82 |
$order = (!empty($args['order']) && $args['order'] == 'desc') ? 'DESC' : 'ASC';
|
83 |
|
84 |
$arr = array();
|
85 |
|
86 |
foreach ($polylang->model->get_languages_list(array('hide_empty' => true, 'orderby' => $orderby, 'order' => $order)) as $lang) {
|
87 |
-
|
|
|
|
|
88 |
|
89 |
-
|
|
|
90 |
continue;
|
91 |
|
92 |
-
$arr[] = array(
|
93 |
'id' => $lang->term_id,
|
94 |
'active' => isset($polylang->curlang->slug) && $polylang->curlang->slug == $lang->slug ? 1 : 0,
|
95 |
'native_name' => $lang->name,
|
@@ -97,7 +101,7 @@ if (!function_exists('icl_get_languages')) {
|
|
97 |
'translated_name' => '', // does not exist in Polylang
|
98 |
'language_code' => $lang->slug,
|
99 |
'country_flag_url' => $lang->flag_url,
|
100 |
-
'url' => $url ? $url :
|
101 |
(empty($args['link_empty_to']) ? $polylang->links->get_home_url($lang) :
|
102 |
str_replace('{$lang}', $lang->slug, $args['link_empty_to']))
|
103 |
);
|
@@ -471,13 +475,13 @@ class PLL_WPML_Config {
|
|
471 |
public function init() {
|
472 |
$this->wpml_config = array();
|
473 |
|
474 |
-
// child theme
|
475 |
-
if (($template = get_template_directory()) != ($stylesheet = get_stylesheet_directory()) && file_exists($file = $stylesheet.'/wpml-config.xml'))
|
476 |
-
$this->xml_parse(file_get_contents($file), get_stylesheet()); // FIXME fopen + fread + fclose quicker ?
|
477 |
-
|
478 |
// theme
|
479 |
-
if (file_exists($file = $template.'/wpml-config.xml'))
|
480 |
-
$this->xml_parse(file_get_contents($file), get_template());
|
|
|
|
|
|
|
|
|
481 |
|
482 |
// plugins
|
483 |
// don't forget sitewide active plugins thanks to Reactorshop http://wordpress.org/support/topic/polylang-and-yoast-seo-plugin/page/2?replies=38#post-4801829
|
52 |
* list of paramaters accepted in $args
|
53 |
*
|
54 |
* skip_missing => wether to skip missing translation or not, 0 or 1, defaults to 0
|
55 |
+
* orderby => 'id', 'code', 'name', defaults to 'id'
|
56 |
* order => 'ASC' or 'DESC', defaults to 'ASC'
|
57 |
* link_empty_to => link to use when the translation is missing {$lang} is replaced by the language code
|
58 |
*
|
75 |
if (!function_exists('icl_get_languages')) {
|
76 |
function icl_get_languages($args = '') {
|
77 |
global $polylang;
|
78 |
+
if (empty($polylang))
|
79 |
return array();
|
80 |
|
81 |
+
$args = wp_parse_args($args, array('skip_missing' => 0, 'orderby' => 'id', 'order' => 'ASC'));
|
82 |
$orderby = (isset($args['orderby']) && $args['orderby'] == 'code') ? 'slug' : (isset($args['orderby']) && $args['orderby'] == 'name' ? 'name' : 'id');
|
83 |
$order = (!empty($args['order']) && $args['order'] == 'desc') ? 'DESC' : 'ASC';
|
84 |
|
85 |
$arr = array();
|
86 |
|
87 |
foreach ($polylang->model->get_languages_list(array('hide_empty' => true, 'orderby' => $orderby, 'order' => $order)) as $lang) {
|
88 |
+
// we can find a translation only on frontend
|
89 |
+
if (method_exists($polylang->links, 'get_translation_url'))
|
90 |
+
$url = $polylang->links->get_translation_url($lang);
|
91 |
|
92 |
+
// it seems that WPML does not bother of skip_missing parameter on admin side and before the $wp_query object has been filled
|
93 |
+
if (empty($url) && !empty($args['skip_missing']) && !is_admin() && did_action('parse_query'))
|
94 |
continue;
|
95 |
|
96 |
+
$arr[$lang->slug] = array(
|
97 |
'id' => $lang->term_id,
|
98 |
'active' => isset($polylang->curlang->slug) && $polylang->curlang->slug == $lang->slug ? 1 : 0,
|
99 |
'native_name' => $lang->name,
|
101 |
'translated_name' => '', // does not exist in Polylang
|
102 |
'language_code' => $lang->slug,
|
103 |
'country_flag_url' => $lang->flag_url,
|
104 |
+
'url' => !empty($url) ? $url :
|
105 |
(empty($args['link_empty_to']) ? $polylang->links->get_home_url($lang) :
|
106 |
str_replace('{$lang}', $lang->slug, $args['link_empty_to']))
|
107 |
);
|
475 |
public function init() {
|
476 |
$this->wpml_config = array();
|
477 |
|
|
|
|
|
|
|
|
|
478 |
// theme
|
479 |
+
if (file_exists($file = ($template = get_template_directory()) .'/wpml-config.xml'))
|
480 |
+
$this->xml_parse(file_get_contents($file), get_template()); // FIXME fopen + fread + fclose quicker ?
|
481 |
+
|
482 |
+
// child theme
|
483 |
+
if ($template != ($stylesheet = get_stylesheet_directory()) && file_exists($file = $stylesheet.'/wpml-config.xml'))
|
484 |
+
$this->xml_parse(file_get_contents($file), get_stylesheet());
|
485 |
|
486 |
// plugins
|
487 |
// don't forget sitewide active plugins thanks to Reactorshop http://wordpress.org/support/topic/polylang-and-yoast-seo-plugin/page/2?replies=38#post-4801829
|
polylang.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Polylang
|
4 |
Plugin URI: http://polylang.wordpress.com/
|
5 |
-
Version: 1.6.
|
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.6.
|
37 |
define('PLL_MIN_WP_VERSION', '3.5');
|
38 |
|
39 |
define('POLYLANG_BASENAME', plugin_basename(__FILE__)); // plugin name as known by WP
|
@@ -52,7 +52,7 @@ if (file_exists(PLL_LOCAL_DIR . '/pll-config.php'))
|
|
52 |
include_once(PLL_LOCAL_DIR . '/pll-config.php');
|
53 |
|
54 |
// our url. Don't use WP_PLUGIN_URL http://wordpress.org/support/topic/ssl-doesnt-work-properly
|
55 |
-
define('POLYLANG_URL', plugins_url('
|
56 |
|
57 |
// default url to access user data such as custom flags
|
58 |
if (!defined('PLL_LOCAL_URL'))
|
2 |
/*
|
3 |
Plugin Name: Polylang
|
4 |
Plugin URI: http://polylang.wordpress.com/
|
5 |
+
Version: 1.6.2
|
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.6.2');
|
37 |
define('PLL_MIN_WP_VERSION', '3.5');
|
38 |
|
39 |
define('POLYLANG_BASENAME', plugin_basename(__FILE__)); // plugin name as known by WP
|
52 |
include_once(PLL_LOCAL_DIR . '/pll-config.php');
|
53 |
|
54 |
// our url. Don't use WP_PLUGIN_URL http://wordpress.org/support/topic/ssl-doesnt-work-properly
|
55 |
+
define('POLYLANG_URL', plugins_url('', __FILE__));
|
56 |
|
57 |
// default url to access user data such as custom flags
|
58 |
if (!defined('PLL_LOCAL_URL'))
|
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: 4.
|
7 |
-
Stable tag: 1.6.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Polylang adds multilingual content management support to WordPress.
|
@@ -35,7 +35,7 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
|
|
35 |
|
36 |
== Installation ==
|
37 |
|
38 |
-
1. Make sure you are using WordPress 3.
|
39 |
1. If you tried other multilingual plugins, deactivate them before activating Polylang, otherwise, you may get unexpected results !
|
40 |
1. Download the plugin
|
41 |
1. Extract all the files.
|
@@ -43,7 +43,7 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
|
|
43 |
1. Activate the plugin through the 'Plugins' menu in WordPress.
|
44 |
1. Go to the languages settings page and create the languages you need
|
45 |
1. Add the 'language switcher' widget to let your visitors switch the language.
|
46 |
-
1. Take care that your theme must come with the corresponding .mo files (Polylang downloads them for themes bundled with WordPress). If your theme is not internationalized yet, please refer to the [codex](http://codex.wordpress.org/I18n_for_WordPress_Developers#I18n_for_theme_and_plugin_developers) or ask the theme author to internationalize it.
|
47 |
|
48 |
== Frequently Asked Questions ==
|
49 |
|
@@ -63,6 +63,18 @@ See http://polylang.wordpress.com/documentation/contribute/
|
|
63 |
|
64 |
== Changelog ==
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
= 1.6.1 (2014-11-19) =
|
67 |
|
68 |
* Add Brazilian Portuguese translation contributed by [Henrique Vianna](http://henriquevianna.com/)
|
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.1
|
7 |
+
Stable tag: 1.6.2
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Polylang adds multilingual content management support to WordPress.
|
35 |
|
36 |
== Installation ==
|
37 |
|
38 |
+
1. Make sure you are using WordPress 3.5 or later and that your server is running PHP 5.2.4 or later (same requirement as WordPress itself)
|
39 |
1. If you tried other multilingual plugins, deactivate them before activating Polylang, otherwise, you may get unexpected results !
|
40 |
1. Download the plugin
|
41 |
1. Extract all the files.
|
43 |
1. Activate the plugin through the 'Plugins' menu in WordPress.
|
44 |
1. Go to the languages settings page and create the languages you need
|
45 |
1. Add the 'language switcher' widget to let your visitors switch the language.
|
46 |
+
1. Take care that your theme must come with the corresponding .mo files (Polylang downloads them for themes and plugins bundled with WordPress). If your theme is not internationalized yet, please refer to the [codex](http://codex.wordpress.org/I18n_for_WordPress_Developers#I18n_for_theme_and_plugin_developers) or ask the theme author to internationalize it.
|
47 |
|
48 |
== Frequently Asked Questions ==
|
49 |
|
63 |
|
64 |
== Changelog ==
|
65 |
|
66 |
+
= 1.6.2 (2014-12-14) =
|
67 |
+
|
68 |
+
* fix: bugs and inconsistencies compared to WPML in 'icl_get_languages' (should fix a conflict with Avada)
|
69 |
+
* fix: https issue
|
70 |
+
* fix: stop displaying an error when adding en_US as new language (translation not downloaded)
|
71 |
+
* fix: infinite redirect loop on (unattached) attachment links
|
72 |
+
* fix: impossible to add tags in post quick edit (introduced in 1.5)
|
73 |
+
* fix: the customizer does not land to the right page when cumulating: static front page + page name in url + default language code not hidden
|
74 |
+
* fix: read parent theme wpml-config.xml before child theme
|
75 |
+
* fix: add protection to avoid empty language
|
76 |
+
* fix: page preview link again
|
77 |
+
|
78 |
= 1.6.1 (2014-11-19) =
|
79 |
|
80 |
* Add Brazilian Portuguese translation contributed by [Henrique Vianna](http://henriquevianna.com/)
|