do_action_ref_array(). fixes #3125

git-svn-id: https://develop.svn.wordpress.org/trunk@4186 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2006-09-12 17:45:23 +00:00
parent 3b731473ec
commit 7d25a72195
7 changed files with 41 additions and 13 deletions

View File

@ -475,7 +475,7 @@ function edit_user($user_id = 0) {
$errors->add('user_login', __('<strong>ERROR</strong>: Please enter a username.'));
/* checking the password has been typed twice */
do_action('check_passwords', array ($user->user_login, & $pass1, & $pass2));
do_action_ref_array('check_passwords', array ($user->user_login, & $pass1, & $pass2));
if (!$update) {
if ($pass1 == '' || $pass2 == '')

View File

@ -228,7 +228,7 @@ class WP {
$this->query_vars = apply_filters('request', $this->query_vars);
do_action('parse_request', array(&$this));
do_action_ref_array('parse_request', array(&$this));
}
function send_headers() {
@ -270,7 +270,7 @@ class WP {
}
}
do_action('send_headers', array(&$this));
do_action_ref_array('send_headers', array(&$this));
}
function build_query_string() {
@ -338,7 +338,7 @@ class WP {
$this->query_posts();
$this->handle_404();
$this->register_globals();
do_action('wp', array(&$this));
do_action_ref_array('wp', array(&$this));
}
function WP() {

View File

@ -695,7 +695,7 @@ function pingback($content, $post_ID) {
endif;
endforeach;
do_action('pre_ping', array(&$post_links, &$pung));
do_action_ref_array('pre_ping', array(&$post_links, &$pung));
foreach ($post_links as $pagelinkedto){
debug_fwrite($log, "Processing -- $pagelinkedto\n");

View File

@ -111,9 +111,9 @@ 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) {
@ -128,7 +128,35 @@ 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);
}
}
}
}
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) {
$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);
}
}
}

View File

@ -350,7 +350,7 @@ class WP_Query {
if ('404' == $qv['error']) {
$this->is_404 = true;
if ( !empty($query) ) {
do_action('parse_query', array(&$this));
do_action_ref_array('parse_query', array(&$this));
}
return;
}
@ -498,7 +498,7 @@ class WP_Query {
}
if ( !empty($query) ) {
do_action('parse_query', array(&$this));
do_action_ref_array('parse_query', array(&$this));
}
}
@ -526,7 +526,7 @@ class WP_Query {
function &get_posts() {
global $wpdb, $pagenow, $user_ID;
do_action('pre_get_posts', array(&$this));
do_action_ref_array('pre_get_posts', array(&$this));
// Shorthand.
$q = &$this->query_vars;

View File

@ -735,7 +735,7 @@ class WP_Rewrite {
// Put them together.
$this->rules = array_merge($robots_rewrite, $page_rewrite, $root_rewrite, $comments_rewrite, $search_rewrite, $category_rewrite, $author_rewrite, $date_rewrite, $post_rewrite, $this->extra_rules);
do_action('generate_rewrite_rules', array(&$this));
do_action_ref_array('generate_rewrite_rules', array(&$this));
$this->rules = apply_filters('rewrite_rules_array', $this->rules);
return $this->rules;

View File

@ -188,7 +188,7 @@ default:
}
}
do_action('wp_authenticate', array(&$user_login, &$user_pass));
do_action_ref_array('wp_authenticate', array(&$user_login, &$user_pass));
if ( $user_login && $user_pass ) {
$user = new WP_User(0, $user_login);