12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- chdir(dirname(__FILE__));
- require_once 'common.php';
- assertCli();
- echo "Please do not run this script. It is here for historical purposes only.";
- exit;
- define('HTMLPURIFIER_SCHEMA_STRICT', true);
- require_once dirname(__FILE__) . '/../library/HTMLPurifier.auto.php';
- require_once 'HTMLPurifier.includes.php';
- require_once 'HTMLPurifier/Filter/ExtractStyleBlocks.php';
- function saveHash($hash) {
- if ($hash === false) return;
- $dir = realpath(dirname(__FILE__) . '/../library/HTMLPurifier/ConfigSchema');
- $name = $hash['ID'] . '.txt';
- $file = $dir . '/' . $name;
- if (file_exists($file)) {
- trigger_error("File already exists; skipped $name");
- return;
- }
- $file = new FSTools_File($file);
- $file->open('w');
- $multiline = false;
- foreach ($hash as $key => $value) {
- $multiline = $multiline || (strpos($value, "\n") !== false);
- if ($multiline) {
- $file->put("--$key--" . PHP_EOL);
- $file->put(str_replace("\n", PHP_EOL, $value) . PHP_EOL);
- } else {
- if ($key == 'ID') {
- $file->put("$value" . PHP_EOL);
- } else {
- $file->put("$key: $value" . PHP_EOL);
- }
- }
- }
- $file->close();
- }
- $schema = HTMLPurifier_ConfigSchema::instance();
- $adapter = new HTMLPurifier_ConfigSchema_StringHashReverseAdapter($schema);
- foreach ($schema->info as $ns => $ns_array) {
- saveHash($adapter->get($ns));
- foreach ($ns_array as $dir => $x) {
- saveHash($adapter->get($ns, $dir));
- }
- }
|