null ]; parent::__construct( $params ); $this->key = $params['key']; $this->error = $params['error']; $this->mName = 'g-recaptcha-response'; } /** * @inheritDoc */ public function getInputHTML( $value ) { $out = $this->mParent->getOutput(); $lang = htmlspecialchars( urlencode( $this->mParent->getLanguage()->getCode() ) ); // Insert reCAPTCHA script, in display language, if available. // Language falls back to the browser's display language. // See https://developers.google.com/recaptcha/docs/faq $out->addHeadItem( 'g-recaptchascript', "" ); ReCaptchaNoCaptcha::addCSPSources( $out->getCSP() ); $output = Html::element( 'div', [ 'class' => [ 'g-recaptcha', 'mw-confirmedit-captcha-fail' => (bool)$this->error, ], 'data-sitekey' => $this->key, ] ); $htmlUrlencoded = htmlspecialchars( urlencode( $this->key ) ); $output .= <<
HTML; return $output; } }