diff options
| author | Meik Sievertsen <acydburn@phpbb.com> | 2009-01-13 17:07:55 +0000 |
|---|---|---|
| committer | Meik Sievertsen <acydburn@phpbb.com> | 2009-01-13 17:07:55 +0000 |
| commit | fde2671cfabc2558260691f4d6c91c2e277cba6a (patch) | |
| tree | 3198b98f6b216e992ac75a7daa99a0c72fa3e0b8 /phpBB | |
| parent | 7e60f634b432393997ece9b35a16116f2e5433ca (diff) | |
| download | forums-fde2671cfabc2558260691f4d6c91c2e277cba6a.tar forums-fde2671cfabc2558260691f4d6c91c2e277cba6a.tar.gz forums-fde2671cfabc2558260691f4d6c91c2e277cba6a.tar.bz2 forums-fde2671cfabc2558260691f4d6c91c2e277cba6a.tar.xz forums-fde2671cfabc2558260691f4d6c91c2e277cba6a.zip | |
allow setter/getter for own attributes in plugins
git-svn-id: file:///svn/phpbb/trunk@9255 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
| -rw-r--r-- | phpBB/plugins/bootstrap.php | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/phpBB/plugins/bootstrap.php b/phpBB/plugins/bootstrap.php index f8a7d3761a..dd10d420ca 100644 --- a/phpBB/plugins/bootstrap.php +++ b/phpBB/plugins/bootstrap.php @@ -544,22 +544,42 @@ abstract class phpbb_plugin_support */ public function __get($name) { - return $this->plugin_attributes[$name]->$name; + if (isset($this->plugin_attributes[$name])) + { + return $this->plugin_attributes[$name]->$name; + } + + return $this->$name; } public function __set($name, $value) { - return $this->plugin_attributes[$name]->$name = $value; + if (isset($this->plugin_attributes[$name])) + { + return $this->plugin_attributes[$name]->$name = $value; + } + + return $this->$name = $value; } public function __isset($name) { - return isset($this->plugin_attributes[$name]->$name); + if (isset($this->plugin_attributes[$name])) + { + return isset($this->plugin_attributes[$name]->$name); + } + + return isset($this->$name); } public function __unset($name) { - unset($this->plugin_attributes[$name]->$name); + if (isset($this->plugin_attributes[$name])) + { + unset($this->plugin_attributes[$name]->$name); + } + + unset($this->$name); } /**#@-*/ @@ -569,8 +589,13 @@ abstract class phpbb_plugin_support */ public function __call($name, $arguments) { - array_unshift($arguments, $this); - return call_user_func_array(array($this->plugin_methods[$name], $name), $arguments); + if (isset($this->plugin_methods[$name]) && !is_array($this->plugin_methods[$name])) + { + array_unshift($arguments, $this); + return call_user_func_array(array($this->plugin_methods[$name], $name), $arguments); + } + + trigger_error('Call to undefined method ' . $name . '() in ' . get_class($this) . '.', E_USER_ERROR); } /** |
