]> git.wh0rd.org - tt-rss.git/blobdiff - plugins/nsfw/init.php
nsfw: fix wrong delimiter when expanding tag_cache
[tt-rss.git] / plugins / nsfw / init.php
index c4182731d092e228c8e5ced9b631ccef8d174f3f..51566592383cecac780c19a4eef201fd3ac1e03f 100644 (file)
@@ -23,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"] = "<div class='nswf wrapper'><button onclick=\"nsfwShow(this)\">".__("Not work safe (click to toggle)")."</button>
                                <div class='nswf content' style='display : none'>".$article["content"]."</div></div>";
                }
@@ -34,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"] = "<div class='nswf wrapper'><button onclick=\"nsfwShow(this)\">".__("Not work safe (click to toggle)")."</button>
                                <div class='nswf content' style='display : none'>".$article["content"]."</div></div>";
                }
@@ -98,5 +100,9 @@ class NSFW extends Plugin {
                echo __("Configuration saved.");
        }
 
+       function api_version() {
+               return 2;
+       }
+
 }
 ?>