From d81f562b712f2387fa02290bf2ca86392ab356f2 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 11 Oct 2006 20:21:25 +0000 Subject: Aktualisierung auf Version 1.8.1 --- includes/Hooks.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'includes/Hooks.php') 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. */ -- cgit v1.2.3-54-g00ecf