2018-12-07 20:44:46 +00:00
|
|
|
<?php
|
|
|
|
|
2022-04-08 16:53:12 +00:00
|
|
|
namespace MediaWiki\Extension\ConfirmEdit\ReCaptchaNoCaptcha;
|
|
|
|
|
2023-08-15 10:11:58 +00:00
|
|
|
use Config;
|
|
|
|
use MediaWiki\ResourceLoader\Hook\ResourceLoaderGetConfigVarsHook;
|
|
|
|
|
|
|
|
class Hooks implements ResourceLoaderGetConfigVarsHook {
|
2018-12-07 20:44:46 +00:00
|
|
|
/**
|
|
|
|
* Adds extra variables to the global config
|
|
|
|
*
|
|
|
|
* @param array &$vars Global variables object
|
2023-08-15 10:11:58 +00:00
|
|
|
* @param string $skin
|
|
|
|
* @param Config $config
|
2018-12-07 20:44:46 +00:00
|
|
|
*/
|
2023-08-15 10:11:58 +00:00
|
|
|
public function onResourceLoaderGetConfigVars( array &$vars, $skin, Config $config ): void {
|
2018-12-07 20:44:46 +00:00
|
|
|
global $wgReCaptchaSiteKey;
|
|
|
|
global $wgCaptchaClass;
|
|
|
|
|
2022-12-13 20:42:56 +00:00
|
|
|
if ( $wgCaptchaClass === ReCaptchaNoCaptcha::class ) {
|
2018-12-07 20:44:46 +00:00
|
|
|
$vars['wgConfirmEditConfig'] = [
|
|
|
|
'reCaptchaSiteKey' => $wgReCaptchaSiteKey,
|
2020-04-17 15:18:38 +00:00
|
|
|
'reCaptchaScriptURL' => 'https://www.recaptcha.net/recaptcha/api.js'
|
2018-12-07 20:44:46 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|