From 930fdbaf3f0105499f34e9e29059e491020f7b47 Mon Sep 17 00:00:00 2001 From: Nick Sturrock Date: Thu, 31 May 2018 15:25:07 +0100 Subject: [PATCH 1/3] Makes whitelist comparison case-insensitive --- src/CensorWords.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CensorWords.php b/src/CensorWords.php index 0eede25..7c9eed5 100644 --- a/src/CensorWords.php +++ b/src/CensorWords.php @@ -124,7 +124,7 @@ private function replaceWhiteListed($string, $reverse = false) } else { $placeHolder = str_replace('[i]', $key, $this->whiteListPlaceHolder); $this->whiteList[$key]['placeHolder'] = $placeHolder; - $string = str_replace($list['word'], $placeHolder, $string); + $string = str_ireplace($list['word'], $placeHolder, $string); } } From 7a5ca390d6894aaef52db6cff4a2cb7364242efe Mon Sep 17 00:00:00 2001 From: Nick Sturrock Date: Fri, 1 Jun 2018 09:32:40 +0100 Subject: [PATCH 2/3] Updates whitelist test to account for case insensitive matching --- tests/CensorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CensorTest.php b/tests/CensorTest.php index 5682094..01e9567 100644 --- a/tests/CensorTest.php +++ b/tests/CensorTest.php @@ -120,7 +120,7 @@ public function testWhiteListCensorObj() ]); $string = $censor->censorString('fuck dumb ass bitch FUCK Mass'); - $this->assertEquals('fuck dumb ass ***** **** Mass', $string['clean']); + $this->assertEquals('fuck dumb ass ***** fuck Mass', $string['clean']); } From 23b1de3461810310ba18f4eb964d27fde56f9aa5 Mon Sep 17 00:00:00 2001 From: Nick Sturrock Date: Mon, 4 Mar 2019 11:33:53 +0000 Subject: [PATCH 3/3] Adds words to profanity list --- src/dict/en-base.php | 1 + src/dict/en-uk.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/dict/en-base.php b/src/dict/en-base.php index a286a74..3e2f60d 100644 --- a/src/dict/en-base.php +++ b/src/dict/en-base.php @@ -18,6 +18,7 @@ 'fag', 'faggot', 'fuck', + 'fucking', 'fuk', 'handjob', 'homo', diff --git a/src/dict/en-uk.php b/src/dict/en-uk.php index 975dac9..00d2081 100644 --- a/src/dict/en-uk.php +++ b/src/dict/en-uk.php @@ -44,6 +44,7 @@ 'fcuk', 'fucker', 'fuckface', + 'fuckin', 'fuckr', 'fuct', 'genital',