#!/usr/bin/php globr('../library/HTMLPurifier/ConfigSchema/schema', '*.txt'); $namespaces = array(); $directives = array(); // Generate string hashes $parser = new ConfigSchema_StringHashParser(); foreach ($files as $file) { $hash = $parser->parseFile($file); if (strpos($hash['ID'], '.') === false) { $namespaces[] = $hash; } else { $directives[] = $hash; } } $adapter = new ConfigSchema_StringHashAdapter(); $schema = new HTMLPurifier_ConfigSchema(); foreach ($namespaces as $hash) $adapter->adapt($hash, $schema); foreach ($directives as $hash) $adapter->adapt($hash, $schema); echo "Saving schema... "; file_put_contents($target, serialize($schema)); echo "done!\n";