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