Make WordPress Core


Ignore:
Timestamp:
09/12/2006 05:45:23 PM (18 years ago)
Author:
ryan
Message:

do_action_ref_array(). fixes #3125

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/plugin.php

    r4179 r4186  
    112112    merge_filters($tag);
    113113
    114     if ( !isset($wp_filter[$tag]) ) {
     114    if ( !isset($wp_filter[$tag]) )
    115115        return;
    116     }
     116
    117117    foreach ($wp_filter[$tag] as $priority => $functions) {
    118118        if ( !is_null($functions) ) {
     
    129129                    $the_args = $args;
    130130
    131                 $string = call_user_func_array($function_name, $the_args);
     131                call_user_func_array($function_name, $the_args);
     132            }
     133        }
     134    }
     135}
     136
     137function do_action_ref_array($tag, $args) {
     138    global $wp_filter;
     139
     140    merge_filters($tag);
     141
     142    if ( !isset($wp_filter[$tag]) )
     143        return;
     144
     145    foreach ($wp_filter[$tag] as $priority => $functions) {
     146        if ( !is_null($functions) ) {
     147            foreach($functions as $function) {
     148
     149                $function_name = $function['function'];
     150                $accepted_args = $function['accepted_args'];
     151
     152                if ( $accepted_args > 0 )
     153                    $the_args = array_slice($args, 0, $accepted_args);
     154                elseif ( $accepted_args == 0 )
     155                    $the_args = NULL;
     156                else
     157                    $the_args = $args;
     158
     159                call_user_func_array($function_name, $the_args);
    132160            }
    133161        }
Note: See TracChangeset for help on using the changeset viewer.