Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/11/2012 09:32:04 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Breathing room for cast variables.

File:
1 edited

Legend:

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

    r5704 r5729  
    173173        $activity_user_ids = array();
    174174        if ( bp_is_active( 'xprofile' ) && $activities ) {
    175             foreach ( (array)$activities as $activity ) {
    176                 if ( (int)$activity->user_id )
     175            foreach ( (array) $activities as $activity ) {
     176                if ( (int) $activity->user_id )
    177177                    $activity_user_ids[] = $activity->user_id;
    178178            }
    179179
    180             $activity_user_ids = implode( ',', array_unique( (array)$activity_user_ids ) );
     180            $activity_user_ids = implode( ',', array_unique( (array) $activity_user_ids ) );
    181181            if ( !empty( $activity_user_ids ) ) {
    182182                if ( $names = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, value AS user_fullname FROM {$bp->profile->table_name_data} WHERE field_id = 1 AND user_id IN ({$activity_user_ids})" ) ) ) {
    183                     foreach ( (array)$names as $name )
     183                    foreach ( (array) $names as $name )
    184184                        $tmp_names[$name->user_id] = $name->user_fullname;
    185185
    186                     foreach ( (array)$activities as $i => $activity ) {
     186                    foreach ( (array) $activities as $i => $activity ) {
    187187                        if ( !empty( $tmp_names[$activity->user_id] ) )
    188188                            $activities[$i]->user_fullname = $tmp_names[$activity->user_id];
     
    197197        // Get activity meta
    198198        $activity_ids = array();
    199         foreach ( (array)$activities as $activity ) {
     199        foreach ( (array) $activities as $activity ) {
    200200            $activity_ids[] = $activity->id;
    201201        }
     
    210210        // If $max is set, only return up to the max results
    211211        if ( !empty( $max ) ) {
    212             if ( (int)$total_activities > (int)$max )
     212            if ( (int) $total_activities > (int) $max )
    213213                $total_activities = $max;
    214214        }
    215215
    216         return array( 'activities' => $activities, 'total' => (int)$total_activities );
     216        return array( 'activities' => $activities, 'total' => (int) $total_activities );
    217217    }
    218218
     
    386386
    387387        /* Now fetch the activity comments and parse them into the correct position in the activities array. */
    388         foreach( (array)$activities as $activity ) {
     388        foreach( (array) $activities as $activity ) {
    389389            if ( 'activity_comment' != $activity->type && $activity->mptt_left && $activity->mptt_right )
    390390                $activity_comments[$activity->id] = BP_Activity_Activity::get_activity_comments( $activity->id, $activity->mptt_left, $activity->mptt_right, $spam );
     
    392392
    393393        /* Merge the comments with the activity items */
    394         foreach( (array)$activities as $key => $activity )
     394        foreach( (array) $activities as $key => $activity )
    395395            if ( isset( $activity_comments[$activity->id] ) )
    396396                $activities[$key]->children = $activity_comments[$activity->id];
     
    440440
    441441            // Loop descendants and build an assoc array
    442             foreach ( (array)$descendants as $d ) {
     442            foreach ( (array) $descendants as $d ) {
    443443                $d->children = array();
    444444
     
    470470
    471471        // Loop the descendants and recalculate the left and right values
    472         foreach ( (array)$descendants as $descendant )
     472        foreach ( (array) $descendants as $descendant )
    473473            $right = BP_Activity_Activity::rebuild_activity_comment_tree( $descendant->id, $right );
    474474
Note: See TracChangeset for help on using the changeset viewer.