diff options
Diffstat (limited to 'views/rss/page')
-rw-r--r-- | views/rss/page/components/creator.php | 14 | ||||
-rw-r--r-- | views/rss/page/components/gallery.php | 8 | ||||
-rw-r--r-- | views/rss/page/components/georss.php | 15 | ||||
-rw-r--r-- | views/rss/page/components/image_block.php | 7 | ||||
-rw-r--r-- | views/rss/page/components/list.php | 14 | ||||
-rw-r--r-- | views/rss/page/default.php | 46 | ||||
-rw-r--r-- | views/rss/page/elements/comments.php | 13 | ||||
-rw-r--r-- | views/rss/page/layouts/default.php | 5 |
8 files changed, 122 insertions, 0 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/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 |