Changeset 5409

Show
Ignore:
Timestamp:
05/07/07 23:22:50 (1 year 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
  • trunk/wp-includes/plugin.php

    r5393 r5409  
    139139    global $wp_filter, $wp_actions; 
    140140 
     141    if ( is_array($wp_actions) ) 
     142        $wp_actions[] = $tag; 
     143    else 
     144        $wp_actions = array($tag); 
     145 
    141146    $args = array(); 
    142147    if ( is_array($arg) && 1 == count($arg) && is_object($arg[0]) ) // array(&$this) 
     
    159164    } while ( next($wp_filter[$tag]) ); 
    160165 
    161     if ( is_array($wp_actions) ) 
    162         $wp_actions[] = $tag; 
    163     else 
    164         $wp_actions = array($tag); 
    165 
    166  
    167 /** 
    168  * Return the number of functions hooked to a specific action hook. 
     166
     167 
     168/** 
     169 * Return the number times an action is fired. 
    169170 * @param string $tag The name of the action hook. 
    170  * @return int The number of functions hooked to action hook <tt>$tag</tt> 
     171 * @return int The number of times action hook <tt>$tag</tt> is fired 
    171172 */ 
    172173function did_action($tag) {