Ticket #12868: 12868-5.diff
File 12868-5.diff, 2.5 KB (added by , 15 years ago) |
---|
-
formatting.php
2359 2359 switch ($option) { 2360 2360 case 'admin_email': 2361 2361 $value = sanitize_email($value); 2362 if ( !$value && function_exists('add_settings_error') ) 2362 if ( !$value && function_exists('add_settings_error') ){ 2363 $value = get_option( $option ); // Resets option to stored val in case of invalid email 2363 2364 add_settings_error('admin_email', 'invalid_admin_email', __('The email address submitted was not in the right format. Please enter a valid email address.')); 2365 } 2364 2366 break; 2365 2367 2366 2368 case 'thumbnail_size_w': … … 2434 2436 $value = preg_replace('/[^0-9:.-]/', '', $value); // strips slashes 2435 2437 break; 2436 2438 2437 case 'siteurl': 2438 case 'home': 2439 $value = esc_url_raw($value); 2440 break; 2439 case 'siteurl': 2440 $value = esc_url_raw($value); 2441 if ( !is_url( $value ) ) 2442 { 2443 $value = get_option( $option ); // Resets option to stored val in case of empty 2444 if( function_exists('add_settings_error') ) 2445 add_settings_error('siteurl', 'invalid_siteurl', __('The WordPress address you submitted was not in the right format. Please enter a valid URL.')); 2446 } 2447 break; 2448 case 'home': 2449 $value = esc_url_raw($value); 2450 if ( !is_url( $value ) ) 2451 { 2452 $value = get_option( $option ); // Resets option to stored val in case of empty 2453 if( function_exists('add_settings_error') ) 2454 add_settings_error('home', 'invalid_home', __('The Site address you submitted was not in the right format. Please enter a valid URL.')); 2455 } 2456 break; 2441 2457 default : 2442 2458 $value = apply_filters("sanitize_option_{$option}", $value, $option); 2443 2459 break; -
pluggable.php
1767 1767 return $r; 1768 1768 } 1769 1769 endif; 1770 1771 if( !function_exists('is_url') ) 1772 { 1773 /** 1774 * Provides minimal validation that a string looks like a URL verifying only that it begins with http or https 1775 * Note that strings without dots (i.e. localhost) are considered valid RFC domain names so validation does 1776 * not look for .com, .net, etc 1777 * 1778 * @since 3.0 1779 * @param string $url A URL to be validated. 1780 * @return boolean 1781 */ 1782 function is_url( $url ) 1783 { 1784 preg_match( '#http(s?)://(.+)#i', $url, $matches ); 1785 if( empty( $matches ) ) 1786 return false; 1787 1788 return true; 1789 } 1790 } 1791 No newline at end of file