@@ -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 | }//end foreach |
| 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 | |
@@ -323,15 +323,15 @@ discard block |
||
| 323 | 323 | $existing_keys = array_keys( $values['item_meta'] ); |
| 324 | 324 | foreach ( $all_fields as $fid ) { |
| 325 | 325 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
| 326 | - $values['item_meta'][ $fid->id ] = ''; |
|
| 326 | + $values['item_meta'][$fid->id] = ''; |
|
| 327 | 327 | } |
| 328 | - $field_array[ $fid->id ] = $fid; |
|
| 328 | + $field_array[$fid->id] = $fid; |
|
| 329 | 329 | } |
| 330 | 330 | unset( $all_fields ); |
| 331 | 331 | |
| 332 | 332 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
| 333 | - if ( isset( $field_array[ $field_id ] ) ) { |
|
| 334 | - $field = $field_array[ $field_id ]; |
|
| 333 | + if ( isset( $field_array[$field_id] ) ) { |
|
| 334 | + $field = $field_array[$field_id]; |
|
| 335 | 335 | } else { |
| 336 | 336 | $field = FrmField::getOne( $field_id ); |
| 337 | 337 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | continue; |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ); |
|
| 343 | + $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) ); |
|
| 344 | 344 | if ( $is_settings_page ) { |
| 345 | 345 | self::get_settings_page_html( $values, $field ); |
| 346 | 346 | |
@@ -360,22 +360,22 @@ discard block |
||
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | foreach ( $update_options as $opt => $default ) { |
| 363 | - $field->field_options[ $opt ] = $values['field_options'][ $opt . '_' . $field_id ] ?? $default; |
|
| 364 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
| 363 | + $field->field_options[$opt] = $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 | - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { |
|
| 375 | - foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) { |
|
| 374 | + if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) { |
|
| 375 | + foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) { |
|
| 376 | 376 | if ( is_array( $option ) ) { |
| 377 | 377 | foreach ( $option as $key => $item ) { |
| 378 | - $values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' ); |
|
| 378 | + $values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' ); |
|
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | } |
@@ -405,8 +405,8 @@ discard block |
||
| 405 | 405 | */ |
| 406 | 406 | private static function maybe_update_max_option( $field, $values, &$new_field ) { |
| 407 | 407 | if ( $field->type === 'textarea' && |
| 408 | - ! empty( $values['field_options'][ 'type_' . $field->id ] ) && |
|
| 409 | - in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 408 | + ! empty( $values['field_options']['type_' . $field->id] ) && |
|
| 409 | + in_array( $values['field_options']['type_' . $field->id], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 410 | 410 | |
| 411 | 411 | $new_field['field_options']['max'] = ''; |
| 412 | 412 | |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | * Update posted field setting so that new 'max' option is displayed after form is saved and page reloads. |
| 415 | 415 | * FrmFieldsHelper::fill_default_field_opts populates field options by calling self::get_posted_field_setting. |
| 416 | 416 | */ |
| 417 | - $_POST['field_options'][ 'max_' . $field->id ] = ''; |
|
| 417 | + $_POST['field_options']['max_' . $field->id] = ''; |
|
| 418 | 418 | } |
| 419 | 419 | } |
| 420 | 420 | |
@@ -492,11 +492,11 @@ discard block |
||
| 492 | 492 | * Updating the settings page |
| 493 | 493 | */ |
| 494 | 494 | private static function get_settings_page_html( $values, &$field ) { |
| 495 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
| 495 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
| 496 | 496 | $prev_opts = array(); |
| 497 | 497 | $fallback_html = $field->field_options['custom_html'] ?? FrmFieldsHelper::get_default_html( $field->type ); |
| 498 | 498 | |
| 499 | - $field->field_options['custom_html'] = $values['field_options'][ 'custom_html_' . $field->id ] ?? $fallback_html; |
|
| 499 | + $field->field_options['custom_html'] = $values['field_options']['custom_html_' . $field->id] ?? $fallback_html; |
|
| 500 | 500 | } elseif ( $field->type === 'hidden' || $field->type === 'user_id' ) { |
| 501 | 501 | $prev_opts = $field->field_options; |
| 502 | 502 | } |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | ); |
| 522 | 522 | foreach ( $field_cols as $col => $default ) { |
| 523 | 523 | $default = $default === '' ? $field->{$col} : $default; |
| 524 | - $new_field[ $col ] = $values['field_options'][ $col . '_' . $field->id ] ?? $default; |
|
| 524 | + $new_field[$col] = $values['field_options'][$col . '_' . $field->id] ?? $default; |
|
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | if ( $field->type === 'submit' && isset( $new_field['field_order'] ) && (int) $new_field['field_order'] === FrmSubmitHelper::DEFAULT_ORDER ) { |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | if ( ! isset( $form->options['trash_time'] ) || $form->options['trash_time'] < $delete_timestamp ) { |
| 713 | 713 | self::destroy( $form->id ); |
| 714 | 714 | if ( empty( $form->parent_form_id ) ) { |
| 715 | - ++$count; |
|
| 715 | + ++ $count; |
|
| 716 | 716 | } |
| 717 | 717 | } |
| 718 | 718 | |
@@ -935,16 +935,16 @@ discard block |
||
| 935 | 935 | foreach ( $results as $row ) { |
| 936 | 936 | if ( 'trash' != $row->status ) { |
| 937 | 937 | if ( $row->is_template ) { |
| 938 | - ++$counts['template']; |
|
| 938 | + ++ $counts['template']; |
|
| 939 | 939 | } else { |
| 940 | - ++$counts['published']; |
|
| 940 | + ++ $counts['published']; |
|
| 941 | 941 | } |
| 942 | 942 | } else { |
| 943 | - ++$counts['trash']; |
|
| 943 | + ++ $counts['trash']; |
|
| 944 | 944 | } |
| 945 | 945 | |
| 946 | 946 | if ( 'draft' == $row->status ) { |
| 947 | - ++$counts['draft']; |
|
| 947 | + ++ $counts['draft']; |
|
| 948 | 948 | } |
| 949 | 949 | |
| 950 | 950 | unset( $row ); |
@@ -985,8 +985,8 @@ discard block |
||
| 985 | 985 | self::maybe_get_form( $form ); |
| 986 | 986 | } |
| 987 | 987 | |
| 988 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
| 989 | - return $frm_vars['form_params'][ $form->id ]; |
|
| 988 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
| 989 | + return $frm_vars['form_params'][$form->id]; |
|
| 990 | 990 | } |
| 991 | 991 | |
| 992 | 992 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -1015,15 +1015,15 @@ discard block |
||
| 1015 | 1015 | // If there are two forms on the same page, make sure not to submit both. |
| 1016 | 1016 | foreach ( $default_values as $var => $default ) { |
| 1017 | 1017 | if ( $var === 'action' ) { |
| 1018 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1018 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1019 | 1019 | } else { |
| 1020 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1020 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1021 | 1021 | } |
| 1022 | 1022 | unset( $var, $default ); |
| 1023 | 1023 | } |
| 1024 | 1024 | } else { |
| 1025 | 1025 | foreach ( $default_values as $var => $default ) { |
| 1026 | - $values[ $var ] = $default; |
|
| 1026 | + $values[$var] = $default; |
|
| 1027 | 1027 | unset( $var, $default ); |
| 1028 | 1028 | } |
| 1029 | 1029 | } |
@@ -1049,7 +1049,7 @@ discard block |
||
| 1049 | 1049 | 'sdir' => '', |
| 1050 | 1050 | ); |
| 1051 | 1051 | foreach ( $defaults as $var => $default ) { |
| 1052 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1052 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1053 | 1053 | } |
| 1054 | 1054 | |
| 1055 | 1055 | return $values; |
@@ -1077,7 +1077,7 @@ discard block |
||
| 1077 | 1077 | 'keep_post' => '', |
| 1078 | 1078 | ); |
| 1079 | 1079 | foreach ( $defaults as $var => $default ) { |
| 1080 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1080 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1081 | 1081 | } |
| 1082 | 1082 | |
| 1083 | 1083 | return $values; |
@@ -1180,7 +1180,7 @@ discard block |
||
| 1180 | 1180 | $form = $atts['form']; |
| 1181 | 1181 | $default = $atts['default'] ?? ''; |
| 1182 | 1182 | |
| 1183 | - return $form->options[ $atts['option'] ] ?? $default; |
|
| 1183 | + return $form->options[$atts['option']] ?? $default; |
|
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | /** |