27 $definition =
$config->getCSSDefinition();
28 $allow_duplicates =
$config->get(
"CSS.AllowDuplicates");
37 $declarations = array();
39 for (
$i = 0;
$i < $len;
$i++) {
40 $c = strcspn($css,
";'\"",
$i);
41 $accum .= substr($css,
$i,
$c);
43 if (
$i == $len)
break;
52 $declarations[] = $accum;
60 if ($accum !=
"") $declarations[] = $accum;
62 $propvalues = array();
63 $new_declarations =
'';
69 $context->register(
'CurrentCSSProperty', $property);
71 foreach ($declarations as $declaration) {
75 if (!strpos($declaration,
':')) {
78 list($property, $value) = explode(
':', $declaration, 2);
79 $property = trim($property);
80 $value = trim($value);
83 if (isset($definition->info[$property])) {
87 if (ctype_lower($property)) {
90 $property = strtolower($property);
91 if (isset($definition->info[$property])) {
100 if (strtolower(trim($value)) !==
'inherit') {
102 $result = $definition->info[$property]->validate(
113 if ($allow_duplicates) {
114 $new_declarations .=
"$property:$result;";
116 $propvalues[$property] =
$result;
120 $context->destroy(
'CurrentCSSProperty');
126 foreach ($propvalues as $prop => $value) {
127 $new_declarations .=
"$prop:$value;";
130 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.
Validates the HTML attribute style, otherwise known as CSS.
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d