PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.5.4
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.5.4
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/controllers/FrmXMLController.php +38 -189 6.265.5.4 View file →
@@ -4,21 +4,15 @@
4 4 }
5 5
6 6 class FrmXMLController {
7 7
8 - /**
9 - * @return void
10 - */
11 8 public static function menu() {
12 9 add_submenu_page( 'formidable', 'Formidable | ' . __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route' );
13 10 }
14 11
15 - /**
16 - * @return void
17 - */
18 12 public static function add_default_templates() {
19 13 if ( FrmXMLHelper::check_if_libxml_disable_entity_loader_exists() ) {
20 - // XML import is not enabled on your server.
14 + // XML import is not enabled on your server
21 15 return;
22 16 }
23 17
24 18 $set_err = libxml_use_internal_errors( true );
@@ -40,9 +34,8 @@
40 34 /**
41 35 * Use the template link to install the XML template
42 36 *
43 37 * @since 3.06
44 - *
45 38 * @return void
46 39 */
47 40 public static function install_template() {
48 41 FrmAppHelper::permission_check( 'frm_edit_forms' );
@@ -55,20 +48,13 @@
55 48 echo wp_json_encode( $response );
56 49 wp_die();
57 50 }
58 51
52 + $url = FrmAppHelper::get_param( 'xml', '', 'post', 'esc_url_raw' );
53 +
59 54 $form = self::get_posted_form();
60 - $url = FrmAppHelper::get_param( 'xml', '', 'post', 'esc_url_raw' );
61 55 self::override_url( $form, $url );
62 56
63 - if ( ! self::validate_xml_url( $url ) ) {
64 - $response = array(
65 - 'message' => __( 'The template you are trying to install could not be validated.', 'formidable' ),
66 - );
67 - echo wp_json_encode( $response );
68 - wp_die();
69 - }
70 -
71 57 $response = wp_remote_get( $url );
72 58 $body = wp_remote_retrieve_body( $response );
73 59 $xml = simplexml_load_string( $body );
74 60
@@ -82,9 +68,8 @@
82 68
83 69 self::set_new_form_name( $xml );
84 70
85 71 $imported = FrmXMLHelper::import_xml_now( $xml, true );
86 -
87 72 if ( ! empty( $imported['form_status'] ) ) {
88 73 // Get the last form id in case there are child forms.
89 74 end( $imported['form_status'] );
90 75 $form_id = key( $imported['form_status'] );
@@ -89,12 +74,11 @@
89 74 end( $imported['form_status'] );
90 75 $form_id = key( $imported['form_status'] );
91 76 $response = array(
92 77 'id' => $form_id,
93 - 'redirect' => FrmForm::get_edit_link( $form_id ) . '&new_template=true',
78 + 'redirect' => FrmForm::get_edit_link( $form_id ),
94 79 'success' => 1,
95 80 );
96 -
97 81 if ( ! empty( $imported['imported']['posts'] ) ) {
98 82 // Return the link to the last page created.
99 83 $pages = $imported['posts'];
100 84 }
@@ -103,10 +87,10 @@
103 87 // Create selected pages with the correct shortcodes.
104 88 $pages = self::create_pages_for_import( $form );
105 89 }
106 90
107 - if ( ! empty( $pages ) ) {
108 - $post_id = end( $pages );
91 + if ( isset( $pages ) && ! empty( $pages ) ) {
92 + $post_id = end( $pages );
109 93 $response['redirect'] = get_permalink( $post_id );
110 94 }
111 95 } else {
112 96 if ( isset( $imported['error'] ) ) {
@@ -113,19 +97,15 @@
113 97 $message = $imported['error'];
114 98 } else {
115 99 $message = __( 'There was an error importing form', 'formidable' );
116 100 }
117 -
118 101 $response = array(
119 102 'message' => $message,
120 103 );
121 104
122 - }//end if
105 + }
123 106
124 - /**
125 - * @since 6.18 Added `url` to the $args.
126 - */
127 - $response = apply_filters( 'frm_xml_response', $response, compact( 'form', 'imported', 'url' ) );
107 + $response = apply_filters( 'frm_xml_response', $response, compact( 'form', 'imported' ) );
128 108
129 109 echo wp_json_encode( $response );
130 110 wp_die();
131 111 }
@@ -130,33 +110,15 @@
130 110 wp_die();
131 111 }
132 112
133 113 /**
134 - * Make sure that the XML file we're trying to load is in fact an XML file, and that it's coming from our S3 bucket.
135 - * This is to make sure that the URL can't be exploited for a SSRF attack.
136 - *
137 - * @since 5.5.5
138 - *
139 - * @param string $url
140 - *
141 - * @return bool True on success, False on error.
142 - */
143 - private static function validate_xml_url( $url ) {
144 - return FrmAppHelper::validate_url_is_in_s3_bucket( $url, 'xml' );
145 - }
146 -
147 - /**
148 114 * @since 4.06.02
149 - *
150 - * @return mixed
151 115 */
152 116 private static function get_posted_form() {
153 117 $form = FrmAppHelper::get_param( 'form', '', 'post', 'wp_unslash' );
154 -
155 118 if ( empty( $form ) ) {
156 119 return $form;
157 120 }
158 -
159 121 $form = json_decode( $form, true );
160 122 return $form;
161 123 }
162 124
@@ -163,23 +125,16 @@
163 125 /**
164 126 * Get a different URL depending on the selection in the form.
165 127 *
166 128 * @since 4.06.02
167 - *
168 - * @param array $form The posted form values.
169 - * @param string $url The URL to override.
170 - *
171 - * @return void
172 129 */
173 130 private static function override_url( $form, &$url ) {
174 131 $selected_form = self::get_selected_in_form( $form, 'form' );
175 -
176 132 if ( empty( $selected_form ) ) {
177 133 return;
178 134 }
179 135
180 - $selected_xml = isset( $form['xml'] ) && isset( $form['xml'][ $selected_form ] ) ? $form['xml'][ $selected_form ] : '';
181 -
136 + $selected_xml = isset( $form['xml'] ) && isset( $form['xml'][ $selected_form ] ) ? $form['xml'][ $selected_form ] : '';
182 137 if ( empty( $selected_xml ) || strpos( $selected_xml, 'http' ) !== 0 ) {
183 138 return;
184 139 }
185 140
@@ -187,16 +142,11 @@
187 142 }
188 143
189 144 /**
190 145 * @since 4.06.02
191 - *
192 - * @param array $form
193 - * @param string $value
194 - *
195 - * @return string
196 146 */
197 147 private static function get_selected_in_form( $form, $value = 'form' ) {
198 - if ( ! empty( $form ) && ! empty( $form[ $value ] ) ) {
148 + if ( ! empty( $form ) && isset( $form[ $value ] ) && ! empty( $form[ $value ] ) ) {
199 149 return $form[ $value ];
200 150 }
201 151
202 152 return '';
@@ -206,20 +156,19 @@
206 156 * @since 4.06.02
207 157 *
208 158 * @param array $form The posted form values.
209 159 *
210 - * @return array|null The array of created pages.
160 + * @return array The array of created pages.
211 161 */
212 162 private static function create_pages_for_import( $form ) {
213 - if ( empty( $form['pages'] ) ) {
214 - return null;
163 + if ( ! isset( $form['pages'] ) || empty( $form['pages'] ) ) {
164 + return;
215 165 }
216 166
217 - $form_key = self::get_selected_in_form( $form, 'form' );
167 + $form_key = self::get_selected_in_form( $form, 'form' );
218 168 $view_keys = self::get_selected_in_form( $form, 'view' );
219 169
220 170 $page_ids = array();
221 -
222 171 foreach ( (array) $form['pages'] as $for => $name ) {
223 172 if ( empty( $name ) ) {
224 173 // Don't create a page if no title is given.
225 174 continue;
@@ -228,9 +177,9 @@
228 177 if ( $for === 'view' ) {
229 178 $item_key = is_array( $view_keys ) ? $view_keys[ $form_key ] : $view_keys;
230 179 $shortcode = '[display-frm-data id=%1$s filter=limited]';
231 180 } elseif ( $for === 'form' ) {
232 - $item_key = $form_key;
181 + $item_key = $form_key;
233 182 $shortcode = '[formidable id=%1$s]';
234 183 } else {
235 184 $item_key = self::get_selected_in_form( $form, 'form' );
236 185 $shortcode = '[' . esc_html( $for ) . ' id=%1$s]';
@@ -247,9 +196,9 @@
247 196 'post_type' => 'page',
248 197 'post_content' => sprintf( $shortcode, $item_key ),
249 198 )
250 199 );
251 - }//end foreach
200 + }
252 201
253 202 return $page_ids;
254 203 }
255 204
@@ -260,9 +209,8 @@
260 209 *
261 210 * @since 3.06
262 211 *
263 212 * @param object $xml The values included in the XML.
264 - *
265 213 * @return void
266 214 */
267 215 private static function set_new_form_name( &$xml ) {
268 216 if ( ! isset( $xml->form ) ) {
@@ -270,9 +218,8 @@
270 218 }
271 219
272 220 $name = FrmAppHelper::get_param( 'name', '', 'post', 'sanitize_text_field' );
273 221 $description = FrmAppHelper::get_param( 'desc', '', 'post', 'sanitize_textarea_field' );
274 -
275 222 if ( ! $name && ! $description ) {
276 223 return;
277 224 }
278 225
@@ -277,9 +224,8 @@
277 224 }
278 225
279 226 // Get the main form ID.
280 227 $set_name = 0;
281 -
282 228 foreach ( $xml->form as $form ) {
283 229 if ( empty( $form->parent_form_id ) ) {
284 230 $set_name = (int) $form->id;
285 231 }
@@ -297,11 +243,8 @@
297 243 $form->form_key = FrmAppHelper::get_unique_key( $sanitized_form_name, 'frm_forms', 'form_key' );
298 244 }
299 245 }
300 246
301 - /**
302 - * @return void
303 - */
304 247 public static function route() {
305 248 $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
306 249 $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
307 250 FrmAppHelper::include_svg();
@@ -306,22 +249,16 @@
306 249 $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
307 250 FrmAppHelper::include_svg();
308 251
309 252 if ( 'import_xml' === $action ) {
310 - self::import_xml();
253 + return self::import_xml();
311 254 } elseif ( 'export_xml' === $action ) {
312 - self::export_xml();
255 + return self::export_xml();
313 256 } elseif ( apply_filters( 'frm_xml_route', true, $action ) ) {
314 - self::form();
257 + return self::form();
315 258 }
316 259 }
317 260
318 - /**
319 - * @param string[] $errors
320 - * @param string $message
321 - *
322 - * @return void
323 - */
324 261 public static function form( $errors = array(), $message = '' ) {
325 262 $where = array(
326 263 'status' => array( null, '', 'published' ),
327 264 );
@@ -346,20 +283,16 @@
346 283 ),
347 284 );
348 285 $export_format = apply_filters( 'frm_export_formats', $export_format );
349 286
350 - include FrmAppHelper::plugin_path() . '/classes/views/xml/import_form.php';
287 + include( FrmAppHelper::plugin_path() . '/classes/views/xml/import_form.php' );
351 288 }
352 289
353 - /**
354 - * @return void
355 - */
356 290 public static function import_xml() {
357 291 $errors = array();
358 292 $message = '';
359 293
360 294 $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'import-xml', 'import-xml-nonce' );
361 -
362 295 if ( false !== $permission_error ) {
363 296 $errors[] = $permission_error;
364 297 self::form( $errors );
365 298
@@ -365,11 +298,9 @@
365 298
366 299 return;
367 300 }
368 301
369 - // phpcs:ignore WordPress.Security.NonceVerification.Missing
370 - $has_file = ! empty( $_FILES['frm_import_file'] ) && ! empty( $_FILES['frm_import_file']['name'] ) && ! empty( $_FILES['frm_import_file']['size'] ) && (int) $_FILES['frm_import_file']['size'] > 0;
371 -
302 + $has_file = isset( $_FILES ) && isset( $_FILES['frm_import_file'] ) && ! empty( $_FILES['frm_import_file']['name'] ) && ! empty( $_FILES['frm_import_file']['size'] ) && (int) $_FILES['frm_import_file']['size'] > 0;
372 303 if ( ! $has_file ) {
373 304 $errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' );
374 305 self::form( $errors );
375 306
@@ -375,9 +306,9 @@
375 306
376 307 return;
377 308 }
378 309
379 - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing
310 + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash
380 311 $file = isset( $_FILES['frm_import_file']['tmp_name'] ) ? sanitize_option( 'upload_path', $_FILES['frm_import_file']['tmp_name'] ) : '';
381 312
382 313 if ( ! is_uploaded_file( $file ) ) {
383 314 unset( $file );
@@ -386,8 +317,10 @@
386 317
387 318 return;
388 319 }
389 320
321 + //add_filter('upload_mimes', 'FrmXMLController::allow_mime');
322 +
390 323 $export_format = array(
391 324 'xml' => array(
392 325 'name' => 'XML',
393 326 'support' => 'forms',
@@ -395,12 +328,11 @@
395 328 ),
396 329 );
397 330 $export_format = apply_filters( 'frm_export_formats', $export_format );
398 331
399 - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing
332 + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash
400 333 $file_type = sanitize_option( 'upload_path', $_FILES['frm_import_file']['name'] );
401 334 $file_type = strtolower( pathinfo( $file_type, PATHINFO_EXTENSION ) );
402 -
403 335 if ( 'xml' !== $file_type && isset( $export_format[ $file_type ] ) ) {
404 336 // allow other file types to be imported
405 337 do_action( 'frm_before_import_' . $file_type );
406 338
@@ -428,14 +360,10 @@
428 360
429 361 self::form( $errors, $message );
430 362 }
431 363
432 - /**
433 - * @return void
434 - */
435 364 public static function export_xml() {
436 365 $error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' );
437 -
438 366 if ( ! empty( $error ) ) {
439 367 wp_die( esc_html( $error ) );
440 368 }
441 369
@@ -458,28 +386,13 @@
458 386
459 387 wp_die();
460 388 }
461 389
462 - /**
463 - * @param array<string>|string $type
464 - * @param array $args
465 - *
466 - * @psalm-param array{ids?: mixed} $args
467 - *
468 - * @return void
469 - */
470 390 public static function generate_xml( $type, $args = array() ) {
471 391 global $wpdb;
472 392
473 393 self::prepare_types_array( $type );
474 394
475 - if ( ! is_array( $type ) ) {
476 - // This shouldn't be possible.
477 - // It is cast to array in prepare_types_array.
478 - // This is just for static analysis.
479 - return;
480 - }
481 -
482 395 $tables = array(
483 396 'items' => $wpdb->prefix . 'frm_items',
484 397 'forms' => $wpdb->prefix . 'frm_forms',
485 398 'posts' => $wpdb->posts,
@@ -508,9 +421,9 @@
508 421 $query_vars = array();
509 422
510 423 switch ( $tb_type ) {
511 424 case 'forms':
512 - // Add forms.
425 + //add forms
513 426 if ( $args['ids'] ) {
514 427 $where[] = array(
515 428 'or' => 1,
516 429 $table . '.id' => $args['ids'],
@@ -522,9 +435,8 @@
522 435 break;
523 436 case 'actions':
524 437 $select = $table . '.ID';
525 438 $where['post_type'] = FrmFormActionsController::$action_post_type;
526 -
527 439 if ( ! empty( $args['ids'] ) ) {
528 440 $where['menu_order'] = $args['ids'];
529 441 }
530 442 break;
@@ -539,12 +451,10 @@
539 451 $frm_style = new FrmStyle();
540 452 $default_style = $frm_style->get_default_style();
541 453 $form_ids = $args['ids'];
542 454 $style_ids = array();
543 -
544 455 foreach ( $form_ids as $form_id ) {
545 456 $form_data = FrmForm::getOne( $form_id );
546 -
547 457 // For forms that have not been updated while running 2.0, check if custom_style is set.
548 458 if ( isset( $form_data->options['custom_style'] ) ) {
549 459 if ( 1 === absint( $form_data->options['custom_style'] ) ) {
550 460 $style_ids[] = $default_style->ID;
@@ -553,9 +463,8 @@
553 463 }
554 464 }
555 465 unset( $form_id, $form_data );
556 466 }
557 -
558 467 $select = $table . '.ID';
559 468 $where['post_type'] = 'frm_styles';
560 469
561 470 // Only export selected styles.
@@ -572,15 +481,15 @@
572 481 $where['pm.meta_value >'] = 1;
573 482 } else {
574 483 $where['pm.meta_value'] = $args['ids'];
575 484 }
576 - }//end switch
485 + }
577 486
578 487 $records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select );
579 488 unset( $tb_type );
580 - }//end foreach
489 + }
581 490
582 - $filename = self::get_file_name( $args, $records );
491 + $filename = self::get_file_name( $args, $type, $records );
583 492
584 493 header( 'Content-Description: File Transfer' );
585 494 header( 'Content-Disposition: attachment; filename=' . $filename );
586 495 header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
@@ -588,47 +497,16 @@
588 497 echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo( 'charset' ) ) . "\" ?>\n";
589 498 include FrmAppHelper::plugin_path() . '/classes/views/xml/xml.php';
590 499 }
591 500
592 - /**
593 - * Returns an array that has parent term slugs for the terms provided.
594 - *
595 - * @since 6.8.3
596 - *
597 - * @param array $terms
598 - *
599 - * @return array
600 - */
601 - public static function get_parent_terms_slugs( $terms ) {
602 - $parent_term_ids = array_filter( array_unique( wp_list_pluck( $terms, 'parent' ) ) );
603 - $parent_slugs = array();
604 -
605 - if ( ! $parent_term_ids ) {
606 - return $parent_slugs;
607 - }
608 -
609 - $results = FrmDb::get_results( 'terms', array( 'term_id' => $parent_term_ids ), 'term_id, slug' );
610 - $parent_slugs = wp_list_pluck( $results, 'slug', 'term_id' );
611 -
612 - return $parent_slugs;
613 - }
614 -
615 - /**
616 - * Prepare the types array.
617 - *
618 - * @param array<string>|string $type
619 - *
620 - * @return void
621 - */
622 501 private static function prepare_types_array( &$type ) {
623 502 $type = (array) $type;
624 -
625 - if ( ! in_array( 'forms', $type, true ) && ( in_array( 'items', $type, true ) || in_array( 'posts', $type, true ) ) ) {
503 + if ( ! in_array( 'forms', $type ) && ( in_array( 'items', $type ) || in_array( 'posts', $type ) ) ) {
626 504 // make sure the form is included if there are entries
627 505 $type[] = 'forms';
628 506 }
629 507
630 - if ( in_array( 'forms', $type, true ) ) {
508 + if ( in_array( 'forms', $type ) ) {
631 509 // include actions with forms
632 510 $type[] = 'actions';
633 511 }
634 512 }
@@ -638,16 +516,14 @@
638 516 * Use the nme of the form if only one form is exported.
639 517 *
640 518 * @since 3.06
641 519 *
642 - * @param array $args
520 + * @param array $type
643 521 * @param array $records
644 - *
645 522 * @return string
646 523 */
647 - private static function get_file_name( $args, $records ) {
648 - $has_one_form = ! empty( $records['forms'] ) && count( $args['ids'] ) === 1;
649 -
524 + private static function get_file_name( $args, $type, $records ) {
525 + $has_one_form = isset( $records['forms'] ) && ! empty( $records['forms'] ) && count( $args['ids'] ) === 1;
650 526 if ( $has_one_form ) {
651 527 // one form is being exported
652 528 $selected_form_id = reset( $args['ids'] );
653 529 $filename = 'form-' . $selected_form_id . '.xml';
@@ -653,13 +529,11 @@
653 529 $filename = 'form-' . $selected_form_id . '.xml';
654 530
655 531 foreach ( $records['forms'] as $form_id ) {
656 532 $filename = 'form-' . $form_id . '.xml';
657 -
658 533 if ( $selected_form_id === $form_id ) {
659 534 $form = FrmForm::getOne( $form_id );
660 - $filename = $form->name !== '' ? $form->name : $form->form_key;
661 - $filename = sanitize_title( $filename ) . '-form.xml';
535 + $filename = sanitize_title( $form->name ) . '-form.xml';
662 536 break;
663 537 }
664 538 }
665 539 } else {
@@ -667,11 +541,10 @@
667 541
668 542 if ( ! empty( $sitename ) ) {
669 543 $sitename .= '.';
670 544 }
671 -
672 545 $filename = $sitename . 'formidable.' . gmdate( 'Y-m-d' ) . '.xml';
673 - }//end if
546 + }
674 547
675 548 /**
676 549 * @since 5.3
677 550 *
@@ -679,16 +552,10 @@
679 552 */
680 553 return apply_filters( 'frm_xml_filename', $filename );
681 554 }
682 555
683 - /**
684 - * @param array $atts
685 - *
686 - * @return void
687 - */
688 556 public static function generate_csv( $atts ) {
689 557 $form_ids = $atts['ids'];
690 -
691 558 if ( empty( $form_ids ) ) {
692 559 wp_die( esc_html__( 'Please select a form', 'formidable' ) );
693 560 }
694 561 self::csv( reset( $form_ids ) );
@@ -697,14 +564,8 @@
697 564 /**
698 565 * Export to CSV
699 566 *
700 567 * @since 2.0.19
701 - *
702 - * @param false|int|string $form_id
703 - * @param string $search
704 - * @param string $fid
705 - *
706 - * @return void
707 568 */
708 569 public static function csv( $form_id = false, $search = '', $fid = '' ) {
709 570 FrmAppHelper::permission_check( 'frm_view_entries' );
710 571
@@ -713,15 +574,10 @@
713 574 $search = FrmAppHelper::get_param( ( isset( $_REQUEST['s'] ) ? 's' : 'search' ), '', 'get', 'sanitize_text_field' );
714 575 $fid = FrmAppHelper::get_param( 'fid', '', 'get', 'sanitize_text_field' );
715 576 }
716 577
717 - // Remove time limit to execute this function.
718 - if ( function_exists( 'set_time_limit' ) ) {
719 - set_time_limit( 0 );
720 - }
721 -
578 + set_time_limit( 0 ); //Remove time limit to execute this function
722 579 $mem_limit = str_replace( 'M', '', ini_get( 'memory_limit' ) );
723 -
724 580 if ( (int) $mem_limit < 256 ) {
725 581 wp_raise_memory_limit();
726 582 }
727 583
@@ -737,9 +593,8 @@
737 593 $form_id = $form->id;
738 594 $form_cols = self::get_fields_for_csv_export( $form_id, $form );
739 595
740 596 $item_id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'sanitize_text_field' );
741 -
742 597 if ( ! empty( $item_id ) ) {
743 598 $item_id = explode( ',', $item_id );
744 599 }
745 600
@@ -776,9 +631,9 @@
776 631 *
777 632 * @since 2.0.19
778 633 * @since 5.0.16 function went from private to public.
779 634 *
780 - * @param int $form_id
635 + * @param int $form_id
781 636 * @param object $form
782 637 *
783 638 * @return array $csv_fields
784 639 */
@@ -784,9 +639,8 @@
784 639 */
785 640 public static function get_fields_for_csv_export( $form_id, $form ) {
786 641 $csv_fields = FrmField::get_all_for_form( $form_id, '', 'include', 'include' );
787 642 $no_export_fields = FrmField::no_save_fields();
788 -
789 643 foreach ( $csv_fields as $k => $f ) {
790 644 if ( in_array( $f->type, $no_export_fields, true ) ) {
791 645 unset( $csv_fields[ $k ] );
792 646 }
@@ -794,13 +648,8 @@
794 648
795 649 return apply_filters( 'frm_fields_for_csv_export', $csv_fields, compact( 'form' ) );
796 650 }
797 651
798 - /**
799 - * @param array $mimes
800 - *
801 - * @return array
802 - */
803 652 public static function allow_mime( $mimes ) {
804 653 if ( ! isset( $mimes['csv'] ) ) {
805 654 // allow csv files
806 655 $mimes['csv'] = 'text/csv';