summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2005-11-13 13:18:19 +0000
committerxue <>2005-11-13 13:18:19 +0000
commit24f744404ab5d148a0bfda03296baa59f7e10725 (patch)
treece2b25814719cbfc22f82ed4cc6251a394f09085
parente80556be742870dfe164d8521e3d640fa1482f7c (diff)
added support to static member event handler
-rw-r--r--framework/TComponent.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/framework/TComponent.php b/framework/TComponent.php
index a23204d5..8df1f235 100644
--- a/framework/TComponent.php
+++ b/framework/TComponent.php
@@ -342,12 +342,17 @@ class TComponent
{
// an array: 0 - object, 1 - method name/path
list($object,$method)=$handler;
- if(($pos=strrpos($method,'.'))!==false)
+ if(is_string($object)) // static method call
+ call_user_func($handler,$sender,$param);
+ else
{
- $object=$this->getSubProperty(substr($method,0,$pos));
- $method=substr($method,$pos+1);
+ if(($pos=strrpos($method,'.'))!==false)
+ {
+ $object=$this->getSubProperty(substr($method,0,$pos));
+ $method=substr($method,$pos+1);
+ }
+ $object->$method($sender,$param);
}
- $object->$method($sender,$param);
}
else
throw new TInvalidDataValueException('component_event_handler_invalid',$handler);