Polylang - Version 1.8.5

Version Description

(2016-04-03) =

  • Revert from $_SERVER['PHP_SELF'] to $_SERVER['SCRIPT_FILENAME'] to detect if the user is on login/register/signup page
  • Fix incompatibility introduced by WP 4.5 in Edit single taxonomy term screen
  • Fix existing post overriden when creating a language and a conflicting plugin sets the global $post on languages pages
Download this release

Release Info

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

Code changes from version 1.8.4 to 1.8.5

admin/admin-base.php CHANGED
@@ -92,7 +92,7 @@ class PLL_Admin_Base extends PLL_Base {
92
  $scripts = array(
93
  'post' => array( array( 'post', 'media', 'async-upload', 'edit' ), array( 'jquery', 'wp-ajax-response', 'post', 'jquery-ui-autocomplete' ), 0 , 1 ),
94
  'media' => array( array( 'upload' ), array( 'jquery' ), 0 , 1 ),
95
- 'term' => array( array( 'edit-tags' ), array( 'jquery', 'wp-ajax-response', 'jquery-ui-autocomplete' ), 0, 1 ),
96
  'user' => array( array( 'profile', 'user-edit' ), array( 'jquery' ), 0 , 0 ),
97
  );
98
 
92
  $scripts = array(
93
  'post' => array( array( 'post', 'media', 'async-upload', 'edit' ), array( 'jquery', 'wp-ajax-response', 'post', 'jquery-ui-autocomplete' ), 0 , 1 ),
94
  'media' => array( array( 'upload' ), array( 'jquery' ), 0 , 1 ),
95
+ 'term' => array( array( 'edit-tags', 'term' ), array( 'jquery', 'wp-ajax-response', 'jquery-ui-autocomplete' ), 0, 1 ),
96
  'user' => array( array( 'profile', 'user-edit' ), array( 'jquery' ), 0 , 0 ),
97
  );
98
 
admin/admin-filters-term.php CHANGED
@@ -620,17 +620,17 @@ class PLL_Admin_Filters_Term {
620
  // FIXME can we simplify how we deal with the admin language filter?
621
  // the language filter selection has just changed
622
  // test $screen->base to avoid interference between the language filter and the post language selection and the category parent dropdown list
623
- elseif ( ! empty( $_GET['lang'] ) && ! ( isset( $screen ) && in_array( $screen->base, array( 'post', 'edit-tags' ) ) ) ) {
624
  if ( 'all' != $_GET['lang'] ) {
625
  $lang = $this->model->get_language( $_GET['lang'] );
626
  }
627
- elseif ( 'edit-tags' == $screen->base && isset( $args['class'] ) ) {
628
  $lang = $this->pref_lang; // parent dropdown
629
  }
630
  }
631
 
632
  // again the language filter
633
- elseif ( ! empty( $this->curlang ) && ( isset( $screen ) && 'post' != $screen->base && ! ( 'edit-tags' == $screen->base && isset( $args['class'] ) ) ) ) { // don't apply to post edit and the category parent dropdown list
634
  $lang = $this->curlang;
635
  }
636
 
@@ -649,7 +649,7 @@ class PLL_Admin_Filters_Term {
649
  }
650
 
651
  // for a new post ( or the parent dropdown list of a new term )
652
- elseif ( isset( $screen ) && ( 'post' == $screen->base || ( 'edit-tags' == $screen->base && isset( $args['class'] ) ) ) ) {
653
  $lang = $this->pref_lang;
654
  }
655
 
620
  // FIXME can we simplify how we deal with the admin language filter?
621
  // the language filter selection has just changed
622
  // test $screen->base to avoid interference between the language filter and the post language selection and the category parent dropdown list
623
+ elseif ( ! empty( $_GET['lang'] ) && ! ( isset( $screen ) && in_array( $screen->base, array( 'post', 'edit-tags', 'term' ) ) ) ) {
624
  if ( 'all' != $_GET['lang'] ) {
625
  $lang = $this->model->get_language( $_GET['lang'] );
626
  }
627
+ elseif ( in_array( $screen->base, array( 'edit-tags', 'term' ) ) && isset( $args['class'] ) ) {
628
  $lang = $this->pref_lang; // parent dropdown
629
  }
630
  }
631
 
632
  // again the language filter
633
+ elseif ( ! empty( $this->curlang ) && ( isset( $screen ) && 'post' != $screen->base && ! ( in_array( $screen->base, array( 'edit-tags', 'term' ) ) && isset( $args['class'] ) ) ) ) { // don't apply to post edit and the category parent dropdown list
634
  $lang = $this->curlang;
635
  }
636
 
649
  }
650
 
651
  // for a new post ( or the parent dropdown list of a new term )
652
+ elseif ( isset( $screen ) && ( 'post' == $screen->base || ( in_array( $screen->base, array( 'edit-tags', 'term' ) ) && isset( $args['class'] ) ) ) ) {
653
  $lang = $this->pref_lang;
654
  }
655
 
admin/view-translations-post.php CHANGED
@@ -39,8 +39,8 @@ if ( ! defined( 'ABSPATH' ) ) {
39
  <td class = "pll-translation-column"><?php
40
  printf( '
41
  <label class="screen-reader-text" for="tr_lang_%1$s">%2$s</label>
42
- <input type="hidden" name="post_tr_lang[%1$s]" id="htr_lang_%1$s" value="%3$s"/>
43
- <input type="text" class="tr_lang" id="tr_lang_%1$s" value="%4$s"%5$s>',
44
  esc_attr( $language->slug ),
45
  __( 'Translation', 'polylang' ),
46
  empty( $value ) ? 0 : esc_attr( $selected->ID ),
39
  <td class = "pll-translation-column"><?php
40
  printf( '
41
  <label class="screen-reader-text" for="tr_lang_%1$s">%2$s</label>
42
+ <input type="hidden" name="post_tr_lang[%1$s]" id="htr_lang_%1$s" value="%3$s" />
43
+ <input type="text" class="tr_lang" id="tr_lang_%1$s" value="%4$s"%5$s />',
44
  esc_attr( $language->slug ),
45
  __( 'Translation', 'polylang' ),
46
  empty( $value ) ? 0 : esc_attr( $selected->ID ),
admin/view-translations-term.php CHANGED
@@ -57,8 +57,8 @@ else {
57
  <td class = "pll-translation-column"><?php
58
  printf( '
59
  <label class="screen-reader-text" for="tr_lang_%1$s">%2$s</label>
60
- <input type="hidden" class="htr_lang" name="term_tr_lang[%1$s]" id="htr_lang_%1$s" value="%3$s"/>
61
- <input type="text" class="tr_lang" id="tr_lang_%1$s" value="%4$s"%5$s>',
62
  esc_attr( $language->slug ),
63
  __( 'Translation', 'polylang' ),
64
  empty( $translation ) ? 0 : esc_attr( $translation->term_id ),
57
  <td class = "pll-translation-column"><?php
58
  printf( '
59
  <label class="screen-reader-text" for="tr_lang_%1$s">%2$s</label>
60
+ <input type="hidden" class="htr_lang" name="term_tr_lang[%1$s]" id="htr_lang_%1$s" value="%3$s" />
61
+ <input type="text" class="tr_lang" id="tr_lang_%1$s" value="%4$s"%5$s />',
62
  esc_attr( $language->slug ),
63
  __( 'Translation', 'polylang' ),
64
  empty( $translation ) ? 0 : esc_attr( $translation->term_id ),
frontend/choose-lang.php CHANGED
@@ -32,7 +32,7 @@ abstract class PLL_Choose_Lang {
32
  * @since 1.8
33
  */
34
  public function init() {
35
- if ( PLL_AJAX_ON_FRONT || false === stripos( $_SERVER['PHP_SELF'], 'index.php' ) ) {
36
  $this->set_language( empty( $_REQUEST['lang'] ) ? $this->get_preferred_language() : $this->model->get_language( $_REQUEST['lang'] ) );
37
  }
38
 
32
  * @since 1.8
33
  */
34
  public function init() {
35
+ if ( PLL_AJAX_ON_FRONT || false === stripos( $_SERVER['SCRIPT_FILENAME'], 'index.php' ) ) {
36
  $this->set_language( empty( $_REQUEST['lang'] ) ? $this->get_preferred_language() : $this->model->get_language( $_REQUEST['lang'] ) );
37
  }
38
 
include/links-domain.php CHANGED
@@ -89,6 +89,7 @@ class PLL_Links_Domain extends PLL_Links_Permalinks {
89
  * @return array list of hosts
90
  */
91
  public function get_hosts() {
 
92
  foreach ( $this->options['domains'] as $domain ) {
93
  $hosts[] = parse_url( $domain, PHP_URL_HOST );
94
  }
89
  * @return array list of hosts
90
  */
91
  public function get_hosts() {
92
+ $hosts = array();
93
  foreach ( $this->options['domains'] as $domain ) {
94
  $hosts[] = parse_url( $domain, PHP_URL_HOST );
95
  }
include/links-subdomain.php CHANGED
@@ -76,6 +76,7 @@ class PLL_Links_Subdomain extends PLL_Links_Permalinks {
76
  * @return array list of hosts
77
  */
78
  public function get_hosts() {
 
79
  foreach ( $this->model->get_languages_list() as $lang ) {
80
  $hosts[] = parse_url( $this->home_url( $lang ), PHP_URL_HOST );
81
  }
76
  * @return array list of hosts
77
  */
78
  public function get_hosts() {
79
+ $hosts = array();
80
  foreach ( $this->model->get_languages_list() as $lang ) {
81
  $hosts[] = parse_url( $this->home_url( $lang ), PHP_URL_HOST );
82
  }
include/mo.php CHANGED
@@ -36,7 +36,8 @@ class PLL_MO extends MO {
36
  $strings[] = array( $entry->singular, $this->translate( $entry->singular ) );
37
  }
38
 
39
- $post = get_post( $lang->mo_id, ARRAY_A ); // wp_insert_post wants an array
 
40
 
41
  $post['post_title'] = 'polylang_mo_' . $lang->term_id;
42
  // json_encode would take less space but is slower to decode
36
  $strings[] = array( $entry->singular, $this->translate( $entry->singular ) );
37
  }
38
 
39
+ // we need to make sure that $post is empty when $lang->mo_id is empty: see https://wordpress.org/support/topic/problem-when-adding-a-language
40
+ $post = empty( $lang->mo_id ) ? array() : get_post( $lang->mo_id, ARRAY_A ); // wp_insert_post wants an array
41
 
42
  $post['post_title'] = 'polylang_mo_' . $lang->term_id;
43
  // json_encode would take less space but is slower to decode
polylang.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  Plugin Name: Polylang
5
  Plugin URI: http://polylang.wordpress.com/
6
- Version: 1.8.4
7
  Author: Frédéric Demarle
8
  Author uri: http://polylang.wordpress.com
9
  Description: Adds multilingual capability to WordPress
@@ -35,7 +35,7 @@ if ( ! defined( 'ABSPATH' ) ) {
35
  exit; // don't access directly
36
  };
37
 
38
- define( 'POLYLANG_VERSION', '1.8.4' );
39
  define( 'PLL_MIN_WP_VERSION', '4.0' );
40
 
41
  define( 'POLYLANG_FILE', __FILE__ ); // this file
3
  /*
4
  Plugin Name: Polylang
5
  Plugin URI: http://polylang.wordpress.com/
6
+ Version: 1.8.5
7
  Author: Frédéric Demarle
8
  Author uri: http://polylang.wordpress.com
9
  Description: Adds multilingual capability to WordPress
35
  exit; // don't access directly
36
  };
37
 
38
+ define( 'POLYLANG_VERSION', '1.8.5' );
39
  define( 'PLL_MIN_WP_VERSION', '4.0' );
40
 
41
  define( 'POLYLANG_FILE', __FILE__ ); // this file
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Chouby
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CCWWYUUQV8F4E
4
  Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
5
  Requires at least: 4.0
6
- Tested up to: 4.4
7
- Stable tag: 1.8.4
8
  License: GPLv2 or later
9
 
10
  Making WordPress multilingual
@@ -71,6 +71,12 @@ See http://polylang.wordpress.com/documentation/contribute/
71
 
72
  == Changelog ==
73
 
 
 
 
 
 
 
74
  = 1.8.4 (2016-03-06) =
75
 
76
  * Revert canonical redirection of static front page when combining plain permalinks + default language hidden in url (introduced in 1.8.2)
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CCWWYUUQV8F4E
4
  Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
5
  Requires at least: 4.0
6
+ Tested up to: 4.5
7
+ Stable tag: 1.8.5
8
  License: GPLv2 or later
9
 
10
  Making WordPress multilingual
71
 
72
  == Changelog ==
73
 
74
+ = 1.8.5 (2016-04-03) =
75
+
76
+ * Revert from $_SERVER['PHP_SELF'] to $_SERVER['SCRIPT_FILENAME'] to detect if the user is on login/register/signup page
77
+ * Fix incompatibility introduced by WP 4.5 in Edit single taxonomy term screen
78
+ * Fix existing post overriden when creating a language and a conflicting plugin sets the global $post on languages pages
79
+
80
  = 1.8.4 (2016-03-06) =
81
 
82
  * Revert canonical redirection of static front page when combining plain permalinks + default language hidden in url (introduced in 1.8.2)