2007-05-28 02:20:55 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once 'common.php';
|
|
|
|
|
2008-04-26 01:13:58 +00:00
|
|
|
// Setup environment
|
|
|
|
require_once '../extras/HTMLPurifierExtras.auto.php';
|
|
|
|
$interchange = HTMLPurifier_ConfigSchema_InterchangeBuilder::buildFromDirectory('test-schema/');
|
|
|
|
$interchange->validate();
|
|
|
|
|
2007-05-28 02:20:55 +00:00
|
|
|
if (isset($_GET['doc'])) {
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-04-26 01:13:58 +00:00
|
|
|
// Hijack page generation to supply documentation
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-04-26 01:13:58 +00:00
|
|
|
if (file_exists('test-schema.html') && !isset($_GET['purge'])) {
|
|
|
|
echo file_get_contents('test-schema.html');
|
2007-05-28 03:33:12 +00:00
|
|
|
exit;
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-04-26 01:13:58 +00:00
|
|
|
$style = 'plain';
|
|
|
|
$configdoc_xml = 'test-schema.xml';
|
|
|
|
|
|
|
|
$xml_builder = new HTMLPurifier_ConfigSchema_Builder_Xml();
|
|
|
|
$xml_builder->openURI($configdoc_xml);
|
|
|
|
$xml_builder->build($interchange);
|
|
|
|
unset($xml_builder); // free handle
|
|
|
|
|
|
|
|
$xslt = new ConfigDoc_HTMLXSLTProcessor();
|
|
|
|
$xslt->importStylesheet("../configdoc/styles/$style.xsl");
|
|
|
|
$xslt->setParameters(array(
|
|
|
|
'css' => '../configdoc/styles/plain.css',
|
2007-05-28 03:33:12 +00:00
|
|
|
));
|
2008-04-26 01:13:58 +00:00
|
|
|
$html = $xslt->transformToHTML($configdoc_xml);
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-04-26 01:13:58 +00:00
|
|
|
unlink('test-schema.xml');
|
|
|
|
file_put_contents('test-schema.html', $html);
|
2007-05-28 03:33:12 +00:00
|
|
|
echo $html;
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-28 02:20:55 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2008-12-06 07:28:20 +00:00
|
|
|
?><!DOCTYPE html
|
2007-05-28 02:20:55 +00:00
|
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>HTML Purifier Config Form Smoketest</title>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
|
|
<link rel="stylesheet" href="../library/HTMLPurifier/Printer/ConfigForm.css" type="text/css" />
|
|
|
|
<script defer="defer" type="text/javascript" src="../library/HTMLPurifier/Printer/ConfigForm.js"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1>HTML Purifier Config Form Smoketest</h1>
|
|
|
|
<p>This file outputs the configuration form for every single type
|
|
|
|
of directive possible.</p>
|
|
|
|
<form id="htmlpurifier-config" name="htmlpurifier-config" method="get" action=""
|
|
|
|
style="float:right;">
|
|
|
|
<?php
|
|
|
|
|
2008-04-26 01:13:58 +00:00
|
|
|
$schema_builder = new HTMLPurifier_ConfigSchema_Builder_ConfigSchema();
|
|
|
|
$schema = $schema_builder->build($interchange);
|
2007-05-28 02:20:55 +00:00
|
|
|
|
2008-05-26 04:05:48 +00:00
|
|
|
$config = HTMLPurifier_Config::loadArrayFromForm($_GET, 'config', true, true, $schema);
|
2007-05-28 13:15:06 +00:00
|
|
|
$printer = new HTMLPurifier_Printer_ConfigForm('config', '?doc#%s');
|
2008-05-26 04:05:48 +00:00
|
|
|
echo $printer->render(array(HTMLPurifier_Config::createDefault(), $config));
|
2007-05-28 02:20:55 +00:00
|
|
|
|
|
|
|
?>
|
|
|
|
</form>
|
|
|
|
<pre>
|
|
|
|
<?php
|
2008-04-26 01:13:58 +00:00
|
|
|
echo htmlspecialchars(var_export($config->getAll(), true));
|
2007-05-28 02:20:55 +00:00
|
|
|
?>
|
|
|
|
</pre>
|
|
|
|
</body>
|
2007-06-27 13:58:32 +00:00
|
|
|
</html>
|