WordPress.org

Make WordPress Core

Changeset 13607


Ignore:
Timestamp:
03/06/10 13:22:56 (4 years ago)
Author:
dd32
Message:

GUU: Add Update breakdown to Title attribute of update bubble. See #12517

File:
1 edited

Legend:

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

    r13603 r13607  
    5151     
    5252    if ( is_super_admin() ) { 
    53         $update_count = 0; 
     53        $plugin_update_count = $theme_update_count = $wordpress_update_count = 0; 
    5454        $update_plugins = get_site_transient( 'update_plugins' ); 
    5555        if ( !empty($update_plugins->response) ) 
    56             $update_count += count( $update_plugins->response ); 
     56            $plugin_update_count = count( $update_plugins->response ); 
    5757        $update_themes = get_site_transient( 'update_themes' ); 
    5858        if ( !empty($update_themes->response) ) 
    59             $update_count += count( $update_themes->response ); 
     59            $theme_update_count = count( $update_themes->response ); 
    6060        $update_wordpress = get_core_updates( array('dismissed' => false) ); 
    6161        if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array('development', 'latest') ) ) 
    62             $update_count++; 
    63  
    64         unset($update_plugins, $update_themes, $update_wordpress); 
    65  
    66         $submenu[ 'index.php' ][10] = array( sprintf( __('Updates %s'), "<span class='update-plugins count-$update_count'><span class='update-count'>" . number_format_i18n($update_count) . "</span></span>" ), 'install_plugins',  'update-core.php'); 
     62            $wordpress_update_count = 1; 
     63 
     64        $update_count = $plugin_update_count + $theme_update_count + $wordpress_update_count; 
     65        $update_title = array(); 
     66        if ( $wordpress_update_count ) 
     67            $update_title[] = sprintf(__('%d WordPress Update'), $wordpress_update_count); 
     68        if ( $plugin_update_count ) 
     69            $update_title[] = sprintf(_n('%d Plugin Update', '%d Plugin Updates', $plugin_update_count), $plugin_update_count); 
     70        if ( $theme_update_count ) 
     71            $update_title[] = sprintf(_n('%d Theme Update', '%d Themes Updates', $theme_update_count), $theme_update_count); 
     72 
     73        $update_title = !empty($update_title) ? esc_attr(implode(', ', $update_title)) : ''; 
     74 
     75        $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'); 
     76        unset($plugin_update_count, $theme_update_count, $wordpress_update_count, $update_count, $update_title); 
    6777    } 
    6878} 
Note: See TracChangeset for help on using the changeset viewer.