Completed
Pull Request — master (#2609)
by
unknown
41s
created
classes/models/FrmEntry.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 * @return void
57 57
 	 */
58 58
 	private static function flag_new_unique_key( $unique_id ) {
59
-		if ( ! isset( self::$unique_id_match_checks[ $unique_id ] ) ) {
60
-			self::$unique_id_match_checks[ $unique_id ] = false;
59
+		if ( ! isset( self::$unique_id_match_checks[$unique_id] ) ) {
60
+			self::$unique_id_match_checks[$unique_id] = false;
61 61
 		}
62 62
 	}
63 63
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 				if ( 0 === (int) $meta->field_id ) {
110 110
 					continue;
111 111
 				}
112
-				$field_metas[ $meta->field_id ] = $meta->meta_value;
112
+				$field_metas[$meta->field_id] = $meta->meta_value;
113 113
 			}
114 114
 
115 115
 			$filtered_vals = array_filter( $values['item_meta'] );
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 			return false;
175 175
 		}
176 176
 
177
-		if ( isset( self::$unique_id_match_checks[ $unique_id ] ) ) {
178
-			return self::$unique_id_match_checks[ $unique_id ];
177
+		if ( isset( self::$unique_id_match_checks[$unique_id] ) ) {
178
+			return self::$unique_id_match_checks[$unique_id];
179 179
 		}
180 180
 
181 181
 		$timestamp = strtotime( $created_at );
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 			$timestamp = time();
184 184
 		}
185 185
 
186
-		self::$unique_id_match_checks[ $unique_id ] = (bool) FrmDb::get_var(
186
+		self::$unique_id_match_checks[$unique_id] = (bool) FrmDb::get_var(
187 187
 			'frm_item_metas',
188 188
 			array(
189 189
 				'field_id'     => 0,
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 			'id'
194 194
 		);
195 195
 
196
-		return self::$unique_id_match_checks[ $unique_id ];
196
+		return self::$unique_id_match_checks[$unique_id];
197 197
 	}
198 198
 
199 199
 	/**
@@ -223,10 +223,10 @@  discard block
 block discarded – undo
223 223
 		$reduced = array();
224 224
 		foreach ( $filter_vals as $field_id => $value ) {
225 225
 			$field                = FrmFieldFactory::get_field_object( $field_id );
226
-			$reduced[ $field_id ] = $field->get_value_to_save( $value, array( 'entry_id' => $entry_id ) );
227
-			$reduced[ $field_id ] = $field->set_value_before_save( $reduced[ $field_id ] );
228
-			if ( '' === $reduced[ $field_id ] || ( is_array( $reduced[ $field_id ] ) && 0 === count( $reduced[ $field_id ] ) ) ) {
229
-				unset( $reduced[ $field_id ] );
226
+			$reduced[$field_id] = $field->get_value_to_save( $value, array( 'entry_id' => $entry_id ) );
227
+			$reduced[$field_id] = $field->set_value_before_save( $reduced[$field_id] );
228
+			if ( '' === $reduced[$field_id] || ( is_array( $reduced[$field_id] ) && 0 === count( $reduced[$field_id] ) ) ) {
229
+				unset( $reduced[$field_id] );
230 230
 			}
231 231
 		}
232 232
 		return $reduced;
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 	private static function prepare_entries( &$entries ) {
490 490
 		foreach ( $entries as $k => $entry ) {
491 491
 			self::prepare_entry( $entry );
492
-			$entries[ $k ] = $entry;
492
+			$entries[$k] = $entry;
493 493
 		}
494 494
 	}
495 495
 
@@ -515,19 +515,19 @@  discard block
 block discarded – undo
515 515
 			FrmFieldsHelper::prepare_field_value( $meta_val->meta_value, $meta_val->type );
516 516
 
517 517
 			if ( $meta_val->item_id == $entry->id ) {
518
-				$entry->metas[ $meta_val->field_id ] = $meta_val->meta_value;
518
+				$entry->metas[$meta_val->field_id] = $meta_val->meta_value;
519 519
 				if ( $include_key ) {
520
-					$entry->metas[ $meta_val->field_key ] = $entry->metas[ $meta_val->field_id ];
520
+					$entry->metas[$meta_val->field_key] = $entry->metas[$meta_val->field_id];
521 521
 				}
522 522
 				continue;
523 523
 			}
524 524
 
525 525
 			// include sub entries in an array
526
-			if ( ! isset( $entry->metas[ $meta_val->field_id ] ) ) {
527
-				$entry->metas[ $meta_val->field_id ] = array();
526
+			if ( ! isset( $entry->metas[$meta_val->field_id] ) ) {
527
+				$entry->metas[$meta_val->field_id] = array();
528 528
 			}
529 529
 
530
-			$entry->metas[ $meta_val->field_id ][] = $meta_val->meta_value;
530
+			$entry->metas[$meta_val->field_id][] = $meta_val->meta_value;
531 531
 
532 532
 			unset( $meta_val );
533 533
 		}
@@ -622,16 +622,16 @@  discard block
 block discarded – undo
622 622
 		}
623 623
 
624 624
 		foreach ( $metas as $m_key => $meta_val ) {
625
-			if ( ! isset( $entries[ $meta_val->item_id ] ) ) {
625
+			if ( ! isset( $entries[$meta_val->item_id] ) ) {
626 626
 				continue;
627 627
 			}
628 628
 
629
-			if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) {
630
-				$entries[ $meta_val->item_id ]->metas = array();
629
+			if ( ! isset( $entries[$meta_val->item_id]->metas ) ) {
630
+				$entries[$meta_val->item_id]->metas = array();
631 631
 			}
632 632
 
633 633
 			FrmFieldsHelper::prepare_field_value( $meta_val->meta_value, $meta_val->type );
634
-			$entries[ $meta_val->item_id ]->metas[ $meta_val->field_id ] = $meta_val->meta_value;
634
+			$entries[$meta_val->item_id]->metas[$meta_val->field_id] = $meta_val->meta_value;
635 635
 			unset( $m_key, $meta_val );
636 636
 		}
637 637
 
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 	}
815 815
 
816 816
 	private static function get_entry_value( $values, $name, $default ) {
817
-		return $values[ $name ] ?? $default;
817
+		return $values[$name] ?? $default;
818 818
 	}
819 819
 
820 820
 	/**
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
 	private static function maybe_add_captcha_meta( $form_id, $entry_id ) {
1022 1022
 		global $frm_vars;
1023 1023
 		if ( array_key_exists( 'captcha_scores', $frm_vars ) && array_key_exists( $form_id, $frm_vars['captcha_scores'] ) ) {
1024
-			$captcha_score_meta = array( 'captcha_score' => $frm_vars['captcha_scores'][ $form_id ] );
1024
+			$captcha_score_meta = array( 'captcha_score' => $frm_vars['captcha_scores'][$form_id] );
1025 1025
 			FrmEntryMeta::add_entry_meta( $entry_id, 0, '', maybe_serialize( $captcha_score_meta ) );
1026 1026
 		}
1027 1027
 	}
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
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 		}
240 240
 
241 241
 		foreach ( $settings as $setting => $default ) {
242
-			if ( isset( $params[ 'frm_' . $setting ] ) ) {
243
-				$this->{$setting} = $params[ 'frm_' . $setting ];
242
+			if ( isset( $params['frm_' . $setting] ) ) {
243
+				$this->{$setting} = $params['frm_' . $setting];
244 244
 			} elseif ( ! isset( $this->{$setting} ) ) {
245 245
 				$this->{$setting} = $default;
246 246
 			}
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 			'denylist_check',
433 433
 		);
434 434
 		foreach ( $checkboxes as $set ) {
435
-			$this->$set = isset( $params[ 'frm_' . $set ] ) ? absint( $params[ 'frm_' . $set ] ) : 0;
435
+			$this->$set = isset( $params['frm_' . $set] ) ? absint( $params['frm_' . $set] ) : 0;
436 436
 		}
437 437
 	}
438 438
 
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 		$frm_roles = FrmAppHelper::frm_capabilities();
446 446
 		$roles     = get_editable_roles();
447 447
 		foreach ( $frm_roles as $frm_role => $frm_role_description ) {
448
-			$this->$frm_role = (array) ( $params[ $frm_role ] ?? 'administrator' );
448
+			$this->$frm_role = (array) ( $params[$frm_role] ?? 'administrator' );
449 449
 
450 450
 			// Make sure administrators always have permissions
451 451
 			if ( ! in_array( 'administrator', $this->$frm_role, true ) ) {
Please login to merge, or discard this patch.
classes/models/FrmFormAction.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 		$groups = FrmFormActionsController::form_action_groups();
209 209
 		$group  = 'misc';
210 210
 
211
-		if ( isset( $action_options['group'] ) && isset( $groups[ $action_options['group'] ] ) ) {
211
+		if ( isset( $action_options['group'] ) && isset( $groups[$action_options['group']] ) ) {
212 212
 			$group = $action_options['group'];
213
-		} elseif ( isset( $groups[ $this->id_base ] ) ) {
213
+		} elseif ( isset( $groups[$this->id_base] ) ) {
214 214
 			$group = $this->id_base;
215 215
 		} else {
216 216
 			foreach ( $groups as $name => $check_group ) {
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 			}
222 222
 		}
223 223
 
224
-		$groups[ $group ]['id'] = $group;
225
-		return $groups[ $group ];
224
+		$groups[$group]['id'] = $group;
225
+		return $groups[$group];
226 226
 	}
227 227
 
228 228
 	/**
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	 * @return int $post_id
334 334
 	 */
335 335
 	public function maybe_create_action( $action, $forms ) {
336
-		if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[ $action['menu_order'] ] ) && $forms[ $action['menu_order'] ] === 'updated' ) {
336
+		if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[$action['menu_order']] ) && $forms[$action['menu_order']] === 'updated' ) {
337 337
 			// Update action only
338 338
 			$action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] );
339 339
 			$post_id                = $this->save_settings( $action );
@@ -356,18 +356,18 @@  discard block
 block discarded – undo
356 356
 		$switch             = $this->get_global_switch_fields();
357 357
 
358 358
 		foreach ( (array) $action->post_content as $key => $val ) {
359
-			if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) {
360
-				$action->post_content[ $key ] = $frm_duplicate_ids[ $val ];
359
+			if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) {
360
+				$action->post_content[$key] = $frm_duplicate_ids[$val];
361 361
 			} elseif ( ! is_array( $val ) ) {
362
-				$action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val );
363
-			} elseif ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) {
362
+				$action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val );
363
+			} elseif ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) {
364 364
 				// loop through each value if empty
365
-				if ( empty( $switch[ $key ] ) ) {
366
-					$switch[ $key ] = array_keys( $val );
365
+				if ( empty( $switch[$key] ) ) {
366
+					$switch[$key] = array_keys( $val );
367 367
 				}
368 368
 
369
-				foreach ( $switch[ $key ] as $subkey ) {
370
-					$action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val );
369
+				foreach ( $switch[$key] as $subkey ) {
370
+					$action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val );
371 371
 				}
372 372
 			}
373 373
 
@@ -385,20 +385,20 @@  discard block
 block discarded – undo
385 385
 			foreach ( $subkey as $subkey2 ) {
386 386
 				foreach ( (array) $val as $ck => $cv ) {
387 387
 					if ( is_array( $cv ) ) {
388
-						$action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv );
389
-					} elseif ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) {
390
-						$action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ];
388
+						$action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv );
389
+					} elseif ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) {
390
+						$action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]];
391 391
 					}
392 392
 				}
393 393
 			}
394 394
 		} else {
395 395
 			foreach ( (array) $val as $ck => $cv ) {
396 396
 				if ( is_array( $cv ) ) {
397
-					$action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv );
398
-				} elseif ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) {
399
-					$action[ $ck ] = $frm_duplicate_ids[ $cv ];
397
+					$action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv );
398
+				} elseif ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) {
399
+					$action[$ck] = $frm_duplicate_ids[$cv];
400 400
 				} elseif ( $ck == $subkey ) {
401
-					$action[ $ck ] = $this->maybe_switch_field_ids( $action[ $ck ] );
401
+					$action[$ck] = $this->maybe_switch_field_ids( $action[$ck] );
402 402
 				}
403 403
 			}
404 404
 		}//end if
@@ -422,10 +422,10 @@  discard block
 block discarded – undo
422 422
 		}
423 423
 
424 424
 		// phpcs:ignore WordPress.Security.NonceVerification.Missing
425
-		if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) {
425
+		if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) {
426 426
 			// Sanitizing removes scripts and <email> type of values.
427 427
 			// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
428
-			$settings = wp_unslash( $_POST[ $this->option_name ] );
428
+			$settings = wp_unslash( $_POST[$this->option_name] );
429 429
 		} else {
430 430
 			return;
431 431
 		}
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 		foreach ( $settings as $number => $new_instance ) {
436 436
 			$this->_set( $number );
437 437
 
438
-			$old_instance = $all_instances[ $number ] ?? array();
438
+			$old_instance = $all_instances[$number] ?? array();
439 439
 
440 440
 			if ( ! isset( $new_instance['post_status'] ) ) {
441 441
 				$new_instance['post_status'] = 'draft';
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 			$instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $instance['post_content'], $instance, $new_instance, $old_instance, $this );
475 475
 
476 476
 			if ( false !== $instance ) {
477
-				$all_instances[ $number ] = $instance;
477
+				$all_instances[$number] = $instance;
478 478
 			}
479 479
 
480 480
 			$action_ids[] = $this->save_settings( $instance );
@@ -563,12 +563,12 @@  discard block
 block discarded – undo
563 563
 			// some plugins/themes are formatting the post_excerpt
564 564
 			$action->post_excerpt = sanitize_title( $action->post_excerpt );
565 565
 
566
-			if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) {
566
+			if ( ! isset( $action_controls[$action->post_excerpt] ) ) {
567 567
 				continue;
568 568
 			}
569 569
 
570
-			$action                  = $action_controls[ $action->post_excerpt ]->prepare_action( $action );
571
-			$settings[ $action->ID ] = $action;
570
+			$action                  = $action_controls[$action->post_excerpt]->prepare_action( $action );
571
+			$settings[$action->ID] = $action;
572 572
 
573 573
 			if ( count( $settings ) >= $limit ) {
574 574
 				break;
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 	 * @return int The filtered limit value.
595 595
 	 */
596 596
 	public static function get_action_limit( $form_id, $limit = 99 ) {
597
-		$type  = 'all';
597
+		$type = 'all';
598 598
 		return (int) apply_filters( 'frm_form_action_limit', (int) $limit, compact( 'type', 'form_id' ) );
599 599
 	}
600 600
 
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 			'limit'       => 99,
618 618
 			'post_status' => $default_status,
619 619
 		);
620
-		$args     = wp_parse_args( $args, $defaults );
620
+		$args = wp_parse_args( $args, $defaults );
621 621
 	}
622 622
 
623 623
 	/**
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 
688 688
 			$action = $this->prepare_action( $action );
689 689
 
690
-			$settings[ $action->ID ] = $action;
690
+			$settings[$action->ID] = $action;
691 691
 		}
692 692
 
693 693
 		if ( 1 === $limit ) {
@@ -730,10 +730,10 @@  discard block
 block discarded – undo
730 730
 
731 731
 		foreach ( $default_values as $k => $vals ) {
732 732
 			if ( is_array( $vals ) && ! empty( $vals ) ) {
733
-				if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) {
733
+				if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) {
734 734
 					continue;
735 735
 				}
736
-				$action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals );
736
+				$action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals );
737 737
 			}
738 738
 		}
739 739
 
@@ -821,9 +821,9 @@  discard block
 block discarded – undo
821 821
 
822 822
 		// fill with existing options
823 823
 		foreach ( $action->post_content as $name => $val ) {
824
-			if ( isset( $form->options[ $name ] ) ) {
825
-				$action->post_content[ $name ] = $form->options[ $name ];
826
-				unset( $form->options[ $name ] );
824
+			if ( isset( $form->options[$name] ) ) {
825
+				$action->post_content[$name] = $form->options[$name];
826
+				unset( $form->options[$name] );
827 827
 			}
828 828
 		}
829 829
 
@@ -883,8 +883,8 @@  discard block
 block discarded – undo
883 883
 	private static function get_value_from_entry( $entry, $field_id ) {
884 884
 		$observed_value = '';
885 885
 
886
-		if ( isset( $entry->metas[ $field_id ] ) ) {
887
-			$observed_value = $entry->metas[ $field_id ];
886
+		if ( isset( $entry->metas[$field_id] ) ) {
887
+			$observed_value = $entry->metas[$field_id];
888 888
 		} elseif ( $entry->post_id && FrmAppHelper::pro_is_installed() ) {
889 889
 			$field          = FrmField::getOne( $field_id );
890 890
 			$observed_value = FrmProEntryMetaHelper::get_post_or_meta_value(
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
 		$form_fields = FrmField::get_all_for_form( $form_id, '', 'include' );
959 959
 		return array_filter(
960 960
 			$form_fields,
961
-			function ( $form_field ) {
961
+			function( $form_field ) {
962 962
 				return ! FrmField::is_no_save_field( $form_field->type );
963 963
 			}
964 964
 		);
Please login to merge, or discard this patch.
classes/models/FrmFieldFormHtml.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 	 * @param array  $atts
45 45
 	 */
46 46
 	private function _set( $param, $atts ) {
47
-		if ( isset( $atts[ $param ] ) ) {
48
-			$this->{$param} = $atts[ $param ];
47
+		if ( isset( $atts[$param] ) ) {
48
+			$this->{$param} = $atts[$param];
49 49
 		}
50 50
 	}
51 51
 
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 
90 90
 		$exclude = array( 'field_obj', 'html' );
91 91
 		foreach ( $exclude as $ex ) {
92
-			if ( isset( $atts[ $ex ] ) ) {
93
-				unset( $this->pass_args[ $ex ] );
92
+			if ( isset( $atts[$ex] ) ) {
93
+				unset( $this->pass_args[$ex] );
94 94
 			}
95 95
 		}
96 96
 	}
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 	 * @param array $set
103 103
 	 */
104 104
 	private function set_from_field( $atts, $set ) {
105
-		if ( isset( $atts[ $set['param'] ] ) ) {
106
-			$this->{$set['param']} = $atts[ $set['param'] ];
105
+		if ( isset( $atts[$set['param']] ) ) {
106
+			$this->{$set['param']} = $atts[$set['param']];
107 107
 		} else {
108 108
 			$this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] );
109 109
 		}
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	 */
231 231
 	private function replace_error_shortcode() {
232 232
 		$this->maybe_add_error_id();
233
-		$error = $this->pass_args['errors'][ 'field' . $this->field_id ] ?? false;
233
+		$error = $this->pass_args['errors']['field' . $this->field_id] ?? false;
234 234
 
235 235
 		if ( ! empty( $error ) && false === strpos( $this->html, 'role="alert"' ) && FrmAppHelper::should_include_alert_role_on_field_errors() ) {
236 236
 			$error_body = self::get_error_body( $this->html );
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 * @since 3.06.02
272 272
 	 */
273 273
 	private function maybe_add_error_id() {
274
-		if ( ! isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) {
274
+		if ( ! isset( $this->pass_args['errors']['field' . $this->field_id] ) ) {
275 275
 			return;
276 276
 		}
277 277
 
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 		preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER );
352 352
 
353 353
 		foreach ( $shortcodes[0] as $short_key => $tag ) {
354
-			$shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] );
354
+			$shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] );
355 355
 			$tag            = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key );
356 356
 
357 357
 			$replace_with = '';
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 				$replace_with = $this->replace_input_shortcode( $shortcode_atts );
363 363
 			}
364 364
 
365
-			$this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html );
365
+			$this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html );
366 366
 		}
367 367
 	}
368 368
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 	 */
385 385
 	private function prepare_input_shortcode_atts( $shortcode_atts ) {
386 386
 		if ( isset( $shortcode_atts['opt'] ) ) {
387
-			--$shortcode_atts['opt'];
387
+			-- $shortcode_atts['opt'];
388 388
 		}
389 389
 
390 390
 		$field_class = $shortcode_atts['class'] ?? '';
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	 */
449 449
 	private function get_field_div_classes() {
450 450
 		// Add error class
451
-		$classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : '';
451
+		$classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : '';
452 452
 
453 453
 		// Add label position class
454 454
 		$settings = $this->field_obj->display_field_settings();
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 		}
528 528
 
529 529
 		// Add 'aria-invalid' attribute to the group if there are errors.
530
-		if ( isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) {
530
+		if ( isset( $this->pass_args['errors']['field' . $this->field_id] ) ) {
531 531
 			$attributes['aria-invalid'] = 'true';
532 532
 		}
533 533
 
Please login to merge, or discard this patch.
classes/helpers/FrmTipsHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 			'page'  => '',
46 46
 			'class' => 'frm-mt-0',
47 47
 		);
48
-		$tip      = array_merge( $defaults, $tip );
48
+		$tip = array_merge( $defaults, $tip );
49 49
 
50 50
 		if ( isset( $tip['link'] ) && ! isset( $tip['link']['medium'] ) ) {
51 51
 			$tip['link']['medium'] = 'tip';
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 	public static function get_random_tip( $tips ) {
394 394
 		$random = random_int( 0, count( $tips ) - 1 );
395 395
 
396
-		return $tips[ $random ];
396
+		return $tips[$random];
397 397
 	}
398 398
 
399 399
 	/**
Please login to merge, or discard this patch.
classes/helpers/FrmHtmlHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 		wp_enqueue_script( 'formidable_settings' );
29 29
 		return FrmAppHelper::clip(
30 30
 			// @phpstan-ignore-next-line
31
-			function () use ( $id, $name, $args ) {
31
+			function() use ( $id, $name, $args ) {
32 32
 				require FrmAppHelper::plugin_path() . '/classes/views/shared/toggle.php';
33 33
 			},
34 34
 			$args['echo'] ?? false
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			}
98 98
 		}
99 99
 
100
-		$input_number_attrs          = array_merge(
100
+		$input_number_attrs = array_merge(
101 101
 			$args['input_number_attrs'],
102 102
 			array(
103 103
 				'type'  => ! empty( $selected_unit ) ? 'number' : 'text',
Please login to merge, or discard this patch.
classes/helpers/FrmOnSubmitHelper.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -219,17 +219,17 @@  discard block
 block discarded – undo
219 219
 	public static function populate_on_submit_data( &$form_options, $action = null, $event = 'create' ) {
220 220
 		$opt = 'update' === $event ? 'edit_' : 'success_';
221 221
 		if ( ! $action || ! is_object( $action ) ) {
222
-			$form_options[ $opt . 'action' ] = self::get_default_action_type();
223
-			$form_options[ $opt . 'msg' ]    = self::get_default_msg();
222
+			$form_options[$opt . 'action'] = self::get_default_action_type();
223
+			$form_options[$opt . 'msg']    = self::get_default_msg();
224 224
 
225 225
 			return;
226 226
 		}
227 227
 
228
-		$form_options[ $opt . 'action' ] = $action->post_content['success_action'] ?? 'message';
228
+		$form_options[$opt . 'action'] = $action->post_content['success_action'] ?? 'message';
229 229
 
230
-		switch ( $form_options[ $opt . 'action' ] ) {
230
+		switch ( $form_options[$opt . 'action'] ) {
231 231
 			case 'redirect':
232
-				$form_options[ $opt . 'url' ]        = $action->post_content['success_url'] ?? '';
232
+				$form_options[$opt . 'url']        = $action->post_content['success_url'] ?? '';
233 233
 				$form_options['open_in_new_tab']     = ! empty( $action->post_content['open_in_new_tab'] );
234 234
 				$form_options['redirect_delay']      = ! empty( $action->post_content['redirect_delay'] );
235 235
 				$form_options['redirect_delay_time'] = $action->post_content['redirect_delay_time'];
@@ -237,11 +237,11 @@  discard block
 block discarded – undo
237 237
 				break;
238 238
 
239 239
 			case 'page':
240
-				$form_options[ $opt . 'page_id' ] = $action->post_content['success_page_id'] ?? '';
240
+				$form_options[$opt . 'page_id'] = $action->post_content['success_page_id'] ?? '';
241 241
 				break;
242 242
 
243 243
 			default:
244
-				$form_options[ $opt . 'msg' ] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : self::get_default_msg();
244
+				$form_options[$opt . 'msg'] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : self::get_default_msg();
245 245
 				$form_options['show_form']    = ! empty( $action->post_content['show_form'] );
246 246
 		}
247 247
 	}
@@ -330,20 +330,20 @@  discard block
 block discarded – undo
330 330
 	private static function get_on_submit_action_data_from_form_options( $form_options, $event = 'create' ) {
331 331
 		$opt  = 'update' === $event ? 'edit_' : 'success_';
332 332
 		$data = array(
333
-			'success_action' => $form_options[ $opt . 'action' ] ?? self::get_default_action_type(),
333
+			'success_action' => $form_options[$opt . 'action'] ?? self::get_default_action_type(),
334 334
 		);
335 335
 
336 336
 		switch ( $data['success_action'] ) {
337 337
 			case 'redirect':
338
-				$data['success_url'] = $form_options[ $opt . 'url' ] ?? '';
338
+				$data['success_url'] = $form_options[$opt . 'url'] ?? '';
339 339
 				break;
340 340
 
341 341
 			case 'page':
342
-				$data['success_page_id'] = $form_options[ $opt . 'page_id' ] ?? '';
342
+				$data['success_page_id'] = $form_options[$opt . 'page_id'] ?? '';
343 343
 				break;
344 344
 
345 345
 			default:
346
-				$data['success_msg'] = $form_options[ $opt . 'msg' ] ?? self::get_default_msg();
346
+				$data['success_msg'] = $form_options[$opt . 'msg'] ?? self::get_default_msg();
347 347
 				$data['show_form']   = ! empty( $form_options['show_form'] );
348 348
 		}
349 349
 
Please login to merge, or discard this patch.
classes/helpers/FrmFormsHelper.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 			'class'        => '',
38 38
 			'inc_children' => 'exclude',
39 39
 		);
40
-		$args     = wp_parse_args( $args, $defaults );
40
+		$args = wp_parse_args( $args, $defaults );
41 41
 
42 42
 		if ( ! $args['field_id'] ) {
43 43
 			$args['field_id'] = $field_name;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public static function add_html_attr( $class, $param, &$add_html ) {
80 80
 		if ( ! empty( $class ) ) {
81
-			$add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"';
81
+			$add_html[$param] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"';
82 82
 		}
83 83
 	}
84 84
 
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
 			'description' => '',
323 323
 		);
324 324
 		foreach ( $defaults as $var => $default ) {
325
-			if ( ! isset( $values[ $var ] ) ) {
326
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
325
+			if ( ! isset( $values[$var] ) ) {
326
+				$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
327 327
 			}
328 328
 		}
329 329
 
@@ -338,8 +338,8 @@  discard block
 block discarded – undo
338 338
 			'parent_form_id' => 0,
339 339
 		);
340 340
 		foreach ( $defaults as $var => $default ) {
341
-			if ( ! isset( $values[ $var ] ) ) {
342
-				$values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
341
+			if ( ! isset( $values[$var] ) ) {
342
+				$values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
343 343
 			}
344 344
 		}
345 345
 		unset( $defaults );
@@ -376,16 +376,16 @@  discard block
 block discarded – undo
376 376
 		$defaults = self::get_default_opts();
377 377
 		foreach ( $defaults as $var => $default ) {
378 378
 			if ( is_array( $default ) ) {
379
-				if ( ! isset( $values[ $var ] ) ) {
380
-					$values[ $var ] = $record && isset( $record->options[ $var ] ) ? $record->options[ $var ] : array();
379
+				if ( ! isset( $values[$var] ) ) {
380
+					$values[$var] = $record && isset( $record->options[$var] ) ? $record->options[$var] : array();
381 381
 				}
382 382
 
383 383
 				foreach ( $default as $k => $v ) {
384
-					$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 );
384
+					$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 );
385 385
 
386 386
 					if ( is_array( $v ) ) {
387 387
 						foreach ( $v as $k1 => $v1 ) {
388
-							$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 );
388
+							$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 );
389 389
 							unset( $k1, $v1 );
390 390
 						}
391 391
 					}
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 					unset( $k, $v );
394 394
 				}
395 395
 			} else {
396
-				$values[ $var ] = $post_values && isset( $post_values['options'][ $var ] ) ? $post_values['options'][ $var ] : ( $record && isset( $record->options[ $var ] ) ? $record->options[ $var ] : $default );
396
+				$values[$var] = $post_values && isset( $post_values['options'][$var] ) ? $post_values['options'][$var] : ( $record && isset( $record->options[$var] ) ? $record->options[$var] : $default );
397 397
 			}
398 398
 
399 399
 			unset( $var, $default );
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 	public static function fill_form_options( &$options, $values ) {
439 439
 		$defaults = self::get_default_opts();
440 440
 		foreach ( $defaults as $var => $default ) {
441
-			$options[ $var ] = $values['options'][ $var ] ?? $default;
441
+			$options[$var] = $values['options'][$var] ?? $default;
442 442
 			unset( $var, $default );
443 443
 		}
444 444
 	}
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 	public static function insert_opt_html( $args ) {
616 616
 		$class  = $args['class'] ?? '';
617 617
 		$fields = self::get_field_type_data_for_insert_opt_html();
618
-		$field  = $fields[ $args['type'] ] ?? array();
618
+		$field  = $fields[$args['type']] ?? array();
619 619
 
620 620
 		self::prepare_field_type( $field );
621 621
 
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 		$last_field         = false;
748 748
 		foreach ( $fields as $field ) {
749 749
 			if ( $prev_order === $field->field_order ) {
750
-				++$add_order;
750
+				++ $add_order;
751 751
 			}
752 752
 
753 753
 			if ( $add_order ) {
@@ -1221,8 +1221,8 @@  discard block
 block discarded – undo
1221 1221
 				$link .= ' onclick="return confirm(\'' . esc_attr( $link_details['confirm'] ) . '\')"';
1222 1222
 			}
1223 1223
 
1224
-			$label = ( $link_details[ $length ] ?? $link_details['label'] );
1225
-			if ( $length === 'icon' && isset( $link_details[ $length ] ) ) {
1224
+			$label = ( $link_details[$length] ?? $link_details['label'] );
1225
+			if ( $length === 'icon' && isset( $link_details[$length] ) ) {
1226 1226
 				$label = '<span class="' . $label . '" title="' . esc_attr( $link_details['label'] ) . '" aria-hidden="true"></span>';
1227 1227
 				$link .= ' aria-label="' . esc_attr( $link_details['label'] ) . '"';
1228 1228
 			}
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
 			$status = 'publish';
1370 1370
 		}
1371 1371
 
1372
-		$name = $nice_names[ $status ];
1372
+		$name = $nice_names[$status];
1373 1373
 
1374 1374
 		return $name;
1375 1375
 	}
@@ -1433,7 +1433,7 @@  discard block
 block discarded – undo
1433 1433
 		$icon = $icons[''];
1434 1434
 		if ( count( $categories ) === 1 ) {
1435 1435
 			$category = reset( $categories );
1436
-			$icon     = $icons[ $category ] ?? $icon;
1436
+			$icon     = $icons[$category] ?? $icon;
1437 1437
 		} elseif ( ! empty( $categories ) ) {
1438 1438
 			$icons = array_intersect_key( $icons, array_flip( $categories ) );
1439 1439
 			$icon  = reset( $icons );
@@ -1555,7 +1555,7 @@  discard block
 block discarded – undo
1555 1555
 
1556 1556
 		foreach ( $item['categories'] as $k => $category ) {
1557 1557
 			if ( in_array( $category, $plans, true ) ) {
1558
-				unset( $item['categories'][ $k ] );
1558
+				unset( $item['categories'][$k] );
1559 1559
 
1560 1560
 				$category = self::convert_legacy_package_names( $category );
1561 1561
 
@@ -1594,7 +1594,7 @@  discard block
 block discarded – undo
1594 1594
 			'include_all' => true,
1595 1595
 			'case_lower'  => false,
1596 1596
 		);
1597
-		$args     = wp_parse_args( $args, $defaults );
1597
+		$args = wp_parse_args( $args, $defaults );
1598 1598
 
1599 1599
 		$license_types = array( 'Basic', 'Plus', 'Business', 'Elite' );
1600 1600
 
@@ -1797,9 +1797,9 @@  discard block
 block discarded – undo
1797 1797
 		}
1798 1798
 
1799 1799
 		foreach ( $shortcodes[0] as $key => $shortcode ) {
1800
-			$options = trim( $shortcodes[3][ $key ] );
1800
+			$options = trim( $shortcodes[3][$key] );
1801 1801
 
1802
-			if ( in_array( $shortcodes[1][ $key ], array( 'if ' ), true ) ) {
1802
+			if ( in_array( $shortcodes[1][$key], array( 'if ' ), true ) ) {
1803 1803
 				// Skip if shortcodes.
1804 1804
 				continue;
1805 1805
 			}
@@ -1809,7 +1809,7 @@  discard block
 block discarded – undo
1809 1809
 				continue;
1810 1810
 			}
1811 1811
 
1812
-			$new_shortcode = '[' . $shortcodes[2][ $key ];
1812
+			$new_shortcode = '[' . $shortcodes[2][$key];
1813 1813
 			if ( $options ) {
1814 1814
 				$new_shortcode .= ' ' . $options;
1815 1815
 			}
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
 
163 163
 			if ( $read || $dismissed || ! $this->within_valid_timeframe( $message ) ) {
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->within_valid_timeframe( $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 );
@@ -257,14 +257,14 @@  discard block
 block discarded – undo
257 257
 	 * @return void
258 258
 	 */
259 259
 	public function mark_read( $key ) {
260
-		if ( ! $key || ! isset( self::$messages[ $key ] ) ) {
260
+		if ( ! $key || ! isset( self::$messages[$key] ) ) {
261 261
 			return;
262 262
 		}
263 263
 
264
-		if ( ! isset( self::$messages[ $key ]['read'] ) ) {
265
-			self::$messages[ $key ]['read'] = array();
264
+		if ( ! isset( self::$messages[$key]['read'] ) ) {
265
+			self::$messages[$key]['read'] = array();
266 266
 		}
267
-		self::$messages[ $key ]['read'][ get_current_user_id() ] = time();
267
+		self::$messages[$key]['read'][get_current_user_id()] = time();
268 268
 
269 269
 		$this->update_list();
270 270
 	}
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
 	 * @return void
277 277
 	 */
278 278
 	public function mark_unread( $key ) {
279
-		$is_read = isset( self::$messages[ $key ] ) && isset( self::$messages[ $key ]['read'] ) && isset( self::$messages[ $key ]['read'][ get_current_user_id() ] );
279
+		$is_read = isset( self::$messages[$key] ) && isset( self::$messages[$key]['read'] ) && isset( self::$messages[$key]['read'][get_current_user_id()] );
280 280
 		if ( $is_read ) {
281
-			unset( self::$messages[ $key ]['read'][ get_current_user_id() ] );
281
+			unset( self::$messages[$key]['read'][get_current_user_id()] );
282 282
 			$this->update_list();
283 283
 		}
284 284
 	}
@@ -294,14 +294,14 @@  discard block
 block discarded – undo
294 294
 			return;
295 295
 		}
296 296
 
297
-		if ( ! isset( self::$messages[ $key ] ) ) {
297
+		if ( ! isset( self::$messages[$key] ) ) {
298 298
 			return;
299 299
 		}
300 300
 
301
-		if ( ! isset( self::$messages[ $key ]['dismissed'] ) ) {
302
-			self::$messages[ $key ]['dismissed'] = array();
301
+		if ( ! isset( self::$messages[$key]['dismissed'] ) ) {
302
+			self::$messages[$key]['dismissed'] = array();
303 303
 		}
304
-		self::$messages[ $key ]['dismissed'][ get_current_user_id() ] = time();
304
+		self::$messages[$key]['dismissed'][get_current_user_id()] = time();
305 305
 
306 306
 		$this->update_list();
307 307
 	}
@@ -315,11 +315,11 @@  discard block
 block discarded – undo
315 315
 		$user_id = get_current_user_id();
316 316
 		foreach ( self::$messages as $key => $message ) {
317 317
 			if ( ! isset( $message['dismissed'] ) ) {
318
-				self::$messages[ $key ]['dismissed'] = array();
318
+				self::$messages[$key]['dismissed'] = array();
319 319
 			}
320 320
 
321
-			if ( ! isset( $message['dismissed'][ $user_id ] ) ) {
322
-				self::$messages[ $key ]['dismissed'][ $user_id ] = time();
321
+			if ( ! isset( $message['dismissed'][$user_id] ) ) {
322
+				self::$messages[$key]['dismissed'][$user_id] = time();
323 323
 			}
324 324
 		}
325 325
 		$this->update_list();
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
 		$messages = $this->get_messages( 'filter' );
330 330
 		$user_id  = get_current_user_id();
331 331
 		foreach ( $messages as $t => $message ) {
332
-			if ( isset( $message['read'] ) && isset( $message['read'][ $user_id ] ) ) {
333
-				unset( $messages[ $t ] );
332
+			if ( isset( $message['read'] ) && isset( $message['read'][$user_id] ) ) {
333
+				unset( $messages[$t] );
334 334
 			}
335 335
 		}
336 336
 		return $messages;
@@ -369,8 +369,8 @@  discard block
 block discarded – undo
369 369
 	 * @return void
370 370
 	 */
371 371
 	public function remove( $key ) {
372
-		if ( isset( self::$messages[ $key ] ) ) {
373
-			unset( self::$messages[ $key ] );
372
+		if ( isset( self::$messages[$key] ) ) {
373
+			unset( self::$messages[$key] );
374 374
 			$this->update_list();
375 375
 		}
376 376
 	}
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 			 * @param array $matches The regex results for a single match.
417 417
 			 * @return string
418 418
 			 */
419
-			function ( $matches ) {
419
+			function( $matches ) {
420 420
 				$url   = $matches[2];
421 421
 				$parts = parse_url( $url );
422 422
 
@@ -479,8 +479,8 @@  discard block
 block discarded – undo
479 479
 		$inbox = new self();
480 480
 		return array_filter(
481 481
 			$inbox->get_messages( 'filter' ),
482
-			function ( $message ) use ( $key ) {
483
-				return ! empty( $message[ $key ] );
482
+			function( $message ) use ( $key ) {
483
+				return ! empty( $message[$key] );
484 484
 			}
485 485
 		);
486 486
 	}
@@ -526,8 +526,8 @@  discard block
 block discarded – undo
526 526
 
527 527
 		return array_reduce(
528 528
 			$keys_to_return,
529
-			function ( $total, $key ) use ( $message ) {
530
-				$total[ $key ] = $message[ $key ] ?? '';
529
+			function( $total, $key ) use ( $message ) {
530
+				$total[$key] = $message[$key] ?? '';
531 531
 				return $total;
532 532
 			},
533 533
 			array()
Please login to merge, or discard this patch.