mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Coding Standards: Rename $d
parameter in various date/time functions to $format
for clarity.
See #49222. Built from https://develop.svn.wordpress.org/trunk@47287 git-svn-id: http://core.svn.wordpress.org/trunk@47087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f7338b347d
commit
6b2c63031c
@ -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;
|
||||
}
|
||||
|
@ -543,17 +543,17 @@ 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.
|
||||
@ -561,10 +561,10 @@ function get_comment_date( $d = '', $comment_ID = 0 ) {
|
||||
* @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 );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -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 );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -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 );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1053,12 +1053,12 @@ 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 );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1066,10 +1066,10 @@ function get_comment_time( $d = '', $gmt = false, $translate = true ) {
|
||||
*
|
||||
* @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 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2344,19 +2344,19 @@ function the_date_xml() {
|
||||
* @global string $currentday The day of the current post in the loop.
|
||||
* @global string $previousday The day of the previous post in the loop.
|
||||
*
|
||||
* @param string $d Optional. PHP date format defaults to the date_format option if not specified.
|
||||
* @param string $format Optional. PHP date format defaults to the date_format option if not specified.
|
||||
* @param string $before Optional. Output before the date.
|
||||
* @param string $after Optional. Output after the date.
|
||||
* @param bool $echo Optional, default is display. Whether to echo the date or return it.
|
||||
* @return string|void String if retrieving.
|
||||
*/
|
||||
function the_date( $d = '', $before = '', $after = '', $echo = true ) {
|
||||
function the_date( $format = '', $before = '', $after = '', $echo = true ) {
|
||||
global $currentday, $previousday;
|
||||
|
||||
$the_date = '';
|
||||
|
||||
if ( is_new_day() ) {
|
||||
$the_date = $before . get_the_date( $d ) . $after;
|
||||
$the_date = $before . get_the_date( $format ) . $after;
|
||||
$previousday = $currentday;
|
||||
}
|
||||
|
||||
@ -2366,12 +2366,12 @@ function the_date( $d = '', $before = '', $after = '', $echo = true ) {
|
||||
* @since 0.71
|
||||
*
|
||||
* @param string $the_date The formatted date string.
|
||||
* @param string $d PHP date format. Defaults to 'date_format' option
|
||||
* @param string $format PHP date format. Defaults to 'date_format' option
|
||||
* if not specified.
|
||||
* @param string $before HTML output before the date.
|
||||
* @param string $after HTML output after the date.
|
||||
*/
|
||||
$the_date = apply_filters( 'the_date', $the_date, $d, $before, $after );
|
||||
$the_date = apply_filters( 'the_date', $the_date, $format, $before, $after );
|
||||
|
||||
if ( $echo ) {
|
||||
echo $the_date;
|
||||
@ -2388,21 +2388,21 @@ function the_date( $d = '', $before = '', $after = '', $echo = true ) {
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param string $d Optional. PHP date format defaults to the date_format option if not specified.
|
||||
* @param string $format Optional. PHP date format defaults to the date_format option if not specified.
|
||||
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post.
|
||||
* @return string|false Date the current post was written. False on failure.
|
||||
*/
|
||||
function get_the_date( $d = '', $post = null ) {
|
||||
function get_the_date( $format = '', $post = null ) {
|
||||
$post = get_post( $post );
|
||||
|
||||
if ( ! $post ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( '' == $d ) {
|
||||
if ( '' == $format ) {
|
||||
$the_date = get_post_time( get_option( 'date_format' ), false, $post, true );
|
||||
} else {
|
||||
$the_date = get_post_time( $d, false, $post, true );
|
||||
$the_date = get_post_time( $format, false, $post, true );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2411,11 +2411,11 @@ function get_the_date( $d = '', $post = null ) {
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param string $the_date The formatted date.
|
||||
* @param string $d PHP date format. Defaults to 'date_format' option
|
||||
* @param string $format PHP date format. Defaults to 'date_format' option
|
||||
* if not specified.
|
||||
* @param int|WP_Post $post The post object or ID.
|
||||
*/
|
||||
return apply_filters( 'get_the_date', $the_date, $d, $post );
|
||||
return apply_filters( 'get_the_date', $the_date, $format, $post );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2423,14 +2423,14 @@ function get_the_date( $d = '', $post = null ) {
|
||||
*
|
||||
* @since 2.1.0
|
||||
*
|
||||
* @param string $d Optional. PHP date format defaults to the date_format option if not specified.
|
||||
* @param string $format Optional. PHP date format defaults to the date_format option if not specified.
|
||||
* @param string $before Optional. Output before the date.
|
||||
* @param string $after Optional. Output after the date.
|
||||
* @param bool $echo Optional, default is display. Whether to echo the date or return it.
|
||||
* @return string|void String if retrieving.
|
||||
*/
|
||||
function the_modified_date( $d = '', $before = '', $after = '', $echo = true ) {
|
||||
$the_modified_date = $before . get_the_modified_date( $d ) . $after;
|
||||
function the_modified_date( $format = '', $before = '', $after = '', $echo = true ) {
|
||||
$the_modified_date = $before . get_the_modified_date( $format ) . $after;
|
||||
|
||||
/**
|
||||
* Filters the date a post was last modified for display.
|
||||
@ -2438,12 +2438,12 @@ function the_modified_date( $d = '', $before = '', $after = '', $echo = true ) {
|
||||
* @since 2.1.0
|
||||
*
|
||||
* @param string $the_modified_date The last modified date.
|
||||
* @param string $d PHP date format. Defaults to 'date_format' option
|
||||
* @param string $format PHP date format. Defaults to 'date_format' option
|
||||
* if not specified.
|
||||
* @param string $before HTML output before the date.
|
||||
* @param string $after HTML output after the date.
|
||||
*/
|
||||
$the_modified_date = apply_filters( 'the_modified_date', $the_modified_date, $d, $before, $after );
|
||||
$the_modified_date = apply_filters( 'the_modified_date', $the_modified_date, $format, $before, $after );
|
||||
|
||||
if ( $echo ) {
|
||||
echo $the_modified_date;
|
||||
@ -2459,20 +2459,20 @@ function the_modified_date( $d = '', $before = '', $after = '', $echo = true ) {
|
||||
* @since 2.1.0
|
||||
* @since 4.6.0 Added the `$post` parameter.
|
||||
*
|
||||
* @param string $d Optional. PHP date format defaults to the date_format option if not specified.
|
||||
* @param string $format Optional. PHP date format defaults to the date_format option if not specified.
|
||||
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post.
|
||||
* @return string|false Date the current post was modified. False on failure.
|
||||
*/
|
||||
function get_the_modified_date( $d = '', $post = null ) {
|
||||
function get_the_modified_date( $format = '', $post = null ) {
|
||||
$post = get_post( $post );
|
||||
|
||||
if ( ! $post ) {
|
||||
// For backward compatibility, failures go through the filter below.
|
||||
$the_time = false;
|
||||
} elseif ( empty( $d ) ) {
|
||||
} elseif ( empty( $format ) ) {
|
||||
$the_time = get_post_modified_time( get_option( 'date_format' ), false, $post, true );
|
||||
} else {
|
||||
$the_time = get_post_modified_time( $d, false, $post, true );
|
||||
$the_time = get_post_modified_time( $format, false, $post, true );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2482,11 +2482,11 @@ function get_the_modified_date( $d = '', $post = null ) {
|
||||
* @since 4.6.0 Added the `$post` parameter.
|
||||
*
|
||||
* @param string|bool $the_time The formatted date or false if no post is found.
|
||||
* @param string $d PHP date format. Defaults to value specified in
|
||||
* @param string $format PHP date format. Defaults to value specified in
|
||||
* 'date_format' option.
|
||||
* @param WP_Post|null $post WP_Post object or null if no post is found.
|
||||
*/
|
||||
return apply_filters( 'get_the_modified_date', $the_time, $d, $post );
|
||||
return apply_filters( 'get_the_modified_date', $the_time, $format, $post );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2494,19 +2494,19 @@ function get_the_modified_date( $d = '', $post = null ) {
|
||||
*
|
||||
* @since 0.71
|
||||
*
|
||||
* @param string $d Either 'G', 'U', or php date format.
|
||||
* @param string $format Either 'G', 'U', or PHP date format.
|
||||
*/
|
||||
function the_time( $d = '' ) {
|
||||
function the_time( $format = '' ) {
|
||||
/**
|
||||
* Filters the time a post was written for display.
|
||||
*
|
||||
* @since 0.71
|
||||
*
|
||||
* @param string $get_the_time The formatted time.
|
||||
* @param string $d The time format. Accepts 'G', 'U',
|
||||
* or php date format.
|
||||
* @param string $format The time format. Accepts 'G', 'U',
|
||||
* or PHP date format.
|
||||
*/
|
||||
echo apply_filters( 'the_time', get_the_time( $d ), $d );
|
||||
echo apply_filters( 'the_time', get_the_time( $format ), $format );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2514,23 +2514,24 @@ function the_time( $d = '' ) {
|
||||
*
|
||||
* @since 1.5.0
|
||||
*
|
||||
* @param string $d Optional. Format to use for retrieving the time the post
|
||||
* was written. Either 'G', 'U', or php date format defaults
|
||||
* @param string $format Optional. Format to use for retrieving the time the post
|
||||
* was written. Either 'G', 'U', or PHP date format defaults
|
||||
* to the value specified in the time_format option. Default empty.
|
||||
* @param int|WP_Post $post WP_Post object or ID. Default is global `$post` object.
|
||||
* @return string|int|false Formatted date string or Unix timestamp if `$d` is 'U' or 'G'. False on failure.
|
||||
* @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
|
||||
* False on failure.
|
||||
*/
|
||||
function get_the_time( $d = '', $post = null ) {
|
||||
function get_the_time( $format = '', $post = null ) {
|
||||
$post = get_post( $post );
|
||||
|
||||
if ( ! $post ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( '' == $d ) {
|
||||
if ( '' == $format ) {
|
||||
$the_time = get_post_time( get_option( 'time_format' ), false, $post, true );
|
||||
} else {
|
||||
$the_time = get_post_time( $d, false, $post, true );
|
||||
$the_time = get_post_time( $format, false, $post, true );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2539,12 +2540,12 @@ function get_the_time( $d = '', $post = null ) {
|
||||
* @since 1.5.0
|
||||
*
|
||||
* @param string $the_time The formatted time.
|
||||
* @param string $d Format to use for retrieving the time the post was written.
|
||||
* Accepts 'G', 'U', or php date format value specified
|
||||
* @param string $format Format to use for retrieving the time the post was written.
|
||||
* Accepts 'G', 'U', or PHP date format value specified
|
||||
* in 'time_format' option. Default empty.
|
||||
* @param int|WP_Post $post WP_Post object or ID.
|
||||
*/
|
||||
return apply_filters( 'get_the_time', $the_time, $d, $post );
|
||||
return apply_filters( 'get_the_time', $the_time, $format, $post );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2552,14 +2553,15 @@ function get_the_time( $d = '', $post = null ) {
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param string $d Optional. Format to use for retrieving the time the post
|
||||
* was written. Either 'G', 'U', or php date format. Default 'U'.
|
||||
* @param string $format Optional. Format to use for retrieving the time the post
|
||||
* was written. Either 'G', 'U', or PHP date format. Default 'U'.
|
||||
* @param bool $gmt Optional. Whether to retrieve the GMT time. Default false.
|
||||
* @param int|WP_Post $post WP_Post object or ID. Default is global `$post` object.
|
||||
* @param bool $translate Whether to translate the time string. Default false.
|
||||
* @return string|int|false Formatted date string or Unix timestamp if `$d` is 'U' or 'G'. False on failure.
|
||||
* @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
|
||||
* False on failure.
|
||||
*/
|
||||
function get_post_time( $d = 'U', $gmt = false, $post = null, $translate = false ) {
|
||||
function get_post_time( $format = 'U', $gmt = false, $post = null, $translate = false ) {
|
||||
$post = get_post( $post );
|
||||
|
||||
if ( ! $post ) {
|
||||
@ -2573,7 +2575,7 @@ function get_post_time( $d = 'U', $gmt = false, $post = null, $translate = false
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( 'U' === $d || 'G' === $d ) {
|
||||
if ( 'U' === $format || 'G' === $format ) {
|
||||
$time = $datetime->getTimestamp();
|
||||
|
||||
// Returns a sum of timestamp with timezone offset. Ideally should never be used.
|
||||
@ -2581,13 +2583,13 @@ function get_post_time( $d = 'U', $gmt = false, $post = null, $translate = false
|
||||
$time += $datetime->getOffset();
|
||||
}
|
||||
} elseif ( $translate ) {
|
||||
$time = wp_date( $d, $datetime->getTimestamp(), $gmt ? new DateTimeZone( 'UTC' ) : null );
|
||||
$time = wp_date( $format, $datetime->getTimestamp(), $gmt ? new DateTimeZone( 'UTC' ) : null );
|
||||
} else {
|
||||
if ( $gmt ) {
|
||||
$datetime = $datetime->setTimezone( new DateTimeZone( 'UTC' ) );
|
||||
}
|
||||
|
||||
$time = $datetime->format( $d );
|
||||
$time = $datetime->format( $format );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2596,11 +2598,11 @@ function get_post_time( $d = 'U', $gmt = false, $post = null, $translate = false
|
||||
* @since 2.6.0
|
||||
*
|
||||
* @param string $time The formatted time.
|
||||
* @param string $d Format to use for retrieving the time the post was written.
|
||||
* Accepts 'G', 'U', or php date format. Default 'U'.
|
||||
* @param string $format Format to use for retrieving the time the post was written.
|
||||
* Accepts 'G', 'U', or PHP date format. Default 'U'.
|
||||
* @param bool $gmt Whether to retrieve the GMT time. Default false.
|
||||
*/
|
||||
return apply_filters( 'get_post_time', $time, $d, $gmt );
|
||||
return apply_filters( 'get_post_time', $time, $format, $gmt );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2680,20 +2682,21 @@ function get_post_timestamp( $post = null, $field = 'date' ) {
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param string $d Optional Either 'G', 'U', or php date format defaults to the value specified in the time_format option.
|
||||
* @param string $format Optional. Either 'G', 'U', or PHP date format defaults
|
||||
* to the value specified in the time_format option.
|
||||
*/
|
||||
function the_modified_time( $d = '' ) {
|
||||
function the_modified_time( $format = '' ) {
|
||||
/**
|
||||
* Filters the localized time a post was last modified, for display.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param string $get_the_modified_time The formatted time.
|
||||
* @param string $d The time format. Accepts 'G', 'U',
|
||||
* or php date format. Defaults to value
|
||||
* @param string $format The time format. Accepts 'G', 'U',
|
||||
* or PHP date format. Defaults to value
|
||||
* specified in 'time_format' option.
|
||||
*/
|
||||
echo apply_filters( 'the_modified_time', get_the_modified_time( $d ), $d );
|
||||
echo apply_filters( 'the_modified_time', get_the_modified_time( $format ), $format );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2702,22 +2705,22 @@ function the_modified_time( $d = '' ) {
|
||||
* @since 2.0.0
|
||||
* @since 4.6.0 Added the `$post` parameter.
|
||||
*
|
||||
* @param string $d Optional. Format to use for retrieving the time the post
|
||||
* was modified. Either 'G', 'U', or php date format defaults
|
||||
* @param string $format Optional. Format to use for retrieving the time the post
|
||||
* was modified. Either 'G', 'U', or PHP date format defaults
|
||||
* to the value specified in the time_format option. Default empty.
|
||||
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post.
|
||||
* @return string|false Formatted date string or Unix timestamp. False on failure.
|
||||
*/
|
||||
function get_the_modified_time( $d = '', $post = null ) {
|
||||
function get_the_modified_time( $format = '', $post = null ) {
|
||||
$post = get_post( $post );
|
||||
|
||||
if ( ! $post ) {
|
||||
// For backward compatibility, failures go through the filter below.
|
||||
$the_time = false;
|
||||
} elseif ( empty( $d ) ) {
|
||||
} elseif ( empty( $format ) ) {
|
||||
$the_time = get_post_modified_time( get_option( 'time_format' ), false, $post, true );
|
||||
} else {
|
||||
$the_time = get_post_modified_time( $d, false, $post, true );
|
||||
$the_time = get_post_modified_time( $format, false, $post, true );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2727,12 +2730,12 @@ function get_the_modified_time( $d = '', $post = null ) {
|
||||
* @since 4.6.0 Added the `$post` parameter.
|
||||
*
|
||||
* @param string|bool $the_time The formatted time or false if no post is found.
|
||||
* @param string $d Format to use for retrieving the time the post was
|
||||
* written. Accepts 'G', 'U', or php date format. Defaults
|
||||
* @param string $format Format to use for retrieving the time the post was
|
||||
* written. Accepts 'G', 'U', or PHP date format. Defaults
|
||||
* to value specified in 'time_format' option.
|
||||
* @param WP_Post|null $post WP_Post object or null if no post is found.
|
||||
*/
|
||||
return apply_filters( 'get_the_modified_time', $the_time, $d, $post );
|
||||
return apply_filters( 'get_the_modified_time', $the_time, $format, $post );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2740,14 +2743,15 @@ function get_the_modified_time( $d = '', $post = null ) {
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param string $d Optional. Format to use for retrieving the time the post
|
||||
* was modified. Either 'G', 'U', or php date format. Default 'U'.
|
||||
* @param string $format Optional. Format to use for retrieving the time the post
|
||||
* was modified. Either 'G', 'U', or PHP date format. Default 'U'.
|
||||
* @param bool $gmt Optional. Whether to retrieve the GMT time. Default false.
|
||||
* @param int|WP_Post $post WP_Post object or ID. Default is global `$post` object.
|
||||
* @param bool $translate Whether to translate the time string. Default false.
|
||||
* @return string|int|false Formatted date string or Unix timestamp if `$d` is 'U' or 'G'. False on failure.
|
||||
* @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
|
||||
* False on failure.
|
||||
*/
|
||||
function get_post_modified_time( $d = 'U', $gmt = false, $post = null, $translate = false ) {
|
||||
function get_post_modified_time( $format = 'U', $gmt = false, $post = null, $translate = false ) {
|
||||
$post = get_post( $post );
|
||||
|
||||
if ( ! $post ) {
|
||||
@ -2761,7 +2765,7 @@ function get_post_modified_time( $d = 'U', $gmt = false, $post = null, $translat
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( 'U' === $d || 'G' === $d ) {
|
||||
if ( 'U' === $format || 'G' === $format ) {
|
||||
$time = $datetime->getTimestamp();
|
||||
|
||||
// Returns a sum of timestamp with timezone offset. Ideally should never be used.
|
||||
@ -2769,13 +2773,13 @@ function get_post_modified_time( $d = 'U', $gmt = false, $post = null, $translat
|
||||
$time += $datetime->getOffset();
|
||||
}
|
||||
} elseif ( $translate ) {
|
||||
$time = wp_date( $d, $datetime->getTimestamp(), $gmt ? new DateTimeZone( 'UTC' ) : null );
|
||||
$time = wp_date( $format, $datetime->getTimestamp(), $gmt ? new DateTimeZone( 'UTC' ) : null );
|
||||
} else {
|
||||
if ( $gmt ) {
|
||||
$datetime = $datetime->setTimezone( new DateTimeZone( 'UTC' ) );
|
||||
}
|
||||
|
||||
$time = $datetime->format( $d );
|
||||
$time = $datetime->format( $format );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2784,11 +2788,11 @@ function get_post_modified_time( $d = 'U', $gmt = false, $post = null, $translat
|
||||
* @since 2.8.0
|
||||
*
|
||||
* @param string $time The formatted time.
|
||||
* @param string $d Format to use for retrieving the time the post was modified.
|
||||
* Accepts 'G', 'U', or php date format. Default 'U'.
|
||||
* @param string $format Format to use for retrieving the time the post was modified.
|
||||
* Accepts 'G', 'U', or PHP date format. Default 'U'.
|
||||
* @param bool $gmt Whether to retrieve the GMT time. Default false.
|
||||
*/
|
||||
return apply_filters( 'get_post_modified_time', $time, $d, $gmt );
|
||||
return apply_filters( 'get_post_modified_time', $time, $format, $gmt );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.4-beta1-47286';
|
||||
$wp_version = '5.4-beta1-47287';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
@ -45,8 +45,8 @@ class WP_Widget_Archives extends WP_Widget {
|
||||
/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
|
||||
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
||||
|
||||
$c = ! empty( $instance['count'] ) ? '1' : '0';
|
||||
$d = ! empty( $instance['dropdown'] ) ? '1' : '0';
|
||||
$count = ! empty( $instance['count'] ) ? '1' : '0';
|
||||
$dropdown = ! empty( $instance['dropdown'] ) ? '1' : '0';
|
||||
|
||||
echo $args['before_widget'];
|
||||
|
||||
@ -54,7 +54,7 @@ class WP_Widget_Archives extends WP_Widget {
|
||||
echo $args['before_title'] . $title . $args['after_title'];
|
||||
}
|
||||
|
||||
if ( $d ) {
|
||||
if ( $dropdown ) {
|
||||
$dropdown_id = "{$this->id_base}-dropdown-{$this->number}";
|
||||
?>
|
||||
<label class="screen-reader-text" for="<?php echo esc_attr( $dropdown_id ); ?>"><?php echo $title; ?></label>
|
||||
@ -76,7 +76,7 @@ class WP_Widget_Archives extends WP_Widget {
|
||||
array(
|
||||
'type' => 'monthly',
|
||||
'format' => 'option',
|
||||
'show_post_count' => $c,
|
||||
'show_post_count' => $count,
|
||||
),
|
||||
$instance
|
||||
);
|
||||
@ -140,7 +140,7 @@ class WP_Widget_Archives extends WP_Widget {
|
||||
'widget_archives_args',
|
||||
array(
|
||||
'type' => 'monthly',
|
||||
'show_post_count' => $c,
|
||||
'show_post_count' => $count,
|
||||
),
|
||||
$instance
|
||||
)
|
||||
|
@ -49,9 +49,9 @@ class WP_Widget_Categories extends WP_Widget {
|
||||
/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
|
||||
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
||||
|
||||
$c = ! empty( $instance['count'] ) ? '1' : '0';
|
||||
$h = ! empty( $instance['hierarchical'] ) ? '1' : '0';
|
||||
$d = ! empty( $instance['dropdown'] ) ? '1' : '0';
|
||||
$count = ! empty( $instance['count'] ) ? '1' : '0';
|
||||
$hierarchical = ! empty( $instance['hierarchical'] ) ? '1' : '0';
|
||||
$dropdown = ! empty( $instance['dropdown'] ) ? '1' : '0';
|
||||
|
||||
echo $args['before_widget'];
|
||||
|
||||
@ -61,11 +61,11 @@ class WP_Widget_Categories extends WP_Widget {
|
||||
|
||||
$cat_args = array(
|
||||
'orderby' => 'name',
|
||||
'show_count' => $c,
|
||||
'hierarchical' => $h,
|
||||
'show_count' => $count,
|
||||
'hierarchical' => $hierarchical,
|
||||
);
|
||||
|
||||
if ( $d ) {
|
||||
if ( $dropdown ) {
|
||||
echo sprintf( '<form action="%s" method="get">', esc_url( home_url() ) );
|
||||
$dropdown_id = ( $first_dropdown ) ? 'cat' : "{$this->id_base}-dropdown-{$this->number}";
|
||||
$first_dropdown = false;
|
||||
|
Loading…
Reference in New Issue
Block a user