]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - actions/publicrss.php
Merge branch '0.8.x' into 0.9.x
[quix0rs-gnu-social.git] / actions / publicrss.php
1 <?php
2
3 /**
4  * Public RSS action class.
5  *
6  * PHP version 5
7  *
8  * @category Action
9  * @package  StatusNet
10  * @author   Evan Prodromou <evan@status.net>
11  * @author   Robin Millette <millette@status.net>
12  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
13  * @link     http://status.net/
14  *
15  * StatusNet - the distributed open-source microblogging tool
16  * Copyright (C) 2008, 2009, StatusNet, Inc.
17  *
18  * This program is free software: you can redistribute it and/or modify
19  * it under the terms of the GNU Affero General Public License as published by
20  * the Free Software Foundation, either version 3 of the License, or
21  * (at your option) any later version.
22  *
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26  * GNU Affero General Public License for more details.
27  *
28  * You should have received a copy of the GNU Affero General Public License
29  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
30  */
31
32 if (!defined('STATUSNET') && !defined('LACONICA')) {
33     exit(1);
34 }
35
36 require_once INSTALLDIR.'/lib/rssaction.php';
37
38 /**
39  * RSS feed for public timeline.
40  *
41  * Formatting of RSS handled by Rss10Action
42  *
43  * @category Action
44  * @package  StatusNet
45  * @author   Evan Prodromou <evan@status.net>
46  * @author   Robin Millette <millette@status.net>
47  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
48  * @link     http://status.net/
49  */
50 class PublicrssAction extends Rss10Action
51 {
52     /**
53      * Read arguments and initialize members
54      *
55      * @param array $args Arguments from $_REQUEST
56      * @return boolean success
57      */
58
59     function prepare($args)
60     {
61         parent::prepare($args);
62         $this->notices = $this->getNotices($this->limit);
63         return true;
64     }
65
66     /**
67      * Initialization.
68      *
69      * @return boolean true
70      */
71     function init()
72     {
73         return true;
74     }
75
76     /**
77      * Get notices
78      *
79      * @param integer $limit max number of notices to return
80      *
81      * @return array notices
82      */
83     function getNotices($limit=0)
84     {
85         $notices = array();
86         $notice  = Notice::publicStream(0, ($limit == 0) ? 48 : $limit);
87         while ($notice->fetch()) {
88             $notices[] = clone($notice);
89         }
90
91         return $notices;
92     }
93
94      /**
95      * Get channel.
96      *
97      * @return array associative array on channel information
98      */
99     function getChannel()
100     {
101         $c = array(
102               'url' => common_local_url('publicrss')
103             , 'title' => sprintf(_('%s public timeline'), common_config('site', 'name'))
104             , 'link' => common_local_url('public')
105             , 'description' => sprintf(_('%s updates from everyone!'), common_config('site', 'name')));
106         return $c;
107     }
108
109     /**
110      * Get image.
111      *
112      * @return nothing
113     */
114     function getImage()
115     {
116         // nop
117     }
118
119     function isReadOnly($args)
120     {
121         return true;
122     }
123 }
124