Bool.php 864 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * Validates a boolean attribute
  4. */
  5. class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef
  6. {
  7. /**
  8. * @type bool
  9. */
  10. protected $name;
  11. /**
  12. * @type bool
  13. */
  14. public $minimized = true;
  15. /**
  16. * @param bool $name
  17. */
  18. public function __construct($name = false)
  19. {
  20. $this->name = $name;
  21. }
  22. /**
  23. * @param string $string
  24. * @param HTMLPurifier_Config $config
  25. * @param HTMLPurifier_Context $context
  26. * @return bool|string
  27. */
  28. public function validate($string, $config, $context)
  29. {
  30. return $this->name;
  31. }
  32. /**
  33. * @param string $string Name of attribute
  34. * @return HTMLPurifier_AttrDef_HTML_Bool
  35. */
  36. public function make($string)
  37. {
  38. return new HTMLPurifier_AttrDef_HTML_Bool($string);
  39. }
  40. }
  41. // vim: et sw=4 sts=4