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-core/bp-core-classes.php

    r5708 r5729  
    258258        if ( !empty( $include ) ) {
    259259            if ( is_array( $include ) ) {
    260                 $uids = $wpdb->escape( implode( ',', (array)$include ) );
     260                $uids = $wpdb->escape( implode( ',', (array) $include ) );
    261261            } else {
    262262                $uids = $wpdb->escape( $include );
     
    268268        } elseif ( !empty( $user_id ) && bp_is_active( 'friends' ) ) {
    269269            $friend_ids = friends_get_friend_user_ids( $user_id );
    270             $friend_ids = $wpdb->escape( implode( ',', (array)$friend_ids ) );
     270            $friend_ids = $wpdb->escape( implode( ',', (array) $friend_ids ) );
    271271
    272272            if ( !empty( $friend_ids ) ) {
     
    316316
    317317        // Get paginated results
    318         $paged_users_sql = apply_filters( 'bp_core_get_paged_users_sql', join( ' ', (array)$sql ), $sql );
     318        $paged_users_sql = apply_filters( 'bp_core_get_paged_users_sql', join( ' ', (array) $sql ), $sql );
    319319        $paged_users     = $wpdb->get_results( $paged_users_sql );
    320320
     
    341341
    342342        // Get total user results
    343         $total_users_sql = apply_filters( 'bp_core_get_total_users_sql', join( ' ', (array)$sql ), $sql );
     343        $total_users_sql = apply_filters( 'bp_core_get_total_users_sql', join( ' ', (array) $sql ), $sql );
    344344        $total_users     = $wpdb->get_var( $total_users_sql );
    345345
     
    351351            $user_ids = array();
    352352
    353             foreach ( (array)$paged_users as $user ) {
     353            foreach ( (array) $paged_users as $user ) {
    354354                $user_ids[] = $user->id;
    355355            }
    356356
    357             $user_ids = $wpdb->escape( join( ',', (array)$user_ids ) );
     357            $user_ids = $wpdb->escape( join( ',', (array) $user_ids ) );
    358358
    359359            // Add additional data to the returned results
     
    416416         */
    417417        $user_ids = array();
    418         foreach ( (array)$paged_users as $user )
     418        foreach ( (array) $paged_users as $user )
    419419            $user_ids[] = $user->id;
    420420
    421         $user_ids = $wpdb->escape( join( ',', (array)$user_ids ) );
     421        $user_ids = $wpdb->escape( join( ',', (array) $user_ids ) );
    422422
    423423        // Add additional data to the returned results
     
    503503         * We can't add these to the main query above since only users who have this information will be returned (since the much of the data is in usermeta and won't support any type of directional join)
    504504         */
    505         foreach ( (array)$paged_users as $user )
     505        foreach ( (array) $paged_users as $user )
    506506            $user_ids[] = $user->id;
    507507
    508         $user_ids = $wpdb->escape( join( ',', (array)$user_ids ) );
     508        $user_ids = $wpdb->escape( join( ',', (array) $user_ids ) );
    509509
    510510        // Add additional data to the returned results
     
    538538            $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() ) );
    539539            for ( $i = 0, $count = count( $paged_users ); $i < $count; ++$i ) {
    540                 foreach ( (array)$names as $name ) {
     540                foreach ( (array) $names as $name ) {
    541541                    if ( $name->id == $paged_users[$i]->id )
    542542                        $paged_users[$i]->fullname = $name->fullname;
     
    549549            $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' ) ) );
    550550            for ( $i = 0, $count = count( $paged_users ); $i < $count; ++$i ) {
    551                 foreach ( (array)$friend_count as $fcount ) {
     551                foreach ( (array) $friend_count as $fcount ) {
    552552                    if ( $fcount->id == $paged_users[$i]->id )
    553                         $paged_users[$i]->total_friend_count = (int)$fcount->total_friend_count;
     553                        $paged_users[$i]->total_friend_count = (int) $fcount->total_friend_count;
    554554                }
    555555            }
     
    560560            $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() ) );
    561561            for ( $i = 0, $count = count( $paged_users ); $i < $count; ++$i ) {
    562                 foreach ( (array)$friend_status as $status ) {
     562                foreach ( (array) $friend_status as $status ) {
    563563                    if ( $status->initiator_user_id == $paged_users[$i]->id || $status->friend_user_id == $paged_users[$i]->id )
    564564                        $paged_users[$i]->is_friend = $status->is_confirmed;
     
    570570            $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' ) ) );
    571571            for ( $i = 0, $count = count( $paged_users ); $i < $count; ++$i ) {
    572                 foreach ( (array)$user_activity as $activity ) {
     572                foreach ( (array) $user_activity as $activity ) {
    573573                    if ( $activity->id == $paged_users[$i]->id )
    574574                        $paged_users[$i]->last_activity = $activity->last_activity;
     
    581581            $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' ) ) );
    582582            for ( $i = 0, $count = count( $paged_users ); $i < $count; ++$i ) {
    583                 foreach ( (array)$user_activity as $activity ) {
     583                foreach ( (array) $user_activity as $activity ) {
    584584                    if ( $activity->id == $paged_users[$i]->id )
    585585                        $paged_users[$i]->last_activity = $activity->last_activity;
     
    591591        $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' ) ) );
    592592        for ( $i = 0, $count = count( $paged_users ); $i < $count; ++$i ) {
    593             foreach ( (array)$user_update as $update ) {
     593            foreach ( (array) $user_update as $update ) {
    594594                if ( $update->id == $paged_users[$i]->id )
    595595                    $paged_users[$i]->latest_update = $update->latest_update;
     
    12081208        $is_oembed_link = false;
    12091209        if ( !$attr['discover'] ) {
    1210             foreach ( (array)$oembed_obj->providers as $provider_matchmask => $provider ) {
     1210            foreach ( (array) $oembed_obj->providers as $provider_matchmask => $provider ) {
    12111211                $regex = ( $is_regex = $provider[1] ) ? $provider_matchmask : '#' . str_replace( '___wildcard___', '(.+)', preg_quote( str_replace( '*', '___wildcard___', $provider_matchmask ), '#' ) ) . '#i';
    12121212
Note: See TracChangeset for help on using the changeset viewer.