3 * StatusNet, the distributed open-source microblogging tool
5 * Action for displaying the public stream
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@status.net>
25 * @copyright 2008-2009 StatusNet, Inc.
26 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
27 * @link http://status.net/
30 if (!defined('GNUSOCIAL')) { exit(1); }
33 * Action for displaying the public stream
37 * @author Evan Prodromou <evan@status.net>
38 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
39 * @link http://status.net/
41 * @see PublicrssAction
42 * @see PublicxrdsAction
44 class PublicAction extends SitestreamAction
46 protected function streamPrepare()
48 if ($this->scoped instanceof Profile && $this->scoped->isLocal() && $this->scoped->getUser()->streamModeOnly()) {
49 $this->stream = new PublicNoticeStream($this->scoped);
51 $this->stream = new ThreadingPublicNoticeStream($this->scoped);
58 * @return page title, including page number if over 1
62 if ($this->page > 1) {
63 // TRANS: Title for all public timeline pages but the first.
64 // TRANS: %d is the page number.
65 return sprintf(_('Public timeline, page %d'), $this->page);
67 // TRANS: Title for the first public timeline page.
68 return _('Public timeline');
75 $this->element('meta', array('http-equiv' => 'X-XRDS-Location',
76 'content' => common_local_url('publicxrds')));
79 function showSections()
81 // Show invite button, as long as site isn't closed, and
82 // we have a logged in user.
83 if (common_config('invite', 'enabled') && !common_config('site', 'closed') && common_logged_in()) {
84 if (!common_config('site', 'private')) {
85 $ibs = new InviteButtonSection(
87 // TRANS: Button text for inviting more users to the StatusNet instance.
88 // TRANS: Less business/enterprise-oriented language for public sites.
89 _m('BUTTON', 'Send invite')
92 $ibs = new InviteButtonSection($this);
97 $p = Profile::current();
99 if (!common_config('performance', 'high')) {
100 $cloud = new PublicTagCloudSection($this);
103 $feat = new FeaturedUsersSection($this);
108 * Output <head> elements for RSS and Atom feeds
114 return array(new Feed(Feed::JSON,
115 common_local_url('ApiTimelinePublic',
116 array('format' => 'as')),
117 // TRANS: Link description for public timeline feed.
118 _('Public Timeline Feed (Activity Streams JSON)')),
119 new Feed(Feed::RSS1, common_local_url('publicrss'),
120 // TRANS: Link description for public timeline feed.
121 _('Public Timeline Feed (RSS 1.0)')),
123 common_local_url('ApiTimelinePublic',
124 array('format' => 'rss')),
125 // TRANS: Link description for public timeline feed.
126 _('Public Timeline Feed (RSS 2.0)')),
128 common_local_url('ApiTimelinePublic',
129 array('format' => 'atom')),
130 // TRANS: Link description for public timeline feed.
131 _('Public Timeline Feed (Atom)')));