Changeset 18468 for trunk/wp-includes/update.php
- Timestamp:
- 07/26/2011 06:39:57 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/update.php
r18392 r18468 281 281 } 282 282 283 /* 284 * Collect counts and UI strings for available updates 285 * 286 * @since 3.3.0 287 * 288 * @return array 289 */ 290 function wp_get_update_data() { 291 $counts = array( 'plugins' => 0, 'themes' => 0, 'wordpress' => 0 ); 292 293 if ( current_user_can( 'update_plugins' ) ) { 294 $update_plugins = get_site_transient( 'update_plugins' ); 295 if ( ! empty( $update_plugins->response ) ) 296 $counts['plugins'] = count( $update_plugins->response ); 297 } 298 299 if ( current_user_can( 'update_themes' ) ) { 300 $update_themes = get_site_transient( 'update_themes' ); 301 if ( ! empty( $update_themes->response ) ) 302 $counts['themes'] = count( $update_themes->response ); 303 } 304 305 if ( function_exists( 'get_core_updates' ) && current_user_can( 'update_core' ) ) { 306 $update_wordpress = get_core_updates( array('dismissed' => false) ); 307 if ( ! empty( $update_wordpress ) && ! in_array( $update_wordpress[0]->response, array('development', 'latest') ) && current_user_can('update_core') ) 308 $counts['wordpress'] = 1; 309 } 310 311 $counts['total'] = $counts['plugins'] + $counts['themes'] + $counts['wordpress']; 312 $update_title = array(); 313 if ( $counts['wordpress'] ) 314 $update_title[] = sprintf(__('%d WordPress Update'), $counts['wordpress']); 315 if ( $counts['plugins'] ) 316 $update_title[] = sprintf(_n('%d Plugin Update', '%d Plugin Updates', $counts['plugins']), $counts['plugins']); 317 if ( $counts['themes'] ) 318 $update_title[] = sprintf(_n('%d Theme Update', '%d Theme Updates', $counts['themes']), $counts['themes']); 319 320 $update_title = ! empty( $update_title ) ? esc_attr( implode( ', ', $update_title ) ) : ''; 321 322 return array( 'counts' => $counts, 'title' => $update_title ); 323 } 324 283 325 function _maybe_update_core() { 284 326 include ABSPATH . WPINC . '/version.php'; // include an unmodified $wp_version
Note: See TracChangeset
for help on using the changeset viewer.