Make WordPress Core

Ticket #49239: menu-header.php.2.patch

File menu-header.php.2.patch, 3.7 KB (added by pikamander2, 6 years ago)
  • menu-header.php

     
    8888                        $submenu_items = $submenu[ $item[2] ];
    8989                }
    9090
    91                 if ( ( $parent_file && $item[2] == $parent_file ) || ( empty( $typenow ) && $self == $item[2] ) ) {
     91                if ( ( $parent_file && $item[2] === $parent_file ) || ( empty( $typenow ) && $self === $item[2] ) ) {
    9292                        if ( ! empty( $submenu_items ) ) {
    9393                                $class[] = 'wp-has-current-submenu wp-menu-open';
    9494                        } else {
     
    157157                        if ( false !== $pos ) {
    158158                                $menu_file = substr( $menu_file, 0, $pos );
    159159                        }
    160                         if ( ! empty( $menu_hook ) || ( ( 'index.php' != $submenu_items[0][2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) {
     160                        if ( ! empty( $menu_hook ) || ( ( 'index.php' !== $submenu_items[0][2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) {
    161161                                $admin_is_parent = true;
    162162                                echo "<a href='admin.php?page={$submenu_items[0][2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>$title</div></a>";
    163163                        } else {
     
    170170                        if ( false !== $pos ) {
    171171                                $menu_file = substr( $menu_file, 0, $pos );
    172172                        }
    173                         if ( ! empty( $menu_hook ) || ( ( 'index.php' != $item[2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) {
     173                        if ( ! empty( $menu_hook ) || ( ( 'index.php' !== $item[2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) {
    174174                                $admin_is_parent = true;
    175175                                echo "\n\t<a href='admin.php?page={$item[2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>{$item[0]}</div></a>";
    176176                        } else {
     
    208208                                $self_type = ! empty( $typenow ) ? $self . '?post_type=' . $typenow : 'nothing';
    209209
    210210                                if ( isset( $submenu_file ) ) {
    211                                         if ( $submenu_file == $sub_item[2] ) {
     211                                        if ( $submenu_file === $sub_item[2] ) {
    212212                                                $class[]          = 'current';
    213213                                                $aria_attributes .= ' aria-current="page"';
    214214                                        }
     
    215215                                        // If plugin_page is set the parent must either match the current page or not physically exist.
    216216                                        // This allows plugin pages with the same hook to exist under different parents.
    217217                                } elseif (
    218                                         ( ! isset( $plugin_page ) && $self == $sub_item[2] ) ||
    219                                         ( isset( $plugin_page ) && $plugin_page == $sub_item[2] && ( $item[2] == $self_type || $item[2] == $self || file_exists( $menu_file ) === false ) )
     218                                        ( ! isset( $plugin_page ) && $self === $sub_item[2] ) ||
     219                                        ( isset( $plugin_page ) && $plugin_page === $sub_item[2] && ( $item[2] === $self_type || $item[2] === $self || file_exists( $menu_file ) === false ) )
    220220                                ) {
    221221                                        $class[]          = 'current';
    222222                                        $aria_attributes .= ' aria-current="page"';
     
    237237
    238238                                $title = wptexturize( $sub_item[0] );
    239239
    240                                 if ( ! empty( $menu_hook ) || ( ( 'index.php' != $sub_item[2] ) && file_exists( WP_PLUGIN_DIR . "/$sub_file" ) && ! file_exists( ABSPATH . "/wp-admin/$sub_file" ) ) ) {
     240                                if ( ! empty( $menu_hook ) || ( ( 'index.php' !== $sub_item[2] ) && file_exists( WP_PLUGIN_DIR . "/$sub_file" ) && ! file_exists( ABSPATH . "/wp-admin/$sub_file" ) ) ) {
    241241                                        // If admin.php is the current page or if the parent exists as a file in the plugins or admin dir
    242242                                        if ( ( ! $admin_is_parent && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! is_dir( WP_PLUGIN_DIR . "/{$item[2]}" ) ) || file_exists( $menu_file ) ) {
    243243                                                $sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), $item[2] );