4 * Records errors for particular segments of an HTML document such as tokens,
5 * attributes or CSS properties. They can contain error structs (which apply
6 * to components of what they represent), but their main purpose is to hold
7 * errors applying to whatever struct is being used.
9 class HTMLPurifier_ErrorStruct
13 * Possible values for $children first-key. Note that top-level structures
14 * are automatically token-level.
21 * Type of this struct.
27 * Value of the struct we are recording errors for. There are various
29 * - TOKEN: Instance of HTMLPurifier_Token
30 * - ATTR: array('attr-name', 'value')
31 * - CSSPROP: array('prop-name', 'value')
37 * Errors registered for this structure.
40 public $errors = array();
43 * Child ErrorStructs that are from this structure. For example, a TOKEN
44 * ErrorStruct would contain ATTR ErrorStructs. This is a multi-dimensional
45 * array in structure: [TYPE]['identifier']
48 public $children = array();
55 public function getChild($type, $id)
57 if (!isset($this->children
[$type][$id])) {
58 $this->children
[$type][$id] = new HTMLPurifier_ErrorStruct();
59 $this->children
[$type][$id]->type
= $type;
61 return $this->children
[$type][$id];
65 * @param int $severity
66 * @param string $message
68 public function addError($severity, $message)
70 $this->errors
[] = array($severity, $message);