X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=plugins%2Fnsfw%2Finit.php;h=6a1ae3c65a23958c6a167ed43bb43603daa0b8e8;hb=ed1262d55a01a6ffbefe01eb3b5fc22d33dfad24;hp=247d56a1e7e68bf740864c07543ad8763b8fa472;hpb=0d6ecb1f1cc663497bdd8fccb3f2dc66d2cdb0b9;p=tt-rss.git diff --git a/plugins/nsfw/init.php b/plugins/nsfw/init.php index 247d56a1..6a1ae3c6 100644 --- a/plugins/nsfw/init.php +++ b/plugins/nsfw/init.php @@ -1,7 +1,5 @@ link = $host->get_link(); $this->host = $host; $host->add_hook($host::HOOK_RENDER_ARTICLE, $this); @@ -26,9 +23,10 @@ class NSFW extends Plugin { } function hook_render_article($article) { - $tags = array_map("trim", explode(", ", $this->host->get($this, "tags"))); + $tags = array_map("trim", explode(",", $this->host->get($this, "tags"))); + $a_tags = array_map("trim", explode(",", $article["tag_cache"])); - if (count(array_intersect($tags, $article["tags"])) > 0) { + if (count(array_intersect($tags, $a_tags)) > 0) { $article["content"] = "
"; } @@ -37,9 +35,10 @@ class NSFW extends Plugin { } function hook_render_article_cdm($article) { - $tags = array_map("trim", explode(", ", $this->host->get($this, "tags"))); + $tags = array_map("trim", explode(",", $this->host->get($this, "tags"))); + $a_tags = array_map("trim", explode(",", $article["tag_cache"])); - if (count(array_intersect($tags, $article["tags"])) > 0) { + if (count(array_intersect($tags, $a_tags)) > 0) { $article["content"] = "
"; } @@ -71,9 +70,9 @@ class NSFW extends Plugin { } "; - print ""; - print ""; - print ""; + print_hidden("op", "pluginhandler"); + print_hidden("method", "save"); + print_hidden("plugin", "nsfw"); print ""; @@ -91,7 +90,7 @@ class NSFW extends Plugin { } function save() { - $tags = explode(",", db_escape_string($this->link, $_POST["tags"])); + $tags = explode(",", $_POST["tags"]); $tags = array_map("trim", $tags); $tags = array_map("mb_strtolower", $tags); $tags = join(", ", $tags); @@ -101,5 +100,8 @@ class NSFW extends Plugin { echo __("Configuration saved."); } -} -?> + function api_version() { + return 2; + } + +} \ No newline at end of file