63 $contents = file_get_contents(HTMLPURIFIER_PREFIX .
'/HTMLPurifier/ConfigSchema/schema.ser');
64 $r = unserialize($contents);
66 $hash = sha1($contents);
67 trigger_error(
"Unserialization of configuration schema failed, sha1 of file was $hash", E_USER_ERROR);
75 public static function instance($prototype = null) {
76 if ($prototype !== null) {
96 public function add($key, $default, $type, $allow_null) {
97 $obj =
new stdclass();
99 if ($allow_null) $obj->allow_null =
true;
100 $this->info[$key] = $obj;
101 $this->defaults[$key] = $default;
102 $this->defaultPlist->set($key, $default);
115 if (!isset($this->info[$key]->aliases)) {
116 $this->info[$key]->aliases = array();
118 foreach ($aliases as $alias => $real) {
119 $this->info[$key]->aliases[$alias] = $real;
132 $this->info[$key]->allowed = $allowed;
144 $obj->key = $new_key;
145 $obj->isAlias =
true;
146 $this->info[$key] = $obj;
153 foreach ($this->info as $key => $v) {
154 if (count((array) $v) == 1) {
155 $this->info[$key] = $v->type;
156 } elseif (count((array) $v) == 2 && isset($v->allow_null)) {
157 $this->info[$key] = -$v->type;
addAlias($key, $new_key)
Defines a directive alias for backwards compatibility.
addAllowedValues($key, $allowed)
Defines a set of allowed values for a directive.
static $types
Lookup table of allowed types.
$defaults
Defaults of the directives and namespaces.
static $singleton
Application-wide singleton.
addValueAliases($key, $aliases)
Defines a directive value alias.
$defaultPlist
The default property list.
Configuration definition, defines directives and their defaults.
static makeFromSerial()
Unserializes the default ConfigSchema.
Generic property list implementation.
$info
Definition of the directives.
static instance($prototype=null)
Retrieves an instance of the application-wide configuration definition.
postProcess()
Replaces any stdclass that only has the type property with type integer.
add($key, $default, $type, $allow_null)
Defines a directive for configuration.