Completed
Push — master ( 3f265f...9a1967 )
by Stephanie
04:15
created
classes/controllers/FrmFormsController.php 1 patch
Indentation   +628 added lines, -628 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmFormsController {
4 4
 
5
-    public static function menu() {
5
+	public static function menu() {
6 6
 		$menu_label = __( 'Forms', 'formidable' );
7 7
 		if ( ! FrmAppHelper::pro_is_installed() ) {
8 8
 			$menu_label .= ' (Lite)';
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 		add_submenu_page('formidable', 'Formidable | '. $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' );
11 11
 
12 12
 		self::maybe_load_listing_hooks();
13
-    }
13
+	}
14 14
 
15 15
 	public static function maybe_load_listing_hooks() {
16 16
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
@@ -24,127 +24,127 @@  discard block
 block discarded – undo
24 24
 		add_filter('manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' );
25 25
 	}
26 26
 
27
-    public static function head() {
28
-        wp_enqueue_script('formidable-editinplace');
27
+	public static function head() {
28
+		wp_enqueue_script('formidable-editinplace');
29 29
 
30
-        if ( wp_is_mobile() ) {
31
-    		wp_enqueue_script( 'jquery-touch-punch' );
32
-    	}
33
-    }
30
+		if ( wp_is_mobile() ) {
31
+			wp_enqueue_script( 'jquery-touch-punch' );
32
+		}
33
+	}
34 34
 
35
-    public static function register_widgets() {
36
-        require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php');
37
-        register_widget('FrmShowForm');
38
-    }
35
+	public static function register_widgets() {
36
+		require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php');
37
+		register_widget('FrmShowForm');
38
+	}
39 39
 
40
-    public static function list_form() {
41
-        FrmAppHelper::permission_check('frm_view_forms');
40
+	public static function list_form() {
41
+		FrmAppHelper::permission_check('frm_view_forms');
42 42
 
43 43
 		$params = FrmForm::list_page_params();
44
-        $errors = self::process_bulk_form_actions( array());
45
-        $errors = apply_filters('frm_admin_list_form_action', $errors);
44
+		$errors = self::process_bulk_form_actions( array());
45
+		$errors = apply_filters('frm_admin_list_form_action', $errors);
46 46
 
47 47
 		return self::display_forms_list( $params, '', $errors );
48
-    }
48
+	}
49 49
 
50 50
 	public static function new_form( $values = array() ) {
51
-        FrmAppHelper::permission_check('frm_edit_forms');
51
+		FrmAppHelper::permission_check('frm_edit_forms');
52 52
 
53
-        global $frm_vars;
53
+		global $frm_vars;
54 54
 
55
-        $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
55
+		$action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
56 56
 		$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ];
57 57
 
58 58
 		if ( $action == 'create' ) {
59
-            return self::create($values);
59
+			return self::create($values);
60 60
 		} else if ( $action == 'new' ) {
61 61
 			$frm_field_selection = FrmField::field_selection();
62
-            $values = FrmFormsHelper::setup_new_vars($values);
63
-            $id = FrmForm::create( $values );
64
-            $form = FrmForm::getOne($id);
62
+			$values = FrmFormsHelper::setup_new_vars($values);
63
+			$id = FrmForm::create( $values );
64
+			$form = FrmForm::getOne($id);
65 65
 
66
-            // add default email notification
67
-            $action_control = FrmFormActionsController::get_form_actions( 'email' );
68
-            $action_control->create($form->id);
66
+			// add default email notification
67
+			$action_control = FrmFormActionsController::get_form_actions( 'email' );
68
+			$action_control->create($form->id);
69 69
 
70 70
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
71 71
 
72
-            $values['id'] = $id;
73
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
74
-        }
75
-    }
72
+			$values['id'] = $id;
73
+			require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
74
+		}
75
+	}
76 76
 
77 77
 	public static function create( $values = array() ) {
78
-        FrmAppHelper::permission_check('frm_edit_forms');
78
+		FrmAppHelper::permission_check('frm_edit_forms');
79 79
 
80
-        global $frm_vars;
81
-        if ( empty( $values ) ) {
82
-            $values = $_POST;
83
-        }
80
+		global $frm_vars;
81
+		if ( empty( $values ) ) {
82
+			$values = $_POST;
83
+		}
84 84
 
85
-        //Set radio button and checkbox meta equal to "other" value
86
-        if ( FrmAppHelper::pro_is_installed() ) {
87
-            $values = FrmProEntry::mod_other_vals( $values, 'back' );
88
-        }
85
+		//Set radio button and checkbox meta equal to "other" value
86
+		if ( FrmAppHelper::pro_is_installed() ) {
87
+			$values = FrmProEntry::mod_other_vals( $values, 'back' );
88
+		}
89 89
 
90 90
 		$id = isset($values['id']) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
91 91
 
92
-        if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
93
-            $frm_settings = FrmAppHelper::get_settings();
94
-            $errors = array( 'form' => $frm_settings->admin_permission );
95
-        } else {
96
-            $errors = FrmForm::validate($values);
97
-        }
92
+		if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
93
+			$frm_settings = FrmAppHelper::get_settings();
94
+			$errors = array( 'form' => $frm_settings->admin_permission );
95
+		} else {
96
+			$errors = FrmForm::validate($values);
97
+		}
98 98
 
99
-        if ( count($errors) > 0 ) {
100
-            $hide_preview = true;
99
+		if ( count($errors) > 0 ) {
100
+			$hide_preview = true;
101 101
 			$frm_field_selection = FrmField::field_selection();
102
-            $form = FrmForm::getOne( $id );
103
-            $fields = FrmField::get_all_for_form($id);
102
+			$form = FrmForm::getOne( $id );
103
+			$fields = FrmField::get_all_for_form($id);
104 104
 
105
-            $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
105
+			$values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
106 106
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
107 107
 
108
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
109
-        } else {
110
-            FrmForm::update( $id, $values, true );
111
-            die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id='. $id)));
112
-        }
113
-    }
108
+			require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
109
+		} else {
110
+			FrmForm::update( $id, $values, true );
111
+			die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id='. $id)));
112
+		}
113
+	}
114 114
 
115
-    public static function edit( $values = false ) {
116
-        FrmAppHelper::permission_check('frm_edit_forms');
115
+	public static function edit( $values = false ) {
116
+		FrmAppHelper::permission_check('frm_edit_forms');
117 117
 
118 118
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
119
-        return self::get_edit_vars($id);
120
-    }
119
+		return self::get_edit_vars($id);
120
+	}
121 121
 
122
-    public static function settings( $id = false, $message = '' ) {
123
-        FrmAppHelper::permission_check('frm_edit_forms');
122
+	public static function settings( $id = false, $message = '' ) {
123
+		FrmAppHelper::permission_check('frm_edit_forms');
124 124
 
125
-        if ( ! $id || ! is_numeric($id) ) {
125
+		if ( ! $id || ! is_numeric($id) ) {
126 126
 			$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
127
-        }
127
+		}
128 128
 		return self::get_settings_vars( $id, array(), $message );
129
-    }
129
+	}
130 130
 
131
-    public static function update_settings() {
132
-        FrmAppHelper::permission_check('frm_edit_forms');
131
+	public static function update_settings() {
132
+		FrmAppHelper::permission_check('frm_edit_forms');
133 133
 
134 134
 		$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
135 135
 
136
-        $errors = FrmForm::validate($_POST);
137
-        if ( count($errors) > 0 ) {
138
-            return self::get_settings_vars($id, $errors);
139
-        }
136
+		$errors = FrmForm::validate($_POST);
137
+		if ( count($errors) > 0 ) {
138
+			return self::get_settings_vars($id, $errors);
139
+		}
140 140
 
141
-        do_action('frm_before_update_form_settings', $id);
141
+		do_action('frm_before_update_form_settings', $id);
142 142
 
143 143
 		FrmForm::update( $id, $_POST );
144 144
 
145
-        $message = __( 'Settings Successfully Updated', 'formidable' );
145
+		$message = __( 'Settings Successfully Updated', 'formidable' );
146 146
 		return self::get_settings_vars( $id, array(), $message );
147
-    }
147
+	}
148 148
 
149 149
 	public static function edit_key() {
150 150
 		$values = self::edit_in_place_value( 'form_key' );
@@ -174,43 +174,43 @@  discard block
 block discarded – undo
174 174
 
175 175
 	public static function update( $values = array() ) {
176 176
 		if ( empty( $values ) ) {
177
-            $values = $_POST;
178
-        }
177
+			$values = $_POST;
178
+		}
179 179
 
180
-        //Set radio button and checkbox meta equal to "other" value
181
-        if ( FrmAppHelper::pro_is_installed() ) {
182
-            $values = FrmProEntry::mod_other_vals( $values, 'back' );
183
-        }
180
+		//Set radio button and checkbox meta equal to "other" value
181
+		if ( FrmAppHelper::pro_is_installed() ) {
182
+			$values = FrmProEntry::mod_other_vals( $values, 'back' );
183
+		}
184 184
 
185
-        $errors = FrmForm::validate( $values );
186
-        $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' );
187
-        if ( $permission_error !== false ) {
188
-            $errors['form'] = $permission_error;
189
-        }
185
+		$errors = FrmForm::validate( $values );
186
+		$permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' );
187
+		if ( $permission_error !== false ) {
188
+			$errors['form'] = $permission_error;
189
+		}
190 190
 
191 191
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
192 192
 
193 193
 		if ( count( $errors ) > 0 ) {
194
-            return self::get_edit_vars( $id, $errors );
194
+			return self::get_edit_vars( $id, $errors );
195 195
 		} else {
196
-            FrmForm::update( $id, $values );
197
-            $message = __( 'Form was Successfully Updated', 'formidable' );
198
-            if ( defined( 'DOING_AJAX' ) ) {
196
+			FrmForm::update( $id, $values );
197
+			$message = __( 'Form was Successfully Updated', 'formidable' );
198
+			if ( defined( 'DOING_AJAX' ) ) {
199 199
 				wp_die( $message );
200
-            }
200
+			}
201 201
 			return self::get_edit_vars( $id, array(), $message );
202
-        }
203
-    }
202
+		}
203
+	}
204 204
 
205
-    public static function bulk_create_template( $ids ) {
206
-        FrmAppHelper::permission_check( 'frm_edit_forms' );
205
+	public static function bulk_create_template( $ids ) {
206
+		FrmAppHelper::permission_check( 'frm_edit_forms' );
207 207
 
208
-        foreach ( $ids as $id ) {
209
-            FrmForm::duplicate( $id, true, true );
210
-        }
208
+		foreach ( $ids as $id ) {
209
+			FrmForm::duplicate( $id, true, true );
210
+		}
211 211
 
212
-        return __( 'Form template was Successfully Created', 'formidable' );
213
-    }
212
+		return __( 'Form template was Successfully Created', 'formidable' );
213
+	}
214 214
 
215 215
 	/**
216 216
 	 * Redirect to the url for creating from a template
@@ -232,45 +232,45 @@  discard block
 block discarded – undo
232 232
 		wp_die();
233 233
 	}
234 234
 
235
-    public static function duplicate() {
236
-        FrmAppHelper::permission_check('frm_edit_forms');
235
+	public static function duplicate() {
236
+		FrmAppHelper::permission_check('frm_edit_forms');
237 237
 
238 238
 		$params = FrmForm::list_page_params();
239
-        $form = FrmForm::duplicate( $params['id'], $params['template'], true );
240
-        $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
241
-        if ( $form ) {
239
+		$form = FrmForm::duplicate( $params['id'], $params['template'], true );
240
+		$message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
241
+		if ( $form ) {
242 242
 			return self::get_edit_vars( $form, array(), $message, true );
243
-        } else {
244
-            return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' ));
245
-        }
246
-    }
243
+		} else {
244
+			return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' ));
245
+		}
246
+	}
247 247
 
248
-    public static function page_preview() {
248
+	public static function page_preview() {
249 249
 		$params = FrmForm::list_page_params();
250
-        if ( ! $params['form'] ) {
251
-            return;
252
-        }
253
-
254
-        $form = FrmForm::getOne( $params['form'] );
255
-        if ( ! $form ) {
256
-            return;
257
-        }
258
-        return self::show_form( $form->id, '', true, true );
259
-    }
260
-
261
-    public static function preview() {
262
-        do_action( 'frm_wp' );
263
-
264
-        global $frm_vars;
265
-        $frm_vars['preview'] = true;
266
-
267
-        if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) {
268
-            global $wp;
269
-            $root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
270
-            include_once( $root.'/wp-config.php' );
271
-            $wp->init();
272
-            $wp->register_globals();
273
-        }
250
+		if ( ! $params['form'] ) {
251
+			return;
252
+		}
253
+
254
+		$form = FrmForm::getOne( $params['form'] );
255
+		if ( ! $form ) {
256
+			return;
257
+		}
258
+		return self::show_form( $form->id, '', true, true );
259
+	}
260
+
261
+	public static function preview() {
262
+		do_action( 'frm_wp' );
263
+
264
+		global $frm_vars;
265
+		$frm_vars['preview'] = true;
266
+
267
+		if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) {
268
+			global $wp;
269
+			$root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
270
+			include_once( $root.'/wp-config.php' );
271
+			$wp->init();
272
+			$wp->register_globals();
273
+		}
274 274
 
275 275
 		self::register_pro_scripts();
276 276
 
@@ -284,11 +284,11 @@  discard block
 block discarded – undo
284 284
 		$form = FrmForm::getAll( array( 'form_key' => $key ), '', 1 );
285 285
 		if ( empty( $form ) ) {
286 286
 			$form = FrmForm::getAll( array(), '', 1 );
287
-        }
287
+		}
288 288
 
289
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/direct.php');
290
-        wp_die();
291
-    }
289
+		require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/direct.php');
290
+		wp_die();
291
+	}
292 292
 
293 293
 	public static function register_pro_scripts() {
294 294
 		if ( FrmAppHelper::pro_is_installed() ) {
@@ -298,22 +298,22 @@  discard block
 block discarded – undo
298 298
 		}
299 299
 	}
300 300
 
301
-    public static function untrash() {
301
+	public static function untrash() {
302 302
 		self::change_form_status( 'untrash' );
303
-    }
303
+	}
304 304
 
305 305
 	public static function bulk_untrash( $ids ) {
306
-        FrmAppHelper::permission_check('frm_edit_forms');
306
+		FrmAppHelper::permission_check('frm_edit_forms');
307 307
 
308
-        $count = FrmForm::set_status( $ids, 'published' );
308
+		$count = FrmForm::set_status( $ids, 'published' );
309 309
 
310
-        $message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
311
-        return $message;
312
-    }
310
+		$message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
311
+		return $message;
312
+	}
313 313
 
314
-    public static function trash() {
314
+	public static function trash() {
315 315
 		self::change_form_status( 'trash' );
316
-    }
316
+	}
317 317
 
318 318
 	/**
319 319
 	 * @param string $status
@@ -351,68 +351,68 @@  discard block
 block discarded – undo
351 351
 	}
352 352
 
353 353
 	public static function bulk_trash( $ids ) {
354
-        FrmAppHelper::permission_check('frm_delete_forms');
354
+		FrmAppHelper::permission_check('frm_delete_forms');
355 355
 
356
-        $count = 0;
357
-        foreach ( $ids as $id ) {
358
-            if ( FrmForm::trash( $id ) ) {
359
-                $count++;
360
-            }
361
-        }
356
+		$count = 0;
357
+		foreach ( $ids as $id ) {
358
+			if ( FrmForm::trash( $id ) ) {
359
+				$count++;
360
+			}
361
+		}
362 362
 
363
-        $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
364
-        $message = sprintf(_n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="'. esc_url(wp_nonce_url( '?page=formidable&frm_action=list&action=bulk_untrash&form_type='. $current_page .'&item-action[]='. implode('item-action[]=', $ids), 'bulk-toplevel_page_formidable' )) .'">', '</a>' );
363
+		$current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
364
+		$message = sprintf(_n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="'. esc_url(wp_nonce_url( '?page=formidable&frm_action=list&action=bulk_untrash&form_type='. $current_page .'&item-action[]='. implode('item-action[]=', $ids), 'bulk-toplevel_page_formidable' )) .'">', '</a>' );
365 365
 
366
-        return $message;
367
-    }
366
+		return $message;
367
+	}
368 368
 
369
-    public static function destroy() {
370
-        FrmAppHelper::permission_check('frm_delete_forms');
369
+	public static function destroy() {
370
+		FrmAppHelper::permission_check('frm_delete_forms');
371 371
 
372 372
 		$params = FrmForm::list_page_params();
373 373
 
374
-        //check nonce url
375
-        check_admin_referer('destroy_form_' . $params['id']);
374
+		//check nonce url
375
+		check_admin_referer('destroy_form_' . $params['id']);
376 376
 
377
-        $count = 0;
378
-        if ( FrmForm::destroy( $params['id'] ) ) {
379
-            $count++;
380
-        }
377
+		$count = 0;
378
+		if ( FrmForm::destroy( $params['id'] ) ) {
379
+			$count++;
380
+		}
381 381
 
382
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
382
+		$message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
383 383
 
384 384
 		self::display_forms_list( $params, $message );
385
-    }
385
+	}
386 386
 
387 387
 	public static function bulk_destroy( $ids ) {
388
-        FrmAppHelper::permission_check('frm_delete_forms');
388
+		FrmAppHelper::permission_check('frm_delete_forms');
389 389
 
390
-        $count = 0;
391
-        foreach ( $ids as $id ) {
392
-            $d = FrmForm::destroy( $id );
393
-            if ( $d ) {
394
-                $count++;
395
-            }
396
-        }
390
+		$count = 0;
391
+		foreach ( $ids as $id ) {
392
+			$d = FrmForm::destroy( $id );
393
+			if ( $d ) {
394
+				$count++;
395
+			}
396
+		}
397 397
 
398
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
398
+		$message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
399 399
 
400
-        return $message;
401
-    }
400
+		return $message;
401
+	}
402 402
 
403
-    private static function delete_all() {
404
-        //check nonce url
405
-        $permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable');
406
-        if ( $permission_error !== false ) {
403
+	private static function delete_all() {
404
+		//check nonce url
405
+		$permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable');
406
+		if ( $permission_error !== false ) {
407 407
 			self::display_forms_list( array(), '', array( $permission_error ) );
408
-            return;
409
-        }
408
+			return;
409
+		}
410 410
 
411 411
 		$count = FrmForm::scheduled_delete( time() );
412
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
412
+		$message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
413 413
 
414 414
 		self::display_forms_list( array(), $message );
415
-    }
415
+	}
416 416
 
417 417
 	public static function scheduled_delete( $delete_timestamp = '' ) {
418 418
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::scheduled_delete' );
@@ -420,11 +420,11 @@  discard block
 block discarded – undo
420 420
 	}
421 421
 
422 422
 	/**
423
-	* Inserts Formidable button
424
-	* Hook exists since 2.5.0
425
-	*
426
-	* @since 2.0.15
427
-	*/
423
+	 * Inserts Formidable button
424
+	 * Hook exists since 2.5.0
425
+	 *
426
+	 * @since 2.0.15
427
+	 */
428 428
 	public static function insert_form_button() {
429 429
 		if ( current_user_can('frm_view_forms') ) {
430 430
 			$menu_name = FrmAppHelper::get_menu_name();
@@ -435,49 +435,49 @@  discard block
 block discarded – undo
435 435
 		}
436 436
 	}
437 437
 
438
-    public static function insert_form_popup() {
438
+	public static function insert_form_popup() {
439 439
 		$page = basename( FrmAppHelper::get_server_value( 'PHP_SELF' ) );
440 440
 		if ( ! in_array( $page, array( 'post.php', 'page.php', 'page-new.php', 'post-new.php' ) ) ) {
441
-            return;
442
-        }
441
+			return;
442
+		}
443 443
 
444
-        FrmAppHelper::load_admin_wide_js();
444
+		FrmAppHelper::load_admin_wide_js();
445 445
 
446
-        $shortcodes = array(
446
+		$shortcodes = array(
447 447
 			'formidable' => array( 'name' => __( 'Form', 'formidable' ), 'label' => __( 'Insert a Form', 'formidable' ) ),
448
-        );
448
+		);
449 449
 
450
-        $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes);
450
+		$shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes);
451 451
 
452
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/insert_form_popup.php');
453
-    }
452
+		include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/insert_form_popup.php');
453
+	}
454 454
 
455
-    public static function get_shortcode_opts() {
455
+	public static function get_shortcode_opts() {
456 456
 		FrmAppHelper::permission_check('frm_view_forms');
457
-        check_ajax_referer( 'frm_ajax', 'nonce' );
457
+		check_ajax_referer( 'frm_ajax', 'nonce' );
458 458
 
459 459
 		$shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' );
460
-        if ( empty($shortcode) ) {
461
-            wp_die();
462
-        }
460
+		if ( empty($shortcode) ) {
461
+			wp_die();
462
+		}
463 463
 
464
-        echo '<div id="sc-opts-'. esc_attr( $shortcode ) .'" class="frm_shortcode_option">';
465
-        echo '<input type="radio" name="frmsc" value="'. esc_attr($shortcode) .'" id="sc-'. esc_attr($shortcode) .'" class="frm_hidden" />';
464
+		echo '<div id="sc-opts-'. esc_attr( $shortcode ) .'" class="frm_shortcode_option">';
465
+		echo '<input type="radio" name="frmsc" value="'. esc_attr($shortcode) .'" id="sc-'. esc_attr($shortcode) .'" class="frm_hidden" />';
466 466
 
467
-        $form_id = '';
468
-        $opts = array();
467
+		$form_id = '';
468
+		$opts = array();
469 469
 		switch ( $shortcode ) {
470
-            case 'formidable':
471
-                $opts = array(
470
+			case 'formidable':
471
+				$opts = array(
472 472
 					'form_id'       => 'id',
473
-                    //'key' => ',
473
+					//'key' => ',
474 474
 					'title'         => array( 'val' => 1, 'label' => __( 'Display form title', 'formidable' ) ),
475 475
 					'description'   => array( 'val' => 1, 'label' => __( 'Display form description', 'formidable' ) ),
476 476
 					'minimize'      => array( 'val' => 1, 'label' => __( 'Minimize form HTML', 'formidable' ) ),
477
-                );
478
-            break;
479
-        }
480
-        $opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode);
477
+				);
478
+			break;
479
+		}
480
+		$opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode);
481 481
 
482 482
 		if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) {
483 483
 			// allow other shortcodes to use the required form id option
@@ -485,63 +485,63 @@  discard block
 block discarded – undo
485 485
 			unset( $opts['form_id'] );
486 486
 		}
487 487
 
488
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/shortcode_opts.php');
488
+		include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/shortcode_opts.php');
489 489
 
490
-        echo '</div>';
490
+		echo '</div>';
491 491
 
492
-        wp_die();
493
-    }
492
+		wp_die();
493
+	}
494 494
 
495 495
 	public static function display_forms_list( $params = array(), $message = '', $errors = array(), $deprecated_errors = array() ) {
496
-        FrmAppHelper::permission_check( 'frm_view_forms' );
496
+		FrmAppHelper::permission_check( 'frm_view_forms' );
497 497
 		if ( ! empty( $deprecated_errors ) ) {
498 498
 			$errors = $deprecated_errors;
499 499
 			_deprecated_argument( 'errors', '2.0.8' );
500 500
 		}
501 501
 
502
-        global $wpdb, $frm_vars;
502
+		global $wpdb, $frm_vars;
503 503
 
504 504
 		if ( empty( $params ) ) {
505 505
 			$params = FrmForm::list_page_params();
506
-        }
506
+		}
507 507
 
508
-        $wp_list_table = new FrmFormsListHelper( compact( 'params' ) );
508
+		$wp_list_table = new FrmFormsListHelper( compact( 'params' ) );
509 509
 
510
-        $pagenum = $wp_list_table->get_pagenum();
510
+		$pagenum = $wp_list_table->get_pagenum();
511 511
 
512
-        $wp_list_table->prepare_items();
512
+		$wp_list_table->prepare_items();
513 513
 
514
-        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
515
-        if ( $pagenum > $total_pages && $total_pages > 0 ) {
514
+		$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
515
+		if ( $pagenum > $total_pages && $total_pages > 0 ) {
516 516
 			wp_redirect( esc_url_raw( add_query_arg( 'paged', $total_pages ) ) );
517
-            die();
518
-        }
517
+			die();
518
+		}
519 519
 
520
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/list.php');
521
-    }
520
+		require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/list.php');
521
+	}
522 522
 
523 523
 	public static function get_columns( $columns ) {
524
-	    $columns['cb'] = '<input type="checkbox" />';
525
-	    $columns['id'] = 'ID';
524
+		$columns['cb'] = '<input type="checkbox" />';
525
+		$columns['id'] = 'ID';
526 526
 
527
-        $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : 'published';
527
+		$type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : 'published';
528 528
 
529
-        if ( 'template' == $type ) {
530
-            $columns['name']        = __( 'Template Name', 'formidable' );
531
-            $columns['type']        = __( 'Type', 'formidable' );
532
-            $columns['form_key']    = __( 'Key', 'formidable' );
533
-        } else {
534
-            $columns['name']        = __( 'Form Title', 'formidable' );
535
-            $columns['entries']     = __( 'Entries', 'formidable' );
536
-            $columns['form_key']    = __( 'Key', 'formidable' );
537
-            $columns['shortcode']   = __( 'Shortcodes', 'formidable' );
538
-        }
529
+		if ( 'template' == $type ) {
530
+			$columns['name']        = __( 'Template Name', 'formidable' );
531
+			$columns['type']        = __( 'Type', 'formidable' );
532
+			$columns['form_key']    = __( 'Key', 'formidable' );
533
+		} else {
534
+			$columns['name']        = __( 'Form Title', 'formidable' );
535
+			$columns['entries']     = __( 'Entries', 'formidable' );
536
+			$columns['form_key']    = __( 'Key', 'formidable' );
537
+			$columns['shortcode']   = __( 'Shortcodes', 'formidable' );
538
+		}
539 539
 
540
-        $columns['created_at'] = __( 'Date', 'formidable' );
540
+		$columns['created_at'] = __( 'Date', 'formidable' );
541 541
 
542 542
 		add_screen_option( 'per_page', array( 'label' => __( 'Forms', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_per_page' ) );
543 543
 
544
-        return $columns;
544
+		return $columns;
545 545
 	}
546 546
 
547 547
 	public static function get_sortable_columns() {
@@ -555,110 +555,110 @@  discard block
 block discarded – undo
555 555
 	}
556 556
 
557 557
 	public static function hidden_columns( $result ) {
558
-        $return = false;
559
-        foreach ( (array) $result as $r ) {
560
-            if ( ! empty( $r ) ) {
561
-                $return = true;
562
-                break;
563
-            }
564
-        }
558
+		$return = false;
559
+		foreach ( (array) $result as $r ) {
560
+			if ( ! empty( $r ) ) {
561
+				$return = true;
562
+				break;
563
+			}
564
+		}
565 565
 
566
-        if ( $return ) {
567
-            return $result;
566
+		if ( $return ) {
567
+			return $result;
568 568
 		}
569 569
 
570
-        $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
570
+		$type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
571 571
 
572
-        $result[] = 'created_at';
573
-        if ( $type == 'template' ) {
574
-            $result[] = 'id';
575
-            $result[] = 'form_key';
576
-        }
572
+		$result[] = 'created_at';
573
+		if ( $type == 'template' ) {
574
+			$result[] = 'id';
575
+			$result[] = 'form_key';
576
+		}
577 577
 
578
-        return $result;
579
-    }
578
+		return $result;
579
+	}
580 580
 
581 581
 	public static function save_per_page( $save, $option, $value ) {
582
-        if ( $option == 'formidable_page_formidable_per_page' ) {
583
-            $save = (int) $value;
584
-        }
585
-        return $save;
586
-    }
582
+		if ( $option == 'formidable_page_formidable_per_page' ) {
583
+			$save = (int) $value;
584
+		}
585
+		return $save;
586
+	}
587 587
 
588 588
 	private static function get_edit_vars( $id, $errors = array(), $message = '', $create_link = false ) {
589
-        global $frm_vars;
589
+		global $frm_vars;
590 590
 
591
-        $form = FrmForm::getOne( $id );
592
-        if ( ! $form ) {
593
-            wp_die( __( 'You are trying to edit a form that does not exist.', 'formidable' ) );
594
-        }
591
+		$form = FrmForm::getOne( $id );
592
+		if ( ! $form ) {
593
+			wp_die( __( 'You are trying to edit a form that does not exist.', 'formidable' ) );
594
+		}
595 595
 
596
-        if ( $form->parent_form_id ) {
596
+		if ( $form->parent_form_id ) {
597 597
 			wp_die( sprintf( __( 'You are trying to edit a child form. Please edit from %1$shere%2$s', 'formidable' ), '<a href="'. esc_url( admin_url( 'admin.php?page=formidable&frm_action=edit&id='. $form->parent_form_id ) ) . '">', '</a>' ));
598
-        }
598
+		}
599 599
 
600 600
 		$frm_field_selection = FrmField::field_selection();
601
-        $fields = FrmField::get_all_for_form($form->id);
601
+		$fields = FrmField::get_all_for_form($form->id);
602 602
 
603
-        // Automatically add end section fields if they don't exist (2.0 migration)
604
-        $reset_fields = false;
605
-        FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields );
603
+		// Automatically add end section fields if they don't exist (2.0 migration)
604
+		$reset_fields = false;
605
+		FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields );
606 606
 
607
-        if ( $reset_fields ) {
608
-            $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
609
-        }
607
+		if ( $reset_fields ) {
608
+			$fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
609
+		}
610 610
 
611
-        unset($end_section_values, $last_order, $open, $reset_fields);
611
+		unset($end_section_values, $last_order, $open, $reset_fields);
612 612
 
613
-        $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
613
+		$values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
614 614
 
615
-        $edit_message = __( 'Form was Successfully Updated', 'formidable' );
616
-        if ( $form->is_template && $message == $edit_message ) {
617
-            $message = __( 'Template was Successfully Updated', 'formidable' );
618
-        }
615
+		$edit_message = __( 'Form was Successfully Updated', 'formidable' );
616
+		if ( $form->is_template && $message == $edit_message ) {
617
+			$message = __( 'Template was Successfully Updated', 'formidable' );
618
+		}
619 619
 
620 620
 		$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
621 621
 
622
-        if ( $form->default_template ) {
623
-            wp_die(__( 'That template cannot be edited', 'formidable' ));
624
-        } else if ( defined('DOING_AJAX') ) {
625
-            wp_die();
626
-        } else if ( $create_link ) {
627
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
628
-        } else {
629
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/edit.php');
630
-        }
631
-    }
622
+		if ( $form->default_template ) {
623
+			wp_die(__( 'That template cannot be edited', 'formidable' ));
624
+		} else if ( defined('DOING_AJAX') ) {
625
+			wp_die();
626
+		} else if ( $create_link ) {
627
+			require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
628
+		} else {
629
+			require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/edit.php');
630
+		}
631
+	}
632 632
 
633 633
 	public static function get_settings_vars( $id, $errors = array(), $message = '' ) {
634 634
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
635 635
 
636
-        global $frm_vars;
636
+		global $frm_vars;
637 637
 
638
-        $form = FrmForm::getOne( $id );
638
+		$form = FrmForm::getOne( $id );
639 639
 
640
-        $fields = FrmField::get_all_for_form($id);
641
-        $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
640
+		$fields = FrmField::get_all_for_form($id);
641
+		$values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
642 642
 
643
-        if ( isset($values['default_template']) && $values['default_template'] ) {
644
-            wp_die(__( 'That template cannot be edited', 'formidable' ));
645
-        }
643
+		if ( isset($values['default_template']) && $values['default_template'] ) {
644
+			wp_die(__( 'That template cannot be edited', 'formidable' ));
645
+		}
646 646
 
647
-        $action_controls = FrmFormActionsController::get_form_actions();
647
+		$action_controls = FrmFormActionsController::get_form_actions();
648 648
 
649
-        $sections = apply_filters('frm_add_form_settings_section', array(), $values);
650
-        $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
649
+		$sections = apply_filters('frm_add_form_settings_section', array(), $values);
650
+		$pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
651 651
 
652
-        $styles = apply_filters('frm_get_style_opts', array());
652
+		$styles = apply_filters('frm_get_style_opts', array());
653 653
 
654
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/settings.php');
655
-    }
654
+		require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/settings.php');
655
+	}
656 656
 
657
-    public static function mb_tags_box( $form_id, $class = '' ) {
658
-        $fields = FrmField::get_all_for_form($form_id, '', 'include');
659
-        $linked_forms = array();
660
-        $col = 'one';
661
-        $settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false;
657
+	public static function mb_tags_box( $form_id, $class = '' ) {
658
+		$fields = FrmField::get_all_for_form($form_id, '', 'include');
659
+		$linked_forms = array();
660
+		$col = 'one';
661
+		$settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false;
662 662
 
663 663
 		$cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() );
664 664
 		$adv_shortcodes = self::get_advanced_shortcodes();
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 		$entry_shortcodes = self::get_shortcode_helpers( $settings_tab );
667 667
 
668 668
 		include( FrmAppHelper::plugin_path() . '/classes/views/shared/mb_adv_info.php' );
669
-    }
669
+	}
670 670
 
671 671
 	/**
672 672
 	 * Get an array of the options to display in the advanced tab
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 			''          => '',
708 708
 			'siteurl'   => __( 'Site URL', 'formidable' ),
709 709
 			'sitename'  => __( 'Site Name', 'formidable' ),
710
-        );
710
+		);
711 711
 
712 712
 		if ( ! FrmAppHelper::pro_is_installed() ) {
713 713
 			unset( $entry_shortcodes['post_id'] );
@@ -734,39 +734,39 @@  discard block
 block discarded – undo
734 734
 		return $entry_shortcodes;
735 735
 	}
736 736
 
737
-    // Insert the form class setting into the form
737
+	// Insert the form class setting into the form
738 738
 	public static function form_classes( $form ) {
739
-        if ( isset($form->options['form_class']) ) {
739
+		if ( isset($form->options['form_class']) ) {
740 740
 			echo esc_attr( sanitize_text_field( $form->options['form_class'] ) );
741
-        }
742
-    }
741
+		}
742
+	}
743 743
 
744
-    public static function get_email_html() {
744
+	public static function get_email_html() {
745 745
 		FrmAppHelper::permission_check('frm_view_forms');
746
-        check_ajax_referer( 'frm_ajax', 'nonce' );
746
+		check_ajax_referer( 'frm_ajax', 'nonce' );
747 747
 		echo FrmEntryFormat::show_entry( array(
748 748
 			'form_id'       => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ),
749
-	        'default_email' => true,
749
+			'default_email' => true,
750 750
 			'plain_text'    => FrmAppHelper::get_post_param( 'plain_text', '', 'absint' ),
751
-	    ) );
752
-	    wp_die();
751
+		) );
752
+		wp_die();
753 753
 	}
754 754
 
755
-    public static function filter_content( $content, $form, $entry = false ) {
755
+	public static function filter_content( $content, $form, $entry = false ) {
756 756
 		self::get_entry_by_param( $entry );
757
-        if ( ! $entry ) {
758
-            return $content;
759
-        }
757
+		if ( ! $entry ) {
758
+			return $content;
759
+		}
760 760
 
761
-        if ( is_object( $form ) ) {
762
-            $form = $form->id;
763
-        }
761
+		if ( is_object( $form ) ) {
762
+			$form = $form->id;
763
+		}
764 764
 
765
-        $shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form );
766
-        $content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes );
765
+		$shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form );
766
+		$content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes );
767 767
 
768
-        return $content;
769
-    }
768
+		return $content;
769
+	}
770 770
 
771 771
 	private static function get_entry_by_param( &$entry ) {
772 772
 		if ( ! $entry || ! is_object( $entry ) ) {
@@ -778,287 +778,287 @@  discard block
 block discarded – undo
778 778
 		}
779 779
 	}
780 780
 
781
-    public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
782
-        return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes );
783
-    }
781
+	public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
782
+		return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes );
783
+	}
784 784
 
785
-    public static function process_bulk_form_actions( $errors ) {
786
-        if ( ! $_REQUEST ) {
787
-            return $errors;
788
-        }
785
+	public static function process_bulk_form_actions( $errors ) {
786
+		if ( ! $_REQUEST ) {
787
+			return $errors;
788
+		}
789 789
 
790 790
 		$bulkaction = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
791
-        if ( $bulkaction == -1 ) {
791
+		if ( $bulkaction == -1 ) {
792 792
 			$bulkaction = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
793
-        }
794
-
795
-        if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) {
796
-            FrmAppHelper::remove_get_action();
797
-
798
-            $bulkaction = str_replace( 'bulk_', '', $bulkaction );
799
-        }
800
-
801
-        $ids = FrmAppHelper::get_param( 'item-action', '' );
802
-        if ( empty( $ids ) ) {
803
-            $errors[] = __( 'No forms were specified', 'formidable' );
804
-            return $errors;
805
-        }
806
-
807
-        $permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' );
808
-        if ( $permission_error !== false ) {
809
-            $errors[] = $permission_error;
810
-            return $errors;
811
-        }
812
-
813
-        if ( ! is_array( $ids ) ) {
814
-            $ids = explode( ',', $ids );
815
-        }
816
-
817
-        switch ( $bulkaction ) {
818
-            case 'delete':
819
-                $message = self::bulk_destroy( $ids );
820
-            break;
821
-            case 'trash':
822
-                $message = self::bulk_trash( $ids );
823
-            break;
824
-            case 'untrash':
825
-                $message = self::bulk_untrash( $ids );
826
-            break;
827
-            case 'create_template':
828
-                $message = self::bulk_create_template( $ids );
829
-            break;
830
-        }
831
-
832
-        if ( isset( $message ) && ! empty( $message ) ) {
793
+		}
794
+
795
+		if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) {
796
+			FrmAppHelper::remove_get_action();
797
+
798
+			$bulkaction = str_replace( 'bulk_', '', $bulkaction );
799
+		}
800
+
801
+		$ids = FrmAppHelper::get_param( 'item-action', '' );
802
+		if ( empty( $ids ) ) {
803
+			$errors[] = __( 'No forms were specified', 'formidable' );
804
+			return $errors;
805
+		}
806
+
807
+		$permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' );
808
+		if ( $permission_error !== false ) {
809
+			$errors[] = $permission_error;
810
+			return $errors;
811
+		}
812
+
813
+		if ( ! is_array( $ids ) ) {
814
+			$ids = explode( ',', $ids );
815
+		}
816
+
817
+		switch ( $bulkaction ) {
818
+			case 'delete':
819
+				$message = self::bulk_destroy( $ids );
820
+			break;
821
+			case 'trash':
822
+				$message = self::bulk_trash( $ids );
823
+			break;
824
+			case 'untrash':
825
+				$message = self::bulk_untrash( $ids );
826
+			break;
827
+			case 'create_template':
828
+				$message = self::bulk_create_template( $ids );
829
+			break;
830
+		}
831
+
832
+		if ( isset( $message ) && ! empty( $message ) ) {
833 833
 			echo '<div id="message" class="updated frm_msg_padding">' . FrmAppHelper::kses( $message ) . '</div>';
834
-        }
834
+		}
835 835
 
836
-        return $errors;
837
-    }
836
+		return $errors;
837
+	}
838 838
 
839
-    public static function add_default_templates( $path, $default = true, $template = true ) {
840
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' );
839
+	public static function add_default_templates( $path, $default = true, $template = true ) {
840
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' );
841 841
 
842
-        $path = untrailingslashit(trim($path));
843
-        $templates = glob( $path .'/*.php' );
842
+		$path = untrailingslashit(trim($path));
843
+		$templates = glob( $path .'/*.php' );
844 844
 
845 845
 		for ( $i = count( $templates ) - 1; $i >= 0; $i-- ) {
846
-            $filename = str_replace( '.php', '', str_replace( $path.'/', '', $templates[ $i ] ) );
846
+			$filename = str_replace( '.php', '', str_replace( $path.'/', '', $templates[ $i ] ) );
847 847
 			$template_query = array( 'form_key' => $filename );
848
-            if ( $template ) {
849
-                $template_query['is_template'] = 1;
850
-            }
851
-            if ( $default ) {
852
-                $template_query['default_template'] = 1;
853
-            }
848
+			if ( $template ) {
849
+				$template_query['is_template'] = 1;
850
+			}
851
+			if ( $default ) {
852
+				$template_query['default_template'] = 1;
853
+			}
854 854
 			$form = FrmForm::getAll( $template_query, '', 1 );
855 855
 
856
-            $values = FrmFormsHelper::setup_new_vars();
857
-            $values['form_key'] = $filename;
858
-            $values['is_template'] = $template;
859
-            $values['status'] = 'published';
860
-            if ( $default ) {
861
-                $values['default_template'] = 1;
862
-            }
863
-
864
-            include( $templates[ $i ] );
865
-
866
-            //get updated form
867
-            if ( isset($form) && ! empty($form) ) {
868
-                $old_id = $form->id;
869
-                $form = FrmForm::getOne($form->id);
870
-            } else {
871
-                $old_id = false;
856
+			$values = FrmFormsHelper::setup_new_vars();
857
+			$values['form_key'] = $filename;
858
+			$values['is_template'] = $template;
859
+			$values['status'] = 'published';
860
+			if ( $default ) {
861
+				$values['default_template'] = 1;
862
+			}
863
+
864
+			include( $templates[ $i ] );
865
+
866
+			//get updated form
867
+			if ( isset($form) && ! empty($form) ) {
868
+				$old_id = $form->id;
869
+				$form = FrmForm::getOne($form->id);
870
+			} else {
871
+				$old_id = false;
872 872
 				$form = FrmForm::getAll( $template_query, '', 1 );
873
-            }
873
+			}
874 874
 
875
-            if ( $form ) {
875
+			if ( $form ) {
876 876
 				do_action( 'frm_after_duplicate_form', $form->id, (array) $form, array( 'old_id' => $old_id ) );
877
-            }
878
-        }
879
-    }
877
+			}
878
+		}
879
+	}
880 880
 
881
-    public static function route() {
882
-        $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
883
-        $vars = array();
881
+	public static function route() {
882
+		$action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
883
+		$vars = array();
884 884
 		if ( isset( $_POST['frm_compact_fields'] ) ) {
885 885
 			FrmAppHelper::permission_check( 'frm_edit_forms' );
886 886
 
887
-            $json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('&quot;', '\\\"', $_POST['frm_compact_fields'] ))));
888
-            $json_vars = json_decode($json_vars, true);
889
-            if ( empty($json_vars) ) {
890
-                // json decoding failed so we should return an error message
887
+			$json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('&quot;', '\\\"', $_POST['frm_compact_fields'] ))));
888
+			$json_vars = json_decode($json_vars, true);
889
+			if ( empty($json_vars) ) {
890
+				// json decoding failed so we should return an error message
891 891
 				$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
892
-                if ( 'edit' == $action ) {
893
-                    $action = 'update';
894
-                }
895
-
896
-                add_filter('frm_validate_form', 'FrmFormsController::json_error');
897
-            } else {
898
-                $vars = FrmAppHelper::json_to_array($json_vars);
899
-                $action = $vars[ $action ];
892
+				if ( 'edit' == $action ) {
893
+					$action = 'update';
894
+				}
895
+
896
+				add_filter('frm_validate_form', 'FrmFormsController::json_error');
897
+			} else {
898
+				$vars = FrmAppHelper::json_to_array($json_vars);
899
+				$action = $vars[ $action ];
900 900
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] );
901 901
 				$_REQUEST = array_merge( $_REQUEST, $vars );
902 902
 				$_POST = array_merge( $_POST, $_REQUEST );
903
-            }
904
-        } else {
903
+			}
904
+		} else {
905 905
 			$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
906
-    		if ( isset( $_REQUEST['delete_all'] ) ) {
907
-                // override the action for this page
908
-    			$action = 'delete_all';
909
-            }
910
-        }
906
+			if ( isset( $_REQUEST['delete_all'] ) ) {
907
+				// override the action for this page
908
+				$action = 'delete_all';
909
+			}
910
+		}
911 911
 
912 912
 		add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' );
913
-        FrmAppHelper::trigger_hook_load( 'form' );
914
-
915
-        switch ( $action ) {
916
-            case 'new':
917
-                return self::new_form($vars);
918
-            case 'create':
919
-            case 'edit':
920
-            case 'update':
921
-            case 'duplicate':
922
-            case 'trash':
923
-            case 'untrash':
924
-            case 'destroy':
925
-            case 'delete_all':
926
-            case 'settings':
927
-            case 'update_settings':
913
+		FrmAppHelper::trigger_hook_load( 'form' );
914
+
915
+		switch ( $action ) {
916
+			case 'new':
917
+				return self::new_form($vars);
918
+			case 'create':
919
+			case 'edit':
920
+			case 'update':
921
+			case 'duplicate':
922
+			case 'trash':
923
+			case 'untrash':
924
+			case 'destroy':
925
+			case 'delete_all':
926
+			case 'settings':
927
+			case 'update_settings':
928 928
 				return self::$action( $vars );
929
-            default:
930
-                do_action('frm_form_action_'. $action);
931
-                if ( apply_filters('frm_form_stop_action_'. $action, false) ) {
932
-                    return;
933
-                }
929
+			default:
930
+				do_action('frm_form_action_'. $action);
931
+				if ( apply_filters('frm_form_stop_action_'. $action, false) ) {
932
+					return;
933
+				}
934 934
 
935 935
 				$action = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
936
-                if ( $action == -1 ) {
936
+				if ( $action == -1 ) {
937 937
 					$action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
938
-                }
938
+				}
939 939
 
940
-                if ( strpos($action, 'bulk_') === 0 ) {
941
-                    FrmAppHelper::remove_get_action();
942
-                    return self::list_form();
943
-                }
940
+				if ( strpos($action, 'bulk_') === 0 ) {
941
+					FrmAppHelper::remove_get_action();
942
+					return self::list_form();
943
+				}
944 944
 
945
-                return self::display_forms_list();
946
-        }
947
-    }
945
+				return self::display_forms_list();
946
+		}
947
+	}
948 948
 
949
-    public static function json_error( $errors ) {
950
-        $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
951
-        return $errors;
952
-    }
949
+	public static function json_error( $errors ) {
950
+		$errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
951
+		return $errors;
952
+	}
953 953
 
954 954
 
955
-    /* FRONT-END FORMS */
956
-    public static function admin_bar_css() {
955
+	/* FRONT-END FORMS */
956
+	public static function admin_bar_css() {
957 957
 		if ( is_admin() || ! current_user_can( 'frm_edit_forms' ) ) {
958
-            return;
959
-        }
958
+			return;
959
+		}
960 960
 
961 961
 		add_action( 'wp_before_admin_bar_render', 'FrmFormsController::admin_bar_configure' );
962 962
 		FrmAppHelper::load_font_style();
963 963
 	}
