@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @return void |
87 | 87 | */ |
88 | 88 | private function init_style_settings( $atts ) { |
89 | - $style_settings = array( |
|
89 | + $style_settings = array( |
|
90 | 90 | 'border_color' => 'dddddd', |
91 | 91 | 'bg_color' => 'f7f7f7', |
92 | 92 | 'text_color' => '444444', |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | $this->style_settings = apply_filters( 'frm_show_entry_styles', $style_settings ); |
98 | 98 | |
99 | 99 | foreach ( $this->style_settings as $key => $setting ) { |
100 | - if ( isset( $atts[ $key ] ) && $atts[ $key ] !== '' ) { |
|
101 | - $this->style_settings[ $key ] = $atts[ $key ]; |
|
100 | + if ( isset( $atts[$key] ) && $atts[$key] !== '' ) { |
|
101 | + $this->style_settings[$key] = $atts[$key]; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | if ( $this->is_color_setting( $key ) ) { |
105 | - $this->style_settings[ $key ] = $this->get_color_markup( $this->style_settings[ $key ] ); |
|
105 | + $this->style_settings[$key] = $this->get_color_markup( $this->style_settings[$key] ); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @return void |
60 | 60 | */ |
61 | 61 | public function set( $key, $value ) { |
62 | - $this->state[ $key ] = $value; |
|
62 | + $this->state[$key] = $value; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | public function get( $key, $default ) { |
78 | - if ( isset( $this->state[ $key ] ) ) { |
|
79 | - return $this->state[ $key ]; |
|
78 | + if ( isset( $this->state[$key] ) ) { |
|
79 | + return $this->state[$key]; |
|
80 | 80 | } |
81 | 81 | return $default; |
82 | 82 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | private function compressed_state() { |
172 | 172 | $compressed = array(); |
173 | 173 | foreach ( $this->state as $key => $value ) { |
174 | - $compressed[ self::compressed_key( $key ) ] = $value; |
|
174 | + $compressed[self::compressed_key( $key )] = $value; |
|
175 | 175 | } |
176 | 176 | return $compressed; |
177 | 177 | } |
@@ -85,7 +85,7 @@ |
||
85 | 85 | foreach ( $errors as $field => $error ) { |
86 | 86 | $field_id = str_replace( 'field', '', $field ); |
87 | 87 | $error = self::maybe_modify_ajax_error( $error, $field_id, $form, $errors ); |
88 | - $obj[ $field_id ] = $error; |
|
88 | + $obj[$field_id] = $error; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $response['errors'] = $obj; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $metas = FrmEntryMeta::get_entry_meta_info( $entry_exist ); |
81 | 81 | $field_metas = array(); |
82 | 82 | foreach ( $metas as $meta ) { |
83 | - $field_metas[ $meta->field_id ] = $meta->meta_value; |
|
83 | + $field_metas[$meta->field_id] = $meta->meta_value; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | $filtered_vals = array_filter( $values['item_meta'] ); |
@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | $reduced = array(); |
137 | 137 | foreach ( $filter_vals as $field_id => $value ) { |
138 | 138 | $field = FrmFieldFactory::get_field_object( $field_id ); |
139 | - $reduced[ $field_id ] = $field->get_value_to_save( $value, array( 'entry_id' => $entry_id ) ); |
|
140 | - $reduced[ $field_id ] = $field->set_value_before_save( $reduced[ $field_id ] ); |
|
141 | - if ( '' === $reduced[ $field_id ] || ( is_array( $reduced[ $field_id ] ) && 0 === count( $reduced[ $field_id ] ) ) ) { |
|
142 | - unset( $reduced[ $field_id ] ); |
|
139 | + $reduced[$field_id] = $field->get_value_to_save( $value, array( 'entry_id' => $entry_id ) ); |
|
140 | + $reduced[$field_id] = $field->set_value_before_save( $reduced[$field_id] ); |
|
141 | + if ( '' === $reduced[$field_id] || ( is_array( $reduced[$field_id] ) && 0 === count( $reduced[$field_id] ) ) ) { |
|
142 | + unset( $reduced[$field_id] ); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | return $reduced; |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $query = "SELECT it.*, fr.name as form_name, fr.form_key as form_key FROM {$wpdb->prefix}frm_items it |
355 | 355 | LEFT OUTER JOIN {$wpdb->prefix}frm_forms fr ON it.form_id=fr.id WHERE "; |
356 | 356 | |
357 | - $query .= is_numeric( $id ) ? 'it.id=%d' : 'it.item_key=%s'; |
|
357 | + $query .= is_numeric( $id ) ? 'it.id=%d' : 'it.item_key=%s'; |
|
358 | 358 | $query_args = array( $id ); |
359 | 359 | $query = $wpdb->prepare( $query, $query_args ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared |
360 | 360 | |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | private static function prepare_entries( &$entries ) { |
400 | 400 | foreach ( $entries as $k => $entry ) { |
401 | 401 | self::prepare_entry( $entry ); |
402 | - $entries[ $k ] = $entry; |
|
402 | + $entries[$k] = $entry; |
|
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
@@ -425,19 +425,19 @@ discard block |
||
425 | 425 | FrmFieldsHelper::prepare_field_value( $meta_val->meta_value, $meta_val->type ); |
426 | 426 | |
427 | 427 | if ( $meta_val->item_id == $entry->id ) { |
428 | - $entry->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
428 | + $entry->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
429 | 429 | if ( $include_key ) { |
430 | - $entry->metas[ $meta_val->field_key ] = $entry->metas[ $meta_val->field_id ]; |
|
430 | + $entry->metas[$meta_val->field_key] = $entry->metas[$meta_val->field_id]; |
|
431 | 431 | } |
432 | 432 | continue; |
433 | 433 | } |
434 | 434 | |
435 | 435 | // include sub entries in an array |
436 | - if ( ! isset( $entry->metas[ $meta_val->field_id ] ) ) { |
|
437 | - $entry->metas[ $meta_val->field_id ] = array(); |
|
436 | + if ( ! isset( $entry->metas[$meta_val->field_id] ) ) { |
|
437 | + $entry->metas[$meta_val->field_id] = array(); |
|
438 | 438 | } |
439 | 439 | |
440 | - $entry->metas[ $meta_val->field_id ][] = $meta_val->meta_value; |
|
440 | + $entry->metas[$meta_val->field_id][] = $meta_val->meta_value; |
|
441 | 441 | |
442 | 442 | unset( $meta_val ); |
443 | 443 | } |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | |
485 | 485 | if ( $inc_form ) { |
486 | 486 | $fields = 'it.*, fr.name as form_name,fr.form_key as form_key'; |
487 | - $table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id '; |
|
487 | + $table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id '; |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | if ( preg_match( '/ meta_([0-9]+)/', $order_by, $order_matches ) ) { |
@@ -532,16 +532,16 @@ discard block |
||
532 | 532 | } |
533 | 533 | |
534 | 534 | foreach ( $metas as $m_key => $meta_val ) { |
535 | - if ( ! isset( $entries[ $meta_val->item_id ] ) ) { |
|
535 | + if ( ! isset( $entries[$meta_val->item_id] ) ) { |
|
536 | 536 | continue; |
537 | 537 | } |
538 | 538 | |
539 | - if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) { |
|
540 | - $entries[ $meta_val->item_id ]->metas = array(); |
|
539 | + if ( ! isset( $entries[$meta_val->item_id]->metas ) ) { |
|
540 | + $entries[$meta_val->item_id]->metas = array(); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | FrmFieldsHelper::prepare_field_value( $meta_val->meta_value, $meta_val->type ); |
544 | - $entries[ $meta_val->item_id ]->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
544 | + $entries[$meta_val->item_id]->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
545 | 545 | unset( $m_key, $meta_val ); |
546 | 546 | } |
547 | 547 | |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | } |
720 | 720 | |
721 | 721 | private static function get_entry_value( $values, $name, $default ) { |
722 | - return isset( $values[ $name ] ) ? $values[ $name ] : $default; |
|
722 | + return isset( $values[$name] ) ? $values[$name] : $default; |
|
723 | 723 | } |
724 | 724 | |
725 | 725 | /** |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | private static function maybe_add_captcha_meta( $form_id, $entry_id ) { |
901 | 901 | global $frm_vars; |
902 | 902 | if ( array_key_exists( 'captcha_scores', $frm_vars ) && array_key_exists( $form_id, $frm_vars['captcha_scores'] ) ) { |
903 | - $captcha_score_meta = array( 'captcha_score' => $frm_vars['captcha_scores'][ $form_id ] ); |
|
903 | + $captcha_score_meta = array( 'captcha_score' => $frm_vars['captcha_scores'][$form_id] ); |
|
904 | 904 | FrmEntryMeta::add_entry_meta( $entry_id, 0, '', maybe_serialize( $captcha_score_meta ) ); |
905 | 905 | } |
906 | 906 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | while ( $count > 0 && ! is_null( $one = $this->read_one() ) ) { |
80 | 80 | $value .= $one; |
81 | - --$count; |
|
81 | + -- $count; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | return $this->strip_quotes( $value ); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | private function read_one() { |
94 | 94 | if ( $this->pos <= $this->max ) { |
95 | - $value = $this->string[ $this->pos ]; |
|
95 | + $value = $this->string[$this->pos]; |
|
96 | 96 | $this->pos += 1; |
97 | 97 | } else { |
98 | 98 | $value = null; |
@@ -65,12 +65,12 @@ |
||
65 | 65 | $string->read( 1 ); |
66 | 66 | |
67 | 67 | $val = array(); |
68 | - for ( $i = 0; $i < $count; $i++ ) { |
|
68 | + for ( $i = 0; $i < $count; $i ++ ) { |
|
69 | 69 | $array_key = $this->do_parse( $string ); |
70 | 70 | $array_value = $this->do_parse( $string ); |
71 | 71 | |
72 | 72 | if ( ! is_array( $array_key ) ) { |
73 | - $val[ $array_key ] = $array_value; |
|
73 | + $val[$array_key] = $array_value; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 |
@@ -240,26 +240,26 @@ discard block |
||
240 | 240 | public static function populate_on_submit_data( &$form_options, $action = null, $event = 'create' ) { |
241 | 241 | $opt = 'update' === $event ? 'edit_' : 'success_'; |
242 | 242 | if ( ! $action || ! is_object( $action ) ) { |
243 | - $form_options[ $opt . 'action' ] = self::get_default_action_type(); |
|
244 | - $form_options[ $opt . 'msg' ] = self::get_default_msg(); |
|
243 | + $form_options[$opt . 'action'] = self::get_default_action_type(); |
|
244 | + $form_options[$opt . 'msg'] = self::get_default_msg(); |
|
245 | 245 | |
246 | 246 | return; |
247 | 247 | } |
248 | 248 | |
249 | - $form_options[ $opt . 'action' ] = isset( $action->post_content['success_action'] ) ? $action->post_content['success_action'] : 'message'; |
|
249 | + $form_options[$opt . 'action'] = isset( $action->post_content['success_action'] ) ? $action->post_content['success_action'] : 'message'; |
|
250 | 250 | |
251 | - switch ( $form_options[ $opt . 'action' ] ) { |
|
251 | + switch ( $form_options[$opt . 'action'] ) { |
|
252 | 252 | case 'redirect': |
253 | - $form_options[ $opt . 'url' ] = isset( $action->post_content['success_url'] ) ? $action->post_content['success_url'] : ''; |
|
253 | + $form_options[$opt . 'url'] = isset( $action->post_content['success_url'] ) ? $action->post_content['success_url'] : ''; |
|
254 | 254 | $form_options['open_in_new_tab'] = ! empty( $action->post_content['open_in_new_tab'] ); |
255 | 255 | break; |
256 | 256 | |
257 | 257 | case 'page': |
258 | - $form_options[ $opt . 'page_id' ] = isset( $action->post_content['success_page_id'] ) ? $action->post_content['success_page_id'] : ''; |
|
258 | + $form_options[$opt . 'page_id'] = isset( $action->post_content['success_page_id'] ) ? $action->post_content['success_page_id'] : ''; |
|
259 | 259 | break; |
260 | 260 | |
261 | 261 | default: |
262 | - $form_options[ $opt . 'msg' ] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : self::get_default_msg(); |
|
262 | + $form_options[$opt . 'msg'] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : self::get_default_msg(); |
|
263 | 263 | $form_options['show_form'] = ! empty( $action->post_content['show_form'] ); |
264 | 264 | } |
265 | 265 | } |
@@ -348,20 +348,20 @@ discard block |
||
348 | 348 | private static function get_on_submit_action_data_from_form_options( $form_options, $event = 'create' ) { |
349 | 349 | $opt = 'update' === $event ? 'edit_' : 'success_'; |
350 | 350 | $data = array( |
351 | - 'success_action' => isset( $form_options[ $opt . 'action' ] ) ? $form_options[ $opt . 'action' ] : self::get_default_action_type(), |
|
351 | + 'success_action' => isset( $form_options[$opt . 'action'] ) ? $form_options[$opt . 'action'] : self::get_default_action_type(), |
|
352 | 352 | ); |
353 | 353 | |
354 | 354 | switch ( $data['success_action'] ) { |
355 | 355 | case 'redirect': |
356 | - $data['success_url'] = isset( $form_options[ $opt . 'url' ] ) ? $form_options[ $opt . 'url' ] : ''; |
|
356 | + $data['success_url'] = isset( $form_options[$opt . 'url'] ) ? $form_options[$opt . 'url'] : ''; |
|
357 | 357 | break; |
358 | 358 | |
359 | 359 | case 'page': |
360 | - $data['success_page_id'] = isset( $form_options[ $opt . 'page_id' ] ) ? $form_options[ $opt . 'page_id' ] : ''; |
|
360 | + $data['success_page_id'] = isset( $form_options[$opt . 'page_id'] ) ? $form_options[$opt . 'page_id'] : ''; |
|
361 | 361 | break; |
362 | 362 | |
363 | 363 | default: |
364 | - $data['success_msg'] = isset( $form_options[ $opt . 'msg' ] ) ? $form_options[ $opt . 'msg' ] : self::get_default_msg(); |
|
364 | + $data['success_msg'] = isset( $form_options[$opt . 'msg'] ) ? $form_options[$opt . 'msg'] : self::get_default_msg(); |
|
365 | 365 | $data['show_form'] = ! empty( $form_options['show_form'] ); |
366 | 366 | } |
367 | 367 |
@@ -1708,7 +1708,8 @@ discard block |
||
1708 | 1708 | $vars = array(); |
1709 | 1709 | FrmAppHelper::include_svg(); |
1710 | 1710 | |
1711 | - if ( isset( $_POST['frm_compact_fields'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1711 | + if ( isset( $_POST['frm_compact_fields'] ) ) { |
|
1712 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1712 | 1713 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
1713 | 1714 | |
1714 | 1715 | // Javascript needs to be allowed in some field settings. |
@@ -2018,7 +2019,8 @@ discard block |
||
2018 | 2019 | private static function maybe_get_form_to_show( $id ) { |
2019 | 2020 | $form = false; |
2020 | 2021 | |
2021 | - if ( ! empty( $id ) ) { // form id or key is set |
|
2022 | + if ( ! empty( $id ) ) { |
|
2023 | +// form id or key is set |
|
2022 | 2024 | $form = FrmForm::getOne( $id ); |
2023 | 2025 | if ( ! $form || $form->parent_form_id || $form->status === 'trash' ) { |
2024 | 2026 | $form = false; |
@@ -2103,7 +2105,8 @@ discard block |
||
2103 | 2105 | private static function get_saved_errors( $form, $params ) { |
2104 | 2106 | global $frm_vars; |
2105 | 2107 | |
2106 | - if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
2108 | + if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { |
|
2109 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
2107 | 2110 | $errors = $frm_vars['created_entries'][ $form->id ]['errors']; |
2108 | 2111 | } else { |
2109 | 2112 | $errors = array(); |
@@ -2294,7 +2297,8 @@ discard block |
||
2294 | 2297 | $action_type = FrmOnSubmitHelper::get_action_type( $action ); |
2295 | 2298 | |
2296 | 2299 | if ( 'redirect' === $action_type ) { |
2297 | - if ( $has_redirect ) { // Do not process because we run the first redirect action only. |
|
2300 | + if ( $has_redirect ) { |
|
2301 | +// Do not process because we run the first redirect action only. |
|
2298 | 2302 | continue; |
2299 | 2303 | } |
2300 | 2304 | } |
@@ -2523,12 +2527,14 @@ discard block |
||
2523 | 2527 | |
2524 | 2528 | $doing_ajax = FrmAppHelper::doing_ajax(); |
2525 | 2529 | |
2526 | - if ( ! empty( $args['ajax'] ) && $doing_ajax && empty( $args['force_delay_redirect'] ) ) { // Is AJAX submit and there is just one Redirect action runs. |
|
2530 | + if ( ! empty( $args['ajax'] ) && $doing_ajax && empty( $args['force_delay_redirect'] ) ) { |
|
2531 | +// Is AJAX submit and there is just one Redirect action runs. |
|
2527 | 2532 | echo json_encode( self::get_ajax_redirect_response_data( $args + compact( 'success_url' ) ) ); |
2528 | 2533 | wp_die(); |
2529 | 2534 | } |
2530 | 2535 | |
2531 | - if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) { // Not AJAX submit, no headers sent, and there is just one Redirect action runs. |
|
2536 | + if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) { |
|
2537 | +// Not AJAX submit, no headers sent, and there is just one Redirect action runs. |
|
2532 | 2538 | if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) { |
2533 | 2539 | self::print_open_in_new_tab_js_with_fallback_handler( $success_url, $args ); |
2534 | 2540 | self::$redirected_in_new_tab[ $args['form']->id ] = 1; |
@@ -2628,7 +2634,8 @@ discard block |
||
2628 | 2634 | |
2629 | 2635 | echo FrmAppHelper::maybe_kses( $redirect_msg ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
2630 | 2636 | echo '<script>'; |
2631 | - if ( empty( $args['doing_ajax'] ) ) { // Not AJAX submit, delay JS until window.load. |
|
2637 | + if ( empty( $args['doing_ajax'] ) ) { |
|
2638 | +// Not AJAX submit, delay JS until window.load. |
|
2632 | 2639 | echo 'window.onload=function(){'; |
2633 | 2640 | } |
2634 | 2641 | echo 'setTimeout(function(){' . $redirect_js . '}, ' . intval( $delay_time ) . ');'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
@@ -530,11 +530,11 @@ discard block |
||
530 | 530 | ), |
531 | 531 | ); |
532 | 532 | |
533 | - if ( ! isset( $available_status[ $status ] ) ) { |
|
533 | + if ( ! isset( $available_status[$status] ) ) { |
|
534 | 534 | return; |
535 | 535 | } |
536 | 536 | |
537 | - FrmAppHelper::permission_check( $available_status[ $status ]['permission'] ); |
|
537 | + FrmAppHelper::permission_check( $available_status[$status]['permission'] ); |
|
538 | 538 | |
539 | 539 | $params = FrmForm::list_page_params(); |
540 | 540 | |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | check_admin_referer( $status . '_form_' . $params['id'] ); |
543 | 543 | |
544 | 544 | $count = 0; |
545 | - if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) { |
|
545 | + if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) { |
|
546 | 546 | $count ++; |
547 | 547 | } |
548 | 548 | |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | /* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */ |
560 | 560 | $available_status['trash']['message'] = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=untrash&form_type=' . $form_type . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' ); |
561 | 561 | |
562 | - $message = $available_status[ $status ]['message']; |
|
562 | + $message = $available_status[$status]['message']; |
|
563 | 563 | |
564 | 564 | self::display_forms_list( $params, $message ); |
565 | 565 | } |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | 'type' => 'request', |
581 | 581 | ) |
582 | 582 | ); |
583 | - $message = sprintf( |
|
583 | + $message = sprintf( |
|
584 | 584 | /* translators: %1$s: Number of forms, %2$s: Start link HTML, %3$s: End link HTML */ |
585 | 585 | _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), |
586 | 586 | $count, |
@@ -1004,11 +1004,11 @@ discard block |
||
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | foreach ( $template['categories'] as $category ) { |
1007 | - if ( ! isset( $templates_by_category[ $category ] ) ) { |
|
1008 | - $templates_by_category[ $category ] = array(); |
|
1007 | + if ( ! isset( $templates_by_category[$category] ) ) { |
|
1008 | + $templates_by_category[$category] = array(); |
|
1009 | 1009 | } |
1010 | 1010 | |
1011 | - $templates_by_category[ $category ][] = $template; |
|
1011 | + $templates_by_category[$category][] = $template; |
|
1012 | 1012 | } |
1013 | 1013 | } |
1014 | 1014 | unset( $template ); |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | $forms = FrmForm::get_published_forms( $where ); |
1038 | 1038 | $view_path = FrmAppHelper::plugin_path() . '/classes/views/frm-forms/'; |
1039 | 1039 | |
1040 | - $templates_by_category[ $my_templates_translation ] = $custom_templates; |
|
1040 | + $templates_by_category[$my_templates_translation] = $custom_templates; |
|
1041 | 1041 | |
1042 | 1042 | unset( $pricing, $license_type, $where ); |
1043 | 1043 | wp_enqueue_script( 'accordion' ); // register accordion for template groups |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | |
1294 | 1294 | foreach ( array( 'landing', 'chat', 'abandonment' ) as $feature ) { |
1295 | 1295 | if ( ! FrmAppHelper::show_new_feature( $feature ) ) { |
1296 | - unset( $sections[ $feature ] ); |
|
1296 | + unset( $sections[$feature] ); |
|
1297 | 1297 | } |
1298 | 1298 | } |
1299 | 1299 | |
@@ -1326,7 +1326,7 @@ discard block |
||
1326 | 1326 | $section['id'] = $section['anchor']; |
1327 | 1327 | } |
1328 | 1328 | |
1329 | - $sections[ $key ] = $section; |
|
1329 | + $sections[$key] = $section; |
|
1330 | 1330 | } |
1331 | 1331 | |
1332 | 1332 | return $sections; |
@@ -1444,7 +1444,7 @@ discard block |
||
1444 | 1444 | if ( ! empty( $user_fields ) ) { |
1445 | 1445 | $user_helpers = array(); |
1446 | 1446 | foreach ( $user_fields as $uk => $uf ) { |
1447 | - $user_helpers[ '|user_id| show="' . $uk . '"' ] = $uf; |
|
1447 | + $user_helpers['|user_id| show="' . $uk . '"'] = $uf; |
|
1448 | 1448 | unset( $uk, $uf ); |
1449 | 1449 | } |
1450 | 1450 | |
@@ -1583,7 +1583,7 @@ discard block |
||
1583 | 1583 | if ( ! isset( $frm_vars['js_validate_forms'] ) ) { |
1584 | 1584 | $frm_vars['js_validate_forms'] = array(); |
1585 | 1585 | } |
1586 | - $frm_vars['js_validate_forms'][ $form->id ] = $form; |
|
1586 | + $frm_vars['js_validate_forms'][$form->id] = $form; |
|
1587 | 1587 | } |
1588 | 1588 | |
1589 | 1589 | public static function get_email_html() { |
@@ -1742,7 +1742,7 @@ discard block |
||
1742 | 1742 | add_filter( 'frm_validate_form', 'FrmFormsController::json_error' ); |
1743 | 1743 | } else { |
1744 | 1744 | $vars = FrmAppHelper::json_to_array( $json_vars ); |
1745 | - $action = $vars[ $action ]; |
|
1745 | + $action = $vars[$action]; |
|
1746 | 1746 | unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
1747 | 1747 | $_REQUEST = array_merge( $_REQUEST, $vars ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
1748 | 1748 | $_POST = array_merge( $_POST, $_REQUEST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -1876,7 +1876,7 @@ discard block |
||
1876 | 1876 | $actions = array(); |
1877 | 1877 | foreach ( $frm_vars['forms_loaded'] as $form ) { |
1878 | 1878 | if ( is_object( $form ) ) { |
1879 | - $actions[ $form->id ] = $form->name; |
|
1879 | + $actions[$form->id] = $form->name; |
|
1880 | 1880 | } |
1881 | 1881 | unset( $form ); |
1882 | 1882 | } |
@@ -2120,8 +2120,8 @@ discard block |
||
2120 | 2120 | private static function get_saved_errors( $form, $params ) { |
2121 | 2121 | global $frm_vars; |
2122 | 2122 | |
2123 | - if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][ $form->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
2124 | - $errors = $frm_vars['created_entries'][ $form->id ]['errors']; |
|
2123 | + if ( $params['posted_form_id'] == $form->id && $_POST && isset( $frm_vars['created_entries'][$form->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
2124 | + $errors = $frm_vars['created_entries'][$form->id]['errors']; |
|
2125 | 2125 | } else { |
2126 | 2126 | $errors = array(); |
2127 | 2127 | } |
@@ -2143,7 +2143,7 @@ discard block |
||
2143 | 2143 | public static function just_created_entry( $form_id ) { |
2144 | 2144 | global $frm_vars; |
2145 | 2145 | |
2146 | - return ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form_id ] ) && isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) ? $frm_vars['created_entries'][ $form_id ]['entry_id'] : 0; |
|
2146 | + return ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][$form_id] ) && isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) ? $frm_vars['created_entries'][$form_id]['entry_id'] : 0; |
|
2147 | 2147 | } |
2148 | 2148 | |
2149 | 2149 | /** |
@@ -2163,7 +2163,7 @@ discard block |
||
2163 | 2163 | private static function get_confirmation_method( $atts ) { |
2164 | 2164 | $action = FrmOnSubmitHelper::current_event( $atts ); |
2165 | 2165 | $opt = 'update' === $action ? 'edit_action' : 'success_action'; |
2166 | - $method = ( isset( $atts['form']->options[ $opt ] ) && ! empty( $atts['form']->options[ $opt ] ) ) ? $atts['form']->options[ $opt ] : 'message'; |
|
2166 | + $method = ( isset( $atts['form']->options[$opt] ) && ! empty( $atts['form']->options[$opt] ) ) ? $atts['form']->options[$opt] : 'message'; |
|
2167 | 2167 | |
2168 | 2168 | if ( ! empty( $atts['entry_id'] ) ) { |
2169 | 2169 | $met_actions = self::get_met_on_submit_actions( $atts, $action ); |
@@ -2184,7 +2184,7 @@ discard block |
||
2184 | 2184 | public static function maybe_trigger_redirect( $form, $params, $args ) { |
2185 | 2185 | if ( ! isset( $params['id'] ) ) { |
2186 | 2186 | global $frm_vars; |
2187 | - $params['id'] = $frm_vars['created_entries'][ $form->id ]['entry_id']; |
|
2187 | + $params['id'] = $frm_vars['created_entries'][$form->id]['entry_id']; |
|
2188 | 2188 | } |
2189 | 2189 | |
2190 | 2190 | $conf_method = self::get_confirmation_method( |
@@ -2266,7 +2266,7 @@ discard block |
||
2266 | 2266 | $args['success_opt'] = $opt; |
2267 | 2267 | $args['ajax'] = ! empty( $frm_vars['ajax'] ); |
2268 | 2268 | |
2269 | - if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[ $opt . '_page_id' ] ) ) { |
|
2269 | + if ( $args['conf_method'] === 'page' && is_numeric( $args['form']->options[$opt . '_page_id'] ) ) { |
|
2270 | 2270 | self::load_page_after_submit( $args ); |
2271 | 2271 | } elseif ( $args['conf_method'] === 'redirect' ) { |
2272 | 2272 | self::redirect_after_submit( $args ); |
@@ -2290,7 +2290,7 @@ discard block |
||
2290 | 2290 | } |
2291 | 2291 | |
2292 | 2292 | // If a redirect action has already opened the URL in a new tab, we show the default message in the currect tab. |
2293 | - if ( ! empty( self::$redirected_in_new_tab[ $args['form']->id ] ) ) { |
|
2293 | + if ( ! empty( self::$redirected_in_new_tab[$args['form']->id] ) ) { |
|
2294 | 2294 | return array( FrmOnSubmitHelper::get_fallback_action_after_open_in_new_tab( $event ) ); |
2295 | 2295 | } |
2296 | 2296 | |
@@ -2477,7 +2477,7 @@ discard block |
||
2477 | 2477 | |
2478 | 2478 | $opt = 'update' === $args['action'] ? 'edit_' : 'success_'; |
2479 | 2479 | |
2480 | - $new_args['conf_method'] = $new_args['form']->options[ $opt . 'action' ]; |
|
2480 | + $new_args['conf_method'] = $new_args['form']->options[$opt . 'action']; |
|
2481 | 2481 | |
2482 | 2482 | /** |
2483 | 2483 | * Filters the run success action args. |
@@ -2497,8 +2497,8 @@ discard block |
||
2497 | 2497 | private static function load_page_after_submit( $args ) { |
2498 | 2498 | global $post; |
2499 | 2499 | $opt = $args['success_opt']; |
2500 | - if ( ! $post || $args['form']->options[ $opt . '_page_id' ] != $post->ID ) { |
|
2501 | - $page = get_post( $args['form']->options[ $opt . '_page_id' ] ); |
|
2500 | + if ( ! $post || $args['form']->options[$opt . '_page_id'] != $post->ID ) { |
|
2501 | + $page = get_post( $args['form']->options[$opt . '_page_id'] ); |
|
2502 | 2502 | $old_post = $post; |
2503 | 2503 | $post = $page; |
2504 | 2504 | $content = apply_filters( 'frm_content', $page->post_content, $args['form'], $args['entry_id'] ); |
@@ -2528,7 +2528,7 @@ discard block |
||
2528 | 2528 | add_filter( 'frm_use_wpautop', '__return_false' ); |
2529 | 2529 | |
2530 | 2530 | $opt = $args['success_opt']; |
2531 | - $success_url = trim( $args['form']->options[ $opt . '_url' ] ); |
|
2531 | + $success_url = trim( $args['form']->options[$opt . '_url'] ); |
|
2532 | 2532 | $success_url = apply_filters( 'frm_content', $success_url, $args['form'], $args['entry_id'] ); |
2533 | 2533 | $success_url = do_shortcode( $success_url ); |
2534 | 2534 | |
@@ -2548,7 +2548,7 @@ discard block |
||
2548 | 2548 | if ( ! headers_sent() && empty( $args['force_delay_redirect'] ) ) { // Not AJAX submit, no headers sent, and there is just one Redirect action runs. |
2549 | 2549 | if ( ! empty( $args['form']->options['open_in_new_tab'] ) ) { |
2550 | 2550 | self::print_open_in_new_tab_js_with_fallback_handler( $success_url, $args ); |
2551 | - self::$redirected_in_new_tab[ $args['form']->id ] = 1; |
|
2551 | + self::$redirected_in_new_tab[$args['form']->id] = 1; |
|
2552 | 2552 | return; |
2553 | 2553 | } |
2554 | 2554 | |
@@ -2808,7 +2808,7 @@ discard block |
||
2808 | 2808 | 'description' => false, |
2809 | 2809 | 'reset' => false, |
2810 | 2810 | ); |
2811 | - $args = wp_parse_args( $args, $defaults ); |
|
2811 | + $args = wp_parse_args( $args, $defaults ); |
|
2812 | 2812 | } |
2813 | 2813 | |
2814 | 2814 | /** |
@@ -2846,7 +2846,7 @@ discard block |
||
2846 | 2846 | $opt = isset( $args['success_opt'] ) ? $args['success_opt'] : 'success'; |
2847 | 2847 | |
2848 | 2848 | if ( $entry_id && is_numeric( $entry_id ) ) { |
2849 | - $message = isset( $form->options[ $opt . '_msg' ] ) ? $form->options[ $opt . '_msg' ] : $frm_settings->success_msg; |
|
2849 | + $message = isset( $form->options[$opt . '_msg'] ) ? $form->options[$opt . '_msg'] : $frm_settings->success_msg; |
|
2850 | 2850 | $class = 'frm_message'; |
2851 | 2851 | } else { |
2852 | 2852 | $message = $frm_settings->failed_msg; |
@@ -3070,7 +3070,7 @@ discard block |
||
3070 | 3070 | |
3071 | 3071 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
3072 | 3072 | |
3073 | - $html = FrmAppHelper::clip( |
|
3073 | + $html = FrmAppHelper::clip( |
|
3074 | 3074 | function() { |
3075 | 3075 | FrmAppHelper::maybe_autocomplete_pages_options( |
3076 | 3076 | array( |
@@ -76,7 +76,7 @@ |
||
76 | 76 | return false; |
77 | 77 | } |
78 | 78 | |
79 | - return $addons[ $addon_id ]; |
|
79 | + return $addons[$addon_id]; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |