diff --git a/ReCaptchaNoCaptcha/includes/Hooks.php b/ReCaptchaNoCaptcha/includes/Hooks.php index 9b28b0150..4aad208ef 100644 --- a/ReCaptchaNoCaptcha/includes/Hooks.php +++ b/ReCaptchaNoCaptcha/includes/Hooks.php @@ -14,12 +14,9 @@ class Hooks implements ResourceLoaderGetConfigVarsHook { * @param Config $config */ public function onResourceLoaderGetConfigVars( array &$vars, $skin, Config $config ): void { - global $wgReCaptchaSiteKey; - global $wgCaptchaClass; - - if ( $wgCaptchaClass === ReCaptchaNoCaptcha::class ) { + if ( $config->get( 'CaptchaClass' ) === ReCaptchaNoCaptcha::class ) { $vars['wgConfirmEditConfig'] = [ - 'reCaptchaSiteKey' => $wgReCaptchaSiteKey, + 'reCaptchaSiteKey' => $config->get( 'ReCaptchaSiteKey' ), 'reCaptchaScriptURL' => 'https://www.recaptcha.net/recaptcha/api.js' ]; } diff --git a/Turnstile/includes/Hooks.php b/Turnstile/includes/Hooks.php index d80b7ac52..2f6f50cb9 100644 --- a/Turnstile/includes/Hooks.php +++ b/Turnstile/includes/Hooks.php @@ -14,12 +14,9 @@ class Hooks implements ResourceLoaderGetConfigVarsHook { * @param Config $config */ public function onResourceLoaderGetConfigVars( array &$vars, $skin, Config $config ): void { - global $wgTurnstileSiteKey; - global $wgCaptchaClass; - - if ( $wgCaptchaClass === Turnstile::class ) { + if ( $config->get( 'CaptchaClass' ) === Turnstile::class ) { $vars['wgConfirmEditConfig'] = [ - 'turnstileSiteKey' => $wgTurnstileSiteKey, + 'turnstileSiteKey' => $config->get( 'TurnstileSiteKey' ), 'turnstileScriptURL' => 'https://challenges.cloudflare.com/turnstile/v0/api.js' ]; }