Passed
Push — master ( 4d2757...52c7bd )
by Brian
05:21
created
templates/payment-forms/cart-item.php 2 patches
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -26,112 +26,112 @@  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="text"
82 82
 											style="width: 48px;"
83 83
 											class="getpaid-item-mobile-quantity-input p-1 m-0 text-center"
84 84
 											value="%s"
85 85
 											min="1">',
86
-											(float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity()
87
-									)
88
-								)
89
-							);
90
-						} else {
91
-							printf(
92
-								'<small class="d-sm-none text-muted form-text">%s</small>',
93
-								sprintf(
94
-									__( 'Qty %s', 'invoicing' ),
95
-									(float) $item->get_quantity()
96
-								)
97
-							);
98
-						}
99
-
100
-					}
101
-
102
-					// Item price.
103
-					if ( 'price' == $key ) {
104
-
105
-						// Set the currency position.
106
-						$position = wpinv_currency_position();
107
-
108
-						if ( $position == 'left_space' ) {
109
-							$position = 'left';
110
-						}
111
-
112
-						if ( $position == 'right_space' ) {
113
-							$position = 'right';
114
-						}
115
-
116
-						if ( $item->user_can_set_their_price() ) {
117
-							$price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
118
-							$minimum          = (float) $item->get_minimum_price();
119
-							$validate_minimum = '';
120
-							$class            = '';
121
-							$data_minimum     = '';
122
-
123
-							if ( $minimum > 0 ) {
124
-								$validate_minimum = sprintf(
125
-									esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
126
-									strip_tags( wpinv_price( $minimum, $currency ) )
127
-								);
128
-
129
-								$class = 'getpaid-validate-minimum-amount';
130
-
131
-								$data_minimum     = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'";
132
-							}
133
-
134
-							?>
86
+                                            (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity()
87
+                                    )
88
+                                )
89
+                            );
90
+                        } else {
91
+                            printf(
92
+                                '<small class="d-sm-none text-muted form-text">%s</small>',
93
+                                sprintf(
94
+                                    __( 'Qty %s', 'invoicing' ),
95
+                                    (float) $item->get_quantity()
96
+                                )
97
+                            );
98
+                        }
99
+
100
+                    }
101
+
102
+                    // Item price.
103
+                    if ( 'price' == $key ) {
104
+
105
+                        // Set the currency position.
106
+                        $position = wpinv_currency_position();
107
+
108
+                        if ( $position == 'left_space' ) {
109
+                            $position = 'left';
110
+                        }
111
+
112
+                        if ( $position == 'right_space' ) {
113
+                            $position = 'right';
114
+                        }
115
+
116
+                        if ( $item->user_can_set_their_price() ) {
117
+                            $price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
118
+                            $minimum          = (float) $item->get_minimum_price();
119
+                            $validate_minimum = '';
120
+                            $class            = '';
121
+                            $data_minimum     = '';
122
+
123
+                            if ( $minimum > 0 ) {
124
+                                $validate_minimum = sprintf(
125
+                                    esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
126
+                                    strip_tags( wpinv_price( $minimum, $currency ) )
127
+                                );
128
+
129
+                                $class = 'getpaid-validate-minimum-amount';
130
+
131
+                                $data_minimum     = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'";
132
+                            }
133
+
134
+                            ?>
135 135
 								<div class="input-group input-group-sm">
136 136
 									<?php if( 'left' == $position ) : ?>
137 137
 										<div class="input-group-prepend">
@@ -156,44 +156,44 @@  discard block
 block discarded – undo
156 156
 
157 157
 							<?php
158 158
 
159
-						} else {
160
-							echo wpinv_price( $item->get_price(), $currency );
159
+                        } else {
160
+                            echo wpinv_price( $item->get_price(), $currency );
161 161
 
162
-							?>
162
+                            ?>
163 163
 								<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() ); ?>'>
164 164
 							<?php
165
-						}
165
+                        }
166 166
 
167
-						printf(
168
-							'<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>',
169
-							sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) )
170
-						);
171
-					}
167
+                        printf(
168
+                            '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>',
169
+                            sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) )
170
+                        );
171
+                    }
172 172
 
