| @@ -47,22 +47,13 @@ | ||
| 47 | 47 | */ |
| 48 | 48 | public function init() { |
| 49 | 49 | parent::init(); |
| 50 | 50 | |
| 51 | - $this->notices = new PLL_Admin_Notices( $this ); | |
| 52 | - | |
| 53 | - if ( Polylang::is_wizard() && class_exists( 'PLL_Wizard_Pro' ) ) { | |
| 54 | - // Instantiate PLL_Wizard_Pro class after all PLL_Admin object is all initialized. | |
| 55 | - // After PLL_Admin::maybe_load_sync_post which is hooked on admin_init with priority 20. | |
| 56 | - add_action( 'admin_init', array( $this, 'instantiate_wizard_pro' ), 30 ); | |
| 57 | - } | |
| 58 | - | |
| 59 | - $this->wizard = new PLL_Wizard( $this ); | |
| 60 | - | |
| 61 | 51 | if ( ! $this->model->get_languages_list() ) { |
| 62 | 52 | return; |
| 63 | 53 | } |
| 64 | 54 | |
| 55 | + $this->notices = new PLL_Admin_Notices( $this ); | |
| 65 | 56 | $this->links = new PLL_Admin_Links( $this ); // FIXME needed here ? |
| 66 | 57 | $this->static_pages = new PLL_Admin_Static_Pages( $this ); // FIXME needed here ? |
| 67 | 58 | $this->filters_links = new PLL_Filters_Links( $this ); // FIXME needed here ? |
| 68 | 59 | |
| @@ -67,9 +58,9 @@ | ||
| 67 | 58 | $this->filters_links = new PLL_Filters_Links( $this ); // FIXME needed here ? |
| 68 | 59 | |
| 69 | 60 | // Filter admin language for users |
| 70 | 61 | // We must not call user info before WordPress defines user roles in wp-settings.php |
| 71 | - add_action( 'setup_theme', array( $this, 'init_user' ) ); | |
| 62 | + add_filter( 'setup_theme', array( $this, 'init_user' ) ); | |
| 72 | 63 | add_filter( 'request', array( $this, 'request' ) ); |
| 73 | 64 | |
| 74 | 65 | // Adds the languages in admin bar |
| 75 | 66 | add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu' ), 100 ); // 100 determines the position |
| @@ -86,10 +77,8 @@ | ||
| 86 | 77 | * |
| 87 | 78 | * @since 0.1 |
| 88 | 79 | */ |
| 89 | 80 | public function add_menus() { |
| 90 | - global $admin_page_hooks; | |
| 91 | - | |
| 92 | 81 | // Prepare the list of tabs |
| 93 | 82 | $tabs = array( 'lang' => __( 'Languages', 'polylang' ) ); |
| 94 | 83 | |
| 95 | 84 | // Only if at least one language has been created |
| @@ -107,16 +96,13 @@ | ||
| 107 | 96 | * @param array $tabs list of tab names |
| 108 | 97 | */ |
| 109 | 98 | $tabs = apply_filters( 'pll_settings_tabs', $tabs ); |
| 110 | 99 | |
| 111 | - $parent = ''; | |
| 112 | - | |
| 113 | 100 | foreach ( $tabs as $tab => $title ) { |
| 114 | 101 | $page = 'lang' === $tab ? 'mlang' : "mlang_$tab"; |
| 115 | 102 | if ( empty( $parent ) ) { |
| 116 | 103 | $parent = $page; |
| 117 | 104 | add_menu_page( $title, __( 'Languages', 'polylang' ), 'manage_options', $page, null, 'dashicons-translation' ); |
| 118 | - $admin_page_hooks[ $page ] = 'languages'; // Hack to avoid the localization of the hook name. See: https://core.trac.wordpress.org/ticket/18857 | |
| 119 | 105 | } |
| 120 | 106 | |
| 121 | 107 | add_submenu_page( $parent, $title, $title, 'manage_options', $page, array( $this, 'languages_page' ) ); |
| 122 | 108 | } |
| @@ -433,14 +419,6 @@ | ||
| 433 | 419 | 'meta' => 'all' === $lang->slug ? array() : array( 'lang' => esc_attr( $lang->get_locale( 'display' ) ) ), |
| 434 | 420 | ) |
| 435 | 421 | ); |
| 436 | 422 | } |
| 437 | - } | |
| 438 | - /** | |
| 439 | - * Instantiate PLL_Wizard_Pro class. | |
| 440 | - * | |
| 441 | - * @since 2.7 | |
| 442 | - */ | |
| 443 | - public function instantiate_wizard_pro() { | |
| 444 | - $this->wizard_pro = new PLL_Wizard_Pro( $this ); | |
| 445 | 423 | } |
| 446 | 424 | } |