]> git.wh0rd.org - tt-rss.git/blob - lib/htmlpurifier/library/HTMLPurifier/AttrDef/CSS/TextDecoration.php
quickAddFeed: remove oauth notice, mention you can paste site URL
[tt-rss.git] / lib / htmlpurifier / library / HTMLPurifier / AttrDef / CSS / TextDecoration.php
1 <?php
2
3 /**
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.
7 */
8 class HTMLPurifier_AttrDef_CSS_TextDecoration extends HTMLPurifier_AttrDef
9 {
10
11 public function validate($string, $config, $context) {
12
13 static $allowed_values = array(
14 'line-through' => true,
15 'overline' => true,
16 'underline' => true,
17 );
18
19 $string = strtolower($this->parseCDATA($string));
20
21 if ($string === 'none') return $string;
22
23 $parts = explode(' ', $string);
24 $final = '';
25 foreach ($parts as $part) {
26 if (isset($allowed_values[$part])) {
27 $final .= $part . ' ';
28 }
29 }
30 $final = rtrim($final);
31 if ($final === '') return false;
32 return $final;
33
34 }
35
36 }
37
38 // vim: et sw=4 sts=4