Completed
Push — master ( d763a3...2e2e06 )
by Stephanie
03:24
created
classes/helpers/FrmFieldsHelper.php 2 patches
Indentation   +814 added lines, -814 removed lines patch added patch discarded remove patch
@@ -7,71 +7,71 @@  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 ( 'data' == $type ) {
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
-            $values['options'] = serialize( array(
47
-                '', __( 'Option 1', 'formidable' ),
48
-            ) );
49
-        } else if ( $type == 'textarea' ) {
50
-            $values['field_options']['max'] = '5';
51
-        } else if ( $type == 'captcha' ) {
52
-            $frm_settings = FrmAppHelper::get_settings();
53
-            $values['invalid'] = $frm_settings->re_msg;
54
-        } else if ( 'url' == $type ) {
55
-            $values['name'] = __( 'Website', 'formidable' );
56
-        }
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 ( 'data' == $type ) {
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
+			$values['options'] = serialize( array(
47
+				'', __( 'Option 1', 'formidable' ),
48
+			) );
49
+		} else if ( $type == 'textarea' ) {
50
+			$values['field_options']['max'] = '5';
51
+		} else if ( $type == 'captcha' ) {
52
+			$frm_settings = FrmAppHelper::get_settings();
53
+			$values['invalid'] = $frm_settings->re_msg;
54
+		} else if ( 'url' == $type ) {
55
+			$values['name'] = __( 'Website', 'formidable' );
56
+		}
57 57
 
58 58
 		$fields = FrmField::field_selection();
59
-        $fields = array_merge($fields, FrmField::pro_field_selection());
59
+		$fields = array_merge($fields, FrmField::pro_field_selection());
60 60
 
61
-        if ( isset( $fields[ $type ] ) ) {
62
-            $values['name'] = is_array( $fields[ $type ] ) ? $fields[ $type ]['name'] : $fields[ $type ];
63
-        }
61
+		if ( isset( $fields[ $type ] ) ) {
62
+			$values['name'] = is_array( $fields[ $type ] ) ? $fields[ $type ]['name'] : $fields[ $type ];
63
+		}
64 64
 
65
-        unset($fields);
65
+		unset($fields);
66 66
 
67
-        return $values;
68
-    }
67
+		return $values;
68
+	}
69 69
 
70 70
 	public static function get_html_id( $field, $plus = '' ) {
71
-        return apply_filters('frm_field_html_id', 'field_'. $field['field_key'] . $plus, $field);
72
-    }
71
+		return apply_filters('frm_field_html_id', 'field_'. $field['field_key'] . $plus, $field);
72
+	}
73 73
 
74
-    public static function setup_edit_vars( $record, $doing_ajax = false ) {
74
+	public static function setup_edit_vars( $record, $doing_ajax = false ) {
75 75
 		$values = array( 'id' => $record->id, 'form_id' => $record->form_id );
76 76
 		$defaults = array(
77 77
 			'name'          => $record->name,
@@ -84,86 +84,86 @@  discard block
 block discarded – undo
84 84
 		);
85 85
 
86 86
 		if ( $doing_ajax ) {
87
-            $values = $values + $defaults;
88
-            $values['form_name'] = '';
87
+			$values = $values + $defaults;
88
+			$values['form_name'] = '';
89 89
 		} else {
90 90
 			foreach ( $defaults as $var => $default ) {
91
-                $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' );
92
-                unset($var, $default);
93
-            }
91
+				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' );
92
+				unset($var, $default);
93
+			}
94 94
 
95 95
 			$values['form_name'] = $record->form_id ? FrmForm::getName( $record->form_id ) : '';
96
-        }
96
+		}
97 97
 
98 98
 		unset( $defaults );
99 99
 
100
-        $values['options'] = $record->options;
101
-        $values['field_options'] = $record->field_options;
100
+		$values['options'] = $record->options;
101
+		$values['field_options'] = $record->field_options;
102 102
 
103
-        $defaults = self::get_default_field_opts($values['type'], $record, true);
103
+		$defaults = self::get_default_field_opts($values['type'], $record, true);
104 104
 
105 105
 		if ( $values['type'] == 'captcha' ) {
106
-            $frm_settings = FrmAppHelper::get_settings();
107
-            $defaults['invalid'] = $frm_settings->re_msg;
108
-        }
106
+			$frm_settings = FrmAppHelper::get_settings();
107
+			$defaults['invalid'] = $frm_settings->re_msg;
108
+		}
109 109
 
110 110
 		foreach ( $defaults as $opt => $default ) {
111
-            $values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default;
112
-            unset($opt, $default);
113
-        }
111
+			$values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default;
112
+			unset($opt, $default);
113
+		}
114 114
 
115
-        $values['custom_html'] = (isset($record->field_options['custom_html'])) ? $record->field_options['custom_html'] : self::get_default_html($record->type);
115
+		$values['custom_html'] = (isset($record->field_options['custom_html'])) ? $record->field_options['custom_html'] : self::get_default_html($record->type);
116 116
 
117 117
 		return apply_filters( 'frm_setup_edit_field_vars', $values, array( 'doing_ajax' => $doing_ajax ) );
118
-    }
118
+	}
119 119
 
120
-    public static function get_default_field_opts( $type, $field, $limit = false ) {
121
-        $field_options = array(
122
-            'size' => '', 'max' => '', 'label' => '', 'blank' => '',
123
-            'required_indicator' => '*', 'invalid' => '', 'separate_value' => 0,
124
-            'clear_on_focus' => 0, 'default_blank' => 0, 'classes' => '',
120
+	public static function get_default_field_opts( $type, $field, $limit = false ) {
121
+		$field_options = array(
122
+			'size' => '', 'max' => '', 'label' => '', 'blank' => '',
123
+			'required_indicator' => '*', 'invalid' => '', 'separate_value' => 0,
124
+			'clear_on_focus' => 0, 'default_blank' => 0, 'classes' => '',
125 125
 			'custom_html' => '', 'captcha_size' => 'default',
126
-        );
126
+		);
127 127
 
128 128
 		if ( $limit ) {
129
-            return $field_options;
129
+			return $field_options;
130 130
 		}
131 131
 
132
-        global $wpdb;
132
+		global $wpdb;
133 133
 
134
-        $form_id = (is_numeric($field)) ? $field : $field->form_id;
134
+		$form_id = (is_numeric($field)) ? $field : $field->form_id;
135 135
 
136
-        $key = is_numeric($field) ? FrmAppHelper::get_unique_key('', $wpdb->prefix .'frm_fields', 'field_key') : $field->field_key;
136
+		$key = is_numeric($field) ? FrmAppHelper::get_unique_key('', $wpdb->prefix .'frm_fields', 'field_key') : $field->field_key;
137 137
 
138
-        $field_count = FrmDb::get_var( 'frm_fields', array( 'form_id' => $form_id ), 'field_order', array( 'order_by' => 'field_order DESC' ) );
138
+		$field_count = FrmDb::get_var( 'frm_fields', array( 'form_id' => $form_id ), 'field_order', array( 'order_by' => 'field_order DESC' ) );
139 139
 
140
-        $frm_settings = FrmAppHelper::get_settings();
141
-        return array(
142
-            'name' => __( 'Untitled', 'formidable' ), 'description' => '',
140
+		$frm_settings = FrmAppHelper::get_settings();
141
+		return array(
142
+			'name' => __( 'Untitled', 'formidable' ), 'description' => '',
143 143
 			'field_key' => $key, 'type' => $type, 'options' => '', 'default_value' => '',
144 144
 			'field_order' => $field_count + 1, 'required' => false,
145
-            'blank' => $frm_settings->blank_msg, 'unique_msg' => $frm_settings->unique_msg,
146
-            'invalid' => __( 'This field is invalid', 'formidable' ), 'form_id' => $form_id,
145
+			'blank' => $frm_settings->blank_msg, 'unique_msg' => $frm_settings->unique_msg,
146
+			'invalid' => __( 'This field is invalid', 'formidable' ), 'form_id' => $form_id,
147 147
 			'field_options' => $field_options,
148
-        );
149
-    }
148
+		);
149
+	}
150 150
 
151
-    public static function fill_field( &$values, $field, $form_id, $new_key = '' ) {
152
-        global $wpdb;
151
+	public static function fill_field( &$values, $field, $form_id, $new_key = '' ) {
152
+		global $wpdb;
153 153
 
154
-        $values['field_key'] = FrmAppHelper::get_unique_key($new_key, $wpdb->prefix .'frm_fields', 'field_key');
155
-        $values['form_id'] = $form_id;
156
-        $values['options'] = maybe_serialize($field->options);
157
-        $values['default_value'] = maybe_serialize($field->default_value);
154
+		$values['field_key'] = FrmAppHelper::get_unique_key($new_key, $wpdb->prefix .'frm_fields', 'field_key');
155
+		$values['form_id'] = $form_id;
156
+		$values['options'] = maybe_serialize($field->options);
157
+		$values['default_value'] = maybe_serialize($field->default_value);
158 158
 
159
-        foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
160
-            $values[ $col ] = $field->{$col};
161
-        }
162
-    }
159
+		foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
160
+			$values[ $col ] = $field->{$col};
161
+		}
162
+	}
163 163
 
164
-    /**
165
-     * @since 2.0
166
-     */
164
+	/**
165
+	 * @since 2.0
166
+	 */
167 167
 	public static function get_error_msg( $field, $error ) {
168 168
 		$frm_settings = FrmAppHelper::get_settings();
169 169
 		$default_settings = $frm_settings->default_options();
@@ -180,21 +180,21 @@  discard block
 block discarded – undo
180 180
 		return $msg;
181 181
 	}
182 182
 
183
-    public static function get_form_fields( $form_id, $error = false ) {
184
-        $fields = FrmField::get_all_for_form($form_id);
185
-        $fields = apply_filters('frm_get_paged_fields', $fields, $form_id, $error);
186
-        return $fields;
187
-    }
183
+	public static function get_form_fields( $form_id, $error = false ) {
184
+		$fields = FrmField::get_all_for_form($form_id);
185
+		$fields = apply_filters('frm_get_paged_fields', $fields, $form_id, $error);
186
+		return $fields;
187
+	}
188 188
 
189 189
 	public static function get_default_html( $type = 'text' ) {
190 190
 		if ( apply_filters( 'frm_normal_field_type_html', true, $type ) ) {
191 191
 			$input = ( in_array( $type, array( 'radio', 'checkbox', 'data' ) ) ) ? '<div class="frm_opt_container">[input]</div>' : '[input]';
192
-            $for = '';
192
+			$for = '';
193 193
 			if ( ! in_array( $type, array( 'radio', 'checkbox', 'data', 'scale' ) ) ) {
194
-                $for = 'for="field_[key]"';
195
-            }
194
+				$for = 'for="field_[key]"';
195
+			}
196 196
 
197
-            $default_html = <<<DEFAULT_HTML
197
+			$default_html = <<<DEFAULT_HTML
198 198
 <div id="frm_field_[id]_container" class="frm_form_field form-field [required_class][error_class]">
199 199
     <label $for class="frm_primary_label">[field_name]
200 200
         <span class="frm_required">[required_label]</span>
@@ -204,145 +204,145 @@  discard block
 block discarded – undo
204 204
     [if error]<div class="frm_error">[error]</div>[/if error]
205 205
 </div>
206 206
 DEFAULT_HTML;
207
-        } else {
207
+		} else {
208 208
 			$default_html = apply_filters('frm_other_custom_html', '', $type);
209
-        }
209
+		}
210 210
 
211
-        return apply_filters('frm_custom_html', $default_html, $type);
212
-    }
211
+		return apply_filters('frm_custom_html', $default_html, $type);
212
+	}
213 213
 
214 214
 	public static function replace_shortcodes( $html, $field, $errors = array(), $form = false, $args = array() ) {
215
-        $html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form);
216
-
217
-        $defaults = array(
218
-            'field_name'  => 'item_meta['. $field['id'] .']',
219
-            'field_id'    => $field['id'],
220
-            'field_plus_id' => '',
221
-            'section_id'    => '',
222
-        );
223
-        $args = wp_parse_args($args, $defaults);
224
-        $field_name = $args['field_name'];
225
-        $field_id = $args['field_id'];
226
-        $html_id = self::get_html_id($field, $args['field_plus_id']);
227
-
228
-        if ( FrmField::is_multiple_select($field) ) {
229
-            $field_name .= '[]';
230
-        }
231
-
232
-        //replace [id]
233
-        $html = str_replace('[id]', $field_id, $html);
234
-
235
-        // Remove the for attribute for captcha
236
-        if ( $field['type'] == 'captcha' ) {
237
-            $html = str_replace(' for="field_[key]"', '', $html);
238
-        }
239
-
240
-        // set the label for
241
-        $html = str_replace('field_[key]', $html_id, $html);
242
-
243
-        //replace [key]
244
-        $html = str_replace('[key]', $field['field_key'], $html);
245
-
246
-        //replace [description] and [required_label] and [error]
215
+		$html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form);
216
+
217
+		$defaults = array(
218
+			'field_name'  => 'item_meta['. $field['id'] .']',
219
+			'field_id'    => $field['id'],
220
+			'field_plus_id' => '',
221
+			'section_id'    => '',
222
+		);
223
+		$args = wp_parse_args($args, $defaults);
224
+		$field_name = $args['field_name'];
225
+		$field_id = $args['field_id'];
226
+		$html_id = self::get_html_id($field, $args['field_plus_id']);
227
+
228
+		if ( FrmField::is_multiple_select($field) ) {
229
+			$field_name .= '[]';
230
+		}
231
+
232
+		//replace [id]
233
+		$html = str_replace('[id]', $field_id, $html);
234
+
235
+		// Remove the for attribute for captcha
236
+		if ( $field['type'] == 'captcha' ) {
237
+			$html = str_replace(' for="field_[key]"', '', $html);
238
+		}
239
+
240
+		// set the label for
241
+		$html = str_replace('field_[key]', $html_id, $html);
242
+
243
+		//replace [key]
244
+		$html = str_replace('[key]', $field['field_key'], $html);
245
+
246
+		//replace [description] and [required_label] and [error]
247 247
 		$required = FrmField::is_required( $field ) ? $field['required_indicator'] : '';
248
-        if ( ! is_array( $errors ) ) {
249
-            $errors = array();
250
-        }
248
+		if ( ! is_array( $errors ) ) {
249
+			$errors = array();
250
+		}
251 251
 		$error = isset( $errors[ 'field' . $field_id ] ) ? $errors[ 'field' . $field_id ] : false;
252 252
 
253
-        //If field type is section heading, add class so a bottom margin can be added to either the h3 or description
254
-        if ( $field['type'] == 'divider' ) {
255
-            if ( FrmField::is_option_true( $field, 'description' ) ) {
256
-                $html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html );
257
-            } else {
258
-                $html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html);
259
-            }
260
-        }
253
+		//If field type is section heading, add class so a bottom margin can be added to either the h3 or description
254
+		if ( $field['type'] == 'divider' ) {
255
+			if ( FrmField::is_option_true( $field, 'description' ) ) {
256
+				$html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html );
257
+			} else {
258
+				$html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html);
259
+			}
260
+		}
261 261
 
