| @@ -7,9 +7,13 @@ | ||
| 7 | 7 | class FrmSettings { |
| 8 | 8 | public $option_name = 'frm_options'; |
| 9 | 9 | public $menu; |
| 10 | 10 | public $mu_menu; |
| 11 | + public $use_html; | |
| 12 | + public $jquery_css; | |
| 13 | + public $accordion_js; | |
| 11 | 14 | public $fade_form; |
| 15 | + public $old_css; | |
| 12 | 16 | public $admin_bar; |
| 13 | 17 | |
| 14 | 18 | public $success_msg; |
| 15 | 19 | public $blank_msg; |
| @@ -42,9 +46,8 @@ | ||
| 42 | 46 | public $re_lang; |
| 43 | 47 | public $re_type; |
| 44 | 48 | public $re_msg; |
| 45 | 49 | public $re_multi; |
| 46 | - public $re_threshold; | |
| 47 | 50 | |
| 48 | 51 | /** |
| 49 | 52 | * Settings for hCaptcha. |
| 50 | 53 | */ |
| @@ -80,9 +83,8 @@ | ||
| 80 | 83 | public $summary_emails; |
| 81 | 84 | public $summary_emails_recipients; |
| 82 | 85 | |
| 83 | 86 | public $default_email; |
| 84 | - public $from_email; | |
| 85 | 87 | public $currency; |
| 86 | 88 | |
| 87 | 89 | /** |
| 88 | 90 | * @since 6.0 |
| @@ -90,18 +92,8 @@ | ||
| 90 | 92 | * @var false|string|null |
| 91 | 93 | */ |
| 92 | 94 | public $custom_css; |
| 93 | 95 | |
| 94 | - public $honeypot; | |
| 95 | - | |
| 96 | - public $wp_spam_check; | |
| 97 | - | |
| 98 | - public $denylist_check; | |
| 99 | - | |
| 100 | - public $disallowed_words; | |
| 101 | - | |
| 102 | - public $allowed_words; | |
| 103 | - | |
| 104 | 96 | public function __construct( $args = array() ) { |
| 105 | 97 | if ( ! defined( 'ABSPATH' ) ) { |
| 106 | 98 | die( 'You are not allowed to call this page directly.' ); |
| 107 | 99 | } |
| @@ -142,9 +134,13 @@ | ||
| 142 | 134 | public function default_options() { |
| 143 | 135 | return array( |
| 144 | 136 | 'menu' => apply_filters( 'frm_default_menu', 'Formidable' ), |
| 145 | 137 | 'mu_menu' => 0, |
| 138 | + 'use_html' => true, | |
| 139 | + 'jquery_css' => false, | |
| 140 | + 'accordion_js' => false, | |
| 146 | 141 | 'fade_form' => false, |
| 142 | + 'old_css' => false, | |
| 147 | 143 | 'admin_bar' => false, |
| 148 | 144 | |
| 149 | 145 | 're_multi' => 1, |
| 150 | 146 | |
| @@ -160,12 +156,11 @@ | ||
| 160 | 156 | 'admin_permission' => __( 'You do not have permission to do that', 'formidable' ), |
| 161 | 157 | 'new_tab_msg' => __( 'The page has been opened in a new tab.', 'formidable' ), |
| 162 | 158 | |
| 163 | 159 | 'email_to' => '[admin_email]', |
| 164 | - 'enable_gdpr' => 0, | |
| 165 | - 'no_gdpr_cookies' => 0, | |
| 166 | 160 | 'no_ips' => 0, |
| 167 | - 'custom_header_ip' => 0, | |
| 161 | + // Use false by default. We show a warning when this is unset. Once global settings have been saved, this gets saved. | |
| 162 | + 'custom_header_ip' => false, | |
| 168 | 163 | 'tracking' => FrmAppHelper::pro_is_installed(), |
| 169 | 164 | // Only enable this by default for the main site. |
| 170 | 165 | 'summary_emails' => get_current_blog_id() === get_main_site_id(), |
| 171 | 166 | 'summary_emails_recipients' => '[admin_email]', |
| @@ -172,14 +167,8 @@ | ||
| 172 | 167 | |
| 173 | 168 | // Normally custom CSS is a string. A false value is used when nothing has been set. |
| 174 | 169 | // When it is false, we try to use the old custom_key value from the default style's post_content array. |
| 175 | 170 | 'custom_css' => false, |
| 176 | - 'honeypot' => 1, | |
| 177 | - 'wp_spam_check' => 0, | |
| 178 | - 'denylist_check' => 0, | |
| 179 | - 'disallowed_words' => '', | |
| 180 | - 'allowed_words' => '', | |
| 181 | - 'email_style' => 'classic', | |
| 182 | 171 | ); |
| 183 | 172 | } |
| 184 | 173 | |
| 185 | 174 | /** |
| @@ -302,11 +291,11 @@ | ||
| 302 | 291 | |
| 303 | 292 | if ( ! isset( $this->pubkey ) ) { |
| 304 | 293 | // Get the options from the database. |
| 305 | 294 | $recaptcha_opt = is_multisite() ? get_site_option( 'recaptcha' ) : get_option( 'recaptcha' ); |
| 306 | - $this->pubkey = $recaptcha_opt['pubkey'] ?? ''; | |
| 307 | - $privkey = $recaptcha_opt['privkey'] ?? $privkey; | |
| 308 | - $re_lang = $recaptcha_opt['re_lang'] ?? $re_lang; | |
| 295 | + $this->pubkey = isset( $recaptcha_opt['pubkey'] ) ? $recaptcha_opt['pubkey'] : ''; | |
| 296 | + $privkey = isset( $recaptcha_opt['privkey'] ) ? $recaptcha_opt['privkey'] : $privkey; | |
| 297 | + $re_lang = isset( $recaptcha_opt['re_lang'] ) ? $recaptcha_opt['re_lang'] : $re_lang; | |
| 309 | 298 | } |
| 310 | 299 | |
| 311 | 300 | if ( empty( $this->re_msg ) ) { |
| 312 | 301 | $this->re_msg = __( 'The CAPTCHA was not entered correctly', 'formidable' ); |
| @@ -413,26 +402,11 @@ | ||
| 413 | 402 | $this->turnstile_privkey = trim( $params['frm_turnstile_privkey'] ); |
| 414 | 403 | $this->load_style = $params['frm_load_style']; |
| 415 | 404 | $this->custom_css = $params['frm_custom_css']; |
| 416 | 405 | $this->default_email = $params['frm_default_email']; |
| 417 | - $this->from_email = $params['frm_from_email']; | |
| 418 | 406 | $this->currency = $params['frm_currency']; |
| 419 | 407 | |
| 420 | - $checkboxes = array( | |
| 421 | - 'mu_menu', | |
| 422 | - 're_multi', | |
| 423 | - 'fade_form', | |
| 424 | - 'no_ips', | |
| 425 | - 'no_gdpr_cookies', | |
| 426 | - 'enable_gdpr', | |
| 427 | - 'custom_header_ip', | |
| 428 | - 'tracking', | |
| 429 | - 'admin_bar', | |
| 430 | - 'summary_emails', | |
| 431 | - 'honeypot', | |
| 432 | - 'wp_spam_check', | |
| 433 | - 'denylist_check', | |
| 434 | - ); | |
| 408 | + $checkboxes = array( 'mu_menu', 're_multi', 'use_html', 'jquery_css', 'accordion_js', 'fade_form', 'no_ips', 'custom_header_ip', 'tracking', 'admin_bar', 'summary_emails' ); | |
| 435 | 409 | foreach ( $checkboxes as $set ) { |
| 436 | 410 | $this->$set = isset( $params[ 'frm_' . $set ] ) ? absint( $params[ 'frm_' . $set ] ) : 0; |
| 437 | 411 | } |
| 438 | 412 | } |
| @@ -445,9 +419,9 @@ | ||
| 445 | 419 | |
| 446 | 420 | $frm_roles = FrmAppHelper::frm_capabilities(); |
| 447 | 421 | $roles = get_editable_roles(); |
| 448 | 422 | foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
| 449 | - $this->$frm_role = (array) ( $params[ $frm_role ] ?? 'administrator' ); | |
| 423 | + $this->$frm_role = (array) ( isset( $params[ $frm_role ] ) ? $params[ $frm_role ] : 'administrator' ); | |
| 450 | 424 | |
| 451 | 425 | // Make sure administrators always have permissions |
| 452 | 426 | if ( ! in_array( 'administrator', $this->$frm_role, true ) ) { |
| 453 | 427 | array_push( $this->$frm_role, 'administrator' ); |