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:
parent
8fe0d246fb
commit
c8a7b53c65
|
@ -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 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue