Iconseasy_svg_harden_icon_markup()

easy_svg_harden_icon_markup()

Strips everything active from sanitized icon markup, whatever the allow-list allows.

Function · Easy SVG · Status: Internal · Defined in includes/icons.php

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

Usage

easy_svg_harden_icon_markup( string $markup ): string

Example

$clean = easy_svg_sanitizer()->sanitize( $raw );
$safe  = is_string( $clean ) ? easy_svg_harden_icon_markup( $clean ) : '';

Description

A fixed second layer for inlined icons: removes every element in EASY_SVG_ICON_UNSAFE_ELEMENTS, every on* attribute and every href that does not start with #. Returns an empty string when the markup does not parse or no element is left under the root. Use it on markup you serve through easy_svg_icon_markup.

Parameters

body
$markupstring

Sanitized SVG markup.

Return value

returnstring

Hardened markup or an empty string.

It does not replace the sanitizer; run easy_svg_sanitizer() first.