4 * Validates the border property as defined by CSS.
6 class HTMLPurifier_AttrDef_CSS_Border extends HTMLPurifier_AttrDef
10 * Local copy of properties this property is shorthand for.
11 * @type HTMLPurifier_AttrDef[]
13 protected $info = array();
16 * @param HTMLPurifier_Config $config
18 public function __construct($config)
20 $def = $config->getCSSDefinition();
21 $this->info['border-width'] = $def->info['border-width'];
22 $this->info['border-style'] = $def->info['border-style'];
23 $this->info['border-top-color'] = $def->info['border-top-color'];
27 * @param string $string
28 * @param HTMLPurifier_Config $config
29 * @param HTMLPurifier_Context $context
32 public function validate($string, $config, $context)
34 $string = $this->parseCDATA($string);
35 $string = $this->mungeRgb($string);
36 $bits = explode(' ', $string);
37 $done = array(); // segments we've finished
38 $ret = ''; // return value
39 foreach ($bits as $bit) {
40 foreach ($this->info as $propname => $validator) {
41 if (isset($done[$propname])) {
44 $r = $validator->validate($bit, $config, $context);
47 $done[$propname] = true;