Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/10/2015 02:49:16 AM (11 years ago)
Author:
johnjamesjacoby
Message:

Replace all remaining $bp global touches with buddypress().

All existing tests continue to pass as normal. I will further manually scrutinize each replacement to ensure correctness.

Fixes #5138. Any stragglers or updates will reference this ticket.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-buddybar.php

    r9351 r9471  
    1414/**
    1515 * Add an item to the main BuddyPress navigation array.
    16  *
    17  * @global BuddyPress $bp The one true BuddyPress instance.
    1816 *
    1917 * @param array $args {
     
    3937 */
    4038function bp_core_new_nav_item( $args = '' ) {
    41     global $bp;
     39    $bp = buddypress();
    4240
    4341    $defaults = array(
     
    120118 * Modify the default subnav item that loads when a top level nav item is clicked.
    121119 *
    122  * @global BuddyPress $bp The one true BuddyPress instance.
    123  *
    124120 * @param array $args {
    125121 *     @type string $parent_slug The slug of the nav item whose default is
     
    131127 */
    132128function bp_core_new_nav_default( $args = '' ) {
    133     global $bp;
     129    $bp = buddypress();
    134130
    135131    $defaults = array(
     
    196192 * after all plugins have had a chance to register their navigation items.
    197193 *
    198  * @global BuddyPress $bp The one true BuddyPress instance
    199  *
    200194 * @return bool|null Returns false on failure.
    201195 */
    202196function bp_core_sort_nav_items() {
    203     global $bp;
     197    $bp = buddypress();
    204198
    205199    if ( empty( $bp->bp_nav ) || !is_array( $bp->bp_nav ) )
     
    229223/**
    230224 * Add a subnav item to the BuddyPress navigation.
    231  *
    232  * @global BuddyPress $bp The one true BuddyPress instance.
    233225 *
    234226 * @param array $args {
     
    261253 */
    262254function bp_core_new_subnav_item( $args = '' ) {
    263     global $bp;
     255    $bp = buddypress();
    264256
    265257    $r = wp_parse_args( $args, array(
     
    442434 * Sort all subnavigation arrays.
    443435 *
    444  * @global BuddyPress $bp The one true BuddyPress instance
    445  *
    446436 * @return bool|null Returns false on failure.
    447437 */
    448438function bp_core_sort_subnav_items() {
    449     global $bp;
     439    $bp = buddypress();
    450440
    451441    if ( empty( $bp->bp_options_nav ) || !is_array( $bp->bp_options_nav ) )
     
    487477 */
    488478function bp_nav_item_has_subnav( $nav_item = '' ) {
    489     global $bp;
     479    $bp = buddypress();
    490480
    491481    if ( !$nav_item )
     
    504494 */
    505495function bp_core_remove_nav_item( $parent_id ) {
    506     global $bp;
     496    $bp = buddypress();
    507497
    508498    // Unset subnav items for this nav item
     
    533523 */
    534524function bp_core_remove_subnav_item( $parent_id, $slug ) {
    535     global $bp;
    536 
    537     $screen_function = isset( $bp->bp_options_nav[$parent_id][$slug]['screen_function'] ) ? $bp->bp_options_nav[$parent_id][$slug]['screen_function'] : false;
     525    $bp = buddypress();
     526
     527    $screen_function = isset( $bp->bp_options_nav[$parent_id][$slug]['screen_function'] )
     528        ? $bp->bp_options_nav[$parent_id][$slug]['screen_function']
     529        : false;
    538530
    539531    if ( ! empty( $screen_function ) ) {
     
    553545 * Clear all subnav items from a specific nav item.
    554546 *
    555  * @global BuddyPress $bp The one true BuddyPress instance.
    556  *
    557547 * @param string $parent_slug The slug of the parent navigation item.
    558548 */
    559549function bp_core_reset_subnav_items( $parent_slug ) {
    560     global $bp;
     550    $bp = buddypress();
    561551
    562552    unset( $bp->bp_options_nav[$parent_slug] );
Note: See TracChangeset for help on using the changeset viewer.