Make WordPress Core

Changeset 16043


Ignore:
Timestamp:
10/28/2010 11:48:22 AM (13 years ago)
Author:
westi
Message:

Missing part of the admin bar rework. See #14772 props filosofo.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r16031 r16043  
    44054405
    44064406/**
    4407  * Retrieve or set the admin bar display state.
     4407 * Set the display status of the admin bar
    44084408 *
    44094409 * This can be called immediately upon plugin load.  It does not need to be called from a function hooked to the init action.
    44104410 *
    4411  * @param bool $show Optional. True to show the admin bar, false to hide it. If not provided the current display state is returned.
    4412  * @return bool The current display state if $show is not provided, the previous disply state if $show is provided.
    4413  *
    44144411 * @since 3.1.0
    4415  */
    4416 function show_admin_bar( $show = null ) {
    4417     static $show_admin_bar = null;
    4418 
    4419     if ( !isset($show_admin_bar) ) {
    4420         if ( null !== $show )
    4421             $show_admin_bar = $show;
    4422         elseif ( defined('WP_SHOW_ADMIN_BAR') )
    4423             $show_admin_bar = WP_SHOW_ADMIN_BAR;
    4424         else
    4425             $show_admin_bar = true;
    4426     }
    4427 
    4428     if ( null === $show ) {
    4429         return $show_admin_bar;
    4430     } else {
    4431         $old_value = $show_admin_bar;
    4432         $show_admin_bar = $show;
    4433 
    4434         // Prevent rendering if already initiated.
    4435         if ( ! $show_admin_bar && isset( $GLOBALS['wp_admin_bar'] ) )
    4436             $GLOBALS['wp_admin_bar'] = null;
    4437 
    4438         return $old_value;
    4439     }
    4440 }
     4412 *
     4413 * @param bool $show Whether to allow the admin bar to show.
     4414 * @return void
     4415 */
     4416function show_admin_bar( $show ) {
     4417    global $show_admin_bar;
     4418    $show_admin_bar = (bool) $show;
     4419}
     4420
Note: See TracChangeset for help on using the changeset viewer.