mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-10 07:38:41 +00:00
7579932948
- Implemented make() for Enum and Bool - Migrate classes over to this new syntax - Add AttrDef_HTML_Bool unit test git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1088 48356398-32a2-884e-a903-53898d9a118a
30 lines
586 B
PHP
30 lines
586 B
PHP
<?php
|
|
|
|
require_once 'HTMLPurifier/AttrDef.php';
|
|
|
|
/**
|
|
* Validates a boolean attribute
|
|
*/
|
|
class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef
|
|
{
|
|
|
|
var $name;
|
|
var $minimized = true;
|
|
|
|
function HTMLPurifier_AttrDef_HTML_Bool($name = false) {$this->name = $name;}
|
|
|
|
function validate($string, $config, &$context) {
|
|
if (empty($string)) return false;
|
|
return $name;
|
|
}
|
|
|
|
/**
|
|
* @param $string Name of attribute
|
|
*/
|
|
function make($string) {
|
|
return new HTMLPurifier_AttrDef_HTML_Bool($string);
|
|
}
|
|
|
|
}
|
|
|
|
?>
|