Go to the documentation of this file.
24 protected function keyMatch( $answer, $info ) {
25 if ( is_array( $info[
'answer'] ) ) {
26 return in_array( strtolower( $answer ), array_map(
'strtolower', $info[
'answer'] ) );
28 return strtolower( $answer ) == strtolower( $info[
'answer'] );
39 $resultArr[
'captcha'][
'id'] = $index;
40 $resultArr[
'captcha'][
'question'] = $captcha[
'question'];
49 'mime' =>
'text/html',
57 global $wgCaptchaQuestions;
60 if ( $wgCaptchaQuestions === array_values( $wgCaptchaQuestions ) ) {
61 return $wgCaptchaQuestions[ mt_rand( 0, count( $wgCaptchaQuestions ) - 1 ) ];
64 $question = array_rand( $wgCaptchaQuestions, 1 );
65 $answer = $wgCaptchaQuestions[ $question ];
66 return [
'question' => $question,
'answer' => $answer ];
77 "No questions found; set some in LocalSettings.php using the format from QuestyCaptcha.php."
82 'html' =>
"<p><label for=\"wpCaptchaWord\">{$captcha['question']}</label> " .
83 Html::element(
'input', [
84 'name' =>
'wpCaptchaWord',
85 'id' =>
'wpCaptchaWord',
86 'class' =>
'mw-ui-input',
88 'autocomplete' =>
'off',
90 'tabindex' => $tabIndex ] ) .
94 'name' =>
'wpCaptchaId',
95 'id' =>
'wpCaptchaId',
103 $wgOut->addWikiMsg(
'questycaptchahelp-text' );
105 $wgOut->addWikiMsg(
'captchahelp-cookies-needed' );
115 return $captchaData[
'question'];
125 array &$formDescriptor,
$action ) {
128 AuthenticationRequest::getRequestByClass( $requests,
129 CaptchaAuthenticationRequest::class,
true );
135 $formDescriptor[
'captchaInfo'][
'raw'] =
true;
136 $formDescriptor[
'captchaWord'][
'label-message'] =
null;
getFormInformation( $tabIndex=1)
static get()
Get somewhere to store captcha data that will persist between requests.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
string $action
Used to select the right message.
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
getCaptchaInfo( $captchaData, $id)
Demo CAPTCHA (not for production usage) and base class for real CAPTCHAs.
storeCaptcha( $info)
Generate a captcha session ID and save the info in PHP's session storage.
keyMatch( $answer, $info)
Validate a captcha response.
onAuthChangeFormFields(array $requests, array $fieldInfo, array &$formDescriptor, $action)
addCaptchaAPI(&$resultArr)
showHelp()
Show a page explaining what this wacky thing is.