1 | <?php |
||
5 | class Censor extends AbstractFilter |
||
6 | { |
||
7 | // how may characters from the benining are left untouched |
||
8 | const OPTION_START_CHARACTERS = 'start_characters'; |
||
9 | // how may characters from the end are left untouched |
||
10 | const OPTION_END_CHARACTERS = 'end_characters'; |
||
11 | // replacement character |
||
12 | const OPTION_REPLACEMENT_CHAR = 'replacement_char'; |
||
13 | // censored words |
||
14 | const OPTION_WORDS = 'words'; |
||
15 | |||
16 | protected $options = [ |
||
17 | self::OPTION_START_CHARACTERS => 1, |
||
18 | self::OPTION_END_CHARACTERS => 1, |
||
19 | self::OPTION_REPLACEMENT_CHAR => '*', |
||
20 | self::OPTION_WORDS => [ |
||
21 | 'fuck', |
||
22 | 'fucker', |
||
23 | 'fuckers', |
||
24 | 'fucking', |
||
25 | 'motherfucker', |
||
26 | 'asshole', |
||
27 | 'cunt', |
||
28 | 'dick' |
||
29 | ] |
||
30 | ]; |
||
31 | |||
32 | protected $obfuscator; |
||
33 | |||
34 | 1 | public function setOption($name, $value) |
|
41 | |||
42 | 2 | protected function getReplaceCallback() |
|
52 | |||
53 | 3 | public function filterSingle($value, string $valueIdentifier = null) |
|
65 | } |
||
66 |