esw_svg_upload_filter_check_init()
Upload and sideload prefilter that sanitizes an SVG or refuses it.
Function · Easy SVG · Status: Internal · Defined in easy-svg.php
Usage
esw_svg_upload_filter_check_init( array $file ): array
Example
$file = esw_svg_upload_filter_check_init( $file );
if ( ! empty( $file['error'] ) ) {
return $file;
}
Description
Hooked on wp_handle_upload_prefilter and wp_handle_sideload_prefilter while SVG uploads are switched on. The client MIME type is ignored: wp_check_filetype_and_ext() decides. A file named .svg that WordPress would not accept as image/svg+xml gets an error; a real SVG is sanitized in place through esw_svg_file_checker() and gets an error when that fails.
Parameters
The $_FILES-style array with name and tmp_name.
Return value
The array, with type set or error added.