Passed
Push — master ( 0dedff...06f640 )
by Brian
10:11 queued 05:31
created
templates/payment-forms/cart-item.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -9,28 +9,28 @@  discard block
 block discarded – undo
9 9
  * @var GetPaid_Form_Item $item
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) || exit;
12
+defined('ABSPATH') || exit;
13 13
 
14
-do_action( 'getpaid_before_payment_form_cart_item', $form, $item );
14
+do_action('getpaid_before_payment_form_cart_item', $form, $item);
15 15
 
16 16
 $currency = $form->get_currency();
17
-$max_qty  = wpinv_item_max_buyable_quantity( $item->get_id() );
17
+$max_qty  = wpinv_item_max_buyable_quantity($item->get_id());
18 18
 ?>
19 19
 <div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo (int) $item->get_id(); ?> border-bottom py-2 px-3'>
20 20
 
21 21
 	<div class="form-row row align-items-center needs-validation">
22 22
 
23
-		<?php foreach ( array_keys( $columns ) as $key ) : ?>
23
+		<?php foreach (array_keys($columns) as $key) : ?>
24 24
 
25
-			<div class="<?php echo 'name' === $key ? 'col-6' : 'col'; ?> <?php echo ( in_array( $key, array( 'subtotal', 'quantity', 'tax_rate' ), true ) ) ? 'd-none d-sm-block' : ''; ?> position-relative getpaid-form-cart-item-<?php echo esc_attr( $key ); ?> getpaid-form-cart-item-<?php echo esc_attr( $key ); ?>-<?php echo (int) $item->get_id(); ?>">
25
+			<div class="<?php echo 'name' === $key ? 'col-6' : 'col'; ?> <?php echo (in_array($key, array('subtotal', 'quantity', 'tax_rate'), true)) ? 'd-none d-sm-block' : ''; ?> position-relative getpaid-form-cart-item-<?php echo esc_attr($key); ?> getpaid-form-cart-item-<?php echo esc_attr($key); ?>-<?php echo (int) $item->get_id(); ?>">
26 26
 
27 27
 				<?php
28 28
 
29 29
 					// Fires before printing a line item column.
30
-					do_action( "getpaid_form_cart_item_before_$key", $item, $form );
30
+					do_action("getpaid_form_cart_item_before_$key", $item, $form);
31 31
 
32 32
 					// Item name.
