Make WordPress Core


Ignore:
Timestamp:
04/25/2004 06:42:45 AM (20 years ago)
Author:
rboren
Message:

menu.php no longer needs menu.txt.

File:
1 edited

Legend:

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

    r1106 r1166  
    22<ul id="adminmenu">
    33<?php
    4 $menu = file('./menu.txt');
    5 $continue = true;
     4// This array constructs the admin menu bar.
     5//
     6// Menu item name
     7// The minimum level the user needs to access the item: between 0 and 10
     8// The URL of the item's file
     9$menu = array(
     10              array(__('Write'), 1, 'post.php'),
     11              array(__('Edit'), 1, 'edit.php'),
     12              array(__('Categories'), 3, 'categories.php'),
     13              array(__('Links'), 5, 'link-manager.php'),
     14              array(__('Users'), 3, 'users.php'),
     15              array(__('Options'), 6, 'options-general.php'),
     16              array(__('Plugins'), 8, 'plugins.php'),
     17              array(__('Templates'), 4, 'templates.php'),
     18              array(__('Upload'), 5, 'upload.php'),
     19              array(__('Profile'), 0, 'profile.php')
     20);
     21
     22$self = str_replace('/wp-admin/', '', $PHP_SELF);
    623foreach ($menu as $item) {
    724    $class = '';
    8     $item = trim($item);
    9     if ('***' == $item) $continue = false;
    10     if ($continue) {
    11         $item = explode("\t", $item);
    12         // 0 = user level, 1 = file, 2 = name
    13         $self = str_replace('/wp-admin/', '', $PHP_SELF);
    14         if ((substr($self, -20) == substr($item[1], -20) && empty($parent_file)) || ($parent_file && ($item[1] == $parent_file))) $class = ' class="current"';
    15         if ($user_level >= $item[0]) {
    16             if (('upload.php' == $item[1] && get_settings('use_fileupload') && ($user_level >= get_settings('fileupload_minlevel'))
    17          && (in_array($user_login, explode(' ', $allowed_users)) || (trim(get_settings('fileupload_allowedusers'))==''))) || 'upload.php' != $item[1])
    18                 echo "\n\t<li><a href='{$item[1]}'$class>{$item[2]}</a></li>";
    19         }
    20     }
     25
     26    // 0 = name, 1 = user_level, 2 = file
     27    if ((substr($self, -20) == substr($item[1], -20) && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"';
     28   
     29    if ($user_level >= $item[1]) {
     30        if (('upload.php' == $item[2] && get_settings('use_fileupload') && ($user_level >= get_settings('fileupload_minlevel'))
     31             && (in_array($user_login, explode(' ', $allowed_users)) || (trim(get_settings('fileupload_allowedusers'))==''))) || 'upload.php' != $item[2])
     32            echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
     33    }
    2134}
    2235
Note: See TracChangeset for help on using the changeset viewer.