3 * Laconica, the distributed open-source microblogging tool
5 * Widget for showing a list of feeds
9 * LICENCE: This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Affero General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Affero General Public License for more details.
19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 * @author Evan Prodromou <evan@controlyourself.ca>
25 * @author Sarven Capadisli <csarven@controlyourself.ca>
26 * @copyright 2008 Control Yourself, Inc.
27 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
28 * @link http://laconi.ca/
31 if (!defined('LACONICA')) {
36 * Widget for showing a list of feeds
38 * Typically used for Action::showExportList()
42 * @author Evan Prodromou <evan@controlyourself.ca>
43 * @author Sarven Capadisli <csarven@controlyourself.ca>
44 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
45 * @link http://laconi.ca/
47 * @see Action::showExportList()
50 class FeedList extends Widget
54 function __construct($action=null)
56 parent::__construct($action);
57 $this->action = $action;
62 $this->out->elementStart('div', array('id' => 'export_data',
63 'class' => 'section'));
64 $this->out->element('h2', null, _('Export data'));
65 $this->out->elementStart('ul', array('class' => 'xoxo'));
67 foreach ($feeds as $key => $value) {
68 $this->feedItem($feeds[$key]);
71 $this->out->elementEnd('ul');
72 $this->out->elementEnd('div');
75 function feedItem($feed)
77 $nickname = $this->action->trimmed('nickname');
79 switch($feed['item']) {
80 case 'notices': default:
81 $feed_classname = $feed['type'];
82 $feed_mimetype = "application/".$feed['type']."+xml";
83 $feed_title = "$nickname's ".$feed['version']." notice feed";
84 $feed['textContent'] = "RSS";
88 $feed_classname = $feed['type'];
89 $feed_mimetype = "application/".$feed['type']."+xml";
90 $feed_title = $feed['version']." feed for $nickname and friends";
91 $feed['textContent'] = "RSS";
95 $feed_classname = $feed['type'];
96 $feed_mimetype = "application/".$feed['type']."+xml";
97 $feed_title = $feed['version']." feed for replies to $nickname";
98 $feed['textContent'] = "RSS";
102 $feed_classname = $feed['type'];
103 $feed_mimetype = "application/".$feed['type']."+xml";
104 $feed_title = "Public timeline ".$feed['version']." feed";
105 $feed['textContent'] = "RSS";
109 $feed_classname = "atom";
110 $feed_mimetype = "application/".$feed['type']."+xml";
111 $feed_title = "Public timeline ".$feed['version']." feed";
112 $feed['textContent'] = "Atom";
116 $feed_classname = $feed['type'];
117 $feed_mimetype = "application/".$feed['type']."+xml";
118 $feed_title = $feed['version']." feed for this tag";
119 $feed['textContent'] = "RSS";
123 $feed_classname = $feed['type'];
124 $feed_mimetype = "application/".$feed['type']."+xml";
125 $feed_title = "Favorited ".$feed['version']." feed";
126 $feed['textContent'] = "RSS";
130 $feed_classname = "foaf";
131 $feed_mimetype = "application/".$feed['type']."+xml";
132 $feed_title = "$nickname's FOAF file";
133 $feed['textContent'] = "FOAF";
137 $feed_classname = "favorites";
138 $feed_mimetype = "application/".$feed['type']."+xml";
139 $feed_title = "Feed for favorites of $nickname";
140 $feed['textContent'] = "RSS";
144 $feed_classname = "atom";
145 $feed_mimetype = "application/".$feed['type']."+xml";
146 $feed_title = "$nickname's ".$feed['version']." notice feed";
147 $feed['textContent'] = "Atom";
150 $this->out->elementStart('li');
151 $this->out->element('a', array('href' => $feed['href'],
152 'class' => $feed_classname,
153 'type' => $feed_mimetype,
154 'title' => $feed_title),
155 $feed['textContent']);
156 $this->out->elementEnd('li');