1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-05 21:57:26 +02:00

[1.7.0] Create ConfigForm printer classes

- Extend hash to convert strings from form key,value,key,value
- Hack up configdoc to accommodate configForm.php smoketest

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1101 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2007-05-28 02:20:55 +00:00
parent ee61ffc0d9
commit ef51f8681a
14 changed files with 398 additions and 18 deletions

View File

@@ -8,6 +8,7 @@ require_once 'HTMLPurifier/ConfigDef/DirectiveAlias.php';
/**
* Configuration definition, defines directives and their defaults.
* @note If you update this, please update Printer_ConfigForm
* @todo The ability to define things multiple times is confusing and should
* be factored out to its own function named registerDependency() or
* addNote(), where only the namespace.name and an extra descriptions
@@ -304,6 +305,7 @@ class HTMLPurifier_ConfigSchema {
if ($allow_null && $var === null) return null;
switch ($type) {
case 'mixed':
//if (is_string($var)) $var = unserialize($var);
return $var;
case 'istring':
case 'string':
@@ -344,6 +346,14 @@ class HTMLPurifier_ConfigSchema {
$var = explode(',',$var);
// remove spaces
foreach ($var as $i => $j) $var[$i] = trim($j);
if ($type === 'hash') {
// key,value,key,value
$nvar = array();
for ($i = 0, $c = count($var); $i + 1 < $c; $i += 2) {
$nvar[$var[$i]] = $var[$i + 1];
}
$var = $nvar;
}
}
if (!is_array($var)) break;
$keys = array_keys($var);