3 require_once 'HTMLPurifier/AttrDef.php';
6 * Validates the border property as defined by CSS.
8 class HTMLPurifier_AttrDef_CSS_Border
extends HTMLPurifier_AttrDef
12 * Local copy of properties this property is shorthand for.
16 function HTMLPurifier_AttrDef_CSS_Border($config) {
17 $def = $config->getCSSDefinition();
18 $this->info
['border-width'] = $def->info
['border-width'];
19 $this->info
['border-style'] = $def->info
['border-style'];
20 $this->info
['border-top-color'] = $def->info
['border-top-color'];
23 function validate($string, $config, &$context) {
24 $string = $this->parseCDATA($string);
25 // we specifically will not support rgb() syntax with spaces
26 $bits = explode(' ', $string);
27 $done = array(); // segments we've finished
28 $ret = ''; // return value
29 foreach ($bits as $bit) {
30 foreach ($this->info
as $propname => $validator) {
31 if (isset($done[$propname])) continue;
32 $r = $validator->validate($bit, $config, $context);
35 $done[$propname] = true;