Completed
Push — master ( 00c267...fcecd8 )
by Stephanie
02:49
created
classes/controllers/FrmHooksController.php 1 patch
Indentation   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -1,89 +1,89 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class FrmHooksController {
4
-    /**
5
-     * Trigger plugin-wide hook loading
6
-     */
7
-    public static function trigger_load_hook( $hooks = 'load_hooks' ) {
8
-        $controllers = apply_filters( 'frm_load_controllers', array( 'FrmHooksController' ) );
9
-
10
-        $trigger_hooks = $hooks;
11
-        $hooks = (array) $hooks;
12
-
13
-        if ( 'load_hooks' == $trigger_hooks ) {
14
-            if ( is_admin() ) {
15
-                $hooks[] = 'load_admin_hooks';
16
-                if ( defined( 'DOING_AJAX' ) ) {
17
-                    $hooks[] = 'load_ajax_hooks';
18
-                    $hooks[] = 'load_form_hooks';
19
-                }
20
-            }
21
-
22
-            if ( is_multisite() ) {
23
-                $hooks[] = 'load_multisite_hooks';
24
-            }
25
-        } else {
26
-            // Make sure the hooks are only triggered once
27
-            add_filter( 'frm' . str_replace( 'load', '', $trigger_hooks ) . '_loaded', '__return_true' );
28
-        }
29
-        unset( $trigger_hooks );
30
-
31
-        // Instansiate Controllers
32
-        foreach ( $controllers as $c ) {
33
-            foreach ( $hooks as $hook ) {
4
+	/**
5
+	 * Trigger plugin-wide hook loading
6
+	 */
7
+	public static function trigger_load_hook( $hooks = 'load_hooks' ) {
8
+		$controllers = apply_filters( 'frm_load_controllers', array( 'FrmHooksController' ) );
9
+
10
+		$trigger_hooks = $hooks;
11
+		$hooks = (array) $hooks;
12
+
13
+		if ( 'load_hooks' == $trigger_hooks ) {
14
+			if ( is_admin() ) {
15
+				$hooks[] = 'load_admin_hooks';
16
+				if ( defined( 'DOING_AJAX' ) ) {
17
+					$hooks[] = 'load_ajax_hooks';
18
+					$hooks[] = 'load_form_hooks';
19
+				}
20
+			}
21
+
22
+			if ( is_multisite() ) {
23
+				$hooks[] = 'load_multisite_hooks';
24
+			}
25
+		} else {
26
+			// Make sure the hooks are only triggered once
27
+			add_filter( 'frm' . str_replace( 'load', '', $trigger_hooks ) . '_loaded', '__return_true' );
28
+		}
29
+		unset( $trigger_hooks );
30
+
31
+		// Instansiate Controllers
32
+		foreach ( $controllers as $c ) {
33
+			foreach ( $hooks as $hook ) {
34 34
 				call_user_func( array( $c, $hook ) );
35 35
 				unset( $hook );
36
-            }
36
+			}
37 37
 			unset( $c );
38
-        }
38
+		}
39 39
 
40
-    }
40
+	}
41 41
 
42
-    public static function trigger_load_form_hooks() {
43
-        self::trigger_load_hook( 'load_form_hooks' );
44
-    }
42
+	public static function trigger_load_form_hooks() {
43
+		self::trigger_load_hook( 'load_form_hooks' );
44
+	}
45 45
 
46 46
 	public static function load_hooks() {
47
-        if ( ! is_admin() ) {
48
-            add_filter( 'the_content', 'FrmAppController::page_route', 10 );
49
-        }
47
+		if ( ! is_admin() ) {
48
+			add_filter( 'the_content', 'FrmAppController::page_route', 10 );
49
+		}
50 50
 
51
-        add_action( 'plugins_loaded', 'FrmAppController::load_lang' );
51
+		add_action( 'plugins_loaded', 'FrmAppController::load_lang' );
52 52
 		add_filter( 'widget_text', 'do_shortcode' );
53 53
 
54
-        // Entries controller
55
-        add_action( 'wp_loaded', 'FrmEntriesController::process_entry', 10, 0 );
56
-        add_filter( 'frm_redirect_url', 'FrmEntriesController::delete_entry_before_redirect', 50, 3 );
57
-        add_action( 'frm_after_entry_processed', 'FrmEntriesController::delete_entry_after_save', 100 );
54
+		// Entries controller
55
+		add_action( 'wp_loaded', 'FrmEntriesController::process_entry', 10, 0 );
56
+		add_filter( 'frm_redirect_url', 'FrmEntriesController::delete_entry_before_redirect', 50, 3 );
57
+		add_action( 'frm_after_entry_processed', 'FrmEntriesController::delete_entry_after_save', 100 );
58 58
 
59
-        // Form Actions Controller
60
-        add_action( 'init', 'FrmFormActionsController::register_post_types', 1 );
59
+		// Form Actions Controller
60
+		add_action( 'init', 'FrmFormActionsController::register_post_types', 1 );
61 61
 		add_action( 'frm_after_create_entry', 'FrmFormActionsController::trigger_create_actions', 20, 3 );
62 62
 
63
-        // Forms Controller
64
-        add_action( 'widgets_init', 'FrmFormsController::register_widgets' );
63
+		// Forms Controller
64
+		add_action( 'widgets_init', 'FrmFormsController::register_widgets' );
65 65
 		add_action( 'init', 'FrmFormsController::front_head' );
66
-        add_filter( 'frm_content', 'FrmFormsController::filter_content', 10, 3 );
67
-        add_filter( 'frm_replace_content_shortcodes', 'FrmFormsController::replace_content_shortcodes', 20, 3 );
68
-        add_action( 'admin_bar_init', 'FrmFormsController::admin_bar_css' );
66
+		add_filter( 'frm_content', 'FrmFormsController::filter_content', 10, 3 );
67
+		add_filter( 'frm_replace_content_shortcodes', 'FrmFormsController::replace_content_shortcodes', 20, 3 );
68
+		add_action( 'admin_bar_init', 'FrmFormsController::admin_bar_css' );
69 69
 		add_action( 'wp_footer', 'FrmFormsController::footer_js', 1, 0 );
70 70
 
71 71
 		add_action( 'wp_scheduled_delete', 'FrmForm::scheduled_delete' );
72 72
 
73
-        // Form Shortcodes
74
-        add_shortcode( 'formidable', 'FrmFormsController::get_form_shortcode' );
73
+		// Form Shortcodes
74
+		add_shortcode( 'formidable', 'FrmFormsController::get_form_shortcode' );
75 75
 
76
-        // Styles Controller
77
-        add_action( 'init', 'FrmStylesController::register_post_types', 0 );
78
-        add_filter( 'frm_get_style_opts', 'FrmStylesController::get_style_opts' );
79
-        add_filter( 'frm_add_form_style_class', 'FrmStylesController::get_form_style_class', 10, 2 );
80
-        add_filter( 'frm_show_entry_styles', 'FrmStylesController::show_entry_styles' );
81
-    }
76
+		// Styles Controller
77
+		add_action( 'init', 'FrmStylesController::register_post_types', 0 );
78
+		add_filter( 'frm_get_style_opts', 'FrmStylesController::get_style_opts' );
79
+		add_filter( 'frm_add_form_style_class', 'FrmStylesController::get_form_style_class', 10, 2 );
80
+		add_filter( 'frm_show_entry_styles', 'FrmStylesController::show_entry_styles' );
81
+	}
82 82
 
83 83
 	public static function load_admin_hooks() {
84
-        add_action( 'admin_menu', 'FrmAppController::menu', 1 );
85
-        add_action( 'admin_enqueue_scripts', 'FrmAppController::load_wp_admin_style' );
86
-        add_action( 'admin_notices', 'FrmAppController::pro_get_started_headline' );
84
+		add_action( 'admin_menu', 'FrmAppController::menu', 1 );
85
+		add_action( 'admin_enqueue_scripts', 'FrmAppController::load_wp_admin_style' );
86
+		add_action( 'admin_notices', 'FrmAppController::pro_get_started_headline' );
87 87
 		add_action( 'admin_init', 'FrmAppController::admin_init', 11 );
88 88
 		add_filter( 'plugin_action_links_' . FrmAppHelper::plugin_folder() . '/formidable.php', 'FrmAppController::settings_link' );
89 89
 		register_activation_hook( FrmAppHelper::plugin_folder() . '/formidable.php', 'FrmAppController::activation_install' );
@@ -92,120 +92,120 @@  discard block
 block discarded – undo
92 92
 		add_action( 'admin_menu', 'FrmAddonsController::menu', 100 );
93 93
 		add_filter( 'upgrader_pre_download', 'FrmAddonsController::add_shorten_edd_filename_filter', 10, 4 );
94 94
 
95
-        // Entries Controller
96
-        add_action( 'admin_menu', 'FrmEntriesController::menu', 12 );
97
-        add_filter( 'contextual_help', 'FrmEntriesController::contextual_help', 10, 3 );
98
-        add_filter( 'set-screen-option', 'FrmEntriesController::save_per_page', 10, 3 );
99
-        add_filter( 'update_user_metadata', 'FrmEntriesController::check_hidden_cols', 10, 5 );
100
-        add_action( 'updated_user_meta', 'FrmEntriesController::update_hidden_cols', 10, 4 );
95
+		// Entries Controller
96
+		add_action( 'admin_menu', 'FrmEntriesController::menu', 12 );
97
+		add_filter( 'contextual_help', 'FrmEntriesController::contextual_help', 10, 3 );
98
+		add_filter( 'set-screen-option', 'FrmEntriesController::save_per_page', 10, 3 );
99
+		add_filter( 'update_user_metadata', 'FrmEntriesController::check_hidden_cols', 10, 5 );
100
+		add_action( 'updated_user_meta', 'FrmEntriesController::update_hidden_cols', 10, 4 );
101 101
 
102
-        // Fields Controller
103
-        add_filter( 'frm_display_field_options', 'FrmFieldsController::display_field_options' );
102
+		// Fields Controller
103
+		add_filter( 'frm_display_field_options', 'FrmFieldsController::display_field_options' );
104 104
 
105
-        // Form Actions Controller
106
-        if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
107
-            add_action( 'frm_before_update_form_settings', 'FrmFormActionsController::update_settings' );
108
-        }
109
-        add_action( 'frm_after_duplicate_form', 'FrmFormActionsController::duplicate_form_actions', 20, 3 );
105
+		// Form Actions Controller
106
+		if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
107
+			add_action( 'frm_before_update_form_settings', 'FrmFormActionsController::update_settings' );
108
+		}
109
+		add_action( 'frm_after_duplicate_form', 'FrmFormActionsController::duplicate_form_actions', 20, 3 );
110 110
 
111
-        // Forms Controller
112
-        add_action( 'admin_menu', 'FrmFormsController::menu', 10 );
113
-        add_action( 'admin_head-toplevel_page_formidable', 'FrmFormsController::head' );
111
+		// Forms Controller
112
+		add_action( 'admin_menu', 'FrmFormsController::menu', 10 );
113
+		add_action( 'admin_head-toplevel_page_formidable', 'FrmFormsController::head' );
114 114
 
115
-        add_filter( 'set-screen-option', 'FrmFormsController::save_per_page', 10, 3 );
116
-        add_action( 'admin_footer', 'FrmFormsController::insert_form_popup' );
115
+		add_filter( 'set-screen-option', 'FrmFormsController::save_per_page', 10, 3 );
116
+		add_action( 'admin_footer', 'FrmFormsController::insert_form_popup' );
117 117
 		add_action( 'media_buttons', 'FrmFormsController::insert_form_button' );
118 118
 
119
-        // Forms Model
120
-        add_action( 'frm_after_duplicate_form', 'FrmForm::after_duplicate', 10, 2 );
119
+		// Forms Model
120
+		add_action( 'frm_after_duplicate_form', 'FrmForm::after_duplicate', 10, 2 );
121 121
 
122
-        // Settings Controller
123
-        add_action( 'admin_menu', 'FrmSettingsController::menu', 45 );
124
-        add_action( 'frm_before_settings', 'FrmSettingsController::license_box' );
122
+		// Settings Controller
123
+		add_action( 'admin_menu', 'FrmSettingsController::menu', 45 );
124
+		add_action( 'frm_before_settings', 'FrmSettingsController::license_box' );
125 125
 		add_action( 'wp_ajax_frm_settings_tab', 'FrmSettingsController::load_settings_tab' );
126 126
 
