File indexing completed on 2025-02-02 05:43:44
0001 <?php 0002 0003 /** 0004 * Concrete text token class. 0005 * 0006 * Text tokens comprise of regular parsed character data (PCDATA) and raw 0007 * character data (from the CDATA sections). Internally, their 0008 * data is parsed with all entities expanded. Surprisingly, the text token 0009 * does have a "tag name" called #PCDATA, which is how the DTD represents it 0010 * in permissible child nodes. 0011 */ 0012 class HTMLPurifier_Token_Text extends HTMLPurifier_Token 0013 { 0014 0015 /** 0016 * @type string 0017 */ 0018 public $name = '#PCDATA'; 0019 /**< PCDATA tag name compatible with DTD. */ 0020 0021 /** 0022 * @type string 0023 */ 0024 public $data; 0025 /**< Parsed character data of text. */ 0026 0027 /** 0028 * @type bool 0029 */ 0030 public $is_whitespace; 0031 0032 /**< Bool indicating if node is whitespace. */ 0033 0034 /** 0035 * Constructor, accepts data and determines if it is whitespace. 0036 * @param string $data String parsed character data. 0037 * @param int $line 0038 * @param int $col 0039 */ 0040 public function __construct($data, $line = null, $col = null) 0041 { 0042 $this->data = $data; 0043 $this->is_whitespace = ctype_space($data); 0044 $this->line = $line; 0045 $this->col = $col; 0046 } 0047 0048 public function toNode() { 0049 return new HTMLPurifier_Node_Text($this->data, $this->is_whitespace, $this->line, $this->col); 0050 } 0051 } 0052 0053 // vim: et sw=4 sts=4