mediawiki-extensions-AbuseF.../includes/api/ApiAbuseFilterEvalExpression.php
Umherirrender a2ebd0c70a Improve some parameter docs
Change-Id: Ibac10a20243a4eedd826485d56eddd5234da6fec
2017-10-07 00:54:58 +02:00

31 lines
668 B
PHP

<?php
class ApiAbuseFilterEvalExpression extends ApiBase {
public function execute() {
$params = $this->extractRequestParams();
$result = AbuseFilter::evaluateExpression( $params['expression'] );
$this->getResult()->addValue( null, $this->getModuleName(), [ 'result' => $result ] );
}
public function getAllowedParams() {
return [
'expression' => [
ApiBase::PARAM_REQUIRED => true,
],
];
}
/**
* @see ApiBase::getExamplesMessages()
* @return array
*/
protected function getExamplesMessages() {
return [
'action=abusefilterevalexpression&expression=lcase("FOO")'
=> 'apihelp-abusefilterevalexpression-example-1',
];
}
}