PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.13
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.13
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/helpers/FrmXMLHelper.php +21 -334 6.26.16.13 View file →
@@ -9,14 +9,8 @@
9 9 * @var bool true if importing an XML from API, false if importing an XML file manually.
10 10 */
11 11 private static $installing_template = false;
12 12
13 - /**
14 - * @param array|string $opt
15 - * @param string $padding
16 - *
17 - * @return void
18 - */
19 13 public static function get_xml_values( $opt, $padding ) {
20 14 if ( is_array( $opt ) ) {
21 15 foreach ( $opt as $ok => $ov ) {
22 16 echo "\n" . esc_html( $padding );
@@ -22,9 +16,8 @@
22 16 echo "\n" . esc_html( $padding );
23 17 $tag = ( is_numeric( $ok ) ? 'key:' : '' ) . $ok;
24 18 echo '<' . esc_html( $tag ) . '>';
25 19 self::get_xml_values( $ov, $padding . ' ' );
26 -
27 20 if ( is_array( $ov ) ) {
28 21 echo "\n" . esc_html( $padding );
29 22 }
30 23 echo '</' . esc_html( $tag ) . '>';
@@ -33,13 +26,8 @@
33 26 echo self::cdata( $opt ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
34 27 }
35 28 }
36 29
37 - /**
38 - * @param string $file
39 - *
40 - * @return array|WP_Error The items imported
41 - */
42 30 public static function import_xml( $file ) {
43 31 if ( ! defined( 'WP_IMPORTING' ) ) {
44 32 define( 'WP_IMPORTING', true );
45 33 }
@@ -61,9 +49,8 @@
61 49
62 50 // LIBXML_COMPACT activates small nodes allocation optimization.
63 51 // Use LIBXML_PARSEHUGE to avoid "parser error : internal error: Huge input lookup" for large (300MB) files.
64 52 $success = $dom->loadXML( $xml_string, LIBXML_COMPACT | LIBXML_PARSEHUGE );
65 -
66 53 if ( ! $success ) {
67 54 return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this XML file', 'formidable' ), libxml_get_errors() );
68 55 }
69 56
@@ -85,9 +72,8 @@
85 72 /**
86 73 * @since 6.2.3
87 74 *
88 75 * @param string $xml_string
89 - *
90 76 * @return void
91 77 */
92 78 private static function maybe_fix_xml( &$xml_string ) {
93 79 if ( '<?xml' !== substr( $xml_string, 0, 5 ) ) {
@@ -98,9 +84,8 @@
98 84 // The Equity theme adds a <meta name="generator" content="Equity 1.7.13" /> tag using the "the_generator" filter.
99 85 // Strip that out as it breaks the XML import.
100 86 $channel_start_position = strpos( $xml_string, '<channel>' );
101 87 $content_before_channel_tag = substr( $xml_string, 0, $channel_start_position );
102 -
103 88 if ( 0 !== strpos( $content_before_channel_tag, '<meta name="generator" ' ) ) {
104 89 $content_before_channel_tag = preg_replace(
105 90 '/<meta\s+[^>]*name="generator"[^>]*\/>/i',
106 91 '',
@@ -117,9 +102,8 @@
117 102 * @since 3.06
118 103 *
119 104 * @param object $xml
120 105 * @param bool $installing_template
121 - *
122 106 * @return array The number of items imported
123 107 */
124 108 public static function import_xml_now( $xml, $installing_template = false ) {
125 109 if ( ! defined( 'WP_IMPORTING' ) ) {
@@ -151,9 +135,8 @@
151 135 }
152 136
153 137 /**
154 138 * @since 3.06
155 - *
156 139 * @return array
157 140 */
158 141 private static function pre_import_data() {
159 142 $defaults = array(
@@ -173,14 +156,8 @@
173 156 'terms' => array(),
174 157 );
175 158 }
176 159
177 - /**
178 - * @param SimpleXMLElement $terms
179 - * @param array $imported
180 - *
181 - * @return array
182 - */
183 160 public static function import_xml_terms( $terms, $imported ) {
184 161 foreach ( $terms as $t ) {
185 162 if ( term_exists( (string) $t->term_slug, (string) $t->term_taxonomy ) ) {
186 163 continue;
@@ -210,19 +187,13 @@
210 187 }
211 188
212 189 /**
213 190 * @since 2.0.8
214 - *
215 - * @param object $t
216 - *
217 - * @return int|string
218 191 */
219 192 private static function get_term_parent_id( $t ) {
220 193 $parent = (string) $t->term_parent;
221 -
222 194 if ( ! empty( $parent ) ) {
223 195 $parent = term_exists( (string) $t->term_parent, (string) $t->term_taxonomy );
224 -
225 196 if ( $parent ) {
226 197 $parent = $parent['term_id'];
227 198 } else {
228 199 $parent = 0;
@@ -231,14 +202,8 @@
231 202
232 203 return $parent;
233 204 }
234 205
235 - /**
236 - * @param SimpleXMLElement $forms
237 - * @param array $imported
238 - *
239 - * @return array
240 - */
241 206 public static function import_xml_forms( $forms, $imported ) {
242 207 $child_forms = array();
243 208
244 209 // Import child forms first
@@ -252,9 +217,8 @@
252 217 $this_form = self::maybe_get_form( $form );
253 218
254 219 $old_id = false;
255 220 $form_fields = false;
256 -
257 221 if ( ! empty( $this_form ) ) {
258 222 $form_id = $this_form->id;
259 223 $old_id = $this_form->id;
260 224 self::update_form( $this_form, $form, $imported );
@@ -261,9 +225,8 @@
261 225
262 226 $form_fields = self::get_form_fields( $form_id );
263 227 } else {
264 228 $form_id = FrmForm::create( $form );
265 -
266 229 if ( $form_id ) {
267 230 if ( empty( $form['parent_form_id'] ) ) {
268 231 // Don't include the repeater form in the imported count.
269 232 ++$imported['imported']['forms'];
@@ -299,13 +262,8 @@
299 262
300 263 return $imported;
301 264 }
302 265
303 - /**
304 - * @param object $item
305 - *
306 - * @return array
307 - */
308 266 private static function fill_form( $item ) {
309 267 $form = array(
310 268 'id' => (int) $item->id,
311 269 'form_key' => (string) $item->form_key,
@@ -333,13 +291,8 @@
333 291
334 292 return $form;
335 293 }
336 294
337 - /**
338 - * @param array $form
339 - *
340 - * @return false|object
341 - */
342 295 private static function maybe_get_form( $form ) {
343 296 // if template, allow to edit if form keys match, otherwise, creation date must also match
344 297 $edit_query = array(
345 298 'form_key' => $form['form_key'],
@@ -344,9 +297,8 @@
344 297 $edit_query = array(
345 298 'form_key' => $form['form_key'],
346 299 'is_template' => $form['is_template'],
347 300 );
348 -
349 301 if ( ! $form['is_template'] ) {
350 302 $edit_query['created_at'] = $form['created_at'];
351 303 }
352 304
@@ -352,9 +304,8 @@
352 304
353 305 $edit_query = apply_filters( 'frm_match_xml_form', $edit_query, $form );
354 306
355 307 $form = FrmForm::getAll( $edit_query, '', 1 );
356 -
357 308 if ( is_object( $form ) && $form->status === 'trash' ) {
358 309 FrmForm::destroy( $form->id );
359 310 return false;
360 311 }
@@ -361,19 +312,11 @@
361 312
362 313 return $form;
363 314 }
364 315
365 - /**
366 - * @param object $this_form
367 - * @param array $form
368 - * @param array $imported
369 - *
370 - * @return void
371 - */
372 316 private static function update_form( $this_form, $form, &$imported ) {
373 317 $form_id = $this_form->id;
374 318 FrmForm::update( $form_id, $form );
375 -
376 319 if ( empty( $form['parent_form_id'] ) ) {
377 320 // Don't include the repeater form in the updated count.
378 321 ++$imported['updated']['forms'];
379 322 }
@@ -381,23 +324,16 @@
381 324 // Keep track of whether this specific form was updated or not
382 325 $imported['form_status'][ $form_id ] = 'updated';
383 326 }
384 327
385 - /**
386 - * @param int|string $form_id
387 - *
388 - * @return array
389 - */
390 328 private static function get_form_fields( $form_id ) {
391 329 $form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' );
392 330 $old_fields = array();
393 -
394 331 foreach ( $form_fields as $f ) {
395 332 $old_fields[ $f->id ] = $f;
396 333 $old_fields[ $f->field_key ] = $f->id;
397 334 unset( $f );
398 335 }
399 -
400 336 $form_fields = $old_fields;
401 337
402 338 return $form_fields;
403 339 }
@@ -403,12 +339,8 @@
403 339 }
404 340
405 341 /**
406 342 * Delete any fields attached to this form that were not included in the template
407 - *
408 - * @param array $form_fields
409 - *
410 - * @return void
411 343 */
412 344 private static function delete_removed_fields( $form_fields ) {
413 345 if ( ! empty( $form_fields ) ) {
414 346 foreach ( $form_fields as $field ) {
@@ -484,14 +416,8 @@
484 416 *
485 417 * @since 2.0.13
486 418 *
487 419 * TODO: Cut down on params
488 - *
489 - * @param SimpleXMLElement $xml_fields
490 - * @param int|string $form_id
491 - * @param object $this_form
492 - * @param array $form_fields
493 - * @param array $imported
494 420 */
495 421 private static function import_xml_fields( $xml_fields, $form_id, $this_form, &$form_fields, &$imported ) {
496 422 $in_section = 0;
497 423 $keys_by_original_field_id = array();
@@ -554,9 +480,8 @@
554 480 /**
555 481 * @since 6.8.4
556 482 *
557 483 * @param array $field_array
558 - *
559 484 * @return array
560 485 */
561 486 private static function update_field_options_with_defaults( $field_array ) {
562 487 $defaults = self::default_field_options( $field_array['type'] );
@@ -589,14 +514,8 @@
589 514 */
590 515 do_action( 'frm_after_existing_field_is_imported', $field_array, $form_fields[ $field_array['field_key'] ], $old_field_id );
591 516 }
592 517
593 - /**
594 - * @param object $field
595 - * @param int|string $form_id
596 - *
597 - * @return array
598 - */
599 518 private static function fill_field( $field, $form_id ) {
600 519 return array(
601 520 'id' => (int) $field->id,
602 521 'field_key' => (string) $field->field_key,
@@ -613,12 +532,8 @@
613 532 }
614 533
615 534 /**
616 535 * @since 4.06
617 - *
618 - * @param array $f
619 - *
620 - * @return void
621 536 */
622 537 private static function set_default_value( &$f ) {
623 538 $has_default = array(
624 539 'text',
@@ -645,12 +560,8 @@
645 560 /**
646 561 * Make sure the required indicator is set.
647 562 *
648 563 * @since 4.05
649 - *
650 - * @param array $f
651 - *
652 - * @return void
653 564 */
654 565 private static function maybe_add_required( &$f ) {
655 566 if ( $f['required'] && ! isset( $f['field_options']['required_indicator'] ) ) {
656 567 $f['field_options']['required_indicator'] = '*';
@@ -660,13 +571,10 @@
660 571 /**
661 572 * Update the current in_section value at the beginning of the field loop
662 573 *
663 574 * @since 2.0.25
664 - *
665 575 * @param int $in_section
666 576 * @param array $f
667 - *
668 - * @return void
669 577 */
670 578 private static function maybe_update_in_section_variable( &$in_section, &$f ) {
671 579 // If we're at the end of a section, switch $in_section is 0
672 580 if ( in_array( $f['type'], array( 'end_divider', 'break', 'form' ) ) ) {
@@ -699,9 +607,8 @@
699 607
700 608 if ( $f['type'] === 'form' || ( $f['type'] === 'divider' && FrmField::is_option_true( $f['field_options'], 'repeat' ) ) ) {
701 609 if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) {
702 610 $form_select = (int) $f['field_options']['form_select'];
703 -
704 611 if ( isset( $imported['forms'][ $form_select ] ) ) {
705 612 $f['field_options']['form_select'] = $imported['forms'][ $form_select ];
706 613 }
707 614 }
@@ -714,10 +621,8 @@
714 621 * @since 2.01.0
715 622 *
716 623 * @param array $imported
717 624 * @param array $f
718 - *
719 - * @return void
720 625 */
721 626 private static function maybe_update_get_values_form_setting( $imported, &$f ) {
722 627 if ( ! isset( $imported['forms'] ) ) {
723 628 return;
@@ -724,9 +629,8 @@
724 629 }
725 630
726 631 if ( FrmField::is_option_true_in_array( $f['field_options'], 'get_values_form' ) ) {
727 632 $old_form = $f['field_options']['get_values_form'];
728 -
729 633 if ( isset( $imported['forms'][ $old_form ] ) ) {
730 634 $f['field_options']['get_values_form'] = $imported['forms'][ $old_form ];
731 635 }
732 636 }
@@ -732,23 +636,27 @@
732 636 }
733 637 }
734 638
735 639 /**
640 + * If field settings have been migrated, update the values during import.
641 + *
736 642 * @since 4.0
737 - *
738 - * @param array $f
739 - *
740 - * @return void
741 643 */
644 + private static function run_field_migrations( &$f ) {
645 + self::migrate_placeholders( $f );
646 + $f = apply_filters( 'frm_import_xml_field', $f );
647 + }
648 +
649 + /**
650 + * @since 4.0
651 + */
742 652 private static function migrate_placeholders( &$f ) {
743 653 $update_values = self::migrate_field_placeholder( $f, 'clear_on_focus' );
744 -
745 654 foreach ( $update_values as $k => $v ) {
746 655 $f[ $k ] = $v;
747 656 }
748 657
749 658 $update_values = self::migrate_field_placeholder( $f, 'default_blank' );
750 -
751 659 foreach ( $update_values as $k => $v ) {
752 660 $f[ $k ] = $v;
753 661 }
754 662 }
@@ -757,18 +665,13 @@
757 665 * Move clear_on_focus or default_blank to placeholder.
758 666 * Also called during database migration in FrmMigrate.
759 667 *
760 668 * @since 4.0
761 - *
762 - * @param array|object $field
763 - * @param string $type
764 - *
765 669 * @return array
766 670 */
767 671 public static function migrate_field_placeholder( $field, $type ) {
768 672 $field = (array) $field;
769 673 $field_options = $field['field_options'];
770 -
771 674 if ( empty( $field_options[ $type ] ) || empty( $field['default_value'] ) ) {
772 675 return array();
773 676 }
774 677
@@ -781,12 +684,10 @@
781 684 );
782 685
783 686 // If a dropdown placeholder was used, remove the option so it won't be included twice.
784 687 $options = $field['options'];
785 -
786 688 if ( $type === 'default_blank' && is_array( $options ) ) {
787 689 $default_value = $field['default_value'];
788 -
789 690 if ( is_array( $default_value ) ) {
790 691 $default_value = reset( $default_value );
791 692 }
792 693
@@ -791,9 +692,9 @@
791 692 }
792 693
793 694 foreach ( $options as $opt_key => $opt ) {
794 695 if ( is_array( $opt ) ) {
795 - $opt = $opt['value'] ?? $opt['label'] ?? reset( $opt );
696 + $opt = isset( $opt['value'] ) ? $opt['value'] : ( isset( $opt['label'] ) ? $opt['label'] : reset( $opt ) );
796 697 }
797 698
798 699 if ( $opt == $default_value ) {
799 700 unset( $options[ $opt_key ] );
@@ -812,10 +713,8 @@
812 713 * @since 2.0.25
813 714 *
814 715 * @param array $f
815 716 * @param array $imported
816 - *
817 - * @return void
818 717 */
819 718 private static function create_imported_field( $f, &$imported ) {
820 719 $f = self::update_field_options_with_defaults( $f );
821 720
@@ -823,9 +722,8 @@
823 722 $f = self::maybe_import_images_for_options( $f );
824 723 }
825 724
826 725 $new_id = FrmField::create( $f );
827 -
828 726 if ( $new_id != false ) {
829 727 ++$imported['imported']['fields'];
830 728 do_action( 'frm_after_field_is_imported', $f, $new_id );
831 729 }
@@ -836,9 +734,8 @@
836 734 *
837 735 * @since 5.5.1
838 736 *
839 737 * @param array $field
840 - *
841 738 * @return array
842 739 */
843 740 private static function maybe_import_images_for_options( $field ) {
844 741 if ( empty( $field['options'] ) || ! is_array( $field['options'] ) ) {
@@ -869,13 +766,10 @@
869 766 /**
870 767 * Fix field ids for fields that already exist prior to import.
871 768 *
872 769 * @since 4.07
873 - *
874 770 * @param int $form_id
875 771 * @param array $keys_by_original_field_id
876 - *
877 - * @return void
878 772 */
879 773 protected static function maybe_update_field_ids( $form_id, $keys_by_original_field_id ) {
880 774 global $frm_duplicate_ids;
881 775
@@ -915,10 +809,8 @@
915 809 *
916 810 * @since 2.0.19
917 811 *
918 812 * @param array $form
919 - *
920 - * @return void
921 813 */
922 814 private static function update_custom_style_setting_on_import( &$form ) {
923 815 if ( ! isset( $form['options']['custom_style'] ) ) {
924 816 return;
@@ -954,12 +846,8 @@
954 846 * After styles are imported, check for any forms that were linked
955 847 * and link them back up.
956 848 *
957 849 * @since 2.2.7
958 - *
959 - * @param int|string $form_id
960 - *
961 - * @return void
962 850 */
963 851 private static function update_custom_style_setting_after_import( $form_id ) {
964 852 $form = FrmForm::getOne( $form_id );
965 853
@@ -968,9 +856,8 @@
968 856 $saved_style = $form['options']['custom_style'];
969 857 $form['options']['custom_style'] = $form['options']['old_style'];
970 858 self::update_custom_style_setting_on_import( $form );
971 859 $has_changed = ( $form['options']['custom_style'] != $saved_style && $form['options']['custom_style'] != $form['options']['old_style'] );
972 -
973 860 if ( $has_changed ) {
974 861 FrmForm::update( $form['id'], $form );
975 862 }
976 863 }
@@ -975,16 +862,8 @@
975 862 }
976 863 }
977 864 }
978 865
979 - /**
980 - * Handle import for all posts. This includes views, styles, pages, and form actions.
981 - *
982 - * @param SimpleXMLElement $views
983 - * @param array $imported
984 - *
985 - * @return array
986 - */
987 866 public static function import_xml_views( $views, $imported ) {
988 867 $imported['posts'] = array();
989 868 $form_action_type = FrmFormActionsController::$action_post_type;
990 869
@@ -1022,13 +901,8 @@
1022 901 );
1023 902
1024 903 $post['post_content'] = self::switch_form_ids( $post['post_content'], $imported['forms'] );
1025 904
1026 - // Fix issue with line breaks appearing in descriptions as "rn".
1027 - if ( $post['post_type'] === $form_action_type ) {
1028 - $post['post_content'] = str_replace( '\\\\r\\\\n', '\\r\\n', $post['post_content'] );
1029 - }
1030 -
1031 905 $old_id = $post['post_id'];
1032 906 self::populate_post( $post, $item, $imported );
1033 907
1034 908 unset( $item );
@@ -1033,13 +907,11 @@
1033 907
1034 908 unset( $item );
1035 909
1036 910 $post_id = false;
1037 -
1038 911 if ( $post['post_type'] === $form_action_type ) {
1039 912 $action_control = FrmFormActionsController::get_form_actions( $post['post_excerpt'] );
1040 -
1041 - if ( $action_control && is_object( $action_control ) && isset( $imported['form_status'] ) ) {
913 + if ( $action_control && is_object( $action_control ) ) {
1042 914 $post_id = $action_control->maybe_create_action( $post, $imported['form_status'] );
1043 915 }
1044 916 unset( $action_control );
1045 917 } elseif ( $post['post_type'] === 'frm_styles' ) {
@@ -1045,10 +917,8 @@
1045 917 } elseif ( $post['post_type'] === 'frm_styles' ) {
1046 918 // Properly encode post content before inserting the post
1047 919 $post['post_content'] = FrmAppHelper::maybe_json_decode( $post['post_content'] );
1048 920 $post['post_content'] = FrmAppHelper::prepare_and_encode( $post['post_content'] );
1049 - // Store template data additionally to a postmeta that can be used to revert the style to default template style.
1050 - $post['postmeta']['frm_style_default'] = $post['post_content'];
1051 921
1052 922 // Create/update post now
1053 923 $post_id = wp_insert_post( $post );
1054 924 } else {
@@ -1072,9 +942,8 @@
1072 942 self::update_postmeta( $post, $post_id );
1073 943 self::update_layout( $post, $post_id );
1074 944
1075 945 $this_type = 'posts';
1076 -
1077 946 if ( isset( $post_types[ $post['post_type'] ] ) ) {
1078 947 $this_type = $post_types[ $post['post_type'] ];
1079 948 }
1080 949
@@ -1115,10 +984,8 @@
1115 984 /**
1116 985 * Clears styles from cache for imported forms
1117 986 *
1118 987 * @param array $imported_forms
1119 - *
1120 - * @return void
1121 988 */
1122 989 private static function clear_forms_style_caches( $imported_forms ) {
1123 990 $where = array(
1124 991 'id' => $imported_forms,
@@ -1127,13 +994,11 @@
1127 994 $forms = FrmDb::get_results( 'frm_forms', $where );
1128 995
1129 996 foreach ( $forms as $form ) {
1130 997 FrmAppHelper::unserialize_or_decode( $form->options );
1131 -
1132 998 if ( ! $form->options ) {
1133 999 continue;
1134 1000 }
1135 -
1136 1001 $where = array(
1137 1002 'post_name' => $form->options['old_style'],
1138 1003 'post_type' => FrmStylesController::$post_type,
1139 1004 );
@@ -1149,9 +1014,8 @@
1149 1014 * Replace old form ids with new ones in a string.
1150 1015 *
1151 1016 * @param string $string
1152 1017 * @param array<int> $form_ids new form ids indexed by old form id.
1153 - *
1154 1018 * @return string
1155 1019 */
1156 1020 private static function switch_form_ids( $string, $form_ids ) {
1157 1021 if ( false === strpos( $string, '[formidable' ) ) {
@@ -1182,15 +1046,13 @@
1182 1046
1183 1047 /**
1184 1048 * @param array<array> $posts_with_shortcodes indexed by current post id.
1185 1049 * @param array<int> $view_ids new view ids indexed by old view id.
1186 - *
1187 1050 * @return void
1188 1051 */
1189 1052 private static function maybe_switch_view_ids_after_importing_posts( $posts_with_shortcodes, $view_ids ) {
1190 1053 foreach ( $posts_with_shortcodes as $imported_post_id => $post ) {
1191 1054 $post_content = self::switch_view_ids( $post['post_content'], $view_ids );
1192 -
1193 1055 if ( $post_content === $post['post_content'] ) {
1194 1056 continue;
1195 1057 }
1196 1058
@@ -1207,9 +1069,8 @@
1207 1069 * Replace old view ids with new ones in a string.
1208 1070 *
1209 1071 * @param string $string
1210 1072 * @param array<int> $view_ids new view ids indexed by old view id.
1211 - *
1212 1073 * @return string
1213 1074 */
1214 1075 private static function switch_view_ids( $string, $view_ids ) {
1215 1076 if ( false === strpos( $string, '[display-frm-data' ) ) {
@@ -1240,14 +1101,12 @@
1240 1101 }
1241 1102
1242 1103 /**
1243 1104 * @param string $content
1244 - *
1245 1105 * @return string
1246 1106 */
1247 1107 private static function maybe_prepare_json_view_content( $content ) {
1248 1108 $maybe_decoded = FrmAppHelper::maybe_json_decode( $content );
1249 -
1250 1109 if ( is_array( $maybe_decoded ) && isset( $maybe_decoded[0] ) && isset( $maybe_decoded[0]['box'] ) ) {
1251 1110 return FrmAppHelper::prepare_and_encode( $maybe_decoded );
1252 1111 }
1253 1112 return $content;
@@ -1252,15 +1111,8 @@
1252 1111 }
1253 1112 return $content;
1254 1113 }
1255 1114
1256 - /**
1257 - * @param array $post
1258 - * @param object $item
1259 - * @param array $imported
1260 - *
1261 - * @return void
1262 - */
1263 1115 private static function populate_post( &$post, $item, $imported ) {
1264 1116 if ( isset( $item->attachment_url ) ) {
1265 1117 $post['attachment_url'] = (string) $item->attachment_url;
1266 1118 }
@@ -1336,20 +1188,9 @@
1336 1188 }
1337 1189 }
1338 1190 }
1339 1191
1340 - if ( ! empty( $m['value']['timeline_options'] ) ) {
1341 - foreach ( $m['value']['timeline_options'] as $timeline_option_group_key => $timeline_group_option ) {
1342 - foreach ( $timeline_group_option as $timeline_option_key => $timeline_option ) {
1343 - if ( isset( $frm_duplicate_ids[ $timeline_option ] ) ) {
1344 - $m['value']['timeline_options'][ $timeline_option_group_key ][ $timeline_option_key ] = $frm_duplicate_ids[ $timeline_option ];
1345 - }
1346 - }
1347 - }
1348 - }
1349 -
1350 1192 $check_dup_array = array();
1351 -
1352 1193 if ( ! empty( $m['value']['order_by'] ) ) {
1353 1194 if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) {
1354 1195 $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ];
1355 1196 } elseif ( is_array( $m['value']['order_by'] ) ) {
@@ -1379,14 +1220,8 @@
1379 1220
1380 1221 $post['postmeta'][ (string) $meta->meta_key ] = $m['value'];
1381 1222 }
1382 1223
1383 - /**
1384 - * @param array $post
1385 - * @param object $layout
1386 - *
1387 - * @return void
1388 - */
1389 1224 private static function populate_layout( &$post, $layout ) {
1390 1225 $post['layout'][ (string) $layout->type ] = (string) $layout->data;
1391 1226 }
1392 1227
@@ -1398,19 +1233,16 @@
1398 1233 */
1399 1234 private static function populate_taxonomies( &$post, $item ) {
1400 1235 foreach ( $item->category as $c ) {
1401 1236 $att = $c->attributes();
1402 -
1403 1237 if ( ! isset( $att['nicename'] ) ) {
1404 1238 continue;
1405 1239 }
1406 1240
1407 1241 $taxonomy = (string) $att['domain'];
1408 -
1409 1242 if ( is_taxonomy_hierarchical( $taxonomy ) ) {
1410 1243 $name = (string) $att['nicename'];
1411 1244 $h_term = get_term_by( 'slug', $name, $taxonomy );
1412 -
1413 1245 if ( $h_term ) {
1414 1246 $name = $h_term->term_id;
1415 1247 }
1416 1248 unset( $h_term );
@@ -1427,13 +1259,9 @@
1427 1259 }//end foreach
1428 1260 }
1429 1261
1430 1262 /**
1431 - * Edit post if the key and created time match.
1432 - *
1433 - * @param array $post By reference.
1434 - *
1435 - * @return void
1263 + * Edit post if the key and created time match
1436 1264 */
1437 1265 private static function maybe_editing_post( &$post ) {
1438 1266 $match_by = array(
1439 1267 'post_type' => $post['post_type'],
@@ -1441,9 +1269,9 @@
1441 1269 'post_status' => $post['post_status'],
1442 1270 'posts_per_page' => 1,
1443 1271 );
1444 1272
1445 - if ( in_array( $post['post_status'], array( 'trash', 'draft' ), true ) ) {
1273 + if ( in_array( $post['post_status'], array( 'trash', 'draft' ) ) ) {
1446 1274 $match_by['include'] = $post['post_id'];
1447 1275 unset( $match_by['name'] );
1448 1276 }
1449 1277
@@ -1457,9 +1285,8 @@
1457 1285
1458 1286 /**
1459 1287 * @param array $post
1460 1288 * @param int $post_id
1461 - *
1462 1289 * @return void
1463 1290 */
1464 1291 private static function update_postmeta( &$post, $post_id ) {
1465 1292 foreach ( $post['postmeta'] as $k => $v ) {
@@ -1499,9 +1326,8 @@
1499 1326 private static function update_layout( &$post, $post_id ) {
1500 1327 if ( is_callable( 'FrmViewsLayout::maybe_create_layouts_for_view' ) ) {
1501 1328 $listing_layout = ! empty( $post['layout']['listing'] ) ? json_decode( $post['layout']['listing'], true ) : array();
1502 1329 $detail_layout = ! empty( $post['layout']['detail'] ) ? json_decode( $post['layout']['detail'], true ) : array();
1503 -
1504 1330 if ( $listing_layout || $detail_layout ) {
1505 1331 FrmViewsLayout::maybe_create_layouts_for_view( $post_id, $listing_layout, $detail_layout );
1506 1332 }
1507 1333 }
@@ -1506,23 +1332,16 @@
1506 1332 }
1507 1333 }
1508 1334 }
1509 1335
1510 - /**
1511 - * @param array $imported
1512 - *
1513 - * @return void
1514 - */
1515 1336 private static function maybe_update_stylesheet( $imported ) {
1516 1337 $new_styles = ! empty( $imported['imported']['styles'] );
1517 1338 $updated_styles = ! empty( $imported['updated']['styles'] );
1518 -
1519 1339 if ( $new_styles || $updated_styles ) {
1520 1340 if ( is_admin() && function_exists( 'get_filesystem_method' ) ) {
1521 1341 $frm_style = new FrmStyle();
1522 1342 $frm_style->update( 'default' );
1523 1343 }
1524 -
1525 1344 foreach ( $imported['forms'] as $form_id ) {
1526 1345 self::update_custom_style_setting_after_import( $form_id );
1527 1346 }
1528 1347 }
@@ -1540,15 +1359,13 @@
1540 1359 // Remove the SimpleXML_parse_error from the WP_Error object to avoid
1541 1360 // displaying duplicate error messages from $result->get_error_message()
1542 1361 $error_codes = $result->get_error_codes();
1543 1362 $error_details = array();
1544 -
1545 1363 foreach ( $error_codes as $error_code ) {
1546 1364 // Clone WP_Error data because WP_Error removes all error messages and data
1547 1365 // associated with the specified error code when an item is removed.
1548 1366 // Source: https://developer.wordpress.org/reference/classes/wp_error/remove/#source
1549 1367 $error_details = $result->get_error_data( $error_code );
1550 -
1551 1368 if ( $error_code === 'SimpleXML_parse_error' ) {
1552 1369 $result->remove( $error_code );
1553 1370 break;
1554 1371 }
@@ -1575,9 +1392,8 @@
1575 1392 'updated' => __( 'Updated', 'formidable' ),
1576 1393 );
1577 1394
1578 1395 $message = '<ul>';
1579 -
1580 1396 foreach ( $result as $type => $results ) {
1581 1397 if ( ! isset( $t_strings[ $type ] ) ) {
1582 1398 // only print imported and updated
1583 1399 continue;
@@ -1583,9 +1399,8 @@
1583 1399 continue;
1584 1400 }
1585 1401
1586 1402 $s_message = array();
1587 -
1588 1403 foreach ( $results as $k => $m ) {
1589 1404 self::item_count_message( $m, $k, $s_message );
1590 1405 unset( $k, $m );
1591 1406 }
@@ -1663,21 +1478,18 @@
1663 1478 /**
1664 1479 * If a single form was imported, include a link in the success message.
1665 1480 *
1666 1481 * @since 4.0
1667 - *
1668 1482 * @param array $result The response from the XML import.
1669 1483 * @param string $message The response shown on the page after import.
1670 1484 */
1671 1485 private static function add_form_link_to_message( $result, &$message ) {
1672 1486 $total_forms = $result['imported']['forms'] + $result['updated']['forms'];
1673 -
1674 1487 if ( $total_forms > 1 ) {
1675 1488 return;
1676 1489 }
1677 1490
1678 1491 $primary_form = reset( $result['forms'] );
1679 -
1680 1492 if ( ! empty( $primary_form ) ) {
1681 1493 $primary_form = FrmForm::getOne( $primary_form );
1682 1494 $form_id = empty( $primary_form->parent_form_id ) ? $primary_form->id : $primary_form->parent_form_id;
1683 1495
@@ -1697,9 +1509,8 @@
1697 1509 public static function prepare_form_options_for_export( $options ) {
1698 1510 FrmAppHelper::unserialize_or_decode( $options );
1699 1511 // Change custom_style to the post_name instead of ID (1 may be a string)
1700 1512 $not_default = isset( $options['custom_style'] ) && 1 != $options['custom_style'];
1701 -
1702 1513 if ( $not_default ) {
1703 1514 global $wpdb;
1704 1515 $table = $wpdb->prefix . 'posts';
1705 1516 $where = array( 'ID' => $options['custom_style'] );
@@ -1723,16 +1534,11 @@
1723 1534 * If the saved value is the same as the default, remove it from the export
1724 1535 * This keeps file size down and prevents overriding global settings after import
1725 1536 *
1726 1537 * @since 3.06
1727 - *
1728 - * @param array $options By reference.
1729 - *
1730 - * @return void
1731 1538 */
1732 1539 private static function remove_default_form_options( &$options ) {
1733 1540 $defaults = FrmFormsHelper::get_default_opts();
1734 -
1735 1541 if ( is_callable( 'FrmProFormsHelper::get_default_opts' ) ) {
1736 1542 $defaults += FrmProFormsHelper::get_default_opts();
1737 1543 }
1738 1544 self::remove_defaults( $defaults, $options );
@@ -1741,12 +1547,8 @@
1741 1547 /**
1742 1548 * Remove extra settings from field to keep file size down
1743 1549 *
1744 1550 * @since 3.06
1745 - *
1746 - * @param object $field
1747 - *
1748 - * @return void
1749 1551 */
1750 1552 public static function prepare_field_for_export( &$field ) {
1751 1553 self::remove_default_field_options( $field );
1752 1554 self::add_image_src_to_image_options( $field );
@@ -1755,16 +1557,11 @@
1755 1557 /**
1756 1558 * Remove defaults from field options too
1757 1559 *
1758 1560 * @since 3.06
1759 - *
1760 - * @param object $field
1761 - *
1762 - * @return void
1763 1561 */
1764 1562 private static function remove_default_field_options( &$field ) {
1765 1563 $defaults = self::default_field_options( $field->type );
1766 -
1767 1564 if ( empty( $defaults['blank'] ) ) {
1768 1565 $global_settings = new FrmSettings();
1769 1566 $global_defaults = $global_settings->default_options();
1770 1567 $defaults['blank'] = $global_defaults['blank_msg'];
@@ -1792,9 +1589,8 @@
1792 1589 *
1793 1590 * @since 5.5.1
1794 1591 *
1795 1592 * @param stdClass $field
1796 - *
1797 1593 * @return void
1798 1594 */
1799 1595 private static function add_image_src_to_image_options( $field ) {
1800 1596 if ( empty( $field->options ) || false === strpos( $field->options, 'image' ) ) {
@@ -1822,16 +1618,11 @@
1822 1618 }
1823 1619
1824 1620 /**
1825 1621 * @since 3.06.03
1826 - *
1827 - * @param string $type
1828 - *
1829 - * @return array
1830 1622 */
1831 1623 private static function default_field_options( $type ) {
1832 1624 $defaults = FrmFieldsHelper::get_default_field_options( $type );
1833 -
1834 1625 if ( empty( $defaults['custom_html'] ) ) {
1835 1626 $defaults['custom_html'] = FrmFieldsHelper::get_default_html( $type );
1836 1627 }
1837 1628 return $defaults;
@@ -1841,13 +1632,8 @@
1841 1632 * Compare the default array to the saved values and
1842 1633 * remove if they are the same
1843 1634 *
1844 1635 * @since 3.06
1845 - *
1846 - * @param array $defaults
1847 - * @param array $saved
1848 - *
1849 - * @return void
1850 1636 */
1851 1637 private static function remove_defaults( $defaults, &$saved ) {
1852 1638 foreach ( $saved as $key => $value ) {
1853 1639 if ( isset( $defaults[ $key ] ) && $defaults[ $key ] === $value ) {
@@ -1859,14 +1645,8 @@
1859 1645 /**
1860 1646 * The line endings may prevent html from being equal when it should
1861 1647 *
1862 1648 * @since 3.06
1863 - *
1864 - * @param string $html_name
1865 - * @param array $defaults
1866 - * @param array $options
1867 - *
1868 - * @return void
1869 1649 */
1870 1650 private static function remove_default_html( $html_name, $defaults, &$options ) {
1871 1651 if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) {
1872 1652 return;
@@ -1873,9 +1653,8 @@
1873 1653 }
1874 1654
1875 1655 $old_html = str_replace( "\r\n", "\n", $options[ $html_name ] );
1876 1656 $default_html = $defaults[ $html_name ];
1877 -
1878 1657 if ( $old_html == $default_html ) {
1879 1658 unset( $options[ $html_name ] );
1880 1659
1881 1660 return;
@@ -1882,25 +1661,18 @@
1882 1661 }
1883 1662
1884 1663 // Account for some of the older field default HTML.
1885 1664 $default_html = str_replace( ' id="frm_desc_field_[key]"', '', $default_html );
1886 -
1887 - if ( $old_html === $default_html ) {
1665 + if ( $old_html == $default_html ) {
1888 1666 unset( $options[ $html_name ] );
1889 1667 }
1890 1668 }
1891 1669
1892 - /**
1893 - * @param string $str
1894 - *
1895 - * @return string
1896 - */
1897 1670 public static function cdata( $str ) {
1898 1671 FrmAppHelper::unserialize_or_decode( $str );
1899 -
1900 1672 if ( is_array( $str ) ) {
1901 1673 $str = json_encode( $str );
1902 - } elseif ( FrmAppHelper::is_valid_utf8( $str ) === false ) {
1674 + } elseif ( seems_utf8( $str ) === false ) {
1903 1675 $str = FrmAppHelper::maybe_utf8_encode( $str );
1904 1676 }
1905 1677
1906 1678 if ( is_numeric( $str ) ) {
@@ -1920,10 +1692,8 @@
1920 1692 *
1921 1693 * @since 2.0.22
1922 1694 *
1923 1695 * @param string $str
1924 - *
1925 - * @return void
1926 1696 */
1927 1697 private static function remove_invalid_characters_from_xml( &$str ) {
1928 1698 // Remove <US> character
1929 1699 $str = str_replace( '\x1F', '', $str );
@@ -1928,18 +1698,8 @@
1928 1698 // Remove <US> character
1929 1699 $str = str_replace( '\x1F', '', $str );
1930 1700 }
1931 1701
1932 - /**
1933 - * Migrate form settings to actions
1934 - *
1935 - * @param array $form_options
1936 - * @param int $form_id
1937 - * @param array $imported
1938 - * @param bool $switch
1939 - *
1940 - * @return void
1941 - */
1942 1702 public static function migrate_form_settings_to_actions( $form_options, $form_id, &$imported = array(), $switch = false ) {
1943 1703 // Get post type
1944 1704 $post_type = FrmFormActionsController::$action_post_type;
1945 1705
@@ -2078,19 +1838,8 @@
2078 1838
2079 1839 return $post_content;
2080 1840 }
2081 1841
2082 - /**
2083 - * Migrate email settings to action
2084 - *
2085 - * @param array $form_options
2086 - * @param int $form_id
2087 - * @param string $post_type
2088 - * @param array $imported
2089 - * @param bool $switch
2090 - *
2091 - * @return void
2092 - */
2093 1842 private static function migrate_email_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) {
2094 1843 // No old notifications or autoresponders to carry over
2095 1844 if ( ! isset( $form_options['auto_responder'] ) && ! isset( $form_options['notification'] ) && ! isset( $form_options['email_to'] ) ) {
2096 1845 return;
@@ -2152,14 +1901,11 @@
2152 1901 * @since 2.05
2153 1902 *
2154 1903 * @param int|string $form_id
2155 1904 * @param array $form_options
2156 - *
2157 - * @return void
2158 1905 */
2159 1906 private static function remove_deprecated_notification_settings( $form_id, $form_options ) {
2160 1907 $delete_settings = array( 'notification', 'autoresponder', 'email_to' );
2161 -
2162 1908 foreach ( $delete_settings as $index ) {
2163 1909 if ( isset( $form_options[ $index ] ) ) {
2164 1910 unset( $form_options[ $index ] );
2165 1911 }
@@ -2166,17 +1912,8 @@
2166 1912 }
2167 1913 FrmForm::update( $form_id, array( 'options' => $form_options ) );
2168 1914 }
2169 1915
2170 - /**
2171 - * Migrate notifications to action
2172 - *
2173 - * @param array $form_options
2174 - * @param int $form_id
2175 - * @param array $notifications
2176 - *
2177 - * @return void
2178 - */
2179 1916 private static function migrate_notifications_to_action( $form_options, $form_id, &$notifications ) {
2180 1917 if ( ! isset( $form_options['notification'] ) && ! empty( $form_options['email_to'] ) ) {
2181 1918 // add old settings into notification array
2182 1919 $form_options['notification'] = array( 0 => $form_options );
@@ -2212,16 +1949,8 @@
2212 1949 }//end foreach
2213 1950 }//end if
2214 1951 }
2215 1952
2216 - /**
2217 - * Format email data
2218 - *
2219 - * @param array $atts
2220 - * @param array $notification
2221 - *
2222 - * @return void
2223 - */
2224 1953 private static function format_email_data( &$atts, $notification ) {
2225 1954 // Format email_to
2226 1955 self::format_email_to_data( $atts, $notification );
2227 1956
@@ -2229,13 +1958,11 @@
2229 1958 $reply_fields = array(
2230 1959 'reply_to' => '',
2231 1960 'reply_to_name' => '',
2232 1961 );
2233 -
2234 1962 foreach ( $reply_fields as $f => $val ) {
2235 1963 if ( isset( $notification[ $f ] ) ) {
2236 1964 $atts[ $f ] = $notification[ $f ];
2237 -
2238 1965 if ( 'custom' == $notification[ $f ] ) {
2239 1966 $atts[ $f ] = $notification[ 'cust_' . $f ];
2240 1967 } elseif ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) {
2241 1968 $atts[ $f ] = '[' . $atts[ $f ] . ']';
@@ -2245,9 +1972,8 @@
2245 1972 }
2246 1973
2247 1974 // Format event
2248 1975 $atts['event'] = array( 'create' );
2249 -
2250 1976 if ( isset( $notification['update_email'] ) && 1 == $notification['update_email'] ) {
2251 1977 $atts['event'][] = 'update';
2252 1978 } elseif ( isset( $notification['update_email'] ) && 2 == $notification['update_email'] ) {
2253 1979 $atts['event'] = array( 'update' );
@@ -2253,16 +1979,8 @@
2253 1979 $atts['event'] = array( 'update' );
2254 1980 }
2255 1981 }
2256 1982
2257 - /**
2258 - * Format email_to data
2259 - *
2260 - * @param array $atts
2261 - * @param array $notification
2262 - *
2263 - * @return void
2264 - */
2265 1983 private static function format_email_to_data( &$atts, $notification ) {
2266 1984 if ( isset( $notification['email_to'] ) ) {
2267 1985 $atts['email_to'] = preg_split( '/ (,|;) /', $notification['email_to'] );
2268 1986 } else {
@@ -2282,9 +2000,8 @@
2282 2000 }
2283 2001
2284 2002 if ( strpos( $email_field, '|' ) ) {
2285 2003 $email_opt = explode( '|', $email_field );
2286 -
2287 2004 if ( isset( $email_opt[0] ) ) {
2288 2005 $atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']';
2289 2006 }
2290 2007 unset( $email_opt );
@@ -2292,17 +2009,8 @@
2292 2009 }
2293 2010 $atts['email_to'] = implode( ', ', $atts['email_to'] );
2294 2011 }
2295 2012
2296 - /**
2297 - * Setup new notification
2298 - *
2299 - * @param array $new_notification
2300 - * @param array $notification
2301 - * @param array $atts
2302 - *
2303 - * @return void
2304 - */
2305 2013 private static function setup_new_notification( &$new_notification, $notification, $atts ) {
2306 2014 // Set up new notification
2307 2015 $new_notification = array(
2308 2016 'post_content' => array(
@@ -2313,9 +2021,8 @@
2313 2021 );
2314 2022
2315 2023 // Add more fields to the new notification
2316 2024 $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' );
2317 -
2318 2025 foreach ( $add_fields as $add_field ) {
2319 2026 if ( isset( $notification[ $add_field ] ) ) {
2320 2027 $new_notification['post_content'][ $add_field ] = $notification[ $add_field ];
2321 2028 } elseif ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) {
@@ -2338,10 +2045,8 @@
2338 2045 /**
2339 2046 * Switch field IDs in pre-2.0 email conditional logic
2340 2047 *
2341 2048 * @param array $post_content Pass by reference.
2342 - *
2343 - * @return void
2344 2049 */
2345 2050 private static function switch_email_condition_field_ids( &$post_content ) {
2346 2051 // Switch field IDs in conditional logic
2347 2052 if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) {
@@ -2353,32 +2058,20 @@
2353 2058 }
2354 2059 }
2355 2060 }
2356 2061
2357 - /**
2358 - * Migrate autoresponder to action
2359 - *
2360 - * @param array $form_options
2361 - * @param int $form_id
2362 - * @param array $notifications
2363 - *
2364 - * @return void
2365 - */
2366 2062 private static function migrate_autoresponder_to_action( $form_options, $form_id, &$notifications ) {
2367 2063 if ( isset( $form_options['auto_responder'] ) && $form_options['auto_responder'] && isset( $form_options['ar_email_message'] ) && $form_options['ar_email_message'] ) {
2368 2064 // migrate autoresponder
2369 2065
2370 - $email_field = $form_options['ar_email_to'] ?? 0;
2371 -
2066 + $email_field = isset( $form_options['ar_email_to'] ) ? $form_options['ar_email_to'] : 0;
2372 2067 if ( strpos( $email_field, '|' ) ) {
2373 2068 // data from entries field
2374 2069 $email_field = explode( '|', $email_field );
2375 -
2376 2070 if ( isset( $email_field[1] ) ) {
2377 2071 $email_field = $email_field[1];
2378 2072 }
2379 2073 }
2380 -
2381 2074 if ( is_numeric( $email_field ) && ! empty( $email_field ) ) {
2382 2075 $email_field = '[' . $email_field . ']';
2383 2076 }
2384 2077
@@ -2385,18 +2078,18 @@
2385 2078 $notification = $form_options;
2386 2079 $new_notification2 = array(
2387 2080 'post_content' => array(
2388 2081 'email_message' => $notification['ar_email_message'],
2389 - 'email_subject' => $notification['ar_email_subject'] ?? '',
2082 + 'email_subject' => isset( $notification['ar_email_subject'] ) ? $notification['ar_email_subject'] : '',
2390 2083 'email_to' => $email_field,
2391 - 'plain_text' => $notification['ar_plain_text'] ?? 0,
2084 + 'plain_text' => isset( $notification['ar_plain_text'] ) ? $notification['ar_plain_text'] : 0,
2392 2085 'inc_user_info' => 0,
2393 2086 ),
2394 2087 'post_name' => $form_id . '_email_' . count( $notifications ),
2395 2088 );
2396 2089
2397 - $reply_to = $notification['ar_reply_to'] ?? '';
2398 - $reply_to_name = $notification['ar_reply_to_name'] ?? '';
2090 + $reply_to = isset( $notification['ar_reply_to'] ) ? $notification['ar_reply_to'] : '';
2091 + $reply_to_name = isset( $notification['ar_reply_to_name'] ) ? $notification['ar_reply_to_name'] : '';
2399 2092
2400 2093 if ( ! empty( $reply_to ) ) {
2401 2094 $new_notification2['post_content']['reply_to'] = $reply_to;
2402 2095 }
@@ -2424,13 +2117,8 @@
2424 2117
2425 2118 return $loader;
2426 2119 }
2427 2120
2428 - /**
2429 - * PHP 8 backward compatibility for the libxml_disable_entity_loader function
2430 - *
2431 - * @return bool
2432 - */
2433 2121 public static function check_if_libxml_disable_entity_loader_exists() {
2434 2122 return version_compare( phpversion(), '8.0', '<' ) && ! function_exists( 'libxml_disable_entity_loader' );
2435 2123 }
2436 2124
@@ -2443,9 +2131,8 @@
2443 2131 * @return array
2444 2132 */
2445 2133 public static function get_supported_upload_file_types() {
2446 2134 $file_types = array( '.xml' );
2447 -
2448 2135 if ( FrmAppHelper::pro_is_installed() ) {
2449 2136 // CSV Importing is only available in Pro.
2450 2137 $file_types[] = '.csv';
2451 2138 }