| @@ -330,9 +330,9 @@ | ||
| 330 | 330 | * @return void |
| 331 | 331 | */ |
| 332 | 332 | private function add_inline_scripts() { |
| 333 | 333 | if ( wp_script_is( 'pll_block-editor', 'enqueued' ) ) { |
| 334 | - $default_lang_script = 'const pllDefaultLanguage = "' . $this->options['default_lang'] . '";'; | |
| 334 | + $default_lang_script = sprintf( 'const pllDefaultLanguage = %s;', wp_json_encode( $this->options['default_lang'] ) ); | |
| 335 | 335 | wp_add_inline_script( |
| 336 | 336 | 'pll_block-editor', |
| 337 | 337 | $default_lang_script, |
| 338 | 338 | 'before' |
| @@ -604,9 +604,9 @@ | ||
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | /** |
| 607 | 607 | * Tells if the Polylang's admin bar menu should be hidden for the current page. |
| 608 | - * Conventionally, it should be hidden on edition pages. | |
| 608 | + * Conventionally, it should be hidden on edition pages, term edit pages and Site Editor pages. | |
| 609 | 609 | * |
| 610 | 610 | * @since 3.8 |
| 611 | 611 | * |
| 612 | 612 | * @return bool |
| @@ -611,19 +611,11 @@ | ||
| 611 | 611 | * |
| 612 | 612 | * @return bool |
| 613 | 613 | */ |
| 614 | 614 | public function should_hide_admin_bar_menu(): bool { |
| 615 | - global $pagenow, $typenow, $taxnow; | |
| 615 | + global $pagenow; | |
| 616 | 616 | |
| 617 | - if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ), true ) ) { | |
| 618 | - return ! empty( $typenow ); | |
| 619 | - } | |
| 620 | - | |
| 621 | - if ( 'term.php' === $pagenow ) { | |
| 622 | - return ! empty( $taxnow ); | |
| 623 | - } | |
| 624 | - | |
| 625 | - return false; | |
| 617 | + return in_array( $pagenow, array( 'post.php', 'post-new.php', 'site-editor.php', 'term.php' ), true ); | |
| 626 | 618 | } |
| 627 | 619 | |
| 628 | 620 | /** |
| 629 | 621 | * Returns the ID of a Polylang's settings screen. |