Completed
Pull Request — master (#2671)
by
unknown
40s
created
classes/controllers/FrmEntriesController.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -170,20 +170,20 @@  discard block
 block discarded – undo
170 170
 		global $frm_vars;
171 171
 		$form_id = FrmForm::get_current_form_id();
172 172
 
173
-		$columns[ $form_id . '_id' ]       = 'ID';
174
-		$columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' );
173
+		$columns[$form_id . '_id']       = 'ID';
174
+		$columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' );
175 175
 
176 176
 		if ( $form_id ) {
177 177
 			self::get_columns_for_form( $form_id, $columns );
178 178
 		} else {
179
-			$columns[ $form_id . '_form_id' ] = esc_html__( 'Form', 'formidable' );
180
-			$columns[ $form_id . '_name' ]    = esc_html__( 'Entry Name', 'formidable' );
181
-			$columns[ $form_id . '_user_id' ] = esc_html__( 'Created By', 'formidable' );
179
+			$columns[$form_id . '_form_id'] = esc_html__( 'Form', 'formidable' );
180
+			$columns[$form_id . '_name']    = esc_html__( 'Entry Name', 'formidable' );
181
+			$columns[$form_id . '_user_id'] = esc_html__( 'Created By', 'formidable' );
182 182
 		}
183 183
 
184
-		$columns[ $form_id . '_is_draft' ]   = esc_html__( 'Entry Status', 'formidable' );
185
-		$columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' );
186
-		$columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' );
184
+		$columns[$form_id . '_is_draft']   = esc_html__( 'Entry Status', 'formidable' );
185
+		$columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' );
186
+		$columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' );
187 187
 		self::maybe_add_ip_col( $form_id, $columns );
188 188
 
189 189
 		$frm_vars['cols'] = $columns;
@@ -256,10 +256,10 @@  discard block
 block discarded – undo
256 256
 
257 257
 		foreach ( $sub_form_cols as $k => $sub_form_col ) {
258 258
 			if ( FrmField::is_no_save_field( $sub_form_col->type ) ) {
259
-				unset( $sub_form_cols[ $k ] );
259
+				unset( $sub_form_cols[$k] );
260 260
 				continue;
261 261
 			}
262
-			$columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
262
+			$columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $field->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 );
263 263
 			unset( $sub_form_col );
264 264
 		}
265 265
 	}
@@ -285,10 +285,10 @@  discard block
 block discarded – undo
285 285
 		$include_column_for_sep_val = $has_separate_value && ! $is_post_status;
286 286
 
287 287
 		if ( $include_column_for_sep_val ) {
288
-			$columns[ $form_id . '_frmsep_' . $col_id ] = self::maybe_format_field_name_for_column_title( $field, $include_column_for_sep_val );
288
+			$columns[$form_id . '_frmsep_' . $col_id] = self::maybe_format_field_name_for_column_title( $field, $include_column_for_sep_val );
289 289
 		}
290 290
 
291
-		$columns[ $form_id . '_' . $col_id ] = self::maybe_format_field_name_for_column_title( $field, $include_column_for_sep_val, false );
291
+		$columns[$form_id . '_' . $col_id] = self::maybe_format_field_name_for_column_title( $field, $include_column_for_sep_val, false );
292 292
 	}
293 293
 
294 294
 	/**
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	 */
323 323
 	private static function maybe_add_ip_col( $form_id, &$columns ) {
324 324
 		if ( FrmAppHelper::ips_saved() ) {
325
-			$columns[ $form_id . '_ip' ] = 'IP';
325
+			$columns[$form_id . '_ip'] = 'IP';
326 326
 		}
327 327
 	}
328 328
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 		foreach ( $meta_value as $mk => $mv ) {
381 381
 			// Remove blank values.
382 382
 			if ( empty( $mv ) ) {
383
-				unset( $meta_value[ $mk ] );
383
+				unset( $meta_value[$mk] );
384 384
 			}
385 385
 		}
386 386
 
@@ -476,14 +476,14 @@  discard block
 block discarded – undo
476 476
 		);
477 477
 
478 478
 		if ( ! $form_id ) {
479
-			$columns[ $form_id . '_user_id' ] = 'user_id';
480
-			$columns[ $form_id . '_name' ]    = 'name';
481
-			$columns[ $form_id . '_form_id' ] = 'form_id';
479
+			$columns[$form_id . '_user_id'] = 'user_id';
480
+			$columns[$form_id . '_name']    = 'name';
481
+			$columns[$form_id . '_form_id'] = 'form_id';
482 482
 		}
