Ticket #12868: 12868-3.diff
File 12868-3.diff, 1.9 KB (added by , 15 years ago) |
---|
-
wp-includes/formatting.php
2435 2435 break; 2436 2436 2437 2437 case 'siteurl': 2438 $value = esc_url_raw($value); 2439 if ( !is_url( $value ) && function_exists('add_settings_error') ) 2440 { 2441 $value = get_option( $option ); // Resets option to stored val in case of empty 2442 add_settings_error('siteurl', 'invalid_siteurl', __('The WordPress address you submitted was not in the right format. Please enter a valid URL.')); 2443 } 2444 break; 2438 2445 case 'home': 2439 2446 $value = esc_url_raw($value); 2447 if ( !is_url( $value ) && function_exists('add_settings_error') ) 2448 { 2449 $value = get_option( $option ); // Resets option to stored val in case of empty 2450 add_settings_error('home', 'invalid_home', __('The Site address you submitted was not in the right format. Please enter a valid URL.')); 2451 } 2440 2452 break; 2441 2453 default : 2442 2454 $value = apply_filters("sanitize_option_{$option}", $value, $option); -
wp-includes/pluggable.php
1749 1749 return $r; 1750 1750 } 1751 1751 endif; 1752 1753 if( !function_exists('is_url') ) 1754 { 1755 /** 1756 * Provides minimal validation that a string looks like a URL verifying only that it begins with http or https 1757 * Note that strings without dots (i.e. localhost) are considered valid RFC domain names so validation does 1758 * not look for .com, .net, etc 1759 * 1760 * @since 3.0 1761 * @param string $url A URL to be validated. 1762 * @return boolean 1763 */ 1764 function is_url( $url ) 1765 { 1766 preg_match( '#http(s?)://(.+)#i', $url, $matches ); 1767 if( empty( $matches ) ) 1768 return false; 1769 1770 return true; 1771 } 1772 } 1773 No newline at end of file