Changeset 5729
- Timestamp:
- 02/11/2012 09:32:04 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 54 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-actions.php
r5684 r5729 271 271 // Post to groups object 272 272 } else if ( 'groups' == $object && bp_is_active( 'groups' ) ) { 273 if ( (int) $item_id ) {273 if ( (int) $item_id ) { 274 274 $activity_id = groups_post_update( array( 'content' => $content, 'group_id' => $item_id ) ); 275 275 } -
trunk/bp-activity/bp-activity-classes.php
r5704 r5729 173 173 $activity_user_ids = array(); 174 174 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 ) 177 177 $activity_user_ids[] = $activity->user_id; 178 178 } 179 179 180 $activity_user_ids = implode( ',', array_unique( (array) $activity_user_ids ) );180 $activity_user_ids = implode( ',', array_unique( (array) $activity_user_ids ) ); 181 181 if ( !empty( $activity_user_ids ) ) { 182 182 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 ) 184 184 $tmp_names[$name->user_id] = $name->user_fullname; 185 185 186 foreach ( (array) $activities as $i => $activity ) {186 foreach ( (array) $activities as $i => $activity ) { 187 187 if ( !empty( $tmp_names[$activity->user_id] ) ) 188 188 $activities[$i]->user_fullname = $tmp_names[$activity->user_id]; … … 197 197 // Get activity meta 198 198 $activity_ids = array(); 199 foreach ( (array) $activities as $activity ) {199 foreach ( (array) $activities as $activity ) { 200 200 $activity_ids[] = $activity->id; 201 201 } … … 210 210 // If $max is set, only return up to the max results 211 211 if ( !empty( $max ) ) { 212 if ( (int) $total_activities > (int)$max )212 if ( (int) $total_activities > (int) $max ) 213 213 $total_activities = $max; 214 214 } 215 215 216 return array( 'activities' => $activities, 'total' => (int) $total_activities );216 return array( 'activities' => $activities, 'total' => (int) $total_activities ); 217 217 } 218 218 … … 386 386 387 387 /* 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 ) { 389 389 if ( 'activity_comment' != $activity->type && $activity->mptt_left && $activity->mptt_right ) 390 390 $activity_comments[$activity->id] = BP_Activity_Activity::get_activity_comments( $activity->id, $activity->mptt_left, $activity->mptt_right, $spam ); … … 392 392 393 393 /* Merge the comments with the activity items */ 394 foreach( (array) $activities as $key => $activity )394 foreach( (array) $activities as $key => $activity ) 395 395 if ( isset( $activity_comments[$activity->id] ) ) 396 396 $activities[$key]->children = $activity_comments[$activity->id]; … … 440 440 441 441 // Loop descendants and build an assoc array 442 foreach ( (array) $descendants as $d ) {442 foreach ( (array) $descendants as $d ) { 443 443 $d->children = array(); 444 444 … … 470 470 471 471 // Loop the descendants and recalculate the left and right values 472 foreach ( (array) $descendants as $descendant )472 foreach ( (array) $descendants as $descendant ) 473 473 $right = BP_Activity_Activity::rebuild_activity_comment_tree( $descendant->id, $right ); 474 474 -
trunk/bp-activity/bp-activity-filters.php
r5609 r5729 220 220 221 221 $usernames = bp_activity_find_mentions( $content ); 222 foreach( (array) $usernames as $username ) {222 foreach( (array) $usernames as $username ) { 223 223 if ( bp_is_username_compatibility_mode() ) 224 224 $user_id = username_exists( $username ); -
trunk/bp-activity/bp-activity-functions.php
r5705 r5729 80 80 81 81 if ( $usernames = bp_activity_find_mentions( strip_tags( $activity->content ) ) ) { 82 foreach( (array) $usernames as $username ) {82 foreach( (array) $usernames as $username ) { 83 83 if ( bp_is_username_compatibility_mode() ) 84 84 $user_id = username_exists( $username ); … … 105 105 default : 106 106 if ( !in_array( $activity_id, $new_mentions ) ) { 107 $new_mentions[] = (int) $activity_id;107 $new_mentions[] = (int) $activity_id; 108 108 } 109 109 break; … … 149 149 $at_mention_title = sprintf( __( '@%s Mentions', 'buddypress' ), bp_get_loggedin_user_username() ); 150 150 151 if ( (int) $total_items > 1 ) {151 if ( (int) $total_items > 1 ) { 152 152 $text = sprintf( __( 'You have %1$d new activity mentions', 'buddypress' ), (int) $total_items ); 153 153 $filter = 'bp_activity_multiple_at_mentions_notification'; … … 161 161 162 162 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 ); 164 164 } else { 165 165 $return = apply_filters( $filter, array( 166 166 'text' => $text, 167 167 '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 ); 169 169 } 170 170 … … 289 289 // Update the total number of users who have favorited this activity 290 290 $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; 292 292 293 293 // Update user meta … … 349 349 350 350 // 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 ) ) { 352 352 353 353 // Update users favorites … … 527 527 528 528 if ( !empty( $metas ) ) { 529 $metas = array_map( 'maybe_unserialize', (array) $metas );529 $metas = array_map( 'maybe_unserialize', (array) $metas ); 530 530 531 531 foreach( $metas as $mkey => $mvalue ) { … … 540 540 541 541 // Maybe, just maybe... unserialize 542 $metas = array_map( 'maybe_unserialize', (array) $metas );542 $metas = array_map( 'maybe_unserialize', (array) $metas ); 543 543 544 544 // Return first item in array if only 1, else return all metas found … … 819 819 820 820 // 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 ) { 822 822 if ( !$activity = wp_cache_get( 'bp_activity_sitewide_front', 'bp' ) ) { 823 823 $activity = BP_Activity_Activity::get( $max, $page, $per_page, $sort, $search_terms, $filter, $display_comments, $show_hidden, false, false, $spam ); … … 1034 1034 // Check to see if the parent activity is hidden, and if so, hide this comment publically. 1035 1035 $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; 1037 1037 1038 1038 // Insert the activity comment … … 1155 1155 $latest_update = bp_get_user_meta( $user_id, 'bp_latest_update', true ); 1156 1156 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 ) ) { 1158 1158 bp_delete_user_meta( $user_id, 'bp_latest_update' ); 1159 1159 } … … 1310 1310 // Recursively delete all children of this comment. 1311 1311 if ( $children = BP_Activity_Activity::get_child_comments( $comment_id ) ) { 1312 foreach( (array) $children as $child ) {1312 foreach( (array) $children as $child ) { 1313 1313 bp_activity_delete_children( $activity_id, $child->id ); 1314 1314 } … … 1408 1408 } 1409 1409 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; 1412 1412 $new_width = $new_height * $ratio; 1413 1413 -
trunk/bp-activity/bp-activity-template.php
r5705 r5729 125 125 $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 ) ); 126 126 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']; 129 129 else 130 $this->total_activity_count = (int) $max;130 $this->total_activity_count = (int) $max; 131 131 132 132 $this->activities = $this->activities['activities']; … … 136 136 $this->activity_count = count( $this->activities ); 137 137 } else { 138 $this->activity_count = (int) $max;138 $this->activity_count = (int) $max; 139 139 } 140 140 } else { … … 145 145 146 146 // 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 ) { 148 148 if ( 'activity_comment' != $activity->type ) 149 149 continue; … … 162 162 } 163 163 164 if ( (int) $this->total_activity_count && (int)$this->pag_num ) {164 if ( (int) $this->total_activity_count && (int) $this->pag_num ) { 165 165 $this->pag_links = paginate_links( array( 166 166 'base' => add_query_arg( 'acpage', '%#%' ), 167 167 '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, 170 170 'prev_text' => _x( '←', 'Activity pagination previous text', 'buddypress' ), 171 171 'next_text' => _x( '→', 'Activity pagination next text', 'buddypress' ), … … 277 277 278 278 // 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 ) ) { 280 280 $scope = $bp->loaded_components[$bp->current_action]; 281 281 } … … 337 337 return false; 338 338 339 $user_id = implode( ',', (array) $friends );339 $user_id = implode( ',', (array) $friends ); 340 340 break; 341 341 case 'groups': … … 346 346 347 347 $object = $bp->groups->id; 348 $primary_id = implode( ',', (array) $groups['groups'] );348 $primary_id = implode( ',', (array) $groups['groups'] ); 349 349 350 350 $user_id = 0; … … 356 356 return false; 357 357 358 $include = implode( ',', (array) $favs );358 $include = implode( ',', (array) $favs ); 359 359 $display_comments = true; 360 360 break; … … 497 497 498 498 $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; 500 500 501 501 return apply_filters( 'bp_activity_has_more_items', $has_more_items ); … … 526 526 global $activities_template; 527 527 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 ); 529 529 } 530 530 … … 553 553 global $activities_template; 554 554 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 ); 556 556 } 557 557 … … 1323 1323 global $activities_template; 1324 1324 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 ) ); 1326 1326 } 1327 1327 … … 1388 1388 1389 1389 echo '<ul>'; 1390 foreach ( (array) $comment->children as $comment_child ) {1390 foreach ( (array) $comment->children as $comment_child ) { 1391 1391 // Put the comment into the global so it's available to filters 1392 1392 $activities_template->activity->current_comment = $comment_child; … … 1682 1682 $count = bp_activity_recurse_comment_count( $activities_template->activity ); 1683 1683 1684 return apply_filters( 'bp_activity_get_comment_count', (int) $count );1684 return apply_filters( 'bp_activity_get_comment_count', (int) $count ); 1685 1685 } 1686 1686 … … 1947 1947 1948 1948 $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 ) ) 1950 1950 $class = ' mini'; 1951 1951 … … 2158 2158 $can_comment = true; 2159 2159 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 ) { 2161 2161 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() ) 2162 2162 $can_comment = false; -
trunk/bp-activity/feeds/bp-activity-favorites-feed.php
r5394 r5729 38 38 <?php 39 39 $favs = bp_activity_get_user_favorites( bp_displayed_user_id() ); 40 $fav_ids = implode( ',', (array) $favs );40 $fav_ids = implode( ',', (array) $favs ); 41 41 ?> 42 42 -
trunk/bp-blogs/bp-blogs-buddybar.php
r5704 r5729 37 37 38 38 $counter = 0; 39 if ( is_array( $blogs['blogs'] ) && (int) $blogs['count'] ) {39 if ( is_array( $blogs['blogs'] ) && (int) $blogs['count'] ) { 40 40 41 41 echo '<li id="bp-adminbar-blogs-menu"><a href="' . trailingslashit( bp_loggedin_user_domain() . bp_get_blogs_slug() ) . '">'; … … 46 46 echo '<ul>'; 47 47 48 foreach ( (array) $blogs['blogs'] as $blog ) {48 foreach ( (array) $blogs['blogs'] as $blog ) { 49 49 $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; 50 50 $site_url = esc_attr( $blog->siteurl ); -
trunk/bp-blogs/bp-blogs-classes.php
r5686 r5729 123 123 124 124 $blog_ids = array(); 125 foreach ( (array) $paged_blogs as $blog ) {125 foreach ( (array) $paged_blogs as $blog ) { 126 126 $blog_ids[] = $blog->blog_id; 127 127 } 128 128 129 $blog_ids = $wpdb->escape( join( ',', (array) $blog_ids ) );129 $blog_ids = $wpdb->escape( join( ',', (array) $blog_ids ) ); 130 130 $paged_blogs = BP_Blogs_Blog::get_blog_extras( $paged_blogs, $blog_ids, $type ); 131 131 … … 173 173 174 174 $user_blogs = array(); 175 foreach ( (array) $blogs as $blog ) {175 foreach ( (array) $blogs as $blog ) { 176 176 $user_blogs[$blog->blog_id] = new stdClass; 177 177 $user_blogs[$blog->blog_id]->id = $blog->id; … … 273 273 274 274 for ( $i = 0, $count = count( $paged_blogs ); $i < $count; ++$i ) { 275 foreach ( (array) $blog_descs as $desc ) {275 foreach ( (array) $blog_descs as $desc ) { 276 276 if ( $desc->blog_id == $paged_blogs[$i]->blog_id ) 277 277 $paged_blogs[$i]->description = $desc->description; … … 285 285 global $wpdb; 286 286 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 ) ) ) 288 288 return true; 289 289 -
trunk/bp-blogs/bp-blogs-functions.php
r5686 r5729 55 55 56 56 if ( $blog_ids ) { 57 foreach( (array) $blog_ids as $blog_id ) {57 foreach( (array) $blog_ids as $blog_id ) { 58 58 $users = get_users( array( 'blog_id' => $blog_id ) ); 59 59 $subscribers = get_users( array( 'blog_id' => $blog_id, 'role' => 'subscriber' ) ); 60 60 61 61 if ( !empty( $users ) ) { 62 foreach ( (array) $users as $user ) {62 foreach ( (array) $users as $user ) { 63 63 // Don't record blogs for subscribers 64 64 if ( !in_array( $user, $subscribers ) ) … … 100 100 bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'last_activity', bp_core_current_time() ); 101 101 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; 103 103 $is_private = !apply_filters( 'bp_is_new_blog_public', !$is_private ); 104 104 … … 150 150 global $bp, $wpdb; 151 151 152 $post_id = (int) $post_id;153 $blog_id = (int) $wpdb->blogid;152 $post_id = (int) $post_id; 153 $blog_id = (int) $wpdb->blogid; 154 154 155 155 if ( !$user_id ) 156 $user_id = (int) $post->post_author;156 $user_id = (int) $post->post_author; 157 157 158 158 // Stop infinite loops with WordPress MU Sitewide Tags. … … 165 165 } 166 166 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 ) ) 168 168 return false; 169 169 … … 181 181 182 182 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>' ); 184 184 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>' ); 186 186 187 187 // Make sure there's not an existing entry for this post (prevent bumping) … … 189 189 $existing = bp_activity_get( array( 190 190 'filter' => array( 191 'user_id' => (int) $post->post_author,191 'user_id' => (int) $post->post_author, 192 192 'action' => 'new_blog_post', 193 193 'primary_id' => $blog_id, … … 204 204 205 205 bp_blogs_record_activity( array( 206 'user_id' => (int) $post->post_author,206 'user_id' => (int) $post->post_author, 207 207 'action' => apply_filters( 'bp_blogs_activity_new_post_action', $activity_action, $post, $post_permalink ), 208 208 'content' => apply_filters( 'bp_blogs_activity_new_post_content', $activity_content, $post, $post_permalink ), … … 248 248 // Get the user_id from the comment author email. 249 249 $user = get_user_by( 'email', $recorded_comment->comment_author_email ); 250 $user_id = (int) $user->ID;250 $user_id = (int) $user->ID; 251 251 252 252 // If there's no registered user id, don't record activity … … 345 345 global $bp; 346 346 347 $blog_id = (int) $blog_id;347 $blog_id = (int) $blog_id; 348 348 do_action( 'bp_blogs_before_remove_blog', $blog_id ); 349 349 … … 384 384 return false; 385 385 386 $post_id = (int) $post_id;386 $post_id = (int) $post_id; 387 387 388 388 if ( !$blog_id ) 389 $blog_id = (int) $wpdb->blogid;389 $blog_id = (int) $wpdb->blogid; 390 390 391 391 if ( !$user_id ) … … 597 597 } 598 598 599 $metas = array_map('maybe_unserialize', (array) $metas);599 $metas = array_map('maybe_unserialize', (array) $metas); 600 600 601 601 if ( 1 == count($metas) ) -
trunk/bp-blogs/bp-blogs-template.php
r5686 r5729 117 117 $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 ) ); 118 118 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']; 121 121 else 122 $this->total_blog_count = (int) $max;122 $this->total_blog_count = (int) $max; 123 123 124 124 $this->blogs = $this->blogs['blogs']; … … 128 128 $this->blog_count = count( $this->blogs ); 129 129 } else { 130 $this->blog_count = (int) $max;130 $this->blog_count = (int) $max; 131 131 } 132 132 } else { … … 134 134 } 135 135 136 if ( (int) $this->total_blog_count && (int)$this->pag_num ) {136 if ( (int) $this->total_blog_count && (int) $this->pag_num ) { 137 137 $this->pag_links = paginate_links( array( 138 138 'base' => add_query_arg( 'bpage', '%#%' ), 139 139 '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, 142 142 'prev_text' => _x( '←', 'Blog pagination previous text', 'buddypress' ), 143 143 'next_text' => _x( '→', 'Blog pagination next text', 'buddypress' ), -
trunk/bp-core/admin/bp-core-functions.php
r5575 r5729 244 244 // The best way to remove this notice is to add a "buddypress" tag to 245 245 // 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 ) ) { 247 247 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' ) ) ); 248 248 } -
trunk/bp-core/admin/bp-core-settings.php
r5727 r5729 189 189 // in the $_POST array when unchecked, we loop through the registered settings 190 190 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 ) { 192 192 foreach( $settings as $setting_name => $setting ) { 193 193 $value = isset( $_POST[$setting_name] ) ? $_POST[$setting_name] : ''; -
trunk/bp-core/admin/bp-core-slugs.php
r5683 r5729 196 196 $directory_pages = array(); 197 197 198 foreach ( (array) $_POST['bp_pages'] as $key => $value ) {198 foreach ( (array) $_POST['bp_pages'] as $key => $value ) { 199 199 if ( !empty( $value ) ) { 200 $directory_pages[$key] = (int) $value;200 $directory_pages[$key] = (int) $value; 201 201 } 202 202 } -
trunk/bp-core/admin/bp-core-update.php
r5727 r5729 67 67 function current_step() { 68 68 if ( isset( $_POST['step'] ) ) { 69 $current_step = (int) $_POST['step'] + 1;69 $current_step = (int) $_POST['step'] + 1; 70 70 } else { 71 71 if ( !empty( $_COOKIE['bp-wizard-step'] ) ) { … … 153 153 154 154 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 ); 156 156 } 157 157 … … 181 181 <ol> 182 182 183 <?php foreach( (array) $this->steps as $i => $name ) : ?>183 <?php foreach( (array) $this->steps as $i => $name ) : ?> 184 184 185 185 <li<?php if ( $this->current_step == $i ) : ?> class="current"<?php endif; ?>> … … 558 558 $bp_theme_installed = false; 559 559 560 foreach ( (array) $installed_plugins as $plugin ) {560 foreach ( (array) $installed_plugins as $plugin ) { 561 561 if ( 'BuddyPress Template Pack' == $plugin['Name'] ) { 562 562 $template_pack_installed = true; … … 564 564 } 565 565 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 ) { 568 568 if ( ( 'BuddyPress Default' != $theme['Name'] ) && ( 'buddypress' == $tag ) ) { 569 569 $bp_theme_installed = true; … … 798 798 } 799 799 800 $blog_pages = $this->setup_pages( (array) $_POST['bp_pages'] );800 $blog_pages = $this->setup_pages( (array) $_POST['bp_pages'] ); 801 801 bp_update_option( 'bp-pages', $blog_pages ); 802 802 … … 1035 1035 // Check for the selected page 1036 1036 if ( !empty( $_POST['bp-' . $key . '-page'] ) ) 1037 $bp_pages[$key] = (int) $_POST['bp-' . $key . '-page'];1037 $bp_pages[$key] = (int) $_POST['bp-' . $key . '-page']; 1038 1038 else 1039 1039 $bp_pages[$key] = wp_insert_post( array( 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_title' => ucwords( $key ), 'post_status' => 'publish', 'post_type' => 'page' ) ); … … 1128 1128 1129 1129 // 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'] ) { 1131 1131 bp_blogs_record_existing_blogs(); 1132 1132 bp_update_option( 'bp-blogs-first-install', 1 ); -
trunk/bp-core/bp-core-avatars.php
r5683 r5729 598 598 599 599 // Make sure we at least have a width and height for cropping 600 if ( !(int) $crop_w )600 if ( !(int) $crop_w ) 601 601 $crop_w = bp_core_avatar_full_width(); 602 602 603 if ( !(int) $crop_h )603 if ( !(int) $crop_h ) 604 604 $crop_h = bp_core_avatar_full_height(); 605 605 … … 609 609 610 610 // 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 ); 613 613 614 614 // Check for errors … … 808 808 global $bp; 809 809 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; 811 811 812 812 return apply_filters( 'bp_core_avatar_dimension', $dim, $type, $h_or_w ); … … 872 872 global $bp; 873 873 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 ); 875 875 } 876 876 … … 886 886 global $bp; 887 887 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 ); 889 889 } 890 890 -
trunk/bp-core/bp-core-buddybar.php
r5704 r5729 151 151 return false; 152 152 153 foreach ( (array) $bp->bp_nav as $slug => $nav_item ) {153 foreach ( (array) $bp->bp_nav as $slug => $nav_item ) { 154 154 if ( empty( $temp[$nav_item['position']]) ) 155 155 $temp[$nav_item['position']] = $nav_item; … … 288 288 return false; 289 289 290 foreach ( (array) $bp->bp_options_nav as $parent_slug => $subnav_items ) {290 foreach ( (array) $bp->bp_options_nav as $parent_slug => $subnav_items ) { 291 291 if ( !is_array( $subnav_items ) ) 292 292 continue; 293 293 294 foreach ( (array) $subnav_items as $subnav_item ) {294 foreach ( (array) $subnav_items as $subnav_item ) { 295 295 if ( empty( $temp[$subnav_item['position']]) ) 296 296 $temp[$subnav_item['position']] = $subnav_item; … … 344 344 // Unset subnav items for this nav item 345 345 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 ) { 347 347 bp_core_remove_subnav_item( $parent_id, $subnav_item['slug'] ); 348 348 } … … 459 459 // Loop through each navigation item 460 460 $counter = 0; 461 foreach( (array) $bp->bp_nav as $nav_item ) {461 foreach( (array) $bp->bp_nav as $nav_item ) { 462 462 $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : ''; 463 463 … … 472 472 $sub_counter = 0; 473 473 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 ) { 475 475 $link = $subnav_item['link']; 476 476 $name = $subnav_item['name']; -
trunk/bp-core/bp-core-catchuri.php
r5683 r5729 68 68 69 69 // Loop and remove empties 70 foreach ( (array) $bp_uri as $key => $uri_chunk ) {70 foreach ( (array) $bp_uri as $key => $uri_chunk ) { 71 71 if ( empty( $bp_uri[$key] ) ) { 72 72 unset( $bp_uri[$key] ); … … 555 555 556 556 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 ) { 558 558 $url_stack[0] = trailingslashit( $url_stack[0] . $av ); 559 559 } -
trunk/bp-core/bp-core-classes.php
r5708 r5729 258 258 if ( !empty( $include ) ) { 259 259 if ( is_array( $include ) ) { 260 $uids = $wpdb->escape( implode( ',', (array) $include ) );260 $uids = $wpdb->escape( implode( ',', (array) $include ) ); 261 261 } else { 262 262 $uids = $wpdb->escape( $include ); … … 268 268 } elseif ( !empty( $user_id ) && bp_is_active( 'friends' ) ) { 269 269 $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 ) ); 271 271 272 272 if ( !empty( $friend_ids ) ) { … … 316 316 317 317 // 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 ); 319 319 $paged_users = $wpdb->get_results( $paged_users_sql ); 320 320 … … 341 341 342 342 // 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 ); 344 344 $total_users = $wpdb->get_var( $total_users_sql ); 345 345 … … 351 351 $user_ids = array(); 352 352 353 foreach ( (array) $paged_users as $user ) {353 foreach ( (array) $paged_users as $user ) { 354 354 $user_ids[] = $user->id; 355 355 } 356 356 357 $user_ids = $wpdb->escape( join( ',', (array) $user_ids ) );357 $user_ids = $wpdb->escape( join( ',', (array) $user_ids ) ); 358 358 359 359 // Add additional data to the returned results … … 416 416 */ 417 417 $user_ids = array(); 418 foreach ( (array) $paged_users as $user )418 foreach ( (array) $paged_users as $user ) 419 419 $user_ids[] = $user->id; 420 420 421 $user_ids = $wpdb->escape( join( ',', (array) $user_ids ) );421 $user_ids = $wpdb->escape( join( ',', (array) $user_ids ) ); 422 422 423 423 // Add additional data to the returned results … … 503 503 * 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) 504 504 */ 505 foreach ( (array) $paged_users as $user )505 foreach ( (array) $paged_users as $user ) 506 506 $user_ids[] = $user->id; 507 507 508 $user_ids = $wpdb->escape( join( ',', (array) $user_ids ) );508 $user_ids = $wpdb->escape( join( ',', (array) $user_ids ) ); 509 509 510 510 // Add additional data to the returned results … … 538 538 $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() ) ); 539 539 for ( $i = 0, $count = count( $paged_users ); $i < $count; ++$i ) { 540 foreach ( (array) $names as $name ) {540 foreach ( (array) $names as $name ) { 541 541 if ( $name->id == $paged_users[$i]->id ) 542 542 $paged_users[$i]->fullname = $name->fullname; … … 549 549 $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' ) ) ); 550 550 for ( $i = 0, $count = count( $paged_users ); $i < $count; ++$i ) { 551 foreach ( (array) $friend_count as $fcount ) {551 foreach ( (array) $friend_count as $fcount ) { 552 552 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; 554 554 } 555 555 } … … 560 560 $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() ) ); 561 561 for ( $i = 0, $count = count( $paged_users ); $i < $count; ++$i ) { 562 foreach ( (array) $friend_status as $status ) {562 foreach ( (array) $friend_status as $status ) { 563 563 if ( $status->initiator_user_id == $paged_users[$i]->id || $status->friend_user_id == $paged_users[$i]->id ) 564 564 $paged_users[$i]->is_friend = $status->is_confirmed; … … 570 570 $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' ) ) ); 571 571 for ( $i = 0, $count = count( $paged_users ); $i < $count; ++$i ) { 572 foreach ( (array) $user_activity as $activity ) {572 foreach ( (array) $user_activity as $activity ) { 573 573 if ( $activity->id == $paged_users[$i]->id ) 574 574 $paged_users[$i]->last_activity = $activity->last_activity; … … 581 581 $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' ) ) ); 582 582 for ( $i = 0, $count = count( $paged_users ); $i < $count; ++$i ) { 583 foreach ( (array) $user_activity as $activity ) {583 foreach ( (array) $user_activity as $activity ) { 584 584 if ( $activity->id == $paged_users[$i]->id ) 585 585 $paged_users[$i]->last_activity = $activity->last_activity; … … 591 591 $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' ) ) ); 592 592 for ( $i = 0, $count = count( $paged_users ); $i < $count; ++$i ) { 593 foreach ( (array) $user_update as $update ) {593 foreach ( (array) $user_update as $update ) { 594 594 if ( $update->id == $paged_users[$i]->id ) 595 595 $paged_users[$i]->latest_update = $update->latest_update; … … 1208 1208 $is_oembed_link = false; 1209 1209 if ( !$attr['discover'] ) { 1210 foreach ( (array) $oembed_obj->providers as $provider_matchmask => $provider ) {1210 foreach ( (array) $oembed_obj->providers as $provider_matchmask => $provider ) { 1211 1211 $regex = ( $is_regex = $provider[1] ) ? $provider_matchmask : '#' . str_replace( '___wildcard___', '(.+)', preg_quote( str_replace( '*', '___wildcard___', $provider_matchmask ), '#' ) ) . '#i'; 1212 1212 -
trunk/bp-core/bp-core-filters.php
r5705 r5729 79 79 global $wpdb; 80 80 81 foreach( (array) $comments as $comment ) {81 foreach( (array) $comments as $comment ) { 82 82 if ( $comment->user_id ) 83 83 $user_ids[] = $comment->user_id; … … 92 92 return $comments; 93 93 94 foreach( (array) $userdata as $user )94 foreach( (array) $userdata as $user ) 95 95 $users[$user->user_id] = bp_core_get_user_domain( $user->user_id, $user->user_nicename, $user->user_login ); 96 96 97 foreach( (array) $comments as $i => $comment ) {97 foreach( (array) $comments as $i => $comment ) { 98 98 if ( !empty( $comment->user_id ) ) { 99 99 if ( !empty( $users[$comment->user_id] ) ) -
trunk/bp-core/bp-core-functions.php
r5724 r5729 126 126 // from the current blog 127 127 $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 ); 129 129 $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' " ) ); 130 130 … … 345 345 $time_chunks = explode( ':', str_replace( ' ', ':', $older_date ) ); 346 346 $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] ); 348 348 } 349 349 … … 688 688 689 689 // 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 ) { 691 691 if ( $key == $slug || $page->slug == $slug ) 692 692 $match = true; … … 710 710 $new_page_ids = array(); 711 711 712 foreach ( (array) $bp->add_root as $slug )712 foreach ( (array) $bp->add_root as $slug ) 713 713 $new_page_ids[$slug] = wp_insert_post( array( 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_title' => ucwords( $slug ), 'post_status' => 'publish', 'post_type' => 'page' ) ); 714 714 -
trunk/bp-core/bp-core-template.php
r5705 r5729 40 40 41 41 // 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 ) { 43 43 if ( !$subnav_item['user_has_access'] ) 44 44 continue; … … 273 273 274 274 $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 ) 276 276 $selection_box .= sprintf( '<option value="%s">%s</option>', $option_value, $option_title ); 277 277 -
trunk/bp-core/deprecated/1.5.php
r5329 r5729 310 310 $group = new BP_Groups_Group( $group_id ); 311 311 312 foreach( (array) $usernames as $username ) {312 foreach( (array) $usernames as $username ) { 313 313 if ( !$receiver_user_id = bp_core_get_userid( $username ) ) 314 314 continue; -
trunk/bp-forums/bp-forums-admin.php
r5574 r5729 123 123 124 124 case 'new': 125 if ( isset( $_REQUEST['doinstall'] ) && 1 == (int) $_REQUEST['doinstall'] ) {125 if ( isset( $_REQUEST['doinstall'] ) && 1 == (int) $_REQUEST['doinstall'] ) { 126 126 $result = bp_forums_bbpress_install(); 127 127 … … 316 316 317 317 // Loop through the lines and modify them 318 foreach ( (array) $lines as $line ) {318 foreach ( (array) $lines as $line ) { 319 319 if ( isset( $alterations[substr( $line, 0, 20 )] ) ) { 320 320 $alteration = $alterations[substr( $line, 0, 20 )]; … … 349 349 350 350 // 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 ) { 352 352 if ( false !== strpos( $modified_line, '?>' ) ) { 353 353 $modified_line = '?>'; -
trunk/bp-forums/bp-forums-bbpress-sa.php
r5574 r5729 101 101 // Set the site admins as the keymasters 102 102 $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 ) 104 104 update_user_meta( bp_core_get_userid( $site_admin ), $bb_table_prefix . 'capabilities', array( 'keymaster' => true ) ); 105 105 -
trunk/bp-forums/bp-forums-functions.php
r5567 r5729 66 66 extract( $r, EXTR_SKIP ); 67 67 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 ) ); 69 69 } 70 70 … … 175 175 $topic_slug = sanitize_title( $topic_title ); 176 176 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 ) ) ) 178 178 return false; 179 179 … … 293 293 } 294 294 $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 ); 296 296 } else { 297 297 $count = 0; … … 426 426 427 427 // 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 ) ); 430 430 431 431 // Fetch the topic's last poster details 432 432 $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} )" ) ); 433 433 for ( $i = 0, $count = count( $topics ); $i < $count; ++$i ) { 434 foreach ( (array) $poster_details as $poster ) {434 foreach ( (array) $poster_details as $poster ) { 435 435 if ( $poster->topic_id == $topics[$i]->topic_id ) { 436 436 $topics[$i]->topic_last_poster_email = $poster->user_email; … … 446 446 $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} )" ) ); 447 447 for ( $i = 0, $count = count( $topics ); $i < $count; ++$i ) { 448 foreach ( (array) $poster_names as $name ) {448 foreach ( (array) $poster_names as $name ) { 449 449 if ( $name->topic_id == $topics[$i]->topic_id ) 450 450 $topics[$i]->topic_last_poster_displayname = $name->value; … … 455 455 // Loop through to make sure that each topic has the proper values set. This covers the 456 456 // case of deleted users 457 foreach ( (array) $topics as $key => $topic ) {457 foreach ( (array) $topics as $key => $topic ) { 458 458 if ( !isset( $topic->topic_last_poster_email ) ) 459 459 $topics[$key]->topic_last_poster_email = ''; … … 565 565 566 566 // 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 ) ); 569 569 570 570 // Fetch the poster's user_email, user_nicename and user_login … … 572 572 573 573 for ( $i = 0, $count = count( $posts ); $i < $count; ++$i ) { 574 foreach ( (array) $poster_details as $poster ) {574 foreach ( (array) $poster_details as $poster ) { 575 575 if ( $poster->user_id == $posts[$i]->poster_id ) { 576 576 $posts[$i]->poster_email = $poster->user_email; … … 586 586 $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} )" ) ); 587 587 for ( $i = 0, $count = count( $posts ); $i < $count; ++$i ) { 588 foreach ( (array) $poster_names as $name ) {588 foreach ( (array) $poster_names as $name ) { 589 589 if ( isset( $topics[$i] ) && $name->user_id == $topics[$i]->user_id ) 590 590 $posts[$i]->poster_name = $poster->value; -
trunk/bp-forums/bp-forums-template.php
r5687 r5729 133 133 $this->topics = apply_filters( 'bp_forums_template_topics', $this->topics, $type, $forum_id, $per_page, $max, $no_stickies ); 134 134 135 if ( !(int) $this->topics ) {135 if ( !(int) $this->topics ) { 136 136 $this->topic_count = 0; 137 137 $this->total_topic_count = 0; … … 142 142 // Group forums 143 143 $topic_count = bp_forums_get_forum( $forum_id ); 144 $topic_count = (int) $topic_count->topics;144 $topic_count = (int) $topic_count->topics; 145 145 } else if ( !empty( $bp->groups->current_group ) ) { 146 146 $topic_count = (int)groups_total_public_forum_topic_count( $type ); … … 164 164 $this->total_topic_count = $topic_count; 165 165 } else { 166 $this->total_topic_count = (int) $max;166 $this->total_topic_count = (int) $max; 167 167 } 168 168 … … 171 171 $this->topic_count = count( $this->topics ); 172 172 } else { 173 $this->topic_count = (int) $max;173 $this->topic_count = (int) $max; 174 174 } 175 175 } else { … … 184 184 $this->topics = bp_forums_get_topic_extras( $this->topics ); 185 185 186 if ( (int) $this->total_topic_count && (int)$this->pag_num ) {186 if ( (int) $this->total_topic_count && (int) $this->pag_num ) { 187 187 $this->pag_links = paginate_links( array( 188 188 'base' => add_query_arg( array( 'p' => '%#%', 'n' => $this->pag_num ) ), 189 189 '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), 191 191 'current' => $this->pag_page, 192 192 'prev_text' => _x( '←', 'Forum topic pagination previous text', 'buddypress' ), … … 379 379 if ( $this_page_stickies ) { 380 380 // Correct the topic_count 381 $forum_template->topic_count += (int) $this_page_stickies;381 $forum_template->topic_count += (int) $this_page_stickies; 382 382 383 383 // Figure out which stickies need to be included … … 385 385 386 386 // 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 ); 388 388 } 389 389 } else { … … 404 404 'base' => add_query_arg( array( 'p' => '%#%', 'n' => $forum_template->pag_num ) ), 405 405 '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 ), 407 407 'current' => $forum_template->pag_page, 408 408 'prev_text' => _x( '←', 'Forum topic pagination previous text', 'buddypress' ), … … 466 466 global $forum_template; 467 467 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 ); 469 469 return apply_filters( 'bp_get_the_topic_text', esc_attr( $post->post_text ) ); 470 470 } … … 796 796 797 797 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 ) 799 799 $links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'stick', 'bp_forums_stick_topic' ) . '">' . __( 'Sticky Topic', 'buddypress' ) . '</a>'; 800 800 else 801 801 $links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'unstick', 'bp_forums_unstick_topic' ) . '">' . __( 'Un-stick Topic', 'buddypress' ) . '</a>'; 802 802 803 if ( 0 == (int) $forum_template->topic->topic_open )803 if ( 0 == (int) $forum_template->topic->topic_open ) 804 804 $links[] = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'open', 'bp_forums_open_topic' ) . '">' . __( 'Open Topic', 'buddypress' ) . '</a>'; 805 805 else … … 824 824 $class .= 'alt'; 825 825 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 ) 827 827 $class .= ' sticky'; 828 828 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 ) 830 830 $class .= ' closed'; 831 831 … … 1018 1018 $this->total_post_count = 0; 1019 1019 } 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; 1022 1022 } else { 1023 $this->total_post_count = (int) $max;1023 $this->total_post_count = (int) $max; 1024 1024 } 1025 1025 … … 1028 1028 $this->post_count = count( $this->posts ); 1029 1029 } else { 1030 $this->post_count = (int) $max;1030 $this->post_count = (int) $max; 1031 1031 } 1032 1032 } else { … … 1038 1038 $this->topic_tags = bb_get_topic_tags( $this->topic_id ); 1039 1039 1040 if ( (int) $this->total_post_count && (int)$this->pag_num ) {1040 if ( (int) $this->total_post_count && (int) $this->pag_num ) { 1041 1041 $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 ) ), 1043 1043 '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 ), 1045 1045 'current' => $this->pag_page, 1046 1046 'prev_text' => _x( '←', 'Forum thread pagination previous text', 'buddypress' ), … … 1049 1049 ) ); 1050 1050 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 ); 1052 1052 } else { 1053 1053 $this->pag->total_pages = 1; … … 1173 1173 $class .= 'alt'; 1174 1174 1175 if ( 1 == (int) $topic_template->post->post_status )1175 if ( 1 == (int) $topic_template->post->post_status ) 1176 1176 $class .= ' deleted'; 1177 1177 1178 if ( 0 == (int) $topic_template->post->post_status )1178 if ( 0 == (int) $topic_template->post->post_status ) 1179 1179 $class .= ' open'; 1180 1180 -
trunk/bp-friends/bp-friends-activity.php
r5712 r5729 83 83 84 84 // 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 ); 87 87 $filter = 'bp_friends_multiple_friendship_accepted_notification'; 88 88 } else { … … 97 97 98 98 // 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 ); 101 101 $filter = 'bp_friends_multiple_friendship_request_notification'; 102 102 } else { … … 110 110 // Return either an HTML link or an array, depending on the requested format 111 111 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 ); 113 113 } else { 114 114 $return = apply_filters( $filter, array( -
trunk/bp-friends/bp-friends-classes.php
r5709 r5729 133 133 return 0; 134 134 135 bp_update_user_meta( $user_id, 'total_friend_count', (int) $count );135 bp_update_user_meta( $user_id, 'total_friend_count', (int) $count ); 136 136 return (int) $count; 137 137 } … … 174 174 return false; 175 175 176 return array( 'friends' => $filtered_friend_ids, 'total' => (int) $total_friend_ids );176 return array( 'friends' => $filtered_friend_ids, 'total' => (int) $total_friend_ids ); 177 177 } 178 178 … … 336 336 337 337 // Loop through friend_ids and update their counts 338 foreach ( (array) $friend_ids as $friend_id ) {338 foreach ( (array) $friend_ids as $friend_id ) { 339 339 BP_Friends_Friendship::total_friend_count( $friend_id ); 340 340 } -
trunk/bp-friends/bp-friends-functions.php
r5712 r5729 21 21 $friendship = new BP_Friends_Friendship; 22 22 23 if ( (int) $friendship->is_confirmed )23 if ( (int) $friendship->is_confirmed ) 24 24 return true; 25 25 … … 173 173 return false; 174 174 175 if ( !(int) $friend_count )175 if ( !(int) $friend_count ) 176 176 return false; 177 177 -
trunk/bp-friends/bp-friends-notifications.php
r5712 r5729 18 18 $initiator_name = bp_core_get_user_displayname( $initiator_id ); 19 19 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 ) ) 21 21 return false; 22 22 -
trunk/bp-friends/bp-friends-template.php
r5712 r5729 274 274 $user_id = bp_displayed_user_id(); 275 275 276 return apply_filters( 'bp_get_potential_friend_id', (int) $user_id );276 return apply_filters( 'bp_get_potential_friend_id', (int) $user_id ); 277 277 } 278 278 -
trunk/bp-groups/bp-groups-actions.php
r5714 r5729 111 111 // Checked against a whitelist for security 112 112 $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'; 114 114 115 115 groups_update_groupmeta( $bp->groups->new_group_id, 'invite_status', $invite_status ); … … 156 156 * we need to loop the step array and fetch the next step that way. 157 157 */ 158 foreach ( (array) $bp->groups->group_creation_steps as $key => $value ) {158 foreach ( (array) $bp->groups->group_creation_steps as $key => $value ) { 159 159 if ( $key == $bp->groups->current_create_step ) { 160 160 $next = 1; … … 276 276 return false; 277 277 278 foreach ( (array) $bp->groups->group_creation_steps as $slug => $step ) {278 foreach ( (array) $bp->groups->group_creation_steps as $slug => $step ) { 279 279 while ( !empty( $temp[$step['position']] ) ) 280 280 $step['position']++; … … 287 287 unset($bp->groups->group_creation_steps); 288 288 289 foreach( (array) $temp as $position => $step )289 foreach( (array) $temp as $position => $step ) 290 290 $bp->groups->group_creation_steps[$step['slug']] = array( 'name' => $step['name'], 'position' => $position ); 291 291 } -
trunk/bp-groups/bp-groups-activity.php
r5714 r5729 90 90 // Because different values are passed to the filters, we'll return the 91 91 // 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 ); 94 94 $filter = 'bp_groups_multiple_new_membership_requests_notification'; 95 95 $notification_link = $group_link . 'admin/membership-requests/?n=1'; … … 127 127 $group_link = bp_get_group_permalink( $group ); 128 128 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 ); 131 131 $filter = 'bp_groups_multiple_membership_request_accepted_notification'; 132 132 $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1'; … … 163 163 $group_link = bp_get_group_permalink( $group ); 164 164 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 ); 167 167 $filter = 'bp_groups_multiple_membership_request_rejected_notification'; 168 168 $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1'; … … 199 199 $group_link = bp_get_group_permalink( $group ); 200 200 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 ); 203 203 $filter = 'bp_groups_multiple_member_promoted_to_admin_notification'; 204 204 $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1'; … … 235 235 $group_link = bp_get_group_permalink( $group ); 236 236 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 ); 239 239 $filter = 'bp_groups_multiple_member_promoted_to_mod_notification'; 240 240 $notification_link = trailingslashit( bp_loggedin_user_domain() . bp_get_groups_slug() ) . '?n=1'; … … 272 272 $notification_link = bp_loggedin_user_domain() . bp_get_groups_slug() . '/invites/?n=1'; 273 273 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 ); 276 276 $filter = 'bp_groups_multiple_group_invite_notification'; 277 277 -
trunk/bp-groups/bp-groups-classes.php
r5714 r5729 62 62 // Get group admins and mods 63 63 $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 ) { 65 65 if ( (int) $user->is_admin ) 66 66 $this->admins[] = $user; … … 150 150 // Fetch the user IDs of all the members of the group 151 151 $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 ); 153 153 154 154 // Modify group count usermeta for members … … 350 350 351 351 // 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 ); 353 353 $paged_groups = $wpdb->get_results( $paged_groups_sql ); 354 354 … … 382 382 383 383 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'] ); 385 385 386 386 // 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 ); 388 388 $total_groups = $wpdb->get_var( $total_groups_sql ); 389 389 390 390 $group_ids = array(); 391 foreach ( (array) $paged_groups as $group ) {391 foreach ( (array) $paged_groups as $group ) { 392 392 $group_ids[] = $group->id; 393 393 } … … 395 395 // Populate some extra information instead of querying each time in the loop 396 396 if ( !empty( $populate_extras ) ) { 397 $group_ids = $wpdb->escape( join( ',', (array) $group_ids ) );397 $group_ids = $wpdb->escape( join( ',', (array) $group_ids ) ); 398 398 $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, $type ); 399 399 } … … 440 440 441 441 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 ) ); 444 444 $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, 'newest' ); 445 445 } … … 481 481 482 482 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 ) ); 485 485 $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, 'newest' ); 486 486 } … … 521 521 522 522 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 ) ); 525 525 $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, 'newest' ); 526 526 } … … 558 558 559 559 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 ) ); 562 562 $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, 'newest' ); 563 563 } … … 577 577 $paged_groups[$i]->is_member = false; 578 578 579 foreach ( (array) $user_status as $group_id ) {579 foreach ( (array) $user_status as $group_id ) { 580 580 if ( $group_id == $paged_groups[$i]->id ) { 581 581 $paged_groups[$i]->is_member = true; … … 588 588 $paged_groups[$i]->is_banned = false; 589 589 590 foreach ( (array) $user_banned as $group_id ) {590 foreach ( (array) $user_banned as $group_id ) { 591 591 if ( $group_id == $paged_groups[$i]->id ) { 592 592 $paged_groups[$i]->is_banned = true; … … 1149 1149 1150 1150 // Fetch whether or not the user is a friend 1151 foreach ( (array) $members as $user )1151 foreach ( (array) $members as $user ) 1152 1152 $user_ids[] = $user->user_id; 1153 1153 … … 1157 1157 $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() ) ); 1158 1158 for ( $i = 0, $count = count( $members ); $i < $count; ++$i ) { 1159 foreach ( (array) $friend_status as $status ) {1159 foreach ( (array) $friend_status as $status ) { 1160 1160 if ( $status->initiator_user_id == $members[$i]->user_id || $status->friend_user_id == $members[$i]->user_id ) { 1161 1161 $members[$i]->is_friend = $status->is_confirmed; -
trunk/bp-groups/bp-groups-forums.php
r5689 r5729 167 167 'primary_link' => apply_filters( 'groups_activity_new_forum_topic_primary_link', bp_get_group_permalink( $bp->groups->current_group ) . 'forum/topic/' . $topic->topic_slug . '/' ), 168 168 '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, 171 171 'secondary_item_id' => $topic->topic_id, 172 172 'recorded_time ' => $topic->topic_time … … 209 209 'primary_link' => apply_filters( 'groups_activity_new_forum_post_primary_link', $primary_link . "#post-" . $post_id ), 210 210 '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, 213 213 'secondary_item_id' => $post_id, 214 214 'recorded_time' => $post->post_time … … 249 249 250 250 // The activity item for each post 251 foreach ( (array) $posts as $post ) {251 foreach ( (array) $posts as $post ) { 252 252 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' ) ); 253 253 } -
trunk/bp-groups/bp-groups-functions.php
r5714 r5729 236 236 global $bp; 237 237 238 return in_array( $status, (array) $bp->groups->valid_status );238 return in_array( $status, (array) $bp->groups->valid_status ); 239 239 } 240 240 … … 245 245 $slug = substr( $slug, 2, strlen( $slug ) - 2 ); 246 246 247 if ( in_array( $slug, (array) $bp->groups->forbidden_names ) )247 if ( in_array( $slug, (array) $bp->groups->forbidden_names ) ) 248 248 $slug = $slug . '-' . rand(); 249 249 … … 927 927 } 928 928 929 $metas = array_map( 'maybe_unserialize', (array) $metas );929 $metas = array_map( 'maybe_unserialize', (array) $metas ); 930 930 931 931 if ( 1 == count( $metas ) ) -
trunk/bp-groups/bp-groups-notifications.php
r5727 r5729 21 21 22 22 $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 ) { 24 24 if ( 'no' == bp_get_user_meta( $user_id, 'notification_groups_group_updated', true ) ) continue; 25 25 -
trunk/bp-groups/bp-groups-screens.php
r5714 r5729 410 410 411 411 if ( !empty( $_POST['friends'] ) ) { 412 foreach( (array) $_POST['friends'] as $friend ) {412 foreach( (array) $_POST['friends'] as $friend ) { 413 413 groups_invite_user( array( 'user_id' => $friend, 'group_id' => $bp->groups->current_group->id ) ); 414 414 } … … 493 493 return false; 494 494 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'] ) ) { 496 496 bp_core_add_message( __( 'There was an error updating group details, please try again.', 'buddypress' ), 'error' ); 497 497 } else { … … 526 526 // Checked against a whitelist for security 527 527 $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'; 529 529 530 530 // Checked against a whitelist for security 531 531 $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'; 533 533 534 534 // Check the nonce -
trunk/bp-groups/bp-groups-template.php
r5714 r5729 141 141 142 142 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']; 145 145 $this->groups = $this->groups['groups']; 146 146 } else if ( 'single-group' == $type ) { … … 149 149 $this->group_count = 1; 150 150 } 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']; 153 153 } else { 154 $this->total_group_count = (int) $max;154 $this->total_group_count = (int) $max; 155 155 } 156 156 … … 161 161 $this->group_count = count( $this->groups ); 162 162 } else { 163 $this->group_count = (int) $max;163 $this->group_count = (int) $max; 164 164 } 165 165 } else { … … 169 169 170 170 // 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 ) { 172 172 $this->pag_links = paginate_links( array( 173 173 'base' => add_query_arg( array( 'grpage' => '%#%', 'num' => $this->pag_num, 's' => $search_terms, 'sortby' => $this->sort_by, 'order' => $this->order ) ), 174 174 '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 ), 176 176 'current' => $this->pag_page, 177 177 'prev_text' => _x( '←', 'Group pagination previous text', 'buddypress' ), … … 287 287 } 288 288 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 ); 290 290 return apply_filters( 'bp_has_groups', $groups_template->has_groups(), $groups_template ); 291 291 } … … 568 568 if ( !empty( $group->admins ) ) { ?> 569 569 <ul id="group-admins"> 570 <?php foreach( (array) $group->admins as $admin ) { ?>570 <?php foreach( (array) $group->admins as $admin ) { ?> 571 571 <li> 572 572 <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> … … 590 590 <ul id="group-mods"> 591 591 592 <?php foreach( (array) $group->mods as $mod ) { ?>592 <?php foreach( (array) $group->mods as $mod ) { ?> 593 593 594 594 <li> … … 797 797 798 798 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 ); 800 800 801 801 if ( (bool) $showtext ) { … … 831 831 832 832 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 ); 834 834 835 835 if ( (bool) $showtext ) { … … 1024 1024 <ul id="admins-list" class="item-list<?php if ( !empty( $admin_list ) ) : ?> single-line<?php endif; ?>"> 1025 1025 1026 <?php foreach ( (array) $admins as $admin ) { ?>1026 <?php foreach ( (array) $admins as $admin ) { ?> 1027 1027 1028 1028 <?php if ( !empty( $admin_list ) ) : ?> … … 1089 1089 <ul id="mods-list" class="item-list<?php if ( $admin_list ) { ?> single-line<?php } ?>"> 1090 1090 1091 <?php foreach ( (array) $group_mods as $mod ) { ?>1091 <?php foreach ( (array) $group_mods as $mod ) { ?> 1092 1092 1093 1093 <?php if ( !empty( $admin_list ) ) { ?> … … 1697 1697 $this->members = BP_Groups_Member::get_all_for_group( $group_id, $this->pag_num, $this->pag_page, $exclude_admins_mods, $exclude_banned, $exclude ); 1698 1698 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']; 1701 1701 else 1702 $this->total_member_count = (int) $max;1702 $this->total_member_count = (int) $max; 1703 1703 1704 1704 $this->members = $this->members['members']; … … 1708 1708 $this->member_count = count($this->members); 1709 1709 else 1710 $this->member_count = (int) $max;1710 $this->member_count = (int) $max; 1711 1711 } else { 1712 1712 $this->member_count = count($this->members); … … 1783 1783 extract( $r, EXTR_SKIP ); 1784 1784 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 ); 1786 1786 return apply_filters( 'bp_group_has_members', $members_template->has_members(), $members_template ); 1787 1787 } … … 2005 2005 $counter = 1; 2006 2006 2007 foreach ( (array) $bp->groups->group_creation_steps as $slug => $step ) {2007 foreach ( (array) $bp->groups->group_creation_steps as $slug => $step ) { 2008 2008 $is_enabled = bp_are_previous_group_creation_steps_complete( $slug ); ?> 2009 2009 … … 2068 2068 $found = true; 2069 2069 2070 foreach ( (array) $step_slugs as $step_slug ) {2070 foreach ( (array) $step_slugs as $step_slug ) { 2071 2071 if ( !in_array( $step_slug, $bp->groups->completed_create_steps ) ) 2072 2072 $found = false; … … 2092 2092 2093 2093 /* 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 ) { 2095 2095 if ( $slug == $step_slug ) 2096 2096 break; … … 2188 2188 global $bp; 2189 2189 2190 foreach ( (array) $bp->groups->group_creation_steps as $slug => $name ) {2190 foreach ( (array) $bp->groups->group_creation_steps as $slug => $name ) { 2191 2191 if ( bp_is_action_variable( $slug ) ) 2192 2192 break; … … 2256 2256 2257 2257 if ( !empty( $items ) ) 2258 return implode( "\n", (array) $items );2258 return implode( "\n", (array) $items ); 2259 2259 2260 2260 return false; … … 2421 2421 $this->requests = BP_Groups_Group::get_membership_requests( $group_id, $this->pag_num, $this->pag_page ); 2422 2422 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']; 2425 2425 else 2426 $this->total_request_count = (int) $max;2426 $this->total_request_count = (int) $max; 2427 2427 2428 2428 $this->requests = $this->requests['requests']; … … 2432 2432 $this->request_count = count($this->requests); 2433 2433 else 2434 $this->request_count = (int) $max;2434 $this->request_count = (int) $max; 2435 2435 } else { 2436 2436 $this->request_count = count($this->requests); … … 2770 2770 $current_group = groups_get_current_group(); 2771 2771 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; 2773 2773 2774 2774 return apply_filters( 'bp_get_current_group_id', $current_group_id, $current_group ); -
trunk/bp-members/bp-members-buddybar.php
r5705 r5729 77 77 78 78 echo '<ul class="author-list">'; 79 foreach( (array) $authors as $author ) {79 foreach( (array) $authors as $author ) { 80 80 $caps = maybe_unserialize( $author->caps ); 81 81 if ( isset( $caps['subscriber'] ) || isset( $caps['contributor'] ) ) continue; -
trunk/bp-members/bp-members-functions.php
r5727 r5729 724 724 return $auth_obj; 725 725 726 if ( ( is_multisite() && (int) $user->spam ) || 1 == (int)$user->user_status )726 if ( ( is_multisite() && (int) $user->spam ) || 1 == (int) $user->user_status ) 727 727 return new WP_Error( 'invalid_username', __( '<strong>ERROR</strong>: Your account has been marked as a spammer.', 'buddypress' ) ); 728 728 else … … 825 825 826 826 // 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 ); 828 828 829 829 // Remove duplicates 830 $illegal_names = array_unique( (array) $merged_names );830 $illegal_names = array_unique( (array) $merged_names ); 831 831 832 832 return apply_filters( 'bp_core_illegal_names', $illegal_names ); … … 854 854 $illegal_names = get_site_option( 'illegal_names' ); 855 855 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 ) ) 857 857 $errors->add( 'user_name', __( 'Only lowercase letters and numbers allowed', 'buddypress' ) ); 858 858 … … 881 881 $emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) ); 882 882 883 if ( in_array( $emaildomain, (array) $limited_email_domains ) == false )883 if ( in_array( $emaildomain, (array) $limited_email_domains ) == false ) 884 884 $errors->add( 'user_email', __( 'Sorry, that email address is not allowed!', 'buddypress' ) ); 885 885 } … … 942 942 $profile_field_ids = explode( ',', $usermeta['profile_field_ids'] ); 943 943 944 foreach( (array) $profile_field_ids as $field_id ) {944 foreach( (array) $profile_field_ids as $field_id ) { 945 945 if ( empty( $usermeta["field_{$field_id}"] ) ) 946 946 continue; … … 1001 1001 $profile_field_ids = explode( ',', $user['meta']['profile_field_ids'] ); 1002 1002 1003 foreach( (array) $profile_field_ids as $field_id ) {1003 foreach( (array) $profile_field_ids as $field_id ) { 1004 1004 $current_field = isset( $user['meta']["field_{$field_id}"] ) ? $user['meta']["field_{$field_id}"] : false; 1005 1005 -
trunk/bp-members/bp-members-screens.php
r5700 r5729 148 148 // Add any errors to the action for the field in the template for display. 149 149 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 ) 151 151 add_action( 'bp_' . $fieldname . '_errors', create_function( '', 'echo apply_filters(\'bp_members_signup_error_message\', "<div class=\"error\">' . $error_message . '</div>" );' ) ); 152 152 } else { -
trunk/bp-members/bp-members-template.php
r5727 r5729 181 181 $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 ) ); 182 182 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']; 185 185 else 186 $this->total_member_count = (int) $max;186 $this->total_member_count = (int) $max; 187 187 188 188 $this->members = $this->members['users']; … … 192 192 $this->member_count = count( $this->members ); 193 193 } else { 194 $this->member_count = (int) $max;194 $this->member_count = (int) $max; 195 195 } 196 196 } else { … … 198 198 } 199 199 200 if ( (int) $this->total_member_count && (int)$this->pag_num ) {200 if ( (int) $this->total_member_count && (int) $this->pag_num ) { 201 201 $this->pag_links = paginate_links( array( 202 202 'base' => add_query_arg( 'upage', '%#%' ), 203 203 '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 ), 205 205 'current' => (int) $this->pag_page, 206 206 'prev_text' => _x( '←', 'Member pagination previous text', 'buddypress' ), … … 746 746 global $bp; 747 747 748 foreach ( (array) $bp->bp_nav as $user_nav_item ) {748 foreach ( (array) $bp->bp_nav as $user_nav_item ) { 749 749 if ( !$user_nav_item['show_for_displayed_user'] && !bp_is_my_profile() ) 750 750 continue; -
trunk/bp-messages/bp-messages-classes.php
r5697 r5729 36 36 return false; 37 37 38 foreach ( (array) $this->messages as $key => $message )38 foreach ( (array) $this->messages as $key => $message ) 39 39 $this->sender_ids[$message->sender_id] = $message->sender_id; 40 40 … … 113 113 114 114 // Sort threads by date_sent 115 foreach( (array) $thread_ids as $thread )115 foreach( (array) $thread_ids as $thread ) 116 116 $sorted_threads[$thread->thread_id] = strtotime( $thread->date_sent ); 117 117 … … 119 119 120 120 $threads = false; 121 foreach ( (array) $sorted_threads as $thread_id => $date_sent )121 foreach ( (array) $sorted_threads as $thread_id => $date_sent ) 122 122 $threads[] = new BP_Messages_Thread( $thread_id ); 123 123 124 return array( 'threads' => &$threads, 'total' => (int) $total_threads );124 return array( 'threads' => &$threads, 'total' => (int) $total_threads ); 125 125 } 126 126 … … 210 210 $recipient_links = array(); 211 211 212 foreach ( (array) $recipients as $recipient )212 foreach ( (array) $recipients as $recipient ) 213 213 $recipient_links[] = bp_core_get_userlink( $recipient->user_id ); 214 214 … … 229 229 return true; 230 230 231 foreach( (array) $threads as $thread ) {231 foreach( (array) $threads as $thread ) { 232 232 $message_ids = maybe_unserialize( $thread->message_ids ); 233 233 … … 298 298 // If we have no thread_id then this is the first message of a new thread. 299 299 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; 301 301 $new_thread = true; 302 302 } … … 310 310 if ( $new_thread ) { 311 311 // Add an recipient entry for all recipients 312 foreach ( (array) $this->recipients as $recipient ) {312 foreach ( (array) $this->recipients as $recipient ) { 313 313 $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 ) ); 314 314 $recipient_ids[] = $recipient->user_id; -
trunk/bp-messages/bp-messages-functions.php
r5696 r5729 90 90 91 91 // 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 ) ) 93 93 unset( $recipient_ids[$key] ); 94 94 95 95 // Remove duplicates 96 $recipient_ids = array_unique( (array) $recipient_ids );96 $recipient_ids = array_unique( (array) $recipient_ids ); 97 97 98 98 if ( empty( $recipient_ids ) ) … … 100 100 101 101 // Format this to match existing recipients 102 foreach( (array) $recipient_ids as $i => $recipient_id ) {102 foreach( (array) $recipient_ids as $i => $recipient_id ) { 103 103 $message->recipients[$i] = new stdClass; 104 104 $message->recipients[$i]->user_id = $recipient_id; … … 109 109 110 110 // Send screen notifications to the recipients 111 foreach ( (array) $message->recipients as $recipient )111 foreach ( (array) $message->recipients as $recipient ) 112 112 bp_core_add_notification( $message->id, $recipient->user_id, 'messages', 'new_message' ); 113 113 … … 234 234 235 235 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 ); 237 237 $filter = 'bp_messages_multiple_new_message_notification'; 238 238 } 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 ); 240 240 $filter = 'bp_messages_single_new_message_notification'; 241 241 } … … 243 243 244 244 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 ); 246 246 } else { 247 247 $return = apply_filters( $filter, array( -
trunk/bp-messages/bp-messages-template.php
r5705 r5729 56 56 $total_notice_count = BP_Messages_Notice::get_total_notice_count(); 57 57 58 if ( !$max || $max >= (int) $total_notice_count ) {58 if ( !$max || $max >= (int) $total_notice_count ) { 59 59 if ( 'notices' == $this->box ) { 60 $this->total_thread_count = (int) $total_notice_count;60 $this->total_thread_count = (int) $total_notice_count; 61 61 } 62 62 } else { 63 $this->total_thread_count = (int) $max;63 $this->total_thread_count = (int) $max; 64 64 } 65 65 … … 68 68 $this->thread_count = count( $this->threads ); 69 69 } else { 70 $this->thread_count = (int) $max;70 $this->thread_count = (int) $max; 71 71 } 72 72 } else { … … 75 75 } 76 76 77 if ( (int) $this->total_thread_count && (int)$this->pag_num ) {77 if ( (int) $this->total_thread_count && (int) $this->pag_num ) { 78 78 $this->pag_links = paginate_links( array( 79 79 'base' => add_query_arg( 'mpage', '%#%' ), 80 80 '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 ), 82 82 'current' => $this->pag_page, 83 83 'prev_text' => _x( '←', 'Message pagination previous text', 'buddypress' ), … … 130 130 if ( 'notices' != $bp->current_action ) { 131 131 $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 ); 133 133 134 134 // Set up the last message data 135 135 if ( count($this->thread->messages) > 1 ) { 136 136 if ( 'inbox' == $this->box ) { 137 foreach ( (array) $this->thread->messages as $key => $message ) {137 foreach ( (array) $this->thread->messages as $key => $message ) { 138 138 if ( bp_loggedin_user_id() != $message->sender_id ) { 139 139 $last_message_index = $key; … … 143 143 144 144 } elseif ( 'sentbox' == $this->box ) { 145 foreach ( (array) $this->thread->messages as $key => $message ) {145 foreach ( (array) $this->thread->messages as $key => $message ) { 146 146 if ( bp_loggedin_user_id() == $message->sender_id ) { 147 147 $last_message_index = $key; … … 296 296 global $messages_template; 297 297 298 if ( (int) $messages_template->thread->unread_count )298 if ( (int) $messages_template->thread->unread_count ) 299 299 return apply_filters( 'bp_get_message_thread_unread_count', $messages_template->thread->unread_count ); 300 300 … … 493 493 global $messages_template, $bp; 494 494 495 if ( 1 == (int) $messages_template->thread->is_active ) {495 if ( 1 == (int) $messages_template->thread->is_active ) { 496 496 $link = wp_nonce_url( trailingslashit( bp_loggedin_user_domain() . $bp->messages->slug . '/notices/deactivate/' . $messages_template->thread->id ), 'messages_deactivate_notice' ); 497 497 } else { … … 507 507 global $messages_template; 508 508 509 if ( 1 == (int) $messages_template->thread->is_active ) {509 if ( 1 == (int) $messages_template->thread->is_active ) { 510 510 $text = __('Deactivate', 'buddypress'); 511 511 } else { … … 788 788 return apply_filters( 'bp_get_the_thread_recipients', sprintf( __( '%d Recipients', 'buddypress' ), count($thread_template->thread->recipients) ) ); 789 789 790 foreach( (array) $thread_template->thread->recipients as $recipient ) {790 foreach( (array) $thread_template->thread->recipients as $recipient ) { 791 791 if ( (int) $recipient->user_id !== bp_loggedin_user_id() ) 792 792 $recipient_links[] = bp_core_get_userlink( $recipient->user_id ); -
trunk/bp-settings/bp-settings-actions.php
r5690 r5729 52 52 $emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) ); 53 53 54 if ( in_array( $emaildomain, (array) $limited_email_domains ) == false ) {54 if ( in_array( $emaildomain, (array) $limited_email_domains ) == false ) { 55 55 $email_error = true; 56 56 } … … 143 143 144 144 if ( isset( $_POST['notifications'] ) ) { 145 foreach ( (array) $_POST['notifications'] as $key => $value ) {145 foreach ( (array) $_POST['notifications'] as $key => $value ) { 146 146 if ( $meta_key = bp_get_user_meta_key( $key ) ) 147 147 bp_update_user_meta( (int)bp_displayed_user_id(), $meta_key, $value ); -
trunk/bp-themes/bp-default/_inc/ajax.php
r5706 r5729 57 57 58 58 /* Now pass the querystring to override default values. */ 59 $query_string = empty( $qs ) ? '' : join( '&', (array) $qs );59 $query_string = empty( $qs ) ? '' : join( '&', (array) $qs ); 60 60 61 61 $object_filter = ''; -
trunk/bp-themes/bp-default/comments.php
r4577 r5729 12 12 $num_comments = 0; 13 13 $num_trackbacks = 0; 14 foreach ( (array) $comments as $comment ) {14 foreach ( (array) $comments as $comment ) { 15 15 if ( 'comment' != get_comment_type() ) 16 16 $num_trackbacks++; … … 63 63 64 64 <ul id="trackbacklist"> 65 <?php foreach ( (array) $comments as $comment ) : ?>65 <?php foreach ( (array) $comments as $comment ) : ?> 66 66 67 67 <?php if ( 'comment' != get_comment_type() ) : ?> -
trunk/bp-xprofile/bp-xprofile-classes.php
r5699 r5729 144 144 // Get the group ids 145 145 $group_ids = array(); 146 foreach( (array) $groups as $group ) {146 foreach( (array) $groups as $group ) { 147 147 $group_ids[] = $group->id; 148 148 } … … 179 179 180 180 // 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 ) { 182 182 183 183 // Empty fields may contain a serialized empty array … … 205 205 206 206 // Loop through fields 207 foreach( (array) $fields as $field_key => $field ) {207 foreach( (array) $fields as $field_key => $field ) { 208 208 209 209 // Loop throught the data in each field 210 foreach( (array) $field_data as $data ) {210 foreach( (array) $field_data as $data ) { 211 211 212 212 // Assign correct data value to the field … … 490 490 $counter = 1; 491 491 if ( !empty( $options ) ) { 492 foreach ( (array) $options as $option_key => $option_value ) {492 foreach ( (array) $options as $option_key => $option_value ) { 493 493 $is_default = 0; 494 494 -
trunk/bp-xprofile/bp-xprofile-filters.php
r5699 r5729 100 100 } else { 101 101 $filtered_values = array(); 102 foreach ( (array) $field_value as $value ) {102 foreach ( (array) $field_value as $value ) { 103 103 $kses_field_value = xprofile_filter_kses( $value ); 104 104 $filtered_value = wp_rel_nofollow( force_balance_tags( $kses_field_value ) ); … … 163 163 164 164 if ( !empty( $values ) ) { 165 foreach ( (array) $values as $value ) {165 foreach ( (array) $values as $value ) { 166 166 $value = trim( $value ); 167 167 … … 185 185 186 186 function xprofile_filter_comments( $comments, $post_id ) { 187 foreach( (array) $comments as $comment ) {187 foreach( (array) $comments as $comment ) { 188 188 if ( $comment->user_id ) { 189 189 $user_ids[] = $comment->user_id; … … 195 195 196 196 if ( $fullnames = BP_XProfile_ProfileData::get_value_byid( 1, $user_ids ) ) { 197 foreach( (array) $fullnames as $user ) {197 foreach( (array) $fullnames as $user ) { 198 198 $users[$user->user_id] = trim($user->value); 199 199 } 200 200 } 201 201 202 foreach( (array) $comments as $i => $comment ) {202 foreach( (array) $comments as $i => $comment ) { 203 203 if ( !empty( $comment->user_id ) ) { 204 204 if ( !empty( $users[$comment->user_id] ) ) { -
trunk/bp-xprofile/bp-xprofile-functions.php
r5699 r5729 175 175 if ( is_array( $values ) ) { 176 176 $data = array(); 177 foreach( (array) $values as $value ) {177 foreach( (array) $values as $value ) { 178 178 $data[] = apply_filters( 'xprofile_get_field_data', $value, $field_id, $user_id ); 179 179 } … … 391 391 global $bp, $wpdb; 392 392 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'] ) 394 394 return true; 395 395 … … 430 430 global $bp; 431 431 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() ) 433 433 return; 434 434 … … 535 535 } 536 536 537 $metas = array_map( 'maybe_unserialize', (array) $metas );537 $metas = array_map( 'maybe_unserialize', (array) $metas ); 538 538 539 539 if ( 1 == count( $metas ) ) -
trunk/bp-xprofile/bp-xprofile-screens.php
r5704 r5729 72 72 // Loop through the posted fields formatting any datebox values 73 73 // then validate the field 74 foreach ( (array) $posted_field_ids as $field_id ) {74 foreach ( (array) $posted_field_ids as $field_id ) { 75 75 if ( !isset( $_POST['field_' . $field_id] ) ) { 76 76 … … 102 102 103 103 // 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 ) { 105 105 106 106 // 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 780 780 global $bp; 781 781 782 if ( !(int) $bp->site_options['bp-disable-avatar-uploads'] )782 if ( !(int) $bp->site_options['bp-disable-avatar-uploads'] ) 783 783 bp_core_avatar_admin( null, bp_loggedin_user_domain() . $bp->profile->slug . '/change-avatar/', bp_loggedin_user_domain() . $bp->profile->slug . '/delete-avatar/' ); 784 784 else
Note: See TracChangeset
for help on using the changeset viewer.