| 1: | <?php
|
| 2: |
|
| 3: | |
| 4: | |
| 5: |
|
| 6: | class HTMLPurifier_AttrDef_CSS_Border extends HTMLPurifier_AttrDef
|
| 7: | {
|
| 8: |
|
| 9: | |
| 10: | |
| 11: | |
| 12: |
|
| 13: | protected $info = array();
|
| 14: |
|
| 15: | |
| 16: | |
| 17: |
|
| 18: | public function __construct($config)
|
| 19: | {
|
| 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'];
|
| 24: | }
|
| 25: |
|
| 26: | |
| 27: | |
| 28: | |
| 29: | |
| 30: | |
| 31: |
|
| 32: | public function validate($string, $config, $context)
|
| 33: | {
|
| 34: | $string = $this->parseCDATA($string);
|
| 35: | $string = $this->mungeRgb($string);
|
| 36: | $bits = explode(' ', $string);
|
| 37: | $done = array();
|
| 38: | $ret = '';
|
| 39: | foreach ($bits as $bit) {
|
| 40: | foreach ($this->info as $propname => $validator) {
|
| 41: | if (isset($done[$propname])) {
|
| 42: | continue;
|
| 43: | }
|
| 44: | $r = $validator->validate($bit, $config, $context);
|
| 45: | if ($r !== false) {
|
| 46: | $ret .= $r . ' ';
|
| 47: | $done[$propname] = true;
|
| 48: | break;
|
| 49: | }
|
| 50: | }
|
| 51: | }
|
| 52: | return rtrim($ret);
|
| 53: | }
|
| 54: | }
|
| 55: |
|
| 56: |
|
| 57: | |