17 public function validate($css, $config, $context) {
21 $definition = $config->getCSSDefinition();
29 $declarations = explode(
';', $css);
30 $propvalues = array();
36 $context->register(
'CurrentCSSProperty', $property);
38 foreach ($declarations as $declaration) {
39 if (!$declaration)
continue;
40 if (!strpos($declaration,
':'))
continue;
41 list($property, $value) = explode(
':', $declaration, 2);
42 $property = trim($property);
43 $value = trim($value);
46 if (isset($definition->info[$property])) {
50 if (ctype_lower($property))
break;
51 $property = strtolower($property);
52 if (isset($definition->info[$property])) {
59 if (strtolower(trim($value)) !==
'inherit') {
61 $result = $definition->info[$property]->validate(
62 $value, $config, $context );
66 if (
$result ===
false)
continue;
67 $propvalues[$property] =
$result;
70 $context->destroy(
'CurrentCSSProperty');
76 $new_declarations =
'';
77 foreach ($propvalues as $prop => $value) {
78 $new_declarations .=
"$prop:$value;";
81 return $new_declarations ? $new_declarations :
false;