aboutsummaryrefslogtreecommitdiff
path: root/views/rss
diff options
context:
space:
mode:
Diffstat (limited to 'views/rss')
-rw-r--r--views/rss/annotation/generic_comment.php33
-rw-r--r--views/rss/group/default.php37
-rw-r--r--views/rss/object/default.php36
-rw-r--r--views/rss/output/url.php6
-rw-r--r--views/rss/page/components/creator.php14
-rw-r--r--views/rss/page/components/gallery.php8
-rw-r--r--views/rss/page/components/georss.php15
-rw-r--r--views/rss/page/components/image_block.php7
-rw-r--r--views/rss/page/components/list.php14
-rw-r--r--views/rss/page/default.php46
-rw-r--r--views/rss/page/elements/comments.php13
-rw-r--r--views/rss/page/layouts/default.php5
-rw-r--r--views/rss/river/item.php35
-rw-r--r--views/rss/user/default.php34
14 files changed, 303 insertions, 0 deletions
diff --git a/views/rss/annotation/generic_comment.php b/views/rss/annotation/generic_comment.php
new file mode 100644
index 000000000..de652fc8e
--- /dev/null
+++ b/views/rss/annotation/generic_comment.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Elgg RSS view for a generic_comment annotation
+ *
+ * @package Elgg
+ * @subpackage Core
+ */
+
+$annotation = $vars['annotation'];
+
+$poster = $annotation->getOwnerEntity();
+$poster_name = htmlspecialchars($poster->name, ENT_NOQUOTES, 'UTF-8');
+$pubdate = date('r', $annotation->getTimeCreated());
+$permalink = $annotation->getURL();
+
+$title = elgg_echo('generic_comment:title', array($poster_name));
+
+$creator = elgg_view('page/components/creator', array('entity' => $annotation));
+$extensions = elgg_view('extensions/item', $vars);
+
+$item = <<<__HTML
+<item>
+ <guid isPermaLink='true'>$permalink</guid>
+ <pubDate>$pubdate</pubDate>
+ <link>$permalink</link>
+ <title><![CDATA[$title]]></title>
+ <description><![CDATA[{$vars['annotation']->value}]]></description>
+ $creator$extensions
+</item>
+
+__HTML;
+
+echo $item;
diff --git a/views/rss/group/default.php b/views/rss/group/default.php
new file mode 100644
index 000000000..7fef4d434
--- /dev/null
+++ b/views/rss/group/default.php
@@ -0,0 +1,37 @@
+<?php
+/**
+ * RSS group view
+ *
+ * @package Elgg
+ * @subpackage Core
+ */
+
+$permalink = htmlspecialchars($vars['entity']->getURL(), ENT_NOQUOTES, 'UTF-8');
+$pubdate = date('r', $vars['entity']->getTimeCreated());
+$title = htmlspecialchars($vars['entity']->name, ENT_NOQUOTES, 'UTF-8');
+
+if ($vars['entity']->description) {
+ $description = elgg_autop($vars['entity']->description);
+} elseif ($vars['entity']->briefdescription) {
+ $description = elgg_autop($vars['entity']->briefdescription);
+} else {
+ $description = '';
+}
+
+$creator = elgg_view('page/components/creator', $vars);
+$georss = elgg_view('page/components/georss', $vars);
+$extension = elgg_view('extensions/item', $vars);
+
+$item = <<<__HTML
+<item>
+ <guid isPermaLink="true">$permalink</guid>
+ <pubDate>$pubdate</pubDate>
+ <link>$permalink</link>
+ <title><![CDATA[$title]]></title>
+ <description><![CDATA[$description]]></description>
+ $creator$georss$extension
+</item>
+
+__HTML;
+
+echo $item;
diff --git a/views/rss/object/default.php b/views/rss/object/default.php
new file mode 100644
index 000000000..8c7d5d8e0
--- /dev/null
+++ b/views/rss/object/default.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * RSS object view
+ *
+ * @package Elgg
+ * @subpackage Core
+ */
+
+$title = $vars['entity']->title;
+if (empty($title)) {
+ $title = strip_tags($vars['entity']->description);
+ $title = elgg_get_excerpt($title, 32);
+}
+
+$permalink = htmlspecialchars($vars['entity']->getURL(), ENT_NOQUOTES, 'UTF-8');
+$pubdate = date('r', $vars['entity']->getTimeCreated());
+
+$description = elgg_autop($vars['entity']->description);
+
+$creator = elgg_view('page/components/creator', $vars);
+$georss = elgg_view('page/components/georss', $vars);
+$extension = elgg_view('extensions/item', $vars);
+
+$item = <<<__HTML
+<item>
+ <guid isPermaLink="true">$permalink</guid>
+ <pubDate>$pubdate</pubDate>
+ <link>$permalink</link>
+ <title><![CDATA[$title]]></title>
+ <description><![CDATA[$description]]></description>
+ $creator$georss$extension
+</item>
+
+__HTML;
+
+echo $item;
diff --git a/views/rss/output/url.php b/views/rss/output/url.php
new file mode 100644
index 000000000..b0f4d9792
--- /dev/null
+++ b/views/rss/output/url.php
@@ -0,0 +1,6 @@
+<?php
+/**
+ * RSS url output view
+ *
+ */
+echo elgg_view('output/url', $vars, false, false, 'default');
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/gallery.php b/views/rss/page/components/gallery.php
new file mode 100644
index 000000000..690416e5b
--- /dev/null
+++ b/views/rss/page/components/gallery.php
@@ -0,0 +1,8 @@
+<?php
+/*
+ * RSS gallery view
+ *
+ * @uses $vars['items']
+ */
+
+echo elgg_view('page/components/list', $vars);
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/components/image_block.php b/views/rss/page/components/image_block.php
new file mode 100644
index 000000000..ff94bcff2
--- /dev/null
+++ b/views/rss/page/components/image_block.php
@@ -0,0 +1,7 @@
+<?php
+/**
+ * RSS image block view
+ *
+ * Only display the body
+ */
+echo $vars['body']; \ No newline at end of file
diff --git a/views/rss/page/components/list.php b/views/rss/page/components/list.php
new file mode 100644
index 000000000..2650fc006
--- /dev/null
+++ b/views/rss/page/components/list.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ * RSS list view
+ *
+ * @uses $vars['items']
+ */
+
+$items = $vars['items'];
+
+if (is_array($items) && sizeof($items) > 0) {
+ foreach ($items as $item) {
+ echo elgg_view_list_item($item, $vars);
+ }
+} \ No newline at end of file
diff --git a/views/rss/page/default.php b/views/rss/page/default.php
new file mode 100644
index 000000000..a7b757760
--- /dev/null
+++ b/views/rss/page/default.php
@@ -0,0 +1,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;
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);
diff --git a/views/rss/page/layouts/default.php b/views/rss/page/layouts/default.php
new file mode 100644
index 000000000..7f3ddebbd
--- /dev/null
+++ b/views/rss/page/layouts/default.php
@@ -0,0 +1,5 @@
+<?php
+/**
+ * RSS layout shell
+ */
+echo $vars['content']; \ No newline at end of file
diff --git a/views/rss/river/item.php b/views/rss/river/item.php
new file mode 100644
index 000000000..fa2914eff
--- /dev/null
+++ b/views/rss/river/item.php
@@ -0,0 +1,35 @@
+<?php
+/**
+ * RSS river view
+ *
+ * @uses $vars['item']
+ */
+$item = $vars['item'];
+
+$name = $item->getSubjectEntity()->name;
+$name = htmlspecialchars($name, ENT_NOQUOTES, 'UTF-8');
+$title = elgg_echo('river:update', array($name));
+
+$timestamp = date('r', $item->getPostedTime());
+$body = elgg_view('river/elements/summary', $vars, false, false, 'default');
+
+
+$object = $item->getObjectEntity();
+if ($object) {
+ $url = htmlspecialchars($object->getURL());
+} else {
+ $url = elgg_normalize_url('activity');
+}
+
+$html = <<<__HTML
+<item>
+ <guid>$item->id</guid>
+ <pubDate>$timestamp</pubDate>
+ <link>$url</link>
+ <title><![CDATA[$title]]></title>
+ <description><![CDATA[$body]]></description>
+</item>
+
+__HTML;
+
+echo $html;
diff --git a/views/rss/user/default.php b/views/rss/user/default.php
new file mode 100644
index 000000000..92c9427b2
--- /dev/null
+++ b/views/rss/user/default.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * RSS user view
+ *
+ * @package Elgg
+ * @subpackage Core
+ */
+
+$permalink = htmlspecialchars($vars['entity']->getURL(), ENT_NOQUOTES, 'UTF-8');
+$pubdate = date('r', $vars['entity']->getTimeCreated());
+$title = htmlspecialchars($vars['entity']->name, ENT_NOQUOTES, 'UTF-8');
+
+if ($vars['entity']->description) {
+ $description = elgg_autop($vars['entity']->description);
+} else {
+ $description = '';
+}
+
+$georss = elgg_view('page/components/georss', $vars);
+$extension = elgg_view('extensions/item', $vars);
+
+$item = <<<__HTML
+<item>
+ <guid isPermaLink="true">$permalink</guid>
+ <pubDate>$pubdate</pubDate>
+ <link>$permalink</link>
+ <title><![CDATA[$title]]></title>
+ <description><![CDATA[$description]]></description>
+ $georss$extension
+</item>
+
+__HTML;
+
+echo $item;