diff options
Diffstat (limited to 'inc/3rdparty/htmlpurifier/HTMLPurifier/Token.php')
-rw-r--r-- | inc/3rdparty/htmlpurifier/HTMLPurifier/Token.php | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/Token.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/Token.php new file mode 100644 index 00000000..9bc19c6b --- /dev/null +++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/Token.php | |||
@@ -0,0 +1,100 @@ | |||
1 | <?php | ||
2 | |||
3 | /** | ||
4 | * Abstract base token class that all others inherit from. | ||
5 | */ | ||
6 | abstract class HTMLPurifier_Token | ||
7 | { | ||
8 | /** | ||
9 | * Line number node was on in source document. Null if unknown. | ||
10 | * @type int | ||
11 | */ | ||
12 | public $line; | ||
13 | |||
14 | /** | ||
15 | * Column of line node was on in source document. Null if unknown. | ||
16 | * @type int | ||
17 | */ | ||
18 | public $col; | ||
19 | |||
20 | /** | ||
21 | * Lookup array of processing that this token is exempt from. | ||
22 | * Currently, valid values are "ValidateAttributes" and | ||
23 | * "MakeWellFormed_TagClosedError" | ||
24 | * @type array | ||
25 | */ | ||
26 | public $armor = array(); | ||
27 | |||
28 | /** | ||
29 | * Used during MakeWellFormed. | ||
30 | * @type | ||
31 | */ | ||
32 | public $skip; | ||
33 | |||
34 | /** | ||
35 | * @type | ||
36 | */ | ||
37 | public $rewind; | ||
38 | |||
39 | /** | ||
40 | * @type | ||
41 | */ | ||
42 | public $carryover; | ||
43 | |||
44 | /** | ||
45 | * @param string $n | ||
46 | * @return null|string | ||
47 | */ | ||
48 | public function __get($n) | ||
49 | { | ||
50 | if ($n === 'type') { | ||
51 | trigger_error('Deprecated type property called; use instanceof', E_USER_NOTICE); | ||
52 | switch (get_class($this)) { | ||
53 | case 'HTMLPurifier_Token_Start': | ||
54 | return 'start'; | ||
55 | case 'HTMLPurifier_Token_Empty': | ||
56 | return 'empty'; | ||
57 | case 'HTMLPurifier_Token_End': | ||
58 | return 'end'; | ||
59 | case 'HTMLPurifier_Token_Text': | ||
60 | return 'text'; | ||
61 | case 'HTMLPurifier_Token_Comment': | ||
62 | return 'comment'; | ||
63 | default: | ||
64 | return null; | ||
65 | } | ||
66 | } | ||
67 | } | ||
68 | |||
69 | /** | ||
70 | * Sets the position of the token in the source document. | ||
71 | * @param int $l | ||
72 | * @param int $c | ||
73 | */ | ||
74 | public function position($l = null, $c = null) | ||
75 | { | ||
76 | $this->line = $l; | ||
77 | $this->col = $c; | ||
78 | } | ||
79 | |||
80 | /** | ||
81 | * Convenience function for DirectLex settings line/col position. | ||
82 | * @param int $l | ||
83 | * @param int $c | ||
84 | */ | ||
85 | public function rawPosition($l, $c) | ||
86 | { | ||
87 | if ($c === -1) { | ||
88 | $l++; | ||
89 | } | ||
90 | $this->line = $l; | ||
91 | $this->col = $c; | ||
92 | } | ||
93 | |||
94 | /** | ||
95 | * Converts a token into its corresponding node. | ||
96 | */ | ||
97 | abstract public function toNode(); | ||
98 | } | ||
99 | |||
100 | // vim: et sw=4 sts=4 | ||