Changeset 14231
- Timestamp:
- 04/25/2010 08:16:10 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/formatting.php
r14144 r14231 2197 2197 $original_url = $url; 2198 2198 2199 if ('' == $url) return $url; 2199 if ( '' == $url ) 2200 return $url; 2200 2201 $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url); 2201 2202 $strip = array('%0d', '%0a', '%0D', '%0A'); … … 2357 2358 function sanitize_option($option, $value) { 2358 2359 2359 switch ( $option) {2360 switch ( $option ) { 2360 2361 case 'admin_email': 2361 2362 $value = sanitize_email($value); 2362 if ( !$value && function_exists('add_settings_error') ) 2363 add_settings_error('admin_email', 'invalid_admin_email', __('The email address submitted was not in the right format. Please enter a valid email address.')); 2363 if ( !is_email($value) ) { 2364 $value = get_option( $option ); // Resets option to stored value in the case of failed sanitization 2365 if ( function_exists('add_settings_error') ) 2366 add_settings_error('admin_email', 'invalid_admin_email', __('The email address entered did not appear to be a valid email address. Please enter a valid email address.')); 2367 } 2364 2368 break; 2365 2369 … … 2395 2399 case 'posts_per_rss': 2396 2400 $value = (int) $value; 2397 if ( empty($value) ) $value = 1; 2398 if ( $value < -1 ) $value = abs($value); 2401 if ( empty($value) ) 2402 $value = 1; 2403 if ( $value < -1 ) 2404 $value = abs($value); 2399 2405 break; 2400 2406 … … 2436 2442 2437 2443 case 'siteurl': 2444 if ( (bool)preg_match( '#http(s?)://(.+)#i', $value) ) { 2445 $value = esc_url_raw($value); 2446 } else { 2447 $value = get_option( $option ); // Resets option to stored value in the case of failed sanitization 2448 if ( function_exists('add_settings_error') ) 2449 add_settings_error('siteurl', 'invalid_siteurl', __('The WordPress address you entered did not appear to be a valid URL. Please enter a valid URL.')); 2450 } 2451 break; 2452 2438 2453 case 'home': 2439 $value = esc_url_raw($value); 2454 if ( (bool)preg_match( '#http(s?)://(.+)#i', $value) ) { 2455 $value = esc_url_raw($value); 2456 } else { 2457 $value = get_option( $option ); // Resets option to stored value in the case of failed sanitization 2458 if ( function_exists('add_settings_error') ) 2459 add_settings_error('home', 'invalid_home', __('The Site address you entered did not appear to be a valid URL. Please enter a valid URL.')); 2460 } 2440 2461 break; 2462 2441 2463 default : 2442 2464 $value = apply_filters("sanitize_option_{$option}", $value, $option);
Note: See TracChangeset
for help on using the changeset viewer.