]> git.mxchange.org Git - friendica-addons.git/commitdiff
nsfw added to repository
authorFriendika <info@friendika.com>
Wed, 5 Oct 2011 09:20:17 +0000 (02:20 -0700)
committerFriendika <info@friendika.com>
Wed, 5 Oct 2011 09:20:17 +0000 (02:20 -0700)
nsfw.tgz [new file with mode: 0644]
nsfw/README [new file with mode: 0644]
nsfw/nsfw.php [new file with mode: 0644]

diff --git a/nsfw.tgz b/nsfw.tgz
new file mode 100644 (file)
index 0000000..294f9ec
Binary files /dev/null and b/nsfw.tgz differ
diff --git a/nsfw/README b/nsfw/README
new file mode 100644 (file)
index 0000000..cf2dc26
--- /dev/null
@@ -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 (file)
index 0000000..776df19
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+
+
+/**
+ * Name: NSFW
+ * Description: Collapse posts with inappropriate content
+ * Version: 1.0
+ * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
+ * 
+ */
+
+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 = '<div id="nsfw-wrap-' . $rnd . '" class="fakelink" onclick=openClose(\'nsfw-' . $rnd . '\'); >' . t('NSFW - Click to open/close') . '</div><div id="nsfw-' . $rnd . '" style="display: none; " >' . $b . '</div>';  
+       }
+}
\ No newline at end of file