PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.22
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.22
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/FrmSettings.php +4 -170 6.266.22 View file →
@@ -4,92 +4,27 @@
4 4 }
5 5
6 6 #[\AllowDynamicProperties]
7 7 class FrmSettings {
8 -
9 - /**
10 - * @var string
11 - */
12 8 public $option_name = 'frm_options';
13 -
14 - /**
15 - * @var int
16 - */
17 9 public $menu;
18 -
19 - /**
20 - * @var int
21 - */
22 10 public $mu_menu;
23 -
24 - /**
25 - * @var int
26 - */
27 11 public $fade_form;
28 -
29 - /**
30 - * @var bool
31 - */
32 12 public $admin_bar;
33 13
34 - /**
35 - * @var string
36 - */
37 14 public $success_msg;
38 -
39 - /**
40 - * @var string
41 - */
42 15 public $blank_msg;
43 -
44 - /**
45 - * @var string
46 - */
47 16 public $unique_msg;
48 -
49 - /**
50 - * @var string
51 - */
52 17 public $invalid_msg;
53 -
54 - /**
55 - * @var string
56 - */
57 18 public $failed_msg;
58 -
59 - /**
60 - * @var string
61 - */
62 19 public $submit_value;
63 -
64 - /**
65 - * @var string
66 - */
67 20 public $login_msg;
68 -
69 - /**
70 - * @var string
71 - */
72 21 public $admin_permission;
73 22
74 - /**
75 - * @var string
76 - */
77 23 public $email_to;
78 -
79 - /**
80 - * @var string|null
81 - */
82 24 public $load_style;
83 -
84 - /**
85 - * @var bool|int|null
86 - */
87 25 public $custom_style;
88 26
89 - /**
90 - * @var string|null
91 - */
92 27 public $active_captcha;
93 28
94 29 /**
95 30 * Settings for reCAPTCHA.
@@ -103,32 +38,12 @@
103 38 /**
104 39 * @var string|null
105 40 */
106 41 public $privkey;
107 -
108 - /**
109 - * @var string|null
110 - */
111 42 public $re_lang;
112 -
113 - /**
114 - * @var string|null
115 - */
116 43 public $re_type;
117 -
118 - /**
119 - * @var string
120 - */
121 44 public $re_msg;
122 -
123 - /**
124 - * @var bool
125 - */
126 45 public $re_multi;
127 -
128 - /**
129 - * @var float|string|null
130 - */
131 46 public $re_threshold;
132 47
133 48 /**
134 49 * Settings for hCaptcha.
@@ -157,51 +72,17 @@
157 72 * @var string|null
158 73 */
159 74 public $turnstile_privkey;
160 75
161 - /**
162 - * @var bool
163 - */
164 76 public $no_ips;
165 -
166 - /**
167 - * @var string
168 - */
169 77 public $custom_header_ip;
170 -
171 - /**
172 - * @var int
173 - */
174 78 public $current_form = 0;
175 -
176 - /**
177 - * @var bool
178 - */
179 79 public $tracking;
180 -
181 - /**
182 - * @var bool
183 - */
184 80 public $summary_emails;
185 -
186 - /**
187 - * @var string
188 - */
189 81 public $summary_emails_recipients;
190 82
191 - /**
192 - * @var string|null
193 - */
194 83 public $default_email;
195 -
196 - /**
197 - * @var string
198 - */
199 84 public $from_email;
200 -
201 - /**
202 - * @var string|null
203 - */
204 85 public $currency;
205 86
206 87 /**
207 88 * @since 6.0
@@ -209,43 +90,18 @@
209 90 * @var false|string|null
210 91 */
211 92 public $custom_css;
212 93
213 - /**
214 - * @var string
215 - */
216 94 public $honeypot;
217 95
218 - /**
219 - * @var bool
220 - */
221 96 public $wp_spam_check;
222 97
223 - /**
224 - * @var bool
225 - */
226 98 public $denylist_check;
227 99
228 - /**
229 - * @since 6.25.1
230 - *
231 - * @var int|null 1 if installed after welcome tour update, null otherwise.
232 - */
233 - public $installed_after_welcome_tour_update;
234 -
235 - /**
236 - * @var string
237 - */
238 100 public $disallowed_words;
239 101
240 - /**
241 - * @var string
242 - */
243 102 public $allowed_words;
244 103
245 - /**
246 - * @param array $args
247 - */
248 104 public function __construct( $args = array() ) {
249 105 if ( ! defined( 'ABSPATH' ) ) {
250 106 die( 'You are not allowed to call this page directly.' );
251 107 }
@@ -265,13 +121,8 @@
265 121
266 122 $this->maybe_filter_for_form( $args );
267 123 }
268 124
269 - /**
270 - * @param false|object $settings
271 - *
272 - * @return object
273 - */
274 125 private function translate_settings( $settings ) {
275 126 if ( $settings ) {
276 127 // Workaround for W3 total cache conflict.
277 128 return unserialize( serialize( $settings ) );
@@ -326,9 +177,8 @@
326 177 'wp_spam_check' => 0,
327 178 'denylist_check' => 0,
328 179 'disallowed_words' => '',
329 180 'allowed_words' => '',
330 - 'email_style' => 'classic',
331 181 );
332 182 }
333 183
334 184 /**
@@ -348,9 +198,8 @@
348 198 $this->fill_with_defaults();
349 199
350 200 if ( is_multisite() && is_admin() ) {
351 201 $mu_menu = get_site_option( 'frm_admin_menu_name' );
352 -
353 202 if ( $mu_menu && ! empty( $mu_menu ) ) {
354 203 $this->menu = $mu_menu;
355 204 $this->mu_menu = 1;
356 205 }
@@ -356,9 +205,8 @@
356 205 }
357 206 }
358 207
359 208 $frm_roles = FrmAppHelper::frm_capabilities( 'pro' );
360 -
361 209 foreach ( $frm_roles as $frm_role => $frm_role_description ) {
362 210 if ( ! isset( $this->$frm_role ) ) {
363 211 $this->$frm_role = 'administrator';
364 212 }
@@ -374,9 +222,8 @@
374 222 }
375 223
376 224 /**
377 225 * @param array $params
378 - *
379 226 * @return void
380 227 */
381 228 public function fill_with_defaults( $params = array() ) {
382 229 $settings = $this->default_options();
@@ -383,9 +230,8 @@
383 230 $filter_html = ! FrmAppHelper::allow_unfiltered_html();
384 231
385 232 if ( $filter_html ) {
386 233 $filter_keys = array( 'failed_msg', 'blank_msg', 'invalid_msg', 'admin_permission', 'unique_msg', 'success_msg', 'submit_value', 'login_msg', 'menu' );
387 -
388 234 if ( ! empty( $params['additional_filter_keys'] ) ) {
389 235 $filter_keys = array_merge( $filter_keys, $params['additional_filter_keys'] );
390 236 }
391 237 } else {
@@ -415,9 +261,8 @@
415 261 *
416 262 * @param mixed $value The unsanitized global setting value.
417 263 * @param string $key The key of the global setting being saved.
418 264 * @param array $filter_keys These keys that are filtered with kses.
419 - *
420 265 * @return mixed
421 266 */
422 267 private function maybe_sanitize_global_setting( $value, $key, $filter_keys ) {
423 268 if ( 'custom_css' === $key ) {
@@ -456,11 +301,11 @@
456 301
457 302 if ( ! isset( $this->pubkey ) ) {
458 303 // Get the options from the database.
459 304 $recaptcha_opt = is_multisite() ? get_site_option( 'recaptcha' ) : get_option( 'recaptcha' );
460 - $this->pubkey = $recaptcha_opt['pubkey'] ?? '';
461 - $privkey = $recaptcha_opt['privkey'] ?? $privkey;
462 - $re_lang = $recaptcha_opt['re_lang'] ?? $re_lang;
305 + $this->pubkey = isset( $recaptcha_opt['pubkey'] ) ? $recaptcha_opt['pubkey'] : '';
306 + $privkey = isset( $recaptcha_opt['privkey'] ) ? $recaptcha_opt['privkey'] : $privkey;
307 + $re_lang = isset( $recaptcha_opt['re_lang'] ) ? $recaptcha_opt['re_lang'] : $re_lang;
463 308 }
464 309
465 310 if ( empty( $this->re_msg ) ) {
466 311 $this->re_msg = __( 'The CAPTCHA was not entered correctly', 'formidable' );
@@ -503,16 +348,13 @@
503 348 * Allow strings to be filtered when a specific form may be displaying them.
504 349 *
505 350 * @since 3.06.01
506 351 *
507 - * @param array $args
508 - *
509 352 * @return void
510 353 */
511 354 public function maybe_filter_for_form( $args ) {
512 355 if ( isset( $args['current_form'] ) && is_numeric( $args['current_form'] ) ) {
513 356 $this->current_form = $args['current_form'];
514 -
515 357 foreach ( $this->translatable_strings() as $string ) {
516 358 $this->{$string} = apply_filters( 'frm_global_setting', $this->{$string}, $string, $this );
517 359 $this->{$string} = apply_filters( 'frm_global_' . $string, $this->{$string}, $this );
518 360 }
@@ -521,10 +363,8 @@
521 363
522 364 /**
523 365 * @param array $params
524 366 * @param array $errors
525 - *
526 - * @return array
527 367 */
528 368 public function validate( $params, $errors ) {
529 369 return apply_filters( 'frm_validate_settings', $errors, $params );
530 370 }
@@ -556,9 +396,8 @@
556 396 }
557 397
558 398 /**
559 399 * @param array $params
560 - *
561 400 * @return void
562 401 */
563 402 private function update_settings( $params ) {
564 403 $this->active_captcha = $params['frm_active_captcha'];
@@ -591,9 +430,8 @@
591 430 'honeypot',
592 431 'wp_spam_check',
593 432 'denylist_check',
594 433 );
595 -
596 434 foreach ( $checkboxes as $set ) {
597 435 $this->$set = isset( $params[ 'frm_' . $set ] ) ? absint( $params[ 'frm_' . $set ] ) : 0;
598 436 }
599 437 }
@@ -598,10 +436,8 @@
598 436 }
599 437 }
600 438
601 439 /**
602 - * @param array $params
603 - *
604 440 * @return void
605 441 */
606 442 private function update_roles( $params ) {
607 443 global $wp_roles;
@@ -607,11 +443,10 @@
607 443 global $wp_roles;
608 444
609 445 $frm_roles = FrmAppHelper::frm_capabilities();
610 446 $roles = get_editable_roles();
611 -
612 447 foreach ( $frm_roles as $frm_role => $frm_role_description ) {
613 - $this->$frm_role = (array) ( $params[ $frm_role ] ?? 'administrator' );
448 + $this->$frm_role = (array) ( isset( $params[ $frm_role ] ) ? $params[ $frm_role ] : 'administrator' );
614 449
615 450 // Make sure administrators always have permissions
616 451 if ( ! in_array( 'administrator', $this->$frm_role, true ) ) {
617 452 array_push( $this->$frm_role, 'administrator' );
@@ -634,9 +469,8 @@
634 469 *
635 470 * @param string $key The setting key to update.
636 471 * @param mixed $value The new value for the setting.
637 472 * @param string $sanitize The name of the sanitization function to apply to the new value.
638 - *
639 473 * @return bool True on success, false on failure.
640 474 */
641 475 public function update_setting( $key, $value, $sanitize ) {
642 476 if ( ! property_exists( $this, $key ) || ! is_callable( $sanitize ) ) {