Completed
Push — master ( 850b26...de47be )
by Stephanie
07:02 queued 03:32
created
classes/helpers/FrmFieldsHelper.php 1 patch
Indentation   +691 added lines, -691 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,82 +208,82 @@  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]
275
-        $field['label'] = apply_filters('frm_html_label_position', $field['label'], $field, $form);
276
-        $field['label'] = ( $field['label'] && $field['label'] != '' ) ? $field['label'] : 'top';
274
+		//replace [label_position]
275
+		$field['label'] = apply_filters('frm_html_label_position', $field['label'], $field, $form);
276
+		$field['label'] = ( $field['label'] && $field['label'] != '' ) ? $field['label'] : 'top';
277 277
 		$html = str_replace( '[label_position]', ( ( in_array( $field['type'], array( 'divider', 'end_divider', 'break' ) ) ) ? $field['label'] : ' frm_primary_label' ), $html );
278 278
 
279
-        //replace [field_name]
280
-        $html = str_replace('[field_name]', $field['name'], $html);
279
+		//replace [field_name]
280
+		$html = str_replace('[field_name]', $field['name'], $html);
281 281
 
282 282
 		self::add_field_div_classes( $field_id, $field, $errors, $html );
283 283
 
284
-        //replace [entry_key]
285
-        $entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' );
286
-        $html = str_replace('[entry_key]', $entry_key, $html);
284
+		//replace [entry_key]
285
+		$entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' );
286
+		$html = str_replace('[entry_key]', $entry_key, $html);
287 287
 
288 288
 		if ( $form ) {
289 289
 			$form = (array) $form;
@@ -297,57 +297,57 @@  discard block
 block discarded – undo
297 297
 
298 298
 		self::process_wp_shortcodes( $html );
299 299
 
300
-        //replace [input]
301
-        preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER);
302
-        global $frm_vars;
303
-        $frm_settings = FrmAppHelper::get_settings();
300
+		//replace [input]
301
+		preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER);
302
+		global $frm_vars;
303
+		$frm_settings = FrmAppHelper::get_settings();
304 304
 
305
-        foreach ( $shortcodes[0] as $short_key => $tag ) {
306
-            $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
305
+		foreach ( $shortcodes[0] as $short_key => $tag ) {
306
+			$atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
307 307
 			$tag = self::get_shortcode_tag( $shortcodes, $short_key, array( 'conditional' => false, 'conditional_check' => false ) );
308 308
 
309
-            $replace_with = '';
309
+			$replace_with = '';
310 310
 
311
-            if ( $tag == 'input' ) {
312
-                if ( isset($atts['opt']) ) {
313
-                    $atts['opt']--;
314
-                }
311
+			if ( $tag == 'input' ) {
312
+				if ( isset($atts['opt']) ) {
313
+					$atts['opt']--;
314
+				}
315 315
 
316
-                $field['input_class'] = isset($atts['class']) ? $atts['class'] : '';
317
-                if ( isset($atts['class']) ) {
318
-                    unset($atts['class']);
319
-                }
316
+				$field['input_class'] = isset($atts['class']) ? $atts['class'] : '';
317
+				if ( isset($atts['class']) ) {
318
+					unset($atts['class']);
319
+				}
320 320
 
321
-                $field['shortcodes'] = $atts;
322
-                ob_start();
321
+				$field['shortcodes'] = $atts;
322
+				ob_start();
323 323
 				include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/input.php' );
324
-                $replace_with = ob_get_contents();
325
-                ob_end_clean();
326
-            } else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) {
327
-                $replace_with = FrmProEntriesController::entry_delete_link($atts);
328
-            }
324
+				$replace_with = ob_get_contents();
325
+				ob_end_clean();
326
+			} else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) {
327
+				$replace_with = FrmProEntriesController::entry_delete_link($atts);
328
+			}
329 329
 
330
-            $html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html );
331
-        }
330
+			$html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html );
331
+		}
332 332
 
333
-        $html .= "\n";
333
+		$html .= "\n";
334 334
 
335
-        //Return html if conf_field to prevent loop
336
-        if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) {
337
-            return $html;
338
-        }
335
+		//Return html if conf_field to prevent loop
336
+		if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) {
337
+			return $html;
338
+		}
339 339
 
340
-        //If field is in repeating section
341
-        if ( $args['section_id'] ) {
342
-            $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] ));
343
-        } else {
344
-            $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form ));
345
-        }
340
+		//If field is in repeating section
341
+		if ( $args['section_id'] ) {
342
+			$html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] ));
343
+		} else {
344
+			$html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form ));
345
+		}
346 346
 
347 347
 		self::remove_collapse_shortcode( $html );
348 348
 
349
-        return $html;
350
-    }
349
+		return $html;
350
+	}
351 351
 
