SAFE_HTML(1) RSpade Manual SAFE_HTML(1) NAME safe_html - Sanitize HTML from WYSIWYG editors to prevent XSS attacks SYNOPSIS PHP: safe_html(string $html): string JS: safe_html(html_string) DESCRIPTION Filters potentially malicious HTML while preserving safe formatting tags. Use for all user-generated rich text content before display. Both PHP (HTMLPurifier) and JS (DOMPurify) implementations use matching allowed tags and attributes for consistent behavior. WHAT GETS STRIPPED -

Output:

Hello

Input: click Output: click Input: Output: USAGE PATTERN Always sanitize on the server before storing OR before display. Sanitizing on both client and server provides defense in depth. // Controller - sanitize before saving $model->description = safe_html($params['description']); // Or sanitize on display in template <%!= safe_html(this.data.description) %> SEE ALSO html() - Escape all HTML (for plain text, not rich text) RSpade Framework December 2025 SAFE_HTML(1)