Explicitly initialize anonModule to null.
[htmlpurifier.git] / docs / examples / basic.php
blobb51096d2d97ae0cf6120cf86f67dc636e7245361
1 <?php
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>';
23 // vim: et sw=4 sts=4