33
-					if ( 'name' === $key ) {
33
+					if ('name' === $key) {
34 34
 
35 35
 
36 36
 						ob_start();
@@ -38,22 +38,22 @@  discard block
 block discarded – undo
38 38
 						// Add an optional description.
39 39
 						$description = $item->get_description();
40 40
 
41
-						if ( ! empty( $description ) ) {
42
-							echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>';
41
+						if (!empty($description)) {
42
+							echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post($description) . '</small>';
43 43
 						}
44 44
 
45 45
 						// Price help text.
46
-						$description = getpaid_item_recurring_price_help_text( $item, $currency );
47
-						if ( $description ) {
48
-							echo "<small class='getpaid-form-item-price-desc form-text text-muted font-italic pr-2 m-0'>" . wp_kses_post( $description ) . '</small>';
46
+						$description = getpaid_item_recurring_price_help_text($item, $currency);
47
+						if ($description) {
48
+							echo "<small class='getpaid-form-item-price-desc form-text text-muted font-italic pr-2 m-0'>" . wp_kses_post($description) . '</small>';
49 49
 						}
50 50
 
51
-						do_action( 'getpaid_payment_form_cart_item_description', $item, $form );
51
+						do_action('getpaid_payment_form_cart_item_description', $item, $form);
52 52
 
53
-						if ( wpinv_current_user_can_manage_invoicing() ) {
53
+						if (wpinv_current_user_can_manage_invoicing()) {
54 54
 
55 55
 							edit_post_link(
56
-								__( 'Edit this item.', 'invoicing' ),
56
+								__('Edit this item.', 'invoicing'),
57 57
 								'<small class="form-text text-muted">',
58 58
 								'</small>',
59 59
 								$item->get_id(),
@@ -65,30 +65,30 @@  discard block
 block discarded – undo
65 65
 						$description = ob_get_clean();
66 66
 
67 67
 						// Display the name.
68
-						$tootip = empty( $description ) ? '' : '&nbsp;<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>';
68
+						$tootip = empty($description) ? '' : '&nbsp;<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>';
69 69
 
70
-						$has_featured_image = has_post_thumbnail( $item->get_id() );
70
+						$has_featured_image = has_post_thumbnail($item->get_id());
71 71
 
72
-						if ( $has_featured_image ) {
72
+						if ($has_featured_image) {
73 73
 							echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">';
74 74
 							echo '<div class="getpaid-form-item-image-container mr-2">';
75
-							echo get_the_post_thumbnail( $item->get_id(), 'thumbnail', array( 'class' => 'getpaid-form-item-image mb-0' ) );
75
+							echo get_the_post_thumbnail($item->get_id(), 'thumbnail', array('class' => 'getpaid-form-item-image mb-0'));
76 76
 							echo '</div>';
77 77
 							echo '<div class="getpaid-form-item-name-container">';
78 78
 						}
79 79
 
80
-						echo '<div class="mb-1 font-weight-bold">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>';
80
+						echo '<div class="mb-1 font-weight-bold">' . esc_html($item->get_name()) . wp_kses_post($tootip) . '</div>';
81 81
 
82
-						if ( ! empty( $description ) ) {
83
-							printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post( $description ) );
82
+						if (!empty($description)) {
83
+							printf('<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post($description));
84 84
 						}
85 85
 
86
-						if ( $item->allows_quantities() ) {
86
+						if ($item->allows_quantities()) {
87 87
 							printf(
88 88
 								'<small class="d-sm-none text-muted form-text">%s</small>',
89 89
 								sprintf(
90 90
 									// translators: %s is the item quantity.
91
-									esc_html__( 'Qty %s', 'invoicing' ),
91
+									esc_html__('Qty %s', 'invoicing'),
92 92
 									sprintf(
93 93
 										'<input
94 94
 												type="number"
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 												max="%s"
101 101
 												>',
102 102
 										(float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(),
103
-										floatval( null !== $max_qty ? $max_qty : 1000000000000 )
103
+										floatval(null !== $max_qty ? $max_qty : 1000000000000)
104 104
 									)
105 105
 								)
106 106
 							);
@@ -109,85 +109,85 @@  discard block
 block discarded – undo
109 109
 								'<small class="d-sm-none text-muted form-text">%s</small>',
110 110
 								sprintf(
111 111
 									// translators: %s is the item quantity.
112
-									esc_html__( 'Qty %s', 'invoicing' ),
112
+									esc_html__('Qty %s', 'invoicing'),
113 113
 									(float) $item->get_quantity()
114 114
 								)
115 115
 							);
116 116
 						}
117 117
 
118
-						if ( $has_featured_image ) {
118
+						if ($has_featured_image) {
119 119
 							echo '</div>';
120 120
 							echo '</div>';
121 121
 						}
122 122
 					}
123 123
 
124 124
 					// Item price.
125
-					if ( 'price' === $key ) {
125
+					if ('price' === $key) {
126 126
 
127 127
 					// Set the currency position.
128 128
 					$position = wpinv_currency_position();
129 129
 
130
-					if ( 'left_space' === $position ) {
130
+					if ('left_space' === $position) {
131 131
 						$position = 'left';
132 132
 					}
133 133
 
134
-					if ( 'right_space' === $position ) {
134
+					if ('right_space' === $position) {
135 135
 						$position = 'right';
136 136
 					}
137 137
 
138
-					if ( $item->user_can_set_their_price() ) {
139
-						$price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
138
+					if ($item->user_can_set_their_price()) {
139
+						$price            = max((float) $item->get_price(), (float) $item->get_minimum_price());
140 140
 						$minimum          = (float) $item->get_minimum_price();
141 141
 						$validate_minimum = '';
142 142
 						$class            = '';
143 143
 						$data_minimum     = '';
144 144
 
145
-						if ( $minimum > 0 ) {
145
+						if ($minimum > 0) {
146 146
 							$validate_minimum = sprintf(
147 147
 								// translators: %s is the minimum price.
148
-								esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
149
-								wp_strip_all_tags( wpinv_price( $minimum, $currency ) )
148
+								esc_attr__('The minimum allowed amount is %s', 'invoicing'),
149
+								wp_strip_all_tags(wpinv_price($minimum, $currency))
150 150
 							);
151 151
 
152 152
 							$class = 'getpaid-validate-minimum-amount';
153 153
 
154
-							$data_minimum     = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'";
154
+							$data_minimum = "data-minimum-amount='" . esc_attr(getpaid_unstandardize_amount($minimum)) . "'";
155 155
 						}
156 156
 
157 157
 						?>
158 158
 								<div class="input-group input-group-sm">
159
-									<?php if ( 'left' === $position ) : ?>
160
-										<?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?>
159
+									<?php if ('left' === $position) : ?>
160
+										<?php if (empty($GLOBALS['aui_bs5'])) : ?>
161 161
 											<div class="input-group-prepend ">
162 162
 												<span class="input-group-text">
163
-													<?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span>
163
+													<?php echo wp_kses_post(wpinv_currency_symbol($currency)); ?></span>
164 164
 												</span>
165 165
 											</div>
166 166
 										<?php else : ?>
167 167
 											<span class="input-group-text">
168
-												<?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span>
168
+												<?php echo wp_kses_post(wpinv_currency_symbol($currency)); ?></span>
169 169
 											</span>
170 170
 										<?php endif; ?>
171 171
 									<?php endif; ?>
172 172
 
173
-									<input type="text" <?php echo wp_kses_post( $data_minimum ); ?> name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo esc_attr( getpaid_unstandardize_amount( $price ) ); ?>" placeholder="<?php echo esc_attr( getpaid_unstandardize_amount( $item->get_minimum_price() ) ); ?>" class="getpaid-item-price-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border <?php echo esc_attr( $class ); ?>" style="width: 64px; line-height: 1; min-height: 35px;">
173
+									<input type="text" <?php echo wp_kses_post($data_minimum); ?> name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo esc_attr(getpaid_unstandardize_amount($price)); ?>" placeholder="<?php echo esc_attr(getpaid_unstandardize_amount($item->get_minimum_price())); ?>" class="getpaid-item-price-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border <?php echo esc_attr($class); ?>" style="width: 64px; line-height: 1; min-height: 35px;">
174 174
 
175
-								<?php if ( ! empty( $validate_minimum ) ) : ?>
175
+								<?php if (!empty($validate_minimum)) : ?>
176 176
 										<div class="invalid-tooltip">
177
-											<?php echo wp_kses_post( $validate_minimum ); ?>
177
+											<?php echo wp_kses_post($validate_minimum); ?>
178 178
 										</div>
179 179
 									<?php endif; ?>
180 180
 
181
-								<?php if ( 'left' !== $position ) : ?>
182
-									<?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?>
181
+								<?php if ('left' !== $position) : ?>
182
+									<?php if (empty($GLOBALS['aui_bs5'])) : ?>
183 183
 											<div class="input-group-append ">
184 184
 												<span class="input-group-text">
185
-													<?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span>
185
+													<?php echo wp_kses_post(wpinv_currency_symbol($currency)); ?></span>
186 186
 												</span>
187 187
 											</div>
188 188
 										<?php else : ?>
189 189
 											<span class="input-group-text">
190
-												<?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span>
190
+												<?php echo wp_kses_post(wpinv_currency_symbol($currency)); ?></span>
191 191
 											</span>
192 192
 										<?php endif; ?>
193 193
 									<?php endif; ?>
@@ -196,24 +196,24 @@  discard block
 block discarded – undo
196 196
 							<?php
197 197
 
198 198
 						} else {
199
-						echo wp_kses_post( wpinv_price( $item->get_price(), $currency ) );
199
+						echo wp_kses_post(wpinv_price($item->get_price(), $currency));
200 200
 
201 201
 						?>
202
-								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'>
202
+								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr($item->get_price()); ?>'>
203 203
 						<?php
204 204
 						}
205 205
 
206 206
 					printf(
207 207
                         '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>',
208 208
 						// translators: %s is the item subtotal.
209
-                        sprintf( esc_html__( 'Subtotal: %s', 'invoicing' ), wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ) )
209
+                        sprintf(esc_html__('Subtotal: %s', 'invoicing'), wp_kses_post(wpinv_price($item->get_sub_total(), $currency)))
210 210
                     );
211 211
 					}
212 212
 
213 213
 					// Item quantity.
214
-					if ( 'quantity' === $key ) {
214
+					if ('quantity' === $key) {
215 215
 
216
-					if ( $item->allows_quantities() ) {
216
+					if ($item->allows_quantities()) {
217 217
 						?>
218 218
 								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type="number" step="any" style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(); ?>' min='1' <?php echo null !== $max_qty ? 'max="' . (float) $max_qty . '"' : ''; ?> required>
219 219
 							<?php
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
 }
228 228
 
229 229
 					// Item sub total.
230
-					if ( 'subtotal' === $key ) {
231
-					echo wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) );
230
+					if ('subtotal' === $key) {
231
+					echo wp_kses_post(wpinv_price($item->get_sub_total(), $currency));
232 232
 					}
233 233
 
234
-					do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
234
+					do_action("getpaid_payment_form_cart_item_$key", $item, $form);
235 235
 				?>
236 236
 
237 237
 			</div>
@@ -242,4 +242,4 @@  discard block
 block discarded – undo
242 242
 
243 243
 </div>
244 244
 <?php
245
-do_action( 'getpaid_payment_form_cart_item', $form, $item );
245
+do_action('getpaid_payment_form_cart_item', $form, $item);
Please login to merge, or discard this patch.