WordPress.org

Make WordPress Core

Changeset 6558


Ignore:
Timestamp:
01/05/2008 12:17:35 AM (14 years ago)
Author:
matt
Message:

Put menus in their proper place. TODO: refactor.

Location:
trunk/wp-admin
Files:
2 edited

Legend:

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

    r6549 r6558  
    6060    }
    6161}
     62
     63foreach ( $menu as $key => $item ) {
     64    if ( $key < 41 ) // there is a more efficient way to do this!
     65        continue;
     66
     67    $class = '';
     68
     69    // 0 = name, 1 = capability, 2 = file
     70    if (( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"';
     71
     72    if ( !empty($submenu[$item[2]]) ) {
     73        $submenu[$item[2]] = array_values($submenu[$item[2]]);  // Re-index.
     74        $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
     75        if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
     76            echo "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
     77        else
     78            echo "\n\t<li><a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
     79    } else if ( current_user_can($item[1]) ) {
     80        if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") )
     81            echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
     82        else
     83            echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
     84    }
     85}
     86
    6287do_action( 'adminmenu' );
    6388?>
     
    6792<?php
    6893foreach ( $menu as $key => $item ) {
    69     if ( 26 > $key ) // get each menu item before 3
     94    if ( 26 > $key || $key > 40 )
    7095        continue;
    7196
  • trunk/wp-admin/menu.php

    r6555 r6558  
    1919if ( 100 < $awaiting_mod )
    2020    $awaiting_mod = '99+'; // to not blow out layout
    21 $menu[15] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod' class='comment-count'>$awaiting_mod</span>" ), 'edit_posts', 'edit-comments.php');
    22 $menu[25] = array(__('Design'), 'switch_themes', 'themes.php');
     21$menu[15] = array(__('Design'), 'switch_themes', 'themes.php');
     22$menu[20] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod' class='comment-count'>$awaiting_mod</span>" ), 'edit_posts', 'edit-comments.php');
    2323$menu[30] = array(__('Plugins'), 'activate_plugins', 'plugins.php');
    2424if ( current_user_can('edit_users') )
Note: See TracChangeset for help on using the changeset viewer.