Changeset 6320
- Timestamp:
- 11/07/2007 04:30:11 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/plugin.php
r6259 r6320 330 330 331 331 function get_plugin_page_hook( $plugin_page, $parent_page ) { 332 global $wp_filter;333 334 332 $hook = get_plugin_page_hookname( $plugin_page, $parent_page ); 335 if ( isset( $wp_filter[$hook] ))333 if ( has_action($hook) ) 336 334 return $hook; 337 335 else -
trunk/wp-includes/classes.php
r6303 r6320 239 239 240 240 // query_string filter deprecated. Use request filter instead. 241 global $wp_filter; 242 if ( isset($wp_filter['query_string']) ) { // Don't bother filtering and parsing if no plugins are hooked in. 241 if ( has_filter('query_string') ) { // Don't bother filtering and parsing if no plugins are hooked in. 243 242 $this->query_string = apply_filters('query_string', $this->query_string); 244 243 parse_str($this->query_string, $this->query_vars); -
trunk/wp-includes/plugin.php
r6319 r6320 80 80 81 81 /** 82 * Check if any filter has been registered for a hook. Optionally returns the priority on that hook for the specified function. 83 * @package WordPress 84 * @subpackage Plugin 85 * @since 2.4 86 * @global array $wp_filter Stores all of the filters 87 * 88 * @param string $tag The name of the filter hook. 89 * @param callback $function_to_check optional. If specified, return the priority of that function on this hook or false if not attached. 90 * @return int|boolean 91 */ 92 function has_filter($tag, $function_to_check = false) { 93 global $wp_filter; 94 95 $has = !empty($wp_filter[$tag]); 96 if ( false === $function_to_check || false == $has ) 97 return $has; 98 99 if ( !$idx = _wp_filter_build_unique_id($tag, $function_to_check, false, 'filter') ) 100 return false; 101 102 foreach ( array_keys($wp_filter[$tag]) as $priority ) { 103 if ( isset($wp_filter[$tag][$priority][$idx]) ) 104 return $priority; 105 } 106 107 return false; 108 } 109 110 /** 82 111 * Call the functions added to a filter hook. 83 112 * … … 181 210 if ( true === $r) { 182 211 unset($GLOBALS['wp_filter'][$tag][$priority][$function_to_remove]); 212 if ( empty($GLOBALS['wp_filter'][$tag][$priority]) ) 213 unset($GLOBALS['wp_filter'][$tag][$priority]); 183 214 unset($GLOBALS['merged_filters'][$tag]); 184 215 } … … 326 357 * the functions hooked to <tt>$tag</tt> are supplied using an array. 327 358 * 328 * @uses merge_filters()329 *330 359 * @package WordPress 331 360 * @subpackage Plugin … … 378 407 379 408 /** 409 * Check if any action has been registered for a hook. Optionally returns the priority on that hook for the specified function. 410 * @package WordPress 411 * @subpackage Plugin 412 * @since 2.4 413 * @global array $wp_action Stores all of the actions 414 * 415 * @param string $tag The name of the action hook. 416 * @param callback $function_to_check optional. If specified, return the priority of that function on this hook or false if not attached. 417 * @return int|boolean 418 */ 419 function has_action($tag, $function_to_check = false) { 420 global $wp_action; 421 422 $has = !empty($wp_action[$tag]); 423 if ( false === $function_to_check || false == $has ) 424 return $has; 425 426 if ( !$idx = _wp_filter_build_unique_id($tag, $function_to_check, false, 'action') ) 427 return false; 428 429 foreach ( array_keys($wp_action[$tag]) as $priority ) { 430 if ( isset($wp_action[$tag][$priority][$idx]) ) 431 return $priority; 432 } 433 434 return false; 435 } 436 437 /** 380 438 * Removes a function from a specified action hook. 381 439 * … … 383 441 * method can be used to remove default functions attached to a specific filter 384 442 * hook and possibly replace them with a substitute. 385 *386 * @uses remove_filter() Uses remove_filter to remove actions added.387 443 * 388 444 * @package WordPress … … 403 459 if ( true === $r) { 404 460 unset($GLOBALS['wp_action'][$tag][$priority][$function_to_remove]); 461 if ( empty($GLOBALS['wp_action'][$tag][$priority]) ) 462 unset($GLOBALS['wp_action'][$tag][$priority]); 405 463 unset($GLOBALS['merged_actions'][$tag]); 406 464 } … … 514 572 * @param string $tag Used in counting how many hooks were applied 515 573 * @param string|array $function Used for creating unique id 516 * @param int $priority Used in counting how many hooks were applied574 * @param int|bool $priority Used in counting how many hooks were applied. If === false and $function is an object reference, we return the unique id only if it already has one, false otherwise. 517 575 * @param string $type filter or action 518 576 * @return string Unique ID for usage as array key … … 529 587 $obj_idx = get_class($function[0]).$function[1]; 530 588 if ( !isset($function[0]->wp_filter_id) ) { 589 if ( false === $priority ) 590 return false; 531 591 if ( 'filter' == $type ) 532 592 $count = count((array)$wp_filter[$tag][$priority]); -
trunk/wp-settings.php
r6299 r6320 21 21 wp_unregister_GLOBALS(); 22 22 23 unset( $wp_filter, $ cache_lastcommentmodified, $cache_lastpostdate );23 unset( $wp_filter, $wp_action, $cache_lastcommentmodified, $cache_lastpostdate ); 24 24 25 25 if ( ! isset($blog_id) )
Note: See TracChangeset
for help on using the changeset viewer.