Completed
Pull Request — master (#2576)
by
unknown
40s
created
classes/models/FrmField.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	}
98 98
 
99 99
 	public static function pro_field_selection() {
100
-		$make_tracked_url = static function ( $url ) {
100
+		$make_tracked_url = static function( $url ) {
101 101
 			$utm_params = array(
102 102
 				'utm_source'   => 'WordPress',
103 103
 				'utm_medium'   => 'form-builder-add-fields',
@@ -346,11 +346,11 @@  discard block
 block discarded – undo
346 346
 			'ranking' => '2024-03-12',
347 347
 		);
348 348
 
349
-		if ( ! isset( $release_dates[ $type ] ) ) {
349
+		if ( ! isset( $release_dates[$type] ) ) {
350 350
 			return false;
351 351
 		}
352 352
 
353
-		$release_date = $release_dates[ $type ];
353
+		$release_date = $release_dates[$type];
354 354
 
355 355
 		$three_months_after_release = gmdate( 'Y-m-d', strtotime( $release_date . ' + 90 days' ) );
356 356
 		return gmdate( 'Y-m-d' ) < $three_months_after_release;
@@ -383,8 +383,8 @@  discard block
 block discarded – undo
383 383
 		$values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) );
384 384
 
385 385
 		foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) {
386
-			if ( isset( $values[ $col ] ) ) {
387
-				$new_values[ $col ] = $values[ $col ];
386
+			if ( isset( $values[$col] ) ) {
387
+				$new_values[$col] = $values[$col];
388 388
 			}
389 389
 		}
390 390
 
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 		$new_values['created_at']    = current_time( 'mysql', 1 );
397 397
 
398 398
 		if ( isset( $values['id'] ) ) {
399
-			$frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key'];
399
+			$frm_duplicate_ids[$values['field_key']] = $new_values['field_key'];
400 400
 			$new_values                                = apply_filters( 'frm_duplicated_field', $new_values );
401 401
 		}
402 402
 
@@ -405,9 +405,9 @@  discard block
 block discarded – undo
405 405
 		foreach ( $new_values as $k => $v ) {
406 406
 			if ( is_array( $v ) ) {
407 407
 				if ( $k === 'default_value' ) {
408
-					$new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v );
408
+					$new_values[$k] = FrmAppHelper::maybe_json_encode( $v );
409 409
 				} else {
410
-					$new_values[ $k ] = serialize( $v );
410
+					$new_values[$k] = serialize( $v );
411 411
 				}
412 412
 			}
413 413
 			unset( $k, $v );
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 		}
428 428
 
429 429
 		if ( isset( $values['id'] ) ) {
430
-			$frm_duplicate_ids[ $values['id'] ] = $new_id;
430
+			$frm_duplicate_ids[$values['id']] = $new_id;
431 431
 		}
432 432
 
433 433
 		return $new_id;
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 			 * @param array $match Shortcode data.
479 479
 			 * @return string
480 480
 			 */
481
-			function ( $match ) {
481
+			function( $match ) {
482 482
 				$attr = shortcode_parse_atts( $match[3] );
483 483
 
484 484
 				if ( ! is_array( $attr ) ) {
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 					}
504 504
 
505 505
 					if ( FrmAppHelper::input_key_is_safe( $key, 'update' ) ) {
506
-						$safe_atts[ $key ] = $value;
506
+						$safe_atts[$key] = $value;
507 507
 					}
508 508
 				}
509 509
 
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 	public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) {
562 562
 		global $frm_duplicate_ids;
563 563
 
564
-		$where  = array(
564
+		$where = array(
565 565
 			array(
566 566
 				'or'                => 1,
567 567
 				'fi.form_id'        => $old_form_id,
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
 
608 608
 			$values                                 = apply_filters( 'frm_duplicated_field', $values );
609 609
 			$new_id                                 = self::create( $values );
610
-			$frm_duplicate_ids[ $field->id ]        = $new_id;
611
-			$frm_duplicate_ids[ $field->field_key ] = $new_id;
610
+			$frm_duplicate_ids[$field->id]        = $new_id;
611
+			$frm_duplicate_ids[$field->field_key] = $new_id;
612 612
 			unset( $field );
613 613
 		}//end foreach
614 614
 	}
@@ -657,11 +657,11 @@  discard block
 block discarded – undo
657 657
 
658 658
 		// serialize array values
659 659
 		foreach ( array( 'field_options', 'options' ) as $opt ) {
660
-			if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) {
660
+			if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) {
661 661
 				if ( 'field_options' === $opt ) {
662
-					$values[ $opt ] = self::maybe_filter_options( $values[ $opt ] );
662
+					$values[$opt] = self::maybe_filter_options( $values[$opt] );
663 663
 				}
664
-				$values[ $opt ] = serialize( $values[ $opt ] );
664
+				$values[$opt] = serialize( $values[$opt] );
665 665
 			}
666 666
 		}
667 667
 		if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) {
@@ -852,8 +852,8 @@  discard block
 block discarded – undo
852 852
 					continue;
853 853
 				}
854 854
 
855
-				$fields[ $result->id ] = $result;
856
-				++$count;
855
+				$fields[$result->id] = $result;
856
+				++ $count;
857 857
 				if ( $limit == 1 ) {
858 858
 					$fields = $result;
859 859
 					break;
@@ -904,8 +904,8 @@  discard block
 block discarded – undo
904 904
 			$fields = array();
905 905
 			$count  = 0;
906 906
 			foreach ( $results as $result ) {
907
-				++$count;
908
-				$fields[ $result->id ] = $result;
907
+				++ $count;
908
+				$fields[$result->id] = $result;
909 909
 				if ( ! empty( $limit ) && $count >= $limit ) {
910 910
 					break;
911 911
 				}
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
 		$query_type = $limit === ' LIMIT 1' || $limit == 1 ? 'row' : 'results';
1020 1020
 
1021 1021
 		if ( is_array( $where ) ) {
1022
-			$args    = array(
1022
+			$args = array(
1023 1023
 				'order_by' => $order_by,
1024 1024
 				'limit'    => $limit,
1025 1025
 			);
@@ -1052,9 +1052,9 @@  discard block
 block discarded – undo
1052 1052
 				FrmDb::set_cache( $result->field_key, $result, 'frm_field' );
1053 1053
 
1054 1054
 				self::prepare_options( $result );
1055
-				$results[ $r_key ]->field_options = $result->field_options;
1056
-				$results[ $r_key ]->options       = $result->options;
1057
-				$results[ $r_key ]->default_value = $result->default_value;
1055
+				$results[$r_key]->field_options = $result->field_options;
1056
+				$results[$r_key]->options       = $result->options;
1057
+				$results[$r_key]->default_value = $result->default_value;
1058 1058
 
1059 1059
 				unset( $r_key, $result );
1060 1060
 			}
@@ -1133,7 +1133,7 @@  discard block
 block discarded – undo
1133 1133
 
1134 1134
 			if ( count( $next_fields ) >= self::$transient_size ) {
1135 1135
 				// if this transient is full, check for another
1136
-				++$next;
1136
+				++ $next;
1137 1137
 				self::get_next_transient( $fields, $base_name, $next );
1138 1138
 			}
1139 1139
 		}
@@ -1161,7 +1161,7 @@  discard block
 block discarded – undo
1161 1161
 				return;
1162 1162
 			}
1163 1163
 
1164
-			++$next;
1164
+			++ $next;
1165 1165
 		}
1166 1166
 	}