127
-        // Styles Controller
128
-        add_action( 'admin_menu', 'FrmStylesController::menu', 14 );
129
-        add_action( 'admin_init', 'FrmStylesController::admin_init' );
127
+		// Styles Controller
128
+		add_action( 'admin_menu', 'FrmStylesController::menu', 14 );
129
+		add_action( 'admin_init', 'FrmStylesController::admin_init' );
130 130
 
131
-        // XML Controller
132
-        add_action( 'admin_menu', 'FrmXMLController::menu', 41 );
133
-    }
131
+		// XML Controller
132
+		add_action( 'admin_menu', 'FrmXMLController::menu', 41 );
133
+	}
134 134
 
135 135
 	public static function load_ajax_hooks() {
136 136
 		add_action( 'wp_ajax_frm_silent_upgrade', 'FrmAppController::ajax_install' );
137 137
 		add_action( 'wp_ajax_nopriv_frm_silent_upgrade', 'FrmAppController::ajax_install' );
138 138
 		add_action( 'wp_ajax_frm_install', 'FrmAppController::ajax_install' );
139
-        add_action( 'wp_ajax_frm_uninstall', 'FrmAppController::uninstall' );
140
-        add_action( 'wp_ajax_frm_deauthorize', 'FrmAppController::deauthorize' );
139
+		add_action( 'wp_ajax_frm_uninstall', 'FrmAppController::uninstall' );
140
+		add_action( 'wp_ajax_frm_deauthorize', 'FrmAppController::deauthorize' );
141 141
 
142 142
 		// Addons
143 143
 		add_action( 'wp_ajax_frm_addon_activate', 'FrmAddon::activate' );
144 144
 		add_action( 'wp_ajax_frm_addon_deactivate', 'FrmAddon::deactivate' );
145 145
 		add_action( 'wp_ajax_frm_fill_licenses', 'FrmAddonsController::get_licenses' );
146 146
 
147
-        // Fields Controller
148
-        add_action( 'wp_ajax_frm_load_field', 'FrmFieldsController::load_field' );
149
-        add_action( 'wp_ajax_frm_insert_field', 'FrmFieldsController::create' );
150
-        add_action( 'wp_ajax_frm_field_name_in_place_edit', 'FrmFieldsController::edit_name' );
151
-        add_action( 'wp_ajax_frm_update_ajax_option', 'FrmFieldsController::update_ajax_option' );
152
-        add_action( 'wp_ajax_frm_duplicate_field', 'FrmFieldsController::duplicate' );
153
-        add_action( 'wp_ajax_frm_delete_field', 'FrmFieldsController::destroy' );
154
-        add_action( 'wp_ajax_frm_add_field_option', 'FrmFieldsController::add_option' );
155
-        add_action( 'wp_ajax_frm_import_choices', 'FrmFieldsController::import_choices' );
156
-        add_action( 'wp_ajax_frm_import_options', 'FrmFieldsController::import_options' );
157
-        add_action( 'wp_ajax_frm_update_field_order', 'FrmFieldsController::update_order' );
158
-
159
-        // Form Actions Controller
160
-        add_action( 'wp_ajax_frm_add_form_action', 'FrmFormActionsController::add_form_action' );
161
-        add_action( 'wp_ajax_frm_form_action_fill', 'FrmFormActionsController::fill_action' );
162
-
163
-        // Forms Controller
147
+		// Fields Controller
148
+		add_action( 'wp_ajax_frm_load_field', 'FrmFieldsController::load_field' );
149
+		add_action( 'wp_ajax_frm_insert_field', 'FrmFieldsController::create' );
150
+		add_action( 'wp_ajax_frm_field_name_in_place_edit', 'FrmFieldsController::edit_name' );
151
+		add_action( 'wp_ajax_frm_update_ajax_option', 'FrmFieldsController::update_ajax_option' );
152
+		add_action( 'wp_ajax_frm_duplicate_field', 'FrmFieldsController::duplicate' );
153
+		add_action( 'wp_ajax_frm_delete_field', 'FrmFieldsController::destroy' );
154
+		add_action( 'wp_ajax_frm_add_field_option', 'FrmFieldsController::add_option' );
155
+		add_action( 'wp_ajax_frm_import_choices', 'FrmFieldsController::import_choices' );
156
+		add_action( 'wp_ajax_frm_import_options', 'FrmFieldsController::import_options' );
157
+		add_action( 'wp_ajax_frm_update_field_order', 'FrmFieldsController::update_order' );
158
+
159
+		// Form Actions Controller
160
+		add_action( 'wp_ajax_frm_add_form_action', 'FrmFormActionsController::add_form_action' );
161
+		add_action( 'wp_ajax_frm_form_action_fill', 'FrmFormActionsController::fill_action' );
162
+
163
+		// Forms Controller
164 164
 		add_action( 'wp_ajax_frm_create_from_template', 'FrmFormsController::_create_from_template' );
165 165
 		add_action( 'wp_ajax_frm_save_form', 'FrmFormsController::route' );
166 166
 		add_action( 'wp_ajax_frm_form_key_in_place_edit', 'FrmFormsController::edit_key' );
167 167
 		add_action( 'wp_ajax_frm_form_desc_in_place_edit', 'FrmFormsController::edit_description' );
168
-        add_action( 'wp_ajax_frm_get_default_html', 'FrmFormsController::get_email_html' );
169
-        add_action( 'wp_ajax_frm_get_shortcode_opts', 'FrmFormsController::get_shortcode_opts' );
170
-        add_action( 'wp_ajax_frm_forms_preview', 'FrmFormsController::preview' );
171
-        add_action( 'wp_ajax_nopriv_frm_forms_preview', 'FrmFormsController::preview' );
172
-
173
-        // Styles Controller
174
-        add_action( 'wp_ajax_frm_settings_reset', 'FrmStylesController::reset_styling' );
175
-        add_action( 'wp_ajax_frm_change_styling', 'FrmStylesController::change_styling' );
176
-        add_action( 'wp_ajax_frmpro_load_css', 'FrmStylesController::load_css' );
177
-        add_action( 'wp_ajax_nopriv_frmpro_load_css', 'FrmStylesController::load_css' );
168
+		add_action( 'wp_ajax_frm_get_default_html', 'FrmFormsController::get_email_html' );
169
+		add_action( 'wp_ajax_frm_get_shortcode_opts', 'FrmFormsController::get_shortcode_opts' );
170
+		add_action( 'wp_ajax_frm_forms_preview', 'FrmFormsController::preview' );
171
+		add_action( 'wp_ajax_nopriv_frm_forms_preview', 'FrmFormsController::preview' );
172
+
173
+		// Styles Controller
174
+		add_action( 'wp_ajax_frm_settings_reset', 'FrmStylesController::reset_styling' );
175
+		add_action( 'wp_ajax_frm_change_styling', 'FrmStylesController::change_styling' );
176
+		add_action( 'wp_ajax_frmpro_load_css', 'FrmStylesController::load_css' );
177
+		add_action( 'wp_ajax_nopriv_frmpro_load_css', 'FrmStylesController::load_css' );
178 178
 		add_action( 'wp_ajax_frmpro_css', 'FrmStylesController::load_saved_css' );
179 179
 		add_action( 'wp_ajax_nopriv_frmpro_css', 'FrmStylesController::load_saved_css' );
180 180
 
181
-        // XML Controller
181
+		// XML Controller
182 182
 		add_action( 'wp_ajax_frm_entries_csv', 'FrmXMLController::csv' );
183 183
 		add_action( 'wp_ajax_nopriv_frm_entries_csv', 'FrmXMLController::csv' );
184
-        add_action( 'wp_ajax_frm_export_xml', 'FrmXMLController::export_xml' );
185
-    }
184
+		add_action( 'wp_ajax_frm_export_xml', 'FrmXMLController::export_xml' );
185
+	}
186 186
 
187 187
 	public static function load_form_hooks() {
188
-        // Fields Controller
189
-        add_filter( 'frm_field_type', 'FrmFieldsController::change_type' );
190
-        add_action( 'frm_field_input_html', 'FrmFieldsController::input_html' );
191
-        add_filter( 'frm_field_value_saved', 'FrmFieldsController::check_value', 50, 3 );
192
-        add_filter( 'frm_field_label_seen', 'FrmFieldsController::check_label' );
188
+		// Fields Controller
189
+		add_filter( 'frm_field_type', 'FrmFieldsController::change_type' );
190
+		add_action( 'frm_field_input_html', 'FrmFieldsController::input_html' );
191
+		add_filter( 'frm_field_value_saved', 'FrmFieldsController::check_value', 50, 3 );
192
+		add_filter( 'frm_field_label_seen', 'FrmFieldsController::check_label' );
193 193
 
194 194
 		// Forms Controller
195 195
 		add_filter( 'frm_form_classes', 'FrmFormsController::form_classes' );
196 196
 
197
-        // Styles Controller
198
-        add_filter( 'frm_use_important_width', 'FrmStylesController::important_style', 10, 2 );
199
-    }
197
+		// Styles Controller
198
+		add_filter( 'frm_use_important_width', 'FrmStylesController::important_style', 10, 2 );
199
+	}
200 200
 
201 201
 	public static function load_view_hooks() {
202
-        // Hooks go here when a view is loaded
203
-    }
202
+		// Hooks go here when a view is loaded
203
+	}
204 204
 
205 205
 	public static function load_multisite_hooks() {
206 206
 		add_action( 'wpmu_upgrade_site', 'FrmAppController::network_upgrade_site' );
207 207
 
208
-        // drop tables when mu site is deleted
209
-        add_filter( 'wpmu_drop_tables', 'FrmAppController::drop_tables' );
210
-    }
208
+		// drop tables when mu site is deleted
209
+		add_filter( 'wpmu_drop_tables', 'FrmAppController::drop_tables' );
210
+	}
211 211
 }
Please login to merge, or discard this patch.
classes/controllers/FrmStylesController.php 2 patches
Indentation   +192 added lines, -192 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class FrmStylesController {
4
-    public static $post_type = 'frm_styles';
5
-    public static $screen = 'formidable_page_formidable-styles';
6
-
7
-    public static function load_pro_hooks() {
8
-        if ( FrmAppHelper::pro_is_installed() ) {
9
-            FrmProStylesController::load_pro_hooks();
10
-        }
11
-    }
12
-
13
-    public static function register_post_types() {
14
-        register_post_type( self::$post_type, array(
15
-            'label' => __( 'Styles', 'formidable' ),
16
-            'public' => false,
17
-            'show_ui' => false,
18
-            'capability_type' => 'page',
4
+	public static $post_type = 'frm_styles';
5
+	public static $screen = 'formidable_page_formidable-styles';
6
+
7
+	public static function load_pro_hooks() {
8
+		if ( FrmAppHelper::pro_is_installed() ) {
9
+			FrmProStylesController::load_pro_hooks();
10
+		}
11
+	}
12
+
13
+	public static function register_post_types() {
14
+		register_post_type( self::$post_type, array(
15
+			'label' => __( 'Styles', 'formidable' ),
16
+			'public' => false,
17
+			'show_ui' => false,
18
+			'capability_type' => 'page',
19 19
 			'capabilities' => array(
20 20
 				'edit_post'     => 'frm_change_settings',
21 21
 				'edit_posts'    => 'frm_change_settings',
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 				'delete_posts'  => 'frm_change_settings',
26 26
 				'read_private_posts' => 'read_private_posts',
27 27
 			),
28
-            'supports' => array(
28
+			'supports' => array(
29 29
 				'title',
30
-            ),
31
-            'has_archive' => false,
32
-            'labels' => array(
30
+			),
31
+			'has_archive' => false,
32
+			'labels' => array(
33 33
 				'name' => __( 'Styles', 'formidable' ),
34 34
 				'singular_name' => __( 'Style', 'formidable' ),
35 35
 				'menu_name' => __( 'Style', 'formidable' ),
@@ -37,19 +37,19 @@  discard block
 block discarded – undo
37 37
 				'add_new_item' => __( 'Create a New Style', 'formidable' ),
38 38
 				'edit_item'    => __( 'Edit Style', 'formidable' ),
39 39
 			),
40
-        ) );
41
-    }
40
+		) );
41
+	}
42 42
 
43
-    public static function menu() {
43
+	public static function menu() {
44 44
 		add_submenu_page( 'formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' );
45
-    }
45
+	}
46 46
 
47 47
 	public static function admin_init() {
48 48
 		if ( ! FrmAppHelper::is_admin_page( 'formidable-styles' ) ) {
49 49
 			return;
50 50
 		}
51 51
 
52
-        self::load_pro_hooks();
52
+		self::load_pro_hooks();
53 53
 
54 54
 		$style_tab = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
55 55
 		if ( $style_tab == 'manage' || $style_tab == 'custom_css' ) {
@@ -59,17 +59,17 @@  discard block
 block discarded – undo
59 59
 
60 60
 		wp_enqueue_script( 'jquery-ui-datepicker' );
61 61
 
62
-        $version = FrmAppHelper::plugin_version();
62
+		$version = FrmAppHelper::plugin_version();
63 63
 		$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
64 64
 		wp_enqueue_script( 'jquery-frm-themepicker', FrmAppHelper::plugin_url() . '/js/jquery/jquery-ui-themepicker' . $suffix . '.js', array( 'jquery' ), $version );
65 65
 
66 66
 		wp_enqueue_style( 'frm-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_css' ) );
67 67
 
68 68
 		$style = apply_filters( 'frm_style_head', false );
69
-        if ( $style ) {
69
+		if ( $style ) {
70 70
 			wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) . '&' . http_build_query( $style->post_content ) );
71
-        }
72
-    }
71
+		}
72
+	}
73 73
 
