2018-12-07 20:44:46 +00:00
|
|
|
<?php
|
|
|
|
|
2022-04-08 16:53:12 +00:00
|
|
|
namespace MediaWiki\Extension\ConfirmEdit\ReCaptchaNoCaptcha;
|
|
|
|
|
2023-12-10 23:07:55 +00:00
|
|
|
use MediaWiki\Config\Config;
|
2023-08-15 10:11:58 +00:00
|
|
|
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 {
|
2024-04-26 20:40:13 +00:00
|
|
|
if ( $config->get( 'CaptchaClass' ) === ReCaptchaNoCaptcha::class ) {
|
2018-12-07 20:44:46 +00:00
|
|
|
$vars['wgConfirmEditConfig'] = [
|
2024-04-26 20:40:13 +00:00
|
|
|
'reCaptchaSiteKey' => $config->get( 'ReCaptchaSiteKey' ),
|
2020-04-17 15:18:38 +00:00
|
|
|
'reCaptchaScriptURL' => 'https://www.recaptcha.net/recaptcha/api.js'
|
2018-12-07 20:44:46 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|