You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
623B

  1. <?php
  2. // This file demonstrates basic usage of HTMLPurifier.
  3. // replace this with the path to the HTML Purifier library
  4. require_once '../../library/HTMLPurifier.auto.php';
  5. $config = HTMLPurifier_Config::createDefault();
  6. // configuration goes here:
  7. $config->set('Core.Encoding', 'UTF-8'); // replace with your encoding
  8. $config->set('HTML.Doctype', 'XHTML 1.0 Transitional'); // replace with your doctype
  9. $purifier = new HTMLPurifier($config);
  10. // untrusted input HTML
  11. $html = '<b>Simple and short';
  12. $pure_html = $purifier->purify($html);
  13. echo '<pre>' . htmlspecialchars($pure_html) . '</pre>';
  14. // vim: et sw=4 sts=4