mirror of
https://github.com/moodle/moodle.git
synced 2025-07-14 02:46:30 +02:00
30 lines
590 B
PHP
30 lines
590 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 $this->name;
|
|
}
|
|
|
|
/**
|
|
* @param $string Name of attribute
|
|
*/
|
|
function make($string) {
|
|
return new HTMLPurifier_AttrDef_HTML_Bool($string);
|
|
}
|
|
|
|
}
|
|
|