Completed
Pull Request — master (#1839)
by Stephanie
45s
created
classes/models/FrmEntryValues.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
 	 * @return array
178 178
 	 */
179 179
 	private function prepare_array_property( $index, $atts ) {
180
-		if ( ! empty( $atts[ $index ] ) ) {
180
+		if ( ! empty( $atts[$index] ) ) {
181 181
 
182
-			if ( is_array( $atts[ $index ] ) ) {
183
-				$property = $atts[ $index ];
182
+			if ( is_array( $atts[$index] ) ) {
183
+				$property = $atts[$index];
184 184
 			} else {
185
-				$property = explode( ',', $atts[ $index ] );
185
+				$property = explode( ',', $atts[$index] );
186 186
 			}
187 187
 		} else {
188 188
 			$property = array();
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
 			);
263 263
 		}
264 264
 
265
-		$ip       = array(
265
+		$ip = array(
266 266
 			'label' => __( 'IP Address', 'formidable' ),
267 267
 			'value' => $this->entry->ip,
268 268
 		);
269
-		$browser  = array(
269
+		$browser = array(
270 270
 			'label' => __( 'User-Agent (Browser/OS)', 'formidable' ),
271 271
 			'value' => isset( $entry_description['browser'] ) ? FrmEntriesHelper::get_browser( $entry_description['browser'] ) : '',
272 272
 		);
@@ -353,6 +353,6 @@  discard block
 block discarded – undo
353 353
 	 * @return void
354 354
 	 */
355 355
 	protected function add_field_values( $field ) {
356
-		$this->field_values[ $field->id ] = new FrmFieldValue( $field, $this->entry );
356
+		$this->field_values[$field->id] = new FrmFieldValue( $field, $this->entry );
357 357
 	}
358 358
 }
Please login to merge, or discard this patch.
classes/helpers/FrmSerializedStringParserHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -89,12 +89,12 @@
 block discarded – undo
89 89
 		$string->skip_next_character();
90 90
 
91 91
 		$val = array();
92
-		for ( $i = 0; $i < $count; $i++ ) {
92
+		for ( $i = 0; $i < $count; $i ++ ) {
93 93
 			$array_key   = $this->do_parse( $string );
94 94
 			$array_value = $this->do_parse( $string );
95 95
 
96 96
 			if ( ! is_array( $array_key ) ) {
97
-				$val[ $array_key ] = $array_value;
97
+				$val[$array_key] = $array_value;
98 98
 			}
99 99
 		}
100 100
 
Please login to merge, or discard this patch.
classes/helpers/FrmStringReaderHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 */
51 51
 	public function read_until( $char ) {
52 52
 		$value = '';
53
-		while ( $this->pos <= $this->max && ( $one = $this->string[ $this->pos++ ] ) !== $char ) {
53
+		while ( $this->pos <= $this->max && ( $one = $this->string[$this->pos ++] ) !== $char ) {
54 54
 			$value .= $one;
55 55
 		}
56 56
 		return $value;
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 	public function read( $count ) {
68 68
 		$value = '';
69 69
 
70
-		while ( $count > 0 && $this->pos <= $this->max && ( ( $one = $this->string[ $this->pos ] ) || '0' === $one ) ) {
70
+		while ( $count > 0 && $this->pos <= $this->max && ( ( $one = $this->string[$this->pos] ) || '0' === $one ) ) {
71 71
 			$value     .= $one;
72 72
 			$this->pos += 1;
73
-			--$count;
73
+			-- $count;
74 74
 		}
75 75
 
76 76
 		/**
Please login to merge, or discard this patch.
classes/models/FrmInbox.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 			return;
106 106
 		}
107 107
 
108
-		if ( isset( self::$messages[ $message['key'] ] ) && ! isset( $message['force'] ) ) {
108
+		if ( isset( self::$messages[$message['key']] ) && ! isset( $message['force'] ) ) {
109 109
 			// Don't replace messages unless required.
110 110
 			return;
111 111
 		}
@@ -114,13 +114,13 @@  discard block
 block discarded – undo
114 114
 			return;
115 115
 		}
116 116
 
117
-		if ( isset( self::$messages[ $message['key'] ] ) ) {
117
+		if ( isset( self::$messages[$message['key']] ) ) {
118 118
 			// Move up and mark as new.
119
-			unset( self::$messages[ $message['key'] ] );
119
+			unset( self::$messages[$message['key']] );
120 120
 		}
121 121
 
122 122
 		$this->fill_message( $message );
123
-		self::$messages[ $message['key'] ] = $message;
123
+		self::$messages[$message['key']] = $message;
124 124
 
125 125
 		$this->update_list();
126 126
 
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
 	private function clean_messages() {
158 158
 		$removed = false;
159 159
 		foreach ( self::$messages as $t => $message ) {
160
-			$read      = ! empty( $message['read'] ) && isset( $message['read'][ get_current_user_id() ] ) && $message['read'][ get_current_user_id() ] < strtotime( '-1 month' );
161
-			$dismissed = ! empty( $message['dismissed'] ) && isset( $message['dismissed'][ get_current_user_id() ] ) && $message['dismissed'][ get_current_user_id() ] < strtotime( '-1 week' );
160
+			$read      = ! empty( $message['read'] ) && isset( $message['read'][get_current_user_id()] ) && $message['read'][get_current_user_id()] < strtotime( '-1 month' );
161
+			$dismissed = ! empty( $message['dismissed'] ) && isset( $message['dismissed'][get_current_user_id()] ) && $message['dismissed'][get_current_user_id()] < strtotime( '-1 week' );
162 162
 			$expired   = $this->is_expired( $message );
163 163
 			if ( $read || $expired || $dismissed ) {
164
-				unset( self::$messages[ $t ] );
164
+				unset( self::$messages[$t] );
165 165
 				$removed = true;
166 166
 			}
167 167
 		}
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
 	public function filter_messages( &$messages, $type = 'unread' ) {
180 180
 		$user_id = get_current_user_id();
181 181
 		foreach ( $messages as $k => $message ) {
182
-			$dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][ $user_id ] );
182
+			$dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][$user_id] );
183 183
 			if ( empty( $k ) || $this->is_expired( $message ) || ( $type === 'dismissed' ) !== $dismissed ) {
184
-				unset( $messages[ $k ] );
184
+				unset( $messages[$k] );
185 185
 			} elseif ( ! $this->is_for_user( $message ) ) {
186
-				unset( $messages[ $k ] );
186
+				unset( $messages[$k] );
187 187
 			}
188 188
 		}
189 189
 		$messages = apply_filters( 'frm_filter_inbox', $messages );
@@ -241,14 +241,14 @@  discard block
 block discarded – undo
241 241
 	 * @return void
242 242
 	 */
243 243
 	public function mark_read( $key ) {
244
-		if ( ! $key || ! isset( self::$messages[ $key ] ) ) {
244
+		if ( ! $key || ! isset( self::$messages[$key] ) ) {
245 245
 			return;
246 246
 		}
247 247
 
248
-		if ( ! isset( self::$messages[ $key ]['read'] ) ) {
249
-			self::$messages[ $key ]['read'] = array();
248
+		if ( ! isset( self::$messages[$key]['read'] ) ) {
249
+			self::$messages[$key]['read'] = array();
250 250
 		}
251
-		self::$messages[ $key ]['read'][ get_current_user_id() ] = time();
251
+		self::$messages[$key]['read'][get_current_user_id()] = time();
252 252
 
253 253
 		$this->update_list();
254 254
 	}
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
 	 * @return void
261 261
 	 */
262 262
 	public function mark_unread( $key ) {
263
-		$is_read = isset( self::$messages[ $key ] ) && isset( self::$messages[ $key ]['read'] ) && isset( self::$messages[ $key ]['read'][ get_current_user_id() ] );
263
+		$is_read = isset( self::$messages[$key] ) && isset( self::$messages[$key]['read'] ) && isset( self::$messages[$key]['read'][get_current_user_id()] );
264 264
 		if ( $is_read ) {
265
-			unset( self::$messages[ $key ]['read'][ get_current_user_id() ] );
265
+			unset( self::$messages[$key]['read'][get_current_user_id()] );
266 266
 			$this->update_list();
267 267
 		}
268 268
 	}
@@ -278,14 +278,14 @@  discard block
 block discarded – undo
278 278
 			return;
279 279
 		}
280 280
 
281
-		if ( ! isset( self::$messages[ $key ] ) ) {
281
+		if ( ! isset( self::$messages[$key] ) ) {
282 282
 			return;
283 283
 		}
284 284
 
285
-		if ( ! isset( self::$messages[ $key ]['dismissed'] ) ) {
286
-			self::$messages[ $key ]['dismissed'] = array();
285
+		if ( ! isset( self::$messages[$key]['dismissed'] ) ) {
286
+			self::$messages[$key]['dismissed'] = array();
287 287
 		}
288
-		self::$messages[ $key ]['dismissed'][ get_current_user_id() ] = time();
288
+		self::$messages[$key]['dismissed'][get_current_user_id()] = time();
289 289
 
290 290
 		$this->update_list();
291 291
 	}
@@ -299,11 +299,11 @@  discard block
 block discarded – undo
299 299
 		$user_id = get_current_user_id();
300 300
 		foreach ( self::$messages as $key => $message ) {
301 301
 			if ( ! isset( $message['dismissed'] ) ) {
302
-				self::$messages[ $key ]['dismissed'] = array();
302
+				self::$messages[$key]['dismissed'] = array();
303 303
 			}
304 304
 
305
-			if ( ! isset( $message['dismissed'][ $user_id ] ) ) {
306
-				self::$messages[ $key ]['dismissed'][ $user_id ] = time();
305
+			if ( ! isset( $message['dismissed'][$user_id] ) ) {
306
+				self::$messages[$key]['dismissed'][$user_id] = time();
307 307
 			}
308 308
 		}
309 309
 		$this->update_list();
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
 		$messages = $this->get_messages( 'filter' );
314 314
 		$user_id  = get_current_user_id();
315 315
 		foreach ( $messages as $t => $message ) {
316
-			if ( isset( $message['read'] ) && isset( $message['read'][ $user_id ] ) ) {
317
-				unset( $messages[ $t ] );
316
+			if ( isset( $message['read'] ) && isset( $message['read'][$user_id] ) ) {
317
+				unset( $messages[$t] );
318 318
 			}
319 319
 		}
320 320
 		return $messages;
@@ -353,8 +353,8 @@  discard block
 block discarded – undo
353 353
 	 * @return void
354 354
 	 */
355 355
 	public function remove( $key ) {
356
-		if ( isset( self::$messages[ $key ] ) ) {
357
-			unset( self::$messages[ $key ] );
356
+		if ( isset( self::$messages[$key] ) ) {
357
+			unset( self::$messages[$key] );
358 358
 			$this->update_list();
359 359
 		}
360 360
 	}
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 			 * @param array $matches The regex results for a single match.
401 401
 			 * @return string
402 402
 			 */
403
-			function ( $matches ) {
403
+			function( $matches ) {
404 404
 				$url   = $matches[2];
405 405
 				$parts = parse_url( $url );
406 406
 
@@ -463,8 +463,8 @@  discard block
 block discarded – undo
463 463
 		$inbox = new self();
464 464
 		return array_filter(
465 465
 			$inbox->get_messages( 'filter' ),
466
-			function ( $message ) use ( $key ) {
467
-				return ! empty( $message[ $key ] );
466
+			function( $message ) use ( $key ) {
467
+				return ! empty( $message[$key] );
468 468
 			}
469 469
 		);
470 470
 	}
@@ -510,8 +510,8 @@  discard block
 block discarded – undo
510 510
 
511 511
 		return array_reduce(
512 512
 			$keys_to_return,
513
-			function ( $total, $key ) use ( $message ) {
514
-				$total[ $key ] = isset( $message[ $key ] ) ? $message[ $key ] : '';
513
+			function( $total, $key ) use ( $message ) {
514
+				$total[$key] = isset( $message[$key] ) ? $message[$key] : '';
515 515
 				return $total;
516 516
 			},
517 517
 			array()
Please login to merge, or discard this patch.
classes/controllers/FrmFieldsController.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 		$_GET['page'] = 'formidable';
27 27
 
28
-		$values     = array(
28
+		$values = array(
29 29
 			'id'         => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ),
30 30
 			'doing_ajax' => true,
31 31
 		);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 			ob_start();
50 50
 			self::load_single_field( $field, $values );
51
-			$field_html[ absint( $field->id ) ] = ob_get_contents();
51
+			$field_html[absint( $field->id )] = ob_get_contents();
52 52
 			ob_end_clean();
53 53
 		}
54 54
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			foreach ( $opts as $opt_key => $opt ) {
259 259
 				if ( strpos( $opt, '|' ) !== false ) {
260 260
 					$vals             = explode( '|', $opt );
261
-					$opts[ $opt_key ] = array(
261
+					$opts[$opt_key] = array(
262 262
 						'label' => trim( $vals[0] ),
263 263
 						'value' => trim( $vals[1] ),
264 264
 					);
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 			$other_array = array();
274 274
 			foreach ( $field['options'] as $opt_key => $opt ) {
275 275
 				if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) {
276
-					$other_array[ $opt_key ] = $opt;
276
+					$other_array[$opt_key] = $opt;
277 277
 				}
278 278
 				unset( $opt_key, $opt );
279 279
 			}
@@ -315,18 +315,18 @@  discard block
 block discarded – undo
315 315
 		$frm_settings         = FrmAppHelper::get_settings();
316 316
 		$field_types          = FrmFieldTypeOptionData::get_field_types( $field['type'] );
317 317
 
318
-		if ( ! isset( $all_field_types[ $field['type'] ] ) ) {
318
+		if ( ! isset( $all_field_types[$field['type']] ) ) {
319 319
 			// Add fallback for an add-on field type that has been deactivated.
320
-			$all_field_types[ $field['type'] ] = array(
320
+			$all_field_types[$field['type']] = array(
321 321
 				'name' => ucfirst( $field['type'] ),
322 322
 				'icon' => 'frm_icon_font frm_pencil_icon',
323 323
 			);
324
-		} elseif ( ! is_array( $all_field_types[ $field['type'] ] ) ) {
324
+		} elseif ( ! is_array( $all_field_types[$field['type']] ) ) {
325 325
 			// Fallback for fields added in a more basic way.
326
-			FrmFormsHelper::prepare_field_type( $all_field_types[ $field['type'] ] );
326
+			FrmFormsHelper::prepare_field_type( $all_field_types[$field['type']] );
327 327
 		}
328 328
 
329
-		$type_name = $all_field_types[ $field['type'] ]['name'];
329
+		$type_name = $all_field_types[$field['type']]['name'];
330 330
 		if ( $field['type'] === 'divider' && FrmField::is_option_true( $field, 'repeat' ) ) {
331 331
 			$type_name = $all_field_types['divider|repeat']['name'];
332 332
 		}
@@ -400,13 +400,13 @@  discard block
 block discarded – undo
400 400
 		$active   = 'default_value';
401 401
 
402 402
 		foreach ( $settings as $type ) {
403
-			if ( ! empty( $field[ $type ] ) ) {
403
+			if ( ! empty( $field[$type] ) ) {
404 404
 				$active = $type;
405 405
 			}
406 406
 		}
407 407
 
408
-		$types[ $active ]['class']  .= ' current';
409
-		$types[ $active ]['current'] = true;
408
+		$types[$active]['class']  .= ' current';
409
+		$types[$active]['current'] = true;
410 410
 
411 411
 		return $types;
412 412
 	}
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
 			'website' => 'url',
421 421
 			'image'   => 'url',
422 422
 		);
423
-		if ( isset( $type_switch[ $type ] ) ) {
424
-			$type = $type_switch[ $type ];
423
+		if ( isset( $type_switch[$type] ) ) {
424
+			$type = $type_switch[$type];
425 425
 		}
426 426
 
427 427
 		$pro_fields = FrmField::pro_field_selection();
@@ -556,11 +556,11 @@  discard block
 block discarded – undo
556 556
 		// include "col" for valid html
557 557
 		$unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) );
558 558
 
559
-		if ( ! isset( $calc[ $unit ] ) ) {
559
+		if ( ! isset( $calc[$unit] ) ) {
560 560
 			return;
561 561
 		}
562 562
 
563
-		$size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ];
563
+		$size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit];
564 564
 
565 565
 		$add_html['cols'] = 'cols="' . absint( $size ) . '"';
566 566
 	}
@@ -792,11 +792,11 @@  discard block
 block discarded – undo
792 792
 	private static function get_form_for_js_validation( $field ) {
793 793
 		global $frm_vars;
794 794
 		if ( ! empty( $frm_vars['js_validate_forms'] ) ) {
795
-			if ( isset( $frm_vars['js_validate_forms'][ $field['form_id'] ] ) ) {
796
-				return $frm_vars['js_validate_forms'][ $field['form_id'] ];
795
+			if ( isset( $frm_vars['js_validate_forms'][$field['form_id']] ) ) {
796
+				return $frm_vars['js_validate_forms'][$field['form_id']];
797 797
 			}
798
-			if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][ $field['parent_form_id'] ] ) ) {
799
-				return $frm_vars['js_validate_forms'][ $field['parent_form_id'] ];
798
+			if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][$field['parent_form_id']] ) ) {
799
+				return $frm_vars['js_validate_forms'][$field['parent_form_id']];
800 800
 			}
801 801
 		}
802 802
 		return false;
@@ -881,10 +881,10 @@  discard block
 block discarded – undo
881 881
 
882 882
 			if ( is_numeric( $k ) && strpos( $v, '=' ) ) {
883 883
 				$add_html[] = $v;
884
-			} elseif ( ! empty( $k ) && isset( $add_html[ $k ] ) ) {
885
-				$add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] );
884
+			} elseif ( ! empty( $k ) && isset( $add_html[$k] ) ) {
885
+				$add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] );
886 886
 			} else {
887
-				$add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"';
887
+				$add_html[$k] = $k . '="' . esc_attr( $v ) . '"';
888 888
 			}
889 889
 
890 890
 			unset( $k, $v );
Please login to merge, or discard this patch.
classes/models/FrmFieldTypeOptionData.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@
 block discarded – undo
19 19
 	 * @return array
20 20
 	 */
21 21
 	public static function get_field_types( $type ) {
22
-		if ( ! isset( self::$data[ $type ] ) ) {
23
-			self::$data[ $type ] = FrmFieldsHelper::get_field_types( $type );
22
+		if ( ! isset( self::$data[$type] ) ) {
23
+			self::$data[$type] = FrmFieldsHelper::get_field_types( $type );
24 24
 		}
25
-		return self::$data[ $type ];
25
+		return self::$data[$type];
26 26
 	}
27 27
 }
Please login to merge, or discard this patch.
classes/models/fields/FrmFieldUserID.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
 	protected function get_field_value( $args ) {
59 59
 		$user_ID      = get_current_user_id();
60 60
 		$user_ID      = ( $user_ID ? $user_ID : '' );
61
-		$posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][ $this->field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
61
+		$posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][$this->field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
62 62
 		$action       = ( isset( $args['action'] ) ? $args['action'] : ( isset( $args['form_action'] ) ? $args['form_action'] : '' ) );
63 63
 		$updating     = $action === 'update';
64 64
 		return is_numeric( $this->field['value'] ) || $posted_value || $updating ? $this->field['value'] : $user_ID;
Please login to merge, or discard this patch.
classes/models/FrmForm.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 			}
210 210
 
211 211
 			if ( $new_val !== $value ) {
212
-				$new_values[ $key ] = $new_val;
212
+				$new_values[$key] = $new_val;
213 213
 			}
214 214
 		}//end foreach
215 215
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
 		foreach ( $values as $value_key => $value ) {
242 242
 			if ( $value_key && in_array( $value_key, $form_fields ) ) {
243
-				$new_values[ $value_key ] = $value;
243
+				$new_values[$value_key] = $value;
244 244
 			}
245 245
 		}
246 246
 
@@ -323,15 +323,15 @@  discard block
 block discarded – undo
323 323
 		$existing_keys = array_keys( $values['item_meta'] );
324 324
 		foreach ( $all_fields as $fid ) {
325 325
 			if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) {
326
-				$values['item_meta'][ $fid->id ] = '';
326
+				$values['item_meta'][$fid->id] = '';
327 327
 			}
328
-			$field_array[ $fid->id ] = $fid;
328
+			$field_array[$fid->id] = $fid;
329 329
 		}
330 330
 		unset( $all_fields );
331 331
 
332 332
 		foreach ( $values['item_meta'] as $field_id => $default_value ) {
333
-			if ( isset( $field_array[ $field_id ] ) ) {
334
-				$field = $field_array[ $field_id ];
333
+			if ( isset( $field_array[$field_id] ) ) {
334
+				$field = $field_array[$field_id];
335 335
 			} else {
336 336
 				$field = FrmField::getOne( $field_id );
337 337
 			}
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 				continue;
341 341
 			}
342 342
 
343
-			$is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) );
343
+			$is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) );
344 344
 			if ( $is_settings_page ) {
345 345
 				self::get_settings_page_html( $values, $field );
346 346
 
@@ -356,22 +356,22 @@  discard block
 block discarded – undo
356 356
 			$update_options = apply_filters( 'frm_field_options_to_update', $update_options );
357 357
 
358 358
 			foreach ( $update_options as $opt => $default ) {
359
-				$field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default;
360
-				self::sanitize_field_opt( $opt, $field->field_options[ $opt ] );
359
+				$field->field_options[$opt] = isset( $values['field_options'][$opt . '_' . $field_id] ) ? $values['field_options'][$opt . '_' . $field_id] : $default;
360
+				self::sanitize_field_opt( $opt, $field->field_options[$opt] );
361 361
 			}
362 362
 
363 363
 			$field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values );
364 364
 
365 365
 			$new_field = array(
366 366
 				'field_options' => $field->field_options,
367
-				'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '',
367
+				'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '',
368 368
 			);
369 369
 
370
-			if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) {
371
-				foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) {
370
+			if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) {
371
+				foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) {
372 372
 					if ( is_array( $option ) ) {
373 373
 						foreach ( $option as $key => $item ) {
374
-							$values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' );
374
+							$values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' );
375 375
 						}
376 376
 					}
377 377
 				}
@@ -401,8 +401,8 @@  discard block
 block discarded – undo
401 401
 	 */
402 402
 	private static function maybe_update_max_option( $field, $values, &$new_field ) {
403 403
 		if ( $field->type === 'textarea' &&
404
-			! empty( $values['field_options'][ 'type_' . $field->id ] ) &&
405
-			in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) {
404
+			! empty( $values['field_options']['type_' . $field->id] ) &&
405
+			in_array( $values['field_options']['type_' . $field->id], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) {
406 406
 
407 407
 			$new_field['field_options']['max'] = '';
408 408
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 			 * Update posted field setting so that new 'max' option is displayed after form is saved and page reloads.
411 411
 			 * FrmFieldsHelper::fill_default_field_opts populates field options by calling self::get_posted_field_setting.
412 412
 			 */
413
-			$_POST['field_options'][ 'max_' . $field->id ] = '';
413
+			$_POST['field_options']['max_' . $field->id] = '';
414 414
 		}
415 415
 	}
416 416
 
@@ -486,11 +486,11 @@  discard block
 block discarded – undo
486 486
 	 * Updating the settings page
487 487
 	 */
488 488
 	private static function get_settings_page_html( $values, &$field ) {
489
-		if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) {
489
+		if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) {
490 490
 			$prev_opts     = array();
491 491
 			$fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type );
492 492
 
493
-			$field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html;
493
+			$field->field_options['custom_html'] = isset( $values['field_options']['custom_html_' . $field->id] ) ? $values['field_options']['custom_html_' . $field->id] : $fallback_html;
494 494
 		} elseif ( $field->type === 'hidden' || $field->type === 'user_id' ) {
495 495
 			$prev_opts = $field->field_options;
496 496
 		}
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 		foreach ( $field_cols as $col => $default ) {
517 517
 			$default = $default === '' ? $field->{$col} : $default;
518 518
 
519
-			$new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default;
519
+			$new_field[$col] = isset( $values['field_options'][$col . '_' . $field->id] ) ? $values['field_options'][$col . '_' . $field->id] : $default;
520 520
 		}
521 521
 
522 522
 		// Don't save the template option.
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 			if ( ! isset( $form->options['trash_time'] ) || $form->options['trash_time'] < $delete_timestamp ) {
697 697
 				self::destroy( $form->id );
698 698
 				if ( empty( $form->parent_form_id ) ) {
699
-					++$count;
699
+					++ $count;
700 700
 				}
701 701
 			}
702 702
 
@@ -920,16 +920,16 @@  discard block
 block discarded – undo
920 920
 		foreach ( $results as $row ) {
921 921
 			if ( 'trash' != $row->status ) {
922 922
 				if ( $row->is_template ) {
923
-					++$counts['template'];
923
+					++ $counts['template'];
924 924
 				} else {
925
-					++$counts['published'];
925
+					++ $counts['published'];
926 926
 				}
927 927
 			} else {
928
-				++$counts['trash'];
928
+				++ $counts['trash'];
929 929
 			}
930 930
 
931 931
 			if ( 'draft' == $row->status ) {
932
-				++$counts['draft'];
932
+				++ $counts['draft'];
933 933
 			}
934 934
 
935 935
 			unset( $row );
@@ -970,8 +970,8 @@  discard block
 block discarded – undo
970 970
 			self::maybe_get_form( $form );
971 971
 		}
972 972
 
973
-		if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) {
974
-			return $frm_vars['form_params'][ $form->id ];
973
+		if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) {
974
+			return $frm_vars['form_params'][$form->id];
975 975
 		}
976 976
 
977 977
 		$action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing
@@ -1000,15 +1000,15 @@  discard block
 block discarded – undo
1000 1000
 			// If there are two forms on the same page, make sure not to submit both.
1001 1001
 			foreach ( $default_values as $var => $default ) {
1002 1002
 				if ( $var === 'action' ) {
1003
-					$values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' );
1003
+					$values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' );
1004 1004
 				} else {
1005
-					$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
1005
+					$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
1006 1006
 				}
1007 1007
 				unset( $var, $default );
1008 1008
 			}
1009 1009
 		} else {
1010 1010
 			foreach ( $default_values as $var => $default ) {
1011
-				$values[ $var ] = $default;
1011
+				$values[$var] = $default;
1012 1012
 				unset( $var, $default );
1013 1013
 			}
1014 1014
 		}
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
 			'sdir'     => '',
1035 1035
 		);
1036 1036
 		foreach ( $defaults as $var => $default ) {
1037
-			$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
1037
+			$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
1038 1038
 		}
1039 1039
 
1040 1040
 		return $values;
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
 			'keep_post' => '',
1063 1063
 		);
1064 1064
 		foreach ( $defaults as $var => $default ) {
1065
-			$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
1065
+			$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
1066 1066
 		}
1067 1067
 
1068 1068
 		return $values;
@@ -1165,7 +1165,7 @@  discard block
 block discarded – undo
1165 1165
 		$form    = $atts['form'];
1166 1166
 		$default = isset( $atts['default'] ) ? $atts['default'] : '';
1167 1167
 
1168
-		return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $default;
1168
+		return isset( $form->options[$atts['option']] ) ? $form->options[$atts['option']] : $default;
1169 1169
 	}
1170 1170
 
1171 1171
 	/**
Please login to merge, or discard this patch.
classes/models/FrmSettings.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
 		}
230 230
 
231 231
 		foreach ( $settings as $setting => $default ) {
232
-			if ( isset( $params[ 'frm_' . $setting ] ) ) {
233
-				$this->{$setting} = $params[ 'frm_' . $setting ];
232
+			if ( isset( $params['frm_' . $setting] ) ) {
233
+				$this->{$setting} = $params['frm_' . $setting];
234 234
 			} elseif ( ! isset( $this->{$setting} ) ) {
235 235
 				$this->{$setting} = $default;
236 236
 			}
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 
408 408
 		$checkboxes = array( 'mu_menu', 're_multi', 'use_html', 'jquery_css', 'accordion_js', 'fade_form', 'no_ips', 'custom_header_ip', 'tracking', 'admin_bar', 'summary_emails' );
409 409
 		foreach ( $checkboxes as $set ) {
410
-			$this->$set = isset( $params[ 'frm_' . $set ] ) ? absint( $params[ 'frm_' . $set ] ) : 0;
410
+			$this->$set = isset( $params['frm_' . $set] ) ? absint( $params['frm_' . $set] ) : 0;
411 411
 		}
412 412
 	}
413 413
 
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 		$frm_roles = FrmAppHelper::frm_capabilities();
421 421
 		$roles     = get_editable_roles();
422 422
 		foreach ( $frm_roles as $frm_role => $frm_role_description ) {
423
-			$this->$frm_role = (array) ( isset( $params[ $frm_role ] ) ? $params[ $frm_role ] : 'administrator' );
423
+			$this->$frm_role = (array) ( isset( $params[$frm_role] ) ? $params[$frm_role] : 'administrator' );
424 424
 
425 425
 			// Make sure administrators always have permissions
426 426
 			if ( ! in_array( 'administrator', $this->$frm_role, true ) ) {
Please login to merge, or discard this patch.