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
|
|
|
|
{
|
|
|
|
|
|
|
|
var $name;
|
|
|
|
var $minimized = true;
|
|
|
|
|
2007-05-23 00:39:07 +00:00
|
|
|
function HTMLPurifier_AttrDef_HTML_Bool($name = false) {$this->name = $name;}
|
2007-05-21 01:36:15 +00:00
|
|
|
|
|
|
|
function validate($string, $config, &$context) {
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
function make($string) {
|
|
|
|
return new HTMLPurifier_AttrDef_HTML_Bool($string);
|
|
|
|
}
|
|
|
|
|
2007-05-21 01:36:15 +00:00
|
|
|
}
|
|
|
|
|