0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-01-03 05:11:52 +00:00

Simplify generate.php variable naming and comments.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1108 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2007-05-28 03:58:02 +00:00
parent dea62ffdab
commit aec84dc3f6

View File

@ -14,45 +14,24 @@ TODO:
- determine how to multilingualize - determine how to multilingualize
*/ */
// there are several hacks for the configForm.php smoketest
// - load copies (override default schema)
// - file/line server information hack
// - post-processing, base-name change hack
// ---------------------------------------------------------------------------
// Check and configure environment
if (version_compare('5', PHP_VERSION, '>')) exit('Requires PHP 5 or higher.'); if (version_compare('5', PHP_VERSION, '>')) exit('Requires PHP 5 or higher.');
error_reporting(E_ALL); // probably not possible to use E_STRICT error_reporting(E_ALL); // probably not possible to use E_STRICT
// load dual-libraries
// ---------------------------------------------------------------------------
// Include HTML Purifier library
require_once '../library/HTMLPurifier.auto.php'; require_once '../library/HTMLPurifier.auto.php';
require_once 'library/ConfigDoc.auto.php'; require_once 'library/ConfigDoc.auto.php';
// ---------------------------------------------------------------------------
// Load copies of HTMLPurifier_ConfigDef and HTMLPurifier
$schema = HTMLPurifier_ConfigSchema::instance(); $schema = HTMLPurifier_ConfigSchema::instance();
$style = 'plain'; // use $_GET in the future
// ---------------------------------------------------------------------------
// Generate final output using XSLT
// determine stylesheet name
$xsl_stylesheet_name = 'plain'; // use $_GET in the future
$configdoc = new ConfigDoc(); $configdoc = new ConfigDoc();
$html_output = $configdoc->generate($schema, $xsl_stylesheet_name); $output = $configdoc->generate($schema, $style);
file_put_contents("$xsl_stylesheet_name.html", $html_output); // write out
file_put_contents("$style.html", $output);
// ---------------------------------------------------------------------------
// Output for instant feedback
if (php_sapi_name() != 'cli') { if (php_sapi_name() != 'cli') {
echo $html_output; // output = instant feedback
echo $output;
} else { } else {
echo 'Files generated successfully.'; echo 'Files generated successfully.';
} }