23 public function validate($css, $config, $context)
27 $definition = $config->getCSSDefinition();
35 $declarations = explode(
';', $css);
36 $propvalues = array();
42 $context->register(
'CurrentCSSProperty', $property);
44 foreach ($declarations as $declaration) {
48 if (!strpos($declaration,
':')) {
51 list($property, $value) = explode(
':', $declaration, 2);
52 $property = trim($property);
53 $value = trim($value);
56 if (isset($definition->info[$property])) {
60 if (ctype_lower($property)) {
63 $property = strtolower($property);
64 if (isset($definition->info[$property])) {
73 if (strtolower(trim($value)) !==
'inherit') {
75 $result = $definition->info[$property]->validate(
86 $propvalues[$property] =
$result;
89 $context->destroy(
'CurrentCSSProperty');
95 $new_declarations =
'';
96 foreach ($propvalues as $prop => $value) {
97 $new_declarations .=
"$prop:$value;";
100 return $new_declarations ? $new_declarations :
false;