id"] = t("Comments on %title", array("title" => p::purify($item->title))); } return $feeds; } static function feed($feed_id, $offset, $limit, $id) { if ($feed_id != "newest" && $feed_id != "item") { return; } $comment_model = ORM::factory("comment") ->viewable() ->where("state", "published") ->orderby("created", "DESC"); if ($feed_id == "item") { $comment_model->where("item_id", $id); } $comments = $comment_model->find_all($limit, $offset); $feed->view = "comment.mrss"; $feed->children = array(); foreach ($comments as $comment) { $item = $comment->item(); $feed->children[] = new ArrayObject( array("pub_date" => date("D, d M Y H:i:s T", $comment->created), "text" => nl2br(p::purify($comment->text)), "thumb_url" => $item->thumb_url(), "thumb_height" => $item->thumb_height, "thumb_width" => $item->thumb_width, "item_uri" => url::abs_site("{$item->type}s/$item->id"), "title" => p::purify($item->title), "author" => p::clean($comment->author_name())), ArrayObject::ARRAY_AS_PROPS); } $feed->max_pages = ceil($comment_model->count_all() / $limit); $feed->title = htmlspecialchars(t("Recent Comments")); $feed->uri = url::abs_site("albums/" . (empty($id) ? "1" : $id)); $feed->description = t("Recent Comments"); return $feed; } }