PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.5.4
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.5.4
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/models/fields/FrmFieldCaptcha.php +7 -36 6.5.15.5.4 View file →
@@ -28,9 +28,11 @@
28 28 */
29 29 public static function get_captcha_image_name() {
30 30 $frm_settings = FrmAppHelper::get_settings();
31 31 $active_captcha = $frm_settings->active_captcha;
32 - if ( $active_captcha === 'recaptcha' && $frm_settings->re_type === 'v3' ) {
32 + if ( ! self::should_show_captcha() ) {
33 + $image_name = 'captcha_not_setup';
34 + } elseif ( $active_captcha === 'recaptcha' && $frm_settings->re_type === 'v3' ) {
33 35 $image_name = 'recaptcha_v3';
34 36 } else {
35 37 $image_name = $active_captcha;
36 38 }
@@ -87,11 +89,8 @@
87 89
88 90 return $replaced_for;
89 91 }
90 92
91 - /**
92 - * @return string
93 - */
94 93 public function front_field_input( $args, $shortcode_atts ) {
95 94 $frm_settings = FrmAppHelper::get_settings();
96 95 if ( ! self::should_show_captcha() ) {
97 96 return '';
@@ -103,9 +102,9 @@
103 102 $allow_mutiple = $frm_settings->re_multi;
104 103
105 104 if ( $frm_settings->active_captcha === 'recaptcha' ) {
106 105 $site_key = $frm_settings->pubkey;
107 - $recaptcha_options = ' data-size="' . esc_attr( $captcha_size ) . '" data-theme="' . esc_attr( $this->field['captcha_theme'] ) . '"';
106 + $recaptcha_options = '" data-size="' . esc_attr( $captcha_size ) . '" data-theme="' . esc_attr( $this->field['captcha_theme'] ) . '"';
108 107 } else {
109 108 $site_key = $frm_settings->hcaptcha_pubkey;
110 109 }
111 110
@@ -118,11 +117,8 @@
118 117
119 118 return $html;
120 119 }
121 120
122 - /**
123 - * @return void
124 - */
125 121 protected function load_field_scripts( $args ) {
126 122 $api_js_url = $this->api_url();
127 123
128 124 wp_register_script( 'captcha-api', $api_js_url, array( 'formidable' ), '3', true );
@@ -137,11 +133,8 @@
137 133
138 134 return $this->hcaptcha_api_url();
139 135 }
140 136
141 - /**
142 - * @param FrmSettings $frm_settings
143 - */
144 137 protected function recaptcha_api_url( $frm_settings ) {
145 138 $api_js_url = 'https://www.google.com/recaptcha/api.js?';
146 139
147 140 $allow_mutiple = $frm_settings->re_multi;
@@ -164,9 +157,9 @@
164 157
165 158 /**
166 159 * Allows updating hcaptcha js api url.
167 160 *
168 - * @since 6.0
161 + * @since x.x
169 162 *
170 163 * @param string $api_js_url
171 164 */
172 165 $api_js_url = apply_filters( 'frm_hcaptcha_js_url', $api_js_url );
@@ -173,15 +166,8 @@
173 166
174 167 return $api_js_url;
175 168 }
176 169
177 - /**
178 - * @param FrmSettings $frm_settings
179 - *
180 - * @return string
181 - *
182 - * @psalm-return ''|'frm-'
183 - */
184 170 protected function class_prefix( $frm_settings ) {
185 171 if ( $this->allow_multiple( $frm_settings ) && $frm_settings->active_captcha === 'recaptcha' ) {
186 172 $class_prefix = 'frm-';
187 173 } else {
@@ -190,15 +176,8 @@
190 176
191 177 return $class_prefix;
192 178 }
193 179
194 - /**
195 - * @param FrmSettings $frm_settings
196 - *
197 - * @return string
198 - *
199 - * @psalm-return 'g-recaptcha'|'h-captcha'
200 - */
201 180 protected function captcha_class( $frm_settings ) {
202 181 return $frm_settings->active_captcha === 'recaptcha' ? 'g-recaptcha' : 'h-captcha';
203 182 }
204 183
@@ -207,10 +186,8 @@
207 186 }
208 187
209 188 /**
210 189 * @return string
211 - *
212 - * @param FrmSettings $frm_settings
213 190 */
214 191 protected function captcha_size( $frm_settings ) {
215 192 if ( in_array( $frm_settings->re_type, array( 'invisible', 'v3' ), true ) ) {
216 193 return 'invisible';
@@ -311,11 +288,8 @@
311 288
312 289 return ! empty( $frm_settings->hcaptcha_pubkey );
313 290 }
314 291
315 - /**
316 - * @return bool
317 - */
318 292 protected function should_validate() {
319 293 $is_hidden_field = apply_filters( 'frm_is_field_hidden', false, $this->field, wp_unslash( $_POST ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
320 294 if ( FrmAppHelper::is_admin() || $is_hidden_field ) {
321 295 return false;
@@ -324,11 +298,8 @@
324 298 // don't require the captcha if it shouldn't be shown
325 299 return self::should_show_captcha();
326 300 }
327 301
328 - /**
329 - * @param FrmSettings $frm_settings
330 - */
331 302 protected function send_api_check( $frm_settings ) {
332 303 $captcha_settings = new FrmFieldCaptchaSettings( $frm_settings );
333 304
334 305 $arg_array = array(
@@ -344,9 +315,9 @@
344 315
345 316 /**
346 317 * Updates field name in page builder to the currently activated captcha if it is set to the default.
347 318 *
348 - * @since 6.0
319 + * @since x.x
349 320 *
350 321 * @param array $values
351 322 *
352 323 * @return array $values
@@ -354,9 +325,9 @@
354 325 public static function update_field_name( $values ) {
355 326 if ( $values['type'] === 'captcha' ) {
356 327 $name = $values['name'];
357 328 if ( in_array( $name, array( __( 'reCAPTCHA', 'formidable' ), __( 'hCaptcha', 'formidable' ) ), true ) ) {
358 - $values['name'] = __( 'Captcha', 'formidable' );
329 + $values['name'] = __( 'CAPTCHA', 'formidable' );
359 330 }
360 331 }
361 332
362 333 return $values;