Passed
Push — master ( b67e15...0b271c )
by Brian
05:07
created
templates/payment-forms/cart-item.php 1 patch
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -26,71 +26,71 @@  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 35
 
36
-						ob_start();
36
+                        ob_start();
37 37
 
38
-						// Add an optional description.
39
-						$description = $item->get_description();
38
+                        // Add an optional description.
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>';
43
-						}
41
+                        if ( ! empty( $description ) ) {
42
+                            echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>';
43
+                        }
44 44
 
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>';
49
-						}
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>';
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
-							edit_post_link(
56
-								__( 'Edit this item.', 'invoicing' ),
57
-								'<small class="form-text text-muted">',
58
-								'</small>',
59
-								$item->get_id(),
60
-								'text-danger'
61
-							);
55
+                            edit_post_link(
56
+                                __( 'Edit this item.', 'invoicing' ),
57
+                                '<small class="form-text text-muted">',
58
+                                '</small>',
59
+                                $item->get_id(),
60
+                                'text-danger'
61
+                            );
62 62
 
63
-						}
63
+                        }
64 64
 
65
-						$description = ob_get_clean();
65
+                        $description = ob_get_clean();
66 66
 
67
-						// Display the name.
68
-						$tootip = empty( $description ) ? '' : '&nbsp;<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>';
67
+                        // Display the name.
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 ) {
73
-							echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">';
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' ) );
76
-							echo '</div>';
77
-							echo '<div class="getpaid-form-item-name-container">';
78
-						}
72
+                        if ( $has_featured_image ) {
73
+                            echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">';
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' ) );
76
+                            echo '</div>';
77
+                            echo '<div class="getpaid-form-item-name-container">';
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 ) );
84
-						}
82
+                        if ( ! empty( $description ) ) {
83
+                            printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post( $description ) );
84
+                        }
85 85
 
86
-						if ( $item->allows_quantities() ) {
87
-							printf(
88
-								'<small class="d-sm-none text-muted form-text">%s</small>',
89
-								sprintf(
90
-									// translators: %s is the item quantity.
91
-									esc_html__( 'Qty %s', 'invoicing' ),
92
-									sprintf(
93
-										'<input
86
+                        if ( $item->allows_quantities() ) {
87
+                            printf(
88
+                                '<small class="d-sm-none text-muted form-text">%s</small>',
89
+                                sprintf(
90
+                                    // translators: %s is the item quantity.
91
+                                    esc_html__( 'Qty %s', 'invoicing' ),
92
+                                    sprintf(
93
+                                        '<input
94 94
 												type="number"
95 95
 												step="0.01"
96 96
 												style="width: 48px;"
@@ -99,62 +99,62 @@  discard block
 block discarded – undo
99 99
 												min="1"
100 100
 												max="%s"
101 101
 												>',
102
-										(float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(),
103
-										floatval( null !== $max_qty ? $max_qty : 1000000000000 )
104
-									)
105
-								)
106
-							);
107
-						} else {
108
-							printf(
109
-								'<small class="d-sm-none text-muted form-text">%s</small>',
110
-								sprintf(
111
-									// translators: %s is the item quantity.
112
-									esc_html__( 'Qty %s', 'invoicing' ),
113
-									(float) $item->get_quantity()
114
-								)
115
-							);
116
-						}
117
-
118
-						if ( $has_featured_image ) {
119
-							echo '</div>';
120
-							echo '</div>';
121
-						}
122
-					}
123
-
124
-					// Item price.
125
-					if ( 'price' === $key ) {
126
-
127
-					// Set the currency position.
128
-					$position = wpinv_currency_position();
129
-
130
-					if ( 'left_space' === $position ) {
131
-						$position = 'left';
132
-					}
133
-
134
-					if ( 'right_space' === $position ) {
135
-						$position = 'right';
136
-					}
137
-
138
-					if ( $item->user_can_set_their_price() ) {
139
-						$price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
140
-						$minimum          = (float) $item->get_minimum_price();
141
-						$validate_minimum = '';
142
-						$class            = '';
143
-						$data_minimum     = '';
144
-
145
-						if ( $minimum > 0 ) {
146
-							$validate_minimum = sprintf(
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 ) )
150
-							);
151
-
152
-							$class = 'getpaid-validate-minimum-amount';
153
-
154
-							$data_minimum     = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'";
155
-						}
156
-
157
-						?>
102
+                                        (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(),
103
+                                        floatval( null !== $max_qty ? $max_qty : 1000000000000 )
104
+                                    )
105
+                                )
106
+                            );
107
+                        } else {
108
+                            printf(
109
+                                '<small class="d-sm-none text-muted form-text">%s</small>',
110
+                                sprintf(
111
+                                    // translators: %s is the item quantity.
112
+                                    esc_html__( 'Qty %s', 'invoicing' ),
113
+                                    (float) $item->get_quantity()
114
+                                )
115
+                            );
116
+                        }
117
+
118
+                        if ( $has_featured_image ) {
119
+                            echo '</div>';
120
+                            echo '</div>';
121
+                        }
122
+                    }
123
+
124
+                    // Item price.
125
+                    if ( 'price' === $key ) {
126
+
127
+                    // Set the currency position.
128
+                    $position = wpinv_currency_position();
129
+
130
+                    if ( 'left_space' === $position ) {
131
+                        $position = 'left';
132
+                    }
133
+
134
+                    if ( 'right_space' === $position ) {
135
+                        $position = 'right';
136
+                    }
137
+
138
+                    if ( $item->user_can_set_their_price() ) {
139
+                        $price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
140
+                        $minimum          = (float) $item->get_minimum_price();
141
+                        $validate_minimum = '';
142
+                        $class            = '';
143
+                        $data_minimum     = '';
144
+
145
+                        if ( $minimum > 0 ) {
146
+                            $validate_minimum = sprintf(
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 ) )
150
+                            );
151
+
152
+                            $class = 'getpaid-validate-minimum-amount';
153
+
154
+                            $data_minimum     = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'";
155
+                        }
156
+
157
+                        ?>
158 158
 								<div class="input-group input-group-sm">
159 159
 								<?php if ( 'left' === $position ) : ?>
160 160
 										<div class="input-group-prepend">
@@ -179,44 +179,44 @@  discard block
 block discarded – undo
179 179
 
180 180
 							<?php
181 181
 
182
-						} else {
183
-						echo wp_kses_post( wpinv_price( $item->get_price(), $currency ) );
182
+                        } else {
183
+                        echo wp_kses_post( wpinv_price( $item->get_price(), $currency ) );
184 184
 
185
-						?>
185
+                        ?>
186 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
-					printf(
190
+                    printf(
191 191
                         '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>',
192
-						// translators: %s is the item subtotal.
192
+                        // translators: %s is the item subtotal.
193 193
                         sprintf( esc_html__( 'Subtotal: %s', 'invoicing' ), wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ) )
194 194
                     );
195
-					}
195
+                    }
196 196
 
197
-					// Item quantity.
198
-					if ( 'quantity' === $key ) {
197
+                    // Item quantity.
198
+                    if ( 'quantity' === $key ) {
199 199
 
200
-					if ( $item->allows_quantities() ) {
201
-						?>
200
+                    if ( $item->allows_quantities() ) {
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
204
-						} else {
205
-						echo (float) $item->get_quantity();
206
-						echo '&nbsp;&nbsp;&nbsp;';
207
-						?>
204
+                        } else {
205
+                        echo (float) $item->get_quantity();
206
+                        echo '&nbsp;&nbsp;&nbsp;';
207
+                        ?>
208 208
 								<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(); ?>'>
209 209
 						<?php
210
-						}
210
+                        }
211 211
 }
212 212
 
213
-					// Item sub total.
214
-					if ( 'subtotal' === $key ) {
215
-					echo wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) );
216
-					}
213
+                    // Item sub total.
214
+                    if ( 'subtotal' === $key ) {
215
+                    echo wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) );
216
+                    }
217 217
 
218
-					do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
219
-				?>
218
+                    do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
219
+                ?>
220 220
 
221 221
 			</div>
222 222
 
Please login to merge, or discard this patch.
templates/invoice/line-item.php 1 patch
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -26,90 +26,90 @@
 block discarded – undo
26 26
 
27 27
 				<?php
28 28
 
29
-					// Fires before printing a line item column.
30
-					do_action( "getpaid_invoice_line_item_before_$column", $item, $invoice );
29
+                    // Fires before printing a line item column.
30
+                    do_action( "getpaid_invoice_line_item_before_$column", $item, $invoice );
31 31
 
