mediawiki-extensions-Confir.../ApiFancyCaptchaReload.php
lalei 12361c5f31 Add a button to request a new fancy captcha
This adds HTML, CSS, and JS to FancyCaptcha output to refresh the image,
which requests it via a new fancycaptchareload API.
It also cleans up the Asirra class a little.

Bug: 14230
Change-Id: I4e476f32de199534c9798fc78e8490b3ef91dd45
2013-04-17 20:10:33 -04:00

35 lines
726 B
PHP

<?
/**
* 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();
$captchaIndex = $captcha->getCaptchaIndex();
$result = $this->getResult();
$result->addValue( null, $this->getModuleName(), array ( 'index' => $captchaIndex ) );
return true;
}
public function getDescription() {
return 'Get a new FancyCaptcha.';
}
public function getAllowedParams() {
return array();
}
public function getParamDescription() {
return array();
}
public function getExamples() {
return array( 'api.php?action=fancycaptchareload&format=xml' );
}
}