Polylang - Version 1.1.5

Version Description

(2013-09-15) =

  • Add compatibility with Aqua Resizer (often used in porfolio themes)
  • Add support of 'icl_get_default_language' function from the WPML API
  • Remove the 3 characters limitation for the language code
  • Change default names for zh_CN, zh_HK, zh_TW
  • Bug correction: urls are modified in search forms
Download this release

Release Info

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

Code changes from version 1.1.4 to 1.1.5

include/admin.php CHANGED
@@ -324,7 +324,7 @@ class Polylang_Admin extends Polylang_Admin_Base {
324
  // error messages for data validation
325
  // FIXME no validation for WordPress locale
326
  //$errors[1] = __('Enter a valid WorPress locale', 'polylang');
327
- $errors[2] = __('The language code must be 2 characters long', 'polylang');
328
  $errors[3] = __('The language code must be unique', 'polylang');
329
  $errors[4] = __('The language must have a name', 'polylang');
330
  $errors[5] = __('The language was created, but the WordPress language file was not downloaded. Please install it manually.', 'polylang');
@@ -385,7 +385,7 @@ class Polylang_Admin extends Polylang_Admin_Base {
385
  */
386
 
387
  // validate slug length
388
- if (!preg_match('#^[a-z]{2,3}$#', $_POST['slug']))
389
  $error = 2;
390
 
391
  // validate slug is unique
324
  // error messages for data validation
325
  // FIXME no validation for WordPress locale
326
  //$errors[1] = __('Enter a valid WorPress locale', 'polylang');
327
+ $errors[2] = __('The language code contains invalid characters', 'polylang');
328
  $errors[3] = __('The language code must be unique', 'polylang');
329
  $errors[4] = __('The language must have a name', 'polylang');
330
  $errors[5] = __('The language was created, but the WordPress language file was not downloaded. Please install it manually.', 'polylang');
385
  */
386
 
387
  // validate slug length
388
+ if (!preg_match('#^[a-z_-]+$#', $_POST['slug']))
389
  $error = 2;
390
 
391
  // validate slug is unique
include/core.php CHANGED
@@ -708,10 +708,16 @@ class Polylang_Core extends Polylang_base {
708
  // adds the language information in the search form
709
  // does not work if searchform.php (prior to WP 3.6) is used or if the search form is hardcoded in another template file
710
  function get_search_form($form) {
711
- if ($form)
712
- $form = $this->using_permalinks ?
713
- str_replace(trailingslashit($this->home), $this->get_home_url($this->curlang, true), $form) :
714
- str_replace('</form>', '<input type="hidden" name="lang" value="'.esc_attr($this->curlang->slug).'" /></form>', $form);
 
 
 
 
 
 
715
 
716
  return $form;
717
  }
708
  // adds the language information in the search form
709
  // does not work if searchform.php (prior to WP 3.6) is used or if the search form is hardcoded in another template file
710
  function get_search_form($form) {
711
+ if ($form) {
712
+ if ($this->using_permalinks) {
713
+ preg_match('#<form.+>#', $form, $matches);
714
+ $old = reset($matches);
715
+ $new = str_replace(trailingslashit($this->home), $this->get_home_url($this->curlang, true), $old);
716
+ $form = str_replace($old, $new, $form);
717
+ }
718
+ else
719
+ $form = str_replace('</form>', '<input type="hidden" name="lang" value="'.esc_attr($this->curlang->slug).'" /></form>', $form);
720
+ }
721
 
722
  return $form;
723
  }
include/languages-form.php CHANGED
@@ -95,7 +95,7 @@ if (isset($_GET['error'])) {?>
95
 
96
  <div class="form-field">
97
  <label for="lang_slug"><?php _e('Language code', 'polylang');?></label>
98
- <input name="slug" id="lang_slug" type="text" value="<?php if ($action=='edit') echo esc_attr($edit_lang->slug);?>" size="3" maxlength="3"/>
99
  <p><?php _e('2-letters ISO 639-1 language code (for example: en)', 'polylang');?></p>
100
  </div>
101
 
95
 
96
  <div class="form-field">
97
  <label for="lang_slug"><?php _e('Language code', 'polylang');?></label>
98
+ <input name="slug" id="lang_slug" type="text" value="<?php if ($action=='edit') echo esc_attr($edit_lang->slug);?>" size="40" />
99
  <p><?php _e('2-letters ISO 639-1 language code (for example: en)', 'polylang');?></p>
100
  </div>
101
 
include/languages.php CHANGED
@@ -78,7 +78,7 @@ $languages = array(
78
  array('uz', 'uz_UZ', 'Oʻzbek'),
79
  array('vec', 'vec', 'Vèneto'),
80
  array('vi', 'vi', 'Tiếng Việt'),
81
- array('zh', 'zh_CN', '中文'),
82
- array('zh', 'zh_HK', '香港'),
83
- array('zh', 'zh_TW', '台灣'),
84
  );
78
  array('uz', 'uz_UZ', 'Oʻzbek'),
79
  array('vec', 'vec', 'Vèneto'),
80
  array('vi', 'vi', 'Tiếng Việt'),
81
+ array('zh', 'zh_CN', '中文 (中国)'),
82
+ array('zh', 'zh_HK', '中文 (香港)'),
83
+ array('zh', 'zh_TW', '中文 (台灣)'),
84
  );
include/plugins-compat.php CHANGED
@@ -18,6 +18,9 @@ class Polylang_Plugins_Compat {
18
 
19
  // Jetpack infinite scroll
20
  add_filter('pre_get_posts', array(&$this, 'jetpack_infinite_scroll'));
 
 
 
21
  }
22
 
23
  // Unfortunately WPSEO loads the text domain before Polylang is able to modify the locale
18
 
19
  // Jetpack infinite scroll
20
  add_filter('pre_get_posts', array(&$this, 'jetpack_infinite_scroll'));
21
+
22
+ // Aqua Resizer
23
+ add_filter('pll_home_url_black_list', create_function('$arr', "return array_merge(\$arr, array(array('function' => 'aq_resize')));"));
24
  }
25
 
26
  // Unfortunately WPSEO loads the text domain before Polylang is able to modify the locale
include/wpml-compat.php CHANGED
@@ -176,6 +176,15 @@ if (!function_exists('wpml_get_copied_fields_for_post_edit')) {
176
  }
177
  }
178
 
 
 
 
 
 
 
 
 
 
179
  /*
180
  * registers strings in a persistant way as done by WPML
181
  */
176
  }
