Polylang - Version 1.1.2

Version Description

(2013-06-18) =

  • Posts and terms now inherit parent's language if created outside the standard WordPress ui
  • Improve the compatibility with the plugins Types and The Events Calendar, and again with WordPress SEO
  • Improve performance
  • Improve html validation
  • Add 'raw' argument to 'pll_the_languages'
  • Add the filter 'pll_translation_url'
  • Bug correction: no language is set for a (translated custom taxonomy) term when added from a (non tranlated) custom post type edit page
  • Bug correction: warning if 'get_terms' is called with a non-array 'include' argument (introduced in 1.1.1)
  • Bug correction: warning if the menu language switcher has nothing to display
Download this release

Release Info

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

Code changes from version 1.1.1 to 1.1.2

include/admin-base.php CHANGED
@@ -26,19 +26,17 @@ class Polylang_Admin_Base extends Polylang_Base {
26
 
27
  // set user preferences
28
  function admin_init_base() {
29
- if (!$this->get_languages_list())
30
  return;
31
 
32
  // set text direction if the user set its own language
33
- global $wpdb, $wp_locale;
34
- $lang_id = $wpdb->get_var($wpdb->prepare("
35
- SELECT t.term_id FROM $wpdb->terms AS t
36
- INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id
37
- WHERE tt.taxonomy = 'language' AND tt.description = %s LIMIT 1",
38
- get_locale()
39
- )); // no function exists to get term by description
40
- if ($lang_id)
41
- $wp_locale->text_direction = get_metadata('term', $lang_id, '_rtl', true) ? 'rtl' : 'ltr';
42
 
43
  // set user meta when choosing to filter content by language
44
  // $_GET[lang] is used in ajax 'tag suggest' and is numeric when editing a language
@@ -200,12 +198,12 @@ class Polylang_Admin_Base extends Polylang_Base {
200
  ));
201
 
202
  foreach (array_merge($all_item, $this->get_languages_list()) as $lang) {
203
- $href = add_query_arg('lang', $lang->slug, $url);
204
  $wp_admin_bar->add_menu(array(
205
  'parent' => 'languages',
206
  'id' => $lang->slug,
207
  'title' => sprintf(
208
- '<input name="language" type="radio" onclick="location.href=%s" value="%s" %s /> %s',
209
  "'" . $href . "'", // onclick is needed for Chrome browser, thanks to RavanH for the bug report and fix
210
  esc_attr($lang->slug),
211
  $selected == $lang->slug ? 'checked="checked"' : '',
26
 
27
  // set user preferences
28
  function admin_init_base() {
29
+ if (!$languages = $this->get_languages_list())
30
  return;
31
 
32
  // set text direction if the user set its own language
33
+ $locale = get_locale();
34
+ foreach($languages as $lang) {
35
+ if ($locale == $lang->description) {
36
+ $GLOBALS['wp_locale']->text_direction = get_metadata('term', $lang->term_id, '_rtl', true) ? 'rtl' : 'ltr';
37
+ break;
38
+ }
39
+ }
 
 
40
 
41
  // set user meta when choosing to filter content by language
42
  // $_GET[lang] is used in ajax 'tag suggest' and is numeric when editing a language
198
  ));
199
 
200
  foreach (array_merge($all_item, $this->get_languages_list()) as $lang) {
201
+ $href = esc_url(add_query_arg('lang', $lang->slug, $url));
202
  $wp_admin_bar->add_menu(array(
203
  'parent' => 'languages',
204
  'id' => $lang->slug,
205
  'title' => sprintf(
206
+ '<input name="language" type="radio" onclick="location.href=%s" value="%s" %s /> %s', // FIXME this works but produces invalid html
207
  "'" . $href . "'", // onclick is needed for Chrome browser, thanks to RavanH for the bug report and fix
208
  esc_attr($lang->slug),
209
  $selected == $lang->slug ? 'checked="checked"' : '',
include/admin-filters.php CHANGED
@@ -55,7 +55,7 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
55
  // adds actions and filters related to languages when creating, saving or deleting posts and pages
56
  add_filter('wp_insert_post_parent', array(&$this, 'wp_insert_post_parent'));
57
  add_action('dbx_post_advanced', array(&$this, 'dbx_post_advanced'));
58
- add_action('save_post', array(&$this, 'save_post'), 200, 2); // priority 200 to come after advanced custom fields (20) and custom fields template (100)
59
  add_action('before_delete_post', array(&$this, 'delete_post'));
60
 
61
  if ($this->options['media_support']) {
@@ -263,7 +263,10 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
263
  $this->get_preferred_language());
264
 
265
  // NOTE: the class "tags-input" allows to include the field in the autosave $_POST (see autosave.js)
266
- printf("<p><em>%s</em></p>\n<p>%s<br /></p>\n<div id='post-translations' class='translations'>",
 
 
 
267
  __('Language', 'polylang'),
268
  $this->dropdown_languages(array(
269
  'name' => $post_type == 'attachment' ? sprintf('attachments[%d][language]', $post_ID) : 'post_lang_choice',
@@ -273,7 +276,7 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
273
  );
274
  if ($lang)
275
  include(PLL_INC.'/'.($post_type == 'attachment' ? 'media' : 'post').'-translations.php');
276
- echo "</div>\n";
277
  }
278
 
279
  // ajax response for changing the language in the post metabox
@@ -369,8 +372,8 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
369
 
370
  $lang = $this->get_language($_GET['lang']);
371
 
372
- $results = $wpdb->get_col( $wpdb->prepare(
373
- "SELECT t.name FROM $wpdb->term_taxonomy AS tt
374
  INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id
375
  INNER JOIN $wpdb->termmeta AS tm ON tm.term_id = t.term_id
376
  WHERE tt.taxonomy = %s AND t.name LIKE (%s) AND tm.meta_key = '_language' AND tm.meta_value = %d",
@@ -396,14 +399,13 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
396
  return isset($_GET['from_post'], $_GET['new_lang']) && ($id = wp_get_post_parent_id($_GET['from_post'])) && ($parent = $this->get_translation('post', $id, $_GET['new_lang'])) ? $parent : $post_parent;
397
  }
398
 
399
- // copy page template, menu order, comment and ping status when using "Add new" (translation)
400
  // the hook was probably not intended for that but did not find a better one
401
- // copy the meta '_wp_page_template' in save_post is not sufficient (the dropdown list in the metabox is not updated)
402
- // We need to set $post->page_template (and so need to wait for the availability of $post)
403
  function dbx_post_advanced() {
404
  if (isset($_GET['from_post'], $_GET['new_lang'])) {
405
  global $post;
406
- $post->page_template = get_post_meta($_GET['from_post'], '_wp_page_template', true);
 
407
 
408
  $from_post = get_post($_GET['from_post']);
409
  foreach (array('menu_order', 'comment_status', 'ping_status') as $property)
@@ -418,6 +420,7 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
418
  function copy_post_metas($from, $to, $lang, $sync = false) {
419
  // copy or synchronize terms
420
  if (!$sync || in_array('taxonomies', $this->options['sync'])) {
 
421
  foreach ($this->taxonomies as $tax) {
422
  $newterms = array();
423
  $terms = get_the_terms($from, $tax);
@@ -511,19 +514,18 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
511
  elseif ($this->get_post_language($post_id))
512
  {} // avoids breaking the language if post is updated outside the edit post page (thanks to Gonçalo Peres)
513
 
 
 
 
514
  else
515
  $this->set_post_language($post_id, $this->get_preferred_language());
516
 
517
- // the hook is called when the post is created
518
- // let's use it translate terms and copy metas when using "Add new" (translation)
519
- if (isset($_GET['from_post'], $_GET['new_lang']))
520
- $this->copy_post_metas($_GET['from_post'], $post_id, $_GET['new_lang']);
521
-
522
  if (!isset($_POST['post_lang_choice']))
523
  return;
524
 
525
  // make sure we get save terms in the right language (especially tags with same name in different languages)
526
  if ($_POST['post_lang_choice']) {
 
527
  foreach ($this->taxonomies as $tax) {
528
  $terms = get_the_terms($post_id, $tax);
529
  if (is_array($terms)) {
@@ -603,8 +605,8 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
603
  'label' => __('Language', 'polylang'),
604
  'input' => 'html',
605
  'html' => $this->dropdown_languages(array(
606
- 'name' => "attachments[$post_id][language]",
607
- 'class' => "media_lang_choice",
608
  'selected' => $lang ? $lang->slug : ''
609
  ))
610
  );
@@ -641,15 +643,15 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
641
 
642
  // Special case for WP < 3.5, first add the html generated by WP if non AJAX, then our translation table
643
  if (version_compare($GLOBALS['wp_version'], '3.5', '<'))
644
- $data = sprintf("
645
- <th valign='top' scope='row' class='label'>
646
- <label for='attachments[%d][translations]'>
647
- <span class='alignleft'>%s</span><br class='clear' />
648
  </label>
649
  </th>
650
- <td class='field'>
651
  %s
652
- </td>",
653
  $post_id, __('Translations', 'polylang'), $data
654
  );
655
  }
@@ -722,9 +724,9 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
722
  function wp_delete_file($file) {
723
  global $wpdb;
724
  $uploadpath = wp_upload_dir();
725
- $ids = $wpdb->get_col($wpdb->prepare(
726
- "SELECT `post_id` FROM $wpdb->postmeta
727
- WHERE `meta_key` = '_wp_attached_file' AND `meta_value` = '%s'",
728
  ltrim($file, $uploadpath['basedir'])
729
  ));
730
 
@@ -756,13 +758,12 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
756
  if (isset($screen) && in_array($screen->base, array('toplevel_page_mlang', 'dashboard')))
757
  return $clauses;
758
 
759
- // FIXME this complex test allows not to filter the 'get_terms_not_translated'
760
- // maybe it's more robust to add a new arg to the function in polylang and to test it
761
- if (isset($screen) && $screen->base == 'edit-tags' && !isset($args['page']) && $args['fields'] != 'count' && !isset($args['class']) && !$args['hide_empty'])
762
  return $clauses;
763
 
764
  // The only ajax response I want to deal with is when changing the language in post metabox
765
- if (isset($_POST['action']) && $_POST['action'] != 'post_lang_choice' && $_POST['action'] != 'term_lang_choice' && $_POST['action'] != 'get-tagcloud')
766
  return $clauses;
767
 
768
  // I only want to filter the parent dropdown list when editing a term in a hierarchical taxonomy
@@ -815,17 +816,22 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
815
  $taxonomy = $_GET['taxonomy'];
816
  $lang = isset($_GET['new_lang']) ? $this->get_language($_GET['new_lang']) : $this->get_preferred_language();
817
 
818
- printf("<div class='form-field'><label for='term_lang_choice'>%s</label>\n%s<p>%s</p>\n</div>",
 
 
 
 
 
819
  __('Language', 'polylang'),
820
  $this->dropdown_languages(array('name' => 'term_lang_choice', 'value' => 'term_id', 'selected' => $lang ? $lang->term_id : '')),
821
  __('Sets the language', 'polylang')
822
  );
823
 
824
  // adds translation fields
825
- echo "<div id='term-translations' class='form-field'>";
826
  if ($lang)
827
  include(PLL_INC.'/term-translations.php');
828
- echo "</div>\n";
829
  }
830
 
831
  // adds the language field and translations tables in the 'Edit Category' and 'Edit Tag' panels
@@ -834,16 +840,25 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
834
  $lang = $this->get_term_language($term_id);
835
  $taxonomy = $tag->taxonomy;
836
 
837
- printf("<tr class='form-field'><th scope='row' valign='top'><label for='term_lang_choice'>%s</label></th>", __('Language', 'polylang'));
838
- printf("<td>%s<br /><span class='description'>%s</span></td></tr>",
 
 
 
 
 
 
 
 
 
839
  $this->dropdown_languages(array('name' => 'term_lang_choice', 'value' => 'term_id', 'selected' => $lang ? $lang->term_id : '')),
840
  __('Sets the language', 'polylang')
841
  );
842
 
843
- echo "<tr id='term-translations' class='form-field'>";
844
  if ($lang)
845
  include(PLL_INC.'/term-translations.php');
846
- echo "</tr>\n";
847
  }
848
 
849
  // adds the language column (before the posts column) in the 'Categories' or 'Post Tags' table
@@ -908,6 +923,16 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
908
  elseif (isset($_POST['post_lang_choice']))
909
  $this->set_term_language($term_id, $_POST['post_lang_choice']);
910
 
 
 
 
 
 
 
 
 
 
 
911
  if (!isset($_POST['term_tr_lang']))
912
  return;
913
 
@@ -940,6 +965,7 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
940
  ));
941
 
942
  // associate translated term to translated post
 
943
  foreach ($this->get_languages_list() as $language) {
944
  if ($translated_term = $this->get_term($term_id, $language)) {
945
  foreach ($posts as $post_id) {
@@ -995,7 +1021,9 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
995
  // returns all terms in the $taxonomy in the $term_language which have no translation in the $translation_language
996
  function get_terms_not_translated($taxonomy, $term_language, $translation_language) {
997
  $new_terms = array();
998
- foreach (get_terms($taxonomy, 'hide_empty=0') as $term) {
 
 
999
  $lang = $this->get_term_language($term->term_id);
1000
  if ($lang && $lang->name == $term_language->name && !$this->get_translation('term', $term->term_id, $translation_language))
1001
  $new_terms[] = $term;
@@ -1078,7 +1106,11 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
1078
 
1079
  // form for language user preference
1080
  function personal_options($profileuser) {
1081
- printf('<tr><th><label for="user_lang">%s</label></th><td>%s</td></tr>',
 
 
 
 
1082
  __('Admin language', 'polylang'),
1083
  $this->dropdown_languages(array(
1084
  'name' => 'user_lang',
55
  // adds actions and filters related to languages when creating, saving or deleting posts and pages
56
  add_filter('wp_insert_post_parent', array(&$this, 'wp_insert_post_parent'));
57
  add_action('dbx_post_advanced', array(&$this, 'dbx_post_advanced'));
58
+ add_action('save_post', array(&$this, 'save_post'), 21, 2); // priority 21 to come after advanced custom fields (20) and before the event calendar which breaks everything after 25
59
  add_action('before_delete_post', array(&$this, 'delete_post'));
60
 
61
  if ($this->options['media_support']) {
263
  $this->get_preferred_language());
264
 
265
  // NOTE: the class "tags-input" allows to include the field in the autosave $_POST (see autosave.js)
266
+ printf('
267
+ <p><em>%s</em></p>
268
+ <p>%s<br /></p>
269
+ <div id="post-translations" class="translations">',
270
  __('Language', 'polylang'),
271
  $this->dropdown_languages(array(
272
  'name' => $post_type == 'attachment' ? sprintf('attachments[%d][language]', $post_ID) : 'post_lang_choice',
276
  );
277
  if ($lang)
278
  include(PLL_INC.'/'.($post_type == 'attachment' ? 'media' : 'post').'-translations.php');
279
+ echo '</div>'."\n";
280
  }
281
 
282
  // ajax response for changing the language in the post metabox
372
 
373
  $lang = $this->get_language($_GET['lang']);
374
 
375
+ $results = $wpdb->get_col( $wpdb->prepare("
376
+ SELECT t.name FROM $wpdb->term_taxonomy AS tt
377
  INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id
378
  INNER JOIN $wpdb->termmeta AS tm ON tm.term_id = t.term_id
379
  WHERE tt.taxonomy = %s AND t.name LIKE (%s) AND tm.meta_key = '_language' AND tm.meta_value = %d",
399
  return isset($_GET['from_post'], $_GET['new_lang']) && ($id = wp_get_post_parent_id($_GET['from_post'])) && ($parent = $this->get_translation('post', $id, $_GET['new_lang'])) ? $parent : $post_parent;
400
  }
401
 
402
+ // copy post metas, menu order, comment and ping status when using "Add new" (translation)
403
  // the hook was probably not intended for that but did not find a better one
 
 
404
  function dbx_post_advanced() {
405
  if (isset($_GET['from_post'], $_GET['new_lang'])) {
406
  global $post;
407
+
408
+ $this->copy_post_metas($_GET['from_post'], $post->ID, $_GET['new_lang']);
409
 
410
  $from_post = get_post($_GET['from_post']);
411
  foreach (array('menu_order', 'comment_status', 'ping_status') as $property)
420
  function copy_post_metas($from, $to, $lang, $sync = false) {
421
  // copy or synchronize terms
422
  if (!$sync || in_array('taxonomies', $this->options['sync'])) {
423
+ // FIXME quite a lot of query in foreach
424
  foreach ($this->taxonomies as $tax) {
425
  $newterms = array();
426
  $terms = get_the_terms($from, $tax);
514
  elseif ($this->get_post_language($post_id))
515
  {} // avoids breaking the language if post is updated outside the edit post page (thanks to Gonçalo Peres)
516
 
517
+ elseif (($parent_id = wp_get_post_parent_id($post_id)) && $parent_lang = $this->get_post_language($parent_id))
518
+ $this->set_post_language($post_id, $parent_lang);
519
+
520
  else
521
  $this->set_post_language($post_id, $this->get_preferred_language());
522
 
 
 
 
 
 
523
  if (!isset($_POST['post_lang_choice']))
524
  return;
525
 
526
  // make sure we get save terms in the right language (especially tags with same name in different languages)
527
  if ($_POST['post_lang_choice']) {
528
+ // FIXME quite a lot of query in foreach
529
  foreach ($this->taxonomies as $tax) {
530
  $terms = get_the_terms($post_id, $tax);
531
  if (is_array($terms)) {
605
  'label' => __('Language', 'polylang'),
606
  'input' => 'html',
607
  'html' => $this->dropdown_languages(array(
608
+ 'name' => sprintf('attachments[%d][language]', $post_id),
609
+ 'class' => 'media_lang_choice',
610
  'selected' => $lang ? $lang->slug : ''
611
  ))
612
  );
643
 
644
  // Special case for WP < 3.5, first add the html generated by WP if non AJAX, then our translation table
645
  if (version_compare($GLOBALS['wp_version'], '3.5', '<'))
646
+ $data = sprintf('
647
+ <th scope="row" class="label">
648
+ <label for="attachments[%d][translations]">
649
+ <span class="alignleft">%s</span><br class="clear" />
650
  </label>
651
  </th>
652
+ <td class="field">
653
  %s
654
+ </td>',
655
  $post_id, __('Translations', 'polylang'), $data
656
  );
657
  }
724
  function wp_delete_file($file) {
725
  global $wpdb;
726
  $uploadpath = wp_upload_dir();
727
+ $ids = $wpdb->get_col($wpdb->prepare("
728
+ SELECT post_id FROM $wpdb->postmeta
729
+ WHERE meta_key = '_wp_attached_file' AND meta_value = '%s'",
730
  ltrim($file, $uploadpath['basedir'])
731
  ));
732
 
758
  if (isset($screen) && in_array($screen->base, array('toplevel_page_mlang', 'dashboard')))
759
  return $clauses;
760
 
761
+ // do not filter 'get_terms_not_translated'
762
+ if (!empty($args['pll_get_terms_not_translated']))
 
763
  return $clauses;
764
 
765
  // The only ajax response I want to deal with is when changing the language in post metabox
766
+ if (isset($_POST['action']) && !in_array($_POST['action'], array('post_lang_choice', 'term_lang_choice', 'get-tagcloud')))
767
  return $clauses;
768
 
769
  // I only want to filter the parent dropdown list when editing a term in a hierarchical taxonomy
816
  $taxonomy = $_GET['taxonomy'];
817
  $lang = isset($_GET['new_lang']) ? $this->get_language($_GET['new_lang']) : $this->get_preferred_language();
818
 
819
+ printf('
820
+ <div class="form-field">
821
+ <label for="term_lang_choice">%s</label>
822
+ %s
823
+ <p>%s</p>
824
+ </div>',
825
  __('Language', 'polylang'),
826
  $this->dropdown_languages(array('name' => 'term_lang_choice', 'value' => 'term_id', 'selected' => $lang ? $lang->term_id : '')),
827
  __('Sets the language', 'polylang')
828
  );
829
 
830
  // adds translation fields
831
+ echo '<div id="term-translations" class="form-field">';
832
  if ($lang)
833
  include(PLL_INC.'/term-translations.php');
834
+ echo '</div>'."\n";
835
  }
836
 
837
  // adds the language field and translations tables in the 'Edit Category' and 'Edit Tag' panels
840
  $lang = $this->get_term_language($term_id);
841
  $taxonomy = $tag->taxonomy;
842
 
843
+ printf('
844
+ <tr class="form-field">
845
+ <th scope="row">
846
+ <label for="term_lang_choice">%s</label>
847
+ </th>
848
+ <td>
849
+ %s<br />
850
+ <span class="description">%s</span>
851
+ </td>
852
+ </tr>',
853
+ __('Language', 'polylang'),
854
  $this->dropdown_languages(array('name' => 'term_lang_choice', 'value' => 'term_id', 'selected' => $lang ? $lang->term_id : '')),
855
  __('Sets the language', 'polylang')
856
  );
857
 
858
+ echo '<tr id="term-translations" class="form-field">';
859
  if ($lang)
860
  include(PLL_INC.'/term-translations.php');
861
+ echo '</tr>'."\n";
862
  }
863
 
864
  // adds the language column (before the posts column) in the 'Categories' or 'Post Tags' table
923
  elseif (isset($_POST['post_lang_choice']))
924
  $this->set_term_language($term_id, $_POST['post_lang_choice']);
925
 
926
+ elseif ($this->get_term_language($term_id))
927
+ {} // avoids breaking the language if the term is updated outside the edit post or edit tag pages
928
+
929
+ // sets language from term parent if exists thanks to Scott Kingsley Clark
930
+ elseif (($term = get_term($term_id, $taxonomy)) && !empty($term->parent) && $parent_lang = $this->get_term_language($term->parent))
931
+ $this->set_term_language($term_id, $parent_lang);
932
+
933
+ else
934
+ $this->set_term_language($term_id, $this->get_preferred_language());
935
+
936
  if (!isset($_POST['term_tr_lang']))
937
  return;
938
 
965
  ));
966
 
967
  // associate translated term to translated post
968
+ // FIXME quite a lot of query in foreach
969
  foreach ($this->get_languages_list() as $language) {
970
  if ($translated_term = $this->get_term($term_id, $language)) {
971
  foreach ($posts as $post_id) {
1021
  // returns all terms in the $taxonomy in the $term_language which have no translation in the $translation_language
1022
  function get_terms_not_translated($taxonomy, $term_language, $translation_language) {
1023
  $new_terms = array();
1024
+ // it is more efficient to use one common query for all languages as son as there are more than 2
1025
+ // pll_get_terms_not_translated arg to identify this query in terms_clauses filter
1026
+ foreach (get_terms($taxonomy, 'hide_empty=0&pll_get_terms_not_translated=1') as $term) {
1027
  $lang = $this->get_term_language($term->term_id);
1028
  if ($lang && $lang->name == $term_language->name && !$this->get_translation('term', $term->term_id, $translation_language))
1029
  $new_terms[] = $term;
1106
 
1107
  // form for language user preference
1108
  function personal_options($profileuser) {
1109
+ printf('
1110
+ <tr>
1111
+ <th><label for="user_lang">%s</label></th>
1112
+ <td>%s</td>
1113
+ </tr>',
1114
  __('Admin language', 'polylang'),
1115
  $this->dropdown_languages(array(
1116
  'name' => 'user_lang',
include/auto-translate.php CHANGED
@@ -126,6 +126,12 @@ class Polylang_Auto_Translate {
126
  foreach (array('post__in', 'post__not_in') as $key) {
127
  $arr = array();
128
  if (!empty($qv[$key])) {
 
 
 
 
 
 
129
  foreach ($qv[$key] as $p)
130
  $arr[] = ($tr = pll_get_post($p)) ? $tr : $p;
131
 
@@ -138,7 +144,7 @@ class Polylang_Auto_Translate {
138
  global $polylang;
139
 
140
  if (!empty($args['include']) && isset($polylang->taxonomies) && is_array($polylang->taxonomies) && array_intersect($taxonomies, $polylang->taxonomies)) {
141
- foreach($args['include'] as $id)
142
  $arr[] = ($tr = pll_get_term($id)) ? $tr : $id;
143
 
144
  $args['include'] = $arr;
126
  foreach (array('post__in', 'post__not_in') as $key) {
127
  $arr = array();
128
  if (!empty($qv[$key])) {
129
+ // post__in used by the 2 functions below
130
+ // useless to filter them as output is already in the right language and would result in performance loss
131
+ foreach (debug_backtrace() as $trace)
132
+ if (in_array($trace['function'], array('wp_nav_menu', 'gallery_shortcode')))
133
+ return;
134
+
135
  foreach ($qv[$key] as $p)
136
  $arr[] = ($tr = pll_get_post($p)) ? $tr : $p;
137
 
144
  global $polylang;
145
 
146
  if (!empty($args['include']) && isset($polylang->taxonomies) && is_array($polylang->taxonomies) && array_intersect($taxonomies, $polylang->taxonomies)) {
147
+ foreach(wp_parse_id_list($args['include']) as $id)
148
  $arr[] = ($tr = pll_get_term($id)) ? $tr : $id;
149
 
150
  $args['include'] = $arr;
include/base.php CHANGED
@@ -39,12 +39,14 @@ abstract class Polylang_Base {
39
  $post_types[] = 'attachment';
40
  if (!empty($this->options['post_types']))
41
  $post_types = array_merge($post_types, $this->options['post_types']);
42
- $this->post_types = apply_filters('pll_get_post_types', array_combine($post_types, $post_types), false);
 
43
 
44
  $taxonomies = array('category', 'post_tag', 'nav_menu');
45
  if (!empty($this->options['taxonomies']))
46
  $taxonomies = array_merge($taxonomies, $this->options['taxonomies']);
47
- $this->taxonomies = apply_filters('pll_get_taxonomies', array_combine($taxonomies, $taxonomies), false);
 
48
  }
49
 
50
  // returns the list of available languages
@@ -90,7 +92,7 @@ abstract class Polylang_Base {
90
  esc_html($language->name)
91
  );
92
  }
93
- $out .= "</select>\n";
94
  return $out;
95
  }
96
 
39
  $post_types[] = 'attachment';
40
  if (!empty($this->options['post_types']))
41
  $post_types = array_merge($post_types, $this->options['post_types']);
42
+ $post_types = apply_filters('pll_get_post_types', array_combine($post_types, $post_types), false);
43
+ $this->post_types = array_intersect($post_types, get_post_types()); // only valid registered post types
44
 
45
  $taxonomies = array('category', 'post_tag', 'nav_menu');
46
  if (!empty($this->options['taxonomies']))
47
  $taxonomies = array_merge($taxonomies, $this->options['taxonomies']);
48
+ $taxonomies = apply_filters('pll_get_taxonomies', array_combine($taxonomies, $taxonomies), false);
49
+ $this->taxonomies = array_intersect($taxonomies, get_taxonomies()); // only valid registered taxonomies
50
  }
51
 
52
  // returns the list of available languages
92
  esc_html($language->name)
93
  );
94
  }
95
+ $out .= '</select>'."\n";
96
  return $out;
97
  }
98
 
include/core.php CHANGED
@@ -3,6 +3,7 @@
3
  // used only for frontend
4
  class Polylang_Core extends Polylang_base {
5
  public $curlang; // current language
 
6
 
7
  private $default_locale;
8
  private $list_textdomains = array(); // all text domains
@@ -240,8 +241,7 @@ class Polylang_Core extends Polylang_base {
240
  // this function was hooked to setup_theme with priority 5 (after Polylang::init)
241
  // has been moved to plugins_loaded, 1 due to WPSEO and to be consistent with WPML
242
  // but $wp_rewrite is not defined yet, so let register our taxonomy partially
243
- $index = 'index.php'; // $wp_rewrite->index is hardcoded in wp-includes/rewrite.php
244
- register_taxonomy('language', null , array('label' => false, 'query_var'=>'lang', 'rewrite'=>false));
245
 
246
  if (!$languages_list = $this->get_languages_list())
247
  return;
@@ -263,7 +263,7 @@ class Polylang_Core extends Polylang_base {
263
  // some PHP setups turn requests for / into /index.php in REQUEST_URI
264
  // thanks to Gonçalo Peres for pointing out the issue with queries unknown to WP
265
  // http://wordpress.org/support/topic/plugin-polylang-language-homepage-redirection-problem-and-solution-but-incomplete?replies=4#post-2729566
266
- if (str_replace('www.', '', home_url('/')) == trailingslashit((is_ssl() ? 'https://' : 'http://').str_replace('www.', '', $_SERVER['HTTP_HOST']).str_replace(array($index, '?'.$_SERVER['QUERY_STRING']), array('', ''), $_SERVER['REQUEST_URI']))) {
267
  // take care to post & page preview http://wordpress.org/support/topic/static-frontpage-url-parameter-url-language-information
268
  if (isset($_GET['preview']) && ( (isset($_GET['p']) && $id = $_GET['p']) || (isset($_GET['page_id']) && $id = $_GET['page_id']) ))
269
  $this->curlang = ($lg = $this->get_post_language($id)) ? $lg : $this->get_language($this->options['default_lang']);
@@ -282,7 +282,7 @@ class Polylang_Core extends Polylang_base {
282
 
283
  // first test for wp-login, wp-signup, wp-activate
284
  // stripos for case insensitive file systems
285
- elseif (false === stripos($_SERVER['SCRIPT_NAME'], $index) || !$this->options['hide_default'])
286
  $this->curlang = $this->get_preferred_language();
287
 
288
  else
@@ -475,8 +475,7 @@ class Polylang_Core extends Polylang_base {
475
 
476
  // special case for wp-signup.php & wp-activate.php
477
  // stripos for case insensitive file systems
478
- // $wp_rewrite->index is hardcoded in wp-includes/rewrite.php
479
- if (false === stripos($_SERVER['SCRIPT_NAME'], 'index.php')) {
480
  $this->curlang = $this->get_preferred_language();
481
  return;
482
  }
@@ -586,7 +585,7 @@ class Polylang_Core extends Polylang_base {
586
  function option_sticky_posts($posts) {
587
  if ($this->curlang && !empty($posts)) {
588
  foreach ($posts as $key=>$post_id) {
589
- if ($this->get_post_language($post_id)->term_id != $this->curlang->term_id)
590
  unset($posts[$key]);
591
  }
592
  }
@@ -596,10 +595,8 @@ class Polylang_Core extends Polylang_base {
596
  // filters categories and post tags by language when needed
597
  function terms_clauses($clauses, $taxonomies, $args) {
598
  // does nothing except on taxonomies which are filterable
599
- foreach ($taxonomies as $tax) {
600
- if (!in_array($tax, $this->taxonomies))
601
- return $clauses;
602
- }
603
 
604
  // adds our clauses to filter by language
605
  return $this->_terms_clauses($clauses, isset($args['lang']) ? $args['lang'] : $this->curlang);
@@ -610,7 +607,7 @@ class Polylang_Core extends Polylang_base {
610
  // outputs references to translated pages (if exists) in the html head section
611
  foreach ($this->get_languages_list() as $language) {
612
  if ($language->slug != $this->curlang->slug && $url = $this->get_translation_url($language))
613
- printf("<link hreflang='%s' href='%s' rel='alternate' />\n", esc_attr($language->slug), esc_url($url));
614
  }
615
  }
616
 
@@ -753,7 +750,7 @@ class Polylang_Core extends Polylang_base {
753
  function posts_where($sql) {
754
  global $wpdb;
755
  preg_match("#post_type = '([^']+)'#", $sql, $matches); // find the queried post type
756
- return !empty($matches[1]) && in_array($matches[1], $this->post_types) ? $sql . $wpdb->prepare(" AND pll_tr.term_taxonomy_id IN (%s)", $this->curlang->term_taxonomy_id) : $sql;
757
  }
758
 
759
  // modifies the author and date links to add the language parameter (as well as feed link)
@@ -842,7 +839,7 @@ class Polylang_Core extends Polylang_base {
842
  elseif (is_home() || is_tax('language') )
843
  $url = $this->get_home_url($language);
844
 
845
- return $this->translation_url[$language->slug] = (isset($url) && !is_wp_error($url) ? $url : null);
846
  }
847
 
848
  // filters the widgets according to the current language
@@ -868,28 +865,32 @@ class Polylang_Core extends Polylang_base {
868
  if (!(did_action('template_redirect') || did_action('login_init')) || rtrim($url,'/') != $this->home)
869
  return $url;
870
 
871
- $theme = get_theme_root();
872
- $is_get_search_form = false;
 
 
 
 
 
873
 
874
- // FIXME can I decrease the size of the array to improve speed?
875
  foreach (array_reverse(debug_backtrace(/*!DEBUG_BACKTRACE_PROVIDE_OBJECT|DEBUG_BACKTRACE_IGNORE_ARGS*/)) as $trace) {
876
  // searchform.php is not passed through get_search_form filter prior to WP 3.6
877
  if (isset($trace['file']) && strpos($trace['file'], 'searchform.php'))
878
  return $this->using_permalinks && version_compare($GLOBALS['wp_version'], '3.6', '<') ? $this->get_home_url($this->curlang, true) : $url;
879
 
880
- // don't interfere with get_search_form filter which I prefer to use when possible
881
- if ($trace['function'] == 'get_search_form')
882
- $is_get_search_form = true;
883
-
884
 
885
- if ($trace['function'] == 'wp_nav_menu' || $trace['function'] == 'login_footer' ||
886
- // direct call from the theme
887
- ( !$is_get_search_form && isset($trace['file']) && strpos($trace['file'], $theme) !== false && in_array($trace['function'], array('home_url', 'get_home_url', 'bloginfo', 'get_bloginfo')) ))
888
- // remove trailing slash if there is none in requested url
889
- return empty($path) ? rtrim($this->get_home_url($this->curlang), '/') : $this->get_home_url($this->curlang);
890
  }
891
 
892
- return $url;
893
  }
894
 
895
  // returns the home url in the right language
@@ -924,6 +925,9 @@ class Polylang_Core extends Polylang_base {
924
  elseif ($this->get_post_language($post_id))
925
  {}
926
 
 
 
 
927
  else
928
  $this->set_post_language($post_id, $this->get_current_language());
929
  }
@@ -939,6 +943,9 @@ class Polylang_Core extends Polylang_base {
939
  elseif ($this->get_term_language($term_id))
940
  {}
941
 
 
 
 
942
  else
943
  $this->set_term_language($term_id, $this->get_current_language());
944
  }
@@ -958,6 +965,7 @@ class Polylang_Core extends Polylang_base {
958
  'hide_if_no_translation' => 0, // don't hide the link if there is no translation
959
  'hide_current' => 0, // don't hide current language
960
  'post_id' => null, // if not null, link to translations of post defined by post_id
 
961
  );
962
  extract(wp_parse_args($args, $defaults));
963
 
@@ -965,51 +973,49 @@ class Polylang_Core extends Polylang_base {
965
  $output = $this->dropdown_languages(array('hide_empty' => $hide_if_empty, 'selected' => $this->curlang->slug));
966
 
967
  else {
968
- $output = '';
969
 
970
  foreach ($this->get_languages_list(array('hide_empty' => $hide_if_empty)) as $language) {
971
- $classes = array();
 
972
 
973
  // hide current language
974
- if ($this->curlang->term_id == $language->term_id && $hide_current)
975
  continue;
976
 
977
  $url = $post_id !== null && ($tr_id = $this->get_post($post_id, $language)) ? get_permalink($tr_id) :
978
  $post_id === null && !$force_home ? $this->get_translation_url($language) : null;
979
 
980
- if (!isset($url))
981
- $classes[] = 'no-translation ';
982
-
983
- $url = apply_filters('pll_the_language_link', $url, $language->slug, $language->description);
984
 
985
  // hide if no translation exists
986
- if (!isset($url) && $hide_if_no_translation)
987
  continue;
988
 
989
- $url = isset($url) ? $url : $this->get_home_url($language); // if the page is not translated, link to the home page
990
 
991
- array_push($classes, 'lang-item', 'lang-item-' . esc_attr($language->term_id), 'lang-item-' . esc_attr($language->slug));
992
- if ($language->term_id == $this->curlang->term_id)
 
 
 
 
 
 
 
993
  $classes[] = 'current-lang';
994
 
995
- $flag = $show_flags ? $this->get_flag($language) : '';
996
- $name = $show_names || !$show_flags ? esc_html($display_names_as == 'slug' ? $language->slug : $language->name) : '';
997
 
998
- if (isset($item)) {
999
- $i = clone $item;
1000
- $i->title = $show_flags && $show_names ? $flag.'&nbsp;'.$name : $flag.$name;
1001
- $i->url = $url;
1002
- $i->lang = $language->slug; // save this for use in nav_menu_link_attributes
1003
- $i->classes = $classes;
1004
- $output[] = $i;
1005
- }
1006
  else {
1007
  if ($menu)
1008
- $classes[] = 'menu-item'; // backward compatibility
1009
 
1010
- $output .= sprintf("<li class='%s'><a hreflang='%s' href='%s'>%s</a></li>\n",
1011
  implode(' ', $classes),
1012
- esc_attr($language->slug),
1013
  esc_url($url),
1014
  $show_flags && $show_names ? $flag.'&nbsp;'.$name : $flag.$name
1015
  );
@@ -1019,7 +1025,7 @@ class Polylang_Core extends Polylang_base {
1019
 
1020
  $output = apply_filters('pll_the_languages', $output, $args);
1021
 
1022
- if (!$echo || isset($item))
1023
  return $output;
1024
  echo $output;
1025
  }
3
  // used only for frontend
4
  class Polylang_Core extends Polylang_base {
5
  public $curlang; // current language
6
+ public $index = 'index.php'; // need this before $wp_rewrite is created, also harcoded in wp-includes/rewrite.php
7
 
8
  private $default_locale;
9
  private $list_textdomains = array(); // all text domains
241
  // this function was hooked to setup_theme with priority 5 (after Polylang::init)
242
  // has been moved to plugins_loaded, 1 due to WPSEO and to be consistent with WPML
243
  // but $wp_rewrite is not defined yet, so let register our taxonomy partially
244
+ register_taxonomy('language', null , array('label' => false, 'query_var'=>'lang', 'rewrite'=>false)); // FIXME put this in base.php ?
 
245
 
246
  if (!$languages_list = $this->get_languages_list())
247
  return;
263
  // some PHP setups turn requests for / into /index.php in REQUEST_URI
264
  // thanks to Gonçalo Peres for pointing out the issue with queries unknown to WP
265
  // http://wordpress.org/support/topic/plugin-polylang-language-homepage-redirection-problem-and-solution-but-incomplete?replies=4#post-2729566
266
+ if (str_replace('www.', '', home_url('/')) == trailingslashit((is_ssl() ? 'https://' : 'http://').str_replace('www.', '', $_SERVER['HTTP_HOST']).str_replace(array($this->index, '?'.$_SERVER['QUERY_STRING']), array('', ''), $_SERVER['REQUEST_URI']))) {
267
  // take care to post & page preview http://wordpress.org/support/topic/static-frontpage-url-parameter-url-language-information
268
  if (isset($_GET['preview']) && ( (isset($_GET['p']) && $id = $_GET['p']) || (isset($_GET['page_id']) && $id = $_GET['page_id']) ))
269
  $this->curlang = ($lg = $this->get_post_language($id)) ? $lg : $this->get_language($this->options['default_lang']);
282
 
283
  // first test for wp-login, wp-signup, wp-activate
284
  // stripos for case insensitive file systems
285
+ elseif (false === stripos($_SERVER['SCRIPT_NAME'], $this->index) || !$this->options['hide_default'])
286
  $this->curlang = $this->get_preferred_language();
287
 
288
  else
475
 
476
  // special case for wp-signup.php & wp-activate.php
477
  // stripos for case insensitive file systems
478
+ if (false === stripos($_SERVER['SCRIPT_NAME'], $GLOBALS['wp_rewrite']->index)) {
 
479
  $this->curlang = $this->get_preferred_language();
480
  return;
481
  }
585
  function option_sticky_posts($posts) {
586
  if ($this->curlang && !empty($posts)) {
587
  foreach ($posts as $key=>$post_id) {
588
+ if ($this->get_post_language($post_id)->term_id != $this->curlang->term_id) // FIXME query in foreach
589
  unset($posts[$key]);
590
  }
591
  }
595
  // filters categories and post tags by language when needed
596
  function terms_clauses($clauses, $taxonomies, $args) {
597
  // does nothing except on taxonomies which are filterable
598
+ if (!array_intersect($taxonomies, $this->taxonomies))
599
+ return $clauses;
 
 
600
 
601
  // adds our clauses to filter by language
602
  return $this->_terms_clauses($clauses, isset($args['lang']) ? $args['lang'] : $this->curlang);
607
  // outputs references to translated pages (if exists) in the html head section
608
  foreach ($this->get_languages_list() as $language) {
609
  if ($language->slug != $this->curlang->slug && $url = $this->get_translation_url($language))
610
+ printf('<link hreflang="%s" href="%s" rel="alternate" />'."\n", esc_attr($language->slug), esc_url($url));
611
  }
612
  }
613
 
750
  function posts_where($sql) {
751
  global $wpdb;
752
  preg_match("#post_type = '([^']+)'#", $sql, $matches); // find the queried post type
753
+ return !empty($matches[1]) && in_array($matches[1], $this->post_types) ? $sql . $wpdb->prepare(" AND pll_tr.term_taxonomy_id = %d", $this->curlang->term_taxonomy_id) : $sql;
754
  }
755
 
756
  // modifies the author and date links to add the language parameter (as well as feed link)
839
  elseif (is_home() || is_tax('language') )
840
  $url = $this->get_home_url($language);
841
 
842
+ return $this->translation_url[$language->slug] = apply_filters('pll_translation_url', (isset($url) && !is_wp_error($url) ? $url : null), $language->slug);
843
  }
844
 
845
  // filters the widgets according to the current language
865
  if (!(did_action('template_redirect') || did_action('login_init')) || rtrim($url,'/') != $this->home)
866
  return $url;
867
 
868
+ $white_list = apply_filters('pll_home_url_white_list', array(
869
+ array('file' => get_theme_root()),
870
+ array('function' => 'wp_nav_menu'),
871
+ array('function' => 'login_footer')
872
+ ));
873
+
874
+ $black_list = apply_filters('pll_home_url_black_list', array(array('function' => 'get_search_form')));
875
 
 
876
  foreach (array_reverse(debug_backtrace(/*!DEBUG_BACKTRACE_PROVIDE_OBJECT|DEBUG_BACKTRACE_IGNORE_ARGS*/)) as $trace) {
877
  // searchform.php is not passed through get_search_form filter prior to WP 3.6
878
  if (isset($trace['file']) && strpos($trace['file'], 'searchform.php'))
879
  return $this->using_permalinks && version_compare($GLOBALS['wp_version'], '3.6', '<') ? $this->get_home_url($this->curlang, true) : $url;
880
 
881
+ foreach ($black_list as $v) {
882
+ if ((isset($trace['file'], $v['file']) && strpos($trace['file'], $v['file']) !== false) || (isset($trace['function'], $v['function']) && $trace['function'] == $v['function']))
883
+ return $url;
884
+ }
885
 
886
+ foreach ($white_list as $v) {
887
+ if ((isset($trace['function'], $v['function']) && $trace['function'] == $v['function']) ||
888
+ (isset($trace['file'], $v['file']) && strpos($trace['file'], $v['file']) !== false && in_array($trace['function'], array('home_url', 'get_home_url', 'bloginfo', 'get_bloginfo'))))
889
+ $ok = true;
890
+ }
891
  }
892
 
893
+ return empty($ok) ? $url : (empty($path) ? rtrim($this->get_home_url($this->curlang), '/') : $this->get_home_url($this->curlang));
894
  }
895
 
896
  // returns the home url in the right language
925
  elseif ($this->get_post_language($post_id))
926
  {}
927
 
928
+ elseif (($parent_id = wp_get_post_parent_id($post_id)) && $parent_lang = $this->get_post_language($parent_id))
929
+ $this->set_post_language($post_id, $parent_lang);
930
+
931
  else
932
  $this->set_post_language($post_id, $this->get_current_language());
933
  }
943
  elseif ($this->get_term_language($term_id))
944
  {}
945
 
946
+ elseif (($term = get_term($term_id, $taxonomy)) && !empty($term->parent) && $parent_lang = $this->get_term_language($term->parent))
947
+ $this->set_term_language($term_id, $parent_lang);
948
+
949
  else
950
  $this->set_term_language($term_id, $this->get_current_language());
951
  }
965
  'hide_if_no_translation' => 0, // don't hide the link if there is no translation
966
  'hide_current' => 0, // don't hide current language
967
  'post_id' => null, // if not null, link to translations of post defined by post_id
968
+ 'raw' => 0, // set this to true to build your own custom language switcher
969
  );
970
  extract(wp_parse_args($args, $defaults));
971
 
973
  $output = $this->dropdown_languages(array('hide_empty' => $hide_if_empty, 'selected' => $this->curlang->slug));
974
 
975
  else {
976
+ $output = !empty($raw) ? array() : '';
977
 
978
  foreach ($this->get_languages_list(array('hide_empty' => $hide_if_empty)) as $language) {
979
+ $id = (int) $language->term_id;
980
+ $slug = $language->slug;
981
 
982
  // hide current language
983
+ if ($this->curlang->term_id == $id && $hide_current)
984
  continue;
985
 
986
  $url = $post_id !== null && ($tr_id = $this->get_post($post_id, $language)) ? get_permalink($tr_id) :
987
  $post_id === null && !$force_home ? $this->get_translation_url($language) : null;
988
 
989
+ $no_translation = empty($url); // keep this for future
990
+ $url = apply_filters('pll_the_language_link', $url, $slug, $language->description);
 
 
991
 
992
  // hide if no translation exists
993
+ if (empty($url) && $hide_if_no_translation)
994
  continue;
995
 
996
+ $url = empty($url) ? $this->get_home_url($language) : $url ; // if the page is not translated, link to the home page
997
 
998
+ $name = $show_names || !$show_flags || $raw ? esc_html($display_names_as == 'slug' ? $slug : $language->name) : '';
999
+ $flag = $show_flags || $raw ? $this->get_flag($language, $raw && !$show_flags) : '';
1000
+ $current_lang = $id == $this->curlang->term_id;
1001
+
1002
+ // classes
1003
+ $classes = array('lang-item', 'lang-item-' . esc_attr($id), 'lang-item-' . esc_attr($slug));
1004
+ if ($no_translation)
1005
+ $classes[] = 'no-translation';
1006
+ if ($current_lang)
1007
  $classes[] = 'current-lang';
1008
 
1009
+ if (!empty($raw))
1010
+ $output[] = compact('id', 'slug', 'name', 'url', 'flag', 'current_lang', 'no_translation', 'classes');
1011
 
 
 
 
 
 
 
 
 
1012
  else {
1013
  if ($menu)
1014
+ $classes[] = 'menu-item'; // backward compatibility < 1.1
1015
 
1016
+ $output .= sprintf('<li class="%s"><a hreflang="%s" href="%s">%s</a></li>'."\n",
1017
  implode(' ', $classes),
1018
+ esc_attr($slug),
1019
  esc_url($url),
1020
  $show_flags && $show_names ? $flag.'&nbsp;'.$name : $flag.$name
1021
  );
1025
 
1026
  $output = apply_filters('pll_the_languages', $output, $args);
1027
 
1028
+ if (!$echo || !empty($raw))
1029
  return $output;
1030
  echo $output;
1031
  }
include/languages-form.php CHANGED
@@ -7,7 +7,7 @@
7
  // display tabs
8
  foreach ($tabs as $key=>$name)
9
  printf(
10
- '<a href="options-general.php?page=mlang&tab=%s" class="nav-tab %s">%s</a>',
11
  $key,
12
  $key == $active_tab ? 'nav-tab-active' : '',
13
  $name
@@ -79,27 +79,27 @@ if (isset($_GET['error'])) {?>
79
  </div>
80
 
81
  <div class="form-field form-required">
82
- <label for="name"><?php _e('Full name', 'polylang');?></label>
83
- <input name="name" id="name" type="text" value="<?php if ($action=='edit') echo esc_attr($edit_lang->name);?>" size="40" aria-required="true" />
84
  <p><?php _e('The name is how it is displayed on your site (for example: English).', 'polylang');?></p>
85
  </div>
86
 
87
  <div class="form-field form-required">
88
- <label for="description"><?php _e('Locale', 'polylang');?></label><?php
89
  printf(
90
- '<input name="description" id="description" type="text" value="%s" size="40" aria-required="true" />',
91
  $action=='edit' ? esc_attr($edit_lang->description) : ''
92
  );?>
93
  <p><?php _e('Wordpress Locale for the language (for example: en_US). You will need to install the .mo file for this language.', 'polylang');?></p>
94
  </div>
95
 
96
  <div class="form-field">
97
- <label for="slug"><?php _e('Language code', 'polylang');?></label>
98
- <input name="slug" id="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
 
102
- <div class="form-field">
103
  <legend><?php _e('Text direction', 'polylang');?></legend><?php
104
  printf(
105
  '<label><input name="rtl" type="radio" value="0" %s /> %s</label>',
@@ -112,11 +112,11 @@ if (isset($_GET['error'])) {?>
112
  __('right to left', 'polylang')
113
  );?>
114
  <p><?php _e('Choose the text direction for the language', 'polylang');?></p>
115
- </div>
116
 
117
  <div class="form-field">
118
- <label for="term_group"><?php _e('Order', 'polylang');?></label>
119
- <input name="term_group" id="term_group" type="text" value="<?php if ($action=='edit') echo esc_attr($edit_lang->term_group);?>" />
120
  <p><?php _e('Position of the language in the language switcher', 'polylang');?></p>
121
  </div>
122
 
@@ -157,20 +157,20 @@ break;
157
  case 'settings': ?>
158
 
159
  <div class="form-wrap">
160
- <form id="options-lang" method="post" action="admin.php?page=mlang&tab=settings&noheader=true" class="validate">
161
  <?php wp_nonce_field('options-lang', '_wpnonce_options-lang');?>
162
  <input type="hidden" name="pll_action" value="options" />
163
 
164
  <table class="form-table">
165
 
166
- <tr valign="top">
167
  <th><label for='default_lang'><?php _e('Default language', 'polylang');?></label></th>
168
  <td><?php echo $this->dropdown_languages(array('name' => 'default_lang', 'selected' => $this->options['default_lang']));?></td>
169
  </tr><?php
170
 
171
  // posts or terms without language set
172
  if ($this->get_objects_with_no_lang() && $this->options['default_lang']) {?>
173
- <tr valign="top">
174
  <th></th>
175
  <td>
176
  <label style="color: red"><?php
@@ -183,7 +183,7 @@ case 'settings': ?>
183
  </tr><?php
184
  }?>
185
 
186
- <tr valign="top">
187
  <th><?php _e('Detect browser language', 'polylang');?></th>
188
  <td>
189
  <label><?php
@@ -196,9 +196,9 @@ case 'settings': ?>
196
  </td>
197
  </tr>
198
 
199
- <tr valign="top">
200
- <th><?php _e('URL modifications', 'polylang') ?></th>
201
- <td scope="row">
202
  <label><?php
203
  printf(
204
  '<input name="force_lang" type="radio" value="0" %s /> %s',
@@ -209,7 +209,7 @@ case 'settings': ?>
209
  <label><?php
210
  printf(
211
  '<input name="force_lang" type="radio" value="1" %s %s/> %s',
212
- $this->using_permalinks ? '' : 'disabled=1',
213
  $this->options['force_lang'] ? 'checked="checked"' :'',
214
  __('The language code, for example /en/, is added to all urls when using pretty permalinks.', 'polylang')
215
  );?>
@@ -218,7 +218,7 @@ case 'settings': ?>
218
  <label><?php
219
  printf(
220
  '<input name="rewrite" type="radio" value="1" %s %s/> %s %s',
221
- $this->using_permalinks ? '' : 'disabled=1',
222
  $this->options['rewrite'] ? 'checked="checked"' : '',
223
  __('Remove /language/ in pretty permalinks. Example:', 'polylang'),
224
  '<code>'.esc_html(home_url('en/')).'</code>'
@@ -227,7 +227,7 @@ case 'settings': ?>
227
  <label><?php
228
  printf(
229
  '<input name="rewrite" type="radio" value="0" %s %s/> %s %s',
230
- $this->using_permalinks ? '' : 'disabled=1',
231
  $this->options['rewrite'] ? '' : 'checked="checked"',
232
  __('Keep /language/ in pretty permalinks. Example:', 'polylang'),
233
  '<code>'.esc_html(home_url('language/en/')).'</code>'
@@ -245,7 +245,7 @@ case 'settings': ?>
245
  <label><?php
246
  printf(
247
  '<input name="redirect_lang" type="checkbox" value="1" %s %s/> %s',
248
- get_option('page_on_front') ? '' : 'disabled=1',
249
  $this->options['redirect_lang'] ? 'checked="checked"' :'',
250
  sprintf(
251
  __('When using static front page, redirect the language page (example: %s) to the front page in the right language', 'polylang'),
@@ -256,9 +256,9 @@ case 'settings': ?>
256
  </td>
257
  </tr>
258
 
259
- <tr valign="top">
260
  <th scope="row"><?php _e('Media', 'polylang') ?></th>
261
- <td scope="row">
262
  <label><?php
263
  printf(
264
  '<input name="media_support" type="checkbox" value="1" %s /> %s',
@@ -269,9 +269,9 @@ case 'settings': ?>
269
  </td>
270
  </tr>
271
 
272
- <tr valign="top">
273
  <th scope="row"><?php _e('Synchronization', 'polylang') ?></th>
274
- <td scope="row"><ul class="pll_inline_block"><?php
275
  foreach ($this->list_metas_to_sync() as $key => $str)
276
  printf(
277
  '<li><label><input name="sync[%s]" type="checkbox" value="1" %s /> %s</label></li>',
@@ -283,9 +283,9 @@ case 'settings': ?>
283
  </tr><?php
284
 
285
  if (!empty($post_types)) {?>
286
- <tr valign="top">
287
  <th scope="row"><?php _e('Custom post types', 'polylang') ?></th>
288
- <td scope="row">
289
  <ul class="pll_inline_block"><?php
290
  foreach ($post_types as $post_type) {
291
  $pt = get_post_type_object($post_type);
@@ -303,9 +303,9 @@ case 'settings': ?>
303
  }
304
 
305
  if (!empty($taxonomies)) {?>
306
- <tr valign="top">
307
  <th scope="row"><?php _e('Custom taxonomies', 'polylang') ?></th>
308
- <td scope="row">
309
  <ul class="pll_inline_block"><?php
310
  foreach ($taxonomies as $taxonomy) {
311
  $tax = get_taxonomy($taxonomy);
7
  // display tabs
8
  foreach ($tabs as $key=>$name)
9
  printf(
10
+ '<a href="options-general.php?page=mlang&amp;tab=%s" class="nav-tab %s">%s</a>',
11
  $key,
12
  $key == $active_tab ? 'nav-tab-active' : '',
13
  $name
79
  </div>
80
 
81
  <div class="form-field form-required">
82
+ <label for="lang_name"><?php _e('Full name', 'polylang');?></label>
83
+ <input name="name" id="lang_name" type="text" value="<?php if ($action=='edit') echo esc_attr($edit_lang->name);?>" size="40" aria-required="true" />
84
  <p><?php _e('The name is how it is displayed on your site (for example: English).', 'polylang');?></p>
85
  </div>
86
 
87
  <div class="form-field form-required">
88
+ <label for="lang_locale"><?php _e('Locale', 'polylang');?></label><?php
89
  printf(
90
+ '<input name="description" id="lang_locale" type="text" value="%s" size="40" aria-required="true" />',
91
  $action=='edit' ? esc_attr($edit_lang->description) : ''
92
  );?>
93
  <p><?php _e('Wordpress Locale for the language (for example: en_US). You will need to install the .mo file for this language.', 'polylang');?></p>
94
  </div>
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
 
102
+ <div class="form-field"><fieldset>
103
  <legend><?php _e('Text direction', 'polylang');?></legend><?php
104
  printf(
105
  '<label><input name="rtl" type="radio" value="0" %s /> %s</label>',
112
  __('right to left', 'polylang')
113
  );?>
114
  <p><?php _e('Choose the text direction for the language', 'polylang');?></p>
115
+ </fieldset></div>
116
 
117
  <div class="form-field">
118
+ <label for="lang_order"><?php _e('Order', 'polylang');?></label>
119
+ <input name="term_group" id="lang_order" type="text" value="<?php if ($action=='edit') echo esc_attr($edit_lang->term_group);?>" />
120
  <p><?php _e('Position of the language in the language switcher', 'polylang');?></p>
121
  </div>
122
 
157
  case 'settings': ?>
158
 
159
  <div class="form-wrap">
160
+ <form id="options-lang" method="post" action="admin.php?page=mlang&amp;tab=settings&amp;noheader=true" class="validate">
161
  <?php wp_nonce_field('options-lang', '_wpnonce_options-lang');?>
162
  <input type="hidden" name="pll_action" value="options" />
163
 
164
  <table class="form-table">
165
 
166
+ <tr>
167
  <th><label for='default_lang'><?php _e('Default language', 'polylang');?></label></th>
168
  <td><?php echo $this->dropdown_languages(array('name' => 'default_lang', 'selected' => $this->options['default_lang']));?></td>
169
  </tr><?php
170
 
171
  // posts or terms without language set
172
  if ($this->get_objects_with_no_lang() && $this->options['default_lang']) {?>
173
+ <tr>
174
  <th></th>
175
  <td>
176
  <label style="color: red"><?php
183
  </tr><?php
184
  }?>
185
 
186
+ <tr>
187
  <th><?php _e('Detect browser language', 'polylang');?></th>
188
  <td>
189
  <label><?php
196
  </td>
197
  </tr>
198
 
199
+ <tr>
200
+ <th scope="row"><?php _e('URL modifications', 'polylang') ?></th>
201
+ <td>
202
  <label><?php
203
  printf(
204
  '<input name="force_lang" type="radio" value="0" %s /> %s',
209
  <label><?php
210
  printf(
211
  '<input name="force_lang" type="radio" value="1" %s %s/> %s',
212
+ $this->using_permalinks ? '' : 'disabled',
213
  $this->options['force_lang'] ? 'checked="checked"' :'',
214
  __('The language code, for example /en/, is added to all urls when using pretty permalinks.', 'polylang')
215
  );?>
218
  <label><?php
219
  printf(
220
  '<input name="rewrite" type="radio" value="1" %s %s/> %s %s',
221
+ $this->using_permalinks ? '' : 'disabled',
222
  $this->options['rewrite'] ? 'checked="checked"' : '',
223
  __('Remove /language/ in pretty permalinks. Example:', 'polylang'),
224
  '<code>'.esc_html(home_url('en/')).'</code>'
227
  <label><?php
228
  printf(
229
  '<input name="rewrite" type="radio" value="0" %s %s/> %s %s',
230
+ $this->using_permalinks ? '' : 'disabled',
231
  $this->options['rewrite'] ? '' : 'checked="checked"',
232
  __('Keep /language/ in pretty permalinks. Example:', 'polylang'),
233
  '<code>'.esc_html(home_url('language/en/')).'</code>'
245
  <label><?php
246
  printf(
247
  '<input name="redirect_lang" type="checkbox" value="1" %s %s/> %s',
248
+ get_option('page_on_front') ? '' : 'disabled',
249
  $this->options['redirect_lang'] ? 'checked="checked"' :'',
250
  sprintf(
251
  __('When using static front page, redirect the language page (example: %s) to the front page in the right language', 'polylang'),
256
  </td>
257
  </tr>
258
 
259
+ <tr>
260
  <th scope="row"><?php _e('Media', 'polylang') ?></th>
261
+ <td>
262
  <label><?php
263
  printf(
264
  '<input name="media_support" type="checkbox" value="1" %s /> %s',
269
  </td>
270
  </tr>
271
 
272
+ <tr>
273
  <th scope="row"><?php _e('Synchronization', 'polylang') ?></th>
274
+ <td><ul class="pll_inline_block"><?php
275
  foreach ($this->list_metas_to_sync() as $key => $str)
276
  printf(
277
  '<li><label><input name="sync[%s]" type="checkbox" value="1" %s /> %s</label></li>',
283
  </tr><?php
284
 
285
  if (!empty($post_types)) {?>
286
+ <tr>
287
  <th scope="row"><?php _e('Custom post types', 'polylang') ?></th>
288
+ <td>
289
  <ul class="pll_inline_block"><?php
290
  foreach ($post_types as $post_type) {
291
  $pt = get_post_type_object($post_type);
303
  }
304
 
305
  if (!empty($taxonomies)) {?>
306
+ <tr>
307
  <th scope="row"><?php _e('Custom taxonomies', 'polylang') ?></th>
308
+ <td>
309
  <ul class="pll_inline_block"><?php
310
  foreach ($taxonomies as $taxonomy) {
311
  $tax = get_taxonomy($taxonomy);
include/list-table.php CHANGED
@@ -11,7 +11,7 @@ class Polylang_Languages_Table extends WP_List_Table {
11
  parent::__construct(array(
12
  'singular' => __('Language','polylang'),
13
  'plural' => __('Languages','polylang'),
14
- 'ajax' => false
15
  ));
16
  }
17
 
@@ -22,21 +22,20 @@ class Polylang_Languages_Table extends WP_List_Table {
22
  function column_name($item) {
23
  $edit_link = esc_url(admin_url('admin.php?page=mlang&amp;pll_action=edit&amp;lang=' . $item['term_id']));
24
  $delete_link = wp_nonce_url('?page=mlang&amp;pll_action=delete&amp;noheader=true&amp;lang=' . $item['term_id'], 'delete-lang');
25
- $actions = array(
26
- 'edit' => '<a href="' . $edit_link . '">' . __('Edit','polylang') . '</a>',
27
- 'delete' => '<a href="' . $delete_link .'">' . __('Delete','polylang') .'</a>'
28
- );
29
- return $item['name'] . $this->row_actions($actions);
30
  }
31
 
32
  function get_columns() {
33
  return array(
34
- 'name' => __('Full name', 'polylang'),
35
  'description' => __('Locale', 'polylang'),
36
- 'slug' => __('Code', 'polylang'),
37
  'term_group' => __('Order', 'polylang'),
38
- 'flag' => __('Flag', 'polylang'),
39
- 'count' => __('Posts', 'polylang')
40
  );
41
  }
42
 
@@ -95,7 +94,7 @@ class Polylang_String_Table extends WP_List_Table {
95
  return sprintf(
96
  '<input type="checkbox" name="strings[]" value="%s" %s />',
97
  esc_attr($item['row']),
98
- empty($item['icl']) ? 'disabled = 1' : ''
99
  );
100
  }
101
 
@@ -181,7 +180,7 @@ class Polylang_String_Table extends WP_List_Table {
181
  esc_html($group)
182
  );
183
  }
184
- echo "</select>\n";
185
 
186
  submit_button( __( 'Filter' ), 'button', false, false, array( 'id' => 'post-query-submit' ) );
187
  }
11
  parent::__construct(array(
12
  'singular' => __('Language','polylang'),
13
  'plural' => __('Languages','polylang'),
14
+ 'ajax' => false
15
  ));
16
  }
17
 
22
  function column_name($item) {
23
  $edit_link = esc_url(admin_url('admin.php?page=mlang&amp;pll_action=edit&amp;lang=' . $item['term_id']));
24
  $delete_link = wp_nonce_url('?page=mlang&amp;pll_action=delete&amp;noheader=true&amp;lang=' . $item['term_id'], 'delete-lang');
25
+ return $item['name'] . $this->row_actions(array(
26
+ 'edit' => sprintf('<a href="%s">%s</a>', $edit_link, __('Edit','polylang')),
27
+ 'delete' => sprintf('<a href="%s">%s</a>', $delete_link, __('Delete','polylang'))
28
+ ));
 
29
  }
30
 
31
  function get_columns() {
32
  return array(
33
+ 'name' => __('Full name', 'polylang'),
34
  'description' => __('Locale', 'polylang'),
35
+ 'slug' => __('Code', 'polylang'),
36
  'term_group' => __('Order', 'polylang'),
37
+ 'flag' => __('Flag', 'polylang'),
38
+ 'count' => __('Posts', 'polylang')
39
  );
40
  }
41
 
94
  return sprintf(
95
  '<input type="checkbox" name="strings[]" value="%s" %s />',
96
  esc_attr($item['row']),
97
+ empty($item['icl']) ? 'disabled' : ''
98
  );
99
  }
100
 
180
  esc_html($group)
181
  );
182
  }
183
+ echo '</select>'."\n";
184
 
185
  submit_button( __( 'Filter' ), 'button', false, false, array( 'id' => 'post-query-submit' ) );
186
  }
include/nav-menu.php CHANGED
@@ -193,13 +193,20 @@ class Polylang_Nav_Menu {
193
 
194
  foreach ($items as $key => $item) {
195
  if ($options = get_post_meta($item->ID, '_pll_menu_item', true)) {
 
196
  $i = 0;
197
 
198
- foreach ($lang_items = $polylang->the_languages(array_merge(array('item' => $item), $options)) as $lang_item)
 
 
 
 
 
 
199
  $lang_item->menu_order += $offset + $i++;
200
-
 
201
  $offset += $i - 1;
202
- $new_items = array_merge($new_items, $lang_items);
203
  }
204
  else {
205
  $item->menu_order += $offset;
193
 
194
  foreach ($items as $key => $item) {
195
  if ($options = get_post_meta($item->ID, '_pll_menu_item', true)) {
196
+ extract($options);
197
  $i = 0;
198
 
199
+ foreach ($polylang->the_languages(array_merge(array('raw' => 1), $options)) as $language) {
200
+ extract($language);
201
+ $lang_item = clone $item;
202
+ $lang_item->title = $show_flags && $show_names ? $flag.'&nbsp;'.$name : ($show_flags ? $flag : $name);
203
+ $lang_item->url = $url;
204
+ $lang_item->lang = $slug; // save this for use in nav_menu_link_attributes
205
+ $lang_item->classes = $classes;
206
  $lang_item->menu_order += $offset + $i++;
207
+ $new_items[] = $lang_item;
208
+ }
209
  $offset += $i - 1;
 
210
  }
211
  else {
212
  $item->menu_order += $offset;
include/plugins-compat.php CHANGED
@@ -9,10 +9,9 @@ class Polylang_Plugins_Compat {
9
  add_action('init', create_function('',"\$GLOBALS['wp_taxonomies']['language']->yarpp_support = 1;"), 20);
10
 
11
  // WordPress SEO by Yoast
12
- if ($polylang->is_admin)
13
- add_filter('override_load_textdomain', array(&$this, 'wpseo_override_load_textdomain'), 10, 2);
14
-
15
  add_filter('get_terms_args', array(&$this, 'wpseo_remove_terms_filter'));
 
16
 
17
  // Custom field template
18
  add_action('dbx_post_advanced', array(&$this, 'cft_copy'));
9
  add_action('init', create_function('',"\$GLOBALS['wp_taxonomies']['language']->yarpp_support = 1;"), 20);
10
 
11
  // WordPress SEO by Yoast
12
+ add_filter('override_load_textdomain', array(&$this, 'wpseo_override_load_textdomain'), 10, 2);
 
 
13
  add_filter('get_terms_args', array(&$this, 'wpseo_remove_terms_filter'));
14
+ add_filter('pll_home_url_white_list', create_function('$arr', "return array_merge(\$arr, array(array('file' => 'wordpress-seo')));"));
15
 
16
  // Custom field template
17
  add_action('dbx_post_advanced', array(&$this, 'cft_copy'));
include/term-translations.php CHANGED
@@ -3,7 +3,7 @@
3
 
4
  if (isset($term_id)) {
5
  // edit term form?>
6
- <th scope="row" valign="top"><?php _e('Translations', 'polylang');?></th>
7
  <td><?php
8
  }
9
  else {
3
 
4
  if (isset($term_id)) {
5
  // edit term form?>
6
+ <th scope="row"><?php _e('Translations', 'polylang');?></th>
7
  <td><?php
8
  }
9
  else {
include/wpml-compat.php CHANGED
@@ -44,14 +44,14 @@ if (!function_exists('icl_get_languages')) {
44
  foreach ($polylang->get_languages_list(array('hide_empty' => true, 'orderby' => $orderby, 'order' => $order)) as $lang) {
45
  $url = $polylang->get_translation_url($lang);
46
 
47
- if (!$url && !empty($skip_missing))
48
  continue;
49
 
50
  $arr[] = array(
51
  'id' => $lang->term_id,
52
  'active' => isset($polylang->curlang->slug) && $polylang->curlang->slug == $lang->slug ? 1 : 0,
53
  'native_name' => $lang->name,
54
- 'missing' => $url ? 0 : 1,
55
  'translated_name' => '', // does not exist in Polylang
56
  'language_code' => $lang->slug,
57
  'country_flag_url' => $polylang->get_flag($lang, true),
@@ -114,7 +114,6 @@ if (!function_exists('icl_object_id')) {
114
 
115
  /*
116
  * registers a string for translation in the "strings translation" panel
117
- * the parameter $context is not used by Polylang
118
  */
119
  if (!function_exists('icl_register_string')) {
120
  function icl_register_string($context, $name, $string) {
@@ -124,7 +123,6 @@ if (!function_exists('icl_register_string')) {
124
 
125
  /*
126
  * removes a string from the "strings translation" panel
127
- * the parameter $context is not used by Polylang
128
  */
129
  if (!function_exists('icl_unregister_string')) {
130
  function icl_unregister_string($context, $name) {
@@ -146,6 +144,7 @@ if (!function_exists('icl_t')) {
146
  * undocumented function used by NextGen Gallery
147
  * seems to be used to both register and translate a string
148
  * the parameters $context and $bool are not used by Polylang
 
149
  */
150
  if (!function_exists('icl_translate')) {
151
  function icl_translate($context, $name, $string, $bool) {
@@ -154,6 +153,29 @@ if (!function_exists('icl_translate')) {
154
  }
155
  }
156
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  /*
158
  * registers strings in a persistant way as done by WPML
159
  */
44
  foreach ($polylang->get_languages_list(array('hide_empty' => true, 'orderby' => $orderby, 'order' => $order)) as $lang) {
45
  $url = $polylang->get_translation_url($lang);
46
 
47
+ if (empty($url) && !empty($skip_missing))
48
  continue;
49
 
50
  $arr[] = array(
51
  'id' => $lang->term_id,
52
  'active' => isset($polylang->curlang->slug) && $polylang->curlang->slug == $lang->slug ? 1 : 0,
53
  'native_name' => $lang->name,
54
+ 'missing' => empty($url) ? 1 : 0,
55
  'translated_name' => '', // does not exist in Polylang
56
  'language_code' => $lang->slug,
57
  'country_flag_url' => $polylang->get_flag($lang, true),
114
 
115
  /*
116
  * registers a string for translation in the "strings translation" panel
 
117
  */
118
  if (!function_exists('icl_register_string')) {
119
  function icl_register_string($context, $name, $string) {
123
 
124
  /*
125
  * removes a string from the "strings translation" panel
 
126
  */
127
  if (!function_exists('icl_unregister_string')) {
128
  function icl_unregister_string($context, $name) {
144
  * undocumented function used by NextGen Gallery
145
  * seems to be used to both register and translate a string
146
  * the parameters $context and $bool are not used by Polylang
147
+ * FIXME: tested only with NextGen gallery
148
  */
149
  if (!function_exists('icl_translate')) {
150
  function icl_translate($context, $name, $string, $bool) {
153
  }
154
  }
155
 
156
+ /*
157
+ * undocumented function used by Types
158
+ * FIXME: tested only with Types
159
+ * probably incomplete as Types locks the custom fields for a new post, but not when edited
160
+ * this is probably linked to the fact that WPML has always an original post in the default language and not Polylang :)
161
+ */
162
+ if (!function_exists('wpml_get_copied_fields_for_post_edit')) {
163
+ function wpml_get_copied_fields_for_post_edit() {
164
+ if (empty($_GET['from_post']))
165
+ return array();
166
+
167
+ // don't know what WPML does but Polylang does copy all public meta keys by default
168
+ foreach ($keys = array_unique(array_keys(get_post_custom($_GET['from_post']))) as $k => $meta_key)
169
+ if (is_protected_meta($meta_key))
170
+ unset ($keys[$k]);
171
+
172
+ // apply our filter and fill the expected output (see /types/embedded/includes/fields-post.php)
173
+ $arr['fields'] = array_unique(apply_filters('pll_copy_post_metas', empty($keys) ? array() : $keys, false));
174
+ $arr['original_post_id'] = (int) $_GET['from_post'];
175
+ return $arr;
176
+ }
177
+ }
178
+
179
  /*
180
  * registers strings in a persistant way as done by WPML
181
  */
languages/polylang-ca.mo CHANGED
Binary file
languages/polylang-ca.po CHANGED
@@ -4,7 +4,7 @@ msgstr ""
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: 2012-08-19 20:12+0100\n"
6
  "PO-Revision-Date: \n"
7
- "Last-Translator: Pau Moreno <pau.moreno@gmail.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
@@ -19,18 +19,34 @@ msgstr ""
19
 
20
  #: include/about.php:3
21
  #, php-format
22
- msgid "Polylang is provided with an extensive %sdocumentation%s (in English only). It includes information on how to set up your multilingual site and use it on a daily basis, a FAQ, as well as a documentation for programmers to adapt their plugins and themes."
23
- msgstr "Polylang es distribueix amb una %sdocumentació%s extensa (només en anglès). Inclou informació de com crear un lloc web multilingüe i com fer-ne un ús diari, una pàgina de preguntes freqüents, així com informació per tal que els programadors puguin adaptar-ne els plugins i temes."
 
 
 
 
 
 
 
 
24
 
25
  #: include/about.php:9
26
  #, php-format
27
- msgid "You will also find useful information in the %ssupport forum%s. However don't forget to make a search before posting a new topic."
28
- msgstr "També trobaràs informació d'interès als %sfòrums de suport%s. Però abans de crear un nou tema, no oblidis fer-ne una cerca."
 
 
 
 
29
 
30
  #: include/about.php:16
31
  #, php-format
32
- msgid "Polylang is free of charge and is released under the same license as WordPress, the %sGPL%s."
33
- msgstr "Polylang és gratuit i es distribueix sota la mateixa llicència que WordPress, %sGPL%s."
 
 
 
 
34
 
35
  #: include/about.php:22
36
  #, php-format
@@ -38,16 +54,16 @@ msgid "If you wonder how you can help the project, just %sread this%s."
38
  msgstr "Si vols saber com ajudar al projecte, llegeix %saixò%s."
39
 
40
  #: include/about.php:27
41
- msgid "Finally if you like this plugin or if it helps your business, donations to the author are greatly appreciated."
42
- msgstr "Finalment, si t'agrada aquest plugin i el trobes útil per al teu negoci, pots fer-ne un donatiu. L'autor t'ho agrairà enormement."
43
-
44
- #: include/admin-base.php:55
45
- #: include/admin-base.php:190
46
- #: include/admin-filters.php:243
47
- #: include/admin.php:23
48
- #: include/admin.php:301
49
- #: include/list-table.php:13
50
- #: polylang.php:339
51
  msgid "Languages"
52
  msgstr "Idiomes"
53
 
@@ -79,36 +95,26 @@ msgstr "Filtra el contingut per idioma"
79
  msgid "Show all languages"
80
  msgstr "Mostra tots els idiomes"
81
 
82
- #: include/admin-filters.php:181
83
- #: include/admin-filters.php:877
84
  msgid "Add new translation"
85
  msgstr "Afegeix traducció nova"
86
 
87
- #: include/admin-filters.php:209
88
- #: include/admin-filters.php:267
89
- #: include/admin-filters.php:601
90
- #: include/admin-filters.php:817
91
- #: include/admin-filters.php:835
92
- #: include/list-table.php:12
93
- #: include/media-translations.php:5
94
- #: include/media-translations.php:43
95
- #: include/post-translations.php:8
96
- #: include/term-translations.php:15
97
  #: polylang.php:340
98
  msgid "Language"
99
  msgstr "Idioma"
100
 
101
- #: include/admin-filters.php:616
102
- #: include/admin-filters.php:651
103
- #: include/list-table.php:127
104
- #: include/media-translations.php:40
105
- #: include/term-translations.php:6
106
- #: include/term-translations.php:11
107
  msgid "Translations"
108
  msgstr "Traduccions"
109
 
110
- #: include/admin-filters.php:819
111
- #: include/admin-filters.php:838
112
  msgid "Sets the language"
113
  msgstr "Estableix l'idioma"
114
 
@@ -116,8 +122,7 @@ msgstr "Estableix l'idioma"
116
  msgid "The widget is displayed for:"
117
  msgstr "El widget es mostra per a:"
118
 
119
- #: include/admin-filters.php:1057
120
- #: polylang.php:341
121
  msgid "All languages"
122
  msgstr "Tots els idiomes"
123
 
@@ -129,8 +134,7 @@ msgstr "Idioma de l'administrador"
129
  msgid "Wordpress default"
130
  msgstr "Opció per defecte de Wordpress"
131
 
132
- #: include/admin-filters.php:1114
133
- #: include/admin.php:306
134
  msgid "Settings"
135
  msgstr "Paràmetres"
136
 
@@ -142,13 +146,11 @@ msgstr "S'estan actualitzant els arxius d'idioma&#8230;"
142
  msgid "About Polylang"
143
  msgstr "Sobre Polylang"
144
 
145
- #: include/admin.php:27
146
- #: include/list-table.php:82
147
  msgid "Strings translations"
148
  msgstr "Traduccions de cadenes"
149
 
150
- #: include/admin.php:305
151
- #: include/list-table.php:81
152
  msgid "Strings translation"
153
  msgstr "Traducció de cadenes"
154
 
@@ -169,8 +171,12 @@ msgid "The language must have a name"
169
  msgstr "L'idioma ha de tenir un nom"
170
 
171
  #: include/admin.php:330
172
- msgid "The language was created, but the WordPress language file was not downloaded. Please install it manually."
173
- msgstr "S'ha creat l'idioma, però l'arxiu d'aquest idioma de WordPress no s'ha descarregat. Si us plau, instal·la'l manualment."
 
 
 
 
174
 
175
  #: include/admin.php:449
176
  msgid "Widget title"
@@ -233,8 +239,7 @@ msgstr "Imatge destacada"
233
  msgid "Edit language"
234
  msgstr "Edita idioma"
235
 
236
- #: include/languages-form.php:42
237
- #: include/languages-form.php:123
238
  msgid "Add new language"
239
  msgstr "Afegeix idioma"
240
 
@@ -246,8 +251,7 @@ msgstr "Tria idioma"
246
  msgid "You can choose a language in the list or directly edit it below."
247
  msgstr "Pots triar un idioma de la llista o editar-lo directament a sota"
248
 
249
- #: include/languages-form.php:82
250
- #: include/list-table.php:34
251
  msgid "Full name"
252
  msgstr "Nom complet"
253
 
@@ -255,14 +259,17 @@ msgstr "Nom complet"
255
  msgid "The name is how it is displayed on your site (for example: English)."
256
  msgstr "El nom és el que apareix al teu lloc web (per exemple: català)"
257
 
258
- #: include/languages-form.php:88
259
- #: include/list-table.php:35
260
  msgid "Locale"
261
  msgstr "Codi d'idioma i regió (locale)"
262
 
263
  #: include/languages-form.php:93
264
- msgid "Wordpress Locale for the language (for example: en_US). You will need to install the .mo file for this language."
265
- msgstr "Codi d'idioma i regió de Wordpress (per exemple: ca_ES). Hauràs d'instal·lar l'arxiu .mo per a aquest idioma"
 
 
 
 
266
 
267
  #: include/languages-form.php:97
268
  msgid "Language code"
@@ -288,8 +295,7 @@ msgstr "de dreta a esquerra"
288
  msgid "Choose the text direction for the language"
289
  msgstr "Tria la direcció del text de l'idioma "
290
 
291
- #: include/languages-form.php:118
292
- #: include/list-table.php:37
293
  msgid "Order"
294
  msgstr "Ordre"
295
 
@@ -297,12 +303,8 @@ msgstr "Ordre"
297
  msgid "Position of the language in the language switcher"
298
  msgstr "Posició al selector d'idioma"
299
 
300
- #: include/nav-menu.php:28
301
- #: include/nav-menu.php:51
302
- #: include/nav-menu.php:54
303
- #: include/nav-menu.php:82
304
- #: include/nav-menu.php:106
305
- #: polylang.php:302
306
  msgid "Language switcher"
307
  msgstr "Selector d'idioma"
308
 
@@ -319,28 +321,44 @@ msgid "Default language"
319
  msgstr "Idioma predeterminat"
320
 
321
  #: include/languages-form.php:179
322
- msgid "There are posts, pages, categories or tags without language set. Do you want to set them all to default language ?"
323
- msgstr "Hi ha entrades, pàgines, categories o etiquetes sense idioma establert. Per establir-hi l'idioma predeterminat, marca aquesta casella."
 
 
 
 
324
 
325
  #: include/languages-form.php:187
326
  msgid "Detect browser language"
327
  msgstr "Detecta l'idioma del navegador"
328
 
329
  #: include/languages-form.php:193
330
- msgid "When the front page is visited, set the language according to the browser preference"
331
- msgstr "Estableix l'idioma d'acord amb les preferències del navegador quan es visita la pàgina principal"
 
 
 
 
332
 
333
  #: include/languages-form.php:200
334
  msgid "URL modifications"
335
  msgstr "Modificacions d'URL"
336
 
337
  #: include/languages-form.php:206
338
- msgid "The language is set from content. Posts, pages, categories and tags urls are not modified."
339
- msgstr "L'idioma s'estableix per al contingut. Les URL de les entrades, pàgines, categories i etiquetes no seran modificades"
 
 
 
 
340
 
341
  #: include/languages-form.php:214
342
- msgid "The language code, for example /en/, is added to all urls when using pretty permalinks."
343
- msgstr "El codi d'idioma, per exemple /ca/, s'afegeix a totes les URLs en fer enllaços permanents"
 
 
 
 
344
 
345
  #: include/languages-form.php:223
346
  msgid "Remove /language/ in pretty permalinks. Example:"
@@ -356,8 +374,12 @@ msgstr "Oculta la informació d'idioma de l'URL a l'idioma predeterminat"
356
 
357
  #: include/languages-form.php:251
358
  #, php-format
359
- msgid "When using static front page, redirect the language page (example: %s) to the front page in the right language"
360
- msgstr "En fer servir una pàgina principal estàtica, redirigeix la pàgina d'idioma (per exemple: %s) a la pàgina d'inici en l'idioma correcte"
 
 
 
 
361
 
362
  # @ polylang
363
  #: include/languages-form.php:260
@@ -393,18 +415,14 @@ msgstr "Taxonomies personalitzades"
393
  msgid "Activate languages and translations for custom taxonomies."
394
  msgstr "Activa idiomes i traduccions per a taxonomies personalitzades."
395
 
396
- #: include/list-table.php:26
397
- #: include/media-translations.php:22
398
- #: include/media-translations.php:60
399
- #: include/post-translations.php:10
400
- #: include/post-translations.php:33
401
- #: include/term-translations.php:18
402
  #: include/term-translations.php:80
403
  msgid "Edit"
404
  msgstr "Edita"
405
 
406
- #: include/list-table.php:27
407
- #: include/list-table.php:162
408
  msgid "Delete"
409
  msgstr "Elimina"
410
 
@@ -428,16 +446,13 @@ msgstr "Nom"
428
  msgid "String"
429
  msgstr "Cadena"
430
 
431
- #: include/media-translations.php:6
432
- #: include/media-translations.php:44
433
  #: include/term-translations.php:16
434
  msgid "Translation"
435
  msgstr "Traducció"
436
 
437
- #: include/media-translations.php:31
438
- #: include/media-translations.php:68
439
- #: include/post-translations.php:38
440
- #: include/term-translations.php:60
441
  msgid "Add new"
442
  msgstr "Afegeix"
443
 
@@ -482,16 +497,22 @@ msgstr "Afegeix capacitat multilingüística a Wordpress"
482
  #: polylang.php:133
483
  #, php-format
484
  msgid "You are using WordPress %s. Polylang requires at least WordPress %s."
485
- msgstr "Estàs fent servir WordPress %s. Polylang requereix, com a mínim, WordPress %s."
 
 
486
 
487
  #: polylang.php:174
488
  msgid "For some reasons, Polylang could not create a table in your database."
489
- msgstr "Per alguna raó, Polylang no ha pogut crear una taula a la teva base de dades."
 
490
 
491
  # @ polylang
492
  #: polylang.php:235
493
- msgid "Polylang has been deactivated because you upgraded from a too old version."
494
- msgstr "S'ha desactivat Polylang perquè l'has actualitzat des d'una versió massa antiga."
 
 
 
495
 
496
  # @ polylang
497
  #: polylang.php:237
@@ -502,12 +523,12 @@ msgstr "Actualitza'l primer a %s abans d'actualizar-lo a %s."
502
  # @ polylang
503
  #: include/list-table.php:124
504
  msgid "Group"
505
- msgstr ""
506
 
507
  # @ polylang
508
  #: include/list-table.php:173
509
  msgid "View all groups"
510
- msgstr ""
511
 
512
  #~ msgid "Displays a language switcher at the end of the menu"
513
  #~ msgstr "Mostra un selector d'idioma al final del menú"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: 2012-08-19 20:12+0100\n"
6
  "PO-Revision-Date: \n"
7
+ "Last-Translator: Núria Martínez Berenguer <nuria.trad@gmail.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
19
 
20
  #: include/about.php:3
21
  #, php-format
22
+ msgid ""
23
+ "Polylang is provided with an extensive %sdocumentation%s (in English only). "
24
+ "It includes information on how to set up your multilingual site and use it "
25
+ "on a daily basis, a FAQ, as well as a documentation for programmers to adapt "
26
+ "their plugins and themes."
27
+ msgstr ""
28
+ "Polylang es distribueix amb una %sdocumentació%s extensa (només en anglès). "
29
+ "Inclou informació de com crear un lloc web multilingüe i com fer-ne un ús "
30
+ "diari, una pàgina de preguntes freqüents, així com informació per tal que "
31
+ "els programadors puguin adaptar-ne els plugins i temes."
32
 
33
  #: include/about.php:9
34
  #, php-format
35
+ msgid ""
36
+ "You will also find useful information in the %ssupport forum%s. However "
37
+ "don't forget to make a search before posting a new topic."
38
+ msgstr ""
39
+ "També trobaràs informació d'interès als %sfòrums de suport%s. Però abans de "
40
+ "crear un nou tema, no oblidis fer-ne una cerca."
41
 
42
  #: include/about.php:16
43
  #, php-format
44
+ msgid ""
45
+ "Polylang is free of charge and is released under the same license as "
46
+ "WordPress, the %sGPL%s."
47
+ msgstr ""
48
+ "Polylang és gratuit i es distribueix sota la mateixa llicència que "
49
+ "WordPress, %sGPL%s."
50
 
51
  #: include/about.php:22
52
  #, php-format
54
  msgstr "Si vols saber com ajudar al projecte, llegeix %saixò%s."
55
 
56
  #: include/about.php:27
57
+ msgid ""
58
+ "Finally if you like this plugin or if it helps your business, donations to "
59
+ "the author are greatly appreciated."
60
+ msgstr ""
61
+ "Finalment, si t'agrada aquest plugin i el trobes útil per al teu negoci, "
62
+ "pots fer-ne un donatiu. L'autor t'ho agrairà enormement."
63
+
64
+ #: include/admin-base.php:55 include/admin-base.php:190
65
+ #: include/admin-filters.php:243 include/admin.php:23 include/admin.php:301
66
+ #: include/list-table.php:13 polylang.php:339
67
  msgid "Languages"
68
  msgstr "Idiomes"
69
 
95
  msgid "Show all languages"
96
  msgstr "Mostra tots els idiomes"
97
 
98
+ #: include/admin-filters.php:181 include/admin-filters.php:877
 
99
  msgid "Add new translation"
100
  msgstr "Afegeix traducció nova"
101
 
102
+ #: include/admin-filters.php:209 include/admin-filters.php:267
103
+ #: include/admin-filters.php:601 include/admin-filters.php:817
104
+ #: include/admin-filters.php:835 include/list-table.php:12
105
+ #: include/media-translations.php:5 include/media-translations.php:43
106
+ #: include/post-translations.php:8 include/term-translations.php:15
 
 
 
 
 
107
  #: polylang.php:340
108
  msgid "Language"
109
  msgstr "Idioma"
110
 
111
+ #: include/admin-filters.php:616 include/admin-filters.php:651
112
+ #: include/list-table.php:127 include/media-translations.php:40
113
+ #: include/term-translations.php:6 include/term-translations.php:11
 
 
 
114
  msgid "Translations"
115
  msgstr "Traduccions"
116
 
117
+ #: include/admin-filters.php:819 include/admin-filters.php:838
 
118
  msgid "Sets the language"
119
  msgstr "Estableix l'idioma"
120
 
122
  msgid "The widget is displayed for:"
123
  msgstr "El widget es mostra per a:"
124
 
125
+ #: include/admin-filters.php:1057 polylang.php:341
 
126
  msgid "All languages"
127
  msgstr "Tots els idiomes"
128
 
134
  msgid "Wordpress default"
135
  msgstr "Opció per defecte de Wordpress"
136
 
137
+ #: include/admin-filters.php:1114 include/admin.php:306
 
138
  msgid "Settings"
139
  msgstr "Paràmetres"
140
 
146
  msgid "About Polylang"
147
  msgstr "Sobre Polylang"
148
 
149
+ #: include/admin.php:27 include/list-table.php:82
 
150
  msgid "Strings translations"
151
  msgstr "Traduccions de cadenes"
152
 
153
+ #: include/admin.php:305 include/list-table.php:81
 
154
  msgid "Strings translation"
155
  msgstr "Traducció de cadenes"
156
 
171
  msgstr "L'idioma ha de tenir un nom"
172
 
173
  #: include/admin.php:330
174
+ msgid ""
175
+ "The language was created, but the WordPress language file was not "
176
+ "downloaded. Please install it manually."
177
+ msgstr ""
178
+ "S'ha creat l'idioma, però l'arxiu d'aquest idioma de WordPress no s'ha "
179
+ "descarregat. Si us plau, instal·la'l manualment."
180
 
181
  #: include/admin.php:449
182
  msgid "Widget title"
239
  msgid "Edit language"
240
  msgstr "Edita idioma"
241
 
242
+ #: include/languages-form.php:42 include/languages-form.php:123
 
243
  msgid "Add new language"
244
  msgstr "Afegeix idioma"
245
 
251
  msgid "You can choose a language in the list or directly edit it below."
252
  msgstr "Pots triar un idioma de la llista o editar-lo directament a sota"
253
 
254
+ #: include/languages-form.php:82 include/list-table.php:34
 
255
  msgid "Full name"
256
  msgstr "Nom complet"
257
 
259
  msgid "The name is how it is displayed on your site (for example: English)."
260
  msgstr "El nom és el que apareix al teu lloc web (per exemple: català)"
261
 
262
+ #: include/languages-form.php:88 include/list-table.php:35
 
263
  msgid "Locale"
264
  msgstr "Codi d'idioma i regió (locale)"
265
 
266
  #: include/languages-form.php:93
267
+ msgid ""
268
+ "Wordpress Locale for the language (for example: en_US). You will need to "
269
+ "install the .mo file for this language."
270
+ msgstr ""
271
+ "Codi d'idioma i regió de Wordpress (per exemple: ca_ES). Hauràs d'instal·lar "
272
+ "l'arxiu .mo per a aquest idioma"
273
 
274
  #: include/languages-form.php:97
275
  msgid "Language code"
295
  msgid "Choose the text direction for the language"
296
  msgstr "Tria la direcció del text de l'idioma "
297
 
298
+ #: include/languages-form.php:118 include/list-table.php:37
 
299
  msgid "Order"
300
  msgstr "Ordre"
301
 
303
  msgid "Position of the language in the language switcher"
304
  msgstr "Posició al selector d'idioma"
305
 
306
+ #: include/nav-menu.php:28 include/nav-menu.php:51 include/nav-menu.php:54
307
+ #: include/nav-menu.php:82 include/nav-menu.php:106 polylang.php:302
 
 
 
 
308
  msgid "Language switcher"
309
  msgstr "Selector d'idioma"
310
 
321
  msgstr "Idioma predeterminat"
322
 
323
  #: include/languages-form.php:179
324
+ msgid ""
325
+ "There are posts, pages, categories or tags without language set. Do you want "
326
+ "to set them all to default language ?"
327
+ msgstr ""
328
+ "Hi ha entrades, pàgines, categories o etiquetes sense idioma establert. Per "
329
+ "establir-hi l'idioma predeterminat, marca aquesta casella."
330
 
331
  #: include/languages-form.php:187
332
  msgid "Detect browser language"
333
  msgstr "Detecta l'idioma del navegador"
334
 
335
  #: include/languages-form.php:193
336
+ msgid ""
337
+ "When the front page is visited, set the language according to the browser "
338
+ "preference"
339
+ msgstr ""
340
+ "Estableix l'idioma d'acord amb les preferències del navegador quan es visita "
341
+ "la pàgina principal"
342
 
343
  #: include/languages-form.php:200
344
  msgid "URL modifications"
345
  msgstr "Modificacions d'URL"
346
 
347
  #: include/languages-form.php:206
348
+ msgid ""
349
+ "The language is set from content. Posts, pages, categories and tags urls are "
350
+ "not modified."
351
+ msgstr ""
352
+ "L'idioma s'estableix per al contingut. Les URL de les entrades, pàgines, "
353
+ "categories i etiquetes no seran modificades"
354
 
355
  #: include/languages-form.php:214
356
+ msgid ""
357
+ "The language code, for example /en/, is added to all urls when using pretty "
358
+ "permalinks."
359
+ msgstr ""
360
+ "El codi d'idioma, per exemple /ca/, s'afegeix a totes les URLs en fer "
361
+ "enllaços permanents"
362
 
363
  #: include/languages-form.php:223
364
  msgid "Remove /language/ in pretty permalinks. Example:"
374
 
375
  #: include/languages-form.php:251
376
  #, php-format
377
+ msgid ""
378
+ "When using static front page, redirect the language page (example: %s) to "
379
+ "the front page in the right language"
380
+ msgstr ""
381
+ "En fer servir una pàgina principal estàtica, redirigeix la pàgina d'idioma "
382
+ "(per exemple: %s) a la pàgina d'inici en l'idioma correcte"
383
 
384
  # @ polylang
385
  #: include/languages-form.php:260
415
  msgid "Activate languages and translations for custom taxonomies."
416
  msgstr "Activa idiomes i traduccions per a taxonomies personalitzades."
417
 
418
+ #: include/list-table.php:26 include/media-translations.php:22
419
+ #: include/media-translations.php:60 include/post-translations.php:10
420
+ #: include/post-translations.php:33 include/term-translations.php:18
 
 
 
421
  #: include/term-translations.php:80
422
  msgid "Edit"
423
  msgstr "Edita"
424
 
425
+ #: include/list-table.php:27 include/list-table.php:162
 
426
  msgid "Delete"
427
  msgstr "Elimina"
428
 
446
  msgid "String"
447
  msgstr "Cadena"
448
 
449
+ #: include/media-translations.php:6 include/media-translations.php:44
 
450
  #: include/term-translations.php:16
451
  msgid "Translation"
452
  msgstr "Traducció"
453
 
454
+ #: include/media-translations.php:31 include/media-translations.php:68
455
+ #: include/post-translations.php:38 include/term-translations.php:60
 
 
456
  msgid "Add new"
457
  msgstr "Afegeix"
458
 
497
  #: polylang.php:133
498
  #, php-format
499
  msgid "You are using WordPress %s. Polylang requires at least WordPress %s."
500
+ msgstr ""
501
+ "Estàs fent servir WordPress %s. Polylang requereix, com a mínim, WordPress "
502
+ "%s."
503
 
504
  #: polylang.php:174
505
  msgid "For some reasons, Polylang could not create a table in your database."
506
+ msgstr ""
507
+ "Per alguna raó, Polylang no ha pogut crear una taula a la teva base de dades."
508
 
509
  # @ polylang
510
  #: polylang.php:235
511
+ msgid ""
512
+ "Polylang has been deactivated because you upgraded from a too old version."
513
+ msgstr ""
514
+ "S'ha desactivat Polylang perquè l'has actualitzat des d'una versió massa "
515
+ "antiga."
516
 
517
  # @ polylang
518
  #: polylang.php:237
523
  # @ polylang
524
  #: include/list-table.php:124
525
  msgid "Group"
526
+ msgstr "Grup"
527
 
528
  # @ polylang
529
  #: include/list-table.php:173
530
  msgid "View all groups"
531
+ msgstr "Mostra tots els grups"
532
 
533
  #~ msgid "Displays a language switcher at the end of the menu"
534
  #~ msgstr "Mostra un selector d'idioma al final del menú"
polylang.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Polylang
4
  Plugin URI: http://polylang.wordpress.com/
5
- Version: 1.1.1
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.1');
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.2
6
  Author: Frédéric Demarle
7
  Description: Adds multilingual capability to WordPress
8
  Text Domain: polylang
29
  *
30
  */
31
 
32
+ define('POLYLANG_VERSION', '1.1.2');
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.1
8
  License: GPLv2 or later
9
 
10
  Polylang adds multilingual content management support to WordPress.
@@ -24,7 +24,7 @@ Polylang allows you to create a bilingual or multilingual WordPress site. You wr
24
 
25
  = Translators =
26
 
27
- The plugin admin interface is currently available in 25 languages: English, French, German contributed by [Christian Ries](http://www.singbyfoot.lu), Russian contributed by [yoyurec](http://yoyurec.in.ua) and unostar, Greek contributed by [theodotos](http://www.ubuntucy.org), Dutch contributed by [AlbertGn](http://wordpress.org/support/profile/albertgn), Hebrew contributed by [ArielK](http://www.arielk.net), Polish contributed by [Peter Paciorkiewicz](http://www.paciorkiewicz.pl), Latvian contributed by [@AndyDeGroo](http://twitter.com/AndyDeGroo), Italian contributed by [Luca Barbetti](http://wordpress.org/support/profile/lucabarbetti), Danish contributed by [Compute](http://wordpress.org/support/profile/compute), Spanish contributed by Curro, Portuguese contributed by [Vitor Carvalho](http://vcarvalho.com/), Lithuanian contributed by [Naglis Jonaitis](http://najo.lt/), Turkish contributed by [darchws](http://darch.ws/), Finnish contributed by [Jani Alha](http://www.wysiwyg.fi), Bulgarian contributed by [pavelsof](http://wordpress.org/support/profile/pavelsof), Belarusian contributed by [Alexander Markevitch](http://fourfeathers.by/), Afrikaans contributed by [Kobus Joubert](http://translate3d.com/), Hungarian contributed by Csaba Erdei, Norwegian contributed by [Tom Boersma](http://www.oransje.com/), Slovak contributed by [Branco (WebHostingGeeks.com)](http://webhostinggeeks.com/user-reviews/), Swedish contributed by [matsii](http://wordpress.org/support/profile/matsii), Catalan contributed by [Núria Martínez Berenguer](http://nuriamb.capa.webfactional.com), Ukrainian contributed by [cmd soft](http://www.cmd-soft.com/)
28
 
29
 
30
  Other [contributions](http://polylang.wordpress.com/documentation/contribute/) are welcome !
@@ -92,6 +92,18 @@ 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.1 (2013-05-20) =
96
 
97
  * Move nav menu language switcher split from 'wp_nav_menu_objects' to 'wp_get_nav_menu_items' filter
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.2
8
  License: GPLv2 or later
9
 
10
  Polylang adds multilingual content management support to WordPress.
24
 
25
  = Translators =
26
 
27
+ The plugin admin interface is currently available in 26 languages: English, French, German contributed by [Christian Ries](http://www.singbyfoot.lu), Russian contributed by [yoyurec](http://yoyurec.in.ua) and unostar, Greek contributed by [theodotos](http://www.ubuntucy.org), Dutch contributed by [AlbertGn](http://wordpress.org/support/profile/albertgn), Hebrew contributed by [ArielK](http://www.arielk.net), Polish contributed by [Peter Paciorkiewicz](http://www.paciorkiewicz.pl), Latvian contributed by [@AndyDeGroo](http://twitter.com/AndyDeGroo), Italian contributed by [Luca Barbetti](http://wordpress.org/support/profile/lucabarbetti), Danish contributed by [Compute](http://wordpress.org/support/profile/compute), Spanish contributed by Curro, Portuguese contributed by [Vitor Carvalho](http://vcarvalho.com/), Lithuanian contributed by [Naglis Jonaitis](http://najo.lt/), Turkish contributed by [darchws](http://darch.ws/), Finnish contributed by [Jani Alha](http://www.wysiwyg.fi), Bulgarian contributed by [pavelsof](http://wordpress.org/support/profile/pavelsof), Belarusian contributed by [Alexander Markevitch](http://fourfeathers.by/), Afrikaans contributed by [Kobus Joubert](http://translate3d.com/), Hungarian contributed by Csaba Erdei, Norwegian contributed by [Tom Boersma](http://www.oransje.com/), Slovak contributed by [Branco (WebHostingGeeks.com)](http://webhostinggeeks.com/user-reviews/), Swedish contributed by [matsii](http://wordpress.org/support/profile/matsii), Catalan contributed by [Núria Martínez Berenguer](http://nuriamb.capa.webfactional.com), Ukrainian contributed by [cmd soft](http://www.cmd-soft.com/), Estonian contributed by [Ahto Naris](http://profiles.wordpress.org/ahtonaris/)
28
 
29
 
30
  Other [contributions](http://polylang.wordpress.com/documentation/contribute/) are welcome !
92
 
93
  == Changelog ==
94
 
95
+ = 1.1.2 (2013-06-18) =
96
+
97
+ * Posts and terms now inherit parent's language if created outside the standard WordPress ui
98
+ * Improve the compatibility with the plugins Types and The Events Calendar, and again with WordPress SEO
99
+ * Improve performance
100
+ * Improve html validation
101
+ * Add 'raw' argument to 'pll_the_languages'
102
+ * Add the filter 'pll_translation_url'
103
+ * Bug correction: no language is set for a (translated custom taxonomy) term when added from a (non tranlated) custom post type edit page
104
+ * Bug correction: warning if 'get_terms' is called with a non-array 'include' argument (introduced in 1.1.1)
105
+ * Bug correction: warning if the menu language switcher has nothing to display
106
+
107
  = 1.1.1 (2013-05-20) =
108
 
109
  * Move nav menu language switcher split from 'wp_nav_menu_objects' to 'wp_get_nav_menu_items' filter