nsfw added to repository
This commit is contained in:
parent
38e3373963
commit
ce7b6d6bb2
3 changed files with 34 additions and 0 deletions
BIN
nsfw.tgz
Normal file
BIN
nsfw.tgz
Normal file
Binary file not shown.
8
nsfw/README
Normal file
8
nsfw/README
Normal file
|
@ -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.
|
||||||
|
|
26
nsfw/nsfw.php
Normal file
26
nsfw/nsfw.php
Normal file
|
@ -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>';
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue