summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/comment/helpers/comment_event.php6
-rw-r--r--modules/comment/helpers/comment_rss.php30
-rw-r--r--modules/gallery/helpers/gallery_event.php4
-rw-r--r--modules/gallery/helpers/gallery_rss.php27
-rw-r--r--modules/rss/helpers/rss.php21
-rw-r--r--modules/rss/helpers/rss_theme.php9
6 files changed, 79 insertions, 18 deletions
diff --git a/modules/comment/helpers/comment_event.php b/modules/comment/helpers/comment_event.php
index fdf3a96f..a3beb27a 100644
--- a/modules/comment/helpers/comment_event.php
+++ b/modules/comment/helpers/comment_event.php
@@ -21,10 +21,4 @@ class comment_event_Core {
static function item_before_delete($item) {
Database::instance()->delete("comments", array("item_id" => $item->id));
}
-
- static function request_feed_links($event_data) {
- $event_data->feeds[t("All new comments")] = "comments";
- $event_data->feeds[sprintf(t("Comments on %s"), $event_data->item->title)] =
- "comments/{$event_data->item->id}";
- }
}
diff --git a/modules/comment/helpers/comment_rss.php b/modules/comment/helpers/comment_rss.php
new file mode 100644
index 00000000..9ae28726
--- /dev/null
+++ b/modules/comment/helpers/comment_rss.php
@@ -0,0 +1,30 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+class comment_rss_Core {
+ static function available_feeds($item) {
+ return array(array("description" => t("All new comments"),
+ "sidebar" => true,
+ "uri" => "comments"),
+ array("description" => sprintf(t("Comments on %s"), $item->title),
+ "sidebar" => true,
+ "uri" => "comments/{$item->id}"));
+ }
+} \ No newline at end of file
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index b1e9332d..aa11b7c0 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -43,8 +43,4 @@ class gallery_event_Core {
module::clear_var("gallery", "choose_default_tookit");
}
}
-
- static function request_feed_links($event_data) {
- $event_data->feeds[t("New photos or movies")] = url::site("updates");
- }
}
diff --git a/modules/gallery/helpers/gallery_rss.php b/modules/gallery/helpers/gallery_rss.php
new file mode 100644
index 00000000..0b87b1b1
--- /dev/null
+++ b/modules/gallery/helpers/gallery_rss.php
@@ -0,0 +1,27 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+class gallery_rss_Core {
+ static function available_feeds($item) {
+ return array(array("description" => t("New photos or movies"),
+ "sidebar" => true,
+ "uri" => "updates"));
+ }
+}
diff --git a/modules/rss/helpers/rss.php b/modules/rss/helpers/rss.php
index b320aeae..b0e7b30f 100644
--- a/modules/rss/helpers/rss.php
+++ b/modules/rss/helpers/rss.php
@@ -27,4 +27,25 @@ class rss_Core {
static function tag_feed($tag) {
return url::site("rss/tags/$tag->id}");
}
+
+ /**
+ * Get all available rss feeds
+ */
+ static function get_feeds($item, $sidebar_only=true) {
+ $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;
+ }
+ $feeds[$feed["description"]] = url::site("rss/{$feed['uri']}");
+ }
+ }
+ }
+
+ return $feeds;
+ }
+
} \ No newline at end of file
diff --git a/modules/rss/helpers/rss_theme.php b/modules/rss/helpers/rss_theme.php
index 2e4e141b..b82133bd 100644
--- a/modules/rss/helpers/rss_theme.php
+++ b/modules/rss/helpers/rss_theme.php
@@ -36,18 +36,11 @@ class rss_theme_Core {
return;
}
- $event_data = new stdClass();
- $event_data->feeds = array();
- $event_data->item = $theme->item();
- module::event("request_feed_links", $event_data);
- foreach ($event_data->feeds as $key => $feed) {
- $event_data->feeds[$key] = url::site("rss/$feed");
- }
$block = new Block();
$block->css_id = "gRss";
$block->title = t("Available RSS Feeds");
$block->content = new View("rss_block.html");
- $block->content->feeds = $event_data->feeds;
+ $block->content->feeds = rss::get_feeds($theme->item());
return $block;
}