Version Description
(2016-03-02) =
- Add support for the 'wpml_get_default_language()' function from the WPML API
- Stop blocking saving settings when errors are detected (invalid domains)
- Use publicly_queryable => true instead of public => true for the language taxonomy (WP 4.5+)
- fix: PHP notice when pll_default_language() is called before a language is created
- fix: PHP notice undefined property PLL_Language::$page_on_front
- fix: canonical redirection of static front page when combining plain permalinks + default language hidden in url
- fix: YARPP compatibility broken in v1.8
- fix: Remove the delete link for translations of the default category (introduced back by WP 4.3)
- fix: settings not displayed with WP 4.1 or older
Download this release
Release Info
Developer | Chouby |
Plugin | Polylang |
Version | 1.8.2 |
Comparing to | |
See all releases |
Code changes from version 1.8.1 to 1.8.2
- admin/admin-filters-columns.php +2 -2
- admin/admin-filters-media.php +1 -1
- admin/admin-filters-term.php +2 -1
- admin/admin-strings.php +1 -1
- css/admin.css +2 -2
- frontend/frontend-static-pages.php +4 -1
- include/api.php +1 -1
- include/language.php +3 -2
- include/model.php +12 -9
- include/translated-post.php +8 -6
- include/widget-calendar.php +85 -82
- modules/plugins/plugins-compat.php +4 -5
- modules/wpml/wpml-compat.php +16 -2
- polylang.php +52 -51
- readme.txt +14 -2
- settings/settings-module.php +11 -10
- settings/settings-url.php +1 -1
- settings/settings.php +1 -1
- settings/table-languages.php +1 -1
- settings/table-settings.php +9 -0
admin/admin-filters-columns.php
CHANGED
@@ -108,7 +108,7 @@ class PLL_Admin_Filters_Columns {
|
|
108 |
* @param int $post_id
|
109 |
*/
|
110 |
public function post_column( $column, $post_id ) {
|
111 |
-
$inline = defined( 'DOING_AJAX' ) &&
|
112 |
$lang = $inline ? $this->model->get_language( $_POST['inline_lang_choice'] ) : $this->model->post->get_language( $post_id );
|
113 |
|
114 |
if ( false === strpos( $column, 'language_' ) || ! $lang ) {
|
@@ -213,7 +213,7 @@ class PLL_Admin_Filters_Columns {
|
|
213 |
* @param int term_id
|
214 |
*/
|
215 |
public function term_column( $out, $column, $term_id ) {
|
216 |
-
$inline = defined( 'DOING_AJAX' ) &&
|
217 |
if ( false === strpos( $column, 'language_' ) || ! ( $lang = $inline ? $this->model->get_language( $_POST['inline_lang_choice'] ) : $this->model->term->get_language( $term_id ) ) ) {
|
218 |
return $out;
|
219 |
}
|
108 |
* @param int $post_id
|
109 |
*/
|
110 |
public function post_column( $column, $post_id ) {
|
111 |
+
$inline = defined( 'DOING_AJAX' ) && isset( $_REQUEST['action'], $_POST['inline_lang_choice'] ) && 'inline-save' === $_REQUEST['action'];
|
112 |
$lang = $inline ? $this->model->get_language( $_POST['inline_lang_choice'] ) : $this->model->post->get_language( $post_id );
|
113 |
|
114 |
if ( false === strpos( $column, 'language_' ) || ! $lang ) {
|
213 |
* @param int term_id
|
214 |
*/
|
215 |
public function term_column( $out, $column, $term_id ) {
|
216 |
+
$inline = defined( 'DOING_AJAX' ) && isset( $_REQUEST['action'], $_POST['inline_lang_choice'] ) && 'inline-save-tax' === $_REQUEST['action'];
|
217 |
if ( false === strpos( $column, 'language_' ) || ! ( $lang = $inline ? $this->model->get_language( $_POST['inline_lang_choice'] ) : $this->model->term->get_language( $term_id ) ) ) {
|
218 |
return $out;
|
219 |
}
|
admin/admin-filters-media.php
CHANGED
@@ -26,7 +26,7 @@ class PLL_Admin_Filters_Media extends PLL_Admin_Filters_Post_Base {
|
|
26 |
add_filter( 'wp_delete_file', array( &$this, 'wp_delete_file' ) );
|
27 |
|
28 |
// creates a media translation
|
29 |
-
if ( isset( $_GET['action'], $_GET['new_lang'], $_GET['from_media'] ) && 'translate_media'
|
30 |
add_action( 'admin_init', array( &$this, 'translate_media' ) );
|
31 |
}
|
32 |
}
|
26 |
add_filter( 'wp_delete_file', array( &$this, 'wp_delete_file' ) );
|
27 |
|
28 |
// creates a media translation
|
29 |
+
if ( isset( $_GET['action'], $_GET['new_lang'], $_GET['from_media'] ) && 'translate_media' === $_GET['action'] ) {
|
30 |
add_action( 'admin_init', array( &$this, 'translate_media' ) );
|
31 |
}
|
32 |
}
|
admin/admin-filters-term.php
CHANGED
@@ -702,7 +702,8 @@ class PLL_Admin_Filters_Term {
|
|
702 |
$traces = debug_backtrace();
|
703 |
|
704 |
if ( isset( $traces[4] ) ) {
|
705 |
-
|
|
|
706 |
return $traces[4]['args'][0]->term_id;
|
707 |
}
|
708 |
|
702 |
$traces = debug_backtrace();
|
703 |
|
704 |
if ( isset( $traces[4] ) ) {
|
705 |
+
// FIXME 'column_name' for backward compatibility with WP < 4.3
|
706 |
+
if ( in_array( $traces[4]['function'], array( 'column_cb', 'column_name', 'handle_row_actions' ) ) && in_array( $traces[4]['args'][0]->term_id, $this->model->term->get_translations( $value ) ) ) {
|
707 |
return $traces[4]['args'][0]->term_id;
|
708 |
}
|
709 |
|
admin/admin-strings.php
CHANGED
@@ -122,7 +122,7 @@ class PLL_Admin_Strings {
|
|
122 |
$translation = strip_tags( $translation );
|
123 |
}
|
124 |
|
125 |
-
if ( $name == self::$default_strings['widget_text'] && !current_user_can( 'unfiltered_html' ) ) {
|
126 |
$translation = wp_unslash( wp_filter_post_kses( addslashes( $translation ) ) ); // wp_filter_post_kses() expects slashed
|
127 |
}
|
128 |
|
122 |
$translation = strip_tags( $translation );
|
123 |
}
|
124 |
|
125 |
+
if ( $name == self::$default_strings['widget_text'] && ! current_user_can( 'unfiltered_html' ) ) {
|
126 |
$translation = wp_unslash( wp_filter_post_kses( addslashes( $translation ) ) ); // wp_filter_post_kses() expects slashed
|
127 |
}
|
128 |
|
css/admin.css
CHANGED
@@ -83,8 +83,8 @@
|
|
83 |
|
84 |
.pll-configure legend {
|
85 |
font-size: 14px;
|
86 |
-
|
87 |
-
|
88 |
}
|
89 |
|
90 |
.pll-configure td .description {
|
83 |
|
84 |
.pll-configure legend {
|
85 |
font-size: 14px;
|
86 |
+
font-weight: 600;
|
87 |
+
margin-bottom: 0.5em;
|
88 |
}
|
89 |
|
90 |
.pll-configure td .description {
|
frontend/frontend-static-pages.php
CHANGED
@@ -171,7 +171,10 @@ class PLL_Frontend_Static_Pages extends PLL_Static_Pages {
|
|
171 |
* @return bool|string
|
172 |
*/
|
173 |
public function pll_check_canonical_url( $redirect_url ) {
|
174 |
-
|
|
|
|
|
|
|
175 |
}
|
176 |
|
177 |
/*
|
171 |
* @return bool|string
|
172 |
*/
|
173 |
public function pll_check_canonical_url( $redirect_url ) {
|
174 |
+
if ( isset( $this->curlang->page_on_front ) && is_page( $this->curlang->page_on_front ) ) {
|
175 |
+
return $this->options['redirect_lang'] ? false : $this->curlang->home_url;
|
176 |
+
}
|
177 |
+
return $redirect_url;
|
178 |
}
|
179 |
|
180 |
/*
|
include/api.php
CHANGED
@@ -52,7 +52,7 @@ function pll_current_language( $field = 'slug' ) {
|
|
52 |
* @return string the requested field for the default language
|
53 |
*/
|
54 |
function pll_default_language( $field = 'slug' ) {
|
55 |
-
return ( $lang = PLL()->model->get_language( PLL()->options['default_lang'] ) ) && isset( $lang->$field ) ? $lang->$field : false;
|
56 |
}
|
57 |
|
58 |
/*
|
52 |
* @return string the requested field for the default language
|
53 |
*/
|
54 |
function pll_default_language( $field = 'slug' ) {
|
55 |
+
return isset( PLL()->options['default_lang'] ) && ( $lang = PLL()->model->get_language( PLL()->options['default_lang'] ) ) && isset( $lang->$field ) ? $lang->$field : false;
|
56 |
}
|
57 |
|
58 |
/*
|
include/language.php
CHANGED
@@ -28,8 +28,8 @@
|
|
28 |
* search_url => home url to use in search forms
|
29 |
* host => host of this language
|
30 |
* mo_id => id of the post storing strings translations
|
31 |
-
* page_on_front => id of the page on front in this language ( set from
|
32 |
-
* page_for_posts => id of the page for posts in this language ( set from
|
33 |
*
|
34 |
* @since 1.2
|
35 |
*/
|
@@ -40,6 +40,7 @@ class PLL_Language {
|
|
40 |
public $flag_url, $flag;
|
41 |
public $home_url, $search_url;
|
42 |
public $host, $mo_id;
|
|
|
43 |
|
44 |
/*
|
45 |
* constructor: builds a language object given its two corresponding terms in language and term_language taxonomies
|
28 |
* search_url => home url to use in search forms
|
29 |
* host => host of this language
|
30 |
* mo_id => id of the post storing strings translations
|
31 |
+
* page_on_front => id of the page on front in this language ( set from pll_languages_list filter )
|
32 |
+
* page_for_posts => id of the page for posts in this language ( set from pll_languages_list filter )
|
33 |
*
|
34 |
* @since 1.2
|
35 |
*/
|
40 |
public $flag_url, $flag;
|
41 |
public $home_url, $search_url;
|
42 |
public $host, $mo_id;
|
43 |
+
public $page_on_front, $page_for_posts;
|
44 |
|
45 |
/*
|
46 |
* constructor: builds a language object given its two corresponding terms in language and term_language taxonomies
|
include/model.php
CHANGED
@@ -393,6 +393,8 @@ class PLL_Model {
|
|
393 |
public function count_posts( $lang, $q = array() ) {
|
394 |
global $wpdb;
|
395 |
|
|
|
|
|
396 |
if ( ! is_array( $q['post_type'] ) ) {
|
397 |
$q['post_type'] = array( $q['post_type'] );
|
398 |
}
|
@@ -416,29 +418,29 @@ class PLL_Model {
|
|
416 |
$where = " WHERE post_status = 'publish'";
|
417 |
$where .= $wpdb->prepare( " AND p.post_type IN ( '%s' )", join( "', '", $q['post_type'] ) );
|
418 |
$where .= $this->post->where_clause( $this->get_languages_list() );
|
419 |
-
$groupby =
|
420 |
|
421 |
if ( ! empty( $q['m'] ) ) {
|
422 |
$q['m'] = '' . preg_replace( '|[^0-9]|', '', $q['m'] );
|
423 |
-
$where .= $wpdb->prepare(
|
424 |
if ( strlen( $q['m'] ) > 5 ) {
|
425 |
-
$where .= $wpdb->prepare(
|
426 |
}
|
427 |
if ( strlen( $q['m'] ) > 7 ) {
|
428 |
-
$where .= $wpdb->prepare(
|
429 |
}
|
430 |
}
|
431 |
|
432 |
if ( ! empty( $q['year'] ) ) {
|
433 |
-
$where .= $wpdb->prepare(
|
434 |
}
|
435 |
|
436 |
if ( ! empty( $q['monthnum'] ) ) {
|
437 |
-
$where .= $wpdb->prepare(
|
438 |
}
|
439 |
|
440 |
if ( ! empty( $q['day'] ) ) {
|
441 |
-
$where .= $wpdb->prepare(
|
442 |
}
|
443 |
|
444 |
if ( ! empty( $q['author_name'] ) ) {
|
@@ -449,16 +451,17 @@ class PLL_Model {
|
|
449 |
}
|
450 |
|
451 |
if ( ! empty( $q['author'] ) ) {
|
452 |
-
$where .= $wpdb->prepare(
|
453 |
}
|
454 |
|
455 |
// filtered taxonomies ( post_format )
|
456 |
foreach ( $this->get_filtered_taxonomies_query_vars() as $tax_qv ) {
|
|
|
457 |
if ( ! empty( $q[ $tax_qv ] ) ) {
|
458 |
$join .= " INNER JOIN {$wpdb->term_relationships} AS tr ON tr.object_id = p.ID";
|
459 |
$join .= " INNER JOIN {$wpdb->term_taxonomy} AS tt ON tt.term_taxonomy_id = tr.term_taxonomy_id";
|
460 |
$join .= " INNER JOIN {$wpdb->terms} AS t ON t.term_id = tt.term_id";
|
461 |
-
$where .= $wpdb->prepare(
|
462 |
}
|
463 |
}
|
464 |
|
393 |
public function count_posts( $lang, $q = array() ) {
|
394 |
global $wpdb;
|
395 |
|
396 |
+
$q = wp_parse_args( $q, array( 'post_type' => 'post' ) );
|
397 |
+
|
398 |
if ( ! is_array( $q['post_type'] ) ) {
|
399 |
$q['post_type'] = array( $q['post_type'] );
|
400 |
}
|
418 |
$where = " WHERE post_status = 'publish'";
|
419 |
$where .= $wpdb->prepare( " AND p.post_type IN ( '%s' )", join( "', '", $q['post_type'] ) );
|
420 |
$where .= $this->post->where_clause( $this->get_languages_list() );
|
421 |
+
$groupby = ' GROUP BY pll_tr.term_taxonomy_id';
|
422 |
|
423 |
if ( ! empty( $q['m'] ) ) {
|
424 |
$q['m'] = '' . preg_replace( '|[^0-9]|', '', $q['m'] );
|
425 |
+
$where .= $wpdb->prepare( ' AND YEAR( p.post_date ) = %d', substr( $q['m'], 0, 4 ) );
|
426 |
if ( strlen( $q['m'] ) > 5 ) {
|
427 |
+
$where .= $wpdb->prepare( ' AND MONTH( p.post_date ) = %d', substr( $q['m'], 4, 2 ) );
|
428 |
}
|
429 |
if ( strlen( $q['m'] ) > 7 ) {
|
430 |
+
$where .= $wpdb->prepare( ' AND DAYOFMONTH( p.post_date ) = %d', substr( $q['m'], 6, 2 ) );
|
431 |
}
|
432 |
}
|
433 |
|
434 |
if ( ! empty( $q['year'] ) ) {
|
435 |
+
$where .= $wpdb->prepare( ' AND YEAR( p.post_date ) = %d', $q['year'] );
|
436 |
}
|
437 |
|
438 |
if ( ! empty( $q['monthnum'] ) ) {
|
439 |
+
$where .= $wpdb->prepare( ' AND MONTH( p.post_date ) = %d', $q['monthnum'] );
|
440 |
}
|
441 |
|
442 |
if ( ! empty( $q['day'] ) ) {
|
443 |
+
$where .= $wpdb->prepare( ' AND DAYOFMONTH( p.post_date ) = %d', $q['day'] );
|
444 |
}
|
445 |
|
446 |
if ( ! empty( $q['author_name'] ) ) {
|
451 |
}
|
452 |
|
453 |
if ( ! empty( $q['author'] ) ) {
|
454 |
+
$where .= $wpdb->prepare( ' AND p.post_author = %d', $q['author'] );
|
455 |
}
|
456 |
|
457 |
// filtered taxonomies ( post_format )
|
458 |
foreach ( $this->get_filtered_taxonomies_query_vars() as $tax_qv ) {
|
459 |
+
|
460 |
if ( ! empty( $q[ $tax_qv ] ) ) {
|
461 |
$join .= " INNER JOIN {$wpdb->term_relationships} AS tr ON tr.object_id = p.ID";
|
462 |
$join .= " INNER JOIN {$wpdb->term_taxonomy} AS tt ON tt.term_taxonomy_id = tr.term_taxonomy_id";
|
463 |
$join .= " INNER JOIN {$wpdb->terms} AS t ON t.term_id = tt.term_id";
|
464 |
+
$where .= $wpdb->prepare( ' AND t.slug = %s', $q[ $tax_qv ] );
|
465 |
}
|
466 |
}
|
467 |
|
include/translated-post.php
CHANGED
@@ -87,12 +87,14 @@ class PLL_Translated_Post extends PLL_Translated_Object {
|
|
87 |
'singular_name' => __( 'Language', 'polylang' ),
|
88 |
'all_items' => __( 'All languages', 'polylang' ),
|
89 |
),
|
90 |
-
|
91 |
-
'
|
92 |
-
'
|
93 |
-
'
|
94 |
-
'
|
95 |
-
'
|
|
|
|
|
96 |
) );
|
97 |
}
|
98 |
|
87 |
'singular_name' => __( 'Language', 'polylang' ),
|
88 |
'all_items' => __( 'All languages', 'polylang' ),
|
89 |
),
|
90 |
+
// FIXME backward compatibility with WP 4.4.x: we must keep public to true for WP to accept our query var
|
91 |
+
'public' => version_compare( $GLOBALS['wp_version'], '4.4', '>=' ) && version_compare( $GLOBALS['wp_version'], '4.5', '<' ),
|
92 |
+
'show_ui' => false, // hide the taxonomy on admin side, needed for WP 4.4.x
|
93 |
+
'show_in_nav_menus' => false, // no metabox for nav menus, needed for WP 4.4.x
|
94 |
+
'publicly_queryable' => true, // since WP 4.5
|
95 |
+
'query_var' => 'lang',
|
96 |
+
'rewrite' => $this->model->options['force_lang'] < 2, // no rewrite for domains and sub-domains
|
97 |
+
'_pll' => true, // polylang taxonomy
|
98 |
) );
|
99 |
}
|
100 |
|
include/widget-calendar.php
CHANGED
@@ -6,7 +6,7 @@ if ( ! class_exists( 'WP_Widget_Calendar' ) ) {
|
|
6 |
|
7 |
/*
|
8 |
* obliged to rewrite the whole functionnality as there is no filter on sql queries and only a filter on final output
|
9 |
-
* code base last checked with WP 4.2
|
10 |
* a request for making a filter on sql queries exists: http://core.trac.wordpress.org/ticket/15202
|
11 |
* method used in 0.4.x: use of the get_calendar filter and overwrite the output of get_calendar function -> not very efficient (add 4 to 5 sql queries)
|
12 |
* method used since 0.5: remove the WP widget and replace it by our own -> our language filter will not work if get_calendar is called directly by a theme
|
@@ -52,56 +52,61 @@ class PLL_Widget_Calendar extends WP_Widget_Calendar {
|
|
52 |
$where_clause = PLL()->model->post->where_clause( PLL()->curlang ); #added#
|
53 |
|
54 |
$key = md5( PLL()->curlang->slug . $m . $monthnum . $year ); #modified#
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
}
|
65 |
}
|
|
|
|
|
66 |
}
|
67 |
|
68 |
-
if ( !is_array( $cache ) )
|
69 |
$cache = array();
|
|
|
70 |
|
71 |
// Quick check. If we have no posts at all, abort!
|
72 |
-
if (
|
73 |
-
$gotsome = $wpdb->get_var(
|
74 |
-
if (
|
75 |
$cache[ $key ] = '';
|
76 |
wp_cache_set( 'get_calendar', $cache, 'calendar' );
|
77 |
return;
|
78 |
}
|
79 |
}
|
80 |
|
81 |
-
if ( isset( $_GET['w'] ) )
|
82 |
-
$w =
|
83 |
-
|
84 |
// week_begins = 0 stands for Sunday
|
85 |
-
$week_begins =
|
|
|
86 |
|
87 |
// Let's figure out when we are
|
88 |
-
if ( !empty( $monthnum ) && !empty( $year ) ) {
|
89 |
-
$thismonth =
|
90 |
-
$thisyear =
|
91 |
-
} elseif ( !empty( $w ) ) {
|
92 |
// We need to get the month from MySQL
|
93 |
-
$thisyear =
|
94 |
-
|
95 |
-
$
|
96 |
-
|
97 |
-
|
98 |
-
|
|
|
99 |
$thismonth = '01';
|
100 |
-
else
|
101 |
-
$thismonth =
|
|
|
102 |
} else {
|
103 |
-
$thisyear = gmdate( 'Y',
|
104 |
-
$thismonth = gmdate( 'm',
|
105 |
}
|
106 |
|
107 |
$unixmonth = mktime( 0, 0 , 0, $thismonth, 1, $thisyear );
|
@@ -124,18 +129,22 @@ class PLL_Widget_Calendar extends WP_Widget_Calendar {
|
|
124 |
/* translators: Calendar caption: 1: month name, 2: 4-digit year */
|
125 |
$calendar_caption = _x( '%1$s %2$s', 'calendar caption' );
|
126 |
$calendar_output = '<table id="wp-calendar">
|
127 |
-
<caption>' . sprintf(
|
|
|
|
|
|
|
|
|
128 |
<thead>
|
129 |
<tr>';
|
130 |
|
131 |
$myweek = array();
|
132 |
|
133 |
-
for ( $wdcount=0; $wdcount<=6; $wdcount++ ) {
|
134 |
-
$myweek[] = $wp_locale->get_weekday( ( $wdcount
|
135 |
}
|
136 |
|
137 |
foreach ( $myweek as $wd ) {
|
138 |
-
$day_name =
|
139 |
$wd = esc_attr( $wd );
|
140 |
$calendar_output .= "\n\t\t<th scope=\"col\" title=\"$wd\">$day_name</th>";
|
141 |
}
|
@@ -148,7 +157,9 @@ class PLL_Widget_Calendar extends WP_Widget_Calendar {
|
|
148 |
<tr>';
|
149 |
|
150 |
if ( $previous ) {
|
151 |
-
$calendar_output .= "\n\t\t".'<td colspan="3" id="prev"><a href="' . get_month_link( $previous->year, $previous->month ) . '">« ' .
|
|
|
|
|
152 |
} else {
|
153 |
$calendar_output .= "\n\t\t".'<td colspan="3" id="prev" class="pad"> </td>';
|
154 |
}
|
@@ -156,7 +167,9 @@ class PLL_Widget_Calendar extends WP_Widget_Calendar {
|
|
156 |
$calendar_output .= "\n\t\t".'<td class="pad"> </td>';
|
157 |
|
158 |
if ( $next ) {
|
159 |
-
$calendar_output .= "\n\t\t".'<td colspan="3" id="next"><a href="' . get_month_link( $next->year, $next->month ) . '">' .
|
|
|
|
|
160 |
} else {
|
161 |
$calendar_output .= "\n\t\t".'<td colspan="3" id="next" class="pad"> </td>';
|
162 |
}
|
@@ -182,63 +195,53 @@ class PLL_Widget_Calendar extends WP_Widget_Calendar {
|
|
182 |
}
|
183 |
}
|
184 |
|
185 |
-
if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false || stripos( $_SERVER['HTTP_USER_AGENT'], 'camino' ) !== false || stripos( $_SERVER['HTTP_USER_AGENT'], 'safari' ) !== false )
|
186 |
-
$ak_title_separator = "\n";
|
187 |
-
else
|
188 |
-
$ak_title_separator = ', ';
|
189 |
-
|
190 |
-
$ak_titles_for_day = array();
|
191 |
-
$ak_post_titles = $wpdb->get_results( "SELECT ID, post_title, DAYOFMONTH( post_date ) as dom "
|
192 |
-
."FROM $wpdb->posts $join_clause "
|
193 |
-
."WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' "
|
194 |
-
."AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59' "
|
195 |
-
."AND post_type = 'post' AND post_status = 'publish' $where_clause"
|
196 |
-
); #modified#
|
197 |
-
if ( $ak_post_titles ) {
|
198 |
-
foreach ( (array) $ak_post_titles as $ak_post_title ) {
|
199 |
-
|
200 |
-
/** This filter is documented in wp-includes/post-template.php */
|
201 |
-
$post_title = esc_attr( apply_filters( 'the_title', $ak_post_title->post_title, $ak_post_title->ID ) );
|
202 |
-
|
203 |
-
if ( empty( $ak_titles_for_day['day_'.$ak_post_title->dom] ) )
|
204 |
-
$ak_titles_for_day['day_'.$ak_post_title->dom] = '';
|
205 |
-
if ( empty( $ak_titles_for_day["$ak_post_title->dom"] ) ) // first one
|
206 |
-
$ak_titles_for_day["$ak_post_title->dom"] = $post_title;
|
207 |
-
else
|
208 |
-
$ak_titles_for_day["$ak_post_title->dom"] .= $ak_title_separator . $post_title;
|
209 |
-
}
|
210 |
-
}
|
211 |
-
|
212 |
// See how much we should pad in the beginning
|
213 |
-
$pad = calendar_week_mod( date( 'w', $unixmonth )
|
214 |
-
if ( 0 != $pad )
|
215 |
$calendar_output .= "\n\t\t".'<td colspan="'. esc_attr( $pad ) .'" class="pad"> </td>';
|
|
|
|
|
|
|
|
|
216 |
|
217 |
-
$daysinmonth = intval( date( 't', $unixmonth ) );
|
218 |
for ( $day = 1; $day <= $daysinmonth; ++$day ) {
|
219 |
-
if ( isset(
|
220 |
$calendar_output .= "\n\t</tr>\n\t<tr>\n\t\t";
|
|
|
221 |
$newrow = false;
|
222 |
|
223 |
-
if ( $day == gmdate( 'j',
|
|
|
|
|
224 |
$calendar_output .= '<td id="today">';
|
225 |
-
else
|
226 |
$calendar_output .= '<td>';
|
|
|
227 |
|
228 |
-
if ( in_array( $day, $daywithpost ) )
|
229 |
-
|
230 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
$calendar_output .= $day;
|
|
|
232 |
$calendar_output .= '</td>';
|
233 |
|
234 |
-
if ( 6 == calendar_week_mod( date( 'w', mktime(
|
235 |
$newrow = true;
|
|
|
236 |
}
|
237 |
|
238 |
-
$pad = 7 - calendar_week_mod( date( 'w', mktime( 0, 0 , 0, $thismonth, $day, $thisyear ) )
|
239 |
-
if ( $pad != 0 && $pad != 7 )
|
240 |
$calendar_output .= "\n\t\t".'<td class="pad" colspan="'. esc_attr( $pad ) .'"> </td>';
|
241 |
-
|
242 |
$calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>";
|
243 |
|
244 |
$cache[ $key ] = $calendar_output;
|
@@ -253,9 +256,9 @@ class PLL_Widget_Calendar extends WP_Widget_Calendar {
|
|
253 |
* @param string $calendar_output HTML output of the calendar.
|
254 |
*/
|
255 |
echo apply_filters( 'get_calendar', $calendar_output );
|
256 |
-
|
257 |
-
/** This filter is documented in wp-includes/general-template.php */
|
258 |
-
return apply_filters( 'get_calendar', $calendar_output );
|
259 |
}
|
|
|
|
|
260 |
}
|
261 |
}
|
6 |
|
7 |
/*
|
8 |
* obliged to rewrite the whole functionnality as there is no filter on sql queries and only a filter on final output
|
9 |
+
* code base last checked with WP 4.4.2
|
10 |
* a request for making a filter on sql queries exists: http://core.trac.wordpress.org/ticket/15202
|
11 |
* method used in 0.4.x: use of the get_calendar filter and overwrite the output of get_calendar function -> not very efficient (add 4 to 5 sql queries)
|
12 |
* method used since 0.5: remove the WP widget and replace it by our own -> our language filter will not work if get_calendar is called directly by a theme
|
52 |
$where_clause = PLL()->model->post->where_clause( PLL()->curlang ); #added#
|
53 |
|
54 |
$key = md5( PLL()->curlang->slug . $m . $monthnum . $year ); #modified#
|
55 |
+
$cache = wp_cache_get( 'get_calendar', 'calendar' );
|
56 |
+
|
57 |
+
if ( $cache && is_array( $cache ) && isset( $cache[ $key ] ) ) {
|
58 |
+
/** This filter is documented in wp-includes/general-template.php */
|
59 |
+
$output = apply_filters( 'get_calendar', $cache[ $key ] );
|
60 |
+
|
61 |
+
if ( $echo ) {
|
62 |
+
echo $output;
|
63 |
+
return;
|
|
|
64 |
}
|
65 |
+
|
66 |
+
return $output;
|
67 |
}
|
68 |
|
69 |
+
if ( ! is_array( $cache ) ) {
|
70 |
$cache = array();
|
71 |
+
}
|
72 |
|
73 |
// Quick check. If we have no posts at all, abort!
|
74 |
+
if ( ! $posts ) {
|
75 |
+
$gotsome = $wpdb->get_var("SELECT 1 as test FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1");
|
76 |
+
if ( ! $gotsome ) {
|
77 |
$cache[ $key ] = '';
|
78 |
wp_cache_set( 'get_calendar', $cache, 'calendar' );
|
79 |
return;
|
80 |
}
|
81 |
}
|
82 |
|
83 |
+
if ( isset( $_GET['w'] ) ) {
|
84 |
+
$w = (int) $_GET['w'];
|
85 |
+
}
|
86 |
// week_begins = 0 stands for Sunday
|
87 |
+
$week_begins = (int) get_option( 'start_of_week' );
|
88 |
+
$ts = current_time( 'timestamp' );
|
89 |
|
90 |
// Let's figure out when we are
|
91 |
+
if ( ! empty( $monthnum ) && ! empty( $year ) ) {
|
92 |
+
$thismonth = zeroise( intval( $monthnum ), 2 );
|
93 |
+
$thisyear = (int) $year;
|
94 |
+
} elseif ( ! empty( $w ) ) {
|
95 |
// We need to get the month from MySQL
|
96 |
+
$thisyear = (int) substr( $m, 0, 4 );
|
97 |
+
//it seems MySQL's weeks disagree with PHP's
|
98 |
+
$d = ( ( $w - 1 ) * 7 ) + 6;
|
99 |
+
$thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')");
|
100 |
+
} elseif ( ! empty( $m ) ) {
|
101 |
+
$thisyear = (int) substr( $m, 0, 4 );
|
102 |
+
if ( strlen( $m ) < 6 ) {
|
103 |
$thismonth = '01';
|
104 |
+
} else {
|
105 |
+
$thismonth = zeroise( (int) substr( $m, 4, 2 ), 2 );
|
106 |
+
}
|
107 |
} else {
|
108 |
+
$thisyear = gmdate( 'Y', $ts );
|
109 |
+
$thismonth = gmdate( 'm', $ts );
|
110 |
}
|
111 |
|
112 |
$unixmonth = mktime( 0, 0 , 0, $thismonth, 1, $thisyear );
|
129 |
/* translators: Calendar caption: 1: month name, 2: 4-digit year */
|
130 |
$calendar_caption = _x( '%1$s %2$s', 'calendar caption' );
|
131 |
$calendar_output = '<table id="wp-calendar">
|
132 |
+
<caption>' . sprintf(
|
133 |
+
$calendar_caption,
|
134 |
+
$wp_locale->get_month( $thismonth ),
|
135 |
+
date( 'Y', $unixmonth )
|
136 |
+
) . '</caption>
|
137 |
<thead>
|
138 |
<tr>';
|
139 |
|
140 |
$myweek = array();
|
141 |
|
142 |
+
for ( $wdcount = 0; $wdcount <= 6; $wdcount++ ) {
|
143 |
+
$myweek[] = $wp_locale->get_weekday( ( $wdcount + $week_begins ) % 7 );
|
144 |
}
|
145 |
|
146 |
foreach ( $myweek as $wd ) {
|
147 |
+
$day_name = $initial ? $wp_locale->get_weekday_initial( $wd ) : $wp_locale->get_weekday_abbrev( $wd );
|
148 |
$wd = esc_attr( $wd );
|
149 |
$calendar_output .= "\n\t\t<th scope=\"col\" title=\"$wd\">$day_name</th>";
|
150 |
}
|
157 |
<tr>';
|
158 |
|
159 |
if ( $previous ) {
|
160 |
+
$calendar_output .= "\n\t\t".'<td colspan="3" id="prev"><a href="' . get_month_link( $previous->year, $previous->month ) . '">« ' .
|
161 |
+
$wp_locale->get_month_abbrev( $wp_locale->get_month( $previous->month ) ) .
|
162 |
+
'</a></td>';
|
163 |
} else {
|
164 |
$calendar_output .= "\n\t\t".'<td colspan="3" id="prev" class="pad"> </td>';
|
165 |
}
|
167 |
$calendar_output .= "\n\t\t".'<td class="pad"> </td>';
|
168 |
|
169 |
if ( $next ) {
|
170 |
+
$calendar_output .= "\n\t\t".'<td colspan="3" id="next"><a href="' . get_month_link( $next->year, $next->month ) . '">' .
|
171 |
+
$wp_locale->get_month_abbrev( $wp_locale->get_month( $next->month ) ) .
|
172 |
+
' »</a></td>';
|
173 |
} else {
|
174 |
$calendar_output .= "\n\t\t".'<td colspan="3" id="next" class="pad"> </td>';
|
175 |
}
|
195 |
}
|
196 |
}
|
197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
// See how much we should pad in the beginning
|
199 |
+
$pad = calendar_week_mod( date( 'w', $unixmonth ) - $week_begins );
|
200 |
+
if ( 0 != $pad ) {
|
201 |
$calendar_output .= "\n\t\t".'<td colspan="'. esc_attr( $pad ) .'" class="pad"> </td>';
|
202 |
+
}
|
203 |
+
|
204 |
+
$newrow = false;
|
205 |
+
$daysinmonth = (int) date( 't', $unixmonth );
|
206 |
|
|
|
207 |
for ( $day = 1; $day <= $daysinmonth; ++$day ) {
|
208 |
+
if ( isset($newrow) && $newrow ) {
|
209 |
$calendar_output .= "\n\t</tr>\n\t<tr>\n\t\t";
|
210 |
+
}
|
211 |
$newrow = false;
|
212 |
|
213 |
+
if ( $day == gmdate( 'j', $ts ) &&
|
214 |
+
$thismonth == gmdate( 'm', $ts ) &&
|
215 |
+
$thisyear == gmdate( 'Y', $ts ) ) {
|
216 |
$calendar_output .= '<td id="today">';
|
217 |
+
} else {
|
218 |
$calendar_output .= '<td>';
|
219 |
+
}
|
220 |
|
221 |
+
if ( in_array( $day, $daywithpost ) ) {
|
222 |
+
// any posts today?
|
223 |
+
$date_format = date( _x( 'F j, Y', 'daily archives date format' ), strtotime( "{$thisyear}-{$thismonth}-{$day}" ) );
|
224 |
+
$label = sprintf( __( 'Posts published on %s' ), $date_format );
|
225 |
+
$calendar_output .= sprintf(
|
226 |
+
'<a href="%s" aria-label="%s">%s</a>',
|
227 |
+
get_day_link( $thisyear, $thismonth, $day ),
|
228 |
+
esc_attr( $label ),
|
229 |
+
$day
|
230 |
+
);
|
231 |
+
} else {
|
232 |
$calendar_output .= $day;
|
233 |
+
}
|
234 |
$calendar_output .= '</td>';
|
235 |
|
236 |
+
if ( 6 == calendar_week_mod( date( 'w', mktime(0, 0 , 0, $thismonth, $day, $thisyear ) ) - $week_begins ) ) {
|
237 |
$newrow = true;
|
238 |
+
}
|
239 |
}
|
240 |
|
241 |
+
$pad = 7 - calendar_week_mod( date( 'w', mktime( 0, 0 , 0, $thismonth, $day, $thisyear ) ) - $week_begins );
|
242 |
+
if ( $pad != 0 && $pad != 7 ) {
|
243 |
$calendar_output .= "\n\t\t".'<td class="pad" colspan="'. esc_attr( $pad ) .'"> </td>';
|
244 |
+
}
|
245 |
$calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>";
|
246 |
|
247 |
$cache[ $key ] = $calendar_output;
|
256 |
* @param string $calendar_output HTML output of the calendar.
|
257 |
*/
|
258 |
echo apply_filters( 'get_calendar', $calendar_output );
|
259 |
+
return;
|
|
|
|
|
260 |
}
|
261 |
+
/** This filter is documented in wp-includes/general-template.php */
|
262 |
+
return apply_filters( 'get_calendar', $calendar_output );
|
263 |
}
|
264 |
}
|
modules/plugins/plugins-compat.php
CHANGED
@@ -20,7 +20,7 @@ class PLL_Plugins_Compat {
|
|
20 |
add_filter( 'wp_import_terms', array( &$this, 'wp_import_terms' ) );
|
21 |
|
22 |
// YARPP
|
23 |
-
add_action( '
|
24 |
|
25 |
// Yoast SEO
|
26 |
add_action( 'pll_language_defined', array( &$this, 'wpseo_init' ) );
|
@@ -47,7 +47,7 @@ class PLL_Plugins_Compat {
|
|
47 |
add_filter( 'jetpack_relatedposts_filter_filters', array( &$this, 'jetpack_relatedposts_filter_filters' ), 10, 2 );
|
48 |
|
49 |
// Jetpack infinite scroll
|
50 |
-
if ( !defined( 'PLL_AJAX_ON_FRONT' ) && isset( $_GET['infinity'], $_POST['action'] ) && 'infinite_scroll' == $_POST['action'] ) {
|
51 |
define( 'PLL_AJAX_ON_FRONT', true );
|
52 |
}
|
53 |
}
|
@@ -146,8 +146,7 @@ class PLL_Plugins_Compat {
|
|
146 |
if ( did_action( 'wp_loaded' ) ) {
|
147 |
if ( version_compare( WPSEO_VERSION, '1.7.2', '<' ) ) {
|
148 |
global $wpseo_front;
|
149 |
-
}
|
150 |
-
else {
|
151 |
$wpseo_front = WPSEO_Frontend::get_instance();
|
152 |
}
|
153 |
|
@@ -465,7 +464,7 @@ class PLL_Plugins_Compat {
|
|
465 |
*/
|
466 |
function jetpack_relatedposts_filter_filters( $filters, $post_id ) {
|
467 |
$slug = sanitize_title( pll_get_post_language( $post_id, 'name' ) );
|
468 |
-
$filters[] = array( 'term' => array('taxonomy.language.slug' => $slug ) );
|
469 |
return $filters;
|
470 |
}
|
471 |
|
20 |
add_filter( 'wp_import_terms', array( &$this, 'wp_import_terms' ) );
|
21 |
|
22 |
// YARPP
|
23 |
+
add_action( 'init', array( &$this, 'yarpp_init' ) ); // after Polylang has registered its taxonomy in setup_theme
|
24 |
|
25 |
// Yoast SEO
|
26 |
add_action( 'pll_language_defined', array( &$this, 'wpseo_init' ) );
|
47 |
add_filter( 'jetpack_relatedposts_filter_filters', array( &$this, 'jetpack_relatedposts_filter_filters' ), 10, 2 );
|
48 |
|
49 |
// Jetpack infinite scroll
|
50 |
+
if ( ! defined( 'PLL_AJAX_ON_FRONT' ) && isset( $_GET['infinity'], $_POST['action'] ) && 'infinite_scroll' == $_POST['action'] ) {
|
51 |
define( 'PLL_AJAX_ON_FRONT', true );
|
52 |
}
|
53 |
}
|
146 |
if ( did_action( 'wp_loaded' ) ) {
|
147 |
if ( version_compare( WPSEO_VERSION, '1.7.2', '<' ) ) {
|
148 |
global $wpseo_front;
|
149 |
+
} else {
|
|
|
150 |
$wpseo_front = WPSEO_Frontend::get_instance();
|
151 |
}
|
152 |
|
464 |
*/
|
465 |
function jetpack_relatedposts_filter_filters( $filters, $post_id ) {
|
466 |
$slug = sanitize_title( pll_get_post_language( $post_id, 'name' ) );
|
467 |
+
$filters[] = array( 'term' => array( 'taxonomy.language.slug' => $slug ) );
|
468 |
return $filters;
|
469 |
}
|
470 |
|
modules/wpml/wpml-compat.php
CHANGED
@@ -180,7 +180,7 @@ if ( ! function_exists( 'icl_link_to_element' ) ) {
|
|
180 |
*/
|
181 |
if ( ! function_exists( 'icl_object_id' ) ) {
|
182 |
function icl_object_id( $id, $type, $return_original_if_missing = false, $lang = false ) {
|
183 |
-
$pll_type = (
|
184 |
return $pll_type && ( $lang = $lang ? $lang : pll_current_language() ) && ( $tr_id = PLL()->model->$pll_type->get_translation( $id, $lang ) ) ? $tr_id :
|
185 |
( $return_original_if_missing ? $id : null );
|
186 |
}
|
@@ -208,7 +208,7 @@ if ( ! function_exists( 'wpml_get_language_information' ) ) {
|
|
208 |
'text_direction' => $lang->is_rtl,
|
209 |
'display_name' => $lang->name, // seems to be the post language name displayed in the current language, not a feature in Polylang
|
210 |
'native_name' => $lang->name,
|
211 |
-
'different_language' => $lang->slug != pll_current_language()
|
212 |
);
|
213 |
}
|
214 |
}
|
@@ -321,6 +321,20 @@ if ( ! function_exists( 'icl_get_default_language' ) ) {
|
|
321 |
}
|
322 |
}
|
323 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
/*
|
325 |
* registers strings in a persistent way as done by WPML
|
326 |
*
|
180 |
*/
|
181 |
if ( ! function_exists( 'icl_object_id' ) ) {
|
182 |
function icl_object_id( $id, $type, $return_original_if_missing = false, $lang = false ) {
|
183 |
+
$pll_type = ( 'post' === $type || pll_is_translated_post_type( $type ) ) ? 'post' : ( 'term' === $type || pll_is_translated_taxonomy( $type ) ? 'term' : false );
|
184 |
return $pll_type && ( $lang = $lang ? $lang : pll_current_language() ) && ( $tr_id = PLL()->model->$pll_type->get_translation( $id, $lang ) ) ? $tr_id :
|
185 |
( $return_original_if_missing ? $id : null );
|
186 |
}
|
208 |
'text_direction' => $lang->is_rtl,
|
209 |
'display_name' => $lang->name, // seems to be the post language name displayed in the current language, not a feature in Polylang
|
210 |
'native_name' => $lang->name,
|
211 |
+
'different_language' => $lang->slug != pll_current_language(),
|
212 |
);
|
213 |
}
|
214 |
}
|
321 |
}
|
322 |
}
|
323 |
|
324 |
+
/*
|
325 |
+
* undocumented function reported to be used by Table Rate Shipping for WooCommerce
|
326 |
+
* @see https://wordpress.org/support/topic/add-wpml-compatibility-function
|
327 |
+
*
|
328 |
+
* @since 1.8.2
|
329 |
+
*
|
330 |
+
* @return string default language code
|
331 |
+
*/
|
332 |
+
if ( ! function_exists( 'wpml_get_default_language' ) ) {
|
333 |
+
function wpml_get_default_language() {
|
334 |
+
return pll_default_language();
|
335 |
+
}
|
336 |
+
}
|
337 |
+
|
338 |
/*
|
339 |
* registers strings in a persistent way as done by WPML
|
340 |
*
|
polylang.php
CHANGED
@@ -1,51 +1,52 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
Plugin
|
5 |
-
|
6 |
-
|
7 |
-
Author
|
8 |
-
|
9 |
-
|
10 |
-
Domain
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
*
|
16 |
-
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
-
*
|
23 |
-
*
|
24 |
-
*
|
25 |
-
*
|
26 |
-
*
|
27 |
-
*
|
28 |
-
*
|
29 |
-
*
|
30 |
-
*
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
define( '
|
39 |
-
|
40 |
-
|
41 |
-
define( '
|
42 |
-
define( '
|
43 |
-
|
44 |
-
|
45 |
-
define( '
|
46 |
-
define( '
|
47 |
-
define( '
|
48 |
-
define( '
|
49 |
-
define( '
|
50 |
-
|
51 |
-
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Plugin Name: Polylang
|
5 |
+
Plugin URI: http://polylang.wordpress.com/
|
6 |
+
Version: 1.8.2
|
7 |
+
Author: Frédéric Demarle
|
8 |
+
Author uri: http://polylang.wordpress.com
|
9 |
+
Description: Adds multilingual capability to WordPress
|
10 |
+
Text Domain: polylang
|
11 |
+
Domain Path: /languages
|
12 |
+
*/
|
13 |
+
|
14 |
+
/*
|
15 |
+
* Copyright 2011-2016 Frédéric Demarle
|
16 |
+
*
|
17 |
+
* This program is free software; you can redistribute it and/or modify
|
18 |
+
* it under the terms of the GNU General Public License as published by
|
19 |
+
* the Free Software Foundation; either version 2 of the License, or
|
20 |
+
* ( at your option ) any later version.
|
21 |
+
*
|
22 |
+
* This program is distributed in the hope that it will be useful,
|
23 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
24 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
25 |
+
* GNU General Public License for more details.
|
26 |
+
*
|
27 |
+
* You should have received a copy of the GNU General Public License
|
28 |
+
* along with this program; if not, write to the Free Software
|
29 |
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
30 |
+
* MA 02110-1301, USA.
|
31 |
+
*
|
32 |
+
*/
|
33 |
+
|
34 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
35 |
+
exit; // don't access directly
|
36 |
+
};
|
37 |
+
|
38 |
+
define( 'POLYLANG_VERSION', '1.8.2' );
|
39 |
+
define( 'PLL_MIN_WP_VERSION', '4.0' );
|
40 |
+
|
41 |
+
define( 'POLYLANG_FILE', __FILE__ ); // this file
|
42 |
+
define( 'POLYLANG_BASENAME', plugin_basename( POLYLANG_FILE ) ); // plugin name as known by WP
|
43 |
+
define( 'POLYLANG_DIR', dirname( POLYLANG_FILE ) ); // our directory
|
44 |
+
|
45 |
+
define( 'PLL_ADMIN_INC', POLYLANG_DIR . '/admin' );
|
46 |
+
define( 'PLL_FRONT_INC', POLYLANG_DIR . '/frontend' );
|
47 |
+
define( 'PLL_INC', POLYLANG_DIR . '/include' );
|
48 |
+
define( 'PLL_INSTALL_INC', POLYLANG_DIR . '/install' );
|
49 |
+
define( 'PLL_MODULES_INC', POLYLANG_DIR . '/modules' );
|
50 |
+
define( 'PLL_SETTINGS_INC', POLYLANG_DIR . '/settings' );
|
51 |
+
|
52 |
+
require_once( PLL_INC . '/class-polylang.php' );
|
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: 4.0
|
6 |
Tested up to: 4.4
|
7 |
-
Stable tag: 1.8.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Making WordPress multilingual
|
@@ -71,6 +71,18 @@ See http://polylang.wordpress.com/documentation/contribute/
|
|
71 |
|
72 |
== Changelog ==
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
= 1.8.1 (2016-01-31) =
|
75 |
|
76 |
* Update the list of Facebook locales used for Opengraph support with Yoast SEO and Jetpack
|
@@ -90,7 +102,7 @@ See http://polylang.wordpress.com/documentation/contribute/
|
|
90 |
* The Polylang and WPML API are now loaded when 'plugins_loaded' is fired (on frontend only if at least one language has been defined)
|
91 |
* Add 'pll_get_post_translations()' and 'pll_get_term_translations()' to the API
|
92 |
* Add filter 'pll_cookie_expiration' to change the cookie expiration time
|
93 |
-
* Add support for 'wpml_get_language_information' function from the WPML API
|
94 |
* The default language is now managed directly from the languages list table
|
95 |
* Various accessibility improvements
|
96 |
* It is now possible to choose the languages flags from the available list (custom flags on frontend still work as previously)
|
4 |
Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.4
|
7 |
+
Stable tag: 1.8.2
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Making WordPress multilingual
|
71 |
|
72 |
== Changelog ==
|
73 |
|
74 |
+
= 1.8.2 (2016-03-02) =
|
75 |
+
|
76 |
+
* Add support for the 'wpml_get_default_language()' function from the WPML API
|
77 |
+
* Stop blocking saving settings when errors are detected (invalid domains)
|
78 |
+
* Use publicly_queryable => true instead of public => true for the language taxonomy (WP 4.5+)
|
79 |
+
* fix: PHP notice when pll_default_language() is called before a language is created
|
80 |
+
* fix: PHP notice undefined property PLL_Language::$page_on_front
|
81 |
+
* fix: canonical redirection of static front page when combining plain permalinks + default language hidden in url
|
82 |
+
* fix: YARPP compatibility broken in v1.8
|
83 |
+
* fix: Remove the delete link for translations of the default category (introduced back by WP 4.3)
|
84 |
+
* fix: settings not displayed with WP 4.1 or older
|
85 |
+
|
86 |
= 1.8.1 (2016-01-31) =
|
87 |
|
88 |
* Update the list of Facebook locales used for Opengraph support with Yoast SEO and Jetpack
|
102 |
* The Polylang and WPML API are now loaded when 'plugins_loaded' is fired (on frontend only if at least one language has been defined)
|
103 |
* Add 'pll_get_post_translations()' and 'pll_get_term_translations()' to the API
|
104 |
* Add filter 'pll_cookie_expiration' to change the cookie expiration time
|
105 |
+
* Add support for 'wpml_get_language_information()' function from the WPML API
|
106 |
* The default language is now managed directly from the languages list table
|
107 |
* Various accessibility improvements
|
108 |
* It is now possible to choose the languages flags from the available list (custom flags on frontend still work as previously)
|
settings/settings-module.php
CHANGED
@@ -156,21 +156,22 @@ class PLL_Settings_Module {
|
|
156 |
|
157 |
if ( $this->module == $_POST['module'] ) {
|
158 |
unset( $_POST['action'], $_POST['module'], $_POST['pll_ajax_backend'], $_POST['_pll_nonce'] );
|
|
|
|
|
159 |
$options = $this->update( $_POST );
|
|
|
|
|
160 |
|
161 |
-
|
|
|
162 |
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
|
167 |
-
|
168 |
-
$this->model->clean_languages_cache();
|
169 |
-
|
170 |
-
// refresh rewrite rules in case rewrite, hide_default, post types or taxonomies options have been modified
|
171 |
-
// don't use flush_rewrite_rules as we don't have the right links model and permastruct
|
172 |
-
delete_option( 'rewrite_rules' );
|
173 |
|
|
|
174 |
// send update message
|
175 |
add_settings_error( 'general', 'settings_updated', __( 'Settings saved.' ), 'updated' );
|
176 |
settings_errors();
|
156 |
|
157 |
if ( $this->module == $_POST['module'] ) {
|
158 |
unset( $_POST['action'], $_POST['module'], $_POST['pll_ajax_backend'], $_POST['_pll_nonce'] );
|
159 |
+
|
160 |
+
// it's up to the child class to decide which options are saved, whether there are errors or not
|
161 |
$options = $this->update( $_POST );
|
162 |
+
$this->options = array_merge( $this->options, $options );
|
163 |
+
update_option( 'polylang', $this->options );
|
164 |
|
165 |
+
// refresh language cache in case home urls have been modified
|
166 |
+
$this->model->clean_languages_cache();
|
167 |
|
168 |
+
// refresh rewrite rules in case rewrite, hide_default, post types or taxonomies options have been modified
|
169 |
+
// don't use flush_rewrite_rules as we don't have the right links model and permastruct
|
170 |
+
delete_option( 'rewrite_rules' );
|
171 |
|
172 |
+
ob_start();
|
|
|
|
|
|
|
|
|
|
|
173 |
|
174 |
+
if ( ! get_settings_errors() ) {
|
175 |
// send update message
|
176 |
add_settings_error( 'general', 'settings_updated', __( 'Settings saved.' ), 'updated' );
|
177 |
settings_errors();
|
settings/settings-url.php
CHANGED
@@ -185,7 +185,7 @@ class PLL_Settings_Url extends PLL_Settings_Module {
|
|
185 |
*/
|
186 |
protected function update( $options ) {
|
187 |
foreach ( array( 'force_lang', 'rewrite' ) as $key ) {
|
188 |
-
$newoptions[ $key ] = isset( $options[ $key] ) ? (int) $options[ $key ] : 0;
|
189 |
}
|
190 |
|
191 |
if ( 3 == $options['force_lang'] && isset( $options['domains'] ) && is_array( $options['domains'] ) ) {
|
185 |
*/
|
186 |
protected function update( $options ) {
|
187 |
foreach ( array( 'force_lang', 'rewrite' ) as $key ) {
|
188 |
+
$newoptions[ $key ] = isset( $options[ $key ] ) ? (int) $options[ $key ] : 0;
|
189 |
}
|
190 |
|
191 |
if ( 3 == $options['force_lang'] && isset( $options['domains'] ) && is_array( $options['domains'] ) ) {
|
settings/settings.php
CHANGED
@@ -317,7 +317,7 @@ class PLL_Settings extends PLL_Admin_Base {
|
|
317 |
}
|
318 |
|
319 |
// unregisters strings registered through WPML API
|
320 |
-
if ( $string_table->current_action() == 'delete' && !empty( $_POST['strings'] ) && function_exists( 'icl_unregister_string' ) ) {
|
321 |
check_admin_referer( 'string-translation', '_wpnonce_string-translation' );
|
322 |
$strings = PLL_Admin_Strings::get_strings();
|
323 |
|
317 |
}
|
318 |
|
319 |
// unregisters strings registered through WPML API
|
320 |
+
if ( $string_table->current_action() == 'delete' && ! empty( $_POST['strings'] ) && function_exists( 'icl_unregister_string' ) ) {
|
321 |
check_admin_referer( 'string-translation', '_wpnonce_string-translation' );
|
322 |
$strings = PLL_Admin_Strings::get_strings();
|
323 |
|
settings/table-languages.php
CHANGED
@@ -184,7 +184,7 @@ class PLL_Table_Languages extends WP_List_Table {
|
|
184 |
$actions = apply_filters( 'pll_languages_row_actions', $actions, $item ); // allow plugins to modify the list of actions
|
185 |
|
186 |
return $this->row_actions( $actions );
|
187 |
-
|
188 |
|
189 |
/*
|
190 |
* Sort items
|
184 |
$actions = apply_filters( 'pll_languages_row_actions', $actions, $item ); // allow plugins to modify the list of actions
|
185 |
|
186 |
return $this->row_actions( $actions );
|
187 |
+
}
|
188 |
|
189 |
/*
|
190 |
* Sort items
|
settings/table-settings.php
CHANGED
@@ -100,6 +100,15 @@ class PLL_Table_Settings extends WP_List_Table {
|
|
100 |
}
|
101 |
}
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
/*
|
104 |
* displays the item information in a column ( default case )
|
105 |
*
|
100 |
}
|
101 |
}
|
102 |
|
103 |
+
/**
|
104 |
+
* added for backward compatibility with WP < 4.2
|
105 |
+
*
|
106 |
+
* @since 1.8.2
|
107 |
+
*
|
108 |
+
* @param object $item
|
109 |
+
*/
|
110 |
+
protected function column_cb( $item ) {}
|
111 |
+
|
112 |
/*
|
113 |
* displays the item information in a column ( default case )
|
114 |
*
|