summaryrefslogtreecommitdiff
path: root/extensions/ConfirmEdit/Captcha.php
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/ConfirmEdit/Captcha.php')
-rw-r--r--extensions/ConfirmEdit/Captcha.php27
1 files changed, 18 insertions, 9 deletions
diff --git a/extensions/ConfirmEdit/Captcha.php b/extensions/ConfirmEdit/Captcha.php
index 0f78d36f..3be6d917 100644
--- a/extensions/ConfirmEdit/Captcha.php
+++ b/extensions/ConfirmEdit/Captcha.php
@@ -42,6 +42,8 @@ class SimpleCaptcha {
Xml::element( 'input', array(
'name' => 'wpCaptchaWord',
'id' => 'wpCaptchaWord',
+ 'size' => 5,
+ 'autocomplete' => 'off',
'tabindex' => 1 ) ) . // tab in before the edit textarea
"</p>\n" .
Xml::element( 'input', array(
@@ -577,15 +579,23 @@ class SimpleCaptcha {
/**
* @param $module ApiBase
+ * @return bool
+ */
+ protected function isAPICaptchaModule( $module ) {
+ return $module instanceof ApiEditPage;
+ }
+
+ /**
+ * @param $module ApiBase
* @param $params array
+ * @param $flags int
* @return bool
*/
- public function APIGetAllowedParams( &$module, &$params ) {
- if ( !$module instanceof ApiEditPage ) {
- return true;
+ public function APIGetAllowedParams( &$module, &$params, $flags ) {
+ if ( $flags && $this->isAPICaptchaModule( $module ) ) {
+ $params['captchaword'] = null;
+ $params['captchaid'] = null;
}
- $params['captchaword'] = null;
- $params['captchaid'] = null;
return true;
}
@@ -596,11 +606,10 @@ class SimpleCaptcha {
* @return bool
*/
public function APIGetParamDescription( &$module, &$desc ) {
- if ( !$module instanceof ApiEditPage ) {
- return true;
+ if ( $this->isAPICaptchaModule( $module ) ) {
+ $desc['captchaid'] = 'CAPTCHA ID from previous request';
+ $desc['captchaword'] = 'Answer to the CAPTCHA';
}
- $desc['captchaid'] = 'CAPTCHA ID from previous request';
- $desc['captchaword'] = 'Answer to the CAPTCHA';
return true;
}