Completed
Push — master ( f2f906...67fde7 )
by Jamie
03:44
created
classes/views/styles/_general.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,59 +1,59 @@
 block discarded – undo
1 1
 <p>
2
-    <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('center_form') ) ?>" id="frm_center_form" value="1" <?php checked($style->post_content['center_form'], 1) ?> />
2
+    <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'center_form' ) ) ?>" id="frm_center_form" value="1" <?php checked( $style->post_content['center_form'], 1 ) ?> />
3 3
 	    <?php _e( 'Center form on page', 'formidable' ) ?> <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'This will center your form on the page where it is published if the form width is less than the available width on the page.', 'formidable' ) ?>" ></span>
4 4
 	</label>
5 5
 </p>
6 6
 
7 7
 <div class="field-group clearfix frm-first-row">
8 8
 	<label><?php _e( 'Alignment', 'formidable' ) ?></label>
9
-	<select name="<?php echo esc_attr( $frm_style->get_field_name('form_align') ) ?>" id="frm_form_align">
10
-		<option value="left" <?php selected($style->post_content['form_align'], 'left') ?>><?php _e( 'left', 'formidable' ) ?></option>
11
-		<option value="right" <?php selected($style->post_content['form_align'], 'right') ?>><?php _e( 'right', 'formidable' ) ?></option>
12
-		<option value="center" <?php selected($style->post_content['form_align'], 'center') ?>><?php _e( 'center', 'formidable' ) ?></option>
9
+	<select name="<?php echo esc_attr( $frm_style->get_field_name( 'form_align' ) ) ?>" id="frm_form_align">
10
+		<option value="left" <?php selected( $style->post_content['form_align'], 'left' ) ?>><?php _e( 'left', 'formidable' ) ?></option>
11
+		<option value="right" <?php selected( $style->post_content['form_align'], 'right' ) ?>><?php _e( 'right', 'formidable' ) ?></option>
12
+		<option value="center" <?php selected( $style->post_content['form_align'], 'center' ) ?>><?php _e( 'center', 'formidable' ) ?></option>
13 13
 	</select>
14 14
 </div>
15 15
 
16 16
 <div class="field-group clearfix frm-first-row">
17 17
 	<label><?php _e( 'Max Width', 'formidable' ) ?></label>
18
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_width') ) ?>" value="<?php echo esc_attr( $style->post_content['form_width'] ) ?>"/>
18
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_width' ) ) ?>" value="<?php echo esc_attr( $style->post_content['form_width'] ) ?>"/>
19 19
 </div>
20 20
 
21 21
 <div class="field-group clearfix frm-first-row">
22 22
 	<label><?php _e( 'Background', 'formidable' ) ?></label>
23
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_bg_color') ) ?>" id="frm_fieldset_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_bg_color'] ) ?>" size="4" />
23
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_bg_color' ) ) ?>" id="frm_fieldset_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_bg_color'] ) ?>" size="4" />
24 24
 </div>
25 25
 
26 26
 <div class="field-group field-group-border clearfix">
27 27
 	<label><?php _e( 'Border', 'formidable' ) ?></label>
28
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset') ) ?>" id="frm_fieldset" value="<?php echo esc_attr( $style->post_content['fieldset'] ) ?>" size="4" />
28
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset' ) ) ?>" id="frm_fieldset" value="<?php echo esc_attr( $style->post_content['fieldset'] ) ?>" size="4" />
29 29
 </div>
30 30
 
31 31
 <div class="field-group clearfix">
32 32
 	<label><?php _e( 'Color', 'formidable' ) ?></label>
33
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_color') ) ?>" id="frm_fieldset_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_color'] ) ?>" />
33
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_color' ) ) ?>" id="frm_fieldset_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_color'] ) ?>" />
34 34
 </div>
35 35
 
36 36
 <div class="field-group clearfix">
37 37
 	<label><?php _e( 'Padding', 'formidable' ) ?></label>
38
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_padding') ) ?>" id="frm_fieldset_padding" value="<?php echo esc_attr( $style->post_content['fieldset_padding'] ) ?>" size="4" />
38
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_padding' ) ) ?>" id="frm_fieldset_padding" value="<?php echo esc_attr( $style->post_content['fieldset_padding'] ) ?>" size="4" />
39 39
 </div>
40 40
 
41 41
 <div id="frm_gen_font_box" class="field-group clearfix">
42 42
 	<label><?php _e( 'Font Family', 'formidable' ) ?></label>
43
-	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('font') ) ?>" id="frm_font" value="<?php echo esc_attr( $style->post_content['font'] ) ?>"  class="frm_full_width" />
43
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'font' ) ) ?>" id="frm_font" value="<?php echo esc_attr( $style->post_content['font'] ) ?>"  class="frm_full_width" />
44 44
 </div>
45 45
 
46 46
 <div class="field-group clearfix frm-half">
47 47
 	<label><?php _e( 'Direction', 'formidable' ) ?></label>
48
-	<select name="<?php echo esc_attr( $frm_style->get_field_name('direction') ) ?>" id="frm_direction">
49
-		<option value="ltr" <?php selected($style->post_content['direction'], 'ltr') ?>><?php _e( 'Left to Right', 'formidable' ) ?></option>
50
-		<option value="rtl" <?php selected($style->post_content['direction'], 'rtl') ?>><?php _e( 'Right to Left', 'formidable' ) ?></option>
48
+	<select name="<?php echo esc_attr( $frm_style->get_field_name( 'direction' ) ) ?>" id="frm_direction">
49
+		<option value="ltr" <?php selected( $style->post_content['direction'], 'ltr' ) ?>><?php _e( 'Left to Right', 'formidable' ) ?></option>
50
+		<option value="rtl" <?php selected( $style->post_content['direction'], 'rtl' ) ?>><?php _e( 'Right to Left', 'formidable' ) ?></option>
51 51
 	</select>
52 52
 </div>
53 53
 
54 54
 <div class="clear"></div>
55 55
 <p class="frm_no_bottom_margin">
56
-    <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('important_style') ) ?>" id="frm_important_style" value="1" <?php checked($style->post_content['important_style'], 1) ?> />
56
+    <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'important_style' ) ) ?>" id="frm_important_style" value="1" <?php checked( $style->post_content['important_style'], 1 ) ?> />
57 57
 	    <?php _e( 'Override theme styling', 'formidable' ) ?> <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'This will add !important to many of the lines in the Formidable styling to make sure it will be used.', 'formidable' ) ?>" ></span>
58 58
 	</label>
59 59
 </p>
Please login to merge, or discard this patch.
classes/helpers/FrmTipsHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -134,6 +134,6 @@
 block discarded – undo
134 134
 
135 135
 	public static function get_random_tip( $tips ) {
136 136
 		$random = rand( 0, count( $tips ) - 1 );
137
-		return $tips[ $random ];
137
+		return $tips[$random];
138 138
 	}
139 139
 }
Please login to merge, or discard this patch.
classes/views/addons/list.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@
 block discarded – undo
7 7
 				continue;
8 8
 			}
9 9
 
10
-			if ( isset( $plugin_names[ $addon['info']['slug'] ] ) ) {
11
-				$installed = is_dir( WP_PLUGIN_DIR . '/' . $plugin_names[ $addon['info']['slug'] ] );
10
+			if ( isset( $plugin_names[$addon['info']['slug']] ) ) {
11
+				$installed = is_dir( WP_PLUGIN_DIR . '/' . $plugin_names[$addon['info']['slug']] );
12 12
 			} else {
13
-				$installed = isset( $installed_addons[ $addon['info']['slug'] ] ) || is_dir( WP_PLUGIN_DIR . '/formidable-' . $addon['info']['slug'] );
13
+				$installed = isset( $installed_addons[$addon['info']['slug']] ) || is_dir( WP_PLUGIN_DIR . '/formidable-' . $addon['info']['slug'] );
14 14
 			}
15 15
 			$has_thumbnail = ! empty( $addon['info']['thumbnail'] );
16 16
 			if ( $addon['info']['slug'] == 'formidable-pro' ) {
Please login to merge, or discard this patch.
classes/controllers/FrmFormsController.php 2 patches
Indentation   +628 added lines, -628 removed lines patch added patch discarded remove patch
@@ -2,140 +2,140 @@  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)';
9 9
 		}
10 10
 		add_submenu_page('formidable', 'Formidable | '. $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' );
11 11
 
12
-	    add_filter('get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' );
12
+		add_filter('get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' );
13 13
 
14
-	    add_filter('manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 );
14
+		add_filter('manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 );
15 15
 		add_filter('manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' );
16
-    }
16
+	}
17 17
 
18
-    public static function head() {
19
-        wp_enqueue_script('formidable-editinplace');
18
+	public static function head() {
19
+		wp_enqueue_script('formidable-editinplace');
20 20
 
21
-        if ( wp_is_mobile() ) {
22
-    		wp_enqueue_script( 'jquery-touch-punch' );
23
-    	}
24
-    }
21
+		if ( wp_is_mobile() ) {
22
+			wp_enqueue_script( 'jquery-touch-punch' );
23
+		}
24
+	}
25 25
 
26
-    public static function register_widgets() {
27
-        require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php');
28
-        register_widget('FrmShowForm');
29
-    }
26
+	public static function register_widgets() {
27
+		require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php');
28
+		register_widget('FrmShowForm');
29
+	}
30 30
 
31
-    public static function list_form() {
32
-        FrmAppHelper::permission_check('frm_view_forms');
31
+	public static function list_form() {
32
+		FrmAppHelper::permission_check('frm_view_forms');
33 33
 
34 34
 		$params = FrmForm::list_page_params();
35
-        $errors = self::process_bulk_form_actions( array());
36
-        $errors = apply_filters('frm_admin_list_form_action', $errors);
35
+		$errors = self::process_bulk_form_actions( array());
36
+		$errors = apply_filters('frm_admin_list_form_action', $errors);
37 37
 
38 38
 		return self::display_forms_list( $params, '', $errors );
39
-    }
39
+	}
40 40
 
41 41
 	public static function new_form( $values = array() ) {
42
-        FrmAppHelper::permission_check('frm_edit_forms');
42
+		FrmAppHelper::permission_check('frm_edit_forms');
43 43
 
44
-        global $frm_vars;
44
+		global $frm_vars;
45 45
 
46
-        $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
46
+		$action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
47 47
 		$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ];
48 48
 
49 49
 		if ( $action == 'create' ) {
50
-            return self::create($values);
50
+			return self::create($values);
51 51
 		} else if ( $action == 'new' ) {
52 52
 			$frm_field_selection = FrmField::field_selection();
53
-            $values = FrmFormsHelper::setup_new_vars($values);
54
-            $id = FrmForm::create( $values );
55
-            $form = FrmForm::getOne($id);
53
+			$values = FrmFormsHelper::setup_new_vars($values);
54
+			$id = FrmForm::create( $values );
55
+			$form = FrmForm::getOne($id);
56 56
 
57
-            // add default email notification
58
-            $action_control = FrmFormActionsController::get_form_actions( 'email' );
59
-            $action_control->create($form->id);
57
+			// add default email notification
58
+			$action_control = FrmFormActionsController::get_form_actions( 'email' );
59
+			$action_control->create($form->id);
60 60
 
61 61
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
62 62
 
63
-            $values['id'] = $id;
64
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
65
-        }
66
-    }
63
+			$values['id'] = $id;
64
+			require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
65
+		}
66
+	}
67 67
 
68 68
 	public static function create( $values = array() ) {
69
-        FrmAppHelper::permission_check('frm_edit_forms');
69
+		FrmAppHelper::permission_check('frm_edit_forms');
70 70
 
71
-        global $frm_vars;
72
-        if ( empty( $values ) ) {
73
-            $values = $_POST;
74
-        }
71
+		global $frm_vars;
72
+		if ( empty( $values ) ) {
73
+			$values = $_POST;
74
+		}
75 75
 
76
-        //Set radio button and checkbox meta equal to "other" value
77
-        if ( FrmAppHelper::pro_is_installed() ) {
78
-            $values = FrmProEntry::mod_other_vals( $values, 'back' );
79
-        }
76
+		//Set radio button and checkbox meta equal to "other" value
77
+		if ( FrmAppHelper::pro_is_installed() ) {
78
+			$values = FrmProEntry::mod_other_vals( $values, 'back' );
79
+		}
80 80
 
81 81
 		$id = isset($values['id']) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
82 82
 
83
-        if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
84
-            $frm_settings = FrmAppHelper::get_settings();
85
-            $errors = array( 'form' => $frm_settings->admin_permission );
86
-        } else {
87
-            $errors = FrmForm::validate($values);
88
-        }
83
+		if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
84
+			$frm_settings = FrmAppHelper::get_settings();
85
+			$errors = array( 'form' => $frm_settings->admin_permission );
86
+		} else {
87
+			$errors = FrmForm::validate($values);
88
+		}
89 89
 
90
-        if ( count($errors) > 0 ) {
91
-            $hide_preview = true;
90
+		if ( count($errors) > 0 ) {
91
+			$hide_preview = true;
92 92
 			$frm_field_selection = FrmField::field_selection();
93
-            $form = FrmForm::getOne( $id );
94
-            $fields = FrmField::get_all_for_form($id);
93
+			$form = FrmForm::getOne( $id );
94
+			$fields = FrmField::get_all_for_form($id);
95 95
 
96
-            $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
96
+			$values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
97 97
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
98 98
 
99
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
100
-        } else {
101
-            FrmForm::update( $id, $values, true );
102
-            die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id='. $id)));
103
-        }
104
-    }
99
+			require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
100
+		} else {
101
+			FrmForm::update( $id, $values, true );
102
+			die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id='. $id)));
103
+		}
104
+	}
105 105
 
106
-    public static function edit( $values = false ) {
107
-        FrmAppHelper::permission_check('frm_edit_forms');
106
+	public static function edit( $values = false ) {
107
+		FrmAppHelper::permission_check('frm_edit_forms');
108 108
 
109 109
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
110
-        return self::get_edit_vars($id);
111
-    }
110
+		return self::get_edit_vars($id);
111
+	}
112 112
 
113
-    public static function settings( $id = false, $message = '' ) {
114
-        FrmAppHelper::permission_check('frm_edit_forms');
113
+	public static function settings( $id = false, $message = '' ) {
114
+		FrmAppHelper::permission_check('frm_edit_forms');
115 115
 
116
-        if ( ! $id || ! is_numeric($id) ) {
116
+		if ( ! $id || ! is_numeric($id) ) {
117 117
 			$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
118
-        }
118
+		}
119 119
 		return self::get_settings_vars( $id, array(), $message );
120
-    }
120
+	}
121 121
 
122
-    public static function update_settings() {
123
-        FrmAppHelper::permission_check('frm_edit_forms');
122
+	public static function update_settings() {
123
+		FrmAppHelper::permission_check('frm_edit_forms');
124 124
 
125 125
 		$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
126 126
 
127
-        $errors = FrmForm::validate($_POST);
128
-        if ( count($errors) > 0 ) {
129
-            return self::get_settings_vars($id, $errors);
130
-        }
127
+		$errors = FrmForm::validate($_POST);
128
+		if ( count($errors) > 0 ) {
129
+			return self::get_settings_vars($id, $errors);
130
+		}
131 131
 
132
-        do_action('frm_before_update_form_settings', $id);
132
+		do_action('frm_before_update_form_settings', $id);
133 133
 
134 134
 		FrmForm::update( $id, $_POST );
135 135
 
136
-        $message = __( 'Settings Successfully Updated', 'formidable' );
136
+		$message = __( 'Settings Successfully Updated', 'formidable' );
137 137
 		return self::get_settings_vars( $id, array(), $message );
138
-    }
138
+	}
139 139
 
