Skip to content

Commit

Permalink
Hold off on menu cleanup until next release. There be dragons.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.automattic.com/wordpress/trunk@4480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
ryan committed Nov 18, 2006
1 parent 2ef2643 commit eda9021
Show file tree
Hide file tree
Showing 33 changed files with 115 additions and 30 deletions.
2 changes: 2 additions & 0 deletions wp-admin/admin.php
Expand Up @@ -82,7 +82,9 @@

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');
Expand Down
3 changes: 3 additions & 0 deletions wp-admin/categories.php
@@ -1,6 +1,9 @@
<?php
require_once('admin.php');

$title = __('Categories');
$parent_file = 'edit.php';

wp_reset_vars(array('action', 'cat'));

switch($action) {
Expand Down
1 change: 1 addition & 0 deletions wp-admin/comment.php
@@ -1,6 +1,7 @@
<?php
require_once('admin.php');

$parent_file = 'edit.php';
$submenu_file = 'edit-comments.php';

wp_reset_vars(array('action'));
Expand Down
2 changes: 2 additions & 0 deletions wp-admin/edit-comments.php
@@ -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');
Expand Down
2 changes: 2 additions & 0 deletions wp-admin/edit-pages.php
@@ -1,5 +1,7 @@
<?php
require_once('admin.php');
$title = __('Pages');
$parent_file = 'edit.php';
wp_enqueue_script( 'listman' );
require_once('admin-header.php');
?>
Expand Down
2 changes: 2 additions & 0 deletions wp-admin/edit.php
@@ -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');

Expand Down
2 changes: 2 additions & 0 deletions wp-admin/export.php
@@ -1,5 +1,7 @@
<?php
require_once ('admin.php');
$title = __('Export');
$parent_file = 'edit.php';

if ( isset( $_GET['download'] ) )
export_wp();
Expand Down
2 changes: 2 additions & 0 deletions wp-admin/import.php
@@ -1,5 +1,7 @@
<?php
require_once ('admin.php');
$title = __('Import');
$parent_file = 'edit.php';
require_once ('admin-header.php');
?>

Expand Down
2 changes: 2 additions & 0 deletions wp-admin/index.php
@@ -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');

Expand Down
3 changes: 3 additions & 0 deletions wp-admin/link-add.php
@@ -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',
Expand Down
2 changes: 2 additions & 0 deletions wp-admin/link-import.php
Expand Up @@ -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'];
Expand Down
1 change: 1 addition & 0 deletions wp-admin/link-manager.php
Expand Up @@ -6,6 +6,7 @@

require_once ('admin.php');

$title = __('Manage Bookmarks');
$this_file = $parent_file = 'link-manager.php';
wp_enqueue_script( 'listman' );

Expand Down
10 changes: 2 additions & 8 deletions wp-admin/menu-header.php
Expand Up @@ -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 = '';
Expand Down Expand Up @@ -68,4 +62,4 @@

do_action('admin_notices');

?>
?>
41 changes: 19 additions & 22 deletions wp-admin/menu.php
Expand Up @@ -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[10] = array(__('Manage'), 'edit_posts', 'edit.php');

$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[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');
Expand Down Expand Up @@ -74,8 +69,9 @@
$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();
Expand Down Expand Up @@ -132,11 +128,12 @@
}
}

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.') );
}

?>
?>
2 changes: 2 additions & 0 deletions wp-admin/moderation.php
@@ -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'));
Expand Down
4 changes: 4 additions & 0 deletions wp-admin/options-discussion.php
@@ -1,5 +1,9 @@
<?php
require_once('admin.php');

$title = __('Discussion Options');
$parent_file = 'options-general.php';

include('admin-header.php');
?>

Expand Down
4 changes: 4 additions & 0 deletions wp-admin/options-general.php
@@ -1,5 +1,9 @@
<?php
require_once('./admin.php');

$title = __('General Options');
$parent_file = 'options-general.php';

include('./admin-header.php');
?>

Expand Down
4 changes: 4 additions & 0 deletions wp-admin/options-misc.php
@@ -1,5 +1,9 @@
<?php
require_once('admin.php');

$title = __('Miscellaneous Options');
$parent_file = 'options-general.php';

include('admin-header.php');

?>
Expand Down
4 changes: 4 additions & 0 deletions wp-admin/options-permalink.php
@@ -1,5 +1,9 @@
<?php
require_once('admin.php');

$title = __('Permalink Options');
$parent_file = 'options-general.php';

function add_js() {
?>
<script type="text/javascript">
Expand Down
4 changes: 4 additions & 0 deletions wp-admin/options-privacy.php
@@ -1,5 +1,9 @@
<?php
require_once('./admin.php');

$title = __('Privacy Options');
$parent_file = 'options-general.php';

include('./admin-header.php');
?>

Expand Down
4 changes: 4 additions & 0 deletions wp-admin/options-reading.php
@@ -1,5 +1,9 @@
<?php
require_once('admin.php');

$title = __('Reading Options');
$parent_file = 'options-general.php';

include('admin-header.php');
?>

Expand Down
4 changes: 4 additions & 0 deletions wp-admin/options-writing.php
@@ -1,5 +1,9 @@
<?php
require_once('admin.php');

$title = __('Writing Options');
$parent_file = 'options-general.php';

include('admin-header.php');
?>

Expand Down
4 changes: 4 additions & 0 deletions wp-admin/options.php
@@ -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') )
Expand Down
2 changes: 2 additions & 0 deletions wp-admin/page-new.php
@@ -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');
Expand Down
4 changes: 4 additions & 0 deletions wp-admin/plugin-editor.php
@@ -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();
Expand Down
1 change: 1 addition & 0 deletions wp-admin/plugins.php
Expand Up @@ -29,6 +29,7 @@
exit;
}

$title = __('Manage Plugins');
require_once('admin-header.php');

// Clean up options
Expand Down
2 changes: 2 additions & 0 deletions wp-admin/post-new.php
@@ -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');
Expand Down
7 changes: 7 additions & 0 deletions wp-admin/profile.php
@@ -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);

Expand Down
3 changes: 3 additions & 0 deletions wp-admin/templates.php
@@ -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');
Expand Down
4 changes: 4 additions & 0 deletions wp-admin/theme-editor.php
@@ -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();
Expand Down
2 changes: 2 additions & 0 deletions wp-admin/themes.php
Expand Up @@ -18,6 +18,8 @@
}
}

$title = __('Manage Themes');
$parent_file = 'themes.php';
require_once('admin-header.php');
?>

Expand Down
5 changes: 5 additions & 0 deletions wp-admin/user-edit.php
@@ -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'));
Expand Down
6 changes: 6 additions & 0 deletions wp-admin/users.php
Expand Up @@ -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 = '';

Expand Down

0 comments on commit eda9021

Please sign in to comment.