Completed
Push — master ( 151d25...a80ee5 )
by Jamie
03:44
created
classes/controllers/FrmFormsController.php 1 patch
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -145,6 +145,9 @@  discard block
 block discarded – undo
145 145
 		wp_die();
146 146
 	}
147 147
 
148
+	/**
149
+	 * @param string $field
150
+	 */
148 151
 	private static function edit_in_place_value( $field ) {
149 152
 		check_ajax_referer( 'frm_ajax', 'nonce' );
150 153
 		FrmAppHelper::permission_check('frm_edit_forms', 'hide');
@@ -677,6 +680,7 @@  discard block
 block discarded – undo
677 680
 	/**
678 681
 	 * Get an array of the helper shortcodes to display in the customization panel
679 682
 	 * @since 2.0.6
683
+	 * @param boolean $settings_tab
680 684
 	 */
681 685
 	private static function get_shortcode_helpers( $settings_tab ) {
682 686
 		$entry_shortcodes = array(
@@ -749,6 +753,9 @@  discard block
 block discarded – undo
749 753
         return $content;
750 754
     }
751 755
 
756
+	/**
757
+	 * @param boolean $entry
758
+	 */
752 759
 	private static function get_entry_by_param( &$entry ) {
753 760
 		if ( ! $entry || ! is_object( $entry ) ) {
754 761
 			if ( ! $entry || ! is_numeric( $entry ) ) {
@@ -1207,6 +1214,7 @@  discard block
 block discarded – undo
1207 1214
 
1208 1215
 	/**
1209 1216
 	 * @since 2.0.8
1217
+	 * @param string $content
1210 1218
 	 */
1211 1219
 	private static function maybe_minimize_form( $atts, &$content ) {
1212 1220
 		// check if minimizing is turned on
Please login to merge, or discard this patch.
classes/helpers/FrmEntriesHelper.php 3 patches
Indentation   +297 added lines, -297 removed lines patch added patch discarded remove patch
@@ -5,68 +5,68 @@  discard block
 block discarded – undo
5 5
 
6 6
 class FrmEntriesHelper {
7 7
 
8
-    public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) {
9
-        $values = array();
8
+	public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) {
9
+		$values = array();
10 10
 		foreach ( array( 'name' => '', 'description' => '', 'item_key' => '' ) as $var => $default ) {
11 11
 			$values[ $var ] = FrmAppHelper::get_post_param( $var, $default, 'wp_kses_post' );
12
-        }
13
-
14
-        $values['fields'] = array();
15
-        if ( empty($fields) ) {
16
-            return apply_filters('frm_setup_new_entry', $values);
17
-        }
18
-
19
-        foreach ( (array) $fields as $field ) {
20
-            $new_value = self::get_field_value_for_new_entry( $field, $reset, $args );
21
-
22
-            $field_array = array(
23
-                'id' => $field->id,
24
-                'value' => $new_value,
25
-                'default_value' => $field->default_value,
26
-                'name' => $field->name,
27
-                'description' => $field->description,
28
-                'type' => apply_filters('frm_field_type', $field->type, $field, $new_value),
29
-                'options' => $field->options,
30
-                'required' => $field->required,
31
-                'field_key' => $field->field_key,
32
-                'field_order' => $field->field_order,
33
-                'form_id' => $field->form_id,
12
+		}
13
+
14
+		$values['fields'] = array();
15
+		if ( empty($fields) ) {
16
+			return apply_filters('frm_setup_new_entry', $values);
17
+		}
18
+
19
+		foreach ( (array) $fields as $field ) {
20
+			$new_value = self::get_field_value_for_new_entry( $field, $reset, $args );
21
+
22
+			$field_array = array(
23
+				'id' => $field->id,
24
+				'value' => $new_value,
25
+				'default_value' => $field->default_value,
26
+				'name' => $field->name,
27
+				'description' => $field->description,
28
+				'type' => apply_filters('frm_field_type', $field->type, $field, $new_value),
29
+				'options' => $field->options,
30
+				'required' => $field->required,
31
+				'field_key' => $field->field_key,
32
+				'field_order' => $field->field_order,
33
+				'form_id' => $field->form_id,
34 34
 				'parent_form_id' => isset( $args['parent_form_id'] ) ? $args['parent_form_id'] : $field->form_id,
35
-	            'reset_value' => $reset,
36
-            );
35
+				'reset_value' => $reset,
36
+			);
37 37
 
38
-            $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
39
-            $opt_defaults['required_indicator'] = '';
38
+			$opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
39
+			$opt_defaults['required_indicator'] = '';
40 40
 			$opt_defaults['original_type'] = $field->type;
41 41
 
42 42
 			foreach ( $opt_defaults as $opt => $default_opt ) {
43
-                $field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt;
44
-                unset($opt, $default_opt);
45
-            }
43
+				$field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt;
44
+				unset($opt, $default_opt);
45
+			}
46 46
 
47
-            unset($opt_defaults);
47
+			unset($opt_defaults);
48 48
 
49
-            if ( $field_array['custom_html'] == '' ) {
50
-                $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
51
-            }
49
+			if ( $field_array['custom_html'] == '' ) {
50
+				$field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
51
+			}
52 52
 
53
-            $field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field);
54
-            $field_array = array_merge( $field->field_options, $field_array );
53
+			$field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field);
54
+			$field_array = array_merge( $field->field_options, $field_array );
55 55
 
56
-            $values['fields'][] = $field_array;
56
+			$values['fields'][] = $field_array;
57 57
 
58
-            if ( ! $form || ! isset($form->id) ) {
59
-                $form = FrmForm::getOne($field->form_id);
60
-            }
61
-        }
58
+			if ( ! $form || ! isset($form->id) ) {
59
+				$form = FrmForm::getOne($field->form_id);
60
+			}
61
+		}
62 62
 
63
-        $form->options = maybe_unserialize($form->options);
64
-        if ( is_array($form->options) ) {
65
-            foreach ( $form->options as $opt => $value ) {
66
-                $values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value );
67
-                unset($opt, $value);
68
-            }
69
-        }
63
+		$form->options = maybe_unserialize($form->options);
64
+		if ( is_array($form->options) ) {
65
+			foreach ( $form->options as $opt => $value ) {
66
+				$values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value );
67
+				unset($opt, $value);
68
+			}
69
+		}
70 70
 
71 71
 		$form_defaults = FrmFormsHelper::get_default_opts();
72 72
 
@@ -76,19 +76,19 @@  discard block
 block discarded – undo
76 76
 		$values = array_merge( $form_defaults, $values );
77 77
 
78 78
 		return apply_filters( 'frm_setup_new_entry', $values );
79
-    }
79
+	}
80 80
 
81 81
 	/**
82
-	* Set the value for each field
83
-	* This function is used when the form is first loaded and on all page turns *for a new entry*
84
-	*
85
-	* @since 2.0.13
86
-	*
87
-	* @param object $field - this is passed by reference since it is an object
88
-	* @param boolean $reset
89
-	* @param array $args
90
-	* @return string|array $new_value
91
-	*/
82
+	 * Set the value for each field
83
+	 * This function is used when the form is first loaded and on all page turns *for a new entry*
84
+	 *
85
+	 * @since 2.0.13
86
+	 *
87
+	 * @param object $field - this is passed by reference since it is an object
88
+	 * @param boolean $reset
89
+	 * @param array $args
90
+	 * @return string|array $new_value
91
+	 */
92 92
 	private static function get_field_value_for_new_entry( $field, $reset, $args ) {
93 93
 		//If checkbox, multi-select dropdown, or checkbox data from entries field, the value should be an array
94 94
 		$return_array = FrmField::is_field_with_multiple_values( $field );
@@ -114,13 +114,13 @@  discard block
 block discarded – undo
114 114
 	}
115 115
 
116 116
 	/**
117
-	* Check if a field has a posted value
118
-	*
119
-	* @since 2.01.0
120
-	* @param object $field
121
-	* @param array $args
122
-	* @return boolean $value_is_posted
123
-	*/
117
+	 * Check if a field has a posted value
118
+	 *
119
+	 * @since 2.01.0
120
+	 * @param object $field
121
+	 * @param array $args
122
+	 * @return boolean $value_is_posted
123
+	 */
124 124
 	public static function value_is_posted( $field, $args ){
125 125
 		$value_is_posted = false;
126 126
 		if ( $_POST ) {
@@ -138,15 +138,15 @@  discard block
 block discarded – undo
138 138
 
139 139
 	public static function setup_edit_vars( $values, $record ) {
140 140
 		$values['item_key'] = FrmAppHelper::get_post_param( 'item_key', $record->item_key, 'sanitize_title' );
141
-        $values['form_id'] = $record->form_id;
142
-        $values['is_draft'] = $record->is_draft;
143
-        return apply_filters('frm_setup_edit_entry_vars', $values, $record);
144
-    }
141
+		$values['form_id'] = $record->form_id;
142
+		$values['is_draft'] = $record->is_draft;
143
+		return apply_filters('frm_setup_edit_entry_vars', $values, $record);
144
+	}
145 145
 
146
-    public static function get_admin_params( $form = null ) {
146
+	public static function get_admin_params( $form = null ) {
147 147
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_admin_params' );
148 148
 		return FrmForm::set_current_form( $form );
149
-    }
149
+	}
150 150
 
151 151
 	public static function set_current_form( $form_id ) {
152 152
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::set_current_form' );
@@ -158,282 +158,282 @@  discard block
 block discarded – undo
158 158
 		return FrmForm::get_current_form( $form_id );
159 159
 	}
160 160
 
161
-    public static function get_current_form_id() {
161
+	public static function get_current_form_id() {
162 162
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_current_form_id' );
163 163
 		return FrmForm::get_current_form_id();
164
-    }
164
+	}
165 165
 
166
-    public static function maybe_get_entry( &$entry ) {
166
+	public static function maybe_get_entry( &$entry ) {
167 167
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmEntry::maybe_get_entry' );
168 168
 		FrmEntry::maybe_get_entry( $entry );
169
-    }
169
+	}
170 170
 
171 171
 	public static function replace_default_message( $message, $atts ) {
172
-        if ( strpos($message, '[default-message') === false &&
173
-            strpos($message, '[default_message') === false &&
174
-            ! empty( $message ) ) {
175
-            return $message;
176
-        }
177
-
178
-        if ( empty($message) ) {
179
-            $message = '[default-message]';
180
-        }
181
-
182
-        preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER);
183
-
184
-        foreach ( $shortcodes[0] as $short_key => $tag ) {
185
-            $add_atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] );
186
-            if ( $add_atts ) {
187
-                $this_atts = array_merge($atts, $add_atts);
188
-            } else {
189
-                $this_atts = $atts;
190
-            }
172
+		if ( strpos($message, '[default-message') === false &&
173
+			strpos($message, '[default_message') === false &&
174
+			! empty( $message ) ) {
175
+			return $message;
176
+		}
177
+
178
+		if ( empty($message) ) {
179
+			$message = '[default-message]';
180
+		}
181
+
182
+		preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER);
183
+
184
+		foreach ( $shortcodes[0] as $short_key => $tag ) {
185
+			$add_atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] );
186
+			if ( $add_atts ) {
187
+				$this_atts = array_merge($atts, $add_atts);
188
+			} else {
189
+				$this_atts = $atts;
190
+			}
191 191
 
192 192
 			$default = FrmEntryFormat::show_entry( $this_atts );
193 193
 
194
-            // Add the default message
195
-            $message = str_replace( $shortcodes[0][ $short_key ], $default, $message );
196
-        }
194
+			// Add the default message
195
+			$message = str_replace( $shortcodes[0][ $short_key ], $default, $message );
196
+		}
197 197
 
198
-        return $message;
199
-    }
198
+		return $message;
199
+	}
200 200
 
201 201
 	public static function prepare_display_value( $entry, $field, $atts ) {
202 202
 		$field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false;
203 203
 
204
-        if ( FrmAppHelper::pro_is_installed() ) {
204
+		if ( FrmAppHelper::pro_is_installed() ) {
205 205
 			FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value );
206
-        }
206
+		}
207 207
 
208
-        if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) {
209
-            return self::display_value($field_value, $field, $atts);
210
-        }
208
+		if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) {
209
+			return self::display_value($field_value, $field, $atts);
210
+		}
211 211
 
212
-        // this is an embeded form
213
-        $val = '';
212
+		// this is an embeded form
213
+		$val = '';
214 214
 
215
-	    if ( strpos($atts['embedded_field_id'], 'form') === 0 ) {
216
-            //this is a repeating section
215
+		if ( strpos($atts['embedded_field_id'], 'form') === 0 ) {
216
+			//this is a repeating section
217 217
 			$child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) );
218
-        } else {
219
-            // get all values for this field
220
-	        $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false;
218
+		} else {
219
+			// get all values for this field
220
+			$child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false;
221 221
 
222
-            if ( $child_values ) {
223
-	            $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) );
224
-	        }
225
-	    }
222
+			if ( $child_values ) {
223
+				$child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) );
224
+			}
225
+		}
226 226
 
227
-	    $field_value = array();
227
+		$field_value = array();
228 228
 
229
-        if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
230
-            return $val;
231
-        }
229
+		if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
230
+			return $val;
231
+		}
232 232
 
233
-        foreach ( $child_entries as $child_entry ) {
234
-            $atts['item_id'] = $child_entry->id;
235
-            $atts['post_id'] = $child_entry->post_id;
233
+		foreach ( $child_entries as $child_entry ) {
234
+			$atts['item_id'] = $child_entry->id;
235
+			$atts['post_id'] = $child_entry->post_id;
236 236
 
237
-            // get the value for this field -- check for post values as well
238
-            $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field);
237
+			// get the value for this field -- check for post values as well
238
+			$entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field);
239 239
 
240
-            if ( $entry_val ) {
241
-                // foreach entry get display_value
242
-                $field_value[] = self::display_value($entry_val, $field, $atts);
243
-            }
240
+			if ( $entry_val ) {
241
+				// foreach entry get display_value
242
+				$field_value[] = self::display_value($entry_val, $field, $atts);
243
+			}
244 244
 
245
-            unset($child_entry);
246
-        }
245
+			unset($child_entry);
246
+		}
247 247
 
248
-        $val = implode(', ', (array) $field_value );
248
+		$val = implode(', ', (array) $field_value );
249 249
 		$val = wp_kses_post( $val );
250 250
 
251
-        return $val;
252
-    }
251
+		return $val;
252
+	}
253 253
 
254
-    /**
255
-     * Prepare the saved value for display
256
-     * @return string
257
-     */
254
+	/**
255
+	 * Prepare the saved value for display
256
+	 * @return string
257
+	 */
258 258
 	public static function display_value( $value, $field, $atts = array() ) {
259 259
 
260
-        $defaults = array(
261
-            'type' => '', 'html' => false, 'show_filename' => true,
262
-            'truncate' => false, 'sep' => ', ', 'post_id' => 0,
263
-            'form_id' => $field->form_id, 'field' => $field, 'keepjs' => 0,
260
+		$defaults = array(
261
+			'type' => '', 'html' => false, 'show_filename' => true,
262
+			'truncate' => false, 'sep' => ', ', 'post_id' => 0,
263
+			'form_id' => $field->form_id, 'field' => $field, 'keepjs' => 0,
264 264
 			'return_array' => false,
265
-        );
265
+		);
266 266
 
267
-        $atts = wp_parse_args( $atts, $defaults );
268
-        $atts = apply_filters('frm_display_value_atts', $atts, $field, $value);
267
+		$atts = wp_parse_args( $atts, $defaults );
268
+		$atts = apply_filters('frm_display_value_atts', $atts, $field, $value);
269 269
 
270
-        if ( ! isset($field->field_options['post_field']) ) {
271
-            $field->field_options['post_field'] = '';
272
-        }
270
+		if ( ! isset($field->field_options['post_field']) ) {
271
+			$field->field_options['post_field'] = '';
272
+		}
273 273
 
274
-        if ( ! isset($field->field_options['custom_field']) ) {
275
-            $field->field_options['custom_field'] = '';
276
-        }
274
+		if ( ! isset($field->field_options['custom_field']) ) {
275
+			$field->field_options['custom_field'] = '';
276
+		}
277 277
 
278
-        if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) {
279
-            $atts['pre_truncate'] = $atts['truncate'];
280
-            $atts['truncate'] = true;
281
-            $atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0;
278
+		if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) {
279
+			$atts['pre_truncate'] = $atts['truncate'];
280
+			$atts['truncate'] = true;
281
+			$atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0;
282 282
 
283
-            $value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts);
284
-            $atts['truncate'] = $atts['pre_truncate'];
285
-        }
283
+			$value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts);
284
+			$atts['truncate'] = $atts['pre_truncate'];
285
+		}
286 286
 
287
-        if ( $value == '' ) {
288
-            return $value;
289
-        }
287
+		if ( $value == '' ) {
288
+			return $value;
289
+		}
290 290
 
291
-        $value = apply_filters('frm_display_value_custom', maybe_unserialize($value), $field, $atts);
291
+		$value = apply_filters('frm_display_value_custom', maybe_unserialize($value), $field, $atts);
292 292
 		$value = apply_filters( 'frm_display_' . $field->type . '_value_custom', $value, compact( 'field', 'atts' ) );
293 293
 
294
-        $new_value = '';
294
+		$new_value = '';
295 295
 
296
-        if ( is_array($value) && $atts['type'] != 'file' ) {
297
-            foreach ( $value as $val ) {
298
-                if ( is_array($val) ) {
296
+		if ( is_array($value) && $atts['type'] != 'file' ) {
297
+			foreach ( $value as $val ) {
298
+				if ( is_array($val) ) {
299 299
 					//TODO: add options for display (li or ,)
300
-                    $new_value .= implode($atts['sep'], $val);
301
-                    if ( $atts['type'] != 'data' ) {
302
-                        $new_value .= '<br/>';
303
-                    }
304
-                }
305
-                unset($val);
306
-            }
307
-        }
308
-
309
-        if ( ! empty($new_value) ) {
310
-            $value = $new_value;
311
-        } else if ( is_array($value) && $atts['type'] != 'file' && ! $atts['return_array'] ) {
312
-            $value = implode($atts['sep'], $value);
313
-        }
314
-
315
-        if ( $atts['truncate'] && $atts['type'] != 'image' ) {
316
-            $value = FrmAppHelper::truncate($value, 50);
317
-        }
300
+					$new_value .= implode($atts['sep'], $val);
301
+					if ( $atts['type'] != 'data' ) {
302
+						$new_value .= '<br/>';
303
+					}
304
+				}
305
+				unset($val);
306
+			}
307
+		}
308
+
309
+		if ( ! empty($new_value) ) {
310
+			$value = $new_value;
311
+		} else if ( is_array($value) && $atts['type'] != 'file' && ! $atts['return_array'] ) {
312
+			$value = implode($atts['sep'], $value);
313
+		}
314
+
315
+		if ( $atts['truncate'] && $atts['type'] != 'image' ) {
316
+			$value = FrmAppHelper::truncate($value, 50);
317
+		}
318 318
 
319 319
 		if ( ! $atts['keepjs'] && ! is_array( $value ) ) {
320 320
 			$value = wp_kses_post( $value );
321 321
 		}
322 322
 
323
-        return apply_filters('frm_display_value', $value, $field, $atts);
324
-    }
323
+		return apply_filters('frm_display_value', $value, $field, $atts);
324
+	}
325 325
 
326 326
 	public static function set_posted_value( $field, $value, $args ) {
327
-        // If validating a field with "other" opt, set back to prev value now
328
-        if ( isset( $args['other'] ) && $args['other'] ) {
329
-            $value = $args['temp_value'];
330
-        }
331
-        if ( empty($args['parent_field_id']) ) {
332
-            $_POST['item_meta'][ $field->id ] = $value;
333
-        } else {
334
-            $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value;
335
-        }
336
-    }
327
+		// If validating a field with "other" opt, set back to prev value now
328
+		if ( isset( $args['other'] ) && $args['other'] ) {
329
+			$value = $args['temp_value'];
330
+		}
331
+		if ( empty($args['parent_field_id']) ) {
332
+			$_POST['item_meta'][ $field->id ] = $value;
333
+		} else {
334
+			$_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value;
335
+		}
336
+	}
337 337
 
338 338
 	public static function get_posted_value( $field, &$value, $args ) {
339 339
 		$field_id = is_object( $field ) ? $field->id : $field;
340 340
 
341
-        if ( empty($args['parent_field_id']) ) {
342
-            $value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : '';
343
-        } else {
344
-            $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : '';
345
-        }
346
-    }
347
-
348
-    /**
349
-    * Check if field has an "Other" option and if any other values are posted
350
-    *
351
-    * @since 2.0
352
-    *
353
-    * @param object $field
354
-    * @param string|array $value
355
-    * @param array $args
356
-    */
357
-    public static function maybe_set_other_validation( $field, &$value, &$args ) {
358
-        $args['other'] = false;
359
-        if ( ! $value || empty( $value ) || ! FrmAppHelper::pro_is_installed() ) {
360
-            return;
361
-        }
362
-
363
-        // Get other value for fields in repeating section
364
-        self::set_other_repeating_vals( $field, $value, $args );
365
-
366
-        // Check if there are any posted "Other" values
341
+		if ( empty($args['parent_field_id']) ) {
342
+			$value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : '';
343
+		} else {
344
+			$value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : '';
345
+		}
346
+	}
347
+
348
+	/**
349
+	 * Check if field has an "Other" option and if any other values are posted
350
+	 *
351
+	 * @since 2.0
352
+	 *
353
+	 * @param object $field
354
+	 * @param string|array $value
355
+	 * @param array $args
356
+	 */
357
+	public static function maybe_set_other_validation( $field, &$value, &$args ) {
358
+		$args['other'] = false;
359
+		if ( ! $value || empty( $value ) || ! FrmAppHelper::pro_is_installed() ) {
360
+			return;
361
+		}
362
+
363
+		// Get other value for fields in repeating section
364
+		self::set_other_repeating_vals( $field, $value, $args );
365
+
366
+		// Check if there are any posted "Other" values
367 367
 		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) {
368 368
 
369
-            // Save original value
370
-            $args['temp_value'] = $value;
371
-            $args['other'] = true;
372
-            $other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] );
373
-
374
-            // Set the validation value now
375
-            self::set_other_validation_val( $value, $other_vals, $field, $args );
376
-        }
377
-    }
378
-
379
-    /**
380
-    * Sets radio or checkbox value equal to "other" value if it is set - FOR REPEATING SECTIONS
381
-    *
382
-    * @since 2.0
383
-    *
384
-    * @param object $field
385
-    * @param string|array $value
386
-    * @param array $args
387
-    */
388
-    public static function set_other_repeating_vals( $field, &$value, &$args ) {
389
-        if ( ! $args['parent_field_id'] ) {
390
-            return;
391
-        }
392
-
393
-        // Check if there are any other posted "other" values for this field
369
+			// Save original value
370
+			$args['temp_value'] = $value;
371
+			$args['other'] = true;
372
+			$other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] );
373
+
374
+			// Set the validation value now
375
+			self::set_other_validation_val( $value, $other_vals, $field, $args );
376
+		}
377
+	}
378
+
379
+	/**
380
+	 * Sets radio or checkbox value equal to "other" value if it is set - FOR REPEATING SECTIONS
381
+	 *
382
+	 * @since 2.0
383
+	 *
384
+	 * @param object $field
385
+	 * @param string|array $value
386
+	 * @param array $args
387
+	 */
388
+	public static function set_other_repeating_vals( $field, &$value, &$args ) {
389
+		if ( ! $args['parent_field_id'] ) {
390
+			return;
391
+		}
392
+
393
+		// Check if there are any other posted "other" values for this field
394 394
 		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) {
395
-            // Save original value
396
-            $args['temp_value'] = $value;
397
-            $args['other'] = true;
398
-
399
-            $other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ];
400
-
401
-            // Set the validation value now
402
-            self::set_other_validation_val( $value, $other_vals, $field, $args );
403
-        }
404
-    }
405
-
406
-    /**
407
-    * Modify value used for validation
408
-    * This function essentially removes the "Other" radio or checkbox value from the $value being validated.
409
-    * It also adds any text from the free text fields to the value
410
-    *
411
-    * Needs to accommodate for times when other opt is selected, but no other free text is entered
412
-    *
413
-    * @since 2.0
414
-    *
415
-    * @param string|array $value
416
-    * @param string|array $other_vals (usually of posted values)
417
-    * @param object $field
418
-    * @param array $args
419
-    */
420
-    public static function set_other_validation_val( &$value, $other_vals, $field, &$args ) {
421
-        // Checkboxes and multi-select dropdowns
422
-        if ( is_array( $value ) && $field->type == 'checkbox' ) {
423
-            // Combine "Other" values with checked values. "Other" values will override checked box values.
424
-            $value = array_merge( $value, $other_vals );
425
-            $value = array_filter( $value );
426
-            if ( count( $value ) == 0 ) {
427
-                $value = '';
428
-            }
429
-        } else {
395
+			// Save original value
396
+			$args['temp_value'] = $value;
397
+			$args['other'] = true;
398
+
399
+			$other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ];
400
+
401
+			// Set the validation value now
402
+			self::set_other_validation_val( $value, $other_vals, $field, $args );
403
+		}
404
+	}
405
+
406
+	/**
407
+	 * Modify value used for validation
408
+	 * This function essentially removes the "Other" radio or checkbox value from the $value being validated.
409
+	 * It also adds any text from the free text fields to the value
410
+	 *
411
+	 * Needs to accommodate for times when other opt is selected, but no other free text is entered
412
+	 *
413
+	 * @since 2.0
414
+	 *
415
+	 * @param string|array $value
416
+	 * @param string|array $other_vals (usually of posted values)
417
+	 * @param object $field
418
+	 * @param array $args
419
+	 */
420
+	public static function set_other_validation_val( &$value, $other_vals, $field, &$args ) {
421
+		// Checkboxes and multi-select dropdowns
422
+		if ( is_array( $value ) && $field->type == 'checkbox' ) {
423
+			// Combine "Other" values with checked values. "Other" values will override checked box values.
424
+			$value = array_merge( $value, $other_vals );
425
+			$value = array_filter( $value );
426
+			if ( count( $value ) == 0 ) {
427
+				$value = '';
428
+			}
429
+		} else {
430 430
 			// Radio and dropdowns
431
-            $other_key = array_filter( array_keys($field->options), 'is_string');
432
-            $other_key = reset( $other_key );
431
+			$other_key = array_filter( array_keys($field->options), 'is_string');
432
+			$other_key = reset( $other_key );
433 433
 
434
-            // Multi-select dropdown
435
-            if ( is_array( $value ) ) {
436
-                $o_key = array_search( $field->options[ $other_key ], $value );
434
+			// Multi-select dropdown
435
+			if ( is_array( $value ) ) {
436
+				$o_key = array_search( $field->options[ $other_key ], $value );
437 437
 
438 438
 				if ( $o_key !== false ) {
439 439
 					// Modify the original value so other key will be preserved
@@ -448,20 +448,20 @@  discard block
 block discarded – undo
448 448
 					$args['temp_value'] = $value;
449 449
 					$value[ $other_key ] = reset( $other_vals );
450 450
 				}
451
-            } else if ( $field->options[ $other_key ] == $value ) {
452
-                $value = $other_vals;
453
-            }
454
-        }
455
-    }
451
+			} else if ( $field->options[ $other_key ] == $value ) {
452
+				$value = $other_vals;
453
+			}
454
+		}
455
+	}
456 456
 
457 457
 	public static function enqueue_scripts( $params ) {
458 458
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmFormsController::enqueue_scripts' );
459 459
 		FrmFormsController::enqueue_scripts( $params );
460 460
 	}
461 461
 
462
-    // Add submitted values to a string for spam checking
462
+	// Add submitted values to a string for spam checking
463 463
 	public static function entry_array_to_string( $values ) {
464
-        $content = '';
464
+		$content = '';
465 465
 		foreach ( $values['item_meta'] as $val ) {
466 466
 			if ( $content != '' ) {
467 467
 				$content .= "\n\n";
@@ -469,14 +469,14 @@  discard block
 block discarded – undo
469 469
 
470 470
 			if ( is_array($val) ) {
471 471
 				$val = FrmAppHelper::array_flatten( $val );
472
-			    $val = implode(',', $val);
472
+				$val = implode(',', $val);
473 473
 			}
474 474
 
475 475
 			$content .= $val;
476 476
 		}
477 477
 
478 478
 		return $content;
479
-    }
479
+	}
480 480
 
481 481
 	public static function fill_entry_values( $atts, $f, array &$values ) {
482 482
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmEntryFormat::fill_entry_values' );
Please login to merge, or discard this patch.
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined('ABSPATH') ) {
2
+if ( ! defined( 'ABSPATH' ) ) {
3 3
 	die( 'You are not allowed to call this page directly.' );
4 4
 }
5 5
 
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
     public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) {
9 9
         $values = array();
10 10
 		foreach ( array( 'name' => '', 'description' => '', 'item_key' => '' ) as $var => $default ) {
11
-			$values[ $var ] = FrmAppHelper::get_post_param( $var, $default, 'wp_kses_post' );
11
+			$values[$var] = FrmAppHelper::get_post_param( $var, $default, 'wp_kses_post' );
12 12
         }
13 13
 
14 14
         $values['fields'] = array();
15
-        if ( empty($fields) ) {
16
-            return apply_filters('frm_setup_new_entry', $values);
15
+        if ( empty( $fields ) ) {
16
+            return apply_filters( 'frm_setup_new_entry', $values );
17 17
         }
18 18
 
19 19
         foreach ( (array) $fields as $field ) {
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
                 'default_value' => $field->default_value,
26 26
                 'name' => $field->name,
27 27
                 'description' => $field->description,
28
-                'type' => apply_filters('frm_field_type', $field->type, $field, $new_value),
28
+                'type' => apply_filters( 'frm_field_type', $field->type, $field, $new_value ),
29 29
                 'options' => $field->options,
30 30
                 'required' => $field->required,
31 31
                 'field_key' => $field->field_key,
@@ -35,43 +35,43 @@  discard block
 block discarded – undo
35 35
 	            'reset_value' => $reset,
36 36
             );
37 37
 
38
-            $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true);
38
+            $opt_defaults = FrmFieldsHelper::get_default_field_opts( $field_array['type'], $field, true );
39 39
             $opt_defaults['required_indicator'] = '';
40 40
 			$opt_defaults['original_type'] = $field->type;
41 41
 
42 42
 			foreach ( $opt_defaults as $opt => $default_opt ) {
43
-                $field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt;
44
-                unset($opt, $default_opt);
43
+                $field_array[$opt] = ( isset( $field->field_options[$opt] ) && $field->field_options[$opt] != '' ) ? $field->field_options[$opt] : $default_opt;
44
+                unset( $opt, $default_opt );
45 45
             }
46 46
 
47
-            unset($opt_defaults);
47
+            unset( $opt_defaults );
48 48
 
49 49
             if ( $field_array['custom_html'] == '' ) {
50
-                $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type);
50
+                $field_array['custom_html'] = FrmFieldsHelper::get_default_html( $field->type );
51 51
             }
52 52
 
53
-            $field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field);
53
+            $field_array = apply_filters( 'frm_setup_new_fields_vars', $field_array, $field );
54 54
             $field_array = array_merge( $field->field_options, $field_array );
55 55
 
56 56
             $values['fields'][] = $field_array;
57 57
 
58
-            if ( ! $form || ! isset($form->id) ) {
59
-                $form = FrmForm::getOne($field->form_id);
58
+            if ( ! $form || ! isset( $form->id ) ) {
59
+                $form = FrmForm::getOne( $field->form_id );
60 60
             }
61 61
         }
62 62
 
63
-        $form->options = maybe_unserialize($form->options);
64
-        if ( is_array($form->options) ) {
63
+        $form->options = maybe_unserialize( $form->options );
64
+        if ( is_array( $form->options ) ) {
65 65
             foreach ( $form->options as $opt => $value ) {
66
-                $values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value );
67
-                unset($opt, $value);
66
+                $values[$opt] = FrmAppHelper::get_post_param( $opt, $value );
67
+                unset( $opt, $value );
68 68
             }
69 69
         }
70 70
 
71 71
 		$form_defaults = FrmFormsHelper::get_default_opts();
72 72
 
73 73
 		$frm_settings = FrmAppHelper::get_settings();
74
-		$form_defaults['custom_style']  = ( $frm_settings->load_style != 'none' );
74
+		$form_defaults['custom_style'] = ( $frm_settings->load_style != 'none' );
75 75
 
76 76
 		$values = array_merge( $form_defaults, $values );
77 77
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		$return_array = FrmField::is_field_with_multiple_values( $field );
95 95
 
96 96
 		// Do any shortcodes in default value and allow customization of default value
97
-		$field->default_value = apply_filters('frm_get_default_value', $field->default_value, $field, true, $return_array);
97
+		$field->default_value = apply_filters( 'frm_get_default_value', $field->default_value, $field, true, $return_array );
98 98
 		// Calls FrmProFieldsHelper::get_default_value
99 99
 
100 100
 		$new_value = $field->default_value;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		}
108 108
 
109 109
 		if ( ! is_array( $new_value ) ) {
110
-			$new_value = str_replace('"', '&quot;', $new_value);
110
+			$new_value = str_replace( '"', '&quot;', $new_value );
111 111
 		}
112 112
 
113 113
 		return $new_value;
@@ -121,15 +121,15 @@  discard block
 block discarded – undo
121 121
 	* @param array $args
122 122
 	* @return boolean $value_is_posted
123 123
 	*/
124
-	public static function value_is_posted( $field, $args ){
124
+	public static function value_is_posted( $field, $args ) {
125 125
 		$value_is_posted = false;
126 126
 		if ( $_POST ) {
127 127
 			$repeating = isset( $args['repeating'] ) && $args['repeating'];
128 128
 			if ( $repeating ) {
129
-				if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) {
129
+				if ( isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] ) ) {
130 130
 					$value_is_posted = true;
131 131
 				}
132
-			} else if ( isset( $_POST['item_meta'][ $field->id ] ) ) {
132
+			} else if ( isset( $_POST['item_meta'][$field->id] ) ) {
133 133
 				$value_is_posted = true;
134 134
 			}
135 135
 		}
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		$values['item_key'] = FrmAppHelper::get_post_param( 'item_key', $record->item_key, 'sanitize_title' );
141 141
         $values['form_id'] = $record->form_id;
142 142
         $values['is_draft'] = $record->is_draft;
143
-        return apply_filters('frm_setup_edit_entry_vars', $values, $record);
143
+        return apply_filters( 'frm_setup_edit_entry_vars', $values, $record );
144 144
     }
145 145
 
146 146
     public static function get_admin_params( $form = null ) {
@@ -169,22 +169,22 @@  discard block
 block discarded – undo
169 169
     }
170 170
 
171 171
 	public static function replace_default_message( $message, $atts ) {
172
-        if ( strpos($message, '[default-message') === false &&
173
-            strpos($message, '[default_message') === false &&
172
+        if ( strpos( $message, '[default-message' ) === false &&
173
+            strpos( $message, '[default_message' ) === false &&
174 174
             ! empty( $message ) ) {
175 175
             return $message;
176 176
         }
177 177
 
178
-        if ( empty($message) ) {
178
+        if ( empty( $message ) ) {
179 179
             $message = '[default-message]';
180 180
         }
181 181
 
182
-        preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER);
182
+        preg_match_all( "/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER );
183 183
 
184 184
         foreach ( $shortcodes[0] as $short_key => $tag ) {
185
-            $add_atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] );
185
+            $add_atts = shortcode_parse_atts( $shortcodes[2][$short_key] );
186 186
             if ( $add_atts ) {
187
-                $this_atts = array_merge($atts, $add_atts);
187
+                $this_atts = array_merge( $atts, $add_atts );
188 188
             } else {
189 189
                 $this_atts = $atts;
190 190
             }
@@ -192,32 +192,32 @@  discard block
 block discarded – undo
192 192
 			$default = FrmEntryFormat::show_entry( $this_atts );
193 193
 
194 194
             // Add the default message
195
-            $message = str_replace( $shortcodes[0][ $short_key ], $default, $message );
195
+            $message = str_replace( $shortcodes[0][$short_key], $default, $message );
196 196
         }
197 197
 
198 198
         return $message;
199 199
     }
200 200
 
201 201
 	public static function prepare_display_value( $entry, $field, $atts ) {
202
-		$field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false;
202
+		$field_value = isset( $entry->metas[$field->id] ) ? $entry->metas[$field->id] : false;
203 203
 
204 204
         if ( FrmAppHelper::pro_is_installed() ) {
205 205
 			FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value );
206 206
         }
207 207
 
208
-        if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) {
209
-            return self::display_value($field_value, $field, $atts);
208
+        if ( $field->form_id == $entry->form_id || empty( $atts['embedded_field_id'] ) ) {
209
+            return self::display_value( $field_value, $field, $atts );
210 210
         }
211 211
 
212 212
         // this is an embeded form
213 213
         $val = '';
214 214
 
215
-	    if ( strpos($atts['embedded_field_id'], 'form') === 0 ) {
215
+	    if ( strpos( $atts['embedded_field_id'], 'form' ) === 0 ) {
216 216
             //this is a repeating section
217 217
 			$child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) );
218 218
         } else {
219 219
             // get all values for this field
220
-	        $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false;
220
+	        $child_values = isset( $entry->metas[$atts['embedded_field_id']] ) ? $entry->metas[$atts['embedded_field_id']] : false;
221 221
 
222 222
             if ( $child_values ) {
223 223
 	            $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) );
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 
227 227
 	    $field_value = array();
228 228
 
229
-        if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
229
+        if ( ! isset( $child_entries ) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) {
230 230
             return $val;
231 231
         }
232 232
 
@@ -235,17 +235,17 @@  discard block
 block discarded – undo
235 235
             $atts['post_id'] = $child_entry->post_id;
236 236
 
237 237
             // get the value for this field -- check for post values as well
238
-            $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field);
238
+            $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value( $child_entry, $field );
239 239
 
240 240
             if ( $entry_val ) {
241 241
                 // foreach entry get display_value
242
-                $field_value[] = self::display_value($entry_val, $field, $atts);
242
+                $field_value[] = self::display_value( $entry_val, $field, $atts );
243 243
             }
244 244
 
245
-            unset($child_entry);
245
+            unset( $child_entry );
246 246
         }
247 247
 
248
-        $val = implode(', ', (array) $field_value );
248
+        $val = implode( ', ', (array) $field_value );
249 249
 		$val = wp_kses_post( $val );
250 250
 
251 251
         return $val;
@@ -265,22 +265,22 @@  discard block
 block discarded – undo
265 265
         );
266 266
 
267 267
         $atts = wp_parse_args( $atts, $defaults );
268
-        $atts = apply_filters('frm_display_value_atts', $atts, $field, $value);
268
+        $atts = apply_filters( 'frm_display_value_atts', $atts, $field, $value );
269 269
 
270
-        if ( ! isset($field->field_options['post_field']) ) {
270
+        if ( ! isset( $field->field_options['post_field'] ) ) {
271 271
             $field->field_options['post_field'] = '';
272 272
         }
273 273
 
274
-        if ( ! isset($field->field_options['custom_field']) ) {
274
+        if ( ! isset( $field->field_options['custom_field'] ) ) {
275 275
             $field->field_options['custom_field'] = '';
276 276
         }
277 277
 
278 278
         if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) {
279 279
             $atts['pre_truncate'] = $atts['truncate'];
280 280
             $atts['truncate'] = true;
281
-            $atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0;
281
+            $atts['exclude_cat'] = isset( $field->field_options['exclude_cat'] ) ? $field->field_options['exclude_cat'] : 0;
282 282
 
283
-            $value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts);
283
+            $value = FrmProEntryMetaHelper::get_post_value( $atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts );
284 284
             $atts['truncate'] = $atts['pre_truncate'];
285 285
         }
286 286
 
@@ -288,39 +288,39 @@  discard block
 block discarded – undo
288 288
             return $value;
289 289
         }
290 290
 
291
-        $value = apply_filters('frm_display_value_custom', maybe_unserialize($value), $field, $atts);
291
+        $value = apply_filters( 'frm_display_value_custom', maybe_unserialize( $value ), $field, $atts );
292 292
 		$value = apply_filters( 'frm_display_' . $field->type . '_value_custom', $value, compact( 'field', 'atts' ) );
293 293
 
294 294
         $new_value = '';
295 295
 
296
-        if ( is_array($value) && $atts['type'] != 'file' ) {
296
+        if ( is_array( $value ) && $atts['type'] != 'file' ) {
297 297
             foreach ( $value as $val ) {
298
-                if ( is_array($val) ) {
298
+                if ( is_array( $val ) ) {
299 299
 					//TODO: add options for display (li or ,)
300
-                    $new_value .= implode($atts['sep'], $val);
300
+                    $new_value .= implode( $atts['sep'], $val );
301 301
                     if ( $atts['type'] != 'data' ) {
302 302
                         $new_value .= '<br/>';
303 303
                     }
304 304
                 }
305
-                unset($val);
305
+                unset( $val );
306 306
             }
307 307
         }
308 308
 
309
-        if ( ! empty($new_value) ) {
309
+        if ( ! empty( $new_value ) ) {
310 310
             $value = $new_value;
311
-        } else if ( is_array($value) && $atts['type'] != 'file' && ! $atts['return_array'] ) {
312
-            $value = implode($atts['sep'], $value);
311
+        } else if ( is_array( $value ) && $atts['type'] != 'file' && ! $atts['return_array'] ) {
312
+            $value = implode( $atts['sep'], $value );
313 313
         }
314 314
 
315 315
         if ( $atts['truncate'] && $atts['type'] != 'image' ) {
316
-            $value = FrmAppHelper::truncate($value, 50);
316
+            $value = FrmAppHelper::truncate( $value, 50 );
317 317
         }
318 318
 
319 319
 		if ( ! $atts['keepjs'] && ! is_array( $value ) ) {
320 320
 			$value = wp_kses_post( $value );
321 321
 		}
322 322
 
323
-        return apply_filters('frm_display_value', $value, $field, $atts);
323
+        return apply_filters( 'frm_display_value', $value, $field, $atts );
324 324
     }
325 325
 
326 326
 	public static function set_posted_value( $field, $value, $args ) {
@@ -328,20 +328,20 @@  discard block
 block discarded – undo
328 328
         if ( isset( $args['other'] ) && $args['other'] ) {
329 329
             $value = $args['temp_value'];
330 330
         }
331
-        if ( empty($args['parent_field_id']) ) {
332
-            $_POST['item_meta'][ $field->id ] = $value;
331
+        if ( empty( $args['parent_field_id'] ) ) {
332
+            $_POST['item_meta'][$field->id] = $value;
333 333
         } else {
334
-            $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value;
334
+            $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] = $value;
335 335
         }
336 336
     }
337 337
 
338 338
 	public static function get_posted_value( $field, &$value, $args ) {
339 339
 		$field_id = is_object( $field ) ? $field->id : $field;
340 340
 
341
-        if ( empty($args['parent_field_id']) ) {
342
-            $value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : '';
341
+        if ( empty( $args['parent_field_id'] ) ) {
342
+            $value = isset( $_POST['item_meta'][$field_id] ) ? $_POST['item_meta'][$field_id] : '';
343 343
         } else {
344
-            $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : '';
344
+            $value = isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) ? $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] : '';
345 345
         }
346 346
     }
347 347
 
@@ -364,12 +364,12 @@  discard block
 block discarded – undo
364 364
         self::set_other_repeating_vals( $field, $value, $args );
365 365
 
366 366
         // Check if there are any posted "Other" values
367
-		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) {
367
+		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][$field->id] ) ) {
368 368
 
369 369
             // Save original value
370 370
             $args['temp_value'] = $value;
371 371
             $args['other'] = true;
372
-            $other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] );
372
+            $other_vals = stripslashes_deep( $_POST['item_meta']['other'][$field->id] );
373 373
 
374 374
             // Set the validation value now
375 375
             self::set_other_validation_val( $value, $other_vals, $field, $args );
@@ -391,12 +391,12 @@  discard block
 block discarded – undo
391 391
         }
392 392
 
393 393
         // Check if there are any other posted "other" values for this field
394
-		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) {
394
+		if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ) ) {
395 395
             // Save original value
396 396
             $args['temp_value'] = $value;
397 397
             $args['other'] = true;
398 398
 
399
-            $other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ];
399
+            $other_vals = $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id];
400 400
 
401 401
             // Set the validation value now
402 402
             self::set_other_validation_val( $value, $other_vals, $field, $args );
@@ -428,27 +428,27 @@  discard block
 block discarded – undo
428 428
             }
429 429
         } else {
430 430
 			// Radio and dropdowns
431
-            $other_key = array_filter( array_keys($field->options), 'is_string');
431
+            $other_key = array_filter( array_keys( $field->options ), 'is_string' );
432 432
             $other_key = reset( $other_key );
433 433
 
434 434
             // Multi-select dropdown
435 435
             if ( is_array( $value ) ) {
436
-                $o_key = array_search( $field->options[ $other_key ], $value );
436
+                $o_key = array_search( $field->options[$other_key], $value );
437 437
 
438 438
 				if ( $o_key !== false ) {
439 439
 					// Modify the original value so other key will be preserved
440
-					$value[ $other_key ] = $value[ $o_key ];
440
+					$value[$other_key] = $value[$o_key];
441 441
 
442 442
 					// By default, the array keys will be numeric for multi-select dropdowns
443 443
 					// If going backwards and forwards between pages, the array key will match the other key
444 444
 					if ( $o_key != $other_key ) {
445
-						unset( $value[ $o_key ] );
445
+						unset( $value[$o_key] );
446 446
 					}
447 447
 
448 448
 					$args['temp_value'] = $value;
449
-					$value[ $other_key ] = reset( $other_vals );
449
+					$value[$other_key] = reset( $other_vals );
450 450
 				}
451
-            } else if ( $field->options[ $other_key ] == $value ) {
451
+            } else if ( $field->options[$other_key] == $value ) {
452 452
                 $value = $other_vals;
453 453
             }
454 454
         }
@@ -467,9 +467,9 @@  discard block
 block discarded – undo
467 467
 				$content .= "\n\n";
468 468
 			}
469 469
 
470
-			if ( is_array($val) ) {
470
+			if ( is_array( $val ) ) {
471 471
 				$val = FrmAppHelper::array_flatten( $val );
472
-			    $val = implode(',', $val);
472
+			    $val = implode( ',', $val );
473 473
 			}
474 474
 
475 475
 			$content .= $val;
@@ -514,6 +514,6 @@  discard block
 block discarded – undo
514 514
 	}
515 515
 
516 516
 	public static function entries_dropdown() {
517
-		_deprecated_function( __FUNCTION__, '1.07.09');
517
+		_deprecated_function( __FUNCTION__, '1.07.09' );
518 518
 	}
519 519
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@
 block discarded – undo
121 121
 	* @param array $args
122 122
 	* @return boolean $value_is_posted
123 123
 	*/
124
-	public static function value_is_posted( $field, $args ){
124
+	public static function value_is_posted( $field, $args ) {
125 125
 		$value_is_posted = false;
126 126
 		if ( $_POST ) {
127 127
 			$repeating = isset( $args['repeating'] ) && $args['repeating'];
Please login to merge, or discard this patch.
classes/helpers/FrmFieldsHelper.php 1 patch
Indentation   +775 added lines, -775 removed lines patch added patch discarded remove patch
@@ -7,71 +7,71 @@  discard block
 block discarded – undo
7 7
 
8 8
 	public static function setup_new_vars( $type = '', $form_id = '' ) {
9 9
 
10
-        if ( strpos($type, '|') ) {
11
-            list($type, $setting) = explode('|', $type);
12
-        }
13
-
14
-        $defaults = self::get_default_field_opts($type, $form_id);
15
-        $defaults['field_options']['custom_html'] = self::get_default_html($type);
16
-
17
-        $values = array();
18
-
19
-        foreach ( $defaults as $var => $default ) {
20
-            if ( $var == 'field_options' ) {
21
-                $values['field_options'] = array();
22
-                foreach ( $default as $opt_var => $opt_default ) {
23
-                    $values['field_options'][ $opt_var ] = $opt_default;
24
-                    unset($opt_var, $opt_default);
25
-                }
26
-            } else {
27
-                $values[ $var ] = $default;
28
-            }
29
-            unset($var, $default);
30
-        }
31
-
32
-        if ( isset( $setting ) && ! empty( $setting ) ) {
33
-            if ( 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
-        } else if ( 'url' == $type ) {
55
-            $values['name'] = __( 'Website', 'formidable' );
56
-        }
10
+		if ( strpos($type, '|') ) {
11
+			list($type, $setting) = explode('|', $type);
12
+		}
13
+
14
+		$defaults = self::get_default_field_opts($type, $form_id);
15
+		$defaults['field_options']['custom_html'] = self::get_default_html($type);
16
+
17
+		$values = array();
18
+
19
+		foreach ( $defaults as $var => $default ) {
20
+			if ( $var == 'field_options' ) {
21
+				$values['field_options'] = array();
22
+				foreach ( $default as $opt_var => $opt_default ) {
23
+					$values['field_options'][ $opt_var ] = $opt_default;
24
+					unset($opt_var, $opt_default);
25
+				}
26
+			} else {
27
+				$values[ $var ] = $default;
28
+			}
29
+			unset($var, $default);
30
+		}
31
+
32
+		if ( isset( $setting ) && ! empty( $setting ) ) {
33
+			if ( 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
+		} else if ( 'url' == $type ) {
55
+			$values['name'] = __( 'Website', 'formidable' );
56
+		}
57 57
 
58 58
 		$fields = FrmField::field_selection();
59
-        $fields = array_merge($fields, FrmField::pro_field_selection());
59
+		$fields = array_merge($fields, FrmField::pro_field_selection());
60 60
 
61
-        if ( isset( $fields[ $type ] ) ) {
62
-            $values['name'] = is_array( $fields[ $type ] ) ? $fields[ $type ]['name'] : $fields[ $type ];
63
-        }
61
+		if ( isset( $fields[ $type ] ) ) {
62
+			$values['name'] = is_array( $fields[ $type ] ) ? $fields[ $type ]['name'] : $fields[ $type ];
63
+		}
64 64
 
65
-        unset($fields);
65
+		unset($fields);
66 66
 
67
-        return $values;
68
-    }
67
+		return $values;
68
+	}
69 69
 
70 70
 	public static function get_html_id( $field, $plus = '' ) {
71 71
 		return apply_filters( 'frm_field_html_id', 'field_' . $field['field_key'] . $plus, $field );
72
-    }
72
+	}
73 73
 
74
-    public static function setup_edit_vars( $record, $doing_ajax = false ) {
74
+	public static function setup_edit_vars( $record, $doing_ajax = false ) {
75 75
 		$values = array( 'id' => $record->id, 'form_id' => $record->form_id );
76 76
 		$defaults = array(
77 77
 			'name'          => $record->name,
@@ -84,86 +84,86 @@  discard block
 block discarded – undo
84 84
 		);
85 85
 
86 86
 		if ( $doing_ajax ) {
87
-            $values = $values + $defaults;
88
-            $values['form_name'] = '';
87
+			$values = $values + $defaults;
88
+			$values['form_name'] = '';
89 89
 		} else {
90 90
 			foreach ( $defaults as $var => $default ) {
91
-                $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' );
92
-                unset($var, $default);
93
-            }
91
+				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' );
92
+				unset($var, $default);
93
+			}
94 94
 
95 95
 			$values['form_name'] = $record->form_id ? FrmForm::getName( $record->form_id ) : '';
96
-        }
96
+		}
97 97
 
98 98
 		unset( $defaults );
99 99
 
100
-        $values['options'] = $record->options;
101
-        $values['field_options'] = $record->field_options;
100
+		$values['options'] = $record->options;
101
+		$values['field_options'] = $record->field_options;
102 102
 
103
-        $defaults = self::get_default_field_opts($values['type'], $record, true);
103
+		$defaults = self::get_default_field_opts($values['type'], $record, true);
104 104
 
105 105
 		if ( $values['type'] == 'captcha' ) {
106
-            $frm_settings = FrmAppHelper::get_settings();
107
-            $defaults['invalid'] = $frm_settings->re_msg;
108
-        }
106
+			$frm_settings = FrmAppHelper::get_settings();
107
+			$defaults['invalid'] = $frm_settings->re_msg;
108
+		}
109 109
 
110 110
 		foreach ( $defaults as $opt => $default ) {
111
-            $values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default;
112
-            unset($opt, $default);
113
-        }
111
+			$values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default;
112
+			unset($opt, $default);
113
+		}
114 114
 
115
-        $values['custom_html'] = (isset($record->field_options['custom_html'])) ? $record->field_options['custom_html'] : self::get_default_html($record->type);
115
+		$values['custom_html'] = (isset($record->field_options['custom_html'])) ? $record->field_options['custom_html'] : self::get_default_html($record->type);
116 116
 
117 117
 		return apply_filters( 'frm_setup_edit_field_vars', $values, array( 'doing_ajax' => $doing_ajax ) );
118
-    }
118
+	}
119 119
 
