PluginProbe
The Innovative Form Builder – IvyForms / 0.8.2
The Innovative Form Builder – IvyForms v0.8.2
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / backend / src / Services / Security / Turnstile / TurnstileConfigProvider.php

TurnstileConfigProvider.php in The Innovative Form Builder – IvyForms 0.8.2, at backend/src/Services/Security/Turnstile/TurnstileConfigProvider.php

51 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * @copyright © Melograno Venture Studio. All rights reserved.
5 * @licence See COPYING.md for license details.
6 */
7
8 namespace IvyForms\Services\Security\Turnstile;
9
10 // phpcs:disable PSR1.Files.SideEffects
11 if (!defined('ABSPATH')) {
12 exit; // Exit if accessed directly
13 }
14
15 use IvyForms\Services\Security\Common\CaptchaServiceInterface;
16
17 /**
18 * Provides Turnstile frontend configuration
19 *
20 * @package IvyForms\Services\Security\Turnstile
21 */
22 class TurnstileConfigProvider
23 {
24 /**
25 * Get Turnstile configuration for frontend
26 *
27 * @param CaptchaServiceInterface|null $service
28 * @return array<string, mixed>
29 */
30 public function getConfig(?CaptchaServiceInterface $service): array
31 {
32 $config = [
33 'configured' => false,
34 'siteKey' => '',
35 'scriptUrl' => '',
36 'theme' => 'auto'
37 ];
38
39 if ($service && $service->isConfigured()) {
40 $turnstileConfig = $service->getFrontendConfig(
41 $service->getType(),
42 $service->getSiteKey()
43 );
44 $turnstileConfig['configured'] = true;
45 return $turnstileConfig;
46 }
47
48 return $config;
49 }
50 }
51