Plugin Directory

Changeset 3106195

Timestamp:
06/23/2024 12:21:34 PM (6 weeks ago)
Author:
whiteshadow
Message:

Minor: Fix many small IDE notices and warnings

This should not have any effect on functionality.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin-menu-editor/trunk/includes/menu-editor-core.php

    r3106188 r3106195  
    3333    private $old_wp_submenu;
    3434
    35     private $title_lookups = array();   //A list of page titles indexed by $item['file']. Used to
    36                                         //fix the titles of moved plugin pages.
    3735    private $reverse_item_lookup = array(); //Contains the final (merged & filtered) list of admin menu items,
    3836                                            //indexed by URL.
     
    465463            } else {
    466464                //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 as result, we can't determine whether
     465                //like is_plugin_active_for_network() will return false. As a result, we can't determine whether
    468466                //the plugin has been network-activated yet, so lets skip setting up the default config until
    469467                //the next page load.
     
    842840                if ( ! $this->current_user_can($data[1]) ) {
    843841                    unset($submenu[$parent][$index]);
     842
    844843                    $_wp_submenu_nopriv[$parent][$data[2]] = true;
    845844                } else {
     
    13371336
    13381337        //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) || ) ) {
    13401339            return;
    13411340        }
     
    14051404      */
    14061405    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));
    14081407
    14091408        wp_register_auto_versioned_style(
     
    16911690     * @param string $title The current page title.
    16921691     * @return string New admin title.
     1692
     1693
    16931694     */
    16941695    function hook_admin_title($admin_title, $title){
     
    20582059   * @uses WPMenuEditor::$custom_wp_submenu Stores the generated sub-menu here.
    20592060   *
    2060    * @uses WPMenuEditor::$title_lookups Generates a lookup list of page titles.
    20612061   * @uses WPMenuEditor::$reverse_item_lookup Generates a lookup list of url => menu item relationships.
    20622062   *
     
    20682068        $new_menu = array();
    20692069        $new_submenu = array();
    2070         $this->title_lookups = array();
    20712070        $this->custom_menu_is_deep = false;
    20722071
     
    20852084            $topmenu = $this->prepare_for_output($topmenu, 'menu');
    20862085
    2087             if ( empty($topmenu['separator']) ) {
    2088                 $this->title_lookups[$topmenu['file']] = !empty($topmenu['page_title']) ? $topmenu['page_title'] : $topmenu['menu_title'];
    2089             }
    2090 
    20912086            //Prepare the submenu of this menu
    20922087            $topmenu['items'] = $this->prepare_children_for_output($topmenu);
     
    21322127        foreach ($menu['items'] as $item) {
    21332128            $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'];
    21372129
    21382130            if ( !empty($item['items']) ) {
     
    22912283    private function convert_to_wp_format($item) {
    22922284        //Build the menu structure that WP expects
    2293         $wp_item = array(
     2285        array(
    22942286            $item['menu_title'],
    22952287            $item['access_level'],
     
    23002292            isset($item['wp_icon_url']) ? $item['wp_icon_url'] : $item['icon_url'],
    23012293        );
    2302 
    2303         return $wp_item;
    23042294    }
    23052295
     
    27842774                        . $debugOutput
    27852775                    );
    2786 
    2787                     return;
    27882776                    // phpcs:enable
    27892777                }
     
    30563044    }
    30573045
     3046
     3047
     3048
    30583049    private function display_editor_ui() {
    30593050        //Prepare a bunch of parameters for the editor.
     
    32263217    private function display_plugin_settings_ui() {
    32273218        //These variables are used by settings-page.php.
    3228         /** @noinspection PhpUnusedLocalVariableInspection */
    32293219        $settings = $this->options;
    3230         /** @noinspection PhpUnusedLocalVariableInspection */
    32313220        $settings_page_url = $this->get_settings_page_url();
    3232         /** @noinspection PhpUnusedLocalVariableInspection */
    32333221        $editor_page_url = admin_url($this->settings_link);
    3234         /** @noinspection PhpUnusedLocalVariableInspection */
    32353222        $db_option_name = $this->option_name;
    32363223
     
    42974284            }
    42984285
    4299             if ( isset($top_menu['items']) && !empty($top_menu['items']) ) {
     4286            if ( !empty($top_menu['items']) ) {
    43004287                foreach($top_menu['items'] as $item) {
    43014288                    if ( $item['separator'] ) {
     
    43864373        }
    43874374
    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])
    43904376            && ($this->default_wp_submenu['woocommerce'][0][2] === 'woocommerce');
    43914377        $anotherSubmenuExists = isset($this->default_wp_submenu['woocommerce'][1]);
     
    47864772        foreach($post_types as $id => $post_type) {
    47874773            $title = $id;
    4788             if (isset($post_type->labels, $post_type->labels->name) && !empty($post_type->labels->name)) {
     4774            if () {
    47894775                $title = $post_type->labels->name;
    47904776            }
     
    48254811        foreach($taxonomies as $id => $taxonomy) {
    48264812            $title = $id;
    4827             if (isset($taxonomy->labels, $taxonomy->labels->name) && !empty($taxonomy->labels->name)) {
     4813            if () {
    48284814                $title = $taxonomy->labels->name;
    48294815            }
     
    53285314
    53295315        if ( !empty($menu) ) {
    5330             if ( !is_array($menu) && ($menu instanceof \Traversable) ) {
     5316            if ( !is_array($menu) && ($menu instanceof Traversable) ) {
    53315317                $menu = iterator_to_array($menu);
    53325318            }
Note: See TracChangeset for help on using the changeset viewer.