140 140
 	public static function edit_key() {
141 141
 		$values = self::edit_in_place_value( 'form_key' );
@@ -165,43 +165,43 @@  discard block
 block discarded – undo
165 165
 
166 166
 	public static function update( $values = array() ) {
167 167
 		if ( empty( $values ) ) {
168
-            $values = $_POST;
169
-        }
168
+			$values = $_POST;
169
+		}
170 170
 
171
-        //Set radio button and checkbox meta equal to "other" value
172
-        if ( FrmAppHelper::pro_is_installed() ) {
173
-            $values = FrmProEntry::mod_other_vals( $values, 'back' );
174
-        }
171
+		//Set radio button and checkbox meta equal to "other" value
172
+		if ( FrmAppHelper::pro_is_installed() ) {
173
+			$values = FrmProEntry::mod_other_vals( $values, 'back' );
174
+		}
175 175
 
176
-        $errors = FrmForm::validate( $values );
177
-        $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' );
178
-        if ( $permission_error !== false ) {
179
-            $errors['form'] = $permission_error;
180
-        }
176
+		$errors = FrmForm::validate( $values );
177
+		$permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' );
178
+		if ( $permission_error !== false ) {
179
+			$errors['form'] = $permission_error;
180
+		}
181 181
 
182 182
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
183 183
 
184 184
 		if ( count( $errors ) > 0 ) {
185
-            return self::get_edit_vars( $id, $errors );
185
+			return self::get_edit_vars( $id, $errors );
186 186
 		} else {
187
-            FrmForm::update( $id, $values );
188
-            $message = __( 'Form was Successfully Updated', 'formidable' );
189
-            if ( defined( 'DOING_AJAX' ) ) {
187
+			FrmForm::update( $id, $values );
188
+			$message = __( 'Form was Successfully Updated', 'formidable' );
189
+			if ( defined( 'DOING_AJAX' ) ) {
190 190
 				wp_die( $message );
191
-            }
191
+			}
192 192
 			return self::get_edit_vars( $id, array(), $message );
193
-        }
194
-    }
193
+		}
194
+	}
195 195
 
196
-    public static function bulk_create_template( $ids ) {
197
-        FrmAppHelper::permission_check( 'frm_edit_forms' );
196
+	public static function bulk_create_template( $ids ) {
197
+		FrmAppHelper::permission_check( 'frm_edit_forms' );
198 198
 
199
-        foreach ( $ids as $id ) {
200
-            FrmForm::duplicate( $id, true, true );
201
-        }
199
+		foreach ( $ids as $id ) {
200
+			FrmForm::duplicate( $id, true, true );
201
+		}
202 202
 
203
-        return __( 'Form template was Successfully Created', 'formidable' );
204
-    }
203
+		return __( 'Form template was Successfully Created', 'formidable' );
204
+	}
205 205
 
206 206
 	/**
207 207
 	 * Redirect to the url for creating from a template
@@ -222,45 +222,45 @@  discard block
 block discarded – undo
222 222
 		wp_die();
223 223
 	}
224 224
 
225
-    public static function duplicate() {
226
-        FrmAppHelper::permission_check('frm_edit_forms');
225
+	public static function duplicate() {
226
+		FrmAppHelper::permission_check('frm_edit_forms');
227 227
 
228 228
 		$params = FrmForm::list_page_params();
229
-        $form = FrmForm::duplicate( $params['id'], $params['template'], true );
230
-        $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
231
-        if ( $form ) {
229
+		$form = FrmForm::duplicate( $params['id'], $params['template'], true );
230
+		$message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
231
+		if ( $form ) {
232 232
 			return self::get_edit_vars( $form, array(), $message, true );
233
-        } else {
234
-            return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' ));
235
-        }
236
-    }
233
+		} else {
234
+			return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' ));
235
+		}
236
+	}
237 237
 
238
-    public static function page_preview() {
238
+	public static function page_preview() {
239 239
 		$params = FrmForm::list_page_params();
240
-        if ( ! $params['form'] ) {
241
-            return;
242
-        }
243
-
244
-        $form = FrmForm::getOne( $params['form'] );
245
-        if ( ! $form ) {
246
-            return;
247
-        }
248
-        return self::show_form( $form->id, '', true, true );
249
-    }
250
-
251
-    public static function preview() {
252
-        do_action( 'frm_wp' );
253
-
254
-        global $frm_vars;
255
-        $frm_vars['preview'] = true;
256
-
257
-        if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) {
258
-            global $wp;
259
-            $root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
260
-            include_once( $root.'/wp-config.php' );
261
-            $wp->init();
262
-            $wp->register_globals();
263
-        }
240
+		if ( ! $params['form'] ) {
241
+			return;
242
+		}
243
+
244
+		$form = FrmForm::getOne( $params['form'] );
245
+		if ( ! $form ) {
246
+			return;
247
+		}
248
+		return self::show_form( $form->id, '', true, true );
249
+	}
250
+
251
+	public static function preview() {
252
+		do_action( 'frm_wp' );
253
+
254
+		global $frm_vars;
255
+		$frm_vars['preview'] = true;
256
+
257
+		if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) {
258
+			global $wp;
259
+			$root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
260
+			include_once( $root.'/wp-config.php' );
261
+			$wp->init();
262
+			$wp->register_globals();
263
+		}
264 264
 
265 265
 		self::register_pro_scripts();
266 266
 
@@ -274,11 +274,11 @@  discard block
 block discarded – undo
274 274
 		$form = FrmForm::getAll( array( 'form_key' => $key ), '', 1 );
275 275
 		if ( empty( $form ) ) {
276 276
 			$form = FrmForm::getAll( array(), '', 1 );
277
-        }
277
+		}
278 278
 
279
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/direct.php');
280
-        wp_die();
281
-    }
279
+		require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/direct.php');
280
+		wp_die();
281
+	}
282 282
 
283 283
 	public static function register_pro_scripts() {
284 284
 		if ( FrmAppHelper::pro_is_installed() ) {
@@ -288,22 +288,22 @@  discard block
 block discarded – undo
288 288
 		}
289 289
 	}
290 290
 
291
-    public static function untrash() {
291
+	public static function untrash() {
292 292
 		self::change_form_status( 'untrash' );
293
-    }
293
+	}
294 294
 
295 295
 	public static function bulk_untrash( $ids ) {
296
-        FrmAppHelper::permission_check('frm_edit_forms');
296
+		FrmAppHelper::permission_check('frm_edit_forms');
297 297
 
298
-        $count = FrmForm::set_status( $ids, 'published' );
298
+		$count = FrmForm::set_status( $ids, 'published' );
299 299
 
300
-        $message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
301
-        return $message;
302
-    }
300
+		$message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
301
+		return $message;
302
+	}
303 303
 
304
-    public static function trash() {
304
+	public static function trash() {
305 305
 		self::change_form_status( 'trash' );
306
-    }
306
+	}
307 307
 
308 308
 	/**
309 309
 	 * @param string $status
@@ -341,68 +341,68 @@  discard block
 block discarded – undo
341 341
 	}
342 342
 
343 343
 	public static function bulk_trash( $ids ) {
344
-        FrmAppHelper::permission_check('frm_delete_forms');
344
+		FrmAppHelper::permission_check('frm_delete_forms');
345 345
 
346
-        $count = 0;
347
-        foreach ( $ids as $id ) {
348
-            if ( FrmForm::trash( $id ) ) {
349
-                $count++;
350
-            }
351
-        }
346
+		$count = 0;
347
+		foreach ( $ids as $id ) {
348
+			if ( FrmForm::trash( $id ) ) {
349
+				$count++;
350
+			}
351
+		}
352 352
 
353
-        $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
354
-        $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>' );
353
+		$current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
354
+		$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>' );
355 355
 
356
-        return $message;
357
-    }
356
+		return $message;
357
+	}
358 358
 
359
-    public static function destroy() {
360
-        FrmAppHelper::permission_check('frm_delete_forms');
359
+	public static function destroy() {
360
+		FrmAppHelper::permission_check('frm_delete_forms');
361 361
 
362 362
 		$params = FrmForm::list_page_params();
363 363
 
364
-        //check nonce url
365
-        check_admin_referer('destroy_form_' . $params['id']);
364
+		//check nonce url
365
+		check_admin_referer('destroy_form_' . $params['id']);
366 366
 
367
-        $count = 0;
368
-        if ( FrmForm::destroy( $params['id'] ) ) {
369
-            $count++;
370
-        }
367
+		$count = 0;
368
+		if ( FrmForm::destroy( $params['id'] ) ) {
369
+			$count++;
370
+		}
371 371
 
372
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
372
+		$message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
373 373
 
374 374
 		self::display_forms_list( $params, $message );
375
-    }
375
+	}
376 376
 
377 377
 	public static function bulk_destroy( $ids ) {
378
-        FrmAppHelper::permission_check('frm_delete_forms');
378
+		FrmAppHelper::permission_check('frm_delete_forms');
379 379
 
380
-        $count = 0;
381
-        foreach ( $ids as $id ) {
382
-            $d = FrmForm::destroy( $id );
383
-            if ( $d ) {
384
-                $count++;
385
-            }
386
-        }
380
+		$count = 0;
381
+		foreach ( $ids as $id ) {
382
+			$d = FrmForm::destroy( $id );
383
+			if ( $d ) {
384
+				$count++;
385
+			}
386
+		}
387 387
 
388
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
388
+		$message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
389 389
 
390
-        return $message;
391
-    }
390
+		return $message;
391
+	}
392 392
 
393
-    private static function delete_all() {
394
-        //check nonce url
395
-        $permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable');
396
-        if ( $permission_error !== false ) {
393
+	private static function delete_all() {
394
+		//check nonce url
395
+		$permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable');
396
+		if ( $permission_error !== false ) {
397 397
 			self::display_forms_list( array(), '', array( $permission_error ) );
398
-            return;
399
-        }
398
+			return;
399
+		}
400 400
 
401 401
 		$count = FrmForm::scheduled_delete( time() );
402
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
402
+		$message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
403 403
 
404 404
 		self::display_forms_list( array(), $message );
405
-    }
405
+	}
406 406
 
407 407
 	public static function scheduled_delete( $delete_timestamp = '' ) {
408 408
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::scheduled_delete' );
@@ -410,11 +410,11 @@  discard block
 block discarded – undo
410 410
 	}
411 411
 
412 412
 	/**
413
-	* Inserts Formidable button
414
-	* Hook exists since 2.5.0
415
-	*
416
-	* @since 2.0.15
417
-	*/
413
+	 * Inserts Formidable button
414
+	 * Hook exists since 2.5.0
415
+	 *
416
+	 * @since 2.0.15
417
+	 */
418 418
 	public static function insert_form_button() {
419 419
 		if ( current_user_can('frm_view_forms') ) {
420 420
 			$frm_settings = FrmAppHelper::get_settings();
@@ -423,48 +423,48 @@  discard block
 block discarded – undo
423 423
 		}
424 424
 	}
425 425
 
426
-    public static function insert_form_popup() {
426
+	public static function insert_form_popup() {
427 427
 		$page = basename( FrmAppHelper::get_server_value( 'PHP_SELF' ) );
428 428
 		if ( ! in_array( $page, array( 'post.php', 'page.php', 'page-new.php', 'post-new.php' ) ) ) {
429
-            return;
430
-        }
429
+			return;
430
+		}
431 431
 
432
-        FrmAppHelper::load_admin_wide_js();
432
+		FrmAppHelper::load_admin_wide_js();
433 433
 
434
-        $shortcodes = array(
434
+		$shortcodes = array(
435 435
 			'formidable' => array( 'name' => __( 'Form', 'formidable' ), 'label' => __( 'Insert a Form', 'formidable' ) ),
436
-        );
436
+		);
437 437
 
438
-        $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes);
438
+		$shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes);
439 439
 
440
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/insert_form_popup.php');
441
-    }
440
+		include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/insert_form_popup.php');
441
+	}
442 442
 
443
-    public static function get_shortcode_opts() {
444
-        check_ajax_referer( 'frm_ajax', 'nonce' );
443
+	public static function get_shortcode_opts() {
444
+		check_ajax_referer( 'frm_ajax', 'nonce' );
445 445
 
446 446
 		$shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' );
447
-        if ( empty($shortcode) ) {
448
-            wp_die();
449
-        }
447
+		if ( empty($shortcode) ) {
448
+			wp_die();
449
+		}
450 450
 
451
-        echo '<div id="sc-opts-'. esc_attr( $shortcode ) .'" class="frm_shortcode_option">';
452
-        echo '<input type="radio" name="frmsc" value="'. esc_attr($shortcode) .'" id="sc-'. esc_attr($shortcode) .'" class="frm_hidden" />';
451
+		echo '<div id="sc-opts-'. esc_attr( $shortcode ) .'" class="frm_shortcode_option">';
452
+		echo '<input type="radio" name="frmsc" value="'. esc_attr($shortcode) .'" id="sc-'. esc_attr($shortcode) .'" class="frm_hidden" />';
453 453
 
454
-        $form_id = '';
455
-        $opts = array();
454
+		$form_id = '';
455
+		$opts = array();
456 456
 		switch ( $shortcode ) {
457
-            case 'formidable':
458
-                $opts = array(
457
+			case 'formidable':
458
+				$opts = array(
459 459
 					'form_id'       => 'id',
460
-                    //'key' => ',
460
+					//'key' => ',
461 461
 					'title'         => array( 'val' => 1, 'label' => __( 'Display form title', 'formidable' ) ),
462 462
 					'description'   => array( 'val' => 1, 'label' => __( 'Display form description', 'formidable' ) ),
463 463
 					'minimize'      => array( 'val' => 1, 'label' => __( 'Minimize form HTML', 'formidable' ) ),
464
-                );
465
-            break;
466
-        }
467
-        $opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode);
464
+				);
465
+			break;
466
+		}
467
+		$opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode);
468 468
 
469 469
 		if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) {
470 470
 			// allow other shortcodes to use the required form id option
@@ -472,63 +472,63 @@  discard block
 block discarded – undo
472 472
 			unset( $opts['form_id'] );
473 473
 		}
474 474
 
475
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/shortcode_opts.php');
475
+		include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/shortcode_opts.php');
476 476
 
477
-        echo '</div>';
477
+		echo '</div>';
478 478
 
479
-        wp_die();
480
-    }
479
+		wp_die();
480
+	}
481 481
 
482 482
 	public static function display_forms_list( $params = array(), $message = '', $errors = array(), $deprecated_errors = array() ) {
483
-        FrmAppHelper::permission_check( 'frm_view_forms' );
483
+		FrmAppHelper::permission_check( 'frm_view_forms' );
484 484
 		if ( ! empty( $deprecated_errors ) ) {
485 485
 			$errors = $deprecated_errors;
486 486
 			_deprecated_argument( 'errors', '2.0.8' );
487 487
 		}
488 488
 
489
-        global $wpdb, $frm_vars;
489
+		global $wpdb, $frm_vars;
490 490
 
491 491
 		if ( empty( $params ) ) {
492 492
 			$params = FrmForm::list_page_params();
493
-        }
493
+		}
494 494
 
495
-        $wp_list_table = new FrmFormsListHelper( compact( 'params' ) );
495
+		$wp_list_table = new FrmFormsListHelper( compact( 'params' ) );
496 496
 
497
-        $pagenum = $wp_list_table->get_pagenum();
497
+		$pagenum = $wp_list_table->get_pagenum();
498 498
 
499
-        $wp_list_table->prepare_items();
499
+		$wp_list_table->prepare_items();
500 500
 
501
-        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
502
-        if ( $pagenum > $total_pages && $total_pages > 0 ) {
501
+		$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
502
+		if ( $pagenum > $total_pages && $total_pages > 0 ) {
503 503
 			wp_redirect( esc_url_raw( add_query_arg( 'paged', $total_pages ) ) );
504
-            die();
505
-        }
504
+			die();
505
+		}
506 506
 
507
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/list.php');
508
-    }
507
+		require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/list.php');
508
+	}
509 509
 
510 510
 	public static function get_columns( $columns ) {
511
-	    $columns['cb'] = '<input type="checkbox" />';
512
-	    $columns['id'] = 'ID';
511
+		$columns['cb'] = '<input type="checkbox" />';
512
+		$columns['id'] = 'ID';
513 513
 
514
-        $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : 'published';
514
+		$type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : 'published';
515 515
 
516
-        if ( 'template' == $type ) {
517
-            $columns['name']        = __( 'Template Name', 'formidable' );
518
-            $columns['type']        = __( 'Type', 'formidable' );
519
-            $columns['form_key']    = __( 'Key', 'formidable' );
520
-        } else {
521
-            $columns['name']        = __( 'Form Title', 'formidable' );
522
-            $columns['entries']     = __( 'Entries', 'formidable' );
523
-            $columns['form_key']    = __( 'Key', 'formidable' );
524
-            $columns['shortcode']   = __( 'Shortcodes', 'formidable' );
525
-        }
516
+		if ( 'template' == $type ) {
517
+			$columns['name']        = __( 'Template Name', 'formidable' );
518
+			$columns['type']        = __( 'Type', 'formidable' );
519
+			$columns['form_key']    = __( 'Key', 'formidable' );
520
+		} else {
521
+			$columns['name']        = __( 'Form Title', 'formidable' );
522
+			$columns['entries']     = __( 'Entries', 'formidable' );
523
+			$columns['form_key']    = __( 'Key', 'formidable' );
524
+			$columns['shortcode']   = __( 'Shortcodes', 'formidable' );
525
+		}
526 526
 
527
-        $columns['created_at'] = __( 'Date', 'formidable' );
527
+		$columns['created_at'] = __( 'Date', 'formidable' );
528 528
 
529 529
 		add_screen_option( 'per_page', array( 'label' => __( 'Forms', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_per_page' ) );
530 530
 
531
-        return $columns;
531
+		return $columns;
532 532
 	}
533 533
 
534 534
 	public static function get_sortable_columns() {
@@ -542,110 +542,110 @@  discard block
 block discarded – undo
542 542
 	}
543 543
 
544 544
 	public static function hidden_columns( $result ) {
545
-        $return = false;
546
-        foreach ( (array) $result as $r ) {
547
-            if ( ! empty( $r ) ) {
548
-                $return = true;
549
-                break;
550
-            }
551
-        }
545
+		$return = false;
546
+		foreach ( (array) $result as $r ) {
547
+			if ( ! empty( $r ) ) {
548
+				$return = true;
549
+				break;
550
+			}
551
+		}
552 552
 
553
-        if ( $return ) {
554
-            return $result;
553
+		if ( $return ) {
554
+			return $result;
555 555
 		}
556 556
 
557
-        $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
557
+		$type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
558 558
 
559
-        $result[] = 'created_at';
560
-        if ( $type == 'template' ) {
561
-            $result[] = 'id';
562
-            $result[] = 'form_key';
563
-        }
559
+		$result[] = 'created_at';
560
+		if ( $type == 'template' ) {
561
+			$result[] = 'id';
562
+			$result[] = 'form_key';
563
+		}
564 564
 
565
-        return $result;
566
-    }
565
+		return $result;
566
+	}
567 567
 
568 568
 	public static function save_per_page( $save, $option, $value ) {
569
-        if ( $option == 'formidable_page_formidable_per_page' ) {
570
-            $save = (int) $value;
571
-        }
572
-        return $save;
573
-    }
569
+		if ( $option == 'formidable_page_formidable_per_page' ) {
570
+			$save = (int) $value;
571
+		}
572
+		return $save;
573
+	}
574 574
 
575 575
 	private static function get_edit_vars( $id, $errors = array(), $message = '', $create_link = false ) {
576
-        global $frm_vars;
576
+		global $frm_vars;
577 577
 
578
-        $form = FrmForm::getOne( $id );
579
-        if ( ! $form ) {
580
-            wp_die( __( 'You are trying to edit a form that does not exist.', 'formidable' ) );
581
-        }
578
+		$form = FrmForm::getOne( $id );
579
+		if ( ! $form ) {
580
+			wp_die( __( 'You are trying to edit a form that does not exist.', 'formidable' ) );
581
+		}
582 582
 
583
-        if ( $form->parent_form_id ) {
584
-            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>' ));
585
-        }
583
+		if ( $form->parent_form_id ) {
584
+			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>' ));
585
+		}
586 586
 
587 587
 		$frm_field_selection = FrmField::field_selection();
588
-        $fields = FrmField::get_all_for_form($form->id);
588
+		$fields = FrmField::get_all_for_form($form->id);
589 589
 
590
-        // Automatically add end section fields if they don't exist (2.0 migration)
591
-        $reset_fields = false;
592
-        FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields );
590
+		// Automatically add end section fields if they don't exist (2.0 migration)
591
+		$reset_fields = false;
592
+		FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields );
593 593
 
594
-        if ( $reset_fields ) {
595
-            $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
596
-        }
594
+		if ( $reset_fields ) {
595
+			$fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
596
+		}
597 597
 
598
-        unset($end_section_values, $last_order, $open, $reset_fields);
598
+		unset($end_section_values, $last_order, $open, $reset_fields);
599 599
 
600
-        $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
600
+		$values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
601 601
 
602
-        $edit_message = __( 'Form was Successfully Updated', 'formidable' );
603
-        if ( $form->is_template && $message == $edit_message ) {
604
-            $message = __( 'Template was Successfully Updated', 'formidable' );
605
-        }
602
+		$edit_message = __( 'Form was Successfully Updated', 'formidable' );
603
+		if ( $form->is_template && $message == $edit_message ) {
604
+			$message = __( 'Template was Successfully Updated', 'formidable' );
605
+		}
606 606
 
607 607
 		$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
608 608
 
609
-        if ( $form->default_template ) {
610
-            wp_die(__( 'That template cannot be edited', 'formidable' ));
611
-        } else if ( defined('DOING_AJAX') ) {
612
-            wp_die();
613
-        } else if ( $create_link ) {
614
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
615
-        } else {
616
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/edit.php');
617
-        }
618
-    }
609
+		if ( $form->default_template ) {
610
+			wp_die(__( 'That template cannot be edited', 'formidable' ));
611
+		} else if ( defined('DOING_AJAX') ) {
612
+			wp_die();
613
+		} else if ( $create_link ) {
614
+			require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
615
+		} else {
616
+			require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/edit.php');
617
+		}
618
+	}
619 619
 
620 620
 	public static function get_settings_vars( $id, $errors = array(), $message = '' ) {
621 621
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
622 622
 
623
-        global $frm_vars;
623
+		global $frm_vars;
624 624
 
625
-        $form = FrmForm::getOne( $id );
625
+		$form = FrmForm::getOne( $id );
626 626
 
627
-        $fields = FrmField::get_all_for_form($id);
628
-        $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
627
+		$fields = FrmField::get_all_for_form($id);
628
+		$values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
629 629
 
630
-        if ( isset($values['default_template']) && $values['default_template'] ) {
631
-            wp_die(__( 'That template cannot be edited', 'formidable' ));
632
-        }
630
+		if ( isset($values['default_template']) && $values['default_template'] ) {
631
+			wp_die(__( 'That template cannot be edited', 'formidable' ));
632
+		}
633 633
 
634
-        $action_controls = FrmFormActionsController::get_form_actions();
634
+		$action_controls = FrmFormActionsController::get_form_actions();
635 635
 
636
-        $sections = apply_filters('frm_add_form_settings_section', array(), $values);
637
-        $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
636
+		$sections = apply_filters('frm_add_form_settings_section', array(), $values);
637
+		$pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
638 638
 
639
-        $styles = apply_filters('frm_get_style_opts', array());
639
+		$styles = apply_filters('frm_get_style_opts', array());
640 640
 
641
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/settings.php');
642
-    }
641
+		require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/settings.php');
642
+	}
643 643
 
644
-    public static function mb_tags_box( $form_id, $class = '' ) {
645
-        $fields = FrmField::get_all_for_form($form_id, '', 'include');
646
-        $linked_forms = array();
647
-        $col = 'one';
648
-        $settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false;
644
+	public static function mb_tags_box( $form_id, $class = '' ) {
645
+		$fields = FrmField::get_all_for_form($form_id, '', 'include');
646
+		$linked_forms = array();
647
+		$col = 'one';
648
+		$settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false;
649 649
 
650 650
 		$cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() );
651 651
 		$adv_shortcodes = self::get_advanced_shortcodes();
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 		$entry_shortcodes = self::get_shortcode_helpers( $settings_tab );
654 654
 
655 655
 		include( FrmAppHelper::plugin_path() . '/classes/views/shared/mb_adv_info.php' );
656
-    }
656
+	}
657 657
 
658 658
 	/**
659 659
 	 * Get an array of the options to display in the advanced tab
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 			''          => '',
695 695
 			'siteurl'   => __( 'Site URL', 'formidable' ),
696 696
 			'sitename'  => __( 'Site Name', 'formidable' ),
697
-        );
697
+		);
698 698
 
699 699
 		if ( ! FrmAppHelper::pro_is_installed() ) {
700 700
 			unset( $entry_shortcodes['post_id'] );
@@ -721,38 +721,38 @@  discard block
 block discarded – undo
721 721
 		return $entry_shortcodes;
722 722
 	}
723 723
 
724
-    // Insert the form class setting into the form
724
+	// Insert the form class setting into the form
725 725
 	public static function form_classes( $form ) {
726
-        if ( isset($form->options['form_class']) ) {
726
+		if ( isset($form->options['form_class']) ) {
727 727
 			echo esc_attr( sanitize_text_field( $form->options['form_class'] ) );
728
-        }
729
-    }
728
+		}
729
+	}
730 730
 
731
-    public static function get_email_html() {
732
-        check_ajax_referer( 'frm_ajax', 'nonce' );
731
+	public static function get_email_html() {
732
+		check_ajax_referer( 'frm_ajax', 'nonce' );
733 733
 		echo FrmEntryFormat::show_entry( array(
734 734
 			'form_id'       => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ),
735
-	        'default_email' => true,
735
+			'default_email' => true,
736 736
 			'plain_text'    => FrmAppHelper::get_post_param( 'plain_text', '', 'absint' ),
737
-	    ) );
738
-	    wp_die();
737
+		) );
738
+		wp_die();
739 739
 	}
740 740
 
741
-    public static function filter_content( $content, $form, $entry = false ) {
741
+	public static function filter_content( $content, $form, $entry = false ) {
742 742
 		self::get_entry_by_param( $entry );
743
-        if ( ! $entry ) {
744
-            return $content;
745
-        }
743
+		if ( ! $entry ) {
744
+			return $content;
745
+		}
746 746
 
747
-        if ( is_object( $form ) ) {
748
-            $form = $form->id;
749
-        }
747
+		if ( is_object( $form ) ) {
748
+			$form = $form->id;
749
+		}
750 750
 
751
-        $shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form );
752
-        $content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes );
751
+		$shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form );
752
+		$content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes );
753 753
 
754
-        return $content;
755
-    }
754
+		return $content;
755
+	}
756 756
 
757 757
 	private static function get_entry_by_param( &$entry ) {
758 758
 		if ( ! $entry || ! is_object( $entry ) ) {
@@ -764,287 +764,287 @@  discard block
 block discarded – undo
764 764
 		}
765 765
 	}
766 766
 
767
-    public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
768
-        return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes );
769
-    }
767
+	public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
768
+		return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes );
769
+	}
770 770
 
771
-    public static function process_bulk_form_actions( $errors ) {
772
-        if ( ! $_REQUEST ) {
773
-            return $errors;
774
-        }
771
+	public static function process_bulk_form_actions( $errors ) {
772
+		if ( ! $_REQUEST ) {
773
+			return $errors;
774
+		}
775 775
 
776 776
 		$bulkaction = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
777
-        if ( $bulkaction == -1 ) {
777
+		if ( $bulkaction == -1 ) {
778 778
 			$bulkaction = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
779
-        }
780
-
781
-        if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) {
782
-            FrmAppHelper::remove_get_action();
783
-
784
-            $bulkaction = str_replace( 'bulk_', '', $bulkaction );
785
-        }
786
-
787
-        $ids = FrmAppHelper::get_param( 'item-action', '' );
788
-        if ( empty( $ids ) ) {
789
-            $errors[] = __( 'No forms were specified', 'formidable' );
790
-            return $errors;
791
-        }
792
-
793
-        $permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' );
794
-        if ( $permission_error !== false ) {
795
-            $errors[] = $permission_error;
796
-            return $errors;
797
-        }
798
-
799
-        if ( ! is_array( $ids ) ) {
800
-            $ids = explode( ',', $ids );
801
-        }
802
-
803
-        switch ( $bulkaction ) {
804
-            case 'delete':
805
-                $message = self::bulk_destroy( $ids );
806
-            break;
807
-            case 'trash':
808
-                $message = self::bulk_trash( $ids );
809
-            break;
810
-            case 'untrash':
811
-                $message = self::bulk_untrash( $ids );
812
-            break;
813
-            case 'create_template':
814
-                $message = self::bulk_create_template( $ids );
815
-            break;
816
-        }
817
-
818
-        if ( isset( $message ) && ! empty( $message ) ) {
779
+		}
780
+
781
+		if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) {
782
+			FrmAppHelper::remove_get_action();
783
+
784
+			$bulkaction = str_replace( 'bulk_', '', $bulkaction );
785
+		}
786
+
787
+		$ids = FrmAppHelper::get_param( 'item-action', '' );
788
+		if ( empty( $ids ) ) {
789
+			$errors[] = __( 'No forms were specified', 'formidable' );
790
+			return $errors;
791
+		}
792
+
793
+		$permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' );
794
+		if ( $permission_error !== false ) {
795
+			$errors[] = $permission_error;
796
+			return $errors;
797
+		}
798
+
799
+		if ( ! is_array( $ids ) ) {
800
+			$ids = explode( ',', $ids );
801
+		}
802
+
803
+		switch ( $bulkaction ) {
804
+			case 'delete':
805
+				$message = self::bulk_destroy( $ids );
806
+			break;
807
+			case 'trash':
808
+				$message = self::bulk_trash( $ids );
809
+			break;
810
+			case 'untrash':
811
+				$message = self::bulk_untrash( $ids );
812
+			break;
813
+			case 'create_template':
814
+				$message = self::bulk_create_template( $ids );
815
+			break;
816
+		}
817
+
818
+		if ( isset( $message ) && ! empty( $message ) ) {
819 819
 			echo '<div id="message" class="updated frm_msg_padding">' . FrmAppHelper::kses( $message ) . '</div>';
820
-        }
820
+		}
821 821
 
822
-        return $errors;
823
-    }
822
+		return $errors;
823
+	}
824 824
 
825
-    public static function add_default_templates( $path, $default = true, $template = true ) {
826
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' );
825
+	public static function add_default_templates( $path, $default = true, $template = true ) {
826
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' );
827 827
 
828
-        $path = untrailingslashit(trim($path));
829
-        $templates = glob( $path .'/*.php' );
828
+		$path = untrailingslashit(trim($path));
829
+		$templates = glob( $path .'/*.php' );
830 830
 
831 831
 		for ( $i = count( $templates ) - 1; $i >= 0; $i-- ) {
832
-            $filename = str_replace( '.php', '', str_replace( $path.'/', '', $templates[ $i ] ) );
832
+			$filename = str_replace( '.php', '', str_replace( $path.'/', '', $templates[ $i ] ) );
833 833
 			$template_query = array( 'form_key' => $filename );
834
-            if ( $template ) {
835
-                $template_query['is_template'] = 1;
836
-            }
837
-            if ( $default ) {
838
-                $template_query['default_template'] = 1;
839
-            }
834
+			if ( $template ) {
835
+				$template_query['is_template'] = 1;
836
+			}
837
+			if ( $default ) {
838
+				$template_query['default_template'] = 1;
839
+			}
840 840
 			$form = FrmForm::getAll( $template_query, '', 1 );
841 841
 
842
-            $values = FrmFormsHelper::setup_new_vars();
843
-            $values['form_key'] = $filename;
844
-            $values['is_template'] = $template;
845
-            $values['status'] = 'published';
846
-            if ( $default ) {
847
-                $values['default_template'] = 1;
848
-            }
849
-
850
-            include( $templates[ $i ] );
851
-
852
-            //get updated form
853
-            if ( isset($form) && ! empty($form) ) {
854
-                $old_id = $form->id;
855
-                $form = FrmForm::getOne($form->id);
856
-            } else {
857
-                $old_id = false;
842
+			$values = FrmFormsHelper::setup_new_vars();
843
+			$values['form_key'] = $filename;
844
+			$values['is_template'] = $template;
845
+			$values['status'] = 'published';
846
+			if ( $default ) {
847
+				$values['default_template'] = 1;
848
+			}
849
+
850
+			include( $templates[ $i ] );
851
+
852
+			//get updated form
853
+			if ( isset($form) && ! empty($form) ) {
854
+				$old_id = $form->id;
855
+				$form = FrmForm::getOne($form->id);
856
+			} else {
857
+				$old_id = false;
858 858
 				$form = FrmForm::getAll( $template_query, '', 1 );
859
-            }
859
+			}
860 860
 
861
-            if ( $form ) {
861
+			if ( $form ) {
862 862
 				do_action( 'frm_after_duplicate_form', $form->id, (array) $form, array( 'old_id' => $old_id ) );
863
-            }
864
-        }
865
-    }
863
+			}
864
+		}
865
+	}
866 866
 
867
-    public static function route() {
868
-        $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
869
-        $vars = array();
867
+	public static function route() {
868
+		$action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
869
+		$vars = array();
870 870
 		if ( isset( $_POST['frm_compact_fields'] ) ) {
871 871
 			FrmAppHelper::permission_check( 'frm_edit_forms' );
872 872
 
873
-            $json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('&quot;', '\\\"', $_POST['frm_compact_fields'] ))));
874
-            $json_vars = json_decode($json_vars, true);
875
-            if ( empty($json_vars) ) {
876
-                // json decoding failed so we should return an error message
873
+			$json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('&quot;', '\\\"', $_POST['frm_compact_fields'] ))));
874
+			$json_vars = json_decode($json_vars, true);
875
+			if ( empty($json_vars) ) {
876
+				// json decoding failed so we should return an error message
877 877
 				$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
878
-                if ( 'edit' == $action ) {
879
-                    $action = 'update';
880
-                }
881
-
882
-                add_filter('frm_validate_form', 'FrmFormsController::json_error');
883
-            } else {
884
-                $vars = FrmAppHelper::json_to_array($json_vars);
885
-                $action = $vars[ $action ];
878
+				if ( 'edit' == $action ) {
879
+					$action = 'update';
880
+				}
881
+
882
+				add_filter('frm_validate_form', 'FrmFormsController::json_error');
883
+			} else {
884
+				$vars = FrmAppHelper::json_to_array($json_vars);
885
+				$action = $vars[ $action ];
886 886
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] );
887 887
 				$_REQUEST = array_merge( $_REQUEST, $vars );
888 888
 				$_POST = array_merge( $_POST, $_REQUEST );
889
-            }
890
-        } else {
889
+			}
890
+		} else {
891 891
 			$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
892
-    		if ( isset( $_REQUEST['delete_all'] ) ) {
893
-                // override the action for this page
894
-    			$action = 'delete_all';
895
-            }
896
-        }
892
+			if ( isset( $_REQUEST['delete_all'] ) ) {
893
+				// override the action for this page
894
+				$action = 'delete_all';
895
+			}
896
+		}
897 897
 
898 898
 		add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' );
899
-        FrmAppHelper::trigger_hook_load( 'form' );
900
-
901
-        switch ( $action ) {
902
-            case 'new':
903
-                return self::new_form($vars);
904
-            case 'create':
905
-            case 'edit':
906
-            case 'update':
907
-            case 'duplicate':
908
-            case 'trash':
909
-            case 'untrash':
910
-            case 'destroy':
911
-            case 'delete_all':
912
-            case 'settings':
913
-            case 'update_settings':
899
+		FrmAppHelper::trigger_hook_load( 'form' );
900
+
901
+		switch ( $action ) {
902
+			case 'new':
903
+				return self::new_form($vars);
904
+			case 'create':
905
+			case 'edit':
906
+			case 'update':
907
+			case 'duplicate':
908
+			case 'trash':
909
+			case 'untrash':
910
+			case 'destroy':
911
+			case 'delete_all':
912
+			case 'settings':
913
+			case 'update_settings':
914 914
 				return self::$action( $vars );
915
-            default:
916
-                do_action('frm_form_action_'. $action);
917
-                if ( apply_filters('frm_form_stop_action_'. $action, false) ) {
918
-                    return;
919
-                }
915
+			default:
916
+				do_action('frm_form_action_'. $action);
917
+				if ( apply_filters('frm_form_stop_action_'. $action, false) ) {
918
+					return;
919
+				}
920 920
 
921 921
 				$action = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
922
-                if ( $action == -1 ) {
922
+				if ( $action == -1 ) {
923 923
 					$action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
924
-                }
924
+				}
925 925
 
926
-                if ( strpos($action, 'bulk_') === 0 ) {
927
-                    FrmAppHelper::remove_get_action();
928
-                    return self::list_form();
929
-                }
926
+				if ( strpos($action, 'bulk_') === 0 ) {
927
+					FrmAppHelper::remove_get_action();
928
+					return self::list_form();
929
+				}
930 930
 
931
-                return self::display_forms_list();
932
-        }
933
-    }
931
+				return self::display_forms_list();
932
+		}
933
+	}
934 934
 
935
-    public static function json_error( $errors ) {
936
-        $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
937
-        return $errors;
938
-    }
935
+	public static function json_error( $errors ) {
936
+		$errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
937
+		return $errors;
938
+	}
939 939
 
940 940
 
941
-    /* FRONT-END FORMS */
942
-    public static function admin_bar_css() {
941
+	/* FRONT-END FORMS */
942
+	public static function admin_bar_css() {
943 943
 		if ( is_admin() || ! current_user_can( 'frm_edit_forms' ) ) {
944
-            return;
945
-        }
944
+			return;
945
+		}
946 946
 
947 947
 		add_action( 'wp_before_admin_bar_render', 'FrmFormsController::admin_bar_configure' );
948 948
 		FrmAppHelper::load_font_style();
949 949
 	}
950 950
 
951 951
 	public static function admin_bar_configure() {
952
-        global $frm_vars;
953
-        if ( empty($frm_vars['forms_loaded']) ) {
954
-            return;
955
-        }
956
-
957
-        $actions = array();
958
-        foreach ( $frm_vars['forms_loaded'] as $form ) {
959
-            if ( is_object($form) ) {
960
-                $actions[ $form->id ] = $form->name;
961
-            }
962
-            unset($form);
963
-        }
964
-
965
-        if ( empty($actions) ) {
966
-            return;
967
-        }
968
-
969
-        asort($actions);
970
-
971
-        global $wp_admin_bar;
972
-
973
-        if ( count($actions) == 1 ) {
974
-            $wp_admin_bar->add_menu( array(
975
-                'title' => 'Edit Form',
976
-                'href'  => admin_url('admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) )),
977
-                'id'    => 'frm-forms',
978
-            ) );
979
-        } else {
980
-            $wp_admin_bar->add_menu( array(
981
-        		'id'    => 'frm-forms',
982
-        		'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>',
983
-        		'href'  => admin_url( 'admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) ) ),
984
-        		'meta'  => array(
952
+		global $frm_vars;
953
+		if ( empty($frm_vars['forms_loaded']) ) {
954
+			return;
955
+		}
956
+
957
+		$actions = array();
958
+		foreach ( $frm_vars['forms_loaded'] as $form ) {
959
+			if ( is_object($form) ) {
960
+				$actions[ $form->id ] = $form->name;
961
+			}
962
+			unset($form);
963
+		}
964
+
965
+		if ( empty($actions) ) {
966
+			return;
967
+		}
968
+
969
+		asort($actions);
970
+
971
+		global $wp_admin_bar;
972
+
973
+		if ( count($actions) == 1 ) {
974
+			$wp_admin_bar->add_menu( array(
975
+				'title' => 'Edit Form',
976
+				'href'  => admin_url('admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) )),
977
+				'id'    => 'frm-forms',
978
+			) );
979
+		} else {
980
+			$wp_admin_bar->add_menu( array(
981
+				'id'    => 'frm-forms',
982
+				'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>',
983
+				'href'  => admin_url( 'admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) ) ),
984
+				'meta'  => array(
985 985
 					'title' => __( 'Edit Forms', 'formidable' ),
986
-        		),
987
-        	) );
986
+				),
987
+			) );
988 988
 
989
-        	foreach ( $actions as $form_id => $name ) {
989
+			foreach ( $actions as $form_id => $name ) {
990 990
 
991
-        		$wp_admin_bar->add_menu( array(
992
-        			'parent'    => 'frm-forms',
993
-        			'id'        => 'edit_form_'. $form_id,
994
-        			'title'     => empty($name) ? __( '(no title)') : $name,
991
+				$wp_admin_bar->add_menu( array(
992
+					'parent'    => 'frm-forms',
993
+					'id'        => 'edit_form_'. $form_id,
994
+					'title'     => empty($name) ? __( '(no title)') : $name,
995 995
 					'href'      => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ),
996
-        		) );
997
-        	}
998
-        }
999
-    }
996
+				) );
997
+			}
998
+		}
999
+	}
1000 1000
 
1001
-    //formidable shortcode
1001
+	//formidable shortcode
1002 1002
 	public static function get_form_shortcode( $atts ) {
1003
-        global $frm_vars;
1004
-        if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) {
1005
-            $sc = '[formidable';
1003
+		global $frm_vars;
1004
+		if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) {
1005
+			$sc = '[formidable';
1006 1006
 			if ( ! empty( $atts ) ) {
1007 1007
 				foreach ( $atts as $k => $v ) {
1008 1008
 					$sc .= ' ' . $k . '="' . esc_attr( $v ) . '"';
1009 1009
 				}
1010 1010
 			}
1011
-            return $sc .']';
1012
-        }
1013
-
1014
-        $shortcode_atts = shortcode_atts( array(
1015
-            'id' => '', 'key' => '', 'title' => false, 'description' => false,
1016
-            'readonly' => false, 'entry_id' => false, 'fields' => array(),
1017
-            'exclude_fields' => array(), 'minimize' => false,
1018
-        ), $atts);
1019
-        do_action('formidable_shortcode_atts', $shortcode_atts, $atts);
1020
-
1021
-        return self::show_form(
1022
-            $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'],
1023
-            $shortcode_atts['description'], $atts
1024
-        );
1025
-    }
1026
-
1027
-    public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) {
1028
-        if ( empty( $id ) ) {
1029
-            $id = $key;
1030
-        }
1031
-
1032
-        // no form id or key set
1033
-        if ( empty( $id ) ) {
1034
-            return __( 'Please select a valid form', 'formidable' );
1035
-        }
1036
-
1037
-        $form = FrmForm::getOne( $id );
1038
-        if ( ! $form || $form->parent_form_id ) {
1039
-            return __( 'Please select a valid form', 'formidable' );
1040
-        }
1011
+			return $sc .']';
1012
+		}
1013
+
1014
+		$shortcode_atts = shortcode_atts( array(
1015
+			'id' => '', 'key' => '', 'title' => false, 'description' => false,
1016
+			'readonly' => false, 'entry_id' => false, 'fields' => array(),
1017
+			'exclude_fields' => array(), 'minimize' => false,
1018
+		), $atts);
1019
+		do_action('formidable_shortcode_atts', $shortcode_atts, $atts);
1020
+
1021
+		return self::show_form(
1022
+			$shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'],
1023
+			$shortcode_atts['description'], $atts
1024
+		);
1025
+	}
1026
+
1027
+	public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) {
1028
+		if ( empty( $id ) ) {
1029
+			$id = $key;
1030
+		}
1031
+
1032
+		// no form id or key set
1033
+		if ( empty( $id ) ) {
1034
+			return __( 'Please select a valid form', 'formidable' );
1035
+		}
1036
+
1037
+		$form = FrmForm::getOne( $id );
1038
+		if ( ! $form || $form->parent_form_id ) {
1039
+			return __( 'Please select a valid form', 'formidable' );
1040
+		}
1041 1041
 
1042 1042
 		add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' );
1043
-        FrmAppHelper::trigger_hook_load( 'form', $form );
1043
+		FrmAppHelper::trigger_hook_load( 'form', $form );
1044 1044
 
1045
-        $form = apply_filters( 'frm_pre_display_form', $form );
1045
+		$form = apply_filters( 'frm_pre_display_form', $form );
1046 1046
 
1047
-        $frm_settings = FrmAppHelper::get_settings();
1047
+		$frm_settings = FrmAppHelper::get_settings();
1048 1048
 
1049 1049
 		if ( self::is_viewable_draft_form( $form ) ) {
1050 1050
 			// don't show a draft form on a page
@@ -1065,7 +1065,7 @@  discard block
 block discarded – undo
1065 1065
 		}
1066 1066
 
1067 1067
 		return $form;
1068
-    }
1068
+	}
1069 1069
 
1070 1070
 	private static function is_viewable_draft_form( $form ) {
1071 1071
 		global $post;
@@ -1081,98 +1081,98 @@  discard block
 block discarded – undo
1081 1081
 		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'] );
1082 1082
 	}
1083 1083
 
1084
-    public static function get_form( $form, $title, $description, $atts = array() ) {
1085
-        ob_start();
1084
+	public static function get_form( $form, $title, $description, $atts = array() ) {
1085
+		ob_start();
1086 1086
 
1087
-        self::get_form_contents( $form, $title, $description, $atts );
1087
+		self::get_form_contents( $form, $title, $description, $atts );
1088 1088
 		self::enqueue_scripts( FrmForm::get_params( $form ) );
1089 1089
 
1090
-        $contents = ob_get_contents();
1091
-        ob_end_clean();
1090
+		$contents = ob_get_contents();
1091
+		ob_end_clean();
1092 1092
 
1093 1093
 		self::maybe_minimize_form( $atts, $contents );
1094 1094
 
1095
-        return $contents;
1096
-    }
1095
+		return $contents;
1096
+	}
1097 1097
 
1098 1098
 	public static function enqueue_scripts( $params ) {
1099 1099
 		do_action( 'frm_enqueue_form_scripts', $params );
1100 1100
 	}
1101 1101
 
1102 1102
 	public static function get_form_contents( $form, $title, $description, $atts ) {
1103
-        global $frm_vars;
1103
+		global $frm_vars;
1104 1104
 
1105
-        $frm_settings = FrmAppHelper::get_settings();
1105
+		$frm_settings = FrmAppHelper::get_settings();
1106 1106
 
1107
-        $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value;
1107
+		$submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value;
1108 1108
 
1109
-        $user_ID = get_current_user_id();
1109
+		$user_ID = get_current_user_id();
1110 1110
 		$params = FrmForm::get_params( $form );
1111
-        $message = $errors = '';
1111
+		$message = $errors = '';
1112 1112
 
1113
-        if ( $params['posted_form_id'] == $form->id && $_POST ) {
1114
-            $errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array();
1115
-        }
1113
+		if ( $params['posted_form_id'] == $form->id && $_POST ) {
1114
+			$errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array();
1115
+		}
1116 1116
 
1117 1117
 		$include_form_tag = apply_filters( 'frm_include_form_tag', true, $form );
1118
-        $fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) );
1119
-
1120
-        if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) {
1121
-            do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
1122
-            if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) {
1123
-                $values = FrmEntriesHelper::setup_new_vars($fields, $form);
1124
-                include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1125
-            }
1126
-            return;
1127
-        }
1128
-
1129
-        if ( ! empty($errors) ) {
1130
-            $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array();
1131
-            include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1132
-            return;
1133
-        }
1134
-
1135
-        do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
1136
-        if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) {
1137
-            return;
1138
-        }
1139
-
1140
-        $values = FrmEntriesHelper::setup_new_vars($fields, $form, true);
1141
-        $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0;
1142
-        $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create');
1143
-
1144
-        if ( $created && is_numeric($created) && $conf_method != 'message' ) {
1145
-            do_action('frm_success_action', $conf_method, $form, $form->options, $created);
1118
+		$fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) );
1119
+
1120
+		if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) {
1121
+			do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
1122
+			if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) {
1123
+				$values = FrmEntriesHelper::setup_new_vars($fields, $form);
1124
+				include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1125
+			}
1126
+			return;
1127
+		}
1128
+
1129
+		if ( ! empty($errors) ) {
1130
+			$values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array();
1131
+			include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1132
+			return;
1133
+		}
1134
+
1135
+		do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
1136
+		if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) {
1137
+			return;
1138
+		}
1139
+
1140
+		$values = FrmEntriesHelper::setup_new_vars($fields, $form, true);
1141
+		$created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0;
1142
+		$conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create');
1143
+
1144
+		if ( $created && is_numeric($created) && $conf_method != 'message' ) {
1145
+			do_action('frm_success_action', $conf_method, $form, $form->options, $created);
1146 1146
 			do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
1147
-            return;
1148
-        }
1147
+			return;
1148
+		}
1149 1149
 
1150
-        if ( $created && is_numeric($created) ) {
1151
-            $message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg;
1152
-            $class = 'frm_message';
1153
-        } else {
1154
-            $message = $frm_settings->failed_msg;
1155
-            $class = 'frm_error_style';
1156
-        }
1150
+		if ( $created && is_numeric($created) ) {
1151
+			$message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg;
1152
+			$class = 'frm_message';
1153
+		} else {
1154
+			$message = $frm_settings->failed_msg;
1155
+			$class = 'frm_error_style';
1156
+		}
1157 1157
 
1158 1158
 		$message = FrmFormsHelper::get_success_message( array(
1159 1159
 			'message' => $message, 'form' => $form,
1160 1160
 			'entry_id' => $created, 'class' => $class,
1161 1161
 		) );
1162
-        $message = apply_filters('frm_main_feedback', $message, $form, $created);
1162
+		$message = apply_filters('frm_main_feedback', $message, $form, $created);
1163 1163
 
1164
-        if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) {
1165
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1166
-        } else {
1167
-            global $frm_vars;
1164
+		if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) {
1165
+			require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1166
+		} else {
1167
+			global $frm_vars;
1168 1168
 			self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] );
1169 1169
 
1170
-            $include_extra_container = 'frm_forms'. FrmFormsHelper::get_form_style_class($values);
1171
-            include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php');
1172
-        }
1170
+			$include_extra_container = 'frm_forms'. FrmFormsHelper::get_form_style_class($values);
1171
+			include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php');
1172
+		}
1173 1173
 
1174 1174
 		do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
1175
-    }
1175
+	}
1176 1176
 
1177 1177
 	public static function front_head() {
1178 1178
 		$version = FrmAppHelper::plugin_version();
Please login to merge, or discard this patch.
Spacing   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@  discard block
 block discarded – undo
7 7
 		if ( ! FrmAppHelper::pro_is_installed() ) {
8 8
 			$menu_label .= ' (Lite)';
9 9
 		}
10
-		add_submenu_page('formidable', 'Formidable | '. $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' );
10
+		add_submenu_page( 'formidable', 'Formidable | ' . $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' );
11 11
 
12
-	    add_filter('get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' );
12
+	    add_filter( 'get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' );
13 13
 
14
-	    add_filter('manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 );
15
-		add_filter('manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' );
14
+	    add_filter( 'manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 );
15
+		add_filter( 'manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' );
16 16
     }
17 17
 
18 18
     public static function head() {
19
-        wp_enqueue_script('formidable-editinplace');
19
+        wp_enqueue_script( 'formidable-editinplace' );
20 20
 
21 21
         if ( wp_is_mobile() ) {
22 22
     		wp_enqueue_script( 'jquery-touch-punch' );
@@ -24,49 +24,49 @@  discard block
 block discarded – undo
24 24
     }
25 25
 
26 26
     public static function register_widgets() {
27
-        require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php');
28
-        register_widget('FrmShowForm');
27
+        require_once( FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php' );
28
+        register_widget( 'FrmShowForm' );
29 29
     }
30 30
 
31 31
     public static function list_form() {
32
-        FrmAppHelper::permission_check('frm_view_forms');
32
+        FrmAppHelper::permission_check( 'frm_view_forms' );
33 33
 
34 34
 		$params = FrmForm::list_page_params();
35
-        $errors = self::process_bulk_form_actions( array());
36
-        $errors = apply_filters('frm_admin_list_form_action', $errors);
35
+        $errors = self::process_bulk_form_actions( array() );
36
+        $errors = apply_filters( 'frm_admin_list_form_action', $errors );
37 37
 
38 38
 		return self::display_forms_list( $params, '', $errors );
39 39
     }
40 40
 
41 41
 	public static function new_form( $values = array() ) {
42
-        FrmAppHelper::permission_check('frm_edit_forms');
42
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
43 43
 
44 44
         global $frm_vars;
45 45
 
46
-        $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
47
-		$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ];
46
+        $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
47
+		$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[$action];
48 48
 
49 49
 		if ( $action == 'create' ) {
50
-            return self::create($values);
50
+            return self::create( $values );
51 51
 		} else if ( $action == 'new' ) {
52 52
 			$frm_field_selection = FrmField::field_selection();
53
-            $values = FrmFormsHelper::setup_new_vars($values);
53
+            $values = FrmFormsHelper::setup_new_vars( $values );
54 54
             $id = FrmForm::create( $values );
55
-            $form = FrmForm::getOne($id);
55
+            $form = FrmForm::getOne( $id );
56 56
 
57 57
             // add default email notification
58 58
             $action_control = FrmFormActionsController::get_form_actions( 'email' );
59
-            $action_control->create($form->id);
59
+            $action_control->create( $form->id );
60 60
 
61 61
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
62 62
 
63 63
             $values['id'] = $id;
64
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
64
+            require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
65 65
         }
66 66
     }
67 67
 
68 68
 	public static function create( $values = array() ) {
69
-        FrmAppHelper::permission_check('frm_edit_forms');
69
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
70 70
 
71 71
         global $frm_vars;
72 72
         if ( empty( $values ) ) {
@@ -78,58 +78,58 @@  discard block
 block discarded – undo
78 78
             $values = FrmProEntry::mod_other_vals( $values, 'back' );
79 79
         }
80 80
 
81
-		$id = isset($values['id']) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
81
+		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
82 82
 
83 83
         if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
84 84
             $frm_settings = FrmAppHelper::get_settings();
85 85
             $errors = array( 'form' => $frm_settings->admin_permission );
86 86
         } else {
87
-            $errors = FrmForm::validate($values);
87
+            $errors = FrmForm::validate( $values );
88 88
         }
89 89
 
90
-        if ( count($errors) > 0 ) {
90
+        if ( count( $errors ) > 0 ) {
91 91
             $hide_preview = true;
92 92
 			$frm_field_selection = FrmField::field_selection();
93 93
             $form = FrmForm::getOne( $id );
94
-            $fields = FrmField::get_all_for_form($id);
94
+            $fields = FrmField::get_all_for_form( $id );
95 95
 
96
-            $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
96
+            $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true );
97 97
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
98 98
 
99
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
99
+            require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
100 100
         } else {
101 101
             FrmForm::update( $id, $values, true );
102
-            die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id='. $id)));
102
+            die( FrmAppHelper::js_redirect( admin_url( 'admin.php?page=formidable&frm_action=settings&id=' . $id ) ) );
103 103
         }
104 104
     }
105 105
 
106 106
     public static function edit( $values = false ) {
107
-        FrmAppHelper::permission_check('frm_edit_forms');
107
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
108 108
 
109 109
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
110
-        return self::get_edit_vars($id);
110
+        return self::get_edit_vars( $id );
111 111
     }
112 112
 
113 113
     public static function settings( $id = false, $message = '' ) {
114
-        FrmAppHelper::permission_check('frm_edit_forms');
114
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
115 115
 
116
-        if ( ! $id || ! is_numeric($id) ) {
116
+        if ( ! $id || ! is_numeric( $id ) ) {
117 117
 			$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
118 118
         }
119 119
 		return self::get_settings_vars( $id, array(), $message );
120 120
     }
121 121
 
122 122
     public static function update_settings() {
123
-        FrmAppHelper::permission_check('frm_edit_forms');
123
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
124 124
 
125 125
 		$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
126 126
 
127
-        $errors = FrmForm::validate($_POST);
128
-        if ( count($errors) > 0 ) {
129
-            return self::get_settings_vars($id, $errors);
127
+        $errors = FrmForm::validate( $_POST );
128
+        if ( count( $errors ) > 0 ) {
129
+            return self::get_settings_vars( $id, $errors );
130 130
         }
131 131
 
132
-        do_action('frm_before_update_form_settings', $id);
132
+        do_action( 'frm_before_update_form_settings', $id );
133 133
 
134 134
 		FrmForm::update( $id, $_POST );
135 135
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
 	private static function edit_in_place_value( $field ) {
153 153
 		check_ajax_referer( 'frm_ajax', 'nonce' );
154
-		FrmAppHelper::permission_check('frm_edit_forms', 'hide');
154
+		FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' );
155 155
 
156 156
 		$form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
157 157
 		$value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_filter_post_kses' );
@@ -223,15 +223,15 @@  discard block
 block discarded – undo
223 223
 	}
224 224
 
225 225
     public static function duplicate() {
226
-        FrmAppHelper::permission_check('frm_edit_forms');
226
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
227 227
 
228 228
 		$params = FrmForm::list_page_params();
229 229
         $form = FrmForm::duplicate( $params['id'], $params['template'], true );
230
-        $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
230
+        $message = ( $params['template'] ) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
231 231
         if ( $form ) {
232 232
 			return self::get_edit_vars( $form, array(), $message, true );
233 233
         } else {
234
-            return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' ));
234
+            return self::display_forms_list( $params, __( 'There was a problem creating the new template.', 'formidable' ) );
235 235
         }
236 236
     }
237 237
 
@@ -257,14 +257,14 @@  discard block
 block discarded – undo
257 257
         if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) {
258 258
             global $wp;
259 259
             $root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
260
-            include_once( $root.'/wp-config.php' );
260
+            include_once( $root . '/wp-config.php' );
261 261
             $wp->init();
262 262
             $wp->register_globals();
263 263
         }
264 264
 
265 265
 		self::register_pro_scripts();
266 266
 
267
-		header( 'Content-Type: text/html; charset='. get_option( 'blog_charset' ) );
267
+		header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
268 268
 
269 269
 		$key = FrmAppHelper::simple_get( 'form', 'sanitize_title' );
270 270
 		if ( $key == '' ) {
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 			$form = FrmForm::getAll( array(), '', 1 );
277 277
         }
278 278
 
279
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/direct.php');
279
+        require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php' );
280 280
         wp_die();
281 281
     }
282 282
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 		if ( FrmAppHelper::pro_is_installed() ) {
285 285
 			wp_register_script( 'jquery-frm-rating', FrmAppHelper::plugin_url() . '/pro/js/jquery.rating.min.js', array( 'jquery' ), '4.11', true );
286 286
 			wp_register_script( 'jquery-maskedinput', FrmAppHelper::plugin_url() . '/pro/js/jquery.maskedinput.min.js', array( 'jquery' ), '1.4', true );
287
-			wp_register_script( 'jquery-chosen', FrmAppHelper::plugin_url() .'/pro/js/chosen.jquery.min.js', array( 'jquery' ), '1.2.0', true );
287
+			wp_register_script( 'jquery-chosen', FrmAppHelper::plugin_url() . '/pro/js/chosen.jquery.min.js', array( 'jquery' ), '1.2.0', true );
288 288
 		}
289 289
 	}
290 290
 
@@ -293,11 +293,11 @@  discard block
 block discarded – undo
293 293
     }
294 294
 
295 295
 	public static function bulk_untrash( $ids ) {
296
-        FrmAppHelper::permission_check('frm_edit_forms');
296
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
297 297
 
298 298
         $count = FrmForm::set_status( $ids, 'published' );
299 299
 
300
-        $message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
300
+        $message = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
301 301
         return $message;
302 302
     }
303 303
 
@@ -316,90 +316,90 @@  discard block
 block discarded – undo
316 316
 			'trash'   => array( 'permission' => 'frm_delete_forms', 'new_status' => 'trash' ),
317 317
 		);
318 318
 
319
-		if ( ! isset( $available_status[ $status ] ) ) {
319
+		if ( ! isset( $available_status[$status] ) ) {
320 320
 			return;
321 321
 		}
322 322
 
323
-		FrmAppHelper::permission_check( $available_status[ $status ]['permission'] );
323
+		FrmAppHelper::permission_check( $available_status[$status]['permission'] );
324 324
 
325 325
 		$params = FrmForm::list_page_params();
326 326
 
327 327
 		//check nonce url
328
-		check_admin_referer($status .'_form_' . $params['id']);
328
+		check_admin_referer( $status . '_form_' . $params['id'] );
329 329
 
330 330
 		$count = 0;
331
-		if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
332
-			$count++;
331
+		if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) {
332
+			$count ++;
333 333
 		}
334 334
 
335
-		$available_status['untrash']['message'] = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count );
336
-		$available_status['trash']['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=untrash&form_type='. ( isset( $_REQUEST['form_type'] ) ? sanitize_title( $_REQUEST['form_type'] ) : '' ) . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' );
335
+		$available_status['untrash']['message'] = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count );
336
+		$available_status['trash']['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=untrash&form_type=' . ( isset( $_REQUEST['form_type'] ) ? sanitize_title( $_REQUEST['form_type'] ) : '' ) . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' );
337 337
 
338
-		$message = $available_status[ $status ]['message'];
338
+		$message = $available_status[$status]['message'];
339 339
 
340 340
 		self::display_forms_list( $params, $message );
341 341
 	}
342 342
 
343 343
 	public static function bulk_trash( $ids ) {
344
-        FrmAppHelper::permission_check('frm_delete_forms');
344
+        FrmAppHelper::permission_check( 'frm_delete_forms' );
345 345
 
346 346
         $count = 0;
347 347
         foreach ( $ids as $id ) {
348 348
             if ( FrmForm::trash( $id ) ) {
349
-                $count++;
349
+                $count ++;
350 350
             }
351 351
         }
352 352
 
353 353
         $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
354
-        $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>' );
354
+        $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>' );
355 355
 
356 356
         return $message;
357 357
     }
358 358
 
359 359
     public static function destroy() {
360
-        FrmAppHelper::permission_check('frm_delete_forms');
360
+        FrmAppHelper::permission_check( 'frm_delete_forms' );
361 361
 
362 362
 		$params = FrmForm::list_page_params();
363 363
 
364 364
         //check nonce url
365
-        check_admin_referer('destroy_form_' . $params['id']);
365
+        check_admin_referer( 'destroy_form_' . $params['id'] );
366 366
 
367 367
         $count = 0;
368 368
         if ( FrmForm::destroy( $params['id'] ) ) {
369
-            $count++;
369
+            $count ++;
370 370
         }
371 371
 
372
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
372
+        $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
373 373
 
374 374
 		self::display_forms_list( $params, $message );
375 375
     }
376 376
 
377 377
 	public static function bulk_destroy( $ids ) {
378
-        FrmAppHelper::permission_check('frm_delete_forms');
378
+        FrmAppHelper::permission_check( 'frm_delete_forms' );
379 379
 
380 380
         $count = 0;
381 381
         foreach ( $ids as $id ) {
382 382
             $d = FrmForm::destroy( $id );
383 383
             if ( $d ) {
384
-                $count++;
384
+                $count ++;
385 385
             }
386 386
         }
387 387
 
388
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
388
+        $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
389 389
 
390 390
         return $message;
391 391
     }
392 392
 
393 393
     private static function delete_all() {
394 394
         //check nonce url
395
-        $permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable');
395
+        $permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable' );
396 396
         if ( $permission_error !== false ) {
397 397
 			self::display_forms_list( array(), '', array( $permission_error ) );
398 398
             return;
399 399
         }
400 400
 
401 401
 		$count = FrmForm::scheduled_delete( time() );
402
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
402
+        $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
403 403
 
404 404
 		self::display_forms_list( array(), $message );
405 405
     }
@@ -416,9 +416,9 @@  discard block
 block discarded – undo
416 416
 	* @since 2.0.15
417 417
 	*/
418 418
 	public static function insert_form_button() {
419
-		if ( current_user_can('frm_view_forms') ) {
419
+		if ( current_user_can( 'frm_view_forms' ) ) {
420 420
 			$frm_settings = FrmAppHelper::get_settings();
421
-			$content = '<a href="#TB_inline?width=50&height=50&inlineId=frm_insert_form" class="thickbox button add_media frm_insert_form" title="' . esc_attr__( 'Add forms and content', 'formidable' ) . '"><span class="frm-buttons-icon wp-media-buttons-icon"></span> '. $frm_settings->menu .'</a>';
421
+			$content = '<a href="#TB_inline?width=50&height=50&inlineId=frm_insert_form" class="thickbox button add_media frm_insert_form" title="' . esc_attr__( 'Add forms and content', 'formidable' ) . '"><span class="frm-buttons-icon wp-media-buttons-icon"></span> ' . $frm_settings->menu . '</a>';
422 422
 			echo wp_kses_post( $content );
423 423
 		}
424 424
 	}
@@ -435,21 +435,21 @@  discard block
 block discarded – undo
435 435
 			'formidable' => array( 'name' => __( 'Form', 'formidable' ), 'label' => __( 'Insert a Form', 'formidable' ) ),
436 436
         );
437 437
 
438
-        $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes);
438
+        $shortcodes = apply_filters( 'frm_popup_shortcodes', $shortcodes );
439 439
 
440
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/insert_form_popup.php');
440
+        include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/insert_form_popup.php' );
441 441
     }
442 442
 
443 443
     public static function get_shortcode_opts() {
444 444
         check_ajax_referer( 'frm_ajax', 'nonce' );
445 445
 
446 446
 		$shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' );
447
-        if ( empty($shortcode) ) {
447
+        if ( empty( $shortcode ) ) {
448 448
             wp_die();
449 449
         }
450 450
 
451
-        echo '<div id="sc-opts-'. esc_attr( $shortcode ) .'" class="frm_shortcode_option">';
452
-        echo '<input type="radio" name="frmsc" value="'. esc_attr($shortcode) .'" id="sc-'. esc_attr($shortcode) .'" class="frm_hidden" />';
451
+        echo '<div id="sc-opts-' . esc_attr( $shortcode ) . '" class="frm_shortcode_option">';
452
+        echo '<input type="radio" name="frmsc" value="' . esc_attr( $shortcode ) . '" id="sc-' . esc_attr( $shortcode ) . '" class="frm_hidden" />';
453 453
 
454 454
         $form_id = '';
455 455
         $opts = array();
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
                 );
465 465
             break;
466 466
         }
467
-        $opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode);
467
+        $opts = apply_filters( 'frm_sc_popup_opts', $opts, $shortcode );
468 468
 
469 469
 		if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) {
470 470
 			// allow other shortcodes to use the required form id option
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 			unset( $opts['form_id'] );
473 473
 		}
474 474
 
475
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/shortcode_opts.php');
475
+        include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/shortcode_opts.php' );
476 476
 
477 477
         echo '</div>';
478 478
 
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
             die();
505 505
         }
506 506
 
507
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/list.php');
507
+        require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list.php' );
508 508
     }
509 509
 
510 510
 	public static function get_columns( $columns ) {
@@ -581,11 +581,11 @@  discard block
 block discarded – undo
581 581
         }
582 582
 
583 583
         if ( $form->parent_form_id ) {
584
-            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>' ));
584
+            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>' ) );
585 585
         }
586 586
 
587 587
 		$frm_field_selection = FrmField::field_selection();
588
-        $fields = FrmField::get_all_for_form($form->id);
588
+        $fields = FrmField::get_all_for_form( $form->id );
589 589
 
590 590
         // Automatically add end section fields if they don't exist (2.0 migration)
591 591
         $reset_fields = false;
@@ -595,9 +595,9 @@  discard block
 block discarded – undo
595 595
             $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
596 596
         }
597 597
 
598
-        unset($end_section_values, $last_order, $open, $reset_fields);
598
+        unset( $end_section_values, $last_order, $open, $reset_fields );
599 599
 
600
-        $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
600
+        $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true );
601 601
 
602 602
         $edit_message = __( 'Form was Successfully Updated', 'formidable' );
603 603
         if ( $form->is_template && $message == $edit_message ) {
@@ -607,13 +607,13 @@  discard block
 block discarded – undo
607 607
 		$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
608 608
 
609 609
         if ( $form->default_template ) {
610
-            wp_die(__( 'That template cannot be edited', 'formidable' ));
611
-        } else if ( defined('DOING_AJAX') ) {
610
+            wp_die( __( 'That template cannot be edited', 'formidable' ) );
611
+        } else if ( defined( 'DOING_AJAX' ) ) {
612 612
             wp_die();
613 613
         } else if ( $create_link ) {
614
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
614
+            require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
615 615
         } else {
616
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/edit.php');
616
+            require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/edit.php' );
617 617
         }
618 618
     }
619 619
 
@@ -624,28 +624,28 @@  discard block
 block discarded – undo
624 624
 
625 625
         $form = FrmForm::getOne( $id );
626 626
 
627
-        $fields = FrmField::get_all_for_form($id);
628
-        $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
627
+        $fields = FrmField::get_all_for_form( $id );
628
+        $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true );
629 629
 
630
-        if ( isset($values['default_template']) && $values['default_template'] ) {
631
-            wp_die(__( 'That template cannot be edited', 'formidable' ));
630
+        if ( isset( $values['default_template'] ) && $values['default_template'] ) {
631
+            wp_die( __( 'That template cannot be edited', 'formidable' ) );
632 632
         }
633 633
 
634 634
         $action_controls = FrmFormActionsController::get_form_actions();
635 635
 
636
-        $sections = apply_filters('frm_add_form_settings_section', array(), $values);
636
+        $sections = apply_filters( 'frm_add_form_settings_section', array(), $values );
637 637
         $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
638 638
 
639
-        $styles = apply_filters('frm_get_style_opts', array());
639
+        $styles = apply_filters( 'frm_get_style_opts', array() );
640 640
 
641
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/settings.php');
641
+        require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings.php' );
642 642
     }
643 643
 
644 644
     public static function mb_tags_box( $form_id, $class = '' ) {
645
-        $fields = FrmField::get_all_for_form($form_id, '', 'include');
645
+        $fields = FrmField::get_all_for_form( $form_id, '', 'include' );
646 646
         $linked_forms = array();
647 647
         $col = 'one';
648
-        $settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false;
648
+        $settings_tab = FrmAppHelper::is_admin_page( 'formidable' ) ? true : false;
649 649
 
650 650
 		$cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() );
651 651
 		$adv_shortcodes = self::get_advanced_shortcodes();
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 
724 724
     // Insert the form class setting into the form
725 725
 	public static function form_classes( $form ) {
726
-        if ( isset($form->options['form_class']) ) {
726
+        if ( isset( $form->options['form_class'] ) ) {
727 727
 			echo esc_attr( sanitize_text_field( $form->options['form_class'] ) );
728 728
         }
729 729
     }
@@ -825,11 +825,11 @@  discard block
 block discarded – undo
825 825
     public static function add_default_templates( $path, $default = true, $template = true ) {
826 826
         _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' );
827 827
 
828
-        $path = untrailingslashit(trim($path));
829
-        $templates = glob( $path .'/*.php' );
828
+        $path = untrailingslashit( trim( $path ) );
829
+        $templates = glob( $path . '/*.php' );
830 830
 
831
-		for ( $i = count( $templates ) - 1; $i >= 0; $i-- ) {
832
-            $filename = str_replace( '.php', '', str_replace( $path.'/', '', $templates[ $i ] ) );
831
+		for ( $i = count( $templates ) - 1; $i >= 0; $i -- ) {
832
+            $filename = str_replace( '.php', '', str_replace( $path . '/', '', $templates[$i] ) );
833 833
 			$template_query = array( 'form_key' => $filename );
834 834
             if ( $template ) {
835 835
                 $template_query['is_template'] = 1;
@@ -847,12 +847,12 @@  discard block
 block discarded – undo
847 847
                 $values['default_template'] = 1;
848 848
             }
849 849
 
850
-            include( $templates[ $i ] );
850
+            include( $templates[$i] );
851 851
 
852 852
             //get updated form
853
-            if ( isset($form) && ! empty($form) ) {
853
+            if ( isset( $form ) && ! empty( $form ) ) {
854 854
                 $old_id = $form->id;
855
-                $form = FrmForm::getOne($form->id);
855
+                $form = FrmForm::getOne( $form->id );
856 856
             } else {
857 857
                 $old_id = false;
858 858
 				$form = FrmForm::getAll( $template_query, '', 1 );
@@ -865,24 +865,24 @@  discard block
 block discarded – undo
865 865
     }
866 866
 
867 867
     public static function route() {
868
-        $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
868
+        $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
869 869
         $vars = array();
870 870
 		if ( isset( $_POST['frm_compact_fields'] ) ) {
871 871
 			FrmAppHelper::permission_check( 'frm_edit_forms' );
872 872
 
873
-            $json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('&quot;', '\\\"', $_POST['frm_compact_fields'] ))));
874
-            $json_vars = json_decode($json_vars, true);
875
-            if ( empty($json_vars) ) {
873
+            $json_vars = htmlspecialchars_decode( nl2br( stripslashes( str_replace( '&quot;', '\\\"', $_POST['frm_compact_fields'] ) ) ) );
874
+            $json_vars = json_decode( $json_vars, true );
875
+            if ( empty( $json_vars ) ) {
876 876
                 // json decoding failed so we should return an error message
877 877
 				$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
878 878
                 if ( 'edit' == $action ) {
879 879
                     $action = 'update';
880 880
                 }
881 881
 
882
-                add_filter('frm_validate_form', 'FrmFormsController::json_error');
882
+                add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
883 883
             } else {
884
-                $vars = FrmAppHelper::json_to_array($json_vars);
885
-                $action = $vars[ $action ];
884
+                $vars = FrmAppHelper::json_to_array( $json_vars );
885
+                $action = $vars[$action];
886 886
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] );
887 887
 				$_REQUEST = array_merge( $_REQUEST, $vars );
888 888
 				$_POST = array_merge( $_POST, $_REQUEST );
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
 
901 901
         switch ( $action ) {
902 902
             case 'new':
903
-                return self::new_form($vars);
903
+                return self::new_form( $vars );
904 904
             case 'create':
905 905
             case 'edit':
906 906
             case 'update':
@@ -913,8 +913,8 @@  discard block
 block discarded – undo
913 913
             case 'update_settings':
914 914
 				return self::$action( $vars );
915 915
             default:
916
-                do_action('frm_form_action_'. $action);
917
-                if ( apply_filters('frm_form_stop_action_'. $action, false) ) {
916
+                do_action( 'frm_form_action_' . $action );
917
+                if ( apply_filters( 'frm_form_stop_action_' . $action, false ) ) {
918 918
                     return;
919 919
                 }
920 920
 
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
 					$action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
924 924
                 }
925 925
 
926
-                if ( strpos($action, 'bulk_') === 0 ) {
926
+                if ( strpos( $action, 'bulk_' ) === 0 ) {
927 927
                     FrmAppHelper::remove_get_action();
928 928
                     return self::list_form();
929 929
                 }
@@ -950,37 +950,37 @@  discard block
 block discarded – undo
950 950
 
951 951
 	public static function admin_bar_configure() {
952 952
         global $frm_vars;
953
-        if ( empty($frm_vars['forms_loaded']) ) {
953
+        if ( empty( $frm_vars['forms_loaded'] ) ) {
954 954
             return;
955 955
         }
956 956
 
957 957
         $actions = array();
958 958
         foreach ( $frm_vars['forms_loaded'] as $form ) {
959
-            if ( is_object($form) ) {
960
-                $actions[ $form->id ] = $form->name;
959
+            if ( is_object( $form ) ) {
960
+                $actions[$form->id] = $form->name;
961 961
             }
962
-            unset($form);
962
+            unset( $form );
963 963
         }
964 964
 
965
-        if ( empty($actions) ) {
965
+        if ( empty( $actions ) ) {
966 966
             return;
967 967
         }
968 968
 
969
-        asort($actions);
969
+        asort( $actions );
970 970
 
971 971
         global $wp_admin_bar;
972 972
 
973
-        if ( count($actions) == 1 ) {
973
+        if ( count( $actions ) == 1 ) {
974 974
             $wp_admin_bar->add_menu( array(
975 975
                 'title' => 'Edit Form',
976
-                'href'  => admin_url('admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) )),
976
+                'href'  => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . current( array_keys( $actions ) ) ),
977 977
                 'id'    => 'frm-forms',
978 978
             ) );
979 979
         } else {
980 980
             $wp_admin_bar->add_menu( array(
981 981
         		'id'    => 'frm-forms',
982 982
         		'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>',
983
-        		'href'  => admin_url( 'admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) ) ),
983
+        		'href'  => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . current( array_keys( $actions ) ) ),
984 984
         		'meta'  => array(
985 985
 					'title' => __( 'Edit Forms', 'formidable' ),
986 986
         		),
@@ -990,8 +990,8 @@  discard block
 block discarded – undo
990 990
 
991 991
         		$wp_admin_bar->add_menu( array(
992 992
         			'parent'    => 'frm-forms',
993
-        			'id'        => 'edit_form_'. $form_id,
994
-        			'title'     => empty($name) ? __( '(no title)') : $name,
993
+        			'id'        => 'edit_form_' . $form_id,
994
+        			'title'     => empty( $name ) ? __( '(no title)' ) : $name,
995 995
 					'href'      => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ),
996 996
         		) );
997 997
         	}
@@ -1001,22 +1001,22 @@  discard block
 block discarded – undo
1001 1001
     //formidable shortcode
1002 1002
 	public static function get_form_shortcode( $atts ) {
1003 1003
         global $frm_vars;
1004
-        if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) {
1004
+        if ( isset( $frm_vars['skip_shortcode'] ) && $frm_vars['skip_shortcode'] ) {
1005 1005
             $sc = '[formidable';
1006 1006
 			if ( ! empty( $atts ) ) {
1007 1007
 				foreach ( $atts as $k => $v ) {
1008 1008
 					$sc .= ' ' . $k . '="' . esc_attr( $v ) . '"';
1009 1009
 				}
1010 1010
 			}
1011
-            return $sc .']';
1011
+            return $sc . ']';
1012 1012
         }
1013 1013
 
1014 1014
         $shortcode_atts = shortcode_atts( array(
1015 1015
             'id' => '', 'key' => '', 'title' => false, 'description' => false,
1016 1016
             'readonly' => false, 'entry_id' => false, 'fields' => array(),
1017 1017
             'exclude_fields' => array(), 'minimize' => false,
1018
-        ), $atts);
1019
-        do_action('formidable_shortcode_atts', $shortcode_atts, $atts);
1018
+        ), $atts );
1019
+        do_action( 'formidable_shortcode_atts', $shortcode_atts, $atts );
1020 1020
 
1021 1021
         return self::show_form(
1022 1022
             $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'],
@@ -1104,51 +1104,51 @@  discard block
 block discarded – undo
1104 1104
 
1105 1105
         $frm_settings = FrmAppHelper::get_settings();
1106 1106
 
1107
-        $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value;
1107
+        $submit = isset( $form->options['submit_value'] ) ? $form->options['submit_value'] : $frm_settings->submit_value;
1108 1108
 
1109 1109
         $user_ID = get_current_user_id();
1110 1110
 		$params = FrmForm::get_params( $form );
1111 1111
         $message = $errors = '';
1112 1112
 
1113 1113
         if ( $params['posted_form_id'] == $form->id && $_POST ) {
1114
-            $errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array();
1114
+            $errors = isset( $frm_vars['created_entries'][$form->id] ) ? $frm_vars['created_entries'][$form->id]['errors'] : array();
1115 1115
         }
1116 1116
 
1117 1117
 		$include_form_tag = apply_filters( 'frm_include_form_tag', true, $form );
1118 1118
         $fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) );
1119 1119
 
1120 1120
         if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) {
1121
-            do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
1122
-            if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) {
1123
-                $values = FrmEntriesHelper::setup_new_vars($fields, $form);
1124
-                include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1121
+            do_action( 'frm_display_form_action', $params, $fields, $form, $title, $description );
1122
+            if ( apply_filters( 'frm_continue_to_new', true, $form->id, $params['action'] ) ) {
1123
+                $values = FrmEntriesHelper::setup_new_vars( $fields, $form );
1124
+                include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' );
1125 1125
             }
1126 1126
             return;
1127 1127
         }
1128 1128
 
1129
-        if ( ! empty($errors) ) {
1130
-            $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array();
1131
-            include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1129
+        if ( ! empty( $errors ) ) {
1130
+            $values = $fields ? FrmEntriesHelper::setup_new_vars( $fields, $form ) : array();
1131
+            include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' );
1132 1132
             return;
1133 1133
         }
1134 1134
 
1135
-        do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
1136
-        if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) {
1135
+        do_action( 'frm_validate_form_creation', $params, $fields, $form, $title, $description );
1136
+        if ( ! apply_filters( 'frm_continue_to_create', true, $form->id ) ) {
1137 1137
             return;
1138 1138
         }
1139 1139
 
1140
-        $values = FrmEntriesHelper::setup_new_vars($fields, $form, true);
1141
-        $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0;
1142
-        $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create');
1140
+        $values = FrmEntriesHelper::setup_new_vars( $fields, $form, true );
1141
+        $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][$form->id] ) ) ? $frm_vars['created_entries'][$form->id]['entry_id'] : 0;
1142
+        $conf_method = apply_filters( 'frm_success_filter', 'message', $form, $form->options, 'create' );
1143 1143
 
1144
-        if ( $created && is_numeric($created) && $conf_method != 'message' ) {
1145
-            do_action('frm_success_action', $conf_method, $form, $form->options, $created);
1144
+        if ( $created && is_numeric( $created ) && $conf_method != 'message' ) {
1145
+            do_action( 'frm_success_action', $conf_method, $form, $form->options, $created );
1146 1146
 			do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
1147 1147
             return;
1148 1148
         }
1149 1149
 
1150
-        if ( $created && is_numeric($created) ) {
1151
-            $message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg;
1150
+        if ( $created && is_numeric( $created ) ) {
1151
+            $message = isset( $form->options['success_msg'] ) ? $form->options['success_msg'] : $frm_settings->success_msg;
1152 1152
             $class = 'frm_message';
1153 1153
         } else {
1154 1154
             $message = $frm_settings->failed_msg;
@@ -1159,16 +1159,16 @@  discard block
 block discarded – undo
1159 1159
 			'message' => $message, 'form' => $form,
1160 1160
 			'entry_id' => $created, 'class' => $class,
1161 1161
 		) );
1162
-        $message = apply_filters('frm_main_feedback', $message, $form, $created);
1162
+        $message = apply_filters( 'frm_main_feedback', $message, $form, $created );
1163 1163
 
1164
-        if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) {
1165
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1164
+        if ( ! isset( $form->options['show_form'] ) || $form->options['show_form'] ) {
1165
+            require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' );
1166 1166
         } else {
1167 1167
             global $frm_vars;
1168 1168
 			self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] );
1169 1169
 
1170
-            $include_extra_container = 'frm_forms'. FrmFormsHelper::get_form_style_class($values);
1171
-            include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php');
1170
+            $include_extra_container = 'frm_forms' . FrmFormsHelper::get_form_style_class( $values );
1171
+            include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/errors.php' );
1172 1172
         }
1173 1173
 
1174 1174
 		do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
Please login to merge, or discard this patch.
classes/controllers/FrmAddonsController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -3,10 +3,10 @@  discard block
 block discarded – undo
3 3
 class FrmAddonsController {
4 4
 
5 5
 	public static function menu() {
6
-		add_submenu_page( 'formidable', 'Formidable | '. __( 'AddOns', 'formidable' ), __( 'AddOns', 'formidable' ), 'frm_view_forms', 'formidable-addons', 'FrmAddonsController::list_addons' );
6
+		add_submenu_page( 'formidable', 'Formidable | ' . __( 'AddOns', 'formidable' ), __( 'AddOns', 'formidable' ), 'frm_view_forms', 'formidable-addons', 'FrmAddonsController::list_addons' );
7 7
 
8 8
 		if ( FrmAppHelper::get_affiliate() ) {
9
-			add_submenu_page( 'formidable', 'Formidable | '. __( 'Upgrade to Pro', 'formidable' ), __( 'Upgrade to Pro', 'formidable' ), 'frm_view_forms', 'formidable-pro-upgrade', 'FrmAddonsController::upgrade_to_pro' );
9
+			add_submenu_page( 'formidable', 'Formidable | ' . __( 'Upgrade to Pro', 'formidable' ), __( 'Upgrade to Pro', 'formidable' ), 'frm_view_forms', 'formidable-pro-upgrade', 'FrmAddonsController::upgrade_to_pro' );
10 10
 		}
11 11
 	}
12 12
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
 		$keyed_addons = array();
40 40
 		foreach ( $addons as $addon ) {
41
-			$keyed_addons[ $addon['info']['slug'] ] = $addon;
41
+			$keyed_addons[$addon['info']['slug']] = $addon;
42 42
 		}
43 43
 
44 44
 		$plugin_order = array(
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 		);
48 48
 		$ordered_addons = array();
49 49
 		foreach ( $plugin_order as $plugin ) {
50
-			if ( isset( $keyed_addons[ $plugin ] ) ) {
51
-				$ordered_addons[] = $keyed_addons[ $plugin ];
52
-				unset( $keyed_addons[ $plugin ] );
50
+			if ( isset( $keyed_addons[$plugin] ) ) {
51
+				$ordered_addons[] = $keyed_addons[$plugin];
52
+				unset( $keyed_addons[$plugin] );
53 53
 			}
54 54
 		}
55 55
 		$addons = $ordered_addons + $keyed_addons;
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 	}
85 85
 
86 86
 	public static function get_licenses() {
87
-		$license = get_option('frmpro-credentials');
87
+		$license = get_option( 'frmpro-credentials' );
88 88
 		if ( $license && is_array( $license ) && isset( $license['license'] ) ) {
89
-			$url = 'http://formidablepro.com/frm-edd-api/licenses?l='. urlencode( base64_encode( $license['license'] ) );
89
+			$url = 'http://formidablepro.com/frm-edd-api/licenses?l=' . urlencode( base64_encode( $license['license'] ) );
90 90
 			$licenses = self::send_api_request( $url, array( 'name' => 'frm_api_licence', 'expires' => 60 * 60 * 5 ) );
91 91
 			echo json_encode( $licenses );
92 92
 		}
Please login to merge, or discard this patch.
classes/views/addons/upgrade_to_pro.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 			<tr>
7 7
 				<th></th>
8 8
 			<?php foreach ( $pro['pricing'] as $name => $price ) {
9
-				$price_id++;
9
+				$price_id ++;
10 10
 				if ( $name == 'smallbusiness' ) {
11 11
 					$name = 'Small Business';
12 12
 				} ?>
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 			<tr>
51 51
 				<th>Included AddOns</th>
52 52
 				<td>None</td>
53
-				<td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com/pricing/#addon-lists') ) ?>" target="_blank">Basic Addons</a></td>
54
-				<td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com/pricing/#addon-lists') ) ?>" target="_blank">Advanced Addons</a></td>
55
-				<td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com/pricing/#addon-lists') ) ?>" target="_blank">Enterprise Addons</a></td>
53
+				<td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/pricing/#addon-lists' ) ) ?>" target="_blank">Basic Addons</a></td>
54
+				<td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/pricing/#addon-lists' ) ) ?>" target="_blank">Advanced Addons</a></td>
55
+				<td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/pricing/#addon-lists' ) ) ?>" target="_blank">Enterprise Addons</a></td>
56 56
 			</tr>
57 57
 		</tbody>
58 58
 	</table>
Please login to merge, or discard this patch.
classes/controllers/FrmAppController.php 2 patches
Indentation   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@  discard block
 block discarded – undo
3 3
 class FrmAppController {
4 4
 
5 5
 	public static function menu() {
6
-        FrmAppHelper::maybe_add_permissions();
7
-        if ( ! current_user_can( 'frm_view_forms' ) ) {
8
-            return;
9
-        }
6
+		FrmAppHelper::maybe_add_permissions();
7
+		if ( ! current_user_can( 'frm_view_forms' ) ) {
8
+			return;
9
+		}
10 10
 
11
-        $frm_settings = FrmAppHelper::get_settings();
12
-        add_menu_page( 'Formidable', $frm_settings->menu, 'frm_view_forms', 'formidable', 'FrmFormsController::route', FrmAppHelper::plugin_url() . '/images/form_16.png', self::get_menu_position() );
13
-    }
11
+		$frm_settings = FrmAppHelper::get_settings();
12
+		add_menu_page( 'Formidable', $frm_settings->menu, 'frm_view_forms', 'formidable', 'FrmFormsController::route', FrmAppHelper::plugin_url() . '/images/form_16.png', self::get_menu_position() );
13
+	}
14 14
 
15 15
 	private static function get_menu_position() {
16 16
 		$count = count( get_post_types( array( 'show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) ) );
@@ -19,39 +19,39 @@  discard block
 block discarded – undo
19 19
 		return $pos;
20 20
 	}
21 21
 
22
-    public static function load_wp_admin_style() {
23
-        FrmAppHelper::load_font_style();
24
-    }
22
+	public static function load_wp_admin_style() {
23
+		FrmAppHelper::load_font_style();
24
+	}
25 25
 
26 26
 	public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) {
27
-        global $pagenow, $frm_vars;
27
+		global $pagenow, $frm_vars;
28 28
 
29 29
 		$show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' );
30
-        if ( empty( $show_nav ) ) {
31
-            return;
32
-        }
30
+		if ( empty( $show_nav ) ) {
31
+			return;
32
+		}
33 33
 
34 34
 		$current_page = isset( $_GET['page'] ) ? FrmAppHelper::simple_get( 'page', 'sanitize_title' ) : FrmAppHelper::simple_get( 'post_type', 'sanitize_title', 'None' );
35 35
 		if ( $pagenow == 'post.php' || $pagenow == 'post-new.php' ) {
36 36
 			$current_page = 'frm_display';
37 37
 		}
38 38
 
39
-        if ( $form ) {
39
+		if ( $form ) {
40 40
 			FrmForm::maybe_get_form( $form );
41 41
 
42
-            if ( is_object( $form ) ) {
43
-                $id = $form->id;
44
-            }
45
-        }
42
+			if ( is_object( $form ) ) {
43
+				$id = $form->id;
44
+			}
45
+		}
46 46
 
47
-        if ( ! isset( $id ) ) {
48
-            $form = $id = false;
49
-        }
47
+		if ( ! isset( $id ) ) {
48
+			$form = $id = false;
49
+		}
50 50
 
51 51
 		$nav_items = self::get_form_nav_items( $id );
52 52
 
53
-        include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
54
-    }
53
+		include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
54
+	}
55 55
 
56 56
 	private static function get_form_nav_items( $id ) {
57 57
 		$nav_items = array(
@@ -82,28 +82,28 @@  discard block
 block discarded – undo
82 82
 		return $nav_items;
83 83
 	}
84 84
 
85
-    // Adds a settings link to the plugins page
86
-    public static function settings_link( $links ) {
85
+	// Adds a settings link to the plugins page
86
+	public static function settings_link( $links ) {
87 87
 		$settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings' ) ) . '">' . __( 'Settings', 'formidable' ) . '</a>';
88
-        array_unshift( $links, $settings );
88
+		array_unshift( $links, $settings );
89 89
 
90
-        return $links;
91
-    }
90
+		return $links;
91
+	}
92 92
 
93
-    public static function pro_get_started_headline() {
93
+	public static function pro_get_started_headline() {
94 94
 		self::maybe_show_upgrade_bar();
95 95
 
96
-        // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message
97
-        if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) {
98
-            return;
99
-        }
96
+		// Don't display this error as we're upgrading the thing, or if the user shouldn't see the message
97
+		if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) {
98
+			return;
99
+		}
100 100
 
101 101
 		if ( get_site_option( 'frmpro-authorized' ) && ! file_exists( FrmAppHelper::plugin_path() . '/pro/formidable-pro.php' ) ) {
102
-            FrmAppHelper::load_admin_wide_js();
102
+			FrmAppHelper::load_admin_wide_js();
103 103
 
104
-            // user is authorized, but running free version
105
-            $inst_install_url = 'https://formidablepro.com/knowledgebase/install-formidable-forms/';
106
-        ?>
104
+			// user is authorized, but running free version
105
+			$inst_install_url = 'https://formidablepro.com/knowledgebase/install-formidable-forms/';
106
+		?>
107 107
 <div class="error" class="frm_previous_install">
108 108
 		<?php
109 109
 		echo wp_kses_post( apply_filters( 'frm_pro_update_msg',
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 		) ); ?>
116 116
 </div>
117 117
 <?php
118
-        }
119
-    }
118
+		}
119
+	}
120 120
 
121 121
 	private static function maybe_show_upgrade_bar() {
122 122
 		$page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		}
216 216
 	}
217 217
 
218
-    public static function admin_js() {
218
+	public static function admin_js() {
219 219
 		$version = FrmAppHelper::plugin_version();
220 220
 		FrmAppHelper::load_admin_wide_js( false );
221 221
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 			'bootstrap_tooltip', 'bootstrap-multiselect',
227 227
 		), $version, true );
228 228
 		wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version );
229
-        wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
229
+		wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
230 230
 
231 231
 		// load multselect js
232 232
 		wp_register_script( 'bootstrap-multiselect', FrmAppHelper::plugin_url() . '/js/bootstrap-multiselect.js', array( 'jquery', 'bootstrap_tooltip' ), '0.9.8', true );
@@ -237,78 +237,78 @@  discard block
 block discarded – undo
237 237
 		global $pagenow;
238 238
 		if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) {
239 239
 
240
-            wp_enqueue_script( 'admin-widgets' );
241
-            wp_enqueue_style( 'widgets' );
242
-            wp_enqueue_script( 'formidable' );
243
-            wp_enqueue_script( 'formidable_admin' );
240
+			wp_enqueue_script( 'admin-widgets' );
241
+			wp_enqueue_style( 'widgets' );
242
+			wp_enqueue_script( 'formidable' );
243
+			wp_enqueue_script( 'formidable_admin' );
244 244
 			FrmAppHelper::localize_script( 'admin' );
245 245
 
246
-            wp_enqueue_style( 'formidable-admin' );
247
-            add_thickbox();
246
+			wp_enqueue_style( 'formidable-admin' );
247
+			add_thickbox();
248 248
 
249
-            wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' );
249
+			wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' );
250 250
 
251
-        } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) {
252
-            if ( isset( $_REQUEST['post_type'] ) ) {
253
-                $post_type = sanitize_title( $_REQUEST['post_type'] );
251
+		} else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) {
252
+			if ( isset( $_REQUEST['post_type'] ) ) {
253
+				$post_type = sanitize_title( $_REQUEST['post_type'] );
254 254
 			} else if ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) {
255 255
 				$post = get_post( absint( $_REQUEST['post'] ) );
256
-                if ( ! $post ) {
257
-                    return;
258
-                }
259
-                $post_type = $post->post_type;
260
-            } else {
261
-                return;
262
-            }
263
-
264
-            if ( $post_type == 'frm_display' ) {
265
-                wp_enqueue_script( 'jquery-ui-draggable' );
266
-                wp_enqueue_script( 'formidable_admin' );
267
-                wp_enqueue_style( 'formidable-admin' );
256
+				if ( ! $post ) {
257
+					return;
258
+				}
259
+				$post_type = $post->post_type;
260
+			} else {
261
+				return;
262
+			}
263
+
264
+			if ( $post_type == 'frm_display' ) {
265
+				wp_enqueue_script( 'jquery-ui-draggable' );
266
+				wp_enqueue_script( 'formidable_admin' );
267
+				wp_enqueue_style( 'formidable-admin' );
268 268
 				FrmAppHelper::localize_script( 'admin' );
269
-            }
270
-        } else if ( $pagenow == 'widgets.php' ) {
271
-            FrmAppHelper::load_admin_wide_js();
272
-        }
273
-    }
274
-
275
-    public static function wp_admin_body_class( $classes ) {
276
-        global $wp_version;
277
-        //we need this class everywhere in the admin for the menu
278
-        if ( version_compare( $wp_version, '3.7.2', '>' ) ) {
279
-            $classes .= ' frm_38_trigger';
280
-        }
281
-
282
-        return $classes;
283
-    }
284
-
285
-    public static function load_lang() {
286
-        load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
287
-    }
288
-
289
-    /**
290
-     * Filter shortcodes in text widgets
291
-     */
292
-    public static function widget_text_filter( $content ) {
293
-    	$regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/';
294
-    	return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content );
295
-    }
296
-
297
-    public static function widget_text_filter_callback( $matches ) {
298
-        _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::widget_text_filter_callback' );
299
-        return FrmAppHelper::widget_text_filter_callback( $matches );
300
-    }
301
-
302
-    public static function front_head() {
303
-        if ( is_multisite() ) {
304
-            $old_db_version = get_option( 'frm_db_version' );
305
-            $pro_db_version = FrmAppHelper::pro_is_installed() ? get_option( 'frmpro_db_version' ) : false;
306
-            if ( ( (int) $old_db_version < (int) FrmAppHelper::$db_version ) ||
307
-                ( FrmAppHelper::pro_is_installed() && (int) $pro_db_version < (int) FrmAppHelper::$pro_db_version ) ) {
308
-                self::install( $old_db_version );
309
-            }
310
-        }
311
-    }
269
+			}
270
+		} else if ( $pagenow == 'widgets.php' ) {
271
+			FrmAppHelper::load_admin_wide_js();
272
+		}
273
+	}
274
+
275
+	public static function wp_admin_body_class( $classes ) {
276
+		global $wp_version;
277
+		//we need this class everywhere in the admin for the menu
278
+		if ( version_compare( $wp_version, '3.7.2', '>' ) ) {
279
+			$classes .= ' frm_38_trigger';
280
+		}
281
+
282
+		return $classes;
283
+	}
284
+
285
+	public static function load_lang() {
286
+		load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
287
+	}
288
+
289
+	/**
290
+	 * Filter shortcodes in text widgets
291
+	 */
292
+	public static function widget_text_filter( $content ) {
293
+		$regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/';
294
+		return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content );
295
+	}
296
+
297
+	public static function widget_text_filter_callback( $matches ) {
298
+		_deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::widget_text_filter_callback' );
299
+		return FrmAppHelper::widget_text_filter_callback( $matches );
300
+	}
301
+
302
+	public static function front_head() {
303
+		if ( is_multisite() ) {
304
+			$old_db_version = get_option( 'frm_db_version' );
305
+			$pro_db_version = FrmAppHelper::pro_is_installed() ? get_option( 'frmpro_db_version' ) : false;
306
+			if ( ( (int) $old_db_version < (int) FrmAppHelper::$db_version ) ||
307
+				( FrmAppHelper::pro_is_installed() && (int) $pro_db_version < (int) FrmAppHelper::$pro_db_version ) ) {
308
+				self::install( $old_db_version );
309
+			}
310
+		}
311
+	}
312 312
 
313 313
 	public static function localize_script( $location ) {
314 314
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmAppHelper::localize_script' );
@@ -368,72 +368,72 @@  discard block
 block discarded – undo
368 368
 		wp_die();
369 369
 	}
370 370
 
371
-    public static function activation_install() {
372
-        FrmAppHelper::delete_cache_and_transient( 'frm_plugin_version' );
373
-        FrmFormActionsController::actions_init();
374
-        self::install();
375
-    }
371
+	public static function activation_install() {
372
+		FrmAppHelper::delete_cache_and_transient( 'frm_plugin_version' );
373
+		FrmFormActionsController::actions_init();
374
+		self::install();
375
+	}
376 376
 
377
-    public static function install( $old_db_version = false ) {
378
-        $frmdb = new FrmDb();
379
-        $frmdb->upgrade( $old_db_version );
380
-    }
377
+	public static function install( $old_db_version = false ) {
378
+		$frmdb = new FrmDb();
379
+		$frmdb->upgrade( $old_db_version );
380
+	}
381 381
 
382
-    public static function uninstall() {
383
-        check_ajax_referer( 'frm_ajax', 'nonce' );
382
+	public static function uninstall() {
383
+		check_ajax_referer( 'frm_ajax', 'nonce' );
384 384
 
385
-        if ( current_user_can( 'administrator' ) ) {
386
-            $frmdb = new FrmDb();
387
-            $frmdb->uninstall();
385
+		if ( current_user_can( 'administrator' ) ) {
386
+			$frmdb = new FrmDb();
387
+			$frmdb->uninstall();
388 388
 
389 389
 			//disable the plugin and redirect after uninstall so the tables don't get added right back
390 390
 			deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false );
391 391
 			echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) );
392
-        } else {
393
-            $frm_settings = FrmAppHelper::get_settings();
394
-            wp_die( $frm_settings->admin_permission );
395
-        }
396
-        wp_die();
397
-    }
398
-
399
-    public static function drop_tables( $tables ) {
400
-        global $wpdb;
401
-        $tables[] = $wpdb->prefix . 'frm_fields';
402
-        $tables[] = $wpdb->prefix . 'frm_forms';
403
-        $tables[] = $wpdb->prefix . 'frm_items';
404
-        $tables[] = $wpdb->prefix . 'frm_item_metas';
405
-        return $tables;
406
-    }
407
-
408
-    // Routes for wordpress pages -- we're just replacing content here folks.
409
-    public static function page_route( $content ) {
410
-        global $post;
411
-
412
-        $frm_settings = FrmAppHelper::get_settings();
413
-        if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) {
414
-            $content = FrmFormsController::page_preview();
415
-        }
416
-
417
-        return $content;
418
-    }
419
-
420
-    public static function deauthorize() {
421
-        check_ajax_referer( 'frm_ajax', 'nonce' );
422
-
423
-        delete_option( 'frmpro-credentials' );
424
-        delete_option( 'frmpro-authorized' );
425
-        delete_site_option( 'frmpro-credentials' );
426
-        delete_site_option( 'frmpro-authorized' );
427
-        wp_die();
428
-    }
429
-
430
-    public static function get_form_shortcode( $atts ) {
431
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' );
432
-        return FrmFormsController::get_form_shortcode( $atts );
433
-    }
434
-
435
-    public static function get_postbox_class() {
436
-        _deprecated_function( __FUNCTION__, '2.0' );
437
-        return 'postbox-container';
438
-    }
392
+		} else {
393
+			$frm_settings = FrmAppHelper::get_settings();
394
+			wp_die( $frm_settings->admin_permission );
395
+		}
396
+		wp_die();
397
+	}
398
+
399
+	public static function drop_tables( $tables ) {
400
+		global $wpdb;
401
+		$tables[] = $wpdb->prefix . 'frm_fields';
402
+		$tables[] = $wpdb->prefix . 'frm_forms';
403
+		$tables[] = $wpdb->prefix . 'frm_items';
404
+		$tables[] = $wpdb->prefix . 'frm_item_metas';
405
+		return $tables;
406
+	}
407
+
408
+	// Routes for wordpress pages -- we're just replacing content here folks.
409
+	public static function page_route( $content ) {
410
+		global $post;
411
+
412
+		$frm_settings = FrmAppHelper::get_settings();
413
+		if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) {
414
+			$content = FrmFormsController::page_preview();
415
+		}
416
+
417
+		return $content;
418
+	}
419
+
420
+	public static function deauthorize() {
421
+		check_ajax_referer( 'frm_ajax', 'nonce' );
422
+
423
+		delete_option( 'frmpro-credentials' );
424
+		delete_option( 'frmpro-authorized' );
425
+		delete_site_option( 'frmpro-credentials' );
426
+		delete_site_option( 'frmpro-authorized' );
427
+		wp_die();
428
+	}
429
+
430
+	public static function get_form_shortcode( $atts ) {
431
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' );
432
+		return FrmFormsController::get_form_shortcode( $atts );
433
+	}
434
+
435
+	public static function get_postbox_class() {
436
+		_deprecated_function( __FUNCTION__, '2.0' );
437
+		return 'postbox-container';
438
+	}
439 439
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@
 block discarded – undo
132 132
 		if ( ! empty( $affiliate ) ) {
133 133
 ?>
134 134
 <div class="update-nag frm-update-to-pro">
135
-	Looking for more options to get professional results? <span>Take your forms to the next level.</span> <a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com') ) ?>" class="button">Upgrade to Pro</a>
135
+	Looking for more options to get professional results? <span>Take your forms to the next level.</span> <a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com' ) ) ?>" class="button">Upgrade to Pro</a>
136 136
 </div>
137 137
 <?php
138 138
 		}
Please login to merge, or discard this patch.
classes/models/FrmAddon.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -275,7 +275,7 @@
 block discarded – undo
275 275
 		return $message;
276 276
 	}
277 277
 
278
-    public function manually_queue_update() {
279
-        set_site_transient( 'update_plugins', null );
280
-    }
278
+	public function manually_queue_update() {
279
+		set_site_transient( 'update_plugins', null );
280
+	}
281 281
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -38,15 +38,15 @@  discard block
 block discarded – undo
38 38
 	}
39 39
 
40 40
 	public function insert_installed_addon( $plugins ) {
41
-		$plugins[ $this->plugin_slug ] = $this;
41
+		$plugins[$this->plugin_slug] = $this;
42 42
 		return $plugins;
43 43
 	}
44 44
 
45 45
 	public static function get_addon( $plugin_slug ) {
46 46
 		$plugins = apply_filters( 'frm_installed_addons', array() );
47 47
 		$plugin = false;
48
-		if ( isset( $plugins[ $plugin_slug ] ) ) {
49
-			$plugin = $plugins[ $plugin_slug ];
48
+		if ( isset( $plugins[$plugin_slug] ) ) {
49
+			$plugin = $plugins[$plugin_slug];
50 50
 		}
51 51
 		return $plugin;
52 52
 	}
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	public function show_license_message( $file, $plugin ) {
99 99
 		$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
100 100
 		echo '<tr class="plugin-update-tr active"><td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"><div class="update-message">';
101
-		echo sprintf( __( 'Your %1$s license key is missing. Please add it on the %2$slicenses page%3$s.', 'formidable' ), $this->plugin_name, '<a href="' . esc_url( admin_url('admin.php?page=formidable-settings&t=licenses_settings' ) ) . '">', '</a>' );
101
+		echo sprintf( __( 'Your %1$s license key is missing. Please add it on the %2$slicenses page%3$s.', 'formidable' ), $this->plugin_name, '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings&t=licenses_settings' ) ) . '">', '</a>' );
102 102
 		$id = sanitize_title( $plugin['Name'] );
103 103
 		echo '<script type="text/javascript">var d = document.getElementById("' . esc_attr( $id ) . '");if ( d !== null ){ d.className = d.className + " update"; }</script>';
104 104
 		echo '</div></td></tr>';
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
 
112 112
 		if ( $this->is_current_version( $transient ) ) {
113 113
 			//make sure it doesn't show there is an update if plugin is up-to-date
114
-			if ( isset( $transient->response[ $this->plugin_folder ] ) ) {
115
-				unset( $transient->response[ $this->plugin_folder ] );
114
+			if ( isset( $transient->response[$this->plugin_folder] ) ) {
115
+				unset( $transient->response[$this->plugin_folder] );
116 116
 			}
117
-		} else if ( isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) ) {
117
+		} else if ( isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) ) {
118 118
 			$cache_key = 'edd_plugin_' . md5( sanitize_key( $this->license . $this->version ) . '_get_version' );
119 119
 			$version_info = get_transient( $cache_key );
120 120
 			if ( $version_info !== false && version_compare( $version_info->new_version, $this->version, '>' ) ) {
121
-				$transient->response[ $this->plugin_folder ] = $version_info;
121
+				$transient->response[$this->plugin_folder] = $version_info;
122 122
 			} else {
123 123
 				delete_transient( $cache_key );
124 124
 				if ( ! $this->has_been_cleared() ) {
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 					$this->manually_queue_update();
128 128
 				}
129 129
 
130
-				unset( $transient->response[ $this->plugin_folder ] );
130
+				unset( $transient->response[$this->plugin_folder] );
131 131
 			}
132 132
 		}
133 133
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	}
136 136
 
137 137
 	private function is_current_version( $transient ) {
138
-		if ( empty( $transient->checked ) || ! isset( $transient->checked[ $this->plugin_folder ] ) ) {
138
+		if ( empty( $transient->checked ) || ! isset( $transient->checked[$this->plugin_folder] ) ) {
139 139
 			return false;
140 140
 		}
141 141
 
@@ -144,16 +144,16 @@  discard block
 block discarded – undo
144 144
 			return true;
145 145
 		}
146 146
 
147
-		return isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) && $transient->checked[ $this->plugin_folder ] == $transient->response[ $this->plugin_folder ]->new_version;
147
+		return isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) && $transient->checked[$this->plugin_folder] == $transient->response[$this->plugin_folder]->new_version;
148 148
 	}
149 149
 
150 150
 	private function has_been_cleared() {
151 151
 		$last_cleared = get_option( 'frm_last_cleared' );
152
-		return ( $last_cleared && $last_cleared > date( 'Y-m-d H:i:s', strtotime('-5 minutes') ) );
152
+		return ( $last_cleared && $last_cleared > date( 'Y-m-d H:i:s', strtotime( '-5 minutes' ) ) );
153 153
 	}
154 154
 
155 155
 	private function cleared_plugins() {
156
-		update_option( 'frm_last_cleared', date('Y-m-d H:i:s') );
156
+		update_option( 'frm_last_cleared', date( 'Y-m-d H:i:s' ) );
157 157
 	}
158 158
 
159 159
 	public static function activate() {
@@ -253,9 +253,9 @@  discard block
 block discarded – undo
253 253
 
254 254
 		$message = __( 'Your License Key was invalid', 'formidable' );
255 255
 		if ( is_wp_error( $resp ) ) {
256
-			$message = sprintf( __( 'You had an error communicating with Formidable Pro\'s API. %1$sClick here%2$s for more information.', 'formidable' ), '<a href="http://formidablepro.com/knowledgebase/why-cant-i-activate-formidable-pro/" target="_blank">', '</a>');
256
+			$message = sprintf( __( 'You had an error communicating with Formidable Pro\'s API. %1$sClick here%2$s for more information.', 'formidable' ), '<a href="http://formidablepro.com/knowledgebase/why-cant-i-activate-formidable-pro/" target="_blank">', '</a>' );
257 257
 			if ( is_wp_error( $resp ) ) {
258
-				$message .= ' '. $resp->get_error_message();
258
+				$message .= ' ' . $resp->get_error_message();
259 259
 			}
260 260
 		} else if ( $body == 'error' || is_wp_error( $body ) ) {
261 261
 			$message = __( 'You had an HTTP error connecting to Formidable Pro\'s API', 'formidable' );
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 					$message = $json_res;
269 269
 				}
270 270
 			} else if ( isset( $resp['response'] ) && isset( $resp['response']['code'] ) ) {
271
-				$message = sprintf( __( 'There was a %1$s error: %2$s', 'formidable' ), $resp['response']['code'], $resp['response']['message'] .' '. $resp['body'] );
271
+				$message = sprintf( __( 'There was a %1$s error: %2$s', 'formidable' ), $resp['response']['code'], $resp['response']['message'] . ' ' . $resp['body'] );
272 272
 			}
273 273
 		}
274 274
 
Please login to merge, or discard this patch.
classes/views/styles/_form-description.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <div class="field-group clearfix frm-half frm-first-row">
2 2
     <label><?php _e( 'Size', 'formidable' ) ?></label>
3
-    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_size') ) ?>" id="frm_form_desc_size" value="<?php echo esc_attr( $style->post_content['form_desc_size'] ) ?>" />
3
+    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_size' ) ) ?>" id="frm_form_desc_size" value="<?php echo esc_attr( $style->post_content['form_desc_size'] ) ?>" />
4 4
 </div>
5 5
 
6 6
 <div class="field-group clearfix frm-half frm-first-row">
7 7
     <label><?php _e( 'Color', 'formidable' ) ?></label>
8
-    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_color') ) ?>" id="frm_form_desc_color" class="hex" value="<?php echo esc_attr( $style->post_content['form_desc_color'] ) ?>" />
8
+    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_color' ) ) ?>" id="frm_form_desc_color" class="hex" value="<?php echo esc_attr( $style->post_content['form_desc_color'] ) ?>" />
9 9
 </div>
10 10
 <div class="field-group clearfix frm-half">
11 11
     <label><?php _e( 'Margin Top', 'formidable' ) ?></label>
12
-    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_margin_top') ) ?>" id="frm_form_desc_margin_top" value="<?php echo esc_attr( $style->post_content['form_desc_margin_top'] ) ?>" size="4" />
12
+    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_margin_top' ) ) ?>" id="frm_form_desc_margin_top" value="<?php echo esc_attr( $style->post_content['form_desc_margin_top'] ) ?>" size="4" />
13 13
 </div>
14 14
 <div class="field-group clearfix frm-half">
15 15
     <label><?php _e( 'Margin Bottom', 'formidable' ) ?></label>
16
-    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_margin_bottom') ) ?>" id="frm_form_desc_margin_bottom" value="<?php echo esc_attr( $style->post_content['form_desc_margin_bottom'] ) ?>" size="4" />
16
+    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_margin_bottom' ) ) ?>" id="frm_form_desc_margin_bottom" value="<?php echo esc_attr( $style->post_content['form_desc_margin_bottom'] ) ?>" size="4" />
17 17
 </div>
Please login to merge, or discard this patch.