From a4edbfa031eb4cd72678051f1510afde4f77951e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 28 Feb 2014 08:36:29 +0100 Subject: Update to MediaWiki 1.22.3 --- extensions/SpamBlacklist/api/ApiSpamBlacklist.php | 78 +++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 extensions/SpamBlacklist/api/ApiSpamBlacklist.php (limited to 'extensions/SpamBlacklist/api/ApiSpamBlacklist.php') diff --git a/extensions/SpamBlacklist/api/ApiSpamBlacklist.php b/extensions/SpamBlacklist/api/ApiSpamBlacklist.php new file mode 100644 index 00000000..dad9e8e0 --- /dev/null +++ b/extensions/SpamBlacklist/api/ApiSpamBlacklist.php @@ -0,0 +1,78 @@ +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 array( + 'url' => array( + ApiBase::PARAM_REQUIRED => true, + ApiBase::PARAM_ISMULTI => true, + ) + ); + } + + public function getParamDescription() { + return array( + 'url' => 'A pipe-separated list of URLs to validate against the blacklist', + ); + } + + public function getDescription() { + return 'Validate one or more URLs against the SpamBlacklist.'; + } + + public function getExamples() { + return array( + 'api.php?action=spamblacklist&url=http%3A%2F%2Fwww.example.com%2F%7Chttp%3A%2F%2Fwww.example.org%2F', + 'api.php?action=spamblacklist&url=https%3A%2F%2Fwww.example.net%2Findex.php', + ); + } + + public function getHelpUrls() { + return array( 'https://www.mediawiki.org/wiki/Extension:SpamBlacklist/API' ); + } +} -- cgit v1.2.3-54-g00ecf