Make WordPress Core

Changeset 21877


Ignore:
Timestamp:
09/16/2012 10:51:44 PM (12 years ago)
Author:
azaozz
Message:

Admin menu: add phpdoc/inline comments describing the usage of the param $icon_url in add_menu_page(), add string 'none' to be used when a menu icon is added from CSS, switch core items in the admin menu to use 'none', fixes #21349

Location:
trunk/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/plugin.php

    r21838 r21877  
    885885 * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
    886886 * @param callback $function The function to be called to output the content for this page.
    887  * @param string $icon_url The url to the icon to be used for this menu
     887 * @param string $icon_url The url to the icon to be used for this menu. Using 'none' would leave div.wp-menu-image empty
     888 *                         so an icon can be added as background with CSS.
    888889 * @param int $position The position in the menu order this one should appear
    889890 *
  • trunk/wp-admin/menu-header.php

    r21574 r21877  
    6969        $id = ! empty( $item[5] ) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : '';
    7070        $img = '';
     71        // if the string 'none' (previously 'div') is passed instead of an URL, don't output the default menu image
     72        // so an icon can be added to div.wp-menu-image as background with CSS.
    7173        if ( ! empty( $item[6] ) )
    72             $img = ( 'div' === $item[6] ) ? '<br />' : '<img src="' . $item[6] . '" alt="" />';
     74            $img = ( 'none' === $item[6] || 'div' === $item[6] ) ? '<br />' : '<img src="' . $item[6] . '" alt="" />';
    7375        $arrow = '<div class="wp-menu-arrow"><div></div></div>';
    7476
  • trunk/wp-admin/menu.php

    r21838 r21877  
    2323 */
    2424
    25 $menu[2] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'div' );
     25$menu[2] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'none' );
    2626
    2727$submenu[ 'index.php' ][0] = array( __('Home'), 'read', 'index.php' );
     
    4747$menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );
    4848
    49 $menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top menu-icon-post', 'menu-posts', 'div' );
     49$menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top menu-icon-post', 'menu-posts', 'none' );
    5050    $submenu['edit.php'][5]  = array( __('All Posts'), 'edit_posts', 'edit.php' );
    5151    /* translators: add new post */
     
    6161    unset($tax);
    6262
    63 $menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'div' );
     63$menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'none' );
    6464    $submenu['upload.php'][5] = array( __('Library'), 'upload_files', 'upload.php');
    6565    /* translators: add new file */
    6666    $submenu['upload.php'][10] = array( _x('Add New', 'file'), 'upload_files', 'media-new.php');
    6767
    68 $menu[15] = array( __('Links'), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'div' );
     68$menu[15] = array( __('Links'), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'none' );
    6969    $submenu['link-manager.php'][5] = array( _x('All Links', 'admin menu'), 'manage_links', 'link-manager.php' );
    7070    /* translators: add new links */
     
    7272    $submenu['link-manager.php'][15] = array( __('Link Categories'), 'manage_categories', 'edit-tags.php?taxonomy=link_category' );
    7373
    74 $menu[20] = array( __('Pages'), 'edit_pages', 'edit.php?post_type=page', '', 'menu-top menu-icon-page', 'menu-pages', 'div' );
     74$menu[20] = array( __('Pages'), 'edit_pages', 'edit.php?post_type=page', '', 'menu-top menu-icon-page', 'menu-pages', 'none' );
    7575    $submenu['edit.php?post_type=page'][5] = array( __('All Pages'), 'edit_pages', 'edit.php?post_type=page' );
    7676    /* translators: add new page */
     
    8787$awaiting_mod = wp_count_comments();
    8888$awaiting_mod = $awaiting_mod->moderated;
    89 $menu[25] = array( sprintf( __('Comments %s'), "<span class='awaiting-mod count-$awaiting_mod'><span class='pending-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'edit_posts', 'edit-comments.php', '', 'menu-top menu-icon-comments', 'menu-comments', 'div' );
     89$menu[25] = array( sprintf( __('Comments %s'), "<span class='awaiting-mod count-$awaiting_mod'><span class='pending-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'edit_posts', 'edit-comments.php', '', 'menu-top menu-icon-comments', 'menu-comments', 'none' );
    9090unset($awaiting_mod);
    9191
     
    105105        $ptype_class = $ptype_for_id;
    106106    } else {
    107         $menu_icon   = 'div';
     107        $menu_icon   = 'none';
    108108        $ptype_class = 'post';
    109109    }
     
    131131
    132132if ( current_user_can( 'switch_themes') ) {
    133     $menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' );
     133    $menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'none' );
    134134        $submenu['themes.php'][5]  = array(__('Themes'), 'switch_themes', 'themes.php');
    135135        if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
    136136            $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php');
    137137} else {
    138     $menu[60] = array( __('Appearance'), 'edit_theme_options', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' );
     138    $menu[60] = array( __('Appearance'), 'edit_theme_options', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'none' );
    139139        $submenu['themes.php'][5]  = array(__('Themes'), 'edit_theme_options', 'themes.php');
    140140        if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
     
    157157}
    158158
    159 $menu[65] = array( sprintf( __('Plugins %s'), $count ), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'div' );
     159$menu[65] = array( sprintf( __('Plugins %s'), $count ), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'none' );
    160160
    161161$submenu['plugins.php'][5]  = array( __('Installed Plugins'), 'activate_plugins', 'plugins.php' );
     
    170170
    171171if ( current_user_can('list_users') )
    172     $menu[70] = array( __('Users'), 'list_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'div' );
     172    $menu[70] = array( __('Users'), 'list_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'none' );
    173173else
    174     $menu[70] = array( __('Profile'), 'read', 'profile.php', '', 'menu-top menu-icon-users', 'menu-users', 'div' );
     174    $menu[70] = array( __('Profile'), 'read', 'profile.php', '', 'menu-top menu-icon-users', 'menu-users', 'none' );
    175175
    176176if ( current_user_can('list_users') ) {
     
    192192}
    193193
    194 $menu[75] = array( __('Tools'), 'edit_posts', 'tools.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'div' );
     194$menu[75] = array( __('Tools'), 'edit_posts', 'tools.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'none' );
    195195    $submenu['tools.php'][5] = array( __('Available Tools'), 'edit_posts', 'tools.php' );
    196196    $submenu['tools.php'][10] = array( __('Import'), 'import', 'import.php' );
     
    201201        $submenu['tools.php'][50] = array(__('Network Setup'), 'manage_options', 'network.php');
    202202
    203 $menu[80] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'div' );
     203$menu[80] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'none' );
    204204    $submenu['options-general.php'][10] = array(_x('General', 'settings screen'), 'manage_options', 'options-general.php');
    205205    $submenu['options-general.php'][15] = array(__('Writing'), 'manage_options', 'options-writing.php');
Note: See TracChangeset for help on using the changeset viewer.