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.

15 lines
470B

  1. <?php
  2. require_once 'common.php';
  3. $config = HTMLPurifier_Config::createDefault();
  4. $config->set('HTML.Doctype', 'HTML 4.01 Strict');
  5. $config->set('HTML.Allowed', 'b,a[href],br');
  6. $config->set('CSS.AllowTricky', true);
  7. $config->set('URI.Disable', true);
  8. $serial = $config->serialize();
  9. $result = unserialize($serial);
  10. $purifier = new HTMLPurifier($result);
  11. echo htmlspecialchars($purifier->purify('<b>Bold</b><br><i><a href="http://google.com">no</a> formatting</i>'));