WC_Helper_Sanitization
in package
WC_Helper_Sanitization Class
Provides sanitization functions for admin content.
Table of Contents
- sanitize_css() : string
- Sanitize CSS markup from API responses for safe rendering in admin pages.
- sanitize_html() : string
- Sanitize HTML content allowing a subset of SVG elements.
- wc_kses_safe_svg_tags() : array<string|int, mixed>
- Add limited SVG support to wp_kses_post with XSS protection.
- wc_pre_sanitize_svg() : string
- Sanitize SVG content before processing with wp_kses.
Methods
sanitize_css()
Sanitize CSS markup from API responses for safe rendering in admin pages.
public
static sanitize_css(string $css) : string
Parameters
- $css : string
-
The raw CSS to sanitize.
Return values
string — Sanitized CSS safe for inclusion in style blocks.sanitize_html()
Sanitize HTML content allowing a subset of SVG elements.
public
static sanitize_html(string $html) : string
Parameters
- $html : string
-
The HTML to sanitize.
Return values
string — Sanitized HTML with SVG support.wc_kses_safe_svg_tags()
Add limited SVG support to wp_kses_post with XSS protection.
public
static wc_kses_safe_svg_tags() : array<string|int, mixed>
Return values
array<string|int, mixed> — Array of allowed SVG tags and their attributes.wc_pre_sanitize_svg()
Sanitize SVG content before processing with wp_kses.
public
static wc_pre_sanitize_svg(string $content) : string
Parameters
- $content : string
-
The SVG content to sanitize.