2013-06-28 23:18:10 +00:00
|
|
|
<?php
|
2013-01-17 02:00:09 +00:00
|
|
|
/**
|
|
|
|
* Api module to reload FancyCaptcha
|
|
|
|
*
|
|
|
|
* @ingroup API
|
|
|
|
* @ingroup Extensions
|
|
|
|
*/
|
|
|
|
class ApiFancyCaptchaReload extends ApiBase {
|
|
|
|
public function execute() {
|
|
|
|
# Get a new FancyCaptcha form data
|
|
|
|
$captcha = new FancyCaptcha();
|
2016-04-25 20:58:18 +00:00
|
|
|
$info = $captcha->getCaptcha();
|
|
|
|
$captchaIndex = $captcha->storeCaptcha( $info );
|
2013-01-17 02:00:09 +00:00
|
|
|
|
|
|
|
$result = $this->getResult();
|
2016-05-09 23:41:17 +00:00
|
|
|
$result->addValue( null, $this->getModuleName(), [ 'index' => $captchaIndex ] );
|
2013-01-17 02:00:09 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-10-28 19:08:41 +00:00
|
|
|
/**
|
|
|
|
* @deprecated since MediaWiki core 1.25
|
|
|
|
*/
|
2013-01-17 02:00:09 +00:00
|
|
|
public function getDescription() {
|
|
|
|
return 'Get a new FancyCaptcha.';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getAllowedParams() {
|
2016-05-09 23:41:17 +00:00
|
|
|
return [];
|
2013-01-17 02:00:09 +00:00
|
|
|
}
|
|
|
|
|
2014-10-28 19:08:41 +00:00
|
|
|
/**
|
|
|
|
* @deprecated since MediaWiki core 1.25
|
|
|
|
*/
|
2013-01-17 02:00:09 +00:00
|
|
|
public function getExamples() {
|
2016-05-09 23:41:17 +00:00
|
|
|
return [ 'api.php?action=fancycaptchareload&format=xml' ];
|
2013-01-17 02:00:09 +00:00
|
|
|
}
|
2014-10-28 19:08:41 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @see ApiBase::getExamplesMessages()
|
|
|
|
*/
|
|
|
|
protected function getExamplesMessages() {
|
2016-05-09 23:41:17 +00:00
|
|
|
return [
|
2014-10-28 19:08:41 +00:00
|
|
|
'action=fancycaptchareload'
|
|
|
|
=> 'apihelp-fancycaptchareload-example-1',
|
2016-05-09 23:41:17 +00:00
|
|
|
];
|
2014-10-28 19:08:41 +00:00
|
|
|
}
|
2013-01-17 02:00:09 +00:00
|
|
|
}
|