Make WordPress Core

Ticket #52322: 52322.3.diff

File 52322.3.diff, 2.6 KB (added by h4l9k, 3 years ago)
  • src/wp-includes/comment-template.php

    diff --git a/src/wp-includes/comment-template.php b/src/wp-includes/comment-template.php
    index 63614663de..239a75936a 100644
    a b function comment_text( $comment_ID = 0, $args = array() ) { 
    10301030 * Retrieves the comment time of the current comment.
    10311031 *
    10321032 * @since 1.5.0
     1033 * @since 6.2.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
    10331034 *
    10341035 * @param string $format    Optional. PHP time format. Defaults to the 'time_format' option.
    10351036 * @param bool   $gmt       Optional. Whether to use the GMT date. Default false.
    10361037 * @param bool   $translate Optional. Whether to translate the time (for use in feeds).
    10371038 *                          Default true.
     1039 * @param int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to get the date.
    10381040 * @return string The formatted time.
    10391041 */
    1040 function get_comment_time( $format = '', $gmt = false, $translate = true ) {
    1041         $comment = get_comment();
     1042function get_comment_time( $format = '', $gmt = false, $translate = true, $comment_ID = 0 ) {
     1043        $comment = get_comment( $comment_ID );
    10421044
    10431045        $comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date;
    10441046
    function get_comment_time( $format = '', $gmt = false, $translate = true ) { 
    10501052         * Filters the returned comment time.
    10511053         *
    10521054         * @since 1.5.0
     1055         * @since 6.2.0 Added `$comment_ID` so that developer can get a direct comment id
    10531056         *
    10541057         * @param string|int $date      The comment time, formatted as a date string or Unix timestamp.
    10551058         * @param string     $format    PHP date format.
    10561059         * @param bool       $gmt       Whether the GMT date is in use.
    10571060         * @param bool       $translate Whether the time is translated.
    10581061         * @param WP_Comment $comment   The comment object.
     1062         * @param string     $comment_ID   The comment ID as a numeric string.
    10591063         */
    1060         return apply_filters( 'get_comment_time', $date, $format, $gmt, $translate, $comment );
     1064        return apply_filters( 'get_comment_time', $date, $format, $gmt, $translate, $comment, $comment_ID );
    10611065}
    10621066
    10631067/**
    10641068 * Displays the comment time of the current comment.
    10651069 *
    10661070 * @since 0.71
     1071 * @since 6.2.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
    10671072 *
    10681073 * @param string $format Optional. PHP time format. Defaults to the 'time_format' option.
     1074 * @param int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to get the date.
    10691075 */
    1070 function comment_time( $format = '' ) {
    1071         echo get_comment_time( $format );
     1076function comment_time( $format = '', $comment_ID = 0 ) {
     1077        echo get_comment_time( $format, false, true, $comment_ID );
    10721078}
    10731079
    10741080/**