Changeset 25256
- Timestamp:
- 09/05/2013 05:04:03 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/update.php
r22618 r25256 16 16 function get_preferred_from_update_core() { 17 17 $updates = get_core_updates(); 18 if ( ! is_array( $updates ) )18 if ( ! is_array( $updates ) ) 19 19 return false; 20 20 if ( empty( $updates ) ) 21 return (object) array('response' => 'latest');21 return (object) array( 'response' => 'latest' ); 22 22 return $updates[0]; 23 23 } … … 31 31 */ 32 32 function get_core_updates( $options = array() ) { 33 $options = array_merge( array( 'available' => true, 'dismissed' => false ), $options );33 $options = array_merge( array( 'available' => true, 'dismissed' => false ), $options ); 34 34 $dismissed = get_site_option( 'dismissed_update_core' ); 35 if ( !is_array( $dismissed ) ) $dismissed = array(); 35 36 if ( ! is_array( $dismissed ) ) 37 $dismissed = array(); 38 36 39 $from_api = get_site_transient( 'update_core' ); 37 if ( empty($from_api) ) 38 return false; 39 if ( !isset( $from_api->updates ) || !is_array( $from_api->updates ) ) return false; 40 41 if ( ! isset( $from_api->updates ) || ! is_array( $from_api->updates ) ) 42 return false; 43 40 44 $updates = $from_api->updates; 41 if ( !is_array( $updates ) ) return false;42 45 $result = array(); 43 foreach ($updates as $update) {44 if ( array_key_exists( $update->current .'|'.$update->locale, $dismissed ) ) {46 foreach ( $updates as $update ) { 47 if ( array_key_exists( $update->current . '|' . $update->locale, $dismissed ) ) { 45 48 if ( $options['dismissed'] ) { 46 49 $update->dismissed = true; 47 $result[] = $update;50 $result[] = $update; 48 51 } 49 52 } else { 50 53 if ( $options['available'] ) { 51 54 $update->dismissed = false; 52 $result[] = $update;55 $result[] = $update; 53 56 } 54 57 } … … 59 62 function dismiss_core_update( $update ) { 60 63 $dismissed = get_site_option( 'dismissed_update_core' ); 61 $dismissed[ $update->current .'|'.$update->locale ] = true;64 $dismissed[ $update->current . '|' . $update->locale ] = true; 62 65 return update_site_option( 'dismissed_update_core', $dismissed ); 63 66 } … … 65 68 function undismiss_core_update( $version, $locale ) { 66 69 $dismissed = get_site_option( 'dismissed_update_core' ); 67 $key = $version.'|'.$locale; 68 if ( !isset( $dismissed[$key] ) ) return false; 70 $key = $version . '|' . $locale; 71 72 if ( ! isset( $dismissed[$key] ) ) 73 return false; 74 69 75 unset( $dismissed[$key] ); 70 76 return update_site_option( 'dismissed_update_core', $dismissed ); … … 73 79 function find_core_update( $version, $locale ) { 74 80 $from_api = get_site_transient( 'update_core' ); 75 if ( !is_array( $from_api->updates ) ) return false; 81 82 if ( ! isset( $from_api->updates ) || ! is_array( $from_api->updates ) ) 83 return false; 84 76 85 $updates = $from_api->updates; 77 foreach ($updates as $update) {86 foreach ( $updates as $update ) { 78 87 if ( $update->current == $version && $update->locale == $locale ) 79 88 return $update;
Note: See TracChangeset
for help on using the changeset viewer.