-
Notifications
You must be signed in to change notification settings - Fork 3
/
idproperties_54.php
executable file
·55 lines (48 loc) · 1.32 KB
/
idproperties_54.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
trait IdProperties {
private $idproperties=array();
public function getAllProperties() {
return $this->idproperties;
}
public function setAllProperties($idproperties=array()) {
$this->idproperties=array_values(array_merge($this->idproperties, $idproperties));
}
public function getIdProperties($id=NULL) {
if(array_key_exists($id, $this->idproperties)) {
return $this->idproperties[$id];
}
else {
return NULL;
}
}
public function setIdProperties($id=NULL, $idproperties=array()) {
$this->idproperties[$id]=array_values(array_merge($this->idproperties[$id], $idproperties));
}
public function getIdProperty($id=NULL, $key='') {
if(array_key_exists($id, $this->idproperties)) {
if(array_key_exists($key, $this->idproperties)) {
return $this->idproperties[$id][$key];
}
else {
return NULL;
}
}
else {
return NULL;
}
}
public function setIdProperty($id=NULL, $key='', $value='') {
$this->idproperties[$id][$key]=$value;
}
public function loadIdProperties_from_element(array $xml=NULL, $ref='') {
if($xml===NULL) return;
foreach($xml as $elem) {
$id=(string)$elem['id'];
if((bool)$elem->properties===false) continue;
foreach($elem->properties->property as $prop) {
$this->setIdProperty($id, (string)$prop['name'], (string)$prop['value']);
}
}
}
};
?>