Add a little bit of documentation about contexts for URIFilters.
[htmlpurifier.git] / library / HTMLPurifier / Token.php
blob7900e6cb10110ef4e9b6cec880c1a6d59c7beed1
1 <?php
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. */
10 /**
11 * Lookup array of processing that this token is exempt from.
12 * Currently, valid values are "ValidateAttributes" and
13 * "MakeWellFormed_TagClosedError"
15 public $armor = array();
17 /**
18 * Used during MakeWellFormed.
20 public $skip;
21 public $rewind;
22 public $carryover;
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;
38 /**
39 * Sets the position of the token in the source document.
41 public function position($l = null, $c = null) {
42 $this->line = $l;
43 $this->col = $c;
46 /**
47 * Convenience function for DirectLex settings line/col position.
49 public function rawPosition($l, $c) {
50 if ($c === -1) $l++;
51 $this->line = $l;
52 $this->col = $c;
57 // vim: et sw=4 sts=4