Changeset 3106195
- Timestamp:
- 06/23/2024 12:21:34 PM (6 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin-menu-editor/trunk/includes/menu-editor-core.php
r3106188 r3106195 33 33 private $old_wp_submenu; 34 34 35 private $title_lookups = array(); //A list of page titles indexed by $item['file']. Used to36 //fix the titles of moved plugin pages.37 35 private $reverse_item_lookup = array(); //Contains the final (merged & filtered) list of admin menu items, 38 36 //indexed by URL. … … 465 463 } else { 466 464 //Yes, this method can actually run before WP updates the list of active plugins. That means functions 467 //like is_plugin_active_for_network() will return false. As a sresult, we can't determine whether465 //like is_plugin_active_for_network() will return false. As a result, we can't determine whether 468 466 //the plugin has been network-activated yet, so lets skip setting up the default config until 469 467 //the next page load. … … 842 840 if ( ! $this->current_user_can($data[1]) ) { 843 841 unset($submenu[$parent][$index]); 842 844 843 $_wp_submenu_nopriv[$parent][$data[2]] = true; 845 844 } else { … … 1337 1336 1338 1337 //Sanity check. If the wp_scripts implementation has changed significantly, don't touch it. 1339 if ( !isset($wp_scripts->queue) || (!is_array($wp_scripts->queue) || ($wp_scripts->queue instanceof Traversable)) ) {1338 if ( !isset($wp_scripts->queue) || ) ) { 1340 1339 return; 1341 1340 } … … 1405 1404 */ 1406 1405 function enqueue_styles(){ 1407 wp_enqueue_auto_versioned_style('jquery-qtip-syle', plugins_url('css/jquery.qtip.min.css', $this->plugin_file) , array());1406 wp_enqueue_auto_versioned_style('jquery-qtip-syle', plugins_url('css/jquery.qtip.min.css', $this->plugin_file)); 1408 1407 1409 1408 wp_register_auto_versioned_style( … … 1691 1690 * @param string $title The current page title. 1692 1691 * @return string New admin title. 1692 1693 1693 1694 */ 1694 1695 function hook_admin_title($admin_title, $title){ … … 2058 2059 * @uses WPMenuEditor::$custom_wp_submenu Stores the generated sub-menu here. 2059 2060 * 2060 * @uses WPMenuEditor::$title_lookups Generates a lookup list of page titles.2061 2061 * @uses WPMenuEditor::$reverse_item_lookup Generates a lookup list of url => menu item relationships. 2062 2062 * … … 2068 2068 $new_menu = array(); 2069 2069 $new_submenu = array(); 2070 $this->title_lookups = array();2071 2070 $this->custom_menu_is_deep = false; 2072 2071 … … 2085 2084 $topmenu = $this->prepare_for_output($topmenu, 'menu'); 2086 2085 2087 if ( empty($topmenu['separator']) ) {2088 $this->title_lookups[$topmenu['file']] = !empty($topmenu['page_title']) ? $topmenu['page_title'] : $topmenu['menu_title'];2089 }2090 2091 2086 //Prepare the submenu of this menu 2092 2087 $topmenu['items'] = $this->prepare_children_for_output($topmenu); … … 2132 2127 foreach ($menu['items'] as $item) { 2133 2128 $item = $this->prepare_for_output($item, 'submenu', $menu, ($is_deep === true)); 2134 2135 //Make a note of the page's correct title so we can fix it later if necessary.2136 $this->title_lookups[$item['file']] = !empty($item['page_title']) ? $item['page_title'] : $item['menu_title'];2137 2129 2138 2130 if ( !empty($item['items']) ) { … … 2291 2283 private function convert_to_wp_format($item) { 2292 2284 //Build the menu structure that WP expects 2293 $wp_item =array(2285 array( 2294 2286 $item['menu_title'], 2295 2287 $item['access_level'], … … 2300 2292 isset($item['wp_icon_url']) ? $item['wp_icon_url'] : $item['icon_url'], 2301 2293 ); 2302 2303 return $wp_item;2304 2294 } 2305 2295 … … 2784 2774 . $debugOutput 2785 2775 ); 2786 2787 return;2788 2776 // phpcs:enable 2789 2777 } … … 3056 3044 } 3057 3045 3046 3047 3048 3058 3049 private function display_editor_ui() { 3059 3050 //Prepare a bunch of parameters for the editor. … … 3226 3217 private function display_plugin_settings_ui() { 3227 3218 //These variables are used by settings-page.php. 3228 /** @noinspection PhpUnusedLocalVariableInspection */3229 3219 $settings = $this->options; 3230 /** @noinspection PhpUnusedLocalVariableInspection */3231 3220 $settings_page_url = $this->get_settings_page_url(); 3232 /** @noinspection PhpUnusedLocalVariableInspection */3233 3221 $editor_page_url = admin_url($this->settings_link); 3234 /** @noinspection PhpUnusedLocalVariableInspection */3235 3222 $db_option_name = $this->option_name; 3236 3223 … … 4297 4284 } 4298 4285 4299 if ( isset($top_menu['items']) &&!empty($top_menu['items']) ) {4286 if ( !empty($top_menu['items']) ) { 4300 4287 foreach($top_menu['items'] as $item) { 4301 4288 if ( $item['separator'] ) { … … 4386 4373 } 4387 4374 4388 $badSubmenuExists = isset($this->default_wp_submenu['woocommerce'][0]) 4389 && isset($this->default_wp_submenu['woocommerce'][0][2]) 4375 $badSubmenuExists = isset($this->default_wp_submenu['woocommerce'][0][2]) 4390 4376 && ($this->default_wp_submenu['woocommerce'][0][2] === 'woocommerce'); 4391 4377 $anotherSubmenuExists = isset($this->default_wp_submenu['woocommerce'][1]); … … 4786 4772 foreach($post_types as $id => $post_type) { 4787 4773 $title = $id; 4788 if ( isset($post_type->labels, $post_type->labels->name) && !empty($post_type->labels->name)) {4774 if () { 4789 4775 $title = $post_type->labels->name; 4790 4776 } … … 4825 4811 foreach($taxonomies as $id => $taxonomy) { 4826 4812 $title = $id; 4827 if ( isset($taxonomy->labels, $taxonomy->labels->name) && !empty($taxonomy->labels->name)) {4813 if () { 4828 4814 $title = $taxonomy->labels->name; 4829 4815 } … … 5328 5314 5329 5315 if ( !empty($menu) ) { 5330 if ( !is_array($menu) && ($menu instanceof \Traversable) ) {5316 if ( !is_array($menu) && ($menu instanceof Traversable) ) { 5331 5317 $menu = iterator_to_array($menu); 5332 5318 }
Note: See TracChangeset
for help on using the changeset viewer.