]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/formatting.php
Wordpress 3.1.3
[autoinstalls/wordpress.git] / wp-includes / formatting.php
index c4f53e9c975ebc1c54f7100c11df59f1389d7b38..6c53f8631455252fb7c80193c38c3adaf7362f2c 100644 (file)
@@ -718,7 +718,7 @@ function sanitize_file_name( $filename ) {
                if ( preg_match("/^[a-zA-Z]{2,5}\d?$/", $part) ) {
                        $allowed = false;
                        foreach ( $mimes as $ext_preg => $mime_match ) {
                if ( preg_match("/^[a-zA-Z]{2,5}\d?$/", $part) ) {
                        $allowed = false;
                        foreach ( $mimes as $ext_preg => $mime_match ) {
-                               $ext_preg = '!(^' . $ext_preg . ')$!i';
+                               $ext_preg = '!^(' . $ext_preg . ')$!i';
                                if ( preg_match( $ext_preg, $part ) ) {
                                        $allowed = true;
                                        break;
                                if ( preg_match( $ext_preg, $part ) ) {
                                        $allowed = true;
                                        break;
@@ -2903,4 +2903,17 @@ function capital_P_dangit( $text ) {
 
 }
 
 
 }
 
+/**
+ * Sanitize a mime type
+ *
+ * @since 3.1.3
+ *
+ * @param string $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 );
+       return apply_filters( 'sanitize_mime_type', $sani_mime_type, $mime_type );
+}
+
 ?>
 ?>