]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - actions/publicrss.php
Merge branch 'master' into groups
[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  Laconica
10  * @author   Evan Prodromou <evan@controlyourself.ca>
11  * @author   Robin Millette <millette@controlyourself.ca>
12  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
13  * @link     http://laconi.ca/
14  *
15  * Laconica - a distributed open-source microblogging tool
16  * Copyright (C) 2008, Controlez-Vous, 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('LACONICA')) {
33     exit(1);
34 }
35
36 require_once INSTALLDIR.'/lib/rssaction.php';
37
38 /**
39  * Formatting of RSS handled by Rss10Action
40  *
41  * @category Action
42  * @package  Laconica
43  * @author   Evan Prodromou <evan@controlyourself.ca>
44  * @author   Robin Millette <millette@controlyourself.ca>
45  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
46  * @link     http://laconi.ca/
47  */
48 class PublicrssAction extends Rss10Action
49 {
50     /**
51      * Initialization.
52      * 
53      * @return boolean true
54      */
55     function init()
56     {
57         return true;
58     }
59
60     /**
61      * Get notices
62      *
63      * @param integer $limit max number of notices to return
64      *
65      * @return array notices
66      */
67     function getNotices($limit=0)
68     {
69         $notices = array();
70         $notice  = Notice::publicStream(0, ($limit == 0) ? 48 : $limit);
71         while ($notice->fetch()) {
72             $notices[] = clone($notice);
73         }
74         
75         return $notices;
76     }
77
78      /**
79      * Get channel.
80      *
81      * @return array associative array on channel information
82      */
83     function getChannel()
84     {
85         global $config;
86         $c = array(
87               'url' => common_local_url('publicrss')
88             , 'title' => sprintf(_('%s Public Stream'), $config['site']['name'])
89             , 'link' => common_local_url('public')
90             , 'description' => sprintf(_('All updates for %s'), $config['site']['name']));
91         return $c;
92     }
93
94     /**
95      * Get image.
96      *
97      * @return nothing
98     */
99     function getImage()
100     {
101         // nop
102     }
103 }
104