74 74
 	public static function enqueue_css( $register = 'enqueue' ) {
75 75
 		global $frm_vars;
@@ -210,10 +210,10 @@  discard block
 block discarded – undo
210 210
 	}
211 211
 
212 212
 	public static function load_styler( $style, $message = '' ) {
213
-        global $frm_settings;
213
+		global $frm_settings;
214 214
 
215
-        $frm_style = new FrmStyle();
216
-        $styles = $frm_style->get_all();
215
+		$frm_style = new FrmStyle();
216
+		$styles = $frm_style->get_all();
217 217
 
218 218
 		if ( is_numeric( $style ) ) {
219 219
 			$style = $styles[ $style ];
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
 			$style = $frm_style->get_default_style( $styles );
222 222
 		}
223 223
 
224
-        self::add_meta_boxes();
224
+		self::add_meta_boxes();
225 225
 
226 226
 		include( FrmAppHelper::plugin_path() . '/classes/views/styles/show.php' );
227
-    }
227
+	}
228 228
 
229 229
 	/**
230 230
 	 * @param string $message
@@ -242,31 +242,31 @@  discard block
 block discarded – undo
242 242
 		include( FrmAppHelper::plugin_path() . '/classes/views/styles/manage.php' );
243 243
 	}
244 244
 
245
-    private static function manage_styles() {
245
+	private static function manage_styles() {
246 246
 		$style_nonce = FrmAppHelper::get_post_param( 'frm_manage_style', '', 'sanitize_text_field' );
247 247
 		if ( ! $_POST || ! isset( $_POST['style'] ) || ! wp_verify_nonce( $style_nonce, 'frm_manage_style_nonce' ) ) {
248
-            return self::manage();
249
-        }
248
+			return self::manage();
249
+		}
250 250
 
251
-        global $wpdb;
251
+		global $wpdb;
252 252
 
253 253
 		$forms = FrmForm::get_published_forms();
254
-        foreach ( $forms as $form ) {
255
-            if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) {
256
-                continue;
257
-            }
254
+		foreach ( $forms as $form ) {
255
+			if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) {
256
+				continue;
257
+			}
258 258
 
259
-            $form->options['custom_style'] = $_POST['style'][ $form->id ];
259
+			$form->options['custom_style'] = $_POST['style'][ $form->id ];
260 260
 
261 261
 			$wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) );
262 262
 			unset( $form );
263
-        }
263
+		}
264 264
 
265
-        $message = __( 'Your form styles have been saved.', 'formidable' );
265
+		$message = __( 'Your form styles have been saved.', 'formidable' );
266 266
 		return self::manage( $message, $forms );
267
-    }
267
+	}
268 268
 
269
-    public static function custom_css( $message = '', $style = null ) {
269
+	public static function custom_css( $message = '', $style = null ) {
270 270
 		if ( function_exists( 'wp_enqueue_code_editor' ) ) {
271 271
 			$id = 'frm_codemirror_box';
272 272
 			$settings = wp_enqueue_code_editor( array(
@@ -306,41 +306,41 @@  discard block
 block discarded – undo
306 306
 		return self::custom_css( $message );
307 307
 	}
308 308
 
309
-    public static function route() {
309
+	public static function route() {
310 310
 		$action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
311 311
 
312
-        switch ( $action ) {
313
-            case 'edit':
314
-            case 'save':
315
-            case 'manage':
316
-            case 'manage_styles':
317
-            case 'custom_css':
318
-            case 'save_css':
312
+		switch ( $action ) {
313
+			case 'edit':
314
+			case 'save':
315
+			case 'manage':
316
+			case 'manage_styles':
317
+			case 'custom_css':
318
+			case 'save_css':
319 319
 				return self::$action();
320
-            default:
321
-            	do_action( 'frm_style_action_route', $action );
322
-            	if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) {
323
-                	return;
324
-            	}
320
+			default:
321
+				do_action( 'frm_style_action_route', $action );
322
+				if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) {
323
+					return;
324
+				}
325 325
 
326
-                if ( 'new_style' == $action || 'duplicate' == $action ) {
327
-                    return self::$action();
328
-                }
326
+				if ( 'new_style' == $action || 'duplicate' == $action ) {
327
+					return self::$action();
328
+				}
329 329
 
330
-                return self::edit();
331
-        }
332
-    }
330
+				return self::edit();
331
+		}
332
+	}
333 333
 
334
-    public static function reset_styling() {
334
+	public static function reset_styling() {
335 335
 		FrmAppHelper::permission_check( 'frm_change_settings' );
336
-        check_ajax_referer( 'frm_ajax', 'nonce' );
336
+		check_ajax_referer( 'frm_ajax', 'nonce' );
337 337
 
338
-        $frm_style = new FrmStyle();
339
-        $defaults = $frm_style->get_defaults();
338
+		$frm_style = new FrmStyle();
339
+		$defaults = $frm_style->get_defaults();
340 340
 
341
-        echo json_encode( $defaults );
342
-        wp_die();
343
-    }
341
+		echo json_encode( $defaults );
342
+		wp_die();
343
+	}
344 344
 
345 345
 	public static function change_styling() {
346 346
 		check_ajax_referer( 'frm_ajax', 'nonce' );
@@ -362,21 +362,21 @@  discard block
 block discarded – undo
362 362
 		wp_die();
363 363
 	}
364 364
 
365
-    private static function add_meta_boxes() {
366
-
367
-        // setup meta boxes
368
-        $meta_boxes = array(
369
-            'general'           => __( 'General', 'formidable' ),
370
-            'form-title'        => __( 'Form Title', 'formidable' ),
371
-            'form-description'  => __( 'Form Description', 'formidable' ),
372
-            'field-labels'      => __( 'Field Labels', 'formidable' ),
373
-            'field-description' => __( 'Field Description', 'formidable' ),
374
-            'field-colors'      => __( 'Field Colors', 'formidable' ),
375
-            'field-sizes'       => __( 'Field Settings', 'formidable' ),
376
-            'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ),
377
-            'buttons'           => __( 'Buttons', 'formidable' ),
378
-            'form-messages'     => __( 'Form Messages', 'formidable' ),
379
-        );
365
+	private static function add_meta_boxes() {
366
+
367
+		// setup meta boxes
368
+		$meta_boxes = array(
369
+			'general'           => __( 'General', 'formidable' ),
370
+			'form-title'        => __( 'Form Title', 'formidable' ),
371
+			'form-description'  => __( 'Form Description', 'formidable' ),
372
+			'field-labels'      => __( 'Field Labels', 'formidable' ),
373
+			'field-description' => __( 'Field Description', 'formidable' ),
374
+			'field-colors'      => __( 'Field Colors', 'formidable' ),
375
+			'field-sizes'       => __( 'Field Settings', 'formidable' ),
376
+			'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ),
377
+			'buttons'           => __( 'Buttons', 'formidable' ),
378
+			'form-messages'     => __( 'Form Messages', 'formidable' ),
379
+		);
380 380
 
381 381
 		/**
382 382
 		 * Add custom boxes to the styling settings
@@ -405,18 +405,18 @@  discard block
 block discarded – undo
405 405
 		$file_name = apply_filters( 'frm_style_settings_' . $sec['args'], $file_name );
406 406
 
407 407
 		include( $file_name );
408
-    }
408
+	}
409 409
 
410
-    public static function load_css() {
410
+	public static function load_css() {
411 411
 		header( 'Content-type: text/css' );
412 412
 
413
-        $frm_style = new FrmStyle();
414
-        $defaults = $frm_style->get_defaults();
413
+		$frm_style = new FrmStyle();
414
+		$defaults = $frm_style->get_defaults();
415 415
 		$style = '';
416 416
 
417 417
 		include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' );
418
-        wp_die();
419
-    }
418
+		wp_die();
419
+	}
420 420
 
421 421
 	public static function load_saved_css() {
422 422
 		$css = get_transient( 'frmpro_css' );
@@ -425,49 +425,49 @@  discard block
 block discarded – undo
425 425
 		wp_die();
426 426
 	}
427 427
 
428
-    /**
429
-     * Check if the Formidable styling should be loaded,
430
-     * then enqueue it for the footer
431
-     * @since 2.0
432
-     */
433
-    public static function enqueue_style() {
434
-        global $frm_vars;
435
-
436
-        if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) {
437
-            // the CSS has already been loaded
438
-            return;
439
-        }
440
-
441
-        $frm_settings = FrmAppHelper::get_settings();
442
-        if ( $frm_settings->load_style != 'none' ) {
443
-            wp_enqueue_style( 'formidable' );
444
-            $frm_vars['css_loaded'] = true;
445
-        }
446
-    }
447
-
448
-    // Get the stylesheets for the form settings page
449
-    public static function get_style_opts() {
450
-        $frm_style = new FrmStyle();
451
-        $styles = $frm_style->get_all();
452
-
453
-        return $styles;
454
-    }
455
-
456
-    public static function get_form_style( $form = 'default' ) {
457
-        $style = FrmFormsHelper::get_form_style( $form );
458
-
459
-        if ( empty( $style ) || 1 == $style ) {
460
-            $style = 'default';
461
-        }
462
-
463
-        $frm_style = new FrmStyle( $style );
464
-        return $frm_style->get_one();
465
-    }
466
-
467
-    /**
468
-     * @param string $class
469
-     * @param string $style
470
-     */
428
+	/**
429
+	 * Check if the Formidable styling should be loaded,
430
+	 * then enqueue it for the footer
431
+	 * @since 2.0
432
+	 */
433
+	public static function enqueue_style() {
434
+		global $frm_vars;
435
+
436
+		if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) {
437
+			// the CSS has already been loaded
438
+			return;
439
+		}
440
+
441
+		$frm_settings = FrmAppHelper::get_settings();
442
+		if ( $frm_settings->load_style != 'none' ) {
443
+			wp_enqueue_style( 'formidable' );
444
+			$frm_vars['css_loaded'] = true;
445
+		}
446
+	}
447
+
448
+	// Get the stylesheets for the form settings page
449
+	public static function get_style_opts() {
450
+		$frm_style = new FrmStyle();
451
+		$styles = $frm_style->get_all();
452
+
453
+		return $styles;
454
+	}
455
+
456
+	public static function get_form_style( $form = 'default' ) {
457
+		$style = FrmFormsHelper::get_form_style( $form );
458
+
459
+		if ( empty( $style ) || 1 == $style ) {
460
+			$style = 'default';
461
+		}
462
+
463
+		$frm_style = new FrmStyle( $style );
464
+		return $frm_style->get_one();
465
+	}
466
+
467
+	/**
468
+	 * @param string $class
469
+	 * @param string $style
470
+	 */
471 471
 	public static function get_form_style_class( $class, $style ) {
472 472
 		if ( 1 == $style ) {
473 473
 			$style = 'default';
@@ -483,9 +483,9 @@  discard block
 block discarded – undo
483 483
 		return $class;
484 484
 	}
485 485
 
486
-    /**
487
-     * @param string $val
488
-     */
486
+	/**
487
+	 * @param string $val
488
+	 */
489 489
 	public static function get_style_val( $val, $form = 'default' ) {
490 490
 		$style = self::get_form_style( $form );
491 491
 		if ( $style && isset( $style->post_content[ $val ] ) ) {
@@ -495,72 +495,72 @@  discard block
 block discarded – undo
495 495
 
496 496
 	public static function show_entry_styles( $default_styles ) {
497 497
 		$frm_style = new FrmStyle( 'default' );
498
-        $style = $frm_style->get_one();
499
-
500
-        if ( ! $style ) {
501
-            return $default_styles;
502
-        }
503
-
504
-        foreach ( $default_styles as $name => $val ) {
505
-            $setting = $name;
506
-            if ( 'border_width' == $name ) {
507
-                $setting = 'field_border_width';
508
-            } else if ( 'alt_bg_color' == $name ) {
509
-                $setting = 'bg_color_active';
510
-            }
511
-            $default_styles[ $name ] = $style->post_content[ $setting ];
498
+		$style = $frm_style->get_one();
499
+
500
+		if ( ! $style ) {
501
+			return $default_styles;
502
+		}
503
+
504
+		foreach ( $default_styles as $name => $val ) {
505
+			$setting = $name;
506
+			if ( 'border_width' == $name ) {
507
+				$setting = 'field_border_width';
508
+			} else if ( 'alt_bg_color' == $name ) {
509
+				$setting = 'bg_color_active';
510
+			}
511
+			$default_styles[ $name ] = $style->post_content[ $setting ];
512 512
 			unset( $name, $val );
513
-        }
513
+		}
514 514
 
515
-        return $default_styles;
516
-    }
515
+		return $default_styles;
516
+	}
517 517
 
518 518
 	public static function &important_style( $important, $field ) {
519 519
 		$important = self::get_style_val( 'important_style', $field['form_id'] );
520
-        return $important;
521
-    }
520
+		return $important;
521
+	}
522 522
 
523
-    /**
524
-     * Fallback for WP < 3.6
525
-     */
526
-    public static function do_accordion_sections( $screen, $context, $object ) {
527
-        if ( function_exists( 'do_accordion_sections' ) ) {
528
-            return do_accordion_sections( $screen, $context, $object );
529
-        }
523
+	/**
524
+	 * Fallback for WP < 3.6
525
+	 */
526
+	public static function do_accordion_sections( $screen, $context, $object ) {
527
+		if ( function_exists( 'do_accordion_sections' ) ) {
528
+			return do_accordion_sections( $screen, $context, $object );
529
+		}
530 530
 
531
-    	global $wp_meta_boxes;
531
+		global $wp_meta_boxes;
532 532
 
533
-        $screen = 'formidable_page_formidable-styles';
534
-        $screen = convert_to_screen( $screen );
533
+		$screen = 'formidable_page_formidable-styles';
534
+		$screen = convert_to_screen( $screen );
535 535
 
536
-    	$page = $screen->id;
536
+		$page = $screen->id;
537 537
 
538
-    	$hidden = get_hidden_meta_boxes( $screen );
539
-    	?>
538
+		$hidden = get_hidden_meta_boxes( $screen );
539
+		?>
540 540
     	<div id="side-sortables" class="accordion-container">
541 541
     	<?php
542
-    	$i = 0;
543
-    	$first_open = false;
544
-    	do {
542
+		$i = 0;
543
+		$first_open = false;
544
+		do {
545 545
 			if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
546 546
 				break;
547 547
 			}
548 548
 
549
-    		foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
550
-    			if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
551
-    				foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
552
-    					if ( false == $box || ! $box['title'] ) {
553
-    						continue;
549
+			foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
550
+				if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
551
+					foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
552
+						if ( false == $box || ! $box['title'] ) {
553
+							continue;
554 554
 						}
555 555
 
556
-    					$i++;
557
-    					$hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
556
+						$i++;
557
+						$hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
558 558
 
559
-    					if ( ! $first_open && empty( $hidden_class ) ) {
560
-    						$first_open = true;
561
-    					}
559
+						if ( ! $first_open && empty( $hidden_class ) ) {
560
+							$first_open = true;
561
+						}
562 562
 
563
-    					?>
563
+						?>
564 564
 						<div class="postbox <?php echo esc_attr( $box['id'] ); ?>">
565 565
 						<div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'formidable' ); ?>"><br/></div>
566 566
                         <h3 class='hndle'><span><?php echo esc_html( $box['title'] ); ?></span></h3>
@@ -571,13 +571,13 @@  discard block
 block discarded – undo
571 571
     						</div><!-- .accordion-section-content -->
572 572
     					</div><!-- .postbox -->
573 573
     					<?php
574
-    				}
575
-    			}
576
-    		}
577
-    	} while ( 0 );
578
-    	?>
574
+					}
575
+				}
576
+			}
577
+		} while ( 0 );
578
+		?>
579 579
     	</div><!-- .accordion-container -->
580 580
     	<?php
581
-    	return $i;
582
-    }
581
+		return $i;
582
+	}
583 583
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
         $styles = $frm_style->get_all();
217 217
 
218 218
 		if ( is_numeric( $style ) ) {
219
-			$style = $styles[ $style ];
219
+			$style = $styles[$style];
220 220
 		} elseif ( 'default' == $style ) {
221 221
 			$style = $frm_style->get_default_style( $styles );
222 222
 		}
@@ -252,11 +252,11 @@  discard block
 block discarded – undo
252 252
 
253 253
 		$forms = FrmForm::get_published_forms();
254 254
         foreach ( $forms as $form ) {
255
-            if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) {
255
+            if ( $_POST['style'][$form->id] == $_POST['prev_style'][$form->id] ) {
256 256
                 continue;
257 257
             }
258 258
 
259
-            $form->options['custom_style'] = $_POST['style'][ $form->id ];
259
+            $form->options['custom_style'] = $_POST['style'][$form->id];
260 260
 
261 261
 			$wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) );
262 262
 			unset( $form );
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 		// remove the # from the colors
353 353
 		foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) {
354 354
 			if ( ! is_array( $v ) && strpos( $v, '#' ) === 0 ) {
355
-				$_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v );
355
+				$_GET['frm_style_setting']['post_content'][$k] = str_replace( '#', '', $v );
356 356
 			}
357 357
 		}
358 358
 
@@ -488,8 +488,8 @@  discard block
 block discarded – undo
488 488
      */
489 489
 	public static function get_style_val( $val, $form = 'default' ) {
490 490
 		$style = self::get_form_style( $form );
491
-		if ( $style && isset( $style->post_content[ $val ] ) ) {
492
-			return $style->post_content[ $val ];
491
+		if ( $style && isset( $style->post_content[$val] ) ) {
492
+			return $style->post_content[$val];
493 493
 		}
494 494
 	}
495 495
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
             } else if ( 'alt_bg_color' == $name ) {
509 509
                 $setting = 'bg_color_active';
510 510
             }
511
-            $default_styles[ $name ] = $style->post_content[ $setting ];
511
+            $default_styles[$name] = $style->post_content[$setting];
512 512
 			unset( $name, $val );
513 513
         }
514 514
 
@@ -542,18 +542,18 @@  discard block
 block discarded – undo
542 542
     	$i = 0;
543 543
     	$first_open = false;
544 544
     	do {
545
-			if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
545
+			if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[$page] ) || ! isset( $wp_meta_boxes[$page][$context] ) ) {
546 546
 				break;
547 547
 			}
548 548
 
549 549
     		foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
550
-    			if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
551
-    				foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
550
+    			if ( isset( $wp_meta_boxes[$page][$context][$priority] ) ) {
551
+    				foreach ( $wp_meta_boxes[$page][$context][$priority] as $box ) {
552 552
     					if ( false == $box || ! $box['title'] ) {
553 553
     						continue;
554 554
 						}
555 555
 
556
-    					$i++;
556
+    					$i ++;
557 557
     					$hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
558 558
 
559 559
     					if ( ! $first_open && empty( $hidden_class ) ) {
Please login to merge, or discard this patch.
classes/controllers/FrmFieldsController.php 2 patches
Indentation   +250 added lines, -250 removed lines patch added patch discarded remove patch
@@ -2,59 +2,59 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmFieldsController {
4 4
 
5
-    public static function load_field() {
5
+	public static function load_field() {
6 6
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
7
-        check_ajax_referer( 'frm_ajax', 'nonce' );
7
+		check_ajax_referer( 'frm_ajax', 'nonce' );
8 8
 
9
-        $fields = $_POST['field'];
10
-        if ( empty( $fields ) ) {
11
-            wp_die();
12
-        }
9
+		$fields = $_POST['field'];
10
+		if ( empty( $fields ) ) {
11
+			wp_die();
12
+		}
13 13
 
14
-        $_GET['page'] = 'formidable';
15
-        $fields = stripslashes_deep( $fields );
14
+		$_GET['page'] = 'formidable';
15
+		$fields = stripslashes_deep( $fields );
16 16
 
17
-        $ajax = true;
17
+		$ajax = true;
18 18
 		$values = array( 'id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ) );
19
-        $path = FrmAppHelper::plugin_path();
20
-        $field_html = array();
21
-
22
-        foreach ( $fields as $field ) {
23
-            $field = htmlspecialchars_decode( nl2br( $field ) );
24
-            $field = json_decode( $field, true );
25
-            if ( ! isset( $field['id'] ) ) {
26
-                // this field may have already been loaded
27
-                continue;
28
-            }
19
+		$path = FrmAppHelper::plugin_path();
20
+		$field_html = array();
21
+
22
+		foreach ( $fields as $field ) {
23
+			$field = htmlspecialchars_decode( nl2br( $field ) );
24
+			$field = json_decode( $field, true );
25
+			if ( ! isset( $field['id'] ) ) {
26
+				// this field may have already been loaded
27
+				continue;
28
+			}
29 29
 
30
-            $field_id = absint( $field['id'] );
30
+			$field_id = absint( $field['id'] );
31 31
 
32
-            if ( ! isset( $field['value'] ) ) {
33
-                $field['value'] = '';
34
-            }
32
+			if ( ! isset( $field['value'] ) ) {
33
+				$field['value'] = '';
34
+			}
35 35
 
36 36
 			$field_name = 'item_meta[' . $field_id . ']';
37 37
 			$html_id = FrmFieldsHelper::get_html_id( $field );
38 38
 
39
-            ob_start();
39
+			ob_start();
40 40
 			include( $path . '/classes/views/frm-forms/add_field.php' );
41
-            $field_html[ $field_id ] = ob_get_contents();
42
-            ob_end_clean();
43
-        }
41
+			$field_html[ $field_id ] = ob_get_contents();
42
+			ob_end_clean();
43
+		}
44 44
 
45 45
 		unset( $path );
46 46
 
47 47
 		echo json_encode( $field_html );
48 48
 
49
-        wp_die();
50
-    }
49
+		wp_die();
50
+	}
51 51
 
52 52
 	/**
53 53
 	 * Create a new field with ajax
54 54
 	 */
55
-    public static function create() {
55
+	public static function create() {
56 56
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
57
-        check_ajax_referer( 'frm_ajax', 'nonce' );
57
+		check_ajax_referer( 'frm_ajax', 'nonce' );
58 58
 
59 59
 		$field_type = FrmAppHelper::get_post_param( 'field_type', '', 'sanitize_text_field' );
60 60
 		$form_id = FrmAppHelper::get_post_param( 'form_id', 0, 'absint' );
@@ -64,16 +64,16 @@  discard block
 block discarded – undo
64 64
 		// this hook will allow for multiple fields to be added at once
65 65
 		do_action( 'frm_after_field_created', $field, $form_id );
66 66
 
67
-        wp_die();
68
-    }
67
+		wp_die();
68
+	}
69 69
 
70
-    /**
71
-     * Set up and create a new field
72
-     *
73
-     * @param string $field_type
74
-     * @param integer $form_id
75
-     * @return array|bool
76
-     */
70
+	/**
71
+	 * Set up and create a new field
72
+	 *
73
+	 * @param string $field_type
74
+	 * @param integer $form_id
75
+	 * @return array|bool
76
+	 */
77 77
 	public static function include_new_field( $field_type, $form_id ) {
78 78
 		$values = array();
79 79
 		if ( FrmAppHelper::pro_is_installed() ) {
@@ -81,18 +81,18 @@  discard block
 block discarded – undo
81 81
 		}
82 82
 
83 83
 		$field_values = FrmFieldsHelper::setup_new_vars( $field_type, $form_id );
84
-        $field_values = apply_filters( 'frm_before_field_created', $field_values );
84
+		$field_values = apply_filters( 'frm_before_field_created', $field_values );
85 85
 
86
-        $field_id = FrmField::create( $field_values );
86
+		$field_id = FrmField::create( $field_values );
87 87
 
88
-        if ( ! $field_id ) {
89
-            return false;
90
-        }
88
+		if ( ! $field_id ) {
89
+			return false;
90
+		}
91 91
 
92 92
 		$field = self::include_single_field( $field_id, $values, $form_id );
93 93
 
94
-        return $field;
95
-    }
94
+		return $field;
95
+	}
96 96
 
97 97
 	public static function edit_name( $field = 'name', $id = '' ) {
98 98
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
@@ -102,29 +102,29 @@  discard block
 block discarded – undo
102 102
 			$field = 'name';
103 103
 		}
104 104
 
105
-        if ( empty( $id ) ) {
105
+		if ( empty( $id ) ) {
106 106
 			$id = FrmAppHelper::get_post_param( 'element_id', '', 'sanitize_title' );
107 107
 			$id = str_replace( 'field_label_', '', $id );
108
-        }
108
+		}
109 109
 
110 110
 		$value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_kses_post' );
111 111
 		$value = trim( $value );
112
-        if ( trim( strip_tags( $value ) ) === '' ) {
113
-            // set blank value if there is no content
114
-            $value = '';
115
-        }
112
+		if ( trim( strip_tags( $value ) ) === '' ) {
113
+			// set blank value if there is no content
114
+			$value = '';
115
+		}
116 116
 
117 117
 		FrmField::update( $id, array( $field => $value ) );
118 118
 
119 119
 		do_action( 'frm_after_update_field_' . $field, compact( 'id', 'value' ) );
120 120
 
121 121
 		echo stripslashes( wp_kses_post( $value ) );
122
-        wp_die();
123
-    }
122
+		wp_die();
123
+	}
124 124
 
125
-    public static function update_ajax_option() {
125
+	public static function update_ajax_option() {
126 126
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
127
-        check_ajax_referer( 'frm_ajax', 'nonce' );
127
+		check_ajax_referer( 'frm_ajax', 'nonce' );
128 128
 
129 129
 		$field_id = FrmAppHelper::get_post_param( 'field', 0, 'absint' );
130 130
 		if ( ! $field_id ) {
@@ -139,26 +139,26 @@  discard block
 block discarded – undo
139 139
 			unset( $new_val );
140 140
 		}
141 141
 
142
-        FrmField::update( $field_id, array(
143
-            'field_options' => $field->field_options,
142
+		FrmField::update( $field_id, array(
143
+			'field_options' => $field->field_options,
144 144
 			'form_id'       => $field->form_id,
145
-        ) );
146
-        wp_die();
147
-    }
145
+		) );
146
+		wp_die();
147
+	}
148 148
 
149
-    public static function duplicate() {
149
+	public static function duplicate() {
150 150
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
151
-        check_ajax_referer( 'frm_ajax', 'nonce' );
151
+		check_ajax_referer( 'frm_ajax', 'nonce' );
152 152
 
153
-        global $wpdb;
153
+		global $wpdb;
154 154
 
155 155
 		$field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' );
156 156
 		$form_id = FrmAppHelper::get_post_param( 'form_id', 0, 'absint' );
157 157
 
158 158
 		$copy_field = FrmField::getOne( $field_id );
159
-        if ( ! $copy_field ) {
160
-            wp_die();
161
-        }
159
+		if ( ! $copy_field ) {
160
+			wp_die();
161
+		}
162 162
 
163 163
 		do_action( 'frm_duplicate_field', $copy_field, $form_id );
164 164
 		do_action( 'frm_duplicate_field_' . $copy_field->type, $copy_field, $form_id );
@@ -174,41 +174,41 @@  discard block
 block discarded – undo
174 174
 
175 175
 		self::include_single_field( $field_id, $values );
176 176
 
177
-        wp_die();
178
-    }
177
+		wp_die();
178
+	}
179 179
 
180
-    /**
181
-     * Load a single field in the form builder along with all needed variables
182
-     */
183
-    public static function include_single_field( $field_id, $values, $form_id = 0 ) {
180
+	/**
181
+	 * Load a single field in the form builder along with all needed variables
182
+	 */
183
+	public static function include_single_field( $field_id, $values, $form_id = 0 ) {
184 184
 		$field = FrmFieldsHelper::setup_edit_vars( FrmField::getOne( $field_id ) );
185 185
 		$field_name = 'item_meta[' . $field_id . ']';
186 186
 		$html_id = FrmFieldsHelper::get_html_id( $field );
187
-        $id = $form_id ? $form_id : $field['form_id'];
188
-        if ( $field['type'] == 'html' ) {
189
-            $field['stop_filter'] = true;
190
-        }
187
+		$id = $form_id ? $form_id : $field['form_id'];
188
+		if ( $field['type'] == 'html' ) {
189
+			$field['stop_filter'] = true;
190
+		}
191 191
 
192 192
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/add_field.php' );
193 193
 
194
-        return $field;
195
-    }
194
+		return $field;
195
+	}
196 196
 
197
-    public static function destroy() {
197
+	public static function destroy() {
198 198
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
199
-        check_ajax_referer( 'frm_ajax', 'nonce' );
199
+		check_ajax_referer( 'frm_ajax', 'nonce' );
200 200
 
201 201
 		$field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' );
202 202
 		FrmField::destroy( $field_id );
203
-        wp_die();
204
-    }
203
+		wp_die();
204
+	}
205 205
 
206
-    /* Field Options */
206
+	/* Field Options */
207 207
 
208
-    //Add Single Option or Other Option
209
-    public static function add_option() {
208
+	//Add Single Option or Other Option
209
+	public static function add_option() {
210 210
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
211
-        check_ajax_referer( 'frm_ajax', 'nonce' );
211
+		check_ajax_referer( 'frm_ajax', 'nonce' );
212 212
 
213 213
 		$id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' );
214 214
 		$opt_type = FrmAppHelper::get_post_param( 'opt_type', '', 'sanitize_text_field' );
@@ -216,85 +216,85 @@  discard block
 block discarded – undo
216 216
 
217 217
 		$field = FrmField::getOne( $id );
218 218
 
219
-        if ( 'other' == $opt_type ) {
219
+		if ( 'other' == $opt_type ) {
220 220
 			$opt = __( 'Other', 'formidable' );
221
-            $other_val = '';
222
-            $opt_key = 'other_' . $opt_key;
223
-        } else {
221
+			$other_val = '';
222
+			$opt_key = 'other_' . $opt_key;
223
+		} else {
224 224
 			$opt = __( 'New Option', 'formidable' );
225
-        }
226
-        $field_val = $opt;
225
+		}
226
+		$field_val = $opt;
227 227
 
228
-        $field_data = $field;
228
+		$field_data = $field;
229 229
 		$field = (array) $field;
230 230
 		$field['separate_value'] = isset( $field_data->field_options['separate_value'] ) ? $field_data->field_options['separate_value'] : 0;
231 231
 		unset( $field_data );
232 232
 
233 233
 		$field_name = 'item_meta[' . $id . ']';
234 234
 		$html_id = FrmFieldsHelper::get_html_id( $field );
235
-        $checked = '';
235
+		$checked = '';
236 236
 
237
-        if ( 'other' == $opt_type ) {
237
+		if ( 'other' == $opt_type ) {
238 238
 			include( FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/other-option.php' );
239
-        } else {
239
+		} else {
240 240
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' );
241
-        }
242
-        wp_die();
243
-    }
241
+		}
242
+		wp_die();
243
+	}
244 244
 
245
-    public static function edit_option() {
245
+	public static function edit_option() {
246 246
 		_deprecated_function( __FUNCTION__, '2.3' );
247
-    }
247
+	}
248 248
 
249
-    public static function delete_option() {
249
+	public static function delete_option() {
250 250
 		_deprecated_function( __FUNCTION__, '2.3' );
251
-    }
251
+	}
252 252
 
253
-    public static function import_choices() {
254
-        FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' );
253
+	public static function import_choices() {
254
+		FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' );
255 255
 
256 256
 		$field_id = absint( $_REQUEST['field_id'] );
257 257
 
258
-        global $current_screen, $hook_suffix;
258
+		global $current_screen, $hook_suffix;
259 259
 
260
-        // Catch plugins that include admin-header.php before admin.php completes.
261
-        if ( empty( $current_screen ) && function_exists( 'set_current_screen' ) ) {
262
-            $hook_suffix = '';
263
-        	set_current_screen();
264
-        }
260
+		// Catch plugins that include admin-header.php before admin.php completes.
261
+		if ( empty( $current_screen ) && function_exists( 'set_current_screen' ) ) {
262
+			$hook_suffix = '';
263
+			set_current_screen();
264
+		}
265 265
 
266
-        if ( function_exists( 'register_admin_color_schemes' ) ) {
267
-            register_admin_color_schemes();
268
-        }
266
+		if ( function_exists( 'register_admin_color_schemes' ) ) {
267
+			register_admin_color_schemes();
268
+		}
269 269
 
270 270
 		$hook_suffix = '';
271 271
 		$admin_body_class = '';
272 272
 
273
-        if ( get_user_setting( 'mfold' ) == 'f' ) {
274
-        	$admin_body_class .= ' folded';
275
-        }
273
+		if ( get_user_setting( 'mfold' ) == 'f' ) {
274
+			$admin_body_class .= ' folded';
275
+		}
276 276
 
277
-        if ( function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() ) {
278
-        	$admin_body_class .= ' admin-bar';
279
-        }
277
+		if ( function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() ) {
278
+			$admin_body_class .= ' admin-bar';
279
+		}
280 280
 
281
-        if ( is_rtl() ) {
282
-        	$admin_body_class .= ' rtl';
283
-        }
281
+		if ( is_rtl() ) {
282
+			$admin_body_class .= ' rtl';
283
+		}
284 284
 
285
-        $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
286
-        $prepop = array();
285
+		$admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
286
+		$prepop = array();
287 287
 		FrmFieldsHelper::get_bulk_prefilled_opts( $prepop );
288 288
 
289 289
 		$field = FrmField::getOne( $field_id );
290 290
 
291
-        wp_enqueue_script( 'utils' );
291
+		wp_enqueue_script( 'utils' );
292 292
 		wp_enqueue_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css' );
293
-        FrmAppHelper::load_admin_wide_js();
293
+		FrmAppHelper::load_admin_wide_js();
294 294
 
295 295
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/import_choices.php' );
296
-        wp_die();
297
-    }
296
+		wp_die();
297
+	}
298 298
 
299 299
 	public static function import_options() {
300 300
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
@@ -308,8 +308,8 @@  discard block
 block discarded – undo
308 308
 		$field = FrmField::getOne( $field_id );
309 309
 
310 310
 		if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'select' ) ) ) {
311
-            return;
312
-        }
311
+			return;
312
+		}
313 313
 
314 314
 		$field = FrmFieldsHelper::setup_edit_vars( $field );
315 315
 		$opts = FrmAppHelper::get_param( 'opts', '', 'post', 'wp_kses_post' );
@@ -332,10 +332,10 @@  discard block
 block discarded – undo
332 332
 			}
333 333
 		}
334 334
 
335
-        //Keep other options after bulk update
336
-        if ( isset( $field['field_options']['other'] ) && $field['field_options']['other'] == true ) {
337
-            $other_array = array();
338
-            foreach ( $field['options'] as $opt_key => $opt ) {
335
+		//Keep other options after bulk update
336
+		if ( isset( $field['field_options']['other'] ) && $field['field_options']['other'] == true ) {
337
+			$other_array = array();
338
+			foreach ( $field['options'] as $opt_key => $opt ) {
339 339
 				if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) {
340 340
 					$other_array[ $opt_key ] = $opt;
341 341
 				}
@@ -346,43 +346,43 @@  discard block
 block discarded – undo
346 346
 			}
347 347
 		}
348 348
 
349
-        $field['options'] = $opts;
349
+		$field['options'] = $opts;
350 350
 
351
-        if ( $field['type'] == 'radio' || $field['type'] == 'checkbox' ) {
351
+		if ( $field['type'] == 'radio' || $field['type'] == 'checkbox' ) {
352 352
 			$field_name = 'item_meta[' . $field['id'] . ']';
353 353
 
354 354
 			// Get html_id which will be used in single-option.php
355 355
 			$html_id = FrmFieldsHelper::get_html_id( $field );
356 356
 
357 357
 			require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/radio.php' );
358
-        } else {
358
+		} else {
359 359
 			FrmFieldsHelper::show_single_option( $field );
360
-        }
360
+		}
361 361
 
362
-        wp_die();
363
-    }
362
+		wp_die();
363
+	}
364 364
 
365
-    public static function update_order() {
365
+	public static function update_order() {
366 366
 		FrmAppHelper::permission_check( 'frm_edit_forms' );
367
-        check_ajax_referer( 'frm_ajax', 'nonce' );
367
+		check_ajax_referer( 'frm_ajax', 'nonce' );
368 368
 
369 369
 		$fields = FrmAppHelper::get_post_param( 'frm_field_id' );
370 370
 		foreach ( (array) $fields as $position => $item ) {
371 371
 			FrmField::update( absint( $item ), array( 'field_order' => absint( $position ) ) );
372 372
 		}
373
-        wp_die();
374
-    }
373
+		wp_die();
374
+	}
375 375
 
376 376
 	public static function change_type( $type ) {
377
-        $type_switch = array(
378
-            'scale'     => 'radio',
379
-            '10radio'   => 'radio',
380
-            'rte'       => 'textarea',
381
-            'website'   => 'url',
382
-        );
383
-        if ( isset( $type_switch[ $type ] ) ) {
384
-            $type = $type_switch[ $type ];
385
-        }
377
+		$type_switch = array(
378
+			'scale'     => 'radio',
379
+			'10radio'   => 'radio',
380
+			'rte'       => 'textarea',
381
+			'website'   => 'url',
382
+		);
383
+		if ( isset( $type_switch[ $type ] ) ) {
384
+			$type = $type_switch[ $type ];
385
+		}
386 386
 
387 387
 		$pro_fields = FrmField::pro_field_selection();
388 388
 		$types = array_keys( $pro_fields );
@@ -390,41 +390,41 @@  discard block
 block discarded – undo
390 390
 			$type = 'text';
391 391
 		}
392 392
 
393
-        return $type;
394
-    }
393
+		return $type;
394
+	}
395 395
 
396 396
 	public static function display_field_options( $display ) {
397 397
 		switch ( $display['type'] ) {
398
-            case 'captcha':
399
-                $display['required'] = false;
400
-                $display['invalid'] = true;
401
-                $display['default_blank'] = false;
398
+			case 'captcha':
399
+				$display['required'] = false;
400
+				$display['invalid'] = true;
401
+				$display['default_blank'] = false;
402 402
 				$display['captcha_size'] = true;
403
-            	break;
404
-            case 'radio':
405
-                $display['default_blank'] = false;
406
-            	break;
407
-            case 'text':
408
-            case 'textarea':
409
-                $display['size'] = true;
410
-                $display['clear_on_focus'] = true;
411
-            	break;
412
-            case 'select':
413
-                $display['size'] = true;
414
-            	break;
415
-            case 'url':
416
-            case 'website':
417
-            case 'email':
418
-                $display['size'] = true;
419
-                $display['clear_on_focus'] = true;
420
-                $display['invalid'] = true;
421
-        }
422
-
423
-        return $display;
424
-    }
425
-
426
-    public static function input_html( $field, $echo = true ) {
427
-        $class = array(); //$field['type'];
403
+				break;
404
+			case 'radio':
405
+				$display['default_blank'] = false;
406
+				break;
407
+			case 'text':
408
+			case 'textarea':
409
+				$display['size'] = true;
410
+				$display['clear_on_focus'] = true;
411
+				break;
412
+			case 'select':
413
+				$display['size'] = true;
414
+				break;
415
+			case 'url':
416
+			case 'website':
417
+			case 'email':
418
+				$display['size'] = true;
419
+				$display['clear_on_focus'] = true;
420
+				$display['invalid'] = true;
421
+		}
422
+
423
+		return $display;
424
+	}
425
+
426
+	public static function input_html( $field, $echo = true ) {
427
+		$class = array(); //$field['type'];
428 428
 		self::add_input_classes( $field, $class );
429 429
 
430 430
 		$add_html = array();
@@ -437,90 +437,90 @@  discard block
 block discarded – undo
437 437
 
438 438
 		FrmFormsHelper::add_html_attr( $class, 'class', $add_html );
439 439
 
440
-        self::add_shortcodes_to_html( $field, $add_html );
440
+		self::add_shortcodes_to_html( $field, $add_html );
441 441
 
442 442
 		$add_html = apply_filters( 'frm_field_extra_html', $add_html, $field );
443 443
 		$add_html = ' ' . implode( ' ', $add_html ) . '  ';
444 444
 
445
-        if ( $echo ) {
446
-            echo $add_html;
447
-        }
445
+		if ( $echo ) {
446
+			echo $add_html;
447
+		}
448 448
 
449
-        return $add_html;
450
-    }
449
+		return $add_html;
450
+	}
451 451
 
452 452
 	private static function add_input_classes( $field, array &$class ) {
453 453
 		if ( isset( $field['input_class'] ) && ! empty( $field['input_class'] ) ) {
454 454
 			$class[] = $field['input_class'];
455 455
 		}
456 456
 
457
-        if ( $field['type'] == 'hidden' || $field['type'] == 'user_id' ) {
458
-            return;
459
-        }
457
+		if ( $field['type'] == 'hidden' || $field['type'] == 'user_id' ) {
458
+			return;
459
+		}
460 460
 
461 461
 		if ( isset( $field['size'] ) && $field['size'] > 0 ) {
462 462
 			$class[] = 'auto_width';
463 463
 		}
464
-    }
464
+	}
465 465
 
466 466
 	private static function add_html_size( $field, array &$add_html ) {
467 467
 		if ( ! isset( $field['size'] ) || $field['size'] <= 0 || in_array( $field['type'], array( 'select', 'data', 'time', 'hidden', 'file', 'lookup' ) ) ) {
468
-            return;
469
-        }
468
+			return;
469
+		}
470 470
 
471
-        if ( FrmAppHelper::is_admin_page('formidable' ) ) {
472
-            return;
473
-        }
471
+		if ( FrmAppHelper::is_admin_page('formidable' ) ) {
472
+			return;
473
+		}
474 474
 
475 475
 		if ( is_numeric( $field['size'] ) ) {
476 476
 			$field['size'] .= 'px';
477 477
 		}
478 478
 
479 479
 		$important = apply_filters( 'frm_use_important_width', 1, $field );
480
-        // Note: This inline styling must stay since we cannot realistically set a class for every possible field size
480
+		// Note: This inline styling must stay since we cannot realistically set a class for every possible field size
481 481
 		$add_html['style'] = 'style="width:' . esc_attr( $field['size'] ) . ( $important ? ' !important' : '' ) . '"';
482 482
 
483 483
 		self::add_html_cols( $field, $add_html );
484
-    }
484
+	}
485 485
 
486 486
 	private static function add_html_cols( $field, array &$add_html ) {
487 487
 		if ( ! in_array( $field['type'], array( 'textarea', 'rte' ) ) ) {
488
-            return;
489
-        }
488
+			return;
489
+		}
490 490
 
491
-        // convert to cols for textareas
492
-        $calc = array(
493
-            ''      => 9,
494
-            'px'    => 9,
495
-            'rem'   => 0.444,
496
-            'em'    => 0.544,
497
-        );
491
+		// convert to cols for textareas
492
+		$calc = array(
493
+			''      => 9,
494
+			'px'    => 9,
495
+			'rem'   => 0.444,
496
+			'em'    => 0.544,
497
+		);
498 498
 
499 499
 		// include "col" for valid html
500 500
 		$unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) );
501 501
 
502
-        if ( ! isset( $calc[ $unit ] ) ) {
503
-            return;
504
-        }
502
+		if ( ! isset( $calc[ $unit ] ) ) {
503
+			return;
504
+		}
505 505
 
506
-        $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ];
506
+		$size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ];
507 507
 
508 508
 		$add_html['cols'] = 'cols="' . absint( $size ) . '"';
509
-    }
509
+	}
510 510
 
511 511
 	private static function add_html_length( $field, array &$add_html ) {
512
-        // check for max setting and if this field accepts maxlength
512
+		// check for max setting and if this field accepts maxlength
513 513
 		if ( FrmField::is_option_empty( $field, 'max' ) || in_array( $field['type'], array( 'textarea', 'rte', 'hidden', 'file' ) ) ) {
514
-            return;
515
-        }
514
+			return;
515
+		}
516 516
 
517 517
 		if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
518
-            // don't load on form builder page
519
-            return;
520
-        }
518
+			// don't load on form builder page
519
+			return;
520
+		}
521 521
 
522 522
 		$add_html['maxlength'] = 'maxlength="' . esc_attr( $field['max'] ) . '"';
523
-    }
523
+	}
524 524
 
525 525
 	private static function add_html_placeholder( $field, array &$add_html, array &$class ) {
526 526
 		if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
@@ -619,38 +619,38 @@  discard block
 block discarded – undo
619 619
 		}
620 620
 	}
621 621
 
622
-    private static function add_shortcodes_to_html( $field, array &$add_html ) {
623
-        if ( FrmField::is_option_empty( $field, 'shortcodes' ) ) {
624
-            return;
625
-        }
622
+	private static function add_shortcodes_to_html( $field, array &$add_html ) {
623
+		if ( FrmField::is_option_empty( $field, 'shortcodes' ) ) {
624
+			return;
625
+		}
626 626
 
627
-        foreach ( $field['shortcodes'] as $k => $v ) {
628
-            if ( 'opt' === $k ) {
629
-                continue;
630
-            }
627
+		foreach ( $field['shortcodes'] as $k => $v ) {
628
+			if ( 'opt' === $k ) {
629
+				continue;
630
+			}
631 631
 
632 632
 			if ( is_numeric( $k ) && strpos( $v, '=' ) ) {
633
-                $add_html[] = $v;
634
-            } else if ( ! empty( $k ) && isset( $add_html[ $k ] ) ) {
633
+				$add_html[] = $v;
634
+			} else if ( ! empty( $k ) && isset( $add_html[ $k ] ) ) {
635 635
 				$add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] );
636
-            } else {
636
+			} else {
637 637
 				$add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"';
638
-            }
638
+			}
639 639
 
640 640
 			unset( $k, $v );
641
-        }
642
-    }
643
-
644
-    public static function check_value( $opt, $opt_key, $field ) {
645
-        if ( is_array( $opt ) ) {
646
-            if ( FrmField::is_option_true( $field, 'separate_value' ) ) {
647
-                $opt = isset( $opt['value'] ) ? $opt['value'] : ( isset( $opt['label'] ) ? $opt['label'] : reset( $opt ) );
648
-            } else {
649
-                $opt = isset( $opt['label'] ) ? $opt['label'] : reset( $opt );
650
-            }
651
-        }
652
-        return $opt;
653
-    }
641
+		}
642
+	}
643
+
644
+	public static function check_value( $opt, $opt_key, $field ) {
645
+		if ( is_array( $opt ) ) {
646
+			if ( FrmField::is_option_true( $field, 'separate_value' ) ) {
647
+				$opt = isset( $opt['value'] ) ? $opt['value'] : ( isset( $opt['label'] ) ? $opt['label'] : reset( $opt ) );
648
+			} else {
649
+				$opt = isset( $opt['label'] ) ? $opt['label'] : reset( $opt );
650
+			}
651
+		}
652
+		return $opt;
653
+	}
654 654
 
655 655
 	public static function check_label( $opt ) {
656 656
 		if ( is_array( $opt ) ) {
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
             ob_start();
40 40
 			include( $path . '/classes/views/frm-forms/add_field.php' );
41
-            $field_html[ $field_id ] = ob_get_contents();
41
+            $field_html[$field_id] = ob_get_contents();
42 42
             ob_end_clean();
43 43
         }
44 44
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 				if ( strpos( $opt, '|' ) !== false ) {
322 322
 					$vals = explode( '|', $opt );
323 323
 					if ( $vals[0] != $vals[1] ) {
324
-						$opts[ $opt_key ] = array(
324
+						$opts[$opt_key] = array(
325 325
 							'label' => trim( $vals[0] ),
326 326
 							'value' => trim( $vals[1] ),
327 327
 						);
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
             $other_array = array();
338 338
             foreach ( $field['options'] as $opt_key => $opt ) {
339 339
 				if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) {
340
-					$other_array[ $opt_key ] = $opt;
340
+					$other_array[$opt_key] = $opt;
341 341
 				}
342 342
 				unset( $opt_key, $opt );
343 343
 			}
@@ -380,8 +380,8 @@  discard block
 block discarded – undo
380 380
             'rte'       => 'textarea',
381 381
             'website'   => 'url',
382 382
         );
383
-        if ( isset( $type_switch[ $type ] ) ) {
384
-            $type = $type_switch[ $type ];
383
+        if ( isset( $type_switch[$type] ) ) {
384
+            $type = $type_switch[$type];
385 385
         }
386 386
 
387 387
 		$pro_fields = FrmField::pro_field_selection();
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
             return;
469 469
         }
470 470
 
471
-        if ( FrmAppHelper::is_admin_page('formidable' ) ) {
471
+        if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
472 472
             return;
473 473
         }
474 474
 
@@ -499,11 +499,11 @@  discard block
 block discarded – undo
499 499
 		// include "col" for valid html
500 500
 		$unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) );
501 501
 
502
-        if ( ! isset( $calc[ $unit ] ) ) {
502
+        if ( ! isset( $calc[$unit] ) ) {
503 503
             return;
504 504
         }
505 505
 
506
-        $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ];
506
+        $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit];
507 507
 
508 508
 		$add_html['cols'] = 'cols="' . absint( $size ) . '"';
509 509
     }
@@ -631,10 +631,10 @@  discard block
 block discarded – undo
631 631
 
632 632
 			if ( is_numeric( $k ) && strpos( $v, '=' ) ) {
633 633
                 $add_html[] = $v;
634
-            } else if ( ! empty( $k ) && isset( $add_html[ $k ] ) ) {
635
-				$add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] );
634
+            } else if ( ! empty( $k ) && isset( $add_html[$k] ) ) {
635
+				$add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] );
636 636
             } else {
637
-				$add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"';
637
+				$add_html[$k] = $k . '="' . esc_attr( $v ) . '"';
638 638
             }
639 639
 
640 640
 			unset( $k, $v );
Please login to merge, or discard this patch.
classes/controllers/FrmEntriesController.php 2 patches
Indentation   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -24,57 +24,57 @@  discard block
 block discarded – undo
24 24
 		}
25 25
 	}
26 26
 
27
-    /* Display in Back End */
28
-    public static function route() {
27
+	/* Display in Back End */
28
+	public static function route() {
29 29
 		$action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
30 30
 
31
-        switch ( $action ) {
32
-            case 'show':
33
-            case 'destroy':
34
-            case 'destroy_all':
35
-                return self::$action();
31
+		switch ( $action ) {
32
+			case 'show':
33
+			case 'destroy':
34
+			case 'destroy_all':
35
+				return self::$action();
36 36
 
37
-            default:
38
-                do_action( 'frm_entry_action_route', $action );
39
-                if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
40
-                    return;
41
-                }
37
+			default:
38
+				do_action( 'frm_entry_action_route', $action );
39
+				if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
40
+					return;
41
+				}
42 42
 
43
-                return self::display_list();
44
-        }
45
-    }
43
+				return self::display_list();
44
+		}
45
+	}
46 46
 
47 47
 	public static function contextual_help( $help, $screen_id, $screen ) {
48
-        // Only add to certain screens. add_help_tab was introduced in WordPress 3.3
49
-        if ( ! method_exists( $screen, 'add_help_tab' ) ) {
50
-            return $help;
51
-        }
48
+		// Only add to certain screens. add_help_tab was introduced in WordPress 3.3
49
+		if ( ! method_exists( $screen, 'add_help_tab' ) ) {
50
+			return $help;
51
+		}
52 52
 
53 53
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
54 54
 		$page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
55 55
 		if ( $page != 'formidable-entries' || ( ! empty( $action ) && $action != 'list' ) ) {
56
-            return $help;
57
-        }
56
+			return $help;
57
+		}
58 58
 
59 59
 		unset( $action, $page );
60 60
 
61
-        $screen->add_help_tab( array(
62
-            'id'      => 'formidable-entries-tab',
63
-            'title'   => __( 'Overview', 'formidable' ),
61
+		$screen->add_help_tab( array(
62
+			'id'      => 'formidable-entries-tab',
63
+			'title'   => __( 'Overview', 'formidable' ),
64 64
 			'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
65
-        ));
65
+		));
66 66
 
67
-        $screen->set_help_sidebar(
67
+		$screen->set_help_sidebar(
68 68
 			'<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
69 69
 			'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' .
70 70
 			'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>'
71
-    	);
71
+		);
72 72
 
73
-        return $help;
74
-    }
73
+		return $help;
74
+	}
75 75
 
76 76
 	public static function manage_columns( $columns ) {
77
-        global $frm_vars;
77
+		global $frm_vars;
78 78
 		$form_id = FrmForm::get_current_form_id();
79 79
 
80 80
 		$columns[ $form_id . '_id' ] = 'ID';
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		$columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
93 93
 		self::maybe_add_ip_col( $form_id, $columns );
94 94
 
95
-        $frm_vars['cols'] = $columns;
95
+		$frm_vars['cols'] = $columns;
96 96
 
97 97
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
98 98
 		if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) {
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
 				'default' => 20,
102 102
 				'option'  => 'formidable_page_formidable_entries_per_page',
103 103
 			) );
104
-        }
104
+		}
105 105
 
106
-        return $columns;
107
-    }
106
+		return $columns;
107
+	}
108 108
 
109 109
 	private static function get_columns_for_form( $form_id, &$columns ) {
110 110
 		$form_cols = FrmField::get_all_for_form( $form_id, '', 'include' );
@@ -153,67 +153,67 @@  discard block
 block discarded – undo
153 153
 	public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
154 154
 		$this_page_name = self::hidden_column_key();
155 155
 		if ( $meta_key != $this_page_name || $meta_value == $prev_value ) {
156
-            return $check;
157
-        }
156
+			return $check;
157
+		}
158 158
 
159 159
 		if ( empty( $prev_value ) ) {
160 160
 			$prev_value = get_metadata( 'user', $object_id, $meta_key, true );
161 161
 		}
162 162
 
163
-        global $frm_vars;
163
+		global $frm_vars;
164 164
 		//add a check so we don't create a loop
165 165
 		$frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
166 166
 
167
-        return $check;
168
-    }
167
+		return $check;
168
+	}
169 169
 
170
-    //add hidden columns back from other forms
170
+	//add hidden columns back from other forms
171 171
 	public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) {
172 172
 		$this_page_name = self::hidden_column_key();
173 173
 		if ( $meta_key != $this_page_name ) {
174
-            return;
175
-        }
174
+			return;
175
+		}
176 176
 
177 177
 		global $frm_vars;
178 178
 		if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) {
179 179
 			return; //don't continue if there's no previous value
180 180
 		}
181 181
 
182
-        foreach ( $meta_value as $mk => $mv ) {
183
-            //remove blank values
184
-            if ( empty( $mv ) ) {
185
-                unset( $meta_value[ $mk ] );
186
-            }
187
-        }
182
+		foreach ( $meta_value as $mk => $mv ) {
183
+			//remove blank values
184
+			if ( empty( $mv ) ) {
185
+				unset( $meta_value[ $mk ] );
186
+			}
187
+		}
188 188
 
189 189
 		$cur_form_prefix = reset( $meta_value );
190 190
 		$cur_form_prefix = explode( '_', $cur_form_prefix );
191
-        $cur_form_prefix = $cur_form_prefix[0];
192
-        $save = false;
191
+		$cur_form_prefix = $cur_form_prefix[0];
192
+		$save = false;
193 193
 
194
-        foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
194
+		foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
195 195
 			if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) {
196
-                //don't add blank cols or process included cols
197
-                continue;
198
-            }
196
+				//don't add blank cols or process included cols
197
+				continue;
198
+			}
199 199
 
200 200
 			$form_prefix = explode( '_', $prev_hidden );
201
-            $form_prefix = $form_prefix[0];
202
-            if ( $form_prefix == $cur_form_prefix ) {
203
-                //don't add back columns that are meant to be hidden
204
-                continue;
205
-            }
206
-
207
-            $meta_value[] = $prev_hidden;
208
-            $save = true;
201
+			$form_prefix = $form_prefix[0];
202
+			if ( $form_prefix == $cur_form_prefix ) {
203
+				//don't add back columns that are meant to be hidden
204
+				continue;
205
+			}
206
+
207
+			$meta_value[] = $prev_hidden;
208
+			$save = true;
209 209
 			unset( $form_prefix );
210
-        }
210
+		}
211 211
 
212 212
 		if ( $save ) {
213 213
 			$user_id = get_current_user_id();
214 214
 			update_user_option( $user_id, $this_page_name, $meta_value, true );
215
-        }
216
-    }
215
+		}
216
+	}
217 217
 
218 218
 	/**
219 219
 	 * @since 2.05.07
@@ -234,11 +234,11 @@  discard block
 block discarded – undo
234 234
 	}
235 235
 
236 236
 	public static function save_per_page( $save, $option, $value ) {
237
-        if ( $option == 'formidable_page_formidable_entries_per_page' ) {
238
-            $save = (int) $value;
239
-        }
240
-        return $save;
241
-    }
237
+		if ( $option == 'formidable_page_formidable_entries_per_page' ) {
238
+			$save = (int) $value;
239
+		}
240
+		return $save;
241
+	}
242 242
 
243 243
 	public static function sortable_columns() {
244 244
 		$form_id = FrmForm::get_current_form_id();
@@ -338,43 +338,43 @@  discard block
 block discarded – undo
338 338
 	}
339 339
 
340 340
 	public static function display_list( $message = '', $errors = array() ) {
341
-        global $wpdb, $frm_vars;
341
+		global $wpdb, $frm_vars;
342 342
 
343 343
 		$form = FrmForm::maybe_get_current_form();
344 344
 		$params = FrmForm::get_admin_params( $form );
345 345
 
346
-        if ( $form ) {
347
-            $params['form'] = $form->id;
348
-            $frm_vars['current_form'] = $form;
346
+		if ( $form ) {
347
+			$params['form'] = $form->id;
348
+			$frm_vars['current_form'] = $form;
349 349
 
350 350
 			self::get_delete_form_time( $form, $errors );
351 351
 		}
352 352
 
353
-        $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
353
+		$table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
354 354
 
355
-        $wp_list_table = new $table_class( array( 'params' => $params ) );
355
+		$wp_list_table = new $table_class( array( 'params' => $params ) );
356 356
 
357
-        $pagenum = $wp_list_table->get_pagenum();
357
+		$pagenum = $wp_list_table->get_pagenum();
358 358
 
359
-        $wp_list_table->prepare_items();
359
+		$wp_list_table->prepare_items();
360 360
 
361
-        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
362
-        if ( $pagenum > $total_pages && $total_pages > 0 ) {
361
+		$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
362
+		if ( $pagenum > $total_pages && $total_pages > 0 ) {
363 363
 			$url = add_query_arg( 'paged', $total_pages );
364
-            if ( headers_sent() ) {
364
+			if ( headers_sent() ) {
365 365
 				echo FrmAppHelper::js_redirect( $url );
366
-            } else {
367
-                wp_redirect( esc_url_raw( $url ) );
368
-            }
369
-            die();
370
-        }
366
+			} else {
367
+				wp_redirect( esc_url_raw( $url ) );
368
+			}
369
+			die();
370
+		}
371 371
 
372 372
 		if ( empty( $message ) && isset( $_GET['import-message'] ) ) {
373
-            $message = __( 'Your import is complete', 'formidable' );
374
-        }
373
+			$message = __( 'Your import is complete', 'formidable' );
374
+		}
375 375
 
376 376
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' );
377
-    }
377
+	}
378 378
 
379 379
 	private static function get_delete_form_time( $form, &$errors ) {
380 380
 		if ( 'trash' == $form->status ) {
@@ -384,17 +384,17 @@  discard block
 block discarded – undo
384 384
 		}
385 385
 	}
386 386
 
387
-    /* Back End CRUD */
387
+	/* Back End CRUD */
388 388
 	public static function show( $id = 0 ) {
389 389
 		FrmAppHelper::permission_check( 'frm_view_entries' );
390 390
 
391
-        if ( ! $id ) {
391
+		if ( ! $id ) {
392 392
 			$id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
393 393
 
394
-            if ( ! $id ) {
394
+			if ( ! $id ) {
395 395
 				$id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' );
396
-            }
397
-        }
396
+			}
397
+		}
398 398
 
399 399
 		$entry = FrmEntry::getOne( $id, true );
400 400
 		if ( ! $entry ) {
@@ -410,104 +410,104 @@  discard block
 block discarded – undo
410 410
 		}
411 411
 
412 412
 		$fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' );
413
-        $to_emails = array();
413
+		$to_emails = array();
414 414
 
415 415
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' );
416
-    }
416
+	}
417 417
 
418
-    public static function destroy() {
418
+	public static function destroy() {
419 419
 		FrmAppHelper::permission_check( 'frm_delete_entries' );
420 420
 
421 421
 		$params = FrmForm::get_admin_params();
422 422
 
423 423
 		if ( isset( $params['keep_post'] ) && $params['keep_post'] ) {
424
-            //unlink entry from post
425
-            global $wpdb;
424
+			//unlink entry from post
425
+			global $wpdb;
426 426
 			$wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) );
427
-        }
427
+		}
428 428
 
