Changeset 6682
- Timestamp:
- 09/09/2017 04:49:42 AM (4 years ago)
- Location:
- trunk/src/includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/replies/template.php
r6680 r6682 2238 2238 * Output the topic pagination count 2239 2239 * 2240 * The results are unescaped by design, to allow them to be filtered freely via 2241 * the 'bbp_get_topic_pagination_count' filter. 2242 * 2240 2243 * @since 2.0.0 bbPress (r2519) 2241 2244 * 2242 2245 */ 2243 2246 function bbp_topic_pagination_count() { 2244 echo esc_html( bbp_get_topic_pagination_count());2247 echo bbp_get_topic_pagination_count(); 2245 2248 } 2246 2249 /** … … 2258 2261 2259 2262 // Set pagination values 2263 $count_int = intval( $bbp->reply_query->post_count ); 2260 2264 $total_int = intval( $bbp->reply_query->found_posts ); 2261 2265 $ppp_int = intval( $bbp->reply_query->posts_per_page ); 2262 2266 $start_int = intval( ( $bbp->reply_query->paged - 1 ) * $ppp_int ) + 1; 2263 2267 $to_int = intval( ( $start_int + ( $ppp_int - 1 ) > $total_int ) 2264 2265 2268 ? $total_int 2269 : $start_int + ( $ppp_int - 1 ) ); 2266 2270 2267 2271 // Format numbers for display 2272 $count_num = bbp_number_format( $count_int ); 2268 2273 $total_num = bbp_number_format( $total_int ); 2269 2274 $from_num = bbp_number_format( $start_int ); … … 2285 2290 // Several replies in a topic with several pages 2286 2291 } else { 2287 $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 );2292 $retstr = sprintf( _n( 'Viewing %2$s replies (of %4$s total)', 'Viewing %1$s replies - %2$s through %3$s (of %4$s total)', $count_int, 'bbpress' ), $count_num, $from_num, $to_num, $total_num ); 2288 2293 } 2289 2294 … … 2297 2302 // Several posts in a topic with several pages 2298 2303 } else { 2299 $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 );2304 $retstr = sprintf( _n( 'Viewing %2$s post (of %4$s total)', 'Viewing %1$s posts - %2$s through %3$s (of %4$s total)', $count_int, 'bbpress' ), $count_num, $from_num, $to_num, $total_num ); 2300 2305 } 2301 2306 } 2307 2308 // Escape results of _n() 2309 $retstr = esc_html( $retstr ); 2302 2310 2303 2311 // Filter & return -
trunk/src/includes/topics/template.php
r6680 r6682 2917 2917 * Output the pagination count 2918 2918 * 2919 * The results are unescaped by design, to allow them to be filtered freely via 2920 * the 'bbp_get_forum_pagination_count' filter. 2921 * 2919 2922 * @since 2.0.0 bbPress (r2519) 2920 2923 */ 2921 2924 function bbp_forum_pagination_count() { 2922 echo esc_html( bbp_get_forum_pagination_count());2925 echo bbp_get_forum_pagination_count(); 2923 2926 } 2924 2927 /** … … 2932 2935 $bbp = bbpress(); 2933 2936 2934 if ( empty( $bbp->topic_query ) ) { 2935 return false; 2936 } 2937 2938 // Set pagination values 2939 $start_num = intval( ( $bbp->topic_query->paged - 1 ) * $bbp->topic_query->posts_per_page ) + 1; 2940 $from_num = bbp_number_format( $start_num ); 2941 $to_num = bbp_number_format( ( $start_num + ( $bbp->topic_query->posts_per_page - 1 ) > $bbp->topic_query->found_posts ) ? $bbp->topic_query->found_posts : $start_num + ( $bbp->topic_query->posts_per_page - 1 ) ); 2942 $total_int = (int) ! empty( $bbp->topic_query->found_posts ) ? $bbp->topic_query->found_posts : $bbp->topic_query->post_count; 2943 $total = bbp_number_format( $total_int ); 2944 2945 // Several topics in a forum with a single page 2946 if ( empty( $to_num ) ) { 2947 $retstr = sprintf( _n( 'Viewing %1$s topic', 'Viewing %1$s topics', $total_int, 'bbpress' ), $total ); 2948 2949 // Several topics in a forum with several pages 2950 } else { 2951 $retstr = sprintf( _n( 'Viewing topic %2$s (of %4$s total)', 'Viewing %1$s topics - %2$s through %3$s (of %4$s total)', $total_int, 'bbpress' ), $bbp->topic_query->post_count, $from_num, $to_num, $total ); 2937 // Define local variable(s) 2938 $retstr = ''; 2939 2940 // Topic query exists 2941 if ( ! empty( $bbp->topic_query ) ) { 2942 2943 // Set pagination values 2944 $count_int = intval( $bbp->topic_query->post_count ); 2945 $start_num = intval( ( $bbp->topic_query->paged - 1 ) * $bbp->topic_query->posts_per_page ) + 1; 2946 $total_int = ! empty( $bbp->topic_query->found_posts ) 2947 ? (int) $bbp->topic_query->found_posts 2948 : $count_int; 2949 2950 // Format numbers for display 2951 $count_num = bbp_number_format( $count_int ); 2952 $from_num = bbp_number_format( $start_num ); 2953 $total = bbp_number_format( $total_int ); 2954 $to_num = bbp_number_format( ( $start_num + ( $bbp->topic_query->posts_per_page - 1 ) > $bbp->topic_query->found_posts ) 2955 ? $bbp->topic_query->found_posts 2956 : $start_num + ( $bbp->topic_query->posts_per_page - 1 ) ); 2957 2958 // Several topics in a forum with a single page 2959 if ( empty( $to_num ) ) { 2960 $retstr = sprintf( _n( 'Viewing %1$s topic', 'Viewing %1$s topics', $total_int, 'bbpress' ), $total ); 2961 2962 // Several topics in a forum with several pages 2963 } else { 2964 $retstr = sprintf( _n( 'Viewing topic %2$s (of %4$s total)', 'Viewing %1$s topics - %2$s through %3$s (of %4$s total)', $total_int, 'bbpress' ), $count_num, $from_num, $to_num, $total ); 2965 } 2966 2967 // Escape results of _n() 2968 $retstr = esc_html( $retstr ); 2952 2969 } 2953 2970
Note: See TracChangeset
for help on using the changeset viewer.