27 $definition =
$config->getCSSDefinition();
28 $allow_duplicates =
$config->get(
"CSS.AllowDuplicates");
36 $declarations = explode(
';', $css);
37 $propvalues =
array();
38 $new_declarations =
'';
44 $context->register(
'CurrentCSSProperty', $property);
46 foreach ($declarations as $declaration) {
50 if (!strpos($declaration,
':')) {
53 list($property, $value) = explode(
':', $declaration, 2);
54 $property = trim($property);
55 $value = trim($value);
58 if (isset($definition->info[$property])) {
62 if (ctype_lower($property)) {
65 $property = strtolower($property);
66 if (isset($definition->info[$property])) {
75 if (strtolower(trim($value)) !==
'inherit') {
77 $result = $definition->info[$property]->validate(
88 if ($allow_duplicates) {
89 $new_declarations .=
"$property:$result;";
91 $propvalues[$property] =
$result;
95 $context->destroy(
'CurrentCSSProperty');
101 foreach ($propvalues as $prop => $value) {
102 $new_declarations .=
"$prop:$value;";
105 return $new_declarations ? $new_declarations :
false;
Base class for all validating attribute definitions.
validate($css, $config, $context)
parseCDATA($string)
Convenience method that parses a string as if it were CDATA.
Create styles array
The data for the language used.
Validates the HTML attribute style, otherwise known as CSS.