Sanitizeresw_svg_file_checker()

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

Internal: not part of the promised public surface. It may change without notice.

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

body
$filestring

Path to a writable SVG file.

Return value

returnbool

True when the file now holds sanitized markup.

The file is overwritten. Never pass a path you do not own.