Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / lib / htmlpurifier / HTMLPurifier / AttrDef / CSS / TextDecoration.php
blob501ab2616fecbf4af9509c3991d334cea388f5a3
1 <?php
3 require_once 'HTMLPurifier/AttrDef.php';
5 /**
6 * Validates the value for the CSS property text-decoration
7 * @note This class could be generalized into a version that acts sort of
8 * like Enum except you can compound the allowed values.
9 */
10 class HTMLPurifier_AttrDef_CSS_TextDecoration extends HTMLPurifier_AttrDef
13 function validate($string, $config, &$context) {
15 static $allowed_values = array(
16 'line-through' => true,
17 'overline' => true,
18 'underline' => true
21 $string = strtolower($this->parseCDATA($string));
22 $parts = explode(' ', $string);
23 $final = '';
24 foreach ($parts as $part) {
25 if (isset($allowed_values[$part])) {
26 $final .= $part . ' ';
29 $final = rtrim($final);
30 if ($final === '') return false;
31 return $final;