/plugins/vjCommentPlugin/lib/tools/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Bool.php

https://bitbucket.org/Kudlaty/360kdw · PHP · 28 lines · 14 code · 7 blank · 7 comment · 1 complexity · c579b5a145c447f1880c7bc6d3db774c MD5 · raw file

  1. <?php
  2. /**
  3. * Validates a boolean attribute
  4. */
  5. class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef
  6. {
  7. protected $name;
  8. public $minimized = true;
  9. public function __construct($name = false) {$this->name = $name;}
  10. public function validate($string, $config, $context) {
  11. if (empty($string)) return false;
  12. return $this->name;
  13. }
  14. /**
  15. * @param $string Name of attribute
  16. */
  17. public function make($string) {
  18. return new HTMLPurifier_AttrDef_HTML_Bool($string);
  19. }
  20. }
  21. // vim: et sw=4 sts=4