From 1b9f9925cfc501828335efa17ae70fd0ac907d2c Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 23 Feb 2013 16:02:29 +0400 Subject: add nsfw plugin --- plugins/nsfw/init.php | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 plugins/nsfw/init.php (limited to 'plugins/nsfw/init.php') diff --git a/plugins/nsfw/init.php b/plugins/nsfw/init.php new file mode 100644 index 000000000..fd274eada --- /dev/null +++ b/plugins/nsfw/init.php @@ -0,0 +1,47 @@ +link = $host->get_link(); + $this->host = $host; + + $host->add_hook($host::HOOK_RENDER_ARTICLE, $this); + $host->add_hook($host::HOOK_RENDER_ARTICLE_CDM, $this); + + } + + function get_js() { + return file_get_contents(dirname(__FILE__) . "/init.js"); + } + + function hook_render_article($article) { + + if (array_search("nsfw", $article["tags"]) !== FALSE) { + $article["content"] = "
+
"; + } + + return $article; + } + + function hook_render_article_cdm($article) { + if (array_search("nsfw", $article["tags"]) !== FALSE) { + $article["content"] = "
+
"; + } + + return $article; + } + +} +?> -- cgit v1.2.3-54-g00ecf