X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=plugins%2Fnsfw%2Finit.php;h=9aadde4dd05fe549f184d5db6e0032f8805a9815;hb=cd616c4c35a4910486a9903bbfd95f1e9b9f3463;hp=fd274eadae59764430caa4abd253595ca68ae2c3;hpb=81c54e3d8d1066ecf0415ed9fbb71c54ec6dee54;p=tt-rss.git diff --git a/plugins/nsfw/init.php b/plugins/nsfw/init.php index fd274ead..9aadde4d 100644 --- a/plugins/nsfw/init.php +++ b/plugins/nsfw/init.php @@ -6,7 +6,7 @@ class NSFW extends Plugin { function about() { return array(1.0, - "Hide article content if tags contain \"nsfw\"", + "Hide article content based on tags", "fox", false); } @@ -17,6 +17,7 @@ class NSFW extends Plugin { $host->add_hook($host::HOOK_RENDER_ARTICLE, $this); $host->add_hook($host::HOOK_RENDER_ARTICLE_CDM, $this); + $host->add_hook($host::HOOK_PREFS_TAB, $this); } @@ -25,8 +26,9 @@ class NSFW extends Plugin { } function hook_render_article($article) { + $tags = array_map("trim", explode(", ", $this->host->get($this, "tags"))); - if (array_search("nsfw", $article["tags"]) !== FALSE) { + if (count(array_intersect($tags, $article["tags"])) > 0) { $article["content"] = "