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:
ryan 2008-10-13 22:14:52 +00:00
parent cf50b7100a
commit 97716d5ae1

View File

@ -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);
}
}