120
-    public static function get_default_field_opts( $type, $field, $limit = false ) {
121
-        $field_options = array(
122
-            'size' => '', 'max' => '', 'label' => '', 'blank' => '',
123
-            'required_indicator' => '*', 'invalid' => '', 'separate_value' => 0,
124
-            'clear_on_focus' => 0, 'default_blank' => 0, 'classes' => '',
120
+	public static function get_default_field_opts( $type, $field, $limit = false ) {
121
+		$field_options = array(
122
+			'size' => '', 'max' => '', 'label' => '', 'blank' => '',
123
+			'required_indicator' => '*', 'invalid' => '', 'separate_value' => 0,
124
+			'clear_on_focus' => 0, 'default_blank' => 0, 'classes' => '',
125 125
 			'custom_html' => '', 'captcha_size' => 'default', 'captcha_theme' => 'light',
126
-        );
126
+		);
127 127
 
128 128
 		if ( $limit ) {
129
-            return $field_options;
129
+			return $field_options;
130 130
 		}
131 131
 
132
-        global $wpdb;
132
+		global $wpdb;
133 133
 
134
-        $form_id = (is_numeric($field)) ? $field : $field->form_id;
134
+		$form_id = (is_numeric($field)) ? $field : $field->form_id;
135 135
 
136 136
 		$key = is_numeric( $field ) ? FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_fields', 'field_key' ) : $field->field_key;
137 137
 
138
-        $field_count = FrmDb::get_var( 'frm_fields', array( 'form_id' => $form_id ), 'field_order', array( 'order_by' => 'field_order DESC' ) );
138
+		$field_count = FrmDb::get_var( 'frm_fields', array( 'form_id' => $form_id ), 'field_order', array( 'order_by' => 'field_order DESC' ) );
139 139
 
140
-        $frm_settings = FrmAppHelper::get_settings();
141
-        return array(
142
-            'name' => __( 'Untitled', 'formidable' ), 'description' => '',
140
+		$frm_settings = FrmAppHelper::get_settings();
141
+		return array(
142
+			'name' => __( 'Untitled', 'formidable' ), 'description' => '',
143 143
 			'field_key' => $key, 'type' => $type, 'options' => '', 'default_value' => '',
144 144
 			'field_order' => $field_count + 1, 'required' => false,
145
-            'blank' => $frm_settings->blank_msg, 'unique_msg' => $frm_settings->unique_msg,
146
-            'invalid' => __( 'This field is invalid', 'formidable' ), 'form_id' => $form_id,
145
+			'blank' => $frm_settings->blank_msg, 'unique_msg' => $frm_settings->unique_msg,
146
+			'invalid' => __( 'This field is invalid', 'formidable' ), 'form_id' => $form_id,
147 147
 			'field_options' => $field_options,
148
-        );
149
-    }
148
+		);
149
+	}
150 150
 
151
-    public static function fill_field( &$values, $field, $form_id, $new_key = '' ) {
152
-        global $wpdb;
151
+	public static function fill_field( &$values, $field, $form_id, $new_key = '' ) {
152
+		global $wpdb;
153 153
 
154 154
 		$values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' );
155
-        $values['form_id'] = $form_id;
156
-        $values['options'] = maybe_serialize($field->options);
157
-        $values['default_value'] = maybe_serialize($field->default_value);
158
-
159
-        foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
160
-            $values[ $col ] = $field->{$col};
161
-        }
162
-    }
163
-
164
-    /**
165
-     * @since 2.0
166
-     */
155
+		$values['form_id'] = $form_id;
156
+		$values['options'] = maybe_serialize($field->options);
157
+		$values['default_value'] = maybe_serialize($field->default_value);
158
+
159
+		foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
160
+			$values[ $col ] = $field->{$col};
161
+		}
162
+	}
163
+
164
+	/**
165
+	 * @since 2.0
166
+	 */
167 167
 	public static function get_error_msg( $field, $error ) {
168 168
 		$frm_settings = FrmAppHelper::get_settings();
169 169
 		$default_settings = $frm_settings->default_options();
@@ -183,21 +183,21 @@  discard block
 block discarded – undo
183 183
 		return $msg;
184 184
 	}
185 185
 
186
-    public static function get_form_fields( $form_id, $error = false ) {
187
-        $fields = FrmField::get_all_for_form($form_id);
188
-        $fields = apply_filters('frm_get_paged_fields', $fields, $form_id, $error);
189
-        return $fields;
190
-    }
186
+	public static function get_form_fields( $form_id, $error = false ) {
187
+		$fields = FrmField::get_all_for_form($form_id);
188
+		$fields = apply_filters('frm_get_paged_fields', $fields, $form_id, $error);
189
+		return $fields;
190
+	}
191 191
 
192 192
 	public static function get_default_html( $type = 'text' ) {
193 193
 		if ( apply_filters( 'frm_normal_field_type_html', true, $type ) ) {
194 194
 			$input = ( in_array( $type, array( 'radio', 'checkbox', 'data' ) ) ) ? '<div class="frm_opt_container">[input]</div>' : '[input]';
195
-            $for = '';
195
+			$for = '';
196 196
 			if ( ! in_array( $type, array( 'radio', 'checkbox', 'data', 'scale' ) ) ) {
197
-                $for = 'for="field_[key]"';
198
-            }
197
+				$for = 'for="field_[key]"';
198
+			}
199 199
 
200
-            $default_html = <<<DEFAULT_HTML
200
+			$default_html = <<<DEFAULT_HTML
201 201
 <div id="frm_field_[id]_container" class="frm_form_field form-field [required_class][error_class]">
202 202
     <label $for class="frm_primary_label">[field_name]
203 203
         <span class="frm_required">[required_label]</span>
@@ -207,145 +207,145 @@  discard block
 block discarded – undo
207 207
     [if error]<div class="frm_error">[error]</div>[/if error]
208 208
 </div>
209 209
 DEFAULT_HTML;
210
-        } else {
210
+		} else {
211 211
 			$default_html = apply_filters('frm_other_custom_html', '', $type);
212
-        }
212
+		}
213 213
 
214
-        return apply_filters('frm_custom_html', $default_html, $type);
215
-    }
214
+		return apply_filters('frm_custom_html', $default_html, $type);
215
+	}
216 216
 
217 217
 	public static function replace_shortcodes( $html, $field, $errors = array(), $form = false, $args = array() ) {
218
-        $html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form);
218
+		$html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form);
219 219
 
220
-        $defaults = array(
220
+		$defaults = array(
221 221
 			'field_name'    => 'item_meta[' . $field['id'] . ']',
222 222
 			'field_id'      => $field['id'],
223
-            'field_plus_id' => '',
224
-            'section_id'    => '',
225
-        );
226
-        $args = wp_parse_args($args, $defaults);
227
-        $field_name = $args['field_name'];
228
-        $field_id = $args['field_id'];
229
-        $html_id = self::get_html_id($field, $args['field_plus_id']);
223
+			'field_plus_id' => '',
224
+			'section_id'    => '',
225
+		);
226
+		$args = wp_parse_args($args, $defaults);
227
+		$field_name = $args['field_name'];
228
+		$field_id = $args['field_id'];
229
+		$html_id = self::get_html_id($field, $args['field_plus_id']);
230 230
 
231
-        if ( FrmField::is_multiple_select($field) ) {
232
-            $field_name .= '[]';
233
-        }
231
+		if ( FrmField::is_multiple_select($field) ) {
232
+			$field_name .= '[]';
233
+		}
234 234
 
235
-        //replace [id]
236
-        $html = str_replace('[id]', $field_id, $html);
235
+		//replace [id]
236
+		$html = str_replace('[id]', $field_id, $html);
237 237
 
238
-        // Remove the for attribute for captcha
239
-        if ( $field['type'] == 'captcha' ) {
240
-            $html = str_replace(' for="field_[key]"', '', $html);
241
-        }
238
+		// Remove the for attribute for captcha
239
+		if ( $field['type'] == 'captcha' ) {
240
+			$html = str_replace(' for="field_[key]"', '', $html);
241
+		}
242 242
 
243
-        // set the label for
244
-        $html = str_replace('field_[key]', $html_id, $html);
243
+		// set the label for
244
+		$html = str_replace('field_[key]', $html_id, $html);
245 245
 
246
-        //replace [key]
247
-        $html = str_replace('[key]', $field['field_key'], $html);
246
+		//replace [key]
247
+		$html = str_replace('[key]', $field['field_key'], $html);
248 248
 
249
-        //replace [description] and [required_label] and [error]
249
+		//replace [description] and [required_label] and [error]
250 250
 		$required = FrmField::is_required( $field ) ? $field['required_indicator'] : '';
251
-        if ( ! is_array( $errors ) ) {
252
-            $errors = array();
253
-        }
251
+		if ( ! is_array( $errors ) ) {
252
+			$errors = array();
253
+		}
254 254
 		$error = isset( $errors[ 'field' . $field_id ] ) ? $errors[ 'field' . $field_id ] : false;
255 255
 
256
-        //If field type is section heading, add class so a bottom margin can be added to either the h3 or description
257
-        if ( $field['type'] == 'divider' ) {
258
-            if ( FrmField::is_option_true( $field, 'description' ) ) {
259
-                $html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html );
260
-            } else {
261
-                $html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html);
262
-            }
263
-        }
256
+		//If field type is section heading, add class so a bottom margin can be added to either the h3 or description
257
+		if ( $field['type'] == 'divider' ) {
258
+			if ( FrmField::is_option_true( $field, 'description' ) ) {
259
+				$html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html );
260
+			} else {
261
+				$html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html);
262
+			}
263
+		}
264 264
 
265 265
 		foreach ( array( 'description' => $field['description'], 'required_label' => $required, 'error' => $error ) as $code => $value ) {
266
-            self::remove_inline_conditions( ( $value && $value != '' ), $code, $value, $html );
267
-        }
266
+			self::remove_inline_conditions( ( $value && $value != '' ), $code, $value, $html );
267
+		}
268 268
 
269
-        //replace [required_class]
269
+		//replace [required_class]
270 270
 		$required_class = FrmField::is_required( $field ) ? ' frm_required_field' : '';
271
-        $html = str_replace('[required_class]', $required_class, $html);
271
+		$html = str_replace('[required_class]', $required_class, $html);
272 272
 
273
-        //replace [label_position]
274
-        $field['label'] = apply_filters('frm_html_label_position', $field['label'], $field, $form);
275
-        $field['label'] = ( $field['label'] && $field['label'] != '' ) ? $field['label'] : 'top';
273
+		//replace [label_position]
274
+		$field['label'] = apply_filters('frm_html_label_position', $field['label'], $field, $form);
275
+		$field['label'] = ( $field['label'] && $field['label'] != '' ) ? $field['label'] : 'top';
276 276
 		$html = str_replace( '[label_position]', ( ( in_array( $field['type'], array( 'divider', 'end_divider', 'break' ) ) ) ? $field['label'] : ' frm_primary_label' ), $html );
277 277
 
278
-        //replace [field_name]
279
-        $html = str_replace('[field_name]', $field['name'], $html);
278
+		//replace [field_name]
279
+		$html = str_replace('[field_name]', $field['name'], $html);
280 280
 
281
-        //replace [error_class]
281
+		//replace [error_class]
282 282
 		$error_class = isset( $errors[ 'field' . $field_id ] ) ? ' frm_blank_field' : '';
283 283
 		self::get_more_field_classes( $error_class, $field, $field_id, $html );
284 284
 		if ( $field['type'] == 'html' && strpos( $html, '[error_class]' ) === false ) {
285 285
 			// there is no error_class shortcode to use for addign fields
286 286
 			$html = str_replace( 'class="frm_form_field', 'class="frm_form_field ' . $error_class, $html );
287 287
 		}
288
-        $html = str_replace('[error_class]', $error_class, $html);
288
+		$html = str_replace('[error_class]', $error_class, $html);
289 289
 
290
-        //replace [entry_key]
291
-        $entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' );
292
-        $html = str_replace('[entry_key]', $entry_key, $html);
290
+		//replace [entry_key]
291
+		$entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' );
292
+		$html = str_replace('[entry_key]', $entry_key, $html);
293 293
 
294
-        //replace [input]
295
-        preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER);
296
-        global $frm_vars;
297
-        $frm_settings = FrmAppHelper::get_settings();
294
+		//replace [input]
295
+		preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER);
296
+		global $frm_vars;
297
+		$frm_settings = FrmAppHelper::get_settings();
298 298
 
299
-        foreach ( $shortcodes[0] as $short_key => $tag ) {
300
-            $atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] );
299
+		foreach ( $shortcodes[0] as $short_key => $tag ) {
300
+			$atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] );
301 301
 			$tag = self::get_shortcode_tag( $shortcodes, $short_key, array( 'conditional' => false, 'conditional_check' => false ) );
302 302
 
303
-            $replace_with = '';
303
+			$replace_with = '';
304 304
 
305
-            if ( $tag == 'input' ) {
306
-                if ( isset($atts['opt']) ) {
307
-                    $atts['opt']--;
308
-                }
305
+			if ( $tag == 'input' ) {
306
+				if ( isset($atts['opt']) ) {
307
+					$atts['opt']--;
308
+				}
309 309
 
310
-                $field['input_class'] = isset($atts['class']) ? $atts['class'] : '';
311
-                if ( isset($atts['class']) ) {
312
-                    unset($atts['class']);
313
-                }
310
+				$field['input_class'] = isset($atts['class']) ? $atts['class'] : '';
311
+				if ( isset($atts['class']) ) {
312
+					unset($atts['class']);
313
+				}
314 314
 
315
-                $field['shortcodes'] = $atts;
316
-                ob_start();
315
+				$field['shortcodes'] = $atts;
316
+				ob_start();
317 317
 				include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/input.php' );
318
-                $replace_with = ob_get_contents();
319
-                ob_end_clean();
320
-            } else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) {
321
-                $replace_with = FrmProEntriesController::entry_delete_link($atts);
322
-            }
318
+				$replace_with = ob_get_contents();
319
+				ob_end_clean();
320
+			} else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) {
321
+				$replace_with = FrmProEntriesController::entry_delete_link($atts);
322
+			}
323 323
 
324
-            $html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html );
325
-        }
324
+			$html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html );
325
+		}
326 326
 
327 327
 		if ( $form ) {
328
-            $form = (array) $form;
328
+			$form = (array) $form;
329 329
 
330
-            //replace [form_key]
331
-            $html = str_replace('[form_key]', $form['form_key'], $html);
330
+			//replace [form_key]
331
+			$html = str_replace('[form_key]', $form['form_key'], $html);
332 332
 
333
-            //replace [form_name]
334
-            $html = str_replace('[form_name]', $form['name'], $html);
335
-        }
336
-        $html .= "\n";
333
+			//replace [form_name]
334
+			$html = str_replace('[form_name]', $form['name'], $html);
335
+		}
336
+		$html .= "\n";
337 337
 
