Completed
Push — master ( d6b7f2...ae2f0c )
by Jamie
05:27 queued 01:49
created
classes/controllers/FrmStylesController.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -121,6 +121,9 @@
 block discarded – undo
121 121
 		$stylesheet_urls['formidable'] = $url;
122 122
 	}
123 123
 
124
+	/**
125
+	 * @param string $version
126
+	 */
124 127
 	private static function get_css_version( $css_key, $version ) {
125 128
 		if ( 'formidable' == $css_key ) {
126 129
 			$this_version = get_option( 'frm_last_style_update' );
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -41,23 +41,23 @@  discard block
 block discarded – undo
41 41
     }
42 42
 
43 43
     public static function menu() {
44
-		add_submenu_page('formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' );
44
+		add_submenu_page( 'formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' );
45 45
     }
46 46
 
47 47
     public static function admin_init() {
48
-        if ( ! FrmAppHelper::is_admin_page('formidable-styles') ) {
48
+        if ( ! FrmAppHelper::is_admin_page( 'formidable-styles' ) ) {
49 49
             return;
50 50
         }
51 51
 
52 52
         self::load_pro_hooks();
53
-        wp_enqueue_script('jquery-ui-datepicker');
53
+        wp_enqueue_script( 'jquery-ui-datepicker' );
54 54
 
55 55
         $version = FrmAppHelper::plugin_version();
56 56
 		wp_enqueue_script( 'jquery-frm-themepicker', FrmAppHelper::plugin_url() . '/js/jquery/jquery-ui-themepicker.js', array( 'jquery' ), $version );
57 57
 
58
-		wp_enqueue_style( 'frm-custom-theme', admin_url('admin-ajax.php?action=frmpro_css' ) );
58
+		wp_enqueue_style( 'frm-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_css' ) );
59 59
 
60
-        $style = apply_filters('frm_style_head', false);
60
+        $style = apply_filters( 'frm_style_head', false );
61 61
         if ( $style ) {
62 62
 			wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) . '&' . http_build_query( $style->post_content ) );
63 63
         }
@@ -143,17 +143,17 @@  discard block
 block discarded – undo
143 143
 	}
144 144
 
145 145
 	public static function new_style( $return = '' ) {
146
-        self::load_styler('default');
146
+        self::load_styler( 'default' );
147 147
     }
148 148
 
149 149
 	public static function duplicate() {
150
-		self::load_styler('default');
150
+		self::load_styler( 'default' );
151 151
 	}
152 152
 
153 153
 	public static function edit( $style_id = false, $message = '' ) {
154 154
         if ( ! $style_id ) {
155 155
 			$style_id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
156
-            if ( empty($style_id) ) {
156
+            if ( empty( $style_id ) ) {
157 157
                 $style_id = 'default';
158 158
             }
159 159
         }
@@ -161,12 +161,12 @@  discard block
 block discarded – undo
161 161
         if ( 'default' == $style_id ) {
162 162
             $style = 'default';
163 163
         } else {
164
-            $frm_style = new FrmStyle($style_id);
164
+            $frm_style = new FrmStyle( $style_id );
165 165
             $style = $frm_style->get_one();
166 166
             $style = $style->ID;
167 167
         }
168 168
 
169
-        self::load_styler($style, $message);
169
+        self::load_styler( $style, $message );
170 170
     }
171 171
 
172 172
     public static function save() {
@@ -176,17 +176,17 @@  discard block
 block discarded – undo
176 176
 		$style_nonce = FrmAppHelper::get_post_param( 'frm_style', '', 'sanitize_text_field' );
177 177
 
178 178
 		if ( $post_id !== false && wp_verify_nonce( $style_nonce, 'frm_style_nonce' ) ) {
179
-            $id = $frm_style->update($post_id);
180
-            if ( empty($post_id) && ! empty($id) ) {
179
+            $id = $frm_style->update( $post_id );
180
+            if ( empty( $post_id ) && ! empty( $id ) ) {
181 181
                 // set the post id to the new style so it will be loaded for editing
182
-                $post_id = reset($id);
182
+                $post_id = reset( $id );
183 183
             }
184 184
             // include the CSS that includes this style
185 185
 			echo '<link href="' . esc_url( admin_url( 'admin-ajax.php?action=frmpro_css' ) ) . '" type="text/css" rel="Stylesheet" class="frm-custom-theme" />';
186 186
             $message = __( 'Your styling settings have been saved.', 'formidable' );
187 187
         }
188 188
 
189
-        return self::edit($post_id, $message);
189
+        return self::edit( $post_id, $message );
190 190
     }
191 191
 
192 192
 	public static function load_styler( $style, $message = '' ) {
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
         $frm_style = new FrmStyle();
196 196
         $styles = $frm_style->get_all();
197 197
 
198
-        if ( is_numeric($style) ) {
199
-            $style = $styles[ $style ];
198
+        if ( is_numeric( $style ) ) {
199
+            $style = $styles[$style];
200 200
         } else if ( 'default' == $style ) {
201
-            $style = $frm_style->get_default_style($styles);
201
+            $style = $frm_style->get_default_style( $styles );
202 202
         }
203 203
 
204 204
         self::add_meta_boxes();
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
 	private static function manage( $message = '', $forms = array() ) {
214 214
         $frm_style = new FrmStyle();
215 215
         $styles = $frm_style->get_all();
216
-        $default_style = $frm_style->get_default_style($styles);
216
+        $default_style = $frm_style->get_default_style( $styles );
217 217
 
218
-        if ( empty($forms) ) {
218
+        if ( empty( $forms ) ) {
219 219
             $forms = FrmForm::get_published_forms();
220 220
         }
221 221
 
@@ -232,26 +232,26 @@  discard block
 block discarded – undo
232 232
 
233 233
 		$forms = FrmForm::get_published_forms();
234 234
         foreach ( $forms as $form ) {
235
-            if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) {
235
+            if ( $_POST['style'][$form->id] == $_POST['prev_style'][$form->id] ) {
236 236
                 continue;
237 237
             }
238 238
 
239
-            $form->options['custom_style'] = $_POST['style'][ $form->id ];
239
+            $form->options['custom_style'] = $_POST['style'][$form->id];
240 240
 
241 241
 			$wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) );
242
-            unset($form);
242
+            unset( $form );
243 243
         }
244 244
 
245 245
         $message = __( 'Your form styles have been saved.', 'formidable' );
246
-        return self::manage($message, $forms);
246
+        return self::manage( $message, $forms );
247 247
     }
248 248
 
249 249
     public static function custom_css( $message = '', $style = null ) {
250
-        wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css');
251
-        wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7');
250
+        wp_enqueue_style( 'codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css' );
251
+        wp_enqueue_script( 'codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7' );
252 252
         wp_enqueue_script( 'codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array( 'codemirror' ), '4.7' );
253 253
 
254
-        if ( ! isset($style) ) {
254
+        if ( ! isset( $style ) ) {
255 255
             $frm_style = new FrmStyle();
256 256
             $style = $frm_style->get_default_style();
257 257
         }
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
 		$post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_text_field' );
267 267
 		$nonce = FrmAppHelper::get_post_param( 'frm_custom_css', '', 'sanitize_text_field' );
268 268
 		if ( wp_verify_nonce( $nonce, 'frm_custom_css_nonce' ) ) {
269
-            $frm_style->update($post_id);
269
+            $frm_style->update( $post_id );
270 270
             $message = __( 'Your styling settings have been saved.', 'formidable' );
271 271
         }
272 272
 
273
-        return self::custom_css($message);
273
+        return self::custom_css( $message );
274 274
     }
275 275
 
276 276
     public static function route() {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
     }
300 300
 
301 301
     public static function reset_styling() {
302
-		FrmAppHelper::permission_check('frm_change_settings');
302
+		FrmAppHelper::permission_check( 'frm_change_settings' );
303 303
         check_ajax_referer( 'frm_ajax', 'nonce' );
304 304
 
305 305
         $frm_style = new FrmStyle();
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
 
318 318
         // remove the # from the colors
319 319
         foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) {
320
-            if ( ! is_array($v) && strpos($v, '#') === 0 ) {
321
-                $_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v );
320
+            if ( ! is_array( $v ) && strpos( $v, '#' ) === 0 ) {
321
+                $_GET['frm_style_setting']['post_content'][$k] = str_replace( '#', '', $v );
322 322
             }
323 323
         }
324 324
 
@@ -348,18 +348,18 @@  discard block
 block discarded – undo
348 348
 
349 349
         foreach ( $meta_boxes as $nicename => $name ) {
350 350
 			add_meta_box( $nicename . '-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename );
351
-            unset($nicename, $name);
351
+            unset( $nicename, $name );
352 352
         }
353 353
     }
354 354
 
355 355
 	public static function include_style_section( $atts, $sec ) {
356
-        extract($atts);
356
+        extract( $atts );
357 357
 		$current_tab = FrmAppHelper::simple_get( 'page-tab', 'sanitize_title', 'default' );
358 358
 		include( FrmAppHelper::plugin_path() . '/classes/views/styles/_' . $sec['args'] . '.php' );
359 359
     }
360 360
 
361 361
     public static function load_css() {
362
-        header('Content-type: text/css');
362
+        header( 'Content-type: text/css' );
363 363
 
364 364
         $frm_style = new FrmStyle();
365 365
         $defaults = $frm_style->get_defaults();
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
             $style = 'default';
424 424
         }
425 425
 
426
-        $frm_style = new FrmStyle($style);
426
+        $frm_style = new FrmStyle( $style );
427 427
         $style = $frm_style->get_one();
428 428
 
429 429
         if ( $style ) {
@@ -437,14 +437,14 @@  discard block
 block discarded – undo
437 437
      * @param string $val
438 438
      */
439 439
 	public static function get_style_val( $val, $form = 'default' ) {
440
-        $style = self::get_form_style($form);
441
-        if ( $style && isset( $style->post_content[ $val ] ) ) {
442
-            return $style->post_content[ $val ];
440
+        $style = self::get_form_style( $form );
441
+        if ( $style && isset( $style->post_content[$val] ) ) {
442
+            return $style->post_content[$val];
443 443
         }
444 444
     }
445 445
 
446 446
 	public static function show_entry_styles( $default_styles ) {
447
-        $frm_style = new FrmStyle('default');
447
+        $frm_style = new FrmStyle( 'default' );
448 448
         $style = $frm_style->get_one();
449 449
 
450 450
         if ( ! $style ) {
@@ -458,15 +458,15 @@  discard block
 block discarded – undo
458 458
             } else if ( 'alt_bg_color' == $name ) {
459 459
                 $setting = 'bg_color_active';
460 460
             }
461
-            $default_styles[ $name ] = $style->post_content[ $setting ];
462
-            unset($name, $val);
461
+            $default_styles[$name] = $style->post_content[$setting];
462
+            unset( $name, $val );
463 463
         }
464 464
 
465 465
         return $default_styles;
466 466
     }
467 467
 
468 468
 	public static function &important_style( $important, $field ) {
469
-        $important = self::get_style_val('important_style', $field['form_id']);
469
+        $important = self::get_style_val( 'important_style', $field['form_id'] );
470 470
         return $important;
471 471
     }
472 472
 
@@ -492,18 +492,18 @@  discard block
 block discarded – undo
492 492
     	$i = 0;
493 493
     	$first_open = false;
494 494
     	do {
495
-			if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
495
+			if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[$page] ) || ! isset( $wp_meta_boxes[$page][$context] ) ) {
496 496
 				break;
497 497
 			}
498 498
 
499 499
     		foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
500
-    			if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
501
-    				foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
500
+    			if ( isset( $wp_meta_boxes[$page][$context][$priority] ) ) {
501
+    				foreach ( $wp_meta_boxes[$page][$context][$priority] as $box ) {
502 502
     					if ( false == $box || ! $box['title'] ) {
503 503
     						continue;
504 504
 						}
505 505
 
506
-    					$i++;
506
+    					$i ++;
507 507
     					$hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
508 508
 
509 509
     					if ( ! $first_open && empty( $hidden_class ) ) {
Please login to merge, or discard this patch.
Indentation   +302 added lines, -302 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class FrmStylesController {
4
-    public static $post_type = 'frm_styles';
5
-    public static $screen = 'formidable_page_formidable-styles';
6
-
7
-    public static function load_pro_hooks() {
8
-        if ( FrmAppHelper::pro_is_installed() ) {
9
-            FrmProStylesController::load_pro_hooks();
10
-        }
11
-    }
12
-
13
-    public static function register_post_types() {
14
-        register_post_type( self::$post_type, array(
15
-            'label' => __( 'Styles', 'formidable' ),
16
-            'public' => false,
17
-            'show_ui' => false,
18
-            'capability_type' => 'page',
4
+	public static $post_type = 'frm_styles';
5
+	public static $screen = 'formidable_page_formidable-styles';
6
+
7
+	public static function load_pro_hooks() {
8
+		if ( FrmAppHelper::pro_is_installed() ) {
9
+			FrmProStylesController::load_pro_hooks();
10
+		}
11
+	}
12
+
13
+	public static function register_post_types() {
14
+		register_post_type( self::$post_type, array(
15
+			'label' => __( 'Styles', 'formidable' ),
16
+			'public' => false,
17
+			'show_ui' => false,
18
+			'capability_type' => 'page',
19 19
 			'capabilities' => array(
20 20
 				'edit_post'		=> 'frm_change_settings',
21 21
 				'edit_posts'	=> 'frm_change_settings',
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 				'delete_posts'	=> 'frm_change_settings',
26 26
 				'read_private_posts' => 'read_private_posts',
27 27
 			),
28
-            'supports' => array(
28
+			'supports' => array(
29 29
 				'title',
30
-            ),
31
-            'has_archive' => false,
32
-            'labels' => array(
30
+			),
31
+			'has_archive' => false,
32
+			'labels' => array(
33 33
 				'name' => __( 'Styles', 'formidable' ),
34 34
 				'singular_name' => __( 'Style', 'formidable' ),
35 35
 				'menu_name' => __( 'Style', 'formidable' ),
@@ -37,19 +37,19 @@  discard block
 block discarded – undo
37 37
 				'add_new_item' => __( 'Create a New Style', 'formidable' ),
38 38
 				'edit_item'    => __( 'Edit Style', 'formidable' ),
39 39
 			),
40
-        ) );
41
-    }
40
+		) );
41
+	}
42 42
 
43
-    public static function menu() {
43
+	public static function menu() {
44 44
 		add_submenu_page('formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' );
45
-    }
45
+	}
46 46
 
47
-    public static function admin_init() {
48
-        if ( ! FrmAppHelper::is_admin_page('formidable-styles') ) {
49
-            return;
50
-        }
47
+	public static function admin_init() {
48
+		if ( ! FrmAppHelper::is_admin_page('formidable-styles') ) {
49
+			return;
50
+		}
51 51
 
52
-        self::load_pro_hooks();
52
+		self::load_pro_hooks();
53 53
 
54 54
 		$style_tab = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
55 55
 		if ( $style_tab == 'manage' || $style_tab == 'custom_css' ) {
@@ -57,18 +57,18 @@  discard block
 block discarded – undo
57 57
 			return;
58 58
 		}
59 59
 
60
-        wp_enqueue_script('jquery-ui-datepicker');
60
+		wp_enqueue_script('jquery-ui-datepicker');
61 61
 
62
-        $version = FrmAppHelper::plugin_version();
62
+		$version = FrmAppHelper::plugin_version();
63 63
 		wp_enqueue_script( 'jquery-frm-themepicker', FrmAppHelper::plugin_url() . '/js/jquery/jquery-ui-themepicker.js', array( 'jquery' ), $version );
64 64
 
65 65
 		wp_enqueue_style( 'frm-custom-theme', admin_url('admin-ajax.php?action=frmpro_css' ) );
66 66
 
67
-        $style = apply_filters('frm_style_head', false);
68
-        if ( $style ) {
67
+		$style = apply_filters('frm_style_head', false);
68
+		if ( $style ) {
69 69
 			wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) . '&' . http_build_query( $style->post_content ) );
70
-        }
71
-    }
70
+		}
71
+	}
72 72
 
73 73
 	public static function enqueue_css( $register = 'enqueue' ) {
74 74
 		global $frm_vars;
@@ -162,230 +162,230 @@  discard block
 block discarded – undo
162 162
 	}
163 163
 
164 164
 	public static function new_style( $return = '' ) {
165
-        self::load_styler('default');
166
-    }
165
+		self::load_styler('default');
166
+	}
167 167
 
168 168
 	public static function duplicate() {
169 169
 		self::load_styler('default');
170 170
 	}
171 171
 
172 172
 	public static function edit( $style_id = false, $message = '' ) {
173
-        if ( ! $style_id ) {
173
+		if ( ! $style_id ) {
174 174
 			$style_id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
175
-            if ( empty($style_id) ) {
176
-                $style_id = 'default';
177
-            }
178
-        }
179
-
180
-        if ( 'default' == $style_id ) {
181
-            $style = 'default';
182
-        } else {
183
-            $frm_style = new FrmStyle($style_id);
184
-            $style = $frm_style->get_one();
185
-            $style = $style->ID;
186
-        }
187
-
188
-        self::load_styler($style, $message);
189
-    }
190
-
191
-    public static function save() {
192
-        $frm_style = new FrmStyle();
193
-        $message = '';
175
+			if ( empty($style_id) ) {
176
+				$style_id = 'default';
177
+			}
178
+		}
179
+
180
+		if ( 'default' == $style_id ) {
181
+			$style = 'default';
182
+		} else {
183
+			$frm_style = new FrmStyle($style_id);
184
+			$style = $frm_style->get_one();
185
+			$style = $style->ID;
186
+		}
187
+
188
+		self::load_styler($style, $message);
189
+	}
190
+
191
+	public static function save() {
192
+		$frm_style = new FrmStyle();
193
+		$message = '';
194 194
 		$post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_title' );
195 195
 		$style_nonce = FrmAppHelper::get_post_param( 'frm_style', '', 'sanitize_text_field' );
196 196
 
197 197
 		if ( $post_id !== false && wp_verify_nonce( $style_nonce, 'frm_style_nonce' ) ) {
198
-            $id = $frm_style->update($post_id);
199
-            if ( empty($post_id) && ! empty($id) ) {
200
-                // set the post id to the new style so it will be loaded for editing
201
-                $post_id = reset($id);
202
-            }
203
-            // include the CSS that includes this style
198
+			$id = $frm_style->update($post_id);
199
+			if ( empty($post_id) && ! empty($id) ) {
200
+				// set the post id to the new style so it will be loaded for editing
201
+				$post_id = reset($id);
202
+			}
203
+			// include the CSS that includes this style
204 204
 			echo '<link href="' . esc_url( admin_url( 'admin-ajax.php?action=frmpro_css' ) ) . '" type="text/css" rel="Stylesheet" class="frm-custom-theme" />';
205
-            $message = __( 'Your styling settings have been saved.', 'formidable' );
206
-        }
205
+			$message = __( 'Your styling settings have been saved.', 'formidable' );
206
+		}
207 207
 
208
-        return self::edit($post_id, $message);
209
-    }
208
+		return self::edit($post_id, $message);
209
+	}
210 210
 
211 211
 	public static function load_styler( $style, $message = '' ) {
212
-        global $frm_settings;
212
+		global $frm_settings;
213 213
 
214
-        $frm_style = new FrmStyle();
215
-        $styles = $frm_style->get_all();
214
+		$frm_style = new FrmStyle();
215
+		$styles = $frm_style->get_all();
216 216
 
217
-        if ( is_numeric($style) ) {
218
-            $style = $styles[ $style ];
219
-        } else if ( 'default' == $style ) {
220
-            $style = $frm_style->get_default_style($styles);
221
-        }
217
+		if ( is_numeric($style) ) {
218
+			$style = $styles[ $style ];
219
+		} else if ( 'default' == $style ) {
220
+			$style = $frm_style->get_default_style($styles);
221
+		}
222 222
 
223
-        self::add_meta_boxes();
223
+		self::add_meta_boxes();
224 224
 
225 225
 		include( FrmAppHelper::plugin_path() . '/classes/views/styles/show.php' );
226
-    }
226
+	}
227 227
 
228 228
 	/**
229 229
 	 * @param string $message
230 230
 	 * @param array|object $forms
231 231
 	 */
232 232
 	private static function manage( $message = '', $forms = array() ) {
233
-        $frm_style = new FrmStyle();
234
-        $styles = $frm_style->get_all();
235
-        $default_style = $frm_style->get_default_style($styles);
233
+		$frm_style = new FrmStyle();
234
+		$styles = $frm_style->get_all();
235
+		$default_style = $frm_style->get_default_style($styles);
236 236
 
237
-        if ( empty($forms) ) {
238
-            $forms = FrmForm::get_published_forms();
239
-        }
237
+		if ( empty($forms) ) {
238
+			$forms = FrmForm::get_published_forms();
239
+		}
240 240
 
241 241
 		include( FrmAppHelper::plugin_path() . '/classes/views/styles/manage.php' );
242
-    }
242
+	}
243 243
 
244
-    private static function manage_styles() {
244
+	private static function manage_styles() {
245 245
 		$style_nonce = FrmAppHelper::get_post_param( 'frm_manage_style', '', 'sanitize_text_field' );
246 246
 		if ( ! $_POST || ! isset( $_POST['style'] ) || ! wp_verify_nonce( $style_nonce, 'frm_manage_style_nonce' ) ) {
247
-            return self::manage();
248
-        }
247
+			return self::manage();
248
+		}
249 249
 
250
-        global $wpdb;
250
+		global $wpdb;
251 251
 
252 252
 		$forms = FrmForm::get_published_forms();
253
-        foreach ( $forms as $form ) {
254
-            if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) {
255
-                continue;
256
-            }
253
+		foreach ( $forms as $form ) {
254
+			if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) {
255
+				continue;
256
+			}
257 257
 
258
-            $form->options['custom_style'] = $_POST['style'][ $form->id ];
258
+			$form->options['custom_style'] = $_POST['style'][ $form->id ];
259 259
 
260 260
 			$wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) );
261
-            unset($form);
262
-        }
261
+			unset($form);
262
+		}
263 263
 
264
-        $message = __( 'Your form styles have been saved.', 'formidable' );
265
-        return self::manage($message, $forms);
266
-    }
264
+		$message = __( 'Your form styles have been saved.', 'formidable' );
265
+		return self::manage($message, $forms);
266
+	}
267 267
 
268
-    public static function custom_css( $message = '', $style = null ) {
269
-        wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css');
270
-        wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7');
271
-        wp_enqueue_script( 'codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array( 'codemirror' ), '4.7' );
268
+	public static function custom_css( $message = '', $style = null ) {
269
+		wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css');
270
+		wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7');
271
+		wp_enqueue_script( 'codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array( 'codemirror' ), '4.7' );
272 272
 
273
-        if ( ! isset($style) ) {
274
-            $frm_style = new FrmStyle();
275
-            $style = $frm_style->get_default_style();
276
-        }
273
+		if ( ! isset($style) ) {
274
+			$frm_style = new FrmStyle();
275
+			$style = $frm_style->get_default_style();
276
+		}
277 277
 
278 278
 		include( FrmAppHelper::plugin_path() . '/classes/views/styles/custom_css.php' );
279
-    }
279
+	}
280 280
 
281
-    public static function save_css() {
282
-        $frm_style = new FrmStyle();
281
+	public static function save_css() {
282
+		$frm_style = new FrmStyle();
283 283
 
284
-        $message = '';
284
+		$message = '';
285 285
 		$post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_text_field' );
286 286
 		$nonce = FrmAppHelper::get_post_param( 'frm_custom_css', '', 'sanitize_text_field' );
287 287
 		if ( wp_verify_nonce( $nonce, 'frm_custom_css_nonce' ) ) {
288
-            $frm_style->update($post_id);
289
-            $message = __( 'Your styling settings have been saved.', 'formidable' );
290
-        }
288
+			$frm_style->update($post_id);
289
+			$message = __( 'Your styling settings have been saved.', 'formidable' );
290
+		}
291 291
 
292
-        return self::custom_css($message);
293
-    }
292
+		return self::custom_css($message);
293
+	}
294 294
 
295
-    public static function route() {
295
+	public static function route() {
296 296
 		$action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
297 297
 
298
-        switch ( $action ) {
299
-            case 'edit':
300
-            case 'save':
301
-            case 'manage':
302
-            case 'manage_styles':
303
-            case 'custom_css':
304
-            case 'save_css':
298
+		switch ( $action ) {
299
+			case 'edit':
300
+			case 'save':
301
+			case 'manage':
302
+			case 'manage_styles':
303
+			case 'custom_css':
304
+			case 'save_css':
305 305
 				return self::$action();
306
-            default:
307
-            	do_action( 'frm_style_action_route', $action );
308
-            	if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) {
309
-                	return;
310
-            	}
306
+			default:
307
+				do_action( 'frm_style_action_route', $action );
308
+				if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) {
309
+					return;
310
+				}
311 311
 
312
-                if ( 'new_style' == $action || 'duplicate' == $action ) {
313
-                    return self::$action();
314
-                }
312
+				if ( 'new_style' == $action || 'duplicate' == $action ) {
313
+					return self::$action();
314
+				}
315 315
 
316
-                return self::edit();
317
-        }
318
-    }
316
+				return self::edit();
317
+		}
318
+	}
319 319
 
320
-    public static function reset_styling() {
320
+	public static function reset_styling() {
321 321
 		FrmAppHelper::permission_check('frm_change_settings');
322
-        check_ajax_referer( 'frm_ajax', 'nonce' );
322
+		check_ajax_referer( 'frm_ajax', 'nonce' );
323 323
 
324
-        $frm_style = new FrmStyle();
325
-        $defaults = $frm_style->get_defaults();
324
+		$frm_style = new FrmStyle();
325
+		$defaults = $frm_style->get_defaults();
326 326
 
327
-        echo json_encode( $defaults );
328
-        wp_die();
329
-    }
327
+		echo json_encode( $defaults );
328
+		wp_die();
329
+	}
330 330
 
331
-    public static function change_styling() {
332
-        check_ajax_referer( 'frm_ajax', 'nonce' );
331
+	public static function change_styling() {
332
+		check_ajax_referer( 'frm_ajax', 'nonce' );
333 333
 
334
-        $frm_style = new FrmStyle();
335
-        $defaults = $frm_style->get_defaults();
334
+		$frm_style = new FrmStyle();
335
+		$defaults = $frm_style->get_defaults();
336 336
 
337
-        // remove the # from the colors
338
-        foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) {
339
-            if ( ! is_array($v) && strpos($v, '#') === 0 ) {
340
-                $_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v );
341
-            }
342
-        }
337
+		// remove the # from the colors
338
+		foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) {
339
+			if ( ! is_array($v) && strpos($v, '#') === 0 ) {
340
+				$_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v );
341
+			}
342
+		}
343 343
 
344
-        echo '<style type="text/css">';
344
+		echo '<style type="text/css">';
345 345
 		include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' );
346
-        echo '</style>';
347
-        wp_die();
348
-    }
349
-
350
-    private static function add_meta_boxes() {
351
-
352
-        // setup meta boxes
353
-        $meta_boxes = array(
354
-            'general'           => __( 'General', 'formidable' ),
355
-            'form-title'        => __( 'Form Title', 'formidable' ),
356
-            'form-description'  => __( 'Form Description', 'formidable' ),
357
-            'field-labels'      => __( 'Field Labels', 'formidable' ),
358
-            'field-description' => __( 'Field Description', 'formidable' ),
359
-            'field-colors'      => __( 'Field Colors', 'formidable' ),
360
-            'field-sizes'       => __( 'Field Settings', 'formidable' ),
361
-            'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ),
362
-            'section-fields'    => __( 'Section Fields', 'formidable' ),
363
-            'date-fields'       => __( 'Date Fields', 'formidable' ),
364
-            'buttons'           => __( 'Buttons', 'formidable' ),
365
-            'form-messages'     => __( 'Form Messages', 'formidable' ),
366
-        );
367
-
368
-        foreach ( $meta_boxes as $nicename => $name ) {
346
+		echo '</style>';
347
+		wp_die();
348
+	}
349
+
350
+	private static function add_meta_boxes() {
351
+
352
+		// setup meta boxes
353
+		$meta_boxes = array(
354
+			'general'           => __( 'General', 'formidable' ),
355
+			'form-title'        => __( 'Form Title', 'formidable' ),
356
+			'form-description'  => __( 'Form Description', 'formidable' ),
357
+			'field-labels'      => __( 'Field Labels', 'formidable' ),
358
+			'field-description' => __( 'Field Description', 'formidable' ),
359
+			'field-colors'      => __( 'Field Colors', 'formidable' ),
360
+			'field-sizes'       => __( 'Field Settings', 'formidable' ),
361
+			'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ),
362
+			'section-fields'    => __( 'Section Fields', 'formidable' ),
363
+			'date-fields'       => __( 'Date Fields', 'formidable' ),
364
+			'buttons'           => __( 'Buttons', 'formidable' ),
365
+			'form-messages'     => __( 'Form Messages', 'formidable' ),
366
+		);
367
+
368
+		foreach ( $meta_boxes as $nicename => $name ) {
369 369
 			add_meta_box( $nicename . '-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename );
370
-            unset($nicename, $name);
371
-        }
372
-    }
370
+			unset($nicename, $name);
371
+		}
372
+	}
373 373
 
374 374
 	public static function include_style_section( $atts, $sec ) {
375
-        extract($atts);
375
+		extract($atts);
376 376
 		$current_tab = FrmAppHelper::simple_get( 'page-tab', 'sanitize_title', 'default' );
377 377
 		include( FrmAppHelper::plugin_path() . '/classes/views/styles/_' . $sec['args'] . '.php' );
378
-    }
378
+	}
379 379
 
380
-    public static function load_css() {
381
-        header('Content-type: text/css');
380
+	public static function load_css() {
381
+		header('Content-type: text/css');
382 382
 
383
-        $frm_style = new FrmStyle();
384
-        $defaults = $frm_style->get_defaults();
383
+		$frm_style = new FrmStyle();
384
+		$defaults = $frm_style->get_defaults();
385 385
 
386 386
 		include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' );
387
-        wp_die();
388
-    }
387
+		wp_die();
388
+	}
389 389
 
390 390
 	public static function load_saved_css() {
391 391
 		$css = get_transient( 'frmpro_css' );
@@ -394,142 +394,142 @@  discard block
 block discarded – undo
394 394
 		wp_die();
395 395
 	}
396 396
 
397
-    /**
398
-     * Check if the Formidable styling should be loaded,
399
-     * then enqueue it for the footer
400
-     * @since 2.0
401
-     */
402
-    public static function enqueue_style() {
403
-        global $frm_vars;
404
-
405
-        if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) {
406
-            // the CSS has already been loaded
407
-            return;
408
-        }
409
-
410
-        $frm_settings = FrmAppHelper::get_settings();
411
-        if ( $frm_settings->load_style != 'none' ) {
412
-            wp_enqueue_style( 'formidable' );
413
-            $frm_vars['css_loaded'] = true;
414
-        }
415
-    }
416
-
417
-    // Get the stylesheets for the form settings page
418
-    public static function get_style_opts() {
419
-        $frm_style = new FrmStyle();
420
-        $styles = $frm_style->get_all();
421
-
422
-        return $styles;
423
-    }
424
-
425
-    public static function get_form_style( $form = 'default' ) {
426
-        $style = FrmFormsHelper::get_form_style( $form );
427
-
428
-        if ( empty( $style ) || 1 == $style ) {
429
-            $style = 'default';
430
-        }
431
-
432
-        $frm_style = new FrmStyle( $style );
433
-        return $frm_style->get_one();
434
-    }
435
-
436
-    /**
437
-     * @param string $class
438
-     * @param string $style
439
-     */
397
+	/**
398
+	 * Check if the Formidable styling should be loaded,
399
+	 * then enqueue it for the footer
400
+	 * @since 2.0
401
+	 */
402
+	public static function enqueue_style() {
403
+		global $frm_vars;
404
+
405
+		if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) {
406
+			// the CSS has already been loaded
407
+			return;
408
+		}
409
+
410
+		$frm_settings = FrmAppHelper::get_settings();
411
+		if ( $frm_settings->load_style != 'none' ) {
412
+			wp_enqueue_style( 'formidable' );
413
+			$frm_vars['css_loaded'] = true;
414
+		}
415
+	}
416
+
417
+	// Get the stylesheets for the form settings page
418
+	public static function get_style_opts() {
419
+		$frm_style = new FrmStyle();
420
+		$styles = $frm_style->get_all();
421
+
422
+		return $styles;
423
+	}
424
+
425
+	public static function get_form_style( $form = 'default' ) {
426
+		$style = FrmFormsHelper::get_form_style( $form );
427
+
428
+		if ( empty( $style ) || 1 == $style ) {
429
+			$style = 'default';
430
+		}
431
+
432
+		$frm_style = new FrmStyle( $style );
433
+		return $frm_style->get_one();
434
+	}
435
+
436
+	/**
437
+	 * @param string $class
438
+	 * @param string $style
439
+	 */
440 440
 	public static function get_form_style_class( $class, $style ) {
441
-        if ( 1 == $style ) {
442
-            $style = 'default';
443
-        }
441
+		if ( 1 == $style ) {
442
+			$style = 'default';
443
+		}
444 444
 
445
-        $frm_style = new FrmStyle($style);
446
-        $style = $frm_style->get_one();
445
+		$frm_style = new FrmStyle($style);
446
+		$style = $frm_style->get_one();
447 447
 
448
-        if ( $style ) {
448
+		if ( $style ) {
449 449
 			$class .= ' frm_style_' . $style->post_name;
450
-        }
450
+		}
451 451
 
452
-        return $class;
453
-    }
452
+		return $class;
453
+	}
454 454
 
455
-    /**
456
-     * @param string $val
457
-     */
455
+	/**
456
+	 * @param string $val
457
+	 */
458 458
 	public static function get_style_val( $val, $form = 'default' ) {
459
-        $style = self::get_form_style($form);
460
-        if ( $style && isset( $style->post_content[ $val ] ) ) {
461
-            return $style->post_content[ $val ];
462
-        }
463
-    }
459
+		$style = self::get_form_style($form);
460
+		if ( $style && isset( $style->post_content[ $val ] ) ) {
461
+			return $style->post_content[ $val ];
462
+		}
463
+	}
464 464
 
465 465
 	public static function show_entry_styles( $default_styles ) {
466
-        $frm_style = new FrmStyle('default');
467
-        $style = $frm_style->get_one();
468
-
469
-        if ( ! $style ) {
470
-            return $default_styles;
471
-        }
472
-
473
-        foreach ( $default_styles as $name => $val ) {
474
-            $setting = $name;
475
-            if ( 'border_width' == $name ) {
476
-                $setting = 'field_border_width';
477
-            } else if ( 'alt_bg_color' == $name ) {
478
-                $setting = 'bg_color_active';
479
-            }
480
-            $default_styles[ $name ] = $style->post_content[ $setting ];
481
-            unset($name, $val);
482
-        }
483
-
484
-        return $default_styles;
485
-    }
466
+		$frm_style = new FrmStyle('default');
467
+		$style = $frm_style->get_one();
468
+
469
+		if ( ! $style ) {
470
+			return $default_styles;
471
+		}
472
+
473
+		foreach ( $default_styles as $name => $val ) {
474
+			$setting = $name;
475
+			if ( 'border_width' == $name ) {
476
+				$setting = 'field_border_width';
477
+			} else if ( 'alt_bg_color' == $name ) {
478
+				$setting = 'bg_color_active';
479
+			}
480
+			$default_styles[ $name ] = $style->post_content[ $setting ];
481
+			unset($name, $val);
482
+		}
483
+
484
+		return $default_styles;
485
+	}
486 486
 
487 487
 	public static function &important_style( $important, $field ) {
488
-        $important = self::get_style_val('important_style', $field['form_id']);
489
-        return $important;
490
-    }
488
+		$important = self::get_style_val('important_style', $field['form_id']);
489
+		return $important;
490
+	}
491 491
 
492
-    /**
493
-     * Fallback for WP < 3.6
494
-     */
495
-    public static function do_accordion_sections( $screen, $context, $object ) {
496
-        if ( function_exists( 'do_accordion_sections' ) ) {
497
-            return do_accordion_sections( $screen, $context, $object );
498
-        }
492
+	/**
493
+	 * Fallback for WP < 3.6
494
+	 */
495
+	public static function do_accordion_sections( $screen, $context, $object ) {
496
+		if ( function_exists( 'do_accordion_sections' ) ) {
497
+			return do_accordion_sections( $screen, $context, $object );
498
+		}
499 499
 
500
-    	global $wp_meta_boxes;
500
+		global $wp_meta_boxes;
501 501
 
502
-        $screen = 'formidable_page_formidable-styles';
503
-        $screen = convert_to_screen( $screen );
502
+		$screen = 'formidable_page_formidable-styles';
503
+		$screen = convert_to_screen( $screen );
504 504
 
505
-    	$page = $screen->id;
505
+		$page = $screen->id;
506 506
 
507
-    	$hidden = get_hidden_meta_boxes( $screen );
508
-    	?>
507
+		$hidden = get_hidden_meta_boxes( $screen );
508
+		?>
509 509
     	<div id="side-sortables" class="accordion-container">
510 510
     	<?php
511
-    	$i = 0;
512
-    	$first_open = false;
513
-    	do {
511
+		$i = 0;
512
+		$first_open = false;
513
+		do {
514 514
 			if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
515 515
 				break;
516 516
 			}
517 517
 
518
-    		foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
519
-    			if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
520
-    				foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
521
-    					if ( false == $box || ! $box['title'] ) {
522
-    						continue;
518
+			foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
519
+				if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
520
+					foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
521
+						if ( false == $box || ! $box['title'] ) {
522
+							continue;
523 523
 						}
524 524
 
525
-    					$i++;
526
-    					$hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
525
+						$i++;
526
+						$hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
527 527
 
528
-    					if ( ! $first_open && empty( $hidden_class ) ) {
529
-    						$first_open = true;
530
-    					}
528
+						if ( ! $first_open && empty( $hidden_class ) ) {
529
+							$first_open = true;
530
+						}
531 531
 
532
-    					?>
532
+						?>
533 533
 						<div class="postbox <?php echo esc_attr( $box['id'] ); ?>">
534 534
 						<div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'formidable' ) ?>"><br/></div>
535 535
                         <h3 class='hndle'><span><?php echo esc_html( $box['title'] ); ?></span></h3>
@@ -540,13 +540,13 @@  discard block
 block discarded – undo
540 540
     						</div><!-- .accordion-section-content -->
541 541
     					</div><!-- .postbox -->
542 542
     					<?php
543
-    				}
544
-    			}
545
-    		}
546
-    	} while ( 0 );
547
-    	?>
543
+					}
544
+				}
545
+			}
546
+		} while ( 0 );
547
+		?>
548 548
     	</div><!-- .accordion-container -->
549 549
     	<?php
550
-    	return $i;
551
-    }
550
+		return $i;
551
+	}
552 552
 }
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/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/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,20 +144,20 @@  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() {
160
-		FrmAppHelper::permission_check('frm_change_settings');
160
+		FrmAppHelper::permission_check( 'frm_change_settings' );
161 161
 	 	check_ajax_referer( 'frm_ajax', 'nonce' );
162 162
 
163 163
 		if ( ! isset( $_POST['license'] ) || empty( $_POST['license'] ) ) {
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	}
206 206
 
207 207
 	public static function deactivate() {
208
-		FrmAppHelper::permission_check('frm_change_settings');
208
+		FrmAppHelper::permission_check( 'frm_change_settings' );
209 209
 		check_ajax_referer( 'frm_ajax', 'nonce' );
210 210
 
211 211
 		$plugin_slug = sanitize_text_field( $_POST['plugin'] );
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 
256 256
 		$message = __( 'Your License Key was invalid', 'formidable' );
257 257
 		if ( is_wp_error( $resp ) ) {
258
-			$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>');
258
+			$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>' );
259 259
 			if ( is_wp_error( $resp ) ) {
260 260
 				$message .= ' ' . $resp->get_error_message();
261 261
 			}
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.
classes/views/styles/_form-title.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('title_size') ) ?>" id="frm_title_size" value="<?php echo esc_attr( $style->post_content['title_size'] ) ?>" />
3
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_size' ) ) ?>" id="frm_title_size" value="<?php echo esc_attr( $style->post_content['title_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('title_color') ) ?>" id="frm_title_color" class="hex" value="<?php echo esc_attr( $style->post_content['title_color'] ) ?>" />
8
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_color' ) ) ?>" id="frm_title_color" class="hex" value="<?php echo esc_attr( $style->post_content['title_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('title_margin_top') ) ?>" id="frm_title_margin_top" value="<?php echo esc_attr( $style->post_content['title_margin_top'] ) ?>" size="4" />
12
+	<input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_margin_top' ) ) ?>" id="frm_title_margin_top" value="<?php echo esc_attr( $style->post_content['title_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('title_margin_bottom') ) ?>" id="frm_title_margin_bottom" value="<?php echo esc_attr( $style->post_content['title_margin_bottom'] ) ?>" size="4" />
16
+    <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_margin_bottom' ) ) ?>" id="frm_title_margin_bottom" value="<?php echo esc_attr( $style->post_content['title_margin_bottom'] ) ?>" size="4" />
17 17
 </div>
Please login to merge, or discard this patch.
classes/helpers/FrmTipsHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -181,13 +181,13 @@
 block discarded – undo
181 181
 			),
182 182
 		);
183 183
 		$random = rand( 0, count( $tips ) - 1 );
184
-		$tip = $tips[ $random ];
184
+		$tip = $tips[$random];
185 185
 		$tip['num'] = $random;
186 186
 		return $tip;
187 187
 	}
188 188
 
189 189
 	public static function get_random_tip( $tips ) {
190 190
 		$random = rand( 0, count( $tips ) - 1 );
191
-		return $tips[ $random ];
191
+		return $tips[$random];
192 192
 	}
193 193
 }
Please login to merge, or discard this patch.
classes/controllers/FrmEntriesController.php 2 patches
Indentation   +335 added lines, -335 removed lines patch added patch discarded remove patch
@@ -2,201 +2,201 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmEntriesController {
4 4
 
5
-    public static function menu() {
5
+	public static function menu() {
6 6
 		FrmAppHelper::force_capability( 'frm_view_entries' );
7 7
 
8
-        add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
8
+		add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
9 9
 
10 10
 		if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) {
11 11
 			$menu_name = FrmAppHelper::get_menu_name();
12 12
 			add_filter( 'manage_' . sanitize_title( $menu_name ) . '_page_formidable-entries_columns', 'FrmEntriesController::manage_columns' );
13 13
 			add_filter( 'get_user_option_manage' . sanitize_title( $menu_name ) . '_page_formidable-entriescolumnshidden', 'FrmEntriesController::hidden_columns' );
14 14
 			add_filter( 'manage_' . sanitize_title( $menu_name ) . '_page_formidable-entries_sortable_columns', 'FrmEntriesController::sortable_columns' );
15
-        }
16
-    }
15
+		}
16
+	}
17 17
 
18
-    /* Display in Back End */
19
-    public static function route() {
18
+	/* Display in Back End */
19
+	public static function route() {
20 20
 		$action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
21 21
 
22
-        switch ( $action ) {
23
-            case 'show':
24
-            case 'destroy':
25
-            case 'destroy_all':
26
-                return self::$action();
22
+		switch ( $action ) {
23
+			case 'show':
24
+			case 'destroy':
25
+			case 'destroy_all':
26
+				return self::$action();
27 27
 
28
-            default:
29
-                do_action( 'frm_entry_action_route', $action );
30
-                if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
31
-                    return;
32
-                }
28
+			default:
29
+				do_action( 'frm_entry_action_route', $action );
30
+				if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
31
+					return;
32
+				}
33 33
 
34
-                return self::display_list();
35
-        }
36
-    }
34
+				return self::display_list();
35
+		}
36
+	}
37 37
 
38 38
 	public static function contextual_help( $help, $screen_id, $screen ) {
39
-        // Only add to certain screens. add_help_tab was introduced in WordPress 3.3
40
-        if ( ! method_exists( $screen, 'add_help_tab' ) ) {
41
-            return $help;
42
-        }
39
+		// Only add to certain screens. add_help_tab was introduced in WordPress 3.3
40
+		if ( ! method_exists( $screen, 'add_help_tab' ) ) {
41
+			return $help;
42
+		}
43 43
 
44 44
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
45 45
 		$page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
46 46
 		if ( $page != 'formidable-entries' || ( ! empty( $action ) && $action != 'list' ) ) {
47
-            return $help;
48
-        }
47
+			return $help;
48
+		}
49 49
 
50 50
 		unset( $action, $page );
51 51
 
52
-        $screen->add_help_tab( array(
53
-            'id'      => 'formidable-entries-tab',
54
-            'title'   => __( 'Overview', 'formidable' ),
52
+		$screen->add_help_tab( array(
53
+			'id'      => 'formidable-entries-tab',
54
+			'title'   => __( 'Overview', 'formidable' ),
55 55
 			'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
56
-        ));
56
+		));
57 57
 
58
-        $screen->set_help_sidebar(
58
+		$screen->set_help_sidebar(
59 59
 			'<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
60 60
 			'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' .
61 61
 			'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>'
62
-    	);
62
+		);
63 63
 
64
-        return $help;
65
-    }
64
+		return $help;
65
+	}
66 66
 
67 67
 	public static function manage_columns( $columns ) {
68
-        global $frm_vars, $wpdb;
68
+		global $frm_vars, $wpdb;
69 69
 		$form_id = FrmForm::get_current_form_id();
70 70
 
71 71
 		$columns[ $form_id . '_id' ] = 'ID';
72 72
 		$columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
73 73
 
74
-        if ( ! $form_id ) {
75
-            return $columns;
76
-        }
74
+		if ( ! $form_id ) {
75
+			return $columns;
76
+		}
77 77
 
78
-        $form_cols = FrmField::get_all_for_form($form_id, '', 'include');
78
+		$form_cols = FrmField::get_all_for_form($form_id, '', 'include');
79 79
 
80
-        foreach ( $form_cols as $form_col ) {
80
+		foreach ( $form_cols as $form_col ) {
81 81
 			if ( FrmField::is_no_save_field( $form_col->type ) ) {
82
-                continue;
83
-            }
82
+				continue;
83
+			}
84 84
 
85
-            if ( $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] ) ) {
85
+			if ( $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] ) ) {
86 86
 				$sub_form_cols = FrmField::get_all_for_form( $form_col->field_options['form_select'] );
87 87
 
88
-                if ( $sub_form_cols ) {
89
-                    foreach ( $sub_form_cols as $k => $sub_form_col ) {
88
+				if ( $sub_form_cols ) {
89
+					foreach ( $sub_form_cols as $k => $sub_form_col ) {
90 90
 						if ( FrmField::is_no_save_field( $sub_form_col->type ) ) {
91
-                            unset( $sub_form_cols[ $k ] );
92
-                            continue;
93
-                        }
91
+							unset( $sub_form_cols[ $k ] );
92
+							continue;
93
+						}
94 94
 						$columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
95
-                        unset($sub_form_col);
96
-                    }
97
-                }
98
-                unset($sub_form_cols);
99
-            } else {
100
-                $col_id = $form_col->field_key;
101
-                if ( $form_col->form_id != $form_id ) {
95
+						unset($sub_form_col);
96
+					}
97
+				}
98
+				unset($sub_form_cols);
99
+			} else {
100
+				$col_id = $form_col->field_key;
101
+				if ( $form_col->form_id != $form_id ) {
102 102
 					$col_id .= '-_-form' . $form_col->form_id;
103
-                }
103
+				}
104 104
 
105
-                if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) {
105
+				if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) {
106 106
 					$columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
107
-                }
107
+				}
108 108
 				$columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
109
-            }
110
-        }
109
+			}
110
+		}
111 111
 
112 112
 		$columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' );
113 113
 		$columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
114 114
 		$columns[ $form_id . '_ip' ] = 'IP';
115 115
 
116
-        $frm_vars['cols'] = $columns;
116
+		$frm_vars['cols'] = $columns;
117 117
 
118 118
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
119 119
 		if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) {
120 120
 			add_screen_option( 'per_page', array( 'label' => __( 'Entries', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_entries_per_page' ) );
121
-        }
121
+		}
122 122
 
123
-        return $columns;
124
-    }
123
+		return $columns;
124
+	}
125 125
 
126 126
 	public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
127 127
 		$menu_name = FrmAppHelper::get_menu_name();
128 128
 		$this_page_name = 'manage' . sanitize_title( $menu_name ) . '_page_formidable-entriescolumnshidden';
129 129
 		if ( $meta_key != $this_page_name || $meta_value == $prev_value ) {
130
-            return $check;
131
-        }
130
+			return $check;
131
+		}
132 132
 
133 133
 		if ( empty( $prev_value ) ) {
134 134
 			$prev_value = get_metadata( 'user', $object_id, $meta_key, true );
135 135
 		}
136 136
 
137
-        global $frm_vars;
138
-        //add a check so we don't create a loop
139
-        $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
137
+		global $frm_vars;
138
+		//add a check so we don't create a loop
139
+		$frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
140 140
 
141
-        return $check;
142
-    }
141
+		return $check;
142
+	}
143 143
 
144
-    //add hidden columns back from other forms
144
+	//add hidden columns back from other forms
145 145
 	public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) {
146 146
 		$menu_name = FrmAppHelper::get_menu_name();
147 147
 		$sanitized = sanitize_title( $menu_name );
148 148
 		$this_page_name = 'manage' .  $sanitized . '_page_formidable-entriescolumnshidden';
149 149
 		if ( $meta_key != $this_page_name ) {
150
-            return;
151
-        }
152
-
153
-        global $frm_vars;
154
-        if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) {
155
-            return; //don't continue if there's no previous value
156
-        }
157
-
158
-        foreach ( $meta_value as $mk => $mv ) {
159
-            //remove blank values
160
-            if ( empty( $mv )  ) {
161
-                unset( $meta_value[ $mk ] );
162
-            }
163
-        }
164
-
165
-        $cur_form_prefix = reset($meta_value);
166
-        $cur_form_prefix = explode('_', $cur_form_prefix);
167
-        $cur_form_prefix = $cur_form_prefix[0];
168
-        $save = false;
169
-
170
-        foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
150
+			return;
151
+		}
152
+
153
+		global $frm_vars;
154
+		if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) {
155
+			return; //don't continue if there's no previous value
156
+		}
157
+
158
+		foreach ( $meta_value as $mk => $mv ) {
159
+			//remove blank values
160
+			if ( empty( $mv )  ) {
161
+				unset( $meta_value[ $mk ] );
162
+			}
163
+		}
164
+
165
+		$cur_form_prefix = reset($meta_value);
166
+		$cur_form_prefix = explode('_', $cur_form_prefix);
167
+		$cur_form_prefix = $cur_form_prefix[0];
168
+		$save = false;
169
+
170
+		foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
171 171
 			if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) {
172
-                //don't add blank cols or process included cols
173
-                continue;
174
-            }
172
+				//don't add blank cols or process included cols
173
+				continue;
174
+			}
175 175
 
176 176
 			$form_prefix = explode( '_', $prev_hidden );
177
-            $form_prefix = $form_prefix[0];
178
-            if ( $form_prefix == $cur_form_prefix ) {
179
-                //don't add back columns that are meant to be hidden
180
-                continue;
181
-            }
177
+			$form_prefix = $form_prefix[0];
178
+			if ( $form_prefix == $cur_form_prefix ) {
179
+				//don't add back columns that are meant to be hidden
180
+				continue;
181
+			}
182 182
 
183
-            $meta_value[] = $prev_hidden;
184
-            $save = true;
185
-            unset($form_prefix);
186
-        }
183
+			$meta_value[] = $prev_hidden;
184
+			$save = true;
185
+			unset($form_prefix);
186
+		}
187 187
 
188 188
 		if ( $save ) {
189
-            $user = wp_get_current_user();
189
+			$user = wp_get_current_user();
190 190
 			update_user_option( $user->ID, $this_page_name, $meta_value, true );
191
-        }
192
-    }
191
+		}
192
+	}
193 193
 
194 194
 	public static function save_per_page( $save, $option, $value ) {
195
-        if ( $option == 'formidable_page_formidable_entries_per_page' ) {
196
-            $save = (int) $value;
197
-        }
198
-        return $save;
199
-    }
195
+		if ( $option == 'formidable_page_formidable_entries_per_page' ) {
196
+			$save = (int) $value;
197
+		}
198
+		return $save;
199
+	}
200 200
 
201 201
 	public static function sortable_columns() {
202 202
 		$form_id = FrmForm::get_current_form_id();
@@ -222,226 +222,226 @@  discard block
 block discarded – undo
222 222
 	}
223 223
 
224 224
 	public static function hidden_columns( $result ) {
225
-        global $frm_vars;
225
+		global $frm_vars;
226 226
 
227 227
 		$form_id = FrmForm::get_current_form_id();
228 228
 
229
-        $return = false;
230
-        foreach ( (array) $result as $r ) {
231
-            if ( ! empty( $r ) ) {
232
-                $form_prefix = explode( '_', $r );
233
-                $form_prefix = $form_prefix[0];
229
+		$return = false;
230
+		foreach ( (array) $result as $r ) {
231
+			if ( ! empty( $r ) ) {
232
+				$form_prefix = explode( '_', $r );
233
+				$form_prefix = $form_prefix[0];
234 234
 
235
-                if ( (int) $form_prefix == (int) $form_id ) {
236
-                    $return = true;
237
-                    break;
238
-                }
235
+				if ( (int) $form_prefix == (int) $form_id ) {
236
+					$return = true;
237
+					break;
238
+				}
239 239
 
240
-                unset($form_prefix);
241
-            }
242
-        }
240
+				unset($form_prefix);
241
+			}
242
+		}
243 243
 
244
-        if ( $return ) {
244
+		if ( $return ) {
245 245
 			return $result;
246 246
 		}
247 247
 
248
-        $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0;
249
-        $max_columns = 8;
250
-        if ( $i <= $max_columns ) {
248
+		$i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0;
249
+		$max_columns = 8;
250
+		if ( $i <= $max_columns ) {
251 251
 			return $result;
252 252
 		}
253 253
 
254
-        global $frm_vars;
255
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) {
256
-            $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options);
257
-        }
254
+		global $frm_vars;
255
+		if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) {
256
+			$frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options);
257
+		}
258 258
 
259
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) {
260
-            $result = $frm_vars['current_form']->options['hidden_cols'];
261
-        } else {
262
-            $cols = $frm_vars['cols'];
263
-            $cols = array_reverse($cols, true);
259
+		if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) {
260
+			$result = $frm_vars['current_form']->options['hidden_cols'];
261
+		} else {
262
+			$cols = $frm_vars['cols'];
263
+			$cols = array_reverse($cols, true);
264 264
 
265 265
 			$result[] = $form_id . '_id';
266
-            $i--;
266
+			$i--;
267 267
 
268 268
 			$result[] = $form_id . '_item_key';
269
-            $i--;
269
+			$i--;
270 270
 
271 271
 			foreach ( $cols as $col_key => $col ) {
272
-                if ( $i > $max_columns ) {
272
+				if ( $i > $max_columns ) {
273 273
 					$result[] = $col_key;
274 274
 				}
275
-                //remove some columns by default
276
-                $i--;
277
-                unset($col_key, $col);
278
-            }
279
-        }
275
+				//remove some columns by default
276
+				$i--;
277
+				unset($col_key, $col);
278
+			}
279
+		}
280 280
 
281
-        return $result;
282
-    }
281
+		return $result;
282
+	}
283 283
 
284 284
 	public static function display_list( $message = '', $errors = array() ) {
285
-        global $wpdb, $frm_vars;
285
+		global $wpdb, $frm_vars;
286 286
 
287 287
 		$form = FrmForm::get_current_form();
288 288
 		$params = FrmForm::get_admin_params( $form );
289 289
 
290
-        if ( $form ) {
291
-            $params['form'] = $form->id;
292
-            $frm_vars['current_form'] = $form;
290
+		if ( $form ) {
291
+			$params['form'] = $form->id;
292
+			$frm_vars['current_form'] = $form;
293 293
 
294
-	        if ( 'trash' == $form->status ) {
295
-	            $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
296
-	            $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) );
297
-	            $errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete );
298
-	            unset( $time_to_delete, $delete_timestamp );
299
-	        }
294
+			if ( 'trash' == $form->status ) {
295
+				$delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
296
+				$time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) );
297
+				$errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete );
298
+				unset( $time_to_delete, $delete_timestamp );
299
+			}
300 300
 		}
301 301
 
302
-        $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
302
+		$table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
303 303
 
304
-        $wp_list_table = new $table_class( array( 'params' => $params ) );
304
+		$wp_list_table = new $table_class( array( 'params' => $params ) );
305 305
 
306
-        $pagenum = $wp_list_table->get_pagenum();
306
+		$pagenum = $wp_list_table->get_pagenum();
307 307
 
308
-        $wp_list_table->prepare_items();
308
+		$wp_list_table->prepare_items();
309 309
 
310
-        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
311
-        if ( $pagenum > $total_pages && $total_pages > 0 ) {
310
+		$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
311
+		if ( $pagenum > $total_pages && $total_pages > 0 ) {
312 312
 			$url = add_query_arg( 'paged', $total_pages );
313
-            if ( headers_sent() ) {
314
-                echo FrmAppHelper::js_redirect($url);
315
-            } else {
316
-                wp_redirect( esc_url_raw( $url ) );
317
-            }
318
-            die();
319
-        }
320
-
321
-        if ( empty($message) && isset($_GET['import-message']) ) {
322
-            $message = __( 'Your import is complete', 'formidable' );
323
-        }
313
+			if ( headers_sent() ) {
314
+				echo FrmAppHelper::js_redirect($url);
315
+			} else {
316
+				wp_redirect( esc_url_raw( $url ) );
317
+			}
318
+			die();
319
+		}
320
+
321
+		if ( empty($message) && isset($_GET['import-message']) ) {
322
+			$message = __( 'Your import is complete', 'formidable' );
323
+		}
324 324
 
325 325
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' );
326
-    }
326
+	}
327 327
 
328
-    /* Back End CRUD */
328
+	/* Back End CRUD */
329 329
 	public static function show( $id = 0 ) {
330
-        FrmAppHelper::permission_check('frm_view_entries');
330
+		FrmAppHelper::permission_check('frm_view_entries');
331 331
 
332
-        if ( ! $id ) {
332
+		if ( ! $id ) {
333 333
 			$id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
334 334
 
335
-            if ( ! $id ) {
335
+			if ( ! $id ) {
336 336
 				$id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' );
337
-            }
338
-        }
337
+			}
338
+		}
339 339
 
340
-        $entry = FrmEntry::getOne($id, true);
340
+		$entry = FrmEntry::getOne($id, true);
341 341
 
342
-        $data = maybe_unserialize($entry->description);
342
+		$data = maybe_unserialize($entry->description);
343 343
 		if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) {
344 344
 			$data = array( 'referrer' => $data );
345 345
 		}
346 346
 
347 347
 		$fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' );
348
-        $to_emails = array();
348
+		$to_emails = array();
349 349
 
350 350
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' );
351
-    }
351
+	}
352 352
 
353
-    public static function destroy() {
354
-        FrmAppHelper::permission_check('frm_delete_entries');
353
+	public static function destroy() {
354
+		FrmAppHelper::permission_check('frm_delete_entries');
355 355
 
356 356
 		$params = FrmForm::get_admin_params();
357 357
 
358
-        if ( isset($params['keep_post']) && $params['keep_post'] ) {
359
-            //unlink entry from post
360
-            global $wpdb;
358
+		if ( isset($params['keep_post']) && $params['keep_post'] ) {
359
+			//unlink entry from post
360
+			global $wpdb;
361 361
 			$wpdb->update( $wpdb->prefix .'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) );
362
-        }
362
+		}
363 363
 
364
-        $message = '';
365
-        if ( FrmEntry::destroy( $params['id'] ) ) {
366
-            $message = __( 'Entry was Successfully Destroyed', 'formidable' );
367
-        }
364
+		$message = '';
365
+		if ( FrmEntry::destroy( $params['id'] ) ) {
366
+			$message = __( 'Entry was Successfully Destroyed', 'formidable' );
367
+		}
368 368
 
369
-        self::display_list( $message );
370
-    }
369
+		self::display_list( $message );
370
+	}
371 371
 
372
-    public static function destroy_all() {
373
-        if ( ! current_user_can( 'frm_delete_entries' ) ) {
374
-            $frm_settings = FrmAppHelper::get_settings();
375
-            wp_die( $frm_settings->admin_permission );
376
-        }
372
+	public static function destroy_all() {
373
+		if ( ! current_user_can( 'frm_delete_entries' ) ) {
374
+			$frm_settings = FrmAppHelper::get_settings();
375
+			wp_die( $frm_settings->admin_permission );
376
+		}
377 377
 
378
-        global $wpdb;
378
+		global $wpdb;
379 379
 		$params = FrmForm::get_admin_params();
380
-        $message = '';
381
-        $errors = array();
382
-        $form_id = (int) $params['form'];
380
+		$message = '';
381
+		$errors = array();
382
+		$form_id = (int) $params['form'];
383 383
 
384
-        if ( $form_id ) {
385
-            $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
384
+		if ( $form_id ) {
385
+			$entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
386 386
 			$action = FrmFormAction::get_action_for_form( $form_id, 'wppost', 1 );
387 387
 
388
-            if ( $action ) {
389
-                // this action takes a while, so only trigger it if there are posts to delete
390
-                foreach ( $entry_ids as $entry_id ) {
391
-                    do_action( 'frm_before_destroy_entry', $entry_id );
392
-                    unset( $entry_id );
393
-                }
394
-            }
395
-
396
-            $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) );
397
-            $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) );
398
-            if ( $results ) {
399
-                $message = __( 'Entries were Successfully Destroyed', 'formidable' );
400
-            }
401
-        } else {
402
-            $errors = __( 'No entries were specified', 'formidable' );
403
-        }
404
-
405
-        self::display_list( $message, $errors );
406
-    }
407
-
408
-    public static function show_form( $id = '', $key = '', $title = false, $description = false ) {
409
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' );
410
-        return FrmFormsController::show_form( $id, $key, $title, $description );
411
-    }
412
-
413
-    public static function get_form( $filename, $form, $title, $description ) {
414
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' );
415
-        return FrmFormsController::get_form( $form, $title, $description );
416
-    }
417
-
418
-    public static function process_entry( $errors = '', $ajax = false ) {
388
+			if ( $action ) {
389
+				// this action takes a while, so only trigger it if there are posts to delete
390
+				foreach ( $entry_ids as $entry_id ) {
391
+					do_action( 'frm_before_destroy_entry', $entry_id );
392
+					unset( $entry_id );
393
+				}
394
+			}
395
+
396
+			$wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) );
397
+			$results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) );
398
+			if ( $results ) {
399
+				$message = __( 'Entries were Successfully Destroyed', 'formidable' );
400
+			}
401
+		} else {
402
+			$errors = __( 'No entries were specified', 'formidable' );
403
+		}
404
+
405
+		self::display_list( $message, $errors );
406
+	}
407
+
408
+	public static function show_form( $id = '', $key = '', $title = false, $description = false ) {
409
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' );
410
+		return FrmFormsController::show_form( $id, $key, $title, $description );
411
+	}
412
+
413
+	public static function get_form( $filename, $form, $title, $description ) {
414
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' );
415
+		return FrmFormsController::get_form( $form, $title, $description );
416
+	}
417
+
418
+	public static function process_entry( $errors = '', $ajax = false ) {
419 419
 		$form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
420 420
 		if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) {
421
-            return;
422
-        }
421
+			return;
422
+		}
423 423
 
424
-        global $frm_vars;
424
+		global $frm_vars;
425 425
 
426 426
 		$form = FrmForm::getOne( $form_id );
427
-        if ( ! $form ) {
428
-            return;
429
-        }
427
+		if ( ! $form ) {
428
+			return;
429
+		}
430 430
 
431 431
 		$params = FrmForm::get_params( $form );
432 432
 
433
-        if ( ! isset( $frm_vars['form_params'] ) ) {
434
-            $frm_vars['form_params'] = array();
435
-        }
433
+		if ( ! isset( $frm_vars['form_params'] ) ) {
434
+			$frm_vars['form_params'] = array();
435
+		}
436 436
 		$frm_vars['form_params'][ $form->id ] = $params;
437 437
 
438 438
 		if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
439
-            return;
440
-        }
439
+			return;
440
+		}
441 441
 
442
-        if ( $errors == '' ) {
442
+		if ( $errors == '' ) {
443 443
 			$errors = FrmEntryValidate::validate( $_POST );
444
-        }
444
+		}
445 445
 
446 446
 		/**
447 447
 		 * Use this filter to add trigger actions and add errors after
@@ -452,102 +452,102 @@  discard block
 block discarded – undo
452 452
 
453 453
 		$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
454 454
 
455
-        if ( empty( $errors ) ) {
455
+		if ( empty( $errors ) ) {
456 456
 			$_POST['frm_skip_cookie'] = 1;
457
-            if ( $params['action'] == 'create' ) {
457
+			if ( $params['action'] == 'create' ) {
458 458
 				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
459 459
 					$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
460
-                }
461
-            }
460
+				}
461
+			}
462 462
 
463
-            do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
463
+			do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
464 464
 			unset( $_POST['frm_skip_cookie'] );
465
-        }
466
-    }
467
-
468
-    public static function delete_entry_before_redirect( $url, $form, $atts ) {
469
-        self::_delete_entry( $atts['id'], $form );
470
-        return $url;
471
-    }
472
-
473
-    //Delete entry if not redirected
474
-    public static function delete_entry_after_save( $atts ) {
475
-        self::_delete_entry( $atts['entry_id'], $atts['form'] );
476
-    }
477
-
478
-    private static function _delete_entry( $entry_id, $form ) {
479
-        if ( ! $form ) {
480
-            return;
481
-        }
482
-
483
-        $form->options = maybe_unserialize( $form->options );
484
-        if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
485
-            FrmEntry::destroy( $entry_id );
486
-        }
487
-    }
465
+		}
466
+	}
467
+
468
+	public static function delete_entry_before_redirect( $url, $form, $atts ) {
469
+		self::_delete_entry( $atts['id'], $form );
470
+		return $url;
471
+	}
472
+
473
+	//Delete entry if not redirected
474
+	public static function delete_entry_after_save( $atts ) {
475
+		self::_delete_entry( $atts['entry_id'], $atts['form'] );
476
+	}
477
+
478
+	private static function _delete_entry( $entry_id, $form ) {
479
+		if ( ! $form ) {
480
+			return;
481
+		}
482
+
483
+		$form->options = maybe_unserialize( $form->options );
484
+		if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
485
+			FrmEntry::destroy( $entry_id );
486
+		}
487
+	}
488 488
 
489 489
 	public static function show_entry_shortcode( $atts ) {
490 490
 		return FrmEntryFormat::show_entry( $atts );
491 491
 	}
492 492
 
493
-    public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) {
494
-        $field = FrmField::getOne($meta->field_id);
495
-        if ( ! $field ) {
496
-            return $value;
497
-        }
493
+	public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) {
494
+		$field = FrmField::getOne($meta->field_id);
495
+		if ( ! $field ) {
496
+			return $value;
497
+		}
498 498
 
499
-        $value = self::filter_display_value($value, $field, $atts);
500
-        return $value;
501
-    }
499
+		$value = self::filter_display_value($value, $field, $atts);
500
+		return $value;
501
+	}
502 502
 
503 503
 	public static function &filter_shortcode_value( $value, $tag, $atts, $field ) {
504
-        $plain_text = add_filter('frm_plain_text_email', true);
504
+		$plain_text = add_filter('frm_plain_text_email', true);
505 505
 		FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value );
506 506
 
507
-        if ( isset($atts['show']) && $atts['show'] == 'value' ) {
508
-            return $value;
509
-        }
507
+		if ( isset($atts['show']) && $atts['show'] == 'value' ) {
508
+			return $value;
509
+		}
510 510
 
511
-        return self::filter_display_value($value, $field, $atts);
512
-    }
511
+		return self::filter_display_value($value, $field, $atts);
512
+	}
513 513
 
514
-    public static function &filter_display_value( $value, $field, $atts = array() ) {
515
-        $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false;
514
+	public static function &filter_display_value( $value, $field, $atts = array() ) {
515
+		$saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false;
516 516
 		if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'radio', 'select' ) ) || ! FrmField::is_option_true( $field, 'separate_value' ) || $saved_value ) {
517
-            return $value;
518
-        }
519
-
520
-        $f_values = $f_labels = array();
521
-
522
-        foreach ( $field->options as $opt_key => $opt ) {
523
-            if ( ! is_array($opt) ) {
524
-                continue;
525
-            }
526
-
527
-            $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt);
528
-            $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ];
529
-            if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) {
530
-                unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] );
531
-            }
532
-            unset($opt_key, $opt);
533
-        }
534
-
535
-        if ( ! empty($f_values) ) {
536
-            foreach ( (array) $value as $v_key => $val ) {
537
-                if ( in_array($val, $f_values) ) {
538
-                    $opt = array_search($val, $f_values);
539
-                    if ( is_array($value) ) {
540
-                        $value[ $v_key ] = $f_labels[ $opt ];
541
-                    } else {
542
-                        $value = $f_labels[ $opt ];
543
-                    }
544
-                }
545
-                unset($v_key, $val);
546
-            }
547
-        }
548
-
549
-        return $value;
550
-    }
517
+			return $value;
518
+		}
519
+
520
+		$f_values = $f_labels = array();
521
+
522
+		foreach ( $field->options as $opt_key => $opt ) {
523
+			if ( ! is_array($opt) ) {
524
+				continue;
525
+			}
526
+
527
+			$f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt);
528
+			$f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ];
529
+			if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) {
530
+				unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] );
531
+			}
532
+			unset($opt_key, $opt);
533
+		}
534
+
535
+		if ( ! empty($f_values) ) {
536
+			foreach ( (array) $value as $v_key => $val ) {
537
+				if ( in_array($val, $f_values) ) {
538
+					$opt = array_search($val, $f_values);
539
+					if ( is_array($value) ) {
540
+						$value[ $v_key ] = $f_labels[ $opt ];
541
+					} else {
542
+						$value = $f_labels[ $opt ];
543
+					}
544
+				}
545
+				unset($v_key, $val);
546
+			}
547
+		}
548
+
549
+		return $value;
550
+	}
551 551
 
552 552
 	public static function get_params( $form = null ) {
553 553
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_params' );
@@ -555,13 +555,13 @@  discard block
 block discarded – undo
555 555
 	}
556 556
 
557 557
 	public static function entry_sidebar( $entry ) {
558
-        $data = maybe_unserialize($entry->description);
559
-        $date_format = get_option('date_format');
560
-        $time_format = get_option('time_format');
558
+		$data = maybe_unserialize($entry->description);
559
+		$date_format = get_option('date_format');
560
+		$time_format = get_option('time_format');
561 561
 		if ( isset( $data['browser'] ) ) {
562 562
 			$browser = FrmEntryFormat::get_browser( $data['browser'] );
563 563
 		}
564 564
 
565 565
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' );
566
-    }
566
+	}
567 567
 }
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
     public static function menu() {
6 6
 		FrmAppHelper::force_capability( 'frm_view_entries' );
7 7
 
8
-        add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
8
+        add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
9 9
 
10 10
 		if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) {
11 11
 			$menu_name = FrmAppHelper::get_menu_name();
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             'id'      => 'formidable-entries-tab',
54 54
             'title'   => __( 'Overview', 'formidable' ),
55 55
 			'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
56
-        ));
56
+        ) );
57 57
 
58 58
         $screen->set_help_sidebar(
59 59
 			'<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
         global $frm_vars, $wpdb;
69 69
 		$form_id = FrmForm::get_current_form_id();
70 70
 
71
-		$columns[ $form_id . '_id' ] = 'ID';
72
-		$columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
71
+		$columns[$form_id . '_id'] = 'ID';
72
+		$columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' );
73 73
 
74 74
         if ( ! $form_id ) {
75 75
             return $columns;
76 76
         }
77 77
 
78
-        $form_cols = FrmField::get_all_for_form($form_id, '', 'include');
78
+        $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' );
79 79
 
80 80
         foreach ( $form_cols as $form_col ) {
81 81
 			if ( FrmField::is_no_save_field( $form_col->type ) ) {
@@ -88,30 +88,30 @@  discard block
 block discarded – undo
88 88
                 if ( $sub_form_cols ) {
89 89
                     foreach ( $sub_form_cols as $k => $sub_form_col ) {
90 90
 						if ( FrmField::is_no_save_field( $sub_form_col->type ) ) {
91
-                            unset( $sub_form_cols[ $k ] );
91
+                            unset( $sub_form_cols[$k] );
92 92
                             continue;
93 93
                         }
94
-						$columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
95
-                        unset($sub_form_col);
94
+						$columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
95
+                        unset( $sub_form_col );
96 96
                     }
97 97
                 }
98
-                unset($sub_form_cols);
98
+                unset( $sub_form_cols );
99 99
             } else {
100 100
                 $col_id = $form_col->field_key;
101 101
                 if ( $form_col->form_id != $form_id ) {
102 102
 					$col_id .= '-_-form' . $form_col->form_id;
103 103
                 }
104 104
 
105
-                if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) {
106
-					$columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
105
+                if ( isset( $form_col->field_options['separate_value'] ) && $form_col->field_options['separate_value'] ) {
106
+					$columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 );
107 107
                 }
108
-				$columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
108
+				$columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 );
109 109
             }
110 110
         }
111 111
 
112
-		$columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' );
113
-		$columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
114
-		$columns[ $form_id . '_ip' ] = 'IP';
112
+		$columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' );
113
+		$columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' );
114
+		$columns[$form_id . '_ip'] = 'IP';
115 115
 
116 116
         $frm_vars['cols'] = $columns;
117 117
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
         global $frm_vars;
138 138
         //add a check so we don't create a loop
139
-        $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
139
+        $frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
140 140
 
141 141
         return $check;
142 142
     }
@@ -151,19 +151,19 @@  discard block
 block discarded – undo
151 151
         }
152 152
 
153 153
         global $frm_vars;
154
-        if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) {
154
+        if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) {
155 155
             return; //don't continue if there's no previous value
156 156
         }
157 157
 
158 158
         foreach ( $meta_value as $mk => $mv ) {
159 159
             //remove blank values
160
-            if ( empty( $mv )  ) {
161
-                unset( $meta_value[ $mk ] );
160
+            if ( empty( $mv ) ) {
161
+                unset( $meta_value[$mk] );
162 162
             }
163 163
         }
164 164
 
165
-        $cur_form_prefix = reset($meta_value);
166
-        $cur_form_prefix = explode('_', $cur_form_prefix);
165
+        $cur_form_prefix = reset( $meta_value );
166
+        $cur_form_prefix = explode( '_', $cur_form_prefix );
167 167
         $cur_form_prefix = $cur_form_prefix[0];
168 168
         $save = false;
169 169
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
             $meta_value[] = $prev_hidden;
184 184
             $save = true;
185
-            unset($form_prefix);
185
+            unset( $form_prefix );
186 186
         }
187 187
 
188 188
 		if ( $save ) {
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		foreach ( $fields as $field ) {
215 215
 			if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) {
216 216
 				// Can't sort on checkboxes because they are stored serialized, or post fields
217
-				$columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id;
217
+				$columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id;
218 218
 			}
219 219
 		}
220 220
 
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
                     break;
238 238
                 }
239 239
 
240
-                unset($form_prefix);
240
+                unset( $form_prefix );
241 241
             }
242 242
         }
243 243
 
@@ -245,36 +245,36 @@  discard block
 block discarded – undo
245 245
 			return $result;
246 246
 		}
247 247
 
248
-        $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0;
248
+        $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0;
249 249
         $max_columns = 8;
250 250
         if ( $i <= $max_columns ) {
251 251
 			return $result;
252 252
 		}
253 253
 
254 254
         global $frm_vars;
255
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) {
256
-            $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options);
255
+        if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] ) {
256
+            $frm_vars['current_form']->options = maybe_unserialize( $frm_vars['current_form']->options );
257 257
         }
258 258
 
259
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) {
259
+        if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] && isset( $frm_vars['current_form']->options['hidden_cols'] ) && ! empty( $frm_vars['current_form']->options['hidden_cols'] ) ) {
260 260
             $result = $frm_vars['current_form']->options['hidden_cols'];
261 261
         } else {
262 262
             $cols = $frm_vars['cols'];
263
-            $cols = array_reverse($cols, true);
263
+            $cols = array_reverse( $cols, true );
264 264
 
265 265
 			$result[] = $form_id . '_id';
266
-            $i--;
266
+            $i --;
267 267
 
268 268
 			$result[] = $form_id . '_item_key';
269
-            $i--;
269
+            $i --;
270 270
 
271 271
 			foreach ( $cols as $col_key => $col ) {
272 272
                 if ( $i > $max_columns ) {
273 273
 					$result[] = $col_key;
274 274
 				}
275 275
                 //remove some columns by default
276
-                $i--;
277
-                unset($col_key, $col);
276
+                $i --;
277
+                unset( $col_key, $col );
278 278
             }
279 279
         }
280 280
 
@@ -311,14 +311,14 @@  discard block
 block discarded – undo
311 311
         if ( $pagenum > $total_pages && $total_pages > 0 ) {
312 312
 			$url = add_query_arg( 'paged', $total_pages );
313 313
             if ( headers_sent() ) {
314
-                echo FrmAppHelper::js_redirect($url);
314
+                echo FrmAppHelper::js_redirect( $url );
315 315
             } else {
316 316
                 wp_redirect( esc_url_raw( $url ) );
317 317
             }
318 318
             die();
319 319
         }
320 320
 
321
-        if ( empty($message) && isset($_GET['import-message']) ) {
321
+        if ( empty( $message ) && isset( $_GET['import-message'] ) ) {
322 322
             $message = __( 'Your import is complete', 'formidable' );
323 323
         }
324 324
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 
328 328
     /* Back End CRUD */
329 329
 	public static function show( $id = 0 ) {
330
-        FrmAppHelper::permission_check('frm_view_entries');
330
+        FrmAppHelper::permission_check( 'frm_view_entries' );
331 331
 
332 332
         if ( ! $id ) {
333 333
 			$id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
@@ -337,9 +337,9 @@  discard block
 block discarded – undo
337 337
             }
338 338
         }
339 339
 
340
-        $entry = FrmEntry::getOne($id, true);
340
+        $entry = FrmEntry::getOne( $id, true );
341 341
 
342
-        $data = maybe_unserialize($entry->description);
342
+        $data = maybe_unserialize( $entry->description );
343 343
 		if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) {
344 344
 			$data = array( 'referrer' => $data );
345 345
 		}
@@ -351,11 +351,11 @@  discard block
 block discarded – undo
351 351
     }
352 352
 
353 353
     public static function destroy() {
354
-        FrmAppHelper::permission_check('frm_delete_entries');
354
+        FrmAppHelper::permission_check( 'frm_delete_entries' );
355 355
 
356 356
 		$params = FrmForm::get_admin_params();
357 357
 
358
-        if ( isset($params['keep_post']) && $params['keep_post'] ) {
358
+        if ( isset( $params['keep_post'] ) && $params['keep_post'] ) {
359 359
             //unlink entry from post
360 360
             global $wpdb;
361 361
 			$wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) );
@@ -433,9 +433,9 @@  discard block
 block discarded – undo
433 433
         if ( ! isset( $frm_vars['form_params'] ) ) {
434 434
             $frm_vars['form_params'] = array();
435 435
         }
436
-		$frm_vars['form_params'][ $form->id ] = $params;
436
+		$frm_vars['form_params'][$form->id] = $params;
437 437
 
438
-		if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
438
+		if ( isset( $frm_vars['created_entries'][$form_id] ) ) {
439 439
             return;
440 440
         }
441 441
 
@@ -450,13 +450,13 @@  discard block
 block discarded – undo
450 450
 		 */
451 451
 		$errors = apply_filters( 'frm_entries_before_create', $errors, $form );
452 452
 
453
-		$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
453
+		$frm_vars['created_entries'][$form_id] = array( 'errors' => $errors );
454 454
 
455 455
         if ( empty( $errors ) ) {
456 456
 			$_POST['frm_skip_cookie'] = 1;
457 457
             if ( $params['action'] == 'create' ) {
458
-				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
459
-					$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
458
+				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) {
459
+					$frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST );
460 460
                 }
461 461
             }
462 462
 
@@ -491,28 +491,28 @@  discard block
 block discarded – undo
491 491
 	}
492 492
 
493 493
     public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) {
494
-        $field = FrmField::getOne($meta->field_id);
494
+        $field = FrmField::getOne( $meta->field_id );
495 495
         if ( ! $field ) {
496 496
             return $value;
497 497
         }
498 498
 
499
-        $value = self::filter_display_value($value, $field, $atts);
499
+        $value = self::filter_display_value( $value, $field, $atts );
500 500
         return $value;
501 501
     }
502 502
 
503 503
 	public static function &filter_shortcode_value( $value, $tag, $atts, $field ) {
504
-        $plain_text = add_filter('frm_plain_text_email', true);
504
+        $plain_text = add_filter( 'frm_plain_text_email', true );
505 505
 		FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value );
506 506
 
507
-        if ( isset($atts['show']) && $atts['show'] == 'value' ) {
507
+        if ( isset( $atts['show'] ) && $atts['show'] == 'value' ) {
508 508
             return $value;
509 509
         }
510 510
 
511
-        return self::filter_display_value($value, $field, $atts);
511
+        return self::filter_display_value( $value, $field, $atts );
512 512
     }
513 513
 
514 514
     public static function &filter_display_value( $value, $field, $atts = array() ) {
515
-        $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false;
515
+        $saved_value = ( isset( $atts['saved_value'] ) && $atts['saved_value'] ) ? true : false;
516 516
 		if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'radio', 'select' ) ) || ! FrmField::is_option_true( $field, 'separate_value' ) || $saved_value ) {
517 517
             return $value;
518 518
         }
@@ -520,29 +520,29 @@  discard block
 block discarded – undo
520 520
         $f_values = $f_labels = array();
521 521
 
522 522
         foreach ( $field->options as $opt_key => $opt ) {
523
-            if ( ! is_array($opt) ) {
523
+            if ( ! is_array( $opt ) ) {
524 524
                 continue;
525 525
             }
526 526
 
527
-            $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt);
528
-            $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ];
529
-            if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) {
530
-                unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] );
527
+            $f_labels[$opt_key] = isset( $opt['label'] ) ? $opt['label'] : reset( $opt );
528
+            $f_values[$opt_key] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[$opt_key];
529
+            if ( $f_labels[$opt_key] == $f_values[$opt_key] ) {
530
+                unset( $f_values[$opt_key], $f_labels[$opt_key] );
531 531
             }
532
-            unset($opt_key, $opt);
532
+            unset( $opt_key, $opt );
533 533
         }
534 534
 
535
-        if ( ! empty($f_values) ) {
535
+        if ( ! empty( $f_values ) ) {
536 536
             foreach ( (array) $value as $v_key => $val ) {
537
-                if ( in_array($val, $f_values) ) {
538
-                    $opt = array_search($val, $f_values);
539
-                    if ( is_array($value) ) {
540
-                        $value[ $v_key ] = $f_labels[ $opt ];
537
+                if ( in_array( $val, $f_values ) ) {
538
+                    $opt = array_search( $val, $f_values );
539
+                    if ( is_array( $value ) ) {
540
+                        $value[$v_key] = $f_labels[$opt];
541 541
                     } else {
542
-                        $value = $f_labels[ $opt ];
542
+                        $value = $f_labels[$opt];
543 543
                     }
544 544
                 }
545
-                unset($v_key, $val);
545
+                unset( $v_key, $val );
546 546
             }
547 547
         }
548 548
 
@@ -555,9 +555,9 @@  discard block
 block discarded – undo
555 555
 	}
556 556
 
557 557
 	public static function entry_sidebar( $entry ) {
558
-        $data = maybe_unserialize($entry->description);
559
-        $date_format = get_option('date_format');
560
-        $time_format = get_option('time_format');
558
+        $data = maybe_unserialize( $entry->description );
559
+        $date_format = get_option( 'date_format' );
560
+        $time_format = get_option( 'time_format' );
561 561
 		if ( isset( $data['browser'] ) ) {
562 562
 			$browser = FrmEntryFormat::get_browser( $data['browser'] );
563 563
 		}
Please login to merge, or discard this patch.
classes/controllers/FrmFormsController.php 2 patches
Spacing   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  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 12
 		self::maybe_load_listing_hooks();
13 13
     }
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 			return;
19 19
 		}
20 20
 
21
-		add_filter('get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' );
21
+		add_filter( 'get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' );
22 22
 
23
-		add_filter('manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 );
24
-		add_filter('manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' );
23
+		add_filter( 'manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 );
24
+		add_filter( 'manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' );
25 25
 	}
26 26
 
27 27
     public static function head() {
28
-        wp_enqueue_script('formidable-editinplace');
28
+        wp_enqueue_script( 'formidable-editinplace' );
29 29
 
30 30
         if ( wp_is_mobile() ) {
31 31
     		wp_enqueue_script( 'jquery-touch-punch' );
@@ -33,39 +33,39 @@  discard block
 block discarded – undo
33 33
     }
34 34
 
35 35
     public static function register_widgets() {
36
-        require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php');
37
-        register_widget('FrmShowForm');
36
+        require_once( FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php' );
37
+        register_widget( 'FrmShowForm' );
38 38
     }
39 39
 
40 40
     public static function list_form() {
41
-        FrmAppHelper::permission_check('frm_view_forms');
41
+        FrmAppHelper::permission_check( 'frm_view_forms' );
42 42
 
43 43
 		$params = FrmForm::list_page_params();
44
-        $errors = self::process_bulk_form_actions( array());
45
-        $errors = apply_filters('frm_admin_list_form_action', $errors);
44
+        $errors = self::process_bulk_form_actions( array() );
45
+        $errors = apply_filters( 'frm_admin_list_form_action', $errors );
46 46
 
47 47
 		return self::display_forms_list( $params, '', $errors );
48 48
     }
49 49
 
50 50
 	public static function new_form( $values = array() ) {
51
-        FrmAppHelper::permission_check('frm_edit_forms');
51
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
52 52
 
53 53
         global $frm_vars;
54 54
 
55
-        $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
56
-		$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ];
55
+        $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
56
+		$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[$action];
57 57
 
58 58
 		if ( $action == 'create' ) {
59
-            return self::create($values);
59
+            return self::create( $values );
60 60
 		} else if ( $action == 'new' ) {
61 61
 			$frm_field_selection = FrmField::field_selection();
62
-            $values = FrmFormsHelper::setup_new_vars($values);
62
+            $values = FrmFormsHelper::setup_new_vars( $values );
63 63
             $id = FrmForm::create( $values );
64
-            $form = FrmForm::getOne($id);
64
+            $form = FrmForm::getOne( $id );
65 65
 
66 66
             // add default email notification
67 67
             $action_control = FrmFormActionsController::get_form_actions( 'email' );
68
-            $action_control->create($form->id);
68
+            $action_control->create( $form->id );
69 69
 
70 70
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
71 71
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     }
76 76
 
77 77
 	public static function create( $values = array() ) {
78
-        FrmAppHelper::permission_check('frm_edit_forms');
78
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
79 79
 
80 80
         global $frm_vars;
81 81
         if ( empty( $values ) ) {
@@ -87,22 +87,22 @@  discard block
 block discarded – undo
87 87
             $values = FrmProEntry::mod_other_vals( $values, 'back' );
88 88
         }
89 89
 
90
-		$id = isset($values['id']) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
90
+		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
91 91
 
92 92
         if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
93 93
             $frm_settings = FrmAppHelper::get_settings();
94 94
             $errors = array( 'form' => $frm_settings->admin_permission );
95 95
         } else {
96
-            $errors = FrmForm::validate($values);
96
+            $errors = FrmForm::validate( $values );
97 97
         }
98 98
 
99
-        if ( count($errors) > 0 ) {
99
+        if ( count( $errors ) > 0 ) {
100 100
             $hide_preview = true;
101 101
 			$frm_field_selection = FrmField::field_selection();
102 102
             $form = FrmForm::getOne( $id );
103
-            $fields = FrmField::get_all_for_form($id);
103
+            $fields = FrmField::get_all_for_form( $id );
104 104
 
105
-            $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
105
+            $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true );
106 106
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
107 107
 
108 108
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
@@ -114,32 +114,32 @@  discard block
 block discarded – undo
114 114
     }
115 115
 
116 116
     public static function edit( $values = false ) {
117
-        FrmAppHelper::permission_check('frm_edit_forms');
117
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
118 118
 
119 119
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
120
-        return self::get_edit_vars($id);
120
+        return self::get_edit_vars( $id );
121 121
     }
122 122
 
123 123
     public static function settings( $id = false, $message = '' ) {
124
-        FrmAppHelper::permission_check('frm_edit_forms');
124
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
125 125
 
126
-        if ( ! $id || ! is_numeric($id) ) {
126
+        if ( ! $id || ! is_numeric( $id ) ) {
127 127
 			$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
128 128
         }
129 129
 		return self::get_settings_vars( $id, array(), $message );
130 130
     }
131 131
 
132 132
     public static function update_settings() {
133
-        FrmAppHelper::permission_check('frm_edit_forms');
133
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
134 134
 
135 135
 		$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
136 136
 
137
-        $errors = FrmForm::validate($_POST);
138
-        if ( count($errors) > 0 ) {
139
-            return self::get_settings_vars($id, $errors);
137
+        $errors = FrmForm::validate( $_POST );
138
+        if ( count( $errors ) > 0 ) {
139
+            return self::get_settings_vars( $id, $errors );
140 140
         }
141 141
 
142
-        do_action('frm_before_update_form_settings', $id);
142
+        do_action( 'frm_before_update_form_settings', $id );
143 143
 
144 144
 		FrmForm::update( $id, $_POST );
145 145
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
 	private static function edit_in_place_value( $field ) {
163 163
 		check_ajax_referer( 'frm_ajax', 'nonce' );
164
-		FrmAppHelper::permission_check('frm_edit_forms', 'hide');
164
+		FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' );
165 165
 
166 166
 		$form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
167 167
 		$value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_filter_post_kses' );
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	 * @since 2.0
220 220
 	 */
221 221
 	public static function _create_from_template() {
222
-		FrmAppHelper::permission_check('frm_edit_forms');
222
+		FrmAppHelper::permission_check( 'frm_edit_forms' );
223 223
 		check_ajax_referer( 'frm_ajax', 'nonce' );
224 224
 
225 225
 		$current_form = FrmAppHelper::get_param( 'this_form', '', 'get', 'absint' );
@@ -234,15 +234,15 @@  discard block
 block discarded – undo
234 234
 	}
235 235
 
236 236
     public static function duplicate() {
237
-        FrmAppHelper::permission_check('frm_edit_forms');
237
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
238 238
 
239 239
 		$params = FrmForm::list_page_params();
240 240
         $form = FrmForm::duplicate( $params['id'], $params['template'], true );
241
-        $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
241
+        $message = ( $params['template'] ) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
242 242
         if ( $form ) {
243 243
 			return self::get_edit_vars( $form, array(), $message, true );
244 244
         } else {
245
-            return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' ));
245
+            return self::display_forms_list( $params, __( 'There was a problem creating the new template.', 'formidable' ) );
246 246
         }
247 247
     }
248 248
 
@@ -304,11 +304,11 @@  discard block
 block discarded – undo
304 304
     }
305 305
 
306 306
 	public static function bulk_untrash( $ids ) {
307
-        FrmAppHelper::permission_check('frm_edit_forms');
307
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
308 308
 
309 309
         $count = FrmForm::set_status( $ids, 'published' );
310 310
 
311
-        $message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
311
+        $message = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
312 312
         return $message;
313 313
     }
314 314
 
@@ -327,11 +327,11 @@  discard block
 block discarded – undo
327 327
 			'trash'   => array( 'permission' => 'frm_delete_forms', 'new_status' => 'trash' ),
328 328
 		);
329 329
 
330
-		if ( ! isset( $available_status[ $status ] ) ) {
330
+		if ( ! isset( $available_status[$status] ) ) {
331 331
 			return;
332 332
 		}
333 333
 
334
-		FrmAppHelper::permission_check( $available_status[ $status ]['permission'] );
334
+		FrmAppHelper::permission_check( $available_status[$status]['permission'] );
335 335
 
336 336
 		$params = FrmForm::list_page_params();
337 337
 
@@ -339,25 +339,25 @@  discard block
 block discarded – undo
339 339
 		check_admin_referer( $status . '_form_' . $params['id'] );
340 340
 
341 341
 		$count = 0;
342
-		if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
343
-			$count++;
342
+		if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) {
343
+			$count ++;
344 344
 		}
345 345
 
346
-		$available_status['untrash']['message'] = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count );
346
+		$available_status['untrash']['message'] = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count );
347 347
 		$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>' );
348 348
 
349
-		$message = $available_status[ $status ]['message'];
349
+		$message = $available_status[$status]['message'];
350 350
 
351 351
 		self::display_forms_list( $params, $message );
352 352
 	}
353 353
 
354 354
 	public static function bulk_trash( $ids ) {
355
-        FrmAppHelper::permission_check('frm_delete_forms');
355
+        FrmAppHelper::permission_check( 'frm_delete_forms' );
356 356
 
357 357
         $count = 0;
358 358
         foreach ( $ids as $id ) {
359 359
             if ( FrmForm::trash( $id ) ) {
360
-                $count++;
360
+                $count ++;
361 361
             }
362 362
         }
363 363
 
@@ -368,49 +368,49 @@  discard block
 block discarded – undo
368 368
     }
369 369
 
370 370
     public static function destroy() {
371
-        FrmAppHelper::permission_check('frm_delete_forms');
371
+        FrmAppHelper::permission_check( 'frm_delete_forms' );
372 372
 
373 373
 		$params = FrmForm::list_page_params();
374 374
 
375 375
         //check nonce url
376
-        check_admin_referer('destroy_form_' . $params['id']);
376
+        check_admin_referer( 'destroy_form_' . $params['id'] );
377 377
 
378 378
         $count = 0;
379 379
         if ( FrmForm::destroy( $params['id'] ) ) {
380
-            $count++;
380
+            $count ++;
381 381
         }
382 382
 
383
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
383
+        $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
384 384
 
385 385
 		self::display_forms_list( $params, $message );
386 386
     }
387 387
 
388 388
 	public static function bulk_destroy( $ids ) {
389
-        FrmAppHelper::permission_check('frm_delete_forms');
389
+        FrmAppHelper::permission_check( 'frm_delete_forms' );
390 390
 
391 391
         $count = 0;
392 392
         foreach ( $ids as $id ) {
393 393
             $d = FrmForm::destroy( $id );
394 394
             if ( $d ) {
395
-                $count++;
395
+                $count ++;
396 396
             }
397 397
         }
398 398
 
399
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
399
+        $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
400 400
 
401 401
         return $message;
402 402
     }
403 403
 
404 404
     private static function delete_all() {
405 405
         //check nonce url
406
-        $permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable');
406
+        $permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable' );
407 407
         if ( $permission_error !== false ) {
408 408
 			self::display_forms_list( array(), '', array( $permission_error ) );
409 409
             return;
410 410
         }
411 411
 
412 412
 		$count = FrmForm::scheduled_delete( time() );
413
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
413
+        $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
414 414
 
415 415
 		self::display_forms_list( array(), $message );
416 416
     }
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 	* @since 2.0.15
428 428
 	*/
429 429
 	public static function insert_form_button() {
430
-		if ( current_user_can('frm_view_forms') ) {
430
+		if ( current_user_can( 'frm_view_forms' ) ) {
431 431
 			$menu_name = FrmAppHelper::get_menu_name();
432 432
 			$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' ) . '">
433 433
 				<span class="frm-buttons-icon wp-media-buttons-icon"></span> ' .
@@ -448,17 +448,17 @@  discard block
 block discarded – undo
448 448
 			'formidable' => array( 'name' => __( 'Form', 'formidable' ), 'label' => __( 'Insert a Form', 'formidable' ) ),
449 449
         );
450 450
 
451
-        $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes);
451
+        $shortcodes = apply_filters( 'frm_popup_shortcodes', $shortcodes );
452 452
 
453 453
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/insert_form_popup.php' );
454 454
     }
455 455
 
456 456
     public static function get_shortcode_opts() {
457
-		FrmAppHelper::permission_check('frm_view_forms');
457
+		FrmAppHelper::permission_check( 'frm_view_forms' );
458 458
         check_ajax_referer( 'frm_ajax', 'nonce' );
459 459
 
460 460
 		$shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' );
461
-        if ( empty($shortcode) ) {
461
+        if ( empty( $shortcode ) ) {
462 462
             wp_die();
463 463
         }
464 464
 
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
                 );
479 479
             break;
480 480
         }
481
-        $opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode);
481
+        $opts = apply_filters( 'frm_sc_popup_opts', $opts, $shortcode );
482 482
 
483 483
 		if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) {
484 484
 			// allow other shortcodes to use the required form id option
@@ -595,11 +595,11 @@  discard block
 block discarded – undo
595 595
         }
596 596
 
597 597
         if ( $form->parent_form_id ) {
598
-			wp_die( sprintf( __( 'You are trying to edit a child form. Please edit from %1$shere%2$s', 'formidable' ), '<a href="' . esc_url( admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form->parent_form_id ) ) . '">', '</a>' ));
598
+			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>' ) );
599 599
         }
600 600
 
601 601
 		$frm_field_selection = FrmField::field_selection();
602
-        $fields = FrmField::get_all_for_form($form->id);
602
+        $fields = FrmField::get_all_for_form( $form->id );
603 603
 
604 604
         // Automatically add end section fields if they don't exist (2.0 migration)
605 605
         $reset_fields = false;
@@ -609,9 +609,9 @@  discard block
 block discarded – undo
609 609
             $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
610 610
         }
611 611
 
612
-        unset($end_section_values, $last_order, $open, $reset_fields);
612
+        unset( $end_section_values, $last_order, $open, $reset_fields );
613 613
 
614
-        $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
614
+        $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true );
615 615
 
616 616
         $edit_message = __( 'Form was Successfully Updated', 'formidable' );
617 617
         if ( $form->is_template && $message == $edit_message ) {
@@ -621,8 +621,8 @@  discard block
 block discarded – undo
621 621
 		$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
622 622
 
623 623
         if ( $form->default_template ) {
624
-            wp_die(__( 'That template cannot be edited', 'formidable' ));
625
-        } else if ( defined('DOING_AJAX') ) {
624
+            wp_die( __( 'That template cannot be edited', 'formidable' ) );
625
+        } else if ( defined( 'DOING_AJAX' ) ) {
626 626
             wp_die();
627 627
         } else if ( $create_link ) {
628 628
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
@@ -638,28 +638,28 @@  discard block
 block discarded – undo
638 638
 
639 639
         $form = FrmForm::getOne( $id );
640 640
 
641
-        $fields = FrmField::get_all_for_form($id);
642
-        $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
641
+        $fields = FrmField::get_all_for_form( $id );
642
+        $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true );
643 643
 
644
-        if ( isset($values['default_template']) && $values['default_template'] ) {
645
-            wp_die(__( 'That template cannot be edited', 'formidable' ));
644
+        if ( isset( $values['default_template'] ) && $values['default_template'] ) {
645
+            wp_die( __( 'That template cannot be edited', 'formidable' ) );
646 646
         }
647 647
 
648 648
         $action_controls = FrmFormActionsController::get_form_actions();
649 649
 
650
-        $sections = apply_filters('frm_add_form_settings_section', array(), $values);
650
+        $sections = apply_filters( 'frm_add_form_settings_section', array(), $values );
651 651
         $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
652 652
 
653
-        $styles = apply_filters('frm_get_style_opts', array());
653
+        $styles = apply_filters( 'frm_get_style_opts', array() );
654 654
 
655 655
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings.php' );
656 656
     }
657 657
 
658 658
     public static function mb_tags_box( $form_id, $class = '' ) {
659
-        $fields = FrmField::get_all_for_form($form_id, '', 'include');
659
+        $fields = FrmField::get_all_for_form( $form_id, '', 'include' );
660 660
         $linked_forms = array();
661 661
         $col = 'one';
662
-        $settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false;
662
+        $settings_tab = FrmAppHelper::is_admin_page( 'formidable' ) ? true : false;
663 663
 
664 664
 		$cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() );
665 665
 		$adv_shortcodes = self::get_advanced_shortcodes();
@@ -737,13 +737,13 @@  discard block
 block discarded – undo
737 737
 
738 738
     // Insert the form class setting into the form
739 739
 	public static function form_classes( $form ) {
740
-        if ( isset($form->options['form_class']) ) {
740
+        if ( isset( $form->options['form_class'] ) ) {
741 741
 			echo esc_attr( sanitize_text_field( $form->options['form_class'] ) );
742 742
         }
743 743
     }
744 744
 
745 745
     public static function get_email_html() {
746
-		FrmAppHelper::permission_check('frm_view_forms');
746
+		FrmAppHelper::permission_check( 'frm_view_forms' );
747 747
         check_ajax_referer( 'frm_ajax', 'nonce' );
748 748
 		echo FrmEntryFormat::show_entry( array(
749 749
 			'form_id'       => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ),
@@ -840,11 +840,11 @@  discard block
 block discarded – undo
840 840
     public static function add_default_templates( $path, $default = true, $template = true ) {
841 841
         _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' );
842 842
 
843
-        $path = untrailingslashit(trim($path));
843
+        $path = untrailingslashit( trim( $path ) );
844 844
 		$templates = glob( $path . '/*.php' );
845 845
 
846
-		for ( $i = count( $templates ) - 1; $i >= 0; $i-- ) {
847
-			$filename = str_replace( '.php', '', str_replace( $path . '/', '', $templates[ $i ] ) );
846
+		for ( $i = count( $templates ) - 1; $i >= 0; $i -- ) {
847
+			$filename = str_replace( '.php', '', str_replace( $path . '/', '', $templates[$i] ) );
848 848
 			$template_query = array( 'form_key' => $filename );
849 849
             if ( $template ) {
850 850
                 $template_query['is_template'] = 1;
@@ -862,12 +862,12 @@  discard block
 block discarded – undo
862 862
                 $values['default_template'] = 1;
863 863
             }
864 864
 
865
-            include( $templates[ $i ] );
865
+            include( $templates[$i] );
866 866
 
867 867
             //get updated form
868
-            if ( isset($form) && ! empty($form) ) {
868
+            if ( isset( $form ) && ! empty( $form ) ) {
869 869
                 $old_id = $form->id;
870
-                $form = FrmForm::getOne($form->id);
870
+                $form = FrmForm::getOne( $form->id );
871 871
             } else {
872 872
                 $old_id = false;
873 873
 				$form = FrmForm::getAll( $template_query, '', 1 );
@@ -880,24 +880,24 @@  discard block
 block discarded – undo
880 880
     }
881 881
 
882 882
     public static function route() {
883
-        $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
883
+        $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
884 884
         $vars = array();
885 885
 		if ( isset( $_POST['frm_compact_fields'] ) ) {
886 886
 			FrmAppHelper::permission_check( 'frm_edit_forms' );
887 887
 
888
-            $json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('&quot;', '\\\"', $_POST['frm_compact_fields'] ))));
889
-            $json_vars = json_decode($json_vars, true);
890
-            if ( empty($json_vars) ) {
888
+            $json_vars = htmlspecialchars_decode( nl2br( stripslashes( str_replace( '&quot;', '\\\"', $_POST['frm_compact_fields'] ) ) ) );
889
+            $json_vars = json_decode( $json_vars, true );
890
+            if ( empty( $json_vars ) ) {
891 891
                 // json decoding failed so we should return an error message
892 892
 				$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
893 893
                 if ( 'edit' == $action ) {
894 894
                     $action = 'update';
895 895
                 }
896 896
 
897
-                add_filter('frm_validate_form', 'FrmFormsController::json_error');
897
+                add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
898 898
             } else {
899
-                $vars = FrmAppHelper::json_to_array($json_vars);
900
-                $action = $vars[ $action ];
899
+                $vars = FrmAppHelper::json_to_array( $json_vars );
900
+                $action = $vars[$action];
901 901
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] );
902 902
 				$_REQUEST = array_merge( $_REQUEST, $vars );
903 903
 				$_POST = array_merge( $_POST, $_REQUEST );
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
 
916 916
         switch ( $action ) {
917 917
             case 'new':
918
-                return self::new_form($vars);
918
+                return self::new_form( $vars );
919 919
             case 'create':
920 920
             case 'edit':
921 921
             case 'update':
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 					$action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
939 939
                 }
940 940
 
941
-                if ( strpos($action, 'bulk_') === 0 ) {
941
+                if ( strpos( $action, 'bulk_' ) === 0 ) {
942 942
                     FrmAppHelper::remove_get_action();
943 943
                     return self::list_form();
944 944
                 }
@@ -965,27 +965,27 @@  discard block
 block discarded – undo
965 965
 
966 966
 	public static function admin_bar_configure() {
967 967
         global $frm_vars;
968
-        if ( empty($frm_vars['forms_loaded']) ) {
968
+        if ( empty( $frm_vars['forms_loaded'] ) ) {
969 969
             return;
970 970
         }
971 971
 
972 972
         $actions = array();
973 973
         foreach ( $frm_vars['forms_loaded'] as $form ) {
974
-            if ( is_object($form) ) {
975
-                $actions[ $form->id ] = $form->name;
974
+            if ( is_object( $form ) ) {
975
+                $actions[$form->id] = $form->name;
976 976
             }
977
-            unset($form);
977
+            unset( $form );
978 978
         }
979 979
 
980
-        if ( empty($actions) ) {
980
+        if ( empty( $actions ) ) {
981 981
             return;
982 982
         }
983 983
 
984
-        asort($actions);
984
+        asort( $actions );
985 985
 
986 986
         global $wp_admin_bar;
987 987
 
988
-        if ( count($actions) == 1 ) {
988
+        if ( count( $actions ) == 1 ) {
989 989
             $wp_admin_bar->add_menu( array(
990 990
                 'title' => 'Edit Form',
991 991
 				'href'  => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . current( array_keys( $actions ) ) ),
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
         		$wp_admin_bar->add_menu( array(
1007 1007
         			'parent'    => 'frm-forms',
1008 1008
 					'id'        => 'edit_form_' . $form_id,
1009
-        			'title'     => empty($name) ? __( '(no title)') : $name,
1009
+        			'title'     => empty( $name ) ? __( '(no title)' ) : $name,
1010 1010
 					'href'      => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ),
1011 1011
         		) );
1012 1012
         	}
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
     //formidable shortcode
1017 1017
 	public static function get_form_shortcode( $atts ) {
1018 1018
         global $frm_vars;
1019
-        if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) {
1019
+        if ( isset( $frm_vars['skip_shortcode'] ) && $frm_vars['skip_shortcode'] ) {
1020 1020
             $sc = '[formidable';
1021 1021
 			if ( ! empty( $atts ) ) {
1022 1022
 				foreach ( $atts as $k => $v ) {
@@ -1030,8 +1030,8 @@  discard block
 block discarded – undo
1030 1030
             'id' => '', 'key' => '', 'title' => false, 'description' => false,
1031 1031
             'readonly' => false, 'entry_id' => false, 'fields' => array(),
1032 1032
             'exclude_fields' => array(), 'minimize' => false,
1033
-        ), $atts);
1034
-        do_action('formidable_shortcode_atts', $shortcode_atts, $atts);
1033
+        ), $atts );
1034
+        do_action( 'formidable_shortcode_atts', $shortcode_atts, $atts );
1035 1035
 
1036 1036
         return self::show_form(
1037 1037
             $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'],
@@ -1119,51 +1119,51 @@  discard block
 block discarded – undo
1119 1119
 
1120 1120
         $frm_settings = FrmAppHelper::get_settings();
1121 1121
 
1122
-        $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value;
1122
+        $submit = isset( $form->options['submit_value'] ) ? $form->options['submit_value'] : $frm_settings->submit_value;
1123 1123
 
1124 1124
         $user_ID = get_current_user_id();
1125 1125
 		$params = FrmForm::get_params( $form );
1126 1126
         $message = $errors = '';
1127 1127
 
1128 1128
         if ( $params['posted_form_id'] == $form->id && $_POST ) {
1129
-            $errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array();
1129
+            $errors = isset( $frm_vars['created_entries'][$form->id] ) ? $frm_vars['created_entries'][$form->id]['errors'] : array();
1130 1130
         }
1131 1131
 
1132 1132
 		$include_form_tag = apply_filters( 'frm_include_form_tag', true, $form );
1133 1133
         $fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) );
1134 1134
 
1135 1135
         if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) {
1136
-            do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
1137
-            if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) {
1138
-                $values = FrmEntriesHelper::setup_new_vars($fields, $form);
1136
+            do_action( 'frm_display_form_action', $params, $fields, $form, $title, $description );
1137
+            if ( apply_filters( 'frm_continue_to_new', true, $form->id, $params['action'] ) ) {
1138
+                $values = FrmEntriesHelper::setup_new_vars( $fields, $form );
1139 1139
 				include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' );
1140 1140
             }
1141 1141
             return;
1142 1142
         }
1143 1143
 
1144
-        if ( ! empty($errors) ) {
1145
-            $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array();
1144
+        if ( ! empty( $errors ) ) {
1145
+            $values = $fields ? FrmEntriesHelper::setup_new_vars( $fields, $form ) : array();
1146 1146
 			include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' );
1147 1147
             return;
1148 1148
         }
1149 1149
 
1150
-        do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
1151
-        if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) {
1150
+        do_action( 'frm_validate_form_creation', $params, $fields, $form, $title, $description );
1151
+        if ( ! apply_filters( 'frm_continue_to_create', true, $form->id ) ) {
1152 1152
             return;
1153 1153
         }
1154 1154
 
1155
-        $values = FrmEntriesHelper::setup_new_vars($fields, $form, true);
1156
-        $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0;
1157
-        $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create');
1155
+        $values = FrmEntriesHelper::setup_new_vars( $fields, $form, true );
1156
+        $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][$form->id] ) ) ? $frm_vars['created_entries'][$form->id]['entry_id'] : 0;
1157
+        $conf_method = apply_filters( 'frm_success_filter', 'message', $form, $form->options, 'create' );
1158 1158
 
1159
-        if ( $created && is_numeric($created) && $conf_method != 'message' ) {
1160
-            do_action('frm_success_action', $conf_method, $form, $form->options, $created);
1159
+        if ( $created && is_numeric( $created ) && $conf_method != 'message' ) {
1160
+            do_action( 'frm_success_action', $conf_method, $form, $form->options, $created );
1161 1161
 			do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
1162 1162
             return;
1163 1163
         }
1164 1164
 
1165
-        if ( $created && is_numeric($created) ) {
1166
-            $message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg;
1165
+        if ( $created && is_numeric( $created ) ) {
1166
+            $message = isset( $form->options['success_msg'] ) ? $form->options['success_msg'] : $frm_settings->success_msg;
1167 1167
             $class = 'frm_message';
1168 1168
         } else {
1169 1169
             $message = $frm_settings->failed_msg;
@@ -1174,9 +1174,9 @@  discard block
 block discarded – undo
1174 1174
 			'message' => $message, 'form' => $form,
1175 1175
 			'entry_id' => $created, 'class' => $class,
1176 1176
 		) );
1177
-        $message = apply_filters('frm_main_feedback', $message, $form, $created);
1177
+        $message = apply_filters( 'frm_main_feedback', $message, $form, $created );
1178 1178
 
1179
-        if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) {
1179
+        if ( ! isset( $form->options['show_form'] ) || $form->options['show_form'] ) {
1180 1180
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' );
1181 1181
         } else {
1182 1182
             global $frm_vars;
Please login to merge, or discard this patch.
Indentation   +596 added lines, -596 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmFormsController {
4 4
 
5
-    public static function menu() {
5
+	public static function menu() {
6 6
 		$menu_label = __( 'Forms', 'formidable' );
7 7
 		if ( ! FrmAppHelper::pro_is_installed() ) {
8 8
 			$menu_label .= ' (Lite)';
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 		add_submenu_page('formidable', 'Formidable | ' . $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' );
11 11
 
12 12
 		self::maybe_load_listing_hooks();
13
-    }
13
+	}
14 14
 
15 15
 	public static function maybe_load_listing_hooks() {
16 16
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
@@ -24,128 +24,128 @@  discard block
 block discarded – undo
24 24
 		add_filter('manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' );
25 25
 	}
26 26
 
27
-    public static function head() {
28
-        wp_enqueue_script('formidable-editinplace');
27
+	public static function head() {
28
+		wp_enqueue_script('formidable-editinplace');
29 29
 
30
-        if ( wp_is_mobile() ) {
31
-    		wp_enqueue_script( 'jquery-touch-punch' );
32
-    	}
33
-    }
30
+		if ( wp_is_mobile() ) {
31
+			wp_enqueue_script( 'jquery-touch-punch' );
32
+		}
33
+	}
34 34
 
35
-    public static function register_widgets() {
36
-        require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php');
37
-        register_widget('FrmShowForm');
38
-    }
35
+	public static function register_widgets() {
36
+		require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php');
37
+		register_widget('FrmShowForm');
38
+	}
39 39
 
40
-    public static function list_form() {
41
-        FrmAppHelper::permission_check('frm_view_forms');
40
+	public static function list_form() {
41
+		FrmAppHelper::permission_check('frm_view_forms');
42 42
 
43 43
 		$params = FrmForm::list_page_params();
44
-        $errors = self::process_bulk_form_actions( array());
45
-        $errors = apply_filters('frm_admin_list_form_action', $errors);
44
+		$errors = self::process_bulk_form_actions( array());
45
+		$errors = apply_filters('frm_admin_list_form_action', $errors);
46 46
 
47 47
 		return self::display_forms_list( $params, '', $errors );
48
-    }
48
+	}
49 49
 
50 50
 	public static function new_form( $values = array() ) {
51
-        FrmAppHelper::permission_check('frm_edit_forms');
51
+		FrmAppHelper::permission_check('frm_edit_forms');
52 52
 
53
-        global $frm_vars;
53
+		global $frm_vars;
54 54
 
55
-        $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
55
+		$action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
56 56
 		$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ];
57 57
 
58 58
 		if ( $action == 'create' ) {
59
-            return self::create($values);
59
+			return self::create($values);
60 60
 		} else if ( $action == 'new' ) {
61 61
 			$frm_field_selection = FrmField::field_selection();
62
-            $values = FrmFormsHelper::setup_new_vars($values);
63
-            $id = FrmForm::create( $values );
64
-            $form = FrmForm::getOne($id);
62
+			$values = FrmFormsHelper::setup_new_vars($values);
63
+			$id = FrmForm::create( $values );
64
+			$form = FrmForm::getOne($id);
65 65
 
66
-            // add default email notification
67
-            $action_control = FrmFormActionsController::get_form_actions( 'email' );
68
-            $action_control->create($form->id);
66
+			// add default email notification
67
+			$action_control = FrmFormActionsController::get_form_actions( 'email' );
68
+			$action_control->create($form->id);
69 69
 
70 70
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
71 71
 
72
-            $values['id'] = $id;
72
+			$values['id'] = $id;
73 73
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
74
-        }
75
-    }
74
+		}
75
+	}
76 76
 
77 77
 	public static function create( $values = array() ) {
78
-        FrmAppHelper::permission_check('frm_edit_forms');
78
+		FrmAppHelper::permission_check('frm_edit_forms');
79 79
 
80
-        global $frm_vars;
81
-        if ( empty( $values ) ) {
82
-            $values = $_POST;
83
-        }
80
+		global $frm_vars;
81
+		if ( empty( $values ) ) {
82
+			$values = $_POST;
83
+		}
84 84
 
85
-        //Set radio button and checkbox meta equal to "other" value
86
-        if ( FrmAppHelper::pro_is_installed() ) {
87
-            $values = FrmProEntry::mod_other_vals( $values, 'back' );
88
-        }
85
+		//Set radio button and checkbox meta equal to "other" value
86
+		if ( FrmAppHelper::pro_is_installed() ) {
87
+			$values = FrmProEntry::mod_other_vals( $values, 'back' );
88
+		}
89 89
 
90 90
 		$id = isset($values['id']) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
91 91
 
92
-        if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
93
-            $frm_settings = FrmAppHelper::get_settings();
94
-            $errors = array( 'form' => $frm_settings->admin_permission );
95
-        } else {
96
-            $errors = FrmForm::validate($values);
97
-        }
92
+		if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
93
+			$frm_settings = FrmAppHelper::get_settings();
94
+			$errors = array( 'form' => $frm_settings->admin_permission );
95
+		} else {
96
+			$errors = FrmForm::validate($values);
97
+		}
98 98
 
99
-        if ( count($errors) > 0 ) {
100
-            $hide_preview = true;
99
+		if ( count($errors) > 0 ) {
100
+			$hide_preview = true;
101 101
 			$frm_field_selection = FrmField::field_selection();
102
-            $form = FrmForm::getOne( $id );
103
-            $fields = FrmField::get_all_for_form($id);
102
+			$form = FrmForm::getOne( $id );
103
+			$fields = FrmField::get_all_for_form($id);
104 104
 
105
-            $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
105
+			$values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
106 106
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
107 107
 
108 108
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
109
-        } else {
110
-            FrmForm::update( $id, $values, true );
109
+		} else {
110
+			FrmForm::update( $id, $values, true );
111 111
 			$url = admin_url( 'admin.php?page=formidable&frm_action=settings&id=' . $id );
112 112
 			die( FrmAppHelper::js_redirect( $url ) );
113
-        }
114
-    }
113
+		}
114
+	}
115 115
 
116
-    public static function edit( $values = false ) {
117
-        FrmAppHelper::permission_check('frm_edit_forms');
116
+	public static function edit( $values = false ) {
117
+		FrmAppHelper::permission_check('frm_edit_forms');
118 118
 
119 119
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
120
-        return self::get_edit_vars($id);
121
-    }
120
+		return self::get_edit_vars($id);
121
+	}
122 122
 
123
-    public static function settings( $id = false, $message = '' ) {
124
-        FrmAppHelper::permission_check('frm_edit_forms');
123
+	public static function settings( $id = false, $message = '' ) {
124
+		FrmAppHelper::permission_check('frm_edit_forms');
125 125
 
126
-        if ( ! $id || ! is_numeric($id) ) {
126
+		if ( ! $id || ! is_numeric($id) ) {
127 127
 			$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
128
-        }
128
+		}
129 129
 		return self::get_settings_vars( $id, array(), $message );
130
-    }
130
+	}
131 131
 
132
-    public static function update_settings() {
133
-        FrmAppHelper::permission_check('frm_edit_forms');
132
+	public static function update_settings() {
133
+		FrmAppHelper::permission_check('frm_edit_forms');
134 134
 
135 135
 		$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
136 136
 
137
-        $errors = FrmForm::validate($_POST);
138
-        if ( count($errors) > 0 ) {
139
-            return self::get_settings_vars($id, $errors);
140
-        }
137
+		$errors = FrmForm::validate($_POST);
138
+		if ( count($errors) > 0 ) {
139
+			return self::get_settings_vars($id, $errors);
140
+		}
141 141
 
142
-        do_action('frm_before_update_form_settings', $id);
142
+		do_action('frm_before_update_form_settings', $id);
143 143
 
144 144
 		FrmForm::update( $id, $_POST );
145 145
 
146
-        $message = __( 'Settings Successfully Updated', 'formidable' );
146
+		$message = __( 'Settings Successfully Updated', 'formidable' );
147 147
 		return self::get_settings_vars( $id, array(), $message );
148
-    }
148
+	}
149 149
 
150 150
 	public static function edit_key() {
151 151
 		$values = self::edit_in_place_value( 'form_key' );
@@ -175,43 +175,43 @@  discard block
 block discarded – undo
175 175
 
176 176
 	public static function update( $values = array() ) {
177 177
 		if ( empty( $values ) ) {
178
-            $values = $_POST;
179
-        }
178
+			$values = $_POST;
179
+		}
180 180
 
181
-        //Set radio button and checkbox meta equal to "other" value
182
-        if ( FrmAppHelper::pro_is_installed() ) {
183
-            $values = FrmProEntry::mod_other_vals( $values, 'back' );
184
-        }
181
+		//Set radio button and checkbox meta equal to "other" value
182
+		if ( FrmAppHelper::pro_is_installed() ) {
183
+			$values = FrmProEntry::mod_other_vals( $values, 'back' );
184
+		}
185 185
 
186
-        $errors = FrmForm::validate( $values );
187
-        $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' );
188
-        if ( $permission_error !== false ) {
189
-            $errors['form'] = $permission_error;
190
-        }
186
+		$errors = FrmForm::validate( $values );
187
+		$permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' );
188
+		if ( $permission_error !== false ) {
189
+			$errors['form'] = $permission_error;
190
+		}
191 191
 
192 192
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
193 193
 
194 194
 		if ( count( $errors ) > 0 ) {
195
-            return self::get_edit_vars( $id, $errors );
195
+			return self::get_edit_vars( $id, $errors );
196 196
 		} else {
197
-            FrmForm::update( $id, $values );
198
-            $message = __( 'Form was Successfully Updated', 'formidable' );
199
-            if ( defined( 'DOING_AJAX' ) ) {
197
+			FrmForm::update( $id, $values );
198
+			$message = __( 'Form was Successfully Updated', 'formidable' );
199
+			if ( defined( 'DOING_AJAX' ) ) {
200 200
 				wp_die( $message );
201
-            }
201
+			}
202 202
 			return self::get_edit_vars( $id, array(), $message );
203
-        }
204
-    }
203
+		}
204
+	}
205 205
 
206
-    public static function bulk_create_template( $ids ) {
207
-        FrmAppHelper::permission_check( 'frm_edit_forms' );
206
+	public static function bulk_create_template( $ids ) {
207
+		FrmAppHelper::permission_check( 'frm_edit_forms' );
208 208
 
209
-        foreach ( $ids as $id ) {
210
-            FrmForm::duplicate( $id, true, true );
211
-        }
209
+		foreach ( $ids as $id ) {
210
+			FrmForm::duplicate( $id, true, true );
211
+		}
212 212
 
213
-        return __( 'Form template was Successfully Created', 'formidable' );
214
-    }
213
+		return __( 'Form template was Successfully Created', 'formidable' );
214
+	}
215 215
 
216 216
 	/**
217 217
 	 * Redirect to the url for creating from a template
@@ -233,45 +233,45 @@  discard block
 block discarded – undo
233 233
 		wp_die();
234 234
 	}
235 235
 
236
-    public static function duplicate() {
237
-        FrmAppHelper::permission_check('frm_edit_forms');
236
+	public static function duplicate() {
237
+		FrmAppHelper::permission_check('frm_edit_forms');
238 238
 
239 239
 		$params = FrmForm::list_page_params();
240
-        $form = FrmForm::duplicate( $params['id'], $params['template'], true );
241
-        $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
242
-        if ( $form ) {
240
+		$form = FrmForm::duplicate( $params['id'], $params['template'], true );
241
+		$message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
242
+		if ( $form ) {
243 243
 			return self::get_edit_vars( $form, array(), $message, true );
244
-        } else {
245
-            return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' ));
246
-        }
247
-    }
244
+		} else {
245
+			return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' ));
246
+		}
247
+	}
248 248
 
249
-    public static function page_preview() {
249
+	public static function page_preview() {
250 250
 		$params = FrmForm::list_page_params();
251
-        if ( ! $params['form'] ) {
252
-            return;
253
-        }
254
-
255
-        $form = FrmForm::getOne( $params['form'] );
256
-        if ( ! $form ) {
257
-            return;
258
-        }
259
-        return self::show_form( $form->id, '', true, true );
260
-    }
261
-
262
-    public static function preview() {
263
-        do_action( 'frm_wp' );
264
-
265
-        global $frm_vars;
266
-        $frm_vars['preview'] = true;
267
-
268
-        if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) {
269
-            global $wp;
270
-            $root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
251
+		if ( ! $params['form'] ) {
252
+			return;
253
+		}
254
+
255
+		$form = FrmForm::getOne( $params['form'] );
256
+		if ( ! $form ) {
257
+			return;
258
+		}
259
+		return self::show_form( $form->id, '', true, true );
260
+	}
261
+
262
+	public static function preview() {
263
+		do_action( 'frm_wp' );
264
+
265
+		global $frm_vars;
266
+		$frm_vars['preview'] = true;
267
+
268
+		if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) {
269
+			global $wp;
270
+			$root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
271 271
 			include_once( $root . '/wp-config.php' );
272
-            $wp->init();
273
-            $wp->register_globals();
274
-        }
272
+			$wp->init();
273
+			$wp->register_globals();
274
+		}
275 275
 
276 276
 		self::register_pro_scripts();
277 277
 
@@ -285,11 +285,11 @@  discard block
 block discarded – undo
285 285
 		$form = FrmForm::getAll( array( 'form_key' => $key ), '', 1 );
286 286
 		if ( empty( $form ) ) {
287 287
 			$form = FrmForm::getAll( array(), '', 1 );
288
-        }
288
+		}
289 289
 
290 290
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php' );
291
-        wp_die();
292
-    }
291
+		wp_die();
292
+	}
293 293
 
294 294
 	public static function register_pro_scripts() {
295 295
 		if ( FrmAppHelper::pro_is_installed() ) {
@@ -299,22 +299,22 @@  discard block
 block discarded – undo
299 299
 		}
300 300
 	}
301 301
 
302
-    public static function untrash() {
302
+	public static function untrash() {
303 303
 		self::change_form_status( 'untrash' );
304
-    }
304
+	}
305 305
 
306 306
 	public static function bulk_untrash( $ids ) {
307
-        FrmAppHelper::permission_check('frm_edit_forms');
307
+		FrmAppHelper::permission_check('frm_edit_forms');
308 308
 
309
-        $count = FrmForm::set_status( $ids, 'published' );
309
+		$count = FrmForm::set_status( $ids, 'published' );
310 310
 
311
-        $message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
312
-        return $message;
313
-    }
311
+		$message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
312
+		return $message;
313
+	}
314 314
 
315
-    public static function trash() {
315
+	public static function trash() {
316 316
 		self::change_form_status( 'trash' );
317
-    }
317
+	}
318 318
 
319 319
 	/**
320 320
 	 * @param string $status
@@ -352,68 +352,68 @@  discard block
 block discarded – undo
352 352
 	}
353 353
 
354 354
 	public static function bulk_trash( $ids ) {
355
-        FrmAppHelper::permission_check('frm_delete_forms');
355
+		FrmAppHelper::permission_check('frm_delete_forms');
356 356
 
357
-        $count = 0;
358
-        foreach ( $ids as $id ) {
359
-            if ( FrmForm::trash( $id ) ) {
360
-                $count++;
361
-            }
362
-        }
357
+		$count = 0;
358
+		foreach ( $ids as $id ) {
359
+			if ( FrmForm::trash( $id ) ) {
360
+				$count++;
361
+			}
362
+		}
363 363
 
364
-        $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
364
+		$current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
365 365
 		$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>' );
366 366
 
367
-        return $message;
368
-    }
367
+		return $message;
368
+	}
369 369
 
370
-    public static function destroy() {
371
-        FrmAppHelper::permission_check('frm_delete_forms');
370
+	public static function destroy() {
371
+		FrmAppHelper::permission_check('frm_delete_forms');
372 372
 
373 373
 		$params = FrmForm::list_page_params();
374 374
 
375
-        //check nonce url
376
-        check_admin_referer('destroy_form_' . $params['id']);
375
+		//check nonce url
376
+		check_admin_referer('destroy_form_' . $params['id']);
377 377
 
378
-        $count = 0;
379
-        if ( FrmForm::destroy( $params['id'] ) ) {
380
-            $count++;
381
-        }
378
+		$count = 0;
379
+		if ( FrmForm::destroy( $params['id'] ) ) {
380
+			$count++;
381
+		}
382 382
 
383
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
383
+		$message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
384 384
 
385 385
 		self::display_forms_list( $params, $message );
386
-    }
386
+	}
387 387
 
388 388
 	public static function bulk_destroy( $ids ) {
389
-        FrmAppHelper::permission_check('frm_delete_forms');
389
+		FrmAppHelper::permission_check('frm_delete_forms');
390 390
 
391
-        $count = 0;
392
-        foreach ( $ids as $id ) {
393
-            $d = FrmForm::destroy( $id );
394
-            if ( $d ) {
395
-                $count++;
396
-            }
397
-        }
391
+		$count = 0;
392
+		foreach ( $ids as $id ) {
393
+			$d = FrmForm::destroy( $id );
394
+			if ( $d ) {
395
+				$count++;
396
+			}
397
+		}
398 398
 
399
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
399
+		$message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
400 400
 
401
-        return $message;
402
-    }
401
+		return $message;
402
+	}
403 403
 
404
-    private static function delete_all() {
405
-        //check nonce url
406
-        $permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable');
407
-        if ( $permission_error !== false ) {
404
+	private static function delete_all() {
405
+		//check nonce url
406
+		$permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable');
407
+		if ( $permission_error !== false ) {
408 408
 			self::display_forms_list( array(), '', array( $permission_error ) );
409
-            return;
410
-        }
409
+			return;
410
+		}
411 411
 
412 412
 		$count = FrmForm::scheduled_delete( time() );
413
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
413
+		$message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
414 414
 
415 415
 		self::display_forms_list( array(), $message );
416
-    }
416
+	}
417 417
 
418 418
 	public static function scheduled_delete( $delete_timestamp = '' ) {
419 419
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::scheduled_delete' );
@@ -421,11 +421,11 @@  discard block
 block discarded – undo
421 421
 	}
422 422
 
423 423
 	/**
424
-	* Inserts Formidable button
425
-	* Hook exists since 2.5.0
426
-	*
427
-	* @since 2.0.15
428
-	*/
424
+	 * Inserts Formidable button
425
+	 * Hook exists since 2.5.0
426
+	 *
427
+	 * @since 2.0.15
428
+	 */
429 429
 	public static function insert_form_button() {
430 430
 		if ( current_user_can('frm_view_forms') ) {
431 431
 			$menu_name = FrmAppHelper::get_menu_name();
@@ -436,49 +436,49 @@  discard block
 block discarded – undo
436 436
 		}
437 437
 	}
438 438
 
439
-    public static function insert_form_popup() {
439
+	public static function insert_form_popup() {
440 440
 		$page = basename( FrmAppHelper::get_server_value( 'PHP_SELF' ) );
441 441
 		if ( ! in_array( $page, array( 'post.php', 'page.php', 'page-new.php', 'post-new.php' ) ) ) {
442
-            return;
443
-        }
442
+			return;
443
+		}
444 444
 
445
-        FrmAppHelper::load_admin_wide_js();
445
+		FrmAppHelper::load_admin_wide_js();
446 446
 
447
-        $shortcodes = array(
447
+		$shortcodes = array(
448 448
 			'formidable' => array( 'name' => __( 'Form', 'formidable' ), 'label' => __( 'Insert a Form', 'formidable' ) ),
449
-        );
449
+		);
450 450
 
451
-        $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes);
451
+		$shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes);
452 452
 
453 453
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/insert_form_popup.php' );
454
-    }
454
+	}
455 455
 
456
-    public static function get_shortcode_opts() {
456
+	public static function get_shortcode_opts() {
457 457
 		FrmAppHelper::permission_check('frm_view_forms');
458
-        check_ajax_referer( 'frm_ajax', 'nonce' );
458
+		check_ajax_referer( 'frm_ajax', 'nonce' );
459 459
 
460 460
 		$shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' );
461
-        if ( empty($shortcode) ) {
462
-            wp_die();
463
-        }
461
+		if ( empty($shortcode) ) {
462
+			wp_die();
463
+		}
464 464
 
465 465
 		echo '<div id="sc-opts-' . esc_attr( $shortcode ) . '" class="frm_shortcode_option">';
466 466
 		echo '<input type="radio" name="frmsc" value="' . esc_attr( $shortcode ) . '" id="sc-' . esc_attr( $shortcode ) . '" class="frm_hidden" />';
467 467
 
468
-        $form_id = '';
469
-        $opts = array();
468
+		$form_id = '';
469
+		$opts = array();
470 470
 		switch ( $shortcode ) {
471
-            case 'formidable':
472
-                $opts = array(
471
+			case 'formidable':
472
+				$opts = array(
473 473
 					'form_id'       => 'id',
474
-                    //'key' => ',
474
+					//'key' => ',
475 475
 					'title'         => array( 'val' => 1, 'label' => __( 'Display form title', 'formidable' ) ),
476 476
 					'description'   => array( 'val' => 1, 'label' => __( 'Display form description', 'formidable' ) ),
477 477
 					'minimize'      => array( 'val' => 1, 'label' => __( 'Minimize form HTML', 'formidable' ) ),
478
-                );
479
-            break;
480
-        }
481
-        $opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode);
478
+				);
479
+			break;
480
+		}
481
+		$opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode);
482 482
 
483 483
 		if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) {
484 484
 			// allow other shortcodes to use the required form id option
@@ -488,61 +488,61 @@  discard block
 block discarded – undo
488 488
 
489 489
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/shortcode_opts.php' );
490 490
 
491
-        echo '</div>';
491
+		echo '</div>';
492 492
 
493
-        wp_die();
494
-    }
493
+		wp_die();
494
+	}
495 495
 
496 496
 	public static function display_forms_list( $params = array(), $message = '', $errors = array(), $deprecated_errors = array() ) {
497
-        FrmAppHelper::permission_check( 'frm_view_forms' );
497
+		FrmAppHelper::permission_check( 'frm_view_forms' );
498 498
 		if ( ! empty( $deprecated_errors ) ) {
499 499
 			$errors = $deprecated_errors;
500 500
 			_deprecated_argument( 'errors', '2.0.8' );
501 501
 		}
502 502
 
503
-        global $wpdb, $frm_vars;
503
+		global $wpdb, $frm_vars;
504 504
 
505 505
 		if ( empty( $params ) ) {
506 506
 			$params = FrmForm::list_page_params();
507
-        }
507
+		}
508 508
 
509
-        $wp_list_table = new FrmFormsListHelper( compact( 'params' ) );
509
+		$wp_list_table = new FrmFormsListHelper( compact( 'params' ) );
510 510
 
511
-        $pagenum = $wp_list_table->get_pagenum();
511
+		$pagenum = $wp_list_table->get_pagenum();
512 512
 
513
-        $wp_list_table->prepare_items();
513
+		$wp_list_table->prepare_items();
514 514
 
515
-        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
516
-        if ( $pagenum > $total_pages && $total_pages > 0 ) {
515
+		$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
516
+		if ( $pagenum > $total_pages && $total_pages > 0 ) {
517 517
 			wp_redirect( esc_url_raw( add_query_arg( 'paged', $total_pages ) ) );
518
-            die();
519
-        }
518
+			die();
519
+		}
520 520
 
521 521
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list.php' );
522
-    }
522
+	}
523 523
 
524 524
 	public static function get_columns( $columns ) {
525
-	    $columns['cb'] = '<input type="checkbox" />';
526
-	    $columns['id'] = 'ID';
525
+		$columns['cb'] = '<input type="checkbox" />';
526
+		$columns['id'] = 'ID';
527 527
 
528
-        $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : 'published';
528
+		$type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : 'published';
529 529
 
530
-        if ( 'template' == $type ) {
531
-            $columns['name']        = __( 'Template Name', 'formidable' );
532
-            $columns['type']        = __( 'Type', 'formidable' );
533
-            $columns['form_key']    = __( 'Key', 'formidable' );
534
-        } else {
535
-            $columns['name']        = __( 'Form Title', 'formidable' );
536
-            $columns['entries']     = __( 'Entries', 'formidable' );
537
-            $columns['form_key']    = __( 'Key', 'formidable' );
538
-            $columns['shortcode']   = __( 'Shortcodes', 'formidable' );
539
-        }
530
+		if ( 'template' == $type ) {
531
+			$columns['name']        = __( 'Template Name', 'formidable' );
532
+			$columns['type']        = __( 'Type', 'formidable' );
533
+			$columns['form_key']    = __( 'Key', 'formidable' );
534
+		} else {
535
+			$columns['name']        = __( 'Form Title', 'formidable' );
536
+			$columns['entries']     = __( 'Entries', 'formidable' );
537
+			$columns['form_key']    = __( 'Key', 'formidable' );
538
+			$columns['shortcode']   = __( 'Shortcodes', 'formidable' );
539
+		}
540 540
 
541
-        $columns['created_at'] = __( 'Date', 'formidable' );
541
+		$columns['created_at'] = __( 'Date', 'formidable' );
542 542
 
543 543
 		add_screen_option( 'per_page', array( 'label' => __( 'Forms', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_per_page' ) );
544 544
 
545
-        return $columns;
545
+		return $columns;
546 546
 	}
547 547
 
548 548
 	public static function get_sortable_columns() {
@@ -556,110 +556,110 @@  discard block
 block discarded – undo
556 556
 	}
557 557
 
558 558
 	public static function hidden_columns( $result ) {
559
-        $return = false;
560
-        foreach ( (array) $result as $r ) {
561
-            if ( ! empty( $r ) ) {
562
-                $return = true;
563
-                break;
564
-            }
565
-        }
559
+		$return = false;
560
+		foreach ( (array) $result as $r ) {
561
+			if ( ! empty( $r ) ) {
562
+				$return = true;
563
+				break;
564
+			}
565
+		}
566 566
 
567
-        if ( $return ) {
568
-            return $result;
567
+		if ( $return ) {
568
+			return $result;
569 569
 		}
570 570
 
571
-        $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
571
+		$type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
572 572
 
573
-        $result[] = 'created_at';
574
-        if ( $type == 'template' ) {
575
-            $result[] = 'id';
576
-            $result[] = 'form_key';
577
-        }
573
+		$result[] = 'created_at';
574
+		if ( $type == 'template' ) {
575
+			$result[] = 'id';
576
+			$result[] = 'form_key';
577
+		}
578 578
 
579
-        return $result;
580
-    }
579
+		return $result;
580
+	}
581 581
 
582 582
 	public static function save_per_page( $save, $option, $value ) {
583
-        if ( $option == 'formidable_page_formidable_per_page' ) {
584
-            $save = (int) $value;
585
-        }
586
-        return $save;
587
-    }
583
+		if ( $option == 'formidable_page_formidable_per_page' ) {
584
+			$save = (int) $value;
585
+		}
586
+		return $save;
587
+	}
588 588
 
589 589
 	private static function get_edit_vars( $id, $errors = array(), $message = '', $create_link = false ) {
590
-        global $frm_vars;
590
+		global $frm_vars;
591 591
 
592
-        $form = FrmForm::getOne( $id );
593
-        if ( ! $form ) {
594
-            wp_die( __( 'You are trying to edit a form that does not exist.', 'formidable' ) );
595
-        }
592
+		$form = FrmForm::getOne( $id );
593
+		if ( ! $form ) {
594
+			wp_die( __( 'You are trying to edit a form that does not exist.', 'formidable' ) );
595
+		}
596 596
 
597
-        if ( $form->parent_form_id ) {
597
+		if ( $form->parent_form_id ) {
598 598
 			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>' ));
599
-        }
599
+		}
600 600
 
601 601
 		$frm_field_selection = FrmField::field_selection();
602
-        $fields = FrmField::get_all_for_form($form->id);
602
+		$fields = FrmField::get_all_for_form($form->id);
603 603
 
604
-        // Automatically add end section fields if they don't exist (2.0 migration)
605
-        $reset_fields = false;
606
-        FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields );
604
+		// Automatically add end section fields if they don't exist (2.0 migration)
605
+		$reset_fields = false;
606
+		FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields );
607 607
 
608
-        if ( $reset_fields ) {
609
-            $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
610
-        }
608
+		if ( $reset_fields ) {
609
+			$fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
610
+		}
611 611
 
612
-        unset($end_section_values, $last_order, $open, $reset_fields);
612
+		unset($end_section_values, $last_order, $open, $reset_fields);
613 613
 
614
-        $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
614
+		$values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
615 615
 
616
-        $edit_message = __( 'Form was Successfully Updated', 'formidable' );
617
-        if ( $form->is_template && $message == $edit_message ) {
618
-            $message = __( 'Template was Successfully Updated', 'formidable' );
619
-        }
616
+		$edit_message = __( 'Form was Successfully Updated', 'formidable' );
617
+		if ( $form->is_template && $message == $edit_message ) {
618
+			$message = __( 'Template was Successfully Updated', 'formidable' );
619
+		}
620 620
 
621 621
 		$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
622 622
 
623
-        if ( $form->default_template ) {
624
-            wp_die(__( 'That template cannot be edited', 'formidable' ));
625
-        } else if ( defined('DOING_AJAX') ) {
626
-            wp_die();
627
-        } else if ( $create_link ) {
623
+		if ( $form->default_template ) {
624
+			wp_die(__( 'That template cannot be edited', 'formidable' ));
625
+		} else if ( defined('DOING_AJAX') ) {
626
+			wp_die();
627
+		} else if ( $create_link ) {
628 628
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
629
-        } else {
629
+		} else {
630 630
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/edit.php' );
631
-        }
632
-    }
631
+		}
632
+	}
633 633
 
634 634
 	public static function get_settings_vars( $id, $errors = array(), $message = '' ) {
635 635
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
636 636
 
637
-        global $frm_vars;
637
+		global $frm_vars;
638 638
 
639
-        $form = FrmForm::getOne( $id );
639
+		$form = FrmForm::getOne( $id );
640 640
 
641
-        $fields = FrmField::get_all_for_form($id);
642
-        $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
641
+		$fields = FrmField::get_all_for_form($id);
642
+		$values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
643 643
 
644
-        if ( isset($values['default_template']) && $values['default_template'] ) {
645
-            wp_die(__( 'That template cannot be edited', 'formidable' ));
646
-        }
644
+		if ( isset($values['default_template']) && $values['default_template'] ) {
645
+			wp_die(__( 'That template cannot be edited', 'formidable' ));
646
+		}
647 647
 
648
-        $action_controls = FrmFormActionsController::get_form_actions();
648
+		$action_controls = FrmFormActionsController::get_form_actions();
649 649
 
650
-        $sections = apply_filters('frm_add_form_settings_section', array(), $values);
651
-        $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
650
+		$sections = apply_filters('frm_add_form_settings_section', array(), $values);
651
+		$pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
652 652
 
653
-        $styles = apply_filters('frm_get_style_opts', array());
653
+		$styles = apply_filters('frm_get_style_opts', array());
654 654
 
655 655
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings.php' );
656
-    }
656
+	}
657 657
 
658
-    public static function mb_tags_box( $form_id, $class = '' ) {
659
-        $fields = FrmField::get_all_for_form($form_id, '', 'include');
660
-        $linked_forms = array();
661
-        $col = 'one';
662
-        $settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false;
658
+	public static function mb_tags_box( $form_id, $class = '' ) {
659
+		$fields = FrmField::get_all_for_form($form_id, '', 'include');
660
+		$linked_forms = array();
661
+		$col = 'one';
662
+		$settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false;
663 663
 
664 664
 		$cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() );
665 665
 		$adv_shortcodes = self::get_advanced_shortcodes();
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 		$entry_shortcodes = self::get_shortcode_helpers( $settings_tab );
668 668
 
669 669
 		include( FrmAppHelper::plugin_path() . '/classes/views/shared/mb_adv_info.php' );
670
-    }
670
+	}
671 671
 
672 672
 	/**
673 673
 	 * Get an array of the options to display in the advanced tab
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 			''          => '',
709 709
 			'siteurl'   => __( 'Site URL', 'formidable' ),
710 710
 			'sitename'  => __( 'Site Name', 'formidable' ),
711
-        );
711
+		);
712 712
 
713 713
 		if ( ! FrmAppHelper::pro_is_installed() ) {
714 714
 			unset( $entry_shortcodes['post_id'] );
@@ -735,39 +735,39 @@  discard block
 block discarded – undo
735 735
 		return $entry_shortcodes;
736 736
 	}
737 737
 
738
-    // Insert the form class setting into the form
738
+	// Insert the form class setting into the form
739 739
 	public static function form_classes( $form ) {
740
-        if ( isset($form->options['form_class']) ) {
740
+		if ( isset($form->options['form_class']) ) {
741 741
 			echo esc_attr( sanitize_text_field( $form->options['form_class'] ) );
742
-        }
743
-    }
742
+		}
743
+	}
744 744
 
745
-    public static function get_email_html() {
745
+	public static function get_email_html() {
746 746
 		FrmAppHelper::permission_check('frm_view_forms');
747
-        check_ajax_referer( 'frm_ajax', 'nonce' );
747
+		check_ajax_referer( 'frm_ajax', 'nonce' );
748 748
 		echo FrmEntryFormat::show_entry( array(
749 749
 			'form_id'       => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ),
750
-	        'default_email' => true,
750
+			'default_email' => true,
751 751
 			'plain_text'    => FrmAppHelper::get_post_param( 'plain_text', '', 'absint' ),
752
-	    ) );
753
-	    wp_die();
752
+		) );
753
+		wp_die();
754 754
 	}
755 755
 
756
-    public static function filter_content( $content, $form, $entry = false ) {
756
+	public static function filter_content( $content, $form, $entry = false ) {
757 757
 		self::get_entry_by_param( $entry );
758
-        if ( ! $entry ) {
759
-            return $content;
760
-        }
758
+		if ( ! $entry ) {
759
+			return $content;
760
+		}
761 761
 
762
-        if ( is_object( $form ) ) {
763
-            $form = $form->id;
764
-        }
762
+		if ( is_object( $form ) ) {
763
+			$form = $form->id;
764
+		}
765 765
 
766
-        $shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form );
767
-        $content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes );
766
+		$shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form );
767
+		$content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes );
768 768
 
769
-        return $content;
770
-    }
769
+		return $content;
770
+	}
771 771
 
772 772
 	private static function get_entry_by_param( &$entry ) {
773 773
 		if ( ! $entry || ! is_object( $entry ) ) {
@@ -779,287 +779,287 @@  discard block
 block discarded – undo
779 779
 		}
780 780
 	}
781 781
 
782
-    public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
783
-        return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes );
784
-    }
782
+	public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
783
+		return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes );
784
+	}
785 785
 
786
-    public static function process_bulk_form_actions( $errors ) {
787
-        if ( ! $_REQUEST ) {
788
-            return $errors;
789
-        }
786
+	public static function process_bulk_form_actions( $errors ) {
787
+		if ( ! $_REQUEST ) {
788
+			return $errors;
789
+		}
790 790
 
791 791
 		$bulkaction = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
792
-        if ( $bulkaction == -1 ) {
792
+		if ( $bulkaction == -1 ) {
793 793
 			$bulkaction = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
794
-        }
795
-
796
-        if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) {
797
-            FrmAppHelper::remove_get_action();
798
-
799
-            $bulkaction = str_replace( 'bulk_', '', $bulkaction );
800
-        }
801
-
802
-        $ids = FrmAppHelper::get_param( 'item-action', '' );
803
-        if ( empty( $ids ) ) {
804
-            $errors[] = __( 'No forms were specified', 'formidable' );
805
-            return $errors;
806
-        }
807
-
808
-        $permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' );
809
-        if ( $permission_error !== false ) {
810
-            $errors[] = $permission_error;
811
-            return $errors;
812
-        }
813
-
814
-        if ( ! is_array( $ids ) ) {
815
-            $ids = explode( ',', $ids );
816
-        }
817
-
818
-        switch ( $bulkaction ) {
819
-            case 'delete':
820
-                $message = self::bulk_destroy( $ids );
821
-            break;
822
-            case 'trash':
823
-                $message = self::bulk_trash( $ids );
824
-            break;
825
-            case 'untrash':
826
-                $message = self::bulk_untrash( $ids );
827
-            break;
828
-            case 'create_template':
829
-                $message = self::bulk_create_template( $ids );
830
-            break;
831
-        }
832
-
833
-        if ( isset( $message ) && ! empty( $message ) ) {
794
+		}
795
+
796
+		if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) {
797
+			FrmAppHelper::remove_get_action();
798
+
799
+			$bulkaction = str_replace( 'bulk_', '', $bulkaction );
800
+		}
801
+
802
+		$ids = FrmAppHelper::get_param( 'item-action', '' );
803
+		if ( empty( $ids ) ) {
804
+			$errors[] = __( 'No forms were specified', 'formidable' );
805
+			return $errors;
806
+		}
807
+
808
+		$permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' );
809
+		if ( $permission_error !== false ) {
810
+			$errors[] = $permission_error;
811
+			return $errors;
812
+		}
813
+
814
+		if ( ! is_array( $ids ) ) {
815
+			$ids = explode( ',', $ids );
816
+		}
817
+
818
+		switch ( $bulkaction ) {
819
+			case 'delete':
820
+				$message = self::bulk_destroy( $ids );
821
+			break;
822
+			case 'trash':
823
+				$message = self::bulk_trash( $ids );
824
+			break;
825
+			case 'untrash':
826
+				$message = self::bulk_untrash( $ids );
827
+			break;
828
+			case 'create_template':
829
+				$message = self::bulk_create_template( $ids );
830
+			break;
831
+		}
832
+
833
+		if ( isset( $message ) && ! empty( $message ) ) {
834 834
 			echo '<div id="message" class="updated frm_msg_padding">' . FrmAppHelper::kses( $message ) . '</div>';
835
-        }
835
+		}
836 836
 
837
-        return $errors;
838
-    }
837
+		return $errors;
838
+	}
839 839
 
840
-    public static function add_default_templates( $path, $default = true, $template = true ) {
841
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' );
840
+	public static function add_default_templates( $path, $default = true, $template = true ) {
841
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' );
842 842
 
843
-        $path = untrailingslashit(trim($path));
843
+		$path = untrailingslashit(trim($path));
844 844
 		$templates = glob( $path . '/*.php' );
845 845
 
846 846
 		for ( $i = count( $templates ) - 1; $i >= 0; $i-- ) {
847 847
 			$filename = str_replace( '.php', '', str_replace( $path . '/', '', $templates[ $i ] ) );
848 848
 			$template_query = array( 'form_key' => $filename );
849
-            if ( $template ) {
850
-                $template_query['is_template'] = 1;
851
-            }
852
-            if ( $default ) {
853
-                $template_query['default_template'] = 1;
854
-            }
849
+			if ( $template ) {
850
+				$template_query['is_template'] = 1;
851
+			}
852
+			if ( $default ) {
853
+				$template_query['default_template'] = 1;
854
+			}
855 855
 			$form = FrmForm::getAll( $template_query, '', 1 );
856 856
 
857
-            $values = FrmFormsHelper::setup_new_vars();
858
-            $values['form_key'] = $filename;
859
-            $values['is_template'] = $template;
860
-            $values['status'] = 'published';
861
-            if ( $default ) {
862
-                $values['default_template'] = 1;
863
-            }
864
-
865
-            include( $templates[ $i ] );
866
-
867
-            //get updated form
868
-            if ( isset($form) && ! empty($form) ) {
869
-                $old_id = $form->id;
870
-                $form = FrmForm::getOne($form->id);
871
-            } else {
872
-                $old_id = false;
857
+			$values = FrmFormsHelper::setup_new_vars();
858
+			$values['form_key'] = $filename;
859
+			$values['is_template'] = $template;
860
+			$values['status'] = 'published';
861
+			if ( $default ) {
862
+				$values['default_template'] = 1;
863
+			}
864
+
865
+			include( $templates[ $i ] );
866
+
867
+			//get updated form
868
+			if ( isset($form) && ! empty($form) ) {
869
+				$old_id = $form->id;
870
+				$form = FrmForm::getOne($form->id);
871
+			} else {
872
+				$old_id = false;
873 873
 				$form = FrmForm::getAll( $template_query, '', 1 );
874
-            }
874
+			}
875 875
 
876
-            if ( $form ) {
876
+			if ( $form ) {
877 877
 				do_action( 'frm_after_duplicate_form', $form->id, (array) $form, array( 'old_id' => $old_id ) );
878
-            }
879
-        }
880
-    }
878
+			}
879
+		}
880
+	}
881 881
 
882
-    public static function route() {
883
-        $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
884
-        $vars = array();
882
+	public static function route() {
883
+		$action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
884
+		$vars = array();
885 885
 		if ( isset( $_POST['frm_compact_fields'] ) ) {
886 886
 			FrmAppHelper::permission_check( 'frm_edit_forms' );
887 887
 
888
-            $json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('&quot;', '\\\"', $_POST['frm_compact_fields'] ))));
889
-            $json_vars = json_decode($json_vars, true);
890
-            if ( empty($json_vars) ) {
891
-                // json decoding failed so we should return an error message
888
+			$json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('&quot;', '\\\"', $_POST['frm_compact_fields'] ))));
889
+			$json_vars = json_decode($json_vars, true);
890
+			if ( empty($json_vars) ) {
891
+				// json decoding failed so we should return an error message
892 892
 				$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
893
-                if ( 'edit' == $action ) {
894
-                    $action = 'update';
895
-                }
896
-
897
-                add_filter('frm_validate_form', 'FrmFormsController::json_error');
898
-            } else {
899
-                $vars = FrmAppHelper::json_to_array($json_vars);
900
-                $action = $vars[ $action ];
893
+				if ( 'edit' == $action ) {
894
+					$action = 'update';
895
+				}
896
+
897
+				add_filter('frm_validate_form', 'FrmFormsController::json_error');
898
+			} else {
899
+				$vars = FrmAppHelper::json_to_array($json_vars);
900
+				$action = $vars[ $action ];
901 901
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] );
902 902
 				$_REQUEST = array_merge( $_REQUEST, $vars );
903 903
 				$_POST = array_merge( $_POST, $_REQUEST );
904
-            }
905
-        } else {
904
+			}
905
+		} else {
906 906
 			$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
907
-    		if ( isset( $_REQUEST['delete_all'] ) ) {
908
-                // override the action for this page
909
-    			$action = 'delete_all';
910
-            }
911
-        }
907
+			if ( isset( $_REQUEST['delete_all'] ) ) {
908
+				// override the action for this page
909
+				$action = 'delete_all';
910
+			}
911
+		}
912 912
 
913 913
 		add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' );
914
-        FrmAppHelper::trigger_hook_load( 'form' );
915
-
916
-        switch ( $action ) {
917
-            case 'new':
918
-                return self::new_form($vars);
919
-            case 'create':
920
-            case 'edit':
921
-            case 'update':
922
-            case 'duplicate':
923
-            case 'trash':
924
-            case 'untrash':
925
-            case 'destroy':
926
-            case 'delete_all':
927
-            case 'settings':
928
-            case 'update_settings':
914
+		FrmAppHelper::trigger_hook_load( 'form' );
915
+
916
+		switch ( $action ) {
917
+			case 'new':
918
+				return self::new_form($vars);
919
+			case 'create':
920
+			case 'edit':
921
+			case 'update':
922
+			case 'duplicate':
923
+			case 'trash':
924
+			case 'untrash':
925
+			case 'destroy':
926
+			case 'delete_all':
927
+			case 'settings':
928
+			case 'update_settings':
929 929
 				return self::$action( $vars );
930
-            default:
930
+			default:
931 931
 				do_action( 'frm_form_action_' . $action );
932 932
 				if ( apply_filters( 'frm_form_stop_action_' . $action, false ) ) {
933
-                    return;
934
-                }
933
+					return;
934
+				}
935 935
 
936 936
 				$action = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
937
-                if ( $action == -1 ) {
937
+				if ( $action == -1 ) {
938 938
 					$action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
939
-                }
939
+				}
940 940
 
941
-                if ( strpos($action, 'bulk_') === 0 ) {
942
-                    FrmAppHelper::remove_get_action();
943
-                    return self::list_form();
944
-                }
941
+				if ( strpos($action, 'bulk_') === 0 ) {
942
+					FrmAppHelper::remove_get_action();
943
+					return self::list_form();
944
+				}
945 945
 
946
-                return self::display_forms_list();
947
-        }
948
-    }
946
+				return self::display_forms_list();
947
+		}
948
+	}
949 949
 
950
-    public static function json_error( $errors ) {
951
-        $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
952
-        return $errors;
953
-    }
950
+	public static function json_error( $errors ) {
951
+		$errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
952
+		return $errors;
953
+	}
954 954
 
955 955
 
956
-    /* FRONT-END FORMS */
957
-    public static function admin_bar_css() {
956
+	/* FRONT-END FORMS */
957
+	public static function admin_bar_css() {
958 958
 		if ( is_admin() || ! current_user_can( 'frm_edit_forms' ) ) {
959
-            return;
960
-        }
959
+			return;
960
+		}
961 961
 
962 962
 		add_action( 'wp_before_admin_bar_render', 'FrmFormsController::admin_bar_configure' );
963 963
 		FrmAppHelper::load_font_style();
964 964
 	}
965 965
 
966 966
 	public static function admin_bar_configure() {
967
-        global $frm_vars;
968
-        if ( empty($frm_vars['forms_loaded']) ) {
969
-            return;
970
-        }
971
-
972
-        $actions = array();
973
-        foreach ( $frm_vars['forms_loaded'] as $form ) {
974
-            if ( is_object($form) ) {
975
-                $actions[ $form->id ] = $form->name;
976
-            }
977
-            unset($form);
978
-        }
979
-
980
-        if ( empty($actions) ) {
981
-            return;
982
-        }
983
-
984
-        asort($actions);
985
-
986
-        global $wp_admin_bar;
987
-
988
-        if ( count($actions) == 1 ) {
989
-            $wp_admin_bar->add_menu( array(
990
-                'title' => 'Edit Form',
967
+		global $frm_vars;
968
+		if ( empty($frm_vars['forms_loaded']) ) {
969
+			return;
970
+		}
971
+
972
+		$actions = array();
973
+		foreach ( $frm_vars['forms_loaded'] as $form ) {
974
+			if ( is_object($form) ) {
975
+				$actions[ $form->id ] = $form->name;
976
+			}
977
+			unset($form);
978
+		}
979
+
980
+		if ( empty($actions) ) {
981
+			return;
982
+		}
983
+
984
+		asort($actions);
985
+
986
+		global $wp_admin_bar;
987
+
988
+		if ( count($actions) == 1 ) {
989
+			$wp_admin_bar->add_menu( array(
990
+				'title' => 'Edit Form',
991 991
 				'href'  => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . current( array_keys( $actions ) ) ),
992
-                'id'    => 'frm-forms',
993
-            ) );
994
-        } else {
995
-            $wp_admin_bar->add_menu( array(
996
-        		'id'    => 'frm-forms',
997
-        		'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>',
992
+				'id'    => 'frm-forms',
993
+			) );
994
+		} else {
995
+			$wp_admin_bar->add_menu( array(
996
+				'id'    => 'frm-forms',
997
+				'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>',
998 998
 				'href'  => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . current( array_keys( $actions ) ) ),
999
-        		'meta'  => array(
999
+				'meta'  => array(
1000 1000
 					'title' => __( 'Edit Forms', 'formidable' ),
1001
-        		),
1002
-        	) );
1001
+				),
1002
+			) );
1003 1003
 
1004
-        	foreach ( $actions as $form_id => $name ) {
1004
+			foreach ( $actions as $form_id => $name ) {
1005 1005
 
1006
-        		$wp_admin_bar->add_menu( array(
1007
-        			'parent'    => 'frm-forms',
1006
+				$wp_admin_bar->add_menu( array(
1007
+					'parent'    => 'frm-forms',
1008 1008
 					'id'        => 'edit_form_' . $form_id,
1009
-        			'title'     => empty($name) ? __( '(no title)') : $name,
1009
+					'title'     => empty($name) ? __( '(no title)') : $name,
1010 1010
 					'href'      => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ),
1011
-        		) );
1012
-        	}
1013
-        }
1014
-    }
1011
+				) );
1012
+			}
1013
+		}
1014
+	}
1015 1015
 
1016
-    //formidable shortcode
1016
+	//formidable shortcode
1017 1017
 	public static function get_form_shortcode( $atts ) {
1018
-        global $frm_vars;
1019
-        if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) {
1020
-            $sc = '[formidable';
1018
+		global $frm_vars;
1019
+		if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) {
1020
+			$sc = '[formidable';
1021 1021
 			if ( ! empty( $atts ) ) {
1022 1022
 				foreach ( $atts as $k => $v ) {
1023 1023
 					$sc .= ' ' . $k . '="' . esc_attr( $v ) . '"';
1024 1024
 				}
1025 1025
 			}
1026 1026
 			return $sc . ']';
1027
-        }
1028
-
1029
-        $shortcode_atts = shortcode_atts( array(
1030
-            'id' => '', 'key' => '', 'title' => false, 'description' => false,
1031
-            'readonly' => false, 'entry_id' => false, 'fields' => array(),
1032
-            'exclude_fields' => array(), 'minimize' => false,
1033
-        ), $atts);
1034
-        do_action('formidable_shortcode_atts', $shortcode_atts, $atts);
1035
-
1036
-        return self::show_form(
1037
-            $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'],
1038
-            $shortcode_atts['description'], $atts
1039
-        );
1040
-    }
1041
-
1042
-    public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) {
1043
-        if ( empty( $id ) ) {
1044
-            $id = $key;
1045
-        }
1046
-
1047
-        // no form id or key set
1048
-        if ( empty( $id ) ) {
1049
-            return __( 'Please select a valid form', 'formidable' );
1050
-        }
1051
-
1052
-        $form = FrmForm::getOne( $id );
1053
-        if ( ! $form || $form->parent_form_id || $form->status == 'trash' ) {
1054
-            return __( 'Please select a valid form', 'formidable' );
1055
-        }
1027
+		}
1028
+
1029
+		$shortcode_atts = shortcode_atts( array(
1030
+			'id' => '', 'key' => '', 'title' => false, 'description' => false,
1031
+			'readonly' => false, 'entry_id' => false, 'fields' => array(),
1032
+			'exclude_fields' => array(), 'minimize' => false,
1033
+		), $atts);
1034
+		do_action('formidable_shortcode_atts', $shortcode_atts, $atts);
1035
+
1036
+		return self::show_form(
1037
+			$shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'],
1038
+			$shortcode_atts['description'], $atts
1039
+		);
1040
+	}
1041
+
1042
+	public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) {
1043
+		if ( empty( $id ) ) {
1044
+			$id = $key;
1045
+		}
1046
+
1047
+		// no form id or key set
1048
+		if ( empty( $id ) ) {
1049
+			return __( 'Please select a valid form', 'formidable' );
1050
+		}
1051
+
1052
+		$form = FrmForm::getOne( $id );
1053
+		if ( ! $form || $form->parent_form_id || $form->status == 'trash' ) {
1054
+			return __( 'Please select a valid form', 'formidable' );
1055
+		}
1056 1056
 
1057 1057
 		add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' );
1058
-        FrmAppHelper::trigger_hook_load( 'form', $form );
1058
+		FrmAppHelper::trigger_hook_load( 'form', $form );
1059 1059
 
1060
-        $form = apply_filters( 'frm_pre_display_form', $form );
1060
+		$form = apply_filters( 'frm_pre_display_form', $form );
1061 1061
 
1062
-        $frm_settings = FrmAppHelper::get_settings();
1062
+		$frm_settings = FrmAppHelper::get_settings();
1063 1063
 
1064 1064
 		if ( self::is_viewable_draft_form( $form ) ) {
1065 1065
 			// don't show a draft form on a page
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
 		}
1081 1081
 
1082 1082
 		return $form;
1083
-    }
1083
+	}
1084 1084
 
1085 1085
 	private static function is_viewable_draft_form( $form ) {
1086 1086
 		global $post;
@@ -1096,98 +1096,98 @@  discard block
 block discarded – undo
1096 1096
 		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'] );
1097 1097
 	}
1098 1098
 
1099
-    public static function get_form( $form, $title, $description, $atts = array() ) {
1100
-        ob_start();
1099
+	public static function get_form( $form, $title, $description, $atts = array() ) {
1100
+		ob_start();
1101 1101
 
1102
-        self::get_form_contents( $form, $title, $description, $atts );
1102
+		self::get_form_contents( $form, $title, $description, $atts );
1103 1103
 		self::enqueue_scripts( FrmForm::get_params( $form ) );
1104 1104
 
1105
-        $contents = ob_get_contents();
1106
-        ob_end_clean();
1105
+		$contents = ob_get_contents();
1106
+		ob_end_clean();
1107 1107
 
1108 1108
 		self::maybe_minimize_form( $atts, $contents );
1109 1109
 
1110
-        return $contents;
1111
-    }
1110
+		return $contents;
1111
+	}
1112 1112
 
1113 1113
 	public static function enqueue_scripts( $params ) {
1114 1114
 		do_action( 'frm_enqueue_form_scripts', $params );
1115 1115
 	}
1116 1116
 
1117 1117
 	public static function get_form_contents( $form, $title, $description, $atts ) {
1118
-        global $frm_vars;
1118
+		global $frm_vars;
1119 1119
 
1120
-        $frm_settings = FrmAppHelper::get_settings();
1120
+		$frm_settings = FrmAppHelper::get_settings();
1121 1121
 
1122
-        $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value;
1122
+		$submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value;
1123 1123
 
1124
-        $user_ID = get_current_user_id();
1124
+		$user_ID = get_current_user_id();
1125 1125
 		$params = FrmForm::get_params( $form );
1126
-        $message = $errors = '';
1126
+		$message = $errors = '';
1127 1127
 
1128
-        if ( $params['posted_form_id'] == $form->id && $_POST ) {
1129
-            $errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array();
1130
-        }
1128
+		if ( $params['posted_form_id'] == $form->id && $_POST ) {
1129
+			$errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array();
1130
+		}
1131 1131
 
1132 1132
 		$include_form_tag = apply_filters( 'frm_include_form_tag', true, $form );
1133
-        $fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) );
1133
+		$fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) );
1134 1134
 
1135
-        if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) {
1136
-            do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
1137
-            if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) {
1138
-                $values = FrmEntriesHelper::setup_new_vars($fields, $form);
1135
+		if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) {
1136
+			do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
1137
+			if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) {
1138
+				$values = FrmEntriesHelper::setup_new_vars($fields, $form);
1139 1139
 				include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' );
1140
-            }
1141
-            return;
1142
-        }
1140
+			}
1141
+			return;
1142
+		}
1143 1143
 
1144
-        if ( ! empty($errors) ) {
1145
-            $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array();
1144
+		if ( ! empty($errors) ) {
1145
+			$values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array();
1146 1146
 			include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' );
1147
-            return;
1148
-        }
1147
+			return;
1148
+		}
1149 1149
 
1150
-        do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
1151
-        if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) {
1152
-            return;
1153
-        }
1150
+		do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
1151
+		if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) {
1152
+			return;
1153
+		}
1154 1154
 
1155
-        $values = FrmEntriesHelper::setup_new_vars($fields, $form, true);
1156
-        $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0;
1157
-        $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create');
1155
+		$values = FrmEntriesHelper::setup_new_vars($fields, $form, true);
1156
+		$created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0;
1157
+		$conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create');
1158 1158
 
1159
-        if ( $created && is_numeric($created) && $conf_method != 'message' ) {
1160
-            do_action('frm_success_action', $conf_method, $form, $form->options, $created);
1159
+		if ( $created && is_numeric($created) && $conf_method != 'message' ) {
1160
+			do_action('frm_success_action', $conf_method, $form, $form->options, $created);
1161 1161
 			do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
1162
-            return;
1163
-        }
1162
+			return;
1163
+		}
1164 1164
 
1165
-        if ( $created && is_numeric($created) ) {
1166
-            $message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg;
1167
-            $class = 'frm_message';
1168
-        } else {
1169
-            $message = $frm_settings->failed_msg;
1170
-            $class = 'frm_error_style';
1171
-        }
1165
+		if ( $created && is_numeric($created) ) {
1166
+			$message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg;
1167
+			$class = 'frm_message';
1168
+		} else {
1169
+			$message = $frm_settings->failed_msg;
1170
+			$class = 'frm_error_style';
1171
+		}
1172 1172
 
1173 1173
 		$message = FrmFormsHelper::get_success_message( array(
1174 1174
 			'message' => $message, 'form' => $form,
1175 1175
 			'entry_id' => $created, 'class' => $class,
1176 1176
 		) );
1177
-        $message = apply_filters('frm_main_feedback', $message, $form, $created);
1177
+		$message = apply_filters('frm_main_feedback', $message, $form, $created);
1178 1178
 
1179
-        if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) {
1179
+		if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) {
1180 1180
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' );
1181
-        } else {
1182
-            global $frm_vars;
1181
+		} else {
1182
+			global $frm_vars;
1183 1183
 			self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] );
1184 1184
 
1185 1185
 			$include_extra_container = 'frm_forms' . FrmFormsHelper::get_form_style_class( $values );
1186 1186
 			include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/errors.php' );
1187
-        }
1187
+		}
1188 1188
 
1189 1189
 		do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
1190
-    }
1190
+	}
1191 1191
 
1192 1192
 	public static function front_head() {
1193 1193
 		$version = FrmAppHelper::plugin_version();
@@ -1216,10 +1216,10 @@  discard block
 block discarded – undo
1216 1216
 	}
1217 1217
 
1218 1218
 	public static function defer_script_loading( $tag, $handle ) {
1219
-	    if ( 'recaptcha-api' == $handle && ! strpos( $tag, 'defer' ) ) {
1220
-	        $tag = str_replace( ' src', ' defer="defer" async="async" src', $tag );
1219
+		if ( 'recaptcha-api' == $handle && ! strpos( $tag, 'defer' ) ) {
1220
+			$tag = str_replace( ' src', ' defer="defer" async="async" src', $tag );
1221 1221
 		}
1222
-	    return $tag;
1222
+		return $tag;
1223 1223
 	}
1224 1224
 
1225 1225
 	public static function footer_js( $location = 'footer' ) {
Please login to merge, or discard this patch.