Release 2.0.1, merged in 1181 to HEAD.
[htmlpurifier.git] / configdoc / generate.php
blob97e9643395fff253bec7d45c2203efe43c3eee72
1 <?php
3 /**
4 * Generates XML and HTML documents describing configuration.
5 * @note PHP 5 only!
6 */
8 /*
9 TODO:
10 - make XML format richer (see XMLSerializer_ConfigSchema)
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
15 - add blurbs to ToC
18 if (version_compare('5', PHP_VERSION, '>')) exit('Requires PHP 5 or higher.');
19 error_reporting(E_ALL); // probably not possible to use E_STRICT
21 // load dual-libraries
22 require_once '../library/HTMLPurifier.auto.php';
23 require_once 'library/ConfigDoc.auto.php';
25 $purifier = HTMLPurifier::getInstance(array(
26 'AutoFormat.PurifierLinkify' => true
27 ));
29 $schema = HTMLPurifier_ConfigSchema::instance();
30 $style = 'plain'; // use $_GET in the future
31 $configdoc = new ConfigDoc();
32 $output = $configdoc->generate($schema, $style);
34 // write out
35 file_put_contents("$style.html", $output);
37 if (php_sapi_name() != 'cli') {
38 // output = instant feedback
39 echo $output;
40 } else {
41 echo 'Files generated successfully.';