Bool.php 873 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Validates a boolean attribute
  4. */
  5. class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef
  6. {
  7. /**
  8. * @type string
  9. */
  10. protected $name;
  11. /**
  12. * @type bool
  13. */
  14. public $minimized = true;
  15. /**
  16. * @param bool|string $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