Initialize the filter globals.

props rmccue.
fixes #25378.


git-svn-id: https://develop.svn.wordpress.org/trunk@25607 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2013-09-24 19:04:21 +00:00
parent 34e9dc9f06
commit 648af753fd

View File

@ -19,6 +19,21 @@
* @since 1.5 * @since 1.5
*/ */
// Initialize the filter globals.
global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
if ( ! isset( $wp_filter ) )
$wp_filter = array();
if ( ! isset( $wp_actions ) )
$wp_actions = array();
if ( ! isset( $merged_filters ) )
$merged_filters = array();
if ( ! isset( $wp_current_filter ) )
$wp_current_filter = array();
/** /**
* Hooks a function or method to a specific filter action. * Hooks a function or method to a specific filter action.
* *
@ -371,9 +386,6 @@ function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1)
function do_action($tag, $arg = '') { function do_action($tag, $arg = '') {
global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter; global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
if ( ! isset($wp_actions) )
$wp_actions = array();
if ( ! isset($wp_actions[$tag]) ) if ( ! isset($wp_actions[$tag]) )
$wp_actions[$tag] = 1; $wp_actions[$tag] = 1;
else else
@ -435,7 +447,7 @@ function do_action($tag, $arg = '') {
function did_action($tag) { function did_action($tag) {
global $wp_actions; global $wp_actions;
if ( ! isset( $wp_actions ) || ! isset( $wp_actions[$tag] ) ) if ( ! isset( $wp_actions[ $tag ] ) )
return 0; return 0;
return $wp_actions[$tag]; return $wp_actions[$tag];
@ -460,9 +472,6 @@ function did_action($tag) {
function do_action_ref_array($tag, $args) { function do_action_ref_array($tag, $args) {
global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter; global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
if ( ! isset($wp_actions) )
$wp_actions = array();
if ( ! isset($wp_actions[$tag]) ) if ( ! isset($wp_actions[$tag]) )
$wp_actions[$tag] = 1; $wp_actions[$tag] = 1;
else else