Changeset 21315
- Timestamp:
- 07/24/2012 03:13:46 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/template.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/template.php
r21311 r21315 1225 1225 // any settings errors you want to show by default. 1226 1226 if ( $sanitize ) 1227 sanitize_option( $setting, get_option( $setting));1227 sanitize_option( $setting, get_option( $setting ) ); 1228 1228 1229 1229 // If settings were passed back from options.php then use them 1230 // Ignore transients if $sanitize is true, we don't want the old values anyway 1231 if ( isset($_GET['settings-updated']) && $_GET['settings-updated'] && get_transient('settings_errors') ) { 1232 $settings_errors = get_transient('settings_errors'); 1233 delete_transient('settings_errors'); 1234 // Otherwise check global in case validation has been run on this pageload 1235 } elseif ( count( $wp_settings_errors ) ) { 1236 $settings_errors = $wp_settings_errors; 1237 } else { 1238 return; 1230 if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] && get_transient( 'settings_errors' ) ) { 1231 $wp_settings_errors = array_merge( (array) $wp_settings_errors, get_transient( 'settings_errors' ) ); 1232 delete_transient( 'settings_errors' ); 1233 } 1234 1235 // Check global in case errors have been added on this pageload 1236 if ( ! count( $wp_settings_errors ) ) { 1237 return array(); 1239 1238 } 1240 1239 1241 1240 // Filter the results to those of a specific setting if one was set 1242 1241 if ( $setting ) { 1243 foreach ( (array) $settings_errors as $key => $details ) 1244 if ( $setting != $details['setting'] ) 1245 unset( $settings_errors[$key] ); 1246 } 1247 return $settings_errors; 1242 foreach ( (array) $wp_settings_errors as $key => $details ) { 1243 debug_log( $details['setting'] ); 1244 if ( $setting == $details['setting'] ) 1245 $setting_errors[] = $wp_settings_errors[$key]; 1246 } 1247 return $setting_errors; 1248 } 1249 1250 return $wp_settings_errors; 1248 1251 } 1249 1252 … … 1277 1280 $settings_errors = get_settings_errors( $setting, $sanitize ); 1278 1281 1279 if ( ! is_array( $settings_errors ) )1282 if ( empty( $settings_errors ) ) 1280 1283 return; 1281 1284
Note: See TracChangeset
for help on using the changeset viewer.