From fcc8efa279aab75419022bd8fc1b3134023c7806 Mon Sep 17 00:00:00 2001 From: nickw Date: Mon, 17 May 2010 20:12:55 +0000 Subject: Updating RSS feeds to use proper views called with page_shells. git-svn-id: http://code.elgg.org/elgg/trunk@6073 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/rss/object/default.php | 61 +++++++++++++++++++++----------------- views/rss/page_shells/default.php | 44 +++++++++++++++++++++++++++ views/rss/pageshells/pageshell.php | 44 --------------------------- views/rss/river/item/list.php | 50 ++++++++++++++----------------- 4 files changed, 99 insertions(+), 100 deletions(-) create mode 100644 views/rss/page_shells/default.php delete mode 100644 views/rss/pageshells/pageshell.php (limited to 'views') diff --git a/views/rss/object/default.php b/views/rss/object/default.php index 5d11599dc..7b1ab10bc 100644 --- a/views/rss/object/default.php +++ b/views/rss/object/default.php @@ -11,38 +11,43 @@ $title = $vars['entity']->title; if (empty($title)) { $subtitle = strip_tags($vars['entity']->description); - $title = substr($subtitle,0,32); + $title = substr($subtitle, 0, 32); if (strlen($subtitle) > 32) { - $title .= " ..."; + $title .= ' ...'; } } -?> +$permalink = htmlspecialchars($vars['entity']->getURL()); +$pubdate = date('r', $vars['entity']->time_created); +$creator = ''; +if ($owner = $vars['entity']->getOwnerEntity()) { + $creator = "{$owner->name}"; +} + +$georss = ''; +if ( + ($vars['entity'] instanceof Locatable) && + ($vars['entity']->getLongitude()) && + ($vars['entity']->getLatitude()) +) { + $latitude = $vars['entity']->getLatitude(); + $longitude = $vars['entity']->getLongitude(); + $georss = "$latitude $longitude"; +} + +$extension = elgg_view('extensions/item'); + +$item = <<<__HTML -getURL()); ?> -time_created) ?> -getURL()); ?> -<![CDATA[<?php echo $title; ?>]]> -description)); ?>]]> -getOwnerEntity(); - if ($owner) { -?> -name; ?> - -getLongitude()) && - ($vars['entity']->getLatitude()) - ) { - ?> - getLatitude(); ?> getLongitude(); ?> - - + $permalink + $pubdate + $permalink + <![CDATA[$title]]> + description}]]> + $creator$georss$extension + +__HTML; + +echo $item; diff --git a/views/rss/page_shells/default.php b/views/rss/page_shells/default.php new file mode 100644 index 000000000..c62ac4aac --- /dev/null +++ b/views/rss/page_shells/default.php @@ -0,0 +1,44 @@ +\n"; + +// Set 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']; +} + +// Remove RSS from URL +$url = str_replace('?view=rss','', full_url()); +$url = str_replace('&view=rss','', $url); + +?> + + > + + <![CDATA[<?php echo $title; ?>]]> + + + + + diff --git a/views/rss/pageshells/pageshell.php b/views/rss/pageshells/pageshell.php deleted file mode 100644 index c62ac4aac..000000000 --- a/views/rss/pageshells/pageshell.php +++ /dev/null @@ -1,44 +0,0 @@ -\n"; - -// Set 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']; -} - -// Remove RSS from URL -$url = str_replace('?view=rss','', full_url()); -$url = str_replace('&view=rss','', $url); - -?> - - > - - <![CDATA[<?php echo $title; ?>]]> - - - - - diff --git a/views/rss/river/item/list.php b/views/rss/river/item/list.php index 5ac43c544..8047c24bf 100644 --- a/views/rss/river/item/list.php +++ b/views/rss/river/item/list.php @@ -6,39 +6,33 @@ * @link http://elgg.org/ */ -if (isset($vars['items']) && is_array($vars['items'])) { - - $i = 0; - if (!empty($vars['items'])) { - foreach($vars['items'] as $item) { - - // echo elgg_view_river_item($item); - if (elgg_view_exists($item->view,'default')) { - $body = elgg_view($item->view,array('item' => $item),false,false,'default'); - $time = date("r",$item->posted); - if ($entity = get_entity($item->object_guid)) { - $url = htmlspecialchars($entity->getURL()); - } else { - $url = $vars['url']; - } - $title = strip_tags($body); - - ?> - - - - - <![CDATA[<?php echo $title; ?>]]> - ]]> - - view)) { + $body = elgg_view($item->view, array('item' => $item)); + $time = date('r', $item->posted); + if ($entity = get_entity($item->object_guid)) { + $url = htmlspecialchars($entity->getURL()); + } else { + $url = $vars['url']; } + $title = strip_tags($body); + + echo <<<__HTML + + $url + $time + <![CDATA[$title]]> + $url + + +__HTML; + $i++; if ($i >= $vars['limit']) { break; } } } -} \ No newline at end of file +} -- cgit v1.2.3