. * * @category Widget * @package Laconica * @author Evan Prodromou * @author Sarven Capadisli * @copyright 2008 Control Yourself, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://laconi.ca/ */ if (!defined('LACONICA')) { exit(1); } /** * Widget for showing a list of feeds * * Typically used for Action::showExportList() * * @category Widget * @package Laconica * @author Evan Prodromou * @author Sarven Capadisli * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://laconi.ca/ * * @see Action::showExportList() */ class FeedList extends Widget { var $action = null; function __construct($action=null) { parent::__construct($action); $this->action = $action; } function show($feeds) { $this->out->elementStart('div', array('id' => 'export_data', 'class' => 'section')); $this->out->element('h2', null, _('Export data')); $this->out->elementStart('ul', array('class' => 'xoxo')); foreach ($feeds as $key => $value) { $this->feedItem($feeds[$key]); } $this->out->elementEnd('ul'); $this->out->elementEnd('div'); } 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; case 'publicatom': $feed_classname = "atom"; $feed_mimetype = "application/".$feed['type']."+xml"; $feed_title = "Public timeline ".$feed['version']." feed"; $feed['textContent'] = "Atom"; break; case 'tagrss': $feed_classname = $feed['type']; $feed_mimetype = "application/".$feed['type']."+xml"; $feed_title = $feed['version']." feed for this tag"; $feed['textContent'] = "RSS"; 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"; 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->elementEnd('li'); } }