Debian Codegraph @

extensions/ConfirmEdit/FancyCaptcha/includes/ApiFancyCaptchaReload.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Extension\ConfirmEdit\FancyCaptcha;
4
5 use MediaWiki\Api\ApiBase;
6
7 /**
8 * Api module to reload FancyCaptcha
9 *
10 * @ingroup API
11 * @ingroup Extensions
12 */
13 class ApiFancyCaptchaReload extends ApiBase {
14 public function execute() {
15 $result = $this->getResult();
16
17 if ( $this->getUser()->pingLimiter( 'badcaptcha', 1 ) ) {
18 $result->addValue( null, $this->getModuleName(), [ 'index' => 0 ] );
19 return true;
20 }
21
22 # Get a new FancyCaptcha form data
23 $captcha = new FancyCaptcha();
24 $info = $captcha->getCaptcha();
25 $captchaIndex = $captcha->storeCaptcha( $info );
26
27 $result->addValue( null, $this->getModuleName(), [ 'index' => $captchaIndex ] );
28 return true;
29 }
30
31 /** @inheritDoc */
32 public function isInternal() {
33 return true;
34 }
35
36 /** @inheritDoc */
37 public function getAllowedParams() {
38 return [];
39 }
40
41 /**
42 * @see ApiBase::getExamplesMessages()
43 * @return array
44 */
45 protected function getExamplesMessages() {
46 return [
47 'action=fancycaptchareload'
48 => 'apihelp-fancycaptchareload-example-1',
49 ];
50 }
51 }