Completed
Push — master ( adf79c...3fa9d1 )
by Jamie
03:51 queued 01:11
created
classes/views/frm-entries/new.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1
-<div class="frm_forms <?php echo FrmFormsHelper::get_form_style_class($values); ?>" id="frm_form_<?php echo esc_attr( $form->id ) ?>_container" <?php echo apply_filters( 'frm_form_div_attributes', '', $form ); ?>>
1
+<div class="frm_forms <?php echo FrmFormsHelper::get_form_style_class( $values ); ?>" id="frm_form_<?php echo esc_attr( $form->id ) ?>_container" <?php echo apply_filters( 'frm_form_div_attributes', '', $form ); ?>>
2 2
 <?php
3 3
 if ( ! isset( $include_form_tag ) || $include_form_tag ) {
4 4
 ?>
5
-<form enctype="<?php echo esc_attr( apply_filters( 'frm_form_enctype', 'multipart/form-data', $form ) ) ?>" method="post" class="frm-show-form <?php do_action('frm_form_classes', $form) ?>" id="form_<?php echo esc_attr( $form->form_key ) ?>" <?php echo $frm_settings->use_html ? '' : 'action=""'; ?> <?php echo apply_filters( 'frm_form_attributes', '', $form ); ?>>
5
+<form enctype="<?php echo esc_attr( apply_filters( 'frm_form_enctype', 'multipart/form-data', $form ) ) ?>" method="post" class="frm-show-form <?php do_action( 'frm_form_classes', $form ) ?>" id="form_<?php echo esc_attr( $form->form_key ) ?>" <?php echo $frm_settings->use_html ? '' : 'action=""'; ?> <?php echo apply_filters( 'frm_form_attributes', '', $form ); ?>>
6 6
 <?php
7 7
 } else { ?>
8
-<div id="form_<?php echo esc_attr( $form->form_key ) ?>" class="frm-show-form <?php do_action('frm_form_classes', $form) ?>" >
8
+<div id="form_<?php echo esc_attr( $form->form_key ) ?>" class="frm-show-form <?php do_action( 'frm_form_classes', $form ) ?>" >
9 9
 <?php
10 10
 }
11 11
 
Please login to merge, or discard this patch.
classes/widgets/FrmShowForm.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 	}
9 9
 
10 10
 	public function widget( $args, $instance ) {
11
-        $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
11
+		$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
12 12
 
13 13
 		echo $args['before_widget'];
14 14
 
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 	}
35 35
 
36 36
 	public function form( $instance ) {
37
-	    //Defaults
37
+		//Defaults
38 38
 		$instance = wp_parse_args( (array) $instance, array(
39
-		    'title' => false, 'form' => false, 'description' => false,
39
+			'title' => false, 'form' => false, 'description' => false,
40 40
 		) );
41 41
 ?>
42 42
 	<p><label for="<?php echo esc_attr( $this->get_field_id('title') ); ?>"><?php _e( 'Title', 'formidable' ) ?>:</label><br/>
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
 
45 45
 	<p><label for="<?php echo esc_attr( $this->get_field_id('form') ); ?>"><?php _e( 'Form', 'formidable' ) ?>:</label><br/>
46 46
 <?php
47
-	    FrmFormsHelper::forms_dropdown( $this->get_field_name('form'), $instance['form'], array(
48
-	        'blank' => false, 'field_id' => $this->get_field_id('form'),
49
-            'class' => 'widefat',
50
-	    ) );
47
+		FrmFormsHelper::forms_dropdown( $this->get_field_name('form'), $instance['form'], array(
48
+			'blank' => false, 'field_id' => $this->get_field_id('form'),
49
+			'class' => 'widefat',
50
+		) );
51 51
 ?>
52 52
 	</p>
53 53
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 	public function __construct() {
6 6
 		$widget_ops = array( 'description' => __( 'Display a Formidable Form', 'formidable' ) );
7
-		parent::__construct('frm_show_form', __( 'Formidable Form', 'formidable' ), $widget_ops);
7
+		parent::__construct( 'frm_show_form', __( 'Formidable Form', 'formidable' ), $widget_ops );
8 8
 	}
9 9
 
10 10
 	public function widget( $args, $instance ) {
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 		echo '<div class="frm_form_widget">';
16 16
 		if ( $title ) {
17
-			echo $args['before_title'] . stripslashes($title) . $args['after_title'];
17
+			echo $args['before_title'] . stripslashes( $title ) . $args['after_title'];
18 18
 		}
19 19
 
20 20
 		$form_atts = array(
@@ -39,19 +39,19 @@  discard block
 block discarded – undo
39 39
 		    'title' => false, 'form' => false, 'description' => false,
40 40
 		) );
41 41
 ?>
42
-	<p><label for="<?php echo esc_attr( $this->get_field_id('title') ); ?>"><?php _e( 'Title', 'formidable' ) ?>:</label><br/>
43
-	<input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id('title') ); ?>" name="<?php echo esc_attr( $this->get_field_name('title') ); ?>" value="<?php echo esc_attr( stripslashes($instance['title']) ); ?>" /></p>
42
+	<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title', 'formidable' ) ?>:</label><br/>
43
+	<input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( stripslashes( $instance['title'] ) ); ?>" /></p>
44 44
 
45
-	<p><label for="<?php echo esc_attr( $this->get_field_id('form') ); ?>"><?php _e( 'Form', 'formidable' ) ?>:</label><br/>
45
+	<p><label for="<?php echo esc_attr( $this->get_field_id( 'form' ) ); ?>"><?php _e( 'Form', 'formidable' ) ?>:</label><br/>
46 46
 <?php
47
-	    FrmFormsHelper::forms_dropdown( $this->get_field_name('form'), $instance['form'], array(
48
-	        'blank' => false, 'field_id' => $this->get_field_id('form'),
47
+	    FrmFormsHelper::forms_dropdown( $this->get_field_name( 'form' ), $instance['form'], array(
48
+	        'blank' => false, 'field_id' => $this->get_field_id( 'form' ),
49 49
             'class' => 'widefat',
50 50
 	    ) );
51 51
 ?>
52 52
 	</p>
53 53
 
54
-	<p><label for="<?php echo esc_attr( $this->get_field_id('description') ); ?>"><input class="checkbox" type="checkbox" <?php checked($instance['description'], true) ?> id="<?php echo esc_attr( $this->get_field_id('description') ); ?>" name="<?php echo esc_attr( $this->get_field_name('description') ); ?>" value="1" />
54
+	<p><label for="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>"><input class="checkbox" type="checkbox" <?php checked( $instance['description'], true ) ?> id="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'description' ) ); ?>" value="1" />
55 55
 	<?php _e( 'Show Description', 'formidable' ) ?></label></p>
56 56
 <?php
57 57
 	}
Please login to merge, or discard this patch.
classes/controllers/FrmAddonsController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@
 block discarded – undo
194 194
 			}
195 195
 			$addon['link'] = FrmAppHelper::make_affiliate_url( $addon['link'] );
196 196
 
197
-			$addons[ $slug ] = $addon;
197
+			$addons[$slug] = $addon;
198 198
 		}
199 199
 	}
200 200
 
Please login to merge, or discard this patch.
classes/views/frm-fields/input.php 2 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -10,41 +10,41 @@  discard block
 block discarded – undo
10 10
 <?php
11 11
 
12 12
 } else if ( $field['type'] == 'radio' ) {
13
-    $read_only = false;
13
+	$read_only = false;
14 14
 	if ( FrmField::is_read_only( $field ) && ! FrmAppHelper::is_admin() ) {
15
-        $read_only = true; ?>
15
+		$read_only = true; ?>
16 16
 <input type="hidden" value="<?php echo esc_attr( $field['value'] ) ?>" name="<?php echo esc_attr( $field_name ) ?>" />
17 17
 <?php
18
-    }
18
+	}
19 19
 
20
-    if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
20
+	if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
21 21
 		do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) );
22
-    } else if ( is_array($field['options']) ) {
23
-        foreach ( $field['options'] as $opt_key => $opt ) {
22
+	} else if ( is_array($field['options']) ) {
23
+		foreach ( $field['options'] as $opt_key => $opt ) {
24 24
 			if ( isset( $atts ) && isset( $atts['opt'] ) && ( $atts['opt'] !== $opt_key ) ) {
25
-                continue;
26
-            }
25
+				continue;
26
+			}
27 27
 
28
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
29
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); ?>
28
+			$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
29
+			$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); ?>
30 30
 			<div class="<?php echo esc_attr( apply_filters( 'frm_radio_class', 'frm_radio', $field, $field_val ) ) ?>"><?php
31 31
 
32 32
 			if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
33 33
 				?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
34
-            }
35
-            $checked = FrmAppHelper::check_selected($field['value'], $field_val) ? 'checked="checked" ' : ' ';
34
+			}
35
+			$checked = FrmAppHelper::check_selected($field['value'], $field_val) ? 'checked="checked" ' : ' ';
36 36
 
37
-            $other_opt = false;
38
-            $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked );
39
-            ?>
37
+			$other_opt = false;
38
+			$other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked );
39
+			?>
40 40
             <input type="radio" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php
41
-            echo $checked;
42
-            do_action('frm_field_input_html', $field);
41
+			echo $checked;
42
+			do_action('frm_field_input_html', $field);
43 43
 ?>/><?php
44 44
 
45 45
 			if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
46 46
 				echo ' ' . $opt . '</label>';
47
-            }
47
+			}
48 48
 
49 49
 			FrmFieldsHelper::include_other_input( array(
50 50
 				'other_opt' => $other_opt, 'read_only' => $read_only,
@@ -53,58 +53,58 @@  discard block
 block discarded – undo
53 53
 				'html_id' => $html_id, 'opt_key' => $opt_key,
54 54
 			) );
55 55
 
56
-            unset( $other_opt, $other_args );
56
+			unset( $other_opt, $other_args );
57 57
 ?></div>
58 58
 <?php
59
-        }
60
-    }
59
+		}
60
+	}
61 61
 } else if ( $field['type'] == 'select' ) {
62 62
 	include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/front-end/dropdown-field.php' );
63 63
 } else if ( $field['type'] == 'checkbox' ) {
64
-    $checked_values = $field['value'];
65
-    $read_only = false;
64
+	$checked_values = $field['value'];
65
+	$read_only = false;
66 66
 
67 67
 	if ( FrmField::is_read_only( $field ) && ! FrmAppHelper::is_admin() ) {
68
-        $read_only = true;
69
-        if ( $checked_values ) {
70
-            foreach ( (array) $checked_values as $checked_value ) { ?>
68
+		$read_only = true;
69
+		if ( $checked_values ) {
70
+			foreach ( (array) $checked_values as $checked_value ) { ?>
71 71
 <input type="hidden" value="<?php echo esc_attr( $checked_value ) ?>" name="<?php echo esc_attr( $field_name ) ?>[]" />
72 72
 <?php
73
-            }
74
-        } else { ?>
73
+			}
74
+		} else { ?>
75 75
 <input type="hidden" value="" name="<?php echo esc_attr( $field_name ) ?>[]" />
76 76
 <?php
77
-        }
78
-    }
77
+		}
78
+	}
79 79
 
80
-    if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
80
+	if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
81 81
 		do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) );
82
-    } else if ( $field['options'] ) {
83
-        foreach ( $field['options'] as $opt_key => $opt ) {
84
-            if ( isset($atts) && isset($atts['opt']) && ($atts['opt'] !== $opt_key) ) {
85
-                continue;
86
-            }
87
-
88
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
89
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
90
-            $checked = FrmAppHelper::check_selected($checked_values, $field_val) ? ' checked="checked"' : '';
91
-
92
-            // Check if other opt, and get values for other field if needed
93
-            $other_opt = false;
82
+	} else if ( $field['options'] ) {
83
+		foreach ( $field['options'] as $opt_key => $opt ) {
84
+			if ( isset($atts) && isset($atts['opt']) && ($atts['opt'] !== $opt_key) ) {
85
+				continue;
86
+			}
87
+
88
+			$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
89
+			$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
90
+			$checked = FrmAppHelper::check_selected($checked_values, $field_val) ? ' checked="checked"' : '';
91
+
92
+			// Check if other opt, and get values for other field if needed
93
+			$other_opt = false;
94 94
 			$other_args = FrmFieldsHelper::prepare_other_input( compact( 'field', 'field_name', 'opt_key' ), $other_opt, $checked );
95 95
 
96
-            ?>
96
+			?>
97 97
 			<div class="<?php echo esc_attr( apply_filters( 'frm_checkbox_class', 'frm_checkbox', $field, $field_val ) ) ?>" id="<?php echo esc_attr( FrmFieldsHelper::get_checkbox_id( $field, $opt_key ) ) ?>"><?php
98 98
 
99
-            if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
100
-                ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
101
-            }
99
+			if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
100
+				?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
101
+			}
102 102
 
103
-            ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action('frm_field_input_html', $field) ?> /><?php
103
+			?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action('frm_field_input_html', $field) ?> /><?php
104 104
 
105
-            if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
105
+			if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
106 106
 				echo ' ' . $opt . '</label>';
107
-            }
107
+			}
108 108
 
109 109
 			FrmFieldsHelper::include_other_input( array(
110 110
 				'other_opt' => $other_opt, 'read_only' => $read_only,
@@ -113,17 +113,17 @@  discard block
 block discarded – undo
113 113
 				'html_id' => $html_id, 'opt_key' => $opt_key,
114 114
 			) );
115 115
 
116
-            unset( $other_opt, $other_args, $checked );
116
+			unset( $other_opt, $other_args, $checked );
117 117
 
118
-            ?></div>
118
+			?></div>
119 119
 <?php
120
-        }
121
-    }
120
+		}
121
+	}
122 122
 } else if ( $field['type'] == 'captcha' && ! FrmAppHelper::is_admin() ) {
123
-    $frm_settings = FrmAppHelper::get_settings();
124
-    if ( ! empty($frm_settings->pubkey) ) {
125
-        FrmFieldsHelper::display_recaptcha($field);
126
-    }
123
+	$frm_settings = FrmAppHelper::get_settings();
124
+	if ( ! empty($frm_settings->pubkey) ) {
125
+		FrmFieldsHelper::display_recaptcha($field);
126
+	}
127 127
 } else {
128 128
 	do_action( 'frm_form_fields', $field, $field_name, compact( 'errors', 'html_id' ) );
129 129
 	do_action( 'frm_form_field_' . $field['type'], $field, $field_name, compact( 'errors', 'html_id' ) );
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php if ( in_array( $field['type'], array( 'email', 'url', 'text' ) ) ) { ?>
2
-<input type="<?php echo ( $frm_settings->use_html || $field['type'] == 'password' ) ? $field['type'] : 'text'; ?>" id="<?php echo esc_attr( $html_id ) ?>" name="<?php echo esc_attr( $field_name ) ?>" value="<?php echo esc_attr( $field['value'] ) ?>" <?php do_action('frm_field_input_html', $field) ?>/>
2
+<input type="<?php echo ( $frm_settings->use_html || $field['type'] == 'password' ) ? $field['type'] : 'text'; ?>" id="<?php echo esc_attr( $html_id ) ?>" name="<?php echo esc_attr( $field_name ) ?>" value="<?php echo esc_attr( $field['value'] ) ?>" <?php do_action( 'frm_field_input_html', $field ) ?>/>
3 3
 <?php } else if ( $field['type'] == 'textarea' ) { ?>
4 4
 <textarea name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" <?php
5 5
 if ( $field['max'] ) {
6 6
 	echo 'rows="' . esc_attr( $field['max'] ) . '" ';
7 7
 }
8
-do_action('frm_field_input_html', $field);
9
-?>><?php echo FrmAppHelper::esc_textarea($field['value']) ?></textarea>
8
+do_action( 'frm_field_input_html', $field );
9
+?>><?php echo FrmAppHelper::esc_textarea( $field['value'] ) ?></textarea>
10 10
 <?php
11 11
 
12 12
 } else if ( $field['type'] == 'radio' ) {
@@ -17,29 +17,29 @@  discard block
 block discarded – undo
17 17
 <?php
18 18
     }
19 19
 
20
-    if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
20
+    if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) {
21 21
 		do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) );
22
-    } else if ( is_array($field['options']) ) {
22
+    } else if ( is_array( $field['options'] ) ) {
23 23
         foreach ( $field['options'] as $opt_key => $opt ) {
24 24
 			if ( isset( $atts ) && isset( $atts['opt'] ) && ( $atts['opt'] !== $opt_key ) ) {
25 25
                 continue;
26 26
             }
27 27
 
28
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
29
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); ?>
28
+            $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field );
29
+            $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field ); ?>
30 30
 			<div class="<?php echo esc_attr( apply_filters( 'frm_radio_class', 'frm_radio', $field, $field_val ) ) ?>"><?php
31 31
 
32 32
 			if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
33 33
 				?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
34 34
             }
35
-            $checked = FrmAppHelper::check_selected($field['value'], $field_val) ? 'checked="checked" ' : ' ';
35
+            $checked = FrmAppHelper::check_selected( $field['value'], $field_val ) ? 'checked="checked" ' : ' ';
36 36
 
37 37
             $other_opt = false;
38 38
             $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked );
39 39
             ?>
40 40
             <input type="radio" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php
41 41
             echo $checked;
42
-            do_action('frm_field_input_html', $field);
42
+            do_action( 'frm_field_input_html', $field );
43 43
 ?>/><?php
44 44
 
45 45
 			if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
@@ -77,17 +77,17 @@  discard block
 block discarded – undo
77 77
         }
78 78
     }
79 79
 
80
-    if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
80
+    if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) {
81 81
 		do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) );
82 82
     } else if ( $field['options'] ) {
83 83
         foreach ( $field['options'] as $opt_key => $opt ) {
84
-            if ( isset($atts) && isset($atts['opt']) && ($atts['opt'] !== $opt_key) ) {
84
+            if ( isset( $atts ) && isset( $atts['opt'] ) && ( $atts['opt'] !== $opt_key ) ) {
85 85
                 continue;
86 86
             }
87 87
 
88
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
89
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
90
-            $checked = FrmAppHelper::check_selected($checked_values, $field_val) ? ' checked="checked"' : '';
88
+            $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field );
89
+            $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field );
90
+            $checked = FrmAppHelper::check_selected( $checked_values, $field_val ) ? ' checked="checked"' : '';
91 91
 
92 92
             // Check if other opt, and get values for other field if needed
93 93
             $other_opt = false;
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                 ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php
101 101
             }
102 102
 
103
-            ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action('frm_field_input_html', $field) ?> /><?php
103
+            ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action( 'frm_field_input_html', $field ) ?> /><?php
104 104
 
105 105
             if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
106 106
 				echo ' ' . $opt . '</label>';
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
     }
122 122
 } else if ( $field['type'] == 'captcha' && ! FrmAppHelper::is_admin() ) {
123 123
     $frm_settings = FrmAppHelper::get_settings();
124
-    if ( ! empty($frm_settings->pubkey) ) {
125
-        FrmFieldsHelper::display_recaptcha($field);
124
+    if ( ! empty( $frm_settings->pubkey ) ) {
125
+        FrmFieldsHelper::display_recaptcha( $field );
126 126
     }
127 127
 } else {
128 128
 	do_action( 'frm_form_fields', $field, $field_name, compact( 'errors', 'html_id' ) );
Please login to merge, or discard this patch.
classes/controllers/FrmSettingsController.php 2 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -2,26 +2,26 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmSettingsController {
4 4
 
5
-    public static function menu() {
5
+	public static function menu() {
6 6
 		// Make sure admins can see the menu items
7 7
 		FrmAppHelper::force_capability( 'frm_change_settings' );
8 8
 
9
-        add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' );
10
-    }
9
+		add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' );
10
+	}
11 11
 
12
-    public static function license_box() {
12
+	public static function license_box() {
13 13
 		$a = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' );
14
-        include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' );
15
-    }
14
+		include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' );
15
+	}
16 16
 
17
-    public static function display_form( $errors = array(), $message = '' ) {
18
-        global $frm_vars;
17
+	public static function display_form( $errors = array(), $message = '' ) {
18
+		global $frm_vars;
19 19
 
20
-        $frm_settings = FrmAppHelper::get_settings();
21
-        $frm_roles = FrmAppHelper::frm_capabilities();
20
+		$frm_settings = FrmAppHelper::get_settings();
21
+		$frm_roles = FrmAppHelper::frm_capabilities();
22 22
 
23
-        $uploads = wp_upload_dir();
24
-        $target_path = $uploads['basedir'] . '/formidable/css';
23
+		$uploads = wp_upload_dir();
24
+		$target_path = $uploads['basedir'] . '/formidable/css';
25 25
 
26 26
 		$sections = self::get_settings_tabs();
27 27
 
@@ -64,47 +64,47 @@  discard block
 block discarded – undo
64 64
 		wp_die();
65 65
 	}
66 66
 
67
-    public static function process_form( $stop_load = false ) {
68
-        global $frm_vars;
67
+	public static function process_form( $stop_load = false ) {
68
+		global $frm_vars;
69 69
 
70
-        $frm_settings = FrmAppHelper::get_settings();
70
+		$frm_settings = FrmAppHelper::get_settings();
71 71
 
72 72
 		$process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' );
73 73
 		if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) {
74
-            wp_die( $frm_settings->admin_permission );
75
-        }
74
+			wp_die( $frm_settings->admin_permission );
75
+		}
76 76
 
77
-        $errors = array();
78
-        $message = '';
77
+		$errors = array();
78
+		$message = '';
79 79
 
80
-        if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) {
81
-            $errors = $frm_settings->validate( $_POST, array() );
80
+		if ( ! isset( $frm_vars['settings_routed'] ) || ! $frm_vars['settings_routed'] ) {
81
+			$errors = $frm_settings->validate( $_POST, array() );
82 82
 
83
-            $frm_settings->update( stripslashes_deep( $_POST ) );
83
+			$frm_settings->update( stripslashes_deep( $_POST ) );
84 84
 
85
-            if ( empty( $errors ) ) {
86
-                $frm_settings->store();
87
-                $message = __( 'Settings Saved', 'formidable' );
88
-            }
89
-        } else {
90
-            $message = __( 'Settings Saved', 'formidable' );
91
-        }
85
+			if ( empty( $errors ) ) {
86
+				$frm_settings->store();
87
+				$message = __( 'Settings Saved', 'formidable' );
88
+			}
89
+		} else {
90
+			$message = __( 'Settings Saved', 'formidable' );
91
+		}
92 92
 
93 93
 		if ( $stop_load == 'stop_load' ) {
94
-            $frm_vars['settings_routed'] = true;
95
-            return;
96
-        }
94
+			$frm_vars['settings_routed'] = true;
95
+			return;
96
+		}
97 97
 
98
-        self::display_form( $errors, $message );
99
-    }
98
+		self::display_form( $errors, $message );
99
+	}
100 100
 
101
-    public static function route( $stop_load = false ) {
102
-        $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
101
+	public static function route( $stop_load = false ) {
102
+		$action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
103 103
 		$action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
104
-        if ( $action == 'process-form' ) {
104
+		if ( $action == 'process-form' ) {
105 105
 			self::process_form( $stop_load );
106
-        } else if ( $stop_load != 'stop_load' ) {
106
+		} else if ( $stop_load != 'stop_load' ) {
107 107
 			self::display_form();
108
-        }
109
-    }
108
+		}
109
+	}
110 110
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,16 +45,16 @@
 block discarded – undo
45 45
 	}
46 46
 
47 47
 	public static function load_settings_tab() {
48
-		FrmAppHelper::permission_check('frm_change_settings');
48
+		FrmAppHelper::permission_check( 'frm_change_settings' );
49 49
 		check_ajax_referer( 'frm_ajax', 'nonce' );
50 50
 
51 51
 		$section = FrmAppHelper::get_post_param( 'tab', '', 'sanitize_text_field' );
52 52
 		$sections = self::get_settings_tabs();
53
-		if ( ! isset( $sections[ $section ] ) ) {
53
+		if ( ! isset( $sections[$section] ) ) {
54 54
 			wp_die();
55 55
 		}
56 56
 
57
-		$section = $sections[ $section ];
57
+		$section = $sections[$section];
58 58
 
59 59
 		if ( isset( $section['class'] ) ) {
60 60
 			call_user_func( array( $section['class'], $section['function'] ) );
Please login to merge, or discard this patch.
classes/views/frm-settings/form.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -191,10 +191,10 @@
 block discarded – undo
191 191
 					} else {
192 192
 						call_user_func( ( isset( $section['function'] ) ? $section['function'] : $section ) );
193 193
 					}
194
-                } ?>
194
+				} ?>
195 195
             </div>
196 196
         <?php
197
-        } ?>
197
+		} ?>
198 198
 
199 199
         <p class="alignright frm_uninstall">
200 200
             <a href="javascript:void(0)" id="frm_uninstall_now"><?php _e( 'Uninstall Formidable', 'formidable' ) ?></a>
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,14 +27,14 @@  discard block
 block discarded – undo
27 27
         </ul>
28 28
         </div>
29 29
 
30
-    <?php do_action('frm_before_settings'); ?>
30
+    <?php do_action( 'frm_before_settings' ); ?>
31 31
 
32 32
 	<form name="frm_settings_form" method="post" class="frm_settings_form" action="?page=formidable-settings<?php echo ( $a ? '&amp;t=' . $a : '' ); ?>">
33 33
         <input type="hidden" name="frm_action" value="process-form" />
34 34
         <input type="hidden" name="action" value="process-form" />
35
-        <?php wp_nonce_field('process_form_nonce', 'process_form'); ?>
35
+        <?php wp_nonce_field( 'process_form_nonce', 'process_form' ); ?>
36 36
 
37
-        <div class="general_settings tabs-panel <?php echo ($a == 'general_settings') ? 'frm_block' : 'frm_hidden'; ?>">
37
+        <div class="general_settings tabs-panel <?php echo ( $a == 'general_settings' ) ? 'frm_block' : 'frm_hidden'; ?>">
38 38
             <p class="submit">
39 39
 				<input class="button-primary" type="submit" value="<?php esc_attr_e( 'Update Options', 'formidable' ) ?>" />
40 40
             </p>
@@ -43,20 +43,20 @@  discard block
 block discarded – undo
43 43
 
44 44
             <p><label class="frm_left_label"><?php _e( 'Load form styling', 'formidable' ) ?></label>
45 45
                 <select id="frm_load_style" name="frm_load_style">
46
-                <option value="all" <?php selected($frm_settings->load_style, 'all') ?>><?php _e( 'on every page of your site', 'formidable' ) ?></option>
47
-                <option value="dynamic" <?php selected($frm_settings->load_style, 'dynamic') ?>><?php _e( 'only on applicable pages', 'formidable' ) ?></option>
48
-                <option value="none" <?php selected($frm_settings->load_style, 'none') ?>><?php _e( 'Don\'t use form styling on any page', 'formidable' ) ?></option>
46
+                <option value="all" <?php selected( $frm_settings->load_style, 'all' ) ?>><?php _e( 'on every page of your site', 'formidable' ) ?></option>
47
+                <option value="dynamic" <?php selected( $frm_settings->load_style, 'dynamic' ) ?>><?php _e( 'only on applicable pages', 'formidable' ) ?></option>
48
+                <option value="none" <?php selected( $frm_settings->load_style, 'none' ) ?>><?php _e( 'Don\'t use form styling on any page', 'formidable' ) ?></option>
49 49
                 </select>
50 50
             </p>
51 51
 
52 52
             <p>
53 53
 				<label for="frm_use_html">
54
-					<input type="checkbox" id="frm_use_html" name="frm_use_html" value="1" <?php checked($frm_settings->use_html, 1) ?>	> <?php _e( 'Use HTML5 in forms', 'formidable' ) ?>
54
+					<input type="checkbox" id="frm_use_html" name="frm_use_html" value="1" <?php checked( $frm_settings->use_html, 1 ) ?>	> <?php _e( 'Use HTML5 in forms', 'formidable' ) ?>
55 55
 				</label>
56 56
 				<span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'We recommend using HTML 5 for your forms. It adds some nifty options like placeholders, patterns, and autocomplete.', 'formidable' ) ?>"></span>
57 57
             </p>
58 58
 
59
-            <?php do_action('frm_style_general_settings', $frm_settings); ?>
59
+            <?php do_action( 'frm_style_general_settings', $frm_settings ); ?>
60 60
 
61 61
 			<h3><?php _e( 'User Permissions', 'formidable' ); ?>
62 62
 				<span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Select users that are allowed access to Formidable. Without access to View Forms, users will be unable to see the Formidable menu.', 'formidable' ) ?>"></span>
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
 			</p>
81 81
 
82 82
 			<p><label class="frm_left_label"><?php _e( 'Site Key', 'formidable' ) ?></label>
83
-			<input type="text" name="frm_pubkey" id="frm_pubkey" size="42" value="<?php echo esc_attr($frm_settings->pubkey) ?>" placeholder="<?php esc_attr_e( 'Optional', 'formidable' ) ?>" /></p>
83
+			<input type="text" name="frm_pubkey" id="frm_pubkey" size="42" value="<?php echo esc_attr( $frm_settings->pubkey ) ?>" placeholder="<?php esc_attr_e( 'Optional', 'formidable' ) ?>" /></p>
84 84
 
85 85
 			<p><label class="frm_left_label"><?php _e( 'Secret Key', 'formidable' ) ?></label>
86
-			<input type="text" name="frm_privkey" id="frm_privkey" size="42" value="<?php echo esc_attr($frm_settings->privkey) ?>" placeholder="<?php esc_attr_e( 'Optional', 'formidable' ) ?>" /></p>
86
+			<input type="text" name="frm_privkey" id="frm_privkey" size="42" value="<?php echo esc_attr( $frm_settings->privkey ) ?>" placeholder="<?php esc_attr_e( 'Optional', 'formidable' ) ?>" /></p>
87 87
 
88 88
 		    <p><label class="frm_left_label"><?php _e( 'reCAPTCHA Type', 'formidable' ) ?></label>
89 89
 			<select name="frm_re_type" id="frm_re_type">
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 			<select name="frm_re_lang" id="frm_re_lang">
100 100
 				<option value="" <?php selected( $frm_settings->re_lang, '' ) ?>><?php esc_html_e( 'Browser Default', 'formidable' ); ?></option>
101 101
 			    <?php foreach ( $captcha_lang as $lang => $lang_name ) { ?>
102
-				<option value="<?php echo esc_attr($lang) ?>" <?php selected($frm_settings->re_lang, $lang) ?>><?php echo esc_html( $lang_name ) ?></option>
102
+				<option value="<?php echo esc_attr( $lang ) ?>" <?php selected( $frm_settings->re_lang, $lang ) ?>><?php echo esc_html( $lang_name ) ?></option>
103 103
                 <?php } ?>
104 104
             </select></p>
105 105
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 			<label class="frm_left_label"><?php _e( 'Success Message', 'formidable' ); ?>
153 153
 				<span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'The default message seen after a form is submitted.', 'formidable' ) ?>" ></span>
154 154
 			</label>
155
-            <input type="text" id="frm_success_msg" name="frm_success_msg" class="frm_with_left_label" value="<?php echo esc_attr($frm_settings->success_msg) ?>" />
155
+            <input type="text" id="frm_success_msg" name="frm_success_msg" class="frm_with_left_label" value="<?php echo esc_attr( $frm_settings->success_msg ) ?>" />
156 156
 		</p>
157 157
 
158 158
 		<p>
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 			<input type="text" value="<?php echo esc_attr( $frm_settings->submit_value ) ?>" id="frm_submit_value" name="frm_submit_value" class="frm_with_left_label" />
161 161
 		</p>
162 162
 
163
-        <?php do_action('frm_settings_form', $frm_settings); ?>
163
+        <?php do_action( 'frm_settings_form', $frm_settings ); ?>
164 164
 
165 165
         <?php if ( ! FrmAppHelper::pro_is_installed() ) { ?>
166 166
 			<div class="clear"></div>
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		<?php } ?>
171 171
 
172 172
         <p><label class="frm_left_label"><?php _e( 'Preview Page', 'formidable' ); ?></label>
173
-        <?php FrmAppHelper::wp_pages_dropdown('frm-preview-page-id', $frm_settings->preview_page_id ) ?>
173
+        <?php FrmAppHelper::wp_pages_dropdown( 'frm-preview-page-id', $frm_settings->preview_page_id ) ?>
174 174
         </p>
175 175
 
176 176
     </div>
Please login to merge, or discard this patch.
classes/models/FrmEntryShortcodeFormatter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -219,7 +219,7 @@
 block discarded – undo
219 219
 			'type'  => $field->type,
220 220
 		);
221 221
 
222
-		$this->array_content[ $field->id ] = apply_filters( 'frm_field_shortcodes_for_default_html_email', $array, $field );
222
+		$this->array_content[$field->id] = apply_filters( 'frm_field_shortcodes_for_default_html_email', $array, $field );
223 223
 
224 224
 		return $array;
225 225
 	}
Please login to merge, or discard this patch.
classes/controllers/FrmEntriesController.php 2 patches
Indentation   +252 added lines, -252 removed lines patch added patch discarded remove patch
@@ -2,70 +2,70 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmEntriesController {
4 4
 
5
-    public static function menu() {
5
+	public static function menu() {
6 6
 		FrmAppHelper::force_capability( 'frm_view_entries' );
7 7
 
8
-        add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
8
+		add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
9 9
 
10 10
 		if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) {
11 11
 			$menu_name = FrmAppHelper::get_menu_name();
12 12
 			add_filter( 'manage_' . sanitize_title( $menu_name ) . '_page_formidable-entries_columns', 'FrmEntriesController::manage_columns' );
13 13
 			add_filter( 'get_user_option_manage' . sanitize_title( $menu_name ) . '_page_formidable-entriescolumnshidden', 'FrmEntriesController::hidden_columns' );
14 14
 			add_filter( 'manage_' . sanitize_title( $menu_name ) . '_page_formidable-entries_sortable_columns', 'FrmEntriesController::sortable_columns' );
15
-        }
16
-    }
15
+		}
16
+	}
17 17
 
18
-    /* Display in Back End */
19
-    public static function route() {
18
+	/* Display in Back End */
19
+	public static function route() {
20 20
 		$action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
21 21
 
22
-        switch ( $action ) {
23
-            case 'show':
24
-            case 'destroy':
25
-            case 'destroy_all':
26
-                return self::$action();
22
+		switch ( $action ) {
23
+			case 'show':
24
+			case 'destroy':
25
+			case 'destroy_all':
26
+				return self::$action();
27 27
 
28
-            default:
29
-                do_action( 'frm_entry_action_route', $action );
30
-                if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
31
-                    return;
32
-                }
28
+			default:
29
+				do_action( 'frm_entry_action_route', $action );
30
+				if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
31
+					return;
32
+				}
33 33
 
34
-                return self::display_list();
35
-        }
36
-    }
34
+				return self::display_list();
35
+		}
36
+	}
37 37
 
38 38
 	public static function contextual_help( $help, $screen_id, $screen ) {
39
-        // Only add to certain screens. add_help_tab was introduced in WordPress 3.3
40
-        if ( ! method_exists( $screen, 'add_help_tab' ) ) {
41
-            return $help;
42
-        }
39
+		// Only add to certain screens. add_help_tab was introduced in WordPress 3.3
40
+		if ( ! method_exists( $screen, 'add_help_tab' ) ) {
41
+			return $help;
42
+		}
43 43
 
44 44
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
45 45
 		$page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
46 46
 		if ( $page != 'formidable-entries' || ( ! empty( $action ) && $action != 'list' ) ) {
47
-            return $help;
48
-        }
47
+			return $help;
48
+		}
49 49
 
50 50
 		unset( $action, $page );
51 51
 
52
-        $screen->add_help_tab( array(
53
-            'id'      => 'formidable-entries-tab',
54
-            'title'   => __( 'Overview', 'formidable' ),
52
+		$screen->add_help_tab( array(
53
+			'id'      => 'formidable-entries-tab',
54
+			'title'   => __( 'Overview', 'formidable' ),
55 55
 			'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
56
-        ));
56
+		));
57 57
 
58
-        $screen->set_help_sidebar(
58
+		$screen->set_help_sidebar(
59 59
 			'<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
60 60
 			'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' .
61 61
 			'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>'
62
-    	);
62
+		);
63 63
 
64
-        return $help;
65
-    }
64
+		return $help;
65
+	}
66 66
 
67 67
 	public static function manage_columns( $columns ) {
68
-        global $frm_vars;
68
+		global $frm_vars;
69 69
 		$form_id = FrmForm::get_current_form_id();
70 70
 
71 71
 		$columns[ $form_id . '_id' ] = 'ID';
@@ -83,15 +83,15 @@  discard block
 block discarded – undo
83 83
 		$columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
84 84
 		$columns[ $form_id . '_ip' ] = 'IP';
85 85
 
86
-        $frm_vars['cols'] = $columns;
86
+		$frm_vars['cols'] = $columns;
87 87
 
88 88
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
89 89
 		if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) {
90 90
 			add_screen_option( 'per_page', array( 'label' => __( 'Entries', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_entries_per_page' ) );
91
-        }
91
+		}
92 92
 
93
-        return $columns;
94
-    }
93
+		return $columns;
94
+	}
95 95
 
96 96
 	private static function get_columns_for_form( $form_id, &$columns ) {
97 97
 		$form_cols = FrmField::get_all_for_form( $form_id, '', 'include' );
@@ -135,76 +135,76 @@  discard block
 block discarded – undo
135 135
 		$menu_name = FrmAppHelper::get_menu_name();
136 136
 		$this_page_name = 'manage' . sanitize_title( $menu_name ) . '_page_formidable-entriescolumnshidden';
137 137
 		if ( $meta_key != $this_page_name || $meta_value == $prev_value ) {
138
-            return $check;
139
-        }
138
+			return $check;
139
+		}
140 140
 
141 141
 		if ( empty( $prev_value ) ) {
142 142
 			$prev_value = get_metadata( 'user', $object_id, $meta_key, true );
143 143
 		}
144 144
 
145
-        global $frm_vars;
146
-        //add a check so we don't create a loop
147
-        $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
145
+		global $frm_vars;
146
+		//add a check so we don't create a loop
147
+		$frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
148 148
 
149
-        return $check;
150
-    }
149
+		return $check;
150
+	}
151 151
 
152
-    //add hidden columns back from other forms
152
+	//add hidden columns back from other forms
153 153
 	public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) {
154 154
 		$menu_name = FrmAppHelper::get_menu_name();
155 155
 		$sanitized = sanitize_title( $menu_name );
156 156
 		$this_page_name = 'manage' . $sanitized . '_page_formidable-entriescolumnshidden';
157 157
 		if ( $meta_key != $this_page_name ) {
158
-            return;
159
-        }
160
-
161
-        global $frm_vars;
162
-        if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) {
163
-            return; //don't continue if there's no previous value
164
-        }
165
-
166
-        foreach ( $meta_value as $mk => $mv ) {
167
-            //remove blank values
168
-            if ( empty( $mv ) ) {
169
-                unset( $meta_value[ $mk ] );
170
-            }
171
-        }
172
-
173
-        $cur_form_prefix = reset($meta_value);
174
-        $cur_form_prefix = explode('_', $cur_form_prefix);
175
-        $cur_form_prefix = $cur_form_prefix[0];
176
-        $save = false;
177
-
178
-        foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
158
+			return;
159
+		}
160
+
161
+		global $frm_vars;
162
+		if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) {
163
+			return; //don't continue if there's no previous value
164
+		}
165
+
166
+		foreach ( $meta_value as $mk => $mv ) {
167
+			//remove blank values
168
+			if ( empty( $mv ) ) {
169
+				unset( $meta_value[ $mk ] );
170
+			}
171
+		}
172
+
173
+		$cur_form_prefix = reset($meta_value);
174
+		$cur_form_prefix = explode('_', $cur_form_prefix);
175
+		$cur_form_prefix = $cur_form_prefix[0];
176
+		$save = false;
177
+
178
+		foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
179 179
 			if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) {
180
-                //don't add blank cols or process included cols
181
-                continue;
182
-            }
180
+				//don't add blank cols or process included cols
181
+				continue;
182
+			}
183 183
 
184 184
 			$form_prefix = explode( '_', $prev_hidden );
185
-            $form_prefix = $form_prefix[0];
186
-            if ( $form_prefix == $cur_form_prefix ) {
187
-                //don't add back columns that are meant to be hidden
188
-                continue;
189
-            }
185
+			$form_prefix = $form_prefix[0];
186
+			if ( $form_prefix == $cur_form_prefix ) {
187
+				//don't add back columns that are meant to be hidden
188
+				continue;
189
+			}
190 190
 
191
-            $meta_value[] = $prev_hidden;
192
-            $save = true;
193
-            unset($form_prefix);
194
-        }
191
+			$meta_value[] = $prev_hidden;
192
+			$save = true;
193
+			unset($form_prefix);
194
+		}
195 195
 
196 196
 		if ( $save ) {
197
-            $user = wp_get_current_user();
197
+			$user = wp_get_current_user();
198 198
 			update_user_option( $user->ID, $this_page_name, $meta_value, true );
199
-        }
200
-    }
199
+		}
200
+	}
201 201
 
202 202
 	public static function save_per_page( $save, $option, $value ) {
203
-        if ( $option == 'formidable_page_formidable_entries_per_page' ) {
204
-            $save = (int) $value;
205
-        }
206
-        return $save;
207
-    }
203
+		if ( $option == 'formidable_page_formidable_entries_per_page' ) {
204
+			$save = (int) $value;
205
+		}
206
+		return $save;
207
+	}
208 208
 
209 209
 	public static function sortable_columns() {
210 210
 		$form_id = FrmForm::get_current_form_id();
@@ -230,46 +230,46 @@  discard block
 block discarded – undo
230 230
 	}
231 231
 
232 232
 	public static function hidden_columns( $result ) {
233
-        global $frm_vars;
233
+		global $frm_vars;
234 234
 
235 235
 		$form_id = FrmForm::get_current_form_id();
236 236
 
237
-        $return = false;
238
-        foreach ( (array) $result as $r ) {
239
-            if ( ! empty( $r ) ) {
240
-                $form_prefix = explode( '_', $r );
241
-                $form_prefix = $form_prefix[0];
237
+		$return = false;
238
+		foreach ( (array) $result as $r ) {
239
+			if ( ! empty( $r ) ) {
240
+				$form_prefix = explode( '_', $r );
241
+				$form_prefix = $form_prefix[0];
242 242
 
243
-                if ( (int) $form_prefix == (int) $form_id ) {
244
-                    $return = true;
245
-                    break;
246
-                }
243
+				if ( (int) $form_prefix == (int) $form_id ) {
244
+					$return = true;
245
+					break;
246
+				}
247 247
 
248
-                unset($form_prefix);
249
-            }
250
-        }
248
+				unset($form_prefix);
249
+			}
250
+		}
251 251
 
252
-        if ( $return ) {
252
+		if ( $return ) {
253 253
 			return $result;
254 254
 		}
255 255
 
256
-        $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0;
257
-        $max_columns = 8;
258
-        if ( $i <= $max_columns ) {
256
+		$i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0;
257
+		$max_columns = 8;
258
+		if ( $i <= $max_columns ) {
259 259
 			return $result;
260 260
 		}
261 261
 
262
-        global $frm_vars;
263
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) {
264
-            $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options);
265
-        }
262
+		global $frm_vars;
263
+		if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) {
264
+			$frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options);
265
+		}
266 266
 
267 267
 		$has_custom_hidden_columns = ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] && isset( $frm_vars['current_form']->options['hidden_cols'] ) && ! empty( $frm_vars['current_form']->options['hidden_cols'] ) );
268 268
 		if ( $has_custom_hidden_columns ) {
269
-            $result = $frm_vars['current_form']->options['hidden_cols'];
270
-        } else {
271
-            $cols = $frm_vars['cols'];
272
-            $cols = array_reverse($cols, true);
269
+			$result = $frm_vars['current_form']->options['hidden_cols'];
270
+		} else {
271
+			$cols = $frm_vars['cols'];
272
+			$cols = array_reverse($cols, true);
273 273
 
274 274
 			if ( $form_id ) {
275 275
 				$result[] = $form_id . '_id';
@@ -277,59 +277,59 @@  discard block
 block discarded – undo
277 277
 			}
278 278
 
279 279
 			$result[] = $form_id . '_item_key';
280
-            $i--;
280
+			$i--;
281 281
 
282 282
 			foreach ( $cols as $col_key => $col ) {
283
-                if ( $i > $max_columns ) {
283
+				if ( $i > $max_columns ) {
284 284
 					$result[] = $col_key;
285 285
 				}
286
-                //remove some columns by default
287
-                $i--;
288
-                unset($col_key, $col);
289
-            }
290
-        }
286
+				//remove some columns by default
287
+				$i--;
288
+				unset($col_key, $col);
289
+			}
290
+		}
291 291
 
292
-        return $result;
293
-    }
292
+		return $result;
293
+	}
294 294
 
295 295
 	public static function display_list( $message = '', $errors = array() ) {
296
-        global $wpdb, $frm_vars;
296
+		global $wpdb, $frm_vars;
297 297
 
298 298
 		$form = FrmForm::maybe_get_current_form();
299 299
 		$params = FrmForm::get_admin_params( $form );
300 300
 
301
-        if ( $form ) {
302
-            $params['form'] = $form->id;
303
-            $frm_vars['current_form'] = $form;
301
+		if ( $form ) {
302
+			$params['form'] = $form->id;
303
+			$frm_vars['current_form'] = $form;
304 304
 
305 305
 			self::get_delete_form_time( $form, $errors );
306 306
 		}
307 307
 
308
-        $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
308
+		$table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
309 309
 
310
-        $wp_list_table = new $table_class( array( 'params' => $params ) );
310
+		$wp_list_table = new $table_class( array( 'params' => $params ) );
311 311
 
312
-        $pagenum = $wp_list_table->get_pagenum();
312
+		$pagenum = $wp_list_table->get_pagenum();
313 313
 
314
-        $wp_list_table->prepare_items();
314
+		$wp_list_table->prepare_items();
315 315
 
316
-        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
317
-        if ( $pagenum > $total_pages && $total_pages > 0 ) {
316
+		$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
317
+		if ( $pagenum > $total_pages && $total_pages > 0 ) {
318 318
 			$url = add_query_arg( 'paged', $total_pages );
319
-            if ( headers_sent() ) {
320
-                echo FrmAppHelper::js_redirect($url);
321
-            } else {
322
-                wp_redirect( esc_url_raw( $url ) );
323
-            }
324
-            die();
325
-        }
326
-
327
-        if ( empty($message) && isset($_GET['import-message']) ) {
328
-            $message = __( 'Your import is complete', 'formidable' );
329
-        }
319
+			if ( headers_sent() ) {
320
+				echo FrmAppHelper::js_redirect($url);
321
+			} else {
322
+				wp_redirect( esc_url_raw( $url ) );
323
+			}
324
+			die();
325
+		}
326
+
327
+		if ( empty($message) && isset($_GET['import-message']) ) {
328
+			$message = __( 'Your import is complete', 'formidable' );
329
+		}
330 330
 
331 331
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' );
332
-    }
332
+	}
333 333
 
334 334
 	private static function get_delete_form_time( $form, &$errors ) {
335 335
 		if ( 'trash' == $form->status ) {
@@ -339,19 +339,19 @@  discard block
 block discarded – undo
339 339
 		}
340 340
 	}
341 341
 
342
-    /* Back End CRUD */
342
+	/* Back End CRUD */
343 343
 	public static function show( $id = 0 ) {
344
-        FrmAppHelper::permission_check('frm_view_entries');
344
+		FrmAppHelper::permission_check('frm_view_entries');
345 345
 
346
-        if ( ! $id ) {
346
+		if ( ! $id ) {
347 347
 			$id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
348 348
 
349
-            if ( ! $id ) {
349
+			if ( ! $id ) {
350 350
 				$id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' );
351
-            }
352
-        }
351
+			}
352
+		}
353 353
 
354
-        $entry = FrmEntry::getOne($id, true);
354
+		$entry = FrmEntry::getOne($id, true);
355 355
 		if ( ! $entry ) {
356 356
 			echo '<div id="form_show_entry_page" class="wrap">' .
357 357
 				__( 'You are trying to view an entry that does not exist.', 'formidable' ) .
@@ -359,110 +359,110 @@  discard block
 block discarded – undo
359 359
 			return;
360 360
 		}
361 361
 
362
-        $data = maybe_unserialize($entry->description);
362
+		$data = maybe_unserialize($entry->description);
363 363
 		if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) {
364 364
 			$data = array( 'referrer' => $data );
365 365
 		}
366 366
 
367 367
 		$fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' );
368
-        $to_emails = array();
368
+		$to_emails = array();
369 369
 
370 370
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' );
371
-    }
371
+	}
372 372
 
373
-    public static function destroy() {
374
-        FrmAppHelper::permission_check('frm_delete_entries');
373
+	public static function destroy() {
374
+		FrmAppHelper::permission_check('frm_delete_entries');
375 375
 
376 376
 		$params = FrmForm::get_admin_params();
377 377
 
378
-        if ( isset($params['keep_post']) && $params['keep_post'] ) {
379
-            //unlink entry from post
380
-            global $wpdb;
378
+		if ( isset($params['keep_post']) && $params['keep_post'] ) {
379
+			//unlink entry from post
380
+			global $wpdb;
381 381
 			$wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) );
382
-        }
382
+		}
383 383
 
384
-        $message = '';
385
-        if ( FrmEntry::destroy( $params['id'] ) ) {
386
-            $message = __( 'Entry was Successfully Destroyed', 'formidable' );
387
-        }
384
+		$message = '';
385
+		if ( FrmEntry::destroy( $params['id'] ) ) {
386
+			$message = __( 'Entry was Successfully Destroyed', 'formidable' );
387
+		}
388 388
 
389
-        self::display_list( $message );
390
-    }
389
+		self::display_list( $message );
390
+	}
391 391
 
392
-    public static function destroy_all() {
393
-        if ( ! current_user_can( 'frm_delete_entries' ) ) {
394
-            $frm_settings = FrmAppHelper::get_settings();
395
-            wp_die( $frm_settings->admin_permission );
396
-        }
392
+	public static function destroy_all() {
393
+		if ( ! current_user_can( 'frm_delete_entries' ) ) {
394
+			$frm_settings = FrmAppHelper::get_settings();
395
+			wp_die( $frm_settings->admin_permission );
396
+		}
397 397
 
398
-        global $wpdb;
398
+		global $wpdb;
399 399
 		$params = FrmForm::get_admin_params();
400
-        $message = '';
401
-        $errors = array();
402
-        $form_id = (int) $params['form'];
400
+		$message = '';
401
+		$errors = array();
402
+		$form_id = (int) $params['form'];
403 403
 
404
-        if ( $form_id ) {
405
-            $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
404
+		if ( $form_id ) {
405
+			$entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
406 406
 			$action = FrmFormAction::get_action_for_form( $form_id, 'wppost', 1 );
407 407
 
408
-            if ( $action ) {
409
-                // this action takes a while, so only trigger it if there are posts to delete
410
-                foreach ( $entry_ids as $entry_id ) {
411
-                    do_action( 'frm_before_destroy_entry', $entry_id );
412
-                    unset( $entry_id );
413
-                }
414
-            }
415
-
416
-            $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) );
417
-            $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) );
418
-            if ( $results ) {
408
+			if ( $action ) {
409
+				// this action takes a while, so only trigger it if there are posts to delete
410
+				foreach ( $entry_ids as $entry_id ) {
411
+					do_action( 'frm_before_destroy_entry', $entry_id );
412
+					unset( $entry_id );
413
+				}
414
+			}
415
+
416
+			$wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) );
417
+			$results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) );
418
+			if ( $results ) {
419 419
 				FrmEntry::clear_cache();
420
-                $message = __( 'Entries were Successfully Destroyed', 'formidable' );
421
-            }
422
-        } else {
423
-            $errors = __( 'No entries were specified', 'formidable' );
424
-        }
425
-
426
-        self::display_list( $message, $errors );
427
-    }
428
-
429
-    public static function show_form( $id = '', $key = '', $title = false, $description = false ) {
430
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' );
431
-        return FrmFormsController::show_form( $id, $key, $title, $description );
432
-    }
433
-
434
-    public static function get_form( $filename, $form, $title, $description ) {
435
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' );
436
-        return FrmFormsController::get_form( $form, $title, $description );
437
-    }
438
-
439
-    public static function process_entry( $errors = '', $ajax = false ) {
420
+				$message = __( 'Entries were Successfully Destroyed', 'formidable' );
421
+			}
422
+		} else {
423
+			$errors = __( 'No entries were specified', 'formidable' );
424
+		}
425
+
426
+		self::display_list( $message, $errors );
427
+	}
428
+
429
+	public static function show_form( $id = '', $key = '', $title = false, $description = false ) {
430
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' );
431
+		return FrmFormsController::show_form( $id, $key, $title, $description );
432
+	}
433
+
434
+	public static function get_form( $filename, $form, $title, $description ) {
435
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' );
436
+		return FrmFormsController::get_form( $form, $title, $description );
437
+	}
438
+
439
+	public static function process_entry( $errors = '', $ajax = false ) {
440 440
 		$form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
441 441
 		if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) {
442
-            return;
443
-        }
442
+			return;
443
+		}
444 444
 
445
-        global $frm_vars;
445
+		global $frm_vars;
446 446
 
447 447
 		$form = FrmForm::getOne( $form_id );
448
-        if ( ! $form ) {
449
-            return;
450
-        }
448
+		if ( ! $form ) {
449
+			return;
450
+		}
451 451
 
452 452
 		$params = FrmForm::get_params( $form );
453 453
 
454
-        if ( ! isset( $frm_vars['form_params'] ) ) {
455
-            $frm_vars['form_params'] = array();
456
-        }
454
+		if ( ! isset( $frm_vars['form_params'] ) ) {
455
+			$frm_vars['form_params'] = array();
456
+		}
457 457
 		$frm_vars['form_params'][ $form->id ] = $params;
458 458
 
459 459
 		if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
460
-            return;
461
-        }
460
+			return;
461
+		}
462 462
 
463
-        if ( $errors == '' && ! $ajax ) {
463
+		if ( $errors == '' && ! $ajax ) {
464 464
 			$errors = FrmEntryValidate::validate( $_POST );
465
-        }
465
+		}
466 466
 
467 467
 		/**
468 468
 		 * Use this filter to add trigger actions and add errors after
@@ -473,39 +473,39 @@  discard block
 block discarded – undo
473 473
 
474 474
 		$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
475 475
 
476
-        if ( empty( $errors ) ) {
476
+		if ( empty( $errors ) ) {
477 477
 			$_POST['frm_skip_cookie'] = 1;
478
-            if ( $params['action'] == 'create' ) {
478
+			if ( $params['action'] == 'create' ) {
479 479
 				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
480 480
 					$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
481
-                }
482
-            }
481
+				}
482
+			}
483 483
 
484
-            do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
484
+			do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
485 485
 			unset( $_POST['frm_skip_cookie'] );
486
-        }
487
-    }
488
-
489
-    public static function delete_entry_before_redirect( $url, $form, $atts ) {
490
-        self::_delete_entry( $atts['id'], $form );
491
-        return $url;
492
-    }
493
-
494
-    //Delete entry if not redirected
495
-    public static function delete_entry_after_save( $atts ) {
496
-        self::_delete_entry( $atts['entry_id'], $atts['form'] );
497
-    }
498
-
499
-    private static function _delete_entry( $entry_id, $form ) {
500
-        if ( ! $form ) {
501
-            return;
502
-        }
503
-
504
-        $form->options = maybe_unserialize( $form->options );
505
-        if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
506
-            FrmEntry::destroy( $entry_id );
507
-        }
508
-    }
486
+		}
487
+	}
488
+
489
+	public static function delete_entry_before_redirect( $url, $form, $atts ) {
490
+		self::_delete_entry( $atts['id'], $form );
491
+		return $url;
492
+	}
493
+
494
+	//Delete entry if not redirected
495
+	public static function delete_entry_after_save( $atts ) {
496
+		self::_delete_entry( $atts['entry_id'], $atts['form'] );
497
+	}
498
+
499
+	private static function _delete_entry( $entry_id, $form ) {
500
+		if ( ! $form ) {
501
+			return;
502
+		}
503
+
504
+		$form->options = maybe_unserialize( $form->options );
505
+		if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
506
+			FrmEntry::destroy( $entry_id );
507
+		}
508
+	}
509 509
 
510 510
 	/**
511 511
 	 * @param $atts
@@ -560,15 +560,15 @@  discard block
 block discarded – undo
560 560
 	}
561 561
 
562 562
 	public static function entry_sidebar( $entry ) {
563
-        $data = maybe_unserialize($entry->description);
564
-        $date_format = get_option('date_format');
565
-        $time_format = get_option('time_format');
563
+		$data = maybe_unserialize($entry->description);
564
+		$date_format = get_option('date_format');
565
+		$time_format = get_option('time_format');
566 566
 		if ( isset( $data['browser'] ) ) {
567 567
 			$browser = FrmEntriesHelper::get_browser( $data['browser'] );
568 568
 		}
569 569
 
570 570
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' );
571
-    }
571
+	}
572 572
 
573 573
 	/***********************************************************************
574 574
 	 * Deprecated Functions
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
     public static function menu() {
6 6
 		FrmAppHelper::force_capability( 'frm_view_entries' );
7 7
 
8
-        add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
8
+        add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
9 9
 
10 10
 		if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) {
11 11
 			$menu_name = FrmAppHelper::get_menu_name();
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             'id'      => 'formidable-entries-tab',
54 54
             'title'   => __( 'Overview', 'formidable' ),
55 55
 			'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
56
-        ));
56
+        ) );
57 57
 
58 58
         $screen->set_help_sidebar(
59 59
 			'<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
@@ -68,20 +68,20 @@  discard block
 block discarded – undo
68 68
         global $frm_vars;
69 69
 		$form_id = FrmForm::get_current_form_id();
70 70
 
71
-		$columns[ $form_id . '_id' ] = 'ID';
72
-		$columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
71
+		$columns[$form_id . '_id'] = 'ID';
72
+		$columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' );
73 73
 
74 74
 		if ( $form_id ) {
75 75
 			self::get_columns_for_form( $form_id, $columns );
76 76
 		} else {
77
-			$columns[ $form_id . '_form_id' ] = __( 'Form', 'formidable' );
78
-			$columns[ $form_id . '_name' ] = __( 'Entry Name', 'formidable' );
79
-			$columns[ $form_id . '_user_id' ] = __( 'Created By', 'formidable' );
77
+			$columns[$form_id . '_form_id'] = __( 'Form', 'formidable' );
78
+			$columns[$form_id . '_name'] = __( 'Entry Name', 'formidable' );
79
+			$columns[$form_id . '_user_id'] = __( 'Created By', 'formidable' );
80 80
 		}
81 81
 
82
-		$columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' );
83
-		$columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
84
-		$columns[ $form_id . '_ip' ] = 'IP';
82
+		$columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' );
83
+		$columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' );
84
+		$columns[$form_id . '_ip'] = 'IP';
85 85
 
86 86
         $frm_vars['cols'] = $columns;
87 87
 
@@ -107,14 +107,14 @@  discard block
 block discarded – undo
107 107
 				if ( $sub_form_cols ) {
108 108
 					foreach ( $sub_form_cols as $k => $sub_form_col ) {
109 109
 						if ( FrmField::is_no_save_field( $sub_form_col->type ) ) {
110
-							unset( $sub_form_cols[ $k ] );
110
+							unset( $sub_form_cols[$k] );
111 111
 							continue;
112 112
 						}
113
-						$columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
114
-						unset($sub_form_col);
113
+						$columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
114
+						unset( $sub_form_col );
115 115
 					}
116 116
 				}
117
-				unset($sub_form_cols);
117
+				unset( $sub_form_cols );
118 118
 			} else {
119 119
 				$col_id = $form_col->field_key;
120 120
 				if ( $form_col->form_id != $form_id ) {
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 				$has_separate_value = ! FrmField::is_option_empty( $form_col, 'separate_value' );
125 125
 				$is_post_status     = FrmField::is_option_true( $form_col, 'post_field' ) && $form_col->field_options['post_field'] == 'post_status';
126 126
 				if ( $has_separate_value && ! $is_post_status ) {
127
-					$columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
127
+					$columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 );
128 128
 				}
129
-				$columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
129
+				$columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 );
130 130
 			}
131 131
 		}
132 132
 	}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
         global $frm_vars;
146 146
         //add a check so we don't create a loop
147
-        $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
147
+        $frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
148 148
 
149 149
         return $check;
150 150
     }
@@ -159,19 +159,19 @@  discard block
 block discarded – undo
159 159
         }
160 160
 
161 161
         global $frm_vars;
162
-        if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) {
162
+        if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) {
163 163
             return; //don't continue if there's no previous value
164 164
         }
165 165
 
166 166
         foreach ( $meta_value as $mk => $mv ) {
167 167
             //remove blank values
168 168
             if ( empty( $mv ) ) {
169
-                unset( $meta_value[ $mk ] );
169
+                unset( $meta_value[$mk] );
170 170
             }
171 171
         }
172 172
 
173
-        $cur_form_prefix = reset($meta_value);
174
-        $cur_form_prefix = explode('_', $cur_form_prefix);
173
+        $cur_form_prefix = reset( $meta_value );
174
+        $cur_form_prefix = explode( '_', $cur_form_prefix );
175 175
         $cur_form_prefix = $cur_form_prefix[0];
176 176
         $save = false;
177 177
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
             $meta_value[] = $prev_hidden;
192 192
             $save = true;
193
-            unset($form_prefix);
193
+            unset( $form_prefix );
194 194
         }
195 195
 
196 196
 		if ( $save ) {
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 		foreach ( $fields as $field ) {
223 223
 			if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) {
224 224
 				// Can't sort on checkboxes because they are stored serialized, or post fields
225
-				$columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id;
225
+				$columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id;
226 226
 			}
227 227
 		}
228 228
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
                     break;
246 246
                 }
247 247
 
248
-                unset($form_prefix);
248
+                unset( $form_prefix );
249 249
             }
250 250
         }
251 251
 
@@ -253,15 +253,15 @@  discard block
 block discarded – undo
253 253
 			return $result;
254 254
 		}
255 255
 
256
-        $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0;
256
+        $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0;
257 257
         $max_columns = 8;
258 258
         if ( $i <= $max_columns ) {
259 259
 			return $result;
260 260
 		}
261 261
 
262 262
         global $frm_vars;
263
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) {
264
-            $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options);
263
+        if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] ) {
264
+            $frm_vars['current_form']->options = maybe_unserialize( $frm_vars['current_form']->options );
265 265
         }
266 266
 
267 267
 		$has_custom_hidden_columns = ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] && isset( $frm_vars['current_form']->options['hidden_cols'] ) && ! empty( $frm_vars['current_form']->options['hidden_cols'] ) );
@@ -269,23 +269,23 @@  discard block
 block discarded – undo
269 269
             $result = $frm_vars['current_form']->options['hidden_cols'];
270 270
         } else {
271 271
             $cols = $frm_vars['cols'];
272
-            $cols = array_reverse($cols, true);
272
+            $cols = array_reverse( $cols, true );
273 273
 
274 274
 			if ( $form_id ) {
275 275
 				$result[] = $form_id . '_id';
276
-				$i--;
276
+				$i --;
277 277
 			}
278 278
 
279 279
 			$result[] = $form_id . '_item_key';
280
-            $i--;
280
+            $i --;
281 281
 
282 282
 			foreach ( $cols as $col_key => $col ) {
283 283
                 if ( $i > $max_columns ) {
284 284
 					$result[] = $col_key;
285 285
 				}
286 286
                 //remove some columns by default
287
-                $i--;
288
-                unset($col_key, $col);
287
+                $i --;
288
+                unset( $col_key, $col );
289 289
             }
290 290
         }
291 291
 
@@ -317,14 +317,14 @@  discard block
 block discarded – undo
317 317
         if ( $pagenum > $total_pages && $total_pages > 0 ) {
318 318
 			$url = add_query_arg( 'paged', $total_pages );
319 319
             if ( headers_sent() ) {
320
-                echo FrmAppHelper::js_redirect($url);
320
+                echo FrmAppHelper::js_redirect( $url );
321 321
             } else {
322 322
                 wp_redirect( esc_url_raw( $url ) );
323 323
             }
324 324
             die();
325 325
         }
326 326
 
327
-        if ( empty($message) && isset($_GET['import-message']) ) {
327
+        if ( empty( $message ) && isset( $_GET['import-message'] ) ) {
328 328
             $message = __( 'Your import is complete', 'formidable' );
329 329
         }
330 330
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 
342 342
     /* Back End CRUD */
343 343
 	public static function show( $id = 0 ) {
344
-        FrmAppHelper::permission_check('frm_view_entries');
344
+        FrmAppHelper::permission_check( 'frm_view_entries' );
345 345
 
346 346
         if ( ! $id ) {
347 347
 			$id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
             }
352 352
         }
353 353
 
354
-        $entry = FrmEntry::getOne($id, true);
354
+        $entry = FrmEntry::getOne( $id, true );
355 355
 		if ( ! $entry ) {
356 356
 			echo '<div id="form_show_entry_page" class="wrap">' .
357 357
 				__( 'You are trying to view an entry that does not exist.', 'formidable' ) .
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 			return;
360 360
 		}
361 361
 
362
-        $data = maybe_unserialize($entry->description);
362
+        $data = maybe_unserialize( $entry->description );
363 363
 		if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) {
364 364
 			$data = array( 'referrer' => $data );
365 365
 		}
@@ -371,11 +371,11 @@  discard block
 block discarded – undo
371 371
     }
372 372
 
373 373
     public static function destroy() {
374
-        FrmAppHelper::permission_check('frm_delete_entries');
374
+        FrmAppHelper::permission_check( 'frm_delete_entries' );
375 375
 
376 376
 		$params = FrmForm::get_admin_params();
377 377
 
378
-        if ( isset($params['keep_post']) && $params['keep_post'] ) {
378
+        if ( isset( $params['keep_post'] ) && $params['keep_post'] ) {
379 379
             //unlink entry from post
380 380
             global $wpdb;
381 381
 			$wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) );
@@ -454,9 +454,9 @@  discard block
 block discarded – undo
454 454
         if ( ! isset( $frm_vars['form_params'] ) ) {
455 455
             $frm_vars['form_params'] = array();
456 456
         }
457
-		$frm_vars['form_params'][ $form->id ] = $params;
457
+		$frm_vars['form_params'][$form->id] = $params;
458 458
 
459
-		if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
459
+		if ( isset( $frm_vars['created_entries'][$form_id] ) ) {
460 460
             return;
461 461
         }
462 462
 
@@ -471,13 +471,13 @@  discard block
 block discarded – undo
471 471
 		 */
472 472
 		$errors = apply_filters( 'frm_entries_before_create', $errors, $form );
473 473
 
474
-		$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
474
+		$frm_vars['created_entries'][$form_id] = array( 'errors' => $errors );
475 475
 
476 476
         if ( empty( $errors ) ) {
477 477
 			$_POST['frm_skip_cookie'] = 1;
478 478
             if ( $params['action'] == 'create' ) {
479
-				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
480
-					$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
479
+				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) {
480
+					$frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST );
481 481
                 }
482 482
             }
483 483
 
@@ -560,9 +560,9 @@  discard block
 block discarded – undo
560 560
 	}
561 561
 
562 562
 	public static function entry_sidebar( $entry ) {
563
-        $data = maybe_unserialize($entry->description);
564
-        $date_format = get_option('date_format');
565
-        $time_format = get_option('time_format');
563
+        $data = maybe_unserialize( $entry->description );
564
+        $date_format = get_option( 'date_format' );
565
+        $time_format = get_option( 'time_format' );
566 566
 		if ( isset( $data['browser'] ) ) {
567 567
 			$browser = FrmEntriesHelper::get_browser( $data['browser'] );
568 568
 		}
Please login to merge, or discard this patch.
classes/helpers/FrmEntriesHelper.php 2 patches
Indentation   +291 added lines, -291 removed lines patch added patch discarded remove patch
@@ -5,69 +5,69 @@  discard block
 block discarded – undo
5 5
 
6 6
 class FrmEntriesHelper {
7 7
 
8
-    public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) {
9
-        $values = array();
8
+	public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) {
9
+		$values = array();
10 10
 		foreach ( array( 'name' => '', 'description' => '', 'item_key' => '' ) as $var => $default ) {
11 11
 			$values[ $var ] = FrmAppHelper::get_post_param( $var, $default, 'wp_kses_post' );
12
-        }
13
-
14
-        $values['fields'] = array();
15
-        if ( empty($fields) ) {
16
-            return apply_filters('frm_setup_new_entry', $values);
17
-        }
18
-
19
-        foreach ( (array) $fields as $field ) {
20
-            $new_value = self::get_field_value_for_new_entry( $field, $reset, $args );
21
-
22
-            $field_array = array(
23
-                'id' => $field->id,
24
-                'value' => $new_value,
25
-                'default_value' => $field->default_value,
26
-                'name' => $field->name,
27
-                'description' => $field->description,
28
-                'type' => apply_filters('frm_field_type', $field->type, $field, $new_value),
29
-                'options' => $field->options,
30
-                'required' => $field->required,
31
-                'field_key' => $field->field_key,
32
-                'field_order' => $field->field_order,
33
-                'form_id' => $field->form_id,
12
+		}
13
+
14
+		$values['fields'] = array();
15
+		if ( empty($fields) ) {
16
+			return apply_filters('frm_setup_new_entry', $values);
17
+		}
18
+
19
+		foreach ( (array) $fields as $field ) {
20
+			$new_value = self::get_field_value_for_new_entry( $field, $reset, $args );
21
+
22
+			$field_array = array(
23
+				'id' => $field->id,
24
+				'value' => $new_value,
25
+				'default_value' => $field->default_value,
26
+				'name' => $field->name,
27
+				'description' => $field->description,
28
+				'type' => apply_filters('frm_field_type', $field->type, $field, $new_value),
29
+				'options' => $field->options,
30
+				'required' => $field->required,
31
+				'field_key' => $field->field_key,
32
+				'field_order' => $field->field_order,
33
+				'form_id' => $field->form_id,
34 34
 				'parent_form_id' => isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id,
35
-	            'reset_value' => $reset,
35
+				'reset_value' => $reset,
36 36
 				'in_embed_form' => isset( $args['in_embed_form'] ) ? $args['in_embed_form'] : '0',
37
-            );
37
+			);
38 38
 
39
-            $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
40
-            $opt_defaults['required_indicator'] = '';
39
+			$opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
40
+			$opt_defaults['required_indicator'] = '';
41 41
 			$opt_defaults['original_type'] = $field->type;
42 42
 
43 43
 			foreach ( $opt_defaults as $opt => $default_opt ) {
44
-                $field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt;
45
-                unset($opt, $default_opt);
46
-            }
44
+				$field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt;
45
+				unset($opt, $default_opt);
46
+			}
47 47
 
48
-            unset($opt_defaults);
48
+			unset($opt_defaults);
49 49
 
50
-            if ( $field_array['custom_html'] == '' ) {
51
-                $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
52
-            }
50
+			if ( $field_array['custom_html'] == '' ) {
51
+				$field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
52
+			}
53 53
 
54
-            $field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field, $args );
55
-            $field_array = array_merge( $field->field_options, $field_array );
54
+			$field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field, $args );
55
+			$field_array = array_merge( $field->field_options, $field_array );
56 56
 
57
-            $values['fields'][] = $field_array;
57
+			$values['fields'][] = $field_array;
58 58
 
59
-            if ( ! $form || ! isset($form->id) ) {
60
-                $form = FrmForm::getOne($field->form_id);
61
-            }
62
-        }
59
+			if ( ! $form || ! isset($form->id) ) {
60
+				$form = FrmForm::getOne($field->form_id);
61
+			}
62
+		}
63 63
 
64
-        $form->options = maybe_unserialize($form->options);
65
-        if ( is_array($form->options) ) {
66
-            foreach ( $form->options as $opt => $value ) {
67
-                $values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value );
68
-                unset($opt, $value);
69
-            }
70
-        }
64
+		$form->options = maybe_unserialize($form->options);
65
+		if ( is_array($form->options) ) {
66
+			foreach ( $form->options as $opt => $value ) {
67
+				$values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value );
68
+				unset($opt, $value);
69
+			}
70
+		}
71 71
 
72 72
 		$form_defaults = FrmFormsHelper::get_default_opts();
73 73
 
@@ -77,19 +77,19 @@  discard block
 block discarded – undo
77 77
 		$values = array_merge( $form_defaults, $values );
78 78
 
79 79
 		return apply_filters( 'frm_setup_new_entry', $values );
80
-    }
80
+	}
81 81
 
82 82
 	/**
83
-	* Set the value for each field
84
-	* This function is used when the form is first loaded and on all page turns *for a new entry*
85
-	*
86
-	* @since 2.0.13
87
-	*
88
-	* @param object $field - this is passed by reference since it is an object
89
-	* @param boolean $reset
90
-	* @param array $args
91
-	* @return string|array $new_value
92
-	*/
83
+	 * Set the value for each field
84
+	 * This function is used when the form is first loaded and on all page turns *for a new entry*
85
+	 *
86
+	 * @since 2.0.13
87
+	 *
88
+	 * @param object $field - this is passed by reference since it is an object
89
+	 * @param boolean $reset
90
+	 * @param array $args
91
+	 * @return string|array $new_value
92
+	 */
93 93
 	private static function get_field_value_for_new_entry( $field, $reset, $args ) {
94 94
 		//If checkbox, multi-select dropdown, or checkbox data from entries field, the value should be an array
95 95
 		$return_array = FrmField::is_field_with_multiple_values( $field );
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
 	}
122 122
 
123 123
 	/**
124
-	* Check if a field has a posted value
125
-	*
126
-	* @since 2.01.0
127
-	* @param object $field
128
-	* @param array $args
129
-	* @return boolean $value_is_posted
130
-	*/
124
+	 * Check if a field has a posted value
125
+	 *
126
+	 * @since 2.01.0
127
+	 * @param object $field
128
+	 * @param array $args
129
+	 * @return boolean $value_is_posted
130
+	 */
131 131
 	public static function value_is_posted( $field, $args ) {
132 132
 		$value_is_posted = false;
133 133
 		if ( $_POST ) {
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 
146 146
 	public static function setup_edit_vars( $values, $record ) {
147 147
 		$values['item_key'] = FrmAppHelper::get_post_param( 'item_key', $record->item_key, 'sanitize_title' );
148
-        $values['form_id'] = $record->form_id;
149
-        $values['is_draft'] = $record->is_draft;
150
-        return apply_filters('frm_setup_edit_entry_vars', $values, $record);
151
-    }
148
+		$values['form_id'] = $record->form_id;
149
+		$values['is_draft'] = $record->is_draft;
150
+		return apply_filters('frm_setup_edit_entry_vars', $values, $record);
151
+	}
152 152
 
153
-    public static function get_admin_params( $form = null ) {
153
+	public static function get_admin_params( $form = null ) {
154 154
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_admin_params' );
155 155
 		return FrmForm::set_current_form( $form );
156
-    }
156
+	}
157 157
 
158 158
 	public static function set_current_form( $form_id ) {
159 159
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::set_current_form' );
@@ -165,284 +165,284 @@  discard block
 block discarded – undo
165 165
 		return FrmForm::get_current_form( $form_id );
166 166
 	}
167 167
 
168
-    public static function get_current_form_id() {
168
+	public static function get_current_form_id() {
169 169
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_current_form_id' );
170 170
 		return FrmForm::get_current_form_id();
171
-    }
171
+	}
172 172
 
173
-    public static function maybe_get_entry( &$entry ) {
173
+	public static function maybe_get_entry( &$entry ) {
174 174
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmEntry::maybe_get_entry' );
175 175
 		FrmEntry::maybe_get_entry( $entry );
176
-    }
176
+	}
177 177
 
178 178
 	public static function replace_default_message( $message, $atts ) {
179
-        if ( strpos($message, '[default-message') === false &&
180
-            strpos($message, '[default_message') === false &&
181
-            ! empty( $message ) ) {
182
-            return $message;
183
-        }
179
+		if ( strpos($message, '[default-message') === false &&
180
+			strpos($message, '[default_message') === false &&
181
+			! empty( $message ) ) {
182
+			return $message;
183
+		}
184 184
 
185
-        if ( empty($message) ) {
186
-            $message = '[default-message]';
187
-        }
185
+		if ( empty($message) ) {
186
+			$message = '[default-message]';
187
+		}
188 188
 
189
-        preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER);
189
+		preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER);
190 190
 
191
-        foreach ( $shortcodes[0] as $short_key => $tag ) {
191
+		foreach ( $shortcodes[0] as $short_key => $tag ) {
192 192
 			$add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
193 193
 			if ( ! empty( $add_atts ) ) {
194
-                $this_atts = array_merge($atts, $add_atts);
195
-            } else {
196
-                $this_atts = $atts;
197
-            }
194
+				$this_atts = array_merge($atts, $add_atts);
195
+			} else {
196
+				$this_atts = $atts;
197
+			}
198 198
 
199 199
 			$default = FrmEntriesController::show_entry_shortcode( $this_atts );
200 200
 
201
-            // Add the default message
202
-            $message = str_replace( $shortcodes[0][ $short_key ], $default, $message );
203
-        }
201
+			// Add the default message
202
+			$message = str_replace( $shortcodes[0][ $short_key ], $default, $message );
203
+		}
204 204
 
205
-        return $message;
206
-    }
205
+		return $message;
206
+	}
207 207
 
208 208
 	public static function prepare_display_value( $entry, $field, $atts ) {
209 209
 		$field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false;
210 210
 
211
-        if ( FrmAppHelper::pro_is_installed() ) {
211
+		if ( FrmAppHelper::pro_is_installed() ) {
212 212
 			FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value );
213
-        }
213
+		}
214 214
 
215
-        if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) {
216
-            return self::display_value($field_value, $field, $atts);
217
-        }
215
+		if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) {
216
+			return self::display_value($field_value, $field, $atts);
217
+		}
218 218
 
219
-        // this is an embeded form
220
-        $val = '';
219
+		// this is an embeded form
220
+		$val = '';
221 221
 
222
-	    if ( strpos($atts['embedded_field_id'], 'form') === 0 ) {
223
-            //this is a repeating section
222
+		if ( strpos($atts['embedded_field_id'], 'form') === 0 ) {
223
+			//this is a repeating section
224 224
 			$child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) );
225
-        } else {
226
-            // get all values for this field
227
-	        $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false;
225
+		} else {
226
+			// get all values for this field
227
+			$child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false;
228 228
 
229
-            if ( $child_values ) {
230
-	            $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) );
231
-	        }
232
-	    }
229
+			if ( $child_values ) {
230
+				$child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) );
231
+			}
232
+		}
233 233
 
234
-	    $field_value = array();
234
+		$field_value = array();
235 235
 
236
-        if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
237
-            return $val;
238
-        }
236
+		if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
237
+			return $val;
238
+		}
239 239
 
240
-        foreach ( $child_entries as $child_entry ) {
241
-            $atts['item_id'] = $child_entry->id;
242
-            $atts['post_id'] = $child_entry->post_id;
240
+		foreach ( $child_entries as $child_entry ) {
241
+			$atts['item_id'] = $child_entry->id;
242
+			$atts['post_id'] = $child_entry->post_id;
243 243
 
244
-            // get the value for this field -- check for post values as well
245
-            $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field);
244
+			// get the value for this field -- check for post values as well
245
+			$entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field);
246 246
 
247
-            if ( $entry_val ) {
248
-                // foreach entry get display_value
249
-                $field_value[] = self::display_value($entry_val, $field, $atts);
250
-            }
247
+			if ( $entry_val ) {
248
+				// foreach entry get display_value
249
+				$field_value[] = self::display_value($entry_val, $field, $atts);
250
+			}
251 251
 
252
-            unset($child_entry);
253
-        }
252
+			unset($child_entry);
253
+		}
254 254
 
255
-        $val = implode(', ', (array) $field_value );
255
+		$val = implode(', ', (array) $field_value );
256 256
 		$val = wp_kses_post( $val );
257 257
 
258
-        return $val;
259
-    }
258
+		return $val;
259
+	}
260 260
 
261
-    /**
262
-     * Prepare the saved value for display
263
-     * @return string
264
-     */
261
+	/**
262
+	 * Prepare the saved value for display
263
+	 * @return string
264
+	 */
265 265
 	public static function display_value( $value, $field, $atts = array() ) {
266 266
 
267
-        $defaults = array(
268
-            'type' => '', 'html' => false, 'show_filename' => true,
269
-            'truncate' => false, 'sep' => ', ', 'post_id' => 0,
270
-            'form_id' => $field->form_id, 'field' => $field, 'keepjs' => 0,
267
+		$defaults = array(
268
+			'type' => '', 'html' => false, 'show_filename' => true,
269
+			'truncate' => false, 'sep' => ', ', 'post_id' => 0,
270
+			'form_id' => $field->form_id, 'field' => $field, 'keepjs' => 0,
271 271
 			'return_array' => false,
272
-        );
272
+		);
273 273
 
274
-        $atts = wp_parse_args( $atts, $defaults );
275
-        $atts = apply_filters('frm_display_value_atts', $atts, $field, $value);
274
+		$atts = wp_parse_args( $atts, $defaults );
275
+		$atts = apply_filters('frm_display_value_atts', $atts, $field, $value);
276 276
 
277
-        if ( ! isset($field->field_options['post_field']) ) {
278
-            $field->field_options['post_field'] = '';
279
-        }
277
+		if ( ! isset($field->field_options['post_field']) ) {
278
+			$field->field_options['post_field'] = '';
279
+		}
280 280
 
281
-        if ( ! isset($field->field_options['custom_field']) ) {
282
-            $field->field_options['custom_field'] = '';
283
-        }
281
+		if ( ! isset($field->field_options['custom_field']) ) {
282
+			$field->field_options['custom_field'] = '';
283
+		}
284 284
 
285
-        if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) {
286
-            $atts['pre_truncate'] = $atts['truncate'];
287
-            $atts['truncate'] = true;
288
-            $atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0;
285
+		if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) {
286
+			$atts['pre_truncate'] = $atts['truncate'];
287
+			$atts['truncate'] = true;
288
+			$atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0;
289 289
 
290
-            $value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts);
291
-            $atts['truncate'] = $atts['pre_truncate'];
292
-        }
290
+			$value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts);
291
+			$atts['truncate'] = $atts['pre_truncate'];
292
+		}
293 293
 
294
-        if ( $value == '' ) {
295
-            return $value;
296
-        }
294
+		if ( $value == '' ) {
295
+			return $value;
296
+		}
297 297
 
298
-        $value = apply_filters('frm_display_value_custom', maybe_unserialize($value), $field, $atts);
298
+		$value = apply_filters('frm_display_value_custom', maybe_unserialize($value), $field, $atts);
299 299
 		$value = apply_filters( 'frm_display_' . $field->type . '_value_custom', $value, compact( 'field', 'atts' ) );
300 300
 
301
-        $new_value = '';
301
+		$new_value = '';
302 302
 
303
-        if ( is_array($value) && $atts['type'] != 'file' ) {
304
-            foreach ( $value as $val ) {
305
-                if ( is_array($val) ) {
303
+		if ( is_array($value) && $atts['type'] != 'file' ) {
304
+			foreach ( $value as $val ) {
305
+				if ( is_array($val) ) {
306 306
 					//TODO: add options for display (li or ,)
307
-                    $new_value .= implode($atts['sep'], $val);
308
-                    if ( $atts['type'] != 'data' ) {
309
-                        $new_value .= '<br/>';
310
-                    }
311
-                }
312
-                unset($val);
313
-            }
314
-        }
315
-
316
-        if ( ! empty($new_value) ) {
317
-            $value = $new_value;
318
-        } else if ( is_array($value) && $atts['type'] != 'file' && ! $atts['return_array'] ) {
319
-            $value = implode($atts['sep'], $value);
320
-        }
321
-
322
-        if ( $atts['truncate'] && $atts['type'] != 'image' ) {
323
-            $value = FrmAppHelper::truncate($value, 50);
324
-        }
307
+					$new_value .= implode($atts['sep'], $val);
308
+					if ( $atts['type'] != 'data' ) {
309
+						$new_value .= '<br/>';
310
+					}
311
+				}
312
+				unset($val);
313
+			}
314
+		}
315
+
316
+		if ( ! empty($new_value) ) {
317
+			$value = $new_value;
318
+		} else if ( is_array($value) && $atts['type'] != 'file' && ! $atts['return_array'] ) {
319
+			$value = implode($atts['sep'], $value);
320
+		}
321
+
322
+		if ( $atts['truncate'] && $atts['type'] != 'image' ) {
323
+			$value = FrmAppHelper::truncate($value, 50);
324
+		}
325 325
 
326 326
 		if ( ! $atts['keepjs'] && ! is_array( $value ) ) {
327 327
 			$value = wp_kses_post( $value );
328 328
 		}
329 329
 
330
-        return apply_filters('frm_display_value', $value, $field, $atts);
331
-    }
330
+		return apply_filters('frm_display_value', $value, $field, $atts);
331
+	}
332 332
 
333 333
 	public static function set_posted_value( $field, $value, $args ) {
334
-        // If validating a field with "other" opt, set back to prev value now
335
-        if ( isset( $args['other'] ) && $args['other'] ) {
336
-            $value = $args['temp_value'];
337
-        }
338
-        if ( empty($args['parent_field_id']) ) {
339
-            $_POST['item_meta'][ $field->id ] = $value;
340
-        } else {
341
-            $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value;
342
-        }
343
-    }
334
+		// If validating a field with "other" opt, set back to prev value now
335
+		if ( isset( $args['other'] ) && $args['other'] ) {
336
+			$value = $args['temp_value'];
337
+		}
338
+		if ( empty($args['parent_field_id']) ) {
339
+			$_POST['item_meta'][ $field->id ] = $value;
340
+		} else {
341
+			$_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value;
342
+		}
343
+	}
344 344
 
345 345
 	public static function get_posted_value( $field, &$value, $args ) {
346 346
 		$field_id = is_object( $field ) ? $field->id : $field;
347 347
 
348
-        if ( empty($args['parent_field_id']) ) {
349
-            $value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : '';
350
-        } else {
351
-            $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : '';
352
-        }
348
+		if ( empty($args['parent_field_id']) ) {
349
+			$value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : '';
350
+		} else {
351
+			$value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : '';
352
+		}
353 353
 		FrmAppHelper::sanitize_value( 'wp_kses_post', $value );
354 354
 		$value = stripslashes_deep( $value );
355
-    }
356
-
357
-    /**
358
-    * Check if field has an "Other" option and if any other values are posted
359
-    *
360
-    * @since 2.0
361
-    *
362
-    * @param object $field
363
-    * @param string|array $value
364
-    * @param array $args
365
-    */
366
-    public static function maybe_set_other_validation( $field, &$value, &$args ) {
367
-        $args['other'] = false;
368
-        if ( ! $value || empty( $value ) || ! FrmAppHelper::pro_is_installed() ) {
369
-            return;
370
-        }
371
-
372
-        // Get other value for fields in repeating section
373
-        self::set_other_repeating_vals( $field, $value, $args );
374
-
375
-        // Check if there are any posted "Other" values
355
+	}
356
+
357
+	/**
358
+	 * Check if field has an "Other" option and if any other values are posted
359
+	 *
360
+	 * @since 2.0
361
+	 *
362
+	 * @param object $field
363
+	 * @param string|array $value
364
+	 * @param array $args
365
+	 */
366
+	public static function maybe_set_other_validation( $field, &$value, &$args ) {
367
+		$args['other'] = false;
368
+		if ( ! $value || empty( $value ) || ! FrmAppHelper::pro_is_installed() ) {
369
+			return;
370
+		}
371
+
372
+		// Get other value for fields in repeating section
373
+		self::set_other_repeating_vals( $field, $value, $args );
374
+
375
+		// Check if there are any posted "Other" values
376 376
 		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) {
377 377
 
378
-            // Save original value
379
-            $args['temp_value'] = $value;
380
-            $args['other'] = true;
381
-            $other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] );
382
-
383
-            // Set the validation value now
384
-            self::set_other_validation_val( $value, $other_vals, $field, $args );
385
-        }
386
-    }
387
-
388
-    /**
389
-    * Sets radio or checkbox value equal to "other" value if it is set - FOR REPEATING SECTIONS
390
-    *
391
-    * @since 2.0
392
-    *
393
-    * @param object $field
394
-    * @param string|array $value
395
-    * @param array $args
396
-    */
397
-    public static function set_other_repeating_vals( $field, &$value, &$args ) {
398
-        if ( ! $args['parent_field_id'] ) {
399
-            return;
400
-        }
401
-
402
-        // Check if there are any other posted "other" values for this field
378
+			// Save original value
379
+			$args['temp_value'] = $value;
380
+			$args['other'] = true;
381
+			$other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] );
382
+
383
+			// Set the validation value now
384
+			self::set_other_validation_val( $value, $other_vals, $field, $args );
385
+		}
386
+	}
387
+
388
+	/**
389
+	 * Sets radio or checkbox value equal to "other" value if it is set - FOR REPEATING SECTIONS
390
+	 *
391
+	 * @since 2.0
392
+	 *
393
+	 * @param object $field
394
+	 * @param string|array $value
395
+	 * @param array $args
396
+	 */
397
+	public static function set_other_repeating_vals( $field, &$value, &$args ) {
398
+		if ( ! $args['parent_field_id'] ) {
399
+			return;
400
+		}
401
+
402
+		// Check if there are any other posted "other" values for this field
403 403
 		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) {
404
-            // Save original value
405
-            $args['temp_value'] = $value;
406
-            $args['other'] = true;
407
-
408
-            $other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ];
409
-
410
-            // Set the validation value now
411
-            self::set_other_validation_val( $value, $other_vals, $field, $args );
412
-        }
413
-    }
414
-
415
-    /**
416
-    * Modify value used for validation
417
-    * This function essentially removes the "Other" radio or checkbox value from the $value being validated.
418
-    * It also adds any text from the free text fields to the value
419
-    *
420
-    * Needs to accommodate for times when other opt is selected, but no other free text is entered
421
-    *
422
-    * @since 2.0
423
-    *
424
-    * @param string|array $value
425
-    * @param string|array $other_vals (usually of posted values)
426
-    * @param object $field
427
-    * @param array $args
428
-    */
429
-    public static function set_other_validation_val( &$value, $other_vals, $field, &$args ) {
430
-        // Checkboxes and multi-select dropdowns
431
-        if ( is_array( $value ) && $field->type == 'checkbox' ) {
432
-            // Combine "Other" values with checked values. "Other" values will override checked box values.
433
-            $value = array_merge( $value, $other_vals );
434
-            $value = array_filter( $value );
435
-            if ( count( $value ) == 0 ) {
436
-                $value = '';
437
-            }
438
-        } else {
404
+			// Save original value
405
+			$args['temp_value'] = $value;
406
+			$args['other'] = true;
407
+
408
+			$other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ];
409
+
410
+			// Set the validation value now
411
+			self::set_other_validation_val( $value, $other_vals, $field, $args );
412
+		}
413
+	}
414
+
415
+	/**
416
+	 * Modify value used for validation
417
+	 * This function essentially removes the "Other" radio or checkbox value from the $value being validated.
418
+	 * It also adds any text from the free text fields to the value
419
+	 *
420
+	 * Needs to accommodate for times when other opt is selected, but no other free text is entered
421
+	 *
422
+	 * @since 2.0
423
+	 *
424
+	 * @param string|array $value
425
+	 * @param string|array $other_vals (usually of posted values)
426
+	 * @param object $field
427
+	 * @param array $args
428
+	 */
429
+	public static function set_other_validation_val( &$value, $other_vals, $field, &$args ) {
430
+		// Checkboxes and multi-select dropdowns
431
+		if ( is_array( $value ) && $field->type == 'checkbox' ) {
432
+			// Combine "Other" values with checked values. "Other" values will override checked box values.
433
+			$value = array_merge( $value, $other_vals );
434
+			$value = array_filter( $value );
435
+			if ( count( $value ) == 0 ) {
436
+				$value = '';
437
+			}
438
+		} else {
439 439
 			// Radio and dropdowns
440
-            $other_key = array_filter( array_keys($field->options), 'is_string');
441
-            $other_key = reset( $other_key );
440
+			$other_key = array_filter( array_keys($field->options), 'is_string');
441
+			$other_key = reset( $other_key );
442 442
 
443
-            // Multi-select dropdown
444
-            if ( is_array( $value ) ) {
445
-                $o_key = array_search( $field->options[ $other_key ], $value );
443
+			// Multi-select dropdown
444
+			if ( is_array( $value ) ) {
445
+				$o_key = array_search( $field->options[ $other_key ], $value );
446 446
 
447 447
 				if ( $o_key !== false ) {
448 448
 					// Modify the original value so other key will be preserved
@@ -457,20 +457,20 @@  discard block
 block discarded – undo
457 457
 					$args['temp_value'] = $value;
458 458
 					$value[ $other_key ] = reset( $other_vals );
459 459
 				}
460
-            } else if ( $field->options[ $other_key ] == $value ) {
461
-                $value = $other_vals;
462
-            }
463
-        }
464
-    }
460
+			} else if ( $field->options[ $other_key ] == $value ) {
461
+				$value = $other_vals;
462
+			}
463
+		}
464
+	}
465 465
 
466 466
 	public static function enqueue_scripts( $params ) {
467 467
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmFormsController::enqueue_scripts' );
468 468
 		FrmFormsController::enqueue_scripts( $params );
469 469
 	}
470 470
 
471
-    // Add submitted values to a string for spam checking
471
+	// Add submitted values to a string for spam checking
472 472
 	public static function entry_array_to_string( $values ) {
473
-        $content = '';
473
+		$content = '';
474 474
 		foreach ( $values['item_meta'] as $val ) {
475 475
 			if ( $content != '' ) {
476 476
 				$content .= "\n\n";
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 		}
486 486
 
487 487
 		return $content;
488
-    }
488
+	}
489 489
 
490 490
 	/**
491 491
 	 * Get the browser from the user agent
Please login to merge, or discard this patch.
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined('ABSPATH') ) {
2
+if ( ! defined( 'ABSPATH' ) ) {
3 3
 	die( 'You are not allowed to call this page directly.' );
4 4
 }
5 5
 
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
     public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) {
9 9
         $values = array();
10 10
 		foreach ( array( 'name' => '', 'description' => '', 'item_key' => '' ) as $var => $default ) {
11
-			$values[ $var ] = FrmAppHelper::get_post_param( $var, $default, 'wp_kses_post' );
11
+			$values[$var] = FrmAppHelper::get_post_param( $var, $default, 'wp_kses_post' );
12 12
         }
13 13
 
14 14
         $values['fields'] = array();
15
-        if ( empty($fields) ) {
16
-            return apply_filters('frm_setup_new_entry', $values);
15
+        if ( empty( $fields ) ) {
16
+            return apply_filters( 'frm_setup_new_entry', $values );
17 17
         }
18 18
 
19 19
         foreach ( (array) $fields as $field ) {
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
                 'default_value' => $field->default_value,
26 26
                 'name' => $field->name,
27 27
                 'description' => $field->description,
28
-                'type' => apply_filters('frm_field_type', $field->type, $field, $new_value),
28
+                'type' => apply_filters( 'frm_field_type', $field->type, $field, $new_value ),
29 29
                 'options' => $field->options,
30 30
                 'required' => $field->required,
31 31
                 'field_key' => $field->field_key,
@@ -36,43 +36,43 @@  discard block
 block discarded – undo
36 36
 				'in_embed_form' => isset( $args['in_embed_form'] ) ? $args['in_embed_form'] : '0',
37 37
             );
38 38
 
39
-            $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
39
+            $opt_defaults = FrmFieldsHelper::get_default_field_opts( $field_array['type'], $field, true );
40 40
             $opt_defaults['required_indicator'] = '';
41 41
 			$opt_defaults['original_type'] = $field->type;
42 42
 
43 43
 			foreach ( $opt_defaults as $opt => $default_opt ) {
44
-                $field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt;
45
-                unset($opt, $default_opt);
44
+                $field_array[$opt] = ( isset( $field->field_options[$opt] ) && $field->field_options[$opt] != '' ) ? $field->field_options[$opt] : $default_opt;
45
+                unset( $opt, $default_opt );
46 46
             }
47 47
 
48
-            unset($opt_defaults);
48
+            unset( $opt_defaults );
49 49
 
50 50
             if ( $field_array['custom_html'] == '' ) {
51
-                $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
51
+                $field_array['custom_html'] = FrmFieldsHelper::get_default_html( $field->type );
52 52
             }
53 53
 
54
-            $field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field, $args );
54
+            $field_array = apply_filters( 'frm_setup_new_fields_vars', $field_array, $field, $args );
55 55
             $field_array = array_merge( $field->field_options, $field_array );
56 56
 
57 57
             $values['fields'][] = $field_array;
58 58
 
59
-            if ( ! $form || ! isset($form->id) ) {
60
-                $form = FrmForm::getOne($field->form_id);
59
+            if ( ! $form || ! isset( $form->id ) ) {
60
+                $form = FrmForm::getOne( $field->form_id );
61 61
             }
62 62
         }
63 63
 
64
-        $form->options = maybe_unserialize($form->options);
65
-        if ( is_array($form->options) ) {
64
+        $form->options = maybe_unserialize( $form->options );
65
+        if ( is_array( $form->options ) ) {
66 66
             foreach ( $form->options as $opt => $value ) {
67
-                $values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value );
68
-                unset($opt, $value);
67
+                $values[$opt] = FrmAppHelper::get_post_param( $opt, $value );
68
+                unset( $opt, $value );
69 69
             }
70 70
         }
71 71
 
72 72
 		$form_defaults = FrmFormsHelper::get_default_opts();
73 73
 
74 74
 		$frm_settings = FrmAppHelper::get_settings();
75
-		$form_defaults['custom_style']  = ( $frm_settings->load_style != 'none' );
75
+		$form_defaults['custom_style'] = ( $frm_settings->load_style != 'none' );
76 76
 
77 77
 		$values = array_merge( $form_defaults, $values );
78 78
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		$return_array = FrmField::is_field_with_multiple_values( $field );
96 96
 
97 97
 		// Do any shortcodes in default value and allow customization of default value
98
-		$field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true, $return_array);
98
+		$field->default_value = apply_filters( 'frm_get_default_value', $field->default_value, $field, true, $return_array );
99 99
 		// Calls FrmProFieldsHelper::get_default_value
100 100
 
101 101
 		$new_value = $field->default_value;
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 		}
115 115
 
116 116
 		if ( ! is_array( $new_value ) ) {
117
-			$new_value = str_replace('"', '&quot;', $new_value);
117
+			$new_value = str_replace( '"', '&quot;', $new_value );
118 118
 		}
119 119
 
120 120
 		return $new_value;
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
 		if ( $_POST ) {
134 134
 			$repeating = isset( $args['repeating'] ) && $args['repeating'];
135 135
 			if ( $repeating ) {
136
-				if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) {
136
+				if ( isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] ) ) {
137 137
 					$value_is_posted = true;
138 138
 				}
139
-			} else if ( isset( $_POST['item_meta'][ $field->id ] ) ) {
139
+			} else if ( isset( $_POST['item_meta'][$field->id] ) ) {
140 140
 				$value_is_posted = true;
141 141
 			}
142 142
 		}
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 		$values['item_key'] = FrmAppHelper::get_post_param( 'item_key', $record->item_key, 'sanitize_title' );
148 148
         $values['form_id'] = $record->form_id;
149 149
         $values['is_draft'] = $record->is_draft;
150
-        return apply_filters('frm_setup_edit_entry_vars', $values, $record);
150
+        return apply_filters( 'frm_setup_edit_entry_vars', $values, $record );
151 151
     }
152 152
 
153 153
     public static function get_admin_params( $form = null ) {
@@ -176,22 +176,22 @@  discard block
 block discarded – undo
176 176
     }
177 177
 
178 178
 	public static function replace_default_message( $message, $atts ) {
179
-        if ( strpos($message, '[default-message') === false &&
180
-            strpos($message, '[default_message') === false &&
179
+        if ( strpos( $message, '[default-message' ) === false &&
180
+            strpos( $message, '[default_message' ) === false &&
181 181
             ! empty( $message ) ) {
182 182
             return $message;
183 183
         }
184 184
 
185
-        if ( empty($message) ) {
185
+        if ( empty( $message ) ) {
186 186
             $message = '[default-message]';
187 187
         }
188 188
 
189
-        preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER);
189
+        preg_match_all( "/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER );
190 190
 
191 191
         foreach ( $shortcodes[0] as $short_key => $tag ) {
192
-			$add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
192
+			$add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] );
193 193
 			if ( ! empty( $add_atts ) ) {
194
-                $this_atts = array_merge($atts, $add_atts);
194
+                $this_atts = array_merge( $atts, $add_atts );
195 195
             } else {
196 196
                 $this_atts = $atts;
197 197
             }
@@ -199,32 +199,32 @@  discard block
 block discarded – undo
199 199
 			$default = FrmEntriesController::show_entry_shortcode( $this_atts );
200 200
 
201 201
             // Add the default message
202
-            $message = str_replace( $shortcodes[0][ $short_key ], $default, $message );
202
+            $message = str_replace( $shortcodes[0][$short_key], $default, $message );
203 203
         }
204 204
 
205 205
         return $message;
206 206
     }
207 207
 
208 208
 	public static function prepare_display_value( $entry, $field, $atts ) {
209
-		$field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false;
209
+		$field_value = isset( $entry->metas[$field->id] ) ? $entry->metas[$field->id] : false;
210 210
 
211 211
         if ( FrmAppHelper::pro_is_installed() ) {
212 212
 			FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value );
213 213
         }
214 214
 
215
-        if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) {
216
-            return self::display_value($field_value, $field, $atts);
215
+        if ( $field->form_id == $entry->form_id || empty( $atts['embedded_field_id'] ) ) {
216
+            return self::display_value( $field_value, $field, $atts );
217 217
         }
218 218
 
219 219
         // this is an embeded form
220 220
         $val = '';
221 221
 
222
-	    if ( strpos($atts['embedded_field_id'], 'form') === 0 ) {
222
+	    if ( strpos( $atts['embedded_field_id'], 'form' ) === 0 ) {
223 223
             //this is a repeating section
224 224
 			$child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) );
225 225
         } else {
226 226
             // get all values for this field
227
-	        $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false;
227
+	        $child_values = isset( $entry->metas[$atts['embedded_field_id']] ) ? $entry->metas[$atts['embedded_field_id']] : false;
228 228
 
229 229
             if ( $child_values ) {
230 230
 	            $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) );
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 	    $field_value = array();
235 235
 
236
-        if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
236
+        if ( ! isset( $child_entries ) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
237 237
             return $val;
238 238
         }
239 239
 
@@ -242,17 +242,17 @@  discard block
 block discarded – undo
242 242
             $atts['post_id'] = $child_entry->post_id;
243 243
 
244 244
             // get the value for this field -- check for post values as well
245
-            $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field);
245
+            $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value( $child_entry, $field );
246 246
 
247 247
             if ( $entry_val ) {
248 248
                 // foreach entry get display_value
249
-                $field_value[] = self::display_value($entry_val, $field, $atts);
249
+                $field_value[] = self::display_value( $entry_val, $field, $atts );
250 250
             }
251 251
 
252
-            unset($child_entry);
252
+            unset( $child_entry );
253 253
         }
254 254
 
255
-        $val = implode(', ', (array) $field_value );
255
+        $val = implode( ', ', (array) $field_value );
256 256
 		$val = wp_kses_post( $val );
257 257
 
258 258
         return $val;
@@ -272,22 +272,22 @@  discard block
 block discarded – undo
272 272
         );
273 273
 
274 274
         $atts = wp_parse_args( $atts, $defaults );
275
-        $atts = apply_filters('frm_display_value_atts', $atts, $field, $value);
275
+        $atts = apply_filters( 'frm_display_value_atts', $atts, $field, $value );
276 276
 
277
-        if ( ! isset($field->field_options['post_field']) ) {
277
+        if ( ! isset( $field->field_options['post_field'] ) ) {
278 278
             $field->field_options['post_field'] = '';
279 279
         }
280 280
 
281
-        if ( ! isset($field->field_options['custom_field']) ) {
281
+        if ( ! isset( $field->field_options['custom_field'] ) ) {
282 282
             $field->field_options['custom_field'] = '';
283 283
         }
284 284
 
285 285
         if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) {
286 286
             $atts['pre_truncate'] = $atts['truncate'];
287 287
             $atts['truncate'] = true;
288
-            $atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0;
288
+            $atts['exclude_cat'] = isset( $field->field_options['exclude_cat'] ) ? $field->field_options['exclude_cat'] : 0;
289 289
 
290
-            $value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts);
290
+            $value = FrmProEntryMetaHelper::get_post_value( $atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts );
291 291
             $atts['truncate'] = $atts['pre_truncate'];
292 292
         }
293 293
 
@@ -295,39 +295,39 @@  discard block
 block discarded – undo
295 295
             return $value;
296 296
         }
297 297
 
298
-        $value = apply_filters('frm_display_value_custom', maybe_unserialize($value), $field, $atts);
298
+        $value = apply_filters( 'frm_display_value_custom', maybe_unserialize( $value ), $field, $atts );
299 299
 		$value = apply_filters( 'frm_display_' . $field->type . '_value_custom', $value, compact( 'field', 'atts' ) );
300 300
 
301 301
         $new_value = '';
302 302
 
303
-        if ( is_array($value) && $atts['type'] != 'file' ) {
303
+        if ( is_array( $value ) && $atts['type'] != 'file' ) {
304 304
             foreach ( $value as $val ) {
305
-                if ( is_array($val) ) {
305
+                if ( is_array( $val ) ) {
306 306
 					//TODO: add options for display (li or ,)
307
-                    $new_value .= implode($atts['sep'], $val);
307
+                    $new_value .= implode( $atts['sep'], $val );
308 308
                     if ( $atts['type'] != 'data' ) {
309 309
                         $new_value .= '<br/>';
310 310
                     }
311 311
                 }
312
-                unset($val);
312
+                unset( $val );
313 313
             }
314 314
         }
315 315
 
316
-        if ( ! empty($new_value) ) {
316
+        if ( ! empty( $new_value ) ) {
317 317
             $value = $new_value;
318
-        } else if ( is_array($value) && $atts['type'] != 'file' && ! $atts['return_array'] ) {
319
-            $value = implode($atts['sep'], $value);
318
+        } else if ( is_array( $value ) && $atts['type'] != 'file' && ! $atts['return_array'] ) {
319
+            $value = implode( $atts['sep'], $value );
320 320
         }
321 321
 
322 322
         if ( $atts['truncate'] && $atts['type'] != 'image' ) {
323
-            $value = FrmAppHelper::truncate($value, 50);
323
+            $value = FrmAppHelper::truncate( $value, 50 );
324 324
         }
325 325
 
326 326
 		if ( ! $atts['keepjs'] && ! is_array( $value ) ) {
327 327
 			$value = wp_kses_post( $value );
328 328
 		}
329 329
 
330
-        return apply_filters('frm_display_value', $value, $field, $atts);
330
+        return apply_filters( 'frm_display_value', $value, $field, $atts );
331 331
     }
332 332
 
333 333
 	public static function set_posted_value( $field, $value, $args ) {
@@ -335,20 +335,20 @@  discard block
 block discarded – undo
335 335
         if ( isset( $args['other'] ) && $args['other'] ) {
336 336
             $value = $args['temp_value'];
337 337
         }
338
-        if ( empty($args['parent_field_id']) ) {
339
-            $_POST['item_meta'][ $field->id ] = $value;
338
+        if ( empty( $args['parent_field_id'] ) ) {
339
+            $_POST['item_meta'][$field->id] = $value;
340 340
         } else {
341
-            $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value;
341
+            $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] = $value;
342 342
         }
343 343
     }
344 344
 
345 345
 	public static function get_posted_value( $field, &$value, $args ) {
346 346
 		$field_id = is_object( $field ) ? $field->id : $field;
347 347
 
348
-        if ( empty($args['parent_field_id']) ) {
349
-            $value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : '';
348
+        if ( empty( $args['parent_field_id'] ) ) {
349
+            $value = isset( $_POST['item_meta'][$field_id] ) ? $_POST['item_meta'][$field_id] : '';
350 350
         } else {
351
-            $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : '';
351
+            $value = isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) ? $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] : '';
352 352
         }
353 353
 		FrmAppHelper::sanitize_value( 'wp_kses_post', $value );
354 354
 		$value = stripslashes_deep( $value );
@@ -373,12 +373,12 @@  discard block
 block discarded – undo
373 373
         self::set_other_repeating_vals( $field, $value, $args );
374 374
 
375 375
         // Check if there are any posted "Other" values
376
-		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) {
376
+		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][$field->id] ) ) {
377 377
 
378 378
             // Save original value
379 379
             $args['temp_value'] = $value;
380 380
             $args['other'] = true;
381
-            $other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] );
381
+            $other_vals = stripslashes_deep( $_POST['item_meta']['other'][$field->id] );
382 382
 
383 383
             // Set the validation value now
384 384
             self::set_other_validation_val( $value, $other_vals, $field, $args );
@@ -400,12 +400,12 @@  discard block
 block discarded – undo
400 400
         }
401 401
 
402 402
         // Check if there are any other posted "other" values for this field
403
-		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) {
403
+		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ) ) {
404 404
             // Save original value
405 405
             $args['temp_value'] = $value;
406 406
             $args['other'] = true;
407 407
 
408
-            $other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ];
408
+            $other_vals = $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id];
409 409
 
410 410
             // Set the validation value now
411 411
             self::set_other_validation_val( $value, $other_vals, $field, $args );
@@ -437,27 +437,27 @@  discard block
 block discarded – undo
437 437
             }
438 438
         } else {
439 439
 			// Radio and dropdowns
440
-            $other_key = array_filter( array_keys($field->options), 'is_string');
440
+            $other_key = array_filter( array_keys( $field->options ), 'is_string' );
441 441
             $other_key = reset( $other_key );
442 442
 
443 443
             // Multi-select dropdown
444 444
             if ( is_array( $value ) ) {
445
-                $o_key = array_search( $field->options[ $other_key ], $value );
445
+                $o_key = array_search( $field->options[$other_key], $value );
446 446
 
447 447
 				if ( $o_key !== false ) {
448 448
 					// Modify the original value so other key will be preserved
449
-					$value[ $other_key ] = $value[ $o_key ];
449
+					$value[$other_key] = $value[$o_key];
450 450
 
451 451
 					// By default, the array keys will be numeric for multi-select dropdowns
452 452
 					// If going backwards and forwards between pages, the array key will match the other key
453 453
 					if ( $o_key != $other_key ) {
454
-						unset( $value[ $o_key ] );
454
+						unset( $value[$o_key] );
455 455
 					}
456 456
 
457 457
 					$args['temp_value'] = $value;
458
-					$value[ $other_key ] = reset( $other_vals );
458
+					$value[$other_key] = reset( $other_vals );
459 459
 				}
460
-            } else if ( $field->options[ $other_key ] == $value ) {
460
+            } else if ( $field->options[$other_key] == $value ) {
461 461
                 $value = $other_vals;
462 462
             }
463 463
         }
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 				$content .= "\n\n";
477 477
 			}
478 478
 
479
-			if ( is_array($val) ) {
479
+			if ( is_array( $val ) ) {
480 480
 				$val = FrmAppHelper::array_flatten( $val );
481 481
 				$val = implode( ', ', $val );
482 482
 			}
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 		preg_match_all( $pattern, $u_agent, $matches ); // get the matching numbers
541 541
 
542 542
 		// see how many we have
543
-		$i = count($matches['browser']);
543
+		$i = count( $matches['browser'] );
544 544
 
545 545
 		if ( $i > 1 ) {
546 546
 			//we will have two since we are not using 'other' argument yet
Please login to merge, or discard this patch.