From bb1e6055fe18618f9274e2d23d4b1e72b7243797 Mon Sep 17 00:00:00 2001 From: donncha Date: Wed, 13 Sep 2006 09:27:15 +0000 Subject: WP Merge to rev 4186 git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@744 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-includes/plugin.php | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'wp-includes/plugin.php') diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php index 1fe2c80..365a6f8 100644 --- a/wp-includes/plugin.php +++ b/wp-includes/plugin.php @@ -111,9 +111,37 @@ function do_action($tag, $arg = '') { merge_filters($tag); - if ( !isset($wp_filter[$tag]) ) { + if ( !isset($wp_filter[$tag]) ) return; + + foreach ($wp_filter[$tag] as $priority => $functions) { + if ( !is_null($functions) ) { + foreach($functions as $function) { + + $function_name = $function['function']; + $accepted_args = $function['accepted_args']; + + if ( $accepted_args > 0 ) + $the_args = array_slice($args, 0, $accepted_args); + elseif ( $accepted_args == 0 ) + $the_args = NULL; + else + $the_args = $args; + + call_user_func_array($function_name, $the_args); + } + } } +} + +function do_action_ref_array($tag, $args) { + global $wp_filter; + + merge_filters($tag); + + if ( !isset($wp_filter[$tag]) ) + return; + foreach ($wp_filter[$tag] as $priority => $functions) { if ( !is_null($functions) ) { foreach($functions as $function) { @@ -128,7 +156,7 @@ function do_action($tag, $arg = '') { else $the_args = $args; - $string = call_user_func_array($function_name, $the_args); + call_user_func_array($function_name, $the_args); } } } -- cgit