set('HTML', 'Strict', true); } if (!empty($_REQUEST['experimental'])) { require_once 'HTMLPurifier/Lexer/PH5P.php'; $config->set('Core', 'LexerImpl', 'PH5P'); $config->set('HTML', 'SafeObject', true); $config->set('HTML', 'SafeEmbed', true); } if (file_exists('demo.custom.php') && isLocal()) include 'demo.custom.php'; $definition = $config->getHTMLDefinition(); $doctype = $definition->doctype; if ($doctype->xml && stripos($_SERVER["HTTP_ACCEPT"], 'application/xhtml+xml') !== false && !isset($_REQUEST['debug'])) { $type = 'application/xhtml+xml'; } else { $type = 'text/html'; } header("Content-type:$type;charset=UTF-8"); // prevent PHP versions with shorttags from barfing if ($doctype->xml) { echo '' . PHP_EOL; } if (!empty($doctype->dtdPublic) && !empty($doctype->dtdSystem)) { echo 'dtdPublic.'" "'.$doctype->dtdSystem.'">' . PHP_EOL; } if ($doctype->xml) { echo '' . PHP_EOL; $END = ' /'; } else { echo '' . PHP_EOL; $END = ''; } ?> HTML Purifier Live Demo > > > > > > >
Please navigate to navigation.html to regenerate menu

Live Demo

50000) { ?>

Request exceeds maximum allowed text size of 50kb.

purify($html); ?>

Here is your purified HTML:

name == 'HTML 4.01 Transitional' || $doctype->name == 'HTML 4.01 Strict') { $img = 'http://www.w3.org/Icons/valid-html401'; } elseif ($doctype->name == 'XHTML 1.0 Transitional' || $doctype->name == 'XHTML 1.0 Strict') { $img = 'http://www.w3.org/Icons/valid-xhtml10'; } elseif ($doctype->name == 'XHTML 1.1') { $img = 'http://www.w3.org/Icons/valid-xhtml11'; } ?>
get('Core', 'CollectErrors')) { $e = $purifier->context->get('ErrorCollector'); $class = $e->getRaw() ? 'fail' : 'pass'; ?>

Here are errors that occurred during purification:

getHTMLFormatted($config); ?>

Here is the source code of the purified HTML:

If you would like to validate the code with W3C's validator, copy and paste the entire demo page's source.

Welcome to the live demo. Enter some HTML and see how HTML Purifier will filter it.

HTML Purifier Input () render($config, $allowed_lite, false); ?>

By default, HTML Purifier may remove some of your spacing or indentation. Turn on CollectErrors or experimental features in order to fully preserve whitespace.

Warning: GET request method can only hold 8129 characters (probably less depending on your browser). If you need to test anything larger than that, try the POST form.

> Use experimental features: name="experimental">

Try the form in GET and POST request flavors (GET is easy to validate with W3C, but POST allows larger inputs). Don't know what to test? Try out these sample filterings: