@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | type="text" |
52 | 52 | name="<?php echo esc_attr( $input_name ); ?>" |
53 | 53 | id="<?php echo esc_attr( $input_id ); ?>" |
54 | - value="<?php echo esc_attr( isset( $default_value[ $sub_field['name'] ] ) ? $default_value[ $sub_field['name'] ] : '' ); ?>" |
|
54 | + value="<?php echo esc_attr( isset( $default_value[$sub_field['name']] ) ? $default_value[$sub_field['name']] : '' ); ?>" |
|
55 | 55 | data-changeme="field_<?php echo esc_attr( $field_key . '_' . $sub_field['name'] ); ?>" |
56 | 56 | data-changeatt="value" |
57 | 57 | /> |
58 | 58 | </span> |
59 | 59 | <label class="frm_description" for="<?php echo esc_attr( $input_id ); ?>"> |
60 | - <?php echo esc_html( $labels[ $option ] ); ?> |
|
60 | + <?php echo esc_html( $labels[$option] ); ?> |
|
61 | 61 | </label> |
62 | 62 | </p> |
63 | 63 | <?php |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | type="text" |
75 | 75 | name="<?php echo esc_attr( $input_name ); ?>" |
76 | 76 | id="<?php echo esc_attr( $input_id ); ?>" |
77 | - value="<?php echo esc_attr( isset( $input_value[ $sub_field['name'] ] ) ? $input_value[ $sub_field['name'] ] : '' ); ?>" |
|
77 | + value="<?php echo esc_attr( isset( $input_value[$sub_field['name']] ) ? $input_value[$sub_field['name']] : '' ); ?>" |
|
78 | 78 | data-changeme="field_<?php echo esc_attr( $field_key . '_' . $sub_field['name'] ); ?>" |
79 | 79 | data-changeatt="<?php echo esc_attr( $option ); ?>" |
80 | 80 | /> |
81 | 81 | <label class="frm_description" for="<?php echo esc_attr( $input_id ); ?>"> |
82 | - <?php echo esc_html( $labels[ $option ] ); ?> |
|
82 | + <?php echo esc_html( $labels[$option] ); ?> |
|
83 | 83 | </label> |
84 | 84 | </p> |
85 | 85 | <?php |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | data-changeme="frm_field_<?php echo esc_attr( $field_id . '_' . $sub_field['name'] ); ?>_desc" |
101 | 101 | /> |
102 | 102 | <label class="frm_description" for="<?php echo esc_attr( $input_id ); ?>"> |
103 | - <?php echo esc_html( $labels[ $option ] ); ?> |
|
103 | + <?php echo esc_html( $labels[$option] ); ?> |
|
104 | 104 | </label> |
105 | 105 | </p> |
106 | 106 | <?php |
@@ -122,7 +122,8 @@ |
||
122 | 122 | |
123 | 123 | private static function field_headings( $col ) { |
124 | 124 | $field_type_obj = FrmFieldFactory::get_field_factory( $col ); |
125 | - if ( ! empty( $field_type_obj->is_combo_field ) ) { // This is combo field. |
|
125 | + if ( ! empty( $field_type_obj->is_combo_field ) ) { |
|
126 | +// This is combo field. |
|
126 | 127 | return $field_type_obj->get_export_headings(); |
127 | 128 | } |
128 | 129 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | self::print_file_headers( $filename ); |
42 | 42 | unset( $filename ); |
43 | 43 | |
44 | - $comment_count = FrmDb::get_count( |
|
44 | + $comment_count = FrmDb::get_count( |
|
45 | 45 | 'frm_item_metas', |
46 | 46 | array( |
47 | 47 | 'item_id' => $atts['entry_ids'], |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | private static function prepare_csv_headings() { |
108 | 108 | $headings = array(); |
109 | 109 | self::csv_headings( $headings ); |
110 | - $headings = apply_filters( |
|
110 | + $headings = apply_filters( |
|
111 | 111 | 'frm_csv_columns', |
112 | 112 | $headings, |
113 | 113 | self::$form_id, |
@@ -129,10 +129,10 @@ discard block |
||
129 | 129 | $field_headings = array(); |
130 | 130 | $separate_values = array( 'user_id', 'file', 'data', 'date' ); |
131 | 131 | if ( ! empty( $col->field_options['separate_value'] ) && ! in_array( $col->type, $separate_values, true ) ) { |
132 | - $field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
132 | + $field_headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
133 | 133 | } |
134 | 134 | |
135 | - $field_headings[ $col->id ] = strip_tags( $col->name ); |
|
135 | + $field_headings[$col->id] = strip_tags( $col->name ); |
|
136 | 136 | $field_headings = apply_filters( |
137 | 137 | 'frm_csv_field_columns', |
138 | 138 | $field_headings, |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | foreach ( self::$fields as $col ) { |
152 | 152 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
153 | 153 | $repeater_id = $col->field_options['in_section']; |
154 | - $headings[ 'repeater' . $repeater_id ] = array(); // set a placeholder to maintain order for repeater fields |
|
154 | + $headings['repeater' . $repeater_id] = array(); // set a placeholder to maintain order for repeater fields |
|
155 | 155 | |
156 | - if ( ! isset( $fields_by_repeater_id[ $repeater_id ] ) ) { |
|
157 | - $fields_by_repeater_id[ $repeater_id ] = array(); |
|
156 | + if ( ! isset( $fields_by_repeater_id[$repeater_id] ) ) { |
|
157 | + $fields_by_repeater_id[$repeater_id] = array(); |
|
158 | 158 | $repeater_ids[] = $repeater_id; |
159 | 159 | } |
160 | 160 | |
161 | - $fields_by_repeater_id[ $repeater_id ][] = $col; |
|
161 | + $fields_by_repeater_id[$repeater_id][] = $col; |
|
162 | 162 | |
163 | 163 | continue; |
164 | 164 | } |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | $end = strpos( $row->meta_value, ':{' ); |
178 | 178 | $length = substr( $row->meta_value, $start, $end - $start ); |
179 | 179 | |
180 | - if ( $length > $max[ $row->field_id ] ) { |
|
181 | - $max[ $row->field_id ] = $length; |
|
180 | + if ( $length > $max[$row->field_id] ) { |
|
181 | + $max[$row->field_id] = $length; |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | unset( $start, $end, $length, $row, $repeater_meta, $where ); |
@@ -189,17 +189,17 @@ discard block |
||
189 | 189 | $repeater_id = str_replace( 'repeater', '', $key ); |
190 | 190 | |
191 | 191 | $repeater_headings = array(); |
192 | - foreach ( $fields_by_repeater_id[ $repeater_id ] as $col ) { |
|
192 | + foreach ( $fields_by_repeater_id[$repeater_id] as $col ) { |
|
193 | 193 | $repeater_headings += self::field_headings( $col ); |
194 | 194 | } |
195 | 195 | |
196 | - for ( $i = 0; $i < $max[ $repeater_id ]; $i ++ ) { |
|
196 | + for ( $i = 0; $i < $max[$repeater_id]; $i ++ ) { |
|
197 | 197 | foreach ( $repeater_headings as $repeater_key => $repeater_name ) { |
198 | - $flat[ $repeater_key . '[' . $i . ']' ] = $repeater_name; |
|
198 | + $flat[$repeater_key . '[' . $i . ']'] = $repeater_name; |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | } else { |
202 | - $flat[ $key ] = $heading; |
|
202 | + $flat[$key] = $heading; |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | |
@@ -213,9 +213,9 @@ discard block |
||
213 | 213 | |
214 | 214 | if ( self::$comment_count ) { |
215 | 215 | for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
216 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
217 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
218 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
216 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
217 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
218 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
219 | 219 | } |
220 | 220 | unset( $i ); |
221 | 221 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | |
259 | 259 | private static function prepare_next_csv_rows( $next_set ) { |
260 | 260 | // order by parent_item_id so children will be first |
261 | - $where = array( |
|
261 | + $where = array( |
|
262 | 262 | 'or' => 1, |
263 | 263 | 'id' => $next_set, |
264 | 264 | 'parent_item_id' => $next_set, |
@@ -303,32 +303,32 @@ discard block |
||
303 | 303 | continue; |
304 | 304 | } |
305 | 305 | |
306 | - if ( ! isset( $entries[ self::$entry->parent_item_id ] ) ) { |
|
307 | - $entries[ self::$entry->parent_item_id ] = new stdClass(); |
|
308 | - $entries[ self::$entry->parent_item_id ]->metas = array(); |
|
306 | + if ( ! isset( $entries[self::$entry->parent_item_id] ) ) { |
|
307 | + $entries[self::$entry->parent_item_id] = new stdClass(); |
|
308 | + $entries[self::$entry->parent_item_id]->metas = array(); |
|
309 | 309 | } |
310 | 310 | |
311 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
312 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
313 | - } elseif ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
311 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
312 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
313 | + } elseif ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
314 | 314 | // if the data is here, it should be an array but if this field has collected data |
315 | 315 | // both while inside and outside of the repeating section, it's possible this is a string |
316 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
316 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | //add the repeated values |
320 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
320 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | self::$entry->metas = self::fill_missing_repeater_metas( self::$entry->metas, $entries ); |
324 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
324 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | // add the embedded form id |
328 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
329 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
328 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
329 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
330 | 330 | } |
331 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
331 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -349,14 +349,14 @@ discard block |
||
349 | 349 | } |
350 | 350 | |
351 | 351 | $repeater_id = $field->field_options['in_section']; |
352 | - if ( ! isset( self::$fields_by_repeater_id[ $repeater_id ] ) ) { |
|
352 | + if ( ! isset( self::$fields_by_repeater_id[$repeater_id] ) ) { |
|
353 | 353 | return $metas; |
354 | 354 | } |
355 | 355 | |
356 | - foreach ( self::$fields_by_repeater_id[ $repeater_id ] as $repeater_child ) { |
|
357 | - if ( ! isset( $metas[ $repeater_child->id ] ) ) { |
|
358 | - $metas[ $repeater_child->id ] = ''; |
|
359 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ][] = ''; |
|
356 | + foreach ( self::$fields_by_repeater_id[$repeater_id] as $repeater_child ) { |
|
357 | + if ( ! isset( $metas[$repeater_child->id] ) ) { |
|
358 | + $metas[$repeater_child->id] = ''; |
|
359 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id][] = ''; |
|
360 | 360 | } |
361 | 361 | } |
362 | 362 | |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | |
376 | 376 | private static function add_field_values_to_csv( &$row ) { |
377 | 377 | foreach ( self::$fields as $col ) { |
378 | - $field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false; |
|
378 | + $field_value = isset( self::$entry->metas[$col->id] ) ? self::$entry->metas[$col->id] : false; |
|
379 | 379 | |
380 | 380 | FrmAppHelper::unserialize_or_decode( $field_value ); |
381 | 381 | self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) ); |
@@ -393,17 +393,17 @@ discard block |
||
393 | 393 | if ( ! empty( $col->field_options['separate_value'] ) ) { |
394 | 394 | $label_key = $col->id . '_label'; |
395 | 395 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
396 | - $row[ $label_key ] = array(); |
|
396 | + $row[$label_key] = array(); |
|
397 | 397 | foreach ( $field_value as $value ) { |
398 | - $row[ $label_key ][] = self::get_separate_value_label( $value, $col ); |
|
398 | + $row[$label_key][] = self::get_separate_value_label( $value, $col ); |
|
399 | 399 | } |
400 | 400 | } else { |
401 | - $row[ $label_key ] = self::get_separate_value_label( $field_value, $col ); |
|
401 | + $row[$label_key] = self::get_separate_value_label( $field_value, $col ); |
|
402 | 402 | } |
403 | 403 | unset( $label_key ); |
404 | 404 | } |
405 | 405 | |
406 | - $row[ $col->id ] = $field_value; |
|
406 | + $row[$col->id] = $field_value; |
|
407 | 407 | |
408 | 408 | unset( $col, $field_value ); |
409 | 409 | } |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | 'show_icon' => false, |
427 | 427 | 'entry_id' => self::$entry->id, |
428 | 428 | 'sep' => self::$separator, |
429 | - '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, |
|
429 | + '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, |
|
430 | 430 | ) |
431 | 431 | ); |
432 | 432 | } |
@@ -441,8 +441,8 @@ discard block |
||
441 | 441 | // This is combo field inside repeater. The heading key has this format: [86_first[0]]. |
442 | 442 | foreach ( $sub_value as $sub_key => $sub_sub_value ) { |
443 | 443 | $column_key = $atts['col']->id . '_' . $sub_key . '[' . $key . ']'; |
444 | - if ( ! is_numeric( $sub_key ) && isset( self::$headings[ $column_key ] ) ) { |
|
445 | - $row[ $column_key ] = $sub_sub_value; |
|
444 | + if ( ! is_numeric( $sub_key ) && isset( self::$headings[$column_key] ) ) { |
|
445 | + $row[$column_key] = $sub_sub_value; |
|
446 | 446 | } |
447 | 447 | } |
448 | 448 | |
@@ -450,8 +450,8 @@ discard block |
||
450 | 450 | } |
451 | 451 | |
452 | 452 | $column_key = $atts['col']->id . '_' . $key; |
453 | - if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) { |
|
454 | - $row[ $column_key ] = $sub_value; |
|
453 | + if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) { |
|
454 | + $row[$column_key] = $sub_value; |
|
455 | 455 | } |
456 | 456 | } |
457 | 457 | } |
@@ -475,18 +475,18 @@ discard block |
||
475 | 475 | $sep = ''; |
476 | 476 | |
477 | 477 | foreach ( self::$headings as $k => $heading ) { |
478 | - if ( isset( $rows[ $k ] ) ) { |
|
479 | - $row = $rows[ $k ]; |
|
478 | + if ( isset( $rows[$k] ) ) { |
|
479 | + $row = $rows[$k]; |
|
480 | 480 | } else { |
481 | 481 | $row = ''; |
482 | 482 | // array indexed data is not at $rows[ $k ] |
483 | - if ( $k[ strlen( $k ) - 1 ] === ']' ) { |
|
483 | + if ( $k[strlen( $k ) - 1] === ']' ) { |
|
484 | 484 | $start = strrpos( $k, '[' ); |
485 | 485 | $key = substr( $k, 0, $start ++ ); |
486 | 486 | $index = substr( $k, $start, strlen( $k ) - 1 - $start ); |
487 | 487 | |
488 | - if ( isset( $rows[ $key ] ) && isset( $rows[ $key ][ $index ] ) ) { |
|
489 | - $row = $rows[ $key ][ $index ]; |
|
488 | + if ( isset( $rows[$key] ) && isset( $rows[$key][$index] ) ) { |
|
489 | + $row = $rows[$key][$index]; |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | unset( $start, $key, $index ); |
@@ -213,10 +213,10 @@ |
||
213 | 213 | return false; |
214 | 214 | } |
215 | 215 | $form_params = $frm_vars['form_params']; |
216 | - if ( ! isset( $form_params[ $this->form_id ] ) ) { |
|
216 | + if ( ! isset( $form_params[$this->form_id] ) ) { |
|
217 | 217 | return false; |
218 | 218 | } |
219 | - $this_form_params = $form_params[ $this->form_id ]; |
|
219 | + $this_form_params = $form_params[$this->form_id]; |
|
220 | 220 | return ! empty( $this_form_params['action'] ) && 'update' === $this_form_params['action']; |
221 | 221 | } |
222 | 222 |
@@ -48,7 +48,7 @@ |
||
48 | 48 | private function check_honeypot_setting() { |
49 | 49 | $form = $this->get_form(); |
50 | 50 | $key = $this->get_option_key(); |
51 | - return $form->options[ $key ]; |
|
51 | + return $form->options[$key]; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -38,7 +38,7 @@ |
||
38 | 38 | protected function is_option_on() { |
39 | 39 | $form = $this->get_form(); |
40 | 40 | $key = $this->get_option_key(); |
41 | - return ! empty( $form->options[ $key ] ) && 'off' !== $form->options[ $key ]; |
|
41 | + return ! empty( $form->options[$key] ) && 'off' !== $form->options[$key]; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -46,19 +46,19 @@ discard block |
||
46 | 46 | $result = array(); |
47 | 47 | |
48 | 48 | foreach ( $names as $name ) { |
49 | - if ( empty( $this->sub_fields[ $name ] ) ) { |
|
49 | + if ( empty( $this->sub_fields[$name] ) ) { |
|
50 | 50 | continue; |
51 | 51 | } |
52 | 52 | |
53 | - if ( ! isset( $this->sub_fields[ $name ]['wrapper_classes'] ) ) { |
|
54 | - $this->sub_fields[ $name ]['wrapper_classes'] = $col_class; |
|
55 | - } elseif ( is_array( $this->sub_fields[ $name ]['wrapper_classes'] ) ) { |
|
56 | - $this->sub_fields[ $name ]['wrapper_classes'] = implode( ' ', $this->sub_fields[ $name ]['wrapper_classes'] ) . ' ' . $col_class; |
|
53 | + if ( ! isset( $this->sub_fields[$name]['wrapper_classes'] ) ) { |
|
54 | + $this->sub_fields[$name]['wrapper_classes'] = $col_class; |
|
55 | + } elseif ( is_array( $this->sub_fields[$name]['wrapper_classes'] ) ) { |
|
56 | + $this->sub_fields[$name]['wrapper_classes'] = implode( ' ', $this->sub_fields[$name]['wrapper_classes'] ) . ' ' . $col_class; |
|
57 | 57 | } else { |
58 | - $this->sub_fields[ $name ]['wrapper_classes'] .= ' ' . $col_class; |
|
58 | + $this->sub_fields[$name]['wrapper_classes'] .= ' ' . $col_class; |
|
59 | 59 | } |
60 | 60 | |
61 | - $result[ $name ] = $this->sub_fields[ $name ]; |
|
61 | + $result[$name] = $this->sub_fields[$name]; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | return $result; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | // Default desc. |
91 | 91 | foreach ( $this->sub_fields as $name => $sub_field ) { |
92 | - $extra_options[ $name . '_desc' ] = $sub_field['label']; |
|
92 | + $extra_options[$name . '_desc'] = $sub_field['label']; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | return $extra_options; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $name_layout = $this->get_name_layout(); |
126 | 126 | |
127 | 127 | if ( ! empty( $atts['show'] ) ) { |
128 | - return isset( $value[ $atts['show'] ] ) ? $value[ $atts['show'] ] : ''; |
|
128 | + return isset( $value[$atts['show']] ) ? $value[$atts['show']] : ''; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | $value = wp_parse_args( |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $args['sub_fields'] = $this->sub_fields; |
199 | 199 | |
200 | 200 | foreach ( $hidden_fields as $name => $hidden_field ) { |
201 | - $args['sub_fields'][ $name ]['wrapper_classes'] .= ' frm_hidden'; |
|
201 | + $args['sub_fields'][$name]['wrapper_classes'] .= ' frm_hidden'; |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | } |
@@ -75,16 +75,16 @@ discard block |
||
75 | 75 | 'name' => sprintf( |
76 | 76 | /* translators: Formidable addon name */ |
77 | 77 | esc_html_x( 'Formidable %s', 'Formidable Addon Name', 'formidable' ), |
78 | - $addon_list[ $matching_addon ]['name'] |
|
78 | + $addon_list[$matching_addon]['name'] |
|
79 | 79 | ), |
80 | - 'addon' => $addon_list[ $matching_addon ]['slug'], |
|
81 | - 'short_description' => $addon_list[ $matching_addon ]['excerpt'], |
|
80 | + 'addon' => $addon_list[$matching_addon]['slug'], |
|
81 | + 'short_description' => $addon_list[$matching_addon]['excerpt'], |
|
82 | 82 | 'slug' => self::$slug, |
83 | - 'version' => $addon_list[ $matching_addon ]['version'], |
|
83 | + 'version' => $addon_list[$matching_addon]['version'], |
|
84 | 84 | ); |
85 | 85 | |
86 | 86 | // Splice in the base addon data. |
87 | - $inject = array_merge( $inject, $addon_list[ $matching_addon ], $overrides ); |
|
87 | + $inject = array_merge( $inject, $addon_list[$matching_addon], $overrides ); |
|
88 | 88 | |
89 | 89 | // Add it to the top of the list. |
90 | 90 | array_unshift( $result->plugins, $inject ); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @return array |
137 | 137 | */ |
138 | 138 | private function get_addons() { |
139 | - $api = new FrmFormApi(); |
|
139 | + $api = new FrmFormApi(); |
|
140 | 140 | return $api->get_api_info(); |
141 | 141 | } |
142 | 142 | |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | |
342 | 342 | $all_plugins = get_plugins(); |
343 | 343 | |
344 | - return isset( $all_plugins[ $plugin ] ); |
|
344 | + return isset( $all_plugins[$plugin] ); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
@@ -30,7 +30,7 @@ |
||
30 | 30 | $grid_helper = new FrmFieldGridHelper(); |
31 | 31 | $values['count'] = 0; |
32 | 32 | foreach ( $values['fields'] as $field ) { |
33 | - $values['count']++; |
|
33 | + $values['count'] ++; |
|
34 | 34 | $grid_helper->set_field( $field ); |
35 | 35 | $grid_helper->maybe_begin_field_wrapper(); |
36 | 36 | FrmFieldsController::load_single_field( $field, $values ); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | if ( in_array( $type, array( 'data', 'lookup' ) ) ) { |
27 | 27 | $values['field_options']['data_type'] = $setting; |
28 | 28 | } else { |
29 | - $values['field_options'][ $setting ] = 1; |
|
29 | + $values['field_options'][$setting] = 1; |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | foreach ( $defaults as $opt => $default ) { |
136 | - $values[ $opt ] = isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default; |
|
136 | + $values[$opt] = isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default; |
|
137 | 137 | |
138 | 138 | if ( $check_post ) { |
139 | - self::get_posted_field_setting( $opt . '_' . $field->id, $values[ $opt ] ); |
|
139 | + self::get_posted_field_setting( $opt . '_' . $field->id, $values[$opt] ); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | unset( $opt, $default ); |
@@ -180,20 +180,20 @@ discard block |
||
180 | 180 | * @param mixed $value |
181 | 181 | */ |
182 | 182 | private static function get_posted_field_setting( $setting, &$value ) { |
183 | - if ( ! isset( $_POST['field_options'][ $setting ] ) ) { |
|
183 | + if ( ! isset( $_POST['field_options'][$setting] ) ) { |
|
184 | 184 | return; |
185 | 185 | } |
186 | 186 | |
187 | 187 | if ( strpos( $setting, 'html' ) !== false ) { |
188 | 188 | // Strip slashes from HTML but not regex or script tags. |
189 | 189 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
190 | - $value = wp_unslash( $_POST['field_options'][ $setting ] ); |
|
190 | + $value = wp_unslash( $_POST['field_options'][$setting] ); |
|
191 | 191 | } elseif ( strpos( $setting, 'format_' ) === 0 ) { |
192 | 192 | // TODO: Remove stripslashes on output, and use on input only. |
193 | - $value = sanitize_text_field( $_POST['field_options'][ $setting ] ); // WPCS: sanitization ok. |
|
193 | + $value = sanitize_text_field( $_POST['field_options'][$setting] ); // WPCS: sanitization ok. |
|
194 | 194 | } else { |
195 | 195 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
196 | - $value = wp_unslash( $_POST['field_options'][ $setting ] ); |
|
196 | + $value = wp_unslash( $_POST['field_options'][$setting] ); |
|
197 | 197 | FrmAppHelper::sanitize_value( 'wp_kses_post', $value ); |
198 | 198 | } |
199 | 199 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $values['default_value'] = FrmAppHelper::maybe_json_encode( $field->default_value ); |
267 | 267 | |
268 | 268 | foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
269 | - $values[ $col ] = $field->{$col}; |
|
269 | + $values[$col] = $field->{$col}; |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | ); |
307 | 307 | |
308 | 308 | $msg = FrmField::get_option( $field, $error ); |
309 | - $msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg; |
|
309 | + $msg = empty( $msg ) ? $defaults[$error]['part'] : $msg; |
|
310 | 310 | $msg = do_shortcode( $msg ); |
311 | 311 | |
312 | 312 | return $msg; |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | } |
417 | 417 | |
418 | 418 | $base_name = 'default_value_' . $field['id']; |
419 | - $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field ); |
|
419 | + $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field ); |
|
420 | 420 | |
421 | 421 | $default_type = self::get_default_value_type( $field ); |
422 | 422 | |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | continue; |
715 | 715 | } |
716 | 716 | |
717 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
717 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] ); |
|
718 | 718 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
719 | 719 | |
720 | 720 | $atts['entry'] = $entry; |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | |
724 | 724 | if ( $replace_with !== null ) { |
725 | 725 | self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with ); |
726 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
726 | + $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
727 | 727 | } |
728 | 728 | |
729 | 729 | unset( $atts, $replace_with ); |
@@ -766,8 +766,8 @@ discard block |
||
766 | 766 | |
767 | 767 | $dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get' ); |
768 | 768 | |
769 | - if ( isset( $shortcode_values[ $atts['tag'] ] ) ) { |
|
770 | - $replace_with = $shortcode_values[ $atts['tag'] ]; |
|
769 | + if ( isset( $shortcode_values[$atts['tag']] ) ) { |
|
770 | + $replace_with = $shortcode_values[$atts['tag']]; |
|
771 | 771 | } elseif ( in_array( $atts['tag'], $dynamic_default ) ) { |
772 | 772 | $replace_with = self::dynamic_default_values( $atts['tag'], $atts ); |
773 | 773 | } elseif ( $clean_tag == 'user_agent' ) { |
@@ -978,8 +978,8 @@ discard block |
||
978 | 978 | self::field_types_for_input( $single_input, $field_selection, $field_types ); |
979 | 979 | } elseif ( in_array( $type, $multiple_input ) ) { |
980 | 980 | self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
981 | - } elseif ( isset( $field_selection[ $type ] ) ) { |
|
982 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
981 | + } elseif ( isset( $field_selection[$type] ) ) { |
|
982 | + $field_types[$type] = $field_selection[$type]; |
|
983 | 983 | } |
984 | 984 | |
985 | 985 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type', 'field_selection' ) ); |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | |
1013 | 1013 | private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
1014 | 1014 | foreach ( $inputs as $input ) { |
1015 | - $field_types[ $input ] = $fields[ $input ]; |
|
1015 | + $field_types[$input] = $fields[$input]; |
|
1016 | 1016 | unset( $input ); |
1017 | 1017 | } |
1018 | 1018 | } |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | 'parent' => false, |
1045 | 1045 | 'pointer' => false, |
1046 | 1046 | ); |
1047 | - $args = wp_parse_args( $args, $defaults ); |
|
1047 | + $args = wp_parse_args( $args, $defaults ); |
|
1048 | 1048 | |
1049 | 1049 | $opt_key = $args['opt_key']; |
1050 | 1050 | $field = $args['field']; |
@@ -1060,22 +1060,22 @@ discard block |
||
1060 | 1060 | |
1061 | 1061 | // Check posted vals before checking saved values |
1062 | 1062 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
1063 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { |
|
1063 | + if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { |
|
1064 | 1064 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
1065 | - $other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
1065 | + $other_val = isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ) : ''; |
|
1066 | 1066 | } else { |
1067 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ); |
|
1067 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ); |
|
1068 | 1068 | } |
1069 | 1069 | |
1070 | 1070 | return $other_val; |
1071 | 1071 | |
1072 | - } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { |
|
1072 | + } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { |
|
1073 | 1073 | // For normal fields |
1074 | 1074 | |
1075 | 1075 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
1076 | - $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
1076 | + $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ) : ''; |
|
1077 | 1077 | } else { |
1078 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) ); |
|
1078 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']] ) ); |
|
1079 | 1079 | } |
1080 | 1080 | |
1081 | 1081 | return $other_val; |
@@ -1085,8 +1085,8 @@ discard block |
||
1085 | 1085 | if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) { |
1086 | 1086 | // Check if there is an "other" val in saved value and make sure the |
1087 | 1087 | // "other" val is not equal to the Other checkbox option |
1088 | - if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
1089 | - $other_val = $field['value'][ $opt_key ]; |
|
1088 | + if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
1089 | + $other_val = $field['value'][$opt_key]; |
|
1090 | 1090 | } |
1091 | 1091 | } else { |
1092 | 1092 | /** |
@@ -1098,8 +1098,8 @@ discard block |
||
1098 | 1098 | // Multi-select dropdowns - key is not preserved |
1099 | 1099 | if ( is_array( $field['value'] ) ) { |
1100 | 1100 | $o_key = array_search( $temp_val, $field['value'] ); |
1101 | - if ( isset( $field['value'][ $o_key ] ) ) { |
|
1102 | - unset( $field['value'][ $o_key ], $o_key ); |
|
1101 | + if ( isset( $field['value'][$o_key] ) ) { |
|
1102 | + unset( $field['value'][$o_key], $o_key ); |
|
1103 | 1103 | } |
1104 | 1104 | } elseif ( $temp_val == $field['value'] ) { |
1105 | 1105 | // For radio and regular dropdowns |
@@ -1141,7 +1141,7 @@ discard block |
||
1141 | 1141 | return $other_args; |
1142 | 1142 | } |
1143 | 1143 | |
1144 | - $other_opt = true; |
|
1144 | + $other_opt = true; |
|
1145 | 1145 | |
1146 | 1146 | self::set_other_name( $args, $other_args ); |
1147 | 1147 | self::set_other_value( $args, $other_args ); |
@@ -1291,7 +1291,7 @@ discard block |
||
1291 | 1291 | if ( is_array( $val ) ) { |
1292 | 1292 | foreach ( $val as $k => $v ) { |
1293 | 1293 | if ( is_string( $v ) ) { |
1294 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
1294 | + $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
1295 | 1295 | unset( $k, $v ); |
1296 | 1296 | } |
1297 | 1297 | } |
@@ -1644,7 +1644,7 @@ discard block |
||
1644 | 1644 | $countries['class'] = 'frm-countries-opts'; |
1645 | 1645 | } |
1646 | 1646 | |
1647 | - $prepop[ __( 'Countries', 'formidable' ) ] = $countries; |
|
1647 | + $prepop[__( 'Countries', 'formidable' )] = $countries; |
|
1648 | 1648 | |
1649 | 1649 | // State abv. |
1650 | 1650 | $states = self::get_us_states(); |
@@ -1654,7 +1654,7 @@ discard block |
||
1654 | 1654 | $state_abv['class'] = 'frm-state-abv-opts'; |
1655 | 1655 | } |
1656 | 1656 | |
1657 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
1657 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
1658 | 1658 | |
1659 | 1659 | // States. |
1660 | 1660 | $states = array_values( $states ); |
@@ -1663,7 +1663,7 @@ discard block |
||
1663 | 1663 | $states['class'] = 'frm-states-opts'; |
1664 | 1664 | } |
1665 | 1665 | |
1666 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
1666 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
1667 | 1667 | unset( $state_abv, $states ); |
1668 | 1668 | |
1669 | 1669 | // Age. |
@@ -1681,7 +1681,7 @@ discard block |
||
1681 | 1681 | $ages['class'] = 'frm-age-opts'; |
1682 | 1682 | } |
1683 | 1683 | |
1684 | - $prepop[ __( 'Age', 'formidable' ) ] = $ages; |
|
1684 | + $prepop[__( 'Age', 'formidable' )] = $ages; |
|
1685 | 1685 | |
1686 | 1686 | // Satisfaction. |
1687 | 1687 | $satisfaction = array( |
@@ -1696,7 +1696,7 @@ discard block |
||
1696 | 1696 | $satisfaction['class'] = 'frm-satisfaction-opts'; |
1697 | 1697 | } |
1698 | 1698 | |
1699 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = $satisfaction; |
|
1699 | + $prepop[__( 'Satisfaction', 'formidable' )] = $satisfaction; |
|
1700 | 1700 | |
1701 | 1701 | // Importance. |
1702 | 1702 | $importance = array( |
@@ -1711,7 +1711,7 @@ discard block |
||
1711 | 1711 | $importance['class'] = 'frm-importance-opts'; |
1712 | 1712 | } |
1713 | 1713 | |
1714 | - $prepop[ __( 'Importance', 'formidable' ) ] = $importance; |
|
1714 | + $prepop[__( 'Importance', 'formidable' )] = $importance; |
|
1715 | 1715 | |
1716 | 1716 | // Agreement. |
1717 | 1717 | $agreement = array( |
@@ -1726,7 +1726,7 @@ discard block |
||
1726 | 1726 | $agreement['class'] = 'frm-agreement-opts'; |
1727 | 1727 | } |
1728 | 1728 | |
1729 | - $prepop[ __( 'Agreement', 'formidable' ) ] = $agreement; |
|
1729 | + $prepop[__( 'Agreement', 'formidable' )] = $agreement; |
|
1730 | 1730 | |
1731 | 1731 | // Likely. |
1732 | 1732 | $likely = array( |
@@ -1741,7 +1741,7 @@ discard block |
||
1741 | 1741 | $likely['class'] = 'frm-likely-opts'; |
1742 | 1742 | } |
1743 | 1743 | |
1744 | - $prepop[ __( 'Likely', 'formidable' ) ] = $likely; |
|
1744 | + $prepop[__( 'Likely', 'formidable' )] = $likely; |
|
1745 | 1745 | |
1746 | 1746 | $prepop = apply_filters( 'frm_bulk_field_choices', $prepop ); |
1747 | 1747 | } |
@@ -1916,16 +1916,16 @@ discard block |
||
1916 | 1916 | */ |
1917 | 1917 | private static function fill_image_setting_options( $options, &$args ) { |
1918 | 1918 | foreach ( $options as $key => $option ) { |
1919 | - $args['options'][ $key ] = $option; |
|
1919 | + $args['options'][$key] = $option; |
|
1920 | 1920 | |
1921 | 1921 | if ( ! empty( $option['addon'] ) ) { |
1922 | - $args['options'][ $key ]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
1922 | + $args['options'][$key]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
1923 | 1923 | } |
1924 | 1924 | |
1925 | - unset( $args['options'][ $key ]['addon'] ); |
|
1925 | + unset( $args['options'][$key]['addon'] ); |
|
1926 | 1926 | $fill = array( 'upgrade', 'message', 'content' ); |
1927 | 1927 | foreach ( $fill as $f ) { |
1928 | - unset( $args['options'][ $key ][ $f ], $f ); |
|
1928 | + unset( $args['options'][$key][$f], $f ); |
|
1929 | 1929 | } |
1930 | 1930 | } |
1931 | 1931 | } |
@@ -1946,8 +1946,8 @@ discard block |
||
1946 | 1946 | |
1947 | 1947 | $fill = array( 'upgrade', 'message', 'content' ); |
1948 | 1948 | foreach ( $fill as $f ) { |
1949 | - if ( isset( $option[ $f ] ) ) { |
|
1950 | - $custom_attrs[ 'data-' . $f ] = $option[ $f ]; |
|
1949 | + if ( isset( $option[$f] ) ) { |
|
1950 | + $custom_attrs['data-' . $f] = $option[$f]; |
|
1951 | 1951 | } |
1952 | 1952 | } |
1953 | 1953 |