mediawiki-extensions-AbuseF.../api/ApiAbuseFilterEvalExpression.php
Umherirrender 24e4e85603 Use short array syntax - Views / api
Done by phpcbf over composer fix

Change-Id: I83ab556c8400354ecd09f33e1eb28caa17aa803d
2017-06-15 14:40:55 +00:00

30 lines
650 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()
*/
protected function getExamplesMessages() {
return [
'action=abusefilterevalexpression&expression=lcase("FOO")'
=> 'apihelp-abusefilterevalexpression-example-1',
];
}
}