]>
Commit | Line | Data |
---|---|---|
d4949327 NL |
1 | <?php\r |
2 | \r | |
3 | /**\r | |
4 | * Concrete element node class.\r | |
5 | */\r | |
6 | class HTMLPurifier_Node_Element extends HTMLPurifier_Node\r | |
7 | {\r | |
8 | /**\r | |
9 | * The lower-case name of the tag, like 'a', 'b' or 'blockquote'.\r | |
10 | *\r | |
11 | * @note Strictly speaking, XML tags are case sensitive, so we shouldn't\r | |
12 | * be lower-casing them, but these tokens cater to HTML tags, which are\r | |
13 | * insensitive.\r | |
14 | * @type string\r | |
15 | */\r | |
16 | public $name;\r | |
17 | \r | |
18 | /**\r | |
19 | * Associative array of the node's attributes.\r | |
20 | * @type array\r | |
21 | */\r | |
22 | public $attr = array();\r | |
23 | \r | |
24 | /**\r | |
25 | * List of child elements.\r | |
26 | * @type array\r | |
27 | */\r | |
28 | public $children = array();\r | |
29 | \r | |
30 | /**\r | |
31 | * Does this use the <a></a> form or the </a> form, i.e.\r | |
32 | * is it a pair of start/end tokens or an empty token.\r | |
33 | * @bool\r | |
34 | */\r | |
35 | public $empty = false;\r | |
36 | \r | |
37 | public $endCol = null, $endLine = null, $endArmor = array();\r | |
38 | \r | |
39 | public function __construct($name, $attr = array(), $line = null, $col = null, $armor = array()) {\r | |
40 | $this->name = $name;\r | |
41 | $this->attr = $attr;\r | |
42 | $this->line = $line;\r | |
43 | $this->col = $col;\r | |
44 | $this->armor = $armor;\r | |
45 | }\r | |
46 | \r | |
47 | public function toTokenPair() {\r | |
48 | // XXX inefficiency here, normalization is not necessary\r | |
49 | if ($this->empty) {\r | |
50 | return array(new HTMLPurifier_Token_Empty($this->name, $this->attr, $this->line, $this->col, $this->armor), null);\r | |
51 | } else {\r | |
52 | $start = new HTMLPurifier_Token_Start($this->name, $this->attr, $this->line, $this->col, $this->armor);\r | |
53 | $end = new HTMLPurifier_Token_End($this->name, array(), $this->endLine, $this->endCol, $this->endArmor);\r | |
54 | //$end->start = $start;\r | |
55 | return array($start, $end);\r | |
56 | }\r | |
57 | }\r | |
58 | }\r | |
59 | \r |