Token.php 743 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Token output from ECML Tokenizer
  4. *
  5. * @access private
  6. */
  7. class Elgg_Ecml_Token {
  8. /**
  9. * @var bool if true, token is plain text, not an ECML tag
  10. */
  11. public $isText = true;
  12. /**
  13. * @var string
  14. */
  15. public $content = "";
  16. /**
  17. * @var string
  18. */
  19. public $keyword = "";
  20. /**
  21. * @var array
  22. */
  23. public $attrs = array();
  24. /**
  25. * @static
  26. * @param string $content
  27. * @param string $keyword
  28. * @param array $attrs
  29. * @return Elgg_Ecml_Token
  30. */
  31. static function factory($content, $keyword = '', array $attrs = array()) {
  32. $token = new self();
  33. $token->content = $content;
  34. if ($keyword !== '') {
  35. $token->isText = false;
  36. $token->keyword = trim($keyword);
  37. $token->attrs = $attrs;
  38. }
  39. return $token;
  40. }
  41. }