4 * Validates the value for the CSS property text-decoration
5 * @note This class could be generalized into a version that acts sort of
6 * like Enum except you can compound the allowed values.
8 class HTMLPurifier_AttrDef_CSS_TextDecoration extends HTMLPurifier_AttrDef
11 public function validate($string, $config, $context) {
13 static $allowed_values = array(
14 'line-through' => true,
19 $string = strtolower($this->parseCDATA($string));
21 if ($string === 'none') return $string;
23 $parts = explode(' ', $string);
25 foreach ($parts as $part) {
26 if (isset($allowed_values[$part])) {
27 $final .= $part . ' ';
30 $final = rtrim($final);
31 if ($final === '') return false;