diff options
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r-- | modules/gallery/helpers/gallery_menu.php | 3 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery_rss.php | 63 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery_theme.php | 8 |
3 files changed, 42 insertions, 32 deletions
diff --git a/modules/gallery/helpers/gallery_menu.php b/modules/gallery/helpers/gallery_menu.php index fd4ec241..4499e50a 100644 --- a/modules/gallery/helpers/gallery_menu.php +++ b/modules/gallery/helpers/gallery_menu.php @@ -91,6 +91,9 @@ class gallery_menu_Core { static function album($menu, $theme) { } + static function tag($menu, $theme) { + } + static function photo($menu, $theme) { if (access::can("view_full", $theme->item())) { $menu diff --git a/modules/gallery/helpers/gallery_rss.php b/modules/gallery/helpers/gallery_rss.php index 6535d29d..6e966bdb 100644 --- a/modules/gallery/helpers/gallery_rss.php +++ b/modules/gallery/helpers/gallery_rss.php @@ -19,41 +19,44 @@ */ class gallery_rss_Core { - static function available_feeds($item) { - return array(array("description" => t("New photos or movies"), - "type" => "block", - "uri" => "updates"), - array("description" => t("Album feed"), - "type" => "head", - "uri" => "albums")); + static function available_feeds($item, $tag) { + $feeds["gallery/latest"] = t("Latest photos and movies"); + return $feeds; } - static function updates($offset, $limit) { - $feed["children"] = ORM::factory("item") - ->viewable() - ->where("type !=", "album") - ->orderby("created", "DESC") - ->find_all($limit, $offset); - $feed["max_pages"] = ceil($feed["children"]->count() / $limit); - $feed["title"] = t("Recent Updates"); - $feed["link"] = url::abs_site("albums/1"); - $feed["description"] = t("Recent Updates"); + static function feed($feed_id, $offset, $limit, $id) { + switch ($feed_id) { + case "latest": + $feed->children = ORM::factory("item") + ->viewable() + ->where("type !=", "album") + ->orderby("created", "DESC") + ->find_all($limit, $offset); - return $feed; - } + $all_children = ORM::factory("item") + ->viewable() + ->where("type !=", "album") + ->orderby("created", "DESC"); + + $feed->max_pages = ceil($all_children->find_all()->count() / $limit); + $feed->title = t("Recent Updates"); + $feed->link = url::abs_site("albums/1"); + $feed->description = t("Recent Updates"); + return $feed; - static function albums($offset, $limit, $id) { - $item = ORM::factory("item", $id); - access::required("view", $item); + case "album": + $item = ORM::factory("item", $id); + access::required("view", $item); - $feed["children"] = $item - ->viewable() - ->descendants($limit, $offset, "photo"); - $feed["max_pages"] = ceil($item->viewable()->descendants_count("photo") / $limit); - $feed["title"] = $item->title; - $feed["link"] = url::abs_site("albums/{$item->id}"); - $feed["description"] = $item->description; + $feed->children = $item + ->viewable() + ->descendants($limit, $offset, "photo"); + $feed->max_pages = ceil($item->viewable()->descendants_count("photo") / $limit); + $feed->title = $item->title; + $feed->link = url::abs_site("albums/{$item->id}"); + $feed->description = $item->description; - return $feed; + return $feed; + } } } diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php index 290434ed..c28c9040 100644 --- a/modules/gallery/helpers/gallery_theme.php +++ b/modules/gallery/helpers/gallery_theme.php @@ -42,8 +42,12 @@ class gallery_theme_Core { $buf .= html::script("modules/gallery/js/fullsize.js"); } - if ($theme->item()) { - $buf .= rss::feed_link("albums/{$theme->item()->id}"); + if (module::is_active("rss")) { + if ($item = $theme->item()) { + $buf = rss::feed_link("gallery/album/{$item->id}"); + } else if ($tag = $theme->tag()) { + $buf = rss::feed_link("tag/tag/{$tag->id}"); + } } if ($session->get("l10n_mode", false)) { |