Tighten allowed upload file types.

Built from https://develop.svn.wordpress.org/trunk@25317


git-svn-id: http://core.svn.wordpress.org/trunk@25279 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-09-10 18:04:09 +00:00
parent 8fe0d246fb
commit c8a7b53c65
1 changed files with 10 additions and 2 deletions

View File

@ -2023,10 +2023,18 @@ function wp_get_mime_types() {
* @uses apply_filters() Calls 'upload_mimes' on returned array
* @uses wp_get_upload_mime_types() to fetch the list of mime types
*
* @param int|WP_User $user Optional. User to check. Defaults to current user.
* @return array Array of mime types keyed by the file extension regex corresponding to those types.
*/
function get_allowed_mime_types() {
return apply_filters( 'upload_mimes', wp_get_mime_types() );
function get_allowed_mime_types( $user = null ) {
$t = wp_get_mime_types();
unset( $t['swf'], $t['exe'] );
$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
if ( ! $unfiltered )
unset( $t['htm|html'] );
return apply_filters( 'upload_mimes', $t, $user );
}
/**