Completed
Push — master ( 904b92...fd3186 )
by Stephanie
03:45
created
classes/controllers/FrmAppController.php 2 patches
Indentation   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@  discard block
 block discarded – undo
3 3
 class FrmAppController {
4 4
 
5 5
 	public static function menu() {
6
-        FrmAppHelper::maybe_add_permissions();
7
-        if ( ! current_user_can( 'frm_view_forms' ) ) {
8
-            return;
9
-        }
6
+		FrmAppHelper::maybe_add_permissions();
7
+		if ( ! current_user_can( 'frm_view_forms' ) ) {
8
+			return;
9
+		}
10 10
 
11
-        $frm_settings = FrmAppHelper::get_settings();
12
-        add_menu_page( 'Formidable', $frm_settings->menu, 'frm_view_forms', 'formidable', 'FrmFormsController::route', FrmAppHelper::plugin_url() . '/images/form_16.png', self::get_menu_position() );
13
-    }
11
+		$frm_settings = FrmAppHelper::get_settings();
12
+		add_menu_page( 'Formidable', $frm_settings->menu, 'frm_view_forms', 'formidable', 'FrmFormsController::route', FrmAppHelper::plugin_url() . '/images/form_16.png', self::get_menu_position() );
13
+	}
14 14
 
15 15
 	private static function get_menu_position() {
16 16
 		$count = count( get_post_types( array( 'show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) ) );
@@ -19,39 +19,39 @@  discard block
 block discarded – undo
19 19
 		return $pos;
20 20
 	}
21 21
 
22
-    public static function load_wp_admin_style() {
23
-        FrmAppHelper::load_font_style();
24
-    }
22
+	public static function load_wp_admin_style() {
23
+		FrmAppHelper::load_font_style();
24
+	}
25 25
 
26 26
 	public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) {
27
-        global $pagenow, $frm_vars;
27
+		global $pagenow, $frm_vars;
28 28
 
29 29
 		$show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' );
30
-        if ( empty( $show_nav ) ) {
31
-            return;
32
-        }
30
+		if ( empty( $show_nav ) ) {
31
+			return;
32
+		}
33 33
 
34 34
 		$current_page = isset( $_GET['page'] ) ? FrmAppHelper::simple_get( 'page', 'sanitize_title' ) : FrmAppHelper::simple_get( 'post_type', 'sanitize_title', 'None' );
35 35
 		if ( $pagenow == 'post.php' || $pagenow == 'post-new.php' ) {
36 36
 			$current_page = 'frm_display';
37 37
 		}
38 38
 
39
-        if ( $form ) {
39
+		if ( $form ) {
40 40
 			FrmForm::maybe_get_form( $form );
41 41
 
42
-            if ( is_object( $form ) ) {
43
-                $id = $form->id;
44
-            }
45
-        }
42
+			if ( is_object( $form ) ) {
43
+				$id = $form->id;
44
+			}
45
+		}
46 46
 
47
-        if ( ! isset( $id ) ) {
48
-            $form = $id = false;
49
-        }
47
+		if ( ! isset( $id ) ) {
48
+			$form = $id = false;
49
+		}
50 50
 
51 51
 		$nav_items = self::get_form_nav_items( $id );
52 52
 
53
-        include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
54
-    }
53
+		include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
54
+	}
55 55
 
56 56
 	private static function get_form_nav_items( $id ) {
57 57
 		$nav_items = array(
@@ -82,28 +82,28 @@  discard block
 block discarded – undo
82 82
 		return $nav_items;
83 83
 	}
84 84
 
85
-    // Adds a settings link to the plugins page
86
-    public static function settings_link( $links ) {
85
+	// Adds a settings link to the plugins page
86
+	public static function settings_link( $links ) {
87 87
 		$settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings' ) ) . '">' . __( 'Settings', 'formidable' ) . '</a>';
88
-        array_unshift( $links, $settings );
88
+		array_unshift( $links, $settings );
89 89
 
90
-        return $links;
91
-    }
90
+		return $links;
91
+	}
92 92
 
93
-    public static function pro_get_started_headline() {
93
+	public static function pro_get_started_headline() {
94 94
 		self::maybe_show_upgrade_bar();
95 95
 
96
-        // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message
97
-        if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) {
98
-            return;
99
-        }
96
+		// Don't display this error as we're upgrading the thing, or if the user shouldn't see the message
97
+		if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) {
98
+			return;
99
+		}
100 100
 
101 101
 		if ( get_site_option( 'frmpro-authorized' ) && ! file_exists( FrmAppHelper::plugin_path() . '/pro/formidable-pro.php' ) ) {
102
-            FrmAppHelper::load_admin_wide_js();
102
+			FrmAppHelper::load_admin_wide_js();
103 103
 
104
-            // user is authorized, but running free version
105
-            $inst_install_url = 'https://formidablepro.com/knowledgebase/install-formidable-forms/';
106
-        ?>
104
+			// user is authorized, but running free version
105
+			$inst_install_url = 'https://formidablepro.com/knowledgebase/install-formidable-forms/';
106
+		?>
107 107
 <div class="error" class="frm_previous_install">
108 108
 		<?php
109 109
 		echo wp_kses_post( apply_filters( 'frm_pro_update_msg',
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 		) ); ?>
116 116
 </div>
117 117
 <?php
118
-        }
119
-    }
118
+		}
119
+	}
120 120
 
121 121
 	private static function maybe_show_upgrade_bar() {
122 122
 		$page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		}
216 216
 	}
217 217
 
218
-    public static function admin_js() {
218
+	public static function admin_js() {
219 219
 		$version = FrmAppHelper::plugin_version();
220 220
 		FrmAppHelper::load_admin_wide_js( false );
221 221
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 			'bootstrap_tooltip', 'bootstrap-multiselect',
227 227
 		), $version, true );
228 228
 		wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version );
229
-        wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
229
+		wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
230 230
 
231 231
 		// load multselect js
232 232
 		wp_register_script( 'bootstrap-multiselect', FrmAppHelper::plugin_url() . '/js/bootstrap-multiselect.js', array( 'jquery', 'bootstrap_tooltip' ), '0.9.8', true );
@@ -237,78 +237,78 @@  discard block
 block discarded – undo
237 237
 		global $pagenow;
238 238
 		if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) {
239 239
 
240
-            wp_enqueue_script( 'admin-widgets' );
241
-            wp_enqueue_style( 'widgets' );
242
-            wp_enqueue_script( 'formidable' );
243
-            wp_enqueue_script( 'formidable_admin' );
240
+			wp_enqueue_script( 'admin-widgets' );
241
+			wp_enqueue_style( 'widgets' );
242
+			wp_enqueue_script( 'formidable' );
243
+			wp_enqueue_script( 'formidable_admin' );
244 244
 			FrmAppHelper::localize_script( 'admin' );
245 245
 
246
-            wp_enqueue_style( 'formidable-admin' );
247
-            add_thickbox();
246
+			wp_enqueue_style( 'formidable-admin' );
247
+			add_thickbox();
248 248
 
249
-            wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' );
249
+			wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' );
250 250
 
251
-        } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) {
252
-            if ( isset( $_REQUEST['post_type'] ) ) {
253
-                $post_type = sanitize_title( $_REQUEST['post_type'] );
251
+		} else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) {
252
+			if ( isset( $_REQUEST['post_type'] ) ) {
253
+				$post_type = sanitize_title( $_REQUEST['post_type'] );
254 254
 			} else if ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) {
255 255
 				$post = get_post( absint( $_REQUEST['post'] ) );
256
-                if ( ! $post ) {
257
-                    return;
258
-                }
259
-                $post_type = $post->post_type;
260
-            } else {
261
-                return;
262
-            }
263
-
264
-            if ( $post_type == 'frm_display' ) {
265
-                wp_enqueue_script( 'jquery-ui-draggable' );
266
-                wp_enqueue_script( 'formidable_admin' );
267
-                wp_enqueue_style( 'formidable-admin' );
256
+				if ( ! $post ) {
257
+					return;
258
+				}
259
+				$post_type = $post->post_type;
260
+			} else {
261
+				return;
262
+			}
263
+
264
+			if ( $post_type == 'frm_display' ) {
265
+				wp_enqueue_script( 'jquery-ui-draggable' );
266
+				wp_enqueue_script( 'formidable_admin' );
267
+				wp_enqueue_style( 'formidable-admin' );
268 268
 				FrmAppHelper::localize_script( 'admin' );
269
-            }
270
-        } else if ( $pagenow == 'widgets.php' ) {
271
-            FrmAppHelper::load_admin_wide_js();
272
-        }
273
-    }
274
-
275
-    public static function wp_admin_body_class( $classes ) {
276
-        global $wp_version;
277
-        //we need this class everywhere in the admin for the menu
278
-        if ( version_compare( $wp_version, '3.7.2', '>' ) ) {
279
-            $classes .= ' frm_38_trigger';
280
-        }
281
-
282
-        return $classes;
283
-    }
284
-
285
-    public static function load_lang() {
286
-        load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
287
-    }
288
-
289
-    /**
290
-     * Filter shortcodes in text widgets
291
-     */
292
-    public static function widget_text_filter( $content ) {
293
-    	$regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/';
294
-    	return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content );
295
-    }
296
-
297
-    public static function widget_text_filter_callback( $matches ) {
298
-        _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::widget_text_filter_callback' );
299
-        return FrmAppHelper::widget_text_filter_callback( $matches );
300
-    }
301
-
302
-    public static function front_head() {
303
-        if ( is_multisite() ) {
304
-            $old_db_version = get_option( 'frm_db_version' );
305
-            $pro_db_version = FrmAppHelper::pro_is_installed() ? get_option( 'frmpro_db_version' ) : false;
306
-            if ( ( (int) $old_db_version < (int) FrmAppHelper::$db_version ) ||
307
-                ( FrmAppHelper::pro_is_installed() && (int) $pro_db_version < (int) FrmAppHelper::$pro_db_version ) ) {
308
-                self::install( $old_db_version );
309
-            }
310
-        }
311
-    }
269
+			}
270
+		} else if ( $pagenow == 'widgets.php' ) {
271
+			FrmAppHelper::load_admin_wide_js();
272
+		}
273
+	}
274
+
275
+	public static function wp_admin_body_class( $classes ) {
276
+		global $wp_version;
277
+		//we need this class everywhere in the admin for the menu
278
+		if ( version_compare( $wp_version, '3.7.2', '>' ) ) {
279
+			$classes .= ' frm_38_trigger';
280
+		}
281
+
282
+		return $classes;
283
+	}
284
+
285
+	public static function load_lang() {
286
+		load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
287
+	}
288
+
289
+	/**
290
+	 * Filter shortcodes in text widgets
291
+	 */
292
+	public static function widget_text_filter( $content ) {
293
+		$regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/';
294
+		return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content );
295
+	}
296
+
297
+	public static function widget_text_filter_callback( $matches ) {
298
+		_deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::widget_text_filter_callback' );
299
+		return FrmAppHelper::widget_text_filter_callback( $matches );
300
+	}
301
+
302
+	public static function front_head() {
303
+		if ( is_multisite() ) {
304
+			$old_db_version = get_option( 'frm_db_version' );
305
+			$pro_db_version = FrmAppHelper::pro_is_installed() ? get_option( 'frmpro_db_version' ) : false;
306
+			if ( ( (int) $old_db_version < (int) FrmAppHelper::$db_version ) ||
307
+				( FrmAppHelper::pro_is_installed() && (int) $pro_db_version < (int) FrmAppHelper::$pro_db_version ) ) {
308
+				self::install( $old_db_version );
309
+			}
310
+		}
311
+	}
312 312
 
313 313
 	public static function localize_script( $location ) {
314 314
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmAppHelper::localize_script' );
@@ -368,20 +368,20 @@  discard block
 block discarded – undo
368 368
 		wp_die();
369 369
 	}
370 370
 
371
-    public static function activation_install() {
372
-        FrmAppHelper::delete_cache_and_transient( 'frm_plugin_version' );
373
-        FrmFormActionsController::actions_init();
374
-        self::install();
375
-    }
371
+	public static function activation_install() {
372
+		FrmAppHelper::delete_cache_and_transient( 'frm_plugin_version' );
373
+		FrmFormActionsController::actions_init();
374
+		self::install();
375
+	}
376 376
 
377
-    public static function install( $old_db_version = false ) {
378
-        $frmdb = new FrmDb();
379
-        $frmdb->upgrade( $old_db_version );
380
-    }
377
+	public static function install( $old_db_version = false ) {
378
+		$frmdb = new FrmDb();
379
+		$frmdb->upgrade( $old_db_version );
380
+	}
381 381
 
382
-    public static function uninstall() {
382
+	public static function uninstall() {
383 383
 		FrmAppHelper::permission_check('administrator');
384
-        check_ajax_referer( 'frm_ajax', 'nonce' );
384
+		check_ajax_referer( 'frm_ajax', 'nonce' );
385 385
 
386 386
 		$frmdb = new FrmDb();
387 387
 		$frmdb->uninstall();
@@ -390,48 +390,48 @@  discard block
 block discarded – undo
390 390
 		deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false );
391 391
 		echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) );
392 392
 
393
-        wp_die();
394
-    }
393
+		wp_die();
394
+	}
395 395
 
396
-    public static function drop_tables( $tables ) {
397
-        global $wpdb;
398
-        $tables[] = $wpdb->prefix . 'frm_fields';
399
-        $tables[] = $wpdb->prefix . 'frm_forms';
400
-        $tables[] = $wpdb->prefix . 'frm_items';
401
-        $tables[] = $wpdb->prefix . 'frm_item_metas';
402
-        return $tables;
403
-    }
396
+	public static function drop_tables( $tables ) {
397
+		global $wpdb;
398
+		$tables[] = $wpdb->prefix . 'frm_fields';
399
+		$tables[] = $wpdb->prefix . 'frm_forms';
400
+		$tables[] = $wpdb->prefix . 'frm_items';
401
+		$tables[] = $wpdb->prefix . 'frm_item_metas';
402
+		return $tables;
403
+	}
404 404
 
405
-    // Routes for wordpress pages -- we're just replacing content here folks.
406
-    public static function page_route( $content ) {
407
-        global $post;
405
+	// Routes for wordpress pages -- we're just replacing content here folks.
406
+	public static function page_route( $content ) {
407
+		global $post;
408 408
 
409
-        $frm_settings = FrmAppHelper::get_settings();
410
-        if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) {
411
-            $content = FrmFormsController::page_preview();
412
-        }
409
+		$frm_settings = FrmAppHelper::get_settings();
410
+		if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) {
411
+			$content = FrmFormsController::page_preview();
412
+		}
413 413
 
414
-        return $content;
415
-    }
414
+		return $content;
415
+	}
416 416
 
417
-    public static function deauthorize() {
417
+	public static function deauthorize() {
418 418
 		FrmAppHelper::permission_check('frm_change_settings');
419
-        check_ajax_referer( 'frm_ajax', 'nonce' );
420
-
421
-        delete_option( 'frmpro-credentials' );
422
-        delete_option( 'frmpro-authorized' );
423
-        delete_site_option( 'frmpro-credentials' );
424
-        delete_site_option( 'frmpro-authorized' );
425
-        wp_die();
426
-    }
427
-
428
-    public static function get_form_shortcode( $atts ) {
429
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' );
430
-        return FrmFormsController::get_form_shortcode( $atts );
431
-    }
432
-
433
-    public static function get_postbox_class() {
434
-        _deprecated_function( __FUNCTION__, '2.0' );
435
-        return 'postbox-container';
436
-    }
419
+		check_ajax_referer( 'frm_ajax', 'nonce' );
420
+
421
+		delete_option( 'frmpro-credentials' );
422
+		delete_option( 'frmpro-authorized' );
423
+		delete_site_option( 'frmpro-credentials' );
424
+		delete_site_option( 'frmpro-authorized' );
425
+		wp_die();
426
+	}
427
+
428
+	public static function get_form_shortcode( $atts ) {
429
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' );
430
+		return FrmFormsController::get_form_shortcode( $atts );
431
+	}
432
+
433
+	public static function get_postbox_class() {
434
+		_deprecated_function( __FUNCTION__, '2.0' );
435
+		return 'postbox-container';
436
+	}
437 437
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		if ( ! empty( $affiliate ) ) {
133 133
 ?>
134 134
 <div class="update-nag frm-update-to-pro">
135
-	Looking for more options to get professional results? <span>Take your forms to the next level.</span> <a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com') ) ?>" class="button">Upgrade to Pro</a>
135
+	Looking for more options to get professional results? <span>Take your forms to the next level.</span> <a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com' ) ) ?>" class="button">Upgrade to Pro</a>
136 136
 </div>
137 137
 <?php
138 138
 		}
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
     }
381 381
 
382 382
     public static function uninstall() {
383
-		FrmAppHelper::permission_check('administrator');
383
+		FrmAppHelper::permission_check( 'administrator' );
384 384
         check_ajax_referer( 'frm_ajax', 'nonce' );
385 385
 
386 386
 		$frmdb = new FrmDb();
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
     }
416 416
 
417 417
     public static function deauthorize() {
418
-		FrmAppHelper::permission_check('frm_change_settings');
418
+		FrmAppHelper::permission_check( 'frm_change_settings' );
419 419
         check_ajax_referer( 'frm_ajax', 'nonce' );
420 420
 
421 421
         delete_option( 'frmpro-credentials' );
Please login to merge, or discard this patch.
classes/controllers/FrmFormActionsController.php 2 patches
Indentation   +223 added lines, -223 removed lines patch added patch discarded remove patch
@@ -1,109 +1,109 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class FrmFormActionsController {
4
-    public static $action_post_type = 'frm_form_actions';
5
-    public static $registered_actions;
6
-
7
-    public static function register_post_types() {
8
-        register_post_type( self::$action_post_type, array(
9
-            'label' => __( 'Form Actions', 'formidable' ),
10
-            'description' => '',
11
-            'public' => false,
12
-            'show_ui' => false,
13
-            'exclude_from_search' => true,
14
-            'show_in_nav_menus' => false,
15
-            'show_in_menu' => true,
16
-            'capability_type' => 'page',
17
-            'supports' => array(
4
+	public static $action_post_type = 'frm_form_actions';
5
+	public static $registered_actions;
6
+
7
+	public static function register_post_types() {
8
+		register_post_type( self::$action_post_type, array(
9
+			'label' => __( 'Form Actions', 'formidable' ),
10
+			'description' => '',
11
+			'public' => false,
12
+			'show_ui' => false,
13
+			'exclude_from_search' => true,
14
+			'show_in_nav_menus' => false,
15
+			'show_in_menu' => true,
16
+			'capability_type' => 'page',
17
+			'supports' => array(
18 18
 				'title', 'editor', 'excerpt', 'custom-fields',
19 19
 				'page-attributes',
20
-            ),
21
-            'has_archive' => false,
22
-        ) );
23
-
24
-        /**
25
-         * post_content: json settings
26
-         * menu_order: form id
27
-         * post_excerpt: action type
28
-         */
29
-
30
-        self::actions_init();
31
-    }
32
-
33
-    public static function actions_init() {
34
-        self::$registered_actions = new Frm_Form_Action_Factory();
35
-        self::register_actions();
36
-        do_action( 'frm_form_actions_init' );
37
-    }
38
-
39
-    public static function register_actions() {
40
-        $action_classes = apply_filters( 'frm_registered_form_actions', array(
41
-            'email'     => 'FrmEmailAction',
42
-            'wppost'    => 'FrmDefPostAction',
43
-            'register'  => 'FrmDefRegAction',
44
-            'paypal'    => 'FrmDefPayPalAction',
45
-            //'aweber'    => 'FrmDefAweberAction',
46
-            'mailchimp' => 'FrmDefMlcmpAction',
47
-            'twilio'    => 'FrmDefTwilioAction',
48
-            'highrise'  => 'FrmDefHrsAction',
49
-        ) );
50
-
51
-        include_once(FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php');
52
-        include_once(FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php');
53
-
54
-        foreach ( $action_classes as $action_class ) {
55
-            self::$registered_actions->register($action_class);
56
-        }
57
-    }
20
+			),
21
+			'has_archive' => false,
22
+		) );
23
+
24
+		/**
25
+		 * post_content: json settings
26
+		 * menu_order: form id
27
+		 * post_excerpt: action type
28
+		 */
29
+
30
+		self::actions_init();
31
+	}
32
+
33
+	public static function actions_init() {
34
+		self::$registered_actions = new Frm_Form_Action_Factory();
35
+		self::register_actions();
36
+		do_action( 'frm_form_actions_init' );
37
+	}
38
+
39
+	public static function register_actions() {
40
+		$action_classes = apply_filters( 'frm_registered_form_actions', array(
41
+			'email'     => 'FrmEmailAction',
42
+			'wppost'    => 'FrmDefPostAction',
43
+			'register'  => 'FrmDefRegAction',
44
+			'paypal'    => 'FrmDefPayPalAction',
45
+			//'aweber'    => 'FrmDefAweberAction',
46
+			'mailchimp' => 'FrmDefMlcmpAction',
47
+			'twilio'    => 'FrmDefTwilioAction',
48
+			'highrise'  => 'FrmDefHrsAction',
49
+		) );
50
+
51
+		include_once(FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php');
52
+		include_once(FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php');
53
+
54
+		foreach ( $action_classes as $action_class ) {
55
+			self::$registered_actions->register($action_class);
56
+		}
57
+	}
58 58
 
59 59
 	public static function get_form_actions( $action = 'all' ) {
60
-        $temp_actions = self::$registered_actions;
61
-        if ( empty($temp_actions) ) {
62
-            self::actions_init();
63
-            $temp_actions = self::$registered_actions->actions;
64
-        } else {
65
-            $temp_actions = $temp_actions->actions;
66
-        }
60
+		$temp_actions = self::$registered_actions;
61
+		if ( empty($temp_actions) ) {
62
+			self::actions_init();
63
+			$temp_actions = self::$registered_actions->actions;
64
+		} else {
65
+			$temp_actions = $temp_actions->actions;
66
+		}
67 67
 
68
-        $actions = array();
68
+		$actions = array();
69 69
 
70
-        foreach ( $temp_actions as $a ) {
71
-            if ( 'all' != $action && $a->id_base == $action ) {
72
-                return $a;
73
-            }
70
+		foreach ( $temp_actions as $a ) {
71
+			if ( 'all' != $action && $a->id_base == $action ) {
72
+				return $a;
73
+			}
74 74
 
75 75
 			$actions[ $a->id_base ] = $a;
76
-        }
77
-        unset( $temp_actions, $a );
78
-
79
-        $action_limit = 10;
80
-        if ( count( $actions ) <= $action_limit ) {
81
-            return $actions;
82
-        }
83
-
84
-        // remove the last few inactive icons if there are too many
85
-        $temp_actions = $actions;
86
-        arsort( $temp_actions );
87
-        foreach ( $temp_actions as $type => $a ) {
88
-            if ( ! isset( $a->action_options['active'] ) || empty( $a->action_options['active'] ) ) {
76
+		}
77
+		unset( $temp_actions, $a );
78
+
79
+		$action_limit = 10;
80
+		if ( count( $actions ) <= $action_limit ) {
81
+			return $actions;
82
+		}
83
+
84
+		// remove the last few inactive icons if there are too many
85
+		$temp_actions = $actions;
86
+		arsort( $temp_actions );
87
+		foreach ( $temp_actions as $type => $a ) {
88
+			if ( ! isset( $a->action_options['active'] ) || empty( $a->action_options['active'] ) ) {
89 89
 				unset( $actions[ $type ] );
90
-                if ( count( $actions ) <= $action_limit ) {
91
-                    break;
92
-                }
93
-            }
94
-            unset( $type, $a );
95
-        }
90
+				if ( count( $actions ) <= $action_limit ) {
91
+					break;
92
+				}
93
+			}
94
+			unset( $type, $a );
95
+		}
96 96
 
97
-        return $actions;
98
-    }
97
+		return $actions;
98
+	}
99 99
 
100 100
 	/**
101 101
 	 * @since 2.0
102 102
 	 */
103
-    public static function list_actions( $form, $values ) {
104
-        if ( empty( $form ) ) {
105
-            return;
106
-        }
103
+	public static function list_actions( $form, $values ) {
104
+		if ( empty( $form ) ) {
105
+			return;
106
+		}
107 107
 
108 108
 		/**
109 109
 		 * use this hook to migrate old settings into a new action
@@ -113,116 +113,116 @@  discard block
 block discarded – undo
113 113
 
114 114
 		$form_actions = FrmFormAction::get_action_for_form( $form->id );
115 115
 
116
-        $action_controls = self::get_form_actions();
116
+		$action_controls = self::get_form_actions();
117 117
 
118
-        $action_map = array();
118
+		$action_map = array();
119 119
 
120 120
 		foreach ( $action_controls as $key => $control ) {
121
-            $action_map[ $control->id_base ] = $key;
122
-        }
121
+			$action_map[ $control->id_base ] = $key;
122
+		}
123 123
 
124
-    	foreach ( $form_actions as $action ) {
125
-    	    if ( ! isset( $action_map[ $action->post_excerpt ] ) ) {
126
-    	        // don't try and show settings if action no longer exists
127
-    	        continue;
128
-    	    }
124
+		foreach ( $form_actions as $action ) {
125
+			if ( ! isset( $action_map[ $action->post_excerpt ] ) ) {
126
+				// don't try and show settings if action no longer exists
127
+				continue;
128
+			}
129 129
 
130
-    		self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values );
131
-    	}
132
-    }
130
+			self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values );
131
+		}
132
+	}
133 133
 
134 134
 	public static function action_control( $form_action, $form, $action_key, $action_control, $values ) {
135
-        $action_control->_set($action_key);
136
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-form-actions/form_action.php');
137
-    }
135
+		$action_control->_set($action_key);
136
+		include(FrmAppHelper::plugin_path() .'/classes/views/frm-form-actions/form_action.php');
137
+	}
138 138
 
139
-    public static function add_form_action() {
139
+	public static function add_form_action() {
140 140
 		FrmAppHelper::permission_check('frm_edit_forms');
141
-        check_ajax_referer( 'frm_ajax', 'nonce' );
141
+		check_ajax_referer( 'frm_ajax', 'nonce' );
142 142
 
143
-        global $frm_vars;
143
+		global $frm_vars;
144 144
 
145 145
 		$action_key = absint( $_POST['list_id'] );
146
-        $action_type = sanitize_text_field( $_POST['type'] );
146
+		$action_type = sanitize_text_field( $_POST['type'] );
147 147
 
148
-        $action_control = self::get_form_actions( $action_type );
149
-        $action_control->_set($action_key);
148
+		$action_control = self::get_form_actions( $action_type );
149
+		$action_control->_set($action_key);
150 150
 
151
-        $form_id = absint( $_POST['form_id'] );
151
+		$form_id = absint( $_POST['form_id'] );
152 152
 
153
-        $form_action = $action_control->prepare_new($form_id);
153
+		$form_action = $action_control->prepare_new($form_id);
154 154
 
155
-        $values = array();
156
-        $form = self::fields_to_values($form_id, $values);
155
+		$values = array();
156
+		$form = self::fields_to_values($form_id, $values);
157 157
 
158
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-form-actions/form_action.php');
159
-        wp_die();
160
-    }
158
+		include(FrmAppHelper::plugin_path() .'/classes/views/frm-form-actions/form_action.php');
159
+		wp_die();
160
+	}
161 161
 
162
-    public static function fill_action() {
162
+	public static function fill_action() {
163 163
 		FrmAppHelper::permission_check('frm_edit_forms');
164
-        check_ajax_referer( 'frm_ajax', 'nonce' );
164
+		check_ajax_referer( 'frm_ajax', 'nonce' );
165 165
 
166
-        $action_key = absint( $_POST['action_id'] );
167
-        $action_type = sanitize_text_field( $_POST['action_type'] );
166
+		$action_key = absint( $_POST['action_id'] );
167
+		$action_type = sanitize_text_field( $_POST['action_type'] );
168 168
 
169
-        $action_control = self::get_form_actions( $action_type );
170
-        if ( empty($action_control) ) {
171
-            wp_die();
172
-        }
169
+		$action_control = self::get_form_actions( $action_type );
170
+		if ( empty($action_control) ) {
171
+			wp_die();
172
+		}
173 173
 
174
-        $form_action = $action_control->get_single_action( $action_key );
174
+		$form_action = $action_control->get_single_action( $action_key );
175 175
 
176
-        $values = array();
177
-        $form = self::fields_to_values($form_action->menu_order, $values);
176
+		$values = array();
177
+		$form = self::fields_to_values($form_action->menu_order, $values);
178 178
 
179
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-form-actions/_action_inside.php');
180
-        wp_die();
181
-    }
179
+		include(FrmAppHelper::plugin_path() .'/classes/views/frm-form-actions/_action_inside.php');
180
+		wp_die();
181
+	}
182 182
 
183 183
 	private static function fields_to_values( $form_id, array &$values ) {
184
-        $form = FrmForm::getOne($form_id);
184
+		$form = FrmForm::getOne($form_id);
185 185
 
186 186
 		$values = array( 'fields' => array(), 'id' => $form->id );
187 187
 
188
-        $fields = FrmField::get_all_for_form($form->id);
189
-        foreach ( $fields as $k => $f ) {
190
-            $f = (array) $f;
191
-            $opts = (array) $f['field_options'];
192
-            $f = array_merge($opts, $f);
193
-            if ( ! isset( $f['post_field'] ) ) {
194
-                $f['post_field'] = '';
195
-            }
196
-            $values['fields'][] = $f;
197
-            unset($k, $f);
198
-        }
199
-
200
-        return $form;
201
-    }
188
+		$fields = FrmField::get_all_for_form($form->id);
189
+		foreach ( $fields as $k => $f ) {
190
+			$f = (array) $f;
191
+			$opts = (array) $f['field_options'];
192
+			$f = array_merge($opts, $f);
193
+			if ( ! isset( $f['post_field'] ) ) {
194
+				$f['post_field'] = '';
195
+			}
196
+			$values['fields'][] = $f;
197
+			unset($k, $f);
198
+		}
199
+
200
+		return $form;
201
+	}
202 202
 
203 203
 	public static function update_settings( $form_id ) {
204
-        global $wpdb;
204
+		global $wpdb;
205 205
 
206
-        $registered_actions = self::$registered_actions->actions;
206
+		$registered_actions = self::$registered_actions->actions;
207 207
 
208 208
 		$old_actions = FrmDb::get_col( $wpdb->posts, array( 'post_type' => self::$action_post_type, 'menu_order' => $form_id ), 'ID' );
209
-        $new_actions = array();
209
+		$new_actions = array();
210 210
 
211
-        foreach ( $registered_actions as $registered_action ) {
212
-            $action_ids = $registered_action->update_callback($form_id);
213
-            if ( ! empty( $action_ids ) ) {
214
-                $new_actions[] = $action_ids;
215
-            }
216
-        }
211
+		foreach ( $registered_actions as $registered_action ) {
212
+			$action_ids = $registered_action->update_callback($form_id);
213
+			if ( ! empty( $action_ids ) ) {
214
+				$new_actions[] = $action_ids;
215
+			}
216
+		}
217 217
 
218
-        //Only use array_merge if there are new actions
219
-        if ( ! empty( $new_actions ) ) {
220
-            $new_actions = call_user_func_array( 'array_merge', $new_actions );
221
-        }
222
-        $old_actions = array_diff( $old_actions, $new_actions );
218
+		//Only use array_merge if there are new actions
219
+		if ( ! empty( $new_actions ) ) {
220
+			$new_actions = call_user_func_array( 'array_merge', $new_actions );
221
+		}
222
+		$old_actions = array_diff( $old_actions, $new_actions );
223 223
 
224 224
 		self::delete_missing_actions( $old_actions );
225
-    }
225
+	}
226 226
 
227 227
 	public static function delete_missing_actions( $old_actions ) {
228 228
 		if ( ! empty( $old_actions ) ) {
@@ -237,36 +237,36 @@  discard block
 block discarded – undo
237 237
 		self::trigger_actions( 'create', $form_id, $entry_id, 'all', $args );
238 238
 	}
239 239
 
240
-    /**
241
-     * @param string $event
242
-     */
240
+	/**
241
+	 * @param string $event
242
+	 */
243 243
 	public static function trigger_actions( $event, $form, $entry, $type = 'all', $args = array() ) {
244 244
 		$form_actions = FrmFormAction::get_action_for_form( ( is_object( $form ) ? $form->id : $form ), $type );
245 245
 
246 246
 		if ( empty( $form_actions ) ) {
247
-            return;
248
-        }
247
+			return;
248
+		}
249 249
 
250 250
 		FrmForm::maybe_get_form( $form );
251 251
 
252
-        $link_settings = self::get_form_actions( $type );
253
-        if ( 'all' != $type ) {
254
-            $link_settings = array( $type => $link_settings );
255
-        }
252
+		$link_settings = self::get_form_actions( $type );
253
+		if ( 'all' != $type ) {
254
+			$link_settings = array( $type => $link_settings );
255
+		}
256 256
 
257
-        $stored_actions = $action_priority = array();
257
+		$stored_actions = $action_priority = array();
258 258
 
259 259
 		$importing = in_array( $event, array( 'create', 'update' ) ) && defined( 'WP_IMPORTING' ) && WP_IMPORTING;
260 260
 
261
-        foreach ( $form_actions as $action ) {
261
+		foreach ( $form_actions as $action ) {
262 262
 			$trigger_on_import = $importing && in_array( 'import', $action->post_content['event'] );
263 263
 			if ( ! in_array( $event, $action->post_content['event'] ) && ! $trigger_on_import ) {
264
-                continue;
265
-            }
264
+				continue;
265
+			}
266 266
 
267
-            if ( ! is_object( $entry ) ) {
268
-                $entry = FrmEntry::getOne( $entry, true );
269
-            }
267
+			if ( ! is_object( $entry ) ) {
268
+				$entry = FrmEntry::getOne( $entry, true );
269
+			}
270 270
 
271 271
 			if ( empty( $entry ) || $entry->is_draft ) {
272 272
 				continue;
@@ -275,66 +275,66 @@  discard block
 block discarded – undo
275 275
 			$child_entry = ( ( $form && is_numeric( $form->parent_form_id ) && $form->parent_form_id ) || ( $entry && ( $entry->form_id != $form->id || $entry->parent_item_id ) ) || ( isset( $args['is_child'] ) && $args['is_child'] ) );
276 276
 
277 277
 			if ( $child_entry ) {
278
-                //don't trigger actions for sub forms
279
-                continue;
280
-            }
278
+				//don't trigger actions for sub forms
279
+				continue;
280
+			}
281 281
 
282
-            // check conditional logic
282
+			// check conditional logic
283 283
 			$stop = FrmFormAction::action_conditions_met( $action, $entry );
284
-            if ( $stop ) {
285
-                continue;
286
-            }
284
+			if ( $stop ) {
285
+				continue;
286
+			}
287 287
 
288
-            // store actions so they can be triggered with the correct priority
289
-            $stored_actions[ $action->ID ] = $action;
290
-            $action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority'];
288
+			// store actions so they can be triggered with the correct priority
289
+			$stored_actions[ $action->ID ] = $action;
290
+			$action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority'];
291 291
 
292
-            unset($action);
293
-        }
292
+			unset($action);
293
+		}
294 294
 
295
-        if ( ! empty( $stored_actions ) ) {
296
-            asort($action_priority);
295
+		if ( ! empty( $stored_actions ) ) {
296
+			asort($action_priority);
297 297
 
298
-            // make sure hooks are loaded
299
-            new FrmNotification();
298
+			// make sure hooks are loaded
299
+			new FrmNotification();
300 300
 
301
-            foreach ( $action_priority as $action_id => $priority ) {
302
-                $action = $stored_actions[ $action_id ];
303
-                do_action('frm_trigger_'. $action->post_excerpt .'_action', $action, $entry, $form, $event);
304
-                do_action('frm_trigger_'. $action->post_excerpt .'_'. $event .'_action', $action, $entry, $form);
301
+			foreach ( $action_priority as $action_id => $priority ) {
302
+				$action = $stored_actions[ $action_id ];
303
+				do_action('frm_trigger_'. $action->post_excerpt .'_action', $action, $entry, $form, $event);
304
+				do_action('frm_trigger_'. $action->post_excerpt .'_'. $event .'_action', $action, $entry, $form);
305 305
 
306
-                // If post is created, get updated $entry object
307
-                if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
308
-                    $entry = FrmEntry::getOne($entry->id, true);
309
-                }
310
-            }
311
-        }
312
-    }
306
+				// If post is created, get updated $entry object
307
+				if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
308
+					$entry = FrmEntry::getOne($entry->id, true);
309
+				}
310
+			}
311
+		}
312
+	}
313 313
 
314 314
 	public static function duplicate_form_actions( $form_id, $values, $args = array() ) {
315
-        if ( ! isset($args['old_id']) || empty($args['old_id']) ) {
316
-            // continue if we know which actions to copy
317
-            return;
318
-        }
315
+		if ( ! isset($args['old_id']) || empty($args['old_id']) ) {
316
+			// continue if we know which actions to copy
317
+			return;
318
+		}
319 319
 
320
-        $action_controls = self::get_form_actions( );
320
+		$action_controls = self::get_form_actions( );
321 321
 
322
-        foreach ( $action_controls as $action_control ) {
323
-            $action_control->duplicate_form_actions( $form_id, $args['old_id'] );
324
-            unset( $action_control );
325
-        }
326
-    }
322
+		foreach ( $action_controls as $action_control ) {
323
+			$action_control->duplicate_form_actions( $form_id, $args['old_id'] );
324
+			unset( $action_control );
325
+		}
326
+	}
327 327
 
328
-    public static function limit_by_type( $where ) {
329
-        global $frm_vars, $wpdb;
328
+	public static function limit_by_type( $where ) {
329
+		global $frm_vars, $wpdb;
330 330
 
331
-        if ( ! isset( $frm_vars['action_type'] ) ) {
332
-            return $where;
333
-        }
331
+		if ( ! isset( $frm_vars['action_type'] ) ) {
332
+			return $where;
333
+		}
334 334
 
335
-        $where .= $wpdb->prepare( ' AND post_excerpt = %s ', $frm_vars['action_type'] );
336
-        return $where;
337
-    }
335
+		$where .= $wpdb->prepare( ' AND post_excerpt = %s ', $frm_vars['action_type'] );
336
+		return $where;
337
+	}
338 338
 }
339 339
 
340 340
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 		foreach ( $keys as $key ) {
362 362
 			// don't register new action if old action with the same id is already registered
363 363
 			if ( ! isset( $this->actions[ $key ] ) ) {
364
-			    $this->actions[ $key ]->_register();
364
+				$this->actions[ $key ]->_register();
365 365
 			}
366 366
 		}
367 367
 	}
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -48,17 +48,17 @@  discard block
 block discarded – undo
48 48
             'highrise'  => 'FrmDefHrsAction',
49 49
         ) );
50 50
 
51
-        include_once(FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php');
52
-        include_once(FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php');
51
+        include_once( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php' );
52
+        include_once( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php' );
53 53
 
54 54
         foreach ( $action_classes as $action_class ) {
55
-            self::$registered_actions->register($action_class);
55
+            self::$registered_actions->register( $action_class );
56 56
         }
57 57
     }
58 58
 
59 59
 	public static function get_form_actions( $action = 'all' ) {
60 60
         $temp_actions = self::$registered_actions;
61
-        if ( empty($temp_actions) ) {
61
+        if ( empty( $temp_actions ) ) {
62 62
             self::actions_init();
63 63
             $temp_actions = self::$registered_actions->actions;
64 64
         } else {
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                 return $a;
73 73
             }
74 74
 
75
-			$actions[ $a->id_base ] = $a;
75
+			$actions[$a->id_base] = $a;
76 76
         }
77 77
         unset( $temp_actions, $a );
78 78
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         arsort( $temp_actions );
87 87
         foreach ( $temp_actions as $type => $a ) {
88 88
             if ( ! isset( $a->action_options['active'] ) || empty( $a->action_options['active'] ) ) {
89
-				unset( $actions[ $type ] );
89
+				unset( $actions[$type] );
90 90
                 if ( count( $actions ) <= $action_limit ) {
91 91
                     break;
92 92
                 }
@@ -118,26 +118,26 @@  discard block
 block discarded – undo
118 118
         $action_map = array();
119 119
 
120 120
 		foreach ( $action_controls as $key => $control ) {
121
-            $action_map[ $control->id_base ] = $key;
121
+            $action_map[$control->id_base] = $key;
122 122
         }
123 123
 
124 124
     	foreach ( $form_actions as $action ) {
125
-    	    if ( ! isset( $action_map[ $action->post_excerpt ] ) ) {
125
+    	    if ( ! isset( $action_map[$action->post_excerpt] ) ) {
126 126
     	        // don't try and show settings if action no longer exists
127 127
     	        continue;
128 128
     	    }
129 129
 
130
-    		self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values );
130
+    		self::action_control( $action, $form, $action->ID, $action_controls[$action_map[$action->post_excerpt]], $values );
131 131
     	}
132 132
     }
133 133
 
134 134
 	public static function action_control( $form_action, $form, $action_key, $action_control, $values ) {
135
-        $action_control->_set($action_key);
136
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-form-actions/form_action.php');
135
+        $action_control->_set( $action_key );
136
+        include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
137 137
     }
138 138
 
139 139
     public static function add_form_action() {
140
-		FrmAppHelper::permission_check('frm_edit_forms');
140
+		FrmAppHelper::permission_check( 'frm_edit_forms' );
141 141
         check_ajax_referer( 'frm_ajax', 'nonce' );
142 142
 
143 143
         global $frm_vars;
@@ -146,55 +146,55 @@  discard block
 block discarded – undo
146 146
         $action_type = sanitize_text_field( $_POST['type'] );
147 147
 
148 148
         $action_control = self::get_form_actions( $action_type );
149
-        $action_control->_set($action_key);
149
+        $action_control->_set( $action_key );
150 150
 
151 151
         $form_id = absint( $_POST['form_id'] );
152 152
 
153
-        $form_action = $action_control->prepare_new($form_id);
153
+        $form_action = $action_control->prepare_new( $form_id );
154 154
 
155 155
         $values = array();
156
-        $form = self::fields_to_values($form_id, $values);
156
+        $form = self::fields_to_values( $form_id, $values );
157 157
 
158
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-form-actions/form_action.php');
158
+        include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
159 159
         wp_die();
160 160
     }
161 161
 
162 162
     public static function fill_action() {
163
-		FrmAppHelper::permission_check('frm_edit_forms');
163
+		FrmAppHelper::permission_check( 'frm_edit_forms' );
164 164
         check_ajax_referer( 'frm_ajax', 'nonce' );
165 165
 
166 166
         $action_key = absint( $_POST['action_id'] );
167 167
         $action_type = sanitize_text_field( $_POST['action_type'] );
168 168
 
169 169
         $action_control = self::get_form_actions( $action_type );
170
-        if ( empty($action_control) ) {
170
+        if ( empty( $action_control ) ) {
171 171
             wp_die();
172 172
         }
173 173
 
174 174
         $form_action = $action_control->get_single_action( $action_key );
175 175
 
176 176
         $values = array();
177
-        $form = self::fields_to_values($form_action->menu_order, $values);
177
+        $form = self::fields_to_values( $form_action->menu_order, $values );
178 178
 
179
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-form-actions/_action_inside.php');
179
+        include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php' );
180 180
         wp_die();
181 181
     }
182 182
 
183 183
 	private static function fields_to_values( $form_id, array &$values ) {
184
-        $form = FrmForm::getOne($form_id);
184
+        $form = FrmForm::getOne( $form_id );
185 185
 
186 186
 		$values = array( 'fields' => array(), 'id' => $form->id );
187 187
 
188
-        $fields = FrmField::get_all_for_form($form->id);
188
+        $fields = FrmField::get_all_for_form( $form->id );
189 189
         foreach ( $fields as $k => $f ) {
190 190
             $f = (array) $f;
191 191
             $opts = (array) $f['field_options'];
192
-            $f = array_merge($opts, $f);
192
+            $f = array_merge( $opts, $f );
193 193
             if ( ! isset( $f['post_field'] ) ) {
194 194
                 $f['post_field'] = '';
195 195
             }
196 196
             $values['fields'][] = $f;
197
-            unset($k, $f);
197
+            unset( $k, $f );
198 198
         }
199 199
 
200 200
         return $form;
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
         $new_actions = array();
210 210
 
211 211
         foreach ( $registered_actions as $registered_action ) {
212
-            $action_ids = $registered_action->update_callback($form_id);
212
+            $action_ids = $registered_action->update_callback( $form_id );
213 213
             if ( ! empty( $action_ids ) ) {
214 214
                 $new_actions[] = $action_ids;
215 215
             }
@@ -286,33 +286,33 @@  discard block
 block discarded – undo
286 286
             }
287 287
 
288 288
             // store actions so they can be triggered with the correct priority
289
-            $stored_actions[ $action->ID ] = $action;
290
-            $action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority'];
289
+            $stored_actions[$action->ID] = $action;
290
+            $action_priority[$action->ID] = $link_settings[$action->post_excerpt]->action_options['priority'];
291 291
 
292
-            unset($action);
292
+            unset( $action );
293 293
         }
294 294
 
295 295
         if ( ! empty( $stored_actions ) ) {
296
-            asort($action_priority);
296
+            asort( $action_priority );
297 297
 
298 298
             // make sure hooks are loaded
299 299
             new FrmNotification();
300 300
 
301 301
             foreach ( $action_priority as $action_id => $priority ) {
302
-                $action = $stored_actions[ $action_id ];
303
-                do_action('frm_trigger_'. $action->post_excerpt .'_action', $action, $entry, $form, $event);
304
-                do_action('frm_trigger_'. $action->post_excerpt .'_'. $event .'_action', $action, $entry, $form);
302
+                $action = $stored_actions[$action_id];
303
+                do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event );
304
+                do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form );
305 305
 
306 306
                 // If post is created, get updated $entry object
307 307
                 if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
308
-                    $entry = FrmEntry::getOne($entry->id, true);
308
+                    $entry = FrmEntry::getOne( $entry->id, true );
309 309
                 }
310 310
             }
311 311
         }
312 312
     }
313 313
 
314 314
 	public static function duplicate_form_actions( $form_id, $values, $args = array() ) {
315
-        if ( ! isset($args['old_id']) || empty($args['old_id']) ) {
315
+        if ( ! isset( $args['old_id'] ) || empty( $args['old_id'] ) ) {
316 316
             // continue if we know which actions to copy
317 317
             return;
318 318
         }
@@ -346,22 +346,22 @@  discard block
 block discarded – undo
346 346
 	}
347 347
 
348 348
 	public function register( $action_class ) {
349
-		$this->actions[ $action_class ] = new $action_class();
349
+		$this->actions[$action_class] = new $action_class();
350 350
 	}
351 351
 
352 352
 	public function unregister( $action_class ) {
353
-		if ( isset( $this->actions[ $action_class ] ) ) {
354
-			unset($this->actions[ $action_class ]);
353
+		if ( isset( $this->actions[$action_class] ) ) {
354
+			unset( $this->actions[$action_class] );
355 355
 		}
356 356
 	}
357 357
 
358 358
 	public function _register_actions() {
359
-		$keys = array_keys($this->actions);
359
+		$keys = array_keys( $this->actions );
360 360
 
361 361
 		foreach ( $keys as $key ) {
362 362
 			// don't register new action if old action with the same id is already registered
363
-			if ( ! isset( $this->actions[ $key ] ) ) {
364
-			    $this->actions[ $key ]->_register();
363
+			if ( ! isset( $this->actions[$key] ) ) {
364
+			    $this->actions[$key]->_register();
365 365
 			}
366 366
 		}
367 367
 	}
Please login to merge, or discard this patch.
classes/controllers/FrmFormsController.php 2 patches
Indentation   +627 added lines, -627 removed lines patch added patch discarded remove patch
@@ -2,140 +2,140 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmFormsController {
4 4
 
5
-    public static function menu() {
5
+	public static function menu() {
6 6
 		$menu_label = __( 'Forms', 'formidable' );
7 7
 		if ( ! FrmAppHelper::pro_is_installed() ) {
8 8
 			$menu_label .= ' (Lite)';
9 9
 		}
10 10
 		add_submenu_page('formidable', 'Formidable | '. $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' );
11 11
 
12
-	    add_filter('get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' );
12
+		add_filter('get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' );
13 13
 
14
-	    add_filter('manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 );
14
+		add_filter('manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 );
15 15
 		add_filter('manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' );
16
-    }
16
+	}
17 17
 
18
-    public static function head() {
19
-        wp_enqueue_script('formidable-editinplace');
18
+	public static function head() {
19
+		wp_enqueue_script('formidable-editinplace');
20 20
 
21
-        if ( wp_is_mobile() ) {
22
-    		wp_enqueue_script( 'jquery-touch-punch' );
23
-    	}
24
-    }
21
+		if ( wp_is_mobile() ) {
22
+			wp_enqueue_script( 'jquery-touch-punch' );
23
+		}
24
+	}
25 25
 
26
-    public static function register_widgets() {
27
-        require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php');
28
-        register_widget('FrmShowForm');
29
-    }
26
+	public static function register_widgets() {
27
+		require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php');
28
+		register_widget('FrmShowForm');
29
+	}
30 30
 
31
-    public static function list_form() {
32
-        FrmAppHelper::permission_check('frm_view_forms');
31
+	public static function list_form() {
32
+		FrmAppHelper::permission_check('frm_view_forms');
33 33
 
34 34
 		$params = FrmForm::list_page_params();
35
-        $errors = self::process_bulk_form_actions( array());
36
-        $errors = apply_filters('frm_admin_list_form_action', $errors);
35
+		$errors = self::process_bulk_form_actions( array());
36
+		$errors = apply_filters('frm_admin_list_form_action', $errors);
37 37
 
38 38
 		return self::display_forms_list( $params, '', $errors );
39
-    }
39
+	}
40 40
 
41 41
 	public static function new_form( $values = array() ) {
42
-        FrmAppHelper::permission_check('frm_edit_forms');
42
+		FrmAppHelper::permission_check('frm_edit_forms');
43 43
 
44
-        global $frm_vars;
44
+		global $frm_vars;
45 45
 
46
-        $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
46
+		$action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
47 47
 		$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ];
48 48
 
49 49
 		if ( $action == 'create' ) {
50
-            return self::create($values);
50
+			return self::create($values);
51 51
 		} else if ( $action == 'new' ) {
52 52
 			$frm_field_selection = FrmField::field_selection();
53
-            $values = FrmFormsHelper::setup_new_vars($values);
54
-            $id = FrmForm::create( $values );
55
-            $form = FrmForm::getOne($id);
53
+			$values = FrmFormsHelper::setup_new_vars($values);
54
+			$id = FrmForm::create( $values );
55
+			$form = FrmForm::getOne($id);
56 56
 
57
-            // add default email notification
58
-            $action_control = FrmFormActionsController::get_form_actions( 'email' );
59
-            $action_control->create($form->id);
57
+			// add default email notification
58
+			$action_control = FrmFormActionsController::get_form_actions( 'email' );
59
+			$action_control->create($form->id);
60 60
 
61 61
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
62 62
 
63
-            $values['id'] = $id;
64
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
65
-        }
66
-    }
63
+			$values['id'] = $id;
64
+			require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
65
+		}
66
+	}
67 67
 
68 68
 	public static function create( $values = array() ) {
69
-        FrmAppHelper::permission_check('frm_edit_forms');
69
+		FrmAppHelper::permission_check('frm_edit_forms');
70 70
 
71
-        global $frm_vars;
72
-        if ( empty( $values ) ) {
73
-            $values = $_POST;
74
-        }
71
+		global $frm_vars;
72
+		if ( empty( $values ) ) {
73
+			$values = $_POST;
74
+		}
75 75
 
76
-        //Set radio button and checkbox meta equal to "other" value
77
-        if ( FrmAppHelper::pro_is_installed() ) {
78
-            $values = FrmProEntry::mod_other_vals( $values, 'back' );
79
-        }
76
+		//Set radio button and checkbox meta equal to "other" value
77
+		if ( FrmAppHelper::pro_is_installed() ) {
78
+			$values = FrmProEntry::mod_other_vals( $values, 'back' );
79
+		}
80 80
 
81 81
 		$id = isset($values['id']) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
82 82
 
83
-        if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
84
-            $frm_settings = FrmAppHelper::get_settings();
85
-            $errors = array( 'form' => $frm_settings->admin_permission );
86
-        } else {
87
-            $errors = FrmForm::validate($values);
88
-        }
83
+		if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
84
+			$frm_settings = FrmAppHelper::get_settings();
85
+			$errors = array( 'form' => $frm_settings->admin_permission );
86
+		} else {
87
+			$errors = FrmForm::validate($values);
88
+		}
89 89
 
90
-        if ( count($errors) > 0 ) {
91
-            $hide_preview = true;
90
+		if ( count($errors) > 0 ) {
91
+			$hide_preview = true;
92 92
 			$frm_field_selection = FrmField::field_selection();
93
-            $form = FrmForm::getOne( $id );
94
-            $fields = FrmField::get_all_for_form($id);
93
+			$form = FrmForm::getOne( $id );
94
+			$fields = FrmField::get_all_for_form($id);
95 95
 
96
-            $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
96
+			$values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
97 97
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
98 98
 
99
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
100
-        } else {
101
-            FrmForm::update( $id, $values, true );
102
-            die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id='. $id)));
103
-        }
104
-    }
99
+			require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
100
+		} else {
101
+			FrmForm::update( $id, $values, true );
102
+			die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id='. $id)));
103
+		}
104
+	}
105 105
 
106
-    public static function edit( $values = false ) {
107
-        FrmAppHelper::permission_check('frm_edit_forms');
106
+	public static function edit( $values = false ) {
107
+		FrmAppHelper::permission_check('frm_edit_forms');
108 108
 
109 109
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
110
-        return self::get_edit_vars($id);
111
-    }
110
+		return self::get_edit_vars($id);
111
+	}
112 112
 
113
-    public static function settings( $id = false, $message = '' ) {
114
-        FrmAppHelper::permission_check('frm_edit_forms');
113
+	public static function settings( $id = false, $message = '' ) {
114
+		FrmAppHelper::permission_check('frm_edit_forms');
115 115
 
116
-        if ( ! $id || ! is_numeric($id) ) {
116
+		if ( ! $id || ! is_numeric($id) ) {
117 117
 			$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
118
-        }
118
+		}
119 119
 		return self::get_settings_vars( $id, array(), $message );
120
-    }
120
+	}
121 121
 
122
-    public static function update_settings() {
123
-        FrmAppHelper::permission_check('frm_edit_forms');
122
+	public static function update_settings() {
123
+		FrmAppHelper::permission_check('frm_edit_forms');
124 124
 
125 125
 		$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
126 126
 
127
-        $errors = FrmForm::validate($_POST);
128
-        if ( count($errors) > 0 ) {
129
-            return self::get_settings_vars($id, $errors);
130
-        }
127
+		$errors = FrmForm::validate($_POST);
128
+		if ( count($errors) > 0 ) {
129
+			return self::get_settings_vars($id, $errors);
130
+		}
131 131
 
132
-        do_action('frm_before_update_form_settings', $id);
132
+		do_action('frm_before_update_form_settings', $id);
133 133
 
134 134
 		FrmForm::update( $id, $_POST );
135 135
 
136
-        $message = __( 'Settings Successfully Updated', 'formidable' );
136
+		$message = __( 'Settings Successfully Updated', 'formidable' );
137 137
 		return self::get_settings_vars( $id, array(), $message );
138
-    }
138
+	}
139 139
 
140 140
 	public static function edit_key() {
141 141
 		$values = self::edit_in_place_value( 'form_key' );
@@ -165,43 +165,43 @@  discard block
 block discarded – undo
165 165
 
166 166
 	public static function update( $values = array() ) {
167 167
 		if ( empty( $values ) ) {
168
-            $values = $_POST;
169
-        }
168
+			$values = $_POST;
169
+		}
170 170
 
171
-        //Set radio button and checkbox meta equal to "other" value
172
-        if ( FrmAppHelper::pro_is_installed() ) {
173
-            $values = FrmProEntry::mod_other_vals( $values, 'back' );
174
-        }
171
+		//Set radio button and checkbox meta equal to "other" value
172
+		if ( FrmAppHelper::pro_is_installed() ) {
173
+			$values = FrmProEntry::mod_other_vals( $values, 'back' );
174
+		}
175 175
 
176
-        $errors = FrmForm::validate( $values );
177
-        $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' );
178
-        if ( $permission_error !== false ) {
179
-            $errors['form'] = $permission_error;
180
-        }
176
+		$errors = FrmForm::validate( $values );
177
+		$permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'frm_save_form', 'frm_save_form_nonce' );
178
+		if ( $permission_error !== false ) {
179
+			$errors['form'] = $permission_error;
180
+		}
181 181
 
182 182
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
183 183
 
184 184
 		if ( count( $errors ) > 0 ) {
185
-            return self::get_edit_vars( $id, $errors );
185
+			return self::get_edit_vars( $id, $errors );
186 186
 		} else {
187
-            FrmForm::update( $id, $values );
188
-            $message = __( 'Form was Successfully Updated', 'formidable' );
189
-            if ( defined( 'DOING_AJAX' ) ) {
187
+			FrmForm::update( $id, $values );
188
+			$message = __( 'Form was Successfully Updated', 'formidable' );
189
+			if ( defined( 'DOING_AJAX' ) ) {
190 190
 				wp_die( $message );
191
-            }
191
+			}
192 192
 			return self::get_edit_vars( $id, array(), $message );
193
-        }
194
-    }
193
+		}
194
+	}
195 195
 
196
-    public static function bulk_create_template( $ids ) {
197
-        FrmAppHelper::permission_check( 'frm_edit_forms' );
196
+	public static function bulk_create_template( $ids ) {
197
+		FrmAppHelper::permission_check( 'frm_edit_forms' );
198 198
 
199
-        foreach ( $ids as $id ) {
200
-            FrmForm::duplicate( $id, true, true );
201
-        }
199
+		foreach ( $ids as $id ) {
200
+			FrmForm::duplicate( $id, true, true );
201
+		}
202 202
 
203
-        return __( 'Form template was Successfully Created', 'formidable' );
204
-    }
203
+		return __( 'Form template was Successfully Created', 'formidable' );
204
+	}
205 205
 
206 206
 	/**
207 207
 	 * Redirect to the url for creating from a template
@@ -223,45 +223,45 @@  discard block
 block discarded – undo
223 223
 		wp_die();
224 224
 	}
225 225
 
226
-    public static function duplicate() {
227
-        FrmAppHelper::permission_check('frm_edit_forms');
226
+	public static function duplicate() {
227
+		FrmAppHelper::permission_check('frm_edit_forms');
228 228
 
229 229
 		$params = FrmForm::list_page_params();
230
-        $form = FrmForm::duplicate( $params['id'], $params['template'], true );
231
-        $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
232
-        if ( $form ) {
230
+		$form = FrmForm::duplicate( $params['id'], $params['template'], true );
231
+		$message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
232
+		if ( $form ) {
233 233
 			return self::get_edit_vars( $form, array(), $message, true );
234
-        } else {
235
-            return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' ));
236
-        }
237
-    }
234
+		} else {
235
+			return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' ));
236
+		}
237
+	}
238 238
 
239
-    public static function page_preview() {
239
+	public static function page_preview() {
240 240
 		$params = FrmForm::list_page_params();
241
-        if ( ! $params['form'] ) {
242
-            return;
243
-        }
244
-
245
-        $form = FrmForm::getOne( $params['form'] );
246
-        if ( ! $form ) {
247
-            return;
248
-        }
249
-        return self::show_form( $form->id, '', true, true );
250
-    }
251
-
252
-    public static function preview() {
253
-        do_action( 'frm_wp' );
254
-
255
-        global $frm_vars;
256
-        $frm_vars['preview'] = true;
257
-
258
-        if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) {
259
-            global $wp;
260
-            $root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
261
-            include_once( $root.'/wp-config.php' );
262
-            $wp->init();
263
-            $wp->register_globals();
264
-        }
241
+		if ( ! $params['form'] ) {
242
+			return;
243
+		}
244
+
245
+		$form = FrmForm::getOne( $params['form'] );
246
+		if ( ! $form ) {
247
+			return;
248
+		}
249
+		return self::show_form( $form->id, '', true, true );
250
+	}
251
+
252
+	public static function preview() {
253
+		do_action( 'frm_wp' );
254
+
255
+		global $frm_vars;
256
+		$frm_vars['preview'] = true;
257
+
258
+		if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) {
259
+			global $wp;
260
+			$root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
261
+			include_once( $root.'/wp-config.php' );
262
+			$wp->init();
263
+			$wp->register_globals();
264
+		}
265 265
 
266 266
 		self::register_pro_scripts();
267 267
 
@@ -275,11 +275,11 @@  discard block
 block discarded – undo
275 275
 		$form = FrmForm::getAll( array( 'form_key' => $key ), '', 1 );
276 276
 		if ( empty( $form ) ) {
277 277
 			$form = FrmForm::getAll( array(), '', 1 );
278
-        }
278
+		}
279 279
 
280
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/direct.php');
281
-        wp_die();
282
-    }
280
+		require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/direct.php');
281
+		wp_die();
282
+	}
283 283
 
284 284
 	public static function register_pro_scripts() {
285 285
 		if ( FrmAppHelper::pro_is_installed() ) {
@@ -289,22 +289,22 @@  discard block
 block discarded – undo
289 289
 		}
290 290
 	}
291 291
 
292
-    public static function untrash() {
292
+	public static function untrash() {
293 293
 		self::change_form_status( 'untrash' );
294
-    }
294
+	}
295 295
 
296 296
 	public static function bulk_untrash( $ids ) {
297
-        FrmAppHelper::permission_check('frm_edit_forms');
297
+		FrmAppHelper::permission_check('frm_edit_forms');
298 298
 
299
-        $count = FrmForm::set_status( $ids, 'published' );
299
+		$count = FrmForm::set_status( $ids, 'published' );
300 300
 
301
-        $message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
302
-        return $message;
303
-    }
301
+		$message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
302
+		return $message;
303
+	}
304 304
 
305
-    public static function trash() {
305
+	public static function trash() {
306 306
 		self::change_form_status( 'trash' );
307
-    }
307
+	}
308 308
 
309 309
 	/**
310 310
 	 * @param string $status
@@ -342,68 +342,68 @@  discard block
 block discarded – undo
342 342
 	}
343 343
 
344 344
 	public static function bulk_trash( $ids ) {
345
-        FrmAppHelper::permission_check('frm_delete_forms');
345
+		FrmAppHelper::permission_check('frm_delete_forms');
346 346
 
347
-        $count = 0;
348
-        foreach ( $ids as $id ) {
349
-            if ( FrmForm::trash( $id ) ) {
350
-                $count++;
351
-            }
352
-        }
347
+		$count = 0;
348
+		foreach ( $ids as $id ) {
349
+			if ( FrmForm::trash( $id ) ) {
350
+				$count++;
351
+			}
352
+		}
353 353
 
354
-        $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
355
-        $message = sprintf(_n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="'. esc_url(wp_nonce_url( '?page=formidable&frm_action=list&action=bulk_untrash&form_type='. $current_page .'&item-action[]='. implode('item-action[]=', $ids), 'bulk-toplevel_page_formidable' )) .'">', '</a>' );
354
+		$current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
355
+		$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>' );
356 356
 
357
-        return $message;
358
-    }
357
+		return $message;
358
+	}
359 359
 
360
-    public static function destroy() {
361
-        FrmAppHelper::permission_check('frm_delete_forms');
360
+	public static function destroy() {
361
+		FrmAppHelper::permission_check('frm_delete_forms');
362 362
 
363 363
 		$params = FrmForm::list_page_params();
364 364
 
365
-        //check nonce url
366
-        check_admin_referer('destroy_form_' . $params['id']);
365
+		//check nonce url
366
+		check_admin_referer('destroy_form_' . $params['id']);
367 367
 
368
-        $count = 0;
369
-        if ( FrmForm::destroy( $params['id'] ) ) {
370
-            $count++;
371
-        }
368
+		$count = 0;
369
+		if ( FrmForm::destroy( $params['id'] ) ) {
370
+			$count++;
371
+		}
372 372
 
373
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
373
+		$message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
374 374
 
375 375
 		self::display_forms_list( $params, $message );
376
-    }
376
+	}
377 377
 
378 378
 	public static function bulk_destroy( $ids ) {
379
-        FrmAppHelper::permission_check('frm_delete_forms');
379
+		FrmAppHelper::permission_check('frm_delete_forms');
380 380
 
381
-        $count = 0;
382
-        foreach ( $ids as $id ) {
383
-            $d = FrmForm::destroy( $id );
384
-            if ( $d ) {
385
-                $count++;
386
-            }
387
-        }
381
+		$count = 0;
382
+		foreach ( $ids as $id ) {
383
+			$d = FrmForm::destroy( $id );
384
+			if ( $d ) {
385
+				$count++;
386
+			}
387
+		}
388 388
 
389
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
389
+		$message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
390 390
 
391
-        return $message;
392
-    }
391
+		return $message;
392
+	}
393 393
 
394
-    private static function delete_all() {
395
-        //check nonce url
396
-        $permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable');
397
-        if ( $permission_error !== false ) {
394
+	private static function delete_all() {
395
+		//check nonce url
396
+		$permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable');
397
+		if ( $permission_error !== false ) {
398 398
 			self::display_forms_list( array(), '', array( $permission_error ) );
399
-            return;
400
-        }
399
+			return;
400
+		}
401 401
 
402 402
 		$count = FrmForm::scheduled_delete( time() );
403
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
403
+		$message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
404 404
 
405 405
 		self::display_forms_list( array(), $message );
406
-    }
406
+	}
407 407
 
408 408
 	public static function scheduled_delete( $delete_timestamp = '' ) {
409 409
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::scheduled_delete' );
@@ -411,11 +411,11 @@  discard block
 block discarded – undo
411 411
 	}
412 412
 
413 413
 	/**
414
-	* Inserts Formidable button
415
-	* Hook exists since 2.5.0
416
-	*
417
-	* @since 2.0.15
418
-	*/
414
+	 * Inserts Formidable button
415
+	 * Hook exists since 2.5.0
416
+	 *
417
+	 * @since 2.0.15
418
+	 */
419 419
 	public static function insert_form_button() {
420 420
 		if ( current_user_can('frm_view_forms') ) {
421 421
 			$frm_settings = FrmAppHelper::get_settings();
@@ -424,49 +424,49 @@  discard block
 block discarded – undo
424 424
 		}
425 425
 	}
426 426
 
427
-    public static function insert_form_popup() {
427
+	public static function insert_form_popup() {
428 428
 		$page = basename( FrmAppHelper::get_server_value( 'PHP_SELF' ) );
429 429
 		if ( ! in_array( $page, array( 'post.php', 'page.php', 'page-new.php', 'post-new.php' ) ) ) {
430
-            return;
431
-        }
430
+			return;
431
+		}
432 432
 
433
-        FrmAppHelper::load_admin_wide_js();
433
+		FrmAppHelper::load_admin_wide_js();
434 434
 
435
-        $shortcodes = array(
435
+		$shortcodes = array(
436 436
 			'formidable' => array( 'name' => __( 'Form', 'formidable' ), 'label' => __( 'Insert a Form', 'formidable' ) ),
437
-        );
437
+		);
438 438
 
439
-        $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes);
439
+		$shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes);
440 440
 
441
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/insert_form_popup.php');
442
-    }
441
+		include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/insert_form_popup.php');
442
+	}
443 443
 
444
-    public static function get_shortcode_opts() {
444
+	public static function get_shortcode_opts() {
445 445
 		FrmAppHelper::permission_check('frm_view_forms');
446
-        check_ajax_referer( 'frm_ajax', 'nonce' );
446
+		check_ajax_referer( 'frm_ajax', 'nonce' );
447 447
 
448 448
 		$shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' );
449
-        if ( empty($shortcode) ) {
450
-            wp_die();
451
-        }
449
+		if ( empty($shortcode) ) {
450
+			wp_die();
451
+		}
452 452
 
453
-        echo '<div id="sc-opts-'. esc_attr( $shortcode ) .'" class="frm_shortcode_option">';
454
-        echo '<input type="radio" name="frmsc" value="'. esc_attr($shortcode) .'" id="sc-'. esc_attr($shortcode) .'" class="frm_hidden" />';
453
+		echo '<div id="sc-opts-'. esc_attr( $shortcode ) .'" class="frm_shortcode_option">';
454
+		echo '<input type="radio" name="frmsc" value="'. esc_attr($shortcode) .'" id="sc-'. esc_attr($shortcode) .'" class="frm_hidden" />';
455 455
 
456
-        $form_id = '';
457
-        $opts = array();
456
+		$form_id = '';
457
+		$opts = array();
458 458
 		switch ( $shortcode ) {
459
-            case 'formidable':
460
-                $opts = array(
459
+			case 'formidable':
460
+				$opts = array(
461 461
 					'form_id'       => 'id',
462
-                    //'key' => ',
462
+					//'key' => ',
463 463
 					'title'         => array( 'val' => 1, 'label' => __( 'Display form title', 'formidable' ) ),
464 464
 					'description'   => array( 'val' => 1, 'label' => __( 'Display form description', 'formidable' ) ),
465 465
 					'minimize'      => array( 'val' => 1, 'label' => __( 'Minimize form HTML', 'formidable' ) ),
466
-                );
467
-            break;
468
-        }
469
-        $opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode);
466
+				);
467
+			break;
468
+		}
469
+		$opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode);
470 470
 
471 471
 		if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) {
472 472
 			// allow other shortcodes to use the required form id option
@@ -474,63 +474,63 @@  discard block
 block discarded – undo
474 474
 			unset( $opts['form_id'] );
475 475
 		}
476 476
 
477
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/shortcode_opts.php');
477
+		include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/shortcode_opts.php');
478 478
 
479
-        echo '</div>';
479
+		echo '</div>';
480 480
 
481
-        wp_die();
482
-    }
481
+		wp_die();
482
+	}
483 483
 
484 484
 	public static function display_forms_list( $params = array(), $message = '', $errors = array(), $deprecated_errors = array() ) {
485
-        FrmAppHelper::permission_check( 'frm_view_forms' );
485
+		FrmAppHelper::permission_check( 'frm_view_forms' );
486 486
 		if ( ! empty( $deprecated_errors ) ) {
487 487
 			$errors = $deprecated_errors;
488 488
 			_deprecated_argument( 'errors', '2.0.8' );
489 489
 		}
490 490
 
491
-        global $wpdb, $frm_vars;
491
+		global $wpdb, $frm_vars;
492 492
 
493 493
 		if ( empty( $params ) ) {
494 494
 			$params = FrmForm::list_page_params();
495
-        }
495
+		}
496 496
 
497
-        $wp_list_table = new FrmFormsListHelper( compact( 'params' ) );
497
+		$wp_list_table = new FrmFormsListHelper( compact( 'params' ) );
498 498
 
499
-        $pagenum = $wp_list_table->get_pagenum();
499
+		$pagenum = $wp_list_table->get_pagenum();
500 500
 
501
-        $wp_list_table->prepare_items();
501
+		$wp_list_table->prepare_items();
502 502
 
503
-        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
504
-        if ( $pagenum > $total_pages && $total_pages > 0 ) {
503
+		$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
504
+		if ( $pagenum > $total_pages && $total_pages > 0 ) {
505 505
 			wp_redirect( esc_url_raw( add_query_arg( 'paged', $total_pages ) ) );
506
-            die();
507
-        }
506
+			die();
507
+		}
508 508
 
509
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/list.php');
510
-    }
509
+		require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/list.php');
510
+	}
511 511
 
512 512
 	public static function get_columns( $columns ) {
513
-	    $columns['cb'] = '<input type="checkbox" />';
514
-	    $columns['id'] = 'ID';
513
+		$columns['cb'] = '<input type="checkbox" />';
514
+		$columns['id'] = 'ID';
515 515
 
516
-        $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : 'published';
516
+		$type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : 'published';
517 517
 
518
-        if ( 'template' == $type ) {
519
-            $columns['name']        = __( 'Template Name', 'formidable' );
520
-            $columns['type']        = __( 'Type', 'formidable' );
521
-            $columns['form_key']    = __( 'Key', 'formidable' );
522
-        } else {
523
-            $columns['name']        = __( 'Form Title', 'formidable' );
524
-            $columns['entries']     = __( 'Entries', 'formidable' );
525
-            $columns['form_key']    = __( 'Key', 'formidable' );
526
-            $columns['shortcode']   = __( 'Shortcodes', 'formidable' );
527
-        }
518
+		if ( 'template' == $type ) {
519
+			$columns['name']        = __( 'Template Name', 'formidable' );
520
+			$columns['type']        = __( 'Type', 'formidable' );
521
+			$columns['form_key']    = __( 'Key', 'formidable' );
522
+		} else {
523
+			$columns['name']        = __( 'Form Title', 'formidable' );
524
+			$columns['entries']     = __( 'Entries', 'formidable' );
525
+			$columns['form_key']    = __( 'Key', 'formidable' );
526
+			$columns['shortcode']   = __( 'Shortcodes', 'formidable' );
527
+		}
528 528
 
529
-        $columns['created_at'] = __( 'Date', 'formidable' );
529
+		$columns['created_at'] = __( 'Date', 'formidable' );
530 530
 
531 531
 		add_screen_option( 'per_page', array( 'label' => __( 'Forms', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_per_page' ) );
532 532
 
533
-        return $columns;
533
+		return $columns;
534 534
 	}
535 535
 
536 536
 	public static function get_sortable_columns() {
@@ -544,110 +544,110 @@  discard block
 block discarded – undo
544 544
 	}
545 545
 
546 546
 	public static function hidden_columns( $result ) {
547
-        $return = false;
548
-        foreach ( (array) $result as $r ) {
549
-            if ( ! empty( $r ) ) {
550
-                $return = true;
551
-                break;
552
-            }
553
-        }
547
+		$return = false;
548
+		foreach ( (array) $result as $r ) {
549
+			if ( ! empty( $r ) ) {
550
+				$return = true;
551
+				break;
552
+			}
553
+		}
554 554
 
555
-        if ( $return ) {
556
-            return $result;
555
+		if ( $return ) {
556
+			return $result;
557 557
 		}
558 558
 
559
-        $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
559
+		$type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
560 560
 
561
-        $result[] = 'created_at';
562
-        if ( $type == 'template' ) {
563
-            $result[] = 'id';
564
-            $result[] = 'form_key';
565
-        }
561
+		$result[] = 'created_at';
562
+		if ( $type == 'template' ) {
563
+			$result[] = 'id';
564
+			$result[] = 'form_key';
565
+		}
566 566
 
567
-        return $result;
568
-    }
567
+		return $result;
568
+	}
569 569
 
570 570
 	public static function save_per_page( $save, $option, $value ) {
571
-        if ( $option == 'formidable_page_formidable_per_page' ) {
572
-            $save = (int) $value;
573
-        }
574
-        return $save;
575
-    }
571
+		if ( $option == 'formidable_page_formidable_per_page' ) {
572
+			$save = (int) $value;
573
+		}
574
+		return $save;
575
+	}
576 576
 
577 577
 	private static function get_edit_vars( $id, $errors = array(), $message = '', $create_link = false ) {
578
-        global $frm_vars;
578
+		global $frm_vars;
579 579
 
580
-        $form = FrmForm::getOne( $id );
581
-        if ( ! $form ) {
582
-            wp_die( __( 'You are trying to edit a form that does not exist.', 'formidable' ) );
583
-        }
580
+		$form = FrmForm::getOne( $id );
581
+		if ( ! $form ) {
582
+			wp_die( __( 'You are trying to edit a form that does not exist.', 'formidable' ) );
583
+		}
584 584
 
585
-        if ( $form->parent_form_id ) {
585
+		if ( $form->parent_form_id ) {
586 586
 			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>' ));
587
-        }
587
+		}
588 588
 
589 589
 		$frm_field_selection = FrmField::field_selection();
590
-        $fields = FrmField::get_all_for_form($form->id);
590
+		$fields = FrmField::get_all_for_form($form->id);
591 591
 
592
-        // Automatically add end section fields if they don't exist (2.0 migration)
593
-        $reset_fields = false;
594
-        FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields );
592
+		// Automatically add end section fields if they don't exist (2.0 migration)
593
+		$reset_fields = false;
594
+		FrmFormsHelper::auto_add_end_section_fields( $form, $fields, $reset_fields );
595 595
 
596
-        if ( $reset_fields ) {
597
-            $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
598
-        }
596
+		if ( $reset_fields ) {
597
+			$fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
598
+		}
599 599
 
600
-        unset($end_section_values, $last_order, $open, $reset_fields);
600
+		unset($end_section_values, $last_order, $open, $reset_fields);
601 601
 
602
-        $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
602
+		$values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
603 603
 
604
-        $edit_message = __( 'Form was Successfully Updated', 'formidable' );
605
-        if ( $form->is_template && $message == $edit_message ) {
606
-            $message = __( 'Template was Successfully Updated', 'formidable' );
607
-        }
604
+		$edit_message = __( 'Form was Successfully Updated', 'formidable' );
605
+		if ( $form->is_template && $message == $edit_message ) {
606
+			$message = __( 'Template was Successfully Updated', 'formidable' );
607
+		}
608 608
 
609 609
 		$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
610 610
 
611
-        if ( $form->default_template ) {
612
-            wp_die(__( 'That template cannot be edited', 'formidable' ));
613
-        } else if ( defined('DOING_AJAX') ) {
614
-            wp_die();
615
-        } else if ( $create_link ) {
616
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
617
-        } else {
618
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/edit.php');
619
-        }
620
-    }
611
+		if ( $form->default_template ) {
612
+			wp_die(__( 'That template cannot be edited', 'formidable' ));
613
+		} else if ( defined('DOING_AJAX') ) {
614
+			wp_die();
615
+		} else if ( $create_link ) {
616
+			require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
617
+		} else {
618
+			require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/edit.php');
619
+		}
620
+	}
621 621
 
622 622
 	public static function get_settings_vars( $id, $errors = array(), $message = '' ) {
623 623
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
624 624
 
625
-        global $frm_vars;
625
+		global $frm_vars;
626 626
 
627
-        $form = FrmForm::getOne( $id );
627
+		$form = FrmForm::getOne( $id );
628 628
 
629
-        $fields = FrmField::get_all_for_form($id);
630
-        $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
629
+		$fields = FrmField::get_all_for_form($id);
630
+		$values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
631 631
 
632
-        if ( isset($values['default_template']) && $values['default_template'] ) {
633
-            wp_die(__( 'That template cannot be edited', 'formidable' ));
634
-        }
632
+		if ( isset($values['default_template']) && $values['default_template'] ) {
633
+			wp_die(__( 'That template cannot be edited', 'formidable' ));
634
+		}
635 635
 
636
-        $action_controls = FrmFormActionsController::get_form_actions();
636
+		$action_controls = FrmFormActionsController::get_form_actions();
637 637
 
638
-        $sections = apply_filters('frm_add_form_settings_section', array(), $values);
639
-        $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
638
+		$sections = apply_filters('frm_add_form_settings_section', array(), $values);
639
+		$pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
640 640
 
641
-        $styles = apply_filters('frm_get_style_opts', array());
641
+		$styles = apply_filters('frm_get_style_opts', array());
642 642
 
643
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/settings.php');
644
-    }
643
+		require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/settings.php');
644
+	}
645 645
 
646
-    public static function mb_tags_box( $form_id, $class = '' ) {
647
-        $fields = FrmField::get_all_for_form($form_id, '', 'include');
648
-        $linked_forms = array();
649
-        $col = 'one';
650
-        $settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false;
646
+	public static function mb_tags_box( $form_id, $class = '' ) {
647
+		$fields = FrmField::get_all_for_form($form_id, '', 'include');
648
+		$linked_forms = array();
649
+		$col = 'one';
650
+		$settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false;
651 651
 
652 652
 		$cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() );
653 653
 		$adv_shortcodes = self::get_advanced_shortcodes();
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 		$entry_shortcodes = self::get_shortcode_helpers( $settings_tab );
656 656
 
657 657
 		include( FrmAppHelper::plugin_path() . '/classes/views/shared/mb_adv_info.php' );
658
-    }
658
+	}
659 659
 
660 660
 	/**
661 661
 	 * Get an array of the options to display in the advanced tab
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 			''          => '',
697 697
 			'siteurl'   => __( 'Site URL', 'formidable' ),
698 698
 			'sitename'  => __( 'Site Name', 'formidable' ),
699
-        );
699
+		);
700 700
 
701 701
 		if ( ! FrmAppHelper::pro_is_installed() ) {
702 702
 			unset( $entry_shortcodes['post_id'] );
@@ -723,39 +723,39 @@  discard block
 block discarded – undo
723 723
 		return $entry_shortcodes;
724 724
 	}
725 725
 
726
-    // Insert the form class setting into the form
726
+	// Insert the form class setting into the form
727 727
 	public static function form_classes( $form ) {
728
-        if ( isset($form->options['form_class']) ) {
728
+		if ( isset($form->options['form_class']) ) {
729 729
 			echo esc_attr( sanitize_text_field( $form->options['form_class'] ) );
730
-        }
731
-    }
730
+		}
731
+	}
732 732
 
733
-    public static function get_email_html() {
733
+	public static function get_email_html() {
734 734
 		FrmAppHelper::permission_check('frm_view_forms');
735
-        check_ajax_referer( 'frm_ajax', 'nonce' );
735
+		check_ajax_referer( 'frm_ajax', 'nonce' );
736 736
 		echo FrmEntryFormat::show_entry( array(
737 737
 			'form_id'       => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ),
738
-	        'default_email' => true,
738
+			'default_email' => true,
739 739
 			'plain_text'    => FrmAppHelper::get_post_param( 'plain_text', '', 'absint' ),
740
-	    ) );
741
-	    wp_die();
740
+		) );
741
+		wp_die();
742 742
 	}
743 743
 
744
-    public static function filter_content( $content, $form, $entry = false ) {
744
+	public static function filter_content( $content, $form, $entry = false ) {
745 745
 		self::get_entry_by_param( $entry );
746
-        if ( ! $entry ) {
747
-            return $content;
748
-        }
746
+		if ( ! $entry ) {
747
+			return $content;
748
+		}
749 749
 
750
-        if ( is_object( $form ) ) {
751
-            $form = $form->id;
752
-        }
750
+		if ( is_object( $form ) ) {
751
+			$form = $form->id;
752
+		}
753 753
 
754
-        $shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form );
755
-        $content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes );
754
+		$shortcodes = FrmFieldsHelper::get_shortcodes( $content, $form );
755
+		$content = apply_filters( 'frm_replace_content_shortcodes', $content, $entry, $shortcodes );
756 756
 
757
-        return $content;
758
-    }
757
+		return $content;
758
+	}
759 759
 
760 760
 	private static function get_entry_by_param( &$entry ) {
761 761
 		if ( ! $entry || ! is_object( $entry ) ) {
@@ -767,287 +767,287 @@  discard block
 block discarded – undo
767 767
 		}
768 768
 	}
769 769
 
770
-    public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
771
-        return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes );
772
-    }
770
+	public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
771
+		return FrmFieldsHelper::replace_content_shortcodes( $content, $entry, $shortcodes );
772
+	}
773 773
 
774
-    public static function process_bulk_form_actions( $errors ) {
775
-        if ( ! $_REQUEST ) {
776
-            return $errors;
777
-        }
774
+	public static function process_bulk_form_actions( $errors ) {
775
+		if ( ! $_REQUEST ) {
776
+			return $errors;
777
+		}
778 778
 
779 779
 		$bulkaction = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
780
-        if ( $bulkaction == -1 ) {
780
+		if ( $bulkaction == -1 ) {
781 781
 			$bulkaction = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
782
-        }
783
-
784
-        if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) {
785
-            FrmAppHelper::remove_get_action();
786
-
787
-            $bulkaction = str_replace( 'bulk_', '', $bulkaction );
788
-        }
789
-
790
-        $ids = FrmAppHelper::get_param( 'item-action', '' );
791
-        if ( empty( $ids ) ) {
792
-            $errors[] = __( 'No forms were specified', 'formidable' );
793
-            return $errors;
794
-        }
795
-
796
-        $permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' );
797
-        if ( $permission_error !== false ) {
798
-            $errors[] = $permission_error;
799
-            return $errors;
800
-        }
801
-
802
-        if ( ! is_array( $ids ) ) {
803
-            $ids = explode( ',', $ids );
804
-        }
805
-
806
-        switch ( $bulkaction ) {
807
-            case 'delete':
808
-                $message = self::bulk_destroy( $ids );
809
-            break;
810
-            case 'trash':
811
-                $message = self::bulk_trash( $ids );
812
-            break;
813
-            case 'untrash':
814
-                $message = self::bulk_untrash( $ids );
815
-            break;
816
-            case 'create_template':
817
-                $message = self::bulk_create_template( $ids );
818
-            break;
819
-        }
820
-
821
-        if ( isset( $message ) && ! empty( $message ) ) {
782
+		}
783
+
784
+		if ( ! empty( $bulkaction ) && strpos( $bulkaction, 'bulk_' ) === 0 ) {
785
+			FrmAppHelper::remove_get_action();
786
+
787
+			$bulkaction = str_replace( 'bulk_', '', $bulkaction );
788
+		}
789
+
790
+		$ids = FrmAppHelper::get_param( 'item-action', '' );
791
+		if ( empty( $ids ) ) {
792
+			$errors[] = __( 'No forms were specified', 'formidable' );
793
+			return $errors;
794
+		}
795
+
796
+		$permission_error = FrmAppHelper::permission_nonce_error( '', '_wpnonce', 'bulk-toplevel_page_formidable' );
797
+		if ( $permission_error !== false ) {
798
+			$errors[] = $permission_error;
799
+			return $errors;
800
+		}
801
+
802
+		if ( ! is_array( $ids ) ) {
803
+			$ids = explode( ',', $ids );
804
+		}
805
+
806
+		switch ( $bulkaction ) {
807
+			case 'delete':
808
+				$message = self::bulk_destroy( $ids );
809
+			break;
810
+			case 'trash':
811
+				$message = self::bulk_trash( $ids );
812
+			break;
813
+			case 'untrash':
814
+				$message = self::bulk_untrash( $ids );
815
+			break;
816
+			case 'create_template':
817
+				$message = self::bulk_create_template( $ids );
818
+			break;
819
+		}
820
+
821
+		if ( isset( $message ) && ! empty( $message ) ) {
822 822
 			echo '<div id="message" class="updated frm_msg_padding">' . FrmAppHelper::kses( $message ) . '</div>';
823
-        }
823
+		}
824 824
 
825
-        return $errors;
826
-    }
825
+		return $errors;
826
+	}
827 827
 
828
-    public static function add_default_templates( $path, $default = true, $template = true ) {
829
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' );
828
+	public static function add_default_templates( $path, $default = true, $template = true ) {
829
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' );
830 830
 
831
-        $path = untrailingslashit(trim($path));
832
-        $templates = glob( $path .'/*.php' );
831
+		$path = untrailingslashit(trim($path));
832
+		$templates = glob( $path .'/*.php' );
833 833
 
834 834
 		for ( $i = count( $templates ) - 1; $i >= 0; $i-- ) {
835
-            $filename = str_replace( '.php', '', str_replace( $path.'/', '', $templates[ $i ] ) );
835
+			$filename = str_replace( '.php', '', str_replace( $path.'/', '', $templates[ $i ] ) );
836 836
 			$template_query = array( 'form_key' => $filename );
837
-            if ( $template ) {
838
-                $template_query['is_template'] = 1;
839
-            }
840
-            if ( $default ) {
841
-                $template_query['default_template'] = 1;
842
-            }
837
+			if ( $template ) {
838
+				$template_query['is_template'] = 1;
839
+			}
840
+			if ( $default ) {
841
+				$template_query['default_template'] = 1;
842
+			}
843 843
 			$form = FrmForm::getAll( $template_query, '', 1 );
844 844
 
845
-            $values = FrmFormsHelper::setup_new_vars();
846
-            $values['form_key'] = $filename;
847
-            $values['is_template'] = $template;
848
-            $values['status'] = 'published';
849
-            if ( $default ) {
850
-                $values['default_template'] = 1;
851
-            }
852
-
853
-            include( $templates[ $i ] );
854
-
855
-            //get updated form
856
-            if ( isset($form) && ! empty($form) ) {
857
-                $old_id = $form->id;
858
-                $form = FrmForm::getOne($form->id);
859
-            } else {
860
-                $old_id = false;
845
+			$values = FrmFormsHelper::setup_new_vars();
846
+			$values['form_key'] = $filename;
847
+			$values['is_template'] = $template;
848
+			$values['status'] = 'published';
849
+			if ( $default ) {
850
+				$values['default_template'] = 1;
851
+			}
852
+
853
+			include( $templates[ $i ] );
854
+
855
+			//get updated form
856
+			if ( isset($form) && ! empty($form) ) {
857
+				$old_id = $form->id;
858
+				$form = FrmForm::getOne($form->id);
859
+			} else {
860
+				$old_id = false;
861 861
 				$form = FrmForm::getAll( $template_query, '', 1 );
862
-            }
862
+			}
863 863
 
864
-            if ( $form ) {
864
+			if ( $form ) {
865 865
 				do_action( 'frm_after_duplicate_form', $form->id, (array) $form, array( 'old_id' => $old_id ) );
866
-            }
867
-        }
868
-    }
866
+			}
867
+		}
868
+	}
869 869
 
870
-    public static function route() {
871
-        $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
872
-        $vars = array();
870
+	public static function route() {
871
+		$action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
872
+		$vars = array();
873 873
 		if ( isset( $_POST['frm_compact_fields'] ) ) {
874 874
 			FrmAppHelper::permission_check( 'frm_edit_forms' );
875 875
 
876
-            $json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('&quot;', '\\\"', $_POST['frm_compact_fields'] ))));
877
-            $json_vars = json_decode($json_vars, true);
878
-            if ( empty($json_vars) ) {
879
-                // json decoding failed so we should return an error message
876
+			$json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('&quot;', '\\\"', $_POST['frm_compact_fields'] ))));
877
+			$json_vars = json_decode($json_vars, true);
878
+			if ( empty($json_vars) ) {
879
+				// json decoding failed so we should return an error message
880 880
 				$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
881
-                if ( 'edit' == $action ) {
882
-                    $action = 'update';
883
-                }
884
-
885
-                add_filter('frm_validate_form', 'FrmFormsController::json_error');
886
-            } else {
887
-                $vars = FrmAppHelper::json_to_array($json_vars);
888
-                $action = $vars[ $action ];
881
+				if ( 'edit' == $action ) {
882
+					$action = 'update';
883
+				}
884
+
885
+				add_filter('frm_validate_form', 'FrmFormsController::json_error');
886
+			} else {
887
+				$vars = FrmAppHelper::json_to_array($json_vars);
888
+				$action = $vars[ $action ];
889 889
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] );
890 890
 				$_REQUEST = array_merge( $_REQUEST, $vars );
891 891
 				$_POST = array_merge( $_POST, $_REQUEST );
892
-            }
893
-        } else {
892
+			}
893
+		} else {
894 894
 			$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
895
-    		if ( isset( $_REQUEST['delete_all'] ) ) {
896
-                // override the action for this page
897
-    			$action = 'delete_all';
898
-            }
899
-        }
895
+			if ( isset( $_REQUEST['delete_all'] ) ) {
896
+				// override the action for this page
897
+				$action = 'delete_all';
898
+			}
899
+		}
900 900
 
901 901
 		add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' );
902
-        FrmAppHelper::trigger_hook_load( 'form' );
903
-
904
-        switch ( $action ) {
905
-            case 'new':
906
-                return self::new_form($vars);
907
-            case 'create':
908
-            case 'edit':
909
-            case 'update':
910
-            case 'duplicate':
911
-            case 'trash':
912
-            case 'untrash':
913
-            case 'destroy':
914
-            case 'delete_all':
915
-            case 'settings':
916
-            case 'update_settings':
902
+		FrmAppHelper::trigger_hook_load( 'form' );
903
+
904
+		switch ( $action ) {
905
+			case 'new':
906
+				return self::new_form($vars);
907
+			case 'create':
908
+			case 'edit':
909
+			case 'update':
910
+			case 'duplicate':
911
+			case 'trash':
912
+			case 'untrash':
913
+			case 'destroy':
914
+			case 'delete_all':
915
+			case 'settings':
916
+			case 'update_settings':
917 917
 				return self::$action( $vars );
918
-            default:
919
-                do_action('frm_form_action_'. $action);
920
-                if ( apply_filters('frm_form_stop_action_'. $action, false) ) {
921
-                    return;
922
-                }
918
+			default:
919
+				do_action('frm_form_action_'. $action);
920
+				if ( apply_filters('frm_form_stop_action_'. $action, false) ) {
921
+					return;
922
+				}
923 923
 
924 924
 				$action = FrmAppHelper::get_param( 'action', '', 'get', 'sanitize_text_field' );
925
-                if ( $action == -1 ) {
925
+				if ( $action == -1 ) {
926 926
 					$action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
927
-                }
927
+				}
928 928
 
929
-                if ( strpos($action, 'bulk_') === 0 ) {
930
-                    FrmAppHelper::remove_get_action();
931
-                    return self::list_form();
932
-                }
929
+				if ( strpos($action, 'bulk_') === 0 ) {
930
+					FrmAppHelper::remove_get_action();
931
+					return self::list_form();
932
+				}
933 933
 
934
-                return self::display_forms_list();
935
-        }
936
-    }
934
+				return self::display_forms_list();
935
+		}
936
+	}
937 937
 
938
-    public static function json_error( $errors ) {
939
-        $errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
940
-        return $errors;
941
-    }
938
+	public static function json_error( $errors ) {
939
+		$errors['json'] = __( 'Abnormal HTML characters prevented your form from saving correctly', 'formidable' );
940
+		return $errors;
941
+	}
942 942
 
943 943
 
944
-    /* FRONT-END FORMS */
945
-    public static function admin_bar_css() {
944
+	/* FRONT-END FORMS */
945
+	public static function admin_bar_css() {
946 946
 		if ( is_admin() || ! current_user_can( 'frm_edit_forms' ) ) {
947
-            return;
948
-        }
947
+			return;
948
+		}
949 949
 
950 950
 		add_action( 'wp_before_admin_bar_render', 'FrmFormsController::admin_bar_configure' );
951 951
 		FrmAppHelper::load_font_style();
952 952
 	}
953 953
 
954 954
 	public static function admin_bar_configure() {
955
-        global $frm_vars;
956
-        if ( empty($frm_vars['forms_loaded']) ) {
957
-            return;
958
-        }
959
-
960
-        $actions = array();
961
-        foreach ( $frm_vars['forms_loaded'] as $form ) {
962
-            if ( is_object($form) ) {
963
-                $actions[ $form->id ] = $form->name;
964
-            }
965
-            unset($form);
966
-        }
967
-
968
-        if ( empty($actions) ) {
969
-            return;
970
-        }
971
-
972
-        asort($actions);
973
-
974
-        global $wp_admin_bar;
975
-
976
-        if ( count($actions) == 1 ) {
977
-            $wp_admin_bar->add_menu( array(
978
-                'title' => 'Edit Form',
979
-                'href'  => admin_url('admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) )),
980
-                'id'    => 'frm-forms',
981
-            ) );
982
-        } else {
983
-            $wp_admin_bar->add_menu( array(
984
-        		'id'    => 'frm-forms',
985
-        		'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>',
986
-        		'href'  => admin_url( 'admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) ) ),
987
-        		'meta'  => array(
955
+		global $frm_vars;
956
+		if ( empty($frm_vars['forms_loaded']) ) {
957
+			return;
958
+		}
959
+
960
+		$actions = array();
961
+		foreach ( $frm_vars['forms_loaded'] as $form ) {
962
+			if ( is_object($form) ) {
963
+				$actions[ $form->id ] = $form->name;
964
+			}
965
+			unset($form);
966
+		}
967
+
968
+		if ( empty($actions) ) {
969
+			return;
970
+		}
971
+
972
+		asort($actions);
973
+
974
+		global $wp_admin_bar;
975
+
976
+		if ( count($actions) == 1 ) {
977
+			$wp_admin_bar->add_menu( array(
978
+				'title' => 'Edit Form',
979
+				'href'  => admin_url('admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) )),
980
+				'id'    => 'frm-forms',
981
+			) );
982
+		} else {
983
+			$wp_admin_bar->add_menu( array(
984
+				'id'    => 'frm-forms',
985
+				'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>',
986
+				'href'  => admin_url( 'admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) ) ),
987
+				'meta'  => array(
988 988
 					'title' => __( 'Edit Forms', 'formidable' ),
989
-        		),
990
-        	) );
989
+				),
990
+			) );
991 991
 
992
-        	foreach ( $actions as $form_id => $name ) {
992
+			foreach ( $actions as $form_id => $name ) {
993 993
 
994
-        		$wp_admin_bar->add_menu( array(
995
-        			'parent'    => 'frm-forms',
996
-        			'id'        => 'edit_form_'. $form_id,
997
-        			'title'     => empty($name) ? __( '(no title)') : $name,
994
+				$wp_admin_bar->add_menu( array(
995
+					'parent'    => 'frm-forms',
996
+					'id'        => 'edit_form_'. $form_id,
997
+					'title'     => empty($name) ? __( '(no title)') : $name,
998 998
 					'href'      => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ),
999
-        		) );
1000
-        	}
1001
-        }
1002
-    }
999
+				) );
1000
+			}
1001
+		}
1002
+	}
1003 1003
 
1004
-    //formidable shortcode
1004
+	//formidable shortcode
1005 1005
 	public static function get_form_shortcode( $atts ) {
1006
-        global $frm_vars;
1007
-        if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) {
1008
-            $sc = '[formidable';
1006
+		global $frm_vars;
1007
+		if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) {
1008
+			$sc = '[formidable';
1009 1009
 			if ( ! empty( $atts ) ) {
1010 1010
 				foreach ( $atts as $k => $v ) {
1011 1011
 					$sc .= ' ' . $k . '="' . esc_attr( $v ) . '"';
1012 1012
 				}
1013 1013
 			}
1014
-            return $sc .']';
1015
-        }
1016
-
1017
-        $shortcode_atts = shortcode_atts( array(
1018
-            'id' => '', 'key' => '', 'title' => false, 'description' => false,
1019
-            'readonly' => false, 'entry_id' => false, 'fields' => array(),
1020
-            'exclude_fields' => array(), 'minimize' => false,
1021
-        ), $atts);
1022
-        do_action('formidable_shortcode_atts', $shortcode_atts, $atts);
1023
-
1024
-        return self::show_form(
1025
-            $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'],
1026
-            $shortcode_atts['description'], $atts
1027
-        );
1028
-    }
1029
-
1030
-    public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) {
1031
-        if ( empty( $id ) ) {
1032
-            $id = $key;
1033
-        }
1034
-
1035
-        // no form id or key set
1036
-        if ( empty( $id ) ) {
1037
-            return __( 'Please select a valid form', 'formidable' );
1038
-        }
1039
-
1040
-        $form = FrmForm::getOne( $id );
1041
-        if ( ! $form || $form->parent_form_id ) {
1042
-            return __( 'Please select a valid form', 'formidable' );
1043
-        }
1014
+			return $sc .']';
1015
+		}
1016
+
1017
+		$shortcode_atts = shortcode_atts( array(
1018
+			'id' => '', 'key' => '', 'title' => false, 'description' => false,
1019
+			'readonly' => false, 'entry_id' => false, 'fields' => array(),
1020
+			'exclude_fields' => array(), 'minimize' => false,
1021
+		), $atts);
1022
+		do_action('formidable_shortcode_atts', $shortcode_atts, $atts);
1023
+
1024
+		return self::show_form(
1025
+			$shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'],
1026
+			$shortcode_atts['description'], $atts
1027
+		);
1028
+	}
1029
+
1030
+	public static function show_form( $id = '', $key = '', $title = false, $description = false, $atts = array() ) {
1031
+		if ( empty( $id ) ) {
1032
+			$id = $key;
1033
+		}
1034
+
1035
+		// no form id or key set
1036
+		if ( empty( $id ) ) {
1037
+			return __( 'Please select a valid form', 'formidable' );
1038
+		}
1039
+
1040
+		$form = FrmForm::getOne( $id );
1041
+		if ( ! $form || $form->parent_form_id ) {
1042
+			return __( 'Please select a valid form', 'formidable' );
1043
+		}
1044 1044
 
1045 1045
 		add_action( 'frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks' );
1046
-        FrmAppHelper::trigger_hook_load( 'form', $form );
1046
+		FrmAppHelper::trigger_hook_load( 'form', $form );
1047 1047
 
1048
-        $form = apply_filters( 'frm_pre_display_form', $form );
1048
+		$form = apply_filters( 'frm_pre_display_form', $form );
1049 1049
 
1050
-        $frm_settings = FrmAppHelper::get_settings();
1050
+		$frm_settings = FrmAppHelper::get_settings();
1051 1051
 
1052 1052
 		if ( self::is_viewable_draft_form( $form ) ) {
1053 1053
 			// don't show a draft form on a page
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
 		}
1069 1069
 
1070 1070
 		return $form;
1071
-    }
1071
+	}
1072 1072
 
1073 1073
 	private static function is_viewable_draft_form( $form ) {
1074 1074
 		global $post;
@@ -1084,98 +1084,98 @@  discard block
 block discarded – undo
1084 1084
 		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'] );
1085 1085
 	}
1086 1086
 
1087
-    public static function get_form( $form, $title, $description, $atts = array() ) {
1088
-        ob_start();
1087
+	public static function get_form( $form, $title, $description, $atts = array() ) {
1088
+		ob_start();
1089 1089
 
1090
-        self::get_form_contents( $form, $title, $description, $atts );
1090
+		self::get_form_contents( $form, $title, $description, $atts );
1091 1091
 		self::enqueue_scripts( FrmForm::get_params( $form ) );
1092 1092
 
1093
-        $contents = ob_get_contents();
1094
-        ob_end_clean();
1093
+		$contents = ob_get_contents();
1094
+		ob_end_clean();
1095 1095
 
1096 1096
 		self::maybe_minimize_form( $atts, $contents );
1097 1097
 
1098
-        return $contents;
1099
-    }
1098
+		return $contents;
1099
+	}
1100 1100
 
1101 1101
 	public static function enqueue_scripts( $params ) {
1102 1102
 		do_action( 'frm_enqueue_form_scripts', $params );
1103 1103
 	}
1104 1104
 
1105 1105
 	public static function get_form_contents( $form, $title, $description, $atts ) {
1106
-        global $frm_vars;
1106
+		global $frm_vars;
1107 1107
 
1108
-        $frm_settings = FrmAppHelper::get_settings();
1108
+		$frm_settings = FrmAppHelper::get_settings();
1109 1109
 
1110
-        $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value;
1110
+		$submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value;
1111 1111
 
1112
-        $user_ID = get_current_user_id();
1112
+		$user_ID = get_current_user_id();
1113 1113
 		$params = FrmForm::get_params( $form );
1114
-        $message = $errors = '';
1114
+		$message = $errors = '';
1115 1115
 
1116
-        if ( $params['posted_form_id'] == $form->id && $_POST ) {
1117
-            $errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array();
1118
-        }
1116
+		if ( $params['posted_form_id'] == $form->id && $_POST ) {
1117
+			$errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array();
1118
+		}
1119 1119
 
1120 1120
 		$include_form_tag = apply_filters( 'frm_include_form_tag', true, $form );
1121
-        $fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) );
1122
-
1123
-        if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) {
1124
-            do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
1125
-            if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) {
1126
-                $values = FrmEntriesHelper::setup_new_vars($fields, $form);
1127
-                include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1128
-            }
1129
-            return;
1130
-        }
1131
-
1132
-        if ( ! empty($errors) ) {
1133
-            $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array();
1134
-            include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1135
-            return;
1136
-        }
1137
-
1138
-        do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
1139
-        if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) {
1140
-            return;
1141
-        }
1142
-
1143
-        $values = FrmEntriesHelper::setup_new_vars($fields, $form, true);
1144
-        $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0;
1145
-        $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create');
1146
-
1147
-        if ( $created && is_numeric($created) && $conf_method != 'message' ) {
1148
-            do_action('frm_success_action', $conf_method, $form, $form->options, $created);
1121
+		$fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) );
1122
+
1123
+		if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) {
1124
+			do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
1125
+			if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) {
1126
+				$values = FrmEntriesHelper::setup_new_vars($fields, $form);
1127
+				include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1128
+			}
1129
+			return;
1130
+		}
1131
+
1132
+		if ( ! empty($errors) ) {
1133
+			$values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array();
1134
+			include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1135
+			return;
1136
+		}
1137
+
1138
+		do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
1139
+		if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) {
1140
+			return;
1141
+		}
1142
+
1143
+		$values = FrmEntriesHelper::setup_new_vars($fields, $form, true);
1144
+		$created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0;
1145
+		$conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create');
1146
+
1147
+		if ( $created && is_numeric($created) && $conf_method != 'message' ) {
1148
+			do_action('frm_success_action', $conf_method, $form, $form->options, $created);
1149 1149
 			do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
1150
-            return;
1151
-        }
1150
+			return;
1151
+		}
1152 1152
 
1153
-        if ( $created && is_numeric($created) ) {
1154
-            $message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg;
1155
-            $class = 'frm_message';
1156
-        } else {
1157
-            $message = $frm_settings->failed_msg;
1158
-            $class = 'frm_error_style';
1159
-        }
1153
+		if ( $created && is_numeric($created) ) {
1154
+			$message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg;
1155
+			$class = 'frm_message';
1156
+		} else {
1157
+			$message = $frm_settings->failed_msg;
1158
+			$class = 'frm_error_style';
1159
+		}
1160 1160
 
1161 1161
 		$message = FrmFormsHelper::get_success_message( array(
1162 1162
 			'message' => $message, 'form' => $form,
1163 1163
 			'entry_id' => $created, 'class' => $class,
1164 1164
 		) );
1165
-        $message = apply_filters('frm_main_feedback', $message, $form, $created);
1165
+		$message = apply_filters('frm_main_feedback', $message, $form, $created);
1166 1166
 
1167
-        if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) {
1168
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1169
-        } else {
1170
-            global $frm_vars;
1167
+		if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) {
1168
+			require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1169
+		} else {
1170
+			global $frm_vars;
1171 1171
 			self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] );
1172 1172
 
1173
-            $include_extra_container = 'frm_forms'. FrmFormsHelper::get_form_style_class($values);
1174
-            include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php');
1175
-        }
1173
+			$include_extra_container = 'frm_forms'. FrmFormsHelper::get_form_style_class($values);
1174
+			include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php');
1175
+		}
1176 1176
 
1177 1177
 		do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
1178
-    }
1178
+	}
1179 1179
 
1180 1180
 	public static function front_head() {
1181 1181
 		$version = FrmAppHelper::plugin_version();
Please login to merge, or discard this patch.
Spacing   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@  discard block
 block discarded – undo
7 7
 		if ( ! FrmAppHelper::pro_is_installed() ) {
8 8
 			$menu_label .= ' (Lite)';
9 9
 		}
10
-		add_submenu_page('formidable', 'Formidable | '. $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' );
10
+		add_submenu_page( 'formidable', 'Formidable | ' . $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' );
11 11
 
12
-	    add_filter('get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' );
12
+	    add_filter( 'get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' );
13 13
 
14
-	    add_filter('manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 );
15
-		add_filter('manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' );
14
+	    add_filter( 'manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 );
15
+		add_filter( 'manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' );
16 16
     }
17 17
 
18 18
     public static function head() {
19
-        wp_enqueue_script('formidable-editinplace');
19
+        wp_enqueue_script( 'formidable-editinplace' );
20 20
 
21 21
         if ( wp_is_mobile() ) {
22 22
     		wp_enqueue_script( 'jquery-touch-punch' );
@@ -24,49 +24,49 @@  discard block
 block discarded – undo
24 24
     }
25 25
 
26 26
     public static function register_widgets() {
27
-        require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php');
28
-        register_widget('FrmShowForm');
27
+        require_once( FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php' );
28
+        register_widget( 'FrmShowForm' );
29 29
     }
30 30
 
31 31
     public static function list_form() {
32
-        FrmAppHelper::permission_check('frm_view_forms');
32
+        FrmAppHelper::permission_check( 'frm_view_forms' );
33 33
 
34 34
 		$params = FrmForm::list_page_params();
35
-        $errors = self::process_bulk_form_actions( array());
36
-        $errors = apply_filters('frm_admin_list_form_action', $errors);
35
+        $errors = self::process_bulk_form_actions( array() );
36
+        $errors = apply_filters( 'frm_admin_list_form_action', $errors );
37 37
 
38 38
 		return self::display_forms_list( $params, '', $errors );
39 39
     }
40 40
 
41 41
 	public static function new_form( $values = array() ) {
42
-        FrmAppHelper::permission_check('frm_edit_forms');
42
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
43 43
 
44 44
         global $frm_vars;
45 45
 
46
-        $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
47
-		$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ];
46
+        $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
47
+		$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[$action];
48 48
 
49 49
 		if ( $action == 'create' ) {
50
-            return self::create($values);
50
+            return self::create( $values );
51 51
 		} else if ( $action == 'new' ) {
52 52
 			$frm_field_selection = FrmField::field_selection();
53
-            $values = FrmFormsHelper::setup_new_vars($values);
53
+            $values = FrmFormsHelper::setup_new_vars( $values );
54 54
             $id = FrmForm::create( $values );
55
-            $form = FrmForm::getOne($id);
55
+            $form = FrmForm::getOne( $id );
56 56
 
57 57
             // add default email notification
58 58
             $action_control = FrmFormActionsController::get_form_actions( 'email' );
59
-            $action_control->create($form->id);
59
+            $action_control->create( $form->id );
60 60
 
61 61
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
62 62
 
63 63
             $values['id'] = $id;
64
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
64
+            require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
65 65
         }
66 66
     }
67 67
 
68 68
 	public static function create( $values = array() ) {
69
-        FrmAppHelper::permission_check('frm_edit_forms');
69
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
70 70
 
71 71
         global $frm_vars;
72 72
         if ( empty( $values ) ) {
@@ -78,58 +78,58 @@  discard block
 block discarded – undo
78 78
             $values = FrmProEntry::mod_other_vals( $values, 'back' );
79 79
         }
80 80
 
81
-		$id = isset($values['id']) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
81
+		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
82 82
 
83 83
         if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
84 84
             $frm_settings = FrmAppHelper::get_settings();
85 85
             $errors = array( 'form' => $frm_settings->admin_permission );
86 86
         } else {
87
-            $errors = FrmForm::validate($values);
87
+            $errors = FrmForm::validate( $values );
88 88
         }
89 89
 
90
-        if ( count($errors) > 0 ) {
90
+        if ( count( $errors ) > 0 ) {
91 91
             $hide_preview = true;
92 92
 			$frm_field_selection = FrmField::field_selection();
93 93
             $form = FrmForm::getOne( $id );
94
-            $fields = FrmField::get_all_for_form($id);
94
+            $fields = FrmField::get_all_for_form( $id );
95 95
 
96
-            $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
96
+            $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true );
97 97
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
98 98
 
99
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
99
+            require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
100 100
         } else {
101 101
             FrmForm::update( $id, $values, true );
102
-            die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id='. $id)));
102
+            die( FrmAppHelper::js_redirect( admin_url( 'admin.php?page=formidable&frm_action=settings&id=' . $id ) ) );
103 103
         }
104 104
     }
105 105
 
106 106
     public static function edit( $values = false ) {
107
-        FrmAppHelper::permission_check('frm_edit_forms');
107
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
108 108
 
109 109
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
110
-        return self::get_edit_vars($id);
110
+        return self::get_edit_vars( $id );
111 111
     }
112 112
 
113 113
     public static function settings( $id = false, $message = '' ) {
114
-        FrmAppHelper::permission_check('frm_edit_forms');
114
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
115 115
 
116
-        if ( ! $id || ! is_numeric($id) ) {
116
+        if ( ! $id || ! is_numeric( $id ) ) {
117 117
 			$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
118 118
         }
119 119
 		return self::get_settings_vars( $id, array(), $message );
120 120
     }
121 121
 
122 122
     public static function update_settings() {
123
-        FrmAppHelper::permission_check('frm_edit_forms');
123
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
124 124
 
125 125
 		$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
126 126
 
127
-        $errors = FrmForm::validate($_POST);
128
-        if ( count($errors) > 0 ) {
129
-            return self::get_settings_vars($id, $errors);
127
+        $errors = FrmForm::validate( $_POST );
128
+        if ( count( $errors ) > 0 ) {
129
+            return self::get_settings_vars( $id, $errors );
130 130
         }
131 131
 
132
-        do_action('frm_before_update_form_settings', $id);
132
+        do_action( 'frm_before_update_form_settings', $id );
133 133
 
134 134
 		FrmForm::update( $id, $_POST );
135 135
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
 	private static function edit_in_place_value( $field ) {
153 153
 		check_ajax_referer( 'frm_ajax', 'nonce' );
154
-		FrmAppHelper::permission_check('frm_edit_forms', 'hide');
154
+		FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' );
155 155
 
156 156
 		$form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
157 157
 		$value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_filter_post_kses' );
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 * @since 2.0
210 210
 	 */
211 211
 	public static function _create_from_template() {
212
-		FrmAppHelper::permission_check('frm_edit_forms');
212
+		FrmAppHelper::permission_check( 'frm_edit_forms' );
213 213
 		check_ajax_referer( 'frm_ajax', 'nonce' );
214 214
 
215 215
 		$current_form = FrmAppHelper::get_param( 'this_form', '', 'get', 'absint' );
@@ -224,15 +224,15 @@  discard block
 block discarded – undo
224 224
 	}
225 225
 
226 226
     public static function duplicate() {
227
-        FrmAppHelper::permission_check('frm_edit_forms');
227
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
228 228
 
229 229
 		$params = FrmForm::list_page_params();
230 230
         $form = FrmForm::duplicate( $params['id'], $params['template'], true );
231
-        $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
231
+        $message = ( $params['template'] ) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
232 232
         if ( $form ) {
233 233
 			return self::get_edit_vars( $form, array(), $message, true );
234 234
         } else {
235
-            return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' ));
235
+            return self::display_forms_list( $params, __( 'There was a problem creating the new template.', 'formidable' ) );
236 236
         }
237 237
     }
238 238
 
@@ -258,14 +258,14 @@  discard block
 block discarded – undo
258 258
         if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) {
259 259
             global $wp;
260 260
             $root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
261
-            include_once( $root.'/wp-config.php' );
261
+            include_once( $root . '/wp-config.php' );
262 262
             $wp->init();
263 263
             $wp->register_globals();
264 264
         }
265 265
 
266 266
 		self::register_pro_scripts();
267 267
 
268
-		header( 'Content-Type: text/html; charset='. get_option( 'blog_charset' ) );
268
+		header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
269 269
 
270 270
 		$key = FrmAppHelper::simple_get( 'form', 'sanitize_title' );
271 271
 		if ( $key == '' ) {
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 			$form = FrmForm::getAll( array(), '', 1 );
278 278
         }
279 279
 
280
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/direct.php');
280
+        require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php' );
281 281
         wp_die();
282 282
     }
283 283
 
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 		if ( FrmAppHelper::pro_is_installed() ) {
286 286
 			wp_register_script( 'jquery-frm-rating', FrmAppHelper::plugin_url() . '/pro/js/jquery.rating.min.js', array( 'jquery' ), '4.11', true );
287 287
 			wp_register_script( 'jquery-maskedinput', FrmAppHelper::plugin_url() . '/pro/js/jquery.maskedinput.min.js', array( 'jquery' ), '1.4', true );
288
-			wp_register_script( 'jquery-chosen', FrmAppHelper::plugin_url() .'/pro/js/chosen.jquery.min.js', array( 'jquery' ), '1.2.0', true );
288
+			wp_register_script( 'jquery-chosen', FrmAppHelper::plugin_url() . '/pro/js/chosen.jquery.min.js', array( 'jquery' ), '1.2.0', true );
289 289
 		}
290 290
 	}
291 291
 
@@ -294,11 +294,11 @@  discard block
 block discarded – undo
294 294
     }
295 295
 
296 296
 	public static function bulk_untrash( $ids ) {
297
-        FrmAppHelper::permission_check('frm_edit_forms');
297
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
298 298
 
299 299
         $count = FrmForm::set_status( $ids, 'published' );
300 300
 
301
-        $message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
301
+        $message = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
302 302
         return $message;
303 303
     }
304 304
 
@@ -317,90 +317,90 @@  discard block
 block discarded – undo
317 317
 			'trash'   => array( 'permission' => 'frm_delete_forms', 'new_status' => 'trash' ),
318 318
 		);
319 319
 
320
-		if ( ! isset( $available_status[ $status ] ) ) {
320
+		if ( ! isset( $available_status[$status] ) ) {
321 321
 			return;
322 322
 		}
323 323
 
324
-		FrmAppHelper::permission_check( $available_status[ $status ]['permission'] );
324
+		FrmAppHelper::permission_check( $available_status[$status]['permission'] );
325 325
 
326 326
 		$params = FrmForm::list_page_params();
327 327
 
328 328
 		//check nonce url
329
-		check_admin_referer($status .'_form_' . $params['id']);
329
+		check_admin_referer( $status . '_form_' . $params['id'] );
330 330
 
331 331
 		$count = 0;
332
-		if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
333
-			$count++;
332
+		if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) {
333
+			$count ++;
334 334
 		}
335 335
 
336
-		$available_status['untrash']['message'] = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count );
337
-		$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>' );
336
+		$available_status['untrash']['message'] = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count );
337
+		$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>' );
338 338
 
339
-		$message = $available_status[ $status ]['message'];
339
+		$message = $available_status[$status]['message'];
340 340
 
341 341
 		self::display_forms_list( $params, $message );
342 342
 	}
343 343
 
344 344
 	public static function bulk_trash( $ids ) {
345
-        FrmAppHelper::permission_check('frm_delete_forms');
345
+        FrmAppHelper::permission_check( 'frm_delete_forms' );
346 346
 
347 347
         $count = 0;
348 348
         foreach ( $ids as $id ) {
349 349
             if ( FrmForm::trash( $id ) ) {
350
-                $count++;
350
+                $count ++;
351 351
             }
352 352
         }
353 353
 
354 354
         $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
355
-        $message = sprintf(_n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="'. esc_url(wp_nonce_url( '?page=formidable&frm_action=list&action=bulk_untrash&form_type='. $current_page .'&item-action[]='. implode('item-action[]=', $ids), 'bulk-toplevel_page_formidable' )) .'">', '</a>' );
355
+        $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>' );
356 356
 
357 357
         return $message;
358 358
     }
359 359
 
360 360
     public static function destroy() {
361
-        FrmAppHelper::permission_check('frm_delete_forms');
361
+        FrmAppHelper::permission_check( 'frm_delete_forms' );
362 362
 
363 363
 		$params = FrmForm::list_page_params();
364 364
 
365 365
         //check nonce url
366
-        check_admin_referer('destroy_form_' . $params['id']);
366
+        check_admin_referer( 'destroy_form_' . $params['id'] );
367 367
 
368 368
         $count = 0;
369 369
         if ( FrmForm::destroy( $params['id'] ) ) {
370
-            $count++;
370
+            $count ++;
371 371
         }
372 372
 
373
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
373
+        $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
374 374
 
375 375
 		self::display_forms_list( $params, $message );
376 376
     }
377 377
 
378 378
 	public static function bulk_destroy( $ids ) {
379
-        FrmAppHelper::permission_check('frm_delete_forms');
379
+        FrmAppHelper::permission_check( 'frm_delete_forms' );
380 380
 
381 381
         $count = 0;
382 382
         foreach ( $ids as $id ) {
383 383
             $d = FrmForm::destroy( $id );
384 384
             if ( $d ) {
385
-                $count++;
385
+                $count ++;
386 386
             }
387 387
         }
388 388
 
389
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
389
+        $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
390 390
 
391 391
         return $message;
392 392
     }
393 393
 
394 394
     private static function delete_all() {
395 395
         //check nonce url
396
-        $permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable');
396
+        $permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable' );
397 397
         if ( $permission_error !== false ) {
398 398
 			self::display_forms_list( array(), '', array( $permission_error ) );
399 399
             return;
400 400
         }
401 401
 
402 402
 		$count = FrmForm::scheduled_delete( time() );
403
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
403
+        $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
404 404
 
405 405
 		self::display_forms_list( array(), $message );
406 406
     }
@@ -417,9 +417,9 @@  discard block
 block discarded – undo
417 417
 	* @since 2.0.15
418 418
 	*/
419 419
 	public static function insert_form_button() {
420
-		if ( current_user_can('frm_view_forms') ) {
420
+		if ( current_user_can( 'frm_view_forms' ) ) {
421 421
 			$frm_settings = FrmAppHelper::get_settings();
422
-			$content = '<a href="#TB_inline?width=50&height=50&inlineId=frm_insert_form" class="thickbox button add_media frm_insert_form" title="' . esc_attr__( 'Add forms and content', 'formidable' ) . '"><span class="frm-buttons-icon wp-media-buttons-icon"></span> '. $frm_settings->menu .'</a>';
422
+			$content = '<a href="#TB_inline?width=50&height=50&inlineId=frm_insert_form" class="thickbox button add_media frm_insert_form" title="' . esc_attr__( 'Add forms and content', 'formidable' ) . '"><span class="frm-buttons-icon wp-media-buttons-icon"></span> ' . $frm_settings->menu . '</a>';
423 423
 			echo wp_kses_post( $content );
424 424
 		}
425 425
 	}
@@ -436,22 +436,22 @@  discard block
 block discarded – undo
436 436
 			'formidable' => array( 'name' => __( 'Form', 'formidable' ), 'label' => __( 'Insert a Form', 'formidable' ) ),
437 437
         );
438 438
 
439
-        $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes);
439
+        $shortcodes = apply_filters( 'frm_popup_shortcodes', $shortcodes );
440 440
 
441
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/insert_form_popup.php');
441
+        include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/insert_form_popup.php' );
442 442
     }
443 443
 
444 444
     public static function get_shortcode_opts() {
445
-		FrmAppHelper::permission_check('frm_view_forms');
445
+		FrmAppHelper::permission_check( 'frm_view_forms' );
446 446
         check_ajax_referer( 'frm_ajax', 'nonce' );
447 447
 
448 448
 		$shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' );
449
-        if ( empty($shortcode) ) {
449
+        if ( empty( $shortcode ) ) {
450 450
             wp_die();
451 451
         }
452 452
 
453
-        echo '<div id="sc-opts-'. esc_attr( $shortcode ) .'" class="frm_shortcode_option">';
454
-        echo '<input type="radio" name="frmsc" value="'. esc_attr($shortcode) .'" id="sc-'. esc_attr($shortcode) .'" class="frm_hidden" />';
453
+        echo '<div id="sc-opts-' . esc_attr( $shortcode ) . '" class="frm_shortcode_option">';
454
+        echo '<input type="radio" name="frmsc" value="' . esc_attr( $shortcode ) . '" id="sc-' . esc_attr( $shortcode ) . '" class="frm_hidden" />';
455 455
 
456 456
         $form_id = '';
457 457
         $opts = array();
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
                 );
467 467
             break;
468 468
         }
469
-        $opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode);
469
+        $opts = apply_filters( 'frm_sc_popup_opts', $opts, $shortcode );
470 470
 
471 471
 		if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) {
472 472
 			// allow other shortcodes to use the required form id option
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 			unset( $opts['form_id'] );
475 475
 		}
476 476
 
477
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/shortcode_opts.php');
477
+        include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/shortcode_opts.php' );
478 478
 
479 479
         echo '</div>';
480 480
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
             die();
507 507
         }
508 508
 
509
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/list.php');
509
+        require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list.php' );
510 510
     }
511 511
 
512 512
 	public static function get_columns( $columns ) {
@@ -583,11 +583,11 @@  discard block
 block discarded – undo
583 583
         }
584 584
 
585 585
         if ( $form->parent_form_id ) {
586
-			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>' ));
586
+			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>' ) );
587 587
         }
588 588
 
589 589
 		$frm_field_selection = FrmField::field_selection();
590
-        $fields = FrmField::get_all_for_form($form->id);
590
+        $fields = FrmField::get_all_for_form( $form->id );
591 591
 
592 592
         // Automatically add end section fields if they don't exist (2.0 migration)
593 593
         $reset_fields = false;
@@ -597,9 +597,9 @@  discard block
 block discarded – undo
597 597
             $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
598 598
         }
599 599
 
600
-        unset($end_section_values, $last_order, $open, $reset_fields);
600
+        unset( $end_section_values, $last_order, $open, $reset_fields );
601 601
 
602
-        $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
602
+        $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true );
603 603
 
604 604
         $edit_message = __( 'Form was Successfully Updated', 'formidable' );
605 605
         if ( $form->is_template && $message == $edit_message ) {
@@ -609,13 +609,13 @@  discard block
 block discarded – undo
609 609
 		$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
610 610
 
611 611
         if ( $form->default_template ) {
612
-            wp_die(__( 'That template cannot be edited', 'formidable' ));
613
-        } else if ( defined('DOING_AJAX') ) {
612
+            wp_die( __( 'That template cannot be edited', 'formidable' ) );
613
+        } else if ( defined( 'DOING_AJAX' ) ) {
614 614
             wp_die();
615 615
         } else if ( $create_link ) {
616
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
616
+            require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
617 617
         } else {
618
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/edit.php');
618
+            require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/edit.php' );
619 619
         }
620 620
     }
621 621
 
@@ -626,28 +626,28 @@  discard block
 block discarded – undo
626 626
 
627 627
         $form = FrmForm::getOne( $id );
628 628
 
629
-        $fields = FrmField::get_all_for_form($id);
630
-        $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
629
+        $fields = FrmField::get_all_for_form( $id );
630
+        $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true );
631 631
 
632
-        if ( isset($values['default_template']) && $values['default_template'] ) {
633
-            wp_die(__( 'That template cannot be edited', 'formidable' ));
632
+        if ( isset( $values['default_template'] ) && $values['default_template'] ) {
633
+            wp_die( __( 'That template cannot be edited', 'formidable' ) );
634 634
         }
635 635
 
636 636
         $action_controls = FrmFormActionsController::get_form_actions();
637 637
 
638
-        $sections = apply_filters('frm_add_form_settings_section', array(), $values);
638
+        $sections = apply_filters( 'frm_add_form_settings_section', array(), $values );
639 639
         $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
640 640
 
641
-        $styles = apply_filters('frm_get_style_opts', array());
641
+        $styles = apply_filters( 'frm_get_style_opts', array() );
642 642
 
643
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/settings.php');
643
+        require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings.php' );
644 644
     }
645 645
 
646 646
     public static function mb_tags_box( $form_id, $class = '' ) {
647
-        $fields = FrmField::get_all_for_form($form_id, '', 'include');
647
+        $fields = FrmField::get_all_for_form( $form_id, '', 'include' );
648 648
         $linked_forms = array();
649 649
         $col = 'one';
650
-        $settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false;
650
+        $settings_tab = FrmAppHelper::is_admin_page( 'formidable' ) ? true : false;
651 651
 
652 652
 		$cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() );
653 653
 		$adv_shortcodes = self::get_advanced_shortcodes();
@@ -725,13 +725,13 @@  discard block
 block discarded – undo
725 725
 
726 726
     // Insert the form class setting into the form
