mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-23 00:41:52 +00:00
34ba0e408f
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1622 48356398-32a2-884e-a903-53898d9a118a
36 lines
1.0 KiB
PHP
36 lines
1.0 KiB
PHP
#!/usr/bin/php
|
|
<?php
|
|
|
|
chdir(dirname(__FILE__));
|
|
require_once 'common.php';
|
|
require_once '../library/HTMLPurifier.auto.php';
|
|
assertCli();
|
|
|
|
/**
|
|
* @file
|
|
* Generates a schema cache file from the contents of
|
|
* library/HTMLPurifier/ConfigSchema/schema.ser
|
|
*/
|
|
|
|
$target = '../library/HTMLPurifier/ConfigSchema/schema.ser';
|
|
$FS = new FSTools();
|
|
|
|
$files = $FS->globr('../library/HTMLPurifier/ConfigSchema/schema', '*.txt');
|
|
|
|
$parser = new HTMLPurifier_StringHashParser();
|
|
$builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder();
|
|
$interchange = new HTMLPurifier_ConfigSchema_Interchange();
|
|
foreach ($files as $file) {
|
|
$builder->build($interchange, new HTMLPurifier_StringHash($parser->parseFile($file)));
|
|
}
|
|
|
|
$validator = new HTMLPurifier_ConfigSchema_Validator();
|
|
$validator->validate($interchange);
|
|
|
|
$schema_builder = new HTMLPurifier_ConfigSchema_Builder_ConfigSchema();
|
|
$schema = $schema_builder->build($interchange);
|
|
|
|
echo "Saving schema... ";
|
|
file_put_contents($target, serialize($schema));
|
|
echo "done!\n";
|