Run the sanitize_option_* filter for all options in sanitize_option(). Add some sanity checks for the permalink options while in there. fixes #18737

git-svn-id: https://develop.svn.wordpress.org/trunk@18738 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2011-09-21 19:05:06 +00:00
parent 41b4edd1a3
commit 6ed92f4fb1
1 changed files with 10 additions and 2 deletions

View File

@ -2462,6 +2462,7 @@ function sanitize_option($option, $value) {
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.'));
}
break;
case 'new_admin_email':
$value = sanitize_email($value);
if ( !is_email($value) ) {
@ -2470,6 +2471,7 @@ function sanitize_option($option, $value) {
add_settings_error('new_admin_email', 'invalid_admin_email', __('The email address entered did not appear to be a valid email address. Please enter a valid email address.'));
}
break;
case 'thumbnail_size_w':
case 'thumbnail_size_h':
case 'medium_size_w':
@ -2563,6 +2565,7 @@ function sanitize_option($option, $value) {
add_settings_error('home', 'invalid_home', __('The Site address you entered did not appear to be a valid URL. Please enter a valid URL.'));
}
break;
case 'WPLANG':
$allowed = get_available_languages();
if ( ! in_array( $value, $allowed ) && ! empty( $value ) )
@ -2578,11 +2581,16 @@ function sanitize_option($option, $value) {
}
break;
default :
$value = apply_filters("sanitize_option_{$option}", $value, $option);
case 'permalink_structure':
case 'category_base':
case 'tag_base':
$value = esc_url_raw( $value );
$value = str_replace( 'http://', '', $value );
break;
}
$value = apply_filters("sanitize_option_{$option}", $value, $option);
return $value;
}