mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-12 13:44:21 +01:00
Convert undefined constants to strings. Props jacobsantos. fixes #7651
git-svn-id: http://svn.automattic.com/wordpress/trunk@9137 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
cf50b7100a
commit
97716d5ae1
@ -1215,8 +1215,10 @@ function iso8601_timezone_to_offset($timezone) {
|
|||||||
* @param string $timezone Optional. If set to GMT returns the time minus gmt_offset. Default is 'user'.
|
* @param string $timezone Optional. If set to GMT returns the time minus gmt_offset. Default is 'user'.
|
||||||
* @return string The date and time in MySQL DateTime format - Y-m-d H:i:s.
|
* @return string The date and time in MySQL DateTime format - Y-m-d H:i:s.
|
||||||
*/
|
*/
|
||||||
function iso8601_to_datetime($date_string, $timezone = USER) {
|
function iso8601_to_datetime($date_string, $timezone = 'user') {
|
||||||
if ($timezone == GMT) {
|
$timezone = strtolower($timezone);
|
||||||
|
|
||||||
|
if ($timezone == 'gmt') {
|
||||||
|
|
||||||
preg_match('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', $date_string, $date_bits);
|
preg_match('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', $date_string, $date_bits);
|
||||||
|
|
||||||
@ -1231,7 +1233,7 @@ function iso8601_to_datetime($date_string, $timezone = USER) {
|
|||||||
|
|
||||||
return gmdate('Y-m-d H:i:s', $timestamp);
|
return gmdate('Y-m-d H:i:s', $timestamp);
|
||||||
|
|
||||||
} else if ($timezone == USER) {
|
} else if ($timezone == 'user') {
|
||||||
return preg_replace('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', '$1-$2-$3 $4:$5:$6', $date_string);
|
return preg_replace('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', '$1-$2-$3 $4:$5:$6', $date_string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user