<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][4770] trunk: Tune up 'for' loops.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://buddypress.trac.wordpress.org/changeset/4770">4770</a></dd>
<dt>Author</dt> <dd>djpaul</dd>
<dt>Date</dt> <dd>2011-07-21 22:27:09 +0000 (Thu, 21 Jul 2011)</dd>
</dl>
<h3>Log Message</h3>
<pre>Tune up 'for' loops. Fixes <a href="http://buddypress.trac.wordpress.org/ticket/2985">#2985</a>, props cnorris23 and r-a-y</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivitybpactivityclassesphp">trunk/bp-activity/bp-activity-classes.php</a></li>
<li><a href="#trunkbpblogsbpblogsclassesphp">trunk/bp-blogs/bp-blogs-classes.php</a></li>
<li><a href="#trunkbpcorebpcoreclassesphp">trunk/bp-core/bp-core-classes.php</a></li>
<li><a href="#trunkbpcorebpcorefunctionsphp">trunk/bp-core/bp-core-functions.php</a></li>
<li><a href="#trunkbpforumsbpforumsfunctionsphp">trunk/bp-forums/bp-forums-functions.php</a></li>
<li><a href="#trunkbpfriendsbpfriendsclassesphp">trunk/bp-friends/bp-friends-classes.php</a></li>
<li><a href="#trunkbpfriendsbpfriendsfunctionsphp">trunk/bp-friends/bp-friends-functions.php</a></li>
<li><a href="#trunkbpfriendsbpfriendstemplatephp">trunk/bp-friends/bp-friends-template.php</a></li>
<li><a href="#trunkbpgroupsbpgroupsclassesphp">trunk/bp-groups/bp-groups-classes.php</a></li>
<li><a href="#trunkbpgroupsbpgroupsfunctionsphp">trunk/bp-groups/bp-groups-functions.php</a></li>
<li><a href="#trunkbpgroupsbpgroupstemplatephp">trunk/bp-groups/bp-groups-template.php</a></li>
<li><a href="#trunkbpmembersbpmembersbuddybarphp">trunk/bp-members/bp-members-buddybar.php</a></li>
<li><a href="#trunkbpmembersbpmembersnotificationsphp">trunk/bp-members/bp-members-notifications.php</a></li>
<li><a href="#trunkbpmessagesbpmessagesclassesphp">trunk/bp-messages/bp-messages-classes.php</a></li>
<li><a href="#trunkbpmessagesbpmessagesfunctionsphp">trunk/bp-messages/bp-messages-functions.php</a></li>
<li><a href="#trunkbpthemesbpdefault_incajaxphp">trunk/bp-themes/bp-default/_inc/ajax.php</a></li>
<li><a href="#trunkbpxprofilebpxprofileclassesphp">trunk/bp-xprofile/bp-xprofile-classes.php</a></li>
<li><a href="#trunkbpxprofilebpxprofiletemplatephp">trunk/bp-xprofile/bp-xprofile-template.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpactivitybpactivityclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-classes.php (4769 => 4770)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-classes.php        2011-07-21 21:33:20 UTC (rev 4769)
+++ trunk/bp-activity/bp-activity-classes.php        2011-07-21 22:27:09 UTC (rev 4770)
</span><span class="lines">@@ -445,7 +445,7 @@
</span><span class="cx">
</span><span class="cx">                 $activities = bp_activity_get_sitewide( array( 'max' => $limit ) );
</span><span class="cx">
</span><del>-                for ( $i = 0; $i < count($activities); $i++ ) {
</del><ins>+                for ( $i = 0, $count = count( $activities ); $i < $count; ++$i ) {
</ins><span class="cx">                                 $title = explode( '<span', $activities[$i]['content'] );
</span><span class="cx">
</span><span class="cx">                                 $activity_feed[$i]['title'] = trim( strip_tags( $title[0] ) );
</span></span></pre></div>
<a id="trunkbpblogsbpblogsclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs/bp-blogs-classes.php (4769 => 4770)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs/bp-blogs-classes.php        2011-07-21 21:33:20 UTC (rev 4769)
+++ trunk/bp-blogs/bp-blogs-classes.php        2011-07-21 22:27:09 UTC (rev 4770)
</span><span class="lines">@@ -250,7 +250,7 @@
</span><span class="cx">                 if ( empty( $blog_ids ) )
</span><span class="cx">                         return $paged_blogs;
</span><span class="cx">
</span><del>-                for ( $i = 0; $i < count( $paged_blogs ); $i++ ) {
</del><ins>+                for ( $i = 0, $count = count( $paged_blogs ); $i < $count; ++$i ) {
</ins><span class="cx">                         $blog_prefix = $wpdb->get_blog_prefix( $paged_blogs[$i]->blog_id );
</span><span class="cx">                         $paged_blogs[$i]->latest_post = $wpdb->get_row( "SELECT post_title, guid FROM {$blog_prefix}posts WHERE post_status = 'publish' AND post_type = 'post' AND id != 1 ORDER BY id DESC LIMIT 1" );
</span><span class="cx">                 }
</span><span class="lines">@@ -258,7 +258,7 @@
</span><span class="cx">                 /* Fetch the blog description for each blog (as it may be empty we can't fetch it in the main query). */
</span><span class="cx">                 $blog_descs = $wpdb->get_results( $wpdb->prepare( "SELECT blog_id, meta_value as description FROM {$bp->blogs->table_name_blogmeta} WHERE meta_key = 'description' AND blog_id IN ( {$blog_ids} )" ) );
</span><span class="cx">
</span><del>-                for ( $i = 0; $i < count( $paged_blogs ); $i++ ) {
</del><ins>+                for ( $i = 0, $count = count( $paged_blogs ); $i < $count; ++$i ) {
</ins><span class="cx">                         foreach ( (array)$blog_descs as $desc ) {
</span><span class="cx">                                 if ( $desc->blog_id == $paged_blogs[$i]->blog_id )
</span><span class="cx">                                         $paged_blogs[$i]->description = $desc->description;
</span></span></pre></div>
<a id="trunkbpcorebpcoreclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-classes.php (4769 => 4770)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-classes.php        2011-07-21 21:33:20 UTC (rev 4769)
+++ trunk/bp-core/bp-core-classes.php        2011-07-21 22:27:09 UTC (rev 4770)
</span><span class="lines">@@ -509,7 +509,7 @@
</span><span class="cx">                 // Fetch the user's full name
</span><span class="cx">                 if ( bp_is_active( 'xprofile' ) && 'alphabetical' != $type ) {
</span><span class="cx">                         $names = $wpdb->get_results( $wpdb->prepare( "SELECT pd.user_id as id, pd.value as fullname FROM {$bp->profile->table_name_fields} pf, {$bp->profile->table_name_data} pd WHERE pf.id = pd.field_id AND pf.name = %s AND pd.user_id IN ( {$user_ids} )", bp_xprofile_fullname_field_name() ) );
</span><del>-                        for ( $i = 0; $i < count( $paged_users ); $i++ ) {
</del><ins>+                        for ( $i = 0, $count = count( $paged_users ); $i < $count; ++$i ) {
</ins><span class="cx">                                 foreach ( (array)$names as $name ) {
</span><span class="cx">                                         if ( $name->id == $paged_users[$i]->id )
</span><span class="cx">                                                 $paged_users[$i]->fullname = $name->fullname;
</span><span class="lines">@@ -520,7 +520,7 @@
</span><span class="cx">                 // Fetch the user's total friend count
</span><span class="cx">                 if ( 'popular' != $type ) {
</span><span class="cx">                         $friend_count = $wpdb->get_results( $wpdb->prepare( "SELECT user_id as id, meta_value as total_friend_count FROM {$wpdb->usermeta} WHERE meta_key = %s AND user_id IN ( {$user_ids} )", bp_get_user_meta_key( 'total_friend_count' ) ) );
</span><del>-                        for ( $i = 0; $i < count( $paged_users ); $i++ ) {
</del><ins>+                        for ( $i = 0, $count = count( $paged_users ); $i < $count; ++$i ) {
</ins><span class="cx">                                 foreach ( (array)$friend_count as $count ) {
</span><span class="cx">                                         if ( $count->id == $paged_users[$i]->id )
</span><span class="cx">                                                 $paged_users[$i]->total_friend_count = (int)$count->total_friend_count;
</span><span class="lines">@@ -531,7 +531,7 @@
</span><span class="cx">                 // Fetch whether or not the user is a friend
</span><span class="cx">                 if ( bp_is_active( 'friends' ) ) {
</span><span class="cx">                         $friend_status = $wpdb->get_results( $wpdb->prepare( "SELECT initiator_user_id, friend_user_id, is_confirmed FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d AND friend_user_id IN ( {$user_ids} ) ) OR (initiator_user_id IN ( {$user_ids} ) AND friend_user_id = %d )", $bp->loggedin_user->id, $bp->loggedin_user->id ) );
</span><del>-                        for ( $i = 0; $i < count( $paged_users ); $i++ ) {
</del><ins>+                        for ( $i = 0, $count = count( $paged_users ); $i < $count; ++$i ) {
</ins><span class="cx">                                 foreach ( (array)$friend_status as $status ) {
</span><span class="cx">                                         if ( $status->initiator_user_id == $paged_users[$i]->id || $status->friend_user_id == $paged_users[$i]->id )
</span><span class="cx">                                                 $paged_users[$i]->is_friend = $status->is_confirmed;
</span><span class="lines">@@ -541,7 +541,7 @@
</span><span class="cx">
</span><span class="cx">                 if ( 'active' != $type ) {
</span><span class="cx">                         $user_activity = $wpdb->get_results( $wpdb->prepare( "SELECT user_id as id, meta_value as last_activity FROM {$wpdb->usermeta} WHERE meta_key = %s AND user_id IN ( {$user_ids} )", bp_get_user_meta_key( 'last_activity' ) ) );
</span><del>-                        for ( $i = 0; $i < count( $paged_users ); $i++ ) {
</del><ins>+                        for ( $i = 0, $count = count( $paged_users ); $i < $count; ++$i ) {
</ins><span class="cx">                                 foreach ( (array)$user_activity as $activity ) {
</span><span class="cx">                                         if ( $activity->id == $paged_users[$i]->id )
</span><span class="cx">                                                 $paged_users[$i]->last_activity = $activity->last_activity;
</span><span class="lines">@@ -552,7 +552,7 @@
</span><span class="cx">                 // Fetch the user's last_activity
</span><span class="cx">                 if ( 'active' != $type ) {
</span><span class="cx">                         $user_activity = $wpdb->get_results( $wpdb->prepare( "SELECT user_id as id, meta_value as last_activity FROM {$wpdb->usermeta} WHERE meta_key = %s AND user_id IN ( {$user_ids} )", bp_get_user_meta_key( 'last_activity' ) ) );
</span><del>-                        for ( $i = 0; $i < count( $paged_users ); $i++ ) {
</del><ins>+                        for ( $i = 0, $count = count( $paged_users ); $i < $count; ++$i ) {
</ins><span class="cx">                                 foreach ( (array)$user_activity as $activity ) {
</span><span class="cx">                                         if ( $activity->id == $paged_users[$i]->id )
</span><span class="cx">                                                 $paged_users[$i]->last_activity = $activity->last_activity;
</span><span class="lines">@@ -562,7 +562,7 @@
</span><span class="cx">
</span><span class="cx">                 // Fetch the user's latest update
</span><span class="cx">                 $user_update = $wpdb->get_results( $wpdb->prepare( "SELECT user_id as id, meta_value as latest_update FROM {$wpdb->usermeta} WHERE meta_key = %s AND user_id IN ( {$user_ids} )", bp_get_user_meta_key( 'bp_latest_update' ) ) );
</span><del>-                for ( $i = 0; $i < count( $paged_users ); $i++ ) {
</del><ins>+                for ( $i = 0, $count = count( $paged_users ); $i < $count; ++$i ) {
</ins><span class="cx">                         foreach ( (array)$user_update as $update ) {
</span><span class="cx">                                 if ( $update->id == $paged_users[$i]->id )
</span><span class="cx">                                         $paged_users[$i]->latest_update = $update->latest_update;
</span></span></pre></div>
<a id="trunkbpcorebpcorefunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-functions.php (4769 => 4770)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-functions.php        2011-07-21 21:33:20 UTC (rev 4769)
+++ trunk/bp-core/bp-core-functions.php        2011-07-21 22:27:09 UTC (rev 4770)
</span><span class="lines">@@ -642,7 +642,7 @@
</span><span class="cx">         } else {
</span><span class="cx">
</span><span class="cx">                 // Step one: the first chunk
</span><del>-                for ( $i = 0, $j = count($chunks); $i < $j; $i++) {
</del><ins>+                for ( $i = 0, $j = count( $chunks ); $i < $j; ++$i ) {
</ins><span class="cx">                         $seconds = $chunks[$i][0];
</span><span class="cx">
</span><span class="cx">                         // Finding the biggest chunk (if the chunk fits, break)
</span></span></pre></div>
<a id="trunkbpforumsbpforumsfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-forums/bp-forums-functions.php (4769 => 4770)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-forums/bp-forums-functions.php        2011-07-21 21:33:20 UTC (rev 4769)
+++ trunk/bp-forums/bp-forums-functions.php        2011-07-21 22:27:09 UTC (rev 4770)
</span><span class="lines">@@ -320,7 +320,7 @@
</span><span class="cx">
</span><span class="cx">         // Fetch the topic's last poster details
</span><span class="cx">         $poster_details = $wpdb->get_results( $wpdb->prepare( "SELECT t.topic_id, t.topic_last_poster, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$wpdb->users} u, {$bbdb->topics} t WHERE u.ID = t.topic_last_poster AND t.topic_id IN ( {$topic_ids} )" ) );
</span><del>-        for ( $i = 0; $i < count( $topics ); $i++ ) {
</del><ins>+        for ( $i = 0, $count = count( $topics ); $i < $count; ++$i ) {
</ins><span class="cx">                 foreach ( (array)$poster_details as $poster ) {
</span><span class="cx">                         if ( $poster->topic_id == $topics[$i]->topic_id ) {
</span><span class="cx">                                 $topics[$i]->topic_last_poster_email = $poster->user_email;
</span><span class="lines">@@ -334,7 +334,7 @@
</span><span class="cx">         // Fetch fullname for the topic's last poster
</span><span class="cx">         if ( bp_is_active( 'xprofile' ) ) {
</span><span class="cx">                 $poster_names = $wpdb->get_results( $wpdb->prepare( "SELECT t.topic_id, pd.value FROM {$bp->profile->table_name_data} pd, {$bbdb->topics} t WHERE pd.user_id = t.topic_last_poster AND pd.field_id = 1 AND t.topic_id IN ( {$topic_ids} )" ) );
</span><del>-                for ( $i = 0; $i < count( $topics ); $i++ ) {
</del><ins>+                for ( $i = 0, $count = count( $topics ); $i < $count; ++$i ) {
</ins><span class="cx">                         foreach ( (array)$poster_names as $name ) {
</span><span class="cx">                                 if ( $name->topic_id == $topics[$i]->topic_id )
</span><span class="cx">                                         $topics[$i]->topic_last_poster_displayname = $name->value;
</span><span class="lines">@@ -438,7 +438,7 @@
</span><span class="cx">         // Fetch the poster's user_email, user_nicename and user_login
</span><span class="cx">         $poster_details = $wpdb->get_results( $wpdb->prepare( "SELECT u.ID as user_id, u.user_login, u.user_nicename, u.user_email, u.display_name FROM {$wpdb->users} u WHERE u.ID IN ( {$user_ids} )" ) );
</span><span class="cx">
</span><del>-        for ( $i = 0; $i < count( $posts ); $i++ ) {
</del><ins>+        for ( $i = 0, $count = count( $posts ); $i < $count; ++$i ) {
</ins><span class="cx">                 foreach ( (array)$poster_details as $poster ) {
</span><span class="cx">                         if ( $poster->user_id == $posts[$i]->poster_id ) {
</span><span class="cx">                                 $posts[$i]->poster_email = $poster->user_email;
</span><span class="lines">@@ -452,7 +452,7 @@
</span><span class="cx">         // Fetch fullname for each poster.
</span><span class="cx">         if ( bp_is_active( 'xprofile' ) ) {
</span><span class="cx">                 $poster_names = $wpdb->get_results( $wpdb->prepare( "SELECT pd.user_id, pd.value FROM {$bp->profile->table_name_data} pd WHERE pd.user_id IN ( {$user_ids} )" ) );
</span><del>-                for ( $i = 0; $i < count( $posts ); $i++ ) {
</del><ins>+                for ( $i = 0, $count = count( $posts ); $i < $count; ++$i ) {
</ins><span class="cx">                         foreach ( (array)$poster_names as $name ) {
</span><span class="cx">                                 if ( isset( $topics[$i] ) && $name->user_id == $topics[$i]->user_id )
</span><span class="cx">                                 $posts[$i]->poster_name = $poster->value;
</span></span></pre></div>
<a id="trunkbpfriendsbpfriendsclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-friends/bp-friends-classes.php (4769 => 4770)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-friends/bp-friends-classes.php        2011-07-21 21:33:20 UTC (rev 4769)
+++ trunk/bp-friends/bp-friends-classes.php        2011-07-21 22:27:09 UTC (rev 4770)
</span><span class="lines">@@ -98,7 +98,7 @@
</span><span class="cx">                 $friends = $wpdb->get_results( $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} $friend_sql $oc_sql ORDER BY date_created DESC" ) );
</span><span class="cx">                 $fids = array();
</span><span class="cx">
</span><del>-                for ( $i = 0; $i < count($friends); $i++ ) {
</del><ins>+                for ( $i = 0, $count = count( $friends ); $i < $count; ++$i ) {
</ins><span class="cx">                         if ( $assoc_arr )
</span><span class="cx">                                 $fids[] = array( 'user_id' => ( $friends[$i]->friend_user_id == $user_id ) ? $friends[$i]->initiator_user_id : $friends[$i]->friend_user_id );
</span><span class="cx">                         else
</span><span class="lines">@@ -280,12 +280,12 @@
</span><span class="cx">                 $sql = $wpdb->prepare( "SELECT friend_user_id, initiator_user_id FROM {$bp->friends->table_name} WHERE (friend_user_id = %d || initiator_user_id = %d) && is_confirmed = 1 ORDER BY rand() LIMIT %d", $user_id, $user_id, $total_friends );
</span><span class="cx">                 $results = $wpdb->get_results($sql);
</span><span class="cx">
</span><del>-                for ( $i = 0; $i < count($results); $i++ ) {
</del><ins>+                for ( $i = 0, $count = count( $results ); $i < $count; ++$i ) {
</ins><span class="cx">                         $fids[] = ( $results[$i]->friend_user_id == $user_id ) ? $results[$i]->initiator_user_id : $results[$i]->friend_user_id;
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 // remove duplicates
</span><del>-                if ( count($fids) > 0 )
</del><ins>+                if ( count( $fids ) > 0 )
</ins><span class="cx">                         return array_flip(array_flip($fids));
</span><span class="cx">                 else
</span><span class="cx">                         return false;
</span><span class="lines">@@ -297,7 +297,7 @@
</span><span class="cx">                 $friend_ids = BP_Friends_Friendship::get_friend_user_ids( $user_id );
</span><span class="cx">
</span><span class="cx">                 $invitable_count = 0;
</span><del>-                for ( $i = 0; $i < count($friend_ids); $i++ ) {
</del><ins>+                for ( $i = 0, $count = count( $friend_ids ); $i < $count; ++$i ) {
</ins><span class="cx">
</span><span class="cx">                         if ( BP_Groups_Member::check_is_member( (int)$friend_ids[$i], $group_id ) )
</span><span class="cx">                                 continue;
</span></span></pre></div>
<a id="trunkbpfriendsbpfriendsfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-friends/bp-friends-functions.php (4769 => 4770)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-friends/bp-friends-functions.php        2011-07-21 21:33:20 UTC (rev 4769)
+++ trunk/bp-friends/bp-friends-functions.php        2011-07-21 22:27:09 UTC (rev 4770)
</span><span class="lines">@@ -244,8 +244,8 @@
</span><span class="cx">         if ( !$user_ids )
</span><span class="cx">                 return false;
</span><span class="cx">
</span><del>-        for ( $i = 0; $i < count( $user_ids ); $i++ )
-                $users[] = new BP_Core_User($user_ids[$i]);
</del><ins>+        for ( $i = 0, $count = count( $user_ids ); $i < $count; ++$i )
+                $users[] = new BP_Core_User( $user_ids[$i] );
</ins><span class="cx">
</span><span class="cx">         return array( 'users' => $users, 'count' => BP_Friends_Friendship::search_users_count( $search_terms ) );
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkbpfriendsbpfriendstemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-friends/bp-friends-template.php (4769 => 4770)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-friends/bp-friends-template.php        2011-07-21 21:33:20 UTC (rev 4769)
+++ trunk/bp-friends/bp-friends-template.php        2011-07-21 22:27:09 UTC (rev 4770)
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx">
</span><span class="cx">                         <ul class="horiz-gallery">
</span><span class="cx">
</span><del>-                        <?php for ( $i = 0; $i < count( $friend_ids ); $i++ ) { ?>
</del><ins>+                        <?php for ( $i = 0, $count = count( $friend_ids ); $i < $count; ++$i ) { ?>
</ins><span class="cx">
</span><span class="cx">                                 <li>
</span><span class="cx">                                         <a href="<?php echo bp_core_get_user_domain( $friend_ids[$i] ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $friend_ids[$i], 'type' => 'thumb' ) ) ?></a>
</span><span class="lines">@@ -138,7 +138,7 @@
</span><span class="cx">
</span><span class="cx">                 <ul class="item-list" id="random-members-list">
</span><span class="cx">
</span><del>-                <?php for ( $i = 0; $i < count( $user_ids['users'] ); $i++ ) { ?>
</del><ins>+                <?php for ( $i = 0, $count = count( $user_ids['users'] ); $i < $count; ++$i ) { ?>
</ins><span class="cx">
</span><span class="cx">                         <li>
</span><span class="cx">                                 <a href="<?php echo bp_core_get_user_domain( $user_ids['users'][$i]->id ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $user_ids['users'][$i]->id, 'type' => 'thumb' ) ) ?></a>
</span></span></pre></div>
<a id="trunkbpgroupsbpgroupsclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-classes.php (4769 => 4770)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-classes.php        2011-07-21 21:33:20 UTC (rev 4769)
+++ trunk/bp-groups/bp-groups-classes.php        2011-07-21 22:27:09 UTC (rev 4770)
</span><span class="lines">@@ -541,7 +541,7 @@
</span><span class="cx">
</span><span class="cx">                 /* Fetch the logged in users status within each group */
</span><span class="cx">                 $user_status = $wpdb->get_col( $wpdb->prepare( "SELECT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND group_id IN ( {$group_ids} ) AND is_confirmed = 1 AND is_banned = 0", $bp->loggedin_user->id ) );
</span><del>-                for ( $i = 0; $i < count( $paged_groups ); $i++ ) {
</del><ins>+                for ( $i = 0, $count = count( $paged_groups ); $i < $count; ++$i ) {
</ins><span class="cx">                         $paged_groups[$i]->is_member = false;
</span><span class="cx">
</span><span class="cx">                         foreach ( (array)$user_status as $group_id ) {
</span><span class="lines">@@ -551,7 +551,7 @@
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 $user_banned = $wpdb->get_col( $wpdb->prepare( "SELECT group_id FROM {$bp->groups->table_name_members} WHERE is_banned = 1 AND user_id = %d AND group_id IN ( {$group_ids} )", $bp->loggedin_user->id ) );
</span><del>-                for ( $i = 0; $i < count( $paged_groups ); $i++ ) {
</del><ins>+                for ( $i = 0, $count = count( $paged_groups ); $i < $count; ++$i ) {
</ins><span class="cx">                         $paged_groups[$i]->is_banned = false;
</span><span class="cx">
</span><span class="cx">                         foreach ( (array)$user_banned as $group_id ) {
</span><span class="lines">@@ -1105,7 +1105,7 @@
</span><span class="cx">
</span><span class="cx">                 if ( bp_is_active( 'friends' ) ) {
</span><span class="cx">                         $friend_status = $wpdb->get_results( $wpdb->prepare( "SELECT initiator_user_id, friend_user_id, is_confirmed FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d AND friend_user_id IN ( {$user_ids} ) ) OR (initiator_user_id IN ( {$user_ids} ) AND friend_user_id = %d )", $bp->loggedin_user->id, $bp->loggedin_user->id ) );
</span><del>-                        for ( $i = 0; $i < count( $members ); $i++ ) {
</del><ins>+                        for ( $i = 0, $count = count( $members ); $i < $count; ++$i ) {
</ins><span class="cx">                                 foreach ( (array)$friend_status as $status ) {
</span><span class="cx">                                         if ( $status->initiator_user_id == $members[$i]->user_id || $status->friend_user_id == $members[$i]->user_id )
</span><span class="cx">                                                 $members[$i]->is_friend = $status->is_confirmed;
</span></span></pre></div>
<a id="trunkbpgroupsbpgroupsfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-functions.php (4769 => 4770)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-functions.php        2011-07-21 21:33:20 UTC (rev 4769)
+++ trunk/bp-groups/bp-groups-functions.php        2011-07-21 22:27:09 UTC (rev 4770)
</span><span class="lines">@@ -644,7 +644,7 @@
</span><span class="cx">         $invited_users = groups_get_invites_for_group( $user_id, $group_id );
</span><span class="cx">         $group = new BP_Groups_Group( $group_id );
</span><span class="cx">
</span><del>-        for ( $i = 0; $i < count( $invited_users ); $i++ ) {
</del><ins>+        for ( $i = 0, $count = count( $invited_users ); $i < $count; ++$i ) {
</ins><span class="cx">                 $member = new BP_Groups_Member( $invited_users[$i], $group_id );
</span><span class="cx">
</span><span class="cx">                 // Send the actual invite
</span><span class="lines">@@ -778,7 +778,7 @@
</span><span class="cx">                 require_once ( BP_PLUGIN_DIR . '/bp-groups/bp-groups-notifications.php' );
</span><span class="cx">
</span><span class="cx">                 // Saved okay, now send the email notification
</span><del>-                for ( $i = 0; $i < count( $admins ); $i++ )
</del><ins>+                for ( $i = 0, $count = count( $admins ); $i < $count; ++$i )
</ins><span class="cx">                         groups_notification_new_membership_request( $requesting_user_id, $admins[$i]->user_id, $group_id, $requesting_user->id );
</span><span class="cx">
</span><span class="cx">                 do_action( 'groups_membership_requested', $requesting_user_id, $admins, $group_id, $requesting_user->id );
</span></span></pre></div>
<a id="trunkbpgroupsbpgroupstemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-template.php (4769 => 4770)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-template.php        2011-07-21 21:33:20 UTC (rev 4769)
+++ trunk/bp-groups/bp-groups-template.php        2011-07-21 22:27:09 UTC (rev 4770)
</span><span class="lines">@@ -2199,7 +2199,7 @@
</span><span class="cx">                 if ( $friends = friends_get_friends_invite_list( $bp->loggedin_user->id, $group_id ) ) {
</span><span class="cx">                         $invites = groups_get_invites_for_group( $bp->loggedin_user->id, $group_id );
</span><span class="cx">
</span><del>-                        for ( $i = 0; $i < count( $friends ); $i++ ) {
</del><ins>+                        for ( $i = 0, $count = count( $friends ); $i < $count; ++$i ) {
</ins><span class="cx">                                 $checked = '';
</span><span class="cx">
</span><span class="cx">                                 if ( !empty( $invites ) ) {
</span></span></pre></div>
<a id="trunkbpmembersbpmembersbuddybarphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-members/bp-members-buddybar.php (4769 => 4770)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-members/bp-members-buddybar.php        2011-07-21 21:33:20 UTC (rev 4769)
+++ trunk/bp-members/bp-members-buddybar.php        2011-07-21 22:27:09 UTC (rev 4770)
</span><span class="lines">@@ -20,7 +20,7 @@
</span><span class="cx">
</span><span class="cx">         if ( $notifications ) {
</span><span class="cx">                 $counter = 0;
</span><del>-                for ( $i = 0; $i < count($notifications); $i++ ) {
</del><ins>+                for ( $i = 0, $count = count( $notifications ); $i < $count; ++$i ) {
</ins><span class="cx">                         $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; ?>
</span><span class="cx">
</span><span class="cx">                         <li<?php echo $alt ?>><?php echo $notifications[$i] ?></li>
</span></span></pre></div>
<a id="trunkbpmembersbpmembersnotificationsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-members/bp-members-notifications.php (4769 => 4770)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-members/bp-members-notifications.php        2011-07-21 21:33:20 UTC (rev 4769)
+++ trunk/bp-members/bp-members-notifications.php        2011-07-21 22:27:09 UTC (rev 4770)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx">         $notifications = BP_Core_Notification::get_all_for_user( $user_id );
</span><span class="cx">
</span><span class="cx">         // Group notifications by component and component_action and provide totals
</span><del>-        for ( $i = 0; $i < count($notifications); $i++ ) {
</del><ins>+        for ( $i = 0, $count = count( $notifications ); $i < $count; ++$i ) {
</ins><span class="cx">                 $notification = $notifications[$i];
</span><span class="cx">                 $grouped_notifications[$notification->component_name][$notification->component_action][] = $notification;
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkbpmessagesbpmessagesclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-messages/bp-messages-classes.php (4769 => 4770)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-messages/bp-messages-classes.php        2011-07-21 21:33:20 UTC (rev 4769)
+++ trunk/bp-messages/bp-messages-classes.php        2011-07-21 22:27:09 UTC (rev 4770)
</span><span class="lines">@@ -175,7 +175,7 @@
</span><span class="cx">                         return false;
</span><span class="cx">
</span><span class="cx">                 $count = 0;
</span><del>-                for ( $i = 0; $i < count( $unread_counts ); $i++ ) {
</del><ins>+                for ( $i = 0, $count = count( $unread_counts ); $i < $count; ++$i ) {
</ins><span class="cx">                         $count += $unread_counts[$i]->unread_count;
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="lines">@@ -341,7 +341,7 @@
</span><span class="cx">                         return false;
</span><span class="cx">
</span><span class="cx">                 if ( is_array( $recipient_usernames ) ) {
</span><del>-                        for ( $i = 0; $i < count($recipient_usernames); $i++ ) {
</del><ins>+                        for ( $i = 0, $count = count( $recipient_usernames ); $i < $count; ++$i ) {
</ins><span class="cx">                                 if ( $rid = bp_core_get_userid( trim($recipient_usernames[$i]) ) )
</span><span class="cx">                                         $recipient_ids[] = $rid;
</span><span class="cx">                         }
</span></span></pre></div>
<a id="trunkbpmessagesbpmessagesfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-messages/bp-messages-functions.php (4769 => 4770)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-messages/bp-messages-functions.php        2011-07-21 21:33:20 UTC (rev 4769)
+++ trunk/bp-messages/bp-messages-functions.php        2011-07-21 22:27:09 UTC (rev 4770)
</span><span class="lines">@@ -135,7 +135,7 @@
</span><span class="cx">
</span><span class="cx">         if ( is_array( $thread_ids ) ) {
</span><span class="cx">                 $error = 0;
</span><del>-                for ( $i = 0; $i < count( $thread_ids ); $i++ ) {
</del><ins>+                for ( $i = 0, $count = count( $thread_ids ); $i < $count; ++$i ) {
</ins><span class="cx">                         if ( !$status = BP_Messages_Thread::delete( $thread_ids[$i]) )
</span><span class="cx">                                 $error = 1;
</span><span class="cx">                 }
</span></span></pre></div>
<a id="trunkbpthemesbpdefault_incajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/ajax.php (4769 => 4770)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/ajax.php        2011-07-21 21:33:20 UTC (rev 4769)
+++ trunk/bp-themes/bp-default/_inc/ajax.php        2011-07-21 22:27:09 UTC (rev 4770)
</span><span class="lines">@@ -558,7 +558,7 @@
</span><span class="cx">         } else {
</span><span class="cx">                 $thread_ids = explode( ',', $_POST['thread_ids'] );
</span><span class="cx">
</span><del>-                for ( $i = 0; $i < count($thread_ids); $i++ ) {
</del><ins>+                for ( $i = 0, $count = count( $thread_ids ); $i < $count; ++$i ) {
</ins><span class="cx">                         BP_Messages_Thread::mark_as_unread($thread_ids[$i]);
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -574,7 +574,7 @@
</span><span class="cx">         } else {
</span><span class="cx">                 $thread_ids = explode( ',', $_POST['thread_ids'] );
</span><span class="cx">
</span><del>-                for ( $i = 0; $i < count($thread_ids); $i++ ) {
</del><ins>+                for ( $i = 0, $count = count( $thread_ids ); $i < $count; ++$i ) {
</ins><span class="cx">                         BP_Messages_Thread::mark_as_read($thread_ids[$i]);
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -590,10 +590,10 @@
</span><span class="cx">         } else {
</span><span class="cx">                 $thread_ids = explode( ',', $_POST['thread_ids'] );
</span><span class="cx">
</span><del>-                for ( $i = 0; $i < count($thread_ids); $i++ )
</del><ins>+                for ( $i = 0, $count = count( $thread_ids ); $i < $count; ++$i )
</ins><span class="cx">                         BP_Messages_Thread::delete($thread_ids[$i]);
</span><span class="cx">
</span><del>-                _e('Messages deleted.', 'buddypress');
</del><ins>+                _e( 'Messages deleted.', 'buddypress' );
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp_ajax_messages_delete', 'bp_dtheme_ajax_messages_delete' );
</span></span></pre></div>
<a id="trunkbpxprofilebpxprofileclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile/bp-xprofile-classes.php (4769 => 4770)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile/bp-xprofile-classes.php        2011-07-21 21:33:20 UTC (rev 4769)
+++ trunk/bp-xprofile/bp-xprofile-classes.php        2011-07-21 22:27:09 UTC (rev 4770)
</span><span class="lines">@@ -72,7 +72,7 @@
</span><span class="cx">                         /* Remove the group's fields. */
</span><span class="cx">                         if ( BP_XProfile_Field::delete_for_group( $this->id ) ) {
</span><span class="cx">                                 /* Remove profile data for the groups fields */
</span><del>-                                for ( $i = 0; $i < count( $this->fields ); $i++ ) {
</del><ins>+                                for ( $i = 0, $count = count( $this->fields ); $i < $count; ++$i ) {
</ins><span class="cx">                                         BP_XProfile_ProfileData::delete_for_field( $this->fields[$i]->id );
</span><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="lines">@@ -586,12 +586,12 @@
</span><span class="cx">                                                                         $_POST["isDefault_{$type}_option"][$i]
</span><span class="cx">                                                 );
</span><span class="cx">
</span><del>-                                                $i++;
</del><ins>+                                                ++$i;
</ins><span class="cx">                                         }
</span><span class="cx">                                 }
</span><span class="cx">
</span><span class="cx">                                 if ( !empty( $options ) ) {
</span><del>-                                        for ( $i = 0; $i < count( $options ); $i++ ) {
</del><ins>+                                        for ( $i = 0, $count = count( $options ); $i < $count; ++$i ) {
</ins><span class="cx">                                                 $j = $i + 1;
</span><span class="cx">
</span><span class="cx">                                                 if ( 'multiselectbox' == $type || 'checkbox' == $type )
</span><span class="lines">@@ -910,7 +910,7 @@
</span><span class="cx">                 $field_sql = '';
</span><span class="cx">
</span><span class="cx">                 if ( is_array( $fields ) ) {
</span><del>-                        for ( $i = 0; $i < count( $fields ); $i++ ) {
</del><ins>+                        for ( $i = 0, $count = count( $fields ); $i < $count; ++$i ) {
</ins><span class="cx">                                 if ( $i == 0 )
</span><span class="cx">                                         $field_sql .= $wpdb->prepare( "AND ( f.name = %s ", $fields[$i] );
</span><span class="cx">                                 else
</span><span class="lines">@@ -930,7 +930,7 @@
</span><span class="cx">                 $new_values = array();
</span><span class="cx">
</span><span class="cx">                 if ( is_array( $fields ) ) {
</span><del>-                        for ( $i = 0; $i < count( $values ); $i++ ) {
</del><ins>+                        for ( $i = 0, $count = count( $values ); $i < $count; ++$i ) {
</ins><span class="cx">                                 for ( $j = 0; $j < count( $fields ); $j++ ) {
</span><span class="cx">                                         if ( $values[$i]->name == $fields[$j] )
</span><span class="cx">                                                 $new_values[$fields[$j]] = $values[$i]->value;
</span></span></pre></div>
<a id="trunkbpxprofilebpxprofiletemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-xprofile/bp-xprofile-template.php (4769 => 4770)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-xprofile/bp-xprofile-template.php        2011-07-21 21:33:20 UTC (rev 4769)
+++ trunk/bp-xprofile/bp-xprofile-template.php        2011-07-21 22:27:09 UTC (rev 4770)
</span><span class="lines">@@ -102,7 +102,7 @@
</span><span class="cx">         function has_fields() {
</span><span class="cx">                 $has_data = false;
</span><span class="cx">
</span><del>-                for ( $i = 0; $i < count( $this->group->fields ); $i++ ) {
</del><ins>+                for ( $i = 0, $count = count( $this->group->fields ); $i < $count; ++$i ) {
</ins><span class="cx">                         $field = &$this->group->fields[$i];
</span><span class="cx">
</span><span class="cx">                         if ( !empty( $field->data ) && $field->data->value != null ) {
</span><span class="lines">@@ -547,7 +547,7 @@
</span><span class="cx">                                         case 'day':
</span><span class="cx">                                                 $html .= '<option value=""' . selected( $day, '', false ) . '>--</option>';
</span><span class="cx">
</span><del>-                                                for ( $i = 1; $i < 32; $i++ ) {
</del><ins>+                                                for ( $i = 1; $i < 32; ++$i ) {
</ins><span class="cx">                                                         $html .= '<option value="' . $i .'"' . selected( $day, $i, false ) . '>' . $i . '</option>';
</span><span class="cx">                                                 }
</span><span class="cx">                                                 break;
</span><span class="lines">@@ -563,7 +563,7 @@
</span><span class="cx">
</span><span class="cx">                                                 $html .= '<option value=""' . selected( $month, '', false ) . '>------</option>';
</span><span class="cx">
</span><del>-                                                for ( $i = 0; $i < 12; $i++ ) {
</del><ins>+                                                for ( $i = 0; $i < 12; ++$i ) {
</ins><span class="cx">                                                         $html .= '<option value="' . $eng_months[$i] . '"' . selected( $month, $eng_months[$i], false ) . '>' . $months[$i] . '</option>';
</span><span class="cx">                                                 }
</span><span class="cx">                                                 break;
</span><span class="lines">@@ -633,7 +633,7 @@
</span><span class="cx">                 $group_name = bp_profile_group_name(false);
</span><span class="cx">
</span><span class="cx">         $tabs = array();
</span><del>-        for ( $i = 0, $count = count( $groups ); $i < $count; $i++ ) {
</del><ins>+        for ( $i = 0, $count = count( $groups ); $i < $count; ++$i ) {
</ins><span class="cx">                 if ( $group_name == $groups[$i]->name )
</span><span class="cx">                         $selected = ' class="current"';
</span><span class="cx">                 else
</span></span></pre>
</div>
</div>
</body>
</html>