Skip to content

Commit 670f022

Browse files
committed
Formatting: Fixed PHPCS warnings/errors.
1 parent 3a73d1a commit 670f022

12 files changed

+56
-46
lines changed

experimental/gpcc-field-indicators.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Gravity Perks // Copy Cat // Show Source and Target Field Indicators in Form Editor
44
* https://gravitywiz.com/documentation/gravity-forms-copy-cat/
5-
*
5+
*
66
* Display visual source and target field indicators next to field labels in the form editor.
77
*/
88
add_filter( 'gform_admin_pre_render', function( $form ) {
@@ -11,7 +11,7 @@
1111
return $form;
1212
}
1313

14-
$gpcc = new GP_Copy_Cat();
14+
$gpcc = new GP_Copy_Cat();
1515
$gpcc_fields = $gpcc->get_copy_cat_fields( $form );
1616
if ( empty( $gpcc_fields ) ) {
1717
return $form;
@@ -54,8 +54,8 @@
5454
$mappings = array_merge( $_mappings );
5555
}
5656

57-
foreach( $form['fields'] as &$field ) {
58-
foreach( $mappings as $mapping ) {
57+
foreach ( $form['fields'] as &$field ) {
58+
foreach ( $mappings as $mapping ) {
5959
if ( $field->id == $mapping['source'] ) {
6060
$field->cssClass .= ' gpcc-source';
6161
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
33
* This snippet has evolved! 🦄
4-
* Find the new version of this snippet here:
4+
* Find the new version of this snippet here:
55
* https://github.com/gravitywiz/snippet-library/blob/master/experimental/gpdtc-recalc.php
66
*/

experimental/gpdtc-recalc.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
* https://gravitywiz.com/documentation/gravity-forms-date-time-calculator/
55
*
66
* Recalculate a calculated field's value every time it's viewed.
7-
*
7+
*
88
* Works great with Date Time Calculator's [:age modifier][1].
9-
*
9+
*
1010
* [1]: https://gravitywiz.com/documentation/gravity-forms-date-time-calculator/#calculating-age
1111
*/
1212
add_action( 'wp_loaded', function() {
13-
13+
1414
$form_id = 123; // Change this to the form's ID
1515
$field_id = 4; // Change this to the Calculation field's ID.
16-
16+
1717
$values = array();
18-
18+
1919
add_filter( sprintf( 'gform_get_input_value_%s', $form_id ), function( $value, $entry, $field, $input_id ) use ( $field_id, &$values ) {
2020
if ( $field['id'] !== $field_id ) {
2121
$values[ $field['id'] ] = $value;
@@ -25,5 +25,5 @@
2525
$_entry = $entry + $values;
2626
return GFCommon::calculate( $field, $form, $_entry );
2727
}, 10, 4 );
28-
28+
2929
} );

gp-limit-dates/gpld-push-min-date-to-next-day-after-set-time.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
$current_time = new DateTime( wp_timezone_string() );
1414
$cutoff_time = ( new DateTime( wp_timezone_string() ) )->setTime( $cutoff_hour, 0 );
1515
if ( $current_time > $cutoff_time ) {
16-
$options['minDate'] = date( 'm/d/Y', strtotime( 'midnight tomorrow', $current_time->getTimestamp() ) );
16+
$options['minDate'] = wp_date( 'm/d/Y', strtotime( 'midnight tomorrow', $current_time->getTimestamp() ) );
1717
}
1818
return $options;
1919
} );

gp-limit-submissions/gpls-do-not-enforce-empty-fields.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
if ( empty( $gpls_enforce->get_rule_groups() ) ) {
2323
return $should_enforce;
2424
}
25-
25+
2626
$failed_rule_group = $gpls_enforce->get_test_result()->failed_rule_group;
2727
if ( ! $failed_rule_group ) {
2828
return $should_enforce;

gp-limit-submissions/gpls-set-limit-by-custom-field.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
*/
66
// Update "123" to your form ID.
77
add_filter( 'gpls_rule_groups_123', function ( $rule_groups ) {
8-
9-
// Update "Your Feed Name" to the name of your Limit Submissions feed.
10-
$feed_name = 'My Feed Name';
11-
12-
// Update "my_custom_limit" to your custom field key.
13-
$custom_field = 'my_custom_limit';
14-
15-
$post_id = get_queried_object_id();
16-
if ( ! $post_id ) {
17-
return $rule_groups;
18-
}
19-
8+
9+
// Update "Your Feed Name" to the name of your Limit Submissions feed.
10+
$feed_name = 'My Feed Name';
11+
12+
// Update "my_custom_limit" to your custom field key.
13+
$custom_field = 'my_custom_limit';
14+
15+
$post_id = get_queried_object_id();
16+
if ( ! $post_id ) {
17+
return $rule_groups;
18+
}
19+
2020
foreach ( $rule_groups as &$rule_group ) {
2121
if ( $rule_group->name == $feed_name ) {
2222
$rule_group->limit = get_post_meta( $post_id, $custom_field, true );

gp-nested-forms/gpnf-attach-child-entry-by-field.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* attached. Tip: Populate Anything can be used to populate this field with existing parent entries. The designated
1111
* field will only appear when the child form is accessed outside a Nested Form field.
1212
*/
13-
class GPNF_Attach_Child_Entry_by_Field {
13+
class GPNF_Attach_Child_Entry_By_Field {
1414

1515
public function __construct( $args = array() ) {
1616

@@ -72,7 +72,7 @@ public function is_applicable_child_form( $form ) {
7272

7373
# Configuration
7474

75-
new GPNF_Attach_Child_Entry_by_Field( array(
75+
new GPNF_Attach_Child_Entry_By_Field( array(
7676
'nested_form_field_id' => 4, // Update "4" to the ID of your Nested Form field on the parent form.
7777
'child_form_id' => 123, // Update "123" to ID of your child form.
7878
'parent_entry_field_id' => 5, // Update "5" to the ID of the field on your child form that will contain the parent entry ID.

gp-notification-scheduler/gpns-pending-activation-reminders.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
* Schedule reminders for users who signed up but never activated their accounts.
77
*
88
* Requirements:
9-
*
9+
*
1010
* 1. [User Registration](https://www.gravityforms.com/add-ons/user-registration/)
1111
* 2. [Notification Scheduler](https://gravitywiz.com/documentation/gravity-forms-notification-scheduler/)
1212
* 3. [GW Conditional Logic: Entry Meta](https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-conditional-logic-entry-meta.php)
1313
*
1414
* Instructions:
15-
*
15+
*
1616
* 1. Ensure that all required plugins have been installed and activated.
1717
* 2. Setup a User Registration feed to create a new user with "User Activation" enabled.
1818
* 3. Setup a notification triggered by the "User is pending activation" event.
@@ -46,15 +46,15 @@
4646
'is',
4747
'isnot',
4848
),
49-
'choices' => array(
49+
'choices' => array(
5050
array(
51-
'text' => 'Yes',
52-
'value' => 1,
51+
'text' => 'Yes',
52+
'value' => 1,
5353
'isSelected' => false,
5454
),
5555
array(
56-
'text' => 'No',
57-
'value' => '',
56+
'text' => 'No',
57+
'value' => '',
5858
'isSelected' => false,
5959
),
6060
),
@@ -71,13 +71,13 @@
7171
}
7272
$field_filter['values'] = array(
7373
array(
74-
'text' => 'Yes',
75-
'value' => 1,
74+
'text' => 'Yes',
75+
'value' => 1,
7676
'isSelected' => false,
7777
),
7878
array(
79-
'text' => 'No',
80-
'value' => '',
79+
'text' => 'No',
80+
'value' => '',
8181
'isSelected' => false,
8282
),
8383
);

gp-populate-anything/gppa-include-static-choices.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,21 @@
3131

3232
if ( strpos( $field->cssClass, 'gppa-sort-static-choices-asc' ) !== false ) {
3333
usort( $choices, function ( $choice1, $choice2 ) {
34-
return $choice1['text'] <=> $choice2['text'];
34+
if ( $choice1['text'] == $choice2['text'] ) {
35+
return 0;
36+
}
37+
38+
return ( $choice1['text'] < $choice2['text'] ) ? -1 : 1;
3539
});
3640
}
3741

3842
if ( strpos( $field->cssClass, 'gppa-sort-static-choices-desc' ) !== false ) {
3943
usort( $choices, function ( $choice1, $choice2 ) {
40-
return $choice2['text'] <=> $choice1['text'];
44+
if ( $choice1['text'] == $choice2['text'] ) {
45+
return 0;
46+
}
47+
48+
return ( $choice1['text'] < $choice2['text'] ) ? 1 : -1;
4149
});
4250
}
4351

gravity-forms/gw-dynamic-range.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ public function set_dynamic_range( $form, $ajax, $field_values ) {
6464
$field->rangeMax = $this->get_range_value( $this->_args['max_field_id'], $form, $field_values );
6565
}
6666
}
67-
6867
}
6968

7069
return $form;
@@ -262,8 +261,11 @@ public function add_init_script( $form ) {
262261
'maxFieldId' => $this->_args['max_field_id'],
263262
'enforceLive' => $this->_args['enforce_live'],
264263
'messages' => array(
264+
// translators: placeholders are numbers
265265
'both' => esc_html__( 'Please enter a number from %1$s to %2$s.', 'gravityforms' ),
266+
// translators: placeholder is a number
266267
'min' => esc_html__( 'Please enter a number greater than or equal to %s.', 'gravityforms' ),
268+
// translators: placeholder is a number
267269
'max' => esc_html__( 'Please enter a number less than or equal to %s.', 'gravityforms' ),
268270
),
269271
);
@@ -287,8 +289,8 @@ public function is_applicable_form( $form ) {
287289
# Configuration
288290

289291
new GW_Dynamic_Range( array(
290-
'form_id' => 123,
291-
'field_id' => 4,
292+
'form_id' => 123,
293+
'field_id' => 4,
292294
'min_field_id' => 5,
293295
'max_field_id' => 6,
294296
) );

0 commit comments

Comments
 (0)