PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.7.2
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.7.2
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 +50 -39 6.5.2 → 6.7.2 View file →
@@ -180,9 +180,9 @@
180 180 $imported['terms'][ (int) $t->term_id ] = $term['term_id'];
181 181 }
182 182
183 183 unset( $term, $t );
184 - }
184 + }//end foreach
185 185
186 186 return $imported;
187 187 }
188 188
@@ -255,9 +255,9 @@
255 255
256 256 do_action( 'frm_after_import_form', $form_id, $form );
257 257
258 258 unset( $form, $item );
259 - }
259 + }//end foreach
260 260
261 261 self::maybe_update_child_form_parent_id( $imported['forms'], $child_forms );
262 262
263 263 return $imported;
@@ -380,10 +380,10 @@
380 380 * Keep track of all imported child forms
381 381 *
382 382 * @since 2.0.16
383 383 *
384 - * @param int $form_id
385 - * @param int $parent_form_id
384 + * @param int $form_id
385 + * @param int $parent_form_id
386 386 * @param array $child_forms
387 387 */
388 388 private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) {
389 389 if ( $parent_form_id ) {
@@ -439,9 +439,9 @@
439 439 $imported['updated']['fields'] ++;
440 440
441 441 unset( $form_fields[ $f['id'] ] );
442 442
443 - //unset old field key
443 + // Unset old field key.
444 444 if ( isset( $form_fields[ $f['field_key'] ] ) ) {
445 445 unset( $form_fields[ $f['field_key'] ] );
446 446 }
447 447 } elseif ( isset( $form_fields[ $f['field_key'] ] ) ) {
@@ -452,19 +452,22 @@
452 452
453 453 FrmField::update( $form_fields[ $f['field_key'] ], $f );
454 454 $imported['updated']['fields'] ++;
455 455
456 - unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); //unset old field id
457 - unset( $form_fields[ $f['field_key'] ] ); //unset old field key
456 + // Unset old field id.
457 + unset( $form_fields[ $form_fields[ $f['field_key'] ] ] );
458 +
459 + // Unset old field key.
460 + unset( $form_fields[ $f['field_key'] ] );
458 461 } else {
459 - // if no matching field id or key in this form, create the field
462 + // If no matching field id or key in this form, create the field.
460 463 self::create_imported_field( $f, $imported );
461 - }
464 + }//end if
462 465 } else {
463 466
464 467 self::create_imported_field( $f, $imported );
465 - }
466 - }
468 + }//end if
469 + }//end foreach
467 470
468 471 if ( $keys_by_original_field_id ) {
469 472 self::maybe_update_field_ids( $form_id, $keys_by_original_field_id );
470 473 }
@@ -526,9 +529,9 @@
526 529 /**
527 530 * Update the current in_section value at the beginning of the field loop
528 531 *
529 532 * @since 2.0.25
530 - * @param int $in_section
533 + * @param int $in_section
531 534 * @param array $f
532 535 */
533 536 private static function maybe_update_in_section_variable( &$in_section, &$f ) {
534 537 // If we're at the end of a section, switch $in_section is 0
@@ -702,13 +705,15 @@
702 705 if ( ! is_array( $option ) || empty( $option['src'] ) ) {
703 706 continue;
704 707 }
705 708
706 - $field_object = (object) $field;
707 - $field_object->type = 'file'; // Fake the file type as FrmProImport::import_attachment checks for file type.
709 + $field_object = (object) $field;
710 + // Fake the file type as FrmProImport::import_attachment checks for file type.
711 + $field_object->type = 'file';
708 712
709 713 $image_id = FrmProFileImport::import_attachment( $option['src'], $field_object );
710 - unset( $field['options'][ $key ]['src'] ); // Remove the src from options as it isn't required after import.
714 + // Remove the src from options as it isn't required after import.
715 + unset( $field['options'][ $key ]['src'] );
711 716
712 717 if ( is_numeric( $image_id ) ) {
713 718 $field['options'][ $key ]['image'] = $image_id;
714 719 }
@@ -720,9 +725,9 @@
720 725 /**
721 726 * Fix field ids for fields that already exist prior to import.
722 727 *
723 728 * @since 4.07
724 - * @param int $form_id
729 + * @param int $form_id
725 730 * @param array $keys_by_original_field_id
726 731 */
727 732 protected static function maybe_update_field_ids( $form_id, $keys_by_original_field_id ) {
728 733 global $frm_duplicate_ids;
@@ -792,9 +797,9 @@
792 797
793 798 // Set to default
794 799 $form['options']['custom_style'] = 1;
795 800 }
796 - }
801 + }//end if
797 802 }
798 803
799 804 /**
800 805 * After styles are imported, check for any forms that were linked
@@ -882,9 +887,9 @@
882 887 $post['post_parent'] = $imported['posts'][ $post['post_parent'] ];
883 888 }
884 889 // Create/update post now
885 890 $post_id = wp_insert_post( $post );
886 - }
891 + }//end if
887 892
888 893 if ( ! is_numeric( $post_id ) ) {
889 894 continue;
890 895 }
@@ -915,9 +920,9 @@
915 920
916 921 do_action( 'frm_after_import_view', $post_id, $post );
917 922
918 923 unset( $post );
919 - }
924 + }//end foreach
920 925
921 926 if ( $posts_with_shortcodes && $view_ids ) {
922 927 self::maybe_switch_view_ids_after_importing_posts( $posts_with_shortcodes, $view_ids );
923 928 }
@@ -1108,9 +1113,9 @@
1108 1113 'key' => (string) $meta->meta_key,
1109 1114 'value' => (string) $meta->meta_value,
1110 1115 );
1111 1116
1112 - //switch old form and field ids to new ones
1117 + // Switch old form and field ids to new ones.
1113 1118 if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][ (int) $m['value'] ] ) ) {
1114 1119 $m['value'] = $imported['forms'][ (int) $m['value'] ];
1115 1120 } else {
1116 1121 $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] );
@@ -1147,11 +1152,11 @@
1147 1152 }
1148 1153 unset( $mk, $mv );
1149 1154 }
1150 1155 }
1151 - }
1152 - }
1153 - }
1156 + }//end if
1157 + }//end if
1158 + }//end if
1154 1159
1155 1160 if ( ! is_array( $m['value'] ) ) {
1156 1161 $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] );
1157 1162 }
@@ -1165,10 +1170,10 @@
1165 1170
1166 1171 /**
1167 1172 * Add terms to post
1168 1173 *
1169 - * @param array $post by reference
1170 - * @param object $item The XML object data
1174 + * @param array $post By reference.
1175 + * @param object $item The XML object data.
1171 1176 */
1172 1177 private static function populate_taxonomies( &$post, $item ) {
1173 1178 foreach ( $item->category as $c ) {
1174 1179 $att = $c->attributes();
@@ -1193,9 +1198,9 @@
1193 1198 }
1194 1199
1195 1200 $post['tax_input'][ $taxonomy ][] = $name;
1196 1201 unset( $name );
1197 - }
1202 + }//end foreach
1198 1203 }
1199 1204
1200 1205 /**
1201 1206 * Edit post if the key and created time match
@@ -1249,13 +1254,13 @@
1249 1254
1250 1255 case 'frm_param':
1251 1256 add_rewrite_endpoint( $v, EP_PERMALINK | EP_PAGES );
1252 1257 break;
1253 - }
1258 + }//end switch
1254 1259
1255 1260 update_post_meta( $post_id, $k, $v );
1256 1261 unset( $k, $v );
1257 - }
1262 + }//end foreach
1258 1263 }
1259 1264
1260 1265 /**
1261 1266 * @param array $post
@@ -1285,9 +1290,11 @@
1285 1290 }
1286 1291 }
1287 1292
1288 1293 /**
1294 + * @param mixed $result
1289 1295 * @param string $message
1296 + * @param array $errors
1290 1297 */
1291 1298 public static function parse_message( $result, &$message, &$errors ) {
1292 1299 if ( is_wp_error( $result ) ) {
1293 1300 $errors[] = $result->get_error_message();
@@ -1313,9 +1320,9 @@
1313 1320
1314 1321 return;
1315 1322 } elseif ( ! $result ) {
1316 1323 return;
1317 - }
1324 + }//end if
1318 1325
1319 1326 if ( ! is_array( $result ) ) {
1320 1327 $message = is_string( $result ) ? $result : htmlentities( print_r( $result, 1 ) );
1321 1328
@@ -1652,9 +1659,13 @@
1652 1659
1653 1660 /**
1654 1661 * Migrate post settings to form action
1655 1662 *
1663 + * @param array $form_options
1664 + * @param int $form_id
1656 1665 * @param string $post_type
1666 + * @param array $imported
1667 + * @param bool $switch
1657 1668 */
1658 1669 private static function migrate_post_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) {
1659 1670 if ( ! isset( $form_options['create_post'] ) || ! $form_options['create_post'] ) {
1660 1671 return;
@@ -1732,11 +1743,11 @@
1732 1743 * Switch old field IDs for new field IDs in emails and post
1733 1744 *
1734 1745 * @since 2.0
1735 1746 *
1736 - * @param array $post_content - check for old field IDs
1737 - * @param array $basic_fields - fields with string or int saved
1738 - * @param array $array_fields - fields with arrays saved
1747 + * @param array $post_content Check for old field IDs.
1748 + * @param array $basic_fields Fields with string or int saved.
1749 + * @param array $array_fields Fields with arrays saved.
1739 1750 *
1740 1751 * @return string $post_content - new field IDs
1741 1752 */
1742 1753 private static function switch_action_field_ids( $post_content, $basic_fields, $array_fields = array() ) {
@@ -1820,9 +1831,9 @@
1820 1831 FrmDb::save_json_post( $new_notification );
1821 1832 $imported['imported']['actions'] ++;
1822 1833 }
1823 1834 unset( $new_notification );
1824 - }
1835 + }//end foreach
1825 1836
1826 1837 self::remove_deprecated_notification_settings( $form_id, $form_options );
1827 1838 }
1828 1839
@@ -1831,9 +1842,9 @@
1831 1842 *
1832 1843 * @since 2.05
1833 1844 *
1834 1845 * @param int|string $form_id
1835 - * @param array $form_options
1846 + * @param array $form_options
1836 1847 */
1837 1848 private static function remove_deprecated_notification_settings( $form_id, $form_options ) {
1838 1849 $delete_settings = array( 'notification', 'autoresponder', 'email_to' );
1839 1850 foreach ( $delete_settings as $index ) {
@@ -1876,10 +1887,10 @@
1876 1887 $new_notification = array();
1877 1888 self::setup_new_notification( $new_notification, $notification, $atts );
1878 1889
1879 1890 $notifications[] = $new_notification;
1880 - }
1881 - }
1891 + }//end foreach
1892 + }//end if
1882 1893 }
1883 1894
1884 1895 private static function format_email_data( &$atts, $notification ) {
1885 1896 // Format email_to
@@ -1975,9 +1986,9 @@
1975 1986
1976 1987 /**
1977 1988 * Switch field IDs in pre-2.0 email conditional logic
1978 1989 *
1979 - * @param $post_content array, pass by reference
1990 + * @param array $post_content Pass by reference.
1980 1991 */
1981 1992 private static function switch_email_condition_field_ids( &$post_content ) {
1982 1993 // Switch field IDs in conditional logic
1983 1994 if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) {
@@ -2030,15 +2041,15 @@
2030 2041 }
2031 2042
2032 2043 $notifications[] = $new_notification2;
2033 2044 unset( $new_notification2 );
2034 - }
2045 + }//end if
2035 2046 }
2036 2047
2037 2048 /**
2038 2049 * PHP 8 backward compatibility for the libxml_disable_entity_loader function
2039 2050 *
2040 - * @param boolean $disable
2051 + * @param boolean $loader
2041 2052 *
2042 2053 * @return boolean
2043 2054 */
2044 2055 public static function maybe_libxml_disable_entity_loader( $loader ) {