Completed
Push — master ( 263488...2baff7 )
by Stephanie
03:35
created
classes/models/FrmMigrate.php 2 patches
Indentation   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
 		return $charset_collate;
83 83
 	}
84 84
 
85
-    private function create_tables() {
86
-        $charset_collate = $this->collation();
87
-        $sql = array();
85
+	private function create_tables() {
86
+		$charset_collate = $this->collation();
87
+		$sql = array();
88 88
 
89
-        /* Create/Upgrade Fields Table */
89
+		/* Create/Upgrade Fields Table */
90 90
 		$sql[] = 'CREATE TABLE ' . $this->fields . ' (
91 91
 				id BIGINT(20) NOT NULL auto_increment,
92 92
 				field_key varchar(100) default NULL,
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
                 UNIQUE KEY field_key (field_key)
106 106
         )';
107 107
 
108
-        /* Create/Upgrade Forms Table */
108
+		/* Create/Upgrade Forms Table */
109 109
 		$sql[] = 'CREATE TABLE ' . $this->forms . ' (
110 110
                 id int(11) NOT NULL auto_increment,
111 111
 				form_key varchar(100) default NULL,
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
                 UNIQUE KEY form_key (form_key)
124 124
         )';
125 125
 
126
-        /* Create/Upgrade Items Table */
126
+		/* Create/Upgrade Items Table */
127 127
 		$sql[] = 'CREATE TABLE ' . $this->entries . ' (
128 128
 				id BIGINT(20) NOT NULL auto_increment,
129 129
 				item_key varchar(100) default NULL,
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
                 UNIQUE KEY item_key (item_key)
147 147
         )';
148 148
 
149
-        /* Create/Upgrade Meta Table */
149
+		/* Create/Upgrade Meta Table */
150 150
 		$sql[] = 'CREATE TABLE ' . $this->entry_metas . ' (
151 151
 				id BIGINT(20) NOT NULL auto_increment,
152 152
 				meta_value longtext default NULL,
@@ -158,16 +158,16 @@  discard block
 block discarded – undo
158 158
                 KEY item_id (item_id)
159 159
         )';
160 160
 
161
-        foreach ( $sql as $q ) {
161
+		foreach ( $sql as $q ) {
162 162
 			if ( function_exists( 'dbDelta' ) ) {
163 163
 				dbDelta( $q . $charset_collate . ';' );
164 164
 			} else {
165 165
 				global $wpdb;
166 166
 				$wpdb->query( $q . $charset_collate );
167 167
 			}
168
-            unset($q);
169
-        }
170
-    }
168
+			unset($q);
169
+		}
170
+	}
171 171
 
172 172
 	private function maybe_create_contact_form() {
173 173
 		$template_id = FrmForm::get_id_by_key( 'contact' );
@@ -209,31 +209,31 @@  discard block
 block discarded – undo
209 209
 		}
210 210
 	}
211 211
 
212
-    public function uninstall() {
212
+	public function uninstall() {
213 213
 		if ( ! current_user_can( 'administrator' ) ) {
214
-            $frm_settings = FrmAppHelper::get_settings();
215
-            wp_die($frm_settings->admin_permission);
216
-        }
214
+			$frm_settings = FrmAppHelper::get_settings();
215
+			wp_die($frm_settings->admin_permission);
216
+		}
217 217
 
218
-        global $wpdb, $wp_roles;
218
+		global $wpdb, $wp_roles;
219 219
 
220 220
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->fields );
221 221
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->forms );
222 222
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entries );
223 223
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entry_metas );
224 224
 
225
-        delete_option('frm_options');
226
-        delete_option('frm_db_version');
227
-
228
-        //delete roles
229
-        $frm_roles = FrmAppHelper::frm_capabilities();
230
-        $roles = get_editable_roles();
231
-        foreach ( $frm_roles as $frm_role => $frm_role_description ) {
232
-            foreach ( $roles as $role => $details ) {
233
-                $wp_roles->remove_cap( $role, $frm_role );
234
-                unset($role, $details);
235
-    		}
236
-    		unset($frm_role, $frm_role_description);
225
+		delete_option('frm_options');
226
+		delete_option('frm_db_version');
227
+
228
+		//delete roles
229
+		$frm_roles = FrmAppHelper::frm_capabilities();
230
+		$roles = get_editable_roles();
231
+		foreach ( $frm_roles as $frm_role => $frm_role_description ) {
232
+			foreach ( $roles as $role => $details ) {
233
+				$wp_roles->remove_cap( $role, $frm_role );
234
+				unset($role, $details);
235
+			}
236
+			unset($frm_role, $frm_role_description);
237 237
 		}
238 238
 		unset($roles, $frm_roles);
239 239
 
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
 
258 258
 		$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_%' ) );
259 259
 
260
-        do_action('frm_after_uninstall');
261
-        return true;
262
-    }
260
+		do_action('frm_after_uninstall');
261
+		return true;
262
+	}
263 263
 
264 264
 	/**
265 265
 	 * Reverse migration 17 -- Divide by 9
@@ -384,138 +384,138 @@  discard block
 block discarded – undo
384 384
 		}
385 385
 	}
386 386
 
387
-    /**
388
-     * Change field size from character to pixel -- Multiply by 9
389
-     */
390
-    private function migrate_to_17() {
387
+	/**
388
+	 * Change field size from character to pixel -- Multiply by 9
389
+	 */
390
+	private function migrate_to_17() {
391 391
 		$pixel_conversion = 9;
392 392
 
393 393
 		$fields = $this->get_fields_with_size();
394 394
 
395
-        foreach ( $fields as $f ) {
396
-            $f->field_options = maybe_unserialize($f->field_options);
397
-            if ( empty($f->field_options['size']) || ! is_numeric($f->field_options['size']) ) {
398
-                continue;
399
-            }
395
+		foreach ( $fields as $f ) {
396
+			$f->field_options = maybe_unserialize($f->field_options);
397
+			if ( empty($f->field_options['size']) || ! is_numeric($f->field_options['size']) ) {
398
+				continue;
399
+			}
400 400
 
401 401
 			$f->field_options['size'] = round( $pixel_conversion * (int) $f->field_options['size'] );
402
-            $f->field_options['size'] .= 'px';
402
+			$f->field_options['size'] .= 'px';
403 403
 			FrmField::update( $f->id, array( 'field_options' => $f->field_options ) );
404
-            unset($f);
405
-        }
406
-
407
-        // Change the characters in widgets to pixels
408
-        $widgets = get_option('widget_frm_show_form');
409
-        if ( empty($widgets) ) {
410
-            return;
411
-        }
412
-
413
-        $widgets = maybe_unserialize($widgets);
414
-        foreach ( $widgets as $k => $widget ) {
415
-            if ( ! is_array($widget) || ! isset($widget['size']) ) {
416
-                continue;
417
-            }
404
+			unset($f);
405
+		}
406
+
407
+		// Change the characters in widgets to pixels
408
+		$widgets = get_option('widget_frm_show_form');
409
+		if ( empty($widgets) ) {
410
+			return;
411
+		}
412
+
413
+		$widgets = maybe_unserialize($widgets);
414
+		foreach ( $widgets as $k => $widget ) {
415
+			if ( ! is_array($widget) || ! isset($widget['size']) ) {
416
+				continue;
417
+			}
418 418
 			$size = round( $pixel_conversion * (int) $widget['size'] );
419
-            $size .= 'px';
419
+			$size .= 'px';
420 420
 			$widgets[ $k ]['size'] = $size;
421
-        }
422
-        update_option('widget_frm_show_form', $widgets);
423
-    }
424
-
425
-    /**
426
-     * Migrate post and email notification settings into actions
427
-     */
428
-    private function migrate_to_16() {
429
-        $forms = FrmDb::get_results( $this->forms, array(), 'id, options, is_template, default_template' );
430
-
431
-        /**
432
-        * Old email settings format:
433
-        * email_to: Email or field id
434
-        * also_email_to: array of fields ids
435
-        * reply_to: Email, field id, 'custom'
436
-        * cust_reply_to: string
437
-        * reply_to_name: field id, 'custom'
438
-        * cust_reply_to_name: string
439
-        * plain_text: 0|1
440
-        * email_message: string or ''
441
-        * email_subject: string or ''
442
-        * inc_user_info: 0|1
443
-        * update_email: 0, 1, 2
444
-        *
445
-        * Old autoresponder settings format:
446
-        * auto_responder: 0|1
447
-        * ar_email_message: string or ''
448
-        * ar_email_to: field id
449
-        * ar_plain_text: 0|1
450
-        * ar_reply_to_name: string
451
-        * ar_reply_to: string
452
-        * ar_email_subject: string
453
-        * ar_update_email: 0, 1, 2
454
-        *
455
-        * New email settings:
456
-        * post_content: json settings
457
-        * post_title: form id
458
-        * post_excerpt: message
459
-        *
460
-        */
461
-
462
-        foreach ( $forms as $form ) {
421
+		}
422
+		update_option('widget_frm_show_form', $widgets);
423
+	}
424
+
425
+	/**
426
+	 * Migrate post and email notification settings into actions
427
+	 */
428
+	private function migrate_to_16() {
429
+		$forms = FrmDb::get_results( $this->forms, array(), 'id, options, is_template, default_template' );
430
+
431
+		/**
432
+		 * Old email settings format:
433
+		 * email_to: Email or field id
434
+		 * also_email_to: array of fields ids
435
+		 * reply_to: Email, field id, 'custom'
436
+		 * cust_reply_to: string
437
+		 * reply_to_name: field id, 'custom'
438
+		 * cust_reply_to_name: string
439
+		 * plain_text: 0|1
440
+		 * email_message: string or ''
441
+		 * email_subject: string or ''
442
+		 * inc_user_info: 0|1
443
+		 * update_email: 0, 1, 2
444
+		 *
445
+		 * Old autoresponder settings format:
446
+		 * auto_responder: 0|1
447
+		 * ar_email_message: string or ''
448
+		 * ar_email_to: field id
449
+		 * ar_plain_text: 0|1
450
+		 * ar_reply_to_name: string
451
+		 * ar_reply_to: string
452
+		 * ar_email_subject: string
453
+		 * ar_update_email: 0, 1, 2
454
+		 *
455
+		 * New email settings:
456
+		 * post_content: json settings
457
+		 * post_title: form id
458
+		 * post_excerpt: message
459
+		 *
460
+		 */
461
+
462
+		foreach ( $forms as $form ) {
463 463
 			if ( $form->is_template && $form->default_template ) {
464 464
 				// don't migrate the default templates since the email will be added anyway
465 465
 				continue;
466 466
 			}
467 467
 
468
-            // Format form options
469
-            $form_options = maybe_unserialize($form->options);
468
+			// Format form options
469
+			$form_options = maybe_unserialize($form->options);
470 470
 
471
-            // Migrate settings to actions
472
-            FrmXMLHelper::migrate_form_settings_to_actions( $form_options, $form->id );
473
-        }
474
-    }
471
+			// Migrate settings to actions
472
+			FrmXMLHelper::migrate_form_settings_to_actions( $form_options, $form->id );
473
+		}
474
+	}
475 475
 
