@@ -108,7 +108,7 @@ |
||
108 | 108 | 'credit_card' => 'FrmFieldCreditCard', |
109 | 109 | ); |
110 | 110 | |
111 | - $class = isset( $type_classes[ $field_type ] ) ? $type_classes[ $field_type ] : ''; |
|
111 | + $class = isset( $type_classes[$field_type] ) ? $type_classes[$field_type] : ''; |
|
112 | 112 | |
113 | 113 | return apply_filters( 'frm_get_field_type_class', $class, $field_type ); |
114 | 114 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) ); |
273 | 273 | |
274 | 274 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
275 | - $new_values[ $col ] = $values[ $col ]; |
|
275 | + $new_values[$col] = $values[$col]; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | $new_values['options'] = self::maybe_filter_options( $values['options'] ); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | $new_values['created_at'] = current_time( 'mysql', 1 ); |
284 | 284 | |
285 | 285 | if ( isset( $values['id'] ) ) { |
286 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
286 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
287 | 287 | $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
288 | 288 | } |
289 | 289 | |
@@ -292,9 +292,9 @@ discard block |
||
292 | 292 | foreach ( $new_values as $k => $v ) { |
293 | 293 | if ( is_array( $v ) ) { |
294 | 294 | if ( $k === 'default_value' ) { |
295 | - $new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v ); |
|
295 | + $new_values[$k] = FrmAppHelper::maybe_json_encode( $v ); |
|
296 | 296 | } else { |
297 | - $new_values[ $k ] = serialize( $v ); |
|
297 | + $new_values[$k] = serialize( $v ); |
|
298 | 298 | } |
299 | 299 | } |
300 | 300 | unset( $k, $v ); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | } |
315 | 315 | |
316 | 316 | if ( isset( $values['id'] ) ) { |
317 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
317 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | return $new_id; |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
375 | 375 | global $frm_duplicate_ids; |
376 | 376 | |
377 | - $where = array( |
|
377 | + $where = array( |
|
378 | 378 | array( |
379 | 379 | 'or' => 1, |
380 | 380 | 'fi.form_id' => $old_form_id, |
@@ -420,8 +420,8 @@ discard block |
||
420 | 420 | |
421 | 421 | $values = apply_filters( 'frm_duplicated_field', $values ); |
422 | 422 | $new_id = self::create( $values ); |
423 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
424 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
423 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
424 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
425 | 425 | unset( $field ); |
426 | 426 | } |
427 | 427 | } |
@@ -453,11 +453,11 @@ discard block |
||
453 | 453 | |
454 | 454 | // serialize array values |
455 | 455 | foreach ( array( 'field_options', 'options' ) as $opt ) { |
456 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
456 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
457 | 457 | if ( 'field_options' === $opt ) { |
458 | - $values[ $opt ] = self::maybe_filter_options( $values[ $opt ] ); |
|
458 | + $values[$opt] = self::maybe_filter_options( $values[$opt] ); |
|
459 | 459 | } |
460 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
460 | + $values[$opt] = serialize( $values[$opt] ); |
|
461 | 461 | } |
462 | 462 | } |
463 | 463 | if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) { |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | 'id' => $id, |
610 | 610 | 'field_key' => $id, |
611 | 611 | ); |
612 | - $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
612 | + $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
613 | 613 | } |
614 | 614 | |
615 | 615 | return $type; |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | continue; |
636 | 636 | } |
637 | 637 | |
638 | - $fields[ $result->id ] = $result; |
|
638 | + $fields[$result->id] = $result; |
|
639 | 639 | $count ++; |
640 | 640 | if ( $limit == 1 ) { |
641 | 641 | $fields = $result; |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | $count = 0; |
682 | 682 | foreach ( $results as $result ) { |
683 | 683 | $count ++; |
684 | - $fields[ $result->id ] = $result; |
|
684 | + $fields[$result->id] = $result; |
|
685 | 685 | if ( ! empty( $limit ) && $count >= $limit ) { |
686 | 686 | break; |
687 | 687 | } |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | } |
751 | 751 | |
752 | 752 | if ( ! empty( $sub_fields ) ) { |
753 | - $index = $k + $index_offset; |
|
753 | + $index = $k + $index_offset; |
|
754 | 754 | $index_offset += count( $sub_fields ); |
755 | 755 | array_splice( $results, $index, 0, $sub_fields ); |
756 | 756 | } |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | $query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results'; |
796 | 796 | |
797 | 797 | if ( is_array( $where ) ) { |
798 | - $args = array( |
|
798 | + $args = array( |
|
799 | 799 | 'order_by' => $order_by, |
800 | 800 | 'limit' => $limit, |
801 | 801 | ); |
@@ -826,9 +826,9 @@ discard block |
||
826 | 826 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
827 | 827 | |
828 | 828 | self::prepare_options( $result ); |
829 | - $results[ $r_key ]->field_options = $result->field_options; |
|
830 | - $results[ $r_key ]->options = $result->options; |
|
831 | - $results[ $r_key ]->default_value = $result->default_value; |
|
829 | + $results[$r_key]->field_options = $result->field_options; |
|
830 | + $results[$r_key]->options = $result->options; |
|
831 | + $results[$r_key]->default_value = $result->default_value; |
|
832 | 832 | |
833 | 833 | unset( $r_key, $result ); |
834 | 834 | } |
@@ -1030,23 +1030,23 @@ discard block |
||
1030 | 1030 | } |
1031 | 1031 | |
1032 | 1032 | public static function is_option_true_in_array( $field, $option ) { |
1033 | - return isset( $field[ $option ] ) && $field[ $option ]; |
|
1033 | + return isset( $field[$option] ) && $field[$option]; |
|
1034 | 1034 | } |
1035 | 1035 | |
1036 | 1036 | public static function is_option_true_in_object( $field, $option ) { |
1037 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
1037 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
1038 | 1038 | } |
1039 | 1039 | |
1040 | 1040 | public static function is_option_empty_in_array( $field, $option ) { |
1041 | - return ! isset( $field[ $option ] ) || empty( $field[ $option ] ); |
|
1041 | + return ! isset( $field[$option] ) || empty( $field[$option] ); |
|
1042 | 1042 | } |
1043 | 1043 | |
1044 | 1044 | public static function is_option_empty_in_object( $field, $option ) { |
1045 | - return ! isset( $field->field_options[ $option ] ) || empty( $field->field_options[ $option ] ); |
|
1045 | + return ! isset( $field->field_options[$option] ) || empty( $field->field_options[$option] ); |
|
1046 | 1046 | } |
1047 | 1047 | |
1048 | 1048 | public static function is_option_value_in_object( $field, $option ) { |
1049 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
1049 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
1050 | 1050 | } |
1051 | 1051 | |
1052 | 1052 | /** |
@@ -1064,10 +1064,10 @@ discard block |
||
1064 | 1064 | |
1065 | 1065 | public static function get_option_in_array( $field, $option ) { |
1066 | 1066 | |
1067 | - if ( isset( $field[ $option ] ) ) { |
|
1068 | - $this_option = $field[ $option ]; |
|
1069 | - } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) { |
|
1070 | - $this_option = $field['field_options'][ $option ]; |
|
1067 | + if ( isset( $field[$option] ) ) { |
|
1068 | + $this_option = $field[$option]; |
|
1069 | + } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) { |
|
1070 | + $this_option = $field['field_options'][$option]; |
|
1071 | 1071 | } else { |
1072 | 1072 | $this_option = ''; |
1073 | 1073 | } |
@@ -1076,7 +1076,7 @@ discard block |
||
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | public static function get_option_in_object( $field, $option ) { |
1079 | - return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : ''; |
|
1079 | + return isset( $field->field_options[$option] ) ? $field->field_options[$option] : ''; |
|
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | /** |
@@ -5,15 +5,15 @@ discard block |
||
5 | 5 | |
6 | 6 | class FrmFormAction { |
7 | 7 | |
8 | - public $id_base; // Root id for all actions of this type. |
|
9 | - public $name; // Name for this action type. |
|
8 | + public $id_base; // Root id for all actions of this type. |
|
9 | + public $name; // Name for this action type. |
|
10 | 10 | public $option_name; |
11 | - public $action_options; // Option array passed to wp_register_sidebar_widget() |
|
11 | + public $action_options; // Option array passed to wp_register_sidebar_widget() |
|
12 | 12 | public $control_options; // Option array passed to wp_register_widget_control() |
13 | 13 | |
14 | - public $form_id; // The ID of the form to evaluate |
|
15 | - public $number = false; // Unique ID number of the current instance. |
|
16 | - public $id = ''; // Unique ID string of the current instance (id_base-number) |
|
14 | + public $form_id; // The ID of the form to evaluate |
|
15 | + public $number = false; // Unique ID number of the current instance. |
|
16 | + public $id = ''; // Unique ID string of the current instance (id_base-number) |
|
17 | 17 | public $updated = false; // Set true when we update the data after a POST submit - makes sure we don't do it twice. |
18 | 18 | |
19 | 19 | // Member functions that you must over-ride. |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | $groups = FrmFormActionsController::form_action_groups(); |
157 | 157 | $group = 'misc'; |
158 | 158 | |
159 | - if ( isset( $action_options['group'] ) && isset( $groups[ $action_options['group'] ] ) ) { |
|
159 | + if ( isset( $action_options['group'] ) && isset( $groups[$action_options['group']] ) ) { |
|
160 | 160 | $group = $action_options['group']; |
161 | - } elseif ( isset( $groups[ $this->id_base ] ) ) { |
|
161 | + } elseif ( isset( $groups[$this->id_base] ) ) { |
|
162 | 162 | $group = $this->id_base; |
163 | 163 | } else { |
164 | 164 | foreach ( $groups as $name => $check_group ) { |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
172 | - $groups[ $group ]['id'] = $group; |
|
173 | - return $groups[ $group ]; |
|
172 | + $groups[$group]['id'] = $group; |
|
173 | + return $groups[$group]; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * @return integer $post_id |
281 | 281 | */ |
282 | 282 | public function maybe_create_action( $action, $forms ) { |
283 | - if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[ $action['menu_order'] ] ) && $forms[ $action['menu_order'] ] == 'updated' ) { |
|
283 | + if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[$action['menu_order']] ) && $forms[$action['menu_order']] == 'updated' ) { |
|
284 | 284 | // Update action only |
285 | 285 | $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
286 | 286 | $post_id = $this->save_settings( $action ); |
@@ -303,18 +303,18 @@ discard block |
||
303 | 303 | $switch = $this->get_global_switch_fields(); |
304 | 304 | |
305 | 305 | foreach ( (array) $action->post_content as $key => $val ) { |
306 | - if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) { |
|
307 | - $action->post_content[ $key ] = $frm_duplicate_ids[ $val ]; |
|
306 | + if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) { |
|
307 | + $action->post_content[$key] = $frm_duplicate_ids[$val]; |
|
308 | 308 | } elseif ( ! is_array( $val ) ) { |
309 | - $action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val ); |
|
310 | - } elseif ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) { |
|
309 | + $action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val ); |
|
310 | + } elseif ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) { |
|
311 | 311 | // loop through each value if empty |
312 | - if ( empty( $switch[ $key ] ) ) { |
|
313 | - $switch[ $key ] = array_keys( $val ); |
|
312 | + if ( empty( $switch[$key] ) ) { |
|
313 | + $switch[$key] = array_keys( $val ); |
|
314 | 314 | } |
315 | 315 | |
316 | - foreach ( $switch[ $key ] as $subkey ) { |
|
317 | - $action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val ); |
|
316 | + foreach ( $switch[$key] as $subkey ) { |
|
317 | + $action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val ); |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | |
@@ -332,20 +332,20 @@ discard block |
||
332 | 332 | foreach ( $subkey as $subkey2 ) { |
333 | 333 | foreach ( (array) $val as $ck => $cv ) { |
334 | 334 | if ( is_array( $cv ) ) { |
335 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv ); |
|
336 | - } elseif ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) { |
|
337 | - $action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ]; |
|
335 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv ); |
|
336 | + } elseif ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) { |
|
337 | + $action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]]; |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | } |
341 | 341 | } else { |
342 | 342 | foreach ( (array) $val as $ck => $cv ) { |
343 | 343 | if ( is_array( $cv ) ) { |
344 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv ); |
|
345 | - } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) { |
|
346 | - $action[ $ck ] = $frm_duplicate_ids[ $cv ]; |
|
344 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv ); |
|
345 | + } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) { |
|
346 | + $action[$ck] = $frm_duplicate_ids[$cv]; |
|
347 | 347 | } elseif ( $ck == $subkey ) { |
348 | - $action[ $ck ] = $this->maybe_switch_field_ids( $action[ $ck ] ); |
|
348 | + $action[$ck] = $this->maybe_switch_field_ids( $action[$ck] ); |
|
349 | 349 | } |
350 | 350 | } |
351 | 351 | } |
@@ -369,10 +369,10 @@ discard block |
||
369 | 369 | } |
370 | 370 | |
371 | 371 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
372 | - if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) { |
|
372 | + if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) { |
|
373 | 373 | // Sanitizing removes scripts and <email> type of values. |
374 | 374 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
375 | - $settings = wp_unslash( $_POST[ $this->option_name ] ); |
|
375 | + $settings = wp_unslash( $_POST[$this->option_name] ); |
|
376 | 376 | } else { |
377 | 377 | return; |
378 | 378 | } |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | foreach ( $settings as $number => $new_instance ) { |
383 | 383 | $this->_set( $number ); |
384 | 384 | |
385 | - $old_instance = isset( $all_instances[ $number ] ) ? $all_instances[ $number ] : array(); |
|
385 | + $old_instance = isset( $all_instances[$number] ) ? $all_instances[$number] : array(); |
|
386 | 386 | |
387 | 387 | if ( ! isset( $new_instance['post_status'] ) ) { |
388 | 388 | $new_instance['post_status'] = 'draft'; |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | $instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $instance['post_content'], $instance, $new_instance, $old_instance, $this ); |
422 | 422 | |
423 | 423 | if ( false !== $instance ) { |
424 | - $all_instances[ $number ] = $instance; |
|
424 | + $all_instances[$number] = $instance; |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | $action_ids[] = $this->save_settings( $instance ); |
@@ -503,12 +503,12 @@ discard block |
||
503 | 503 | // some plugins/themes are formatting the post_excerpt |
504 | 504 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
505 | 505 | |
506 | - if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) { |
|
506 | + if ( ! isset( $action_controls[$action->post_excerpt] ) ) { |
|
507 | 507 | continue; |
508 | 508 | } |
509 | 509 | |
510 | - $action = $action_controls[ $action->post_excerpt ]->prepare_action( $action ); |
|
511 | - $settings[ $action->ID ] = $action; |
|
510 | + $action = $action_controls[$action->post_excerpt]->prepare_action( $action ); |
|
511 | + $settings[$action->ID] = $action; |
|
512 | 512 | |
513 | 513 | if ( count( $settings ) >= $limit ) { |
514 | 514 | break; |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | 'limit' => 99, |
542 | 542 | 'post_status' => $default_status, |
543 | 543 | ); |
544 | - $args = wp_parse_args( $args, $defaults ); |
|
544 | + $args = wp_parse_args( $args, $defaults ); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | /** |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | |
608 | 608 | $action = $this->prepare_action( $action ); |
609 | 609 | |
610 | - $settings[ $action->ID ] = $action; |
|
610 | + $settings[$action->ID] = $action; |
|
611 | 611 | } |
612 | 612 | |
613 | 613 | if ( 1 === $limit ) { |
@@ -650,10 +650,10 @@ discard block |
||
650 | 650 | |
651 | 651 | foreach ( $default_values as $k => $vals ) { |
652 | 652 | if ( is_array( $vals ) && ! empty( $vals ) ) { |
653 | - if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) { |
|
653 | + if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) { |
|
654 | 654 | continue; |
655 | 655 | } |
656 | - $action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals ); |
|
656 | + $action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals ); |
|
657 | 657 | } |
658 | 658 | } |
659 | 659 | |
@@ -736,14 +736,14 @@ discard block |
||
736 | 736 | * Migrate settings from form->options into new action. |
737 | 737 | */ |
738 | 738 | public function migrate_to_2( $form, $update = 'update' ) { |
739 | - $action = $this->prepare_new( $form->id ); |
|
739 | + $action = $this->prepare_new( $form->id ); |
|
740 | 740 | FrmAppHelper::unserialize_or_decode( $form->options ); |
741 | 741 | |
742 | 742 | // fill with existing options |
743 | 743 | foreach ( $action->post_content as $name => $val ) { |
744 | - if ( isset( $form->options[ $name ] ) ) { |
|
745 | - $action->post_content[ $name ] = $form->options[ $name ]; |
|
746 | - unset( $form->options[ $name ] ); |
|
744 | + if ( isset( $form->options[$name] ) ) { |
|
745 | + $action->post_content[$name] = $form->options[$name]; |
|
746 | + unset( $form->options[$name] ); |
|
747 | 747 | } |
748 | 748 | } |
749 | 749 | |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | $stop = $stop ? false : true; |
810 | 810 | } |
811 | 811 | |
812 | - $met[ $stop ] = $stop; |
|
812 | + $met[$stop] = $stop; |
|
813 | 813 | } |
814 | 814 | |
815 | 815 | if ( $notification['conditions']['any_all'] == 'all' && ! empty( $met ) && isset( $met[0] ) && isset( $met[1] ) ) { |
@@ -863,8 +863,8 @@ discard block |
||
863 | 863 | private static function get_value_from_entry( $entry, $field_id ) { |
864 | 864 | $observed_value = ''; |
865 | 865 | |
866 | - if ( isset( $entry->metas[ $field_id ] ) ) { |
|
867 | - $observed_value = $entry->metas[ $field_id ]; |
|
866 | + if ( isset( $entry->metas[$field_id] ) ) { |
|
867 | + $observed_value = $entry->metas[$field_id]; |
|
868 | 868 | } elseif ( $entry->post_id && FrmAppHelper::pro_is_installed() ) { |
869 | 869 | $field = FrmField::getOne( $field_id ); |
870 | 870 | $observed_value = FrmProEntryMetaHelper::get_post_or_meta_value( |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | $field_val = ''; |
145 | 145 | if ( is_object( $this->field ) ) { |
146 | 146 | $field_val = $this->field->{$column}; |
147 | - } elseif ( is_array( $this->field ) && isset( $this->field[ $column ] ) ) { |
|
148 | - $field_val = $this->field[ $column ]; |
|
147 | + } elseif ( is_array( $this->field ) && isset( $this->field[$column] ) ) { |
|
148 | + $field_val = $this->field[$column]; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | return $field_val; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | if ( is_object( $this->field ) ) { |
160 | 160 | $this->field->{$column} = $value; |
161 | 161 | } elseif ( is_array( $this->field ) ) { |
162 | - $this->field[ $column ] = $value; |
|
162 | + $this->field[$column] = $value; |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | printf( |
549 | 549 | /* translators: %s: Field type */ |
550 | 550 | esc_html__( '%s Options', 'formidable' ), |
551 | - esc_html( $all_field_types[ $args['display']['type'] ]['name'] ) |
|
551 | + esc_html( $all_field_types[$args['display']['type']]['name'] ) |
|
552 | 552 | ); |
553 | 553 | FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown6_icon', array( 'aria-hidden' => 'true' ) ); |
554 | 554 | ?> |
@@ -681,8 +681,8 @@ discard block |
||
681 | 681 | |
682 | 682 | $fields = array_merge( $fields, $pro_fields ); |
683 | 683 | |
684 | - if ( isset( $fields[ $this->type ] ) ) { |
|
685 | - $name = is_array( $fields[ $this->type ] ) ? $fields[ $this->type ]['name'] : $fields[ $this->type ]; |
|
684 | + if ( isset( $fields[$this->type] ) ) { |
|
685 | + $name = is_array( $fields[$this->type] ) ? $fields[$this->type]['name'] : $fields[$this->type]; |
|
686 | 686 | } |
687 | 687 | |
688 | 688 | return $name; |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | * @return array |
700 | 700 | */ |
701 | 701 | public function get_default_field_options() { |
702 | - $opts = array( |
|
702 | + $opts = array( |
|
703 | 703 | 'size' => '', |
704 | 704 | 'max' => '', |
705 | 705 | 'label' => '', |
@@ -1066,7 +1066,7 @@ discard block |
||
1066 | 1066 | } |
1067 | 1067 | } else { |
1068 | 1068 | $args['save_array'] = $this->is_readonly_array(); |
1069 | - $hidden .= $this->show_single_hidden( $selected_value, $args ); |
|
1069 | + $hidden .= $this->show_single_hidden( $selected_value, $args ); |
|
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | return $hidden; |
@@ -1075,7 +1075,7 @@ discard block |
||
1075 | 1075 | protected function show_single_hidden( $selected, $args ) { |
1076 | 1076 | if ( $args['save_array'] ) { |
1077 | 1077 | $args['field_name'] .= '[]'; |
1078 | - $id = ''; |
|
1078 | + $id = ''; |
|
1079 | 1079 | } else { |
1080 | 1080 | $id = ' id="' . esc_attr( $args['html_id'] ) . '"'; |
1081 | 1081 | } |
@@ -1091,8 +1091,8 @@ discard block |
||
1091 | 1091 | $selected = $values['field_value']; |
1092 | 1092 | |
1093 | 1093 | if ( isset( $values['combo_name'] ) ) { |
1094 | - $options = $options[ $values['combo_name'] ]; |
|
1095 | - $selected = ( is_array( $selected ) && isset( $selected[ $values['combo_name'] ] ) ) ? $selected[ $values['combo_name'] ] : ''; |
|
1094 | + $options = $options[$values['combo_name']]; |
|
1095 | + $selected = ( is_array( $selected ) && isset( $selected[$values['combo_name']] ) ) ? $selected[$values['combo_name']] : ''; |
|
1096 | 1096 | } |
1097 | 1097 | |
1098 | 1098 | $input = $this->select_tag( $values ); |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | } |
1144 | 1144 | |
1145 | 1145 | protected function fill_display_field_values( $args = array() ) { |
1146 | - $defaults = array( |
|
1146 | + $defaults = array( |
|
1147 | 1147 | 'field_name' => 'item_meta[' . $this->get_field_column( 'id' ) . ']', |
1148 | 1148 | 'field_id' => $this->get_field_column( 'id' ), |
1149 | 1149 | 'field_plus_id' => '', |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | } |
1197 | 1197 | } |
1198 | 1198 | |
1199 | - if ( isset( $args['errors'][ 'field' . $args['field_id'] ] ) && ! $custom_error_fields ) { |
|
1199 | + if ( isset( $args['errors']['field' . $args['field_id']] ) && ! $custom_error_fields ) { |
|
1200 | 1200 | if ( $error_comes_first ) { |
1201 | 1201 | array_unshift( $describedby, 'frm_error_' . $args['html_id'] ); |
1202 | 1202 | } else { |
@@ -1275,11 +1275,11 @@ discard block |
||
1275 | 1275 | |
1276 | 1276 | $field_id = $this->get_field_column( 'id' ); |
1277 | 1277 | if ( ! array_key_exists( $field_id, $frm_validated_unique_values ) ) { |
1278 | - $frm_validated_unique_values[ $field_id ] = array(); |
|
1278 | + $frm_validated_unique_values[$field_id] = array(); |
|
1279 | 1279 | return false; |
1280 | 1280 | } |
1281 | 1281 | |
1282 | - $already_validated_this_value = in_array( $value, $frm_validated_unique_values[ $field_id ], true ); |
|
1282 | + $already_validated_this_value = in_array( $value, $frm_validated_unique_values[$field_id], true ); |
|
1283 | 1283 | return $already_validated_this_value; |
1284 | 1284 | } |
1285 | 1285 | |
@@ -1304,7 +1304,7 @@ discard block |
||
1304 | 1304 | private function value_validated_as_unique( $value ) { |
1305 | 1305 | global $frm_validated_unique_values; |
1306 | 1306 | $field_id = $this->get_field_column( 'id' ); |
1307 | - $frm_validated_unique_values[ $field_id ][] = $value; |
|
1307 | + $frm_validated_unique_values[$field_id][] = $value; |
|
1308 | 1308 | } |
1309 | 1309 | |
1310 | 1310 | public function get_value_to_save( $value, $atts ) { |
@@ -1336,8 +1336,8 @@ discard block |
||
1336 | 1336 | $value = $this->prepare_display_value( $value, $atts ); |
1337 | 1337 | |
1338 | 1338 | if ( is_array( $value ) ) { |
1339 | - if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[ $atts['show'] ] ) ) { |
|
1340 | - $value = $value[ $atts['show'] ]; |
|
1339 | + if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[$atts['show']] ) ) { |
|
1340 | + $value = $value[$atts['show']]; |
|
1341 | 1341 | } elseif ( ! isset( $atts['return_array'] ) || ! $atts['return_array'] ) { |
1342 | 1342 | $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', '; |
1343 | 1343 | $value = implode( $sep, $value ); |
@@ -1406,8 +1406,8 @@ discard block |
||
1406 | 1406 | $saved_entries = $atts['ids']; |
1407 | 1407 | $new_value = array(); |
1408 | 1408 | foreach ( (array) $value as $old_child_id ) { |
1409 | - if ( isset( $saved_entries[ $old_child_id ] ) ) { |
|
1410 | - $new_value[] = $saved_entries[ $old_child_id ]; |
|
1409 | + if ( isset( $saved_entries[$old_child_id] ) ) { |
|
1410 | + $new_value[] = $saved_entries[$old_child_id]; |
|
1411 | 1411 | } |
1412 | 1412 | } |
1413 | 1413 |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | 'fill' => '#4d4d4d', |
179 | 179 | 'orange' => '#f05a24', |
180 | 180 | ); |
181 | - $atts = array_merge( $defaults, $atts ); |
|
181 | + $atts = array_merge( $defaults, $atts ); |
|
182 | 182 | |
183 | 183 | return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 599.68 601.37" width="' . esc_attr( $atts['width'] ) . '" height="' . esc_attr( $atts['height'] ) . '"> |
184 | 184 | <path fill="' . esc_attr( $atts['orange'] ) . '" d="M289.6 384h140v76h-140z"/> |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * @return string |
390 | 390 | */ |
391 | 391 | public static function get_server_value( $value ) { |
392 | - return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[ $value ] ) ) : ''; |
|
392 | + return isset( $_SERVER[$value] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[$value] ) ) : ''; |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | /** |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | $ip = ''; |
425 | 425 | |
426 | 426 | foreach ( $ip_options as $key ) { |
427 | - if ( ! isset( $_SERVER[ $key ] ) ) { |
|
427 | + if ( ! isset( $_SERVER[$key] ) ) { |
|
428 | 428 | continue; |
429 | 429 | } |
430 | 430 | |
@@ -492,10 +492,10 @@ discard block |
||
492 | 492 | } |
493 | 493 | |
494 | 494 | if ( $src === 'get' ) { |
495 | - $value = isset( $_POST[ $param ] ) ? wp_unslash( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? wp_unslash( $_GET[ $param ] ) : $default ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
|
496 | - if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
495 | + $value = isset( $_POST[$param] ) ? wp_unslash( $_POST[$param] ) : ( isset( $_GET[$param] ) ? wp_unslash( $_GET[$param] ) : $default ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
|
496 | + if ( ! isset( $_POST[$param] ) && isset( $_GET[$param] ) && ! is_array( $value ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
497 | 497 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
498 | - $value = htmlspecialchars_decode( wp_unslash( $_GET[ $param ] ) ); |
|
498 | + $value = htmlspecialchars_decode( wp_unslash( $_GET[$param] ) ); |
|
499 | 499 | } |
500 | 500 | self::sanitize_value( $sanitize, $value ); |
501 | 501 | } else { |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | } |
517 | 517 | |
518 | 518 | $p = trim( $p, ']' ); |
519 | - $value = isset( $value[ $p ] ) ? $value[ $p ] : $default; |
|
519 | + $value = isset( $value[$p] ) ? $value[$p] : $default; |
|
520 | 520 | } |
521 | 521 | } |
522 | 522 | |
@@ -572,26 +572,26 @@ discard block |
||
572 | 572 | 'sanitize' => 'sanitize_text_field', |
573 | 573 | 'serialized' => false, |
574 | 574 | ); |
575 | - $args = wp_parse_args( $args, $defaults ); |
|
575 | + $args = wp_parse_args( $args, $defaults ); |
|
576 | 576 | |
577 | 577 | $value = $args['default']; |
578 | 578 | if ( $args['type'] === 'get' ) { |
579 | - if ( $_GET && isset( $_GET[ $args['param'] ] ) ) { |
|
579 | + if ( $_GET && isset( $_GET[$args['param']] ) ) { |
|
580 | 580 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
581 | - $value = wp_unslash( $_GET[ $args['param'] ] ); |
|
581 | + $value = wp_unslash( $_GET[$args['param']] ); |
|
582 | 582 | } |
583 | 583 | } elseif ( $args['type'] === 'post' ) { |
584 | - if ( isset( $_POST[ $args['param'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
584 | + if ( isset( $_POST[$args['param']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
585 | 585 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
586 | - $value = wp_unslash( $_POST[ $args['param'] ] ); |
|
586 | + $value = wp_unslash( $_POST[$args['param']] ); |
|
587 | 587 | if ( $args['serialized'] === true && is_serialized_string( $value ) && is_serialized( $value ) ) { |
588 | 588 | self::unserialize_or_decode( $value ); |
589 | 589 | } |
590 | 590 | } |
591 | 591 | } else { |
592 | - if ( isset( $_REQUEST[ $args['param'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
592 | + if ( isset( $_REQUEST[$args['param']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
593 | 593 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
594 | - $value = wp_unslash( $_REQUEST[ $args['param'] ] ); |
|
594 | + $value = wp_unslash( $_REQUEST[$args['param']] ); |
|
595 | 595 | } |
596 | 596 | } |
597 | 597 | |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | if ( is_array( $value ) ) { |
624 | 624 | $temp_values = $value; |
625 | 625 | foreach ( $temp_values as $k => $v ) { |
626 | - self::sanitize_value( $sanitize, $value[ $k ] ); |
|
626 | + self::sanitize_value( $sanitize, $value[$k] ); |
|
627 | 627 | } |
628 | 628 | } else { |
629 | 629 | $value = call_user_func( $sanitize, $value ); |
@@ -634,8 +634,8 @@ discard block |
||
634 | 634 | public static function sanitize_request( $sanitize_method, &$values ) { |
635 | 635 | $temp_values = $values; |
636 | 636 | foreach ( $temp_values as $k => $val ) { |
637 | - if ( isset( $sanitize_method[ $k ] ) ) { |
|
638 | - $values[ $k ] = call_user_func( $sanitize_method[ $k ], $val ); |
|
637 | + if ( isset( $sanitize_method[$k] ) ) { |
|
638 | + $values[$k] = call_user_func( $sanitize_method[$k], $val ); |
|
639 | 639 | } |
640 | 640 | } |
641 | 641 | } |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | if ( is_array( $value ) ) { |
659 | 659 | $temp_values = $value; |
660 | 660 | foreach ( $temp_values as $k => $v ) { |
661 | - self::decode_specialchars( $value[ $k ] ); |
|
661 | + self::decode_specialchars( $value[$k] ); |
|
662 | 662 | } |
663 | 663 | } else { |
664 | 664 | self::decode_amp( $value ); |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | * @return array |
779 | 779 | */ |
780 | 780 | public static function add_allowed_submit_button_tags( $allowed_html ) { |
781 | - $allowed_html['input'] = array( |
|
781 | + $allowed_html['input'] = array( |
|
782 | 782 | 'type' => true, |
783 | 783 | 'value' => true, |
784 | 784 | 'formnovalidate' => true, |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | $allowed_html = $html; |
802 | 802 | } elseif ( ! empty( $allowed ) ) { |
803 | 803 | foreach ( (array) $allowed as $a ) { |
804 | - $allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array(); |
|
804 | + $allowed_html[$a] = isset( $html[$a] ) ? $html[$a] : array(); |
|
805 | 805 | } |
806 | 806 | } |
807 | 807 | |
@@ -980,8 +980,8 @@ discard block |
||
980 | 980 | } |
981 | 981 | |
982 | 982 | global $wp_query; |
983 | - if ( isset( $wp_query->query_vars[ $param ] ) ) { |
|
984 | - $value = $wp_query->query_vars[ $param ]; |
|
983 | + if ( isset( $wp_query->query_vars[$param] ) ) { |
|
984 | + $value = $wp_query->query_vars[$param]; |
|
985 | 985 | } |
986 | 986 | |
987 | 987 | return $value; |
@@ -1008,9 +1008,9 @@ discard block |
||
1008 | 1008 | $deprecated = array( |
1009 | 1009 | 'frm_clone_solid_icon' => 'frm_clone_icon', |
1010 | 1010 | ); |
1011 | - if ( isset( $deprecated[ $icon ] ) ) { |
|
1012 | - $icon = $deprecated[ $icon ]; |
|
1013 | - $class = str_replace( $icon, $deprecated[ $icon ], $class ); |
|
1011 | + if ( isset( $deprecated[$icon] ) ) { |
|
1012 | + $icon = $deprecated[$icon]; |
|
1013 | + $class = str_replace( $icon, $deprecated[$icon], $class ); |
|
1014 | 1014 | } |
1015 | 1015 | |
1016 | 1016 | if ( $icon === $class ) { |
@@ -1338,7 +1338,7 @@ discard block |
||
1338 | 1338 | 'new_file_path' => self::plugin_path() . '/js', |
1339 | 1339 | ) |
1340 | 1340 | ); |
1341 | - $new_file = new FrmCreateFile( $file_atts ); |
|
1341 | + $new_file = new FrmCreateFile( $file_atts ); |
|
1342 | 1342 | |
1343 | 1343 | $files = array( |
1344 | 1344 | self::plugin_path() . '/js/formidable.min.js', |
@@ -1357,7 +1357,7 @@ discard block |
||
1357 | 1357 | 'new_file_path' => self::plugin_path() . '/js', |
1358 | 1358 | ) |
1359 | 1359 | ); |
1360 | - $new_file = new FrmCreateFile( $file_atts ); |
|
1360 | + $new_file = new FrmCreateFile( $file_atts ); |
|
1361 | 1361 | $files = array( |
1362 | 1362 | FrmStrpLiteAppHelper::plugin_path() . 'js/frmstrp.min.js', |
1363 | 1363 | ); |
@@ -1842,8 +1842,8 @@ discard block |
||
1842 | 1842 | return $error; |
1843 | 1843 | } |
1844 | 1844 | |
1845 | - $nonce_value = ( $_REQUEST && isset( $_REQUEST[ $nonce_name ] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[ $nonce_name ] ) ) : ''; |
|
1846 | - if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) { |
|
1845 | + $nonce_value = ( $_REQUEST && isset( $_REQUEST[$nonce_name] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST[$nonce_name] ) ) : ''; |
|
1846 | + if ( $_REQUEST && ( ! isset( $_REQUEST[$nonce_name] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) { |
|
1847 | 1847 | $frm_settings = self::get_settings(); |
1848 | 1848 | $error = $frm_settings->admin_permission; |
1849 | 1849 | } |
@@ -1878,7 +1878,7 @@ discard block |
||
1878 | 1878 | } else { |
1879 | 1879 | foreach ( $value as $k => $v ) { |
1880 | 1880 | if ( ! is_array( $v ) ) { |
1881 | - $value[ $k ] = call_user_func( $original_function, $v ); |
|
1881 | + $value[$k] = call_user_func( $original_function, $v ); |
|
1882 | 1882 | } |
1883 | 1883 | } |
1884 | 1884 | } |
@@ -1903,7 +1903,7 @@ discard block |
||
1903 | 1903 | $return = array_merge( $return, self::array_flatten( $value, $keys ) ); |
1904 | 1904 | } else { |
1905 | 1905 | if ( $keys === 'keep' ) { |
1906 | - $return[ $key ] = $value; |
|
1906 | + $return[$key] = $value; |
|
1907 | 1907 | } else { |
1908 | 1908 | $return[] = $value; |
1909 | 1909 | } |
@@ -1956,11 +1956,11 @@ discard block |
||
1956 | 1956 | } |
1957 | 1957 | |
1958 | 1958 | $ver = $default; |
1959 | - if ( ! isset( $wp_scripts->registered[ $handle ] ) ) { |
|
1959 | + if ( ! isset( $wp_scripts->registered[$handle] ) ) { |
|
1960 | 1960 | return $ver; |
1961 | 1961 | } |
1962 | 1962 | |
1963 | - $query = $wp_scripts->registered[ $handle ]; |
|
1963 | + $query = $wp_scripts->registered[$handle]; |
|
1964 | 1964 | if ( is_object( $query ) && ! empty( $query->ver ) ) { |
1965 | 1965 | $ver = $query->ver; |
1966 | 1966 | } |
@@ -2066,7 +2066,7 @@ discard block |
||
2066 | 2066 | $suffix = 2; |
2067 | 2067 | do { |
2068 | 2068 | $key_check = $key . $separator . $suffix; |
2069 | - ++$suffix; |
|
2069 | + ++ $suffix; |
|
2070 | 2070 | } while ( in_array( $key_check, $similar_keys, true ) ); |
2071 | 2071 | |
2072 | 2072 | $key = $key_check; |
@@ -2167,7 +2167,7 @@ discard block |
||
2167 | 2167 | |
2168 | 2168 | foreach ( array( 'name', 'description' ) as $var ) { |
2169 | 2169 | $default_val = isset( $record->{$var} ) ? $record->{$var} : ''; |
2170 | - $values[ $var ] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' ); |
|
2170 | + $values[$var] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' ); |
|
2171 | 2171 | unset( $var, $default_val ); |
2172 | 2172 | } |
2173 | 2173 | |
@@ -2225,9 +2225,9 @@ discard block |
||
2225 | 2225 | } |
2226 | 2226 | } |
2227 | 2227 | |
2228 | - $field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type; |
|
2229 | - if ( isset( $post_values['item_meta'][ $field->id ] ) ) { |
|
2230 | - $new_value = $post_values['item_meta'][ $field->id ]; |
|
2228 | + $field_type = isset( $post_values['field_options']['type_' . $field->id] ) ? $post_values['field_options']['type_' . $field->id] : $field->type; |
|
2229 | + if ( isset( $post_values['item_meta'][$field->id] ) ) { |
|
2230 | + $new_value = $post_values['item_meta'][$field->id]; |
|
2231 | 2231 | self::unserialize_or_decode( $new_value ); |
2232 | 2232 | } else { |
2233 | 2233 | $new_value = $meta_value; |
@@ -2248,7 +2248,7 @@ discard block |
||
2248 | 2248 | |
2249 | 2249 | $field_array = array_merge( (array) $field->field_options, $field_array ); |
2250 | 2250 | |
2251 | - $values['fields'][ $field->id ] = $field_array; |
|
2251 | + $values['fields'][$field->id] = $field_array; |
|
2252 | 2252 | } |
2253 | 2253 | |
2254 | 2254 | /** |
@@ -2295,11 +2295,11 @@ discard block |
||
2295 | 2295 | } |
2296 | 2296 | |
2297 | 2297 | foreach ( $form->options as $opt => $value ) { |
2298 | - if ( isset( $post_values[ $opt ] ) ) { |
|
2299 | - $values[ $opt ] = $post_values[ $opt ]; |
|
2300 | - self::unserialize_or_decode( $values[ $opt ] ); |
|
2298 | + if ( isset( $post_values[$opt] ) ) { |
|
2299 | + $values[$opt] = $post_values[$opt]; |
|
2300 | + self::unserialize_or_decode( $values[$opt] ); |
|
2301 | 2301 | } else { |
2302 | - $values[ $opt ] = $value; |
|
2302 | + $values[$opt] = $value; |
|
2303 | 2303 | } |
2304 | 2304 | } |
2305 | 2305 | |
@@ -2313,8 +2313,8 @@ discard block |
||
2313 | 2313 | $form_defaults = FrmFormsHelper::get_default_opts(); |
2314 | 2314 | |
2315 | 2315 | foreach ( $form_defaults as $opt => $default ) { |
2316 | - if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) { |
|
2317 | - $values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default; |
|
2316 | + if ( ! isset( $values[$opt] ) || $values[$opt] == '' ) { |
|
2317 | + $values[$opt] = ( $post_values && isset( $post_values['options'][$opt] ) ) ? $post_values['options'][$opt] : $default; |
|
2318 | 2318 | } |
2319 | 2319 | |
2320 | 2320 | unset( $opt, $default ); |
@@ -2325,8 +2325,8 @@ discard block |
||
2325 | 2325 | } |
2326 | 2326 | |
2327 | 2327 | foreach ( array( 'before', 'after', 'submit' ) as $h ) { |
2328 | - if ( ! isset( $values[ $h . '_html' ] ) ) { |
|
2329 | - $values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) ); |
|
2328 | + if ( ! isset( $values[$h . '_html'] ) ) { |
|
2329 | + $values[$h . '_html'] = ( isset( $post_values['options'][$h . '_html'] ) ? $post_values['options'][$h . '_html'] : FrmFormsHelper::get_default_html( $h ) ); |
|
2330 | 2330 | } |
2331 | 2331 | unset( $h ); |
2332 | 2332 | } |
@@ -2478,25 +2478,25 @@ discard block |
||
2478 | 2478 | if ( ! is_numeric( $levels ) ) { |
2479 | 2479 | // Show time in specified unit. |
2480 | 2480 | $levels = self::get_unit( $levels ); |
2481 | - if ( isset( $time_strings[ $levels ] ) ) { |
|
2481 | + if ( isset( $time_strings[$levels] ) ) { |
|
2482 | 2482 | $diff = array( |
2483 | 2483 | $levels => self::time_format( $levels, $diff ), |
2484 | 2484 | ); |
2485 | 2485 | $time_strings = array( |
2486 | - $levels => $time_strings[ $levels ], |
|
2486 | + $levels => $time_strings[$levels], |
|
2487 | 2487 | ); |
2488 | 2488 | } |
2489 | 2489 | $levels = 1; |
2490 | 2490 | } |
2491 | 2491 | |
2492 | 2492 | foreach ( $time_strings as $k => $v ) { |
2493 | - if ( isset( $diff[ $k ] ) && $diff[ $k ] ) { |
|
2494 | - $time_strings[ $k ] = $diff[ $k ] . ' ' . ( $diff[ $k ] > 1 ? $v[1] : $v[0] ); |
|
2495 | - } elseif ( isset( $diff[ $k ] ) && count( $time_strings ) === 1 ) { |
|
2493 | + if ( isset( $diff[$k] ) && $diff[$k] ) { |
|
2494 | + $time_strings[$k] = $diff[$k] . ' ' . ( $diff[$k] > 1 ? $v[1] : $v[0] ); |
|
2495 | + } elseif ( isset( $diff[$k] ) && count( $time_strings ) === 1 ) { |
|
2496 | 2496 | // Account for 0. |
2497 | - $time_strings[ $k ] = $diff[ $k ] . ' ' . $v[1]; |
|
2497 | + $time_strings[$k] = $diff[$k] . ' ' . $v[1]; |
|
2498 | 2498 | } else { |
2499 | - unset( $time_strings[ $k ] ); |
|
2499 | + unset( $time_strings[$k] ); |
|
2500 | 2500 | } |
2501 | 2501 | } |
2502 | 2502 | |
@@ -2515,8 +2515,8 @@ discard block |
||
2515 | 2515 | 'y' => 'y', |
2516 | 2516 | 'd' => 'days', |
2517 | 2517 | ); |
2518 | - if ( isset( $return[ $unit ] ) ) { |
|
2519 | - return $diff[ $return[ $unit ] ]; |
|
2518 | + if ( isset( $return[$unit] ) ) { |
|
2519 | + return $diff[$return[$unit]]; |
|
2520 | 2520 | } |
2521 | 2521 | |
2522 | 2522 | $total = $diff['days'] * self::convert_time( 'd', $unit ); |
@@ -2524,11 +2524,11 @@ discard block |
||
2524 | 2524 | $times = array( 'h', 'i', 's' ); |
2525 | 2525 | |
2526 | 2526 | foreach ( $times as $time ) { |
2527 | - if ( ! isset( $diff[ $time ] ) ) { |
|
2527 | + if ( ! isset( $diff[$time] ) ) { |
|
2528 | 2528 | continue; |
2529 | 2529 | } |
2530 | 2530 | |
2531 | - $total += $diff[ $time ] * self::convert_time( $time, $unit ); |
|
2531 | + $total += $diff[$time] * self::convert_time( $time, $unit ); |
|
2532 | 2532 | } |
2533 | 2533 | |
2534 | 2534 | return floor( $total ); |
@@ -2548,7 +2548,7 @@ discard block |
||
2548 | 2548 | 'y' => DAY_IN_SECONDS * 365.25, |
2549 | 2549 | ); |
2550 | 2550 | |
2551 | - return $convert[ $from ] / $convert[ $to ]; |
|
2551 | + return $convert[$from] / $convert[$to]; |
|
2552 | 2552 | } |
2553 | 2553 | |
2554 | 2554 | /** |
@@ -2556,7 +2556,7 @@ discard block |
||
2556 | 2556 | */ |
2557 | 2557 | private static function get_unit( $unit ) { |
2558 | 2558 | $units = self::get_time_strings(); |
2559 | - if ( isset( $units[ $unit ] ) || is_numeric( $unit ) ) { |
|
2559 | + if ( isset( $units[$unit] ) || is_numeric( $unit ) ) { |
|
2560 | 2560 | return $unit; |
2561 | 2561 | } |
2562 | 2562 | |
@@ -2667,17 +2667,17 @@ discard block |
||
2667 | 2667 | |
2668 | 2668 | case 1: |
2669 | 2669 | $l2 = $name; |
2670 | - self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] ); |
|
2670 | + self::add_value_to_array( $name, $l2, $this_val, $vars[$l1] ); |
|
2671 | 2671 | break; |
2672 | 2672 | |
2673 | 2673 | case 2: |
2674 | 2674 | $l3 = $name; |
2675 | - self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] ); |
|
2675 | + self::add_value_to_array( $name, $l3, $this_val, $vars[$l1][$l2] ); |
|
2676 | 2676 | break; |
2677 | 2677 | |
2678 | 2678 | case 3: |
2679 | 2679 | $l4 = $name; |
2680 | - self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] ); |
|
2680 | + self::add_value_to_array( $name, $l4, $this_val, $vars[$l1][$l2][$l3] ); |
|
2681 | 2681 | } |
2682 | 2682 | |
2683 | 2683 | unset( $this_val, $n ); |
@@ -2696,8 +2696,8 @@ discard block |
||
2696 | 2696 | public static function add_value_to_array( $name, $l1, $val, &$vars ) { |
2697 | 2697 | if ( $name == '' ) { |
2698 | 2698 | $vars[] = $val; |
2699 | - } elseif ( ! isset( $vars[ $l1 ] ) ) { |
|
2700 | - $vars[ $l1 ] = $val; |
|
2699 | + } elseif ( ! isset( $vars[$l1] ) ) { |
|
2700 | + $vars[$l1] = $val; |
|
2701 | 2701 | } |
2702 | 2702 | } |
2703 | 2703 | |
@@ -2714,7 +2714,7 @@ discard block |
||
2714 | 2714 | 'new_tab' => __( 'This option will open the link in a new browser tab. Please note that some popup blockers may prevent this from happening, in which case the link will be displayed.', 'formidable' ), |
2715 | 2715 | ); |
2716 | 2716 | |
2717 | - if ( ! isset( $tooltips[ $name ] ) ) { |
|
2717 | + if ( ! isset( $tooltips[$name] ) ) { |
|
2718 | 2718 | return; |
2719 | 2719 | } |
2720 | 2720 | |
@@ -2724,7 +2724,7 @@ discard block |
||
2724 | 2724 | echo ' class="frm_help"'; |
2725 | 2725 | } |
2726 | 2726 | |
2727 | - echo ' title="' . esc_attr( $tooltips[ $name ] ); |
|
2727 | + echo ' title="' . esc_attr( $tooltips[$name] ); |
|
2728 | 2728 | |
2729 | 2729 | if ( 'open' != $class ) { |
2730 | 2730 | echo '"'; |
@@ -2783,13 +2783,13 @@ discard block |
||
2783 | 2783 | } |
2784 | 2784 | |
2785 | 2785 | private static function prepare_action_slashes( $val, $key, &$post_content ) { |
2786 | - if ( ! isset( $post_content[ $key ] ) || is_numeric( $val ) ) { |
|
2786 | + if ( ! isset( $post_content[$key] ) || is_numeric( $val ) ) { |
|
2787 | 2787 | return; |
2788 | 2788 | } |
2789 | 2789 | |
2790 | 2790 | if ( is_array( $val ) ) { |
2791 | 2791 | foreach ( $val as $k1 => $v1 ) { |
2792 | - self::prepare_action_slashes( $v1, $k1, $post_content[ $key ] ); |
|
2792 | + self::prepare_action_slashes( $v1, $k1, $post_content[$key] ); |
|
2793 | 2793 | unset( $k1, $v1 ); |
2794 | 2794 | } |
2795 | 2795 | } else { |
@@ -2797,7 +2797,7 @@ discard block |
||
2797 | 2797 | $val = stripslashes( $val ); |
2798 | 2798 | |
2799 | 2799 | // Add backslashes before double quotes and forward slashes only |
2800 | - $post_content[ $key ] = addcslashes( $val, '"\\/' ); |
|
2800 | + $post_content[$key] = addcslashes( $val, '"\\/' ); |
|
2801 | 2801 | } |
2802 | 2802 | } |
2803 | 2803 | |
@@ -2918,14 +2918,14 @@ discard block |
||
2918 | 2918 | continue; |
2919 | 2919 | } |
2920 | 2920 | $key = $input['name']; |
2921 | - if ( isset( $formatted[ $key ] ) ) { |
|
2922 | - if ( is_array( $formatted[ $key ] ) ) { |
|
2923 | - $formatted[ $key ][] = $input['value']; |
|
2921 | + if ( isset( $formatted[$key] ) ) { |
|
2922 | + if ( is_array( $formatted[$key] ) ) { |
|
2923 | + $formatted[$key][] = $input['value']; |
|
2924 | 2924 | } else { |
2925 | - $formatted[ $key ] = array( $formatted[ $key ], $input['value'] ); |
|
2925 | + $formatted[$key] = array( $formatted[$key], $input['value'] ); |
|
2926 | 2926 | } |
2927 | 2927 | } else { |
2928 | - $formatted[ $key ] = $input['value']; |
|
2928 | + $formatted[$key] = $input['value']; |
|
2929 | 2929 | } |
2930 | 2930 | } |
2931 | 2931 | |
@@ -3603,8 +3603,8 @@ discard block |
||
3603 | 3603 | } |
3604 | 3604 | |
3605 | 3605 | foreach ( $keys as $key ) { |
3606 | - if ( isset( $values[ $key ] ) ) { |
|
3607 | - $values[ $key ] = self::kses( $values[ $key ], 'all' ); |
|
3606 | + if ( isset( $values[$key] ) ) { |
|
3607 | + $values[$key] = self::kses( $values[$key], 'all' ); |
|
3608 | 3608 | } |
3609 | 3609 | } |
3610 | 3610 | |
@@ -3763,7 +3763,7 @@ discard block |
||
3763 | 3763 | return 0; |
3764 | 3764 | } |
3765 | 3765 | |
3766 | - return strlen( $parts[ count( $parts ) - 1 ] ); |
|
3766 | + return strlen( $parts[count( $parts ) - 1] ); |
|
3767 | 3767 | } |
3768 | 3768 | |
3769 | 3769 | /** |
@@ -493,7 +493,8 @@ discard block |
||
493 | 493 | |
494 | 494 | if ( $src === 'get' ) { |
495 | 495 | $value = isset( $_POST[ $param ] ) ? wp_unslash( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? wp_unslash( $_GET[ $param ] ) : $default ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
496 | - if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
496 | + if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) { |
|
497 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
497 | 498 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
498 | 499 | $value = htmlspecialchars_decode( wp_unslash( $_GET[ $param ] ) ); |
499 | 500 | } |
@@ -581,7 +582,8 @@ discard block |
||
581 | 582 | $value = wp_unslash( $_GET[ $args['param'] ] ); |
582 | 583 | } |
583 | 584 | } elseif ( $args['type'] === 'post' ) { |
584 | - if ( isset( $_POST[ $args['param'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
585 | + if ( isset( $_POST[ $args['param'] ] ) ) { |
|
586 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
585 | 587 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
586 | 588 | $value = wp_unslash( $_POST[ $args['param'] ] ); |
587 | 589 | if ( $args['serialized'] === true && is_serialized_string( $value ) && is_serialized( $value ) ) { |
@@ -589,7 +591,8 @@ discard block |
||
589 | 591 | } |
590 | 592 | } |
591 | 593 | } else { |
592 | - if ( isset( $_REQUEST[ $args['param'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
594 | + if ( isset( $_REQUEST[ $args['param'] ] ) ) { |
|
595 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
593 | 596 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
594 | 597 | $value = wp_unslash( $_REQUEST[ $args['param'] ] ); |
595 | 598 | } |
@@ -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 |
@@ -16,10 +16,10 @@ |
||
16 | 16 | public static function get_currency( $currency ) { |
17 | 17 | $currency = strtoupper( $currency ); |
18 | 18 | $currencies = self::get_currencies(); |
19 | - if ( isset( $currencies[ $currency ] ) ) { |
|
20 | - $currency = $currencies[ $currency ]; |
|
21 | - } elseif ( isset( $currencies[ strtolower( $currency ) ] ) ) { |
|
22 | - $currency = $currencies[ strtolower( $currency ) ]; |
|
19 | + if ( isset( $currencies[$currency] ) ) { |
|
20 | + $currency = $currencies[$currency]; |
|
21 | + } elseif ( isset( $currencies[strtolower( $currency )] ) ) { |
|
22 | + $currency = $currencies[strtolower( $currency )]; |
|
23 | 23 | } else { |
24 | 24 | $currency = $currencies['usd']; |
25 | 25 | } |
@@ -464,8 +464,8 @@ |
||
464 | 464 | 'charge.refunded' => 'refunded', |
465 | 465 | ); |
466 | 466 | |
467 | - if ( isset( $events[ $this->event->type ] ) ) { |
|
468 | - $this->status = $events[ $this->event->type ]; |
|
467 | + if ( isset( $events[$this->event->type] ) ) { |
|
468 | + $this->status = $events[$this->event->type]; |
|
469 | 469 | $this->set_payment_status(); |
470 | 470 | } elseif ( $this->event->type === 'customer.deleted' ) { |
471 | 471 | $this->reset_customer(); |
@@ -100,7 +100,7 @@ |
||
100 | 100 | 'sort' => '', |
101 | 101 | 'sdir' => '', |
102 | 102 | ) as $var => $default ) { |
103 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default ); |
|
103 | + $values[$var] = FrmAppHelper::get_param( $var, $default ); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | return $values; |