From 9dcd0110fb23b72ac4715ec1b527ba66db6ca7e4 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Tue, 24 Sep 2013 19:05:10 +0000 Subject: [PATCH] Initialize the filter globals. props rmccue. fixes #25378. Built from https://develop.svn.wordpress.org/trunk@25607 git-svn-id: http://core.svn.wordpress.org/trunk@25524 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/plugin.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php index 03c4ac36fb..df4ba8d33e 100644 --- a/wp-includes/plugin.php +++ b/wp-includes/plugin.php @@ -19,6 +19,21 @@ * @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. * @@ -371,9 +386,6 @@ function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) function do_action($tag, $arg = '') { global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter; - if ( ! isset($wp_actions) ) - $wp_actions = array(); - if ( ! isset($wp_actions[$tag]) ) $wp_actions[$tag] = 1; else @@ -435,7 +447,7 @@ function do_action($tag, $arg = '') { function did_action($tag) { global $wp_actions; - if ( ! isset( $wp_actions ) || ! isset( $wp_actions[$tag] ) ) + if ( ! isset( $wp_actions[ $tag ] ) ) return 0; return $wp_actions[$tag]; @@ -460,9 +472,6 @@ function did_action($tag) { function do_action_ref_array($tag, $args) { global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter; - if ( ! isset($wp_actions) ) - $wp_actions = array(); - if ( ! isset($wp_actions[$tag]) ) $wp_actions[$tag] = 1; else