mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-07-21 23:33:54 -04:00
Improve comment RSS feed visibility, initially added by Thomas E. Horner in
fc942aacda.
Change some variable names, refactor out visibility checking code, actually
check visibility at generation time instead of just suppressing the UI,
update module.info
Fixes #1829.
This commit is contained in:
@@ -19,17 +19,23 @@
|
||||
*/
|
||||
|
||||
class comment_rss_Core {
|
||||
static function available_feeds($item, $tag) {
|
||||
$avail = module::get_var("comment", "rss_available");
|
||||
if($avail == "none") {
|
||||
return array();
|
||||
static function feed_visible($feed_id) {
|
||||
$visible = module::get_var("comment", "rss_visible");
|
||||
if (!in_array($feed_id, array("newest", "per_item"))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if($avail == "both" || $avail == "newest") {
|
||||
return ($visible == "all" || $visible == $feed_id);
|
||||
}
|
||||
|
||||
static function available_feeds($item, $tag) {
|
||||
$feeds = array();
|
||||
|
||||
if (comment_rss::feed_visible("newest")) {
|
||||
$feeds["comment/newest"] = t("All new comments");
|
||||
}
|
||||
|
||||
if ($item && ($avail == "both" || $avail == "onitem")) {
|
||||
if ($item && comment_rss::feed_visible("per_item")) {
|
||||
$feeds["comment/item/$item->id"] =
|
||||
t("Comments on %title", array("title" => html::purify($item->title)));
|
||||
}
|
||||
@@ -37,7 +43,7 @@ class comment_rss_Core {
|
||||
}
|
||||
|
||||
static function feed($feed_id, $offset, $limit, $id) {
|
||||
if ($feed_id != "newest" && $feed_id != "item") {
|
||||
if (!comment_rss::feed_visible($feed_id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user