2006-08-16 15:12:48 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once 'HTMLPurifier/AttrDef.php';
|
|
|
|
|
2006-08-20 21:47:15 +00:00
|
|
|
/**
|
|
|
|
* Validates the value for the CSS property text-decoration
|
|
|
|
* @note This class could be generalized into a version that acts sort of
|
|
|
|
* like Enum except you can compound the allowed values.
|
|
|
|
*/
|
2007-02-14 20:38:51 +00:00
|
|
|
class HTMLPurifier_AttrDef_CSS_TextDecoration extends HTMLPurifier_AttrDef
|
2006-08-16 15:12:48 +00:00
|
|
|
{
|
|
|
|
|
2006-08-20 21:47:15 +00:00
|
|
|
/**
|
|
|
|
* Lookup table of allowed values.
|
|
|
|
* @protected
|
|
|
|
*/
|
2006-08-16 15:12:48 +00:00
|
|
|
var $allowed_values = array(
|
|
|
|
'line-through' => true,
|
|
|
|
'overline' => true,
|
|
|
|
'underline' => true
|
|
|
|
);
|
|
|
|
|
|
|
|
function validate($string, $config, &$context) {
|
|
|
|
|
|
|
|
$string = strtolower($this->parseCDATA($string));
|
|
|
|
$parts = explode(' ', $string);
|
|
|
|
$final = '';
|
|
|
|
foreach ($parts as $part) {
|
|
|
|
if (isset($this->allowed_values[$part])) {
|
|
|
|
$final .= $part . ' ';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$final = rtrim($final);
|
|
|
|
if ($final === '') return false;
|
|
|
|
return $final;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|