HTML Purifier

HTML Purifier:

用PHP编写的符合标准的HTML过滤器库。不仅可以通过白名单来删除所有XSS代码,还确保您的文档符合W3C规范。

编辑器集成

  • Phorum (in use at our very own forums!)
  • MODx
  • Drupal by Bart Jansens
  • Wordpress and bbPress by John Godley
  • Joomla by Double D
  • CodeIgniter by Tyler Brownell (there is also an older plugin CodeIgniter by Andy Mathijs)
  • Symfony by Alexandre Mogère
  • CakePHP by Jose Diaz-Gonzalez
  • Joomla by Federico Capoano
  • Lithium by Hari K T
  • Elgg by Evan Winslow
  • SilverStripe CMS by Gabriele Brosulo

地址

官网
文档
下载

基本用法

require_once '/path/to/HTMLPurifier.auto.php';

$config = HTMLPurifier_Config::createDefault();
$purifier = new HTMLPurifier($config);
$clean_html = $purifier->purify($dirty_html);

你可能感兴趣的:(HTML Purifier)