4 * Generates XML and HTML documents describing configuration.
10 - make XML format richer
11 - extend XSLT transformation (see the corresponding XSLT file)
12 - allow generation of packaged docs that can be easily moved
13 - multipage documentation
14 - determine how to multilingualize
18 if (version_compare(PHP_VERSION
, '5.2', '<')) exit('PHP 5.2+ required.');
19 error_reporting(E_ALL | E_STRICT
);
21 // load dual-libraries
22 require_once dirname(__FILE__
) . '/../extras/HTMLPurifierExtras.auto.php';
23 require_once dirname(__FILE__
) . '/../library/HTMLPurifier.auto.php';
25 // setup HTML Purifier singleton
26 HTMLPurifier
::getInstance(array(
27 'AutoFormat.PurifierLinkify' => true
30 $builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder();
31 $interchange = new HTMLPurifier_ConfigSchema_Interchange();
32 $builder->buildDir($interchange);
33 $loader = dirname(__FILE__
) . '/../config-schema.php';
34 if (file_exists($loader)) include $loader;
35 $interchange->validate();
37 $style = 'plain'; // use $_GET in the future, careful to validate!
38 $configdoc_xml = dirname(__FILE__
) . '/configdoc.xml';
40 $xml_builder = new HTMLPurifier_ConfigSchema_Builder_Xml();
41 $xml_builder->openURI($configdoc_xml);
42 $xml_builder->build($interchange);
43 unset($xml_builder); // free handle
45 $xslt = new ConfigDoc_HTMLXSLTProcessor();
46 $xslt->importStylesheet(dirname(__FILE__
) . "/styles/$style.xsl");
47 $output = $xslt->transformToHTML($configdoc_xml);
50 echo "Error in generating files\n";
55 file_put_contents(dirname(__FILE__
) . "/$style.html", $output);
57 if (php_sapi_name() != 'cli') {
58 // output (instant feedback if it's a browser)
61 echo "Files generated successfully.\n";