Changeset 27294 for trunk/src/wp-includes/plugin.php
- Timestamp:
- 02/26/2014 06:43:59 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/plugin.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/plugin.php
r27262 r27294 323 323 global $wp_current_filter; 324 324 return end( $wp_current_filter ); 325 } 326 327 /** 328 * Retrieve the name of the current action. 329 * 330 * @since 3.9.0 331 * @uses current_filter() 332 * 333 * @return string Hook name of the current action. 334 */ 335 function current_action() { 336 return current_filter(); 337 } 338 339 /** 340 * Retrieve the name of a filter currently being processed. 341 * 342 * The function current_filter() only returns the most recent filter or action 343 * being executed. did_action() returns true once the action is initially 344 * processed. This function allows detection for any filter currently being 345 * executed (despite not being the most recent filter to fire, in the case of 346 * hooks called from hook callbacks) to be verified. 347 * 348 * @since 3.9.0 349 * @see current_filter() 350 * @see did_action() 351 * 352 * @param string $filter Optional. Filter to check. Defaults to null, which checks if any filter is currently being run. 353 * 354 * @global array $wp_current_filter 355 * 356 * @return bool Whether the filter is currently in the stack 357 */ 358 function doing_filter( $filter = null ) { 359 global $wp_current_filter; 360 361 if ( null === $filter ) { 362 return ! empty( $wp_current_filter ); 363 } 364 365 return in_array( $filter, $wp_current_filter ); 366 } 367 368 /** 369 * Retrieve the name of an action currently being processed. 370 * 371 * @since 3.9.0 372 * @uses doing_filter() 373 * 374 * @param string $action Optional. Action to check. Defaults to null, which checks if any action is currently being run. 375 * 376 * @return bool Whether the action is currently in the stack. 377 */ 378 function doing_action( $action = null ) { 379 return doing_filter( $action ); 325 380 } 326 381
Note: See TracChangeset
for help on using the changeset viewer.