extractRequestParams(); $matches = BaseBlacklist::getSpamBlacklist()->filter( $params['url'], null, $this->getUser(), true ); $res = $this->getResult(); if ( $matches !== false ) { // this url is blacklisted. $res->addValue( 'spamblacklist', 'result', 'blacklisted' ); ApiResult::setIndexedTagName( $matches, 'match' ); $res->addValue( 'spamblacklist', 'matches', $matches ); } else { // not blacklisted $res->addValue( 'spamblacklist', 'result', 'ok' ); } } /** @inheritDoc */ public function getAllowedParams() { return [ 'url' => [ ParamValidator::PARAM_REQUIRED => true, ParamValidator::PARAM_ISMULTI => true, ] ]; } /** * @see ApiBase::getExamplesMessages() * @return array */ protected function getExamplesMessages() { return [ 'action=spamblacklist&url=http://www.example.com/|http://www.example.org/' => 'apihelp-spamblacklist-example-1', ]; } /** @inheritDoc */ public function getHelpUrls() { return [ 'https://www.mediawiki.org/wiki/Extension:SpamBlacklist/API' ]; } }