]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/formatting.php
Wordpress 3.1.4
[autoinstalls/wordpress.git] / wp-includes / formatting.php
index 6c53f8631455252fb7c80193c38c3adaf7362f2c..92aae26d38f3df5ab5f8d52144abd5f2b6aa207d 100644 (file)
@@ -2440,7 +2440,14 @@ 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;
                                        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) ) {
+                               $value = get_option( $option ); // Resets option to stored value in the case of failed sanitization
+                               if ( function_exists('add_settings_error') )
+                                       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':
                case 'thumbnail_size_w':
                case 'thumbnail_size_h':
                case 'medium_size_w':
@@ -2534,6 +2541,11 @@ 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;
                                        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 ) )
+                               $value = get_option( $option );
+                       break;
 
                default :
                        $value = apply_filters("sanitize_option_{$option}", $value, $option);
 
                default :
                        $value = apply_filters("sanitize_option_{$option}", $value, $option);
@@ -2912,7 +2924,7 @@ function capital_P_dangit( $text ) {
  * @return string Sanitized mime type
  */
 function sanitize_mime_type( $mime_type ) {
  * @return string Sanitized mime type
  */
 function sanitize_mime_type( $mime_type ) {
-       $sani_mime_type = preg_replace( '/[^-*.a-zA-Z0-9\/]/', '', $mime_type );
+       $sani_mime_type = preg_replace( '/[^-+*.a-zA-Z0-9\/]/', '', $mime_type );
        return apply_filters( 'sanitize_mime_type', $sani_mime_type, $mime_type );
 }
 
        return apply_filters( 'sanitize_mime_type', $sani_mime_type, $mime_type );
 }