|
Revision 21, 0.6 kB
(checked in by admin, 18 years ago)
|
|
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | /** |
|---|
| 4 | * Validates a boolean attribute |
|---|
| 5 | */ |
|---|
| 6 | class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef |
|---|
| 7 | { |
|---|
| 8 | |
|---|
| 9 | protected $name; |
|---|
| 10 | public $minimized = true; |
|---|
| 11 | |
|---|
| 12 | public function __construct($name = false) {$this->name = $name;} |
|---|
| 13 | |
|---|
| 14 | public function validate($string, $config, $context) { |
|---|
| 15 | if (empty($string)) return false; |
|---|
| 16 | return $this->name; |
|---|
| 17 | } |
|---|
| 18 | |
|---|
| 19 | /** |
|---|
| 20 | * @param $string Name of attribute |
|---|
| 21 | */ |
|---|
| 22 | public function make($string) { |
|---|
| 23 | return new HTMLPurifier_AttrDef_HTML_Bool($string); |
|---|
| 24 | } |
|---|
| 25 | |
|---|
| 26 | } |
|---|
| 27 | |
|---|