From 7119110439615a0cd03b96530e2b819ba5f2d870 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 7 Oct 2010 20:12:49 +0000 Subject: [PATCH] Unset global variables when they are no longer needed. git-svn-id: http://svn.automattic.com/wordpress/trunk@15747 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/menu.php | 10 +++++----- wp-includes/default-filters.php | 2 ++ wp-includes/ms-settings.php | 1 + wp-includes/vars.php | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/wp-admin/menu.php b/wp-admin/menu.php index 7d92deca95..0948201aff 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -22,9 +22,6 @@ * @var array */ -$awaiting_mod = wp_count_comments(); -$awaiting_mod = $awaiting_mod->moderated; - $menu[2] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'div' ); if ( is_multisite() || is_super_admin() ) { @@ -57,7 +54,7 @@ if ( is_multisite() || is_super_admin() ) { $update_title = !empty($update_title) ? esc_attr(implode(', ', $update_title)) : ''; $submenu[ 'index.php' ][10] = array( sprintf( __('Updates %s'), "" . number_format_i18n($update_count) . "" ), 'install_plugins', 'update-core.php'); - unset($plugin_update_count, $theme_update_count, $wordpress_update_count, $update_count, $update_title); + unset($plugin_update_count, $theme_update_count, $wordpress_update_count, $update_count, $update_title, $update_themes, $update_plugins, $update_wordpress); } } @@ -101,7 +98,10 @@ $menu[20] = array( __('Pages'), 'edit_pages', 'edit.php?post_type=page', '', 'me } unset($tax); +$awaiting_mod = wp_count_comments(); +$awaiting_mod = $awaiting_mod->moderated; $menu[25] = array( sprintf( __('Comments %s'), "" . number_format_i18n($awaiting_mod) . "" ), 'edit_posts', 'edit-comments.php', '', 'menu-top menu-icon-comments', 'menu-comments', 'div' ); +unset($awaiting_mod); $_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group @@ -134,7 +134,7 @@ foreach ( (array) get_post_types( array('show_ui' => true, '_builtin' => false) $submenu["edit.php?post_type=$ptype"][$i++] = array( esc_attr( $tax->labels->name ), $tax->cap->manage_terms, "edit-tags.php?taxonomy=$tax->name&post_type=$ptype" ); } } -unset($ptype, $ptype_obj); +unset($ptype, $ptype_obj, $ptype_class, $ptype_for_id, $ptype_menu_position, $menu_icon, $i); $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' ); diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 698280c1cc..a47f686425 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -261,4 +261,6 @@ add_filter( 'pre_option_gmt_offset','wp_timezone_override_offset' ); add_action( 'admin_init', 'register_admin_color_schemes', 1); add_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' ); +unset($filter, $action); + ?> diff --git a/wp-includes/ms-settings.php b/wp-includes/ms-settings.php index 14862f9e16..43724621a9 100644 --- a/wp-includes/ms-settings.php +++ b/wp-includes/ms-settings.php @@ -78,6 +78,7 @@ if ( !isset( $current_site ) || !isset( $current_blog ) ) { if ( $current_blog ) wp_cache_set( 'current_blog_' . $domain . $path, $current_blog, 'site-options' ); } + unset($reserved_blognames); } if ( ! defined( 'WP_INSTALLING' ) && is_subdomain_install() && ! is_object( $current_blog ) ) { diff --git a/wp-includes/vars.php b/wp-includes/vars.php index 67d8d70d48..2ac305b95c 100644 --- a/wp-includes/vars.php +++ b/wp-includes/vars.php @@ -38,6 +38,7 @@ if ( is_admin() ) { else $pagenow = 'index.php'; } +unset($self_matches); // Simple browser detection $is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = $is_chrome = $is_iphone = false;