WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/14/2020 12:05:43 AM (19 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Rename $d parameter in various date/time functions to $format for clarity.

See #49222.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment-template.php

    r47276 r47287  
    544544 * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
    545545 *
    546  * @param string          $d          Optional. The format of the date. Default user's setting.
     546 * @param string          $format     Optional. The format of the date. Default user's setting.
    547547 * @param int|WP_Comment  $comment_ID WP_Comment or ID of the comment for which to get the date.
    548548 *                                    Default current comment.
    549549 * @return string The comment's date.
    550550 */
    551 function get_comment_date( $d = '', $comment_ID = 0 ) {
     551function get_comment_date( $format = '', $comment_ID = 0 ) {
    552552    $comment = get_comment( $comment_ID );
    553     if ( '' == $d ) {
     553    if ( '' == $format ) {
    554554        $date = mysql2date( get_option( 'date_format' ), $comment->comment_date );
    555555    } else {
    556         $date = mysql2date( $d, $comment->comment_date );
     556        $date = mysql2date( $format, $comment->comment_date );
    557557    }
    558558    /**
     
    562562     *
    563563     * @param string|int $date    Formatted date string or Unix timestamp.
    564      * @param string     $d       The format of the date.
     564     * @param string     $format  The format of the date.
    565565     * @param WP_Comment $comment The comment object.
    566566     */
    567     return apply_filters( 'get_comment_date', $date, $d, $comment );
     567    return apply_filters( 'get_comment_date', $date, $format, $comment );
    568568}
    569569
     
    574574 * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
    575575 *
    576  * @param string         $d          Optional. The format of the date. Default user's settings.
     576 * @param string         $format     Optional. The format of the date. Default user's settings.
    577577 * @param int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to print the date.
    578578 *                                   Default current comment.
    579579 */
    580 function comment_date( $d = '', $comment_ID = 0 ) {
    581     echo get_comment_date( $d, $comment_ID );
     580function comment_date( $format = '', $comment_ID = 0 ) {
     581    echo get_comment_date( $format, $comment_ID );
    582582}
    583583
     
    10321032 * @since 1.5.0
    10331033 *
    1034  * @param string $d         Optional. The format of the time. Default user's settings.
     1034 * @param string $format    Optional. The format of the time. Default user's settings.
    10351035 * @param bool   $gmt       Optional. Whether to use the GMT date. Default false.
    10361036 * @param bool   $translate Optional. Whether to translate the time (for use in feeds).
     
    10381038 * @return string The formatted time.
    10391039 */
    1040 function get_comment_time( $d = '', $gmt = false, $translate = true ) {
     1040function get_comment_time( $format = '', $gmt = false, $translate = true ) {
    10411041    $comment = get_comment();
    10421042
    10431043    $comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date;
    1044     if ( '' == $d ) {
     1044    if ( '' == $format ) {
    10451045        $date = mysql2date( get_option( 'time_format' ), $comment_date, $translate );
    10461046    } else {
    1047         $date = mysql2date( $d, $comment_date, $translate );
     1047        $date = mysql2date( $format, $comment_date, $translate );
    10481048    }
    10491049
     
    10541054     *
    10551055     * @param string|int $date      The comment time, formatted as a date string or Unix timestamp.
    1056      * @param string     $d         Date format.
     1056     * @param string     $format    Date format.
    10571057     * @param bool       $gmt       Whether the GMT date is in use.
    10581058     * @param bool       $translate Whether the time is translated.
    10591059     * @param WP_Comment $comment   The comment object.
    10601060     */
    1061     return apply_filters( 'get_comment_time', $date, $d, $gmt, $translate, $comment );
     1061    return apply_filters( 'get_comment_time', $date, $format, $gmt, $translate, $comment );
    10621062}
    10631063
     
    10671067 * @since 0.71
    10681068 *
    1069  * @param string $d Optional. The format of the time. Default user's settings.
    1070  */
    1071 function comment_time( $d = '' ) {
    1072     echo get_comment_time( $d );
     1069 * @param string $format Optional. The format of the time. Default user's settings.
     1070 */
     1071function comment_time( $format = '' ) {
     1072    echo get_comment_time( $format );
    10731073}
    10741074
Note: See TracChangeset for help on using the changeset viewer.