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
43 class PublicAction extends SitestreamAction
45 protected function streamPrepare()
47 if ($this->scoped instanceof Profile && $this->scoped->isLocal() && $this->scoped->getUser()->streamModeOnly()) {
48 $this->stream = new PublicNoticeStream($this->scoped);
50 $this->stream = new ThreadingPublicNoticeStream($this->scoped);
57 * @return page title, including page number if over 1
61 if ($this->page > 1) {
62 // TRANS: Title for all public timeline pages but the first.
63 // TRANS: %d is the page number.
64 return sprintf(_('Public timeline, page %d'), $this->page);
66 // TRANS: Title for the first public timeline page.
67 return _('Public timeline');
71 function showSections()
73 // Show invite button, as long as site isn't closed, and
74 // we have a logged in user.
75 if (common_config('invite', 'enabled') && !common_config('site', 'closed') && common_logged_in()) {
76 if (!common_config('site', 'private')) {
77 $ibs = new InviteButtonSection(
79 // TRANS: Button text for inviting more users to the StatusNet instance.
80 // TRANS: Less business/enterprise-oriented language for public sites.
81 _m('BUTTON', 'Send invite')
84 $ibs = new InviteButtonSection($this);
89 $p = Profile::current();
91 if (!common_config('performance', 'high')) {
92 $cloud = new PublicTagCloudSection($this);
95 $feat = new FeaturedUsersSection($this);
100 * Output <head> elements for RSS and Atom feeds
106 return array(new Feed(Feed::JSON,
107 common_local_url('ApiTimelinePublic',
108 array('format' => 'as')),
109 // TRANS: Link description for public timeline feed.
110 _('Public Timeline Feed (Activity Streams JSON)')),
111 new Feed(Feed::RSS1, common_local_url('publicrss'),
112 // TRANS: Link description for public timeline feed.
113 _('Public Timeline Feed (RSS 1.0)')),
115 common_local_url('ApiTimelinePublic',
116 array('format' => 'rss')),
117 // TRANS: Link description for public timeline feed.
118 _('Public Timeline Feed (RSS 2.0)')),
120 common_local_url('ApiTimelinePublic',
121 array('format' => 'atom')),
122 // TRANS: Link description for public timeline feed.
123 _('Public Timeline Feed (Atom)')));