Make WordPress Core

Changeset 4186


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

do_action_ref_array(). fixes #3125

Location:
trunk
Files:
7 edited

Legend:

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

    r4182 r4186  
    476476
    477477        /* checking the password has been typed twice */
    478         do_action('check_passwords', array ($user->user_login, & $pass1, & $pass2));
     478        do_action_ref_array('check_passwords', array ($user->user_login, & $pass1, & $pass2));
    479479
    480480        if (!$update) {
  • trunk/wp-includes/classes.php

    r4165 r4186  
    229229                $this->query_vars = apply_filters('request', $this->query_vars);
    230230
    231                 do_action('parse_request', array(&$this));
     231                do_action_ref_array('parse_request', array(&$this));
    232232        }
    233233
    … …  
    271271                }
    272272
    273                 do_action('send_headers', array(&$this));
     273                do_action_ref_array('send_headers', array(&$this));
    274274        }
    275275
    … …  
    339339                $this->handle_404();
    340340                $this->register_globals();
    341                 do_action('wp', array(&$this));
     341                do_action_ref_array('wp', array(&$this));
    342342        }
    343343
  • trunk/wp-includes/comment.php

    r4144 r4186  
    696696        endforeach;
    697697
    698         do_action('pre_ping',  array(&$post_links, &$pung));
     698        do_action_ref_array('pre_ping',  array(&$post_links, &$pung));
    699699
    700700        foreach ($post_links as $pagelinkedto){
  • 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                }
  • trunk/wp-includes/query.php

    r4144 r4186  
    351351                        $this->is_404 = true;
    352352                        if ( !empty($query) ) {
    353                                 do_action('parse_query', array(&$this));
     353                                do_action_ref_array('parse_query', array(&$this));
    354354                        }
    355355                        return;
    … …  
    499499
    500500                if ( !empty($query) ) {
    501                         do_action('parse_query', array(&$this));
     501                        do_action_ref_array('parse_query', array(&$this));
    502502                }
    503503        }
    … …  
    527527                global $wpdb, $pagenow, $user_ID;
    528528
    529                 do_action('pre_get_posts', array(&$this));
     529                do_action_ref_array('pre_get_posts', array(&$this));
    530530
    531531                // Shorthand.
  • trunk/wp-includes/rewrite.php

    r4144 r4186  
    736736                $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);
    737737
    738                 do_action('generate_rewrite_rules', array(&$this));
     738                do_action_ref_array('generate_rewrite_rules', array(&$this));
    739739                $this->rules = apply_filters('rewrite_rules_array', $this->rules);
    740740
  • trunk/wp-login.php

    r4144 r4186  
    189189        }
    190190
    191         do_action('wp_authenticate', array(&$user_login, &$user_pass));
     191        do_action_ref_array('wp_authenticate', array(&$user_login, &$user_pass));
    192192
    193193        if ( $user_login && $user_pass ) {
Note: See TracChangeset for help on using the changeset viewer.