| @@ -173,9 +173,9 @@ | ||
| 173 | 173 | */ |
| 174 | 174 | public $current_form = 0; |
| 175 | 175 | |
| 176 | 176 | /** |
| 177 | - * @var bool | |
| 177 | + * @var bool|int | |
| 178 | 178 | */ |
| 179 | 179 | public $tracking; |
| 180 | 180 | |
| 181 | 181 | /** |
| @@ -210,9 +210,9 @@ | ||
| 210 | 210 | */ |
| 211 | 211 | public $custom_css; |
| 212 | 212 | |
| 213 | 213 | /** |
| 214 | - * @var string | |
| 214 | + * @var int | |
| 215 | 215 | */ |
| 216 | 216 | public $honeypot; |
| 217 | 217 | |
| 218 | 218 | /** |
| @@ -279,9 +279,9 @@ | ||
| 279 | 279 | |
| 280 | 280 | // If unserializing didn't work. |
| 281 | 281 | $settings = $this; |
| 282 | 282 | |
| 283 | - update_option( $this->option_name, $settings, 'yes' ); | |
| 283 | + update_option( $this->option_name, $settings, true ); | |
| 284 | 284 | |
| 285 | 285 | return $settings; |
| 286 | 286 | } |
| 287 | 287 | |
| @@ -349,9 +349,9 @@ | ||
| 349 | 349 | |
| 350 | 350 | if ( is_multisite() && is_admin() ) { |
| 351 | 351 | $mu_menu = get_site_option( 'frm_admin_menu_name' ); |
| 352 | 352 | |
| 353 | - if ( $mu_menu && ! empty( $mu_menu ) ) { | |
| 353 | + if ( $mu_menu && $mu_menu ) { | |
| 354 | 354 | $this->menu = $mu_menu; |
| 355 | 355 | $this->mu_menu = 1; |
| 356 | 356 | } |
| 357 | 357 | } |
| @@ -424,8 +424,9 @@ | ||
| 424 | 424 | if ( false === $value ) { |
| 425 | 425 | // Avoid changing the false default value to an empty string. |
| 426 | 426 | return $value; |
| 427 | 427 | } |
| 428 | + | |
| 428 | 429 | return sanitize_textarea_field( $value ); |
| 429 | 430 | } |
| 430 | 431 | |
| 431 | 432 | if ( in_array( $key, $filter_keys, true ) ) { |
| @@ -461,9 +462,9 @@ | ||
| 461 | 462 | $privkey = $recaptcha_opt['privkey'] ?? $privkey; |
| 462 | 463 | $re_lang = $recaptcha_opt['re_lang'] ?? $re_lang; |
| 463 | 464 | } |
| 464 | 465 | |
| 465 | - if ( empty( $this->re_msg ) ) { | |
| 466 | + if ( ! $this->re_msg ) { | |
| 466 | 467 | $this->re_msg = __( 'The CAPTCHA was not entered correctly', 'formidable' ); |
| 467 | 468 | } |
| 468 | 469 | |
| 469 | 470 | if ( ! isset( $this->privkey ) ) { |
| @@ -508,15 +509,17 @@ | ||
| 508 | 509 | * |
| 509 | 510 | * @return void |
| 510 | 511 | */ |
| 511 | 512 | public function maybe_filter_for_form( $args ) { |
| 512 | - if ( isset( $args['current_form'] ) && is_numeric( $args['current_form'] ) ) { | |
| 513 | - $this->current_form = $args['current_form']; | |
| 513 | + if ( ! isset( $args['current_form'] ) || ! is_numeric( $args['current_form'] ) ) { | |
| 514 | + return; | |
| 515 | + } | |
| 514 | 516 | |
| 515 | - foreach ( $this->translatable_strings() as $string ) { | |
| 516 | - $this->{$string} = apply_filters( 'frm_global_setting', $this->{$string}, $string, $this ); | |
| 517 | - $this->{$string} = apply_filters( 'frm_global_' . $string, $this->{$string}, $this ); | |
| 518 | - } | |
| 517 | + $this->current_form = $args['current_form']; | |
| 518 | + | |
| 519 | + foreach ( $this->translatable_strings() as $string ) { | |
| 520 | + $this->{$string} = apply_filters( 'frm_global_setting', $this->{$string}, $string, $this ); | |
| 521 | + $this->{$string} = apply_filters( 'frm_global_' . $string, $this->{$string}, $this ); | |
| 519 | 522 | } |
| 520 | 523 | } |
| 521 | 524 | |
| 522 | 525 | /** |
| @@ -547,13 +550,15 @@ | ||
| 547 | 550 | $this->update_roles( $params ); |
| 548 | 551 | |
| 549 | 552 | do_action( 'frm_update_settings', $params ); |
| 550 | 553 | |
| 551 | - if ( function_exists( 'get_filesystem_method' ) ) { | |
| 552 | - // Save styling settings in case fallback setting changes. | |
| 553 | - $frm_style = new FrmStyle(); | |
| 554 | - $frm_style->update( 'default' ); | |
| 554 | + if ( ! function_exists( 'get_filesystem_method' ) ) { | |
| 555 | + return; | |
| 555 | 556 | } |
| 557 | + | |
| 558 | + // Save styling settings in case fallback setting changes. | |
| 559 | + $frm_style = new FrmStyle(); | |
| 560 | + $frm_style->update( 'default' ); | |
| 556 | 561 | } |
| 557 | 562 | |
| 558 | 563 | /** |
| 559 | 564 | * @param array $params |
| @@ -617,9 +622,9 @@ | ||
| 617 | 622 | array_push( $this->$frm_role, 'administrator' ); |
| 618 | 623 | } |
| 619 | 624 | |
| 620 | 625 | foreach ( $roles as $role => $details ) { |
| 621 | - if ( in_array( $role, $this->$frm_role ) ) { | |
| 626 | + if ( in_array( $role, $this->$frm_role, true ) ) { | |
| 622 | 627 | $wp_roles->add_cap( $role, $frm_role ); |
| 623 | 628 | } else { |
| 624 | 629 | $wp_roles->remove_cap( $role, $frm_role ); |
| 625 | 630 | } |