/ wordfilters / v.php
v.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  function word_filter_consoles($text) {
 25    static $from = array(
 26      'pcfat',
 27      'pcuck',
 28      'pccuck',
 29      'valvedrone',
 30      'sonynigger',
 31      'sonygger',
 32      'sonydrone',
 33      'sonycuck',
 34      'sonypony',
 35      'nintencuck',
 36      'nintoddler',
 37      'nintendotoddler',
 38      'nintendrone',
 39      'nintenyearold',
 40      'nintendroid',
 41      'nintenshit',
 42      'Pcfat',
 43      'Pcuck',
 44      'PCuck',
 45      'Pccuck',
 46      'Valvedrone',
 47      'Sonynigger',
 48      'Sonygger',
 49      'Sonydrone',
 50      'Sonycuck',
 51      'Sonypony',
 52      'Nintencuck',
 53      'Nintoddler',
 54      'Nintendotoddler',
 55      'Nintendrone',
 56      'Nintenyearold',
 57      'Nintendroid',
 58      'Nintenshit',
 59      'nintendr0ne',
 60      'Nintendr0ne',
 61      'sonybrony',
 62      'Sonybrony',
 63      'sonybronies',
 64      'Sonybronies',
 65      'sonypony',
 66      'Sonypony',
 67      'sonyponies',
 68      'Sonyponies',
 69      'sonigger',
 70      'Sonigger'
 71    );
 72    
 73    static $to = array(
 74      'pcbro',
 75      'pcbro',
 76      'pcbro',
 77      'pcbro',
 78      'sonybro',
 79      'sonybro',
 80      'sonybro',
 81      'sonybro',
 82      'sonybro',
 83      'nintenbro',
 84      'nintenbro',
 85      'nintenbro',
 86      'nintenbro',
 87      'nintenbro',
 88      'nintenbro',
 89      'nintenbro',
 90      'Pcbro',
 91      'Pcbro',
 92      'PCbro',
 93      'Pcbro',
 94      'Pcbro',
 95      'Sonybro',
 96      'Sonybro',
 97      'Sonybro',
 98      'Sonybro',
 99      'Sonybro',
100      'Nintenbro',
101      'Nintenbro',
102      'Nintenbro',
103      'Nintenbro',
104      'Nintenbro',
105      'Nintenbro',
106      'Nintenbro',
107      'nintenbro',
108      'Nintenbro',
109      'sonybro',
110      'Sonybro',
111      'sonybros',
112      'Sonybros',
113      'sonybro',
114      'Sonybro',
115      'sonybros',
116      'Sonybros',
117      'sonybro',
118      'Sonybro'
119    );
120    
121    return str_replace($from, $to, $text);
122  }
123  
124  function word_filter_callback_soy($m) {
125    $is_uc = $m[2] === strtoupper($m[2]);
126    
127    $lc = strtolower($m[4]);
128    
129    if ($lc === 'uz') {
130      return $m[0];
131    }
132    
133    if ($lc === 'im' || $lc === 'lent') {
134      $m[4] = '';
135    }
136    
137    if (!isset($m[4][1])) {
138      if ($is_uc) {
139        $onions = 'ONIONS';
140      }
141      else {
142        if ($m[2][0] === 's') {
143          $onions = 'onions';
144        }
145        else {
146          $onions = 'Onions';
147        }
148      }
149      
150      return "{$m[1]}{$onions}{$m[4]}";
151    }
152    
153    if ($m[2][0] === 's') {
154      $b = 'b';
155    }
156    else {
157      $b = 'B';
158    }
159    
160    $ac = mb_strlen($m[3]);
161    
162    if ($ac == 1) {
163      $a = 'a';
164    }
165    else {
166      if ($ac < 35) {
167        $a = str_repeat('a', $ac);
168      }
169      else {
170        $a = 'a';
171      }
172    }
173    
174    $based = "{$b}{$a}sed";
175    
176    if ($is_uc) {
177      $based = strtoupper($based);
178    }
179    
180    return $m[1] . $based . $m[4];
181  }
182  
183  // $text contents of a field
184  // $type name of the field
185  function word_filter($text, $type) {
186    if ($type !== 'com') {
187      return $text;
188    }
189    
190  //  $text = str_replace('Cuck', 'Kek', $text);
191  //  $text = str_replace('cuck', 'kek', $text);
192    $text = str_replace('CUCK', 'KEK', $text);
193    
194    $text = preg_replace_callback('/(\b)(sjw|sjws|smh|tbh|fams|fam)(\b)/i', 'word_filter_callback', $text);
195    
196    $text = preg_replace_callback('/(\b)(s([o0οоօჿ]+)[yуΥ])(\b|[[:alpha:]]{2,4})/iu', 'word_filter_callback_soy', $text);
197    
198    $text = word_filter_consoles($text);
199    
200    return $text;
201  }