Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.
/ xss Public archive

PHP filter class to prevent cross-site-scripting (XSS) vulnerabilities. Removes dangerous tags and protocols from HTML. The main difference between this class and strip_tags() or filter_var() is that you can preserve certain tags AND sanitize their attributes. Port of Drupal's XSS filter

License

Notifications You must be signed in to change notification settings

ymakux/xss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

$filter = new Filter();

$allowed_protocols = array('http', 'ftp', 'mailto');
$allowed_tags = array('a', 'i', 'b', 'em', 'span', 'strong', 'ul', 'ol', 'li', 'table', 'tr', 'td', 'thead', 'th', 'tbody');

$filter->addAllowedProtocols($allowed_protocols);
$filter->addAllowedTags($allowed_tags);

$filtered_string = $filter->xss($string);

About

PHP filter class to prevent cross-site-scripting (XSS) vulnerabilities. Removes dangerous tags and protocols from HTML. The main difference between this class and strip_tags() or filter_var() is that you can preserve certain tags AND sanitize their attributes. Port of Drupal's XSS filter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages