Hold off on menu cleanup until next release. There be dragons.

git-svn-id: http://svn.automattic.com/wordpress/trunk@4480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-11-18 07:31:29 +00:00
parent 2ef26430ec
commit eda9021317
33 changed files with 115 additions and 30 deletions

View File

@ -82,7 +82,9 @@ if (isset($plugin_page)) {
include(ABSPATH . "wp-admin/import/$importer.php");
$parent_file = 'edit.php';
$submenu_file = 'import.php';
$title = __('Import');
if (! isset($_GET['noheader']))
require_once(ABSPATH . 'wp-admin/admin-header.php');

View File

@ -1,6 +1,9 @@
<?php
require_once('admin.php');
$title = __('Categories');
$parent_file = 'edit.php';
wp_reset_vars(array('action', 'cat'));
switch($action) {

View File

@ -1,6 +1,7 @@
<?php
require_once('admin.php');
$parent_file = 'edit.php';
$submenu_file = 'edit-comments.php';
wp_reset_vars(array('action'));

View File

@ -1,6 +1,8 @@
<?php
require_once('admin.php');
$title = __('Edit Comments');
$parent_file = 'edit-comments.php';
wp_enqueue_script( 'admin-comments' );
require_once('admin-header.php');

View File

@ -1,5 +1,7 @@
<?php
require_once('admin.php');
$title = __('Pages');
$parent_file = 'edit.php';
wp_enqueue_script( 'listman' );
require_once('admin-header.php');
?>

View File

@ -1,6 +1,8 @@
<?php
require_once('admin.php');
$title = __('Posts');
$parent_file = 'edit.php';
wp_enqueue_script( 1 == $_GET['c'] ? 'admin-comments' : 'listman' );
require_once('admin-header.php');

View File

@ -1,5 +1,7 @@
<?php
require_once ('admin.php');
$title = __('Export');
$parent_file = 'edit.php';
if ( isset( $_GET['download'] ) )
export_wp();

View File

@ -1,5 +1,7 @@
<?php
require_once ('admin.php');
$title = __('Import');
$parent_file = 'edit.php';
require_once ('admin-header.php');
?>

View File

@ -1,5 +1,7 @@
<?php
require_once('admin.php');
$title = __('Dashboard');
$parent_file = 'index.php';
require_once('admin-header.php');
require_once (ABSPATH . WPINC . '/rss.php');

View File

@ -1,7 +1,10 @@
<?php
require_once('admin.php');
$title = __('Add Bookmark');
$this_file = 'link-manager.php';
$parent_file = 'link-manager.php';
wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image',
'description', 'visible', 'target', 'category', 'link_id',

View File

@ -3,6 +3,8 @@
// Copyright (C) 2002 Mike Little -- mike@zed1.com
require_once('admin.php');
$parent_file = 'link-manager.php';
$title = __('Import Blogroll');
$this_file = 'link-import.php';
$step = $_POST['step'];

View File

@ -6,6 +6,7 @@
require_once ('admin.php');
$title = __('Manage Bookmarks');
$this_file = $parent_file = 'link-manager.php';
wp_enqueue_script( 'listman' );

View File

@ -3,13 +3,7 @@
$self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
$self = preg_replace('|^.*/plugins/|i', '', $self);
foreach ( $submenu as $parent => $subpages ) {
foreach ( $subpages as $page ) {
// 0 menu title, 1 cap, 2 file or slug, 3 page title
if ( $self == $page[2] )
$parent_file = $parent;
}
}
get_admin_page_parent();
foreach ($menu as $item) {
$class = '';

View File

@ -4,31 +4,26 @@
// Menu item name
// The minimum level the user needs to access the item: between 0 and 10
// The URL of the item's file
// Slug
$menu[0] = array(__('Dashboard'), 'read', 'index.php', 'home');
$menu[0] = array(__('Dashboard'), 'read', 'index.php');
// So when people switch between write and manage they go to the appropiate page/post mode they were on
if ( strstr($_SERVER['REQUEST_URI'], 'edit-pages.php') )
$menu[5] = array(__('Write'), 'edit_pages', 'page-new.php', 'write');
$menu[5] = array(__('Write'), 'edit_pages', 'page-new.php');
else
$menu[5] = array(__('Write'), 'edit_posts', 'post-new.php', 'write');
$menu[5] = array(__('Write'), 'edit_posts', 'post-new.php');
if ( strstr($_SERVER['REQUEST_URI'], 'page-new.php') )
$menu[10] = array(__('Manage'), 'edit_pages', 'edit-pages.php', 'manage');
$menu[10] = array(__('Manage'), 'edit_pages', 'edit-pages.php');
else
$menu[10] = array(__('Manage'), 'edit_posts', 'edit.php', 'manage');
$menu[15] = array(__('Comments'), 'edit_posts', 'edit-comments.php', 'comments');
$menu[20] = array(__('Blogroll'), 'manage_links', 'link-manager.php', 'blogroll');
$menu[25] = array(__('Presentation'), 'switch_themes', 'themes.php', 'themes');
$menu[30] = array(__('Plugins'), 'activate_plugins', 'plugins.php', 'plugins');
$menu[10] = array(__('Manage'), 'edit_posts', 'edit.php');
$menu[15] = array(__('Comments'), 'edit_posts', 'edit-comments.php');
$menu[20] = array(__('Blogroll'), 'manage_links', 'link-manager.php');
$menu[25] = array(__('Presentation'), 'switch_themes', 'themes.php');
$menu[30] = array(__('Plugins'), 'activate_plugins', 'plugins.php');
if ( current_user_can('edit_users') )
$menu[35] = array(__('Users'), 'edit_users', 'users.php', 'users');
$menu[35] = array(__('Users'), 'edit_users', 'users.php');
else
$menu[35] = array(__('Profile'), 'read', 'profile.php', 'profile');
$menu[40] = array(__('Options'), 'manage_options', 'options-general.php', 'options');
$menu[35] = array(__('Profile'), 'read', 'profile.php');
$menu[40] = array(__('Options'), 'manage_options', 'options-general.php');
$submenu['post-new.php'][5] = array(__('Write Post'), 'edit_posts', 'post-new.php');
@ -74,8 +69,9 @@ $submenu['themes.php'][5] = array(__('Themes'), 'switch_themes', 'themes.php');
$submenu['themes.php'][10] = array(__('Theme Editor'), 'edit_themes', 'theme-editor.php');
// Create list of page plugin hook names.
foreach ( $menu as $menu_page )
foreach ($menu as $menu_page) {
$admin_page_hooks[$menu_page[2]] = sanitize_title($menu_page[0]);
}
$_wp_submenu_nopriv = array();
$_wp_menu_nopriv = array();
@ -132,11 +128,12 @@ foreach ( $menu as $id => $data ) {
}
}
unset( $id );
unset($id);
uksort( $menu, 'strnatcasecmp' );
uksort($menu, "strnatcasecmp"); // make it all pretty
if ( !user_can_access_admin_page() )
if (! user_can_access_admin_page()) {
wp_die( __('You do not have sufficient permissions to access this page.') );
}
?>

View File

@ -1,6 +1,8 @@
<?php
require_once('admin.php');
$title = __('Moderate comments');
$parent_file = 'edit-comments.php';
wp_enqueue_script( 'admin-comments' );
wp_reset_vars(array('action', 'item_ignored', 'item_deleted', 'item_approved', 'item_spam', 'feelinglucky'));

View File

@ -1,5 +1,9 @@
<?php
require_once('admin.php');
$title = __('Discussion Options');
$parent_file = 'options-general.php';
include('admin-header.php');
?>

View File

@ -1,5 +1,9 @@
<?php
require_once('./admin.php');
$title = __('General Options');
$parent_file = 'options-general.php';
include('./admin-header.php');
?>

View File

@ -1,5 +1,9 @@
<?php
require_once('admin.php');
$title = __('Miscellaneous Options');
$parent_file = 'options-general.php';
include('admin-header.php');
?>

View File

@ -1,5 +1,9 @@
<?php
require_once('admin.php');
$title = __('Permalink Options');
$parent_file = 'options-general.php';
function add_js() {
?>
<script type="text/javascript">

View File

@ -1,5 +1,9 @@
<?php
require_once('./admin.php');
$title = __('Privacy Options');
$parent_file = 'options-general.php';
include('./admin-header.php');
?>

View File

@ -1,5 +1,9 @@
<?php
require_once('admin.php');
$title = __('Reading Options');
$parent_file = 'options-general.php';
include('admin-header.php');
?>

View File

@ -1,5 +1,9 @@
<?php
require_once('admin.php');
$title = __('Writing Options');
$parent_file = 'options-general.php';
include('admin-header.php');
?>

View File

@ -1,6 +1,10 @@
<?php
require_once('admin.php');
$title = __('Options');
$this_file = 'options.php';
$parent_file = 'options-general.php';
wp_reset_vars(array('action'));
if ( !current_user_can('manage_options') )

View File

@ -1,5 +1,7 @@
<?php
require_once('admin.php');
$title = __('New Page');
$parent_file = 'post-new.php';
$editing = true;
wp_enqueue_script('prototype');
wp_enqueue_script('autosave');

View File

@ -1,5 +1,9 @@
<?php
require_once('admin.php');
$title = __("Edit Plugins");
$parent_file = 'plugins.php';
wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file'));
$plugins = get_plugins();

View File

@ -29,6 +29,7 @@ if ( isset($_GET['action']) ) {
exit;
}
$title = __('Manage Plugins');
require_once('admin-header.php');
// Clean up options

View File

@ -1,5 +1,7 @@
<?php
require_once('admin.php');
$title = __('Create New Post');
$parent_file = 'post-new.php';
$editing = true;
wp_enqueue_script('prototype');
wp_enqueue_script('autosave');

View File

@ -1,5 +1,12 @@
<?php
require_once('admin.php');
$title = __('Profile');
if ( current_user_can('edit_users') )
$parent_file = 'users.php';
else
$parent_file = 'profile.php';
include_once('admin-header.php');
$profileuser = get_user_to_edit($user_ID);

View File

@ -1,5 +1,8 @@
<?php
require_once('admin.php');
$title = __('Template &amp; File Editing');
$parent_file = 'edit.php';
wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file'));
$recents = get_option('recently_edited');

View File

@ -1,5 +1,9 @@
<?php
require_once('admin.php');
$title = __("Edit Themes");
$parent_file = 'themes.php';
wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'theme'));
$themes = get_themes();

View File

@ -18,6 +18,8 @@ if ( isset($_GET['action']) ) {
}
}
$title = __('Manage Themes');
$parent_file = 'themes.php';
require_once('admin-header.php');
?>

View File

@ -1,6 +1,11 @@
<?php
require_once('admin.php');
$title = __('Edit User');
if ( current_user_can('edit_users') )
$parent_file = 'users.php';
else
$parent_file = 'profile.php';
$submenu_file = 'users.php';
wp_reset_vars(array('action', 'redirect', 'profile', 'user_id', 'wp_http_referer'));

View File

@ -2,6 +2,12 @@
require_once('admin.php');
require_once( ABSPATH . WPINC . '/registration.php');
$title = __('Users');
if ( current_user_can('edit_users') )
$parent_file = 'users.php';
else
$parent_file = 'profile.php';
$action = $_REQUEST['action'];
$update = '';