aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/3rdparty/htmlpurifier/HTMLPurifier/Token/Text.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/3rdparty/htmlpurifier/HTMLPurifier/Token/Text.php')
-rw-r--r--inc/3rdparty/htmlpurifier/HTMLPurifier/Token/Text.php53
1 files changed, 53 insertions, 0 deletions
diff --git a/inc/3rdparty/htmlpurifier/HTMLPurifier/Token/Text.php b/inc/3rdparty/htmlpurifier/HTMLPurifier/Token/Text.php
new file mode 100644
index 00000000..ff45125a
--- /dev/null
+++ b/inc/3rdparty/htmlpurifier/HTMLPurifier/Token/Text.php
@@ -0,0 +1,53 @@
1<?php
2
3/**
4 * Concrete text token class.
5 *
6 * Text tokens comprise of regular parsed character data (PCDATA) and raw
7 * character data (from the CDATA sections). Internally, their
8 * data is parsed with all entities expanded. Surprisingly, the text token
9 * does have a "tag name" called #PCDATA, which is how the DTD represents it
10 * in permissible child nodes.
11 */
12class HTMLPurifier_Token_Text extends HTMLPurifier_Token
13{
14
15 /**
16 * @type string
17 */
18 public $name = '#PCDATA';
19 /**< PCDATA tag name compatible with DTD. */
20
21 /**
22 * @type string
23 */
24 public $data;
25 /**< Parsed character data of text. */
26
27 /**
28 * @type bool
29 */
30 public $is_whitespace;
31
32 /**< Bool indicating if node is whitespace. */
33
34 /**
35 * Constructor, accepts data and determines if it is whitespace.
36 * @param string $data String parsed character data.
37 * @param int $line
38 * @param int $col
39 */
40 public function __construct($data, $line = null, $col = null)
41 {
42 $this->data = $data;
43 $this->is_whitespace = ctype_space($data);
44 $this->line = $line;
45 $this->col = $col;
46 }
47
48 public function toNode() {
49 return new HTMLPurifier_Node_Text($this->data, $this->is_whitespace, $this->line, $this->col);
50 }
51}
52
53// vim: et sw=4 sts=4