]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/feedlist.php
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing
[quix0rs-gnu-social.git] / lib / feedlist.php
index 47d909e969c1ac51986f7448e7c3996630ff4c7d..9ae83f5e886e00bac74c39dcbf06579c4ea8a229 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Laconica, the distributed open-source microblogging tool
+ * StatusNet, the distributed open-source microblogging tool
  *
  * Widget for showing a list of feeds
  *
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  * @category  Widget
- * @package   Laconica
- * @author    Evan Prodromou <evan@controlyourself.ca>
- * @author    Sarven Capadisli <csarven@controlyourself.ca>
- * @copyright 2008 Control Yourself, Inc.
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @author    Sarven Capadisli <csarven@status.net>
+ * @copyright 2008 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://laconi.ca/
+ * @link      http://status.net/
  */
 
-if (!defined('LACONICA')) {
+if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
@@ -38,11 +38,11 @@ if (!defined('LACONICA')) {
  * Typically used for Action::showExportList()
  *
  * @category Widget
- * @package  Laconica
- * @author   Evan Prodromou <evan@controlyourself.ca>
- * @author   Sarven Capadisli <csarven@controlyourself.ca>
+ * @package  StatusNet
+ * @author   Evan Prodromou <evan@status.net>
+ * @author   Sarven Capadisli <csarven@status.net>
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://laconi.ca/
+ * @link     http://status.net/
  *
  * @see      Action::showExportList()
  */
@@ -50,7 +50,7 @@ if (!defined('LACONICA')) {
 class FeedList extends Widget
 {
     var $action = null;
-    
+
     function __construct($action=null)
     {
        parent::__construct($action);
@@ -64,8 +64,8 @@ class FeedList extends Widget
         $this->out->element('h2', null, _('Export data'));
         $this->out->elementStart('ul', array('class' => 'xoxo'));
 
-        foreach ($feeds as $key => $value) {
-            $this->feedItem($feeds[$key]);
+        foreach ($feeds as $feed) {
+            $this->feedItem($feed);
         }
 
         $this->out->elementEnd('ul');
@@ -74,85 +74,27 @@ class FeedList extends Widget
 
     function feedItem($feed)
     {
-        $nickname = $this->action->trimmed('nickname');
-
-        switch($feed['item']) {
-         case 'notices': default:
-            $feed_classname = $feed['type'];
-            $feed_mimetype = "application/".$feed['type']."+xml";
-            $feed_title = "$nickname's ".$feed['version']." notice feed";
-            $feed['textContent'] = "RSS";
-            break;
-
-         case 'allrss':
-            $feed_classname = $feed['type'];
-            $feed_mimetype = "application/".$feed['type']."+xml";
-            $feed_title = $feed['version']." feed for $nickname and friends";
-            $feed['textContent'] = "RSS";
-            break;
-
-         case 'repliesrss':
-            $feed_classname = $feed['type'];
-            $feed_mimetype = "application/".$feed['type']."+xml";
-            $feed_title = $feed['version']." feed for replies to $nickname";
-            $feed['textContent'] = "RSS";
-            break;
-
-         case 'publicrss':
-            $feed_classname = $feed['type'];
-            $feed_mimetype = "application/".$feed['type']."+xml";
-            $feed_title = "Public timeline ".$feed['version']." feed";
-            $feed['textContent'] = "RSS";
-            break;
+        $classname = null;
 
-         case 'publicatom':
-            $feed_classname = "atom";
-            $feed_mimetype = "application/".$feed['type']."+xml";
-            $feed_title = "Public timeline ".$feed['version']." feed";
-            $feed['textContent'] = "Atom";
+        switch ($feed->type) {
+         case Feed::RSS1:
+         case Feed::RSS2:
+            $classname = 'rss';
             break;
-
-         case 'tagrss':
-            $feed_classname = $feed['type'];
-            $feed_mimetype = "application/".$feed['type']."+xml";
-            $feed_title = $feed['version']." feed for this tag";
-            $feed['textContent'] = "RSS";
+         case Feed::ATOM:
+            $classname = 'atom';
             break;
-
-         case 'favoritedrss':
-            $feed_classname = $feed['type'];
-            $feed_mimetype = "application/".$feed['type']."+xml";
-            $feed_title = "Favorited ".$feed['version']." feed";
-            $feed['textContent'] = "RSS";
-            break;
-
-         case 'foaf':
-            $feed_classname = "foaf";
-            $feed_mimetype = "application/".$feed['type']."+xml";
-            $feed_title = "$nickname's FOAF file";
-            $feed['textContent'] = "FOAF";
-            break;
-
-         case 'favoritesrss':
-            $feed_classname = "favorites";
-            $feed_mimetype = "application/".$feed['type']."+xml";
-            $feed_title = "Feed for favorites of $nickname";
-            $feed['textContent'] = "RSS";
-            break;
-
-         case 'usertimeline':
-            $feed_classname = "atom";
-            $feed_mimetype = "application/".$feed['type']."+xml";
-            $feed_title = "$nickname's ".$feed['version']." notice feed";
-            $feed['textContent'] = "Atom";
+         case Feed::FOAF:
+            $classname = 'foaf';
             break;
         }
+
         $this->out->elementStart('li');
-        $this->out->element('a', array('href' => $feed['href'],
-                                  'class' => $feed_classname,
-                                  'type' => $feed_mimetype,
-                                  'title' => $feed_title),
-                       $feed['textContent']);
+        $this->out->element('a', array('href' => $feed->url,
+                                       'class' => $classname,
+                                       'type' => $feed->mimeType(),
+                                       'title' => $feed->title),
+                            $feed->typeName());
         $this->out->elementEnd('li');
     }
 }