PEAK XOOPS - Re: I cannot use ryus_date in xhld. in englishin japanese

Re: I cannot use ryus_date in xhld.

List posts in the topic

normal Re: I cannot use ryus_date in xhld.

msg# 1.2.1.1.1.1
depth:
5
Previous post - Next post | Parent - Children.1 | Posted on 2004/8/11 5:48
GIJOE  ÀèǤ·³Áâ   Posts: 4110
The RSS displays a wrong format of w3c.

wrong:
<dc:date>2004-08-10T20:19:46+9:00</dc:date> 

correct:
<dc:date>2004-08-10T20:19:46+09:00</dc:date> 

But there are many wrong formats in the world, I think.
I've modified the parser for w3c (dc:date).
replace the function of class RssDcDateHandler in line 705 of xmlrss2parser.php
	function dateW3cToUnix( $w3cDT )
	{
		$w3cDT = strtoupper( $w3cDT ) ;
		$tzoffset = date( 'Z' ) ;
		if( $pos = strrpos( $w3cDT , 'Z' ) ) {
			// GMT
			$localdatetime = substr( $w3cDT , 0 , $pos ) ;
		} else if( ( $pos = strrpos( $w3cDT , '+' ) ) > 0 ) {
			$hourmin = explode( ':' , substr( $w3cDT , $pos + 1 ) ) ;
			if( ! empty( $hourmin[0] ) ) $tzoffset -= $hourmin[0] * 3600 ;
			if( ! empty( $hourmin[1] ) ) $tzoffset -= $hourmin[1] * 60 ;
			$localdatetime = substr( $w3cDT , 0 , $pos ) ;
		} else if( ( $pos = strrpos( $w3cDT , '-' ) ) > 7 ) {
			$hourmin = explode( ':' , substr( $w3cDT , $pos + 1 ) ) ;
			if( ! empty( $hourmin[0] ) ) $tzoffset += $hourmin[0] * 3600 ;
			if( ! empty( $hourmin[1] ) ) $tzoffset += $hourmin[1] * 60 ;
			$localdatetime = substr( $w3cDT , 0 , $pos ) ;
		} else {
			// no timezone
			$localdatetime = $w3cDT ;
		}

		$localunixtime = strtotime( str_replace( 'T' , ' ' , $localdatetime ) ) ;
		if( $localunixtime == -1 ) return time() ;
		else return $localunixtime + $tzoffset ;
	}
Votes:0 Average:0.00

Posts tree

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!