@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $this->id = $new_instance['ID']; |
58 | 58 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
59 | 59 | if ( $id != $this->id || ! $_POST || ! isset( $_POST['frm_style_setting'] ) ) { |
60 | - $all_instances[ $number ] = $new_instance; |
|
60 | + $all_instances[$number] = $new_instance; |
|
61 | 61 | |
62 | 62 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
63 | 63 | if ( $new_instance['menu_order'] && $_POST && empty( $_POST['prev_menu_order'] ) && isset( $_POST['frm_style_setting']['menu_order'] ) ) { |
@@ -83,27 +83,27 @@ discard block |
||
83 | 83 | $default_settings = $this->get_defaults(); |
84 | 84 | |
85 | 85 | foreach ( $default_settings as $setting => $default ) { |
86 | - if ( ! isset( $new_instance['post_content'][ $setting ] ) ) { |
|
87 | - $new_instance['post_content'][ $setting ] = $default; |
|
86 | + if ( ! isset( $new_instance['post_content'][$setting] ) ) { |
|
87 | + $new_instance['post_content'][$setting] = $default; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | if ( $this->is_color( $setting ) ) { |
91 | - $color_val = $new_instance['post_content'][ $setting ]; |
|
91 | + $color_val = $new_instance['post_content'][$setting]; |
|
92 | 92 | if ( $color_val !== '' && 0 === strpos( $color_val, 'rgb' ) ) { |
93 | 93 | // maybe sanitize if invalid rgba value is entered |
94 | 94 | $this->maybe_sanitize_rgba_value( $color_val ); |
95 | 95 | } |
96 | - $new_instance['post_content'][ $setting ] = str_replace( '#', '', $color_val ); |
|
96 | + $new_instance['post_content'][$setting] = str_replace( '#', '', $color_val ); |
|
97 | 97 | } elseif ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) |
98 | - && ! isset( $new_instance['post_content'][ $setting ] ) |
|
98 | + && ! isset( $new_instance['post_content'][$setting] ) |
|
99 | 99 | ) { |
100 | - $new_instance['post_content'][ $setting ] = 0; |
|
100 | + $new_instance['post_content'][$setting] = 0; |
|
101 | 101 | } elseif ( $setting == 'font' ) { |
102 | - $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
102 | + $new_instance['post_content'][$setting] = $this->force_balanced_quotation( $new_instance['post_content'][$setting] ); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | - $all_instances[ $number ] = $new_instance; |
|
106 | + $all_instances[$number] = $new_instance; |
|
107 | 107 | |
108 | 108 | $action_ids[] = $this->save( $new_instance ); |
109 | 109 | |
@@ -215,10 +215,10 @@ discard block |
||
215 | 215 | $valid_keys = array_keys( $defaults ); |
216 | 216 | $sanitized_settings = array(); |
217 | 217 | foreach ( $valid_keys as $key ) { |
218 | - if ( isset( $settings[ $key ] ) ) { |
|
219 | - $sanitized_settings[ $key ] = sanitize_textarea_field( $settings[ $key ] ); |
|
218 | + if ( isset( $settings[$key] ) ) { |
|
219 | + $sanitized_settings[$key] = sanitize_textarea_field( $settings[$key] ); |
|
220 | 220 | } else { |
221 | - $sanitized_settings[ $key ] = $defaults[ $key ]; |
|
221 | + $sanitized_settings[$key] = $defaults[$key]; |
|
222 | 222 | } |
223 | 223 | } |
224 | 224 | return $sanitized_settings; |
@@ -385,13 +385,13 @@ discard block |
||
385 | 385 | $style->post_content = $this->override_defaults( $style->post_content ); |
386 | 386 | $style->post_content = wp_parse_args( $style->post_content, $default_values ); |
387 | 387 | |
388 | - $styles[ $style->ID ] = $style; |
|
388 | + $styles[$style->ID] = $style; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | if ( ! $default_style ) { |
392 | 392 | $default_style = reset( $styles ); |
393 | 393 | |
394 | - $styles[ $default_style->ID ]->menu_order = 1; |
|
394 | + $styles[$default_style->ID]->menu_order = 1; |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | return $styles; |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } |
210 | 210 | |
211 | 211 | if ( $new_val !== $value ) { |
212 | - $new_values[ $key ] = $new_val; |
|
212 | + $new_values[$key] = $new_val; |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | foreach ( $values as $value_key => $value ) { |
242 | 242 | if ( $value_key && in_array( $value_key, $form_fields ) ) { |
243 | - $new_values[ $value_key ] = $value; |
|
243 | + $new_values[$value_key] = $value; |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
@@ -328,15 +328,15 @@ discard block |
||
328 | 328 | $existing_keys = array_keys( $values['item_meta'] ); |
329 | 329 | foreach ( $all_fields as $fid ) { |
330 | 330 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
331 | - $values['item_meta'][ $fid->id ] = ''; |
|
331 | + $values['item_meta'][$fid->id] = ''; |
|
332 | 332 | } |
333 | - $field_array[ $fid->id ] = $fid; |
|
333 | + $field_array[$fid->id] = $fid; |
|
334 | 334 | } |
335 | 335 | unset( $all_fields ); |
336 | 336 | |
337 | 337 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
338 | - if ( isset( $field_array[ $field_id ] ) ) { |
|
339 | - $field = $field_array[ $field_id ]; |
|
338 | + if ( isset( $field_array[$field_id] ) ) { |
|
339 | + $field = $field_array[$field_id]; |
|
340 | 340 | } else { |
341 | 341 | $field = FrmField::getOne( $field_id ); |
342 | 342 | } |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | continue; |
346 | 346 | } |
347 | 347 | |
348 | - $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ); |
|
348 | + $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) ); |
|
349 | 349 | if ( $is_settings_page ) { |
350 | 350 | self::get_settings_page_html( $values, $field ); |
351 | 351 | |
@@ -360,15 +360,15 @@ discard block |
||
360 | 360 | $update_options = apply_filters( 'frm_field_options_to_update', $update_options ); |
361 | 361 | |
362 | 362 | foreach ( $update_options as $opt => $default ) { |
363 | - $field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default; |
|
364 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
363 | + $field->field_options[$opt] = isset( $values['field_options'][$opt . '_' . $field_id] ) ? $values['field_options'][$opt . '_' . $field_id] : $default; |
|
364 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
368 | 368 | |
369 | 369 | $new_field = array( |
370 | 370 | 'field_options' => $field->field_options, |
371 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
371 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
372 | 372 | ); |
373 | 373 | |
374 | 374 | self::prepare_field_update_values( $field, $values, $new_field ); |
@@ -430,11 +430,11 @@ discard block |
||
430 | 430 | * Updating the settings page |
431 | 431 | */ |
432 | 432 | private static function get_settings_page_html( $values, &$field ) { |
433 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
433 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
434 | 434 | $prev_opts = array(); |
435 | 435 | $fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type ); |
436 | 436 | |
437 | - $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html; |
|
437 | + $field->field_options['custom_html'] = isset( $values['field_options']['custom_html_' . $field->id] ) ? $values['field_options']['custom_html_' . $field->id] : $fallback_html; |
|
438 | 438 | } elseif ( $field->type == 'hidden' || $field->type == 'user_id' ) { |
439 | 439 | $prev_opts = $field->field_options; |
440 | 440 | } |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | foreach ( $field_cols as $col => $default ) { |
461 | 461 | $default = ( $default === '' ) ? $field->{$col} : $default; |
462 | 462 | |
463 | - $new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default; |
|
463 | + $new_field[$col] = isset( $values['field_options'][$col . '_' . $field->id] ) ? $values['field_options'][$col . '_' . $field->id] : $default; |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | // Don't save the template option. |
@@ -874,8 +874,8 @@ discard block |
||
874 | 874 | self::maybe_get_form( $form ); |
875 | 875 | } |
876 | 876 | |
877 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
878 | - return $frm_vars['form_params'][ $form->id ]; |
|
877 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
878 | + return $frm_vars['form_params'][$form->id]; |
|
879 | 879 | } |
880 | 880 | |
881 | 881 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -904,15 +904,15 @@ discard block |
||
904 | 904 | //if there are two forms on the same page, make sure not to submit both |
905 | 905 | foreach ( $default_values as $var => $default ) { |
906 | 906 | if ( $var == 'action' ) { |
907 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
907 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
908 | 908 | } else { |
909 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
909 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
910 | 910 | } |
911 | 911 | unset( $var, $default ); |
912 | 912 | } |
913 | 913 | } else { |
914 | 914 | foreach ( $default_values as $var => $default ) { |
915 | - $values[ $var ] = $default; |
|
915 | + $values[$var] = $default; |
|
916 | 916 | unset( $var, $default ); |
917 | 917 | } |
918 | 918 | } |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | 'sdir' => '', |
939 | 939 | ); |
940 | 940 | foreach ( $defaults as $var => $default ) { |
941 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
941 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
942 | 942 | } |
943 | 943 | |
944 | 944 | return $values; |
@@ -966,7 +966,7 @@ discard block |
||
966 | 966 | 'keep_post' => '', |
967 | 967 | ); |
968 | 968 | foreach ( $defaults as $var => $default ) { |
969 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
969 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
970 | 970 | } |
971 | 971 | |
972 | 972 | return $values; |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | $form = $atts['form']; |
1070 | 1070 | $default = isset( $atts['default'] ) ? $atts['default'] : ''; |
1071 | 1071 | |
1072 | - return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $default; |
|
1072 | + return isset( $form->options[$atts['option']] ) ? $form->options[$atts['option']] : $default; |
|
1073 | 1073 | } |
1074 | 1074 | |
1075 | 1075 | /** |