mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-12 14:49:55 +01:00
Media: Add a $real_mime
parameter to the wp_check_filetype_and_ext
filter.
This allows more accurate filtering of the filename and extension given to uploaded files. Props desrosj, Tkama. Fixes #45707. Built from https://develop.svn.wordpress.org/trunk@44677 git-svn-id: http://core.svn.wordpress.org/trunk@44508 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7d9f962521
commit
d289b00dc6
@ -2638,6 +2638,7 @@ function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
|
|||||||
* Filters the "real" file type of the given file.
|
* Filters the "real" file type of the given file.
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
* @since 5.1.0 The $real_mime parameter was added.
|
||||||
*
|
*
|
||||||
* @param array $wp_check_filetype_and_ext File data array containing 'ext', 'type', and
|
* @param array $wp_check_filetype_and_ext File data array containing 'ext', 'type', and
|
||||||
* 'proper_filename' keys.
|
* 'proper_filename' keys.
|
||||||
@ -2645,8 +2646,9 @@ function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
|
|||||||
* @param string $filename The name of the file (may differ from $file due to
|
* @param string $filename The name of the file (may differ from $file due to
|
||||||
* $file being in a tmp directory).
|
* $file being in a tmp directory).
|
||||||
* @param array $mimes Key is the file extension with value as the mime type.
|
* @param array $mimes Key is the file extension with value as the mime type.
|
||||||
|
* @param string|bool $real_mime The actual mime type or false if the type cannot be determined.
|
||||||
*/
|
*/
|
||||||
return apply_filters( 'wp_check_filetype_and_ext', compact( 'ext', 'type', 'proper_filename' ), $file, $filename, $mimes );
|
return apply_filters( 'wp_check_filetype_and_ext', compact( 'ext', 'type', 'proper_filename' ), $file, $filename, $mimes, $real_mime );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.1-beta1-44676';
|
$wp_version = '5.1-beta1-44677';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user