From abe8b4735168cc86878898fbf53017bfa7027bc4 Mon Sep 17 00:00:00 2001 From: nbachiyski Date: Thu, 11 Aug 2011 04:45:14 +0000 Subject: [PATCH] Explicitly globalize some variables, so that unit tests can run WordPress inside a function. Fixes #17749 git-svn-id: http://svn.automattic.com/wordpress/trunk@18532 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/media.php | 2 +- wp-includes/widgets.php | 2 +- wp-settings.php | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-includes/media.php b/wp-includes/media.php index f4e60d00d8..03e4cb0ac0 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -1288,7 +1288,7 @@ class WP_Embed { return apply_filters( 'embed_maybe_make_link', $output, $url ); } } -$wp_embed = new WP_Embed(); +$GLOBALS['wp_embed'] = new WP_Embed(); /** * Register an embed handler. This function should probably only be used for sites that do not support oEmbed. diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index b90ffd6753..084ccd9702 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -385,7 +385,7 @@ $_wp_sidebars_widgets = array(); /** * Private */ - $_wp_deprecated_widgets_callbacks = array( + $GLOBALS['_wp_deprecated_widgets_callbacks'] = array( 'wp_widget_pages', 'wp_widget_pages_control', 'wp_widget_calendar', diff --git a/wp-settings.php b/wp-settings.php index 06af3dd3ce..45bb8994d3 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -104,6 +104,7 @@ require( ABSPATH . WPINC . '/l10n.php' ); // Run the installer if WordPress is not installed. wp_not_installed(); + // Load most of WordPress. require( ABSPATH . WPINC . '/class-wp-walker.php' ); require( ABSPATH . WPINC . '/class-wp-ajax-response.php' ); @@ -249,7 +250,7 @@ $wp = new WP(); * @global object $wp_widget_factory * @since 2.8.0 */ -$wp_widget_factory = new WP_Widget_Factory(); +$GLOBALS['wp_widget_factory'] = new WP_Widget_Factory(); do_action( 'setup_theme' );