727 727
 	public static function form_classes( $form ) {
728
-        if ( isset($form->options['form_class']) ) {
728
+        if ( isset( $form->options['form_class'] ) ) {
729 729
 			echo esc_attr( sanitize_text_field( $form->options['form_class'] ) );
730 730
         }
731 731
     }
732 732
 
733 733
     public static function get_email_html() {
734
-		FrmAppHelper::permission_check('frm_view_forms');
734
+		FrmAppHelper::permission_check( 'frm_view_forms' );
735 735
         check_ajax_referer( 'frm_ajax', 'nonce' );
736 736
 		echo FrmEntryFormat::show_entry( array(
737 737
 			'form_id'       => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ),
@@ -828,11 +828,11 @@  discard block
 block discarded – undo
828 828
     public static function add_default_templates( $path, $default = true, $template = true ) {
829 829
         _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' );
830 830
 
831
-        $path = untrailingslashit(trim($path));
832
-        $templates = glob( $path .'/*.php' );
831
+        $path = untrailingslashit( trim( $path ) );
832
+        $templates = glob( $path . '/*.php' );
833 833
 
834
-		for ( $i = count( $templates ) - 1; $i >= 0; $i-- ) {
835
-            $filename = str_replace( '.php', '', str_replace( $path.'/', '', $templates[ $i ] ) );
834
+		for ( $i = count( $templates ) - 1; $i >= 0; $i -- ) {
835
+            $filename = str_replace( '.php', '', str_replace( $path . '/', '', $templates[$i] ) );
836 836
 			$template_query = array( 'form_key' => $filename );
837 837
             if ( $template ) {
838 838
                 $template_query['is_template'] = 1;
@@ -850,12 +850,12 @@  discard block
 block discarded – undo
850 850
                 $values['default_template'] = 1;
851 851
             }
852 852
 
853
-            include( $templates[ $i ] );
853
+            include( $templates[$i] );
854 854
 
855 855
             //get updated form
856
-            if ( isset($form) && ! empty($form) ) {
856
+            if ( isset( $form ) && ! empty( $form ) ) {
857 857
                 $old_id = $form->id;
858
-                $form = FrmForm::getOne($form->id);
858
+                $form = FrmForm::getOne( $form->id );
859 859
             } else {
860 860
                 $old_id = false;
861 861
 				$form = FrmForm::getAll( $template_query, '', 1 );
@@ -868,24 +868,24 @@  discard block
 block discarded – undo
868 868
     }
869 869
 
870 870
     public static function route() {
871
-        $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
871
+        $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
872 872
         $vars = array();
873 873
 		if ( isset( $_POST['frm_compact_fields'] ) ) {
874 874
 			FrmAppHelper::permission_check( 'frm_edit_forms' );
875 875
 
876
-            $json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('&quot;', '\\\"', $_POST['frm_compact_fields'] ))));
877
-            $json_vars = json_decode($json_vars, true);
878
-            if ( empty($json_vars) ) {
876
+            $json_vars = htmlspecialchars_decode( nl2br( stripslashes( str_replace( '&quot;', '\\\"', $_POST['frm_compact_fields'] ) ) ) );
877
+            $json_vars = json_decode( $json_vars, true );
878
+            if ( empty( $json_vars ) ) {
879 879
                 // json decoding failed so we should return an error message
880 880
 				$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
881 881
                 if ( 'edit' == $action ) {
882 882
                     $action = 'update';
883 883
                 }
884 884
 
885
-                add_filter('frm_validate_form', 'FrmFormsController::json_error');
885
+                add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
886 886
             } else {
887
-                $vars = FrmAppHelper::json_to_array($json_vars);
888
-                $action = $vars[ $action ];
887
+                $vars = FrmAppHelper::json_to_array( $json_vars );
888
+                $action = $vars[$action];
889 889
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] );
890 890
 				$_REQUEST = array_merge( $_REQUEST, $vars );
891 891
 				$_POST = array_merge( $_POST, $_REQUEST );
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 
904 904
         switch ( $action ) {
905 905
             case 'new':
906
-                return self::new_form($vars);
906
+                return self::new_form( $vars );
907 907
             case 'create':
908 908
             case 'edit':
909 909
             case 'update':
@@ -916,8 +916,8 @@  discard block
 block discarded – undo
916 916
             case 'update_settings':
917 917
 				return self::$action( $vars );
918 918
             default:
919
-                do_action('frm_form_action_'. $action);
920
-                if ( apply_filters('frm_form_stop_action_'. $action, false) ) {
919
+                do_action( 'frm_form_action_' . $action );
920
+                if ( apply_filters( 'frm_form_stop_action_' . $action, false ) ) {
921 921
                     return;
922 922
                 }
923 923
 
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 					$action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
927 927
                 }
928 928
 
929
-                if ( strpos($action, 'bulk_') === 0 ) {
929
+                if ( strpos( $action, 'bulk_' ) === 0 ) {
930 930
                     FrmAppHelper::remove_get_action();
931 931
                     return self::list_form();
932 932
                 }
@@ -953,37 +953,37 @@  discard block
 block discarded – undo
953 953
 
954 954
 	public static function admin_bar_configure() {
955 955
         global $frm_vars;
956
-        if ( empty($frm_vars['forms_loaded']) ) {
956
+        if ( empty( $frm_vars['forms_loaded'] ) ) {
957 957
             return;
958 958
         }
959 959
 
960 960
         $actions = array();
961 961
         foreach ( $frm_vars['forms_loaded'] as $form ) {
962
-            if ( is_object($form) ) {
963
-                $actions[ $form->id ] = $form->name;
962
+            if ( is_object( $form ) ) {
963
+                $actions[$form->id] = $form->name;
964 964
             }
965
-            unset($form);
965
+            unset( $form );
966 966
         }
967 967
 
968
-        if ( empty($actions) ) {
968
+        if ( empty( $actions ) ) {
969 969
             return;
970 970
         }
971 971
 
972
-        asort($actions);
972
+        asort( $actions );
973 973
 
974 974
         global $wp_admin_bar;
975 975
 
976
-        if ( count($actions) == 1 ) {
976
+        if ( count( $actions ) == 1 ) {
977 977
             $wp_admin_bar->add_menu( array(
978 978
                 'title' => 'Edit Form',
979
-                'href'  => admin_url('admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) )),
979
+                'href'  => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . current( array_keys( $actions ) ) ),
980 980
                 'id'    => 'frm-forms',
981 981
             ) );
982 982
         } else {
983 983
             $wp_admin_bar->add_menu( array(
984 984
         		'id'    => 'frm-forms',
985 985
         		'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>',
986
-        		'href'  => admin_url( 'admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) ) ),
986
+        		'href'  => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . current( array_keys( $actions ) ) ),
987 987
         		'meta'  => array(
988 988
 					'title' => __( 'Edit Forms', 'formidable' ),
989 989
         		),
@@ -993,8 +993,8 @@  discard block
 block discarded – undo
993 993
 
994 994
         		$wp_admin_bar->add_menu( array(
995 995
         			'parent'    => 'frm-forms',
996
-        			'id'        => 'edit_form_'. $form_id,
997
-        			'title'     => empty($name) ? __( '(no title)') : $name,
996
+        			'id'        => 'edit_form_' . $form_id,
997
+        			'title'     => empty( $name ) ? __( '(no title)' ) : $name,
998 998
 					'href'      => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ),
999 999
         		) );
1000 1000
         	}
@@ -1004,22 +1004,22 @@  discard block
 block discarded – undo
1004 1004
     //formidable shortcode
1005 1005
 	public static function get_form_shortcode( $atts ) {
1006 1006
         global $frm_vars;
1007
-        if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) {
1007
+        if ( isset( $frm_vars['skip_shortcode'] ) && $frm_vars['skip_shortcode'] ) {
1008 1008
             $sc = '[formidable';
1009 1009
 			if ( ! empty( $atts ) ) {
1010 1010
 				foreach ( $atts as $k => $v ) {
1011 1011
 					$sc .= ' ' . $k . '="' . esc_attr( $v ) . '"';
1012 1012
 				}
1013 1013
 			}
1014
-            return $sc .']';
1014
+            return $sc . ']';
1015 1015
         }
1016 1016
 
1017 1017
         $shortcode_atts = shortcode_atts( array(
1018 1018
             'id' => '', 'key' => '', 'title' => false, 'description' => false,
1019 1019
             'readonly' => false, 'entry_id' => false, 'fields' => array(),
1020 1020
             'exclude_fields' => array(), 'minimize' => false,
1021
-        ), $atts);
1022
-        do_action('formidable_shortcode_atts', $shortcode_atts, $atts);
1021
+        ), $atts );
1022
+        do_action( 'formidable_shortcode_atts', $shortcode_atts, $atts );
1023 1023
 
1024 1024
         return self::show_form(
1025 1025
             $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'],
@@ -1107,51 +1107,51 @@  discard block
 block discarded – undo
1107 1107
 
1108 1108
         $frm_settings = FrmAppHelper::get_settings();
1109 1109
 
1110
-        $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value;
1110
+        $submit = isset( $form->options['submit_value'] ) ? $form->options['submit_value'] : $frm_settings->submit_value;
1111 1111
 
1112 1112
         $user_ID = get_current_user_id();
1113 1113
 		$params = FrmForm::get_params( $form );
1114 1114
         $message = $errors = '';
1115 1115
 
1116 1116
         if ( $params['posted_form_id'] == $form->id && $_POST ) {
1117
-            $errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array();
1117
+            $errors = isset( $frm_vars['created_entries'][$form->id] ) ? $frm_vars['created_entries'][$form->id]['errors'] : array();
1118 1118
         }
1119 1119
 
1120 1120
 		$include_form_tag = apply_filters( 'frm_include_form_tag', true, $form );
1121 1121
         $fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) );
1122 1122
 
1123 1123
         if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) {
1124
-            do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
1125
-            if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) {
1126
-                $values = FrmEntriesHelper::setup_new_vars($fields, $form);
1127
-                include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1124
+            do_action( 'frm_display_form_action', $params, $fields, $form, $title, $description );
1125
+            if ( apply_filters( 'frm_continue_to_new', true, $form->id, $params['action'] ) ) {
1126
+                $values = FrmEntriesHelper::setup_new_vars( $fields, $form );
1127
+                include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' );
1128 1128
             }
1129 1129
             return;
1130 1130
         }
1131 1131
 
1132
-        if ( ! empty($errors) ) {
1133
-            $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array();
1134
-            include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1132
+        if ( ! empty( $errors ) ) {
1133
+            $values = $fields ? FrmEntriesHelper::setup_new_vars( $fields, $form ) : array();
1134
+            include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' );
1135 1135
             return;
1136 1136
         }
1137 1137
 
1138
-        do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
1139
-        if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) {
1138
+        do_action( 'frm_validate_form_creation', $params, $fields, $form, $title, $description );
1139
+        if ( ! apply_filters( 'frm_continue_to_create', true, $form->id ) ) {
1140 1140
             return;
1141 1141
         }
1142 1142
 
1143
-        $values = FrmEntriesHelper::setup_new_vars($fields, $form, true);
1144
-        $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0;
1145
-        $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create');
1143
+        $values = FrmEntriesHelper::setup_new_vars( $fields, $form, true );
1144
+        $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][$form->id] ) ) ? $frm_vars['created_entries'][$form->id]['entry_id'] : 0;
1145
+        $conf_method = apply_filters( 'frm_success_filter', 'message', $form, $form->options, 'create' );
1146 1146
 
1147
-        if ( $created && is_numeric($created) && $conf_method != 'message' ) {
1148
-            do_action('frm_success_action', $conf_method, $form, $form->options, $created);
1147
+        if ( $created && is_numeric( $created ) && $conf_method != 'message' ) {
1148
+            do_action( 'frm_success_action', $conf_method, $form, $form->options, $created );
1149 1149
 			do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
1150 1150
             return;
1151 1151
         }
1152 1152
 
1153
-        if ( $created && is_numeric($created) ) {
1154
-            $message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg;
1153
+        if ( $created && is_numeric( $created ) ) {
1154
+            $message = isset( $form->options['success_msg'] ) ? $form->options['success_msg'] : $frm_settings->success_msg;
1155 1155
             $class = 'frm_message';
1156 1156
         } else {
1157 1157
             $message = $frm_settings->failed_msg;
@@ -1162,16 +1162,16 @@  discard block
 block discarded – undo
1162 1162
 			'message' => $message, 'form' => $form,
1163 1163
 			'entry_id' => $created, 'class' => $class,
1164 1164
 		) );
1165
-        $message = apply_filters('frm_main_feedback', $message, $form, $created);
1165
+        $message = apply_filters( 'frm_main_feedback', $message, $form, $created );
1166 1166
 
1167
-        if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) {
1168
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1167
+        if ( ! isset( $form->options['show_form'] ) || $form->options['show_form'] ) {
1168
+            require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' );
1169 1169
         } else {
1170 1170
             global $frm_vars;
1171 1171
 			self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] );
1172 1172
 
1173
-            $include_extra_container = 'frm_forms'. FrmFormsHelper::get_form_style_class($values);
1174
-            include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php');
1173
+            $include_extra_container = 'frm_forms' . FrmFormsHelper::get_form_style_class( $values );
1174
+            include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/errors.php' );
1175 1175
         }
1176 1176
 
1177 1177
 		do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
Please login to merge, or discard this patch.
classes/controllers/FrmStylesController.php 2 patches
Indentation   +317 added lines, -317 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,31 +37,31 @@  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() {
44
-        add_submenu_page('formidable', 'Formidable | '. __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route');
45
-    }
43
+	public static function menu() {
44
+		add_submenu_page('formidable', 'Formidable | '. __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route');
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();
53
-        wp_enqueue_script('jquery-ui-datepicker');
52
+		self::load_pro_hooks();
53
+		wp_enqueue_script('jquery-ui-datepicker');
54 54
 
55
-        $version = FrmAppHelper::plugin_version();
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 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);
61
-        if ( $style ) {
60
+		$style = apply_filters('frm_style_head', false);
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
-        }
64
-    }
63
+		}
64
+	}
65 65
 
66 66
 	public static function enqueue_css( $register = 'enqueue' ) {
67 67
 		global $frm_vars;
@@ -141,230 +141,230 @@  discard block
 block discarded – undo
141 141
 	}
142 142
 
143 143
 	public static function new_style( $return = '' ) {
144
-        self::load_styler('default');
145
-    }
144
+		self::load_styler('default');
145
+	}
146 146
 
147 147
 	public static function duplicate() {
148 148
 		self::load_styler('default');
149 149
 	}
150 150
 
151 151
 	public static function edit( $style_id = false, $message = '' ) {
152
-        if ( ! $style_id ) {
152
+		if ( ! $style_id ) {
153 153
 			$style_id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
154
-            if ( empty($style_id) ) {
155
-                $style_id = 'default';
156
-            }
157
-        }
158
-
159
-        if ( 'default' == $style_id ) {
160
-            $style = 'default';
161
-        } else {
162
-            $frm_style = new FrmStyle($style_id);
163
-            $style = $frm_style->get_one();
164
-            $style = $style->ID;
165
-        }
166
-
167
-        self::load_styler($style, $message);
168
-    }
169
-
170
-    public static function save() {
171
-        $frm_style = new FrmStyle();
172
-        $message = '';
154
+			if ( empty($style_id) ) {
155
+				$style_id = 'default';
156
+			}
157
+		}
158
+
159
+		if ( 'default' == $style_id ) {
160
+			$style = 'default';
161
+		} else {
162
+			$frm_style = new FrmStyle($style_id);
163
+			$style = $frm_style->get_one();
164
+			$style = $style->ID;
165
+		}
166
+
167
+		self::load_styler($style, $message);
168
+	}
169
+
170
+	public static function save() {
171
+		$frm_style = new FrmStyle();
172
+		$message = '';
173 173
 		$post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_title' );
174 174
 		$style_nonce = FrmAppHelper::get_post_param( 'frm_style', '', 'sanitize_text_field' );
175 175
 
176 176
 		if ( $post_id !== false && wp_verify_nonce( $style_nonce, 'frm_style_nonce' ) ) {
177
-            $id = $frm_style->update($post_id);
178
-            if ( empty($post_id) && ! empty($id) ) {
179
-                // set the post id to the new style so it will be loaded for editing
180
-                $post_id = reset($id);
181
-            }
182
-            // include the CSS that includes this style
177
+			$id = $frm_style->update($post_id);
178
+			if ( empty($post_id) && ! empty($id) ) {
179
+				// set the post id to the new style so it will be loaded for editing
180
+				$post_id = reset($id);
181
+			}
182
+			// include the CSS that includes this style
183 183
 			echo '<link href="' . esc_url( admin_url( 'admin-ajax.php?action=frmpro_css' ) ) . '" type="text/css" rel="Stylesheet" class="frm-custom-theme" />';
184
-            $message = __( 'Your styling settings have been saved.', 'formidable' );
185
-        }
184
+			$message = __( 'Your styling settings have been saved.', 'formidable' );
185
+		}
186 186
 
187
-        return self::edit($post_id, $message);
188
-    }
187
+		return self::edit($post_id, $message);
188
+	}
189 189
 
190 190
 	public static function load_styler( $style, $message = '' ) {
191
-        global $frm_settings;
191
+		global $frm_settings;
192 192
 
193
-        $frm_style = new FrmStyle();
194
-        $styles = $frm_style->get_all();
193
+		$frm_style = new FrmStyle();
194
+		$styles = $frm_style->get_all();
195 195
 
196
-        if ( is_numeric($style) ) {
197
-            $style = $styles[ $style ];
198
-        } else if ( 'default' == $style ) {
199
-            $style = $frm_style->get_default_style($styles);
200
-        }
196
+		if ( is_numeric($style) ) {
197
+			$style = $styles[ $style ];
198
+		} else if ( 'default' == $style ) {
199
+			$style = $frm_style->get_default_style($styles);
200
+		}
201 201
 
202
-        self::add_meta_boxes();
202
+		self::add_meta_boxes();
203 203
 
204
-        include(FrmAppHelper::plugin_path() .'/classes/views/styles/show.php');
205
-    }
204
+		include(FrmAppHelper::plugin_path() .'/classes/views/styles/show.php');
205
+	}
206 206
 
207 207
 	/**
208 208
 	 * @param string $message
209 209
 	 * @param array|object $forms
210 210
 	 */
211 211
 	private static function manage( $message = '', $forms = array() ) {
212
-        $frm_style = new FrmStyle();
213
-        $styles = $frm_style->get_all();
214
-        $default_style = $frm_style->get_default_style($styles);
212
+		$frm_style = new FrmStyle();
213
+		$styles = $frm_style->get_all();
214
+		$default_style = $frm_style->get_default_style($styles);
215 215
 
216
-        if ( empty($forms) ) {
217
-            $forms = FrmForm::get_published_forms();
218
-        }
216
+		if ( empty($forms) ) {
217
+			$forms = FrmForm::get_published_forms();
218
+		}
219 219
 
220
-        include(FrmAppHelper::plugin_path() .'/classes/views/styles/manage.php');
221
-    }
220
+		include(FrmAppHelper::plugin_path() .'/classes/views/styles/manage.php');
221
+	}
222 222
 
223
-    private static function manage_styles() {
223
+	private static function manage_styles() {
224 224
 		$style_nonce = FrmAppHelper::get_post_param( 'frm_manage_style', '', 'sanitize_text_field' );
225 225
 		if ( ! $_POST || ! isset( $_POST['style'] ) || ! wp_verify_nonce( $style_nonce, 'frm_manage_style_nonce' ) ) {
226
-            return self::manage();
227
-        }
226
+			return self::manage();
227
+		}
228 228
 
229
-        global $wpdb;
229
+		global $wpdb;
230 230
 
231 231
 		$forms = FrmForm::get_published_forms();
232
-        foreach ( $forms as $form ) {
233
-            if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) {
234
-                continue;
235
-            }
232
+		foreach ( $forms as $form ) {
233
+			if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) {
234
+				continue;
235
+			}
236 236
 
237
-            $form->options['custom_style'] = $_POST['style'][ $form->id ];
237
+			$form->options['custom_style'] = $_POST['style'][ $form->id ];
238 238
 
239 239
 			$wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) );
240
-            unset($form);
241
-        }
240
+			unset($form);
241
+		}
242 242
 
243
-        $message = __( 'Your form styles have been saved.', 'formidable' );
244
-        return self::manage($message, $forms);
245
-    }
243
+		$message = __( 'Your form styles have been saved.', 'formidable' );
244
+		return self::manage($message, $forms);
245
+	}
246 246
 
247
-    public static function custom_css( $message = '', $style = null ) {
248
-        wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css');
249
-        wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7');
250
-        wp_enqueue_script( 'codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array( 'codemirror' ), '4.7' );
247
+	public static function custom_css( $message = '', $style = null ) {
248
+		wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css');
249
+		wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7');
250
+		wp_enqueue_script( 'codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array( 'codemirror' ), '4.7' );
251 251
 
252
-        if ( ! isset($style) ) {
253
-            $frm_style = new FrmStyle();
254
-            $style = $frm_style->get_default_style();
255
-        }
252
+		if ( ! isset($style) ) {
253
+			$frm_style = new FrmStyle();
254
+			$style = $frm_style->get_default_style();
255
+		}
256 256
 
257
-        include(FrmAppHelper::plugin_path() .'/classes/views/styles/custom_css.php');
258
-    }
257
+		include(FrmAppHelper::plugin_path() .'/classes/views/styles/custom_css.php');
258
+	}
259 259
 
260
-    public static function save_css() {
261
-        $frm_style = new FrmStyle();
260
+	public static function save_css() {
261
+		$frm_style = new FrmStyle();
262 262
 
263
-        $message = '';
263
+		$message = '';
264 264
 		$post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_text_field' );
265 265
 		$nonce = FrmAppHelper::get_post_param( 'frm_custom_css', '', 'sanitize_text_field' );
266 266
 		if ( wp_verify_nonce( $nonce, 'frm_custom_css_nonce' ) ) {
267
-            $frm_style->update($post_id);
268
-            $message = __( 'Your styling settings have been saved.', 'formidable' );
269
-        }
267
+			$frm_style->update($post_id);
268
+			$message = __( 'Your styling settings have been saved.', 'formidable' );
269
+		}
270 270
 
271
-        return self::custom_css($message);
272
-    }
271
+		return self::custom_css($message);
272
+	}
273 273
 
274
-    public static function route() {
274
+	public static function route() {
275 275
 		$action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
276 276
 
277
-        switch ( $action ) {
278
-            case 'edit':
279
-            case 'save':
280
-            case 'manage':
281
-            case 'manage_styles':
282
-            case 'custom_css':
283
-            case 'save_css':
277
+		switch ( $action ) {
278
+			case 'edit':
279
+			case 'save':
280
+			case 'manage':
281
+			case 'manage_styles':
282
+			case 'custom_css':
283
+			case 'save_css':
284 284
 				return self::$action();
285
-            default:
286
-            	do_action( 'frm_style_action_route', $action );
287
-            	if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) {
288
-                	return;
289
-            	}
285
+			default:
286
+				do_action( 'frm_style_action_route', $action );
287
+				if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) {
288
+					return;
289
+				}
290 290
 
291
-                if ( 'new_style' == $action || 'duplicate' == $action ) {
292
-                    return self::$action();
293
-                }
291
+				if ( 'new_style' == $action || 'duplicate' == $action ) {
292
+					return self::$action();
293
+				}
294 294
 
295
-                return self::edit();
296
-        }
297
-    }
295
+				return self::edit();
296
+		}
297
+	}
298 298
 
299
-    public static function reset_styling() {
299
+	public static function reset_styling() {
300 300
 		FrmAppHelper::permission_check('frm_change_settings');
301
-        check_ajax_referer( 'frm_ajax', 'nonce' );
302
-
303
-        $frm_style = new FrmStyle();
304
-        $defaults = $frm_style->get_defaults();
305
-
306
-        echo json_encode( $defaults );
307
-        wp_die();
308
-    }
309
-
310
-    public static function change_styling() {
311
-        check_ajax_referer( 'frm_ajax', 'nonce' );
312
-
313
-        $frm_style = new FrmStyle();
314
-        $defaults = $frm_style->get_defaults();
315
-
316
-        // remove the # from the colors
317
-        foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) {
318
-            if ( ! is_array($v) && strpos($v, '#') === 0 ) {
319
-                $_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v );
320
-            }
321
-        }
322
-
323
-        echo '<style type="text/css">';
324
-        include(FrmAppHelper::plugin_path() .'/css/_single_theme.css.php');
325
-        echo '</style>';
326
-        wp_die();
327
-    }
328
-
329
-    private static function add_meta_boxes() {
330
-
331
-        // setup meta boxes
332
-        $meta_boxes = array(
333
-            'general'           => __( 'General', 'formidable' ),
334
-            'form-title'        => __( 'Form Title', 'formidable' ),
335
-            'form-description'  => __( 'Form Description', 'formidable' ),
336
-            'field-labels'      => __( 'Field Labels', 'formidable' ),
337
-            'field-description' => __( 'Field Description', 'formidable' ),
338
-            'field-colors'      => __( 'Field Colors', 'formidable' ),
339
-            'field-sizes'       => __( 'Field Settings', 'formidable' ),
340
-            'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ),
341
-            'section-fields'    => __( 'Section Fields', 'formidable' ),
342
-            'date-fields'       => __( 'Date Fields', 'formidable' ),
343
-            'buttons'           => __( 'Buttons', 'formidable' ),
344
-            'form-messages'     => __( 'Form Messages', 'formidable' ),
345
-        );
346
-
347
-        foreach ( $meta_boxes as $nicename => $name ) {
348
-            add_meta_box( $nicename .'-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename );
349
-            unset($nicename, $name);
350
-        }
351
-    }
301
+		check_ajax_referer( 'frm_ajax', 'nonce' );
302
+
303
+		$frm_style = new FrmStyle();
304
+		$defaults = $frm_style->get_defaults();
305
+
306
+		echo json_encode( $defaults );
307
+		wp_die();
308
+	}
309
+
310
+	public static function change_styling() {
311
+		check_ajax_referer( 'frm_ajax', 'nonce' );
312
+
313
+		$frm_style = new FrmStyle();
314
+		$defaults = $frm_style->get_defaults();
315
+
316
+		// remove the # from the colors
317
+		foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) {
318
+			if ( ! is_array($v) && strpos($v, '#') === 0 ) {
319
+				$_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v );
320
+			}
321
+		}
322
+
323
+		echo '<style type="text/css">';
324
+		include(FrmAppHelper::plugin_path() .'/css/_single_theme.css.php');
325
+		echo '</style>';
326
+		wp_die();
327
+	}
328
+
329
+	private static function add_meta_boxes() {
330
+
331
+		// setup meta boxes
332
+		$meta_boxes = array(
333
+			'general'           => __( 'General', 'formidable' ),
334
+			'form-title'        => __( 'Form Title', 'formidable' ),
335
+			'form-description'  => __( 'Form Description', 'formidable' ),
336
+			'field-labels'      => __( 'Field Labels', 'formidable' ),
337
+			'field-description' => __( 'Field Description', 'formidable' ),
338
+			'field-colors'      => __( 'Field Colors', 'formidable' ),
339
+			'field-sizes'       => __( 'Field Settings', 'formidable' ),
340
+			'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ),
341
+			'section-fields'    => __( 'Section Fields', 'formidable' ),
342
+			'date-fields'       => __( 'Date Fields', 'formidable' ),
343
+			'buttons'           => __( 'Buttons', 'formidable' ),
344
+			'form-messages'     => __( 'Form Messages', 'formidable' ),
345
+		);
346
+
347
+		foreach ( $meta_boxes as $nicename => $name ) {
348
+			add_meta_box( $nicename .'-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename );
349
+			unset($nicename, $name);
350
+		}
351
+	}
352 352
 
353 353
 	public static function include_style_section( $atts, $sec ) {
354
-        extract($atts);
354
+		extract($atts);
355 355
 		$current_tab = FrmAppHelper::simple_get( 'page-tab', 'sanitize_title', 'default' );
356
-        include(FrmAppHelper::plugin_path() .'/classes/views/styles/_'. $sec['args'] .'.php');
357
-    }
356
+		include(FrmAppHelper::plugin_path() .'/classes/views/styles/_'. $sec['args'] .'.php');
357
+	}
358 358
 