429
-        $message = '';
430
-        if ( FrmEntry::destroy( $params['id'] ) ) {
431
-            $message = __( 'Entry was Successfully Destroyed', 'formidable' );
432
-        }
429
+		$message = '';
430
+		if ( FrmEntry::destroy( $params['id'] ) ) {
431
+			$message = __( 'Entry was Successfully Destroyed', 'formidable' );
432
+		}
433 433
 
434
-        self::display_list( $message );
435
-    }
434
+		self::display_list( $message );
435
+	}
436 436
 
437
-    public static function destroy_all() {
438
-        if ( ! current_user_can( 'frm_delete_entries' ) ) {
439
-            $frm_settings = FrmAppHelper::get_settings();
440
-            wp_die( $frm_settings->admin_permission );
441
-        }
437
+	public static function destroy_all() {
438
+		if ( ! current_user_can( 'frm_delete_entries' ) ) {
439
+			$frm_settings = FrmAppHelper::get_settings();
440
+			wp_die( $frm_settings->admin_permission );
441
+		}
442 442
 
443
-        global $wpdb;
443
+		global $wpdb;
444 444
 		$params = FrmForm::get_admin_params();
445
-        $message = '';
446
-        $errors = array();
447
-        $form_id = (int) $params['form'];
445
+		$message = '';
446
+		$errors = array();
447
+		$form_id = (int) $params['form'];
448 448
 
449
-        if ( $form_id ) {
450
-            $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
449
+		if ( $form_id ) {
450
+			$entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
451 451
 			$action = FrmFormAction::get_action_for_form( $form_id, 'wppost', 1 );
452 452
 
453
-            if ( $action ) {
454
-                // this action takes a while, so only trigger it if there are posts to delete
455
-                foreach ( $entry_ids as $entry_id ) {
456
-                    do_action( 'frm_before_destroy_entry', $entry_id );
457
-                    unset( $entry_id );
458
-                }
459
-            }
460
-
461
-            $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) );
462
-            $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) );
463
-            if ( $results ) {
453
+			if ( $action ) {
454
+				// this action takes a while, so only trigger it if there are posts to delete
455
+				foreach ( $entry_ids as $entry_id ) {
456
+					do_action( 'frm_before_destroy_entry', $entry_id );
457
+					unset( $entry_id );
458
+				}
459
+			}
460
+
461
+			$wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) );
462
+			$results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) );
463
+			if ( $results ) {
464 464
 				FrmEntry::clear_cache();
465
-                $message = __( 'Entries were Successfully Destroyed', 'formidable' );
466
-            }
467
-        } else {
468
-            $errors = __( 'No entries were specified', 'formidable' );
469
-        }
470
-
471
-        self::display_list( $message, $errors );
472
-    }
473
-
474
-    public static function show_form( $id = '', $key = '', $title = false, $description = false ) {
475
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' );
476
-        return FrmFormsController::show_form( $id, $key, $title, $description );
477
-    }
478
-
479
-    public static function get_form( $filename, $form, $title, $description ) {
480
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' );
481
-        return FrmFormsController::get_form( $form, $title, $description );
482
-    }
483
-
484
-    public static function process_entry( $errors = '', $ajax = false ) {
465
+				$message = __( 'Entries were Successfully Destroyed', 'formidable' );
466
+			}
467
+		} else {
468
+			$errors = __( 'No entries were specified', 'formidable' );
469
+		}
470
+
471
+		self::display_list( $message, $errors );
472
+	}
473
+
474
+	public static function show_form( $id = '', $key = '', $title = false, $description = false ) {
475
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' );
476
+		return FrmFormsController::show_form( $id, $key, $title, $description );
477
+	}
478
+
479
+	public static function get_form( $filename, $form, $title, $description ) {
480
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' );
481
+		return FrmFormsController::get_form( $form, $title, $description );
482
+	}
483
+
484
+	public static function process_entry( $errors = '', $ajax = false ) {
485 485
 		$form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
486 486
 		if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) {
487
-            return;
488
-        }
487
+			return;
488
+		}
489 489
 
490
-        global $frm_vars;
490
+		global $frm_vars;
491 491
 
492 492
 		$form = FrmForm::getOne( $form_id );
493
-        if ( ! $form ) {
494
-            return;
495
-        }
493
+		if ( ! $form ) {
494
+			return;
495
+		}
496 496
 
497 497
 		$params = FrmForm::get_params( $form );
498 498
 
499
-        if ( ! isset( $frm_vars['form_params'] ) ) {
500
-            $frm_vars['form_params'] = array();
501
-        }
499
+		if ( ! isset( $frm_vars['form_params'] ) ) {
500
+			$frm_vars['form_params'] = array();
501
+		}
502 502
 		$frm_vars['form_params'][ $form->id ] = $params;
503 503
 
504 504
 		if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
505
-            return;
506
-        }
505
+			return;
506
+		}
507 507
 
508
-        if ( $errors == '' && ! $ajax ) {
508
+		if ( $errors == '' && ! $ajax ) {
509 509
 			$errors = FrmEntryValidate::validate( $_POST );
510
-        }
510
+		}
511 511
 
512 512
 		/**
513 513
 		 * Use this filter to add trigger actions and add errors after
@@ -518,39 +518,39 @@  discard block
 block discarded – undo
518 518
 
519 519
 		$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
520 520
 
521
-        if ( empty( $errors ) ) {
521
+		if ( empty( $errors ) ) {
522 522
 			$_POST['frm_skip_cookie'] = 1;
523
-            if ( $params['action'] == 'create' ) {
523
+			if ( $params['action'] == 'create' ) {
524 524
 				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
525 525
 					$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
526
-                }
527
-            }
526
+				}
527
+			}
528 528
 
529
-            do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
529
+			do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
530 530
 			unset( $_POST['frm_skip_cookie'] );
531
-        }
532
-    }
533
-
534
-    public static function delete_entry_before_redirect( $url, $form, $atts ) {
535
-        self::_delete_entry( $atts['id'], $form );
536
-        return $url;
537
-    }
538
-
539
-    //Delete entry if not redirected
540
-    public static function delete_entry_after_save( $atts ) {
541
-        self::_delete_entry( $atts['entry_id'], $atts['form'] );
542
-    }
543
-
544
-    private static function _delete_entry( $entry_id, $form ) {
545
-        if ( ! $form ) {
546
-            return;
547
-        }
548
-
549
-        $form->options = maybe_unserialize( $form->options );
550
-        if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
551
-            FrmEntry::destroy( $entry_id );
552
-        }
553
-    }
531
+		}
532
+	}
533
+
534
+	public static function delete_entry_before_redirect( $url, $form, $atts ) {
535
+		self::_delete_entry( $atts['id'], $form );
536
+		return $url;
537
+	}
538
+
539
+	//Delete entry if not redirected
540
+	public static function delete_entry_after_save( $atts ) {
541
+		self::_delete_entry( $atts['entry_id'], $atts['form'] );
542
+	}
543
+
544
+	private static function _delete_entry( $entry_id, $form ) {
545
+		if ( ! $form ) {
546
+			return;
547
+		}
548
+
549
+		$form->options = maybe_unserialize( $form->options );
550
+		if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
551
+			FrmEntry::destroy( $entry_id );
552
+		}
553
+	}
554 554
 
555 555
 	/**
556 556
 	 * @param $atts
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 		}
618 618
 
619 619
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' );
620
-    }
620
+	}
621 621
 
622 622
 	/***********************************************************************
623 623
 	 * Deprecated Functions
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
             'id'      => 'formidable-entries-tab',
63 63
             'title'   => __( 'Overview', 'formidable' ),
64 64
 			'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
65
-        ));
65
+        ) );
66 66
 
67 67
         $screen->set_help_sidebar(
68 68
 			'<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
@@ -77,19 +77,19 @@  discard block
 block discarded – undo
77 77
         global $frm_vars;
78 78
 		$form_id = FrmForm::get_current_form_id();
79 79
 
80
-		$columns[ $form_id . '_id' ] = 'ID';
81
-		$columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
80
+		$columns[$form_id . '_id'] = 'ID';
81
+		$columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' );
82 82
 
83 83
 		if ( $form_id ) {
84 84
 			self::get_columns_for_form( $form_id, $columns );
85 85
 		} else {
86
-			$columns[ $form_id . '_form_id' ] = __( 'Form', 'formidable' );
87
-			$columns[ $form_id . '_name' ] = __( 'Entry Name', 'formidable' );
88
-			$columns[ $form_id . '_user_id' ] = __( 'Created By', 'formidable' );
86
+			$columns[$form_id . '_form_id'] = __( 'Form', 'formidable' );
87
+			$columns[$form_id . '_name'] = __( 'Entry Name', 'formidable' );
88
+			$columns[$form_id . '_user_id'] = __( 'Created By', 'formidable' );
89 89
 		}
90 90
 
91
-		$columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' );
92
-		$columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
91
+		$columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' );
92
+		$columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' );
93 93
 		self::maybe_add_ip_col( $form_id, $columns );
94 94
 
95 95
         $frm_vars['cols'] = $columns;
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
 				if ( $sub_form_cols ) {
121 121
 					foreach ( $sub_form_cols as $k => $sub_form_col ) {
122 122
 						if ( FrmField::is_no_save_field( $sub_form_col->type ) ) {
123
-							unset( $sub_form_cols[ $k ] );
123
+							unset( $sub_form_cols[$k] );
124 124
 							continue;
125 125
 						}
126
-						$columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
126
+						$columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
127 127
 						unset( $sub_form_col );
128 128
 					}
129 129
 				}
@@ -137,16 +137,16 @@  discard block
 block discarded – undo
137 137
 				$has_separate_value = ! FrmField::is_option_empty( $form_col, 'separate_value' );
138 138
 				$is_post_status     = FrmField::is_option_true( $form_col, 'post_field' ) && $form_col->field_options['post_field'] == 'post_status';
139 139
 				if ( $has_separate_value && ! $is_post_status ) {
140
-					$columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
140
+					$columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 );
141 141
 				}
142
-				$columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
142
+				$columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 );
143 143
 			}
144 144
 		}
145 145
 	}
146 146
 
147 147
 	private static function maybe_add_ip_col( $form_id, &$columns ) {
148 148
 		if ( FrmAppHelper::ips_saved() ) {
149
-			$columns[ $form_id . '_ip' ] = 'IP';
149
+			$columns[$form_id . '_ip'] = 'IP';
150 150
 		}
151 151
 	}
152 152
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         foreach ( $meta_value as $mk => $mv ) {
183 183
             //remove blank values
184 184
             if ( empty( $mv ) ) {
185
-                unset( $meta_value[ $mk ] );
185
+                unset( $meta_value[$mk] );
186 186
             }
187 187
         }
188 188
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 		foreach ( $fields as $field ) {
257 257
 			if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) {
258 258
 				// Can't sort on checkboxes because they are stored serialized, or post fields
259
-				$columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id;
259
+				$columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id;
260 260
 			}
261 261
 		}
262 262
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 
331 331
 			if ( ! in_array( $col_key, $result, true ) ) {
332 332
 				$result[] = $col_key;
333
-				$i--;
333
+				$i --;
334 334
 			}
335 335
 
336 336
 			unset( $col_key, $col );
@@ -499,9 +499,9 @@  discard block
 block discarded – undo
499 499
         if ( ! isset( $frm_vars['form_params'] ) ) {
500 500
             $frm_vars['form_params'] = array();
501 501
         }
502
-		$frm_vars['form_params'][ $form->id ] = $params;
502
+		$frm_vars['form_params'][$form->id] = $params;
503 503
 
504
-		if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
504
+		if ( isset( $frm_vars['created_entries'][$form_id] ) ) {
505 505
             return;
506 506
         }
507 507
 
@@ -516,13 +516,13 @@  discard block
 block discarded – undo
516 516
 		 */
517 517
 		$errors = apply_filters( 'frm_entries_before_create', $errors, $form );
518 518
 
519
-		$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
519
+		$frm_vars['created_entries'][$form_id] = array( 'errors' => $errors );
520 520
 
521 521
         if ( empty( $errors ) ) {
522 522
 			$_POST['frm_skip_cookie'] = 1;
523 523
             if ( $params['action'] == 'create' ) {
524
-				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
525
-					$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
524
+				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) {
525
+					$frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST );
526 526
                 }
527 527
             }
528 528
 
Please login to merge, or discard this patch.