Specify number of accepted args.

git-svn-id: https://develop.svn.wordpress.org/trunk@4176 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2006-09-08 23:18:03 +00:00
parent bb74bd1d1b
commit 826dd2da08
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'));
}
add_action('update_option_home', 'update_home_siteurl');
add_action('update_option_siteurl', 'update_home_siteurl');
add_action('update_option_home', 'update_home_siteurl', 10, 2);
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 = '') {
global $wp_filter;
$extra_args = array_slice(func_get_args(), 2);
if ( is_array($arg) )
$args = array_merge($arg, $extra_args);
else
$args = array_merge(array($arg), $extra_args);
$args = array($arg);
for ( $a = 2; $a < func_num_args(); $a++ )
$args[] = func_get_args($a);
merge_filters($tag);
@ -121,10 +119,7 @@ function do_action($tag, $arg = '') {
$accepted_args = $function['accepted_args'];
if ( $accepted_args == 1 ) {
if ( is_array($arg) )
$the_args = $arg;
else
$the_args = array($arg);
$the_args = array($arg);
} elseif ( $accepted_args > 1 ) {
$the_args = array_slice($args, 0, $accepted_args);
} elseif ( $accepted_args == 0 ) {