Make WordPress Core

Ticket #25508: 25508.3.diff

File 25508.3.diff, 2.4 KB (added by DrewAPicture, 11 years ago)

Clean up

  • src/wp-includes/admin-bar.php

     
    2525        require( ABSPATH . WPINC . '/class-wp-admin-bar.php' );
    2626
    2727        /* Instantiate the admin bar */
     28
     29        /**
     30         * Filter the admin bar class to instantiate.
     31         *
     32         * @since 3.1.0
     33         *
     34         * @param string $wp_admin_bar_class Admin bar class to use. Default 'WP_Admin_Bar'.
     35         */
    2836        $admin_bar_class = apply_filters( 'wp_admin_bar_class', 'WP_Admin_Bar' );
    2937        if ( class_exists( $admin_bar_class ) )
    3038                $wp_admin_bar = new $admin_bar_class;
     
    5765        if ( ! is_admin_bar_showing() || ! is_object( $wp_admin_bar ) )
    5866                return false;
    5967
     68        /**
     69         * Load all necessary admin bar items.
     70         *
     71         * This is the hook used to add, remove, or manipulate admin bar items.
     72         *
     73         * @since 3.1.0
     74         *
     75         * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference
     76         */
    6077        do_action_ref_array( 'admin_bar_menu', array( &$wp_admin_bar ) );
    6178
     79        /**
     80         * Fires before the admin bar is rendered.
     81         *
     82         * @since 3.1.0
     83         */
    6284        do_action( 'wp_before_admin_bar_render' );
    6385
    6486        $wp_admin_bar->render();
    6587
     88        /**
     89         * Fires after the admin bar is rendered.
     90         *
     91         * @since 3.1.0
     92         */
    6693        do_action( 'wp_after_admin_bar_render' );
    6794}
    6895add_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
     
    621648        if ( current_theme_supports( 'widgets' )  )
    622649                $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'widgets', 'title' => __('Widgets'), 'href' => admin_url('widgets.php') ) );
    623650
    624          if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
     651        if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
    625652                $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'menus', 'title' => __('Menus'), 'href' => admin_url('nav-menus.php') ) );
    626653
    627654        if ( current_theme_supports( 'custom-background' ) )
     
    773800                }
    774801        }
    775802
     803        /**
     804         * Filter whether to show the admin bar.
     805         *
     806         * Returning false to this hook is the recommended way to hide the admin bar.
     807         * The user's display preference is used for logged in users.
     808         *
     809         * @since 3.1.0
     810         *
     811         * @param bool $show_admin_bar Whether the admin bar should be shown. Default false.
     812         */
    776813        $show_admin_bar = apply_filters( 'show_admin_bar', $show_admin_bar );
    777814
    778815        return $show_admin_bar;