PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.2.2
Defender Security – Malware Scanner, Login Security & Firewall v6.2.2
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / src / component / captcha / interface-provider.php

interface-provider.php in Defender Security – Malware Scanner, Login Security & Firewall 6.2.2, at src/component/captcha/interface-provider.php

152 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Captcha provider interface.
4 *
5 * @package WP_Defender\Component\Captcha
6 */
7
8 namespace WP_Defender\Component\Captcha;
9
10 use WP_Defender\Integrations\Buddypress;
11 use WP_Defender\Integrations\Woocommerce;
12
13 /**
14 * Interface for captcha providers.
15 *
16 * Defines the contract for all captcha provider implementations.
17 */
18 interface Interface_Provider {
19 /**
20 * Get the captcha response token from the current request.
21 *
22 * @return string The response token or empty string if not found.
23 */
24 public function get_response(): string;
25
26 /**
27 * Get API script URL.
28 *
29 * @return string
30 */
31 public function get_api_url(): string;
32
33 /**
34 * Get verification URL.
35 *
36 * @return string
37 */
38 public function get_verify_url(): string;
39
40 /**
41 * Get script handle name.
42 *
43 * @return string
44 */
45 public function get_script_handle(): string;
46
47 /**
48 * Get frontend script URL.
49 *
50 * @return string
51 */
52 public function get_script_url(): string;
53
54 /**
55 * Get provider name.
56 *
57 * @param bool $is_type Get provider name by type.
58 *
59 * @return string
60 */
61 public function get_name( bool $is_type = false ): string;
62
63 /**
64 * Get widget options.
65 *
66 * @return array
67 */
68 public function get_options(): array;
69
70 /**
71 * Render the provider widget HTML.
72 *
73 * @return string
74 */
75 public function render_widget(): string;
76
77 /**
78 * Get API script configuration.
79 *
80 * @return array
81 */
82 public function get_api_script(): array;
83
84 /**
85 * Get list of excluded requests.
86 *
87 * @return array
88 */
89 public function get_excluded_requests(): array;
90
91 /**
92 * Get list of duplicate script handles.
93 *
94 * @return array
95 */
96 public function get_duplicate_script_handles(): array;
97
98 /**
99 * Get regex pattern for duplicate scripts.
100 *
101 * @return string
102 */
103 public function get_duplicate_script_pattern(): string;
104
105 /**
106 * Verify a captcha response token via remote request.
107 *
108 * @param string $token Response token.
109 * @param string $url Endpoint URL.
110 * @param array $body Additional request body data.
111 *
112 * @return array
113 */
114 public function verify_response_token( string $token, string $url, array $body = array() ): array;
115
116 /**
117 * Get formatted error message for display.
118 *
119 * @return string
120 */
121 public function error_message(): string;
122
123 /**
124 * Determine whether to skip checks for this form.
125 *
126 * @param Woocommerce $woo WooCommerce integration.
127 * @param Buddypress $buddypress BuddyPress integration.
128 *
129 * @return bool
130 */
131 public function should_skip_check( Woocommerce $woo, Buddypress $buddypress ): bool;
132
133 /**
134 * Verify response for a specific form.
135 *
136 * @param string $form Form identifier.
137 *
138 * @return bool
139 */
140 public function verify_response( string $form ): bool;
141
142 /**
143 * Build admin notice data for the captcha settings UI.
144 *
145 * @param bool $is_woo_activated Whether WooCommerce is active.
146 * @param bool $is_buddypress_activated Whether BuddyPress is active.
147 *
148 * @return array
149 */
150 public function get_notice_data( bool $is_woo_activated, bool $is_buddypress_activated ): array;
151 }
152