32
-					// Item name.
33
-					if ( 'name' === $column ) {
32
+                    // Item name.
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 ) {
38
-							echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">';
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' ) );
41
-							echo '</div>';
42
-							echo '<div class="getpaid-form-item-name-container">';
43
-						}
37
+                        if ( $has_featured_image ) {
38
+                            echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">';
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' ) );
41
+                            echo '</div>';
42
+                            echo '<div class="getpaid-form-item-name-container">';
43
+                        }
44 44
 
45
-						// Display the name.
46
-						echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>';
45
+                        // Display the name.
46
+                        echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>';
47 47
 
48
-						// And an optional description.
49
-						$description = $item->get_description();
48
+                        // And an optional description.
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>';
53
-						}
51
+                        if ( ! empty( $description ) ) {
52
+                            echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>';
53
+                        }
54 54
 
55
-						// Fires before printing the line item actions.
56
-						do_action( 'getpaid_before_invoice_line_item_actions', $item, $invoice );
55
+                        // Fires before printing the line item actions.
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 );
66
-								$sanitized[] = "<span class='$key'>$item_action</span>";
67
-							}
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
+                                $sanitized[] = "<span class='$key'>$item_action</span>";
67
+                            }
68 68
 
69
-							echo "<small class='form-text getpaid-line-item-actions'>";
70
-							echo wp_kses_post( implode( ' | ', $sanitized ) );
71
-							echo '</small>';
69
+                            echo "<small class='form-text getpaid-line-item-actions'>";
70
+                            echo wp_kses_post( implode( ' | ', $sanitized ) );
71
+                            echo '</small>';
72 72
 
73
-						}
73
+                        }
74 74
 
75
-						if ( $has_featured_image ) {
76
-							echo '</div>';
77
-							echo '</div>';
78
-						}
79
-					}
75
+                        if ( $has_featured_image ) {
76
+                            echo '</div>';
77
+                            echo '</div>';
78
+                        }
79
+                    }
80 80
 
81
-					// Item price.
82
-					if ( 'price' === $column ) {
81
+                    // Item price.
82
+                    if ( 'price' === $column ) {
83 83
 
84
-					// Display the item price (or recurring price if this is a renewal invoice)
85
-					$price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price();
86
-					wpinv_the_price( $price, $invoice->get_currency() );
84
+                    // Display the item price (or recurring price if this is a renewal invoice)
85
+                    $price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price();
86
+                    wpinv_the_price( $price, $invoice->get_currency() );
87 87
 
88
-					}
88
+                    }
89 89
 
90
-					// Tax rate.
91
-					if ( 'tax_rate' === $column ) {
92
-					echo floatval( round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%';
93
-					}
90
+                    // Tax rate.
91
+                    if ( 'tax_rate' === $column ) {
92
+                    echo floatval( round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%';
93
+                    }
94 94
 
95
-					// Item quantity.
96
-					if ( 'quantity' === $column ) {
97
-					echo (float) $item->get_quantity();
98
-					}
95
+                    // Item quantity.
96
+                    if ( 'quantity' === $column ) {
97
+                    echo (float) $item->get_quantity();
98
+                    }
99 99
 
100
-					// Item sub total.
101
-					if ( 'subtotal' === $column ) {
102
-					$subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total();
103
-					wpinv_the_price( $subtotal, $invoice->get_currency() );
104
-					}
100
+                    // Item sub total.
101
+                    if ( 'subtotal' === $column ) {
102
+                    $subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total();
103
+                    wpinv_the_price( $subtotal, $invoice->get_currency() );
104
+                    }
105 105
 
106
-					// Fires when printing a line item column.
107
-					do_action( "getpaid_invoice_line_item_$column", $item, $invoice );
106
+                    // Fires when printing a line item column.
107
+                    do_action( "getpaid_invoice_line_item_$column", $item, $invoice );
108 108
 
109
-					// Fires after printing a line item column.
110
-					do_action( "getpaid_invoice_line_item_after_$column", $item, $invoice );
109
+                    // Fires after printing a line item column.
110
+                    do_action( "getpaid_invoice_line_item_after_$column", $item, $invoice );
111 111
 
112
-				?>
112
+                ?>
113 113
 
114 114
 			</div>
115 115
 
Please login to merge, or discard this patch.