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

git-svn-id: http://svn.automattic.com/wordpress/trunk@13607 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dd32 2010-03-06 13:22:56 +00:00
parent 7ac692af5f
commit 28b2f32688
1 changed files with 16 additions and 6 deletions

View File

@ -50,20 +50,30 @@ if ( is_multisite() || is_super_admin() ) {
$submenu[ 'index.php' ][5] = array( __('My Sites'), 'read', 'my-sites.php' ); $submenu[ 'index.php' ][5] = array( __('My Sites'), 'read', 'my-sites.php' );
if ( is_super_admin() ) { if ( is_super_admin() ) {
$update_count = 0; $plugin_update_count = $theme_update_count = $wordpress_update_count = 0;
$update_plugins = get_site_transient( 'update_plugins' ); $update_plugins = get_site_transient( 'update_plugins' );
if ( !empty($update_plugins->response) ) if ( !empty($update_plugins->response) )
$update_count += count( $update_plugins->response ); $plugin_update_count = count( $update_plugins->response );
$update_themes = get_site_transient( 'update_themes' ); $update_themes = get_site_transient( 'update_themes' );
if ( !empty($update_themes->response) ) if ( !empty($update_themes->response) )
$update_count += count( $update_themes->response ); $theme_update_count = count( $update_themes->response );
$update_wordpress = get_core_updates( array('dismissed' => false) ); $update_wordpress = get_core_updates( array('dismissed' => false) );
if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array('development', 'latest') ) ) if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array('development', 'latest') ) )
$update_count++; $wordpress_update_count = 1;
unset($update_plugins, $update_themes, $update_wordpress); $update_count = $plugin_update_count + $theme_update_count + $wordpress_update_count;
$update_title = array();
if ( $wordpress_update_count )
$update_title[] = sprintf(__('%d WordPress Update'), $wordpress_update_count);
if ( $plugin_update_count )
$update_title[] = sprintf(_n('%d Plugin Update', '%d Plugin Updates', $plugin_update_count), $plugin_update_count);
if ( $theme_update_count )
$update_title[] = sprintf(_n('%d Theme Update', '%d Themes Updates', $theme_update_count), $theme_update_count);
$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'); $update_title = !empty($update_title) ? esc_attr(implode(', ', $update_title)) : '';
$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');
unset($plugin_update_count, $theme_update_count, $wordpress_update_count, $update_count, $update_title);
} }
} }