From: Friendika Date: Wed, 5 Oct 2011 09:20:17 +0000 (-0700) Subject: nsfw added to repository X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ce7b6d6bb268ccfe712e115c09c8c59502952ea2;p=friendica-addons.git nsfw added to repository --- diff --git a/nsfw.tgz b/nsfw.tgz new file mode 100644 index 00000000..294f9ec8 Binary files /dev/null and b/nsfw.tgz differ diff --git a/nsfw/README b/nsfw/README new file mode 100644 index 00000000..cf2dc262 --- /dev/null +++ b/nsfw/README @@ -0,0 +1,8 @@ +NSFW + +"Not safe for work" + +Scans the message content for the string 'nsfw' +(case insensitive) and if found replaces the content +with a "click to open/close" link, default is closed. + diff --git a/nsfw/nsfw.php b/nsfw/nsfw.php new file mode 100644 index 00000000..776df194 --- /dev/null +++ b/nsfw/nsfw.php @@ -0,0 +1,26 @@ + + * + */ + +function nsfw_install() { + register_hook('prepare_body', 'addon/nsfw/nsfw.php', 'nsfw_prepare_body'); +} + + +function nsfw_uninstall() { + unregister_hook('prepare_body', 'addon/nsfw/nsfw.php', 'nsfw_prepare_body'); +} + +function nsfw_prepare_body(&$a,&$b) { + if(stristr($b,'nsfw')) { + $rnd = random_string(8); + $b = ''; + } +} \ No newline at end of file