| @@ 199-205 (lines=7) @@ | ||
| 196 | ); |
|
| 197 | ||
| 198 | add_filter( 'jetpack_supported_media_sideload_types', $mime_type_static_filter ); |
|
| 199 | if ( |
|
| 200 | ! self::is_file_supported_for_sideloading( $tmp_filename ) && |
|
| 201 | ! file_is_displayable_image( $tmp_filename ) |
|
| 202 | ) { |
|
| 203 | @unlink( $tmp_filename ); |
|
| 204 | return new WP_Error( 'invalid_input', 'Invalid file type.', 403 ); |
|
| 205 | } |
|
| 206 | remove_filter( 'jetpack_supported_media_sideload_types', $mime_type_static_filter ); |
|
| 207 | ||
| 208 | // generate a new file name |
|
| @@ 1895-1898 (lines=4) @@ | ||
| 1892 | ||
| 1893 | // First check to see if we get a mime-type match by file, otherwise, check to |
|
| 1894 | // see if WordPress supports this file as an image. If neither, then it is not supported. |
|
| 1895 | if ( ! $this->is_file_supported_for_sideloading( $tmp ) || 'image' === $type && ! file_is_displayable_image( $tmp ) ) { |
|
| 1896 | @unlink( $tmp ); |
|
| 1897 | return new WP_Error( 'invalid_input', 'Invalid file type.', 403 ); |
|
| 1898 | } |
|
| 1899 | ||
| 1900 | // emulate a $_FILES entry |
|
| 1901 | $file_array = array( |
|