Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/16/2025 10:43:01 PM (6 months ago)
Author:
johnjamesjacoby
Message:

Tools - Code Improvement: Updates to the phpcs.xml.dist config file.

This commit implements the WordPress.WP.I18n.MissingTranslatorsComment code sniff, fixes a bunch of whitespace regressions from #3614 and #3613.

Props johnjamesjacoby, sirlouen.

In trunk, for 2.7.

Fixes #3615.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/search/template.php

    r7357 r7360  
    174174        // Include search terms in title
    175175        } else {
     176            /* translators: %s: Search query terms */
    176177            $title = sprintf( esc_html__( "Search Results for '%s'", 'bbpress' ), esc_attr( $search_terms ) );
    177178        }
     
    381382}
    382383
    383     /**
    384      * Return the search results pagination count
    385      *
    386      * @since 2.3.0 bbPress (r4579)
    387      *
    388      * @return string Search pagination count
    389      */
    390     function bbp_get_search_pagination_count() {
    391         $bbp = bbpress();
    392 
    393         // Define local variable(s)
    394         $retstr = '';
    395 
    396         // Set pagination values
    397         $total_int = intval( $bbp->search_query->found_posts    );
    398         $ppp_int   = intval( $bbp->search_query->posts_per_page );
    399         $start_int = intval( ( $bbp->search_query->paged - 1 ) * $ppp_int ) + 1;
    400         $to_int    = intval( ( $start_int + ( $ppp_int - 1 ) > $total_int )
    401                 ? $total_int
    402                 : $start_int + ( $ppp_int - 1 ) );
    403 
    404         // Format numbers for display
    405         $total_num = bbp_number_format( $total_int );
    406         $from_num  = bbp_number_format( $start_int );
    407         $to_num    = bbp_number_format( $to_int    );
    408 
    409         // Single page of results
    410         if ( empty( $to_num ) ) {
    411             $retstr = sprintf( _n( 'Viewing %1$s result', 'Viewing %1$s results', $total_int, 'bbpress' ), $total_num );
    412 
    413         // Several pages of results
    414         } else {
    415             $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 );  //phpcs:ignore
    416         }
     384/**
     385 * Return the search results pagination count
     386 *
     387 * @since 2.3.0 bbPress (r4579)
     388 *
     389 * @return string Search pagination count
     390 */
     391function bbp_get_search_pagination_count() {
     392    $bbp = bbpress();
     393
     394    // Define local variable(s)
     395    $retstr = '';
     396
     397    // Set pagination values
     398    $total_int = intval( $bbp->search_query->found_posts    );
     399    $ppp_int   = intval( $bbp->search_query->posts_per_page );
     400    $start_int = intval( ( $bbp->search_query->paged - 1 ) * $ppp_int ) + 1;
     401    $to_int    = intval( ( $start_int + ( $ppp_int - 1 ) > $total_int )
     402            ? $total_int
     403            : $start_int + ( $ppp_int - 1 ) );
     404
     405    // Format numbers for display
     406    $total_num = bbp_number_format( $total_int );
     407    $from_num  = bbp_number_format( $start_int );
     408    $to_num    = bbp_number_format( $to_int    );
     409
     410    // Single page of results
     411    if ( empty( $to_num ) ) {
     412        $retstr = sprintf(
     413            /* translators: %1$s: Number of results */
     414            _n( 'Viewing %1$s result', 'Viewing %1$s results', $total_int, 'bbpress' ),
     415            $total_num
     416        );
     417
     418    // Several pages of results
     419    } else {
     420        $retstr = sprintf(
     421            /* translators: 1: Number of results being viewed, 2: First result number, 3: Last result number, 4: Total results */
     422            _n(
     423                'Viewing %1$s result - %2$s through %3$s (of %4$s total)',
     424                'Viewing %1$s results - %2$s through %3$s (of %4$s total)',
     425                $bbp->search_query->post_count,
     426                'bbpress'
     427            ),
     428            $bbp->search_query->post_count,
     429            $from_num,
     430            $to_num,
     431            $total_num
     432        );
    417433
    418434        // Filter & return
    419435        return apply_filters( 'bbp_get_search_pagination_count', esc_html( $retstr ) );
    420436    }
     437}
    421438
    422439/**
Note: See TracChangeset for help on using the changeset viewer.