From c2a331c502e069e97fdb8b513a64141f6ed4de44 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 13 Oct 2008 22:14:52 +0000 Subject: [PATCH] Convert undefined constants to strings. Props jacobsantos. fixes #7651 git-svn-id: https://develop.svn.wordpress.org/trunk@9137 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/formatting.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 9d9a0e97b9..d6f9879424 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -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'. * @return string The date and time in MySQL DateTime format - Y-m-d H:i:s. */ -function iso8601_to_datetime($date_string, $timezone = USER) { - if ($timezone == GMT) { +function iso8601_to_datetime($date_string, $timezone = 'user') { + $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); @@ -1231,7 +1233,7 @@ function iso8601_to_datetime($date_string, $timezone = USER) { 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); } }