2006-09-10 02:02:40 +00:00
|
|
|
<?php
|
|
|
|
|
2006-09-11 02:52:47 +00:00
|
|
|
/**
|
|
|
|
* Generates XML and HTML documents describing configuration.
|
2007-05-28 02:55:50 +00:00
|
|
|
* @note PHP 5 only!
|
2006-09-11 02:52:47 +00:00
|
|
|
*/
|
|
|
|
|
2006-09-10 20:21:19 +00:00
|
|
|
/*
|
|
|
|
TODO:
|
2007-05-28 03:33:12 +00:00
|
|
|
- make XML format richer (see XMLSerializer_ConfigSchema)
|
2006-09-10 20:21:19 +00:00
|
|
|
- extend XSLT transformation (see the corresponding XSLT file)
|
|
|
|
- allow generation of packaged docs that can be easily moved
|
|
|
|
- multipage documentation
|
|
|
|
- determine how to multilingualize
|
|
|
|
*/
|
|
|
|
|
2006-09-11 02:52:47 +00:00
|
|
|
if (version_compare('5', PHP_VERSION, '>')) exit('Requires PHP 5 or higher.');
|
2007-05-28 02:55:50 +00:00
|
|
|
error_reporting(E_ALL); // probably not possible to use E_STRICT
|
2006-09-10 02:02:40 +00:00
|
|
|
|
2007-05-28 03:58:02 +00:00
|
|
|
// load dual-libraries
|
2007-04-22 21:01:48 +00:00
|
|
|
require_once '../library/HTMLPurifier.auto.php';
|
2007-05-28 02:41:01 +00:00
|
|
|
require_once 'library/ConfigDoc.auto.php';
|
2006-09-10 02:02:40 +00:00
|
|
|
|
2007-05-28 03:33:12 +00:00
|
|
|
$schema = HTMLPurifier_ConfigSchema::instance();
|
2007-05-28 03:58:02 +00:00
|
|
|
$style = 'plain'; // use $_GET in the future
|
2007-05-28 03:33:12 +00:00
|
|
|
$configdoc = new ConfigDoc();
|
2007-05-28 03:58:02 +00:00
|
|
|
$output = $configdoc->generate($schema, $style);
|
2006-09-11 02:52:47 +00:00
|
|
|
|
2007-05-28 03:58:02 +00:00
|
|
|
// write out
|
|
|
|
file_put_contents("$style.html", $output);
|
2006-09-11 02:52:47 +00:00
|
|
|
|
2006-09-10 22:47:27 +00:00
|
|
|
if (php_sapi_name() != 'cli') {
|
2007-05-28 03:58:02 +00:00
|
|
|
// output = instant feedback
|
|
|
|
echo $output;
|
2006-09-10 22:47:27 +00:00
|
|
|
} else {
|
2006-09-10 22:53:40 +00:00
|
|
|
echo 'Files generated successfully.';
|
2006-09-10 22:47:27 +00:00
|
|
|
}
|
2006-09-10 02:02:40 +00:00
|
|
|
|
|
|
|
?>
|