Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / lib / htmlpurifier / HTMLPurifier / AttrDef / CSS / Border.php
blob4eb3e25abd58806e0c5be2f02f029200f5aeabb3
1 <?php
3 require_once 'HTMLPurifier/AttrDef.php';
5 /**
6 * Validates the border property as defined by CSS.
7 */
8 class HTMLPurifier_AttrDef_CSS_Border extends HTMLPurifier_AttrDef
11 /**
12 * Local copy of properties this property is shorthand for.
14 var $info = array();
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 $string = $this->mungeRgb($string);
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);
33 if ($r !== false) {
34 $ret .= $r . ' ';
35 $done[$propname] = true;
36 break;
40 return rtrim($ret);