Completed
Push — master ( f15df2...a3d1c4 )
by Stephanie
02:49
created
classes/models/FrmMigrate.php 2 patches
Indentation   +152 added lines, -152 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' );
@@ -183,10 +183,10 @@  discard block
 block discarded – undo
183 183
 		}
184 184
 	}
185 185
 
186
-    /**
187
-     * @param integer $frm_db_version
186
+	/**
187
+	 * @param integer $frm_db_version
188 188
 	 * @param int $old_db_version
189
-     */
189
+	 */
190 190
 	private function migrate_data( $old_db_version ) {
191 191
 		if ( ! $old_db_version ) {
192 192
 			$old_db_version = get_option( 'frm_db_version' );
@@ -210,31 +210,31 @@  discard block
 block discarded – undo
210 210
 		}
211 211
 	}
212 212
 
213
-    public function uninstall() {
213
+	public function uninstall() {
214 214
 		if ( ! current_user_can( 'administrator' ) ) {
215
-            $frm_settings = FrmAppHelper::get_settings();
216
-            wp_die($frm_settings->admin_permission);
217
-        }
215
+			$frm_settings = FrmAppHelper::get_settings();
216
+			wp_die($frm_settings->admin_permission);
217
+		}
218 218
 
219
-        global $wpdb, $wp_roles;
219
+		global $wpdb, $wp_roles;
220 220
 
221 221
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->fields );
222 222
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->forms );
223 223
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entries );
224 224
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entry_metas );
225 225
 
226
-        delete_option('frm_options');
227
-        delete_option('frm_db_version');
228
-
229
-        //delete roles
230
-        $frm_roles = FrmAppHelper::frm_capabilities();
231
-        $roles = get_editable_roles();
232
-        foreach ( $frm_roles as $frm_role => $frm_role_description ) {
233
-            foreach ( $roles as $role => $details ) {
234
-                $wp_roles->remove_cap( $role, $frm_role );
235
-                unset($role, $details);
236
-    		}
237
-    		unset($frm_role, $frm_role_description);
226
+		delete_option('frm_options');
227
+		delete_option('frm_db_version');
228
+
229
+		//delete roles
230
+		$frm_roles = FrmAppHelper::frm_capabilities();
231
+		$roles = get_editable_roles();
232
+		foreach ( $frm_roles as $frm_role => $frm_role_description ) {
233
+			foreach ( $roles as $role => $details ) {
234
+				$wp_roles->remove_cap( $role, $frm_role );
235
+				unset($role, $details);
236
+			}
237
+			unset($frm_role, $frm_role_description);
238 238
 		}
239 239
 		unset($roles, $frm_roles);
240 240
 
@@ -258,9 +258,9 @@  discard block
 block discarded – undo
258 258
 
259 259
 		$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_%' ) );
260 260
 
261
-        do_action('frm_after_uninstall');
262
-        return true;
263
-    }
261
+		do_action('frm_after_uninstall');
262
+		return true;
263
+	}
264 264
 
265 265
 	/**
266 266
 	 * Migrate old styling settings. If sites are using the old
@@ -299,14 +299,14 @@  discard block
 block discarded – undo
299 299
 		}
300 300
 	}
301 301
 
302
-    /**
303
-     * Change field size from character to pixel -- Multiply by 9
304
-     */
305
-    private function migrate_to_17() {
306
-        global $wpdb;
302
+	/**
303
+	 * Change field size from character to pixel -- Multiply by 9
304
+	 */
305
+	private function migrate_to_17() {
306
+		global $wpdb;
307 307
 		$pixel_conversion = 9;
308 308
 
309
-        // Get query arguments
309
+		// Get query arguments
310 310
 		$field_types = array( 'textarea', 'text', 'number', 'email', 'url', 'rte', 'date', 'phone', 'password', 'image', 'tag', 'file' );
311 311
 		$query = array(
312 312
 			'type' => $field_types,
@@ -314,137 +314,137 @@  discard block
 block discarded – undo
314 314
 			'field_options not like' => 's:4:"size";s:0:',
315 315
 		);
316 316
 
317
-        // Get results
317
+		// Get results
318 318
 		$fields = FrmDb::get_results( $this->fields, $query, 'id, field_options' );
319 319
 
320
-        $updated = 0;
321
-        foreach ( $fields as $f ) {
322
-            $f->field_options = maybe_unserialize($f->field_options);
323
-            if ( empty($f->field_options['size']) || ! is_numeric($f->field_options['size']) ) {
324
-                continue;
325
-            }
320
+		$updated = 0;
321
+		foreach ( $fields as $f ) {
322
+			$f->field_options = maybe_unserialize($f->field_options);
323
+			if ( empty($f->field_options['size']) || ! is_numeric($f->field_options['size']) ) {
324
+				continue;
325
+			}
326 326
 
327 327
 			$f->field_options['size'] = round( $pixel_conversion * (int) $f->field_options['size'] );
328
-            $f->field_options['size'] .= 'px';
329
-            $u = FrmField::update( $f->id, array( 'field_options' => $f->field_options ) );
330
-            if ( $u ) {
331
-                $updated++;
332
-            }
333
-            unset($f);
334
-        }
335
-
336
-        // Change the characters in widgets to pixels
337
-        $widgets = get_option('widget_frm_show_form');
338
-        if ( empty($widgets) ) {
339
-            return;
340
-        }
341
-
342
-        $widgets = maybe_unserialize($widgets);
343
-        foreach ( $widgets as $k => $widget ) {
344
-            if ( ! is_array($widget) || ! isset($widget['size']) ) {
345
-                continue;
346
-            }
328
+			$f->field_options['size'] .= 'px';
329
+			$u = FrmField::update( $f->id, array( 'field_options' => $f->field_options ) );
330
+			if ( $u ) {
331
+				$updated++;
332
+			}
333
+			unset($f);
334
+		}
335
+
336
+		// Change the characters in widgets to pixels
337
+		$widgets = get_option('widget_frm_show_form');
338
+		if ( empty($widgets) ) {
339
+			return;
340
+		}
341
+
342
+		$widgets = maybe_unserialize($widgets);
343
+		foreach ( $widgets as $k => $widget ) {
344
+			if ( ! is_array($widget) || ! isset($widget['size']) ) {
345
+				continue;
346
+			}
347 347
 			$size = round( $pixel_conversion * (int) $widget['size'] );
348
-            $size .= 'px';
348
+			$size .= 'px';
349 349
 			$widgets[ $k ]['size'] = $size;
350
-        }
351
-        update_option('widget_frm_show_form', $widgets);
352
-    }
353
-
354
-    /**
355
-     * Migrate post and email notification settings into actions
356
-     */
357
-    private function migrate_to_16() {
358
-        $forms = FrmDb::get_results( $this->forms, array(), 'id, options, is_template, default_template' );
359
-
360
-        /**
361
-        * Old email settings format:
362
-        * email_to: Email or field id
363
-        * also_email_to: array of fields ids
364
-        * reply_to: Email, field id, 'custom'
365
-        * cust_reply_to: string
366
-        * reply_to_name: field id, 'custom'
367
-        * cust_reply_to_name: string
368
-        * plain_text: 0|1
369
-        * email_message: string or ''
370
-        * email_subject: string or ''
371
-        * inc_user_info: 0|1
372
-        * update_email: 0, 1, 2
373
-        *
374
-        * Old autoresponder settings format:
375
-        * auto_responder: 0|1
376
-        * ar_email_message: string or ''
377
-        * ar_email_to: field id
378
-        * ar_plain_text: 0|1
379
-        * ar_reply_to_name: string
380
-        * ar_reply_to: string
381
-        * ar_email_subject: string
382
-        * ar_update_email: 0, 1, 2
383
-        *
384
-        * New email settings:
385
-        * post_content: json settings
386
-        * post_title: form id
387
-        * post_excerpt: message
388
-        *
389
-        */
390
-
391
-        foreach ( $forms as $form ) {
350
+		}
351
+		update_option('widget_frm_show_form', $widgets);
352
+	}
353
+
354
+	/**
355
+	 * Migrate post and email notification settings into actions
356
+	 */
357
+	private function migrate_to_16() {
358
+		$forms = FrmDb::get_results( $this->forms, array(), 'id, options, is_template, default_template' );
359
+
360
+		/**
361
+		 * Old email settings format:
362
+		 * email_to: Email or field id
363
+		 * also_email_to: array of fields ids
364
+		 * reply_to: Email, field id, 'custom'
365
+		 * cust_reply_to: string
366
+		 * reply_to_name: field id, 'custom'
367
+		 * cust_reply_to_name: string
368
+		 * plain_text: 0|1
369
+		 * email_message: string or ''
370
+		 * email_subject: string or ''
371
+		 * inc_user_info: 0|1
372
+		 * update_email: 0, 1, 2
373
+		 *
374
+		 * Old autoresponder settings format:
375
+		 * auto_responder: 0|1
376
+		 * ar_email_message: string or ''
377
+		 * ar_email_to: field id
378
+		 * ar_plain_text: 0|1
379
+		 * ar_reply_to_name: string
380
+		 * ar_reply_to: string
381
+		 * ar_email_subject: string
382
+		 * ar_update_email: 0, 1, 2
383
+		 *
384
+		 * New email settings:
385
+		 * post_content: json settings
386
+		 * post_title: form id
387
+		 * post_excerpt: message
388
+		 *
389
+		 */
390
+
391
+		foreach ( $forms as $form ) {
392 392
 			if ( $form->is_template && $form->default_template ) {
393 393
 				// don't migrate the default templates since the email will be added anyway
394 394
 				continue;
395 395
 			}
396 396
 
397
-            // Format form options
398
-            $form_options = maybe_unserialize($form->options);
397
+			// Format form options
398
+			$form_options = maybe_unserialize($form->options);
399 399
 
400
-            // Migrate settings to actions
401
-            FrmXMLHelper::migrate_form_settings_to_actions( $form_options, $form->id );
402
-        }
403
-    }
400
+			// Migrate settings to actions
401
+			FrmXMLHelper::migrate_form_settings_to_actions( $form_options, $form->id );
402
+		}
403
+	}
404 404
 
405
-    private function migrate_to_11() {
406
-        global $wpdb;
405
+	private function migrate_to_11() {
406
+		global $wpdb;
407 407
 
408
-        $forms = FrmDb::get_results( $this->forms, array(), 'id, options');
408
+		$forms = FrmDb::get_results( $this->forms, array(), 'id, options');
409 409
 
410
-        $sending = __( 'Sending', 'formidable' );
410
+		$sending = __( 'Sending', 'formidable' );
411 411
 		$img = FrmAppHelper::plugin_url() . '/images/ajax_loader.gif';
412
-        $old_default_html = <<<DEFAULT_HTML
412
+		$old_default_html = <<<DEFAULT_HTML
413 413
 <div class="frm_submit">
414 414
 [if back_button]<input type="submit" value="[back_label]" name="frm_prev_page" formnovalidate="formnovalidate" [back_hook] />[/if back_button]
415 415
 <input type="submit" value="[button_label]" [button_action] />
416 416
 <img class="frm_ajax_loading" src="$img" alt="$sending" style="visibility:hidden;" />
417 417
 </div>
418 418
 DEFAULT_HTML;
419
-        unset($sending, $img);
419
+		unset($sending, $img);
420 420
 
421
-        $new_default_html = FrmFormsHelper::get_default_html('submit');
422
-        $draft_link = FrmFormsHelper::get_draft_link();
421
+		$new_default_html = FrmFormsHelper::get_default_html('submit');
422
+		$draft_link = FrmFormsHelper::get_draft_link();
423 423
 		foreach ( $forms as $form ) {
424
-            $form->options = maybe_unserialize($form->options);
425
-            if ( ! isset($form->options['submit_html']) || empty($form->options['submit_html']) ) {
426
-                continue;
427
-            }
424
+			$form->options = maybe_unserialize($form->options);
425
+			if ( ! isset($form->options['submit_html']) || empty($form->options['submit_html']) ) {
426
+				continue;
427
+			}
428 428
 
429
-            if ( $form->options['submit_html'] != $new_default_html && $form->options['submit_html'] == $old_default_html ) {
430
-                $form->options['submit_html'] = $new_default_html;
429
+			if ( $form->options['submit_html'] != $new_default_html && $form->options['submit_html'] == $old_default_html ) {
430
+				$form->options['submit_html'] = $new_default_html;
431 431
 				$wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) );
432 432
 			} else if ( ! strpos( $form->options['submit_html'], 'save_draft' ) ) {
433 433
 				$form->options['submit_html'] = preg_replace( '~\<\/div\>(?!.*\<\/div\>)~', $draft_link . "\r\n</div>", $form->options['submit_html'] );
434 434
 				$wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) );
435
-            }
436
-            unset($form);
437
-        }
438
-        unset($forms);
439
-    }
435
+			}
436
+			unset($form);
437
+		}
438
+		unset($forms);
439
+	}
440 440
 