1167 1167
 
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
 	 * @return bool
1310 1310
 	 */
1311 1311
 	public static function is_option_true_in_array( $field, $option ) {
1312
-		return ! empty( $field[ $option ] );
1312
+		return ! empty( $field[$option] );
1313 1313
 	}
1314 1314
 
1315 1315
 	/**
@@ -1318,7 +1318,7 @@  discard block
 block discarded – undo
1318 1318
 	 * @return bool
1319 1319
 	 */
1320 1320
 	public static function is_option_true_in_object( $field, $option ) {
1321
-		return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ];
1321
+		return isset( $field->field_options[$option] ) && $field->field_options[$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_empty_in_array( $field, $option ) {
1330
-		return empty( $field[ $option ] );
1330
+		return empty( $field[$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_object( $field, $option ) {
1339
-		return empty( $field->field_options[ $option ] );
1339
+		return empty( $field->field_options[$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_value_in_object( $field, $option ) {
1348
-		return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != '';
1348
+		return isset( $field->field_options[$option] ) && $field->field_options[$option] != '';
1349 1349
 	}
1350 1350
 
1351 1351
 	/**
@@ -1371,10 +1371,10 @@  discard block
 block discarded – undo
1371 1371
 	 * @return mixed
1372 1372
 	 */
1373 1373
 	public static function get_option_in_array( $field, $option ) {
1374
-		if ( isset( $field[ $option ] ) ) {
1375
-			$this_option = $field[ $option ];
1376
-		} elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) {
1377
-			$this_option = $field['field_options'][ $option ];
1374
+		if ( isset( $field[$option] ) ) {
1375
+			$this_option = $field[$option];
1376
+		} elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) {
1377
+			$this_option = $field['field_options'][$option];
1378 1378
 		} else {
1379 1379
 			$this_option = '';
1380 1380
 		}
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
 	 * @return mixed
1389 1389
 	 */
1390 1390
 	public static function get_option_in_object( $field, $option ) {
1391
-		return $field->field_options[ $option ] ?? '';
1391
+		return $field->field_options[$option] ?? '';
1392 1392
 	}
1393 1393
 
1394 1394
 	/**
Please login to merge, or discard this patch.