From c0c3167621814c587ebcc69a7593086de1f6b0c0 Mon Sep 17 00:00:00 2001 From: Peter Westwood Date: Thu, 28 Oct 2010 11:48:22 +0000 Subject: [PATCH] Missing part of the admin bar rework. See #14772 props filosofo. git-svn-id: https://develop.svn.wordpress.org/trunk@16043 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/functions.php | 36 ++++++++---------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index b35e74dd49..795ec89933 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -4404,37 +4404,17 @@ function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = ar } /** - * Retrieve or set the admin bar display state. + * Set the display status of the admin bar * * This can be called immediately upon plugin load. It does not need to be called from a function hooked to the init action. * - * @param bool $show Optional. True to show the admin bar, false to hide it. If not provided the current display state is returned. - * @return bool The current display state if $show is not provided, the previous disply state if $show is provided. - * * @since 3.1.0 + * + * @param bool $show Whether to allow the admin bar to show. + * @return void */ -function show_admin_bar( $show = null ) { - static $show_admin_bar = null; - - if ( !isset($show_admin_bar) ) { - if ( null !== $show ) - $show_admin_bar = $show; - elseif ( defined('WP_SHOW_ADMIN_BAR') ) - $show_admin_bar = WP_SHOW_ADMIN_BAR; - else - $show_admin_bar = true; - } - - if ( null === $show ) { - return $show_admin_bar; - } else { - $old_value = $show_admin_bar; - $show_admin_bar = $show; - - // Prevent rendering if already initiated. - if ( ! $show_admin_bar && isset( $GLOBALS['wp_admin_bar'] ) ) - $GLOBALS['wp_admin_bar'] = null; - - return $old_value; - } +function show_admin_bar( $show ) { + global $show_admin_bar; + $show_admin_bar = (bool) $show; } +