Passed
Push — master ( 215c11...221553 )
by Brian
14:30
created
templates/payment-forms/cart-item.php 1 patch
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -26,58 +26,58 @@  discard block
 block discarded – undo
26 26
 
27 27
 				<?php
28 28
 
29
-					// Fires before printing a line item column.
30
-					do_action( "getpaid_form_cart_item_before_$key", $item, $form );
29
+                    // Fires before printing a line item column.
30
+                    do_action( "getpaid_form_cart_item_before_$key", $item, $form );
31 31
 
32
-					// Item name.
33
-					if ( 'name' == $key ) {
32
+                    // Item name.
33
+                    if ( 'name' == $key ) {
34 34
 
35
-						ob_start();
36
-						// And an optional description.
35
+                        ob_start();
36
+                        // And an optional description.
37 37
                         $description = $item->get_description();
38 38
 
39 39
                         if ( ! empty( $description ) ) {
40 40
                             $description = wp_kses_post( $description );
41 41
                             echo "<small class='form-text text-muted pr-2 m-0'>$description</small>";
42
-						}
42
+                        }
43 43
 
44
-						// Price help text.
44
+                        // Price help text.
45 45
                         $description = getpaid_item_recurring_price_help_text( $item, $currency );
46 46
                         if ( $description ) {
47 47
                             echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>";
48
-						}
48
+                        }
49 49
 
50
-						do_action( 'getpaid_payment_form_cart_item_description', $item, $form );
50
+                        do_action( 'getpaid_payment_form_cart_item_description', $item, $form );
51 51
 
52
-						if ( wpinv_current_user_can_manage_invoicing() ) {
52
+                        if ( wpinv_current_user_can_manage_invoicing() ) {
53 53
 
54
-							edit_post_link(
55
-								__( 'Edit this item.', 'invoicing' ),
56
-								'<small class="form-text text-muted">',
57
-								'</small>',
58
-								$item->get_id(),
59
-								'text-danger'
60
-							);
54
+                            edit_post_link(
55
+                                __( 'Edit this item.', 'invoicing' ),
56
+                                '<small class="form-text text-muted">',
57
+                                '</small>',
58
+                                $item->get_id(),
59
+                                'text-danger'
60
+                            );
61 61
 
62
-						}
62
+                        }
63 63
 
64
-						$description = ob_get_clean();
64
+                        $description = ob_get_clean();
65 65
 
66
-						// Display the name.
67
-						$tootip = empty( $description ) ? '' : "&nbsp;" . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>';
68
-						echo '<div class="mb-1">' . esc_html( $item->get_name() ) . $tootip . '</div>';
66
+                        // Display the name.
67
+                        $tootip = empty( $description ) ? '' : "&nbsp;" . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>';
68
+                        echo '<div class="mb-1">' . esc_html( $item->get_name() ) . $tootip . '</div>';
69 69
 
