File indexing completed on 2025-01-26 05:29:09
0001 <?php 0002 0003 /** 0004 * Abstract base token class that all others inherit from. 0005 */ 0006 abstract class HTMLPurifier_Token 0007 { 0008 /** 0009 * Line number node was on in source document. Null if unknown. 0010 * @type int 0011 */ 0012 public $line; 0013 0014 /** 0015 * Column of line node was on in source document. Null if unknown. 0016 * @type int 0017 */ 0018 public $col; 0019 0020 /** 0021 * Lookup array of processing that this token is exempt from. 0022 * Currently, valid values are "ValidateAttributes" and 0023 * "MakeWellFormed_TagClosedError" 0024 * @type array 0025 */ 0026 public $armor = array(); 0027 0028 /** 0029 * Used during MakeWellFormed. See Note [Injector skips] 0030 * @type 0031 */ 0032 public $skip; 0033 0034 /** 0035 * @type 0036 */ 0037 public $rewind; 0038 0039 /** 0040 * @type 0041 */ 0042 public $carryover; 0043 0044 /** 0045 * @param string $n 0046 * @return null|string 0047 */ 0048 public function __get($n) 0049 { 0050 if ($n === 'type') { 0051 trigger_error('Deprecated type property called; use instanceof', E_USER_NOTICE); 0052 switch (get_class($this)) { 0053 case 'HTMLPurifier_Token_Start': 0054 return 'start'; 0055 case 'HTMLPurifier_Token_Empty': 0056 return 'empty'; 0057 case 'HTMLPurifier_Token_End': 0058 return 'end'; 0059 case 'HTMLPurifier_Token_Text': 0060 return 'text'; 0061 case 'HTMLPurifier_Token_Comment': 0062 return 'comment'; 0063 default: 0064 return null; 0065 } 0066 } 0067 } 0068 0069 /** 0070 * Sets the position of the token in the source document. 0071 * @param int $l 0072 * @param int $c 0073 */ 0074 public function position($l = null, $c = null) 0075 { 0076 $this->line = $l; 0077 $this->col = $c; 0078 } 0079 0080 /** 0081 * Convenience function for DirectLex settings line/col position. 0082 * @param int $l 0083 * @param int $c 0084 */ 0085 public function rawPosition($l, $c) 0086 { 0087 if ($c === -1) { 0088 $l++; 0089 } 0090 $this->line = $l; 0091 $this->col = $c; 0092 } 0093 0094 /** 0095 * Converts a token into its corresponding node. 0096 */ 0097 abstract public function toNode(); 0098 } 0099 0100 // vim: et sw=4 sts=4