Completed
Push — master ( 469bb7...e89fdc )
by Stephanie
03:56
created
classes/controllers/FrmAppController.php 1 patch
Indentation   +154 added lines, -154 removed lines patch added patch discarded remove patch
@@ -3,14 +3,14 @@  discard block
 block discarded – undo
3 3
 class FrmAppController {
4 4
 
5 5
 	public static function menu() {
6
-        FrmAppHelper::maybe_add_permissions();
7
-        if ( ! current_user_can( 'frm_view_forms' ) ) {
8
-            return;
9
-        }
6
+		FrmAppHelper::maybe_add_permissions();
7
+		if ( ! current_user_can( 'frm_view_forms' ) ) {
8
+			return;
9
+		}
10 10
 
11 11
 		$menu_name = FrmAppHelper::get_menu_name();
12 12
 		add_menu_page( 'Formidable', $menu_name, 'frm_view_forms', 'formidable', 'FrmFormsController::route', FrmAppHelper::plugin_url() . '/images/form_16.png', self::get_menu_position() );
13
-    }
13
+	}
14 14
 
15 15
 	private static function get_menu_position() {
16 16
 		$count = count( get_post_types( array( 'show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) ) );
@@ -19,39 +19,39 @@  discard block
 block discarded – undo
19 19
 		return $pos;
20 20
 	}
21 21
 
22
-    public static function load_wp_admin_style() {
23
-        FrmAppHelper::load_font_style();
24
-    }
22
+	public static function load_wp_admin_style() {
23
+		FrmAppHelper::load_font_style();
24
+	}
25 25
 
26 26
 	public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) {
27
-        global $pagenow, $frm_vars;
27
+		global $pagenow, $frm_vars;
28 28
 
29 29
 		$show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' );
30
-        if ( empty( $show_nav ) ) {
31
-            return;
32
-        }
30
+		if ( empty( $show_nav ) ) {
31
+			return;
32
+		}
33 33
 
34 34
 		$current_page = isset( $_GET['page'] ) ? FrmAppHelper::simple_get( 'page', 'sanitize_title' ) : FrmAppHelper::simple_get( 'post_type', 'sanitize_title', 'None' );
35 35
 		if ( $pagenow == 'post.php' || $pagenow == 'post-new.php' ) {
36 36
 			$current_page = 'frm_display';
37 37
 		}
38 38
 
39
-        if ( $form ) {
39
+		if ( $form ) {
40 40
 			FrmForm::maybe_get_form( $form );
41 41
 
42
-            if ( is_object( $form ) ) {
43
-                $id = $form->id;
44
-            }
45
-        }
42
+			if ( is_object( $form ) ) {
43
+				$id = $form->id;
44
+			}
45
+		}
46 46
 
47
-        if ( ! isset( $id ) ) {
48
-            $form = $id = false;
49
-        }
47
+		if ( ! isset( $id ) ) {
48
+			$form = $id = false;
49
+		}
50 50
 
51 51
 		$nav_items = self::get_form_nav_items( $id );
52 52
 
53
-        include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
54
-    }
53
+		include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' );
54
+	}
55 55
 
56 56
 	private static function get_form_nav_items( $id ) {
57 57
 		$nav_items = array(
@@ -82,28 +82,28 @@  discard block
 block discarded – undo
82 82
 		return $nav_items;
83 83
 	}
84 84
 
85
-    // Adds a settings link to the plugins page
86
-    public static function settings_link( $links ) {
85
+	// Adds a settings link to the plugins page
86
+	public static function settings_link( $links ) {
87 87
 		$settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings' ) ) . '">' . __( 'Settings', 'formidable' ) . '</a>';
88
-        array_unshift( $links, $settings );
88
+		array_unshift( $links, $settings );
89 89
 
90
-        return $links;
91
-    }
90
+		return $links;
91
+	}
92 92
 
93
-    public static function pro_get_started_headline() {
93
+	public static function pro_get_started_headline() {
94 94
 		self::maybe_show_upgrade_bar();
95 95
 
96
-        // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message
97
-        if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) {
98
-            return;
99
-        }
96
+		// Don't display this error as we're upgrading the thing, or if the user shouldn't see the message
97
+		if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) {
98
+			return;
99
+		}
100 100
 
101 101
 		if ( get_site_option( 'frmpro-authorized' ) && ! file_exists( FrmAppHelper::plugin_path() . '/pro/formidable-pro.php' ) ) {
102
-            FrmAppHelper::load_admin_wide_js();
102
+			FrmAppHelper::load_admin_wide_js();
103 103
 
104
-            // user is authorized, but running free version
105
-            $inst_install_url = 'https://formidablepro.com/knowledgebase/install-formidable-forms/';
106
-        ?>
104
+			// user is authorized, but running free version
105
+			$inst_install_url = 'https://formidablepro.com/knowledgebase/install-formidable-forms/';
106
+		?>
107 107
 <div class="error" class="frm_previous_install">
108 108
 		<?php
109 109
 		echo wp_kses_post( apply_filters( 'frm_pro_update_msg',
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 		) ); ?>
116 116
 </div>
117 117
 <?php
118
-        }
119
-    }
118
+		}
119
+	}
120 120
 
121 121
 	private static function maybe_show_upgrade_bar() {
122 122
 		$page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 		}
217 217
 	}
218 218
 
219
-    public static function admin_js() {
219
+	public static function admin_js() {
220 220
 		$version = FrmAppHelper::plugin_version();
221 221
 		FrmAppHelper::load_admin_wide_js( false );
222 222
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 			'bootstrap_tooltip', 'bootstrap-multiselect',
228 228
 		), $version, true );
229 229
 		wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version );
230
-        wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
230
+		wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' );
231 231
 
232 232
 		// load multselect js
233 233
 		wp_register_script( 'bootstrap-multiselect', FrmAppHelper::plugin_url() . '/js/bootstrap-multiselect.js', array( 'jquery', 'bootstrap_tooltip' ), '0.9.8', true );
@@ -238,78 +238,78 @@  discard block
 block discarded – undo
238 238
 		global $pagenow;
239 239
 		if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) {
240 240
 
241
-            wp_enqueue_script( 'admin-widgets' );
242
-            wp_enqueue_style( 'widgets' );
243
-            wp_enqueue_script( 'formidable' );
244
-            wp_enqueue_script( 'formidable_admin' );
241
+			wp_enqueue_script( 'admin-widgets' );
242
+			wp_enqueue_style( 'widgets' );
243
+			wp_enqueue_script( 'formidable' );
244
+			wp_enqueue_script( 'formidable_admin' );
245 245
 			FrmAppHelper::localize_script( 'admin' );
246 246
 
247
-            wp_enqueue_style( 'formidable-admin' );
248
-            add_thickbox();
247
+			wp_enqueue_style( 'formidable-admin' );
248
+			add_thickbox();
249 249
 
250
-            wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' );
250
+			wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' );
251 251
 
252
-        } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) {
253
-            if ( isset( $_REQUEST['post_type'] ) ) {
254
-                $post_type = sanitize_title( $_REQUEST['post_type'] );
252
+		} else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) {
253
+			if ( isset( $_REQUEST['post_type'] ) ) {
254
+				$post_type = sanitize_title( $_REQUEST['post_type'] );
255 255
 			} else if ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) {
256 256
 				$post = get_post( absint( $_REQUEST['post'] ) );
257
-                if ( ! $post ) {
258
-                    return;
259
-                }
260
-                $post_type = $post->post_type;
261
-            } else {
262
-                return;
263
-            }
264
-
265
-            if ( $post_type == 'frm_display' ) {
266
-                wp_enqueue_script( 'jquery-ui-draggable' );
267
-                wp_enqueue_script( 'formidable_admin' );
268
-                wp_enqueue_style( 'formidable-admin' );
257
+				if ( ! $post ) {
258
+					return;
259
+				}
260
+				$post_type = $post->post_type;
261
+			} else {
262
+				return;
263
+			}
264
+
265
+			if ( $post_type == 'frm_display' ) {
266
+				wp_enqueue_script( 'jquery-ui-draggable' );
267
+				wp_enqueue_script( 'formidable_admin' );
268
+				wp_enqueue_style( 'formidable-admin' );
269 269
 				FrmAppHelper::localize_script( 'admin' );
270
-            }
271
-        } else if ( $pagenow == 'widgets.php' ) {
272
-            FrmAppHelper::load_admin_wide_js();
273
-        }
274
-    }
275
-
276
-    public static function wp_admin_body_class( $classes ) {
277
-        global $wp_version;
278
-        //we need this class everywhere in the admin for the menu
279
-        if ( version_compare( $wp_version, '3.7.2', '>' ) ) {
280
-            $classes .= ' frm_38_trigger';
281
-        }
282
-
283
-        return $classes;
284
-    }
285
-
286
-    public static function load_lang() {
287
-        load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
288
-    }
289
-
290
-    /**
291
-     * Filter shortcodes in text widgets
292
-     */
293
-    public static function widget_text_filter( $content ) {
294
-    	$regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/';
295
-    	return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content );
296
-    }
297
-
298
-    public static function widget_text_filter_callback( $matches ) {
299
-        _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::widget_text_filter_callback' );
300
-        return FrmAppHelper::widget_text_filter_callback( $matches );
301
-    }
302
-
303
-    public static function front_head() {
304
-        if ( is_multisite() ) {
305
-            $old_db_version = get_option( 'frm_db_version' );
306
-            $pro_db_version = FrmAppHelper::pro_is_installed() ? get_option( 'frmpro_db_version' ) : false;
307
-            if ( ( (int) $old_db_version < (int) FrmAppHelper::$db_version ) ||
308
-                ( FrmAppHelper::pro_is_installed() && (int) $pro_db_version < (int) FrmAppHelper::$pro_db_version ) ) {
309
-                self::install( $old_db_version );
310
-            }
311
-        }
312
-    }
270
+			}
271
+		} else if ( $pagenow == 'widgets.php' ) {
272
+			FrmAppHelper::load_admin_wide_js();
273
+		}
274
+	}
275
+
276
+	public static function wp_admin_body_class( $classes ) {
277
+		global $wp_version;
278
+		//we need this class everywhere in the admin for the menu
279
+		if ( version_compare( $wp_version, '3.7.2', '>' ) ) {
280
+			$classes .= ' frm_38_trigger';
281
+		}
282
+
283
+		return $classes;
284
+	}
285
+
286
+	public static function load_lang() {
287
+		load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' );
288
+	}
289
+
290
+	/**
291
+	 * Filter shortcodes in text widgets
292
+	 */
293
+	public static function widget_text_filter( $content ) {
294
+		$regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/';
295
+		return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content );
296
+	}
297
+
298
+	public static function widget_text_filter_callback( $matches ) {
299
+		_deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::widget_text_filter_callback' );
300
+		return FrmAppHelper::widget_text_filter_callback( $matches );
301
+	}
302
+
303
+	public static function front_head() {
304
+		if ( is_multisite() ) {
305
+			$old_db_version = get_option( 'frm_db_version' );
306
+			$pro_db_version = FrmAppHelper::pro_is_installed() ? get_option( 'frmpro_db_version' ) : false;
307
+			if ( ( (int) $old_db_version < (int) FrmAppHelper::$db_version ) ||
308
+				( FrmAppHelper::pro_is_installed() && (int) $pro_db_version < (int) FrmAppHelper::$pro_db_version ) ) {
309
+				self::install( $old_db_version );
310
+			}
311
+		}
312
+	}
313 313
 
314 314
 	public static function localize_script( $location ) {
315 315
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmAppHelper::localize_script' );
@@ -369,20 +369,20 @@  discard block
 block discarded – undo
369 369
 		wp_die();
370 370
 	}
371 371
 
372
-    public static function activation_install() {
373
-        FrmAppHelper::delete_cache_and_transient( 'frm_plugin_version' );
374
-        FrmFormActionsController::actions_init();
375
-        self::install();
376
-    }
372
+	public static function activation_install() {
373
+		FrmAppHelper::delete_cache_and_transient( 'frm_plugin_version' );
374
+		FrmFormActionsController::actions_init();
375
+		self::install();
376
+	}
377 377
 
378
-    public static function install( $old_db_version = false ) {
379
-        $frmdb = new FrmDb();
380
-        $frmdb->upgrade( $old_db_version );
381
-    }
378
+	public static function install( $old_db_version = false ) {
379
+		$frmdb = new FrmDb();
380
+		$frmdb->upgrade( $old_db_version );
381
+	}
382 382
 
383
-    public static function uninstall() {
383
+	public static function uninstall() {
384 384
 		FrmAppHelper::permission_check('administrator');
385
-        check_ajax_referer( 'frm_ajax', 'nonce' );
385
+		check_ajax_referer( 'frm_ajax', 'nonce' );
386 386
 
387 387
 		$frmdb = new FrmDb();
388 388
 		$frmdb->uninstall();
@@ -391,48 +391,48 @@  discard block
 block discarded – undo
391 391
 		deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false );
392 392
 		echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) );
393 393
 
394
-        wp_die();
395
-    }
394
+		wp_die();
395
+	}
396 396
 
397
-    public static function drop_tables( $tables ) {
398
-        global $wpdb;
399
-        $tables[] = $wpdb->prefix . 'frm_fields';
400
-        $tables[] = $wpdb->prefix . 'frm_forms';
401
-        $tables[] = $wpdb->prefix . 'frm_items';
402
-        $tables[] = $wpdb->prefix . 'frm_item_metas';
403
-        return $tables;
404
-    }
397
+	public static function drop_tables( $tables ) {
398
+		global $wpdb;
399
+		$tables[] = $wpdb->prefix . 'frm_fields';
400
+		$tables[] = $wpdb->prefix . 'frm_forms';
401
+		$tables[] = $wpdb->prefix . 'frm_items';
402
+		$tables[] = $wpdb->prefix . 'frm_item_metas';
403
+		return $tables;
404
+	}
405 405
 
406
-    // Routes for wordpress pages -- we're just replacing content here folks.
407
-    public static function page_route( $content ) {
408
-        global $post;
406
+	// Routes for wordpress pages -- we're just replacing content here folks.
407
+	public static function page_route( $content ) {
408
+		global $post;
409 409
 
410
-        $frm_settings = FrmAppHelper::get_settings();
411
-        if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) {
412
-            $content = FrmFormsController::page_preview();
413
-        }
410
+		$frm_settings = FrmAppHelper::get_settings();
411
+		if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) {
412
+			$content = FrmFormsController::page_preview();
413
+		}
414 414
 
415
-        return $content;
416
-    }
415
+		return $content;
416
+	}
417 417
 
418
-    public static function deauthorize() {
418
+	public static function deauthorize() {
419 419
 		FrmAppHelper::permission_check('frm_change_settings');
420
-        check_ajax_referer( 'frm_ajax', 'nonce' );
421
-
422
-        delete_option( 'frmpro-credentials' );
423
-        delete_option( 'frmpro-authorized' );
424
-        delete_site_option( 'frmpro-credentials' );
425
-        delete_site_option( 'frmpro-authorized' );
426
-        wp_die();
427
-    }
428
-
429
-    public static function get_form_shortcode( $atts ) {
430
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' );
431
-        return FrmFormsController::get_form_shortcode( $atts );
432
-    }
433
-
434
-    public static function get_postbox_class() {
435
-        _deprecated_function( __FUNCTION__, '2.0' );
436
-        return 'postbox-container';
437
-    }
420
+		check_ajax_referer( 'frm_ajax', 'nonce' );
421
+
422
+		delete_option( 'frmpro-credentials' );
423
+		delete_option( 'frmpro-authorized' );
424
+		delete_site_option( 'frmpro-credentials' );
425
+		delete_site_option( 'frmpro-authorized' );
426
+		wp_die();
427
+	}
428
+
429
+	public static function get_form_shortcode( $atts ) {
430
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' );
431
+		return FrmFormsController::get_form_shortcode( $atts );
432
+	}
433
+
434
+	public static function get_postbox_class() {
435
+		_deprecated_function( __FUNCTION__, '2.0' );
436
+		return 'postbox-container';
437
+	}
438 438
 }
Please login to merge, or discard this patch.
classes/controllers/FrmEntriesController.php 2 patches
Indentation   +352 added lines, -352 removed lines patch added patch discarded remove patch
@@ -2,201 +2,201 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmEntriesController {
4 4
 
5
-    public static function menu() {
5
+	public static function menu() {
6 6
 		FrmAppHelper::force_capability( 'frm_view_entries' );
7 7
 
8
-        add_submenu_page('formidable', 'Formidable | '. __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
8
+		add_submenu_page('formidable', 'Formidable | '. __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
9 9
 
10 10
 		if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) {
11 11
 			$menu_name = FrmAppHelper::get_menu_name();
12 12
 			add_filter( 'manage_' . sanitize_title( $menu_name ) . '_page_formidable-entries_columns', 'FrmEntriesController::manage_columns' );
13 13
 			add_filter( 'get_user_option_manage' . sanitize_title( $menu_name ) . '_page_formidable-entriescolumnshidden', 'FrmEntriesController::hidden_columns' );
14 14
 			add_filter( 'manage_' . sanitize_title( $menu_name ) . '_page_formidable-entries_sortable_columns', 'FrmEntriesController::sortable_columns' );
15
-        }
16
-    }
15
+		}
16
+	}
17 17
 
18
-    /* Display in Back End */
19
-    public static function route() {
18
+	/* Display in Back End */
19
+	public static function route() {
20 20
 		$action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
21 21
 
22
-        switch ( $action ) {
23
-            case 'show':
24
-            case 'destroy':
25
-            case 'destroy_all':
26
-                return self::$action();
22
+		switch ( $action ) {
23
+			case 'show':
24
+			case 'destroy':
25
+			case 'destroy_all':
26
+				return self::$action();
27 27
 
28
-            default:
29
-                do_action( 'frm_entry_action_route', $action );
30
-                if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
31
-                    return;
32
-                }
28
+			default:
29
+				do_action( 'frm_entry_action_route', $action );
30
+				if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
31
+					return;
32
+				}
33 33
 
34
-                return self::display_list();
35
-        }
36
-    }
34
+				return self::display_list();
35
+		}
36
+	}
37 37
 
38 38
 	public static function contextual_help( $help, $screen_id, $screen ) {
39
-        // Only add to certain screens. add_help_tab was introduced in WordPress 3.3
40
-        if ( ! method_exists( $screen, 'add_help_tab' ) ) {
41
-            return $help;
42
-        }
39
+		// Only add to certain screens. add_help_tab was introduced in WordPress 3.3
40
+		if ( ! method_exists( $screen, 'add_help_tab' ) ) {
41
+			return $help;
42
+		}
43 43
 
44 44
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
45 45
 		$page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
46 46
 		if ( $page != 'formidable-entries' || ( ! empty( $action ) && $action != 'list' ) ) {
47
-            return $help;
48
-        }
47
+			return $help;
48
+		}
49 49
 
50 50
 		unset( $action, $page );
51 51
 
52
-        $screen->add_help_tab( array(
53
-            'id'      => 'formidable-entries-tab',
54
-            'title'   => __( 'Overview', 'formidable' ),
52
+		$screen->add_help_tab( array(
53
+			'id'      => 'formidable-entries-tab',
54
+			'title'   => __( 'Overview', 'formidable' ),
55 55
 			'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) .'</p> <p>'. esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
56
-        ));
56
+		));
57 57
 
58
-        $screen->set_help_sidebar(
58
+		$screen->set_help_sidebar(
59 59
 			'<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
60 60
 			'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' .
61 61
 			'<p><a href="'. esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>'
62
-    	);
62
+		);
63 63
 
64
-        return $help;
65
-    }
64
+		return $help;
65
+	}
66 66
 
67 67
 	public static function manage_columns( $columns ) {
68
-        global $frm_vars, $wpdb;
68
+		global $frm_vars, $wpdb;
69 69
 		$form_id = FrmForm::get_current_form_id();
70 70
 
71
-        $columns[ $form_id .'_id' ] = 'ID';
71
+		$columns[ $form_id .'_id' ] = 'ID';
72 72
 		$columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
73 73
 
74
-        if ( ! $form_id ) {
75
-            return $columns;
76
-        }
74
+		if ( ! $form_id ) {
75
+			return $columns;
76
+		}
77 77
 
78
-        $form_cols = FrmField::get_all_for_form($form_id, '', 'include');
78
+		$form_cols = FrmField::get_all_for_form($form_id, '', 'include');
79 79
 
80
-        foreach ( $form_cols as $form_col ) {
80
+		foreach ( $form_cols as $form_col ) {
81 81
 			if ( FrmField::is_no_save_field( $form_col->type ) ) {
82
-                continue;
83
-            }
82
+				continue;
83
+			}
84 84
 
85
-            if ( $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] ) ) {
85
+			if ( $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] ) ) {
86 86
 				$sub_form_cols = FrmField::get_all_for_form( $form_col->field_options['form_select'] );
87 87
 
88
-                if ( $sub_form_cols ) {
89
-                    foreach ( $sub_form_cols as $k => $sub_form_col ) {
88
+				if ( $sub_form_cols ) {
89
+					foreach ( $sub_form_cols as $k => $sub_form_col ) {
90 90
 						if ( FrmField::is_no_save_field( $sub_form_col->type ) ) {
91
-                            unset( $sub_form_cols[ $k ] );
92
-                            continue;
93
-                        }
91
+							unset( $sub_form_cols[ $k ] );
92
+							continue;
93
+						}
94 94
 						$columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
95
-                        unset($sub_form_col);
96
-                    }
97
-                }
98
-                unset($sub_form_cols);
99
-            } else {
100
-                $col_id = $form_col->field_key;
101
-                if ( $form_col->form_id != $form_id ) {
102
-                    $col_id .= '-_-form'. $form_col->form_id;
103
-                }
104
-
105
-                if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) {
106
-                    $columns[ $form_id .'_frmsep_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
107
-                }
108
-                $columns[ $form_id .'_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
109
-            }
110
-        }
111
-
112
-        $columns[ $form_id .'_created_at' ] = __( 'Entry creation date', 'formidable' );
113
-        $columns[ $form_id .'_updated_at' ] = __( 'Entry update date', 'formidable' );
114
-        $columns[ $form_id .'_ip' ] = 'IP';
115
-
116
-        $frm_vars['cols'] = $columns;
95
+						unset($sub_form_col);
96
+					}
97
+				}
98
+				unset($sub_form_cols);
99
+			} else {
100
+				$col_id = $form_col->field_key;
101
+				if ( $form_col->form_id != $form_id ) {
102
+					$col_id .= '-_-form'. $form_col->form_id;
103
+				}
104
+
105
+				if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) {
106
+					$columns[ $form_id .'_frmsep_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
107
+				}
108
+				$columns[ $form_id .'_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
109
+			}
110
+		}
111
+
112
+		$columns[ $form_id .'_created_at' ] = __( 'Entry creation date', 'formidable' );
113
+		$columns[ $form_id .'_updated_at' ] = __( 'Entry update date', 'formidable' );
114
+		$columns[ $form_id .'_ip' ] = 'IP';
115
+
116
+		$frm_vars['cols'] = $columns;
117 117
 
118 118
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
119 119
 		if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) {
120 120
 			add_screen_option( 'per_page', array( 'label' => __( 'Entries', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_entries_per_page' ) );
121
-        }
121
+		}
122 122
 
123
-        return $columns;
124
-    }
123
+		return $columns;
124
+	}
125 125
 
126 126
 	public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
127 127
 		$menu_name = FrmAppHelper::get_menu_name();
128 128
 		$this_page_name = 'manage' .  sanitize_title( $menu_name ) . '_page_formidable-entriescolumnshidden';
129 129
 		if ( $meta_key != $this_page_name || $meta_value == $prev_value ) {
130
-            return $check;
131
-        }
130
+			return $check;
131
+		}
132 132
 
133 133
 		if ( empty( $prev_value ) ) {
134 134
 			$prev_value = get_metadata( 'user', $object_id, $meta_key, true );
135 135
 		}
136 136
 
137
-        global $frm_vars;
138
-        //add a check so we don't create a loop
139
-        $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
137
+		global $frm_vars;
138
+		//add a check so we don't create a loop
139
+		$frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
140 140
 
141
-        return $check;
142
-    }
141
+		return $check;
142
+	}
143 143
 
144
-    //add hidden columns back from other forms
144
+	//add hidden columns back from other forms
145 145
 	public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) {
146 146
 		$menu_name = FrmAppHelper::get_menu_name();
147 147
 		$sanitized = sanitize_title( $menu_name );
148 148
 		$this_page_name = 'manage'.  $sanitized .'_page_formidable-entriescolumnshidden';
149 149
 		if ( $meta_key != $this_page_name ) {
150
-            return;
151
-        }
152
-
153
-        global $frm_vars;
154
-        if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) {
155
-            return; //don't continue if there's no previous value
156
-        }
157
-
158
-        foreach ( $meta_value as $mk => $mv ) {
159
-            //remove blank values
160
-            if ( empty( $mv )  ) {
161
-                unset( $meta_value[ $mk ] );
162
-            }
163
-        }
164
-
165
-        $cur_form_prefix = reset($meta_value);
166
-        $cur_form_prefix = explode('_', $cur_form_prefix);
167
-        $cur_form_prefix = $cur_form_prefix[0];
168
-        $save = false;
169
-
170
-        foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
150
+			return;
151
+		}
152
+
153
+		global $frm_vars;
154
+		if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) {
155
+			return; //don't continue if there's no previous value
156
+		}
157
+
158
+		foreach ( $meta_value as $mk => $mv ) {
159
+			//remove blank values
160
+			if ( empty( $mv )  ) {
161
+				unset( $meta_value[ $mk ] );
162
+			}
163
+		}
164
+
165
+		$cur_form_prefix = reset($meta_value);
166
+		$cur_form_prefix = explode('_', $cur_form_prefix);
167
+		$cur_form_prefix = $cur_form_prefix[0];
168
+		$save = false;
169
+
170
+		foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
171 171
 			if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) {
172
-                //don't add blank cols or process included cols
173
-                continue;
174
-            }
172
+				//don't add blank cols or process included cols
173
+				continue;
174
+			}
175 175
 
176 176
 			$form_prefix = explode( '_', $prev_hidden );
177
-            $form_prefix = $form_prefix[0];
178
-            if ( $form_prefix == $cur_form_prefix ) {
179
-                //don't add back columns that are meant to be hidden
180
-                continue;
181
-            }
177
+			$form_prefix = $form_prefix[0];
178
+			if ( $form_prefix == $cur_form_prefix ) {
179
+				//don't add back columns that are meant to be hidden
180
+				continue;
181
+			}
182 182
 
183
-            $meta_value[] = $prev_hidden;
184
-            $save = true;
185
-            unset($form_prefix);
186
-        }
183
+			$meta_value[] = $prev_hidden;
184
+			$save = true;
185
+			unset($form_prefix);
186
+		}
187 187
 
188 188
 		if ( $save ) {
189
-            $user = wp_get_current_user();
189
+			$user = wp_get_current_user();
190 190
 			update_user_option( $user->ID, $this_page_name, $meta_value, true );
191
-        }
192
-    }
191
+		}
192
+	}
193 193
 
194 194
 	public static function save_per_page( $save, $option, $value ) {
195
-        if ( $option == 'formidable_page_formidable_entries_per_page' ) {
196
-            $save = (int) $value;
197
-        }
198
-        return $save;
199
-    }
195
+		if ( $option == 'formidable_page_formidable_entries_per_page' ) {
196
+			$save = (int) $value;
197
+		}
198
+		return $save;
199
+	}
200 200
 
201 201
 	public static function sortable_columns() {
202 202
 		$form_id = FrmForm::get_current_form_id();
@@ -222,226 +222,226 @@  discard block
 block discarded – undo
222 222
 	}
223 223
 
224 224
 	public static function hidden_columns( $result ) {
225
-        global $frm_vars;
225
+		global $frm_vars;
226 226
 
227 227
 		$form_id = FrmForm::get_current_form_id();
228 228
 
229
-        $return = false;
230
-        foreach ( (array) $result as $r ) {
231
-            if ( ! empty( $r ) ) {
232
-                $form_prefix = explode( '_', $r );
233
-                $form_prefix = $form_prefix[0];
229
+		$return = false;
230
+		foreach ( (array) $result as $r ) {
231
+			if ( ! empty( $r ) ) {
232
+				$form_prefix = explode( '_', $r );
233
+				$form_prefix = $form_prefix[0];
234 234
 
235
-                if ( (int) $form_prefix == (int) $form_id ) {
236
-                    $return = true;
237
-                    break;
238
-                }
235
+				if ( (int) $form_prefix == (int) $form_id ) {
236
+					$return = true;
237
+					break;
238
+				}
239 239
 
240
-                unset($form_prefix);
241
-            }
242
-        }
240
+				unset($form_prefix);
241
+			}
242
+		}
243 243
 
244
-        if ( $return ) {
244
+		if ( $return ) {
245 245
 			return $result;
246 246
 		}
247 247
 
248
-        $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0;
249
-        $max_columns = 8;
250
-        if ( $i <= $max_columns ) {
248
+		$i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0;
249
+		$max_columns = 8;
250
+		if ( $i <= $max_columns ) {
251 251
 			return $result;
252 252
 		}
253 253
 
254
-        global $frm_vars;
255
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) {
256
-            $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options);
257
-        }
254
+		global $frm_vars;
255
+		if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) {
256
+			$frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options);
257
+		}
258 258
 
259
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) {
260
-            $result = $frm_vars['current_form']->options['hidden_cols'];
261
-        } else {
262
-            $cols = $frm_vars['cols'];
263
-            $cols = array_reverse($cols, true);
259
+		if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) {
260
+			$result = $frm_vars['current_form']->options['hidden_cols'];
261
+		} else {
262
+			$cols = $frm_vars['cols'];
263
+			$cols = array_reverse($cols, true);
264 264
 
265
-            $result[] = $form_id .'_id';
266
-            $i--;
265
+			$result[] = $form_id .'_id';
266
+			$i--;
267 267
 
268
-            $result[] = $form_id .'_item_key';
269
-            $i--;
268
+			$result[] = $form_id .'_item_key';
269
+			$i--;
270 270
 
271 271
 			foreach ( $cols as $col_key => $col ) {
272
-                if ( $i > $max_columns ) {
272
+				if ( $i > $max_columns ) {
273 273
 					$result[] = $col_key;
274 274
 				}
275
-                //remove some columns by default
276
-                $i--;
277
-                unset($col_key, $col);
278
-            }
279
-        }
275
+				//remove some columns by default
276
+				$i--;
277
+				unset($col_key, $col);
278
+			}
279
+		}
280 280
 
281
-        return $result;
282
-    }
281
+		return $result;
282
+	}
283 283
 
284 284
 	public static function display_list( $message = '', $errors = array() ) {
285
-        global $wpdb, $frm_vars;
285
+		global $wpdb, $frm_vars;
286 286
 
287 287
 		$form = FrmForm::get_current_form();
288 288
 		$params = FrmForm::get_admin_params( $form );
289 289
 
290
-        if ( $form ) {
291
-            $params['form'] = $form->id;
292
-            $frm_vars['current_form'] = $form;
290
+		if ( $form ) {
291
+			$params['form'] = $form->id;
292
+			$frm_vars['current_form'] = $form;
293 293
 
294
-	        if ( 'trash' == $form->status ) {
295
-	            $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
296
-	            $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) );
297
-	            $errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete );
298
-	            unset( $time_to_delete, $delete_timestamp );
299
-	        }
294
+			if ( 'trash' == $form->status ) {
295
+				$delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
296
+				$time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) );
297
+				$errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete );
298
+				unset( $time_to_delete, $delete_timestamp );
299
+			}
300 300
 		}
301 301
 
302
-        $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
302
+		$table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
303 303
 
304
-        $wp_list_table = new $table_class( array( 'params' => $params ) );
304
+		$wp_list_table = new $table_class( array( 'params' => $params ) );
305 305
 
306
-        $pagenum = $wp_list_table->get_pagenum();
306
+		$pagenum = $wp_list_table->get_pagenum();
307 307
 
308
-        $wp_list_table->prepare_items();
308
+		$wp_list_table->prepare_items();
309 309
 
310
-        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
311
-        if ( $pagenum > $total_pages && $total_pages > 0 ) {
310
+		$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
311
+		if ( $pagenum > $total_pages && $total_pages > 0 ) {
312 312
 			$url = add_query_arg( 'paged', $total_pages );
313
-            if ( headers_sent() ) {
314
-                echo FrmAppHelper::js_redirect($url);
315
-            } else {
316
-                wp_redirect( esc_url_raw( $url ) );
317
-            }
318
-            die();
319
-        }
320
-
321
-        if ( empty($message) && isset($_GET['import-message']) ) {
322
-            $message = __( 'Your import is complete', 'formidable' );
323
-        }
324
-
325
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/list.php');
326
-    }
327
-
328
-    /* Back End CRUD */
313
+			if ( headers_sent() ) {
314
+				echo FrmAppHelper::js_redirect($url);
315
+			} else {
316
+				wp_redirect( esc_url_raw( $url ) );
317
+			}
318
+			die();
319
+		}
320
+
321
+		if ( empty($message) && isset($_GET['import-message']) ) {
322
+			$message = __( 'Your import is complete', 'formidable' );
323
+		}
324
+
325
+		require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/list.php');
326
+	}
327
+
328
+	/* Back End CRUD */
329 329
 	public static function show( $id = 0 ) {
330
-        FrmAppHelper::permission_check('frm_view_entries');
330
+		FrmAppHelper::permission_check('frm_view_entries');
331 331
 
332
-        if ( ! $id ) {
332
+		if ( ! $id ) {
333 333
 			$id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
334 334
 
335
-            if ( ! $id ) {
335
+			if ( ! $id ) {
336 336
 				$id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' );
337
-            }
338
-        }
337
+			}
338
+		}
339 339
 
340
-        $entry = FrmEntry::getOne($id, true);
340
+		$entry = FrmEntry::getOne($id, true);
341 341
 
342
-        $data = maybe_unserialize($entry->description);
342
+		$data = maybe_unserialize($entry->description);
343 343
 		if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) {
344 344
 			$data = array( 'referrer' => $data );
345 345
 		}
346 346
 
347 347
 		$fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' );
348
-        $to_emails = array();
348
+		$to_emails = array();
349 349
 
350
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/show.php');
351
-    }
350
+		include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/show.php');
351
+	}
352 352
 
353
-    public static function destroy() {
354
-        FrmAppHelper::permission_check('frm_delete_entries');
353
+	public static function destroy() {
354
+		FrmAppHelper::permission_check('frm_delete_entries');
355 355
 
356 356
 		$params = FrmForm::get_admin_params();
357 357
 
358
-        if ( isset($params['keep_post']) && $params['keep_post'] ) {
359
-            //unlink entry from post
360
-            global $wpdb;
358
+		if ( isset($params['keep_post']) && $params['keep_post'] ) {
359
+			//unlink entry from post
360
+			global $wpdb;
361 361
 			$wpdb->update( $wpdb->prefix .'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) );
362
-        }
362
+		}
363 363
 
364
-        $message = '';
365
-        if ( FrmEntry::destroy( $params['id'] ) ) {
366
-            $message = __( 'Entry was Successfully Destroyed', 'formidable' );
367
-        }
364
+		$message = '';
365
+		if ( FrmEntry::destroy( $params['id'] ) ) {
366
+			$message = __( 'Entry was Successfully Destroyed', 'formidable' );
367
+		}
368 368
 
369
-        self::display_list( $message );
370
-    }
369
+		self::display_list( $message );
370
+	}
371 371
 
372
-    public static function destroy_all() {
373
-        if ( ! current_user_can( 'frm_delete_entries' ) ) {
374
-            $frm_settings = FrmAppHelper::get_settings();
375
-            wp_die( $frm_settings->admin_permission );
376
-        }
372
+	public static function destroy_all() {
373
+		if ( ! current_user_can( 'frm_delete_entries' ) ) {
374
+			$frm_settings = FrmAppHelper::get_settings();
375
+			wp_die( $frm_settings->admin_permission );
376
+		}
377 377
 
378
-        global $wpdb;
378
+		global $wpdb;
379 379
 		$params = FrmForm::get_admin_params();
380
-        $message = '';
381
-        $errors = array();
382
-        $form_id = (int) $params['form'];
380
+		$message = '';
381
+		$errors = array();
382
+		$form_id = (int) $params['form'];
383 383
 
384
-        if ( $form_id ) {
385
-            $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
384
+		if ( $form_id ) {
385
+			$entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
386 386
 			$action = FrmFormAction::get_action_for_form( $form_id, 'wppost', 1 );
387 387
 
388
-            if ( $action ) {
389
-                // this action takes a while, so only trigger it if there are posts to delete
390
-                foreach ( $entry_ids as $entry_id ) {
391
-                    do_action( 'frm_before_destroy_entry', $entry_id );
392
-                    unset( $entry_id );
393
-                }
394
-            }
395
-
396
-            $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) );
397
-            $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) );
398
-            if ( $results ) {
399
-                $message = __( 'Entries were Successfully Destroyed', 'formidable' );
400
-            }
401
-        } else {
402
-            $errors = __( 'No entries were specified', 'formidable' );
403
-        }
404
-
405
-        self::display_list( $message, $errors );
406
-    }
407
-
408
-    public static function show_form( $id = '', $key = '', $title = false, $description = false ) {
409
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' );
410
-        return FrmFormsController::show_form( $id, $key, $title, $description );
411
-    }
412
-
413
-    public static function get_form( $filename, $form, $title, $description ) {
414
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' );
415
-        return FrmFormsController::get_form( $form, $title, $description );
416
-    }
417
-
418
-    public static function process_entry( $errors = '', $ajax = false ) {
388
+			if ( $action ) {
389
+				// this action takes a while, so only trigger it if there are posts to delete
390
+				foreach ( $entry_ids as $entry_id ) {
391
+					do_action( 'frm_before_destroy_entry', $entry_id );
392
+					unset( $entry_id );
393
+				}
394
+			}
395
+
396
+			$wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) );
397
+			$results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) );
398
+			if ( $results ) {
399
+				$message = __( 'Entries were Successfully Destroyed', 'formidable' );
400
+			}
401
+		} else {
402
+			$errors = __( 'No entries were specified', 'formidable' );
403
+		}
404
+
405
+		self::display_list( $message, $errors );
406
+	}
407
+
408
+	public static function show_form( $id = '', $key = '', $title = false, $description = false ) {
409
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' );
410
+		return FrmFormsController::show_form( $id, $key, $title, $description );
411
+	}
412
+
413
+	public static function get_form( $filename, $form, $title, $description ) {
414
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' );
415
+		return FrmFormsController::get_form( $form, $title, $description );
416
+	}
417
+
418
+	public static function process_entry( $errors = '', $ajax = false ) {
419 419
 		$form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
420 420
 		if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) {
421
-            return;
422
-        }
421
+			return;
422
+		}
423 423
 
424
-        global $frm_vars;
424
+		global $frm_vars;
425 425
 
426 426
 		$form = FrmForm::getOne( $form_id );
427
-        if ( ! $form ) {
428
-            return;
429
-        }
427
+		if ( ! $form ) {
428
+			return;
429
+		}
430 430
 
431 431
 		$params = FrmForm::get_params( $form );
432 432
 
433
-        if ( ! isset( $frm_vars['form_params'] ) ) {
434
-            $frm_vars['form_params'] = array();
435
-        }
433
+		if ( ! isset( $frm_vars['form_params'] ) ) {
434
+			$frm_vars['form_params'] = array();
435
+		}
436 436
 		$frm_vars['form_params'][ $form->id ] = $params;
437 437
 
438 438
 		if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
439
-            return;
440
-        }
439
+			return;
440
+		}
441 441
 
442
-        if ( $errors == '' ) {
442
+		if ( $errors == '' ) {
443 443
 			$errors = FrmEntryValidate::validate( $_POST );
444
-        }
444
+		}
445 445
 
446 446
 		/**
447 447
 		 * Use this filter to add trigger actions and add errors after
@@ -452,102 +452,102 @@  discard block
 block discarded – undo
452 452
 
453 453
 		$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
454 454
 
455
-        if ( empty( $errors ) ) {
455
+		if ( empty( $errors ) ) {
456 456
 			$_POST['frm_skip_cookie'] = 1;
457
-            if ( $params['action'] == 'create' ) {
457
+			if ( $params['action'] == 'create' ) {
458 458
 				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
459 459
 					$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
460
-                }
461
-            }
460
+				}
461
+			}
462 462
 
463
-            do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
463
+			do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
464 464
 			unset( $_POST['frm_skip_cookie'] );
465
-        }
466
-    }
467
-
468
-    public static function delete_entry_before_redirect( $url, $form, $atts ) {
469
-        self::_delete_entry( $atts['id'], $form );
470
-        return $url;
471
-    }
472
-
473
-    //Delete entry if not redirected
474
-    public static function delete_entry_after_save( $atts ) {
475
-        self::_delete_entry( $atts['entry_id'], $atts['form'] );
476
-    }
477
-
478
-    private static function _delete_entry( $entry_id, $form ) {
479
-        if ( ! $form ) {
480
-            return;
481
-        }
482
-
483
-        $form->options = maybe_unserialize( $form->options );
484
-        if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
485
-            FrmEntry::destroy( $entry_id );
486
-        }
487
-    }
465
+		}
466
+	}
467
+
468
+	public static function delete_entry_before_redirect( $url, $form, $atts ) {
469
+		self::_delete_entry( $atts['id'], $form );
470
+		return $url;
471
+	}
472
+
473
+	//Delete entry if not redirected
474
+	public static function delete_entry_after_save( $atts ) {
475
+		self::_delete_entry( $atts['entry_id'], $atts['form'] );
476
+	}
477
+
478
+	private static function _delete_entry( $entry_id, $form ) {
479
+		if ( ! $form ) {
480
+			return;
481
+		}
482
+
483
+		$form->options = maybe_unserialize( $form->options );
484
+		if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
485
+			FrmEntry::destroy( $entry_id );
486
+		}
487
+	}
488 488
 
489 489
 	public static function show_entry_shortcode( $atts ) {
490 490
 		return FrmEntryFormat::show_entry( $atts );
491 491
 	}
492 492
 
493
-    public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) {
494
-        $field = FrmField::getOne($meta->field_id);
495
-        if ( ! $field ) {
496
-            return $value;
497
-        }
493
+	public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) {
494
+		$field = FrmField::getOne($meta->field_id);
495
+		if ( ! $field ) {
496
+			return $value;
497
+		}
498 498
 
499
-        $value = self::filter_display_value($value, $field, $atts);
500
-        return $value;
501
-    }
499
+		$value = self::filter_display_value($value, $field, $atts);
500
+		return $value;
501
+	}
502 502
 
503 503
 	public static function &filter_shortcode_value( $value, $tag, $atts, $field ) {
504
-        $plain_text = add_filter('frm_plain_text_email', true);
504
+		$plain_text = add_filter('frm_plain_text_email', true);
505 505
 		FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value );
506 506
 
507
-        if ( isset($atts['show']) && $atts['show'] == 'value' ) {
508
-            return $value;
509
-        }
507
+		if ( isset($atts['show']) && $atts['show'] == 'value' ) {
508
+			return $value;
509
+		}
510 510
 
511
-        return self::filter_display_value($value, $field, $atts);
512
-    }
511
+		return self::filter_display_value($value, $field, $atts);
512
+	}
513 513
 
514
-    public static function &filter_display_value( $value, $field, $atts = array() ) {
515
-        $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false;
514
+	public static function &filter_display_value( $value, $field, $atts = array() ) {
515
+		$saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false;
516 516
 		if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'radio', 'select' ) ) || ! FrmField::is_option_true( $field, 'separate_value' ) || $saved_value ) {
517
-            return $value;
518
-        }
519
-
520
-        $f_values = $f_labels = array();
521
-
522
-        foreach ( $field->options as $opt_key => $opt ) {
523
-            if ( ! is_array($opt) ) {
524
-                continue;
525
-            }
526
-
527
-            $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt);
528
-            $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ];
529
-            if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) {
530
-                unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] );
531
-            }
532
-            unset($opt_key, $opt);
533
-        }
534
-
535
-        if ( ! empty($f_values) ) {
536
-            foreach ( (array) $value as $v_key => $val ) {
537
-                if ( in_array($val, $f_values) ) {
538
-                    $opt = array_search($val, $f_values);
539
-                    if ( is_array($value) ) {
540
-                        $value[ $v_key ] = $f_labels[ $opt ];
541
-                    } else {
542
-                        $value = $f_labels[ $opt ];
543
-                    }
544
-                }
545
-                unset($v_key, $val);
546
-            }
547
-        }
548
-
549
-        return $value;
550
-    }
517
+			return $value;
518
+		}
519
+
520
+		$f_values = $f_labels = array();
521
+
522
+		foreach ( $field->options as $opt_key => $opt ) {
523
+			if ( ! is_array($opt) ) {
524
+				continue;
525
+			}
526
+
527
+			$f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt);
528
+			$f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ];
529
+			if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) {
530
+				unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] );
531
+			}
532
+			unset($opt_key, $opt);
533
+		}
534
+
535
+		if ( ! empty($f_values) ) {
536
+			foreach ( (array) $value as $v_key => $val ) {
537
+				if ( in_array($val, $f_values) ) {
538
+					$opt = array_search($val, $f_values);
539
+					if ( is_array($value) ) {
540
+						$value[ $v_key ] = $f_labels[ $opt ];
541
+					} else {
542
+						$value = $f_labels[ $opt ];
543
+					}
544
+				}
545
+				unset($v_key, $val);
546
+			}
547
+		}
548
+
549
+		return $value;
550
+	}
551 551
 
552 552
 	public static function get_params( $form = null ) {
553 553
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_params' );
@@ -555,13 +555,13 @@  discard block
 block discarded – undo
555 555
 	}
556 556
 
557 557
 	public static function entry_sidebar( $entry ) {
558
-        $data = maybe_unserialize($entry->description);
559
-        $date_format = get_option('date_format');
560
-        $time_format = get_option('time_format');
558
+		$data = maybe_unserialize($entry->description);
559
+		$date_format = get_option('date_format');
560
+		$time_format = get_option('time_format');
561 561
 		if ( isset( $data['browser'] ) ) {
562 562
 			$browser = FrmEntryFormat::get_browser( $data['browser'] );
563 563
 		}
564 564
 
565
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/sidebar-shared.php');
566
-    }
565
+		include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/sidebar-shared.php');
566
+	}
567 567
 }
Please login to merge, or discard this patch.
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
     public static function menu() {
6 6
 		FrmAppHelper::force_capability( 'frm_view_entries' );
7 7
 
8
-        add_submenu_page('formidable', 'Formidable | '. __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
8
+        add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
9 9
 
10 10
 		if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) {
11 11
 			$menu_name = FrmAppHelper::get_menu_name();
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
         $screen->add_help_tab( array(
53 53
             'id'      => 'formidable-entries-tab',
54 54
             'title'   => __( 'Overview', 'formidable' ),
55
-			'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) .'</p> <p>'. esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
56
-        ));
55
+			'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
56
+        ) );
57 57
 
58 58
         $screen->set_help_sidebar(
59 59
 			'<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
60 60
 			'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' .
61
-			'<p><a href="'. esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>'
61
+			'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>'
62 62
     	);
63 63
 
64 64
         return $help;
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
         global $frm_vars, $wpdb;
69 69
 		$form_id = FrmForm::get_current_form_id();
70 70
 
71
-        $columns[ $form_id .'_id' ] = 'ID';
72
-		$columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
71
+        $columns[$form_id . '_id'] = 'ID';
72
+		$columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' );
73 73
 
74 74
         if ( ! $form_id ) {
75 75
             return $columns;
76 76
         }
77 77
 
78
-        $form_cols = FrmField::get_all_for_form($form_id, '', 'include');
78
+        $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' );
79 79
 
80 80
         foreach ( $form_cols as $form_col ) {
81 81
 			if ( FrmField::is_no_save_field( $form_col->type ) ) {
@@ -88,30 +88,30 @@  discard block
 block discarded – undo
88 88
                 if ( $sub_form_cols ) {
89 89
                     foreach ( $sub_form_cols as $k => $sub_form_col ) {
90 90
 						if ( FrmField::is_no_save_field( $sub_form_col->type ) ) {
91
-                            unset( $sub_form_cols[ $k ] );
91
+                            unset( $sub_form_cols[$k] );
92 92
                             continue;
93 93
                         }
94
-						$columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
95
-                        unset($sub_form_col);
94
+						$columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
95
+                        unset( $sub_form_col );
96 96
                     }
97 97
                 }
98
-                unset($sub_form_cols);
98
+                unset( $sub_form_cols );
99 99
             } else {
100 100
                 $col_id = $form_col->field_key;
101 101
                 if ( $form_col->form_id != $form_id ) {
102
-                    $col_id .= '-_-form'. $form_col->form_id;
102
+                    $col_id .= '-_-form' . $form_col->form_id;
103 103
                 }
104 104
 
105
-                if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) {
106
-                    $columns[ $form_id .'_frmsep_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
105
+                if ( isset( $form_col->field_options['separate_value'] ) && $form_col->field_options['separate_value'] ) {
106
+                    $columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 );
107 107
                 }
108
-                $columns[ $form_id .'_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
108
+                $columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 );
109 109
             }
110 110
         }
111 111
 
112
-        $columns[ $form_id .'_created_at' ] = __( 'Entry creation date', 'formidable' );
113
-        $columns[ $form_id .'_updated_at' ] = __( 'Entry update date', 'formidable' );
114
-        $columns[ $form_id .'_ip' ] = 'IP';
112
+        $columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' );
113
+        $columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' );
114
+        $columns[$form_id . '_ip'] = 'IP';
115 115
 
116 116
         $frm_vars['cols'] = $columns;
117 117
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
 	public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
127 127
 		$menu_name = FrmAppHelper::get_menu_name();
128
-		$this_page_name = 'manage' .  sanitize_title( $menu_name ) . '_page_formidable-entriescolumnshidden';
128
+		$this_page_name = 'manage' . sanitize_title( $menu_name ) . '_page_formidable-entriescolumnshidden';
129 129
 		if ( $meta_key != $this_page_name || $meta_value == $prev_value ) {
130 130
             return $check;
131 131
         }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
         global $frm_vars;
138 138
         //add a check so we don't create a loop
139
-        $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
139
+        $frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
140 140
 
141 141
         return $check;
142 142
     }
@@ -145,25 +145,25 @@  discard block
 block discarded – undo
145 145
 	public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) {
146 146
 		$menu_name = FrmAppHelper::get_menu_name();
147 147
 		$sanitized = sanitize_title( $menu_name );
148
-		$this_page_name = 'manage'.  $sanitized .'_page_formidable-entriescolumnshidden';
148
+		$this_page_name = 'manage' . $sanitized . '_page_formidable-entriescolumnshidden';
149 149
 		if ( $meta_key != $this_page_name ) {
150 150
             return;
151 151
         }
152 152
 
153 153
         global $frm_vars;
154
-        if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) {
154
+        if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) {
155 155
             return; //don't continue if there's no previous value
156 156
         }
157 157
 
158 158
         foreach ( $meta_value as $mk => $mv ) {
159 159
             //remove blank values
160
-            if ( empty( $mv )  ) {
161
-                unset( $meta_value[ $mk ] );
160
+            if ( empty( $mv ) ) {
161
+                unset( $meta_value[$mk] );
162 162
             }
163 163
         }
164 164
 
165
-        $cur_form_prefix = reset($meta_value);
166
-        $cur_form_prefix = explode('_', $cur_form_prefix);
165
+        $cur_form_prefix = reset( $meta_value );
166
+        $cur_form_prefix = explode( '_', $cur_form_prefix );
167 167
         $cur_form_prefix = $cur_form_prefix[0];
168 168
         $save = false;
169 169
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
             $meta_value[] = $prev_hidden;
184 184
             $save = true;
185
-            unset($form_prefix);
185
+            unset( $form_prefix );
186 186
         }
187 187
 
188 188
 		if ( $save ) {
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		foreach ( $fields as $field ) {
215 215
 			if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) {
216 216
 				// Can't sort on checkboxes because they are stored serialized, or post fields
217
-				$columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id;
217
+				$columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id;
218 218
 			}
219 219
 		}
220 220
 
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
                     break;
238 238
                 }
239 239
 
240
-                unset($form_prefix);
240
+                unset( $form_prefix );
241 241
             }
242 242
         }
243 243
 
@@ -245,36 +245,36 @@  discard block
 block discarded – undo
245 245
 			return $result;
246 246
 		}
247 247
 
248
-        $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0;
248
+        $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0;
249 249
         $max_columns = 8;
250 250
         if ( $i <= $max_columns ) {
251 251
 			return $result;
252 252
 		}
253 253
 
254 254
         global $frm_vars;
255
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) {
256
-            $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options);
255
+        if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] ) {
256
+            $frm_vars['current_form']->options = maybe_unserialize( $frm_vars['current_form']->options );
257 257
         }
258 258
 
259
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) {
259
+        if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] && isset( $frm_vars['current_form']->options['hidden_cols'] ) && ! empty( $frm_vars['current_form']->options['hidden_cols'] ) ) {
260 260
             $result = $frm_vars['current_form']->options['hidden_cols'];
261 261
         } else {
262 262
             $cols = $frm_vars['cols'];
263
-            $cols = array_reverse($cols, true);
263
+            $cols = array_reverse( $cols, true );
264 264
 
265
-            $result[] = $form_id .'_id';
266
-            $i--;
265
+            $result[] = $form_id . '_id';
266
+            $i --;
267 267
 
268
-            $result[] = $form_id .'_item_key';
269
-            $i--;
268
+            $result[] = $form_id . '_item_key';
269
+            $i --;
270 270
 
271 271
 			foreach ( $cols as $col_key => $col ) {
272 272
                 if ( $i > $max_columns ) {
273 273
 					$result[] = $col_key;
274 274
 				}
275 275
                 //remove some columns by default
276
-                $i--;
277
-                unset($col_key, $col);
276
+                $i --;
277
+                unset( $col_key, $col );
278 278
             }
279 279
         }
280 280
 
@@ -311,23 +311,23 @@  discard block
 block discarded – undo
311 311
         if ( $pagenum > $total_pages && $total_pages > 0 ) {
312 312
 			$url = add_query_arg( 'paged', $total_pages );
313 313
             if ( headers_sent() ) {
314
-                echo FrmAppHelper::js_redirect($url);
314
+                echo FrmAppHelper::js_redirect( $url );
315 315
             } else {
316 316
                 wp_redirect( esc_url_raw( $url ) );
317 317
             }
318 318
             die();
319 319
         }
320 320
 
321
-        if ( empty($message) && isset($_GET['import-message']) ) {
321
+        if ( empty( $message ) && isset( $_GET['import-message'] ) ) {
322 322
             $message = __( 'Your import is complete', 'formidable' );
323 323
         }
324 324
 
325
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/list.php');
325
+        require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' );
326 326
     }
327 327
 
328 328
     /* Back End CRUD */
329 329
 	public static function show( $id = 0 ) {
330
-        FrmAppHelper::permission_check('frm_view_entries');
330
+        FrmAppHelper::permission_check( 'frm_view_entries' );
331 331
 
332 332
         if ( ! $id ) {
333 333
 			$id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
@@ -337,9 +337,9 @@  discard block
 block discarded – undo
337 337
             }
338 338
         }
339 339
 
340
-        $entry = FrmEntry::getOne($id, true);
340
+        $entry = FrmEntry::getOne( $id, true );
341 341
 
342
-        $data = maybe_unserialize($entry->description);
342
+        $data = maybe_unserialize( $entry->description );
343 343
 		if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) {
344 344
 			$data = array( 'referrer' => $data );
345 345
 		}
@@ -347,18 +347,18 @@  discard block
 block discarded – undo
347 347
 		$fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' );
348 348
         $to_emails = array();
349 349
 
350
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/show.php');
350
+        include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' );
351 351
     }
352 352
 
353 353
     public static function destroy() {
354
-        FrmAppHelper::permission_check('frm_delete_entries');
354
+        FrmAppHelper::permission_check( 'frm_delete_entries' );
355 355
 
356 356
 		$params = FrmForm::get_admin_params();
357 357
 
358
-        if ( isset($params['keep_post']) && $params['keep_post'] ) {
358
+        if ( isset( $params['keep_post'] ) && $params['keep_post'] ) {
359 359
             //unlink entry from post
360 360
             global $wpdb;
361
-			$wpdb->update( $wpdb->prefix .'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) );
361
+			$wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) );
362 362
         }
363 363
 
364 364
         $message = '';
@@ -433,9 +433,9 @@  discard block
 block discarded – undo
433 433
         if ( ! isset( $frm_vars['form_params'] ) ) {
434 434
             $frm_vars['form_params'] = array();
435 435
         }
436
-		$frm_vars['form_params'][ $form->id ] = $params;
436
+		$frm_vars['form_params'][$form->id] = $params;
437 437
 
438
-		if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
438
+		if ( isset( $frm_vars['created_entries'][$form_id] ) ) {
439 439
             return;
440 440
         }
441 441
 
@@ -450,13 +450,13 @@  discard block
 block discarded – undo
450 450
 		 */
451 451
 		$errors = apply_filters( 'frm_entries_before_create', $errors, $form );
452 452
 
453
-		$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
453
+		$frm_vars['created_entries'][$form_id] = array( 'errors' => $errors );
454 454
 
455 455
         if ( empty( $errors ) ) {
456 456
 			$_POST['frm_skip_cookie'] = 1;
457 457
             if ( $params['action'] == 'create' ) {
458
-				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
459
-					$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
458
+				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) {
459
+					$frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST );
460 460
                 }
461 461
             }
462 462
 
@@ -491,28 +491,28 @@  discard block
 block discarded – undo
491 491
 	}
492 492
 
493 493
     public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) {
494
-        $field = FrmField::getOne($meta->field_id);
494
+        $field = FrmField::getOne( $meta->field_id );
495 495
         if ( ! $field ) {
496 496
             return $value;
497 497
         }
498 498
 
499
-        $value = self::filter_display_value($value, $field, $atts);
499
+        $value = self::filter_display_value( $value, $field, $atts );
500 500
         return $value;
501 501
     }
502 502
 
503 503
 	public static function &filter_shortcode_value( $value, $tag, $atts, $field ) {
504
-        $plain_text = add_filter('frm_plain_text_email', true);
504
+        $plain_text = add_filter( 'frm_plain_text_email', true );
505 505
 		FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value );
506 506
 
507
-        if ( isset($atts['show']) && $atts['show'] == 'value' ) {
507
+        if ( isset( $atts['show'] ) && $atts['show'] == 'value' ) {
508 508
             return $value;
509 509
         }
510 510
 
511
-        return self::filter_display_value($value, $field, $atts);
511
+        return self::filter_display_value( $value, $field, $atts );
512 512
     }
513 513
 
514 514
     public static function &filter_display_value( $value, $field, $atts = array() ) {
515
-        $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false;
515
+        $saved_value = ( isset( $atts['saved_value'] ) && $atts['saved_value'] ) ? true : false;
516 516
 		if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'radio', 'select' ) ) || ! FrmField::is_option_true( $field, 'separate_value' ) || $saved_value ) {
517 517
             return $value;
518 518
         }
@@ -520,29 +520,29 @@  discard block
 block discarded – undo
520 520
         $f_values = $f_labels = array();
521 521
 
522 522
         foreach ( $field->options as $opt_key => $opt ) {
523
-            if ( ! is_array($opt) ) {
523
+            if ( ! is_array( $opt ) ) {
524 524
                 continue;
525 525
             }
526 526
 
527
-            $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt);
528
-            $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ];
529
-            if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) {
530
-                unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] );
527
+            $f_labels[$opt_key] = isset( $opt['label'] ) ? $opt['label'] : reset( $opt );
528
+            $f_values[$opt_key] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[$opt_key];
529
+            if ( $f_labels[$opt_key] == $f_values[$opt_key] ) {
530
+                unset( $f_values[$opt_key], $f_labels[$opt_key] );
531 531
             }
532
-            unset($opt_key, $opt);
532
+            unset( $opt_key, $opt );
533 533
         }
534 534
 
535
-        if ( ! empty($f_values) ) {
535
+        if ( ! empty( $f_values ) ) {
536 536
             foreach ( (array) $value as $v_key => $val ) {
537
-                if ( in_array($val, $f_values) ) {
538
-                    $opt = array_search($val, $f_values);
539
-                    if ( is_array($value) ) {
540
-                        $value[ $v_key ] = $f_labels[ $opt ];
537
+                if ( in_array( $val, $f_values ) ) {
538
+                    $opt = array_search( $val, $f_values );
539
+                    if ( is_array( $value ) ) {
540
+                        $value[$v_key] = $f_labels[$opt];
541 541
                     } else {
542
-                        $value = $f_labels[ $opt ];
542
+                        $value = $f_labels[$opt];
543 543
                     }
544 544
                 }
545
-                unset($v_key, $val);
545
+                unset( $v_key, $val );
546 546
             }
547 547
         }
548 548
 
@@ -555,13 +555,13 @@  discard block
 block discarded – undo
555 555
 	}
556 556
 
557 557
 	public static function entry_sidebar( $entry ) {
558
-        $data = maybe_unserialize($entry->description);
559
-        $date_format = get_option('date_format');
560
-        $time_format = get_option('time_format');
558
+        $data = maybe_unserialize( $entry->description );
559
+        $date_format = get_option( 'date_format' );
560
+        $time_format = get_option( 'time_format' );
561 561
 		if ( isset( $data['browser'] ) ) {
562 562
 			$browser = FrmEntryFormat::get_browser( $data['browser'] );
563 563
 		}
564 564
 
565
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/sidebar-shared.php');
565
+        include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' );
566 566
     }
567 567
 }
Please login to merge, or discard this patch.
classes/controllers/FrmFormsController.php 1 patch
Spacing   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 		if ( ! FrmAppHelper::pro_is_installed() ) {
8 8
 			$menu_label .= ' (Lite)';
9 9
 		}
10
-		add_submenu_page('formidable', 'Formidable | '. $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' );
10
+		add_submenu_page( 'formidable', 'Formidable | ' . $menu_label, $menu_label, 'frm_view_forms', 'formidable', 'FrmFormsController::route' );
11 11
 
12 12
 		self::maybe_load_listing_hooks();
13 13
     }
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 			return;
19 19
 		}
20 20
 
21
-		add_filter('get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' );
21
+		add_filter( 'get_user_option_managetoplevel_page_formidablecolumnshidden', 'FrmFormsController::hidden_columns' );
22 22
 
23
-		add_filter('manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 );
24
-		add_filter('manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' );
23
+		add_filter( 'manage_toplevel_page_formidable_columns', 'FrmFormsController::get_columns', 0 );
24
+		add_filter( 'manage_toplevel_page_formidable_sortable_columns', 'FrmFormsController::get_sortable_columns' );
25 25
 	}
26 26
 
27 27
     public static function head() {
28
-        wp_enqueue_script('formidable-editinplace');
28
+        wp_enqueue_script( 'formidable-editinplace' );
29 29
 
30 30
         if ( wp_is_mobile() ) {
31 31
     		wp_enqueue_script( 'jquery-touch-punch' );
@@ -33,49 +33,49 @@  discard block
 block discarded – undo
33 33
     }
34 34
 
35 35
     public static function register_widgets() {
36
-        require_once(FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php');
37
-        register_widget('FrmShowForm');
36
+        require_once( FrmAppHelper::plugin_path() . '/classes/widgets/FrmShowForm.php' );
37
+        register_widget( 'FrmShowForm' );
38 38
     }
39 39
 
40 40
     public static function list_form() {
41
-        FrmAppHelper::permission_check('frm_view_forms');
41
+        FrmAppHelper::permission_check( 'frm_view_forms' );
42 42
 
43 43
 		$params = FrmForm::list_page_params();
44
-        $errors = self::process_bulk_form_actions( array());
45
-        $errors = apply_filters('frm_admin_list_form_action', $errors);
44
+        $errors = self::process_bulk_form_actions( array() );
45
+        $errors = apply_filters( 'frm_admin_list_form_action', $errors );
46 46
 
47 47
 		return self::display_forms_list( $params, '', $errors );
48 48
     }
49 49
 
50 50
 	public static function new_form( $values = array() ) {
51
-        FrmAppHelper::permission_check('frm_edit_forms');
51
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
52 52
 
53 53
         global $frm_vars;
54 54
 
55
-        $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
56
-		$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ];
55
+        $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
56
+		$action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[$action];
57 57
 
58 58
 		if ( $action == 'create' ) {
59
-            return self::create($values);
59
+            return self::create( $values );
60 60
 		} else if ( $action == 'new' ) {
61 61
 			$frm_field_selection = FrmField::field_selection();
62
-            $values = FrmFormsHelper::setup_new_vars($values);
62
+            $values = FrmFormsHelper::setup_new_vars( $values );
63 63
             $id = FrmForm::create( $values );
64
-            $form = FrmForm::getOne($id);
64
+            $form = FrmForm::getOne( $id );
65 65
 
66 66
             // add default email notification
67 67
             $action_control = FrmFormActionsController::get_form_actions( 'email' );
68
-            $action_control->create($form->id);
68
+            $action_control->create( $form->id );
69 69
 
70 70
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
71 71
 
72 72
             $values['id'] = $id;
73
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
73
+            require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
74 74
         }
75 75
     }
76 76
 
77 77
 	public static function create( $values = array() ) {
78
-        FrmAppHelper::permission_check('frm_edit_forms');
78
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
79 79
 
80 80
         global $frm_vars;
81 81
         if ( empty( $values ) ) {
@@ -87,58 +87,58 @@  discard block
 block discarded – undo
87 87
             $values = FrmProEntry::mod_other_vals( $values, 'back' );
88 88
         }
89 89
 
90
-		$id = isset($values['id']) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
90
+		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
91 91
 
92 92
         if ( ! current_user_can( 'frm_edit_forms' ) || ( $_POST && ( ! isset( $values['frm_save_form'] ) || ! wp_verify_nonce( $values['frm_save_form'], 'frm_save_form_nonce' ) ) ) ) {
93 93
             $frm_settings = FrmAppHelper::get_settings();
94 94
             $errors = array( 'form' => $frm_settings->admin_permission );
95 95
         } else {
96
-            $errors = FrmForm::validate($values);
96
+            $errors = FrmForm::validate( $values );
97 97
         }
98 98
 
99
-        if ( count($errors) > 0 ) {
99
+        if ( count( $errors ) > 0 ) {
100 100
             $hide_preview = true;
101 101
 			$frm_field_selection = FrmField::field_selection();
102 102
             $form = FrmForm::getOne( $id );
103
-            $fields = FrmField::get_all_for_form($id);
103
+            $fields = FrmField::get_all_for_form( $id );
104 104
 
105
-            $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
105
+            $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true );
106 106
 			$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
107 107
 
108
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
108
+            require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
109 109
         } else {
110 110
             FrmForm::update( $id, $values, true );
111
-            die(FrmAppHelper::js_redirect(admin_url('admin.php?page=formidable&frm_action=settings&id='. $id)));
111
+            die( FrmAppHelper::js_redirect( admin_url( 'admin.php?page=formidable&frm_action=settings&id=' . $id ) ) );
112 112
         }
113 113
     }
114 114
 
115 115
     public static function edit( $values = false ) {
116
-        FrmAppHelper::permission_check('frm_edit_forms');
116
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
117 117
 
118 118
 		$id = isset( $values['id'] ) ? absint( $values['id'] ) : FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
119
-        return self::get_edit_vars($id);
119
+        return self::get_edit_vars( $id );
120 120
     }
121 121
 
122 122
     public static function settings( $id = false, $message = '' ) {
123
-        FrmAppHelper::permission_check('frm_edit_forms');
123
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
124 124
 
125
-        if ( ! $id || ! is_numeric($id) ) {
125
+        if ( ! $id || ! is_numeric( $id ) ) {
126 126
 			$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
127 127
         }
128 128
 		return self::get_settings_vars( $id, array(), $message );
129 129
     }
130 130
 
131 131
     public static function update_settings() {
132
-        FrmAppHelper::permission_check('frm_edit_forms');
132
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
133 133
 
134 134
 		$id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' );
135 135
 
136
-        $errors = FrmForm::validate($_POST);
137
-        if ( count($errors) > 0 ) {
138
-            return self::get_settings_vars($id, $errors);
136
+        $errors = FrmForm::validate( $_POST );
137
+        if ( count( $errors ) > 0 ) {
138
+            return self::get_settings_vars( $id, $errors );
139 139
         }
140 140
 
141
-        do_action('frm_before_update_form_settings', $id);
141
+        do_action( 'frm_before_update_form_settings', $id );
142 142
 
143 143
 		FrmForm::update( $id, $_POST );
144 144
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
 	private static function edit_in_place_value( $field ) {
162 162
 		check_ajax_referer( 'frm_ajax', 'nonce' );
163
-		FrmAppHelper::permission_check('frm_edit_forms', 'hide');
163
+		FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' );
164 164
 
165 165
 		$form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
166 166
 		$value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_filter_post_kses' );
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 * @since 2.0
219 219
 	 */
220 220
 	public static function _create_from_template() {
221
-		FrmAppHelper::permission_check('frm_edit_forms');
221
+		FrmAppHelper::permission_check( 'frm_edit_forms' );
222 222
 		check_ajax_referer( 'frm_ajax', 'nonce' );
223 223
 
224 224
 		$current_form = FrmAppHelper::get_param( 'this_form', '', 'get', 'absint' );
@@ -233,15 +233,15 @@  discard block
 block discarded – undo
233 233
 	}
234 234
 
235 235
     public static function duplicate() {
236
-        FrmAppHelper::permission_check('frm_edit_forms');
236
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
237 237
 
238 238
 		$params = FrmForm::list_page_params();
239 239
         $form = FrmForm::duplicate( $params['id'], $params['template'], true );
240
-        $message = ($params['template']) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
240
+        $message = ( $params['template'] ) ? __( 'Form template was Successfully Created', 'formidable' ) : __( 'Form was Successfully Copied', 'formidable' );
241 241
         if ( $form ) {
242 242
 			return self::get_edit_vars( $form, array(), $message, true );
243 243
         } else {
244
-            return self::display_forms_list($params, __( 'There was a problem creating the new template.', 'formidable' ));
244
+            return self::display_forms_list( $params, __( 'There was a problem creating the new template.', 'formidable' ) );
245 245
         }
246 246
     }
247 247
 
@@ -267,14 +267,14 @@  discard block
 block discarded – undo
267 267
         if ( ! defined( 'ABSPATH' ) && ! defined( 'XMLRPC_REQUEST' ) ) {
268 268
             global $wp;
269 269
             $root = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
270
-            include_once( $root.'/wp-config.php' );
270
+            include_once( $root . '/wp-config.php' );
271 271
             $wp->init();
272 272
             $wp->register_globals();
273 273
         }
274 274
 
275 275
 		self::register_pro_scripts();
276 276
 
277
-		header( 'Content-Type: text/html; charset='. get_option( 'blog_charset' ) );
277
+		header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
278 278
 
279 279
 		$key = FrmAppHelper::simple_get( 'form', 'sanitize_title' );
280 280
 		if ( $key == '' ) {
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 			$form = FrmForm::getAll( array(), '', 1 );
287 287
         }
288 288
 
289
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/direct.php');
289
+        require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/direct.php' );
290 290
         wp_die();
291 291
     }
292 292
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 		if ( FrmAppHelper::pro_is_installed() ) {
295 295
 			wp_register_script( 'jquery-frm-rating', FrmAppHelper::plugin_url() . '/pro/js/jquery.rating.min.js', array( 'jquery' ), '4.11', true );
296 296
 			wp_register_script( 'jquery-maskedinput', FrmAppHelper::plugin_url() . '/pro/js/jquery.maskedinput.min.js', array( 'jquery' ), '1.4', true );
297
-			wp_register_script( 'jquery-chosen', FrmAppHelper::plugin_url() .'/pro/js/chosen.jquery.min.js', array( 'jquery' ), '1.2.0', true );
297
+			wp_register_script( 'jquery-chosen', FrmAppHelper::plugin_url() . '/pro/js/chosen.jquery.min.js', array( 'jquery' ), '1.2.0', true );
298 298
 		}
299 299
 	}
300 300
 
@@ -303,11 +303,11 @@  discard block
 block discarded – undo
303 303
     }
304 304
 
305 305
 	public static function bulk_untrash( $ids ) {
306
-        FrmAppHelper::permission_check('frm_edit_forms');
306
+        FrmAppHelper::permission_check( 'frm_edit_forms' );
307 307
 
308 308
         $count = FrmForm::set_status( $ids, 'published' );
309 309
 
310
-        $message = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
310
+        $message = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), 1 );
311 311
         return $message;
312 312
     }
313 313
 
@@ -326,90 +326,90 @@  discard block
 block discarded – undo
326 326
 			'trash'   => array( 'permission' => 'frm_delete_forms', 'new_status' => 'trash' ),
327 327
 		);
328 328
 
329
-		if ( ! isset( $available_status[ $status ] ) ) {
329
+		if ( ! isset( $available_status[$status] ) ) {
330 330
 			return;
331 331
 		}
332 332
 
333
-		FrmAppHelper::permission_check( $available_status[ $status ]['permission'] );
333
+		FrmAppHelper::permission_check( $available_status[$status]['permission'] );
334 334
 
335 335
 		$params = FrmForm::list_page_params();
336 336
 
337 337
 		//check nonce url
338
-		check_admin_referer($status .'_form_' . $params['id']);
338
+		check_admin_referer( $status . '_form_' . $params['id'] );
339 339
 
340 340
 		$count = 0;
341
-		if ( FrmForm::set_status( $params['id'], $available_status[ $status ]['new_status'] ) ) {
342
-			$count++;
341
+		if ( FrmForm::set_status( $params['id'], $available_status[$status]['new_status'] ) ) {
342
+			$count ++;
343 343
 		}
344 344
 
345
-		$available_status['untrash']['message'] = sprintf(_n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count );
346
-		$available_status['trash']['message'] = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=untrash&form_type='. ( isset( $_REQUEST['form_type'] ) ? sanitize_title( $_REQUEST['form_type'] ) : '' ) . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' );
345
+		$available_status['untrash']['message'] = sprintf( _n( '%1$s form restored from the Trash.', '%1$s forms restored from the Trash.', $count, 'formidable' ), $count );
346
+		$available_status['trash']['message'] = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=untrash&form_type=' . ( isset( $_REQUEST['form_type'] ) ? sanitize_title( $_REQUEST['form_type'] ) : '' ) . '&id=' . $params['id'], 'untrash_form_' . $params['id'] ) ) . '">', '</a>' );
347 347
 
348
-		$message = $available_status[ $status ]['message'];
348
+		$message = $available_status[$status]['message'];
349 349
 
350 350
 		self::display_forms_list( $params, $message );
351 351
 	}
352 352
 
353 353
 	public static function bulk_trash( $ids ) {
354
-        FrmAppHelper::permission_check('frm_delete_forms');
354
+        FrmAppHelper::permission_check( 'frm_delete_forms' );
355 355
 
356 356
         $count = 0;
357 357
         foreach ( $ids as $id ) {
358 358
             if ( FrmForm::trash( $id ) ) {
359
-                $count++;
359
+                $count ++;
360 360
             }
361 361
         }
362 362
 
363 363
         $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
364
-        $message = sprintf(_n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="'. esc_url(wp_nonce_url( '?page=formidable&frm_action=list&action=bulk_untrash&form_type='. $current_page .'&item-action[]='. implode('item-action[]=', $ids), 'bulk-toplevel_page_formidable' )) .'">', '</a>' );
364
+        $message = sprintf( _n( '%1$s form moved to the Trash. %2$sUndo%3$s', '%1$s forms moved to the Trash. %2$sUndo%3$s', $count, 'formidable' ), $count, '<a href="' . esc_url( wp_nonce_url( '?page=formidable&frm_action=list&action=bulk_untrash&form_type=' . $current_page . '&item-action[]=' . implode( 'item-action[]=', $ids ), 'bulk-toplevel_page_formidable' ) ) . '">', '</a>' );
365 365
 
366 366
         return $message;
367 367
     }
368 368
 
369 369
     public static function destroy() {
370
-        FrmAppHelper::permission_check('frm_delete_forms');
370
+        FrmAppHelper::permission_check( 'frm_delete_forms' );
371 371
 
372 372
 		$params = FrmForm::list_page_params();
373 373
 
374 374
         //check nonce url
375
-        check_admin_referer('destroy_form_' . $params['id']);
375
+        check_admin_referer( 'destroy_form_' . $params['id'] );
376 376
 
377 377
         $count = 0;
378 378
         if ( FrmForm::destroy( $params['id'] ) ) {
379
-            $count++;
379
+            $count ++;
380 380
         }
381 381
 
382
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
382
+        $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
383 383
 
384 384
 		self::display_forms_list( $params, $message );
385 385
     }
386 386
 
387 387
 	public static function bulk_destroy( $ids ) {
388
-        FrmAppHelper::permission_check('frm_delete_forms');
388
+        FrmAppHelper::permission_check( 'frm_delete_forms' );
389 389
 
390 390
         $count = 0;
391 391
         foreach ( $ids as $id ) {
392 392
             $d = FrmForm::destroy( $id );
393 393
             if ( $d ) {
394
-                $count++;
394
+                $count ++;
395 395
             }
396 396
         }
397 397
 
398
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
398
+        $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
399 399
 
400 400
         return $message;
401 401
     }
402 402
 
403 403
     private static function delete_all() {
404 404
         //check nonce url
405
-        $permission_error = FrmAppHelper::permission_nonce_error('frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable');
405
+        $permission_error = FrmAppHelper::permission_nonce_error( 'frm_delete_forms', '_wpnonce', 'bulk-toplevel_page_formidable' );
406 406
         if ( $permission_error !== false ) {
407 407
 			self::display_forms_list( array(), '', array( $permission_error ) );
408 408
             return;
409 409
         }
410 410
 
411 411
 		$count = FrmForm::scheduled_delete( time() );
412
-        $message = sprintf(_n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count);
412
+        $message = sprintf( _n( '%1$s form permanently deleted.', '%1$s forms permanently deleted.', $count, 'formidable' ), $count );
413 413
 
414 414
 		self::display_forms_list( array(), $message );
415 415
     }
@@ -426,11 +426,11 @@  discard block
 block discarded – undo
426 426
 	* @since 2.0.15
427 427
 	*/
428 428
 	public static function insert_form_button() {
429
-		if ( current_user_can('frm_view_forms') ) {
429
+		if ( current_user_can( 'frm_view_forms' ) ) {
430 430
 			$menu_name = FrmAppHelper::get_menu_name();
431 431
 			$content = '<a href="#TB_inline?width=50&height=50&inlineId=frm_insert_form" class="thickbox button add_media frm_insert_form" title="' . esc_attr__( 'Add forms and content', 'formidable' ) . '">
432 432
 				<span class="frm-buttons-icon wp-media-buttons-icon"></span> '.
433
-				$menu_name .'</a>';
433
+				$menu_name . '</a>';
434 434
 			echo wp_kses_post( $content );
435 435
 		}
436 436
 	}
@@ -447,22 +447,22 @@  discard block
 block discarded – undo
447 447
 			'formidable' => array( 'name' => __( 'Form', 'formidable' ), 'label' => __( 'Insert a Form', 'formidable' ) ),
448 448
         );
449 449
 
450
-        $shortcodes = apply_filters('frm_popup_shortcodes', $shortcodes);
450
+        $shortcodes = apply_filters( 'frm_popup_shortcodes', $shortcodes );
451 451
 
452
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/insert_form_popup.php');
452
+        include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/insert_form_popup.php' );
453 453
     }
454 454
 
455 455
     public static function get_shortcode_opts() {
456
-		FrmAppHelper::permission_check('frm_view_forms');
456
+		FrmAppHelper::permission_check( 'frm_view_forms' );
457 457
         check_ajax_referer( 'frm_ajax', 'nonce' );
458 458
 
459 459
 		$shortcode = FrmAppHelper::get_post_param( 'shortcode', '', 'sanitize_text_field' );
460
-        if ( empty($shortcode) ) {
460
+        if ( empty( $shortcode ) ) {
461 461
             wp_die();
462 462
         }
463 463
 
464
-        echo '<div id="sc-opts-'. esc_attr( $shortcode ) .'" class="frm_shortcode_option">';
465
-        echo '<input type="radio" name="frmsc" value="'. esc_attr($shortcode) .'" id="sc-'. esc_attr($shortcode) .'" class="frm_hidden" />';
464
+        echo '<div id="sc-opts-' . esc_attr( $shortcode ) . '" class="frm_shortcode_option">';
465
+        echo '<input type="radio" name="frmsc" value="' . esc_attr( $shortcode ) . '" id="sc-' . esc_attr( $shortcode ) . '" class="frm_hidden" />';
466 466
 
467 467
         $form_id = '';
468 468
         $opts = array();
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
                 );
478 478
             break;
479 479
         }
480
-        $opts = apply_filters('frm_sc_popup_opts', $opts, $shortcode);
480
+        $opts = apply_filters( 'frm_sc_popup_opts', $opts, $shortcode );
481 481
 
482 482
 		if ( isset( $opts['form_id'] ) && is_string( $opts['form_id'] ) ) {
483 483
 			// allow other shortcodes to use the required form id option
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 			unset( $opts['form_id'] );
486 486
 		}
487 487
 
488
-        include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/shortcode_opts.php');
488
+        include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/shortcode_opts.php' );
489 489
 
490 490
         echo '</div>';
491 491
 
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
             die();
518 518
         }
519 519
 
520
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/list.php');
520
+        require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/list.php' );
521 521
     }
522 522
 
523 523
 	public static function get_columns( $columns ) {
@@ -594,11 +594,11 @@  discard block
 block discarded – undo
594 594
         }
595 595
 
596 596
         if ( $form->parent_form_id ) {
597
-			wp_die( sprintf( __( 'You are trying to edit a child form. Please edit from %1$shere%2$s', 'formidable' ), '<a href="'. esc_url( admin_url( 'admin.php?page=formidable&frm_action=edit&id='. $form->parent_form_id ) ) . '">', '</a>' ));
597
+			wp_die( sprintf( __( 'You are trying to edit a child form. Please edit from %1$shere%2$s', 'formidable' ), '<a href="' . esc_url( admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form->parent_form_id ) ) . '">', '</a>' ) );
598 598
         }
599 599
 
600 600
 		$frm_field_selection = FrmField::field_selection();
601
-        $fields = FrmField::get_all_for_form($form->id);
601
+        $fields = FrmField::get_all_for_form( $form->id );
602 602
 
603 603
         // Automatically add end section fields if they don't exist (2.0 migration)
604 604
         $reset_fields = false;
@@ -608,9 +608,9 @@  discard block
 block discarded – undo
608 608
             $fields = FrmField::get_all_for_form( $form->id, '', 'exclude' );
609 609
         }
610 610
 
611
-        unset($end_section_values, $last_order, $open, $reset_fields);
611
+        unset( $end_section_values, $last_order, $open, $reset_fields );
612 612
 
613
-        $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
613
+        $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true );
614 614
 
615 615
         $edit_message = __( 'Form was Successfully Updated', 'formidable' );
616 616
         if ( $form->is_template && $message == $edit_message ) {
@@ -620,13 +620,13 @@  discard block
 block discarded – undo
620 620
 		$all_templates = FrmForm::getAll( array( 'is_template' => 1 ), 'name' );
621 621
 
622 622
         if ( $form->default_template ) {
623
-            wp_die(__( 'That template cannot be edited', 'formidable' ));
624
-        } else if ( defined('DOING_AJAX') ) {
623
+            wp_die( __( 'That template cannot be edited', 'formidable' ) );
624
+        } else if ( defined( 'DOING_AJAX' ) ) {
625 625
             wp_die();
626 626
         } else if ( $create_link ) {
627
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/new.php');
627
+            require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/new.php' );
628 628
         } else {
629
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/edit.php');
629
+            require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/edit.php' );
630 630
         }
631 631
     }
632 632
 
@@ -637,28 +637,28 @@  discard block
 block discarded – undo
637 637
 
638 638
         $form = FrmForm::getOne( $id );
639 639
 
640
-        $fields = FrmField::get_all_for_form($id);
641
-        $values = FrmAppHelper::setup_edit_vars($form, 'forms', $fields, true);
640
+        $fields = FrmField::get_all_for_form( $id );
641
+        $values = FrmAppHelper::setup_edit_vars( $form, 'forms', $fields, true );
642 642
 
643
-        if ( isset($values['default_template']) && $values['default_template'] ) {
644
-            wp_die(__( 'That template cannot be edited', 'formidable' ));
643
+        if ( isset( $values['default_template'] ) && $values['default_template'] ) {
644
+            wp_die( __( 'That template cannot be edited', 'formidable' ) );
645 645
         }
646 646
 
647 647
         $action_controls = FrmFormActionsController::get_form_actions();
648 648
 
649
-        $sections = apply_filters('frm_add_form_settings_section', array(), $values);
649
+        $sections = apply_filters( 'frm_add_form_settings_section', array(), $values );
650 650
         $pro_feature = FrmAppHelper::pro_is_installed() ? '' : ' class="pro_feature"';
651 651
 
652
-        $styles = apply_filters('frm_get_style_opts', array());
652
+        $styles = apply_filters( 'frm_get_style_opts', array() );
653 653
 
654
-        require(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/settings.php');
654
+        require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/settings.php' );
655 655
     }
656 656
 
657 657
     public static function mb_tags_box( $form_id, $class = '' ) {
658
-        $fields = FrmField::get_all_for_form($form_id, '', 'include');
658
+        $fields = FrmField::get_all_for_form( $form_id, '', 'include' );
659 659
         $linked_forms = array();
660 660
         $col = 'one';
661
-        $settings_tab = FrmAppHelper::is_admin_page('formidable' ) ? true : false;
661
+        $settings_tab = FrmAppHelper::is_admin_page( 'formidable' ) ? true : false;
662 662
 
663 663
 		$cond_shortcodes = apply_filters( 'frm_conditional_shortcodes', array() );
664 664
 		$adv_shortcodes = self::get_advanced_shortcodes();
@@ -736,13 +736,13 @@  discard block
 block discarded – undo
736 736
 
737 737
     // Insert the form class setting into the form
738 738
 	public static function form_classes( $form ) {
739
-        if ( isset($form->options['form_class']) ) {
739
+        if ( isset( $form->options['form_class'] ) ) {
740 740
 			echo esc_attr( sanitize_text_field( $form->options['form_class'] ) );
741 741
         }
742 742
     }
743 743
 
744 744
     public static function get_email_html() {
745
-		FrmAppHelper::permission_check('frm_view_forms');
745
+		FrmAppHelper::permission_check( 'frm_view_forms' );
746 746
         check_ajax_referer( 'frm_ajax', 'nonce' );
747 747
 		echo FrmEntryFormat::show_entry( array(
748 748
 			'form_id'       => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ),
@@ -839,11 +839,11 @@  discard block
 block discarded – undo
839 839
     public static function add_default_templates( $path, $default = true, $template = true ) {
840 840
         _deprecated_function( __FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()' );
841 841
 
842
-        $path = untrailingslashit(trim($path));
843
-        $templates = glob( $path .'/*.php' );
842
+        $path = untrailingslashit( trim( $path ) );
843
+        $templates = glob( $path . '/*.php' );
844 844
 
845
-		for ( $i = count( $templates ) - 1; $i >= 0; $i-- ) {
846
-            $filename = str_replace( '.php', '', str_replace( $path.'/', '', $templates[ $i ] ) );
845
+		for ( $i = count( $templates ) - 1; $i >= 0; $i -- ) {
846
+            $filename = str_replace( '.php', '', str_replace( $path . '/', '', $templates[$i] ) );
847 847
 			$template_query = array( 'form_key' => $filename );
848 848
             if ( $template ) {
849 849
                 $template_query['is_template'] = 1;
@@ -861,12 +861,12 @@  discard block
 block discarded – undo
861 861
                 $values['default_template'] = 1;
862 862
             }
863 863
 
864
-            include( $templates[ $i ] );
864
+            include( $templates[$i] );
865 865
 
866 866
             //get updated form
867
-            if ( isset($form) && ! empty($form) ) {
867
+            if ( isset( $form ) && ! empty( $form ) ) {
868 868
                 $old_id = $form->id;
869
-                $form = FrmForm::getOne($form->id);
869
+                $form = FrmForm::getOne( $form->id );
870 870
             } else {
871 871
                 $old_id = false;
872 872
 				$form = FrmForm::getAll( $template_query, '', 1 );
@@ -879,24 +879,24 @@  discard block
 block discarded – undo
879 879
     }
880 880
 
881 881
     public static function route() {
882
-        $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
882
+        $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
883 883
         $vars = array();
884 884
 		if ( isset( $_POST['frm_compact_fields'] ) ) {
885 885
 			FrmAppHelper::permission_check( 'frm_edit_forms' );
886 886
 
887
-            $json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('&quot;', '\\\"', $_POST['frm_compact_fields'] ))));
888
-            $json_vars = json_decode($json_vars, true);
889
-            if ( empty($json_vars) ) {
887
+            $json_vars = htmlspecialchars_decode( nl2br( stripslashes( str_replace( '&quot;', '\\\"', $_POST['frm_compact_fields'] ) ) ) );
888
+            $json_vars = json_decode( $json_vars, true );
889
+            if ( empty( $json_vars ) ) {
890 890
                 // json decoding failed so we should return an error message
891 891
 				$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
892 892
                 if ( 'edit' == $action ) {
893 893
                     $action = 'update';
894 894
                 }
895 895
 
896
-                add_filter('frm_validate_form', 'FrmFormsController::json_error');
896
+                add_filter( 'frm_validate_form', 'FrmFormsController::json_error' );
897 897
             } else {
898
-                $vars = FrmAppHelper::json_to_array($json_vars);
899
-                $action = $vars[ $action ];
898
+                $vars = FrmAppHelper::json_to_array( $json_vars );
899
+                $action = $vars[$action];
900 900
 				unset( $_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields'] );
901 901
 				$_REQUEST = array_merge( $_REQUEST, $vars );
902 902
 				$_POST = array_merge( $_POST, $_REQUEST );
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 
915 915
         switch ( $action ) {
916 916
             case 'new':
917
-                return self::new_form($vars);
917
+                return self::new_form( $vars );
918 918
             case 'create':
919 919
             case 'edit':
920 920
             case 'update':
@@ -927,8 +927,8 @@  discard block
 block discarded – undo
927 927
             case 'update_settings':
928 928
 				return self::$action( $vars );
929 929
             default:
930
-                do_action('frm_form_action_'. $action);
931
-                if ( apply_filters('frm_form_stop_action_'. $action, false) ) {
930
+                do_action( 'frm_form_action_' . $action );
931
+                if ( apply_filters( 'frm_form_stop_action_' . $action, false ) ) {
932 932
                     return;
933 933
                 }
934 934
 
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
 					$action = FrmAppHelper::get_param( 'action2', '', 'get', 'sanitize_title' );
938 938
                 }
939 939
 
940
-                if ( strpos($action, 'bulk_') === 0 ) {
940
+                if ( strpos( $action, 'bulk_' ) === 0 ) {
941 941
                     FrmAppHelper::remove_get_action();
942 942
                     return self::list_form();
943 943
                 }
@@ -964,37 +964,37 @@  discard block
 block discarded – undo
964 964
 
965 965
 	public static function admin_bar_configure() {
966 966
         global $frm_vars;
967
-        if ( empty($frm_vars['forms_loaded']) ) {
967
+        if ( empty( $frm_vars['forms_loaded'] ) ) {
968 968
             return;
969 969
         }
970 970
 
971 971
         $actions = array();
972 972
         foreach ( $frm_vars['forms_loaded'] as $form ) {
973
-            if ( is_object($form) ) {
974
-                $actions[ $form->id ] = $form->name;
973
+            if ( is_object( $form ) ) {
974
+                $actions[$form->id] = $form->name;
975 975
             }
976
-            unset($form);
976
+            unset( $form );
977 977
         }
978 978
 
979
-        if ( empty($actions) ) {
979
+        if ( empty( $actions ) ) {
980 980
             return;
981 981
         }
982 982
 
983
-        asort($actions);
983
+        asort( $actions );
984 984
 
985 985
         global $wp_admin_bar;
986 986
 
987
-        if ( count($actions) == 1 ) {
987
+        if ( count( $actions ) == 1 ) {
988 988
             $wp_admin_bar->add_menu( array(
989 989
                 'title' => 'Edit Form',
990
-                'href'  => admin_url('admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) )),
990
+                'href'  => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . current( array_keys( $actions ) ) ),
991 991
                 'id'    => 'frm-forms',
992 992
             ) );
993 993
         } else {
994 994
             $wp_admin_bar->add_menu( array(
995 995
         		'id'    => 'frm-forms',
996 996
         		'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Edit Forms', 'formidable' ) . '</span>',
997
-        		'href'  => admin_url( 'admin.php?page=formidable&frm_action=edit&id='. current( array_keys( $actions ) ) ),
997
+        		'href'  => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . current( array_keys( $actions ) ) ),
998 998
         		'meta'  => array(
999 999
 					'title' => __( 'Edit Forms', 'formidable' ),
1000 1000
         		),
@@ -1004,8 +1004,8 @@  discard block
 block discarded – undo
1004 1004
 
1005 1005
         		$wp_admin_bar->add_menu( array(
1006 1006
         			'parent'    => 'frm-forms',
1007
-        			'id'        => 'edit_form_'. $form_id,
1008
-        			'title'     => empty($name) ? __( '(no title)') : $name,
1007
+        			'id'        => 'edit_form_' . $form_id,
1008
+        			'title'     => empty( $name ) ? __( '(no title)' ) : $name,
1009 1009
 					'href'      => admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ),
1010 1010
         		) );
1011 1011
         	}
@@ -1015,22 +1015,22 @@  discard block
 block discarded – undo
1015 1015
     //formidable shortcode
1016 1016
 	public static function get_form_shortcode( $atts ) {
1017 1017
         global $frm_vars;
1018
-        if ( isset($frm_vars['skip_shortcode']) && $frm_vars['skip_shortcode'] ) {
1018
+        if ( isset( $frm_vars['skip_shortcode'] ) && $frm_vars['skip_shortcode'] ) {
1019 1019
             $sc = '[formidable';
1020 1020
 			if ( ! empty( $atts ) ) {
1021 1021
 				foreach ( $atts as $k => $v ) {
1022 1022
 					$sc .= ' ' . $k . '="' . esc_attr( $v ) . '"';
1023 1023
 				}
1024 1024
 			}
1025
-            return $sc .']';
1025
+            return $sc . ']';
1026 1026
         }
1027 1027
 
1028 1028
         $shortcode_atts = shortcode_atts( array(
1029 1029
             'id' => '', 'key' => '', 'title' => false, 'description' => false,
1030 1030
             'readonly' => false, 'entry_id' => false, 'fields' => array(),
1031 1031
             'exclude_fields' => array(), 'minimize' => false,
1032
-        ), $atts);
1033
-        do_action('formidable_shortcode_atts', $shortcode_atts, $atts);
1032
+        ), $atts );
1033
+        do_action( 'formidable_shortcode_atts', $shortcode_atts, $atts );
1034 1034
 
1035 1035
         return self::show_form(
1036 1036
             $shortcode_atts['id'], $shortcode_atts['key'], $shortcode_atts['title'],
@@ -1118,51 +1118,51 @@  discard block
 block discarded – undo
1118 1118
 
1119 1119
         $frm_settings = FrmAppHelper::get_settings();
1120 1120
 
1121
-        $submit = isset($form->options['submit_value']) ? $form->options['submit_value'] : $frm_settings->submit_value;
1121
+        $submit = isset( $form->options['submit_value'] ) ? $form->options['submit_value'] : $frm_settings->submit_value;
1122 1122
 
1123 1123
         $user_ID = get_current_user_id();
1124 1124
 		$params = FrmForm::get_params( $form );
1125 1125
         $message = $errors = '';
1126 1126
 
1127 1127
         if ( $params['posted_form_id'] == $form->id && $_POST ) {
1128
-            $errors = isset( $frm_vars['created_entries'][ $form->id ] ) ? $frm_vars['created_entries'][ $form->id ]['errors'] : array();
1128
+            $errors = isset( $frm_vars['created_entries'][$form->id] ) ? $frm_vars['created_entries'][$form->id]['errors'] : array();
1129 1129
         }
1130 1130
 
1131 1131
 		$include_form_tag = apply_filters( 'frm_include_form_tag', true, $form );
1132 1132
         $fields = FrmFieldsHelper::get_form_fields( $form->id, ( isset( $errors ) && ! empty( $errors ) ) );
1133 1133
 
1134 1134
         if ( $params['action'] != 'create' || $params['posted_form_id'] != $form->id || ! $_POST ) {
1135
-            do_action('frm_display_form_action', $params, $fields, $form, $title, $description);
1136
-            if ( apply_filters('frm_continue_to_new', true, $form->id, $params['action']) ) {
1137
-                $values = FrmEntriesHelper::setup_new_vars($fields, $form);
1138
-                include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1135
+            do_action( 'frm_display_form_action', $params, $fields, $form, $title, $description );
1136
+            if ( apply_filters( 'frm_continue_to_new', true, $form->id, $params['action'] ) ) {
1137
+                $values = FrmEntriesHelper::setup_new_vars( $fields, $form );
1138
+                include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' );
1139 1139
             }
1140 1140
             return;
1141 1141
         }
1142 1142
 
1143
-        if ( ! empty($errors) ) {
1144
-            $values = $fields ? FrmEntriesHelper::setup_new_vars($fields, $form) : array();
1145
-            include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1143
+        if ( ! empty( $errors ) ) {
1144
+            $values = $fields ? FrmEntriesHelper::setup_new_vars( $fields, $form ) : array();
1145
+            include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' );
1146 1146
             return;
1147 1147
         }
1148 1148
 
1149
-        do_action('frm_validate_form_creation', $params, $fields, $form, $title, $description);
1150
-        if ( ! apply_filters('frm_continue_to_create', true, $form->id) ) {
1149
+        do_action( 'frm_validate_form_creation', $params, $fields, $form, $title, $description );
1150
+        if ( ! apply_filters( 'frm_continue_to_create', true, $form->id ) ) {
1151 1151
             return;
1152 1152
         }
1153 1153
 
1154
-        $values = FrmEntriesHelper::setup_new_vars($fields, $form, true);
1155
-        $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][ $form->id ] ) ) ? $frm_vars['created_entries'][ $form->id ]['entry_id'] : 0;
1156
-        $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create');
1154
+        $values = FrmEntriesHelper::setup_new_vars( $fields, $form, true );
1155
+        $created = ( isset( $frm_vars['created_entries'] ) && isset( $frm_vars['created_entries'][$form->id] ) ) ? $frm_vars['created_entries'][$form->id]['entry_id'] : 0;
1156
+        $conf_method = apply_filters( 'frm_success_filter', 'message', $form, $form->options, 'create' );
1157 1157
 
1158
-        if ( $created && is_numeric($created) && $conf_method != 'message' ) {
1159
-            do_action('frm_success_action', $conf_method, $form, $form->options, $created);
1158
+        if ( $created && is_numeric( $created ) && $conf_method != 'message' ) {
1159
+            do_action( 'frm_success_action', $conf_method, $form, $form->options, $created );
1160 1160
 			do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
1161 1161
             return;
1162 1162
         }
1163 1163
 
1164
-        if ( $created && is_numeric($created) ) {
1165
-            $message = isset($form->options['success_msg']) ? $form->options['success_msg'] : $frm_settings->success_msg;
1164
+        if ( $created && is_numeric( $created ) ) {
1165
+            $message = isset( $form->options['success_msg'] ) ? $form->options['success_msg'] : $frm_settings->success_msg;
1166 1166
             $class = 'frm_message';
1167 1167
         } else {
1168 1168
             $message = $frm_settings->failed_msg;
@@ -1173,16 +1173,16 @@  discard block
 block discarded – undo
1173 1173
 			'message' => $message, 'form' => $form,
1174 1174
 			'entry_id' => $created, 'class' => $class,
1175 1175
 		) );
1176
-        $message = apply_filters('frm_main_feedback', $message, $form, $created);
1176
+        $message = apply_filters( 'frm_main_feedback', $message, $form, $created );
1177 1177
 
1178
-        if ( ! isset($form->options['show_form']) || $form->options['show_form'] ) {
1179
-            require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/new.php');
1178
+        if ( ! isset( $form->options['show_form'] ) || $form->options['show_form'] ) {
1179
+            require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php' );
1180 1180
         } else {
1181 1181
             global $frm_vars;
1182 1182
 			self::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] );
1183 1183
 
1184
-            $include_extra_container = 'frm_forms'. FrmFormsHelper::get_form_style_class($values);
1185
-            include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/errors.php');
1184
+            $include_extra_container = 'frm_forms' . FrmFormsHelper::get_form_style_class( $values );
1185
+            include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/errors.php' );
1186 1186
         }
1187 1187
 
1188 1188
 		do_action( 'frm_after_entry_processed', array( 'entry_id' => $created, 'form' => $form ) );
Please login to merge, or discard this patch.
classes/helpers/FrmAppHelper.php 1 patch
Indentation   +1120 added lines, -1120 removed lines patch added patch discarded remove patch
@@ -12,50 +12,50 @@  discard block
 block discarded – undo
12 12
 	 */
13 13
 	public static $plug_version = '2.0.23b1';
14 14
 
15
-    /**
16
-     * @since 1.07.02
17
-     *
18
-     * @param none
19
-     * @return string The version of this plugin
20
-     */
21
-    public static function plugin_version() {
22
-        return self::$plug_version;
23
-    }
24
-
25
-    public static function plugin_folder() {
26
-        return basename(self::plugin_path());
27
-    }
28
-
29
-    public static function plugin_path() {
30
-        return dirname(dirname(dirname(__FILE__)));
31
-    }
32
-
33
-    public static function plugin_url() {
34
-        //prevously FRM_URL constant
35
-        return plugins_url( '', self::plugin_path() .'/formidable.php' );
36
-    }
15
+	/**
16
+	 * @since 1.07.02
17
+	 *
18
+	 * @param none
19
+	 * @return string The version of this plugin
20
+	 */
21
+	public static function plugin_version() {
22
+		return self::$plug_version;
23
+	}
24
+
25
+	public static function plugin_folder() {
26
+		return basename(self::plugin_path());
27
+	}
28
+
29
+	public static function plugin_path() {
30
+		return dirname(dirname(dirname(__FILE__)));
31
+	}
32
+
33
+	public static function plugin_url() {
34
+		//prevously FRM_URL constant
35
+		return plugins_url( '', self::plugin_path() .'/formidable.php' );
36
+	}
37 37
 
38 38
 	public static function relative_plugin_url() {
39 39
 		return str_replace( array( 'https:', 'http:' ), '', self::plugin_url() );
40 40
 	}
41 41
 
42
-    /**
43
-     * @return string Site URL
44
-     */
45
-    public static function site_url() {
46
-        return site_url();
47
-    }
48
-
49
-    /**
50
-     * Get the name of this site
51
-     * Used for [sitename] shortcode
52
-     *
53
-     * @since 2.0
54
-     * @return string
55
-     */
56
-    public static function site_name() {
57
-        return get_option('blogname');
58
-    }
42
+	/**
43
+	 * @return string Site URL
44
+	 */
45
+	public static function site_url() {
46
+		return site_url();
47
+	}
48
+
49
+	/**
50
+	 * Get the name of this site
51
+	 * Used for [sitename] shortcode
52
+	 *
53
+	 * @since 2.0
54
+	 * @return string
55
+	 */
56
+	public static function site_name() {
57
+		return get_option('blogname');
58
+	}
59 59
 
60 60
 	public static function make_affiliate_url( $url ) {
61 61
 		$affiliate_id = self::get_affiliate();
@@ -75,21 +75,21 @@  discard block
 block discarded – undo
75 75
 		return $affiliate_id;
76 76
 	}
77 77
 
78
-    /**
79
-     * Get the Formidable settings
80
-     *
81
-     * @since 2.0
82
-     *
83
-     * @param None
84
-     * @return FrmSettings $frm_setings
85
-     */
86
-    public static function get_settings() {
87
-        global $frm_settings;
88
-        if ( empty($frm_settings) ) {
89
-            $frm_settings = new FrmSettings();
90
-        }
91
-        return $frm_settings;
92
-    }
78
+	/**
79
+	 * Get the Formidable settings
80
+	 *
81
+	 * @since 2.0
82
+	 *
83
+	 * @param None
84
+	 * @return FrmSettings $frm_setings
85
+	 */
86
+	public static function get_settings() {
87
+		global $frm_settings;
88
+		if ( empty($frm_settings) ) {
89
+			$frm_settings = new FrmSettings();
90
+		}
91
+		return $frm_settings;
92
+	}
93 93
 
94 94
 	public static function get_menu_name() {
95 95
 		$frm_settings = FrmAppHelper::get_settings();
@@ -97,62 +97,62 @@  discard block
 block discarded – undo
97 97
 		return empty( $menu_name ) ? __( 'Forms', 'formidable' ) : $menu_name;
98 98
 	}
99 99
 
100
-    /**
101
-     * Show a message in place of pro features
102
-     *
103
-     * @since 2.0
104
-     */
100
+	/**
101
+	 * Show a message in place of pro features
102
+	 *
103
+	 * @since 2.0
104
+	 */
105 105
 	public static function update_message( $features, $class = '' ) {
106 106
 		_deprecated_function( __FUNCTION__, '2.0.19' );
107
-    }
108
-
109
-    public static function pro_is_installed() {
110
-        return apply_filters('frm_pro_installed', false);
111
-    }
112
-
113
-    /**
114
-     * Check for certain page in Formidable settings
115
-     *
116
-     * @since 2.0
117
-     *
118
-     * @param string $page The name of the page to check
119
-     * @return boolean
120
-     */
107
+	}
108
+
109
+	public static function pro_is_installed() {
110
+		return apply_filters('frm_pro_installed', false);
111
+	}
112
+
113
+	/**
114
+	 * Check for certain page in Formidable settings
115
+	 *
116
+	 * @since 2.0
117
+	 *
118
+	 * @param string $page The name of the page to check
119
+	 * @return boolean
120
+	 */
121 121
 	public static function is_admin_page( $page = 'formidable' ) {
122
-        global $pagenow;
122
+		global $pagenow;
123 123
 		$get_page = self::simple_get( 'page', 'sanitize_title' );
124
-        if ( $pagenow ) {
124
+		if ( $pagenow ) {
125 125
 			return $pagenow == 'admin.php' && $get_page == $page;
126
-        }
126
+		}
127 127
 
128 128
 		return is_admin() && $get_page == $page;
129
-    }
130
-
131
-    /**
132
-     * Check for the form preview page
133
-     *
134
-     * @since 2.0
135
-     *
136
-     * @param None
137
-     * @return boolean
138
-     */
139
-    public static function is_preview_page() {
140
-        global $pagenow;
129
+	}
130
+
131
+	/**
132
+	 * Check for the form preview page
133
+	 *
134
+	 * @since 2.0
135
+	 *
136
+	 * @param None
137
+	 * @return boolean
138
+	 */
139
+	public static function is_preview_page() {
140
+		global $pagenow;
141 141
 		$action = FrmAppHelper::simple_get( 'action', 'sanitize_title' );
142 142
 		return $pagenow && $pagenow == 'admin-ajax.php' && $action == 'frm_forms_preview';
143
-    }
143
+	}
144 144
 
145
-    /**
146
-     * Check for ajax except the form preview page
147
-     *
148
-     * @since 2.0
149
-     *
150
-     * @param None
151
-     * @return boolean
152
-     */
153
-    public static function doing_ajax() {
154
-        return defined('DOING_AJAX') && DOING_AJAX && ! self::is_preview_page();
155
-    }
145
+	/**
146
+	 * Check for ajax except the form preview page
147
+	 *
148
+	 * @since 2.0
149
+	 *
150
+	 * @param None
151
+	 * @return boolean
152
+	 */
153
+	public static function doing_ajax() {
154
+		return defined('DOING_AJAX') && DOING_AJAX && ! self::is_preview_page();
155
+	}
156 156
 
157 157
 	/**
158 158
 	 * @since 2.0.8
@@ -162,101 +162,101 @@  discard block
 block discarded – undo
162 162
 		return isset( $frm_vars['prevent_caching'] ) && $frm_vars['prevent_caching'];
163 163
 	}
164 164
 
165
-    /**
166
-     * Check if on an admin page
167
-     *
168
-     * @since 2.0
169
-     *
170
-     * @param None
171
-     * @return boolean
172
-     */
173
-    public static function is_admin() {
174
-        return is_admin() && ( ! defined('DOING_AJAX') || ! DOING_AJAX );
175
-    }
176
-
177
-    /**
178
-     * Check if value contains blank value or empty array
179
-     *
180
-     * @since 2.0
181
-     * @param $value - value to check
182
-     * @return boolean
183
-     */
184
-    public static function is_empty_value( $value, $empty = '' ) {
185
-        return ( is_array( $value ) && empty( $value ) ) || $value == $empty;
186
-    }
187
-
188
-    public static function is_not_empty_value( $value, $empty = '' ) {
189
-        return ! self::is_empty_value( $value, $empty );
190
-    }
191
-
192
-    /**
193
-     * Get any value from the $_SERVER
194
-     *
195
-     * @since 2.0
196
-     * @param string $value
197
-     * @return string
198
-     */
165
+	/**
166
+	 * Check if on an admin page
167
+	 *
168
+	 * @since 2.0
169
+	 *
170
+	 * @param None
171
+	 * @return boolean
172
+	 */
173
+	public static function is_admin() {
174
+		return is_admin() && ( ! defined('DOING_AJAX') || ! DOING_AJAX );
175
+	}
176
+
177
+	/**
178
+	 * Check if value contains blank value or empty array
179
+	 *
180
+	 * @since 2.0
181
+	 * @param $value - value to check
182
+	 * @return boolean
183
+	 */
184
+	public static function is_empty_value( $value, $empty = '' ) {
185
+		return ( is_array( $value ) && empty( $value ) ) || $value == $empty;
186
+	}
187
+
188
+	public static function is_not_empty_value( $value, $empty = '' ) {
189
+		return ! self::is_empty_value( $value, $empty );
190
+	}
191
+
192
+	/**
193
+	 * Get any value from the $_SERVER
194
+	 *
195
+	 * @since 2.0
196
+	 * @param string $value
197
+	 * @return string
198
+	 */
199 199
 	public static function get_server_value( $value ) {
200
-        return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
201
-    }
202
-
203
-    /**
204
-     * Check for the IP address in several places
205
-     * Used by [ip] shortcode
206
-     *
207
-     * @return string The IP address of the current user
208
-     */
209
-    public static function get_ip_address() {
200
+		return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
201
+	}
202
+
203
+	/**
204
+	 * Check for the IP address in several places
205
+	 * Used by [ip] shortcode
206
+	 *
207
+	 * @return string The IP address of the current user
208
+	 */
209
+	public static function get_ip_address() {
210 210
 		$ip = '';
211
-        foreach ( array(
212
-            'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
213
-            'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR',
214
-        ) as $key ) {
215
-            if ( ! isset( $_SERVER[ $key ] ) ) {
216
-                continue;
217
-            }
218
-
219
-            foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
220
-                $ip = trim($ip); // just to be safe
221
-
222
-                if ( filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false ) {
223
-                    return $ip;
224
-                }
225
-            }
226
-        }
211
+		foreach ( array(
212
+			'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP',
213
+			'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR',
214
+		) as $key ) {
215
+			if ( ! isset( $_SERVER[ $key ] ) ) {
216
+				continue;
217
+			}
218
+
219
+			foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
220
+				$ip = trim($ip); // just to be safe
221
+
222
+				if ( filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false ) {
223
+					return $ip;
224
+				}
225
+			}
226
+		}
227 227
 
228 228
 		return sanitize_text_field( $ip );
229
-    }
229
+	}
230 230
 
231
-    public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
232
-        if ( strpos($param, '[') ) {
233
-            $params = explode('[', $param);
234
-            $param = $params[0];
235
-        }
231
+	public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
232
+		if ( strpos($param, '[') ) {
233
+			$params = explode('[', $param);
234
+			$param = $params[0];
235
+		}
236 236
 
237 237
 		if ( $src == 'get' ) {
238
-            $value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
239
-            if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
240
-                $value = stripslashes_deep( htmlspecialchars_decode( urldecode( $_GET[ $param ] ) ) );
241
-            }
238
+			$value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
239
+			if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
240
+				$value = stripslashes_deep( htmlspecialchars_decode( urldecode( $_GET[ $param ] ) ) );
241
+			}
242 242
 			self::sanitize_value( $sanitize, $value );
243 243
 		} else {
244
-            $value = self::get_simple_request( array( 'type' => $src, 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
245
-        }
244
+			$value = self::get_simple_request( array( 'type' => $src, 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
245
+		}
246 246
 
247 247
 		if ( isset( $params ) && is_array( $value ) && ! empty( $value ) ) {
248
-            foreach ( $params as $k => $p ) {
249
-                if ( ! $k || ! is_array($value) ) {
250
-                    continue;
251
-                }
248
+			foreach ( $params as $k => $p ) {
249
+				if ( ! $k || ! is_array($value) ) {
250
+					continue;
251
+				}
252 252
 
253
-                $p = trim($p, ']');
254
-                $value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
255
-            }
256
-        }
253
+				$p = trim($p, ']');
254
+				$value = isset( $value[ $p ] ) ? $value[ $p ] : $default;
255
+			}
256
+		}
257 257
 
258
-        return $value;
259
-    }
258
+		return $value;
259
+	}
260 260
 
261 261
 	/**
262 262
 	 *
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 */
278 278
 	public static function simple_get( $param, $sanitize = 'sanitize_text_field', $default = '' ) {
279 279
 		return self::get_simple_request( array( 'type' => 'get', 'param' => $param, 'default' => $default, 'sanitize' => $sanitize ) );
280
-    }
280
+	}
281 281
 
282 282
 	/**
283 283
 	 * Get a GET/POST/REQUEST value and sanitize it
@@ -311,12 +311,12 @@  discard block
 block discarded – undo
311 311
 	}
312 312
 
313 313
 	/**
314
-	* Preserve backslashes in a value, but make sure value doesn't get compounding slashes
315
-	*
316
-	* @since 2.0.8
317
-	* @param string $value
318
-	* @return string $value
319
-	*/
314
+	 * Preserve backslashes in a value, but make sure value doesn't get compounding slashes
315
+	 *
316
+	 * @since 2.0.8
317
+	 * @param string $value
318
+	 * @return string $value
319
+	 */
320 320
 	public static function preserve_backslashes( $value ) {
321 321
 		// If backslashes have already been added, don't add them again
322 322
 		if ( strpos( $value, '\\\\' ) === false ) {
@@ -335,14 +335,14 @@  discard block
 block discarded – undo
335 335
 		}
336 336
 	}
337 337
 
338
-    public static function sanitize_request( $sanitize_method, &$values ) {
339
-        $temp_values = $values;
340
-        foreach ( $temp_values as $k => $val ) {
341
-            if ( isset( $sanitize_method[ $k ] ) ) {
338
+	public static function sanitize_request( $sanitize_method, &$values ) {
339
+		$temp_values = $values;
340
+		foreach ( $temp_values as $k => $val ) {
341
+			if ( isset( $sanitize_method[ $k ] ) ) {
342 342
 				$values[ $k ] = call_user_func( $sanitize_method[ $k ], $val );
343
-            }
344
-        }
345
-    }
343
+			}
344
+		}
345
+	}
346 346
 
347 347
 	public static function sanitize_array( &$values ) {
348 348
 		$temp_values = $values;
@@ -357,12 +357,12 @@  discard block
 block discarded – undo
357 357
 	 */
358 358
 	public static function kses( $value, $allowed = array() ) {
359 359
 		$html = array(
360
-		    'a' => array(
360
+			'a' => array(
361 361
 				'href'  => array(),
362 362
 				'title' => array(),
363 363
 				'id'    => array(),
364 364
 				'class' => array(),
365
-		    ),
365
+			),
366 366
 		);
367 367
 
368 368
 		$allowed_html = array();
@@ -373,176 +373,176 @@  discard block
 block discarded – undo
373 373
 		return wp_kses( $value, $allowed_html );
374 374
 	}
375 375
 
376
-    /**
377
-     * Used when switching the action for a bulk action
378
-     * @since 2.0
379
-     */
380
-    public static function remove_get_action() {
381
-        if ( ! isset($_GET) ) {
382
-            return;
383
-        }
376
+	/**
377
+	 * Used when switching the action for a bulk action
378
+	 * @since 2.0
379
+	 */
380
+	public static function remove_get_action() {
381
+		if ( ! isset($_GET) ) {
382
+			return;
383
+		}
384 384
 
385
-        $new_action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ( isset( $_GET['action2'] ) ? sanitize_text_field( $_GET['action2'] ) : '' );
386
-        if ( ! empty( $new_action ) ) {
385
+		$new_action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ( isset( $_GET['action2'] ) ? sanitize_text_field( $_GET['action2'] ) : '' );
386
+		if ( ! empty( $new_action ) ) {
387 387
 			$_SERVER['REQUEST_URI'] = str_replace( '&action=' . $new_action, '', FrmAppHelper::get_server_value( 'REQUEST_URI' ) );
388
-        }
389
-    }
390
-
391
-    /**
392
-     * Check the WP query for a parameter
393
-     *
394
-     * @since 2.0
395
-     * @return string|array
396
-     */
397
-    public static function get_query_var( $value, $param ) {
398
-        if ( $value != '' ) {
399
-            return $value;
400
-        }
401
-
402
-        global $wp_query;
403
-        if ( isset( $wp_query->query_vars[ $param ] ) ) {
404
-            $value = $wp_query->query_vars[ $param ];
405
-        }
406
-
407
-        return $value;
408
-    }
409
-
410
-    /**
411
-     * @param string $type
412
-     */
413
-    public static function trigger_hook_load( $type, $object = null ) {
414
-        // only load the form hooks once
415
-        $hooks_loaded = apply_filters('frm_'. $type .'_hooks_loaded', false, $object);
416
-        if ( ! $hooks_loaded ) {
417
-            do_action('frm_load_'. $type .'_hooks');
418
-        }
419
-    }
420
-
421
-    /**
422
-     * Check cache before fetching values and saving to cache
423
-     *
424
-     * @since 2.0
425
-     *
426
-     * @param string $cache_key The unique name for this cache
427
-     * @param string $group The name of the cache group
428
-     * @param string $query If blank, don't run a db call
429
-     * @param string $type The wpdb function to use with this query
430
-     * @return mixed $results The cache or query results
431
-     */
432
-    public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
433
-        $results = wp_cache_get($cache_key, $group);
434
-        if ( ! self::is_empty_value( $results, false ) || empty($query) ) {
435
-            return $results;
436
-        }
437
-
438
-        if ( 'get_posts' == $type ) {
439
-            $results = get_posts($query);
440
-        } else {
441
-            global $wpdb;
442
-            $results = $wpdb->{$type}($query);
443
-        }
388
+		}
389
+	}
390
+
391
+	/**
392
+	 * Check the WP query for a parameter
393
+	 *
394
+	 * @since 2.0
395
+	 * @return string|array
396
+	 */
397
+	public static function get_query_var( $value, $param ) {
398
+		if ( $value != '' ) {
399
+			return $value;
400
+		}
401
+
402
+		global $wp_query;
403
+		if ( isset( $wp_query->query_vars[ $param ] ) ) {
404
+			$value = $wp_query->query_vars[ $param ];
405
+		}
406
+
407
+		return $value;
408
+	}
409
+
410
+	/**
411
+	 * @param string $type
412
+	 */
413
+	public static function trigger_hook_load( $type, $object = null ) {
414
+		// only load the form hooks once
415
+		$hooks_loaded = apply_filters('frm_'. $type .'_hooks_loaded', false, $object);
416
+		if ( ! $hooks_loaded ) {
417
+			do_action('frm_load_'. $type .'_hooks');
418
+		}
419
+	}
420
+
421
+	/**
422
+	 * Check cache before fetching values and saving to cache
423
+	 *
424
+	 * @since 2.0
425
+	 *
426
+	 * @param string $cache_key The unique name for this cache
427
+	 * @param string $group The name of the cache group
428
+	 * @param string $query If blank, don't run a db call
429
+	 * @param string $type The wpdb function to use with this query
430
+	 * @return mixed $results The cache or query results
431
+	 */
432
+	public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
433
+		$results = wp_cache_get($cache_key, $group);
434
+		if ( ! self::is_empty_value( $results, false ) || empty($query) ) {
435
+			return $results;
436
+		}
437
+
438
+		if ( 'get_posts' == $type ) {
439
+			$results = get_posts($query);
440
+		} else {
441
+			global $wpdb;
442
+			$results = $wpdb->{$type}($query);
443
+		}
444 444
 
445 445
 		if ( ! self::prevent_caching() ) {
446 446
 			wp_cache_set( $cache_key, $results, $group, $time );
447 447
 		}
448 448
 
449
-        return $results;
450
-    }
449
+		return $results;
450
+	}
451 451
 
452
-    /**
453
-     * Data that should be stored for a long time can be stored in a transient.
454
-     * First check the cache, then check the transient
455
-     * @since 2.0
456
-     * @return mixed The cached value or false
457
-     */
452
+	/**
453
+	 * Data that should be stored for a long time can be stored in a transient.
454
+	 * First check the cache, then check the transient
455
+	 * @since 2.0
456
+	 * @return mixed The cached value or false
457
+	 */
458 458
 	public static function check_cache_and_transient( $cache_key ) {
459
-        // check caching layer first
460
-        $results = self::check_cache( $cache_key );
461
-        if ( $results ) {
462
-            return $results;
463
-        }
464
-
465
-        // then check the transient
466
-        $results = get_transient($cache_key);
467
-        if ( $results ) {
468
-            wp_cache_set($cache_key, $results);
469
-        }
470
-
471
-        return $results;
472
-    }
473
-
474
-    /**
475
-     * @since 2.0
476
-     * @param string $cache_key
477
-     */
459
+		// check caching layer first
460
+		$results = self::check_cache( $cache_key );
461
+		if ( $results ) {
462
+			return $results;
463
+		}
464
+
465
+		// then check the transient
466
+		$results = get_transient($cache_key);
467
+		if ( $results ) {
468
+			wp_cache_set($cache_key, $results);
469
+		}
470
+
471
+		return $results;
472
+	}
473
+
474
+	/**
475
+	 * @since 2.0
476
+	 * @param string $cache_key
477
+	 */
478 478
 	public static function delete_cache_and_transient( $cache_key ) {
479
-        delete_transient($cache_key);
480
-        wp_cache_delete($cache_key);
481
-    }
482
-
483
-    /**
484
-     * Delete all caching in a single group
485
-     *
486
-     * @since 2.0
487
-     *
488
-     * @param string $group The name of the cache group
489
-     * @return boolean True or False
490
-     */
479
+		delete_transient($cache_key);
480
+		wp_cache_delete($cache_key);
481
+	}
482
+
483
+	/**
484
+	 * Delete all caching in a single group
485
+	 *
486
+	 * @since 2.0
487
+	 *
488
+	 * @param string $group The name of the cache group
489
+	 * @return boolean True or False
490
+	 */
491 491
 	public static function cache_delete_group( $group ) {
492
-    	global $wp_object_cache;
493
-
494
-        if ( isset( $wp_object_cache->cache[ $group ] ) ) {
495
-            foreach ( $wp_object_cache->cache[ $group ] as $k => $v ) {
496
-                wp_cache_delete($k, $group);
497
-            }
498
-            return true;
499
-        }
500
-
501
-    	return false;
502
-    }
503
-
504
-    /**
505
-     * Check a value from a shortcode to see if true or false.
506
-     * True when value is 1, true, 'true', 'yes'
507
-     *
508
-     * @since 1.07.10
509
-     *
510
-     * @param string $value The value to compare
511
-     * @return boolean True or False
512
-     */
492
+		global $wp_object_cache;
493
+
494
+		if ( isset( $wp_object_cache->cache[ $group ] ) ) {
495
+			foreach ( $wp_object_cache->cache[ $group ] as $k => $v ) {
496
+				wp_cache_delete($k, $group);
497
+			}
498
+			return true;
499
+		}
500
+
501
+		return false;
502
+	}
503
+
504
+	/**
505
+	 * Check a value from a shortcode to see if true or false.
506
+	 * True when value is 1, true, 'true', 'yes'
507
+	 *
508
+	 * @since 1.07.10
509
+	 *
510
+	 * @param string $value The value to compare
511
+	 * @return boolean True or False
512
+	 */
513 513
 	public static function is_true( $value ) {
514
-        return ( true === $value || 1 == $value || 'true' == $value || 'yes' == $value );
515
-    }
514
+		return ( true === $value || 1 == $value || 'true' == $value || 'yes' == $value );
515
+	}
516 516
 
517
-    /**
518
-     * Used to filter shortcode in text widgets
519
-     */
520
-    public static function widget_text_filter_callback( $matches ) {
521
-        return do_shortcode( $matches[0] );
522
-    }
517
+	/**
518
+	 * Used to filter shortcode in text widgets
519
+	 */
520
+	public static function widget_text_filter_callback( $matches ) {
521
+		return do_shortcode( $matches[0] );
522
+	}
523 523
 
524 524
 	public static function load_scripts( $scripts ) {
525
-        _deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_script' );
526
-        foreach ( (array) $scripts as $s ) {
527
-            wp_enqueue_script($s);
528
-        }
529
-    }
525
+		_deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_script' );
526
+		foreach ( (array) $scripts as $s ) {
527
+			wp_enqueue_script($s);
528
+		}
529
+	}
530 530
 
531 531
 	public static function load_styles( $styles ) {
532
-        _deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_style' );
533
-        foreach ( (array) $styles as $s ) {
534
-            wp_enqueue_style($s);
535
-        }
536
-    }
532
+		_deprecated_function( __FUNCTION__, '2.0', 'wp_enqueue_style' );
533
+		foreach ( (array) $styles as $s ) {
534
+			wp_enqueue_style($s);
535
+		}
536
+	}
537 537
 
538
-    public static function get_pages() {
538
+	public static function get_pages() {
539 539
 		return get_posts( array( 'post_type' => 'page', 'post_status' => array( 'publish', 'private' ), 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC' ) );
540
-    }
540
+	}
541 541
 
542
-    public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
543
-        $pages = self::get_pages();
542
+	public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
543
+		$pages = self::get_pages();
544 544
 		$selected = self::get_post_param( $field_name, $page_id, 'absint' );
545
-    ?>
545
+	?>
546 546
         <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" class="frm-pages-dropdown">
547 547
             <option value=""> </option>
548 548
             <?php foreach ( $pages as $page ) { ?>
@@ -552,107 +552,107 @@  discard block
 block discarded – undo
552 552
             <?php } ?>
553 553
         </select>
554 554
     <?php
555
-    }
555
+	}
556 556
 
557 557
 	public static function post_edit_link( $post_id ) {
558
-        $post = get_post($post_id);
559
-        if ( $post ) {
558
+		$post = get_post($post_id);
559
+		if ( $post ) {
560 560
 			return '<a href="'. esc_url( admin_url('post.php?post='. $post_id .'&action=edit') ) .'">'. self::truncate( $post->post_title, 50 ) .'</a>';
561
-        }
562
-        return '';
563
-    }
561
+		}
562
+		return '';
563
+	}
564 564
 
565 565
 	public static function wp_roles_dropdown( $field_name, $capability, $multiple = 'single' ) {
566
-    ?>
566
+	?>
567 567
         <select name="<?php echo esc_attr($field_name); ?>" id="<?php echo esc_attr($field_name); ?>" <?php
568
-            echo ( 'multiple' == $multiple ) ? 'multiple="multiple"' : '';
569
-            ?> class="frm_multiselect">
568
+			echo ( 'multiple' == $multiple ) ? 'multiple="multiple"' : '';
569
+			?> class="frm_multiselect">
570 570
             <?php self::roles_options($capability); ?>
571 571
         </select>
572 572
     <?php
573
-    }
573
+	}
574 574
 
575 575
 	public static function roles_options( $capability ) {
576
-        global $frm_vars;
577
-        if ( isset($frm_vars['editable_roles']) ) {
578
-            $editable_roles = $frm_vars['editable_roles'];
579
-        } else {
580
-            $editable_roles = get_editable_roles();
581
-            $frm_vars['editable_roles'] = $editable_roles;
582
-        }
583
-
584
-        foreach ( $editable_roles as $role => $details ) {
585
-            $name = translate_user_role($details['name'] ); ?>
576
+		global $frm_vars;
577
+		if ( isset($frm_vars['editable_roles']) ) {
578
+			$editable_roles = $frm_vars['editable_roles'];
579
+		} else {
580
+			$editable_roles = get_editable_roles();
581
+			$frm_vars['editable_roles'] = $editable_roles;
582
+		}
583
+
584
+		foreach ( $editable_roles as $role => $details ) {
585
+			$name = translate_user_role($details['name'] ); ?>
586 586
         <option value="<?php echo esc_attr($role) ?>" <?php echo in_array($role, (array) $capability) ? ' selected="selected"' : ''; ?>><?php echo esc_attr($name) ?> </option>
587 587
 <?php
588
-            unset($role, $details);
589
-        }
590
-    }
588
+			unset($role, $details);
589
+		}
590
+	}
591 591
 
592 592
 	public static function frm_capabilities( $type = 'auto' ) {
593
-        $cap = array(
594
-            'frm_view_forms'        => __( 'View Forms and Templates', 'formidable' ),
595
-            'frm_edit_forms'        => __( 'Add/Edit Forms and Templates', 'formidable' ),
596
-            'frm_delete_forms'      => __( 'Delete Forms and Templates', 'formidable' ),
597
-            'frm_change_settings'   => __( 'Access this Settings Page', 'formidable' ),
598
-            'frm_view_entries'      => __( 'View Entries from Admin Area', 'formidable' ),
599
-            'frm_delete_entries'    => __( 'Delete Entries from Admin Area', 'formidable' ),
600
-        );
593
+		$cap = array(
594
+			'frm_view_forms'        => __( 'View Forms and Templates', 'formidable' ),
595
+			'frm_edit_forms'        => __( 'Add/Edit Forms and Templates', 'formidable' ),
596
+			'frm_delete_forms'      => __( 'Delete Forms and Templates', 'formidable' ),
597
+			'frm_change_settings'   => __( 'Access this Settings Page', 'formidable' ),
598
+			'frm_view_entries'      => __( 'View Entries from Admin Area', 'formidable' ),
599
+			'frm_delete_entries'    => __( 'Delete Entries from Admin Area', 'formidable' ),
600
+		);
601 601
 
602 602
 		if ( ! self::pro_is_installed() && 'pro' != $type ) {
603
-            return $cap;
604
-        }
603
+			return $cap;
604
+		}
605 605
 
606
-        $cap['frm_create_entries'] = __( 'Add Entries from Admin Area', 'formidable' );
607
-        $cap['frm_edit_entries'] = __( 'Edit Entries from Admin Area', 'formidable' );
608
-        $cap['frm_view_reports'] = __( 'View Reports', 'formidable' );
609
-        $cap['frm_edit_displays'] = __( 'Add/Edit Views', 'formidable' );
606
+		$cap['frm_create_entries'] = __( 'Add Entries from Admin Area', 'formidable' );
607
+		$cap['frm_edit_entries'] = __( 'Edit Entries from Admin Area', 'formidable' );
608
+		$cap['frm_view_reports'] = __( 'View Reports', 'formidable' );
609
+		$cap['frm_edit_displays'] = __( 'Add/Edit Views', 'formidable' );
610 610
 
611
-        return $cap;
612
-    }
611
+		return $cap;
612
+	}
613 613
 
614 614
 	public static function user_has_permission( $needed_role ) {
615
-        if ( $needed_role == '-1' ) {
616
-            return false;
615
+		if ( $needed_role == '-1' ) {
616
+			return false;
617 617
 		}
618 618
 
619
-        // $needed_role will be equal to blank if "Logged-in users" is selected
620
-        if ( ( $needed_role == '' && is_user_logged_in() ) || current_user_can( $needed_role ) ) {
621
-            return true;
622
-        }
619
+		// $needed_role will be equal to blank if "Logged-in users" is selected
620
+		if ( ( $needed_role == '' && is_user_logged_in() ) || current_user_can( $needed_role ) ) {
621
+			return true;
622
+		}
623 623
 
624
-        $roles = array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' );
625
-        foreach ( $roles as $role ) {
624
+		$roles = array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' );
625
+		foreach ( $roles as $role ) {
626 626
 			if ( current_user_can( $role ) ) {
627
-        		return true;
627
+				return true;
628 628
 			}
629
-        	if ( $role == $needed_role ) {
630
-        		break;
629
+			if ( $role == $needed_role ) {
630
+				break;
631 631
 			}
632
-        }
633
-        return false;
634
-    }
635
-
636
-    /**
637
-     * Make sure administrators can see Formidable menu
638
-     *
639
-     * @since 2.0
640
-     */
641
-    public static function maybe_add_permissions() {
632
+		}
633
+		return false;
634
+	}
635
+
636
+	/**
637
+	 * Make sure administrators can see Formidable menu
638
+	 *
639
+	 * @since 2.0
640
+	 */
641
+	public static function maybe_add_permissions() {
642 642
 		self::force_capability( 'frm_view_entries' );
643 643
 
644
-        if ( ! current_user_can('administrator') || current_user_can('frm_view_forms') ) {
645
-            return;
646
-        }
644
+		if ( ! current_user_can('administrator') || current_user_can('frm_view_forms') ) {
645
+			return;
646
+		}
647 647
 
648 648
 		$user_id = get_current_user_id();
649 649
 		$user = new WP_User( $user_id );
650
-        $frm_roles = self::frm_capabilities();
651
-        foreach ( $frm_roles as $frm_role => $frm_role_description ) {
650
+		$frm_roles = self::frm_capabilities();
651
+		foreach ( $frm_roles as $frm_role => $frm_role_description ) {
652 652
 			$user->add_cap( $frm_role );
653
-            unset($frm_role, $frm_role_description);
654
-        }
655
-    }
653
+			unset($frm_role, $frm_role_description);
654
+		}
655
+	}
656 656
 
657 657
 	/**
658 658
 	 * Make sure admins have permission to see the menu items
@@ -668,28 +668,28 @@  discard block
 block discarded – undo
668 668
 		}
669 669
 	}
670 670
 
671
-    /**
672
-     * Check if the user has permision for action.
673
-     * Return permission message and stop the action if no permission
674
-     * @since 2.0
675
-     * @param string $permission
676
-     */
671
+	/**
672
+	 * Check if the user has permision for action.
673
+	 * Return permission message and stop the action if no permission
674
+	 * @since 2.0
675
+	 * @param string $permission
676
+	 */
677 677
 	public static function permission_check( $permission, $show_message = 'show' ) {
678
-        $permission_error = self::permission_nonce_error($permission);
679
-        if ( $permission_error !== false ) {
680
-            if ( 'hide' == $show_message ) {
681
-                $permission_error = '';
682
-            }
683
-            wp_die($permission_error);
684
-        }
685
-    }
686
-
687
-    /**
688
-     * Check user permission and nonce
689
-     * @since 2.0
690
-     * @param string $permission
691
-     * @return false|string The permission message or false if allowed
692
-     */
678
+		$permission_error = self::permission_nonce_error($permission);
679
+		if ( $permission_error !== false ) {
680
+			if ( 'hide' == $show_message ) {
681
+				$permission_error = '';
682
+			}
683
+			wp_die($permission_error);
684
+		}
685
+	}
686
+
687
+	/**
688
+	 * Check user permission and nonce
689
+	 * @since 2.0
690
+	 * @param string $permission
691
+	 * @return false|string The permission message or false if allowed
692
+	 */
693 693
 	public static function permission_nonce_error( $permission, $nonce_name = '', $nonce = '' ) {
694 694
 		if ( ! empty( $permission ) && ! current_user_can( $permission ) && ! current_user_can( 'administrator' ) ) {
695 695
 			$frm_settings = self::get_settings();
@@ -697,75 +697,75 @@  discard block
 block discarded – undo
697 697
 		}
698 698
 
699 699
 		$error = false;
700
-        if ( empty($nonce_name) ) {
701
-            return $error;
702
-        }
700
+		if ( empty($nonce_name) ) {
701
+			return $error;
702
+		}
703 703
 
704
-        if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
705
-            $frm_settings = self::get_settings();
706
-            $error = $frm_settings->admin_permission;
707
-        }
704
+		if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
705
+			$frm_settings = self::get_settings();
706
+			$error = $frm_settings->admin_permission;
707
+		}
708 708
 
709
-        return $error;
710
-    }
709
+		return $error;
710
+	}
711 711
 
712
-    public static function checked( $values, $current ) {
712
+	public static function checked( $values, $current ) {
713 713
 		if ( self::check_selected( $values, $current ) ) {
714
-            echo ' checked="checked"';
714
+			echo ' checked="checked"';
715 715
 		}
716
-    }
716
+	}
717 717
 
718 718
 	public static function check_selected( $values, $current ) {
719
-        $values = self::recursive_function_map( $values, 'trim' );
720
-        $current = trim($current);
721
-
722
-        return ( is_array($values) && in_array($current, $values) ) || ( ! is_array($values) && $values == $current );
723
-    }
724
-
725
-    /**
726
-    * Check if current field option is an "other" option
727
-    *
728
-    * @since 2.0
729
-    *
730
-    * @param string $opt_key
731
-    * @return boolean Returns true if current field option is an "Other" option
732
-    */
733
-    public static function is_other_opt( $opt_key ) {
734
-        _deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::is_other_opt' );
735
-        return FrmFieldsHelper::is_other_opt( $opt_key );
736
-    }
737
-
738
-    /**
739
-    * Get value that belongs in "Other" text box
740
-    *
741
-    * @since 2.0
742
-    *
743
-    * @param string $opt_key
744
-    * @param array $field
745
-    * @return string $other_val
746
-    */
747
-    public static function get_other_val( $opt_key, $field, $parent = false, $pointer = false ) {
719
+		$values = self::recursive_function_map( $values, 'trim' );
720
+		$current = trim($current);
721
+
722
+		return ( is_array($values) && in_array($current, $values) ) || ( ! is_array($values) && $values == $current );
723
+	}
724
+
725
+	/**
726
+	 * Check if current field option is an "other" option
727
+	 *
728
+	 * @since 2.0
729
+	 *
730
+	 * @param string $opt_key
731
+	 * @return boolean Returns true if current field option is an "Other" option
732
+	 */
733
+	public static function is_other_opt( $opt_key ) {
734
+		_deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::is_other_opt' );
735
+		return FrmFieldsHelper::is_other_opt( $opt_key );
736
+	}
737
+
738
+	/**
739
+	 * Get value that belongs in "Other" text box
740
+	 *
741
+	 * @since 2.0
742
+	 *
743
+	 * @param string $opt_key
744
+	 * @param array $field
745
+	 * @return string $other_val
746
+	 */
747
+	public static function get_other_val( $opt_key, $field, $parent = false, $pointer = false ) {
748 748
 		_deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::get_other_val' );
749 749
 		return FrmFieldsHelper::get_other_val( compact( 'opt_key', 'field', 'parent', 'pointer' ) );
750
-    }
751
-
752
-    /**
753
-    * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
754
-    * Intended for front-end use
755
-    *
756
-    * @since 2.0
757
-    *
758
-    * @param array $field
759
-    * @param boolean $other_opt
760
-    * @param string $checked
761
-    * @param array $args should include opt_key and field name
762
-    * @return string $other_val
763
-    */
764
-    public static function prepare_other_input( $field, &$other_opt, &$checked, $args = array() ) {
750
+	}
751
+
752
+	/**
753
+	 * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
754
+	 * Intended for front-end use
755
+	 *
756
+	 * @since 2.0
757
+	 *
758
+	 * @param array $field
759
+	 * @param boolean $other_opt
760
+	 * @param string $checked
761
+	 * @param array $args should include opt_key and field name
762
+	 * @return string $other_val
763
+	 */
764
+	public static function prepare_other_input( $field, &$other_opt, &$checked, $args = array() ) {
765 765
 		_deprecated_function( __FUNCTION__, '2.0.6', 'FrmFieldsHelper::prepare_other_input' );
766 766
 		$args['field'] = $field;
767 767
 		return FrmFieldsHelper::prepare_other_input( $args, $other_opt, $checked );
768
-    }
768
+	}
769 769
 
770 770
 	public static function recursive_function_map( $value, $function ) {
771 771
 		if ( is_array( $value ) ) {
@@ -795,331 +795,331 @@  discard block
 block discarded – undo
795 795
 		return (bool) count( array_filter( array_keys( $array ), 'is_string' ) );
796 796
 	}
797 797
 
798
-    /**
799
-     * Flatten a multi-dimensional array
800
-     */
798
+	/**
799
+	 * Flatten a multi-dimensional array
800
+	 */
801 801
 	public static function array_flatten( $array, $keys = 'keep' ) {
802
-        $return = array();
803
-        foreach ( $array as $key => $value ) {
804
-            if ( is_array($value) ) {
802
+		$return = array();
803
+		foreach ( $array as $key => $value ) {
804
+			if ( is_array($value) ) {
805 805
 				$return = array_merge( $return, self::array_flatten( $value, $keys ) );
806
-            } else {
806
+			} else {
807 807
 				if ( $keys == 'keep' ) {
808 808
 					$return[ $key ] = $value;
809 809
 				} else {
810 810
 					$return[] = $value;
811 811
 				}
812
-            }
813
-        }
814
-        return $return;
815
-    }
816
-
817
-    public static function esc_textarea( $text ) {
818
-        $safe_text = str_replace('&quot;', '"', $text);
819
-        $safe_text = htmlspecialchars( $safe_text, ENT_NOQUOTES );
820
-    	return apply_filters( 'esc_textarea', $safe_text, $text );
821
-    }
822
-
823
-    /**
824
-     * Add auto paragraphs to text areas
825
-     * @since 2.0
826
-     */
812
+			}
813
+		}
814
+		return $return;
815
+	}
816
+
817
+	public static function esc_textarea( $text ) {
818
+		$safe_text = str_replace('&quot;', '"', $text);
819
+		$safe_text = htmlspecialchars( $safe_text, ENT_NOQUOTES );
820
+		return apply_filters( 'esc_textarea', $safe_text, $text );
821
+	}
822
+
823
+	/**
824
+	 * Add auto paragraphs to text areas
825
+	 * @since 2.0
826
+	 */
827 827
 	public static function use_wpautop( $content ) {
828
-        if ( apply_filters('frm_use_wpautop', true) ) {
829
-            $content = wpautop(str_replace( '<br>', '<br />', $content));
830
-        }
831
-        return $content;
832
-    }
828
+		if ( apply_filters('frm_use_wpautop', true) ) {
829
+			$content = wpautop(str_replace( '<br>', '<br />', $content));
830
+		}
831
+		return $content;
832
+	}
833 833
 
834 834
 	public static function replace_quotes( $val ) {
835
-        //Replace double quotes
835
+		//Replace double quotes
836 836
 		$val = str_replace( array( '&#8220;', '&#8221;', '&#8243;' ), '"', $val );
837
-        //Replace single quotes
838
-        $val = str_replace( array( '&#8216;', '&#8217;', '&#8242;', '&prime;', '&rsquo;', '&lsquo;' ), "'", $val );
839
-        return $val;
840
-    }
841
-
842
-    /**
843
-     * @since 2.0
844
-     * @return string The base Google APIS url for the current version of jQuery UI
845
-     */
846
-    public static function jquery_ui_base_url() {
847
-        $url = 'http'. ( is_ssl() ? 's' : '' ) .'://ajax.googleapis.com/ajax/libs/jqueryui/'. self::script_version('jquery-ui-core');
848
-        $url = apply_filters('frm_jquery_ui_base_url', $url);
849
-        return $url;
850
-    }
851
-
852
-    /**
853
-     * @param string $handle
854
-     */
837
+		//Replace single quotes
838
+		$val = str_replace( array( '&#8216;', '&#8217;', '&#8242;', '&prime;', '&rsquo;', '&lsquo;' ), "'", $val );
839
+		return $val;
840
+	}
841
+
842
+	/**
843
+	 * @since 2.0
844
+	 * @return string The base Google APIS url for the current version of jQuery UI
845
+	 */
846
+	public static function jquery_ui_base_url() {
847
+		$url = 'http'. ( is_ssl() ? 's' : '' ) .'://ajax.googleapis.com/ajax/libs/jqueryui/'. self::script_version('jquery-ui-core');
848
+		$url = apply_filters('frm_jquery_ui_base_url', $url);
849
+		return $url;
850
+	}
851
+
852
+	/**
853
+	 * @param string $handle
854
+	 */
855 855
 	public static function script_version( $handle ) {
856
-        global $wp_scripts;
857
-    	if ( ! $wp_scripts ) {
858
-    	    return false;
859
-    	}
856
+		global $wp_scripts;
857
+		if ( ! $wp_scripts ) {
858
+			return false;
859
+		}
860 860
 
861
-        $ver = 0;
861
+		$ver = 0;
862 862
 
863
-        if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {
864
-            return $ver;
865
-        }
863
+		if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {
864
+			return $ver;
865
+		}
866 866
 
867
-        $query = $wp_scripts->registered[ $handle ];
868
-    	if ( is_object( $query ) ) {
869
-    	    $ver = $query->ver;
870
-    	}
867
+		$query = $wp_scripts->registered[ $handle ];
868
+		if ( is_object( $query ) ) {
869
+			$ver = $query->ver;
870
+		}
871 871
 
872
-    	return $ver;
873
-    }
872
+		return $ver;
873
+	}
874 874
 
875 875
 	public static function js_redirect( $url ) {
876 876
 		return '<script type="text/javascript">window.location="' . esc_url_raw( $url ) . '"</script>';
877
-    }
877
+	}
878 878
 
879 879
 	public static function get_user_id_param( $user_id ) {
880
-        if ( ! $user_id || empty($user_id) || is_numeric($user_id) ) {
881
-            return $user_id;
882
-        }
880
+		if ( ! $user_id || empty($user_id) || is_numeric($user_id) ) {
881
+			return $user_id;
882
+		}
883 883
 
884 884
 		if ( $user_id == 'current' ) {
885 885
 			$user_id = get_current_user_id();
886 886
 		} else {
887
-            if ( is_email($user_id) ) {
888
-                $user = get_user_by('email', $user_id);
889
-            } else {
890
-                $user = get_user_by('login', $user_id);
891
-            }
887
+			if ( is_email($user_id) ) {
888
+				$user = get_user_by('email', $user_id);
889
+			} else {
890
+				$user = get_user_by('login', $user_id);
891
+			}
892 892
 
893
-            if ( $user ) {
894
-                $user_id = $user->ID;
895
-            }
896
-            unset($user);
897
-        }
893
+			if ( $user ) {
894
+				$user_id = $user->ID;
895
+			}
896
+			unset($user);
897
+		}
898 898
 
899
-        return $user_id;
900
-    }
899
+		return $user_id;
900
+	}
901 901
 
902 902
 	public static function get_file_contents( $filename, $atts = array() ) {
903
-        if ( ! is_file($filename) ) {
904
-            return false;
905
-        }
906
-
907
-        extract($atts);
908
-        ob_start();
909
-        include($filename);
910
-        $contents = ob_get_contents();
911
-        ob_end_clean();
912
-        return $contents;
913
-    }
914
-
915
-    /**
916
-     * @param string $table_name
917
-     * @param string $column
903
+		if ( ! is_file($filename) ) {
904
+			return false;
905
+		}
906
+
907
+		extract($atts);
908
+		ob_start();
909
+		include($filename);
910
+		$contents = ob_get_contents();
911
+		ob_end_clean();
912
+		return $contents;
913
+	}
914
+
915
+	/**
916
+	 * @param string $table_name
917
+	 * @param string $column
918 918
 	 * @param int $id
919 919
 	 * @param int $num_chars
920
-     */
921
-    public static function get_unique_key( $name = '', $table_name, $column, $id = 0, $num_chars = 5 ) {
922
-        $key = '';
920
+	 */
921
+	public static function get_unique_key( $name = '', $table_name, $column, $id = 0, $num_chars = 5 ) {
922
+		$key = '';
923 923
 
924
-        if ( ! empty( $name ) ) {
925
-            $key = sanitize_key($name);
926
-        }
924
+		if ( ! empty( $name ) ) {
925
+			$key = sanitize_key($name);
926
+		}
927 927
 
928 928
 		if ( empty( $key ) ) {
929
-            $max_slug_value = pow(36, $num_chars);
930
-            $min_slug_value = 37; // we want to have at least 2 characters in the slug
931
-            $key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
932
-        }
929
+			$max_slug_value = pow(36, $num_chars);
930
+			$min_slug_value = 37; // we want to have at least 2 characters in the slug
931
+			$key = base_convert( rand($min_slug_value, $max_slug_value), 10, 36 );
932
+		}
933 933
 
934 934
 		if ( is_numeric($key) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
935
-            $key = $key .'a';
936
-        }
935
+			$key = $key .'a';
936
+		}
937 937
 
938 938
 		$key_check = FrmDb::get_var( $table_name, array( $column => $key, 'ID !' => $id ), $column );
939 939
 
940
-        if ( $key_check || is_numeric($key_check) ) {
941
-            $suffix = 2;
940
+		if ( $key_check || is_numeric($key_check) ) {
941
+			$suffix = 2;
942 942
 			do {
943 943
 				$alt_post_name = substr( $key, 0, 200 - ( strlen( $suffix ) + 1 ) ) . $suffix;
944 944
 				$key_check = FrmDb::get_var( $table_name, array( $column => $alt_post_name, 'ID !' => $id ), $column );
945 945
 				$suffix++;
946 946
 			} while ($key_check || is_numeric($key_check));
947 947
 			$key = $alt_post_name;
948
-        }
949
-        return $key;
950
-    }
951
-
952
-    /**
953
-     * Editing a Form or Entry
954
-     * @param string $table
955
-     * @return bool|array
956
-     */
957
-    public static function setup_edit_vars( $record, $table, $fields = '', $default = false, $post_values = array(), $args = array() ) {
958
-        if ( ! $record ) {
959
-            return false;
960
-        }
961
-
962
-        if ( empty($post_values) ) {
963
-            $post_values = stripslashes_deep($_POST);
964
-        }
948
+		}
949
+		return $key;
950
+	}
951
+
952
+	/**
953
+	 * Editing a Form or Entry
954
+	 * @param string $table
955
+	 * @return bool|array
956
+	 */
957
+	public static function setup_edit_vars( $record, $table, $fields = '', $default = false, $post_values = array(), $args = array() ) {
958
+		if ( ! $record ) {
959
+			return false;
960
+		}
961
+
962
+		if ( empty($post_values) ) {
963
+			$post_values = stripslashes_deep($_POST);
964
+		}
965 965
 
966 966
 		$values = array( 'id' => $record->id, 'fields' => array() );
967 967
 
968 968
 		foreach ( array( 'name', 'description' ) as $var ) {
969
-            $default_val = isset($record->{$var}) ? $record->{$var} : '';
970
-            $values[ $var ] = self::get_param( $var, $default_val );
971
-            unset($var, $default_val);
972
-        }
973
-
974
-        $values['description'] = self::use_wpautop($values['description']);
975
-        $frm_settings = self::get_settings();
976
-        $is_form_builder = self::is_admin_page('formidable' );
977
-
978
-        foreach ( (array) $fields as $field ) {
979
-            // Make sure to filter default values (for placeholder text), but not on the form builder page
980
-            if ( ! $is_form_builder ) {
981
-                $field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true );
982
-            }
969
+			$default_val = isset($record->{$var}) ? $record->{$var} : '';
970
+			$values[ $var ] = self::get_param( $var, $default_val );
971
+			unset($var, $default_val);
972
+		}
973
+
974
+		$values['description'] = self::use_wpautop($values['description']);
975
+		$frm_settings = self::get_settings();
976
+		$is_form_builder = self::is_admin_page('formidable' );
977
+
978
+		foreach ( (array) $fields as $field ) {
979
+			// Make sure to filter default values (for placeholder text), but not on the form builder page
980
+			if ( ! $is_form_builder ) {
981
+				$field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true );
982
+			}
983 983
 			$parent_form_id = isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id;
984 984
 			self::fill_field_defaults($field, $record, $values, compact('default', 'post_values', 'frm_settings', 'parent_form_id' ) );
985
-        }
985
+		}
986 986
 
987
-        self::fill_form_opts($record, $table, $post_values, $values);
987
+		self::fill_form_opts($record, $table, $post_values, $values);
988 988
 
989
-        if ( $table == 'entries' ) {
990
-            $values = FrmEntriesHelper::setup_edit_vars( $values, $record );
991
-        } else if ( $table == 'forms' ) {
992
-            $values = FrmFormsHelper::setup_edit_vars( $values, $record, $post_values );
993
-        }
989
+		if ( $table == 'entries' ) {
990
+			$values = FrmEntriesHelper::setup_edit_vars( $values, $record );
991
+		} else if ( $table == 'forms' ) {
992
+			$values = FrmFormsHelper::setup_edit_vars( $values, $record, $post_values );
993
+		}
994 994
 
995
-        return $values;
996
-    }
995
+		return $values;
996
+	}
997 997
 
998 998
 	private static function fill_field_defaults( $field, $record, array &$values, $args ) {
999
-        $post_values = $args['post_values'];
1000
-
1001
-        if ( $args['default'] ) {
1002
-            $meta_value = $field->default_value;
1003
-        } else {
1004
-            if ( $record->post_id && self::pro_is_installed() && isset($field->field_options['post_field']) && $field->field_options['post_field'] ) {
1005
-                if ( ! isset($field->field_options['custom_field']) ) {
1006
-                    $field->field_options['custom_field'] = '';
1007
-                }
999
+		$post_values = $args['post_values'];
1000
+
1001
+		if ( $args['default'] ) {
1002
+			$meta_value = $field->default_value;
1003
+		} else {
1004
+			if ( $record->post_id && self::pro_is_installed() && isset($field->field_options['post_field']) && $field->field_options['post_field'] ) {
1005
+				if ( ! isset($field->field_options['custom_field']) ) {
1006
+					$field->field_options['custom_field'] = '';
1007
+				}
1008 1008
 				$meta_value = FrmProEntryMetaHelper::get_post_value( $record->post_id, $field->field_options['post_field'], $field->field_options['custom_field'], array( 'truncate' => false, 'type' => $field->type, 'form_id' => $field->form_id, 'field' => $field ) );
1009
-            } else {
1009
+			} else {
1010 1010
 				$meta_value = FrmEntryMeta::get_meta_value( $record, $field->id );
1011
-            }
1012
-        }
1013
-
1014
-        $field_type = isset( $post_values['field_options'][ 'type_'. $field->id ] ) ? $post_values['field_options'][ 'type_'. $field->id ] : $field->type;
1015
-        $new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1016
-
1017
-        $field_array = array(
1018
-            'id'            => $field->id,
1019
-            'value'         => $new_value,
1020
-            'default_value' => $field->default_value,
1021
-            'name'          => $field->name,
1022
-            'description'   => $field->description,
1023
-            'type'          => apply_filters('frm_field_type', $field_type, $field, $new_value),
1024
-            'options'       => $field->options,
1025
-            'required'      => $field->required,
1026
-            'field_key'     => $field->field_key,
1027
-            'field_order'   => $field->field_order,
1028
-            'form_id'       => $field->form_id,
1011
+			}
1012
+		}
1013
+
1014
+		$field_type = isset( $post_values['field_options'][ 'type_'. $field->id ] ) ? $post_values['field_options'][ 'type_'. $field->id ] : $field->type;
1015
+		$new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1016
+
1017
+		$field_array = array(
1018
+			'id'            => $field->id,
1019
+			'value'         => $new_value,
1020
+			'default_value' => $field->default_value,
1021
+			'name'          => $field->name,
1022
+			'description'   => $field->description,
1023
+			'type'          => apply_filters('frm_field_type', $field_type, $field, $new_value),
1024
+			'options'       => $field->options,
1025
+			'required'      => $field->required,
1026
+			'field_key'     => $field->field_key,
1027
+			'field_order'   => $field->field_order,
1028
+			'form_id'       => $field->form_id,
1029 1029
 			'parent_form_id' => $args['parent_form_id'],
1030
-        );
1030
+		);
1031 1031
 
1032
-        $args['field_type'] = $field_type;
1033
-        self::fill_field_opts($field, $field_array, $args);
1032
+		$args['field_type'] = $field_type;
1033
+		self::fill_field_opts($field, $field_array, $args);
1034 1034
 
1035
-        $field_array = apply_filters('frm_setup_edit_fields_vars', $field_array, $field, $values['id']);
1035
+		$field_array = apply_filters('frm_setup_edit_fields_vars', $field_array, $field, $values['id']);
1036 1036
 
1037
-        if ( ! isset($field_array['unique']) || ! $field_array['unique'] ) {
1038
-            $field_array['unique_msg'] = '';
1039
-        }
1037
+		if ( ! isset($field_array['unique']) || ! $field_array['unique'] ) {
1038
+			$field_array['unique_msg'] = '';
1039
+		}
1040 1040
 
1041
-        $field_array = array_merge( $field->field_options, $field_array );
1041
+		$field_array = array_merge( $field->field_options, $field_array );
1042 1042
 
1043
-        $values['fields'][ $field->id ] = $field_array;
1044
-    }
1043
+		$values['fields'][ $field->id ] = $field_array;
1044
+	}
1045 1045
 
1046 1046
 	private static function fill_field_opts( $field, array &$field_array, $args ) {
1047
-        $post_values = $args['post_values'];
1048
-        $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
1049
-
1050
-        foreach ( $opt_defaults as $opt => $default_opt ) {
1051
-            $field_array[ $opt ] = ( $post_values && isset( $post_values['field_options'][ $opt .'_'. $field->id ] ) ) ? maybe_unserialize( $post_values['field_options'][ $opt .'_'. $field->id ] ) : ( isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default_opt );
1052
-            if ( $opt == 'blank' && $field_array[ $opt ] == '' ) {
1053
-                $field_array[ $opt ] = $args['frm_settings']->blank_msg;
1054
-            } else if ( $opt == 'invalid' && $field_array[ $opt ] == '' ) {
1055
-                if ( $args['field_type'] == 'captcha' ) {
1056
-                    $field_array[ $opt ] = $args['frm_settings']->re_msg;
1057
-                } else {
1058
-                    $field_array[ $opt ] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1059
-                }
1060
-            }
1061
-        }
1062
-
1063
-        if ( $field_array['custom_html'] == '' ) {
1064
-            $field_array['custom_html'] = FrmFieldsHelper::get_default_html($args['field_type']);
1065
-        }
1066
-    }
1067
-
1068
-    /**
1069
-     * @param string $table
1070
-     */
1047
+		$post_values = $args['post_values'];
1048
+		$opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
1049
+
1050
+		foreach ( $opt_defaults as $opt => $default_opt ) {
1051
+			$field_array[ $opt ] = ( $post_values && isset( $post_values['field_options'][ $opt .'_'. $field->id ] ) ) ? maybe_unserialize( $post_values['field_options'][ $opt .'_'. $field->id ] ) : ( isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default_opt );
1052
+			if ( $opt == 'blank' && $field_array[ $opt ] == '' ) {
1053
+				$field_array[ $opt ] = $args['frm_settings']->blank_msg;
1054
+			} else if ( $opt == 'invalid' && $field_array[ $opt ] == '' ) {
1055
+				if ( $args['field_type'] == 'captcha' ) {
1056
+					$field_array[ $opt ] = $args['frm_settings']->re_msg;
1057
+				} else {
1058
+					$field_array[ $opt ] = sprintf( __( '%s is invalid', 'formidable' ), $field_array['name'] );
1059
+				}
1060
+			}
1061
+		}
1062
+
1063
+		if ( $field_array['custom_html'] == '' ) {
1064
+			$field_array['custom_html'] = FrmFieldsHelper::get_default_html($args['field_type']);
1065
+		}
1066
+	}
1067
+
1068
+	/**
1069
+	 * @param string $table
1070
+	 */
1071 1071
 	private static function fill_form_opts( $record, $table, $post_values, array &$values ) {
1072
-        if ( $table == 'entries' ) {
1073
-            $form = $record->form_id;
1072
+		if ( $table == 'entries' ) {
1073
+			$form = $record->form_id;
1074 1074
 			FrmForm::maybe_get_form( $form );
1075
-        } else {
1076
-            $form = $record;
1077
-        }
1075
+		} else {
1076
+			$form = $record;
1077
+		}
1078 1078
 
1079
-        if ( ! $form ) {
1080
-            return;
1081
-        }
1079
+		if ( ! $form ) {
1080
+			return;
1081
+		}
1082 1082
 
1083
-        $values['form_name'] = isset($record->form_id) ? $form->name : '';
1083
+		$values['form_name'] = isset($record->form_id) ? $form->name : '';
1084 1084
 		$values['parent_form_id'] = isset( $record->form_id ) ? $form->parent_form_id : 0;
1085 1085
 
1086
-        if ( ! is_array($form->options) ) {
1087
-            return;
1088
-        }
1086
+		if ( ! is_array($form->options) ) {
1087
+			return;
1088
+		}
1089 1089
 
1090
-        foreach ( $form->options as $opt => $value ) {
1091
-            $values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1092
-        }
1090
+		foreach ( $form->options as $opt => $value ) {
1091
+			$values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1092
+		}
1093 1093
 
1094
-        self::fill_form_defaults($post_values, $values);
1095
-    }
1094
+		self::fill_form_defaults($post_values, $values);
1095
+	}
1096 1096
 
1097
-    /**
1098
-     * Set to POST value or default
1099
-     */
1097
+	/**
1098
+	 * Set to POST value or default
1099
+	 */
1100 1100
 	private static function fill_form_defaults( $post_values, array &$values ) {
1101
-        $form_defaults = FrmFormsHelper::get_default_opts();
1101
+		$form_defaults = FrmFormsHelper::get_default_opts();
1102 1102
 
1103
-        foreach ( $form_defaults as $opt => $default ) {
1104
-            if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1103
+		foreach ( $form_defaults as $opt => $default ) {
1104
+			if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1105 1105
 				$values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
1106
-            }
1106
+			}
1107 1107
 
1108
-            unset($opt, $defaut);
1109
-        }
1108
+			unset($opt, $defaut);
1109
+		}
1110 1110
 
1111
-        if ( ! isset($values['custom_style']) ) {
1112
-            $frm_settings = self::get_settings();
1111
+		if ( ! isset($values['custom_style']) ) {
1112
+			$frm_settings = self::get_settings();
1113 1113
 			$values['custom_style'] = ( $post_values && isset( $post_values['options']['custom_style'] ) ) ? absint( $_POST['options']['custom_style'] ) : ( $frm_settings->load_style != 'none' );
1114
-        }
1114
+		}
1115 1115
 
1116 1116
 		foreach ( array( 'before', 'after', 'submit' ) as $h ) {
1117
-            if ( ! isset( $values[ $h .'_html' ] ) ) {
1118
-                $values[ $h .'_html' ] = ( isset( $post_values['options'][ $h .'_html' ] ) ? $post_values['options'][ $h .'_html' ] : FrmFormsHelper::get_default_html( $h ) );
1119
-            }
1120
-            unset($h);
1121
-        }
1122
-    }
1117
+			if ( ! isset( $values[ $h .'_html' ] ) ) {
1118
+				$values[ $h .'_html' ] = ( isset( $post_values['options'][ $h .'_html' ] ) ? $post_values['options'][ $h .'_html' ] : FrmFormsHelper::get_default_html( $h ) );
1119
+			}
1120
+			unset($h);
1121
+		}
1122
+	}
1123 1123
 
1124 1124
 	public static function get_meta_value( $field_id, $entry ) {
1125 1125
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmEntryMeta::get_meta_value' );
@@ -1127,69 +1127,69 @@  discard block
 block discarded – undo
1127 1127
 	}
1128 1128
 
1129 1129
 	public static function insert_opt_html( $args ) {
1130
-        $class = '';
1131
-        if ( in_array( $args['type'], array( 'email', 'user_id', 'hidden', 'select', 'radio', 'checkbox', 'phone', 'text' ) ) ) {
1132
-            $class .= 'show_frm_not_email_to';
1133
-        }
1134
-    ?>
1130
+		$class = '';
1131
+		if ( in_array( $args['type'], array( 'email', 'user_id', 'hidden', 'select', 'radio', 'checkbox', 'phone', 'text' ) ) ) {
1132
+			$class .= 'show_frm_not_email_to';
1133
+		}
1134
+	?>
1135 1135
 <li>
1136 1136
     <a href="javascript:void(0)" class="frmids frm_insert_code alignright <?php echo esc_attr($class) ?>" data-code="<?php echo esc_attr($args['id']) ?>" >[<?php echo esc_attr( $args['id'] ) ?>]</a>
1137 1137
     <a href="javascript:void(0)" class="frmkeys frm_insert_code alignright <?php echo esc_attr($class) ?>" data-code="<?php echo esc_attr($args['key']) ?>" >[<?php echo esc_attr( self::truncate($args['key'], 10) ) ?>]</a>
1138 1138
     <a href="javascript:void(0)" class="frm_insert_code <?php echo esc_attr( $class ) ?>" data-code="<?php echo esc_attr($args['id']) ?>" ><?php echo esc_attr( self::truncate($args['name'], 60) ) ?></a>
1139 1139
 </li>
1140 1140
     <?php
1141
-    }
1141
+	}
1142 1142
 
1143
-    public static function get_us_states() {
1144
-        _deprecated_function( __FUNCTION__, '2.0', 'FrmFieldsHelper::get_us_states' );
1145
-        return FrmFieldsHelper::get_us_states();
1146
-    }
1143
+	public static function get_us_states() {
1144
+		_deprecated_function( __FUNCTION__, '2.0', 'FrmFieldsHelper::get_us_states' );
1145
+		return FrmFieldsHelper::get_us_states();
1146
+	}
1147 1147
 
1148
-    public static function get_countries() {
1149
-        _deprecated_function( __FUNCTION__, '2.0', 'FrmFieldsHelper::get_countries' );
1150
-        return FrmFieldsHelper::get_countries();
1151
-    }
1148
+	public static function get_countries() {
1149
+		_deprecated_function( __FUNCTION__, '2.0', 'FrmFieldsHelper::get_countries' );
1150
+		return FrmFieldsHelper::get_countries();
1151
+	}
1152 1152
 
1153 1153
 	public static function truncate( $str, $length, $minword = 3, $continue = '...' ) {
1154
-        if ( is_array( $str ) ) {
1155
-            return;
1154
+		if ( is_array( $str ) ) {
1155
+			return;
1156 1156
 		}
1157 1157
 
1158
-        $length = (int) $length;
1158
+		$length = (int) $length;
1159 1159
 		$str = wp_strip_all_tags( $str );
1160 1160
 		$original_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $str ) );
1161 1161
 
1162 1162
 		if ( $length == 0 ) {
1163
-            return '';
1164
-        } else if ( $length <= 10 ) {
1163
+			return '';
1164
+		} else if ( $length <= 10 ) {
1165 1165
 			$sub = self::mb_function( array( 'mb_substr', 'substr' ), array( $str, 0, $length ) );
1166
-            return $sub . (($length < $original_len) ? $continue : '');
1167
-        }
1166
+			return $sub . (($length < $original_len) ? $continue : '');
1167
+		}
1168 1168
 
1169
-        $sub = '';
1170
-        $len = 0;
1169
+		$sub = '';
1170
+		$len = 0;
1171 1171
 
1172 1172
 		$words = self::mb_function( array( 'mb_split', 'explode' ), array( ' ', $str ) );
1173 1173
 
1174 1174
 		foreach ( $words as $word ) {
1175
-            $part = (($sub != '') ? ' ' : '') . $word;
1175
+			$part = (($sub != '') ? ' ' : '') . $word;
1176 1176
 			$total_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $sub . $part ) );
1177
-            if ( $total_len > $length && str_word_count($sub) ) {
1178
-                break;
1179
-            }
1177
+			if ( $total_len > $length && str_word_count($sub) ) {
1178
+				break;
1179
+			}
1180 1180
 
1181
-            $sub .= $part;
1181
+			$sub .= $part;
1182 1182
 			$len += self::mb_function( array( 'mb_strlen', 'strlen' ), array( $part ) );
1183 1183
 
1184
-            if ( str_word_count($sub) > $minword && $total_len >= $length ) {
1185
-                break;
1186
-            }
1184
+			if ( str_word_count($sub) > $minword && $total_len >= $length ) {
1185
+				break;
1186
+			}
1187 1187
 
1188
-            unset($total_len, $word);
1189
-        }
1188
+			unset($total_len, $word);
1189
+		}
1190 1190
 
1191
-        return $sub . (($len < $original_len) ? $continue : '');
1192
-    }
1191
+		return $sub . (($len < $original_len) ? $continue : '');
1192
+	}
1193 1193
 
1194 1194
 	public static function mb_function( $function_names, $args ) {
1195 1195
 		$mb_function_name = $function_names[0];
@@ -1201,18 +1201,18 @@  discard block
 block discarded – undo
1201 1201
 	}
1202 1202
 
1203 1203
 	public static function get_formatted_time( $date, $date_format = '', $time_format = '' ) {
1204
-        if ( empty($date) ) {
1205
-            return $date;
1206
-        }
1204
+		if ( empty($date) ) {
1205
+			return $date;
1206
+		}
1207 1207
 
1208
-        if ( empty($date_format) ) {
1209
-            $date_format = get_option('date_format');
1210
-        }
1208
+		if ( empty($date_format) ) {
1209
+			$date_format = get_option('date_format');
1210
+		}
1211 1211
 
1212
-        if ( preg_match('/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date) && self::pro_is_installed() ) {
1213
-            $frmpro_settings = new FrmProSettings();
1214
-            $date = FrmProAppHelper::convert_date($date, $frmpro_settings->date_format, 'Y-m-d');
1215
-        }
1212
+		if ( preg_match('/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date) && self::pro_is_installed() ) {
1213
+			$frmpro_settings = new FrmProSettings();
1214
+			$date = FrmProAppHelper::convert_date($date, $frmpro_settings->date_format, 'Y-m-d');
1215
+		}
1216 1216
 
1217 1217
 		$formatted = self::get_localized_date( $date_format, $date );
1218 1218
 
@@ -1221,8 +1221,8 @@  discard block
 block discarded – undo
1221 1221
 			$formatted .= self::add_time_to_date( $time_format, $date );
1222 1222
 		}
1223 1223
 
1224
-        return $formatted;
1225
-    }
1224
+		return $formatted;
1225
+	}
1226 1226
 
1227 1227
 	private static function add_time_to_date( $time_format, $date ) {
1228 1228
 		if ( empty( $time_format ) ) {
@@ -1303,61 +1303,61 @@  discard block
 block discarded – undo
1303 1303
 		);
1304 1304
 	}
1305 1305
 
1306
-    /**
1307
-     * Added for < WP 4.0 compatability
1308
-     *
1309
-     * @since 1.07.10
1310
-     *
1311
-     * @param string $term The value to escape
1312
-     * @return string The escaped value
1313
-     */
1306
+	/**
1307
+	 * Added for < WP 4.0 compatability
1308
+	 *
1309
+	 * @since 1.07.10
1310
+	 *
1311
+	 * @param string $term The value to escape
1312
+	 * @return string The escaped value
1313
+	 */
1314 1314
 	public static function esc_like( $term ) {
1315
-        global $wpdb;
1316
-        if ( method_exists($wpdb, 'esc_like') ) {
1315
+		global $wpdb;
1316
+		if ( method_exists($wpdb, 'esc_like') ) {
1317 1317
 			// WP 4.0
1318
-            $term = $wpdb->esc_like( $term );
1319
-        } else {
1320
-            $term = like_escape( $term );
1321
-        }
1318
+			$term = $wpdb->esc_like( $term );
1319
+		} else {
1320
+			$term = like_escape( $term );
1321
+		}
1322 1322
 
1323
-        return $term;
1324
-    }
1323
+		return $term;
1324
+	}
1325 1325
 
1326
-    /**
1327
-     * @param string $order_query
1328
-     */
1326
+	/**
1327
+	 * @param string $order_query
1328
+	 */
1329 1329
 	public static function esc_order( $order_query ) {
1330
-        if ( empty($order_query) ) {
1331
-            return '';
1332
-        }
1333
-
1334
-        // remove ORDER BY before santizing
1335
-        $order_query = strtolower($order_query);
1336
-        if ( strpos($order_query, 'order by') !== false ) {
1337
-            $order_query = str_replace('order by', '', $order_query);
1338
-        }
1339
-
1340
-        $order_query = explode(' ', trim($order_query));
1341
-
1342
-        $order_fields = array(
1343
-            'id', 'form_key', 'name', 'description',
1344
-            'parent_form_id', 'logged_in', 'is_template',
1345
-            'default_template', 'status', 'created_at',
1346
-        );
1347
-
1348
-        $order = trim(trim(reset($order_query), ','));
1349
-        if ( ! in_array($order, $order_fields) ) {
1350
-            return '';
1351
-        }
1352
-
1353
-        $order_by = '';
1354
-        if ( count($order_query) > 1 ) {
1330
+		if ( empty($order_query) ) {
1331
+			return '';
1332
+		}
1333
+
1334
+		// remove ORDER BY before santizing
1335
+		$order_query = strtolower($order_query);
1336
+		if ( strpos($order_query, 'order by') !== false ) {
1337
+			$order_query = str_replace('order by', '', $order_query);
1338
+		}
1339
+
1340
+		$order_query = explode(' ', trim($order_query));
1341
+
1342
+		$order_fields = array(
1343
+			'id', 'form_key', 'name', 'description',
1344
+			'parent_form_id', 'logged_in', 'is_template',
1345
+			'default_template', 'status', 'created_at',
1346
+		);
1347
+
1348
+		$order = trim(trim(reset($order_query), ','));
1349
+		if ( ! in_array($order, $order_fields) ) {
1350
+			return '';
1351
+		}
1352
+
1353
+		$order_by = '';
1354
+		if ( count($order_query) > 1 ) {
1355 1355
 			$order_by = end( $order_query );
1356 1356
 			self::esc_order_by( $order_by );
1357
-        }
1357
+		}
1358 1358
 
1359
-        return ' ORDER BY '. $order . ' '. $order_by;
1360
-    }
1359
+		return ' ORDER BY '. $order . ' '. $order_by;
1360
+	}
1361 1361
 
1362 1362
 	/**
1363 1363
 	 * Make sure this is ordering by either ASC or DESC
@@ -1369,183 +1369,183 @@  discard block
 block discarded – undo
1369 1369
 		}
1370 1370
 	}
1371 1371
 
1372
-    /**
1373
-     * @param string $limit
1374
-     */
1372
+	/**
1373
+	 * @param string $limit
1374
+	 */
1375 1375
 	public static function esc_limit( $limit ) {
1376
-        if ( empty($limit) ) {
1377
-            return '';
1378
-        }
1379
-
1380
-        $limit = trim(str_replace(' limit', '', strtolower($limit)));
1381
-        if ( is_numeric($limit) ) {
1382
-            return ' LIMIT '. $limit;
1383
-        }
1384
-
1385
-        $limit = explode(',', trim($limit));
1386
-        foreach ( $limit as $k => $l ) {
1387
-            if ( is_numeric( $l ) ) {
1388
-                $limit[ $k ] = $l;
1389
-            }
1390
-        }
1391
-
1392
-        $limit = implode(',', $limit);
1393
-        return ' LIMIT '. $limit;
1394
-    }
1395
-
1396
-    /**
1397
-     * Get an array of values ready to go through $wpdb->prepare
1398
-     * @since 2.0
1399
-     */
1400
-    public static function prepare_array_values( $array, $type = '%s' ) {
1401
-        $placeholders = array_fill(0, count($array), $type);
1402
-        return implode(', ', $placeholders);
1403
-    }
1404
-
1405
-    public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
1406
-        if ( empty($where) ) {
1407
-            return '';
1408
-        }
1376
+		if ( empty($limit) ) {
1377
+			return '';
1378
+		}
1379
+
1380
+		$limit = trim(str_replace(' limit', '', strtolower($limit)));
1381
+		if ( is_numeric($limit) ) {
1382
+			return ' LIMIT '. $limit;
1383
+		}
1384
+
1385
+		$limit = explode(',', trim($limit));
1386
+		foreach ( $limit as $k => $l ) {
1387
+			if ( is_numeric( $l ) ) {
1388
+				$limit[ $k ] = $l;
1389
+			}
1390
+		}
1391
+
1392
+		$limit = implode(',', $limit);
1393
+		return ' LIMIT '. $limit;
1394
+	}
1395
+
1396
+	/**
1397
+	 * Get an array of values ready to go through $wpdb->prepare
1398
+	 * @since 2.0
1399
+	 */
1400
+	public static function prepare_array_values( $array, $type = '%s' ) {
1401
+		$placeholders = array_fill(0, count($array), $type);
1402
+		return implode(', ', $placeholders);
1403
+	}
1404
+
1405
+	public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
1406
+		if ( empty($where) ) {
1407
+			return '';
1408
+		}
1409 1409
 
1410 1410
 		if ( is_array( $where ) ) {
1411
-            global $wpdb;
1412
-            FrmDb::get_where_clause_and_values( $where, $starts_with );
1411
+			global $wpdb;
1412
+			FrmDb::get_where_clause_and_values( $where, $starts_with );
1413 1413
 			$where = $wpdb->prepare( $where['where'], $where['values'] );
1414 1414
 		} else {
1415
-            $where = $starts_with . $where;
1416
-        }
1415
+			$where = $starts_with . $where;
1416
+		}
1417 1417
 
1418
-        return $where;
1419
-    }
1418
+		return $where;
1419
+	}
1420 1420
 
1421
-    // Pagination Methods
1421
+	// Pagination Methods
1422 1422
 
1423
-    /**
1424
-     * @param integer $current_p
1425
-     */
1423
+	/**
1424
+	 * @param integer $current_p
1425
+	 */
1426 1426
 	public static function get_last_record_num( $r_count, $current_p, $p_size ) {
1427 1427
 		return ( ( $r_count < ( $current_p * $p_size ) ) ? $r_count : ( $current_p * $p_size ) );
1428 1428
 	}
1429 1429
 
1430
-    /**
1431
-     * @param integer $current_p
1432
-     */
1433
-    public static function get_first_record_num( $r_count, $current_p, $p_size ) {
1434
-        if ( $current_p == 1 ) {
1435
-            return 1;
1436
-        } else {
1437
-            return ( self::get_last_record_num( $r_count, ( $current_p - 1 ), $p_size ) + 1 );
1438
-        }
1439
-    }
1440
-
1441
-    /**
1442
-     * @param string $table_name
1443
-     */
1444
-    public static function &getRecordCount( $where = '', $table_name ) {
1445
-        _deprecated_function( __FUNCTION__, '2.0', 'FrmDb::get_count' );
1446
-        $count = FrmDb::get_count( $table_name, $where );
1447
-        return $count;
1448
-    }
1449
-
1450
-    public static function get_referer_info() {
1451
-        _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::get_server_value' );
1452
-        return self::get_server_value('HTTP_REFERER');
1453
-    }
1430
+	/**
1431
+	 * @param integer $current_p
1432
+	 */
1433
+	public static function get_first_record_num( $r_count, $current_p, $p_size ) {
1434
+		if ( $current_p == 1 ) {
1435
+			return 1;
1436
+		} else {
1437
+			return ( self::get_last_record_num( $r_count, ( $current_p - 1 ), $p_size ) + 1 );
1438
+		}
1439
+	}
1440
+
1441
+	/**
1442
+	 * @param string $table_name
1443
+	 */
1444
+	public static function &getRecordCount( $where = '', $table_name ) {
1445
+		_deprecated_function( __FUNCTION__, '2.0', 'FrmDb::get_count' );
1446
+		$count = FrmDb::get_count( $table_name, $where );
1447
+		return $count;
1448
+	}
1449
+
1450
+	public static function get_referer_info() {
1451
+		_deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::get_server_value' );
1452
+		return self::get_server_value('HTTP_REFERER');
1453
+	}
1454 1454
 
1455 1455
 	/**
1456 1456
 	 * @return array
1457 1457
 	 */
1458 1458
 	public static function json_to_array( $json_vars ) {
1459
-        $vars = array();
1460
-        foreach ( $json_vars as $jv ) {
1461
-            $jv_name = explode('[', $jv['name']);
1462
-            $last = count($jv_name) - 1;
1463
-            foreach ( $jv_name as $p => $n ) {
1464
-                $name = trim($n, ']');
1465
-                if ( ! isset($l1) ) {
1466
-                    $l1 = $name;
1467
-                }
1468
-
1469
-                if ( ! isset($l2) ) {
1470
-                    $l2 = $name;
1471
-                }
1472
-
1473
-                if ( ! isset($l3) ) {
1474
-                    $l3 = $name;
1475
-                }
1476
-
1477
-                $this_val = ( $p == $last ) ? $jv['value'] : array();
1478
-
1479
-                switch ( $p ) {
1480
-                    case 0:
1481
-                        $l1 = $name;
1482
-                        self::add_value_to_array( $name, $l1, $this_val, $vars );
1483
-                    break;
1484
-
1485
-                    case 1:
1486
-                        $l2 = $name;
1487
-                        self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1488
-                    break;
1489
-
1490
-                    case 2:
1491
-                        $l3 = $name;
1492
-                        self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1493
-                    break;
1494
-
1495
-                    case 3:
1496
-                        $l4 = $name;
1497
-                        self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1498
-                    break;
1499
-                }
1500
-
1501
-                unset($this_val, $n);
1502
-            }
1503
-
1504
-            unset($last, $jv);
1505
-        }
1506
-
1507
-        return $vars;
1508
-    }
1509
-
1510
-    /**
1511
-     * @param string $name
1512
-     * @param string $l1
1513
-     */
1514
-    public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1515
-        if ( $name == '' ) {
1516
-            $vars[] = $val;
1517
-        } else if ( ! isset( $vars[ $l1 ] ) ) {
1518
-            $vars[ $l1 ] = $val;
1519
-        }
1520
-    }
1459
+		$vars = array();
1460
+		foreach ( $json_vars as $jv ) {
1461
+			$jv_name = explode('[', $jv['name']);
1462
+			$last = count($jv_name) - 1;
1463
+			foreach ( $jv_name as $p => $n ) {
1464
+				$name = trim($n, ']');
1465
+				if ( ! isset($l1) ) {
1466
+					$l1 = $name;
1467
+				}
1468
+
1469
+				if ( ! isset($l2) ) {
1470
+					$l2 = $name;
1471
+				}
1472
+
1473
+				if ( ! isset($l3) ) {
1474
+					$l3 = $name;
1475
+				}
1476
+
1477
+				$this_val = ( $p == $last ) ? $jv['value'] : array();
1478
+
1479
+				switch ( $p ) {
1480
+					case 0:
1481
+						$l1 = $name;
1482
+						self::add_value_to_array( $name, $l1, $this_val, $vars );
1483
+					break;
1484
+
1485
+					case 1:
1486
+						$l2 = $name;
1487
+						self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1488
+					break;
1489
+
1490
+					case 2:
1491
+						$l3 = $name;
1492
+						self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1493
+					break;
1494
+
1495
+					case 3:
1496
+						$l4 = $name;
1497
+						self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1498
+					break;
1499
+				}
1500
+
1501
+				unset($this_val, $n);
1502
+			}
1503
+
1504
+			unset($last, $jv);
1505
+		}
1506
+
1507
+		return $vars;
1508
+	}
1509
+
1510
+	/**
1511
+	 * @param string $name
1512
+	 * @param string $l1
1513
+	 */
1514
+	public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1515
+		if ( $name == '' ) {
1516
+			$vars[] = $val;
1517
+		} else if ( ! isset( $vars[ $l1 ] ) ) {
1518
+			$vars[ $l1 ] = $val;
1519
+		}
1520
+	}
1521 1521
 
1522 1522
 	public static function maybe_add_tooltip( $name, $class = 'closed', $form_name = '' ) {
1523
-        $tooltips = array(
1524
-            'action_title'  => __( 'Give this action a label for easy reference.', 'formidable' ),
1525
-            'email_to'      => __( 'Add one or more recipient addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].  [admin_email] is the address set in WP General Settings.', 'formidable' ),
1526
-            'cc'            => __( 'Add CC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1527
-            'bcc'           => __( 'Add BCC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1528
-            'reply_to'      => __( 'If you would like a different reply to address than the "from" address, add a single address here.  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1529
-            'from'          => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <[email protected]> or [email protected].', 'formidable' ),
1530
-            'email_subject' => esc_attr( sprintf( __( 'If you leave the subject blank, the default will be used: %1$s Form submitted on %2$s', 'formidable' ), $form_name, self::site_name() ) ),
1531
-        );
1532
-
1533
-        if ( ! isset( $tooltips[ $name ] ) ) {
1534
-            return;
1535
-        }
1536
-
1537
-        if ( 'open' == $class ) {
1538
-            echo ' frm_help"';
1539
-        } else {
1540
-            echo ' class="frm_help"';
1541
-        }
1542
-
1543
-        echo ' title="'. esc_attr( $tooltips[ $name ] );
1544
-
1545
-        if ( 'open' != $class ) {
1546
-            echo '"';
1547
-        }
1548
-    }
1523
+		$tooltips = array(
1524
+			'action_title'  => __( 'Give this action a label for easy reference.', 'formidable' ),
1525
+			'email_to'      => __( 'Add one or more recipient addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].  [admin_email] is the address set in WP General Settings.', 'formidable' ),
1526
+			'cc'            => __( 'Add CC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1527
+			'bcc'           => __( 'Add BCC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1528
+			'reply_to'      => __( 'If you would like a different reply to address than the "from" address, add a single address here.  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1529
+			'from'          => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <[email protected]> or [email protected].', 'formidable' ),
1530
+			'email_subject' => esc_attr( sprintf( __( 'If you leave the subject blank, the default will be used: %1$s Form submitted on %2$s', 'formidable' ), $form_name, self::site_name() ) ),
1531
+		);
1532
+
1533
+		if ( ! isset( $tooltips[ $name ] ) ) {
1534
+			return;
1535
+		}
1536
+
1537
+		if ( 'open' == $class ) {
1538
+			echo ' frm_help"';
1539
+		} else {
1540
+			echo ' class="frm_help"';
1541
+		}
1542
+
1543
+		echo ' title="'. esc_attr( $tooltips[ $name ] );
1544
+
1545
+		if ( 'open' != $class ) {
1546
+			echo '"';
1547
+		}
1548
+	}
1549 1549
 
1550 1550
 	/**
1551 1551
 	 * Add the current_page class to that page in the form nav
@@ -1561,35 +1561,35 @@  discard block
 block discarded – undo
1561 1561
 		}
1562 1562
 	}
1563 1563
 
1564
-    /**
1565
-     * Prepare and json_encode post content
1566
-     *
1567
-     * @since 2.0
1568
-     *
1569
-     * @param array $post_content
1570
-     * @return string $post_content ( json encoded array )
1571
-     */
1572
-    public static function prepare_and_encode( $post_content ) {
1573
-        //Loop through array to strip slashes and add only the needed ones
1564
+	/**
1565
+	 * Prepare and json_encode post content
1566
+	 *
1567
+	 * @since 2.0
1568
+	 *
1569
+	 * @param array $post_content
1570
+	 * @return string $post_content ( json encoded array )
1571
+	 */
1572
+	public static function prepare_and_encode( $post_content ) {
1573
+		//Loop through array to strip slashes and add only the needed ones
1574 1574
 		foreach ( $post_content as $key => $val ) {
1575 1575
 			// Replace problematic characters (like &quot;)
1576 1576
 			$val = str_replace( '&quot;', '"', $val );
1577 1577
 
1578 1578
 			self::prepare_action_slashes( $val, $key, $post_content );
1579
-            unset( $key, $val );
1580
-        }
1579
+			unset( $key, $val );
1580
+		}
1581 1581
 
1582
-        // json_encode the array
1583
-        $post_content = json_encode( $post_content );
1582
+		// json_encode the array
1583
+		$post_content = json_encode( $post_content );
1584 1584
 
1585
-	    // add extra slashes for \r\n since WP strips them
1585
+		// add extra slashes for \r\n since WP strips them
1586 1586
 		$post_content = str_replace( array( '\\r', '\\n', '\\u', '\\t' ), array( '\\\\r', '\\\\n', '\\\\u', '\\\\t' ), $post_content );
1587 1587
 
1588
-        // allow for &quot
1589
-	    $post_content = str_replace( '&quot;', '\\"', $post_content );
1588
+		// allow for &quot
1589
+		$post_content = str_replace( '&quot;', '\\"', $post_content );
1590 1590
 
1591
-        return $post_content;
1592
-    }
1591
+		return $post_content;
1592
+	}
1593 1593
 
1594 1594
 	private static function prepare_action_slashes( $val, $key, &$post_content ) {
1595 1595
 		if ( ! isset( $post_content[ $key ] ) ) {
@@ -1657,64 +1657,64 @@  discard block
 block discarded – undo
1657 1657
 	}
1658 1658
 
1659 1659
 	public static function maybe_json_decode( $string ) {
1660
-        if ( is_array($string) ) {
1661
-            return $string;
1662
-        }
1660
+		if ( is_array($string) ) {
1661
+			return $string;
1662
+		}
1663 1663
 
1664
-        $new_string = json_decode($string, true);
1665
-        if ( function_exists('json_last_error') ) {
1664
+		$new_string = json_decode($string, true);
1665
+		if ( function_exists('json_last_error') ) {
1666 1666
 			// php 5.3+
1667
-            if ( json_last_error() == JSON_ERROR_NONE ) {
1668
-                $string = $new_string;
1669
-            }
1670
-        } else if ( isset($new_string) ) {
1667
+			if ( json_last_error() == JSON_ERROR_NONE ) {
1668
+				$string = $new_string;
1669
+			}
1670
+		} else if ( isset($new_string) ) {
1671 1671
 			// php < 5.3 fallback
1672
-            $string = $new_string;
1673
-        }
1674
-        return $string;
1675
-    }
1676
-
1677
-    /**
1678
-     * @since 1.07.10
1679
-     *
1680
-     * @param string $post_type The name of the post type that may need to be highlighted
1681
-     * @return echo The javascript to open and highlight the Formidable menu
1682
-     */
1672
+			$string = $new_string;
1673
+		}
1674
+		return $string;
1675
+	}
1676
+
1677
+	/**
1678
+	 * @since 1.07.10
1679
+	 *
1680
+	 * @param string $post_type The name of the post type that may need to be highlighted
1681
+	 * @return echo The javascript to open and highlight the Formidable menu
1682
+	 */
1683 1683
 	public static function maybe_highlight_menu( $post_type ) {
1684
-        global $post, $pagenow;
1684
+		global $post, $pagenow;
1685 1685
 
1686
-        if ( isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != $post_type ) {
1687
-            return;
1688
-        }
1686
+		if ( isset($_REQUEST['post_type']) && $_REQUEST['post_type'] != $post_type ) {
1687
+			return;
1688
+		}
1689 1689
 
1690
-        if ( is_object($post) && $post->post_type != $post_type ) {
1691
-            return;
1692
-        }
1690
+		if ( is_object($post) && $post->post_type != $post_type ) {
1691
+			return;
1692
+		}
1693 1693
 
1694
-        self::load_admin_wide_js();
1695
-        echo '<script type="text/javascript">jQuery(document).ready(function(){frmSelectSubnav();});</script>';
1696
-    }
1694
+		self::load_admin_wide_js();
1695
+		echo '<script type="text/javascript">jQuery(document).ready(function(){frmSelectSubnav();});</script>';
1696
+	}
1697 1697
 
1698
-    /**
1699
-     * Load the JS file on non-Formidable pages in the admin area
1700
-     * @since 2.0
1701
-     */
1698
+	/**
1699
+	 * Load the JS file on non-Formidable pages in the admin area
1700
+	 * @since 2.0
1701
+	 */
1702 1702
 	public static function load_admin_wide_js( $load = true ) {
1703
-        $version = FrmAppHelper::plugin_version();
1703
+		$version = FrmAppHelper::plugin_version();
1704 1704
 		wp_register_script( 'formidable_admin_global', FrmAppHelper::plugin_url() . '/js/formidable_admin_global.js', array( 'jquery' ), $version );
1705 1705
 
1706
-        wp_localize_script( 'formidable_admin_global', 'frmGlobal', array(
1706
+		wp_localize_script( 'formidable_admin_global', 'frmGlobal', array(
1707 1707
 			'updating_msg' => __( 'Please wait while your site updates.', 'formidable' ),
1708
-            'deauthorize'  => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
1708
+			'deauthorize'  => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
1709 1709
 			'url'          => FrmAppHelper::plugin_url(),
1710 1710
 			'loading'      => __( 'Loading&hellip;' ),
1711 1711
 			'nonce'        => wp_create_nonce( 'frm_ajax' ),
1712
-        ) );
1712
+		) );
1713 1713
 
1714 1714
 		if ( $load ) {
1715 1715
 			wp_enqueue_script( 'formidable_admin_global' );
1716 1716
 		}
1717
-    }
1717
+	}
1718 1718
 
1719 1719
 	/**
1720 1720
 	 * @since 2.0.9
@@ -1723,9 +1723,9 @@  discard block
 block discarded – undo
1723 1723
 		wp_enqueue_style( 'frm_fonts', self::plugin_url() . '/css/frm_fonts.css', array(), self::plugin_version() );
1724 1724
 	}
1725 1725
 
1726
-    /**
1727
-     * @param string $location
1728
-     */
1726
+	/**
1727
+	 * @param string $location
1728
+	 */
1729 1729
 	public static function localize_script( $location ) {
1730 1730
 		$ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' );
1731 1731
 		$ajax_url = apply_filters( 'frm_ajax_url', $ajax_url );
@@ -1775,81 +1775,81 @@  discard block
 block discarded – undo
1775 1775
 		}
1776 1776
 	}
1777 1777
 
1778
-    /**
1778
+	/**
1779 1779
 	 * echo the message on the plugins listing page
1780
-     * @since 1.07.10
1781
-     *
1782
-     * @param float $min_version The version the add-on requires
1783
-     */
1780
+	 * @since 1.07.10
1781
+	 *
1782
+	 * @param float $min_version The version the add-on requires
1783
+	 */
1784 1784
 	public static function min_version_notice( $min_version ) {
1785
-        $frm_version = self::plugin_version();
1785
+		$frm_version = self::plugin_version();
1786 1786
 
1787
-        // check if Formidable meets minimum requirements
1788
-        if ( version_compare($frm_version, $min_version, '>=') ) {
1789
-            return;
1790
-        }
1787
+		// check if Formidable meets minimum requirements
1788
+		if ( version_compare($frm_version, $min_version, '>=') ) {
1789
+			return;
1790
+		}
1791 1791
 
1792
-        $wp_list_table = _get_list_table('WP_Plugins_List_Table');
1792
+		$wp_list_table = _get_list_table('WP_Plugins_List_Table');
1793 1793
 		echo '<tr class="plugin-update-tr active"><th colspan="' . absint( $wp_list_table->get_column_count() ) . '" class="check-column plugin-update colspanchange"><div class="update-message">' .
1794
-        __( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1795
-        '</div></td></tr>';
1796
-    }
1797
-
1798
-    public static function locales( $type = 'date' ) {
1799
-        $locales = array(
1800
-            'en' => __( 'English', 'formidable' ),    '' => __( 'English/Western', 'formidable' ),
1801
-            'af' => __( 'Afrikaans', 'formidable' ),  'sq' => __( 'Albanian', 'formidable' ),
1802
-            'ar' => __( 'Arabic', 'formidable' ),     'hy' => __( 'Armenian', 'formidable' ),
1803
-            'az' => __( 'Azerbaijani', 'formidable' ), 'eu' => __( 'Basque', 'formidable' ),
1804
-            'bs' => __( 'Bosnian', 'formidable' ),    'bg' => __( 'Bulgarian', 'formidable' ),
1805
-            'ca' => __( 'Catalan', 'formidable' ),    'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1806
-            'zh-CN' => __( 'Chinese Simplified', 'formidable' ), 'zh-TW' => __( 'Chinese Traditional', 'formidable' ),
1807
-            'hr' => __( 'Croatian', 'formidable' ),   'cs' => __( 'Czech', 'formidable' ),
1808
-            'da' => __( 'Danish', 'formidable' ),     'nl' => __( 'Dutch', 'formidable' ),
1809
-            'en-GB' => __( 'English/UK', 'formidable' ), 'eo' => __( 'Esperanto', 'formidable' ),
1810
-            'et' => __( 'Estonian', 'formidable' ),   'fo' => __( 'Faroese', 'formidable' ),
1811
-            'fa' => __( 'Farsi/Persian', 'formidable' ), 'fil' => __( 'Filipino', 'formidable' ),
1812
-            'fi' => __( 'Finnish', 'formidable' ),    'fr' => __( 'French', 'formidable' ),
1813
-            'fr-CA' => __( 'French/Canadian', 'formidable' ), 'fr-CH' => __( 'French/Swiss', 'formidable' ),
1814
-            'de' => __( 'German', 'formidable' ),     'de-AT' => __( 'German/Austria', 'formidable' ),
1815
-            'de-CH' => __( 'German/Switzerland', 'formidable' ), 'el' => __( 'Greek', 'formidable' ),
1816
-            'he' => __( 'Hebrew', 'formidable' ),     'iw' => __( 'Hebrew', 'formidable' ),
1817
-            'hi' => __( 'Hindi', 'formidable' ),      'hu' => __( 'Hungarian', 'formidable' ),
1818
-            'is' => __( 'Icelandic', 'formidable' ),  'id' => __( 'Indonesian', 'formidable' ),
1819
-            'it' => __( 'Italian', 'formidable' ),    'ja' => __( 'Japanese', 'formidable' ),
1820
-            'ko' => __( 'Korean', 'formidable' ),     'lv' => __( 'Latvian', 'formidable' ),
1821
-            'lt' => __( 'Lithuanian', 'formidable' ), 'ms' => __( 'Malaysian', 'formidable' ),
1822
-            'no' => __( 'Norwegian', 'formidable' ),  'pl' => __( 'Polish', 'formidable' ),
1823
-            'pt' => __( 'Portuguese', 'formidable' ), 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
1824
-            'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ), 'ro' => __( 'Romanian', 'formidable' ),
1825
-            'ru' => __( 'Russian', 'formidable' ),    'sr' => __( 'Serbian', 'formidable' ),
1826
-            'sr-SR' => __( 'Serbian', 'formidable' ), 'sk' => __( 'Slovak', 'formidable' ),
1827
-            'sl' => __( 'Slovenian', 'formidable' ),  'es' => __( 'Spanish', 'formidable' ),
1828
-            'es-419' => __( 'Spanish/Latin America', 'formidable' ), 'sv' => __( 'Swedish', 'formidable' ),
1829
-            'ta' => __( 'Tamil', 'formidable' ),      'th' => __( 'Thai', 'formidable' ),
1830
-            'tu' => __( 'Turkish', 'formidable' ),    'tr' => __( 'Turkish', 'formidable' ),
1831
-            'uk' => __( 'Ukranian', 'formidable' ),   'vi' => __( 'Vietnamese', 'formidable' ),
1832
-        );
1833
-
1834
-        if ( $type == 'captcha' ) {
1835
-            // remove the languages unavailable for the captcha
1836
-            $unset = array(
1837
-                '', 'af', 'sq', 'hy', 'az', 'eu', 'bs',
1838
-                'zh-HK', 'eo', 'et', 'fo', 'fr-CH',
1839
-                'he', 'is', 'ms', 'sr-SR', 'ta', 'tu',
1840
-            );
1841
-        } else {
1842
-            // remove the languages unavailable for the datepicker
1843
-            $unset = array(
1844
-                'en', 'fil', 'fr-CA', 'de-AT', 'de-AT',
1845
-                'de-CH', 'iw', 'hi', 'pt', 'pt-PT',
1846
-                'es-419', 'tr',
1847
-            );
1848
-        }
1849
-
1850
-        $locales = array_diff_key($locales, array_flip($unset));
1851
-        $locales = apply_filters('frm_locales', $locales);
1852
-
1853
-        return $locales;
1854
-    }
1794
+		__( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1795
+		'</div></td></tr>';
1796
+	}
1797
+
1798
+	public static function locales( $type = 'date' ) {
1799
+		$locales = array(
1800
+			'en' => __( 'English', 'formidable' ),    '' => __( 'English/Western', 'formidable' ),
1801
+			'af' => __( 'Afrikaans', 'formidable' ),  'sq' => __( 'Albanian', 'formidable' ),
1802
+			'ar' => __( 'Arabic', 'formidable' ),     'hy' => __( 'Armenian', 'formidable' ),
1803
+			'az' => __( 'Azerbaijani', 'formidable' ), 'eu' => __( 'Basque', 'formidable' ),
1804
+			'bs' => __( 'Bosnian', 'formidable' ),    'bg' => __( 'Bulgarian', 'formidable' ),
1805
+			'ca' => __( 'Catalan', 'formidable' ),    'zh-HK' => __( 'Chinese Hong Kong', 'formidable' ),
1806
+			'zh-CN' => __( 'Chinese Simplified', 'formidable' ), 'zh-TW' => __( 'Chinese Traditional', 'formidable' ),
1807
+			'hr' => __( 'Croatian', 'formidable' ),   'cs' => __( 'Czech', 'formidable' ),
1808
+			'da' => __( 'Danish', 'formidable' ),     'nl' => __( 'Dutch', 'formidable' ),
1809
+			'en-GB' => __( 'English/UK', 'formidable' ), 'eo' => __( 'Esperanto', 'formidable' ),
1810
+			'et' => __( 'Estonian', 'formidable' ),   'fo' => __( 'Faroese', 'formidable' ),
1811
+			'fa' => __( 'Farsi/Persian', 'formidable' ), 'fil' => __( 'Filipino', 'formidable' ),
1812
+			'fi' => __( 'Finnish', 'formidable' ),    'fr' => __( 'French', 'formidable' ),
1813
+			'fr-CA' => __( 'French/Canadian', 'formidable' ), 'fr-CH' => __( 'French/Swiss', 'formidable' ),
1814
+			'de' => __( 'German', 'formidable' ),     'de-AT' => __( 'German/Austria', 'formidable' ),
1815
+			'de-CH' => __( 'German/Switzerland', 'formidable' ), 'el' => __( 'Greek', 'formidable' ),
1816
+			'he' => __( 'Hebrew', 'formidable' ),     'iw' => __( 'Hebrew', 'formidable' ),
1817
+			'hi' => __( 'Hindi', 'formidable' ),      'hu' => __( 'Hungarian', 'formidable' ),
1818
+			'is' => __( 'Icelandic', 'formidable' ),  'id' => __( 'Indonesian', 'formidable' ),
1819
+			'it' => __( 'Italian', 'formidable' ),    'ja' => __( 'Japanese', 'formidable' ),
1820
+			'ko' => __( 'Korean', 'formidable' ),     'lv' => __( 'Latvian', 'formidable' ),
1821
+			'lt' => __( 'Lithuanian', 'formidable' ), 'ms' => __( 'Malaysian', 'formidable' ),
1822
+			'no' => __( 'Norwegian', 'formidable' ),  'pl' => __( 'Polish', 'formidable' ),
1823
+			'pt' => __( 'Portuguese', 'formidable' ), 'pt-BR' => __( 'Portuguese/Brazilian', 'formidable' ),
1824
+			'pt-PT' => __( 'Portuguese/Portugal', 'formidable' ), 'ro' => __( 'Romanian', 'formidable' ),
1825
+			'ru' => __( 'Russian', 'formidable' ),    'sr' => __( 'Serbian', 'formidable' ),
1826
+			'sr-SR' => __( 'Serbian', 'formidable' ), 'sk' => __( 'Slovak', 'formidable' ),
1827
+			'sl' => __( 'Slovenian', 'formidable' ),  'es' => __( 'Spanish', 'formidable' ),
1828
+			'es-419' => __( 'Spanish/Latin America', 'formidable' ), 'sv' => __( 'Swedish', 'formidable' ),
1829
+			'ta' => __( 'Tamil', 'formidable' ),      'th' => __( 'Thai', 'formidable' ),
1830
+			'tu' => __( 'Turkish', 'formidable' ),    'tr' => __( 'Turkish', 'formidable' ),
1831
+			'uk' => __( 'Ukranian', 'formidable' ),   'vi' => __( 'Vietnamese', 'formidable' ),
1832
+		);
1833
+
1834
+		if ( $type == 'captcha' ) {
1835
+			// remove the languages unavailable for the captcha
1836
+			$unset = array(
1837
+				'', 'af', 'sq', 'hy', 'az', 'eu', 'bs',
1838
+				'zh-HK', 'eo', 'et', 'fo', 'fr-CH',
1839
+				'he', 'is', 'ms', 'sr-SR', 'ta', 'tu',
1840
+			);
1841
+		} else {
1842
+			// remove the languages unavailable for the datepicker
1843
+			$unset = array(
1844
+				'en', 'fil', 'fr-CA', 'de-AT', 'de-AT',
1845
+				'de-CH', 'iw', 'hi', 'pt', 'pt-PT',
1846
+				'es-419', 'tr',
1847
+			);
1848
+		}
1849
+
1850
+		$locales = array_diff_key($locales, array_flip($unset));
1851
+		$locales = apply_filters('frm_locales', $locales);
1852
+
1853
+		return $locales;
1854
+	}
1855 1855
 }
Please login to merge, or discard this patch.