Convert undefined constants to strings. Props jacobsantos. fixes #7651

git-svn-id: https://develop.svn.wordpress.org/trunk@9137 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-10-13 22:14:52 +00:00
parent c3de146cbb
commit c2a331c502
1 changed files with 5 additions and 3 deletions

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