Completed
Pull Request — master (#2603)
by
unknown
40s
created
classes/models/FrmEntryFormatter.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 
170 170
 		$conditionally_add = array( 'include_fields', 'fields', 'exclude_fields', 'entry' );
171 171
 		foreach ( $conditionally_add as $index ) {
172
-			if ( isset( $atts[ $index ] ) ) {
173
-				$entry_atts[ $index ] = $atts[ $index ];
172
+			if ( isset( $atts[$index] ) ) {
173
+				$entry_atts[$index] = $atts[$index];
174 174
 			}
175 175
 		}
176 176
 
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
 
377 377
 		$unset = array( 'id', 'form_id', 'format' );
378 378
 		foreach ( $unset as $param ) {
379
-			if ( isset( $atts[ $param ] ) ) {
380
-				unset( $atts[ $param ] );
379
+			if ( isset( $atts[$param] ) ) {
380
+				unset( $atts[$param] );
381 381
 			}
382 382
 		}
383 383
 
@@ -553,11 +553,11 @@  discard block
 block discarded – undo
553 553
 
554 554
 			$displayed_value = $this->prepare_display_value_for_array( $field_value->get_displayed_value() );
555 555
 
556
-			$output[ $this->get_key_or_id( $field_value ) ] = $displayed_value;
556
+			$output[$this->get_key_or_id( $field_value )] = $displayed_value;
557 557
 
558 558
 			$has_separate_value = (bool) $field_value->get_field_option( 'separate_value' );
559 559
 			if ( $has_separate_value || $displayed_value !== $field_value->get_saved_value() ) {
560
-				$output[ $this->get_key_or_id( $field_value ) . '-value' ] = $field_value->get_saved_value();
560
+				$output[$this->get_key_or_id( $field_value ) . '-value'] = $field_value->get_saved_value();
561 561
 			}
562 562
 		}
563 563
 	}
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
 		if ( $this->is_plain_text ) {
976 976
 			if ( is_array( $value ) ) {
977 977
 				foreach ( $value as $key => $single_value ) {
978
-					$value[ $key ] = $this->strip_html( $single_value );
978
+					$value[$key] = $this->strip_html( $single_value );
979 979
 				}
980 980
 			} elseif ( $this->is_plain_text && ! is_array( $value ) ) {
981 981
 				if ( strpos( $value, '<img' ) !== false ) {
Please login to merge, or discard this patch.
classes/models/FrmFormMigrator.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	/**
39 39
 	 * @var array
40 40
 	 */
41
-	protected $fields_map          = array();
41
+	protected $fields_map = array();
42 42
 
43 43
 	/**
44 44
 	 * @var mixed
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	/**
49 49
 	 * @var array
50 50
 	 */
51
-	protected $current_section     = array();
51
+	protected $current_section = array();
52 52
 
53 53
 	/**
54 54
 	 * Define required properties.
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 
316 316
 			// This may occasionally skip one level/order e.g. after adding a
317 317
 			// list field, as field_order would already be prepared to be used.
318
-			++$field_order;
318
+			++ $field_order;
319 319
 
320 320
 			if ( ! empty( $new_field['fields'] ) && is_array( $new_field['fields'] ) ) {
321 321
 				// we have (inner) fields to merge
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 
365 365
 		$order = 0;
366 366
 		foreach ( $fields as $field ) {
367
-			++$order;
367
+			++ $order;
368 368
 			$type     = $this->get_field_type( $field );
369 369
 			$new_type = $this->convert_field_type( $type, $field );
370 370
 			if ( ! in_array( $new_type, $with_end ) && $new_type !== 'break' ) {
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 		$sub['name'] = __( 'Section Buttons', 'formidable' );
400 400
 		$subs        = array( $sub );
401 401
 		$this->insert_fields_in_array( $subs, $order, 0, $fields );
402
-		++$order;
402
+		++ $order;
403 403
 	}
404 404
 
405 405
 	/**
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 	protected function create_fields( $form_id, &$form ) {
514 514
 		foreach ( $form['fields'] as $key => $new_field ) {
515 515
 			$new_field['form_id']         = $form_id;
516
-			$form['fields'][ $key ]['id'] = FrmField::create( $new_field );
516
+			$form['fields'][$key]['id'] = FrmField::create( $new_field );
517 517
 		}
518 518
 	}
519 519
 
@@ -554,9 +554,9 @@  discard block
 block discarded – undo
554 554
 			} elseif ( $key === 'the_post_title' ) {
555 555
 				$new_action->post_content['post_title'] = $value;
556 556
 			} elseif ( is_string( $value ) ) {
557
-				$new_action->post_content[ $key ] = $this->replace_smart_tags( $value, $form['fields'] );
557
+				$new_action->post_content[$key] = $this->replace_smart_tags( $value, $form['fields'] );
558 558
 			} else {
559
-				$new_action->post_content[ $key ] = $value;
559
+				$new_action->post_content[$key] = $value;
560 560
 			}
561 561
 		}
562 562
 
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 
578 578
 		$imported = $this->get_tracked_import();
579 579
 
580
-		$imported[ $this->slug ][ $new_form_id ] = $source_id;
580
+		$imported[$this->slug][$new_form_id] = $source_id;
581 581
 
582 582
 		update_option( $this->tracking, $imported, false );
583 583
 	}
@@ -597,11 +597,11 @@  discard block
 block discarded – undo
597 597
 	private function is_imported( $source_id ) {
598 598
 		$imported    = $this->get_tracked_import();
599 599
 		$new_form_id = 0;
600
-		if ( ! isset( $imported[ $this->slug ] ) || ! in_array( $source_id, $imported[ $this->slug ] ) ) {
600
+		if ( ! isset( $imported[$this->slug] ) || ! in_array( $source_id, $imported[$this->slug] ) ) {
601 601
 			return $new_form_id;
602 602
 		}
603 603
 
604
-		$new_form_id = array_search( $source_id, array_reverse( $imported[ $this->slug ], true ) );
604
+		$new_form_id = array_search( $source_id, array_reverse( $imported[$this->slug], true ) );
605 605
 		if ( ! empty( $new_form_id ) && empty( FrmForm::get_key_by_id( $new_form_id ) ) ) {
606 606
 			// Allow reimport if the form was deleted.
607 607
 			$new_form_id = 0;
Please login to merge, or discard this patch.
classes/models/FrmField.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 	/**
9 9
 	 * @var bool
10 10
 	 */
11
-	public static $use_cache      = true;
11
+	public static $use_cache = true;
12 12
 
13 13
 	/**
14 14
 	 * @var int
@@ -280,11 +280,11 @@  discard block
 block discarded – undo
280 280
 			'ranking' => '2024-03-12',
281 281
 		);
282 282
 
283
-		if ( ! isset( $release_dates[ $type ] ) ) {
283
+		if ( ! isset( $release_dates[$type] ) ) {
284 284
 			return false;
285 285
 		}
286 286
 
287
-		$release_date = $release_dates[ $type ];
287
+		$release_date = $release_dates[$type];
288 288
 
289 289
 		$three_months_after_release = gmdate( 'Y-m-d', strtotime( $release_date . ' + 90 days' ) );
290 290
 		return gmdate( 'Y-m-d' ) < $three_months_after_release;
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
 		$values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) );
318 318
 
319 319
 		foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) {
320
-			if ( isset( $values[ $col ] ) ) {
321
-				$new_values[ $col ] = $values[ $col ];
320
+			if ( isset( $values[$col] ) ) {
321
+				$new_values[$col] = $values[$col];
322 322
 			}
323 323
 		}
324 324
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 		$new_values['created_at']    = current_time( 'mysql', 1 );
331 331
 
332 332
 		if ( isset( $values['id'] ) ) {
333
-			$frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key'];
333
+			$frm_duplicate_ids[$values['field_key']] = $new_values['field_key'];
334 334
 			$new_values                                = apply_filters( 'frm_duplicated_field', $new_values );
335 335
 		}
336 336
 
@@ -339,9 +339,9 @@  discard block
 block discarded – undo
339 339
 		foreach ( $new_values as $k => $v ) {
340 340
 			if ( is_array( $v ) ) {
341 341
 				if ( $k === 'default_value' ) {
342
-					$new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v );
342
+					$new_values[$k] = FrmAppHelper::maybe_json_encode( $v );
343 343
 				} else {
344
-					$new_values[ $k ] = serialize( $v );
344
+					$new_values[$k] = serialize( $v );
345 345
 				}
346 346
 			}
347 347
 			unset( $k, $v );
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 		}
362 362
 
363 363
 		if ( isset( $values['id'] ) ) {
364
-			$frm_duplicate_ids[ $values['id'] ] = $new_id;
364
+			$frm_duplicate_ids[$values['id']] = $new_id;
365 365
 		}
366 366
 
367 367
 		return $new_id;
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 			 * @param array $match Shortcode data.
413 413
 			 * @return string
414 414
 			 */
415
-			function ( $match ) {
415
+			function( $match ) {
416 416
 				$attr = shortcode_parse_atts( $match[3] );
417 417
 
418 418
 				if ( ! is_array( $attr ) ) {
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 					}
438 438
 
439 439
 					if ( FrmAppHelper::input_key_is_safe( $key, 'update' ) ) {
440
-						$safe_atts[ $key ] = $value;
440
+						$safe_atts[$key] = $value;
441 441
 					}
442 442
 				}
443 443
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 	public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) {
509 509
 		global $frm_duplicate_ids;
510 510
 
511
-		$where  = array(
511
+		$where = array(
512 512
 			array(
513 513
 				'or'                => 1,
514 514
 				'fi.form_id'        => $old_form_id,
@@ -554,8 +554,8 @@  discard block
 block discarded – undo
554 554
 
555 555
 			$values                                 = apply_filters( 'frm_duplicated_field', $values );
556 556
 			$new_id                                 = self::create( $values );
557
-			$frm_duplicate_ids[ $field->id ]        = $new_id;
558
-			$frm_duplicate_ids[ $field->field_key ] = $new_id;
557
+			$frm_duplicate_ids[$field->id]        = $new_id;
558
+			$frm_duplicate_ids[$field->field_key] = $new_id;
559 559
 			unset( $field );
560 560
 		}//end foreach
561 561
 	}
@@ -604,11 +604,11 @@  discard block
 block discarded – undo
604 604
 
605 605
 		// serialize array values
606 606
 		foreach ( array( 'field_options', 'options' ) as $opt ) {
607
-			if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) {
607
+			if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) {
608 608
 				if ( 'field_options' === $opt ) {
609
-					$values[ $opt ] = self::maybe_filter_options( $values[ $opt ] );
609
+					$values[$opt] = self::maybe_filter_options( $values[$opt] );
610 610
 				}
611
-				$values[ $opt ] = serialize( $values[ $opt ] );
611
+				$values[$opt] = serialize( $values[$opt] );
612 612
 			}
613 613
 		}
614 614
 		if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) {
@@ -815,8 +815,8 @@  discard block
 block discarded – undo
815 815
 					continue;
816 816
 				}
817 817
 
818
-				$fields[ $result->id ] = $result;
819
-				++$count;
818
+				$fields[$result->id] = $result;
819
+				++ $count;
820 820
 				if ( $limit == 1 ) {
821 821
 					$fields = $result;
822 822
 					break;
@@ -867,8 +867,8 @@  discard block
 block discarded – undo
867 867
 			$fields = array();
868 868
 			$count  = 0;
869 869
 			foreach ( $results as $result ) {
870
-				++$count;
871
-				$fields[ $result->id ] = $result;
870
+				++ $count;
871
+				$fields[$result->id] = $result;
872 872
 				if ( ! empty( $limit ) && $count >= $limit ) {
873 873
 					break;
874 874
 				}
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
 		$query_type = $limit === ' LIMIT 1' || $limit == 1 ? 'row' : 'results';
1001 1001
 
1002 1002
 		if ( is_array( $where ) ) {
1003
-			$args    = array(
1003
+			$args = array(
1004 1004
 				'order_by' => $order_by,
1005 1005
 				'limit'    => $limit,
1006 1006
 			);
@@ -1036,9 +1036,9 @@  discard block
 block discarded – undo
1036 1036
 				FrmDb::set_cache( $result->field_key, $result, 'frm_field' );
1037 1037
 
1038 1038
 				self::prepare_options( $result );
1039
-				$results[ $r_key ]->field_options = $result->field_options;
1040
-				$results[ $r_key ]->options       = $result->options;
1041
-				$results[ $r_key ]->default_value = $result->default_value;
1039
+				$results[$r_key]->field_options = $result->field_options;
1040
+				$results[$r_key]->options       = $result->options;
1041
+				$results[$r_key]->default_value = $result->default_value;
1042 1042
 
1043 1043
 				unset( $r_key, $result );
1044 1044
 			}
@@ -1131,7 +1131,7 @@  discard block
 block discarded – undo
1131 1131
 
1132 1132
 			if ( count( $next_fields ) >= self::$transient_size ) {
1133 1133
 				// if this transient is full, check for another
1134
-				++$next;
1134
+				++ $next;
1135 1135
 				self::get_next_transient( $fields, $base_name, $next );
1136 1136
 			}
1137 1137
 		}
@@ -1166,7 +1166,7 @@  discard block
 block discarded – undo
1166 1166
 				return;
1167 1167
 			}
1168 1168
 
1169
-			++$next;
1169
+			++ $next;
1170 1170
 		}
1171 1171
 	}
1172 1172
 
@@ -1318,7 +1318,7 @@  discard block
 block discarded – undo
1318 1318
 	 * @return bool
1319 1319
 	 */
1320 1320
 	public static function is_option_true_in_array( $field, $option ) {
1321
-		return ! empty( $field[ $option ] );
1321
+		return ! empty( $field[$option] );
1322 1322
 	}
1323 1323
 
1324 1324
 	/**
@@ -1327,7 +1327,7 @@  discard block
 block discarded – undo
1327 1327
 	 * @return bool
1328 1328
 	 */
1329 1329
 	public static function is_option_true_in_object( $field, $option ) {
1330
-		return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ];
1330
+		return isset( $field->field_options[$option] ) && $field->field_options[$option];
1331 1331
 	}
1332 1332
 
1333 1333
 	/**
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
 	 * @return bool
1337 1337
 	 */
1338 1338
 	public static function is_option_empty_in_array( $field, $option ) {
1339
-		return empty( $field[ $option ] );
1339
+		return empty( $field[$option] );
1340 1340
 	}
1341 1341
 
1342 1342
 	/**
@@ -1345,7 +1345,7 @@  discard block
 block discarded – undo
1345 1345
 	 * @return bool
1346 1346
 	 */
1347 1347
 	public static function is_option_empty_in_object( $field, $option ) {
1348
-		return empty( $field->field_options[ $option ] );
1348
+		return empty( $field->field_options[$option] );
1349 1349
 	}
1350 1350
 
1351 1351
 	/**
@@ -1354,7 +1354,7 @@  discard block
 block discarded – undo
1354 1354
 	 * @return bool
1355 1355
 	 */
1356 1356
 	public static function is_option_value_in_object( $field, $option ) {
1357
-		return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != '';
1357
+		return isset( $field->field_options[$option] ) && $field->field_options[$option] != '';
1358 1358
 	}
1359 1359
 
1360 1360
 	/**
@@ -1380,10 +1380,10 @@  discard block
 block discarded – undo
1380 1380
 	 * @return mixed
1381 1381
 	 */
1382 1382
 	public static function get_option_in_array( $field, $option ) {
1383
-		if ( isset( $field[ $option ] ) ) {
1384
-			$this_option = $field[ $option ];
1385
-		} elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) {
1386
-			$this_option = $field['field_options'][ $option ];
1383
+		if ( isset( $field[$option] ) ) {
1384
+			$this_option = $field[$option];
1385
+		} elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) {
1386
+			$this_option = $field['field_options'][$option];
1387 1387
 		} else {
1388 1388
 			$this_option = '';
1389 1389
 		}
@@ -1397,7 +1397,7 @@  discard block
 block discarded – undo
1397 1397
 	 * @return mixed
1398 1398
 	 */
1399 1399
 	public static function get_option_in_object( $field, $option ) {
1400
-		return $field->field_options[ $option ] ?? '';
1400
+		return $field->field_options[$option] ?? '';
1401 1401
 	}
1402 1402
 
1403 1403
 	/**
Please login to merge, or discard this patch.
classes/models/FrmCreateFile.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@
 block discarded – undo
33 33
 	/**
34 34
 	 * @var int
35 35
 	 */
36
-	public $chmod_dir       = 0755;
36
+	public $chmod_dir = 0755;
37 37
 
38 38
 	/**
39 39
 	 * @var int
40 40
 	 */
41
-	public $chmod_file      = 0644;
41
+	public $chmod_file = 0644;
42 42
 
43 43
 	/**
44 44
 	 * @var bool
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';
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 		}
403 403
 
404 404
 		$random = random_int( 0, $count - 1 );
405
-		return $tips[ $random ];
405
+		return $tips[$random];
406 406
 	}
407 407
 
408 408
 	/**
Please login to merge, or discard this patch.