@@ -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. |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | $groups = FrmFormActionsController::form_action_groups(); |
152 | 152 | $group = 'misc'; |
153 | 153 | |
154 | - if ( isset( $action_options['group'] ) && isset( $groups[ $action_options['group'] ] ) ) { |
|
154 | + if ( isset( $action_options['group'] ) && isset( $groups[$action_options['group']] ) ) { |
|
155 | 155 | $group = $action_options['group']; |
156 | - } elseif ( isset( $groups[ $this->id_base ] ) ) { |
|
156 | + } elseif ( isset( $groups[$this->id_base] ) ) { |
|
157 | 157 | $group = $this->id_base; |
158 | 158 | } else { |
159 | 159 | foreach ( $groups as $name => $check_group ) { |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | - $groups[ $group ]['id'] = $group; |
|
168 | - return $groups[ $group ]; |
|
167 | + $groups[$group]['id'] = $group; |
|
168 | + return $groups[$group]; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @return integer $post_id |
268 | 268 | */ |
269 | 269 | public function maybe_create_action( $action, $forms ) { |
270 | - if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[ $action['menu_order'] ] ) && $forms[ $action['menu_order'] ] == 'updated' ) { |
|
270 | + if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[$action['menu_order']] ) && $forms[$action['menu_order']] == 'updated' ) { |
|
271 | 271 | // Update action only |
272 | 272 | $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
273 | 273 | $post_id = $this->save_settings( $action ); |
@@ -287,18 +287,18 @@ discard block |
||
287 | 287 | $switch = $this->get_global_switch_fields(); |
288 | 288 | |
289 | 289 | foreach ( (array) $action->post_content as $key => $val ) { |
290 | - if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) { |
|
291 | - $action->post_content[ $key ] = $frm_duplicate_ids[ $val ]; |
|
290 | + if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) { |
|
291 | + $action->post_content[$key] = $frm_duplicate_ids[$val]; |
|
292 | 292 | } elseif ( ! is_array( $val ) ) { |
293 | - $action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val ); |
|
294 | - } elseif ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) { |
|
293 | + $action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val ); |
|
294 | + } elseif ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) { |
|
295 | 295 | // loop through each value if empty |
296 | - if ( empty( $switch[ $key ] ) ) { |
|
297 | - $switch[ $key ] = array_keys( $val ); |
|
296 | + if ( empty( $switch[$key] ) ) { |
|
297 | + $switch[$key] = array_keys( $val ); |
|
298 | 298 | } |
299 | 299 | |
300 | - foreach ( $switch[ $key ] as $subkey ) { |
|
301 | - $action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val ); |
|
300 | + foreach ( $switch[$key] as $subkey ) { |
|
301 | + $action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val ); |
|
302 | 302 | } |
303 | 303 | } |
304 | 304 | |
@@ -316,20 +316,20 @@ discard block |
||
316 | 316 | foreach ( $subkey as $subkey2 ) { |
317 | 317 | foreach ( (array) $val as $ck => $cv ) { |
318 | 318 | if ( is_array( $cv ) ) { |
319 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv ); |
|
320 | - } elseif ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) { |
|
321 | - $action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ]; |
|
319 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv ); |
|
320 | + } elseif ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) { |
|
321 | + $action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]]; |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | } |
325 | 325 | } else { |
326 | 326 | foreach ( (array) $val as $ck => $cv ) { |
327 | 327 | if ( is_array( $cv ) ) { |
328 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv ); |
|
329 | - } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) { |
|
330 | - $action[ $ck ] = $frm_duplicate_ids[ $cv ]; |
|
328 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv ); |
|
329 | + } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) { |
|
330 | + $action[$ck] = $frm_duplicate_ids[$cv]; |
|
331 | 331 | } elseif ( $ck == $subkey ) { |
332 | - $action[ $ck ] = $this->maybe_switch_field_ids( $action[ $ck ] ); |
|
332 | + $action[$ck] = $this->maybe_switch_field_ids( $action[$ck] ); |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | } |
@@ -353,10 +353,10 @@ discard block |
||
353 | 353 | } |
354 | 354 | |
355 | 355 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
356 | - if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) { |
|
356 | + if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) { |
|
357 | 357 | // Sanitizing removes scripts and <email> type of values. |
358 | 358 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
359 | - $settings = wp_unslash( $_POST[ $this->option_name ] ); |
|
359 | + $settings = wp_unslash( $_POST[$this->option_name] ); |
|
360 | 360 | } else { |
361 | 361 | return; |
362 | 362 | } |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | foreach ( $settings as $number => $new_instance ) { |
367 | 367 | $this->_set( $number ); |
368 | 368 | |
369 | - $old_instance = isset( $all_instances[ $number ] ) ? $all_instances[ $number ] : array(); |
|
369 | + $old_instance = isset( $all_instances[$number] ) ? $all_instances[$number] : array(); |
|
370 | 370 | |
371 | 371 | if ( ! isset( $new_instance['post_status'] ) ) { |
372 | 372 | $new_instance['post_status'] = 'draft'; |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | $instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $instance['post_content'], $instance, $new_instance, $old_instance, $this ); |
407 | 407 | |
408 | 408 | if ( false !== $instance ) { |
409 | - $all_instances[ $number ] = $instance; |
|
409 | + $all_instances[$number] = $instance; |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | $action_ids[] = $this->save_settings( $instance ); |
@@ -482,12 +482,12 @@ discard block |
||
482 | 482 | // some plugins/themes are formatting the post_excerpt |
483 | 483 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
484 | 484 | |
485 | - if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) { |
|
485 | + if ( ! isset( $action_controls[$action->post_excerpt] ) ) { |
|
486 | 486 | continue; |
487 | 487 | } |
488 | 488 | |
489 | - $action = $action_controls[ $action->post_excerpt ]->prepare_action( $action ); |
|
490 | - $settings[ $action->ID ] = $action; |
|
489 | + $action = $action_controls[$action->post_excerpt]->prepare_action( $action ); |
|
490 | + $settings[$action->ID] = $action; |
|
491 | 491 | |
492 | 492 | if ( count( $settings ) >= $limit ) { |
493 | 493 | break; |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | 'limit' => 99, |
518 | 518 | 'post_status' => $default_status, |
519 | 519 | ); |
520 | - $args = wp_parse_args( $args, $defaults ); |
|
520 | + $args = wp_parse_args( $args, $defaults ); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | /** |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | |
579 | 579 | $action = $this->prepare_action( $action ); |
580 | 580 | |
581 | - $settings[ $action->ID ] = $action; |
|
581 | + $settings[$action->ID] = $action; |
|
582 | 582 | } |
583 | 583 | |
584 | 584 | if ( 1 === $limit ) { |
@@ -615,10 +615,10 @@ discard block |
||
615 | 615 | |
616 | 616 | foreach ( $default_values as $k => $vals ) { |
617 | 617 | if ( is_array( $vals ) && ! empty( $vals ) ) { |
618 | - if ( 'event' == $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) { |
|
618 | + if ( 'event' == $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) { |
|
619 | 619 | continue; |
620 | 620 | } |
621 | - $action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals ); |
|
621 | + $action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals ); |
|
622 | 622 | } |
623 | 623 | } |
624 | 624 | |
@@ -693,14 +693,14 @@ discard block |
||
693 | 693 | * Migrate settings from form->options into new action. |
694 | 694 | */ |
695 | 695 | public function migrate_to_2( $form, $update = 'update' ) { |
696 | - $action = $this->prepare_new( $form->id ); |
|
696 | + $action = $this->prepare_new( $form->id ); |
|
697 | 697 | FrmAppHelper::unserialize_or_decode( $form->options ); |
698 | 698 | |
699 | 699 | // fill with existing options |
700 | 700 | foreach ( $action->post_content as $name => $val ) { |
701 | - if ( isset( $form->options[ $name ] ) ) { |
|
702 | - $action->post_content[ $name ] = $form->options[ $name ]; |
|
703 | - unset( $form->options[ $name ] ); |
|
701 | + if ( isset( $form->options[$name] ) ) { |
|
702 | + $action->post_content[$name] = $form->options[$name]; |
|
703 | + unset( $form->options[$name] ); |
|
704 | 704 | } |
705 | 705 | } |
706 | 706 | |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | $stop = $stop ? false : true; |
767 | 767 | } |
768 | 768 | |
769 | - $met[ $stop ] = $stop; |
|
769 | + $met[$stop] = $stop; |
|
770 | 770 | } |
771 | 771 | |
772 | 772 | if ( $notification['conditions']['any_all'] == 'all' && ! empty( $met ) && isset( $met[0] ) && isset( $met[1] ) ) { |
@@ -817,8 +817,8 @@ discard block |
||
817 | 817 | private static function get_value_from_entry( $entry, $field_id ) { |
818 | 818 | $observed_value = ''; |
819 | 819 | |
820 | - if ( isset( $entry->metas[ $field_id ] ) ) { |
|
821 | - $observed_value = $entry->metas[ $field_id ]; |
|
820 | + if ( isset( $entry->metas[$field_id] ) ) { |
|
821 | + $observed_value = $entry->metas[$field_id]; |
|
822 | 822 | } elseif ( $entry->post_id && FrmAppHelper::pro_is_installed() ) { |
823 | 823 | $field = FrmField::getOne( $field_id ); |
824 | 824 | $observed_value = FrmProEntryMetaHelper::get_post_or_meta_value( |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | </li><?php |
17 | 17 | $render_icon = true; |
18 | 18 | foreach ( array( 20872734, 20874748, 20882522, 20874739, 20908981, 28109851 ) as $template ) { |
19 | - if ( isset( $templates[ $template ] ) ) { |
|
20 | - $template = $templates[ $template ]; |
|
19 | + if ( isset( $templates[$template] ) ) { |
|
20 | + $template = $templates[$template]; |
|
21 | 21 | require $view_path . 'list-template.php'; |
22 | 22 | } |
23 | 23 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | <ul class="frm-templates-list frm-categories-list"> |
46 | 46 | <?php foreach ( $categories as $category ) { ?> |
47 | 47 | <?php |
48 | - $category_templates = $templates_by_category[ $category ]; |
|
48 | + $category_templates = $templates_by_category[$category]; |
|
49 | 49 | $count = count( $category_templates ); |
50 | 50 | $available = FrmFormsHelper::available_count( $category_templates, $args ); |
51 | 51 | ?> |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | class FrmDefPostAction extends FrmFormAction { |
8 | 8 | public function __construct() { |
9 | 9 | $action_ops = FrmFormAction::default_action_opts( 'frm_wordpress_icon frm-inverse frm_show_upgrade' ); |
10 | - $action_ops['color'] = 'rgb(0,160,210)'; |
|
10 | + $action_ops['color'] = 'rgb(0,160,210)'; |
|
11 | 11 | |
12 | 12 | parent::__construct( 'wppost', __( 'Create Post', 'formidable' ), $action_ops ); |
13 | 13 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | class FrmDefQuizAction extends FrmFormAction { |
38 | 38 | public function __construct() { |
39 | 39 | $action_ops = FrmFormAction::default_action_opts( 'frm_percent_icon frm_quiz_icon frm_show_upgrade' ); |
40 | - $action_ops['plugin'] = 'quizzes'; |
|
40 | + $action_ops['plugin'] = 'quizzes'; |
|
41 | 41 | parent::__construct( 'quiz', __( 'Quiz', 'formidable' ), $action_ops ); |
42 | 42 | } |
43 | 43 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | class FrmDefMlcmpAction extends FrmFormAction { |
56 | 56 | public function __construct() { |
57 | 57 | $action_ops = FrmFormAction::default_action_opts( 'frm_mailchimp_icon frm_show_upgrade frm-inverse' ); |
58 | - $action_ops['color'] = 'var(--dark-grey)'; |
|
58 | + $action_ops['color'] = 'var(--dark-grey)'; |
|
59 | 59 | |
60 | 60 | parent::__construct( 'mailchimp', 'MailChimp', $action_ops ); |
61 | 61 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | return $errors; |
15 | 15 | } |
16 | 16 | |
17 | - if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values[ 'frm_submit_entry_' . $values['form_id'] ] ) || ! wp_verify_nonce( $values[ 'frm_submit_entry_' . $values['form_id'] ], 'frm_submit_entry_nonce' ) ) ) { |
|
17 | + if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values['frm_submit_entry_' . $values['form_id']] ) || ! wp_verify_nonce( $values['frm_submit_entry_' . $values['form_id']], 'frm_submit_entry_nonce' ) ) ) { |
|
18 | 18 | $frm_settings = FrmAppHelper::get_settings(); |
19 | 19 | $errors['form'] = $frm_settings->admin_permission; |
20 | 20 | } |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | 'key_pointer' => '', // the pointer in the posted array |
89 | 89 | 'exclude' => array(), // exclude these field types from validation |
90 | 90 | ); |
91 | - $args = wp_parse_args( $args, $defaults ); |
|
91 | + $args = wp_parse_args( $args, $defaults ); |
|
92 | 92 | |
93 | 93 | if ( empty( $args['parent_field_id'] ) ) { |
94 | - $value = isset( $values['item_meta'][ $args['id'] ] ) ? $values['item_meta'][ $args['id'] ] : ''; |
|
94 | + $value = isset( $values['item_meta'][$args['id']] ) ? $values['item_meta'][$args['id']] : ''; |
|
95 | 95 | } else { |
96 | 96 | // value is from a nested form |
97 | 97 | $value = $values; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
115 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
115 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
116 | 116 | } elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
117 | 117 | self::maybe_add_item_name( $value, $posted_field ); |
118 | 118 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $pattern = self::phone_format( $field ); |
189 | 189 | |
190 | 190 | if ( ! preg_match( $pattern, $value ) ) { |
191 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
191 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | */ |
299 | 299 | private static function form_is_in_progress( $values ) { |
300 | 300 | return FrmAppHelper::pro_is_installed() && |
301 | - ( isset( $values[ 'frm_page_order_' . $values['form_id'] ] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) && |
|
301 | + ( isset( $values['frm_page_order_' . $values['form_id']] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) && |
|
302 | 302 | FrmField::get_all_types_in_form( $values['form_id'], 'break' ); |
303 | 303 | } |
304 | 304 | |
@@ -543,9 +543,9 @@ discard block |
||
543 | 543 | foreach ( $datas['missing_keys'] as $key_index => $key ) { |
544 | 544 | $found = self::is_akismet_guest_info_value( $key, $value, $field_id, $datas['name_field_ids'] ); |
545 | 545 | if ( $found ) { |
546 | - $datas[ $key ] = $value; |
|
546 | + $datas[$key] = $value; |
|
547 | 547 | $datas['frm_duplicated'][] = $field_id; |
548 | - unset( $datas['missing_keys'][ $key_index ] ); |
|
548 | + unset( $datas['missing_keys'][$key_index] ); |
|
549 | 549 | } |
550 | 550 | } |
551 | 551 | } |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | |
592 | 592 | // Send any potentially useful $_SERVER vars, but avoid sending junk we don't need. |
593 | 593 | if ( $include_value ) { |
594 | - $datas[ $key ] = $value; |
|
594 | + $datas[$key] = $value; |
|
595 | 595 | } |
596 | 596 | unset( $key, $value ); |
597 | 597 | } |
@@ -608,10 +608,10 @@ discard block |
||
608 | 608 | private static function add_comment_content_to_akismet( &$datas, $values ) { |
609 | 609 | if ( isset( $datas['frm_duplicated'] ) ) { |
610 | 610 | foreach ( $datas['frm_duplicated'] as $index ) { |
611 | - if ( isset( $values['item_meta'][ $index ] ) ) { |
|
612 | - unset( $values['item_meta'][ $index ] ); |
|
611 | + if ( isset( $values['item_meta'][$index] ) ) { |
|
612 | + unset( $values['item_meta'][$index] ); |
|
613 | 613 | } else { |
614 | - unset( $values[ $index ] ); |
|
614 | + unset( $values[$index] ); |
|
615 | 615 | } |
616 | 616 | } |
617 | 617 | unset( $datas['frm_duplicated'] ); |
@@ -632,14 +632,14 @@ discard block |
||
632 | 632 | private static function skip_adding_values_to_akismet( &$values ) { |
633 | 633 | $skipped_fields = self::get_akismet_skipped_field_ids( $values ); |
634 | 634 | foreach ( $skipped_fields as $skipped_field ) { |
635 | - if ( ! isset( $values['item_meta'][ $skipped_field->id ] ) ) { |
|
635 | + if ( ! isset( $values['item_meta'][$skipped_field->id] ) ) { |
|
636 | 636 | continue; |
637 | 637 | } |
638 | 638 | |
639 | 639 | if ( self::should_really_skip_field( $skipped_field, $values ) ) { |
640 | - unset( $values['item_meta'][ $skipped_field->id ] ); |
|
641 | - if ( isset( $values['item_meta']['other'][ $skipped_field->id ] ) ) { |
|
642 | - unset( $values['item_meta']['other'][ $skipped_field->id ] ); |
|
640 | + unset( $values['item_meta'][$skipped_field->id] ); |
|
641 | + if ( isset( $values['item_meta']['other'][$skipped_field->id] ) ) { |
|
642 | + unset( $values['item_meta']['other'][$skipped_field->id] ); |
|
643 | 643 | } |
644 | 644 | } |
645 | 645 | } |
@@ -672,14 +672,14 @@ discard block |
||
672 | 672 | } |
673 | 673 | |
674 | 674 | // If a choice field has Other option, but Other is not selected. |
675 | - if ( empty( $values['item_meta']['other'][ $field_data->id ] ) ) { |
|
675 | + if ( empty( $values['item_meta']['other'][$field_data->id] ) ) { |
|
676 | 676 | return true; |
677 | 677 | } |
678 | 678 | |
679 | 679 | // Check if submitted value is same as one of field option. |
680 | 680 | foreach ( $field_data->options as $option ) { |
681 | 681 | $option_value = ! is_array( $option ) ? $option : ( isset( $option['value'] ) ? $option['value'] : '' ); |
682 | - if ( $values['item_meta']['other'][ $field_data->id ] === $option_value ) { |
|
682 | + if ( $values['item_meta']['other'][$field_data->id] === $option_value ) { |
|
683 | 683 | return true; |
684 | 684 | } |
685 | 685 | } |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | |
750 | 750 | // Convert name array to string. |
751 | 751 | if ( isset( $value['first'] ) && isset( $value['last'] ) ) { |
752 | - $values['item_meta'][ $field_id ] = trim( implode( ' ', $value ) ); |
|
752 | + $values['item_meta'][$field_id] = trim( implode( ' ', $value ) ); |
|
753 | 753 | $values['name_field_ids'][] = $field_id; |
754 | 754 | continue; |
755 | 755 | } |
@@ -770,8 +770,8 @@ discard block |
||
770 | 770 | continue; |
771 | 771 | } |
772 | 772 | |
773 | - if ( ! isset( $values['item_meta'][ $subsubindex ] ) ) { |
|
774 | - $values['item_meta'][ $subsubindex ] = array(); |
|
773 | + if ( ! isset( $values['item_meta'][$subsubindex] ) ) { |
|
774 | + $values['item_meta'][$subsubindex] = array(); |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | // Convert name array to string. |
@@ -781,11 +781,11 @@ discard block |
||
781 | 781 | $values['name_field_ids'][] = $subsubindex; |
782 | 782 | } |
783 | 783 | |
784 | - $values['item_meta'][ $subsubindex ][] = $subsubvalue; |
|
784 | + $values['item_meta'][$subsubindex][] = $subsubvalue; |
|
785 | 785 | } |
786 | 786 | } |
787 | 787 | |
788 | - unset( $values['item_meta'][ $field_id ] ); |
|
788 | + unset( $values['item_meta'][$field_id] ); |
|
789 | 789 | } |
790 | 790 | |
791 | 791 | return $form_ids; |
@@ -113,7 +113,8 @@ discard block |
||
113 | 113 | |
114 | 114 | if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
115 | 115 | $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
116 | - } elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
116 | + } elseif ( ! isset( $_POST['item_name'] ) ) { |
|
117 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
117 | 118 | self::maybe_add_item_name( $value, $posted_field ); |
118 | 119 | } |
119 | 120 | |
@@ -655,12 +656,14 @@ discard block |
||
655 | 656 | * @return bool |
656 | 657 | */ |
657 | 658 | private static function should_really_skip_field( $field_data, $values ) { |
658 | - if ( empty( $field_data->options ) ) { // This is skipped field types. |
|
659 | + if ( empty( $field_data->options ) ) { |
|
660 | +// This is skipped field types. |
|
659 | 661 | return true; |
660 | 662 | } |
661 | 663 | |
662 | 664 | FrmAppHelper::unserialize_or_decode( $field_data->options ); |
663 | - if ( ! $field_data->options ) { // Check if an error happens when unserializing, or empty options. |
|
665 | + if ( ! $field_data->options ) { |
|
666 | +// Check if an error happens when unserializing, or empty options. |
|
664 | 667 | return true; |
665 | 668 | } |
666 | 669 | |
@@ -743,7 +746,8 @@ discard block |
||
743 | 746 | // Blacklist check for File field in the old version doesn't contain `form_id`. |
744 | 747 | $form_ids = isset( $values['form_id'] ) ? array( absint( $values['form_id'] ) ) : array(); |
745 | 748 | foreach ( $values['item_meta'] as $field_id => $value ) { |
746 | - if ( ! is_numeric( $field_id ) ) { // Maybe `other`. |
|
749 | + if ( ! is_numeric( $field_id ) ) { |
|
750 | +// Maybe `other`. |
|
747 | 751 | continue; |
748 | 752 | } |
749 | 753 |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | * @param array $atts |
46 | 46 | */ |
47 | 47 | private function _set( $param, $atts ) { |
48 | - if ( isset( $atts[ $param ] ) ) { |
|
49 | - $this->{$param} = $atts[ $param ]; |
|
48 | + if ( isset( $atts[$param] ) ) { |
|
49 | + $this->{$param} = $atts[$param]; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | |
91 | 91 | $exclude = array( 'field_obj', 'html' ); |
92 | 92 | foreach ( $exclude as $ex ) { |
93 | - if ( isset( $atts[ $ex ] ) ) { |
|
94 | - unset( $this->pass_args[ $ex ] ); |
|
93 | + if ( isset( $atts[$ex] ) ) { |
|
94 | + unset( $this->pass_args[$ex] ); |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | } |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | * @param array $set |
104 | 104 | */ |
105 | 105 | private function set_from_field( $atts, $set ) { |
106 | - if ( isset( $atts[ $set['param'] ] ) ) { |
|
107 | - $this->{$set['param']} = $atts[ $set['param'] ]; |
|
106 | + if ( isset( $atts[$set['param']] ) ) { |
|
107 | + $this->{$set['param']} = $atts[$set['param']]; |
|
108 | 108 | } else { |
109 | 109 | $this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] ); |
110 | 110 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | private function replace_error_shortcode() { |
231 | 231 | $this->maybe_add_error_id(); |
232 | - $error = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? $this->pass_args['errors'][ 'field' . $this->field_id ] : false; |
|
232 | + $error = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? $this->pass_args['errors']['field' . $this->field_id] : false; |
|
233 | 233 | |
234 | 234 | if ( ! empty( $error ) && false === strpos( $this->html, 'role="alert"' ) && FrmAppHelper::should_include_alert_role_on_field_errors() ) { |
235 | 235 | $error_body = self::get_error_body( $this->html ); |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @since 3.06.02 |
271 | 271 | */ |
272 | 272 | private function maybe_add_error_id() { |
273 | - if ( ! isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) { |
|
273 | + if ( ! isset( $this->pass_args['errors']['field' . $this->field_id] ) ) { |
|
274 | 274 | return; |
275 | 275 | } |
276 | 276 | |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER ); |
351 | 351 | |
352 | 352 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
353 | - $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
353 | + $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
354 | 354 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
355 | 355 | |
356 | 356 | $replace_with = ''; |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | $replace_with = $this->replace_input_shortcode( $shortcode_atts ); |
362 | 362 | } |
363 | 363 | |
364 | - $this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html ); |
|
364 | + $this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html ); |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 | |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | unset( $shortcode_atts['class'] ); |
394 | 394 | } |
395 | 395 | |
396 | - $shortcode_atts['aria-invalid'] = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? 'true' : 'false'; |
|
396 | + $shortcode_atts['aria-invalid'] = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? 'true' : 'false'; |
|
397 | 397 | |
398 | 398 | $this->field_obj->set_field_column( 'shortcodes', $shortcode_atts ); |
399 | 399 | |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | */ |
449 | 449 | private function get_field_div_classes() { |
450 | 450 | // Add error class |
451 | - $classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : ''; |
|
451 | + $classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : ''; |
|
452 | 452 | |
453 | 453 | // Add label position class |
454 | 454 | $settings = $this->field_obj->display_field_settings(); |
@@ -87,7 +87,8 @@ |
||
87 | 87 | |
88 | 88 | if ( ! isset( $imported['form_status'] ) || empty( $imported['form_status'] ) ) { |
89 | 89 | // Check for an error message in the XML. |
90 | - if ( isset( $xml->Code ) && isset( $xml->Message ) ) { // phpcs:ignore WordPress.NamingConventions |
|
90 | + if ( isset( $xml->Code ) && isset( $xml->Message ) ) { |
|
91 | +// phpcs:ignore WordPress.NamingConventions |
|
91 | 92 | $imported['error'] = (string) $xml->Message; // phpcs:ignore WordPress.NamingConventions |
92 | 93 | } |
93 | 94 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | if ( $term && is_array( $term ) ) { |
140 | 140 | $imported['imported']['terms'] ++; |
141 | - $imported['terms'][ (int) $t->term_id ] = $term['term_id']; |
|
141 | + $imported['terms'][(int) $t->term_id] = $term['term_id']; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | unset( $term, $t ); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | // Keep track of whether this specific form was updated or not. |
197 | - $imported['form_status'][ $form_id ] = 'imported'; |
|
197 | + $imported['form_status'][$form_id] = 'imported'; |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | // Update field ids/keys to new ones. |
210 | 210 | do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) ); |
211 | 211 | |
212 | - $imported['forms'][ (int) $item->id ] = $form_id; |
|
212 | + $imported['forms'][(int) $item->id] = $form_id; |
|
213 | 213 | |
214 | 214 | // Send pre 2.0 form options through function that creates actions. |
215 | 215 | self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true ); |
@@ -277,15 +277,15 @@ discard block |
||
277 | 277 | } |
278 | 278 | |
279 | 279 | // Keep track of whether this specific form was updated or not |
280 | - $imported['form_status'][ $form_id ] = 'updated'; |
|
280 | + $imported['form_status'][$form_id] = 'updated'; |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | private static function get_form_fields( $form_id ) { |
284 | 284 | $form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' ); |
285 | 285 | $old_fields = array(); |
286 | 286 | foreach ( $form_fields as $f ) { |
287 | - $old_fields[ $f->id ] = $f; |
|
288 | - $old_fields[ $f->field_key ] = $f->id; |
|
287 | + $old_fields[$f->id] = $f; |
|
288 | + $old_fields[$f->field_key] = $f->id; |
|
289 | 289 | unset( $f ); |
290 | 290 | } |
291 | 291 | $form_fields = $old_fields; |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | */ |
343 | 343 | private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) { |
344 | 344 | if ( $parent_form_id ) { |
345 | - $child_forms[ $form_id ] = $parent_form_id; |
|
345 | + $child_forms[$form_id] = $parent_form_id; |
|
346 | 346 | } |
347 | 347 | } |
348 | 348 | |
@@ -357,9 +357,9 @@ discard block |
||
357 | 357 | */ |
358 | 358 | private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) { |
359 | 359 | foreach ( $child_forms as $child_form_id => $old_parent_form_id ) { |
360 | - if ( isset( $imported_forms[ $old_parent_form_id ] ) && (int) $imported_forms[ $old_parent_form_id ] !== (int) $old_parent_form_id ) { |
|
360 | + if ( isset( $imported_forms[$old_parent_form_id] ) && (int) $imported_forms[$old_parent_form_id] !== (int) $old_parent_form_id ) { |
|
361 | 361 | // Update all children with this old parent_form_id |
362 | - $new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ]; |
|
362 | + $new_parent_form_id = (int) $imported_forms[$old_parent_form_id]; |
|
363 | 363 | FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) ); |
364 | 364 | do_action( 'frm_update_child_form_parent_id', $child_form_id, $new_parent_form_id ); |
365 | 365 | } |
@@ -389,27 +389,27 @@ discard block |
||
389 | 389 | |
390 | 390 | if ( ! empty( $this_form ) ) { |
391 | 391 | // check for field to edit by field id |
392 | - if ( isset( $form_fields[ $f['id'] ] ) ) { |
|
392 | + if ( isset( $form_fields[$f['id']] ) ) { |
|
393 | 393 | FrmField::update( $f['id'], $f ); |
394 | 394 | $imported['updated']['fields'] ++; |
395 | 395 | |
396 | - unset( $form_fields[ $f['id'] ] ); |
|
396 | + unset( $form_fields[$f['id']] ); |
|
397 | 397 | |
398 | 398 | //unset old field key |
399 | - if ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
400 | - unset( $form_fields[ $f['field_key'] ] ); |
|
399 | + if ( isset( $form_fields[$f['field_key']] ) ) { |
|
400 | + unset( $form_fields[$f['field_key']] ); |
|
401 | 401 | } |
402 | - } elseif ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
403 | - $keys_by_original_field_id[ $f['id'] ] = $f['field_key']; |
|
402 | + } elseif ( isset( $form_fields[$f['field_key']] ) ) { |
|
403 | + $keys_by_original_field_id[$f['id']] = $f['field_key']; |
|
404 | 404 | |
405 | 405 | // check for field to edit by field key |
406 | 406 | unset( $f['id'] ); |
407 | 407 | |
408 | - FrmField::update( $form_fields[ $f['field_key'] ], $f ); |
|
408 | + FrmField::update( $form_fields[$f['field_key']], $f ); |
|
409 | 409 | $imported['updated']['fields'] ++; |
410 | 410 | |
411 | - unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); //unset old field id |
|
412 | - unset( $form_fields[ $f['field_key'] ] ); //unset old field key |
|
411 | + unset( $form_fields[$form_fields[$f['field_key']]] ); //unset old field id |
|
412 | + unset( $form_fields[$f['field_key']] ); //unset old field key |
|
413 | 413 | } else { |
414 | 414 | // if no matching field id or key in this form, create the field |
415 | 415 | self::create_imported_field( $f, $imported ); |
@@ -518,8 +518,8 @@ discard block |
||
518 | 518 | if ( $f['type'] == 'form' || ( $f['type'] == 'divider' && FrmField::is_option_true( $f['field_options'], 'repeat' ) ) ) { |
519 | 519 | if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) { |
520 | 520 | $form_select = (int) $f['field_options']['form_select']; |
521 | - if ( isset( $imported['forms'][ $form_select ] ) ) { |
|
522 | - $f['field_options']['form_select'] = $imported['forms'][ $form_select ]; |
|
521 | + if ( isset( $imported['forms'][$form_select] ) ) { |
|
522 | + $f['field_options']['form_select'] = $imported['forms'][$form_select]; |
|
523 | 523 | } |
524 | 524 | } |
525 | 525 | } |
@@ -540,8 +540,8 @@ discard block |
||
540 | 540 | |
541 | 541 | if ( FrmField::is_option_true_in_array( $f['field_options'], 'get_values_form' ) ) { |
542 | 542 | $old_form = $f['field_options']['get_values_form']; |
543 | - if ( isset( $imported['forms'][ $old_form ] ) ) { |
|
544 | - $f['field_options']['get_values_form'] = $imported['forms'][ $old_form ]; |
|
543 | + if ( isset( $imported['forms'][$old_form] ) ) { |
|
544 | + $f['field_options']['get_values_form'] = $imported['forms'][$old_form]; |
|
545 | 545 | } |
546 | 546 | } |
547 | 547 | } |
@@ -562,12 +562,12 @@ discard block |
||
562 | 562 | private static function migrate_placeholders( &$f ) { |
563 | 563 | $update_values = self::migrate_field_placeholder( $f, 'clear_on_focus' ); |
564 | 564 | foreach ( $update_values as $k => $v ) { |
565 | - $f[ $k ] = $v; |
|
565 | + $f[$k] = $v; |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | $update_values = self::migrate_field_placeholder( $f, 'default_blank' ); |
569 | 569 | foreach ( $update_values as $k => $v ) { |
570 | - $f[ $k ] = $v; |
|
570 | + $f[$k] = $v; |
|
571 | 571 | } |
572 | 572 | } |
573 | 573 | |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | public static function migrate_field_placeholder( $field, $type ) { |
582 | 582 | $field = (array) $field; |
583 | 583 | $field_options = $field['field_options']; |
584 | - if ( empty( $field_options[ $type ] ) || empty( $field['default_value'] ) ) { |
|
584 | + if ( empty( $field_options[$type] ) || empty( $field['default_value'] ) ) { |
|
585 | 585 | return array(); |
586 | 586 | } |
587 | 587 | |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | } |
608 | 608 | |
609 | 609 | if ( $opt == $default_value ) { |
610 | - unset( $options[ $opt_key ] ); |
|
610 | + unset( $options[$opt_key] ); |
|
611 | 611 | break; |
612 | 612 | } |
613 | 613 | } |
@@ -809,27 +809,27 @@ discard block |
||
809 | 809 | } |
810 | 810 | |
811 | 811 | if ( false !== strpos( $post['post_content'], '[frm-display-data' ) || false !== strpos( $post['post_content'], '[formidable' ) ) { |
812 | - $posts_with_shortcodes[ $post_id ] = $post; |
|
812 | + $posts_with_shortcodes[$post_id] = $post; |
|
813 | 813 | } |
814 | 814 | |
815 | 815 | self::update_postmeta( $post, $post_id ); |
816 | 816 | self::update_layout( $post, $post_id ); |
817 | 817 | |
818 | 818 | $this_type = 'posts'; |
819 | - if ( isset( $post_types[ $post['post_type'] ] ) ) { |
|
820 | - $this_type = $post_types[ $post['post_type'] ]; |
|
819 | + if ( isset( $post_types[$post['post_type']] ) ) { |
|
820 | + $this_type = $post_types[$post['post_type']]; |
|
821 | 821 | } |
822 | 822 | |
823 | 823 | if ( isset( $post['ID'] ) && $post_id == $post['ID'] ) { |
824 | - $imported['updated'][ $this_type ] ++; |
|
824 | + $imported['updated'][$this_type] ++; |
|
825 | 825 | } else { |
826 | - $imported['imported'][ $this_type ] ++; |
|
826 | + $imported['imported'][$this_type] ++; |
|
827 | 827 | } |
828 | 828 | |
829 | - $imported['posts'][ (int) $old_id ] = $post_id; |
|
829 | + $imported['posts'][(int) $old_id] = $post_id; |
|
830 | 830 | |
831 | 831 | if ( $post['post_type'] === 'frm_display' ) { |
832 | - $view_ids[ (int) $old_id ] = $post_id; |
|
832 | + $view_ids[(int) $old_id] = $post_id; |
|
833 | 833 | } |
834 | 834 | |
835 | 835 | do_action( 'frm_after_import_view', $post_id, $post ); |
@@ -954,9 +954,9 @@ discard block |
||
954 | 954 | $post['attachment_url'] = (string) $item->attachment_url; |
955 | 955 | } |
956 | 956 | |
957 | - if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) { |
|
957 | + if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][(int) $post['menu_order']] ) ) { |
|
958 | 958 | // update to new form id |
959 | - $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ]; |
|
959 | + $post['menu_order'] = $imported['forms'][(int) $post['menu_order']]; |
|
960 | 960 | } |
961 | 961 | |
962 | 962 | // Don't allow default styles to take over a site's default style |
@@ -993,8 +993,8 @@ discard block |
||
993 | 993 | ); |
994 | 994 | |
995 | 995 | //switch old form and field ids to new ones |
996 | - if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][ (int) $m['value'] ] ) ) { |
|
997 | - $m['value'] = $imported['forms'][ (int) $m['value'] ]; |
|
996 | + if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][(int) $m['value']] ) ) { |
|
997 | + $m['value'] = $imported['forms'][(int) $m['value']]; |
|
998 | 998 | } else { |
999 | 999 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
1000 | 1000 | |
@@ -1005,15 +1005,15 @@ discard block |
||
1005 | 1005 | } elseif ( 'frm_options' === $m['key'] ) { |
1006 | 1006 | |
1007 | 1007 | foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) { |
1008 | - if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) { |
|
1009 | - $m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ]; |
|
1008 | + if ( isset( $m['value'][$setting_name] ) && is_numeric( $m['value'][$setting_name] ) && isset( $frm_duplicate_ids[$m['value'][$setting_name]] ) ) { |
|
1009 | + $m['value'][$setting_name] = $frm_duplicate_ids[$m['value'][$setting_name]]; |
|
1010 | 1010 | } |
1011 | 1011 | } |
1012 | 1012 | |
1013 | 1013 | $check_dup_array = array(); |
1014 | 1014 | if ( isset( $m['value']['order_by'] ) && ! empty( $m['value']['order_by'] ) ) { |
1015 | - if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) { |
|
1016 | - $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ]; |
|
1015 | + if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[$m['value']['order_by']] ) ) { |
|
1016 | + $m['value']['order_by'] = $frm_duplicate_ids[$m['value']['order_by']]; |
|
1017 | 1017 | } elseif ( is_array( $m['value']['order_by'] ) ) { |
1018 | 1018 | $check_dup_array[] = 'order_by'; |
1019 | 1019 | } |
@@ -1024,9 +1024,9 @@ discard block |
||
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | foreach ( $check_dup_array as $check_k ) { |
1027 | - foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) { |
|
1028 | - if ( isset( $frm_duplicate_ids[ $mv ] ) ) { |
|
1029 | - $m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ]; |
|
1027 | + foreach ( (array) $m['value'][$check_k] as $mk => $mv ) { |
|
1028 | + if ( isset( $frm_duplicate_ids[$mv] ) ) { |
|
1029 | + $m['value'][$check_k][$mk] = $frm_duplicate_ids[$mv]; |
|
1030 | 1030 | } |
1031 | 1031 | unset( $mk, $mv ); |
1032 | 1032 | } |
@@ -1039,11 +1039,11 @@ discard block |
||
1039 | 1039 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
1040 | 1040 | } |
1041 | 1041 | |
1042 | - $post['postmeta'][ (string) $meta->meta_key ] = $m['value']; |
|
1042 | + $post['postmeta'][(string) $meta->meta_key] = $m['value']; |
|
1043 | 1043 | } |
1044 | 1044 | |
1045 | 1045 | private static function populate_layout( &$post, $layout ) { |
1046 | - $post['layout'][ (string) $layout->type ] = (string) $layout->data; |
|
1046 | + $post['layout'][(string) $layout->type] = (string) $layout->data; |
|
1047 | 1047 | } |
1048 | 1048 | |
1049 | 1049 | /** |
@@ -1071,11 +1071,11 @@ discard block |
||
1071 | 1071 | $name = (string) $c; |
1072 | 1072 | } |
1073 | 1073 | |
1074 | - if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) { |
|
1075 | - $post['tax_input'][ $taxonomy ] = array(); |
|
1074 | + if ( ! isset( $post['tax_input'][$taxonomy] ) ) { |
|
1075 | + $post['tax_input'][$taxonomy] = array(); |
|
1076 | 1076 | } |
1077 | 1077 | |
1078 | - $post['tax_input'][ $taxonomy ][] = $name; |
|
1078 | + $post['tax_input'][$taxonomy][] = $name; |
|
1079 | 1079 | unset( $name ); |
1080 | 1080 | } |
1081 | 1081 | } |
@@ -1192,7 +1192,7 @@ discard block |
||
1192 | 1192 | |
1193 | 1193 | $message = '<ul>'; |
1194 | 1194 | foreach ( $result as $type => $results ) { |
1195 | - if ( ! isset( $t_strings[ $type ] ) ) { |
|
1195 | + if ( ! isset( $t_strings[$type] ) ) { |
|
1196 | 1196 | // only print imported and updated |
1197 | 1197 | continue; |
1198 | 1198 | } |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | } |
1205 | 1205 | |
1206 | 1206 | if ( ! empty( $s_message ) ) { |
1207 | - $message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> '; |
|
1207 | + $message .= '<li><strong>' . $t_strings[$type] . ':</strong> '; |
|
1208 | 1208 | $message .= implode( ', ', $s_message ); |
1209 | 1209 | $message .= '</li>'; |
1210 | 1210 | } |
@@ -1256,8 +1256,8 @@ discard block |
||
1256 | 1256 | 'actions' => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ), |
1257 | 1257 | ); |
1258 | 1258 | |
1259 | - if ( isset( $strings[ $type ] ) ) { |
|
1260 | - $s_message[] = $strings[ $type ]; |
|
1259 | + if ( isset( $strings[$type] ) ) { |
|
1260 | + $s_message[] = $strings[$type]; |
|
1261 | 1261 | } else { |
1262 | 1262 | $string = ' ' . $m . ' ' . ucfirst( $type ); |
1263 | 1263 | |
@@ -1400,8 +1400,8 @@ discard block |
||
1400 | 1400 | */ |
1401 | 1401 | private static function remove_defaults( $defaults, &$saved ) { |
1402 | 1402 | foreach ( $saved as $key => $value ) { |
1403 | - if ( isset( $defaults[ $key ] ) && $defaults[ $key ] === $value ) { |
|
1404 | - unset( $saved[ $key ] ); |
|
1403 | + if ( isset( $defaults[$key] ) && $defaults[$key] === $value ) { |
|
1404 | + unset( $saved[$key] ); |
|
1405 | 1405 | } |
1406 | 1406 | } |
1407 | 1407 | } |
@@ -1412,14 +1412,14 @@ discard block |
||
1412 | 1412 | * @since 3.06 |
1413 | 1413 | */ |
1414 | 1414 | private static function remove_default_html( $html_name, $defaults, &$options ) { |
1415 | - if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) { |
|
1415 | + if ( ! isset( $options[$html_name] ) || ! isset( $defaults[$html_name] ) ) { |
|
1416 | 1416 | return; |
1417 | 1417 | } |
1418 | 1418 | |
1419 | - $old_html = str_replace( "\r\n", "\n", $options[ $html_name ] ); |
|
1420 | - $default_html = $defaults[ $html_name ]; |
|
1419 | + $old_html = str_replace( "\r\n", "\n", $options[$html_name] ); |
|
1420 | + $default_html = $defaults[$html_name]; |
|
1421 | 1421 | if ( $old_html == $default_html ) { |
1422 | - unset( $options[ $html_name ] ); |
|
1422 | + unset( $options[$html_name] ); |
|
1423 | 1423 | |
1424 | 1424 | return; |
1425 | 1425 | } |
@@ -1427,7 +1427,7 @@ discard block |
||
1427 | 1427 | // Account for some of the older field default HTML. |
1428 | 1428 | $default_html = str_replace( ' id="frm_desc_field_[key]"', '', $default_html ); |
1429 | 1429 | if ( $old_html == $default_html ) { |
1430 | - unset( $options[ $html_name ] ); |
|
1430 | + unset( $options[$html_name] ); |
|
1431 | 1431 | } |
1432 | 1432 | } |
1433 | 1433 | |
@@ -1514,8 +1514,8 @@ discard block |
||
1514 | 1514 | ); |
1515 | 1515 | |
1516 | 1516 | foreach ( $post_settings as $post_setting ) { |
1517 | - if ( isset( $form_options[ $post_setting ] ) ) { |
|
1518 | - $new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ]; |
|
1517 | + if ( isset( $form_options[$post_setting] ) ) { |
|
1518 | + $new_action['post_content'][$post_setting] = $form_options[$post_setting]; |
|
1519 | 1519 | } |
1520 | 1520 | unset( $post_setting ); |
1521 | 1521 | } |
@@ -1586,11 +1586,11 @@ discard block |
||
1586 | 1586 | foreach ( $post_content as $key => $setting ) { |
1587 | 1587 | if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) { |
1588 | 1588 | // Replace old IDs with new IDs |
1589 | - $post_content[ $key ] = str_replace( $old, $new, $setting ); |
|
1589 | + $post_content[$key] = str_replace( $old, $new, $setting ); |
|
1590 | 1590 | } elseif ( is_array( $setting ) && in_array( $key, $array_fields ) ) { |
1591 | 1591 | foreach ( $setting as $k => $val ) { |
1592 | 1592 | // Replace old IDs with new IDs |
1593 | - $post_content[ $key ][ $k ] = str_replace( $old, $new, $val ); |
|
1593 | + $post_content[$key][$k] = str_replace( $old, $new, $val ); |
|
1594 | 1594 | } |
1595 | 1595 | } |
1596 | 1596 | unset( $key, $setting ); |
@@ -1666,8 +1666,8 @@ discard block |
||
1666 | 1666 | private static function remove_deprecated_notification_settings( $form_id, $form_options ) { |
1667 | 1667 | $delete_settings = array( 'notification', 'autoresponder', 'email_to' ); |
1668 | 1668 | foreach ( $delete_settings as $index ) { |
1669 | - if ( isset( $form_options[ $index ] ) ) { |
|
1670 | - unset( $form_options[ $index ] ); |
|
1669 | + if ( isset( $form_options[$index] ) ) { |
|
1670 | + unset( $form_options[$index] ); |
|
1671 | 1671 | } |
1672 | 1672 | } |
1673 | 1673 | FrmForm::update( $form_id, array( 'options' => $form_options ) ); |
@@ -1720,12 +1720,12 @@ discard block |
||
1720 | 1720 | 'reply_to_name' => '', |
1721 | 1721 | ); |
1722 | 1722 | foreach ( $reply_fields as $f => $val ) { |
1723 | - if ( isset( $notification[ $f ] ) ) { |
|
1724 | - $atts[ $f ] = $notification[ $f ]; |
|
1725 | - if ( 'custom' == $notification[ $f ] ) { |
|
1726 | - $atts[ $f ] = $notification[ 'cust_' . $f ]; |
|
1727 | - } elseif ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) { |
|
1728 | - $atts[ $f ] = '[' . $atts[ $f ] . ']'; |
|
1723 | + if ( isset( $notification[$f] ) ) { |
|
1724 | + $atts[$f] = $notification[$f]; |
|
1725 | + if ( 'custom' == $notification[$f] ) { |
|
1726 | + $atts[$f] = $notification['cust_' . $f]; |
|
1727 | + } elseif ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) { |
|
1728 | + $atts[$f] = '[' . $atts[$f] . ']'; |
|
1729 | 1729 | } |
1730 | 1730 | } |
1731 | 1731 | unset( $f, $val ); |
@@ -1756,13 +1756,13 @@ discard block |
||
1756 | 1756 | foreach ( $atts['email_to'] as $key => $email_field ) { |
1757 | 1757 | |
1758 | 1758 | if ( is_numeric( $email_field ) ) { |
1759 | - $atts['email_to'][ $key ] = '[' . $email_field . ']'; |
|
1759 | + $atts['email_to'][$key] = '[' . $email_field . ']'; |
|
1760 | 1760 | } |
1761 | 1761 | |
1762 | 1762 | if ( strpos( $email_field, '|' ) ) { |
1763 | 1763 | $email_opt = explode( '|', $email_field ); |
1764 | 1764 | if ( isset( $email_opt[0] ) ) { |
1765 | - $atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
1765 | + $atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
1766 | 1766 | } |
1767 | 1767 | unset( $email_opt ); |
1768 | 1768 | } |
@@ -1783,12 +1783,12 @@ discard block |
||
1783 | 1783 | // Add more fields to the new notification |
1784 | 1784 | $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' ); |
1785 | 1785 | foreach ( $add_fields as $add_field ) { |
1786 | - if ( isset( $notification[ $add_field ] ) ) { |
|
1787 | - $new_notification['post_content'][ $add_field ] = $notification[ $add_field ]; |
|
1786 | + if ( isset( $notification[$add_field] ) ) { |
|
1787 | + $new_notification['post_content'][$add_field] = $notification[$add_field]; |
|
1788 | 1788 | } elseif ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) { |
1789 | - $new_notification['post_content'][ $add_field ] = 0; |
|
1789 | + $new_notification['post_content'][$add_field] = 0; |
|
1790 | 1790 | } else { |
1791 | - $new_notification['post_content'][ $add_field ] = ''; |
|
1791 | + $new_notification['post_content'][$add_field] = ''; |
|
1792 | 1792 | } |
1793 | 1793 | unset( $add_field ); |
1794 | 1794 | } |
@@ -1812,7 +1812,7 @@ discard block |
||
1812 | 1812 | if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) { |
1813 | 1813 | foreach ( $post_content['conditions'] as $email_key => $val ) { |
1814 | 1814 | if ( is_numeric( $email_key ) ) { |
1815 | - $post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
1815 | + $post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
1816 | 1816 | } |
1817 | 1817 | unset( $email_key, $val ); |
1818 | 1818 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | //validate the number format |
55 | 55 | if ( ! is_numeric( $args['value'] ) && '' !== $args['value'] ) { |
56 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
56 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // validate number settings |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | if ( $frm_settings->use_html && $maxnum !== '' && $minnum !== '' ) { |
66 | 66 | $value = (float) $args['value']; |
67 | 67 | if ( $value < $minnum ) { |
68 | - $errors[ 'field' . $args['id'] ] = __( 'Please select a higher number', 'formidable' ); |
|
68 | + $errors['field' . $args['id']] = __( 'Please select a higher number', 'formidable' ); |
|
69 | 69 | } elseif ( $value > $maxnum ) { |
70 | - $errors[ 'field' . $args['id'] ] = __( 'Please select a lower number', 'formidable' ); |
|
70 | + $errors['field' . $args['id']] = __( 'Please select a lower number', 'formidable' ); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param array $args Validation args. |
87 | 87 | */ |
88 | 88 | private function validate_step( &$errors, $args ) { |
89 | - if ( isset( $errors[ 'field' . $args['id'] ] ) ) { |
|
89 | + if ( isset( $errors['field' . $args['id']] ) ) { |
|
90 | 90 | return; // Don't need to check if value is invalid before. |
91 | 91 | } |
92 | 92 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | return; |
101 | 101 | } |
102 | 102 | |
103 | - $errors[ 'field' . $args['id'] ] = sprintf( |
|
103 | + $errors['field' . $args['id']] = sprintf( |
|
104 | 104 | // Translators: %1$s: the first nearest value; %2$s: the second nearest value. |
105 | 105 | __( 'Please enter a valid value. Two nearest valid values are %1$s and %2$s', 'formidable' ), |
106 | 106 | floatval( $result[0] ), |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | |
19 | 19 | foreach ( $type as $tb_type ) { |
20 | 20 | |
21 | - if ( ! isset( $tables[ $tb_type ] ) ) { |
|
21 | + if ( ! isset( $tables[$tb_type] ) ) { |
|
22 | 22 | do_action( 'frm_xml_import_' . $tb_type, $args ); |
23 | 23 | continue; |
24 | 24 | } |
25 | 25 | |
26 | - if ( ! isset( $records[ $tb_type ] ) ) { |
|
26 | + if ( ! isset( $records[$tb_type] ) ) { |
|
27 | 27 | // No records. |
28 | 28 | continue; |
29 | 29 | } |
30 | 30 | |
31 | - $item_ids = $records[ $tb_type ]; |
|
31 | + $item_ids = $records[$tb_type]; |
|
32 | 32 | |
33 | 33 | if ( in_array( $tb_type, array( 'styles', 'actions' ), true ) ) { |
34 | 34 | include dirname( __FILE__ ) . '/posts_xml.php'; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | include FrmProAppHelper::plugin_path() . '/classes/views/xml/' . $tb_type . '_xml.php'; |
39 | 39 | } |
40 | 40 | |
41 | - unset( $item_ids, $records[ $tb_type ], $tb_type ); |
|
41 | + unset( $item_ids, $records[$tb_type], $tb_type ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @param array $keys |
40 | 40 | */ |
41 | - self::$keys = apply_filters( |
|
41 | + self::$keys = apply_filters( |
|
42 | 42 | 'frm_application_data_keys', |
43 | 43 | array( 'key', 'name', 'description', 'link', 'categories', 'views', 'forms' ) |
44 | 44 | ); |
@@ -100,17 +100,17 @@ discard block |
||
100 | 100 | public function as_js_object() { |
101 | 101 | $application = array(); |
102 | 102 | foreach ( self::$keys as $key ) { |
103 | - if ( ! isset( $this->api_data[ $key ] ) ) { |
|
103 | + if ( ! isset( $this->api_data[$key] ) ) { |
|
104 | 104 | continue; |
105 | 105 | } |
106 | 106 | |
107 | - $value = $this->api_data[ $key ]; |
|
107 | + $value = $this->api_data[$key]; |
|
108 | 108 | |
109 | 109 | if ( 'icon' === $key ) { |
110 | 110 | // Icon is an array. The first array item is the image URL. |
111 | - $application[ $key ] = reset( $value ); |
|
111 | + $application[$key] = reset( $value ); |
|
112 | 112 | } elseif ( 'categories' === $key ) { |
113 | - $application[ $key ] = array_values( |
|
113 | + $application[$key] = array_values( |
|
114 | 114 | array_filter( |
115 | 115 | $value, |
116 | 116 | function( $category ) { |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | // Strip off the " Template" text at the end of the name as it takes up space. |
130 | 130 | $value = substr( $value, 0, -9 ); |
131 | 131 | } |
132 | - $application[ $key ] = $value; |
|
132 | + $application[$key] = $value; |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 |