/ wordfilters / ck.php
ck.php
1 <?php 2 function word_filter_callback($m) { 3 static $vals = array( 4 'smh' => 'baka', 5 'SMH' => 'BAKA', 6 'tbh' => 'desu', 7 'TBH' => 'DESU', 8 'fam' => 'senpai', 9 'FAM' => 'SENPAI', 10 'Fam' => 'Senpai', 11 'fams' => 'senpaitachi', 12 'FAMS' => 'SENPAITACHI', 13 'FAMs' => 'SENPAITACHI', 14 'Fams' => 'Senpaitachi' 15 ); 16 17 if (!isset($vals[$m[2]])) { 18 return $m[0]; 19 } 20 21 return "{$m[1]}{$vals[$m[2]]}{$m[3]}"; 22 } 23 24 // $text contents of a field 25 // $type name of the field 26 function word_filter($text, $type) { 27 if ($type !== 'com') { 28 return $text; 29 } 30 31 // $text = str_replace('Cuck', 'Kek', $text); 32 // $text = str_replace('cuck', 'kek', $text); 33 $text = str_replace('CUCK', 'KEK', $text); 34 35 $text = preg_replace_callback('/(\b)(sjw|sjws|smh|tbh|fams|fam)(\b)/i', 'word_filter_callback', $text); 36 37 return $text; 38 }