Changeset 17822
- Timestamp:
- 05/06/2011 07:48:13 PM (14 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/menu.php
r17588 r17822 33 33 if ( ! is_multisite() || is_super_admin() ) { 34 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) && current_user_can('update_plugins') ) 37 $plugin_update_count = count( $update_plugins->response ); 38 $update_themes = get_site_transient( 'update_themes' ); 39 if ( !empty($update_themes->response) && current_user_can('update_themes') ) 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') ) && current_user_can('update_core') ) 43 $wordpress_update_count = 1; 35 36 if ( current_user_can( 'update_plugins' ) ) { 37 $update_plugins = get_site_transient( 'update_plugins' ); 38 if ( ! empty( $update_plugins->response ) ) 39 $plugin_update_count = count( $update_plugins->response ); 40 } 41 42 if ( current_user_can( 'update_themes' ) ) { 43 $update_themes = get_site_transient( 'update_themes' ); 44 if ( !empty($update_themes->response) ) 45 $theme_update_count = count( $update_themes->response ); 46 } 47 48 if ( current_user_can( 'update_core' ) ) { 49 $update_wordpress = get_core_updates( array('dismissed' => false) ); 50 if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array('development', 'latest') ) && current_user_can('update_core') ) 51 $wordpress_update_count = 1; 52 } 44 53 45 54 $total_update_count = $plugin_update_count + $theme_update_count + $wordpress_update_count; … … 59 68 } 60 69 61 unset($ plugin_update_count, $theme_update_count, $wordpress_update_count, $update_themes, $update_plugins, $update_wordpress);70 unset($theme_update_count, $wordpress_update_count, $update_themes, $update_plugins, $update_wordpress); 62 71 63 72 $menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' ); … … 164 173 } 165 174 166 $update_plugins = get_site_transient( 'update_plugins' );167 $update_count = 0;168 if ( !empty($update_plugins->response) )169 $update_count = count( $update_plugins->response );170 171 175 $menu_perms = get_site_option('menu_items', array()); 172 176 if ( ! is_multisite() || is_super_admin() || ! empty( $menu_perms['plugins'] ) ) { 173 $count = "<span class='update-plugins count-$ update_count'><span class='plugin-count'>" . number_format_i18n($update_count) . "</span></span>";177 $count = "<span class='update-plugins count-$plugin_update_count'><span class='plugin-count'>" . number_format_i18n($plugin_update_count) . "</span></span>"; 174 178 if ( is_multisite() || ! current_user_can( 'update_plugins' ) ) 175 179 $count = ''; … … 182 186 } 183 187 } 184 unset($menu_perms, $update_plugins, $ update_count);188 unset($menu_perms, $update_plugins, $plugin_update_count); 185 189 186 190 if ( current_user_can('list_users') ) -
trunk/wp-admin/network/menu.php
r17048 r17822 22 22 $submenu['users.php'][10] = array( _x('Add New', 'user'), 'create_users', 'user-new.php' ); 23 23 24 $plugin_update_count = $theme_update_count = $wordpress_update_count = 0; 25 $update_themes = get_site_transient( 'update_themes' ); 26 if ( !empty($update_themes->response) ) 27 $theme_update_count = count( $update_themes->response ); 28 $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'); 24 if ( current_user_can( 'update_themes' ) ) { 25 $plugin_update_count = $theme_update_count = $wordpress_update_count = 0; 26 $update_themes = get_site_transient( 'update_themes' ); 27 if ( !empty($update_themes->response) ) 28 $theme_update_count = count( $update_themes->response ); 29 $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' ); 30 } else { 31 $menu[15] = array( __( 'Themes' ), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' ); 32 } 29 33 $submenu['themes.php'][5] = array( __('Themes'), 'manage_network_themes', 'themes.php' ); 30 34 $submenu['themes.php'][10] = array( _x('Add New', 'theme'), 'install_themes', 'theme-install.php' ); 31 35 $submenu['themes.php'][15] = array( _x('Editor', 'theme editor'), 'edit_themes', 'theme-editor.php' ); 32 36 33 $update_plugins = get_site_transient( 'update_plugins' ); 34 if ( !empty($update_plugins->response) ) 35 $plugin_update_count = count( $update_plugins->response ); 36 $menu[20] = array(sprintf( __('Plugins %s'), "<span class='update-plugins count-$plugin_update_count'><span class='plugin-count'>" . number_format_i18n($plugin_update_count) . "</span></span>" ), 'manage_network_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'div'); 37 if ( current_user_can( 'update_plugins' ) ) { 38 $update_plugins = get_site_transient( 'update_plugins' ); 39 if ( !empty($update_plugins->response) ) 40 $plugin_update_count = count( $update_plugins->response ); 41 $menu[20] = array( sprintf( __( 'Plugins %s' ), "<span class='update-plugins count-$plugin_update_count'><span class='plugin-count'>" . number_format_i18n( $plugin_update_count ) . "</span></span>" ), 'manage_network_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'div'); 42 } else { 43 $menu[20] = array( __('Plugins'), 'manage_network_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'div' ); 44 } 37 45 $submenu['plugins.php'][5] = array( __('Plugins'), 'manage_network_plugins', 'plugins.php' ); 38 46 $submenu['plugins.php'][10] = array( _x('Add New', 'plugin editor'), 'install_plugins', 'plugin-install.php' ); … … 46 54 } 47 55 48 $update_wordpress = get_core_updates( array('dismissed' => false) ); 49 if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array('development', 'latest') ) ) 50 $wordpress_update_count = 1; 56 if ( current_user_can( 'update_core' ) ) { 57 $update_wordpress = get_core_updates( array('dismissed' => false) ); 58 if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array('development', 'latest') ) ) 59 $wordpress_update_count = 1; 60 61 $update_count = $plugin_update_count + $theme_update_count + $wordpress_update_count; 62 $update_title = array(); 63 if ( $wordpress_update_count ) 64 $update_title[] = sprintf(__('%d WordPress Update'), $wordpress_update_count); 65 if ( $plugin_update_count ) 66 $update_title[] = sprintf(_n('%d Plugin Update', '%d Plugin Updates', $plugin_update_count), $plugin_update_count); 67 if ( $theme_update_count ) 68 $update_title[] = sprintf(_n('%d Theme Update', '%d Themes Updates', $theme_update_count), $theme_update_count); 69 70 $update_title = !empty($update_title) ? esc_attr(implode(', ', $update_title)) : ''; 71 72 $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' ); 73 } else { 74 $menu[30] = array( __( 'Updates' ), 'manage_network', 'upgrade.php', '', 'menu-top menu-icon-tools', 'menu-update', 'div' ); 75 } 51 76 52 $update_count = $plugin_update_count + $theme_update_count + $wordpress_update_count;53 $update_title = array();54 if ( $wordpress_update_count )55 $update_title[] = sprintf(__('%d WordPress Update'), $wordpress_update_count);56 if ( $plugin_update_count )57 $update_title[] = sprintf(_n('%d Plugin Update', '%d Plugin Updates', $plugin_update_count), $plugin_update_count);58 if ( $theme_update_count )59 $update_title[] = sprintf(_n('%d Theme Update', '%d Themes Updates', $theme_update_count), $theme_update_count);60 61 $update_title = !empty($update_title) ? esc_attr(implode(', ', $update_title)) : '';62 63 $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');64 77 $submenu[ 'upgrade.php' ][10] = array( __( 'Updates' ), 'update_core', 'update-core.php' ); 65 78 $submenu[ 'upgrade.php' ][15] = array( __( 'Update Network' ), 'manage_network', 'upgrade.php' );
Note: See TracChangeset
for help on using the changeset viewer.