mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-12-13 08:39:36 +00:00
8d3afbd390
Bug: T319068 Follows-Up: I0d5a74655619975f0bf61b5b672159afe5f4fb00 Change-Id: I15c26957158f22a0b6d6abb9def0e84e73c63ddc
28 lines
754 B
PHP
28 lines
754 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\ConfirmEdit\Turnstile;
|
|
|
|
use MediaWiki\Config\Config;
|
|
use MediaWiki\ResourceLoader\Hook\ResourceLoaderGetConfigVarsHook;
|
|
|
|
class Hooks implements ResourceLoaderGetConfigVarsHook {
|
|
/**
|
|
* Adds extra variables to the global config
|
|
*
|
|
* @param array &$vars Global variables object
|
|
* @param string $skin
|
|
* @param Config $config
|
|
*/
|
|
public function onResourceLoaderGetConfigVars( array &$vars, $skin, Config $config ): void {
|
|
global $wgTurnstileSiteKey;
|
|
global $wgCaptchaClass;
|
|
|
|
if ( $wgCaptchaClass === Turnstile::class ) {
|
|
$vars['wgConfirmEditConfig'] = [
|
|
'turnstileSiteKey' => $wgTurnstileSiteKey,
|
|
'turnstileScriptURL' => 'https://challenges.cloudflare.com/turnstile/v0/api.js'
|
|
];
|
|
}
|
|
}
|
|
}
|