Changeset 8491 for trunk/src/bp-activity/bp-activity-template.php
- Timestamp:
- 06/09/2014 06:33:05 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-activity/bp-activity-template.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-template.php
r8477 r8491 98 98 99 99 var $in_the_loop; 100 101 /** 102 * URL parameter key for activity pagination. Default: 'acpage'. 103 * 104 * @since BuddyPress (2.1.0) 105 * @var string 106 */ 107 var $pag_arg; 100 108 101 109 var $pag_page; … … 179 187 extract( $r ); 180 188 181 $this->pag_page = isset( $_REQUEST[$page_arg] ) ? intval( $_REQUEST[$page_arg] ) : $page; 189 $this->pag_arg = $r['page_arg']; 190 $this->pag_page = isset( $_REQUEST[ $this->pag_arg ] ) ? intval( $_REQUEST[ $this->pag_arg ] ) : $page; 182 191 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page; 183 192 … … 221 230 } 222 231 223 if ( !$max || $max >= (int) $this->activities['total'] ) 224 $this->total_activity_count = (int) $this->activities['total']; 225 else 226 $this->total_activity_count = (int) $max; 232 // The total_activity_count property will be set only if a 233 // 'count_total' query has taken place 234 if ( ! is_null( $this->activities['total'] ) ) { 235 if ( ! $max || $max >= (int) $this->activities['total'] ) { 236 $this->total_activity_count = (int) $this->activities['total']; 237 } else { 238 $this->total_activity_count = (int) $max; 239 } 240 } 241 242 $this->has_more_items = $this->activities['has_more_items']; 227 243 228 244 $this->activities = $this->activities['activities']; … … 707 723 708 724 /** 725 * Output the URL for the Load More link. 726 * 727 * @since BuddyPress (2.1.0) 728 */ 729 function bp_activity_load_more_link() { 730 echo bp_get_activity_load_more_link(); 731 } 732 function bp_get_activity_load_more_link() { 733 global $activities_template; 734 735 $link = bp_get_requested_url(); 736 $link = add_query_arg( $activities_template->pag_arg, $activities_template->pag_page + 1, $link ); 737 738 return apply_filters( 'bp_get_activity_load_more_link', $link ); 739 } 740 741 /** 709 742 * Output the activity pagination count. 710 743 * … … 779 812 global $activities_template; 780 813 781 $remaining_pages = 0; 782 783 if ( ! empty( $activities_template->pag_page ) ) { 784 $remaining_pages = floor( ( $activities_template->total_activity_count - 1 ) / ( $activities_template->pag_num * $activities_template->pag_page ) ); 785 } 786 787 $has_more_items = (int) $remaining_pages ? true : false; 814 if ( ! empty( $activities_template->has_more_items ) ) { 815 $has_more_items = true; 816 } else { 817 $remaining_pages = 0; 818 819 if ( ! empty( $activities_template->pag_page ) ) { 820 $remaining_pages = floor( ( $activities_template->total_activity_count - 1 ) / ( $activities_template->pag_num * $activities_template->pag_page ) ); 821 } 822 823 $has_more_items = (int) $remaining_pages > 0; 824 } 788 825 789 826 return apply_filters( 'bp_activity_has_more_items', $has_more_items );
Note:
See TracChangeset
for help on using the changeset viewer.