@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | $address_setting = $action->post_content['billing_address']; |
124 | 124 | |
125 | 125 | $entry = self::generate_false_entry(); |
126 | - $first_name = $first_name_setting && isset( $entry->metas[ $first_name_setting ] ) ? $entry->metas[ $first_name_setting ] : ''; |
|
127 | - $last_name = $last_name_setting && isset( $entry->metas[ $last_name_setting ] ) ? $entry->metas[ $last_name_setting ] : ''; |
|
128 | - $address = $address_setting && isset( $entry->metas[ $address_setting ] ) ? $entry->metas[ $address_setting ] : ''; |
|
126 | + $first_name = $first_name_setting && isset( $entry->metas[$first_name_setting] ) ? $entry->metas[$first_name_setting] : ''; |
|
127 | + $last_name = $last_name_setting && isset( $entry->metas[$last_name_setting] ) ? $entry->metas[$last_name_setting] : ''; |
|
128 | + $address = $address_setting && isset( $entry->metas[$address_setting] ) ? $entry->metas[$address_setting] : ''; |
|
129 | 129 | |
130 | 130 | if ( is_array( $first_name ) && isset( $first_name['first'] ) ) { |
131 | 131 | $first_name = $first_name['first']; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | ); |
142 | 142 | |
143 | 143 | if ( $email_setting ) { |
144 | - $shortcode_atts = array( |
|
144 | + $shortcode_atts = array( |
|
145 | 145 | 'entry' => $entry, |
146 | 146 | 'form' => $action->menu_order, |
147 | 147 | 'value' => $email_setting, |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | if ( is_array( $v ) ) { |
182 | 182 | foreach ( $v as $f => $value ) { |
183 | 183 | FrmAppHelper::sanitize_value( 'wp_kses_post', $value ); |
184 | - $entry->metas[ absint( $f ) ] = $value; |
|
184 | + $entry->metas[absint( $f )] = $value; |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | } else { |
@@ -139,7 +139,8 @@ discard block |
||
139 | 139 | * @return string|true string on error, true on success. |
140 | 140 | */ |
141 | 141 | private static function trigger_one_time_payment( $atts ) { |
142 | - if ( empty( $_POST['square-token'] ) || empty( $_POST['square-verification-token'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
142 | + if ( empty( $_POST['square-token'] ) || empty( $_POST['square-verification-token'] ) ) { |
|
143 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
143 | 144 | return __( 'Please enter a valid credit card', 'formidable' ); |
144 | 145 | } |
145 | 146 | |
@@ -199,7 +200,8 @@ discard block |
||
199 | 200 | * @return bool|string True on success, error message on failure |
200 | 201 | */ |
201 | 202 | private static function trigger_recurring_payment( $atts ) { |
202 | - if ( empty( $_POST['square-token'] ) || empty( $_POST['square-verification-token'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
203 | + if ( empty( $_POST['square-token'] ) || empty( $_POST['square-verification-token'] ) ) { |
|
204 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
203 | 205 | return __( 'Please enter a valid credit card', 'formidable' ); |
204 | 206 | } |
205 | 207 |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $gateway = $payment_action->post_content['gateway']; |
77 | 77 | $is_square = $gateway === 'square' || ( is_array( $gateway ) && in_array( 'square', $gateway, true ) ); |
78 | 78 | if ( ! $is_square || empty( $payment_action->post_content['amount'] ) ) { |
79 | - unset( $payment_actions[ $k ] ); |
|
79 | + unset( $payment_actions[$k] ); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | return $payment_actions; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | 'run_triggers' => false, |
98 | 98 | 'show_errors' => true, |
99 | 99 | ); |
100 | - $atts = compact( 'action', 'entry', 'form' ); |
|
100 | + $atts = compact( 'action', 'entry', 'form' ); |
|
101 | 101 | |
102 | 102 | $amount = self::prepare_amount( $action->post_content['amount'], $atts ); |
103 | 103 | if ( empty( $amount ) || $amount == 000 ) { |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | 'value' => $atts['action']->post_content['description'], |
151 | 151 | ) |
152 | 152 | ); |
153 | - $result = FrmSquareLiteConnectHelper::create_payment( $atts['amount'], $currency, $square_token, $verification_token, $description ); |
|
153 | + $result = FrmSquareLiteConnectHelper::create_payment( $atts['amount'], $currency, $square_token, $verification_token, $description ); |
|
154 | 154 | |
155 | 155 | if ( false === $result ) { |
156 | 156 | return FrmSquareLiteConnectHelper::get_latest_error_from_square_api(); |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | false |
456 | 456 | ); |
457 | 457 | |
458 | - $square_vars = array( |
|
458 | + $square_vars = array( |
|
459 | 459 | 'formId' => $form_id, |
460 | 460 | 'nonce' => wp_create_nonce( 'frm_square_ajax' ), |
461 | 461 | 'ajax' => esc_url_raw( FrmAppHelper::get_ajax_url() ), |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | $disallowed = array( ';', ':', '!important' ); |
573 | 573 | foreach ( $settings as $k => $s ) { |
574 | 574 | if ( is_string( $s ) ) { |
575 | - $settings[ $k ] = str_replace( $disallowed, '', $s ); |
|
575 | + $settings[$k] = str_replace( $disallowed, '', $s ); |
|
576 | 576 | } |
577 | 577 | } |
578 | 578 | |
@@ -598,11 +598,11 @@ discard block |
||
598 | 598 | |
599 | 599 | $field_id = isset( $field->temp_id ) ? $field->temp_id : $field->id; |
600 | 600 | |
601 | - if ( isset( $errors[ 'field' . $field_id . '-cc' ] ) ) { |
|
602 | - unset( $errors[ 'field' . $field_id . '-cc' ] ); |
|
601 | + if ( isset( $errors['field' . $field_id . '-cc'] ) ) { |
|
602 | + unset( $errors['field' . $field_id . '-cc'] ); |
|
603 | 603 | } |
604 | - if ( isset( $errors[ 'field' . $field_id ] ) ) { |
|
605 | - unset( $errors[ 'field' . $field_id ] ); |
|
604 | + if ( isset( $errors['field' . $field_id] ) ) { |
|
605 | + unset( $errors['field' . $field_id] ); |
|
606 | 606 | } |
607 | 607 | |
608 | 608 | return $errors; |
@@ -472,8 +472,8 @@ discard block |
||
472 | 472 | return $values; |
473 | 473 | } |
474 | 474 | |
475 | - if ( is_array( $previous_entry->metas ) && isset( $previous_entry->metas[ $field->id ] ) ) { |
|
476 | - $values['value'] = $previous_entry->metas[ $field->id ]; |
|
475 | + if ( is_array( $previous_entry->metas ) && isset( $previous_entry->metas[$field->id] ) ) { |
|
476 | + $values['value'] = $previous_entry->metas[$field->id]; |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | $frm_vars['trans_filled'] = true; |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | * @param Closure $destroy_callback |
509 | 509 | * @return void |
510 | 510 | */ |
511 | - function () use ( $entry_id, &$destroy_callback ) { |
|
511 | + function() use ( $entry_id, &$destroy_callback ) { |
|
512 | 512 | FrmEntry::destroy( $entry_id ); |
513 | 513 | // Only call this once. |
514 | 514 | remove_action( 'frm_entry_form', $destroy_callback ); |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | * @return array |
529 | 529 | */ |
530 | 530 | public static function before_save_settings( $settings, $action ) { |
531 | - $settings['gateway'] = ! empty( $settings['gateway'] ) ? (array) $settings['gateway'] : array( 'stripe' ); |
|
531 | + $settings['gateway'] = ! empty( $settings['gateway'] ) ? (array) $settings['gateway'] : array( 'stripe' ); |
|
532 | 532 | |
533 | 533 | if ( in_array( 'square', $settings['gateway'] ) ) { |
534 | 534 | $currency = FrmSquareLiteConnectHelper::get_merchant_currency(); |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | $field_val = ''; |
157 | 157 | if ( is_object( $this->field ) ) { |
158 | 158 | $field_val = $this->field->{$column}; |
159 | - } elseif ( is_array( $this->field ) && isset( $this->field[ $column ] ) ) { |
|
160 | - $field_val = $this->field[ $column ]; |
|
159 | + } elseif ( is_array( $this->field ) && isset( $this->field[$column] ) ) { |
|
160 | + $field_val = $this->field[$column]; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | return $field_val; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | if ( is_object( $this->field ) ) { |
172 | 172 | $this->field->{$column} = $value; |
173 | 173 | } elseif ( is_array( $this->field ) ) { |
174 | - $this->field[ $column ] = $value; |
|
174 | + $this->field[$column] = $value; |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | printf( |
638 | 638 | /* translators: %s: Field type */ |
639 | 639 | esc_html__( '%s Options', 'formidable' ), |
640 | - esc_html( $all_field_types[ $args['display']['type'] ]['name'] ) |
|
640 | + esc_html( $all_field_types[$args['display']['type']]['name'] ) |
|
641 | 641 | ); |
642 | 642 | FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown6_icon', array( 'aria-hidden' => 'true' ) ); |
643 | 643 | ?> |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | * New field |
738 | 738 | */ |
739 | 739 | public function get_new_field_defaults() { |
740 | - $field = array( |
|
740 | + $field = array( |
|
741 | 741 | 'name' => $this->get_new_field_name(), |
742 | 742 | 'description' => '', |
743 | 743 | 'type' => $this->type, |
@@ -768,8 +768,8 @@ discard block |
||
768 | 768 | |
769 | 769 | $fields = array_merge( $fields, $pro_fields ); |
770 | 770 | |
771 | - if ( isset( $fields[ $this->type ] ) ) { |
|
772 | - $name = is_array( $fields[ $this->type ] ) ? $fields[ $this->type ]['name'] : $fields[ $this->type ]; |
|
771 | + if ( isset( $fields[$this->type] ) ) { |
|
772 | + $name = is_array( $fields[$this->type] ) ? $fields[$this->type]['name'] : $fields[$this->type]; |
|
773 | 773 | } |
774 | 774 | |
775 | 775 | return $name; |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | * @return array |
787 | 787 | */ |
788 | 788 | public function get_default_field_options() { |
789 | - $opts = array( |
|
789 | + $opts = array( |
|
790 | 790 | 'size' => '', |
791 | 791 | 'max' => '', |
792 | 792 | 'label' => '', |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | * @return void |
1031 | 1031 | */ |
1032 | 1032 | public function set_aria_invalid_error( &$shortcode_atts, $args ) { |
1033 | - $shortcode_atts['aria-invalid'] = isset( $args['errors'][ 'field' . $this->field_id ] ) ? 'true' : 'false'; |
|
1033 | + $shortcode_atts['aria-invalid'] = isset( $args['errors']['field' . $this->field_id] ) ? 'true' : 'false'; |
|
1034 | 1034 | } |
1035 | 1035 | |
1036 | 1036 | /** |
@@ -1181,11 +1181,11 @@ discard block |
||
1181 | 1181 | } |
1182 | 1182 | |
1183 | 1183 | $options = array_values( $this->field['options'] ); |
1184 | - if ( ! isset( $options[ $opt ] ) ) { |
|
1184 | + if ( ! isset( $options[$opt] ) ) { |
|
1185 | 1185 | return $hidden; |
1186 | 1186 | } |
1187 | 1187 | |
1188 | - $option = $options[ $opt ]; |
|
1188 | + $option = $options[$opt]; |
|
1189 | 1189 | if ( is_array( $option ) ) { |
1190 | 1190 | $option = $option['value']; |
1191 | 1191 | } |
@@ -1249,8 +1249,8 @@ discard block |
||
1249 | 1249 | $selected = $values['field_value']; |
1250 | 1250 | |
1251 | 1251 | if ( isset( $values['combo_name'] ) ) { |
1252 | - $options = $options[ $values['combo_name'] ]; |
|
1253 | - $selected = is_array( $selected ) && isset( $selected[ $values['combo_name'] ] ) ? $selected[ $values['combo_name'] ] : ''; |
|
1252 | + $options = $options[$values['combo_name']]; |
|
1253 | + $selected = is_array( $selected ) && isset( $selected[$values['combo_name']] ) ? $selected[$values['combo_name']] : ''; |
|
1254 | 1254 | } |
1255 | 1255 | |
1256 | 1256 | $input = $this->select_tag( $values ); |
@@ -1305,7 +1305,7 @@ discard block |
||
1305 | 1305 | } |
1306 | 1306 | |
1307 | 1307 | protected function fill_display_field_values( $args = array() ) { |
1308 | - $defaults = array( |
|
1308 | + $defaults = array( |
|
1309 | 1309 | 'field_name' => 'item_meta[' . $this->get_field_column( 'id' ) . ']', |
1310 | 1310 | 'field_id' => $this->get_field_column( 'id' ), |
1311 | 1311 | 'field_plus_id' => '', |
@@ -1362,7 +1362,7 @@ discard block |
||
1362 | 1362 | } |
1363 | 1363 | } |
1364 | 1364 | |
1365 | - if ( isset( $args['errors'][ 'field' . $args['field_id'] ] ) && ! $custom_error_fields ) { |
|
1365 | + if ( isset( $args['errors']['field' . $args['field_id']] ) && ! $custom_error_fields ) { |
|
1366 | 1366 | if ( $error_comes_first ) { |
1367 | 1367 | array_unshift( $describedby, 'frm_error_' . $args['html_id'] ); |
1368 | 1368 | } else { |
@@ -1440,11 +1440,11 @@ discard block |
||
1440 | 1440 | |
1441 | 1441 | $field_id = $this->get_field_column( 'id' ); |
1442 | 1442 | if ( ! array_key_exists( $field_id, $frm_validated_unique_values ) ) { |
1443 | - $frm_validated_unique_values[ $field_id ] = array(); |
|
1443 | + $frm_validated_unique_values[$field_id] = array(); |
|
1444 | 1444 | return false; |
1445 | 1445 | } |
1446 | 1446 | |
1447 | - $already_validated_this_value = in_array( $value, $frm_validated_unique_values[ $field_id ], true ); |
|
1447 | + $already_validated_this_value = in_array( $value, $frm_validated_unique_values[$field_id], true ); |
|
1448 | 1448 | return $already_validated_this_value; |
1449 | 1449 | } |
1450 | 1450 | |
@@ -1469,7 +1469,7 @@ discard block |
||
1469 | 1469 | private function value_validated_as_unique( $value ) { |
1470 | 1470 | global $frm_validated_unique_values; |
1471 | 1471 | $field_id = $this->get_field_column( 'id' ); |
1472 | - $frm_validated_unique_values[ $field_id ][] = $value; |
|
1472 | + $frm_validated_unique_values[$field_id][] = $value; |
|
1473 | 1473 | } |
1474 | 1474 | |
1475 | 1475 | /** |
@@ -1514,8 +1514,8 @@ discard block |
||
1514 | 1514 | $value = $this->prepare_display_value( $value, $atts ); |
1515 | 1515 | |
1516 | 1516 | if ( is_array( $value ) ) { |
1517 | - if ( ! empty( $atts['show'] ) && isset( $value[ $atts['show'] ] ) ) { |
|
1518 | - $value = $value[ $atts['show'] ]; |
|
1517 | + if ( ! empty( $atts['show'] ) && isset( $value[$atts['show']] ) ) { |
|
1518 | + $value = $value[$atts['show']]; |
|
1519 | 1519 | } elseif ( empty( $atts['return_array'] ) ) { |
1520 | 1520 | $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', '; |
1521 | 1521 | $value = FrmAppHelper::safe_implode( $sep, $value ); |
@@ -1645,8 +1645,8 @@ discard block |
||
1645 | 1645 | $saved_entries = $atts['ids']; |
1646 | 1646 | $new_value = array(); |
1647 | 1647 | foreach ( (array) $value as $old_child_id ) { |
1648 | - if ( isset( $saved_entries[ $old_child_id ] ) ) { |
|
1649 | - $new_value[] = $saved_entries[ $old_child_id ]; |
|
1648 | + if ( isset( $saved_entries[$old_child_id] ) ) { |
|
1649 | + $new_value[] = $saved_entries[$old_child_id]; |
|
1650 | 1650 | } |
1651 | 1651 | } |
1652 | 1652 |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $section['function'] = $original; |
174 | 174 | } |
175 | 175 | |
176 | - $sections[ $key ] = $section; |
|
176 | + $sections[$key] = $section; |
|
177 | 177 | }//end foreach |
178 | 178 | |
179 | 179 | return $sections; |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | |
194 | 194 | foreach ( $sections as $key => $section ) { |
195 | 195 | if ( in_array( $key, $payment_section_keys, true ) ) { |
196 | - self::$removed_payments_sections[ $key ] = $section; |
|
197 | - unset( $sections[ $key ] ); |
|
196 | + self::$removed_payments_sections[$key] = $section; |
|
197 | + unset( $sections[$key] ); |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
@@ -226,11 +226,11 @@ discard block |
||
226 | 226 | |
227 | 227 | $section = FrmAppHelper::get_post_param( 'tab', '', 'sanitize_text_field' ); |
228 | 228 | $sections = self::get_settings_tabs(); |
229 | - if ( ! isset( $sections[ $section ] ) ) { |
|
229 | + if ( ! isset( $sections[$section] ) ) { |
|
230 | 230 | wp_die(); |
231 | 231 | } |
232 | 232 | |
233 | - $section = $sections[ $section ]; |
|
233 | + $section = $sections[$section]; |
|
234 | 234 | |
235 | 235 | if ( isset( $section['class'] ) ) { |
236 | 236 | call_user_func( array( $section['class'], $section['function'] ) ); |
@@ -31,8 +31,8 @@ |
||
31 | 31 | if ( $is_active ) { |
32 | 32 | $input_params['checked'] = 'checked'; |
33 | 33 | } |
34 | - $other_section_selectors = array_map( |
|
35 | - function ( $section ) { |
|
34 | + $other_section_selectors = array_map( |
|
35 | + function( $section ) { |
|
36 | 36 | return "#frm_{$section}_settings_section"; |
37 | 37 | }, |
38 | 38 | array_diff( array_keys( $payment_sections ), array( $key ) ) |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $sub_field_class = "frm_form_field form-field frm_form_subfield-{$name} {$sub_field['wrapper_classes']}"; |
42 | 42 | $sub_field_desc = FrmField::get_option( $field, $name . '_desc' ); |
43 | 43 | |
44 | - if ( isset( $errors[ 'field' . $field_id . '-' . $name ] ) ) { |
|
44 | + if ( isset( $errors['field' . $field_id . '-' . $name] ) ) { |
|
45 | 45 | $sub_field_class .= ' frm_blank_field'; |
46 | 46 | } |
47 | 47 | ?> |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | $attrs = array( |
61 | 61 | 'type' => $sub_field['type'], |
62 | 62 | 'id' => $html_id . '_' . $name, |
63 | - 'value' => isset( $field_value[ $name ] ) ? $field_value[ $name ] : '', |
|
63 | + 'value' => isset( $field_value[$name] ) ? $field_value[$name] : '', |
|
64 | 64 | ); |
65 | 65 | |
66 | - if ( ! empty( $field_value[ $name ] ) ) { |
|
67 | - $attrs['data-frmval'] = $field_value[ $name ]; |
|
66 | + if ( ! empty( $field_value[$name] ) ) { |
|
67 | + $attrs['data-frmval'] = $field_value[$name]; |
|
68 | 68 | } |
69 | 69 | if ( empty( $args['remove_names'] ) ) { |
70 | 70 | $attrs['name'] = $field_name . '[' . $name . ']'; |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | // Don't show individual field errors when there is a combo field error. |
84 | - if ( ! empty( $errors ) && isset( $errors[ 'field' . $field_id . '-' . $name ] ) && ! isset( $errors[ 'field' . $field_id ] ) ) { |
|
84 | + if ( ! empty( $errors ) && isset( $errors['field' . $field_id . '-' . $name] ) && ! isset( $errors['field' . $field_id] ) ) { |
|
85 | 85 | ?> |
86 | - <div class="frm_error" role="alert"><?php echo esc_html( $errors[ 'field' . $field_id . '-' . $name ] ); ?></div> |
|
86 | + <div class="frm_error" role="alert"><?php echo esc_html( $errors['field' . $field_id . '-' . $name] ); ?></div> |
|
87 | 87 | <?php } ?> |
88 | 88 | </div> |
89 | 89 | <?php |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | unset( $filename ); |
156 | 156 | |
157 | - $comment_count = FrmDb::get_count( |
|
157 | + $comment_count = FrmDb::get_count( |
|
158 | 158 | 'frm_item_metas', |
159 | 159 | array( |
160 | 160 | 'item_id' => $atts['entry_ids'], |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | private static function prepare_csv_headings() { |
301 | 301 | $headings = array(); |
302 | 302 | self::csv_headings( $headings ); |
303 | - $headings = apply_filters( |
|
303 | + $headings = apply_filters( |
|
304 | 304 | 'frm_csv_columns', |
305 | 305 | $headings, |
306 | 306 | self::$form_id, |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | $field_headings = array(); |
325 | 325 | $separate_values = array( 'user_id', 'file', 'data', 'date' ); |
326 | 326 | if ( ! empty( $col->field_options['separate_value'] ) && ! in_array( $col->type, $separate_values, true ) ) { |
327 | - $field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
327 | + $field_headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
328 | 328 | } |
329 | 329 | |
330 | - $field_headings[ $col->id ] = strip_tags( $col->name ); |
|
330 | + $field_headings[$col->id] = strip_tags( $col->name ); |
|
331 | 331 | $field_headings = apply_filters( |
332 | 332 | 'frm_csv_field_columns', |
333 | 333 | $field_headings, |
@@ -348,14 +348,14 @@ discard block |
||
348 | 348 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
349 | 349 | $repeater_id = $col->field_options['in_section']; |
350 | 350 | // Set a placeholder to maintain order for repeater fields. |
351 | - $headings[ 'repeater' . $repeater_id ] = array(); |
|
351 | + $headings['repeater' . $repeater_id] = array(); |
|
352 | 352 | |
353 | - if ( ! isset( $fields_by_repeater_id[ $repeater_id ] ) ) { |
|
354 | - $fields_by_repeater_id[ $repeater_id ] = array(); |
|
353 | + if ( ! isset( $fields_by_repeater_id[$repeater_id] ) ) { |
|
354 | + $fields_by_repeater_id[$repeater_id] = array(); |
|
355 | 355 | $repeater_ids[] = $repeater_id; |
356 | 356 | } |
357 | 357 | |
358 | - $fields_by_repeater_id[ $repeater_id ][] = $col; |
|
358 | + $fields_by_repeater_id[$repeater_id][] = $col; |
|
359 | 359 | |
360 | 360 | continue; |
361 | 361 | } |
@@ -374,8 +374,8 @@ discard block |
||
374 | 374 | $end = strpos( $row->meta_value, ':{' ); |
375 | 375 | $length = substr( $row->meta_value, $start, $end - $start ); |
376 | 376 | |
377 | - if ( $length > $max[ $row->field_id ] ) { |
|
378 | - $max[ $row->field_id ] = $length; |
|
377 | + if ( $length > $max[$row->field_id] ) { |
|
378 | + $max[$row->field_id] = $length; |
|
379 | 379 | } |
380 | 380 | } |
381 | 381 | unset( $start, $end, $length, $row, $repeater_meta, $where ); |
@@ -386,17 +386,17 @@ discard block |
||
386 | 386 | $repeater_id = str_replace( 'repeater', '', $key ); |
387 | 387 | |
388 | 388 | $repeater_headings = array(); |
389 | - foreach ( $fields_by_repeater_id[ $repeater_id ] as $col ) { |
|
389 | + foreach ( $fields_by_repeater_id[$repeater_id] as $col ) { |
|
390 | 390 | $repeater_headings += self::field_headings( $col ); |
391 | 391 | } |
392 | 392 | |
393 | - for ( $i = 0; $i < $max[ $repeater_id ]; $i++ ) { |
|
393 | + for ( $i = 0; $i < $max[$repeater_id]; $i ++ ) { |
|
394 | 394 | foreach ( $repeater_headings as $repeater_key => $repeater_name ) { |
395 | - $flat[ $repeater_key . '[' . $i . ']' ] = $repeater_name; |
|
395 | + $flat[$repeater_key . '[' . $i . ']'] = $repeater_name; |
|
396 | 396 | } |
397 | 397 | } |
398 | 398 | } else { |
399 | - $flat[ $key ] = $heading; |
|
399 | + $flat[$key] = $heading; |
|
400 | 400 | } |
401 | 401 | } |
402 | 402 | |
@@ -409,10 +409,10 @@ discard block |
||
409 | 409 | }//end if |
410 | 410 | |
411 | 411 | if ( self::$comment_count ) { |
412 | - for ( $i = 0; $i < self::$comment_count; $i++ ) { |
|
413 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
414 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
415 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
412 | + for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
|
413 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
414 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
415 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
416 | 416 | } |
417 | 417 | unset( $i ); |
418 | 418 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | |
458 | 458 | private static function prepare_next_csv_rows( $next_set ) { |
459 | 459 | if ( FrmAppHelper::pro_is_installed() ) { |
460 | - $where = array( |
|
460 | + $where = array( |
|
461 | 461 | 'or' => 1, |
462 | 462 | 'id' => $next_set, |
463 | 463 | 'parent_item_id' => $next_set, |
@@ -514,32 +514,32 @@ discard block |
||
514 | 514 | continue; |
515 | 515 | } |
516 | 516 | |
517 | - if ( ! isset( $entries[ self::$entry->parent_item_id ] ) ) { |
|
518 | - $entries[ self::$entry->parent_item_id ] = new stdClass(); |
|
519 | - $entries[ self::$entry->parent_item_id ]->metas = array(); |
|
517 | + if ( ! isset( $entries[self::$entry->parent_item_id] ) ) { |
|
518 | + $entries[self::$entry->parent_item_id] = new stdClass(); |
|
519 | + $entries[self::$entry->parent_item_id]->metas = array(); |
|
520 | 520 | } |
521 | 521 | |
522 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
523 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
524 | - } elseif ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
522 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
523 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
524 | + } elseif ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
525 | 525 | // if the data is here, it should be an array but if this field has collected data |
526 | 526 | // both while inside and outside of the repeating section, it's possible this is a string. |
527 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
527 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
528 | 528 | } |
529 | 529 | |
530 | 530 | // Add the repeated values. |
531 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
531 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
532 | 532 | }//end foreach |
533 | 533 | |
534 | 534 | self::$entry->metas = self::fill_missing_repeater_metas( self::$entry->metas, $entries ); |
535 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
535 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
536 | 536 | }//end if |
537 | 537 | |
538 | 538 | // add the embedded form id |
539 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
540 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
539 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
540 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
541 | 541 | } |
542 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
542 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | /** |
@@ -560,19 +560,19 @@ discard block |
||
560 | 560 | } |
561 | 561 | |
562 | 562 | $repeater_id = $field->field_options['in_section']; |
563 | - if ( ! isset( self::$fields_by_repeater_id[ $repeater_id ] ) ) { |
|
563 | + if ( ! isset( self::$fields_by_repeater_id[$repeater_id] ) ) { |
|
564 | 564 | return $metas; |
565 | 565 | } |
566 | 566 | |
567 | - foreach ( self::$fields_by_repeater_id[ $repeater_id ] as $repeater_child ) { |
|
568 | - if ( ! isset( $metas[ $repeater_child->id ] ) ) { |
|
569 | - $metas[ $repeater_child->id ] = ''; |
|
567 | + foreach ( self::$fields_by_repeater_id[$repeater_id] as $repeater_child ) { |
|
568 | + if ( ! isset( $metas[$repeater_child->id] ) ) { |
|
569 | + $metas[$repeater_child->id] = ''; |
|
570 | 570 | |
571 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) || ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) ) { |
|
572 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] = array(); |
|
571 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) || ! is_array( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) ) { |
|
572 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] = array(); |
|
573 | 573 | } |
574 | 574 | |
575 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ][] = ''; |
|
575 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id][] = ''; |
|
576 | 576 | } |
577 | 577 | } |
578 | 578 | |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | |
592 | 592 | private static function add_field_values_to_csv( &$row ) { |
593 | 593 | foreach ( self::$fields as $col ) { |
594 | - $field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false; |
|
594 | + $field_value = isset( self::$entry->metas[$col->id] ) ? self::$entry->metas[$col->id] : false; |
|
595 | 595 | |
596 | 596 | FrmFieldsHelper::prepare_field_value( $field_value, $col->type ); |
597 | 597 | |
@@ -613,20 +613,20 @@ discard block |
||
613 | 613 | if ( ! empty( $col->field_options['separate_value'] ) ) { |
614 | 614 | $label_key = $col->id . '_label'; |
615 | 615 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
616 | - $row[ $label_key ] = array(); |
|
616 | + $row[$label_key] = array(); |
|
617 | 617 | |
618 | 618 | if ( is_array( $field_value ) ) { |
619 | 619 | foreach ( $field_value as $value ) { |
620 | - $row[ $label_key ][] = self::get_separate_value_label( $value, $col ); |
|
620 | + $row[$label_key][] = self::get_separate_value_label( $value, $col ); |
|
621 | 621 | } |
622 | 622 | } |
623 | 623 | } else { |
624 | - $row[ $label_key ] = self::get_separate_value_label( $field_value, $col ); |
|
624 | + $row[$label_key] = self::get_separate_value_label( $field_value, $col ); |
|
625 | 625 | } |
626 | 626 | unset( $label_key ); |
627 | 627 | } |
628 | 628 | |
629 | - $row[ $col->id ] = $field_value; |
|
629 | + $row[$col->id] = $field_value; |
|
630 | 630 | |
631 | 631 | unset( $col, $field_value ); |
632 | 632 | }//end foreach |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | 'show_icon' => false, |
650 | 650 | 'entry_id' => self::$entry->id, |
651 | 651 | 'sep' => self::$separator, |
652 | - 'embedded_field_id' => isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[ self::$entry->id ] ) ? 'form' . self::$entry->embedded_fields[ self::$entry->id ] : 0, |
|
652 | + 'embedded_field_id' => isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[self::$entry->id] ) ? 'form' . self::$entry->embedded_fields[self::$entry->id] : 0, |
|
653 | 653 | ) |
654 | 654 | ); |
655 | 655 | } |
@@ -664,8 +664,8 @@ discard block |
||
664 | 664 | // This is combo field inside repeater. The heading key has this format: [86_first[0]]. |
665 | 665 | foreach ( $sub_value as $sub_key => $sub_sub_value ) { |
666 | 666 | $column_key = $atts['col']->id . '_' . $sub_key . '[' . $key . ']'; |
667 | - if ( ! is_numeric( $sub_key ) && isset( self::$headings[ $column_key ] ) ) { |
|
668 | - $row[ $column_key ] = $sub_sub_value; |
|
667 | + if ( ! is_numeric( $sub_key ) && isset( self::$headings[$column_key] ) ) { |
|
668 | + $row[$column_key] = $sub_sub_value; |
|
669 | 669 | } |
670 | 670 | } |
671 | 671 | |
@@ -673,8 +673,8 @@ discard block |
||
673 | 673 | } |
674 | 674 | |
675 | 675 | $column_key = $atts['col']->id . '_' . $key; |
676 | - if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) { |
|
677 | - $row[ $column_key ] = $sub_value; |
|
676 | + if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) { |
|
677 | + $row[$column_key] = $sub_value; |
|
678 | 678 | } |
679 | 679 | } |
680 | 680 | } |
@@ -699,18 +699,18 @@ discard block |
||
699 | 699 | $echo = 'echo' === self::$mode; |
700 | 700 | |
701 | 701 | foreach ( self::$headings as $k => $heading ) { |
702 | - if ( isset( $rows[ $k ] ) ) { |
|
703 | - $row = $rows[ $k ]; |
|
702 | + if ( isset( $rows[$k] ) ) { |
|
703 | + $row = $rows[$k]; |
|
704 | 704 | } else { |
705 | 705 | $row = ''; |
706 | 706 | // array indexed data is not at $rows[ $k ] |
707 | - if ( $k[ strlen( $k ) - 1 ] === ']' ) { |
|
707 | + if ( $k[strlen( $k ) - 1] === ']' ) { |
|
708 | 708 | $start = strrpos( $k, '[' ); |
709 | - $key = substr( $k, 0, $start++ ); |
|
709 | + $key = substr( $k, 0, $start ++ ); |
|
710 | 710 | $index = substr( $k, $start, strlen( $k ) - 1 - $start ); |
711 | 711 | |
712 | - if ( isset( $rows[ $key ] ) && isset( $rows[ $key ][ $index ] ) ) { |
|
713 | - $row = $rows[ $key ][ $index ]; |
|
712 | + if ( isset( $rows[$key] ) && isset( $rows[$key][$index] ) ) { |
|
713 | + $row = $rows[$key][$index]; |
|
714 | 714 | } |
715 | 715 | |
716 | 716 | unset( $start, $key, $index ); |