Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r18109 r16471  
    103103        $_wp_menu_nopriv[$data[2]] = true;
    104104
    105     // If there is only one submenu and it is has same destination as the parent,
    106     // remove the submenu.
    107     if ( ! empty( $submenu[$data[2]] ) && 1 == count ( $submenu[$data[2]] ) ) {
    108         $subs = $submenu[$data[2]];
    109         $first_sub = array_shift($subs);
    110         if ( $data[2] == $first_sub[2] )
    111             unset( $submenu[$data[2]] );
    112     }
    113 
    114105    // If submenu is empty...
    115106    if ( empty($submenu[$data[2]]) ) {
     
    120111    }
    121112}
    122 unset($id, $data, $subs, $first_sub);
    123 
    124 // Remove any duplicated separators
    125 $separator_found = false;
     113unset($id, $data);
     114
     115// Remove any duplicated seperators
     116$seperator_found = false;
    126117foreach ( $menu as $id => $data ) {
    127118    if ( 0 == strcmp('wp-menu-separator', $data[4] ) ) {
    128         if (false == $separator_found) {
    129             $separator_found = true;
     119        if (false == $seperator_found) {
     120            $seperator_found = true;
    130121        } else {
    131122            unset($menu[$id]);
    132             $separator_found = false;
     123            $seperator_found = false;
    133124        }
    134125    } else {
    135         $separator_found = false;
     126        $seperator_found = false;
    136127    }
    137128}
     
    215206}
    216207
    217 // Remove the last menu item if it is a separator.
    218 $last_menu_key = array_pop( array_keys( $menu ) );
    219 if ( 'wp-menu-separator' == $menu[ $last_menu_key ][ 4 ] )
    220     unset( $menu[ $last_menu_key ] );
    221 unset( $last_menu_key );
    222 
    223208if ( !user_can_access_admin_page() ) {
    224209    do_action('admin_page_access_denied');
Note: See TracChangeset for help on using the changeset viewer.