2021-03-04 11:24:20 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace MediaWiki\Extension\AbuseFilter\EditBox;
|
|
|
|
|
|
|
|
use Xml;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class responsible for building a plain text filter edit box
|
|
|
|
*/
|
|
|
|
class PlainEditBoxBuiler extends EditBoxBuilder {
|
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
2021-07-21 18:51:12 +00:00
|
|
|
public function getEditBox( string $rules, bool $isUserAllowed, bool $externalForm ): string {
|
2021-03-04 11:24:20 +00:00
|
|
|
$rules = rtrim( $rules ) . "\n";
|
|
|
|
// Rules are in English
|
|
|
|
$editorAttribs = [ 'dir' => 'ltr' ];
|
|
|
|
if ( !$isUserAllowed ) {
|
|
|
|
$editorAttribs['readonly'] = 'readonly';
|
|
|
|
}
|
|
|
|
if ( $externalForm ) {
|
|
|
|
$editorAttribs['form'] = 'wpFilterForm';
|
|
|
|
}
|
|
|
|
return Xml::textarea( 'wpFilterRules', $rules, 40, 15, $editorAttribs );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|