Skip to:
Content

BuddyPress.org

Changeset 8182


Ignore:
Timestamp:
03/27/2014 10:52:19 PM (11 years ago)
Author:
johnjamesjacoby
Message:

Replace $bp global touches in core component functions with buddypress() calls. See #5138.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-functions.php

    r8181 r8182  
    576576 */
    577577function bp_core_create_root_component_page() {
    578     global $bp;
     578
     579    // Get BuddyPress
     580    $bp = buddypress();
    579581
    580582    $new_page_ids = array();
    581583
    582     foreach ( (array) $bp->add_root as $slug )
    583         $new_page_ids[$slug] = wp_insert_post( array( 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_title' => ucwords( $slug ), 'post_status' => 'publish', 'post_type' => 'page' ) );
     584    foreach ( (array) $bp->add_root as $slug ) {
     585        $new_page_ids[ $slug ] = wp_insert_post( array(
     586            'comment_status' => 'closed',
     587            'ping_status'    => 'closed',
     588            'post_title'     => ucwords( $slug ),
     589            'post_status'    => 'publish',
     590            'post_type'      => 'page'
     591        ) );
     592    }
    584593
    585594    $page_ids = array_merge( (array) $new_page_ids, (array) bp_core_get_directory_page_ids() );
     
    11611170 *
    11621171 * @since BuddyPress (1.5.0)
    1163  *
    1164  * @global BuddyPress $bp BuddyPress global settings.
    11651172 */
    11661173function bp_embed_init() {
    1167     global $bp;
    1168 
    1169     if ( empty( $bp->embed ) )
     1174
     1175    // Get BuddyPress
     1176    $bp = buddypress();
     1177
     1178    if ( empty( $bp->embed ) ) {
    11701179        $bp->embed = new BP_Embed();
     1180    }
    11711181}
    11721182add_action( 'bp_init', 'bp_embed_init', 9 );
     
    13471357 */
    13481358function bp_get_root_blog_id() {
    1349     global $bp;
    1350 
    1351     return (int) apply_filters( 'bp_get_root_blog_id', (int) $bp->root_blog_id );
     1359    return (int) apply_filters( 'bp_get_root_blog_id', (int) buddypress()->root_blog_id );
    13521360}
    13531361
     
    14331441
    14341442/**
    1435  * Set the $bp->is_directory global.
    1436  *
    1437  * @global BuddyPress $bp The one true BuddyPress instance.
     1443 * Set the "is_directory" global.
    14381444 *
    14391445 * @param bool $is_directory Optional. Default: false.
     
    14421448 */
    14431449function bp_update_is_directory( $is_directory = false, $component = '' ) {
    1444     global $bp;
    1445 
    1446     if ( empty( $component ) )
     1450
     1451    if ( empty( $component ) ) {
    14471452        $component = bp_current_component();
    1448 
    1449     $bp->is_directory = apply_filters( 'bp_update_is_directory', $is_directory, $component );
    1450 }
    1451 
    1452 /**
    1453  * Set the $bp->is_item_admin global.
    1454  *
    1455  * @global BuddyPress $bp The one true BuddyPress instance.
     1453    }
     1454
     1455    buddypress()->is_directory = apply_filters( 'bp_update_is_directory', $is_directory, $component );
     1456}
     1457
     1458/**
     1459 * Set the "is_item_admin" global.
    14561460 *
    14571461 * @param bool $is_item_admin Optional. Default: false.
    1458  * @param string $component. Optional. Component name. Default: the current
     1462 * @param string $component Optional. Component name. Default: the current
    14591463 *        component.
    14601464 */
    14611465function bp_update_is_item_admin( $is_item_admin = false, $component = '' ) {
    1462     global $bp;
    1463 
    1464     if ( empty( $component ) )
     1466
     1467    if ( empty( $component ) ) {
    14651468        $component = bp_current_component();
    1466 
    1467     $bp->is_item_admin = apply_filters( 'bp_update_is_item_admin', $is_item_admin, $component );
    1468 }
    1469 
    1470 /**
    1471  * Set the $bp->is_item_mod global.
    1472  *
    1473  * @global BuddyPress $bp The one true BuddyPress instance.
     1469    }
     1470
     1471    buddypress()->is_item_admin = apply_filters( 'bp_update_is_item_admin', $is_item_admin, $component );
     1472}
     1473
     1474/**
     1475 * Set the "is_item_mod" global.
    14741476 *
    14751477 * @param bool $is_item_mod Optional. Default: false.
    1476  * @param string $component. Optional. Component name. Default: the current
     1478 * @param string $component Optional. Component name. Default: the current
    14771479 *        component.
    14781480 */
    14791481function bp_update_is_item_mod( $is_item_mod = false, $component = '' ) {
    1480     global $bp;
    1481 
    1482     if ( empty( $component ) )
     1482
     1483    if ( empty( $component ) ) {
    14831484        $component = bp_current_component();
    1484 
    1485     $bp->is_item_mod = apply_filters( 'bp_update_is_item_mod', $is_item_mod, $component );
     1485    }
     1486
     1487    buddypress()->is_item_mod = apply_filters( 'bp_update_is_item_mod', $is_item_mod, $component );
    14861488}
    14871489
     
    15051507    nocache_headers();
    15061508
    1507     if ( 'remove_canonical_direct' == $redirect )
     1509    if ( 'remove_canonical_direct' === $redirect ) {
    15081510        remove_action( 'template_redirect', 'redirect_canonical' );
     1511    }
    15091512}
    15101513
Note: See TracChangeset for help on using the changeset viewer.