Polylang - Version 2.2.5

Version Description

(2017-11-09) =

  • Update plugin updater class to 1.6.15
  • Add $link in cache key of links filters
  • Add support for 'nav_menu' post type in wpml_object_id
  • Fix conflict with Timber (introduced in 2.2.4)
Download this release

Release Info

Developer Chouby
Plugin Icon 128x128 Polylang
Version 2.2.5
Comparing to
See all releases

Code changes from version 2.2.4 to 2.2.5

admin/admin-base.php CHANGED
@@ -66,7 +66,7 @@ class PLL_Admin_Base extends PLL_Base {
66
  */
67
  public function add_menus() {
68
  // Prepare the list of tabs
69
- $tabs = array( 'lang' => __( 'Languages','polylang' ) );
70
 
71
  // Only if at least one language has been created
72
  if ( $this->model->get_languages_list() ) {
@@ -88,10 +88,10 @@ class PLL_Admin_Base extends PLL_Base {
88
  $page = 'lang' === $tab ? 'mlang' : "mlang_$tab";
89
  if ( empty( $parent ) ) {
90
  $parent = $page;
91
- add_menu_page( $title, __( 'Languages','polylang' ), 'manage_options', $page, null , 'dashicons-translation' );
92
  }
93
 
94
- add_submenu_page( $parent, $title, $title, 'manage_options', $page , array( $this, 'languages_page' ) );
95
  }
96
  }
97
 
66
  */
67
  public function add_menus() {
68
  // Prepare the list of tabs
69
+ $tabs = array( 'lang' => __( 'Languages', 'polylang' ) );
70
 
71
  // Only if at least one language has been created
72
  if ( $this->model->get_languages_list() ) {
88
  $page = 'lang' === $tab ? 'mlang' : "mlang_$tab";
89
  if ( empty( $parent ) ) {
90
  $parent = $page;
91
+ add_menu_page( $title, __( 'Languages', 'polylang' ), 'manage_options', $page, null, 'dashicons-translation' );
92
  }
93
 
94
+ add_submenu_page( $parent, $title, $title, 'manage_options', $page, array( $this, 'languages_page' ) );
95
  }
96
  }
97
 
admin/admin-filters-media.php CHANGED
@@ -89,7 +89,7 @@ class PLL_Admin_Filters_Media extends PLL_Admin_Filters_Post_Base {
89
 
90
  // Copy metadata, attached file and alternative text
91
  foreach ( array( '_wp_attachment_metadata', '_wp_attached_file', '_wp_attachment_image_alt' ) as $key ) {
92
- if ( $meta = get_post_meta( $post_id, $key , true ) ) {
93
  add_post_meta( $tr_id, $key, $meta );
94
  }
95
  }
@@ -180,7 +180,7 @@ class PLL_Admin_Filters_Media extends PLL_Admin_Filters_Post_Base {
180
 
181
  $ids = $wpdb->get_col( $wpdb->prepare( "
182
  SELECT post_id FROM $wpdb->postmeta
183
- WHERE meta_key = '_wp_attached_file' AND meta_value = '%s'",
184
  substr_replace( $file, '', 0, strlen( trailingslashit( $uploadpath['basedir'] ) ) )
185
  ) );
186
 
89
 
90
  // Copy metadata, attached file and alternative text
91
  foreach ( array( '_wp_attachment_metadata', '_wp_attached_file', '_wp_attachment_image_alt' ) as $key ) {
92
+ if ( $meta = get_post_meta( $post_id, $key, true ) ) {
93
  add_post_meta( $tr_id, $key, $meta );
94
  }
95
  }
180
 
181
  $ids = $wpdb->get_col( $wpdb->prepare( "
182
  SELECT post_id FROM $wpdb->postmeta
183
+ WHERE meta_key = '_wp_attached_file' AND meta_value = %s",
184
  substr_replace( $file, '', 0, strlen( trailingslashit( $uploadpath['basedir'] ) ) )
185
  ) );
186
 
admin/admin-filters-post.php CHANGED
@@ -122,7 +122,7 @@ class PLL_Admin_Filters_Post extends PLL_Admin_Filters_Post_Base {
122
  */
123
  public function add_meta_boxes( $post_type, $post ) {
124
  if ( $this->model->is_translated_post_type( $post_type ) ) {
125
- add_meta_box( 'ml_box', __( 'Languages','polylang' ), array( $this, 'post_language' ), $post_type, 'side', 'high' );
126
  }
127
  }
128
 
122
  */
123
  public function add_meta_boxes( $post_type, $post ) {
124
  if ( $this->model->is_translated_post_type( $post_type ) ) {
125
+ add_meta_box( 'ml_box', __( 'Languages', 'polylang' ), array( $this, 'post_language' ), $post_type, 'side', 'high' );
126
  }
127
  }
128
 
admin/admin-filters-term.php CHANGED
@@ -142,7 +142,7 @@ class PLL_Admin_Filters_Term {
142
  <p class="description">%s</p>
143
  </td>
144
  </tr>',
145
- wp_nonce_field( 'pll_language', '_pll_nonce', true , false ),
146
  esc_html__( 'Language', 'polylang' ),
147
  $dropdown->walk( $this->model->get_languages_list(), array(
148
  'name' => 'term_lang_choice',
142
  <p class="description">%s</p>
143
  </td>
144
  </tr>',
145
+ wp_nonce_field( 'pll_language', '_pll_nonce', true, false ),
146
  esc_html__( 'Language', 'polylang' ),
147
  $dropdown->walk( $this->model->get_languages_list(), array(
148
  'name' => 'term_lang_choice',
admin/admin-model.php CHANGED
@@ -283,7 +283,7 @@ class PLL_Admin_Model extends PLL_Model {
283
  // Validate name
284
  // No need to sanitize it as wp_insert_term will do it for us
285
  if ( empty( $args['name'] ) ) {
286
- add_settings_error( 'general', 'pll_invalid_name', __( 'The language must have a name', 'polylang' ) );
287
  }
288
 
289
  // Validate flag
@@ -350,8 +350,8 @@ class PLL_Admin_Model extends PLL_Model {
350
 
351
  foreach ( $translations as $t ) {
352
  $term = uniqid( 'pll_' ); // the term name
353
- $terms[] = $wpdb->prepare( '( "%s", "%s" )', $term, $term );
354
- $slugs[] = $wpdb->prepare( '"%s"', $term );
355
  $description[ $term ] = serialize( $t );
356
  $count[ $term ] = count( $t );
357
  }
@@ -368,7 +368,7 @@ class PLL_Admin_Model extends PLL_Model {
368
  // Prepare terms taxonomy relationship
369
  foreach ( $terms as $term ) {
370
  $term_ids[] = $term->term_id;
371
- $tts[] = $wpdb->prepare( '( %d, "%s", "%s", %d )', $term->term_id, $taxonomy, $description[ $term->slug ], $count[ $term->slug ] );
372
  }
373
 
374
  // Insert term_taxonomy
283
  // Validate name
284
  // No need to sanitize it as wp_insert_term will do it for us
285
  if ( empty( $args['name'] ) ) {
286
+ add_settings_error( 'general', 'pll_invalid_name', __( 'The language must have a name', 'polylang' ) );
287
  }
288
 
289
  // Validate flag
350
 
351
  foreach ( $translations as $t ) {
352
  $term = uniqid( 'pll_' ); // the term name
353
+ $terms[] = $wpdb->prepare( '( %s, %s )', $term, $term );
354
+ $slugs[] = $wpdb->prepare( '%s', $term );
355
  $description[ $term ] = serialize( $t );
356
  $count[ $term ] = count( $t );
357
  }
368
  // Prepare terms taxonomy relationship
369
  foreach ( $terms as $term ) {
370
  $term_ids[] = $term->term_id;
371
+ $tts[] = $wpdb->prepare( '( %d, %s, %s, %d )', $term->term_id, $taxonomy, $description[ $term->slug ], $count[ $term->slug ] );
372
  }
373
 
374
  // Insert term_taxonomy
admin/admin-nav-menu.php CHANGED
@@ -249,7 +249,7 @@ class PLL_Admin_Nav_Menu extends PLL_Nav_Menu {
249
  $locations = get_registered_nav_menus();
250
  if ( is_array( $locations ) ) {
251
  $locations = array_fill_keys( array_keys( $locations ), 0 );
252
- $menus = is_array( $menus ) ? array_merge( $locations , $menus ) : $locations;
253
  }
254
 
255
  if ( is_array( $menus ) ) {
249
  $locations = get_registered_nav_menus();
250
  if ( is_array( $locations ) ) {
251
  $locations = array_fill_keys( array_keys( $locations ), 0 );
252
+ $menus = is_array( $menus ) ? array_merge( $locations, $menus ) : $locations;
253
  }
254
 
255
  if ( is_array( $menus ) ) {
frontend/choose-lang-content.php CHANGED
@@ -51,7 +51,7 @@ class PLL_Choose_Lang_Content extends PLL_Choose_lang {
51
  }
52
 
53
  if ( $var = get_query_var( 'lang' ) ) {
54
- $lang = explode( ',',$var );
55
  $lang = $this->model->get_language( reset( $lang ) ); // choose the first queried language
56
  }
57
 
51
  }
52
 
53
  if ( $var = get_query_var( 'lang' ) ) {
54
+ $lang = explode( ',', $var );
55
  $lang = $this->model->get_language( reset( $lang ) ); // choose the first queried language
56
  }
57
 
frontend/choose-lang.php CHANGED
@@ -147,7 +147,7 @@ abstract class PLL_Choose_Lang {
147
  }
148
  }
149
  }
150
- $accept_langs = array_combine( $k,$v );
151
  }
152
  }
153
 
147
  }
148
  }
149
  }
150
+ $accept_langs = array_combine( $k, $v );
151
  }
152
  }
153
 
frontend/frontend-auto-translate.php CHANGED
@@ -157,7 +157,7 @@ class PLL_Frontend_Auto_Translate {
157
  if ( empty( $qv['post_type'] ) ) {
158
  $post_types = array( 'post' );
159
  } elseif ( 'any' === $qv['post_type'] ) {
160
- $post_types = get_post_types( array('exclude_from_search' => false) ); // May return a empty array
161
  } else {
162
  $post_types = (array) $qv['post_type'];
163
  }
157
  if ( empty( $qv['post_type'] ) ) {
158
  $post_types = array( 'post' );
159
  } elseif ( 'any' === $qv['post_type'] ) {
160
+ $post_types = get_post_types( array( 'exclude_from_search' => false ) ); // May return a empty array
161
  } else {
162
  $post_types = (array) $qv['post_type'];
163
  }
frontend/frontend-filters-links.php CHANGED
@@ -72,8 +72,7 @@ class PLL_Frontend_Filters_Links extends PLL_Filters_Links {
72
  * @return string modified post link
73
  */
74
  public function _get_page_link( $link, $post_id ) {
75
- $sample = false !== strpos( $link, '%pagename%' ); // To avoid a conflict with plugin Custom Permalinks
76
- $cache_key = "post:{$post_id}:{$sample}";
77
  if ( false === $_link = $this->cache->get( $cache_key ) ) {
78
  $_link = parent::_get_page_link( $link, $post_id );
79
  $this->cache->set( $cache_key, $_link );
@@ -92,7 +91,7 @@ class PLL_Frontend_Filters_Links extends PLL_Filters_Links {
92
  * @return string modified attachment link
93
  */
94
  public function attachment_link( $link, $post_id ) {
95
- $cache_key = 'post:' . $post_id;
96
  if ( false === $_link = $this->cache->get( $cache_key ) ) {
97
  $_link = parent::attachment_link( $link, $post_id );
98
  $this->cache->set( $cache_key, $_link );
@@ -111,8 +110,7 @@ class PLL_Frontend_Filters_Links extends PLL_Filters_Links {
111
  * @return string modified post link
112
  */
113
  public function post_type_link( $link, $post ) {
114
- $sample = false !== strpos( $link, '%postname%' ); // To avoid a conflict with plugin Custom Permalinks
115
- $cache_key = "post:{$post->ID}:{$sample}";
116
  if ( false === $_link = $this->cache->get( $cache_key ) ) {
117
  $_link = parent::post_type_link( $link, $post );
118
  $this->cache->set( $cache_key, $_link );
@@ -132,7 +130,7 @@ class PLL_Frontend_Filters_Links extends PLL_Filters_Links {
132
  * @return string modified link
133
  */
134
  public function term_link( $link, $term, $tax ) {
135
- $cache_key = 'term:' . $term->term_id;
136
  if ( false === $_link = $this->cache->get( $cache_key ) ) {
137
  if ( in_array( $tax, $this->model->get_filtered_taxonomies() ) ) {
138
  $_link = $this->links_model->switch_language_in_link( $link, $this->curlang );
@@ -215,7 +213,7 @@ class PLL_Frontend_Filters_Links extends PLL_Filters_Links {
215
  * @return string
216
  */
217
  public function home_url( $url, $path ) {
218
- if ( ! ( did_action( 'template_redirect' ) || did_action( 'login_init' ) ) || rtrim( $url,'/' ) != $this->links_model->home ) {
219
  return $url;
220
  }
221
 
@@ -238,7 +236,7 @@ class PLL_Frontend_Filters_Links extends PLL_Filters_Links {
238
  *
239
  * @param array $args
240
  */
241
- $white_list = apply_filters( 'pll_home_url_white_list', array(
242
  array( 'file' => $theme_root ),
243
  array( 'function' => 'wp_nav_menu' ),
244
  array( 'function' => 'login_footer' ),
@@ -259,7 +257,7 @@ class PLL_Frontend_Filters_Links extends PLL_Filters_Links {
259
  *
260
  * @param array $args
261
  */
262
- $black_list = apply_filters( 'pll_home_url_black_list', array(
263
  array( 'file' => 'searchform.php' ), // Since WP 3.6 searchform.php is passed through get_search_form
264
  array( 'function' => 'get_search_form' ),
265
  ) );
@@ -330,7 +328,7 @@ class PLL_Frontend_Filters_Links extends PLL_Filters_Links {
330
  }
331
 
332
  if ( empty( $requested_url ) ) {
333
- $requested_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
334
  }
335
 
336
  if ( is_single() || is_page() ) {
72
  * @return string modified post link
73
  */
74
  public function _get_page_link( $link, $post_id ) {
75
+ $cache_key = "post:{$post_id}:{$link}";
 
76
  if ( false === $_link = $this->cache->get( $cache_key ) ) {
77
  $_link = parent::_get_page_link( $link, $post_id );
78
  $this->cache->set( $cache_key, $_link );
91
  * @return string modified attachment link
92
  */
93
  public function attachment_link( $link, $post_id ) {
94
+ $cache_key = "post:{$post_id}:{$link}";
95
  if ( false === $_link = $this->cache->get( $cache_key ) ) {
96
  $_link = parent::attachment_link( $link, $post_id );
97
  $this->cache->set( $cache_key, $_link );
110
  * @return string modified post link
111
  */
112
  public function post_type_link( $link, $post ) {
113
+ $cache_key = "post:{$post->ID}:{$link}";
 
114
  if ( false === $_link = $this->cache->get( $cache_key ) ) {
115
  $_link = parent::post_type_link( $link, $post );
116
  $this->cache->set( $cache_key, $_link );
130
  * @return string modified link
131
  */
132
  public function term_link( $link, $term, $tax ) {
133
+ $cache_key = "term:{$term->term_id}:{$link}";
134
  if ( false === $_link = $this->cache->get( $cache_key ) ) {
135
  if ( in_array( $tax, $this->model->get_filtered_taxonomies() ) ) {
136
  $_link = $this->links_model->switch_language_in_link( $link, $this->curlang );
213
  * @return string
214
  */
215
  public function home_url( $url, $path ) {
216
+ if ( ! ( did_action( 'template_redirect' ) || did_action( 'login_init' ) ) || rtrim( $url, '/' ) != $this->links_model->home ) {
217
  return $url;
218
  }
219
 
236
  *
237
  * @param array $args
238
  */
239
+ $white_list = apply_filters( 'pll_home_url_white_list', array(
240
  array( 'file' => $theme_root ),
241
  array( 'function' => 'wp_nav_menu' ),
242
  array( 'function' => 'login_footer' ),
257
  *
258
  * @param array $args
259
  */
260
+ $black_list = apply_filters( 'pll_home_url_black_list', array(
261
  array( 'file' => 'searchform.php' ), // Since WP 3.6 searchform.php is passed through get_search_form
262
  array( 'function' => 'get_search_form' ),
263
  ) );
328
  }
329
 
330
  if ( empty( $requested_url ) ) {
331
+ $requested_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
332
  }
333
 
334
  if ( is_single() || is_page() ) {
frontend/frontend-links.php CHANGED
@@ -114,7 +114,7 @@ class PLL_Frontend_Links extends PLL_Links {
114
  * @param string $lang The language code of the translation
115
  * @param array $args Arguments used to evaluated the number of posts in the archive
116
  */
117
- if ( ! apply_filters( 'pll_hide_archive_translation_url', ! $count , $language->slug, array( 'taxonomy' => $term->taxonomy ) ) ) {
118
  $url = wpcom_vip_get_term_link( $tr_term, $term->taxonomy );
119
  }
120
  }
@@ -128,7 +128,7 @@ class PLL_Frontend_Links extends PLL_Links {
128
  $count = $this->model->count_posts( $language, $args );
129
 
130
  /** This filter is documented in frontend/frontend-links.php */
131
- if ( ! apply_filters( 'pll_hide_archive_translation_url', ! $count , $language->slug, $args ) ) {
132
  $url = $this->get_archive_url( $language );
133
  }
134
  }
@@ -142,7 +142,7 @@ class PLL_Frontend_Links extends PLL_Links {
142
  $count = $this->model->count_posts( $language, $args );
143
 
144
  /** This filter is documented in frontend/frontend-links.php */
145
- if ( ! apply_filters( 'pll_hide_archive_translation_url', ! $count , $language->slug, $args ) ) {
146
  $url = $this->get_archive_url( $language );
147
  }
148
  }
114
  * @param string $lang The language code of the translation
115
  * @param array $args Arguments used to evaluated the number of posts in the archive
116
  */
117
+ if ( ! apply_filters( 'pll_hide_archive_translation_url', ! $count, $language->slug, array( 'taxonomy' => $term->taxonomy ) ) ) {
118
  $url = wpcom_vip_get_term_link( $tr_term, $term->taxonomy );
119
  }
120
  }
128
  $count = $this->model->count_posts( $language, $args );
129
 
130
  /** This filter is documented in frontend/frontend-links.php */
131
+ if ( ! apply_filters( 'pll_hide_archive_translation_url', ! $count, $language->slug, $args ) ) {
132
  $url = $this->get_archive_url( $language );
133
  }
134
  }
142
  $count = $this->model->count_posts( $language, $args );
143
 
144
  /** This filter is documented in frontend/frontend-links.php */
145
+ if ( ! apply_filters( 'pll_hide_archive_translation_url', ! $count, $language->slug, $args ) ) {
146
  $url = $this->get_archive_url( $language );
147
  }
148
  }
frontend/frontend.php CHANGED
@@ -124,7 +124,7 @@ class PLL_Frontend extends PLL_Base {
124
  // modifies query vars when the language is queried
125
  if ( ! empty( $qv['lang'] ) || ( ! empty( $taxonomies ) && array( 'language' ) == array_values( $taxonomies ) ) ) {
126
  // do we query a custom taxonomy?
127
- $taxonomies = array_diff( $taxonomies , array( 'language', 'category', 'post_tag' ) );
128
 
129
  // remove pages query when the language is set unless we do a search
130
  // take care not to break the single page, attachment and taxonomies queries!
@@ -139,7 +139,7 @@ class PLL_Frontend extends PLL_Base {
139
  }
140
 
141
  // unset the is_tax flag except if another custom tax is queried
142
- if ( empty( $taxonomies ) && ($query->is_category || $query->is_tag || $query->is_author || $query->is_post_type_archive || $query->is_date || $query->is_search || $query->is_feed ) ) {
143
  $query->is_tax = false;
144
  unset( $query->queried_object ); // FIXME useless?
145
  }
124
  // modifies query vars when the language is queried
125
  if ( ! empty( $qv['lang'] ) || ( ! empty( $taxonomies ) && array( 'language' ) == array_values( $taxonomies ) ) ) {
126
  // do we query a custom taxonomy?
127
+ $taxonomies = array_diff( $taxonomies, array( 'language', 'category', 'post_tag' ) );
128
 
129
  // remove pages query when the language is set unless we do a search
130
  // take care not to break the single page, attachment and taxonomies queries!
139
  }
140
 
141
  // unset the is_tax flag except if another custom tax is queried
142
+ if ( empty( $taxonomies ) && ( $query->is_category || $query->is_tag || $query->is_author || $query->is_post_type_archive || $query->is_date || $query->is_search || $query->is_feed ) ) {
143
  $query->is_tax = false;
144
  unset( $query->queried_object ); // FIXME useless?
145
  }
include/links-directory.php CHANGED
@@ -82,7 +82,7 @@ class PLL_Links_Directory extends PLL_Links_Permalinks {
82
  if ( ! empty( $languages ) ) {
83
  $pattern = str_replace( '/', '\/', $this->home . '/' . $this->root );
84
  $pattern = '#' . $pattern . ( $this->options['rewrite'] ? '' : 'language\/' ) . '(' . implode( '|', $languages ) . ')(\/|$)#';
85
- $url = preg_replace( $pattern, $this->home . '/' . $this->root, $url );
86
  }
87
  return $url;
88
  }
82
  if ( ! empty( $languages ) ) {
83
  $pattern = str_replace( '/', '\/', $this->home . '/' . $this->root );
84
  $pattern = '#' . $pattern . ( $this->options['rewrite'] ? '' : 'language\/' ) . '(' . implode( '|', $languages ) . ')(\/|$)#';
85
+ $url = preg_replace( $pattern, $this->home . '/' . $this->root, $url );
86
  }
87
  return $url;
88
  }
include/links-domain.php CHANGED
@@ -21,8 +21,8 @@ class PLL_Links_Domain extends PLL_Links_Abstract_Domain {
21
 
22
  $this->hosts = $this->get_hosts();
23
 
24
- // Filrer the site url ( mainly to get the correct login form )
25
- add_filter( 'site_url', array( $this, 'site_url' ) );
26
  }
27
 
28
 
@@ -71,7 +71,7 @@ class PLL_Links_Domain extends PLL_Links_Abstract_Domain {
71
  */
72
  public function get_language_from_url( $url = '' ) {
73
  $host = empty( $url ) ? $_SERVER['HTTP_HOST'] : parse_url( $url, PHP_URL_HOST );
74
- return ( $lang = array_search( $host , $this->hosts ) ) ? $lang : '';
75
  }
76
 
77
  /**
21
 
22
  $this->hosts = $this->get_hosts();
23
 
24
+ // Filter the site url ( mainly to get the correct login form )
25
+ add_filter( 'site_url', array( $this, 'site_url' ) );
26
  }
27
 
28
 
71
  */
72
  public function get_language_from_url( $url = '' ) {
73
  $host = empty( $url ) ? $_SERVER['HTTP_HOST'] : parse_url( $url, PHP_URL_HOST );
74
+ return ( $lang = array_search( $host, $this->hosts ) ) ? $lang : '';
75
  }
76
 
77
  /**
include/model.php CHANGED
@@ -208,7 +208,7 @@ class PLL_Model {
208
  }
209
 
210
  if ( ! empty( $this->options['post_types'] ) && is_array( $this->options['post_types'] ) ) {
211
- $post_types = array_merge( $post_types, array_combine( $this->options['post_types'], $this->options['post_types'] ) );
212
  }
213
 
214
  /**
@@ -459,7 +459,7 @@ class PLL_Model {
459
  $select = "SELECT pll_tr.term_taxonomy_id, COUNT( * ) AS num_posts FROM {$wpdb->posts}";
460
  $join = $this->post->join_clause();
461
  $where = " WHERE post_status = 'publish'";
462
- $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_type IN ( '%s' )", join( "', '", $q['post_type'] ) );
463
  $where .= $this->post->where_clause( $this->get_languages_list() );
464
  $groupby = ' GROUP BY pll_tr.term_taxonomy_id';
465
 
@@ -487,7 +487,7 @@ class PLL_Model {
487
  }
488
 
489
  if ( ! empty( $q['author_name'] ) ) {
490
- $author = get_user_by( 'slug', sanitize_title_for_query( $q['author_name'] ) );
491
  if ( $author ) {
492
  $q['author'] = $author->ID;
493
  }
208
  }
209
 
210
  if ( ! empty( $this->options['post_types'] ) && is_array( $this->options['post_types'] ) ) {
211
+ $post_types = array_merge( $post_types, array_combine( $this->options['post_types'], $this->options['post_types'] ) );
212
  }
213
 
214
  /**
459
  $select = "SELECT pll_tr.term_taxonomy_id, COUNT( * ) AS num_posts FROM {$wpdb->posts}";
460
  $join = $this->post->join_clause();
461
  $where = " WHERE post_status = 'publish'";
462
+ $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_type IN ( %s )", join( "', '", $q['post_type'] ) );
463
  $where .= $this->post->where_clause( $this->get_languages_list() );
464
  $groupby = ' GROUP BY pll_tr.term_taxonomy_id';
465
 
487
  }
488
 
489
  if ( ! empty( $q['author_name'] ) ) {
490
+ $author = get_user_by( 'slug', sanitize_title_for_query( $q['author_name'] ) );
491
  if ( $author ) {
492
  $q['author'] = $author->ID;
493
  }
include/switcher.php CHANGED
@@ -94,7 +94,7 @@ class PLL_Switcher {
94
  continue;
95
  }
96
 
97
- $url = empty( $url ) || $args['force_home'] ? $links->get_home_url( $language ) : $url ; // If the page is not translated, link to the home page
98
 
99
  $name = $args['show_names'] || ! $args['show_flags'] || $args['raw'] ? ( 'slug' == $args['display_names_as'] ? $slug : $language->name ) : '';
100
  $flag = $args['raw'] && ! $args['show_flags'] ? $language->flag_url : ( $args['show_flags'] ? $language->flag : '' );
94
  continue;
95
  }
96
 
97
+ $url = empty( $url ) || $args['force_home'] ? $links->get_home_url( $language ) : $url; // If the page is not translated, link to the home page
98
 
99
  $name = $args['show_names'] || ! $args['show_flags'] || $args['raw'] ? ( 'slug' == $args['display_names_as'] ? $slug : $language->name ) : '';
100
  $flag = $args['raw'] && ! $args['show_flags'] ? $language->flag_url : ( $args['show_flags'] ? $language->flag : '' );
include/translated-term.php CHANGED
@@ -77,7 +77,7 @@ class PLL_Translated_Term extends PLL_Translated_Object {
77
 
78
  // get_term_by still not cached in WP 3.5.1 but internally, the function is always called by term_id
79
  elseif ( is_string( $value ) && $taxonomy ) {
80
- $term_id = wpcom_vip_get_term_by( 'slug', $value , $taxonomy )->term_id;
81
  }
82
 
83
  // Get the language and make sure it is a PLL_Language object
77
 
78
  // get_term_by still not cached in WP 3.5.1 but internally, the function is always called by term_id
79
  elseif ( is_string( $value ) && $taxonomy ) {
80
+ $term_id = wpcom_vip_get_term_by( 'slug', $value, $taxonomy )->term_id;
81
  }
82
 
83
  // Get the language and make sure it is a PLL_Language object
include/walker-dropdown.php CHANGED
@@ -69,7 +69,7 @@ class PLL_Walker_Dropdown extends Walker {
69
  */
70
  function walk( $elements, $args = array() ) {
71
  $output = '';
72
- $args = wp_parse_args( $args, array( 'value' => 'slug', 'name' => 'lang_choice' ) );
73
 
74
  if ( ! empty( $args['flag'] ) ) {
75
  $current = wp_list_filter( $elements, array( $args['value'] => $args['selected'] ) );
69
  */
70
  function walk( $elements, $args = array() ) {
71
  $output = '';
72
+ $args = wp_parse_args( $args, array( 'value' => 'slug', 'name' => 'lang_choice' ) );
73
 
74
  if ( ! empty( $args['flag'] ) ) {
75
  $current = wp_list_filter( $elements, array( $args['value'] => $args['selected'] ) );
install/install.php CHANGED
@@ -21,7 +21,7 @@ class PLL_Install extends PLL_Install_Base {
21
 
22
  load_plugin_textdomain( 'polylang', false, basename( POLYLANG_DIR ) . '/languages' ); // plugin i18n
23
 
24
- if ( version_compare( $wp_version, PLL_MIN_WP_VERSION , '<' ) ) {
25
  die( sprintf( '<p style = "font-family: sans-serif; font-size: 12px; color: #333; margin: -5px">%s</p>',
26
  /* translators: %s are WordPress version numbers */
27
  sprintf( esc_html__( 'You are using WordPress %s. Polylang requires at least WordPress %s.', 'polylang' ),
21
 
22
  load_plugin_textdomain( 'polylang', false, basename( POLYLANG_DIR ) . '/languages' ); // plugin i18n
23
 
24
+ if ( version_compare( $wp_version, PLL_MIN_WP_VERSION, '<' ) ) {
25
  die( sprintf( '<p style = "font-family: sans-serif; font-size: 12px; color: #333; margin: -5px">%s</p>',
26
  /* translators: %s are WordPress version numbers */
27
  sprintf( esc_html__( 'You are using WordPress %s. Polylang requires at least WordPress %s.', 'polylang' ),
install/plugin-updater.php CHANGED
@@ -10,7 +10,7 @@ if ( ! defined( 'ABSPATH' ) ) {
10
  * Modified version with 'polylang' text domain and comments for translators
11
  *
12
  * @author Easy Digital Downloads
13
- * @version 1.6.12
14
  */
15
  class PLL_Plugin_Updater {
16
 
@@ -43,7 +43,7 @@ class PLL_Plugin_Updater {
43
  $this->version = $_api_data['version'];
44
  $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
45
  $this->beta = ! empty( $this->api_data['beta'] ) ? true : false;
46
- $this->cache_key = md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
47
 
48
  $edd_plugin_data[ $this->slug ] = $this->api_data;
49
 
@@ -312,11 +312,13 @@ class PLL_Plugin_Updater {
312
  * @return object $array
313
  */
314
  public function http_request_args( $args, $url ) {
315
- // If it is an https request and we are performing a package download, disable ssl verification
 
316
  if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
317
- $args['sslverify'] = false;
318
  }
319
  return $args;
 
320
  }
321
 
322
  /**
@@ -356,7 +358,8 @@ class PLL_Plugin_Updater {
356
  'beta' => ! empty( $data['beta'] ),
357
  );
358
 
359
- $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
 
360
 
361
  if ( ! is_wp_error( $request ) ) {
362
  $request = json_decode( wp_remote_retrieve_body( $request ) );
@@ -418,7 +421,8 @@ class PLL_Plugin_Updater {
418
  'beta' => ! empty( $data['beta'] )
419
  );
420
 
421
- $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
 
422
 
423
  if ( ! is_wp_error( $request ) ) {
424
  $version_info = json_decode( wp_remote_retrieve_body( $request ) );
@@ -475,8 +479,18 @@ class PLL_Plugin_Updater {
475
  'value' => json_encode( $value )
476
  );
477
 
478
- update_option( $cache_key, $data );
 
 
479
 
 
 
 
 
 
 
 
 
480
  }
481
 
482
  }
10
  * Modified version with 'polylang' text domain and comments for translators
11
  *
12
  * @author Easy Digital Downloads
13
+ * @version 1.6.15
14
  */
15
  class PLL_Plugin_Updater {
16
 
43
  $this->version = $_api_data['version'];
44
  $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
45
  $this->beta = ! empty( $this->api_data['beta'] ) ? true : false;
46
+ $this->cache_key = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
47
 
48
  $edd_plugin_data[ $this->slug ] = $this->api_data;
49
 
312
  * @return object $array
313
  */
314
  public function http_request_args( $args, $url ) {
315
+
316
+ $verify_ssl = $this->verify_ssl();
317
  if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
318
+ $args['sslverify'] = $verify_ssl;
319
  }
320
  return $args;
321
+
322
  }
323
 
324
  /**
358
  'beta' => ! empty( $data['beta'] ),
359
  );
360
 
361
+ $verify_ssl = $this->verify_ssl();
362
+ $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
363
 
364
  if ( ! is_wp_error( $request ) ) {
365
  $request = json_decode( wp_remote_retrieve_body( $request ) );
421
  'beta' => ! empty( $data['beta'] )
422
  );
423
 
424
+ $verify_ssl = $this->verify_ssl();
425
+ $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
426
 
427
  if ( ! is_wp_error( $request ) ) {
428
  $version_info = json_decode( wp_remote_retrieve_body( $request ) );
479
  'value' => json_encode( $value )
480
  );
481
 
482
+ update_option( $cache_key, $data, 'no' );
483
+
484
+ }
485
 
486
+ /**
487
+ * Returns if the SSL of the store should be verified.
488
+ *
489
+ * @since 1.6.13
490
+ * @return bool
491
+ */
492
+ private function verify_ssl() {
493
+ return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
494
  }
495
 
496
  }
install/upgrade.php CHANGED
@@ -166,7 +166,7 @@ class PLL_Upgrade {
166
 
167
  // Need to register the taxonomies
168
  foreach ( array( 'language', 'term_language', 'post_translations', 'term_translations' ) as $taxonomy ) {
169
- register_taxonomy( $taxonomy, null , array( 'label' => false, 'public' => false, 'query_var' => false, 'rewrite' => false ) );
170
  }
171
 
172
  // Abort if the db upgrade has already been done previously
@@ -219,8 +219,8 @@ class PLL_Upgrade {
219
 
220
  foreach ( $objects as $obj ) {
221
  $term = uniqid( 'pll_' ); // The term name
222
- $terms[] = $wpdb->prepare( '( "%s", "%s" )', $term, $term );
223
- $slugs[] = $wpdb->prepare( '"%s"', $term );
224
  $translations = maybe_unserialize( maybe_unserialize( $obj ) ); // 2 unserialize due to an old storage bug
225
  $description[ $term ] = serialize( $translations );
226
  }
@@ -237,7 +237,7 @@ class PLL_Upgrade {
237
 
238
  // Prepare terms taxonomy relationship
239
  foreach ( $terms as $term ) {
240
- $tts[] = $wpdb->prepare( '( %d, "%s", "%s" )', $term->term_id, $type . '_translations', $description[ $term->slug ] );
241
  }
242
 
243
  $tts = array_unique( $tts );
166
 
167
  // Need to register the taxonomies
168
  foreach ( array( 'language', 'term_language', 'post_translations', 'term_translations' ) as $taxonomy ) {
169
+ register_taxonomy( $taxonomy, null, array( 'label' => false, 'public' => false, 'query_var' => false, 'rewrite' => false ) );
170
  }
171
 
172
  // Abort if the db upgrade has already been done previously
219
 
220
  foreach ( $objects as $obj ) {
221
  $term = uniqid( 'pll_' ); // The term name
222
+ $terms[] = $wpdb->prepare( '( %s, %s )', $term, $term );
223
+ $slugs[] = $wpdb->prepare( '%s', $term );
224
  $translations = maybe_unserialize( maybe_unserialize( $obj ) ); // 2 unserialize due to an old storage bug
225
  $description[ $term ] = serialize( $translations );
226
  }
237
 
238
  // Prepare terms taxonomy relationship
239
  foreach ( $terms as $term ) {
240
+ $tts[] = $wpdb->prepare( '( %d, %s, %s )', $term->term_id, $type . '_translations', $description[ $term->slug ] );
241
  }
242
 
243
  $tts = array_unique( $tts );
modules/plugins/plugins-compat.php CHANGED
@@ -36,7 +36,7 @@ class PLL_Plugins_Compat {
36
  add_filter( 'option_featured-content', array( $this, 'twenty_fourteen_option_featured_content' ) );
37
 
38
  // Duplicate post
39
- add_filter( 'option_duplicate_post_taxonomies_blacklist' , array( $this, 'duplicate_post_taxonomies_blacklist' ) );
40
 
41
  // Jetpack 3
42
  add_action( 'init', array( $this, 'jetpack_init' ) );
@@ -186,7 +186,7 @@ class PLL_Plugins_Compat {
186
 
187
  if ( PLL()->options['force_lang'] > 1 ) {
188
  add_filter( 'wpseo_enable_xml_sitemap_transient_caching', '__return_false' ); // Disable cache! otherwise WPSEO keeps only one domain (thanks to Junaid Bhura)
189
- add_filter( 'home_url', array( $this, 'wpseo_home_url' ) , 10, 2 ); // Fix home_url
190
  } else {
191
  // Get all terms in all languages when the language is set from the content or directory name
192
  add_filter( 'get_terms_args', array( $this, 'wpseo_remove_terms_filter' ) );
@@ -401,7 +401,7 @@ class PLL_Plugins_Compat {
401
  global $wpseo_sitemaps;
402
  $renderer = version_compare( WPSEO_VERSION, '3.2', '<' ) ? $wpseo_sitemaps : $wpseo_sitemaps->renderer;
403
 
404
- $languages = wp_list_pluck( wp_list_filter( PLL()->model->get_languages_list() , array( 'active' => false ), 'NOT' ), 'slug' );
405
 
406
  foreach ( $languages as $lang ) {
407
  if ( empty( PLL()->options['hide_default'] ) || pll_default_language() !== $lang ) {
36
  add_filter( 'option_featured-content', array( $this, 'twenty_fourteen_option_featured_content' ) );
37
 
38
  // Duplicate post
39
+ add_filter( 'option_duplicate_post_taxonomies_blacklist', array( $this, 'duplicate_post_taxonomies_blacklist' ) );
40
 
41
  // Jetpack 3
42
  add_action( 'init', array( $this, 'jetpack_init' ) );
186
 
187
  if ( PLL()->options['force_lang'] > 1 ) {
188
  add_filter( 'wpseo_enable_xml_sitemap_transient_caching', '__return_false' ); // Disable cache! otherwise WPSEO keeps only one domain (thanks to Junaid Bhura)
189
+ add_filter( 'home_url', array( $this, 'wpseo_home_url' ), 10, 2 ); // Fix home_url
190
  } else {
191
  // Get all terms in all languages when the language is set from the content or directory name
192
  add_filter( 'get_terms_args', array( $this, 'wpseo_remove_terms_filter' ) );
401
  global $wpseo_sitemaps;
402
  $renderer = version_compare( WPSEO_VERSION, '3.2', '<' ) ? $wpseo_sitemaps : $wpseo_sitemaps->renderer;
403
 
404
+ $languages = wp_list_pluck( wp_list_filter( PLL()->model->get_languages_list(), array( 'active' => false ), 'NOT' ), 'slug' );
405
 
406
  foreach ( $languages as $lang ) {
407
  if ( empty( PLL()->options['hide_default'] ) || pll_default_language() !== $lang ) {
modules/share-slug/settings-share-slug.php CHANGED
@@ -58,7 +58,7 @@ class PLL_Settings_Share_Slug extends PLL_Settings_Module {
58
  wp_enqueue_script( 'jquery' );
59
 
60
  $activated = sprintf( '<span class="activated">%s</span>', $this->action_links['activated'] );
61
- $deactivated = sprintf( '<span class="deactivated">%s</span>', $this->action_links['deactivated'] );
62
 
63
  ?>
64
  <script type='text/javascript'>
58
  wp_enqueue_script( 'jquery' );
59
 
60
  $activated = sprintf( '<span class="activated">%s</span>', $this->action_links['activated'] );
61
+ $deactivated = sprintf( '<span class="deactivated">%s</span>', $this->action_links['deactivated'] );
62
 
63
  ?>
64
  <script type='text/javascript'>
modules/wpml/wpml-api.php CHANGED
@@ -26,7 +26,7 @@ class PLL_WPML_API {
26
  // wpml_footer_language_selector => not applicable
27
  add_action( 'wpml_add_language_form_field', array( $this, 'wpml_add_language_form_field' ) );
28
  add_filter( 'wpml_language_is_active', array( $this, 'wpml_language_is_active' ), 10, 2 );
29
- add_filter( 'wpml_is_rtl' , array( $this, 'wpml_is_rtl' ) );
30
  // wpml_language_form_input_field => See wpml_add_language_form_field
31
  // wpml_language_has_switched => not implemented
32
 
@@ -40,7 +40,7 @@ class PLL_WPML_API {
40
  // Retrieving Localized Content
41
 
42
  add_filter( 'wpml_home_url', 'pll_home_url', 10, 0 );
43
- add_filter( 'wpml_element_link', 'icl_link_to_element' , 10, 7 );
44
  add_filter( 'wpml_object_id', 'icl_object_id', 10, 4 );
45
  add_filter( 'wpml_translate_single_string', array( $this, 'wpml_translate_single_string' ), 10, 4 );
46
  // wpml_translate_string => not applicable
26
  // wpml_footer_language_selector => not applicable
27
  add_action( 'wpml_add_language_form_field', array( $this, 'wpml_add_language_form_field' ) );
28
  add_filter( 'wpml_language_is_active', array( $this, 'wpml_language_is_active' ), 10, 2 );
29
+ add_filter( 'wpml_is_rtl', array( $this, 'wpml_is_rtl' ) );
30
  // wpml_language_form_input_field => See wpml_add_language_form_field
31
  // wpml_language_has_switched => not implemented
32
 
40
  // Retrieving Localized Content
41
 
42
  add_filter( 'wpml_home_url', 'pll_home_url', 10, 0 );
43
+ add_filter( 'wpml_element_link', 'icl_link_to_element', 10, 7 );
44
  add_filter( 'wpml_object_id', 'icl_object_id', 10, 4 );
45
  add_filter( 'wpml_translate_single_string', array( $this, 'wpml_translate_single_string' ), 10, 4 );
46
  // wpml_translate_string => not applicable
modules/wpml/wpml-config.php CHANGED
@@ -106,7 +106,7 @@ class PLL_WPML_Config {
106
  if ( 'copy' == $attributes['action'] || ( ! $sync && in_array( $attributes['action'], array( 'translate', 'copy-once' ) ) ) ) {
107
  $metas[] = (string) $cf;
108
  } else {
109
- $metas = array_diff( $metas, array( (string) $cf ) );
110
  }
111
  }
112
  }
106
  if ( 'copy' == $attributes['action'] || ( ! $sync && in_array( $attributes['action'], array( 'translate', 'copy-once' ) ) ) ) {
107
  $metas[] = (string) $cf;
108
  } else {
109
+ $metas = array_diff( $metas, array( (string) $cf ) );
110
  }
111
  }
112
  }
modules/wpml/wpml-legacy-api.php CHANGED
@@ -139,7 +139,7 @@ if ( ! function_exists( 'icl_link_to_element' ) ) {
139
  }
140
 
141
  if ( ! empty( $args ) ) {
142
- $link .= ( false === strpos( $link, '?' ) ? '?' : '&' ) . http_build_query( $args );
143
  }
144
 
145
  if ( ! empty( $anchor ) ) {
@@ -169,9 +169,21 @@ if ( ! function_exists( 'icl_object_id' ) ) {
169
  * @return int|null the object id of the translation, null if the translation is missing and $return_original_if_missing set to false
170
  */
171
  function icl_object_id( $id, $type = 'post', $return_original_if_missing = false, $lang = false ) {
172
- $pll_type = ( 'post' === $type || pll_is_translated_post_type( $type ) ) ? 'post' : ( 'term' === $type || pll_is_translated_taxonomy( $type ) ? 'term' : false );
173
- return $pll_type && ( $lang = $lang ? $lang : pll_current_language() ) && ( $tr_id = PLL()->model->$pll_type->get_translation( $id, $lang ) ) ? $tr_id :
174
- ( $return_original_if_missing ? $id : null );
 
 
 
 
 
 
 
 
 
 
 
 
175
  }
176
  }
177
 
139
  }
140
 
141
  if ( ! empty( $args ) ) {
142
+ $link .= ( false === strpos( $link, '?' ) ? '?' : '&' ) . http_build_query( $args );
143
  }
144
 
145
  if ( ! empty( $anchor ) ) {
169
  * @return int|null the object id of the translation, null if the translation is missing and $return_original_if_missing set to false
170
  */
171
  function icl_object_id( $id, $type = 'post', $return_original_if_missing = false, $lang = false ) {
172
+ $lang = $lang ? $lang : pll_current_language();
173
+
174
+ if ( 'nav_menu' === $type ) {
175
+ $theme = get_option( 'stylesheet' );
176
+ foreach ( PLL()->options['nav_menus'][ $theme ] as $loc => $menu ) {
177
+ if ( array_search( $id, $menu ) && ! empty( $menu[ $lang ] ) ) {
178
+ $tr_id = $menu[ $lang ];
179
+ break;
180
+ }
181
+ }
182
+ } elseif ( $pll_type = ( 'post' === $type || pll_is_translated_post_type( $type ) ) ? 'post' : ( 'term' === $type || pll_is_translated_taxonomy( $type ) ? 'term' : false ) ) {
183
+ $tr_id = PLL()->model->$pll_type->get_translation( $id, $lang );
184
+ }
185
+
186
+ return ! empty( $tr_id ) ? $tr_id : ( $return_original_if_missing ? $id : null );
187
  }
188
  }
189
 
polylang.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  Plugin Name: Polylang
5
  Plugin URI: https://polylang.pro
6
- Version: 2.2.4
7
  Author: Frédéric Demarle
8
  Author uri: https://polylang.pro
9
  Description: Adds multilingual capability to WordPress
@@ -35,18 +35,18 @@ if ( ! defined( 'ABSPATH' ) ) {
35
  exit; // don't access directly
36
  };
37
 
38
- define( 'POLYLANG_VERSION', '2.2.4' );
39
  define( 'PLL_MIN_WP_VERSION', '4.4' );
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';
3
  /**
4
  Plugin Name: Polylang
5
  Plugin URI: https://polylang.pro
6
+ Version: 2.2.5
7
  Author: Frédéric Demarle
8
  Author uri: https://polylang.pro
9
  Description: Adds multilingual capability to WordPress
35
  exit; // don't access directly
36
  };
37
 
38
+ define( 'POLYLANG_VERSION', '2.2.5' );
39
  define( 'PLL_MIN_WP_VERSION', '4.4' );
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://polylang.pro
4
  Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
5
  Requires at least: 4.4
6
  Tested up to: 4.9
7
- Stable tag: 2.2.4
8
  License: GPLv2 or later
9
 
10
  Making WordPress multilingual
@@ -76,6 +76,13 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
76
 
77
  == Changelog ==
78
 
 
 
 
 
 
 
 
79
  = 2.2.4 (2017-10-26) =
80
 
81
  * Pro: Fix unknown language not redirected to default when using multiple domains
4
  Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
5
  Requires at least: 4.4
6
  Tested up to: 4.9
7
+ Stable tag: 2.2.5
8
  License: GPLv2 or later
9
 
10
  Making WordPress multilingual
76
 
77
  == Changelog ==
78
 
79
+ = 2.2.5 (2017-11-09) =
80
+
81
+ * Update plugin updater class to 1.6.15
82
+ * Add $link in cache key of links filters
83
+ * Add support for 'nav_menu' post type in wpml_object_id
84
+ * Fix conflict with Timber (introduced in 2.2.4)
85
+
86
  = 2.2.4 (2017-10-26) =
87
 
88
  * Pro: Fix unknown language not redirected to default when using multiple domains
settings/settings-cpt.php CHANGED
@@ -30,7 +30,7 @@ class PLL_Settings_CPT extends PLL_Settings_Module {
30
  $taxonomies = get_taxonomies( array( 'public' => true, '_builtin' => false ) );
31
  $taxonomies = array_diff( $taxonomies, get_taxonomies( array( '_pll' => true ) ) );
32
  /** This filter is documented in include/model.php */
33
- $this->taxonomies = array_unique( apply_filters( 'pll_get_taxonomies', $taxonomies , true ) );
34
  }
35
 
36
  /**
30
  $taxonomies = get_taxonomies( array( 'public' => true, '_builtin' => false ) );
31
  $taxonomies = array_diff( $taxonomies, get_taxonomies( array( '_pll' => true ) ) );
32
  /** This filter is documented in include/model.php */
33
+ $this->taxonomies = array_unique( apply_filters( 'pll_get_taxonomies', $taxonomies, true ) );
34
  }
35
 
36
  /**
settings/settings.php CHANGED
@@ -39,8 +39,8 @@ class PLL_Settings extends PLL_Admin_Base {
39
  add_action( 'admin_init', array( $this, 'register_settings_modules' ) );
40
 
41
  // adds screen options and the about box in the languages admin panel
42
- add_action( 'load-toplevel_page_mlang', array( $this, 'load_page' ) );
43
- add_action( 'load-languages_page_mlang_strings', array( $this, 'load_page_strings' ) );
44
 
45
  // saves per-page value in screen option
46
  add_filter( 'set-screen-option', array( $this, 'set_screen_option' ), 10, 3 );
@@ -277,7 +277,7 @@ class PLL_Settings extends PLL_Admin_Base {
277
 
278
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
279
 
280
- wp_enqueue_script( 'pll_admin', plugins_url( '/js/admin' . $suffix . '.js', POLYLANG_FILE ), array( 'jquery', 'wp-ajax-response', 'postbox', 'jquery-ui-selectmenu' ), POLYLANG_VERSION );
281
  wp_localize_script( 'pll_admin', 'pll_flag_base_url', plugins_url( '/flags/', POLYLANG_FILE ) );
282
 
283
  wp_enqueue_style( 'pll_selectmenu', plugins_url( '/css/selectmenu' . $suffix . '.css', POLYLANG_FILE ), array(), POLYLANG_VERSION );
@@ -313,7 +313,7 @@ class PLL_Settings extends PLL_Admin_Base {
313
  $args['settings-updated'] = 1;
314
  }
315
  // remove possible 'pll_action' and 'lang' query args from the referer before redirecting
316
- wp_safe_redirect( add_query_arg( $args, remove_query_arg( array( 'pll_action', 'lang' ), wp_get_referer() ) ) );
317
  exit;
318
  }
319
  }
39
  add_action( 'admin_init', array( $this, 'register_settings_modules' ) );
40
 
41
  // adds screen options and the about box in the languages admin panel
42
+ add_action( 'load-toplevel_page_mlang', array( $this, 'load_page' ) );
43
+ add_action( 'load-languages_page_mlang_strings', array( $this, 'load_page_strings' ) );
44
 
45
  // saves per-page value in screen option
46
  add_filter( 'set-screen-option', array( $this, 'set_screen_option' ), 10, 3 );
277
 
278
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
279
 
280
+ wp_enqueue_script( 'pll_admin', plugins_url( '/js/admin' . $suffix . '.js', POLYLANG_FILE ), array( 'jquery', 'wp-ajax-response', 'postbox', 'jquery-ui-selectmenu' ), POLYLANG_VERSION );
281
  wp_localize_script( 'pll_admin', 'pll_flag_base_url', plugins_url( '/flags/', POLYLANG_FILE ) );
282
 
283
  wp_enqueue_style( 'pll_selectmenu', plugins_url( '/css/selectmenu' . $suffix . '.css', POLYLANG_FILE ), array(), POLYLANG_VERSION );
313
  $args['settings-updated'] = 1;
314
  }
315
  // remove possible 'pll_action' and 'lang' query args from the referer before redirecting
316
+ wp_safe_redirect( add_query_arg( $args, remove_query_arg( array( 'pll_action', 'lang' ), wp_get_referer() ) ) );
317
  exit;
318
  }
319
  }
settings/table-languages.php CHANGED
@@ -199,14 +199,14 @@ class PLL_Table_Languages extends WP_List_Table {
199
  '<a title="%s" href="%s">%s</a>',
200
  esc_attr__( 'Edit this language', 'polylang' ),
201
  esc_url( admin_url( 'admin.php?page=mlang&amp;pll_action=edit&amp;lang=' . $item->term_id ) ),
202
- esc_html__( 'Edit','polylang' )
203
  ),
204
  'delete' => sprintf(
205
  '<a title="%s" href="%s" onclick = "return confirm( \'%s\' );">%s</a>',
206
  esc_attr__( 'Delete this language and all its associated data', 'polylang' ),
207
  wp_nonce_url( '?page=mlang&amp;pll_action=delete&amp;noheader=true&amp;lang=' . $item->term_id, 'delete-lang' ),
208
  esc_js( __( 'You are about to permanently delete this language. Are you sure?', 'polylang' ) ),
209
- esc_html__( 'Delete','polylang' )
210
  ),
211
  );
212
 
199
  '<a title="%s" href="%s">%s</a>',
200
  esc_attr__( 'Edit this language', 'polylang' ),
201
  esc_url( admin_url( 'admin.php?page=mlang&amp;pll_action=edit&amp;lang=' . $item->term_id ) ),
202
+ esc_html__( 'Edit', 'polylang' )
203
  ),
204
  'delete' => sprintf(
205
  '<a title="%s" href="%s" onclick = "return confirm( \'%s\' );">%s</a>',
206
  esc_attr__( 'Delete this language and all its associated data', 'polylang' ),
207
  wp_nonce_url( '?page=mlang&amp;pll_action=delete&amp;noheader=true&amp;lang=' . $item->term_id, 'delete-lang' ),
208
  esc_js( __( 'You are about to permanently delete this language. Are you sure?', 'polylang' ) ),
209
+ esc_html__( 'Delete', 'polylang' )
210
  ),
211
  );
212
 
settings/table-string.php CHANGED
@@ -216,7 +216,7 @@ class PLL_Table_String extends WP_List_Table {
216
  * @return array
217
  */
218
  function get_bulk_actions() {
219
- return array( 'delete' => __( 'Delete','polylang' ) );
220
  }
221
 
222
  /**
216
  * @return array
217
  */
218
  function get_bulk_actions() {
219
+ return array( 'delete' => __( 'Delete', 'polylang' ) );
220
  }
221
 
222
  /**
uninstall.php CHANGED
@@ -62,7 +62,7 @@ class PLL_Uninstall {
62
  // Need to register the taxonomies
63
  $pll_taxonomies = array( 'language', 'term_language', 'post_translations', 'term_translations' );
64
  foreach ( $pll_taxonomies as $taxonomy ) {
65
- register_taxonomy( $taxonomy, null , array( 'label' => false, 'public' => false, 'query_var' => false, 'rewrite' => false ) );
66
  }
67
 
68
  $languages = get_terms( 'language', array( 'hide_empty' => false ) );
62
  // Need to register the taxonomies
63
  $pll_taxonomies = array( 'language', 'term_language', 'post_translations', 'term_translations' );
64
  foreach ( $pll_taxonomies as $taxonomy ) {
65
+ register_taxonomy( $taxonomy, null, array( 'label' => false, 'public' => false, 'query_var' => false, 'rewrite' => false ) );
66
  }
67
 
68
  $languages = get_terms( 'language', array( 'hide_empty' => false ) );