Eliminate one of the uses of `extract()` in `wp_handle_sideload()`.

See #22400.


git-svn-id: https://develop.svn.wordpress.org/trunk@28416 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-05-15 04:28:24 +00:00
parent 3e54a1fab5
commit 219ad73200
1 changed files with 10 additions and 8 deletions

View File

@ -421,19 +421,21 @@ function wp_handle_sideload( &$file, $overrides = false, $time = null ) {
// A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
if ( $test_type ) {
$wp_filetype = wp_check_filetype_and_ext( $file['tmp_name'], $file['name'], $mimes );
extract( $wp_filetype );
$ext = empty( $wp_filetype['ext'] ) ? '' : $wp_filetype['ext'];
$type = empty( $wp_filetype['type'] ) ? '' : $wp_filetype['type'];
$proper_filename = empty( $wp_filetype['proper_filename'] ) ? '' : $wp_filetype['proper_filename'];
// Check to see if wp_check_filetype_and_ext() determined the filename was incorrect
if ( $proper_filename )
if ( $proper_filename ) {
$file['name'] = $proper_filename;
if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
return $upload_error_handler( $file, __( 'Sorry, this file type is not permitted for security reasons.' ));
if ( !$type )
}
if ( ( ! $type || ! $ext ) && ! current_user_can( 'unfiltered_upload' ) ) {
return $upload_error_handler( $file, __( 'Sorry, this file type is not permitted for security reasons.' ) );
}
if ( ! $type ) {
$type = $file['type'];
}
}
// A writable uploads dir will pass this test. Again, there's no point overriding this one.
if ( ! ( ( $uploads = wp_upload_dir( $time ) ) && false === $uploads['error'] ) )