]> git.immae.eu Git - github/wallabag/wallabag.git/blame - inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/CSS/TextDecoration.php
remove autoload section in composer.json
[github/wallabag/wallabag.git] / inc / 3rdparty / htmlpurifier / HTMLPurifier / AttrDef / CSS / TextDecoration.php
CommitLineData
d4949327
NL
1<?php\r
2\r
3/**\r
4 * Validates the value for the CSS property text-decoration\r
5 * @note This class could be generalized into a version that acts sort of\r
6 * like Enum except you can compound the allowed values.\r
7 */\r
8class HTMLPurifier_AttrDef_CSS_TextDecoration extends HTMLPurifier_AttrDef\r
9{\r
10\r
11 /**\r
12 * @param string $string\r
13 * @param HTMLPurifier_Config $config\r
14 * @param HTMLPurifier_Context $context\r
15 * @return bool|string\r
16 */\r
17 public function validate($string, $config, $context)\r
18 {\r
19 static $allowed_values = array(\r
20 'line-through' => true,\r
21 'overline' => true,\r
22 'underline' => true,\r
23 );\r
24\r
25 $string = strtolower($this->parseCDATA($string));\r
26\r
27 if ($string === 'none') {\r
28 return $string;\r
29 }\r
30\r
31 $parts = explode(' ', $string);\r
32 $final = '';\r
33 foreach ($parts as $part) {\r
34 if (isset($allowed_values[$part])) {\r
35 $final .= $part . ' ';\r
36 }\r
37 }\r
38 $final = rtrim($final);\r
39 if ($final === '') {\r
40 return false;\r
41 }\r
42 return $final;\r
43 }\r
44}\r
45\r
46// vim: et sw=4 sts=4\r