3 * Laconica - a distributed open-source microblogging tool
4 * Copyright (C) 2008, Controlez-Vous, Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 if (!defined('LACONICA')) { exit(1); }
22 class TagAction extends Action
24 function prepare($args)
26 parent::prepare($args);
27 $this->tag = $this->trimmed('tag');
30 common_redirect(common_local_url('publictagcloud'), 301);
34 $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
40 if ($this->page == 1) {
41 return sprintf(_("Notices tagged with %s"), $this->tag);
43 return sprintf(_("Notices tagged with %s, page %d"),
49 function handle($args)
51 parent::handle($args);
58 $this->element('link', array('rel' => 'alternate',
59 'href' => common_local_url('tagrss', array('tag' => $this->tag)),
60 'type' => 'application/rss+xml',
61 'title' => sprintf(_('Feed for tag %s'), $this->tag)));
64 function showPageNotice()
66 return sprintf(_('Messages tagged "%s", most recent first'), $this->tag);
69 function showExportData()
71 $fl = new FeedList($this);
72 $fl->show(array(0=>array('href'=>common_local_url('tagrss', array('tag' => $this->tag)),
74 'version' => 'RSS 1.0',
75 'item' => 'tagrss')));
78 function showContent()
80 $notice = Notice_tag::getStream($this->tag, (($this->page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1);
82 $nl = new NoticeList($notice, $this);
86 $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
87 $this->page, 'tag', array('tag' => $this->tag));