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.4.2
=
Download this release
Release Info
Developer | Chouby |
Plugin | Polylang |
Version | 1.4.2 |
Comparing to | |
See all releases |
Code changes from version 1.4.1 to 1.4.2
- admin/admin-filters-post.php +24 -8
- frontend/frontend-links.php +5 -4
- frontend/frontend-nav-menu.php +9 -6
- include/model.php +3 -1
- polylang.php +2 -2
- readme.txt +11 -3
admin/admin-filters-post.php
CHANGED
@@ -328,20 +328,23 @@ class PLL_Admin_Filters_Post {
|
|
328 |
* @return array
|
329 |
*/
|
330 |
public function get_posts_not_translated($post_type, $post_language, $translation_language) {
|
|
|
331 |
$posts = get_posts(array(
|
332 |
-
'
|
333 |
-
'
|
334 |
-
'
|
335 |
-
'
|
336 |
-
'
|
337 |
-
'
|
338 |
-
'
|
339 |
-
'
|
|
|
340 |
'taxonomy' => 'language',
|
341 |
'field' => 'term_taxonomy_id', // WP 3.5+
|
342 |
'terms' => $post_language->term_taxonomy_id
|
343 |
))
|
344 |
));
|
|
|
345 |
|
346 |
foreach ($posts as $key => $post) {
|
347 |
if ($this->model->get_translation('post', $post->ID, $translation_language))
|
@@ -351,6 +354,19 @@ class PLL_Admin_Filters_Post {
|
|
351 |
return $posts;
|
352 |
}
|
353 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
/*
|
355 |
* returns html markup for a translation link
|
356 |
*
|
328 |
* @return array
|
329 |
*/
|
330 |
public function get_posts_not_translated($post_type, $post_language, $translation_language) {
|
331 |
+
add_filter('posts_fields', array(&$this, 'get_posts_not_translated_fields'));
|
332 |
$posts = get_posts(array(
|
333 |
+
'suppress_filters' => 0, // to make the post_fields filter work
|
334 |
+
'lang' => 0, // avoid admin language filter
|
335 |
+
'numberposts' => -1,
|
336 |
+
'nopaging' => true,
|
337 |
+
'post_status' => 'any',
|
338 |
+
'post_type' => $post_type,
|
339 |
+
'orderby' => 'title',
|
340 |
+
'order' => 'ASC',
|
341 |
+
'tax_query' => array(array(
|
342 |
'taxonomy' => 'language',
|
343 |
'field' => 'term_taxonomy_id', // WP 3.5+
|
344 |
'terms' => $post_language->term_taxonomy_id
|
345 |
))
|
346 |
));
|
347 |
+
remove_filter('posts_fields', array(&$this, 'get_posts_not_translated_fields'));
|
348 |
|
349 |
foreach ($posts as $key => $post) {
|
350 |
if ($this->model->get_translation('post', $post->ID, $translation_language))
|
354 |
return $posts;
|
355 |
}
|
356 |
|
357 |
+
/*
|
358 |
+
* filters the fields returned by get_posts in get_posts_not_translated to decrease memory usage
|
359 |
+
*
|
360 |
+
* @since 1.4.2
|
361 |
+
*
|
362 |
+
* @param string $fields not used
|
363 |
+
* @return string fields to get from database
|
364 |
+
*/
|
365 |
+
public function get_posts_not_translated_fields($fields) {
|
366 |
+
global $wpdb;
|
367 |
+
return "$wpdb->posts.ID, $wpdb->posts.post_title, $wpdb->posts.post_parent";
|
368 |
+
}
|
369 |
+
|
370 |
/*
|
371 |
* returns html markup for a translation link
|
372 |
*
|
frontend/frontend-links.php
CHANGED
@@ -90,8 +90,8 @@ class PLL_Frontend_Links extends PLL_Links {
|
|
90 |
if (isset($this->links[$link]))
|
91 |
return $this->links[$link];
|
92 |
|
93 |
-
return $this->links[$link] = $tax == 'post_format' ?
|
94 |
-
|
95 |
}
|
96 |
|
97 |
/*
|
@@ -140,8 +140,9 @@ class PLL_Frontend_Links extends PLL_Links {
|
|
140 |
*/
|
141 |
public function redirect_canonical($redirect_url, $requested_url) {
|
142 |
global $wp_query;
|
143 |
-
if (is_page() && !is_feed() && isset($wp_query->queried_object) && 'page' == get_option('show_on_front') && $wp_query->queried_object->ID == get_option('page_on_front'))
|
144 |
-
return $this->
|
|
|
145 |
return $redirect_url;
|
146 |
}
|
147 |
|
90 |
if (isset($this->links[$link]))
|
91 |
return $this->links[$link];
|
92 |
|
93 |
+
return $this->links[$link] = $tax == 'post_format' ? $this->links_model->add_language_to_link($link, $this->curlang) :
|
94 |
+
($this->options['force_lang'] ? parent::term_link($link, $term, $tax) : $link);
|
95 |
}
|
96 |
|
97 |
/*
|
140 |
*/
|
141 |
public function redirect_canonical($redirect_url, $requested_url) {
|
142 |
global $wp_query;
|
143 |
+
if (is_page() && !is_feed() && isset($wp_query->queried_object) && 'page' == get_option('show_on_front') && $wp_query->queried_object->ID == get_option('page_on_front')) {
|
144 |
+
return $this->get_home_url();
|
145 |
+
}
|
146 |
return $redirect_url;
|
147 |
}
|
148 |
|
frontend/frontend-nav-menu.php
CHANGED
@@ -93,18 +93,21 @@ class PLL_Frontend_Nav_Menu {
|
|
93 |
$r_ids = $k_ids = array();
|
94 |
|
95 |
foreach ($items as $item) {
|
96 |
-
if (
|
97 |
-
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
100 |
-
elseif (is_array($item->classes) && in_array('current-menu-item', $item->classes))
|
101 |
-
$k_ids = array_merge($k_ids, $this->get_ancestors($item)); // keep the classes for these ancestors
|
102 |
}
|
103 |
|
104 |
$r_ids = array_diff($r_ids, $k_ids);
|
105 |
|
106 |
foreach ($items as $item) {
|
107 |
-
if (in_array($item->db_id, $r_ids))
|
108 |
$item->classes = array_diff($item->classes, array('current-menu-ancestor', 'current-menu-parent', 'current_page_parent', 'current_page_ancestor'));
|
109 |
}
|
110 |
|
93 |
$r_ids = $k_ids = array();
|
94 |
|
95 |
foreach ($items as $item) {
|
96 |
+
if (!empty($item->classes) && is_array($item->classes)) {
|
97 |
+
if (in_array('current-lang', $item->classes)) {
|
98 |
+
$item->classes = array_diff($item->classes, array('current-menu-item'));
|
99 |
+
$r_ids = array_merge($r_ids, $this->get_ancestors($item)); // remove the classes for these ancestors
|
100 |
+
}
|
101 |
+
elseif (in_array('current-menu-item', $item->classes)) {
|
102 |
+
$k_ids = array_merge($k_ids, $this->get_ancestors($item)); // keep the classes for these ancestors
|
103 |
+
}
|
104 |
}
|
|
|
|
|
105 |
}
|
106 |
|
107 |
$r_ids = array_diff($r_ids, $k_ids);
|
108 |
|
109 |
foreach ($items as $item) {
|
110 |
+
if (!empty($item->db_id) && in_array($item->db_id, $r_ids))
|
111 |
$item->classes = array_diff($item->classes, array('current-menu-ancestor', 'current-menu-parent', 'current_page_parent', 'current_page_ancestor'));
|
112 |
}
|
113 |
|
include/model.php
CHANGED
@@ -643,6 +643,8 @@ class PLL_Model {
|
|
643 |
global $wpdb;
|
644 |
|
645 |
$q = wp_parse_args($args, array('post_type' => 'post'));
|
|
|
|
|
646 |
|
647 |
$cache_key = md5(serialize($q));
|
648 |
$counts = wp_cache_get($cache_key, 'pll_count_posts');
|
@@ -651,7 +653,7 @@ class PLL_Model {
|
|
651 |
$select = "SELECT pll_tr.term_taxonomy_id, COUNT(*) AS num_posts FROM {$wpdb->posts} AS p";
|
652 |
$join = $this->join_clause('post');
|
653 |
$where = " WHERE post_status = 'publish'";
|
654 |
-
$where .=
|
655 |
$where .= $this->where_clause($this->get_languages_list(), 'post');
|
656 |
$groupby = " GROUP BY pll_tr.term_taxonomy_id";
|
657 |
|
643 |
global $wpdb;
|
644 |
|
645 |
$q = wp_parse_args($args, array('post_type' => 'post'));
|
646 |
+
if (!is_array($q['post_type']))
|
647 |
+
$q['post_type'] = array($q['post_type']);
|
648 |
|
649 |
$cache_key = md5(serialize($q));
|
650 |
$counts = wp_cache_get($cache_key, 'pll_count_posts');
|
653 |
$select = "SELECT pll_tr.term_taxonomy_id, COUNT(*) AS num_posts FROM {$wpdb->posts} AS p";
|
654 |
$join = $this->join_clause('post');
|
655 |
$where = " WHERE post_status = 'publish'";
|
656 |
+
$where .= " AND p.post_type IN ('" . join("', '", $q['post_type'] ) . "')";
|
657 |
$where .= $this->where_clause($this->get_languages_list(), 'post');
|
658 |
$groupby = " GROUP BY pll_tr.term_taxonomy_id";
|
659 |
|
polylang.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Polylang
|
4 |
Plugin URI: http://polylang.wordpress.com/
|
5 |
-
Version: 1.4.
|
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.4.
|
33 |
define('PLL_MIN_WP_VERSION', '3.5');
|
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.4.2
|
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.4.2');
|
33 |
define('PLL_MIN_WP_VERSION', '3.5');
|
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.5
|
6 |
Tested up to: 3.8
|
7 |
-
Stable tag: 1.4.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Polylang adds multilingual content management support to WordPress.
|
@@ -64,11 +64,19 @@ See http://polylang.wordpress.com/documentation/contribute/
|
|
64 |
|
65 |
== Upgrade Notice ==
|
66 |
|
67 |
-
= 1.4.
|
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.4.
|
69 |
|
70 |
== Changelog ==
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
= 1.4.1 (2014-02-16) =
|
73 |
|
74 |
* Add: Czech translation contributed by [Přemysl Karbula](http://www.premyslkarbula.cz)
|
4 |
Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
|
5 |
Requires at least: 3.5
|
6 |
Tested up to: 3.8
|
7 |
+
Stable tag: 1.4.2
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Polylang adds multilingual content management support to WordPress.
|
64 |
|
65 |
== Upgrade Notice ==
|
66 |
|
67 |
+
= 1.4.2 =
|
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.4.2
|
69 |
|
70 |
== Changelog ==
|
71 |
|
72 |
+
= 1.4.2 (2014-02-24) =
|
73 |
+
|
74 |
+
* Add: check multiple post types in PLL_Model::count_posts
|
75 |
+
* Fix: error 404 on category links when setting the language by content (introduced in 1.4.1)
|
76 |
+
* Fix: PHP notices in frontend-nav-menu.php with Artisteer themes
|
77 |
+
* Fix: decrease the memory usage of untranslated posts list
|
78 |
+
* Fix: home page not correctly redirected to canonical when using page on front and page name is kept in url
|
79 |
+
|
80 |
= 1.4.1 (2014-02-16) =
|
81 |
|
82 |
* Add: Czech translation contributed by [Přemysl Karbula](http://www.premyslkarbula.cz)
|