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
|
2007-05-29 21:26:43 +00:00
|
|
|
- add blurbs to ToC
|
2006-09-10 20:21:19 +00:00
|
|
|
*/
|
|
|
|
|
2008-02-25 21:21:12 +00:00
|
|
|
if (version_compare(PHP_VERSION, '5.2.0', '<')) exit('PHP 5.2.0 or greater required.');
|
|
|
|
error_reporting(E_ALL | E_STRICT);
|
2006-09-10 02:02:40 +00:00
|
|
|
|
2008-02-25 21:21:12 +00:00
|
|
|
echo 'Currently broken!';
|
|
|
|
exit;
|
2007-07-31 01:04:38 +00:00
|
|
|
|
2007-05-28 03:58:02 +00:00
|
|
|
// load dual-libraries
|
2008-02-25 21:21:12 +00:00
|
|
|
require_once '../extras/HTMLPurifierExtras.auto.php';
|
|
|
|
require_once '../library/HTMLPurifier.auto.php';
|
2006-09-10 02:02:40 +00:00
|
|
|
|
2008-02-25 21:21:12 +00:00
|
|
|
// setup HTML Purifier singleton
|
|
|
|
HTMLPurifier::getInstance(array(
|
2007-06-24 22:22:00 +00:00
|
|
|
'AutoFormat.PurifierLinkify' => true
|
|
|
|
));
|
|
|
|
|
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
|
|
|
|
2008-02-25 21:21:12 +00:00
|
|
|
if (!$output) {
|
|
|
|
echo "Error in generating files\n";
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
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') {
|
2008-02-25 21:21:12 +00:00
|
|
|
// output (instant feedback if it's a browser)
|
2007-05-28 03:58:02 +00:00
|
|
|
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
|
|
|
|