From e581440c3d17d3e316b890e2fec393d47006c862 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sun, 14 Jun 2009 10:13:12 -0700 Subject: Rename Rss_Controller::__call to Rss_Controller::feed, which changes the feed url to rss/feed//[] Where feed name is the name of the feed (i.e. albums, updates, comments, tags etc.) and id is the optional element id that the feed applies to. --- modules/rss/helpers/rss.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/rss/helpers') diff --git a/modules/rss/helpers/rss.php b/modules/rss/helpers/rss.php index 1d30425f..3c278b49 100644 --- a/modules/rss/helpers/rss.php +++ b/modules/rss/helpers/rss.php @@ -21,11 +21,11 @@ class rss_Core { static function item_feed($item) { $id = $item->is_album() ? $item->id : $item->parent_id; - return url::site("rss/albums/$id"); + return url::site("rss/feed/albums/$id"); } static function tag_feed($tag) { - return url::site("rss/tags/$tag->id}"); + return url::site("rss/feed/tags/$tag->id}"); } /** @@ -40,7 +40,7 @@ class rss_Core { if ($sidebar_only && !$feed["sidebar"]) { continue; } - $feeds[$feed["description"]] = url::site("rss/{$feed['uri']}"); + $feeds[$feed["description"]] = url::site("rss/feed/{$feed['uri']}"); } } } -- cgit v1.2.3 From b32670f0300b24ad8366d154c3b9a6853f9c710f Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sun, 14 Jun 2009 11:20:08 -0700 Subject: Rename: rss::get_feeds() -> rss::available_feeds() rss::process_feed() -> rss::feed_data() --- modules/rss/controllers/rss.php | 2 +- modules/rss/helpers/rss.php | 4 ++-- modules/rss/helpers/rss_theme.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'modules/rss/helpers') diff --git a/modules/rss/controllers/rss.php b/modules/rss/controllers/rss.php index 8cf083db..8c3544e4 100644 --- a/modules/rss/controllers/rss.php +++ b/modules/rss/controllers/rss.php @@ -27,7 +27,7 @@ class Rss_Controller extends Controller { url::redirect($feed_uri); } - $feed = rss::process_feed($method, ($page - 1) * self::$page_size, self::$page_size, $id); + $feed = rss::feed_data($method, ($page - 1) * self::$page_size, self::$page_size, $id); if ($feed->max_pages && $page > $feed->max_pages) { url::redirect("$feed_uri?page={$feed->max_pages}"); } diff --git a/modules/rss/helpers/rss.php b/modules/rss/helpers/rss.php index 3c278b49..cf42ec28 100644 --- a/modules/rss/helpers/rss.php +++ b/modules/rss/helpers/rss.php @@ -31,7 +31,7 @@ class rss_Core { /** * Get all available rss feeds */ - static function get_feeds($item, $sidebar_only=true) { + static function available_feeds($item, $sidebar_only=true) { $feeds = array(); foreach (module::active() as $module) { $class_name = "{$module->name}_rss"; @@ -48,7 +48,7 @@ class rss_Core { return $feeds; } - static function process_feed($feed, $offset, $limit, $id) { + static function feed_data($feed, $offset, $limit, $id) { foreach (module::active() as $module) { $class_name = "{$module->name}_rss"; if (method_exists($class_name, $feed)) { diff --git a/modules/rss/helpers/rss_theme.php b/modules/rss/helpers/rss_theme.php index b82133bd..0f12b475 100644 --- a/modules/rss/helpers/rss_theme.php +++ b/modules/rss/helpers/rss_theme.php @@ -40,7 +40,7 @@ class rss_theme_Core { $block->css_id = "gRss"; $block->title = t("Available RSS Feeds"); $block->content = new View("rss_block.html"); - $block->content->feeds = rss::get_feeds($theme->item()); + $block->content->feeds = rss::available_feeds($theme->item()); return $block; } -- cgit v1.2.3 From 484796e7cc54c3690462ee061850b563c4d5da16 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sun, 14 Jun 2009 11:39:53 -0700 Subject: Remove rss:item_feed, rss::tag_fead and rss_theme::head and move that functionality in the _theme::head function. Created rss::feed_link to wrap the module supplied uri in the html link element. --- modules/gallery/helpers/gallery_theme.php | 4 ++++ modules/rss/helpers/rss.php | 10 +++------- modules/rss/helpers/rss_theme.php | 12 ------------ modules/tag/helpers/tag_theme.php | 6 +++++- 4 files changed, 12 insertions(+), 20 deletions(-) (limited to 'modules/rss/helpers') diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php index f955e8f7..290434ed 100644 --- a/modules/gallery/helpers/gallery_theme.php +++ b/modules/gallery/helpers/gallery_theme.php @@ -42,6 +42,10 @@ class gallery_theme_Core { $buf .= html::script("modules/gallery/js/fullsize.js"); } + if ($theme->item()) { + $buf .= rss::feed_link("albums/{$theme->item()->id}"); + } + if ($session->get("l10n_mode", false)) { $buf .= ""; diff --git a/modules/rss/helpers/rss.php b/modules/rss/helpers/rss.php index cf42ec28..e4d6f5e9 100644 --- a/modules/rss/helpers/rss.php +++ b/modules/rss/helpers/rss.php @@ -19,13 +19,9 @@ */ class rss_Core { - static function item_feed($item) { - $id = $item->is_album() ? $item->id : $item->parent_id; - return url::site("rss/feed/albums/$id"); - } - - static function tag_feed($tag) { - return url::site("rss/feed/tags/$tag->id}"); + static function feed_link($uri) { + $url = url::site("rss/feed/$uri"); + return ""; } /** diff --git a/modules/rss/helpers/rss_theme.php b/modules/rss/helpers/rss_theme.php index 0f12b475..52d988bf 100644 --- a/modules/rss/helpers/rss_theme.php +++ b/modules/rss/helpers/rss_theme.php @@ -18,18 +18,6 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class rss_theme_Core { - static function head($theme) { - if ($theme->item()) { - $url = rss::item_feed($theme->item()); - } else if ($theme->tag()) { - $url = rss::tag_feed($theme->tag()); - } - - if (!empty($url)) { - return ""; - } - } - static function sidebar_blocks($theme) { // @todo this needs to be data driven if (!$theme->item()) { diff --git a/modules/tag/helpers/tag_theme.php b/modules/tag/helpers/tag_theme.php index a32d71b6..45f55986 100644 --- a/modules/tag/helpers/tag_theme.php +++ b/modules/tag/helpers/tag_theme.php @@ -20,7 +20,11 @@ class tag_theme_Core { static function head($theme) { $url = url::file("modules/tag/js/tag.js"); - return ""; + $head[] = ""; + if ($theme->tag() && module::is_active("rss")) { + $head[] = rss::feed_link("tags/{$theme->tag()->id}"); + } + return implode("\n", $head); } static function sidebar_blocks($theme) { -- cgit v1.2.3 From 76b89556fc138dce694178fab9140a8242ea40ec Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sun, 14 Jun 2009 12:09:47 -0700 Subject: Remove the sidebar flag from the feed definition returned by available_feeds and replace with a type field with one of two values (head and block). We need to do this to determine what fields go in the rss block so we can ignore the definitions that are related to the page head when creating the rss block that goes into the sidebar. --- modules/comment/helpers/comment_rss.php | 4 ++-- modules/gallery/helpers/gallery_rss.php | 4 ++-- modules/rss/helpers/rss.php | 7 +++---- modules/tag/helpers/tag_rss.php | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) (limited to 'modules/rss/helpers') diff --git a/modules/comment/helpers/comment_rss.php b/modules/comment/helpers/comment_rss.php index b191c326..2e958eef 100644 --- a/modules/comment/helpers/comment_rss.php +++ b/modules/comment/helpers/comment_rss.php @@ -21,10 +21,10 @@ class comment_rss_Core { static function available_feeds($item) { return array(array("description" => t("All new comments"), - "sidebar" => true, + "type" => "block", "uri" => "comments"), array("description" => sprintf(t("Comments on %s"), $item->title), - "sidebar" => true, + "type" => "block", "uri" => "comments/{$item->id}")); } diff --git a/modules/gallery/helpers/gallery_rss.php b/modules/gallery/helpers/gallery_rss.php index 6e722ff6..455e210f 100644 --- a/modules/gallery/helpers/gallery_rss.php +++ b/modules/gallery/helpers/gallery_rss.php @@ -21,10 +21,10 @@ class gallery_rss_Core { static function available_feeds($item) { return array(array("description" => t("New photos or movies"), - "sidebar" => true, + "type" => "block", "uri" => "updates"), array("description" => t("Album feed"), - "sidebar" => false, + "type" => "head", "uri" => "albums")); } diff --git a/modules/rss/helpers/rss.php b/modules/rss/helpers/rss.php index e4d6f5e9..403ee225 100644 --- a/modules/rss/helpers/rss.php +++ b/modules/rss/helpers/rss.php @@ -27,16 +27,15 @@ class rss_Core { /** * Get all available rss feeds */ - static function available_feeds($item, $sidebar_only=true) { + static function available_feeds($item) { $feeds = array(); foreach (module::active() as $module) { $class_name = "{$module->name}_rss"; if (method_exists($class_name, "available_feeds")) { foreach (call_user_func(array($class_name, "available_feeds"), $item) as $feed) { - if ($sidebar_only && !$feed["sidebar"]) { - continue; + if ($feed["type"] == "block") { + $feeds[$feed["description"]] = url::site("rss/feed/{$feed['uri']}"); } - $feeds[$feed["description"]] = url::site("rss/feed/{$feed['uri']}"); } } } diff --git a/modules/tag/helpers/tag_rss.php b/modules/tag/helpers/tag_rss.php index ace7fd6a..7846edf6 100644 --- a/modules/tag/helpers/tag_rss.php +++ b/modules/tag/helpers/tag_rss.php @@ -21,7 +21,7 @@ class tag_rss_Core { static function available_feeds($item) { return array(array("description" => t("Tag Album feed"), - "sidebar" => false, + "type" => "head", "uri" => "tags")); } -- cgit v1.2.3