Text.php 1014 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Concrete text token class.
  4. *
  5. * Text tokens comprise of regular parsed character data (PCDATA) and raw
  6. * character data (from the CDATA sections). Internally, their
  7. * data is parsed with all entities expanded. Surprisingly, the text token
  8. * does have a "tag name" called #PCDATA, which is how the DTD represents it
  9. * in permissible child nodes.
  10. */
  11. class HTMLPurifier_Token_Text extends HTMLPurifier_Token
  12. {
  13. public $name = '#PCDATA'; /**< PCDATA tag name compatible with DTD. */
  14. public $data; /**< Parsed character data of text. */
  15. public $is_whitespace; /**< Bool indicating if node is whitespace. */
  16. /**
  17. * Constructor, accepts data and determines if it is whitespace.
  18. *
  19. * @param $data String parsed character data.
  20. */
  21. public function __construct($data, $line = null, $col = null) {
  22. $this->data = $data;
  23. $this->is_whitespace = ctype_space($data);
  24. $this->line = $line;
  25. $this->col = $col;
  26. }
  27. }
  28. // vim: et sw=4 sts=4