Passed
Push — master ( d98642...b1c520 )
by Brian
05:06
created
includes/admin/meta-boxes/class-getpaid-meta-box-discount-details.php 2 patches
Spacing   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  *
8 8
  */
9 9
 
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if (!defined('ABSPATH')) {
11 11
 	exit; // Exit if accessed directly
12 12
 }
13 13
 
@@ -21,24 +21,24 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @param WP_Post $post
23 23
 	 */
24
-    public static function output( $post ) {
24
+    public static function output($post) {
25 25
 
26 26
         // Prepare the discount.
27
-        $discount = new WPInv_Discount( $post );
27
+        $discount = new WPInv_Discount($post);
28 28
 
29 29
         // Nonce field.
30
-        wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' );
30
+        wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce');
31 31
 
32
-        do_action( 'wpinv_discount_form_top', $discount );
32
+        do_action('wpinv_discount_form_top', $discount);
33 33
 
34 34
         // Set the currency position.
35 35
         $position = wpinv_currency_position();
36 36
 
37
-        if ( $position == 'left_space' ) {
37
+        if ($position == 'left_space') {
38 38
             $position = 'left';
39 39
         }
40 40
 
41
-        if ( $position == 'right_space' ) {
41
+        if ($position == 'right_space') {
42 42
             $position = 'right';
43 43
         }
44 44
 
@@ -52,69 +52,69 @@  discard block
 block discarded – undo
52 52
         </style>
53 53
         <div class='bsui' style='max-width: 600px;padding-top: 10px;'>
54 54
 
55
-            <?php do_action( 'wpinv_discount_form_first', $discount ); ?>
55
+            <?php do_action('wpinv_discount_form_first', $discount); ?>
56 56
 
57
-            <?php do_action( 'wpinv_discount_form_before_code', $discount ); ?>
57
+            <?php do_action('wpinv_discount_form_before_code', $discount); ?>
58 58
 
59 59
             <div class="form-group mb-3 row">
60 60
                 <label for="wpinv_discount_code" class="col-sm-3 col-form-label">
61
-                    <?php esc_html_e( 'Discount Code', 'invoicing' ); ?>
61
+                    <?php esc_html_e('Discount Code', 'invoicing'); ?>
62 62
                 </label>
63 63
                 <div class="col-sm-8">
64 64
                     <div class="row">
65 65
                         <div class="col-sm-12 form-group mb-3">
66
-                            <input type="text" value="<?php echo esc_attr( $discount->get_code( 'edit' ) ); ?>" placeholder="SUMMER_SALE" name="wpinv_discount_code" id="wpinv_discount_code" style="width: 100%;" />
66
+                            <input type="text" value="<?php echo esc_attr($discount->get_code('edit')); ?>" placeholder="SUMMER_SALE" name="wpinv_discount_code" id="wpinv_discount_code" style="width: 100%;" />
67 67
                         </div>
68 68
                         <div class="col-sm-12">
69 69
                             <?php
70
-                                do_action( 'wpinv_discount_form_before_single_use', $discount );
70
+                                do_action('wpinv_discount_form_before_single_use', $discount);
71 71
 
72 72
                                 aui()->input(
73 73
                                     array(
74 74
                                         'id'      => 'wpinv_discount_single_use',
75 75
                                         'name'    => 'wpinv_discount_single_use',
76 76
                                         'type'    => 'checkbox',
77
-                                        'label'   => __( 'Each customer can only use this discount once', 'invoicing' ),
77
+                                        'label'   => __('Each customer can only use this discount once', 'invoicing'),
78 78
                                         'value'   => '1',
79 79
                                         'checked' => $discount->is_single_use(),
80 80
                                     ),
81 81
                                     true
82 82
                                 );
83 83
 
84
-                                do_action( 'wpinv_discount_form_single_use', $discount );
84
+                                do_action('wpinv_discount_form_single_use', $discount);
85 85
                             ?>
86 86
                         </div>
87 87
                         <div class="col-sm-12">
88 88
                             <?php
89
-                                do_action( 'wpinv_discount_form_before_recurring', $discount );
89
+                                do_action('wpinv_discount_form_before_recurring', $discount);
90 90
 
91 91
                                 aui()->input(
92 92
                                     array(
93 93
                                         'id'      => 'wpinv_discount_recurring',
94 94
                                         'name'    => 'wpinv_discount_recurring',
95 95
                                         'type'    => 'checkbox',
96
-                                        'label'   => __( 'Apply this discount to all recurring payments for subscriptions', 'invoicing' ),
96
+                                        'label'   => __('Apply this discount to all recurring payments for subscriptions', 'invoicing'),
97 97
                                         'value'   => '1',
98 98
                                         'checked' => $discount->is_recurring(),
99 99
                                     ),
100 100
                                     true
101 101
                                 );
102 102
 
103
-                                do_action( 'wpinv_discount_form_recurring', $discount );
103
+                                do_action('wpinv_discount_form_recurring', $discount);
104 104
                             ?>
105 105
                         </div>
106 106
                     </div>
107 107
                 </div>
108 108
                 <div class="col-sm-1 pt-2 pl-0">
109
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter a discount code such as 10OFF.', 'invoicing' ); ?>"></span>
109
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter a discount code such as 10OFF.', 'invoicing'); ?>"></span>
110 110
                 </div>
111 111
             </div>
112
-            <?php do_action( 'wpinv_discount_form_code', $discount ); ?>
112
+            <?php do_action('wpinv_discount_form_code', $discount); ?>
113 113
 
114
-            <?php do_action( 'wpinv_discount_form_before_type', $discount ); ?>
114
+            <?php do_action('wpinv_discount_form_before_type', $discount); ?>
115 115
             <div class="form-group mb-3 row">
116 116
                 <label for="wpinv_discount_type" class="col-sm-3 col-form-label">
117
-                    <?php esc_html_e( 'Discount Type', 'invoicing' ); ?>
117
+                    <?php esc_html_e('Discount Type', 'invoicing'); ?>
118 118
                 </label>
119 119
                 <div class="col-sm-8">
120 120
                     <?php
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
                             array(
123 123
                                 'id'               => 'wpinv_discount_type',
124 124
                                 'name'             => 'wpinv_discount_type',
125
-                                'label'            => __( 'Discount Type', 'invoicing' ),
126
-                                'placeholder'      => __( 'Select Discount Type', 'invoicing' ),
127
-                                'value'            => $discount->get_type( 'edit' ),
125
+                                'label'            => __('Discount Type', 'invoicing'),
126
+                                'placeholder'      => __('Select Discount Type', 'invoicing'),
127
+                                'value'            => $discount->get_type('edit'),
128 128
                                 'select2'          => true,
129 129
                                 'data-allow-clear' => 'false',
130 130
                                 'options'          => wpinv_get_discount_types(),
@@ -134,49 +134,49 @@  discard block
 block discarded – undo
134 134
                     ?>
135 135
                 </div>
136 136
                 <div class="col-sm-1 pt-2 pl-0">
137
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Discount type.', 'invoicing' ); ?>"></span>
137
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Discount type.', 'invoicing'); ?>"></span>
138 138
                 </div>
139 139
             </div>
140
-            <?php do_action( 'wpinv_discount_form_type', $discount ); ?>
140
+            <?php do_action('wpinv_discount_form_type', $discount); ?>
141 141
 
142
-            <?php do_action( 'wpinv_discount_form_before_amount', $discount ); ?>
143
-            <div class="form-group mb-3 row <?php echo esc_attr( $discount->get_type( 'edit' ) ); ?>" id="wpinv_discount_amount_wrap">
142
+            <?php do_action('wpinv_discount_form_before_amount', $discount); ?>
143
+            <div class="form-group mb-3 row <?php echo esc_attr($discount->get_type('edit')); ?>" id="wpinv_discount_amount_wrap">
144 144
                 <label for="wpinv_discount_amount" class="col-sm-3 col-form-label">
145
-                    <?php esc_html_e( 'Discount Amount', 'invoicing' ); ?>
145
+                    <?php esc_html_e('Discount Amount', 'invoicing'); ?>
146 146
                 </label>
147 147
                 <div class="col-sm-8">
148 148
                     <div class="input-group input-group-sm">
149 149
 
150
-                        <?php if ( 'left' == $position ) : ?>
151
-                            <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?>
150
+                        <?php if ('left' == $position) : ?>
151
+                            <?php if (empty($GLOBALS['aui_bs5'])) : ?>
152 152
                                 <div class="input-group-prepend left wpinv-if-flat">
153 153
                                     <span class="input-group-text">
154
-                                        <?php echo wp_kses_post( wpinv_currency_symbol() ); ?>
154
+                                        <?php echo wp_kses_post(wpinv_currency_symbol()); ?>
155 155
                                     </span>
156 156
                                 </div>
157 157
                             <?php else : ?>
158 158
                                 <span class="input-group-text left wpinv-if-flat">
159
-                                    <?php echo wp_kses_post( wpinv_currency_symbol() ); ?>
159
+                                    <?php echo wp_kses_post(wpinv_currency_symbol()); ?>
160 160
                                 </span>
161 161
                             <?php endif; ?>
162 162
                         <?php endif; ?>
163 163
 
164
-                        <input type="text" name="wpinv_discount_amount" id="wpinv_discount_amount" value="<?php echo esc_attr( $discount->get_amount( 'edit' ) ); ?>" placeholder="0" class="form-control">
164
+                        <input type="text" name="wpinv_discount_amount" id="wpinv_discount_amount" value="<?php echo esc_attr($discount->get_amount('edit')); ?>" placeholder="0" class="form-control">
165 165
 
166
-                        <?php if ( 'right' == $position ) : ?>
167
-                            <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?>
166
+                        <?php if ('right' == $position) : ?>
167
+                            <?php if (empty($GLOBALS['aui_bs5'])) : ?>
168 168
                                 <div class="input-group-append right wpinv-if-flat">
169 169
                                     <span class="input-group-text">
170
-                                        <?php echo wp_kses_post( wpinv_currency_symbol() ); ?>
170
+                                        <?php echo wp_kses_post(wpinv_currency_symbol()); ?>
171 171
                                     </span>
172 172
                                 </div>
173 173
                             <?php else : ?>
174 174
                                 <span class="input-group-text left wpinv-if-flat">
175
-                                    <?php echo wp_kses_post( wpinv_currency_symbol() ); ?>
175
+                                    <?php echo wp_kses_post(wpinv_currency_symbol()); ?>
176 176
                                 </span>
177 177
                             <?php endif; ?>
178 178
                         <?php endif; ?>
179
-                        <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?>
179
+                        <?php if (empty($GLOBALS['aui_bs5'])) : ?>
180 180
                             <div class="input-group-append right wpinv-if-percent">
181 181
                                 <span class="input-group-text">%</span>
182 182
                             </div>
@@ -186,15 +186,15 @@  discard block
 block discarded – undo
186 186
                     </div>
187 187
                 </div>
188 188
                 <div class="col-sm-1 pt-2 pl-0">
189
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter the discount value. Ex: 10', 'invoicing' ); ?>"></span>
189
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter the discount value. Ex: 10', 'invoicing'); ?>"></span>
190 190
                 </div>
191 191
             </div>
192
-            <?php do_action( 'wpinv_discount_form_amount', $discount ); ?>
192
+            <?php do_action('wpinv_discount_form_amount', $discount); ?>
193 193
 
194
-            <?php do_action( 'wpinv_discount_form_before_items', $discount ); ?>
194
+            <?php do_action('wpinv_discount_form_before_items', $discount); ?>
195 195
             <div class="form-group mb-3 row">
196 196
                 <label for="wpinv_discount_items" class="col-sm-3 col-form-label">
197
-                    <?php esc_html_e( 'Items', 'invoicing' ); ?>
197
+                    <?php esc_html_e('Items', 'invoicing'); ?>
198 198
                 </label>
199 199
                 <div class="col-sm-8">
200 200
                     <?php
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
                             array(
203 203
                                 'id'               => 'wpinv_discount_items',
204 204
                                 'name'             => 'wpinv_discount_items[]',
205
-                                'label'            => __( 'Items', 'invoicing' ),
206
-                                'placeholder'      => __( 'Select Items', 'invoicing' ),
207
-                                'value'            => $discount->get_items( 'edit' ),
205
+                                'label'            => __('Items', 'invoicing'),
206
+                                'placeholder'      => __('Select Items', 'invoicing'),
207
+                                'value'            => $discount->get_items('edit'),
208 208
                                 'select2'          => true,
209 209
                                 'multiple'         => true,
210 210
                                 'data-allow-clear' => 'false',
@@ -215,15 +215,15 @@  discard block
 block discarded – undo
215 215
                     ?>
216 216
                 </div>
217 217
                 <div class="col-sm-1 pt-2 pl-0">
218
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Select the items that are allowed to use this discount or leave blank to use this discount all items.', 'invoicing' ); ?>"></span>
218
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Select the items that are allowed to use this discount or leave blank to use this discount all items.', 'invoicing'); ?>"></span>
219 219
                 </div>
220 220
             </div>
221
-            <?php do_action( 'wpinv_discount_form_items', $discount ); ?>
221
+            <?php do_action('wpinv_discount_form_items', $discount); ?>
222 222
 
223
-            <?php do_action( 'wpinv_discount_form_before_excluded_items', $discount ); ?>
223
+            <?php do_action('wpinv_discount_form_before_excluded_items', $discount); ?>
224 224
             <div class="form-group mb-3 row">
225 225
                 <label for="wpinv_discount_excluded_items" class="col-sm-3 col-form-label">
226
-                    <?php esc_html_e( 'Excluded Items', 'invoicing' ); ?>
226
+                    <?php esc_html_e('Excluded Items', 'invoicing'); ?>
227 227
                 </label>
228 228
                 <div class="col-sm-8">
229 229
                     <?php
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
                             array(
232 232
                                 'id'               => 'wpinv_discount_excluded_items',
233 233
                                 'name'             => 'wpinv_discount_excluded_items[]',
234
-                                'label'            => __( 'Excluded Items', 'invoicing' ),
235
-                                'placeholder'      => __( 'Select Items', 'invoicing' ),
236
-                                'value'            => $discount->get_excluded_items( 'edit' ),
234
+                                'label'            => __('Excluded Items', 'invoicing'),
235
+                                'placeholder'      => __('Select Items', 'invoicing'),
236
+                                'value'            => $discount->get_excluded_items('edit'),
237 237
                                 'select2'          => true,
238 238
                                 'multiple'         => true,
239 239
                                 'data-allow-clear' => 'false',
@@ -244,15 +244,15 @@  discard block
 block discarded – undo
244 244
                     ?>
245 245
                 </div>
246 246
                 <div class="col-sm-1 pt-2 pl-0">
247
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Select all the items that are not allowed to use this discount.', 'invoicing' ); ?>"></span>
247
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Select all the items that are not allowed to use this discount.', 'invoicing'); ?>"></span>
248 248
                 </div>
249 249
             </div>
250
-            <?php do_action( 'wpinv_discount_form_excluded_items', $discount ); ?>
250
+            <?php do_action('wpinv_discount_form_excluded_items', $discount); ?>
251 251
 
252
-            <?php do_action( 'wpinv_discount_form_before_required_items', $discount ); ?>
252
+            <?php do_action('wpinv_discount_form_before_required_items', $discount); ?>
253 253
             <div class="form-group mb-3 row">
254 254
                 <label for="wpinv_discount_required_items" class="col-sm-3 col-form-label">
255
-                    <?php esc_html_e( 'Required Items', 'invoicing' ); ?>
255
+                    <?php esc_html_e('Required Items', 'invoicing'); ?>
256 256
                 </label>
257 257
                 <div class="col-sm-8">
258 258
                     <?php
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
                             array(
261 261
                                 'id'               => 'wpinv_discount_required_items',
262 262
                                 'name'             => 'wpinv_discount_required_items[]',
263
-                                'label'            => __( 'Required Items', 'invoicing' ),
264
-                                'placeholder'      => __( 'Select Items', 'invoicing' ),
265
-                                'value'            => $discount->get_required_items( 'edit' ),
263
+                                'label'            => __('Required Items', 'invoicing'),
264
+                                'placeholder'      => __('Select Items', 'invoicing'),
265
+                                'value'            => $discount->get_required_items('edit'),
266 266
                                 'select2'          => true,
267 267
                                 'multiple'         => true,
268 268
                                 'data-allow-clear' => 'false',
@@ -273,15 +273,15 @@  discard block
 block discarded – undo
273 273
                     ?>
274 274
                 </div>
275 275
                 <div class="col-sm-1 pt-2 pl-0">
276
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Select all the items that are required to be in the cart before using this discount.', 'invoicing' ); ?>"></span>
276
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Select all the items that are required to be in the cart before using this discount.', 'invoicing'); ?>"></span>
277 277
                 </div>
278 278
             </div>
279
-            <?php do_action( 'wpinv_discount_form_required_items', $discount ); ?>
279
+            <?php do_action('wpinv_discount_form_required_items', $discount); ?>
280 280
 
281
-            <?php do_action( 'wpinv_discount_form_before_start', $discount ); ?>
281
+            <?php do_action('wpinv_discount_form_before_start', $discount); ?>
282 282
             <div class="form-group mb-3 row">
283 283
                 <label for="wpinv_discount_start" class="col-sm-3 col-form-label">
284
-                    <?php esc_html_e( 'Start Date', 'invoicing' ); ?>
284
+                    <?php esc_html_e('Start Date', 'invoicing'); ?>
285 285
                 </label>
286 286
                 <div class="col-sm-8">
287 287
                     <?php
@@ -290,10 +290,10 @@  discard block
 block discarded – undo
290 290
                                 'type'             => 'datepicker',
291 291
                                 'id'               => 'wpinv_discount_start',
292 292
                                 'name'             => 'wpinv_discount_start',
293
-                                'label'            => __( 'Start Date', 'invoicing' ),
293
+                                'label'            => __('Start Date', 'invoicing'),
294 294
                                 'placeholder'      => 'YYYY-MM-DD 00:00',
295 295
                                 'class'            => 'form-control-sm',
296
-                                'value'            => $discount->get_start_date( 'edit' ),
296
+                                'value'            => $discount->get_start_date('edit'),
297 297
                                 'extra_attributes' => array(
298 298
                                     'data-enable-time' => 'true',
299 299
                                     'data-time_24hr'   => 'true',
@@ -305,15 +305,15 @@  discard block
 block discarded – undo
305 305
                     ?>
306 306
                 </div>
307 307
                 <div class="col-sm-1 pt-2 pl-0">
308
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'For no start date, leave blank. If entered, the discount can only be used after or on this date.', 'invoicing' ); ?>"></span>
308
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('For no start date, leave blank. If entered, the discount can only be used after or on this date.', 'invoicing'); ?>"></span>
309 309
                 </div>
310 310
             </div>
311
-            <?php do_action( 'wpinv_discount_form_start', $discount ); ?>
311
+            <?php do_action('wpinv_discount_form_start', $discount); ?>
312 312
 
313
-            <?php do_action( 'wpinv_discount_form_before_expiration', $discount ); ?>
313
+            <?php do_action('wpinv_discount_form_before_expiration', $discount); ?>
314 314
             <div class="form-group mb-3 row">
315 315
                 <label for="wpinv_discount_expiration" class="col-sm-3 col-form-label">
316
-                    <?php esc_html_e( 'Expiration Date', 'invoicing' ); ?>
316
+                    <?php esc_html_e('Expiration Date', 'invoicing'); ?>
317 317
                 </label>
318 318
                 <div class="col-sm-8">
319 319
                     <?php
@@ -322,10 +322,10 @@  discard block
 block discarded – undo
322 322
                                 'type'             => 'datepicker',
323 323
                                 'id'               => 'wpinv_discount_expiration',
324 324
                                 'name'             => 'wpinv_discount_expiration',
325
-                                'label'            => __( 'Expiration Date', 'invoicing' ),
325
+                                'label'            => __('Expiration Date', 'invoicing'),
326 326
                                 'placeholder'      => 'YYYY-MM-DD 00:00',
327 327
                                 'class'            => 'form-control-sm',
328
-                                'value'            => $discount->get_end_date( 'edit' ),
328
+                                'value'            => $discount->get_end_date('edit'),
329 329
                                 'extra_attributes' => array(
330 330
                                     'data-enable-time' => 'true',
331 331
                                     'data-time_24hr'   => 'true',
@@ -339,111 +339,111 @@  discard block
 block discarded – undo
339 339
                     ?>
340 340
                 </div>
341 341
                 <div class="col-sm-1 pt-2 pl-0">
342
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the date after which the discount will expire.', 'invoicing' ); ?>"></span>
342
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the date after which the discount will expire.', 'invoicing'); ?>"></span>
343 343
                 </div>
344 344
             </div>
345
-            <?php do_action( 'wpinv_discount_form_expiration', $discount ); ?>
345
+            <?php do_action('wpinv_discount_form_expiration', $discount); ?>
346 346
 
347
-            <?php do_action( 'wpinv_discount_form_before_min_total', $discount ); ?>
347
+            <?php do_action('wpinv_discount_form_before_min_total', $discount); ?>
348 348
             <div class="form-group mb-3 row">
349 349
                 <label for="wpinv_discount_min_total" class="col-sm-3 col-form-label">
350
-                    <?php esc_html_e( 'Minimum Amount', 'invoicing' ); ?>
350
+                    <?php esc_html_e('Minimum Amount', 'invoicing'); ?>
351 351
                 </label>
352 352
                 <div class="col-sm-8">
353 353
                     <div class="input-group input-group-sm">
354 354
 
355
-                        <?php if ( 'left' == $position ) : ?>
356
-                            <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?>
355
+                        <?php if ('left' == $position) : ?>
356
+                            <?php if (empty($GLOBALS['aui_bs5'])) : ?>
357 357
                                 <div class="input-group-prepend">
358
-                                    <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span>
358
+                                    <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span>
359 359
                                 </div>
360 360
                             <?php else : ?>
361 361
                                 <span class="input-group-text">
362
-                                    <?php echo wp_kses_post( wpinv_currency_symbol() ); ?>
362
+                                    <?php echo wp_kses_post(wpinv_currency_symbol()); ?>
363 363
                                 </span>
364 364
                             <?php endif; ?>
365 365
                         <?php endif; ?>
366 366
 
367
-                        <input type="text" name="wpinv_discount_min_total" id="wpinv_discount_min_total" value="<?php echo esc_attr( $discount->get_minimum_total( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'No minimum', 'invoicing' ); ?>" class="form-control">
367
+                        <input type="text" name="wpinv_discount_min_total" id="wpinv_discount_min_total" value="<?php echo esc_attr($discount->get_minimum_total('edit')); ?>" placeholder="<?php esc_attr_e('No minimum', 'invoicing'); ?>" class="form-control">
368 368
 
369
-                        <?php if ( 'left' != $position ) : ?>
370
-                            <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?>
369
+                        <?php if ('left' != $position) : ?>
370
+                            <?php if (empty($GLOBALS['aui_bs5'])) : ?>
371 371
                                 <div class="input-group-append">
372
-                                    <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span>
372
+                                    <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span>
373 373
                                 </div>
374 374
                             <?php else : ?>
375 375
                                 <span class="input-group-text">
376
-                                    <?php echo wp_kses_post( wpinv_currency_symbol() ); ?>
376
+                                    <?php echo wp_kses_post(wpinv_currency_symbol()); ?>
377 377
                                 </span>
378 378
                             <?php endif; ?>
379 379
                         <?php endif; ?>
380 380
                     </div>
381 381
                 </div>
382 382
                 <div class="col-sm-1 pt-2 pl-0">
383
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the minimum amount (including taxes) required to use this discount.', 'invoicing' ); ?>"></span>
383
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the minimum amount (including taxes) required to use this discount.', 'invoicing'); ?>"></span>
384 384
                 </div>
385 385
             </div>
386
-            <?php do_action( 'wpinv_discount_form_min_total', $discount ); ?>
386
+            <?php do_action('wpinv_discount_form_min_total', $discount); ?>
387 387
 
388
-            <?php do_action( 'wpinv_discount_form_before_max_total', $discount ); ?>
388
+            <?php do_action('wpinv_discount_form_before_max_total', $discount); ?>
389 389
             <div class="form-group mb-3 row">
390 390
                 <label for="wpinv_discount_max_total" class="col-sm-3 col-form-label">
391
-                    <?php esc_html_e( 'Maximum Amount', 'invoicing' ); ?>
391
+                    <?php esc_html_e('Maximum Amount', 'invoicing'); ?>
392 392
                 </label>
393 393
                 <div class="col-sm-8">
394 394
                     <div class="input-group input-group-sm">
395
-                        <?php if ( 'left' == $position ) : ?>
396
-                            <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?>
395
+                        <?php if ('left' == $position) : ?>
396
+                            <?php if (empty($GLOBALS['aui_bs5'])) : ?>
397 397
                                 <div class="input-group-prepend">
398
-                                    <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span>
398
+                                    <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span>
399 399
                                 </div>
400 400
                             <?php else : ?>
401 401
                                 <span class="input-group-text">
402
-                                    <?php echo wp_kses_post( wpinv_currency_symbol() ); ?>
402
+                                    <?php echo wp_kses_post(wpinv_currency_symbol()); ?>
403 403
                                 </span>
404 404
                             <?php endif; ?>
405 405
                         <?php endif; ?>
406 406
 
407
-                        <input type="text" name="wpinv_discount_max_total" id="wpinv_discount_max_total" value="<?php echo esc_attr( $discount->get_maximum_total( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'No maximum', 'invoicing' ); ?>" class="form-control">
407
+                        <input type="text" name="wpinv_discount_max_total" id="wpinv_discount_max_total" value="<?php echo esc_attr($discount->get_maximum_total('edit')); ?>" placeholder="<?php esc_attr_e('No maximum', 'invoicing'); ?>" class="form-control">
408 408
 
409
-                        <?php if ( 'left' != $position ) : ?>
410
-                            <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?>
409
+                        <?php if ('left' != $position) : ?>
410
+                            <?php if (empty($GLOBALS['aui_bs5'])) : ?>
411 411
                                 <div class="input-group-append">
412
-                                    <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span>
412
+                                    <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span>
413 413
                                 </div>
414 414
                             <?php else : ?>
415 415
                                 <span class="input-group-text">
416
-                                    <?php echo wp_kses_post( wpinv_currency_symbol() ); ?>
416
+                                    <?php echo wp_kses_post(wpinv_currency_symbol()); ?>
417 417
                                 </span>
418 418
                             <?php endif; ?>
419 419
                         <?php endif; ?>
420 420
                     </div>
421 421
                 </div>
422 422
                 <div class="col-sm-1 pt-2 pl-0">
423
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the maximum amount (including taxes) allowed when using this discount.', 'invoicing' ); ?>"></span>
423
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the maximum amount (including taxes) allowed when using this discount.', 'invoicing'); ?>"></span>
424 424
                 </div>
425 425
             </div>
426
-            <?php do_action( 'wpinv_discount_form_before_max_total', $discount ); ?>
426
+            <?php do_action('wpinv_discount_form_before_max_total', $discount); ?>
427 427
 
428
-            <?php do_action( 'wpinv_discount_form_before_max_uses', $discount ); ?>
428
+            <?php do_action('wpinv_discount_form_before_max_uses', $discount); ?>
429 429
             <div class="form-group mb-3 row">
430 430
                 <label for="wpinv_discount_max_uses" class="col-sm-3 col-form-label">
431
-                    <?php esc_html_e( 'Maximum Uses', 'invoicing' ); ?>
431
+                    <?php esc_html_e('Maximum Uses', 'invoicing'); ?>
432 432
                 </label>
433 433
                 <div class="col-sm-8">
434
-                    <input type="text" value="<?php echo esc_attr( $discount->get_max_uses( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'Unlimited', 'invoicing' ); ?>" name="wpinv_discount_max_uses" id="wpinv_discount_max_uses" style="width: 100%;" />
434
+                    <input type="text" value="<?php echo esc_attr($discount->get_max_uses('edit')); ?>" placeholder="<?php esc_attr_e('Unlimited', 'invoicing'); ?>" name="wpinv_discount_max_uses" id="wpinv_discount_max_uses" style="width: 100%;" />
435 435
                 </div>
436 436
                 <div class="col-sm-1 pt-2 pl-0">
437
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the maximum number of times that this discount code can be used.', 'invoicing' ); ?>"></span>
437
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the maximum number of times that this discount code can be used.', 'invoicing'); ?>"></span>
438 438
                 </div>
439 439
             </div>
440
-            <?php do_action( 'wpinv_discount_form_max_uses', $discount ); ?>
440
+            <?php do_action('wpinv_discount_form_max_uses', $discount); ?>
441 441
 
442
-            <?php do_action( 'wpinv_discount_form_last', $discount ); ?>
442
+            <?php do_action('wpinv_discount_form_last', $discount); ?>
443 443
 
444 444
         </div>
445 445
         <?php
446
-        do_action( 'wpinv_discount_form_bottom', $post );
446
+        do_action('wpinv_discount_form_bottom', $post);
447 447
     }
448 448
 
449 449
     /**
@@ -451,31 +451,31 @@  discard block
 block discarded – undo
451 451
 	 *
452 452
 	 * @param int $post_id
453 453
 	 */
454
-	public static function save( $post_id ) {
454
+	public static function save($post_id) {
455 455
 
456 456
         // Prepare the discount.
457
-        $discount = new WPInv_Discount( $post_id );
457
+        $discount = new WPInv_Discount($post_id);
458 458
 
459 459
         // Load new data.
460 460
         $discount->set_props(
461 461
 			array(
462
-				'code'           => isset( $_POST['wpinv_discount_code'] ) ? wpinv_clean( $_POST['wpinv_discount_code'] ) : null,
463
-				'amount'         => isset( $_POST['wpinv_discount_amount'] ) ? floatval( $_POST['wpinv_discount_amount'] ) : null,
464
-				'start'          => isset( $_POST['wpinv_discount_start'] ) ? wpinv_clean( $_POST['wpinv_discount_start'] ) : null,
465
-				'expiration'     => isset( $_POST['wpinv_discount_expiration'] ) ? wpinv_clean( $_POST['wpinv_discount_expiration'] ) : null,
466
-				'is_single_use'  => ! empty( $_POST['wpinv_discount_single_use'] ),
467
-                'type'           => isset( $_POST['wpinv_discount_type'] ) ? wpinv_clean( $_POST['wpinv_discount_type'] ) : null,
468
-				'is_recurring'   => ! empty( $_POST['wpinv_discount_recurring'] ),
469
-				'items'          => isset( $_POST['wpinv_discount_items'] ) ? wpinv_clean( $_POST['wpinv_discount_items'] ) : array(),
470
-				'excluded_items' => isset( $_POST['wpinv_discount_excluded_items'] ) ? wpinv_clean( $_POST['wpinv_discount_excluded_items'] ) : array(),
471
-                'required_items' => isset( $_POST['wpinv_discount_required_items'] ) ? wpinv_clean( $_POST['wpinv_discount_required_items'] ) : array(),
472
-				'max_uses'       => isset( $_POST['wpinv_discount_max_uses'] ) ? intval( $_POST['wpinv_discount_max_uses'] ) : null,
473
-				'min_total'      => isset( $_POST['wpinv_discount_min_total'] ) ? floatval( $_POST['wpinv_discount_min_total'] ) : null,
474
-				'max_total'      => isset( $_POST['wpinv_discount_max_total'] ) ? floatval( $_POST['wpinv_discount_max_total'] ) : null,
462
+				'code'           => isset($_POST['wpinv_discount_code']) ? wpinv_clean($_POST['wpinv_discount_code']) : null,
463
+				'amount'         => isset($_POST['wpinv_discount_amount']) ? floatval($_POST['wpinv_discount_amount']) : null,
464
+				'start'          => isset($_POST['wpinv_discount_start']) ? wpinv_clean($_POST['wpinv_discount_start']) : null,
465
+				'expiration'     => isset($_POST['wpinv_discount_expiration']) ? wpinv_clean($_POST['wpinv_discount_expiration']) : null,
466
+				'is_single_use'  => !empty($_POST['wpinv_discount_single_use']),
467
+                'type'           => isset($_POST['wpinv_discount_type']) ? wpinv_clean($_POST['wpinv_discount_type']) : null,
468
+				'is_recurring'   => !empty($_POST['wpinv_discount_recurring']),
469
+				'items'          => isset($_POST['wpinv_discount_items']) ? wpinv_clean($_POST['wpinv_discount_items']) : array(),
470
+				'excluded_items' => isset($_POST['wpinv_discount_excluded_items']) ? wpinv_clean($_POST['wpinv_discount_excluded_items']) : array(),
471
+                'required_items' => isset($_POST['wpinv_discount_required_items']) ? wpinv_clean($_POST['wpinv_discount_required_items']) : array(),
472
+				'max_uses'       => isset($_POST['wpinv_discount_max_uses']) ? intval($_POST['wpinv_discount_max_uses']) : null,
473
+				'min_total'      => isset($_POST['wpinv_discount_min_total']) ? floatval($_POST['wpinv_discount_min_total']) : null,
474
+				'max_total'      => isset($_POST['wpinv_discount_max_total']) ? floatval($_POST['wpinv_discount_max_total']) : null,
475 475
 			)
476 476
         );
477 477
 
478 478
 		$discount->save();
479
-		do_action( 'getpaid_discount_metabox_save', $post_id, $discount );
479
+		do_action('getpaid_discount_metabox_save', $post_id, $discount);
480 480
 	}
481 481
 }
Please login to merge, or discard this patch.
Braces   +35 added lines, -14 removed lines patch added patch discarded remove patch
@@ -154,9 +154,12 @@  discard block
 block discarded – undo
154 154
                                         <?php echo wp_kses_post( wpinv_currency_symbol() ); ?>
155 155
                                     </span>
156 156
                                 </div>
157
-                            <?php else : ?>
157
+                            <?php else {
158
+    : ?>
158 159
                                 <span class="input-group-text left wpinv-if-flat">
159
-                                    <?php echo wp_kses_post( wpinv_currency_symbol() ); ?>
160
+                                    <?php echo wp_kses_post( wpinv_currency_symbol() );
161
+}
162
+?>
160 163
                                 </span>
161 164
                             <?php endif; ?>
162 165
                         <?php endif; ?>
@@ -170,9 +173,12 @@  discard block
 block discarded – undo
170 173
                                         <?php echo wp_kses_post( wpinv_currency_symbol() ); ?>
171 174
                                     </span>
172 175
                                 </div>
173
-                            <?php else : ?>
176
+                            <?php else {
177
+    : ?>
174 178
                                 <span class="input-group-text left wpinv-if-flat">
175
-                                    <?php echo wp_kses_post( wpinv_currency_symbol() ); ?>
179
+                                    <?php echo wp_kses_post( wpinv_currency_symbol() );
180
+}
181
+?>
176 182
                                 </span>
177 183
                             <?php endif; ?>
178 184
                         <?php endif; ?>
@@ -180,9 +186,12 @@  discard block
 block discarded – undo
180 186
                             <div class="input-group-append right wpinv-if-percent">
181 187
                                 <span class="input-group-text">%</span>
182 188
                             </div>
183
-                        <?php else : ?>
189
+                        <?php else {
190
+    : ?>
184 191
                             <span class="input-group-text right wpinv-if-percent">%</span>
185
-                        <?php endif; ?>
192
+                        <?php endif;
193
+}
194
+?>
186 195
                     </div>
187 196
                 </div>
188 197
                 <div class="col-sm-1 pt-2 pl-0">
@@ -357,9 +366,12 @@  discard block
 block discarded – undo
357 366
                                 <div class="input-group-prepend">
358 367
                                     <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span>
359 368
                                 </div>
360
-                            <?php else : ?>
369
+                            <?php else {
370
+    : ?>
361 371
                                 <span class="input-group-text">
362
-                                    <?php echo wp_kses_post( wpinv_currency_symbol() ); ?>
372
+                                    <?php echo wp_kses_post( wpinv_currency_symbol() );
373
+}
374
+?>
363 375
                                 </span>
364 376
                             <?php endif; ?>
365 377
                         <?php endif; ?>
@@ -371,9 +383,12 @@  discard block
 block discarded – undo
371 383
                                 <div class="input-group-append">
372 384
                                     <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span>
373 385
                                 </div>
374
-                            <?php else : ?>
386
+                            <?php else {
387
+    : ?>
375 388
                                 <span class="input-group-text">
376
-                                    <?php echo wp_kses_post( wpinv_currency_symbol() ); ?>
389
+                                    <?php echo wp_kses_post( wpinv_currency_symbol() );
390
+}
391
+?>
377 392
                                 </span>
378 393
                             <?php endif; ?>
379 394
                         <?php endif; ?>
@@ -397,9 +412,12 @@  discard block
 block discarded – undo
397 412
                                 <div class="input-group-prepend">
398 413
                                     <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span>
399 414
                                 </div>
400
-                            <?php else : ?>
415
+                            <?php else {
416
+    : ?>
401 417
                                 <span class="input-group-text">
402
-                                    <?php echo wp_kses_post( wpinv_currency_symbol() ); ?>
418
+                                    <?php echo wp_kses_post( wpinv_currency_symbol() );
419
+}
420
+?>
403 421
                                 </span>
404 422
                             <?php endif; ?>
405 423
                         <?php endif; ?>
@@ -411,9 +429,12 @@  discard block
 block discarded – undo
411 429
                                 <div class="input-group-append">
412 430
                                     <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span>
413 431
                                 </div>
414
-                            <?php else : ?>
432
+                            <?php else {
433
+    : ?>
415 434
                                 <span class="input-group-text">
416
-                                    <?php echo wp_kses_post( wpinv_currency_symbol() ); ?>
435
+                                    <?php echo wp_kses_post( wpinv_currency_symbol() );
436
+}
437
+?>
417 438
                                 </span>
418 439
                             <?php endif; ?>
419 440
                         <?php endif; ?>
Please login to merge, or discard this patch.