Add theme update bubble, hide redundant bubble on network admin. props PeteMall, see #15866.

git-svn-id: http://svn.automattic.com/wordpress/trunk@17029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-12-17 18:51:19 +00:00
parent 300bee4a8d
commit 86daabffdf

View File

@ -21,12 +21,15 @@ $menu[10] = array(__('Users'), 'manage_network_users', 'users.php', '', 'menu-to
$submenu['users.php'][5] = array( __('Users'), 'manage_network_users', 'users.php' ); $submenu['users.php'][5] = array( __('Users'), 'manage_network_users', 'users.php' );
$submenu['users.php'][10] = array( _x('Add New', 'user'), 'create_users', 'user-new.php' ); $submenu['users.php'][10] = array( _x('Add New', 'user'), 'create_users', 'user-new.php' );
$menu[15] = array(__('Themes'), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div'); $plugin_update_count = $theme_update_count = $wordpress_update_count = 0;
$update_themes = get_site_transient( 'update_themes' );
if ( !empty($update_themes->response) )
$theme_update_count = count( $update_themes->response );
$menu[15] = array(sprintf(__('Themes %s'), "<span class='update-plugins count-$theme_update_count'><span class='theme-count'>" . number_format_i18n($theme_update_count) . "</span></span>" ), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div');
$submenu['themes.php'][5] = array( __('Themes'), 'manage_network_themes', 'themes.php' ); $submenu['themes.php'][5] = array( __('Themes'), 'manage_network_themes', 'themes.php' );
$submenu['themes.php'][10] = array( _x('Add New', 'theme'), 'install_themes', 'theme-install.php' ); $submenu['themes.php'][10] = array( _x('Add New', 'theme'), 'install_themes', 'theme-install.php' );
$submenu['themes.php'][15] = array( _x('Editor', 'theme editor'), 'edit_themes', 'theme-editor.php' ); $submenu['themes.php'][15] = array( _x('Editor', 'theme editor'), 'edit_themes', 'theme-editor.php' );
$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) )
$plugin_update_count = count( $update_plugins->response ); $plugin_update_count = count( $update_plugins->response );
@ -42,9 +45,6 @@ if ( defined( 'MULTISITE' ) && defined( 'WP_ALLOW_MULTISITE' ) && WP_ALLOW_MULTI
$submenu['settings.php'][10] = array( __('Network Setup'), 'manage_network_options', 'setup.php' ); $submenu['settings.php'][10] = array( __('Network Setup'), 'manage_network_options', 'setup.php' );
} }
$update_themes = get_site_transient( 'update_themes' );
if ( !empty($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') ) )
$wordpress_update_count = 1; $wordpress_update_count = 1;
@ -61,7 +61,7 @@ if ( $theme_update_count )
$update_title = !empty($update_title) ? esc_attr(implode(', ', $update_title)) : ''; $update_title = !empty($update_title) ? esc_attr(implode(', ', $update_title)) : '';
$menu[30] = 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>" ), 'manage_network', 'upgrade.php', '', 'menu-top menu-icon-tools', 'menu-update', 'div'); $menu[30] = 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>" ), 'manage_network', 'upgrade.php', '', 'menu-top menu-icon-tools', 'menu-update', 'div');
$submenu[ 'upgrade.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'); $submenu[ 'upgrade.php' ][10] = array( __( 'Updates' ), 'install_plugins', 'update-core.php' );
$submenu[ 'upgrade.php' ][15] = array( __( 'Update Network' ), 'manage_network', 'upgrade.php' ); $submenu[ 'upgrade.php' ][15] = array( __( 'Update Network' ), 'manage_network', 'upgrade.php' );
unset($plugin_update_count, $theme_update_count, $wordpress_update_count, $update_count, $update_title, $update_themes, $update_plugins, $update_wordpress); unset($plugin_update_count, $theme_update_count, $wordpress_update_count, $update_count, $update_title, $update_themes, $update_plugins, $update_wordpress);