Completed
Branch 3.0 (991649)
by Stephanie
02:44
created
classes/models/fields/FrmFieldType.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	protected function set_type( $type ) {
77 77
 		if ( empty( $this->type ) ) {
78
-			$this->type = $this->get_field_column('type');
78
+			$this->type = $this->get_field_column( 'type' );
79 79
 			if ( empty( $this->type ) && ! empty( $type ) ) {
80 80
 				$this->type = $type;
81 81
 			}
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 		$field_val = '';
92 92
 		if ( is_object( $this->field ) ) {
93 93
 			$field_val = $this->field->{$column};
94
-		} elseif ( is_array( $this->field ) && isset( $this->field[ $column ] ) ) {
95
-			$field_val = $this->field[ $column ];
94
+		} elseif ( is_array( $this->field ) && isset( $this->field[$column] ) ) {
95
+			$field_val = $this->field[$column];
96 96
 		}
97 97
 		return $field_val;
98 98
 	}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		if ( is_object( $this->field ) ) {
106 106
 			$this->field->{$column} = $value;
107 107
 		} elseif ( is_array( $this->field ) ) {
108
-			$this->field[ $column ] = $value;
108
+			$this->field[$column] = $value;
109 109
 		}
110 110
 	}
111 111
 
@@ -197,16 +197,16 @@  discard block
 block discarded – undo
197 197
 	}
198 198
 
199 199
 	protected function builder_text_field() {
200
-		return '<input type="text" name="' . esc_attr( $this->html_name() ) . '" id="' . esc_attr( $this->html_id() ) . '" value="' . esc_attr( $this->get_field_column('default_value') ) . '" class="dyn_default_value" />';
200
+		return '<input type="text" name="' . esc_attr( $this->html_name() ) . '" id="' . esc_attr( $this->html_id() ) . '" value="' . esc_attr( $this->get_field_column( 'default_value' ) ) . '" class="dyn_default_value" />';
201 201
 	}
202 202
 
203 203
 	protected function html_name( $name = '' ) {
204 204
 		$prefix = empty( $name ) ? 'item_meta' : $name;
205
-		return $prefix . '[' . $this->get_field_column('id') . ']';
205
+		return $prefix . '[' . $this->get_field_column( 'id' ) . ']';
206 206
 	}
207 207
 
208 208
 	protected function html_id( $plus = '' ) {
209
-		return apply_filters( 'frm_field_get_html_id', 'field_' . $this->get_field_column('field_key') . $plus, $this->field );
209
+		return apply_filters( 'frm_field_get_html_id', 'field_' . $this->get_field_column( 'field_key' ) . $plus, $this->field );
210 210
     }
211 211
 
212 212
 	public function display_field_settings() {
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	}
297 297
 
298 298
 	protected function default_invalid_msg() {
299
-		$field_name = $this->get_field_column('name');
299
+		$field_name = $this->get_field_column( 'name' );
300 300
 		if ( $field_name == '' ) {
301 301
 			$invalid = __( 'This field is invalid', 'formidable' );
302 302
 		} else {
@@ -312,8 +312,8 @@  discard block
 block discarded – undo
312 312
 		$fields = FrmField::field_selection();
313 313
 		$fields = array_merge( $fields, FrmField::pro_field_selection() );
314 314
 
315
-		if ( isset( $fields[ $this->type ] ) ) {
316
-			$name = is_array( $fields[ $this->type ] ) ? $fields[ $this->type ]['name'] : $fields[ $this->type ];
315
+		if ( isset( $fields[$this->type] ) ) {
316
+			$name = is_array( $fields[$this->type] ) ? $fields[$this->type]['name'] : $fields[$this->type];
317 317
 		}
318 318
 
319 319
 		return $name;
@@ -462,8 +462,8 @@  discard block
 block discarded – undo
462 462
 
463 463
 	protected function fill_display_field_values( $args = array() ) {
464 464
 		$defaults = array(
465
-			'field_name'    => 'item_meta[' . $this->get_field_column('id') . ']',
466
-			'field_id'      => $this->get_field_column('id'),
465
+			'field_name'    => 'item_meta[' . $this->get_field_column( 'id' ) . ']',
466
+			'field_id'      => $this->get_field_column( 'id' ),
467 467
 			'field_plus_id' => '',
468 468
 			'section_id'    => '',
469 469
 		);
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
 		$value = $this->prepare_display_value( $value, $atts );
501 501
 
502 502
 		if ( is_array( $value ) ) {
503
-			if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[ $atts['show'] ] ) ) {
504
-				$value = $value[ $atts['show'] ];
503
+			if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[$atts['show']] ) ) {
504
+				$value = $value[$atts['show']];
505 505
 			} elseif ( ! isset( $atts['return_array'] ) || ! $atts['return_array'] ) {
506 506
 				$sep = isset( $atts['sep'] ) ? $atts['sep'] : ', ';
507 507
 				$value = implode( $sep, $value );
@@ -560,8 +560,8 @@  discard block
 block discarded – undo
560 560
 		$saved_entries = $atts['ids'];
561 561
 		$new_value = array();
562 562
 		foreach ( (array) $value as $old_child_id ) {
563
-			if ( isset( $saved_entries[ $old_child_id ] ) ) {
564
-				$new_value[] = $saved_entries[ $old_child_id ];
563
+			if ( isset( $saved_entries[$old_child_id] ) ) {
564
+				$new_value[] = $saved_entries[$old_child_id];
565 565
 			}
566 566
 		}
567 567
 
Please login to merge, or discard this patch.
classes/models/FrmFieldFormHtml.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	 * @param array $atts
42 42
 	 */
43 43
 	private function _set( $param, $atts ) {
44
-		if ( isset( $atts[ $param ] ) ) {
45
-			$this->{$param} = $atts[ $param ];
44
+		if ( isset( $atts[$param] ) ) {
45
+			$this->{$param} = $atts[$param];
46 46
 		}
47 47
 	}
48 48
 
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 		$exclude = array( 'field_obj', 'html' );
75 75
 		
76 76
 		foreach ( $exclude as $ex ) {
77
-			if ( isset( $atts[ $ex ] ) ) {
78
-				unset( $this->pass_args[ $ex ] );
77
+			if ( isset( $atts[$ex] ) ) {
78
+				unset( $this->pass_args[$ex] );
79 79
 			}
80 80
 		}
81 81
 	}
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 * @param array $set
88 88
 	 */
89 89
 	private function set_from_field( $atts, $set ) {
90
-		if ( isset( $atts[ $set['param'] ] ) ) {
91
-			$this->{$set['param']} = $atts[ $set['param'] ];
90
+		if ( isset( $atts[$set['param']] ) ) {
91
+			$this->{$set['param']} = $atts[$set['param']];
92 92
 		} else {
93 93
 			$this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] );
94 94
 		}
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	private function replace_shortcodes_before_input() {
109 109
 
110 110
 		// Remove the for attribute for captcha
111
-		if ( $this->field_obj->get_field_column('type') == 'captcha' ) {
111
+		if ( $this->field_obj->get_field_column( 'type' ) == 'captcha' ) {
112 112
 			$this->html = str_replace( ' for="field_[key]"', '', $this->html );
113 113
 		}
114 114
 
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
 		$this->html = str_replace( 'field_[key]', $this->html_id, $this->html );
139 139
 
140 140
 		//replace [key]
141
-		$this->html = str_replace( '[key]', $this->field_obj->get_field_column('field_key'), $this->html );
141
+		$this->html = str_replace( '[key]', $this->field_obj->get_field_column( 'field_key' ), $this->html );
142 142
 
143 143
 		//replace [field_name]
144
-		$this->html = str_replace('[field_name]', $this->field_obj->get_field_column('name'), $this->html );
144
+		$this->html = str_replace( '[field_name]', $this->field_obj->get_field_column( 'name' ), $this->html );
145 145
 	}
146 146
 
147 147
 	/**
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * @since 3.0
152 152
 	 */
153 153
 	private function add_class_to_divider() {
154
-		if ( $this->field_obj->get_field_column('type') == 'divider' ) {
154
+		if ( $this->field_obj->get_field_column( 'type' ) == 'divider' ) {
155 155
 			if ( FrmField::is_option_true( $this->field_obj->get_field(), 'description' ) ) {
156 156
 				$this->html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $this->html );
157 157
 			} else {
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	 * @since 3.0
165 165
 	 */
166 166
 	private function replace_required_label_shortcode() {
167
-		$required = FrmField::is_required( $this->field_obj->get_field() ) ? $this->field_obj->get_field_column('required_indicator') : '';
167
+		$required = FrmField::is_required( $this->field_obj->get_field() ) ? $this->field_obj->get_field_column( 'required_indicator' ) : '';
168 168
 		FrmShortcodeHelper::remove_inline_conditions( ! empty( $required ), 'required_label', $required, $this->html );
169 169
 	}
170 170
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	 * @since 3.0
173 173
 	 */
174 174
 	private function replace_description_shortcode() {
175
-		$description = $this->field_obj->get_field_column('description');
175
+		$description = $this->field_obj->get_field_column( 'description' );
176 176
 		FrmShortcodeHelper::remove_inline_conditions( ( $description && $description != '' ), 'description', $description, $this->html );
177 177
 	}
178 178
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 * @since 3.0
181 181
 	 */
182 182
 	private function replace_error_shortcode() {
183
-		$error = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? $this->pass_args['errors'][ 'field' . $this->field_id ] : false;
183
+		$error = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? $this->pass_args['errors']['field' . $this->field_id] : false;
184 184
 		FrmShortcodeHelper::remove_inline_conditions( ! empty( $error ), 'error', $error, $this->html );
185 185
 	}
186 186
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 		$this->html .= "\n";
217 217
 
218 218
 		//Return html if conf_field to prevent loop
219
-		if ( $this->field_obj->get_field_column('conf_field') == 'stop' ) {
219
+		if ( $this->field_obj->get_field_column( 'conf_field' ) == 'stop' ) {
220 220
 			return;
221 221
 		}
222 222
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	 * @since 3.0
243 243
 	 */
244 244
 	private function filter_html_field_shortcodes() {
245
-		if ( $this->field_obj->get_field_column('type') == 'html' ) {
245
+		if ( $this->field_obj->get_field_column( 'type' ) == 'html' ) {
246 246
 			FrmFieldsHelper::run_wpautop( array( 'wpautop' => true ), $this->html );
247 247
 
248 248
 			$this->html = apply_filters( 'frm_get_default_value', $this->html, (object) $this->field_obj->get_field(), false );
@@ -264,10 +264,10 @@  discard block
 block discarded – undo
264 264
 	 * @since 3.0
265 265
 	 */
266 266
 	private function replace_shortcodes_with_atts() {
267
-		preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER);
267
+		preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER );
268 268
 
269 269
 		foreach ( $shortcodes[0] as $short_key => $tag ) {
270
-			$shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
270
+			$shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] );
271 271
 			$tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key, array( 'conditional' => false, 'conditional_check' => false ) );
272 272
 
273 273
 			$replace_with = '';
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 				$replace_with = $this->replace_input_shortcode( $shortcode_atts );
279 279
 			}
280 280
 
281
-			$this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html );
281
+			$this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html );
282 282
 		}
283 283
 	}
284 284
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 */
300 300
 	private function prepare_input_shortcode_atts( $shortcode_atts ) {
301 301
 		if ( isset( $shortcode_atts['opt'] ) ) {
302
-			$shortcode_atts['opt']--;
302
+			$shortcode_atts['opt'] --;
303 303
 		}
304 304
 
305 305
 		$field_class = isset( $shortcode_atts['class'] ) ? $shortcode_atts['class'] : '';
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
 	 * @since 3.0
322 322
 	 */
323 323
 	private function add_class_to_label() {
324
-		$label_class = in_array( $this->field_obj->get_field_column('type'), array( 'divider', 'end_divider', 'break' ) ) ? $this->field_obj->get_field_column('label') : ' frm_primary_label';
324
+		$label_class = in_array( $this->field_obj->get_field_column( 'type' ), array( 'divider', 'end_divider', 'break' ) ) ? $this->field_obj->get_field_column( 'label' ) : ' frm_primary_label';
325 325
 		$this->html = str_replace( '[label_position]', $label_class, $this->html );
326
-		if ( $this->field_obj->get_field_column('label') == 'inside' && $this->field_obj->get_field_column('value') != '' ) {
326
+		if ( $this->field_obj->get_field_column( 'label' ) == 'inside' && $this->field_obj->get_field_column( 'value' ) != '' ) {
327 327
 			$this->html = str_replace( 'frm_primary_label', 'frm_primary_label frm_visible', $this->html );
328 328
 		}
329 329
 	}
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 	private function add_field_div_classes() {
347 347
 		$classes = $this->get_field_div_classes();
348 348
 
349
-		if ( $this->field_obj->get_field_column('type') == 'html' && strpos( $this->html, '[error_class]' ) === false ) {
349
+		if ( $this->field_obj->get_field_column( 'type' ) == 'html' && strpos( $this->html, '[error_class]' ) === false ) {
350 350
 			// there is no error_class shortcode for HTML fields
351 351
 			$this->html = str_replace( 'class="frm_form_field', 'class="frm_form_field ' . $classes, $this->html );
352 352
 		}
@@ -363,21 +363,21 @@  discard block
 block discarded – undo
363 363
 	 */
364 364
 	private function get_field_div_classes() {
365 365
 		// Add error class
366
-		$classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : '';
366
+		$classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : '';
367 367
 
368 368
 		// Add label position class
369
-		$classes .= ' frm_' . $this->field_obj->get_field_column('label') . '_container';
369
+		$classes .= ' frm_' . $this->field_obj->get_field_column( 'label' ) . '_container';
370 370
 
371 371
 		// Add CSS layout classes
372
-		if ( ! empty( $this->field_obj->get_field_column('classes') ) ) {
373
-			if ( ! strpos( $this->html, 'frm_form_field ') ) {
372
+		if ( ! empty( $this->field_obj->get_field_column( 'classes' ) ) ) {
373
+			if ( ! strpos( $this->html, 'frm_form_field ' ) ) {
374 374
 				$classes .= ' frm_form_field';
375 375
 			}
376
-			$classes .= ' ' . $this->field_obj->get_field_column('classes');
376
+			$classes .= ' ' . $this->field_obj->get_field_column( 'classes' );
377 377
 		}
378 378
 
379 379
 		// Add class to HTML field
380
-		if ( $this->field_obj->get_field_column('type') == 'html' ) {
380
+		if ( $this->field_obj->get_field_column( 'type' ) == 'html' ) {
381 381
 			$classes .= ' frm_html_container';
382 382
 		}
383 383
 
Please login to merge, or discard this patch.
classes/helpers/FrmFormsHelper.php 1 patch
Spacing   +54 added lines, -54 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
 
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 	public static function get_direct_link( $key, $form = false ) {
16 16
 		$target_url = esc_url( admin_url( 'admin-ajax.php?action=frm_forms_preview&form=' . $key ) );
17
-        $target_url = apply_filters('frm_direct_link', $target_url, $key, $form);
17
+        $target_url = apply_filters( 'frm_direct_link', $target_url, $key, $form );
18 18
 
19 19
         return $target_url;
20 20
     }
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 			$query['id !'] = $args['exclude'];
40 40
         }
41 41
 
42
-        $where = apply_filters('frm_forms_dropdown', $query, $field_name);
42
+        $where = apply_filters( 'frm_forms_dropdown', $query, $field_name );
43 43
 		$forms = FrmForm::get_published_forms( $where, 999, $args['inc_children'] );
44 44
 		$add_html = array();
45 45
 		self::add_html_attr( $args['onchange'], 'onchange', $add_html );
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		<?php } ?>
53 53
 		<?php foreach ( $forms as $form ) { ?>
54 54
 			<option value="<?php echo esc_attr( $form->id ); ?>" <?php selected( $field_value, $form->id ); ?>><?php
55
-				echo ( '' == $form->name ) ? esc_html__( '(no title)', 'formidable' ) : esc_html( FrmAppHelper::truncate( $form->name, 50 ) ) . ( $form->parent_form_id ? esc_html__( ' (child)', 'formidable' ) : '' ) ;
55
+				echo ( '' == $form->name ) ? esc_html__( '(no title)', 'formidable' ) : esc_html( FrmAppHelper::truncate( $form->name, 50 ) ) . ( $form->parent_form_id ? esc_html__( ' (child)', 'formidable' ) : '' );
56 56
 			?></option>
57 57
 		<?php } ?>
58 58
         </select>
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public static function add_html_attr( $class, $param, &$add_html ) {
70 70
 		if ( ! empty( $class ) ) {
71
-			$add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"';
71
+			$add_html[$param] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"';
72 72
 		}
73 73
 	}
74 74
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		$args = array( 'id' => 0, 'form' => 0 );
80 80
 		if ( isset( $_GET['id'] ) && ! isset( $_GET['form'] ) ) {
81 81
 			unset( $args['form'] );
82
-		} else if ( isset( $_GET['form']) && ! isset( $_GET['id'] ) ) {
82
+		} else if ( isset( $_GET['form'] ) && ! isset( $_GET['id'] ) ) {
83 83
 			unset( $args['id'] );
84 84
         }
85 85
 
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
 		if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $frm_action, array( 'edit', 'show', 'destroy_all' ) ) ) {
88 88
             $args['frm_action'] = 'list';
89 89
             $args['form'] = 0;
90
-		} else if ( FrmAppHelper::is_admin_page('formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) {
90
+		} else if ( FrmAppHelper::is_admin_page( 'formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) {
91 91
             $args['frm_action'] = 'edit';
92 92
 		} else if ( isset( $_GET['post'] ) ) {
93 93
             $args['form'] = 0;
94
-            $base = admin_url('edit.php?post_type=frm_display');
94
+            $base = admin_url( 'edit.php?post_type=frm_display' );
95 95
         }
96 96
 
97 97
         ?>
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 			        $args['form'] = $form->id;
108 108
 				}
109 109
                 ?>
110
-				<li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)') : FrmAppHelper::truncate( $form->name, 60 ) ); ?></a></li>
110
+				<li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)' ) : FrmAppHelper::truncate( $form->name, 60 ) ); ?></a></li>
111 111
 			<?php
112 112
 				unset( $form );
113 113
 			} ?>
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
     }
118 118
 
119 119
 	public static function get_sortable_classes( $col, $sort_col, $sort_dir ) {
120
-        echo ($sort_col == $col) ? 'sorted' : 'sortable';
121
-        echo ($sort_col == $col && $sort_dir == 'desc') ? ' asc' : ' desc';
120
+        echo ( $sort_col == $col ) ? 'sorted' : 'sortable';
121
+        echo ( $sort_col == $col && $sort_dir == 'desc' ) ? ' asc' : ' desc';
122 122
     }
123 123
 
124 124
 	/**
@@ -153,20 +153,20 @@  discard block
 block discarded – undo
153 153
             $post_values = $values;
154 154
         } else {
155 155
             $values = array();
156
-            $post_values = isset($_POST) ? $_POST : array();
156
+            $post_values = isset( $_POST ) ? $_POST : array();
157 157
         }
158 158
 
159 159
 		foreach ( array( 'name' => '', 'description' => '' ) as $var => $default ) {
160
-			if ( ! isset( $values[ $var ] ) ) {
161
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default );
160
+			if ( ! isset( $values[$var] ) ) {
161
+				$values[$var] = FrmAppHelper::get_param( $var, $default );
162 162
             }
163 163
         }
164 164
 
165
-        $values['description'] = FrmAppHelper::use_wpautop($values['description']);
165
+        $values['description'] = FrmAppHelper::use_wpautop( $values['description'] );
166 166
 
167 167
 		foreach ( array( 'form_id' => '', 'logged_in' => '', 'editable' => '', 'default_template' => 0, 'is_template' => 0, 'status' => 'draft', 'parent_form_id' => 0 ) as $var => $default ) {
168
-            if ( ! isset( $values[ $var ] ) ) {
169
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default );
168
+            if ( ! isset( $values[$var] ) ) {
169
+				$values[$var] = FrmAppHelper::get_param( $var, $default );
170 170
             }
171 171
         }
172 172
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		$values = self::fill_default_opts( $values, false, $post_values );
178 178
 		$values['custom_style'] = FrmAppHelper::custom_style_value( $post_values );
179 179
 
180
-        return apply_filters('frm_setup_new_form_vars', $values);
180
+        return apply_filters( 'frm_setup_new_form_vars', $values );
181 181
     }
182 182
 
183 183
     /**
@@ -188,42 +188,42 @@  discard block
 block discarded – undo
188 188
 			$post_values = stripslashes_deep( $_POST );
189 189
 		}
190 190
 
191
-        $values['form_key'] = isset($post_values['form_key']) ? $post_values['form_key'] : $record->form_key;
192
-        $values['default_template'] = isset($post_values['default_template']) ? $post_values['default_template'] : $record->default_template;
193
-        $values['is_template'] = isset($post_values['is_template']) ? $post_values['is_template'] : $record->is_template;
191
+        $values['form_key'] = isset( $post_values['form_key'] ) ? $post_values['form_key'] : $record->form_key;
192
+        $values['default_template'] = isset( $post_values['default_template'] ) ? $post_values['default_template'] : $record->default_template;
193
+        $values['is_template'] = isset( $post_values['is_template'] ) ? $post_values['is_template'] : $record->is_template;
194 194
         $values['status'] = $record->status;
195 195
 
196
-        $values = self::fill_default_opts($values, $record, $post_values);
196
+        $values = self::fill_default_opts( $values, $record, $post_values );
197 197
 
198
-        return apply_filters('frm_setup_edit_form_vars', $values);
198
+        return apply_filters( 'frm_setup_edit_form_vars', $values );
199 199
     }
200 200
 
201 201
 	public static function fill_default_opts( $values, $record, $post_values ) {
202 202
 
203 203
         $defaults = self::get_default_opts();
204 204
 		foreach ( $defaults as $var => $default ) {
205
-            if ( is_array($default) ) {
206
-                if ( ! isset( $values[ $var ] ) ) {
207
-					$values[ $var ] = ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : array();
205
+            if ( is_array( $default ) ) {
206
+                if ( ! isset( $values[$var] ) ) {
207
+					$values[$var] = ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : array();
208 208
                 }
209 209
 
210 210
                 foreach ( $default as $k => $v ) {
211
-					$values[ $var ][ $k ] = ( $post_values && isset( $post_values[ $var ][ $k ] ) ) ? $post_values[ $var ][ $k ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) ) ? $record->options[ $var ][ $k ] : $v);
211
+					$values[$var][$k] = ( $post_values && isset( $post_values[$var][$k] ) ) ? $post_values[$var][$k] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) ) ? $record->options[$var][$k] : $v );
212 212
 
213 213
                     if ( is_array( $v ) ) {
214 214
                         foreach ( $v as $k1 => $v1 ) {
215
-							$values[ $var ][ $k ][ $k1 ] = ( $post_values && isset( $post_values[ $var ][ $k ][ $k1 ] ) ) ? $post_values[ $var ][ $k ][ $k1 ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) && isset( $record->options[ $var ][ $k ][ $k1 ] ) ) ? $record->options[ $var ][ $k ][ $k1 ] : $v1 );
215
+							$values[$var][$k][$k1] = ( $post_values && isset( $post_values[$var][$k][$k1] ) ) ? $post_values[$var][$k][$k1] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) && isset( $record->options[$var][$k][$k1] ) ) ? $record->options[$var][$k][$k1] : $v1 );
216 216
                             unset( $k1, $v1 );
217 217
                         }
218 218
                     }
219 219
 
220
-                    unset($k, $v);
220
+                    unset( $k, $v );
221 221
                 }
222 222
             } else {
223
-				$values[ $var ] = ( $post_values && isset( $post_values['options'][ $var ] ) ) ? $post_values['options'][ $var ] : ( ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : $default );
223
+				$values[$var] = ( $post_values && isset( $post_values['options'][$var] ) ) ? $post_values['options'][$var] : ( ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : $default );
224 224
             }
225 225
 
226
-            unset($var, $default);
226
+            unset( $var, $default );
227 227
         }
228 228
 
229 229
         return $values;
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
             'submit_value' => $frm_settings->submit_value, 'success_action' => 'message',
237 237
             'success_msg' => $frm_settings->success_msg, 'show_form' => 0, 'akismet' => '',
238 238
             'no_save' => 0, 'ajax_load' => 0, 'form_class' => '', 'custom_style' => 1,
239
-            'before_html' => self::get_default_html('before'),
239
+            'before_html' => self::get_default_html( 'before' ),
240 240
             'after_html' => '',
241
-            'submit_html' => self::get_default_html('submit'),
241
+            'submit_html' => self::get_default_html( 'submit' ),
242 242
         );
243 243
     }
244 244
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	public static function fill_form_options( &$options, $values ) {
251 251
 		$defaults = self::get_default_opts();
252 252
 		foreach ( $defaults as $var => $default ) {
253
-			$options[ $var ] = isset( $values['options'][ $var ] ) ? $values['options'][ $var ] : $default;
253
+			$options[$var] = isset( $values['options'][$var] ) ? $values['options'][$var] : $default;
254 254
 			unset( $var, $default );
255 255
 		}
256 256
 	}
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 		$last_field = false;
330 330
         foreach ( $fields as $field ) {
331 331
 			if ( $prev_order === $field->field_order ) {
332
-				$add_order++;
332
+				$add_order ++;
333 333
 			}
334 334
 
335 335
 			if ( $add_order ) {
@@ -396,8 +396,8 @@  discard block
 block discarded – undo
396 396
             if ( $code == 'form_name' ) {
397 397
                 $replace_with = $form->name;
398 398
             } else if ( $code == 'form_description' ) {
399
-                $replace_with = FrmAppHelper::use_wpautop($form->description);
400
-            } else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) {
399
+                $replace_with = FrmAppHelper::use_wpautop( $form->description );
400
+            } else if ( $code == 'entry_key' && isset( $_GET ) && isset( $_GET['entry'] ) ) {
401 401
                 $replace_with = FrmAppHelper::simple_get( 'entry' );
402 402
             } else {
403 403
                 $replace_with = '';
@@ -407,10 +407,10 @@  discard block
 block discarded – undo
407 407
         }
408 408
 
409 409
         //replace [form_key]
410
-        $html = str_replace('[form_key]', $form->form_key, $html);
410
+        $html = str_replace( '[form_key]', $form->form_key, $html );
411 411
 
412 412
         //replace [frmurl]
413
-        $html = str_replace('[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html);
413
+        $html = str_replace( '[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html );
414 414
 
415 415
 		if ( strpos( $html, '[button_label]' ) ) {
416 416
 			add_filter( 'frm_submit_button', 'FrmFormsHelper::submit_button_label', 1 );
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 			$html = str_replace( '[button_label]', $submit_label, $html );
420 420
         }
421 421
 
422
-        $html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values);
422
+        $html = apply_filters( 'frm_form_replace_shortcodes', $html, $form, $values );
423 423
 
424 424
 		if ( strpos( $html, '[if back_button]' ) ) {
425 425
 			$html = preg_replace( '/(\[if\s+back_button\])(.*?)(\[\/if\s+back_button\])/mis', '', $html );
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
     }
438 438
 
439 439
 	public static function submit_button_label( $submit ) {
440
-        if ( ! $submit || empty($submit) ) {
440
+        if ( ! $submit || empty( $submit ) ) {
441 441
             $frm_settings = FrmAppHelper::get_settings();
442 442
             $submit = $frm_settings->submit_value;
443 443
         }
@@ -460,11 +460,11 @@  discard block
 block discarded – undo
460 460
 	}
461 461
 
462 462
 	public static function get_form_style_class( $form = false ) {
463
-        $style = self::get_form_style($form);
463
+        $style = self::get_form_style( $form );
464 464
         $class = ' with_frm_style';
465 465
 
466
-        if ( empty($style) ) {
467
-            if ( FrmAppHelper::is_admin_page('formidable-entries') ) {
466
+        if ( empty( $style ) ) {
467
+            if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) ) {
468 468
                 return $class;
469 469
             } else {
470 470
                 return;
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
         }
473 473
 
474 474
         //If submit button needs to be inline or centered
475
-        if ( is_object($form) ) {
475
+        if ( is_object( $form ) ) {
476 476
 			$form = $form->options;
477 477
 		}
478 478
 
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 			$class .= ' frm_center_submit';
485 485
 		}
486 486
 
487
-        $class = apply_filters('frm_add_form_style_class', $class, $style);
487
+        $class = apply_filters( 'frm_add_form_style_class', $class, $style );
488 488
 
489 489
         return $class;
490 490
     }
@@ -580,12 +580,12 @@  discard block
 block discarded – undo
580 580
     }
581 581
 
582 582
 	public static function edit_form_link( $form_id ) {
583
-        if ( is_object($form_id) ) {
583
+        if ( is_object( $form_id ) ) {
584 584
             $form = $form_id;
585 585
             $name = $form->name;
586 586
             $form_id = $form->id;
587 587
         } else {
588
-            $name = FrmForm::getName($form_id);
588
+            $name = FrmForm::getName( $form_id );
589 589
         }
590 590
 
591 591
         if ( $form_id ) {
@@ -617,12 +617,12 @@  discard block
 block discarded – undo
617 617
         $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
618 618
 		$base_url = '?page=formidable&form_type=' . $current_page . '&id=' . $id;
619 619
         if ( 'trash' == $status ) {
620
-			$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][ $length ] . '</a>';
621
-        } else if ( current_user_can('frm_delete_forms') ) {
620
+			$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][$length] . '</a>';
621
+        } else if ( current_user_can( 'frm_delete_forms' ) ) {
622 622
             if ( EMPTY_TRASH_DAYS ) {
623
-				$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][ $length ] . '</a>';
623
+				$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][$length] . '</a>';
624 624
             } else {
625
-				$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][ $length ] . '</a>';
625
+				$link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][$length] . '</a>';
626 626
             }
627 627
         }
628 628
 
@@ -636,11 +636,11 @@  discard block
 block discarded – undo
636 636
             'publish'   => __( 'Published', 'formidable' ),
637 637
         );
638 638
 
639
-        if ( ! in_array($status, array_keys($nice_names)) ) {
639
+        if ( ! in_array( $status, array_keys( $nice_names ) ) ) {
640 640
             $status = 'publish';
641 641
         }
642 642
 
643
-		$name = $nice_names[ $status ];
643
+		$name = $nice_names[$status];
644 644
 
645 645
         return $name;
646 646
     }
Please login to merge, or discard this patch.
classes/helpers/FrmFieldsHelper.php 1 patch
Spacing   +110 added lines, -110 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
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		if ( ! $doing_ajax ) {
49 49
 			$field_values = array( 'name', 'description', 'field_key', 'type', 'default_value', 'field_order', 'required' );
50 50
 			foreach ( $field_values as $var ) {
51
-				$values[ $var ] = FrmAppHelper::get_param( $var, $values[ $var ], 'get', 'htmlspecialchars' );
51
+				$values[$var] = FrmAppHelper::get_param( $var, $values[$var], 'get', 'htmlspecialchars' );
52 52
 				unset( $var );
53 53
 			}
54 54
 
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 		$defaults = self::get_default_field_options_from_field( $field );
79 79
 
80 80
 		foreach ( $defaults as $opt => $default ) {
81
-			$current_opt = isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default;
82
-			$values[ $opt ] = ( $_POST && isset( $_POST['field_options'][ $opt . '_' . $field->id ] ) ) ? stripslashes_deep( maybe_unserialize( $_POST['field_options'][ $opt . '_' . $field->id ] ) ) : $current_opt;
81
+			$current_opt = isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default;
82
+			$values[$opt] = ( $_POST && isset( $_POST['field_options'][$opt . '_' . $field->id] ) ) ? stripslashes_deep( maybe_unserialize( $_POST['field_options'][$opt . '_' . $field->id] ) ) : $current_opt;
83 83
 			unset( $opt, $default );
84 84
 		}
85 85
 	}
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 
129 129
 		$values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' );
130 130
         $values['form_id'] = $form_id;
131
-        $values['options'] = maybe_serialize($field->options);
132
-        $values['default_value'] = maybe_serialize($field->default_value);
131
+        $values['options'] = maybe_serialize( $field->options );
132
+        $values['default_value'] = maybe_serialize( $field->default_value );
133 133
 
134 134
         foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) {
135
-            $values[ $col ] = $field->{$col};
135
+            $values[$col] = $field->{$col};
136 136
         }
137 137
     }
138 138
 
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
 
147 147
 		$conf_msg = __( 'The entered values do not match', 'formidable' );
148 148
 		$defaults = array(
149
-			'unique_msg' => array( 'full' => $default_settings['unique_msg'], 'part' => sprintf( __('%s must be unique', 'formidable' ), $field_name ) ),
150
-			'invalid'   => array( 'full' => __( 'This field is invalid', 'formidable' ), 'part' => sprintf( __('%s is invalid', 'formidable' ), $field_name ) ),
149
+			'unique_msg' => array( 'full' => $default_settings['unique_msg'], 'part' => sprintf( __( '%s must be unique', 'formidable' ), $field_name ) ),
150
+			'invalid'   => array( 'full' => __( 'This field is invalid', 'formidable' ), 'part' => sprintf( __( '%s is invalid', 'formidable' ), $field_name ) ),
151 151
 			'blank'     => array( 'full' => $frm_settings->blank_msg, 'part' => $frm_settings->blank_msg ),
152 152
 			'conf_msg'  => array( 'full' => $conf_msg, 'part' => $conf_msg ),
153 153
 		);
154 154
 
155 155
 		$msg = FrmField::get_option( $field, $error );
156
-		$msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg;
156
+		$msg = empty( $msg ) ? $defaults[$error]['part'] : $msg;
157 157
 		$msg = do_shortcode( $msg );
158 158
 		return $msg;
159 159
 	}
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 			$default_html = apply_filters( 'frm_other_custom_html', '', $type );
173 173
 		}
174 174
 
175
-		return apply_filters('frm_custom_html', $default_html, $type);
175
+		return apply_filters( 'frm_custom_html', $default_html, $type );
176 176
 	}
177 177
 
178 178
 	public static function show_fields( $fields, $errors, $form, $form_action ) {
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 		}
265 265
 
266 266
         $field_name = $field['name'];
267
-        $html_id = self::get_html_id($field);
267
+        $html_id = self::get_html_id( $field );
268 268
 
269 269
 		foreach ( $field['options'] as $opt_key => $opt ) {
270 270
 		    $field_val = self::get_value_from_array( $opt, $opt_key, $field );
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 			// Get string for Other text field, if needed
274 274
 			$other_val = self::get_other_val( compact( 'opt_key', 'field' ) );
275 275
 
276
-			$checked = ( $other_val || isset( $field['value'] ) && ( ( ! is_array( $field['value'] ) && $field['value'] == $field_val ) || ( is_array($field['value'] ) && in_array( $field_val, $field['value'] ) ) ) ) ? ' checked="checked"':'';
276
+			$checked = ( $other_val || isset( $field['value'] ) && ( ( ! is_array( $field['value'] ) && $field['value'] == $field_val ) || ( is_array( $field['value'] ) && in_array( $field_val, $field['value'] ) ) ) ) ? ' checked="checked"' : '';
277 277
 
278 278
 		    // If this is an "Other" option, get the HTML for it
279 279
 			if ( self::is_other_opt( $opt_key ) ) {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	}
300 300
 
301 301
 	public static function get_term_link( $tax_id ) {
302
-        $tax = get_taxonomy($tax_id);
302
+        $tax = get_taxonomy( $tax_id );
303 303
         if ( ! $tax ) {
304 304
             return;
305 305
         }
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
             __( 'Please add options from the WordPress "%1$s" page', 'formidable' ),
309 309
 			'<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>'
310 310
         );
311
-        unset($tax);
311
+        unset( $tax );
312 312
 
313 313
         return $link;
314 314
     }
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
 		$hide_opt = self::get_value_for_comparision( $hide_opt );
318 318
 		$observed_value = self::get_value_for_comparision( $observed_value );
319 319
 
320
-        if ( is_array($observed_value) ) {
321
-            return self::array_value_condition($observed_value, $cond, $hide_opt);
320
+        if ( is_array( $observed_value ) ) {
321
+            return self::array_value_condition( $observed_value, $cond, $hide_opt );
322 322
         }
323 323
 
324 324
         $m = false;
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
         } else if ( $cond == '<' ) {
332 332
             $m = $observed_value < $hide_opt;
333 333
         } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
334
-            $m = stripos($observed_value, $hide_opt);
334
+            $m = stripos( $observed_value, $hide_opt );
335 335
             if ( $cond == 'not LIKE' ) {
336 336
                 $m = ( $m === false ) ? true : false;
337 337
             } else {
@@ -357,23 +357,23 @@  discard block
 block discarded – undo
357 357
 	public static function array_value_condition( $observed_value, $cond, $hide_opt ) {
358 358
         $m = false;
359 359
         if ( $cond == '==' ) {
360
-            if ( is_array($hide_opt) ) {
361
-                $m = array_intersect($hide_opt, $observed_value);
362
-                $m = empty($m) ? false : true;
360
+            if ( is_array( $hide_opt ) ) {
361
+                $m = array_intersect( $hide_opt, $observed_value );
362
+                $m = empty( $m ) ? false : true;
363 363
             } else {
364
-                $m = in_array($hide_opt, $observed_value);
364
+                $m = in_array( $hide_opt, $observed_value );
365 365
             }
366 366
         } else if ( $cond == '!=' ) {
367
-            $m = ! in_array($hide_opt, $observed_value);
367
+            $m = ! in_array( $hide_opt, $observed_value );
368 368
         } else if ( $cond == '>' ) {
369
-            $min = min($observed_value);
369
+            $min = min( $observed_value );
370 370
             $m = $min > $hide_opt;
371 371
         } else if ( $cond == '<' ) {
372
-            $max = max($observed_value);
372
+            $max = max( $observed_value );
373 373
             $m = $max < $hide_opt;
374 374
         } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) {
375 375
             foreach ( $observed_value as $ob ) {
376
-                $m = strpos($ob, $hide_opt);
376
+                $m = strpos( $ob, $hide_opt );
377 377
                 if ( $m !== false ) {
378 378
                     $m = true;
379 379
                     break;
@@ -394,27 +394,27 @@  discard block
 block discarded – undo
394 394
      * @return string
395 395
      */
396 396
 	public static function basic_replace_shortcodes( $value, $form, $entry ) {
397
-        if ( strpos($value, '[sitename]') !== false ) {
397
+        if ( strpos( $value, '[sitename]' ) !== false ) {
398 398
             $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES );
399
-            $value = str_replace('[sitename]', $new_value, $value);
399
+            $value = str_replace( '[sitename]', $new_value, $value );
400 400
         }
401 401
 
402
-        $value = apply_filters('frm_content', $value, $form, $entry);
403
-        $value = do_shortcode($value);
402
+        $value = apply_filters( 'frm_content', $value, $form, $entry );
403
+        $value = do_shortcode( $value );
404 404
 
405 405
         return $value;
406 406
     }
407 407
 
408 408
 	public static function get_shortcodes( $content, $form_id ) {
409 409
         if ( FrmAppHelper::pro_is_installed() ) {
410
-            return FrmProDisplaysHelper::get_shortcodes($content, $form_id);
410
+            return FrmProDisplaysHelper::get_shortcodes( $content, $form_id );
411 411
         }
412 412
 
413 413
         $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) );
414 414
 
415
-        $tagregexp = self::allowed_shortcodes($fields);
415
+        $tagregexp = self::allowed_shortcodes( $fields );
416 416
 
417
-        preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER);
417
+        preg_match_all( "/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER );
418 418
 
419 419
         return $matches;
420 420
     }
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
             $tagregexp[] = $field->field_key;
433 433
         }
434 434
 
435
-        $tagregexp = implode('|', $tagregexp);
435
+        $tagregexp = implode( '|', $tagregexp );
436 436
         return $tagregexp;
437 437
     }
438 438
 
@@ -448,28 +448,28 @@  discard block
 block discarded – undo
448 448
 				continue;
449 449
 			}
450 450
 
451
-            $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] );
451
+            $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] );
452 452
 
453
-            if ( ! empty( $shortcodes[3][ $short_key ] ) ) {
454
-				$tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] );
455
-                $tags = explode(' ', $tag);
456
-                if ( is_array($tags) ) {
453
+            if ( ! empty( $shortcodes[3][$short_key] ) ) {
454
+				$tag = str_replace( array( '[', ']' ), '', $shortcodes[0][$short_key] );
455
+                $tags = explode( ' ', $tag );
456
+                if ( is_array( $tags ) ) {
457 457
                     $tag = $tags[0];
458 458
                 }
459 459
             } else {
460
-                $tag = $shortcodes[2][ $short_key ];
460
+                $tag = $shortcodes[2][$short_key];
461 461
             }
462 462
 
463 463
             switch ( $tag ) {
464 464
                 case 'id':
465 465
                 case 'key':
466 466
                 case 'ip':
467
-                    $replace_with = $shortcode_values[ $tag ];
467
+                    $replace_with = $shortcode_values[$tag];
468 468
                 break;
469 469
 
470 470
                 case 'user_agent':
471 471
                 case 'user-agent':
472
-                    $entry->description = maybe_unserialize($entry->description);
472
+                    $entry->description = maybe_unserialize( $entry->description );
473 473
 					$replace_with = FrmEntriesHelper::get_browser( $entry->description['browser'] );
474 474
                 break;
475 475
 
@@ -477,25 +477,25 @@  discard block
 block discarded – undo
477 477
                 case 'created-at':
478 478
                 case 'updated_at':
479 479
                 case 'updated-at':
480
-                    if ( isset($atts['format']) ) {
480
+                    if ( isset( $atts['format'] ) ) {
481 481
                         $time_format = ' ';
482 482
                     } else {
483
-                        $atts['format'] = get_option('date_format');
483
+                        $atts['format'] = get_option( 'date_format' );
484 484
                         $time_format = '';
485 485
                     }
486 486
 
487
-                    $this_tag = str_replace('-', '_', $tag);
488
-                    $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
489
-                    unset($this_tag);
487
+                    $this_tag = str_replace( '-', '_', $tag );
488
+                    $replace_with = FrmAppHelper::get_formatted_time( $entry->{$this_tag}, $atts['format'], $time_format );
489
+                    unset( $this_tag );
490 490
                 break;
491 491
 
492 492
                 case 'created_by':
493 493
                 case 'created-by':
494 494
                 case 'updated_by':
495 495
                 case 'updated-by':
496
-                    $this_tag = str_replace('-', '_', $tag);
496
+                    $this_tag = str_replace( '-', '_', $tag );
497 497
 					$replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts );
498
-                    unset($this_tag);
498
+                    unset( $this_tag );
499 499
                 break;
500 500
 
501 501
                 case 'admin_email':
@@ -512,16 +512,16 @@  discard block
 block discarded – undo
512 512
                         break;
513 513
                     }
514 514
 
515
-                    $sep = isset($atts['sep']) ? $atts['sep'] : ', ';
515
+                    $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', ';
516 516
 
517 517
                     $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id );
518 518
 
519 519
                     $atts['entry_id'] = $entry->id;
520 520
                     $atts['entry_key'] = $entry->item_key;
521 521
 
522
-                    if ( isset($atts['show']) && $atts['show'] == 'field_label' ) {
522
+                    if ( isset( $atts['show'] ) && $atts['show'] == 'field_label' ) {
523 523
                         $replace_with = $field->name;
524
-                    } else if ( isset($atts['show']) && $atts['show'] == 'description' ) {
524
+                    } else if ( isset( $atts['show'] ) && $atts['show'] == 'description' ) {
525 525
                         $replace_with = $field->description;
526 526
 					} else {
527 527
 						$string_value = $replace_with;
@@ -536,15 +536,15 @@  discard block
 block discarded – undo
536 536
 						}
537 537
 					}
538 538
 
539
-                    unset($field);
539
+                    unset( $field );
540 540
                 break;
541 541
             }
542 542
 
543
-            if ( isset($replace_with) ) {
544
-                $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content );
543
+            if ( isset( $replace_with ) ) {
544
+                $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content );
545 545
             }
546 546
 
547
-            unset($atts, $conditional, $replace_with);
547
+            unset( $atts, $conditional, $replace_with );
548 548
 		}
549 549
 
550 550
 		return $content;
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
         $new_value = '';
561 561
         switch ( $tag ) {
562 562
             case 'admin_email':
563
-                $new_value = get_option('admin_email');
563
+                $new_value = get_option( 'admin_email' );
564 564
                 break;
565 565
             case 'siteurl':
566 566
                 $new_value = FrmAppHelper::site_url();
@@ -586,28 +586,28 @@  discard block
 block discarded – undo
586 586
      * @return string|array
587 587
      */
588 588
     public static function process_get_shortcode( $atts, $return_array = false ) {
589
-        if ( ! isset($atts['param']) ) {
589
+        if ( ! isset( $atts['param'] ) ) {
590 590
             return '';
591 591
         }
592 592
 
593
-        if ( strpos($atts['param'], '&#91;') ) {
594
-            $atts['param'] = str_replace('&#91;', '[', $atts['param']);
595
-            $atts['param'] = str_replace('&#93;', ']', $atts['param']);
593
+        if ( strpos( $atts['param'], '&#91;' ) ) {
594
+            $atts['param'] = str_replace( '&#91;', '[', $atts['param'] );
595
+            $atts['param'] = str_replace( '&#93;', ']', $atts['param'] );
596 596
         }
597 597
 
598
-        $new_value = FrmAppHelper::get_param($atts['param'], '');
598
+        $new_value = FrmAppHelper::get_param( $atts['param'], '' );
599 599
         $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] );
600 600
 
601 601
         if ( $new_value == '' ) {
602
-            if ( ! isset($atts['prev_val']) ) {
602
+            if ( ! isset( $atts['prev_val'] ) ) {
603 603
                 $atts['prev_val'] = '';
604 604
             }
605 605
 
606
-            $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val'];
606
+            $new_value = isset( $atts['default'] ) ? $atts['default'] : $atts['prev_val'];
607 607
         }
608 608
 
609
-        if ( is_array($new_value) && ! $return_array ) {
610
-            $new_value = implode(', ', $new_value);
609
+        if ( is_array( $new_value ) && ! $return_array ) {
610
+            $new_value = implode( ', ', $new_value );
611 611
         }
612 612
 
613 613
         return $new_value;
@@ -644,9 +644,9 @@  discard block
 block discarded – undo
644 644
 			'blank' => false, 'link' => false, 'size' => 96
645 645
 		);
646 646
 
647
-		$args = wp_parse_args($args, $defaults);
647
+		$args = wp_parse_args( $args, $defaults );
648 648
 
649
-		$user = get_userdata($user_id);
649
+		$user = get_userdata( $user_id );
650 650
 		$info = '';
651 651
 
652 652
 		if ( $user ) {
@@ -655,16 +655,16 @@  discard block
 block discarded – undo
655 655
 			} elseif ( $user_info == 'author_link' ) {
656 656
 				$info = get_author_posts_url( $user_id );
657 657
 			} else {
658
-				$info = isset($user->$user_info) ? $user->$user_info : '';
658
+				$info = isset( $user->$user_info ) ? $user->$user_info : '';
659 659
 			}
660 660
 
661
-			if ( empty($info) && ! $args['blank'] ) {
661
+			if ( empty( $info ) && ! $args['blank'] ) {
662 662
 				$info = $user->user_login;
663 663
 			}
664 664
 		}
665 665
 
666 666
 		if ( $args['link'] ) {
667
-			$info = '<a href="' .  esc_url( admin_url('user-edit.php?user_id=' . $user_id ) ) . '">' . $info . '</a>';
667
+			$info = '<a href="' . esc_url( admin_url( 'user-edit.php?user_id=' . $user_id ) ) . '">' . $info . '</a>';
668 668
 		}
669 669
 
670 670
 		return $info;
@@ -682,14 +682,14 @@  discard block
 block discarded – undo
682 682
 		$field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() );
683 683
 
684 684
         $field_types = array();
685
-        if ( in_array($type, $single_input) ) {
685
+        if ( in_array( $type, $single_input ) ) {
686 686
             self::field_types_for_input( $single_input, $field_selection, $field_types );
687
-        } else if ( in_array($type, $multiple_input) ) {
687
+        } else if ( in_array( $type, $multiple_input ) ) {
688 688
             self::field_types_for_input( $multiple_input, $field_selection, $field_types );
689
-        } else if ( in_array($type, $other_type) ) {
689
+        } else if ( in_array( $type, $other_type ) ) {
690 690
             self::field_types_for_input( $other_type, $field_selection, $field_types );
691
-		} else if ( isset( $field_selection[ $type ] ) ) {
692
-            $field_types[ $type ] = $field_selection[ $type ];
691
+		} else if ( isset( $field_selection[$type] ) ) {
692
+            $field_types[$type] = $field_selection[$type];
693 693
         }
694 694
 
695 695
 		$field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) );
@@ -698,8 +698,8 @@  discard block
 block discarded – undo
698 698
 
699 699
     private static function field_types_for_input( $inputs, $fields, &$field_types ) {
700 700
         foreach ( $inputs as $input ) {
701
-            $field_types[ $input ] = $fields[ $input ];
702
-            unset($input);
701
+            $field_types[$input] = $fields[$input];
702
+            unset( $input );
703 703
         }
704 704
     }
705 705
 
@@ -744,21 +744,21 @@  discard block
 block discarded – undo
744 744
 		// Check posted vals before checking saved values
745 745
 
746 746
 		// For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
747
-		if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) {
747
+		if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) {
748 748
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
749
-				$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 ] ) : '';
749
+				$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] ) : '';
750 750
 			} else {
751
-				$other_val = sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] );
751
+				$other_val = sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] );
752 752
 			}
753 753
 			return $other_val;
754 754
 
755
-		} else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) {
755
+		} else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) {
756 756
 			// For normal fields
757 757
 
758 758
 			if ( FrmField::is_field_with_multiple_values( $field ) ) {
759
-				$other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) : '';
759
+				$other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta']['other'][$field['id']][$opt_key] ) : '';
760 760
 			} else {
761
-				$other_val = sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ] );
761
+				$other_val = sanitize_text_field( $_POST['item_meta']['other'][$field['id']] );
762 762
 			}
763 763
 			return $other_val;
764 764
 		}
@@ -767,8 +767,8 @@  discard block
 block discarded – undo
767 767
 		if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) {
768 768
 			// Check if there is an "other" val in saved value and make sure the
769 769
 			// "other" val is not equal to the Other checkbox option
770
-			if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) {
771
-				$other_val = $field['value'][ $opt_key ];
770
+			if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) {
771
+				$other_val = $field['value'][$opt_key];
772 772
 			}
773 773
 		} else {
774 774
 			/**
@@ -780,8 +780,8 @@  discard block
 block discarded – undo
780 780
 				// Multi-select dropdowns - key is not preserved
781 781
 				if ( is_array( $field['value'] ) ) {
782 782
 					$o_key = array_search( $temp_val, $field['value'] );
783
-					if ( isset( $field['value'][ $o_key ] ) ) {
784
-						unset( $field['value'][ $o_key ], $o_key );
783
+					if ( isset( $field['value'][$o_key] ) ) {
784
+						unset( $field['value'][$o_key], $o_key );
785 785
 					}
786 786
 				} else if ( $temp_val == $field['value'] ) {
787 787
 					// For radio and regular dropdowns
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 	private static function set_other_name( $args, &$other_args ) {
839 839
 		//Set up name for other field
840 840
 		$other_args['name'] = str_replace( '[]', '', $args['field_name'] );
841
-		$other_args['name'] = preg_replace('/\[' . $args['field']['id'] . '\]$/', '', $other_args['name']);
841
+		$other_args['name'] = preg_replace( '/\[' . $args['field']['id'] . '\]$/', '', $other_args['name'] );
842 842
 		$other_args['name'] = $other_args['name'] . '[other]' . '[' . $args['field']['id'] . ']';
843 843
 
844 844
 		//Converts item_meta[field_id] => item_meta[other][field_id] and
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
 		// Count should only be greater than 3 if inside of a repeating section
866 866
 		if ( count( $temp_array ) > 3 ) {
867 867
 			$parent = str_replace( ']', '', $temp_array[1] );
868
-			$pointer = str_replace( ']', '', $temp_array[2]);
868
+			$pointer = str_replace( ']', '', $temp_array[2] );
869 869
 		}
870 870
 
871 871
 		// Get text for "other" text field
@@ -984,15 +984,15 @@  discard block
 block discarded – undo
984 984
 			$replace_with[] = '[' . $new . ']';
985 985
 			$replace[] = '[' . $old . ' ';
986 986
 			$replace_with[] = '[' . $new . ' ';
987
-            unset($old, $new);
987
+            unset( $old, $new );
988 988
         }
989 989
 		if ( is_array( $val ) ) {
990 990
 			foreach ( $val as $k => $v ) {
991
-                $val[ $k ] = str_replace( $replace, $replace_with, $v );
992
-                unset($k, $v);
991
+                $val[$k] = str_replace( $replace, $replace_with, $v );
992
+                unset( $k, $v );
993 993
             }
994 994
         } else {
995
-            $val = str_replace($replace, $replace_with, $val);
995
+            $val = str_replace( $replace, $replace_with, $val );
996 996
         }
997 997
 
998 998
         return $val;
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
             'DC' => 'District of Columbia',
1006 1006
             'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho',
1007 1007
             'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas',
1008
-            'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland',
1008
+            'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine', 'MD' => 'Maryland',
1009 1009
             'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi',
1010 1010
             'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada',
1011 1011
             'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York',
@@ -1096,35 +1096,35 @@  discard block
 block discarded – undo
1096 1096
     }
1097 1097
 
1098 1098
 	public static function get_bulk_prefilled_opts( array &$prepop ) {
1099
-		$prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries();
1099
+		$prepop[__( 'Countries', 'formidable' )] = FrmFieldsHelper::get_countries();
1100 1100
 
1101 1101
         $states = FrmFieldsHelper::get_us_states();
1102
-        $state_abv = array_keys($states);
1103
-        sort($state_abv);
1104
-		$prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv;
1102
+        $state_abv = array_keys( $states );
1103
+        sort( $state_abv );
1104
+		$prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv;
1105 1105
 
1106
-        $states = array_values($states);
1107
-        sort($states);
1108
-		$prepop[ __( 'U.S. States', 'formidable' ) ] = $states;
1109
-        unset($state_abv, $states);
1106
+        $states = array_values( $states );
1107
+        sort( $states );
1108
+		$prepop[__( 'U.S. States', 'formidable' )] = $states;
1109
+        unset( $state_abv, $states );
1110 1110
 
1111
-		$prepop[ __( 'Age', 'formidable' ) ] = array(
1111
+		$prepop[__( 'Age', 'formidable' )] = array(
1112 1112
             __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ),
1113 1113
             __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ),
1114 1114
             __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ),
1115 1115
         );
1116 1116
 
1117
-		$prepop[ __( 'Satisfaction', 'formidable' ) ] = array(
1117
+		$prepop[__( 'Satisfaction', 'formidable' )] = array(
1118 1118
             __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ),
1119 1119
             __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ),
1120 1120
         );
1121 1121
 
1122
-		$prepop[ __( 'Importance', 'formidable' ) ] = array(
1122
+		$prepop[__( 'Importance', 'formidable' )] = array(
1123 1123
             __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ),
1124 1124
             __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ),
1125 1125
         );
1126 1126
 
1127
-		$prepop[ __( 'Agreement', 'formidable' ) ] = array(
1127
+		$prepop[__( 'Agreement', 'formidable' )] = array(
1128 1128
             __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ),
1129 1129
             __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ),
1130 1130
         );
Please login to merge, or discard this patch.