Passed
Push — master ( b67e15...0b271c )
by Brian
05:07
created
templates/payment-forms/cart-item.php 1 patch
Spacing   +52 added lines, -52 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 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,70 +109,70 @@  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 ) : ?>
159
+								<?php if ('left' === $position) : ?>
160 160
 										<div class="input-group-prepend">
161
-											<span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span>
161
+											<span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol($currency)); ?></span>
162 162
 										</div>
163 163
 									<?php endif; ?>
164 164
 
165
-									<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;">
165
+									<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;">
166 166
 
167
-								<?php if ( ! empty( $validate_minimum ) ) : ?>
167
+								<?php if (!empty($validate_minimum)) : ?>
168 168
 										<div class="invalid-tooltip">
169
-											<?php echo wp_kses_post( $validate_minimum ); ?>
169
+											<?php echo wp_kses_post($validate_minimum); ?>
170 170
 										</div>
171 171
 									<?php endif; ?>
172 172
 
173
-								<?php if ( 'left' !== $position ) : ?>
173
+								<?php if ('left' !== $position) : ?>
174 174
 										<div class="input-group-append">
175
-											<span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span>
175
+											<span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol($currency)); ?></span>
176 176
 										</div>
177 177
 									<?php endif; ?>
178 178
 								</div>
@@ -180,24 +180,24 @@  discard block
 block discarded – undo
180 180
 							<?php
181 181
 
182 182
 						} else {
183
-						echo wp_kses_post( wpinv_price( $item->get_price(), $currency ) );
183
+						echo wp_kses_post(wpinv_price($item->get_price(), $currency));
184 184
 
185 185
 						?>
186
-								<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() ); ?>'>
186
+								<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()); ?>'>
187 187
 						<?php
188 188
 						}
189 189
 
190 190
 					printf(
191 191
                         '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>',
192 192
 						// translators: %s is the item subtotal.
193
-                        sprintf( esc_html__( 'Subtotal: %s', 'invoicing' ), wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ) )
193
+                        sprintf(esc_html__('Subtotal: %s', 'invoicing'), wp_kses_post(wpinv_price($item->get_sub_total(), $currency)))
194 194
                     );
195 195
 					}
196 196
 
197 197
 					// Item quantity.
198
-					if ( 'quantity' === $key ) {
198
+					if ('quantity' === $key) {
199 199
 
200
-					if ( $item->allows_quantities() ) {
200
+					if ($item->allows_quantities()) {
201 201
 						?>
202 202
 								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type="number" step="0.01" 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>
203 203
 							<?php
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
 }
212 212
 
213 213
 					// Item sub total.
214
-					if ( 'subtotal' === $key ) {
215
-					echo wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) );
214
+					if ('subtotal' === $key) {
215
+					echo wp_kses_post(wpinv_price($item->get_sub_total(), $currency));
216 216
 					}
217 217
 
218
-					do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
218
+					do_action("getpaid_payment_form_cart_item_$key", $item, $form);
219 219
 				?>
220 220
 
221 221
 			</div>
@@ -226,4 +226,4 @@  discard block
 block discarded – undo
226 226
 
227 227
 </div>
228 228
 <?php
229
-do_action( 'getpaid_payment_form_cart_item', $form, $item );
229
+do_action('getpaid_payment_form_cart_item', $form, $item);
Please login to merge, or discard this patch.
templates/invoice/line-item.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -10,104 +10,104 @@
 block discarded – undo
10 10
  * @var array $columns
11 11
  */
12 12
 
13
-defined( 'ABSPATH' ) || exit;
13
+defined('ABSPATH') || exit;
14 14
 
15
-do_action( 'getpaid_before_invoice_line_item', $invoice, $item );
15
+do_action('getpaid_before_invoice_line_item', $invoice, $item);
16 16
 
17 17
 ?>
18 18
 
19
-<div class='getpaid-invoice-item item-<?php echo (int) $item->get_id(); ?> item-type-<?php echo esc_attr( $item->get_type() ); ?> border-bottom'>
19
+<div class='getpaid-invoice-item item-<?php echo (int) $item->get_id(); ?> item-type-<?php echo esc_attr($item->get_type()); ?> border-bottom'>
20 20
 
21 21
 	<div class="form-row align-items-center">
22 22
 
23
-		<?php foreach ( array_keys( $columns ) as $column ) : ?>
23
+		<?php foreach (array_keys($columns) as $column) : ?>
24 24
 
25
-			<div class="<?php echo 'name' === $column ? 'col-12 col-sm-6' : 'col-12 col-sm'; ?> getpaid-invoice-item-<?php echo esc_attr( $column ); ?>">
25
+			<div class="<?php echo 'name' === $column ? 'col-12 col-sm-6' : 'col-12 col-sm'; ?> getpaid-invoice-item-<?php echo esc_attr($column); ?>">
26 26
 
27 27
 				<?php
28 28
 
29 29
 					// Fires before printing a line item column.
30
-					do_action( "getpaid_invoice_line_item_before_$column", $item, $invoice );
30
+					do_action("getpaid_invoice_line_item_before_$column", $item, $invoice);
31 31
 
32 32
 					// Item name.
33
-					if ( 'name' === $column ) {
33
+					if ('name' === $column) {
34 34
 
35
-						$has_featured_image = has_post_thumbnail( $item->get_id() );
35
+						$has_featured_image = has_post_thumbnail($item->get_id());
36 36
 
37
-						if ( $has_featured_image ) {
37
+						if ($has_featured_image) {
38 38
 							echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">';
39 39
 							echo '<div class="getpaid-form-item-image-container mr-2">';
40
-							echo get_the_post_thumbnail( $item->get_id(), 'thumbnail', array( 'class' => 'getpaid-form-item-image mb-0' ) );
40
+							echo get_the_post_thumbnail($item->get_id(), 'thumbnail', array('class' => 'getpaid-form-item-image mb-0'));
41 41
 							echo '</div>';
42 42
 							echo '<div class="getpaid-form-item-name-container">';
43 43
 						}
44 44
 
45 45
 						// Display the name.
46
-						echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>';
46
+						echo '<div class="mb-1">' . esc_html($item->get_name()) . '</div>';
47 47
 
48 48
 						// And an optional description.
49 49
 						$description = $item->get_description();
50 50
 
51
-						if ( ! empty( $description ) ) {
52
-							echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>';
51
+						if (!empty($description)) {
52
+							echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post($description) . '</small>';
53 53
 						}
54 54
 
55 55
 						// Fires before printing the line item actions.
56
-						do_action( 'getpaid_before_invoice_line_item_actions', $item, $invoice );
56
+						do_action('getpaid_before_invoice_line_item_actions', $item, $invoice);
57 57
 
58
-						$actions = apply_filters( 'getpaid-invoice-page-line-item-actions', array(), $item, $invoice );
58
+						$actions = apply_filters('getpaid-invoice-page-line-item-actions', array(), $item, $invoice);
59 59
 
60
-						if ( ! empty( $actions ) ) {
60
+						if (!empty($actions)) {
61 61
 
62
-							$sanitized  = array();
63
-							foreach ( $actions as $key => $item_action ) {
64
-								$key         = sanitize_html_class( $key );
65
-								$item_action = wp_kses_post( $item_action );
62
+							$sanitized = array();
63
+							foreach ($actions as $key => $item_action) {
64
+								$key         = sanitize_html_class($key);
65
+								$item_action = wp_kses_post($item_action);
66 66
 								$sanitized[] = "<span class='$key'>$item_action</span>";
67 67
 							}
68 68
 
69 69
 							echo "<small class='form-text getpaid-line-item-actions'>";
70
-							echo wp_kses_post( implode( ' | ', $sanitized ) );
70
+							echo wp_kses_post(implode(' | ', $sanitized));
71 71
 							echo '</small>';
72 72
 
73 73
 						}
74 74
 
75
-						if ( $has_featured_image ) {
75
+						if ($has_featured_image) {
76 76
 							echo '</div>';
77 77
 							echo '</div>';
78 78
 						}
79 79
 					}
80 80
 
81 81
 					// Item price.
82
-					if ( 'price' === $column ) {
82
+					if ('price' === $column) {
83 83
 
84 84
 					// Display the item price (or recurring price if this is a renewal invoice)
85 85
 					$price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price();
86
-					wpinv_the_price( $price, $invoice->get_currency() );
86
+					wpinv_the_price($price, $invoice->get_currency());
87 87
 
88 88
 					}
89 89
 
90 90
 					// Tax rate.
91
-					if ( 'tax_rate' === $column ) {
92
-					echo floatval( round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%';
91
+					if ('tax_rate' === $column) {
92
+					echo floatval(round(getpaid_get_invoice_tax_rate($invoice, $item), 2)) . '%';
93 93
 					}
94 94
 
95 95
 					// Item quantity.
96
-					if ( 'quantity' === $column ) {
96
+					if ('quantity' === $column) {
97 97
 					echo (float) $item->get_quantity();
98 98
 					}
99 99
 
100 100
 					// Item sub total.
101
-					if ( 'subtotal' === $column ) {
101
+					if ('subtotal' === $column) {
102 102
 					$subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total();
103
-					wpinv_the_price( $subtotal, $invoice->get_currency() );
103
+					wpinv_the_price($subtotal, $invoice->get_currency());
104 104
 					}
105 105
 
106 106
 					// Fires when printing a line item column.
107
-					do_action( "getpaid_invoice_line_item_$column", $item, $invoice );
107
+					do_action("getpaid_invoice_line_item_$column", $item, $invoice);
108 108
 
109 109
 					// Fires after printing a line item column.
110
-					do_action( "getpaid_invoice_line_item_after_$column", $item, $invoice );
110
+					do_action("getpaid_invoice_line_item_after_$column", $item, $invoice);
111 111
 
112 112
 				?>
113 113
 
Please login to merge, or discard this patch.