Sanitizes the icon SVG content.
Description
Logic borrowed from twentytwenty.
See also
- twentytwenty_get_theme_svg
Parameters
$icon_contentstringrequired- The icon SVG content to sanitize.
Source
protected function sanitize_icon_content( $icon_content ) {
$allowed_tags = array(
'svg' => array(
'class' => true,
'xmlns' => true,
'width' => true,
'height' => true,
'viewbox' => true,
'aria-hidden' => true,
'role' => true,
'focusable' => true,
),
'path' => array(
'fill' => true,
'fill-rule' => true,
'd' => true,
'transform' => true,
),
'polygon' => array(
'fill' => true,
'fill-rule' => true,
'points' => true,
'transform' => true,
'focusable' => true,
),
);
return wp_kses( $icon_content, $allowed_tags );
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.