441
-    private function migrate_to_6() {
442
-        global $wpdb;
441
+	private function migrate_to_6() {
442
+		global $wpdb;
443 443
 
444 444
 		$no_save = array_merge( FrmField::no_save_fields(), array( 'form', 'hidden', 'user_id' ) );
445 445
 		$fields = FrmDb::get_results( $this->fields, array( 'type NOT' => $no_save ), 'id, field_options' );
446 446
 
447
-        $default_html = <<<DEFAULT_HTML
447
+		$default_html = <<<DEFAULT_HTML
448 448
 <div id="frm_field_[id]_container" class="form-field [required_class] [error_class]">
449 449
     <label class="frm_pos_[label_position]">[field_name]
450 450
         <span class="frm_required">[required_label]</span>
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 </div>
455 455
 DEFAULT_HTML;
456 456
 
457
-        $old_default_html = <<<DEFAULT_HTML
457
+		$old_default_html = <<<DEFAULT_HTML
458 458
 <div id="frm_field_[id]_container" class="form-field [required_class] [error_class]">
459 459
     <label class="frm_pos_[label_position]">[field_name]
460 460
         <span class="frm_required">[required_label]</span>
@@ -464,27 +464,27 @@  discard block
 block discarded – undo
464 464
 </div>
465 465
 DEFAULT_HTML;
466 466
 
467
-        $new_default_html = FrmFieldsHelper::get_default_html('text');
468
-        foreach ( $fields as $field ) {
469
-            $field->field_options = maybe_unserialize($field->field_options);
467
+		$new_default_html = FrmFieldsHelper::get_default_html('text');
468
+		foreach ( $fields as $field ) {
469
+			$field->field_options = maybe_unserialize($field->field_options);
470 470
 			$html = FrmField::get_option( $field, 'custom_html' );
471 471
 			if ( $html == $default_html || $html == $old_default_html ) {
472
-                $field->field_options['custom_html'] = $new_default_html;
472
+				$field->field_options['custom_html'] = $new_default_html;
473 473
 				$wpdb->update( $this->fields, array( 'field_options' => maybe_serialize( $field->field_options ) ), array( 'id' => $field->id ) );
474
-            }
475
-            unset($field);
476
-        }
477
-        unset($default_html, $old_default_html, $fields);
478
-    }
474
+			}
475
+			unset($field);
476
+		}
477
+		unset($default_html, $old_default_html, $fields);
478
+	}
479 479
 