476
-    private function migrate_to_11() {
477
-        global $wpdb;
476
+	private function migrate_to_11() {
477
+		global $wpdb;
478 478
 
479
-        $forms = FrmDb::get_results( $this->forms, array(), 'id, options');
479
+		$forms = FrmDb::get_results( $this->forms, array(), 'id, options');
480 480
 
481
-        $sending = __( 'Sending', 'formidable' );
481
+		$sending = __( 'Sending', 'formidable' );
482 482
 		$img = FrmAppHelper::plugin_url() . '/images/ajax_loader.gif';
483
-        $old_default_html = <<<DEFAULT_HTML
483
+		$old_default_html = <<<DEFAULT_HTML
484 484
 <div class="frm_submit">
485 485
 [if back_button]<input type="submit" value="[back_label]" name="frm_prev_page" formnovalidate="formnovalidate" [back_hook] />[/if back_button]
486 486
 <input type="submit" value="[button_label]" [button_action] />
487 487
 <img class="frm_ajax_loading" src="$img" alt="$sending" style="visibility:hidden;" />
488 488
 </div>
489 489
 DEFAULT_HTML;
490
-        unset($sending, $img);
490
+		unset($sending, $img);
491 491
 
492
-        $new_default_html = FrmFormsHelper::get_default_html('submit');
493
-        $draft_link = FrmFormsHelper::get_draft_link();
492
+		$new_default_html = FrmFormsHelper::get_default_html('submit');
493
+		$draft_link = FrmFormsHelper::get_draft_link();
494 494
 		foreach ( $forms as $form ) {
495
-            $form->options = maybe_unserialize($form->options);
496
-            if ( ! isset($form->options['submit_html']) || empty($form->options['submit_html']) ) {
497
-                continue;
498
-            }
495
+			$form->options = maybe_unserialize($form->options);
496
+			if ( ! isset($form->options['submit_html']) || empty($form->options['submit_html']) ) {
497
+				continue;
498
+			}
499 499
 
500
-            if ( $form->options['submit_html'] != $new_default_html && $form->options['submit_html'] == $old_default_html ) {
501
-                $form->options['submit_html'] = $new_default_html;
500
+			if ( $form->options['submit_html'] != $new_default_html && $form->options['submit_html'] == $old_default_html ) {
501
+				$form->options['submit_html'] = $new_default_html;
502 502
 				$wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) );
503 503
 			} else if ( ! strpos( $form->options['submit_html'], 'save_draft' ) ) {
504 504
 				$form->options['submit_html'] = preg_replace( '~\<\/div\>(?!.*\<\/div\>)~', $draft_link . "\r\n</div>", $form->options['submit_html'] );
505 505
 				$wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) );
506
-            }
507
-            unset($form);
508
-        }
509
-        unset($forms);
510
-    }
506
+			}
507
+			unset($form);
508
+		}
509
+		unset($forms);
510
+	}
511 511
 
512
-    private function migrate_to_6() {
513
-        global $wpdb;
512
+	private function migrate_to_6() {
513
+		global $wpdb;
514 514
 
515 515
 		$no_save = array_merge( FrmField::no_save_fields(), array( 'form', 'hidden', 'user_id' ) );
516 516
 		$fields = FrmDb::get_results( $this->fields, array( 'type NOT' => $no_save ), 'id, field_options' );
517 517
 
518
-        $default_html = <<<DEFAULT_HTML
518
+		$default_html = <<<DEFAULT_HTML
519 519
 <div id="frm_field_[id]_container" class="form-field [required_class] [error_class]">
520 520
     <label class="frm_pos_[label_position]">[field_name]
521 521
         <span class="frm_required">[required_label]</span>
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 </div>
526 526
 DEFAULT_HTML;
527 527
 
528
-        $old_default_html = <<<DEFAULT_HTML
528
+		$old_default_html = <<<DEFAULT_HTML
529 529
 <div id="frm_field_[id]_container" class="form-field [required_class] [error_class]">
530 530
     <label class="frm_pos_[label_position]">[field_name]
531 531
         <span class="frm_required">[required_label]</span>
@@ -535,27 +535,27 @@  discard block
 block discarded – undo
535 535
 </div>
536 536
 DEFAULT_HTML;
537 537
 
538
-        $new_default_html = FrmFieldsHelper::get_default_html('text');
539
-        foreach ( $fields as $field ) {
540
-            $field->field_options = maybe_unserialize($field->field_options);
538
+		$new_default_html = FrmFieldsHelper::get_default_html('text');
539
+		foreach ( $fields as $field ) {
540
+			$field->field_options = maybe_unserialize($field->field_options);
541 541
 			$html = FrmField::get_option( $field, 'custom_html' );
542 542
 			if ( $html == $default_html || $html == $old_default_html ) {
543
-                $field->field_options['custom_html'] = $new_default_html;
543
+				$field->field_options['custom_html'] = $new_default_html;
544 544
 				$wpdb->update( $this->fields, array( 'field_options' => maybe_serialize( $field->field_options ) ), array( 'id' => $field->id ) );
545
-            }
546
-            unset($field);
547
-        }
548
-        unset($default_html, $old_default_html, $fields);
549
-    }
545
+			}
546
+			unset($field);
547
+		}
548
+		unset($default_html, $old_default_html, $fields);
549
+	}
550 550
 
551 551
 	/**
552 552
 	 * Adds user id to the entry
553 553
 	 */
554
-    private function migrate_to_4() {
555
-        global $wpdb;
554
+	private function migrate_to_4() {
555
+		global $wpdb;
556 556
 		$user_ids = FrmEntryMeta::getAll( array( 'fi.type' => 'user_id' ) );
557
-        foreach ( $user_ids as $user_id ) {
557
+		foreach ( $user_ids as $user_id ) {
558 558
 			$wpdb->update( $this->entries, array( 'user_id' => $user_id->meta_value ), array( 'id' => $user_id->item_id ) );
559
-        }
560
-    }
559
+		}
560
+	}
561 561
 }
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
 	public $entry_metas;
8 8
 
9 9
 	public function __construct() {
10
-		if ( ! defined('ABSPATH') ) {
11
-			die('You are not allowed to call this page directly.');
10
+		if ( ! defined( 'ABSPATH' ) ) {
11
+			die( 'You are not allowed to call this page directly.' );
12 12
 		}
13 13
 
14 14
 		global $wpdb;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 			}
52 52
 		}
53 53
 
54
-		do_action('frm_after_install');
54
+		do_action( 'frm_after_install' );
55 55
 
56 56
 		$frm_vars['doing_upgrade'] = false;
57 57
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 				global $wpdb;
166 166
 				$wpdb->query( $q . $charset_collate );
167 167
 			}
168
-            unset($q);
168
+            unset( $q );
169 169
         }
170 170
     }
171 171
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
     public function uninstall() {
213 213
 		if ( ! current_user_can( 'administrator' ) ) {
214 214
             $frm_settings = FrmAppHelper::get_settings();
215
-            wp_die($frm_settings->admin_permission);
215
+            wp_die( $frm_settings->admin_permission );
216 216
         }
217 217
 
218 218
         global $wpdb, $wp_roles;
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entries );
223 223
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entry_metas );
224 224
 
225
-        delete_option('frm_options');
226
-        delete_option('frm_db_version');
225
+        delete_option( 'frm_options' );
226
+        delete_option( 'frm_db_version' );
227 227
 
228 228
         //delete roles
229 229
         $frm_roles = FrmAppHelper::frm_capabilities();
@@ -231,11 +231,11 @@  discard block
 block discarded – undo
231 231
         foreach ( $frm_roles as $frm_role => $frm_role_description ) {
232 232
             foreach ( $roles as $role => $details ) {
233 233
                 $wp_roles->remove_cap( $role, $frm_role );
234
-                unset($role, $details);
234
+                unset( $role, $details );
235 235
     		}
236
-    		unset($frm_role, $frm_role_description);
236
+    		unset( $frm_role, $frm_role_description );
237 237
 		}
238
-		unset($roles, $frm_roles);
238
+		unset( $roles, $frm_roles );
239 239
 
240 240
 		// delete actions, views, and styles
241 241
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 
258 258
 		$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_%' ) );
259 259
 
260
-        do_action('frm_after_uninstall');
260
+        do_action( 'frm_after_uninstall' );
261 261
         return true;
262 262
     }
263 263
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 				continue;
324 324
 			}
325 325
 
326
-			$widgets[ $k ]['size'] = $size;
326
+			$widgets[$k]['size'] = $size;
327 327
 		}
328 328
 		update_option( 'widget_frm_show_form', $widgets );
329 329
 	}
@@ -393,33 +393,33 @@  discard block
 block discarded – undo
393 393
 		$fields = $this->get_fields_with_size();
394 394
 
