| @@ -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,9 +37,8 @@ | ||
| 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 | 44 | /** |
| @@ -119,24 +117,17 @@ | ||
| 119 | 117 | 'failed_msg' => __( 'We\'re sorry. It looks like you\'ve already submitted that.', 'formidable' ), |
| 120 | 118 | 'submit_value' => __( 'Submit', 'formidable' ), |
| 121 | 119 | 'login_msg' => __( 'You do not have permission to view this form.', 'formidable' ), |
| 122 | 120 | 'admin_permission' => __( 'You do not have permission to do that', 'formidable' ), |
| 123 | - 'new_tab_msg' => __( 'The page has been opened in a new tab.', 'formidable' ), | |
| 124 | 121 | |
| 125 | - 'email_to' => '[admin_email]', | |
| 126 | - 'no_ips' => 0, | |
| 127 | - '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 | |
| 128 | - 'tracking' => FrmAppHelper::pro_is_installed(), | |
| 122 | + 'email_to' => '[admin_email]', | |
| 123 | + 'no_ips' => 0, | |
| 124 | + 'tracking' => FrmAppHelper::pro_is_installed(), | |
| 129 | 125 | |
| 130 | - // Normally custom CSS is a string. A false value is used when nothing has been set. | |
| 131 | - // When it is false, we try to use the old custom_key value from the default style's post_content array. | |
| 132 | 126 | 'custom_css' => false, |
| 133 | 127 | ); |
| 134 | 128 | } |
| 135 | 129 | |
| 136 | - /** | |
| 137 | - * @return void | |
| 138 | - */ | |
| 139 | 130 | private function set_default_options() { |
| 140 | 131 | $this->fill_captcha_settings(); |
| 141 | 132 | |
| 142 | 133 | if ( ! isset( $this->load_style ) ) { |
| @@ -209,12 +200,8 @@ | ||
| 209 | 200 | * @return mixed |
| 210 | 201 | */ |
| 211 | 202 | private function maybe_sanitize_global_setting( $value, $key, $filter_keys ) { |
| 212 | 203 | if ( 'custom_css' === $key ) { |
| 213 | - if ( false === $value ) { | |
| 214 | - // Avoid changing the false default value to an empty string. | |
| 215 | - return $value; | |
| 216 | - } | |
| 217 | 204 | return sanitize_textarea_field( $value ); |
| 218 | 205 | } |
| 219 | 206 | |
| 220 | 207 | if ( in_array( $key, $filter_keys, true ) ) { |
| @@ -223,11 +210,8 @@ | ||
| 223 | 210 | |
| 224 | 211 | return $value; |
| 225 | 212 | } |
| 226 | 213 | |
| 227 | - /** | |
| 228 | - * @return void | |
| 229 | - */ | |
| 230 | 214 | private function fill_captcha_settings() { |
| 231 | 215 | if ( ! isset( $this->active_captcha ) ) { |
| 232 | 216 | $this->active_captcha = 'recaptcha'; |
| 233 | 217 | } |
| @@ -271,10 +255,8 @@ | ||
| 271 | 255 | /** |
| 272 | 256 | * Get values that may be shown on the front-end without an override in the form settings. |
| 273 | 257 | * |
| 274 | 258 | * @since 3.06.01 |
| 275 | - * | |
| 276 | - * @return string[] | |
| 277 | 259 | */ |
| 278 | 260 | public function translatable_strings() { |
| 279 | 261 | return array( |
| 280 | 262 | 'invalid_msg', |
| @@ -287,10 +269,8 @@ | ||
| 287 | 269 | /** |
| 288 | 270 | * Allow strings to be filtered when a specific form may be displaying them. |
| 289 | 271 | * |
| 290 | 272 | * @since 3.06.01 |
| 291 | - * | |
| 292 | - * @return void | |
| 293 | 273 | */ |
| 294 | 274 | public function maybe_filter_for_form( $args ) { |
| 295 | 275 | if ( isset( $args['current_form'] ) && is_numeric( $args['current_form'] ) ) { |
| 296 | 276 | $this->current_form = $args['current_form']; |
| @@ -300,21 +280,12 @@ | ||
| 300 | 280 | } |
| 301 | 281 | } |
| 302 | 282 | } |
| 303 | 283 | |
| 304 | - /** | |
| 305 | - * @param array $params | |
| 306 | - * @param array $errors | |
| 307 | - */ | |
| 308 | 284 | public function validate( $params, $errors ) { |
| 309 | 285 | return apply_filters( 'frm_validate_settings', $errors, $params ); |
| 310 | 286 | } |
| 311 | 287 | |
| 312 | - /** | |
| 313 | - * @param array $params | |
| 314 | - * | |
| 315 | - * @return void | |
| 316 | - */ | |
| 317 | 288 | public function update( $params ) { |
| 318 | 289 | $this->fill_with_defaults( $params ); |
| 319 | 290 | $this->update_settings( $params ); |
| 320 | 291 | |
| @@ -334,17 +305,14 @@ | ||
| 334 | 305 | $frm_style->update( 'default' ); |
| 335 | 306 | } |
| 336 | 307 | } |
| 337 | 308 | |
| 338 | - /** | |
| 339 | - * @return void | |
| 340 | - */ | |
| 341 | 309 | private function update_settings( $params ) { |
| 342 | 310 | $this->active_captcha = $params['frm_active_captcha']; |
| 343 | 311 | $this->hcaptcha_pubkey = trim( $params['frm_hcaptcha_pubkey'] ); |
| 344 | - $this->hcaptcha_privkey = trim( $params['frm_hcaptcha_privkey'] ); | |
| 312 | + $this->hcaptcha_privkey = $params['frm_hcaptcha_privkey']; | |
| 345 | 313 | $this->pubkey = trim( $params['frm_pubkey'] ); |
| 346 | - $this->privkey = trim( $params['frm_privkey'] ); | |
| 314 | + $this->privkey = $params['frm_privkey']; | |
| 347 | 315 | $this->re_type = $params['frm_re_type']; |
| 348 | 316 | $this->re_lang = $params['frm_re_lang']; |
| 349 | 317 | $this->re_threshold = floatval( $params['frm_re_threshold'] ); |
| 350 | 318 | $this->load_style = $params['frm_load_style']; |
| @@ -349,17 +317,14 @@ | ||
| 349 | 317 | $this->re_threshold = floatval( $params['frm_re_threshold'] ); |
| 350 | 318 | $this->load_style = $params['frm_load_style']; |
| 351 | 319 | $this->custom_css = $params['frm_custom_css']; |
| 352 | 320 | |
| 353 | - $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' ); | |
| 354 | 322 | foreach ( $checkboxes as $set ) { |
| 355 | - $this->$set = isset( $params[ 'frm_' . $set ] ) ? absint( $params[ 'frm_' . $set ] ) : 0; | |
| 323 | + $this->$set = isset( $params[ 'frm_' . $set ] ) ? $params[ 'frm_' . $set ] : 0; | |
| 356 | 324 | } |
| 357 | 325 | } |
| 358 | 326 | |
| 359 | - /** | |
| 360 | - * @return void | |
| 361 | - */ | |
| 362 | 327 | private function update_roles( $params ) { |
| 363 | 328 | global $wp_roles; |
| 364 | 329 | |
| 365 | 330 | $frm_roles = FrmAppHelper::frm_capabilities(); |
| @@ -381,11 +346,8 @@ | ||
| 381 | 346 | } |
| 382 | 347 | } |
| 383 | 348 | } |
| 384 | 349 | |
| 385 | - /** | |
| 386 | - * @return void | |
| 387 | - */ | |
| 388 | 350 | public function store() { |
| 389 | 351 | // Save the posted value in the database |
| 390 | 352 | |
| 391 | 353 | update_option( 'frm_options', $this ); |