Date/Time: Replace all instances of `date()` with `gmdate()`.
Use of `date()` in core depends on PHP timezone set to UTC and not changed by third party code (which cannot be guaranteed). `gmdate()` is functionally equivalent, but is not affected by PHP timezone setting: it's always UTC, which is the exact behavior the core needs. Props nielsdeblaauw, Rarst. Fixes #46438. See #44491. Built from https://develop.svn.wordpress.org/trunk@45424 git-svn-id: http://core.svn.wordpress.org/trunk@45235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
17cc8cd0f8
commit
c77e771c84
|
@ -1476,7 +1476,7 @@ function wp_ajax_add_meta() {
|
|||
$post_data['post_status'] = 'draft';
|
||||
$now = time();
|
||||
/* translators: 1: Post creation date, 2: Post creation time */
|
||||
$post_data['post_title'] = sprintf( __( 'Draft created on %1$s at %2$s' ), date( __( 'F j, Y' ), $now ), date( __( 'g:i a' ), $now ) );
|
||||
$post_data['post_title'] = sprintf( __( 'Draft created on %1$s at %2$s' ), gmdate( __( 'F j, Y' ), $now ), gmdate( __( 'g:i a' ), $now ) );
|
||||
|
||||
$pid = edit_post( $post_data );
|
||||
if ( $pid ) {
|
||||
|
|
|
@ -207,7 +207,7 @@ class ftp_base {
|
|||
$b['month'] = $lucifer[5];
|
||||
$b['day'] = $lucifer[6];
|
||||
if (preg_match("/([0-9]{2}):([0-9]{2})/",$lucifer[7],$l2)) {
|
||||
$b['year'] = date("Y");
|
||||
$b['year'] = gmdate("Y");
|
||||
$b['hour'] = $l2[1];
|
||||
$b['minute'] = $l2[2];
|
||||
} else {
|
||||
|
|
|
@ -598,8 +598,8 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
|||
$struc['group'] = $this->group( $path . '/' . $entry );
|
||||
$struc['size'] = $this->size( $path . '/' . $entry );
|
||||
$struc['lastmodunix'] = $this->mtime( $path . '/' . $entry );
|
||||
$struc['lastmod'] = date( 'M j', $struc['lastmodunix'] );
|
||||
$struc['time'] = date( 'h:i:s', $struc['lastmodunix'] );
|
||||
$struc['lastmod'] = gmdate( 'M j', $struc['lastmodunix'] );
|
||||
$struc['time'] = gmdate( 'h:i:s', $struc['lastmodunix'] );
|
||||
$struc['type'] = $this->is_dir( $path . '/' . $entry ) ? 'd' : 'f';
|
||||
|
||||
if ( 'd' == $struc['type'] ) {
|
||||
|
|
|
@ -621,7 +621,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
|||
$b['month'] = $lucifer[5];
|
||||
$b['day'] = $lucifer[6];
|
||||
if ( preg_match( '/([0-9]{2}):([0-9]{2})/', $lucifer[7], $l2 ) ) {
|
||||
$b['year'] = date( 'Y' );
|
||||
$b['year'] = gmdate( 'Y' );
|
||||
$b['hour'] = $l2[1];
|
||||
$b['minute'] = $l2[2];
|
||||
} else {
|
||||
|
|
|
@ -744,8 +744,8 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
|
|||
$struc['group'] = $this->group( $path . '/' . $entry );
|
||||
$struc['size'] = $this->size( $path . '/' . $entry );
|
||||
$struc['lastmodunix'] = $this->mtime( $path . '/' . $entry );
|
||||
$struc['lastmod'] = date( 'M j', $struc['lastmodunix'] );
|
||||
$struc['time'] = date( 'h:i:s', $struc['lastmodunix'] );
|
||||
$struc['lastmod'] = gmdate( 'M j', $struc['lastmodunix'] );
|
||||
$struc['time'] = gmdate( 'h:i:s', $struc['lastmodunix'] );
|
||||
$struc['type'] = $this->is_dir( $path . '/' . $entry ) ? 'd' : 'f';
|
||||
|
||||
if ( 'd' == $struc['type'] ) {
|
||||
|
|
|
@ -863,11 +863,11 @@ function wp_dashboard_recent_posts( $args ) {
|
|||
$posts->the_post();
|
||||
|
||||
$time = get_the_time( 'U' );
|
||||
if ( date( 'Y-m-d', $time ) == $today ) {
|
||||
if ( gmdate( 'Y-m-d', $time ) == $today ) {
|
||||
$relative = __( 'Today' );
|
||||
} elseif ( date( 'Y-m-d', $time ) == $tomorrow ) {
|
||||
} elseif ( gmdate( 'Y-m-d', $time ) == $tomorrow ) {
|
||||
$relative = __( 'Tomorrow' );
|
||||
} elseif ( date( 'Y', $time ) !== $year ) {
|
||||
} elseif ( gmdate( 'Y', $time ) !== $year ) {
|
||||
/* translators: date and time format for recent posts on the dashboard, from a different calendar year, see https://secure.php.net/date */
|
||||
$relative = date_i18n( __( 'M jS Y' ), $time );
|
||||
} else {
|
||||
|
|
|
@ -79,7 +79,7 @@ function export_wp( $args = array() ) {
|
|||
if ( ! empty( $sitename ) ) {
|
||||
$sitename .= '.';
|
||||
}
|
||||
$date = date( 'Y-m-d' );
|
||||
$date = gmdate( 'Y-m-d' );
|
||||
$wp_filename = $sitename . 'WordPress.' . $date . '.xml';
|
||||
/**
|
||||
* Filters the export filename.
|
||||
|
@ -129,11 +129,11 @@ function export_wp( $args = array() ) {
|
|||
}
|
||||
|
||||
if ( $args['start_date'] ) {
|
||||
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", date( 'Y-m-d', strtotime( $args['start_date'] ) ) );
|
||||
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", gmdate( 'Y-m-d', strtotime( $args['start_date'] ) ) );
|
||||
}
|
||||
|
||||
if ( $args['end_date'] ) {
|
||||
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", date( 'Y-m-d', strtotime( '+1 month', strtotime( $args['end_date'] ) ) ) );
|
||||
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", gmdate( 'Y-m-d', strtotime( '+1 month', strtotime( $args['end_date'] ) ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -458,7 +458,7 @@ function export_wp( $args = array() ) {
|
|||
<title><?php bloginfo_rss( 'name' ); ?></title>
|
||||
<link><?php bloginfo_rss( 'url' ); ?></link>
|
||||
<description><?php bloginfo_rss( 'description' ); ?></description>
|
||||
<pubDate><?php echo date( 'D, d M Y H:i:s +0000' ); ?></pubDate>
|
||||
<pubDate><?php echo gmdate( 'D, d M Y H:i:s +0000' ); ?></pubDate>
|
||||
<language><?php bloginfo_rss( 'language' ); ?></language>
|
||||
<wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version>
|
||||
<wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
|
||||
|
|
|
@ -170,10 +170,10 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
|
|||
$hh = $post_data['hh'];
|
||||
$mn = $post_data['mn'];
|
||||
$ss = $post_data['ss'];
|
||||
$aa = ( $aa <= 0 ) ? date( 'Y' ) : $aa;
|
||||
$mm = ( $mm <= 0 ) ? date( 'n' ) : $mm;
|
||||
$aa = ( $aa <= 0 ) ? gmdate( 'Y' ) : $aa;
|
||||
$mm = ( $mm <= 0 ) ? gmdate( 'n' ) : $mm;
|
||||
$jj = ( $jj > 31 ) ? 31 : $jj;
|
||||
$jj = ( $jj <= 0 ) ? date( 'j' ) : $jj;
|
||||
$jj = ( $jj <= 0 ) ? gmdate( 'j' ) : $jj;
|
||||
$hh = ( $hh > 23 ) ? $hh - 24 : $hh;
|
||||
$mn = ( $mn > 59 ) ? $mn - 60 : $mn;
|
||||
$ss = ( $ss > 59 ) ? $ss - 60 : $ss;
|
||||
|
|
|
@ -941,7 +941,7 @@ function upgrade_110() {
|
|||
|
||||
$time_difference = $all_options->time_difference;
|
||||
|
||||
$server_time = time() + date( 'Z' );
|
||||
$server_time = time() + gmdate( 'Z' );
|
||||
$weblogger_time = $server_time + $time_difference * HOUR_IN_SECONDS;
|
||||
$gmt_time = time();
|
||||
|
||||
|
|
|
@ -202,11 +202,11 @@ $structures = array(
|
|||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label><input name="selection" type="radio" value="<?php echo esc_attr( $structures[1] ); ?>" <?php checked( $structures[1], $permalink_structure ); ?> /> <?php _e( 'Day and name' ); ?></label></th>
|
||||
<td><code><?php echo get_option( 'home' ) . $blog_prefix . $prefix . '/' . date( 'Y' ) . '/' . date( 'm' ) . '/' . date( 'd' ) . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
|
||||
<td><code><?php echo get_option( 'home' ) . $blog_prefix . $prefix . '/' . gmdate( 'Y' ) . '/' . gmdate( 'm' ) . '/' . gmdate( 'd' ) . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label><input name="selection" type="radio" value="<?php echo esc_attr( $structures[2] ); ?>" <?php checked( $structures[2], $permalink_structure ); ?> /> <?php _e( 'Month and name' ); ?></label></th>
|
||||
<td><code><?php echo get_option( 'home' ) . $blog_prefix . $prefix . '/' . date( 'Y' ) . '/' . date( 'm' ) . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
|
||||
<td><code><?php echo get_option( 'home' ) . $blog_prefix . $prefix . '/' . gmdate( 'Y' ) . '/' . gmdate( 'm' ) . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label><input name="selection" type="radio" value="<?php echo esc_attr( $structures[3] ); ?>" <?php checked( $structures[3], $permalink_structure ); ?> /> <?php _e( 'Numeric' ); ?></label></th>
|
||||
|
|
|
@ -37,12 +37,12 @@ class IXR_Date {
|
|||
|
||||
function parseTimestamp($timestamp)
|
||||
{
|
||||
$this->year = date('Y', $timestamp);
|
||||
$this->month = date('m', $timestamp);
|
||||
$this->day = date('d', $timestamp);
|
||||
$this->hour = date('H', $timestamp);
|
||||
$this->minute = date('i', $timestamp);
|
||||
$this->second = date('s', $timestamp);
|
||||
$this->year = gmdate('Y', $timestamp);
|
||||
$this->month = gmdate('m', $timestamp);
|
||||
$this->day = gmdate('d', $timestamp);
|
||||
$this->hour = gmdate('H', $timestamp);
|
||||
$this->minute = gmdate('i', $timestamp);
|
||||
$this->second = gmdate('s', $timestamp);
|
||||
$this->timezone = '';
|
||||
}
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ EOD;
|
|||
header('Content-Type: text/xml; charset='.$charset);
|
||||
else
|
||||
header('Content-Type: text/xml');
|
||||
header('Date: '.date('r'));
|
||||
header('Date: '.gmdate('r'));
|
||||
echo $xml;
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ function _walk_bookmarks( $bookmarks, $args = '' ) {
|
|||
$title .= ' (';
|
||||
$title .= sprintf(
|
||||
__( 'Last updated: %s' ),
|
||||
date(
|
||||
gmdate(
|
||||
get_option( 'links_updated_date_format' ),
|
||||
$bookmark->link_updated_f + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS )
|
||||
)
|
||||
|
|
|
@ -443,7 +443,7 @@ class WP {
|
|||
}
|
||||
|
||||
if ( ! $wp_last_modified ) {
|
||||
$wp_last_modified = date( 'D, d M Y H:i:s' );
|
||||
$wp_last_modified = gmdate( 'D, d M Y H:i:s' );
|
||||
}
|
||||
|
||||
$wp_last_modified .= ' GMT';
|
||||
|
|
|
@ -337,7 +337,7 @@ function get_lastcommentmodified( $timezone = 'server' ) {
|
|||
$comment_modified_date = $wpdb->get_var( "SELECT comment_date FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1" );
|
||||
break;
|
||||
case 'server':
|
||||
$add_seconds_server = date( 'Z' );
|
||||
$add_seconds_server = gmdate( 'Z' );
|
||||
|
||||
$comment_modified_date = $wpdb->get_var( $wpdb->prepare( "SELECT DATE_ADD(comment_date_gmt, INTERVAL %s SECOND) FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1", $add_seconds_server ) );
|
||||
break;
|
||||
|
|
|
@ -317,7 +317,7 @@ class WP_Date_Query {
|
|||
$_year = $date_query['year'];
|
||||
}
|
||||
|
||||
$max_days_of_year = date( 'z', mktime( 0, 0, 0, 12, 31, $_year ) ) + 1;
|
||||
$max_days_of_year = gmdate( 'z', mktime( 0, 0, 0, 12, 31, $_year ) ) + 1;
|
||||
} else {
|
||||
// otherwise we use the max of 366 (leap-year)
|
||||
$max_days_of_year = 366;
|
||||
|
@ -352,7 +352,7 @@ class WP_Date_Query {
|
|||
* If we have a specific year, use it to calculate number of weeks.
|
||||
* Note: the number of weeks in a year is the date in which Dec 28 appears.
|
||||
*/
|
||||
$week_count = date( 'W', mktime( 0, 0, 0, 12, 28, $_year ) );
|
||||
$week_count = gmdate( 'W', mktime( 0, 0, 0, 12, 28, $_year ) );
|
||||
|
||||
} else {
|
||||
// Otherwise set the week-count to a maximum of 53.
|
||||
|
@ -923,7 +923,7 @@ class WP_Date_Query {
|
|||
}
|
||||
|
||||
if ( ! isset( $datetime['day'] ) ) {
|
||||
$datetime['day'] = ( $default_to_max ) ? (int) date( 't', mktime( 0, 0, 0, $datetime['month'], 1, $datetime['year'] ) ) : 1;
|
||||
$datetime['day'] = ( $default_to_max ) ? (int) gmdate( 't', mktime( 0, 0, 0, $datetime['month'], 1, $datetime['year'] ) ) : 1;
|
||||
}
|
||||
|
||||
if ( ! isset( $datetime['hour'] ) ) {
|
||||
|
|
|
@ -960,7 +960,7 @@ function get_links($category = -1, $before = '', $after = '<br />', $between = '
|
|||
|
||||
if ( $show_updated )
|
||||
if (substr($row->link_updated_f, 0, 2) != '00')
|
||||
$title .= ' ('.__('Last updated') . ' ' . date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')';
|
||||
$title .= ' ('.__('Last updated') . ' ' . gmdate(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')';
|
||||
|
||||
if ( '' != $title )
|
||||
$title = ' title="' . $title . '"';
|
||||
|
|
|
@ -3432,13 +3432,13 @@ function get_date_from_gmt( $string, $format = 'Y-m-d H:i:s' ) {
|
|||
if ( $tz ) {
|
||||
$datetime = date_create( $string, new DateTimeZone( 'UTC' ) );
|
||||
if ( ! $datetime ) {
|
||||
return date( $format, 0 );
|
||||
return gmdate( $format, 0 );
|
||||
}
|
||||
$datetime->setTimezone( new DateTimeZone( $tz ) );
|
||||
$string_localtime = $datetime->format( $format );
|
||||
} else {
|
||||
if ( ! preg_match( '#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches ) ) {
|
||||
return date( $format, 0 );
|
||||
return gmdate( $format, 0 );
|
||||
}
|
||||
$string_time = gmmktime( $matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1] );
|
||||
$string_localtime = gmdate( $format, $string_time + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
|
||||
|
|
|
@ -41,7 +41,7 @@ function mysql2date( $format, $date, $translate = true ) {
|
|||
if ( $translate ) {
|
||||
return date_i18n( $format, $i );
|
||||
} else {
|
||||
return date( $format, $i );
|
||||
return gmdate( $format, $i );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,12 +111,12 @@ function date_i18n( $dateformatstring, $timestamp_with_offset = false, $gmt = fa
|
|||
$dateformatstring = preg_replace( '/(?<!\\\\)r/', DATE_RFC2822, $dateformatstring );
|
||||
|
||||
if ( ( ! empty( $wp_locale->month ) ) && ( ! empty( $wp_locale->weekday ) ) ) {
|
||||
$datemonth = $wp_locale->get_month( date( 'm', $i ) );
|
||||
$datemonth = $wp_locale->get_month( gmdate( 'm', $i ) );
|
||||
$datemonth_abbrev = $wp_locale->get_month_abbrev( $datemonth );
|
||||
$dateweekday = $wp_locale->get_weekday( date( 'w', $i ) );
|
||||
$dateweekday = $wp_locale->get_weekday( gmdate( 'w', $i ) );
|
||||
$dateweekday_abbrev = $wp_locale->get_weekday_abbrev( $dateweekday );
|
||||
$datemeridiem = $wp_locale->get_meridiem( date( 'a', $i ) );
|
||||
$datemeridiem_capital = $wp_locale->get_meridiem( date( 'A', $i ) );
|
||||
$datemeridiem = $wp_locale->get_meridiem( gmdate( 'a', $i ) );
|
||||
$datemeridiem_capital = $wp_locale->get_meridiem( gmdate( 'A', $i ) );
|
||||
$dateformatstring = ' ' . $dateformatstring;
|
||||
$dateformatstring = preg_replace( '/([^\\\])D/', "\\1" . backslashit( $dateweekday_abbrev ), $dateformatstring );
|
||||
$dateformatstring = preg_replace( '/([^\\\])F/', "\\1" . backslashit( $datemonth ), $dateformatstring );
|
||||
|
@ -177,7 +177,7 @@ function date_i18n( $dateformatstring, $timestamp_with_offset = false, $gmt = fa
|
|||
}
|
||||
}
|
||||
}
|
||||
$j = @date( $dateformatstring, $i );
|
||||
$j = @gmdate( $dateformatstring, $i );
|
||||
|
||||
/**
|
||||
* Filters the date formatted based on the locale.
|
||||
|
@ -415,7 +415,7 @@ function get_weekstartend( $mysqlstring, $start_of_week = '' ) {
|
|||
$day = mktime( 0, 0, 0, $md, $mm, $my );
|
||||
|
||||
// The day of the week from the timestamp.
|
||||
$weekday = date( 'w', $day );
|
||||
$weekday = gmdate( 'w', $day );
|
||||
|
||||
if ( ! is_numeric( $start_of_week ) ) {
|
||||
$start_of_week = get_option( 'start_of_week' );
|
||||
|
|
|
@ -2107,7 +2107,7 @@ function get_calendar( $initial = true, $echo = true ) {
|
|||
}
|
||||
|
||||
$unixmonth = mktime( 0, 0, 0, $thismonth, 1, $thisyear );
|
||||
$last_day = date( 't', $unixmonth );
|
||||
$last_day = gmdate( 't', $unixmonth );
|
||||
|
||||
// Get the next and previous month and year with at least one post
|
||||
$previous = $wpdb->get_row(
|
||||
|
@ -2133,7 +2133,7 @@ function get_calendar( $initial = true, $echo = true ) {
|
|||
<caption>' . sprintf(
|
||||
$calendar_caption,
|
||||
$wp_locale->get_month( $thismonth ),
|
||||
date( 'Y', $unixmonth )
|
||||
gmdate( 'Y', $unixmonth )
|
||||
) . '</caption>
|
||||
<thead>
|
||||
<tr>';
|
||||
|
@ -2199,13 +2199,13 @@ function get_calendar( $initial = true, $echo = true ) {
|
|||
}
|
||||
|
||||
// See how much we should pad in the beginning
|
||||
$pad = calendar_week_mod( date( 'w', $unixmonth ) - $week_begins );
|
||||
$pad = calendar_week_mod( gmdate( 'w', $unixmonth ) - $week_begins );
|
||||
if ( 0 != $pad ) {
|
||||
$calendar_output .= "\n\t\t" . '<td colspan="' . esc_attr( $pad ) . '" class="pad"> </td>';
|
||||
}
|
||||
|
||||
$newrow = false;
|
||||
$daysinmonth = (int) date( 't', $unixmonth );
|
||||
$daysinmonth = (int) gmdate( 't', $unixmonth );
|
||||
|
||||
for ( $day = 1; $day <= $daysinmonth; ++$day ) {
|
||||
if ( isset( $newrow ) && $newrow ) {
|
||||
|
@ -2223,7 +2223,7 @@ function get_calendar( $initial = true, $echo = true ) {
|
|||
|
||||
if ( in_array( $day, $daywithpost ) ) {
|
||||
// any posts today?
|
||||
$date_format = date( _x( 'F j, Y', 'daily archives date format' ), strtotime( "{$thisyear}-{$thismonth}-{$day}" ) );
|
||||
$date_format = gmdate( _x( 'F j, Y', 'daily archives date format' ), strtotime( "{$thisyear}-{$thismonth}-{$day}" ) );
|
||||
/* translators: Post calendar label. %s: Date */
|
||||
$label = sprintf( __( 'Posts published on %s' ), $date_format );
|
||||
$calendar_output .= sprintf(
|
||||
|
@ -2237,12 +2237,12 @@ function get_calendar( $initial = true, $echo = true ) {
|
|||
}
|
||||
$calendar_output .= '</td>';
|
||||
|
||||
if ( 6 == calendar_week_mod( date( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ) ) {
|
||||
if ( 6 == calendar_week_mod( gmdate( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ) ) {
|
||||
$newrow = true;
|
||||
}
|
||||
}
|
||||
|
||||
$pad = 7 - calendar_week_mod( date( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins );
|
||||
$pad = 7 - calendar_week_mod( gmdate( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins );
|
||||
if ( $pad != 0 && $pad != 7 ) {
|
||||
$calendar_output .= "\n\t\t" . '<td class="pad" colspan="' . esc_attr( $pad ) . '"> </td>';
|
||||
}
|
||||
|
@ -4452,7 +4452,7 @@ function get_the_generator( $type = '' ) {
|
|||
$gen = '<!-- generator="WordPress/' . esc_attr( get_bloginfo( 'version' ) ) . '" -->';
|
||||
break;
|
||||
case 'export':
|
||||
$gen = '<!-- generator="WordPress/' . esc_attr( get_bloginfo_rss( 'version' ) ) . '" created="' . date( 'Y-m-d H:i' ) . '" -->';
|
||||
$gen = '<!-- generator="WordPress/' . esc_attr( get_bloginfo_rss( 'version' ) ) . '" created="' . gmdate( 'Y-m-d H:i' ) . '" -->';
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ function get_permalink( $post = 0, $leavename = false ) {
|
|||
$author = $authordata->user_nicename;
|
||||
}
|
||||
|
||||
$date = explode( ' ', date( 'Y m d H i s', $unixtime ) );
|
||||
$date = explode( ' ', gmdate( 'Y m d H i s', $unixtime ) );
|
||||
$rewritereplace =
|
||||
array(
|
||||
$date[0],
|
||||
|
|
|
@ -6031,8 +6031,8 @@ function wp_check_for_changed_slugs( $post_id, $post, $post_before ) {
|
|||
* @param WP_Post $post_before The Previous Post Object
|
||||
*/
|
||||
function wp_check_for_changed_dates( $post_id, $post, $post_before ) {
|
||||
$previous_date = date( 'Y-m-d', strtotime( $post_before->post_date ) );
|
||||
$new_date = date( 'Y-m-d', strtotime( $post->post_date ) );
|
||||
$previous_date = gmdate( 'Y-m-d', strtotime( $post_before->post_date ) );
|
||||
$new_date = gmdate( 'Y-m-d', strtotime( $post->post_date ) );
|
||||
// Don't bother if it hasn't changed.
|
||||
if ( $new_date == $previous_date ) {
|
||||
return;
|
||||
|
@ -6286,7 +6286,7 @@ function _get_last_post_time( $timezone, $field, $post_type = 'any' ) {
|
|||
$date = $wpdb->get_var( "SELECT post_{$field} FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1" );
|
||||
break;
|
||||
case 'server':
|
||||
$add_seconds_server = date( 'Z' );
|
||||
$add_seconds_server = gmdate( 'Z' );
|
||||
$date = $wpdb->get_var( "SELECT DATE_ADD(post_{$field}_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1" );
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -924,10 +924,10 @@ function rest_get_date_with_gmt( $date, $is_utc = false ) {
|
|||
// Timezone conversion needs to be handled differently between these two
|
||||
// cases.
|
||||
if ( ! $is_utc && ! $has_timezone ) {
|
||||
$local = date( 'Y-m-d H:i:s', $date );
|
||||
$local = gmdate( 'Y-m-d H:i:s', $date );
|
||||
$utc = get_gmt_from_date( $local );
|
||||
} else {
|
||||
$utc = date( 'Y-m-d H:i:s', $date );
|
||||
$utc = gmdate( 'Y-m-d H:i:s', $date );
|
||||
$local = get_date_from_gmt( $utc );
|
||||
}
|
||||
|
||||
|
|
|
@ -1478,7 +1478,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
|||
// based on the `post_modified` field with the site's timezone
|
||||
// offset applied.
|
||||
if ( '0000-00-00 00:00:00' === $post->post_modified_gmt ) {
|
||||
$post_modified_gmt = date( 'Y-m-d H:i:s', strtotime( $post->post_modified ) - ( get_option( 'gmt_offset' ) * 3600 ) );
|
||||
$post_modified_gmt = gmdate( 'Y-m-d H:i:s', strtotime( $post->post_modified ) - ( get_option( 'gmt_offset' ) * 3600 ) );
|
||||
} else {
|
||||
$post_modified_gmt = $post->post_modified_gmt;
|
||||
}
|
||||
|
|
|
@ -925,7 +925,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
|
|||
}
|
||||
|
||||
if ( in_array( 'registered_date', $fields, true ) ) {
|
||||
$data['registered_date'] = date( 'c', strtotime( $user->user_registered ) );
|
||||
$data['registered_date'] = gmdate( 'c', strtotime( $user->user_registered ) );
|
||||
}
|
||||
|
||||
if ( in_array( 'capabilities', $fields, true ) ) {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.3-alpha-45423';
|
||||
$wp_version = '5.3-alpha-45424';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue