aboutsummaryrefslogtreecommitdiff
path: root/views/rss/object
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2011-11-26 16:35:25 -0500
committerCash Costello <cash.costello@gmail.com>2011-11-26 16:35:25 -0500
commitca5a35607dfb277cecba120ce27eece7c59f270a (patch)
tree301e5b6fb94a2521f18ce926e69e659fe4e4fa54 /views/rss/object
parent22afb49f30fc9bcd6be84f734e89a9b644f2fb0f (diff)
downloadelgg-ca5a35607dfb277cecba120ce27eece7c59f270a.tar.gz
elgg-ca5a35607dfb277cecba120ce27eece7c59f270a.tar.bz2
fixed RSS feeds for Elgg 1.8
Diffstat (limited to 'views/rss/object')
-rw-r--r--views/rss/object/album.php64
-rw-r--r--views/rss/object/album/full.php16
-rw-r--r--views/rss/object/album/summary.php33
-rw-r--r--views/rss/object/file.php23
-rw-r--r--views/rss/object/image.php57
5 files changed, 99 insertions, 94 deletions
diff --git a/views/rss/object/album.php b/views/rss/object/album.php
index 8df98cf7a..0c4606245 100644
--- a/views/rss/object/album.php
+++ b/views/rss/object/album.php
@@ -1,59 +1,15 @@
<?php
- /**
- * Tidypics Album RSS View
- */
+/**
+ * Album RSS view
+ *
+ * @uses $vars['entity'] TidypicsAlbum
+ */
-// for now catch the albums view and ignore it
-if (get_context() == "search" && get_input('search_viewtype') == "gallery") {
-?>
- <item>
- <guid isPermaLink='true'><?php echo $vars['entity']->getURL(); ?></guid>
- <pubDate><?php echo date("r",$vars['entity']->time_created) ?></pubDate>
- <link><?php echo $vars['entity']->getURL(); ?></link>
- <title><![CDATA[<?php echo $vars['entity']->title; ?>]]></title>
- <description><![CDATA[<?php echo (autop($vars['entity']->description)); ?>]]></description>
- </item>
-<?php
-} else {
-
- $album = $vars['entity'];
-
- // use fullsize image
- $base_url_fullsize = $vars['url'] . 'pg/photos/download/';
-
- $album_cover_guid = $album->getCoverImageGuid();
- if ($album_cover_guid) {
- // Set title
- $vars['title'] = $album->title;
- if (empty($vars['title'])) {
- $title = $vars['config']->sitename;
- } else if (empty($vars['config']->sitename)) {
- $title = $vars['title'];
- } else {
- $title = $vars['config']->sitename . ": " . $vars['title'];
- }
- $album_cover_url = $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $album_cover_guid . '&amp;size=thumb';
-?> <image>
- <url><?php echo $album_cover_url; ?></url>
- <title><![CDATA[<?php echo $title; ?>]]></title>
- <link><?php echo $album->getURL() . '?view=rss'; ?></link>
- </image>
-<?php
- }
-
- $limit = get_input('limit', 20);
-
- $images = elgg_get_entities(array(
- "type" => "object",
- "subtype" => "image",
- "container_guid" => $album->guid,
- "limit" => $limit,
- ));
-
-
- foreach ($images as $image) {
- echo elgg_view_entity($image);
- }
+$full_view = elgg_extract('full_view', $vars, false);
+if ($full_view) {
+ echo elgg_view('object/album/full', $vars);
+} else {
+ echo elgg_view('object/album/summary', $vars);
}
diff --git a/views/rss/object/album/full.php b/views/rss/object/album/full.php
new file mode 100644
index 000000000..8261e5ce0
--- /dev/null
+++ b/views/rss/object/album/full.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * List photos in an album for RSS
+ *
+ * @uses $vars['entity'] TidypicsAlbum
+ */
+
+$limit = (int)get_input('limit', 20);
+
+echo elgg_list_entities(array(
+ 'type' => 'object',
+ 'subtype' => 'image',
+ 'container_guid' => $vars['entity']->getGUID(),
+ 'limit' => $limit,
+ 'full_view' => false,
+));
diff --git a/views/rss/object/album/summary.php b/views/rss/object/album/summary.php
new file mode 100644
index 000000000..b6dc8f003
--- /dev/null
+++ b/views/rss/object/album/summary.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Individual album summary view for RSS
+ *
+ * @uses $vars['entity'] TidypicsAlbum
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
+
+$permalink = htmlspecialchars($vars['entity']->getURL(), ENT_NOQUOTES, 'UTF-8');
+$pubdate = date('r', $vars['entity']->getTimeCreated());
+
+$title = $vars['entity']->getTitle();
+$description = 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/object/file.php b/views/rss/object/file.php
deleted file mode 100644
index 1ede661ad..000000000
--- a/views/rss/object/file.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-/**
- * Tidypics RSS file object view - need to look into removing download link based on settings
- */
-
-$title = $vars['entity']->title;
-if (empty($title)) {
- $title = substr($vars['entity']->description,0,32);
- if (strlen($vars['entity']->description) > 32) {
- $title .= " ...";
- }
-}
-?>
-
- <item>
- <guid isPermaLink='true'><?php echo $vars['entity']->getURL(); ?></guid>
- <pubDate><?php echo date("r",$vars['entity']->time_created) ?></pubDate>
- <link><?php echo $vars['entity']->getURL(); ?></link>
- <title><![CDATA[<?php echo $title; ?>]]></title>
- <description><![CDATA[<?php echo (autop($vars['entity']->description)); ?>]]></description>
- <enclosure url="<?php echo $vars['url']; ?>pg/photos/download/<?php echo $vars['entity']->getGUID(); ?>/" length="<?php echo $vars['entity']->size(); ?>" type="<?php echo $vars['entity']->getMimeType(); ?>" />
- </item>
diff --git a/views/rss/object/image.php b/views/rss/object/image.php
index b93592081..a59021bd1 100644
--- a/views/rss/object/image.php
+++ b/views/rss/object/image.php
@@ -1,19 +1,42 @@
<?php
+/**
+ * Individual image RSS view
+ *
+ * @uses $vars['entity'] TidypicsImage
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
-$title = $vars['entity']->title;
-$descr = $vars['entity']->description;
-$download = $vars['url'] . 'pg/photos/download/' . $vars['entity']->guid . '/inline/';
-$base_url = $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=';
-?>
-
- <item>
- <title><?php echo $title; ?></title>
- <link><?php echo $base_url . $vars['entity']->guid . '&amp;size=large'; ?></link>
- <description><?php echo htmlentities($descr, ENT_QUOTES); ?></description>
- <pubDate><?php echo date("r", $vars['entity']->time_created); ?></pubDate>
- <guid isPermaLink="true"><?php echo $vars['entity']->getURL(); ?></guid>
- <media:content url="<?php echo $download; ?>" medium="image" type="<?php echo $vars['entity']->getMimeType(); ?>" />
- <media:title><?php echo $title; ?></media:title>
- <media:description><?php echo htmlentities($descr); ?></media:description>
- <media:thumbnail url="<?php echo $base_url . $vars['entity']->guid . '&amp;size=thumb'; ?>"></media:thumbnail>
- </item> \ No newline at end of file
+$permalink = htmlspecialchars($vars['entity']->getURL(), ENT_NOQUOTES, 'UTF-8');
+$pubdate = date('r', $vars['entity']->getTimeCreated());
+
+$title = $vars['entity']->getTitle();
+$description = autop($vars['entity']->description);
+
+$creator = elgg_view('page/components/creator', $vars);
+$georss = elgg_view('page/components/georss', $vars);
+$extension = elgg_view('extensions/item', $vars);
+
+$thumbnail_url = $vars['entity']->getSrcUrl('thumb');
+$download_url = $vars['entity']->getSrcUrl('large');
+
+$mime_type = $vars['entity']->getMimeType();
+
+$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
+ <media:content url="$download_url" medium="image" type="$mime_type" />
+ <media:title><![CDATA[$title]]></media:title>
+ <media:description><![CDATA[$description]]></media:description>
+ <media:thumbnail url="$thumbnail_url"></media:thumbnail>
+</item>
+
+__HTML;
+
+echo $item;