mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-30 16:54:18 +00:00
71170d6db1
This luckily doesn't appear anywhere else: https://codesearch.wmcloud.org/search/?q=EditBoxBuiler Change-Id: I8238015b10cc729a2df7b56be7e3eb5140f8a070
28 lines
642 B
PHP
28 lines
642 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\AbuseFilter\EditBox;
|
|
|
|
use Xml;
|
|
|
|
/**
|
|
* Class responsible for building a plain text filter edit box
|
|
*/
|
|
class PlainEditBoxBuilder extends EditBoxBuilder {
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function getEditBox( string $rules, bool $isUserAllowed, bool $externalForm ): string {
|
|
$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 );
|
|
}
|
|
|
|
}
|