Make WordPress Core

Changeset 2430


Ignore:
Timestamp:
03/11/2005 12:57:34 AM (21 years ago)
Author:
ryan
Message:

Fix do_action arg handling. http://mosquito.wordpress.org/view.php?id=901

File:
1 edited

Legend:

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

    r2421 r2430  
    898898
    899899                                if($accepted_args == 1) {
    900                                         $args = array($string);
     900                                        $the_args = array($string);
    901901                                } elseif ($accepted_args > 1) {
    902                                         $args = array_slice($all_args, 0, $accepted_args);
     902                                        $the_args = array_slice($all_args, 0, $accepted_args);
    903903                                } elseif($accepted_args == 0) {
    904                                         $args = NULL;
     904                                        $the_args = NULL;
    905905                                } else {
    906                                         $args = $all_args;
     906                                        $the_args = $all_args;
    907907                                }
    908908
    909                                 $string = call_user_func_array($function_name, $args);
     909                                $string = call_user_func_array($function_name, $the_args);
    910910                        }
    911911                }
     
    953953        global $wp_filter;
    954954        $extra_args = array_slice(func_get_args(), 2);
    955         if ( is_array($arg) )
    956                 $args = array_merge($arg, $extra_args);
     955        if ( is_array($arg) )
     956                $args = array_merge($arg, $extra_args);
    957957        else
    958958                $args = array_merge(array($arg), $extra_args);
     
    967967                        foreach($functions as $function) {
    968968
    969                                 $all_args = array_merge(array($string), $args);
    970969                                $function_name = $function['function'];
    971970                                $accepted_args = $function['accepted_args'];
    972971
    973972                                if($accepted_args == 1) {
    974                                         $args = array($string);
     973                                        if ( is_array($arg) )
     974                                                $the_args = $arg;
     975                                        else
     976                                                $the_args = array($arg);
    975977                                } elseif ($accepted_args > 1) {
    976                                         $args = array_slice($all_args, 0, $accepted_args);
     978                                        $the_args = array_slice($args, 0, $accepted_args);
    977979                                } elseif($accepted_args == 0) {
    978                                         $args = NULL;
     980                                        $the_args = NULL;
    979981                                } else {
    980                                         $args = $all_args;
     982                                        $the_args = $args;
    981983                                }
    982984
    983                                 $string = call_user_func_array($function_name, $args);
     985                                $string = call_user_func_array($function_name, $the_args);
    984986                        }
    985987                }
Note: See TracChangeset for help on using the changeset viewer.