Changeset 5729 for trunk/bp-forums/bp-forums-template.php
- Timestamp:
- 02/11/2012 09:32:04 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.