Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/24/2010 03:34:25 PM (16 years ago)
Author:
apeatling
Message:

Return and echo functions for pagination counts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-forums/bp-forums-templatetags.php

    r2946 r2950  
    662662
    663663function bp_forum_pagination_count() {
    664     global $bp, $forum_template;
    665 
    666     $from_num = bp_core_number_format( intval( ( $forum_template->pag_page - 1 ) * $forum_template->pag_num ) + 1 );
    667     $to_num = bp_core_number_format( ( $from_num + ( $forum_template->pag_num - 1  ) > $forum_template->total_topic_count ) ? $forum_template->total_topic_count : $from_num + ( $forum_template->pag_num - 1 ) );
    668     $total = bp_core_number_format( $forum_template->total_topic_count );
    669 
    670     $pag_filter = false;
    671     if ( 'tags' == $forum_template->type && !empty( $forum_template->search_terms ) )
    672         $pag_filter = sprintf( __( ' matching tag "%s"', 'buddypress' ), $forum_template->search_terms );
    673 
    674     echo apply_filters( 'bp_forum_pagination_count', sprintf( __( 'Viewing topic %s to %s (%s total topics%s)', 'buddypress' ), $from_num, $to_num, $total, $pag_filter ) );
    675 ?>
    676 <span class="ajax-loader"></span>
    677 <?php
    678 }
     664    echo bp_get_forum_pagination_count();
     665}
     666    function bp_get_forum_pagination_count() {
     667        global $bp, $forum_template;
     668
     669        $from_num = bp_core_number_format( intval( ( $forum_template->pag_page - 1 ) * $forum_template->pag_num ) + 1 );
     670        $to_num = bp_core_number_format( ( $from_num + ( $forum_template->pag_num - 1  ) > $forum_template->total_topic_count ) ? $forum_template->total_topic_count : $from_num + ( $forum_template->pag_num - 1 ) );
     671        $total = bp_core_number_format( $forum_template->total_topic_count );
     672
     673        $pag_filter = false;
     674        if ( 'tags' == $forum_template->type && !empty( $forum_template->search_terms ) )
     675            $pag_filter = sprintf( __( ' matching tag "%s"', 'buddypress' ), $forum_template->search_terms );
     676
     677        return apply_filters( 'bp_get_forum_pagination_count', sprintf( __( 'Viewing topic %s to %s (of %s total topics%s)', 'buddypress' ), $from_num, $to_num, $total, $pag_filter ) );
     678    }
    679679
    680680function bp_is_edit_topic() {
Note: See TracChangeset for help on using the changeset viewer.