Skip to content

Instantly share code, notes, and snippets.

@Muqsit
Last active August 8, 2017 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Muqsit/3623ced0b8efdfad4c29ccd93a14bee9 to your computer and use it in GitHub Desktop.
Save Muqsit/3623ced0b8efdfad4c29ccd93a14bee9 to your computer and use it in GitHub Desktop.
this > mojang
<?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