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-groups/bp-groups-loader.php

    r7277 r7347  
    119119         *
    120120         * @since BuddyPress (1.5)
    121          * @global BuddyPress $bp The one true BuddyPress instance
    122121         */
    123122        public function setup_globals( $args = array() ) {
    124                 global $bp;
     123                $bp = buddypress();
    125124
    126125                // Define a slug, if necessary
     
    137136                // All globals for groups component.
    138137                // Note that global_tables is included in this array.
    139                 $globals = array(
     138                $args = array(
    140139                        'slug'                  => BP_GROUPS_SLUG,
    141140                        'root_slug'             => isset( $bp->pages->groups->slug ) ? $bp->pages->groups->slug : BP_GROUPS_SLUG,
     
    146145                );
    147146
    148                 parent::setup_globals( $globals );
     147                parent::setup_globals( $args );
    149148
    150149                /** Single Group Globals **********************************************/
     
    339338        public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
    340339
    341                 // Define local variables
    342                 $sub_nav = array();
    343 
    344340                // Add 'Groups' to the main navigation
    345341                $main_nav = array(
     
    489485                }
    490486
    491                 if ( isset( $this->current_group->user_has_access ) )
     487                if ( isset( $this->current_group->user_has_access ) ) {
    492488                        do_action( 'groups_setup_nav', $this->current_group->user_has_access );
    493                 else
     489                } else {
    494490                        do_action( 'groups_setup_nav');
     491                }
    495492        }
    496493
    497494        /**
    498495         * Set up the Toolbar
    499          *
    500          * @global BuddyPress $bp The one true BuddyPress instance
    501496         */
    502497        public function setup_admin_bar( $wp_admin_nav = array() ) {
    503                 global $bp;
    504 
    505                 // Prevent debug notices
    506                 $wp_admin_nav = array();
     498                $bp = buddypress();
    507499
    508500                // Menus for logged in user
     
    563555        /**
    564556         * Sets up the title for pages and <title>
    565          *
    566          * @global BuddyPress $bp The one true BuddyPress instance
    567557         */
    568558        function setup_title() {
    569                 global $bp;
     559                $bp = buddypress();
    570560
    571561                if ( bp_is_groups_component() ) {
    572562
    573563                        if ( bp_is_my_profile() && !bp_is_single_item() ) {
    574 
    575564                                $bp->bp_options_title = __( 'Memberships', 'buddypress' );
    576565
    577566                        } else if ( !bp_is_my_profile() && !bp_is_single_item() ) {
    578 
    579567                                $bp->bp_options_avatar = bp_core_fetch_avatar( array(
    580568                                        'item_id' => bp_displayed_user_id(),
     
    595583                                        'alt'        => __( 'Group Avatar', 'buddypress' )
    596584                                ) );
     585
    597586                                if ( empty( $bp->bp_options_avatar ) ) {
    598                                         $bp->bp_options_avatar = '<img src="' . esc_attr( $group->avatar_full ) . '" class="avatar" alt="' . esc_attr( $group->name ) . '" />';
     587                                        $bp->bp_options_avatar = bp_group_current_avatar();
    599588                                }
    600589                        }
     
    607596
    608597function bp_setup_groups() {
    609         global $bp;
    610 
    611         $bp->groups = new BP_Groups_Component();
     598        buddypress()->groups = new BP_Groups_Component();
    612599}
    613600add_action( 'bp_setup_components', 'bp_setup_groups', 6 );
Note: See TracChangeset for help on using the changeset viewer.