diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index 67544bc..eef3bd1 100644
a
|
b
|
function wp_filesize( $path ) { |
3603 | 3603 | * @return string[] Array of mime types keyed by the file extension regex corresponding |
3604 | 3604 | * to those types. |
3605 | 3605 | */ |
3606 | | function get_allowed_mime_types( $user = null ) { |
| 3606 | function get_allowed_mime_types( $user = null, $ignore_user = false ) { |
3607 | 3607 | $t = wp_get_mime_types(); |
3608 | 3608 | |
3609 | 3609 | unset( $t['swf'], $t['exe'] ); |
… |
… |
function get_allowed_mime_types( $user = null ) { |
3616 | 3616 | } |
3617 | 3617 | |
3618 | 3618 | /** |
3619 | | * Filters the list of allowed mime types and file extensions. |
3620 | | * |
3621 | | * @since 2.0.0 |
3622 | | * |
3623 | | * @param array $t Mime types keyed by the file extension regex corresponding to those types. |
3624 | | * @param int|WP_User|null $user User ID, User object or null if not provided (indicates current user). |
| 3619 | * @param array $t Mime types keyed by the file extension regex corresponding to |
| 3620 | * those types. 'swf' and 'exe' removed from full list. 'htm|html' also |
| 3621 | * removed depending on '$user' capabilities. |
| 3622 | * @param int|WP_User|null $user User ID, User object or null if not provided (indicates current user). |
| 3623 | * |
| 3624 | * @param bool $ignore_user An override flag to return all possible mime types regardless of user. |
3625 | 3625 | */ |
3626 | | return apply_filters( 'upload_mimes', $t, $user ); |
| 3626 | return apply_filters( 'upload_mimes', $t, $user, $ignore_user ); |
3627 | 3627 | } |
3628 | 3628 | |
3629 | 3629 | /** |
diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php
index 9d3260a..75918da 100644
a
|
b
|
class Tests_Functions extends WP_UnitTestCase { |
2218 | 2218 | ); |
2219 | 2219 | $this->assertSameSetsWithIndex( $theme_json, $expected_theme_json ); |
2220 | 2220 | } |
2221 | | } |
| 2221 | |
| 2222 | /** |
| 2223 | * @ticket 32544 |
| 2224 | */ |
| 2225 | function test_get_allowed_mime_types_all() { |
| 2226 | add_filter( 'upload_mimes', array( $this, 'whitelist_test_mime_type_ignore' ), 10, 3 ); |
| 2227 | $all_mimes = get_allowed_mime_types( null, true ); |
| 2228 | $this->assertArrayHasKey( 'test', $all_mimes ); |
| 2229 | |
| 2230 | $mimes = get_allowed_mime_types(); |
| 2231 | $this->assertArrayNotHasKey( 'test', $mimes ); |
| 2232 | } |
| 2233 | |
| 2234 | public function whitelist_test_mime_type_ignore( $mimes, $user_id, $ignore_user ) { |
| 2235 | $mime_types = array( 'test' => 'text/test' ); |
| 2236 | if ( $ignore_user ) { |
| 2237 | $mimes = array_merge( $mime_types, $mimes ); |
| 2238 | } |
| 2239 | return $mimes; |
| 2240 | } |
| 2241 | } |
| 2242 | No newline at end of file |