mediawiki-extensions-AbuseF.../includes/api/ApiAbuseFilterEvalExpression.php
Max Semenik 2f250127b4 Normalize file layout
Aka move all code into includes/.

Change-Id: I21f7b80bb6df04abbed6bfccb94f92100dc8f071
2017-08-07 16:11:38 -07: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',
];
}
}