2007-05-21 01:36:15 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once 'HTMLPurifier/AttrDef.php';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Validates a boolean attribute
|
|
|
|
*/
|
|
|
|
class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef
|
|
|
|
{
|
|
|
|
|
2007-11-25 02:24:39 +00:00
|
|
|
protected $name;
|
|
|
|
public $minimized = true;
|
2007-05-21 01:36:15 +00:00
|
|
|
|
2007-11-25 02:24:39 +00:00
|
|
|
public function HTMLPurifier_AttrDef_HTML_Bool($name = false) {$this->name = $name;}
|
2007-05-21 01:36:15 +00:00
|
|
|
|
2007-11-25 02:24:39 +00:00
|
|
|
public function validate($string, $config, &$context) {
|
2007-05-21 01:36:15 +00:00
|
|
|
if (empty($string)) return false;
|
2007-05-29 02:12:08 +00:00
|
|
|
return $this->name;
|
2007-05-21 01:36:15 +00:00
|
|
|
}
|
|
|
|
|
2007-05-23 00:39:07 +00:00
|
|
|
/**
|
|
|
|
* @param $string Name of attribute
|
|
|
|
*/
|
2007-11-25 02:24:39 +00:00
|
|
|
public function make($string) {
|
2007-05-23 00:39:07 +00:00
|
|
|
return new HTMLPurifier_AttrDef_HTML_Bool($string);
|
|
|
|
}
|
|
|
|
|
2007-05-21 01:36:15 +00:00
|
|
|
}
|
|
|
|
|