diff --git bp-activity/bp-activity-template.php bp-activity/bp-activity-template.php
index fbd8aec..0a97147 100644
|
|
class BP_Activity_Template { |
104 | 104 | |
105 | 105 | var $full_name; |
106 | 106 | |
107 | | function __construct( $page, $per_page, $max, $include, $sort, $filter, $search_terms, $display_comments, $show_hidden, $exclude = false, $in = false, $spam = 'ham_only', $page_arg = 'acpage' ) { |
| 107 | /** |
| 108 | * Constructor method |
| 109 | * |
| 110 | * See definition of $defaults below, as well as $defaults in bp_has_activities(), for |
| 111 | * description of $args array |
| 112 | * |
| 113 | * @param array $args |
| 114 | */ |
| 115 | function __construct( $args ) { |
108 | 116 | global $bp; |
109 | 117 | |
| 118 | // Backward compatibility with old method of passing arguments |
| 119 | if ( !is_array( $args ) || func_num_args() > 1 ) { |
| 120 | _deprecated_argument( __METHOD__, '1.6', sprintf( __( 'Arguments passed to %s should be in an associative array. See the inline documentation for more details.', 'buddypress' ), __METHOD__ ) ); |
| 121 | |
| 122 | $old_args = array( |
| 123 | 0 => 'page', |
| 124 | 1 => 'per_page', |
| 125 | 2 => 'max', |
| 126 | 3 => 'include', |
| 127 | 4 => 'sort', |
| 128 | 5 => 'filter', |
| 129 | 6 => 'search_terms', |
| 130 | 7 => 'display_comments', |
| 131 | 8 => 'show_hidden', |
| 132 | 9 => 'exclude', |
| 133 | 10 => 'in', |
| 134 | 11 => 'spam', |
| 135 | 12 => 'page_arg' |
| 136 | ); |
| 137 | |
| 138 | $args_count = func_num_args(); |
| 139 | $new_args = array(); |
| 140 | foreach( $old_args as $arg_num => $arg_key ) { |
| 141 | if ( $args_count > $arg_num ) { |
| 142 | $new_args[$arg_key] = func_get_arg( $arg_num ); |
| 143 | } else { |
| 144 | break; |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | // Restore the $args variable so we can parse |
| 149 | $args = $new_args; |
| 150 | } |
| 151 | |
| 152 | $defaults = array( |
| 153 | 'page' => 1, |
| 154 | 'per_page' => 20, |
| 155 | 'page_arg' => 'acpage', |
| 156 | 'max' => false, |
| 157 | 'sort' => false, |
| 158 | 'include' => false, |
| 159 | 'exclude' => false, |
| 160 | 'in' => false, |
| 161 | 'filter' => false, |
| 162 | 'search_terms' => false, |
| 163 | 'display_comments' => 'threaded', |
| 164 | 'show_hidden' => false, |
| 165 | 'spam' => 'ham_only', |
| 166 | ); |
| 167 | $r = wp_parse_args( $args, $defaults ); |
| 168 | extract( $r ); |
| 169 | |
110 | 170 | $this->pag_page = isset( $_REQUEST[$page_arg] ) ? intval( $_REQUEST[$page_arg] ) : $page; |
111 | 171 | $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page; |
112 | 172 | |
… |
… |
function bp_has_activities( $args = '' ) { |
389 | 449 | if ( !empty( $include ) && ( 'ham_only' == $spam ) ) |
390 | 450 | $spam = 'all'; |
391 | 451 | |
392 | | $activities_template = new BP_Activity_Template( $page, $per_page, $max, $include, $sort, $filter, $search_terms, $display_comments, $show_hidden, $exclude, $in, $spam, $page_arg ); |
| 452 | $template_args = array( |
| 453 | 'page' => $page, |
| 454 | 'per_page' => $per_page, |
| 455 | 'page_arg' => $page_arg, |
| 456 | 'max' => $max, |
| 457 | 'sort' => $sort, |
| 458 | 'include' => $include, |
| 459 | 'exclude' => $exclude, |
| 460 | 'in' => $in, |
| 461 | 'filter' => $filter, |
| 462 | 'search_terms' => $search_terms, |
| 463 | 'display_comments' => $display_comments, |
| 464 | 'show_hidden' => $show_hidden, |
| 465 | 'spam' => $spam |
| 466 | ); |
| 467 | |
| 468 | //$activites_template = new BP_Activity_Template( $page, $per_page, $max, $include, $sort, $filter, $search_terms, $display_comments, $show_hidden, $exclude, $in, $spam, $page_arg ); |
| 469 | $activities_template = new BP_Activity_Template( $template_args ); |
393 | 470 | |
394 | | return apply_filters( 'bp_has_activities', $activities_template->has_activities(), $activities_template ); |
| 471 | return apply_filters( 'bp_has_activities', $activities_template->has_activities(), $activities_template, $template_args ); |
395 | 472 | } |
396 | 473 | |
397 | 474 | /** |