|
6 | 6 | use wcf\system\form\builder\data\processor\CustomFormDataProcessor; |
7 | 7 | use wcf\system\form\builder\field\AbstractFormField; |
8 | 8 | use wcf\system\form\builder\field\IAttributeFormField; |
| 9 | +use wcf\system\form\builder\field\ICensorshipFormField; |
9 | 10 | use wcf\system\form\builder\field\IMaximumLengthFormField; |
10 | 11 | use wcf\system\form\builder\field\IMinimumLengthFormField; |
| 12 | +use wcf\system\form\builder\field\TCensorshipFormField; |
11 | 13 | use wcf\system\form\builder\field\TInputAttributeFormField; |
12 | 14 | use wcf\system\form\builder\field\TMaximumLengthFormField; |
13 | 15 | use wcf\system\form\builder\field\TMinimumLengthFormField; |
|
17 | 19 | use wcf\system\form\builder\TObjectTypeFormNode; |
18 | 20 | use wcf\system\html\input\HtmlInputProcessor; |
19 | 21 | use wcf\system\html\upcast\HtmlUpcastProcessor; |
20 | | -use wcf\system\message\censorship\Censorship; |
21 | 22 | use wcf\system\message\quote\MessageQuoteManager; |
22 | 23 | use wcf\system\WCF; |
23 | 24 | use wcf\util\StringUtil; |
|
32 | 33 | */ |
33 | 34 | final class WysiwygFormField extends AbstractFormField implements |
34 | 35 | IAttributeFormField, |
| 36 | + ICensorshipFormField, |
35 | 37 | IMaximumLengthFormField, |
36 | 38 | IMinimumLengthFormField, |
37 | 39 | IObjectTypeFormNode |
38 | 40 | { |
| 41 | + use TCensorshipFormField; |
39 | 42 | use TInputAttributeFormField { |
40 | 43 | getReservedFieldAttributes as private inputGetReservedFieldAttributes; |
41 | 44 | } |
@@ -89,6 +92,12 @@ final class WysiwygFormField extends AbstractFormField implements |
89 | 92 | */ |
90 | 93 | protected $templateName = 'shared_wysiwygFormField'; |
91 | 94 |
|
| 95 | + public function __construct() |
| 96 | + { |
| 97 | + // WYSIWYG form fields use the censorship function by default for backward compatibility reasons. |
| 98 | + $this->censorship(); |
| 99 | + } |
| 100 | + |
92 | 101 | /** |
93 | 102 | * Sets the identifier used to autosave the field value and returns this field. |
94 | 103 | * |
@@ -372,14 +381,7 @@ public function validate() |
372 | 381 | $this->validateMaximumLength($message); |
373 | 382 |
|
374 | 383 | if (empty($this->getValidationErrors())) { |
375 | | - $censoredWords = Censorship::getInstance()->test($message); |
376 | | - if ($censoredWords) { |
377 | | - $this->addValidationError(new FormFieldValidationError( |
378 | | - 'censoredWords', |
379 | | - 'wcf.message.error.censoredWordsFound', |
380 | | - ['censoredWords' => $censoredWords] |
381 | | - )); |
382 | | - } |
| 384 | + $this->validateCensorship($message); |
383 | 385 | } |
384 | 386 | } |
385 | 387 | } |
|
0 commit comments