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 CSSPropertyDeclaration {
4
  var $_code;
5
  var $_value;
6
  var $_important;
7
 
8
  function CSSPropertyDeclaration() {
9
    $this->_code      = 0;
10
    $this->_value     = null;
11
    $this->_important = false;
12
  }
13
 
14
  function &get_value() {
15
    return $this->_value;
16
  }
17
 
18
  function set_code($code) {
19
    $this->_code = $code;
20
  }
21
 
22
  function set_important($value) {
23
    $this->_important = $value;
24
  }
25
 
26
  function set_value(&$value) {
27
    $this->_value =& $value;
28
  }
29
 
30
  function &create($code, $value, $pipeline) {
31
    $handler =& CSS::get_handler($code);
32
    if (is_null($handler)) {
33
      $null = null;
34
      return $null;
35
    };
36
 
37
    $declaration =& new CSSPropertyDeclaration();
38
    $declaration->_code = $code;
39
 
40
    if (preg_match("/^(.*)!\s*important\s*$/", $value, $matches)) {
41
      $value     = $matches[1];
42
      $declaration->_important = true;
43
    } else {
44
      $declaration->_important = false;
45
    };
46
 
47
    $declaration->_value = $handler->parse($value, $pipeline);
48
    return $declaration;
49
  }
50
 
51
  function get_code() {
52
    return $this->_code;
53
  }
54
 
55
  function &copy() {
56
    $declaration =& new CSSPropertyDeclaration();
57
    $declaration->_code = $this->_code;
58
 
59
    if (is_object($this->_value)) {
60
      $declaration->_value =& $this->_value->copy();
61
    } else {
62
      $declaration->_value =& $this->_value;
63
    };
64
 
65
    $declaration->_important = $this->_important;
66
 
67
    return $declaration;
68
  }
69
 
70
  function is_important() {
71
    return $this->_important;
72
  }
73
}
74
 
75
?>