Changeset 5408

Show
Ignore:
Timestamp:
05/07/07 23:22:28 (2 years ago)
Author:
ryan
Message:

Fix did_action to properly account for actions that have no callbacks attached.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2.2/wp-includes/plugin.php

    r5202 r5408  
    137137    global $wp_filter, $wp_actions; 
    138138 
     139    if ( is_array($wp_actions) ) 
     140        $wp_actions[] = $tag; 
     141    else 
     142        $wp_actions = array($tag); 
     143 
    139144    $args = array(); 
    140145    if ( is_array($arg) && 1 == count($arg) && is_object($arg[0]) ) // array(&$this) 
     
    157162    } while ( next($wp_filter[$tag]) ); 
    158163 
    159     if ( is_array($wp_actions) ) 
    160         $wp_actions[] = $tag; 
    161     else 
    162         $wp_actions = array($tag); 
    163 
    164  
    165 /** 
    166  * Return the number of functions hooked to a specific action hook. 
     164
     165 
     166/** 
     167 * Return the number times an action is fired. 
    167168 * @param string $tag The name of the action hook. 
    168  * @return int The number of functions hooked to action hook <tt>$tag</tt> 
     169 * @return int The number of times action hook <tt>$tag</tt> is fired 
    169170 */ 
    170171function did_action($tag) {