Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/10/2012 01:17:51 AM (15 years ago)
Author:
johnjamesjacoby
Message:

Remove unneeded globals and clean up some code in Groups component. See #3989.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups/bp-groups-template.php

    r5687 r5689  
    105105
    106106        function __construct( $user_id, $type, $page, $per_page, $max, $slug, $search_terms, $populate_extras, $include = false, $exclude = false, $show_hidden = false ){
    107 
    108                 global $bp;
    109107
    110108                $this->pag_page = isset( $_REQUEST['grpage'] ) ? intval( $_REQUEST['grpage'] ) : $page;
    … …  
    163161
    164162                // Build pagination links
    165                 if ( (int)$this->total_group_count && (int)$this->pag_num ) {
     163                if ( (int) $this->total_group_count && (int)$this->pag_num ) {
    166164                        $this->pag_links = paginate_links( array(
    167165                                'base'      => add_query_arg( array( 'grpage' => '%#%', 'num' => $this->pag_num, 's' => $search_terms, 'sortby' => $this->sort_by, 'order' => $this->order ) ),
    … …  
    211209
    212210        function the_group() {
    213                 global $group;
    214 
    215211                $this->in_the_loop = true;
    216                 $this->group = $this->next_group();
     212                $this->group       = $this->next_group();
    217213
    218214                if ( $this->single_group )
    … …  
    298294
    299295function bp_group_is_visible( $group = false ) {
    300         global $bp, $groups_template;
     296        global $groups_template;
    301297
    302298        if ( bp_current_user_can( 'bp_moderate' ) )
    … …  
    382378
    383379                $defaults = array(
    384                         'type' => 'full',
    385                         'width' => false,
     380                        'type'   => 'full',
     381                        'width'  => false,
    386382                        'height' => false,
    387                         'class' => 'avatar',
    388                         'id' => false,
    389                         'alt' => sprintf( __( 'Group logo of %s', 'buddypress' ), $groups_template->group->name )
     383                        'class'  => 'avatar',
     384                        'id'     => false,
     385                        'alt'    => sprintf( __( 'Group logo of %s', 'buddypress' ), $groups_template->group->name )
    390386                );
    391387
    … …  
    439435}
    440436        function bp_get_group_permalink( $group = false ) {
    441                 global $groups_template, $bp;
     437                global $groups_template;
    442438
    443439                if ( empty( $group ) )
    … …  
    451447}
    452448        function bp_get_group_admin_permalink( $group = false ) {
    453                 global $groups_template, $bp;
     449                global $groups_template;
    454450
    455451                if ( empty( $group ) )
    … …  
    668664}
    669665        function bp_get_group_all_members_permalink( $group = false ) {
    670                 global $groups_template, $bp;
     666                global $groups_template;
    671667
    672668                if ( empty( $group ) )
    … …  
    677673
    678674function bp_group_search_form() {
    679         global $groups_template, $bp;
     675        global $bp;
    680676
    681677        $action = $bp->displayed_user->domain . bp_get_groups_slug() . '/my-groups/search/';
    … …  
    721717}
    722718        function bp_get_groups_pagination_count() {
    723                 global $bp, $groups_template;
     719                global $groups_template;
    724720
    725721                $start_num = intval( ( $groups_template->pag_page - 1 ) * $groups_template->pag_num ) + 1;
    726                 $from_num = bp_core_number_format( $start_num );
    727                 $to_num = bp_core_number_format( ( $start_num + ( $groups_template->pag_num - 1 ) > $groups_template->total_group_count ) ? $groups_template->total_group_count : $start_num + ( $groups_template->pag_num - 1 ) );
    728                 $total = bp_core_number_format( $groups_template->total_group_count );
     722                $from_num  = bp_core_number_format( $start_num );
     723                $to_num    = bp_core_number_format( ( $start_num + ( $groups_template->pag_num - 1 ) > $groups_template->total_group_count ) ? $groups_template->total_group_count : $start_num + ( $groups_template->pag_num - 1 ) );
     724                $total     = bp_core_number_format( $groups_template->total_group_count );
    729725
    730726                return apply_filters( 'bp_get_groups_pagination_count', sprintf( __( 'Viewing group %1$s to %2$s (of %3$s groups)', 'buddypress' ), $from_num, $to_num, $total ) );
    … …  
    10761072
    10771073function bp_group_mod_memberlist( $admin_list = false, $group = false ) {
    1078         global $groups_template, $group_mods;
     1074        global $groups_template;
    10791075
    10801076        if ( empty( $group ) )
    … …  
    11381134
    11391135function bp_group_has_moderators( $group = false ) {
    1140         global $group_mods, $groups_template;
     1136        global $groups_template;
    11411137
    11421138        if ( empty( $group ) )
    … …  
    11501146}
    11511147        function bp_get_group_member_promote_mod_link( $args = '' ) {
    1152                 global $members_template, $groups_template, $bp;
     1148                global $members_template, $groups_template;
    11531149
    11541150                $defaults = array(
    … …  
    11671163}
    11681164        function bp_get_group_member_promote_admin_link( $args = '' ) {
    1169                 global $members_template, $groups_template, $bp;
     1165                global $members_template, $groups_template;
    11701166
    11711167                $defaults = array(
    … …  
    11891185}
    11901186        function bp_get_group_member_demote_link( $user_id = 0, $group = false ) {
    1191                 global $members_template, $groups_template, $bp;
     1187                global $members_template, $groups_template;
    11921188
    11931189                if ( empty( $group ) )
    … …  
    12091205}
    12101206        function bp_get_group_member_ban_link( $user_id = 0, $group = false ) {
    1211                 global $members_template, $groups_template, $bp;
     1207                global $groups_template;
    12121208
    12131209                if ( empty( $group ) )
    … …  
    12471243}
    12481244        function bp_get_group_member_remove_link( $user_id = 0, $group = false ) {
    1249                 global $members_template, $groups_template;
     1245                global $groups_template;
    12501246
    12511247                if ( empty( $group ) )
Note: See TracChangeset for help on using the changeset viewer.