Make WordPress Core

Ticket #21413: 21413.diff

File 21413.diff, 5.0 KB (added by obenland, 12 years ago)
  • wp-admin/admin-header.php

     
    100100</script>
    101101
    102102<?php
    103 // If the customize-loader script is enqueued, make sure the customize
    104 // body classes are correct as early as possible.
    105 if ( wp_script_is( 'customize-loader', 'queue' ) && current_user_can( 'edit_theme_options' ) )
     103// Make sure the customize body classes are correct as early as possible.
     104if (  current_user_can( 'edit_theme_options' ) )
    106105        wp_customize_support_script();
    107106?>
    108107
  • wp-admin/menu.php

     
    129129
    130130$menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
    131131
    132 if ( current_user_can( 'switch_themes') ) {
    133         $menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' );
    134                 $submenu['themes.php'][5]  = array(__('Themes'), 'switch_themes', 'themes.php');
    135                 if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
    136                         $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php');
    137 } else {
    138         $menu[60] = array( __('Appearance'), 'edit_theme_options', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' );
    139                 $submenu['themes.php'][5]  = array(__('Themes'), 'edit_theme_options', 'themes.php');
    140                 if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
    141                         $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php' );
    142 }
     132$appearance_cap = current_user_can( 'switch_themes') ? 'switch_themes' : 'edit_theme_options';
     133
     134$menu[60] = array( __('Appearance'), $appearance_cap, 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' );
     135        $submenu['themes.php'][4] = array( __( 'Customize' ), $appearance_cap, 'customize.php', 'hide-if-no-customize' );
     136        $submenu['themes.php'][5] = array(__('Themes'), $appearance_cap, 'themes.php');
     137        if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
     138                $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php');
     139
     140unset( $appearance_cap );
    143141
    144142// Add 'Editor' to the bottom of the Appearance menu.
    145143if ( ! is_multisite() )
  • wp-admin/menu-header.php

     
    5353                        $class[] = 'wp-has-submenu';
    5454                        $submenu_items = $submenu[$item[2]];
    5555                }
    56 
     56               
    5757                if ( ( $parent_file && $item[2] == $parent_file ) || ( empty($typenow) && $self == $item[2] ) ) {
    5858                        $class[] = ! empty( $submenu_items ) ? 'wp-has-current-submenu wp-menu-open' : 'current';
    5959                } else {
     
    8080                if ( false !== strpos( $class, 'wp-menu-separator' ) ) {
    8181                        echo '<div class="separator"></div>';
    8282                } elseif ( $submenu_as_parent && ! empty( $submenu_items ) ) {
    83                         $submenu_items = array_values( $submenu_items );  // Re-index.
     83                        $temp_submenu_items = $submenu_items = array_values( $submenu_items );  // Re-index.
     84                        if ( 'customize.php' == $submenu_items[0][2] )
     85                                $submenu_items[0][2] = 'themes.php';
    8486                        $menu_hook = get_plugin_page_hook( $submenu_items[0][2], $item[2] );
    8587                        $menu_file = $submenu_items[0][2];
    8688                        if ( false !== ( $pos = strpos( $menu_file, '?' ) ) )
     
    9193                        } else {
    9294                                echo "\n\t<div class='wp-menu-image'><a href='{$submenu_items[0][2]}' tabindex='-1' aria-label='$aria_label'>$img</a></div>$arrow<a href='{$submenu_items[0][2]}'$class $aria_attributes>$title</a>";
    9395                        }
     96                        $submenu_items = $temp_submenu_items;
    9497                } elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) {
    9598                        $menu_hook = get_plugin_page_hook( $item[2], 'admin.php' );
    9699                        $menu_file = $item[2];
     
    103106                                echo "\n\t<div class='wp-menu-image'><a href='{$item[2]}' tabindex='-1' aria-label='$aria_label'>$img</a></div>$arrow<a href='{$item[2]}'$class $aria_attributes>{$item[0]}</a>";
    104107                        }
    105108                }
    106 
     109               
    107110                if ( ! empty( $submenu_items ) ) {
    108111                        echo "\n\t<div class='wp-submenu'><div class='wp-submenu-wrap'>";
    109112                        echo "<div class='wp-submenu-head'>{$item[0]}</div><ul>";
     
    137140                                ) {
    138141                                        $class[] = 'current';
    139142                                }
     143                               
     144                                if ( ! empty( $sub_item[3] ) )
     145                                        $class[] = $sub_item[3];
    140146
    141147                                $class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
    142148
  • wp-admin/includes/menu.php

     
    7373        $new_parent = $first_sub[2];
    7474        // If the first submenu is not the same as the assigned parent,
    7575        // make the first submenu the new parent.
    76         if ( $new_parent != $old_parent ) {
     76        if ( $new_parent != $old_parent && 'customize.php' != $new_parent ) {
    7777                $_wp_real_parent_file[$old_parent] = $new_parent;
    7878                $menu[$id][2] = $new_parent;
    7979