Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/12/2013 10:30:52 PM (13 years ago)
Author:
johnjamesjacoby
Message:

Audit loader classes, and remove $bp global touches in lieu of using the buddypress() function. Also some whitespace clean-up.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-members/bp-members-loader.php

    r7277 r7347  
    5353     *
    5454     * @since BuddyPress (1.5)
    55      * @global BuddyPress $bp The one true BuddyPress instance
    5655     */
    5756    public function setup_globals( $args = array() ) {
    58         global $bp;
     57        $bp = buddypress();
    5958
    6059        // Define a slug, if necessary
     
    6261            define( 'BP_MEMBERS_SLUG', $this->id );
    6362
    64         $globals = array(
     63        parent::setup_globals( array(
    6564            'slug'          => BP_MEMBERS_SLUG,
    6665            'root_slug'     => isset( $bp->pages->members->slug ) ? $bp->pages->members->slug : BP_MEMBERS_SLUG,
    6766            'has_directory' => true,
    6867            'search_string' => __( 'Search Members...', 'buddypress' ),
    69         );
    70 
    71         parent::setup_globals( $globals );
     68        ) );
    7269
    7370        /** Logged in user ****************************************************/
     
    105102
    106103        /** Default Profile Component *****************************************/
     104
    107105        if ( !defined( 'BP_DEFAULT_COMPONENT' ) ) {
    108             if ( bp_is_active( 'activity' ) && isset( $bp->pages->activity ) )
     106            if ( bp_is_active( 'activity' ) && isset( $bp->pages->activity ) ) {
    109107                $bp->default_component = bp_get_activity_slug();
    110             else
    111                 $bp->default_component = ( 'xprofile' == $bp->profile->id ) ? 'profile' : $bp->profile->id;
     108            } else {
     109                $bp->default_component = ( 'xprofile' === $bp->profile->id ) ? 'profile' : $bp->profile->id;
     110            }
    112111
    113112        } else {
     
    141140    /**
    142141     * Setup BuddyBar navigation
    143      *
    144      * @global BuddyPress $bp The one true BuddyPress instance
    145142     */
    146143    public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
    147         global $bp;
     144        $bp = buddypress();
    148145
    149146        // Add 'Profile' to the main navigation
     
    151148
    152149            // Don't set up navigation if there's no user
    153             if ( !is_user_logged_in() && !bp_is_user() )
     150            if ( !is_user_logged_in() && !bp_is_user() ) {
    154151                return;
    155 
    156             $sub_nav  = array();
     152            }
     153
    157154            $main_nav = array(
    158155                'name'                => __( 'Profile', 'buddypress' ),
     
    165162
    166163            // User links
    167             $user_domain   = bp_displayed_user_domain() ? bp_displayed_user_domain() : bp_loggedin_user_domain();
    168             $profile_link  = trailingslashit( $user_domain . $bp->profile->slug );
     164            $user_domain  = bp_displayed_user_domain() ? bp_displayed_user_domain() : bp_loggedin_user_domain();
     165            $profile_link = trailingslashit( $user_domain . $bp->profile->slug );
    169166
    170167            // Add the subnav items to the profile
     
    188185     */
    189186    function setup_title() {
    190         global $bp;
     187        $bp = buddypress();
    191188
    192189        if ( bp_is_my_profile() ) {
     
    206203
    207204function bp_setup_members() {
    208     global $bp;
    209     $bp->members = new BP_Members_Component();
     205    buddypress()->members = new BP_Members_Component();
    210206}
    211207add_action( 'bp_setup_components', 'bp_setup_members', 1 );
Note: See TracChangeset for help on using the changeset viewer.