File indexing completed on 2024-12-22 05:36:20

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_Node_Text extends HTMLPurifier_Node
0013 {
0014 
0015     /**
0016      * PCDATA tag name compatible with DTD, see
0017      * HTMLPurifier_ChildDef_Custom for details.
0018      * @type string
0019      */
0020     public $name = '#PCDATA';
0021 
0022     /**
0023      * @type string
0024      */
0025     public $data;
0026     /**< Parsed character data of text. */
0027 
0028     /**
0029      * @type bool
0030      */
0031     public $is_whitespace;
0032 
0033     /**< Bool indicating if node is whitespace. */
0034 
0035     /**
0036      * Constructor, accepts data and determines if it is whitespace.
0037      * @param string $data String parsed character data.
0038      * @param int $line
0039      * @param int $col
0040      */
0041     public function __construct($data, $is_whitespace, $line = null, $col = null)
0042     {
0043         $this->data = $data;
0044         $this->is_whitespace = $is_whitespace;
0045         $this->line = $line;
0046         $this->col = $col;
0047     }
0048 
0049     public function toTokenPair() {
0050         return array(new HTMLPurifier_Token_Text($this->data, $this->line, $this->col), null);
0051     }
0052 }
0053 
0054 // vim: et sw=4 sts=4