Date/Time: Reduce explicit local current_time( 'timestamp' ) usage in favor of native PHP functions.
Timestamps don't carry any timezone information, using the intended format directly simplifies the logic and makes the code less confusing. Props Rarst, jdgrimes. See #40657. Built from https://develop.svn.wordpress.org/trunk@44809 git-svn-id: http://core.svn.wordpress.org/trunk@44641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -470,7 +470,7 @@ function get_attachment_link( $post = null, $leavename = false ) {
|
||||
function get_year_link( $year ) {
|
||||
global $wp_rewrite;
|
||||
if ( ! $year ) {
|
||||
$year = gmdate( 'Y', current_time( 'timestamp' ) );
|
||||
$year = current_time( 'Y' );
|
||||
}
|
||||
$yearlink = $wp_rewrite->get_year_permastruct();
|
||||
if ( ! empty( $yearlink ) ) {
|
||||
@@ -505,10 +505,10 @@ function get_year_link( $year ) {
|
||||
function get_month_link( $year, $month ) {
|
||||
global $wp_rewrite;
|
||||
if ( ! $year ) {
|
||||
$year = gmdate( 'Y', current_time( 'timestamp' ) );
|
||||
$year = current_time( 'Y' );
|
||||
}
|
||||
if ( ! $month ) {
|
||||
$month = gmdate( 'm', current_time( 'timestamp' ) );
|
||||
$month = current_time( 'm' );
|
||||
}
|
||||
$monthlink = $wp_rewrite->get_month_permastruct();
|
||||
if ( ! empty( $monthlink ) ) {
|
||||
@@ -546,13 +546,13 @@ function get_month_link( $year, $month ) {
|
||||
function get_day_link( $year, $month, $day ) {
|
||||
global $wp_rewrite;
|
||||
if ( ! $year ) {
|
||||
$year = gmdate( 'Y', current_time( 'timestamp' ) );
|
||||
$year = current_time( 'Y' );
|
||||
}
|
||||
if ( ! $month ) {
|
||||
$month = gmdate( 'm', current_time( 'timestamp' ) );
|
||||
$month = current_time( 'm' );
|
||||
}
|
||||
if ( ! $day ) {
|
||||
$day = gmdate( 'j', current_time( 'timestamp' ) );
|
||||
$day = current_time( 'j' );
|
||||
}
|
||||
|
||||
$daylink = $wp_rewrite->get_day_permastruct();
|
||||
|
||||
Reference in New Issue
Block a user