262 262
 		foreach ( array( 'description' => $field['description'], 'required_label' => $required, 'error' => $error ) as $code => $value ) {
263
-            self::remove_inline_conditions( ( $value && $value != '' ), $code, $value, $html );
264
-        }
263
+			self::remove_inline_conditions( ( $value && $value != '' ), $code, $value, $html );
264
+		}
265 265
 
266
-        //replace [required_class]
266
+		//replace [required_class]
267 267
 		$required_class = FrmField::is_required( $field ) ? ' frm_required_field' : '';
268
-        $html = str_replace('[required_class]', $required_class, $html);
268
+		$html = str_replace('[required_class]', $required_class, $html);
269 269
 
270
-        //replace [label_position]
271
-        $field['label'] = apply_filters('frm_html_label_position', $field['label'], $field, $form);
272
-        $field['label'] = ( $field['label'] && $field['label'] != '' ) ? $field['label'] : 'top';
270
+		//replace [label_position]
271
+		$field['label'] = apply_filters('frm_html_label_position', $field['label'], $field, $form);
272
+		$field['label'] = ( $field['label'] && $field['label'] != '' ) ? $field['label'] : 'top';
273 273
 		$html = str_replace( '[label_position]', ( ( in_array( $field['type'], array( 'divider', 'end_divider', 'break' ) ) ) ? $field['label'] : ' frm_primary_label' ), $html );
274 274
 
275
-        //replace [field_name]
276
-        $html = str_replace('[field_name]', $field['name'], $html);
275
+		//replace [field_name]
276
+		$html = str_replace('[field_name]', $field['name'], $html);
277 277
 
278
-        //replace [error_class]
278
+		//replace [error_class]
279 279
 		$error_class = isset( $errors[ 'field' . $field_id ] ) ? ' frm_blank_field' : '';
280 280
 		self::get_more_field_classes( $error_class, $field, $field_id, $html );
281 281
 		if ( $field['type'] == 'html' && strpos( $html, '[error_class]' ) === false ) {
282 282
 			// there is no error_class shortcode to use for addign fields
283 283
 			$html = str_replace( 'class="frm_form_field', 'class="frm_form_field ' . $error_class, $html );
284 284
 		}
285
-        $html = str_replace('[error_class]', $error_class, $html);
285
+		$html = str_replace('[error_class]', $error_class, $html);
286 286
 
287
-        //replace [entry_key]
288
-        $entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' );
289
-        $html = str_replace('[entry_key]', $entry_key, $html);
287
+		//replace [entry_key]
288
+		$entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' );
289
+		$html = str_replace('[entry_key]', $entry_key, $html);
290 290
 
291
-        //replace [input]
292
-        preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER);
293
-        global $frm_vars;
294
-        $frm_settings = FrmAppHelper::get_settings();
291
+		//replace [input]
292
+		preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER);
293
+		global $frm_vars;
294
+		$frm_settings = FrmAppHelper::get_settings();
295 295
 
296
-        foreach ( $shortcodes[0] as $short_key => $tag ) {
297
-            $atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] );
296
+		foreach ( $shortcodes[0] as $short_key => $tag ) {
297
+			$atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] );
298 298
 			$tag = self::get_shortcode_tag( $shortcodes, $short_key, array( 'conditional' => false, 'conditional_check' => false ) );
299 299
 
300
-            $replace_with = '';
300
+			$replace_with = '';
301 301
 
302
-            if ( $tag == 'input' ) {
303
-                if ( isset($atts['opt']) ) {
304
-                    $atts['opt']--;
305
-                }
302
+			if ( $tag == 'input' ) {
303
+				if ( isset($atts['opt']) ) {
304
+					$atts['opt']--;
305
+				}
306 306
 
307
-                $field['input_class'] = isset($atts['class']) ? $atts['class'] : '';
308
-                if ( isset($atts['class']) ) {
309
-                    unset($atts['class']);
310
-                }
307
+				$field['input_class'] = isset($atts['class']) ? $atts['class'] : '';
308
+				if ( isset($atts['class']) ) {
309
+					unset($atts['class']);
310
+				}
311 311
 
312
-                $field['shortcodes'] = $atts;
313
-                ob_start();
314
-                include(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/input.php');
315
-                $replace_with = ob_get_contents();
316
-                ob_end_clean();
317
-            } else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) {
318
-                $replace_with = FrmProEntriesController::entry_delete_link($atts);
319
-            }
312
+				$field['shortcodes'] = $atts;
313
+				ob_start();
314
+				include(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/input.php');
315
+				$replace_with = ob_get_contents();
316
+				ob_end_clean();
317
+			} else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) {
318
+				$replace_with = FrmProEntriesController::entry_delete_link($atts);
319
+			}
320 320
 
321
-            $html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html );
322
-        }
321
+			$html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html );
322
+		}
323 323
 
324 324
 		if ( $form ) {
325
-            $form = (array) $form;
325
+			$form = (array) $form;
326 326
 
327
-            //replace [form_key]
328
-            $html = str_replace('[form_key]', $form['form_key'], $html);
327
+			//replace [form_key]
328
+			$html = str_replace('[form_key]', $form['form_key'], $html);
329 329
 
330
-            //replace [form_name]
331
-            $html = str_replace('[form_name]', $form['name'], $html);
332
-        }
333
-        $html .= "\n";
330
+			//replace [form_name]
331
+			$html = str_replace('[form_name]', $form['name'], $html);
332
+		}
333
+		$html .= "\n";
334 334
 
335
-        //Return html if conf_field to prevent loop
336
-        if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) {
337
-            return $html;
338
-        }
335
+		//Return html if conf_field to prevent loop
336
+		if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) {
337
+			return $html;
338
+		}
339 339
 
340
-        //If field is in repeating section
341
-        if ( $args['section_id'] ) {
342
-            $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] ));
343
-        } else {
344
-            $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form ));
345
-        }
340
+		//If field is in repeating section
341
+		if ( $args['section_id'] ) {
342
+			$html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] ));
343
+		} else {
344
+			$html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form ));
345
+		}
346 346
 
347 347
 		self::remove_collapse_shortcode( $html );
348 348
 
@@ -350,18 +350,18 @@  discard block
 block discarded – undo
350 350
 			$html = do_shortcode( $html );
351 351
 		}
352 352
 
353
-        return $html;
354
-    }
353
+		return $html;
354
+	}
355 355
 
356 356
 	/**
357
-	* Add more classes to certain fields (like confirmation fields, other fields, repeating fields, etc.)
358
-	*
359
-	* @since 2.0
360
-	* @param $error_class string, pass by reference
361
-	* @param $field array
362
-	* @param $field_id int
363
-	* @param $html string
364
-	*/
357
+	 * Add more classes to certain fields (like confirmation fields, other fields, repeating fields, etc.)
358
+	 *
359
+	 * @since 2.0
360
+	 * @param $error_class string, pass by reference
361
+	 * @param $field array
362
+	 * @param $field_id int
363
+	 * @param $html string
364
+	 */
365 365
 	private static function get_more_field_classes( &$error_class, $field, $field_id, $html ) {
366 366
 		$error_class .= ' frm_'. $field['label'] .'_container';
367 367
 		if ( $field['id'] != $field_id ) {
@@ -425,46 +425,46 @@  discard block
 block discarded – undo
425 425
 		}
426 426
 	}
427 427
 
428
-    public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) {
429
-        if ( $no_vars ) {
430
-            $html = str_replace( '[if '. $code.']', '', $html );
431
-    	    $html = str_replace( '[/if '. $code.']', '', $html );
432
-        } else {
433
-            $html = preg_replace( '/(\[if\s+'. $code .'\])(.*?)(\[\/if\s+'. $code .'\])/mis', '', $html );
434
-        }
428
+	public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) {
429
+		if ( $no_vars ) {
430
+			$html = str_replace( '[if '. $code.']', '', $html );
431
+			$html = str_replace( '[/if '. $code.']', '', $html );
432
+		} else {
433
+			$html = preg_replace( '/(\[if\s+'. $code .'\])(.*?)(\[\/if\s+'. $code .'\])/mis', '', $html );
434
+		}
435 435
 
436
-        $html = str_replace( '['. $code .']', $replace_with, $html );
437
-    }
436
+		$html = str_replace( '['. $code .']', $replace_with, $html );
437
+	}
438 438
 
439 439
 	public static function get_shortcode_tag( $shortcodes, $short_key, $args ) {
440 440
 		$args = wp_parse_args( $args, array( 'conditional' => false, 'conditional_check' => false, 'foreach' => false ) );
441
-        if ( ( $args['conditional'] || $args['foreach'] ) && ! $args['conditional_check'] ) {
442
-            $args['conditional_check'] = true;
443
-        }
444
-
445
-        $prefix = '';
446
-        if ( $args['conditional_check'] ) {
447
-            if ( $args['conditional'] ) {
448
-                $prefix = 'if ';
449
-            } else if ( $args['foreach'] ) {
450
-                $prefix = 'foreach ';
451
-            }
452
-        }
453
-
454
-        $with_tags = $args['conditional_check'] ? 3 : 2;
455
-        if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
456
-            $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
457
-            $tag = str_replace(']', '', $tag);
458
-            $tags = explode(' ', $tag);
459
-            if ( is_array($tags) ) {
460
-                $tag = $tags[0];
461
-            }
462
-        } else {
463
-            $tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
464
-        }
465
-
466
-        return $tag;
467
-    }
441
+		if ( ( $args['conditional'] || $args['foreach'] ) && ! $args['conditional_check'] ) {
442
+			$args['conditional_check'] = true;
443
+		}
444
+
445
+		$prefix = '';
446
+		if ( $args['conditional_check'] ) {
447
+			if ( $args['conditional'] ) {
448
+				$prefix = 'if ';
449
+			} else if ( $args['foreach'] ) {
450
+				$prefix = 'foreach ';
451
+			}
452
+		}
453
+
454
+		$with_tags = $args['conditional_check'] ? 3 : 2;
455
+		if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
456
+			$tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
457
+			$tag = str_replace(']', '', $tag);
458
+			$tags = explode(' ', $tag);
459
+			if ( is_array($tags) ) {
460
+				$tag = $tags[0];
461
+			}
462
+		} else {
463
+			$tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
464
+		}
465
+
466
+		return $tag;
467
+	}
468 468
 
