diff --git a/library/HTMLPurifier/ConfigDef.php b/library/HTMLPurifier/ConfigDef.php
new file mode 100644
index 00000000..b92640dc
--- /dev/null
+++ b/library/HTMLPurifier/ConfigDef.php
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/library/HTMLPurifier/ConfigDef/Directive.php b/library/HTMLPurifier/ConfigDef/Directive.php
new file mode 100644
index 00000000..39026540
--- /dev/null
+++ b/library/HTMLPurifier/ConfigDef/Directive.php
@@ -0,0 +1,74 @@
+type = $type;
+ if ($descriptions !== null) $this->descriptions = $descriptions;
+ if ( $allow_null !== null) $this->allow_null = $allow_null;
+ if ( $allowed !== null) $this->allowed = $allowed;
+ if ( $aliases !== null) $this->aliases = $aliases;
+ }
+
+ /**
+ * Allowed type of the directive. Values are:
+ * - string
+ * - istring (case insensitive string)
+ * - int
+ * - float
+ * - bool
+ * - lookup (array of value => true)
+ * - list (regular numbered index array)
+ * - hash (array of key => value)
+ * - mixed (anything goes)
+ */
+ var $type = 'mixed';
+
+ /**
+ * Plaintext descriptions of the configuration entity is. Organized by
+ * file and line number, so multiple descriptions are allowed.
+ */
+ var $descriptions = array();
+
+ /**
+ * Is null allowed? Has no effect for mixed type.
+ * @bool
+ */
+ var $allow_null = false;
+
+ /**
+ * Lookup table of allowed values of the element, bool true if all allowed.
+ */
+ var $allowed = true;
+
+ /**
+ * Hash of value aliases, i.e. values that are equivalent.
+ */
+ var $aliases = array();
+
+ /**
+ * Adds a description to the array
+ */
+ function addDescription($file, $line, $description) {
+ if (!isset($this->descriptions[$file])) $this->descriptions[$file] = array();
+ $this->descriptions[$file][$line] = $description;
+ }
+
+}
+
+?>
\ No newline at end of file
diff --git a/library/HTMLPurifier/ConfigDef/DirectiveAlias.php b/library/HTMLPurifier/ConfigDef/DirectiveAlias.php
new file mode 100644
index 00000000..81a44514
--- /dev/null
+++ b/library/HTMLPurifier/ConfigDef/DirectiveAlias.php
@@ -0,0 +1,27 @@
+namespace = $namespace;
+ $this->name = $name;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/library/HTMLPurifier/ConfigDef/Namespace.php b/library/HTMLPurifier/ConfigDef/Namespace.php
new file mode 100644
index 00000000..f53892b4
--- /dev/null
+++ b/library/HTMLPurifier/ConfigDef/Namespace.php
@@ -0,0 +1,23 @@
+description = $description;
+ }
+
+ var $class = 'namespace';
+
+ /**
+ * String description of what kinds of directives go in this namespace.
+ */
+ var $description;
+
+}
+
+?>
\ No newline at end of file
diff --git a/library/HTMLPurifier/ConfigSchema.php b/library/HTMLPurifier/ConfigSchema.php
index 8833d699..9f1f3e3e 100644
--- a/library/HTMLPurifier/ConfigSchema.php
+++ b/library/HTMLPurifier/ConfigSchema.php
@@ -1,6 +1,10 @@
info[$namespace][$name] =
- new HTMLPurifier_ConfigEntity_Directive();
+ new HTMLPurifier_ConfigDef_Directive();
$def->info[$namespace][$name]->type = $type;
$def->info[$namespace][$name]->allow_null = $allow_null;
$def->defaults[$namespace][$name] = $default;
@@ -172,7 +176,7 @@ class HTMLPurifier_ConfigSchema {
return;
}
$def->info[$namespace] = array();
- $def->info_namespace[$namespace] = new HTMLPurifier_ConfigEntity_Namespace();
+ $def->info_namespace[$namespace] = new HTMLPurifier_ConfigDef_Namespace();
$def->info_namespace[$namespace]->description = $description;
$def->defaults[$namespace] = array();
}
@@ -284,7 +288,7 @@ class HTMLPurifier_ConfigSchema {
return;
}
$def->info[$namespace][$name] =
- new HTMLPurifier_ConfigEntity_DirectiveAlias(
+ new HTMLPurifier_ConfigDef_DirectiveAlias(
$new_namespace, $new_name);
}
@@ -379,120 +383,4 @@ class HTMLPurifier_ConfigSchema {
}
}
-/**
- * Base class for configuration entity
- */
-class HTMLPurifier_ConfigEntity {
- var $class = false;
-}
-
-/**
- * Structure object describing of a namespace
- */
-class HTMLPurifier_ConfigEntity_Namespace extends HTMLPurifier_ConfigEntity {
-
- function HTMLPurifier_ConfigEntity_Namespace($description = null) {
- $this->description = $description;
- }
-
- var $class = 'namespace';
-
- /**
- * String description of what kinds of directives go in this namespace.
- */
- var $description;
-
-}
-
-/**
- * Structure object containing definition of a directive.
- * @note This structure does not contain default values
- */
-class HTMLPurifier_ConfigEntity_Directive extends HTMLPurifier_ConfigEntity
-{
-
- var $class = 'directive';
-
- function HTMLPurifier_ConfigEntity_Directive(
- $type = null,
- $descriptions = null,
- $allow_null = null,
- $allowed = null,
- $aliases = null
- ) {
- if ( $type !== null) $this->type = $type;
- if ($descriptions !== null) $this->descriptions = $descriptions;
- if ( $allow_null !== null) $this->allow_null = $allow_null;
- if ( $allowed !== null) $this->allowed = $allowed;
- if ( $aliases !== null) $this->aliases = $aliases;
- }
-
- /**
- * Allowed type of the directive. Values are:
- * - string
- * - istring (case insensitive string)
- * - int
- * - float
- * - bool
- * - lookup (array of value => true)
- * - list (regular numbered index array)
- * - hash (array of key => value)
- * - mixed (anything goes)
- */
- var $type = 'mixed';
-
- /**
- * Plaintext descriptions of the configuration entity is. Organized by
- * file and line number, so multiple descriptions are allowed.
- */
- var $descriptions = array();
-
- /**
- * Is null allowed? Has no effect for mixed type.
- * @bool
- */
- var $allow_null = false;
-
- /**
- * Lookup table of allowed values of the element, bool true if all allowed.
- */
- var $allowed = true;
-
- /**
- * Hash of value aliases, i.e. values that are equivalent.
- */
- var $aliases = array();
-
- /**
- * Adds a description to the array
- */
- function addDescription($file, $line, $description) {
- if (!isset($this->descriptions[$file])) $this->descriptions[$file] = array();
- $this->descriptions[$file][$line] = $description;
- }
-
-}
-
-/**
- * Structure object describing a directive alias
- */
-class HTMLPurifier_ConfigEntity_DirectiveAlias extends HTMLPurifier_ConfigEntity
-{
- var $class = 'alias';
-
- /**
- * Namespace being aliased to
- */
- var $namespace;
- /**
- * Directive being aliased to
- */
- var $name;
-
- function HTMLPurifier_ConfigEntity_DirectiveAlias($namespace, $name) {
- $this->namespace = $namespace;
- $this->name = $name;
- }
-}
-
?>
diff --git a/tests/HTMLPurifier/ConfigSchemaTest.php b/tests/HTMLPurifier/ConfigSchemaTest.php
index 075a552c..b4b235d5 100644
--- a/tests/HTMLPurifier/ConfigSchemaTest.php
+++ b/tests/HTMLPurifier/ConfigSchemaTest.php
@@ -48,7 +48,7 @@ class HTMLPurifier_ConfigSchemaTest extends UnitTestCase
CS::defineNamespace('http', $d = 'This is an internet protocol.');
$this->assertIdentical($this->our_copy->info_namespace, array(
- 'http' => new HTMLPurifier_ConfigEntity_Namespace($d)
+ 'http' => new HTMLPurifier_ConfigDef_Namespace($d)
));
$this->expectError('Cannot redefine namespace');
@@ -68,7 +68,7 @@ class HTMLPurifier_ConfigSchemaTest extends UnitTestCase
$this->assertIdentical($this->our_copy->defaults['Car']['Seats'], 5);
$this->assertIdentical($this->our_copy->info['Car']['Seats'],
- new HTMLPurifier_ConfigEntity_Directive('int',
+ new HTMLPurifier_ConfigDef_Directive('int',
array($this->file => array($l => $d))
)
);
@@ -77,7 +77,7 @@ class HTMLPurifier_ConfigSchemaTest extends UnitTestCase
$this->assertIdentical($this->our_copy->defaults['Car']['Age'], null);
$this->assertIdentical($this->our_copy->info['Car']['Age'],
- new HTMLPurifier_ConfigEntity_Directive('int',
+ new HTMLPurifier_ConfigDef_Directive('int',
array($this->file => array($l => $d)), true
)
);
@@ -106,7 +106,7 @@ class HTMLPurifier_ConfigSchemaTest extends UnitTestCase
$this->assertIdentical($this->our_copy->defaults['Cat']['Dead'], false);
$this->assertIdentical($this->our_copy->info['Cat']['Dead'],
- new HTMLPurifier_ConfigEntity_Directive('bool',
+ new HTMLPurifier_ConfigDef_Directive('bool',
array($this->file => array($l1 => $d1, $l2 => $d2))
)
);
@@ -132,7 +132,7 @@ class HTMLPurifier_ConfigSchemaTest extends UnitTestCase
$this->assertIdentical($this->our_copy->defaults['QuantumNumber']['Difficulty'], null);
$this->assertIdentical($this->our_copy->info['QuantumNumber']['Difficulty'],
- new HTMLPurifier_ConfigEntity_Directive(
+ new HTMLPurifier_ConfigDef_Directive(
'string',
array($this->file => array($l => $d)),
true,
@@ -184,7 +184,7 @@ class HTMLPurifier_ConfigSchemaTest extends UnitTestCase
$this->assertIdentical($this->our_copy->defaults['Abbrev']['HTH'], 'Happy to Help');
$this->assertIdentical($this->our_copy->info['Abbrev']['HTH'],
- new HTMLPurifier_ConfigEntity_Directive(
+ new HTMLPurifier_ConfigDef_Directive(
'string',
array($this->file => array($l => $d)),
false,
@@ -224,7 +224,7 @@ class HTMLPurifier_ConfigSchemaTest extends UnitTestCase
$this->assertTrue(!isset($this->our_copy->defaults['Home']['Carpet']));
$this->assertIdentical($this->our_copy->info['Home']['Carpet'],
- new HTMLPurifier_ConfigEntity_DirectiveAlias('Home', 'Rug')
+ new HTMLPurifier_ConfigDef_DirectiveAlias('Home', 'Rug')
);
$this->expectError('Cannot define directive alias in undefined namespace');