-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
44 lines (35 loc) · 804 Bytes
/
example.php
File metadata and controls
44 lines (35 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
include 'src/autoload.php';
$analyzer = new Profanity\Analyzer([
'badwords' => explode("\n", file_get_contents('badwords.txt')),
'aliases' => [
'0' => 'o',
'1' => 'l',
'2' => 'r',
'3' => 'e',
'4' => 'a',
'5' => 's',
'6' => 'g',
'7' => 't',
'8' => 'b',
'9' => 'g',
'@' => 'a',
'!' => 'i',
'$' => 's',
'§' => 's',
'(' => 'c',
')' => 'd',
'()' => 'o',
'><' => 'x',
'|' => 'i',
'+' => 't',
'vv' => 'w'
]
]);
$analyzer->addStrategy('simple');
$string = 'Du bist ein Arsch!';
if ($analyzer->execute($string)) {
echo 'Badword detected.';
} else {
echo 'Text is safe.';
}