Passed
Push — master ( 9627b3...29dccc )
by Brian
05:02
created
templates/payment-forms/elements/date.php 2 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -12,58 +12,58 @@
 block discarded – undo
12 12
 $label       = empty( $label ) ? '' : wp_kses_post( $label );
13 13
 $label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) );
14 14
 if ( ! empty( $required ) ) {
15
-	$label .= "<span class='text-danger'> *</span>";
15
+    $label .= "<span class='text-danger'> *</span>";
16 16
 }
17 17
 
18 18
 $disable_dates = array();
19 19
 
20 20
 if ( ! empty( $disabled_dates ) ) {
21
-	$disabled_dates = preg_replace( '/\s+/', '', $disabled_dates );
22
-	$disabled_dates = str_ireplace( 'today', current_time( 'Y-m-d' ), $disabled_dates );
23
-	$disabled_dates = array_filter( explode( ',', $disabled_dates ) );
21
+    $disabled_dates = preg_replace( '/\s+/', '', $disabled_dates );
22
+    $disabled_dates = str_ireplace( 'today', current_time( 'Y-m-d' ), $disabled_dates );
23
+    $disabled_dates = array_filter( explode( ',', $disabled_dates ) );
24 24
 
25
-	foreach ( $disabled_dates as $disabled_date ) {
25
+    foreach ( $disabled_dates as $disabled_date ) {
26 26
 
27
-		$disabled_date = trim( $disabled_date );
27
+        $disabled_date = trim( $disabled_date );
28 28
 
29
-		if ( false === strpos( $disabled_date, '|' ) ) {
30
-			$disable_dates[] = $disabled_date;
31
-			continue;
32
-		}
29
+        if ( false === strpos( $disabled_date, '|' ) ) {
30
+            $disable_dates[] = $disabled_date;
31
+            continue;
32
+        }
33 33
 
34
-		$disabled_date   = explode( '|', $disabled_date );
35
-		$disable_dates[] = array(
36
-			'from' => trim( $disabled_date[0] ),
37
-			'to'   => trim( $disabled_date[1] ),
38
-		);
34
+        $disabled_date   = explode( '|', $disabled_date );
35
+        $disable_dates[] = array(
36
+            'from' => trim( $disabled_date[0] ),
37
+            'to'   => trim( $disabled_date[1] ),
38
+        );
39 39
 
40
-	}
40
+    }
41 41
 
42 42
 }
43 43
 
44 44
 $options = array(
45
-	'data-default-date' => empty( 'default_date' ) ? false : $default_date,
46
-	'data-min-date'     => empty( 'min_date' ) ? false : $min_date,
47
-	'data-max-date'     => empty( 'max_date' ) ? false : $max_date,
48
-	'data-mode'         => empty( 'mode' ) ? 'single' : $mode,
49
-	'data-alt-format'   => get_option( 'date_format', 'F j, Y' ),
50
-	'data-date-format'  => 'Y-m-d',
51
-	'data-alt-input'    => 'true',
52
-	'data-disable_alt'  => empty( $disabled_dates ) ? false : wp_json_encode( $disable_dates ),
53
-	'data-disable_days_alt'  => empty( $disable_days ) ? false : wp_json_encode( wp_parse_id_list( $disable_days ) ),
45
+    'data-default-date' => empty( 'default_date' ) ? false : $default_date,
46
+    'data-min-date'     => empty( 'min_date' ) ? false : $min_date,
47
+    'data-max-date'     => empty( 'max_date' ) ? false : $max_date,
48
+    'data-mode'         => empty( 'mode' ) ? 'single' : $mode,
49
+    'data-alt-format'   => get_option( 'date_format', 'F j, Y' ),
50
+    'data-date-format'  => 'Y-m-d',
51
+    'data-alt-input'    => 'true',
52
+    'data-disable_alt'  => empty( $disabled_dates ) ? false : wp_json_encode( $disable_dates ),
53
+    'data-disable_days_alt'  => empty( $disable_days ) ? false : wp_json_encode( wp_parse_id_list( $disable_days ) ),
54 54
 );
55 55
 
56 56
 echo aui()->input(
57
-	array(
58
-		'name'             => esc_attr( $id ),
59
-		'id'               => esc_attr( $id ) . uniqid( '_' ),
60
-		'placeholder'      => empty( $placeholder ) ? '' : esc_attr( $placeholder ),
61
-		'required'         => ! empty( $required ),
62
-		'label'            => $label,
63
-		'label_type'       => 'vertical',
64
-		'help_text'        => empty( $description ) ? '' : wp_kses_post( $description ),
65
-		'type'             => 'datepicker',
66
-		'class'            => $label_class . ' getpaid-init-flatpickr flatpickr-input',
67
-		'extra_attributes' => array_filter( apply_filters( 'getpaid_date_field_attributes', $options ) ),
68
-	)
57
+    array(
58
+        'name'             => esc_attr( $id ),
59
+        'id'               => esc_attr( $id ) . uniqid( '_' ),
60
+        'placeholder'      => empty( $placeholder ) ? '' : esc_attr( $placeholder ),
61
+        'required'         => ! empty( $required ),
62
+        'label'            => $label,
63
+        'label_type'       => 'vertical',
64
+        'help_text'        => empty( $description ) ? '' : wp_kses_post( $description ),
65
+        'type'             => 'datepicker',
66
+        'class'            => $label_class . ' getpaid-init-flatpickr flatpickr-input',
67
+        'extra_attributes' => array_filter( apply_filters( 'getpaid_date_field_attributes', $options ) ),
68
+    )
69 69
 );
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -7,34 +7,34 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$label       = empty( $label ) ? '' : wp_kses_post( $label );
13
-$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) );
14
-if ( ! empty( $required ) ) {
12
+$label       = empty($label) ? '' : wp_kses_post($label);
13
+$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label));
14
+if (!empty($required)) {
15 15
 	$label .= "<span class='text-danger'> *</span>";
16 16
 }
17 17
 
18 18
 $disable_dates = array();
19 19
 
20
-if ( ! empty( $disabled_dates ) ) {
21
-	$disabled_dates = preg_replace( '/\s+/', '', $disabled_dates );
22
-	$disabled_dates = str_ireplace( 'today', current_time( 'Y-m-d' ), $disabled_dates );
23
-	$disabled_dates = array_filter( explode( ',', $disabled_dates ) );
20
+if (!empty($disabled_dates)) {
21
+	$disabled_dates = preg_replace('/\s+/', '', $disabled_dates);
22
+	$disabled_dates = str_ireplace('today', current_time('Y-m-d'), $disabled_dates);
23
+	$disabled_dates = array_filter(explode(',', $disabled_dates));
24 24
 
25
-	foreach ( $disabled_dates as $disabled_date ) {
25
+	foreach ($disabled_dates as $disabled_date) {
26 26
 
27
-		$disabled_date = trim( $disabled_date );
27
+		$disabled_date = trim($disabled_date);
28 28
 
29
-		if ( false === strpos( $disabled_date, '|' ) ) {
29
+		if (false === strpos($disabled_date, '|')) {
30 30
 			$disable_dates[] = $disabled_date;
31 31
 			continue;
32 32
 		}
33 33
 
34
-		$disabled_date   = explode( '|', $disabled_date );
34
+		$disabled_date   = explode('|', $disabled_date);
35 35
 		$disable_dates[] = array(
36
-			'from' => trim( $disabled_date[0] ),
37
-			'to'   => trim( $disabled_date[1] ),
36
+			'from' => trim($disabled_date[0]),
37
+			'to'   => trim($disabled_date[1]),
38 38
 		);
39 39
 
40 40
 	}
@@ -42,28 +42,28 @@  discard block
 block discarded – undo
42 42
 }
43 43
 
44 44
 $options = array(
45
-	'data-default-date' => empty( 'default_date' ) ? false : $default_date,
46
-	'data-min-date'     => empty( 'min_date' ) ? false : $min_date,
47
-	'data-max-date'     => empty( 'max_date' ) ? false : $max_date,
48
-	'data-mode'         => empty( 'mode' ) ? 'single' : $mode,
49
-	'data-alt-format'   => get_option( 'date_format', 'F j, Y' ),
45
+	'data-default-date' => empty('default_date') ? false : $default_date,
46
+	'data-min-date'     => empty('min_date') ? false : $min_date,
47
+	'data-max-date'     => empty('max_date') ? false : $max_date,
48
+	'data-mode'         => empty('mode') ? 'single' : $mode,
49
+	'data-alt-format'   => get_option('date_format', 'F j, Y'),
50 50
 	'data-date-format'  => 'Y-m-d',
51 51
 	'data-alt-input'    => 'true',
52
-	'data-disable_alt'  => empty( $disabled_dates ) ? false : wp_json_encode( $disable_dates ),
53
-	'data-disable_days_alt'  => empty( $disable_days ) ? false : wp_json_encode( wp_parse_id_list( $disable_days ) ),
52
+	'data-disable_alt'  => empty($disabled_dates) ? false : wp_json_encode($disable_dates),
53
+	'data-disable_days_alt'  => empty($disable_days) ? false : wp_json_encode(wp_parse_id_list($disable_days)),
54 54
 );
55 55
 
56 56
 echo aui()->input(
57 57
 	array(
58
-		'name'             => esc_attr( $id ),
59
-		'id'               => esc_attr( $id ) . uniqid( '_' ),
60
-		'placeholder'      => empty( $placeholder ) ? '' : esc_attr( $placeholder ),
61
-		'required'         => ! empty( $required ),
58
+		'name'             => esc_attr($id),
59
+		'id'               => esc_attr($id) . uniqid('_'),
60
+		'placeholder'      => empty($placeholder) ? '' : esc_attr($placeholder),
61
+		'required'         => !empty($required),
62 62
 		'label'            => $label,
63 63
 		'label_type'       => 'vertical',
64
-		'help_text'        => empty( $description ) ? '' : wp_kses_post( $description ),
64
+		'help_text'        => empty($description) ? '' : wp_kses_post($description),
65 65
 		'type'             => 'datepicker',
66 66
 		'class'            => $label_class . ' getpaid-init-flatpickr flatpickr-input',
67
-		'extra_attributes' => array_filter( apply_filters( 'getpaid_date_field_attributes', $options ) ),
67
+		'extra_attributes' => array_filter(apply_filters('getpaid_date_field_attributes', $options)),
68 68
 	)
69 69
 );
Please login to merge, or discard this patch.
templates/payment-forms-admin/edit/date.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -7,104 +7,104 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
14 14
 <div class='form-group'>
15 15
 	<label class="d-block">
16
-		<span><?php esc_html_e( 'Field Label', 'invoicing' ); ?></span>
16
+		<span><?php esc_html_e('Field Label', 'invoicing'); ?></span>
17 17
 		<input v-model='active_form_element.label' class='form-control' type="text"/>
18 18
 	</label>
19 19
 </div>
20 20
 
21 21
 <div class='form-group'>
22 22
 	<label class="d-block">
23
-		<span><?php esc_html_e( 'Default Date', 'invoicing' ); ?></span>
24
-		<?php echo wpi_help_tip( sprintf( __( 'You can enter the shortcut "today" or enter a date matching the format Y-m-d, e.g %s', 'invoicing' ), current_time( 'Y-m-d' ) ), false, true ); ?>
25
-		<input v-model='active_form_element.default_date' placeholder="<?php esc_attr_e( 'None', 'invoicing' ); ?>" class='form-control' type="text"/>
23
+		<span><?php esc_html_e('Default Date', 'invoicing'); ?></span>
24
+		<?php echo wpi_help_tip(sprintf(__('You can enter the shortcut "today" or enter a date matching the format Y-m-d, e.g %s', 'invoicing'), current_time('Y-m-d')), false, true); ?>
25
+		<input v-model='active_form_element.default_date' placeholder="<?php esc_attr_e('None', 'invoicing'); ?>" class='form-control' type="text"/>
26 26
 	</label>
27 27
 </div>
28 28
 
29 29
 <div class='form-group'>
30 30
 	<label class="d-block">
31
-		<span><?php esc_html_e( 'Minimum Date', 'invoicing' ); ?></span>
32
-		<?php echo wpi_help_tip( sprintf( __( 'You can enter the shortcut "today" or enter a date matching the format Y-m-d, e.g %s', 'invoicing' ), current_time( 'Y-m-d' ) ), false, true ); ?>
33
-		<input v-model='active_form_element.min_date' placeholder="<?php esc_attr_e( 'None', 'invoicing' ); ?>" class='form-control' type="text"/>
34
-		<small class="form-text text-muted"><?php _e( 'Specify the minimum/earliest date (inclusively) allowed for selection.', 'invoicing' ); ?></small>
31
+		<span><?php esc_html_e('Minimum Date', 'invoicing'); ?></span>
32
+		<?php echo wpi_help_tip(sprintf(__('You can enter the shortcut "today" or enter a date matching the format Y-m-d, e.g %s', 'invoicing'), current_time('Y-m-d')), false, true); ?>
33
+		<input v-model='active_form_element.min_date' placeholder="<?php esc_attr_e('None', 'invoicing'); ?>" class='form-control' type="text"/>
34
+		<small class="form-text text-muted"><?php _e('Specify the minimum/earliest date (inclusively) allowed for selection.', 'invoicing'); ?></small>
35 35
 	</label>
36 36
 </div>
37 37
 
38 38
 <div class='form-group'>
39 39
 	<label class="d-block">
40
-		<span><?php esc_html_e( 'Maximum Date', 'invoicing' ); ?></span>
41
-		<?php echo wpi_help_tip( sprintf( __( 'You can enter the shortcut "today" or enter a date matching the format Y-m-d, e.g %s', 'invoicing' ), current_time( 'Y-m-d' ) ), false, true ); ?>
42
-		<input v-model='active_form_element.max_date' placeholder="<?php esc_attr_e( 'None', 'invoicing' ); ?>" class='form-control' type="text"/>
43
-		<small class="form-text text-muted"><?php _e( 'Specify the maximum/latest date (inclusively) allowed for selection.', 'invoicing' ); ?></small>
40
+		<span><?php esc_html_e('Maximum Date', 'invoicing'); ?></span>
41
+		<?php echo wpi_help_tip(sprintf(__('You can enter the shortcut "today" or enter a date matching the format Y-m-d, e.g %s', 'invoicing'), current_time('Y-m-d')), false, true); ?>
42
+		<input v-model='active_form_element.max_date' placeholder="<?php esc_attr_e('None', 'invoicing'); ?>" class='form-control' type="text"/>
43
+		<small class="form-text text-muted"><?php _e('Specify the maximum/latest date (inclusively) allowed for selection.', 'invoicing'); ?></small>
44 44
 	</label>
45 45
 </div>
46 46
 
47 47
 <div class='form-group'>
48 48
 	<label class="d-block">
49
-		<span><?php esc_html_e( 'Disabled Dates', 'invoicing' ); ?></span>
50
-		<?php echo wpi_help_tip( sprintf( __( 'You can use the shortcut "today" or enter dates matching the format Y-m-d, e.g %s', 'invoicing' ), current_time( 'Y-m-d' ) ), false, true ); ?>
51
-		<input v-model='active_form_element.disabled_dates' placeholder="<?php echo esc_attr( sprintf( __( 'For example, %s', 'invoicing' ), 'today,2025-04-01|2025-05-01,2025-09-01|2025-12-01' ) ); ?>" class='form-control' type="text"/>
52
-		<small class="form-text text-muted"><?php _e( 'Specify the dates to ignore. Use commas to separate dates and "|" to separate date ranges.', 'invoicing' ); ?></small>
49
+		<span><?php esc_html_e('Disabled Dates', 'invoicing'); ?></span>
50
+		<?php echo wpi_help_tip(sprintf(__('You can use the shortcut "today" or enter dates matching the format Y-m-d, e.g %s', 'invoicing'), current_time('Y-m-d')), false, true); ?>
51
+		<input v-model='active_form_element.disabled_dates' placeholder="<?php echo esc_attr(sprintf(__('For example, %s', 'invoicing'), 'today,2025-04-01|2025-05-01,2025-09-01|2025-12-01')); ?>" class='form-control' type="text"/>
52
+		<small class="form-text text-muted"><?php _e('Specify the dates to ignore. Use commas to separate dates and "|" to separate date ranges.', 'invoicing'); ?></small>
53 53
 	</label>
54 54
 </div>
55 55
 
56 56
 <div class='form-group'>
57 57
 	<label class="d-block">
58
-		<span><?php esc_html_e( 'Disable Days', 'invoicing' ) ?></span>
58
+		<span><?php esc_html_e('Disable Days', 'invoicing') ?></span>
59 59
 		<gpselect2 class='form-control custom-select' v-model='active_form_element.disable_days' multiple>
60
-			<option value='0'><?php esc_html_e( 'Sundays', 'invoicing' ); ?></option>
61
-			<option value='1'><?php esc_html_e( 'Mondays', 'invoicing' ); ?></option>
62
-			<option value='2'><?php esc_html_e( 'Tuesdays', 'invoicing' ); ?></option>
63
-			<option value='3'><?php esc_html_e( 'Wednesdays', 'invoicing' ); ?></option>
64
-			<option value='4'><?php esc_html_e( 'Thursdays', 'invoicing' ); ?></option>
65
-			<option value='5'><?php esc_html_e( 'Fridays', 'invoicing' ); ?></option>
66
-			<option value='6'><?php esc_html_e( 'Saturdays', 'invoicing' ); ?></option>
60
+			<option value='0'><?php esc_html_e('Sundays', 'invoicing'); ?></option>
61
+			<option value='1'><?php esc_html_e('Mondays', 'invoicing'); ?></option>
62
+			<option value='2'><?php esc_html_e('Tuesdays', 'invoicing'); ?></option>
63
+			<option value='3'><?php esc_html_e('Wednesdays', 'invoicing'); ?></option>
64
+			<option value='4'><?php esc_html_e('Thursdays', 'invoicing'); ?></option>
65
+			<option value='5'><?php esc_html_e('Fridays', 'invoicing'); ?></option>
66
+			<option value='6'><?php esc_html_e('Saturdays', 'invoicing'); ?></option>
67 67
 		</gpselect2>
68
-		<small class="form-text text-muted"><?php _e( 'Optionally specify the days of the week to disable.', 'invoicing' ); ?></small>
68
+		<small class="form-text text-muted"><?php _e('Optionally specify the days of the week to disable.', 'invoicing'); ?></small>
69 69
 	</label>
70 70
 </div>
71 71
 
72 72
 <div class='form-group'>
73 73
 	<label class="d-block">
74
-		<span><?php esc_html_e( 'Mode', 'invoicing' ) ?></span>
74
+		<span><?php esc_html_e('Mode', 'invoicing') ?></span>
75 75
 		<select class='form-control custom-select' v-model='active_form_element.mode'>
76
-			<option value='single'><?php esc_html_e( 'Users can only select a single date', 'invoicing' ); ?></option>
77
-			<option value='range'><?php esc_html_e( 'Users can select a date range', 'invoicing' ); ?></option>
78
-			<option value='multiple'><?php esc_html_e( 'Users can select multiple dates', 'invoicing' ); ?></option>
76
+			<option value='single'><?php esc_html_e('Users can only select a single date', 'invoicing'); ?></option>
77
+			<option value='range'><?php esc_html_e('Users can select a date range', 'invoicing'); ?></option>
78
+			<option value='multiple'><?php esc_html_e('Users can select multiple dates', 'invoicing'); ?></option>
79 79
 		</select>
80 80
 	</label>
81 81
 </div>
82 82
 
83 83
 <div class='form-group'>
84 84
 	<label class="d-block">
85
-		<span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span>
86
-		<textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
87
-		<small class="form-text text-muted"><?php _e( 'HTML is allowed', 'invoicing' ); ?></small>
85
+		<span><?php esc_html_e('Help Text', 'invoicing'); ?></span>
86
+		<textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
87
+		<small class="form-text text-muted"><?php _e('HTML is allowed', 'invoicing'); ?></small>
88 88
 	</label>
89 89
 </div>
90 90
 
91 91
 <div class='form-group form-check'>
92 92
 	<input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' />
93
-	<label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label>
93
+	<label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label>
94 94
 </div>
95 95
 
96 96
 <div class='form-group form-check'>
97 97
 	<input :id="active_form_element.id + '_add_meta'" v-model='active_form_element.add_meta' type='checkbox' class='form-check-input' />
98
-	<label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e( 'Show this field in receipts and emails?', 'invoicing' ); ?></label>
98
+	<label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e('Show this field in receipts and emails?', 'invoicing'); ?></label>
99 99
 </div>
100 100
 
101 101
 <hr class='featurette-divider mt-4'>
102 102
 
103 103
 <div class='form-group'>
104 104
 	<label class="d-block">
105
-		<span><?php esc_html_e( 'Email Merge Tag', 'invoicing' ); ?></span>
105
+		<span><?php esc_html_e('Email Merge Tag', 'invoicing'); ?></span>
106 106
 		<input :value='active_form_element.label | formatMergeTag' class='form-control bg-white' type="text" readonly onclick="this.select()" />
107
-		<span class="form-text text-muted"><?php esc_html_e( 'You can use this merge tag in notification emails', 'invoicing' ); ?></span>
107
+		<span class="form-text text-muted"><?php esc_html_e('You can use this merge tag in notification emails', 'invoicing'); ?></span>
108 108
 	</label>
109 109
 </div>
110 110
 
Please login to merge, or discard this patch.