PluginProbe
Polylang / 3.1.4
Polylang v3.1.4
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | admin/admin-base.php +22 -9 3.0.33.1.4 View file →
@@ -50,8 +50,13 @@
50 50 */
51 51 public $static_pages;
52 52
53 53 /**
54 + * @var PLL_Admin_Default_Term
55 + */
56 + public $default_term;
57 +
58 + /**
54 59 * Setups actions needed on all admin pages.
55 60 *
56 61 * @since 1.8
57 62 *
@@ -87,8 +92,10 @@
87 92
88 93 $this->links = new PLL_Admin_Links( $this ); // FIXME needed here ?
89 94 $this->static_pages = new PLL_Admin_Static_Pages( $this ); // FIXME needed here ?
90 95 $this->filters_links = new PLL_Filters_Links( $this ); // FIXME needed here ?
96 + $this->default_term = new PLL_Admin_Default_Term( $this );
97 + $this->default_term->add_hooks();
91 98
92 99 // Filter admin language for users
93 100 // We must not call user info before WordPress defines user roles in wp-settings.php
94 101 add_action( 'setup_theme', array( $this, 'init_user' ) );
@@ -309,9 +316,9 @@
309 316 if ( 'undefined' === typeof options.data || 'string' === typeof options.data ) {
310 317 addPolylangParametersAsString();
311 318 } else {
312 319 // Otherwise options.data is probably an object.
313 - options.data = Object.assign( options.data, <?php echo $arr; // phpcs:ignore WordPress.Security.EscapeOutput ?> );
320 + options.data = Object.assign( options.data || {} , <?php echo $arr; // phpcs:ignore WordPress.Security.EscapeOutput ?> );
314 321 }
315 322 }
316 323 }
317 324 });
@@ -456,17 +463,23 @@
456 463 * @param array $items The admin languages filter submenu items.
457 464 */
458 465 $items = apply_filters( 'pll_admin_languages_filter', array_merge( array( $all_item ), $this->model->get_languages_list() ) );
459 466
467 + $menu = array(
468 + 'id' => 'languages',
469 + 'title' => $selected->flag . $title,
470 + 'href' => esc_url( add_query_arg( 'lang', $selected->slug, remove_query_arg( 'paged' ) ) ),
471 + 'meta' => array(
472 + 'title' => __( 'Filters content by language', 'polylang' ),
473 + ),
474 + );
475 +
476 + if ( 'all' !== $selected->slug ) {
477 + $menu['meta']['class'] = 'pll-filtered-languages';
478 + }
479 +
460 480 if ( ! empty( $items ) ) {
461 - $wp_admin_bar->add_menu(
462 - array(
463 - 'id' => 'languages',
464 - 'title' => $selected->flag . $title,
465 - 'href' => esc_url( add_query_arg( 'lang', $selected->slug, remove_query_arg( 'paged' ) ) ),
466 - 'meta' => array( 'title' => __( 'Filters content by language', 'polylang' ) ),
467 - )
468 - );
481 + $wp_admin_bar->add_menu( $menu );
469 482 }
470 483
471 484 foreach ( $items as $lang ) {
472 485 if ( $selected->slug === $lang->slug ) {