easy_svg_markup_is_clean()
Tells whether the sanitizer would leave SVG markup structurally unchanged.
Function · Easy SVG · Status: Internal · Defined in easy-svg.php
Internal: not part of the promised public surface. It may change without notice.
Usage
easy_svg_markup_is_clean( string $markup ): bool
Example
if ( ! easy_svg_markup_is_clean( $bits ) ) {
return new WP_Error( 'unclean_svg', 'Upload this SVG through the media library.' );
}
Description
Compares element names, attributes, processing instructions and text before and after sanitizing, ignoring whitespace, the XML declaration and comments. False for markup over the size limit, with a doctype, with control characters, not ending in >, too complex, or that the sanitizer refuses. Used for wp_upload_bits(), which can only refuse bytes.
Parameters
body
$markupstring
SVG markup.
Return value
returnbool
True when nothing would be removed.
Related
Was this page helpful?