2006-07-23 00:11:03 +00:00
|
|
|
<?php
|
|
|
|
|
2006-07-23 13:20:15 +00:00
|
|
|
/**
|
|
|
|
* Abstract base token class that all others inherit from.
|
|
|
|
*/
|
|
|
|
class HTMLPurifier_Token {
|
2007-11-25 02:24:39 +00:00
|
|
|
public $line; /**< Line number node was on in source document. Null if unknown. */
|
2008-09-01 18:10:10 +00:00
|
|
|
public $col; /**< Column of line node was on in source document. Null if unknown. */
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-06-20 21:39:28 +00:00
|
|
|
/**
|
|
|
|
* Lookup array of processing that this token is exempt from.
|
2007-06-26 15:07:07 +00:00
|
|
|
* Currently, valid values are "ValidateAttributes" and
|
|
|
|
* "MakeWellFormed_TagClosedError"
|
2007-06-20 21:39:28 +00:00
|
|
|
*/
|
2007-11-25 02:24:39 +00:00
|
|
|
public $armor = array();
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-10-01 07:14:28 +00:00
|
|
|
/**
|
|
|
|
* Used during MakeWellFormed.
|
|
|
|
*/
|
|
|
|
public $skip;
|
|
|
|
public $rewind;
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-01-19 20:23:01 +00:00
|
|
|
public function __get($n) {
|
|
|
|
if ($n === 'type') {
|
|
|
|
trigger_error('Deprecated type property called; use instanceof', E_USER_NOTICE);
|
|
|
|
switch (get_class($this)) {
|
2008-09-01 18:10:10 +00:00
|
|
|
case 'HTMLPurifier_Token_Start': return 'start';
|
|
|
|
case 'HTMLPurifier_Token_Empty': return 'empty';
|
|
|
|
case 'HTMLPurifier_Token_End': return 'end';
|
|
|
|
case 'HTMLPurifier_Token_Text': return 'text';
|
|
|
|
case 'HTMLPurifier_Token_Comment': return 'comment';
|
2008-01-19 20:23:01 +00:00
|
|
|
default: return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-09-01 18:10:10 +00:00
|
|
|
/**
|
|
|
|
* Sets the position of the token in the source document.
|
|
|
|
*/
|
|
|
|
public function position($l = null, $c = null) {
|
|
|
|
$this->line = $l;
|
|
|
|
$this->col = $c;
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-09-01 18:10:10 +00:00
|
|
|
/**
|
|
|
|
* Convenience function for DirectLex settings line/col position.
|
|
|
|
*/
|
|
|
|
public function rawPosition($l, $c) {
|
|
|
|
if ($c === -1) $l++;
|
|
|
|
$this->line = $l;
|
|
|
|
$this->col = $c;
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2006-07-23 13:20:15 +00:00
|
|
|
}
|