Completed
Pull Request — master (#101)
by Stephanie
02:45
created
classes/controllers/FrmStylesController.php 1 patch
Indentation   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class FrmStylesController {
4
-    public static $post_type = 'frm_styles';
5
-    public static $screen = 'formidable_page_formidable-styles';
4
+	public static $post_type = 'frm_styles';
5
+	public static $screen = 'formidable_page_formidable-styles';
6 6
 
7
-    public static function load_pro_hooks() {
8
-        if ( FrmAppHelper::pro_is_installed() ) {
9
-            FrmProStylesController::load_pro_hooks();
10
-        }
11
-    }
7
+	public static function load_pro_hooks() {
8
+		if ( FrmAppHelper::pro_is_installed() ) {
9
+			FrmProStylesController::load_pro_hooks();
10
+		}
11
+	}
12 12
 
13
-    public static function register_post_types() {
13
+	public static function register_post_types() {
14 14
 		register_post_type(
15 15
 			self::$post_type,
16 16
 			array(
@@ -41,18 +41,18 @@  discard block
 block discarded – undo
41 41
 				),
42 42
 			)
43 43
 		);
44
-    }
44
+	}
45 45
 
46
-    public static function menu() {
46
+	public static function menu() {
47 47
 		add_submenu_page( 'formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' );
48
-    }
48
+	}
49 49
 
50 50
 	public static function admin_init() {
51 51
 		if ( ! FrmAppHelper::is_admin_page( 'formidable-styles' ) ) {
52 52
 			return;
53 53
 		}
54 54
 
55
-        self::load_pro_hooks();
55
+		self::load_pro_hooks();
56 56
 
57 57
 		$style_tab = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
58 58
 		if ( $style_tab == 'manage' || $style_tab == 'custom_css' ) {
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 		wp_enqueue_style( 'frm-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_css' ) );
66 66
 
67 67
 		$style = apply_filters( 'frm_style_head', false );
68
-        if ( $style ) {
68
+		if ( $style ) {
69 69
 			wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) . '&' . http_build_query( $style->post_content ) );
70
-        }
71
-    }
70
+		}
71
+	}
72 72
 
73 73
 	public static function enqueue_css( $register = 'enqueue', $force = false ) {
74 74
 		global $frm_vars;
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 	}
220 220
 
221 221
 	public static function load_styler( $style, $message = '' ) {
222
-        global $frm_settings;
222
+		global $frm_settings;
223 223
 
224
-        $frm_style = new FrmStyle();
225
-        $styles = $frm_style->get_all();
224
+		$frm_style = new FrmStyle();
225
+		$styles = $frm_style->get_all();
226 226
 
227 227
 		if ( is_numeric( $style ) ) {
228 228
 			$style = $styles[ $style ];
@@ -230,10 +230,10 @@  discard block
 block discarded – undo
230 230
 			$style = $frm_style->get_default_style( $styles );
231 231
 		}
232 232
 
233
-        self::add_meta_boxes();
233
+		self::add_meta_boxes();
234 234
 
235 235
 		include( FrmAppHelper::plugin_path() . '/classes/views/styles/show.php' );
236
-    }
236
+	}
237 237
 
238 238
 	/**
239 239
 	 * @param string $message
@@ -251,31 +251,31 @@  discard block
 block discarded – undo
251 251
 		include( FrmAppHelper::plugin_path() . '/classes/views/styles/manage.php' );
252 252
 	}
253 253
 
254
-    private static function manage_styles() {
254
+	private static function manage_styles() {
255 255
 		$style_nonce = FrmAppHelper::get_post_param( 'frm_manage_style', '', 'sanitize_text_field' );
256 256
 		if ( ! $_POST || ! isset( $_POST['style'] ) || ! wp_verify_nonce( $style_nonce, 'frm_manage_style_nonce' ) ) {
257
-            return self::manage();
258
-        }
257
+			return self::manage();
258
+		}
259 259
 
260
-        global $wpdb;
260
+		global $wpdb;
261 261
 
262 262
 		$forms = FrmForm::get_published_forms();
263
-        foreach ( $forms as $form ) {
264
-            if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) {
265
-                continue;
266
-            }
263
+		foreach ( $forms as $form ) {
264
+			if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) {
265
+				continue;
266
+			}
267 267
 
268
-            $form->options['custom_style'] = $_POST['style'][ $form->id ];
268
+			$form->options['custom_style'] = $_POST['style'][ $form->id ];
269 269
 
270 270
 			$wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) );
271 271
 			unset( $form );
272
-        }
272
+		}
273 273
 
274
-        $message = __( 'Your form styles have been saved.', 'formidable' );
274
+		$message = __( 'Your form styles have been saved.', 'formidable' );
275 275
 		return self::manage( $message, $forms );
276
-    }
276
+	}
277 277
 
278
-    public static function custom_css( $message = '', $style = null ) {
278
+	public static function custom_css( $message = '', $style = null ) {
279 279
 		if ( function_exists( 'wp_enqueue_code_editor' ) ) {
280 280
 			$id = 'frm_codemirror_box';
281 281
 			$settings = wp_enqueue_code_editor(
@@ -317,41 +317,41 @@  discard block
 block discarded – undo
317 317
 		return self::custom_css( $message );
318 318
 	}
319 319
 
320
-    public static function route() {
320
+	public static function route() {
321 321
 		$action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
322 322
 
323
-        switch ( $action ) {
324
-            case 'edit':
325
-            case 'save':
326
-            case 'manage':
327
-            case 'manage_styles':
328
-            case 'custom_css':
329
-            case 'save_css':
323
+		switch ( $action ) {
324
+			case 'edit':
325
+			case 'save':
326
+			case 'manage':
327
+			case 'manage_styles':
328
+			case 'custom_css':
329
+			case 'save_css':
330 330
 				return self::$action();
331
-            default:
332
-            	do_action( 'frm_style_action_route', $action );
333
-            	if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) {
334
-                	return;
335
-            	}
331
+			default:
332
+				do_action( 'frm_style_action_route', $action );
333
+				if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) {
334
+					return;
335
+				}
336 336
 
337
-                if ( 'new_style' == $action || 'duplicate' == $action ) {
338
-                    return self::$action();
339
-                }
337
+				if ( 'new_style' == $action || 'duplicate' == $action ) {
338
+					return self::$action();
339
+				}
340 340
 
341
-                return self::edit();
342
-        }
343
-    }
341
+				return self::edit();
342
+		}
343
+	}
344 344
 
345
-    public static function reset_styling() {
345
+	public static function reset_styling() {
346 346
 		FrmAppHelper::permission_check( 'frm_change_settings' );
347
-        check_ajax_referer( 'frm_ajax', 'nonce' );
347
+		check_ajax_referer( 'frm_ajax', 'nonce' );
348 348
 
349
-        $frm_style = new FrmStyle();
350
-        $defaults = $frm_style->get_defaults();
349
+		$frm_style = new FrmStyle();
350
+		$defaults = $frm_style->get_defaults();
351 351
 
352
-        echo json_encode( $defaults );
353
-        wp_die();
354
-    }
352
+		echo json_encode( $defaults );
353
+		wp_die();
354
+	}
355 355
 
356 356
 	public static function change_styling() {
357 357
 		check_ajax_referer( 'frm_ajax', 'nonce' );
@@ -366,21 +366,21 @@  discard block
 block discarded – undo
366 366
 		wp_die();
367 367
 	}
368 368
 
369
-    private static function add_meta_boxes() {
370
-
371
-        // setup meta boxes
372
-        $meta_boxes = array(
373
-            'general'           => __( 'General', 'formidable' ),
374
-            'form-title'        => __( 'Form Title', 'formidable' ),
375
-            'form-description'  => __( 'Form Description', 'formidable' ),
376
-            'field-labels'      => __( 'Field Labels', 'formidable' ),
377
-            'field-description' => __( 'Field Description', 'formidable' ),
378
-            'field-colors'      => __( 'Field Colors', 'formidable' ),
379
-            'field-sizes'       => __( 'Field Settings', 'formidable' ),
380
-            'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ),
381
-            'buttons'           => __( 'Buttons', 'formidable' ),
382
-            'form-messages'     => __( 'Form Messages', 'formidable' ),
383
-        );
369
+	private static function add_meta_boxes() {
370
+
371
+		// setup meta boxes
372
+		$meta_boxes = array(
373
+			'general'           => __( 'General', 'formidable' ),
374
+			'form-title'        => __( 'Form Title', 'formidable' ),
375
+			'form-description'  => __( 'Form Description', 'formidable' ),
376
+			'field-labels'      => __( 'Field Labels', 'formidable' ),
377
+			'field-description' => __( 'Field Description', 'formidable' ),
378
+			'field-colors'      => __( 'Field Colors', 'formidable' ),
379
+			'field-sizes'       => __( 'Field Settings', 'formidable' ),
380
+			'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ),
381
+			'buttons'           => __( 'Buttons', 'formidable' ),
382
+			'form-messages'     => __( 'Form Messages', 'formidable' ),
383
+		);
384 384
 
385 385
 		/**
386 386
 		 * Add custom boxes to the styling settings
@@ -412,18 +412,18 @@  discard block
 block discarded – undo
412 412
 		$file_name = apply_filters( 'frm_style_settings_' . $sec['args'], $file_name );
413 413
 
414 414
 		include( $file_name );
415
-    }
415
+	}
416 416
 
417
-    public static function load_css() {
417
+	public static function load_css() {
418 418
 		header( 'Content-type: text/css' );
419 419
 
420
-        $frm_style = new FrmStyle();
421
-        $defaults = $frm_style->get_defaults();
420
+		$frm_style = new FrmStyle();
421
+		$defaults = $frm_style->get_defaults();
422 422
 		$style = '';
423 423
 
424 424
 		include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' );
425
-        wp_die();
426
-    }
425
+		wp_die();
426
+	}
427 427
 
428 428
 	public static function load_saved_css() {
429 429
 		$css = get_transient( 'frmpro_css' );
@@ -432,49 +432,49 @@  discard block
 block discarded – undo
432 432
 		wp_die();
433 433
 	}
434 434
 
435
-    /**
436
-     * Check if the Formidable styling should be loaded,
437
-     * then enqueue it for the footer
438
-     * @since 2.0
439
-     */
440
-    public static function enqueue_style() {
441
-        global $frm_vars;
442
-
443
-        if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) {
444
-            // the CSS has already been loaded
445
-            return;
446
-        }
447
-
448
-        $frm_settings = FrmAppHelper::get_settings();
449
-        if ( $frm_settings->load_style != 'none' ) {
450
-            wp_enqueue_style( 'formidable' );
451
-            $frm_vars['css_loaded'] = true;
452
-        }
453
-    }
454
-
455
-    // Get the stylesheets for the form settings page
456
-    public static function get_style_opts() {
457
-        $frm_style = new FrmStyle();
458
-        $styles = $frm_style->get_all();
459
-
460
-        return $styles;
461
-    }
462
-
463
-    public static function get_form_style( $form = 'default' ) {
464
-        $style = FrmFormsHelper::get_form_style( $form );
465
-
466
-        if ( empty( $style ) || 1 == $style ) {
467
-            $style = 'default';
468
-        }
469
-
470
-        $frm_style = new FrmStyle( $style );
471
-        return $frm_style->get_one();
472
-    }
473
-
474
-    /**
475
-     * @param string $class
476
-     * @param string $style
477
-     */
435
+	/**
436
+	 * Check if the Formidable styling should be loaded,
437
+	 * then enqueue it for the footer
438
+	 * @since 2.0
439
+	 */
440
+	public static function enqueue_style() {
441
+		global $frm_vars;
442
+
443
+		if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) {
444
+			// the CSS has already been loaded
445
+			return;
446
+		}
447
+
448
+		$frm_settings = FrmAppHelper::get_settings();
449
+		if ( $frm_settings->load_style != 'none' ) {
450
+			wp_enqueue_style( 'formidable' );
451
+			$frm_vars['css_loaded'] = true;
452
+		}
453
+	}
454
+
455
+	// Get the stylesheets for the form settings page
456
+	public static function get_style_opts() {
457
+		$frm_style = new FrmStyle();
458
+		$styles = $frm_style->get_all();
459
+
460
+		return $styles;
461
+	}
462
+
463
+	public static function get_form_style( $form = 'default' ) {
464
+		$style = FrmFormsHelper::get_form_style( $form );
465
+
466
+		if ( empty( $style ) || 1 == $style ) {
467
+			$style = 'default';
468
+		}
469
+
470
+		$frm_style = new FrmStyle( $style );
471
+		return $frm_style->get_one();
472
+	}
473
+
474
+	/**
475
+	 * @param string $class
476
+	 * @param string $style
477
+	 */
478 478
 	public static function get_form_style_class( $class, $style ) {
479 479
 		if ( 1 == $style ) {
480 480
 			$style = 'default';
@@ -504,9 +504,9 @@  discard block
 block discarded – undo
504 504
 		}
505 505
 	}
506 506
 
507
-    /**
508
-     * @param string $val
509
-     */
507
+	/**
508
+	 * @param string $val
509
+	 */
510 510
 	public static function get_style_val( $val, $form = 'default' ) {
511 511
 		$style = self::get_form_style( $form );
512 512
 		if ( $style && isset( $style->post_content[ $val ] ) ) {
@@ -516,72 +516,72 @@  discard block
 block discarded – undo
516 516
 
517 517
 	public static function show_entry_styles( $default_styles ) {
518 518
 		$frm_style = new FrmStyle( 'default' );
519
-        $style = $frm_style->get_one();
520
-
521
-        if ( ! $style ) {
522
-            return $default_styles;
523
-        }
524
-
525
-        foreach ( $default_styles as $name => $val ) {
526
-            $setting = $name;
527
-            if ( 'border_width' == $name ) {
528
-                $setting = 'field_border_width';
529
-            } else if ( 'alt_bg_color' == $name ) {
530
-                $setting = 'bg_color_active';
531
-            }
532
-            $default_styles[ $name ] = $style->post_content[ $setting ];
519
+		$style = $frm_style->get_one();
520
+
521
+		if ( ! $style ) {
522
+			return $default_styles;
523
+		}
524
+
525
+		foreach ( $default_styles as $name => $val ) {
526
+			$setting = $name;
527
+			if ( 'border_width' == $name ) {
528
+				$setting = 'field_border_width';
529
+			} else if ( 'alt_bg_color' == $name ) {
530
+				$setting = 'bg_color_active';
531
+			}
532
+			$default_styles[ $name ] = $style->post_content[ $setting ];
533 533
 			unset( $name, $val );
534
-        }
534
+		}
535 535
 
536
-        return $default_styles;
537
-    }
536
+		return $default_styles;
537
+	}
538 538
 
539 539
 	public static function &important_style( $important, $field ) {
540 540
 		$important = self::get_style_val( 'important_style', $field['form_id'] );
541
-        return $important;
542
-    }
541
+		return $important;
542
+	}
543 543
 
544
-    /**
545
-     * Fallback for WP < 3.6
546
-     */
547
-    public static function do_accordion_sections( $screen, $context, $object ) {
548
-        if ( function_exists( 'do_accordion_sections' ) ) {
549
-            return do_accordion_sections( $screen, $context, $object );
550
-        }
544
+	/**
545
+	 * Fallback for WP < 3.6
546
+	 */
547
+	public static function do_accordion_sections( $screen, $context, $object ) {
548
+		if ( function_exists( 'do_accordion_sections' ) ) {
549
+			return do_accordion_sections( $screen, $context, $object );
550
+		}
551 551
 
552
-    	global $wp_meta_boxes;
552
+		global $wp_meta_boxes;
553 553
 
554
-        $screen = 'formidable_page_formidable-styles';
555
-        $screen = convert_to_screen( $screen );
554
+		$screen = 'formidable_page_formidable-styles';
555
+		$screen = convert_to_screen( $screen );
556 556
 
557
-    	$page = $screen->id;
557
+		$page = $screen->id;
558 558
 
559
-    	$hidden = get_hidden_meta_boxes( $screen );
560
-    	?>
559
+		$hidden = get_hidden_meta_boxes( $screen );
560
+		?>
561 561
     	<div id="side-sortables" class="accordion-container">
562 562
     	<?php
563
-    	$i = 0;
564
-    	$first_open = false;
565
-    	do {
563
+		$i = 0;
564
+		$first_open = false;
565
+		do {
566 566
 			if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
567 567
 				break;
568 568
 			}
569 569
 
570
-    		foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
571
-    			if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
572
-    				foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
573
-    					if ( false == $box || ! $box['title'] ) {
574
-    						continue;
570
+			foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
571
+				if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
572
+					foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
573
+						if ( false == $box || ! $box['title'] ) {
574
+							continue;
575 575
 						}
576 576
 
577
-    					$i++;
578
-    					$hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
577
+						$i++;
578
+						$hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
579 579
 
580
-    					if ( ! $first_open && empty( $hidden_class ) ) {
581
-    						$first_open = true;
582
-    					}
580
+						if ( ! $first_open && empty( $hidden_class ) ) {
581
+							$first_open = true;
582
+						}
583 583
 
584
-    					?>
584
+						?>
585 585
 						<div class="postbox <?php echo esc_attr( $box['id'] ); ?>">
586 586
 						<div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'formidable' ); ?>"><br/></div>
587 587
                         <h3 class='hndle'><span><?php echo esc_html( $box['title'] ); ?></span></h3>
@@ -592,13 +592,13 @@  discard block
 block discarded – undo
592 592
     						</div><!-- .accordion-section-content -->
593 593
     					</div><!-- .postbox -->
594 594
     					<?php
595
-    				}
596
-    			}
597
-    		}
598
-    	} while ( 0 );
599
-    	?>
595
+					}
596
+				}
597
+			}
598
+		} while ( 0 );
599
+		?>
600 600
     	</div><!-- .accordion-container -->
601 601
     	<?php
602
-    	return $i;
603
-    }
602
+		return $i;
603
+	}
604 604
 }
Please login to merge, or discard this patch.
classes/controllers/FrmHooksController.php 1 patch
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -2,89 +2,89 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmHooksController {
4 4
 
5
-    /**
6
-     * Trigger plugin-wide hook loading
7
-     */
8
-    public static function trigger_load_hook( $hooks = 'load_hooks' ) {
9
-        $controllers = apply_filters( 'frm_load_controllers', array( 'FrmHooksController' ) );
10
-
11
-        $trigger_hooks = $hooks;
12
-        $hooks = (array) $hooks;
13
-
14
-        if ( 'load_hooks' == $trigger_hooks ) {
15
-            if ( is_admin() ) {
16
-                $hooks[] = 'load_admin_hooks';
17
-                if ( defined( 'DOING_AJAX' ) ) {
18
-                    $hooks[] = 'load_ajax_hooks';
19
-                    $hooks[] = 'load_form_hooks';
20
-                }
21
-            }
22
-
23
-            if ( is_multisite() ) {
24
-                $hooks[] = 'load_multisite_hooks';
25
-            }
26
-        } else {
27
-            // Make sure the hooks are only triggered once
28
-            add_filter( 'frm' . str_replace( 'load', '', $trigger_hooks ) . '_loaded', '__return_true' );
29
-        }
30
-        unset( $trigger_hooks );
31
-
32
-        // Instansiate Controllers
33
-        foreach ( $controllers as $c ) {
34
-            foreach ( $hooks as $hook ) {
5
+	/**
6
+	 * Trigger plugin-wide hook loading
7
+	 */
8
+	public static function trigger_load_hook( $hooks = 'load_hooks' ) {
9
+		$controllers = apply_filters( 'frm_load_controllers', array( 'FrmHooksController' ) );
10
+
11
+		$trigger_hooks = $hooks;
12
+		$hooks = (array) $hooks;
13
+
14
+		if ( 'load_hooks' == $trigger_hooks ) {
15
+			if ( is_admin() ) {
16
+				$hooks[] = 'load_admin_hooks';
17
+				if ( defined( 'DOING_AJAX' ) ) {
18
+					$hooks[] = 'load_ajax_hooks';
19
+					$hooks[] = 'load_form_hooks';
20
+				}
21
+			}
22
+
23
+			if ( is_multisite() ) {
24
+				$hooks[] = 'load_multisite_hooks';
25
+			}
26
+		} else {
27
+			// Make sure the hooks are only triggered once
28
+			add_filter( 'frm' . str_replace( 'load', '', $trigger_hooks ) . '_loaded', '__return_true' );
29
+		}
30
+		unset( $trigger_hooks );
31
+
32
+		// Instansiate Controllers
33
+		foreach ( $controllers as $c ) {
34
+			foreach ( $hooks as $hook ) {
35 35
 				call_user_func( array( $c, $hook ) );
36 36
 				unset( $hook );
37
-            }
37
+			}
38 38
 			unset( $c );
39
-        }
39
+		}
40 40
 
41
-    }
41
+	}
42 42
 
43
-    public static function trigger_load_form_hooks() {
44
-        self::trigger_load_hook( 'load_form_hooks' );
45
-    }
43
+	public static function trigger_load_form_hooks() {
44
+		self::trigger_load_hook( 'load_form_hooks' );
45
+	}
46 46
 
47 47
 	public static function load_hooks() {
48 48
 		add_action( 'rest_api_init', 'FrmAppController::create_rest_routes', 0 );
49
-        add_action( 'plugins_loaded', 'FrmAppController::load_lang' );
49
+		add_action( 'plugins_loaded', 'FrmAppController::load_lang' );
50 50
 		add_filter( 'widget_text', 'do_shortcode' );
51 51
 
52
-        // Entries controller
53
-        add_action( 'wp_loaded', 'FrmEntriesController::process_entry', 10, 0 );
54
-        add_action( 'frm_after_entry_processed', 'FrmEntriesController::delete_entry_after_save', 100 );
52
+		// Entries controller
53
+		add_action( 'wp_loaded', 'FrmEntriesController::process_entry', 10, 0 );
54
+		add_action( 'frm_after_entry_processed', 'FrmEntriesController::delete_entry_after_save', 100 );
55 55
 
56
-        // Form Actions Controller
57
-        add_action( 'init', 'FrmFormActionsController::register_post_types', 1 );
56
+		// Form Actions Controller
57
+		add_action( 'init', 'FrmFormActionsController::register_post_types', 1 );
58 58
 		add_action( 'frm_after_create_entry', 'FrmFormActionsController::trigger_create_actions', 20, 3 );
59 59
 
60
-        // Forms Controller
61
-        add_action( 'widgets_init', 'FrmFormsController::register_widgets' );
60
+		// Forms Controller
61
+		add_action( 'widgets_init', 'FrmFormsController::register_widgets' );
62 62
 		add_action( 'init', 'FrmFormsController::front_head' );
63
-        add_filter( 'frm_content', 'FrmFormsController::filter_content', 10, 3 );
64
-        add_filter( 'frm_replace_content_shortcodes', 'FrmFormsController::replace_content_shortcodes', 20, 3 );
65
-        add_action( 'admin_bar_init', 'FrmFormsController::admin_bar_css' );
63
+		add_filter( 'frm_content', 'FrmFormsController::filter_content', 10, 3 );
64
+		add_filter( 'frm_replace_content_shortcodes', 'FrmFormsController::replace_content_shortcodes', 20, 3 );
65
+		add_action( 'admin_bar_init', 'FrmFormsController::admin_bar_css' );
66 66
 		add_action( 'wp_footer', 'FrmFormsController::footer_js', 1, 0 );
67 67
 
68 68
 		add_action( 'wp_scheduled_delete', 'FrmForm::scheduled_delete' );
69 69
 
70
-        // Form Shortcodes
71
-        add_shortcode( 'formidable', 'FrmFormsController::get_form_shortcode' );
70
+		// Form Shortcodes
71
+		add_shortcode( 'formidable', 'FrmFormsController::get_form_shortcode' );
72 72
 
73
-        // Styles Controller
74
-        add_action( 'init', 'FrmStylesController::register_post_types', 0 );
75
-        add_filter( 'frm_get_style_opts', 'FrmStylesController::get_style_opts' );
76
-        add_filter( 'frm_add_form_style_class', 'FrmStylesController::get_form_style_class', 10, 2 );
77
-        add_filter( 'frm_show_entry_styles', 'FrmStylesController::show_entry_styles' );
73
+		// Styles Controller
74
+		add_action( 'init', 'FrmStylesController::register_post_types', 0 );
75
+		add_filter( 'frm_get_style_opts', 'FrmStylesController::get_style_opts' );
76
+		add_filter( 'frm_add_form_style_class', 'FrmStylesController::get_form_style_class', 10, 2 );
77
+		add_filter( 'frm_show_entry_styles', 'FrmStylesController::show_entry_styles' );
78 78
 
79 79
 		//Simple Blocks Controller
80 80
 		add_action( 'init', 'FrmSimpleBlocksController::register_simple_form_block' );
81
-    }
81
+	}
82 82
 
83 83
 	public static function load_admin_hooks() {
84
-        add_action( 'admin_menu', 'FrmAppController::menu', 1 );
84
+		add_action( 'admin_menu', 'FrmAppController::menu', 1 );
85 85
 		add_filter( 'admin_body_class', 'FrmAppController::add_admin_class', 999 );
86
-        add_action( 'admin_enqueue_scripts', 'FrmAppController::load_wp_admin_style' );
87
-        add_action( 'admin_notices', 'FrmAppController::pro_get_started_headline' );
86
+		add_action( 'admin_enqueue_scripts', 'FrmAppController::load_wp_admin_style' );
87
+		add_action( 'admin_notices', 'FrmAppController::pro_get_started_headline' );
88 88
 		add_action( 'admin_init', 'FrmAppController::admin_init', 11 );
89 89
 		add_filter( 'plugin_action_links_' . FrmAppHelper::plugin_folder() . '/formidable.php', 'FrmAppController::settings_link' );
90 90
 		add_filter( 'admin_footer_text', 'FrmAppController::set_footer_text' );
@@ -95,120 +95,120 @@  discard block
 block discarded – undo
95 95
 		add_action( 'admin_menu', 'FrmAddonsController::menu', 100 );
96 96
 		add_filter( 'pre_set_site_transient_update_plugins', 'FrmAddonsController::check_update' );
97 97
 
98
-        // Entries Controller
99
-        add_action( 'admin_menu', 'FrmEntriesController::menu', 12 );
100
-        add_filter( 'contextual_help', 'FrmEntriesController::contextual_help', 10, 3 );
101
-        add_filter( 'set-screen-option', 'FrmEntriesController::save_per_page', 10, 3 );
102
-        add_filter( 'update_user_metadata', 'FrmEntriesController::check_hidden_cols', 10, 5 );
103
-        add_action( 'updated_user_meta', 'FrmEntriesController::update_hidden_cols', 10, 4 );
104
-
105
-        // Form Actions Controller
106
-        if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
107
-            add_action( 'frm_before_update_form_settings', 'FrmFormActionsController::update_settings' );
108
-        }
109
-        add_action( 'frm_after_duplicate_form', 'FrmFormActionsController::duplicate_form_actions', 20, 3 );
110
-
111
-        // Forms Controller
112
-        add_action( 'admin_menu', 'FrmFormsController::menu', 10 );
113
-        add_action( 'admin_head-toplevel_page_formidable', 'FrmFormsController::head' );
114
-
115
-        add_filter( 'set-screen-option', 'FrmFormsController::save_per_page', 10, 3 );
116
-        add_action( 'admin_footer', 'FrmFormsController::insert_form_popup' );
98
+		// Entries Controller
99
+		add_action( 'admin_menu', 'FrmEntriesController::menu', 12 );
100
+		add_filter( 'contextual_help', 'FrmEntriesController::contextual_help', 10, 3 );
101
+		add_filter( 'set-screen-option', 'FrmEntriesController::save_per_page', 10, 3 );
102
+		add_filter( 'update_user_metadata', 'FrmEntriesController::check_hidden_cols', 10, 5 );
103
+		add_action( 'updated_user_meta', 'FrmEntriesController::update_hidden_cols', 10, 4 );
104
+
105
+		// Form Actions Controller
106
+		if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
107
+			add_action( 'frm_before_update_form_settings', 'FrmFormActionsController::update_settings' );
108
+		}
109
+		add_action( 'frm_after_duplicate_form', 'FrmFormActionsController::duplicate_form_actions', 20, 3 );
110
+
111
+		// Forms Controller
112
+		add_action( 'admin_menu', 'FrmFormsController::menu', 10 );
113
+		add_action( 'admin_head-toplevel_page_formidable', 'FrmFormsController::head' );
114
+
115
+		add_filter( 'set-screen-option', 'FrmFormsController::save_per_page', 10, 3 );
116
+		add_action( 'admin_footer', 'FrmFormsController::insert_form_popup' );
117 117
 		add_action( 'media_buttons', 'FrmFormsController::insert_form_button' );
118 118
 		add_action( 'et_pb_admin_excluded_shortcodes', 'FrmFormsController::prevent_divi_conflict' );
119 119
 
120
-        // Forms Model
121
-        add_action( 'frm_after_duplicate_form', 'FrmForm::after_duplicate', 10, 2 );
120
+		// Forms Model
121
+		add_action( 'frm_after_duplicate_form', 'FrmForm::after_duplicate', 10, 2 );
122 122
 
123
-        // Settings Controller
124
-        add_action( 'admin_menu', 'FrmSettingsController::menu', 45 );
125
-        add_action( 'frm_before_settings', 'FrmSettingsController::license_box' );
123
+		// Settings Controller
124
+		add_action( 'admin_menu', 'FrmSettingsController::menu', 45 );
125
+		add_action( 'frm_before_settings', 'FrmSettingsController::license_box' );
126 126
 		add_action( 'frm_after_settings', 'FrmSettingsController::settings_cta' );
127 127
 		add_action( 'wp_ajax_frm_settings_tab', 'FrmSettingsController::load_settings_tab' );
128 128
 
129
-        // Styles Controller
130
-        add_action( 'admin_menu', 'FrmStylesController::menu', 14 );
131
-        add_action( 'admin_init', 'FrmStylesController::admin_init' );
129
+		// Styles Controller
130
+		add_action( 'admin_menu', 'FrmStylesController::menu', 14 );
131
+		add_action( 'admin_init', 'FrmStylesController::admin_init' );
132 132
 
133
-        // XML Controller
134
-        add_action( 'admin_menu', 'FrmXMLController::menu', 41 );
133
+		// XML Controller
134
+		add_action( 'admin_menu', 'FrmXMLController::menu', 41 );
135 135
 
136 136
 		// Simple Blocks Controller
137 137
 		add_action( 'enqueue_block_editor_assets', 'FrmSimpleBlocksController::block_editor_assets' );
138
-    }
138
+	}
139 139
 
140 140
 	public static function load_ajax_hooks() {
141 141
 		add_action( 'wp_ajax_frm_install', 'FrmAppController::ajax_install' );
142
-        add_action( 'wp_ajax_frm_uninstall', 'FrmAppController::uninstall' );
143
-        add_action( 'wp_ajax_frm_deauthorize', 'FrmAppController::deauthorize' );
142
+		add_action( 'wp_ajax_frm_uninstall', 'FrmAppController::uninstall' );
143
+		add_action( 'wp_ajax_frm_deauthorize', 'FrmAppController::deauthorize' );
144 144
 
145 145
 		// Addons
146 146
 		add_action( 'wp_ajax_frm_addon_activate', 'FrmAddon::activate' );
147 147
 		add_action( 'wp_ajax_frm_addon_deactivate', 'FrmAddon::deactivate' );
148 148
 		add_action( 'wp_ajax_frm_install_addon', 'FrmAddonsController::ajax_install_addon' );
149 149
 
150
-        // Fields Controller
151
-        add_action( 'wp_ajax_frm_load_field', 'FrmFieldsController::load_field' );
152
-        add_action( 'wp_ajax_frm_insert_field', 'FrmFieldsController::create' );
153
-        add_action( 'wp_ajax_frm_update_ajax_option', 'FrmFieldsController::update_ajax_option' );
154
-        add_action( 'wp_ajax_frm_duplicate_field', 'FrmFieldsController::duplicate' );
155
-        add_action( 'wp_ajax_frm_delete_field', 'FrmFieldsController::destroy' );
156
-        add_action( 'wp_ajax_frm_add_field_option', 'FrmFieldsController::add_option' );
157
-        add_action( 'wp_ajax_frm_import_choices', 'FrmFieldsController::import_choices' );
158
-        add_action( 'wp_ajax_frm_import_options', 'FrmFieldsController::import_options' );
159
-        add_action( 'wp_ajax_frm_update_field_order', 'FrmFieldsController::update_order' );
160
-
161
-        // Form Actions Controller
162
-        add_action( 'wp_ajax_frm_add_form_action', 'FrmFormActionsController::add_form_action' );
163
-        add_action( 'wp_ajax_frm_form_action_fill', 'FrmFormActionsController::fill_action' );
164
-
165
-        // Forms Controller
150
+		// Fields Controller
151
+		add_action( 'wp_ajax_frm_load_field', 'FrmFieldsController::load_field' );
152
+		add_action( 'wp_ajax_frm_insert_field', 'FrmFieldsController::create' );
153
+		add_action( 'wp_ajax_frm_update_ajax_option', 'FrmFieldsController::update_ajax_option' );
154
+		add_action( 'wp_ajax_frm_duplicate_field', 'FrmFieldsController::duplicate' );
155
+		add_action( 'wp_ajax_frm_delete_field', 'FrmFieldsController::destroy' );
156
+		add_action( 'wp_ajax_frm_add_field_option', 'FrmFieldsController::add_option' );
157
+		add_action( 'wp_ajax_frm_import_choices', 'FrmFieldsController::import_choices' );
158
+		add_action( 'wp_ajax_frm_import_options', 'FrmFieldsController::import_options' );
159
+		add_action( 'wp_ajax_frm_update_field_order', 'FrmFieldsController::update_order' );
160
+
161
+		// Form Actions Controller
162
+		add_action( 'wp_ajax_frm_add_form_action', 'FrmFormActionsController::add_form_action' );
163
+		add_action( 'wp_ajax_frm_form_action_fill', 'FrmFormActionsController::fill_action' );
164
+
165
+		// Forms Controller
166 166
 		add_action( 'wp_ajax_frm_create_from_template', 'FrmFormsController::_create_from_template' );
167 167
 		add_action( 'wp_ajax_frm_save_form', 'FrmFormsController::route' );
168
-        add_action( 'wp_ajax_frm_get_default_html', 'FrmFormsController::get_email_html' );
169
-        add_action( 'wp_ajax_frm_get_shortcode_opts', 'FrmFormsController::get_shortcode_opts' );
170
-        add_action( 'wp_ajax_frm_forms_preview', 'FrmFormsController::preview' );
171
-        add_action( 'wp_ajax_nopriv_frm_forms_preview', 'FrmFormsController::preview' );
168
+		add_action( 'wp_ajax_frm_get_default_html', 'FrmFormsController::get_email_html' );
169
+		add_action( 'wp_ajax_frm_get_shortcode_opts', 'FrmFormsController::get_shortcode_opts' );
170
+		add_action( 'wp_ajax_frm_forms_preview', 'FrmFormsController::preview' );
171
+		add_action( 'wp_ajax_nopriv_frm_forms_preview', 'FrmFormsController::preview' );
172 172
 
173 173
 		// Settings
174 174
 		add_action( 'wp_ajax_frm_lite_settings_upgrade', 'FrmSettingsController::settings_cta_dismiss' );
175 175
 
176
-        // Styles Controller
177
-        add_action( 'wp_ajax_frm_settings_reset', 'FrmStylesController::reset_styling' );
178
-        add_action( 'wp_ajax_frm_change_styling', 'FrmStylesController::change_styling' );
179
-        add_action( 'wp_ajax_frmpro_load_css', 'FrmStylesController::load_css' );
180
-        add_action( 'wp_ajax_nopriv_frmpro_load_css', 'FrmStylesController::load_css' );
176
+		// Styles Controller
177
+		add_action( 'wp_ajax_frm_settings_reset', 'FrmStylesController::reset_styling' );
178
+		add_action( 'wp_ajax_frm_change_styling', 'FrmStylesController::change_styling' );
179
+		add_action( 'wp_ajax_frmpro_load_css', 'FrmStylesController::load_css' );
180
+		add_action( 'wp_ajax_nopriv_frmpro_load_css', 'FrmStylesController::load_css' );
181 181
 		add_action( 'wp_ajax_frmpro_css', 'FrmStylesController::load_saved_css' );
182 182
 		add_action( 'wp_ajax_nopriv_frmpro_css', 'FrmStylesController::load_saved_css' );
183 183
 
184
-        // XML Controller
184
+		// XML Controller
185 185
 		add_action( 'wp_ajax_frm_entries_csv', 'FrmXMLController::csv' );
186 186
 		add_action( 'wp_ajax_nopriv_frm_entries_csv', 'FrmXMLController::csv' );
187
-        add_action( 'wp_ajax_frm_export_xml', 'FrmXMLController::export_xml' );
188
-    }
187
+		add_action( 'wp_ajax_frm_export_xml', 'FrmXMLController::export_xml' );
188
+	}
189 189
 
190 190
 	public static function load_form_hooks() {
191
-        // Fields Controller
192
-        add_filter( 'frm_field_type', 'FrmFieldsController::change_type' );
193
-        add_action( 'frm_field_input_html', 'FrmFieldsController::input_html' );
194
-        add_filter( 'frm_field_value_saved', 'FrmFieldsController::check_value', 50, 3 );
195
-        add_filter( 'frm_field_label_seen', 'FrmFieldsController::check_label' );
191
+		// Fields Controller
192
+		add_filter( 'frm_field_type', 'FrmFieldsController::change_type' );
193
+		add_action( 'frm_field_input_html', 'FrmFieldsController::input_html' );
194
+		add_filter( 'frm_field_value_saved', 'FrmFieldsController::check_value', 50, 3 );
195
+		add_filter( 'frm_field_label_seen', 'FrmFieldsController::check_label' );
196 196
 
197 197
 		// Forms Controller
198 198
 		add_filter( 'frm_form_classes', 'FrmFormsController::form_classes' );
199 199
 
200
-        // Styles Controller
201
-        add_filter( 'frm_use_important_width', 'FrmStylesController::important_style', 10, 2 );
202
-    }
200
+		// Styles Controller
201
+		add_filter( 'frm_use_important_width', 'FrmStylesController::important_style', 10, 2 );
202
+	}
203 203
 
204 204
 	public static function load_view_hooks() {
205
-        // Hooks go here when a view is loaded
206
-    }
205
+		// Hooks go here when a view is loaded
206
+	}
207 207
 
208 208
 	public static function load_multisite_hooks() {
209 209
 		add_action( 'wpmu_upgrade_site', 'FrmAppController::network_upgrade_site' );
210 210
 
211
-        // drop tables when mu site is deleted
212
-        add_filter( 'wpmu_drop_tables', 'FrmAppController::drop_tables' );
213
-    }
211
+		// drop tables when mu site is deleted
212
+		add_filter( 'wpmu_drop_tables', 'FrmAppController::drop_tables' );
213
+	}
214 214
 }
Please login to merge, or discard this patch.
classes/helpers/FrmAppHelper.php 1 patch
Indentation   +551 added lines, -551 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@  discard block
 block discarded – undo
13 13
 	 */
14 14
 	public static $plug_version = '3.05b';
15 15
 
16
-    /**
17
-     * @since 1.07.02
18
-     *
19
-     * @param none
20
-     * @return string The version of this plugin
21
-     */
22
-    public static function plugin_version() {
23
-        return self::$plug_version;
24
-    }
16
+	/**
17
+	 * @since 1.07.02
18
+	 *
19
+	 * @param none
20
+	 * @return string The version of this plugin
21
+	 */
22
+	public static function plugin_version() {
23
+		return self::$plug_version;
24
+	}
25 25
 
26 26
 	public static function plugin_folder() {
27 27
 		return basename( self::plugin_path() );
@@ -31,29 +31,29 @@  discard block
 block discarded – undo
31 31
 		return dirname( dirname( dirname( __FILE__ ) ) );
32 32
 	}
33 33
 
34
-    public static function plugin_url() {
35
-        //prevously FRM_URL constant
34
+	public static function plugin_url() {
35
+		//prevously FRM_URL constant
36 36
 		return plugins_url( '', self::plugin_path() . '/formidable.php' );
37
-    }
37
+	}
38 38
 
39 39
 	public static function relative_plugin_url() {
40 40
 		return str_replace( array( 'https:', 'http:' ), '', self::plugin_url() );
41 41
 	}
42 42
 
43
-    /**
44
-     * @return string Site URL
45
-     */
46
-    public static function site_url() {
47
-        return site_url();
48
-    }
49
-
50
-    /**
51
-     * Get the name of this site
52
-     * Used for [sitename] shortcode
53
-     *
54
-     * @since 2.0
55
-     * @return string
56
-     */
43
+	/**
44
+	 * @return string Site URL
45
+	 */
46
+	public static function site_url() {
47
+		return site_url();
48
+	}
49
+
50
+	/**
51
+	 * Get the name of this site
52
+	 * Used for [sitename] shortcode
53
+	 *
54
+	 * @since 2.0
55
+	 * @return string
56
+	 */
57 57
 	public static function site_name() {
58 58
 		return get_option( 'blogname' );
59 59
 	}
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
 		return add_query_arg( $query_args, $page );
89 89
 	}
90 90
 
91
-    /**
92
-     * Get the Formidable settings
93
-     *
94
-     * @since 2.0
95
-     *
96
-     * @param None
97
-     * @return FrmSettings $frm_setings
98
-     */
91
+	/**
92
+	 * Get the Formidable settings
93
+	 *
94
+	 * @since 2.0
95
+	 *
96
+	 * @param None
97
+	 * @return FrmSettings $frm_setings
98
+	 */
99 99
 	public static function get_settings() {
100 100
 		global $frm_settings;
101 101
 		if ( empty( $frm_settings ) ) {
@@ -156,50 +156,50 @@  discard block
 block discarded – undo
156 156
 		return $is_formidable;
157 157
 	}
158 158
 
159
-    /**
160
-     * Check for certain page in Formidable settings
161
-     *
162
-     * @since 2.0
163
-     *
164
-     * @param string $page The name of the page to check
165
-     * @return boolean
166
-     */
159
+	/**
160
+	 * Check for certain page in Formidable settings
161
+	 *
162
+	 * @since 2.0
163
+	 *
164
+	 * @param string $page The name of the page to check
165
+	 * @return boolean
166
+	 */
167 167
 	public static function is_admin_page( $page = 'formidable' ) {
168
-        global $pagenow;
168
+		global $pagenow;
169 169
 		$get_page = self::simple_get( 'page', 'sanitize_title' );
170
-        if ( $pagenow ) {
170
+		if ( $pagenow ) {
171 171
 			// allow this to be true during ajax load i.e. ajax form builder loading
172 172
 			return ( $pagenow == 'admin.php' || $pagenow == 'admin-ajax.php' ) && $get_page == $page;
173
-        }
173
+		}
174 174
 
175 175
 		return is_admin() && $get_page == $page;
176
-    }
177
-
178
-    /**
179
-     * Check for the form preview page
180
-     *
181
-     * @since 2.0
182
-     *
183
-     * @param None
184
-     * @return boolean
185
-     */
186
-    public static function is_preview_page() {
187
-        global $pagenow;
176
+	}
177
+
178
+	/**
179
+	 * Check for the form preview page
180
+	 *
181
+	 * @since 2.0
182
+	 *
183
+	 * @param None
184
+	 * @return boolean
185
+	 */
186
+	public static function is_preview_page() {
187
+		global $pagenow;
188 188
 		$action = FrmAppHelper::simple_get( 'action', 'sanitize_title' );
189 189
 		return $pagenow && $pagenow == 'admin-ajax.php' && $action == 'frm_forms_preview';
190
-    }
191
-
192
-    /**
193
-     * Check for ajax except the form preview page
194
-     *
195
-     * @since 2.0
196
-     *
197
-     * @param None
198
-     * @return boolean
199
-     */
200
-    public static function doing_ajax() {
201
-        return self::wp_doing_ajax() && ! self::is_preview_page();
202
-    }
190
+	}
191
+
192
+	/**
193
+	 * Check for ajax except the form preview page
194
+	 *
195
+	 * @since 2.0
196
+	 *
197
+	 * @param None
198
+	 * @return boolean
199
+	 */
200
+	public static function doing_ajax() {
201
+		return self::wp_doing_ajax() && ! self::is_preview_page();
202
+	}
203 203
 
204 204
 	public static function js_suffix() {
205 205
 		return defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
@@ -226,81 +226,81 @@  discard block
 block discarded – undo
226 226
 		return isset( $frm_vars['prevent_caching'] ) && $frm_vars['prevent_caching'];
227 227
 	}
228 228
 
229
-    /**
230
-     * Check if on an admin page
231
-     *
232
-     * @since 2.0
233
-     *
234
-     * @param None
235
-     * @return boolean
236
-     */
237
-    public static function is_admin() {
238
-        return is_admin() && ! self::wp_doing_ajax();
239
-    }
240
-
241
-    /**
242
-     * Check if value contains blank value or empty array
243
-     *
244
-     * @since 2.0
245
-     * @param mixed $value - value to check
229
+	/**
230
+	 * Check if on an admin page
231
+	 *
232
+	 * @since 2.0
233
+	 *
234
+	 * @param None
235
+	 * @return boolean
236
+	 */
237
+	public static function is_admin() {
238
+		return is_admin() && ! self::wp_doing_ajax();
239
+	}
240
+
241
+	/**
242
+	 * Check if value contains blank value or empty array
243
+	 *
244
+	 * @since 2.0
245
+	 * @param mixed $value - value to check
246 246
 	 * @param string
247
-     * @return boolean
248
-     */
249
-    public static function is_empty_value( $value, $empty = '' ) {
250
-        return ( is_array( $value ) && empty( $value ) ) || $value === $empty;
251
-    }
252
-
253
-    public static function is_not_empty_value( $value, $empty = '' ) {
254
-        return ! self::is_empty_value( $value, $empty );
255
-    }
256
-
257
-    /**
258
-     * Get any value from the $_SERVER
259
-     *
260
-     * @since 2.0
261
-     * @param string $value
262
-     * @return string
263
-     */
247
+	 * @return boolean
248
+	 */
249
+	public static function is_empty_value( $value, $empty = '' ) {
250
+		return ( is_array( $value ) && empty( $value ) ) || $value === $empty;
251
+	}
252
+
253
+	public static function is_not_empty_value( $value, $empty = '' ) {
254
+		return ! self::is_empty_value( $value, $empty );
255
+	}
256
+
257
+	/**
258
+	 * Get any value from the $_SERVER
259
+	 *
260
+	 * @since 2.0
261
+	 * @param string $value
262
+	 * @return string
263
+	 */
264 264
 	public static function get_server_value( $value ) {
265
-        return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
266
-    }
267
-
268
-    /**
269
-     * Check for the IP address in several places
270
-     * Used by [ip] shortcode
271
-     *
272
-     * @return string The IP address of the current user
273
-     */
274
-    public static function get_ip_address() {
265
+		return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( $_SERVER[ $value ] ) : '';
266
+	}
267
+
268
+	/**
269
+	 * Check for the IP address in several places
270
+	 * Used by [ip] shortcode
271
+	 *
272
+	 * @return string The IP address of the current user
273
+	 */
274
+	public static function get_ip_address() {
275 275
 		$ip = '';
276 276
 		foreach ( array( 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR' ) as $key ) {
277
-            if ( ! isset( $_SERVER[ $key ] ) ) {
278
-                continue;
279
-            }
277
+			if ( ! isset( $_SERVER[ $key ] ) ) {
278
+				continue;
279
+			}
280 280
 
281
-            foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
281
+			foreach ( explode( ',', $_SERVER[ $key ] ) as $ip ) {
282 282
 				$ip = trim( $ip ); // just to be safe
283 283
 
284 284
 				if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) {
285
-                    return sanitize_text_field( $ip );
286
-                }
287
-            }
288
-        }
285
+					return sanitize_text_field( $ip );
286
+				}
287
+			}
288
+		}
289 289
 
290 290
 		return sanitize_text_field( $ip );
291
-    }
291
+	}
292 292
 
293
-    public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
293
+	public static function get_param( $param, $default = '', $src = 'get', $sanitize = '' ) {
294 294
 		if ( strpos( $param, '[' ) ) {
295 295
 			$params = explode( '[', $param );
296
-            $param = $params[0];
297
-        }
296
+			$param = $params[0];
297
+		}
298 298
 
299 299
 		if ( $src == 'get' ) {
300
-            $value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
301
-            if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
302
-                $value = stripslashes_deep( htmlspecialchars_decode( $_GET[ $param ] ) );
303
-            }
300
+			$value = isset( $_POST[ $param ] ) ? stripslashes_deep( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? stripslashes_deep( $_GET[ $param ] ) : $default );
301
+			if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) {
302
+				$value = stripslashes_deep( htmlspecialchars_decode( $_GET[ $param ] ) );
303
+			}
304 304
 			self::sanitize_value( $sanitize, $value );
305 305
 		} else {
306 306
 			$value = self::get_simple_request(
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
 			}
325 325
 		}
326 326
 
327
-        return $value;
328
-    }
327
+		return $value;
328
+	}
329 329
 
330 330
 	public static function get_post_param( $param, $default = '', $sanitize = '' ) {
331 331
 		return self::get_simple_request(
@@ -393,12 +393,12 @@  discard block
 block discarded – undo
393 393
 	}
394 394
 
395 395
 	/**
396
-	* Preserve backslashes in a value, but make sure value doesn't get compounding slashes
397
-	*
398
-	* @since 2.0.8
399
-	* @param string $value
400
-	* @return string $value
401
-	*/
396
+	 * Preserve backslashes in a value, but make sure value doesn't get compounding slashes
397
+	 *
398
+	 * @since 2.0.8
399
+	 * @param string $value
400
+	 * @return string $value
401
+	 */
402 402
 	public static function preserve_backslashes( $value ) {
403 403
 		// If backslashes have already been added, don't add them again
404 404
 		if ( strpos( $value, '\\\\' ) === false ) {
@@ -420,14 +420,14 @@  discard block
 block discarded – undo
420 420
 		}
421 421
 	}
422 422
 
423
-    public static function sanitize_request( $sanitize_method, &$values ) {
424
-        $temp_values = $values;
425
-        foreach ( $temp_values as $k => $val ) {
426
-            if ( isset( $sanitize_method[ $k ] ) ) {
423
+	public static function sanitize_request( $sanitize_method, &$values ) {
424
+		$temp_values = $values;
425
+		foreach ( $temp_values as $k => $val ) {
426
+			if ( isset( $sanitize_method[ $k ] ) ) {
427 427
 				$values[ $k ] = call_user_func( $sanitize_method[ $k ], $val );
428
-            }
429
-        }
430
-    }
428
+			}
429
+		}
430
+	}
431 431
 
432 432
 	/**
433 433
 	 * Sanitize the value, and allow some HTML
@@ -563,39 +563,39 @@  discard block
 block discarded – undo
563 563
 		);
564 564
 	}
565 565
 
566
-    /**
567
-     * Used when switching the action for a bulk action
568
-     * @since 2.0
569
-     */
566
+	/**
567
+	 * Used when switching the action for a bulk action
568
+	 * @since 2.0
569
+	 */
570 570
 	public static function remove_get_action() {
571 571
 		if ( ! isset( $_GET ) ) {
572 572
 			return;
573 573
 		}
574 574
 
575
-        $new_action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ( isset( $_GET['action2'] ) ? sanitize_text_field( $_GET['action2'] ) : '' );
576
-        if ( ! empty( $new_action ) ) {
575
+		$new_action = isset( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : ( isset( $_GET['action2'] ) ? sanitize_text_field( $_GET['action2'] ) : '' );
576
+		if ( ! empty( $new_action ) ) {
577 577
 			$_SERVER['REQUEST_URI'] = str_replace( '&action=' . $new_action, '', FrmAppHelper::get_server_value( 'REQUEST_URI' ) );
578
-        }
579
-    }
578
+		}
579
+	}
580 580
 
581
-    /**
582
-     * Check the WP query for a parameter
583
-     *
584
-     * @since 2.0
585
-     * @return string|array
586
-     */
587
-    public static function get_query_var( $value, $param ) {
588
-        if ( $value != '' ) {
589
-            return $value;
590
-        }
581
+	/**
582
+	 * Check the WP query for a parameter
583
+	 *
584
+	 * @since 2.0
585
+	 * @return string|array
586
+	 */
587
+	public static function get_query_var( $value, $param ) {
588
+		if ( $value != '' ) {
589
+			return $value;
590
+		}
591 591
 
592
-        global $wp_query;
593
-        if ( isset( $wp_query->query_vars[ $param ] ) ) {
594
-            $value = $wp_query->query_vars[ $param ];
595
-        }
592
+		global $wp_query;
593
+		if ( isset( $wp_query->query_vars[ $param ] ) ) {
594
+			$value = $wp_query->query_vars[ $param ];
595
+		}
596 596
 
597
-        return $value;
598
-    }
597
+		return $value;
598
+	}
599 599
 
600 600
 	/**
601 601
 	 * @since 3.0
@@ -617,16 +617,16 @@  discard block
 block discarded – undo
617 617
 		}
618 618
 	}
619 619
 
620
-    /**
621
-     * @param string $type
622
-     */
623
-    public static function trigger_hook_load( $type, $object = null ) {
624
-        // only load the form hooks once
620
+	/**
621
+	 * @param string $type
622
+	 */
623
+	public static function trigger_hook_load( $type, $object = null ) {
624
+		// only load the form hooks once
625 625
 		$hooks_loaded = apply_filters( 'frm_' . $type . '_hooks_loaded', false, $object );
626
-        if ( ! $hooks_loaded ) {
626
+		if ( ! $hooks_loaded ) {
627 627
 			do_action( 'frm_load_' . $type . '_hooks' );
628
-        }
629
-    }
628
+		}
629
+	}
630 630
 
631 631
 	/**
632 632
 	 * Save all front-end js scripts into a single file
@@ -651,18 +651,18 @@  discard block
 block discarded – undo
651 651
 		$new_file->combine_files( $files );
652 652
 	}
653 653
 
654
-    /**
655
-     * Check a value from a shortcode to see if true or false.
656
-     * True when value is 1, true, 'true', 'yes'
657
-     *
658
-     * @since 1.07.10
659
-     *
660
-     * @param string $value The value to compare
661
-     * @return boolean True or False
662
-     */
654
+	/**
655
+	 * Check a value from a shortcode to see if true or false.
656
+	 * True when value is 1, true, 'true', 'yes'
657
+	 *
658
+	 * @since 1.07.10
659
+	 *
660
+	 * @param string $value The value to compare
661
+	 * @return boolean True or False
662
+	 */
663 663
 	public static function is_true( $value ) {
664
-        return ( true === $value || 1 == $value || 'true' == $value || 'yes' == $value );
665
-    }
664
+		return ( true === $value || 1 == $value || 'true' == $value || 'yes' == $value );
665
+	}
666 666
 
667 667
 	public static function get_pages() {
668 668
 		$query = array(
@@ -675,10 +675,10 @@  discard block
 block discarded – undo
675 675
 		return get_posts( $query );
676 676
 	}
677 677
 
678
-    public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
679
-        $pages = self::get_pages();
678
+	public static function wp_pages_dropdown( $field_name, $page_id, $truncate = false ) {
679
+		$pages = self::get_pages();
680 680
 		$selected = self::get_post_param( $field_name, $page_id, 'absint' );
681
-    ?>
681
+	?>
682 682
 		<select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $field_name ); ?>" class="frm-pages-dropdown">
683 683
             <option value=""> </option>
684 684
             <?php foreach ( $pages as $page ) { ?>
@@ -688,16 +688,16 @@  discard block
 block discarded – undo
688 688
             <?php } ?>
689 689
         </select>
690 690
     <?php
691
-    }
691
+	}
692 692
 
693 693
 	public static function post_edit_link( $post_id ) {
694 694
 		$post = get_post( $post_id );
695
-        if ( $post ) {
695
+		if ( $post ) {
696 696
 			$post_url = admin_url( 'post.php?post=' . $post_id . '&action=edit' );
697 697
 			return '<a href="' . esc_url( $post_url ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
698
-        }
699
-        return '';
700
-    }
698
+		}
699
+		return '';
700
+	}
701 701
 
702 702
 	public static function wp_roles_dropdown( $field_name, $capability, $multiple = 'single' ) {
703 703
 		?>
@@ -708,73 +708,73 @@  discard block
 block discarded – undo
708 708
 	}
709 709
 
710 710
 	public static function roles_options( $capability ) {
711
-        global $frm_vars;
711
+		global $frm_vars;
712 712
 		if ( isset( $frm_vars['editable_roles'] ) ) {
713
-            $editable_roles = $frm_vars['editable_roles'];
714
-        } else {
715
-            $editable_roles = get_editable_roles();
716
-            $frm_vars['editable_roles'] = $editable_roles;
717
-        }
713
+			$editable_roles = $frm_vars['editable_roles'];
714
+		} else {
715
+			$editable_roles = get_editable_roles();
716
+			$frm_vars['editable_roles'] = $editable_roles;
717
+		}
718 718
 
719
-        foreach ( $editable_roles as $role => $details ) {
719
+		foreach ( $editable_roles as $role => $details ) {
720 720
 			$name = translate_user_role( $details['name'] );
721 721
 			?>
722 722
 		<option value="<?php echo esc_attr( $role ); ?>" <?php echo in_array( $role, (array) $capability ) ? ' selected="selected"' : ''; ?>><?php echo esc_attr( $name ); ?> </option>
723 723
 <?php
724 724
 			unset( $role, $details );
725
-        }
726
-    }
725
+		}
726
+	}
727 727
 
728 728
 	public static function frm_capabilities( $type = 'auto' ) {
729
-        $cap = array(
730
-            'frm_view_forms'        => __( 'View Forms and Templates', 'formidable' ),
731
-            'frm_edit_forms'        => __( 'Add/Edit Forms and Templates', 'formidable' ),
732
-            'frm_delete_forms'      => __( 'Delete Forms and Templates', 'formidable' ),
733
-            'frm_change_settings'   => __( 'Access this Settings Page', 'formidable' ),
734
-            'frm_view_entries'      => __( 'View Entries from Admin Area', 'formidable' ),
735
-            'frm_delete_entries'    => __( 'Delete Entries from Admin Area', 'formidable' ),
736
-        );
729
+		$cap = array(
730
+			'frm_view_forms'        => __( 'View Forms and Templates', 'formidable' ),
731
+			'frm_edit_forms'        => __( 'Add/Edit Forms and Templates', 'formidable' ),
732
+			'frm_delete_forms'      => __( 'Delete Forms and Templates', 'formidable' ),
733
+			'frm_change_settings'   => __( 'Access this Settings Page', 'formidable' ),
734
+			'frm_view_entries'      => __( 'View Entries from Admin Area', 'formidable' ),
735
+			'frm_delete_entries'    => __( 'Delete Entries from Admin Area', 'formidable' ),
736
+		);
737 737
 
738 738
 		if ( ! self::pro_is_installed() && 'pro' != $type ) {
739
-            return $cap;
740
-        }
739
+			return $cap;
740
+		}
741 741
 
742
-        $cap['frm_create_entries'] = __( 'Add Entries from Admin Area', 'formidable' );
743
-        $cap['frm_edit_entries'] = __( 'Edit Entries from Admin Area', 'formidable' );
744
-        $cap['frm_view_reports'] = __( 'View Reports', 'formidable' );
745
-        $cap['frm_edit_displays'] = __( 'Add/Edit Views', 'formidable' );
742
+		$cap['frm_create_entries'] = __( 'Add Entries from Admin Area', 'formidable' );
743
+		$cap['frm_edit_entries'] = __( 'Edit Entries from Admin Area', 'formidable' );
744
+		$cap['frm_view_reports'] = __( 'View Reports', 'formidable' );
745
+		$cap['frm_edit_displays'] = __( 'Add/Edit Views', 'formidable' );
746 746
 
747
-        return $cap;
748
-    }
747
+		return $cap;
748
+	}
749 749
 
750 750
 	public static function user_has_permission( $needed_role ) {
751
-        if ( $needed_role == '-1' ) {
752
-            return false;
751
+		if ( $needed_role == '-1' ) {
752
+			return false;
753 753
 		}
754 754
 
755
-        // $needed_role will be equal to blank if "Logged-in users" is selected
756
-        if ( ( $needed_role == '' && is_user_logged_in() ) || current_user_can( $needed_role ) ) {
757
-            return true;
758
-        }
755
+		// $needed_role will be equal to blank if "Logged-in users" is selected
756
+		if ( ( $needed_role == '' && is_user_logged_in() ) || current_user_can( $needed_role ) ) {
757
+			return true;
758
+		}
759 759
 
760
-        $roles = array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' );
761
-        foreach ( $roles as $role ) {
760
+		$roles = array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' );
761
+		foreach ( $roles as $role ) {
762 762
 			if ( current_user_can( $role ) ) {
763
-        		return true;
763
+				return true;
764 764
 			}
765
-        	if ( $role == $needed_role ) {
766
-        		break;
765
+			if ( $role == $needed_role ) {
766
+				break;
767 767
 			}
768
-        }
769
-        return false;
770
-    }
771
-
772
-    /**
773
-     * Make sure administrators can see Formidable menu
774
-     *
775
-     * @since 2.0
776
-     */
777
-    public static function maybe_add_permissions() {
768
+		}
769
+		return false;
770
+	}
771
+
772
+	/**
773
+	 * Make sure administrators can see Formidable menu
774
+	 *
775
+	 * @since 2.0
776
+	 */
777
+	public static function maybe_add_permissions() {
778 778
 		self::force_capability( 'frm_view_entries' );
779 779
 
780 780
 		if ( ! current_user_can( 'administrator' ) || current_user_can( 'frm_view_forms' ) ) {
@@ -783,12 +783,12 @@  discard block
 block discarded – undo
783 783
 
784 784
 		$user_id = get_current_user_id();
785 785
 		$user = new WP_User( $user_id );
786
-        $frm_roles = self::frm_capabilities();
787
-        foreach ( $frm_roles as $frm_role => $frm_role_description ) {
786
+		$frm_roles = self::frm_capabilities();
787
+		foreach ( $frm_roles as $frm_role => $frm_role_description ) {
788 788
 			$user->add_cap( $frm_role );
789 789
 			unset( $frm_role, $frm_role_description );
790
-        }
791
-    }
790
+		}
791
+	}
792 792
 
793 793
 	/**
794 794
 	 * Make sure admins have permission to see the menu items
@@ -804,28 +804,28 @@  discard block
 block discarded – undo
804 804
 		}
805 805
 	}
806 806
 
807
-    /**
808
-     * Check if the user has permision for action.
809
-     * Return permission message and stop the action if no permission
810
-     * @since 2.0
811
-     * @param string $permission
812
-     */
807
+	/**
808
+	 * Check if the user has permision for action.
809
+	 * Return permission message and stop the action if no permission
810
+	 * @since 2.0
811
+	 * @param string $permission
812
+	 */
813 813
 	public static function permission_check( $permission, $show_message = 'show' ) {
814 814
 		$permission_error = self::permission_nonce_error( $permission );
815
-        if ( $permission_error !== false ) {
816
-            if ( 'hide' == $show_message ) {
817
-                $permission_error = '';
818
-            }
815
+		if ( $permission_error !== false ) {
816
+			if ( 'hide' == $show_message ) {
817
+				$permission_error = '';
818
+			}
819 819
 			wp_die( esc_html( $permission_error ) );
820
-        }
821
-    }
822
-
823
-    /**
824
-     * Check user permission and nonce
825
-     * @since 2.0
826
-     * @param string $permission
827
-     * @return false|string The permission message or false if allowed
828
-     */
820
+		}
821
+	}
822
+
823
+	/**
824
+	 * Check user permission and nonce
825
+	 * @since 2.0
826
+	 * @param string $permission
827
+	 * @return false|string The permission message or false if allowed
828
+	 */
829 829
 	public static function permission_nonce_error( $permission, $nonce_name = '', $nonce = '' ) {
830 830
 		if ( ! empty( $permission ) && ! current_user_can( $permission ) && ! current_user_can( 'administrator' ) ) {
831 831
 			$frm_settings = self::get_settings();
@@ -834,22 +834,22 @@  discard block
 block discarded – undo
834 834
 
835 835
 		$error = false;
836 836
 		if ( empty( $nonce_name ) ) {
837
-            return $error;
838
-        }
837
+			return $error;
838
+		}
839 839
 
840
-        if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
841
-            $frm_settings = self::get_settings();
842
-            $error = $frm_settings->admin_permission;
843
-        }
840
+		if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $_REQUEST[ $nonce_name ], $nonce ) ) ) {
841
+			$frm_settings = self::get_settings();
842
+			$error = $frm_settings->admin_permission;
843
+		}
844 844
 
845
-        return $error;
846
-    }
845
+		return $error;
846
+	}
847 847
 
848
-    public static function checked( $values, $current ) {
848
+	public static function checked( $values, $current ) {
849 849
 		if ( self::check_selected( $values, $current ) ) {
850
-            echo ' checked="checked"';
850
+			echo ' checked="checked"';
851 851
 		}
852
-    }
852
+	}
853 853
 
854 854
 	public static function check_selected( $values, $current ) {
855 855
 		$values = self::recursive_function_map( $values, 'trim' );
@@ -887,24 +887,24 @@  discard block
 block discarded – undo
887 887
 		return (bool) count( array_filter( array_keys( $array ), 'is_string' ) );
888 888
 	}
889 889
 
890
-    /**
891
-     * Flatten a multi-dimensional array
892
-     */
890
+	/**
891
+	 * Flatten a multi-dimensional array
892
+	 */
893 893
 	public static function array_flatten( $array, $keys = 'keep' ) {
894
-        $return = array();
895
-        foreach ( $array as $key => $value ) {
894
+		$return = array();
895
+		foreach ( $array as $key => $value ) {
896 896
 			if ( is_array( $value ) ) {
897 897
 				$return = array_merge( $return, self::array_flatten( $value, $keys ) );
898
-            } else {
898
+			} else {
899 899
 				if ( $keys == 'keep' ) {
900 900
 					$return[ $key ] = $value;
901 901
 				} else {
902 902
 					$return[] = $value;
903 903
 				}
904
-            }
905
-        }
906
-        return $return;
907
-    }
904
+			}
905
+		}
906
+		return $return;
907
+	}
908 908
 
909 909
 	public static function esc_textarea( $text, $is_rich_text = false ) {
910 910
 		$safe_text = str_replace( '&quot;', '"', $text );
@@ -915,10 +915,10 @@  discard block
 block discarded – undo
915 915
 		return apply_filters( 'esc_textarea', $safe_text, $text );
916 916
 	}
917 917
 
918
-    /**
919
-     * Add auto paragraphs to text areas
920
-     * @since 2.0
921
-     */
918
+	/**
919
+	 * Add auto paragraphs to text areas
920
+	 * @since 2.0
921
+	 */
922 922
 	public static function use_wpautop( $content ) {
923 923
 		if ( apply_filters( 'frm_use_wpautop', true ) ) {
924 924
 			$content = wpautop( str_replace( '<br>', '<br />', $content ) );
@@ -927,26 +927,26 @@  discard block
 block discarded – undo
927 927
 	}
928 928
 
929 929
 	public static function replace_quotes( $val ) {
930
-        //Replace double quotes
930
+		//Replace double quotes
931 931
 		$val = str_replace( array( '&#8220;', '&#8221;', '&#8243;' ), '"', $val );
932
-        //Replace single quotes
933
-        $val = str_replace( array( '&#8216;', '&#8217;', '&#8242;', '&prime;', '&rsquo;', '&lsquo;' ), "'", $val );
934
-        return $val;
935
-    }
936
-
937
-    /**
938
-     * @since 2.0
939
-     * @return string The base Google APIS url for the current version of jQuery UI
940
-     */
941
-    public static function jquery_ui_base_url() {
932
+		//Replace single quotes
933
+		$val = str_replace( array( '&#8216;', '&#8217;', '&#8242;', '&prime;', '&rsquo;', '&lsquo;' ), "'", $val );
934
+		return $val;
935
+	}
936
+
937
+	/**
938
+	 * @since 2.0
939
+	 * @return string The base Google APIS url for the current version of jQuery UI
940
+	 */
941
+	public static function jquery_ui_base_url() {
942 942
 		$url = 'http' . ( is_ssl() ? 's' : '' ) . '://ajax.googleapis.com/ajax/libs/jqueryui/' . self::script_version( 'jquery-ui-core', '1.11.4' );
943 943
 		$url = apply_filters( 'frm_jquery_ui_base_url', $url );
944
-        return $url;
945
-    }
944
+		return $url;
945
+	}
946 946
 
947
-    /**
948
-     * @param string $handle
949
-     */
947
+	/**
948
+	 * @param string $handle
949
+	 */
950 950
 	public static function script_version( $handle, $default = 0 ) {
951 951
 		global $wp_scripts;
952 952
 		if ( ! $wp_scripts ) {
@@ -968,12 +968,12 @@  discard block
 block discarded – undo
968 968
 
969 969
 	public static function js_redirect( $url ) {
970 970
 		return '<script type="text/javascript">window.location="' . esc_url_raw( $url ) . '"</script>';
971
-    }
971
+	}
972 972
 
973 973
 	public static function get_user_id_param( $user_id ) {
974 974
 		if ( ! $user_id || empty( $user_id ) || is_numeric( $user_id ) ) {
975
-            return $user_id;
976
-        }
975
+			return $user_id;
976
+		}
977 977
 
978 978
 		$user_id = sanitize_text_field( $user_id );
979 979
 		if ( $user_id == 'current' ) {
@@ -985,14 +985,14 @@  discard block
 block discarded – undo
985 985
 				$user = get_user_by( 'login', $user_id );
986 986
 			}
987 987
 
988
-            if ( $user ) {
989
-                $user_id = $user->ID;
990
-            }
988
+			if ( $user ) {
989
+				$user_id = $user->ID;
990
+			}
991 991
 			unset( $user );
992
-        }
992
+		}
993 993
 
994
-        return $user_id;
995
-    }
994
+		return $user_id;
995
+	}
996 996
 
997 997
 	public static function get_file_contents( $filename, $atts = array() ) {
998 998
 		if ( ! is_file( $filename ) ) {
@@ -1007,28 +1007,28 @@  discard block
 block discarded – undo
1007 1007
 		return $contents;
1008 1008
 	}
1009 1009
 
1010
-    /**
1011
-     * @param string $table_name
1012
-     * @param string $column
1010
+	/**
1011
+	 * @param string $table_name
1012
+	 * @param string $column
1013 1013
 	 * @param int $id
1014 1014
 	 * @param int $num_chars
1015
-     */
1016
-    public static function get_unique_key( $name = '', $table_name, $column, $id = 0, $num_chars = 5 ) {
1017
-        $key = '';
1015
+	 */
1016
+	public static function get_unique_key( $name = '', $table_name, $column, $id = 0, $num_chars = 5 ) {
1017
+		$key = '';
1018 1018
 
1019
-        if ( ! empty( $name ) ) {
1019
+		if ( ! empty( $name ) ) {
1020 1020
 			$key = sanitize_key( $name );
1021
-        }
1021
+		}
1022 1022
 
1023 1023
 		if ( empty( $key ) ) {
1024 1024
 			$max_slug_value = pow( 36, $num_chars );
1025
-            $min_slug_value = 37; // we want to have at least 2 characters in the slug
1025
+			$min_slug_value = 37; // we want to have at least 2 characters in the slug
1026 1026
 			$key = base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 );
1027
-        }
1027
+		}
1028 1028
 
1029 1029
 		if ( is_numeric( $key ) || in_array( $key, array( 'id', 'key', 'created-at', 'detaillink', 'editlink', 'siteurl', 'evenodd' ) ) ) {
1030 1030
 			$key = $key . 'a';
1031
-        }
1031
+		}
1032 1032
 
1033 1033
 		$key_check = FrmDb::get_var(
1034 1034
 			$table_name,
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 		);
1041 1041
 
1042 1042
 		if ( $key_check || is_numeric( $key_check ) ) {
1043
-            $suffix = 2;
1043
+			$suffix = 2;
1044 1044
 			do {
1045 1045
 				$alt_post_name = substr( $key, 0, 200 - ( strlen( $suffix ) + 1 ) ) . $suffix;
1046 1046
 				$key_check = FrmDb::get_var(
@@ -1054,19 +1054,19 @@  discard block
 block discarded – undo
1054 1054
 				$suffix++;
1055 1055
 			} while ( $key_check || is_numeric( $key_check ) );
1056 1056
 			$key = $alt_post_name;
1057
-        }
1058
-        return $key;
1059
-    }
1060
-
1061
-    /**
1062
-     * Editing a Form or Entry
1063
-     * @param string $table
1064
-     * @return bool|array
1065
-     */
1066
-    public static function setup_edit_vars( $record, $table, $fields = '', $default = false, $post_values = array(), $args = array() ) {
1067
-        if ( ! $record ) {
1068
-            return false;
1069
-        }
1057
+		}
1058
+		return $key;
1059
+	}
1060
+
1061
+	/**
1062
+	 * Editing a Form or Entry
1063
+	 * @param string $table
1064
+	 * @return bool|array
1065
+	 */
1066
+	public static function setup_edit_vars( $record, $table, $fields = '', $default = false, $post_values = array(), $args = array() ) {
1067
+		if ( ! $record ) {
1068
+			return false;
1069
+		}
1070 1070
 
1071 1071
 		if ( empty( $post_values ) ) {
1072 1072
 			$post_values = stripslashes_deep( $_POST );
@@ -1089,14 +1089,14 @@  discard block
 block discarded – undo
1089 1089
 
1090 1090
 		self::prepare_field_arrays( $fields, $record, $values, array_merge( $args, compact( 'default', 'post_values' ) ) );
1091 1091
 
1092
-        if ( $table == 'entries' ) {
1093
-            $values = FrmEntriesHelper::setup_edit_vars( $values, $record );
1094
-        } else if ( $table == 'forms' ) {
1095
-            $values = FrmFormsHelper::setup_edit_vars( $values, $record, $post_values );
1096
-        }
1092
+		if ( $table == 'entries' ) {
1093
+			$values = FrmEntriesHelper::setup_edit_vars( $values, $record );
1094
+		} else if ( $table == 'forms' ) {
1095
+			$values = FrmFormsHelper::setup_edit_vars( $values, $record, $post_values );
1096
+		}
1097 1097
 
1098
-        return $values;
1099
-    }
1098
+		return $values;
1099
+	}
1100 1100
 
1101 1101
 	private static function prepare_field_arrays( $fields, $record, array &$values, $args ) {
1102 1102
 		if ( ! empty( $fields ) ) {
@@ -1109,15 +1109,15 @@  discard block
 block discarded – undo
1109 1109
 	}
1110 1110
 
1111 1111
 	private static function fill_field_defaults( $field, $record, array &$values, $args ) {
1112
-        $post_values = $args['post_values'];
1112
+		$post_values = $args['post_values'];
1113 1113
 
1114
-        if ( $args['default'] ) {
1115
-            $meta_value = $field->default_value;
1116
-        } else {
1114
+		if ( $args['default'] ) {
1115
+			$meta_value = $field->default_value;
1116
+		} else {
1117 1117
 			if ( $record->post_id && self::pro_is_installed() && isset( $field->field_options['post_field'] ) && $field->field_options['post_field'] ) {
1118 1118
 				if ( ! isset( $field->field_options['custom_field'] ) ) {
1119
-                    $field->field_options['custom_field'] = '';
1120
-                }
1119
+					$field->field_options['custom_field'] = '';
1120
+				}
1121 1121
 				$meta_value = FrmProEntryMetaHelper::get_post_value(
1122 1122
 					$record->post_id,
1123 1123
 					$field->field_options['post_field'],
@@ -1129,31 +1129,31 @@  discard block
 block discarded – undo
1129 1129
 						'field' => $field,
1130 1130
 					)
1131 1131
 				);
1132
-            } else {
1132
+			} else {
1133 1133
 				$meta_value = FrmEntryMeta::get_meta_value( $record, $field->id );
1134
-            }
1135
-        }
1134
+			}
1135
+		}
1136 1136
 
1137 1137
 		$field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type;
1138
-        $new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1138
+		$new_value = isset( $post_values['item_meta'][ $field->id ] ) ? maybe_unserialize( $post_values['item_meta'][ $field->id ] ) : $meta_value;
1139 1139
 
1140 1140
 		$field_array = self::start_field_array( $field );
1141 1141
 		$field_array['value'] = $new_value;
1142 1142
 		$field_array['type']  = apply_filters( 'frm_field_type', $field_type, $field, $new_value );
1143 1143
 		$field_array['parent_form_id'] = $args['parent_form_id'];
1144 1144
 
1145
-        $args['field_type'] = $field_type;
1145
+		$args['field_type'] = $field_type;
1146 1146
 
1147 1147
 		FrmFieldsHelper::prepare_edit_front_field( $field_array, $field, $values['id'], $args );
1148 1148
 
1149 1149
 		if ( ! isset( $field_array['unique'] ) || ! $field_array['unique'] ) {
1150
-            $field_array['unique_msg'] = '';
1151
-        }
1150
+			$field_array['unique_msg'] = '';
1151
+		}
1152 1152
 
1153
-        $field_array = array_merge( $field->field_options, $field_array );
1153
+		$field_array = array_merge( $field->field_options, $field_array );
1154 1154
 
1155
-        $values['fields'][ $field->id ] = $field_array;
1156
-    }
1155
+		$values['fields'][ $field->id ] = $field_array;
1156
+	}
1157 1157
 
1158 1158
 	/**
1159 1159
 	 * @since 3.0
@@ -1174,20 +1174,20 @@  discard block
 block discarded – undo
1174 1174
 		);
1175 1175
 	}
1176 1176
 
1177
-    /**
1178
-     * @param string $table
1179
-     */
1177
+	/**
1178
+	 * @param string $table
1179
+	 */
1180 1180
 	private static function fill_form_opts( $record, $table, $post_values, array &$values ) {
1181
-        if ( $table == 'entries' ) {
1182
-            $form = $record->form_id;
1181
+		if ( $table == 'entries' ) {
1182
+			$form = $record->form_id;
1183 1183
 			FrmForm::maybe_get_form( $form );
1184
-        } else {
1185
-            $form = $record;
1186
-        }
1184
+		} else {
1185
+			$form = $record;
1186
+		}
1187 1187
 
1188
-        if ( ! $form ) {
1189
-            return;
1190
-        }
1188
+		if ( ! $form ) {
1189
+			return;
1190
+		}
1191 1191
 
1192 1192
 		$values['form_name'] = isset( $record->form_id ) ? $form->name : '';
1193 1193
 		$values['parent_form_id'] = isset( $record->form_id ) ? $form->parent_form_id : 0;
@@ -1196,26 +1196,26 @@  discard block
 block discarded – undo
1196 1196
 			return;
1197 1197
 		}
1198 1198
 
1199
-        foreach ( $form->options as $opt => $value ) {
1200
-            $values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1201
-        }
1199
+		foreach ( $form->options as $opt => $value ) {
1200
+			$values[ $opt ] = isset( $post_values[ $opt ] ) ? maybe_unserialize( $post_values[ $opt ] ) : $value;
1201
+		}
1202 1202
 
1203 1203
 		self::fill_form_defaults( $post_values, $values );
1204
-    }
1204
+	}
1205 1205
 
1206
-    /**
1207
-     * Set to POST value or default
1208
-     */
1206
+	/**
1207
+	 * Set to POST value or default
1208
+	 */
1209 1209
 	private static function fill_form_defaults( $post_values, array &$values ) {
1210
-        $form_defaults = FrmFormsHelper::get_default_opts();
1210
+		$form_defaults = FrmFormsHelper::get_default_opts();
1211 1211
 
1212
-        foreach ( $form_defaults as $opt => $default ) {
1213
-            if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1212
+		foreach ( $form_defaults as $opt => $default ) {
1213
+			if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) {
1214 1214
 				$values[ $opt ] = ( $post_values && isset( $post_values['options'][ $opt ] ) ) ? $post_values['options'][ $opt ] : $default;
1215
-            }
1215
+			}
1216 1216
 
1217 1217
 			unset( $opt, $default );
1218
-        }
1218
+		}
1219 1219
 
1220 1220
 		if ( ! isset( $values['custom_style'] ) ) {
1221 1221
 			$values['custom_style'] = self::custom_style_value( $post_values );
@@ -1224,10 +1224,10 @@  discard block
 block discarded – undo
1224 1224
 		foreach ( array( 'before', 'after', 'submit' ) as $h ) {
1225 1225
 			if ( ! isset( $values[ $h . '_html' ] ) ) {
1226 1226
 				$values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) );
1227
-            }
1227
+			}
1228 1228
 			unset( $h );
1229
-        }
1230
-    }
1229
+		}
1230
+	}
1231 1231
 
1232 1232
 	/**
1233 1233
 	 * @since 2.2.10
@@ -1250,33 +1250,33 @@  discard block
 block discarded – undo
1250 1250
 		if ( $possible_email_field ) {
1251 1251
 			$class .= 'show_frm_not_email_to';
1252 1252
 		}
1253
-    ?>
1253
+	?>
1254 1254
 <li>
1255 1255
 	<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>
1256 1256
 	<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>
1257 1257
 	<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>
1258 1258
 </li>
1259 1259
     <?php
1260
-    }
1260
+	}
1261 1261
 
1262 1262
 	public static function truncate( $str, $length, $minword = 3, $continue = '...' ) {
1263
-        if ( is_array( $str ) ) {
1264
-            return '';
1263
+		if ( is_array( $str ) ) {
1264
+			return '';
1265 1265
 		}
1266 1266
 
1267
-        $length = (int) $length;
1267
+		$length = (int) $length;
1268 1268
 		$str = wp_strip_all_tags( $str );
1269 1269
 		$original_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $str ) );
1270 1270
 
1271 1271
 		if ( $length == 0 ) {
1272
-            return '';
1273
-        } else if ( $length <= 10 ) {
1272
+			return '';
1273
+		} else if ( $length <= 10 ) {
1274 1274
 			$sub = self::mb_function( array( 'mb_substr', 'substr' ), array( $str, 0, $length ) );
1275 1275
 			return $sub . ( ( $length < $original_len ) ? $continue : '' );
1276
-        }
1276
+		}
1277 1277
 
1278
-        $sub = '';
1279
-        $len = 0;
1278
+		$sub = '';
1279
+		$len = 0;
1280 1280
 
1281 1281
 		$words = self::mb_function( array( 'mb_split', 'explode' ), array( ' ', $str ) );
1282 1282
 
@@ -1284,21 +1284,21 @@  discard block
 block discarded – undo
1284 1284
 			$part = ( ( $sub != '' ) ? ' ' : '' ) . $word;
1285 1285
 			$total_len = self::mb_function( array( 'mb_strlen', 'strlen' ), array( $sub . $part ) );
1286 1286
 			if ( $total_len > $length && str_word_count( $sub ) ) {
1287
-                break;
1288
-            }
1287
+				break;
1288
+			}
1289 1289
 
1290
-            $sub .= $part;
1290
+			$sub .= $part;
1291 1291
 			$len += self::mb_function( array( 'mb_strlen', 'strlen' ), array( $part ) );
1292 1292
 
1293 1293
 			if ( str_word_count( $sub ) > $minword && $total_len >= $length ) {
1294
-                break;
1295
-            }
1294
+				break;
1295
+			}
1296 1296
 
1297 1297
 			unset( $total_len, $word );
1298
-        }
1298
+		}
1299 1299
 
1300 1300
 		return $sub . ( ( $len < $original_len ) ? $continue : '' );
1301
-    }
1301
+	}
1302 1302
 
1303 1303
 	public static function mb_function( $function_names, $args ) {
1304 1304
 		$mb_function_name = $function_names[0];
@@ -1311,17 +1311,17 @@  discard block
 block discarded – undo
1311 1311
 
1312 1312
 	public static function get_formatted_time( $date, $date_format = '', $time_format = '' ) {
1313 1313
 		if ( empty( $date ) ) {
1314
-            return $date;
1315
-        }
1314
+			return $date;
1315
+		}
1316 1316
 
1317 1317
 		if ( empty( $date_format ) ) {
1318 1318
 			$date_format = get_option( 'date_format' );
1319 1319
 		}
1320 1320
 
1321 1321
 		if ( preg_match( '/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date ) && self::pro_is_installed() ) {
1322
-            $frmpro_settings = new FrmProSettings();
1322
+			$frmpro_settings = new FrmProSettings();
1323 1323
 			$date = FrmProAppHelper::convert_date( $date, $frmpro_settings->date_format, 'Y-m-d' );
1324
-        }
1324
+		}
1325 1325
 
1326 1326
 		$formatted = self::get_localized_date( $date_format, $date );
1327 1327
 
@@ -1330,8 +1330,8 @@  discard block
 block discarded – undo
1330 1330
 			$formatted .= self::add_time_to_date( $time_format, $date );
1331 1331
 		}
1332 1332
 
1333
-        return $formatted;
1334
-    }
1333
+		return $formatted;
1334
+	}
1335 1335
 
1336 1336
 	private static function add_time_to_date( $time_format, $date ) {
1337 1337
 		if ( empty( $time_format ) ) {
@@ -1413,32 +1413,32 @@  discard block
 block discarded – undo
1413 1413
 		);
1414 1414
 	}
1415 1415
 
1416
-    // Pagination Methods
1416
+	// Pagination Methods
1417 1417
 
1418
-    /**
1419
-     * @param integer $current_p
1420
-     */
1418
+	/**
1419
+	 * @param integer $current_p
1420
+	 */
1421 1421
 	public static function get_last_record_num( $r_count, $current_p, $p_size ) {
1422 1422
 		return ( ( $r_count < ( $current_p * $p_size ) ) ? $r_count : ( $current_p * $p_size ) );
1423 1423
 	}
1424 1424
 
1425
-    /**
1426
-     * @param integer $current_p
1427
-     */
1428
-    public static function get_first_record_num( $r_count, $current_p, $p_size ) {
1429
-        if ( $current_p == 1 ) {
1430
-            return 1;
1431
-        } else {
1432
-            return ( self::get_last_record_num( $r_count, ( $current_p - 1 ), $p_size ) + 1 );
1433
-        }
1434
-    }
1425
+	/**
1426
+	 * @param integer $current_p
1427
+	 */
1428
+	public static function get_first_record_num( $r_count, $current_p, $p_size ) {
1429
+		if ( $current_p == 1 ) {
1430
+			return 1;
1431
+		} else {
1432
+			return ( self::get_last_record_num( $r_count, ( $current_p - 1 ), $p_size ) + 1 );
1433
+		}
1434
+	}
1435 1435
 
1436 1436
 	/**
1437 1437
 	 * @return array
1438 1438
 	 */
1439 1439
 	public static function json_to_array( $json_vars ) {
1440
-        $vars = array();
1441
-        foreach ( $json_vars as $jv ) {
1440
+		$vars = array();
1441
+		foreach ( $json_vars as $jv ) {
1442 1442
 			$jv_name = explode( '[', $jv['name'] );
1443 1443
 			$last = count( $jv_name ) - 1;
1444 1444
 			foreach ( $jv_name as $p => $n ) {
@@ -1455,77 +1455,77 @@  discard block
 block discarded – undo
1455 1455
 					$l3 = $name;
1456 1456
 				}
1457 1457
 
1458
-                $this_val = ( $p == $last ) ? $jv['value'] : array();
1458
+				$this_val = ( $p == $last ) ? $jv['value'] : array();
1459 1459
 
1460
-                switch ( $p ) {
1461
-                    case 0:
1462
-                        $l1 = $name;
1463
-                        self::add_value_to_array( $name, $l1, $this_val, $vars );
1460
+				switch ( $p ) {
1461
+					case 0:
1462
+						$l1 = $name;
1463
+						self::add_value_to_array( $name, $l1, $this_val, $vars );
1464 1464
 						break;
1465 1465
 
1466
-                    case 1:
1467
-                        $l2 = $name;
1468
-                        self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1466
+					case 1:
1467
+						$l2 = $name;
1468
+						self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] );
1469 1469
 						break;
1470 1470
 
1471
-                    case 2:
1472
-                        $l3 = $name;
1473
-                        self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1471
+					case 2:
1472
+						$l3 = $name;
1473
+						self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] );
1474 1474
 						break;
1475 1475
 
1476
-                    case 3:
1477
-                        $l4 = $name;
1478
-                        self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1479
-                }
1476
+					case 3:
1477
+						$l4 = $name;
1478
+						self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] );
1479
+				}
1480 1480
 
1481 1481
 				unset( $this_val, $n );
1482
-            }
1482
+			}
1483 1483
 
1484 1484
 			unset( $last, $jv );
1485
-        }
1486
-
1487
-        return $vars;
1488
-    }
1489
-
1490
-    /**
1491
-     * @param string $name
1492
-     * @param string $l1
1493
-     */
1494
-    public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1495
-        if ( $name == '' ) {
1496
-            $vars[] = $val;
1497
-        } else if ( ! isset( $vars[ $l1 ] ) ) {
1498
-            $vars[ $l1 ] = $val;
1499
-        }
1500
-    }
1485
+		}
1486
+
1487
+		return $vars;
1488
+	}
1489
+
1490
+	/**
1491
+	 * @param string $name
1492
+	 * @param string $l1
1493
+	 */
1494
+	public static function add_value_to_array( $name, $l1, $val, &$vars ) {
1495
+		if ( $name == '' ) {
1496
+			$vars[] = $val;
1497
+		} else if ( ! isset( $vars[ $l1 ] ) ) {
1498
+			$vars[ $l1 ] = $val;
1499
+		}
1500
+	}
1501 1501
 
1502 1502
 	public static function maybe_add_tooltip( $name, $class = 'closed', $form_name = '' ) {
1503
-        $tooltips = array(
1504
-            'action_title'  => __( 'Give this action a label for easy reference.', 'formidable' ),
1505
-            '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' ),
1506
-            'cc'            => __( 'Add CC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1507
-            'bcc'           => __( 'Add BCC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1508
-            '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' ),
1509
-            'from'          => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <[email protected]> or [email protected].', 'formidable' ),
1510
-            '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() ) ),
1511
-        );
1512
-
1513
-        if ( ! isset( $tooltips[ $name ] ) ) {
1514
-            return;
1515
-        }
1516
-
1517
-        if ( 'open' == $class ) {
1518
-            echo ' frm_help"';
1519
-        } else {
1520
-            echo ' class="frm_help"';
1521
-        }
1503
+		$tooltips = array(
1504
+			'action_title'  => __( 'Give this action a label for easy reference.', 'formidable' ),
1505
+			'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' ),
1506
+			'cc'            => __( 'Add CC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1507
+			'bcc'           => __( 'Add BCC addresses separated by a ",".  FORMAT: Name <[email protected]> or [email protected].', 'formidable' ),
1508
+			'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' ),
1509
+			'from'          => __( 'Enter the name and/or email address of the sender. FORMAT: John Bates <[email protected]> or [email protected].', 'formidable' ),
1510
+			'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() ) ),
1511
+		);
1512
+
1513
+		if ( ! isset( $tooltips[ $name ] ) ) {
1514
+			return;
1515
+		}
1516
+
1517
+		if ( 'open' == $class ) {
1518
+			echo ' frm_help"';
1519
+		} else {
1520
+			echo ' class="frm_help"';
1521
+		}
1522 1522
 
1523 1523
 		echo ' title="' . esc_attr( $tooltips[ $name ] );
1524 1524
 
1525
-        if ( 'open' != $class ) {
1526
-            echo '"';
1527
-        }
1528
-    }
1525
+		if ( 'open' != $class ) {
1526
+			echo '"';
1527
+		}
1528
+	}
1529 1529
 
1530 1530
 	/**
1531 1531
 	 * Add the current_page class to that page in the form nav
@@ -1541,35 +1541,35 @@  discard block
 block discarded – undo
1541 1541
 		}
1542 1542
 	}
1543 1543
 
1544
-    /**
1545
-     * Prepare and json_encode post content
1546
-     *
1547
-     * @since 2.0
1548
-     *
1549
-     * @param array $post_content
1550
-     * @return string $post_content ( json encoded array )
1551
-     */
1552
-    public static function prepare_and_encode( $post_content ) {
1553
-        //Loop through array to strip slashes and add only the needed ones
1544
+	/**
1545
+	 * Prepare and json_encode post content
1546
+	 *
1547
+	 * @since 2.0
1548
+	 *
1549
+	 * @param array $post_content
1550
+	 * @return string $post_content ( json encoded array )
1551
+	 */
1552
+	public static function prepare_and_encode( $post_content ) {
1553
+		//Loop through array to strip slashes and add only the needed ones
1554 1554
 		foreach ( $post_content as $key => $val ) {
1555 1555
 			// Replace problematic characters (like &quot;)
1556 1556
 			$val = str_replace( '&quot;', '"', $val );
1557 1557
 
1558 1558
 			self::prepare_action_slashes( $val, $key, $post_content );
1559
-            unset( $key, $val );
1560
-        }
1559
+			unset( $key, $val );
1560
+		}
1561 1561
 
1562
-        // json_encode the array
1563
-        $post_content = json_encode( $post_content );
1562
+		// json_encode the array
1563
+		$post_content = json_encode( $post_content );
1564 1564
 
1565
-	    // add extra slashes for \r\n since WP strips them
1565
+		// add extra slashes for \r\n since WP strips them
1566 1566
 		$post_content = str_replace( array( '\\r', '\\n', '\\u', '\\t' ), array( '\\\\r', '\\\\n', '\\\\u', '\\\\t' ), $post_content );
1567 1567
 
1568
-        // allow for &quot
1569
-	    $post_content = str_replace( '&quot;', '\\"', $post_content );
1568
+		// allow for &quot
1569
+		$post_content = str_replace( '&quot;', '\\"', $post_content );
1570 1570
 
1571
-        return $post_content;
1572
-    }
1571
+		return $post_content;
1572
+	}
1573 1573
 
1574 1574
 	private static function prepare_action_slashes( $val, $key, &$post_content ) {
1575 1575
 		if ( ! isset( $post_content[ $key ] ) ) {
@@ -1592,54 +1592,54 @@  discard block
 block discarded – undo
1592 1592
 
1593 1593
 	public static function maybe_json_decode( $string ) {
1594 1594
 		if ( is_array( $string ) ) {
1595
-            return $string;
1596
-        }
1595
+			return $string;
1596
+		}
1597 1597
 
1598 1598
 		$new_string = json_decode( $string, true );
1599 1599
 		if ( function_exists( 'json_last_error' ) ) {
1600 1600
 			// php 5.3+
1601
-            if ( json_last_error() == JSON_ERROR_NONE ) {
1602
-                $string = $new_string;
1603
-            }
1601
+			if ( json_last_error() == JSON_ERROR_NONE ) {
1602
+				$string = $new_string;
1603
+			}
1604 1604
 		} elseif ( isset( $new_string ) ) {
1605 1605
 			// php < 5.3 fallback
1606
-            $string = $new_string;
1607
-        }
1608
-        return $string;
1609
-    }
1610
-
1611
-    /**
1612
-     * @since 1.07.10
1613
-     *
1614
-     * @param string $post_type The name of the post type that may need to be highlighted
1615
-     * echo The javascript to open and highlight the Formidable menu
1616
-     */
1606
+			$string = $new_string;
1607
+		}
1608
+		return $string;
1609
+	}
1610
+
1611
+	/**
1612
+	 * @since 1.07.10
1613
+	 *
1614
+	 * @param string $post_type The name of the post type that may need to be highlighted
1615
+	 * echo The javascript to open and highlight the Formidable menu
1616
+	 */
1617 1617
 	public static function maybe_highlight_menu( $post_type ) {
1618
-        global $post;
1618
+		global $post;
1619 1619
 
1620 1620
 		if ( isset( $_REQUEST['post_type'] ) && $_REQUEST['post_type'] != $post_type ) {
1621
-            return;
1622
-        }
1621
+			return;
1622
+		}
1623 1623
 
1624 1624
 		if ( is_object( $post ) && $post->post_type != $post_type ) {
1625
-            return;
1626
-        }
1625
+			return;
1626
+		}
1627 1627
 
1628
-        self::load_admin_wide_js();
1629
-        echo '<script type="text/javascript">jQuery(document).ready(function(){frmSelectSubnav();});</script>';
1630
-    }
1628
+		self::load_admin_wide_js();
1629
+		echo '<script type="text/javascript">jQuery(document).ready(function(){frmSelectSubnav();});</script>';
1630
+	}
1631 1631
 
1632
-    /**
1633
-     * Load the JS file on non-Formidable pages in the admin area
1634
-     * @since 2.0
1635
-     */
1632
+	/**
1633
+	 * Load the JS file on non-Formidable pages in the admin area
1634
+	 * @since 2.0
1635
+	 */
1636 1636
 	public static function load_admin_wide_js( $load = true ) {
1637
-        $version = FrmAppHelper::plugin_version();
1637
+		$version = FrmAppHelper::plugin_version();
1638 1638
 		wp_register_script( 'formidable_admin_global', FrmAppHelper::plugin_url() . '/js/formidable_admin_global.js', array( 'jquery' ), $version );
1639 1639
 
1640 1640
 		$global_strings = array(
1641 1641
 			'updating_msg' => __( 'Please wait while your site updates.', 'formidable' ),
1642
-            'deauthorize'  => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
1642
+			'deauthorize'  => __( 'Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable' ),
1643 1643
 			'url'          => FrmAppHelper::plugin_url(),
1644 1644
 			'loading'      => __( 'Loading&hellip;' ),
1645 1645
 			'nonce'        => wp_create_nonce( 'frm_ajax' ),
@@ -1649,7 +1649,7 @@  discard block
 block discarded – undo
1649 1649
 		if ( $load ) {
1650 1650
 			wp_enqueue_script( 'formidable_admin_global' );
1651 1651
 		}
1652
-    }
1652
+	}
1653 1653
 
1654 1654
 	/**
1655 1655
 	 * @since 2.0.9
@@ -1658,9 +1658,9 @@  discard block
 block discarded – undo
1658 1658
 		wp_enqueue_style( 'frm_fonts', self::plugin_url() . '/css/frm_fonts.css', array(), self::plugin_version() );
1659 1659
 	}
1660 1660
 
1661
-    /**
1662
-     * @param string $location
1663
-     */
1661
+	/**
1662
+	 * @param string $location
1663
+	 */
1664 1664
 	public static function localize_script( $location ) {
1665 1665
 		$ajax_url = admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' );
1666 1666
 		$ajax_url = apply_filters( 'frm_ajax_url', $ajax_url );
@@ -1726,27 +1726,27 @@  discard block
 block discarded – undo
1726 1726
 		}
1727 1727
 	}
1728 1728
 
1729
-    /**
1729
+	/**
1730 1730
 	 * echo the message on the plugins listing page
1731
-     * @since 1.07.10
1732
-     *
1733
-     * @param float $min_version The version the add-on requires
1734
-     */
1731
+	 * @since 1.07.10
1732
+	 *
1733
+	 * @param float $min_version The version the add-on requires
1734
+	 */
1735 1735
 	public static function min_version_notice( $min_version ) {
1736
-        $frm_version = self::plugin_version();
1736
+		$frm_version = self::plugin_version();
1737 1737
 
1738
-        // check if Formidable meets minimum requirements
1738
+		// check if Formidable meets minimum requirements
1739 1739
 		if ( version_compare( $frm_version, $min_version, '>=' ) ) {
1740
-            return;
1741
-        }
1740
+			return;
1741
+		}
1742 1742
 
1743 1743
 		$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
1744 1744
 		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">' .
1745
-        esc_html__( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1746
-        '</div></td></tr>';
1747
-    }
1745
+		esc_html__( 'You are running an outdated version of Formidable. This plugin may not work correctly if you do not update Formidable.', 'formidable' ) .
1746
+		'</div></td></tr>';
1747
+	}
1748 1748
 
1749
-    public static function locales( $type = 'date' ) {
1749
+	public static function locales( $type = 'date' ) {
1750 1750
 		$locales = array(
1751 1751
 			'en' => __( 'English', 'formidable' ),
1752 1752
 			''   => __( 'English/Western', 'formidable' ),
@@ -1825,8 +1825,8 @@  discard block
 block discarded – undo
1825 1825
 		$locales = array_diff_key( $locales, array_flip( $unset ) );
1826 1826
 		$locales = apply_filters( 'frm_locales', $locales );
1827 1827
 
1828
-        return $locales;
1829
-    }
1828
+		return $locales;
1829
+	}
1830 1830
 
1831 1831
 	/**
1832 1832
 	 * Used to filter shortcode in text widgets
Please login to merge, or discard this patch.