From: Ævar Arnfjörð Bjarmason Date: Thu, 3 Nov 2005 02:21:01 +0000 (+0000) Subject: * Add support for TS_ISO_8601, used for Special:Import/Export and the sitemap X-Git-Tag: 1.6.0~1237 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=a0458d40d0093dd503bc82f781c45a9dc6c3c009;p=lhc%2Fweb%2Fwiklou.git * Add support for TS_ISO_8601, used for Special:Import/Export and the sitemap --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 07e6a052aa..0c7e19129a 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1129,6 +1129,13 @@ define('TS_DB', 2); */ define('TS_RFC2822', 3); +/** + * ISO 8601 format with no timezone: 1986-02-09T20:00:00Z + * + * This is used by Special:Export + */ +define('TS_ISO_8601', 4); + /** * An Exif timestamp (YYYY:MM:DD HH:MM:SS) * @@ -1136,12 +1143,12 @@ define('TS_RFC2822', 3); * DateTime tag and page 36 for the DateTimeOriginal and * DateTimeDigitized tags. */ -define('TS_EXIF', 4); +define('TS_EXIF', 5); /** * Oracle format time. */ -define('TS_ORACLE', 5); +define('TS_ORACLE', 6); /** * @param mixed $outputtype A timestamp in one of the supported formats, the @@ -1172,6 +1179,10 @@ function wfTimestamp($outputtype=TS_UNIX,$ts=0) { # TS_ORACLE $uts = strtotime(preg_replace('/(\d\d)\.(\d\d)\.(\d\d)(\.(\d+))?/', "$1:$2:$3", str_replace("+00:00", "UTC", $ts))); + } elseif (preg_match('/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/', $ts, $da)) { + # TS_ISO_8601 + $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6], + (int)$da[2],(int)$da[3],(int)$da[1]); } else { # Bogus value; fall back to the epoch... wfDebug("wfTimestamp() fed bogus time value: $outputtype; $ts\n"); @@ -1186,6 +1197,8 @@ function wfTimestamp($outputtype=TS_UNIX,$ts=0) { return gmdate( 'YmdHis', $uts ); case TS_DB: return gmdate( 'Y-m-d H:i:s', $uts ); + case TS_ISO_8601: + return gmdate( 'Y-m-d\TH:i:s\Z', $uts ); // This shouldn't ever be used, but is included for completeness case TS_EXIF: return gmdate( 'Y:m:d H:i:s', $uts );