Changeset 25810
- Timestamp:
- 10/16/2013 02:33:21 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/update.php
r25801 r25810 356 356 } 357 357 add_action( 'admin_notices', 'maintenance_nag' ); 358 359 /**360 * Retrieves a list of all language updates available.361 *362 * @since 3.7.0363 */364 function wp_get_translation_updates() {365 $updates = array();366 $transients = array( 'update_core' => 'core', 'update_plugins' => 'plugin', 'update_themes' => 'theme' );367 foreach ( $transients as $transient => $type ) {368 369 $transient = get_site_transient( $transient );370 if ( empty( $transient->translations ) )371 continue;372 373 foreach ( $transient->translations as $translation ) {374 $updates[] = (object) $translation;375 }376 }377 378 return $updates;379 } -
trunk/src/wp-includes/update.php
r25781 r25810 421 421 } 422 422 423 /** 424 * Retrieves a list of all language updates available. 425 * 426 * @since 3.7.0 427 */ 428 function wp_get_translation_updates() { 429 $updates = array(); 430 $transients = array( 'update_core' => 'core', 'update_plugins' => 'plugin', 'update_themes' => 'theme' ); 431 foreach ( $transients as $transient => $type ) { 432 433 $transient = get_site_transient( $transient ); 434 if ( empty( $transient->translations ) ) 435 continue; 436 437 foreach ( $transient->translations as $translation ) { 438 $updates[] = (object) $translation; 439 } 440 } 441 442 return $updates; 443 } 444 423 445 /* 424 446 * Collect counts and UI strings for available updates … … 429 451 */ 430 452 function wp_get_update_data() { 431 $counts = array( 'plugins' => 0, 'themes' => 0, 'wordpress' => 0 );432 433 if ( current_user_can( 'update_plugins' ) ) {453 $counts = array( 'plugins' => 0, 'themes' => 0, 'wordpress' => 0, 'translations' => 0 ); 454 455 if ( $plugins = current_user_can( 'update_plugins' ) ) { 434 456 $update_plugins = get_site_transient( 'update_plugins' ); 435 457 if ( ! empty( $update_plugins->response ) ) … … 437 459 } 438 460 439 if ( current_user_can( 'update_themes' ) ) {461 if ( $themes = current_user_can( 'update_themes' ) ) { 440 462 $update_themes = get_site_transient( 'update_themes' ); 441 463 if ( ! empty( $update_themes->response ) ) … … 443 465 } 444 466 445 if ( function_exists( 'get_core_updates' ) && current_user_can( 'update_core' ) ) {467 if ( ( $core = current_user_can( 'update_core' ) ) && function_exists( 'get_core_updates' ) ) { 446 468 $update_wordpress = get_core_updates( array('dismissed' => false) ); 447 469 if ( ! empty( $update_wordpress ) && ! in_array( $update_wordpress[0]->response, array('development', 'latest') ) && current_user_can('update_core') ) … … 449 471 } 450 472 451 $counts['total'] = $counts['plugins'] + $counts['themes'] + $counts['wordpress']; 473 if ( ( $core || $plugins || $themes ) && wp_get_translation_updates() ) 474 $counts['translations'] = 1; 475 476 $counts['total'] = $counts['plugins'] + $counts['themes'] + $counts['wordpress'] + $counts['translations']; 452 477 $titles = array(); 453 478 if ( $counts['wordpress'] ) … … 457 482 if ( $counts['themes'] ) 458 483 $titles['themes'] = sprintf( _n( '%d Theme Update', '%d Theme Updates', $counts['themes'] ), $counts['themes'] ); 484 if ( $counts['translations'] ) 485 $titles['translations'] = __( 'Translation Updates' ); 459 486 460 487 $update_title = $titles ? esc_attr( implode( ', ', $titles ) ) : '';
Note: See TracChangeset
for help on using the changeset viewer.