Skip to content

Commit

Permalink
Coding Standards: Rename $d parameter in various date/time function…
Browse files Browse the repository at this point in the history
…s to `$format` for clarity.

See #49222.

git-svn-id: https://develop.svn.wordpress.org/trunk@47287 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Feb 14, 2020
1 parent a41b2d9 commit 5439442
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 111 deletions.
6 changes: 3 additions & 3 deletions src/wp-admin/includes/image.php
Expand Up @@ -638,9 +638,9 @@ function wp_exif_frac2dec( $str ) {
return $str;
}

list( $n, $d ) = explode( '/', $str );
if ( ! empty( $d ) ) {
return $n / $d;
list( $numerator, $denominator ) = explode( '/', $str );
if ( ! empty( $denominator ) ) {
return $numerator / $denominator;
}
return $str;
}
Expand Down
36 changes: 18 additions & 18 deletions src/wp-includes/comment-template.php
Expand Up @@ -543,28 +543,28 @@ function get_comment_class( $class = '', $comment_id = null, $post_id = null ) {
* @since 1.5.0
* @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
*
* @param string $d Optional. The format of the date. Default user's setting.
* @param string $format Optional. The format of the date. Default user's setting.
* @param int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to get the date.
* Default current comment.
* @return string The comment's date.
*/
function get_comment_date( $d = '', $comment_ID = 0 ) {
function get_comment_date( $format = '', $comment_ID = 0 ) {
$comment = get_comment( $comment_ID );
if ( '' == $d ) {
if ( '' == $format ) {
$date = mysql2date( get_option( 'date_format' ), $comment->comment_date );
} else {
$date = mysql2date( $d, $comment->comment_date );
$date = mysql2date( $format, $comment->comment_date );
}
/**
* Filters the returned comment date.
*
* @since 1.5.0
*
* @param string|int $date Formatted date string or Unix timestamp.
* @param string $d The format of the date.
* @param string $format The format of the date.
* @param WP_Comment $comment The comment object.
*/
return apply_filters( 'get_comment_date', $date, $d, $comment );
return apply_filters( 'get_comment_date', $date, $format, $comment );
}

/**
Expand All @@ -573,12 +573,12 @@ function get_comment_date( $d = '', $comment_ID = 0 ) {
* @since 0.71
* @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
*
* @param string $d Optional. The format of the date. Default user's settings.
* @param string $format Optional. The format of the date. Default user's settings.
* @param int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to print the date.
* Default current comment.
*/
function comment_date( $d = '', $comment_ID = 0 ) {
echo get_comment_date( $d, $comment_ID );
function comment_date( $format = '', $comment_ID = 0 ) {
echo get_comment_date( $format, $comment_ID );
}

/**
Expand Down Expand Up @@ -1031,20 +1031,20 @@ function comment_text( $comment_ID = 0, $args = array() ) {
*
* @since 1.5.0
*
* @param string $d Optional. The format of the time. Default user's settings.
* @param string $format Optional. The format of the time. Default user's settings.
* @param bool $gmt Optional. Whether to use the GMT date. Default false.
* @param bool $translate Optional. Whether to translate the time (for use in feeds).
* Default true.
* @return string The formatted time.
*/
function get_comment_time( $d = '', $gmt = false, $translate = true ) {
function get_comment_time( $format = '', $gmt = false, $translate = true ) {
$comment = get_comment();

$comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date;
if ( '' == $d ) {
if ( '' == $format ) {
$date = mysql2date( get_option( 'time_format' ), $comment_date, $translate );
} else {
$date = mysql2date( $d, $comment_date, $translate );
$date = mysql2date( $format, $comment_date, $translate );
}

/**
Expand All @@ -1053,23 +1053,23 @@ function get_comment_time( $d = '', $gmt = false, $translate = true ) {
* @since 1.5.0
*
* @param string|int $date The comment time, formatted as a date string or Unix timestamp.
* @param string $d Date format.
* @param string $format Date format.
* @param bool $gmt Whether the GMT date is in use.
* @param bool $translate Whether the time is translated.
* @param WP_Comment $comment The comment object.
*/
return apply_filters( 'get_comment_time', $date, $d, $gmt, $translate, $comment );
return apply_filters( 'get_comment_time', $date, $format, $gmt, $translate, $comment );
}

/**
* Displays the comment time of the current comment.
*
* @since 0.71
*
* @param string $d Optional. The format of the time. Default user's settings.
* @param string $format Optional. The format of the time. Default user's settings.
*/
function comment_time( $d = '' ) {
echo get_comment_time( $d );
function comment_time( $format = '' ) {
echo get_comment_time( $format );
}

/**
Expand Down

0 comments on commit 5439442

Please sign in to comment.