352 352
 	/**
353 353
 	 * This filters shortcodes in the field HTML
@@ -412,46 +412,46 @@  discard block
 block discarded – undo
412 412
 		return $classes;
413 413
 	}
414 414
 
415
-    public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) {
416
-        if ( $no_vars ) {
415
+	public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) {
416
+		if ( $no_vars ) {
417 417
 			$html = str_replace( '[if ' . $code . ']', '', $html );
418 418
 			$html = str_replace( '[/if ' . $code . ']', '', $html );
419
-        } else {
419
+		} else {
420 420
 			$html = preg_replace( '/(\[if\s+' . $code . '\])(.*?)(\[\/if\s+' . $code . '\])/mis', '', $html );
421
-        }
421
+		}
422 422
 
423 423
 		$html = str_replace( '[' . $code . ']', $replace_with, $html );
424
-    }
424
+	}
425 425
 
426 426
 	public static function get_shortcode_tag( $shortcodes, $short_key, $args ) {
427 427
 		$args = wp_parse_args( $args, array( 'conditional' => false, 'conditional_check' => false, 'foreach' => false ) );
428
-        if ( ( $args['conditional'] || $args['foreach'] ) && ! $args['conditional_check'] ) {
429
-            $args['conditional_check'] = true;
430
-        }
431
-
432
-        $prefix = '';
433
-        if ( $args['conditional_check'] ) {
434
-            if ( $args['conditional'] ) {
435
-                $prefix = 'if ';
436
-            } else if ( $args['foreach'] ) {
437
-                $prefix = 'foreach ';
438
-            }
439
-        }
440
-
441
-        $with_tags = $args['conditional_check'] ? 3 : 2;
442
-        if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
443
-            $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
444
-            $tag = str_replace(']', '', $tag);
445
-            $tags = explode(' ', $tag);
446
-            if ( is_array($tags) ) {
447
-                $tag = $tags[0];
448
-            }
449
-        } else {
450
-            $tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
451
-        }
452
-
453
-        return $tag;
454
-    }
428
+		if ( ( $args['conditional'] || $args['foreach'] ) && ! $args['conditional_check'] ) {
429
+			$args['conditional_check'] = true;
430
+		}
431
+
432
+		$prefix = '';
433
+		if ( $args['conditional_check'] ) {
434
+			if ( $args['conditional'] ) {
435
+				$prefix = 'if ';
436
+			} else if ( $args['foreach'] ) {
437
+				$prefix = 'foreach ';
438
+			}
439
+		}
440
+
441
+		$with_tags = $args['conditional_check'] ? 3 : 2;
442
+		if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
443
+			$tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
444
+			$tag = str_replace(']', '', $tag);
445
+			$tags = explode(' ', $tag);
446
+			if ( is_array($tags) ) {
447
+				$tag = $tags[0];
448
+			}
449
+		} else {
450
+			$tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
451
+		}
452
+
453
+		return $tag;
454
+	}
455 455
 
456 456
 	/**
457 457
 	 * Remove [collapse_this] if it's still included after all processing
@@ -489,8 +489,8 @@  discard block
 block discarded – undo
489 489
 		}
490 490
 		$api_js_url = apply_filters( 'frm_recaptcha_js_url', $api_js_url );
491 491
 
492
-        wp_register_script( 'recaptcha-api', $api_js_url, '', true );
493
-        wp_enqueue_script( 'recaptcha-api' );
492
+		wp_register_script( 'recaptcha-api', $api_js_url, '', true );
493
+		wp_enqueue_script( 'recaptcha-api' );
494 494
 
495 495
 		// for reverse compatability
496 496
 		$field['captcha_size'] = ( $field['captcha_size'] == 'default' ) ? 'normal' : $field['captcha_size'];
@@ -502,40 +502,40 @@  discard block
 block discarded – undo
502 502
 	}
503 503
 ?>></div>
504 504
 <?php
505
-    }
505
+	}
506 506
 
507 507
 	public static function show_single_option( $field ) {
508
-        $field_name = $field['name'];
509
-        $html_id = self::get_html_id($field);
510
-        foreach ( $field['options'] as $opt_key => $opt ) {
511
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
512
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
508
+		$field_name = $field['name'];
509
+		$html_id = self::get_html_id($field);
510
+		foreach ( $field['options'] as $opt_key => $opt ) {
511
+			$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
512
+			$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
513 513
 
514
-            // If this is an "Other" option, get the HTML for it
514
+			// If this is an "Other" option, get the HTML for it
515 515
 			if ( self::is_other_opt( $opt_key ) ) {
516
-                // Get string for Other text field, if needed
516
+				// Get string for Other text field, if needed
517 517
 				$other_val = self::get_other_val( compact( 'opt_key', 'field' ) );
518 518
 				require( FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/other-option.php' );
519
-            } else {
519
+			} else {
520 520
 				require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' );
521
-            }
522
-        }
523
-    }
521
+			}
522
+		}
523
+	}
524 524
 
525 525
 	public static function get_term_link( $tax_id ) {
526
-        $tax = get_taxonomy($tax_id);
527
-        if ( ! $tax ) {
528
-            return;
529
-        }
526
+		$tax = get_taxonomy($tax_id);
527
+		if ( ! $tax ) {
528
+			return;
529
+		}
530 530
 
531
-        $link = sprintf(
532
-            __( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
531
+		$link = sprintf(
532
+			__( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
533 533
 			'<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>'
534
-        );
535
-        unset($tax);
534
+		);
535
+		unset($tax);
536 536
 
537
-        return $link;
538
-    }
537
+		return $link;
538
+	}
539 539
 
540 540
 	public static function value_meets_condition( $observed_value, $cond, $hide_opt ) {
541 541
 		// Remove white space from hide_opt
@@ -546,199 +546,199 @@  discard block
 block discarded – undo
546 546
 		$observed_value = wp_kses_post( $observed_value );
547 547
 		$hide_opt = wp_kses_post( $hide_opt );
548 548
 
549
-        if ( is_array($observed_value) ) {
550
-            return self::array_value_condition($observed_value, $cond, $hide_opt);
551
-        }
552
-
553
-        $m = false;
554
-        if ( $cond == '==' ) {
555
-            $m = $observed_value == $hide_opt;
556
-        } else if ( $cond == '!=' ) {
557
-            $m = $observed_value != $hide_opt;
558
-        } else if ( $cond == '>' ) {
559
-            $m = $observed_value > $hide_opt;
560
-        } else if ( $cond == '<' ) {
561
-            $m = $observed_value < $hide_opt;
562
-        } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
563
-            $m = stripos($observed_value, $hide_opt);
564
-            if ( $cond == 'not LIKE' ) {
565
-                $m = ( $m === false ) ? true : false;
566
-            } else {
567
-                $m = ( $m === false ) ? false : true;
568
-            }
569
-        }
570
-        return $m;
571
-    }
549
+		if ( is_array($observed_value) ) {
550
+			return self::array_value_condition($observed_value, $cond, $hide_opt);
551
+		}
552
+
553
+		$m = false;
554
+		if ( $cond == '==' ) {
555
+			$m = $observed_value == $hide_opt;
556
+		} else if ( $cond == '!=' ) {
557
+			$m = $observed_value != $hide_opt;
558
+		} else if ( $cond == '>' ) {
559
+			$m = $observed_value > $hide_opt;
560
+		} else if ( $cond == '<' ) {
561
+			$m = $observed_value < $hide_opt;
562
+		} else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
563
+			$m = stripos($observed_value, $hide_opt);
564
+			if ( $cond == 'not LIKE' ) {
565
+				$m = ( $m === false ) ? true : false;
566
+			} else {
567
+				$m = ( $m === false ) ? false : true;
568
+			}
569
+		}
570
+		return $m;
571
+	}
572 572
 
573 573
 	public static function array_value_condition( $observed_value, $cond, $hide_opt ) {
574
-        $m = false;
575
-        if ( $cond == '==' ) {
576
-            if ( is_array($hide_opt) ) {
577
-                $m = array_intersect($hide_opt, $observed_value);
578
-                $m = empty($m) ? false : true;
579
-            } else {
580
-                $m = in_array($hide_opt, $observed_value);
581
-            }
582
-        } else if ( $cond == '!=' ) {
583
-            $m = ! in_array($hide_opt, $observed_value);
584
-        } else if ( $cond == '>' ) {
585
-            $min = min($observed_value);
586
-            $m = $min > $hide_opt;
587
-        } else if ( $cond == '<' ) {
588
-            $max = max($observed_value);
589
-            $m = $max < $hide_opt;
590
-        } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
591
-            foreach ( $observed_value as $ob ) {
592
-                $m = strpos($ob, $hide_opt);
593
-                if ( $m !== false ) {
594
-                    $m = true;
595
-                    break;
596
-                }
597
-            }
598
-
599
-            if ( $cond == 'not LIKE' ) {
600
-                $m = ( $m === false ) ? true : false;
601
-            }
602
-        }
603
-
604
-        return $m;
605
-    }
606
-
607
-    /**
608
-     * Replace a few basic shortcodes and field ids
609
-     * @since 2.0
610
-     * @return string
611
-     */
574
+		$m = false;
575
+		if ( $cond == '==' ) {
576
+			if ( is_array($hide_opt) ) {
577
+				$m = array_intersect($hide_opt, $observed_value);
578
+				$m = empty($m) ? false : true;
579
+			} else {
580
+				$m = in_array($hide_opt, $observed_value);
581
+			}
582
+		} else if ( $cond == '!=' ) {
583
+			$m = ! in_array($hide_opt, $observed_value);
584
+		} else if ( $cond == '>' ) {
585
+			$min = min($observed_value);
586
+			$m = $min > $hide_opt;
587
+		} else if ( $cond == '<' ) {
588
+			$max = max($observed_value);
589
+			$m = $max < $hide_opt;
590
+		} else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
591
+			foreach ( $observed_value as $ob ) {
592
+				$m = strpos($ob, $hide_opt);
593
+				if ( $m !== false ) {
594
+					$m = true;
595
+					break;
596
+				}
597
+			}
598
+
599
+			if ( $cond == 'not LIKE' ) {
600
+				$m = ( $m === false ) ? true : false;
601
+			}
602
+		}
603
+
604
+		return $m;
605
+	}
606
+
607
+	/**
608
+	 * Replace a few basic shortcodes and field ids
609
+	 * @since 2.0
610
+	 * @return string
611
+	 */
612 612
 	public static function basic_replace_shortcodes( $value, $form, $entry ) {
613
-        if ( strpos($value, '[sitename]') !== false ) {
614
-            $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
615
-            $value = str_replace('[sitename]', $new_value, $value);
616
-        }
613
+		if ( strpos($value, '[sitename]') !== false ) {
614
+			$new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
615
+			$value = str_replace('[sitename]', $new_value, $value);
616
+		}
617 617
 
618
-        $value = apply_filters('frm_content', $value, $form, $entry);
619
-        $value = do_shortcode($value);
618
+		$value = apply_filters('frm_content', $value, $form, $entry);
619
+		$value = do_shortcode($value);
620 620
 
621
-        return $value;
622
-    }
621
+		return $value;
622
+	}
623 623
 
624 624
 	public static function get_shortcodes( $content, $form_id ) {
625
-        if ( FrmAppHelper::pro_is_installed() ) {
626
-            return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
627
-        }
625
+		if ( FrmAppHelper::pro_is_installed() ) {
626
+			return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
627
+		}
628 628
 
629
-        $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) );
629
+		$fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) );
630 630
 
631
-        $tagregexp = self::allowed_shortcodes($fields);
631
+		$tagregexp = self::allowed_shortcodes($fields);
632 632
 
633
-        preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
633
+		preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
634 634
 
635
-        return $matches;
636
-    }
635
+		return $matches;
636
+	}
637 637
 
638 638
 	public static function allowed_shortcodes( $fields = array() ) {
639
-        $tagregexp = array(
640
-            'editlink', 'id', 'key', 'ip',
641
-            'siteurl', 'sitename', 'admin_email',
642
-            'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by',
639
+		$tagregexp = array(
640
+			'editlink', 'id', 'key', 'ip',
641
+			'siteurl', 'sitename', 'admin_email',
642
+			'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by',
643 643
 			'parent[-|_]id',
644
-        );
644
+		);
645 645
 
646
-        foreach ( $fields as $field ) {
647
-            $tagregexp[] = $field->id;
648
-            $tagregexp[] = $field->field_key;
649
-        }
646
+		foreach ( $fields as $field ) {
647
+			$tagregexp[] = $field->id;
648
+			$tagregexp[] = $field->field_key;
649
+		}
650 650
 
651
-        $tagregexp = implode('|', $tagregexp);
652
-        return $tagregexp;
653
-    }
651
+		$tagregexp = implode('|', $tagregexp);
652
+		return $tagregexp;
653
+	}
654 654
 
655 655
 	public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
656
-        $shortcode_values = array(
657
-           'id'     => $entry->id,
658
-           'key'    => $entry->item_key,
659
-           'ip'     => $entry->ip,
660
-        );
656
+		$shortcode_values = array(
657
+		   'id'     => $entry->id,
658
+		   'key'    => $entry->item_key,
659
+		   'ip'     => $entry->ip,
660
+		);
661 661
 
662
-        foreach ( $shortcodes[0] as $short_key => $tag ) {
662
+		foreach ( $shortcodes[0] as $short_key => $tag ) {
663 663
 			if ( empty( $tag ) ) {
664 664
 				continue;
665 665
 			}
666 666
 
667
-            $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] );
667
+			$atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] );
668 668
 
669
-            if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
669
+			if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
670 670
 				$tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] );
671
-                $tags = explode(' ', $tag);
672
-                if ( is_array($tags) ) {
673
-                    $tag = $tags[0];
674
-                }
675
-            } else {
676
-                $tag = $shortcodes[2][ $short_key ];
677
-            }
678
-
679
-            switch ( $tag ) {
680
-                case 'id':
681
-                case 'key':
682
-                case 'ip':
683
-                    $replace_with = $shortcode_values[ $tag ];
684
-                break;
685
-
686
-                case 'user_agent':
687
-                case 'user-agent':
688
-                    $entry->description = maybe_unserialize($entry->description);
671
+				$tags = explode(' ', $tag);
672
+				if ( is_array($tags) ) {
673
+					$tag = $tags[0];
674
+				}
675
+			} else {
676
+				$tag = $shortcodes[2][ $short_key ];
677
+			}
678
+
679
+			switch ( $tag ) {
680
+				case 'id':
681
+				case 'key':
682
+				case 'ip':
683
+					$replace_with = $shortcode_values[ $tag ];
684
+				break;
685
+
686
+				case 'user_agent':
687
+				case 'user-agent':
688
+					$entry->description = maybe_unserialize($entry->description);
689 689
 					$replace_with = FrmEntryFormat::get_browser( $entry->description['browser'] );
690
-                break;
691
-
692
-                case 'created_at':
693
-                case 'created-at':
694
-                case 'updated_at':
695
-                case 'updated-at':
696
-                    if ( isset($atts['format']) ) {
697
-                        $time_format = ' ';
698
-                    } else {
699
-                        $atts['format'] = get_option('date_format');
700
-                        $time_format = '';
701
-                    }
702
-
703
-                    $this_tag = str_replace('-', '_', $tag);
704
-                    $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
705
-                    unset($this_tag);
706
-                break;
707
-
708
-                case 'created_by':
709
-                case 'created-by':
710
-                case 'updated_by':
711
-                case 'updated-by':
712
-                    $this_tag = str_replace('-', '_', $tag);
690
+				break;
691
+
692
+				case 'created_at':
693
+				case 'created-at':
694
+				case 'updated_at':
695
+				case 'updated-at':
696
+					if ( isset($atts['format']) ) {
697
+						$time_format = ' ';
698
+					} else {
699
+						$atts['format'] = get_option('date_format');
700
+						$time_format = '';
701
+					}
702
+
703
+					$this_tag = str_replace('-', '_', $tag);
704
+					$replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
705
+					unset($this_tag);
706
+				break;
707
+
708
+				case 'created_by':
709
+				case 'created-by':
710
+				case 'updated_by':
711
+				case 'updated-by':
712
+					$this_tag = str_replace('-', '_', $tag);
713 713
 					$replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts );
714
-                    unset($this_tag);
715
-                break;
716
-
717
-                case 'admin_email':
718
-                case 'siteurl':
719
-                case 'frmurl':
720
-                case 'sitename':
721
-                case 'get':
722
-                    $replace_with = self::dynamic_default_values( $tag, $atts );
723
-                break;
724
-
725
-                default:
726
-                    $field = FrmField::getOne( $tag );
727
-                    if ( ! $field ) {
728
-                        break;
729
-                    }
730
-
731
-                    $sep = isset($atts['sep']) ? $atts['sep'] : ', ';
732
-
733
-                    $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
734
-
735
-                    $atts['entry_id'] = $entry->id;
736
-                    $atts['entry_key'] = $entry->item_key;
737
-
738
-                    if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
739
-                        $replace_with = $field->name;
740
-                    } else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
741
-                        $replace_with = $field->description;
714
+					unset($this_tag);
715
+				break;
716
+
717
+				case 'admin_email':
718
+				case 'siteurl':
719
+				case 'frmurl':
720
+				case 'sitename':
721
+				case 'get':
722
+					$replace_with = self::dynamic_default_values( $tag, $atts );
723
+				break;
724
+
725
+				default:
726
+					$field = FrmField::getOne( $tag );
727
+					if ( ! $field ) {
728
+						break;
729
+					}
730
+
731
+					$sep = isset($atts['sep']) ? $atts['sep'] : ', ';
732
+
733
+					$replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
734
+
735
+					$atts['entry_id'] = $entry->id;
736
+					$atts['entry_key'] = $entry->item_key;
737
+
738
+					if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
739
+						$replace_with = $field->name;
740
+					} else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
741
+						$replace_with = $field->description;
742 742
 					} else {
743 743
 						$string_value = $replace_with;
744 744
 						if ( is_array( $replace_with ) ) {
@@ -752,82 +752,82 @@  discard block
 block discarded – undo
752 752
 						}
753 753
 					}