173
-					// Item quantity.
174
-					if ( 'quantity' == $key ) {
173
+                    // Item quantity.
174
+                    if ( 'quantity' == $key ) {
175 175
 
176
-						if ( $item->allows_quantities() ) {
177
-							?>
176
+                        if ( $item->allows_quantities() ) {
177
+                            ?>
178 178
 								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type='text' 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' required>
179 179
 							<?php
180
-						} else {
181
-							echo (float) $item->get_quantity();
182
-							echo '&nbsp;&nbsp;&nbsp;';
183
-							?>
180
+                        } else {
181
+                            echo (float) $item->get_quantity();
182
+                            echo '&nbsp;&nbsp;&nbsp;';
183
+                            ?>
184 184
 								<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(); ?>'>
185 185
 							<?php
186
-						}
186
+                        }
187 187
 
188
-					}
188
+                    }
189 189
 
190
-					// Item sub total.
191
-					if ( 'subtotal' == $key ) {
192
-						echo wpinv_price( $item->get_sub_total(), $currency );
193
-					}
190
+                    // Item sub total.
191
+                    if ( 'subtotal' == $key ) {
192
+                        echo wpinv_price( $item->get_sub_total(), $currency );
193
+                    }
194 194
 
195
-					do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
196
-				?>
195
+                    do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
196
+                ?>
197 197
 
198 198
 			</div>
199 199
 
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -9,50 +9,50 @@  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 17
 
18 18
 ?>
19
-<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required'  : 'selectable'; ?> item-<?php echo $item->get_id(); ?> border-bottom py-2 px-3'>
19
+<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo $item->get_id(); ?> border-bottom py-2 px-3'>
20 20
 
21 21
 	<div class="form-row 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-8 col-sm-6' : 'col' ?> <?php echo ( in_array( $key, array( 'subtotal', 'quantity', 'tax_rate' ) ) ) ? 'd-none d-sm-block' : '' ?> position-relative getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?> getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?>-<?php echo $item->get_id(); ?>">
25
+			<div class="<?php echo 'name' == $key ? 'col-8 col-sm-6' : 'col' ?> <?php echo (in_array($key, array('subtotal', 'quantity', 'tax_rate'))) ? 'd-none d-sm-block' : '' ?> position-relative getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?> getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?>-<?php echo $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
 						ob_start();
36 36
 						// And an optional description.
37 37
                         $description = $item->get_description();
38 38
 
39
-                        if ( ! empty( $description ) ) {
40
-                            $description = wp_kses_post( $description );
39
+                        if (!empty($description)) {
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 44
 						// Price help text.
45
-                        $description = getpaid_item_recurring_price_help_text( $item, $currency );
46
-                        if ( $description ) {
45
+                        $description = getpaid_item_recurring_price_help_text($item, $currency);
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 54
 							edit_post_link(
55
-								__( 'Edit this item.', 'invoicing' ),
55
+								__('Edit this item.', 'invoicing'),
56 56
 								'<small class="form-text text-muted">',
57 57
 								'</small>',
58 58
 								$item->get_id(),
@@ -64,18 +64,18 @@  discard block
 block discarded – undo
64 64
 						$description = ob_get_clean();
65 65
 
66 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>';
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 );
70
+						if (!empty($description)) {
71
+							printf('<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description);
72 72
 						}
73 73
 
74
-						if ( $item->allows_quantities() ) {
74
+						if ($item->allows_quantities()) {
75 75
 							printf(
76 76
 								'<small class="d-sm-none text-muted form-text">%s</small>',
77 77
 								sprintf(
78
-									__( 'Qty %s', 'invoicing' ),
78
+									__('Qty %s', 'invoicing'),
79 79
 									sprintf(
80 80
 										'<input
81 81
 											type="text"
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 							printf(
92 92
 								'<small class="d-sm-none text-muted form-text">%s</small>',
93 93
 								sprintf(
94
-									__( 'Qty %s', 'invoicing' ),
94
+									__('Qty %s', 'invoicing'),
95 95
 									(float) $item->get_quantity()
96 96
 								)
97 97
 							);
@@ -100,56 +100,56 @@  discard block
 block discarded – undo
100 100
 					}
101 101
 
102 102
 					// Item price.
103
-					if ( 'price' == $key ) {
103
+					if ('price' == $key) {
104 104
 
105 105
 						// Set the currency position.
106 106
 						$position = wpinv_currency_position();
107 107
 
108
-						if ( $position == 'left_space' ) {
108
+						if ($position == 'left_space') {
109 109
 							$position = 'left';
110 110
 						}
111 111
 
112
-						if ( $position == 'right_space' ) {
112
+						if ($position == 'right_space') {
113 113
 							$position = 'right';
114 114
 						}
115 115
 
116
-						if ( $item->user_can_set_their_price() ) {
117
-							$price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
116
+						if ($item->user_can_set_their_price()) {
117
+							$price            = max((float) $item->get_price(), (float) $item->get_minimum_price());
118 118
 							$minimum          = (float) $item->get_minimum_price();
119 119
 							$validate_minimum = '';
120 120
 							$class            = '';
121 121
 							$data_minimum     = '';
122 122
 
123
-							if ( $minimum > 0 ) {
123
+							if ($minimum > 0) {
124 124
 								$validate_minimum = sprintf(
125
-									esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
126
-									strip_tags( wpinv_price( $minimum, $currency ) )
125
+									esc_attr__('The minimum allowed amount is %s', 'invoicing'),
126
+									strip_tags(wpinv_price($minimum, $currency))
127 127
 								);
128 128
 
129 129
 								$class = 'getpaid-validate-minimum-amount';
130 130
 
131
-								$data_minimum     = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'";
131
+								$data_minimum = "data-minimum-amount='" . esc_attr(getpaid_unstandardize_amount($minimum)) . "'";
132 132
 							}
133 133
 
134 134
 							?>
135 135
 								<div class="input-group input-group-sm">
136
-									<?php if( 'left' == $position ) : ?>
136
+									<?php if ('left' == $position) : ?>
137 137
 										<div class="input-group-prepend">
138
-											<span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span>
138
+											<span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span>
139 139
 										</div>
140 140
 									<?php endif; ?>
141 141
 
142
-									<input type="text" <?php echo $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 $class; ?>" style="width: 64px; line-height: 1; min-height: 35px;">
142
+									<input type="text" <?php echo $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 $class; ?>" style="width: 64px; line-height: 1; min-height: 35px;">
143 143
 
144
-									<?php if ( ! empty( $validate_minimum ) ) : ?>
144
+									<?php if (!empty($validate_minimum)) : ?>
145 145
 										<div class="invalid-tooltip">
146 146
 											<?php echo $validate_minimum; ?>
147 147
 										</div>
148 148
 									<?php endif; ?>
149 149
 
150
-									<?php if( 'left' != $position ) : ?>
150
+									<?php if ('left' != $position) : ?>
151 151
 										<div class="input-group-append">
152
-											<span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span>
152
+											<span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span>
153 153
 										</div>
154 154
 									<?php endif; ?>
155 155
 								</div>
@@ -157,23 +157,23 @@  discard block
 block discarded – undo
157 157
 							<?php
158 158
 
159 159
 						} else {
160
-							echo wpinv_price( $item->get_price(), $currency );
160
+							echo wpinv_price($item->get_price(), $currency);
161 161
 
162 162
 							?>
163
-								<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() ); ?>'>
163
+								<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()); ?>'>
164 164
 							<?php
165 165
 						}
166 166
 
167 167
 						printf(
168 168
 							'<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>',
169
-							sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) )
169
+							sprintf(__('Subtotal: %s', 'invoicing'), wpinv_price($item->get_sub_total(), $currency))
170 170
 						);
171 171
 					}
172 172
 
173 173
 					// Item quantity.
174
-					if ( 'quantity' == $key ) {
174
+					if ('quantity' == $key) {
175 175
 
176
-						if ( $item->allows_quantities() ) {
176
+						if ($item->allows_quantities()) {
177 177
 							?>
178 178
 								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type='text' 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' required>
179 179
 							<?php
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
 					}
189 189
 
190 190
 					// Item sub total.
191
-					if ( 'subtotal' == $key ) {
192
-						echo wpinv_price( $item->get_sub_total(), $currency );
191
+					if ('subtotal' == $key) {
192
+						echo wpinv_price($item->get_sub_total(), $currency);
193 193
 					}
194 194
 
195
-					do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
195
+					do_action("getpaid_payment_form_cart_item_$key", $item, $form);
196 196
 				?>
197 197
 
198 198
 			</div>
@@ -203,4 +203,4 @@  discard block
 block discarded – undo
203 203
 
204 204
 </div>
205 205
 <?php
206
-do_action(  'getpaid_payment_form_cart_item', $form, $item );
206
+do_action('getpaid_payment_form_cart_item', $form, $item);
Please login to merge, or discard this patch.