[pLog-svn] r6091 - in plog/branches/lifetype-1.2: class/locale templates/rss

mark at devel.lifetype.net mark at devel.lifetype.net
Thu Nov 29 03:21:58 EST 2007


Author: mark
Date: 2007-11-29 03:21:57 -0500 (Thu, 29 Nov 2007)
New Revision: 6091

Modified:
   plog/branches/lifetype-1.2/class/locale/locale.class.php
   plog/branches/lifetype-1.2/templates/rss/atom.template
Log:
Fixed the bug http://bugs.lifetype.net/view.php?id=1428

Now, lifetype follow the ISO 8601 date format in Atom feed.

Modified: plog/branches/lifetype-1.2/class/locale/locale.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/locale/locale.class.php	2007-11-29 07:23:46 UTC (rev 6090)
+++ plog/branches/lifetype-1.2/class/locale/locale.class.php	2007-11-29 08:21:57 UTC (rev 6091)
@@ -473,7 +473,8 @@
 		 * <li>%S	seconds</li>
 		 * <li>%y	2-digit year representation</li>
 		 * <li>%Y	4-digit year representation</li>
-		 * <li>%O   Difference to Greenwich time (GMT) in hours</li>
+		 * <li>%O   Difference to Greenwich time (GMT) in hours, format will be +0000</li>
+		 * <li>%G   Difference to Greenwich time (GMT) in hours, format will be +00:00</li>
 		 * <li>%%	the '%' character
          * </ul>
          * (these have been added by myself and are therefore incompatible with php)<ul>
@@ -588,6 +589,14 @@
 				
 				$text = str_replace( "%O", sprintf( "%s%02d%02d", $timeZoneDirection, $timeZoneHours, $timeZoneMins ), $text );				
 			}					
+			if( strpos( $text, "%G" ) !== FALSE ) {
+	            // Now convert the time zone seconds to hours and minutes
+	            $timeZoneHours = intval( abs($timeZoneSec) / 3600 );
+	            $timeZoneMins = intval(( abs($timeZoneSec) % 3600 ) / 60 );
+	            $timeZoneDirection = ($timeZoneSec < 0 ) ? "-" : "+";				
+				
+				$text = str_replace( "%G", sprintf( "%s%02d:%02d", $timeZoneDirection, $timeZoneHours, $timeZoneMins ), $text );				
+			}
 			if( strpos( $text, "%%" ) !== FALSE ) {
 				$text = str_replace( "%%", "%", $text );				
 			}
@@ -651,6 +660,7 @@
 		 * <li>%y	2-digit year representation</li>
 		 * <li>%Y	4-digit year representation</li>
 		 * <li>%O   Difference to Greenwich time (GMT) in hours (Will always be +0000)</li>
+		 * <li>%G   Difference to Greenwich time (GMT) in hours (Will always be +00:00)</li>
 		 * <li>%%	the '%' character
          * </ul>
          * (these have been added by myself and are therefore incompatible with php)<ul>
@@ -764,6 +774,9 @@
 			if( strpos( $text, "%O" ) !== FALSE ) {
 				$text = str_replace( "%O", "+0000", $text );				
 			}					
+			if( strpos( $text, "%G" ) !== FALSE ) {
+				$text = str_replace( "%G", "+00:00", $text );				
+			}					
 			if( strpos( $text, "%%" ) !== FALSE ) {
 				$text = str_replace( "%%", "%", $text );
 			}

Modified: plog/branches/lifetype-1.2/templates/rss/atom.template
===================================================================
--- plog/branches/lifetype-1.2/templates/rss/atom.template	2007-11-29 07:23:46 UTC (rev 6090)
+++ plog/branches/lifetype-1.2/templates/rss/atom.template	2007-11-29 08:21:57 UTC (rev 6091)
@@ -4,7 +4,7 @@
 <link rel="alternate" type="text/html" href="{$url->blogLink()}" /> 
 {if $posts}
 	{assign var="newestDate" value=$posts[0]->getDateObject()} 
-	<modified>{$locale->formatDate($newestDate, "%Y-%m-%dT%H:%M:%S%O", $blog)}</modified> 
+	<modified>{$locale->formatDate($newestDate, "%Y-%m-%dT%H:%M:%S%G", $blog)}</modified> 
 {/if}
 <tagline>{$blog->getAbout()|escape}</tagline> 
 <generator url="http://www.lifetype.net/" version="1.2">LifeType</generator> 
@@ -16,9 +16,9 @@
  <title>{$post->getTopic()|escape}</title> 
  <link rel="alternate" type="text/html" href="{$url->postPermalink($post)}" /> 
  {assign var="postDate" value=$post->getDateObject()} 
- <modified>{$locale->formatDate($postDate, "%Y-%m-%dT%H:%M:%S%O", $blog)}</modified> 
- <issued>{$locale->formatDate($postDate, "%Y-%m-%dT%H:%M:%S%O", $blog)}</issued> 
- <created>{$locale->formatDate($postDate, "%Y-%m-%dT%H:%M:%S%O", $blog)}</created> 
+ <modified>{$locale->formatDate($postDate, "%Y-%m-%dT%H:%M:%S%G", $blog)}</modified> 
+ <issued>{$locale->formatDate($postDate, "%Y-%m-%dT%H:%M:%S%G", $blog)}</issued> 
+ <created>{$locale->formatDate($postDate, "%Y-%m-%dT%H:%M:%S%G", $blog)}</created> 
  <summary type="text/plain">{$post->getText()|strip_tags|truncate:200:" ..."|escape:"html"}</summary> 
  <author> 
  {assign var="postOwner" value=$post->getUserInfo()} 



More information about the pLog-svn mailing list