Skip to:
Content

BuddyPress.org

Changeset 5729


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

Breathing room for cast variables.

Location:
trunk
Files:
54 edited

Legend:

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

    r5684 r5729  
    271271        // Post to groups object
    272272        } else if ( 'groups' == $object && bp_is_active( 'groups' ) ) {
    273                 if ( (int)$item_id ) {
     273                if ( (int) $item_id ) {
    274274                        $activity_id = groups_post_update( array( 'content' => $content, 'group_id' => $item_id ) );
    275275                }
  • 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
  • trunk/bp-activity/bp-activity-filters.php

    r5609 r5729  
    220220
    221221        $usernames = bp_activity_find_mentions( $content );
    222         foreach( (array)$usernames as $username ) {
     222        foreach( (array) $usernames as $username ) {
    223223                if ( bp_is_username_compatibility_mode() )
    224224                        $user_id = username_exists( $username );
  • trunk/bp-activity/bp-activity-functions.php

    r5705 r5729  
    8080
    8181        if ( $usernames = bp_activity_find_mentions( strip_tags( $activity->content ) ) ) {
    82                 foreach( (array)$usernames as $username ) {
     82                foreach( (array) $usernames as $username ) {
    8383                        if ( bp_is_username_compatibility_mode() )
    8484                                $user_id = username_exists( $username );
     
    105105                                default :
    106106                                        if ( !in_array( $activity_id, $new_mentions ) ) {
    107                                                 $new_mentions[] = (int)$activity_id;
     107                                                $new_mentions[] = (int) $activity_id;
    108108                                        }
    109109                                        break;
     
    149149                        $at_mention_title = sprintf( __( '@%s Mentions', 'buddypress' ), bp_get_loggedin_user_username() );
    150150
    151                         if ( (int)$total_items > 1 ) {
     151                        if ( (int) $total_items > 1 ) {
    152152                                $text = sprintf( __( 'You have %1$d new activity mentions', 'buddypress' ), (int) $total_items );
    153153                                $filter = 'bp_activity_multiple_at_mentions_notification';
     
    161161
    162162        if ( 'string' == $format ) {
    163                 $return = apply_filters( $filter, '<a href="' . $at_mention_link . '" title="' . $at_mention_title . '">' . $text . '</a>', $at_mention_link, (int)$total_items, $activity_id, $poster_user_id );
     163                $return = apply_filters( $filter, '<a href="' . $at_mention_link . '" title="' . $at_mention_title . '">' . $text . '</a>', $at_mention_link, (int) $total_items, $activity_id, $poster_user_id );
    164164        } else {
    165165                $return = apply_filters( $filter, array(
    166166                        'text' => $text,
    167167                        'link' => $at_mention_link
    168                 ), $at_mention_link, (int)$total_items, $activity_id, $poster_user_id );
     168                ), $at_mention_link, (int) $total_items, $activity_id, $poster_user_id );
    169169        }
    170170
     
    289289        // Update the total number of users who have favorited this activity
    290290        $fav_count = bp_activity_get_meta( $activity_id, 'favorite_count' );
    291         $fav_count = !empty( $fav_count ) ? (int)$fav_count + 1 : 1;
     291        $fav_count = !empty( $fav_count ) ? (int) $fav_count + 1 : 1;
    292292
    293293        // Update user meta
     
    349349
    350350                // Deduct from total favorites
    351                 if ( bp_activity_update_meta( $activity_id, 'favorite_count', (int)$fav_count - 1 ) ) {
     351                if ( bp_activity_update_meta( $activity_id, 'favorite_count', (int) $fav_count - 1 ) ) {
    352352
    353353                        // Update users favorites
     
    527527                               
    528528                if ( !empty( $metas ) ) {
    529                         $metas = array_map( 'maybe_unserialize', (array)$metas );
     529                        $metas = array_map( 'maybe_unserialize', (array) $metas );
    530530                       
    531531                        foreach( $metas as $mkey => $mvalue ) {
     
    540540
    541541        // Maybe, just maybe... unserialize
    542         $metas = array_map( 'maybe_unserialize', (array)$metas );
     542        $metas = array_map( 'maybe_unserialize', (array) $metas );
    543543
    544544        // Return first item in array if only 1, else return all metas found
     
    819819
    820820        // Attempt to return a cached copy of the first page of sitewide activity.
    821         if ( 1 == (int)$page && empty( $max ) && empty( $search_terms ) && empty( $filter ) && empty( $exclude ) && empty( $in ) && 'DESC' == $sort && empty( $exclude ) && 'ham_only' == $spam ) {
     821        if ( 1 == (int) $page && empty( $max ) && empty( $search_terms ) && empty( $filter ) && empty( $exclude ) && empty( $in ) && 'DESC' == $sort && empty( $exclude ) && 'ham_only' == $spam ) {
    822822                if ( !$activity = wp_cache_get( 'bp_activity_sitewide_front', 'bp' ) ) {
    823823                        $activity = BP_Activity_Activity::get( $max, $page, $per_page, $sort, $search_terms, $filter, $display_comments, $show_hidden, false, false, $spam );
     
    10341034        // Check to see if the parent activity is hidden, and if so, hide this comment publically.
    10351035        $activity = new BP_Activity_Activity( $activity_id );
    1036         $is_hidden = ( (int)$activity->hide_sitewide ) ? 1 : 0;
     1036        $is_hidden = ( (int) $activity->hide_sitewide ) ? 1 : 0;
    10371037
    10381038        // Insert the activity comment
     
    11551155        $latest_update = bp_get_user_meta( $user_id, 'bp_latest_update', true );
    11561156        if ( !empty( $latest_update ) ) {
    1157                 if ( in_array( (int)$latest_update['id'], (array)$activity_ids_deleted ) ) {
     1157                if ( in_array( (int) $latest_update['id'], (array) $activity_ids_deleted ) ) {
    11581158                        bp_delete_user_meta( $user_id, 'bp_latest_update' );
    11591159                }
     
    13101310                // Recursively delete all children of this comment.
    13111311                if ( $children = BP_Activity_Activity::get_child_comments( $comment_id ) ) {
    1312                         foreach( (array)$children as $child ) {
     1312                        foreach( (array) $children as $child ) {
    13131313                                bp_activity_delete_children( $activity_id, $child->id );
    13141314                        }
     
    14081408                        }
    14091409
    1410                         $ratio      = (int)$width / (int)$height;
    1411                         $new_height = (int)$height >= 100 ? 100 : $height;
     1410                        $ratio      = (int) $width / (int) $height;
     1411                        $new_height = (int) $height >= 100 ? 100 : $height;
    14121412                        $new_width  = $new_height * $ratio;
    14131413
  • trunk/bp-activity/bp-activity-template.php

    r5705 r5729  
    125125                        $this->activities = bp_activity_get( array( 'display_comments' => $display_comments, 'max' => $max, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'sort' => $sort, 'search_terms' => $search_terms, 'filter' => $filter, 'show_hidden' => $show_hidden, 'exclude' => $exclude, 'in' => $in, 'spam' => $spam ) );
    126126
    127                 if ( !$max || $max >= (int)$this->activities['total'] )
    128                         $this->total_activity_count = (int)$this->activities['total'];
     127                if ( !$max || $max >= (int) $this->activities['total'] )
     128                        $this->total_activity_count = (int) $this->activities['total'];
    129129                else
    130                         $this->total_activity_count = (int)$max;
     130                        $this->total_activity_count = (int) $max;
    131131
    132132                $this->activities = $this->activities['activities'];
     
    136136                                $this->activity_count = count( $this->activities );
    137137                        } else {
    138                                 $this->activity_count = (int)$max;
     138                                $this->activity_count = (int) $max;
    139139                        }
    140140                } else {
     
    145145
    146146                // Fetch parent content for activity comments so we do not have to query in the loop
    147                 foreach ( (array)$this->activities as $activity ) {
     147                foreach ( (array) $this->activities as $activity ) {
    148148                        if ( 'activity_comment' != $activity->type )
    149149                                continue;
     
    162162                }
    163163
    164                 if ( (int)$this->total_activity_count && (int)$this->pag_num ) {
     164                if ( (int) $this->total_activity_count && (int) $this->pag_num ) {
    165165                        $this->pag_links = paginate_links( array(
    166166                                'base'      => add_query_arg( 'acpage', '%#%' ),
    167167                                'format'    => '',
    168                                 'total'     => ceil( (int)$this->total_activity_count / (int)$this->pag_num ),
    169                                 'current'   => (int)$this->pag_page,
     168                                'total'     => ceil( (int) $this->total_activity_count / (int) $this->pag_num ),
     169                                'current'   => (int) $this->pag_page,
    170170                                'prev_text' => _x( '&larr;', 'Activity pagination previous text', 'buddypress' ),
    171171                                'next_text' => _x( '&rarr;', 'Activity pagination next text', 'buddypress' ),
     
    277277
    278278        // The default scope should recognize custom slugs
    279         if ( array_key_exists( $bp->current_action, (array)$bp->loaded_components ) ) {
     279        if ( array_key_exists( $bp->current_action, (array) $bp->loaded_components ) ) {
    280280                $scope = $bp->loaded_components[$bp->current_action];
    281281        }
     
    337337                                                        return false;
    338338
    339                                                 $user_id = implode( ',', (array)$friends );
     339                                                $user_id = implode( ',', (array) $friends );
    340340                                        break;
    341341                                case 'groups':
     
    346346
    347347                                                $object = $bp->groups->id;
    348                                                 $primary_id = implode( ',', (array)$groups['groups'] );
     348                                                $primary_id = implode( ',', (array) $groups['groups'] );
    349349
    350350                                                $user_id = 0;
     
    356356                                                return false;
    357357
    358                                         $include          = implode( ',', (array)$favs );
     358                                        $include          = implode( ',', (array) $favs );
    359359                                        $display_comments = true;
    360360                                        break;
     
    497497
    498498        $remaining_pages = floor( ( $activities_template->total_activity_count - 1 ) / ( $activities_template->pag_num * $activities_template->pag_page ) );
    499         $has_more_items  = (int)$remaining_pages ? true : false;
     499        $has_more_items  = (int) $remaining_pages ? true : false;
    500500
    501501        return apply_filters( 'bp_activity_has_more_items', $has_more_items );
     
    526526                global $activities_template;
    527527
    528                 return apply_filters( 'bp_get_activity_count', (int)$activities_template->activity_count );
     528                return apply_filters( 'bp_get_activity_count', (int) $activities_template->activity_count );
    529529        }
    530530
     
    553553                global $activities_template;
    554554
    555                 return apply_filters( 'bp_get_activity_per_page', (int)$activities_template->pag_num );
     555                return apply_filters( 'bp_get_activity_per_page', (int) $activities_template->pag_num );
    556556        }
    557557
     
    13231323                global $activities_template;
    13241324
    1325                 return apply_filters( 'bp_get_activity_is_favorite', in_array( $activities_template->activity->id, (array)$activities_template->my_favs ) );
     1325                return apply_filters( 'bp_get_activity_is_favorite', in_array( $activities_template->activity->id, (array) $activities_template->my_favs ) );
    13261326        }
    13271327
     
    13881388
    13891389                        echo '<ul>';
    1390                         foreach ( (array)$comment->children as $comment_child ) {
     1390                        foreach ( (array) $comment->children as $comment_child ) {
    13911391                                // Put the comment into the global so it's available to filters
    13921392                                $activities_template->activity->current_comment = $comment_child;
     
    16821682                $count = bp_activity_recurse_comment_count( $activities_template->activity );
    16831683
    1684                 return apply_filters( 'bp_activity_get_comment_count', (int)$count );
     1684                return apply_filters( 'bp_activity_get_comment_count', (int) $count );
    16851685        }
    16861686
     
    19471947
    19481948                $class = '';
    1949                 if ( in_array( $activities_template->activity->type, (array)$mini_activity_actions ) || empty( $activities_template->activity->content ) )
     1949                if ( in_array( $activities_template->activity->type, (array) $mini_activity_actions ) || empty( $activities_template->activity->content ) )
    19501950                        $class = ' mini';
    19511951
     
    21582158        $can_comment = true;
    21592159
    2160         if ( false === $activities_template->disable_blogforum_replies || (int)$activities_template->disable_blogforum_replies ) {
     2160        if ( false === $activities_template->disable_blogforum_replies || (int) $activities_template->disable_blogforum_replies ) {
    21612161                if ( 'new_blog_post' == bp_get_activity_action_name() || 'new_blog_comment' == bp_get_activity_action_name() || 'new_forum_topic' == bp_get_activity_action_name() || 'new_forum_post' == bp_get_activity_action_name() )
    21622162                        $can_comment = false;
  • trunk/bp-activity/feeds/bp-activity-favorites-feed.php

    r5394 r5729  
    3838        <?php
    3939                $favs = bp_activity_get_user_favorites( bp_displayed_user_id() );
    40                 $fav_ids = implode( ',', (array)$favs );
     40                $fav_ids = implode( ',', (array) $favs );
    4141        ?>
    4242
  • trunk/bp-blogs/bp-blogs-buddybar.php

    r5704 r5729  
    3737
    3838        $counter = 0;
    39         if ( is_array( $blogs['blogs'] ) && (int)$blogs['count'] ) {
     39        if ( is_array( $blogs['blogs'] ) && (int) $blogs['count'] ) {
    4040
    4141                echo '<li id="bp-adminbar-blogs-menu"><a href="' . trailingslashit( bp_loggedin_user_domain() . bp_get_blogs_slug() ) . '">';
     
    4646                echo '<ul>';
    4747
    48                 foreach ( (array)$blogs['blogs'] as $blog ) {
     48                foreach ( (array) $blogs['blogs'] as $blog ) {
    4949                        $alt      = ( 0 == $counter % 2 ) ? ' class="alt"' : '';
    5050                        $site_url = esc_attr( $blog->siteurl );
  • trunk/bp-blogs/bp-blogs-classes.php

    r5686 r5729  
    123123
    124124                $blog_ids = array();
    125                 foreach ( (array)$paged_blogs as $blog ) {
     125                foreach ( (array) $paged_blogs as $blog ) {
    126126                        $blog_ids[] = $blog->blog_id;
    127127                }
    128128
    129                 $blog_ids = $wpdb->escape( join( ',', (array)$blog_ids ) );
     129                $blog_ids = $wpdb->escape( join( ',', (array) $blog_ids ) );
    130130                $paged_blogs = BP_Blogs_Blog::get_blog_extras( $paged_blogs, $blog_ids, $type );
    131131
     
    173173
    174174                $user_blogs = array();
    175                 foreach ( (array)$blogs as $blog ) {
     175                foreach ( (array) $blogs as $blog ) {
    176176                        $user_blogs[$blog->blog_id] = new stdClass;
    177177                        $user_blogs[$blog->blog_id]->id = $blog->id;
     
    273273
    274274                for ( $i = 0, $count = count( $paged_blogs ); $i < $count; ++$i ) {
    275                         foreach ( (array)$blog_descs as $desc ) {
     275                        foreach ( (array) $blog_descs as $desc ) {
    276276                                if ( $desc->blog_id == $paged_blogs[$i]->blog_id )
    277277                                        $paged_blogs[$i]->description = $desc->description;
     
    285285                global $wpdb;
    286286
    287                 if ( !(int)$wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT public FROM {$wpdb->base_prefix}blogs WHERE blog_id = %d", $blog_id ) ) )
     287                if ( !(int) $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT public FROM {$wpdb->base_prefix}blogs WHERE blog_id = %d", $blog_id ) ) )
    288288                        return true;
    289289
  • trunk/bp-blogs/bp-blogs-functions.php

    r5686 r5729  
    5555
    5656        if ( $blog_ids ) {
    57                 foreach( (array)$blog_ids as $blog_id ) {
     57                foreach( (array) $blog_ids as $blog_id ) {
    5858                        $users          = get_users( array( 'blog_id' => $blog_id ) );
    5959                        $subscribers    = get_users( array( 'blog_id' => $blog_id, 'role' => 'subscriber' ) );
    6060
    6161                        if ( !empty( $users ) ) {
    62                                 foreach ( (array)$users as $user ) {
     62                                foreach ( (array) $users as $user ) {
    6363                                        // Don't record blogs for subscribers
    6464                                        if ( !in_array( $user, $subscribers ) )
     
    100100        bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'last_activity', bp_core_current_time() );
    101101
    102         $is_private = !empty( $_POST['blog_public'] ) && (int)$_POST['blog_public'] ? false : true;
     102        $is_private = !empty( $_POST['blog_public'] ) && (int) $_POST['blog_public'] ? false : true;
    103103        $is_private = !apply_filters( 'bp_is_new_blog_public', !$is_private );
    104104
     
    150150        global $bp, $wpdb;
    151151
    152         $post_id = (int)$post_id;
    153         $blog_id = (int)$wpdb->blogid;
     152        $post_id = (int) $post_id;
     153        $blog_id = (int) $wpdb->blogid;
    154154
    155155        if ( !$user_id )
    156                 $user_id = (int)$post->post_author;
     156                $user_id = (int) $post->post_author;
    157157
    158158        // Stop infinite loops with WordPress MU Sitewide Tags.
     
    165165        }
    166166
    167         if ( (int)$blog_id == $tags_blog_id && apply_filters( 'bp_blogs_block_sitewide_tags_activity', true ) )
     167        if ( (int) $blog_id == $tags_blog_id && apply_filters( 'bp_blogs_block_sitewide_tags_activity', true ) )
    168168                return false;
    169169
     
    181181
    182182                        if ( is_multisite() )
    183                                 $activity_action  = sprintf( __( '%1$s wrote a new post, %2$s, on the site %3$s', 'buddypress' ), bp_core_get_userlink( (int)$post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>', '<a href="' . get_blog_option( $blog_id, 'home' ) . '">' . get_blog_option( $blog_id, 'blogname' ) . '</a>' );
     183                                $activity_action  = sprintf( __( '%1$s wrote a new post, %2$s, on the site %3$s', 'buddypress' ), bp_core_get_userlink( (int) $post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>', '<a href="' . get_blog_option( $blog_id, 'home' ) . '">' . get_blog_option( $blog_id, 'blogname' ) . '</a>' );
    184184                        else
    185                                 $activity_action  = sprintf( __( '%1$s wrote a new post, %2$s', 'buddypress' ), bp_core_get_userlink( (int)$post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>' );
     185                                $activity_action  = sprintf( __( '%1$s wrote a new post, %2$s', 'buddypress' ), bp_core_get_userlink( (int) $post->post_author ), '<a href="' . $post_permalink . '">' . $post->post_title . '</a>' );
    186186
    187187                        // Make sure there's not an existing entry for this post (prevent bumping)
     
    189189                                $existing = bp_activity_get( array(
    190190                                        'filter' => array(
    191                                                 'user_id'      => (int)$post->post_author,
     191                                                'user_id'      => (int) $post->post_author,
    192192                                                'action'       => 'new_blog_post',
    193193                                                'primary_id'   => $blog_id,
     
    204204
    205205                        bp_blogs_record_activity( array(
    206                                 'user_id'           => (int)$post->post_author,
     206                                'user_id'           => (int) $post->post_author,
    207207                                'action'            => apply_filters( 'bp_blogs_activity_new_post_action',       $activity_action,  $post, $post_permalink ),
    208208                                'content'           => apply_filters( 'bp_blogs_activity_new_post_content',      $activity_content, $post, $post_permalink ),
     
    248248        // Get the user_id from the comment author email.
    249249        $user    = get_user_by( 'email', $recorded_comment->comment_author_email );
    250         $user_id = (int)$user->ID;
     250        $user_id = (int) $user->ID;
    251251
    252252        // If there's no registered user id, don't record activity
     
    345345        global $bp;
    346346
    347         $blog_id = (int)$blog_id;
     347        $blog_id = (int) $blog_id;
    348348        do_action( 'bp_blogs_before_remove_blog', $blog_id );
    349349
     
    384384                return false;
    385385
    386         $post_id = (int)$post_id;
     386        $post_id = (int) $post_id;
    387387
    388388        if ( !$blog_id )
    389                 $blog_id = (int)$wpdb->blogid;
     389                $blog_id = (int) $wpdb->blogid;
    390390
    391391        if ( !$user_id )
     
    597597        }
    598598
    599         $metas = array_map('maybe_unserialize', (array)$metas);
     599        $metas = array_map('maybe_unserialize', (array) $metas);
    600600
    601601        if ( 1 == count($metas) )
  • trunk/bp-blogs/bp-blogs-template.php

    r5686 r5729  
    117117                        $this->blogs = bp_blogs_get_blogs( array( 'type' => $type, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'user_id' => $user_id, 'search_terms' => $search_terms ) );
    118118
    119                 if ( !$max || $max >= (int)$this->blogs['total'] )
    120                         $this->total_blog_count = (int)$this->blogs['total'];
     119                if ( !$max || $max >= (int) $this->blogs['total'] )
     120                        $this->total_blog_count = (int) $this->blogs['total'];
    121121                else
    122                         $this->total_blog_count = (int)$max;
     122                        $this->total_blog_count = (int) $max;
    123123
    124124                $this->blogs = $this->blogs['blogs'];
     
    128128                                $this->blog_count = count( $this->blogs );
    129129                        } else {
    130                                 $this->blog_count = (int)$max;
     130                                $this->blog_count = (int) $max;
    131131                        }
    132132                } else {
     
    134134                }
    135135
    136                 if ( (int)$this->total_blog_count && (int)$this->pag_num ) {
     136                if ( (int) $this->total_blog_count && (int) $this->pag_num ) {
    137137                        $this->pag_links = paginate_links( array(
    138138                                'base'      => add_query_arg( 'bpage', '%#%' ),
    139139                                'format'    => '',
    140                                 'total'     => ceil( (int)$this->total_blog_count / (int)$this->pag_num ),
    141                                 'current'   => (int)$this->pag_page,
     140                                'total'     => ceil( (int) $this->total_blog_count / (int) $this->pag_num ),
     141                                'current'   => (int) $this->pag_page,
    142142                                'prev_text' => _x( '&larr;', 'Blog pagination previous text', 'buddypress' ),
    143143                                'next_text' => _x( '&rarr;', 'Blog pagination next text', 'buddypress' ),
  • trunk/bp-core/admin/bp-core-functions.php

    r5575 r5729  
    244244        // The best way to remove this notice is to add a "buddypress" tag to
    245245        // your active theme's CSS header.
    246         if ( !defined( 'BP_SILENCE_THEME_NOTICE' ) && !in_array( 'buddypress', (array)$ct->tags ) ) {
     246        if ( !defined( 'BP_SILENCE_THEME_NOTICE' ) && !in_array( 'buddypress', (array) $ct->tags ) ) {
    247247                bp_core_add_admin_notice( sprintf( __( "You'll need to <a href='%s'>activate a <strong>BuddyPress-compatible theme</strong></a> to take advantage of all of BuddyPress's features. We've bundled a default theme, but you can always <a href='%s'>install some other compatible themes</a> or <a href='%s'>update your existing WordPress theme</a>.", 'buddypress' ), admin_url( 'themes.php' ), network_admin_url( 'theme-install.php?type=tag&s=buddypress&tab=search' ), network_admin_url( 'plugin-install.php?type=term&tab=search&s=%22bp-template-pack%22' ) ) );
    248248        }
  • trunk/bp-core/admin/bp-core-settings.php

    r5727 r5729  
    189189                // in the $_POST array when unchecked, we loop through the registered settings
    190190                if ( isset( $wp_settings_fields['buddypress'] ) ) {
    191                         foreach( (array)$wp_settings_fields['buddypress'] as $section => $settings ) {
     191                        foreach( (array) $wp_settings_fields['buddypress'] as $section => $settings ) {
    192192                                foreach( $settings as $setting_name => $setting ) {
    193193                                        $value = isset( $_POST[$setting_name] ) ? $_POST[$setting_name] : '';
  • trunk/bp-core/admin/bp-core-slugs.php

    r5683 r5729  
    196196                        $directory_pages = array();
    197197
    198                         foreach ( (array)$_POST['bp_pages'] as $key => $value ) {
     198                        foreach ( (array) $_POST['bp_pages'] as $key => $value ) {
    199199                                if ( !empty( $value ) ) {
    200                                         $directory_pages[$key] = (int)$value;
     200                                        $directory_pages[$key] = (int) $value;
    201201                                }
    202202                        }
  • trunk/bp-core/admin/bp-core-update.php

    r5727 r5729  
    6767        function current_step() {
    6868                if ( isset( $_POST['step'] ) ) {
    69                         $current_step = (int)$_POST['step'] + 1;
     69                        $current_step = (int) $_POST['step'] + 1;
    7070                } else {
    7171                        if ( !empty( $_COOKIE['bp-wizard-step'] ) ) {
     
    153153
    154154                if ( 'finish' != $step_name )
    155                         setcookie( 'bp-wizard-step', (int)$this->current_step, time() + 60 * 60 * 24, COOKIEPATH );
     155                        setcookie( 'bp-wizard-step', (int) $this->current_step, time() + 60 * 60 * 24, COOKIEPATH );
    156156        }
    157157
     
    181181                                        <ol>
    182182
    183                                                 <?php foreach( (array)$this->steps as $i => $name ) : ?>
     183                                                <?php foreach( (array) $this->steps as $i => $name ) : ?>
    184184
    185185                                                        <li<?php if ( $this->current_step == $i ) : ?> class="current"<?php endif; ?>>
     
    558558                $bp_theme_installed      = false;
    559559
    560                 foreach ( (array)$installed_plugins as $plugin ) {
     560                foreach ( (array) $installed_plugins as $plugin ) {
    561561                        if ( 'BuddyPress Template Pack' == $plugin['Name'] ) {
    562562                                $template_pack_installed = true;
     
    564564                }
    565565
    566                 foreach ( (array)$installed_themes as $theme ) {
    567                         foreach ( (array)$theme['Tags'] as $tag ) {
     566                foreach ( (array) $installed_themes as $theme ) {
     567                        foreach ( (array) $theme['Tags'] as $tag ) {
    568568                                if ( ( 'BuddyPress Default' != $theme['Name'] ) && ( 'buddypress' == $tag ) ) {
    569569                                        $bp_theme_installed = true;
     
    798798                        }
    799799
    800                         $blog_pages   = $this->setup_pages( (array)$_POST['bp_pages'] );
     800                        $blog_pages   = $this->setup_pages( (array) $_POST['bp_pages'] );
    801801                        bp_update_option( 'bp-pages', $blog_pages );
    802802
     
    10351035                                // Check for the selected page
    10361036                                if ( !empty( $_POST['bp-' . $key . '-page'] ) )
    1037                                         $bp_pages[$key] = (int)$_POST['bp-' . $key . '-page'];
     1037                                        $bp_pages[$key] = (int) $_POST['bp-' . $key . '-page'];
    10381038                                else
    10391039                                        $bp_pages[$key] = wp_insert_post( array( 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_title' => ucwords( $key ), 'post_status' => 'publish', 'post_type' => 'page' ) );
     
    11281128
    11291129        // On first installation - record all existing blogs in the system.
    1130         if ( !(int)$bp->site_options['bp-blogs-first-install'] ) {
     1130        if ( !(int) $bp->site_options['bp-blogs-first-install'] ) {
    11311131                bp_blogs_record_existing_blogs();
    11321132                bp_update_option( 'bp-blogs-first-install', 1 );
  • trunk/bp-core/bp-core-avatars.php

    r5683 r5729  
    598598
    599599        // Make sure we at least have a width and height for cropping
    600         if ( !(int)$crop_w )
     600        if ( !(int) $crop_w )
    601601                $crop_w = bp_core_avatar_full_width();
    602602
    603         if ( !(int)$crop_h )
     603        if ( !(int) $crop_h )
    604604                $crop_h = bp_core_avatar_full_height();
    605605
     
    609609
    610610        // Crop the image
    611         $full_cropped  = wp_crop_image( $original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, bp_core_avatar_full_width(), bp_core_avatar_full_height(), false, $avatar_folder_dir . '/' . $full_filename );
    612         $thumb_cropped = wp_crop_image( $original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, bp_core_avatar_thumb_width(), bp_core_avatar_thumb_height(), false, $avatar_folder_dir . '/' . $thumb_filename );
     611        $full_cropped  = wp_crop_image( $original_file, (int) $crop_x, (int) $crop_y, (int) $crop_w, (int) $crop_h, bp_core_avatar_full_width(), bp_core_avatar_full_height(), false, $avatar_folder_dir . '/' . $full_filename );
     612        $thumb_cropped = wp_crop_image( $original_file, (int) $crop_x, (int) $crop_y, (int) $crop_w, (int) $crop_h, bp_core_avatar_thumb_width(), bp_core_avatar_thumb_height(), false, $avatar_folder_dir . '/' . $thumb_filename );
    613613
    614614        // Check for errors
     
    808808        global $bp;
    809809       
    810         $dim = isset( $bp->avatar->{$type}->{$h_or_w} ) ? (int)$bp->avatar->{$type}->{$h_or_w} : false;
     810        $dim = isset( $bp->avatar->{$type}->{$h_or_w} ) ? (int) $bp->avatar->{$type}->{$h_or_w} : false;
    811811       
    812812        return apply_filters( 'bp_core_avatar_dimension', $dim, $type, $h_or_w );
     
    872872        global $bp;
    873873       
    874         return apply_filters( 'bp_core_avatar_original_max_width', (int)$bp->avatar->original_max_width );
     874        return apply_filters( 'bp_core_avatar_original_max_width', (int) $bp->avatar->original_max_width );
    875875}
    876876
     
    886886        global $bp;
    887887       
    888         return apply_filters( 'bp_core_avatar_original_max_filesize', (int)$bp->avatar->original_max_filesize );
     888        return apply_filters( 'bp_core_avatar_original_max_filesize', (int) $bp->avatar->original_max_filesize );
    889889}
    890890
  • trunk/bp-core/bp-core-buddybar.php

    r5704 r5729  
    151151                return false;
    152152
    153         foreach ( (array)$bp->bp_nav as $slug => $nav_item ) {
     153        foreach ( (array) $bp->bp_nav as $slug => $nav_item ) {
    154154                if ( empty( $temp[$nav_item['position']]) )
    155155                        $temp[$nav_item['position']] = $nav_item;
     
    288288                return false;
    289289
    290         foreach ( (array)$bp->bp_options_nav as $parent_slug => $subnav_items ) {
     290        foreach ( (array) $bp->bp_options_nav as $parent_slug => $subnav_items ) {
    291291                if ( !is_array( $subnav_items ) )
    292292                        continue;
    293293
    294                 foreach ( (array)$subnav_items as $subnav_item ) {
     294                foreach ( (array) $subnav_items as $subnav_item ) {
    295295                        if ( empty( $temp[$subnav_item['position']]) )
    296296                                $temp[$subnav_item['position']] = $subnav_item;
     
    344344        // Unset subnav items for this nav item
    345345        if ( isset( $bp->bp_options_nav[$parent_id] ) && is_array( $bp->bp_options_nav[$parent_id] ) ) {
    346                 foreach( (array)$bp->bp_options_nav[$parent_id] as $subnav_item ) {
     346                foreach( (array) $bp->bp_options_nav[$parent_id] as $subnav_item ) {
    347347                        bp_core_remove_subnav_item( $parent_id, $subnav_item['slug'] );
    348348                }
     
    459459        // Loop through each navigation item
    460460        $counter = 0;
    461         foreach( (array)$bp->bp_nav as $nav_item ) {
     461        foreach( (array) $bp->bp_nav as $nav_item ) {
    462462                $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';
    463463
     
    472472                        $sub_counter = 0;
    473473
    474                         foreach( (array)$bp->bp_options_nav[$nav_item['slug']] as $subnav_item ) {
     474                        foreach( (array) $bp->bp_options_nav[$nav_item['slug']] as $subnav_item ) {
    475475                                $link = $subnav_item['link'];
    476476                                $name = $subnav_item['name'];
  • trunk/bp-core/bp-core-catchuri.php

    r5683 r5729  
    6868
    6969        // Loop and remove empties
    70         foreach ( (array)$bp_uri as $key => $uri_chunk ) {
     70        foreach ( (array) $bp_uri as $key => $uri_chunk ) {
    7171                if ( empty( $bp_uri[$key] ) ) {
    7272                        unset( $bp_uri[$key] );
     
    555555                                       
    556556                if ( !empty( $bp->redirect_stack['action_variables'] ) ) {
    557                         foreach( (array)$bp->redirect_stack['action_variables'] as $av ) {
     557                        foreach( (array) $bp->redirect_stack['action_variables'] as $av ) {
    558558                                $url_stack[0] = trailingslashit( $url_stack[0] . $av );
    559559                        }
  • 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
  • trunk/bp-core/bp-core-filters.php

    r5705 r5729  
    7979        global $wpdb;
    8080
    81         foreach( (array)$comments as $comment ) {
     81        foreach( (array) $comments as $comment ) {
    8282                if ( $comment->user_id )
    8383                        $user_ids[] = $comment->user_id;
     
    9292                return $comments;
    9393
    94         foreach( (array)$userdata as $user )
     94        foreach( (array) $userdata as $user )
    9595                $users[$user->user_id] = bp_core_get_user_domain( $user->user_id, $user->user_nicename, $user->user_login );
    9696
    97         foreach( (array)$comments as $i => $comment ) {
     97        foreach( (array) $comments as $i => $comment ) {
    9898                if ( !empty( $comment->user_id ) ) {
    9999                        if ( !empty( $users[$comment->user_id] ) )
  • trunk/bp-core/bp-core-functions.php

    r5724 r5729  
    126126                // from the current blog
    127127                $posts_table_name = bp_is_multiblog_mode() ? $wpdb->posts : $wpdb->get_blog_prefix( bp_get_root_blog_id() ) . 'posts';
    128                 $page_ids_sql     = implode( ',', (array)$page_ids );
     128                $page_ids_sql     = implode( ',', (array) $page_ids );
    129129                $page_names       = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent, post_title FROM {$posts_table_name} WHERE ID IN ({$page_ids_sql}) AND post_status = 'publish' " ) );
    130130
     
    345345                $time_chunks = explode( ':', str_replace( ' ', ':', $older_date ) );
    346346                $date_chunks = explode( '-', str_replace( ' ', '-', $older_date ) );
    347                 $older_date  = gmmktime( (int)$time_chunks[1], (int)$time_chunks[2], (int)$time_chunks[3], (int)$date_chunks[1], (int)$date_chunks[2], (int)$date_chunks[0] );
     347                $older_date  = gmmktime( (int) $time_chunks[1], (int) $time_chunks[2], (int) $time_chunks[3], (int) $date_chunks[1], (int) $date_chunks[2], (int) $date_chunks[0] );
    348348        }
    349349
     
    688688
    689689        // Check if the slug is registered in the $bp->pages global
    690         foreach ( (array)$bp->pages as $key => $page ) {
     690        foreach ( (array) $bp->pages as $key => $page ) {
    691691                if ( $key == $slug || $page->slug == $slug )
    692692                        $match = true;
     
    710710        $new_page_ids = array();
    711711
    712         foreach ( (array)$bp->add_root as $slug )
     712        foreach ( (array) $bp->add_root as $slug )
    713713                $new_page_ids[$slug] = wp_insert_post( array( 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_title' => ucwords( $slug ), 'post_status' => 'publish', 'post_type' => 'page' ) );
    714714
  • trunk/bp-core/bp-core-template.php

    r5705 r5729  
    4040
    4141        // Loop through each navigation item
    42         foreach ( (array)$bp->bp_options_nav[$the_index] as $subnav_item ) {
     42        foreach ( (array) $bp->bp_options_nav[$the_index] as $subnav_item ) {
    4343                if ( !$subnav_item['user_has_access'] )
    4444                        continue;
     
    273273
    274274        $options = apply_filters( 'bp_search_form_type_select_options', $options );
    275         foreach( (array)$options as $option_value => $option_title )
     275        foreach( (array) $options as $option_value => $option_title )
    276276                $selection_box .= sprintf( '<option value="%s">%s</option>', $option_value, $option_title );
    277277
  • trunk/bp-core/deprecated/1.5.php

    r5329 r5729  
    310310        $group = new BP_Groups_Group( $group_id );
    311311
    312         foreach( (array)$usernames as $username ) {
     312        foreach( (array) $usernames as $username ) {
    313313                if ( !$receiver_user_id = bp_core_get_userid( $username ) )
    314314                        continue;
  • trunk/bp-forums/bp-forums-admin.php

    r5574 r5729  
    123123
    124124                case 'new':
    125                         if ( isset( $_REQUEST['doinstall'] ) && 1 == (int)$_REQUEST['doinstall'] ) {
     125                        if ( isset( $_REQUEST['doinstall'] ) && 1 == (int) $_REQUEST['doinstall'] ) {
    126126                                $result = bp_forums_bbpress_install();
    127127
     
    316316
    317317        // Loop through the lines and modify them
    318         foreach ( (array)$lines as $line ) {
     318        foreach ( (array) $lines as $line ) {
    319319                if ( isset( $alterations[substr( $line, 0, 20 )] ) ) {
    320320                        $alteration = $alterations[substr( $line, 0, 20 )];
     
    349349
    350350        // Write lines one by one to avoid OS specific newline hassles
    351         foreach ( (array)$modified_lines as $modified_line ) {
     351        foreach ( (array) $modified_lines as $modified_line ) {
    352352                if ( false !== strpos( $modified_line, '?>' ) ) {
    353353                        $modified_line = '?>';
  • trunk/bp-forums/bp-forums-bbpress-sa.php

    r5574 r5729  
    101101                // Set the site admins as the keymasters
    102102                $site_admins = get_site_option( 'site_admins', array('admin') );
    103                 foreach ( (array)$site_admins as $site_admin )
     103                foreach ( (array) $site_admins as $site_admin )
    104104                        update_user_meta( bp_core_get_userid( $site_admin ), $bb_table_prefix . 'capabilities', array( 'keymaster' => true ) );
    105105
  • trunk/bp-forums/bp-forums-functions.php

    r5567 r5729  
    6666        extract( $r, EXTR_SKIP );
    6767
    68         return bb_update_forum( array( 'forum_id' => (int)$forum_id, 'forum_name' => stripslashes( $forum_name ), 'forum_desc' => stripslashes( $forum_desc ), 'forum_slug' => stripslashes( $forum_slug ), 'forum_parent' => $forum_parent_id, 'forum_order' => $forum_order, 'forum_is_category' => $forum_is_category ) );
     68        return bb_update_forum( array( 'forum_id' => (int) $forum_id, 'forum_name' => stripslashes( $forum_name ), 'forum_desc' => stripslashes( $forum_desc ), 'forum_slug' => stripslashes( $forum_slug ), 'forum_parent' => $forum_parent_id, 'forum_order' => $forum_order, 'forum_is_category' => $forum_is_category ) );
    6969}
    7070
     
    175175                $topic_slug = sanitize_title( $topic_title );
    176176
    177         if ( !$topic_id = bb_insert_topic( array( 'topic_title' => stripslashes( $topic_title ), 'topic_slug' => $topic_slug, 'topic_poster' => $topic_poster, 'topic_poster_name' => $topic_poster_name, 'topic_last_poster' => $topic_last_poster, 'topic_last_poster_name' => $topic_last_poster_name, 'topic_start_time' => $topic_start_time, 'topic_time' => $topic_time, 'topic_open' => $topic_open, 'forum_id' => (int)$forum_id, 'tags' => $topic_tags ) ) )
     177        if ( !$topic_id = bb_insert_topic( array( 'topic_title' => stripslashes( $topic_title ), 'topic_slug' => $topic_slug, 'topic_poster' => $topic_poster, 'topic_poster_name' => $topic_poster_name, 'topic_last_poster' => $topic_last_poster, 'topic_last_poster_name' => $topic_last_poster_name, 'topic_start_time' => $topic_start_time, 'topic_time' => $topic_time, 'topic_open' => $topic_open, 'forum_id' => (int) $forum_id, 'tags' => $topic_tags ) ) )
    178178                return false;
    179179
     
    293293                }
    294294                $count = $bbdb->get_results( $bbdb->prepare( "SELECT t.topic_id FROM {$bbdb->topics} AS t {$groups_table_sql} WHERE {$groups_where_sql}" ) );
    295                 $count = count( (array)$count );
     295                $count = count( (array) $count );
    296296        } else {
    297297                $count = 0;
     
    426426
    427427        // Get the topic ids
    428         foreach ( (array)$topics as $topic ) $topic_ids[] = $topic->topic_id;
    429         $topic_ids = $wpdb->escape( join( ',', (array)$topic_ids ) );
     428        foreach ( (array) $topics as $topic ) $topic_ids[] = $topic->topic_id;
     429        $topic_ids = $wpdb->escape( join( ',', (array) $topic_ids ) );
    430430
    431431        // Fetch the topic's last poster details
    432432        $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} )" ) );
    433433        for ( $i = 0, $count = count( $topics ); $i < $count; ++$i ) {
    434                 foreach ( (array)$poster_details as $poster ) {
     434                foreach ( (array) $poster_details as $poster ) {
    435435                        if ( $poster->topic_id == $topics[$i]->topic_id ) {
    436436                                $topics[$i]->topic_last_poster_email       = $poster->user_email;
     
    446446                $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} )" ) );
    447447                for ( $i = 0, $count = count( $topics ); $i < $count; ++$i ) {
    448                         foreach ( (array)$poster_names as $name ) {
     448                        foreach ( (array) $poster_names as $name ) {
    449449                                if ( $name->topic_id == $topics[$i]->topic_id )
    450450                                        $topics[$i]->topic_last_poster_displayname = $name->value;
     
    455455        // Loop through to make sure that each topic has the proper values set. This covers the
    456456        // case of deleted users
    457         foreach ( (array)$topics as $key => $topic ) {
     457        foreach ( (array) $topics as $key => $topic ) {
    458458                if ( !isset( $topic->topic_last_poster_email ) )
    459459                        $topics[$key]->topic_last_poster_email = '';
     
    565565
    566566        // Get the user ids
    567         foreach ( (array)$posts as $post ) $user_ids[] = $post->poster_id;
    568         $user_ids = $wpdb->escape( join( ',', (array)$user_ids ) );
     567        foreach ( (array) $posts as $post ) $user_ids[] = $post->poster_id;
     568        $user_ids = $wpdb->escape( join( ',', (array) $user_ids ) );
    569569
    570570        // Fetch the poster's user_email, user_nicename and user_login
     
    572572
    573573        for ( $i = 0, $count = count( $posts ); $i < $count; ++$i ) {
    574                 foreach ( (array)$poster_details as $poster ) {
     574                foreach ( (array) $poster_details as $poster ) {
    575575                        if ( $poster->user_id == $posts[$i]->poster_id ) {
    576576                                $posts[$i]->poster_email    = $poster->user_email;
     
    586586                $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} )" ) );
    587587                for ( $i = 0, $count = count( $posts ); $i < $count; ++$i ) {
    588                         foreach ( (array)$poster_names as $name ) {
     588                        foreach ( (array) $poster_names as $name ) {
    589589                                if ( isset( $topics[$i] ) && $name->user_id == $topics[$i]->user_id )
    590590                                $posts[$i]->poster_name = $poster->value;
  • trunk/bp-forums/bp-forums-template.php

    r5687 r5729  
    133133                $this->topics = apply_filters( 'bp_forums_template_topics', $this->topics, $type, $forum_id, $per_page, $max, $no_stickies );
    134134
    135                 if ( !(int)$this->topics ) {
     135                if ( !(int) $this->topics ) {
    136136                        $this->topic_count       = 0;
    137137                        $this->total_topic_count = 0;
     
    142142                                // Group forums
    143143                                $topic_count = bp_forums_get_forum( $forum_id );
    144                                 $topic_count = (int)$topic_count->topics;
     144                                $topic_count = (int) $topic_count->topics;
    145145                        } else if ( !empty( $bp->groups->current_group ) ) {
    146146                                $topic_count = (int)groups_total_public_forum_topic_count( $type );
     
    164164                                $this->total_topic_count = $topic_count;
    165165                        } else {
    166                                 $this->total_topic_count = (int)$max;
     166                                $this->total_topic_count = (int) $max;
    167167                        }
    168168
     
    171171                                        $this->topic_count = count( $this->topics );
    172172                                } else {
    173                                         $this->topic_count = (int)$max;
     173                                        $this->topic_count = (int) $max;
    174174                                }
    175175                        } else {
     
    184184                $this->topics = bp_forums_get_topic_extras( $this->topics );
    185185
    186                 if ( (int)$this->total_topic_count && (int)$this->pag_num ) {
     186                if ( (int) $this->total_topic_count && (int) $this->pag_num ) {
    187187                        $this->pag_links = paginate_links( array(
    188188                                'base'      => add_query_arg( array( 'p' => '%#%', 'n' => $this->pag_num ) ),
    189189                                'format'    => '',
    190                                 'total'     => ceil( (int)$this->total_topic_count / (int)$this->pag_num),
     190                                'total'     => ceil( (int) $this->total_topic_count / (int) $this->pag_num),
    191191                                'current'   => $this->pag_page,
    192192                                'prev_text' => _x( '&larr;', 'Forum topic pagination previous text', 'buddypress' ),
     
    379379                                if ( $this_page_stickies ) {
    380380                                        // Correct the topic_count
    381                                         $forum_template->topic_count += (int)$this_page_stickies;
     381                                        $forum_template->topic_count += (int) $this_page_stickies;
    382382
    383383                                        // Figure out which stickies need to be included
     
    385385
    386386                                        // Merge these topics into the forum template
    387                                         $forum_template->topics = array_merge( $this_page_sticky_topics, (array)$forum_template->topics );
     387                                        $forum_template->topics = array_merge( $this_page_sticky_topics, (array) $forum_template->topics );
    388388                                }
    389389                        } else {
     
    404404                                'base'      => add_query_arg( array( 'p' => '%#%', 'n' => $forum_template->pag_num ) ),
    405405                                'format'    => '',
    406                                 'total'     => ceil( (int)$forum_template->total_topic_count / (int)$forum_template->pag_num ),
     406                                'total'     => ceil( (int) $forum_template->total_topic_count / (int) $forum_template->pag_num ),
    407407                                'current'   => $forum_template->pag_page,
    408408                                'prev_text' => _x( '&larr;', 'Forum topic pagination previous text', 'buddypress' ),
     
    466466                global $forum_template;
    467467
    468                 $post = bb_get_first_post( (int)$forum_template->topic->topic_id, false );
     468                $post = bb_get_first_post( (int) $forum_template->topic->topic_id, false );
    469469                return apply_filters( 'bp_get_the_topic_text', esc_attr( $post->post_text ) );
    470470        }
     
    796796
    797797                if ( bp_is_item_admin() || bp_is_item_mod() || bp_current_user_can( 'bp_moderate' ) ) {
    798                         if ( 0 == (int)$forum_template->topic->topic_sticky )
     798                        if ( 0 == (int) $forum_template->topic->topic_sticky )
    799799                                $links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'stick', 'bp_forums_stick_topic' ) . '">' . __( 'Sticky Topic', 'buddypress' ) . '</a>';
    800800                        else
    801801                                $links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'unstick', 'bp_forums_unstick_topic' ) . '">' . __( 'Un-stick Topic', 'buddypress' ) . '</a>';
    802802
    803                         if ( 0 == (int)$forum_template->topic->topic_open )
     803                        if ( 0 == (int) $forum_template->topic->topic_open )
    804804                                $links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'open', 'bp_forums_open_topic' ) . '">' . __( 'Open Topic', 'buddypress' ) . '</a>';
    805805                        else
     
    824824                        $class .= 'alt';
    825825
    826                 if ( isset( $forum_template->topic->topic_sticky ) && 1 == (int)$forum_template->topic->topic_sticky )
     826                if ( isset( $forum_template->topic->topic_sticky ) && 1 == (int) $forum_template->topic->topic_sticky )
    827827                        $class .= ' sticky';
    828828
    829                 if ( !isset( $forum_template->topic->topic_open ) || 0 == (int)$forum_template->topic->topic_open )
     829                if ( !isset( $forum_template->topic->topic_open ) || 0 == (int) $forum_template->topic->topic_open )
    830830                        $class .= ' closed';
    831831
     
    10181018                        $this->total_post_count = 0;
    10191019                } else {
    1020                         if ( !$max || $max >= (int)$forum_template->topic->topic_posts ) {
    1021                                 $this->total_post_count = (int)$forum_template->topic->topic_posts;
     1020                        if ( !$max || $max >= (int) $forum_template->topic->topic_posts ) {
     1021                                $this->total_post_count = (int) $forum_template->topic->topic_posts;
    10221022                        } else {
    1023                                 $this->total_post_count = (int)$max;
     1023                                $this->total_post_count = (int) $max;
    10241024                        }
    10251025
     
    10281028                                        $this->post_count = count( $this->posts );
    10291029                                } else {
    1030                                         $this->post_count = (int)$max;
     1030                                        $this->post_count = (int) $max;
    10311031                                }
    10321032                        } else {
     
    10381038                $this->topic_tags = bb_get_topic_tags( $this->topic_id );
    10391039
    1040                 if ( (int)$this->total_post_count && (int)$this->pag_num ) {
     1040                if ( (int) $this->total_post_count && (int) $this->pag_num ) {
    10411041                        $this->pag_links = paginate_links( array(
    1042                                 'base'      => add_query_arg( array( 'topic_page' => '%#%', 'num' => (int)$this->pag_num ) ),
     1042                                'base'      => add_query_arg( array( 'topic_page' => '%#%', 'num' => (int) $this->pag_num ) ),
    10431043                                'format'    => '',
    1044                                 'total'     => ceil( (int)$this->total_post_count / (int)$this->pag_num ),
     1044                                'total'     => ceil( (int) $this->total_post_count / (int) $this->pag_num ),
    10451045                                'current'   => $this->pag_page,
    10461046                                'prev_text' => _x( '&larr;', 'Forum thread pagination previous text', 'buddypress' ),
     
    10491049                        ) );
    10501050
    1051                         $this->pag->total_pages = ceil( (int)$this->total_post_count / (int)$this->pag_num );
     1051                        $this->pag->total_pages = ceil( (int) $this->total_post_count / (int) $this->pag_num );
    10521052                } else {
    10531053                        $this->pag->total_pages = 1;
     
    11731173                        $class .= 'alt';
    11741174
    1175                 if ( 1 == (int)$topic_template->post->post_status )
     1175                if ( 1 == (int) $topic_template->post->post_status )
    11761176                        $class .= ' deleted';
    11771177
    1178                 if ( 0 == (int)$topic_template->post->post_status )
     1178                if ( 0 == (int) $topic_template->post->post_status )
    11791179                        $class .= ' open';
    11801180
  • trunk/bp-friends/bp-friends-activity.php

    r5712 r5729  
    8383
    8484                        // Set up the string and the filter
    85                         if ( (int)$total_items > 1 ) {
    86                                 $text = sprintf( __( '%d friends accepted your friendship requests', 'buddypress' ), (int)$total_items );
     85                        if ( (int) $total_items > 1 ) {
     86                                $text = sprintf( __( '%d friends accepted your friendship requests', 'buddypress' ), (int) $total_items );
    8787                                $filter = 'bp_friends_multiple_friendship_accepted_notification';
    8888                        } else {
     
    9797
    9898                        // Set up the string and the filter
    99                         if ( (int)$total_items > 1 ) {
    100                                 $text = sprintf( __( 'You have %d pending friendship requests', 'buddypress' ), (int)$total_items );
     99                        if ( (int) $total_items > 1 ) {
     100                                $text = sprintf( __( 'You have %d pending friendship requests', 'buddypress' ), (int) $total_items );
    101101                                $filter = 'bp_friends_multiple_friendship_request_notification';
    102102                        } else {
     
    110110        // Return either an HTML link or an array, depending on the requested format
    111111        if ( 'string' == $format ) {
    112                 $return = apply_filters( $filter, '<a href="' . $link . '">' . $text . '</a>', (int)$total_items );
     112                $return = apply_filters( $filter, '<a href="' . $link . '">' . $text . '</a>', (int) $total_items );
    113113        } else {
    114114                $return = apply_filters( $filter, array(
  • trunk/bp-friends/bp-friends-classes.php

    r5709 r5729  
    133133                        return 0;
    134134
    135                 bp_update_user_meta( $user_id, 'total_friend_count', (int)$count );
     135                bp_update_user_meta( $user_id, 'total_friend_count', (int) $count );
    136136                return (int) $count;
    137137        }
     
    174174                        return false;
    175175
    176                 return array( 'friends' => $filtered_friend_ids, 'total' => (int)$total_friend_ids );
     176                return array( 'friends' => $filtered_friend_ids, 'total' => (int) $total_friend_ids );
    177177        }
    178178
     
    336336
    337337                // Loop through friend_ids and update their counts
    338                 foreach ( (array)$friend_ids as $friend_id ) {
     338                foreach ( (array) $friend_ids as $friend_id ) {
    339339                        BP_Friends_Friendship::total_friend_count( $friend_id );
    340340                }
  • trunk/bp-friends/bp-friends-functions.php

    r5712 r5729  
    2121        $friendship = new BP_Friends_Friendship;
    2222
    23         if ( (int)$friendship->is_confirmed )
     23        if ( (int) $friendship->is_confirmed )
    2424                return true;
    2525
     
    173173                return false;
    174174
    175         if ( !(int)$friend_count )
     175        if ( !(int) $friend_count )
    176176                return false;
    177177
  • trunk/bp-friends/bp-friends-notifications.php

    r5712 r5729  
    1818        $initiator_name = bp_core_get_user_displayname( $initiator_id );
    1919
    20         if ( 'no' == bp_get_user_meta( (int)$friend_id, 'notification_friends_friendship_request', true ) )
     20        if ( 'no' == bp_get_user_meta( (int) $friend_id, 'notification_friends_friendship_request', true ) )
    2121                return false;
    2222
  • trunk/bp-friends/bp-friends-template.php

    r5712 r5729  
    274274                        $user_id = bp_displayed_user_id();
    275275
    276                 return apply_filters( 'bp_get_potential_friend_id', (int)$user_id );
     276                return apply_filters( 'bp_get_potential_friend_id', (int) $user_id );
    277277        }
    278278
  • trunk/bp-groups/bp-groups-actions.php

    r5714 r5729  
    111111                        // Checked against a whitelist for security
    112112                        $allowed_invite_status = apply_filters( 'groups_allowed_invite_status', array( 'members', 'mods', 'admins' ) );
    113                         $invite_status         = !empty( $_POST['group-invite-status'] ) && in_array( $_POST['group-invite-status'], (array)$allowed_invite_status ) ? $_POST['group-invite-status'] : 'members';
     113                        $invite_status         = !empty( $_POST['group-invite-status'] ) && in_array( $_POST['group-invite-status'], (array) $allowed_invite_status ) ? $_POST['group-invite-status'] : 'members';
    114114
    115115                        groups_update_groupmeta( $bp->groups->new_group_id, 'invite_status', $invite_status );
     
    156156                         * we need to loop the step array and fetch the next step that way.
    157157                         */
    158                         foreach ( (array)$bp->groups->group_creation_steps as $key => $value ) {
     158                        foreach ( (array) $bp->groups->group_creation_steps as $key => $value ) {
    159159                                if ( $key == $bp->groups->current_create_step ) {
    160160                                        $next = 1;
     
    276276                return false;
    277277
    278         foreach ( (array)$bp->groups->group_creation_steps as $slug => $step ) {
     278        foreach ( (array) $bp->groups->group_creation_steps as $slug => $step ) {
    279279                while ( !empty( $temp[$step['position']] ) )
    280280                        $step['position']++;
     
    287287        unset($bp->groups->group_creation_steps);
    288288
    289         foreach( (array)$temp as $position => $step )
     289        foreach( (array) $temp as $position => $step )
    290290                $bp->groups->group_creation_steps[$step['slug']] = array( 'name' => $step['name'], 'position' => $position );
    291291}
  • trunk/bp-groups/bp-groups-activity.php

    r5714 r5729  
    9090                        // Because different values are passed to the filters, we'll return the
    9191                        // values inline
    92                         if ( (int)$total_items > 1 ) {
    93                                 $text = sprintf( __( '%1$d new membership requests for the group "%2$s"', 'buddypress' ), (int)$total_items, $group->name );
     92                        if ( (int) $total_items > 1 ) {
     93                                $text = sprintf( __( '%1$d new membership requests for the group "%2$s"', 'buddypress' ), (int) $total_items, $group->name );
    9494                                $filter = 'bp_groups_multiple_new_membership_requests_notification';
    9595                                $notification_link = $group_link . 'admin/membership-requests/?n=1';
     
    127127                        $group_link = bp_get_group_permalink( $group );
    128128
    129                         if ( (int)$total_items > 1 ) {
    130                                 $text = sprintf( __( '%d accepted group membership requests', 'buddypress' ), (int)$total_items, $group->name );
     129                        if ( (int) $total_items > 1 ) {
     130                                $text = sprintf( __( '%d accepted group membership requests', 'buddypress' ), (int) $total_items, $group->name );
    131131                                $filter = 'bp_groups_multiple_membership_request_accepted_notification';
    132132                                $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1';
     
    163163                        $group_link = bp_get_group_permalink( $group );
    164164
    165                         if ( (int)$total_items > 1 ) {
    166                                 $text = sprintf( __( '%d rejected group membership requests', 'buddypress' ), (int)$total_items, $group->name );
     165                        if ( (int) $total_items > 1 ) {
     166                                $text = sprintf( __( '%d rejected group membership requests', 'buddypress' ), (int) $total_items, $group->name );
    167167                                $filter = 'bp_groups_multiple_membership_request_rejected_notification';
    168168                                $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1';
     
    199199                        $group_link = bp_get_group_permalink( $group );
    200200
    201                         if ( (int)$total_items > 1 ) {
    202                                 $text = sprintf( __( 'You were promoted to an admin in %d groups', 'buddypress' ), (int)$total_items );
     201                        if ( (int) $total_items > 1 ) {
     202                                $text = sprintf( __( 'You were promoted to an admin in %d groups', 'buddypress' ), (int) $total_items );
    203203                                $filter = 'bp_groups_multiple_member_promoted_to_admin_notification';
    204204                                $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1';
     
    235235                        $group_link = bp_get_group_permalink( $group );
    236236
    237                         if ( (int)$total_items > 1 ) {
    238                                 $text = sprintf( __( 'You were promoted to a mod in %d groups', 'buddypress' ), (int)$total_items );
     237                        if ( (int) $total_items > 1 ) {
     238                                $text = sprintf( __( 'You were promoted to a mod in %d groups', 'buddypress' ), (int) $total_items );
    239239                                $filter = 'bp_groups_multiple_member_promoted_to_mod_notification';
    240240                                $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1';
     
    272272                        $notification_link = bp_loggedin_user_domain() . bp_get_groups_slug() . '/invites/?n=1';
    273273
    274                         if ( (int)$total_items > 1 ) {
    275                                 $text = sprintf( __( 'You have %d new group invitations', 'buddypress' ), (int)$total_items );
     274                        if ( (int) $total_items > 1 ) {
     275                                $text = sprintf( __( 'You have %d new group invitations', 'buddypress' ), (int) $total_items );
    276276                                $filter = 'bp_groups_multiple_group_invite_notification';
    277277
  • trunk/bp-groups/bp-groups-classes.php

    r5714 r5729  
    6262                        // Get group admins and mods
    6363                        $admin_mods = $wpdb->get_results( apply_filters( 'bp_group_admin_mods_user_join_filter', $wpdb->prepare( "SELECT u.ID as user_id, u.user_login, u.user_email, u.user_nicename, m.is_admin, m.is_mod FROM {$wpdb->users} u, {$bp->groups->table_name_members} m WHERE u.ID = m.user_id AND m.group_id = %d AND ( m.is_admin = 1 OR m.is_mod = 1 )", $this->id ) ) );
    64                         foreach( (array)$admin_mods as $user ) {
     64                        foreach( (array) $admin_mods as $user ) {
    6565                                if ( (int) $user->is_admin )
    6666                                        $this->admins[] = $user;
     
    150150                // Fetch the user IDs of all the members of the group
    151151                $user_ids = BP_Groups_Member::get_group_member_ids( $this->id );
    152                 $user_ids = implode( ',', (array)$user_ids );
     152                $user_ids = implode( ',', (array) $user_ids );
    153153
    154154                // Modify group count usermeta for members
     
    350350
    351351                // Get paginated results
    352                 $paged_groups_sql = apply_filters( 'bp_groups_get_paged_groups_sql', join( ' ', (array)$sql ), $sql );
     352                $paged_groups_sql = apply_filters( 'bp_groups_get_paged_groups_sql', join( ' ', (array) $sql ), $sql );
    353353                $paged_groups     = $wpdb->get_results( $paged_groups_sql );
    354354
     
    382382
    383383                if ( !empty( $total_sql['where'] ) )
    384                         $t_sql .= " WHERE " . join( ' AND ', (array)$total_sql['where'] );
     384                        $t_sql .= " WHERE " . join( ' AND ', (array) $total_sql['where'] );
    385385
    386386                // Get total group results
    387                 $total_groups_sql = apply_filters( 'bp_groups_get_total_groups_sql', join( ' ', (array)$t_sql ), $t_sql );
     387                $total_groups_sql = apply_filters( 'bp_groups_get_total_groups_sql', join( ' ', (array) $t_sql ), $t_sql );
    388388                $total_groups     = $wpdb->get_var( $total_groups_sql );
    389389
    390390                $group_ids = array();
    391                 foreach ( (array)$paged_groups as $group ) {
     391                foreach ( (array) $paged_groups as $group ) {
    392392                        $group_ids[] = $group->id;
    393393                }
     
    395395                // Populate some extra information instead of querying each time in the loop
    396396                if ( !empty( $populate_extras ) ) {
    397                         $group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
     397                        $group_ids = $wpdb->escape( join( ',', (array) $group_ids ) );
    398398                        $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, $type );
    399399                }
     
    440440
    441441                if ( !empty( $populate_extras ) ) {
    442                         foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
    443                         $group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
     442                        foreach ( (array) $paged_groups as $group ) $group_ids[] = $group->id;
     443                        $group_ids = $wpdb->escape( join( ',', (array) $group_ids ) );
    444444                        $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, 'newest' );
    445445                }
     
    481481
    482482                if ( !empty( $populate_extras ) ) {
    483                         foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
    484                         $group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
     483                        foreach ( (array) $paged_groups as $group ) $group_ids[] = $group->id;
     484                        $group_ids = $wpdb->escape( join( ',', (array) $group_ids ) );
    485485                        $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, 'newest' );
    486486                }
     
    521521
    522522                if ( !empty( $populate_extras ) ) {
    523                         foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
    524                         $group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
     523                        foreach ( (array) $paged_groups as $group ) $group_ids[] = $group->id;
     524                        $group_ids = $wpdb->escape( join( ',', (array) $group_ids ) );
    525525                        $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, 'newest' );
    526526                }
     
    558558
    559559                if ( !empty( $populate_extras ) ) {
    560                         foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
    561                         $group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
     560                        foreach ( (array) $paged_groups as $group ) $group_ids[] = $group->id;
     561                        $group_ids = $wpdb->escape( join( ',', (array) $group_ids ) );
    562562                        $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, 'newest' );
    563563                }
     
    577577                        $paged_groups[$i]->is_member = false;
    578578
    579                         foreach ( (array)$user_status as $group_id ) {
     579                        foreach ( (array) $user_status as $group_id ) {
    580580                                if ( $group_id == $paged_groups[$i]->id ) {
    581581                                        $paged_groups[$i]->is_member = true;
     
    588588                        $paged_groups[$i]->is_banned = false;
    589589
    590                         foreach ( (array)$user_banned as $group_id ) {
     590                        foreach ( (array) $user_banned as $group_id ) {
    591591                                if ( $group_id == $paged_groups[$i]->id ) {
    592592                                        $paged_groups[$i]->is_banned = true;
     
    11491149
    11501150                // Fetch whether or not the user is a friend
    1151                 foreach ( (array)$members as $user )
     1151                foreach ( (array) $members as $user )
    11521152                        $user_ids[] = $user->user_id;
    11531153
     
    11571157                        $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() ) );
    11581158                        for ( $i = 0, $count = count( $members ); $i < $count; ++$i ) {
    1159                                 foreach ( (array)$friend_status as $status ) {
     1159                                foreach ( (array) $friend_status as $status ) {
    11601160                                        if ( $status->initiator_user_id == $members[$i]->user_id || $status->friend_user_id == $members[$i]->user_id ) {
    11611161                                                $members[$i]->is_friend = $status->is_confirmed;
  • trunk/bp-groups/bp-groups-forums.php

    r5689 r5729  
    167167                        'primary_link'      => apply_filters( 'groups_activity_new_forum_topic_primary_link', bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug . '/' ),
    168168                        'type'              => 'new_forum_topic',
    169                         'item_id'           => (int)$bp->groups->current_group->id,
    170                         'user_id'           => (int)$topic->topic_poster,
     169                        'item_id'           => (int) $bp->groups->current_group->id,
     170                        'user_id'           => (int) $topic->topic_poster,
    171171                        'secondary_item_id' => $topic->topic_id,
    172172                        'recorded_time '    => $topic->topic_time
     
    209209                        'primary_link'      => apply_filters( 'groups_activity_new_forum_post_primary_link', $primary_link . "#post-" . $post_id ),
    210210                        'type'              => 'new_forum_post',
    211                         'item_id'           => (int)$bp->groups->current_group->id,
    212                         'user_id'           => (int)$post->poster_id,
     211                        'item_id'           => (int) $bp->groups->current_group->id,
     212                        'user_id'           => (int) $post->poster_id,
    213213                        'secondary_item_id' => $post_id,
    214214                        'recorded_time'     => $post->post_time
     
    249249
    250250                        // The activity item for each post
    251                         foreach ( (array)$posts as $post ) {
     251                        foreach ( (array) $posts as $post ) {
    252252                                bp_activity_delete( array( 'item_id' => $bp->groups->current_group->id, 'secondary_item_id' => $post->post_id, 'component' => $bp->groups->id, 'type' => 'new_forum_post' ) );
    253253                        }
  • trunk/bp-groups/bp-groups-functions.php

    r5714 r5729  
    236236        global $bp;
    237237
    238         return in_array( $status, (array)$bp->groups->valid_status );
     238        return in_array( $status, (array) $bp->groups->valid_status );
    239239}
    240240
     
    245245                $slug = substr( $slug, 2, strlen( $slug ) - 2 );
    246246
    247         if ( in_array( $slug, (array)$bp->groups->forbidden_names ) )
     247        if ( in_array( $slug, (array) $bp->groups->forbidden_names ) )
    248248                $slug = $slug . '-' . rand();
    249249
     
    927927        }
    928928
    929         $metas = array_map( 'maybe_unserialize', (array)$metas );
     929        $metas = array_map( 'maybe_unserialize', (array) $metas );
    930930
    931931        if ( 1 == count( $metas ) )
  • trunk/bp-groups/bp-groups-notifications.php

    r5727 r5729  
    2121
    2222        $user_ids = BP_Groups_Member::get_group_member_ids( $group->id );
    23         foreach ( (array)$user_ids as $user_id ) {
     23        foreach ( (array) $user_ids as $user_id ) {
    2424                if ( 'no' == bp_get_user_meta( $user_id, 'notification_groups_group_updated', true ) ) continue;
    2525
  • trunk/bp-groups/bp-groups-screens.php

    r5714 r5729  
    410410
    411411                        if ( !empty( $_POST['friends'] ) ) {
    412                                 foreach( (array)$_POST['friends'] as $friend ) {
     412                                foreach( (array) $_POST['friends'] as $friend ) {
    413413                                        groups_invite_user( array( 'user_id' => $friend, 'group_id' => $bp->groups->current_group->id ) );
    414414                                }
     
    493493                                        return false;
    494494
    495                                 if ( !groups_edit_base_group_details( $_POST['group-id'], $_POST['group-name'], $_POST['group-desc'], (int)$_POST['group-notify-members'] ) ) {
     495                                if ( !groups_edit_base_group_details( $_POST['group-id'], $_POST['group-name'], $_POST['group-desc'], (int) $_POST['group-notify-members'] ) ) {
    496496                                        bp_core_add_message( __( 'There was an error updating group details, please try again.', 'buddypress' ), 'error' );
    497497                                } else {
     
    526526                        // Checked against a whitelist for security
    527527                        $allowed_status = apply_filters( 'groups_allowed_status', array( 'public', 'private', 'hidden' ) );
    528                         $status         = ( in_array( $_POST['group-status'], (array)$allowed_status ) ) ? $_POST['group-status'] : 'public';
     528                        $status         = ( in_array( $_POST['group-status'], (array) $allowed_status ) ) ? $_POST['group-status'] : 'public';
    529529
    530530                        // Checked against a whitelist for security
    531531                        $allowed_invite_status = apply_filters( 'groups_allowed_invite_status', array( 'members', 'mods', 'admins' ) );
    532                         $invite_status         = in_array( $_POST['group-invite-status'], (array)$allowed_invite_status ) ? $_POST['group-invite-status'] : 'members';
     532                        $invite_status         = in_array( $_POST['group-invite-status'], (array) $allowed_invite_status ) ? $_POST['group-invite-status'] : 'members';
    533533
    534534                        // Check the nonce
  • trunk/bp-groups/bp-groups-template.php

    r5714 r5729  
    141141
    142142                if ( 'invites' == $type ) {
    143                         $this->total_group_count = (int)$this->groups['total'];
    144                         $this->group_count       = (int)$this->groups['total'];
     143                        $this->total_group_count = (int) $this->groups['total'];
     144                        $this->group_count       = (int) $this->groups['total'];
    145145                        $this->groups            = $this->groups['groups'];
    146146                } else if ( 'single-group' == $type ) {
     
    149149                        $this->group_count       = 1;
    150150                } else {
    151                         if ( empty( $max ) || $max >= (int)$this->groups['total'] ) {
    152                                 $this->total_group_count = (int)$this->groups['total'];
     151                        if ( empty( $max ) || $max >= (int) $this->groups['total'] ) {
     152                                $this->total_group_count = (int) $this->groups['total'];
    153153                        } else {
    154                                 $this->total_group_count = (int)$max;
     154                                $this->total_group_count = (int) $max;
    155155                        }
    156156
     
    161161                                        $this->group_count = count( $this->groups );
    162162                                } else {
    163                                         $this->group_count = (int)$max;
     163                                        $this->group_count = (int) $max;
    164164                                }
    165165                        } else {
     
    169169
    170170                // Build pagination links
    171                 if ( (int) $this->total_group_count && (int)$this->pag_num ) {
     171                if ( (int) $this->total_group_count && (int) $this->pag_num ) {
    172172                        $this->pag_links = paginate_links( array(
    173173                                'base'      => add_query_arg( array( 'grpage' => '%#%', 'num' => $this->pag_num, 's' => $search_terms, 'sortby' => $this->sort_by, 'order' => $this->order ) ),
    174174                                'format'    => '',
    175                                 'total'     => ceil( (int)$this->total_group_count / (int)$this->pag_num ),
     175                                'total'     => ceil( (int) $this->total_group_count / (int) $this->pag_num ),
    176176                                'current'   => $this->pag_page,
    177177                                'prev_text' => _x( '&larr;', 'Group pagination previous text', 'buddypress' ),
     
    287287        }
    288288
    289         $groups_template = new BP_Groups_Template( (int)$user_id, $type, (int)$page, (int)$per_page, (int)$max, $slug, $search_terms, (bool)$populate_extras, $include, $exclude, $show_hidden );
     289        $groups_template = new BP_Groups_Template( (int) $user_id, $type, (int) $page, (int) $per_page, (int) $max, $slug, $search_terms, (bool)$populate_extras, $include, $exclude, $show_hidden );
    290290        return apply_filters( 'bp_has_groups', $groups_template->has_groups(), $groups_template );
    291291}
     
    568568        if ( !empty( $group->admins ) ) { ?>
    569569                <ul id="group-admins">
    570                         <?php foreach( (array)$group->admins as $admin ) { ?>
     570                        <?php foreach( (array) $group->admins as $admin ) { ?>
    571571                                <li>
    572572                                        <a href="<?php echo bp_core_get_user_domain( $admin->user_id, $admin->user_nicename, $admin->user_login ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $admin->user_id, 'email' => $admin->user_email, 'alt' => sprintf( __( 'Profile picture of %s', 'buddypress' ), bp_core_get_user_displayname( $admin->user_id ) ) ) ) ?></a>
     
    590590                <ul id="group-mods">
    591591
    592                         <?php foreach( (array)$group->mods as $mod ) { ?>
     592                        <?php foreach( (array) $group->mods as $mod ) { ?>
    593593
    594594                                <li>
     
    797797
    798798                if ( !$groups_template->group->forum_counts )
    799                         $groups_template->group->forum_counts = bp_forums_get_forum_topicpost_count( (int)$forum_id );
     799                        $groups_template->group->forum_counts = bp_forums_get_forum_topicpost_count( (int) $forum_id );
    800800
    801801                if ( (bool) $showtext ) {
     
    831831
    832832                if ( !$groups_template->group->forum_counts )
    833                         $groups_template->group->forum_counts = bp_forums_get_forum_topicpost_count( (int)$forum_id );
     833                        $groups_template->group->forum_counts = bp_forums_get_forum_topicpost_count( (int) $forum_id );
    834834
    835835                if ( (bool) $showtext ) {
     
    10241024                <ul id="admins-list" class="item-list<?php if ( !empty( $admin_list ) ) : ?> single-line<?php endif; ?>">
    10251025
    1026                 <?php foreach ( (array)$admins as $admin ) { ?>
     1026                <?php foreach ( (array) $admins as $admin ) { ?>
    10271027
    10281028                        <?php if ( !empty( $admin_list ) ) : ?>
     
    10891089                <ul id="mods-list" class="item-list<?php if ( $admin_list ) { ?> single-line<?php } ?>">
    10901090
    1091                 <?php foreach ( (array)$group_mods as $mod ) { ?>
     1091                <?php foreach ( (array) $group_mods as $mod ) { ?>
    10921092
    10931093                        <?php if ( !empty( $admin_list ) ) { ?>
     
    16971697                $this->members  = BP_Groups_Member::get_all_for_group( $group_id, $this->pag_num, $this->pag_page, $exclude_admins_mods, $exclude_banned, $exclude );
    16981698
    1699                 if ( !$max || $max >= (int)$this->members['count'] )
    1700                         $this->total_member_count = (int)$this->members['count'];
     1699                if ( !$max || $max >= (int) $this->members['count'] )
     1700                        $this->total_member_count = (int) $this->members['count'];
    17011701                else
    1702                         $this->total_member_count = (int)$max;
     1702                        $this->total_member_count = (int) $max;
    17031703
    17041704                $this->members = $this->members['members'];
     
    17081708                                $this->member_count = count($this->members);
    17091709                        else
    1710                                 $this->member_count = (int)$max;
     1710                                $this->member_count = (int) $max;
    17111711                } else {
    17121712                        $this->member_count = count($this->members);
     
    17831783        extract( $r, EXTR_SKIP );
    17841784
    1785         $members_template = new BP_Groups_Group_Members_Template( $group_id, $per_page, $max, (int)$exclude_admins_mods, (int)$exclude_banned, $exclude );
     1785        $members_template = new BP_Groups_Group_Members_Template( $group_id, $per_page, $max, (int) $exclude_admins_mods, (int) $exclude_banned, $exclude );
    17861786        return apply_filters( 'bp_group_has_members', $members_template->has_members(), $members_template );
    17871787}
     
    20052005        $counter = 1;
    20062006
    2007         foreach ( (array)$bp->groups->group_creation_steps as $slug => $step ) {
     2007        foreach ( (array) $bp->groups->group_creation_steps as $slug => $step ) {
    20082008                $is_enabled = bp_are_previous_group_creation_steps_complete( $slug ); ?>
    20092009
     
    20682068                $found = true;
    20692069
    2070                 foreach ( (array)$step_slugs as $step_slug ) {
     2070                foreach ( (array) $step_slugs as $step_slug ) {
    20712071                        if ( !in_array( $step_slug, $bp->groups->completed_create_steps ) )
    20722072                                $found = false;
     
    20922092
    20932093        /* Get previous steps */
    2094         foreach ( (array)$bp->groups->group_creation_steps as $slug => $name ) {
     2094        foreach ( (array) $bp->groups->group_creation_steps as $slug => $name ) {
    20952095                if ( $slug == $step_slug )
    20962096                        break;
     
    21882188                global $bp;
    21892189
    2190                 foreach ( (array)$bp->groups->group_creation_steps as $slug => $name ) {
     2190                foreach ( (array) $bp->groups->group_creation_steps as $slug => $name ) {
    21912191                        if ( bp_is_action_variable( $slug ) )
    21922192                                break;
     
    22562256
    22572257                if ( !empty( $items ) )
    2258                         return implode( "\n", (array)$items );
     2258                        return implode( "\n", (array) $items );
    22592259
    22602260                return false;
     
    24212421                $this->requests = BP_Groups_Group::get_membership_requests( $group_id, $this->pag_num, $this->pag_page );
    24222422
    2423                 if ( !$max || $max >= (int)$this->requests['total'] )
    2424                         $this->total_request_count = (int)$this->requests['total'];
     2423                if ( !$max || $max >= (int) $this->requests['total'] )
     2424                        $this->total_request_count = (int) $this->requests['total'];
    24252425                else
    2426                         $this->total_request_count = (int)$max;
     2426                        $this->total_request_count = (int) $max;
    24272427
    24282428                $this->requests = $this->requests['requests'];
     
    24322432                                $this->request_count = count($this->requests);
    24332433                        else
    2434                                 $this->request_count = (int)$max;
     2434                                $this->request_count = (int) $max;
    24352435                } else {
    24362436                        $this->request_count = count($this->requests);
     
    27702770                $current_group = groups_get_current_group();
    27712771
    2772                 $current_group_id = isset( $current_group->id ) ? (int)$current_group->id : 0;
     2772                $current_group_id = isset( $current_group->id ) ? (int) $current_group->id : 0;
    27732773
    27742774                return apply_filters( 'bp_get_current_group_id', $current_group_id, $current_group );
  • trunk/bp-members/bp-members-buddybar.php

    r5705 r5729  
    7777
    7878                echo '<ul class="author-list">';
    79                 foreach( (array)$authors as $author ) {
     79                foreach( (array) $authors as $author ) {
    8080                        $caps = maybe_unserialize( $author->caps );
    8181                        if ( isset( $caps['subscriber'] ) || isset( $caps['contributor'] ) ) continue;
  • trunk/bp-members/bp-members-functions.php

    r5727 r5729  
    724724                return $auth_obj;
    725725
    726         if ( ( is_multisite() && (int)$user->spam ) || 1 == (int)$user->user_status )
     726        if ( ( is_multisite() && (int) $user->spam ) || 1 == (int) $user->user_status )
    727727                return new WP_Error( 'invalid_username', __( '<strong>ERROR</strong>: Your account has been marked as a spammer.', 'buddypress' ) );
    728728        else
     
    825825
    826826        // Merge the arrays together
    827         $merged_names           = array_merge( (array)$filtered_illegal_names, (array)$db_illegal_names );
     827        $merged_names           = array_merge( (array) $filtered_illegal_names, (array) $db_illegal_names );
    828828
    829829        // Remove duplicates
    830         $illegal_names          = array_unique( (array)$merged_names );
     830        $illegal_names          = array_unique( (array) $merged_names );
    831831
    832832        return apply_filters( 'bp_core_illegal_names', $illegal_names );
     
    854854        $illegal_names = get_site_option( 'illegal_names' );
    855855
    856         if ( !validate_username( $user_name ) || in_array( $user_name, (array)$illegal_names ) )
     856        if ( !validate_username( $user_name ) || in_array( $user_name, (array) $illegal_names ) )
    857857                $errors->add( 'user_name', __( 'Only lowercase letters and numbers allowed', 'buddypress' ) );
    858858
     
    881881                $emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) );
    882882
    883                 if ( in_array( $emaildomain, (array)$limited_email_domains ) == false )
     883                if ( in_array( $emaildomain, (array) $limited_email_domains ) == false )
    884884                        $errors->add( 'user_email', __( 'Sorry, that email address is not allowed!', 'buddypress' ) );
    885885        }
     
    942942                                $profile_field_ids = explode( ',', $usermeta['profile_field_ids'] );
    943943
    944                                 foreach( (array)$profile_field_ids as $field_id ) {
     944                                foreach( (array) $profile_field_ids as $field_id ) {
    945945                                        if ( empty( $usermeta["field_{$field_id}"] ) )
    946946                                                continue;
     
    10011001                                $profile_field_ids = explode( ',', $user['meta']['profile_field_ids'] );
    10021002
    1003                                 foreach( (array)$profile_field_ids as $field_id ) {
     1003                                foreach( (array) $profile_field_ids as $field_id ) {
    10041004                                        $current_field = isset( $user['meta']["field_{$field_id}"] ) ? $user['meta']["field_{$field_id}"] : false;
    10051005
  • trunk/bp-members/bp-members-screens.php

    r5700 r5729  
    148148                // Add any errors to the action for the field in the template for display.
    149149                if ( !empty( $bp->signup->errors ) ) {
    150                         foreach ( (array)$bp->signup->errors as $fieldname => $error_message )
     150                        foreach ( (array) $bp->signup->errors as $fieldname => $error_message )
    151151                                add_action( 'bp_' . $fieldname . '_errors', create_function( '', 'echo apply_filters(\'bp_members_signup_error_message\', "<div class=\"error\">' . $error_message . '</div>" );' ) );
    152152                } else {
  • trunk/bp-members/bp-members-template.php

    r5727 r5729  
    181181                        $this->members = bp_core_get_users( array( 'type' => $this->type, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'user_id' => $user_id, 'include' => $include, 'search_terms' => $search_terms, 'populate_extras' => $populate_extras, 'exclude' => $exclude, 'meta_key' => $meta_key, 'meta_value' => $meta_value ) );
    182182
    183                 if ( !$max || $max >= (int)$this->members['total'] )
    184                         $this->total_member_count = (int)$this->members['total'];
     183                if ( !$max || $max >= (int) $this->members['total'] )
     184                        $this->total_member_count = (int) $this->members['total'];
    185185                else
    186                         $this->total_member_count = (int)$max;
     186                        $this->total_member_count = (int) $max;
    187187
    188188                $this->members = $this->members['users'];
     
    192192                                $this->member_count = count( $this->members );
    193193                        } else {
    194                                 $this->member_count = (int)$max;
     194                                $this->member_count = (int) $max;
    195195                        }
    196196                } else {
     
    198198                }
    199199
    200                 if ( (int)$this->total_member_count && (int)$this->pag_num ) {
     200                if ( (int) $this->total_member_count && (int) $this->pag_num ) {
    201201                        $this->pag_links = paginate_links( array(
    202202                                'base'      => add_query_arg( 'upage', '%#%' ),
    203203                                'format'    => '',
    204                                 'total'     => ceil( (int)$this->total_member_count / (int)$this->pag_num ),
     204                                'total'     => ceil( (int) $this->total_member_count / (int) $this->pag_num ),
    205205                                'current'   => (int) $this->pag_page,
    206206                                'prev_text' => _x( '&larr;', 'Member pagination previous text', 'buddypress' ),
     
    746746        global $bp;
    747747
    748         foreach ( (array)$bp->bp_nav as $user_nav_item ) {
     748        foreach ( (array) $bp->bp_nav as $user_nav_item ) {
    749749                if ( !$user_nav_item['show_for_displayed_user'] && !bp_is_my_profile() )
    750750                        continue;
  • trunk/bp-messages/bp-messages-classes.php

    r5697 r5729  
    3636                        return false;
    3737
    38                 foreach ( (array)$this->messages as $key => $message )
     38                foreach ( (array) $this->messages as $key => $message )
    3939                        $this->sender_ids[$message->sender_id] = $message->sender_id;
    4040
     
    113113
    114114                // Sort threads by date_sent
    115                 foreach( (array)$thread_ids as $thread )
     115                foreach( (array) $thread_ids as $thread )
    116116                        $sorted_threads[$thread->thread_id] = strtotime( $thread->date_sent );
    117117
     
    119119
    120120                $threads = false;
    121                 foreach ( (array)$sorted_threads as $thread_id => $date_sent )
     121                foreach ( (array) $sorted_threads as $thread_id => $date_sent )
    122122                        $threads[] = new BP_Messages_Thread( $thread_id );
    123123
    124                 return array( 'threads' => &$threads, 'total' => (int)$total_threads );
     124                return array( 'threads' => &$threads, 'total' => (int) $total_threads );
    125125        }
    126126
     
    210210                $recipient_links = array();
    211211
    212                 foreach ( (array)$recipients as $recipient )
     212                foreach ( (array) $recipients as $recipient )
    213213                        $recipient_links[] = bp_core_get_userlink( $recipient->user_id );
    214214
     
    229229                        return true;
    230230
    231                 foreach( (array)$threads as $thread ) {
     231                foreach( (array) $threads as $thread ) {
    232232                        $message_ids = maybe_unserialize( $thread->message_ids );
    233233
     
    298298                // If we have no thread_id then this is the first message of a new thread.
    299299                if ( empty( $this->thread_id ) ) {
    300                         $this->thread_id = (int)$wpdb->get_var( $wpdb->prepare( "SELECT MAX(thread_id) FROM {$bp->messages->table_name_messages}" ) ) + 1;
     300                        $this->thread_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT MAX(thread_id) FROM {$bp->messages->table_name_messages}" ) ) + 1;
    301301                        $new_thread = true;
    302302                }
     
    310310                if ( $new_thread ) {
    311311                        // Add an recipient entry for all recipients
    312                         foreach ( (array)$this->recipients as $recipient ) {
     312                        foreach ( (array) $this->recipients as $recipient ) {
    313313                                $wpdb->query( $wpdb->prepare( "INSERT INTO {$bp->messages->table_name_recipients} ( user_id, thread_id, unread_count ) VALUES ( %d, %d, 1 )", $recipient->user_id, $this->thread_id ) );
    314314                                $recipient_ids[] = $recipient->user_id;
  • trunk/bp-messages/bp-messages-functions.php

    r5696 r5729  
    9090
    9191                // Strip the sender from the recipient list if they exist
    92                 if ( $key = array_search( $sender_id, (array)$recipient_ids ) )
     92                if ( $key = array_search( $sender_id, (array) $recipient_ids ) )
    9393                        unset( $recipient_ids[$key] );
    9494
    9595                // Remove duplicates
    96                 $recipient_ids = array_unique( (array)$recipient_ids );
     96                $recipient_ids = array_unique( (array) $recipient_ids );
    9797
    9898                if ( empty( $recipient_ids ) )
     
    100100
    101101                // Format this to match existing recipients
    102                 foreach( (array)$recipient_ids as $i => $recipient_id ) {
     102                foreach( (array) $recipient_ids as $i => $recipient_id ) {
    103103                        $message->recipients[$i]          = new stdClass;
    104104                        $message->recipients[$i]->user_id = $recipient_id;
     
    109109
    110110                // Send screen notifications to the recipients
    111                 foreach ( (array)$message->recipients as $recipient )
     111                foreach ( (array) $message->recipients as $recipient )
    112112                        bp_core_add_notification( $message->id, $recipient->user_id, 'messages', 'new_message' );
    113113
     
    234234
    235235                if ( (int) $total_items > 1 ) {
    236                         $text = sprintf( __('You have %d new messages', 'buddypress' ), (int)$total_items );
     236                        $text = sprintf( __('You have %d new messages', 'buddypress' ), (int) $total_items );
    237237                        $filter = 'bp_messages_multiple_new_message_notification';
    238238                } else {
    239                         $text = sprintf( __('You have %d new message', 'buddypress' ), (int)$total_items );
     239                        $text = sprintf( __('You have %d new message', 'buddypress' ), (int) $total_items );
    240240                        $filter = 'bp_messages_single_new_message_notification';
    241241                }
     
    243243
    244244        if ( 'string' == $format ) {
    245                 $return = apply_filters( $filter, '<a href="' . $link . '" title="' . $title . '">' . $text . '</a>', (int)$total_items, $text, $link );
     245                $return = apply_filters( $filter, '<a href="' . $link . '" title="' . $title . '">' . $text . '</a>', (int) $total_items, $text, $link );
    246246        } else {
    247247                $return = apply_filters( $filter, array(
  • trunk/bp-messages/bp-messages-template.php

    r5705 r5729  
    5656                        $total_notice_count = BP_Messages_Notice::get_total_notice_count();
    5757
    58                         if ( !$max || $max >= (int)$total_notice_count ) {
     58                        if ( !$max || $max >= (int) $total_notice_count ) {
    5959                                if ( 'notices' == $this->box ) {
    60                                         $this->total_thread_count = (int)$total_notice_count;
     60                                        $this->total_thread_count = (int) $total_notice_count;
    6161                                }
    6262                        } else {
    63                                 $this->total_thread_count = (int)$max;
     63                                $this->total_thread_count = (int) $max;
    6464                        }
    6565
     
    6868                                        $this->thread_count = count( $this->threads );
    6969                                } else {
    70                                         $this->thread_count = (int)$max;
     70                                        $this->thread_count = (int) $max;
    7171                                }
    7272                        } else {
     
    7575                }
    7676
    77                 if ( (int)$this->total_thread_count && (int)$this->pag_num ) {
     77                if ( (int) $this->total_thread_count && (int) $this->pag_num ) {
    7878                        $this->pag_links = paginate_links( array(
    7979                                'base'      => add_query_arg( 'mpage', '%#%' ),
    8080                                'format'    => '',
    81                                 'total'     => ceil( (int)$this->total_thread_count / (int)$this->pag_num ),
     81                                'total'     => ceil( (int) $this->total_thread_count / (int) $this->pag_num ),
    8282                                'current'   => $this->pag_page,
    8383                                'prev_text' => _x( '&larr;', 'Message pagination previous text', 'buddypress' ),
     
    130130                if ( 'notices' != $bp->current_action ) {
    131131                        $last_message_index = count( $this->thread->messages ) - 1;
    132                         $this->thread->messages = array_reverse( (array)$this->thread->messages );
     132                        $this->thread->messages = array_reverse( (array) $this->thread->messages );
    133133
    134134                        // Set up the last message data
    135135                        if ( count($this->thread->messages) > 1 ) {
    136136                                if ( 'inbox' == $this->box ) {
    137                                         foreach ( (array)$this->thread->messages as $key => $message ) {
     137                                        foreach ( (array) $this->thread->messages as $key => $message ) {
    138138                                                if ( bp_loggedin_user_id() != $message->sender_id ) {
    139139                                                        $last_message_index = $key;
     
    143143
    144144                                } elseif ( 'sentbox' == $this->box ) {
    145                                         foreach ( (array)$this->thread->messages as $key => $message ) {
     145                                        foreach ( (array) $this->thread->messages as $key => $message ) {
    146146                                                if ( bp_loggedin_user_id() == $message->sender_id ) {
    147147                                                        $last_message_index = $key;
     
    296296                global $messages_template;
    297297
    298                 if ( (int)$messages_template->thread->unread_count )
     298                if ( (int) $messages_template->thread->unread_count )
    299299                        return apply_filters( 'bp_get_message_thread_unread_count', $messages_template->thread->unread_count );
    300300
     
    493493                global $messages_template, $bp;
    494494
    495                 if ( 1 == (int)$messages_template->thread->is_active ) {
     495                if ( 1 == (int) $messages_template->thread->is_active ) {
    496496                        $link = wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . $bp->messages->slug . '/notices/deactivate/' . $messages_template->thread->id ), 'messages_deactivate_notice' );
    497497                } else {
     
    507507                global $messages_template;
    508508
    509                 if ( 1 == (int)$messages_template->thread->is_active  ) {
     509                if ( 1 == (int) $messages_template->thread->is_active  ) {
    510510                        $text = __('Deactivate', 'buddypress');
    511511                } else {
     
    788788                        return apply_filters( 'bp_get_the_thread_recipients', sprintf( __( '%d Recipients', 'buddypress' ), count($thread_template->thread->recipients) ) );
    789789
    790                 foreach( (array)$thread_template->thread->recipients as $recipient ) {
     790                foreach( (array) $thread_template->thread->recipients as $recipient ) {
    791791                        if ( (int) $recipient->user_id !== bp_loggedin_user_id() )
    792792                                $recipient_links[] = bp_core_get_userlink( $recipient->user_id );
  • trunk/bp-settings/bp-settings-actions.php

    r5690 r5729  
    5252                                        $emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) );
    5353
    54                                         if ( in_array( $emaildomain, (array)$limited_email_domains ) == false ) {
     54                                        if ( in_array( $emaildomain, (array) $limited_email_domains ) == false ) {
    5555                                                $email_error = true;
    5656                                        }
     
    143143
    144144                if ( isset( $_POST['notifications'] ) ) {
    145                         foreach ( (array)$_POST['notifications'] as $key => $value ) {
     145                        foreach ( (array) $_POST['notifications'] as $key => $value ) {
    146146                                if ( $meta_key = bp_get_user_meta_key( $key ) )
    147147                                        bp_update_user_meta( (int)bp_displayed_user_id(), $meta_key, $value );
  • trunk/bp-themes/bp-default/_inc/ajax.php

    r5706 r5729  
    5757
    5858        /* Now pass the querystring to override default values. */
    59         $query_string = empty( $qs ) ? '' : join( '&', (array)$qs );
     59        $query_string = empty( $qs ) ? '' : join( '&', (array) $qs );
    6060
    6161        $object_filter = '';
  • trunk/bp-themes/bp-default/comments.php

    r4577 r5729  
    1212                $num_comments = 0;
    1313                $num_trackbacks = 0;
    14                 foreach ( (array)$comments as $comment ) {
     14                foreach ( (array) $comments as $comment ) {
    1515                        if ( 'comment' != get_comment_type() )
    1616                                $num_trackbacks++;
     
    6363
    6464                <ul id="trackbacklist">
    65                         <?php foreach ( (array)$comments as $comment ) : ?>
     65                        <?php foreach ( (array) $comments as $comment ) : ?>
    6666
    6767                                <?php if ( 'comment' != get_comment_type() ) : ?>
  • trunk/bp-xprofile/bp-xprofile-classes.php

    r5699 r5729  
    144144                // Get the group ids
    145145                $group_ids = array();
    146                 foreach( (array)$groups as $group ) {
     146                foreach( (array) $groups as $group ) {
    147147                        $group_ids[] = $group->id;
    148148                }
     
    179179
    180180                                // Loop through the results and find the fields that have data.
    181                                 foreach( (array)$field_data as $data ) {
     181                                foreach( (array) $field_data as $data ) {
    182182
    183183                                        // Empty fields may contain a serialized empty array
     
    205205
    206206                                // Loop through fields
    207                                 foreach( (array)$fields as $field_key => $field ) {
     207                                foreach( (array) $fields as $field_key => $field ) {
    208208
    209209                                        // Loop throught the data in each field
    210                                         foreach( (array)$field_data as $data ) {
     210                                        foreach( (array) $field_data as $data ) {
    211211
    212212                                                // Assign correct data value to the field
     
    490490                                $counter = 1;
    491491                                if ( !empty( $options ) ) {
    492                                         foreach ( (array)$options as $option_key => $option_value ) {
     492                                        foreach ( (array) $options as $option_key => $option_value ) {
    493493                                                $is_default = 0;
    494494
  • trunk/bp-xprofile/bp-xprofile-filters.php

    r5699 r5729  
    100100        } else {
    101101                $filtered_values = array();
    102                 foreach ( (array)$field_value as $value ) {
     102                foreach ( (array) $field_value as $value ) {
    103103                        $kses_field_value       = xprofile_filter_kses( $value );
    104104                        $filtered_value         = wp_rel_nofollow( force_balance_tags( $kses_field_value ) );
     
    163163
    164164        if ( !empty( $values ) ) {
    165                 foreach ( (array)$values as $value ) {
     165                foreach ( (array) $values as $value ) {
    166166                        $value = trim( $value );
    167167
     
    185185
    186186function xprofile_filter_comments( $comments, $post_id ) {
    187         foreach( (array)$comments as $comment ) {
     187        foreach( (array) $comments as $comment ) {
    188188                if ( $comment->user_id ) {
    189189                        $user_ids[] = $comment->user_id;
     
    195195
    196196        if ( $fullnames = BP_XProfile_ProfileData::get_value_byid( 1, $user_ids ) ) {
    197                 foreach( (array)$fullnames as $user ) {
     197                foreach( (array) $fullnames as $user ) {
    198198                        $users[$user->user_id] = trim($user->value);
    199199                }
    200200        }
    201201
    202         foreach( (array)$comments as $i => $comment ) {
     202        foreach( (array) $comments as $i => $comment ) {
    203203                if ( !empty( $comment->user_id ) ) {
    204204                        if ( !empty( $users[$comment->user_id] ) ) {
  • trunk/bp-xprofile/bp-xprofile-functions.php

    r5699 r5729  
    175175        if ( is_array( $values ) ) {
    176176                $data = array();
    177                 foreach( (array)$values as $value ) {
     177                foreach( (array) $values as $value ) {
    178178                        $data[] = apply_filters( 'xprofile_get_field_data', $value, $field_id, $user_id );
    179179                }
     
    391391        global $bp, $wpdb;
    392392
    393         if ( !empty( $bp->site_options['bp-disable-profile-sync'] ) && (int)$bp->site_options['bp-disable-profile-sync'] )
     393        if ( !empty( $bp->site_options['bp-disable-profile-sync'] ) && (int) $bp->site_options['bp-disable-profile-sync'] )
    394394                return true;
    395395
     
    430430        global $bp;
    431431
    432         if ( ( !empty( $bp->site_options['bp-disable-profile-sync'] ) && (int)$bp->site_options['bp-disable-profile-sync'] ) || !$update || $errors->get_error_codes() )
     432        if ( ( !empty( $bp->site_options['bp-disable-profile-sync'] ) && (int) $bp->site_options['bp-disable-profile-sync'] ) || !$update || $errors->get_error_codes() )
    433433                return;
    434434
     
    535535        }
    536536
    537         $metas = array_map( 'maybe_unserialize', (array)$metas );
     537        $metas = array_map( 'maybe_unserialize', (array) $metas );
    538538
    539539        if ( 1 == count( $metas ) )
  • trunk/bp-xprofile/bp-xprofile-screens.php

    r5704 r5729  
    7272                // Loop through the posted fields formatting any datebox values
    7373                // then validate the field
    74                 foreach ( (array)$posted_field_ids as $field_id ) {
     74                foreach ( (array) $posted_field_ids as $field_id ) {
    7575                        if ( !isset( $_POST['field_' . $field_id] ) ) {
    7676
     
    102102
    103103                        // Now we've checked for required fields, lets save the values.
    104                         foreach ( (array)$posted_field_ids as $field_id ) {
     104                        foreach ( (array) $posted_field_ids as $field_id ) {
    105105
    106106                                // Certain types of fields (checkboxes, multiselects) may come through empty. Save them as an empty array so that they don't get overwritten by the default on the next edit.
  • trunk/bp-xprofile/bp-xprofile-template.php

    r5704 r5729  
    780780        global $bp;
    781781
    782         if ( !(int)$bp->site_options['bp-disable-avatar-uploads'] )
     782        if ( !(int) $bp->site_options['bp-disable-avatar-uploads'] )
    783783                bp_core_avatar_admin( null, bp_loggedin_user_domain() . $bp->profile->slug . '/change-avatar/', bp_loggedin_user_domain() . $bp->profile->slug . '/delete-avatar/' );
    784784        else
Note: See TracChangeset for help on using the changeset viewer.