Author: chabotc
Date: Sat Nov  8 03:43:46 2008
New Revision: 712376

URL: http://svn.apache.org/viewvc?rev=712376&view=rev
Log:
Minor fix to new Feed parser code

Modified:
    incubator/shindig/trunk/php/src/gadgets/ProxyHandler.php

Modified: incubator/shindig/trunk/php/src/gadgets/ProxyHandler.php
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/ProxyHandler.php?rev=712376&r1=712375&r2=712376&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/ProxyHandler.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/ProxyHandler.php Sat Nov  8 
03:43:46 2008
@@ -89,10 +89,13 @@
                                                        // Try get author
                                                        if ($feed->author()) {
                                                                $author = 
$feed->author();
-                                                       } else 
+                                                       } else {
                                                                if 
($feed->creator()) {
                                                                        $author 
= $feed->creator();
+                                                               } else {
+                                                                       $author 
= null;
                                                                }
+                                                       }
                                                        // Loop over each 
channel item and store relevant data
                                                        $counter = 0;
                                                        $channel['Entry'] = 
array();
@@ -138,7 +141,9 @@
                                                                        
$channel['Link'] = $feed->link();
                                                                }
                                                        }
-                                                       $channel['Author'] = 
$author;
+                                                       if ($author != null) {
+                                                               
$channel['Author'] = $author;
+                                                       }
                                                } elseif ($feed instanceof 
Zend_Feed_Atom) {
                                                        // Try get author
                                                        $author = 
$feed->author() ? $feed->author() : '';
@@ -158,16 +163,18 @@
                                                                $date = 0;
                                                                if 
($entry->updated()) {
                                                                        $date = 
strtotime($entry->updated());
-                                                               } else 
+                                                               } else {
                                                                        if 
($entry->published()) {
                                                                                
$date = strtotime($entry->published());
                                                                        }
+                                                               }
                                                                $_entry['Date'] 
= $date;
-                                                               
                                                                
$channel['Entry'][] = $_entry;
                                                                // Remember 
author if first found
                                                                if 
(empty($author) && $entry->author()) {
                                                                        $author 
= $entry->author();
+                                                               } elseif 
(empty($author)) {
+                                                                       $author 
= null;
                                                                }
                                                                $counter ++;
                                                        }
@@ -175,7 +182,9 @@
                                                        $channel['URL'] = $url;
                                                        $channel['Description'] 
= $feed->subtitle();
                                                        $channel['Link'] = 
$feed->link('alternate');
-                                                       $channel['Author'] = 
$author;
+                                                       if (!empty($author)) {
+                                                               
$channel['Author'] = $author;
+                                                       }
                                                } else {
                                                        throw new 
Exception('Invalid feed type');
                                                }


Reply via email to