null ]; parent::__construct( $params ); $this->key = $params['key']; $this->error = $params['error']; $this->mName = 'cf-turnstile-response'; } /** @inheritDoc */ public function getInputHTML( $value ) { $out = $this->mParent->getOutput(); $lang = htmlspecialchars( urlencode( $this->mParent->getLanguage()->getCode() ) ); // Insert the Turnstile script, in display language, if available. // Language falls back to the browser's display language. // See https://developers.cloudflare.com/turnstile/reference/supported-languages/ $out->addHeadItem( 'cf-turnstile-script', "" ); Turnstile::addCSPSources( $out->getCSP() ); return Html::element( 'div', [ 'class' => [ 'cf-turnstile', 'mw-confirmedit-captcha-fail' => (bool)$this->error, ], 'data-sitekey' => $this->key, ] ); } }