177
  }
178
 
179
+ /*
180
+ * undocumented function used by Warp 6 by Yootheme
181
+ */
182
+ if (!function_exists('icl_get_default_language')) {
183
+ function icl_get_default_language() {
184
+ return pll_default_language();
185
+ }
186
+ }
187
+
188
  /*
189
  * registers strings in a persistant way as done by WPML
190
  */
polylang.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Polylang
4
  Plugin URI: http://polylang.wordpress.com/
5
- Version: 1.1.4
6
  Author: Frédéric Demarle
7
  Description: Adds multilingual capability to WordPress
8
  Text Domain: polylang
@@ -29,7 +29,7 @@ Domain Path: /languages
29
  *
30
  */
31
 
32
- define('POLYLANG_VERSION', '1.1.4');
33
  define('PLL_MIN_WP_VERSION', '3.1');
34
 
35
  define('POLYLANG_DIR', dirname(__FILE__)); // our directory
2
  /*
3
  Plugin Name: Polylang
4
  Plugin URI: http://polylang.wordpress.com/
5
+ Version: 1.1.5
6
  Author: Frédéric Demarle
7
  Description: Adds multilingual capability to WordPress
8
  Text Domain: polylang
29
  *
30
  */
31
 
32
+ define('POLYLANG_VERSION', '1.1.5');
33
  define('PLL_MIN_WP_VERSION', '3.1');
34
 
35
  define('POLYLANG_DIR', dirname(__FILE__)); // our directory
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, i18n, international, l10n, localization
5
  Requires at least: 3.1
6
  Tested up to: 3.6
7
- Stable tag: 1.1.4
8
  License: GPLv2 or later
9
 
10
  Polylang adds multilingual content management support to WordPress.
@@ -92,7 +92,15 @@ If you are using a version older than 0.8, please ugrade to 0.9.8 before ugradin
92
 
93
  == Changelog ==
94
 
95
- = 1.1.4 (2013-08-16) =
 
 
 
 
 
 
 
 
96
 
97
  * Add simplified Chinese language contributed by [Changmeng Hu](http://www.wpdaxue.com)
98
  * Add Indonesian language contributed by [ajoull](http://www.ajoull.com/)
4
  Tags: multilingual, bilingual, translate, translation, language, multilanguage, i18n, international, l10n, localization
5
  Requires at least: 3.1
6
  Tested up to: 3.6
7
+ Stable tag: 1.1.5
8
  License: GPLv2 or later
9
 
10
  Polylang adds multilingual content management support to WordPress.
92
 
93
  == Changelog ==
94
 
95
+ = 1.1.5 (2013-09-15) =
96
+
97
+ * Add compatibility with Aqua Resizer (often used in porfolio themes)
98
+ * Add support of 'icl_get_default_language' function from the WPML API
99
+ * Remove the 3 characters limitation for the language code
100
+ * Change default names for zh_CN, zh_HK, zh_TW
101
+ * Bug correction: urls are modified in search forms
102
+
103
+ = 1.1.4 (2013-08-16) =
104
 
105
  * Add simplified Chinese language contributed by [Changmeng Hu](http://www.wpdaxue.com)
106
  * Add Indonesian language contributed by [ajoull](http://www.ajoull.com/)