395 395
         foreach ( $fields as $f ) {
396
-            $f->field_options = maybe_unserialize($f->field_options);
397
-            if ( empty($f->field_options['size']) || ! is_numeric($f->field_options['size']) ) {
396
+            $f->field_options = maybe_unserialize( $f->field_options );
397
+            if ( empty( $f->field_options['size'] ) || ! is_numeric( $f->field_options['size'] ) ) {
398 398
                 continue;
399 399
             }
400 400
 
401 401
 			$f->field_options['size'] = round( $pixel_conversion * (int) $f->field_options['size'] );
402 402
             $f->field_options['size'] .= 'px';
403 403
 			FrmField::update( $f->id, array( 'field_options' => $f->field_options ) );
404
-            unset($f);
404
+            unset( $f );
405 405
         }
406 406
 
407 407
         // Change the characters in widgets to pixels
408
-        $widgets = get_option('widget_frm_show_form');
409
-        if ( empty($widgets) ) {
408
+        $widgets = get_option( 'widget_frm_show_form' );
409
+        if ( empty( $widgets ) ) {
410 410
             return;
411 411
         }
412 412
 
413
-        $widgets = maybe_unserialize($widgets);
413
+        $widgets = maybe_unserialize( $widgets );
414 414
         foreach ( $widgets as $k => $widget ) {
415
-            if ( ! is_array($widget) || ! isset($widget['size']) ) {
415
+            if ( ! is_array( $widget ) || ! isset( $widget['size'] ) ) {
416 416
                 continue;
417 417
             }
418 418
 			$size = round( $pixel_conversion * (int) $widget['size'] );
419 419
             $size .= 'px';
420
-			$widgets[ $k ]['size'] = $size;
420
+			$widgets[$k]['size'] = $size;
421 421
         }
422
-        update_option('widget_frm_show_form', $widgets);
422
+        update_option( 'widget_frm_show_form', $widgets );
423 423
     }
424 424
 
425 425
     /**
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 			}
467 467
 
468 468
             // Format form options
469
-            $form_options = maybe_unserialize($form->options);
469
+            $form_options = maybe_unserialize( $form->options );
470 470
 
471 471
             // Migrate settings to actions
472 472
             FrmXMLHelper::migrate_form_settings_to_actions( $form_options, $form->id );
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
     private function migrate_to_11() {
477 477
         global $wpdb;
478 478
 
479
-        $forms = FrmDb::get_results( $this->forms, array(), 'id, options');
479
+        $forms = FrmDb::get_results( $this->forms, array(), 'id, options' );
480 480
 
481 481
         $sending = __( 'Sending', 'formidable' );
482 482
 		$img = FrmAppHelper::plugin_url() . '/images/ajax_loader.gif';
@@ -487,13 +487,13 @@  discard block
 block discarded – undo
487 487
 <img class="frm_ajax_loading" src="$img" alt="$sending" style="visibility:hidden;" />
488 488
 </div>
489 489
 DEFAULT_HTML;
490
-        unset($sending, $img);
490
+        unset( $sending, $img );
491 491
 
492
-        $new_default_html = FrmFormsHelper::get_default_html('submit');
492
+        $new_default_html = FrmFormsHelper::get_default_html( 'submit' );
493 493
         $draft_link = FrmFormsHelper::get_draft_link();
494 494
 		foreach ( $forms as $form ) {
495
-            $form->options = maybe_unserialize($form->options);
496
-            if ( ! isset($form->options['submit_html']) || empty($form->options['submit_html']) ) {
495
+            $form->options = maybe_unserialize( $form->options );
496
+            if ( ! isset( $form->options['submit_html'] ) || empty( $form->options['submit_html'] ) ) {
497 497
                 continue;
498 498
             }
499 499
 
@@ -504,9 +504,9 @@  discard block
 block discarded – undo
504 504
 				$form->options['submit_html'] = preg_replace( '~\<\/div\>(?!.*\<\/div\>)~', $draft_link . "\r\n</div>", $form->options['submit_html'] );
505 505
 				$wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) );
506 506
             }
507
-            unset($form);
507
+            unset( $form );
508 508
         }
509
-        unset($forms);
509
+        unset( $forms );
510 510
     }
511 511
 
512 512
     private function migrate_to_6() {
@@ -535,17 +535,17 @@  discard block
 block discarded – undo
535 535
 </div>
536 536
 DEFAULT_HTML;
537 537
 
538
-        $new_default_html = FrmFieldsHelper::get_default_html('text');
538
+        $new_default_html = FrmFieldsHelper::get_default_html( 'text' );
539 539
         foreach ( $fields as $field ) {
540
-            $field->field_options = maybe_unserialize($field->field_options);
540
+            $field->field_options = maybe_unserialize( $field->field_options );
541 541
 			$html = FrmField::get_option( $field, 'custom_html' );
542 542
 			if ( $html == $default_html || $html == $old_default_html ) {
543 543
                 $field->field_options['custom_html'] = $new_default_html;
544 544
 				$wpdb->update( $this->fields, array( 'field_options' => maybe_serialize( $field->field_options ) ), array( 'id' => $field->id ) );
545 545
             }
546
-            unset($field);
546
+            unset( $field );
547 547
         }
548
-        unset($default_html, $old_default_html, $fields);
548
+        unset( $default_html, $old_default_html, $fields );
549 549
     }
550 550
 
551 551
 	/**
Please login to merge, or discard this patch.