480 480
 	/**
481 481
 	 * Adds user id to the entry
482 482
 	 */
483
-    private function migrate_to_4() {
484
-        global $wpdb;
483
+	private function migrate_to_4() {
484
+		global $wpdb;
485 485
 		$user_ids = FrmEntryMeta::getAll( array( 'fi.type' => 'user_id' ) );
486
-        foreach ( $user_ids as $user_id ) {
486
+		foreach ( $user_ids as $user_id ) {
487 487
 			$wpdb->update( $this->entries, array( 'user_id' => $user_id->meta_value ), array( 'id' => $user_id->item_id ) );
488
-        }
489
-    }
488
+		}
489
+	}
490 490
 }
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
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
     public function uninstall() {
214 214
 		if ( ! current_user_can( 'administrator' ) ) {
215 215
             $frm_settings = FrmAppHelper::get_settings();
216
-            wp_die($frm_settings->admin_permission);
216
+            wp_die( $frm_settings->admin_permission );
217 217
         }
218 218
 
219 219
         global $wpdb, $wp_roles;
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entries );
224 224
 		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entry_metas );
225 225
 
226
-        delete_option('frm_options');
227
-        delete_option('frm_db_version');
226
+        delete_option( 'frm_options' );
227
+        delete_option( 'frm_db_version' );
228 228
 
229 229
         //delete roles
230 230
         $frm_roles = FrmAppHelper::frm_capabilities();
@@ -232,11 +232,11 @@  discard block
 block discarded – undo
232 232
         foreach ( $frm_roles as $frm_role => $frm_role_description ) {
233 233
             foreach ( $roles as $role => $details ) {
234 234
                 $wp_roles->remove_cap( $role, $frm_role );
235
-                unset($role, $details);
235
+                unset( $role, $details );
236 236
     		}
237
-    		unset($frm_role, $frm_role_description);
237
+    		unset( $frm_role, $frm_role_description );
238 238
 		}
239
-		unset($roles, $frm_roles);
239
+		unset( $roles, $frm_roles );
240 240
 
241 241
 		// delete actions, views, and styles
242 242
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
 		$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_%' ) );
260 260
 
261
-        do_action('frm_after_uninstall');
261
+        do_action( 'frm_after_uninstall' );
262 262
         return true;
263 263
     }
264 264
 
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 
320 320
         $updated = 0;
