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