From: friendica Date: Thu, 2 Feb 2012 07:40:16 +0000 (-0800) Subject: nsfw - use regex matching if word starts with '/' X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=895b263c8a26a1eda31d4c97b8805b6135b32eee;p=friendica-addons.git nsfw - use regex matching if word starts with '/' --- diff --git a/nsfw.tgz b/nsfw.tgz index 187ef015..b9dc85be 100755 Binary files a/nsfw.tgz and b/nsfw.tgz differ diff --git a/nsfw/nsfw.php b/nsfw/nsfw.php index 71880499..332e8224 100755 --- a/nsfw/nsfw.php +++ b/nsfw/nsfw.php @@ -86,14 +86,21 @@ function nsfw_prepare_body(&$a,&$b) { if(! strlen(trim($word))) { continue; } - - if(stristr($b['html'],$word)) { - $found = true; - break; + if(strpos($word,'/') === 0) { + if(preg_match($word,$b['html'])) { + $found = true; + break; + } } - if(stristr($b['item']['tag'], ']' . $word . '[' )) { - $found = true; - break; + else { + if(stristr($b['html'],$word)) { + $found = true; + break; + } + if(stristr($b['item']['tag'], ']' . $word . '[' )) { + $found = true; + break; + } } } }