Completed
Branch 3.0 (864fc8)
by Stephanie
02:53
created
classes/models/FrmEntryValues.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -155,12 +155,12 @@  discard block
 block discarded – undo
155 155
 	 * @return array
156 156
 	 */
157 157
 	private function prepare_array_property( $index, $atts ) {
158
-		if ( isset( $atts[ $index ] ) && ! empty( $atts[ $index ] ) ) {
158
+		if ( isset( $atts[$index] ) && ! empty( $atts[$index] ) ) {
159 159
 
160
-			if ( is_array( $atts[ $index ] ) ) {
161
-				$property = $atts[ $index ];
160
+			if ( is_array( $atts[$index] ) ) {
161
+				$property = $atts[$index];
162 162
 			} else {
163
-				$property = explode( ',', $atts[ $index ] );
163
+				$property = explode( ',', $atts[$index] );
164 164
 			}
165 165
 
166 166
 		} else {
@@ -294,6 +294,6 @@  discard block
 block discarded – undo
294 294
 	 * @param stdClass $field
295 295
 	 */
296 296
 	protected function add_field_values( $field ) {
297
-		$this->field_values[ $field->id ] = new FrmFieldValue( $field, $this->entry, array( 'source' => $this->source ) );
297
+		$this->field_values[$field->id] = new FrmFieldValue( $field, $this->entry, array( 'source' => $this->source ) );
298 298
 	}
299 299
 }
300 300
\ No newline at end of file
Please login to merge, or discard this patch.
classes/models/FrmEntryShortcodeFormatter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -219,7 +219,7 @@
 block discarded – undo
219 219
 			'type'  => $field->type,
220 220
 		);
221 221
 
222
-		$this->array_content[ $field->id ] = apply_filters( 'frm_field_shortcodes_for_default_html_email', $array, $field );
222
+		$this->array_content[$field->id] = apply_filters( 'frm_field_shortcodes_for_default_html_email', $array, $field );
223 223
 
224 224
 		return $array;
225 225
 	}
Please login to merge, or discard this patch.
classes/models/FrmFieldValue.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 	 * @since 2.03.11
81 81
 	 */
82 82
 	protected function init_saved_value() {
83
-		if ( isset( $this->entry->metas[ $this->field->id ] ) ) {
84
-			$this->saved_value = $this->entry->metas[ $this->field->id ];
83
+		if ( isset( $this->entry->metas[$this->field->id] ) ) {
84
+			$this->saved_value = $this->entry->metas[$this->field->id];
85 85
 		} else {
86 86
 			$this->saved_value = '';
87 87
 		}
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 
155 155
 		if ( $this->source === 'entry_formatter' ) {
156 156
 			// Deprecated frm_email_value hook
157
-			$meta                  = array(
157
+			$meta = array(
158 158
 				'item_id'    => $this->entry->id,
159 159
 				'field_id'   => $this->field->id,
160 160
 				'meta_value' => $this->saved_value,
Please login to merge, or discard this patch.
classes/models/FrmEntryFormatter.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 		if ( is_object( $atts['entry'] ) ) {
110 110
 
111 111
 			if ( isset( $atts['entry']->metas ) ) {
112
-				$this->entry = $atts[ 'entry' ];
112
+				$this->entry = $atts['entry'];
113 113
 			} else {
114 114
 				$this->entry = FrmEntry::getOne( $atts['entry']->id, true );
115 115
 			}
@@ -351,10 +351,10 @@  discard block
 block discarded – undo
351 351
 		if ( $this->include_field_in_content( $field_value ) ) {
352 352
 
353 353
 			$displayed_value = $this->prepare_display_value_for_array( $field_value->get_displayed_value() );
354
-			$output[ $field_value->get_field_key() ] = $displayed_value;
354
+			$output[$field_value->get_field_key()] = $displayed_value;
355 355
 
356 356
 			if ( $displayed_value !== $field_value->get_saved_value() ) {
357
-				$output[ $field_value->get_field_key() . '-value' ] = $field_value->get_saved_value();
357
+				$output[$field_value->get_field_key() . '-value'] = $field_value->get_saved_value();
358 358
 			}
359 359
 		}
360 360
 	}
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 
606 606
 			if ( is_array( $value ) ) {
607 607
 				foreach ( $value as $key => $single_value ) {
608
-					$value[ $key ] = $this->strip_html( $single_value );
608
+					$value[$key] = $this->strip_html( $single_value );
609 609
 				}
610 610
 			} else if ( $this->is_plain_text && ! is_array( $value ) ) {
611 611
 				if ( strpos( $value, '<img' ) !== false ) {
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	 *
331 331
 	 * @since 2.03.11
332 332
 	 *
333
-	 * @param array $field_values
333
+	 * @param FrmFieldValue[] $field_values
334 334
 	 * @param array $output
335 335
 	 */
336 336
 	protected function push_field_values_to_array( $field_values, &$output ) {
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 	 *
400 400
 	 * @since 2.03.11
401 401
 	 *
402
-	 * @param FrmProFieldValue $field_value
402
+	 * @param FrmFieldValue $field_value
403 403
 	 * @param string $content
404 404
 	 */
405 405
 	private function add_standard_row( $field_value, &$content ) {
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 	 * @param mixed $display_value
561 561
 	 * @param string $field_type
562 562
 	 *
563
-	 * @return mixed|string
563
+	 * @return string
564 564
 	 */
565 565
 	protected function prepare_display_value_for_html_table( $display_value, $field_type = '' ) {
566 566
 		$display_value = $this->flatten_array( $display_value );
Please login to merge, or discard this patch.
classes/controllers/FrmEntriesController.php 2 patches
Indentation   +252 added lines, -252 removed lines patch added patch discarded remove patch
@@ -2,70 +2,70 @@  discard block
 block discarded – undo
2 2
 
3 3
 class FrmEntriesController {
4 4
 
5
-    public static function menu() {
5
+	public static function menu() {
6 6
 		FrmAppHelper::force_capability( 'frm_view_entries' );
7 7
 
8
-        add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
8
+		add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
9 9
 
10 10
 		if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) {
11 11
 			$menu_name = FrmAppHelper::get_menu_name();
12 12
 			add_filter( 'manage_' . sanitize_title( $menu_name ) . '_page_formidable-entries_columns', 'FrmEntriesController::manage_columns' );
13 13
 			add_filter( 'get_user_option_manage' . sanitize_title( $menu_name ) . '_page_formidable-entriescolumnshidden', 'FrmEntriesController::hidden_columns' );
14 14
 			add_filter( 'manage_' . sanitize_title( $menu_name ) . '_page_formidable-entries_sortable_columns', 'FrmEntriesController::sortable_columns' );
15
-        }
16
-    }
15
+		}
16
+	}
17 17
 
18
-    /* Display in Back End */
19
-    public static function route() {
18
+	/* Display in Back End */
19
+	public static function route() {
20 20
 		$action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
21 21
 
22
-        switch ( $action ) {
23
-            case 'show':
24
-            case 'destroy':
25
-            case 'destroy_all':
26
-                return self::$action();
22
+		switch ( $action ) {
23
+			case 'show':
24
+			case 'destroy':
25
+			case 'destroy_all':
26
+				return self::$action();
27 27
 
28
-            default:
29
-                do_action( 'frm_entry_action_route', $action );
30
-                if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
31
-                    return;
32
-                }
28
+			default:
29
+				do_action( 'frm_entry_action_route', $action );
30
+				if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) {
31
+					return;
32
+				}
33 33
 
34
-                return self::display_list();
35
-        }
36
-    }
34
+				return self::display_list();
35
+		}
36
+	}
37 37
 
38 38
 	public static function contextual_help( $help, $screen_id, $screen ) {
39
-        // Only add to certain screens. add_help_tab was introduced in WordPress 3.3
40
-        if ( ! method_exists( $screen, 'add_help_tab' ) ) {
41
-            return $help;
42
-        }
39
+		// Only add to certain screens. add_help_tab was introduced in WordPress 3.3
40
+		if ( ! method_exists( $screen, 'add_help_tab' ) ) {
41
+			return $help;
42
+		}
43 43
 
44 44
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
45 45
 		$page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
46 46
 		if ( $page != 'formidable-entries' || ( ! empty( $action ) && $action != 'list' ) ) {
47
-            return $help;
48
-        }
47
+			return $help;
48
+		}
49 49
 
50 50
 		unset( $action, $page );
51 51
 
52
-        $screen->add_help_tab( array(
53
-            'id'      => 'formidable-entries-tab',
54
-            'title'   => __( 'Overview', 'formidable' ),
52
+		$screen->add_help_tab( array(
53
+			'id'      => 'formidable-entries-tab',
54
+			'title'   => __( 'Overview', 'formidable' ),
55 55
 			'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
56
-        ));
56
+		));
57 57
 
58
-        $screen->set_help_sidebar(
58
+		$screen->set_help_sidebar(
59 59
 			'<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
60 60
 			'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' .
61 61
 			'<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>'
62
-    	);
62
+		);
63 63
 
64
-        return $help;
65
-    }
64
+		return $help;
65
+	}
66 66
 
67 67
 	public static function manage_columns( $columns ) {
68
-        global $frm_vars;
68
+		global $frm_vars;
69 69
 		$form_id = FrmForm::get_current_form_id();
70 70
 
71 71
 		$columns[ $form_id . '_id' ] = 'ID';
@@ -83,15 +83,15 @@  discard block
 block discarded – undo
83 83
 		$columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
84 84
 		$columns[ $form_id . '_ip' ] = 'IP';
85 85
 
86
-        $frm_vars['cols'] = $columns;
86
+		$frm_vars['cols'] = $columns;
87 87
 
88 88
 		$action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' );
89 89
 		if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) {
90 90
 			add_screen_option( 'per_page', array( 'label' => __( 'Entries', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_entries_per_page' ) );
91
-        }
91
+		}
92 92
 
93
-        return $columns;
94
-    }
93
+		return $columns;
94
+	}
95 95
 
96 96
 	private static function get_columns_for_form( $form_id, &$columns ) {
97 97
 		$form_cols = FrmField::get_all_for_form( $form_id, '', 'include' );
@@ -135,76 +135,76 @@  discard block
 block discarded – undo
135 135
 		$menu_name = FrmAppHelper::get_menu_name();
136 136
 		$this_page_name = 'manage' . sanitize_title( $menu_name ) . '_page_formidable-entriescolumnshidden';
137 137
 		if ( $meta_key != $this_page_name || $meta_value == $prev_value ) {
138
-            return $check;
139
-        }
138
+			return $check;
139
+		}
140 140
 
141 141
 		if ( empty( $prev_value ) ) {
142 142
 			$prev_value = get_metadata( 'user', $object_id, $meta_key, true );
143 143
 		}
144 144
 
145
-        global $frm_vars;
146
-        //add a check so we don't create a loop
147
-        $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
145
+		global $frm_vars;
146
+		//add a check so we don't create a loop
147
+		$frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
148 148
 
149
-        return $check;
150
-    }
149
+		return $check;
150
+	}
151 151
 
152
-    //add hidden columns back from other forms
152
+	//add hidden columns back from other forms
153 153
 	public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) {
154 154
 		$menu_name = FrmAppHelper::get_menu_name();
155 155
 		$sanitized = sanitize_title( $menu_name );
156 156
 		$this_page_name = 'manage' . $sanitized . '_page_formidable-entriescolumnshidden';
157 157
 		if ( $meta_key != $this_page_name ) {
158
-            return;
159
-        }
160
-
161
-        global $frm_vars;
162
-        if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) {
163
-            return; //don't continue if there's no previous value
164
-        }
165
-
166
-        foreach ( $meta_value as $mk => $mv ) {
167
-            //remove blank values
168
-            if ( empty( $mv ) ) {
169
-                unset( $meta_value[ $mk ] );
170
-            }
171
-        }
172
-
173
-        $cur_form_prefix = reset($meta_value);
174
-        $cur_form_prefix = explode('_', $cur_form_prefix);
175
-        $cur_form_prefix = $cur_form_prefix[0];
176
-        $save = false;
177
-
178
-        foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
158
+			return;
159
+		}
160
+
161
+		global $frm_vars;
162
+		if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) {
163
+			return; //don't continue if there's no previous value
164
+		}
165
+
166
+		foreach ( $meta_value as $mk => $mv ) {
167
+			//remove blank values
168
+			if ( empty( $mv ) ) {
169
+				unset( $meta_value[ $mk ] );
170
+			}
171
+		}
172
+
173
+		$cur_form_prefix = reset($meta_value);
174
+		$cur_form_prefix = explode('_', $cur_form_prefix);
175
+		$cur_form_prefix = $cur_form_prefix[0];
176
+		$save = false;
177
+
178
+		foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) {
179 179
 			if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) {
180
-                //don't add blank cols or process included cols
181
-                continue;
182
-            }
180
+				//don't add blank cols or process included cols
181
+				continue;
182
+			}
183 183
 
184 184
 			$form_prefix = explode( '_', $prev_hidden );
185
-            $form_prefix = $form_prefix[0];
186
-            if ( $form_prefix == $cur_form_prefix ) {
187
-                //don't add back columns that are meant to be hidden
188
-                continue;
189
-            }
185
+			$form_prefix = $form_prefix[0];
186
+			if ( $form_prefix == $cur_form_prefix ) {
187
+				//don't add back columns that are meant to be hidden
188
+				continue;
189
+			}
190 190
 
191
-            $meta_value[] = $prev_hidden;
192
-            $save = true;
193
-            unset($form_prefix);
194
-        }
191
+			$meta_value[] = $prev_hidden;
192
+			$save = true;
193
+			unset($form_prefix);
194
+		}
195 195
 
196 196
 		if ( $save ) {
197
-            $user = wp_get_current_user();
197
+			$user = wp_get_current_user();
198 198
 			update_user_option( $user->ID, $this_page_name, $meta_value, true );
199
-        }
200
-    }
199
+		}
200
+	}
201 201
 
202 202
 	public static function save_per_page( $save, $option, $value ) {
203
-        if ( $option == 'formidable_page_formidable_entries_per_page' ) {
204
-            $save = (int) $value;
205
-        }
206
-        return $save;
207
-    }
203
+		if ( $option == 'formidable_page_formidable_entries_per_page' ) {
204
+			$save = (int) $value;
205
+		}
206
+		return $save;
207
+	}
208 208
 
209 209
 	public static function sortable_columns() {
210 210
 		$form_id = FrmForm::get_current_form_id();
@@ -230,46 +230,46 @@  discard block
 block discarded – undo
230 230
 	}
231 231
 
232 232
 	public static function hidden_columns( $result ) {
233
-        global $frm_vars;
233
+		global $frm_vars;
234 234
 
235 235
 		$form_id = FrmForm::get_current_form_id();
236 236
 
237
-        $return = false;
238
-        foreach ( (array) $result as $r ) {
239
-            if ( ! empty( $r ) ) {
240
-                $form_prefix = explode( '_', $r );
241
-                $form_prefix = $form_prefix[0];
237
+		$return = false;
238
+		foreach ( (array) $result as $r ) {
239
+			if ( ! empty( $r ) ) {
240
+				$form_prefix = explode( '_', $r );
241
+				$form_prefix = $form_prefix[0];
242 242
 
243
-                if ( (int) $form_prefix == (int) $form_id ) {
244
-                    $return = true;
245
-                    break;
246
-                }
243
+				if ( (int) $form_prefix == (int) $form_id ) {
244
+					$return = true;
245
+					break;
246
+				}
247 247
 
248
-                unset($form_prefix);
249
-            }
250
-        }
248
+				unset($form_prefix);
249
+			}
250
+		}
251 251
 
252
-        if ( $return ) {
252
+		if ( $return ) {
253 253
 			return $result;
254 254
 		}
255 255
 
256
-        $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0;
257
-        $max_columns = 8;
258
-        if ( $i <= $max_columns ) {
256
+		$i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0;
257
+		$max_columns = 8;
258
+		if ( $i <= $max_columns ) {
259 259
 			return $result;
260 260
 		}
261 261
 
262
-        global $frm_vars;
263
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) {
264
-            $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options);
265
-        }
262
+		global $frm_vars;
263
+		if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) {
264
+			$frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options);
265
+		}
266 266
 
267 267
 		$has_custom_hidden_columns = ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] && isset( $frm_vars['current_form']->options['hidden_cols'] ) && ! empty( $frm_vars['current_form']->options['hidden_cols'] ) );
268 268
 		if ( $has_custom_hidden_columns ) {
269
-            $result = $frm_vars['current_form']->options['hidden_cols'];
270
-        } else {
271
-            $cols = $frm_vars['cols'];
272
-            $cols = array_reverse($cols, true);
269
+			$result = $frm_vars['current_form']->options['hidden_cols'];
270
+		} else {
271
+			$cols = $frm_vars['cols'];
272
+			$cols = array_reverse($cols, true);
273 273
 
274 274
 			if ( $form_id ) {
275 275
 				$result[] = $form_id . '_id';
@@ -277,59 +277,59 @@  discard block
 block discarded – undo
277 277
 			}
278 278
 
279 279
 			$result[] = $form_id . '_item_key';
280
-            $i--;
280
+			$i--;
281 281
 
282 282
 			foreach ( $cols as $col_key => $col ) {
283
-                if ( $i > $max_columns ) {
283
+				if ( $i > $max_columns ) {
284 284
 					$result[] = $col_key;
285 285
 				}
286
-                //remove some columns by default
287
-                $i--;
288
-                unset($col_key, $col);
289
-            }
290
-        }
286
+				//remove some columns by default
287
+				$i--;
288
+				unset($col_key, $col);
289
+			}
290
+		}
291 291
 
292
-        return $result;
293
-    }
292
+		return $result;
293
+	}
294 294
 
295 295
 	public static function display_list( $message = '', $errors = array() ) {
296
-        global $wpdb, $frm_vars;
296
+		global $wpdb, $frm_vars;
297 297
 
298 298
 		$form = FrmForm::maybe_get_current_form();
299 299
 		$params = FrmForm::get_admin_params( $form );
300 300
 
301
-        if ( $form ) {
302
-            $params['form'] = $form->id;
303
-            $frm_vars['current_form'] = $form;
301
+		if ( $form ) {
302
+			$params['form'] = $form->id;
303
+			$frm_vars['current_form'] = $form;
304 304
 
305 305
 			self::get_delete_form_time( $form, $errors );
306 306
 		}
307 307
 
308
-        $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
308
+		$table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' );
309 309
 
310
-        $wp_list_table = new $table_class( array( 'params' => $params ) );
310
+		$wp_list_table = new $table_class( array( 'params' => $params ) );
311 311
 
312
-        $pagenum = $wp_list_table->get_pagenum();
312
+		$pagenum = $wp_list_table->get_pagenum();
313 313
 
314
-        $wp_list_table->prepare_items();
314
+		$wp_list_table->prepare_items();
315 315
 
316
-        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
317
-        if ( $pagenum > $total_pages && $total_pages > 0 ) {
316
+		$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
317
+		if ( $pagenum > $total_pages && $total_pages > 0 ) {
318 318
 			$url = add_query_arg( 'paged', $total_pages );
319
-            if ( headers_sent() ) {
320
-                echo FrmAppHelper::js_redirect($url);
321
-            } else {
322
-                wp_redirect( esc_url_raw( $url ) );
323
-            }
324
-            die();
325
-        }
326
-
327
-        if ( empty($message) && isset($_GET['import-message']) ) {
328
-            $message = __( 'Your import is complete', 'formidable' );
329
-        }
319
+			if ( headers_sent() ) {
320
+				echo FrmAppHelper::js_redirect($url);
321
+			} else {
322
+				wp_redirect( esc_url_raw( $url ) );
323
+			}
324
+			die();
325
+		}
326
+
327
+		if ( empty($message) && isset($_GET['import-message']) ) {
328
+			$message = __( 'Your import is complete', 'formidable' );
329
+		}
330 330
 
331 331
 		require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' );
332
-    }
332
+	}
333 333
 
334 334
 	private static function get_delete_form_time( $form, &$errors ) {
335 335
 		if ( 'trash' == $form->status ) {
@@ -339,19 +339,19 @@  discard block
 block discarded – undo
339 339
 		}
340 340
 	}
341 341
 
342
-    /* Back End CRUD */
342
+	/* Back End CRUD */
343 343
 	public static function show( $id = 0 ) {
344
-        FrmAppHelper::permission_check('frm_view_entries');
344
+		FrmAppHelper::permission_check('frm_view_entries');
345 345
 
346
-        if ( ! $id ) {
346
+		if ( ! $id ) {
347 347
 			$id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
348 348
 
349
-            if ( ! $id ) {
349
+			if ( ! $id ) {
350 350
 				$id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' );
351
-            }
352
-        }
351
+			}
352
+		}
353 353
 
354
-        $entry = FrmEntry::getOne($id, true);
354
+		$entry = FrmEntry::getOne($id, true);
355 355
 		if ( ! $entry ) {
356 356
 			echo '<div id="form_show_entry_page" class="wrap">' .
357 357
 				__( 'You are trying to view an entry that does not exist.', 'formidable' ) .
@@ -359,110 +359,110 @@  discard block
 block discarded – undo
359 359
 			return;
360 360
 		}
361 361
 
362
-        $data = maybe_unserialize($entry->description);
362
+		$data = maybe_unserialize($entry->description);
363 363
 		if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) {
364 364
 			$data = array( 'referrer' => $data );
365 365
 		}
366 366
 
367 367
 		$fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' );
368
-        $to_emails = array();
368
+		$to_emails = array();
369 369
 
370 370
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' );
371
-    }
371
+	}
372 372
 
373
-    public static function destroy() {
374
-        FrmAppHelper::permission_check('frm_delete_entries');
373
+	public static function destroy() {
374
+		FrmAppHelper::permission_check('frm_delete_entries');
375 375
 
376 376
 		$params = FrmForm::get_admin_params();
377 377
 
378
-        if ( isset($params['keep_post']) && $params['keep_post'] ) {
379
-            //unlink entry from post
380
-            global $wpdb;
378
+		if ( isset($params['keep_post']) && $params['keep_post'] ) {
379
+			//unlink entry from post
380
+			global $wpdb;
381 381
 			$wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) );
382
-        }
382
+		}
383 383
 
384
-        $message = '';
385
-        if ( FrmEntry::destroy( $params['id'] ) ) {
386
-            $message = __( 'Entry was Successfully Destroyed', 'formidable' );
387
-        }
384
+		$message = '';
385
+		if ( FrmEntry::destroy( $params['id'] ) ) {
386
+			$message = __( 'Entry was Successfully Destroyed', 'formidable' );
387
+		}
388 388
 
389
-        self::display_list( $message );
390
-    }
389
+		self::display_list( $message );
390
+	}
391 391
 
392
-    public static function destroy_all() {
393
-        if ( ! current_user_can( 'frm_delete_entries' ) ) {
394
-            $frm_settings = FrmAppHelper::get_settings();
395
-            wp_die( $frm_settings->admin_permission );
396
-        }
392
+	public static function destroy_all() {
393
+		if ( ! current_user_can( 'frm_delete_entries' ) ) {
394
+			$frm_settings = FrmAppHelper::get_settings();
395
+			wp_die( $frm_settings->admin_permission );
396
+		}
397 397
 
398
-        global $wpdb;
398
+		global $wpdb;
399 399
 		$params = FrmForm::get_admin_params();
400
-        $message = '';
401
-        $errors = array();
402
-        $form_id = (int) $params['form'];
400
+		$message = '';
401
+		$errors = array();
402
+		$form_id = (int) $params['form'];
403 403
 
404
-        if ( $form_id ) {
405
-            $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
404
+		if ( $form_id ) {
405
+			$entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) );
406 406
 			$action = FrmFormAction::get_action_for_form( $form_id, 'wppost', 1 );
407 407
 
408
-            if ( $action ) {
409
-                // this action takes a while, so only trigger it if there are posts to delete
410
-                foreach ( $entry_ids as $entry_id ) {
411
-                    do_action( 'frm_before_destroy_entry', $entry_id );
412
-                    unset( $entry_id );
413
-                }
414
-            }
415
-
416
-            $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) );
417
-            $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) );
418
-            if ( $results ) {
408
+			if ( $action ) {
409
+				// this action takes a while, so only trigger it if there are posts to delete
410
+				foreach ( $entry_ids as $entry_id ) {
411
+					do_action( 'frm_before_destroy_entry', $entry_id );
412
+					unset( $entry_id );
413
+				}
414
+			}
415
+
416
+			$wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) );
417
+			$results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) );
418
+			if ( $results ) {
419 419
 				FrmEntry::clear_cache();
420
-                $message = __( 'Entries were Successfully Destroyed', 'formidable' );
421
-            }
422
-        } else {
423
-            $errors = __( 'No entries were specified', 'formidable' );
424
-        }
425
-
426
-        self::display_list( $message, $errors );
427
-    }
428
-
429
-    public static function show_form( $id = '', $key = '', $title = false, $description = false ) {
430
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' );
431
-        return FrmFormsController::show_form( $id, $key, $title, $description );
432
-    }
433
-
434
-    public static function get_form( $filename, $form, $title, $description ) {
435
-        _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' );
436
-        return FrmFormsController::get_form( $form, $title, $description );
437
-    }
438
-
439
-    public static function process_entry( $errors = '', $ajax = false ) {
420
+				$message = __( 'Entries were Successfully Destroyed', 'formidable' );
421
+			}
422
+		} else {
423
+			$errors = __( 'No entries were specified', 'formidable' );
424
+		}
425
+
426
+		self::display_list( $message, $errors );
427
+	}
428
+
429
+	public static function show_form( $id = '', $key = '', $title = false, $description = false ) {
430
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' );
431
+		return FrmFormsController::show_form( $id, $key, $title, $description );
432
+	}
433
+
434
+	public static function get_form( $filename, $form, $title, $description ) {
435
+		_deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' );
436
+		return FrmFormsController::get_form( $form, $title, $description );
437
+	}
438
+
439
+	public static function process_entry( $errors = '', $ajax = false ) {
440 440
 		$form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' );
441 441
 		if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) {
442
-            return;
443
-        }
442
+			return;
443
+		}
444 444
 
445
-        global $frm_vars;
445
+		global $frm_vars;
446 446
 
447 447
 		$form = FrmForm::getOne( $form_id );
448
-        if ( ! $form ) {
449
-            return;
450
-        }
448
+		if ( ! $form ) {
449
+			return;
450
+		}
451 451
 
452 452
 		$params = FrmForm::get_params( $form );
453 453
 
454
-        if ( ! isset( $frm_vars['form_params'] ) ) {
455
-            $frm_vars['form_params'] = array();
456
-        }
454
+		if ( ! isset( $frm_vars['form_params'] ) ) {
455
+			$frm_vars['form_params'] = array();
456
+		}
457 457
 		$frm_vars['form_params'][ $form->id ] = $params;
458 458
 
459 459
 		if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
460
-            return;
461
-        }
460
+			return;
461
+		}
462 462
 
463
-        if ( $errors == '' && ! $ajax ) {
463
+		if ( $errors == '' && ! $ajax ) {
464 464
 			$errors = FrmEntryValidate::validate( $_POST );
465
-        }
465
+		}
466 466
 
467 467
 		/**
468 468
 		 * Use this filter to add trigger actions and add errors after
@@ -473,39 +473,39 @@  discard block
 block discarded – undo
473 473
 
474 474
 		$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
475 475
 
476
-        if ( empty( $errors ) ) {
476
+		if ( empty( $errors ) ) {
477 477
 			$_POST['frm_skip_cookie'] = 1;
478
-            if ( $params['action'] == 'create' ) {
478
+			if ( $params['action'] == 'create' ) {
479 479
 				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
480 480
 					$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
481
-                }
482
-            }
481
+				}
482
+			}
483 483
 
484
-            do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
484
+			do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) );
485 485
 			unset( $_POST['frm_skip_cookie'] );
486
-        }
487
-    }
488
-
489
-    public static function delete_entry_before_redirect( $url, $form, $atts ) {
490
-        self::_delete_entry( $atts['id'], $form );
491
-        return $url;
492
-    }
493
-
494
-    //Delete entry if not redirected
495
-    public static function delete_entry_after_save( $atts ) {
496
-        self::_delete_entry( $atts['entry_id'], $atts['form'] );
497
-    }
498
-
499
-    private static function _delete_entry( $entry_id, $form ) {
500
-        if ( ! $form ) {
501
-            return;
502
-        }
503
-
504
-        $form->options = maybe_unserialize( $form->options );
505
-        if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
506
-            FrmEntry::destroy( $entry_id );
507
-        }
508
-    }
486
+		}
487
+	}
488
+
489
+	public static function delete_entry_before_redirect( $url, $form, $atts ) {
490
+		self::_delete_entry( $atts['id'], $form );
491
+		return $url;
492
+	}
493
+
494
+	//Delete entry if not redirected
495
+	public static function delete_entry_after_save( $atts ) {
496
+		self::_delete_entry( $atts['entry_id'], $atts['form'] );
497
+	}
498
+
499
+	private static function _delete_entry( $entry_id, $form ) {
500
+		if ( ! $form ) {
501
+			return;
502
+		}
503
+
504
+		$form->options = maybe_unserialize( $form->options );
505
+		if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) {
506
+			FrmEntry::destroy( $entry_id );
507
+		}
508
+	}
509 509
 
510 510
 	/**
511 511
 	 * @param $atts
@@ -560,15 +560,15 @@  discard block
 block discarded – undo
560 560
 	}
561 561
 
562 562
 	public static function entry_sidebar( $entry ) {
563
-        $data = maybe_unserialize($entry->description);
564
-        $date_format = get_option('date_format');
565
-        $time_format = get_option('time_format');
563
+		$data = maybe_unserialize($entry->description);
564
+		$date_format = get_option('date_format');
565
+		$time_format = get_option('time_format');
566 566
 		if ( isset( $data['browser'] ) ) {
567 567
 			$browser = FrmEntriesHelper::get_browser( $data['browser'] );
568 568
 		}
569 569
 
570 570
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' );
571
-    }
571
+	}
572 572
 
573 573
 	/***********************************************************************
574 574
 	 * Deprecated Functions
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
     public static function menu() {
6 6
 		FrmAppHelper::force_capability( 'frm_view_entries' );
7 7
 
8
-        add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
8
+        add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' );
9 9
 
10 10
 		if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) {
11 11
 			$menu_name = FrmAppHelper::get_menu_name();
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             'id'      => 'formidable-entries-tab',
54 54
             'title'   => __( 'Overview', 'formidable' ),
55 55
 			'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>',
56
-        ));
56
+        ) );
57 57
 
58 58
         $screen->set_help_sidebar(
59 59
 			'<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' .
@@ -68,20 +68,20 @@  discard block
 block discarded – undo
68 68
         global $frm_vars;
69 69
 		$form_id = FrmForm::get_current_form_id();
70 70
 
71
-		$columns[ $form_id . '_id' ] = 'ID';
72
-		$columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
71
+		$columns[$form_id . '_id'] = 'ID';
72
+		$columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' );
73 73
 
74 74
 		if ( $form_id ) {
75 75
 			self::get_columns_for_form( $form_id, $columns );
76 76
 		} else {
77
-			$columns[ $form_id . '_form_id' ] = __( 'Form', 'formidable' );
78
-			$columns[ $form_id . '_name' ] = __( 'Entry Name', 'formidable' );
79
-			$columns[ $form_id . '_user_id' ] = __( 'Created By', 'formidable' );
77
+			$columns[$form_id . '_form_id'] = __( 'Form', 'formidable' );
78
+			$columns[$form_id . '_name'] = __( 'Entry Name', 'formidable' );
79
+			$columns[$form_id . '_user_id'] = __( 'Created By', 'formidable' );
80 80
 		}
81 81
 
82
-		$columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' );
83
-		$columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
84
-		$columns[ $form_id . '_ip' ] = 'IP';
82
+		$columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' );
83
+		$columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' );
84
+		$columns[$form_id . '_ip'] = 'IP';
85 85
 
86 86
         $frm_vars['cols'] = $columns;
87 87
 
@@ -107,14 +107,14 @@  discard block
 block discarded – undo
107 107
 				if ( $sub_form_cols ) {
108 108
 					foreach ( $sub_form_cols as $k => $sub_form_col ) {
109 109
 						if ( FrmField::is_no_save_field( $sub_form_col->type ) ) {
110
-							unset( $sub_form_cols[ $k ] );
110
+							unset( $sub_form_cols[$k] );
111 111
 							continue;
112 112
 						}
113
-						$columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
114
-						unset($sub_form_col);
113
+						$columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
114
+						unset( $sub_form_col );
115 115
 					}
116 116
 				}
117
-				unset($sub_form_cols);
117
+				unset( $sub_form_cols );
118 118
 			} else {
119 119
 				$col_id = $form_col->field_key;
120 120
 				if ( $form_col->form_id != $form_id ) {
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 				$has_separate_value = ! FrmField::is_option_empty( $form_col, 'separate_value' );
125 125
 				$is_post_status     = FrmField::is_option_true( $form_col, 'post_field' ) && $form_col->field_options['post_field'] == 'post_status';
126 126
 				if ( $has_separate_value && ! $is_post_status ) {
127
-					$columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
127
+					$columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 );
128 128
 				}
129
-				$columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 );
129
+				$columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 );
130 130
 			}
131 131
 		}
132 132
 	}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
         global $frm_vars;
146 146
         //add a check so we don't create a loop
147
-        $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
147
+        $frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value;
148 148
 
149 149
         return $check;
150 150
     }
@@ -159,19 +159,19 @@  discard block
 block discarded – undo
159 159
         }
160 160
 
161 161
         global $frm_vars;
162
-        if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) {
162
+        if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) {
163 163
             return; //don't continue if there's no previous value
164 164
         }
165 165
 
166 166
         foreach ( $meta_value as $mk => $mv ) {
167 167
             //remove blank values
168 168
             if ( empty( $mv ) ) {
169
-                unset( $meta_value[ $mk ] );
169
+                unset( $meta_value[$mk] );
170 170
             }
171 171
         }
172 172
 
173
-        $cur_form_prefix = reset($meta_value);
174
-        $cur_form_prefix = explode('_', $cur_form_prefix);
173
+        $cur_form_prefix = reset( $meta_value );
174
+        $cur_form_prefix = explode( '_', $cur_form_prefix );
175 175
         $cur_form_prefix = $cur_form_prefix[0];
176 176
         $save = false;
177 177
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
             $meta_value[] = $prev_hidden;
192 192
             $save = true;
193
-            unset($form_prefix);
193
+            unset( $form_prefix );
194 194
         }
195 195
 
196 196
 		if ( $save ) {
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 		foreach ( $fields as $field ) {
223 223
 			if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) {
224 224
 				// Can't sort on checkboxes because they are stored serialized, or post fields
225
-				$columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id;
225
+				$columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id;
226 226
 			}
227 227
 		}
228 228
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
                     break;
246 246
                 }
247 247
 
248
-                unset($form_prefix);
248
+                unset( $form_prefix );
249 249
             }
250 250
         }
251 251
 
@@ -253,15 +253,15 @@  discard block
 block discarded – undo
253 253
 			return $result;
254 254
 		}
255 255
 
256
-        $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0;
256
+        $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0;
257 257
         $max_columns = 8;
258 258
         if ( $i <= $max_columns ) {
259 259
 			return $result;
260 260
 		}
261 261
 
262 262
         global $frm_vars;
263
-        if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) {
264
-            $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options);
263
+        if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] ) {
264
+            $frm_vars['current_form']->options = maybe_unserialize( $frm_vars['current_form']->options );
265 265
         }
266 266
 
267 267
 		$has_custom_hidden_columns = ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] && isset( $frm_vars['current_form']->options['hidden_cols'] ) && ! empty( $frm_vars['current_form']->options['hidden_cols'] ) );
@@ -269,23 +269,23 @@  discard block
 block discarded – undo
269 269
             $result = $frm_vars['current_form']->options['hidden_cols'];
270 270
         } else {
271 271
             $cols = $frm_vars['cols'];
272
-            $cols = array_reverse($cols, true);
272
+            $cols = array_reverse( $cols, true );
273 273
 
274 274
 			if ( $form_id ) {
275 275
 				$result[] = $form_id . '_id';
276
-				$i--;
276
+				$i --;
277 277
 			}
278 278
 
279 279
 			$result[] = $form_id . '_item_key';
280
-            $i--;
280
+            $i --;
281 281
 
282 282
 			foreach ( $cols as $col_key => $col ) {
283 283
                 if ( $i > $max_columns ) {
284 284
 					$result[] = $col_key;
285 285
 				}
286 286
                 //remove some columns by default
287
-                $i--;
288
-                unset($col_key, $col);
287
+                $i --;
288
+                unset( $col_key, $col );
289 289
             }
290 290
         }
291 291
 
@@ -317,14 +317,14 @@  discard block
 block discarded – undo
317 317
         if ( $pagenum > $total_pages && $total_pages > 0 ) {
318 318
 			$url = add_query_arg( 'paged', $total_pages );
319 319
             if ( headers_sent() ) {
320
-                echo FrmAppHelper::js_redirect($url);
320
+                echo FrmAppHelper::js_redirect( $url );
321 321
             } else {
322 322
                 wp_redirect( esc_url_raw( $url ) );
323 323
             }
324 324
             die();
325 325
         }
326 326
 
327
-        if ( empty($message) && isset($_GET['import-message']) ) {
327
+        if ( empty( $message ) && isset( $_GET['import-message'] ) ) {
328 328
             $message = __( 'Your import is complete', 'formidable' );
329 329
         }
330 330
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 
342 342
     /* Back End CRUD */
343 343
 	public static function show( $id = 0 ) {
344
-        FrmAppHelper::permission_check('frm_view_entries');
344
+        FrmAppHelper::permission_check( 'frm_view_entries' );
345 345
 
346 346
         if ( ! $id ) {
347 347
 			$id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' );
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
             }
352 352
         }
353 353
 
354
-        $entry = FrmEntry::getOne($id, true);
354
+        $entry = FrmEntry::getOne( $id, true );
355 355
 		if ( ! $entry ) {
356 356
 			echo '<div id="form_show_entry_page" class="wrap">' .
357 357
 				__( 'You are trying to view an entry that does not exist.', 'formidable' ) .
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 			return;
360 360
 		}
361 361
 
362
-        $data = maybe_unserialize($entry->description);
362
+        $data = maybe_unserialize( $entry->description );
363 363
 		if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) {
364 364
 			$data = array( 'referrer' => $data );
365 365
 		}
@@ -371,11 +371,11 @@  discard block
 block discarded – undo
371 371
     }
372 372
 
373 373
     public static function destroy() {
374
-        FrmAppHelper::permission_check('frm_delete_entries');
374
+        FrmAppHelper::permission_check( 'frm_delete_entries' );
375 375
 
376 376
 		$params = FrmForm::get_admin_params();
377 377
 
378
-        if ( isset($params['keep_post']) && $params['keep_post'] ) {
378
+        if ( isset( $params['keep_post'] ) && $params['keep_post'] ) {
379 379
             //unlink entry from post
380 380
             global $wpdb;
381 381
 			$wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) );
@@ -454,9 +454,9 @@  discard block
 block discarded – undo
454 454
         if ( ! isset( $frm_vars['form_params'] ) ) {
455 455
             $frm_vars['form_params'] = array();
456 456
         }
457
-		$frm_vars['form_params'][ $form->id ] = $params;
457
+		$frm_vars['form_params'][$form->id] = $params;
458 458
 
459
-		if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
459
+		if ( isset( $frm_vars['created_entries'][$form_id] ) ) {
460 460
             return;
461 461
         }
462 462
 
@@ -471,13 +471,13 @@  discard block
 block discarded – undo
471 471
 		 */
472 472
 		$errors = apply_filters( 'frm_entries_before_create', $errors, $form );
473 473
 
474
-		$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
474
+		$frm_vars['created_entries'][$form_id] = array( 'errors' => $errors );
475 475
 
476 476
         if ( empty( $errors ) ) {
477 477
 			$_POST['frm_skip_cookie'] = 1;
478 478
             if ( $params['action'] == 'create' ) {
479
-				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
480
-					$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST );
479
+				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) {
480
+					$frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST );
481 481
                 }
482 482
             }
483 483
 
@@ -560,9 +560,9 @@  discard block
 block discarded – undo
560 560
 	}
561 561
 
562 562
 	public static function entry_sidebar( $entry ) {
563
-        $data = maybe_unserialize($entry->description);
564
-        $date_format = get_option('date_format');
565
-        $time_format = get_option('time_format');
563
+        $data = maybe_unserialize( $entry->description );
564
+        $date_format = get_option( 'date_format' );
565
+        $time_format = get_option( 'time_format' );
566 566
 		if ( isset( $data['browser'] ) ) {
567 567
 			$browser = FrmEntriesHelper::get_browser( $data['browser'] );
568 568
 		}
Please login to merge, or discard this patch.
classes/helpers/FrmFieldsHelper.php 3 patches
Doc Comments   +10 added lines patch added patch discarded remove patch
@@ -98,6 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
 	/**
100 100
 	 * @since 3.0
101
+	 * @return string
101 102
 	 */
102 103
 	public static function get_default_field( $type ) {
103 104
 		$field_type = FrmFieldFactory::get_field_type( $type );
@@ -119,6 +120,7 @@  discard block
 block discarded – undo
119 120
 
120 121
     /**
121 122
      * @since 2.0
123
+     * @param string $error
122 124
      */
123 125
 	public static function get_error_msg( $field, $error ) {
124 126
 		$frm_settings = FrmAppHelper::get_settings();
@@ -350,6 +352,7 @@  discard block
 block discarded – undo
350 352
 	 * This filters shortcodes in the field HTML
351 353
 	 *
352 354
 	 * @since 2.02.11
355
+	 * @param string $html
353 356
 	 */
354 357
 	private static function process_wp_shortcodes( &$html ) {
355 358
 		if ( apply_filters( 'frm_do_html_shortcodes', true ) ) {
@@ -414,6 +417,10 @@  discard block
 block discarded – undo
414 417
 		return $classes;
415 418
 	}
416 419
 
420
+    /**
421
+     * @param boolean $no_vars
422
+     * @param string $code
423
+     */
417 424
     public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) {
418 425
         if ( $no_vars ) {
419 426
 			$html = str_replace( '[if ' . $code . ']', '', $html );
@@ -884,6 +891,9 @@  discard block
 block discarded – undo
884 891
         return $field_types;
885 892
     }
886 893
 
894
+    /**
895
+     * @param string[] $inputs
896
+     */
887 897
     private static function field_types_for_input( $inputs, $fields, &$field_types ) {
888 898
         foreach ( $inputs as $input ) {
889 899
             $field_types[ $input ] = $fields[ $input ];
Please login to merge, or discard this patch.
Indentation   +610 added lines, -610 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  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
-        }
10
+		if ( strpos($type, '|') ) {
11
+			list($type, $setting) = explode('|', $type);
12
+		}
13 13
 
14 14
 		$values = self::get_default_field( $type );
15 15
 
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 			}
30 30
 		}
31 31
 
32
-        return $values;
33
-    }
32
+		return $values;
33
+	}
34 34
 
35 35
 	public static function get_html_id( $field, $plus = '' ) {
36 36
 		return apply_filters( 'frm_field_html_id', 'field_' . $field['field_key'] . $plus, $field );
37
-    }
37
+	}
38 38
 
39
-    public static function setup_edit_vars( $record, $doing_ajax = false ) {
39
+	public static function setup_edit_vars( $record, $doing_ajax = false ) {
40 40
 		$values = array( 'id' => $record->id, 'form_id' => $record->form_id );
41 41
 		$defaults = array(
42 42
 			'name'          => $record->name,
@@ -49,35 +49,35 @@  discard block
 block discarded – undo
49 49
 		);
50 50
 
51 51
 		if ( $doing_ajax ) {
52
-            $values = $values + $defaults;
53
-            $values['form_name'] = '';
52
+			$values = $values + $defaults;
53
+			$values['form_name'] = '';
54 54
 		} else {
55 55
 			foreach ( $defaults as $var => $default ) {
56
-                $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' );
57
-                unset($var, $default);
58
-            }
56
+				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' );
57
+				unset($var, $default);
58
+			}
59 59
 
60 60
 			$values['form_name'] = $record->form_id ? FrmForm::getName( $record->form_id ) : '';
61
-        }
61
+		}
62 62
 
63 63
 		unset( $defaults );
64 64
 
65
-        $values['options'] = $record->options;
66
-        $values['field_options'] = $record->field_options;
65
+		$values['options'] = $record->options;
66
+		$values['field_options'] = $record->field_options;
67 67
 
68 68
 		$defaults = self::get_default_field_options( $values['type'] );
69 69
 
70 70
 		foreach ( $defaults as $opt => $default ) {
71
-            $values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default;
72
-            unset($opt, $default);
73
-        }
71
+			$values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default;
72
+			unset($opt, $default);
73
+		}
74 74
 
75
-        $values['custom_html'] = (isset($record->field_options['custom_html'])) ? $record->field_options['custom_html'] : self::get_default_html($record->type);
75
+		$values['custom_html'] = (isset($record->field_options['custom_html'])) ? $record->field_options['custom_html'] : self::get_default_html($record->type);
76 76
 
77 77
 		return apply_filters( 'frm_setup_edit_field_vars', $values, array( 'doing_ajax' => $doing_ajax ) );
78
-    }
78
+	}
79 79
 
80
-    public static function get_default_field_opts( $type, $field, $limit = false ) {
80
+	public static function get_default_field_opts( $type, $field, $limit = false ) {
81 81
 		_deprecated_function( __FUNCTION__, '3.0', 'FrmFieldHelper::get_default_field_options or FrmFieldHelper::get_default_field' );
82 82
 		if ( $limit ) {
83 83
 			$field_options = self::get_default_field_options( $type );
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		}
87 87
 
88 88
 		return $field_options;
89
-    }
89
+	}
90 90
 
91 91
 	/**
92 92
 	 * @since 3.0
@@ -104,22 +104,22 @@  discard block
 block discarded – undo
104 104
 		return $field_type->get_new_field_defaults();
105 105
 	}
106 106
 
107
-    public static function fill_field( &$values, $field, $form_id, $new_key = '' ) {
108
-        global $wpdb;
107
+	public static function fill_field( &$values, $field, $form_id, $new_key = '' ) {
108
+		global $wpdb;
109 109
 
110 110
 		$values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' );
111
-        $values['form_id'] = $form_id;
112
-        $values['options'] = maybe_serialize($field->options);
113
-        $values['default_value'] = maybe_serialize($field->default_value);
114
-
115
-        foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
116
-            $values[ $col ] = $field->{$col};
117
-        }
118
-    }
119
-
120
-    /**
121
-     * @since 2.0
122
-     */
111
+		$values['form_id'] = $form_id;
112
+		$values['options'] = maybe_serialize($field->options);
113
+		$values['default_value'] = maybe_serialize($field->default_value);
114
+
115
+		foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
116
+			$values[ $col ] = $field->{$col};
117
+		}
118
+	}
119
+
120
+	/**
121
+	 * @since 2.0
122
+	 */
123 123
 	public static function get_error_msg( $field, $error ) {
124 124
 		$frm_settings = FrmAppHelper::get_settings();
125 125
 		$default_settings = $frm_settings->default_options();
@@ -196,68 +196,68 @@  discard block
 block discarded – undo
196 196
 	}
197 197
 
198 198
 	public static function replace_shortcodes( $html, $field, $errors = array(), $form = false, $args = array() ) {
199
-        $html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form);
199
+		$html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form);
200 200
 
201
-        $args = self::fill_display_field_values( $field, $args );
202
-        $field_name = $args['field_name'];
203
-        $field_id = $args['field_id'];
204
-        $html_id = $args['html_id'];
201
+		$args = self::fill_display_field_values( $field, $args );
202
+		$field_name = $args['field_name'];
203
+		$field_id = $args['field_id'];
204
+		$html_id = $args['html_id'];
205 205
 
206
-        if ( FrmField::is_multiple_select($field) ) {
207
-            $field_name .= '[]';
208
-        }
206
+		if ( FrmField::is_multiple_select($field) ) {
207
+			$field_name .= '[]';
208
+		}
209 209
 
210
-        //replace [id]
211
-        $html = str_replace('[id]', $field_id, $html);
210
+		//replace [id]
211
+		$html = str_replace('[id]', $field_id, $html);
212 212
 
213
-        // Remove the for attribute for captcha
214
-        if ( $field['type'] == 'captcha' ) {
215
-            $html = str_replace(' for="field_[key]"', '', $html);
213
+		// Remove the for attribute for captcha
214
+		if ( $field['type'] == 'captcha' ) {
215
+			$html = str_replace(' for="field_[key]"', '', $html);
216 216
 		}
217 217
 
218
-        // set the label for
219
-        $html = str_replace('field_[key]', $html_id, $html);
218
+		// set the label for
219
+		$html = str_replace('field_[key]', $html_id, $html);
220 220
 
221
-        //replace [key]
222
-        $html = str_replace('[key]', $field['field_key'], $html);
221
+		//replace [key]
222
+		$html = str_replace('[key]', $field['field_key'], $html);
223 223
 
224
-        //replace [description] and [required_label] and [error]
224
+		//replace [description] and [required_label] and [error]
225 225
 		$required = FrmField::is_required( $field ) ? $field['required_indicator'] : '';
226
-        if ( ! is_array( $errors ) ) {
227
-            $errors = array();
228
-        }
226
+		if ( ! is_array( $errors ) ) {
227
+			$errors = array();
228
+		}
229 229
 		$error = isset( $errors[ 'field' . $field_id ] ) ? $errors[ 'field' . $field_id ] : false;
230 230
 
231
-        //If field type is section heading, add class so a bottom margin can be added to either the h3 or description
232
-        if ( $field['type'] == 'divider' ) {
233
-            if ( FrmField::is_option_true( $field, 'description' ) ) {
234
-                $html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html );
235
-            } else {
236
-                $html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html);
237
-            }
238
-        }
231
+		//If field type is section heading, add class so a bottom margin can be added to either the h3 or description
232
+		if ( $field['type'] == 'divider' ) {
233
+			if ( FrmField::is_option_true( $field, 'description' ) ) {
234
+				$html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html );
235
+			} else {
236
+				$html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html);
237
+			}
238
+		}
239 239
 
240 240
 		foreach ( array( 'description' => $field['description'], 'required_label' => $required, 'error' => $error ) as $code => $value ) {
241
-            self::remove_inline_conditions( ( $value && $value != '' ), $code, $value, $html );
242
-        }
241
+			self::remove_inline_conditions( ( $value && $value != '' ), $code, $value, $html );
242
+		}
243 243
 
244
-        //replace [required_class]
244
+		//replace [required_class]
245 245
 		$required_class = FrmField::is_required( $field ) ? ' frm_required_field' : '';
246
-        $html = str_replace('[required_class]', $required_class, $html);
246
+		$html = str_replace('[required_class]', $required_class, $html);
247 247
 
248
-        //replace [label_position]
249
-        $field['label'] = apply_filters('frm_html_label_position', $field['label'], $field, $form);
250
-        $field['label'] = ( $field['label'] && $field['label'] != '' ) ? $field['label'] : 'top';
248
+		//replace [label_position]
249
+		$field['label'] = apply_filters('frm_html_label_position', $field['label'], $field, $form);
250
+		$field['label'] = ( $field['label'] && $field['label'] != '' ) ? $field['label'] : 'top';
251 251
 		$html = str_replace( '[label_position]', ( ( in_array( $field['type'], array( 'divider', 'end_divider', 'break' ) ) ) ? $field['label'] : ' frm_primary_label' ), $html );
252 252
 
253
-        //replace [field_name]
254
-        $html = str_replace('[field_name]', $field['name'], $html);
253
+		//replace [field_name]
254
+		$html = str_replace('[field_name]', $field['name'], $html);
255 255
 
256 256
 		self::add_field_div_classes( $field_id, $field, $errors, $html );
257 257
 
258
-        //replace [entry_key]
259
-        $entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' );
260
-        $html = str_replace('[entry_key]', $entry_key, $html);
258
+		//replace [entry_key]
259
+		$entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' );
260
+		$html = str_replace('[entry_key]', $entry_key, $html);
261 261
 
262 262
 		if ( $form ) {
263 263
 			$form = (array) $form;
@@ -271,58 +271,58 @@  discard block
 block discarded – undo
271 271
 
272 272
 		self::process_wp_shortcodes( $html );
273 273
 
274
-        //replace [input]
275
-        preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER);
276
-        global $frm_vars;
277
-        $frm_settings = FrmAppHelper::get_settings();
274
+		//replace [input]
275
+		preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER);
276
+		global $frm_vars;
277
+		$frm_settings = FrmAppHelper::get_settings();
278 278
 
279
-        foreach ( $shortcodes[0] as $short_key => $tag ) {
280
-            $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
279
+		foreach ( $shortcodes[0] as $short_key => $tag ) {
280
+			$atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
281 281
 			$tag = self::get_shortcode_tag( $shortcodes, $short_key, array( 'conditional' => false, 'conditional_check' => false ) );
282 282
 
283
-            $replace_with = '';
283
+			$replace_with = '';
284 284
 
285
-            if ( $tag == 'input' ) {
286
-                if ( isset($atts['opt']) ) {
287
-                    $atts['opt']--;
288
-                }
285
+			if ( $tag == 'input' ) {
286
+				if ( isset($atts['opt']) ) {
287
+					$atts['opt']--;
288
+				}
289 289
 
290
-                $field['input_class'] = isset($atts['class']) ? $atts['class'] : '';
291
-                if ( isset($atts['class']) ) {
292
-                    unset($atts['class']);
293
-                }
290
+				$field['input_class'] = isset($atts['class']) ? $atts['class'] : '';
291
+				if ( isset($atts['class']) ) {
292
+					unset($atts['class']);
293
+				}
294 294
 
295
-                $field['shortcodes'] = $atts;
296
-                ob_start();
295
+				$field['shortcodes'] = $atts;
296
+				ob_start();
297 297
 				include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/input.php' );
298
-                $replace_with = ob_get_contents();
299
-                ob_end_clean();
300
-            } else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) {
301
-                $replace_with = FrmProEntriesController::entry_delete_link($atts);
302
-            }
298
+				$replace_with = ob_get_contents();
299
+				ob_end_clean();
300
+			} else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) {
301
+				$replace_with = FrmProEntriesController::entry_delete_link($atts);
302
+			}
303 303
 
304
-            $html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html );
305
-        }
304
+			$html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html );
305
+		}
306 306
 
307
-        $html .= "\n";
307
+		$html .= "\n";
308 308
 
309
-        //Return html if conf_field to prevent loop
310
-        if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) {
311
-            return $html;
312
-        }
309
+		//Return html if conf_field to prevent loop
310
+		if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) {
311
+			return $html;
312
+		}
313 313
 
314
-        //If field is in repeating section
315
-        if ( $args['section_id'] ) {
316
-            $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'] ));
317
-        } else {
318
-            $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form ));
319
-        }
314
+		//If field is in repeating section
315
+		if ( $args['section_id'] ) {
316
+			$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'] ));
317
+		} else {
318
+			$html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form ));
319
+		}
320 320
 
321 321
 		self::filter_html_field_shortcodes( $field, $html );
322 322
 		self::remove_collapse_shortcode( $html );
323 323
 
324
-        return $html;
325
-    }
324
+		return $html;
325
+	}
326 326
 
327 327
 	private static function fill_display_field_values( $field, $args = array() ) {
328 328
 		$defaults = array(
@@ -414,46 +414,46 @@  discard block
 block discarded – undo
414 414
 		return $classes;
415 415
 	}
416 416
 
417
-    public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) {
418
-        if ( $no_vars ) {
417
+	public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) {
418
+		if ( $no_vars ) {
419 419
 			$html = str_replace( '[if ' . $code . ']', '', $html );
420 420
 			$html = str_replace( '[/if ' . $code . ']', '', $html );
421
-        } else {
421
+		} else {
422 422
 			$html = preg_replace( '/(\[if\s+' . $code . '\])(.*?)(\[\/if\s+' . $code . '\])/mis', '', $html );
423
-        }
423
+		}
424 424
 
425 425
 		$html = str_replace( '[' . $code . ']', $replace_with, $html );
426
-    }
426
+	}
427 427
 
428 428
 	public static function get_shortcode_tag( $shortcodes, $short_key, $args ) {
429 429
 		$args = wp_parse_args( $args, array( 'conditional' => false, 'conditional_check' => false, 'foreach' => false ) );
430
-        if ( ( $args['conditional'] || $args['foreach'] ) && ! $args['conditional_check'] ) {
431
-            $args['conditional_check'] = true;
432
-        }
433
-
434
-        $prefix = '';
435
-        if ( $args['conditional_check'] ) {
436
-            if ( $args['conditional'] ) {
437
-                $prefix = 'if ';
438
-            } else if ( $args['foreach'] ) {
439
-                $prefix = 'foreach ';
440
-            }
441
-        }
442
-
443
-        $with_tags = $args['conditional_check'] ? 3 : 2;
444
-        if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
445
-            $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
446
-            $tag = str_replace(']', '', $tag);
447
-            $tags = explode(' ', $tag);
448
-            if ( is_array($tags) ) {
449
-                $tag = $tags[0];
450
-            }
451
-        } else {
452
-            $tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
453
-        }
454
-
455
-        return $tag;
456
-    }
430
+		if ( ( $args['conditional'] || $args['foreach'] ) && ! $args['conditional_check'] ) {
431
+			$args['conditional_check'] = true;
432
+		}
433
+
434
+		$prefix = '';
435
+		if ( $args['conditional_check'] ) {
436
+			if ( $args['conditional'] ) {
437
+				$prefix = 'if ';
438
+			} else if ( $args['foreach'] ) {
439
+				$prefix = 'foreach ';
440
+			}
441
+		}
442
+
443
+		$with_tags = $args['conditional_check'] ? 3 : 2;
444
+		if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
445
+			$tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
446
+			$tag = str_replace(']', '', $tag);
447
+			$tags = explode(' ', $tag);
448
+			if ( is_array($tags) ) {
449
+				$tag = $tags[0];
450
+			}
451
+		} else {
452
+			$tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
453
+		}
454
+
455
+		return $tag;
456
+	}
457 457
 
458 458
 	/**
459 459
 	 * Remove [collapse_this] if it's still included after all processing
@@ -491,8 +491,8 @@  discard block
 block discarded – undo
491 491
 		}
492 492
 		$api_js_url = apply_filters( 'frm_recaptcha_js_url', $api_js_url );
493 493
 
494
-        wp_register_script( 'recaptcha-api', $api_js_url, '', true );
495
-        wp_enqueue_script( 'recaptcha-api' );
494
+		wp_register_script( 'recaptcha-api', $api_js_url, '', true );
495
+		wp_enqueue_script( 'recaptcha-api' );
496 496
 
497 497
 		// for reverse compatibility
498 498
 		$field['captcha_size'] = ( $field['captcha_size'] == 'default' ) ? 'normal' : $field['captcha_size'];
@@ -505,40 +505,40 @@  discard block
 block discarded – undo
505 505
 	}
506 506
 ?>></div>
507 507
 <?php
508
-    }
508
+	}
509 509
 
510 510
 	public static function show_single_option( $field ) {
511
-        $field_name = $field['name'];
512
-        $html_id = self::get_html_id($field);
513
-        foreach ( $field['options'] as $opt_key => $opt ) {
514
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
515
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
511
+		$field_name = $field['name'];
512
+		$html_id = self::get_html_id($field);
513
+		foreach ( $field['options'] as $opt_key => $opt ) {
514
+			$field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
515
+			$opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
516 516
 
517
-            // If this is an "Other" option, get the HTML for it
517
+			// If this is an "Other" option, get the HTML for it
518 518
 			if ( self::is_other_opt( $opt_key ) ) {
519
-                // Get string for Other text field, if needed
519
+				// Get string for Other text field, if needed
520 520
 				$other_val = self::get_other_val( compact( 'opt_key', 'field' ) );
521 521
 				require( FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/other-option.php' );
522
-            } else {
522
+			} else {
523 523
 				require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' );
524
-            }
525
-        }
526
-    }
524
+			}
525
+		}
526
+	}
527 527
 
528 528
 	public static function get_term_link( $tax_id ) {
529
-        $tax = get_taxonomy($tax_id);
530
-        if ( ! $tax ) {
531
-            return;
532
-        }
529
+		$tax = get_taxonomy($tax_id);
530
+		if ( ! $tax ) {
531
+			return;
532
+		}
533 533
 
534
-        $link = sprintf(
535
-            __( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
534
+		$link = sprintf(
535
+			__( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
536 536
 			'<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>'
537
-        );
538
-        unset($tax);
537
+		);
538
+		unset($tax);
539 539
 
540
-        return $link;
541
-    }
540
+		return $link;
541
+	}
542 542
 
543 543
 	public static function value_meets_condition( $observed_value, $cond, $hide_opt ) {
544 544
 		// Remove white space from hide_opt
@@ -549,199 +549,199 @@  discard block
 block discarded – undo
549 549
 		$observed_value = wp_kses_post( $observed_value );
550 550
 		$hide_opt = wp_kses_post( $hide_opt );
551 551
 
552
-        if ( is_array($observed_value) ) {
553
-            return self::array_value_condition($observed_value, $cond, $hide_opt);
554
-        }
555
-
556
-        $m = false;
557
-        if ( $cond == '==' ) {
558
-            $m = $observed_value == $hide_opt;
559
-        } else if ( $cond == '!=' ) {
560
-            $m = $observed_value != $hide_opt;
561
-        } else if ( $cond == '>' ) {
562
-            $m = $observed_value > $hide_opt;
563
-        } else if ( $cond == '<' ) {
564
-            $m = $observed_value < $hide_opt;
565
-        } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
566
-            $m = stripos($observed_value, $hide_opt);
567
-            if ( $cond == 'not LIKE' ) {
568
-                $m = ( $m === false ) ? true : false;
569
-            } else {
570
-                $m = ( $m === false ) ? false : true;
571
-            }
572
-        }
573
-        return $m;
574
-    }
552
+		if ( is_array($observed_value) ) {
553
+			return self::array_value_condition($observed_value, $cond, $hide_opt);
554
+		}
555
+
556
+		$m = false;
557
+		if ( $cond == '==' ) {
558
+			$m = $observed_value == $hide_opt;
559
+		} else if ( $cond == '!=' ) {
560
+			$m = $observed_value != $hide_opt;
561
+		} else if ( $cond == '>' ) {
562
+			$m = $observed_value > $hide_opt;
563
+		} else if ( $cond == '<' ) {
564
+			$m = $observed_value < $hide_opt;
565
+		} else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
566
+			$m = stripos($observed_value, $hide_opt);
567
+			if ( $cond == 'not LIKE' ) {
568
+				$m = ( $m === false ) ? true : false;
569
+			} else {
570
+				$m = ( $m === false ) ? false : true;
571
+			}
572
+		}
573
+		return $m;
574
+	}
575 575
 
576 576
 	public static function array_value_condition( $observed_value, $cond, $hide_opt ) {
577
-        $m = false;
578
-        if ( $cond == '==' ) {
579
-            if ( is_array($hide_opt) ) {
580
-                $m = array_intersect($hide_opt, $observed_value);
581
-                $m = empty($m) ? false : true;
582
-            } else {
583
-                $m = in_array($hide_opt, $observed_value);
584
-            }
585
-        } else if ( $cond == '!=' ) {
586
-            $m = ! in_array($hide_opt, $observed_value);
587
-        } else if ( $cond == '>' ) {
588
-            $min = min($observed_value);
589
-            $m = $min > $hide_opt;
590
-        } else if ( $cond == '<' ) {
591
-            $max = max($observed_value);
592
-            $m = $max < $hide_opt;
593
-        } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
594
-            foreach ( $observed_value as $ob ) {
595
-                $m = strpos($ob, $hide_opt);
596
-                if ( $m !== false ) {
597
-                    $m = true;
598
-                    break;
599
-                }
600
-            }
601
-
602
-            if ( $cond == 'not LIKE' ) {
603
-                $m = ( $m === false ) ? true : false;
604
-            }
605
-        }
606
-
607
-        return $m;
608
-    }
609
-
610
-    /**
611
-     * Replace a few basic shortcodes and field ids
612
-     * @since 2.0
613
-     * @return string
614
-     */
577
+		$m = false;
578
+		if ( $cond == '==' ) {
579
+			if ( is_array($hide_opt) ) {
580
+				$m = array_intersect($hide_opt, $observed_value);
581
+				$m = empty($m) ? false : true;
582
+			} else {
583
+				$m = in_array($hide_opt, $observed_value);
584
+			}
585
+		} else if ( $cond == '!=' ) {
586
+			$m = ! in_array($hide_opt, $observed_value);
587
+		} else if ( $cond == '>' ) {
588
+			$min = min($observed_value);
589
+			$m = $min > $hide_opt;
590
+		} else if ( $cond == '<' ) {
591
+			$max = max($observed_value);
592
+			$m = $max < $hide_opt;
593
+		} else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
594
+			foreach ( $observed_value as $ob ) {
595
+				$m = strpos($ob, $hide_opt);
596
+				if ( $m !== false ) {
597
+					$m = true;
598
+					break;
599
+				}
600
+			}
601
+
602
+			if ( $cond == 'not LIKE' ) {
603
+				$m = ( $m === false ) ? true : false;
604
+			}
605
+		}
606
+
607
+		return $m;
608
+	}
609
+
610
+	/**
611
+	 * Replace a few basic shortcodes and field ids
612
+	 * @since 2.0
613
+	 * @return string
614
+	 */
615 615
 	public static function basic_replace_shortcodes( $value, $form, $entry ) {
616
-        if ( strpos($value, '[sitename]') !== false ) {
617
-            $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
618
-            $value = str_replace('[sitename]', $new_value, $value);
619
-        }
616
+		if ( strpos($value, '[sitename]') !== false ) {
617
+			$new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
618
+			$value = str_replace('[sitename]', $new_value, $value);
619
+		}
620 620
 
621
-        $value = apply_filters('frm_content', $value, $form, $entry);
622
-        $value = do_shortcode($value);
621
+		$value = apply_filters('frm_content', $value, $form, $entry);
622
+		$value = do_shortcode($value);
623 623
 
624
-        return $value;
625
-    }
624
+		return $value;
625
+	}
626 626
 
627 627
 	public static function get_shortcodes( $content, $form_id ) {
628
-        if ( FrmAppHelper::pro_is_installed() ) {
629
-            return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
630
-        }
628
+		if ( FrmAppHelper::pro_is_installed() ) {
629
+			return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
630
+		}
631 631
 
632
-        $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) );
632
+		$fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) );
633 633
 
634
-        $tagregexp = self::allowed_shortcodes($fields);
634
+		$tagregexp = self::allowed_shortcodes($fields);
635 635
 
636
-        preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
636
+		preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
637 637
 
638
-        return $matches;
639
-    }
638
+		return $matches;
639
+	}
640 640
 
641 641
 	public static function allowed_shortcodes( $fields = array() ) {
642
-        $tagregexp = array(
643
-            'editlink', 'id', 'key', 'ip',
644
-            'siteurl', 'sitename', 'admin_email',
645
-            'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by',
642
+		$tagregexp = array(
643
+			'editlink', 'id', 'key', 'ip',
644
+			'siteurl', 'sitename', 'admin_email',
645
+			'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by',
646 646
 			'parent[-|_]id',
647
-        );
647
+		);
648 648
 
649
-        foreach ( $fields as $field ) {
650
-            $tagregexp[] = $field->id;
651
-            $tagregexp[] = $field->field_key;
652
-        }
649
+		foreach ( $fields as $field ) {
650
+			$tagregexp[] = $field->id;
651
+			$tagregexp[] = $field->field_key;
652
+		}
653 653
 
654
-        $tagregexp = implode('|', $tagregexp);
655
-        return $tagregexp;
656
-    }
654
+		$tagregexp = implode('|', $tagregexp);
655
+		return $tagregexp;
656
+	}
657 657
 
658 658
 	public static function replace_content_shortcodes( $content, $entry, $shortcodes ) {
659
-        $shortcode_values = array(
660
-           'id'     => $entry->id,
661
-           'key'    => $entry->item_key,
662
-           'ip'     => $entry->ip,
663
-        );
659
+		$shortcode_values = array(
660
+		   'id'     => $entry->id,
661
+		   'key'    => $entry->item_key,
662
+		   'ip'     => $entry->ip,
663
+		);
664 664
 
665
-        foreach ( $shortcodes[0] as $short_key => $tag ) {
665
+		foreach ( $shortcodes[0] as $short_key => $tag ) {
666 666
 			if ( empty( $tag ) ) {
667 667
 				continue;
668 668
 			}
669 669
 
670
-            $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] );
670
+			$atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] );
671 671
 
672
-            if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
672
+			if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
673 673
 				$tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] );
674
-                $tags = explode(' ', $tag);
675
-                if ( is_array($tags) ) {
676
-                    $tag = $tags[0];
677
-                }
678
-            } else {
679
-                $tag = $shortcodes[2][ $short_key ];
680
-            }
681
-
682
-            switch ( $tag ) {
683
-                case 'id':
684
-                case 'key':
685
-                case 'ip':
686
-                    $replace_with = $shortcode_values[ $tag ];
687
-                break;
688
-
689
-                case 'user_agent':
690
-                case 'user-agent':
691
-                    $entry->description = maybe_unserialize($entry->description);
674
+				$tags = explode(' ', $tag);
675
+				if ( is_array($tags) ) {
676
+					$tag = $tags[0];
677
+				}
678
+			} else {
679
+				$tag = $shortcodes[2][ $short_key ];
680
+			}
681
+
682
+			switch ( $tag ) {
683
+				case 'id':
684
+				case 'key':
685
+				case 'ip':
686
+					$replace_with = $shortcode_values[ $tag ];
687
+				break;
688
+
689
+				case 'user_agent':
690
+				case 'user-agent':
691
+					$entry->description = maybe_unserialize($entry->description);
692 692
 					$replace_with = FrmEntriesHelper::get_browser( $entry->description['browser'] );
693
-                break;
694
-
695
-                case 'created_at':
696
-                case 'created-at':
697
-                case 'updated_at':
698
-                case 'updated-at':
699
-                    if ( isset($atts['format']) ) {
700
-                        $time_format = ' ';
701
-                    } else {
702
-                        $atts['format'] = get_option('date_format');
703
-                        $time_format = '';
704
-                    }
705
-
706
-                    $this_tag = str_replace('-', '_', $tag);
707
-                    $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
708
-                    unset($this_tag);
709
-                break;
710
-
711
-                case 'created_by':
712
-                case 'created-by':
713
-                case 'updated_by':
714
-                case 'updated-by':
715
-                    $this_tag = str_replace('-', '_', $tag);
693
+				break;
694
+
695
+				case 'created_at':
696
+				case 'created-at':
697
+				case 'updated_at':
698
+				case 'updated-at':
699
+					if ( isset($atts['format']) ) {
700
+						$time_format = ' ';
701
+					} else {
702
+						$atts['format'] = get_option('date_format');
703
+						$time_format = '';
704
+					}
705
+
706
+					$this_tag = str_replace('-', '_', $tag);
707
+					$replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
708
+					unset($this_tag);
709
+				break;
710
+
711
+				case 'created_by':
712
+				case 'created-by':
713
+				case 'updated_by':
714
+				case 'updated-by':
715
+					$this_tag = str_replace('-', '_', $tag);
716 716
 					$replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts );
717
-                    unset($this_tag);
718
-                break;
719
-
720
-                case 'admin_email':
721
-                case 'siteurl':
722
-                case 'frmurl':
723
-                case 'sitename':
724
-                case 'get':
725
-                    $replace_with = self::dynamic_default_values( $tag, $atts );
726
-                break;
727
-
728
-                default:
729
-                    $field = FrmField::getOne( $tag );
730
-                    if ( ! $field ) {
731
-                        break;
732
-                    }
733
-
734
-                    $sep = isset($atts['sep']) ? $atts['sep'] : ', ';
735
-
736
-                    $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
737
-
738
-                    $atts['entry_id'] = $entry->id;
739
-                    $atts['entry_key'] = $entry->item_key;
740
-
741
-                    if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
742
-                        $replace_with = $field->name;
743
-                    } else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
744
-                        $replace_with = $field->description;
717
+					unset($this_tag);
718
+				break;
719
+
720
+				case 'admin_email':
721
+				case 'siteurl':
722
+				case 'frmurl':
723
+				case 'sitename':
724
+				case 'get':
725
+					$replace_with = self::dynamic_default_values( $tag, $atts );
726
+				break;
727
+
728
+				default:
729
+					$field = FrmField::getOne( $tag );
730
+					if ( ! $field ) {
731
+						break;
732
+					}
733
+
734
+					$sep = isset($atts['sep']) ? $atts['sep'] : ', ';
735
+
736
+					$replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
737
+
738
+					$atts['entry_id'] = $entry->id;
739
+					$atts['entry_key'] = $entry->item_key;
740
+
741
+					if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
742
+						$replace_with = $field->name;
743
+					} else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
744
+						$replace_with = $field->description;
745 745
 					} else {
746 746
 						$string_value = $replace_with;
747 747
 						if ( is_array( $replace_with ) ) {
@@ -755,82 +755,82 @@  discard block
 block discarded – undo
755 755
 						}
756 756
 					}
757 757
 
758
-                    unset($field);
759
-                break;
760
-            }
758
+					unset($field);
759
+				break;
760
+			}
761 761
 
762
-            if ( isset($replace_with) ) {
763
-                $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
764
-            }
762
+			if ( isset($replace_with) ) {
763
+				$content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
764
+			}
765 765
 
766
-            unset($atts, $conditional, $replace_with);
766
+			unset($atts, $conditional, $replace_with);
767 767
 		}
768 768
 
769 769
 		return $content;
770
-    }
771
-
772
-    /**
773
-     * Get the value to replace a few standard shortcodes
774
-     *
775
-     * @since 2.0
776
-     * @return string
777
-     */
778
-    public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) {
779
-        $new_value = '';
780
-        switch ( $tag ) {
781
-            case 'admin_email':
782
-                $new_value = get_option('admin_email');
783
-                break;
784
-            case 'siteurl':
785
-                $new_value = FrmAppHelper::site_url();
786
-                break;
787
-            case 'frmurl':
788
-                $new_value = FrmAppHelper::plugin_url();
789
-                break;
790
-            case 'sitename':
791
-                $new_value = FrmAppHelper::site_name();
792
-                break;
793
-            case 'get':
794
-                $new_value = self::process_get_shortcode( $atts, $return_array );
795
-                break;
796
-        }
797
-
798
-        return $new_value;
799
-    }
800
-
801
-    /**
802
-     * Process the [get] shortcode
803
-     *
804
-     * @since 2.0
805
-     * @return string|array
806
-     */
807
-    public static function process_get_shortcode( $atts, $return_array = false ) {
808
-        if ( ! isset($atts['param']) ) {
809
-            return '';
810
-        }
811
-
812
-        if ( strpos($atts['param'], '&#91;') ) {
813
-            $atts['param'] = str_replace('&#91;', '[', $atts['param']);
814
-            $atts['param'] = str_replace('&#93;', ']', $atts['param']);
815
-        }
816
-
817
-        $new_value = FrmAppHelper::get_param($atts['param'], '');
818
-        $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
819
-
820
-        if ( $new_value == '' ) {
821
-            if ( ! isset($atts['prev_val']) ) {
822
-                $atts['prev_val'] = '';
823
-            }
824
-
825
-            $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
826
-        }
827
-
828
-        if ( is_array($new_value) && ! $return_array ) {
829
-            $new_value = implode(', ', $new_value);
830
-        }
831
-
832
-        return $new_value;
833
-    }
770
+	}
771
+
772
+	/**
773
+	 * Get the value to replace a few standard shortcodes
774
+	 *
775
+	 * @since 2.0
776
+	 * @return string
777
+	 */
778
+	public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) {
779
+		$new_value = '';
780
+		switch ( $tag ) {
781
+			case 'admin_email':
782
+				$new_value = get_option('admin_email');
783
+				break;
784
+			case 'siteurl':
785
+				$new_value = FrmAppHelper::site_url();
786
+				break;
787
+			case 'frmurl':
788
+				$new_value = FrmAppHelper::plugin_url();
789
+				break;
790
+			case 'sitename':
791
+				$new_value = FrmAppHelper::site_name();
792
+				break;
793
+			case 'get':
794
+				$new_value = self::process_get_shortcode( $atts, $return_array );
795
+				break;
796
+		}
797
+
798
+		return $new_value;
799
+	}
800
+
801
+	/**
802
+	 * Process the [get] shortcode
803
+	 *
804
+	 * @since 2.0
805
+	 * @return string|array
806
+	 */
807
+	public static function process_get_shortcode( $atts, $return_array = false ) {
808
+		if ( ! isset($atts['param']) ) {
809
+			return '';
810
+		}
811
+
812
+		if ( strpos($atts['param'], '&#91;') ) {
813
+			$atts['param'] = str_replace('&#91;', '[', $atts['param']);
814
+			$atts['param'] = str_replace('&#93;', ']', $atts['param']);
815
+		}
816
+
817
+		$new_value = FrmAppHelper::get_param($atts['param'], '');
818
+		$new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
819
+
820
+		if ( $new_value == '' ) {
821
+			if ( ! isset($atts['prev_val']) ) {
822
+				$atts['prev_val'] = '';
823
+			}
824
+
825
+			$new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
826
+		}
827
+
828
+		if ( is_array($new_value) && ! $return_array ) {
829
+			$new_value = implode(', ', $new_value);
830
+		}
831
+
832
+		return $new_value;
833
+	}
834 834
 
835 835
 	public static function get_display_value( $replace_with, $field, $atts = array() ) {
836 836
 		$sep = isset( $atts['sep'] ) ? $atts['sep'] : ', ';
@@ -838,14 +838,14 @@  discard block
 block discarded – undo
838 838
 		$replace_with = apply_filters( 'frm_get_' . $field->type . '_display_value', $replace_with, $field, $atts );
839 839
 		$replace_with = apply_filters( 'frm_get_display_value', $replace_with, $field, $atts );
840 840
 
841
-        if ( $field->type == 'textarea' || $field->type == 'rte' ) {
842
-            $autop = isset($atts['wpautop']) ? $atts['wpautop'] : true;
843
-            if ( apply_filters('frm_use_wpautop', $autop) ) {
844
-                if ( is_array($replace_with) ) {
845
-                    $replace_with = implode("\n", $replace_with);
846
-                }
847
-                $replace_with = wpautop($replace_with);
848
-            }
841
+		if ( $field->type == 'textarea' || $field->type == 'rte' ) {
842
+			$autop = isset($atts['wpautop']) ? $atts['wpautop'] : true;
843
+			if ( apply_filters('frm_use_wpautop', $autop) ) {
844
+				if ( is_array($replace_with) ) {
845
+					$replace_with = implode("\n", $replace_with);
846
+				}
847
+				$replace_with = wpautop($replace_with);
848
+			}
849 849
 			unset( $autop );
850 850
 		} else if ( is_array( $replace_with ) ) {
851 851
 			if ( $atts['show'] && isset( $replace_with[ $atts['show'] ] ) ) {
@@ -859,37 +859,37 @@  discard block
 block discarded – undo
859 859
 	}
860 860
 
861 861
 	public static function get_field_types( $type ) {
862
-        $single_input = array(
863
-            'text', 'textarea', 'rte', 'number', 'email', 'url',
864
-            'image', 'file', 'date', 'phone', 'hidden', 'time',
865
-            'user_id', 'tag', 'password',
866
-        );
862
+		$single_input = array(
863
+			'text', 'textarea', 'rte', 'number', 'email', 'url',
864
+			'image', 'file', 'date', 'phone', 'hidden', 'time',
865
+			'user_id', 'tag', 'password',
866
+		);
867 867
 		$multiple_input = array( 'radio', 'checkbox', 'select', 'scale', 'lookup' );
868 868
 		$other_type = array( 'html', 'break' );
869 869
 
870 870
 		$field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() );
871 871
 
872
-        $field_types = array();
873
-        if ( in_array($type, $single_input) ) {
874
-            self::field_types_for_input( $single_input, $field_selection, $field_types );
875
-        } else if ( in_array($type, $multiple_input) ) {
876
-            self::field_types_for_input( $multiple_input, $field_selection, $field_types );
877
-        } else if ( in_array($type, $other_type) ) {
878
-            self::field_types_for_input( $other_type, $field_selection, $field_types );
872
+		$field_types = array();
873
+		if ( in_array($type, $single_input) ) {
874
+			self::field_types_for_input( $single_input, $field_selection, $field_types );
875
+		} else if ( in_array($type, $multiple_input) ) {
876
+			self::field_types_for_input( $multiple_input, $field_selection, $field_types );
877
+		} else if ( in_array($type, $other_type) ) {
878
+			self::field_types_for_input( $other_type, $field_selection, $field_types );
879 879
 		} else if ( isset( $field_selection[ $type ] ) ) {
880
-            $field_types[ $type ] = $field_selection[ $type ];
881
-        }
880
+			$field_types[ $type ] = $field_selection[ $type ];
881
+		}
882 882
 
883 883
 		$field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) );
884
-        return $field_types;
885
-    }
884
+		return $field_types;
885
+	}
886 886
 
887
-    private static function field_types_for_input( $inputs, $fields, &$field_types ) {
888
-        foreach ( $inputs as $input ) {
889
-            $field_types[ $input ] = $fields[ $input ];
890
-            unset($input);
891
-        }
892
-    }
887
+	private static function field_types_for_input( $inputs, $fields, &$field_types ) {
888
+		foreach ( $inputs as $input ) {
889
+			$field_types[ $input ] = $fields[ $input ];
890
+			unset($input);
891
+		}
892
+	}
893 893
 
894 894
 	/**
895 895
 	 * Check if current field option is an "other" option
@@ -903,14 +903,14 @@  discard block
 block discarded – undo
903 903
 		return $opt_key && strpos( $opt_key, 'other_' ) === 0;
904 904
 	}
905 905
 
906
-    /**
907
-    * Get value that belongs in "Other" text box
908
-    *
909
-    * @since 2.0.6
910
-    *
911
-    * @param array $args
912
-    */
913
-    public static function get_other_val( $args ) {
906
+	/**
907
+	 * Get value that belongs in "Other" text box
908
+	 *
909
+	 * @since 2.0.6
910
+	 *
911
+	 * @param array $args
912
+	 */
913
+	public static function get_other_val( $args ) {
914 914
 		$defaults = array(
915 915
 			'opt_key' => 0, 'field' => array(),
916 916
 			'parent' => false, 'pointer' => false,
@@ -986,20 +986,20 @@  discard block
 block discarded – undo
986 986
 		}
987 987
 
988 988
 		return $other_val;
989
-    }
990
-
991
-    /**
992
-    * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
993
-    * Intended for front-end use
994
-    *
995
-    * @since 2.0.6
996
-    *
997
-    * @param array $args should include field, opt_key and field name
998
-    * @param boolean $other_opt
999
-    * @param string $checked
1000
-    * @return string $other_val
1001
-    */
1002
-    public static function prepare_other_input( $args, &$other_opt, &$checked ) {
989
+	}
990
+
991
+	/**
992
+	 * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val.
993
+	 * Intended for front-end use
994
+	 *
995
+	 * @since 2.0.6
996
+	 *
997
+	 * @param array $args should include field, opt_key and field name
998
+	 * @param boolean $other_opt
999
+	 * @param string $checked
1000
+	 * @return string $other_val
1001
+	 */
1002
+	public static function prepare_other_input( $args, &$other_opt, &$checked ) {
1003 1003
 		//Check if this is an "Other" option
1004 1004
 		if ( ! self::is_other_opt( $args['opt_key'] ) ) {
1005 1005
 			return;
@@ -1015,8 +1015,8 @@  discard block
 block discarded – undo
1015 1015
 			$checked = 'checked="checked" ';
1016 1016
 		}
1017 1017
 
1018
-        return $other_args;
1019
-    }
1018
+		return $other_args;
1019
+	}
1020 1020
 
1021 1021
 	/**
1022 1022
 	 * @param array $args
@@ -1066,8 +1066,8 @@  discard block
 block discarded – undo
1066 1066
 	 * @since 2.0.6
1067 1067
 	 */
1068 1068
 	public static function include_other_input( $args ) {
1069
-        if ( ! $args['other_opt'] ) {
1070
-        	return;
1069
+		if ( ! $args['other_opt'] ) {
1070
+			return;
1071 1071
 		}
1072 1072
 
1073 1073
 		$classes = array( 'frm_other_input' );
@@ -1088,15 +1088,15 @@  discard block
 block discarded – undo
1088 1088
 	}
1089 1089
 
1090 1090
 	/**
1091
-	* Get the HTML id for an "Other" text field
1092
-	* Note: This does not affect fields in repeating sections
1093
-	*
1094
-	* @since 2.0.08
1095
-	* @param string $type - field type
1096
-	* @param string $html_id
1097
-	* @param string|boolean $opt_key
1098
-	* @return string $other_id
1099
-	*/
1091
+	 * Get the HTML id for an "Other" text field
1092
+	 * Note: This does not affect fields in repeating sections
1093
+	 *
1094
+	 * @since 2.0.08
1095
+	 * @param string $type - field type
1096
+	 * @param string $html_id
1097
+	 * @param string|boolean $opt_key
1098
+	 * @return string $other_id
1099
+	 */
1100 1100
 	public static function get_other_field_html_id( $type, $html_id, $opt_key = false ) {
1101 1101
 		$other_id = $html_id;
1102 1102
 
@@ -1154,10 +1154,10 @@  discard block
 block discarded – undo
1154 1154
 	}
1155 1155
 
1156 1156
 	public static function switch_field_ids( $val ) {
1157
-        global $frm_duplicate_ids;
1158
-        $replace = array();
1159
-        $replace_with = array();
1160
-        foreach ( (array) $frm_duplicate_ids as $old => $new ) {
1157
+		global $frm_duplicate_ids;
1158
+		$replace = array();
1159
+		$replace_with = array();
1160
+		foreach ( (array) $frm_duplicate_ids as $old => $new ) {
1161 1161
 			$replace[] = '[if ' . $old . ']';
1162 1162
 			$replace_with[] = '[if ' . $new . ']';
1163 1163
 			$replace[] = '[if ' . $old . ' ';
@@ -1172,153 +1172,153 @@  discard block
 block discarded – undo
1172 1172
 			$replace_with[] = '[' . $new . ']';
1173 1173
 			$replace[] = '[' . $old . ' ';
1174 1174
 			$replace_with[] = '[' . $new . ' ';
1175
-            unset($old, $new);
1176
-        }
1175
+			unset($old, $new);
1176
+		}
1177 1177
 		if ( is_array( $val ) ) {
1178 1178
 			foreach ( $val as $k => $v ) {
1179
-                $val[ $k ] = str_replace( $replace, $replace_with, $v );
1180
-                unset($k, $v);
1181
-            }
1182
-        } else {
1183
-            $val = str_replace($replace, $replace_with, $val);
1184
-        }
1185
-
1186
-        return $val;
1187
-    }
1188
-
1189
-    public static function get_us_states() {
1190
-        return apply_filters( 'frm_us_states', array(
1191
-            'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona',
1192
-            'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware',
1193
-            'DC' => 'District of Columbia',
1194
-            'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho',
1195
-            'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas',
1196
-            'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland',
1197
-            'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi',
1198
-            'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada',
1199
-            'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York',
1200
-            'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma',
1201
-            'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina',
1202
-            'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah',
1203
-            'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia',
1204
-            'WI' => 'Wisconsin', 'WY' => 'Wyoming',
1205
-        ) );
1206
-    }
1207
-
1208
-    public static function get_countries() {
1209
-        return apply_filters( 'frm_countries', array(
1210
-            __( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ),
1211
-            __( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ),
1212
-            __( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ),
1213
-            __( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ),
1214
-            __( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ),
1215
-            __( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ),
1216
-            __( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ),
1217
-            __( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ),
1218
-            __( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ),
1219
-            __( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ),
1220
-            __( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ),
1221
-            __( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ),
1222
-            __( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ),
1223
-            __( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ),
1224
-            __( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ),
1225
-            __( 'Costa Rica', 'formidable' ), __( 'C&ocirc;te d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ),
1226
-            __( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ),
1227
-            __( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ),
1228
-            __( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ),
1229
-            __( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ),
1230
-            __( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ),
1231
-            __( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ),
1232
-            __( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ),
1233
-            __( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ),
1234
-            __( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ),
1235
-            __( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ),
1236
-            __( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ),
1237
-            __( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ),
1238
-            __( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ),
1239
-            __( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ),
1240
-            __( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ),
1241
-            __( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ),
1242
-            __( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ),
1243
-            __( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ),
1244
-            __( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ),
1245
-            __( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ),
1246
-            __( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ),
1247
-            __( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ),
1248
-            __( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ),
1249
-            __( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ),
1250
-            __( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ),
1251
-            __( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ),
1252
-            __( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ),
1253
-            __( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ),
1254
-            __( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ),
1255
-            __( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ),
1256
-            __( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ),
1257
-            __( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ),
1258
-            __( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ),
1259
-            __( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ),
1260
-            __( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ),
1261
-            __( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ),
1262
-            __( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ),
1263
-            __( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ),
1264
-            __( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ),
1265
-            __( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ),
1266
-            __( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ),
1267
-            __( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ),
1268
-            __( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ),
1269
-            __( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ),
1270
-            __( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ),
1271
-            __( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ),
1272
-            __( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ),
1273
-            __( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ),
1274
-            __( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ),
1275
-            __( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ),
1276
-            __( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ),
1277
-            __( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ),
1278
-            __( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ),
1279
-            __( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ),
1280
-            __( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ),
1281
-            __( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ),
1282
-            __( 'Zimbabwe', 'formidable' ),
1283
-        ) );
1284
-    }
1179
+				$val[ $k ] = str_replace( $replace, $replace_with, $v );
1180
+				unset($k, $v);
1181
+			}
1182
+		} else {
1183
+			$val = str_replace($replace, $replace_with, $val);
1184
+		}
1185
+
1186
+		return $val;
1187
+	}
1188
+
1189
+	public static function get_us_states() {
1190
+		return apply_filters( 'frm_us_states', array(
1191
+			'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona',
1192
+			'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware',
1193
+			'DC' => 'District of Columbia',
1194
+			'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho',
1195
+			'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas',
1196
+			'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland',
1197
+			'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi',
1198
+			'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada',
1199
+			'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York',
1200
+			'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma',
1201
+			'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina',
1202
+			'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah',
1203
+			'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia',
1204
+			'WI' => 'Wisconsin', 'WY' => 'Wyoming',
1205
+		) );
1206
+	}
1207
+
1208
+	public static function get_countries() {
1209
+		return apply_filters( 'frm_countries', array(
1210
+			__( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ),
1211
+			__( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ),
1212
+			__( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ),
1213
+			__( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ),
1214
+			__( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ),
1215
+			__( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ),
1216
+			__( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ),
1217
+			__( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ),
1218
+			__( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ),
1219
+			__( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ),
1220
+			__( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ),
1221
+			__( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ),
1222
+			__( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ),
1223
+			__( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ),
1224
+			__( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ),
1225
+			__( 'Costa Rica', 'formidable' ), __( 'C&ocirc;te d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ),
1226
+			__( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ),
1227
+			__( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ),
1228
+			__( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ),
1229
+			__( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ),
1230
+			__( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ),
1231
+			__( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ),
1232
+			__( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ),
1233
+			__( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ),
1234
+			__( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ),
1235
+			__( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ),
1236
+			__( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ),
1237
+			__( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ),
1238
+			__( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ),
1239
+			__( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ),
1240
+			__( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ),
1241
+			__( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ),
1242
+			__( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ),
1243
+			__( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ),
1244
+			__( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ),
1245
+			__( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ),
1246
+			__( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ),
1247
+			__( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ),
1248
+			__( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ),
1249
+			__( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ),
1250
+			__( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ),
1251
+			__( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ),
1252
+			__( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ),
1253
+			__( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ),
1254
+			__( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ),
1255
+			__( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ),
1256
+			__( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ),
1257
+			__( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ),
1258
+			__( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ),
1259
+			__( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ),
1260
+			__( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ),
1261
+			__( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ),
1262
+			__( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ),
1263
+			__( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ),
1264
+			__( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ),
1265
+			__( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ),
1266
+			__( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ),
1267
+			__( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ),
1268
+			__( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ),
1269
+			__( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ),
1270
+			__( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ),
1271
+			__( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ),
1272
+			__( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ),
1273
+			__( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ),
1274
+			__( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ),
1275
+			__( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ),
1276
+			__( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ),
1277
+			__( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ),
1278
+			__( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ),
1279
+			__( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ),
1280
+			__( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ),
1281
+			__( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ),
1282
+			__( 'Zimbabwe', 'formidable' ),
1283
+		) );
1284
+	}
1285 1285
 
1286 1286
 	public static function get_bulk_prefilled_opts( array &$prepop ) {
1287 1287
 		$prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries();
1288 1288
 
1289
-        $states = FrmFieldsHelper::get_us_states();
1290
-        $state_abv = array_keys($states);
1291
-        sort($state_abv);
1289
+		$states = FrmFieldsHelper::get_us_states();
1290
+		$state_abv = array_keys($states);
1291
+		sort($state_abv);
1292 1292
 		$prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
1293 1293
 
1294
-        $states = array_values($states);
1295
-        sort($states);
1294
+		$states = array_values($states);
1295
+		sort($states);
1296 1296
 		$prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
1297
-        unset($state_abv, $states);
1297
+		unset($state_abv, $states);
1298 1298
 
1299 1299
 		$prepop[ __( 'Age', 'formidable' ) ] = array(
1300
-            __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ),
1301
-            __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ),
1302
-            __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ),
1303
-        );
1300
+			__( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ),
1301
+			__( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ),
1302
+			__( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ),
1303
+		);
1304 1304
 
1305 1305
 		$prepop[ __( 'Satisfaction', 'formidable' ) ] = array(
1306
-            __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ),
1307
-            __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ),
1308
-        );
1306
+			__( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ),
1307
+			__( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ),
1308
+		);
1309 1309
 
1310 1310
 		$prepop[ __( 'Importance', 'formidable' ) ] = array(
1311
-            __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ),
1312
-            __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ),
1313
-        );
1311
+			__( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ),
1312
+			__( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ),
1313
+		);
1314 1314
 
1315 1315
 		$prepop[ __( 'Agreement', 'formidable' ) ] = array(
1316
-            __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ),
1317
-            __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ),
1318
-        );
1316
+			__( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ),
1317
+			__( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ),
1318
+		);
1319 1319
 
1320 1320
 		$prepop = apply_filters( 'frm_bulk_field_choices', $prepop );
1321
-    }
1321
+	}
1322 1322
 
1323 1323
 	/**
1324 1324
 	 * Display a field value selector
@@ -1328,10 +1328,10 @@  discard block
 block discarded – undo
1328 1328
 	 * @param int $selector_field_id
1329 1329
 	 * @param array $selector_args
1330 1330
 	 */
1331
-    public static function display_field_value_selector( $selector_field_id, $selector_args ) {
1332
-	    $field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args );
1333
-	    $field_value_selector->display();
1334
-    }
1331
+	public static function display_field_value_selector( $selector_field_id, $selector_args ) {
1332
+		$field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args );
1333
+		$field_value_selector->display();
1334
+	}
1335 1335
 
1336 1336
 	/**
1337 1337
 	 * Convert a field object to a flat array
@@ -1384,10 +1384,10 @@  discard block
 block discarded – undo
1384 1384
 		return FrmField::is_required( $field );
1385 1385
 	}
1386 1386
 
1387
-    public static function maybe_get_field( &$field ) {
1387
+	public static function maybe_get_field( &$field ) {
1388 1388
 		_deprecated_function( __FUNCTION__, '2.0.9', 'FrmField::maybe_get_field' );
1389 1389
 		FrmField::maybe_get_field( $field );
1390
-    }
1390
+	}
1391 1391
 
1392 1392
 	public static function dropdown_categories( $args ) {
1393 1393
 		_deprecated_function( __FUNCTION__, '2.02.07', 'FrmProPost::get_category_dropdown' );
Please login to merge, or discard this patch.
Spacing   +152 added lines, -152 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,8 +7,8 @@  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 14
 		$values = self::get_default_field( $type );
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 			if ( in_array( $type, array( 'data', 'lookup' ) ) ) {
26 26
 				$values['field_options']['data_type'] = $setting;
27 27
 			} else {
28
-				$values['field_options'][ $setting ] = 1;
28
+				$values['field_options'][$setting] = 1;
29 29
 			}
30 30
 		}
31 31
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
             $values['form_name'] = '';
54 54
 		} else {
55 55
 			foreach ( $defaults as $var => $default ) {
56
-                $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' );
57
-                unset($var, $default);
56
+                $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' );
57
+                unset( $var, $default );
58 58
             }
59 59
 
60 60
 			$values['form_name'] = $record->form_id ? FrmForm::getName( $record->form_id ) : '';
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
 		$defaults = self::get_default_field_options( $values['type'] );
69 69
 
70 70
 		foreach ( $defaults as $opt => $default ) {
71
-            $values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default;
72
-            unset($opt, $default);
71
+            $values[$opt] = isset( $record->field_options[$opt] ) ? $record->field_options[$opt] : $default;
72
+            unset( $opt, $default );
73 73
         }
74 74
 
75
-        $values['custom_html'] = (isset($record->field_options['custom_html'])) ? $record->field_options['custom_html'] : self::get_default_html($record->type);
75
+        $values['custom_html'] = ( isset( $record->field_options['custom_html'] ) ) ? $record->field_options['custom_html'] : self::get_default_html( $record->type );
76 76
 
77 77
 		return apply_filters( 'frm_setup_edit_field_vars', $values, array( 'doing_ajax' => $doing_ajax ) );
78 78
     }
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 
110 110
 		$values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' );
111 111
         $values['form_id'] = $form_id;
112
-        $values['options'] = maybe_serialize($field->options);
113
-        $values['default_value'] = maybe_serialize($field->default_value);
112
+        $values['options'] = maybe_serialize( $field->options );
113
+        $values['default_value'] = maybe_serialize( $field->default_value );
114 114
 
115 115
         foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
116
-            $values[ $col ] = $field->{$col};
116
+            $values[$col] = $field->{$col};
117 117
         }
118 118
     }
119 119
 
@@ -127,14 +127,14 @@  discard block
 block discarded – undo
127 127
 
128 128
 		$conf_msg = __( 'The entered values do not match', 'formidable' );
129 129
 		$defaults = array(
130
-			'unique_msg' => array( 'full' => $default_settings['unique_msg'], 'part' => sprintf( __('%s must be unique', 'formidable' ), $field_name ) ),
131
-			'invalid'   => array( 'full' => __( 'This field is invalid', 'formidable' ), 'part' => sprintf( __('%s is invalid', 'formidable' ), $field_name ) ),
130
+			'unique_msg' => array( 'full' => $default_settings['unique_msg'], 'part' => sprintf( __( '%s must be unique', 'formidable' ), $field_name ) ),
131
+			'invalid'   => array( 'full' => __( 'This field is invalid', 'formidable' ), 'part' => sprintf( __( '%s is invalid', 'formidable' ), $field_name ) ),
132 132
 			'blank'     => array( 'full' => $frm_settings->blank_msg, 'part' => $frm_settings->blank_msg ),
133 133
 			'conf_msg'  => array( 'full' => $conf_msg, 'part' => $conf_msg ),
134 134
 		);
135 135
 
136 136
 		$msg = FrmField::get_option( $field, $error );
137
-		$msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg;
137
+		$msg = empty( $msg ) ? $defaults[$error]['part'] : $msg;
138 138
 		$msg = do_shortcode( $msg );
139 139
 		return $msg;
140 140
 	}
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 			$default_html = apply_filters( 'frm_other_custom_html', '', $type );
154 154
 		}
155 155
 
156
-		return apply_filters('frm_custom_html', $default_html, $type);
156
+		return apply_filters( 'frm_custom_html', $default_html, $type );
157 157
 	}
158 158
 
159 159
 	public static function show_fields( $fields, $errors, $form, $form_action ) {
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 			} else {
170 170
 				do_action( 'frm_show_other_field_type', $field, $form, array( 'action' => $form_action ) );
171 171
 			}
172
-			do_action('frm_get_field_scripts', $field, $form, $form->id);
172
+			do_action( 'frm_get_field_scripts', $field, $form, $form->id );
173 173
 		}
174 174
 	}
175 175
 
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
 
179 179
 		$user_ID = get_current_user_id();
180 180
 		$user_ID = ( $user_ID ? $user_ID : '' );
181
-		$posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][ $field['id'] ] ) );
181
+		$posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][$field['id']] ) );
182 182
 		$updating = ( isset( $args['action'] ) && $args['action'] == 'update' );
183 183
 		$value = ( is_numeric( $field['value'] ) || $posted_value || $updating ) ? $field['value'] : $user_ID;
184 184
 
185
-		echo '<input type="hidden" name="' . esc_attr( $args['field_name'] ) . '" id="' . esc_attr( $args['html_id'] ) . '" value="' . esc_attr( $value ) . '" data-frmval="' . esc_attr( $value ) . '"/>'."\n";
185
+		echo '<input type="hidden" name="' . esc_attr( $args['field_name'] ) . '" id="' . esc_attr( $args['html_id'] ) . '" value="' . esc_attr( $value ) . '" data-frmval="' . esc_attr( $value ) . '"/>' . "\n";
186 186
 	}
187 187
 
188 188
 	private static function show_hidden_field( $field ) {
@@ -196,44 +196,44 @@  discard block
 block discarded – undo
196 196
 	}
197 197
 
198 198
 	public static function replace_shortcodes( $html, $field, $errors = array(), $form = false, $args = array() ) {
199
-        $html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form);
199
+        $html = apply_filters( 'frm_before_replace_shortcodes', $html, $field, $errors, $form );
200 200
 
201 201
         $args = self::fill_display_field_values( $field, $args );
202 202
         $field_name = $args['field_name'];
203 203
         $field_id = $args['field_id'];
204 204
         $html_id = $args['html_id'];
205 205
 
206
-        if ( FrmField::is_multiple_select($field) ) {
206
+        if ( FrmField::is_multiple_select( $field ) ) {
207 207
             $field_name .= '[]';
208 208
         }
209 209
 
210 210
         //replace [id]
211
-        $html = str_replace('[id]', $field_id, $html);
211
+        $html = str_replace( '[id]', $field_id, $html );
212 212
 
213 213
         // Remove the for attribute for captcha
214 214
         if ( $field['type'] == 'captcha' ) {
215
-            $html = str_replace(' for="field_[key]"', '', $html);
215
+            $html = str_replace( ' for="field_[key]"', '', $html );
216 216
 		}
217 217
 
218 218
         // set the label for
219
-        $html = str_replace('field_[key]', $html_id, $html);
219
+        $html = str_replace( 'field_[key]', $html_id, $html );
220 220
 
221 221
         //replace [key]
222
-        $html = str_replace('[key]', $field['field_key'], $html);
222
+        $html = str_replace( '[key]', $field['field_key'], $html );
223 223
 
224 224
         //replace [description] and [required_label] and [error]
225 225
 		$required = FrmField::is_required( $field ) ? $field['required_indicator'] : '';
226 226
         if ( ! is_array( $errors ) ) {
227 227
             $errors = array();
228 228
         }
229
-		$error = isset( $errors[ 'field' . $field_id ] ) ? $errors[ 'field' . $field_id ] : false;
229
+		$error = isset( $errors['field' . $field_id] ) ? $errors['field' . $field_id] : false;
230 230
 
231 231
         //If field type is section heading, add class so a bottom margin can be added to either the h3 or description
232 232
         if ( $field['type'] == 'divider' ) {
233 233
             if ( FrmField::is_option_true( $field, 'description' ) ) {
234 234
                 $html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html );
235 235
             } else {
236
-                $html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html);
236
+                $html = str_replace( '[label_position]', '[label_position] frm_section_spacing', $html );
237 237
             }
238 238
         }
239 239
 
@@ -243,53 +243,53 @@  discard block
 block discarded – undo
243 243
 
244 244
         //replace [required_class]
245 245
 		$required_class = FrmField::is_required( $field ) ? ' frm_required_field' : '';
246
-        $html = str_replace('[required_class]', $required_class, $html);
246
+        $html = str_replace( '[required_class]', $required_class, $html );
247 247
 
248 248
         //replace [label_position]
249
-        $field['label'] = apply_filters('frm_html_label_position', $field['label'], $field, $form);
249
+        $field['label'] = apply_filters( 'frm_html_label_position', $field['label'], $field, $form );
250 250
         $field['label'] = ( $field['label'] && $field['label'] != '' ) ? $field['label'] : 'top';
251 251
 		$html = str_replace( '[label_position]', ( ( in_array( $field['type'], array( 'divider', 'end_divider', 'break' ) ) ) ? $field['label'] : ' frm_primary_label' ), $html );
252 252
 
253 253
         //replace [field_name]
254
-        $html = str_replace('[field_name]', $field['name'], $html);
254
+        $html = str_replace( '[field_name]', $field['name'], $html );
255 255
 
256 256
 		self::add_field_div_classes( $field_id, $field, $errors, $html );
257 257
 
258 258
         //replace [entry_key]
259 259
         $entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' );
260
-        $html = str_replace('[entry_key]', $entry_key, $html);
260
+        $html = str_replace( '[entry_key]', $entry_key, $html );
261 261
 
262 262
 		if ( $form ) {
263 263
 			$form = (array) $form;
264 264
 
265 265
 			//replace [form_key]
266
-			$html = str_replace('[form_key]', $form['form_key'], $html);
266
+			$html = str_replace( '[form_key]', $form['form_key'], $html );
267 267
 
268 268
 			//replace [form_name]
269
-			$html = str_replace('[form_name]', $form['name'], $html);
269
+			$html = str_replace( '[form_name]', $form['name'], $html );
270 270
 		}
271 271
 
272 272
 		self::process_wp_shortcodes( $html );
273 273
 
274 274
         //replace [input]
275
-        preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER);
275
+        preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER );
276 276
         global $frm_vars;
277 277
         $frm_settings = FrmAppHelper::get_settings();
278 278
 
279 279
         foreach ( $shortcodes[0] as $short_key => $tag ) {
280
-            $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
280
+            $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] );
281 281
 			$tag = self::get_shortcode_tag( $shortcodes, $short_key, array( 'conditional' => false, 'conditional_check' => false ) );
282 282
 
283 283
             $replace_with = '';
284 284
 
285 285
             if ( $tag == 'input' ) {
286
-                if ( isset($atts['opt']) ) {
287
-                    $atts['opt']--;
286
+                if ( isset( $atts['opt'] ) ) {
287
+                    $atts['opt'] --;
288 288
                 }
289 289
 
290
-                $field['input_class'] = isset($atts['class']) ? $atts['class'] : '';
291
-                if ( isset($atts['class']) ) {
292
-                    unset($atts['class']);
290
+                $field['input_class'] = isset( $atts['class'] ) ? $atts['class'] : '';
291
+                if ( isset( $atts['class'] ) ) {
292
+                    unset( $atts['class'] );
293 293
                 }
294 294
 
295 295
                 $field['shortcodes'] = $atts;
@@ -298,24 +298,24 @@  discard block
 block discarded – undo
298 298
                 $replace_with = ob_get_contents();
299 299
                 ob_end_clean();
300 300
             } else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) {
301
-                $replace_with = FrmProEntriesController::entry_delete_link($atts);
301
+                $replace_with = FrmProEntriesController::entry_delete_link( $atts );
302 302
             }
303 303
 
304
-            $html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html );
304
+            $html = str_replace( $shortcodes[0][$short_key], $replace_with, $html );
305 305
         }
306 306
 
307 307
         $html .= "\n";
308 308
 
309 309
         //Return html if conf_field to prevent loop
310
-        if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) {
310
+        if ( isset( $field['conf_field'] ) && $field['conf_field'] == 'stop' ) {
311 311
             return $html;
312 312
         }
313 313
 
314 314
         //If field is in repeating section
315 315
         if ( $args['section_id'] ) {
316
-            $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'] ));
316
+            $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'] ) );
317 317
         } else {
318
-            $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form ));
318
+            $html = apply_filters( 'frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form ) );
319 319
         }
320 320
 
321 321
 		self::filter_html_field_shortcodes( $field, $html );
@@ -390,14 +390,14 @@  discard block
 block discarded – undo
390 390
 	 */
391 391
 	private static function get_field_div_classes( $field_id, $field, $errors, $html ) {
392 392
 		// Add error class
393
-		$classes = isset( $errors[ 'field' . $field_id ] ) ? ' frm_blank_field' : '';
393
+		$classes = isset( $errors['field' . $field_id] ) ? ' frm_blank_field' : '';
394 394
 
395 395
 		// Add label position class
396 396
 		$classes .= ' frm_' . $field['label'] . '_container';
397 397
 
398 398
 		// Add CSS layout classes
399 399
 		if ( ! empty( $field['classes'] ) ) {
400
-			if ( ! strpos( $html, 'frm_form_field ') ) {
400
+			if ( ! strpos( $html, 'frm_form_field ' ) ) {
401 401
 				$classes .= ' frm_form_field';
402 402
 			}
403 403
 			$classes .= ' ' . $field['classes'];
@@ -441,15 +441,15 @@  discard block
 block discarded – undo
441 441
         }
442 442
 
443 443
         $with_tags = $args['conditional_check'] ? 3 : 2;
444
-        if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
445
-            $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
446
-            $tag = str_replace(']', '', $tag);
447
-            $tags = explode(' ', $tag);
448
-            if ( is_array($tags) ) {
444
+        if ( ! empty( $shortcodes[$with_tags][$short_key] ) ) {
445
+            $tag = str_replace( '[' . $prefix, '', $shortcodes[0][$short_key] );
446
+            $tag = str_replace( ']', '', $tag );
447
+            $tags = explode( ' ', $tag );
448
+            if ( is_array( $tags ) ) {
449 449
                 $tag = $tags[0];
450 450
             }
451 451
         } else {
452
-            $tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
452
+            $tag = $shortcodes[$with_tags - 1][$short_key];
453 453
         }
454 454
 
455 455
         return $tag;
@@ -509,10 +509,10 @@  discard block
 block discarded – undo
509 509
 
510 510
 	public static function show_single_option( $field ) {
511 511
         $field_name = $field['name'];
512
-        $html_id = self::get_html_id($field);
512
+        $html_id = self::get_html_id( $field );
513 513
         foreach ( $field['options'] as $opt_key => $opt ) {
514
-            $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
515
-            $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
514
+            $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field );
515
+            $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field );
516 516
 
517 517
             // If this is an "Other" option, get the HTML for it
518 518
 			if ( self::is_other_opt( $opt_key ) ) {
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
     }
527 527
 
528 528
 	public static function get_term_link( $tax_id ) {
529
-        $tax = get_taxonomy($tax_id);
529
+        $tax = get_taxonomy( $tax_id );
530 530
         if ( ! $tax ) {
531 531
             return;
532 532
         }
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
             __( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
536 536
 			'<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>'
537 537
         );
538
-        unset($tax);
538
+        unset( $tax );
539 539
 
540 540
         return $link;
541 541
     }
@@ -549,8 +549,8 @@  discard block
 block discarded – undo
549 549
 		$observed_value = wp_kses_post( $observed_value );
550 550
 		$hide_opt = wp_kses_post( $hide_opt );
551 551
 
552
-        if ( is_array($observed_value) ) {
553
-            return self::array_value_condition($observed_value, $cond, $hide_opt);
552
+        if ( is_array( $observed_value ) ) {
553
+            return self::array_value_condition( $observed_value, $cond, $hide_opt );
554 554
         }
555 555
 
556 556
         $m = false;
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
         } else if ( $cond == '<' ) {
564 564
             $m = $observed_value < $hide_opt;
565 565
         } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
566
-            $m = stripos($observed_value, $hide_opt);
566
+            $m = stripos( $observed_value, $hide_opt );
567 567
             if ( $cond == 'not LIKE' ) {
568 568
                 $m = ( $m === false ) ? true : false;
569 569
             } else {
@@ -576,23 +576,23 @@  discard block
 block discarded – undo
576 576
 	public static function array_value_condition( $observed_value, $cond, $hide_opt ) {
577 577
         $m = false;
578 578
         if ( $cond == '==' ) {
579
-            if ( is_array($hide_opt) ) {
580
-                $m = array_intersect($hide_opt, $observed_value);
581
-                $m = empty($m) ? false : true;
579
+            if ( is_array( $hide_opt ) ) {
580
+                $m = array_intersect( $hide_opt, $observed_value );
581
+                $m = empty( $m ) ? false : true;
582 582
             } else {
583
-                $m = in_array($hide_opt, $observed_value);
583
+                $m = in_array( $hide_opt, $observed_value );
584 584
             }
585 585
         } else if ( $cond == '!=' ) {
586
-            $m = ! in_array($hide_opt, $observed_value);
586
+            $m = ! in_array( $hide_opt, $observed_value );
587 587
         } else if ( $cond == '>' ) {
588
-            $min = min($observed_value);
588
+            $min = min( $observed_value );
589 589
             $m = $min > $hide_opt;
590 590
         } else if ( $cond == '<' ) {
591
-            $max = max($observed_value);
591
+            $max = max( $observed_value );
592 592
             $m = $max < $hide_opt;
593 593
         } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
594 594
             foreach ( $observed_value as $ob ) {
595
-                $m = strpos($ob, $hide_opt);
595
+                $m = strpos( $ob, $hide_opt );
596 596
                 if ( $m !== false ) {
597 597
                     $m = true;
598 598
                     break;
@@ -613,27 +613,27 @@  discard block
 block discarded – undo
613 613
      * @return string
614 614
      */
615 615
 	public static function basic_replace_shortcodes( $value, $form, $entry ) {
616
-        if ( strpos($value, '[sitename]') !== false ) {
616
+        if ( strpos( $value, '[sitename]' ) !== false ) {
617 617
             $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
618
-            $value = str_replace('[sitename]', $new_value, $value);
618
+            $value = str_replace( '[sitename]', $new_value, $value );
619 619
         }
620 620
 
621
-        $value = apply_filters('frm_content', $value, $form, $entry);
622
-        $value = do_shortcode($value);
621
+        $value = apply_filters( 'frm_content', $value, $form, $entry );
622
+        $value = do_shortcode( $value );
623 623
 
624 624
         return $value;
625 625
     }
626 626
 
627 627
 	public static function get_shortcodes( $content, $form_id ) {
628 628
         if ( FrmAppHelper::pro_is_installed() ) {
629
-            return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
629
+            return FrmProDisplaysHelper::get_shortcodes( $content, $form_id );
630 630
         }
631 631
 
632 632
         $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) );
633 633
 
634
-        $tagregexp = self::allowed_shortcodes($fields);
634
+        $tagregexp = self::allowed_shortcodes( $fields );
635 635
 
636
-        preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
636
+        preg_match_all( "/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER );
637 637
 
638 638
         return $matches;
639 639
     }
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
             $tagregexp[] = $field->field_key;
652 652
         }
653 653
 
654
-        $tagregexp = implode('|', $tagregexp);
654
+        $tagregexp = implode( '|', $tagregexp );
655 655
         return $tagregexp;
656 656
     }
657 657
 
@@ -667,28 +667,28 @@  discard block
 block discarded – undo
667 667
 				continue;
668 668
 			}
669 669
 
670
-            $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] );
670
+            $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] );
671 671
 
672
-            if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
673
-				$tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] );
674
-                $tags = explode(' ', $tag);
675
-                if ( is_array($tags) ) {
672
+            if ( ! empty( $shortcodes[3][$short_key] ) ) {
673
+				$tag = str_replace( array( '[', ']' ), '', $shortcodes[0][$short_key] );
674
+                $tags = explode( ' ', $tag );
675
+                if ( is_array( $tags ) ) {
676 676
                     $tag = $tags[0];
677 677
                 }
678 678
             } else {
679
-                $tag = $shortcodes[2][ $short_key ];
679
+                $tag = $shortcodes[2][$short_key];
680 680
             }
681 681
 
682 682
             switch ( $tag ) {
683 683
                 case 'id':
684 684
                 case 'key':
685 685
                 case 'ip':
686
-                    $replace_with = $shortcode_values[ $tag ];
686
+                    $replace_with = $shortcode_values[$tag];
687 687
                 break;
688 688
 
689 689
                 case 'user_agent':
690 690
                 case 'user-agent':
691
-                    $entry->description = maybe_unserialize($entry->description);
691
+                    $entry->description = maybe_unserialize( $entry->description );
692 692
 					$replace_with = FrmEntriesHelper::get_browser( $entry->description['browser'] );
693 693
                 break;
694 694
 
@@ -696,25 +696,25 @@  discard block
 block discarded – undo
696 696
                 case 'created-at':
697 697
                 case 'updated_at':
698 698
                 case 'updated-at':
699
-                    if ( isset($atts['format']) ) {
699
+                    if ( isset( $atts['format'] ) ) {
700 700
                         $time_format = ' ';
701 701
                     } else {
702
-                        $atts['format'] = get_option('date_format');
702
+                        $atts['format'] = get_option( 'date_format' );
703 703
                         $time_format = '';
704 704
                     }
705 705
 
706
-                    $this_tag = str_replace('-', '_', $tag);
707
-                    $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
708
-                    unset($this_tag);
706
+                    $this_tag = str_replace( '-', '_', $tag );
707
+                    $replace_with = FrmAppHelper::get_formatted_time( $entry->{$this_tag}, $atts['format'], $time_format );
708
+                    unset( $this_tag );
709 709
                 break;
710 710
 
711 711
                 case 'created_by':
712 712
                 case 'created-by':
713 713
                 case 'updated_by':
714 714
                 case 'updated-by':
715
-                    $this_tag = str_replace('-', '_', $tag);
715
+                    $this_tag = str_replace( '-', '_', $tag );
716 716
 					$replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts );
717
-                    unset($this_tag);
717
+                    unset( $this_tag );
718 718
                 break;
719 719
 
720 720
                 case 'admin_email':
@@ -731,16 +731,16 @@  discard block
 block discarded – undo
731 731
                         break;
732 732
                     }
733 733
 
734
-                    $sep = isset($atts['sep']) ? $atts['sep'] : ', ';
734
+                    $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', ';
735 735
 
736 736
                     $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
737 737
 
738 738
                     $atts['entry_id'] = $entry->id;
739 739
                     $atts['entry_key'] = $entry->item_key;
740 740
 
741
-                    if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
741
+                    if ( isset( $atts['show'] ) && $atts['show'] == 'field_label' ) {
742 742
                         $replace_with = $field->name;
743
-                    } else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
743
+                    } else if ( isset( $atts['show'] ) && $atts['show'] == 'description' ) {
744 744
                         $replace_with = $field->description;
745 745
 					} else {
746 746
 						$string_value = $replace_with;
@@ -755,15 +755,15 @@  discard block
 block discarded – undo
755 755
 						}
756 756
 					}
757 757
 
758
-                    unset($field);
758
+                    unset( $field );
759 759
                 break;
760 760
             }
761 761
 
762
-            if ( isset($replace_with) ) {
763
-                $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
762
+            if ( isset( $replace_with ) ) {
763
+                $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content );
764 764
             }
765 765
 
766
-            unset($atts, $conditional, $replace_with);
766
+            unset( $atts, $conditional, $replace_with );
767 767
 		}
768 768
 
769 769
 		return $content;
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
         $new_value = '';
780 780
         switch ( $tag ) {
781 781
             case 'admin_email':
782
-                $new_value = get_option('admin_email');
782
+                $new_value = get_option( 'admin_email' );
783 783
                 break;
784 784
             case 'siteurl':
785 785
                 $new_value = FrmAppHelper::site_url();
@@ -805,28 +805,28 @@  discard block
 block discarded – undo
805 805
      * @return string|array
806 806
      */
807 807
     public static function process_get_shortcode( $atts, $return_array = false ) {
808
-        if ( ! isset($atts['param']) ) {
808
+        if ( ! isset( $atts['param'] ) ) {
809 809
             return '';
810 810
         }
811 811
 
812
-        if ( strpos($atts['param'], '&#91;') ) {
813
-            $atts['param'] = str_replace('&#91;', '[', $atts['param']);
814
-            $atts['param'] = str_replace('&#93;', ']', $atts['param']);
812
+        if ( strpos( $atts['param'], '&#91;' ) ) {
813
+            $atts['param'] = str_replace( '&#91;', '[', $atts['param'] );
814
+            $atts['param'] = str_replace( '&#93;', ']', $atts['param'] );
815 815
         }
816 816
 
817
-        $new_value = FrmAppHelper::get_param($atts['param'], '');
817
+        $new_value = FrmAppHelper::get_param( $atts['param'], '' );
818 818
         $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
819 819
 
820 820
         if ( $new_value == '' ) {
821
-            if ( ! isset($atts['prev_val']) ) {
821
+            if ( ! isset( $atts['prev_val'] ) ) {
822 822
                 $atts['prev_val'] = '';
823 823
             }
824 824
 
825
-            $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
825
+            $new_value = isset( $atts['default'] ) ? $atts['default'] : $atts['prev_val'];
826 826
         }
827 827
 
828
-        if ( is_array($new_value) && ! $return_array ) {
829
-            $new_value = implode(', ', $new_value);
828
+        if ( is_array( $new_value ) && ! $return_array ) {
829
+            $new_value = implode( ', ', $new_value );
830 830
         }
831 831
 
832 832
         return $new_value;
@@ -839,17 +839,17 @@  discard block
 block discarded – undo
839 839
 		$replace_with = apply_filters( 'frm_get_display_value', $replace_with, $field, $atts );
840 840
 
841 841
         if ( $field->type == 'textarea' || $field->type == 'rte' ) {
842
-            $autop = isset($atts['wpautop']) ? $atts['wpautop'] : true;
843
-            if ( apply_filters('frm_use_wpautop', $autop) ) {
844
-                if ( is_array($replace_with) ) {
845
-                    $replace_with = implode("\n", $replace_with);
842
+            $autop = isset( $atts['wpautop'] ) ? $atts['wpautop'] : true;
843
+            if ( apply_filters( 'frm_use_wpautop', $autop ) ) {
844
+                if ( is_array( $replace_with ) ) {
845
+                    $replace_with = implode( "\n", $replace_with );
846 846
                 }
847
-                $replace_with = wpautop($replace_with);
847
+                $replace_with = wpautop( $replace_with );
848 848
             }
849 849
 			unset( $autop );
850 850
 		} else if ( is_array( $replace_with ) ) {
851
-			if ( $atts['show'] && isset( $replace_with[ $atts['show'] ] ) ) {
852
-				$replace_with = $replace_with[ $atts['show'] ];
851
+			if ( $atts['show'] && isset( $replace_with[$atts['show']] ) ) {
852
+				$replace_with = $replace_with[$atts['show']];
853 853
 			} else {
854 854
 				$replace_with = implode( $sep, $replace_with );
855 855
 			}
@@ -870,14 +870,14 @@  discard block
 block discarded – undo
870 870
 		$field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() );
871 871
 
872 872
         $field_types = array();
873
-        if ( in_array($type, $single_input) ) {
873
+        if ( in_array( $type, $single_input ) ) {
874 874
             self::field_types_for_input( $single_input, $field_selection, $field_types );
875
-        } else if ( in_array($type, $multiple_input) ) {
875
+        } else if ( in_array( $type, $multiple_input ) ) {
876 876
             self::field_types_for_input( $multiple_input, $field_selection, $field_types );
877
-        } else if ( in_array($type, $other_type) ) {
877
+        } else if ( in_array( $type, $other_type ) ) {
878 878
             self::field_types_for_input( $other_type, $field_selection, $field_types );
879
-		} else if ( isset( $field_selection[ $type ] ) ) {
880
-            $field_types[ $type ] = $field_selection[ $type ];
879
+		} else if ( isset( $field_selection[$type] ) ) {
880
+            $field_types[$type] = $field_selection[$type];
881 881
         }
882 882
 
883 883
 		$field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) );
@@ -886,8 +886,8 @@  discard block
 block discarded – undo
886 886
 
887 887
     private static function field_types_for_input( $inputs, $fields, &$field_types ) {
888 888
         foreach ( $inputs as $input ) {
889
-            $field_types[ $input ] = $fields[ $input ];
890
-            unset($input);
889
+            $field_types[$input] = $fields[$input];
890
+            unset( $input );
891 891
         }
892 892
     }
893 893
 
@@ -932,21 +932,21 @@  discard block
 block discarded – undo
932 932
 		// Check posted vals before checking saved values
933 933
 
934 934
 		// For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
935
-		if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) {
935
+		if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) {
936 936
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
937
-				$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 ] ) : '';
937
+				$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] ) : '';
938 938
 			} else {
939
-				$other_val = sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] );
939
+				$other_val = sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] );
940 940
 			}
941 941
 			return $other_val;
942 942
 
943
-		} else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) {
943
+		} else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) {
944 944
 			// For normal fields
945 945
 
946 946
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
947
-				$other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) : '';
947
+				$other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta']['other'][$field['id']][$opt_key] ) : '';
948 948
 			} else {
949
-				$other_val = sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ] );
949
+				$other_val = sanitize_text_field( $_POST['item_meta']['other'][$field['id']] );
950 950
 			}
951 951
 			return $other_val;
952 952
 		}
@@ -955,8 +955,8 @@  discard block
 block discarded – undo
955 955
 		if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) {
956 956
 			// Check if there is an "other" val in saved value and make sure the
957 957
 			// "other" val is not equal to the Other checkbox option
958
-			if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) {
959
-				$other_val = $field['value'][ $opt_key ];
958
+			if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) {
959
+				$other_val = $field['value'][$opt_key];
960 960
 			}
961 961
 		} else {
962 962
 			/**
@@ -968,8 +968,8 @@  discard block
 block discarded – undo
968 968
 				// Multi-select dropdowns - key is not preserved
969 969
 				if ( is_array( $field['value'] ) ) {
970 970
 					$o_key = array_search( $temp_val, $field['value'] );
971
-					if ( isset( $field['value'][ $o_key ] ) ) {
972
-						unset( $field['value'][ $o_key ], $o_key );
971
+					if ( isset( $field['value'][$o_key] ) ) {
972
+						unset( $field['value'][$o_key], $o_key );
973 973
 					}
974 974
 				} else if ( $temp_val == $field['value'] ) {
975 975
 					// For radio and regular dropdowns
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
 	private static function set_other_name( $args, &$other_args ) {
1027 1027
 		//Set up name for other field
1028 1028
 		$other_args['name'] = str_replace( '[]', '', $args['field_name'] );
1029
-		$other_args['name'] = preg_replace('/\[' . $args['field']['id'] . '\]$/', '', $other_args['name']);
1029
+		$other_args['name'] = preg_replace( '/\[' . $args['field']['id'] . '\]$/', '', $other_args['name'] );
1030 1030
 		$other_args['name'] = $other_args['name'] . '[other]' . '[' . $args['field']['id'] . ']';
1031 1031
 
1032 1032
 		//Converts item_meta[field_id] => item_meta[other][field_id] and
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
 		// Count should only be greater than 3 if inside of a repeating section
1054 1054
 		if ( count( $temp_array ) > 3 ) {
1055 1055
 			$parent = str_replace( ']', '', $temp_array[1] );
1056
-			$pointer = str_replace( ']', '', $temp_array[2]);
1056
+			$pointer = str_replace( ']', '', $temp_array[2] );
1057 1057
 		}
1058 1058
 
1059 1059
 		// Get text for "other" text field
@@ -1172,15 +1172,15 @@  discard block
 block discarded – undo
1172 1172
 			$replace_with[] = '[' . $new . ']';
1173 1173
 			$replace[] = '[' . $old . ' ';
1174 1174
 			$replace_with[] = '[' . $new . ' ';
1175
-            unset($old, $new);
1175
+            unset( $old, $new );
1176 1176
         }
1177 1177
 		if ( is_array( $val ) ) {
1178 1178
 			foreach ( $val as $k => $v ) {
1179
-                $val[ $k ] = str_replace( $replace, $replace_with, $v );
1180
-                unset($k, $v);
1179
+                $val[$k] = str_replace( $replace, $replace_with, $v );
1180
+                unset( $k, $v );
1181 1181
             }
1182 1182
         } else {
1183
-            $val = str_replace($replace, $replace_with, $val);
1183
+            $val = str_replace( $replace, $replace_with, $val );
1184 1184
         }
1185 1185
 
1186 1186
         return $val;
@@ -1193,7 +1193,7 @@  discard block
 block discarded – undo
1193 1193
             'DC' => 'District of Columbia',
1194 1194
             'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho',
1195 1195
             'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas',
1196
-            'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland',
1196
+            'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine', 'MD' => 'Maryland',
1197 1197
             'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi',
1198 1198
             'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada',
1199 1199
             'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York',
@@ -1284,35 +1284,35 @@  discard block
 block discarded – undo
1284 1284
     }
1285 1285
 
1286 1286
 	public static function get_bulk_prefilled_opts( array &$prepop ) {
1287
-		$prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries();
1287
+		$prepop[__( 'Countries', 'formidable' )] = FrmFieldsHelper::get_countries();
1288 1288
 
1289 1289
         $states = FrmFieldsHelper::get_us_states();
1290
-        $state_abv = array_keys($states);
1291
-        sort($state_abv);
1292
-		$prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
1290
+        $state_abv = array_keys( $states );
1291
+        sort( $state_abv );
1292
+		$prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv;
1293 1293
 
1294
-        $states = array_values($states);
1295
-        sort($states);
1296
-		$prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
1297
-        unset($state_abv, $states);
1294
+        $states = array_values( $states );
1295
+        sort( $states );
1296
+		$prepop[__( 'U.S. States', 'formidable' )] = $states;
1297
+        unset( $state_abv, $states );
1298 1298
 
1299
-		$prepop[ __( 'Age', 'formidable' ) ] = array(
1299
+		$prepop[__( 'Age', 'formidable' )] = array(
1300 1300
             __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ),
1301 1301
             __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ),
1302 1302
             __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ),
1303 1303
         );
1304 1304
 
1305
-		$prepop[ __( 'Satisfaction', 'formidable' ) ] = array(
1305
+		$prepop[__( 'Satisfaction', 'formidable' )] = array(
1306 1306
             __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ),
1307 1307
             __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ),
1308 1308
         );
1309 1309
 
1310
-		$prepop[ __( 'Importance', 'formidable' ) ] = array(
1310
+		$prepop[__( 'Importance', 'formidable' )] = array(
1311 1311
             __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ),
1312 1312
             __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ),
1313 1313
         );
1314 1314
 
1315
-		$prepop[ __( 'Agreement', 'formidable' ) ] = array(
1315
+		$prepop[__( 'Agreement', 'formidable' )] = array(
1316 1316
             __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ),
1317 1317
             __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ),
1318 1318
         );
Please login to merge, or discard this patch.
classes/factories/FrmFieldFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
 			'captcha'  => 'FrmFieldCaptcha',
65 65
 		);
66 66
 
67
-		$class = isset( $type_classes[ $field_type ] ) ? $type_classes[ $field_type ] : '';
67
+		$class = isset( $type_classes[$field_type] ) ? $type_classes[$field_type] : '';
68 68
 		$class = apply_filters( 'frm_get_field_type_class', $class, $field_type );
69 69
 
70 70
 		return $class;
Please login to merge, or discard this patch.
classes/models/fields/FrmFieldEmail.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 	protected function field_settings_for_type() {
15 15
 		return array(
16 16
 			'size'           => true,
17
-            'clear_on_focus' => true,
17
+			'clear_on_focus' => true,
18 18
 			'invalid'        => true,
19 19
 		);
20 20
 	}
Please login to merge, or discard this patch.
classes/models/fields/FrmFieldType.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -154,8 +154,8 @@
 block discarded – undo
154 154
 		$fields = FrmField::field_selection();
155 155
 		$fields = array_merge( $fields, FrmField::pro_field_selection() );
156 156
 
157
-		if ( isset( $fields[ $this->type ] ) ) {
158
-			$name = is_array( $fields[ $this->type ] ) ? $fields[ $this->type ]['name'] : $fields[ $this->type ];
157
+		if ( isset( $fields[$this->type] ) ) {
158
+			$name = is_array( $fields[$this->type] ) ? $fields[$this->type]['name'] : $fields[$this->type];
159 159
 		}
160 160
 
161 161
 		return $name;
Please login to merge, or discard this patch.