359
-    public static function load_css() {
360
-        header('Content-type: text/css');
359
+	public static function load_css() {
360
+		header('Content-type: text/css');
361 361
 
362
-        $frm_style = new FrmStyle();
363
-        $defaults = $frm_style->get_defaults();
362
+		$frm_style = new FrmStyle();
363
+		$defaults = $frm_style->get_defaults();
364 364
 
365
-        include(FrmAppHelper::plugin_path() .'/css/_single_theme.css.php');
366
-        wp_die();
367
-    }
365
+		include(FrmAppHelper::plugin_path() .'/css/_single_theme.css.php');
366
+		wp_die();
367
+	}
368 368
 
369 369
 	public static function load_saved_css() {
370 370
 		$css = get_transient( 'frmpro_css' );
@@ -373,142 +373,142 @@  discard block
 block discarded – undo
373 373
 		wp_die();
374 374
 	}
375 375
 
376
-    /**
377
-     * Check if the Formidable styling should be loaded,
378
-     * then enqueue it for the footer
379
-     * @since 2.0
380
-     */
381
-    public static function enqueue_style() {
382
-        global $frm_vars;
383
-
384
-        if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) {
385
-            // the CSS has already been loaded
386
-            return;
387
-        }
388
-
389
-        $frm_settings = FrmAppHelper::get_settings();
390
-        if ( $frm_settings->load_style != 'none' ) {
391
-            wp_enqueue_style( 'formidable' );
392
-            $frm_vars['css_loaded'] = true;
393
-        }
394
-    }
395
-
396
-    // Get the stylesheets for the form settings page
397
-    public static function get_style_opts() {
398
-        $frm_style = new FrmStyle();
399
-        $styles = $frm_style->get_all();
400
-
401
-        return $styles;
402
-    }
403
-
404
-    public static function get_form_style( $form = 'default' ) {
405
-        $style = FrmFormsHelper::get_form_style( $form );
406
-
407
-        if ( empty( $style ) || 1 == $style ) {
408
-            $style = 'default';
409
-        }
410
-
411
-        $frm_style = new FrmStyle( $style );
412
-        return $frm_style->get_one();
413
-    }
414
-
415
-    /**
416
-     * @param string $class
417
-     * @param string $style
418
-     */
376
+	/**
377
+	 * Check if the Formidable styling should be loaded,
378
+	 * then enqueue it for the footer
379
+	 * @since 2.0
380
+	 */
381
+	public static function enqueue_style() {
382
+		global $frm_vars;
383
+
384
+		if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) {
385
+			// the CSS has already been loaded
386
+			return;
387
+		}
388
+
389
+		$frm_settings = FrmAppHelper::get_settings();
390
+		if ( $frm_settings->load_style != 'none' ) {
391
+			wp_enqueue_style( 'formidable' );
392
+			$frm_vars['css_loaded'] = true;
393
+		}
394
+	}
395
+
396
+	// Get the stylesheets for the form settings page
397
+	public static function get_style_opts() {
398
+		$frm_style = new FrmStyle();
399
+		$styles = $frm_style->get_all();
400
+
401
+		return $styles;
402
+	}
403
+
404
+	public static function get_form_style( $form = 'default' ) {
405
+		$style = FrmFormsHelper::get_form_style( $form );
406
+
407
+		if ( empty( $style ) || 1 == $style ) {
408
+			$style = 'default';
409
+		}
410
+
411
+		$frm_style = new FrmStyle( $style );
412
+		return $frm_style->get_one();
413
+	}
414
+
415
+	/**
416
+	 * @param string $class
417
+	 * @param string $style
418
+	 */
419 419
 	public static function get_form_style_class( $class, $style ) {
420
-        if ( 1 == $style ) {
421
-            $style = 'default';
422
-        }
420
+		if ( 1 == $style ) {
421
+			$style = 'default';
422
+		}
423 423
 
424
-        $frm_style = new FrmStyle($style);
425
-        $style = $frm_style->get_one();
424
+		$frm_style = new FrmStyle($style);
425
+		$style = $frm_style->get_one();
426 426
 
427
-        if ( $style ) {
428
-            $class .= ' frm_style_'. $style->post_name;
429
-        }
427
+		if ( $style ) {
428
+			$class .= ' frm_style_'. $style->post_name;
429
+		}
430 430
 
431
-        return $class;
432
-    }
431
+		return $class;
432
+	}
433 433
 
434
-    /**
435
-     * @param string $val
436
-     */
434
+	/**
435
+	 * @param string $val
436
+	 */
437 437
 	public static function get_style_val( $val, $form = 'default' ) {
438
-        $style = self::get_form_style($form);
439
-        if ( $style && isset( $style->post_content[ $val ] ) ) {
440
-            return $style->post_content[ $val ];
441
-        }
442
-    }
438
+		$style = self::get_form_style($form);
439
+		if ( $style && isset( $style->post_content[ $val ] ) ) {
440
+			return $style->post_content[ $val ];
441
+		}
442
+	}
443 443
 
444 444
 	public static function show_entry_styles( $default_styles ) {
445
-        $frm_style = new FrmStyle('default');
446
-        $style = $frm_style->get_one();
447
-
448
-        if ( ! $style ) {
449
-            return $default_styles;
450
-        }
451
-
452
-        foreach ( $default_styles as $name => $val ) {
453
-            $setting = $name;
454
-            if ( 'border_width' == $name ) {
455
-                $setting = 'field_border_width';
456
-            } else if ( 'alt_bg_color' == $name ) {
457
-                $setting = 'bg_color_active';
458
-            }
459
-            $default_styles[ $name ] = $style->post_content[ $setting ];
460
-            unset($name, $val);
461
-        }
462
-
463
-        return $default_styles;
464
-    }
445
+		$frm_style = new FrmStyle('default');
446
+		$style = $frm_style->get_one();
447
+
448
+		if ( ! $style ) {
449
+			return $default_styles;
450
+		}
451
+
452
+		foreach ( $default_styles as $name => $val ) {
453
+			$setting = $name;
454
+			if ( 'border_width' == $name ) {
455
+				$setting = 'field_border_width';
456
+			} else if ( 'alt_bg_color' == $name ) {
457
+				$setting = 'bg_color_active';
458
+			}
459
+			$default_styles[ $name ] = $style->post_content[ $setting ];
460
+			unset($name, $val);
461
+		}
462
+
463
+		return $default_styles;
464
+	}
465 465
 
466 466
 	public static function &important_style( $important, $field ) {
467
-        $important = self::get_style_val('important_style', $field['form_id']);
468
-        return $important;
469
-    }
467
+		$important = self::get_style_val('important_style', $field['form_id']);
468
+		return $important;
469
+	}
470 470
 
471
-    /**
472
-     * Fallback for WP < 3.6
473
-     */
474
-    public static function do_accordion_sections( $screen, $context, $object ) {
475
-        if ( function_exists( 'do_accordion_sections' ) ) {
476
-            return do_accordion_sections( $screen, $context, $object );
477
-        }
471
+	/**
472
+	 * Fallback for WP < 3.6
473
+	 */
474
+	public static function do_accordion_sections( $screen, $context, $object ) {
475
+		if ( function_exists( 'do_accordion_sections' ) ) {
476
+			return do_accordion_sections( $screen, $context, $object );
477
+		}
478 478
 
479
-    	global $wp_meta_boxes;
479
+		global $wp_meta_boxes;
480 480
 
481
-        $screen = 'formidable_page_formidable-styles';
482
-        $screen = convert_to_screen( $screen );
481
+		$screen = 'formidable_page_formidable-styles';
482
+		$screen = convert_to_screen( $screen );
483 483
 
484
-    	$page = $screen->id;
484
+		$page = $screen->id;
485 485
 
486
-    	$hidden = get_hidden_meta_boxes( $screen );
487
-    	?>
486
+		$hidden = get_hidden_meta_boxes( $screen );
487
+		?>
488 488
     	<div id="side-sortables" class="accordion-container">
489 489
     	<?php
490
-    	$i = 0;
491
-    	$first_open = false;
492
-    	do {
490
+		$i = 0;
491
+		$first_open = false;
492
+		do {
493 493
 			if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
494 494
 				break;
495 495
 			}
496 496
 
497
-    		foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
498
-    			if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
499
-    				foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
500
-    					if ( false == $box || ! $box['title'] ) {
501
-    						continue;
497
+			foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
498
+				if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
499
+					foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
500
+						if ( false == $box || ! $box['title'] ) {
501
+							continue;
502 502
 						}
503 503
 
504
-    					$i++;
505
-    					$hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
504
+						$i++;
505
+						$hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
506 506
 
507
-    					if ( ! $first_open && empty( $hidden_class ) ) {
508
-    						$first_open = true;
509
-    					}
507
+						if ( ! $first_open && empty( $hidden_class ) ) {
508
+							$first_open = true;
509
+						}
510 510
 
511
-    					?>
511
+						?>
512 512
 						<div class="postbox <?php echo esc_attr( $box['id'] ); ?>">
513 513
 						<div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'formidable' ) ?>"><br/></div>
514 514
                         <h3 class='hndle'><span><?php echo esc_html( $box['title'] ); ?></span></h3>
@@ -519,13 +519,13 @@  discard block
 block discarded – undo
519 519
     						</div><!-- .accordion-section-content -->
520 520
     					</div><!-- .postbox -->
521 521
     					<?php
522
-    				}
523
-    			}
524
-    		}
525
-    	} while ( 0 );
526
-    	?>
522
+					}
523
+				}
524
+			}
525
+		} while ( 0 );
526
+		?>
527 527
     	</div><!-- .accordion-container -->
528 528
     	<?php
529
-    	return $i;
530
-    }
529
+		return $i;
530
+	}
531 531
 }
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -41,25 +41,25 @@  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
-			wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) .'&'. http_build_query( $style->post_content ) );
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
         }
64 64
     }
65 65
 
@@ -141,17 +141,17 @@  discard block
 block discarded – undo
141 141
 	}
142 142
 
143 143
 	public static function new_style( $return = '' ) {
144
-        self::load_styler('default');
144
+        self::load_styler( 'default' );
145 145
     }
146 146
 
147 147
 	public static function duplicate() {
148
-		self::load_styler('default');
148
+		self::load_styler( 'default' );
149 149
 	}
150 150
 
151 151
 	public static function edit( $style_id = false, $message = '' ) {
152 152
         if ( ! $style_id ) {
153 153
 			$style_id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
154
-            if ( empty($style_id) ) {
154
+            if ( empty( $style_id ) ) {
155 155
                 $style_id = 'default';
156 156
             }
157 157
         }
@@ -159,12 +159,12 @@  discard block
 block discarded – undo
159 159
         if ( 'default' == $style_id ) {
160 160
             $style = 'default';
161 161
         } else {
162
-            $frm_style = new FrmStyle($style_id);
162
+            $frm_style = new FrmStyle( $style_id );
163 163
             $style = $frm_style->get_one();
164 164
             $style = $style->ID;
165 165
         }
166 166
 
167
-        self::load_styler($style, $message);
167
+        self::load_styler( $style, $message );
168 168
     }
169 169
 
170 170
     public static function save() {
@@ -174,17 +174,17 @@  discard block
 block discarded – undo
174 174
 		$style_nonce = FrmAppHelper::get_post_param( 'frm_style', '', 'sanitize_text_field' );
175 175
 
176 176
 		if ( $post_id !== false && wp_verify_nonce( $style_nonce, 'frm_style_nonce' ) ) {
177
-            $id = $frm_style->update($post_id);
178
-            if ( empty($post_id) && ! empty($id) ) {
177
+            $id = $frm_style->update( $post_id );
178
+            if ( empty( $post_id ) && ! empty( $id ) ) {
179 179
                 // set the post id to the new style so it will be loaded for editing
180
-                $post_id = reset($id);
180
+                $post_id = reset( $id );
181 181
             }
182 182
             // include the CSS that includes this style
183 183
 			echo '<link href="' . esc_url( admin_url( 'admin-ajax.php?action=frmpro_css' ) ) . '" type="text/css" rel="Stylesheet" class="frm-custom-theme" />';
184 184
             $message = __( 'Your styling settings have been saved.', 'formidable' );
185 185
         }
186 186
 
187
-        return self::edit($post_id, $message);
187
+        return self::edit( $post_id, $message );
188 188
     }
189 189
 
190 190
 	public static function load_styler( $style, $message = '' ) {
@@ -193,15 +193,15 @@  discard block
 block discarded – undo
193 193
         $frm_style = new FrmStyle();
194 194
         $styles = $frm_style->get_all();
195 195
 
196
-        if ( is_numeric($style) ) {
197
-            $style = $styles[ $style ];
196
+        if ( is_numeric( $style ) ) {
197
+            $style = $styles[$style];
198 198
         } else if ( 'default' == $style ) {
199
-            $style = $frm_style->get_default_style($styles);
199
+            $style = $frm_style->get_default_style( $styles );
200 200
         }
201 201
 
202 202
         self::add_meta_boxes();
203 203
 
204
-        include(FrmAppHelper::plugin_path() .'/classes/views/styles/show.php');
204
+        include( FrmAppHelper::plugin_path() . '/classes/views/styles/show.php' );
205 205
     }
206 206
 
207 207
 	/**
@@ -211,13 +211,13 @@  discard block
 block discarded – undo
211 211
 	private static function manage( $message = '', $forms = array() ) {
212 212
         $frm_style = new FrmStyle();
213 213
         $styles = $frm_style->get_all();
214
-        $default_style = $frm_style->get_default_style($styles);
214
+        $default_style = $frm_style->get_default_style( $styles );
215 215
 
216
-        if ( empty($forms) ) {
216
+        if ( empty( $forms ) ) {
217 217
             $forms = FrmForm::get_published_forms();
218 218
         }
219 219
 
220
-        include(FrmAppHelper::plugin_path() .'/classes/views/styles/manage.php');
220
+        include( FrmAppHelper::plugin_path() . '/classes/views/styles/manage.php' );
221 221
     }
222 222
 
223 223
     private static function manage_styles() {
@@ -230,31 +230,31 @@  discard block
 block discarded – undo
230 230
 
231 231
 		$forms = FrmForm::get_published_forms();
232 232
         foreach ( $forms as $form ) {
233
-            if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) {
233
+            if ( $_POST['style'][$form->id] == $_POST['prev_style'][$form->id] ) {
234 234
                 continue;
235 235
             }
236 236
 
237
-            $form->options['custom_style'] = $_POST['style'][ $form->id ];
237
+            $form->options['custom_style'] = $_POST['style'][$form->id];
238 238
 
239 239
 			$wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) );
240
-            unset($form);
240
+            unset( $form );
241 241
         }
242 242
 
243 243
         $message = __( 'Your form styles have been saved.', 'formidable' );
244
-        return self::manage($message, $forms);
244
+        return self::manage( $message, $forms );
245 245
     }
246 246
 
247 247
     public static function custom_css( $message = '', $style = null ) {
248
-        wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css');
249
-        wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7');
248
+        wp_enqueue_style( 'codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css' );
249
+        wp_enqueue_script( 'codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7' );
250 250
         wp_enqueue_script( 'codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array( 'codemirror' ), '4.7' );
251 251
 
252
-        if ( ! isset($style) ) {
252
+        if ( ! isset( $style ) ) {
253 253
             $frm_style = new FrmStyle();
254 254
             $style = $frm_style->get_default_style();
255 255
         }
256 256
 
257
-        include(FrmAppHelper::plugin_path() .'/classes/views/styles/custom_css.php');
257
+        include( FrmAppHelper::plugin_path() . '/classes/views/styles/custom_css.php' );
258 258
     }
259 259
 
260 260
     public static function save_css() {
@@ -264,11 +264,11 @@  discard block
 block discarded – undo
264 264
 		$post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_text_field' );
265 265
 		$nonce = FrmAppHelper::get_post_param( 'frm_custom_css', '', 'sanitize_text_field' );
266 266
 		if ( wp_verify_nonce( $nonce, 'frm_custom_css_nonce' ) ) {
267
-            $frm_style->update($post_id);
267
+            $frm_style->update( $post_id );
268 268
             $message = __( 'Your styling settings have been saved.', 'formidable' );
269 269
         }
270 270
 
271
-        return self::custom_css($message);
271
+        return self::custom_css( $message );
272 272
     }
273 273
 
274 274
     public static function route() {
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
     }
298 298
 
299 299
     public static function reset_styling() {
300
-		FrmAppHelper::permission_check('frm_change_settings');
300
+		FrmAppHelper::permission_check( 'frm_change_settings' );
301 301
         check_ajax_referer( 'frm_ajax', 'nonce' );
302 302
 
303 303
         $frm_style = new FrmStyle();
@@ -315,13 +315,13 @@  discard block
 block discarded – undo
315 315
 
316 316
         // remove the # from the colors
317 317
         foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) {
318
-            if ( ! is_array($v) && strpos($v, '#') === 0 ) {
319
-                $_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v );
318
+            if ( ! is_array( $v ) && strpos( $v, '#' ) === 0 ) {
319
+                $_GET['frm_style_setting']['post_content'][$k] = str_replace( '#', '', $v );
320 320
             }
321 321
         }
322 322
 
323 323
         echo '<style type="text/css">';
324
-        include(FrmAppHelper::plugin_path() .'/css/_single_theme.css.php');
324
+        include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' );
325 325
         echo '</style>';
326 326
         wp_die();
327 327
     }
@@ -345,24 +345,24 @@  discard block
 block discarded – undo
345 345
         );
346 346
 
347 347
         foreach ( $meta_boxes as $nicename => $name ) {
348
-            add_meta_box( $nicename .'-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename );
349
-            unset($nicename, $name);
348
+            add_meta_box( $nicename . '-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename );
349
+            unset( $nicename, $name );
350 350
         }
351 351
     }
352 352
 
353 353
 	public static function include_style_section( $atts, $sec ) {
354
-        extract($atts);
354
+        extract( $atts );
355 355
 		$current_tab = FrmAppHelper::simple_get( 'page-tab', 'sanitize_title', 'default' );
356
-        include(FrmAppHelper::plugin_path() .'/classes/views/styles/_'. $sec['args'] .'.php');
356
+        include( FrmAppHelper::plugin_path() . '/classes/views/styles/_' . $sec['args'] . '.php' );
357 357
     }
358 358
 
359 359
     public static function load_css() {
360
-        header('Content-type: text/css');
360
+        header( 'Content-type: text/css' );
361 361
 
362 362
         $frm_style = new FrmStyle();
363 363
         $defaults = $frm_style->get_defaults();
364 364
 
365
-        include(FrmAppHelper::plugin_path() .'/css/_single_theme.css.php');
365
+        include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' );
366 366
         wp_die();
367 367
     }
368 368
 
@@ -421,11 +421,11 @@  discard block
 block discarded – undo
421 421
             $style = 'default';
422 422
         }
423 423
 
424
-        $frm_style = new FrmStyle($style);
424
+        $frm_style = new FrmStyle( $style );
425 425
         $style = $frm_style->get_one();
426 426
 
427 427
         if ( $style ) {
428
-            $class .= ' frm_style_'. $style->post_name;
428
+            $class .= ' frm_style_' . $style->post_name;
429 429
         }
430 430
 
431 431
         return $class;
@@ -435,14 +435,14 @@  discard block
 block discarded – undo
435 435
      * @param string $val
436 436
      */
437 437
 	public static function get_style_val( $val, $form = 'default' ) {
438
-        $style = self::get_form_style($form);
439
-        if ( $style && isset( $style->post_content[ $val ] ) ) {
440
-            return $style->post_content[ $val ];
438
+        $style = self::get_form_style( $form );
439
+        if ( $style && isset( $style->post_content[$val] ) ) {
440
+            return $style->post_content[$val];
441 441
         }
442 442
     }
443 443
 
444 444
 	public static function show_entry_styles( $default_styles ) {
445
-        $frm_style = new FrmStyle('default');
445
+        $frm_style = new FrmStyle( 'default' );
446 446
         $style = $frm_style->get_one();
447 447
 
448 448
         if ( ! $style ) {
@@ -456,15 +456,15 @@  discard block
 block discarded – undo
456 456
             } else if ( 'alt_bg_color' == $name ) {
457 457
                 $setting = 'bg_color_active';
458 458
             }
459
-            $default_styles[ $name ] = $style->post_content[ $setting ];
460
-            unset($name, $val);
459
+            $default_styles[$name] = $style->post_content[$setting];
460
+            unset( $name, $val );
461 461
         }
462 462
 
463 463
         return $default_styles;
464 464
     }
465 465
 
466 466
 	public static function &important_style( $important, $field ) {
467
-        $important = self::get_style_val('important_style', $field['form_id']);
467
+        $important = self::get_style_val( 'important_style', $field['form_id'] );
468 468
         return $important;
469 469
     }
470 470
 
@@ -490,18 +490,18 @@  discard block
 block discarded – undo
490 490
     	$i = 0;
491 491
     	$first_open = false;
492 492
     	do {
493
-			if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
493
+			if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[$page] ) || ! isset( $wp_meta_boxes[$page][$context] ) ) {
494 494
 				break;
495 495
 			}
496 496
 
497 497
     		foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
498
-    			if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
499
-    				foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
498
+    			if ( isset( $wp_meta_boxes[$page][$context][$priority] ) ) {
499
+    				foreach ( $wp_meta_boxes[$page][$context][$priority] as $box ) {
500 500
     					if ( false == $box || ! $box['title'] ) {
501 501
     						continue;
502 502
 						}
503 503
 
504
-    					$i++;
504
+    					$i ++;
505 505
     					$hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
506 506
 
507 507
     					if ( ! $first_open && empty( $hidden_class ) ) {
Please login to merge, or discard this patch.