Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
class CSSPropertyStringSet extends CSSPropertyHandler {
4
  var $_mapping;
5
  var $_keys;
6
 
7
  function CSSPropertyStringSet($inherit, $inherit_text, $mapping) {
8
    $this->CSSPropertyHandler($inherit, $inherit_text);
9
 
10
    $this->_mapping = $mapping;
11
 
12
    /**
13
     * Unfortunately, isset($this->_mapping[$key]) will return false
14
     * for $_mapping[$key] = null. As CSS_PROPERTY_INHERIT value is 'null',
15
     * this should be avoided using the hack below
16
     */
17
    $this->_keys    = $mapping;
18
    foreach ($this->_keys as $key => $value) {
19
      $this->_keys[$key] = 1;
20
    };
21
  }
22
 
23
  function parse($value) {
24
    $value = trim(strtolower($value));
25
 
26
    if (isset($this->_keys[$value])) {
27
      return $this->_mapping[$value];
28
    };
29
 
30
    return $this->default_value();
31
  }
32
}
33
 
34
?>