2007-05-21 01:36:15 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Validates a boolean attribute
|
|
|
|
*/
|
|
|
|
class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef
|
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
/**
|
|
|
|
* @type bool
|
|
|
|
*/
|
2007-11-25 02:24:39 +00:00
|
|
|
protected $name;
|
2013-07-16 11:56:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @type bool
|
|
|
|
*/
|
2007-11-25 02:24:39 +00:00
|
|
|
public $minimized = true;
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
/**
|
|
|
|
* @param bool $name
|
|
|
|
*/
|
|
|
|
public function __construct($name = false)
|
|
|
|
{
|
|
|
|
$this->name = $name;
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
/**
|
|
|
|
* @param string $string
|
|
|
|
* @param HTMLPurifier_Config $config
|
|
|
|
* @param HTMLPurifier_Context $context
|
|
|
|
* @return bool|string
|
|
|
|
*/
|
|
|
|
public 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
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-23 00:39:07 +00:00
|
|
|
/**
|
2013-07-16 11:56:14 +00:00
|
|
|
* @param string $string Name of attribute
|
|
|
|
* @return HTMLPurifier_AttrDef_HTML_Bool
|
2007-05-23 00:39:07 +00:00
|
|
|
*/
|
2013-07-16 11:56:14 +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
|
|
|
}
|
|
|
|
|
2008-12-06 09:24:59 +00:00
|
|
|
// vim: et sw=4 sts=4
|