Changeset 6300
- Timestamp:
- 02/21/2017 11:25:09 PM (8 years ago)
- Location:
- trunk/src/includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/replies/template.php
r6291 r6300 2457 2457 2458 2458 // Set pagination values 2459 $start_num = intval( ( $bbp->reply_query->paged - 1 ) * $bbp->reply_query->posts_per_page ) + 1; 2460 $from_num = bbp_number_format( $start_num ); 2461 $to_num = bbp_number_format( ( $start_num + ( $bbp->reply_query->posts_per_page - 1 ) > $bbp->reply_query->found_posts ) ? $bbp->reply_query->found_posts : $start_num + ( $bbp->reply_query->posts_per_page - 1 ) ); 2462 $total_int = (int) $bbp->reply_query->found_posts; 2463 $total = bbp_number_format( $total_int ); 2459 $total_int = intval( $bbp->reply_query->found_posts ); 2460 $ppp_int = intval( $bbp->reply_query->posts_per_page ); 2461 $start_int = intval( ( $bbp->reply_query->paged - 1 ) * $ppp_int ) + 1; 2462 $to_int = intval( ( $start_int + ( $ppp_int - 1 ) > $total_int ) 2463 ? $total_int 2464 : $start_int + ( $ppp_int - 1 ) ); 2465 2466 // Format numbers for display 2467 $total_num = bbp_number_format( $total_int ); 2468 $from_num = bbp_number_format( $start_int ); 2469 $to_num = bbp_number_format( $to_int ); 2464 2470 2465 2471 // We are threading replies … … 2474 2480 // Several replies in a topic with a single page 2475 2481 if ( empty( $to_num ) ) { 2476 $retstr = sprintf( _n( 'Viewing %1$s reply', 'Viewing %1$s replies', $total_int, 'bbpress' ), $total );2482 $retstr = sprintf( _n( 'Viewing %1$s reply', 'Viewing %1$s replies', $total_int, 'bbpress' ), $total_num ); 2477 2483 2478 2484 // Several replies in a topic with several pages 2479 2485 } else { 2480 $retstr = sprintf( _n( 'Viewing %2$s replies (of %4$s total)', 'Viewing %1$s replies - %2$s through %3$s (of %4$s total)', $bbp->reply_query->post_count, 'bbpress' ), $bbp->reply_query->post_count, $from_num, $to_num, $total );2486 $retstr = sprintf( _n( 'Viewing %2$s replies (of %4$s total)', 'Viewing %1$s replies - %2$s through %3$s (of %4$s total)', $bbp->reply_query->post_count, 'bbpress' ), $bbp->reply_query->post_count, $from_num, $to_num, $total_num ); 2481 2487 } 2482 2488 … … 2486 2492 // Several posts in a topic with a single page 2487 2493 if ( empty( $to_num ) ) { 2488 $retstr = sprintf( _n( 'Viewing %1$s post', 'Viewing %1$s posts', $total_int, 'bbpress' ), $total );2494 $retstr = sprintf( _n( 'Viewing %1$s post', 'Viewing %1$s posts', $total_int, 'bbpress' ), $total_num ); 2489 2495 2490 2496 // Several posts in a topic with several pages 2491 2497 } else { 2492 $retstr = sprintf( _n( 'Viewing %2$s post (of %4$s total)', 'Viewing %1$s posts - %2$s through %3$s (of %4$s total)', $bbp->reply_query->post_count, 'bbpress' ), $bbp->reply_query->post_count, $from_num, $to_num, $total );2498 $retstr = sprintf( _n( 'Viewing %2$s post (of %4$s total)', 'Viewing %1$s posts - %2$s through %3$s (of %4$s total)', $bbp->reply_query->post_count, 'bbpress' ), $bbp->reply_query->post_count, $from_num, $to_num, $total_num ); 2493 2499 } 2494 2500 } -
trunk/src/includes/search/template.php
r6228 r6300 402 402 403 403 // Set pagination values 404 $start_num = intval( ( $bbp->search_query->paged - 1 ) * $bbp->search_query->posts_per_page ) + 1; 405 $from_num = bbp_number_format( $start_num ); 406 $to_num = bbp_number_format( ( $start_num + ( $bbp->search_query->posts_per_page - 1 ) > $bbp->search_query->found_posts ) ? $bbp->search_query->found_posts : $start_num + ( $bbp->search_query->posts_per_page - 1 ) ); 407 $total_int = (int) $bbp->search_query->found_posts; 408 $total = bbp_number_format( $total_int ); 404 $total_int = intval( $bbp->search_query->found_posts ); 405 $ppp_int = intval( $bbp->search_query->posts_per_page ); 406 $start_int = intval( ( $bbp->search_query->paged - 1 ) * $ppp_int ) + 1; 407 $to_int = intval( ( $start_int + ( $ppp_int - 1 ) > $total_int ) 408 ? $total_int 409 : $start_int + ( $ppp_int - 1 ) ); 410 411 // Format numbers for display 412 $total_num = bbp_number_format( $total_int ); 413 $from_num = bbp_number_format( $start_int ); 414 $to_num = bbp_number_format( $to_int ); 409 415 410 416 // Single page of results 411 417 if ( empty( $to_num ) ) { 412 $retstr = sprintf( _n( 'Viewing %1$s result', 'Viewing %1$s results', $total_int, 'bbpress' ), $total );418 $retstr = sprintf( _n( 'Viewing %1$s result', 'Viewing %1$s results', $total_int, 'bbpress' ), $total_num ); 413 419 414 420 // Several pages of results 415 421 } else { 416 $retstr = sprintf( _n( 'Viewing %2$s results (of %4$s total)', 'Viewing %1$s results - %2$s through %3$s (of %4$s total)', $bbp->search_query->post_count, 'bbpress' ), $bbp->search_query->post_count, $from_num, $to_num, $total ); 417 422 $retstr = sprintf( _n( 'Viewing %2$s results (of %4$s total)', 'Viewing %1$s results - %2$s through %3$s (of %4$s total)', $bbp->search_query->post_count, 'bbpress' ), $bbp->search_query->post_count, $from_num, $to_num, $total_num ); 418 423 } 419 424
Note: See TracChangeset
for help on using the changeset viewer.