extractRequestParams(); $matches = BaseBlacklist::getInstance( 'spam' )->filter( $params['url'], null, true ); $res = $this->getResult(); if ( $matches !== false ) { // this url is blacklisted. $res->addValue( 'spamblacklist', 'result', 'blacklisted' ); $res->setIndexedTagName( $matches, 'match' ); $res->addValue( 'spamblacklist', 'matches', $matches ); } else { // not blacklisted $res->addValue( 'spamblacklist', 'result', 'ok' ); } } public function getAllowedParams() { return [ 'url' => [ ApiBase::PARAM_REQUIRED => true, ApiBase::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', ]; } public function getHelpUrls() { return [ 'https://www.mediawiki.org/wiki/Extension:SpamBlacklist/API' ]; } }