-
-
Save Muqsit/3623ced0b8efdfad4c29ccd93a14bee9 to your computer and use it in GitHub Desktop.
this > mojang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ChatHandler{ | |
const BAD_WORDS = [ | |
'asshole' => '*******', | |
'bitch' => '*****', | |
'blowjob' => '*******', | |
'boner' => '*****', | |
'boobs' => '*****', | |
'clit' => '****', | |
'cunt' => '****', | |
'dildo' => '*****', | |
'faggit' => '******', | |
'faggot' => '******', | |
'fingering' => '*********', | |
'fuck' => '****', | |
'nigga' => '*****', | |
'nigger' => '******', | |
'nude' => '****', | |
'penis' => '*****', | |
'porn' => '****', | |
'rimjob' => '******', | |
'shit' => '****', | |
'slut' => '****', | |
'tits' => '****', | |
'vagina' => '******', | |
'viagra' => '******' | |
]; | |
public function filterBadWords(string &$message){ | |
$message = str_ireplace(array_keys(self::BAD_WORDS), array_values(self::BAD_WORDS), $message); | |
} | |
} | |
$message = "This server is fucking gay and that staff is such a slut!"; | |
$cf = new ChatFilter(); | |
$cf->filterBadWords($message); | |
echo $message;//"This server is so ****ing gay and that staff is such a ****!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment