Completed
Push — master ( efe739...717945 )
by Stephanie
03:35
created

FrmMigrate::migrate_to_11()   C

Complexity

Conditions 7
Paths 5

Size

Total Lines 34
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 7
eloc 23
nc 5
nop 0
dl 0
loc 34
rs 6.7272
c 0
b 0
f 0
1
<?php
2
3
class FrmMigrate {
4
	public $fields;
5
	public $forms;
6
	public $entries;
7
	public $entry_metas;
8
9
	public function __construct() {
10
		if ( ! defined('ABSPATH') ) {
11
			die('You are not allowed to call this page directly.');
12
		}
13
14
		global $wpdb;
15
		$this->fields         = $wpdb->prefix . 'frm_fields';
16
		$this->forms          = $wpdb->prefix . 'frm_forms';
17
		$this->entries        = $wpdb->prefix . 'frm_items';
18
		$this->entry_metas    = $wpdb->prefix . 'frm_item_metas';
19
	}
20
21
	public function upgrade( $old_db_version = false ) {
22
		do_action( 'frm_before_install' );
23
24
		global $wpdb, $frm_vars;
25
26
		$frm_vars['doing_upgrade'] = true;
27
28
		$needs_upgrade = FrmAppController::compare_for_update( array(
29
			'option'             => 'frm_db_version',
30
			'new_db_version'     => FrmAppHelper::$db_version,
31
			'new_plugin_version' => FrmAppHelper::plugin_version(),
32
		) );
33
34
		if ( $needs_upgrade ) {
35
			// update rewrite rules for views and other custom post types
36
			flush_rewrite_rules();
37
38
			require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
39
40
			$this->create_tables();
41
			$this->migrate_data( $old_db_version );
42
43
			/***** SAVE DB VERSION *****/
44
			update_option( 'frm_db_version', FrmAppHelper::plugin_version() . '-' . FrmAppHelper::$db_version );
45
46
			/**** ADD/UPDATE DEFAULT TEMPLATES ****/
47
			FrmXMLController::add_default_templates();
48
49
			if ( ! $old_db_version ) {
50
				$this->maybe_create_contact_form();
51
			}
52
		}
53
54
		do_action('frm_after_install');
55
56
		$frm_vars['doing_upgrade'] = false;
57
58
		FrmAppHelper::save_combined_js();
59
60
		/**** update the styling settings ****/
61
		if ( function_exists( 'get_filesystem_method' ) ) {
62
			$frm_style = new FrmStyle();
63
			$frm_style->update( 'default' );
64
		}
65
	}
66
67
	public function collation() {
68
		global $wpdb;
69
		if ( ! $wpdb->has_cap( 'collation' ) ) {
70
			return '';
71
		}
72
73
		$charset_collate = '';
74
		if ( ! empty( $wpdb->charset ) ) {
75
			$charset_collate .= ' DEFAULT CHARACTER SET ' . $wpdb->charset;
76
		}
77
78
		if ( ! empty( $wpdb->collate ) ) {
79
			$charset_collate .= ' COLLATE ' . $wpdb->collate;
80
		}
81
82
		return $charset_collate;
83
	}
84
85
    private function create_tables() {
86
        $charset_collate = $this->collation();
87
        $sql = array();
88
89
        /* Create/Upgrade Fields Table */
90
		$sql[] = 'CREATE TABLE ' . $this->fields . ' (
91
				id BIGINT(20) NOT NULL auto_increment,
92
				field_key varchar(100) default NULL,
93
                name text default NULL,
94
                description longtext default NULL,
95
                type text default NULL,
96
                default_value longtext default NULL,
97
                options longtext default NULL,
98
                field_order int(11) default 0,
99
                required int(1) default NULL,
100
                field_options longtext default NULL,
101
                form_id int(11) default NULL,
102
                created_at datetime NOT NULL,
103
                PRIMARY KEY  (id),
104
                KEY form_id (form_id),
105
                UNIQUE KEY field_key (field_key)
106
        )';
107
108
        /* Create/Upgrade Forms Table */
109
		$sql[] = 'CREATE TABLE ' . $this->forms . ' (
110
                id int(11) NOT NULL auto_increment,
111
				form_key varchar(100) default NULL,
112
                name varchar(255) default NULL,
113
                description text default NULL,
114
                parent_form_id int(11) default 0,
115
                logged_in tinyint(1) default NULL,
116
                editable tinyint(1) default NULL,
117
                is_template tinyint(1) default 0,
118
                default_template tinyint(1) default 0,
119
                status varchar(255) default NULL,
120
                options longtext default NULL,
121
                created_at datetime NOT NULL,
122
                PRIMARY KEY  (id),
123
                UNIQUE KEY form_key (form_key)
124
        )';
125
126
        /* Create/Upgrade Items Table */
127
		$sql[] = 'CREATE TABLE ' . $this->entries . ' (
128
				id BIGINT(20) NOT NULL auto_increment,
129
				item_key varchar(100) default NULL,
130
                name varchar(255) default NULL,
131
                description text default NULL,
132
                ip text default NULL,
133
				form_id BIGINT(20) default NULL,
134
				post_id BIGINT(20) default NULL,
135
				user_id BIGINT(20) default NULL,
136
				parent_item_id BIGINT(20) default 0,
137
				is_draft tinyint(1) default 0,
138
				updated_by BIGINT(20) default NULL,
139
                created_at datetime NOT NULL,
140
                updated_at datetime NOT NULL,
141
                PRIMARY KEY  (id),
142
                KEY form_id (form_id),
143
                KEY post_id (post_id),
144
                KEY user_id (user_id),
145
                KEY parent_item_id (parent_item_id),
146
                UNIQUE KEY item_key (item_key)
147
        )';
148
149
        /* Create/Upgrade Meta Table */
150
		$sql[] = 'CREATE TABLE ' . $this->entry_metas . ' (
151
				id BIGINT(20) NOT NULL auto_increment,
152
				meta_value longtext default NULL,
153
				field_id BIGINT(20) NOT NULL,
154
				item_id BIGINT(20) NOT NULL,
155
                created_at datetime NOT NULL,
156
                PRIMARY KEY  (id),
157
                KEY field_id (field_id),
158
                KEY item_id (item_id)
159
        )';
160
161
        foreach ( $sql as $q ) {
162
			if ( function_exists( 'dbDelta' ) ) {
163
				dbDelta( $q . $charset_collate . ';' );
164
			} else {
165
				global $wpdb;
166
				$wpdb->query( $q . $charset_collate );
167
			}
168
            unset($q);
169
        }
170
    }
171
172
	private function maybe_create_contact_form() {
173
		$template_id = FrmForm::get_id_by_key( 'contact' );
174
		if ( $template_id ) {
175
			$form_id = FrmForm::duplicate( $template_id, false, true );
176
			if ( $form_id ) {
177
				$values = array(
178
					'status'   => 'published',
179
					'form_key' => 'contact-form',
180
				);
181
				FrmForm::update( $form_id, $values );
182
			}
183
		}
184
	}
185
186
	/**
187
	 * @param int|string $old_db_version
188
	 */
189
	private function migrate_data( $old_db_version ) {
190
		if ( ! $old_db_version ) {
191
			$old_db_version = get_option( 'frm_db_version' );
192
		}
193
		if ( strpos( $old_db_version, '-' ) ) {
194
			$last_upgrade = explode( '-', $old_db_version );
195
			$old_db_version = (int) $last_upgrade[1];
196
		}
197
198
		if ( ! is_numeric( $old_db_version ) ) {
199
			// bail if we don't know the previous version
200
			return;
201
		}
202
203
		$migrations = array( 6, 11, 16, 17, 23, 25, 86 );
204
		foreach ( $migrations as $migration ) {
205
			if ( FrmAppHelper::$db_version >= $migration && $old_db_version < $migration ) {
206
				$function_name = 'migrate_to_' . $migration;
207
				$this->$function_name();
208
			}
209
		}
210
	}
211
212
    public function uninstall() {
213
		if ( ! current_user_can( 'administrator' ) ) {
214
            $frm_settings = FrmAppHelper::get_settings();
215
            wp_die($frm_settings->admin_permission);
216
        }
217
218
        global $wpdb, $wp_roles;
219
220
		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->fields );
221
		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->forms );
222
		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entries );
223
		$wpdb->query( 'DROP TABLE IF EXISTS ' . $this->entry_metas );
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);
237
		}
238
		unset($roles, $frm_roles);
239
240
		// delete actions, views, and styles
241
242
		// prevent the post deletion from triggering entries to be deleted
243
		remove_action( 'before_delete_post', 'FrmProDisplaysController::before_delete_post' );
244
		remove_action( 'deleted_post', 'FrmProEntriesController::delete_entry' );
245
246
		$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' ) );
247
		foreach ( $post_ids as $post_id ) {
248
			// Delete's each post.
249
			wp_delete_post( $post_id, true );
250
		}
251
		unset( $post_ids );
252
253
		// delete transients
254
		delete_transient( 'frmpro_css' );
255
		delete_transient( 'frm_options' );
256
		delete_transient( 'frmpro_options' );
257
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
260
        do_action('frm_after_uninstall');
261
        return true;
262
    }
263
264
	/**
265
	 * Reverse migration 17 -- Divide by 9
266
	 * @since 3.0.05
267
	 */
268
	private function migrate_to_86() {
269
270
		$fields = $this->get_fields_with_size();
271
272
		foreach ( (array) $fields as $f ) {
273
			$f->field_options = maybe_unserialize( $f->field_options );
274
			$size = $f->field_options['size'];
275
			$this->maybe_convert_migrated_size( $size );
276
277
			if ( $size === $f->field_options['size'] ) {
278
				continue;
279
			}
280
281
			$f->field_options['size'] = $size;
282
			FrmField::update( $f->id, array( 'field_options' => $f->field_options ) );
283
			unset( $f );
284
		}
285
286
		// reverse the extra size changes in widgets
287
		$widgets = get_option( 'widget_frm_show_form' );
288
		if ( empty( $widgets ) ) {
289
			return;
290
		}
291
292
		$this->revert_widget_field_size();
293
	}
294
295
	private function get_fields_with_size() {
296
		$field_types = array( 'textarea', 'text', 'number', 'email', 'url', 'rte', 'date', 'phone', 'password', 'image', 'tag', 'file' );
297
		$query = array(
298
			'type' => $field_types,
299
			'field_options like' => 's:4:"size";',
300
			'field_options not like' => 's:4:"size";s:0:',
301
		);
302
303
		return FrmDb::get_results( $this->fields, $query, 'id, field_options' );
304
	}
305
306
	/**
307
	 * reverse the extra size changes in widgets
308
	 * @since 3.0.05
309
	 */
310 View Code Duplication
	private function revert_widget_field_size() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
311
		$widgets = get_option( 'widget_frm_show_form' );
312
		if ( empty( $widgets ) ) {
313
			return;
314
		}
315
316
		$widgets = maybe_unserialize( $widgets );
317
		foreach ( $widgets as $k => $widget ) {
318
			if ( ! is_array( $widget ) || ! isset( $widget['size'] ) ) {
319
				continue;
320
			}
321
322
			$this->maybe_convert_migrated_size( $widgets[ $k ]['size'] );
323
		}
324
		update_option( 'widget_frm_show_form', $widgets );
325
	}
326
327
	/**
328
	 * Divide by 9 to reverse the multiplication
329
	 * @since 3.0.05
330
	 */
331
	private function maybe_convert_migrated_size( &$size ) {
332
		$has_px_size = ! empty( $size ) && strpos( $size, 'px' );
333
		if ( ! $has_px_size ) {
334
			return;
335
		}
336
337
		$int_size = str_replace( 'px', '', $size );
338
		if ( ! is_numeric( $int_size ) || (int) $int_size < 900 ) {
339
			return;
340
		}
341
342
		$pixel_conversion = 9;
343
		$size = round( (int) $int_size / $pixel_conversion );
344
	}
345
346
	/**
347
	 * Migrate old styling settings. If sites are using the old
348
	 * default 400px field width, switch it to 100%
349
	 *
350
	 * @since 2.0.4
351
	 */
352
	private function migrate_to_25() {
353
		// get the style that was created with the style migration
354
		$frm_style = new FrmStyle();
355
		$styles = $frm_style->get_all( 'post_date', 'ASC', 1 );
356
		if ( empty( $styles ) ) {
357
			return;
358
		}
359
360
		foreach ( $styles as $style ) {
361
			if ( $style->post_content['field_width'] == '400px' ) {
362
				$style->post_content['field_width'] = '100%';
363
				$frm_style->save( (array) $style );
364
				return;
365
			}
366
		}
367
	}
368
369
	/**
370
	 * Check if the parent_form_id columns exists.
371
	 * If not, try and add it again
372
	 *
373
	 * @since 2.0.2
374
	 */
375
	private function migrate_to_23() {
376
		global $wpdb;
377
		$exists = $wpdb->get_row( 'SHOW COLUMNS FROM ' . $this->forms . ' LIKE "parent_form_id"' );
378
		if ( empty( $exists ) ) {
379
			$wpdb->query( 'ALTER TABLE ' . $this->forms . ' ADD parent_form_id int(11) default 0' );
380
		}
381
	}
382
383
	/**
384
	 * Change field size from character to pixel -- Multiply by 9
385
	 */
386
	private function migrate_to_17() {
387
		$fields = $this->get_fields_with_size();
388
389
		foreach ( $fields as $f ) {
0 ignored issues
show
Bug introduced by
The expression $fields of type array|null|string|object is not guaranteed to be traversable. How about adding an additional type check?

There are different options of fixing this problem.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
390
			$f->field_options = maybe_unserialize( $f->field_options );
391
			if ( empty( $f->field_options['size'] ) || ! is_numeric( $f->field_options['size'] ) ) {
392
				continue;
393
			}
394
395
			$this->convert_character_to_px( $f->field_options['size'] );
396
397
			FrmField::update( $f->id, array( 'field_options' => $f->field_options ) );
398
			unset( $f );
399
		}
400
401
		$this->adjust_widget_size();
402
	}
403
404
	/**
405
	 * Change the characters in widgets to pixels
406
	 */
407 View Code Duplication
	private function adjust_widget_size() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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
			$this->convert_character_to_px( $widgets[ $k ]['size'] );
419
		}
420
		update_option( 'widget_frm_show_form', $widgets );
421
	}
422
423
	private function convert_character_to_px( &$size ) {
424
		$pixel_conversion = 9;
425
		$size = round( $pixel_conversion * (int) $size );
426
		$size .= 'px';
427
	}
428
429
    /**
430
     * Migrate post and email notification settings into actions
431
     */
432
    private function migrate_to_16() {
433
        $forms = FrmDb::get_results( $this->forms, array(), 'id, options, is_template, default_template' );
434
435
        /**
436
        * Old email settings format:
437
        * email_to: Email or field id
438
        * also_email_to: array of fields ids
439
        * reply_to: Email, field id, 'custom'
440
        * cust_reply_to: string
441
        * reply_to_name: field id, 'custom'
442
        * cust_reply_to_name: string
443
        * plain_text: 0|1
444
        * email_message: string or ''
445
        * email_subject: string or ''
446
        * inc_user_info: 0|1
447
        * update_email: 0, 1, 2
448
        *
449
        * Old autoresponder settings format:
450
        * auto_responder: 0|1
451
        * ar_email_message: string or ''
452
        * ar_email_to: field id
453
        * ar_plain_text: 0|1
454
        * ar_reply_to_name: string
455
        * ar_reply_to: string
456
        * ar_email_subject: string
457
        * ar_update_email: 0, 1, 2
458
        *
459
        * New email settings:
460
        * post_content: json settings
461
        * post_title: form id
462
        * post_excerpt: message
463
        *
464
        */
465
466
        foreach ( $forms as $form ) {
0 ignored issues
show
Bug introduced by
The expression $forms of type array|null|string|object is not guaranteed to be traversable. How about adding an additional type check?

There are different options of fixing this problem.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
467
			if ( $form->is_template && $form->default_template ) {
468
				// don't migrate the default templates since the email will be added anyway
469
				continue;
470
			}
471
472
            // Format form options
473
            $form_options = maybe_unserialize($form->options);
474
475
            // Migrate settings to actions
476
            FrmXMLHelper::migrate_form_settings_to_actions( $form_options, $form->id );
477
        }
478
    }
479
480
    private function migrate_to_11() {
481
        global $wpdb;
482
483
        $forms = FrmDb::get_results( $this->forms, array(), 'id, options');
484
485
        $sending = __( 'Sending', 'formidable' );
486
		$img = FrmAppHelper::plugin_url() . '/images/ajax_loader.gif';
487
        $old_default_html = <<<DEFAULT_HTML
488
<div class="frm_submit">
489
[if back_button]<input type="submit" value="[back_label]" name="frm_prev_page" formnovalidate="formnovalidate" [back_hook] />[/if back_button]
490
<input type="submit" value="[button_label]" [button_action] />
491
<img class="frm_ajax_loading" src="$img" alt="$sending" style="visibility:hidden;" />
492
</div>
493
DEFAULT_HTML;
494
        unset($sending, $img);
495
496
        $new_default_html = FrmFormsHelper::get_default_html('submit');
497
        $draft_link = FrmFormsHelper::get_draft_link();
498
		foreach ( $forms as $form ) {
0 ignored issues
show
Bug introduced by
The expression $forms of type array|null|string|object is not guaranteed to be traversable. How about adding an additional type check?

There are different options of fixing this problem.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
499
            $form->options = maybe_unserialize($form->options);
500
            if ( ! isset($form->options['submit_html']) || empty($form->options['submit_html']) ) {
501
                continue;
502
            }
503
504
            if ( $form->options['submit_html'] != $new_default_html && $form->options['submit_html'] == $old_default_html ) {
505
                $form->options['submit_html'] = $new_default_html;
506
				$wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) );
507
			} else if ( ! strpos( $form->options['submit_html'], 'save_draft' ) ) {
508
				$form->options['submit_html'] = preg_replace( '~\<\/div\>(?!.*\<\/div\>)~', $draft_link . "\r\n</div>", $form->options['submit_html'] );
509
				$wpdb->update( $this->forms, array( 'options' => serialize( $form->options ) ), array( 'id' => $form->id ) );
510
            }
511
            unset($form);
512
        }
513
    }
514
515
    private function migrate_to_6() {
516
        global $wpdb;
517
518
		$no_save = array_merge( FrmField::no_save_fields(), array( 'form', 'hidden', 'user_id' ) );
519
		$fields = FrmDb::get_results( $this->fields, array( 'type NOT' => $no_save ), 'id, field_options' );
520
521
        $default_html = <<<DEFAULT_HTML
522
<div id="frm_field_[id]_container" class="form-field [required_class] [error_class]">
523
    <label class="frm_pos_[label_position]">[field_name]
524
        <span class="frm_required">[required_label]</span>
525
    </label>
526
    [input]
527
    [if description]<div class="frm_description">[description]</div>[/if description]
528
</div>
529
DEFAULT_HTML;
530
531
        $old_default_html = <<<DEFAULT_HTML
532
<div id="frm_field_[id]_container" class="form-field [required_class] [error_class]">
533
    <label class="frm_pos_[label_position]">[field_name]
534
        <span class="frm_required">[required_label]</span>
535
    </label>
536
    [input]
537
    [if description]<p class="frm_description">[description]</p>[/if description]
538
</div>
539
DEFAULT_HTML;
540
541
        $new_default_html = FrmFieldsHelper::get_default_html('text');
542
        foreach ( $fields as $field ) {
0 ignored issues
show
Bug introduced by
The expression $fields of type array|null|string|object is not guaranteed to be traversable. How about adding an additional type check?

There are different options of fixing this problem.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
543
            $field->field_options = maybe_unserialize($field->field_options);
544
			$html = FrmField::get_option( $field, 'custom_html' );
545
			if ( $html == $default_html || $html == $old_default_html ) {
546
                $field->field_options['custom_html'] = $new_default_html;
547
				$wpdb->update( $this->fields, array( 'field_options' => maybe_serialize( $field->field_options ) ), array( 'id' => $field->id ) );
548
            }
549
            unset($field);
550
        }
551
        unset($default_html, $old_default_html, $fields);
552
    }
553
}
554