aboutsummaryrefslogtreecommitdiff
path: root/views/rss/page
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2011-11-18 07:32:27 +0100
committerSem <sembrestels@riseup.net>2011-11-18 07:32:27 +0100
commite53d410129701ea1c9d19529afa493f11b5f5b70 (patch)
treed9963b24bf8932654b4a47e36602c75975e50dba /views/rss/page
parent377da25d2965c64941f83baae119fc970ec60982 (diff)
parent08a962c98e2923724f8013d6eaae89101243752a (diff)
downloadelgg-e53d410129701ea1c9d19529afa493f11b5f5b70.tar.gz
elgg-e53d410129701ea1c9d19529afa493f11b5f5b70.tar.bz2
Merge github.com:Elgg/Elgg
Conflicts: engine/lib/input.php
Diffstat (limited to 'views/rss/page')
-rw-r--r--views/rss/page/components/creator.php14
-rw-r--r--views/rss/page/components/georss.php15
-rw-r--r--views/rss/page/default.php45
-rw-r--r--views/rss/page/elements/comments.php13
4 files changed, 67 insertions, 20 deletions
diff --git a/views/rss/page/components/creator.php b/views/rss/page/components/creator.php
new file mode 100644
index 000000000..a14f1dbca
--- /dev/null
+++ b/views/rss/page/components/creator.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ * Creator view
+ *
+ * Implements Dublin Core creator
+ *
+ * @uses $vars['entity']
+ */
+
+$owner = $vars['entity']->getOwnerEntity();
+if ($owner) {
+ $owner_name = htmlspecialchars($owner->name, ENT_NOQUOTES, 'UTF-8');
+ echo "<dc:creator>$owner_name</dc:creator>";
+}
diff --git a/views/rss/page/components/georss.php b/views/rss/page/components/georss.php
new file mode 100644
index 000000000..d176b8cac
--- /dev/null
+++ b/views/rss/page/components/georss.php
@@ -0,0 +1,15 @@
+<?php
+/**
+ * GeoRSS view
+ *
+ * This implements GeoRSS-Simple
+ *
+ * @uses $vars['entity']
+ */
+
+$longitude = $vars['entity']->getLongitude();
+$latitude = $vars['entity']->getLatitude();
+
+if ($vars['entity'] instanceof Locatable && $longitude && $latitude) {
+ echo "<georss:point>$latitude $longitude</georss:point>";
+}
diff --git a/views/rss/page/default.php b/views/rss/page/default.php
index da6f69c41..c973e3fd0 100644
--- a/views/rss/page/default.php
+++ b/views/rss/page/default.php
@@ -2,18 +2,13 @@
/**
* Elgg RSS output pageshell
*
- * @package Elgg
- * @subpackage Core
+ * @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
*/
-header("Content-Type: text/xml");
-
-// allow caching as required by stupid MS products for https feeds.
-header('Pragma: public', TRUE);
-
-echo "<?xml version='1.0'?>\n";
-
// Set title
if (empty($vars['title'])) {
$title = elgg_get_config('sitename');
@@ -22,20 +17,30 @@ if (empty($vars['title'])) {
}
// Remove RSS from URL
-$url = str_replace('?view=rss','', full_url());
-$url = str_replace('&view=rss','', $url);
+$url = str_replace('?view=rss', '', full_url());
+$url = str_replace('&view=rss', '', $url);
+$url = htmlspecialchars($url, ENT_NOQUOTES, 'UTF-8');
-?>
+$body = elgg_extract('body', $vars, '');
+$description = elgg_extract('description', $vars, '');
-<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" <?php echo elgg_view('extensions/xmlns'); ?> >
-<channel>
- <title><![CDATA[<?php echo $title; ?>]]></title>
- <link><?php echo htmlentities($url); ?></link>
- <?php echo elgg_view('extensions/channel'); ?>
- <?php
+$namespaces = elgg_view('extensions/xmlns');
+$extensions = elgg_view('extensions/channel');
- echo $vars['body'];
- ?>
+// 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;
diff --git a/views/rss/page/elements/comments.php b/views/rss/page/elements/comments.php
new file mode 100644
index 000000000..9c655ffef
--- /dev/null
+++ b/views/rss/page/elements/comments.php
@@ -0,0 +1,13 @@
+<?php
+/**
+ * RSS comments view
+ *
+ * @uses $vars['entity']
+ */
+
+$options = array(
+ 'guid' => $vars['entity']->getGUID(),
+ 'annotation_name' => 'generic_comment',
+ 'order_by' => 'n_table.time_created desc',
+);
+echo elgg_list_annotations($options);