Completed
Push — master ( 7d42b5...b32aa6 )
by Stephanie
02:40
created
css/_single_theme.css.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 $settings = FrmStylesHelper::get_settings_for_output( $style );
4 4
 extract( $settings );
5 5
 
6
-$important = empty($important_style) ? '' : ' !important';
6
+$important = empty( $important_style ) ? '' : ' !important';
7 7
 $label_margin = (int) $width + 10;
8 8
 
9 9
 $minus_icons = FrmStylesHelper::minus_icons();
@@ -123,11 +123,11 @@  discard block
 block discarded – undo
123 123
 }
124 124
 
125 125
 .<?php echo esc_html( $style_class ) ?> .frm_icon_font.frm_minus_icon:before{
126
-	content:"\e<?php echo esc_html( isset( $minus_icons[ $repeat_icon ] ) ? $minus_icons[ $repeat_icon ]['-'] : $minus_icons[1]['-'] ) ?>";
126
+	content:"\e<?php echo esc_html( isset( $minus_icons[$repeat_icon] ) ? $minus_icons[$repeat_icon]['-'] : $minus_icons[1]['-'] ) ?>";
127 127
 }
128 128
 
129 129
 .<?php echo esc_html( $style_class ) ?> .frm_icon_font.frm_plus_icon:before{
130
-	content:"\e<?php echo esc_html( isset( $minus_icons[ $repeat_icon ] ) ? $minus_icons[ $repeat_icon ]['+'] : $minus_icons[1]['+'] ) ?>";
130
+	content:"\e<?php echo esc_html( isset( $minus_icons[$repeat_icon] ) ? $minus_icons[$repeat_icon]['+'] : $minus_icons[1]['+'] ) ?>";
131 131
 }
132 132
 
133 133
 .<?php echo esc_html( $style_class ) ?> .frm_icon_font.frm_minus_icon:before,
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
 }
137 137
 
138 138
 .<?php echo esc_html( $style_class ) ?> .frm_trigger.active .frm_icon_font.frm_arrow_icon:before{
139
-	content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['-'] : $arrow_icons[1]['-'] ) ?>";
139
+	content:"\e<?php echo esc_html( isset( $arrow_icons[$collapse_icon] ) ? $arrow_icons[$collapse_icon]['-'] : $arrow_icons[1]['-'] ) ?>";
140 140
 	color:<?php echo esc_html( $section_color . $important ) ?>;
141 141
 }
142 142
 
143 143
 .<?php echo esc_html( $style_class ) ?> .frm_trigger .frm_icon_font.frm_arrow_icon:before{
144
-	content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['+'] : $arrow_icons[1]['+'] ) ?>";
144
+	content:"\e<?php echo esc_html( isset( $arrow_icons[$collapse_icon] ) ? $arrow_icons[$collapse_icon]['+'] : $arrow_icons[1]['+'] ) ?>";
145 145
 	color:<?php echo esc_html( $section_color . $important ) ?>;
146 146
 }
147 147
 
@@ -966,10 +966,10 @@  discard block
 block discarded – undo
966 966
 .<?php echo esc_html( $style_class ) ?> .chosen-container-single .chosen-single div{
967 967
 <?php
968 968
     // calculate the top position based on field padding
969
-    $top_pad = explode(' ', $field_pad);
970
-    $top_pad = reset($top_pad); // the top padding is listed first
971
-    $pad_unit = preg_replace('/[0-9]+/', '', $top_pad); //px, em, rem...
972
-    $top_margin = (int) str_replace($pad_unit, '', $top_pad) / 2;
969
+    $top_pad = explode( ' ', $field_pad );
970
+    $top_pad = reset( $top_pad ); // the top padding is listed first
971
+    $pad_unit = preg_replace( '/[0-9]+/', '', $top_pad ); //px, em, rem...
972
+    $top_margin = (int) str_replace( $pad_unit, '', $top_pad ) / 2;
973 973
 ?>
974 974
     top:<?php echo esc_html( $top_margin . $pad_unit . $important ) ?>;
975 975
 }
Please login to merge, or discard this patch.
classes/helpers/FrmStylesHelper.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
             'swanky-purse'  => 'Swanky Purse',
30 30
         );
31 31
 
32
-        $themes = apply_filters('frm_jquery_themes', $themes);
32
+        $themes = apply_filters( 'frm_jquery_themes', $themes );
33 33
         return $themes;
34 34
     }
35 35
 
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 
41 41
         if ( ! $theme_css || $theme_css == '' || $theme_css == 'ui-lightness' ) {
42 42
             $css_file = FrmAppHelper::plugin_url() . '/css/ui-lightness/jquery-ui.css';
43
-        } else if ( preg_match('/^http.?:\/\/.*\..*$/', $theme_css) ) {
43
+        } else if ( preg_match( '/^http.?:\/\/.*\..*$/', $theme_css ) ) {
44 44
             $css_file = $theme_css;
45 45
         } else {
46 46
             $uploads = self::get_upload_base();
47 47
 			$file_path = '/formidable/css/' . $theme_css . '/jquery-ui.css';
48
-            if ( file_exists($uploads['basedir'] . $file_path) ) {
48
+            if ( file_exists( $uploads['basedir'] . $file_path ) ) {
49 49
                 $css_file = $uploads['baseurl'] . $file_path;
50 50
             } else {
51 51
 				$css_file = FrmAppHelper::jquery_ui_base_url() . '/themes/' . $theme_css . '/jquery-ui.min.css';
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		$form = self::get_form_for_page();
60 60
 		$theme_css = FrmStylesController::get_style_val( 'theme_css', $form );
61 61
         if ( $theme_css != -1 ) {
62
-            wp_enqueue_style('jquery-theme', self::jquery_css_url($theme_css), array(), FrmAppHelper::plugin_version());
62
+            wp_enqueue_style( 'jquery-theme', self::jquery_css_url( $theme_css ), array(), FrmAppHelper::plugin_version() );
63 63
         }
64 64
     }
65 65
 
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 
80 80
     public static function get_upload_base() {
81 81
         $uploads = wp_upload_dir();
82
-        if ( is_ssl() && ! preg_match('/^https:\/\/.*\..*$/', $uploads['baseurl']) ) {
83
-            $uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']);
82
+        if ( is_ssl() && ! preg_match( '/^https:\/\/.*\..*$/', $uploads['baseurl'] ) ) {
83
+            $uploads['baseurl'] = str_replace( 'http://', 'https://', $uploads['baseurl'] );
84 84
         }
85 85
 
86 86
         return $uploads;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         <h2 class="nav-tab-wrapper">
92 92
 			<a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-styles' ) ) ?>" class="nav-tab <?php echo ( '' == $active ) ? 'nav-tab-active' : '' ?>"><?php esc_html_e( 'Edit Styles', 'formidable' ) ?></a>
93 93
 			<a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-styles&frm_action=manage' ) ) ?>" class="nav-tab <?php echo ( 'manage' == $active ) ? 'nav-tab-active' : '' ?>"><?php esc_html_e( 'Manage Form Styles', 'formidable' ) ?></a>
94
-			<a href="<?php echo esc_url( admin_url('admin.php?page=formidable-styles&frm_action=custom_css' ) ) ?>" class="nav-tab <?php echo ( 'custom_css' == $active ) ? 'nav-tab-active' : '' ?>"><?php esc_html_e( 'Custom CSS', 'formidable' ) ?></a>
94
+			<a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-styles&frm_action=custom_css' ) ) ?>" class="nav-tab <?php echo ( 'custom_css' == $active ) ? 'nav-tab-active' : '' ?>"><?php esc_html_e( 'Custom CSS', 'formidable' ) ?></a>
95 95
         </h2>
96 96
 <?php
97 97
     }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 				'-' => 'down',
198 198
 				'+' => 'up',
199 199
 			);
200
-			$class = 'frm_arrow' . $arrow[ $icon ];
200
+			$class = 'frm_arrow' . $arrow[$icon];
201 201
 		} else {
202 202
 			//frm_minus1_icon
203 203
 			$key = str_replace( 'p', '', $key );
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 				'-' => 'minus',
206 206
 				'+' => 'plus',
207 207
 			);
208
-			$class = 'frm_' . $plus[ $icon ];
208
+			$class = 'frm_' . $plus[$icon];
209 209
 		}
210 210
 
211 211
         if ( $key ) {
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 
224 224
         $name = ( 'arrow' == $type ) ? 'collapse_icon' : 'repeat_icon';
225 225
 ?>
226
-    	<select name="<?php echo esc_attr( $frm_style->get_field_name($name) ) ?>" id="frm_<?php echo esc_attr( $name ) ?>" class="frm_icon_font frm_multiselect hide-if-js">
226
+    	<select name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ) ?>" id="frm_<?php echo esc_attr( $name ) ?>" class="frm_icon_font frm_multiselect hide-if-js">
227 227
             <?php foreach ( $icons as $key => $icon ) { ?>
228
-			<option value="<?php echo esc_attr( $key ) ?>" <?php selected( $style->post_content[ $name ], $key ) ?>>
228
+			<option value="<?php echo esc_attr( $key ) ?>" <?php selected( $style->post_content[$name], $key ) ?>>
229 229
 				<?php echo '&#xe' . $icon['+'] . '; &#xe' . $icon['-'] . ';'; ?>
230 230
             </option>
231 231
             <?php } ?>
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 
234 234
         <div class="btn-group hide-if-no-js" id="frm_<?php echo esc_attr( $name ) ?>_select">
235 235
             <button class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" type="button">
236
-				<i class="frm_icon_font <?php echo esc_attr( self::icon_key_to_class( $style->post_content[ $name ], '+', $type ) ) ?>"></i>
237
-				<i class="frm_icon_font <?php echo esc_attr( self::icon_key_to_class( $style->post_content[ $name ], '-', $type ) ) ?>"></i>
236
+				<i class="frm_icon_font <?php echo esc_attr( self::icon_key_to_class( $style->post_content[$name], '+', $type ) ) ?>"></i>
237
+				<i class="frm_icon_font <?php echo esc_attr( self::icon_key_to_class( $style->post_content[$name], '-', $type ) ) ?>"></i>
238 238
                 <b class="caret"></b>
239 239
             </button>
240 240
             <ul class="multiselect-container frm-dropdown-menu">
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
     }
258 258
 
259 259
 	public static function hex2rgb( $hex ) {
260
-        $hex = str_replace('#', '', $hex);
260
+        $hex = str_replace( '#', '', $hex );
261 261
 
262
-        if ( strlen($hex) == 3 ) {
262
+        if ( strlen( $hex ) == 3 ) {
263 263
 			$r = hexdec( substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) );
264 264
 			$g = hexdec( substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) );
265 265
 			$b = hexdec( substr( $hex, 2, 1 ) . substr( $hex, 2, 1 ) );
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 			$b = hexdec( substr( $hex, 4, 2 ) );
270 270
         }
271 271
 		$rgb = array( $r, $g, $b );
272
-        return implode(',', $rgb); // returns the rgb values separated by commas
272
+        return implode( ',', $rgb ); // returns the rgb values separated by commas
273 273
         //return $rgb; // returns an array with the rgb values
274 274
     }
275 275
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 * @since 2.3
280 280
 	 */
281 281
 	public static function adjust_brightness( $hex, $steps ) {
282
-		$steps = max( -255, min( 255, $steps ) );
282
+		$steps = max( - 255, min( 255, $steps ) );
283 283
 
284 284
 		// Normalize into a six character long hex string
285 285
 		$hex = str_replace( '#', '', $hex );
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
 
331 331
 		$checkbox_opts = array( 'important_style', 'auto_width', 'submit_style', 'collapse_icon', 'center_form' );
332 332
 		foreach ( $checkbox_opts as $opt ) {
333
-			if ( ! isset( $settings[ $opt ] ) ) {
334
-				$settings[ $opt ] = 0;
333
+			if ( ! isset( $settings[$opt] ) ) {
334
+				$settings[$opt] = 0;
335 335
 			}
336 336
 		}
337 337
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 		$colors = self::allow_color_override();
348 348
 		foreach ( $colors as $css => $opts ) {
349 349
 			foreach ( $opts as $opt ) {
350
-				self::get_color_output( $css, $settings[ $opt ] );
350
+				self::get_color_output( $css, $settings[$opt] );
351 351
 			}
352 352
 		}
353 353
 	}
Please login to merge, or discard this patch.
classes/helpers/FrmFieldsHelper.php 2 patches
Indentation   +524 added lines, -524 removed lines patch added patch discarded remove patch
@@ -7,73 +7,73 @@  discard block
 block discarded – undo
7 7
 
8 8
 	public static function setup_new_vars( $type = '', $form_id = '' ) {
9 9
 
10
-        if ( strpos($type, '|') ) {
11
-            list($type, $setting) = explode('|', $type);
12
-        }
13
-
14
-        $defaults = self::get_default_field_opts($type, $form_id);
15
-        $defaults['field_options']['custom_html'] = self::get_default_html($type);
16
-
17
-        $values = array();
18
-
19
-        foreach ( $defaults as $var => $default ) {
20
-            if ( $var == 'field_options' ) {
21
-                $values['field_options'] = array();
22
-                foreach ( $default as $opt_var => $opt_default ) {
23
-                    $values['field_options'][ $opt_var ] = $opt_default;
24
-                    unset($opt_var, $opt_default);
25
-                }
26
-            } else {
27
-                $values[ $var ] = $default;
28
-            }
29
-            unset($var, $default);
30
-        }
31
-
32
-        if ( isset( $setting ) && ! empty( $setting ) ) {
33
-            if ( in_array( $type, array( 'data', 'lookup' ) ) ) {
34
-                $values['field_options']['data_type'] = $setting;
35
-            } else {
36
-                $values['field_options'][ $setting ] = 1;
37
-            }
38
-        }
39
-
40
-        if ( $type == 'radio' || $type == 'checkbox' ) {
41
-            $values['options'] = serialize( array(
42
-                __( 'Option 1', 'formidable' ),
43
-                __( 'Option 2', 'formidable' ),
44
-            ) );
45
-        } else if ( $type == 'select' ) {
10
+		if ( strpos($type, '|') ) {
11
+			list($type, $setting) = explode('|', $type);
12
+		}
13
+
14
+		$defaults = self::get_default_field_opts($type, $form_id);
15
+		$defaults['field_options']['custom_html'] = self::get_default_html($type);
16
+
17
+		$values = array();
18
+
19
+		foreach ( $defaults as $var => $default ) {
20
+			if ( $var == 'field_options' ) {
21
+				$values['field_options'] = array();
22
+				foreach ( $default as $opt_var => $opt_default ) {
23
+					$values['field_options'][ $opt_var ] = $opt_default;
24
+					unset($opt_var, $opt_default);
25
+				}
26
+			} else {
27
+				$values[ $var ] = $default;
28
+			}
29
+			unset($var, $default);
30
+		}
31
+
32
+		if ( isset( $setting ) && ! empty( $setting ) ) {
33
+			if ( in_array( $type, array( 'data', 'lookup' ) ) ) {
34
+				$values['field_options']['data_type'] = $setting;
35
+			} else {
36
+				$values['field_options'][ $setting ] = 1;
37
+			}
38
+		}
39
+
40
+		if ( $type == 'radio' || $type == 'checkbox' ) {
41
+			$values['options'] = serialize( array(
42
+				__( 'Option 1', 'formidable' ),
43
+				__( 'Option 2', 'formidable' ),
44
+			) );
45
+		} else if ( $type == 'select' ) {
46 46
 			$values['options'] = serialize( array(
47 47
 				'',
48 48
 				__( 'Option 1', 'formidable' ),
49 49
 			) );
50
-        } else if ( $type == 'textarea' ) {
51
-            $values['field_options']['max'] = '5';
52
-        } else if ( $type == 'captcha' ) {
53
-            $frm_settings = FrmAppHelper::get_settings();
54
-            $values['invalid'] = $frm_settings->re_msg;
50
+		} else if ( $type == 'textarea' ) {
51
+			$values['field_options']['max'] = '5';
52
+		} else if ( $type == 'captcha' ) {
53
+			$frm_settings = FrmAppHelper::get_settings();
54
+			$values['invalid'] = $frm_settings->re_msg;
55 55
 			$values['field_options']['label'] = 'none';
56
-        } else if ( 'url' == $type ) {
57
-            $values['name'] = __( 'Website', 'formidable' );
58
-        }
56
+		} else if ( 'url' == $type ) {
57
+			$values['name'] = __( 'Website', 'formidable' );
58
+		}
59 59
 
60 60
 		$fields = FrmField::field_selection();
61
-        $fields = array_merge($fields, FrmField::pro_field_selection());
61
+		$fields = array_merge($fields, FrmField::pro_field_selection());
62 62
 
63
-        if ( isset( $fields[ $type ] ) ) {
64
-            $values['name'] = is_array( $fields[ $type ] ) ? $fields[ $type ]['name'] : $fields[ $type ];
65
-        }
63
+		if ( isset( $fields[ $type ] ) ) {
64
+			$values['name'] = is_array( $fields[ $type ] ) ? $fields[ $type ]['name'] : $fields[ $type ];
65
+		}
66 66
 
67
-        unset($fields);
67
+		unset($fields);
68 68
 
69
-        return $values;
70
-    }
69
+		return $values;
70
+	}
71 71
 
72 72
 	public static function get_html_id( $field, $plus = '' ) {
73 73
 		return apply_filters( 'frm_field_html_id', 'field_' . $field['field_key'] . $plus, $field );
74
-    }
74
+	}
75 75
 
76
-    public static function setup_edit_vars( $record, $doing_ajax = false ) {
76
+	public static function setup_edit_vars( $record, $doing_ajax = false ) {
77 77
 		$values = array(
78 78
 			'id'      => $record->id,
79 79
 			'form_id' => $record->form_id,
@@ -89,40 +89,40 @@  discard block
 block discarded – undo
89 89
 		);
90 90
 
91 91
 		if ( $doing_ajax ) {
92
-            $values = $values + $defaults;
93
-            $values['form_name'] = '';
92
+			$values = $values + $defaults;
93
+			$values['form_name'] = '';
94 94
 		} else {
95 95
 			foreach ( $defaults as $var => $default ) {
96
-                $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' );
97
-                unset($var, $default);
98
-            }
96
+				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' );
97
+				unset($var, $default);
98
+			}
99 99
 
100 100
 			$values['form_name'] = $record->form_id ? FrmForm::getName( $record->form_id ) : '';
101
-        }
101
+		}
102 102
 
103 103
 		unset( $defaults );
104 104
 
105
-        $values['options'] = $record->options;
106
-        $values['field_options'] = $record->field_options;
105
+		$values['options'] = $record->options;
106
+		$values['field_options'] = $record->field_options;
107 107
 
108
-        $defaults = self::get_default_field_opts($values['type'], $record, true);
108
+		$defaults = self::get_default_field_opts($values['type'], $record, true);
109 109
 
110 110
 		if ( $values['type'] == 'captcha' ) {
111
-            $frm_settings = FrmAppHelper::get_settings();
112
-            $defaults['invalid'] = $frm_settings->re_msg;
113
-        }
111
+			$frm_settings = FrmAppHelper::get_settings();
112
+			$defaults['invalid'] = $frm_settings->re_msg;
113
+		}
114 114
 
115 115
 		foreach ( $defaults as $opt => $default ) {
116
-            $values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default;
117
-            unset($opt, $default);
118
-        }
116
+			$values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default;
117
+			unset($opt, $default);
118
+		}
119 119
 
120 120
 		$values['custom_html'] = ( isset( $record->field_options['custom_html'] ) ) ? $record->field_options['custom_html'] : self::get_default_html( $record->type );
121 121
 
122 122
 		return apply_filters( 'frm_setup_edit_field_vars', $values, array( 'doing_ajax' => $doing_ajax ) );
123
-    }
123
+	}
124 124
 
125
-    public static function get_default_field_opts( $type, $field, $limit = false ) {
125
+	public static function get_default_field_opts( $type, $field, $limit = false ) {
126 126
 		$field_options = array(
127 127
 			'size'           => '',
128 128
 			'max'            => '',
@@ -140,18 +140,18 @@  discard block
 block discarded – undo
140 140
 		);
141 141
 
142 142
 		if ( $limit ) {
143
-            return $field_options;
143
+			return $field_options;
144 144
 		}
145 145
 
146
-        global $wpdb;
146
+		global $wpdb;
147 147
 
148 148
 		$form_id = ( is_numeric( $field ) ) ? $field : $field->form_id;
149 149
 
150 150
 		$key = is_numeric( $field ) ? FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_fields', 'field_key' ) : $field->field_key;
151 151
 
152
-        $field_count = FrmDb::get_var( 'frm_fields', array( 'form_id' => $form_id ), 'field_order', array( 'order_by' => 'field_order DESC' ) );
152
+		$field_count = FrmDb::get_var( 'frm_fields', array( 'form_id' => $form_id ), 'field_order', array( 'order_by' => 'field_order DESC' ) );
153 153
 
154
-        $frm_settings = FrmAppHelper::get_settings();
154
+		$frm_settings = FrmAppHelper::get_settings();
155 155
 		return array(
156 156
 			'name'          => __( 'Untitled', 'formidable' ),
157 157
 			'description'   => '',
@@ -167,24 +167,24 @@  discard block
 block discarded – undo
167 167
 			'form_id'       => $form_id,
168 168
 			'field_options' => $field_options,
169 169
 		);
170
-    }
170
+	}
171 171
 
172
-    public static function fill_field( &$values, $field, $form_id, $new_key = '' ) {
173
-        global $wpdb;
172
+	public static function fill_field( &$values, $field, $form_id, $new_key = '' ) {
173
+		global $wpdb;
174 174
 
175 175
 		$values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' );
176
-        $values['form_id'] = $form_id;
177
-        $values['options'] = maybe_serialize($field->options);
178
-        $values['default_value'] = maybe_serialize($field->default_value);
179
-
180
-        foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
181
-            $values[ $col ] = $field->{$col};
182
-        }
183
-    }
184
-
185
-    /**
186
-     * @since 2.0
187
-     */
176
+		$values['form_id'] = $form_id;
177
+		$values['options'] = maybe_serialize($field->options);
178
+		$values['default_value'] = maybe_serialize($field->default_value);
179
+
180
+		foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
181
+			$values[ $col ] = $field->{$col};
182
+		}
183
+	}
184
+
185
+	/**
186
+	 * @since 2.0
187
+	 */
188 188
 	public static function get_error_msg( $field, $error ) {
189 189
 		$frm_settings = FrmAppHelper::get_settings();
190 190
 		$default_settings = $frm_settings->default_options();
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
 	public static function get_default_html( $type = 'text' ) {
226 226
 		if ( apply_filters( 'frm_normal_field_type_html', true, $type ) ) {
227 227
 			$input = ( in_array( $type, array( 'radio', 'checkbox', 'data' ) ) ) ? '<div class="frm_opt_container">[input]</div>' : '[input]';
228
-            $for = '';
228
+			$for = '';
229 229
 			if ( ! in_array( $type, array( 'radio', 'checkbox', 'data', 'scale' ) ) ) {
230
-                $for = 'for="field_[key]"';
231
-            }
230
+				$for = 'for="field_[key]"';
231
+			}
232 232
 
233
-            $default_html = <<<DEFAULT_HTML
233
+			$default_html = <<<DEFAULT_HTML
234 234
 <div id="frm_field_[id]_container" class="frm_form_field form-field [required_class][error_class]">
235 235
     <label $for class="frm_primary_label">[field_name]
236 236
         <span class="frm_required">[required_label]</span>
@@ -240,60 +240,60 @@  discard block
 block discarded – undo
240 240
     [if error]<div class="frm_error">[error]</div>[/if error]
241 241
 </div>
242 242
 DEFAULT_HTML;
243
-        } else {
243
+		} else {
244 244
 			$default_html = apply_filters('frm_other_custom_html', '', $type);
245
-        }
245
+		}
246 246
 
247
-        return apply_filters('frm_custom_html', $default_html, $type);
248
-    }
247
+		return apply_filters('frm_custom_html', $default_html, $type);
248
+	}
249 249
 
250 250
 	public static function replace_shortcodes( $html, $field, $errors = array(), $form = false, $args = array() ) {
251
-        $html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form);
251
+		$html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form);
252 252
 
253
-        $defaults = array(
253
+		$defaults = array(
254 254
 			'field_name'    => 'item_meta[' . $field['id'] . ']',
255 255
 			'field_id'      => $field['id'],
256
-            'field_plus_id' => '',
257
-            'section_id'    => '',
258
-        );
259
-        $args = wp_parse_args($args, $defaults);
260
-        $field_name = $args['field_name'];
261
-        $field_id = $args['field_id'];
262
-        $html_id = self::get_html_id($field, $args['field_plus_id']);
256
+			'field_plus_id' => '',
257
+			'section_id'    => '',
258
+		);
259
+		$args = wp_parse_args($args, $defaults);
260
+		$field_name = $args['field_name'];
261
+		$field_id = $args['field_id'];
262
+		$html_id = self::get_html_id($field, $args['field_plus_id']);
263 263
 
264
-        if ( FrmField::is_multiple_select($field) ) {
265
-            $field_name .= '[]';
266
-        }
264
+		if ( FrmField::is_multiple_select($field) ) {
265
+			$field_name .= '[]';
266
+		}
267 267
 
268
-        //replace [id]
269
-        $html = str_replace('[id]', $field_id, $html);
268
+		//replace [id]
269
+		$html = str_replace('[id]', $field_id, $html);
270 270
 
271
-        // Remove the for attribute for captcha
272
-        if ( $field['type'] == 'captcha' ) {
273
-            $html = str_replace(' for="field_[key]"', '', $html);
274
-        }
271
+		// Remove the for attribute for captcha
272
+		if ( $field['type'] == 'captcha' ) {
273
+			$html = str_replace(' for="field_[key]"', '', $html);
274
+		}
275 275
 
276
-        // set the label for
277
-        $html = str_replace('field_[key]', $html_id, $html);
276
+		// set the label for
277
+		$html = str_replace('field_[key]', $html_id, $html);
278 278
 
279
-        //replace [key]
280
-        $html = str_replace('[key]', $field['field_key'], $html);
279
+		//replace [key]
280
+		$html = str_replace('[key]', $field['field_key'], $html);
281 281
 
282
-        //replace [description] and [required_label] and [error]
282
+		//replace [description] and [required_label] and [error]
283 283
 		$required = FrmField::is_required( $field ) ? $field['required_indicator'] : '';
284
-        if ( ! is_array( $errors ) ) {
285
-            $errors = array();
286
-        }
284
+		if ( ! is_array( $errors ) ) {
285
+			$errors = array();
286
+		}
287 287
 		$error = isset( $errors[ 'field' . $field_id ] ) ? $errors[ 'field' . $field_id ] : false;
288 288
 
289
-        //If field type is section heading, add class so a bottom margin can be added to either the h3 or description
290
-        if ( $field['type'] == 'divider' ) {
291
-            if ( FrmField::is_option_true( $field, 'description' ) ) {
292
-                $html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html );
293
-            } else {
294
-                $html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html);
295
-            }
296
-        }
289
+		//If field type is section heading, add class so a bottom margin can be added to either the h3 or description
290
+		if ( $field['type'] == 'divider' ) {
291
+			if ( FrmField::is_option_true( $field, 'description' ) ) {
292
+				$html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html );
293
+			} else {
294
+				$html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html);
295
+			}
296
+		}
297 297
 
298 298
 		$codes = array(
299 299
 			'description'    => $field['description'],
@@ -301,25 +301,25 @@  discard block
 block discarded – undo
301 301
 			'error'          => $error,
302 302
 		);
303 303
 		foreach ( $codes as $code => $value ) {
304
-            self::remove_inline_conditions( ( $value && $value != '' ), $code, $value, $html );
305
-        }
304
+			self::remove_inline_conditions( ( $value && $value != '' ), $code, $value, $html );
305
+		}
306 306
 
307
-        //replace [required_class]
307
+		//replace [required_class]
308 308
 		$required_class = FrmField::is_required( $field ) ? ' frm_required_field' : '';
309
-        $html = str_replace('[required_class]', $required_class, $html);
309
+		$html = str_replace('[required_class]', $required_class, $html);
310 310
 
311
-        //replace [label_position]
311
+		//replace [label_position]
312 312
 		$field['label'] = self::label_position( $field['label'], $field, $form );
313 313
 		self::add_class_to_label( $field, $html );
314 314
 
315
-        //replace [field_name]
316
-        $html = str_replace('[field_name]', $field['name'], $html);
315
+		//replace [field_name]
316
+		$html = str_replace('[field_name]', $field['name'], $html);
317 317
 
318 318
 		self::add_field_div_classes( $field_id, $field, $errors, $html );
319 319
 
320
-        //replace [entry_key]
321
-        $entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' );
322
-        $html = str_replace('[entry_key]', $entry_key, $html);
320
+		//replace [entry_key]
321
+		$entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' );
322
+		$html = str_replace('[entry_key]', $entry_key, $html);
323 323
 
324 324
 		if ( $form ) {
325 325
 			$form = (array) $form;
@@ -333,51 +333,51 @@  discard block
 block discarded – undo
333 333
 
334 334
 		self::process_wp_shortcodes( $html );
335 335
 
336
-        //replace [input]
337
-        preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER);
338
-        global $frm_vars;
339
-        $frm_settings = FrmAppHelper::get_settings();
336
+		//replace [input]
337
+		preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER);
338
+		global $frm_vars;
339
+		$frm_settings = FrmAppHelper::get_settings();
340 340
 
341
-        foreach ( $shortcodes[0] as $short_key => $tag ) {
342
-            $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
341
+		foreach ( $shortcodes[0] as $short_key => $tag ) {
342
+			$atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
343 343
 			$tag = self::get_shortcode_tag( $shortcodes, $short_key, array(
344 344
 				'conditional' => false,
345 345
 				'conditional_check' => false,
346 346
 			) );
347 347
 
348
-            $replace_with = '';
348
+			$replace_with = '';
349 349
 
350
-            if ( $tag == 'input' ) {
351
-                if ( isset($atts['opt']) ) {
352
-                    $atts['opt']--;
353
-                }
350
+			if ( $tag == 'input' ) {
351
+				if ( isset($atts['opt']) ) {
352
+					$atts['opt']--;
353
+				}
354 354
 
355
-                $field['input_class'] = isset($atts['class']) ? $atts['class'] : '';
356
-                if ( isset($atts['class']) ) {
357
-                    unset($atts['class']);
358
-                }
355
+				$field['input_class'] = isset($atts['class']) ? $atts['class'] : '';
356
+				if ( isset($atts['class']) ) {
357
+					unset($atts['class']);
358
+				}
359 359
 
360
-                $field['shortcodes'] = $atts;
361
-                ob_start();
360
+				$field['shortcodes'] = $atts;
361
+				ob_start();
362 362
 				include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/input.php' );
363
-                $replace_with = ob_get_contents();
364
-                ob_end_clean();
365
-            } else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) {
366
-                $replace_with = FrmProEntriesController::entry_delete_link($atts);
367
-            }
363
+				$replace_with = ob_get_contents();
364
+				ob_end_clean();
365
+			} else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) {
366
+				$replace_with = FrmProEntriesController::entry_delete_link($atts);
367
+			}
368 368
 
369
-            $html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html );
370
-        }
369
+			$html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html );
370
+		}
371 371
 
372
-        $html .= "\n";
372
+		$html .= "\n";
373 373
 
374
-        //Return html if conf_field to prevent loop
375
-        if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) {
376
-            return $html;
377
-        }
374
+		//Return html if conf_field to prevent loop
375
+		if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) {
376
+			return $html;
377
+		}
378 378
 
379
-        //If field is in repeating section
380
-        if ( $args['section_id'] ) {
379
+		//If field is in repeating section
380
+		if ( $args['section_id'] ) {
381 381
 			$html = apply_filters( 'frm_replace_shortcodes', $html, $field, array(
382 382
 				'errors'     => $errors,
383 383
 				'form'       => $form,
@@ -386,17 +386,17 @@  discard block
 block discarded – undo
386 386
 				'field_plus_id' => $args['field_plus_id'],
387 387
 				'section_id' => $args['section_id'],
388 388
 			) );
389
-        } else {
389
+		} else {
390 390
 			$html = apply_filters( 'frm_replace_shortcodes', $html, $field, array(
391 391
 				'errors' => $errors,
392 392
 				'form' => $form,
393 393
 			) );
394
-        }
394
+		}
395 395
 
396 396
 		self::remove_collapse_shortcode( $html );
397 397
 
398
-        return $html;
399
-    }
398
+		return $html;
399
+	}
400 400
 
401 401
 	/**
402 402
 	 * Get the class to use for the label position
@@ -507,16 +507,16 @@  discard block
 block discarded – undo
507 507
 		return $classes;
508 508
 	}
509 509
 
510
-    public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) {
511
-        if ( $no_vars ) {
510
+	public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) {
511
+		if ( $no_vars ) {
512 512
 			$html = str_replace( '[if ' . $code . ']', '', $html );
513 513
 			$html = str_replace( '[/if ' . $code . ']', '', $html );
514
-        } else {
514
+		} else {
515 515
 			$html = preg_replace( '/(\[if\s+' . $code . '\])(.*?)(\[\/if\s+' . $code . '\])/mis', '', $html );
516
-        }
516
+		}
517 517
 
518 518
 		$html = str_replace( '[' . $code . ']', $replace_with, $html );
519
-    }
519
+	}
520 520
 
521 521
 	public static function get_shortcode_tag( $shortcodes, $short_key, $args ) {
522 522
 		$args = wp_parse_args( $args, array(
@@ -524,33 +524,33 @@  discard block
 block discarded – undo
524 524
 			'conditional_check' => false,
525 525
 			'foreach' => false,
526 526
 		) );
527
-        if ( ( $args['conditional'] || $args['foreach'] ) && ! $args['conditional_check'] ) {
528
-            $args['conditional_check'] = true;
529
-        }
530
-
531
-        $prefix = '';
532
-        if ( $args['conditional_check'] ) {
533
-            if ( $args['conditional'] ) {
534
-                $prefix = 'if ';
535
-            } else if ( $args['foreach'] ) {
536
-                $prefix = 'foreach ';
537
-            }
538
-        }
539
-
540
-        $with_tags = $args['conditional_check'] ? 3 : 2;
541
-        if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
542
-            $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
543
-            $tag = str_replace(']', '', $tag);
544
-            $tags = explode(' ', $tag);
545
-            if ( is_array($tags) ) {
546
-                $tag = $tags[0];
547
-            }
548
-        } else {
549
-            $tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
550
-        }
551
-
552
-        return $tag;
553
-    }
527
+		if ( ( $args['conditional'] || $args['foreach'] ) && ! $args['conditional_check'] ) {
528
+			$args['conditional_check'] = true;
529
+		}
530
+
531
+		$prefix = '';
532
+		if ( $args['conditional_check'] ) {
533
+			if ( $args['conditional'] ) {
534
+				$prefix = 'if ';
535
+			} else if ( $args['foreach'] ) {
536
+				$prefix = 'foreach ';
537
+			}
538
+		}
539
+
540
+		$with_tags = $args['conditional_check'] ? 3 : 2;
541
+		if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
542
+			$tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
543
+			$tag = str_replace(']', '', $tag);
544
+			$tags = explode(' ', $tag);
545
+			if ( is_array($tags) ) {
546
+				$tag = $tags[0];
547
+			}
548
+		} else {
549
+			$tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
550
+		}
551
+
552
+		return $tag;
553
+	}
554 554
 
555 555
 	/**
556 556
 	 * Remove [collapse_this] if it's still included after all processing
@@ -588,8 +588,8 @@  discard block
 block discarded – undo
588 588
 		}
589 589
 		$api_js_url = apply_filters( 'frm_recaptcha_js_url', $api_js_url );
590 590
 
591
-        wp_register_script( 'recaptcha-api', $api_js_url, array( 'formidable' ), true );
592
-        wp_enqueue_script( 'recaptcha-api' );
591
+		wp_register_script( 'recaptcha-api', $api_js_url, array( 'formidable' ), true );
592
+		wp_enqueue_script( 'recaptcha-api' );
593 593
 
594 594
 		// for reverse compatibility
595 595
 		$field['captcha_size'] = ( $field['captcha_size'] == 'default' ) ? 'normal' : $field['captcha_size'];
@@ -598,68 +598,68 @@  discard block
 block discarded – undo
598 598
 ?>
599 599
 <div id="field_<?php echo esc_attr( $field['field_key'] ) ?>" class="<?php echo esc_attr( $class_prefix ) ?>g-recaptcha" data-sitekey="<?php echo esc_attr( $frm_settings->pubkey ) ?>" data-size="<?php echo esc_attr( $field['captcha_size'] ) ?>" data-theme="<?php echo esc_attr( $field['captcha_theme'] ) ?>" <?php echo ( 'invisible' === $field['captcha_size'] && ! $allow_mutiple ) ? 'data-callback="frmAfterRecaptcha"' : ''; ?>></div>
600 600
 <?php
601
-    }
601
+	}
602 602
 
603 603
 	public static function show_single_option( $field ) {
604
-        $field_name = $field['name'];
605
-        $html_id = self::get_html_id($field);
606
-        foreach ( $field['options'] as $opt_key => $opt ) {
607
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
608
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
604
+		$field_name = $field['name'];
605
+		$html_id = self::get_html_id($field);
606
+		foreach ( $field['options'] as $opt_key => $opt ) {
607
+			$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
608
+			$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
609 609
 
610
-            // If this is an "Other" option, get the HTML for it
610
+			// If this is an "Other" option, get the HTML for it
611 611
 			if ( self::is_other_opt( $opt_key ) ) {
612
-                // Get string for Other text field, if needed
612
+				// Get string for Other text field, if needed
613 613
 				$other_val = self::get_other_val( compact( 'opt_key', 'field' ) );
614 614
 				require( FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/other-option.php' );
615
-            } else {
615
+			} else {
616 616
 				require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' );
617
-            }
618
-        }
619
-    }
617
+			}
618
+		}
619
+	}
620 620
 
621 621
 	public static function get_term_link( $tax_id ) {
622
-        $tax = get_taxonomy($tax_id);
623
-        if ( ! $tax ) {
624
-            return;
625
-        }
622
+		$tax = get_taxonomy($tax_id);
623
+		if ( ! $tax ) {
624
+			return;
625
+		}
626 626
 
627
-        $link = sprintf(
628
-            __( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
627
+		$link = sprintf(
628
+			__( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
629 629
 			'<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>'
630
-        );
631
-        unset($tax);
630
+		);
631
+		unset($tax);
632 632
 
633
-        return $link;
634
-    }
633
+		return $link;
634
+	}
635 635
 
636 636
 	public static function value_meets_condition( $observed_value, $cond, $hide_opt ) {
637 637
 		$hide_opt = self::get_value_for_comparision( $hide_opt );
638 638
 		$observed_value = self::get_value_for_comparision( $observed_value );
639 639
 
640
-        if ( is_array($observed_value) ) {
641
-            return self::array_value_condition($observed_value, $cond, $hide_opt);
642
-        }
643
-
644
-        $m = false;
645
-        if ( $cond == '==' ) {
646
-            $m = $observed_value == $hide_opt;
647
-        } else if ( $cond == '!=' ) {
648
-            $m = $observed_value != $hide_opt;
649
-        } else if ( $cond == '>' ) {
650
-            $m = $observed_value > $hide_opt;
651
-        } else if ( $cond == '<' ) {
652
-            $m = $observed_value < $hide_opt;
653
-        } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
654
-            $m = stripos($observed_value, $hide_opt);
655
-            if ( $cond == 'not LIKE' ) {
656
-                $m = ( $m === false ) ? true : false;
657
-            } else {
658
-                $m = ( $m === false ) ? false : true;
659
-            }
660
-        }
661
-        return $m;
662
-    }
640
+		if ( is_array($observed_value) ) {
641
+			return self::array_value_condition($observed_value, $cond, $hide_opt);
642
+		}
643
+
644
+		$m = false;
645
+		if ( $cond == '==' ) {
646
+			$m = $observed_value == $hide_opt;
647
+		} else if ( $cond == '!=' ) {
648
+			$m = $observed_value != $hide_opt;
649
+		} else if ( $cond == '>' ) {
650
+			$m = $observed_value > $hide_opt;
651
+		} else if ( $cond == '<' ) {
652
+			$m = $observed_value < $hide_opt;
653
+		} else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
654
+			$m = stripos($observed_value, $hide_opt);
655
+			if ( $cond == 'not LIKE' ) {
656
+				$m = ( $m === false ) ? true : false;
657
+			} else {
658
+				$m = ( $m === false ) ? false : true;
659
+			}
660
+		}
661
+		return $m;
662
+	}
663 663
 
664 664
 	/**
665 665
 	 * Trim and sanitize the values
@@ -675,84 +675,84 @@  discard block
 block discarded – undo
675 675
 	}
676 676
 
677 677
 	public static function array_value_condition( $observed_value, $cond, $hide_opt ) {
678
-        $m = false;
679
-        if ( $cond == '==' ) {
680
-            if ( is_array($hide_opt) ) {
681
-                $m = array_intersect($hide_opt, $observed_value);
682
-                $m = empty($m) ? false : true;
683
-            } else {
684
-                $m = in_array($hide_opt, $observed_value);
685
-            }
686
-        } else if ( $cond == '!=' ) {
687
-            $m = ! in_array($hide_opt, $observed_value);
688
-        } else if ( $cond == '>' ) {
689
-            $min = min($observed_value);
690
-            $m = $min > $hide_opt;
691
-        } else if ( $cond == '<' ) {
692
-            $max = max($observed_value);
693
-            $m = $max < $hide_opt;
694
-        } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
695
-            foreach ( $observed_value as $ob ) {
696
-                $m = strpos($ob, $hide_opt);
697
-                if ( $m !== false ) {
698
-                    $m = true;
699
-                    break;
700
-                }
701
-            }
702
-
703
-            if ( $cond == 'not LIKE' ) {
704
-                $m = ( $m === false ) ? true : false;
705
-            }
706
-        }
707
-
708
-        return $m;
709
-    }
710
-
711
-    /**
712
-     * Replace a few basic shortcodes and field ids
713
-     * @since 2.0
714
-     * @return string
715
-     */
678
+		$m = false;
679
+		if ( $cond == '==' ) {
680
+			if ( is_array($hide_opt) ) {
681
+				$m = array_intersect($hide_opt, $observed_value);
682
+				$m = empty($m) ? false : true;
683
+			} else {
684
+				$m = in_array($hide_opt, $observed_value);
685
+			}
686
+		} else if ( $cond == '!=' ) {
687
+			$m = ! in_array($hide_opt, $observed_value);
688
+		} else if ( $cond == '>' ) {
689
+			$min = min($observed_value);
690
+			$m = $min > $hide_opt;
691
+		} else if ( $cond == '<' ) {
692
+			$max = max($observed_value);
693
+			$m = $max < $hide_opt;
694
+		} else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
695
+			foreach ( $observed_value as $ob ) {
696
+				$m = strpos($ob, $hide_opt);
697
+				if ( $m !== false ) {
698
+					$m = true;
699
+					break;
700
+				}
701
+			}
702
+
703
+			if ( $cond == 'not LIKE' ) {
704
+				$m = ( $m === false ) ? true : false;
705
+			}
706
+		}
707
+
708
+		return $m;
709
+	}
710
+
711
+	/**
712
+	 * Replace a few basic shortcodes and field ids
713
+	 * @since 2.0
714
+	 * @return string
715
+	 */
716 716
 	public static function basic_replace_shortcodes( $value, $form, $entry ) {
717
-        if ( strpos($value, '[sitename]') !== false ) {
718
-            $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
719
-            $value = str_replace('[sitename]', $new_value, $value);
720
-        }
717
+		if ( strpos($value, '[sitename]') !== false ) {
718
+			$new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
719
+			$value = str_replace('[sitename]', $new_value, $value);
720
+		}
721 721
 
722
-        $value = apply_filters('frm_content', $value, $form, $entry);
723
-        $value = do_shortcode($value);
722
+		$value = apply_filters('frm_content', $value, $form, $entry);
723
+		$value = do_shortcode($value);
724 724
 
725
-        return $value;
726
-    }
725
+		return $value;
726
+	}
727 727
 
728 728
 	public static function get_shortcodes( $content, $form_id ) {
729
-        if ( FrmAppHelper::pro_is_installed() ) {
730
-            return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
731
-        }
729
+		if ( FrmAppHelper::pro_is_installed() ) {
730
+			return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
731
+		}
732 732
 
733 733
 		$fields = FrmField::getAll( array(
734 734
 			'fi.form_id'  => (int) $form_id,
735 735
 			'fi.type not' => FrmField::no_save_fields(),
736 736
 		) );
737 737
 
738
-        $tagregexp = self::allowed_shortcodes($fields);
738
+		$tagregexp = self::allowed_shortcodes($fields);
739 739
 
740
-        preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
740
+		preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
741 741
 
742
-        return $matches;
743
-    }
742
+		return $matches;
743
+	}
744 744
 
745 745
 	public static function allowed_shortcodes( $fields = array() ) {
746 746
 		$tagregexp = array( 'editlink', 'id', 'key', 'ip', 'siteurl', 'sitename', 'admin_email', 'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by', 'parent[-|_]id' );
747 747
 
748
-        foreach ( $fields as $field ) {
749
-            $tagregexp[] = $field->id;
750
-            $tagregexp[] = $field->field_key;
751
-        }
748
+		foreach ( $fields as $field ) {
749
+			$tagregexp[] = $field->id;
750
+			$tagregexp[] = $field->field_key;
751
+		}
752 752
 
753
-        $tagregexp = implode('|', $tagregexp);
754
-        return $tagregexp;
755
-    }
753
+		$tagregexp = implode('|', $tagregexp);
754
+		return $tagregexp;
755
+	}
756 756
 
757 757
 	public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
758 758
 		$shortcode_values = array(
@@ -761,86 +761,86 @@  discard block
 block discarded – undo
761 761
 			'ip'  => $entry->ip,
762 762
 		);
763 763
 
764
-        foreach ( $shortcodes[0] as $short_key => $tag ) {
764
+		foreach ( $shortcodes[0] as $short_key => $tag ) {
765 765
 			if ( empty( $tag ) ) {
766 766
 				continue;
767 767
 			}
768 768
 
769
-            $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] );
769
+			$atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] );
770 770
 
771
-            if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
771
+			if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
772 772
 				$tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] );
773
-                $tags = explode(' ', $tag);
774
-                if ( is_array($tags) ) {
775
-                    $tag = $tags[0];
776
-                }
777
-            } else {
778
-                $tag = $shortcodes[2][ $short_key ];
779
-            }
780
-
781
-            switch ( $tag ) {
782
-                case 'id':
783
-                case 'key':
784
-                case 'ip':
785
-                    $replace_with = $shortcode_values[ $tag ];
773
+				$tags = explode(' ', $tag);
774
+				if ( is_array($tags) ) {
775
+					$tag = $tags[0];
776
+				}
777
+			} else {
778
+				$tag = $shortcodes[2][ $short_key ];
779
+			}
780
+
781
+			switch ( $tag ) {
782
+				case 'id':
783
+				case 'key':
784
+				case 'ip':
785
+					$replace_with = $shortcode_values[ $tag ];
786 786
 					break;
787 787
 
788
-                case 'user_agent':
789
-                case 'user-agent':
790
-                    $entry->description = maybe_unserialize($entry->description);
788
+				case 'user_agent':
789
+				case 'user-agent':
790
+					$entry->description = maybe_unserialize($entry->description);
791 791
 					$replace_with = FrmEntriesHelper::get_browser( $entry->description['browser'] );
792 792
 					break;
793 793
 
794
-                case 'created_at':
795
-                case 'created-at':
796
-                case 'updated_at':
797
-                case 'updated-at':
798
-                    if ( isset($atts['format']) ) {
799
-                        $time_format = ' ';
800
-                    } else {
801
-                        $atts['format'] = get_option('date_format');
802
-                        $time_format = '';
803
-                    }
804
-
805
-                    $this_tag = str_replace('-', '_', $tag);
806
-                    $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
807
-                    unset($this_tag);
794
+				case 'created_at':
795
+				case 'created-at':
796
+				case 'updated_at':
797
+				case 'updated-at':
798
+					if ( isset($atts['format']) ) {
799
+						$time_format = ' ';
800
+					} else {
801
+						$atts['format'] = get_option('date_format');
802
+						$time_format = '';
803
+					}
804
+
805
+					$this_tag = str_replace('-', '_', $tag);
806
+					$replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
807
+					unset($this_tag);
808 808
 					break;
809 809
 
810
-                case 'created_by':
811
-                case 'created-by':
812
-                case 'updated_by':
813
-                case 'updated-by':
814
-                    $this_tag = str_replace('-', '_', $tag);
810
+				case 'created_by':
811
+				case 'created-by':
812
+				case 'updated_by':
813
+				case 'updated-by':
814
+					$this_tag = str_replace('-', '_', $tag);
815 815
 					$replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts );
816
-                    unset($this_tag);
816
+					unset($this_tag);
817 817
 					break;
818 818
 
819
-                case 'admin_email':
820
-                case 'siteurl':
821
-                case 'frmurl':
822
-                case 'sitename':
823
-                case 'get':
824
-                    $replace_with = self::dynamic_default_values( $tag, $atts );
819
+				case 'admin_email':
820
+				case 'siteurl':
821
+				case 'frmurl':
822
+				case 'sitename':
823
+				case 'get':
824
+					$replace_with = self::dynamic_default_values( $tag, $atts );
825 825
 					break;
826 826
 
827
-                default:
828
-                    $field = FrmField::getOne( $tag );
829
-                    if ( ! $field ) {
830
-                        break;
831
-                    }
827
+				default:
828
+					$field = FrmField::getOne( $tag );
829
+					if ( ! $field ) {
830
+						break;
831
+					}
832 832
 
833
-                    $sep = isset($atts['sep']) ? $atts['sep'] : ', ';
833
+					$sep = isset($atts['sep']) ? $atts['sep'] : ', ';
834 834
 
835
-                    $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
835
+					$replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
836 836
 
837
-                    $atts['entry_id'] = $entry->id;
838
-                    $atts['entry_key'] = $entry->item_key;
837
+					$atts['entry_id'] = $entry->id;
838
+					$atts['entry_key'] = $entry->item_key;
839 839
 
840
-                    if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
841
-                        $replace_with = $field->name;
842
-                    } else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
843
-                        $replace_with = $field->description;
840
+					if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
841
+						$replace_with = $field->name;
842
+					} else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
843
+						$replace_with = $field->description;
844 844
 					} else {
845 845
 						$string_value = $replace_with;
846 846
 						if ( is_array( $replace_with ) ) {
@@ -854,81 +854,81 @@  discard block
 block discarded – undo
854 854
 						}
855 855
 					}
856 856
 
857
-                    unset($field);
858
-            }
857
+					unset($field);
858
+			}
859 859
 
860
-            if ( isset($replace_with) ) {
861
-                $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
862
-            }
860
+			if ( isset($replace_with) ) {
861
+				$content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
862
+			}
863 863
 
864
-            unset($atts, $conditional, $replace_with);
864
+			unset($atts, $conditional, $replace_with);
865 865
 		}
866 866
 
867 867
 		return $content;
868
-    }
869
-
870
-    /**
871
-     * Get the value to replace a few standard shortcodes
872
-     *
873
-     * @since 2.0
874
-     * @return string
875
-     */
876
-    public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) {
877
-        $new_value = '';
878
-        switch ( $tag ) {
879
-            case 'admin_email':
880
-                $new_value = get_option('admin_email');
881
-                break;
882
-            case 'siteurl':
883
-                $new_value = FrmAppHelper::site_url();
884
-                break;
885
-            case 'frmurl':
886
-                $new_value = FrmAppHelper::plugin_url();
887
-                break;
888
-            case 'sitename':
889
-                $new_value = FrmAppHelper::site_name();
890
-                break;
891
-            case 'get':
892
-                $new_value = self::process_get_shortcode( $atts, $return_array );
893
-                break;
894
-        }
895
-
896
-        return $new_value;
897
-    }
898
-
899
-    /**
900
-     * Process the [get] shortcode
901
-     *
902
-     * @since 2.0
903
-     * @return string|array
904
-     */
905
-    public static function process_get_shortcode( $atts, $return_array = false ) {
906
-        if ( ! isset($atts['param']) ) {
907
-            return '';
908
-        }
909
-
910
-        if ( strpos($atts['param'], '&#91;') ) {
911
-            $atts['param'] = str_replace('&#91;', '[', $atts['param']);
912
-            $atts['param'] = str_replace('&#93;', ']', $atts['param']);
913
-        }
868
+	}
869
+
870
+	/**
871
+	 * Get the value to replace a few standard shortcodes
872
+	 *
873
+	 * @since 2.0
874
+	 * @return string
875
+	 */
876
+	public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) {
877
+		$new_value = '';
878
+		switch ( $tag ) {
879
+			case 'admin_email':
880
+				$new_value = get_option('admin_email');
881
+				break;
882
+			case 'siteurl':
883
+				$new_value = FrmAppHelper::site_url();
884
+				break;
885
+			case 'frmurl':
886
+				$new_value = FrmAppHelper::plugin_url();
887
+				break;
888
+			case 'sitename':
889
+				$new_value = FrmAppHelper::site_name();
890
+				break;
891
+			case 'get':
892
+				$new_value = self::process_get_shortcode( $atts, $return_array );
893
+				break;
894
+		}
895
+
896
+		return $new_value;
897
+	}
898
+
899
+	/**
900
+	 * Process the [get] shortcode
901
+	 *
902
+	 * @since 2.0
903
+	 * @return string|array
904
+	 */
905
+	public static function process_get_shortcode( $atts, $return_array = false ) {
906
+		if ( ! isset($atts['param']) ) {
907
+			return '';
908
+		}
909
+
910
+		if ( strpos($atts['param'], '&#91;') ) {
911
+			$atts['param'] = str_replace('&#91;', '[', $atts['param']);
912
+			$atts['param'] = str_replace('&#93;', ']', $atts['param']);
913
+		}
914 914
 
915 915
 		$new_value = FrmAppHelper::get_param( $atts['param'], '', 'get', 'sanitize_text_field' );
916
-        $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
916
+		$new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
917 917
 
918
-        if ( $new_value == '' ) {
919
-            if ( ! isset($atts['prev_val']) ) {
920
-                $atts['prev_val'] = '';
921
-            }
918
+		if ( $new_value == '' ) {
919
+			if ( ! isset($atts['prev_val']) ) {
920
+				$atts['prev_val'] = '';
921
+			}
922 922
 
923
-            $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
924
-        }
923
+			$new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
924
+		}
925 925
 
926
-        if ( is_array($new_value) && ! $return_array ) {
927
-            $new_value = implode(', ', $new_value);
928
-        }
926
+		if ( is_array($new_value) && ! $return_array ) {
927
+			$new_value = implode(', ', $new_value);
928
+		}
929 929
 
930
-        return $new_value;
931
-    }
930
+		return $new_value;
931
+	}
932 932
 
933 933
 	public static function get_display_value( $replace_with, $field, $atts = array() ) {
934 934
 		$sep = isset( $atts['sep'] ) ? $atts['sep'] : ', ';
@@ -936,14 +936,14 @@  discard block
 block discarded – undo
936 936
 		$replace_with = apply_filters( 'frm_get_' . $field->type . '_display_value', $replace_with, $field, $atts );
937 937
 		$replace_with = apply_filters( 'frm_get_display_value', $replace_with, $field, $atts );
938 938
 
939
-        if ( $field->type == 'textarea' || $field->type == 'rte' ) {
940
-            $autop = isset($atts['wpautop']) ? $atts['wpautop'] : true;
941
-            if ( apply_filters('frm_use_wpautop', $autop) ) {
942
-                if ( is_array($replace_with) ) {
943
-                    $replace_with = implode("\n", $replace_with);
944
-                }
945
-                $replace_with = wpautop($replace_with);
946
-            }
939
+		if ( $field->type == 'textarea' || $field->type == 'rte' ) {
940
+			$autop = isset($atts['wpautop']) ? $atts['wpautop'] : true;
941
+			if ( apply_filters('frm_use_wpautop', $autop) ) {
942
+				if ( is_array($replace_with) ) {
943
+					$replace_with = implode("\n", $replace_with);
944
+				}
945
+				$replace_with = wpautop($replace_with);
946
+			}
947 947
 			unset( $autop );
948 948
 		} else if ( is_array( $replace_with ) ) {
949 949
 			if ( isset( $atts['show'] ) && $atts['show'] && isset( $replace_with[ $atts['show'] ] ) ) {
@@ -963,27 +963,27 @@  discard block
 block discarded – undo
963 963
 
964 964
 		$field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() );
965 965
 
966
-        $field_types = array();
967
-        if ( in_array($type, $single_input) ) {
968
-            self::field_types_for_input( $single_input, $field_selection, $field_types );
969
-        } else if ( in_array($type, $multiple_input) ) {
970
-            self::field_types_for_input( $multiple_input, $field_selection, $field_types );
971
-        } else if ( in_array($type, $other_type) ) {
972
-            self::field_types_for_input( $other_type, $field_selection, $field_types );
966
+		$field_types = array();
967
+		if ( in_array($type, $single_input) ) {
968
+			self::field_types_for_input( $single_input, $field_selection, $field_types );
969
+		} else if ( in_array($type, $multiple_input) ) {
970
+			self::field_types_for_input( $multiple_input, $field_selection, $field_types );
971
+		} else if ( in_array($type, $other_type) ) {
972
+			self::field_types_for_input( $other_type, $field_selection, $field_types );
973 973
 		} else if ( isset( $field_selection[ $type ] ) ) {
974
-            $field_types[ $type ] = $field_selection[ $type ];
975
-        }
974
+			$field_types[ $type ] = $field_selection[ $type ];
975
+		}
976 976
 
977 977
 		$field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) );
978
-        return $field_types;
979
-    }
978
+		return $field_types;
979
+	}
980 980
 
981
-    private static function field_types_for_input( $inputs, $fields, &$field_types ) {
982
-        foreach ( $inputs as $input ) {
983
-            $field_types[ $input ] = $fields[ $input ];
984
-            unset($input);
985
-        }
986
-    }
981
+	private static function field_types_for_input( $inputs, $fields, &$field_types ) {
982
+		foreach ( $inputs as $input ) {
983
+			$field_types[ $input ] = $fields[ $input ];
984
+			unset($input);
985
+		}
986
+	}
987 987
 
988 988
 	/**
989 989
 	 * Check if current field option is an "other" option
@@ -997,14 +997,14 @@  discard block
 block discarded – undo
997 997
 		return $opt_key && strpos( $opt_key, 'other_' ) === 0;
998 998
 	}
999 999
 
1000
-    /**
1001
-    * Get value that belongs in "Other" text box
1002
-    *
1003
-    * @since 2.0.6
1004
-    *
1005
-    * @param array $args
1006
-    */
1007
-    public static function get_other_val( $args ) {
1000
+	/**
1001
+	 * Get value that belongs in "Other" text box
1002
+	 *
1003
+	 * @since 2.0.6
1004
+	 *
1005
+	 * @param array $args
1006
+	 */
1007
+	public static function get_other_val( $args ) {
1008 1008
 		$defaults = array(
1009 1009
 			'opt_key' => 0,
1010 1010
 			'field'   => array(),
@@ -1082,20 +1082,20 @@  discard block
 block discarded – undo
1082 1082
 		}
1083 1083
 
1084 1084
 		return $other_val;
1085
-    }
1086
-
1087
-    /**
1088
-    * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
1089
-    * Intended for front-end use
1090
-    *
1091
-    * @since 2.0.6
1092
-    *
1093
-    * @param array $args should include field, opt_key and field name
1094
-    * @param boolean $other_opt
1095
-    * @param string $checked
1096
-    * @return string $other_val
1097
-    */
1098
-    public static function prepare_other_input( $args, &$other_opt, &$checked ) {
1085
+	}
1086
+
1087
+	/**
1088
+	 * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
1089
+	 * Intended for front-end use
1090
+	 *
1091
+	 * @since 2.0.6
1092
+	 *
1093
+	 * @param array $args should include field, opt_key and field name
1094
+	 * @param boolean $other_opt
1095
+	 * @param string $checked
1096
+	 * @return string $other_val
1097
+	 */
1098
+	public static function prepare_other_input( $args, &$other_opt, &$checked ) {
1099 1099
 		//Check if this is an "Other" option
1100 1100
 		if ( ! self::is_other_opt( $args['opt_key'] ) ) {
1101 1101
 			return;
@@ -1111,8 +1111,8 @@  discard block
 block discarded – undo
1111 1111
 			$checked = 'checked="checked" ';
1112 1112
 		}
1113 1113
 
1114
-        return $other_args;
1115
-    }
1114
+		return $other_args;
1115
+	}
1116 1116
 
1117 1117
 	/**
1118 1118
 	 * @param array $args
@@ -1167,8 +1167,8 @@  discard block
 block discarded – undo
1167 1167
 	 * @since 2.0.6
1168 1168
 	 */
1169 1169
 	public static function include_other_input( $args ) {
1170
-        if ( ! $args['other_opt'] ) {
1171
-        	return;
1170
+		if ( ! $args['other_opt'] ) {
1171
+			return;
1172 1172
 		}
1173 1173
 
1174 1174
 		$classes = array( 'frm_other_input' );
@@ -1187,15 +1187,15 @@  discard block
 block discarded – undo
1187 1187
 	}
1188 1188
 
1189 1189
 	/**
1190
-	* Get the HTML id for an "Other" text field
1191
-	* Note: This does not affect fields in repeating sections
1192
-	*
1193
-	* @since 2.0.08
1194
-	* @param string $type - field type
1195
-	* @param string $html_id
1196
-	* @param string|boolean $opt_key
1197
-	* @return string $other_id
1198
-	*/
1190
+	 * Get the HTML id for an "Other" text field
1191
+	 * Note: This does not affect fields in repeating sections
1192
+	 *
1193
+	 * @since 2.0.08
1194
+	 * @param string $type - field type
1195
+	 * @param string $html_id
1196
+	 * @param string|boolean $opt_key
1197
+	 * @return string $other_id
1198
+	 */
1199 1199
 	public static function get_other_field_html_id( $type, $html_id, $opt_key = false ) {
1200 1200
 		$other_id = $html_id;
1201 1201
 
@@ -1259,10 +1259,10 @@  discard block
 block discarded – undo
1259 1259
 	}
1260 1260
 
1261 1261
 	public static function switch_field_ids( $val ) {
1262
-        global $frm_duplicate_ids;
1263
-        $replace = array();
1264
-        $replace_with = array();
1265
-        foreach ( (array) $frm_duplicate_ids as $old => $new ) {
1262
+		global $frm_duplicate_ids;
1263
+		$replace = array();
1264
+		$replace_with = array();
1265
+		foreach ( (array) $frm_duplicate_ids as $old => $new ) {
1266 1266
 			$replace[] = '[if ' . $old . ']';
1267 1267
 			$replace_with[] = '[if ' . $new . ']';
1268 1268
 			$replace[] = '[if ' . $old . ' ';
@@ -1277,19 +1277,19 @@  discard block
 block discarded – undo
1277 1277
 			$replace_with[] = '[' . $new . ']';
1278 1278
 			$replace[] = '[' . $old . ' ';
1279 1279
 			$replace_with[] = '[' . $new . ' ';
1280
-            unset($old, $new);
1281
-        }
1280
+			unset($old, $new);
1281
+		}
1282 1282
 		if ( is_array( $val ) ) {
1283 1283
 			foreach ( $val as $k => $v ) {
1284
-                $val[ $k ] = str_replace( $replace, $replace_with, $v );
1285
-                unset($k, $v);
1286
-            }
1287
-        } else {
1288
-            $val = str_replace($replace, $replace_with, $val);
1289
-        }
1284
+				$val[ $k ] = str_replace( $replace, $replace_with, $v );
1285
+				unset($k, $v);
1286
+			}
1287
+		} else {
1288
+			$val = str_replace($replace, $replace_with, $val);
1289
+		}
1290 1290
 
1291
-        return $val;
1292
-    }
1291
+		return $val;
1292
+	}
1293 1293
 
1294 1294
 	public static function get_us_states() {
1295 1295
 		return apply_filters( 'frm_us_states', array(
@@ -1354,15 +1354,15 @@  discard block
 block discarded – undo
1354 1354
 	public static function get_bulk_prefilled_opts( array &$prepop ) {
1355 1355
 		$prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries();
1356 1356
 
1357
-        $states = FrmFieldsHelper::get_us_states();
1358
-        $state_abv = array_keys($states);
1359
-        sort($state_abv);
1357
+		$states = FrmFieldsHelper::get_us_states();
1358
+		$state_abv = array_keys($states);
1359
+		sort($state_abv);
1360 1360
 		$prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
1361 1361
 
1362
-        $states = array_values($states);
1363
-        sort($states);
1362
+		$states = array_values($states);
1363
+		sort($states);
1364 1364
 		$prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
1365
-        unset($state_abv, $states);
1365
+		unset($state_abv, $states);
1366 1366
 
1367 1367
 		$prepop[ __( 'Age', 'formidable' ) ] = array(
1368 1368
 			__( 'Under 18', 'formidable' ),
@@ -1403,7 +1403,7 @@  discard block
 block discarded – undo
1403 1403
 		);
1404 1404
 
1405 1405
 		$prepop = apply_filters( 'frm_bulk_field_choices', $prepop );
1406
-    }
1406
+	}
1407 1407
 
1408 1408
 	/**
1409 1409
 	 * Display a field value selector
@@ -1413,10 +1413,10 @@  discard block
 block discarded – undo
1413 1413
 	 * @param int $selector_field_id
1414 1414
 	 * @param array $selector_args
1415 1415
 	 */
1416
-    public static function display_field_value_selector( $selector_field_id, $selector_args ) {
1417
-	    $field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args );
1418
-	    $field_value_selector->display();
1419
-    }
1416
+	public static function display_field_value_selector( $selector_field_id, $selector_args ) {
1417
+		$field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args );
1418
+		$field_value_selector->display();
1419
+	}
1420 1420
 
1421 1421
 	/**
1422 1422
 	 * Convert a field object to a flat array
@@ -1469,10 +1469,10 @@  discard block
 block discarded – undo
1469 1469
 		return FrmField::is_required( $field );
1470 1470
 	}
1471 1471
 
1472
-    public static function maybe_get_field( &$field ) {
1472
+	public static function maybe_get_field( &$field ) {
1473 1473
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmField::maybe_get_field' );
1474 1474
 		FrmField::maybe_get_field( $field );
1475
-    }
1475
+	}
1476 1476
 
1477 1477
 	public static function dropdown_categories( $args ) {
1478 1478
 		_deprecated_function( __FUNCTION__, '2.02.07', 'FrmProPost::get_category_dropdown' );
Please login to merge, or discard this patch.
Spacing   +157 added lines, -157 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
 
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
 
8 8
 	public static function setup_new_vars( $type = '', $form_id = '' ) {
9 9
 
10
-        if ( strpos($type, '|') ) {
11
-            list($type, $setting) = explode('|', $type);
10
+        if ( strpos( $type, '|' ) ) {
11
+            list( $type, $setting ) = explode( '|', $type );
12 12
         }
13 13
 
14
-        $defaults = self::get_default_field_opts($type, $form_id);
15
-        $defaults['field_options']['custom_html'] = self::get_default_html($type);
14
+        $defaults = self::get_default_field_opts( $type, $form_id );
15
+        $defaults['field_options']['custom_html'] = self::get_default_html( $type );
16 16
 
17 17
         $values = array();
18 18
 
@@ -20,20 +20,20 @@  discard block
 block discarded – undo
20 20
             if ( $var == 'field_options' ) {
21 21
                 $values['field_options'] = array();
22 22
                 foreach ( $default as $opt_var => $opt_default ) {
23
-                    $values['field_options'][ $opt_var ] = $opt_default;
24
-                    unset($opt_var, $opt_default);
23
+                    $values['field_options'][$opt_var] = $opt_default;
24
+                    unset( $opt_var, $opt_default );
25 25
                 }
26 26
             } else {
27
-                $values[ $var ] = $default;
27
+                $values[$var] = $default;
28 28
             }
29
-            unset($var, $default);
29
+            unset( $var, $default );
30 30
         }
31 31
 
32 32
         if ( isset( $setting ) && ! empty( $setting ) ) {
33 33
             if ( in_array( $type, array( 'data', 'lookup' ) ) ) {
34 34
                 $values['field_options']['data_type'] = $setting;
35 35
             } else {
36
-                $values['field_options'][ $setting ] = 1;
36
+                $values['field_options'][$setting] = 1;
37 37
             }
38 38
         }
39 39
 
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
         }
59 59
 
60 60
 		$fields = FrmField::field_selection();
61
-        $fields = array_merge($fields, FrmField::pro_field_selection());
61
+        $fields = array_merge( $fields, FrmField::pro_field_selection() );
62 62
 
63
-        if ( isset( $fields[ $type ] ) ) {
64
-            $values['name'] = is_array( $fields[ $type ] ) ? $fields[ $type ]['name'] : $fields[ $type ];
63
+        if ( isset( $fields[$type] ) ) {
64
+            $values['name'] = is_array( $fields[$type] ) ? $fields[$type]['name'] : $fields[$type];
65 65
         }
66 66
 
67
-        unset($fields);
67
+        unset( $fields );
68 68
 
69 69
         return $values;
70 70
     }
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
             $values['form_name'] = '';
94 94
 		} else {
95 95
 			foreach ( $defaults as $var => $default ) {
96
-                $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' );
97
-                unset($var, $default);
96
+                $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' );
97
+                unset( $var, $default );
98 98
             }
99 99
 
100 100
 			$values['form_name'] = $record->form_id ? FrmForm::getName( $record->form_id ) : '';
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         $values['options'] = $record->options;
106 106
         $values['field_options'] = $record->field_options;
107 107
 
108
-        $defaults = self::get_default_field_opts($values['type'], $record, true);
108
+        $defaults = self::get_default_field_opts( $values['type'], $record, true );
109 109
 
110 110
 		if ( $values['type'] == 'captcha' ) {
111 111
             $frm_settings = FrmAppHelper::get_settings();
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
         }
114 114
 
115 115
 		foreach ( $defaults as $opt => $default ) {
116
-            $values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default;
117
-            unset($opt, $default);
116
+            $values[$opt] = isset( $record->field_options[$opt] ) ? $record->field_options[$opt] : $default;
117
+            unset( $opt, $default );
118 118
         }
119 119
 
120 120
 		$values['custom_html'] = ( isset( $record->field_options['custom_html'] ) ) ? $record->field_options['custom_html'] : self::get_default_html( $record->type );
@@ -174,11 +174,11 @@  discard block
 block discarded – undo
174 174
 
175 175
 		$values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' );
176 176
         $values['form_id'] = $form_id;
177
-        $values['options'] = maybe_serialize($field->options);
178
-        $values['default_value'] = maybe_serialize($field->default_value);
177
+        $values['options'] = maybe_serialize( $field->options );
178
+        $values['default_value'] = maybe_serialize( $field->default_value );
179 179
 
180 180
         foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
181
-            $values[ $col ] = $field->{$col};
181
+            $values[$col] = $field->{$col};
182 182
         }
183 183
     }
184 184
 
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
 		$defaults = array(
195 195
 			'unique_msg' => array(
196 196
 				'full' => $default_settings['unique_msg'],
197
-				'part' => sprintf( __('%s must be unique', 'formidable' ), $field_name ),
197
+				'part' => sprintf( __( '%s must be unique', 'formidable' ), $field_name ),
198 198
 			),
199 199
 			'invalid'  => array(
200 200
 				'full' => __( 'This field is invalid', 'formidable' ),
201
-				'part' => sprintf( __('%s is invalid', 'formidable' ), $field_name ),
201
+				'part' => sprintf( __( '%s is invalid', 'formidable' ), $field_name ),
202 202
 			),
203 203
 			'blank'    => array(
204 204
 				'full' => $frm_settings->blank_msg,
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 		);
212 212
 
213 213
 		$msg = FrmField::get_option( $field, $error );
214
-		$msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg;
214
+		$msg = empty( $msg ) ? $defaults[$error]['part'] : $msg;
215 215
 		$msg = do_shortcode( $msg );
216 216
 		return $msg;
217 217
 	}
@@ -241,14 +241,14 @@  discard block
 block discarded – undo
241 241
 </div>
242 242
 DEFAULT_HTML;
243 243
         } else {
244
-			$default_html = apply_filters('frm_other_custom_html', '', $type);
244
+			$default_html = apply_filters( 'frm_other_custom_html', '', $type );
245 245
         }
246 246
 
247
-        return apply_filters('frm_custom_html', $default_html, $type);
247
+        return apply_filters( 'frm_custom_html', $default_html, $type );
248 248
     }
249 249
 
250 250
 	public static function replace_shortcodes( $html, $field, $errors = array(), $form = false, $args = array() ) {
251
-        $html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form);
251
+        $html = apply_filters( 'frm_before_replace_shortcodes', $html, $field, $errors, $form );
252 252
 
253 253
         $defaults = array(
254 254
 			'field_name'    => 'item_meta[' . $field['id'] . ']',
@@ -256,42 +256,42 @@  discard block
 block discarded – undo
256 256
             'field_plus_id' => '',
257 257
             'section_id'    => '',
258 258
         );
259
-        $args = wp_parse_args($args, $defaults);
259
+        $args = wp_parse_args( $args, $defaults );
260 260
         $field_name = $args['field_name'];
261 261
         $field_id = $args['field_id'];
262
-        $html_id = self::get_html_id($field, $args['field_plus_id']);
262
+        $html_id = self::get_html_id( $field, $args['field_plus_id'] );
263 263
 
264
-        if ( FrmField::is_multiple_select($field) ) {
264
+        if ( FrmField::is_multiple_select( $field ) ) {
265 265
             $field_name .= '[]';
266 266
         }
267 267
 
268 268
         //replace [id]
269
-        $html = str_replace('[id]', $field_id, $html);
269
+        $html = str_replace( '[id]', $field_id, $html );
270 270
 
271 271
         // Remove the for attribute for captcha
272 272
         if ( $field['type'] == 'captcha' ) {
273
-            $html = str_replace(' for="field_[key]"', '', $html);
273
+            $html = str_replace( ' for="field_[key]"', '', $html );
274 274
         }
275 275
 
276 276
         // set the label for
277
-        $html = str_replace('field_[key]', $html_id, $html);
277
+        $html = str_replace( 'field_[key]', $html_id, $html );
278 278
 
279 279
         //replace [key]
280
-        $html = str_replace('[key]', $field['field_key'], $html);
280
+        $html = str_replace( '[key]', $field['field_key'], $html );
281 281
 
282 282
         //replace [description] and [required_label] and [error]
283 283
 		$required = FrmField::is_required( $field ) ? $field['required_indicator'] : '';
284 284
         if ( ! is_array( $errors ) ) {
285 285
             $errors = array();
286 286
         }
287
-		$error = isset( $errors[ 'field' . $field_id ] ) ? $errors[ 'field' . $field_id ] : false;
287
+		$error = isset( $errors['field' . $field_id] ) ? $errors['field' . $field_id] : false;
288 288
 
289 289
         //If field type is section heading, add class so a bottom margin can be added to either the h3 or description
290 290
         if ( $field['type'] == 'divider' ) {
291 291
             if ( FrmField::is_option_true( $field, 'description' ) ) {
292 292
                 $html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html );
293 293
             } else {
294
-                $html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html);
294
+                $html = str_replace( '[label_position]', '[label_position] frm_section_spacing', $html );
295 295
             }
296 296
         }
297 297
 
@@ -306,40 +306,40 @@  discard block
 block discarded – undo
306 306
 
307 307
         //replace [required_class]
308 308
 		$required_class = FrmField::is_required( $field ) ? ' frm_required_field' : '';
309
-        $html = str_replace('[required_class]', $required_class, $html);
309
+        $html = str_replace( '[required_class]', $required_class, $html );
310 310
 
311 311
         //replace [label_position]
312 312
 		$field['label'] = self::label_position( $field['label'], $field, $form );
313 313
 		self::add_class_to_label( $field, $html );
314 314
 
315 315
         //replace [field_name]
316
-        $html = str_replace('[field_name]', $field['name'], $html);
316
+        $html = str_replace( '[field_name]', $field['name'], $html );
317 317
 
318 318
 		self::add_field_div_classes( $field_id, $field, $errors, $html );
319 319
 
320 320
         //replace [entry_key]
321 321
         $entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' );
322
-        $html = str_replace('[entry_key]', $entry_key, $html);
322
+        $html = str_replace( '[entry_key]', $entry_key, $html );
323 323
 
324 324
 		if ( $form ) {
325 325
 			$form = (array) $form;
326 326
 
327 327
 			//replace [form_key]
328
-			$html = str_replace('[form_key]', $form['form_key'], $html);
328
+			$html = str_replace( '[form_key]', $form['form_key'], $html );
329 329
 
330 330
 			//replace [form_name]
331
-			$html = str_replace('[form_name]', $form['name'], $html);
331
+			$html = str_replace( '[form_name]', $form['name'], $html );
332 332
 		}
333 333
 
334 334
 		self::process_wp_shortcodes( $html );
335 335
 
336 336
         //replace [input]
337
-        preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER);
337
+        preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER );
338 338
         global $frm_vars;
339 339
         $frm_settings = FrmAppHelper::get_settings();
340 340
 
341 341
         foreach ( $shortcodes[0] as $short_key => $tag ) {
342
-            $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
342
+            $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] );
343 343
 			$tag = self::get_shortcode_tag( $shortcodes, $short_key, array(
344 344
 				'conditional' => false,
345 345
 				'conditional_check' => false,
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
             $replace_with = '';
349 349
 
350 350
             if ( $tag == 'input' ) {
351
-                if ( isset($atts['opt']) ) {
352
-                    $atts['opt']--;
351
+                if ( isset( $atts['opt'] ) ) {
352
+                    $atts['opt'] --;
353 353
                 }
354 354
 
355
-                $field['input_class'] = isset($atts['class']) ? $atts['class'] : '';
356
-                if ( isset($atts['class']) ) {
357
-                    unset($atts['class']);
355
+                $field['input_class'] = isset( $atts['class'] ) ? $atts['class'] : '';
356
+                if ( isset( $atts['class'] ) ) {
357
+                    unset( $atts['class'] );
358 358
                 }
359 359
 
360 360
                 $field['shortcodes'] = $atts;
@@ -363,16 +363,16 @@  discard block
 block discarded – undo
363 363
                 $replace_with = ob_get_contents();
364 364
                 ob_end_clean();
365 365
             } else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) {
366
-                $replace_with = FrmProEntriesController::entry_delete_link($atts);
366
+                $replace_with = FrmProEntriesController::entry_delete_link( $atts );
367 367
             }
368 368
 
369
-            $html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html );
369
+            $html = str_replace( $shortcodes[0][$short_key], $replace_with, $html );
370 370
         }
371 371
 
372 372
         $html .= "\n";
373 373
 
374 374
         //Return html if conf_field to prevent loop
375
-        if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) {
375
+        if ( isset( $field['conf_field'] ) && $field['conf_field'] == 'stop' ) {
376 376
             return $html;
377 377
         }
378 378
 
@@ -488,14 +488,14 @@  discard block
 block discarded – undo
488 488
 	 */
489 489
 	private static function get_field_div_classes( $field_id, $field, $errors, $html ) {
490 490
 		// Add error class
491
-		$classes = isset( $errors[ 'field' . $field_id ] ) ? ' frm_blank_field' : '';
491
+		$classes = isset( $errors['field' . $field_id] ) ? ' frm_blank_field' : '';
492 492
 
493 493
 		// Add label position class
494 494
 		$classes .= ' frm_' . $field['label'] . '_container';
495 495
 
496 496
 		// Add CSS layout classes
497 497
 		if ( ! empty( $field['classes'] ) ) {
498
-			if ( ! strpos( $html, 'frm_form_field ') ) {
498
+			if ( ! strpos( $html, 'frm_form_field ' ) ) {
499 499
 				$classes .= ' frm_form_field';
500 500
 			}
501 501
 			$classes .= ' ' . $field['classes'];
@@ -538,15 +538,15 @@  discard block
 block discarded – undo
538 538
         }
539 539
 
540 540
         $with_tags = $args['conditional_check'] ? 3 : 2;
541
-        if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
542
-            $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
543
-            $tag = str_replace(']', '', $tag);
544
-            $tags = explode(' ', $tag);
545
-            if ( is_array($tags) ) {
541
+        if ( ! empty( $shortcodes[$with_tags][$short_key] ) ) {
542
+            $tag = str_replace( '[' . $prefix, '', $shortcodes[0][$short_key] );
543
+            $tag = str_replace( ']', '', $tag );
544
+            $tags = explode( ' ', $tag );
545
+            if ( is_array( $tags ) ) {
546 546
                 $tag = $tags[0];
547 547
             }
548 548
         } else {
549
-            $tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
549
+            $tag = $shortcodes[$with_tags - 1][$short_key];
550 550
         }
551 551
 
552 552
         return $tag;
@@ -602,10 +602,10 @@  discard block
 block discarded – undo
602 602
 
603 603
 	public static function show_single_option( $field ) {
604 604
         $field_name = $field['name'];
605
-        $html_id = self::get_html_id($field);
605
+        $html_id = self::get_html_id( $field );
606 606
         foreach ( $field['options'] as $opt_key => $opt ) {
607
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
608
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
607
+            $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field );
608
+            $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field );
609 609
 
610 610
             // If this is an "Other" option, get the HTML for it
611 611
 			if ( self::is_other_opt( $opt_key ) ) {
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
     }
620 620
 
621 621
 	public static function get_term_link( $tax_id ) {
622
-        $tax = get_taxonomy($tax_id);
622
+        $tax = get_taxonomy( $tax_id );
623 623
         if ( ! $tax ) {
624 624
             return;
625 625
         }
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
             __( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
629 629
 			'<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>'
630 630
         );
631
-        unset($tax);
631
+        unset( $tax );
632 632
 
633 633
         return $link;
634 634
     }
@@ -637,8 +637,8 @@  discard block
 block discarded – undo
637 637
 		$hide_opt = self::get_value_for_comparision( $hide_opt );
638 638
 		$observed_value = self::get_value_for_comparision( $observed_value );
639 639
 
640
-        if ( is_array($observed_value) ) {
641
-            return self::array_value_condition($observed_value, $cond, $hide_opt);
640
+        if ( is_array( $observed_value ) ) {
641
+            return self::array_value_condition( $observed_value, $cond, $hide_opt );
642 642
         }
643 643
 
644 644
         $m = false;
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
         } else if ( $cond == '<' ) {
652 652
             $m = $observed_value < $hide_opt;
653 653
         } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
654
-            $m = stripos($observed_value, $hide_opt);
654
+            $m = stripos( $observed_value, $hide_opt );
655 655
             if ( $cond == 'not LIKE' ) {
656 656
                 $m = ( $m === false ) ? true : false;
657 657
             } else {
@@ -677,23 +677,23 @@  discard block
 block discarded – undo
677 677
 	public static function array_value_condition( $observed_value, $cond, $hide_opt ) {
678 678
         $m = false;
679 679
         if ( $cond == '==' ) {
680
-            if ( is_array($hide_opt) ) {
681
-                $m = array_intersect($hide_opt, $observed_value);
682
-                $m = empty($m) ? false : true;
680
+            if ( is_array( $hide_opt ) ) {
681
+                $m = array_intersect( $hide_opt, $observed_value );
682
+                $m = empty( $m ) ? false : true;
683 683
             } else {
684
-                $m = in_array($hide_opt, $observed_value);
684
+                $m = in_array( $hide_opt, $observed_value );
685 685
             }
686 686
         } else if ( $cond == '!=' ) {
687
-            $m = ! in_array($hide_opt, $observed_value);
687
+            $m = ! in_array( $hide_opt, $observed_value );
688 688
         } else if ( $cond == '>' ) {
689
-            $min = min($observed_value);
689
+            $min = min( $observed_value );
690 690
             $m = $min > $hide_opt;
691 691
         } else if ( $cond == '<' ) {
692
-            $max = max($observed_value);
692
+            $max = max( $observed_value );
693 693
             $m = $max < $hide_opt;
694 694
         } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
695 695
             foreach ( $observed_value as $ob ) {
696
-                $m = strpos($ob, $hide_opt);
696
+                $m = strpos( $ob, $hide_opt );
697 697
                 if ( $m !== false ) {
698 698
                     $m = true;
699 699
                     break;
@@ -714,20 +714,20 @@  discard block
 block discarded – undo
714 714
      * @return string
715 715
      */
716 716
 	public static function basic_replace_shortcodes( $value, $form, $entry ) {
717
-        if ( strpos($value, '[sitename]') !== false ) {
717
+        if ( strpos( $value, '[sitename]' ) !== false ) {
718 718
             $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
719
-            $value = str_replace('[sitename]', $new_value, $value);
719
+            $value = str_replace( '[sitename]', $new_value, $value );
720 720
         }
721 721
 
722
-        $value = apply_filters('frm_content', $value, $form, $entry);
723
-        $value = do_shortcode($value);
722
+        $value = apply_filters( 'frm_content', $value, $form, $entry );
723
+        $value = do_shortcode( $value );
724 724
 
725 725
         return $value;
726 726
     }
727 727
 
728 728
 	public static function get_shortcodes( $content, $form_id ) {
729 729
         if ( FrmAppHelper::pro_is_installed() ) {
730
-            return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
730
+            return FrmProDisplaysHelper::get_shortcodes( $content, $form_id );
731 731
         }
732 732
 
733 733
 		$fields = FrmField::getAll( array(
@@ -735,9 +735,9 @@  discard block
 block discarded – undo
735 735
 			'fi.type not' => FrmField::no_save_fields(),
736 736
 		) );
737 737
 
738
-        $tagregexp = self::allowed_shortcodes($fields);
738
+        $tagregexp = self::allowed_shortcodes( $fields );
739 739
 
740
-        preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
740
+        preg_match_all( "/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER );
741 741
 
742 742
         return $matches;
743 743
     }
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
             $tagregexp[] = $field->field_key;
751 751
         }
752 752
 
753
-        $tagregexp = implode('|', $tagregexp);
753
+        $tagregexp = implode( '|', $tagregexp );
754 754
         return $tagregexp;
755 755
     }
756 756
 
@@ -766,28 +766,28 @@  discard block
 block discarded – undo
766 766
 				continue;
767 767
 			}
768 768
 
769
-            $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] );
769
+            $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] );
770 770
 
771
-            if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
772
-				$tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] );
773
-                $tags = explode(' ', $tag);
774
-                if ( is_array($tags) ) {
771
+            if ( ! empty( $shortcodes[3][$short_key] ) ) {
772
+				$tag = str_replace( array( '[', ']' ), '', $shortcodes[0][$short_key] );
773
+                $tags = explode( ' ', $tag );
774
+                if ( is_array( $tags ) ) {
775 775
                     $tag = $tags[0];
776 776
                 }
777 777
             } else {
778
-                $tag = $shortcodes[2][ $short_key ];
778
+                $tag = $shortcodes[2][$short_key];
779 779
             }
780 780
 
781 781
             switch ( $tag ) {
782 782
                 case 'id':
783 783
                 case 'key':
784 784
                 case 'ip':
785
-                    $replace_with = $shortcode_values[ $tag ];
785
+                    $replace_with = $shortcode_values[$tag];
786 786
 					break;
787 787
 
788 788
                 case 'user_agent':
789 789
                 case 'user-agent':
790
-                    $entry->description = maybe_unserialize($entry->description);
790
+                    $entry->description = maybe_unserialize( $entry->description );
791 791
 					$replace_with = FrmEntriesHelper::get_browser( $entry->description['browser'] );
792 792
 					break;
793 793
 
@@ -795,25 +795,25 @@  discard block
 block discarded – undo
795 795
                 case 'created-at':
796 796
                 case 'updated_at':
797 797
                 case 'updated-at':
798
-                    if ( isset($atts['format']) ) {
798
+                    if ( isset( $atts['format'] ) ) {
799 799
                         $time_format = ' ';
800 800
                     } else {
801
-                        $atts['format'] = get_option('date_format');
801
+                        $atts['format'] = get_option( 'date_format' );
802 802
                         $time_format = '';
803 803
                     }
804 804
 
805
-                    $this_tag = str_replace('-', '_', $tag);
806
-                    $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
807
-                    unset($this_tag);
805
+                    $this_tag = str_replace( '-', '_', $tag );
806
+                    $replace_with = FrmAppHelper::get_formatted_time( $entry->{$this_tag}, $atts['format'], $time_format );
807
+                    unset( $this_tag );
808 808
 					break;
809 809
 
810 810
                 case 'created_by':
811 811
                 case 'created-by':
812 812
                 case 'updated_by':
813 813
                 case 'updated-by':
814
-                    $this_tag = str_replace('-', '_', $tag);
814
+                    $this_tag = str_replace( '-', '_', $tag );
815 815
 					$replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts );
816
-                    unset($this_tag);
816
+                    unset( $this_tag );
817 817
 					break;
818 818
 
819 819
                 case 'admin_email':
@@ -830,16 +830,16 @@  discard block
 block discarded – undo
830 830
                         break;
831 831
                     }
832 832
 
833
-                    $sep = isset($atts['sep']) ? $atts['sep'] : ', ';
833
+                    $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', ';
834 834
 
835 835
                     $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
836 836
 
837 837
                     $atts['entry_id'] = $entry->id;
838 838
                     $atts['entry_key'] = $entry->item_key;
839 839
 
840
-                    if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
840
+                    if ( isset( $atts['show'] ) && $atts['show'] == 'field_label' ) {
841 841
                         $replace_with = $field->name;
842
-                    } else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
842
+                    } else if ( isset( $atts['show'] ) && $atts['show'] == 'description' ) {
843 843
                         $replace_with = $field->description;
844 844
 					} else {
845 845
 						$string_value = $replace_with;
@@ -854,14 +854,14 @@  discard block
 block discarded – undo
854 854
 						}
855 855
 					}
856 856
 
857
-                    unset($field);
857
+                    unset( $field );
858 858
             }
859 859
 
860
-            if ( isset($replace_with) ) {
861
-                $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
860
+            if ( isset( $replace_with ) ) {
861
+                $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content );
862 862
             }
863 863
 
864
-            unset($atts, $conditional, $replace_with);
864
+            unset( $atts, $conditional, $replace_with );
865 865
 		}
866 866
 
867 867
 		return $content;
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
         $new_value = '';
878 878
         switch ( $tag ) {
879 879
             case 'admin_email':
880
-                $new_value = get_option('admin_email');
880
+                $new_value = get_option( 'admin_email' );
881 881
                 break;
882 882
             case 'siteurl':
883 883
                 $new_value = FrmAppHelper::site_url();
@@ -903,28 +903,28 @@  discard block
 block discarded – undo
903 903
      * @return string|array
904 904
      */
905 905
     public static function process_get_shortcode( $atts, $return_array = false ) {
906
-        if ( ! isset($atts['param']) ) {
906
+        if ( ! isset( $atts['param'] ) ) {
907 907
             return '';
908 908
         }
909 909
 
910
-        if ( strpos($atts['param'], '&#91;') ) {
911
-            $atts['param'] = str_replace('&#91;', '[', $atts['param']);
912
-            $atts['param'] = str_replace('&#93;', ']', $atts['param']);
910
+        if ( strpos( $atts['param'], '&#91;' ) ) {
911
+            $atts['param'] = str_replace( '&#91;', '[', $atts['param'] );
912
+            $atts['param'] = str_replace( '&#93;', ']', $atts['param'] );
913 913
         }
914 914
 
915 915
 		$new_value = FrmAppHelper::get_param( $atts['param'], '', 'get', 'sanitize_text_field' );
916 916
         $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
917 917
 
918 918
         if ( $new_value == '' ) {
919
-            if ( ! isset($atts['prev_val']) ) {
919
+            if ( ! isset( $atts['prev_val'] ) ) {
920 920
                 $atts['prev_val'] = '';
921 921
             }
922 922
 
923
-            $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
923
+            $new_value = isset( $atts['default'] ) ? $atts['default'] : $atts['prev_val'];
924 924
         }
925 925
 
926
-        if ( is_array($new_value) && ! $return_array ) {
927
-            $new_value = implode(', ', $new_value);
926
+        if ( is_array( $new_value ) && ! $return_array ) {
927
+            $new_value = implode( ', ', $new_value );
928 928
         }
929 929
 
930 930
         return $new_value;
@@ -937,17 +937,17 @@  discard block
 block discarded – undo
937 937
 		$replace_with = apply_filters( 'frm_get_display_value', $replace_with, $field, $atts );
938 938
 
939 939
         if ( $field->type == 'textarea' || $field->type == 'rte' ) {
940
-            $autop = isset($atts['wpautop']) ? $atts['wpautop'] : true;
941
-            if ( apply_filters('frm_use_wpautop', $autop) ) {
942
-                if ( is_array($replace_with) ) {
943
-                    $replace_with = implode("\n", $replace_with);
940
+            $autop = isset( $atts['wpautop'] ) ? $atts['wpautop'] : true;
941
+            if ( apply_filters( 'frm_use_wpautop', $autop ) ) {
942
+                if ( is_array( $replace_with ) ) {
943
+                    $replace_with = implode( "\n", $replace_with );
944 944
                 }
945
-                $replace_with = wpautop($replace_with);
945
+                $replace_with = wpautop( $replace_with );
946 946
             }
947 947
 			unset( $autop );
948 948
 		} else if ( is_array( $replace_with ) ) {
949
-			if ( isset( $atts['show'] ) && $atts['show'] && isset( $replace_with[ $atts['show'] ] ) ) {
950
-				$replace_with = $replace_with[ $atts['show'] ];
949
+			if ( isset( $atts['show'] ) && $atts['show'] && isset( $replace_with[$atts['show']] ) ) {
950
+				$replace_with = $replace_with[$atts['show']];
951 951
 			} else {
952 952
 				$replace_with = implode( $sep, $replace_with );
953 953
 			}
@@ -964,14 +964,14 @@  discard block
 block discarded – undo
964 964
 		$field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() );
965 965
 
966 966
         $field_types = array();
967
-        if ( in_array($type, $single_input) ) {
967
+        if ( in_array( $type, $single_input ) ) {
968 968
             self::field_types_for_input( $single_input, $field_selection, $field_types );
969
-        } else if ( in_array($type, $multiple_input) ) {
969
+        } else if ( in_array( $type, $multiple_input ) ) {
970 970
             self::field_types_for_input( $multiple_input, $field_selection, $field_types );
971
-        } else if ( in_array($type, $other_type) ) {
971
+        } else if ( in_array( $type, $other_type ) ) {
972 972
             self::field_types_for_input( $other_type, $field_selection, $field_types );
973
-		} else if ( isset( $field_selection[ $type ] ) ) {
974
-            $field_types[ $type ] = $field_selection[ $type ];
973
+		} else if ( isset( $field_selection[$type] ) ) {
974
+            $field_types[$type] = $field_selection[$type];
975 975
         }
976 976
 
977 977
 		$field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) );
@@ -980,8 +980,8 @@  discard block
 block discarded – undo
980 980
 
981 981
     private static function field_types_for_input( $inputs, $fields, &$field_types ) {
982 982
         foreach ( $inputs as $input ) {
983
-            $field_types[ $input ] = $fields[ $input ];
984
-            unset($input);
983
+            $field_types[$input] = $fields[$input];
984
+            unset( $input );
985 985
         }
986 986
     }
987 987
 
@@ -1028,21 +1028,21 @@  discard block
 block discarded – undo
1028 1028
 		// Check posted vals before checking saved values
1029 1029
 
1030 1030
 		// For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
1031
-		if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) {
1031
+		if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) {
1032 1032
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
1033
-				$other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) : '';
1033
+				$other_val = isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) : '';
1034 1034
 			} else {
1035
-				$other_val = sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] );
1035
+				$other_val = sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] );
1036 1036
 			}
1037 1037
 			return $other_val;
1038 1038
 
1039
-		} else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) {
1039
+		} else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) {
1040 1040
 			// For normal fields
1041 1041
 
1042 1042
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
1043
-				$other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) : '';
1043
+				$other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta']['other'][$field['id']][$opt_key] ) : '';
1044 1044
 			} else {
1045
-				$other_val = sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ] );
1045
+				$other_val = sanitize_text_field( $_POST['item_meta']['other'][$field['id']] );
1046 1046
 			}
1047 1047
 			return $other_val;
1048 1048
 		}
@@ -1051,8 +1051,8 @@  discard block
 block discarded – undo
1051 1051
 		if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) {
1052 1052
 			// Check if there is an "other" val in saved value and make sure the
1053 1053
 			// "other" val is not equal to the Other checkbox option
1054
-			if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) {
1055
-				$other_val = $field['value'][ $opt_key ];
1054
+			if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) {
1055
+				$other_val = $field['value'][$opt_key];
1056 1056
 			}
1057 1057
 		} else {
1058 1058
 			/**
@@ -1064,8 +1064,8 @@  discard block
 block discarded – undo
1064 1064
 				// Multi-select dropdowns - key is not preserved
1065 1065
 				if ( is_array( $field['value'] ) ) {
1066 1066
 					$o_key = array_search( $temp_val, $field['value'] );
1067
-					if ( isset( $field['value'][ $o_key ] ) ) {
1068
-						unset( $field['value'][ $o_key ], $o_key );
1067
+					if ( isset( $field['value'][$o_key] ) ) {
1068
+						unset( $field['value'][$o_key], $o_key );
1069 1069
 					}
1070 1070
 				} else if ( $temp_val == $field['value'] ) {
1071 1071
 					// For radio and regular dropdowns
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
 	private static function set_other_name( $args, &$other_args ) {
1123 1123
 		//Set up name for other field
1124 1124
 		$other_args['name'] = str_replace( '[]', '', $args['field_name'] );
1125
-		$other_args['name'] = preg_replace('/\[' . $args['field']['id'] . '\]$/', '', $other_args['name']);
1125
+		$other_args['name'] = preg_replace( '/\[' . $args['field']['id'] . '\]$/', '', $other_args['name'] );
1126 1126
 		$other_args['name'] = $other_args['name'] . '[other]' . '[' . $args['field']['id'] . ']';
1127 1127
 
1128 1128
 		//Converts item_meta[field_id] => item_meta[other][field_id] and
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 		// Count should only be greater than 3 if inside of a repeating section
1150 1150
 		if ( count( $temp_array ) > 3 ) {
1151 1151
 			$parent = str_replace( ']', '', $temp_array[1] );
1152
-			$pointer = str_replace( ']', '', $temp_array[2]);
1152
+			$pointer = str_replace( ']', '', $temp_array[2] );
1153 1153
 		}
1154 1154
 
1155 1155
 		// Get text for "other" text field
@@ -1277,15 +1277,15 @@  discard block
 block discarded – undo
1277 1277
 			$replace_with[] = '[' . $new . ']';
1278 1278
 			$replace[] = '[' . $old . ' ';
1279 1279
 			$replace_with[] = '[' . $new . ' ';
1280
-            unset($old, $new);
1280
+            unset( $old, $new );
1281 1281
         }
1282 1282
 		if ( is_array( $val ) ) {
1283 1283
 			foreach ( $val as $k => $v ) {
1284
-                $val[ $k ] = str_replace( $replace, $replace_with, $v );
1285
-                unset($k, $v);
1284
+                $val[$k] = str_replace( $replace, $replace_with, $v );
1285
+                unset( $k, $v );
1286 1286
             }
1287 1287
         } else {
1288
-            $val = str_replace($replace, $replace_with, $val);
1288
+            $val = str_replace( $replace, $replace_with, $val );
1289 1289
         }
1290 1290
 
1291 1291
         return $val;
@@ -1352,19 +1352,19 @@  discard block
 block discarded – undo
1352 1352
 	}
1353 1353
 
1354 1354
 	public static function get_bulk_prefilled_opts( array &$prepop ) {
1355
-		$prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries();
1355
+		$prepop[__( 'Countries', 'formidable' )] = FrmFieldsHelper::get_countries();
1356 1356
 
1357 1357
         $states = FrmFieldsHelper::get_us_states();
1358
-        $state_abv = array_keys($states);
1359
-        sort($state_abv);
1360
-		$prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
1358
+        $state_abv = array_keys( $states );
1359
+        sort( $state_abv );
1360
+		$prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv;
1361 1361
 
1362
-        $states = array_values($states);
1363
-        sort($states);
1364
-		$prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
1365
-        unset($state_abv, $states);
1362
+        $states = array_values( $states );
1363
+        sort( $states );
1364
+		$prepop[__( 'U.S. States', 'formidable' )] = $states;
1365
+        unset( $state_abv, $states );
1366 1366
 
1367
-		$prepop[ __( 'Age', 'formidable' ) ] = array(
1367
+		$prepop[__( 'Age', 'formidable' )] = array(
1368 1368
 			__( 'Under 18', 'formidable' ),
1369 1369
 			__( '18-24', 'formidable' ),
1370 1370
 			__( '25-34', 'formidable' ),
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
 			__( 'Prefer Not to Answer', 'formidable' ),
1376 1376
 		);
1377 1377
 
1378
-		$prepop[ __( 'Satisfaction', 'formidable' ) ] = array(
1378
+		$prepop[__( 'Satisfaction', 'formidable' )] = array(
1379 1379
 			__( 'Very Satisfied', 'formidable' ),
1380 1380
 			__( 'Satisfied', 'formidable' ),
1381 1381
 			__( 'Neutral', 'formidable' ),
@@ -1384,7 +1384,7 @@  discard block
 block discarded – undo
1384 1384
 			__( 'N/A', 'formidable' ),
1385 1385
 		);
1386 1386
 
1387
-		$prepop[ __( 'Importance', 'formidable' ) ] = array(
1387
+		$prepop[__( 'Importance', 'formidable' )] = array(
1388 1388
 			__( 'Very Important', 'formidable' ),
1389 1389
 			__( 'Important', 'formidable' ),
1390 1390
 			__( 'Neutral', 'formidable' ),
@@ -1393,7 +1393,7 @@  discard block
 block discarded – undo
1393 1393
 			__( 'N/A', 'formidable' ),
1394 1394
 		);
1395 1395
 
1396
-		$prepop[ __( 'Agreement', 'formidable' ) ] = array(
1396
+		$prepop[__( 'Agreement', 'formidable' )] = array(
1397 1397
 			__( 'Strongly Agree', 'formidable' ),
1398 1398
 			__( 'Agree', 'formidable' ),
1399 1399
 			__( 'Neutral', 'formidable' ),
Please login to merge, or discard this patch.
classes/helpers/FrmFormsHelper.php 1 patch
Spacing   +49 added lines, -49 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
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 	public static function get_direct_link( $key, $form = false ) {
21 21
 		$target_url = esc_url( admin_url( 'admin-ajax.php?action=frm_forms_preview&form=' . $key ) );
22
-        $target_url = apply_filters('frm_direct_link', $target_url, $key, $form);
22
+        $target_url = apply_filters( 'frm_direct_link', $target_url, $key, $form );
23 23
 
24 24
         return $target_url;
25 25
     }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			$query['id !'] = $args['exclude'];
45 45
         }
46 46
 
47
-        $where = apply_filters('frm_forms_dropdown', $query, $field_name);
47
+        $where = apply_filters( 'frm_forms_dropdown', $query, $field_name );
48 48
 		$forms = FrmForm::get_published_forms( $where, 999, $args['inc_children'] );
49 49
 		$add_html = array();
50 50
 		self::add_html_attr( $args['onchange'], 'onchange', $add_html );
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public static function add_html_attr( $class, $param, &$add_html ) {
75 75
 		if ( ! empty( $class ) ) {
76
-			$add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"';
76
+			$add_html[$param] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"';
77 77
 		}
78 78
 	}
79 79
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		);
88 88
 		if ( isset( $_GET['id'] ) && ! isset( $_GET['form'] ) ) {
89 89
 			unset( $args['form'] );
90
-		} else if ( isset( $_GET['form']) && ! isset( $_GET['id'] ) ) {
90
+		} else if ( isset( $_GET['form'] ) && ! isset( $_GET['id'] ) ) {
91 91
 			unset( $args['id'] );
92 92
         }
93 93
 
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 		if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $frm_action, array( 'edit', 'show', 'destroy_all' ) ) ) {
96 96
             $args['frm_action'] = 'list';
97 97
             $args['form'] = 0;
98
-		} else if ( FrmAppHelper::is_admin_page('formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) {
98
+		} else if ( FrmAppHelper::is_admin_page( 'formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) {
99 99
             $args['frm_action'] = 'edit';
100 100
 		} else if ( isset( $_GET['post'] ) ) {
101 101
             $args['form'] = 0;
102
-            $base = admin_url('edit.php?post_type=frm_display');
102
+            $base = admin_url( 'edit.php?post_type=frm_display' );
103 103
         }
104 104
 
105 105
         ?>
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             $post_values = $values;
163 163
         } else {
164 164
             $values = array();
165
-            $post_values = isset($_POST) ? $_POST : array();
165
+            $post_values = isset( $_POST ) ? $_POST : array();
166 166
         }
167 167
 
168 168
 		$defaults = array(
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
 			'description' => '',
171 171
 		);
172 172
 		foreach ( $defaults as $var => $default ) {
173
-			if ( ! isset( $values[ $var ] ) ) {
174
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
173
+			if ( ! isset( $values[$var] ) ) {
174
+				$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
175 175
             }
176 176
         }
177 177
 
178
-        $values['description'] = FrmAppHelper::use_wpautop($values['description']);
178
+        $values['description'] = FrmAppHelper::use_wpautop( $values['description'] );
179 179
 
180 180
 		$defaults = array(
181 181
 			'form_id'        => '',
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 			'parent_form_id' => 0,
188 188
 		);
189 189
 		foreach ( $defaults as $var => $default ) {
190
-			if ( ! isset( $values[ $var ] ) ) {
191
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
190
+			if ( ! isset( $values[$var] ) ) {
191
+				$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
192 192
 			}
193 193
 		}
194 194
 		unset( $defaults );
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 		$values = self::fill_default_opts( $values, false, $post_values );
201 201
 		$values['custom_style'] = FrmAppHelper::custom_style_value( $post_values );
202 202
 
203
-        return apply_filters('frm_setup_new_form_vars', $values);
203
+        return apply_filters( 'frm_setup_new_form_vars', $values );
204 204
     }
205 205
 
206 206
     /**
@@ -211,42 +211,42 @@  discard block
 block discarded – undo
211 211
 			$post_values = stripslashes_deep( $_POST );
212 212
 		}
213 213
 
214
-        $values['form_key'] = isset($post_values['form_key']) ? $post_values['form_key'] : $record->form_key;
215
-        $values['default_template'] = isset($post_values['default_template']) ? $post_values['default_template'] : $record->default_template;
216
-        $values['is_template'] = isset($post_values['is_template']) ? $post_values['is_template'] : $record->is_template;
214
+        $values['form_key'] = isset( $post_values['form_key'] ) ? $post_values['form_key'] : $record->form_key;
215
+        $values['default_template'] = isset( $post_values['default_template'] ) ? $post_values['default_template'] : $record->default_template;
216
+        $values['is_template'] = isset( $post_values['is_template'] ) ? $post_values['is_template'] : $record->is_template;
217 217
         $values['status'] = $record->status;
218 218
 
219
-        $values = self::fill_default_opts($values, $record, $post_values);
219
+        $values = self::fill_default_opts( $values, $record, $post_values );
220 220
 
221
-        return apply_filters('frm_setup_edit_form_vars', $values);
221
+        return apply_filters( 'frm_setup_edit_form_vars', $values );
222 222
     }
223 223
 
224 224
 	public static function fill_default_opts( $values, $record, $post_values ) {
225 225
 
226 226
         $defaults = self::get_default_opts();
227 227
 		foreach ( $defaults as $var => $default ) {
228
-            if ( is_array($default) ) {
229
-                if ( ! isset( $values[ $var ] ) ) {
230
-					$values[ $var ] = ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : array();
228
+            if ( is_array( $default ) ) {
229
+                if ( ! isset( $values[$var] ) ) {
230
+					$values[$var] = ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : array();
231 231
                 }
232 232
 
233 233
                 foreach ( $default as $k => $v ) {
234
-					$values[ $var ][ $k ] = ( $post_values && isset( $post_values[ $var ][ $k ] ) ) ? $post_values[ $var ][ $k ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) ) ? $record->options[ $var ][ $k ] : $v );
234
+					$values[$var][$k] = ( $post_values && isset( $post_values[$var][$k] ) ) ? $post_values[$var][$k] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) ) ? $record->options[$var][$k] : $v );
235 235
 
236 236
                     if ( is_array( $v ) ) {
237 237
                         foreach ( $v as $k1 => $v1 ) {
238
-							$values[ $var ][ $k ][ $k1 ] = ( $post_values && isset( $post_values[ $var ][ $k ][ $k1 ] ) ) ? $post_values[ $var ][ $k ][ $k1 ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) && isset( $record->options[ $var ][ $k ][ $k1 ] ) ) ? $record->options[ $var ][ $k ][ $k1 ] : $v1 );
238
+							$values[$var][$k][$k1] = ( $post_values && isset( $post_values[$var][$k][$k1] ) ) ? $post_values[$var][$k][$k1] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) && isset( $record->options[$var][$k][$k1] ) ) ? $record->options[$var][$k][$k1] : $v1 );
239 239
                             unset( $k1, $v1 );
240 240
                         }
241 241
                     }
242 242
 
243
-                    unset($k, $v);
243
+                    unset( $k, $v );
244 244
                 }
245 245
             } else {
246
-				$values[ $var ] = ( $post_values && isset( $post_values['options'][ $var ] ) ) ? $post_values['options'][ $var ] : ( ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : $default );
246
+				$values[$var] = ( $post_values && isset( $post_values['options'][$var] ) ) ? $post_values['options'][$var] : ( ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : $default );
247 247
             }
248 248
 
249
-            unset($var, $default);
249
+            unset( $var, $default );
250 250
         }
251 251
 
252 252
         return $values;
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	public static function fill_form_options( &$options, $values ) {
280 280
 		$defaults = self::get_default_opts();
281 281
 		foreach ( $defaults as $var => $default ) {
282
-			$options[ $var ] = isset( $values['options'][ $var ] ) ? $values['options'][ $var ] : $default;
282
+			$options[$var] = isset( $values['options'][$var] ) ? $values['options'][$var] : $default;
283 283
 			unset( $var, $default );
284 284
 		}
285 285
 	}
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 		$last_field = false;
359 359
         foreach ( $fields as $field ) {
360 360
 			if ( $prev_order === $field->field_order ) {
361
-				$add_order++;
361
+				$add_order ++;
362 362
 			}
363 363
 
364 364
 			if ( $add_order ) {
@@ -430,21 +430,21 @@  discard block
 block discarded – undo
430 430
             if ( $code == 'form_name' ) {
431 431
                 $replace_with = $form->name;
432 432
             } else if ( $code == 'form_description' ) {
433
-                $replace_with = FrmAppHelper::use_wpautop($form->description);
434
-            } else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) {
433
+                $replace_with = FrmAppHelper::use_wpautop( $form->description );
434
+            } else if ( $code == 'entry_key' && isset( $_GET ) && isset( $_GET['entry'] ) ) {
435 435
                 $replace_with = FrmAppHelper::simple_get( 'entry' );
436 436
             } else {
437 437
                 $replace_with = '';
438 438
             }
439 439
 
440
-            FrmFieldsHelper::remove_inline_conditions( ( FrmAppHelper::is_true($show) && $replace_with != '' ), $code, $replace_with, $html );
440
+            FrmFieldsHelper::remove_inline_conditions( ( FrmAppHelper::is_true( $show ) && $replace_with != '' ), $code, $replace_with, $html );
441 441
         }
442 442
 
443 443
         //replace [form_key]
444
-        $html = str_replace('[form_key]', $form->form_key, $html);
444
+        $html = str_replace( '[form_key]', $form->form_key, $html );
445 445
 
446 446
         //replace [frmurl]
447
-        $html = str_replace('[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html);
447
+        $html = str_replace( '[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html );
448 448
 
449 449
 		if ( strpos( $html, '[button_label]' ) ) {
450 450
 			add_filter( 'frm_submit_button', 'FrmFormsHelper::submit_button_label', 1 );
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 			$html = str_replace( '[button_label]', $submit_label, $html );
454 454
         }
455 455
 
456
-        $html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values);
456
+        $html = apply_filters( 'frm_form_replace_shortcodes', $html, $form, $values );
457 457
 
458 458
 		if ( strpos( $html, '[if back_button]' ) ) {
459 459
 			$html = preg_replace( '/(\[if\s+back_button\])(.*?)(\[\/if\s+back_button\])/mis', '', $html );
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
     }
472 472
 
473 473
 	public static function submit_button_label( $submit ) {
474
-        if ( ! $submit || empty($submit) ) {
474
+        if ( ! $submit || empty( $submit ) ) {
475 475
             $frm_settings = FrmAppHelper::get_settings();
476 476
             $submit = $frm_settings->submit_value;
477 477
         }
@@ -494,11 +494,11 @@  discard block
 block discarded – undo
494 494
 	}
495 495
 
496 496
 	public static function get_form_style_class( $form = false ) {
497
-        $style = self::get_form_style($form);
497
+        $style = self::get_form_style( $form );
498 498
         $class = ' with_frm_style';
499 499
 
500
-        if ( empty($style) ) {
501
-            if ( FrmAppHelper::is_admin_page('formidable-entries') ) {
500
+        if ( empty( $style ) ) {
501
+            if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) ) {
502 502
                 return $class;
503 503
             } else {
504 504
                 return;
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
         }
507 507
 
508 508
         //If submit button needs to be inline or centered
509
-        if ( is_object($form) ) {
509
+        if ( is_object( $form ) ) {
510 510
 			$form = $form->options;
511 511
 		}
512 512
 
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 			$class .= ' frm_center_submit';
519 519
 		}
520 520
 
521
-        $class = apply_filters('frm_add_form_style_class', $class, $style);
521
+        $class = apply_filters( 'frm_add_form_style_class', $class, $style );
522 522
 
523 523
         return $class;
524 524
     }
@@ -618,12 +618,12 @@  discard block
 block discarded – undo
618 618
     }
619 619
 
620 620
 	public static function edit_form_link( $form_id ) {
621
-        if ( is_object($form_id) ) {
621
+        if ( is_object( $form_id ) ) {
622 622
             $form = $form_id;
623 623
             $name = $form->name;
624 624
             $form_id = $form->id;
625 625
         } else {
626
-            $name = FrmForm::getName($form_id);
626
+            $name = FrmForm::getName( $form_id );
627 627
         }
628 628
 
629 629
         if ( $form_id ) {
@@ -655,12 +655,12 @@  discard block
 block discarded – undo
655 655
 		$current_page = FrmAppHelper::get_simple_request( array( 'param' => 'form_type' ) );
656 656
 		$base_url = '?page=formidable&form_type=' . $current_page . '&id=' . $id;
657 657
         if ( 'trash' == $status ) {
658
-			$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][ $length ] . '</a>';
659
-        } else if ( current_user_can('frm_delete_forms') ) {
658
+			$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][$length] . '</a>';
659
+        } else if ( current_user_can( 'frm_delete_forms' ) ) {
660 660
             if ( EMPTY_TRASH_DAYS ) {
661
-				$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][ $length ] . '</a>';
661
+				$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][$length] . '</a>';
662 662
             } else {
663
-				$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][ $length ] . '</a>';
663
+				$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][$length] . '</a>';
664 664
             }
665 665
         }
666 666
 
@@ -674,11 +674,11 @@  discard block
 block discarded – undo
674 674
             'publish'   => __( 'Published', 'formidable' ),
675 675
         );
676 676
 
677
-        if ( ! in_array($status, array_keys($nice_names)) ) {
677
+        if ( ! in_array( $status, array_keys( $nice_names ) ) ) {
678 678
             $status = 'publish';
679 679
         }
680 680
 
681
-		$name = $nice_names[ $status ];
681
+		$name = $nice_names[$status];
682 682
 
683 683
         return $name;
684 684
     }
Please login to merge, or discard this patch.
classes/helpers/FrmXMLHelper.php 1 patch
Spacing   +146 added lines, -146 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
 
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 			'terms'    => array(),
41 41
         );
42 42
 
43
-        unset($defaults);
43
+        unset( $defaults );
44 44
 
45 45
 		if ( ! defined( 'WP_IMPORTING' ) ) {
46
-            define('WP_IMPORTING', true);
46
+            define( 'WP_IMPORTING', true );
47 47
         }
48 48
 
49 49
 		if ( ! class_exists( 'DOMDocument' ) ) {
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 			return new WP_Error( 'SimpleXML_parse_error', __( 'There was an error when reading this XML file', 'formidable' ), libxml_get_errors() );
57 57
 		}
58 58
 
59
-		if ( ! function_exists('simplexml_import_dom') ) {
59
+		if ( ! function_exists( 'simplexml_import_dom' ) ) {
60 60
 			return new WP_Error( 'SimpleXML_parse_error', __( 'Your server is missing the simplexml_import_dom function', 'formidable' ), libxml_get_errors() );
61 61
 		}
62 62
 
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
         // add terms, forms (form and field ids), posts (post ids), and entries to db, in that order
72 72
 		foreach ( array( 'term', 'form', 'view' ) as $item_type ) {
73 73
             // grab cats, tags, and terms, or forms or posts
74
-            if ( isset($xml->{$item_type} ) ) {
74
+            if ( isset( $xml->{$item_type} ) ) {
75 75
 				$function_name = 'import_xml_' . $item_type . 's';
76 76
 				$imported = self::$function_name( $xml->{$item_type}, $imported );
77 77
 				unset( $function_name, $xml->{$item_type} );
78 78
             }
79 79
         }
80 80
 
81
-	    $return = apply_filters('frm_importing_xml', $imported, $xml );
81
+	    $return = apply_filters( 'frm_importing_xml', $imported, $xml );
82 82
 
83 83
 	    return $return;
84 84
     }
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
                 'slug'          => (string) $t->term_slug,
96 96
                 'description'   => (string) $t->term_description,
97 97
 				'parent'        => empty( $parent ) ? 0 : $parent,
98
-            ));
98
+            ) );
99 99
 
100 100
 			if ( $term && is_array( $term ) ) {
101
-                $imported['imported']['terms']++;
102
-				$imported['terms'][ (int) $t->term_id ] = $term['term_id'];
101
+                $imported['imported']['terms'] ++;
102
+				$imported['terms'][(int) $t->term_id] = $term['term_id'];
103 103
             }
104 104
 
105 105
 			unset( $term, $t );
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 			} else {
149 149
 				$form_id = FrmForm::create( $form );
150 150
 		        if ( $form_id ) {
151
-		            $imported['imported']['forms']++;
151
+		            $imported['imported']['forms'] ++;
152 152
 		            // Keep track of whether this specific form was updated or not
153
-					$imported['form_status'][ $form_id ] = 'imported';
153
+					$imported['form_status'][$form_id] = 'imported';
154 154
 					self::track_imported_child_forms( (int) $form_id, $form['parent_form_id'], $child_forms );
155 155
 		        }
156 156
 			}
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 		    // Update field ids/keys to new ones
163 163
 			do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) );
164 164
 
165
-			$imported['forms'][ (int) $item->id ] = $form_id;
165
+			$imported['forms'][(int) $item->id] = $form_id;
166 166
 
167 167
             // Send pre 2.0 form options through function that creates actions
168 168
             self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true );
169 169
 
170 170
 			do_action( 'frm_after_import_form', $form_id, $form );
171 171
 
172
-		    unset($form, $item);
172
+		    unset( $form, $item );
173 173
 		}
174 174
 
175 175
 		self::maybe_update_child_form_parent_id( $imported['forms'], $child_forms );
@@ -214,18 +214,18 @@  discard block
 block discarded – undo
214 214
 	private static function update_form( $this_form, $form, &$imported ) {
215 215
 		$form_id = $this_form->id;
216 216
 		FrmForm::update( $form_id, $form );
217
-		$imported['updated']['forms']++;
217
+		$imported['updated']['forms'] ++;
218 218
 		// Keep track of whether this specific form was updated or not
219
-		$imported['form_status'][ $form_id ] = 'updated';
219
+		$imported['form_status'][$form_id] = 'updated';
220 220
 	}
221 221
 
222 222
 	private static function get_form_fields( $form_id ) {
223 223
 		$form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' );
224 224
 		$old_fields = array();
225 225
 		foreach ( $form_fields as $f ) {
226
-			$old_fields[ $f->id ] = $f;
227
-			$old_fields[ $f->field_key ] = $f->id;
228
-			unset($f);
226
+			$old_fields[$f->id] = $f;
227
+			$old_fields[$f->field_key] = $f->id;
228
+			unset( $f );
229 229
 		}
230 230
 		$form_fields = $old_fields;
231 231
 		return $form_fields;
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 		$regular_forms = array();
257 257
 
258 258
 		foreach ( $forms as $form ) {
259
-			$parent_form_id = isset( $form->parent_form_id) ? (int) $form->parent_form_id : 0;
259
+			$parent_form_id = isset( $form->parent_form_id ) ? (int) $form->parent_form_id : 0;
260 260
 
261 261
 			if ( $parent_form_id ) {
262 262
 				$child_forms[] = $form;
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	*/
279 279
 	private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) {
280 280
 		if ( $parent_form_id ) {
281
-			$child_forms[ $form_id ] = $parent_form_id;
281
+			$child_forms[$form_id] = $parent_form_id;
282 282
 		}
283 283
 	}
284 284
 
@@ -293,9 +293,9 @@  discard block
 block discarded – undo
293 293
 	private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) {
294 294
 		foreach ( $child_forms as $child_form_id => $old_parent_form_id ) {
295 295
 
296
-			if ( isset( $imported_forms[ $old_parent_form_id ] ) && $imported_forms[ $old_parent_form_id ] != $old_parent_form_id ) {
296
+			if ( isset( $imported_forms[$old_parent_form_id] ) && $imported_forms[$old_parent_form_id] != $old_parent_form_id ) {
297 297
 				// Update all children with this old parent_form_id
298
-				$new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ];
298
+				$new_parent_form_id = (int) $imported_forms[$old_parent_form_id];
299 299
 
300 300
 				FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) );
301 301
 			}
@@ -327,27 +327,27 @@  discard block
 block discarded – undo
327 327
 			self::maybe_update_form_select( $f, $imported );
328 328
 			self::maybe_update_get_values_form_setting( $imported, $f );
329 329
 
330
-			if ( ! empty($this_form) ) {
330
+			if ( ! empty( $this_form ) ) {
331 331
 				// check for field to edit by field id
332
-				if ( isset( $form_fields[ $f['id'] ] ) ) {
332
+				if ( isset( $form_fields[$f['id']] ) ) {
333 333
 					FrmField::update( $f['id'], $f );
334
-					$imported['updated']['fields']++;
334
+					$imported['updated']['fields'] ++;
335 335
 
336
-					unset( $form_fields[ $f['id'] ] );
336
+					unset( $form_fields[$f['id']] );
337 337
 
338 338
 					//unset old field key
339
-					if ( isset( $form_fields[ $f['field_key'] ] ) ) {
340
-						unset( $form_fields[ $f['field_key'] ] );
339
+					if ( isset( $form_fields[$f['field_key']] ) ) {
340
+						unset( $form_fields[$f['field_key']] );
341 341
 					}
342
-				} else if ( isset( $form_fields[ $f['field_key'] ] ) ) {
342
+				} else if ( isset( $form_fields[$f['field_key']] ) ) {
343 343
 					// check for field to edit by field key
344
-					unset($f['id']);
344
+					unset( $f['id'] );
345 345
 
346
-					FrmField::update( $form_fields[ $f['field_key'] ], $f );
347
-					$imported['updated']['fields']++;
346
+					FrmField::update( $form_fields[$f['field_key']], $f );
347
+					$imported['updated']['fields'] ++;
348 348
 
349
-					unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); //unset old field id
350
-					unset( $form_fields[ $f['field_key'] ] ); //unset old field key
349
+					unset( $form_fields[$form_fields[$f['field_key']]] ); //unset old field id
350
+					unset( $form_fields[$f['field_key']] ); //unset old field key
351 351
 				} else {
352 352
 					// if no matching field id or key in this form, create the field
353 353
 					self::create_imported_field( $f, $imported );
@@ -366,11 +366,11 @@  discard block
 block discarded – undo
366 366
 			'name'          => (string) $field->name,
367 367
 			'description'   => (string) $field->description,
368 368
 			'type'          => (string) $field->type,
369
-			'default_value' => FrmAppHelper::maybe_json_decode( (string) $field->default_value),
369
+			'default_value' => FrmAppHelper::maybe_json_decode( (string) $field->default_value ),
370 370
 			'field_order'   => (int) $field->field_order,
371 371
 			'form_id'       => (int) $form_id,
372 372
 			'required'      => (int) $field->required,
373
-			'options'       => FrmAppHelper::maybe_json_decode( (string) $field->options),
373
+			'options'       => FrmAppHelper::maybe_json_decode( (string) $field->options ),
374 374
 			'field_options' => FrmAppHelper::maybe_json_decode( (string) $field->field_options ),
375 375
 		);
376 376
 	}
@@ -414,8 +414,8 @@  discard block
 block discarded – undo
414 414
 		if ( $f['type'] == 'form' || ( $f['type'] == 'divider' && FrmField::is_option_true( $f['field_options'], 'repeat' ) ) ) {
415 415
 			if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) {
416 416
 				$form_select = (int) $f['field_options']['form_select'];
417
-				if ( isset( $imported['forms'][ $form_select ] ) ) {
418
-					$f['field_options']['form_select'] = $imported['forms'][ $form_select ];
417
+				if ( isset( $imported['forms'][$form_select] ) ) {
418
+					$f['field_options']['form_select'] = $imported['forms'][$form_select];
419 419
 				}
420 420
 			}
421 421
 		}
@@ -435,8 +435,8 @@  discard block
 block discarded – undo
435 435
 
436 436
 		if ( FrmField::is_option_true_in_array( $f['field_options'], 'get_values_form' ) ) {
437 437
 			$old_form = $f['field_options']['get_values_form'];
438
-			if ( isset( $imported['forms'][ $old_form ] ) ) {
439
-				$f['field_options']['get_values_form'] = $imported['forms'][ $old_form ];
438
+			if ( isset( $imported['forms'][$old_form] ) ) {
439
+				$f['field_options']['get_values_form'] = $imported['forms'][$old_form];
440 440
 			}
441 441
 		}
442 442
 	}
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	private static function create_imported_field( $f, &$imported ) {
452 452
 		$new_id = FrmField::create( $f );
453 453
 		if ( $new_id != false ) {
454
-			$imported['imported']['fields']++;
454
+			$imported['imported']['fields'] ++;
455 455
 			do_action( 'frm_after_field_is_imported', $f, $new_id );
456 456
 		}
457 457
 	}
@@ -550,9 +550,9 @@  discard block
 block discarded – undo
550 550
 			);
551 551
 
552 552
             $old_id = $post['post_id'];
553
-            self::populate_post($post, $item, $imported);
553
+            self::populate_post( $post, $item, $imported );
554 554
 
555
-			unset($item);
555
+			unset( $item );
556 556
 
557 557
 			$post_id = false;
558 558
             if ( $post['post_type'] == $form_action_type ) {
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 				if ( $action_control && is_object( $action_control ) ) {
561 561
 					$post_id = $action_control->maybe_create_action( $post, $imported['form_status'] );
562 562
 				}
563
-                unset($action_control);
563
+                unset( $action_control );
564 564
             } else if ( $post['post_type'] == 'frm_styles' ) {
565 565
                 // Properly encode post content before inserting the post
566 566
                 $post['post_content'] = FrmAppHelper::maybe_json_decode( $post['post_content'] );
@@ -575,24 +575,24 @@  discard block
 block discarded – undo
575 575
                 $post_id = wp_insert_post( $post );
576 576
             }
577 577
 
578
-            if ( ! is_numeric($post_id) ) {
578
+            if ( ! is_numeric( $post_id ) ) {
579 579
                 continue;
580 580
             }
581 581
 
582
-            self::update_postmeta($post, $post_id);
582
+            self::update_postmeta( $post, $post_id );
583 583
 
584 584
             $this_type = 'posts';
585
-			if ( isset( $post_types[ $post['post_type'] ] ) ) {
586
-				$this_type = $post_types[ $post['post_type'] ];
585
+			if ( isset( $post_types[$post['post_type']] ) ) {
586
+				$this_type = $post_types[$post['post_type']];
587 587
             }
588 588
 
589
-            if ( isset($post['ID']) && $post_id == $post['ID'] ) {
590
-                $imported['updated'][ $this_type ]++;
589
+            if ( isset( $post['ID'] ) && $post_id == $post['ID'] ) {
590
+                $imported['updated'][$this_type] ++;
591 591
             } else {
592
-                $imported['imported'][ $this_type ]++;
592
+                $imported['imported'][$this_type] ++;
593 593
             }
594 594
 
595
-			$imported['posts'][ (int) $old_id ] = $post_id;
595
+			$imported['posts'][(int) $old_id] = $post_id;
596 596
 
597 597
 			do_action( 'frm_after_import_view', $post_id, $post );
598 598
 
@@ -605,13 +605,13 @@  discard block
 block discarded – undo
605 605
     }
606 606
 
607 607
     private static function populate_post( &$post, $item, $imported ) {
608
-		if ( isset($item->attachment_url) ) {
608
+		if ( isset( $item->attachment_url ) ) {
609 609
 			$post['attachment_url'] = (string) $item->attachment_url;
610 610
 		}
611 611
 
612
-		if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) {
612
+		if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][(int) $post['menu_order']] ) ) {
613 613
 		    // update to new form id
614
-		    $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ];
614
+		    $post['menu_order'] = $imported['forms'][(int) $post['menu_order']];
615 615
 		}
616 616
 
617 617
 		// Don't allow default styles to take over a site's default style
@@ -620,13 +620,13 @@  discard block
 block discarded – undo
620 620
 		}
621 621
 
622 622
 		foreach ( $item->postmeta as $meta ) {
623
-		    self::populate_postmeta($post, $meta, $imported);
624
-			unset($meta);
623
+		    self::populate_postmeta( $post, $meta, $imported );
624
+			unset( $meta );
625 625
 		}
626 626
 
627
-        self::populate_taxonomies($post, $item);
627
+        self::populate_taxonomies( $post, $item );
628 628
 
629
-        self::maybe_editing_post($post);
629
+        self::maybe_editing_post( $post );
630 630
     }
631 631
 
632 632
     private static function populate_postmeta( &$post, $meta, $imported ) {
@@ -638,27 +638,27 @@  discard block
 block discarded – undo
638 638
 		);
639 639
 
640 640
 		//switch old form and field ids to new ones
641
-		if ( $m['key'] == 'frm_form_id' && isset($imported['forms'][ (int) $m['value'] ]) ) {
642
-		    $m['value'] = $imported['forms'][ (int) $m['value'] ];
641
+		if ( $m['key'] == 'frm_form_id' && isset( $imported['forms'][(int) $m['value']] ) ) {
642
+		    $m['value'] = $imported['forms'][(int) $m['value']];
643 643
 		} else {
644
-		    $m['value'] = FrmAppHelper::maybe_json_decode($m['value']);
644
+		    $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] );
645 645
 
646
-		    if ( ! empty($frm_duplicate_ids) ) {
646
+		    if ( ! empty( $frm_duplicate_ids ) ) {
647 647
 
648 648
 		        if ( $m['key'] == 'frm_dyncontent' ) {
649
-		            $m['value'] = FrmFieldsHelper::switch_field_ids($m['value']);
649
+		            $m['value'] = FrmFieldsHelper::switch_field_ids( $m['value'] );
650 650
     		    } else if ( $m['key'] == 'frm_options' ) {
651 651
 
652 652
 					foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) {
653
-						if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) {
654
-							$m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ];
653
+						if ( isset( $m['value'][$setting_name] ) && is_numeric( $m['value'][$setting_name] ) && isset( $frm_duplicate_ids[$m['value'][$setting_name]] ) ) {
654
+							$m['value'][$setting_name] = $frm_duplicate_ids[$m['value'][$setting_name]];
655 655
     		            }
656 656
     		        }
657 657
 
658 658
                     $check_dup_array = array();
659 659
     		        if ( isset( $m['value']['order_by'] ) && ! empty( $m['value']['order_by'] ) ) {
660
-    		            if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) {
661
-    		                $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ];
660
+    		            if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[$m['value']['order_by']] ) ) {
661
+    		                $m['value']['order_by'] = $frm_duplicate_ids[$m['value']['order_by']];
662 662
     		            } else if ( is_array( $m['value']['order_by'] ) ) {
663 663
                             $check_dup_array[] = 'order_by';
664 664
     		            }
@@ -669,22 +669,22 @@  discard block
 block discarded – undo
669 669
     		        }
670 670
 
671 671
                     foreach ( $check_dup_array as $check_k ) {
672
-						foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) {
673
-							if ( isset( $frm_duplicate_ids[ $mv ] ) ) {
674
-								$m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ];
672
+						foreach ( (array) $m['value'][$check_k] as $mk => $mv ) {
673
+							if ( isset( $frm_duplicate_ids[$mv] ) ) {
674
+								$m['value'][$check_k][$mk] = $frm_duplicate_ids[$mv];
675 675
 		                    }
676
-		                    unset($mk, $mv);
676
+		                    unset( $mk, $mv );
677 677
 		                }
678 678
                     }
679 679
     		    }
680 680
 		    }
681 681
 		}
682 682
 
683
-		if ( ! is_array($m['value']) ) {
684
-		    $m['value'] = FrmAppHelper::maybe_json_decode($m['value']);
683
+		if ( ! is_array( $m['value'] ) ) {
684
+		    $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] );
685 685
 		}
686 686
 
687
-		$post['postmeta'][ (string) $meta->meta_key ] = $m['value'];
687
+		$post['postmeta'][(string) $meta->meta_key] = $m['value'];
688 688
     }
689 689
 
690 690
     /**
@@ -700,23 +700,23 @@  discard block
 block discarded – undo
700 700
             }
701 701
 
702 702
 		    $taxonomy = (string) $att['domain'];
703
-		    if ( is_taxonomy_hierarchical($taxonomy) ) {
703
+		    if ( is_taxonomy_hierarchical( $taxonomy ) ) {
704 704
 		        $name = (string) $att['nicename'];
705
-		        $h_term = get_term_by('slug', $name, $taxonomy);
705
+		        $h_term = get_term_by( 'slug', $name, $taxonomy );
706 706
 		        if ( $h_term ) {
707 707
 		            $name = $h_term->term_id;
708 708
 		        }
709
-		        unset($h_term);
709
+		        unset( $h_term );
710 710
 		    } else {
711 711
 		        $name = (string) $c;
712 712
 		    }
713 713
 
714
-			if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) {
715
-				$post['tax_input'][ $taxonomy ] = array();
714
+			if ( ! isset( $post['tax_input'][$taxonomy] ) ) {
715
+				$post['tax_input'][$taxonomy] = array();
716 716
 			}
717 717
 
718
-			$post['tax_input'][ $taxonomy ][] = $name;
719
-		    unset($name);
718
+			$post['tax_input'][$taxonomy][] = $name;
719
+		    unset( $name );
720 720
 		}
721 721
     }
722 722
 
@@ -733,29 +733,29 @@  discard block
 block discarded – undo
733 733
 
734 734
 		if ( in_array( $post['post_status'], array( 'trash', 'draft' ) ) ) {
735 735
 		    $match_by['include'] = $post['post_id'];
736
-		    unset($match_by['name']);
736
+		    unset( $match_by['name'] );
737 737
 		}
738 738
 
739
-		$editing = get_posts($match_by);
739
+		$editing = get_posts( $match_by );
740 740
 
741
-        if ( ! empty($editing) && current($editing)->post_date == $post['post_date'] ) {
741
+        if ( ! empty( $editing ) && current( $editing )->post_date == $post['post_date'] ) {
742 742
             // set the id of the post to edit
743
-            $post['ID'] = current($editing)->ID;
743
+            $post['ID'] = current( $editing )->ID;
744 744
         }
745 745
     }
746 746
 
747 747
     private static function update_postmeta( &$post, $post_id ) {
748 748
         foreach ( $post['postmeta'] as $k => $v ) {
749 749
             if ( '_edit_last' == $k ) {
750
-                $v = FrmAppHelper::get_user_id_param($v);
750
+                $v = FrmAppHelper::get_user_id_param( $v );
751 751
             } else if ( '_thumbnail_id' == $k && FrmAppHelper::pro_is_installed() ) {
752 752
                 //change the attachment ID
753
-                $v = FrmProXMLHelper::get_file_id($v);
753
+                $v = FrmProXMLHelper::get_file_id( $v );
754 754
             }
755 755
 
756
-            update_post_meta($post_id, $k, $v);
756
+            update_post_meta( $post_id, $k, $v );
757 757
 
758
-            unset($k, $v);
758
+            unset( $k, $v );
759 759
         }
760 760
     }
761 761
 
@@ -794,13 +794,13 @@  discard block
 block discarded – undo
794 794
      * @param string $message
795 795
      */
796 796
 	public static function parse_message( $result, &$message, &$errors ) {
797
-        if ( is_wp_error($result) ) {
797
+        if ( is_wp_error( $result ) ) {
798 798
             $errors[] = $result->get_error_message();
799 799
         } else if ( ! $result ) {
800 800
             return;
801 801
         }
802 802
 
803
-        if ( ! is_array($result) ) {
803
+        if ( ! is_array( $result ) ) {
804 804
             $message = is_string( $result ) ? $result : htmlentities( print_r( $result, 1 ) );
805 805
             return;
806 806
         }
@@ -812,20 +812,20 @@  discard block
 block discarded – undo
812 812
 
813 813
         $message = '<ul>';
814 814
         foreach ( $result as $type => $results ) {
815
-			if ( ! isset( $t_strings[ $type ] ) ) {
815
+			if ( ! isset( $t_strings[$type] ) ) {
816 816
                 // only print imported and updated
817 817
                 continue;
818 818
             }
819 819
 
820 820
             $s_message = array();
821 821
             foreach ( $results as $k => $m ) {
822
-                self::item_count_message($m, $k, $s_message);
823
-                unset($k, $m);
822
+                self::item_count_message( $m, $k, $s_message );
823
+                unset( $k, $m );
824 824
             }
825 825
 
826
-            if ( ! empty($s_message) ) {
827
-				$message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> ';
828
-                $message .= implode(', ', $s_message);
826
+            if ( ! empty( $s_message ) ) {
827
+				$message .= '<li><strong>' . $t_strings[$type] . ':</strong> ';
828
+                $message .= implode( ', ', $s_message );
829 829
                 $message .= '</li>';
830 830
             }
831 831
         }
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
             'actions'   => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ),
855 855
         );
856 856
 
857
-		$s_message[] = isset( $strings[ $type ] ) ? $strings[ $type ] : ' ' . $m . ' ' . ucfirst( $type );
857
+		$s_message[] = isset( $strings[$type] ) ? $strings[$type] : ' ' . $m . ' ' . ucfirst( $type );
858 858
     }
859 859
 
860 860
 	/**
@@ -886,14 +886,14 @@  discard block
 block discarded – undo
886 886
 	}
887 887
 
888 888
 	public static function cdata( $str ) {
889
-	    $str = maybe_unserialize($str);
890
-	    if ( is_array($str) ) {
891
-	        $str = json_encode($str);
889
+	    $str = maybe_unserialize( $str );
890
+	    if ( is_array( $str ) ) {
891
+	        $str = json_encode( $str );
892 892
 		} else if ( seems_utf8( $str ) == false ) {
893 893
 			$str = utf8_encode( $str );
894 894
 		}
895 895
 
896
-        if ( is_numeric($str) ) {
896
+        if ( is_numeric( $str ) ) {
897 897
             return $str;
898 898
         }
899 899
 
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
     * @param string $post_type
939 939
     */
940 940
     private static function migrate_post_settings_to_action( $form_options, $form_id, $post_type, &$imported, $switch ) {
941
-        if ( ! isset($form_options['create_post']) || ! $form_options['create_post'] ) {
941
+        if ( ! isset( $form_options['create_post'] ) || ! $form_options['create_post'] ) {
942 942
             return;
943 943
         }
944 944
 
@@ -955,10 +955,10 @@  discard block
 block discarded – undo
955 955
 		$post_settings = array( 'post_type', 'post_category', 'post_content', 'post_excerpt', 'post_title', 'post_name', 'post_date', 'post_status', 'post_custom_fields', 'post_password' );
956 956
 
957 957
         foreach ( $post_settings as $post_setting ) {
958
-			if ( isset( $form_options[ $post_setting ] ) ) {
959
-				$new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ];
958
+			if ( isset( $form_options[$post_setting] ) ) {
959
+				$new_action['post_content'][$post_setting] = $form_options[$post_setting];
960 960
             }
961
-            unset($post_setting);
961
+            unset( $post_setting );
962 962
         }
963 963
 
964 964
 		$new_action['event'] = array( 'create', 'update' );
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
 
973 973
 			$new_action['post_content'] = self::switch_action_field_ids( $new_action['post_content'], $basic_fields, $array_fields );
974 974
         }
975
-        $new_action['post_content'] = json_encode($new_action['post_content']);
975
+        $new_action['post_content'] = json_encode( $new_action['post_content'] );
976 976
 
977 977
         $exists = get_posts( array(
978 978
             'name'          => $new_action['post_name'],
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
         if ( ! $exists ) {
985 985
 			// this isn't an email, but we need to use a class that will always be included
986 986
 			FrmDb::save_json_post( $new_action );
987
-            $imported['imported']['actions']++;
987
+            $imported['imported']['actions'] ++;
988 988
         }
989 989
     }
990 990
 
@@ -1016,11 +1016,11 @@  discard block
 block discarded – undo
1016 1016
         foreach ( $post_content as $key => $setting ) {
1017 1017
             if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) {
1018 1018
                 // Replace old IDs with new IDs
1019
-				$post_content[ $key ] = str_replace( $old, $new, $setting );
1019
+				$post_content[$key] = str_replace( $old, $new, $setting );
1020 1020
             } else if ( is_array( $setting ) && in_array( $key, $array_fields ) ) {
1021 1021
                 foreach ( $setting as $k => $val ) {
1022 1022
                     // Replace old IDs with new IDs
1023
-					$post_content[ $key ][ $k ] = str_replace( $old, $new, $val );
1023
+					$post_content[$key][$k] = str_replace( $old, $new, $val );
1024 1024
                 }
1025 1025
             }
1026 1026
             unset( $key, $setting );
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
         foreach ( $notifications as $new_notification ) {
1051 1051
             $new_notification['post_type']      = $post_type;
1052 1052
             $new_notification['post_excerpt']   = 'email';
1053
-			$new_notification['post_title']     = __( 'Email Notification', 'formidable' );
1053
+			$new_notification['post_title'] = __( 'Email Notification', 'formidable' );
1054 1054
             $new_notification['menu_order']     = $form_id;
1055 1055
             $new_notification['post_status']    = 'publish';
1056 1056
 
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
 				// Switch all other field IDs in email
1064 1064
                 $new_notification['post_content'] = FrmFieldsHelper::switch_field_ids( $new_notification['post_content'] );
1065 1065
             }
1066
-            $new_notification['post_content']   = FrmAppHelper::prepare_and_encode( $new_notification['post_content'] );
1066
+            $new_notification['post_content'] = FrmAppHelper::prepare_and_encode( $new_notification['post_content'] );
1067 1067
 
1068 1068
             $exists = get_posts( array(
1069 1069
                 'name'          => $new_notification['post_name'],
@@ -1072,11 +1072,11 @@  discard block
 block discarded – undo
1072 1072
                 'numberposts'   => 1,
1073 1073
             ) );
1074 1074
 
1075
-            if ( empty($exists) ) {
1075
+            if ( empty( $exists ) ) {
1076 1076
 				FrmDb::save_json_post( $new_notification );
1077
-                $imported['imported']['actions']++;
1077
+                $imported['imported']['actions'] ++;
1078 1078
             }
1079
-            unset($new_notification);
1079
+            unset( $new_notification );
1080 1080
         }
1081 1081
 
1082 1082
 		self::remove_deprecated_notification_settings( $form_id, $form_options );
@@ -1093,8 +1093,8 @@  discard block
 block discarded – undo
1093 1093
 	private static function remove_deprecated_notification_settings( $form_id, $form_options ) {
1094 1094
 		$delete_settings = array( 'notification', 'autoresponder', 'email_to' );
1095 1095
 		foreach ( $delete_settings as $index ) {
1096
-			if ( isset( $form_options[ $index ] ) ) {
1097
-				unset( $form_options[ $index ] );
1096
+			if ( isset( $form_options[$index] ) ) {
1097
+				unset( $form_options[$index] );
1098 1098
 			}
1099 1099
 		}
1100 1100
 		FrmForm::update( $form_id, array( 'options' => $form_options ) );
@@ -1109,7 +1109,7 @@  discard block
 block discarded – undo
1109 1109
 			$form_options['notification'] = array( 0 => $form_options['notification'] );
1110 1110
         }
1111 1111
 
1112
-        if ( isset( $form_options['notification'] ) && is_array($form_options['notification']) ) {
1112
+        if ( isset( $form_options['notification'] ) && is_array( $form_options['notification'] ) ) {
1113 1113
             foreach ( $form_options['notification'] as $email_key => $notification ) {
1114 1114
 
1115 1115
 				$atts = array(
@@ -1147,12 +1147,12 @@  discard block
 block discarded – undo
1147 1147
 			'reply_to_name' => '',
1148 1148
 		);
1149 1149
         foreach ( $reply_fields as $f => $val ) {
1150
-			if ( isset( $notification[ $f ] ) ) {
1151
-				$atts[ $f ] = $notification[ $f ];
1152
-				if ( 'custom' == $notification[ $f ] ) {
1153
-					$atts[ $f ] = $notification[ 'cust_' . $f ];
1154
-				} else if ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) {
1155
-					$atts[ $f ] = '[' . $atts[ $f ] . ']';
1150
+			if ( isset( $notification[$f] ) ) {
1151
+				$atts[$f] = $notification[$f];
1152
+				if ( 'custom' == $notification[$f] ) {
1153
+					$atts[$f] = $notification['cust_' . $f];
1154
+				} else if ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) {
1155
+					$atts[$f] = '[' . $atts[$f] . ']';
1156 1156
                 }
1157 1157
             }
1158 1158
             unset( $f, $val );
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
 		$atts['event'] = array( 'create' );
1163 1163
         if ( isset( $notification['update_email'] ) && 1 == $notification['update_email'] ) {
1164 1164
             $atts['event'][] = 'update';
1165
-        } else if ( isset($notification['update_email']) && 2 == $notification['update_email'] ) {
1165
+        } else if ( isset( $notification['update_email'] ) && 2 == $notification['update_email'] ) {
1166 1166
 			$atts['event'] = array( 'update' );
1167 1167
         }
1168 1168
     }
@@ -1183,18 +1183,18 @@  discard block
 block discarded – undo
1183 1183
         foreach ( $atts['email_to'] as $key => $email_field ) {
1184 1184
 
1185 1185
             if ( is_numeric( $email_field ) ) {
1186
-				$atts['email_to'][ $key ] = '[' . $email_field . ']';
1186
+				$atts['email_to'][$key] = '[' . $email_field . ']';
1187 1187
             }
1188 1188
 
1189
-            if ( strpos( $email_field, '|') ) {
1189
+            if ( strpos( $email_field, '|' ) ) {
1190 1190
                 $email_opt = explode( '|', $email_field );
1191 1191
                 if ( isset( $email_opt[0] ) ) {
1192
-					$atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']';
1192
+					$atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']';
1193 1193
                 }
1194 1194
                 unset( $email_opt );
1195 1195
             }
1196 1196
         }
1197
-        $atts['email_to'] = implode(', ', $atts['email_to']);
1197
+        $atts['email_to'] = implode( ', ', $atts['email_to'] );
1198 1198
     }
1199 1199
 
1200 1200
     private static function setup_new_notification( &$new_notification, $notification, $atts ) {
@@ -1210,12 +1210,12 @@  discard block
 block discarded – undo
1210 1210
         // Add more fields to the new notification
1211 1211
         $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' );
1212 1212
         foreach ( $add_fields as $add_field ) {
1213
-			if ( isset( $notification[ $add_field ] ) ) {
1214
-				$new_notification['post_content'][ $add_field ] = $notification[ $add_field ];
1213
+			if ( isset( $notification[$add_field] ) ) {
1214
+				$new_notification['post_content'][$add_field] = $notification[$add_field];
1215 1215
             } else if ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) {
1216
-				$new_notification['post_content'][ $add_field ] = 0;
1216
+				$new_notification['post_content'][$add_field] = 0;
1217 1217
             } else {
1218
-				$new_notification['post_content'][ $add_field ] = '';
1218
+				$new_notification['post_content'][$add_field] = '';
1219 1219
             }
1220 1220
             unset( $add_field );
1221 1221
         }
@@ -1239,26 +1239,26 @@  discard block
 block discarded – undo
1239 1239
 		if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) {
1240 1240
 			foreach ( $post_content['conditions'] as $email_key => $val ) {
1241 1241
 				if ( is_numeric( $email_key ) ) {
1242
-					$post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) );
1242
+					$post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) );
1243 1243
 				}
1244
-				unset( $email_key, $val);
1244
+				unset( $email_key, $val );
1245 1245
 			}
1246 1246
 		}
1247 1247
 	}
1248 1248
 
1249 1249
     private static function migrate_autoresponder_to_action( $form_options, $form_id, &$notifications ) {
1250
-        if ( isset($form_options['auto_responder']) && $form_options['auto_responder'] && isset($form_options['ar_email_message']) && $form_options['ar_email_message'] ) {
1250
+        if ( isset( $form_options['auto_responder'] ) && $form_options['auto_responder'] && isset( $form_options['ar_email_message'] ) && $form_options['ar_email_message'] ) {
1251 1251
             // migrate autoresponder
1252 1252
 
1253
-            $email_field = isset($form_options['ar_email_to']) ? $form_options['ar_email_to'] : 0;
1254
-            if ( strpos($email_field, '|') ) {
1253
+            $email_field = isset( $form_options['ar_email_to'] ) ? $form_options['ar_email_to'] : 0;
1254
+            if ( strpos( $email_field, '|' ) ) {
1255 1255
                 // data from entries field
1256
-                $email_field = explode('|', $email_field);
1257
-                if ( isset($email_field[1]) ) {
1256
+                $email_field = explode( '|', $email_field );
1257
+                if ( isset( $email_field[1] ) ) {
1258 1258
                     $email_field = $email_field[1];
1259 1259
                 }
1260 1260
             }
1261
-            if ( is_numeric($email_field) && ! empty($email_field) ) {
1261
+            if ( is_numeric( $email_field ) && ! empty( $email_field ) ) {
1262 1262
 				$email_field = '[' . $email_field . ']';
1263 1263
             }
1264 1264
 
@@ -1266,16 +1266,16 @@  discard block
 block discarded – undo
1266 1266
             $new_notification2 = array(
1267 1267
                 'post_content'  => array(
1268 1268
                     'email_message' => $notification['ar_email_message'],
1269
-                    'email_subject' => isset($notification['ar_email_subject']) ? $notification['ar_email_subject'] : '',
1269
+                    'email_subject' => isset( $notification['ar_email_subject'] ) ? $notification['ar_email_subject'] : '',
1270 1270
                     'email_to'      => $email_field,
1271
-                    'plain_text'    => isset($notification['ar_plain_text']) ? $notification['ar_plain_text'] : 0,
1271
+                    'plain_text'    => isset( $notification['ar_plain_text'] ) ? $notification['ar_plain_text'] : 0,
1272 1272
                     'inc_user_info' => 0,
1273 1273
                 ),
1274 1274
 				'post_name'     => $form_id . '_email_' . count( $notifications ),
1275 1275
             );
1276 1276
 
1277
-            $reply_to = isset($notification['ar_reply_to']) ? $notification['ar_reply_to'] : '';
1278
-            $reply_to_name = isset($notification['ar_reply_to_name']) ? $notification['ar_reply_to_name'] : '';
1277
+            $reply_to = isset( $notification['ar_reply_to'] ) ? $notification['ar_reply_to'] : '';
1278
+            $reply_to_name = isset( $notification['ar_reply_to_name'] ) ? $notification['ar_reply_to_name'] : '';
1279 1279
 
1280 1280
 			if ( ! empty( $reply_to ) ) {
1281 1281
 				$new_notification2['post_content']['reply_to'] = $reply_to;
Please login to merge, or discard this patch.
classes/views/shared/mb_adv_info.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -44,15 +44,15 @@  discard block
 block discarded – undo
44 44
 
45 45
 				if ( $f->type == 'data' ) {
46 46
 					//get all fields from linked form
47
-                    if ( isset($f->field_options['form_select']) && is_numeric($f->field_options['form_select']) ) {
47
+					if ( isset($f->field_options['form_select']) && is_numeric($f->field_options['form_select']) ) {
48 48
 						$linked_form = FrmDb::get_var( $wpdb->prefix . 'frm_fields', array( 'id' => $f->field_options['form_select'] ), 'form_id' );
49
-                        if ( ! in_array( $linked_form, $linked_forms ) ) {
50
-                            $linked_forms[] = $linked_form;
49
+						if ( ! in_array( $linked_form, $linked_forms ) ) {
50
+							$linked_forms[] = $linked_form;
51 51
 							$linked_fields = FrmField::getAll( array(
52 52
 								'fi.type not' => FrmField::no_save_fields(),
53 53
 								'fi.form_id'  => $linked_form,
54 54
 							) );
55
-                            $ldfe = '';
55
+							$ldfe = '';
56 56
 							if ( $linked_fields ) {
57 57
 								foreach ( $linked_fields as $linked_field ) {
58 58
 									FrmAppHelper::insert_opt_html( array(
@@ -62,16 +62,16 @@  discard block
 block discarded – undo
62 62
 										'type' => $linked_field->type,
63 63
 									) );
64 64
 
65
-                                    $ldfe = $linked_field->id;
66
-                                    unset($linked_field);
67
-                                }
68
-                            }
69
-                        }
70
-                    }
71
-                    $dfe = $f->id;
72
-        	    }
73
-                unset($f);
74
-                }
65
+									$ldfe = $linked_field->id;
66
+									unset($linked_field);
67
+								}
68
+							}
69
+						}
70
+					}
71
+					$dfe = $f->id;
72
+				}
73
+				unset($f);
74
+				}
75 75
 			}
76 76
 			?>
77 77
         </ul>
@@ -79,27 +79,27 @@  discard block
 block discarded – undo
79 79
         <?php esc_html_e( 'Helpers', 'formidable' ) ?>:
80 80
         <ul class="frm_code_list">
81 81
         <?php
82
-        $col = 'one';
82
+		$col = 'one';
83 83
 		foreach ( $entry_shortcodes as $skey => $sname ) {
84 84
 			if ( empty( $skey ) ) {
85
-                 $col = 'one';
86
-                 echo '<li class="clear frm_block"></li>';
87
-                 continue;
88
-            }
85
+				 $col = 'one';
86
+				 echo '<li class="clear frm_block"></li>';
87
+				 continue;
88
+			}
89 89
 
90 90
 			$classes = ( in_array( $skey, array( 'siteurl', 'sitename', 'entry_count' ) ) ) ? 'show_before_content show_after_content' : '';
91 91
 			$classes .= ( strpos( $skey, 'default-' ) === 0 ) ? 'hide_frm_not_email_subject' : '';
92
-        ?>
92
+		?>
93 93
         <li class="frm_col_<?php echo esc_attr( $col ) ?>">
94 94
 			<a href="javascript:void(0)" class="frmbutton button <?php echo esc_attr( $classes ); ?> frm_insert_code" data-code="<?php echo esc_attr( $skey ) ?>">
95 95
 				<?php echo esc_html( $sname ) ?>
96 96
 			</a>
97 97
         </li>
98 98
         <?php
99
-            $col = ( $col == 'one' ) ? 'two' : 'one';
99
+			$col = ( $col == 'one' ) ? 'two' : 'one';
100 100
 			unset( $skey, $sname, $classes );
101
-        }
102
-        ?>
101
+		}
102
+		?>
103 103
         </ul>
104 104
 	</div>
105 105
 
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
 	    <ul class="frm_code_list frm_full_width">
114 114
 			<?php
115 115
 			if ( ! empty( $fields ) ) {
116
-		        foreach ( $fields as $f ) {
116
+				foreach ( $fields as $f ) {
117 117
 					if ( FrmField::is_no_save_field( $f->type ) || ( $f->type == 'data' && ( ! isset( $f->field_options['data_type'] ) || $f->field_options['data_type'] == 'data' || $f->field_options['data_type'] == '' ) ) ) {
118
-                        continue;
119
-                }
120
-            ?>
118
+						continue;
119
+				}
120
+			?>
121 121
                 <li>
122 122
                     <a href="javascript:void(0)" class="frmids alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->id ) ?>]<?php esc_attr_e( 'Conditional text here', 'formidable' ) ?>[/if <?php echo esc_attr( $f->id ) ?>">[if <?php echo (int) $f->id ?>]</a>
123 123
                 	<a href="javascript:void(0)" class="frmkeys alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->field_key ) ?>]something[/if <?php echo esc_attr( $f->field_key ) ?>">[if <?php echo FrmAppHelper::truncate($f->field_key, 10) ?>]</a>
@@ -139,17 +139,17 @@  discard block
 block discarded – undo
139 139
         <p class="howto"><?php esc_html_e( 'Click a button below to insert sample logic into your view', 'formidable' ) ?></p>
140 140
         <ul class="frm_code_list">
141 141
         <?php
142
-        $col = 'one';
142
+		$col = 'one';
143 143
 		foreach ( $cond_shortcodes as $skey => $sname ) {
144
-	    ?>
144
+		?>
145 145
 	    <li class="frm_col_<?php echo esc_attr( $col ) ?>">
146 146
 	        <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="if x <?php echo esc_attr($skey) ?>][/if x"><?php echo esc_html( $sname ) ?></a>
147 147
 	    </li>
148 148
 	    <?php
149
-	        $col = ( $col == 'one' ) ? 'two' : 'one';
150
-	        unset($skey, $sname);
151
-	    }
152
-        ?>
149
+			$col = ( $col == 'one' ) ? 'two' : 'one';
150
+			unset($skey, $sname);
151
+		}
152
+		?>
153 153
         </ul>
154 154
 	</div>
155 155
 	<?php } ?>
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 	<div id="frm-adv-info-tab" class="tabs-panel">
158 158
 		<ul class="frm_code_list">
159 159
         <?php
160
-        $col = 'one';
160
+		$col = 'one';
161 161
 		foreach ( $adv_shortcodes as $skey => $sname ) {
162
-	    ?>
162
+		?>
163 163
 	    <li class="frm_col_<?php echo esc_attr( $col ) ?>">
164 164
 			<a href="javascript:void(0)" class="frmbutton button frm_insert_code <?php echo is_array( $sname ) ? 'frm_help' : ''; ?>" data-code="x <?php echo esc_attr( $skey ) ?>" <?php echo is_array( $sname ) ? 'title="' . esc_attr( $sname['title'] ) . '"' : ''; ?>>
165 165
 				<?php echo is_array( $sname ) ? $sname['label'] : $sname; ?>
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	    </li>
168 168
 		<?php
169 169
 			$col = ( $col == 'one' ) ? 'two' : 'one';
170
-	        unset( $skey, $sname );
170
+			unset( $skey, $sname );
171 171
 		}
172 172
 		?>
173 173
 		<?php if ( isset( $file ) ) { ?>
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 		?>
206 206
         </ul>
207 207
 		<?php
208
-        }
208
+		}
209 209
 
210 210
 		if ( isset( $repeat_field ) ) {
211 211
 		?>
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
         	    </li>
218 218
             </ul>
219 219
         <?php
220
-        }
220
+		}
221 221
 
222 222
 		if ( isset( $dfe ) ) {
223
-        ?>
223
+		?>
224 224
 
225 225
         <div class="clear"></div>
226 226
         <p class="howto"><?php esc_html_e( 'Dynamic field options', 'formidable' ); ?></p>
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 	</div>
240 240
 
241 241
     <?php
242
-    if ( $settings_tab ) {
242
+	if ( $settings_tab ) {
243 243
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/mb_html_tab.php' );
244
-    }
245
-    ?>
244
+	}
245
+	?>
246 246
 </div>
Please login to merge, or discard this patch.
classes/views/frm-entries/show.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -14,21 +14,21 @@  discard block
 block discarded – undo
14 14
                     <div class="inside">
15 15
                         <table class="form-table"><tbody>
16 16
                         <?php
17
-                        $first_h3 = 'frm_first_h3';
18
-                        foreach ( $fields as $field ) {
17
+						$first_h3 = 'frm_first_h3';
18
+						foreach ( $fields as $field ) {
19 19
 							if ( in_array( $field->type, array( 'captcha', 'html', 'end_divider', 'form' ) ) ) {
20
-                                continue;
21
-                            }
20
+								continue;
21
+							}
22 22
 
23
-                            if ( in_array($field->type, array( 'break', 'divider' ) ) ) {
24
-                            ?>
23
+							if ( in_array($field->type, array( 'break', 'divider' ) ) ) {
24
+							?>
25 25
                         </tbody></table>
26 26
                         <br/><h3 class="<?php echo esc_attr( $first_h3 ) ?>"><?php echo esc_html( $field->name ) ?></h3>
27 27
                         <table class="form-table"><tbody>
28 28
                         <?php
29
-                                $first_h3 = '';
30
-                            } else {
31
-                        ?>
29
+								$first_h3 = '';
30
+							} else {
31
+						?>
32 32
                         <tr>
33 33
                             <th scope="row"><?php echo esc_html( $field->name ) ?>:</th>
34 34
                             <td>
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
 							$display_value = FrmEntriesHelper::prepare_display_value( $entry, $field, $atts );
46 46
 							echo $display_value;
47 47
 
48
-                            if ( is_email($display_value) && ! in_array($display_value, $to_emails) ) {
49
-                                $to_emails[] = $display_value;
50
-                            }
51
-                            ?>
48
+							if ( is_email($display_value) && ! in_array($display_value, $to_emails) ) {
49
+								$to_emails[] = $display_value;
50
+							}
51
+							?>
52 52
                             </td>
53 53
                         </tr>
54 54
 						<?php
55 55
 							}
56
-                        }
56
+						}
57 57
 
58
-                        ?>
58
+						?>
59 59
 
60 60
                         <?php if ( $entry->parent_item_id ) { ?>
61 61
                         <tr><th><?php esc_html_e( 'Parent Entry ID', 'formidable' ); ?>:</th>
Please login to merge, or discard this patch.
classes/views/frm-entries/sidebar-shared.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
         <div class="misc-pub-section">
7 7
             <span class="dashicons dashicons-admin-post wp-media-buttons-icon"></span>
8 8
             <?php esc_html_e( 'Post', 'formidable' ) ?>:
9
-            <b><?php echo get_the_title($entry->post_id) ?></b>
9
+            <b><?php echo get_the_title( $entry->post_id ) ?></b>
10 10
 			<span>
11 11
 				<a href="<?php echo esc_url( admin_url( 'post.php?post=' . $entry->post_id . '&action=edit' ) ) ?>">
12 12
 					<?php esc_html_e( 'Edit', 'formidable' ) ?>
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         </div>
67 67
         <?php } ?>
68 68
 
69
-        <?php if ( isset($data['referrer']) ) { ?>
69
+        <?php if ( isset( $data['referrer'] ) ) { ?>
70 70
         <div class="misc-pub-section">
71 71
 			<b><?php esc_html_e( 'Referrer', 'formidable' ) ?></b>:<br/>
72 72
 			<?php echo wp_kses_post( str_replace( "\r\n", '<br/>', $data['referrer'] ) ); ?>
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 			<?php echo wp_kses_post( implode( ', ', (array) $d ) ); ?>
85 85
         </div>
86 86
         <?php
87
-            unset($k, $d);
87
+            unset( $k, $d );
88 88
         }
89 89
         ?>
90 90
     </div>
Please login to merge, or discard this patch.
classes/views/frm-entries/_sidebar-shared-pub.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 if ( ! isset( $entry) ) {
3
-    $entry = $record;
3
+	$entry = $record;
4 4
 } ?>
5 5
 
6 6
 <div class="misc-pub-section curtime misc-pub-curtime">
7 7
     <span id="timestamp">
8 8
     <?php
9
-    $date_format = __( 'M j, Y @ G:i' );
9
+	$date_format = __( 'M j, Y @ G:i' );
10 10
 	printf( esc_html__( 'Published on: %1$s' ), '<b>' . FrmAppHelper::get_localized_date( $date_format, $entry->created_at ) . '</b>' );
11 11
 	?>
12 12
     </span>
Please login to merge, or discard this patch.