3 require_once 'common.php';
6 require_once '../extras/HTMLPurifierExtras.auto.php';
7 $interchange = HTMLPurifier_ConfigSchema_InterchangeBuilder
::buildFromDirectory('test-schema/');
8 $interchange->validate();
10 if (isset($_GET['doc'])) {
12 // Hijack page generation to supply documentation
14 if (file_exists('test-schema.html') && !isset($_GET['purge'])) {
15 echo file_get_contents('test-schema.html');
20 $configdoc_xml = 'test-schema.xml';
22 $xml_builder = new HTMLPurifier_ConfigSchema_Builder_Xml();
23 $xml_builder->openURI($configdoc_xml);
24 $xml_builder->build($interchange);
25 unset($xml_builder); // free handle
27 $xslt = new ConfigDoc_HTMLXSLTProcessor();
28 $xslt->importStylesheet("../configdoc/styles/$style.xsl");
29 $xslt->setParameters(array(
30 'css' => '../configdoc/styles/plain.css',
32 $html = $xslt->transformToHTML($configdoc_xml);
34 unlink('test-schema.xml');
35 file_put_contents('test-schema.html', $html);
42 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
43 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
46 <title
>HTML Purifier Config Form Smoketest
</title
>
47 <meta http
-equiv
="Content-Type" content
="text/html; charset=UTF-8" />
48 <link rel
="stylesheet" href
="../library/HTMLPurifier/Printer/ConfigForm.css" type
="text/css" />
49 <script defer
="defer" type
="text/javascript" src
="../library/HTMLPurifier/Printer/ConfigForm.js"></script
>
52 <h1
>HTML Purifier Config Form Smoketest
</h1
>
53 <p
>This file outputs the configuration form
for every single type
54 of directive possible
.</p
>
55 <form id
="htmlpurifier-config" name
="htmlpurifier-config" method
="get" action
=""
59 $schema_builder = new HTMLPurifier_ConfigSchema_Builder_ConfigSchema();
60 $schema = $schema_builder->build($interchange);
62 $config = HTMLPurifier_Config
::loadArrayFromForm($_GET, 'config', true, true, $schema);
63 $printer = new HTMLPurifier_Printer_ConfigForm('config', '?doc#%s');
64 echo $printer->render(array(HTMLPurifier_Config
::createDefault(), $config));
70 echo htmlspecialchars(var_export($config->getAll(), true));