Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/21/2011 10:27:09 PM (14 years ago)
Author:
djpaul
Message:

Tune up 'for' loops. Fixes #2985, props cnorris23 and r-a-y

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-friends/bp-friends-classes.php

    r4634 r4770  
    9999        $fids = array();
    100100
    101         for ( $i = 0; $i < count($friends); $i++ ) {
     101        for ( $i = 0, $count = count( $friends ); $i < $count; ++$i ) {
    102102            if ( $assoc_arr )
    103103                $fids[] = array( 'user_id' => ( $friends[$i]->friend_user_id == $user_id ) ? $friends[$i]->initiator_user_id : $friends[$i]->friend_user_id );
     
    281281        $results = $wpdb->get_results($sql);
    282282
    283         for ( $i = 0; $i < count($results); $i++ ) {
     283        for ( $i = 0, $count = count( $results ); $i < $count; ++$i ) {
    284284            $fids[] = ( $results[$i]->friend_user_id == $user_id ) ? $results[$i]->initiator_user_id : $results[$i]->friend_user_id;
    285285        }
    286286
    287287        // remove duplicates
    288         if ( count($fids) > 0 )
     288        if ( count( $fids ) > 0 )
    289289            return array_flip(array_flip($fids));
    290290        else
     
    298298
    299299        $invitable_count = 0;
    300         for ( $i = 0; $i < count($friend_ids); $i++ ) {
     300        for ( $i = 0, $count = count( $friend_ids ); $i < $count; ++$i ) {
    301301
    302302            if ( BP_Groups_Member::check_is_member( (int)$friend_ids[$i], $group_id ) )
Note: See TracChangeset for help on using the changeset viewer.