]>
Commit | Line | Data |
---|---|---|
f45a286b AD |
1 | <?php |
2 | ||
3 | /** | |
4 | * Abstract base token class that all others inherit from. | |
5 | */ | |
6 | class HTMLPurifier_Token { | |
7 | public $line; /**< Line number node was on in source document. Null if unknown. */ | |
8 | public $col; /**< Column of line node was on in source document. Null if unknown. */ | |
9 | ||
10 | /** | |
11 | * Lookup array of processing that this token is exempt from. | |
12 | * Currently, valid values are "ValidateAttributes" and | |
13 | * "MakeWellFormed_TagClosedError" | |
14 | */ | |
15 | public $armor = array(); | |
16 | ||
17 | /** | |
18 | * Used during MakeWellFormed. | |
19 | */ | |
20 | public $skip; | |
21 | public $rewind; | |
22 | public $carryover; | |
23 | ||
24 | public function __get($n) { | |
25 | if ($n === 'type') { | |
26 | trigger_error('Deprecated type property called; use instanceof', E_USER_NOTICE); | |
27 | switch (get_class($this)) { | |
28 | case 'HTMLPurifier_Token_Start': return 'start'; | |
29 | case 'HTMLPurifier_Token_Empty': return 'empty'; | |
30 | case 'HTMLPurifier_Token_End': return 'end'; | |
31 | case 'HTMLPurifier_Token_Text': return 'text'; | |
32 | case 'HTMLPurifier_Token_Comment': return 'comment'; | |
33 | default: return null; | |
34 | } | |
35 | } | |
36 | } | |
37 | ||
38 | /** | |
39 | * Sets the position of the token in the source document. | |
40 | */ | |
41 | public function position($l = null, $c = null) { | |
42 | $this->line = $l; | |
43 | $this->col = $c; | |
44 | } | |
45 | ||
46 | /** | |
47 | * Convenience function for DirectLex settings line/col position. | |
48 | */ | |
49 | public function rawPosition($l, $c) { | |
50 | if ($c === -1) $l++; | |
51 | $this->line = $l; | |
52 | $this->col = $c; | |
53 | } | |
54 | ||
55 | } | |
56 | ||
57 | // vim: et sw=4 sts=4 |