aboutsummaryrefslogtreecommitdiff
path: root/views/rss/page/default.php
blob: a7b757760f1b5b5256ac20411e75f69751c10a13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
 * Elgg RSS output pageshell
 *
 * @package Elgg.Core
 *
 * @uses $vars['title']      The title of the RSS feed
 * @uses $vars['body']       The items for the RSS feed as a string
 * @uses $vars['descrption'] The description for the RSS feed
 */

// Set title
if (empty($vars['title'])) {
	$title = elgg_get_config('sitename');
} else {
	$title = elgg_get_config('sitename') . ": " . $vars['title'];
}

// Remove RSS from URL
$url = str_replace('?view=rss', '', current_page_url());
$url = str_replace('&view=rss', '', $url);
$url = htmlspecialchars($url, ENT_NOQUOTES, 'UTF-8');

$body = elgg_extract('body', $vars, '');
$description = elgg_extract('description', $vars, '');

$namespaces = elgg_view('extensions/xmlns');
$extensions = elgg_view('extensions/channel');


// allow caching as required by stupid MS products for https feeds.
header('Pragma: public', true);
header("Content-Type: text/xml");

echo "<?xml version='1.0'?>";
echo <<<END
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" $namespaces>
<channel>
	<title><![CDATA[$title]]></title>
	<link>$url</link>
	<description><![CDATA[$description]]></description>
	$extensions
	$body
</channel>
</rss>
END;