Version Description
(2015-05-11) =
- Add 'pll_languages_list' filter
- fix: warning when a plugin calls 'icl_object_id' with an untranslated post type (seen in ACF 4.4.1)
- fix: the language is not correctly set from the url when using PATHINFO permalinks (introduced in 1.6!)
- fix: notice when a search is filtered by a taxonomy term in a different language
Download this release
Release Info
Developer | Chouby |
Plugin | Polylang |
Version | 1.7.5 |
Comparing to | |
See all releases |
Code changes from version 1.7.4 to 1.7.5
- frontend/frontend-links.php +2 -1
- include/links-directory.php +3 -3
- include/model.php +14 -9
- polylang.php +2 -2
- readme.txt +8 -1
frontend/frontend-links.php
CHANGED
@@ -367,7 +367,8 @@ class PLL_Frontend_Links extends PLL_Links {
|
|
367 |
$terms = get_terms($tax->name, array('fields' => 'id=>slug')); // filtered by current language
|
368 |
|
369 |
foreach ($tax_query['terms'] as $slug) {
|
370 |
-
|
|
|
371 |
$term = get_term($term_id, $tax->name);
|
372 |
$url = str_replace($slug, $term->slug, $url);
|
373 |
}
|
367 |
$terms = get_terms($tax->name, array('fields' => 'id=>slug')); // filtered by current language
|
368 |
|
369 |
foreach ($tax_query['terms'] as $slug) {
|
370 |
+
$term_id = array_search($slug, $terms); // what is the term_id corresponding to taxonomy term?
|
371 |
+
if ($term_id && $term_id = $this->model->get_translation('term', $term_id, $language)) { // get the translated term_id
|
372 |
$term = get_term($term_id, $tax->name);
|
373 |
$url = str_replace($slug, $term->slug, $url);
|
374 |
}
|
include/links-directory.php
CHANGED
@@ -21,6 +21,9 @@ class PLL_Links_Directory extends PLL_Links_Permalinks {
|
|
21 |
public function __construct(&$model) {
|
22 |
parent::__construct($model);
|
23 |
|
|
|
|
|
|
|
24 |
add_action('pll_init', array(&$this, 'init'));
|
25 |
}
|
26 |
|
@@ -30,9 +33,6 @@ class PLL_Links_Directory extends PLL_Links_Permalinks {
|
|
30 |
* @since 1.6
|
31 |
*/
|
32 |
public function init() {
|
33 |
-
// inspired by wp-includes/rewrite.php
|
34 |
-
$this->root = preg_match('#^/*' . $this->index . '#', get_option('permalink_structure')) ? $this->index . '/' : '';
|
35 |
-
|
36 |
add_action('setup_theme', array(&$this, 'add_permastruct'), 2);
|
37 |
|
38 |
// make sure to prepare rewrite rules when flushing
|
21 |
public function __construct(&$model) {
|
22 |
parent::__construct($model);
|
23 |
|
24 |
+
// inspired by wp-includes/rewrite.php
|
25 |
+
$this->root = preg_match('#^/*' . $this->index . '#', get_option('permalink_structure')) ? $this->index . '/' : '';
|
26 |
+
|
27 |
add_action('pll_init', array(&$this, 'init'));
|
28 |
}
|
29 |
|
33 |
* @since 1.6
|
34 |
*/
|
35 |
public function init() {
|
|
|
|
|
|
|
36 |
add_action('setup_theme', array(&$this, 'add_permastruct'), 2);
|
37 |
|
38 |
// make sure to prepare rewrite rules when flushing
|
include/model.php
CHANGED
@@ -162,6 +162,8 @@ class PLL_Model {
|
|
162 |
foreach ($languages as $k => $v) {
|
163 |
$languages[$k] = new PLL_Language($v, $term_languages[$v->name]);
|
164 |
}
|
|
|
|
|
165 |
}
|
166 |
else {
|
167 |
$languages = array(); // in case something went wrong
|
@@ -398,10 +400,11 @@ class PLL_Model {
|
|
398 |
$translations = array_intersect_key($translations, array_flip($this->get_languages_list(array('fields' => 'slug'))));
|
399 |
|
400 |
// make sure to return at least the passed post or term in its translation array
|
401 |
-
if (empty($translations) && $lang = call_user_func(array(&$this, 'get_'.$type.'_language'), $id))
|
402 |
$translations = array($lang->slug => $id);
|
403 |
|
404 |
-
return $translations;
|
|
|
405 |
|
406 |
/*
|
407 |
* store the post language in the database
|
@@ -494,10 +497,8 @@ class PLL_Model {
|
|
494 |
elseif (is_string($value) && $taxonomy)
|
495 |
$term_id = get_term_by('slug', $value , $taxonomy)->term_id;
|
496 |
|
497 |
-
|
498 |
-
|
499 |
-
// switch to PLL_Language
|
500 |
-
return ($lang) ? $this->get_language($lang->term_id) : false;
|
501 |
}
|
502 |
|
503 |
/*
|
@@ -908,8 +909,12 @@ class PLL_Model {
|
|
908 |
* @return object implementing "links_model interface"
|
909 |
*/
|
910 |
public function get_links_model() {
|
911 |
-
|
912 |
-
|
913 |
-
|
|
|
|
|
|
|
|
|
914 |
}
|
915 |
}
|
162 |
foreach ($languages as $k => $v) {
|
163 |
$languages[$k] = new PLL_Language($v, $term_languages[$v->name]);
|
164 |
}
|
165 |
+
|
166 |
+
$languages = apply_filters('pll_languages_list', $languages);
|
167 |
}
|
168 |
else {
|
169 |
$languages = array(); // in case something went wrong
|
400 |
$translations = array_intersect_key($translations, array_flip($this->get_languages_list(array('fields' => 'slug'))));
|
401 |
|
402 |
// make sure to return at least the passed post or term in its translation array
|
403 |
+
if (empty($translations) && $type && $lang = call_user_func(array(&$this, 'get_'.$type.'_language'), $id))
|
404 |
$translations = array($lang->slug => $id);
|
405 |
|
406 |
+
return $translations;
|
407 |
+
}
|
408 |
|
409 |
/*
|
410 |
* store the post language in the database
|
497 |
elseif (is_string($value) && $taxonomy)
|
498 |
$term_id = get_term_by('slug', $value , $taxonomy)->term_id;
|
499 |
|
500 |
+
// get the language and make sure it is a PLL_Language object
|
501 |
+
return isset($term_id) && ($lang = $this->get_object_term($term_id, 'term_language')) ? $this->get_language($lang->term_id) : false;
|
|
|
|
|
502 |
}
|
503 |
|
504 |
/*
|
909 |
* @return object implementing "links_model interface"
|
910 |
*/
|
911 |
public function get_links_model() {
|
912 |
+
if (!$links_model = $this->cache->get('links_model')) {
|
913 |
+
$c = array('Directory', 'Directory', 'Subdomain', 'Domain');
|
914 |
+
$class = get_option('permalink_structure') ? 'PLL_Links_' .$c[$this->options['force_lang']] : 'PLL_Links_Default';
|
915 |
+
$links_model = new $class($this);
|
916 |
+
$this->cache->set('links_model', $links_model);
|
917 |
+
}
|
918 |
+
return $links_model;
|
919 |
}
|
920 |
}
|
polylang.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Polylang
|
4 |
Plugin URI: http://polylang.wordpress.com/
|
5 |
-
Version: 1.7.
|
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.7.
|
37 |
define('PLL_MIN_WP_VERSION', '3.8');
|
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.7.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.7.5');
|
37 |
define('PLL_MIN_WP_VERSION', '3.8');
|
38 |
|
39 |
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.8
|
6 |
Tested up to: 4.2
|
7 |
-
Stable tag: 1.7.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Making WordPress multilingual
|
@@ -67,6 +67,13 @@ See http://polylang.wordpress.com/documentation/contribute/
|
|
67 |
|
68 |
== Changelog ==
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
= 1.7.4 (2015-05-03) =
|
71 |
|
72 |
* fix: translated taxonomies and post types from wpml-config.xml are not filtered on frontend (introduced in 1.7.2)
|
4 |
Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.2
|
7 |
+
Stable tag: 1.7.5
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Making WordPress multilingual
|
67 |
|
68 |
== Changelog ==
|
69 |
|
70 |
+
= 1.7.5 (2015-05-11) =
|
71 |
+
|
72 |
+
* Add 'pll_languages_list' filter
|
73 |
+
* fix: warning when a plugin calls 'icl_object_id' with an untranslated post type (seen in ACF 4.4.1)
|
74 |
+
* fix: the language is not correctly set from the url when using PATHINFO permalinks (introduced in 1.6!)
|
75 |
+
* fix: notice when a search is filtered by a taxonomy term in a different language
|
76 |
+
|
77 |
= 1.7.4 (2015-05-03) =
|
78 |
|
79 |
* fix: translated taxonomies and post types from wpml-config.xml are not filtered on frontend (introduced in 1.7.2)
|