Polylang - Version 3.0.2

Version Description

(2021-03-16) =

  • Move hreflang attributes higher in the head section #771
  • Fix custom flags not working (introduced in 3.0)
  • Fix translation of the confirmation modal when changing the language of a post
  • Fix js and css not loaded when Polylang is used as a mu-plugin ((introduced in 3.0))
  • Fix support for html5 stylesheet link tags #775
  • Fix possible warning in frontend-filters-links.php
  • Yoast SEO Premium: Take over the multilingual compatibility removed in Yoast SEO Premium 15.8 #796
  • Yoast SEO: Fix CPT breadcrumb title when the option is left empty #794
  • Yoast SEO: Fix sitemap.xml not redirected on secondary domains #789
Download this release

Release Info

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

Code changes from version 3.0.1 to 3.0.2

admin/admin-base.php CHANGED
@@ -188,12 +188,15 @@ abstract class PLL_Admin_Base extends PLL_Base {
188
 
189
  foreach ( $scripts as $script => $v ) {
190
  if ( in_array( $screen->base, $v[0] ) && ( $v[2] || $this->model->get_languages_list() ) ) {
191
- wp_enqueue_script( 'pll_' . $script, plugins_url( '/js/build/' . $script . $suffix . '.js', POLYLANG_BASENAME ), $v[1], POLYLANG_VERSION, $v[3] );
 
 
 
192
  }
193
  }
194
 
195
- wp_register_style( 'polylang_admin', plugins_url( '/css/build/admin' . $suffix . '.css', POLYLANG_BASENAME ), array( 'wp-jquery-ui-dialog' ), POLYLANG_VERSION );
196
- wp_enqueue_style( 'polylang_dialog', plugins_url( '/css/build/dialog' . $suffix . '.css', POLYLANG_BASENAME ), array( 'polylang_admin' ), POLYLANG_VERSION );
197
 
198
  $this->localize_scripts();
199
  }
@@ -208,7 +211,7 @@ abstract class PLL_Admin_Base extends PLL_Base {
208
  public function customize_controls_enqueue_scripts() {
209
  if ( $this->model->get_languages_list() ) {
210
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
211
- wp_enqueue_script( 'pll_widgets', plugins_url( '/js/build/widgets' . $suffix . '.js', POLYLANG_BASENAME ), array( 'jquery' ), POLYLANG_VERSION, true );
212
  $this->localize_scripts();
213
  }
214
  }
188
 
189
  foreach ( $scripts as $script => $v ) {
190
  if ( in_array( $screen->base, $v[0] ) && ( $v[2] || $this->model->get_languages_list() ) ) {
191
+ wp_enqueue_script( 'pll_' . $script, plugins_url( '/js/build/' . $script . $suffix . '.js', POLYLANG_ROOT_FILE ), $v[1], POLYLANG_VERSION, $v[3] );
192
+ if ( 'classic-editor' === $script || 'block-editor' === $script ) {
193
+ wp_set_script_translations( 'pll_' . $script, 'polylang' );
194
+ }
195
  }
196
  }
197
 
198
+ wp_register_style( 'polylang_admin', plugins_url( '/css/build/admin' . $suffix . '.css', POLYLANG_ROOT_FILE ), array( 'wp-jquery-ui-dialog' ), POLYLANG_VERSION );
199
+ wp_enqueue_style( 'polylang_dialog', plugins_url( '/css/build/dialog' . $suffix . '.css', POLYLANG_ROOT_FILE ), array( 'polylang_admin' ), POLYLANG_VERSION );
200
 
201
  $this->localize_scripts();
202
  }
211
  public function customize_controls_enqueue_scripts() {
212
  if ( $this->model->get_languages_list() ) {
213
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
214
+ wp_enqueue_script( 'pll_widgets', plugins_url( '/js/build/widgets' . $suffix . '.js', POLYLANG_ROOT_FILE ), array( 'jquery' ), POLYLANG_VERSION, true );
215
  $this->localize_scripts();
216
  }
217
  }
admin/admin-nav-menu.php CHANGED
@@ -101,7 +101,7 @@ class PLL_Admin_Nav_Menu extends PLL_Nav_Menu {
101
  }
102
 
