Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| Hooks | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
| onResourceLoaderGetConfigVars | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Extension\ConfirmEdit\Turnstile; |
| 4 | |
| 5 | use MediaWiki\Config\Config; |
| 6 | use MediaWiki\ResourceLoader\Hook\ResourceLoaderGetConfigVarsHook; |
| 7 | |
| 8 | class Hooks implements ResourceLoaderGetConfigVarsHook { |
| 9 | /** |
| 10 | * Adds extra variables to the global config |
| 11 | * |
| 12 | * @param array &$vars Global variables object |
| 13 | * @param string $skin |
| 14 | * @param Config $config |
| 15 | */ |
| 16 | public function onResourceLoaderGetConfigVars( array &$vars, $skin, Config $config ): void { |
| 17 | if ( $config->get( 'CaptchaClass' ) === Turnstile::class ) { |
| 18 | $vars['wgConfirmEditConfig'] = [ |
| 19 | 'turnstileSiteKey' => $config->get( 'TurnstileSiteKey' ), |
| 20 | 'turnstileScriptURL' => 'https://challenges.cloudflare.com/turnstile/v0/api.js' |
| 21 | ]; |
| 22 | } |
| 23 | } |
| 24 | } |