topical media & game development 
  
 
 
 
 
  
    
    
  
 mashup-delicious-11-delcache-lib-rss-utils.inc / inc
  <?php
  /*
   * Project:     MagpieRSS: a simple RSS integration tool
   * File:        rss_utils.inc, utility methods for working with RSS
   * Author:      Kellan Elliott-McCrea <kellan@protest.net>
   * Version:     0.51
   * License:     GPL
   *
   * The lastest version of MagpieRSS can be obtained from:
   * http://magpierss.sourceforge.net
   *
   * For questions, help, comments, discussion, etc., please join the
   * Magpie mailing list:
   * magpierss-general@lists.sourceforge.net
   */
  
  /*======================================================================*\
      Function: parse_w3cdtf
      Purpose:  parse a W3CDTF date into unix epoch
  
      NOTE: http://www.w3.org/TR/NOTE-datetime
  \*======================================================================*/
  
  function parse_w3cdtf ( pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/";
      
      if ( preg_match( date_str, year, day, minutes, match[1], match[3], match[5], epoch = gmmktime( minutes, month, year);
          
          match[10] == 'Z' ) {
              # zulu time, aka GMT
          }
          else {
              list( tz_hour, match[8], match[10]);
              
              # zero out the variables
              if ( ! tz_hour = 0; }
              if ( ! tz_min = 0; }
          
              tz_hour*60)+tz_mod == '+' ) {
                  offset_secs * -1;
              }
              
              offset_secs; 
          }
          epoch + epoch;
      }
      else {
          return -1;
      }
  }
  
  ?>
  
  
  
(C) Æliens 
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. 
In case of other copyright issues, contact the author.