summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2008-11-28 04:51:17 +0000
committerBharat Mediratta <bharat@menalto.com>2008-11-28 04:51:17 +0000
commitdec97b42fe94105e39dc5cbadc0051155a123569 (patch)
tree2c0337261a00ad3147699b2ee07a8eb6852bbd52
parent3fa12655dd2409981804c9ef065ff4c1d2daa3b6 (diff)
Create media_rss helper and move feed generation in there, so that we
can get to the feed from other parts of the code.
-rw-r--r--modules/media_rss/helpers/media_rss.php30
-rw-r--r--modules/media_rss/helpers/media_rss_block.php8
2 files changed, 32 insertions, 6 deletions
diff --git a/modules/media_rss/helpers/media_rss.php b/modules/media_rss/helpers/media_rss.php
new file mode 100644
index 00000000..c834611a
--- /dev/null
+++ b/modules/media_rss/helpers/media_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-2008 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 media_rss_Core {
+ public static function item_feed($item) {
+ $id = $item->type == "album" ? $item->id : $item->parent_id;
+ return url::site("media_rss/albums/$id");
+ }
+
+ public static function tag_feed($tag) {
+ return url::site("media_rss/tags/$tag->id}");
+ }
+} \ No newline at end of file
diff --git a/modules/media_rss/helpers/media_rss_block.php b/modules/media_rss/helpers/media_rss_block.php
index e19ceef7..0a88ba70 100644
--- a/modules/media_rss/helpers/media_rss_block.php
+++ b/modules/media_rss/helpers/media_rss_block.php
@@ -20,13 +20,9 @@
class media_rss_block_Core {
public static function head($theme) {
if ($theme->item()) {
- if ($theme->item()->type == "album") {
- $url = url::site("media_rss/albums/{$theme->item()->id}");
- } else {
- $url = url::site("media_rss/albums/{$theme->item()->parent_id}");
- }
+ $url = media_rss::item_feed($theme->item());
} else if ($theme->tag()) {
- $url = url::site("media_rss/tags/{$theme->tag()->id}");
+ $url = media_rss::tag_feed($theme->tag());
}
if (!empty($url)) {