summaryrefslogtreecommitdiff
path: root/modules/comment/helpers/comment_rss.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-06-15 21:35:14 -0700
committerBharat Mediratta <bharat@menalto.com>2009-06-15 21:35:14 -0700
commitce2fde5d37f7dd3972eafb644a9ff38532c4bae1 (patch)
tree1f5ed4001d320760b48289d69d345f135b27e698 /modules/comment/helpers/comment_rss.php
parentb8c68ce2f9e61ff7df5c17cd99142eb75df17a0c (diff)
Refactor the comment_rss::feed() method to eliminate code duplication.
Diffstat (limited to 'modules/comment/helpers/comment_rss.php')
-rw-r--r--modules/comment/helpers/comment_rss.php30
1 files changed, 13 insertions, 17 deletions
diff --git a/modules/comment/helpers/comment_rss.php b/modules/comment/helpers/comment_rss.php
index afcc275c..ef2d176e 100644
--- a/modules/comment/helpers/comment_rss.php
+++ b/modules/comment/helpers/comment_rss.php
@@ -29,24 +29,20 @@ class comment_rss_Core {
}
static function feed($feed_id, $offset, $limit, $id) {
- switch ($feed_id) {
- case "newest":
- $comments = ORM::factory("comment")
- ->where("state", "published")
- ->orderby("created", "DESC");
- $all_comments = ORM::factory("comment")
- ->where("state", "published")
- ->orderby("created", "DESC");
- break;
+ if ($feed_id != "newest" && $feed_id != "item") {
+ return;
+ }
+
+ $comments = ORM::factory("comment")
+ ->where("state", "published")
+ ->orderby("created", "DESC");
+ $all_comments = ORM::factory("comment")
+ ->where("state", "published")
+ ->orderby("created", "DESC");
- case "item":
- $comments = ORM::factory("comment")
- ->where("state", "published")
- ->orderby("created", "DESC")
- ->where("item_id", $id);
- $all_comments = ORM::factory("comment")
- ->where("state", "published")
- ->where("item_id", $id);
+ if ($feed_id == "item") {
+ $comments->where("item_id", $id);
+ $all_comments->where("item_id", $id);
}
if (!empty($comments)) {