diff --git a/library/HTMLPurifier.includes.php b/library/HTMLPurifier.includes.php
index 4a496de8..e637c4ac 100644
--- a/library/HTMLPurifier.includes.php
+++ b/library/HTMLPurifier.includes.php
@@ -57,6 +57,8 @@ require 'HTMLPurifier/Lexer.php';
require 'HTMLPurifier/PercentEncoder.php';
require 'HTMLPurifier/Printer.php';
require 'HTMLPurifier/Strategy.php';
+require 'HTMLPurifier/StringHash.php';
+require 'HTMLPurifier/StringHashParser.php';
require 'HTMLPurifier/TagTransform.php';
require 'HTMLPurifier/Token.php';
require 'HTMLPurifier/TokenFactory.php';
@@ -128,9 +130,6 @@ require 'HTMLPurifier/ConfigDef/Namespace.php';
require 'HTMLPurifier/ConfigSchema/Exception.php';
require 'HTMLPurifier/ConfigSchema/Interchange.php';
require 'HTMLPurifier/ConfigSchema/InterchangeBuilder.php';
-require 'HTMLPurifier/ConfigSchema/InterchangeValidator.php';
-require 'HTMLPurifier/ConfigSchema/StringHash.php';
-require 'HTMLPurifier/ConfigSchema/StringHashParser.php';
require 'HTMLPurifier/ConfigSchema/Builder/ConfigSchema.php';
require 'HTMLPurifier/ConfigSchema/Interchange/Directive.php';
require 'HTMLPurifier/ConfigSchema/Interchange/Id.php';
diff --git a/library/HTMLPurifier/ConfigSchema/InterchangeValidator.php b/library/HTMLPurifier/ConfigSchema/InterchangeValidator.php
deleted file mode 100644
index 3009d06c..00000000
--- a/library/HTMLPurifier/ConfigSchema/InterchangeValidator.php
+++ /dev/null
@@ -1,46 +0,0 @@
-interchange = $interchange;
- $this->namespace = new HTMLPurifier_ConfigSchema_Validator_Composite();
- $this->directive = new HTMLPurifier_ConfigSchema_Validator_Composite();
- }
-
- /**
- * Registers a HTMLPurifier_ConfigSchema_Validator for both
- * directive and namespace
- */
- public function addValidator($validator) {
- $this->directive->addValidator($validator);
- $this->namespace->addValidator($validator);
- }
-
- /**
- * Validates and adds a namespace hash
- */
- public function addNamespace($hash) {
- $this->namespace->validate($hash, $this->interchange);
- $this->interchange->addNamespace($hash);
- }
-
- /**
- * Validates and adds a directive hash
- */
- public function addDirective($hash) {
- $this->directive->validate($hash, $this->interchange);
- $this->interchange->addDirective($hash);
- }
-}
diff --git a/library/HTMLPurifier/ConfigSchema/StringHash.php b/library/HTMLPurifier/StringHash.php
similarity index 93%
rename from library/HTMLPurifier/ConfigSchema/StringHash.php
rename to library/HTMLPurifier/StringHash.php
index 280a1bbe..86cda25e 100644
--- a/library/HTMLPurifier/ConfigSchema/StringHash.php
+++ b/library/HTMLPurifier/StringHash.php
@@ -8,7 +8,7 @@
* of PHP 5, you must not use the $hash[$key] syntax; if you do
* our version of offsetGet is never called.
*/
-class HTMLPurifier_ConfigSchema_StringHash extends ArrayObject
+class HTMLPurifier_StringHash extends ArrayObject
{
protected $accessed = array();
diff --git a/library/HTMLPurifier/ConfigSchema/StringHashParser.php b/library/HTMLPurifier/StringHashParser.php
similarity index 85%
rename from library/HTMLPurifier/ConfigSchema/StringHashParser.php
rename to library/HTMLPurifier/StringHashParser.php
index b490be52..1883d50f 100644
--- a/library/HTMLPurifier/ConfigSchema/StringHashParser.php
+++ b/library/HTMLPurifier/StringHashParser.php
@@ -20,19 +20,15 @@
* )
*
* We use this as an easy to use file-format for configuration schema
- * files.
- *
- * @todo
- * Put this in its own class hierarchy or something; this class
- * is usage agnostic.
+ * files, but the class itself is usage agnostic.
*/
-class HTMLPurifier_ConfigSchema_StringHashParser
+class HTMLPurifier_StringHashParser
{
public $default = 'ID';
public function parseFile($file) {
- if (!file_exists($file)) throw new HTMLPurifier_ConfigSchema_Exception('File ' . $file . ' does not exist');
+ if (!file_exists($file)) return false;
$fh = fopen($file, 'r');
$state = false;
$single = false;
diff --git a/maintenance/generate-schema-cache.php b/maintenance/generate-schema-cache.php
index 10eb81ba..4b693ee5 100644
--- a/maintenance/generate-schema-cache.php
+++ b/maintenance/generate-schema-cache.php
@@ -17,11 +17,11 @@ $FS = new FSTools();
$files = $FS->globr('../library/HTMLPurifier/ConfigSchema/schema', '*.txt');
-$parser = new HTMLPurifier_ConfigSchema_StringHashParser();
+$parser = new HTMLPurifier_StringHashParser();
$builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder();
$interchange = new HTMLPurifier_ConfigSchema_Interchange();
foreach ($files as $file) {
- $builder->build($interchange, $parser->parseFile($file));
+ $builder->build($interchange, new HTMLPurifier_StringHash($parser->parseFile($file)));
}
$schema_builder = new HTMLPurifier_ConfigSchema_Builder_ConfigSchema();
diff --git a/tests/HTMLPurifier/ConfigSchema/StringHashParser/AppendMultiline.txt b/tests/HTMLPurifier/StringHashParser/AppendMultiline.txt
similarity index 100%
rename from tests/HTMLPurifier/ConfigSchema/StringHashParser/AppendMultiline.txt
rename to tests/HTMLPurifier/StringHashParser/AppendMultiline.txt
diff --git a/tests/HTMLPurifier/ConfigSchema/StringHashParser/Default.txt b/tests/HTMLPurifier/StringHashParser/Default.txt
similarity index 100%
rename from tests/HTMLPurifier/ConfigSchema/StringHashParser/Default.txt
rename to tests/HTMLPurifier/StringHashParser/Default.txt
diff --git a/tests/HTMLPurifier/ConfigSchema/StringHashParser/OverrideSingle.txt b/tests/HTMLPurifier/StringHashParser/OverrideSingle.txt
similarity index 100%
rename from tests/HTMLPurifier/ConfigSchema/StringHashParser/OverrideSingle.txt
rename to tests/HTMLPurifier/StringHashParser/OverrideSingle.txt
diff --git a/tests/HTMLPurifier/ConfigSchema/StringHashParser/Simple.txt b/tests/HTMLPurifier/StringHashParser/Simple.txt
similarity index 100%
rename from tests/HTMLPurifier/ConfigSchema/StringHashParser/Simple.txt
rename to tests/HTMLPurifier/StringHashParser/Simple.txt
diff --git a/tests/HTMLPurifier/ConfigSchema/StringHashParserTest.php b/tests/HTMLPurifier/StringHashParserTest.php
similarity index 91%
rename from tests/HTMLPurifier/ConfigSchema/StringHashParserTest.php
rename to tests/HTMLPurifier/StringHashParserTest.php
index 746cb9ba..6a61690d 100644
--- a/tests/HTMLPurifier/ConfigSchema/StringHashParserTest.php
+++ b/tests/HTMLPurifier/StringHashParserTest.php
@@ -3,7 +3,7 @@
/**
* @note Sample input files are located in the StringHashParser/ directory.
*/
-class HTMLPurifier_ConfigSchema_StringHashParserTest extends UnitTestCase
+class HTMLPurifier_StringHashParserTest extends UnitTestCase
{
/**
@@ -12,7 +12,7 @@ class HTMLPurifier_ConfigSchema_StringHashParserTest extends UnitTestCase
protected $parser;
function setup() {
- $this->parser = new HTMLPurifier_ConfigSchema_StringHashParser();
+ $this->parser = new HTMLPurifier_StringHashParser();
}
/**
diff --git a/tests/HTMLPurifier/ConfigSchema/StringHashTest.php b/tests/HTMLPurifier/StringHashTest.php
similarity index 75%
rename from tests/HTMLPurifier/ConfigSchema/StringHashTest.php
rename to tests/HTMLPurifier/StringHashTest.php
index ce3ddd60..a9550672 100644
--- a/tests/HTMLPurifier/ConfigSchema/StringHashTest.php
+++ b/tests/HTMLPurifier/StringHashTest.php
@@ -1,10 +1,10 @@
'value',
'key2' => 'value2'
));