You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.3KB

  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_Node_Text extends HTMLPurifier_Node
  12. {
  13. /**
  14. * PCDATA tag name compatible with DTD, see
  15. * HTMLPurifier_ChildDef_Custom for details.
  16. * @type string
  17. */
  18. public $name = '#PCDATA';
  19. /**
  20. * @type string
  21. */
  22. public $data;
  23. /**< Parsed character data of text. */
  24. /**
  25. * @type bool
  26. */
  27. public $is_whitespace;
  28. /**< Bool indicating if node is whitespace. */
  29. /**
  30. * Constructor, accepts data and determines if it is whitespace.
  31. * @param string $data String parsed character data.
  32. * @param int $line
  33. * @param int $col
  34. */
  35. public function __construct($data, $is_whitespace, $line = null, $col = null)
  36. {
  37. $this->data = $data;
  38. $this->is_whitespace = $is_whitespace;
  39. $this->line = $line;
  40. $this->col = $col;
  41. }
  42. public function toTokenPair() {
  43. return array(new HTMLPurifier_Token_Text($this->data, $this->line, $this->col), null);
  44. }
  45. }
  46. // vim: et sw=4 sts=4