Menu fixes
git-svn-id: http://svn.automattic.com/wordpress/trunk@9178 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a0f339d3bf
commit
79656f6382
|
@ -497,14 +497,14 @@ function add_menu_page( $page_title, $menu_title, $access_level, $file, $functio
|
|||
|
||||
$file = plugin_basename( $file );
|
||||
|
||||
$menu[] = array ( $menu_title, $access_level, $file, $page_title );
|
||||
|
||||
$admin_page_hooks[$file] = sanitize_title( $menu_title );
|
||||
|
||||
$hookname = get_plugin_page_hookname( $file, '' );
|
||||
if (!empty ( $function ) && !empty ( $hookname ))
|
||||
add_action( $hookname, $function );
|
||||
|
||||
$menu[] = array ( $menu_title, $access_level, $file, $page_title, $hookname, $hookname );
|
||||
|
||||
return $hookname;
|
||||
}
|
||||
|
||||
|
@ -660,6 +660,7 @@ function get_admin_page_title() {
|
|||
$hook = get_plugin_page_hook( $plugin_page, $pagenow );
|
||||
|
||||
$parent = $parent1 = get_admin_page_parent();
|
||||
|
||||
if ( empty ( $parent) ) {
|
||||
foreach ( $menu as $menu_array ) {
|
||||
if ( isset( $menu_array[3] ) ) {
|
||||
|
@ -718,8 +719,8 @@ function get_plugin_page_hookname( $plugin_page, $parent_page ) {
|
|||
$parent = get_admin_page_parent( $parent_page );
|
||||
|
||||
$page_type = 'admin';
|
||||
if ( empty ( $parent_page ) || 'admin.php' == $parent_page ) {
|
||||
if ( isset( $admin_page_hooks[$plugin_page] ))
|
||||
if ( empty ( $parent_page ) || 'admin.php' == $parent_page || isset( $admin_page_hooks[$plugin_page] ) ) {
|
||||
if ( isset( $admin_page_hooks[$plugin_page] ) )
|
||||
$page_type = 'toplevel';
|
||||
else
|
||||
if ( isset( $admin_page_hooks[$parent] ))
|
||||
|
|
|
@ -51,12 +51,12 @@ function _wp_menu_output( &$menu, &$submenu, $submenu_as_parent = true ) {
|
|||
$class[] = 'current';
|
||||
}
|
||||
|
||||
if ( isset($item[3]) && ! empty($item[3]) )
|
||||
$class[] = $item[3];
|
||||
if ( isset($item[4]) && ! empty($item[4]) )
|
||||
$class[] = $item[4];
|
||||
|
||||
$class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
|
||||
$id = isset($item[4]) && ! empty($item[4]) ? ' id="' . $item[4] . '"' : '';
|
||||
$img = isset($item[5]) && ! empty($item[5]) ? '<img class="wp-menu-image" src="' . $item[5] . '" alt="" />' : '';
|
||||
$id = isset($item[5]) && ! empty($item[5]) ? ' id="' . $item[5] . '"' : '';
|
||||
$img = isset($item[6]) && ! empty($item[6]) ? '<img class="wp-menu-image" src="' . $item[6] . '" alt="" />' : '';
|
||||
|
||||
echo "\n\t<li$class$id>";
|
||||
|
||||
|
@ -126,4 +126,4 @@ _wp_menu_output( $menu, $submenu );
|
|||
do_action( 'adminmenu' );
|
||||
|
||||
?>
|
||||
</ul>
|
||||
</ul>
|
|
@ -24,50 +24,50 @@
|
|||
$awaiting_mod = wp_count_comments();
|
||||
$awaiting_mod = $awaiting_mod->moderated;
|
||||
|
||||
$menu[0] = array( __('Dashboard'), 'read', 'index.php', 'wp-menu-open', 'menu-dashboard', 'images/menu/home.png' );
|
||||
$menu[0] = array( __('Dashboard'), 'read', 'index.php', '', 'wp-menu-open', 'menu-dashboard', 'images/menu/home.png' );
|
||||
$submenu['index.php'][5] = array( __('Dashboard'), 'read' , 'index.php' );
|
||||
|
||||
$menu[4] = array( '', 'read', '', 'wp-menu-separator' );
|
||||
$menu[4] = array( '', 'read', '', '', 'wp-menu-separator' );
|
||||
|
||||
$menu[5] = array( __('Posts'), 'edit_posts', 'post-new.php', 'wp-menu-open', 'menu-posts', 'images/menu/posts.png' );
|
||||
$menu[5] = array( __('Posts'), 'edit_posts', 'post-new.php', '', 'wp-menu-open', 'menu-posts', 'images/menu/posts.png' );
|
||||
$submenu['post-new.php'][5] = array( __('Add New'), 'edit_posts', 'post-new.php' );
|
||||
//$submenu['post-new.php'][10] = array( __('Drafts'), 'edit_posts', 'edit-post-drafts.php' );
|
||||
$submenu['post-new.php'][15] = array( __('Edit'), 'edit_posts', 'edit.php' );
|
||||
$submenu['post-new.php'][20] = array( __('Tags'), 'manage_categories', 'edit-tags.php' );
|
||||
$submenu['post-new.php'][25] = array( __('Categories'), 'manage_categories', 'categories.php' );
|
||||
|
||||
$menu[10] = array( __('Media'), 'upload_files', 'media-new.php', '', 'menu-media', 'images/menu/media.png' );
|
||||
$menu[10] = array( __('Media'), 'upload_files', 'media-new.php', '', '', 'menu-media', 'images/menu/media.png' );
|
||||
$submenu['media-new.php'][5] = array( __('Add New'), 'upload_files', 'media-new.php');
|
||||
$submenu['media-new.php'][10] = array( __('Edit'), 'upload_files', 'upload.php');
|
||||
|
||||
$menu[15] = array( __('Links'), 'manage_links', 'link-add.php', '', 'menu-links', 'images/menu/links.png' );
|
||||
$menu[15] = array( __('Links'), 'manage_links', 'link-add.php', '', '', 'menu-links', 'images/menu/links.png' );
|
||||
$submenu['link-add.php'][5] = array( __('Add New'), 'manage_links', 'link-add.php' );
|
||||
$submenu['link-add.php'][10] = array( __('Edit'), 'manage_links', 'link-manager.php' );
|
||||
$submenu['link-add.php'][15] = array( __('Link Categories'), 'manage_categories', 'edit-link-categories.php' );
|
||||
|
||||
$menu[20] = array( __('Pages'), 'edit_pages', 'page-new.php', '', 'menu-pages', 'images/menu/pages.png' );
|
||||
$menu[20] = array( __('Pages'), 'edit_pages', 'page-new.php', '', '', 'menu-pages', 'images/menu/pages.png' );
|
||||
$submenu['page-new.php'][5] = array( __('Add New'), 'edit_pages', 'page-new.php' );
|
||||
//$submenu['page-new.php'][10] = array( __('Drafts'), 'edit_pages', 'edit-page-drafts.php' );
|
||||
$submenu['page-new.php'][15] = array( __('Edit'), 'edit_pages', 'edit-pages.php' );
|
||||
|
||||
$menu[25] = array( __('Comments'), 'edit_posts', 'edit-comments.php', '', 'menu-comments', 'images/menu/comments.png' );
|
||||
$menu[25] = array( __('Comments'), 'edit_posts', 'edit-comments.php', '', '', 'menu-comments', 'images/menu/comments.png' );
|
||||
$submenu['edit-comments.php'][15] = array( __('Comments'), 'edit_posts', 'edit-comments.php' );
|
||||
|
||||
$menu[29] = array( '', 'read', '', 'wp-menu-separator' );
|
||||
$menu[29] = array( '', 'read', '', '', 'wp-menu-separator' );
|
||||
|
||||
$menu[30] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-appearance', 'images/menu/appearance.png' );
|
||||
$menu[30] = array( __('Appearance'), 'switch_themes', 'themes.php', '', '', 'menu-appearance', 'images/menu/appearance.png' );
|
||||
$submenu['themes.php'][5] = array(__('Themes'), 'switch_themes', 'themes.php');
|
||||
$submenu['themes.php'][10] = array(__('Editor'), 'edit_themes', 'theme-editor.php');
|
||||
|
||||
$menu[35] = array( __('Plugins'), 'activate_plugins', 'plugins.php', '', 'menu-plugins', 'images/menu/plugins.png' );
|
||||
$menu[35] = array( __('Plugins'), 'activate_plugins', 'plugins.php', '', '', 'menu-plugins', 'images/menu/plugins.png' );
|
||||
$submenu['plugins.php'][15] = array(__('Add New'), 'install_plugins', 'plugin-install.php');
|
||||
$submenu['plugins.php'][5] = array( __('Installed'), 'activate_plugins', 'plugins.php' );
|
||||
$submenu['plugins.php'][10] = array( __('Editor'), 'edit_plugins', 'plugin-editor.php' );
|
||||
|
||||
if ( current_user_can('edit_users') )
|
||||
$menu[40] = array( __('Users'), 'edit_users', 'users.php', '', 'menu-users', 'images/menu/users.png' );
|
||||
$menu[40] = array( __('Users'), 'edit_users', 'users.php', '', '', 'menu-users', 'images/menu/users.png' );
|
||||
else
|
||||
$menu[40] = array( __('Profile'), 'read', 'profile.php', '', 'menu-users', 'images/menu/users.png' );
|
||||
$menu[40] = array( __('Profile'), 'read', 'profile.php', '', '', 'menu-users', 'images/menu/users.png' );
|
||||
|
||||
if ( current_user_can('edit_users') ) {
|
||||
$_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.
|
||||
|
@ -78,14 +78,14 @@ if ( current_user_can('edit_users') ) {
|
|||
$submenu['profile.php'][5] = array(__('Your Profile'), 'read', 'profile.php');
|
||||
}
|
||||
|
||||
$menu[45] = array( __('Tools'), 'manage_options', 'import.php', '', 'menu-tools', 'images/menu/tools.png' );
|
||||
$menu[45] = array( __('Tools'), 'manage_options', 'import.php', '', '', 'menu-tools', 'images/menu/tools.png' );
|
||||
$submenu['import.php'][5] = array( __('Import'), 'import', 'import.php' );
|
||||
$submenu['import.php'][10] = array( __('Export'), 'import', 'export.php' );
|
||||
$submenu['import.php'][15] = array( __('Press This'), 'publish_posts', 'press-this-landing.php' );
|
||||
if ( ! $is_opera )
|
||||
$submenu['import.php'][20] = array( __('Turbo'), 'read', 'turbo.php' );
|
||||
|
||||
$menu[50] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-settings', 'images/menu/settings.png' );
|
||||
$menu[50] = array( __('Settings'), 'manage_options', 'options-general.php', '', '', 'menu-settings', 'images/menu/settings.png' );
|
||||
$submenu['options-general.php'][10] = array(__('General'), 'manage_options', 'options-general.php');
|
||||
$submenu['options-general.php'][15] = array(__('Writing'), 'manage_options', 'options-writing.php');
|
||||
$submenu['options-general.php'][20] = array(__('Reading'), 'manage_options', 'options-reading.php');
|
||||
|
@ -162,6 +162,8 @@ foreach ( $menu as $id => $data ) {
|
|||
if ( ! current_user_can($data[1]) ) {
|
||||
$_wp_menu_nopriv[$data[2]] = true;
|
||||
unset($menu[$id]);
|
||||
} elseif ( !empty($data[0]) ) {
|
||||
$submenu[$data[2]][0] = $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue