Changeset 18468 for trunk/wp-admin/menu.php
- Timestamp:
- 07/26/2011 06:39:57 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/menu.php
r18254 r18468 31 31 } 32 32 33 if ( ! is_multisite() || is_super_admin() ) { 34 $plugin_update_count = $theme_update_count = $wordpress_update_count = 0; 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 } 53 54 $total_update_count = $plugin_update_count + $theme_update_count + $wordpress_update_count; 55 $update_title = array(); 56 if ( $wordpress_update_count ) 57 $update_title[] = sprintf(__('%d WordPress Update'), $wordpress_update_count); 58 if ( $plugin_update_count ) 59 $update_title[] = sprintf(_n('%d Plugin Update', '%d Plugin Updates', $plugin_update_count), $plugin_update_count); 60 if ( $theme_update_count ) 61 $update_title[] = sprintf(_n('%d Theme Update', '%d Theme Updates', $theme_update_count), $theme_update_count); 62 63 $update_title = !empty($update_title) ? esc_attr(implode(', ', $update_title)) : ''; 64 } 33 if ( ! is_multisite() || is_super_admin() ) 34 $update_data = wp_get_update_data(); 65 35 66 36 if ( ! is_multisite() ) { 67 $submenu[ 'index.php' ][10] = array( sprintf( __('Updates %s'), "<span class='update-plugins count-$total_update_count' title='$update_title'><span class='update-count'>" . number_format_i18n($total_update_count) . "</span></span>" ), 'update_core', 'update-core.php'); 68 } 69 70 unset($theme_update_count, $wordpress_update_count, $update_themes, $update_plugins, $update_wordpress); 37 $submenu[ 'index.php' ][10] = array( sprintf( __('Updates %s'), "<span class='update-plugins count-{$update_data['counts']['total']}' title='{$update_data['title']}'><span class='update-count'>" . number_format_i18n($update_data['counts']['total']) . "</span></span>" ), 'update_core', 'update-core.php'); 38 } 71 39 72 40 $menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' ); … … 177 145 $menu_perms = get_site_option( 'menu_items', array() ); 178 146 if ( ! is_multisite() || is_super_admin() || ! empty( $menu_perms['plugins'] ) ) { 147 if ( ! isset( $update_data ) ) 148 $update_data = wp_get_update_data(); 149 179 150 $count = ''; 180 151 if ( ! is_multisite() && current_user_can( 'update_plugins' ) ) 181 $count = "<span class='update-plugins count- $plugin_update_count'><span class='plugin-count'>" . number_format_i18n($plugin_update_count) . "</span></span>";152 $count = "<span class='update-plugins count-{$update_data['counts']['plugins']}'><span class='plugin-count'>" . number_format_i18n($update_data['counts']['plugins']) . "</span></span>"; 182 153 183 154 $menu[65] = array( sprintf( __('Plugins %s'), $count ), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'div' ); … … 191 162 } 192 163 } 193 unset($menu_perms, $update_ plugins, $plugin_update_count);164 unset($menu_perms, $update_data); 194 165 195 166 if ( current_user_can('list_users') )
Note: See TracChangeset
for help on using the changeset viewer.