Source for file rss_utils.inc
Documentation is available at rss_utils.inc
* Project: MagpieRSS: a simple RSS integration tool
* File: rss_utils.inc, utility methods for working with RSS
* Author: Kellan Elliott-McCrea <kellan@protest.net>
* The lastest version of MagpieRSS can be obtained from:
* http://magpierss.sourceforge.net
* For questions, help, comments, discussion, etc., please join the
* magpierss-general@lists.sourceforge.net
/*======================================================================*\
Purpose: parse a W3CDTF date into unix epoch
NOTE: http://www.w3.org/TR/NOTE-datetime
\*======================================================================*/
$pat =
"/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/";
list
( $year, $month, $day, $hours, $minutes, $seconds) =
array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[6]);
# calc epoch for current date assuming GMT
$epoch =
gmmktime( $hours, $minutes, $seconds, $month, $day, $year);
if ( $match[10] ==
'Z' ) {
list
( $tz_mod, $tz_hour, $tz_min ) =
array( $match[8], $match[9], $match[10]);
if ( ! $tz_hour ) { $tz_hour =
0; }
if ( ! $tz_min ) { $tz_min =
0; }
$offset_secs =
(($tz_hour*
60)+
$tz_min)*
60;
# is timezone ahead of GMT? then subtract offset
$offset_secs =
$offset_secs * -
1;
$epoch =
$epoch +
$offset;
Documentation generated on Tue, 01 May 2007 16:47:13 +0200 by phpDocumentor 1.3.2