ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
TextDecoration.php
Go to the documentation of this file.
1<?php
2
9{
10
17 public function validate($string, $config, $context)
18 {
19 static $allowed_values = array(
20 'line-through' => true,
21 'overline' => true,
22 'underline' => true,
23 );
24
25 $string = strtolower($this->parseCDATA($string));
26
27 if ($string === 'none') {
28 return $string;
29 }
30
31 $parts = explode(' ', $string);
32 $final = '';
33 foreach ($parts as $part) {
34 if (isset($allowed_values[$part])) {
35 $final .= $part . ' ';
36 }
37 }
38 $final = rtrim($final);
39 if ($final === '') {
40 return false;
41 }
42 return $final;
43 }
44}
45
46// vim: et sw=4 sts=4
Validates the value for the CSS property text-decoration.
validate($string, $config, $context)
Base class for all validating attribute definitions.
Definition: AttrDef.php:14
parseCDATA($string)
Convenience method that parses a string as if it were CDATA.
Definition: AttrDef.php:60