mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
WP Mail: replace logic that was mimicking strtotime()
with strtotime()
. Without this, the date parsing wasn't accounting for half-hour and quarter-hour timezones.
Props neoscrib, solarissmoke. Fixes #16993. Built from https://develop.svn.wordpress.org/trunk@34864 git-svn-id: http://core.svn.wordpress.org/trunk@34829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c32357a900
commit
53060a8987
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.4-alpha-34863';
|
$wp_version = '4.4-alpha-34864';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
29
wp-mail.php
29
wp-mail.php
@ -128,31 +128,10 @@ for ( $i = 1; $i <= $count; $i++ ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/Date: /i', $line)) { // of the form '20 Mar 2002 20:32:37'
|
if ( preg_match( '/Date: /i', $line ) ) { // of the form '20 Mar 2002 20:32:37 +0100'
|
||||||
$ddate = trim($line);
|
$ddate = str_replace( 'Date: ', '', trim( $line ) );
|
||||||
$ddate = str_replace('Date: ', '', $ddate);
|
$ddate = preg_replace( '!\s*\(.+\)\s*$!', '', $ddate ); // remove parenthesised timezone string if it exists, as this confuses strtotime
|
||||||
if (strpos($ddate, ',')) {
|
$ddate_U = strtotime( $ddate );
|
||||||
$ddate = trim(substr($ddate, strpos($ddate, ',') + 1, strlen($ddate)));
|
|
||||||
}
|
|
||||||
$date_arr = explode(' ', $ddate);
|
|
||||||
$date_time = explode(':', $date_arr[3]);
|
|
||||||
|
|
||||||
$ddate_H = $date_time[0];
|
|
||||||
$ddate_i = $date_time[1];
|
|
||||||
$ddate_s = $date_time[2];
|
|
||||||
|
|
||||||
$ddate_m = $date_arr[1];
|
|
||||||
$ddate_d = $date_arr[0];
|
|
||||||
$ddate_Y = $date_arr[2];
|
|
||||||
for ( $j = 0; $j < 12; $j++ ) {
|
|
||||||
if ( $ddate_m == $dmonths[$j] ) {
|
|
||||||
$ddate_m = $j+1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$time_zn = intval($date_arr[4]) * 36;
|
|
||||||
$ddate_U = gmmktime($ddate_H, $ddate_i, $ddate_s, $ddate_m, $ddate_d, $ddate_Y);
|
|
||||||
$ddate_U = $ddate_U - $time_zn;
|
|
||||||
$post_date = gmdate( 'Y-m-d H:i:s', $ddate_U + $time_difference );
|
$post_date = gmdate( 'Y-m-d H:i:s', $ddate_U + $time_difference );
|
||||||
$post_date_gmt = gmdate( 'Y-m-d H:i:s', $ddate_U );
|
$post_date_gmt = gmdate( 'Y-m-d H:i:s', $ddate_U );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user