Example #1
0
<?php

require_once 'common.php';
// Setup environment
require_once '../extras/HTMLPurifierExtras.auto.php';
$interchange = HTMLPurifier_ConfigSchema_InterchangeBuilder::buildFromDirectory('test-schema/');
$interchange->validate();
if (isset($_GET['doc'])) {
    // Hijack page generation to supply documentation
    if (file_exists('test-schema.html') && !isset($_GET['purge'])) {
        echo file_get_contents('test-schema.html');
        exit;
    }
    $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'));
    $html = $xslt->transformToHTML($configdoc_xml);
    unlink('test-schema.xml');
    file_put_contents('test-schema.html', $html);
    echo $html;
    exit;
}
?>
<!DOCTYPE html