469 469
 	/**
470 470
 	 * Remove [collapse_this] if it's still included after all processing
@@ -477,128 +477,128 @@  discard block
 block discarded – undo
477 477
 	}
478 478
 
479 479
 	public static function display_recaptcha( $field ) {
480
-        $frm_settings = FrmAppHelper::get_settings();
481
-        $lang = apply_filters('frm_recaptcha_lang', $frm_settings->re_lang, $field);
480
+		$frm_settings = FrmAppHelper::get_settings();
481
+		$lang = apply_filters('frm_recaptcha_lang', $frm_settings->re_lang, $field);
482 482
 
483
-        $api_js_url = 'https://www.google.com/recaptcha/api.js?onload=frmRecaptcha&render=explicit';
484
-        if ( $lang != 'en' ) {
485
-            $api_js_url .= '&hl='. $lang;
486
-        }
487
-        $api_js_url = apply_filters('frm_recpatcha_js_url', $api_js_url);
483
+		$api_js_url = 'https://www.google.com/recaptcha/api.js?onload=frmRecaptcha&render=explicit';
484
+		if ( $lang != 'en' ) {
485
+			$api_js_url .= '&hl='. $lang;
486
+		}
487
+		$api_js_url = apply_filters('frm_recpatcha_js_url', $api_js_url);
488 488
 
489
-        wp_register_script('recaptcha-api', $api_js_url, '', true);
490
-        wp_enqueue_script('recaptcha-api');
489
+		wp_register_script('recaptcha-api', $api_js_url, '', true);
490
+		wp_enqueue_script('recaptcha-api');
491 491
 
492 492
 ?>
493 493
 <div id="field_<?php echo esc_attr( $field['field_key'] ) ?>" class="frm-g-recaptcha" data-sitekey="<?php echo esc_attr( $frm_settings->pubkey ) ?>" data-size="<?php echo esc_attr( $field['captcha_size'] ) ?>"></div>
494 494
 <?php
495
-    }
495
+	}
496 496
 
497 497
 	public static function show_single_option( $field ) {
498
-        $field_name = $field['name'];
499
-        $html_id = self::get_html_id($field);
500
-        foreach ( $field['options'] as $opt_key => $opt ) {
501
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
502
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
498
+		$field_name = $field['name'];
499
+		$html_id = self::get_html_id($field);
500
+		foreach ( $field['options'] as $opt_key => $opt ) {
501
+			$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
502
+			$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
503 503
 
504
-            // If this is an "Other" option, get the HTML for it
504
+			// If this is an "Other" option, get the HTML for it
505 505
 			if ( self::is_other_opt( $opt_key ) ) {
506
-                // Get string for Other text field, if needed
506
+				// Get string for Other text field, if needed
507 507
 				$other_val = self::get_other_val( compact( 'opt_key', 'field' ) );
508
-                require(FrmAppHelper::plugin_path() .'/pro/classes/views/frmpro-fields/other-option.php');
509
-            } else {
510
-                require(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/single-option.php');
511
-            }
512
-        }
513
-    }
508
+				require(FrmAppHelper::plugin_path() .'/pro/classes/views/frmpro-fields/other-option.php');
509
+			} else {
510
+				require(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/single-option.php');
511
+			}
512
+		}
513
+	}
514 514
 
515 515
 	public static function dropdown_categories( $args ) {
516 516
 		$defaults = array( 'field' => false, 'name' => false, 'show_option_all' => ' ' );
517
-        $args = wp_parse_args($args, $defaults);
517
+		$args = wp_parse_args($args, $defaults);
518 518
 
519
-        if ( ! $args['field'] ) {
520
-            return;
521
-        }
519
+		if ( ! $args['field'] ) {
520
+			return;
521
+		}
522 522
 
523
-        if ( ! $args['name'] ) {
524
-            $args['name'] = 'item_meta['. $args['field']['id'] .']';
525
-        }
523
+		if ( ! $args['name'] ) {
524
+			$args['name'] = 'item_meta['. $args['field']['id'] .']';
525
+		}
526 526
 
527
-        $id = self::get_html_id($args['field']);
528
-        $class = $args['field']['type'];
527
+		$id = self::get_html_id($args['field']);
528
+		$class = $args['field']['type'];
529 529
 
530
-        $exclude = (is_array($args['field']['exclude_cat'])) ? implode(',', $args['field']['exclude_cat']) : $args['field']['exclude_cat'];
531
-        $exclude = apply_filters('frm_exclude_cats', $exclude, $args['field']);
530
+		$exclude = (is_array($args['field']['exclude_cat'])) ? implode(',', $args['field']['exclude_cat']) : $args['field']['exclude_cat'];
531
+		$exclude = apply_filters('frm_exclude_cats', $exclude, $args['field']);
532 532
 
533
-        if ( is_array($args['field']['value']) ) {
534
-            if ( ! empty($exclude) ) {
535
-                $args['field']['value'] = array_diff($args['field']['value'], explode(',', $exclude));
536
-            }
537
-            $selected = reset($args['field']['value']);
538
-        } else {
539
-            $selected = $args['field']['value'];
540
-        }
533
+		if ( is_array($args['field']['value']) ) {
534
+			if ( ! empty($exclude) ) {
535
+				$args['field']['value'] = array_diff($args['field']['value'], explode(',', $exclude));
536
+			}
537
+			$selected = reset($args['field']['value']);
538
+		} else {
539
+			$selected = $args['field']['value'];
540
+		}
541 541
 
542
-        $tax_atts = array(
543
-            'show_option_all' => $args['show_option_all'], 'hierarchical' => 1, 'name' => $args['name'],
544
-            'id' => $id, 'exclude' => $exclude, 'class' => $class, 'selected' => $selected,
545
-            'hide_empty' => false, 'echo' => 0, 'orderby' => 'name',
546
-        );
542
+		$tax_atts = array(
543
+			'show_option_all' => $args['show_option_all'], 'hierarchical' => 1, 'name' => $args['name'],
544
+			'id' => $id, 'exclude' => $exclude, 'class' => $class, 'selected' => $selected,
545
+			'hide_empty' => false, 'echo' => 0, 'orderby' => 'name',
546
+		);
547 547
 
548
-        $tax_atts = apply_filters('frm_dropdown_cat', $tax_atts, $args['field']);
548
+		$tax_atts = apply_filters('frm_dropdown_cat', $tax_atts, $args['field']);
549 549
 
550
-        if ( FrmAppHelper::pro_is_installed() ) {
551
-            $post_type = FrmProFormsHelper::post_type($args['field']['form_id']);
552
-            $tax_atts['taxonomy'] = FrmProAppHelper::get_custom_taxonomy($post_type, $args['field']);
553
-            if ( ! $tax_atts['taxonomy'] ) {
554
-                return;
555
-            }
550
+		if ( FrmAppHelper::pro_is_installed() ) {
551
+			$post_type = FrmProFormsHelper::post_type($args['field']['form_id']);
552
+			$tax_atts['taxonomy'] = FrmProAppHelper::get_custom_taxonomy($post_type, $args['field']);
553
+			if ( ! $tax_atts['taxonomy'] ) {
554
+				return;
555
+			}
556 556
 
557
-            // If field type is dropdown (not Dynamic), exclude children when parent is excluded
558
-            if ( $args['field']['type'] != 'data' && is_taxonomy_hierarchical($tax_atts['taxonomy']) ) {
559
-                $tax_atts['exclude_tree'] = $exclude;
560
-            }
561
-        }
557
+			// If field type is dropdown (not Dynamic), exclude children when parent is excluded
558
+			if ( $args['field']['type'] != 'data' && is_taxonomy_hierarchical($tax_atts['taxonomy']) ) {
559
+				$tax_atts['exclude_tree'] = $exclude;
560
+			}
561
+		}
562 562
 
563
-        $dropdown = wp_dropdown_categories($tax_atts);
563
+		$dropdown = wp_dropdown_categories($tax_atts);
564 564
 
565
-        $add_html = FrmFieldsController::input_html($args['field'], false);
565
+		$add_html = FrmFieldsController::input_html($args['field'], false);
566 566
 
567
-        if ( FrmAppHelper::pro_is_installed() ) {
568
-            $add_html .= FrmProFieldsController::input_html($args['field'], false);
569
-        }
567
+		if ( FrmAppHelper::pro_is_installed() ) {
568
+			$add_html .= FrmProFieldsController::input_html($args['field'], false);
569
+		}
570 570
 
571 571
 		$dropdown = str_replace( "<select name='" . esc_attr( $args['name'] ) ."' id='" . esc_attr( $id ) . "' class='" . esc_attr( $class ) . "'", "<select name='" . esc_attr( $args['name'] ) . "' id='" . esc_attr( $id ) . "' " . $add_html, $dropdown );
572 572
 
573
-        if ( is_array($args['field']['value']) ) {
574
-            $skip = true;
575
-            foreach ( $args['field']['value'] as $v ) {
573
+		if ( is_array($args['field']['value']) ) {
574
+			$skip = true;
575
+			foreach ( $args['field']['value'] as $v ) {
576 576
 				if ( $skip ) {
577
-                    $skip = false;
578
-                    continue;
579
-                }
577
+					$skip = false;
578
+					continue;
579
+				}
580 580
 				$dropdown = str_replace(' value="' . esc_attr( $v ) . '"', ' value="' . esc_attr( $v ) . '" selected="selected"', $dropdown );
581
-                unset($v);
582
-            }
583
-        }
581
+				unset($v);
582
+			}
583
+		}
584 584
 
585
-        return $dropdown;
586
-    }
585
+		return $dropdown;
586
+	}
587 587
 
588 588
 	public static function get_term_link( $tax_id ) {
589
-        $tax = get_taxonomy($tax_id);
590
-        if ( ! $tax ) {
591
-            return;
592
-        }
589
+		$tax = get_taxonomy($tax_id);
590
+		if ( ! $tax ) {
591
+			return;
592
+		}
593 593
 
594
-        $link = sprintf(
595
-            __( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
596
-            '<a href="'. esc_url( admin_url( 'edit-tags.php?taxonomy='. $tax->name ) ) .'" target="_blank">'. ( empty($tax->labels->name) ? __( 'Categories' ) : $tax->labels->name ) .'</a>'
597
-        );
598
-        unset($tax);
594
+		$link = sprintf(
595
+			__( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
596
+			'<a href="'. esc_url( admin_url( 'edit-tags.php?taxonomy='. $tax->name ) ) .'" target="_blank">'. ( empty($tax->labels->name) ? __( 'Categories' ) : $tax->labels->name ) .'</a>'
597
+		);
598
+		unset($tax);
599 599
 
600
-        return $link;
601
-    }
600
+		return $link;
601
+	}
602 602
 
603 603
 	public static function value_meets_condition( $observed_value, $cond, $hide_opt ) {
604 604
 		// Remove white space from hide_opt
@@ -606,195 +606,195 @@  discard block
 block discarded – undo
606 606
 			$hide_opt = rtrim( $hide_opt );
607 607
 		}
608 608
 
609
-        if ( is_array($observed_value) ) {
610
-            return self::array_value_condition($observed_value, $cond, $hide_opt);
611
-        }
612
-
613
-        $m = false;
614
-        if ( $cond == '==' ) {
615
-            $m = $observed_value == $hide_opt;
616
-        } else if ( $cond == '!=' ) {
617
-            $m = $observed_value != $hide_opt;
618
-        } else if ( $cond == '>' ) {
619
-            $m = $observed_value > $hide_opt;
620
-        } else if ( $cond == '<' ) {
621
-            $m = $observed_value < $hide_opt;
622
-        } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
623
-            $m = stripos($observed_value, $hide_opt);
624
-            if ( $cond == 'not LIKE' ) {
625
-                $m = ( $m === false ) ? true : false;
626
-            } else {
627
-                $m = ( $m === false ) ? false : true;
628
-            }
629
-        }
630
-        return $m;
631
-    }
609
+		if ( is_array($observed_value) ) {
610
+			return self::array_value_condition($observed_value, $cond, $hide_opt);
611
+		}
612
+
613
+		$m = false;
614
+		if ( $cond == '==' ) {
615
+			$m = $observed_value == $hide_opt;
616
+		} else if ( $cond == '!=' ) {
617
+			$m = $observed_value != $hide_opt;
618
+		} else if ( $cond == '>' ) {
619
+			$m = $observed_value > $hide_opt;
620
+		} else if ( $cond == '<' ) {
621
+			$m = $observed_value < $hide_opt;
622
+		} else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
623
+			$m = stripos($observed_value, $hide_opt);
624
+			if ( $cond == 'not LIKE' ) {
625
+				$m = ( $m === false ) ? true : false;
626
+			} else {
627
+				$m = ( $m === false ) ? false : true;
628
+			}
629
+		}
630
+		return $m;
631
+	}
632 632
 
633 633
 	public static function array_value_condition( $observed_value, $cond, $hide_opt ) {
634
-        $m = false;
635
-        if ( $cond == '==' ) {
636
-            if ( is_array($hide_opt) ) {
637
-                $m = array_intersect($hide_opt, $observed_value);
638
-                $m = empty($m) ? false : true;
639
-            } else {
640
-                $m = in_array($hide_opt, $observed_value);
641
-            }
642
-        } else if ( $cond == '!=' ) {
643
-            $m = ! in_array($hide_opt, $observed_value);
644
-        } else if ( $cond == '>' ) {
645
-            $min = min($observed_value);
646
-            $m = $min > $hide_opt;
647
-        } else if ( $cond == '<' ) {
648
-            $max = max($observed_value);
649
-            $m = $max < $hide_opt;
650
-        } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
651
-            foreach ( $observed_value as $ob ) {
652
-                $m = strpos($ob, $hide_opt);
653
-                if ( $m !== false ) {
654
-                    $m = true;
655
-                    break;
656
-                }
657
-            }
658
-
659
-            if ( $cond == 'not LIKE' ) {
660
-                $m = ( $m === false ) ? true : false;
661
-            }
662
-        }
663
-
664
-        return $m;
665
-    }
666
-
667
-    /**
668
-     * Replace a few basic shortcodes and field ids
669
-     * @since 2.0
670
-     * @return string
671
-     */
634
+		$m = false;
635
+		if ( $cond == '==' ) {
636
+			if ( is_array($hide_opt) ) {
637
+				$m = array_intersect($hide_opt, $observed_value);
638
+				$m = empty($m) ? false : true;
639
+			} else {
640
+				$m = in_array($hide_opt, $observed_value);
641
+			}
642
+		} else if ( $cond == '!=' ) {
643
+			$m = ! in_array($hide_opt, $observed_value);
644
+		} else if ( $cond == '>' ) {
645
+			$min = min($observed_value);
646
+			$m = $min > $hide_opt;
647
+		} else if ( $cond == '<' ) {
648
+			$max = max($observed_value);
649
+			$m = $max < $hide_opt;
650
+		} else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
651
+			foreach ( $observed_value as $ob ) {
652
+				$m = strpos($ob, $hide_opt);
653
+				if ( $m !== false ) {
654
+					$m = true;
655
+					break;
656
+				}
657
+			}
658
+
659
+			if ( $cond == 'not LIKE' ) {
660
+				$m = ( $m === false ) ? true : false;
661
+			}
662
+		}
663
+
664
+		return $m;
665
+	}
666
+
667
+	/**
668
+	 * Replace a few basic shortcodes and field ids
669
+	 * @since 2.0
670
+	 * @return string
671
+	 */
672 672
 	public static function basic_replace_shortcodes( $value, $form, $entry ) {
673
-        if ( strpos($value, '[sitename]') !== false ) {
674
-            $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
675
-            $value = str_replace('[sitename]', $new_value, $value);
676
-        }
673
+		if ( strpos($value, '[sitename]') !== false ) {
674
+			$new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
675
+			$value = str_replace('[sitename]', $new_value, $value);
676
+		}
677 677
 
678
-        $value = apply_filters('frm_content', $value, $form, $entry);
679
-        $value = do_shortcode($value);
678
+		$value = apply_filters('frm_content', $value, $form, $entry);
679
+		$value = do_shortcode($value);
680 680
 
681
-        return $value;
682
-    }
681
+		return $value;
682
+	}
683 683
 
684 684
 	public static function get_shortcodes( $content, $form_id ) {
685
-        if ( FrmAppHelper::pro_is_installed() ) {
686
-            return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
687
-        }
685
+		if ( FrmAppHelper::pro_is_installed() ) {
686
+			return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
687
+		}
688 688
 
689
-        $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) );
689
+		$fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) );
690 690
 
691
-        $tagregexp = self::allowed_shortcodes($fields);
691
+		$tagregexp = self::allowed_shortcodes($fields);
692 692
 
693
-        preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
693
+		preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
694 694
 
695
-        return $matches;
696
-    }
695
+		return $matches;
696
+	}
697 697
 
698 698
 	public static function allowed_shortcodes( $fields = array() ) {
699
-        $tagregexp = array(
700
-            'editlink', 'id', 'key', 'ip',
701
-            'siteurl', 'sitename', 'admin_email',
702
-            'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by',
699
+		$tagregexp = array(
700
+			'editlink', 'id', 'key', 'ip',
701
+			'siteurl', 'sitename', 'admin_email',
702
+			'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by',
703 703
 			'parent[-|_]id',
704
-        );
704
+		);
705 705
 
706
-        foreach ( $fields as $field ) {
707
-            $tagregexp[] = $field->id;
708
-            $tagregexp[] = $field->field_key;
709
-        }
706
+		foreach ( $fields as $field ) {
707
+			$tagregexp[] = $field->id;
708
+			$tagregexp[] = $field->field_key;
709
+		}
710 710
 
711
-        $tagregexp = implode('|', $tagregexp);
712
-        return $tagregexp;
713
-    }
711
+		$tagregexp = implode('|', $tagregexp);
712
+		return $tagregexp;
713
+	}
714 714
 
715 715
 	public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
716
-        $shortcode_values = array(
717
-           'id'     => $entry->id,
718
-           'key'    => $entry->item_key,
719
-           'ip'     => $entry->ip,
720
-        );
716
+		$shortcode_values = array(
717
+		   'id'     => $entry->id,
718
+		   'key'    => $entry->item_key,
719
+		   'ip'     => $entry->ip,
720
+		);
721 721
 
722
-        foreach ( $shortcodes[0] as $short_key => $tag ) {
723
-            $atts = shortcode_parse_atts( $shortcodes[3][ $short_key ] );
722
+		foreach ( $shortcodes[0] as $short_key => $tag ) {
723
+			$atts = shortcode_parse_atts( $shortcodes[3][ $short_key ] );
724 724
 
725
-            if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
725
+			if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
726 726
 				$tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] );
727
-                $tags = explode(' ', $tag);
728
-                if ( is_array($tags) ) {
729
-                    $tag = $tags[0];
730
-                }
731
-            } else {
732
-                $tag = $shortcodes[2][ $short_key ];
733
-            }
734
-
735
-            switch ( $tag ) {
736
-                case 'id':
737
-                case 'key':
738
-                case 'ip':
739
-                    $replace_with = $shortcode_values[ $tag ];
740
-                break;
741
-
742
-                case 'user_agent':
743
-                case 'user-agent':
744
-                    $entry->description = maybe_unserialize($entry->description);
727
+				$tags = explode(' ', $tag);
728
+				if ( is_array($tags) ) {
729
+					$tag = $tags[0];
730
+				}
731
+			} else {
732
+				$tag = $shortcodes[2][ $short_key ];
733
+			}
734
+
735
+			switch ( $tag ) {
736
+				case 'id':
737
+				case 'key':
738
+				case 'ip':
739
+					$replace_with = $shortcode_values[ $tag ];
740
+				break;
741
+
742
+				case 'user_agent':
743
+				case 'user-agent':
744
+					$entry->description = maybe_unserialize($entry->description);
745 745
 					$replace_with = FrmEntryFormat::get_browser( $entry->description['browser'] );
746
-                break;
747
-
748
-                case 'created_at':
749
-                case 'created-at':
750
-                case 'updated_at':
751
-                case 'updated-at':
752
-                    if ( isset($atts['format']) ) {
753
-                        $time_format = ' ';
754
-                    } else {
755
-                        $atts['format'] = get_option('date_format');
756
-                        $time_format = '';
757
-                    }
758
-
759
-                    $this_tag = str_replace('-', '_', $tag);
760
-                    $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
761
-                    unset($this_tag);
762
-                break;
763
-
764
-                case 'created_by':
765
-                case 'created-by':
766
-                case 'updated_by':
767
-                case 'updated-by':
768
-                    $this_tag = str_replace('-', '_', $tag);
746
+				break;
747
+
748
+				case 'created_at':
749
+				case 'created-at':
750
+				case 'updated_at':
751
+				case 'updated-at':
752
+					if ( isset($atts['format']) ) {
753
+						$time_format = ' ';
754
+					} else {
755
+						$atts['format'] = get_option('date_format');
756
+						$time_format = '';
757
+					}
758
+
759
+					$this_tag = str_replace('-', '_', $tag);
760
+					$replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
761
+					unset($this_tag);
762
+				break;
763
+
764
+				case 'created_by':
765
+				case 'created-by':
766
+				case 'updated_by':
767
+				case 'updated-by':
768
+					$this_tag = str_replace('-', '_', $tag);
769 769
 					$replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts );
770
-                    unset($this_tag);
771
-                break;
772
-
773
-                case 'admin_email':
774
-                case 'siteurl':
775
-                case 'frmurl':
776
-                case 'sitename':
777
-                case 'get':
778
-                    $replace_with = self::dynamic_default_values( $tag, $atts );
779
-                break;
780
-
781
-                default:
782
-                    $field = FrmField::getOne( $tag );
783
-                    if ( ! $field ) {
784
-                        break;
785
-                    }
786
-
787
-                    $sep = isset($atts['sep']) ? $atts['sep'] : ', ';
788
-
789
-                    $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
790
-
791
-                    $atts['entry_id'] = $entry->id;
792
-                    $atts['entry_key'] = $entry->item_key;
793
-
794
-                    if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
795
-                        $replace_with = $field->name;
796
-                    } else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
797
-                        $replace_with = $field->description;
770
+					unset($this_tag);
771
+				break;
772
+
773
+				case 'admin_email':
774
+				case 'siteurl':
775
+				case 'frmurl':
776
+				case 'sitename':
777
+				case 'get':
778
+					$replace_with = self::dynamic_default_values( $tag, $atts );
779
+				break;
780
+
781
+				default:
782
+					$field = FrmField::getOne( $tag );
783
+					if ( ! $field ) {
784
+						break;
785
+					}
786
+
787
+					$sep = isset($atts['sep']) ? $atts['sep'] : ', ';
788
+
789
+					$replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
790
+
791
+					$atts['entry_id'] = $entry->id;
792
+					$atts['entry_key'] = $entry->item_key;
793
+
794
+					if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
795
+						$replace_with = $field->name;
796
+					} else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
797
+						$replace_with = $field->description;
798 798
 					} else {
799 799
 						$string_value = $replace_with;
800 800
 						if ( is_array( $replace_with ) ) {
@@ -808,82 +808,82 @@  discard block
 block discarded – undo
808 808
 						}
809 809
 					}
810 810
 
811
-                    unset($field);
812
-                break;
813
-            }
811
+					unset($field);
812
+				break;
813
+			}
814 814
 
815
-            if ( isset($replace_with) ) {
816
-                $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
817
-            }
815
+			if ( isset($replace_with) ) {
816
+				$content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
817
+			}
818 818
 
819
-            unset($atts, $conditional, $replace_with);
819
+			unset($atts, $conditional, $replace_with);
820 820
 		}
821 821
 
822 822
 		return $content;
823
-    }
824
-
825
-    /**
826
-     * Get the value to replace a few standard shortcodes
827
-     *
828
-     * @since 2.0
829
-     * @return string
830
-     */
831
-    public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) {
832
-        $new_value = '';
833
-        switch ( $tag ) {
834
-            case 'admin_email':
835
-                $new_value = get_option('admin_email');
836
-                break;
837
-            case 'siteurl':
838
-                $new_value = FrmAppHelper::site_url();
839
-                break;
840
-            case 'frmurl':
841
-                $new_value = FrmAppHelper::plugin_url();
842
-                break;
843
-            case 'sitename':
844
-                $new_value = FrmAppHelper::site_name();
845
-                break;
846
-            case 'get':
847
-                $new_value = self::process_get_shortcode( $atts, $return_array );
848
-                break;
849
-        }
850
-
851
-        return $new_value;
852
-    }
853
-
854
-    /**
855
-     * Process the [get] shortcode
856
-     *
857
-     * @since 2.0
858
-     * @return string|array
859
-     */
860
-    public static function process_get_shortcode( $atts, $return_array = false ) {
861
-        if ( ! isset($atts['param']) ) {
862
-            return '';
863
-        }
864
-
865
-        if ( strpos($atts['param'], '&#91;') ) {
866
-            $atts['param'] = str_replace('&#91;', '[', $atts['param']);
867
-            $atts['param'] = str_replace('&#93;', ']', $atts['param']);
868
-        }
869
-
870
-        $new_value = FrmAppHelper::get_param($atts['param'], '');
871
-        $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
872
-
873
-        if ( $new_value == '' ) {
874
-            if ( ! isset($atts['prev_val']) ) {
875
-                $atts['prev_val'] = '';
876
-            }
877
-
878
-            $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
879
-        }
880
-
881
-        if ( is_array($new_value) && ! $return_array ) {
882
-            $new_value = implode(', ', $new_value);
883
-        }
884
-
885
-        return $new_value;
886
-    }
823
+	}
824
+
825
+	/**
826
+	 * Get the value to replace a few standard shortcodes
827
+	 *
828
+	 * @since 2.0
829
+	 * @return string
830
+	 */
831
+	public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) {
832
+		$new_value = '';
833
+		switch ( $tag ) {
834
+			case 'admin_email':
835
+				$new_value = get_option('admin_email');
836
+				break;
837
+			case 'siteurl':
838
+				$new_value = FrmAppHelper::site_url();
839
+				break;
840
+			case 'frmurl':
841
+				$new_value = FrmAppHelper::plugin_url();
842
+				break;
843
+			case 'sitename':
844
+				$new_value = FrmAppHelper::site_name();
845
+				break;
846
+			case 'get':
847
+				$new_value = self::process_get_shortcode( $atts, $return_array );
848
+				break;
849
+		}
850
+
851
+		return $new_value;
852
+	}
853
+
854
+	/**
855
+	 * Process the [get] shortcode
856
+	 *
857
+	 * @since 2.0
858
+	 * @return string|array
859
+	 */
860
+	public static function process_get_shortcode( $atts, $return_array = false ) {
861
+		if ( ! isset($atts['param']) ) {
862
+			return '';
863
+		}
864
+
865
+		if ( strpos($atts['param'], '&#91;') ) {
866
+			$atts['param'] = str_replace('&#91;', '[', $atts['param']);
867
+			$atts['param'] = str_replace('&#93;', ']', $atts['param']);
868
+		}
869
+
870
+		$new_value = FrmAppHelper::get_param($atts['param'], '');
871
+		$new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
872
+
873
+		if ( $new_value == '' ) {
874
+			if ( ! isset($atts['prev_val']) ) {
875
+				$atts['prev_val'] = '';
876
+			}
877
+
878
+			$new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
879
+		}
880
+
881
+		if ( is_array($new_value) && ! $return_array ) {
882
+			$new_value = implode(', ', $new_value);
883
+		}
884
+
885
+		return $new_value;
886
+	}
887 887
 
888 888
 	public static function get_display_value( $replace_with, $field, $atts = array() ) {
889 889
 		$atts['sep'] = isset( $atts['sep'] ) ? $atts['sep'] : ', ';
@@ -891,14 +891,14 @@  discard block
 block discarded – undo
891 891
 		$replace_with = apply_filters( 'frm_get_' . $field->type . '_display_value', $replace_with, $field, $atts );
892 892
 		$replace_with = apply_filters( 'frm_get_display_value', $replace_with, $field, $atts );
893 893
 
894
-        if ( $field->type == 'textarea' || $field->type == 'rte' ) {
895
-            $autop = isset($atts['wpautop']) ? $atts['wpautop'] : true;
896
-            if ( apply_filters('frm_use_wpautop', $autop) ) {
897
-                if ( is_array($replace_with) ) {
898
-                    $replace_with = implode("\n", $replace_with);
899
-                }
900
-                $replace_with = wpautop($replace_with);
901
-            }
894
+		if ( $field->type == 'textarea' || $field->type == 'rte' ) {
895
+			$autop = isset($atts['wpautop']) ? $atts['wpautop'] : true;
896
+			if ( apply_filters('frm_use_wpautop', $autop) ) {
897
+				if ( is_array($replace_with) ) {
898
+					$replace_with = implode("\n", $replace_with);
899
+				}
900
+				$replace_with = wpautop($replace_with);
901
+			}
902 902
 			unset( $autop );
903 903
 		} else if ( is_array( $replace_with ) ) {
904 904
 			$replace_with = implode( $atts['sep'], $replace_with );
@@ -908,57 +908,57 @@  discard block
 block discarded – undo
908 908
 	}
909 909
 
910 910
 	public static function get_field_types( $type ) {
911
-        $single_input = array(
912
-            'text', 'textarea', 'rte', 'number', 'email', 'url',
913
-            'image', 'file', 'date', 'phone', 'hidden', 'time',
914
-            'user_id', 'tag', 'password',
915
-        );
911
+		$single_input = array(
912
+			'text', 'textarea', 'rte', 'number', 'email', 'url',
913
+			'image', 'file', 'date', 'phone', 'hidden', 'time',
914
+			'user_id', 'tag', 'password',
915
+		);
916 916
 		$multiple_input = array( 'radio', 'checkbox', 'select', 'scale' );
917 917
 		$other_type = array( 'divider', 'html', 'break' );
918 918
 
919 919
 		$field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() );
920 920
 
921
-        $field_types = array();
922
-        if ( in_array($type, $single_input) ) {
923
-            self::field_types_for_input( $single_input, $field_selection, $field_types );
924
-        } else if ( in_array($type, $multiple_input) ) {
925
-            self::field_types_for_input( $multiple_input, $field_selection, $field_types );
926
-        } else if ( in_array($type, $other_type) ) {
927
-            self::field_types_for_input( $other_type, $field_selection, $field_types );
921
+		$field_types = array();
922
+		if ( in_array($type, $single_input) ) {
923
+			self::field_types_for_input( $single_input, $field_selection, $field_types );
924
+		} else if ( in_array($type, $multiple_input) ) {
925
+			self::field_types_for_input( $multiple_input, $field_selection, $field_types );
926
+		} else if ( in_array($type, $other_type) ) {
927
+			self::field_types_for_input( $other_type, $field_selection, $field_types );
928 928
 		} else if ( isset( $field_selection[ $type ] ) ) {
929
-            $field_types[ $type ] = $field_selection[ $type ];
930
-        }
931
-
932
-        return $field_types;
933
-    }
934
-
935
-    private static function field_types_for_input( $inputs, $fields, &$field_types ) {
936
-        foreach ( $inputs as $input ) {
937
-            $field_types[ $input ] = $fields[ $input ];
938
-            unset($input);
939
-        }
940
-    }
941
-
942
-    /**
943
-    * Check if current field option is an "other" option
944
-    *
945
-    * @since 2.0.6
946
-    *
947
-    * @param string $opt_key
948
-    * @return boolean Returns true if current field option is an "Other" option
949
-    */
950
-    public static function is_other_opt( $opt_key ) {
951
-        return $opt_key && strpos( $opt_key, 'other' ) !== false;
952
-    }
953
-
954
-    /**
955
-    * Get value that belongs in "Other" text box
956
-    *
957
-    * @since 2.0.6
958
-    *
959
-    * @param array $args
960
-    */
961
-    public static function get_other_val( $args ) {
929
+			$field_types[ $type ] = $field_selection[ $type ];
930
+		}
931
+
932
+		return $field_types;
933
+	}
934
+
935
+	private static function field_types_for_input( $inputs, $fields, &$field_types ) {
936
+		foreach ( $inputs as $input ) {
937
+			$field_types[ $input ] = $fields[ $input ];
938
+			unset($input);
939
+		}
940
+	}
941
+
942
+	/**
943
+	 * Check if current field option is an "other" option
944
+	 *
945
+	 * @since 2.0.6
946
+	 *
947
+	 * @param string $opt_key
948
+	 * @return boolean Returns true if current field option is an "Other" option
949
+	 */
950
+	public static function is_other_opt( $opt_key ) {
951
+		return $opt_key && strpos( $opt_key, 'other' ) !== false;
952
+	}
953
+
954
+	/**
955
+	 * Get value that belongs in "Other" text box
956
+	 *
957
+	 * @since 2.0.6
958
+	 *
959
+	 * @param array $args
960
+	 */
961
+	public static function get_other_val( $args ) {
962 962
 		$defaults = array(
963 963
 			'opt_key' => 0, 'field' => array(),
964 964
 			'parent' => false, 'pointer' => false,
@@ -1034,20 +1034,20 @@  discard block
 block discarded – undo
1034 1034
 		}
1035 1035
 
1036 1036
 		return $other_val;
1037
-    }
1038
-
1039
-    /**
1040
-    * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
1041
-    * Intended for front-end use
1042
-    *
1043
-    * @since 2.0.6
1044
-    *
1045
-    * @param array $args should include field, opt_key and field name
1046
-    * @param boolean $other_opt
1047
-    * @param string $checked
1048
-    * @return string $other_val
1049
-    */
1050
-    public static function prepare_other_input( $args, &$other_opt, &$checked ) {
1037
+	}
1038
+
1039
+	/**
1040
+	 * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
1041
+	 * Intended for front-end use
1042
+	 *
1043
+	 * @since 2.0.6
1044
+	 *
1045
+	 * @param array $args should include field, opt_key and field name
1046
+	 * @param boolean $other_opt
1047
+	 * @param string $checked
1048
+	 * @return string $other_val
1049
+	 */
1050
+	public static function prepare_other_input( $args, &$other_opt, &$checked ) {
1051 1051
 		//Check if this is an "Other" option
1052 1052
 		if ( ! self::is_other_opt( $args['opt_key'] ) ) {
1053 1053
 			return;
@@ -1063,8 +1063,8 @@  discard block
 block discarded – undo
1063 1063
 			$checked = 'checked="checked" ';
1064 1064
 		}
1065 1065
 
1066
-        return $other_args;
1067
-    }
1066
+		return $other_args;
1067
+	}
1068 1068
 
1069 1069
 	/**
1070 1070
 	 * @param array $args
@@ -1113,8 +1113,8 @@  discard block
 block discarded – undo
1113 1113
 	 * @since 2.0.6
1114 1114
 	 */
1115 1115
 	public static function include_other_input( $args ) {
1116
-        if ( ! $args['other_opt'] ) {
1117
-        	return;
1116
+		if ( ! $args['other_opt'] ) {
1117
+			return;
1118 1118
 		}
1119 1119
 
1120 1120
 		$classes = array( 'frm_other_input' );
@@ -1135,15 +1135,15 @@  discard block
 block discarded – undo
1135 1135
 	}
1136 1136
 
1137 1137
 	/**
1138
-	* Get the HTML id for an "Other" text field
1139
-	* Note: This does not affect fields in repeating sections
1140
-	*
1141
-	* @since 2.0.08
1142
-	* @param string $type - field type
1143
-	* @param string $html_id
1144
-	* @param string|boolean $opt_key
1145
-	* @return string $other_id
1146
-	*/
1138
+	 * Get the HTML id for an "Other" text field
1139
+	 * Note: This does not affect fields in repeating sections
1140
+	 *
1141
+	 * @since 2.0.08
1142
+	 * @param string $type - field type
1143
+	 * @param string $html_id
1144
+	 * @param string|boolean $opt_key
1145
+	 * @return string $other_id
1146
+	 */
1147 1147
 	public static function get_other_field_html_id( $type, $html_id, $opt_key = false ) {
1148 1148
 		$other_id = $html_id;
1149 1149
 
@@ -1201,171 +1201,171 @@  discard block
 block discarded – undo
1201 1201
 	}
1202 1202
 
1203 1203
 	public static function switch_field_ids( $val ) {
1204
-        global $frm_duplicate_ids;
1205
-        $replace = array();
1206
-        $replace_with = array();
1207
-        foreach ( (array) $frm_duplicate_ids as $old => $new ) {
1208
-            $replace[] = '[if '. $old .']';
1209
-            $replace_with[] = '[if '. $new .']';
1210
-            $replace[] = '[if '. $old .' ';
1211
-            $replace_with[] = '[if '. $new .' ';
1212
-            $replace[] = '[/if '. $old .']';
1213
-            $replace_with[] = '[/if '. $new .']';
1214
-            $replace[] = '[foreach '. $old .']';
1215
-            $replace_with[] = '[foreach '. $new .']';
1216
-            $replace[] = '[/foreach '. $old .']';
1217
-            $replace_with[] = '[/foreach '. $new .']';
1218
-            $replace[] = '['. $old .']';
1219
-            $replace_with[] = '['. $new .']';
1220
-            $replace[] = '['. $old .' ';
1221
-            $replace_with[] = '['. $new .' ';
1222
-            unset($old, $new);
1223
-        }
1204
+		global $frm_duplicate_ids;
1205
+		$replace = array();
1206
+		$replace_with = array();
1207
+		foreach ( (array) $frm_duplicate_ids as $old => $new ) {
1208
+			$replace[] = '[if '. $old .']';
1209
+			$replace_with[] = '[if '. $new .']';
1210
+			$replace[] = '[if '. $old .' ';
1211
+			$replace_with[] = '[if '. $new .' ';
1212
+			$replace[] = '[/if '. $old .']';
1213
+			$replace_with[] = '[/if '. $new .']';
1214
+			$replace[] = '[foreach '. $old .']';
1215
+			$replace_with[] = '[foreach '. $new .']';
1216
+			$replace[] = '[/foreach '. $old .']';
1217
+			$replace_with[] = '[/foreach '. $new .']';
1218
+			$replace[] = '['. $old .']';
1219
+			$replace_with[] = '['. $new .']';
1220
+			$replace[] = '['. $old .' ';
1221
+			$replace_with[] = '['. $new .' ';
1222
+			unset($old, $new);
1223
+		}
1224 1224
 		if ( is_array( $val ) ) {
1225 1225
 			foreach ( $val as $k => $v ) {
1226
-                $val[ $k ] = str_replace( $replace, $replace_with, $v );
1227
-                unset($k, $v);
1228
-            }
1229
-        } else {
1230
-            $val = str_replace($replace, $replace_with, $val);
1231
-        }
1232
-
1233
-        return $val;
1234
-    }
1235
-
1236
-    public static function get_us_states() {
1237
-        return apply_filters( 'frm_us_states', array(
1238
-            'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona',
1239
-            'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware',
1240
-            'DC' => 'District of Columbia',
1241
-            'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho',
1242
-            'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas',
1243
-            'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland',
1244
-            'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi',
1245
-            'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada',
1246
-            'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York',
1247
-            'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma',
1248
-            'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina',
1249
-            'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah',
1250
-            'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia',
1251
-            'WI' => 'Wisconsin', 'WY' => 'Wyoming',
1252
-        ) );
1253
-    }
1254
-
1255
-    public static function get_countries() {
1256
-        return apply_filters( 'frm_countries', array(
1257
-            __( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ),
1258
-            __( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ),
1259
-            __( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ),
1260
-            __( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ),
1261
-            __( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ),
1262
-            __( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ),
1263
-            __( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ),
1264
-            __( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ),
1265
-            __( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ),
1266
-            __( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ),
1267
-            __( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ),
1268
-            __( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ),
1269
-            __( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ),
1270
-            __( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ),
1271
-            __( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ),
1272
-            __( 'Costa Rica', 'formidable' ), __( 'C&ocirc;te d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ),
1273
-            __( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ),
1274
-            __( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ),
1275
-            __( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ),
1276
-            __( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ),
1277
-            __( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ),
1278
-            __( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ),
1279
-            __( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ),
1280
-            __( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ),
1281
-            __( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ),
1282
-            __( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ),
1283
-            __( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ),
1284
-            __( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ),
1285
-            __( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ),
1286
-            __( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ),
1287
-            __( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ),
1288
-            __( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ),
1289
-            __( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ),
1290
-            __( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ),
1291
-            __( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ),
1292
-            __( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ),
1293
-            __( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ),
1294
-            __( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ),
1295
-            __( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ),
1296
-            __( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ),
1297
-            __( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ),
1298
-            __( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ),
1299
-            __( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ),
1300
-            __( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ),
1301
-            __( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ),
1302
-            __( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ),
1303
-            __( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ),
1304
-            __( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ),
1305
-            __( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ),
1306
-            __( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ),
1307
-            __( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ),
1308
-            __( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ),
1309
-            __( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ),
1310
-            __( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ),
1311
-            __( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ),
1312
-            __( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ),
1313
-            __( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ),
1314
-            __( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ),
1315
-            __( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ),
1316
-            __( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ),
1317
-            __( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ),
1318
-            __( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ),
1319
-            __( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ),
1320
-            __( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ),
1321
-            __( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ),
1322
-            __( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ),
1323
-            __( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ),
1324
-            __( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ),
1325
-            __( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ),
1326
-            __( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ),
1327
-            __( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ),
1328
-            __( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ),
1329
-            __( 'Zimbabwe', 'formidable' ),
1330
-        ) );
1331
-    }
1226
+				$val[ $k ] = str_replace( $replace, $replace_with, $v );
1227
+				unset($k, $v);
1228
+			}
1229
+		} else {
1230
+			$val = str_replace($replace, $replace_with, $val);
1231
+		}
1232
+
1233
+		return $val;
1234
+	}
1235
+
1236
+	public static function get_us_states() {
1237
+		return apply_filters( 'frm_us_states', array(
1238
+			'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona',
1239
+			'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware',
1240
+			'DC' => 'District of Columbia',
1241
+			'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho',
1242
+			'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas',
1243
+			'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland',
1244
+			'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi',
1245
+			'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada',
1246
+			'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York',
1247
+			'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma',
1248
+			'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina',
1249
+			'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah',
1250
+			'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia',
1251
+			'WI' => 'Wisconsin', 'WY' => 'Wyoming',
1252
+		) );
1253
+	}
1254
+
1255
+	public static function get_countries() {
1256
+		return apply_filters( 'frm_countries', array(
1257
+			__( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ),
1258
+			__( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ),
1259
+			__( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ),
1260
+			__( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ),
1261
+			__( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ),
1262
+			__( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ),
1263
+			__( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ),
1264
+			__( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ),
1265
+			__( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ),
1266
+			__( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ),
1267
+			__( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ),
1268
+			__( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ),
1269
+			__( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ),
1270
+			__( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ),
1271
+			__( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ),
1272
+			__( 'Costa Rica', 'formidable' ), __( 'C&ocirc;te d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ),
1273
+			__( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ),
1274
+			__( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ),
1275
+			__( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ),
1276
+			__( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ),
1277
+			__( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ),
1278
+			__( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ),
1279
+			__( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ),
1280
+			__( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ),
1281
+			__( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ),
1282
+			__( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ),
1283
+			__( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ),
1284
+			__( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ),
1285
+			__( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ),
1286
+			__( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ),
1287
+			__( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ),
1288
+			__( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ),
1289
+			__( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ),
1290
+			__( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ),
1291
+			__( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ),
1292
+			__( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ),
1293
+			__( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ),
1294
+			__( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ),
1295
+			__( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ),
1296
+			__( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ),
1297
+			__( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ),
1298
+			__( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ),
1299
+			__( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ),
1300
+			__( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ),
1301
+			__( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ),
1302
+			__( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ),
1303
+			__( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ),
1304
+			__( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ),
1305
+			__( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ),
1306
+			__( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ),
1307
+			__( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ),
1308
+			__( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ),
1309
+			__( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ),
1310
+			__( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ),
1311
+			__( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ),
1312
+			__( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ),
1313
+			__( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ),
1314
+			__( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ),
1315
+			__( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ),
1316
+			__( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ),
1317
+			__( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ),
1318
+			__( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ),
1319
+			__( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ),
1320
+			__( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ),
1321
+			__( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ),
1322
+			__( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ),
1323
+			__( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ),
1324
+			__( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ),
1325
+			__( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ),
1326
+			__( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ),
1327
+			__( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ),
1328
+			__( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ),
1329
+			__( 'Zimbabwe', 'formidable' ),
1330
+		) );
1331
+	}
1332 1332
 
1333 1333
 	public static function get_bulk_prefilled_opts( array &$prepop ) {
1334 1334
 		$prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries();
1335 1335
 
1336
-        $states = FrmFieldsHelper::get_us_states();
1337
-        $state_abv = array_keys($states);
1338
-        sort($state_abv);
1336
+		$states = FrmFieldsHelper::get_us_states();
1337
+		$state_abv = array_keys($states);
1338
+		sort($state_abv);
1339 1339
 		$prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
1340 1340
 
1341
-        $states = array_values($states);
1342
-        sort($states);
1341
+		$states = array_values($states);
1342
+		sort($states);
1343 1343
 		$prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
1344
-        unset($state_abv, $states);
1344
+		unset($state_abv, $states);
1345 1345
 
1346 1346
 		$prepop[ __( 'Age', 'formidable' ) ] = array(
1347
-            __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ),
1348
-            __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ),
1349
-            __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ),
1350
-        );
1347
+			__( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ),
1348
+			__( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ),
1349
+			__( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ),
1350
+		);
1351 1351
 
1352 1352
 		$prepop[ __( 'Satisfaction', 'formidable' ) ] = array(
1353
-            __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ),
1354
-            __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ),
1355
-        );
1353
+			__( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ),
1354
+			__( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ),
1355
+		);
1356 1356
 
1357 1357
 		$prepop[ __( 'Importance', 'formidable' ) ] = array(
1358
-            __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ),
1359
-            __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ),
1360
-        );
1358
+			__( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ),
1359
+			__( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ),
1360
+		);
1361 1361
 
1362 1362
 		$prepop[ __( 'Agreement', 'formidable' ) ] = array(
1363
-            __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ),
1364
-            __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ),
1365
-        );
1363
+			__( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ),
1364
+			__( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ),
1365
+		);
1366 1366
 
1367 1367
 		$prepop = apply_filters( 'frm_bulk_field_choices', $prepop );
1368
-    }
1368
+	}
1369 1369
 
1370 1370
 	public static function field_selection() {
1371 1371
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmField::field_selection' );
@@ -1402,8 +1402,8 @@  discard block
 block discarded – undo
1402 1402
 		return FrmField::is_required( $field );
1403 1403
 	}
1404 1404
 
1405
-    public static function maybe_get_field( &$field ) {
1405
+	public static function maybe_get_field( &$field ) {
1406 1406
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmField::maybe_get_field' );
1407 1407
 		FrmField::maybe_get_field( $field );
1408
-    }
1408
+	}
1409 1409
 }
Please login to merge, or discard this patch.
Spacing   +221 added lines, -221 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 ( 'data' == $type ) {
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
 
@@ -56,19 +56,19 @@  discard block
 block discarded – undo
56 56
         }
57 57
 
58 58
 		$fields = FrmField::field_selection();
59
-        $fields = array_merge($fields, FrmField::pro_field_selection());
59
+        $fields = array_merge( $fields, FrmField::pro_field_selection() );
60 60
 
61
-        if ( isset( $fields[ $type ] ) ) {
62
-            $values['name'] = is_array( $fields[ $type ] ) ? $fields[ $type ]['name'] : $fields[ $type ];
61
+        if ( isset( $fields[$type] ) ) {
62
+            $values['name'] = is_array( $fields[$type] ) ? $fields[$type]['name'] : $fields[$type];
63 63
         }
64 64
 
65
-        unset($fields);
65
+        unset( $fields );
66 66
 
67 67
         return $values;
68 68
     }
69 69
 
70 70
 	public static function get_html_id( $field, $plus = '' ) {
71
-        return apply_filters('frm_field_html_id', 'field_'. $field['field_key'] . $plus, $field);
71
+        return apply_filters( 'frm_field_html_id', 'field_' . $field['field_key'] . $plus, $field );
72 72
     }
73 73
 
74 74
     public static function setup_edit_vars( $record, $doing_ajax = false ) {
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
             $values['form_name'] = '';
89 89
 		} else {
90 90
 			foreach ( $defaults as $var => $default ) {
91
-                $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' );
92
-                unset($var, $default);
91
+                $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' );
92
+                unset( $var, $default );
93 93
             }
94 94
 
95 95
 			$values['form_name'] = $record->form_id ? FrmForm::getName( $record->form_id ) : '';
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         $values['options'] = $record->options;
101 101
         $values['field_options'] = $record->field_options;
102 102
 
103
-        $defaults = self::get_default_field_opts($values['type'], $record, true);
103
+        $defaults = self::get_default_field_opts( $values['type'], $record, true );
104 104
 
105 105
 		if ( $values['type'] == 'captcha' ) {
106 106
             $frm_settings = FrmAppHelper::get_settings();
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
         }
109 109
 
110 110
 		foreach ( $defaults as $opt => $default ) {
111
-            $values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default;
112
-            unset($opt, $default);
111
+            $values[$opt] = isset( $record->field_options[$opt] ) ? $record->field_options[$opt] : $default;
112
+            unset( $opt, $default );
113 113
         }
114 114
 
115
-        $values['custom_html'] = (isset($record->field_options['custom_html'])) ? $record->field_options['custom_html'] : self::get_default_html($record->type);
115
+        $values['custom_html'] = ( isset( $record->field_options['custom_html'] ) ) ? $record->field_options['custom_html'] : self::get_default_html( $record->type );
116 116
 
117 117
 		return apply_filters( 'frm_setup_edit_field_vars', $values, array( 'doing_ajax' => $doing_ajax ) );
118 118
     }
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
 
132 132
         global $wpdb;
133 133
 
134
-        $form_id = (is_numeric($field)) ? $field : $field->form_id;
134
+        $form_id = ( is_numeric( $field ) ) ? $field : $field->form_id;
135 135
 
136
-        $key = is_numeric($field) ? FrmAppHelper::get_unique_key('', $wpdb->prefix .'frm_fields', 'field_key') : $field->field_key;
136
+        $key = is_numeric( $field ) ? FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_fields', 'field_key' ) : $field->field_key;
137 137
 
138 138
         $field_count = FrmDb::get_var( 'frm_fields', array( 'form_id' => $form_id ), 'field_order', array( 'order_by' => 'field_order DESC' ) );
139 139
 
@@ -151,13 +151,13 @@  discard block
 block discarded – undo
151 151
     public static function fill_field( &$values, $field, $form_id, $new_key = '' ) {
152 152
         global $wpdb;
153 153
 
154
-        $values['field_key'] = FrmAppHelper::get_unique_key($new_key, $wpdb->prefix .'frm_fields', 'field_key');
154
+        $values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' );
155 155
         $values['form_id'] = $form_id;
156
-        $values['options'] = maybe_serialize($field->options);
157
-        $values['default_value'] = maybe_serialize($field->default_value);
156
+        $values['options'] = maybe_serialize( $field->options );
157
+        $values['default_value'] = maybe_serialize( $field->default_value );
158 158
 
159 159
         foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
160
-            $values[ $col ] = $field->{$col};
160
+            $values[$col] = $field->{$col};
161 161
         }
162 162
     }
163 163
 
@@ -170,19 +170,19 @@  discard block
 block discarded – undo
170 170
 		$field_name = is_array( $field ) ? $field['name'] : $field->name;
171 171
 
172 172
 		$defaults = array(
173
-			'unique_msg' => array( 'full' => $default_settings['unique_msg'], 'part' => sprintf( __('%s must be unique', 'formidable' ), $field_name ) ),
174
-			'invalid'   => array( 'full' => __( 'This field is invalid', 'formidable' ), 'part' => sprintf( __('%s is invalid', 'formidable' ), $field_name ) ),
173
+			'unique_msg' => array( 'full' => $default_settings['unique_msg'], 'part' => sprintf( __( '%s must be unique', 'formidable' ), $field_name ) ),
174
+			'invalid'   => array( 'full' => __( 'This field is invalid', 'formidable' ), 'part' => sprintf( __( '%s is invalid', 'formidable' ), $field_name ) ),
175 175
 			'blank'     => array( 'full' => $frm_settings->blank_msg, 'part' => $frm_settings->blank_msg ),
176 176
 		);
177 177
 
178 178
 		$msg = FrmField::get_option( $field, $error );
179
-		$msg = ( $msg == $defaults[ $error ]['full'] || empty( $msg ) ) ? $defaults[ $error ]['part'] : $msg;
179
+		$msg = ( $msg == $defaults[$error]['full'] || empty( $msg ) ) ? $defaults[$error]['part'] : $msg;
180 180
 		return $msg;
181 181
 	}
182 182
 
183 183
     public static function get_form_fields( $form_id, $error = false ) {
184
-        $fields = FrmField::get_all_for_form($form_id);
185
-        $fields = apply_filters('frm_get_paged_fields', $fields, $form_id, $error);
184
+        $fields = FrmField::get_all_for_form( $form_id );
185
+        $fields = apply_filters( 'frm_get_paged_fields', $fields, $form_id, $error );
186 186
         return $fields;
187 187
     }
188 188
 
@@ -205,57 +205,57 @@  discard block
 block discarded – undo
205 205
 </div>
206 206
 DEFAULT_HTML;
207 207
         } else {
208
-			$default_html = apply_filters('frm_other_custom_html', '', $type);
208
+			$default_html = apply_filters( 'frm_other_custom_html', '', $type );
209 209
         }
210 210
 
211
-        return apply_filters('frm_custom_html', $default_html, $type);
211
+        return apply_filters( 'frm_custom_html', $default_html, $type );
212 212
     }
213 213
 
214 214
 	public static function replace_shortcodes( $html, $field, $errors = array(), $form = false, $args = array() ) {
215
-        $html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form);
215
+        $html = apply_filters( 'frm_before_replace_shortcodes', $html, $field, $errors, $form );
216 216
 
217 217
         $defaults = array(
218
-            'field_name'  => 'item_meta['. $field['id'] .']',
218
+            'field_name'  => 'item_meta[' . $field['id'] . ']',
219 219
             'field_id'    => $field['id'],
220 220
             'field_plus_id' => '',
221 221
             'section_id'    => '',
222 222
         );
223
-        $args = wp_parse_args($args, $defaults);
223
+        $args = wp_parse_args( $args, $defaults );
224 224
         $field_name = $args['field_name'];
225 225
         $field_id = $args['field_id'];
226
-        $html_id = self::get_html_id($field, $args['field_plus_id']);
226
+        $html_id = self::get_html_id( $field, $args['field_plus_id'] );
227 227
 
228
-        if ( FrmField::is_multiple_select($field) ) {
228
+        if ( FrmField::is_multiple_select( $field ) ) {
229 229
             $field_name .= '[]';
230 230
         }
231 231
 
232 232
         //replace [id]
233
-        $html = str_replace('[id]', $field_id, $html);
233
+        $html = str_replace( '[id]', $field_id, $html );
234 234
 
235 235
         // Remove the for attribute for captcha
236 236
         if ( $field['type'] == 'captcha' ) {
237
-            $html = str_replace(' for="field_[key]"', '', $html);
237
+            $html = str_replace( ' for="field_[key]"', '', $html );
238 238
         }
239 239
 
240 240
         // set the label for
241
-        $html = str_replace('field_[key]', $html_id, $html);
241
+        $html = str_replace( 'field_[key]', $html_id, $html );
242 242
 
243 243
         //replace [key]
244
-        $html = str_replace('[key]', $field['field_key'], $html);
244
+        $html = str_replace( '[key]', $field['field_key'], $html );
245 245
 
246 246
         //replace [description] and [required_label] and [error]
247 247
 		$required = FrmField::is_required( $field ) ? $field['required_indicator'] : '';
248 248
         if ( ! is_array( $errors ) ) {
249 249
             $errors = array();
250 250
         }
251
-		$error = isset( $errors[ 'field' . $field_id ] ) ? $errors[ 'field' . $field_id ] : false;
251
+		$error = isset( $errors['field' . $field_id] ) ? $errors['field' . $field_id] : false;
252 252
 
253 253
         //If field type is section heading, add class so a bottom margin can be added to either the h3 or description
254 254
         if ( $field['type'] == 'divider' ) {
255 255
             if ( FrmField::is_option_true( $field, 'description' ) ) {
256 256
                 $html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html );
257 257
             } else {
258
-                $html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html);
258
+                $html = str_replace( '[label_position]', '[label_position] frm_section_spacing', $html );
259 259
             }
260 260
         }
261 261
 
@@ -265,83 +265,83 @@  discard block
 block discarded – undo
265 265
 
266 266
         //replace [required_class]
267 267
 		$required_class = FrmField::is_required( $field ) ? ' frm_required_field' : '';
268
-        $html = str_replace('[required_class]', $required_class, $html);
268
+        $html = str_replace( '[required_class]', $required_class, $html );
269 269
 
270 270
         //replace [label_position]
271
-        $field['label'] = apply_filters('frm_html_label_position', $field['label'], $field, $form);
271
+        $field['label'] = apply_filters( 'frm_html_label_position', $field['label'], $field, $form );
272 272
         $field['label'] = ( $field['label'] && $field['label'] != '' ) ? $field['label'] : 'top';
273 273
 		$html = str_replace( '[label_position]', ( ( in_array( $field['type'], array( 'divider', 'end_divider', 'break' ) ) ) ? $field['label'] : ' frm_primary_label' ), $html );
274 274
 
275 275
         //replace [field_name]
276
-        $html = str_replace('[field_name]', $field['name'], $html);
276
+        $html = str_replace( '[field_name]', $field['name'], $html );
277 277
 
278 278
         //replace [error_class]
279
-		$error_class = isset( $errors[ 'field' . $field_id ] ) ? ' frm_blank_field' : '';
279
+		$error_class = isset( $errors['field' . $field_id] ) ? ' frm_blank_field' : '';
280 280
 		self::get_more_field_classes( $error_class, $field, $field_id, $html );
281 281
 		if ( $field['type'] == 'html' && strpos( $html, '[error_class]' ) === false ) {
282 282
 			// there is no error_class shortcode to use for addign fields
283 283
 			$html = str_replace( 'class="frm_form_field', 'class="frm_form_field ' . $error_class, $html );
284 284
 		}
285
-        $html = str_replace('[error_class]', $error_class, $html);
285
+        $html = str_replace( '[error_class]', $error_class, $html );
286 286
 
287 287
         //replace [entry_key]
288 288
         $entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' );
289
-        $html = str_replace('[entry_key]', $entry_key, $html);
289
+        $html = str_replace( '[entry_key]', $entry_key, $html );
290 290
 
291 291
         //replace [input]
292
-        preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER);
292
+        preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER );
293 293
         global $frm_vars;
294 294
         $frm_settings = FrmAppHelper::get_settings();
295 295
 
296 296
         foreach ( $shortcodes[0] as $short_key => $tag ) {
297
-            $atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] );
297
+            $atts = shortcode_parse_atts( $shortcodes[2][$short_key] );
298 298
 			$tag = self::get_shortcode_tag( $shortcodes, $short_key, array( 'conditional' => false, 'conditional_check' => false ) );
299 299
 
300 300
             $replace_with = '';
301 301
 
302 302
             if ( $tag == 'input' ) {
303
-                if ( isset($atts['opt']) ) {
304
-                    $atts['opt']--;
303
+                if ( isset( $atts['opt'] ) ) {
304
+                    $atts['opt'] --;
305 305
                 }
306 306
 
307
-                $field['input_class'] = isset($atts['class']) ? $atts['class'] : '';
308
-                if ( isset($atts['class']) ) {
309
-                    unset($atts['class']);
307
+                $field['input_class'] = isset( $atts['class'] ) ? $atts['class'] : '';
308
+                if ( isset( $atts['class'] ) ) {
309
+                    unset( $atts['class'] );
310 310
                 }
311 311
 
312 312
                 $field['shortcodes'] = $atts;
313 313
                 ob_start();
314
-                include(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/input.php');
314
+                include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/input.php' );
315 315
                 $replace_with = ob_get_contents();
316 316
                 ob_end_clean();
317 317
             } else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) {
318
-                $replace_with = FrmProEntriesController::entry_delete_link($atts);
318
+                $replace_with = FrmProEntriesController::entry_delete_link( $atts );
319 319
             }
320 320
 
321
-            $html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html );
321
+            $html = str_replace( $shortcodes[0][$short_key], $replace_with, $html );
322 322
         }
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
         $html .= "\n";
334 334
 
335 335
         //Return html if conf_field to prevent loop
336
-        if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) {
336
+        if ( isset( $field['conf_field'] ) && $field['conf_field'] == 'stop' ) {
337 337
             return $html;
338 338
         }
339 339
 
340 340
         //If field is in repeating section
341 341
         if ( $args['section_id'] ) {
342
-            $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] ));
342
+            $html = apply_filters( 'frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] ) );
343 343
         } else {
344
-            $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form ));
344
+            $html = apply_filters( 'frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form ) );
345 345
         }
346 346
 
347 347
 		self::remove_collapse_shortcode( $html );
@@ -363,10 +363,10 @@  discard block
 block discarded – undo
363 363
 	* @param $html string
364 364
 	*/
365 365
 	private static function get_more_field_classes( &$error_class, $field, $field_id, $html ) {
366
-		$error_class .= ' frm_'. $field['label'] .'_container';
366
+		$error_class .= ' frm_' . $field['label'] . '_container';
367 367
 		if ( $field['id'] != $field_id ) {
368 368
 			// add a class for repeating/embedded fields
369
-			$error_class .= ' frm_field_'. $field['id'] .'_container';
369
+			$error_class .= ' frm_field_' . $field['id'] . '_container';
370 370
 		}
371 371
 
372 372
 		// Add class to embedded form field
@@ -418,22 +418,22 @@  discard block
 block discarded – undo
418 418
 
419 419
 		//insert custom CSS classes
420 420
 		if ( ! empty( $field['classes'] ) ) {
421
-			if ( ! strpos( $html, 'frm_form_field ') ) {
421
+			if ( ! strpos( $html, 'frm_form_field ' ) ) {
422 422
 				$error_class .= ' frm_form_field';
423 423
 			}
424
-			$error_class .= ' '. $field['classes'];
424
+			$error_class .= ' ' . $field['classes'];
425 425
 		}
426 426
 	}
427 427
 
428 428
     public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) {
429 429
         if ( $no_vars ) {
430
-            $html = str_replace( '[if '. $code.']', '', $html );
431
-    	    $html = str_replace( '[/if '. $code.']', '', $html );
430
+            $html = str_replace( '[if ' . $code . ']', '', $html );
431
+    	    $html = str_replace( '[/if ' . $code . ']', '', $html );
432 432
         } else {
433
-            $html = preg_replace( '/(\[if\s+'. $code .'\])(.*?)(\[\/if\s+'. $code .'\])/mis', '', $html );
433
+            $html = preg_replace( '/(\[if\s+' . $code . '\])(.*?)(\[\/if\s+' . $code . '\])/mis', '', $html );
434 434
         }
435 435
 
436
-        $html = str_replace( '['. $code .']', $replace_with, $html );
436
+        $html = str_replace( '[' . $code . ']', $replace_with, $html );
437 437
     }
438 438
 
439 439
 	public static function get_shortcode_tag( $shortcodes, $short_key, $args ) {
@@ -452,15 +452,15 @@  discard block
 block discarded – undo
452 452
         }
453 453
 
454 454
         $with_tags = $args['conditional_check'] ? 3 : 2;
455
-        if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
456
-            $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
457
-            $tag = str_replace(']', '', $tag);
458
-            $tags = explode(' ', $tag);
459
-            if ( is_array($tags) ) {
455
+        if ( ! empty( $shortcodes[$with_tags][$short_key] ) ) {
456
+            $tag = str_replace( '[' . $prefix, '', $shortcodes[0][$short_key] );
457
+            $tag = str_replace( ']', '', $tag );
458
+            $tags = explode( ' ', $tag );
459
+            if ( is_array( $tags ) ) {
460 460
                 $tag = $tags[0];
461 461
             }
462 462
         } else {
463
-            $tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
463
+            $tag = $shortcodes[$with_tags - 1][$short_key];
464 464
         }
465 465
 
466 466
         return $tag;
@@ -478,16 +478,16 @@  discard block
 block discarded – undo
478 478
 
479 479
 	public static function display_recaptcha( $field ) {
480 480
         $frm_settings = FrmAppHelper::get_settings();
481
-        $lang = apply_filters('frm_recaptcha_lang', $frm_settings->re_lang, $field);
481
+        $lang = apply_filters( 'frm_recaptcha_lang', $frm_settings->re_lang, $field );
482 482
 
483 483
         $api_js_url = 'https://www.google.com/recaptcha/api.js?onload=frmRecaptcha&render=explicit';
484 484
         if ( $lang != 'en' ) {
485
-            $api_js_url .= '&hl='. $lang;
485
+            $api_js_url .= '&hl=' . $lang;
486 486
         }
487
-        $api_js_url = apply_filters('frm_recpatcha_js_url', $api_js_url);
487
+        $api_js_url = apply_filters( 'frm_recpatcha_js_url', $api_js_url );
488 488
 
489
-        wp_register_script('recaptcha-api', $api_js_url, '', true);
490
-        wp_enqueue_script('recaptcha-api');
489
+        wp_register_script( 'recaptcha-api', $api_js_url, '', true );
490
+        wp_enqueue_script( 'recaptcha-api' );
491 491
 
492 492
 ?>
493 493
 <div id="field_<?php echo esc_attr( $field['field_key'] ) ?>" class="frm-g-recaptcha" data-sitekey="<?php echo esc_attr( $frm_settings->pubkey ) ?>" data-size="<?php echo esc_attr( $field['captcha_size'] ) ?>"></div>
@@ -496,45 +496,45 @@  discard block
 block discarded – undo
496 496
 
497 497
 	public static function show_single_option( $field ) {
498 498
         $field_name = $field['name'];
499
-        $html_id = self::get_html_id($field);
499
+        $html_id = self::get_html_id( $field );
500 500
         foreach ( $field['options'] as $opt_key => $opt ) {
501
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
502
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
501
+            $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field );
502
+            $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field );
503 503
 
504 504
             // If this is an "Other" option, get the HTML for it
505 505
 			if ( self::is_other_opt( $opt_key ) ) {
506 506
                 // Get string for Other text field, if needed
507 507
 				$other_val = self::get_other_val( compact( 'opt_key', 'field' ) );
508
-                require(FrmAppHelper::plugin_path() .'/pro/classes/views/frmpro-fields/other-option.php');
508
+                require( FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/other-option.php' );
509 509
             } else {
510
-                require(FrmAppHelper::plugin_path() .'/classes/views/frm-fields/single-option.php');
510
+                require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' );
511 511
             }
512 512
         }
513 513
     }
514 514
 
515 515
 	public static function dropdown_categories( $args ) {
516 516
 		$defaults = array( 'field' => false, 'name' => false, 'show_option_all' => ' ' );
517
-        $args = wp_parse_args($args, $defaults);
517
+        $args = wp_parse_args( $args, $defaults );
518 518
 
519 519
         if ( ! $args['field'] ) {
520 520
             return;
521 521
         }
522 522
 
523 523
         if ( ! $args['name'] ) {
524
-            $args['name'] = 'item_meta['. $args['field']['id'] .']';
524
+            $args['name'] = 'item_meta[' . $args['field']['id'] . ']';
525 525
         }
526 526
 
527
-        $id = self::get_html_id($args['field']);
527
+        $id = self::get_html_id( $args['field'] );
528 528
         $class = $args['field']['type'];
529 529
 
530
-        $exclude = (is_array($args['field']['exclude_cat'])) ? implode(',', $args['field']['exclude_cat']) : $args['field']['exclude_cat'];
531
-        $exclude = apply_filters('frm_exclude_cats', $exclude, $args['field']);
530
+        $exclude = ( is_array( $args['field']['exclude_cat'] ) ) ? implode( ',', $args['field']['exclude_cat'] ) : $args['field']['exclude_cat'];
531
+        $exclude = apply_filters( 'frm_exclude_cats', $exclude, $args['field'] );
532 532
 
533
-        if ( is_array($args['field']['value']) ) {
534
-            if ( ! empty($exclude) ) {
535
-                $args['field']['value'] = array_diff($args['field']['value'], explode(',', $exclude));
533
+        if ( is_array( $args['field']['value'] ) ) {
534
+            if ( ! empty( $exclude ) ) {
535
+                $args['field']['value'] = array_diff( $args['field']['value'], explode( ',', $exclude ) );
536 536
             }
537
-            $selected = reset($args['field']['value']);
537
+            $selected = reset( $args['field']['value'] );
538 538
         } else {
539 539
             $selected = $args['field']['value'];
540 540
         }
@@ -545,40 +545,40 @@  discard block
 block discarded – undo
545 545
             'hide_empty' => false, 'echo' => 0, 'orderby' => 'name',
546 546
         );
547 547
 
548
-        $tax_atts = apply_filters('frm_dropdown_cat', $tax_atts, $args['field']);
548
+        $tax_atts = apply_filters( 'frm_dropdown_cat', $tax_atts, $args['field'] );
549 549
 
550 550
         if ( FrmAppHelper::pro_is_installed() ) {
551
-            $post_type = FrmProFormsHelper::post_type($args['field']['form_id']);
552
-            $tax_atts['taxonomy'] = FrmProAppHelper::get_custom_taxonomy($post_type, $args['field']);
551
+            $post_type = FrmProFormsHelper::post_type( $args['field']['form_id'] );
552
+            $tax_atts['taxonomy'] = FrmProAppHelper::get_custom_taxonomy( $post_type, $args['field'] );
553 553
             if ( ! $tax_atts['taxonomy'] ) {
554 554
                 return;
555 555
             }
556 556
 
557 557
             // If field type is dropdown (not Dynamic), exclude children when parent is excluded
558
-            if ( $args['field']['type'] != 'data' && is_taxonomy_hierarchical($tax_atts['taxonomy']) ) {
558
+            if ( $args['field']['type'] != 'data' && is_taxonomy_hierarchical( $tax_atts['taxonomy'] ) ) {
559 559
                 $tax_atts['exclude_tree'] = $exclude;
560 560
             }
561 561
         }
562 562
 
563
-        $dropdown = wp_dropdown_categories($tax_atts);
563
+        $dropdown = wp_dropdown_categories( $tax_atts );
564 564
 
565
-        $add_html = FrmFieldsController::input_html($args['field'], false);
565
+        $add_html = FrmFieldsController::input_html( $args['field'], false );
566 566
 
567 567
         if ( FrmAppHelper::pro_is_installed() ) {
568
-            $add_html .= FrmProFieldsController::input_html($args['field'], false);
568
+            $add_html .= FrmProFieldsController::input_html( $args['field'], false );
569 569
         }
570 570
 
571
-		$dropdown = str_replace( "<select name='" . esc_attr( $args['name'] ) ."' id='" . esc_attr( $id ) . "' class='" . esc_attr( $class ) . "'", "<select name='" . esc_attr( $args['name'] ) . "' id='" . esc_attr( $id ) . "' " . $add_html, $dropdown );
571
+		$dropdown = str_replace( "<select name='" . esc_attr( $args['name'] ) . "' id='" . esc_attr( $id ) . "' class='" . esc_attr( $class ) . "'", "<select name='" . esc_attr( $args['name'] ) . "' id='" . esc_attr( $id ) . "' " . $add_html, $dropdown );
572 572
 
573
-        if ( is_array($args['field']['value']) ) {
573
+        if ( is_array( $args['field']['value'] ) ) {
574 574
             $skip = true;
575 575
             foreach ( $args['field']['value'] as $v ) {
576 576
 				if ( $skip ) {
577 577
                     $skip = false;
578 578
                     continue;
579 579
                 }
580
-				$dropdown = str_replace(' value="' . esc_attr( $v ) . '"', ' value="' . esc_attr( $v ) . '" selected="selected"', $dropdown );
581
-                unset($v);
580
+				$dropdown = str_replace( ' value="' . esc_attr( $v ) . '"', ' value="' . esc_attr( $v ) . '" selected="selected"', $dropdown );
581
+                unset( $v );
582 582
             }
583 583
         }
584 584
 
@@ -586,16 +586,16 @@  discard block
 block discarded – undo
586 586
     }
587 587
 
588 588
 	public static function get_term_link( $tax_id ) {
589
-        $tax = get_taxonomy($tax_id);
589
+        $tax = get_taxonomy( $tax_id );
590 590
         if ( ! $tax ) {
591 591
             return;
592 592
         }
593 593
 
594 594
         $link = sprintf(
595 595
             __( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
596
-            '<a href="'. esc_url( admin_url( 'edit-tags.php?taxonomy='. $tax->name ) ) .'" target="_blank">'. ( empty($tax->labels->name) ? __( 'Categories' ) : $tax->labels->name ) .'</a>'
596
+            '<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>'
597 597
         );
598
-        unset($tax);
598
+        unset( $tax );
599 599
 
600 600
         return $link;
601 601
     }
@@ -606,8 +606,8 @@  discard block
 block discarded – undo
606 606
 			$hide_opt = rtrim( $hide_opt );
607 607
 		}
608 608
 
609
-        if ( is_array($observed_value) ) {
610
-            return self::array_value_condition($observed_value, $cond, $hide_opt);
609
+        if ( is_array( $observed_value ) ) {
610
+            return self::array_value_condition( $observed_value, $cond, $hide_opt );
611 611
         }
612 612
 
613 613
         $m = false;
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
         } else if ( $cond == '<' ) {
621 621
             $m = $observed_value < $hide_opt;
622 622
         } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
623
-            $m = stripos($observed_value, $hide_opt);
623
+            $m = stripos( $observed_value, $hide_opt );
624 624
             if ( $cond == 'not LIKE' ) {
625 625
                 $m = ( $m === false ) ? true : false;
626 626
             } else {
@@ -633,23 +633,23 @@  discard block
 block discarded – undo
633 633
 	public static function array_value_condition( $observed_value, $cond, $hide_opt ) {
634 634
         $m = false;
635 635
         if ( $cond == '==' ) {
636
-            if ( is_array($hide_opt) ) {
637
-                $m = array_intersect($hide_opt, $observed_value);
638
-                $m = empty($m) ? false : true;
636
+            if ( is_array( $hide_opt ) ) {
637
+                $m = array_intersect( $hide_opt, $observed_value );
638
+                $m = empty( $m ) ? false : true;
639 639
             } else {
640
-                $m = in_array($hide_opt, $observed_value);
640
+                $m = in_array( $hide_opt, $observed_value );
641 641
             }
642 642
         } else if ( $cond == '!=' ) {
643
-            $m = ! in_array($hide_opt, $observed_value);
643
+            $m = ! in_array( $hide_opt, $observed_value );
644 644
         } else if ( $cond == '>' ) {
645
-            $min = min($observed_value);
645
+            $min = min( $observed_value );
646 646
             $m = $min > $hide_opt;
647 647
         } else if ( $cond == '<' ) {
648
-            $max = max($observed_value);
648
+            $max = max( $observed_value );
649 649
             $m = $max < $hide_opt;
650 650
         } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
651 651
             foreach ( $observed_value as $ob ) {
652
-                $m = strpos($ob, $hide_opt);
652
+                $m = strpos( $ob, $hide_opt );
653 653
                 if ( $m !== false ) {
654 654
                     $m = true;
655 655
                     break;
@@ -670,27 +670,27 @@  discard block
 block discarded – undo
670 670
      * @return string
671 671
      */
672 672
 	public static function basic_replace_shortcodes( $value, $form, $entry ) {
673
-        if ( strpos($value, '[sitename]') !== false ) {
673
+        if ( strpos( $value, '[sitename]' ) !== false ) {
674 674
             $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
675
-            $value = str_replace('[sitename]', $new_value, $value);
675
+            $value = str_replace( '[sitename]', $new_value, $value );
676 676
         }
677 677
 
678
-        $value = apply_filters('frm_content', $value, $form, $entry);
679
-        $value = do_shortcode($value);
678
+        $value = apply_filters( 'frm_content', $value, $form, $entry );
679
+        $value = do_shortcode( $value );
680 680
 
681 681
         return $value;
682 682
     }
683 683
 
684 684
 	public static function get_shortcodes( $content, $form_id ) {
685 685
         if ( FrmAppHelper::pro_is_installed() ) {
686
-            return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
686
+            return FrmProDisplaysHelper::get_shortcodes( $content, $form_id );
687 687
         }
688 688
 
689 689
         $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) );
690 690
 
691
-        $tagregexp = self::allowed_shortcodes($fields);
691
+        $tagregexp = self::allowed_shortcodes( $fields );
692 692
 
693
-        preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
693
+        preg_match_all( "/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER );
694 694
 
695 695
         return $matches;
696 696
     }
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
             $tagregexp[] = $field->field_key;
709 709
         }
710 710
 
711
-        $tagregexp = implode('|', $tagregexp);
711
+        $tagregexp = implode( '|', $tagregexp );
712 712
         return $tagregexp;
713 713
     }
714 714
 
@@ -720,28 +720,28 @@  discard block
 block discarded – undo
720 720
         );
721 721
 
722 722
         foreach ( $shortcodes[0] as $short_key => $tag ) {
723
-            $atts = shortcode_parse_atts( $shortcodes[3][ $short_key ] );
723
+            $atts = shortcode_parse_atts( $shortcodes[3][$short_key] );
724 724
 
725
-            if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
726
-				$tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] );
727
-                $tags = explode(' ', $tag);
728
-                if ( is_array($tags) ) {
725
+            if ( ! empty( $shortcodes[3][$short_key] ) ) {
726
+				$tag = str_replace( array( '[', ']' ), '', $shortcodes[0][$short_key] );
727
+                $tags = explode( ' ', $tag );
728
+                if ( is_array( $tags ) ) {
729 729
                     $tag = $tags[0];
730 730
                 }
731 731
             } else {
732
-                $tag = $shortcodes[2][ $short_key ];
732
+                $tag = $shortcodes[2][$short_key];
733 733
             }
734 734
 
735 735
             switch ( $tag ) {
736 736
                 case 'id':
737 737
                 case 'key':
738 738
                 case 'ip':
739
-                    $replace_with = $shortcode_values[ $tag ];
739
+                    $replace_with = $shortcode_values[$tag];
740 740
                 break;
741 741
 
742 742
                 case 'user_agent':
743 743
                 case 'user-agent':
744
-                    $entry->description = maybe_unserialize($entry->description);
744
+                    $entry->description = maybe_unserialize( $entry->description );
745 745
 					$replace_with = FrmEntryFormat::get_browser( $entry->description['browser'] );
746 746
                 break;
747 747
 
@@ -749,25 +749,25 @@  discard block
 block discarded – undo
749 749
                 case 'created-at':
750 750
                 case 'updated_at':
751 751
                 case 'updated-at':
752
-                    if ( isset($atts['format']) ) {
752
+                    if ( isset( $atts['format'] ) ) {
753 753
                         $time_format = ' ';
754 754
                     } else {
755
-                        $atts['format'] = get_option('date_format');
755
+                        $atts['format'] = get_option( 'date_format' );
756 756
                         $time_format = '';
757 757
                     }
758 758
 
759
-                    $this_tag = str_replace('-', '_', $tag);
760
-                    $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
761
-                    unset($this_tag);
759
+                    $this_tag = str_replace( '-', '_', $tag );
760
+                    $replace_with = FrmAppHelper::get_formatted_time( $entry->{$this_tag}, $atts['format'], $time_format );
761
+                    unset( $this_tag );
762 762
                 break;
763 763
 
764 764
                 case 'created_by':
765 765
                 case 'created-by':
766 766
                 case 'updated_by':
767 767
                 case 'updated-by':
768
-                    $this_tag = str_replace('-', '_', $tag);
768
+                    $this_tag = str_replace( '-', '_', $tag );
769 769
 					$replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts );
770
-                    unset($this_tag);
770
+                    unset( $this_tag );
771 771
                 break;
772 772
 
773 773
                 case 'admin_email':
@@ -784,16 +784,16 @@  discard block
 block discarded – undo
784 784
                         break;
785 785
                     }
786 786
 
787
-                    $sep = isset($atts['sep']) ? $atts['sep'] : ', ';
787
+                    $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', ';
788 788
 
789 789
                     $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
790 790
 
791 791
                     $atts['entry_id'] = $entry->id;
792 792
                     $atts['entry_key'] = $entry->item_key;
793 793
 
794
-                    if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
794
+                    if ( isset( $atts['show'] ) && $atts['show'] == 'field_label' ) {
795 795
                         $replace_with = $field->name;
796
-                    } else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
796
+                    } else if ( isset( $atts['show'] ) && $atts['show'] == 'description' ) {
797 797
                         $replace_with = $field->description;
798 798
 					} else {
799 799
 						$string_value = $replace_with;
@@ -808,15 +808,15 @@  discard block
 block discarded – undo
808 808
 						}
809 809
 					}
810 810
 
811
-                    unset($field);
811
+                    unset( $field );
812 812
                 break;
813 813
             }
814 814
 
815
-            if ( isset($replace_with) ) {
816
-                $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
815
+            if ( isset( $replace_with ) ) {
816
+                $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content );
817 817
             }
818 818
 
819
-            unset($atts, $conditional, $replace_with);
819
+            unset( $atts, $conditional, $replace_with );
820 820
 		}
821 821
 
822 822
 		return $content;
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
         $new_value = '';
833 833
         switch ( $tag ) {
834 834
             case 'admin_email':
835
-                $new_value = get_option('admin_email');
835
+                $new_value = get_option( 'admin_email' );
836 836
                 break;
837 837
             case 'siteurl':
838 838
                 $new_value = FrmAppHelper::site_url();
@@ -858,28 +858,28 @@  discard block
 block discarded – undo
858 858
      * @return string|array
859 859
      */
860 860
     public static function process_get_shortcode( $atts, $return_array = false ) {
861
-        if ( ! isset($atts['param']) ) {
861
+        if ( ! isset( $atts['param'] ) ) {
862 862
             return '';
863 863
         }
864 864
 
865
-        if ( strpos($atts['param'], '&#91;') ) {
866
-            $atts['param'] = str_replace('&#91;', '[', $atts['param']);
867
-            $atts['param'] = str_replace('&#93;', ']', $atts['param']);
865
+        if ( strpos( $atts['param'], '&#91;' ) ) {
866
+            $atts['param'] = str_replace( '&#91;', '[', $atts['param'] );
867
+            $atts['param'] = str_replace( '&#93;', ']', $atts['param'] );
868 868
         }
869 869
 
870
-        $new_value = FrmAppHelper::get_param($atts['param'], '');
870
+        $new_value = FrmAppHelper::get_param( $atts['param'], '' );
871 871
         $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
872 872
 
873 873
         if ( $new_value == '' ) {
874
-            if ( ! isset($atts['prev_val']) ) {
874
+            if ( ! isset( $atts['prev_val'] ) ) {
875 875
                 $atts['prev_val'] = '';
876 876
             }
877 877
 
878
-            $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
878
+            $new_value = isset( $atts['default'] ) ? $atts['default'] : $atts['prev_val'];
879 879
         }
880 880
 
881
-        if ( is_array($new_value) && ! $return_array ) {
882
-            $new_value = implode(', ', $new_value);
881
+        if ( is_array( $new_value ) && ! $return_array ) {
882
+            $new_value = implode( ', ', $new_value );
883 883
         }
884 884
 
885 885
         return $new_value;
@@ -892,12 +892,12 @@  discard block
 block discarded – undo
892 892
 		$replace_with = apply_filters( 'frm_get_display_value', $replace_with, $field, $atts );
893 893
 
894 894
         if ( $field->type == 'textarea' || $field->type == 'rte' ) {
895
-            $autop = isset($atts['wpautop']) ? $atts['wpautop'] : true;
896
-            if ( apply_filters('frm_use_wpautop', $autop) ) {
897
-                if ( is_array($replace_with) ) {
898
-                    $replace_with = implode("\n", $replace_with);
895
+            $autop = isset( $atts['wpautop'] ) ? $atts['wpautop'] : true;
896
+            if ( apply_filters( 'frm_use_wpautop', $autop ) ) {
897
+                if ( is_array( $replace_with ) ) {
898
+                    $replace_with = implode( "\n", $replace_with );
899 899
                 }
900
-                $replace_with = wpautop($replace_with);
900
+                $replace_with = wpautop( $replace_with );
901 901
             }
902 902
 			unset( $autop );
903 903
 		} else if ( is_array( $replace_with ) ) {
@@ -919,14 +919,14 @@  discard block
 block discarded – undo
919 919
 		$field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() );
920 920
 
921 921
         $field_types = array();
922
-        if ( in_array($type, $single_input) ) {
922
+        if ( in_array( $type, $single_input ) ) {
923 923
             self::field_types_for_input( $single_input, $field_selection, $field_types );
924
-        } else if ( in_array($type, $multiple_input) ) {
924
+        } else if ( in_array( $type, $multiple_input ) ) {
925 925
             self::field_types_for_input( $multiple_input, $field_selection, $field_types );
926
-        } else if ( in_array($type, $other_type) ) {
926
+        } else if ( in_array( $type, $other_type ) ) {
927 927
             self::field_types_for_input( $other_type, $field_selection, $field_types );
928
-		} else if ( isset( $field_selection[ $type ] ) ) {
929
-            $field_types[ $type ] = $field_selection[ $type ];
928
+		} else if ( isset( $field_selection[$type] ) ) {
929
+            $field_types[$type] = $field_selection[$type];
930 930
         }
931 931
 
932 932
         return $field_types;
@@ -934,8 +934,8 @@  discard block
 block discarded – undo
934 934
 
935 935
     private static function field_types_for_input( $inputs, $fields, &$field_types ) {
936 936
         foreach ( $inputs as $input ) {
937
-            $field_types[ $input ] = $fields[ $input ];
938
-            unset($input);
937
+            $field_types[$input] = $fields[$input];
938
+            unset( $input );
939 939
         }
940 940
     }
941 941
 
@@ -980,21 +980,21 @@  discard block
 block discarded – undo
980 980
 		// Check posted vals before checking saved values
981 981
 
982 982
 		// For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
983
-		if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) {
983
+		if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) {
984 984
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
985
-				$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 ] ) : '';
985
+				$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] ) : '';
986 986
 			} else {
987
-				$other_val = sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] );
987
+				$other_val = sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] );
988 988
 			}
989 989
 			return $other_val;
990 990
 
991
-		} else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) {
991
+		} else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) {
992 992
 			// For normal fields
993 993
 
994 994
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
995
-				$other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) : '';
995
+				$other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta']['other'][$field['id']][$opt_key] ) : '';
996 996
 			} else {
997
-				$other_val = sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ] );
997
+				$other_val = sanitize_text_field( $_POST['item_meta']['other'][$field['id']] );
998 998
 			}
999 999
 			return $other_val;
1000 1000
 		}
@@ -1003,8 +1003,8 @@  discard block
 block discarded – undo
1003 1003
 		if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) {
1004 1004
 			// Check if there is an "other" val in saved value and make sure the
1005 1005
 			// "other" val is not equal to the Other checkbox option
1006
-			if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) {
1007
-				$other_val = $field['value'][ $opt_key ];
1006
+			if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) {
1007
+				$other_val = $field['value'][$opt_key];
1008 1008
 			}
1009 1009
 		} else {
1010 1010
 			/**
@@ -1016,8 +1016,8 @@  discard block
 block discarded – undo
1016 1016
 				// Multi-select dropdowns - key is not preserved
1017 1017
 				if ( is_array( $field['value'] ) ) {
1018 1018
 					$o_key = array_search( $temp_val, $field['value'] );
1019
-					if ( isset( $field['value'][ $o_key ] ) ) {
1020
-						unset( $field['value'][ $o_key ], $o_key );
1019
+					if ( isset( $field['value'][$o_key] ) ) {
1020
+						unset( $field['value'][$o_key], $o_key );
1021 1021
 					}
1022 1022
 				} else if ( $temp_val == $field['value'] ) {
1023 1023
 					// For radio and regular dropdowns
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
 	private static function set_other_name( $args, &$other_args ) {
1075 1075
 		//Set up name for other field
1076 1076
 		$other_args['name'] = str_replace( '[]', '', $args['field_name'] );
1077
-		$other_args['name'] = preg_replace('/\[' . $args['field']['id'] . '\]$/', '', $other_args['name']);
1077
+		$other_args['name'] = preg_replace( '/\[' . $args['field']['id'] . '\]$/', '', $other_args['name'] );
1078 1078
 		$other_args['name'] = $other_args['name'] . '[other]' . '[' . $args['field']['id'] . ']';
1079 1079
 
1080 1080
 		//Converts item_meta[field_id] => item_meta[other][field_id] and
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
 		// Count should only be greater than 3 if inside of a repeating section
1101 1101
 		if ( count( $temp_array ) > 3 ) {
1102 1102
 			$parent = str_replace( ']', '', $temp_array[1] );
1103
-			$pointer = str_replace( ']', '', $temp_array[2]);
1103
+			$pointer = str_replace( ']', '', $temp_array[2] );
1104 1104
 		}
1105 1105
 
1106 1106
 		// Get text for "other" text field
@@ -1167,11 +1167,11 @@  discard block
 block discarded – undo
1167 1167
 
1168 1168
 			if ( $display['default_blank'] ) {
1169 1169
 				self::show_default_blank_js( $field['default_blank'] );
1170
-				echo '<input type="hidden" name="field_options[default_blank_'. esc_attr( $field['id'] ) .']" value="' . esc_attr( $field['default_blank'] ) .'" />';
1170
+				echo '<input type="hidden" name="field_options[default_blank_' . esc_attr( $field['id'] ) . ']" value="' . esc_attr( $field['default_blank'] ) . '" />';
1171 1171
 			}
1172 1172
 
1173 1173
 			self::show_onfocus_js( $field['clear_on_focus'] );
1174
-			echo '<input type="hidden" name="field_options[clear_on_focus_'. esc_attr( $field['id'] ) .']" value="' . esc_attr( $field['default_blank'] ) .'" />';
1174
+			echo '<input type="hidden" name="field_options[clear_on_focus_' . esc_attr( $field['id'] ) . ']" value="' . esc_attr( $field['default_blank'] ) . '" />';
1175 1175
 
1176 1176
 			echo '</span>';
1177 1177
 		}
@@ -1205,29 +1205,29 @@  discard block
 block discarded – undo
1205 1205
         $replace = array();
1206 1206
         $replace_with = array();
1207 1207
         foreach ( (array) $frm_duplicate_ids as $old => $new ) {
1208
-            $replace[] = '[if '. $old .']';
1209
-            $replace_with[] = '[if '. $new .']';
1210
-            $replace[] = '[if '. $old .' ';
1211
-            $replace_with[] = '[if '. $new .' ';
1212
-            $replace[] = '[/if '. $old .']';
1213
-            $replace_with[] = '[/if '. $new .']';
1214
-            $replace[] = '[foreach '. $old .']';
1215
-            $replace_with[] = '[foreach '. $new .']';
1216
-            $replace[] = '[/foreach '. $old .']';
1217
-            $replace_with[] = '[/foreach '. $new .']';
1218
-            $replace[] = '['. $old .']';
1219
-            $replace_with[] = '['. $new .']';
1220
-            $replace[] = '['. $old .' ';
1221
-            $replace_with[] = '['. $new .' ';
1222
-            unset($old, $new);
1208
+            $replace[] = '[if ' . $old . ']';
1209
+            $replace_with[] = '[if ' . $new . ']';
1210
+            $replace[] = '[if ' . $old . ' ';
1211
+            $replace_with[] = '[if ' . $new . ' ';
1212
+            $replace[] = '[/if ' . $old . ']';
1213
+            $replace_with[] = '[/if ' . $new . ']';
1214
+            $replace[] = '[foreach ' . $old . ']';
1215
+            $replace_with[] = '[foreach ' . $new . ']';
1216
+            $replace[] = '[/foreach ' . $old . ']';
1217
+            $replace_with[] = '[/foreach ' . $new . ']';
1218
+            $replace[] = '[' . $old . ']';
1219
+            $replace_with[] = '[' . $new . ']';
1220
+            $replace[] = '[' . $old . ' ';
1221
+            $replace_with[] = '[' . $new . ' ';
1222
+            unset( $old, $new );
1223 1223
         }
1224 1224
 		if ( is_array( $val ) ) {
1225 1225
 			foreach ( $val as $k => $v ) {
1226
-                $val[ $k ] = str_replace( $replace, $replace_with, $v );
1227
-                unset($k, $v);
1226
+                $val[$k] = str_replace( $replace, $replace_with, $v );
1227
+                unset( $k, $v );
1228 1228
             }
1229 1229
         } else {
1230
-            $val = str_replace($replace, $replace_with, $val);
1230
+            $val = str_replace( $replace, $replace_with, $val );
1231 1231
         }
1232 1232
 
1233 1233
         return $val;
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
             'DC' => 'District of Columbia',
1241 1241
             'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho',
1242 1242
             'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas',
1243
-            'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland',
1243
+            'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine', 'MD' => 'Maryland',
1244 1244
             'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi',
1245 1245
             'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada',
1246 1246
             'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York',
@@ -1331,35 +1331,35 @@  discard block
 block discarded – undo
1331 1331
     }
1332 1332
 
1333 1333
 	public static function get_bulk_prefilled_opts( array &$prepop ) {
1334
-		$prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries();
1334
+		$prepop[__( 'Countries', 'formidable' )] = FrmFieldsHelper::get_countries();
1335 1335
 
1336 1336
         $states = FrmFieldsHelper::get_us_states();
1337
-        $state_abv = array_keys($states);
1338
-        sort($state_abv);
1339
-		$prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
1337
+        $state_abv = array_keys( $states );
1338
+        sort( $state_abv );
1339
+		$prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv;
1340 1340
 
1341
-        $states = array_values($states);
1342
-        sort($states);
1343
-		$prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
1344
-        unset($state_abv, $states);
1341
+        $states = array_values( $states );
1342
+        sort( $states );
1343
+		$prepop[__( 'U.S. States', 'formidable' )] = $states;
1344
+        unset( $state_abv, $states );
1345 1345
 
1346
-		$prepop[ __( 'Age', 'formidable' ) ] = array(
1346
+		$prepop[__( 'Age', 'formidable' )] = array(
1347 1347
             __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ),
1348 1348
             __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ),
1349 1349
             __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ),
1350 1350
         );
1351 1351
 
1352
-		$prepop[ __( 'Satisfaction', 'formidable' ) ] = array(
1352
+		$prepop[__( 'Satisfaction', 'formidable' )] = array(
1353 1353
             __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ),
1354 1354
             __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ),
1355 1355
         );
1356 1356
 
1357
-		$prepop[ __( 'Importance', 'formidable' ) ] = array(
1357
+		$prepop[__( 'Importance', 'formidable' )] = array(
1358 1358
             __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ),
1359 1359
             __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ),
1360 1360
         );
1361 1361
 
1362
-		$prepop[ __( 'Agreement', 'formidable' ) ] = array(
1362
+		$prepop[__( 'Agreement', 'formidable' )] = array(
1363 1363
             __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ),
1364 1364
             __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ),
1365 1365
         );
Please login to merge, or discard this patch.