Changeset 9213
- Timestamp:
- 12/04/2014 08:00:17 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-classes.php
r9212 r9213 337 337 ); 338 338 $r = wp_parse_args( $args, $defaults ); 339 extract( $r );340 339 341 340 // Select conditions … … 352 351 $excluded_types = array(); 353 352 353 // Regular filtering 354 if ( $r['filter'] && $filter_sql = BP_Activity_Activity::get_filter_sql( $r['filter'] ) ) { 355 $where_conditions['filter_sql'] = $filter_sql; 356 } 357 354 358 // Spam 355 if ( 'ham_only' == $ spam )359 if ( 'ham_only' == $r['spam'] ) { 356 360 $where_conditions['spam_sql'] = 'a.is_spam = 0'; 357 elseif ( 'spam_only' == $spam )361 } elseif ( 'spam_only' == $r['spam'] ) { 358 362 $where_conditions['spam_sql'] = 'a.is_spam = 1'; 363 } 359 364 360 365 // Searching 361 if ( $ search_terms) {362 $search_terms_like = '%' . bp_esc_like( $ search_terms) . '%';366 if ( $r['search_terms'] ) { 367 $search_terms_like = '%' . bp_esc_like( $r['search_terms'] ) . '%'; 363 368 $where_conditions['search_sql'] = $wpdb->prepare( 'a.content LIKE %s', $search_terms_like ); 364 369 } 365 370 366 // Filtering367 if ( $filter && $filter_sql = BP_Activity_Activity::get_filter_sql( $filter ) )368 $where_conditions['filter_sql'] = $filter_sql;369 370 371 // Sorting 371 if ( $sort != 'ASC' && $sort != 'DESC' ) 372 $sort = $r['sort']; 373 if ( $sort != 'ASC' && $sort != 'DESC' ) { 372 374 $sort = 'DESC'; 375 } 373 376 374 377 // Hide Hidden Items? 375 if ( ! $show_hidden)378 if ( ! $r['show_hidden'] ) 376 379 $where_conditions['hidden_sql'] = "a.hide_sitewide = 0"; 377 380 378 381 // Exclude specified items 379 if ( ! empty( $exclude) ) {380 $exclude = implode( ',', wp_parse_id_list( $ exclude) );382 if ( ! empty( $r['exclude'] ) ) { 383 $exclude = implode( ',', wp_parse_id_list( $r['exclude'] ) ); 381 384 $where_conditions['exclude'] = "a.id NOT IN ({$exclude})"; 382 385 } 383 386 384 387 // The specific ids to which you want to limit the query 385 if ( ! empty( $in) ) {386 $in = implode( ',', wp_parse_id_list( $ in) );388 if ( ! empty( $r['in'] ) ) { 389 $in = implode( ',', wp_parse_id_list( $r['in'] ) ); 387 390 $where_conditions['in'] = "a.id IN ({$in})"; 388 391 } 389 392 390 393 // Process meta_query into SQL 391 $meta_query_sql = self::get_meta_query_sql( $ meta_query);394 $meta_query_sql = self::get_meta_query_sql( $r['meta_query'] ); 392 395 393 396 if ( ! empty( $meta_query_sql['join'] ) ) { … … 400 403 401 404 // Process date_query into SQL 402 $date_query_sql = self::get_date_query_sql( $ date_query);405 $date_query_sql = self::get_date_query_sql( $r['date_query'] ); 403 406 404 407 if ( ! empty( $date_query_sql ) ) { … … 409 412 // comments in the stream like normal comments or threaded below 410 413 // the activity. 411 if ( false === $ display_comments || 'threaded' === $display_comments) {414 if ( false === $r['display_comments'] || 'threaded' === $r['display_comments'] ) { 412 415 $excluded_types[] = 'activity_comment'; 413 416 } … … 415 418 // Exclude 'last_activity' items unless the 'action' filter has 416 419 // been explicitly set 417 if ( empty( $ filter['object'] ) ) {420 if ( empty( $r['filter']['object'] ) ) { 418 421 $excluded_types[] = 'last_activity'; 419 422 } … … 469 472 470 473 // Sanitize page and per_page parameters 471 $page = absint( $ page);472 $per_page = absint( $ per_page);474 $page = absint( $r['page'] ); 475 $per_page = absint( $r['per_page'] ); 473 476 474 477 $retval = array( … … 560 563 } 561 564 562 if ( ! empty( $activity_ids ) && $ update_meta_cache) {565 if ( ! empty( $activity_ids ) && $r['update_meta_cache'] ) { 563 566 bp_activity_update_meta_cache( $activity_ids ); 564 567 } 565 568 566 if ( $activities && $display_comments ) 567 $activities = BP_Activity_Activity::append_comments( $activities, $spam ); 569 if ( $activities && $r['display_comments'] ) { 570 $activities = BP_Activity_Activity::append_comments( $activities, $r['spam'] ); 571 } 568 572 569 573 // Pre-fetch data associated with activity users and other objects … … 590 594 $total_activities = $wpdb->get_var( $total_activities_sql ); 591 595 592 if ( !empty( $ max) ) {593 if ( (int) $total_activities > (int) $ max)594 $total_activities = $ max;596 if ( !empty( $r['max'] ) ) { 597 if ( (int) $total_activities > (int) $r['max'] ) 598 $total_activities = $r['max']; 595 599 } 596 600
Note: See TracChangeset
for help on using the changeset viewer.