70
-						if ( ! empty( $description ) ) {
71
-							printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description );
72
-						}
73
-
74
-						if ( $item->allows_quantities() ) {
75
-							printf(
76
-								'<small class="d-sm-none text-muted form-text">%s</small>',
77
-								sprintf(
78
-									__( 'Qty %s', 'invoicing' ),
79
-									sprintf(
80
-										'<input
70
+                        if ( ! empty( $description ) ) {
71
+                            printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description );
72
+                        }
73
+
74
+                        if ( $item->allows_quantities() ) {
75
+                            printf(
76
+                                '<small class="d-sm-none text-muted form-text">%s</small>',
77
+                                sprintf(
78
+                                    __( 'Qty %s', 'invoicing' ),
79
+                                    sprintf(
80
+                                        '<input
81 81
 											type="number"
82 82
 											step="0.01"
83 83
 											style="width: 48px;"
@@ -85,56 +85,56 @@  discard block
 block discarded – undo
85 85
 											value="%s"
86 86
 											min="1"
87 87
 											%s>',
88
-											(float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(),
89
-											null !== $max_qty ? 'max="' . (float) $max_qty . '"' : ''
90
-									)
91
-								)
92
-							);
93
-						} else {
94
-							printf(
95
-								'<small class="d-sm-none text-muted form-text">%s</small>',
96
-								sprintf(
97
-									__( 'Qty %s', 'invoicing' ),
98
-									(float) $item->get_quantity()
99
-								)
100
-							);
101
-						}
102
-
103
-					}
104
-
105
-					// Item price.
106
-					if ( 'price' == $key ) {
107
-
108
-						// Set the currency position.
109
-						$position = wpinv_currency_position();
110
-
111
-						if ( $position == 'left_space' ) {
112
-							$position = 'left';
113
-						}
114
-
115
-						if ( $position == 'right_space' ) {
116
-							$position = 'right';
117
-						}
118
-
119
-						if ( $item->user_can_set_their_price() ) {
120
-							$price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
121
-							$minimum          = (float) $item->get_minimum_price();
122
-							$validate_minimum = '';
123
-							$class            = '';
124
-							$data_minimum     = '';
125
-
126
-							if ( $minimum > 0 ) {
127
-								$validate_minimum = sprintf(
128
-									esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
129
-									strip_tags( wpinv_price( $minimum, $currency ) )
130
-								);
131
-
132
-								$class = 'getpaid-validate-minimum-amount';
133
-
134
-								$data_minimum     = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'";
135
-							}
136
-
137
-							?>
88
+                                            (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(),
89
+                                            null !== $max_qty ? 'max="' . (float) $max_qty . '"' : ''
90
+                                    )
91
+                                )
92
+                            );
93
+                        } else {
94
+                            printf(
95
+                                '<small class="d-sm-none text-muted form-text">%s</small>',
96
+                                sprintf(
97
+                                    __( 'Qty %s', 'invoicing' ),
98
+                                    (float) $item->get_quantity()
99
+                                )
100
+                            );
101
+                        }
102
+
103
+                    }
104
+
105
+                    // Item price.
106
+                    if ( 'price' == $key ) {
107
+
108
+                        // Set the currency position.
109
+                        $position = wpinv_currency_position();
110
+
111
+                        if ( $position == 'left_space' ) {
112
+                            $position = 'left';
113
+                        }
114
+
115
+                        if ( $position == 'right_space' ) {
116
+                            $position = 'right';
117
+                        }
118
+
119
+                        if ( $item->user_can_set_their_price() ) {
120
+                            $price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
121
+                            $minimum          = (float) $item->get_minimum_price();
122
+                            $validate_minimum = '';
123
+                            $class            = '';
124
+                            $data_minimum     = '';
125
+
126
+                            if ( $minimum > 0 ) {
127
+                                $validate_minimum = sprintf(
128
+                                    esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
129
+                                    strip_tags( wpinv_price( $minimum, $currency ) )
130
+                                );
131
+
132
+                                $class = 'getpaid-validate-minimum-amount';
133
+
134
+                                $data_minimum     = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'";
135
+                            }
136
+
137
+                            ?>
138 138
 								<div class="input-group input-group-sm">
139 139
 									<?php if( 'left' == $position ) : ?>
140 140
 										<div class="input-group-prepend">
@@ -159,44 +159,44 @@  discard block
 block discarded – undo
159 159
 
160 160
 							<?php
161 161
 
162
-						} else {
163
-							echo wpinv_price( $item->get_price(), $currency );
162
+                        } else {
163
+                            echo wpinv_price( $item->get_price(), $currency );
164 164
 
165
-							?>
165
+                            ?>
166 166
 								<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() ); ?>'>
167 167
 							<?php
168
-						}
168
+                        }
169 169
 
170
-						printf(
171
-							'<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>',
172
-							sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) )
173
-						);
174
-					}
170
+                        printf(
171
+                            '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>',
172
+                            sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) )
173
+                        );
174
+                    }
175 175
 
176
-					// Item quantity.
177
-					if ( 'quantity' == $key ) {
176
+                    // Item quantity.
177
+                    if ( 'quantity' == $key ) {
178 178
 
179
-						if ( $item->allows_quantities() ) {
180
-							?>
179
+                        if ( $item->allows_quantities() ) {
180
+                            ?>
181 181
 								<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>
182 182
 							<?php
183
-						} else {
184
-							echo (float) $item->get_quantity();
185
-							echo '&nbsp;&nbsp;&nbsp;';
186
-							?>
183
+                        } else {
184
+                            echo (float) $item->get_quantity();
185
+                            echo '&nbsp;&nbsp;&nbsp;';
186
+                            ?>
187 187
 								<input type='hidden' name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' class='getpaid-item-quantity-input' value='<?php echo (float) $item->get_quantity(); ?>'>
188 188
 							<?php
189
-						}
189
+                        }
190 190
 
191
-					}
191
+                    }
192 192
 
193
-					// Item sub total.
194
-					if ( 'subtotal' == $key ) {
195
-						echo wpinv_price( $item->get_sub_total(), $currency );
196
-					}
193
+                    // Item sub total.
194
+                    if ( 'subtotal' == $key ) {
195
+                        echo wpinv_price( $item->get_sub_total(), $currency );
196
+                    }
197 197
 
198
-					do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
199
-				?>
198
+                    do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
199
+                ?>
200 200
 
201 201
 			</div>
202 202
 
Please login to merge, or discard this patch.