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