Update rss with validator recommendations
Update rss with validator recommendations

--- a/include/controller/Controller_Feed.class.php
+++ b/include/controller/Controller_Feed.class.php
@@ -95,7 +95,7 @@
 		}
 
 		if ($this->params['format'] == GitPHP_Controller_Feed::RssFormat) {
-			$this->headers[] = "Content-type: text/xml; charset=UTF-8";
+			$this->headers[] = "Content-type: application/rss+xml; charset=UTF-8";
 		} else if ($this->params['format'] == GitPHP_Controller_Feed::AtomFormat) {
 			$this->headers[] = "Content-type: application/atom+xml; charset=UTF-8";
 		}

--- a/include/git/commit/Commit.class.php
+++ b/include/git/commit/Commit.class.php
@@ -291,6 +291,21 @@
 	}
 
 	/**
+	 * Gets the author's email only
+	 *
+	 * @return string author email
+	 */
+	public function GetAuthorEmail()
+	{
+		if (!$this->dataRead)
+			$this->ReadData();
+
+		if (preg_match('/ <(.*)>$/', $this->author, $regs)) {
+			return $regs[1];
+		}
+	}
+
+	/**
 	 * Gets the author's epoch
 	 *
 	 * @return string author epoch
@@ -361,6 +376,21 @@
 			$this->ReadData();
 
 		return preg_replace('/ <.*/', '', $this->committer);
+	}
+
+	/**
+	 * Gets the committer's email only
+	 *
+	 * @return string committer email
+	 */
+	public function GetCommitterEmail()
+	{
+		if (!$this->dataRead)
+			$this->ReadData();
+
+		if (preg_match('/ <(.*)>$/', $this->committer, $regs)) {
+			return $regs[1];
+		}
 	}
 
 	/**

--- a/templates/rss.tpl
+++ b/templates/rss.tpl
@@ -6,17 +6,18 @@
  *  Copyright (C) 2009 Christopher Han <xiphux@gmail.com>
  *}
 <?xml version="1.0" encoding="utf-8"?>
-<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
+<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom">
   <channel>
     <title>{$project->GetProject()}</title>
     <link>{geturl fullurl=true project=$project}</link>
+    <atom:link rel="self" href="{geturl fullurl=true project=$project action=rss}" type="application/rss+xml" />
     <description>{$project->GetProject()} log</description>
     <language>en</language>
 
     {foreach from=$log item=logitem}
       <item>
         <title>{$logitem->GetCommitterEpoch()|date_format:"%d %b %R"} - {$logitem->GetTitle()|escape:'html'}</title>
-        <author>{$logitem->GetAuthor()|escape:'html'}</author>
+        <author>{$logitem->GetAuthorEmail()|escape:'html'} ({$logitem->GetAuthorName()|escape:'html'})</author>
         <pubDate>{$logitem->GetCommitterEpoch()|date_format:"%a, %d %b %Y %H:%M:%S %z"}</pubDate>
         <guid isPermaLink="true">{geturl fullurl=true project=$project action=commit hash=$logitem}</guid>
         <link>{geturl fullurl=true project=$project action=commit hash=$logitem}</link>

comments