diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2006-10-11 20:21:25 +0000 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2006-10-11 20:21:25 +0000 |
commit | d81f562b712f2387fa02290bf2ca86392ab356f2 (patch) | |
tree | d666cdefbe6ac320827a2c6cb473581b46e22c4c /includes/Hooks.php | |
parent | 183851b06bd6c52f3cae5375f433da720d410447 (diff) |
Aktualisierung auf Version 1.8.1
Diffstat (limited to 'includes/Hooks.php')
-rw-r--r-- | includes/Hooks.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/includes/Hooks.php b/includes/Hooks.php index 4daffaf3..575a28c5 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -64,7 +64,7 @@ function wfRunHooks($event, $args = null) { if (count($hook) < 1) { throw new MWException("Empty array in hooks for " . $event . "\n"); } else if (is_object($hook[0])) { - $object =& $wgHooks[$event][$index][0]; + $object = $wgHooks[$event][$index][0]; if (count($hook) < 2) { $method = "on" . $event; } else { @@ -87,7 +87,7 @@ function wfRunHooks($event, $args = null) { } else if (is_string($hook)) { # functions look like strings, too $func = $hook; } else if (is_object($hook)) { - $object =& $wgHooks[$event][$index]; + $object = $wgHooks[$event][$index]; $method = "on" . $event; } else { throw new MWException("Unknown datatype in hooks for " . $event . "\n"); @@ -101,18 +101,18 @@ function wfRunHooks($event, $args = null) { $hook_args = $args; } - if ( isset( $object ) ) { $func = get_class( $object ) . '::' . $method; + $callback = array( $object, $method ); + } elseif ( false !== ( $pos = strpos( '::', $func ) ) ) { + $callback = array( substr( $func, 0, $pos ), substr( $func, $pos + 2 ) ); + } else { + $callback = $func; } /* Call the hook. */ wfProfileIn( $func ); - if( isset( $object ) ) { - $retval = call_user_func_array(array(&$object, $method), $hook_args); - } else { - $retval = call_user_func_array($func, $hook_args); - } + $retval = call_user_func_array( $callback, $hook_args ); wfProfileOut( $func ); /* String return is an error; false return means stop processing. */ |