964 964
 
965 965
 	public static function admin_bar_configure() {
966
-        global $frm_vars;
967
-        if ( empty($frm_vars['forms_loaded']) ) {
968
-            return;
969
-        }
970
-
971
-        $actions = array();
972
-        foreach ( $frm_vars['forms_loaded'] as $form ) {
973
-            if ( is_object($form) ) {
974
-                $actions[ $form->id ] = $form->name;
975
-            }
976
-            unset($form);
977
-        }
978
-
979
-        if ( empty($actions) ) {
980
-            return;
981
-        }
982
-
983
-        asort($actions);
984
-
985
-        global $wp_admin_bar;
986
-
987
-        if ( count($actions) == 1 ) {
988
-            $wp_admin_bar->add_menu( array(
989
-                'title' => 'Edit Form',
990
-                'href'  => admin_url('admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) )),
991
-                'id'    => 'frm-forms',
992
-            ) );
993
-        } else {
994
-            $wp_admin_bar->add_menu( array(
995
-        		'id'    => 'frm-forms',
996
-        		'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>',
997
-        		'href'  => admin_url( 'admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) ) ),
998
-        		'meta'  => array(
966
+		global $frm_vars;
967
+		if ( empty($frm_vars['forms_loaded']) ) {
968
+			return;
969
+		}
970
+
971
+		$actions = array();
972
+		foreach ( $frm_vars['forms_loaded'] as $form ) {
973
+			if ( is_object($form) ) {
974
+				$actions[ $form->id ] = $form->name;
975
+			}
976
+			unset($form);
977
+		}
978
+
979
+		if ( empty($actions) ) {
980
+			return;
981
+		}
982
+
983
+		asort($actions);
984
+
985
+		global $wp_admin_bar;
986
+
987
+		if ( count($actions) == 1 ) {
988
+			$wp_admin_bar->add_menu( array(
989
+				'title' => 'Edit Form',
990
+				'href'  => admin_url('admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) )),
991
+				'id'    => 'frm-forms',
992
+			) );
993
+		} else {
994
+			$wp_admin_bar->add_menu( array(
995
+				'id'    => 'frm-forms',
996
+				'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>',
997
+				'href'  => admin_url( 'admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) ) ),
998
+				'meta'  => array(
999 999
 					'title' => __( 'Edit Forms', 'formidable' ),
1000
-        		),
1001
-        	) );
1000
+				),
1001
+			) );
1002 1002
 
1003
-        	foreach ( $actions as $form_id => $name ) {
1003
+			foreach ( $actions as $form_id => $name ) {
1004 1004
 
1005
-        		$wp_admin_bar->add_menu( array(
1006
-        			'parent'    => 'frm-forms',
1007
-        			'id'        => 'edit_form_'. $form_id,
1008
-        			'title'     => empty($name) ? __( '(no title)') : $name,
1005
+				$wp_admin_bar->add_menu( array(
1006
+					'parent'    => 'frm-forms',
1007
+					'id'        => 'edit_form_'. $form_id,
1008
+					'title'     => empty($name) ? __( '(no title)') : $name,
1009 1009
 					'href'      => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ),
1010
-        		) );
1011
-        	}
1012
-        }
1013
-    }
1010
+				) );
1011
+			}
1012
+		}
1013
+	}
1014 1014
 
1015
-    //formidable shortcode
1015
+	//formidable shortcode
1016 1016
 	public static function get_form_shortcode( $atts ) {
1017
-        global $frm_vars;
1018
-        if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) {
1019
-            $sc = '[formidable';
1017
+		global $frm_vars;
1018
+		if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) {
1019
+			$sc = '[formidable';
1020 1020
 			if ( ! empty( $atts ) ) {
1021 1021
 				foreach ( $atts as $k => $v ) {
1022 1022
 					$sc .= ' ' . $k . '="' . esc_attr( $v ) . '"';
1023 1023
 				}
1024 1024
 			}
1025
-            return $sc .']';
1026
-        }
1027
-
1028
-        $shortcode_atts = shortcode_atts( array(
1029
-            'id' => '', 'key' => '', 'title' => false, 'description' => false,
1030
-            'readonly' => false, 'entry_id' => false, 'fields' => array(),
1031
-            'exclude_fields' => array(), 'minimize' => false,
1032
-        ), $atts);
1033
-        do_action('formidable_shortcode_atts', $shortcode_atts, $atts);
1034
-
1035
-        return self::show_form(
1036
-            $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'],
1037
-            $shortcode_atts['description'], $atts
1038
-        );
1039
-    }
1040
-
1041
-    public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) {
1042
-        if ( empty( $id ) ) {
1043
-            $id = $key;
1044
-        }
1045
-
1046
-        // no form id or key set
1047
-        if ( empty( $id ) ) {
1048
-            return __( 'Please select a valid form', 'formidable' );
1049
-        }
1050
-
1051
-        $form = FrmForm::getOne( $id );
1052
-        if ( ! $form || $form->parent_form_id ) {
1053
-            return __( 'Please select a valid form', 'formidable' );
1054
-        }
1025
+			return $sc .']';
1026
+		}
1027
+
1028
+		$shortcode_atts = shortcode_atts( array(
1029
+			'id' => '', 'key' => '', 'title' => false, 'description' => false,
1030
+			'readonly' => false, 'entry_id' => false, 'fields' => array(),
1031
+			'exclude_fields' => array(), 'minimize' => false,
1032
+		), $atts);
1033
+		do_action('formidable_shortcode_atts', $shortcode_atts, $atts);
1034
+
1035
+		return self::show_form(
1036
+			$shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'],
1037
+			$shortcode_atts['description'], $atts
1038
+		);
1039
+	}
1040
+
1041
+	public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) {
1042
+		if ( empty( $id ) ) {
1043
+			$id = $key;
1044
+		}
1045
+
1046
+		// no form id or key set
1047
+		if ( empty( $id ) ) {
1048
+			return __( 'Please select a valid form', 'formidable' );
1049
+		}
1050
+
1051
+		$form = FrmForm::getOne( $id );
1052
+		if ( ! $form || $form->parent_form_id ) {
1053
+			return __( 'Please select a valid form', 'formidable' );
1054
+		}
1055 1055
 
1056 1056
 		add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' );
1057
-        FrmAppHelper::trigger_hook_load( 'form', $form );
1057
+		FrmAppHelper::trigger_hook_load( 'form', $form );
1058 1058
 
1059
-        $form = apply_filters( 'frm_pre_display_form', $form );
1059
+		$form = apply_filters( 'frm_pre_display_form', $form );
1060 1060
 
1061
-        $frm_settings = FrmAppHelper::get_settings();
1061
+		$frm_settings = FrmAppHelper::get_settings();
1062 1062
 
1063 1063
 		if ( self::is_viewable_draft_form( $form ) ) {
1064 1064
 			// don't show a draft form on a page
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
 		}
1080 1080
 
1081 1081
 		return $form;
1082
-    }
1082
+	}
1083 1083
 
1084 1084
 	private static function is_viewable_draft_form( $form ) {
1085 1085
 		global $post;
@@ -1095,98 +1095,98 @@  discard block
 block discarded – undo
1095 1095
 		return $form->logged_in && get_current_user_id() && isset( $form->options['logged_in_role'] ) && $form->options['logged_in_role'] != '' && ! FrmAppHelper::user_has_permission( $form->options['logged_in_role'] );
1096 1096
 	}
1097 1097
 
1098
-    public static function get_form( $form, $title, $description, $atts = array() ) {
1099
-        ob_start();
1098
+	public static function get_form( $form, $title, $description, $atts = array() ) {
1099
+		ob_start();
1100 1100
 
1101
-        self::get_form_contents( $form, $title, $description, $atts );
1101
+		self::get_form_contents( $form, $title, $description, $atts );
1102 1102
 		self::enqueue_scripts( FrmForm::get_params( $form ) );
1103 1103
 
1104
-        $contents = ob_get_contents();
1105
-        ob_end_clean();
1104
+		$contents = ob_get_contents();
1105
+		ob_end_clean();
1106 1106
 
1107 1107
 		self::maybe_minimize_form( $atts, $contents );
1108 1108
 
1109
-        return $contents;
1110
-    }
1109
+		return $contents;
1110
+	}
1111 1111
 
1112 1112
 	public static function enqueue_scripts( $params ) {
1113 1113
 		do_action( 'frm_enqueue_form_scripts', $params );
1114 1114
 	}
1115 1115
 
1116 1116
 	public static function get_form_contents( $form, $title, $description, $atts ) {
1117
-        global $frm_vars;
1117
+		global $frm_vars;
1118 1118
 
1119
-        $frm_settings = FrmAppHelper::get_settings();
1119
+		$frm_settings = FrmAppHelper::get_settings();
1120 1120
 
1121
-        $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value;
1121
+		$submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value;
1122 1122
 
1123
-        $user_ID = get_current_user_id();
1123
+		$user_ID = get_current_user_id();
1124 1124
 		$params = FrmForm::get_params( $form );
1125
-        $message = $errors = '';
1125
+		$message = $errors = '';
1126 1126
 
1127
-        if ( $params['posted_form_id'] == $form->id && $_POST ) {
1128
-            $errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array();
1129
-        }
1127
+		if ( $params['posted_form_id'] == $form->id && $_POST ) {
1128
+			$errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array();
1129
+		}
1130 1130
 
1131 1131
 		$include_form_tag = apply_filters( 'frm_include_form_tag', true, $form );
1132
-        $fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) );
1133
-
1134
-        if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) {
1135
-            do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
1136
-            if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) {
1137
-                $values = FrmEntriesHelper::setup_new_vars($fields, $form);
1138
-                include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1139
-            }
1140
-            return;
1141
-        }
1142
-
1143
-        if ( ! empty($errors) ) {
1144
-            $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array();
1145
-            include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1146
-            return;
1147
-        }
1148
-
1149
-        do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
1150
-        if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) {
1151
-            return;
1152
-        }
1153
-
1154
-        $values = FrmEntriesHelper::setup_new_vars($fields, $form, true);
1155
-        $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0;
1156
-        $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create');
1157
-
1158
-        if ( $created && is_numeric($created) && $conf_method != 'message' ) {
1159
-            do_action('frm_success_action', $conf_method, $form, $form->options, $created);
1132
+		$fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) );
1133
+
1134
+		if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) {
1135
+			do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
1136
+			if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) {
1137
+				$values = FrmEntriesHelper::setup_new_vars($fields, $form);
1138
+				include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1139
+			}
1140
+			return;
1141
+		}
1142
+
1143
+		if ( ! empty($errors) ) {
1144
+			$values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array();
1145
+			include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1146
+			return;
1147
+		}
1148
+
1149
+		do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
1150
+		if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) {
1151
+			return;
1152
+		}
1153
+
1154
+		$values = FrmEntriesHelper::setup_new_vars($fields, $form, true);
1155
+		$created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0;
1156
+		$conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create');
1157
+
1158
+		if ( $created && is_numeric($created) && $conf_method != 'message' ) {
1159
+			do_action('frm_success_action', $conf_method, $form, $form->options, $created);
1160 1160
 			do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
1161
-            return;
1162
-        }
1161
+			return;
1162
+		}
1163 1163
 
1164
-        if ( $created && is_numeric($created) ) {
1165
-            $message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg;
1166
-            $class = 'frm_message';
1167
-        } else {
1168
-            $message = $frm_settings->failed_msg;
1169
-            $class = 'frm_error_style';
1170
-        }
1164
+		if ( $created && is_numeric($created) ) {
1165
+			$message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg;
1166
+			$class = 'frm_message';
1167
+		} else {
1168
+			$message = $frm_settings->failed_msg;
1169
+			$class = 'frm_error_style';
1170
+		}
1171 1171
 
1172 1172
 		$message = FrmFormsHelper::get_success_message( array(
1173 1173
 			'message' => $message, 'form' => $form,
1174 1174
 			'entry_id' => $created, 'class' => $class,
1175 1175
 		) );
1176
-        $message = apply_filters('frm_main_feedback', $message, $form, $created);
1176
+		$message = apply_filters('frm_main_feedback', $message, $form, $created);
1177 1177
 
1178
-        if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) {
1179
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1180
-        } else {
1181
-            global $frm_vars;
1178
+		if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) {
1179
+			require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1180
+		} else {
1181
+			global $frm_vars;
1182 1182
 			self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] );
1183 1183
 
1184
-            $include_extra_container = 'frm_forms'. FrmFormsHelper::get_form_style_class($values);
1185
-            include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php');
1186
-        }
1184
+			$include_extra_container = 'frm_forms'. FrmFormsHelper::get_form_style_class($values);
1185
+			include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php');
1186
+		}
1187 1187
 
1188 1188
 		do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
1189
-    }
1189
+	}
1190 1190
 
1191 1191
 	public static function front_head() {
1192 1192
 		$version = FrmAppHelper::plugin_version();
@@ -1215,10 +1215,10 @@  discard block
 block discarded – undo
1215 1215
 	}
1216 1216
 
1217 1217
 	public static function defer_script_loading( $tag, $handle ) {
1218
-	    if ( 'recaptcha-api' == $handle && ! strpos( $tag, 'defer' ) ) {
1219
-	        $tag = str_replace( ' src', ' defer="defer" async="async" src', $tag );
1218
+		if ( 'recaptcha-api' == $handle && ! strpos( $tag, 'defer' ) ) {
1219
+			$tag = str_replace( ' src', ' defer="defer" async="async" src', $tag );
1220 1220
 		}
1221
-	    return $tag;
1221
+		return $tag;
1222 1222
 	}
1223 1223
 
1224 1224
 	public static function footer_js( $location = 'footer' ) {
Please login to merge, or discard this patch.