aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/3rdparty/htmlpurifier/HTMLPurifier/ErrorStruct.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2014-02-21 15:57:10 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2014-02-21 15:57:10 +0100
commit99679d06884120c57f43b44e55e03595f1f87bed (patch)
treea3f2a1aa1afdaeca1386d0c6e8a75344fd2241fb /inc/3rdparty/htmlpurifier/HTMLPurifier/ErrorStruct.php
parent655214ab30ee84884dc408488b85586f36263fcb (diff)
parentd3b47e94705e17b3ba3529cbb1dc6efe69c5d2b7 (diff)
downloadwallabag-99679d06884120c57f43b44e55e03595f1f87bed.tar.gz
wallabag-99679d06884120c57f43b44e55e03595f1f87bed.tar.zst
wallabag-99679d06884120c57f43b44e55e03595f1f87bed.zip
Merge pull request #481 from wallabag/dev1.5.2
1.5.2
Diffstat (limited to 'inc/3rdparty/htmlpurifier/HTMLPurifier/ErrorStruct.php')
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/ErrorStruct.php74
1 files changed, 74 insertions, 0 deletions
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/ErrorStruct.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/ErrorStruct.php
new file mode 100644
index 00000000..a6c0da29
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/ErrorStruct.php
@@ -0,0 +1,74 @@
1<?php
2
3/**
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.
8 */
9class HTMLPurifier_ErrorStruct
10{
11
12 /**
13 * Possible values for $children first-key. Note that top-level structures
14 * are automatically token-level.
15 */
16 const TOKEN = 0;
17 const ATTR = 1;
18 const CSSPROP = 2;
19
20 /**
21 * Type of this struct.
22 * @type string
23 */
24 public $type;
25
26 /**
27 * Value of the struct we are recording errors for. There are various
28 * values for this:
29 * - TOKEN: Instance of HTMLPurifier_Token
30 * - ATTR: array('attr-name', 'value')
31 * - CSSPROP: array('prop-name', 'value')
32 * @type mixed
33 */
34 public $value;
35
36 /**
37 * Errors registered for this structure.
38 * @type array
39 */
40 public $errors = array();
41
42 /**
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']
46 * @type array
47 */
48 public $children = array();
49
50 /**
51 * @param string $type
52 * @param string $id
53 * @return mixed
54 */
55 public function getChild($type, $id)
56 {
57 if (!isset($this->children[$type][$id])) {
58 $this->children[$type][$id] = new HTMLPurifier_ErrorStruct();
59 $this->children[$type][$id]->type = $type;
60 }
61 return $this->children[$type][$id];
62 }
63
64 /**
65 * @param int $severity
66 * @param string $message
67 */
68 public function addError($severity, $message)
69 {
70 $this->errors[] = array($severity, $message);
71 }
72}
73
74// vim: et sw=4 sts=4