[geeklog-cvs] geeklog: Be a little more forgiving with RSS feeds that have no ...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Jan 8 11:15:08 EST 2011


changeset 8041:7ab2ea2a6881
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/7ab2ea2a6881
user: Dirk Haun <dirk at haun-online.de>
date: Sat Jan 08 14:11:45 2011 +0100
description:
Be a little more forgiving with RSS feeds that have no link but only a guid for the item: if the guid is not permanent but looks like a URL, accept it anyway

diffstat:

 system/classes/syndication/rss.feed.class.php |  17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diffs (27 lines):

diff -r 1274b6100895 -r 7ab2ea2a6881 system/classes/syndication/rss.feed.class.php
--- a/system/classes/syndication/rss.feed.class.php	Fri Jan 07 14:22:34 2011 -0500
+++ b/system/classes/syndication/rss.feed.class.php	Sat Jan 08 14:11:45 2011 +0100
@@ -440,10 +440,19 @@
       {
         $this->_inItem = false;
         $this->articles[] = $this->_currentItem;
-      } elseif( $name == 'GUID' && $this->_permaLink ) {
-        /* if we have a guid that is ALSO a permalink, override link with it */
-        $this->_currentItem['link'] = $this->_currentItem['guid'];
-        $this->_linkGUID = true;
+      } elseif ($name == 'GUID') {
+        if ($this->_permaLink) {
+          // if we have a guid that is ALSO a permalink, override link with it
+          $this->_currentItem['link'] = $this->_currentItem['guid'];
+          $this->_linkGUID = true;
+        } elseif (empty($this->_currentItem['link']) &&
+                  substr($this->_currentItem['guid'], 0, 4) == 'http') {
+          /* this is NOT according to spec: if we don't have a link but the
+           * guid, despite being non-permanent, starts with http, use it instead
+           */
+          $this->_currentItem['link'] = $this->_currentItem['guid'];
+          $this->_linkGUID = true;
+        }
       }
       $this->_currentTag = '';
     }



More information about the geeklog-cvs mailing list