Release 2.0.1, merged in 1181 to HEAD.
[htmlpurifier.git] / library / HTMLPurifier / ConfigDef / Directive.php
blob21c33fae8d814447cd5eadb19a4b40332abb0db1
1 <?php
3 require_once 'HTMLPurifier/ConfigDef.php';
5 /**
6 * Structure object containing definition of a directive.
7 * @note This structure does not contain default values
8 */
9 class HTMLPurifier_ConfigDef_Directive extends HTMLPurifier_ConfigDef
12 var $class = 'directive';
14 function HTMLPurifier_ConfigDef_Directive(
15 $type = null,
16 $descriptions = null,
17 $allow_null = null,
18 $allowed = null,
19 $aliases = null
20 ) {
21 if ( $type !== null) $this->type = $type;
22 if ($descriptions !== null) $this->descriptions = $descriptions;
23 if ( $allow_null !== null) $this->allow_null = $allow_null;
24 if ( $allowed !== null) $this->allowed = $allowed;
25 if ( $aliases !== null) $this->aliases = $aliases;
28 /**
29 * Allowed type of the directive. Values are:
30 * - string
31 * - istring (case insensitive string)
32 * - int
33 * - float
34 * - bool
35 * - lookup (array of value => true)
36 * - list (regular numbered index array)
37 * - hash (array of key => value)
38 * - mixed (anything goes)
40 var $type = 'mixed';
42 /**
43 * Plaintext descriptions of the configuration entity is. Organized by
44 * file and line number, so multiple descriptions are allowed.
46 var $descriptions = array();
48 /**
49 * Is null allowed? Has no effect for mixed type.
50 * @bool
52 var $allow_null = false;
54 /**
55 * Lookup table of allowed values of the element, bool true if all allowed.
57 var $allowed = true;
59 /**
60 * Hash of value aliases, i.e. values that are equivalent.
62 var $aliases = array();
64 /**
65 * Advisory list of directive aliases, i.e. other directives that
66 * redirect here
68 var $directiveAliases = array();
70 /**
71 * Adds a description to the array
73 function addDescription($file, $line, $description) {
74 if (!isset($this->descriptions[$file])) $this->descriptions[$file] = array();
75 $this->descriptions[$file][$line] = $description;