483 483
 
484 484
 		foreach ( $fields as $field ) {
485 485
 			if ( self::field_supports_sorting( $field ) ) {
486
-				$columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id;
486
+				$columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id;
487 487
 			}
488 488
 		}
489 489
 
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 			$atts['form_id'] . '_item_key' => '',
581 581
 			$atts['form_id'] . '_id'       => '',
582 582
 		);
583
-		$cols         = $remove_first + array_reverse( $frm_vars['cols'], true );
583
+		$cols = $remove_first + array_reverse( $frm_vars['cols'], true );
584 584
 
585 585
 		$i = $atts['i'];
586 586
 
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 
592 592
 			if ( empty( $result ) || ! in_array( $col_key, $result, true ) ) {
593 593
 				$result[] = $col_key;
594
-				--$i;
594
+				-- $i;
595 595
 			}
596 596
 
597 597
 			unset( $col_key, $col );
@@ -770,9 +770,9 @@  discard block
 block discarded – undo
770 770
 		if ( ! isset( $frm_vars['form_params'] ) ) {
771 771
 			$frm_vars['form_params'] = array();
772 772
 		}
773
-		$frm_vars['form_params'][ $form->id ] = $params;
773
+		$frm_vars['form_params'][$form->id] = $params;
774 774
 
775
-		if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) {
775
+		if ( isset( $frm_vars['created_entries'][$form_id] ) ) {
776 776
 			return;
777 777
 		}
778 778
 
@@ -788,17 +788,17 @@  discard block
 block discarded – undo
788 788
 		 */
789 789
 		$errors = apply_filters( 'frm_entries_before_create', $errors, $form );
790 790
 
791
-		$frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors );
791
+		$frm_vars['created_entries'][$form_id] = array( 'errors' => $errors );
792 792
 
793 793
 		if ( empty( $errors ) ) {
794 794
 			$_POST['frm_skip_cookie'] = 1;
795 795
 			$do_success               = false;
796 796
 
797 797
 			if ( $params['action'] === 'create' ) {
798
-				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) {
799
-					$frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
798
+				if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) {
799
+					$frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
800 800
 
801
-					$params['id'] = $frm_vars['created_entries'][ $form_id ]['entry_id'];
801
+					$params['id'] = $frm_vars['created_entries'][$form_id]['entry_id'];
802 802
 					$do_success   = true;
803 803
 				}
804 804
 			}
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 		$atts = shortcode_atts( $defaults, $atts );
927 927
 
928 928
 		if ( $atts['default_email'] ) {
929
-			$shortcode_atts  = array(
929
+			$shortcode_atts = array(
930 930
 				'format'     => $atts['format'],
931 931
 				'plain_text' => $atts['plain_text'],
932 932
 			);
Please login to merge, or discard this patch.
classes/models/FrmFormAction.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 		$groups = FrmFormActionsController::form_action_groups();
228 228
 		$group  = 'misc';
229 229
 
230
-		if ( isset( $action_options['group'] ) && isset( $groups[ $action_options['group'] ] ) ) {
230
+		if ( isset( $action_options['group'] ) && isset( $groups[$action_options['group']] ) ) {
231 231
 			$group = $action_options['group'];
232
-		} elseif ( isset( $groups[ $this->id_base ] ) ) {
232
+		} elseif ( isset( $groups[$this->id_base] ) ) {
233 233
 			$group = $this->id_base;
234 234
 		} else {
235 235
 			foreach ( $groups as $name => $check_group ) {
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 			}
241 241
 		}
242 242
 
243
-		$groups[ $group ]['id'] = $group;
244
-		return $groups[ $group ];
243
+		$groups[$group]['id'] = $group;
244
+		return $groups[$group];
245 245
 	}
246 246
 
247 247
 	/**
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	 * @return int $post_id
367 367
 	 */
368 368
 	public function maybe_create_action( $action, $forms ) {
369
-		if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[ $action['menu_order'] ] ) && $forms[ $action['menu_order'] ] === 'updated' ) {
369
+		if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[$action['menu_order']] ) && $forms[$action['menu_order']] === 'updated' ) {
370 370
 			// Update action only
371 371
 			$action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] );
372 372
 			return $this->save_settings( $action );
@@ -389,18 +389,18 @@  discard block
 block discarded – undo
389 389
 		$switch             = $this->get_global_switch_fields();
390 390
 
391 391
 		foreach ( (array) $action->post_content as $key => $val ) {
392
-			if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) {
393
-				$action->post_content[ $key ] = $frm_duplicate_ids[ $val ];
392
+			if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) {
393
+				$action->post_content[$key] = $frm_duplicate_ids[$val];
394 394
 			} elseif ( ! is_array( $val ) ) {
395
-				$action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val );
396
-			} elseif ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) {
395
+				$action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val );
396
+			} elseif ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) {
397 397
 				// loop through each value if empty
398
-				if ( empty( $switch[ $key ] ) ) {
399
-					$switch[ $key ] = array_keys( $val );
398
+				if ( empty( $switch[$key] ) ) {
399
+					$switch[$key] = array_keys( $val );
400 400
 				}
401 401
 
402
-				foreach ( $switch[ $key ] as $subkey ) {
403
-					$action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val );
402
+				foreach ( $switch[$key] as $subkey ) {
403
+					$action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val );
404 404
 				}
405 405
 			}
406 406
 
@@ -425,20 +425,20 @@  discard block
 block discarded – undo
425 425
 			foreach ( $subkey as $subkey2 ) {
426 426
 				foreach ( (array) $val as $ck => $cv ) {
427 427
 					if ( is_array( $cv ) ) {
428
-						$action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv );
429
-					} elseif ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) {
430
-						$action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ];
428
+						$action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv );
429
+					} elseif ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) {
430
+						$action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]];
431 431
 					}
432 432
 				}
433 433
 			}
434 434
 		} else {
435 435
 			foreach ( (array) $val as $ck => $cv ) {
436 436
 				if ( is_array( $cv ) ) {
437
-					$action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv );
438
-				} elseif ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) {
439
-					$action[ $ck ] = $frm_duplicate_ids[ $cv ];
437
+					$action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv );
438
+				} elseif ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) {
439
+					$action[$ck] = $frm_duplicate_ids[$cv];
440 440
 				} elseif ( $ck == $subkey ) {
441
-					$action[ $ck ] = $this->maybe_switch_field_ids( $action[ $ck ] );
441
+					$action[$ck] = $this->maybe_switch_field_ids( $action[$ck] );
442 442
 				}
443 443
 			}
444 444
 		}//end if
@@ -466,10 +466,10 @@  discard block
 block discarded – undo
466 466
 		}
467 467
 
468 468
 		// phpcs:ignore WordPress.Security.NonceVerification.Missing
469
-		if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) {
469
+		if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) {
470 470
 			// Sanitizing removes scripts and <email> type of values.
471 471
 			// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
472
-			$settings = wp_unslash( $_POST[ $this->option_name ] );
472
+			$settings = wp_unslash( $_POST[$this->option_name] );
473 473
 		} else {
474 474
 			return null;
475 475
 		}
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 		foreach ( $settings as $number => $new_instance ) {
480 480
 			$this->_set( $number );
481 481
 
482
-			$old_instance = $all_instances[ $number ] ?? array();
482
+			$old_instance = $all_instances[$number] ?? array();
483 483
 
484 484
 			if ( ! isset( $new_instance['post_status'] ) ) {
485 485
 				$new_instance['post_status'] = 'draft';
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 			$instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $instance['post_content'], $instance, $new_instance, $old_instance, $this );
519 519
 
520 520
 			if ( false !== $instance ) {
521
-				$all_instances[ $number ] = $instance;
521
+				$all_instances[$number] = $instance;
522 522
 			}
523 523
 
524 524
 			$action_ids[] = $this->save_settings( $instance );
@@ -629,12 +629,12 @@  discard block
 block discarded – undo
629 629
 			// some plugins/themes are formatting the post_excerpt
630 630
 			$action->post_excerpt = sanitize_title( $action->post_excerpt );
631 631
 
632
-			if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) {
632
+			if ( ! isset( $action_controls[$action->post_excerpt] ) ) {
633 633
 				continue;
634 634
 			}
635 635
 
636
-			$action                  = $action_controls[ $action->post_excerpt ]->prepare_action( $action );
637
-			$settings[ $action->ID ] = $action;
636
+			$action                  = $action_controls[$action->post_excerpt]->prepare_action( $action );
637
+			$settings[$action->ID] = $action;
638 638
 
639 639
 			if ( count( $settings ) >= $limit ) {
640 640
 				break;
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 	 * @return int The filtered limit value.
661 661
 	 */
662 662
 	public static function get_action_limit( $form_id, $limit = 99 ) {
663
-		$type  = 'all';
663
+		$type = 'all';
664 664
 		return (int) apply_filters( 'frm_form_action_limit', (int) $limit, compact( 'type', 'form_id' ) );
665 665
 	}
666 666
 
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 			'limit'       => 99,
685 685
 			'post_status' => $default_status,
686 686
 		);
687
-		$args     = wp_parse_args( $args, $defaults );
687
+		$args = wp_parse_args( $args, $defaults );
688 688
 	}
689 689
 
690 690
 	/**
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 
765 765
 			$action = $this->prepare_action( $action );
766 766
 
767
-			$settings[ $action->ID ] = $action;
767
+			$settings[$action->ID] = $action;
768 768
 		}
769 769
 
770 770
 		if ( 1 === $limit ) {
@@ -812,10 +812,10 @@  discard block
 block discarded – undo
812 812
 
813 813
 		foreach ( $default_values as $k => $vals ) {
814 814
 			if ( is_array( $vals ) && ! empty( $vals ) ) {
815
-				if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) {
815
+				if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) {
816 816
 					continue;
817 817
 				}
818
-				$action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals );
818
+				$action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals );
819 819
 			}
820 820
 		}
821 821
 
@@ -917,9 +917,9 @@  discard block
 block discarded – undo
917 917
 
918 918
 		// fill with existing options
919 919
 		foreach ( $action->post_content as $name => $val ) {
920
-			if ( isset( $form->options[ $name ] ) ) {
921
-				$action->post_content[ $name ] = $form->options[ $name ];
922
-				unset( $form->options[ $name ] );
920
+			if ( isset( $form->options[$name] ) ) {
921
+				$action->post_content[$name] = $form->options[$name];
922
+				unset( $form->options[$name] );
923 923
 			}
924 924
 		}
925 925
 
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
 		$form_fields = FrmField::get_all_for_form( $form_id, '', 'include' );
1028 1028
 		return array_filter(
1029 1029
 			$form_fields,
1030
-			function ( $form_field ) {
1030
+			function( $form_field ) {
1031 1031
 				return ! FrmField::is_no_save_field( $form_field->type );
1032 1032
 			}
1033 1033
 		);
Please login to merge, or discard this patch.
classes/models/FrmEntryValues.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
 	 * @return array
179 179
 	 */
180 180
 	private function prepare_array_property( $index, $atts ) {
181
-		if ( ! empty( $atts[ $index ] ) ) {
182
-			return is_array( $atts[ $index ] ) ? $atts[ $index ] : explode( ',', $atts[ $index ] );
181
+		if ( ! empty( $atts[$index] ) ) {
182
+			return is_array( $atts[$index] ) ? $atts[$index] : explode( ',', $atts[$index] );
183 183
 		}
184 184
 
185 185
 		return array();
@@ -256,11 +256,11 @@  discard block
 block discarded – undo
256 256
 			);
257 257
 		}
258 258
 
259
-		$ip       = array(
259
+		$ip = array(
260 260
 			'label' => __( 'IP Address', 'formidable' ),
261 261
 			'value' => $this->entry->ip,
262 262
 		);
263
-		$browser  = array(
263
+		$browser = array(
264 264
 			'label' => __( 'User-Agent (Browser/OS)', 'formidable' ),
265 265
 			'value' => isset( $entry_description['browser'] ) ? FrmEntriesHelper::get_browser( $entry_description['browser'] ) : '',
266 266
 		);
@@ -349,6 +349,6 @@  discard block
 block discarded – undo
349 349
 	 * @return void
350 350
 	 */
351 351
 	protected function add_field_values( $field ) {
352
-		$this->field_values[ $field->id ] = new FrmFieldValue( $field, $this->entry );
352
+		$this->field_values[$field->id] = new FrmFieldValue( $field, $this->entry );
353 353
 	}
354 354
 }
Please login to merge, or discard this patch.