338
-        //Return html if conf_field to prevent loop
339
-        if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) {
340
-            return $html;
341
-        }
338
+		//Return html if conf_field to prevent loop
339
+		if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) {
340
+			return $html;
341
+		}
342 342
 
343
-        //If field is in repeating section
344
-        if ( $args['section_id'] ) {
345
-            $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'] ));
346
-        } else {
347
-            $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form ));
348
-        }
343
+		//If field is in repeating section
344
+		if ( $args['section_id'] ) {
345
+			$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'] ));
346
+		} else {
347
+			$html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form ));
348
+		}
349 349
 
350 350
 		self::remove_collapse_shortcode( $html );
351 351
 
@@ -353,18 +353,18 @@  discard block
 block discarded – undo
353 353
 			$html = do_shortcode( $html );
354 354
 		}
355 355
 
356
-        return $html;
357
-    }
356
+		return $html;
357
+	}
358 358
 
359 359
 	/**
360
-	* Add more classes to certain fields (like confirmation fields, other fields, repeating fields, etc.)
361
-	*
362
-	* @since 2.0
363
-	* @param $error_class string, pass by reference
364
-	* @param $field array
365
-	* @param $field_id int
366
-	* @param $html string
367
-	*/
360
+	 * Add more classes to certain fields (like confirmation fields, other fields, repeating fields, etc.)
361
+	 *
362
+	 * @since 2.0
363
+	 * @param $error_class string, pass by reference
364
+	 * @param $field array
365
+	 * @param $field_id int
366
+	 * @param $html string
367
+	 */
368 368
 	private static function get_more_field_classes( &$error_class, $field, $field_id, $html ) {
369 369
 		$error_class .= ' frm_' . $field['label'] . '_container';
370 370
 		if ( $field['id'] != $field_id ) {
@@ -428,46 +428,46 @@  discard block
 block discarded – undo
428 428
 		}
429 429
 	}
430 430
 
431
-    public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) {
432
-        if ( $no_vars ) {
431
+	public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) {
432
+		if ( $no_vars ) {
433 433
 			$html = str_replace( '[if ' . $code . ']', '', $html );
434 434
 			$html = str_replace( '[/if ' . $code . ']', '', $html );
435
-        } else {
435
+		} else {
436 436
 			$html = preg_replace( '/(\[if\s+' . $code . '\])(.*?)(\[\/if\s+' . $code . '\])/mis', '', $html );
437
-        }
437
+		}
438 438
 
439 439
 		$html = str_replace( '[' . $code . ']', $replace_with, $html );
440
-    }
440
+	}
441 441
 
442 442
 	public static function get_shortcode_tag( $shortcodes, $short_key, $args ) {
443 443
 		$args = wp_parse_args( $args, array( 'conditional' => false, 'conditional_check' => false, 'foreach' => false ) );
444
-        if ( ( $args['conditional'] || $args['foreach'] ) && ! $args['conditional_check'] ) {
445
-            $args['conditional_check'] = true;
446
-        }
447
-
448
-        $prefix = '';
449
-        if ( $args['conditional_check'] ) {
450
-            if ( $args['conditional'] ) {
451
-                $prefix = 'if ';
452
-            } else if ( $args['foreach'] ) {
453
-                $prefix = 'foreach ';
454
-            }
455
-        }
456
-
457
-        $with_tags = $args['conditional_check'] ? 3 : 2;
458
-        if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
459
-            $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
460
-            $tag = str_replace(']', '', $tag);
461
-            $tags = explode(' ', $tag);
462
-            if ( is_array($tags) ) {
463
-                $tag = $tags[0];
464
-            }
465
-        } else {
466
-            $tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
467
-        }
468
-
469
-        return $tag;
470
-    }
444
+		if ( ( $args['conditional'] || $args['foreach'] ) && ! $args['conditional_check'] ) {
445
+			$args['conditional_check'] = true;
446
+		}
447
+
448
+		$prefix = '';
449
+		if ( $args['conditional_check'] ) {
450
+			if ( $args['conditional'] ) {
451
+				$prefix = 'if ';
452
+			} else if ( $args['foreach'] ) {
453
+				$prefix = 'foreach ';
454
+			}
455
+		}
456
+
457
+		$with_tags = $args['conditional_check'] ? 3 : 2;
458
+		if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
459
+			$tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
460
+			$tag = str_replace(']', '', $tag);
461
+			$tags = explode(' ', $tag);
462
+			if ( is_array($tags) ) {
463
+				$tag = $tags[0];
464
+			}
465
+		} else {
466
+			$tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
467
+		}
468
+
469
+		return $tag;
470
+	}
471 471
 
472 472
 	/**
473 473
 	 * Remove [collapse_this] if it's still included after all processing
@@ -492,124 +492,124 @@  discard block
 block discarded – undo
492 492
 			$class_prefix = 'frm-';
493 493
 		}
494 494
 
495
-        if ( $lang != 'en' ) {
495
+		if ( $lang != 'en' ) {
496 496
 			$api_js_url .= '&hl=' . $lang;
497
-        }
497
+		}
498 498
 		$api_js_url = apply_filters( 'frm_recaptcha_js_url', $api_js_url );
499 499
 
500
-        wp_register_script( 'recaptcha-api', $api_js_url, '', true );
501
-        wp_enqueue_script( 'recaptcha-api' );
500
+		wp_register_script( 'recaptcha-api', $api_js_url, '', true );
501
+		wp_enqueue_script( 'recaptcha-api' );
502 502
 
503 503
 ?>
504 504
 <div id="field_<?php echo esc_attr( $field['field_key'] ) ?>" class="<?php echo esc_attr( $class_prefix ) ?>g-recaptcha" data-sitekey="<?php echo esc_attr( $frm_settings->pubkey ) ?>" data-size="<?php echo esc_attr( $field['captcha_size'] ) ?>" data-theme="<?php echo esc_attr( $field['captcha_theme'] ) ?>"></div>
505 505
 <?php
506
-    }
506
+	}
507 507
 
508 508
 	public static function show_single_option( $field ) {
509
-        $field_name = $field['name'];
510
-        $html_id = self::get_html_id($field);
511
-        foreach ( $field['options'] as $opt_key => $opt ) {
512
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
513
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
509
+		$field_name = $field['name'];
510
+		$html_id = self::get_html_id($field);
511
+		foreach ( $field['options'] as $opt_key => $opt ) {
512
+			$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
513
+			$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
514 514
 
515
-            // If this is an "Other" option, get the HTML for it
515
+			// If this is an "Other" option, get the HTML for it
516 516
 			if ( self::is_other_opt( $opt_key ) ) {
517
-                // Get string for Other text field, if needed
517
+				// Get string for Other text field, if needed
518 518
 				$other_val = self::get_other_val( compact( 'opt_key', 'field' ) );
519 519
 				require( FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/other-option.php' );
520
-            } else {
520
+			} else {
521 521
 				require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' );
522
-            }
523
-        }
524
-    }
522
+			}
523
+		}
524
+	}
525 525
 
526 526
 	public static function dropdown_categories( $args ) {
527 527
 		$defaults = array( 'field' => false, 'name' => false, 'show_option_all' => ' ' );
528
-        $args = wp_parse_args($args, $defaults);
528
+		$args = wp_parse_args($args, $defaults);
529 529
 
530
-        if ( ! $args['field'] ) {
531
-            return;
532
-        }
530
+		if ( ! $args['field'] ) {
531
+			return;
532
+		}
533 533
 
534
-        if ( ! $args['name'] ) {
534
+		if ( ! $args['name'] ) {
535 535
 			$args['name'] = 'item_meta[' . $args['field']['id'] . ']';
536
-        }
536
+		}
537 537
 
538
-        $id = self::get_html_id($args['field']);
539
-        $class = $args['field']['type'];
538
+		$id = self::get_html_id($args['field']);
539
+		$class = $args['field']['type'];
540 540
 
541
-        $exclude = (is_array($args['field']['exclude_cat'])) ? implode(',', $args['field']['exclude_cat']) : $args['field']['exclude_cat'];
542
-        $exclude = apply_filters('frm_exclude_cats', $exclude, $args['field']);
541
+		$exclude = (is_array($args['field']['exclude_cat'])) ? implode(',', $args['field']['exclude_cat']) : $args['field']['exclude_cat'];
542
+		$exclude = apply_filters('frm_exclude_cats', $exclude, $args['field']);
543 543
 
544
-        if ( is_array($args['field']['value']) ) {
545
-            if ( ! empty($exclude) ) {
546
-                $args['field']['value'] = array_diff($args['field']['value'], explode(',', $exclude));
547
-            }
548
-            $selected = reset($args['field']['value']);
549
-        } else {
550
-            $selected = $args['field']['value'];
551
-        }
544
+		if ( is_array($args['field']['value']) ) {
545
+			if ( ! empty($exclude) ) {
546
+				$args['field']['value'] = array_diff($args['field']['value'], explode(',', $exclude));
547
+			}
548
+			$selected = reset($args['field']['value']);
549
+		} else {
550
+			$selected = $args['field']['value'];
551
+		}
552 552
 
553
-        $tax_atts = array(
554
-            'show_option_all' => $args['show_option_all'], 'hierarchical' => 1, 'name' => $args['name'],
555
-            'id' => $id, 'exclude' => $exclude, 'class' => $class, 'selected' => $selected,
556
-            'hide_empty' => false, 'echo' => 0, 'orderby' => 'name',
557
-        );
553
+		$tax_atts = array(
554
+			'show_option_all' => $args['show_option_all'], 'hierarchical' => 1, 'name' => $args['name'],
555
+			'id' => $id, 'exclude' => $exclude, 'class' => $class, 'selected' => $selected,
556
+			'hide_empty' => false, 'echo' => 0, 'orderby' => 'name',
557
+		);
558 558
 
559
-        $tax_atts = apply_filters('frm_dropdown_cat', $tax_atts, $args['field']);
559
+		$tax_atts = apply_filters('frm_dropdown_cat', $tax_atts, $args['field']);
560 560
 
561
-        if ( FrmAppHelper::pro_is_installed() ) {
562
-            $post_type = FrmProFormsHelper::post_type($args['field']['form_id']);
563
-            $tax_atts['taxonomy'] = FrmProAppHelper::get_custom_taxonomy($post_type, $args['field']);
564
-            if ( ! $tax_atts['taxonomy'] ) {
565
-                return;
566
-            }
561
+		if ( FrmAppHelper::pro_is_installed() ) {
562
+			$post_type = FrmProFormsHelper::post_type($args['field']['form_id']);
563
+			$tax_atts['taxonomy'] = FrmProAppHelper::get_custom_taxonomy($post_type, $args['field']);
564
+			if ( ! $tax_atts['taxonomy'] ) {
565
+				return;
566
+			}
567 567
 
568
-            // If field type is dropdown (not Dynamic), exclude children when parent is excluded
569
-            if ( $args['field']['type'] != 'data' && is_taxonomy_hierarchical($tax_atts['taxonomy']) ) {
570
-                $tax_atts['exclude_tree'] = $exclude;
571
-            }
572
-        }
568
+			// If field type is dropdown (not Dynamic), exclude children when parent is excluded
569
+			if ( $args['field']['type'] != 'data' && is_taxonomy_hierarchical($tax_atts['taxonomy']) ) {
570
+				$tax_atts['exclude_tree'] = $exclude;
571
+			}
572
+		}
573 573
 
574
-        $dropdown = wp_dropdown_categories($tax_atts);
574
+		$dropdown = wp_dropdown_categories($tax_atts);
575 575
 
576
-        $add_html = FrmFieldsController::input_html($args['field'], false);
576
+		$add_html = FrmFieldsController::input_html($args['field'], false);
577 577
 
578
-        if ( FrmAppHelper::pro_is_installed() ) {
579
-            $add_html .= FrmProFieldsController::input_html($args['field'], false);
580
-        }
578
+		if ( FrmAppHelper::pro_is_installed() ) {
579
+			$add_html .= FrmProFieldsController::input_html($args['field'], false);
580
+		}
581 581
 
582 582
 		$dropdown = str_replace( "<select name='" . esc_attr( $args['name'] ) . "' id='" . esc_attr( $id ) . "' class='" . esc_attr( $class ) . "'", "<select name='" . esc_attr( $args['name'] ) . "' id='" . esc_attr( $id ) . "' " . $add_html, $dropdown );
583 583
 
584
-        if ( is_array($args['field']['value']) ) {
585
-            $skip = true;
586
-            foreach ( $args['field']['value'] as $v ) {
584
+		if ( is_array($args['field']['value']) ) {
585
+			$skip = true;
586
+			foreach ( $args['field']['value'] as $v ) {
587 587
 				if ( $skip ) {
588
-                    $skip = false;
589
-                    continue;
590
-                }
588
+					$skip = false;
589
+					continue;
590
+				}
591 591
 				$dropdown = str_replace(' value="' . esc_attr( $v ) . '"', ' value="' . esc_attr( $v ) . '" selected="selected"', $dropdown );
592
-                unset($v);
593
-            }
594
-        }
592
+				unset($v);
593
+			}
594
+		}
595 595
 
596
-        return $dropdown;
597
-    }
596
+		return $dropdown;
597
+	}
598 598
 
599 599
 	public static function get_term_link( $tax_id ) {
600
-        $tax = get_taxonomy($tax_id);
601
-        if ( ! $tax ) {
602
-            return;
603
-        }
600
+		$tax = get_taxonomy($tax_id);
601
+		if ( ! $tax ) {
602
+			return;
603
+		}
604 604
 
605
-        $link = sprintf(
606
-            __( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
605
+		$link = sprintf(
606
+			__( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
607 607
 			'<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>'
608
-        );
609
-        unset($tax);
608
+		);
609
+		unset($tax);
610 610
 
611
-        return $link;
612
-    }
611
+		return $link;
612
+	}
613 613
 
614 614
 	public static function value_meets_condition( $observed_value, $cond, $hide_opt ) {
615 615
 		// Remove white space from hide_opt
@@ -617,195 +617,195 @@  discard block
 block discarded – undo
617 617
 			$hide_opt = rtrim( $hide_opt );
618 618
 		}
619 619
 
620
-        if ( is_array($observed_value) ) {
621
-            return self::array_value_condition($observed_value, $cond, $hide_opt);
622
-        }
623
-
624
-        $m = false;
625
-        if ( $cond == '==' ) {
626
-            $m = $observed_value == $hide_opt;
627
-        } else if ( $cond == '!=' ) {
628
-            $m = $observed_value != $hide_opt;
629
-        } else if ( $cond == '>' ) {
630
-            $m = $observed_value > $hide_opt;
631
-        } else if ( $cond == '<' ) {
632
-            $m = $observed_value < $hide_opt;
633
-        } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
634
-            $m = stripos($observed_value, $hide_opt);
635
-            if ( $cond == 'not LIKE' ) {
636
-                $m = ( $m === false ) ? true : false;
637
-            } else {
638
-                $m = ( $m === false ) ? false : true;
639
-            }
640
-        }
641
-        return $m;
642
-    }
620
+		if ( is_array($observed_value) ) {
621
+			return self::array_value_condition($observed_value, $cond, $hide_opt);
622
+		}
623
+
624
+		$m = false;
625
+		if ( $cond == '==' ) {
626
+			$m = $observed_value == $hide_opt;
627
+		} else if ( $cond == '!=' ) {
628
+			$m = $observed_value != $hide_opt;
629
+		} else if ( $cond == '>' ) {
630
+			$m = $observed_value > $hide_opt;
631
+		} else if ( $cond == '<' ) {
632
+			$m = $observed_value < $hide_opt;
633
+		} else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
634
+			$m = stripos($observed_value, $hide_opt);
635
+			if ( $cond == 'not LIKE' ) {
636
+				$m = ( $m === false ) ? true : false;
637
+			} else {
638
+				$m = ( $m === false ) ? false : true;
639
+			}
640
+		}
641
+		return $m;
642
+	}
643 643
 
644 644
 	public static function array_value_condition( $observed_value, $cond, $hide_opt ) {
645
-        $m = false;
646
-        if ( $cond == '==' ) {
647
-            if ( is_array($hide_opt) ) {
648
-                $m = array_intersect($hide_opt, $observed_value);
649
-                $m = empty($m) ? false : true;
650
-            } else {
651
-                $m = in_array($hide_opt, $observed_value);
652
-            }
653
-        } else if ( $cond == '!=' ) {
654
-            $m = ! in_array($hide_opt, $observed_value);
655
-        } else if ( $cond == '>' ) {
656
-            $min = min($observed_value);
657
-            $m = $min > $hide_opt;
658
-        } else if ( $cond == '<' ) {
659
-            $max = max($observed_value);
660
-            $m = $max < $hide_opt;
661
-        } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
662
-            foreach ( $observed_value as $ob ) {
663
-                $m = strpos($ob, $hide_opt);
664
-                if ( $m !== false ) {
665
-                    $m = true;
666
-                    break;
667
-                }
668
-            }
669
-
670
-            if ( $cond == 'not LIKE' ) {
671
-                $m = ( $m === false ) ? true : false;
672
-            }
673
-        }
674
-
675
-        return $m;
676
-    }
677
-
678
-    /**
679
-     * Replace a few basic shortcodes and field ids
680
-     * @since 2.0
681
-     * @return string
682
-     */
645
+		$m = false;
646
+		if ( $cond == '==' ) {
647
+			if ( is_array($hide_opt) ) {
648
+				$m = array_intersect($hide_opt, $observed_value);
649
+				$m = empty($m) ? false : true;
650
+			} else {
651
+				$m = in_array($hide_opt, $observed_value);
652
+			}
653
+		} else if ( $cond == '!=' ) {
654
+			$m = ! in_array($hide_opt, $observed_value);
655
+		} else if ( $cond == '>' ) {
656
+			$min = min($observed_value);
657
+			$m = $min > $hide_opt;
658
+		} else if ( $cond == '<' ) {
659
+			$max = max($observed_value);
660
+			$m = $max < $hide_opt;
661
+		} else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
662
+			foreach ( $observed_value as $ob ) {
663
+				$m = strpos($ob, $hide_opt);
664
+				if ( $m !== false ) {
665
+					$m = true;
666
+					break;
667
+				}
668
+			}
669
+
670
+			if ( $cond == 'not LIKE' ) {
671
+				$m = ( $m === false ) ? true : false;
672
+			}
673
+		}
674
+
675
+		return $m;
676
+	}
677
+
678
+	/**
679
+	 * Replace a few basic shortcodes and field ids
680
+	 * @since 2.0
681
+	 * @return string
682
+	 */
683 683
 	public static function basic_replace_shortcodes( $value, $form, $entry ) {
684
-        if ( strpos($value, '[sitename]') !== false ) {
685
-            $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
686
-            $value = str_replace('[sitename]', $new_value, $value);
687
-        }
684
+		if ( strpos($value, '[sitename]') !== false ) {
685
+			$new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
686
+			$value = str_replace('[sitename]', $new_value, $value);
687
+		}
688 688
 
689
-        $value = apply_filters('frm_content', $value, $form, $entry);
690
-        $value = do_shortcode($value);
689
+		$value = apply_filters('frm_content', $value, $form, $entry);
690
+		$value = do_shortcode($value);
691 691
 
692
-        return $value;
693
-    }
692
+		return $value;
693
+	}
694 694
 
695 695
 	public static function get_shortcodes( $content, $form_id ) {
696
-        if ( FrmAppHelper::pro_is_installed() ) {
697
-            return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
698
-        }
696
+		if ( FrmAppHelper::pro_is_installed() ) {
697
+			return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
698
+		}
699 699
 
700
-        $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) );
700
+		$fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) );
701 701
 
702
-        $tagregexp = self::allowed_shortcodes($fields);
702
+		$tagregexp = self::allowed_shortcodes($fields);
703 703
 
704
-        preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
704
+		preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
705 705
 
706
-        return $matches;
707
-    }
706
+		return $matches;
707
+	}
708 708
 
709 709
 	public static function allowed_shortcodes( $fields = array() ) {
710
-        $tagregexp = array(
711
-            'editlink', 'id', 'key', 'ip',
712
-            'siteurl', 'sitename', 'admin_email',
713
-            'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by',
710
+		$tagregexp = array(
711
+			'editlink', 'id', 'key', 'ip',
712
+			'siteurl', 'sitename', 'admin_email',
713
+			'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by',
714 714
 			'parent[-|_]id',
715
-        );
715
+		);
716 716
 
717
-        foreach ( $fields as $field ) {
718
-            $tagregexp[] = $field->id;
719
-            $tagregexp[] = $field->field_key;
720
-        }
717
+		foreach ( $fields as $field ) {
718
+			$tagregexp[] = $field->id;
719
+			$tagregexp[] = $field->field_key;
720
+		}
721 721
 
722
-        $tagregexp = implode('|', $tagregexp);
723
-        return $tagregexp;
724
-    }
722
+		$tagregexp = implode('|', $tagregexp);
723
+		return $tagregexp;
724
+	}
725 725
 
726 726
 	public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
727
-        $shortcode_values = array(
728
-           'id'     => $entry->id,
729
-           'key'    => $entry->item_key,
730
-           'ip'     => $entry->ip,
731
-        );
727
+		$shortcode_values = array(
728
+		   'id'     => $entry->id,
729
+		   'key'    => $entry->item_key,
730
+		   'ip'     => $entry->ip,
731
+		);
732 732
 
733
-        foreach ( $shortcodes[0] as $short_key => $tag ) {
734
-            $atts = shortcode_parse_atts( $shortcodes[3][ $short_key ] );
733
+		foreach ( $shortcodes[0] as $short_key => $tag ) {
734
+			$atts = shortcode_parse_atts( $shortcodes[3][ $short_key ] );
735 735
 
736
-            if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
736
+			if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
737 737
 				$tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] );
738
-                $tags = explode(' ', $tag);
739
-                if ( is_array($tags) ) {
740
-                    $tag = $tags[0];
741
-                }
742
-            } else {
743
-                $tag = $shortcodes[2][ $short_key ];
744
-            }
745
-
746
-            switch ( $tag ) {
747
-                case 'id':
748
-                case 'key':
749
-                case 'ip':
750
-                    $replace_with = $shortcode_values[ $tag ];
751
-                break;
752
-
753
-                case 'user_agent':
754
-                case 'user-agent':
755
-                    $entry->description = maybe_unserialize($entry->description);
738
+				$tags = explode(' ', $tag);
739
+				if ( is_array($tags) ) {
740
+					$tag = $tags[0];
741
+				}
742
+			} else {
743
+				$tag = $shortcodes[2][ $short_key ];
744
+			}
745
+
746
+			switch ( $tag ) {
747
+				case 'id':
748
+				case 'key':
749
+				case 'ip':
750
+					$replace_with = $shortcode_values[ $tag ];
751
+				break;
752
+
753
+				case 'user_agent':
754
+				case 'user-agent':
755
+					$entry->description = maybe_unserialize($entry->description);
756 756
 					$replace_with = FrmEntryFormat::get_browser( $entry->description['browser'] );
757
-                break;
758
-
759
-                case 'created_at':
760
-                case 'created-at':
761
-                case 'updated_at':
762
-                case 'updated-at':
763
-                    if ( isset($atts['format']) ) {
764
-                        $time_format = ' ';
765
-                    } else {
766
-                        $atts['format'] = get_option('date_format');
767
-                        $time_format = '';
768
-                    }
769
-
770
-                    $this_tag = str_replace('-', '_', $tag);
771
-                    $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
772
-                    unset($this_tag);
773
-                break;
774
-
775
-                case 'created_by':
776
-                case 'created-by':
777
-                case 'updated_by':
778
-                case 'updated-by':
779
-                    $this_tag = str_replace('-', '_', $tag);
757
+				break;
758
+
759
+				case 'created_at':
760
+				case 'created-at':
761
+				case 'updated_at':
762
+				case 'updated-at':
763
+					if ( isset($atts['format']) ) {
764
+						$time_format = ' ';
765
+					} else {
766
+						$atts['format'] = get_option('date_format');
767
+						$time_format = '';
768
+					}
769
+
770
+					$this_tag = str_replace('-', '_', $tag);
771
+					$replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
772
+					unset($this_tag);
773
+				break;
774
+
775
+				case 'created_by':
776
+				case 'created-by':
777
+				case 'updated_by':
778
+				case 'updated-by':
779
+					$this_tag = str_replace('-', '_', $tag);
780 780
 					$replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts );
781
-                    unset($this_tag);
782
-                break;
783
-
784
-                case 'admin_email':
785
-                case 'siteurl':
786
-                case 'frmurl':
787
-                case 'sitename':
788
-                case 'get':
789
-                    $replace_with = self::dynamic_default_values( $tag, $atts );
790
-                break;
791
-
792
-                default:
793
-                    $field = FrmField::getOne( $tag );
794
-                    if ( ! $field ) {
795
-                        break;
796
-                    }
797
-
798
-                    $sep = isset($atts['sep']) ? $atts['sep'] : ', ';
799
-
800
-                    $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
801
-
802
-                    $atts['entry_id'] = $entry->id;
803
-                    $atts['entry_key'] = $entry->item_key;
804
-
805
-                    if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
806
-                        $replace_with = $field->name;
807
-                    } else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
808
-                        $replace_with = $field->description;
781
+					unset($this_tag);
782
+				break;
783
+
784
+				case 'admin_email':
785
+				case 'siteurl':
786
+				case 'frmurl':
787
+				case 'sitename':
788
+				case 'get':
789
+					$replace_with = self::dynamic_default_values( $tag, $atts );
790
+				break;
791
+
792
+				default:
793
+					$field = FrmField::getOne( $tag );
794
+					if ( ! $field ) {
795
+						break;
796
+					}
797
+
798
+					$sep = isset($atts['sep']) ? $atts['sep'] : ', ';
799
+
800
+					$replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
801
+
802
+					$atts['entry_id'] = $entry->id;
803
+					$atts['entry_key'] = $entry->item_key;
804
+
805
+					if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
806
+						$replace_with = $field->name;
807
+					} else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
808
+						$replace_with = $field->description;
809 809
 					} else {
810 810
 						$string_value = $replace_with;
811 811
 						if ( is_array( $replace_with ) ) {
@@ -819,82 +819,82 @@  discard block
 block discarded – undo
819 819
 						}
820 820
 					}
821 821
 
822
-                    unset($field);
823
-                break;
824
-            }
822
+					unset($field);
823
+				break;
824
+			}
825 825
 
826
-            if ( isset($replace_with) ) {
827
-                $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
828
-            }
826
+			if ( isset($replace_with) ) {
827
+				$content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
828
+			}
829 829
 
830
-            unset($atts, $conditional, $replace_with);
830
+			unset($atts, $conditional, $replace_with);
831 831
 		}
832 832
 
833 833
 		return $content;
834
-    }
835
-
836
-    /**
837
-     * Get the value to replace a few standard shortcodes
838
-     *
839
-     * @since 2.0
840
-     * @return string
841
-     */
842
-    public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) {
843
-        $new_value = '';
844
-        switch ( $tag ) {
845
-            case 'admin_email':
846
-                $new_value = get_option('admin_email');
847
-                break;
848
-            case 'siteurl':
849
-                $new_value = FrmAppHelper::site_url();
850
-                break;
851
-            case 'frmurl':
852
-                $new_value = FrmAppHelper::plugin_url();
853
-                break;
854
-            case 'sitename':
855
-                $new_value = FrmAppHelper::site_name();
856
-                break;
857
-            case 'get':
858
-                $new_value = self::process_get_shortcode( $atts, $return_array );
859
-                break;
860
-        }
861
-
862
-        return $new_value;
863
-    }
864
-
865
-    /**
866
-     * Process the [get] shortcode
867
-     *
868
-     * @since 2.0
869
-     * @return string|array
870
-     */
871
-    public static function process_get_shortcode( $atts, $return_array = false ) {
872
-        if ( ! isset($atts['param']) ) {
873
-            return '';
874
-        }
875
-
876
-        if ( strpos($atts['param'], '&#91;') ) {
877
-            $atts['param'] = str_replace('&#91;', '[', $atts['param']);
878
-            $atts['param'] = str_replace('&#93;', ']', $atts['param']);
879
-        }
880
-
881
-        $new_value = FrmAppHelper::get_param($atts['param'], '');
882
-        $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
883
-
884
-        if ( $new_value == '' ) {
885
-            if ( ! isset($atts['prev_val']) ) {
886
-                $atts['prev_val'] = '';
887
-            }
888
-
889
-            $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
890
-        }
891
-
892
-        if ( is_array($new_value) && ! $return_array ) {
893
-            $new_value = implode(', ', $new_value);
894
-        }
895
-
896
-        return $new_value;
897
-    }
834
+	}
835
+
836
+	/**
837
+	 * Get the value to replace a few standard shortcodes
838
+	 *
839
+	 * @since 2.0
840
+	 * @return string
841
+	 */
842
+	public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) {
843
+		$new_value = '';
844
+		switch ( $tag ) {
845
+			case 'admin_email':
846
+				$new_value = get_option('admin_email');
847
+				break;
848
+			case 'siteurl':
849
+				$new_value = FrmAppHelper::site_url();
850
+				break;
851
+			case 'frmurl':
852
+				$new_value = FrmAppHelper::plugin_url();
853
+				break;
854
+			case 'sitename':
855
+				$new_value = FrmAppHelper::site_name();
856
+				break;
857
+			case 'get':
858
+				$new_value = self::process_get_shortcode( $atts, $return_array );
859
+				break;
860
+		}
861
+
862
+		return $new_value;
863
+	}
864
+
865
+	/**
866
+	 * Process the [get] shortcode
867
+	 *
868
+	 * @since 2.0
869
+	 * @return string|array
870
+	 */
871
+	public static function process_get_shortcode( $atts, $return_array = false ) {
872
+		if ( ! isset($atts['param']) ) {
873
+			return '';
874
+		}
875
+
876
+		if ( strpos($atts['param'], '&#91;') ) {
877
+			$atts['param'] = str_replace('&#91;', '[', $atts['param']);
878
+			$atts['param'] = str_replace('&#93;', ']', $atts['param']);
879
+		}
880
+
881
+		$new_value = FrmAppHelper::get_param($atts['param'], '');
882
+		$new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
883
+
884
+		if ( $new_value == '' ) {
885
+			if ( ! isset($atts['prev_val']) ) {
886
+				$atts['prev_val'] = '';
887
+			}
888
+
889
+			$new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
890
+		}
891
+
892
+		if ( is_array($new_value) && ! $return_array ) {
893
+			$new_value = implode(', ', $new_value);
894
+		}
895
+
896
+		return $new_value;
897
+	}
898 898
 
899 899
 	public static function get_display_value( $replace_with, $field, $atts = array() ) {
900 900
 		$atts['sep'] = isset( $atts['sep'] ) ? $atts['sep'] : ', ';
@@ -902,14 +902,14 @@  discard block
 block discarded – undo
902 902
 		$replace_with = apply_filters( 'frm_get_' . $field->type . '_display_value', $replace_with, $field, $atts );
903 903
 		$replace_with = apply_filters( 'frm_get_display_value', $replace_with, $field, $atts );
904 904
 
905
-        if ( $field->type == 'textarea' || $field->type == 'rte' ) {
906
-            $autop = isset($atts['wpautop']) ? $atts['wpautop'] : true;
907
-            if ( apply_filters('frm_use_wpautop', $autop) ) {
908
-                if ( is_array($replace_with) ) {
909
-                    $replace_with = implode("\n", $replace_with);
910
-                }
911
-                $replace_with = wpautop($replace_with);
912
-            }
905
+		if ( $field->type == 'textarea' || $field->type == 'rte' ) {
906
+			$autop = isset($atts['wpautop']) ? $atts['wpautop'] : true;
907
+			if ( apply_filters('frm_use_wpautop', $autop) ) {
908
+				if ( is_array($replace_with) ) {
909
+					$replace_with = implode("\n", $replace_with);
910
+				}
911
+				$replace_with = wpautop($replace_with);
912
+			}
913 913
 			unset( $autop );
914 914
 		} else if ( is_array( $replace_with ) ) {
915 915
 			$replace_with = implode( $atts['sep'], $replace_with );
@@ -919,58 +919,58 @@  discard block
 block discarded – undo
919 919
 	}
920 920
 
921 921
 	public static function get_field_types( $type ) {
922
-        $single_input = array(
923
-            'text', 'textarea', 'rte', 'number', 'email', 'url',
924
-            'image', 'file', 'date', 'phone', 'hidden', 'time',
925
-            'user_id', 'tag', 'password',
926
-        );
922
+		$single_input = array(
923
+			'text', 'textarea', 'rte', 'number', 'email', 'url',
924
+			'image', 'file', 'date', 'phone', 'hidden', 'time',
925
+			'user_id', 'tag', 'password',
926
+		);
927 927
 		$multiple_input = array( 'radio', 'checkbox', 'select', 'scale', 'lookup' );
928 928
 		$other_type = array( 'divider', 'html', 'break' );
929 929
 
930 930
 		$field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() );
931 931
 
932
-        $field_types = array();
933
-        if ( in_array($type, $single_input) ) {
934
-            self::field_types_for_input( $single_input, $field_selection, $field_types );
935
-        } else if ( in_array($type, $multiple_input) ) {
936
-            self::field_types_for_input( $multiple_input, $field_selection, $field_types );
937
-        } else if ( in_array($type, $other_type) ) {
938
-            self::field_types_for_input( $other_type, $field_selection, $field_types );
932
+		$field_types = array();
933
+		if ( in_array($type, $single_input) ) {
934
+			self::field_types_for_input( $single_input, $field_selection, $field_types );
935
+		} else if ( in_array($type, $multiple_input) ) {
936
+			self::field_types_for_input( $multiple_input, $field_selection, $field_types );
937
+		} else if ( in_array($type, $other_type) ) {
938
+			self::field_types_for_input( $other_type, $field_selection, $field_types );
939 939
 		} else if ( isset( $field_selection[ $type ] ) ) {
940
-            $field_types[ $type ] = $field_selection[ $type ];
941
-        }
940
+			$field_types[ $type ] = $field_selection[ $type ];
941
+		}
942 942
 
943 943
 		$field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) );
944
-        return $field_types;
945
-    }
946
-
947
-    private static function field_types_for_input( $inputs, $fields, &$field_types ) {
948
-        foreach ( $inputs as $input ) {
949
-            $field_types[ $input ] = $fields[ $input ];
950
-            unset($input);
951
-        }
952
-    }
953
-
954
-    /**
955
-    * Check if current field option is an "other" option
956
-    *
957
-    * @since 2.0.6
958
-    *
959
-    * @param string $opt_key
960
-    * @return boolean Returns true if current field option is an "Other" option
961
-    */
962
-    public static function is_other_opt( $opt_key ) {
963
-        return $opt_key && strpos( $opt_key, 'other' ) !== false;
964
-    }
965
-
966
-    /**
967
-    * Get value that belongs in "Other" text box
968
-    *
969
-    * @since 2.0.6
970
-    *
971
-    * @param array $args
972
-    */
973
-    public static function get_other_val( $args ) {
944
+		return $field_types;
945
+	}
946
+
947
+	private static function field_types_for_input( $inputs, $fields, &$field_types ) {
948
+		foreach ( $inputs as $input ) {
949
+			$field_types[ $input ] = $fields[ $input ];
950
+			unset($input);
951
+		}
952
+	}
953
+
954
+	/**
955
+	 * Check if current field option is an "other" option
956
+	 *
957
+	 * @since 2.0.6
958
+	 *
959
+	 * @param string $opt_key
960
+	 * @return boolean Returns true if current field option is an "Other" option
961
+	 */
962
+	public static function is_other_opt( $opt_key ) {
963
+		return $opt_key && strpos( $opt_key, 'other' ) !== false;
964
+	}
965
+
966
+	/**
967
+	 * Get value that belongs in "Other" text box
968
+	 *
969
+	 * @since 2.0.6
970
+	 *
971
+	 * @param array $args
972
+	 */
973
+	public static function get_other_val( $args ) {
974 974
 		$defaults = array(
975 975
 			'opt_key' => 0, 'field' => array(),
976 976
 			'parent' => false, 'pointer' => false,
@@ -1046,20 +1046,20 @@  discard block
 block discarded – undo
1046 1046
 		}
1047 1047
 
1048 1048
 		return $other_val;
1049
-    }
1050
-
1051
-    /**
1052
-    * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
1053
-    * Intended for front-end use
1054
-    *
1055
-    * @since 2.0.6
1056
-    *
1057
-    * @param array $args should include field, opt_key and field name
1058
-    * @param boolean $other_opt
1059
-    * @param string $checked
1060
-    * @return string $other_val
1061
-    */
1062
-    public static function prepare_other_input( $args, &$other_opt, &$checked ) {
1049
+	}
1050
+
1051
+	/**
1052
+	 * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
1053
+	 * Intended for front-end use
1054
+	 *
1055
+	 * @since 2.0.6
1056
+	 *
1057
+	 * @param array $args should include field, opt_key and field name
1058
+	 * @param boolean $other_opt
1059
+	 * @param string $checked
1060
+	 * @return string $other_val
1061
+	 */
1062
+	public static function prepare_other_input( $args, &$other_opt, &$checked ) {
1063 1063
 		//Check if this is an "Other" option
1064 1064
 		if ( ! self::is_other_opt( $args['opt_key'] ) ) {
1065 1065
 			return;
@@ -1075,8 +1075,8 @@  discard block
 block discarded – undo
1075 1075
 			$checked = 'checked="checked" ';
1076 1076
 		}
1077 1077
 
1078
-        return $other_args;
1079
-    }
1078
+		return $other_args;
1079
+	}
1080 1080
 
1081 1081
 	/**
1082 1082
 	 * @param array $args
@@ -1125,8 +1125,8 @@  discard block
 block discarded – undo
1125 1125
 	 * @since 2.0.6
1126 1126
 	 */
1127 1127
 	public static function include_other_input( $args ) {
1128
-        if ( ! $args['other_opt'] ) {
1129
-        	return;
1128
+		if ( ! $args['other_opt'] ) {
1129
+			return;
1130 1130
 		}
1131 1131
 
1132 1132
 		$classes = array( 'frm_other_input' );
@@ -1147,15 +1147,15 @@  discard block
 block discarded – undo
1147 1147
 	}
1148 1148
 
1149 1149
 	/**
1150
-	* Get the HTML id for an "Other" text field
1151
-	* Note: This does not affect fields in repeating sections
1152
-	*
1153
-	* @since 2.0.08
1154
-	* @param string $type - field type
1155
-	* @param string $html_id
1156
-	* @param string|boolean $opt_key
1157
-	* @return string $other_id
1158
-	*/
1150
+	 * Get the HTML id for an "Other" text field
1151
+	 * Note: This does not affect fields in repeating sections
1152
+	 *
1153
+	 * @since 2.0.08
1154
+	 * @param string $type - field type
1155
+	 * @param string $html_id
1156
+	 * @param string|boolean $opt_key
1157
+	 * @return string $other_id
1158
+	 */
1159 1159
 	public static function get_other_field_html_id( $type, $html_id, $opt_key = false ) {
1160 1160
 		$other_id = $html_id;
1161 1161
 
@@ -1213,10 +1213,10 @@  discard block
 block discarded – undo
1213 1213
 	}
1214 1214
 
1215 1215
 	public static function switch_field_ids( $val ) {
1216
-        global $frm_duplicate_ids;
1217
-        $replace = array();
1218
-        $replace_with = array();
1219
-        foreach ( (array) $frm_duplicate_ids as $old => $new ) {
1216
+		global $frm_duplicate_ids;
1217
+		$replace = array();
1218
+		$replace_with = array();
1219
+		foreach ( (array) $frm_duplicate_ids as $old => $new ) {
1220 1220
 			$replace[] = '[if ' . $old . ']';
1221 1221
 			$replace_with[] = '[if ' . $new . ']';
1222 1222
 			$replace[] = '[if ' . $old . ' ';
@@ -1231,153 +1231,153 @@  discard block
 block discarded – undo
1231 1231
 			$replace_with[] = '[' . $new . ']';
1232 1232
 			$replace[] = '[' . $old . ' ';
1233 1233
 			$replace_with[] = '[' . $new . ' ';
1234
-            unset($old, $new);
1235
-        }
1234
+			unset($old, $new);
1235
+		}
1236 1236
 		if ( is_array( $val ) ) {
1237 1237
 			foreach ( $val as $k => $v ) {
1238
-                $val[ $k ] = str_replace( $replace, $replace_with, $v );
1239
-                unset($k, $v);
1240
-            }
1241
-        } else {
1242
-            $val = str_replace($replace, $replace_with, $val);
1243
-        }
1244
-
1245
-        return $val;
1246
-    }
1247
-
1248
-    public static function get_us_states() {
1249
-        return apply_filters( 'frm_us_states', array(
1250
-            'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona',
1251
-            'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware',
1252
-            'DC' => 'District of Columbia',
1253
-            'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho',
1254
-            'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas',
1255
-            'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland',
1256
-            'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi',
1257
-            'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada',
1258
-            'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York',
1259
-            'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma',
1260
-            'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina',
1261
-            'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah',
1262
-            'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia',
1263
-            'WI' => 'Wisconsin', 'WY' => 'Wyoming',
1264
-        ) );
1265
-    }
1266
-
1267
-    public static function get_countries() {
1268
-        return apply_filters( 'frm_countries', array(
1269
-            __( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ),
1270
-            __( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ),
1271
-            __( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ),
1272
-            __( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ),
1273
-            __( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ),
1274
-            __( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ),
1275
-            __( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ),
1276
-            __( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ),
1277
-            __( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ),
1278
-            __( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ),
1279
-            __( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ),
1280
-            __( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ),
1281
-            __( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ),
1282
-            __( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ),
1283
-            __( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ),
1284
-            __( 'Costa Rica', 'formidable' ), __( 'C&ocirc;te d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ),
1285
-            __( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ),
1286
-            __( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ),
1287
-            __( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ),
1288
-            __( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ),
1289
-            __( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ),
1290
-            __( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ),
1291
-            __( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ),
1292
-            __( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ),
1293
-            __( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ),
1294
-            __( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ),
1295
-            __( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ),
1296
-            __( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ),
1297
-            __( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ),
1298
-            __( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ),
1299
-            __( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ),
1300
-            __( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ),
1301
-            __( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ),
1302
-            __( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ),
1303
-            __( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ),
1304
-            __( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ),
1305
-            __( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ),
1306
-            __( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ),
1307
-            __( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ),
1308
-            __( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ),
1309
-            __( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ),
1310
-            __( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ),
1311
-            __( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ),
1312
-            __( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ),
1313
-            __( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ),
1314
-            __( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ),
1315
-            __( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ),
1316
-            __( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ),
1317
-            __( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ),
1318
-            __( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ),
1319
-            __( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ),
1320
-            __( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ),
1321
-            __( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ),
1322
-            __( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ),
1323
-            __( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ),
1324
-            __( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ),
1325
-            __( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ),
1326
-            __( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ),
1327
-            __( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ),
1328
-            __( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ),
1329
-            __( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ),
1330
-            __( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ),
1331
-            __( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ),
1332
-            __( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ),
1333
-            __( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ),
1334
-            __( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ),
1335
-            __( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ),
1336
-            __( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ),
1337
-            __( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ),
1338
-            __( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ),
1339
-            __( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ),
1340
-            __( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ),
1341
-            __( 'Zimbabwe', 'formidable' ),
1342
-        ) );
1343
-    }
1238
+				$val[ $k ] = str_replace( $replace, $replace_with, $v );
1239
+				unset($k, $v);
1240
+			}
1241
+		} else {
1242
+			$val = str_replace($replace, $replace_with, $val);
1243
+		}
1244
+
1245
+		return $val;
1246
+	}
1247
+
1248
+	public static function get_us_states() {
1249
+		return apply_filters( 'frm_us_states', array(
1250
+			'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona',
1251
+			'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware',
1252
+			'DC' => 'District of Columbia',
1253
+			'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho',
1254
+			'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas',
1255
+			'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland',
1256
+			'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi',
1257
+			'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada',
1258
+			'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York',
1259
+			'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma',
1260
+			'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina',
1261
+			'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah',
1262
+			'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia',
1263
+			'WI' => 'Wisconsin', 'WY' => 'Wyoming',
1264
+		) );
1265
+	}
1266
+
1267
+	public static function get_countries() {
1268
+		return apply_filters( 'frm_countries', array(
1269
+			__( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ),
1270
+			__( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ),
1271
+			__( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ),
1272
+			__( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ),
1273
+			__( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ),
1274
+			__( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ),
1275
+			__( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ),
1276
+			__( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ),
1277
+			__( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ),
1278
+			__( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ),
1279
+			__( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ),
1280
+			__( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ),
1281
+			__( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ),
1282
+			__( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ),
1283
+			__( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ),
1284
+			__( 'Costa Rica', 'formidable' ), __( 'C&ocirc;te d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ),
1285
+			__( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ),
1286
+			__( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ),
1287
+			__( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ),
1288
+			__( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ),
1289
+			__( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ),
1290
+			__( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ),
1291
+			__( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ),
1292
+			__( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ),
1293
+			__( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ),
1294
+			__( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ),
1295
+			__( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ),
1296
+			__( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ),
1297
+			__( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ),
1298
+			__( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ),
1299
+			__( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ),
1300
+			__( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ),
1301
+			__( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ),
1302
+			__( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ),
1303
+			__( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ),
1304
+			__( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ),
1305
+			__( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ),
1306
+			__( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ),
1307
+			__( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ),
1308
+			__( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ),
1309
+			__( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ),
1310
+			__( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ),
1311
+			__( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ),
1312
+			__( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ),
1313
+			__( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ),
1314
+			__( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ),
1315
+			__( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ),
1316
+			__( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ),
1317
+			__( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ),
1318
+			__( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ),
1319
+			__( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ),
1320
+			__( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ),
1321
+			__( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ),
1322
+			__( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ),
1323
+			__( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ),
1324
+			__( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ),
1325
+			__( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ),
1326
+			__( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ),
1327
+			__( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ),
1328
+			__( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ),
1329
+			__( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ),
1330
+			__( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ),
1331
+			__( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ),
1332
+			__( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ),
1333
+			__( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ),
1334
+			__( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ),
1335
+			__( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ),
1336
+			__( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ),
1337
+			__( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ),
1338
+			__( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ),
1339
+			__( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ),
1340
+			__( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ),
1341
+			__( 'Zimbabwe', 'formidable' ),
1342
+		) );
1343
+	}
1344 1344
 
1345 1345
 	public static function get_bulk_prefilled_opts( array &$prepop ) {
1346 1346
 		$prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries();
1347 1347
 
1348
-        $states = FrmFieldsHelper::get_us_states();
1349
-        $state_abv = array_keys($states);
1350
-        sort($state_abv);
1348
+		$states = FrmFieldsHelper::get_us_states();
1349
+		$state_abv = array_keys($states);
1350
+		sort($state_abv);
1351 1351
 		$prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
1352 1352
 
1353
-        $states = array_values($states);
1354
-        sort($states);
1353
+		$states = array_values($states);
1354
+		sort($states);
1355 1355
 		$prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
1356
-        unset($state_abv, $states);
1356
+		unset($state_abv, $states);
1357 1357
 
1358 1358
 		$prepop[ __( 'Age', 'formidable' ) ] = array(
1359
-            __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ),
1360
-            __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ),
1361
-            __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ),
1362
-        );
1359
+			__( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ),
1360
+			__( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ),
1361
+			__( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ),
1362
+		);
1363 1363
 
1364 1364
 		$prepop[ __( 'Satisfaction', 'formidable' ) ] = array(
1365
-            __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ),
1366
-            __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ),
1367
-        );
1365
+			__( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ),
1366
+			__( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ),
1367
+		);
1368 1368
 
1369 1369
 		$prepop[ __( 'Importance', 'formidable' ) ] = array(
1370
-            __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ),
1371
-            __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ),
1372
-        );
1370
+			__( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ),
1371
+			__( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ),
1372
+		);
1373 1373
 
1374 1374
 		$prepop[ __( 'Agreement', 'formidable' ) ] = array(
1375
-            __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ),
1376
-            __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ),
1377
-        );
1375
+			__( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ),
1376
+			__( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ),
1377
+		);
1378 1378
 
1379 1379
 		$prepop = apply_filters( 'frm_bulk_field_choices', $prepop );
1380
-    }
1380
+	}
1381 1381
 
1382 1382
 	public static function field_selection() {
1383 1383
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmField::field_selection' );
@@ -1414,8 +1414,8 @@  discard block
 block discarded – undo
1414 1414
 		return FrmField::is_required( $field );
1415 1415
 	}
1416 1416
 
1417
-    public static function maybe_get_field( &$field ) {
1417
+	public static function maybe_get_field( &$field ) {
1418 1418
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmField::maybe_get_field' );
1419 1419
 		FrmField::maybe_get_field( $field );
1420
-    }
1420
+	}
1421 1421
 }
Please login to merge, or discard this patch.
classes/views/back-end-field-opts/pixels-wide.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 	<td>
4 4
 		<input type="text" name="field_options[size_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['size'] ); ?>" size="5" /> <span class="howto"><?php _e( 'pixels wide', 'formidable' ) ?></span><?php
5 5
 		if ( $display_max ) {
6
-			include( FrmAppHelper::plugin_path() .'/classes/views/back-end-field-opts/max.php' );
6
+			include( FrmAppHelper::plugin_path() . '/classes/views/back-end-field-opts/max.php' );
7 7
 		}
8 8
 	?></td>
9 9
 </tr>
10 10
\ No newline at end of file
Please login to merge, or discard this patch.
classes/views/frm-forms/add_field.php 2 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $display = apply_filters('frm_display_field_options', array(
4
-    'type' => $field['type'], 'field_data' => $field,
5
-    'required' => true, 'unique' => false, 'read_only' => false,
6
-    'description' => true, 'options' => true, 'label_position' => true,
7
-    'invalid' => false, 'size' => false, 'clear_on_focus' => false,
8
-    'default_blank' => true, 'css' => true, 'conf_field' => false,
4
+	'type' => $field['type'], 'field_data' => $field,
5
+	'required' => true, 'unique' => false, 'read_only' => false,
6
+	'description' => true, 'options' => true, 'label_position' => true,
7
+	'invalid' => false, 'size' => false, 'clear_on_focus' => false,
8
+	'default_blank' => true, 'css' => true, 'conf_field' => false,
9 9
 	'max' => true, 'captcha_size' => false,
10 10
 ));
11 11
 
@@ -25,19 +25,19 @@  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);
30
-    } else {
28
+	if ( isset($frm_field_selection) && isset($pro_field_selection) ) {
29
+		$frm_all_field_selection = array_merge($frm_field_selection, $pro_field_selection);
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 );
33
-    }
33
+	}
34 34
 }
35 35
 
36 36
 $disabled_fields = FrmAppHelper::pro_is_installed() ? array() : $pro_field_selection;
37 37
 
38 38
 
39 39
 if ( ! isset( $ajax ) ) {
40
-    $li_classes .= ' ui-state-default widgets-holder-wrap'; ?>
40
+	$li_classes .= ' ui-state-default widgets-holder-wrap'; ?>
41 41
 <li id="frm_field_id_<?php echo esc_attr( $field['id'] ); ?>" class="<?php echo esc_attr( $li_classes ) ?>" data-fid="<?php echo esc_attr( $field['id'] ) ?>" data-formid="<?php echo ( 'divider' == $field['type'] ) ? esc_attr( $field['form_select'] ) : esc_attr( $field['form_id'] ); ?>">
42 42
 <?php
43 43
 }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     </span>
60 60
     <?php }
61 61
 
62
-    ?>
62
+	?>
63 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
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 if ( in_array( $field['type'], array( 'select', 'radio', 'checkbox' ) ) ) { ?>
106 106
     <div class="frm-show-click frm_small_top_margin"><?php
107 107
 
108
-    if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
108
+	if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
109 109
 		echo '<p class="howto">' . FrmFieldsHelper::get_term_link( $field['taxonomy'] ) . '</p>';
110 110
 	} else if ( ! isset( $field['post_field'] ) || ! in_array( $field['post_field'], array( 'post_category' ) ) ) {
111 111
 ?>
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
 				<a href="javascript:void(0);" id="other_button_<?php echo esc_attr( $field['id'] ); ?>" data-opttype="other" data-ftype="<?php echo esc_attr( $field['type'] ) ?>" class="button frm_cb_button frm_add_opt<?php echo ( in_array( $field['type'], array( 'radio', 'select' ) ) && $field['other'] == true ? ' frm_hidden' : '' ); ?>"><?php _e( 'Add "Other"', 'formidable' ) ?></a>
118 118
                 <input type="hidden" value="<?php echo esc_attr( $field['other'] ); ?>" id="other_input_<?php echo esc_attr( $field['id'] ); ?>" name="field_options[other_<?php echo esc_attr( $field['id'] ); ?>]">
119 119
             <?php
120
-            }
120
+			}
121 121
 
122
-            if ( ! isset($field['post_field']) || $field['post_field'] != 'post_category' ) { ?>
122
+			if ( ! isset($field['post_field']) || $field['post_field'] != 'post_category' ) { ?>
123 123
 			<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">
124 124
 				<?php _e( 'Bulk Edit Options', 'formidable' ) ?>
125 125
 			</a>
126 126
             <?php } ?>
127 127
         </div>
128 128
 <?php
129
-    }
129
+	}
130 130
 ?>
131 131
     </div>
132 132
 <?php
@@ -158,28 +158,28 @@  discard block
 block discarded – undo
158 158
 				if ( $display['required'] ) { ?>
159 159
                     <label for="frm_req_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label"><input type="checkbox" id="frm_req_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_req_field" name="field_options[required_<?php echo esc_attr( $field['id'] ) ?>]" value="1" <?php echo $field['required'] ? 'checked="checked"': ''; ?> /> <?php _e( 'Required', 'formidable' ) ?></label>
160 160
                 <?php
161
-                }
161
+				}
162 162
 
163 163
 				if ( $display['unique'] ) {
164
-                    if ( ! isset( $field['unique'] ) ) {
165
-                        $field['unique'] = false;
166
-                    }
167
-                ?>
164
+					if ( ! isset( $field['unique'] ) ) {
165
+						$field['unique'] = false;
166
+					}
167
+				?>
168 168
                 <label for="frm_uniq_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label frm_help" title="<?php esc_attr_e( 'Unique: Do not allow the same response multiple times. For example, if one user enters \'Joe\', then no one else will be allowed to enter the same name.', 'formidable' ) ?>"><input type="checkbox" name="field_options[unique_<?php echo esc_attr( $field['id'] ) ?>]" id="frm_uniq_field_<?php echo esc_attr( $field['id'] ) ?>" value="1" <?php checked( $field['unique'], 1 ); ?> class="frm_mark_unique" /> <?php _e( 'Unique', 'formidable' ) ?></label>
169 169
                 <?php
170
-                }
170
+				}
171 171
 
172 172
 				if ( $display['read_only'] ) {
173
-                    if ( ! isset( $field['read_only'] ) ) {
174
-                        $field['read_only'] = false;
173
+					if ( ! isset( $field['read_only'] ) ) {
174
+						$field['read_only'] = false;
175 175
 					}
176
-                ?>
176
+				?>
177 177
                 <label for="frm_read_only_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label frm_help" title="<?php esc_attr_e( 'Read Only: Show this field but do not allow the field value to be edited from the front-end.', 'formidable' ) ?>" ><input type="checkbox" id="frm_read_only_field_<?php echo esc_attr( $field['id'] ) ?>" name="field_options[read_only_<?php echo esc_attr( $field['id'] ) ?>]" value="1" <?php echo $field['read_only'] ? ' checked="checked"' : ''; ?>/> <?php _e( 'Read Only', 'formidable' ) ?></label>
178 178
                 <?php }
179 179
 
180
-                do_action('frm_field_options_form_top', $field, $display, $values);
180
+				do_action('frm_field_options_form_top', $field, $display, $values);
181 181
 
182
-                ?>
182
+				?>
183 183
                 <?php
184 184
 				if ( $display['required'] ) { ?>
185 185
                 <div class="frm_required_details<?php echo esc_attr( $field['id'] . ( $field['required'] ? '' : ' frm_hidden' ) ); ?>">
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 				do_action( 'frm_' . $field['type'] . '_field_options_form', $field, $display, $values );
266 266
 				do_action( 'frm_field_options_form', $field, $display, $values );
267 267
 
268
-                if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?>
268
+				if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?>
269 269
 					<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'; ?>">
270 270
 					<td colspan="2">
271 271
                     <div class="menu-settings">
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
                             <input type="text" name="field_options[blank_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['blank'] ); ?>" />
279 279
                         </p>
280 280
                         <?php
281
-                        }
281
+						}
282 282
 
283 283
 						if ( $display['invalid'] ) { ?>
284 284
                             <p><label><?php _e( 'Invalid Format', 'formidable' ) ?></label>
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
                             <input type="text" name="field_options[unique_msg_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['unique_msg'] ); ?>" />
294 294
                         </p>
295 295
                         <?php
296
-                        }
296
+						}
297 297
 
298 298
 						if ( $display['conf_field'] ) { ?>
299 299
                         <p class="frm_conf_details<?php echo esc_attr( $field['id'] . ( $field['conf_field'] ? '' : ' frm_hidden' ) ); ?>">
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
                             <input type="text" name="field_options[conf_msg_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_msg'] ); ?>" />
302 302
                         </p>
303 303
                         <?php
304
-                        } ?>
304
+						} ?>
305 305
                     </div>
306 306
                     </div>
307 307
                     </td>
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 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 } ?>
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
 <div id="frm_conf_field_<?php echo esc_attr( $field['id'] ) ?>_container" class="frm_conf_field_container frm_form_fields frm_conf_details<?php echo esc_attr( $field['id'] . ( $field['conf_field'] ? '' : ' frm_hidden' ) ); ?>">
89 89
     <div id="frm_conf_field_<?php echo esc_attr( $field['id'] ) ?>_inner_container" class="frm_inner_conf_container">
90 90
 		<div class="frm_form_fields">
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'] ); ?>" <?php do_action('frm_field_input_html', $field) ?> />
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'] ); ?>" <?php do_action( 'frm_field_input_html', $field ) ?> />
92 92
 		</div>
93
-    	<div class="frm_ipe_field_conf_desc description <?php echo ($field['conf_desc'] == '') ? 'frm-show-click' : '' ?>"><?php echo ($field['conf_desc'] == '') ? __( '(Click to add description)', 'formidable' ) : force_balance_tags($field['conf_desc']); ?></div>
93
+    	<div class="frm_ipe_field_conf_desc description <?php echo ( $field['conf_desc'] == '' ) ? 'frm-show-click' : '' ?>"><?php echo ( $field['conf_desc'] == '' ) ? __( '(Click to add description)', 'formidable' ) : force_balance_tags( $field['conf_desc'] ); ?></div>
94 94
     	<input type="hidden" name="field_options[conf_desc_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_desc'] ); ?>" />
95 95
 </div>
96 96
 	<?php if ( $display['clear_on_focus'] ) { ?>
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 if ( in_array( $field['type'], array( 'select', 'radio', 'checkbox' ) ) ) { ?>
106 106
     <div class="frm-show-click frm_small_top_margin"><?php
107 107
 
108
-    if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
108
+    if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) {
109 109
 		echo '<p class="howto">' . FrmFieldsHelper::get_term_link( $field['taxonomy'] ) . '</p>';
110 110
 	} else if ( ! isset( $field['post_field'] ) || ! in_array( $field['post_field'], array( 'post_category' ) ) ) {
111 111
 ?>
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
             <?php
120 120
             }
121 121
 
122
-            if ( ! isset($field['post_field']) || $field['post_field'] != 'post_category' ) { ?>
122
+            if ( ! isset( $field['post_field'] ) || $field['post_field'] != 'post_category' ) { ?>
123 123
 			<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">
124 124
 				<?php _e( 'Bulk Edit Options', 'formidable' ) ?>
125 125
 			</a>
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 <?php
133 133
 }
134 134
 
135
-do_action('frm_before_field_options', $field);
135
+do_action( 'frm_before_field_options', $field );
136 136
 
137 137
 if ( $display['options'] ) { ?>
138 138
     <div class="widget">
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
         </div>
143 143
     	<div class="widget-inside">
144 144
             <table class="form-table frm_clear_none">
145
-                <?php $field_types = FrmFieldsHelper::get_field_types($field['type']); ?>
145
+                <?php $field_types = FrmFieldsHelper::get_field_types( $field['type'] ); ?>
146 146
 				<tr><td class="frm_150_width"><label><?php _e( 'Field Type', 'formidable' ) ?></label></td>
147 147
                     <td>
148
-                <select <?php if ( count($field_types) == 1 ) { ?>disabled="disabled"<?php } else { ?>name="field_options[type_<?php echo esc_attr( $field['id'] ) ?>]"<?php } ?>>
148
+                <select <?php if ( count( $field_types ) == 1 ) { ?>disabled="disabled"<?php } else { ?>name="field_options[type_<?php echo esc_attr( $field['id'] ) ?>]"<?php } ?>>
149 149
                     <?php
150 150
 					foreach ( $field_types as $fkey => $ftype ) { ?>
151
-                        <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>
151
+                        <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 152
                     <?php
153 153
 						unset( $fkey, $ftype );
154 154
 					} ?>
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
                 <?php
158 158
 				if ( $display['required'] ) { ?>
159
-                    <label for="frm_req_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label"><input type="checkbox" id="frm_req_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_req_field" name="field_options[required_<?php echo esc_attr( $field['id'] ) ?>]" value="1" <?php echo $field['required'] ? 'checked="checked"': ''; ?> /> <?php _e( 'Required', 'formidable' ) ?></label>
159
+                    <label for="frm_req_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label"><input type="checkbox" id="frm_req_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_req_field" name="field_options[required_<?php echo esc_attr( $field['id'] ) ?>]" value="1" <?php echo $field['required'] ? 'checked="checked"' : ''; ?> /> <?php _e( 'Required', 'formidable' ) ?></label>
160 160
                 <?php
161 161
                 }
162 162
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
                 <label for="frm_read_only_field_<?php echo esc_attr( $field['id'] ) ?>" class="frm_inline_label frm_help" title="<?php esc_attr_e( 'Read Only: Show this field but do not allow the field value to be edited from the front-end.', 'formidable' ) ?>" ><input type="checkbox" id="frm_read_only_field_<?php echo esc_attr( $field['id'] ) ?>" name="field_options[read_only_<?php echo esc_attr( $field['id'] ) ?>]" value="1" <?php echo $field['read_only'] ? ' checked="checked"' : ''; ?>/> <?php _e( 'Read Only', 'formidable' ) ?></label>
178 178
                 <?php }
179 179
 
180
-                do_action('frm_field_options_form_top', $field, $display, $values);
180
+                do_action( 'frm_field_options_form_top', $field, $display, $values );
181 181
 
182 182
                 ?>
183 183
                 <?php
@@ -214,13 +214,13 @@  discard block
 block discarded – undo
214 214
 				if ( $display['label_position'] ) { ?>
215 215
                     <tr><td class="frm_150_width"><label><?php _e( 'Label Position', 'formidable' ) ?></label></td>
216 216
                         <td><select name="field_options[label_<?php echo esc_attr( $field['id'] ) ?>]">
217
-                            <option value=""<?php selected($field['label'], ''); ?>><?php _e( 'Default', 'formidable' ) ?></option>
218
-                            <option value="top"<?php selected($field['label'], 'top'); ?>><?php _e( 'Top', 'formidable' ) ?></option>
219
-                            <option value="left"<?php selected($field['label'], 'left'); ?>><?php _e( 'Left', 'formidable' ) ?></option>
220
-                            <option value="right"<?php selected($field['label'], 'right'); ?>><?php _e( 'Right', 'formidable' ) ?></option>
221
-                            <option value="inline"<?php selected($field['label'], 'inline'); ?>><?php _e( 'Inline (left without a set width)', 'formidable' ) ?></option>
222
-                            <option value="none"<?php selected($field['label'], 'none'); ?>><?php _e( 'None', 'formidable' ) ?></option>
223
-                            <option value="hidden"<?php selected($field['label'], 'hidden'); ?>><?php _e( 'Hidden (but leave the space)', 'formidable' ) ?></option>
217
+                            <option value=""<?php selected( $field['label'], '' ); ?>><?php _e( 'Default', 'formidable' ) ?></option>
218
+                            <option value="top"<?php selected( $field['label'], 'top' ); ?>><?php _e( 'Top', 'formidable' ) ?></option>
219
+                            <option value="left"<?php selected( $field['label'], 'left' ); ?>><?php _e( 'Left', 'formidable' ) ?></option>
220
+                            <option value="right"<?php selected( $field['label'], 'right' ); ?>><?php _e( 'Right', 'formidable' ) ?></option>
221
+                            <option value="inline"<?php selected( $field['label'], 'inline' ); ?>><?php _e( 'Inline (left without a set width)', 'formidable' ) ?></option>
222
+                            <option value="none"<?php selected( $field['label'], 'none' ); ?>><?php _e( 'None', 'formidable' ) ?></option>
223
+                            <option value="hidden"<?php selected( $field['label'], 'hidden' ); ?>><?php _e( 'Hidden (but leave the space)', 'formidable' ) ?></option>
224 224
                         </select>
225 225
                         </td>
226 226
                     </tr>
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
 				if ( $display['size'] ) {
231 231
 					if ( in_array( $field['type'], array( 'select', 'time', 'data' ) ) ) {
232 232
 						if ( ! isset( $values['custom_style'] ) || $values['custom_style'] ) {
233
-							include( FrmAppHelper::plugin_path() .'/classes/views/back-end-field-opts/automatic-width.php' );
233
+							include( FrmAppHelper::plugin_path() . '/classes/views/back-end-field-opts/automatic-width.php' );
234 234
 						}
235 235
 					} else {
236 236
 						$display_max = $display['max'];
237
-						include( FrmAppHelper::plugin_path() .'/classes/views/back-end-field-opts/pixels-wide.php' );
237
+						include( FrmAppHelper::plugin_path() . '/classes/views/back-end-field-opts/pixels-wide.php' );
238 238
 					}
239 239
 				}
240 240
 
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 					<span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Set the size of the captcha field. The compact option is best if your form is in a small area.', 'formidable' ) ?>" ></span>
244 244
                     </td>
245 245
                     <td><select name="field_options[captcha_size_<?php echo esc_attr( $field['id'] ) ?>]">
246
-                        <option value="default"<?php selected($field['captcha_size'], 'default'); ?>><?php _e( 'Default', 'formidable' ) ?></option>
247
-                        <option value="compact"<?php selected($field['captcha_size'], 'compact'); ?>><?php _e( 'Compact', 'formidable' ) ?></option>
246
+                        <option value="default"<?php selected( $field['captcha_size'], 'default' ); ?>><?php _e( 'Default', 'formidable' ) ?></option>
247
+                        <option value="compact"<?php selected( $field['captcha_size'], 'compact' ); ?>><?php _e( 'Compact', 'formidable' ) ?></option>
248 248
                     </select>
249 249
                     </td>
250 250
                 </tr>
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 				do_action( 'frm_field_options_form', $field, $display, $values );
267 267
 
268 268
                 if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?>
269
-					<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'; ?>">
269
+					<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'; ?>">
270 270
 					<td colspan="2">
271 271
                     <div class="menu-settings">
272 272
                     <h3 class="frm_no_bg"><?php _e( 'Validation', 'formidable' ) ?></h3>
@@ -330,4 +330,4 @@  discard block
 block discarded – undo
330 330
 <?php
331 331
 }
332 332
 
333
-unset($display);
333
+unset( $display );
Please login to merge, or discard this patch.