754 754
 
755
-                    unset($field);
756
-                break;
757
-            }
755
+					unset($field);
756
+				break;
757
+			}
758 758
 
759
-            if ( isset($replace_with) ) {
760
-                $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
761
-            }
759
+			if ( isset($replace_with) ) {
760
+				$content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
761
+			}
762 762
 
763
-            unset($atts, $conditional, $replace_with);
763
+			unset($atts, $conditional, $replace_with);
764 764
 		}
765 765
 
766 766
 		return $content;
767
-    }
768
-
769
-    /**
770
-     * Get the value to replace a few standard shortcodes
771
-     *
772
-     * @since 2.0
773
-     * @return string
774
-     */
775
-    public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) {
776
-        $new_value = '';
777
-        switch ( $tag ) {
778
-            case 'admin_email':
779
-                $new_value = get_option('admin_email');
780
-                break;
781
-            case 'siteurl':
782
-                $new_value = FrmAppHelper::site_url();
783
-                break;
784
-            case 'frmurl':
785
-                $new_value = FrmAppHelper::plugin_url();
786
-                break;
787
-            case 'sitename':
788
-                $new_value = FrmAppHelper::site_name();
789
-                break;
790
-            case 'get':
791
-                $new_value = self::process_get_shortcode( $atts, $return_array );
792
-                break;
793
-        }
794
-
795
-        return $new_value;
796
-    }
797
-
798
-    /**
799
-     * Process the [get] shortcode
800
-     *
801
-     * @since 2.0
802
-     * @return string|array
803
-     */
804
-    public static function process_get_shortcode( $atts, $return_array = false ) {
805
-        if ( ! isset($atts['param']) ) {
806
-            return '';
807
-        }
808
-
809
-        if ( strpos($atts['param'], '&#91;') ) {
810
-            $atts['param'] = str_replace('&#91;', '[', $atts['param']);
811
-            $atts['param'] = str_replace('&#93;', ']', $atts['param']);
812
-        }
813
-
814
-        $new_value = FrmAppHelper::get_param($atts['param'], '');
815
-        $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
816
-
817
-        if ( $new_value == '' ) {
818
-            if ( ! isset($atts['prev_val']) ) {
819
-                $atts['prev_val'] = '';
820
-            }
821
-
822
-            $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
823
-        }
824
-
825
-        if ( is_array($new_value) && ! $return_array ) {
826
-            $new_value = implode(', ', $new_value);
827
-        }
828
-
829
-        return $new_value;
830
-    }
767
+	}
768
+
769
+	/**
770
+	 * Get the value to replace a few standard shortcodes
771
+	 *
772
+	 * @since 2.0
773
+	 * @return string
774
+	 */
775
+	public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) {
776
+		$new_value = '';
777
+		switch ( $tag ) {
778
+			case 'admin_email':
779
+				$new_value = get_option('admin_email');
780
+				break;
781
+			case 'siteurl':
782
+				$new_value = FrmAppHelper::site_url();
783
+				break;
784
+			case 'frmurl':
785
+				$new_value = FrmAppHelper::plugin_url();
786
+				break;
787
+			case 'sitename':
788
+				$new_value = FrmAppHelper::site_name();
789
+				break;
790
+			case 'get':
791
+				$new_value = self::process_get_shortcode( $atts, $return_array );
792
+				break;
793
+		}
794
+
795
+		return $new_value;
796
+	}
797
+
798
+	/**
799
+	 * Process the [get] shortcode
800
+	 *
801
+	 * @since 2.0
802
+	 * @return string|array
803
+	 */
804
+	public static function process_get_shortcode( $atts, $return_array = false ) {
805
+		if ( ! isset($atts['param']) ) {
806
+			return '';
807
+		}
808
+
809
+		if ( strpos($atts['param'], '&#91;') ) {
810
+			$atts['param'] = str_replace('&#91;', '[', $atts['param']);
811
+			$atts['param'] = str_replace('&#93;', ']', $atts['param']);
812
+		}
813
+
814
+		$new_value = FrmAppHelper::get_param($atts['param'], '');
815
+		$new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
816
+
817
+		if ( $new_value == '' ) {
818
+			if ( ! isset($atts['prev_val']) ) {
819
+				$atts['prev_val'] = '';
820
+			}
821
+
822
+			$new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
823
+		}
824
+
825
+		if ( is_array($new_value) && ! $return_array ) {
826
+			$new_value = implode(', ', $new_value);
827
+		}
828
+
829
+		return $new_value;
830
+	}
831 831
 
832 832
 	public static function get_display_value( $replace_with, $field, $atts = array() ) {
833 833
 		$sep = isset( $atts['sep'] ) ? $atts['sep'] : ', ';
@@ -835,14 +835,14 @@  discard block
 block discarded – undo
835 835
 		$replace_with = apply_filters( 'frm_get_' . $field->type . '_display_value', $replace_with, $field, $atts );
836 836
 		$replace_with = apply_filters( 'frm_get_display_value', $replace_with, $field, $atts );
837 837
 
838
-        if ( $field->type == 'textarea' || $field->type == 'rte' ) {
839
-            $autop = isset($atts['wpautop']) ? $atts['wpautop'] : true;
840
-            if ( apply_filters('frm_use_wpautop', $autop) ) {
841
-                if ( is_array($replace_with) ) {
842
-                    $replace_with = implode("\n", $replace_with);
843
-                }
844
-                $replace_with = wpautop($replace_with);
845
-            }
838
+		if ( $field->type == 'textarea' || $field->type == 'rte' ) {
839
+			$autop = isset($atts['wpautop']) ? $atts['wpautop'] : true;
840
+			if ( apply_filters('frm_use_wpautop', $autop) ) {
841
+				if ( is_array($replace_with) ) {
842
+					$replace_with = implode("\n", $replace_with);
843
+				}
844
+				$replace_with = wpautop($replace_with);
845
+			}
846 846
 			unset( $autop );
847 847
 		} else if ( is_array( $replace_with ) ) {
848 848
 			if ( $atts['show'] && isset( $replace_with[ $atts['show'] ] ) ) {
@@ -856,37 +856,37 @@  discard block
 block discarded – undo
856 856
 	}
857 857
 
858 858
 	public static function get_field_types( $type ) {
859
-        $single_input = array(
860
-            'text', 'textarea', 'rte', 'number', 'email', 'url',
861
-            'image', 'file', 'date', 'phone', 'hidden', 'time',
862
-            'user_id', 'tag', 'password',
863
-        );
859
+		$single_input = array(
860
+			'text', 'textarea', 'rte', 'number', 'email', 'url',
861
+			'image', 'file', 'date', 'phone', 'hidden', 'time',
862
+			'user_id', 'tag', 'password',
863
+		);
864 864
 		$multiple_input = array( 'radio', 'checkbox', 'select', 'scale', 'lookup' );
865 865
 		$other_type = array( 'html', 'break' );
866 866
 
867 867
 		$field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() );
868 868
 
869
-        $field_types = array();
870
-        if ( in_array($type, $single_input) ) {
871
-            self::field_types_for_input( $single_input, $field_selection, $field_types );
872
-        } else if ( in_array($type, $multiple_input) ) {
873
-            self::field_types_for_input( $multiple_input, $field_selection, $field_types );
874
-        } else if ( in_array($type, $other_type) ) {
875
-            self::field_types_for_input( $other_type, $field_selection, $field_types );
869
+		$field_types = array();
870
+		if ( in_array($type, $single_input) ) {
871
+			self::field_types_for_input( $single_input, $field_selection, $field_types );
872
+		} else if ( in_array($type, $multiple_input) ) {
873
+			self::field_types_for_input( $multiple_input, $field_selection, $field_types );
874
+		} else if ( in_array($type, $other_type) ) {
875
+			self::field_types_for_input( $other_type, $field_selection, $field_types );
876 876
 		} else if ( isset( $field_selection[ $type ] ) ) {
877
-            $field_types[ $type ] = $field_selection[ $type ];
878
-        }
877
+			$field_types[ $type ] = $field_selection[ $type ];
878
+		}
879 879
 
880 880
 		$field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) );
881
-        return $field_types;
882
-    }
881
+		return $field_types;
882
+	}
883 883
 
884
-    private static function field_types_for_input( $inputs, $fields, &$field_types ) {
885
-        foreach ( $inputs as $input ) {
886
-            $field_types[ $input ] = $fields[ $input ];
887
-            unset($input);
888
-        }
889
-    }
884
+	private static function field_types_for_input( $inputs, $fields, &$field_types ) {
885
+		foreach ( $inputs as $input ) {
886
+			$field_types[ $input ] = $fields[ $input ];
887
+			unset($input);
888
+		}
889
+	}
890 890
 
891 891
 	/**
892 892
 	 * Check if current field option is an "other" option
@@ -900,14 +900,14 @@  discard block
 block discarded – undo
900 900
 		return $opt_key && strpos( $opt_key, 'other_' ) === 0;
901 901
 	}
902 902
 
903
-    /**
904
-    * Get value that belongs in "Other" text box
905
-    *
906
-    * @since 2.0.6
907
-    *
908
-    * @param array $args
909
-    */
910
-    public static function get_other_val( $args ) {
903
+	/**
904
+	 * Get value that belongs in "Other" text box
905
+	 *
906
+	 * @since 2.0.6
907
+	 *
908
+	 * @param array $args
909
+	 */
910
+	public static function get_other_val( $args ) {
911 911
 		$defaults = array(
912 912
 			'opt_key' => 0, 'field' => array(),
913 913
 			'parent' => false, 'pointer' => false,
@@ -983,20 +983,20 @@  discard block
 block discarded – undo
983 983
 		}
984 984
 
985 985
 		return $other_val;
986
-    }
987
-
988
-    /**
989
-    * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
990
-    * Intended for front-end use
991
-    *
992
-    * @since 2.0.6
993
-    *
994
-    * @param array $args should include field, opt_key and field name
995
-    * @param boolean $other_opt
996
-    * @param string $checked
997
-    * @return string $other_val
998
-    */
999
-    public static function prepare_other_input( $args, &$other_opt, &$checked ) {
986
+	}
987
+
988
+	/**
989
+	 * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
990
+	 * Intended for front-end use
991
+	 *
992
+	 * @since 2.0.6
993
+	 *
994
+	 * @param array $args should include field, opt_key and field name
995
+	 * @param boolean $other_opt
996
+	 * @param string $checked
997
+	 * @return string $other_val
998
+	 */
999
+	public static function prepare_other_input( $args, &$other_opt, &$checked ) {
1000 1000
 		//Check if this is an "Other" option
1001 1001
 		if ( ! self::is_other_opt( $args['opt_key'] ) ) {
1002 1002
 			return;
@@ -1012,8 +1012,8 @@  discard block
 block discarded – undo
1012 1012
 			$checked = 'checked="checked" ';
1013 1013
 		}
1014 1014
 
1015
-        return $other_args;
1016
-    }
1015
+		return $other_args;
1016
+	}
1017 1017
 
1018 1018
 	/**
1019 1019
 	 * @param array $args
@@ -1063,8 +1063,8 @@  discard block
 block discarded – undo
1063 1063
 	 * @since 2.0.6
1064 1064
 	 */
1065 1065
 	public static function include_other_input( $args ) {
1066
-        if ( ! $args['other_opt'] ) {
1067
-        	return;
1066
+		if ( ! $args['other_opt'] ) {
1067
+			return;
1068 1068
 		}
1069 1069
 
1070 1070
 		$classes = array( 'frm_other_input' );
@@ -1085,15 +1085,15 @@  discard block
 block discarded – undo
1085 1085
 	}
1086 1086
 
1087 1087
 	/**
1088
-	* Get the HTML id for an "Other" text field
1089
-	* Note: This does not affect fields in repeating sections
1090
-	*
1091
-	* @since 2.0.08
1092
-	* @param string $type - field type
1093
-	* @param string $html_id
1094
-	* @param string|boolean $opt_key
1095
-	* @return string $other_id
1096
-	*/
1088
+	 * Get the HTML id for an "Other" text field
1089
+	 * Note: This does not affect fields in repeating sections
1090
+	 *
1091
+	 * @since 2.0.08
1092
+	 * @param string $type - field type
1093
+	 * @param string $html_id
1094
+	 * @param string|boolean $opt_key
1095
+	 * @return string $other_id
1096
+	 */
1097 1097
 	public static function get_other_field_html_id( $type, $html_id, $opt_key = false ) {
1098 1098
 		$other_id = $html_id;
1099 1099
 
@@ -1151,10 +1151,10 @@  discard block
 block discarded – undo
1151 1151
 	}
1152 1152
 
1153 1153
 	public static function switch_field_ids( $val ) {
1154
-        global $frm_duplicate_ids;
1155
-        $replace = array();
1156
-        $replace_with = array();
1157
-        foreach ( (array) $frm_duplicate_ids as $old => $new ) {
1154
+		global $frm_duplicate_ids;
1155
+		$replace = array();
1156
+		$replace_with = array();
1157
+		foreach ( (array) $frm_duplicate_ids as $old => $new ) {
1158 1158
 			$replace[] = '[if ' . $old . ']';
1159 1159
 			$replace_with[] = '[if ' . $new . ']';
1160 1160
 			$replace[] = '[if ' . $old . ' ';
@@ -1169,153 +1169,153 @@  discard block
 block discarded – undo
1169 1169
 			$replace_with[] = '[' . $new . ']';
1170 1170
 			$replace[] = '[' . $old . ' ';
1171 1171
 			$replace_with[] = '[' . $new . ' ';
1172
-            unset($old, $new);
1173
-        }
1172
+			unset($old, $new);
1173
+		}
1174 1174
 		if ( is_array( $val ) ) {
1175 1175
 			foreach ( $val as $k => $v ) {
1176
-                $val[ $k ] = str_replace( $replace, $replace_with, $v );
1177
-                unset($k, $v);
1178
-            }
1179
-        } else {
1180
-            $val = str_replace($replace, $replace_with, $val);
1181
-        }
1182
-
1183
-        return $val;
1184
-    }
1185
-
1186
-    public static function get_us_states() {
1187
-        return apply_filters( 'frm_us_states', array(
1188
-            'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona',
1189
-            'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware',
1190
-            'DC' => 'District of Columbia',
1191
-            'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho',
1192
-            'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas',
1193
-            'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland',
1194
-            'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi',
1195
-            'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada',
1196
-            'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York',
1197
-            'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma',
1198
-            'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina',
1199
-            'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah',
1200
-            'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia',
1201
-            'WI' => 'Wisconsin', 'WY' => 'Wyoming',
1202
-        ) );
1203
-    }
1204
-
1205
-    public static function get_countries() {
1206
-        return apply_filters( 'frm_countries', array(
1207
-            __( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ),
1208
-            __( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ),
1209
-            __( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ),
1210
-            __( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ),
1211
-            __( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ),
1212
-            __( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ),
1213
-            __( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ),
1214
-            __( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ),
1215
-            __( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ),
1216
-            __( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ),
1217
-            __( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ),
1218
-            __( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ),
1219
-            __( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ),
1220
-            __( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ),
1221
-            __( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ),
1222
-            __( 'Costa Rica', 'formidable' ), __( 'C&ocirc;te d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ),
1223
-            __( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ),
1224
-            __( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ),
1225
-            __( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ),
1226
-            __( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ),
1227
-            __( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ),
1228
-            __( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ),
1229
-            __( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ),
1230
-            __( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ),
1231
-            __( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ),
1232
-            __( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ),
1233
-            __( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ),
1234
-            __( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ),
1235
-            __( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ),
1236
-            __( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ),
1237
-            __( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ),
1238
-            __( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ),
1239
-            __( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ),
1240
-            __( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ),
1241
-            __( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ),
1242
-            __( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ),
1243
-            __( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ),
1244
-            __( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ),
1245
-            __( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ),
1246
-            __( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ),
1247
-            __( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ),
1248
-            __( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ),
1249
-            __( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ),
1250
-            __( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ),
1251
-            __( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ),
1252
-            __( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ),
1253
-            __( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ),
1254
-            __( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ),
1255
-            __( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ),
1256
-            __( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ),
1257
-            __( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ),
1258
-            __( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ),
1259
-            __( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ),
1260
-            __( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ),
1261
-            __( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ),
1262
-            __( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ),
1263
-            __( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ),
1264
-            __( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ),
1265
-            __( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ),
1266
-            __( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ),
1267
-            __( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ),
1268
-            __( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ),
1269
-            __( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ),
1270
-            __( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ),
1271
-            __( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ),
1272
-            __( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ),
1273
-            __( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ),
1274
-            __( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ),
1275
-            __( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ),
1276
-            __( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ),
1277
-            __( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ),
1278
-            __( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ),
1279
-            __( 'Zimbabwe', 'formidable' ),
1280
-        ) );
1281
-    }
1176
+				$val[ $k ] = str_replace( $replace, $replace_with, $v );
1177
+				unset($k, $v);
1178
+			}
1179
+		} else {
1180
+			$val = str_replace($replace, $replace_with, $val);
1181
+		}
1182
+
1183
+		return $val;
1184
+	}
1185
+
1186
+	public static function get_us_states() {
1187
+		return apply_filters( 'frm_us_states', array(
1188
+			'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona',
1189
+			'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware',
1190
+			'DC' => 'District of Columbia',
1191
+			'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho',
1192
+			'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas',
1193
+			'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland',
1194
+			'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi',
1195
+			'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada',
1196
+			'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York',
1197
+			'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma',
1198
+			'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina',
1199
+			'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah',
1200
+			'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia',
1201
+			'WI' => 'Wisconsin', 'WY' => 'Wyoming',
1202
+		) );
1203
+	}
1204
+
1205
+	public static function get_countries() {
1206
+		return apply_filters( 'frm_countries', array(
1207
+			__( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ),
1208
+			__( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ),
1209
+			__( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ),
1210
+			__( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ),
1211
+			__( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ),
1212
+			__( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ),
1213
+			__( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ),
1214
+			__( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ),
1215
+			__( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ),
1216
+			__( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ),
1217
+			__( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ),
1218
+			__( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ),
1219
+			__( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ),
1220
+			__( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ),
1221
+			__( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ),
1222
+			__( 'Costa Rica', 'formidable' ), __( 'C&ocirc;te d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ),
1223
+			__( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ),
1224
+			__( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ),
1225
+			__( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ),
1226
+			__( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ),
1227
+			__( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ),
1228
+			__( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ),
1229
+			__( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ),
1230
+			__( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ),
1231
+			__( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ),
1232
+			__( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ),
1233
+			__( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ),
1234
+			__( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ),
1235
+			__( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ),
1236
+			__( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ),
1237
+			__( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ),
1238
+			__( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ),
1239
+			__( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ),
1240
+			__( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ),
1241
+			__( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ),
1242
+			__( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ),
1243
+			__( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ),
1244
+			__( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ),
1245
+			__( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ),
1246
+			__( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ),
1247
+			__( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ),
1248
+			__( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ),
1249
+			__( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ),
1250
+			__( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ),
1251
+			__( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ),
1252
+			__( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ),
1253
+			__( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ),
1254
+			__( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ),
1255
+			__( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ),
1256
+			__( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ),
1257
+			__( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ),
1258
+			__( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ),
1259
+			__( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ),
1260
+			__( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ),
1261
+			__( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ),
1262
+			__( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ),
1263
+			__( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ),
1264
+			__( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ),
1265
+			__( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ),
1266
+			__( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ),
1267
+			__( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ),
1268
+			__( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ),
1269
+			__( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ),
1270
+			__( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ),
1271
+			__( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ),
1272
+			__( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ),
1273
+			__( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ),
1274
+			__( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ),
1275
+			__( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ),
1276
+			__( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ),
1277
+			__( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ),
1278
+			__( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ),
1279
+			__( 'Zimbabwe', 'formidable' ),
1280
+		) );
1281
+	}
1282 1282
 
1283 1283
 	public static function get_bulk_prefilled_opts( array &$prepop ) {
1284 1284
 		$prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries();
1285 1285
 
1286
-        $states = FrmFieldsHelper::get_us_states();
1287
-        $state_abv = array_keys($states);
1288
-        sort($state_abv);
1286
+		$states = FrmFieldsHelper::get_us_states();
1287
+		$state_abv = array_keys($states);
1288
+		sort($state_abv);
1289 1289
 		$prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
1290 1290
 
1291
-        $states = array_values($states);
1292
-        sort($states);
1291
+		$states = array_values($states);
1292
+		sort($states);
1293 1293
 		$prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
1294
-        unset($state_abv, $states);
1294
+		unset($state_abv, $states);
1295 1295
 
1296 1296
 		$prepop[ __( 'Age', 'formidable' ) ] = array(
1297
-            __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ),
1298
-            __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ),
1299
-            __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ),
1300
-        );
1297
+			__( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ),
1298
+			__( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ),
1299
+			__( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ),
1300
+		);
1301 1301
 
1302 1302
 		$prepop[ __( 'Satisfaction', 'formidable' ) ] = array(
1303
-            __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ),
1304
-            __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ),
1305
-        );
1303
+			__( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ),
1304
+			__( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ),
1305
+		);
1306 1306
 
1307 1307
 		$prepop[ __( 'Importance', 'formidable' ) ] = array(
1308
-            __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ),
1309
-            __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ),
1310
-        );
1308
+			__( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ),
1309
+			__( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ),
1310
+		);
1311 1311
 
1312 1312
 		$prepop[ __( 'Agreement', 'formidable' ) ] = array(
1313
-            __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ),
1314
-            __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ),
1315
-        );
1313
+			__( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ),
1314
+			__( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ),
1315
+		);
1316 1316
 
1317 1317
 		$prepop = apply_filters( 'frm_bulk_field_choices', $prepop );
1318
-    }
1318
+	}
1319 1319
 
1320 1320
 	/**
1321 1321
 	 * Display a field value selector
@@ -1325,10 +1325,10 @@  discard block
 block discarded – undo
1325 1325
 	 * @param int $selector_field_id
1326 1326
 	 * @param array $selector_args
1327 1327
 	 */
1328
-    public static function display_field_value_selector( $selector_field_id, $selector_args ) {
1329
-	    $field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args );
1330
-	    $field_value_selector->display();
1331
-    }
1328
+	public static function display_field_value_selector( $selector_field_id, $selector_args ) {
1329
+		$field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args );
1330
+		$field_value_selector->display();
1331
+	}
1332 1332
 
1333 1333
 	/**
1334 1334
 	 * Convert a field object to a flat array
@@ -1381,10 +1381,10 @@  discard block
 block discarded – undo
1381 1381
 		return FrmField::is_required( $field );
1382 1382
 	}
1383 1383
 
1384
-    public static function maybe_get_field( &$field ) {
1384
+	public static function maybe_get_field( &$field ) {
1385 1385
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmField::maybe_get_field' );
1386 1386
 		FrmField::maybe_get_field( $field );
1387
-    }
1387
+	}
1388 1388
 
1389 1389
 	public static function dropdown_categories( $args ) {
1390 1390
 		_deprecated_function( __FUNCTION__, '2.02.07', 'FrmProPost::get_category_dropdown' );
Please login to merge, or discard this patch.
classes/views/frm-forms/add_field.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-$display = apply_filters('frm_display_field_options', array(
3
+$display = apply_filters( 'frm_display_field_options', array(
4 4
     'type' => $field['type'], 'field_data' => $field,
5 5
     'required' => true, 'unique' => false, 'read_only' => false,
6 6
     'description' => true, 'options' => true, 'label_position' => true,
7 7
     'invalid' => false, 'size' => false, 'clear_on_focus' => false,
8 8
     'default_blank' => true, 'css' => true, 'conf_field' => false,
9 9
 	'max' => true, 'captcha_size' => false,
10
-));
10
+) );
11 11
 
12 12
 $li_classes = 'form-field edit_form_item frm_field_box frm_top_container frm_not_divider edit_field_type_' . $display['type'];
13
-$li_classes = apply_filters('frm_build_field_class', $li_classes, $field );
13
+$li_classes = apply_filters( 'frm_build_field_class', $li_classes, $field );
14 14
 
15 15
 if ( isset( $values ) && isset( $values['ajax_load'] ) && $values['ajax_load'] && isset( $count ) && $count > 10 && ! in_array( $field['type'], array( 'divider', 'end_divider' ) ) ) {
16 16
 ?>
17 17
 <li id="frm_field_id_<?php echo esc_attr( $field['id'] ); ?>" class="<?php echo esc_attr( $li_classes ) ?> frm_field_loading" data-fid="<?php echo esc_attr( $field['id'] ) ?>" data-formid="<?php echo esc_attr( 'divider' == $field['type'] ? $field['form_select'] : $field['form_id'] ); ?>" data-ftype="<?php echo esc_attr( $display['type'] ) ?>">
18 18
 <img src="<?php echo FrmAppHelper::plugin_url() ?>/images/ajax_loader.gif" alt="<?php esc_attr_e( 'Loading', 'formidable' ) ?>" />
19
-<span class="frm_hidden_fdata frm_hidden"><?php echo htmlspecialchars(json_encode($field)) ?></span>
19
+<span class="frm_hidden_fdata frm_hidden"><?php echo htmlspecialchars( json_encode( $field ) ) ?></span>
20 20
 </li>
21 21
 <?php
22 22
    return;
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 $frm_settings = FrmAppHelper::get_settings();
26 26
 
27 27
 if ( ! isset( $frm_all_field_selection ) ) {
28
-    if ( isset($frm_field_selection) && isset($pro_field_selection) ) {
29
-        $frm_all_field_selection = array_merge($frm_field_selection, $pro_field_selection);
28
+    if ( isset( $frm_field_selection ) && isset( $pro_field_selection ) ) {
29
+        $frm_all_field_selection = array_merge( $frm_field_selection, $pro_field_selection );
30 30
     } else {
31 31
 		$pro_field_selection = FrmField::pro_field_selection();
32 32
 		$frm_all_field_selection = array_merge( FrmField::field_selection(), $pro_field_selection );
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
     <a href="javascript:void(0);" class="frm_bstooltip alignright frm-show-hover frm-move frm-hover-icon frm_icon_font frm_move_icon" title="<?php esc_attr_e( 'Move Field', 'formidable' ) ?>"> </a>
52 52
     <a href="#" class="frm_bstooltip alignright frm-show-hover frm-hover-icon frm_icon_font frm_delete_icon frm_delete_field" title="<?php esc_attr_e( 'Delete Field', 'formidable' ) ?>"> </a>
53 53
     <a href="#" class="frm_bstooltip alignright frm-show-hover frm-hover-icon frm_icon_font frm_duplicate_icon" title="<?php ( $field['type'] == 'divider' ) ? esc_attr_e( 'Duplicate Section', 'formidable' ) : esc_attr_e( 'Duplicate Field', 'formidable' ) ?>"> </a>
54
-    <input type="hidden" name="frm_fields_submitted[]" value="<?php echo esc_attr($field['id']) ?>" />
55
-    <?php do_action('frm_extra_field_actions', $field['id']); ?>
54
+    <input type="hidden" name="frm_fields_submitted[]" value="<?php echo esc_attr( $field['id'] ) ?>" />
55
+    <?php do_action( 'frm_extra_field_actions', $field['id'] ); ?>
56 56
     <?php if ( $display['required'] ) { ?>
57 57
     <span id="require_field_<?php echo esc_attr( $field['id'] ); ?>">
58 58
 		<a href="javascript:void(0);" class="frm_req_field frm_action_icon frm_required_icon frm_icon_font alignleft frm_required<?php echo (int) $field['required'] ?>" id="req_field_<?php echo esc_attr( $field['id'] ); ?>" title="Click to Mark as <?php echo FrmField::is_required( $field ) ? 'not ' : ''; ?>Required"></a>
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     <?php }
61 61
 
62 62
     ?>
63
-    <label class="<?php echo ( $field['type'] == 'end_divider' ) ? '' : 'frm_ipe_field_label'; ?> frm_primary_label <?php echo ( $field['type'] == 'break' ) ? 'button': ''; ?>" id="field_label_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['name'] == '' ) ? __( '(no label)', 'formidable' ) : force_balance_tags( $field['name'] ); ?></label>
63
+    <label class="<?php echo ( $field['type'] == 'end_divider' ) ? '' : 'frm_ipe_field_label'; ?> frm_primary_label <?php echo ( $field['type'] == 'break' ) ? 'button' : ''; ?>" id="field_label_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['name'] == '' ) ? __( '(no label)', 'formidable' ) : force_balance_tags( $field['name'] ); ?></label>
64 64
 
65 65
 
66 66
 <div id="field_<?php echo esc_attr( $field['id'] ) ?>_inner_container" class="frm_inner_field_container">
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 </div>
79 79
 <?php
80 80
 if ( $display['description'] ) { ?>
81
-    <div class="frm_ipe_field_desc description <?php echo ($field['description'] == '') ? 'frm-show-click' : '' ?>" id="field_description_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ($field['description'] == '') ? __( '(Click to add description)', 'formidable' ) : force_balance_tags( $field['description'] ); ?></div>
81
+    <div class="frm_ipe_field_desc description <?php echo ( $field['description'] == '' ) ? 'frm-show-click' : '' ?>" id="field_description_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['description'] == '' ) ? __( '(Click to add description)', 'formidable' ) : force_balance_tags( $field['description'] ); ?></div>
82 82
     <input type="hidden" name="field_options[description_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['description'] ); ?>" />
83 83
 
84 84
 <?php } ?>
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 		<div class="frm_form_fields">
91 91
 			<input type="text" id="conf_field_<?php echo esc_attr( $field['field_key'] ) ?>" name="field_options[conf_input_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_input'] ); ?>" class="dyn_default_value" />
92 92
 		</div>
93
-    	<div id="conf_field_description_<?php echo esc_attr( $field['id'] ) ?>" class="frm_ipe_field_conf_desc description <?php echo ($field['conf_desc'] == '') ? 'frm-show-click' : '' ?>"><?php
94
-			echo ($field['conf_desc'] == '') ? __( '(Click to add description)', 'formidable' ) : force_balance_tags($field['conf_desc']); ?></div>
93
+    	<div id="conf_field_description_<?php echo esc_attr( $field['id'] ) ?>" class="frm_ipe_field_conf_desc description <?php echo ( $field['conf_desc'] == '' ) ? 'frm-show-click' : '' ?>"><?php
94
+			echo ( $field['conf_desc'] == '' ) ? __( '(Click to add description)', 'formidable' ) : force_balance_tags( $field['conf_desc'] ); ?></div>
95 95
     	<input type="hidden" name="field_options[conf_desc_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_desc'] ); ?>" />
96 96
 </div>
97 97
 	<?php if ( $display['clear_on_focus'] ) { ?>
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 if ( in_array( $field['type'], array( 'select', 'radio', 'checkbox' ) ) ) { ?>
107 107
     <div class="frm-show-click frm_small_top_margin"><?php
108 108
 
109
-    if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
109
+    if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) {
110 110
 		echo '<p class="howto">' . FrmFieldsHelper::get_term_link( $field['taxonomy'] ) . '</p>';
111 111
 	} else if ( ! isset( $field['post_field'] ) || ! in_array( $field['post_field'], array( 'post_category' ) ) ) {
112 112
 ?>
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
             <?php
121 121
             }
122 122
 
123
-            if ( ! isset($field['post_field']) || $field['post_field'] != 'post_category' ) { ?>
123
+            if ( ! isset( $field['post_field'] ) || $field['post_field'] != 'post_category' ) { ?>
124 124
 			<a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=frm_import_choices&field_id=' . $field['id'] . '&TB_iframe=1' ) ) ?>" title="<?php echo esc_attr( FrmAppHelper::truncate( strip_tags( str_replace( '"', '&quot;', $field['name'] ) ), 20 ) . ' ' . __( 'Field Choices', 'formidable' ) ); ?>" class="thickbox frm_orange">
125 125
 				<?php _e( 'Bulk Edit Options', 'formidable' ) ?>
126 126
 			</a>
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 <?php
134 134
 }
135 135
 
136
-do_action('frm_before_field_options', $field);
136
+do_action( 'frm_before_field_options', $field );
137 137
 
138 138
 if ( $display['options'] ) { ?>
139 139
     <div class="widget">
@@ -143,13 +143,13 @@  discard block
 block discarded – undo
143 143
         </div>
144 144
     	<div class="widget-inside">
145 145
             <table class="form-table frm_clear_none">
146
-                <?php $field_types = FrmFieldsHelper::get_field_types($field['type']); ?>
146
+                <?php $field_types = FrmFieldsHelper::get_field_types( $field['type'] ); ?>
147 147
 				<tr><td class="frm_150_width"><label><?php _e( 'Field Type', 'formidable' ) ?></label></td>
148 148
                     <td>
149
-                <select <?php if ( count($field_types) == 1 ) { ?>disabled="disabled"<?php } else { ?>name="field_options[type_<?php echo esc_attr( $field['id'] ) ?>]"<?php } ?>>
149
+                <select <?php if ( count( $field_types ) == 1 ) { ?>disabled="disabled"<?php } else { ?>name="field_options[type_<?php echo esc_attr( $field['id'] ) ?>]"<?php } ?>>
150 150
                     <?php
151 151
 					foreach ( $field_types as $fkey => $ftype ) { ?>
152
-                        <option value="<?php echo esc_attr( $fkey ) ?>" <?php echo ( $fkey == $field['type'] ) ? ' selected="selected"' : ''; ?> <?php echo array_key_exists($fkey, $disabled_fields ) ? 'disabled="disabled"' : '';  ?>><?php echo is_array($ftype) ? $ftype['name'] : $ftype ?> </option>
152
+                        <option value="<?php echo esc_attr( $fkey ) ?>" <?php echo ( $fkey == $field['type'] ) ? ' selected="selected"' : ''; ?> <?php echo array_key_exists( $fkey, $disabled_fields ) ? 'disabled="disabled"' : ''; ?>><?php echo is_array( $ftype ) ? $ftype['name'] : $ftype ?> </option>
153 153
                     <?php
154 154
 						unset( $fkey, $ftype );
155 155
 					} ?>
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 				</label>
185 185
                 <?php }
186 186
 
187
-                do_action('frm_field_options_form_top', $field, $display, $values);
187
+                do_action( 'frm_field_options_form_top', $field, $display, $values );
188 188
 
189 189
                 ?>
190 190
                 <?php
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
 				if ( $display['label_position'] ) { ?>
222 222
                     <tr><td class="frm_150_width"><label><?php _e( 'Label Position', 'formidable' ) ?></label></td>
223 223
                         <td><select name="field_options[label_<?php echo esc_attr( $field['id'] ) ?>]">
224
-                            <option value=""<?php selected($field['label'], ''); ?>><?php _e( 'Default', 'formidable' ) ?></option>
225
-                            <option value="top"<?php selected($field['label'], 'top'); ?>><?php _e( 'Top', 'formidable' ) ?></option>
226
-                            <option value="left"<?php selected($field['label'], 'left'); ?>><?php _e( 'Left', 'formidable' ) ?></option>
227
-                            <option value="right"<?php selected($field['label'], 'right'); ?>><?php _e( 'Right', 'formidable' ) ?></option>
228
-                            <option value="inline"<?php selected($field['label'], 'inline'); ?>><?php _e( 'Inline (left without a set width)', 'formidable' ) ?></option>
229
-                            <option value="none"<?php selected($field['label'], 'none'); ?>><?php _e( 'None', 'formidable' ) ?></option>
230
-                            <option value="hidden"<?php selected($field['label'], 'hidden'); ?>><?php _e( 'Hidden (but leave the space)', 'formidable' ) ?></option>
224
+                            <option value=""<?php selected( $field['label'], '' ); ?>><?php _e( 'Default', 'formidable' ) ?></option>
225
+                            <option value="top"<?php selected( $field['label'], 'top' ); ?>><?php _e( 'Top', 'formidable' ) ?></option>
226
+                            <option value="left"<?php selected( $field['label'], 'left' ); ?>><?php _e( 'Left', 'formidable' ) ?></option>
227
+                            <option value="right"<?php selected( $field['label'], 'right' ); ?>><?php _e( 'Right', 'formidable' ) ?></option>
228
+                            <option value="inline"<?php selected( $field['label'], 'inline' ); ?>><?php _e( 'Inline (left without a set width)', 'formidable' ) ?></option>
229
+                            <option value="none"<?php selected( $field['label'], 'none' ); ?>><?php _e( 'None', 'formidable' ) ?></option>
230
+                            <option value="hidden"<?php selected( $field['label'], 'hidden' ); ?>><?php _e( 'Hidden (but leave the space)', 'formidable' ) ?></option>
231 231
                         </select>
232 232
                         </td>
233 233
                     </tr>
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 				do_action( 'frm_field_options_form', $field, $display, $values );
282 282
 
283 283
                 if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?>
284
-					<tr class="frm_validation_msg <?php echo ($display['invalid'] || $field['required'] || FrmField::is_option_true( $field, 'unique' ) || FrmField::is_option_true( $field, 'conf_field' ) ) ? '' : 'frm_hidden'; ?>">
284
+					<tr class="frm_validation_msg <?php echo ( $display['invalid'] || $field['required'] || FrmField::is_option_true( $field, 'unique' ) || FrmField::is_option_true( $field, 'conf_field' ) ) ? '' : 'frm_hidden'; ?>">
285 285
 					<td colspan="2">
286 286
                     <div class="menu-settings">
287 287
                     <h3 class="frm_no_bg"><?php _e( 'Validation', 'formidable' ) ?></h3>
@@ -345,4 +345,4 @@  discard block
 block discarded – undo
345 345
 <?php
346 346
 }
347 347
 
348
-unset($display);
348
+unset( $display );
Please login to merge, or discard this patch.