summaryrefslogtreecommitdiff
path: root/includes/Hooks.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/Hooks.php')
-rw-r--r--includes/Hooks.php16
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. */