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()
54 function __construct($out=null)
61 $this->out->elementStart('div', array('class' => 'feeds'));
62 $this->out->element('p', null, 'Feeds:');
63 $this->out->elementStart('ul', array('class' => 'xoxo'));
65 foreach ($feeds as $key => $value) {
66 $this->feedItem($feeds[$key]);
69 $this->out->elementEnd('ul');
70 $this->out->elementEnd('div');
73 function feedItem($feed)
75 $nickname = $this->trimmed('nickname');
77 switch($feed['item']) {
78 case 'notices': default:
79 $feed_classname = $feed['type'];
80 $feed_mimetype = "application/".$feed['type']."+xml";
81 $feed_title = "$nickname's ".$feed['version']." notice feed";
82 $feed['textContent'] = "RSS";
86 $feed_classname = $feed['type'];
87 $feed_mimetype = "application/".$feed['type']."+xml";
88 $feed_title = $feed['version']." feed for $nickname and friends";
89 $feed['textContent'] = "RSS";
93 $feed_classname = $feed['type'];
94 $feed_mimetype = "application/".$feed['type']."+xml";
95 $feed_title = $feed['version']." feed for replies to $nickname";
96 $feed['textContent'] = "RSS";
100 $feed_classname = $feed['type'];
101 $feed_mimetype = "application/".$feed['type']."+xml";
102 $feed_title = "Public timeline ".$feed['version']." feed";
103 $feed['textContent'] = "RSS";
107 $feed_classname = "atom";
108 $feed_mimetype = "application/".$feed['type']."+xml";
109 $feed_title = "Public timeline ".$feed['version']." feed";
110 $feed['textContent'] = "Atom";
114 $feed_classname = $feed['type'];
115 $feed_mimetype = "application/".$feed['type']."+xml";
116 $feed_title = $feed['version']." feed for this tag";
117 $feed['textContent'] = "RSS";
121 $feed_classname = $feed['type'];
122 $feed_mimetype = "application/".$feed['type']."+xml";
123 $feed_title = "Favorited ".$feed['version']." feed";
124 $feed['textContent'] = "RSS";
128 $feed_classname = "foaf";
129 $feed_mimetype = "application/".$feed['type']."+xml";
130 $feed_title = "$nickname's FOAF file";
131 $feed['textContent'] = "FOAF";
135 $feed_classname = "favorites";
136 $feed_mimetype = "application/".$feed['type']."+xml";
137 $feed_title = "Feed for favorites of $nickname";
138 $feed['textContent'] = "RSS";
142 $feed_classname = "atom";
143 $feed_mimetype = "application/".$feed['type']."+xml";
144 $feed_title = "$nickname's ".$feed['version']." notice feed";
145 $feed['textContent'] = "Atom";
148 $this->out->elementStart('li');
149 $this->out->element('a', array('href' => $feed['href'],
150 'class' => $feed_classname,
151 'type' => $feed_mimetype,
152 'title' => $feed_title),
153 $feed['textContent']);
154 $this->out->elementEnd('li');