| @@ -2,9 +2,8 @@ | ||
| 2 | 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | 3 | die( 'You are not allowed to call this page directly.' ); |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | -#[\AllowDynamicProperties] | |
| 7 | 6 | class FrmSettings { |
| 8 | 7 | public $option_name = 'frm_options'; |
| 9 | 8 | public $menu; |
| 10 | 9 | public $mu_menu; |
| @@ -38,14 +37,11 @@ | ||
| 38 | 37 | public $re_msg; |
| 39 | 38 | public $re_multi; |
| 40 | 39 | |
| 41 | 40 | public $no_ips; |
| 42 | - public $custom_header_ip; | |
| 43 | 41 | public $current_form = 0; |
| 44 | 42 | public $tracking; |
| 45 | 43 | |
| 46 | - public $currency; | |
| 47 | - | |
| 48 | 44 | /** |
| 49 | 45 | * @since 6.0 |
| 50 | 46 | * |
| 51 | 47 | * @var string|false|null |
| @@ -121,24 +117,17 @@ | ||
| 121 | 117 | 'failed_msg' => __( 'We\'re sorry. It looks like you\'ve already submitted that.', 'formidable' ), |
| 122 | 118 | 'submit_value' => __( 'Submit', 'formidable' ), |
| 123 | 119 | 'login_msg' => __( 'You do not have permission to view this form.', 'formidable' ), |
| 124 | 120 | 'admin_permission' => __( 'You do not have permission to do that', 'formidable' ), |
| 125 | - 'new_tab_msg' => __( 'The page has been opened in a new tab.', 'formidable' ), | |
| 126 | 121 | |
| 127 | - 'email_to' => '[admin_email]', | |
| 128 | - 'no_ips' => 0, | |
| 129 | - 'custom_header_ip' => false, // Use false by default. We show a warning when this is unset. Once global settings have been saved, this gets saved | |
| 130 | - 'tracking' => FrmAppHelper::pro_is_installed(), | |
| 122 | + 'email_to' => '[admin_email]', | |
| 123 | + 'no_ips' => 0, | |
| 124 | + 'tracking' => FrmAppHelper::pro_is_installed(), | |
| 131 | 125 | |
| 132 | - // Normally custom CSS is a string. A false value is used when nothing has been set. | |
| 133 | - // When it is false, we try to use the old custom_key value from the default style's post_content array. | |
| 134 | 126 | 'custom_css' => false, |
| 135 | 127 | ); |
| 136 | 128 | } |
| 137 | 129 | |
| 138 | - /** | |
| 139 | - * @return void | |
| 140 | - */ | |
| 141 | 130 | private function set_default_options() { |
| 142 | 131 | $this->fill_captcha_settings(); |
| 143 | 132 | |
| 144 | 133 | if ( ! isset( $this->load_style ) ) { |
| @@ -164,12 +153,8 @@ | ||
| 164 | 153 | if ( ! isset( $this->$frm_role ) ) { |
| 165 | 154 | $this->$frm_role = 'administrator'; |
| 166 | 155 | } |
| 167 | 156 | } |
| 168 | - | |
| 169 | - if ( ! isset( $this->currency ) ) { | |
| 170 | - $this->currency = 'USD'; | |
| 171 | - } | |
| 172 | 157 | } |
| 173 | 158 | |
| 174 | 159 | /** |
| 175 | 160 | * @param array $params |
| @@ -215,12 +200,8 @@ | ||
| 215 | 200 | * @return mixed |
| 216 | 201 | */ |
| 217 | 202 | private function maybe_sanitize_global_setting( $value, $key, $filter_keys ) { |
| 218 | 203 | if ( 'custom_css' === $key ) { |
| 219 | - if ( false === $value ) { | |
| 220 | - // Avoid changing the false default value to an empty string. | |
| 221 | - return $value; | |
| 222 | - } | |
| 223 | 204 | return sanitize_textarea_field( $value ); |
| 224 | 205 | } |
| 225 | 206 | |
| 226 | 207 | if ( in_array( $key, $filter_keys, true ) ) { |
| @@ -229,11 +210,8 @@ | ||
| 229 | 210 | |
| 230 | 211 | return $value; |
| 231 | 212 | } |
| 232 | 213 | |
| 233 | - /** | |
| 234 | - * @return void | |
| 235 | - */ | |
| 236 | 214 | private function fill_captcha_settings() { |
| 237 | 215 | if ( ! isset( $this->active_captcha ) ) { |
| 238 | 216 | $this->active_captcha = 'recaptcha'; |
| 239 | 217 | } |
| @@ -277,10 +255,8 @@ | ||
| 277 | 255 | /** |
| 278 | 256 | * Get values that may be shown on the front-end without an override in the form settings. |
| 279 | 257 | * |
| 280 | 258 | * @since 3.06.01 |
| 281 | - * | |
| 282 | - * @return string[] | |
| 283 | 259 | */ |
| 284 | 260 | public function translatable_strings() { |
| 285 | 261 | return array( |
| 286 | 262 | 'invalid_msg', |
| @@ -293,10 +269,8 @@ | ||
| 293 | 269 | /** |
| 294 | 270 | * Allow strings to be filtered when a specific form may be displaying them. |
| 295 | 271 | * |
| 296 | 272 | * @since 3.06.01 |
| 297 | - * | |
| 298 | - * @return void | |
| 299 | 273 | */ |
| 300 | 274 | public function maybe_filter_for_form( $args ) { |
| 301 | 275 | if ( isset( $args['current_form'] ) && is_numeric( $args['current_form'] ) ) { |
| 302 | 276 | $this->current_form = $args['current_form']; |
| @@ -306,21 +280,12 @@ | ||
| 306 | 280 | } |
| 307 | 281 | } |
| 308 | 282 | } |
| 309 | 283 | |
| 310 | - /** | |
| 311 | - * @param array $params | |
| 312 | - * @param array $errors | |
| 313 | - */ | |
| 314 | 284 | public function validate( $params, $errors ) { |
| 315 | 285 | return apply_filters( 'frm_validate_settings', $errors, $params ); |
| 316 | 286 | } |
| 317 | 287 | |
| 318 | - /** | |
| 319 | - * @param array $params | |
| 320 | - * | |
| 321 | - * @return void | |
| 322 | - */ | |
| 323 | 288 | public function update( $params ) { |
| 324 | 289 | $this->fill_with_defaults( $params ); |
| 325 | 290 | $this->update_settings( $params ); |
| 326 | 291 | |
| @@ -340,33 +305,26 @@ | ||
| 340 | 305 | $frm_style->update( 'default' ); |
| 341 | 306 | } |
| 342 | 307 | } |
| 343 | 308 | |
| 344 | - /** | |
| 345 | - * @return void | |
| 346 | - */ | |
| 347 | 309 | private function update_settings( $params ) { |
| 348 | 310 | $this->active_captcha = $params['frm_active_captcha']; |
| 349 | 311 | $this->hcaptcha_pubkey = trim( $params['frm_hcaptcha_pubkey'] ); |
| 350 | - $this->hcaptcha_privkey = trim( $params['frm_hcaptcha_privkey'] ); | |
| 312 | + $this->hcaptcha_privkey = $params['frm_hcaptcha_privkey']; | |
| 351 | 313 | $this->pubkey = trim( $params['frm_pubkey'] ); |
| 352 | - $this->privkey = trim( $params['frm_privkey'] ); | |
| 314 | + $this->privkey = $params['frm_privkey']; | |
| 353 | 315 | $this->re_type = $params['frm_re_type']; |
| 354 | 316 | $this->re_lang = $params['frm_re_lang']; |
| 355 | 317 | $this->re_threshold = floatval( $params['frm_re_threshold'] ); |
| 356 | 318 | $this->load_style = $params['frm_load_style']; |
| 357 | 319 | $this->custom_css = $params['frm_custom_css']; |
| 358 | - $this->currency = $params['frm_currency']; | |
| 359 | 320 | |
| 360 | - $checkboxes = array( 'mu_menu', 're_multi', 'use_html', 'jquery_css', 'accordion_js', 'fade_form', 'no_ips', 'custom_header_ip', 'tracking', 'admin_bar' ); | |
| 321 | + $checkboxes = array( 'mu_menu', 're_multi', 'use_html', 'jquery_css', 'accordion_js', 'fade_form', 'no_ips', 'tracking', 'admin_bar' ); | |
| 361 | 322 | foreach ( $checkboxes as $set ) { |
| 362 | - $this->$set = isset( $params[ 'frm_' . $set ] ) ? absint( $params[ 'frm_' . $set ] ) : 0; | |
| 323 | + $this->$set = isset( $params[ 'frm_' . $set ] ) ? $params[ 'frm_' . $set ] : 0; | |
| 363 | 324 | } |
| 364 | 325 | } |
| 365 | 326 | |
| 366 | - /** | |
| 367 | - * @return void | |
| 368 | - */ | |
| 369 | 327 | private function update_roles( $params ) { |
| 370 | 328 | global $wp_roles; |
| 371 | 329 | |
| 372 | 330 | $frm_roles = FrmAppHelper::frm_capabilities(); |
| @@ -388,11 +346,8 @@ | ||
| 388 | 346 | } |
| 389 | 347 | } |
| 390 | 348 | } |
| 391 | 349 | |
| 392 | - /** | |
| 393 | - * @return void | |
| 394 | - */ | |
| 395 | 350 | public function store() { |
| 396 | 351 | // Save the posted value in the database |
| 397 | 352 | |
| 398 | 353 | update_option( 'frm_options', $this ); |