menu.php no longer needs menu.txt.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1166 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2004-04-25 06:42:45 +00:00
parent fea0df34e3
commit 726b92ffe3

View File

@ -1,23 +1,36 @@
<ul id="adminmenu">
<?php
$menu = file('./menu.txt');
$continue = true;
// This array constructs the admin menu bar.
//
// Menu item name
// The minimum level the user needs to access the item: between 0 and 10
// The URL of the item's file
$menu = array(
array(__('Write'), 1, 'post.php'),
array(__('Edit'), 1, 'edit.php'),
array(__('Categories'), 3, 'categories.php'),
array(__('Links'), 5, 'link-manager.php'),
array(__('Users'), 3, 'users.php'),
array(__('Options'), 6, 'options-general.php'),
array(__('Plugins'), 8, 'plugins.php'),
array(__('Templates'), 4, 'templates.php'),
array(__('Upload'), 5, 'upload.php'),
array(__('Profile'), 0, 'profile.php')
);
$self = str_replace('/wp-admin/', '', $PHP_SELF);
foreach ($menu as $item) {
$class = '';
$item = trim($item);
if ('***' == $item) $continue = false;
if ($continue) {
$item = explode("\t", $item);
// 0 = user level, 1 = file, 2 = name
$self = str_replace('/wp-admin/', '', $PHP_SELF);
if ((substr($self, -20) == substr($item[1], -20) && empty($parent_file)) || ($parent_file && ($item[1] == $parent_file))) $class = ' class="current"';
if ($user_level >= $item[0]) {
if (('upload.php' == $item[1] && get_settings('use_fileupload') && ($user_level >= get_settings('fileupload_minlevel'))
&& (in_array($user_login, explode(' ', $allowed_users)) || (trim(get_settings('fileupload_allowedusers'))==''))) || 'upload.php' != $item[1])
echo "\n\t<li><a href='{$item[1]}'$class>{$item[2]}</a></li>";
}
}
// 0 = name, 1 = user_level, 2 = file
if ((substr($self, -20) == substr($item[1], -20) && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"';
if ($user_level >= $item[1]) {
if (('upload.php' == $item[2] && get_settings('use_fileupload') && ($user_level >= get_settings('fileupload_minlevel'))
&& (in_array($user_login, explode(' ', $allowed_users)) || (trim(get_settings('fileupload_allowedusers'))==''))) || 'upload.php' != $item[2])
echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
}
}
?>