321 321
         foreach ( $fields as $f ) {
322
-            $f->field_options = maybe_unserialize($f->field_options);
323
-            if ( empty($f->field_options['size']) || ! is_numeric($f->field_options['size']) ) {
322
+            $f->field_options = maybe_unserialize( $f->field_options );
323
+            if ( empty( $f->field_options['size'] ) || ! is_numeric( $f->field_options['size'] ) ) {
324 324
                 continue;
325 325
             }
326 326
 
@@ -328,27 +328,27 @@  discard block
 block discarded – undo
328 328
             $f->field_options['size'] .= 'px';
329 329
             $u = FrmField::update( $f->id, array( 'field_options' => $f->field_options ) );
330 330
             if ( $u ) {
331
-                $updated++;
331
+                $updated ++;
332 332
             }
333
-            unset($f);
333
+            unset( $f );
334 334
         }
335 335
 
336 336
         // Change the characters in widgets to pixels
337
-        $widgets = get_option('widget_frm_show_form');
338
-        if ( empty($widgets) ) {
337
+        $widgets = get_option( 'widget_frm_show_form' );
338
+        if ( empty( $widgets ) ) {
339 339
             return;
340 340
         }
341 341
 
342
-        $widgets = maybe_unserialize($widgets);
342
+        $widgets = maybe_unserialize( $widgets );
343 343
         foreach ( $widgets as $k => $widget ) {
344
-            if ( ! is_array($widget) || ! isset($widget['size']) ) {
344
+            if ( ! is_array( $widget ) || ! isset( $widget['size'] ) ) {
345 345
                 continue;
346 346
             }
347 347
 			$size = round( $pixel_conversion * (int) $widget['size'] );
348 348
             $size .= 'px';
349
-			$widgets[ $k ]['size'] = $size;
349
+			$widgets[$k]['size'] = $size;
350 350
         }
351
-        update_option('widget_frm_show_form', $widgets);
351
+        update_option( 'widget_frm_show_form', $widgets );
352 352
     }
353 353
 
354 354
     /**
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 			}
396 396
 
397 397
             // Format form options
398
-            $form_options = maybe_unserialize($form->options);
398
+            $form_options = maybe_unserialize( $form->options );
399 399
 
400 400
             // Migrate settings to actions
401 401
             FrmXMLHelper::migrate_form_settings_to_actions( $form_options, $form->id );
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
     private function migrate_to_11() {
406 406
         global $wpdb;
407 407
 
408
-        $forms = FrmDb::get_results( $this->forms, array(), 'id, options');
408
+        $forms = FrmDb::get_results( $this->forms, array(), 'id, options' );
409 409
 
410 410
         $sending = __( 'Sending', 'formidable' );
411 411
 		$img = FrmAppHelper::plugin_url() . '/images/ajax_loader.gif';
@@ -416,13 +416,13 @@  discard block
 block discarded – undo
416 416
 <img class="frm_ajax_loading" src="$img" alt="$sending" style="visibility:hidden;" />
417 417
 </div>
418 418
 DEFAULT_HTML;
419
-        unset($sending, $img);
419
+        unset( $sending, $img );
420 420
 
421
-        $new_default_html = FrmFormsHelper::get_default_html('submit');
421
+        $new_default_html = FrmFormsHelper::get_default_html( 'submit' );
422 422
         $draft_link = FrmFormsHelper::get_draft_link();
423 423
 		foreach ( $forms as $form ) {
424
-            $form->options = maybe_unserialize($form->options);
425
-            if ( ! isset($form->options['submit_html']) || empty($form->options['submit_html']) ) {
424
+            $form->options = maybe_unserialize( $form->options );
425
+            if ( ! isset( $form->options['submit_html'] ) || empty( $form->options['submit_html'] ) ) {
426 426
                 continue;
427 427
             }
428 428
 
@@ -433,9 +433,9 @@  discard block
 block discarded – undo
433 433
 				$form->options['submit_html'] = preg_replace( '~\<\/div\>(?!.*\<\/div\>)~', $draft_link . "\r\n</div>", $form->options['submit_html'] );
434 434
 				$wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) );
435 435
             }
436
-            unset($form);
436
+            unset( $form );
437 437
         }
438
-        unset($forms);
438
+        unset( $forms );
439 439
     }
440 440
 
441 441
     private function migrate_to_6() {
@@ -464,17 +464,17 @@  discard block
 block discarded – undo
464 464
 </div>
465 465
 DEFAULT_HTML;
466 466
 
467
-        $new_default_html = FrmFieldsHelper::get_default_html('text');
467
+        $new_default_html = FrmFieldsHelper::get_default_html( 'text' );
468 468
         foreach ( $fields as $field ) {
469
-            $field->field_options = maybe_unserialize($field->field_options);
469
+            $field->field_options = maybe_unserialize( $field->field_options );
470 470
 			$html = FrmField::get_option( $field, 'custom_html' );
471 471
 			if ( $html == $default_html || $html == $old_default_html ) {
472 472
                 $field->field_options['custom_html'] = $new_default_html;
473 473
 				$wpdb->update( $this->fields, array( 'field_options' => maybe_serialize( $field->field_options ) ), array( 'id' => $field->id ) );
474 474
             }
475
-            unset($field);
475
+            unset( $field );
476 476
         }
477
-        unset($default_html, $old_default_html, $fields);
477
+        unset( $default_html, $old_default_html, $fields );
478 478
     }
479 479
 
480 480
 	/**
Please login to merge, or discard this patch.