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 '' . PHP_EOL; } if ($doctype->xml) { echo '' . PHP_EOL; $END = ' /'; } else { echo '' . PHP_EOL; $END = ''; } ?>
Request exceeds maximum allowed text size of 50kb.
purify($html); ?>Here is your purified HTML:
Here are errors that occurred during purification:
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.
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: