51
51
$image = new FeedImage();
52
52
$image->title = $conf['title'];
53
$image->url = DOKU_URL."lib/images/favicon.ico";
53
$image->url = tpl_getFavicon(true);
54
54
$image->link = DOKU_URL;
55
55
$rss->image = $image;
58
if($opt['feed_mode'] == 'list'){
59
$data = rssListNamespace($opt);
60
}elseif($opt['feed_mode'] == 'search'){
61
$data = rssSearch($opt);
58
$modes = array('list' => 'rssListNamespace',
59
'search' => 'rssSearch',
60
'recent' => 'rssRecentChanges');
61
if (isset($modes[$opt['feed_mode']])) {
62
$data = $modes[$opt['feed_mode']]($opt);
63
64
$eventData = array(
67
68
$event = new Doku_Event('FEED_MODE_UNKNOWN', $eventData);
68
69
if ($event->advise_before(true)) {
69
$data = rssRecentChanges($opt);
70
echo sprintf('<error>Unknown feed mode %s</error>', hsc($opt['feed_mode']));
71
73
$event->advise_after();
83
85
// ---------------------------------------------------------------- //
86
* Get URL parameters and config options and return a initialized option array
88
* Get URL parameters and config options and return an initialized option array
88
90
* @author Andreas Gohr <andi@splitbrain.org>
90
92
function rss_parseOptions(){
93
$opt['items'] = (int) $_REQUEST['num'];
94
$opt['feed_type'] = $_REQUEST['type'];
95
$opt['feed_mode'] = $_REQUEST['mode'];
96
$opt['show_minor'] = $_REQUEST['minor'];
97
$opt['namespace'] = $_REQUEST['ns'];
98
$opt['link_to'] = $_REQUEST['linkto'];
99
$opt['item_content'] = $_REQUEST['content'];
100
$opt['search_query'] = $_REQUEST['q'];
102
if(!$opt['feed_type']) $opt['feed_type'] = $conf['rss_type'];
103
if(!$opt['item_content']) $opt['item_content'] = $conf['rss_content'];
104
if(!$opt['link_to']) $opt['link_to'] = $conf['rss_linkto'];
105
if(!$opt['items']) $opt['items'] = $conf['recent'];
98
// Basic feed properties
99
// Plugins may probably want to add new values to these
100
// properties for implementing own feeds
102
// One of: list, search, recent
103
'feed_mode' => array('mode', 'recent'),
104
// One of: diff, page, rev, current
105
'link_to' => array('linkto', $conf['rss_linkto']),
106
// One of: abstract, diff, htmldiff, html
107
'item_content' => array('content', $conf['rss_content']),
109
// Special feed properties
110
// These are only used by certain feed_modes
112
// String, used for feed title, in list and rc mode
113
'namespace' => array('ns', null),
114
// Positive integer, only used in rc mode
115
'items' => array('num', $conf['recent']),
116
// Boolean, only used in rc mode
117
'show_minor' => array('minor', false),
118
// String, only used in search mode
119
'search_query' => array('q', null),
121
) as $name => $val) {
122
$opt[$name] = (isset($_REQUEST[$val[0]]) && !empty($_REQUEST[$val[0]]))
123
? $_REQUEST[$val[0]] : $val[1];
126
$opt['items'] = max(0, (int) $opt['items']);
127
$opt['show_minor'] = (bool) $opt['show_minor'];
106
129
$opt['guardmail'] = ($conf['mailguard'] != '' && $conf['mailguard'] != 'none');
108
switch ($opt['feed_type']){
131
$type = valid_input_set('type', array('rss','rss2','atom','atom1','rss1',
132
'default' => $conf['rss_type']),
110
136
$opt['feed_type'] = 'RSS0.91';
111
137
$opt['mime_type'] = 'text/xml';