@@ -38,7 +38,7 @@ |
||
38 | 38 | protected function is_option_on() { |
39 | 39 | $form = $this->get_form(); |
40 | 40 | $key = $this->get_option_key(); |
41 | - return ! empty( $form->options[ $key ] ) && 'off' !== $form->options[ $key ]; |
|
41 | + return ! empty( $form->options[$key] ) && 'off' !== $form->options[$key]; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -46,19 +46,19 @@ discard block |
||
46 | 46 | $result = array(); |
47 | 47 | |
48 | 48 | foreach ( $names as $name ) { |
49 | - if ( empty( $this->sub_fields[ $name ] ) ) { |
|
49 | + if ( empty( $this->sub_fields[$name] ) ) { |
|
50 | 50 | continue; |
51 | 51 | } |
52 | 52 | |
53 | - if ( ! isset( $this->sub_fields[ $name ]['wrapper_classes'] ) ) { |
|
54 | - $this->sub_fields[ $name ]['wrapper_classes'] = $col_class; |
|
55 | - } elseif ( is_array( $this->sub_fields[ $name ]['wrapper_classes'] ) ) { |
|
56 | - $this->sub_fields[ $name ]['wrapper_classes'] = implode( ' ', $this->sub_fields[ $name ]['wrapper_classes'] ) . ' ' . $col_class; |
|
53 | + if ( ! isset( $this->sub_fields[$name]['wrapper_classes'] ) ) { |
|
54 | + $this->sub_fields[$name]['wrapper_classes'] = $col_class; |
|
55 | + } elseif ( is_array( $this->sub_fields[$name]['wrapper_classes'] ) ) { |
|
56 | + $this->sub_fields[$name]['wrapper_classes'] = implode( ' ', $this->sub_fields[$name]['wrapper_classes'] ) . ' ' . $col_class; |
|
57 | 57 | } else { |
58 | - $this->sub_fields[ $name ]['wrapper_classes'] .= ' ' . $col_class; |
|
58 | + $this->sub_fields[$name]['wrapper_classes'] .= ' ' . $col_class; |
|
59 | 59 | } |
60 | 60 | |
61 | - $result[ $name ] = $this->sub_fields[ $name ]; |
|
61 | + $result[$name] = $this->sub_fields[$name]; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | return $result; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | // Default desc. |
91 | 91 | foreach ( $this->sub_fields as $name => $sub_field ) { |
92 | - $extra_options[ $name . '_desc' ] = $sub_field['label']; |
|
92 | + $extra_options[$name . '_desc'] = $sub_field['label']; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | return $extra_options; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $name_layout = $this->get_name_layout(); |
126 | 126 | |
127 | 127 | if ( ! empty( $atts['show'] ) ) { |
128 | - return isset( $value[ $atts['show'] ] ) ? $value[ $atts['show'] ] : ''; |
|
128 | + return isset( $value[$atts['show']] ) ? $value[$atts['show']] : ''; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | $value = wp_parse_args( |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $args['sub_fields'] = $this->sub_fields; |
199 | 199 | |
200 | 200 | foreach ( $hidden_fields as $name => $hidden_field ) { |
201 | - $args['sub_fields'][ $name ]['wrapper_classes'] .= ' frm_hidden'; |
|
201 | + $args['sub_fields'][$name]['wrapper_classes'] .= ' frm_hidden'; |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | $grid_helper = new FrmFieldGridHelper(); |
31 | 31 | $values['count'] = 0; |
32 | 32 | foreach ( $values['fields'] as $field ) { |
33 | - $values['count']++; |
|
33 | + $values['count'] ++; |
|
34 | 34 | $grid_helper->set_field( $field ); |
35 | 35 | $grid_helper->maybe_begin_field_wrapper(); |
36 | 36 | FrmFieldsController::load_single_field( $field, $values ); |
@@ -86,7 +86,7 @@ |
||
86 | 86 | |
87 | 87 | foreach ( $forms as $form ) { |
88 | 88 | $form_title = '' === $form->name ? __( '(no title)', 'formidable' ) : FrmAppHelper::truncate( $form->name, 50 ); |
89 | - $options[ $form->id ] = esc_html( $form_title ); |
|
89 | + $options[$form->id] = esc_html( $form_title ); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return $options; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | $_GET['page'] = 'formidable'; |
20 | 20 | |
21 | - $values = array( |
|
21 | + $values = array( |
|
22 | 22 | 'id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ), |
23 | 23 | 'doing_ajax' => true, |
24 | 24 | ); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | ob_start(); |
43 | 43 | self::load_single_field( $field, $values ); |
44 | - $field_html[ absint( $field->id ) ] = ob_get_contents(); |
|
44 | + $field_html[absint( $field->id )] = ob_get_contents(); |
|
45 | 45 | ob_end_clean(); |
46 | 46 | } |
47 | 47 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | foreach ( $opts as $opt_key => $opt ) { |
257 | 257 | if ( strpos( $opt, '|' ) !== false ) { |
258 | 258 | $vals = explode( '|', $opt ); |
259 | - $opts[ $opt_key ] = array( |
|
259 | + $opts[$opt_key] = array( |
|
260 | 260 | 'label' => trim( $vals[0] ), |
261 | 261 | 'value' => trim( $vals[1] ), |
262 | 262 | ); |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $other_array = array(); |
272 | 272 | foreach ( $field['options'] as $opt_key => $opt ) { |
273 | 273 | if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) { |
274 | - $other_array[ $opt_key ] = $opt; |
|
274 | + $other_array[$opt_key] = $opt; |
|
275 | 275 | } |
276 | 276 | unset( $opt_key, $opt ); |
277 | 277 | } |
@@ -313,18 +313,18 @@ discard block |
||
313 | 313 | $disabled_fields = FrmAppHelper::pro_is_installed() ? array() : $pro_field_selection; |
314 | 314 | $frm_settings = FrmAppHelper::get_settings(); |
315 | 315 | |
316 | - if ( ! isset( $all_field_types[ $field['type'] ] ) ) { |
|
316 | + if ( ! isset( $all_field_types[$field['type']] ) ) { |
|
317 | 317 | // Add fallback for an add-on field type that has been deactivated. |
318 | - $all_field_types[ $field['type'] ] = array( |
|
318 | + $all_field_types[$field['type']] = array( |
|
319 | 319 | 'name' => ucfirst( $field['type'] ), |
320 | 320 | 'icon' => 'frm_icon_font frm_pencil_icon', |
321 | 321 | ); |
322 | - } elseif ( ! is_array( $all_field_types[ $field['type'] ] ) ) { |
|
322 | + } elseif ( ! is_array( $all_field_types[$field['type']] ) ) { |
|
323 | 323 | // Fallback for fields added in a more basic way. |
324 | - FrmFormsHelper::prepare_field_type( $all_field_types[ $field['type'] ] ); |
|
324 | + FrmFormsHelper::prepare_field_type( $all_field_types[$field['type']] ); |
|
325 | 325 | } |
326 | 326 | |
327 | - $type_name = $all_field_types[ $field['type'] ]['name']; |
|
327 | + $type_name = $all_field_types[$field['type']]['name']; |
|
328 | 328 | if ( $field['type'] === 'divider' && FrmField::is_option_true( $field, 'repeat' ) ) { |
329 | 329 | $type_name = $all_field_types['divider|repeat']['name']; |
330 | 330 | } |
@@ -387,13 +387,13 @@ discard block |
||
387 | 387 | $active = 'default_value'; |
388 | 388 | |
389 | 389 | foreach ( $settings as $type ) { |
390 | - if ( ! empty( $field[ $type ] ) ) { |
|
390 | + if ( ! empty( $field[$type] ) ) { |
|
391 | 391 | $active = $type; |
392 | 392 | } |
393 | 393 | } |
394 | 394 | |
395 | - $types[ $active ]['class'] .= ' current'; |
|
396 | - $types[ $active ]['current'] = true; |
|
395 | + $types[$active]['class'] .= ' current'; |
|
396 | + $types[$active]['current'] = true; |
|
397 | 397 | |
398 | 398 | return $types; |
399 | 399 | } |
@@ -407,8 +407,8 @@ discard block |
||
407 | 407 | 'website' => 'url', |
408 | 408 | 'image' => 'url', |
409 | 409 | ); |
410 | - if ( isset( $type_switch[ $type ] ) ) { |
|
411 | - $type = $type_switch[ $type ]; |
|
410 | + if ( isset( $type_switch[$type] ) ) { |
|
411 | + $type = $type_switch[$type]; |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | $pro_fields = FrmField::pro_field_selection(); |
@@ -532,11 +532,11 @@ discard block |
||
532 | 532 | // include "col" for valid html |
533 | 533 | $unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) ); |
534 | 534 | |
535 | - if ( ! isset( $calc[ $unit ] ) ) { |
|
535 | + if ( ! isset( $calc[$unit] ) ) { |
|
536 | 536 | return; |
537 | 537 | } |
538 | 538 | |
539 | - $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
539 | + $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit]; |
|
540 | 540 | |
541 | 541 | $add_html['cols'] = 'cols="' . absint( $size ) . '"'; |
542 | 542 | } |
@@ -729,11 +729,11 @@ discard block |
||
729 | 729 | private static function get_form_for_js_validation( $field ) { |
730 | 730 | global $frm_vars; |
731 | 731 | if ( ! empty( $frm_vars['js_validate_forms'] ) ) { |
732 | - if ( isset( $frm_vars['js_validate_forms'][ $field['form_id'] ] ) ) { |
|
733 | - return $frm_vars['js_validate_forms'][ $field['form_id'] ]; |
|
732 | + if ( isset( $frm_vars['js_validate_forms'][$field['form_id']] ) ) { |
|
733 | + return $frm_vars['js_validate_forms'][$field['form_id']]; |
|
734 | 734 | } |
735 | - if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][ $field['parent_form_id'] ] ) ) { |
|
736 | - return $frm_vars['js_validate_forms'][ $field['parent_form_id'] ]; |
|
735 | + if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][$field['parent_form_id']] ) ) { |
|
736 | + return $frm_vars['js_validate_forms'][$field['parent_form_id']]; |
|
737 | 737 | } |
738 | 738 | } |
739 | 739 | return false; |
@@ -804,10 +804,10 @@ discard block |
||
804 | 804 | |
805 | 805 | if ( is_numeric( $k ) && strpos( $v, '=' ) ) { |
806 | 806 | $add_html[] = $v; |
807 | - } elseif ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
808 | - $add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] ); |
|
807 | + } elseif ( ! empty( $k ) && isset( $add_html[$k] ) ) { |
|
808 | + $add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] ); |
|
809 | 809 | } else { |
810 | - $add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"'; |
|
810 | + $add_html[$k] = $k . '="' . esc_attr( $v ) . '"'; |
|
811 | 811 | } |
812 | 812 | |
813 | 813 | unset( $k, $v ); |
@@ -491,7 +491,8 @@ |
||
491 | 491 | |
492 | 492 | public static function process_entry( $errors = '', $ajax = false ) { |
493 | 493 | $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' ); |
494 | - if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
494 | + if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { |
|
495 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
495 | 496 | return; |
496 | 497 | } |
497 | 498 |
@@ -75,20 +75,20 @@ discard block |
||
75 | 75 | global $frm_vars; |
76 | 76 | $form_id = FrmForm::get_current_form_id(); |
77 | 77 | |
78 | - $columns[ $form_id . '_id' ] = 'ID'; |
|
79 | - $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
|
78 | + $columns[$form_id . '_id'] = 'ID'; |
|
79 | + $columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' ); |
|
80 | 80 | |
81 | 81 | if ( $form_id ) { |
82 | 82 | self::get_columns_for_form( $form_id, $columns ); |
83 | 83 | } else { |
84 | - $columns[ $form_id . '_form_id' ] = esc_html__( 'Form', 'formidable' ); |
|
85 | - $columns[ $form_id . '_name' ] = esc_html__( 'Entry Name', 'formidable' ); |
|
86 | - $columns[ $form_id . '_user_id' ] = esc_html__( 'Created By', 'formidable' ); |
|
84 | + $columns[$form_id . '_form_id'] = esc_html__( 'Form', 'formidable' ); |
|
85 | + $columns[$form_id . '_name'] = esc_html__( 'Entry Name', 'formidable' ); |
|
86 | + $columns[$form_id . '_user_id'] = esc_html__( 'Created By', 'formidable' ); |
|
87 | 87 | } |
88 | 88 | |
89 | - $columns[ $form_id . '_is_draft' ] = esc_html__( 'Entry Status', 'formidable' ); |
|
90 | - $columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
91 | - $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
89 | + $columns[$form_id . '_is_draft'] = esc_html__( 'Entry Status', 'formidable' ); |
|
90 | + $columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' ); |
|
91 | + $columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' ); |
|
92 | 92 | self::maybe_add_ip_col( $form_id, $columns ); |
93 | 93 | |
94 | 94 | $frm_vars['cols'] = $columns; |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | |
147 | 147 | foreach ( $sub_form_cols as $k => $sub_form_col ) { |
148 | 148 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
149 | - unset( $sub_form_cols[ $k ] ); |
|
149 | + unset( $sub_form_cols[$k] ); |
|
150 | 150 | continue; |
151 | 151 | } |
152 | - $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
152 | + $columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
153 | 153 | unset( $sub_form_col ); |
154 | 154 | } |
155 | 155 | } |
@@ -166,15 +166,15 @@ discard block |
||
166 | 166 | $has_separate_value = ! FrmField::is_option_empty( $field, 'separate_value' ); |
167 | 167 | $is_post_status = FrmField::is_option_true( $field, 'post_field' ) && $field->field_options['post_field'] == 'post_status'; |
168 | 168 | if ( $has_separate_value && ! $is_post_status ) { |
169 | - $columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 ); |
|
169 | + $columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $field->name, 35 ); |
|
170 | 170 | } |
171 | 171 | |
172 | - $columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $field->name, 35 ); |
|
172 | + $columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $field->name, 35 ); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | private static function maybe_add_ip_col( $form_id, &$columns ) { |
176 | 176 | if ( FrmAppHelper::ips_saved() ) { |
177 | - $columns[ $form_id . '_ip' ] = 'IP'; |
|
177 | + $columns[$form_id . '_ip'] = 'IP'; |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | foreach ( $meta_value as $mk => $mv ) { |
213 | 213 | // Remove blank values. |
214 | 214 | if ( empty( $mv ) ) { |
215 | - unset( $meta_value[ $mk ] ); |
|
215 | + unset( $meta_value[$mk] ); |
|
216 | 216 | } |
217 | 217 | } |
218 | 218 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | foreach ( $fields as $field ) { |
290 | 290 | if ( self::field_supports_sorting( $field ) ) { |
291 | - $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id; |
|
291 | + $columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id; |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | $atts['form_id'] . '_item_key' => '', |
376 | 376 | $atts['form_id'] . '_id' => '', |
377 | 377 | ); |
378 | - $cols = $remove_first + array_reverse( $frm_vars['cols'], true ); |
|
378 | + $cols = $remove_first + array_reverse( $frm_vars['cols'], true ); |
|
379 | 379 | |
380 | 380 | $i = $atts['i']; |
381 | 381 | |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | if ( empty( $result ) || ! in_array( $col_key, $result, true ) ) { |
388 | 388 | $result[] = $col_key; |
389 | - $i--; |
|
389 | + $i --; |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | unset( $col_key, $col ); |
@@ -528,9 +528,9 @@ discard block |
||
528 | 528 | if ( ! isset( $frm_vars['form_params'] ) ) { |
529 | 529 | $frm_vars['form_params'] = array(); |
530 | 530 | } |
531 | - $frm_vars['form_params'][ $form->id ] = $params; |
|
531 | + $frm_vars['form_params'][$form->id] = $params; |
|
532 | 532 | |
533 | - if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
|
533 | + if ( isset( $frm_vars['created_entries'][$form_id] ) ) { |
|
534 | 534 | return; |
535 | 535 | } |
536 | 536 | |
@@ -546,16 +546,16 @@ discard block |
||
546 | 546 | */ |
547 | 547 | $errors = apply_filters( 'frm_entries_before_create', $errors, $form ); |
548 | 548 | |
549 | - $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
|
549 | + $frm_vars['created_entries'][$form_id] = array( 'errors' => $errors ); |
|
550 | 550 | |
551 | 551 | if ( empty( $errors ) ) { |
552 | 552 | $_POST['frm_skip_cookie'] = 1; |
553 | 553 | $do_success = false; |
554 | 554 | if ( $params['action'] === 'create' ) { |
555 | - if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
|
556 | - $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
555 | + if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) { |
|
556 | + $frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
557 | 557 | |
558 | - $params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id']; |
|
558 | + $params['id'] = $frm_vars['created_entries'][$form_id]['entry_id']; |
|
559 | 559 | $do_success = true; |
560 | 560 | } |
561 | 561 | } |
@@ -52,7 +52,7 @@ |
||
52 | 52 | protected function get_field_value( $args ) { |
53 | 53 | $user_ID = get_current_user_id(); |
54 | 54 | $user_ID = ( $user_ID ? $user_ID : '' ); |
55 | - $posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][ $this->field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
55 | + $posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][$this->field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
56 | 56 | $action = ( isset( $args['action'] ) ? $args['action'] : ( isset( $args['form_action'] ) ? $args['form_action'] : '' ) ); |
57 | 57 | $updating = $action == 'update'; |
58 | 58 | return ( is_numeric( $this->field['value'] ) || $posted_value || $updating ) ? $this->field['value'] : $user_ID; |
@@ -180,7 +180,8 @@ discard block |
||
180 | 180 | * @param mixed $value |
181 | 181 | */ |
182 | 182 | private static function get_posted_field_setting( $setting, &$value ) { |
183 | - if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
183 | + if ( ! isset( $_POST['field_options'][ $setting ] ) ) { |
|
184 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
184 | 185 | return; |
185 | 186 | } |
186 | 187 | |
@@ -1084,7 +1085,8 @@ discard block |
||
1084 | 1085 | |
1085 | 1086 | // Check posted vals before checking saved values |
1086 | 1087 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
1087 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1088 | + if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { |
|
1089 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1088 | 1090 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
1089 | 1091 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
1090 | 1092 | $other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
@@ -1094,7 +1096,8 @@ discard block |
||
1094 | 1096 | |
1095 | 1097 | return $other_val; |
1096 | 1098 | |
1097 | - } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1099 | + } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { |
|
1100 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1098 | 1101 | // For normal fields |
1099 | 1102 | |
1100 | 1103 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | if ( in_array( $type, array( 'data', 'lookup' ), true ) ) { |
32 | 32 | $values['field_options']['data_type'] = $setting; |
33 | 33 | } else { |
34 | - $values['field_options'][ $setting ] = 1; |
|
34 | + $values['field_options'][$setting] = 1; |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | foreach ( $defaults as $opt => $default ) { |
141 | - $values[ $opt ] = isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default; |
|
141 | + $values[$opt] = isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default; |
|
142 | 142 | |
143 | 143 | if ( $check_post ) { |
144 | - self::get_posted_field_setting( $opt . '_' . $field->id, $values[ $opt ] ); |
|
144 | + self::get_posted_field_setting( $opt . '_' . $field->id, $values[$opt] ); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | unset( $opt, $default ); |
@@ -185,18 +185,18 @@ discard block |
||
185 | 185 | * @param mixed $value |
186 | 186 | */ |
187 | 187 | private static function get_posted_field_setting( $setting, &$value ) { |
188 | - if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
188 | + if ( ! isset( $_POST['field_options'][$setting] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
189 | 189 | return; |
190 | 190 | } |
191 | 191 | |
192 | 192 | if ( strpos( $setting, 'html' ) !== false ) { |
193 | 193 | // Strip slashes from HTML but not regex or script tags. |
194 | - $value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
194 | + $value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
195 | 195 | } elseif ( strpos( $setting, 'format_' ) === 0 ) { |
196 | 196 | // TODO: Remove stripslashes on output, and use on input only. |
197 | - $value = sanitize_text_field( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing |
|
197 | + $value = sanitize_text_field( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing |
|
198 | 198 | } else { |
199 | - $value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
199 | + $value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
200 | 200 | FrmAppHelper::sanitize_value( 'wp_kses_post', $value ); |
201 | 201 | } |
202 | 202 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | $values['default_value'] = FrmAppHelper::maybe_json_encode( $field->default_value ); |
270 | 270 | |
271 | 271 | foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
272 | - $values[ $col ] = $field->{$col}; |
|
272 | + $values[$col] = $field->{$col}; |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | ); |
310 | 310 | |
311 | 311 | $msg = FrmField::get_option( $field, $error ); |
312 | - $msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg; |
|
312 | + $msg = empty( $msg ) ? $defaults[$error]['part'] : $msg; |
|
313 | 313 | $msg = do_shortcode( $msg ); |
314 | 314 | |
315 | 315 | return $msg; |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | } |
420 | 420 | |
421 | 421 | $base_name = 'default_value_' . $field['id']; |
422 | - $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field ); |
|
422 | + $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field ); |
|
423 | 423 | |
424 | 424 | $default_type = self::get_default_value_type( $field ); |
425 | 425 | |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | continue; |
750 | 750 | } |
751 | 751 | |
752 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
752 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] ); |
|
753 | 753 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
754 | 754 | |
755 | 755 | $atts['entry'] = $entry; |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | if ( $replace_with !== null ) { |
760 | 760 | $replace_with = self::trigger_shortcode_atts( $replace_with, $atts ); |
761 | 761 | self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with ); |
762 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
762 | + $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | unset( $atts, $replace_with ); |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | $supported_atts = array( 'remove_accents', 'sanitize', 'sanitize_url' ); |
778 | 778 | $included_atts = array_intersect( $supported_atts, array_keys( $atts ) ); |
779 | 779 | foreach ( $included_atts as $included_att ) { |
780 | - if ( '0' === $atts[ $included_att ] ) { |
|
780 | + if ( '0' === $atts[$included_att] ) { |
|
781 | 781 | // Skip any option that uses 0 so sanitize_url=0 does not encode. |
782 | 782 | continue; |
783 | 783 | } |
@@ -850,8 +850,8 @@ discard block |
||
850 | 850 | |
851 | 851 | $dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get' ); |
852 | 852 | |
853 | - if ( isset( $shortcode_values[ $atts['tag'] ] ) ) { |
|
854 | - $replace_with = $shortcode_values[ $atts['tag'] ]; |
|
853 | + if ( isset( $shortcode_values[$atts['tag']] ) ) { |
|
854 | + $replace_with = $shortcode_values[$atts['tag']]; |
|
855 | 855 | } elseif ( in_array( $atts['tag'], $dynamic_default ) ) { |
856 | 856 | $replace_with = self::dynamic_default_values( $atts['tag'], $atts ); |
857 | 857 | } elseif ( $clean_tag === 'user_agent' ) { |
@@ -1062,8 +1062,8 @@ discard block |
||
1062 | 1062 | self::field_types_for_input( $single_input, $field_selection, $field_types ); |
1063 | 1063 | } elseif ( in_array( $type, $multiple_input ) ) { |
1064 | 1064 | self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
1065 | - } elseif ( isset( $field_selection[ $type ] ) ) { |
|
1066 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
1065 | + } elseif ( isset( $field_selection[$type] ) ) { |
|
1066 | + $field_types[$type] = $field_selection[$type]; |
|
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type', 'field_selection' ) ); |
@@ -1096,7 +1096,7 @@ discard block |
||
1096 | 1096 | |
1097 | 1097 | private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
1098 | 1098 | foreach ( $inputs as $input ) { |
1099 | - $field_types[ $input ] = $fields[ $input ]; |
|
1099 | + $field_types[$input] = $fields[$input]; |
|
1100 | 1100 | unset( $input ); |
1101 | 1101 | } |
1102 | 1102 | } |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | 'parent' => false, |
1129 | 1129 | 'pointer' => false, |
1130 | 1130 | ); |
1131 | - $args = wp_parse_args( $args, $defaults ); |
|
1131 | + $args = wp_parse_args( $args, $defaults ); |
|
1132 | 1132 | |
1133 | 1133 | $opt_key = $args['opt_key']; |
1134 | 1134 | $field = $args['field']; |
@@ -1144,24 +1144,24 @@ discard block |
||
1144 | 1144 | |
1145 | 1145 | // Check posted vals before checking saved values |
1146 | 1146 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
1147 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1147 | + if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1148 | 1148 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
1149 | 1149 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
1150 | - $other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
1150 | + $other_val = isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ) : ''; |
|
1151 | 1151 | } else { |
1152 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1152 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1153 | 1153 | } |
1154 | 1154 | |
1155 | 1155 | return $other_val; |
1156 | 1156 | |
1157 | - } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1157 | + } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1158 | 1158 | // For normal fields |
1159 | 1159 | |
1160 | 1160 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
1161 | 1161 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
1162 | - $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
1162 | + $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ) : ''; |
|
1163 | 1163 | } else { |
1164 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1164 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1165 | 1165 | } |
1166 | 1166 | |
1167 | 1167 | return $other_val; |
@@ -1171,8 +1171,8 @@ discard block |
||
1171 | 1171 | if ( $field['type'] === 'checkbox' && is_array( $field['value'] ) ) { |
1172 | 1172 | // Check if there is an "other" val in saved value and make sure the |
1173 | 1173 | // "other" val is not equal to the Other checkbox option |
1174 | - if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
1175 | - $other_val = $field['value'][ $opt_key ]; |
|
1174 | + if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
1175 | + $other_val = $field['value'][$opt_key]; |
|
1176 | 1176 | } |
1177 | 1177 | } else { |
1178 | 1178 | /** |
@@ -1184,8 +1184,8 @@ discard block |
||
1184 | 1184 | // Multi-select dropdowns - key is not preserved |
1185 | 1185 | if ( is_array( $field['value'] ) ) { |
1186 | 1186 | $o_key = array_search( $temp_val, $field['value'] ); |
1187 | - if ( isset( $field['value'][ $o_key ] ) ) { |
|
1188 | - unset( $field['value'][ $o_key ], $o_key ); |
|
1187 | + if ( isset( $field['value'][$o_key] ) ) { |
|
1188 | + unset( $field['value'][$o_key], $o_key ); |
|
1189 | 1189 | } |
1190 | 1190 | } elseif ( $temp_val == $field['value'] ) { |
1191 | 1191 | // For radio and regular dropdowns |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | return $other_args; |
1228 | 1228 | } |
1229 | 1229 | |
1230 | - $other_opt = true; |
|
1230 | + $other_opt = true; |
|
1231 | 1231 | |
1232 | 1232 | self::set_other_name( $args, $other_args ); |
1233 | 1233 | self::set_other_value( $args, $other_args ); |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | if ( is_array( $val ) ) { |
1386 | 1386 | foreach ( $val as $k => $v ) { |
1387 | 1387 | if ( is_string( $v ) ) { |
1388 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
1388 | + $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
1389 | 1389 | unset( $k, $v ); |
1390 | 1390 | } |
1391 | 1391 | } |
@@ -1738,7 +1738,7 @@ discard block |
||
1738 | 1738 | $countries['class'] = 'frm-countries-opts'; |
1739 | 1739 | } |
1740 | 1740 | |
1741 | - $prepop[ __( 'Countries', 'formidable' ) ] = $countries; |
|
1741 | + $prepop[__( 'Countries', 'formidable' )] = $countries; |
|
1742 | 1742 | |
1743 | 1743 | // State abv. |
1744 | 1744 | $states = self::get_us_states(); |
@@ -1748,7 +1748,7 @@ discard block |
||
1748 | 1748 | $state_abv['class'] = 'frm-state-abv-opts'; |
1749 | 1749 | } |
1750 | 1750 | |
1751 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
1751 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
1752 | 1752 | |
1753 | 1753 | // States. |
1754 | 1754 | $states = array_values( $states ); |
@@ -1757,7 +1757,7 @@ discard block |
||
1757 | 1757 | $states['class'] = 'frm-states-opts'; |
1758 | 1758 | } |
1759 | 1759 | |
1760 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
1760 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
1761 | 1761 | unset( $state_abv, $states ); |
1762 | 1762 | |
1763 | 1763 | // Age. |
@@ -1775,7 +1775,7 @@ discard block |
||
1775 | 1775 | $ages['class'] = 'frm-age-opts'; |
1776 | 1776 | } |
1777 | 1777 | |
1778 | - $prepop[ __( 'Age', 'formidable' ) ] = $ages; |
|
1778 | + $prepop[__( 'Age', 'formidable' )] = $ages; |
|
1779 | 1779 | |
1780 | 1780 | // Satisfaction. |
1781 | 1781 | $satisfaction = array( |
@@ -1790,7 +1790,7 @@ discard block |
||
1790 | 1790 | $satisfaction['class'] = 'frm-satisfaction-opts'; |
1791 | 1791 | } |
1792 | 1792 | |
1793 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = $satisfaction; |
|
1793 | + $prepop[__( 'Satisfaction', 'formidable' )] = $satisfaction; |
|
1794 | 1794 | |
1795 | 1795 | // Importance. |
1796 | 1796 | $importance = array( |
@@ -1805,7 +1805,7 @@ discard block |
||
1805 | 1805 | $importance['class'] = 'frm-importance-opts'; |
1806 | 1806 | } |
1807 | 1807 | |
1808 | - $prepop[ __( 'Importance', 'formidable' ) ] = $importance; |
|
1808 | + $prepop[__( 'Importance', 'formidable' )] = $importance; |
|
1809 | 1809 | |
1810 | 1810 | // Agreement. |
1811 | 1811 | $agreement = array( |
@@ -1820,7 +1820,7 @@ discard block |
||
1820 | 1820 | $agreement['class'] = 'frm-agreement-opts'; |
1821 | 1821 | } |
1822 | 1822 | |
1823 | - $prepop[ __( 'Agreement', 'formidable' ) ] = $agreement; |
|
1823 | + $prepop[__( 'Agreement', 'formidable' )] = $agreement; |
|
1824 | 1824 | |
1825 | 1825 | // Likely. |
1826 | 1826 | $likely = array( |
@@ -1835,7 +1835,7 @@ discard block |
||
1835 | 1835 | $likely['class'] = 'frm-likely-opts'; |
1836 | 1836 | } |
1837 | 1837 | |
1838 | - $prepop[ __( 'Likely', 'formidable' ) ] = $likely; |
|
1838 | + $prepop[__( 'Likely', 'formidable' )] = $likely; |
|
1839 | 1839 | |
1840 | 1840 | $prepop = apply_filters( 'frm_bulk_field_choices', $prepop ); |
1841 | 1841 | } |
@@ -2042,16 +2042,16 @@ discard block |
||
2042 | 2042 | */ |
2043 | 2043 | private static function fill_image_setting_options( $options, &$args ) { |
2044 | 2044 | foreach ( $options as $key => $option ) { |
2045 | - $args['options'][ $key ] = $option; |
|
2045 | + $args['options'][$key] = $option; |
|
2046 | 2046 | |
2047 | 2047 | if ( ! empty( $option['addon'] ) ) { |
2048 | - $args['options'][ $key ]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
2048 | + $args['options'][$key]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
2049 | 2049 | } |
2050 | 2050 | |
2051 | - unset( $args['options'][ $key ]['addon'] ); |
|
2051 | + unset( $args['options'][$key]['addon'] ); |
|
2052 | 2052 | $fill = array( 'upgrade', 'message', 'content' ); |
2053 | 2053 | foreach ( $fill as $f ) { |
2054 | - unset( $args['options'][ $key ][ $f ], $f ); |
|
2054 | + unset( $args['options'][$key][$f], $f ); |
|
2055 | 2055 | } |
2056 | 2056 | } |
2057 | 2057 | } |
@@ -2072,8 +2072,8 @@ discard block |
||
2072 | 2072 | |
2073 | 2073 | $fill = array( 'upgrade', 'message', 'content' ); |
2074 | 2074 | foreach ( $fill as $f ) { |
2075 | - if ( isset( $option[ $f ] ) ) { |
|
2076 | - $custom_attrs[ 'data-' . $f ] = $option[ $f ]; |
|
2075 | + if ( isset( $option[$f] ) ) { |
|
2076 | + $custom_attrs['data-' . $f] = $option[$f]; |
|
2077 | 2077 | } |
2078 | 2078 | } |
2079 | 2079 |
@@ -114,13 +114,16 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public static function value_is_posted( $field, $args ) { |
116 | 116 | $value_is_posted = false; |
117 | - if ( $_POST ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
117 | + if ( $_POST ) { |
|
118 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
118 | 119 | $repeating = isset( $args['repeating'] ) && $args['repeating']; |
119 | 120 | if ( $repeating ) { |
120 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
121 | + if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) { |
|
122 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
121 | 123 | $value_is_posted = true; |
122 | 124 | } |
123 | - } elseif ( isset( $_POST['item_meta'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
125 | + } elseif ( isset( $_POST['item_meta'][ $field->id ] ) ) { |
|
126 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
124 | 127 | $value_is_posted = true; |
125 | 128 | } |
126 | 129 | } |
@@ -322,8 +325,10 @@ discard block |
||
322 | 325 | * @since 4.01 |
323 | 326 | */ |
324 | 327 | private static function set_parent_field_posted_value( $field, $value, $args ) { |
325 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ] ) && is_array( $_POST['item_meta'][ $args['parent_field_id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
326 | - if ( ! isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) || ! is_array( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
328 | + if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ] ) && is_array( $_POST['item_meta'][ $args['parent_field_id'] ] ) ) { |
|
329 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
330 | + if ( ! isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) || ! is_array( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) ) { |
|
331 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
327 | 332 | $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
328 | 333 | } |
329 | 334 | } else { |
@@ -395,7 +400,8 @@ discard block |
||
395 | 400 | self::set_other_repeating_vals( $field, $value, $args ); |
396 | 401 | |
397 | 402 | // Check if there are any posted "Other" values. |
398 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
403 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) { |
|
404 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
399 | 405 | |
400 | 406 | // Save original value. |
401 | 407 | $args['temp_value'] = $value; |
@@ -425,7 +431,8 @@ discard block |
||
425 | 431 | } |
426 | 432 | |
427 | 433 | // Check if there are any other posted "other" values for this field. |
428 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
434 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) { |
|
435 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
429 | 436 | // Save original value |
430 | 437 | $args['temp_value'] = $value; |
431 | 438 | $args['other'] = true; |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | if ( $_POST ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
138 | 138 | $repeating = isset( $args['repeating'] ) && $args['repeating']; |
139 | 139 | if ( $repeating ) { |
140 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
140 | + if ( isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
141 | 141 | $value_is_posted = true; |
142 | 142 | } |
143 | - } elseif ( isset( $_POST['item_meta'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
143 | + } elseif ( isset( $_POST['item_meta'][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
144 | 144 | $value_is_posted = true; |
145 | 145 | } |
146 | 146 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | preg_match_all( "/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER ); |
173 | 173 | |
174 | 174 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
175 | - $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
175 | + $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
176 | 176 | if ( ! empty( $add_atts ) ) { |
177 | 177 | $this_atts = array_merge( $atts, $add_atts ); |
178 | 178 | } else { |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $default = FrmEntriesController::show_entry_shortcode( $this_atts ); |
183 | 183 | |
184 | 184 | // Add the default message. |
185 | - $message = str_replace( $shortcodes[0][ $short_key ], $default, $message ); |
|
185 | + $message = str_replace( $shortcodes[0][$short_key], $default, $message ); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | return $message; |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @return string |
196 | 196 | */ |
197 | 197 | public static function prepare_display_value( $entry, $field, $atts ) { |
198 | - $field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false; |
|
198 | + $field_value = isset( $entry->metas[$field->id] ) ? $entry->metas[$field->id] : false; |
|
199 | 199 | |
200 | 200 | if ( FrmAppHelper::pro_is_installed() ) { |
201 | 201 | $empty = empty( $field_value ); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ), '', '', true ); |
221 | 221 | } else { |
222 | 222 | // Get all values for this field. |
223 | - $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false; |
|
223 | + $child_values = isset( $entry->metas[$atts['embedded_field_id']] ) ? $entry->metas[$atts['embedded_field_id']] : false; |
|
224 | 224 | |
225 | 225 | if ( $child_values ) { |
226 | 226 | $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) ); |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | $value = $args['temp_value']; |
339 | 339 | } |
340 | 340 | if ( empty( $args['parent_field_id'] ) ) { |
341 | - $_POST['item_meta'][ $field->id ] = $value; |
|
341 | + $_POST['item_meta'][$field->id] = $value; |
|
342 | 342 | } else { |
343 | 343 | self::set_parent_field_posted_value( $field, $value, $args ); |
344 | 344 | } |
@@ -350,17 +350,17 @@ discard block |
||
350 | 350 | * @since 4.01 |
351 | 351 | */ |
352 | 352 | private static function set_parent_field_posted_value( $field, $value, $args ) { |
353 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ] ) && is_array( $_POST['item_meta'][ $args['parent_field_id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
354 | - if ( ! isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) || ! is_array( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
355 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
353 | + if ( isset( $_POST['item_meta'][$args['parent_field_id']] ) && is_array( $_POST['item_meta'][$args['parent_field_id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
354 | + if ( ! isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] ) || ! is_array( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
355 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
356 | 356 | } |
357 | 357 | } else { |
358 | 358 | // All of the section was probably removed. |
359 | - $_POST['item_meta'][ $args['parent_field_id'] ] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
360 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
359 | + $_POST['item_meta'][$args['parent_field_id']] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
360 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
361 | 361 | } |
362 | 362 | |
363 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
363 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] = $value; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | public static function get_posted_value( $field, &$value, $args ) { |
@@ -390,9 +390,9 @@ discard block |
||
390 | 390 | private static function get_posted_meta( $field_id, $args ) { |
391 | 391 | if ( empty( $args['parent_field_id'] ) ) { |
392 | 392 | // Sanitizing is done next. |
393 | - $value = isset( $_POST['item_meta'][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $field_id ] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
393 | + $value = isset( $_POST['item_meta'][$field_id] ) ? wp_unslash( $_POST['item_meta'][$field_id] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
394 | 394 | } else { |
395 | - $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
395 | + $value = isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) ? wp_unslash( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
396 | 396 | } |
397 | 397 | return $value; |
398 | 398 | } |
@@ -423,14 +423,14 @@ discard block |
||
423 | 423 | self::set_other_repeating_vals( $field, $value, $args ); |
424 | 424 | |
425 | 425 | // Check if there are any posted "Other" values. |
426 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
426 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
427 | 427 | |
428 | 428 | // Save original value. |
429 | 429 | $args['temp_value'] = $value; |
430 | 430 | $args['other'] = true; |
431 | 431 | |
432 | 432 | // Sanitizing is done next. |
433 | - $other_vals = wp_unslash( $_POST['item_meta']['other'][ $field->id ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
433 | + $other_vals = wp_unslash( $_POST['item_meta']['other'][$field->id] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
434 | 434 | FrmAppHelper::sanitize_value( 'sanitize_text_field', $other_vals ); |
435 | 435 | |
436 | 436 | // Set the validation value now |
@@ -453,12 +453,12 @@ discard block |
||
453 | 453 | } |
454 | 454 | |
455 | 455 | // Check if there are any other posted "other" values for this field. |
456 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
456 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
457 | 457 | // Save original value |
458 | 458 | $args['temp_value'] = $value; |
459 | 459 | $args['other'] = true; |
460 | 460 | |
461 | - $other_vals = wp_unslash( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
461 | + $other_vals = wp_unslash( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
462 | 462 | FrmAppHelper::sanitize_value( 'sanitize_text_field', $other_vals ); |
463 | 463 | |
464 | 464 | // Set the validation value now. |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | if ( is_array( $value ) && $field->type === 'checkbox' ) { |
486 | 486 | // Combine "Other" values with checked values. "Other" values will override checked box values. |
487 | 487 | foreach ( $other_vals as $k => $v ) { |
488 | - if ( isset( $value[ $k ] ) && trim( $v ) === '' ) { |
|
488 | + if ( isset( $value[$k] ) && trim( $v ) === '' ) { |
|
489 | 489 | // If the other box is checked, but doesn't have a value. |
490 | 490 | $value = ''; |
491 | 491 | break; |
@@ -502,25 +502,25 @@ discard block |
||
502 | 502 | |
503 | 503 | // Multi-select dropdown. |
504 | 504 | if ( is_array( $value ) ) { |
505 | - $o_key = array_search( $field->options[ $other_key ], $value ); |
|
505 | + $o_key = array_search( $field->options[$other_key], $value ); |
|
506 | 506 | |
507 | 507 | if ( $o_key !== false ) { |
508 | 508 | // Modify the original value so other key will be preserved. |
509 | - $value[ $other_key ] = $value[ $o_key ]; |
|
509 | + $value[$other_key] = $value[$o_key]; |
|
510 | 510 | |
511 | 511 | // By default, the array keys will be numeric for multi-select dropdowns. |
512 | 512 | // If going backwards and forwards between pages, the array key will match the other key. |
513 | 513 | if ( $o_key !== $other_key ) { |
514 | - unset( $value[ $o_key ] ); |
|
514 | + unset( $value[$o_key] ); |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | $args['temp_value'] = $value; |
518 | - $value[ $other_key ] = reset( $other_vals ); |
|
519 | - if ( FrmAppHelper::is_empty_value( $value[ $other_key ] ) ) { |
|
520 | - unset( $value[ $other_key ] ); |
|
518 | + $value[$other_key] = reset( $other_vals ); |
|
519 | + if ( FrmAppHelper::is_empty_value( $value[$other_key] ) ) { |
|
520 | + unset( $value[$other_key] ); |
|
521 | 521 | } |
522 | 522 | } |
523 | - } elseif ( $field->options[ $other_key ] == $value ) { |
|
523 | + } elseif ( $field->options[$other_key] == $value ) { |
|
524 | 524 | $value = $other_vals; |
525 | 525 | } |
526 | 526 | } |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | * @return void |
732 | 732 | */ |
733 | 733 | public static function maybe_render_captcha_score( $entry_id ) { |
734 | - $query = array( |
|
734 | + $query = array( |
|
735 | 735 | 'item_id' => (int) $entry_id, |
736 | 736 | 'field_id' => 0, |
737 | 737 | ); |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | public static function get_entry_status_label( $status ) { |
785 | 785 | $statuses = self::get_entry_statuses(); |
786 | 786 | |
787 | - return $statuses[ self::get_entry_status( $status ) ]; |
|
787 | + return $statuses[self::get_entry_status( $status )]; |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | /** |