Changeset 3247
- Timestamp:
- 09/10/2010 09:49:11 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-templatetags.php
r3232 r3247 20 20 21 21 $this->pag_page = isset( $_REQUEST['acpage'] ) ? intval( $_REQUEST['acpage'] ) : $page; 22 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;23 24 / * Check if blog/forum replies are disabled */22 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page; 23 24 // Check if blog/forum replies are disabled 25 25 $this->disable_blogforum_replies = $bp->site_options['bp-disable-blogforum-comments']; 26 26 27 / * Get an array of the logged in user's favorite activities */27 // Get an array of the logged in user's favorite activities 28 28 $this->my_favs = maybe_unserialize( get_usermeta( $bp->loggedin_user->id, 'bp_favorite_activities' ) ); 29 29 30 if ( !empty( $include ) ) {31 /* Fetch specific activity items based on ID's */30 // Fetch specific activity items based on ID's 31 if ( !empty( $include ) ) 32 32 $this->activities = bp_activity_get_specific( array( 'activity_ids' => explode( ',', $include ), 'max' => $max, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'sort' => $sort, 'display_comments' => $display_comments ) ); 33 } else {33 else 34 34 $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 ) ); 35 }36 35 37 36 if ( !$max || $max >= (int)$this->activities['total'] ) … … 43 42 44 43 if ( $max ) { 45 if ( $max >= count($this->activities) ) 46 $this->activity_count = count( $this->activities);47 else44 if ( $max >= count($this->activities) ) { 45 $this->activity_count = count( $this->activities ); 46 } else { 48 47 $this->activity_count = (int)$max; 48 } 49 49 } else { 50 $this->activity_count = count( $this->activities);50 $this->activity_count = count( $this->activities ); 51 51 } 52 52 53 53 $this->full_name = $bp->displayed_user->fullname; 54 54 55 / * Fetch parent content for activity comments so we do not have to query in the loop */55 // Fetch parent content for activity comments so we do not have to query in the loop 56 56 foreach ( (array)$this->activities as $activity ) { 57 if ( 'activity_comment' != $activity->type ) continue; 57 if ( 'activity_comment' != $activity->type ) 58 continue; 59 58 60 $parent_ids[] = $activity->item_id; 59 61 } … … 63 65 64 66 if ( !empty( $activity_parents['activities'] ) ) { 65 foreach( $activity_parents['activities'] as $parent ) $this->activity_parents[$parent->id] = $parent; 67 foreach( $activity_parents['activities'] as $parent ) 68 $this->activity_parents[$parent->id] = $parent; 69 66 70 unset( $activity_parents ); 67 71 } 68 72 69 if ( (int) $this->total_activity_count && (int)$this->pag_num ) {73 if ( (int)$this->total_activity_count && (int)$this->pag_num ) { 70 74 $this->pag_links = paginate_links( array( 71 'base' => add_query_arg( 'acpage', '%#%' ),72 'format' => '',73 'total' => ceil( (int)$this->total_activity_count / (int)$this->pag_num ),74 'current' => (int)$this->pag_page,75 'base' => add_query_arg( 'acpage', '%#%' ), 76 'format' => '', 77 'total' => ceil( (int)$this->total_activity_count / (int)$this->pag_num ), 78 'current' => (int)$this->pag_page, 75 79 'prev_text' => '←', 76 80 'next_text' => '→', 77 'mid_size' => 178 ) );81 'mid_size' => 1 82 ) ); 79 83 } 80 84 } -
trunk/bp-blogs/bp-blogs-templatetags.php
r3232 r3247 22 22 23 23 $this->pag_page = isset( $_REQUEST['bpage'] ) ? intval( $_REQUEST['bpage'] ) : $page; 24 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;24 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page; 25 25 26 26 if ( isset( $_REQUEST['letter'] ) && '' != $_REQUEST['letter'] ) … … 37 37 38 38 if ( $max ) { 39 if ( $max >= count( $this->blogs) )40 $this->blog_count = count( $this->blogs);41 else39 if ( $max >= count( $this->blogs ) ) { 40 $this->blog_count = count( $this->blogs ); 41 } else { 42 42 $this->blog_count = (int)$max; 43 } 43 44 } else { 44 $this->blog_count = count($this->blogs); 45 } 46 47 $this->pag_links = paginate_links( array( 48 'base' => add_query_arg( 'bpage', '%#%' ), 49 'format' => '', 50 'total' => ceil( (int) $this->total_blog_count / (int) $this->pag_num ), 51 'current' => (int) $this->pag_page, 52 'prev_text' => '←', 53 'next_text' => '→', 54 'mid_size' => 1 55 )); 45 $this->blog_count = count( $this->blogs ); 46 } 47 48 if ( (int)$this->total_blog_count && (int)$this->pag_num ) { 49 $this->pag_links = paginate_links( array( 50 'base' => add_query_arg( 'bpage', '%#%' ), 51 'format' => '', 52 'total' => ceil( (int)$this->total_blog_count / (int)$this->pag_num ), 53 'current' => (int)$this->pag_page, 54 'prev_text' => '←', 55 'next_text' => '→', 56 'mid_size' => 1 57 ) ); 58 } 56 59 } 57 60 -
trunk/bp-core/bp-core-templatetags.php
r3239 r3247 22 22 23 23 $this->pag_page = isset( $_REQUEST['upage'] ) ? intval( $_REQUEST['upage'] ) : $page_number; 24 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;25 $this->type = $type;26 27 if ( isset( $_REQUEST['letter'] ) && '' != $_REQUEST['letter'] ) {24 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page; 25 $this->type = $type; 26 27 if ( isset( $_REQUEST['letter'] ) && '' != $_REQUEST['letter'] ) 28 28 $this->members = BP_Core_User::get_users_by_letter( $_REQUEST['letter'], $this->pag_num, $this->pag_page, $populate_extras ); 29 } 30 else if ( false !== $include ) { 29 else if ( false !== $include ) 31 30 $this->members = BP_Core_User::get_specific_users( $include, $this->pag_num, $this->pag_page, $populate_extras ); 32 } 33 else { 31 else 34 32 $this->members = bp_core_get_users( array( 'type' => $this->type, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'user_id' => $user_id, 'search_terms' => $search_terms, 'populate_extras' => $populate_extras ) ); 35 }36 33 37 34 if ( !$max || $max >= (int)$this->members['total'] ) … … 43 40 44 41 if ( $max ) { 45 if ( $max >= count( $this->members) )46 $this->member_count = count( $this->members);47 else42 if ( $max >= count( $this->members ) ) { 43 $this->member_count = count( $this->members ); 44 } else { 48 45 $this->member_count = (int)$max; 46 } 49 47 } else { 50 $this->member_count = count( $this->members);48 $this->member_count = count( $this->members ); 51 49 } 52 50 53 if ( (int) $this->total_member_count && (int)$this->pag_num ) {51 if ( (int)$this->total_member_count && (int)$this->pag_num ) { 54 52 $this->pag_links = paginate_links( array( 55 'base' => add_query_arg( 'upage', '%#%' ),56 'format' => '',57 'total' => ceil( (int) $this->total_member_count / (int)$this->pag_num ),58 'current' => (int) $this->pag_page,53 'base' => add_query_arg( 'upage', '%#%' ), 54 'format' => '', 55 'total' => ceil( (int)$this->total_member_count / (int)$this->pag_num ), 56 'current' => (int) $this->pag_page, 59 57 'prev_text' => '←', 60 58 'next_text' => '→', 61 'mid_size' => 162 ) );59 'mid_size' => 1 60 ) ); 63 61 } 64 62 } -
trunk/bp-forums/bp-forums-templatetags.php
r3232 r3247 22 22 global $bp; 23 23 24 $this->pag_page = isset( $_REQUEST['p'] ) ? intval( $_REQUEST['p'] ) : $page;25 $this->pag_num = isset( $_REQUEST['n'] ) ? intval( $_REQUEST['n'] ) : $per_page;26 $this->type = $type;24 $this->pag_page = isset( $_REQUEST['p'] ) ? intval( $_REQUEST['p'] ) : $page; 25 $this->pag_num = isset( $_REQUEST['n'] ) ? intval( $_REQUEST['n'] ) : $per_page; 26 $this->type = $type; 27 27 $this->search_terms = $search_terms; 28 28 … … 66 66 67 67 if ( $max ) { 68 if ( $max >= count( $this->topics) )68 if ( $max >= count( $this->topics ) ) { 69 69 $this->topic_count = count( $this->topics ); 70 else70 } else { 71 71 $this->topic_count = (int)$max; 72 } 72 73 } else { 73 74 $this->topic_count = count( $this->topics ); … … 75 76 } 76 77 77 $this->topic_count = apply_filters( 'bp_forums_template_topic_count', $this->topic_count, &$topics, $type, $forum_id, $per_page, $max, $no_stickies );78 $this->topic_count = apply_filters( 'bp_forums_template_topic_count', $this->topic_count, &$topics, $type, $forum_id, $per_page, $max, $no_stickies ); 78 79 $this->total_topic_count = apply_filters( 'bp_forums_template_total_topic_count', $this->total_topic_count, $this->topic_count, &$topics, $type, $forum_id, $per_page, $max, $no_stickies ); 79 80 80 if ( !$no_stickies ) {81 / * Place stickies at the top - not sure why bbPress doesn't do this? */81 if ( !$no_stickies ) { 82 // Place stickies at the top - not sure why bbPress doesn't do this? 82 83 foreach( (array)$this->topics as $topic ) { 83 if ( 1 == (int)$topic->topic_sticky ) 84 if ( 1 == (int)$topic->topic_sticky ) { 84 85 $stickies[] = $topic; 85 else86 } else { 86 87 $standard[] = $topic; 88 } 87 89 } 90 88 91 $this->topics = array_merge( (array)$stickies, (array)$standard ); 89 92 } 90 93 91 / * Fetch extra information for topics, so we don't have to query inside the loop */94 // Fetch extra information for topics, so we don't have to query inside the loop 92 95 $this->topics = bp_forums_get_topic_extras( &$this->topics ); 93 96 94 $this->pag_links = paginate_links( array( 95 'base' => add_query_arg( array( 'p' => '%#%', 'n' => $this->pag_num ) ), 96 'format' => '', 97 'total' => ceil($this->total_topic_count / $this->pag_num), 98 'current' => $this->pag_page, 99 'prev_text' => '←', 100 'next_text' => '→', 101 'mid_size' => 1 102 )); 97 if ( (int)$this->total_topic_count && (int)$this->pag_num ) { 98 $this->pag_links = paginate_links( array( 99 'base' => add_query_arg( array( 'p' => '%#%', 'n' => $this->pag_num ) ), 100 'format' => '', 101 'total' => ceil( (int)$this->total_topic_count / (int)$this->pag_num ), 102 'current' => $this->pag_page, 103 'prev_text' => '←', 104 'next_text' => '→', 105 'mid_size' => 1 106 ) ); 107 } 103 108 } 104 109 … … 710 715 global $bp, $current_user, $forum_template; 711 716 712 $this->pag_page = isset( $_REQUEST['topic_page'] ) ? intval( $_REQUEST['topic_page'] ) : 1; 713 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page; 714 715 $this->topic_id = $topic_id; 717 $this->pag_page = isset( $_REQUEST['topic_page'] ) ? intval( $_REQUEST['topic_page'] ) : 1; 718 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page; 719 720 $this->order = $order; 721 $this->topic_id = $topic_id; 716 722 $forum_template->topic = (object) bp_forums_get_topic_details( $this->topic_id ); 717 723 718 $this->posts = bp_forums_get_topic_posts( array( 'topic_id' => $this->topic_id, 'page' => $this->pag_page, 'per_page' => $this->pag_num) );724 $this->posts = bp_forums_get_topic_posts( array( 'topic_id' => $this->topic_id, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'order' => $this->order ) ); 719 725 720 726 if ( !$this->posts ) { … … 722 728 $this->total_post_count = 0; 723 729 } else { 724 if ( !$max || $max >= (int) $forum_template->topic->topic_posts ) 730 if ( !$max || $max >= (int) $forum_template->topic->topic_posts ) { 725 731 $this->total_post_count = (int) $forum_template->topic->topic_posts; 726 else732 } else { 727 733 $this->total_post_count = (int)$max; 734 } 728 735 729 736 if ( $max ) { 730 if ( $max >= count( $this->posts) )737 if ( $max >= count( $this->posts ) ) { 731 738 $this->post_count = count( $this->posts ); 732 else739 } else { 733 740 $this->post_count = (int)$max; 741 } 734 742 } else { 735 743 $this->post_count = count( $this->posts ); … … 737 745 } 738 746 739 $this->pag_links = paginate_links( array( 740 'base' => add_query_arg( array( 'topic_page' => '%#%', 'num' => $this->pag_num ) ), 741 'format' => '', 742 'total' => ceil($this->total_post_count / $this->pag_num), 743 'current' => $this->pag_page, 744 'prev_text' => '←', 745 'next_text' => '→', 746 'mid_size' => 1 747 )); 748 $this->pag->total_pages = ceil($this->total_post_count / $this->pag_num); 747 if ( (int)$this->total_post_count && (int)$this->pag_num ) { 748 $this->pag_links = paginate_links( array( 749 'base' => add_query_arg( array( 'topic_page' => '%#%', 'num' => (int)$this->pag_num ) ), 750 'format' => '', 751 'total' => ceil( (int)$this->total_post_count / (int)$this->pag_num ), 752 'current' => $this->pag_page, 753 'prev_text' => '←', 754 'next_text' => '→', 755 'mid_size' => 1 756 ) ); 757 758 $this->pag->total_pages = ceil( (int)$this->total_post_count / (int)$this->pag_num ); 759 } else { 760 $this->pag->total_pages = 1; 761 } 749 762 } 750 763 -
trunk/bp-groups/bp-groups-templatetags.php
r3232 r3247 24 24 25 25 $this->pag_page = isset( $_REQUEST['grpage'] ) ? intval( $_REQUEST['grpage'] ) : $page; 26 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;27 28 if ( 'invites' == $type ) 26 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page; 27 28 if ( 'invites' == $type ) { 29 29 $this->groups = groups_get_invites_for_user( $user_id, $this->pag_num, $this->pag_page ); 30 else if ( 'single-group' == $type ) {30 } else if ( 'single-group' == $type ) { 31 31 $group = new stdClass; 32 32 $group->group_id = BP_Groups_Group::get_id_from_slug($slug); 33 $this->groups = array( $group );34 } else 33 $this->groups = array( $group ); 34 } else { 35 35 $this->groups = groups_get_groups( array( 'type' => $type, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'user_id' => $user_id, 'search_terms' => $search_terms, 'include' => $include, 'populate_extras' => $populate_extras ) ); 36 } 36 37 37 38 if ( 'invites' == $type ) { 38 39 $this->total_group_count = (int)$this->groups['total']; 39 $this->group_count = (int)$this->groups['total']; 40 $this->group_count = (int)$this->groups['total']; 41 $this->groups = $this->groups['groups']; 42 } else if ( 'single-group' == $type ) { 43 $this->single_group = true; 44 $this->total_group_count = 1; 45 $this->group_count = 1; 46 } else { 47 if ( !$max || $max >= (int)$this->groups['total'] ) { 48 $this->total_group_count = (int)$this->groups['total']; 49 } else { 50 $this->total_group_count = (int)$max; 51 } 52 40 53 $this->groups = $this->groups['groups']; 41 } else if ( 'single-group' == $type ) {42 $this->single_group = true;43 $this->total_group_count = 1;44 $this->group_count = 1;45 } else {46 if ( !$max || $max >= (int)$this->groups['total'] )47 $this->total_group_count = (int)$this->groups['total'];48 else49 $this->total_group_count = (int)$max;50 51 $this->groups = $this->groups['groups'];52 54 53 55 if ( $max ) { 54 if ( $max >= count( $this->groups) )55 $this->group_count = count( $this->groups);56 else56 if ( $max >= count( $this->groups ) ) { 57 $this->group_count = count( $this->groups ); 58 } else { 57 59 $this->group_count = (int)$max; 60 } 58 61 } else { 59 $this->group_count = count( $this->groups);62 $this->group_count = count( $this->groups ); 60 63 } 61 64 } 62 65 63 $this->pag_links = paginate_links( array( 64 'base' => add_query_arg( array( 'grpage' => '%#%' ) ), 65 'format' => '', 66 'total' => ceil($this->total_group_count / $this->pag_num), 67 'current' => $this->pag_page, 68 'prev_text' => '←', 69 'next_text' => '→', 70 'mid_size' => 1 71 )); 66 // Build pagination links 67 if ( (int)$this->total_group_count && (int)$this->pag_num ) { 68 $this->pag_links = paginate_links( array( 69 'base' => add_query_arg( array( 'grpage' => '%#%' ) ), 70 'format' => '', 71 'total' => ceil( (int)$this->total_group_count / (int)$this->pag_num ), 72 'current' => $this->pag_page, 73 'prev_text' => '←', 74 'next_text' => '→', 75 'mid_size' => 1 76 ) ); 77 } 72 78 } 73 79 -
trunk/bp-messages/bp-messages-templatetags.php
r3232 r3247 22 22 function bp_messages_box_template( $user_id, $box, $per_page, $max, $type ) { 23 23 $this->pag_page = isset( $_GET['mpage'] ) ? intval( $_GET['mpage'] ) : 1; 24 $this->pag_num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : $per_page;25 26 $this->user_id = $user_id;27 $this->box = $box;28 $this->type = $type;24 $this->pag_num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : $per_page; 25 26 $this->user_id = $user_id; 27 $this->box = $box; 28 $this->type = $type; 29 29 30 30 if ( 'notices' == $this->box ) … … 33 33 $threads = BP_Messages_Thread::get_current_threads_for_user( $this->user_id, $this->box, $this->type, $this->pag_num, $this->pag_page ); 34 34 35 $this->threads = $threads['threads'];35 $this->threads = $threads['threads']; 36 36 $this->total_thread_count = $threads['total']; 37 37 } 38 38 39 39 if ( !$this->threads ) { 40 $this->thread_count = 0;40 $this->thread_count = 0; 41 41 $this->total_thread_count = 0; 42 42 } else { … … 44 44 45 45 if ( !$max || $max >= (int)$total_notice_count ) { 46 if ( 'notices' == $this->box ) 46 if ( 'notices' == $this->box ) { 47 47 $this->total_thread_count = (int)$total_notice_count; 48 } 48 49 } else { 49 50 $this->total_thread_count = (int)$max; … … 51 52 52 53 if ( $max ) { 53 if ( $max >= count( $this->threads) )54 $this->thread_count = count( $this->threads);55 else54 if ( $max >= count( $this->threads ) ) { 55 $this->thread_count = count( $this->threads ); 56 } else { 56 57 $this->thread_count = (int)$max; 58 } 57 59 } else { 58 $this->thread_count = count( $this->threads);60 $this->thread_count = count( $this->threads ); 59 61 } 60 62 } 61 63 62 $this->pag_links = paginate_links( array( 63 'base' => add_query_arg( 'mpage', '%#%' ), 64 'format' => '', 65 'total' => ceil($this->total_thread_count / $this->pag_num), 66 'current' => $this->pag_page, 67 'prev_text' => '←', 68 'next_text' => '→', 69 'mid_size' => 1 70 )); 64 if ( (int)$this->total_thread_count && (int)$this->pag_num ) { 65 $this->pag_links = paginate_links( array( 66 'base' => add_query_arg( 'mpage', '%#%' ), 67 'format' => '', 68 'total' => ceil( (int)$this->total_thread_count / (int)$this->pag_num ), 69 'current' => $this->pag_page, 70 'prev_text' => '←', 71 'next_text' => '→', 72 'mid_size' => 1 73 ) ); 74 } 71 75 } 72 76
Note: See TracChangeset
for help on using the changeset viewer.