PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.22
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.22
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/models/FrmMigrate.php +41 -190 6.296.22 View file →
@@ -3,27 +3,11 @@
3 3 die( 'You are not allowed to call this page directly.' );
4 4 }
5 5
6 6 class FrmMigrate {
7 -
8 - /**
9 - * @var string
10 - */
11 7 public $fields;
12 -
13 - /**
14 - * @var string
15 - */
16 8 public $forms;
17 -
18 - /**
19 - * @var string
20 - */
21 9 public $entries;
22 -
23 - /**
24 - * @var string
25 - */
26 10 public $entry_metas;
27 11
28 12 public function __construct() {
29 13 global $wpdb;
@@ -32,11 +16,8 @@
32 16 $this->entries = $wpdb->prefix . 'frm_items';
33 17 $this->entry_metas = $wpdb->prefix . 'frm_item_metas';
34 18 }
35 19
36 - /**
37 - * @return void
38 - */
39 20 public function upgrade() {
40 21 do_action( 'frm_before_install' );
41 22
42 23 global $wpdb, $frm_vars;
@@ -51,11 +32,9 @@
51 32 )
52 33 );
53 34
54 35 if ( $needs_upgrade ) {
55 - $this->maybe_delete_htaccess_file();
56 -
57 - // Update rewrite rules for views and other custom post types
36 + // update rewrite rules for views and other custom post types
58 37 flush_rewrite_rules();
59 38
60 39 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
61 40
@@ -73,10 +52,8 @@
73 52
74 53 if ( false === get_option( 'frm_first_activation' ) ) {
75 54 update_option( 'frm_first_activation', time(), false );
76 55 }
77 -
78 - $this->update_settings_for_new_install();
79 56 }
80 57 }//end if
81 58
82 59 do_action( 'frm_after_install' );
@@ -84,56 +61,16 @@
84 61 $frm_vars['doing_upgrade'] = false;
85 62
86 63 FrmAppHelper::save_combined_js();
87 64
88 - // Update the styling settings
89 - if ( ! function_exists( 'get_filesystem_method' ) ) {
90 - return;
65 + // update the styling settings
66 + if ( function_exists( 'get_filesystem_method' ) ) {
67 + $frm_style = new FrmStyle();
68 + $frm_style->update( 'default' );
91 69 }
92 -
93 - $frm_style = new FrmStyle();
94 - $frm_style->update( 'default' );
95 70 }
96 71
97 72 /**
98 - * Check if the .htaccess file should be deleted based on server response.
99 - * If a server has AllowOverride FileInfo but not AllowOverride AuthConfig, JS and CSS files
100 - * will result in a 500 error.
101 - *
102 - * @since 6.27
103 - *
104 - * @return void
105 - */
106 - private function maybe_delete_htaccess_file() {
107 - $css_file_request = wp_remote_get( FrmAppHelper::plugin_url() . '/css/frm_fonts.css' );
108 -
109 - if ( 200 === wp_remote_retrieve_response_code( $css_file_request ) ) {
110 - return;
111 - }
112 -
113 - $htaccess_path = FrmAppHelper::plugin_path() . '/.htaccess';
114 -
115 - if ( file_exists( $htaccess_path ) ) {
116 - wp_delete_file( $htaccess_path );
117 - }
118 - }
119 -
120 - /**
121 - * Updates some settings for new installs.
122 - *
123 - * @since 6.23
124 - *
125 - * @return void
126 - */
127 - private function update_settings_for_new_install() {
128 - $settings = FrmAppHelper::get_settings();
129 -
130 - $settings->denylist_check = 1;
131 - $settings->installed_after_welcome_tour_update = 1;
132 - $settings->store();
133 - }
134 -
135 - /**
136 73 * If we fail to create the database tables, add an inbox notice.
137 74 * This informs the user that they need to correct the issue and try again.
138 75 *
139 76 * @since 6.19
@@ -153,9 +90,9 @@
153 90
154 91 $message = array(
155 92 'key' => 'failed-to-create-tables',
156 93 'subject' => 'Something went wrong setting up the database',
157 - 'message' => 'For steps to continue, see our <a href="https://formidableforms.com/knowledgebase/install-formidable-forms/#kb-missing-database-tables">documentation</a>. If you need assistance, we recommend that you reach out to your hosting provider. Then <a href="' . esc_url( admin_url( 'admin.php?page=formidable&frm_add_tables=1' ) ) . '">click here</a> to try again.', // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
94 + 'message' => 'For steps to continue, see our <a href="https://formidableforms.com/knowledgebase/install-formidable-forms/#kb-missing-database-tables">documentation</a>. If you need assistance, we recommend that you reach out to your hosting provider. Then <a href="' . esc_url( admin_url( 'admin.php?page=formidable&frm_add_tables=1' ) ) . '">click here</a> to try again.',
158 95 'cta' => '<a href="https://formidableforms.com/knowledgebase/install-formidable-forms/#kb-missing-database-tables">Learn More</a>',
159 96 'type' => 'error',
160 97 );
161 98
@@ -167,14 +104,15 @@
167 104 * @return string
168 105 */
169 106 public function collation() {
170 107 global $wpdb;
171 - return $wpdb->has_cap( 'collation' ) ? $wpdb->get_charset_collate() : '';
108 + if ( ! $wpdb->has_cap( 'collation' ) ) {
109 + return '';
110 + }
111 +
112 + return $wpdb->get_charset_collate();
172 113 }
173 114
174 - /**
175 - * @return void
176 - */
177 115 private function create_tables() {
178 116 $charset_collate = $this->collation();
179 117 $sql = array();
180 118
@@ -310,9 +248,8 @@
310 248 * @since 6.6
311 249 *
312 250 * @param string $table_name
313 251 * @param string $index_name
314 - *
315 252 * @return bool
316 253 */
317 254 private static function index_exists( $table_name, $index_name ) {
318 255 global $wpdb;
@@ -328,14 +265,10 @@
328 265 );
329 266 return (bool) $row;
330 267 }
331 268
332 - /**
333 - * @return void
334 - */
335 269 private function maybe_create_contact_form() {
336 270 $form_exists = FrmForm::get_id_by_key( 'contact-form' );
337 -
338 271 if ( ! $form_exists ) {
339 272 $this->add_default_template();
340 273 }
341 274 }
@@ -343,10 +276,8 @@
343 276 /**
344 277 * Create the default contact form
345 278 *
346 279 * @since 3.06
347 - *
348 - * @return void
349 280 */
350 281 private function add_default_template() {
351 282 if ( FrmXMLHelper::check_if_libxml_disable_entity_loader_exists() ) {
352 283 // XML import is not enabled on your server.
@@ -354,9 +285,10 @@
354 285 }
355 286
356 287 $set_err = libxml_use_internal_errors( true );
357 288 $loader = FrmXMLHelper::maybe_libxml_disable_entity_loader( true );
358 - $file = FrmAppHelper::plugin_path() . '/classes/views/xml/default-templates.xml';
289 +
290 + $file = FrmAppHelper::plugin_path() . '/classes/views/xml/default-templates.xml';
359 291 FrmXMLHelper::import_xml( $file );
360 292
361 293 libxml_use_internal_errors( $set_err );
362 294 FrmXMLHelper::maybe_libxml_disable_entity_loader( $loader );
@@ -363,41 +295,32 @@
363 295 }
364 296
365 297 /**
366 298 * @param int|string $old_db_version
367 - *
368 - * @return void
369 299 */
370 300 private function migrate_data( $old_db_version ) {
371 301 if ( ! $old_db_version ) {
372 302 $old_db_version = get_option( 'frm_db_version' );
373 303 }
374 -
375 - if ( str_contains( $old_db_version, '-' ) ) {
304 + if ( strpos( $old_db_version, '-' ) ) {
376 305 $last_upgrade = explode( '-', $old_db_version );
377 306 $old_db_version = (int) $last_upgrade[1];
378 307 }
379 308
380 309 if ( ! is_numeric( $old_db_version ) ) {
381 - // Bail if we don't know the previous version
310 + // bail if we don't know the previous version
382 311 return;
383 312 }
384 313
385 - $migrations = array( 16, 11, 16, 17, 23, 25, 86, 90, 97, 98, 101, 104 );
386 -
314 + $migrations = array( 16, 11, 16, 17, 23, 25, 86, 90, 97, 98, 101 );
387 315 foreach ( $migrations as $migration ) {
388 - if ( FrmAppHelper::$db_version < $migration || $old_db_version >= $migration ) {
389 - continue;
316 + if ( FrmAppHelper::$db_version >= $migration && $old_db_version < $migration ) {
317 + $function_name = 'migrate_to_' . $migration;
318 + $this->$function_name();
390 319 }
391 -
392 - $function_name = 'migrate_to_' . $migration;
393 - $this->$function_name();
394 320 }
395 321 }
396 322
397 - /**
398 - * @return bool
399 - */
400 323 public function uninstall() {
401 324 if ( ! current_user_can( 'administrator' ) ) {
402 325 $frm_settings = FrmAppHelper::get_settings();
403 326 wp_die( esc_html( $frm_settings->admin_permission ) );
@@ -422,9 +345,8 @@
422 345
423 346 // Delete roles.
424 347 $frm_roles = FrmAppHelper::frm_capabilities();
425 348 $roles = get_editable_roles();
426 -
427 349 foreach ( $frm_roles as $frm_role => $frm_role_description ) {
428 350 foreach ( $roles as $role => $details ) {
429 351 $wp_roles->remove_cap( $role, $frm_role );
430 352 unset( $role, $details );
@@ -432,16 +354,15 @@
432 354 unset( $frm_role, $frm_role_description );
433 355 }
434 356 unset( $roles, $frm_roles );
435 357
436 - // Delete actions, views, and styles
358 + // delete actions, views, and styles
437 359
438 - // Prevent the post deletion from triggering entries to be deleted
360 + // prevent the post deletion from triggering entries to be deleted
439 361 remove_action( 'before_delete_post', 'FrmProDisplaysController::before_delete_post' );
440 362 remove_action( 'deleted_post', 'FrmProEntriesController::delete_entry' );
441 363
442 - $post_ids = $wpdb->get_col( $wpdb->prepare( 'SELECT ID FROM ' . $wpdb->posts . ' WHERE post_type in (%s, %s, %s)', FrmFormActionsController::$action_post_type, FrmStylesController::$post_type, 'frm_display' ) ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
443 -
364 + $post_ids = $wpdb->get_col( $wpdb->prepare( 'SELECT ID FROM ' . $wpdb->posts . ' WHERE post_type in (%s, %s, %s)', FrmFormActionsController::$action_post_type, FrmStylesController::$post_type, 'frm_display' ) );
444 365 foreach ( $post_ids as $post_id ) {
445 366 // Delete's each post.
446 367 wp_delete_post( $post_id, true );
447 368 }
@@ -446,15 +367,15 @@
446 367 wp_delete_post( $post_id, true );
447 368 }
448 369 unset( $post_ids );
449 370
450 - // Delete transients
371 + // delete transients
451 372 delete_transient( 'frmpro_css' );
452 373 delete_transient( 'frm_options' );
453 374 delete_transient( 'frmpro_options' );
454 375 delete_transient( FrmOnboardingWizardController::TRANSIENT_NAME );
455 376
456 - $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE %s OR option_name LIKE %s', '_transient_timeout_frm_form_fields_%', '_transient_frm_form_fields_%' ) ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
377 + $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE %s OR option_name LIKE %s', '_transient_timeout_frm_form_fields_%', '_transient_frm_form_fields_%' ) );
457 378
458 379 do_action( 'frm_after_uninstall' );
459 380
460 381 return true;
@@ -460,31 +381,11 @@
460 381 return true;
461 382 }
462 383
463 384 /**
464 - * In older versions of Lite, it's possible we've saved the wrong location ID.
465 - * So force it to get valid values again.
466 - *
467 - * @since 6.25
468 - *
469 - * @return void
470 - */
471 - private function migrate_to_104() {
472 - if ( FrmSquareLiteConnectHelper::get_merchant_id( 'test' ) ) {
473 - FrmSquareLiteConnectHelper::get_location_id( true, 'test' );
474 - }
475 -
476 - if ( FrmSquareLiteConnectHelper::get_merchant_id( 'live' ) ) {
477 - FrmSquareLiteConnectHelper::get_location_id( true, 'live' );
478 - }
479 - }
480 -
481 - /**
482 385 * Disables summary email for multisite (not the main site) if recipient setting isn't changed.
483 386 *
484 387 * @since 6.8
485 - *
486 - * @return void
487 388 */
488 389 private function migrate_to_101() {
489 390 if ( ! is_multisite() || get_main_site_id() === get_current_blog_id() ) {
490 391 return;
@@ -490,9 +391,8 @@
490 391 return;
491 392 }
492 393
493 394 $frm_settings = FrmAppHelper::get_settings();
494 -
495 395 if ( empty( $frm_settings->summary_emails ) || '[admin_email]' !== $frm_settings->summary_emails_recipients ) {
496 396 // User changed it.
497 397 return;
498 398 }
@@ -504,10 +404,8 @@
504 404 /**
505 405 * Clear frmpro_css transient.
506 406 *
507 407 * @since 4.10.02
508 - *
509 - * @return void
510 408 */
511 409 private function migrate_to_98() {
512 410 delete_transient( 'frmpro_css' );
513 411 }
@@ -515,10 +413,8 @@
515 413 /**
516 414 * Move default_blank and clear_on_focus to placeholder.
517 415 *
518 416 * @since 4.0
519 - *
520 - * @return void
521 417 */
522 418 private function migrate_to_97() {
523 419 $this->migrate_to_placeholder( 'clear_on_focus' );
524 420 $this->migrate_to_placeholder( 'default_blank' );
@@ -527,12 +423,8 @@
527 423 /**
528 424 * Move clear_on_focus or default_blank to placeholder.
529 425 *
530 426 * @since 4.0
531 - *
532 - * @param string $type Field option key to migrate.
533 - *
534 - * @return void
535 427 */
536 428 private function migrate_to_placeholder( $type = 'clear_on_focus' ) {
537 429 $query = array(
538 430 'field_options like' => '"' . $type . '";s:1:"1";',
@@ -543,10 +435,9 @@
543 435 foreach ( $fields as $field ) {
544 436 FrmAppHelper::unserialize_or_decode( $field->field_options );
545 437 FrmAppHelper::unserialize_or_decode( $field->options );
546 438 $update_values = FrmXMLHelper::migrate_field_placeholder( $field, $type );
547 -
548 - if ( ! $update_values ) {
439 + if ( empty( $update_values ) ) {
549 440 continue;
550 441 }
551 442
552 443 FrmField::update( $field->id, $update_values );
@@ -557,15 +448,11 @@
557 448 /**
558 449 * Delete unneeded default templates
559 450 *
560 451 * @since 3.06
561 - *
562 - * @return void
563 452 */
564 453 private function migrate_to_90() {
565 454 $form = FrmForm::getOne( 'contact' );
566 -
567 - // phpcs:ignore Universal.Operators.StrictComparisons
568 455 if ( $form && $form->default_template == 1 ) {
569 456 FrmForm::destroy( 'contact' );
570 457 }
571 458 }
@@ -573,15 +460,14 @@
573 460 /**
574 461 * Reverse migration 17 -- Divide by 9
575 462 *
576 463 * @since 3.0.05
577 - *
578 - * @return void
579 464 */
580 465 private function migrate_to_86() {
466 +
581 467 $fields = $this->get_fields_with_size();
582 468
583 - foreach ( $fields as $f ) {
469 + foreach ( (array) $fields as $f ) {
584 470 FrmAppHelper::unserialize_or_decode( $f->field_options );
585 471 $size = $f->field_options['size'];
586 472 $this->maybe_convert_migrated_size( $size );
587 473
@@ -593,12 +479,11 @@
593 479 FrmField::update( $f->id, array( 'field_options' => $f->field_options ) );
594 480 unset( $f );
595 481 }
596 482
597 - // Reverse the extra size changes in widgets
483 + // reverse the extra size changes in widgets
598 484 $widgets = get_option( 'widget_frm_show_form' );
599 -
600 - if ( ! $widgets ) {
485 + if ( empty( $widgets ) ) {
601 486 return;
602 487 }
603 488
604 489 $this->revert_widget_field_size();
@@ -603,11 +488,8 @@
603 488
604 489 $this->revert_widget_field_size();
605 490 }
606 491
607 - /**
608 - * @return array
609 - */
610 492 private function get_fields_with_size() {
611 493 $field_types = array(
612 494 'textarea',
613 495 'text',
@@ -635,20 +517,16 @@
635 517 /**
636 518 * Reverse the extra size changes in widgets
637 519 *
638 520 * @since 3.0.05
639 - *
640 - * @return void
641 521 */
642 522 private function revert_widget_field_size() {
643 523 $widgets = get_option( 'widget_frm_show_form' );
644 -
645 - if ( ! $widgets ) {
524 + if ( empty( $widgets ) ) {
646 525 return;
647 526 }
648 527
649 528 FrmAppHelper::unserialize_or_decode( $widgets );
650 -
651 529 foreach ( $widgets as $k => $widget ) {
652 530 if ( ! is_array( $widget ) || ! isset( $widget['size'] ) ) {
653 531 continue;
654 532 }
@@ -654,9 +532,8 @@
654 532 }
655 533
656 534 $this->maybe_convert_migrated_size( $widgets[ $k ]['size'] );
657 535 }
658 -
659 536 update_option( 'widget_frm_show_form', $widgets );
660 537 }
661 538
662 539 /**
@@ -662,28 +539,23 @@
662 539 /**
663 540 * Divide by 9 to reverse the multiplication
664 541 *
665 542 * @since 3.0.05
666 - *
667 - * @param string $size Size string to maybe convert, passed by reference.
668 - *
669 - * @return void
670 543 */
671 544 private function maybe_convert_migrated_size( &$size ) {
672 - $has_px_size = $size && str_contains( $size, 'px' );
673 -
545 + $has_px_size = ! empty( $size ) && strpos( $size, 'px' );
674 546 if ( ! $has_px_size ) {
675 547 return;
676 548 }
677 549
678 550 $int_size = str_replace( 'px', '', $size );
679 -
680 551 if ( ! is_numeric( $int_size ) || (int) $int_size < 900 ) {
681 552 return;
682 553 }
683 554
684 555 $pixel_conversion = 9;
685 - $size = round( (int) $int_size / $pixel_conversion );
556 +
557 + $size = round( (int) $int_size / $pixel_conversion );
686 558 }
687 559
688 560 /**
689 561 * Migrate old styling settings. If sites are using the old
@@ -689,17 +561,14 @@
689 561 * Migrate old styling settings. If sites are using the old
690 562 * default 400px field width, switch it to 100%
691 563 *
692 564 * @since 2.0.4
693 - *
694 - * @return void
695 565 */
696 566 private function migrate_to_25() {
697 - // Get the style that was created with the style migration
567 + // get the style that was created with the style migration
698 568 $frm_style = new FrmStyle();
699 569 $styles = $frm_style->get_all( 'post_date', 'ASC', 1 );
700 -
701 - if ( ! $styles ) {
570 + if ( empty( $styles ) ) {
702 571 return;
703 572 }
704 573
705 574 foreach ( $styles as $style ) {
@@ -716,16 +585,13 @@
716 585 * Check if the parent_form_id columns exists.
717 586 * If not, try and add it again
718 587 *
719 588 * @since 2.0.2
720 - *
721 - * @return void
722 589 */
723 590 private function migrate_to_23() {
724 591 global $wpdb;
725 592 $exists = $wpdb->get_row( 'SHOW COLUMNS FROM ' . $this->forms . ' LIKE "parent_form_id"' ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
726 -
727 - if ( ! $exists ) {
593 + if ( empty( $exists ) ) {
728 594 $wpdb->query( 'ALTER TABLE ' . $this->forms . ' ADD parent_form_id int(11) default 0' ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
729 595 }
730 596 }
731 597
@@ -730,10 +596,8 @@
730 596 }
731 597
732 598 /**
733 599 * Change field size from character to pixel -- Multiply by 9
734 - *
735 - * @return void
736 600 */
737 601 private function migrate_to_17() {
738 602 $fields = $this->get_fields_with_size();
739 603
@@ -738,9 +602,8 @@
738 602 $fields = $this->get_fields_with_size();
739 603
740 604 foreach ( $fields as $f ) {
741 605 FrmAppHelper::unserialize_or_decode( $f->field_options );
742 -
743 606 if ( empty( $f->field_options['size'] ) || ! is_numeric( $f->field_options['size'] ) ) {
744 607 continue;
745 608 }
746 609
@@ -754,20 +617,16 @@
754 617 }
755 618
756 619 /**
757 620 * Change the characters in widgets to pixels
758 - *
759 - * @return void
760 621 */
761 622 private function adjust_widget_size() {
762 623 $widgets = get_option( 'widget_frm_show_form' );
763 -
764 - if ( ! $widgets ) {
624 + if ( empty( $widgets ) ) {
765 625 return;
766 626 }
767 627
768 628 FrmAppHelper::unserialize_or_decode( $widgets );
769 -
770 629 foreach ( $widgets as $k => $widget ) {
771 630 if ( ! is_array( $widget ) || ! isset( $widget['size'] ) ) {
772 631 continue;
773 632 }
@@ -772,17 +631,11 @@
772 631 continue;
773 632 }
774 633 $this->convert_character_to_px( $widgets[ $k ]['size'] );
775 634 }
776 -
777 635 update_option( 'widget_frm_show_form', $widgets );
778 636 }
779 637
780 - /**
781 - * @param string $size
782 - *
783 - * @return void
784 - */
785 638 private function convert_character_to_px( &$size ) {
786 639 $pixel_conversion = 9;
787 640
788 641 $size = round( $pixel_conversion * (int) $size );
@@ -825,9 +678,9 @@
825 678 * post_excerpt: message
826 679 */
827 680 foreach ( $forms as $form ) {
828 681 if ( $form->is_template && $form->default_template ) {
829 - // Don't migrate the default templates since the email will be added anyway
682 + // don't migrate the default templates since the email will be added anyway
830 683 continue;
831 684 }
832 685
833 686 // Format form options
@@ -841,9 +694,10 @@
841 694
842 695 private function migrate_to_11() {
843 696 global $wpdb;
844 697
845 - $forms = FrmDb::get_results( $this->forms, array(), 'id, options' );
698 + $forms = FrmDb::get_results( $this->forms, array(), 'id, options' );
699 +
846 700 $sending = __( 'Sending', 'formidable' );
847 701 $img = FrmAppHelper::plugin_url() . '/images/ajax_loader.gif';
848 702 $old_default_html = <<<DEFAULT_HTML
849 703 <div class="frm_submit">
@@ -855,21 +709,18 @@
855 709 unset( $sending, $img );
856 710
857 711 $new_default_html = FrmFormsHelper::get_default_html( 'submit' );
858 712 $draft_link = FrmFormsHelper::get_draft_link();
859 -
860 713 foreach ( $forms as $form ) {
861 714 FrmAppHelper::unserialize_or_decode( $form->options );
862 -
863 715 if ( empty( $form->options['submit_html'] ) ) {
864 716 continue;
865 717 }
866 718
867 - // phpcs:ignore Universal.Operators.StrictComparisons
868 719 if ( $form->options['submit_html'] != $new_default_html && $form->options['submit_html'] == $old_default_html ) {
869 720 $form->options['submit_html'] = $new_default_html;
870 721 $wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) );
871 - } elseif ( ! str_contains( $form->options['submit_html'], 'save_draft' ) ) {
722 + } elseif ( ! strpos( $form->options['submit_html'], 'save_draft' ) ) {
872 723 $form->options['submit_html'] = preg_replace( '~\<\/div\>(?!.*\<\/div\>)~', $draft_link . "\r\n</div>", $form->options['submit_html'] );
873 724 $wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) );
874 725 }
875 726 unset( $form );