Changeset 18984
- Timestamp:
- 10/17/2011 10:06:31 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/admin-bar.php
r18929 r18984 272 272 ) ); 273 273 274 // Add the whole adminmenu.275 wp_admin_bar_a dminmenu_menu( $wp_admin_bar );274 // Add the appearance menu. 275 wp_admin_bar_appearance_menu( $wp_admin_bar ); 276 276 } 277 277 } … … 600 600 601 601 /** 602 * Add the whole default admin menu.603 *604 * @since 3.3.0605 */606 function wp_admin_bar_adminmenu_menu( $wp_admin_bar ) {607 608 $menu = $submenu = array();609 610 $menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', 'menu-posts' );611 $submenu['edit.php'][5] = array( __('All Posts'), 'edit_posts', 'edit.php' );612 /* translators: add new post */613 $submenu['edit.php'][10] = array( _x('Add New', 'post'), 'edit_posts', 'post-new.php' );614 615 $i = 15;616 foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {617 if ( ! $tax->show_ui || ! in_array('post', (array) $tax->object_type, true) )618 continue;619 620 $submenu['edit.php'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name );621 }622 unset($tax);623 624 $menu[10] = array( __('Media'), 'upload_files', 'upload.php', 'menu-media' );625 $submenu['upload.php'][5] = array( __('Library'), 'upload_files', 'upload.php');626 /* translators: add new file */627 $submenu['upload.php'][10] = array( _x('Add New', 'file'), 'upload_files', 'media-new.php');628 629 $menu[15] = array( __('Links'), 'manage_links', 'link-manager.php', 'menu-links' );630 $submenu['link-manager.php'][5] = array( __('All Links'), 'manage_links', 'link-manager.php' );631 /* translators: add new links */632 $submenu['link-manager.php'][10] = array( _x('Add New', 'link'), 'manage_links', 'link-add.php' );633 $submenu['link-manager.php'][15] = array( __('Link Categories'), 'manage_categories', 'edit-tags.php?taxonomy=link_category' );634 635 $menu[20] = array( __('Pages'), 'edit_pages', 'edit.php?post_type=page', 'menu-pages' );636 $submenu['edit.php?post_type=page'][5] = array( __('All Pages'), 'edit_pages', 'edit.php?post_type=page' );637 /* translators: add new page */638 $submenu['edit.php?post_type=page'][10] = array( _x('Add New', 'page'), 'edit_pages', 'post-new.php?post_type=page' );639 $i = 15;640 foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {641 if ( ! $tax->show_ui || ! in_array('page', (array) $tax->object_type, true) )642 continue;643 644 $submenu['edit.php?post_type=page'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&post_type=page' );645 }646 unset($tax);647 648 $menu[25] = array( __('Comments'), 'edit_posts', 'edit-comments.php', 'menu-comments' );649 650 //$submenu[ 'edit-comments.php' ][0] = array( __('All Comments'), 'edit_posts', 'edit-comments.php' );651 652 if ( current_user_can( 'switch_themes') ) { // special case, calls wp_admin_bar_appearance_menu()653 $menu[60] = array( '', '', '', 'menu-appearance' );654 }655 656 $menu[65] = array( __('Plugins'), 'activate_plugins', 'plugins.php', 'menu-plugins' );657 658 $submenu['plugins.php'][5] = array( __('Installed Plugins'), 'activate_plugins', 'plugins.php' );659 660 if ( ! is_multisite() ) {661 /* translators: add new plugin */662 $submenu['plugins.php'][10] = array( _x('Add New', 'plugin'), 'install_plugins', 'plugin-install.php' );663 }664 665 if ( current_user_can('list_users') )666 $menu[70] = array( __('Users'), 'list_users', 'users.php', 'menu-users' );667 else668 $menu[70] = array( __('Profile'), 'read', 'profile.php', 'menu-users' );669 670 if ( current_user_can('list_users') ) {671 $_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.672 $submenu['users.php'][5] = array(__('All Users'), 'list_users', 'users.php');673 if ( current_user_can('create_users') )674 $submenu['users.php'][10] = array(_x('Add New', 'user'), 'create_users', 'user-new.php');675 else676 $submenu['users.php'][10] = array(_x('Add New', 'user'), 'promote_users', 'user-new.php');677 678 $submenu['users.php'][15] = array(__('Your Profile'), 'read', 'profile.php');679 } else {680 $_wp_real_parent_file['users.php'] = 'profile.php';681 $submenu['profile.php'][5] = array(__('Your Profile'), 'read', 'profile.php');682 if ( current_user_can('create_users') )683 $submenu['profile.php'][10] = array(__('Add New User'), 'create_users', 'user-new.php');684 else685 $submenu['profile.php'][10] = array(__('Add New User'), 'promote_users', 'user-new.php');686 }687 688 $menu[75] = array( __('Tools'), 'edit_posts', 'tools.php', 'menu-tools' );689 $submenu['tools.php'][5] = array( __('Available Tools'), 'edit_posts', 'tools.php' );690 $submenu['tools.php'][10] = array( __('Import'), 'import', 'import.php' );691 $submenu['tools.php'][15] = array( __('Export'), 'export', 'export.php' );692 if ( is_multisite() && !is_main_site() )693 $submenu['tools.php'][25] = array( __('Delete Site'), 'manage_options', 'ms-delete-site.php' );694 if ( ! is_multisite() && defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE )695 $submenu['tools.php'][50] = array(__('Network Setup'), 'manage_options', 'network.php');696 697 $menu[80] = array( __('Settings'), 'manage_options', 'options-general.php', 'menu-settings' );698 $submenu['options-general.php'][10] = array(_x('General', 'settings screen'), 'manage_options', 'options-general.php');699 $submenu['options-general.php'][15] = array(__('Writing'), 'manage_options', 'options-writing.php');700 $submenu['options-general.php'][20] = array(__('Reading'), 'manage_options', 'options-reading.php');701 $submenu['options-general.php'][25] = array(__('Discussion'), 'manage_options', 'options-discussion.php');702 $submenu['options-general.php'][30] = array(__('Media'), 'manage_options', 'options-media.php');703 $submenu['options-general.php'][35] = array(__('Privacy'), 'manage_options', 'options-privacy.php');704 $submenu['options-general.php'][40] = array(__('Permalinks'), 'manage_options', 'options-permalink.php');705 706 foreach ( $menu as $item ) {707 if ( 'menu-appearance' == $item[3] ) {708 wp_admin_bar_appearance_menu( $wp_admin_bar );709 continue;710 }711 712 if ( !current_user_can($item[1]) )713 continue;714 715 $wp_admin_bar->add_menu( array('id' => $item[3], 'title' => $item[0], 'href' => admin_url($item[2]), 'parent' => 'site-name') );716 717 if ( !empty($submenu[$item[2]]) ) {718 foreach ( $submenu[$item[2]] as $name => $value ) {719 if ( !current_user_can($value[1]) )720 continue;721 722 $id = preg_replace( '/[^a-z0-9-]+/', '-', str_replace('.php', '', "{$item[3]}-$name") );723 $wp_admin_bar->add_menu( array( 'parent' => $item[3], 'id' => $id, 'title' => $value[0], 'href' => admin_url($value[2]) ) );724 }725 }726 }727 }728 729 /**730 602 * Provide an update link if theme/plugin/core updates are available. 731 603 *
Note: See TracChangeset
for help on using the changeset viewer.