Changeset 18468 for trunk/wp-includes/admin-bar.php
- Timestamp:
- 07/26/2011 06:39:57 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/admin-bar.php
r18451 r18468 324 324 */ 325 325 function wp_admin_bar_updates_menu( $wp_admin_bar ) { 326 if ( !current_user_can('install_plugins') ) 327 return; 328 329 $plugin_update_count = $theme_update_count = $wordpress_update_count = 0; 330 $update_plugins = get_site_transient( 'update_plugins' ); 331 if ( !empty($update_plugins->response) ) 332 $plugin_update_count = count( $update_plugins->response ); 333 $update_themes = get_site_transient( 'update_themes' ); 334 if ( !empty($update_themes->response) ) 335 $theme_update_count = count( $update_themes->response ); 336 /* @todo get_core_updates() is only available on admin page loads 337 $update_wordpress = get_core_updates( array('dismissed' => false) ); 338 if ( !empty($update_wordpress) && !in_array( $update_wordpress[0]->response, array('development', 'latest') ) ) 339 $wordpress_update_count = 1; 340 */ 341 342 $update_count = $plugin_update_count + $theme_update_count + $wordpress_update_count; 343 344 if ( !$update_count ) 345 return; 346 347 $update_title = array(); 348 if ( $wordpress_update_count ) 349 $update_title[] = sprintf(__('%d WordPress Update'), $wordpress_update_count); 350 if ( $plugin_update_count ) 351 $update_title[] = sprintf(_n('%d Plugin Update', '%d Plugin Updates', $plugin_update_count), $plugin_update_count); 352 if ( $theme_update_count ) 353 $update_title[] = sprintf(_n('%d Theme Update', '%d Theme Updates', $theme_update_count), $theme_update_count); 354 355 $update_title = !empty($update_title) ? esc_attr(implode(', ', $update_title)) : ''; 356 357 $update_title = "<span title='$update_title'>"; 358 $update_title .= sprintf( __('Updates %s'), "<span id='ab-updates' class='update-count'>" . number_format_i18n($update_count) . '</span>' ); 326 327 $update_data = wp_get_update_data(); 328 329 if ( !$update_data['counts']['total'] ) 330 return; 331 332 $update_title = "<span title='{$update_data['title']}'>"; 333 $update_title .= sprintf( __('Updates %s'), "<span id='ab-updates' class='update-count'>" . number_format_i18n($update_data['counts']['total']) . '</span>' ); 359 334 $update_title .= '</span>'; 360 335
Note: See TracChangeset
for help on using the changeset viewer.