103
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
104
- wp_enqueue_script( 'pll_nav_menu', plugins_url( '/js/build/nav-menu' . $suffix . '.js', POLYLANG_BASENAME ), array( 'jquery' ), POLYLANG_VERSION );
105
 
106
  $data = array(
107
  'strings' => PLL_Switcher::get_switcher_options( 'menu', 'string' ), // The strings for the options
101
  }
102
 
103
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
104
+ wp_enqueue_script( 'pll_nav_menu', plugins_url( '/js/build/nav-menu' . $suffix . '.js', POLYLANG_ROOT_FILE ), array( 'jquery' ), POLYLANG_VERSION );
105
 
106
  $data = array(
107
  'strings' => PLL_Switcher::get_switcher_options( 'menu', 'string' ), // The strings for the options
frontend/choose-lang.php CHANGED
@@ -96,8 +96,10 @@ abstract class PLL_Choose_Lang {
96
  // See https://wordpress.org/support/topic/detect-browser-language-sometimes-setting-null-language
97
  $this->curlang = ( $curlang instanceof PLL_Language ) ? $curlang : $this->model->get_language( $this->options['default_lang'] );
98
 
99
- $GLOBALS['text_direction'] = $this->curlang->is_rtl ? 'rtl' : 'ltr';
100
- wp_styles()->text_direction = $GLOBALS['text_direction'];
 
 
101
 
102
  /**
103
  * Fires when the current language is defined.
96
  // See https://wordpress.org/support/topic/detect-browser-language-sometimes-setting-null-language
97
  $this->curlang = ( $curlang instanceof PLL_Language ) ? $curlang : $this->model->get_language( $this->options['default_lang'] );
98
 
99
+ $GLOBALS['text_direction'] = $this->curlang->is_rtl ? 'rtl' : 'ltr';
100
+ if ( did_action( 'wp_default_styles' ) ) {
101
+ wp_styles()->text_direction = $GLOBALS['text_direction'];
102
+ }
103
 
104
  /**
105
  * Fires when the current language is defined.
frontend/frontend-filters-links.php CHANGED
@@ -57,7 +57,7 @@ class PLL_Frontend_Filters_Links extends PLL_Filters_Links {
57
  }
58
 
59
  // Meta in the html head section
60
- add_action( 'wp_head', array( $this, 'wp_head' ) );
61
 
62
  // Modifies the home url
63
  if ( ! defined( 'PLL_FILTER_HOME_URL' ) || PLL_FILTER_HOME_URL ) {
@@ -500,12 +500,15 @@ class PLL_Frontend_Filters_Links extends PLL_Filters_Links {
500
  * @since 2.9
501
  *
502
  * @param WP_Tax_Query $tax_query An instance of WP_Tax_Query.
503
- * @return int
504
  */
505
  protected function get_queried_term_id( $tax_query ) {
506
  $queried_terms = $tax_query->queried_terms;
507
  $taxonomy = $this->get_queried_taxonomy( $tax_query );
508
 
 
 
 
509
  $field = $queried_terms[ $taxonomy ]['field'];
510
  $term = reset( $queried_terms[ $taxonomy ]['terms'] );
511
 
57
  }
58
 
59
  // Meta in the html head section
60
+ add_action( 'wp_head', array( $this, 'wp_head' ), 1 );
61
 
62
  // Modifies the home url
63
  if ( ! defined( 'PLL_FILTER_HOME_URL' ) || PLL_FILTER_HOME_URL ) {
500
  * @since 2.9
501
  *
502
  * @param WP_Tax_Query $tax_query An instance of WP_Tax_Query.
503
+ * @return int|false
504
  */
505
  protected function get_queried_term_id( $tax_query ) {
506
  $queried_terms = $tax_query->queried_terms;
507
  $taxonomy = $this->get_queried_taxonomy( $tax_query );
508
 
509
+ if ( ! is_array( $queried_terms[ $taxonomy ]['terms'] ) ) {
510
+ return false;
511
+ }
512
  $field = $queried_terms[ $taxonomy ]['field'];
513
  $term = reset( $queried_terms[ $taxonomy ]['terms'] );
514
 
include/language.php CHANGED
@@ -169,14 +169,14 @@ class PLL_Language {
169
  *
170
  * @var string
171
  */
172
- protected $custom_flag_url;
173
 
174
  /**
175
  * Html markup of the custom flag if it exists.
176
  *
177
  * @var string
178
  */
179
- protected $custom_flag;
180
 
181
  /**
182
  * Constructor: builds a language object given its two corresponding terms in 'language' and 'term_language' taxonomies.
169
  *
170
  * @var string
171
  */
172
+ public $custom_flag_url;
173
 
174
  /**
175
  * Html markup of the custom flag if it exists.
176
  *
177
  * @var string
178
  */
179
+ public $custom_flag;
180
 
181
  /**
182
  * Constructor: builds a language object given its two corresponding terms in 'language' and 'term_language' taxonomies.
integrations/wpseo/wpseo.php CHANGED
@@ -5,7 +5,7 @@
5
 
6
  /**
7
  * Manages the compatibility with Yoast SEO
8
- * Version tested: 11.5
9
  *
10
  * @since 2.3
11
  */
@@ -47,48 +47,44 @@ class PLL_WPSEO {
47
  add_filter( 'wpseo_frontend_presentation', array( $this, 'frontend_presentation' ) );
48
  add_filter( 'wpseo_breadcrumb_indexables', array( $this, 'breadcrumb_indexables' ) );
49
  } else {
50
- // Primary category
51
- add_filter( 'pll_copy_post_metas', array( $this, 'copy_post_metas' ) );
52
  add_filter( 'pll_translate_post_meta', array( $this, 'translate_post_meta' ), 10, 3 );
53
  }
54
  }
55
 
56
  /**
57
- * Registers custom post types and taxonomy titles for translation.
58
  *
59
  * @since 2.9
60
  */
61
  public function wpseo_translate_options() {
62
- $keys = array();
63
-
64
- foreach ( get_post_types( array( 'public' => true, '_builtin' => false ) ) as $t ) {
65
- if ( pll_is_translated_post_type( $t ) ) {
66
- $keys[] = 'title-' . $t;
67
- $keys[] = 'metadesc-' . $t;
68
- }
69
  }
70
 
71
- foreach ( get_post_types( array( 'has_archive' => true, '_builtin' => false ) ) as $t ) {
72
- if ( pll_is_translated_post_type( $t ) ) {
73
- $keys[] = 'title-ptarchive-' . $t;
74
- $keys[] = 'metadesc-ptarchive-' . $t;
75
- $keys[] = 'bctitle-ptarchive-' . $t;
76
- }
77
- }
 
 
 
 
 
 
 
78
 
79
- foreach ( get_taxonomies( array( 'public' => true, '_builtin' => false ) ) as $t ) {
80
- if ( pll_is_translated_taxonomy( $t ) ) {
81
- $keys[] = 'title-tax-' . $t;
82
- $keys[] = 'metadesc-tax-' . $t;
83
- }
84
- }
85
 
86
- if ( ! empty( $keys ) ) {
87
- if ( method_exists( 'WPSEO_Options', 'clear_cache' ) ) {
88
- WPSEO_Options::clear_cache();
89
- }
90
- new PLL_Translate_Option( 'wpseo_titles', array_fill_keys( $keys, 1 ), array( 'context' => 'wordpress-seo' ) );
91
- }
92
  }
93
 
94
  /**
@@ -106,7 +102,7 @@ class PLL_WPSEO {
106
  $path = ltrim( wp_parse_url( pll_get_requested_url(), PHP_URL_PATH ), '/' );
107
  }
108
 
109
- if ( 'sitemap_index.xml' === $path || preg_match( '#([^/]+?)-sitemap([0-9]+)?\.xml|([a-z]+)?-?sitemap\.xsl#', $path ) ) {
110
  $url = PLL()->links_model->switch_language_in_link( $url, PLL()->curlang );
111
  }
112
 
@@ -373,6 +369,8 @@ class PLL_WPSEO {
373
  $presentation->model->permalink = pll_home_url();
374
  $presentation->model->title = WPSEO_Options::get( 'title-home-wpseo' );
375
  $presentation->model->description = WPSEO_Options::get( 'metadesc-home-wpseo' );
 
 
376
  break;
377
 
378
  case 'post-type-archive':
@@ -421,7 +419,9 @@ class PLL_WPSEO {
421
  case 'post-type-archive':
422
  if ( pll_is_translated_post_type( $indexable->object_sub_type ) ) {
423
  $indexable->permalink = get_post_type_archive_link( $indexable->object_sub_type );
424
- $indexable->breadcrumb_title = pll__( WPSEO_Options::get( 'bctitle-ptarchive-' . $indexable->object_sub_type ) );
 
 
425
  }
426
  break;
427
  }
@@ -431,14 +431,35 @@ class PLL_WPSEO {
431
  }
432
 
433
  /**
434
- * Synchronize the primary term
435
  *
436
  * @since 2.3.3
437
  *
438
- * @param array $keys List of custom fields names.
 
439
  * @return array
440
  */
441
- public function copy_post_metas( $keys ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
442
  $taxonomies = get_taxonomies(
443
  array(
444
  'hierarchical' => true,
5
 
6
  /**
7
  * Manages the compatibility with Yoast SEO
8
+ * Version tested: 15.9.2
9
  *
10
  * @since 2.3
11
  */
47
  add_filter( 'wpseo_frontend_presentation', array( $this, 'frontend_presentation' ) );
48
  add_filter( 'wpseo_breadcrumb_indexables', array( $this, 'breadcrumb_indexables' ) );
49
  } else {
50
+ add_filter( 'pll_copy_post_metas', array( $this, 'copy_post_metas' ), 10, 2 );
 
51
  add_filter( 'pll_translate_post_meta', array( $this, 'translate_post_meta' ), 10, 3 );
52
  }
53
  }
54
 
55
  /**
56
+ * Registers options for translation.
57
  *
58
  * @since 2.9
59
  */
60
  public function wpseo_translate_options() {
61
+ if ( method_exists( 'WPSEO_Options', 'clear_cache' ) ) {
62
+ WPSEO_Options::clear_cache();
 
 
 
 
 
63
  }
64
 
65
+ $keys = array(
66
+ 'title-*',
67
+ 'metadesc-*',
68
+ 'bctitle-*',
69
+ 'breadcrumbs-sep',
70
+ 'breadcrumbs-home',
71
+ 'breadcrumbs-prefix',
72
+ 'breadcrumbs-archiveprefix',
73
+ 'breadcrumbs-searchprefix',
74
+ 'breadcrumbs-404crumb',
75
+ 'company_name',
76
+ 'rssbefore',
77
+ 'rssafter',
78
+ );
79
 
80
+ new PLL_Translate_Option( 'wpseo_titles', array_fill_keys( $keys, 1 ), array( 'context' => 'wordpress-seo' ) );
 
 
 
 
 
81
 
82
+ $keys = array(
83
+ 'og_frontpage_title',
84
+ 'og_frontpage_desc',
85
+ );
86
+
87
+ new PLL_Translate_Option( 'wpseo_social', array_fill_keys( $keys, 1 ), array( 'context' => 'wordpress-seo' ) );
88
  }
89
 
90
  /**
102
  $path = ltrim( wp_parse_url( pll_get_requested_url(), PHP_URL_PATH ), '/' );
103
  }
104
 
105
+ if ( preg_match( '#sitemap(_index)?\.xml|([^\/]+?)-?sitemap([0-9]+)?\.xml|([a-z]+)?-?sitemap\.xsl#', $path ) ) {
106
  $url = PLL()->links_model->switch_language_in_link( $url, PLL()->curlang );
107
  }
108
 
369
  $presentation->model->permalink = pll_home_url();
370
  $presentation->model->title = WPSEO_Options::get( 'title-home-wpseo' );
371
  $presentation->model->description = WPSEO_Options::get( 'metadesc-home-wpseo' );
372
+ $presentation->model->open_graph_title = WPSEO_Options::get( 'og_frontpage_title' );
373
+ $presentation->model->open_graph_description = WPSEO_Options::get( 'og_frontpage_desc' );
374
  break;
375
 
376
  case 'post-type-archive':
419
  case 'post-type-archive':
420
  if ( pll_is_translated_post_type( $indexable->object_sub_type ) ) {
421
  $indexable->permalink = get_post_type_archive_link( $indexable->object_sub_type );
422
+ $breadcrumb_title = WPSEO_Options::get( 'bctitle-ptarchive-' . $indexable->object_sub_type );
423
+ $breadcrumb_title = $breadcrumb_title ? $breadcrumb_title : $indexable->breadcrumb_title; // The option may be empty.
424
+ $indexable->breadcrumb_title = pll__( $breadcrumb_title );
425
  }
426
  break;
427
  }
431
  }
432
 
433
  /**
434
+ * Copies or synchronizes the metas.
435
  *
436
  * @since 2.3.3
437
  *
438
+ * @param string[] $keys List of custom fields names.
439
+ * @param bool $sync True if it is synchronization, false if it is a copy.
440
  * @return array
441
  */
442
+ public function copy_post_metas( $keys, $sync ) {
443
+ if ( ! $sync ) {
444
+ // Text requiring translation.
445
+ $keys[] = '_yoast_wpseo_title';
446
+ $keys[] = '_yoast_wpseo_metadesc';
447
+ $keys[] = '_yoast_wpseo_bctitle';
448
+ $keys[] = '_yoast_wpseo_focuskw';
449
+ $keys[] = '_yoast_wpseo_opengraph-title';
450
+ $keys[] = '_yoast_wpseo_opengraph-description';
451
+ $keys[] = '_yoast_wpseo_twitter-title';
452
+ $keys[] = '_yoast_wpseo_twitter-description';
453
+
454
+ // Copy the image urls.
455
+ $keys[] = '_yoast_wpseo_opengraph-image';
456
+ $keys[] = '_yoast_wpseo_twitter-image';
457
+ }
458
+
459
+ $keys[] = '_yoast_wpseo_meta-robots-noindex';
460
+ $keys[] = '_yoast_wpseo_meta-robots-nofollow';
461
+ $keys[] = '_yoast_wpseo_meta-robots-adv';
462
+
463
  $taxonomies = get_taxonomies(
464
  array(
465
  'hierarchical' => true,
modules/wizard/wizard.php CHANGED
@@ -283,8 +283,8 @@ class PLL_Wizard {
283
  * @return void
284
  */
285
  public function enqueue_scripts() {
286
- wp_enqueue_style( 'polylang_admin', plugins_url( '/css/build/admin' . $this->get_suffix() . '.css', POLYLANG_BASENAME ), array(), POLYLANG_VERSION );
287
- wp_enqueue_style( 'pll-wizard', plugins_url( '/css/build/wizard' . $this->get_suffix() . '.css', POLYLANG_BASENAME ), array( 'dashicons', 'install', 'common', 'forms' ), POLYLANG_VERSION );
288
 
289
  $this->styles = array( 'polylang_admin', 'pll-wizard' );
290
  }
@@ -367,7 +367,7 @@ class PLL_Wizard {
367
 
368
  // Be careful pll_admin script is enqueued here without depedency except jquery because only code useful for deactivate license button is needed.
369
  // To be really loaded the script need to be passed to the $steps['licenses']['scripts'] array below with the same handle than in wp_enqueue_script().
370
- wp_enqueue_script( 'pll_admin', plugins_url( '/js/build/admin' . $this->get_suffix() . '.js', POLYLANG_BASENAME ), array( 'jquery' ), POLYLANG_VERSION, true );
371
  wp_localize_script( 'pll_admin', 'pll_admin', array( 'dismiss_notice' => esc_html__( 'Dismiss this notice.', 'polylang' ) ) );
372
 
373
  if ( $this->is_licenses_step_displayable() ) {
@@ -468,9 +468,9 @@ class PLL_Wizard {
468
  wp_deregister_script( 'pll_admin' ); // Deregister after the licenses step enqueue to update jquery-ui-selectmenu dependency.
469
  // The wp-ajax-response and postbox dependencies is useless in wizard steps espacially postbox which triggers a javascript error otherwise.
470
  // To be really loaded the script need to be passed to the $steps['languages']['scripts'] array below with the same handle than in wp_enqueue_script().
471
- wp_enqueue_script( 'pll_admin', plugins_url( '/js/build/admin' . $this->get_suffix() . '.js', POLYLANG_BASENAME ), array( 'jquery', 'jquery-ui-selectmenu' ), POLYLANG_VERSION, true );
472
  wp_localize_script( 'pll_admin', 'pll_admin', array( 'dismiss_notice' => esc_html__( 'Dismiss this notice.', 'polylang' ) ) );
473
- wp_register_script( 'pll-wizard-languages', plugins_url( '/js/build/languages-step' . $this->get_suffix() . '.js', POLYLANG_BASENAME ), array( 'jquery', 'jquery-ui-dialog' ), POLYLANG_VERSION, true );
474
  wp_localize_script(
475
  'pll-wizard-languages',
476
  'pll_wizard_params',
@@ -493,7 +493,7 @@ class PLL_Wizard {
493
  )
494
  );
495
  wp_enqueue_script( 'pll-wizard-languages' );
496
- wp_enqueue_style( 'pll-wizard-selectmenu', plugins_url( '/css/build/selectmenu' . $this->get_suffix() . '.css', POLYLANG_BASENAME ), array( 'dashicons', 'install', 'common', 'wp-jquery-ui-dialog' ), POLYLANG_VERSION );
497
  $steps['languages'] = array(
498
  'name' => esc_html__( 'Languages', 'polylang' ),
499
  'view' => array( $this, 'display_step_languages' ),
@@ -659,9 +659,9 @@ class PLL_Wizard {
659
  if ( ! $this->model->get_languages_list() || $this->model->get_objects_with_no_lang( 1 ) ) {
660
  // Even if pll_admin is already enqueued with the same dependencies by the languages step, it is interesting to keep that it's also useful for the untranslated-contents step.
661
  // To be really loaded the script need to be passed to the $steps['untranslated-contents']['scripts'] array below with the same handle than in wp_enqueue_script().
662
- wp_enqueue_script( 'pll_admin', plugins_url( '/js/build/admin' . $this->get_suffix() . '.js', POLYLANG_BASENAME ), array( 'jquery', 'jquery-ui-selectmenu' ), POLYLANG_VERSION, true );
663
  wp_localize_script( 'pll_admin', 'pll_admin', array( 'dismiss_notice' => esc_html__( 'Dismiss this notice.', 'polylang' ) ) );
664
- wp_enqueue_style( 'pll-wizard-selectmenu', plugins_url( '/css/build/selectmenu' . $this->get_suffix() . '.css', POLYLANG_BASENAME ), array( 'dashicons', 'install', 'common' ), POLYLANG_VERSION );
665
  $steps['untranslated-contents'] = array(
666
  'name' => esc_html__( 'Content', 'polylang' ),
667
  'view' => array( $this, 'display_step_untranslated_contents' ),
283
  * @return void
284
  */
285
  public function enqueue_scripts() {
286
+ wp_enqueue_style( 'polylang_admin', plugins_url( '/css/build/admin' . $this->get_suffix() . '.css', POLYLANG_ROOT_FILE ), array(), POLYLANG_VERSION );
287
+ wp_enqueue_style( 'pll-wizard', plugins_url( '/css/build/wizard' . $this->get_suffix() . '.css', POLYLANG_ROOT_FILE ), array( 'dashicons', 'install', 'common', 'forms' ), POLYLANG_VERSION );
288
 
289
  $this->styles = array( 'polylang_admin', 'pll-wizard' );
290
  }
367
 
368
  // Be careful pll_admin script is enqueued here without depedency except jquery because only code useful for deactivate license button is needed.
369
  // To be really loaded the script need to be passed to the $steps['licenses']['scripts'] array below with the same handle than in wp_enqueue_script().
370
+ wp_enqueue_script( 'pll_admin', plugins_url( '/js/build/admin' . $this->get_suffix() . '.js', POLYLANG_ROOT_FILE ), array( 'jquery' ), POLYLANG_VERSION, true );
371
  wp_localize_script( 'pll_admin', 'pll_admin', array( 'dismiss_notice' => esc_html__( 'Dismiss this notice.', 'polylang' ) ) );
372
 
373
  if ( $this->is_licenses_step_displayable() ) {
468
  wp_deregister_script( 'pll_admin' ); // Deregister after the licenses step enqueue to update jquery-ui-selectmenu dependency.
469
  // The wp-ajax-response and postbox dependencies is useless in wizard steps espacially postbox which triggers a javascript error otherwise.
470
  // To be really loaded the script need to be passed to the $steps['languages']['scripts'] array below with the same handle than in wp_enqueue_script().
471
+ wp_enqueue_script( 'pll_admin', plugins_url( '/js/build/admin' . $this->get_suffix() . '.js', POLYLANG_ROOT_FILE ), array( 'jquery', 'jquery-ui-selectmenu' ), POLYLANG_VERSION, true );
472
  wp_localize_script( 'pll_admin', 'pll_admin', array( 'dismiss_notice' => esc_html__( 'Dismiss this notice.', 'polylang' ) ) );
473
+ wp_register_script( 'pll-wizard-languages', plugins_url( '/js/build/languages-step' . $this->get_suffix() . '.js', POLYLANG_ROOT_FILE ), array( 'jquery', 'jquery-ui-dialog' ), POLYLANG_VERSION, true );
474
  wp_localize_script(
475
  'pll-wizard-languages',
476
  'pll_wizard_params',
493
  )
494
  );
495
  wp_enqueue_script( 'pll-wizard-languages' );
496
+ wp_enqueue_style( 'pll-wizard-selectmenu', plugins_url( '/css/build/selectmenu' . $this->get_suffix() . '.css', POLYLANG_ROOT_FILE ), array( 'dashicons', 'install', 'common', 'wp-jquery-ui-dialog' ), POLYLANG_VERSION );
497
  $steps['languages'] = array(
498
  'name' => esc_html__( 'Languages', 'polylang' ),
499
  'view' => array( $this, 'display_step_languages' ),
659
  if ( ! $this->model->get_languages_list() || $this->model->get_objects_with_no_lang( 1 ) ) {
660
  // Even if pll_admin is already enqueued with the same dependencies by the languages step, it is interesting to keep that it's also useful for the untranslated-contents step.
661
  // To be really loaded the script need to be passed to the $steps['untranslated-contents']['scripts'] array below with the same handle than in wp_enqueue_script().
662
+ wp_enqueue_script( 'pll_admin', plugins_url( '/js/build/admin' . $this->get_suffix() . '.js', POLYLANG_ROOT_FILE ), array( 'jquery', 'jquery-ui-selectmenu' ), POLYLANG_VERSION, true );
663
  wp_localize_script( 'pll_admin', 'pll_admin', array( 'dismiss_notice' => esc_html__( 'Dismiss this notice.', 'polylang' ) ) );
664
+ wp_enqueue_style( 'pll-wizard-selectmenu', plugins_url( '/css/build/selectmenu' . $this->get_suffix() . '.css', POLYLANG_ROOT_FILE ), array( 'dashicons', 'install', 'common' ), POLYLANG_VERSION );
665
  $steps['untranslated-contents'] = array(
666
  'name' => esc_html__( 'Content', 'polylang' ),
667
  'view' => array( $this, 'display_step_untranslated_contents' ),
polylang.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: Polylang
11
  * Plugin URI: https://polylang.pro
12
  * Description: Adds multilingual capability to WordPress
13
- * Version: 3.0.1
14
  * Requires at least: 5.1
15
  * Requires PHP: 5.6
16
  * Author: WP SYNTEX
@@ -53,13 +53,18 @@ if ( defined( 'POLYLANG_VERSION' ) ) {
53
  }
54
  } else {
55
  // Go on loading the plugin
56
- define( 'POLYLANG_VERSION', '3.0.1' );
57
  define( 'PLL_MIN_WP_VERSION', '5.1' );
58
  define( 'PLL_MIN_PHP_VERSION', '5.6' );
59
 
60
  define( 'POLYLANG_FILE', __FILE__ );
61
  define( 'POLYLANG_DIR', __DIR__ );
62
 
 
 
 
 
 
63
  if ( ! defined( 'POLYLANG_BASENAME' ) ) {
64
  define( 'POLYLANG_BASENAME', plugin_basename( __FILE__ ) ); // Plugin name as known by WP.
65
  require __DIR__ . '/vendor/autoload.php';
10
  * Plugin Name: Polylang
11
  * Plugin URI: https://polylang.pro
12
  * Description: Adds multilingual capability to WordPress
13
+ * Version: 3.0.2
14
  * Requires at least: 5.1
15
  * Requires PHP: 5.6
16
  * Author: WP SYNTEX
53
  }
54
  } else {
55
  // Go on loading the plugin
56
+ define( 'POLYLANG_VERSION', '3.0.2' );
57
  define( 'PLL_MIN_WP_VERSION', '5.1' );
58
  define( 'PLL_MIN_PHP_VERSION', '5.6' );
59
 
60
  define( 'POLYLANG_FILE', __FILE__ );
61
  define( 'POLYLANG_DIR', __DIR__ );
62
 
63
+ // Whether we are using Polylang or Polylang Pro, get the filename of the plugin in use.
64
+ if ( ! defined( 'POLYLANG_ROOT_FILE' ) ) {
65
+ define( 'POLYLANG_ROOT_FILE', __FILE__ );
66
+ }
67
+
68
  if ( ! defined( 'POLYLANG_BASENAME' ) ) {
69
  define( 'POLYLANG_BASENAME', plugin_basename( __FILE__ ) ); // Plugin name as known by WP.
70
  require __DIR__ . '/vendor/autoload.php';
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: multilingual, bilingual, translate, translation, language, multilanguage,
5
  Requires at least: 5.1
6
  Tested up to: 5.7
7
  Requires PHP: 5.6
8
- Stable tag: 3.0.1
9
  License: GPLv3 or later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -78,6 +78,18 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
78
 
79
  == Changelog ==
80
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  = 3.0.1 (2021-03-10) =
82
 
83
  * Fix media gallery messed when editing a post in the classic editor
5
  Requires at least: 5.1
6
  Tested up to: 5.7
7
  Requires PHP: 5.6
8
+ Stable tag: 3.0.2
9
  License: GPLv3 or later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
78
 
79
  == Changelog ==
80
 
81
+ = 3.0.2 (2021-03-16) =
82
+
83
+ * Move hreflang attributes higher in the head section #771
84
+ * Fix custom flags not working (introduced in 3.0)
85
+ * Fix translation of the confirmation modal when changing the language of a post
86
+ * Fix js and css not loaded when Polylang is used as a mu-plugin ((introduced in 3.0))
87
+ * Fix support for html5 stylesheet link tags #775
88
+ * Fix possible warning in frontend-filters-links.php
89
+ * Yoast SEO Premium: Take over the multilingual compatibility removed in Yoast SEO Premium 15.8 #796
90
+ * Yoast SEO: Fix CPT breadcrumb title when the option is left empty #794
91
+ * Yoast SEO: Fix sitemap.xml not redirected on secondary domains #789
92
+
93
  = 3.0.1 (2021-03-10) =
94
 
95
  * Fix media gallery messed when editing a post in the classic editor
settings/settings.php CHANGED
@@ -330,10 +330,10 @@ class PLL_Settings extends PLL_Admin_Base {
330
 
331
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
332
 
333
- wp_enqueue_script( 'pll_admin', plugins_url( '/js/build/admin' . $suffix . '.js', POLYLANG_BASENAME ), array( 'jquery', 'wp-ajax-response', 'postbox', 'jquery-ui-selectmenu' ), POLYLANG_VERSION, true );
334
  wp_localize_script( 'pll_admin', 'pll_admin', array( 'dismiss_notice' => esc_html__( 'Dismiss this notice.', 'polylang' ) ) );
335
 
336
- wp_enqueue_style( 'pll_selectmenu', plugins_url( '/css/build/selectmenu' . $suffix . '.css', POLYLANG_BASENAME ), array(), POLYLANG_VERSION );
337
  }
338
 
339
  /**
330
 
331
  $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
332
 
333
+ wp_enqueue_script( 'pll_admin', plugins_url( '/js/build/admin' . $suffix . '.js', POLYLANG_ROOT_FILE ), array( 'jquery', 'wp-ajax-response', 'postbox', 'jquery-ui-selectmenu' ), POLYLANG_VERSION, true );
334
  wp_localize_script( 'pll_admin', 'pll_admin', array( 'dismiss_notice' => esc_html__( 'Dismiss this notice.', 'polylang' ) ) );
335
 
336
+ wp_enqueue_style( 'pll_selectmenu', plugins_url( '/css/build/selectmenu' . $suffix . '.css', POLYLANG_ROOT_FILE ), array(), POLYLANG_VERSION );
337
  }
338
 
339
  /**