esw_svg_file_checker()
Sanitizes an SVG file in place and reports whether it succeeded.
Function · Easy SVG · Status: Internal · Defined in easy-svg.php
Usage
esw_svg_file_checker( string $file ): bool
Example
if ( ! esw_svg_file_checker( $tmp_path ) ) {
wp_delete_file( $tmp_path );
}
Description
Refuses the file when the sanitizer is missing, the file is over easy_svg_max_bytes() (checked on disk and again after reading), it is too complex, the sanitizer throws or returns nothing usable, or the cleaned bytes cannot be written back. When the result contains animation elements, href-driving animation is removed first. Used by the upload prefilters and by the attachment safety net.
Parameters
Path to a writable SVG file.
Return value
True when the file now holds sanitized markup.