Specify number of accepted args.

git-svn-id: http://svn.automattic.com/wordpress/trunk@4176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-09-08 23:18:03 +00:00
parent 5898bcca41
commit 9e240a859f
2 changed files with 6 additions and 11 deletions

View File

@ -2075,7 +2075,7 @@ function update_home_siteurl($old_value, $value) {
wp_setcookie($user_login, $user_pass_md5, true, get_option('home'), get_option('siteurl')); wp_setcookie($user_login, $user_pass_md5, true, get_option('home'), get_option('siteurl'));
} }
add_action('update_option_home', 'update_home_siteurl'); add_action('update_option_home', 'update_home_siteurl', 10, 2);
add_action('update_option_siteurl', 'update_home_siteurl'); add_action('update_option_siteurl', 'update_home_siteurl', 10, 2);
?> ?>

View File

@ -102,11 +102,9 @@ function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1)
function do_action($tag, $arg = '') { function do_action($tag, $arg = '') {
global $wp_filter; global $wp_filter;
$extra_args = array_slice(func_get_args(), 2); $args = array($arg);
if ( is_array($arg) ) for ( $a = 2; $a < func_num_args(); $a++ )
$args = array_merge($arg, $extra_args); $args[] = func_get_args($a);
else
$args = array_merge(array($arg), $extra_args);
merge_filters($tag); merge_filters($tag);
@ -121,10 +119,7 @@ function do_action($tag, $arg = '') {
$accepted_args = $function['accepted_args']; $accepted_args = $function['accepted_args'];
if ( $accepted_args == 1 ) { if ( $accepted_args == 1 ) {
if ( is_array($arg) ) $the_args = array($arg);
$the_args = $arg;
else
$the_args = array($arg);
} elseif ( $accepted_args > 1 ) { } elseif ( $accepted_args > 1 ) {
$the_args = array_slice($args, 0, $accepted_args); $the_args = array_slice($args, 0, $accepted_args);
} elseif ( $accepted_args == 0 ) { } elseif ( $accepted_args == 0 ) {