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