WordPress.org

Make WordPress Core

Changeset 16374


Ignore:
Timestamp:
11/14/2010 06:49:18 PM (9 years ago)
Author:
scribu
Message:

Don't display Updates submenu in site admin. See #14435

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/menu.php

    r16294 r16374  
    2525$menu[2] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'div' );
    2626
    27 if ( is_multisite() || is_super_admin() ) {
    28     $submenu[ 'index.php' ][0] = array( __('Dashboard'), 'read', 'index.php' );
    29 
    30     if ( is_multisite() )
    31         $submenu[ 'index.php' ][5] = array( __('My Sites'), 'read', 'my-sites.php' );
    32 
    33     if ( is_super_admin() ) {
    34         $plugin_update_count = $theme_update_count = $wordpress_update_count = 0;
    35         $update_plugins = get_site_transient( 'update_plugins' );
    36         if ( !empty($update_plugins->response) )
    37             $plugin_update_count = count( $update_plugins->response );
    38         $update_themes = get_site_transient( 'update_themes' );
    39         if ( !empty($update_themes->response) )
    40             $theme_update_count = count( $update_themes->response );
    41         $update_wordpress = get_core_updates( array('dismissed' => false) );
    42         if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array('development', 'latest') ) )
    43             $wordpress_update_count = 1;
    44 
    45         $update_count = $plugin_update_count + $theme_update_count + $wordpress_update_count;
    46         $update_title = array();
    47         if ( $wordpress_update_count )
    48             $update_title[] = sprintf(__('%d WordPress Update'), $wordpress_update_count);
    49         if ( $plugin_update_count )
    50             $update_title[] = sprintf(_n('%d Plugin Update', '%d Plugin Updates', $plugin_update_count), $plugin_update_count);
    51         if ( $theme_update_count )
    52             $update_title[] = sprintf(_n('%d Theme Update', '%d Themes Updates', $theme_update_count), $theme_update_count);
    53 
    54         $update_title = !empty($update_title) ? esc_attr(implode(', ', $update_title)) : '';
    55 
    56         $submenu[ 'index.php' ][10] = array( sprintf( __('Updates %s'), "<span class='update-plugins count-$update_count' title='$update_title'><span class='update-count'>" . number_format_i18n($update_count) . "</span></span>" ), 'install_plugins',  'update-core.php');
    57         unset($plugin_update_count, $theme_update_count, $wordpress_update_count, $update_count, $update_title, $update_themes, $update_plugins, $update_wordpress);
    58     }
     27$submenu[ 'index.php' ][0] = array( __('Dashboard'), 'read', 'index.php' );
     28
     29if ( is_multisite() ) {
     30    $submenu[ 'index.php' ][5] = array( __('My Sites'), 'read', 'my-sites.php' );
     31} else {
     32    $plugin_update_count = $theme_update_count = $wordpress_update_count = 0;
     33    $update_plugins = get_site_transient( 'update_plugins' );
     34    if ( !empty($update_plugins->response) )
     35        $plugin_update_count = count( $update_plugins->response );
     36    $update_themes = get_site_transient( 'update_themes' );
     37    if ( !empty($update_themes->response) )
     38        $theme_update_count = count( $update_themes->response );
     39    $update_wordpress = get_core_updates( array('dismissed' => false) );
     40    if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array('development', 'latest') ) )
     41        $wordpress_update_count = 1;
     42
     43    $update_count = $plugin_update_count + $theme_update_count + $wordpress_update_count;
     44    $update_title = array();
     45    if ( $wordpress_update_count )
     46        $update_title[] = sprintf(__('%d WordPress Update'), $wordpress_update_count);
     47    if ( $plugin_update_count )
     48        $update_title[] = sprintf(_n('%d Plugin Update', '%d Plugin Updates', $plugin_update_count), $plugin_update_count);
     49    if ( $theme_update_count )
     50        $update_title[] = sprintf(_n('%d Theme Update', '%d Themes Updates', $theme_update_count), $theme_update_count);
     51
     52    $update_title = !empty($update_title) ? esc_attr(implode(', ', $update_title)) : '';
     53
     54    $submenu[ 'index.php' ][10] = array( sprintf( __('Updates %s'), "<span class='update-plugins count-$update_count' title='$update_title'><span class='update-count'>" . number_format_i18n($update_count) . "</span></span>" ), 'install_plugins',  'update-core.php');
     55    unset($plugin_update_count, $theme_update_count, $wordpress_update_count, $update_count, $update_title, $update_themes, $update_plugins, $update_wordpress);
    5956}
    6057
Note: See TracChangeset for help on using the changeset viewer.