Automatic installer.php lang files by installer_builder (20070726)
[moodle-linuxchix.git] / lib / htmlpurifier / HTMLPurifier / AttrDef / CSS / Border.php
blob583f14fd09b28bb305b8ba45f822d9e61f098c02
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 // 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);
33 if ($r !== false) {
34 $ret .= $r . ' ';
35 $done[$propname] = true;
36 break;
40 return rtrim($ret);