Release 2.1.0, merged in 1313 to HEAD.
[htmlpurifier.git] / configdoc / generate.php
blob9e73f4c7d45a6218df80a7383aeaf33cfb48b0e3
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 define('HTMLPURIFIER_SCHEMA_STRICT', true); // description data needs to be collected
23 // load dual-libraries
24 require_once '../library/HTMLPurifier.auto.php';
25 require_once 'library/ConfigDoc.auto.php';
27 $purifier = HTMLPurifier::getInstance(array(
28 'AutoFormat.PurifierLinkify' => true
29 ));
31 $schema = HTMLPurifier_ConfigSchema::instance();
32 $style = 'plain'; // use $_GET in the future
33 $configdoc = new ConfigDoc();
34 $output = $configdoc->generate($schema, $style);
36 // write out
37 file_put_contents("$style.html", $output);
39 if (php_sapi_name() != 'cli') {
40 // output = instant feedback
41 echo $output;
42 } else {
43 echo 'Files generated successfully.';