diff options
author | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-03-06 10:28:12 +0000 |
---|---|---|
committer | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-03-06 10:28:12 +0000 |
commit | be6d5f0455f1603ea08b92b6444721ea8869e4ac (patch) | |
tree | a276f96dd97f42c55b34fc3c8fb525f4d1eda5e3 | |
parent | 982b28f3ed14a94a6a3c667a1639c221c2198691 (diff) | |
download | elgg-be6d5f0455f1603ea08b92b6444721ea8869e4ac.tar.gz elgg-be6d5f0455f1603ea08b92b6444721ea8869e4ac.tar.bz2 |
Marcus Povey <marcus@dushka.co.uk>
* Fixed get/sets
git-svn-id: https://code.elgg.org/elgg/trunk@87 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | engine/lib/annotations.php | 14 | ||||
-rw-r--r-- | engine/lib/metadata.php | 14 | ||||
-rw-r--r-- | engine/lib/objects.php | 3 |
3 files changed, 18 insertions, 13 deletions
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index 8a0438383..e73e04889 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -31,6 +31,8 @@ */ function __construct($id = null) { + $this->attributes = array(); + if (!empty($id)) { if ($id instanceof stdClass) $annotation = $id; @@ -47,23 +49,23 @@ } function __get($name) { - if (isset($attributes[$name])) { + if (isset($this->attributes[$name])) { // Sanitise outputs if required if ($name=='value') { - switch ($attributes['value_type']) + switch ($this->attributes['value_type']) { - case 'integer' : return (int)$attributes['value']; + case 'integer' : return (int)$this->attributes['value']; case 'tag' : case 'text' : - case 'file' : return sanitise_string($attributes['value']); + case 'file' : return sanitise_string($this->attributes['value']); - default : throw new InstallationException("Type {$attributes['value_type']} is not supported. This indicates an error in your installation, most likely caused by an incomplete upgrade."); + default : throw new InstallationException("Type {$this->attributes['value_type']} is not supported. This indicates an error in your installation, most likely caused by an incomplete upgrade."); } } - return $attributes[$name]; + return $this->attributes[$name]; } return null; } diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index 9d95cded6..e3a01ee2e 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -30,6 +30,8 @@ */ function __construct($id = null) { + $this->attributes = array(); + if (!empty($id)) { if ($id instanceof stdClass) @@ -47,23 +49,23 @@ } function __get($name) { - if (isset($attributes[$name])) { + if (isset($this->attributes[$name])) { // Sanitise value if necessary if ($name=='value') { - switch ($attributes['value_type']) + switch ($this->attributes['value_type']) { - case 'integer' : return (int)$attributes['value']; + case 'integer' : return (int)$this->attributes['value']; case 'tag' : case 'text' : - case 'file' : return sanitise_string($attributes['value']); + case 'file' : return sanitise_string($this->attributes['value']); - default : throw new InstallationException("Type {$attributes['value_type']} is not supported. This indicates an error in your installation, most likely caused by an incomplete upgrade."); + default : throw new InstallationException("Type {$this->attributes['value_type']} is not supported. This indicates an error in your installation, most likely caused by an incomplete upgrade."); } } - return $attributes[$name]; + return $this->attributes[$name]; } return null; } diff --git a/engine/lib/objects.php b/engine/lib/objects.php index f8a4387f3..1541c8dd5 100644 --- a/engine/lib/objects.php +++ b/engine/lib/objects.php @@ -334,7 +334,8 @@ private $attributes = array();
- function __get($name) {
+ function __get($name) { +
if (isset($this->attributes[$name])) {
return $this->attributes[$name];
}
|