Passed
Push — master ( 35d84f...3024fb )
by Brian
05:36
created
includes/class-wpinv-payment-form-elements.php 1 patch
Spacing   +581 added lines, -581 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
     exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -13,19 +13,19 @@  discard block
 block discarded – undo
13 13
 
14 14
     public function __construct() {
15 15
 
16
-        foreach( $this->get_elements() as $element ) {
16
+        foreach ($this->get_elements() as $element) {
17 17
             $element = $element['type'];
18 18
 
19
-            if ( method_exists( $this, "render_{$element}_template" ) ) {
20
-                add_action( 'wpinv_payment_form_render_element_template', array( $this, "render_{$element}_template" ), 10, 2 );
19
+            if (method_exists($this, "render_{$element}_template")) {
20
+                add_action('wpinv_payment_form_render_element_template', array($this, "render_{$element}_template"), 10, 2);
21 21
             }
22 22
 
23
-            if ( method_exists( $this, "edit_{$element}_template" ) ) {
24
-                add_action( 'wpinv_payment_form_edit_element_template', array( $this, "edit_{$element}_template" ), 10, 2 );
23
+            if (method_exists($this, "edit_{$element}_template")) {
24
+                add_action('wpinv_payment_form_edit_element_template', array($this, "edit_{$element}_template"), 10, 2);
25 25
             }
26 26
 
27
-            if ( method_exists( $this, "frontend_render_{$element}_template" ) ) {
28
-                add_action( "wpinv_frontend_render_payment_form_$element", array( $this, "frontend_render_{$element}_template" ), 10, 3 );
27
+            if (method_exists($this, "frontend_render_{$element}_template")) {
28
+                add_action("wpinv_frontend_render_payment_form_$element", array($this, "frontend_render_{$element}_template"), 10, 3);
29 29
             }
30 30
 
31 31
         }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function get_elements() {
39 39
 
40
-        if ( ! empty( $this->elements ) ) {
40
+        if (!empty($this->elements)) {
41 41
             return $this->elements;
42 42
         }
43 43
 
@@ -45,28 +45,28 @@  discard block
 block discarded – undo
45 45
 
46 46
             array(
47 47
                 'type'     => 'heading',
48
-                'name'     => __( 'Heading', 'invoicing' ),
48
+                'name'     => __('Heading', 'invoicing'),
49 49
                 'defaults' => array(
50 50
                     'level' => 'h2',
51
-                    'text'  => __( 'Heading', 'invoicing' ),
51
+                    'text'  => __('Heading', 'invoicing'),
52 52
                 )
53 53
             ),
54 54
 
55 55
             array(
56 56
                 'type' => 'paragraph',
57
-                'name' => __( 'Paragraph', 'invoicing' ),
57
+                'name' => __('Paragraph', 'invoicing'),
58 58
                 'defaults'  => array(
59
-                    'text'  => __( 'Paragraph text', 'invoicing' ),
59
+                    'text'  => __('Paragraph text', 'invoicing'),
60 60
                 )
61 61
             ),
62 62
 
63 63
             array( 
64 64
                 'type' => 'alert',
65
-                'name' => __( 'Alert', 'invoicing' ),
65
+                'name' => __('Alert', 'invoicing'),
66 66
                 'defaults'  => array(
67 67
                     'value'        => '',
68 68
                     'class'        => 'alert-warning',
69
-                    'text'         => __( 'Alert', 'invoicing' ),
69
+                    'text'         => __('Alert', 'invoicing'),
70 70
                     'dismissible'  => false,
71 71
                 )
72 72
             ),
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
 
83 83
             array(
84 84
                 'type' => 'text',
85
-                'name' => __( 'Text Input', 'invoicing' ),
85
+                'name' => __('Text Input', 'invoicing'),
86 86
                 'defaults'  => array(
87
-                    'placeholder'  => __( 'Enter some text', 'invoicing' ),
87
+                    'placeholder'  => __('Enter some text', 'invoicing'),
88 88
                     'value'        => '',
89
-                    'label'        => __( 'Field Label', 'invoicing' ),
89
+                    'label'        => __('Field Label', 'invoicing'),
90 90
                     'description'  => '',
91 91
                     'required'     => false,
92 92
                 )
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
 
95 95
             array(
96 96
                 'type' => 'textarea',
97
-                'name' => __( 'Textarea', 'invoicing' ),
97
+                'name' => __('Textarea', 'invoicing'),
98 98
                 'defaults'         => array(
99
-                    'placeholder'  => __( 'Enter your text hear', 'invoicing' ),
99
+                    'placeholder'  => __('Enter your text hear', 'invoicing'),
100 100
                     'value'        => '',
101
-                    'label'        => __( 'Textarea Label', 'invoicing' ),
101
+                    'label'        => __('Textarea Label', 'invoicing'),
102 102
                     'description'  => '',
103 103
                     'required'     => false,
104 104
                 )
@@ -106,27 +106,27 @@  discard block
 block discarded – undo
106 106
 
107 107
             array(
108 108
                 'type' => 'select',
109
-                'name' => __( 'Dropdown', 'invoicing' ),
109
+                'name' => __('Dropdown', 'invoicing'),
110 110
                 'defaults'         => array(
111
-                    'placeholder'  => __( 'Select a value', 'invoicing' ),
111
+                    'placeholder'  => __('Select a value', 'invoicing'),
112 112
                     'value'        => '',
113
-                    'label'        => __( 'Dropdown Label', 'invoicing' ),
113
+                    'label'        => __('Dropdown Label', 'invoicing'),
114 114
                     'description'  => '',
115 115
                     'required'     => false,
116 116
                     'options'      => array(
117
-                        esc_attr__( 'Option One', 'invoicing' ),
118
-                        esc_attr__( 'Option Two', 'invoicing' ),
119
-                        esc_attr__( 'Option Three', 'invoicing' )
117
+                        esc_attr__('Option One', 'invoicing'),
118
+                        esc_attr__('Option Two', 'invoicing'),
119
+                        esc_attr__('Option Three', 'invoicing')
120 120
                     ),
121 121
                 )
122 122
             ),
123 123
 
124 124
             array(
125 125
                 'type' => 'checkbox',
126
-                'name' => __( 'Checkbox', 'invoicing' ),
126
+                'name' => __('Checkbox', 'invoicing'),
127 127
                 'defaults'         => array(
128 128
                     'value'        => '',
129
-                    'label'        => __( 'Checkbox Label', 'invoicing' ),
129
+                    'label'        => __('Checkbox Label', 'invoicing'),
130 130
                     'description'  => '',
131 131
                     'required'     => false,
132 132
                 )
@@ -134,24 +134,24 @@  discard block
 block discarded – undo
134 134
 
135 135
             array( 
136 136
                 'type' => 'radio',
137
-                'name' => __( 'Multiple Choice', 'invoicing' ),
137
+                'name' => __('Multiple Choice', 'invoicing'),
138 138
                 'defaults'     => array(
139
-                    'label'    => __( 'Select one choice', 'invoicing' ),
139
+                    'label'    => __('Select one choice', 'invoicing'),
140 140
                     'options'  => array(
141
-                        esc_attr__( 'Choice One', 'invoicing' ),
142
-                        esc_attr__( 'Choice Two', 'invoicing' ),
143
-                        esc_attr__( 'Choice Three', 'invoicing' )
141
+                        esc_attr__('Choice One', 'invoicing'),
142
+                        esc_attr__('Choice Two', 'invoicing'),
143
+                        esc_attr__('Choice Three', 'invoicing')
144 144
                     ),
145 145
                 )
146 146
             ),
147 147
 
148 148
             array( 
149 149
                 'type' => 'date',
150
-                'name' => __( 'Date', 'invoicing' ),
150
+                'name' => __('Date', 'invoicing'),
151 151
                 'defaults' => array(
152 152
                     'placeholder'  => '',
153 153
                     'value'        => '',
154
-                    'label'        => __( 'Date', 'invoicing' ),
154
+                    'label'        => __('Date', 'invoicing'),
155 155
                     'description'  => '',
156 156
                     'required'     => false,
157 157
                 )
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 
160 160
             array( 
161 161
                 'type' => 'time',
162
-                'name' => __( 'Time', 'invoicing' ),
162
+                'name' => __('Time', 'invoicing'),
163 163
                 'defaults' => array(
164 164
                     'placeholder'  => '',
165 165
                     'value'        => '',
166
-                    'label'        => __( 'Time', 'invoicing' ),
166
+                    'label'        => __('Time', 'invoicing'),
167 167
                     'description'  => '',
168 168
                     'required'     => false,
169 169
                 )
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 
172 172
             array( 
173 173
                 'type' => 'number',
174
-                'name' => __( 'Number', 'invoicing' ),
174
+                'name' => __('Number', 'invoicing'),
175 175
                 'defaults' => array(
176 176
                     'placeholder'  => '',
177 177
                     'value'        => '',
178
-                    'label'        => __( 'Number', 'invoicing' ),
178
+                    'label'        => __('Number', 'invoicing'),
179 179
                     'description'  => '',
180 180
                     'required'     => false,
181 181
                 )
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 
184 184
             array( 
185 185
                 'type' => 'website',
186
-                'name' => __( 'Website', 'invoicing' ),
186
+                'name' => __('Website', 'invoicing'),
187 187
                 'defaults' => array(
188 188
                     'placeholder'  => 'http://example.com',
189 189
                     'value'        => '',
190
-                    'label'        => __( 'Website', 'invoicing' ),
190
+                    'label'        => __('Website', 'invoicing'),
191 191
                     'description'  => '',
192 192
                     'required'     => false,
193 193
                 )
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 
196 196
             array( 
197 197
                 'type' => 'email',
198
-                'name' => __( 'Email', 'invoicing' ),
198
+                'name' => __('Email', 'invoicing'),
199 199
                 'defaults'  => array(
200 200
                     'placeholder'  => '[email protected]',
201 201
                     'value'        => '',
202
-                    'label'        => __( 'Email Address', 'invoicing' ),
202
+                    'label'        => __('Email Address', 'invoicing'),
203 203
                     'description'  => '',
204 204
                     'required'     => false,
205 205
                 )
@@ -207,14 +207,14 @@  discard block
 block discarded – undo
207 207
 
208 208
             array( 
209 209
                 'type' => 'address',
210
-                'name' => __( 'Address', 'invoicing' ),
210
+                'name' => __('Address', 'invoicing'),
211 211
                 'defaults'  => array(
212 212
 
213 213
                     'fields' => array(
214 214
                         array(
215 215
                             'placeholder'  => 'Jon',
216 216
                             'value'        => '',
217
-                            'label'        => __( 'First Name', 'invoicing' ),
217
+                            'label'        => __('First Name', 'invoicing'),
218 218
                             'description'  => '',
219 219
                             'required'     => false,
220 220
                             'visible'      => true,
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
                         array(
225 225
                             'placeholder'  => 'Snow',
226 226
                             'value'        => '',
227
-                            'label'        => __( 'Last Name', 'invoicing' ),
227
+                            'label'        => __('Last Name', 'invoicing'),
228 228
                             'description'  => '',
229 229
                             'required'     => false,
230 230
                             'visible'      => true,
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
                         array(
235 235
                             'placeholder'  => '',
236 236
                             'value'        => '',
237
-                            'label'        => __( 'Address', 'invoicing' ),
237
+                            'label'        => __('Address', 'invoicing'),
238 238
                             'description'  => '',
239 239
                             'required'     => false,
240 240
                             'visible'      => true,
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
                         array(
245 245
                             'placeholder'  => '',
246 246
                             'value'        => '',
247
-                            'label'        => __( 'City', 'invoicing' ),
247
+                            'label'        => __('City', 'invoicing'),
248 248
                             'description'  => '',
249 249
                             'required'     => false,
250 250
                             'visible'      => true,
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
                         ),
253 253
 
254 254
                         array(
255
-                            'placeholder'  => __( 'Select your country' ),
255
+                            'placeholder'  => __('Select your country'),
256 256
                             'value'        => '',
257
-                            'label'        => __( 'Country', 'invoicing' ),
257
+                            'label'        => __('Country', 'invoicing'),
258 258
                             'description'  => '',
259 259
                             'required'     => false,
260 260
                             'visible'      => true,
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
                         ),
263 263
 
264 264
                         array(
265
-                            'placeholder'  => __( 'Choose a state', 'invoicing' ),
265
+                            'placeholder'  => __('Choose a state', 'invoicing'),
266 266
                             'value'        => '',
267
-                            'label'        => __( 'State / Province', 'invoicing' ),
267
+                            'label'        => __('State / Province', 'invoicing'),
268 268
                             'description'  => '',
269 269
                             'required'     => false,
270 270
                             'visible'      => true,
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
                         array(
275 275
                             'placeholder'  => '',
276 276
                             'value'        => '',
277
-                            'label'        => __( 'ZIP / Postcode', 'invoicing' ),
277
+                            'label'        => __('ZIP / Postcode', 'invoicing'),
278 278
                             'description'  => '',
279 279
                             'required'     => false,
280 280
                             'visible'      => true,
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
                         array(
285 285
                             'placeholder'  => '',
286 286
                             'value'        => '',
287
-                            'label'        => __( 'Phone', 'invoicing' ),
287
+                            'label'        => __('Phone', 'invoicing'),
288 288
                             'description'  => '',
289 289
                             'required'     => false,
290 290
                             'visible'      => true,
@@ -296,11 +296,11 @@  discard block
 block discarded – undo
296 296
 
297 297
             array( 
298 298
                 'type' => 'billing_email',
299
-                'name' => __( 'Billing Email', 'invoicing' ),
299
+                'name' => __('Billing Email', 'invoicing'),
300 300
                 'defaults'  => array(
301 301
                     'placeholder'  => '[email protected]',
302 302
                     'value'        => '',
303
-                    'label'        => __( 'Billing Email', 'invoicing' ),
303
+                    'label'        => __('Billing Email', 'invoicing'),
304 304
                     'description'  => '',
305 305
                     'premade'      => true,
306 306
                 )
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 
320 320
             array( 
321 321
                 'type' => 'items',
322
-                'name' => __( 'Items', 'invoicing' ),
322
+                'name' => __('Items', 'invoicing'),
323 323
                 'defaults'  => array(
324 324
                     'value'        => '',
325 325
                     'items_type'   => 'total',
@@ -330,25 +330,25 @@  discard block
 block discarded – undo
330 330
 
331 331
             array( 
332 332
                 'type'       => 'pay_button',
333
-                'name'       => __( 'Payment Button', 'invoicing' ),
333
+                'name'       => __('Payment Button', 'invoicing'),
334 334
                 'defaults'   => array(
335 335
                     'value'        => '',
336 336
                     'class'        => 'btn-primary',
337
-                    'label'        => __( 'Pay Now »', 'invoicing' ),
338
-                    'description'  => __( 'By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ),
337
+                    'label'        => __('Pay Now »', 'invoicing'),
338
+                    'description'  => __('By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'),
339 339
                     'premade'      => true,
340 340
                 )
341 341
             )
342 342
         );
343 343
 
344
-        $this->elements = apply_filters( 'wpinv_filter_core_payment_form_elements', $this->elements );
344
+        $this->elements = apply_filters('wpinv_filter_core_payment_form_elements', $this->elements);
345 345
         return $this->elements;
346 346
     }
347 347
 
348 348
     /**
349 349
      * Returns the restrict markup.
350 350
      */
351
-    public function get_restrict_markup( $field, $field_type ) {
351
+    public function get_restrict_markup($field, $field_type) {
352 352
         $restrict = "$field.type=='$field_type'";
353 353
         return "v-if=\"$restrict\"";
354 354
     }
@@ -356,15 +356,15 @@  discard block
 block discarded – undo
356 356
     /**
357 357
      * Renders the title element template.
358 358
      */
359
-    public function render_heading_template( $field ) {
360
-        $restrict = $this->get_restrict_markup( $field, 'heading' );
359
+    public function render_heading_template($field) {
360
+        $restrict = $this->get_restrict_markup($field, 'heading');
361 361
         echo "<component :is='$field.level' $restrict v-html='$field.text'></component>";
362 362
     }
363 363
 
364 364
     /**
365 365
      * Renders the title element on the frontend.
366 366
      */
367
-    public function frontend_render_heading_template( $field ) {
367
+    public function frontend_render_heading_template($field) {
368 368
         $tag = $field['level'];
369 369
         echo "<$tag>{$field['text']}</$tag>";
370 370
     }
@@ -372,10 +372,10 @@  discard block
 block discarded – undo
372 372
     /**
373 373
      * Renders the edit title element template.
374 374
      */
375
-    public function edit_heading_template( $field ) {
376
-        $restrict = $this->get_restrict_markup( $field, 'heading' );
377
-        $label    = __( 'Heading', 'invoicing' );
378
-        $label2   = __( 'Select Heading Level', 'invoicing' );
375
+    public function edit_heading_template($field) {
376
+        $restrict = $this->get_restrict_markup($field, 'heading');
377
+        $label    = __('Heading', 'invoicing');
378
+        $label2   = __('Select Heading Level', 'invoicing');
379 379
         $id       = $field . '.id + "_edit"';
380 380
         $id2      = $field . '.id + "_edit2"';
381 381
 
@@ -407,8 +407,8 @@  discard block
 block discarded – undo
407 407
     /**
408 408
      * Renders a paragraph element template.
409 409
      */
410
-    public function render_paragraph_template( $field ) {
411
-        $restrict = $this->get_restrict_markup( $field, 'paragraph' );
410
+    public function render_paragraph_template($field) {
411
+        $restrict = $this->get_restrict_markup($field, 'paragraph');
412 412
         $label    = "$field.text";
413 413
         echo "<p $restrict v-html='$label' style='font-size: 16px;'></p>";
414 414
     }
@@ -416,16 +416,16 @@  discard block
 block discarded – undo
416 416
     /**
417 417
      * Renders the paragraph element on the frontend.
418 418
      */
419
-    public function frontend_render_paragraph_template( $field ) {
419
+    public function frontend_render_paragraph_template($field) {
420 420
         echo "<p>{$field['text']}</p>";
421 421
     }
422 422
 
423 423
     /**
424 424
      * Renders the edit paragraph element template.
425 425
      */
426
-    public function edit_paragraph_template( $field ) {
427
-        $restrict = $this->get_restrict_markup( $field, 'paragraph' );
428
-        $label    = __( 'Enter your text', 'invoicing' );
426
+    public function edit_paragraph_template($field) {
427
+        $restrict = $this->get_restrict_markup($field, 'paragraph');
428
+        $label    = __('Enter your text', 'invoicing');
429 429
         $id       = $field . '.id + "_edit"';
430 430
         echo "
431 431
             <div $restrict>
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
     /**
442 442
      * Renders the text element template.
443 443
      */
444
-    public function render_text_template( $field ) {
445
-        $restrict = $this->get_restrict_markup( $field, 'text' );
444
+    public function render_text_template($field) {
445
+        $restrict = $this->get_restrict_markup($field, 'text');
446 446
         $label    = "$field.label";
447 447
         echo "
448 448
             <div $restrict>
@@ -456,23 +456,23 @@  discard block
 block discarded – undo
456 456
     /**
457 457
      * Renders the text element on the frontend.
458 458
      */
459
-    public function frontend_render_text_template( $field ) {
459
+    public function frontend_render_text_template($field) {
460 460
         
461 461
         echo "<div class='form-group'>";
462 462
 
463 463
         echo aui()->input(
464 464
             array(
465
-                'name'       => esc_attr( $field['id'] ),
466
-                'id'         => esc_attr( $field['id'] ),
467
-                'placeholder'=> esc_attr( $field['placeholder'] ),
465
+                'name'       => esc_attr($field['id']),
466
+                'id'         => esc_attr($field['id']),
467
+                'placeholder'=> esc_attr($field['placeholder']),
468 468
                 'required'   => (bool) $field['required'],
469
-                'label'      => wp_kses_post( $field['label'] ),
469
+                'label'      => wp_kses_post($field['label']),
470 470
                 'no_wrap'    => true,
471 471
             )
472 472
         );
473 473
 
474
-        if ( ! empty( $field['description'] ) ) {
475
-            $description = wp_kses_post( $field['description'] );
474
+        if (!empty($field['description'])) {
475
+            $description = wp_kses_post($field['description']);
476 476
             echo "<small class='form-text text-muted'>$description</small>";
477 477
         }
478 478
 
@@ -483,16 +483,16 @@  discard block
 block discarded – undo
483 483
     /**
484 484
      * Renders the edit text element template.
485 485
      */
486
-    public function edit_text_template( $field ) {
487
-        $restrict = $this->get_restrict_markup( $field, 'text' );
488
-        $label    = __( 'Field Label', 'invoicing' );
486
+    public function edit_text_template($field) {
487
+        $restrict = $this->get_restrict_markup($field, 'text');
488
+        $label    = __('Field Label', 'invoicing');
489 489
         $id       = $field . '.id + "_edit"';
490
-        $label2   = __( 'Placeholder text', 'invoicing' );
490
+        $label2   = __('Placeholder text', 'invoicing');
491 491
         $id2      = $field . '.id + "_edit2"';
492
-        $label3   = __( 'Help text', 'invoicing' );
493
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
492
+        $label3   = __('Help text', 'invoicing');
493
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
494 494
         $id3      = $field . '.id + "_edit3"';
495
-        $label5   = __( 'Is this field required?', 'invoicing' );
495
+        $label5   = __('Is this field required?', 'invoicing');
496 496
         $id4      = $field . '.id + "_edit4"';
497 497
         echo "
498 498
             <div $restrict>
@@ -520,8 +520,8 @@  discard block
 block discarded – undo
520 520
     /**
521 521
      * Renders the textarea element template.
522 522
      */
523
-    public function render_textarea_template( $field ) {
524
-        $restrict = $this->get_restrict_markup( $field, 'textarea' );
523
+    public function render_textarea_template($field) {
524
+        $restrict = $this->get_restrict_markup($field, 'textarea');
525 525
         $label    = "$field.label";
526 526
         echo "
527 527
             <div $restrict>
@@ -535,24 +535,24 @@  discard block
 block discarded – undo
535 535
     /**
536 536
      * Renders the textarea element on the frontend.
537 537
      */
538
-    public function frontend_render_textarea_template( $field ) {
538
+    public function frontend_render_textarea_template($field) {
539 539
         
540 540
         echo "<div class='form-group'>";
541 541
 
542 542
         echo aui()->textarea(
543 543
             array(
544
-                'name'       => esc_attr( $field['id'] ),
545
-                'id'         => esc_attr( $field['id'] ),
546
-                'placeholder'=> esc_attr( $field['placeholder'] ),
544
+                'name'       => esc_attr($field['id']),
545
+                'id'         => esc_attr($field['id']),
546
+                'placeholder'=> esc_attr($field['placeholder']),
547 547
                 'required'   => (bool) $field['required'],
548
-                'label'      => wp_kses_post( $field['label'] ),
548
+                'label'      => wp_kses_post($field['label']),
549 549
                 'no_wrap'    => true,
550 550
                 'rows'       => 3,
551 551
             )
552 552
         );
553 553
 
554
-        if ( ! empty( $field['description'] ) ) {
555
-            $description = wp_kses_post( $field['description'] );
554
+        if (!empty($field['description'])) {
555
+            $description = wp_kses_post($field['description']);
556 556
             echo "<small class='form-text text-muted'>$description</small>";
557 557
         }
558 558
 
@@ -563,16 +563,16 @@  discard block
 block discarded – undo
563 563
     /**
564 564
      * Renders the edit textarea element template.
565 565
      */
566
-    public function edit_textarea_template( $field ) {
567
-        $restrict = $this->get_restrict_markup( $field, 'textarea' );
568
-        $label    = __( 'Field Label', 'invoicing' );
566
+    public function edit_textarea_template($field) {
567
+        $restrict = $this->get_restrict_markup($field, 'textarea');
568
+        $label    = __('Field Label', 'invoicing');
569 569
         $id       = $field . '.id + "_edit"';
570
-        $label2   = __( 'Placeholder text', 'invoicing' );
570
+        $label2   = __('Placeholder text', 'invoicing');
571 571
         $id2      = $field . '.id + "_edit2"';
572
-        $label3   = __( 'Help text', 'invoicing' );
573
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
572
+        $label3   = __('Help text', 'invoicing');
573
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
574 574
         $id3      = $field . '.id + "_edit3"';
575
-        $label5   = __( 'Is this field required?', 'invoicing' );
575
+        $label5   = __('Is this field required?', 'invoicing');
576 576
         $id4      = $field . '.id + "_edit4"';
577 577
         echo "
578 578
             <div $restrict>
@@ -600,8 +600,8 @@  discard block
 block discarded – undo
600 600
     /**
601 601
      * Renders the select element template.
602 602
      */
603
-    public function render_select_template( $field ) {
604
-        $restrict    = $this->get_restrict_markup( $field, 'select' );
603
+    public function render_select_template($field) {
604
+        $restrict    = $this->get_restrict_markup($field, 'select');
605 605
         $label       = "$field.label";
606 606
         $placeholder = "$field.placeholder";
607 607
         $id          = $field . '.id';
@@ -620,24 +620,24 @@  discard block
 block discarded – undo
620 620
     /**
621 621
      * Renders the select element on the frontend.
622 622
      */
623
-    public function frontend_render_select_template( $field ) {
623
+    public function frontend_render_select_template($field) {
624 624
         
625 625
         echo "<div class='form-group'>";
626 626
 
627 627
         echo aui()->select(
628 628
             array(
629
-                'name'       => esc_attr( $field['id'] ),
630
-                'id'         => esc_attr( $field['id'] ),
631
-                'placeholder'=> esc_attr( $field['placeholder'] ),
629
+                'name'       => esc_attr($field['id']),
630
+                'id'         => esc_attr($field['id']),
631
+                'placeholder'=> esc_attr($field['placeholder']),
632 632
                 'required'   => (bool) $field['required'],
633
-                'label'      => wp_kses_post( $field['label'] ),
633
+                'label'      => wp_kses_post($field['label']),
634 634
                 'no_wrap'    => true,
635
-                'options'    => array_combine( $field['options'], $field['options'] ),
635
+                'options'    => array_combine($field['options'], $field['options']),
636 636
             )
637 637
         );
638 638
 
639
-        if ( ! empty( $field['description'] ) ) {
640
-            $description = wp_kses_post( $field['description'] );
639
+        if (!empty($field['description'])) {
640
+            $description = wp_kses_post($field['description']);
641 641
             echo "<small class='form-text text-muted'>$description</small>";
642 642
         }
643 643
 
@@ -648,18 +648,18 @@  discard block
 block discarded – undo
648 648
     /**
649 649
      * Renders the edit select element template.
650 650
      */
651
-    public function edit_select_template( $field ) {
652
-        $restrict = $this->get_restrict_markup( $field, 'select' );
653
-        $label    = __( 'Field Label', 'invoicing' );
651
+    public function edit_select_template($field) {
652
+        $restrict = $this->get_restrict_markup($field, 'select');
653
+        $label    = __('Field Label', 'invoicing');
654 654
         $id       = $field . '.id + "_edit"';
655
-        $label2   = __( 'Placeholder text', 'invoicing' );
655
+        $label2   = __('Placeholder text', 'invoicing');
656 656
         $id2      = $field . '.id + "_edit2"';
657
-        $label3   = __( 'Help text', 'invoicing' );
658
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
657
+        $label3   = __('Help text', 'invoicing');
658
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
659 659
         $id3      = $field . '.id + "_edit3"';
660
-        $label5   = __( 'Is this field required?', 'invoicing' );
660
+        $label5   = __('Is this field required?', 'invoicing');
661 661
         $id4      = $field . '.id + "_edit4"';
662
-        $label6   = __( 'Available Options', 'invoicing' );
662
+        $label6   = __('Available Options', 'invoicing');
663 663
         echo "
664 664
             <div $restrict>
665 665
                 <div class='form-group'>
@@ -697,8 +697,8 @@  discard block
 block discarded – undo
697 697
     /**
698 698
      * Renders the checkbox element template.
699 699
      */
700
-    public function render_checkbox_template( $field ) {
701
-        $restrict = $this->get_restrict_markup( $field, 'checkbox' );
700
+    public function render_checkbox_template($field) {
701
+        $restrict = $this->get_restrict_markup($field, 'checkbox');
702 702
         $label    = "$field.label";
703 703
         echo "
704 704
             <div class='form-check' $restrict>
@@ -712,24 +712,24 @@  discard block
 block discarded – undo
712 712
     /**
713 713
      * Renders the checkbox element on the frontend.
714 714
      */
715
-    public function frontend_render_checkbox_template( $field ) {
715
+    public function frontend_render_checkbox_template($field) {
716 716
         
717 717
         echo "<div class='form-group'>";
718 718
 
719 719
         echo aui()->input(
720 720
             array(
721
-                'name'       => esc_attr( $field['id'] ),
722
-                'id'         => esc_attr( $field['id'] ),
721
+                'name'       => esc_attr($field['id']),
722
+                'id'         => esc_attr($field['id']),
723 723
                 'required'   => (bool) $field['required'],
724
-                'label'      => wp_kses_post( $field['label'] ),
724
+                'label'      => wp_kses_post($field['label']),
725 725
                 'no_wrap'    => true,
726
-                'value'      => esc_attr__( 'Yes', 'invoicing' ),
726
+                'value'      => esc_attr__('Yes', 'invoicing'),
727 727
                 'type'       => 'checkbox',
728 728
             )
729 729
         );
730 730
 
731
-        if ( ! empty( $field['description'] ) ) {
732
-            $description = wp_kses_post( $field['description'] );
731
+        if (!empty($field['description'])) {
732
+            $description = wp_kses_post($field['description']);
733 733
             echo "<small class='form-text text-muted'>$description</small>";
734 734
         }
735 735
 
@@ -740,14 +740,14 @@  discard block
 block discarded – undo
740 740
     /**
741 741
      * Renders the edit checkbox element template.
742 742
      */
743
-    public function edit_checkbox_template( $field ) {
744
-        $restrict = $this->get_restrict_markup( $field, 'checkbox' );
745
-        $label    = __( 'Field Label', 'invoicing' );
743
+    public function edit_checkbox_template($field) {
744
+        $restrict = $this->get_restrict_markup($field, 'checkbox');
745
+        $label    = __('Field Label', 'invoicing');
746 746
         $id       = $field . '.id + "_edit"';
747
-        $label2   = __( 'Help text', 'invoicing' );
748
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
747
+        $label2   = __('Help text', 'invoicing');
748
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
749 749
         $id2      = $field . '.id + "_edit2"';
750
-        $label4   = __( 'Is this field required?', 'invoicing' );
750
+        $label4   = __('Is this field required?', 'invoicing');
751 751
         $id3      = $field . '.id + "_edit3"';
752 752
         echo "
753 753
             <div $restrict>
@@ -771,8 +771,8 @@  discard block
 block discarded – undo
771 771
     /**
772 772
      * Renders the radio element template.
773 773
      */
774
-    public function render_radio_template( $field ) {
775
-        $restrict    = $this->get_restrict_markup( $field, 'radio' );
774
+    public function render_radio_template($field) {
775
+        $restrict    = $this->get_restrict_markup($field, 'radio');
776 776
         $label       = "$field.label";
777 777
         $id          = $field . '.id';
778 778
         echo "
@@ -790,20 +790,20 @@  discard block
 block discarded – undo
790 790
     /**
791 791
      * Renders the radio element on the frontend.
792 792
      */
793
-    public function frontend_render_radio_template( $field ) {
793
+    public function frontend_render_radio_template($field) {
794 794
         
795 795
         echo "<div class='form-group'>";
796 796
 
797
-        if ( ! empty( $field['label'] ) ) {
798
-            $label = wp_kses_post( $field['label'] );
797
+        if (!empty($field['label'])) {
798
+            $label = wp_kses_post($field['label']);
799 799
             echo "<legend class='col-form-label'>$label</legend>";
800 800
         }
801 801
 
802
-        foreach( $field['options'] as $index => $option ) {
802
+        foreach ($field['options'] as $index => $option) {
803 803
             $id    = $field['id'] . $index;
804 804
             $name  = $field['id'];
805
-            $value = esc_attr( $option );
806
-            $label = wp_kses_post( $option );
805
+            $value = esc_attr($option);
806
+            $label = wp_kses_post($option);
807 807
 
808 808
             echo "
809 809
                 <div class='form-check'>
@@ -813,8 +813,8 @@  discard block
 block discarded – undo
813 813
             ";
814 814
         }
815 815
 
816
-        if ( ! empty( $field['description'] ) ) {
817
-            $description = wp_kses_post( $field['description'] );
816
+        if (!empty($field['description'])) {
817
+            $description = wp_kses_post($field['description']);
818 818
             echo "<small class='form-text text-muted'>$description</small>";
819 819
         }
820 820
 
@@ -825,16 +825,16 @@  discard block
 block discarded – undo
825 825
     /**
826 826
      * Renders the edit radio element template.
827 827
      */
828
-    public function edit_radio_template( $field ) {
829
-        $restrict = $this->get_restrict_markup( $field, 'radio' );
830
-        $label    = __( 'Field Label', 'invoicing' );
828
+    public function edit_radio_template($field) {
829
+        $restrict = $this->get_restrict_markup($field, 'radio');
830
+        $label    = __('Field Label', 'invoicing');
831 831
         $id       = $field . '.id + "_edit"';
832
-        $label2   = __( 'Help text', 'invoicing' );
833
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
832
+        $label2   = __('Help text', 'invoicing');
833
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
834 834
         $id2      = $field . '.id + "_edit3"';
835
-        $label4   = __( 'Is this field required?', 'invoicing' );
835
+        $label4   = __('Is this field required?', 'invoicing');
836 836
         $id3      = $field . '.id + "_edit4"';
837
-        $label5   = __( 'Available Options', 'invoicing' );
837
+        $label5   = __('Available Options', 'invoicing');
838 838
         echo "
839 839
             <div $restrict>
840 840
                 <div class='form-group'>
@@ -868,8 +868,8 @@  discard block
 block discarded – undo
868 868
     /**
869 869
      * Renders the address element template.
870 870
      */
871
-    public function render_address_template( $field ) {
872
-        $restrict    = $this->get_restrict_markup( $field, 'address' );
871
+    public function render_address_template($field) {
872
+        $restrict = $this->get_restrict_markup($field, 'address');
873 873
 
874 874
         echo "
875 875
             <div class='wpinv-address-wrapper' $restrict>
@@ -890,55 +890,55 @@  discard block
 block discarded – undo
890 890
     /**
891 891
      * Renders the address element on the frontend.
892 892
      */
893
-    public function frontend_render_address_template( $field ) {
893
+    public function frontend_render_address_template($field) {
894 894
         
895 895
         echo "<div class='wpinv-address-fields'>";
896 896
 
897
-        foreach( $field['fields'] as $address_field ) {
897
+        foreach ($field['fields'] as $address_field) {
898 898
 
899
-            if ( empty( $address_field['visible'] ) ) {
899
+            if (empty($address_field['visible'])) {
900 900
                 continue;
901 901
             }
902 902
 
903
-            $class = esc_attr( $address_field['name'] );
903
+            $class = esc_attr($address_field['name']);
904 904
             echo "<div class='form-group $class'>";
905 905
 
906 906
             $label = $address_field['label'];
907 907
 
908
-            if ( ! empty( $address_field['required'] ) ) {
908
+            if (!empty($address_field['required'])) {
909 909
                 $label .= "<span class='text-danger'> *</span>";
910 910
             }
911 911
 
912
-            if ( 'wpinv_country' == $address_field['name'] ) {
912
+            if ('wpinv_country' == $address_field['name']) {
913 913
 
914
-                echo aui()->select( array(
914
+                echo aui()->select(array(
915 915
                     'options'          => wpinv_get_country_list(),
916
-                    'name'             => esc_attr( $address_field['name'] ),
917
-                    'id'               => esc_attr( $address_field['name'] ),
916
+                    'name'             => esc_attr($address_field['name']),
917
+                    'id'               => esc_attr($address_field['name']),
918 918
                     'value'            => wpinv_get_default_country(),
919
-                    'placeholder'      => esc_attr( $address_field['placeholder'] ),
919
+                    'placeholder'      => esc_attr($address_field['placeholder']),
920 920
                     'required'         => (bool) $address_field['required'],
921 921
                     'no_wrap'          => true,
922
-                    'label'            => wp_kses_post( $label ),
922
+                    'label'            => wp_kses_post($label),
923 923
                     'select2'          => false,
924 924
                 ));
925 925
     
926
-            } else if ( 'wpinv_state' == $address_field['name'] ) {
926
+            } else if ('wpinv_state' == $address_field['name']) {
927 927
 
928
-                $states = wpinv_get_country_states( wpinv_get_default_country() );
928
+                $states = wpinv_get_country_states(wpinv_get_default_country());
929 929
                 $state  = wpinv_get_default_state();
930 930
 
931
-                if ( ! empty( $states ) ) {
931
+                if (!empty($states)) {
932 932
 
933
-                    echo aui()->select( array(
933
+                    echo aui()->select(array(
934 934
                         'options'          => $states,
935
-                        'name'             => esc_attr( $address_field['name'] ),
936
-                        'id'               => esc_attr( $address_field['name'] ),
935
+                        'name'             => esc_attr($address_field['name']),
936
+                        'id'               => esc_attr($address_field['name']),
937 937
                         'value'            => $state,
938
-                        'placeholder'      => esc_attr( $address_field['placeholder'] ),
938
+                        'placeholder'      => esc_attr($address_field['placeholder']),
939 939
                         'required'         => (bool) $address_field['required'],
940 940
                         'no_wrap'          => true,
941
-                        'label'            => wp_kses_post( $label ),
941
+                        'label'            => wp_kses_post($label),
942 942
                         'select2'          => false,
943 943
                     ));
944 944
 
@@ -946,10 +946,10 @@  discard block
 block discarded – undo
946 946
 
947 947
                     echo aui()->input(
948 948
                         array(
949
-                            'name'       => esc_attr( $address_field['name'] ),
950
-                            'id'         => esc_attr( $address_field['name'] ),
949
+                            'name'       => esc_attr($address_field['name']),
950
+                            'id'         => esc_attr($address_field['name']),
951 951
                             'required'   => (bool) $address_field['required'],
952
-                            'label'      => wp_kses_post( $label ),
952
+                            'label'      => wp_kses_post($label),
953 953
                             'no_wrap'    => true,
954 954
                             'type'       => 'text',
955 955
                         )
@@ -961,12 +961,12 @@  discard block
 block discarded – undo
961 961
 
962 962
                 echo aui()->input(
963 963
                     array(
964
-                        'name'       => esc_attr( $address_field['name'] ),
965
-                        'id'         => esc_attr( $address_field['name'] ),
964
+                        'name'       => esc_attr($address_field['name']),
965
+                        'id'         => esc_attr($address_field['name']),
966 966
                         'required'   => (bool) $address_field['required'],
967
-                        'label'      => wp_kses_post( $label ),
967
+                        'label'      => wp_kses_post($label),
968 968
                         'no_wrap'    => true,
969
-                        'placeholder' => esc_attr( $address_field['placeholder'] ),
969
+                        'placeholder' => esc_attr($address_field['placeholder']),
970 970
                         'type'       => 'text',
971 971
                     )
972 972
                 );
@@ -974,8 +974,8 @@  discard block
 block discarded – undo
974 974
             }
975 975
             
976 976
 
977
-            if ( ! empty( $address_field['description'] ) ) {
978
-                $description = wp_kses_post( $address_field['description'] );
977
+            if (!empty($address_field['description'])) {
978
+                $description = wp_kses_post($address_field['description']);
979 979
                 echo "<small class='form-text text-muted'>$description</small>";
980 980
             }
981 981
     
@@ -990,13 +990,13 @@  discard block
 block discarded – undo
990 990
     /**
991 991
      * Renders the edit address element template.
992 992
      */
993
-    public function edit_address_template( $field ) {
994
-        $restrict  = $this->get_restrict_markup( $field, 'address' );
995
-        $label     = __( 'Field Label', 'invoicing' );
996
-        $label2    = __( 'Placeholder', 'invoicing' );
997
-        $label3    = __( 'Description', 'invoicing' );
998
-        $label4    = __( 'Is required', 'invoicing' );
999
-        $label5    = __( 'Is visible', 'invoicing' );
993
+    public function edit_address_template($field) {
994
+        $restrict  = $this->get_restrict_markup($field, 'address');
995
+        $label     = __('Field Label', 'invoicing');
996
+        $label2    = __('Placeholder', 'invoicing');
997
+        $label3    = __('Description', 'invoicing');
998
+        $label4    = __('Is required', 'invoicing');
999
+        $label5    = __('Is visible', 'invoicing');
1000 1000
         $id        = $field . '.id + "_edit_label"';
1001 1001
         $id2       = $field . '.id + "_edit_placeholder"';
1002 1002
         $id3       = $field . '.id + "_edit_description"';
@@ -1064,8 +1064,8 @@  discard block
 block discarded – undo
1064 1064
     /**
1065 1065
      * Renders the email element template.
1066 1066
      */
1067
-    public function render_email_template( $field ) {
1068
-        $restrict = $this->get_restrict_markup( $field, 'email' );
1067
+    public function render_email_template($field) {
1068
+        $restrict = $this->get_restrict_markup($field, 'email');
1069 1069
         $label    = "$field.label";
1070 1070
         echo "
1071 1071
             <div $restrict>
@@ -1079,8 +1079,8 @@  discard block
 block discarded – undo
1079 1079
     /**
1080 1080
      * Renders the billing_email element template.
1081 1081
      */
1082
-    public function render_billing_email_template( $field ) {
1083
-        $restrict = $this->get_restrict_markup( $field, 'billing_email' );
1082
+    public function render_billing_email_template($field) {
1083
+        $restrict = $this->get_restrict_markup($field, 'billing_email');
1084 1084
         $label    = "$field.label";
1085 1085
         echo "
1086 1086
             <div $restrict>
@@ -1094,24 +1094,24 @@  discard block
 block discarded – undo
1094 1094
     /**
1095 1095
      * Renders the email element on the frontend.
1096 1096
      */
1097
-    public function frontend_render_email_template( $field ) {
1097
+    public function frontend_render_email_template($field) {
1098 1098
         
1099 1099
         echo "<div class='form-group'>";
1100 1100
 
1101 1101
         echo aui()->input(
1102 1102
             array(
1103
-                'name'       => esc_attr( $field['id'] ),
1104
-                'id'         => esc_attr( $field['id'] ),
1103
+                'name'       => esc_attr($field['id']),
1104
+                'id'         => esc_attr($field['id']),
1105 1105
                 'required'   => (bool) $field['required'],
1106
-                'label'      => wp_kses_post( $field['label'] ),
1106
+                'label'      => wp_kses_post($field['label']),
1107 1107
                 'no_wrap'    => true,
1108
-                'placeholder' => esc_attr( $field['placeholder'] ),
1108
+                'placeholder' => esc_attr($field['placeholder']),
1109 1109
                 'type'       => 'email',
1110 1110
             )
1111 1111
         );
1112 1112
 
1113
-        if ( ! empty( $field['description'] ) ) {
1114
-            $description = wp_kses_post( $field['description'] );
1113
+        if (!empty($field['description'])) {
1114
+            $description = wp_kses_post($field['description']);
1115 1115
             echo "<small class='form-text text-muted'>$description</small>";
1116 1116
         }
1117 1117
 
@@ -1122,30 +1122,30 @@  discard block
 block discarded – undo
1122 1122
     /**
1123 1123
      * Renders the billing email element on the frontend.
1124 1124
      */
1125
-    public function frontend_render_billing_email_template( $field ) {
1125
+    public function frontend_render_billing_email_template($field) {
1126 1126
         
1127 1127
         echo "<div class='form-group'>";
1128 1128
         $value = '';
1129 1129
 
1130
-        if ( is_user_logged_in() ) {
1130
+        if (is_user_logged_in()) {
1131 1131
             $user  = wp_get_current_user();
1132
-            $value = sanitize_email( $user->user_email );
1132
+            $value = sanitize_email($user->user_email);
1133 1133
         }
1134 1134
         echo aui()->input(
1135 1135
             array(
1136 1136
                 'name'       => 'billing_email',
1137 1137
                 'value'      => $value,
1138
-                'id'         => esc_attr( $field['id'] ),
1138
+                'id'         => esc_attr($field['id']),
1139 1139
                 'required'   => true,
1140
-                'label'      => wp_kses_post( $field['label'] ),
1140
+                'label'      => wp_kses_post($field['label']),
1141 1141
                 'no_wrap'    => true,
1142
-                'placeholder' => esc_attr( $field['placeholder'] ),
1142
+                'placeholder' => esc_attr($field['placeholder']),
1143 1143
                 'type'       => 'email',
1144 1144
             )
1145 1145
         );
1146 1146
 
1147
-        if ( ! empty( $field['description'] ) ) {
1148
-            $description = wp_kses_post( $field['description'] );
1147
+        if (!empty($field['description'])) {
1148
+            $description = wp_kses_post($field['description']);
1149 1149
             echo "<small class='form-text text-muted'>$description</small>";
1150 1150
         }
1151 1151
 
@@ -1156,16 +1156,16 @@  discard block
 block discarded – undo
1156 1156
     /**
1157 1157
      * Renders the edit email element template.
1158 1158
      */
1159
-    public function edit_email_template( $field ) {
1160
-        $restrict = $this->get_restrict_markup( $field, 'email' );
1161
-        $label    = __( 'Field Label', 'invoicing' );
1159
+    public function edit_email_template($field) {
1160
+        $restrict = $this->get_restrict_markup($field, 'email');
1161
+        $label    = __('Field Label', 'invoicing');
1162 1162
         $id       = $field . '.id + "_edit"';
1163
-        $label2   = __( 'Placeholder text', 'invoicing' );
1163
+        $label2   = __('Placeholder text', 'invoicing');
1164 1164
         $id2      = $field . '.id + "_edit2"';
1165
-        $label3   = __( 'Help text', 'invoicing' );
1166
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1165
+        $label3   = __('Help text', 'invoicing');
1166
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1167 1167
         $id3      = $field . '.id + "_edit3"';
1168
-        $label5   = __( 'Is this field required?', 'invoicing' );
1168
+        $label5   = __('Is this field required?', 'invoicing');
1169 1169
         $id4      = $field . '.id + "_edit4"';
1170 1170
         echo "
1171 1171
             <div $restrict>
@@ -1193,16 +1193,16 @@  discard block
 block discarded – undo
1193 1193
     /**
1194 1194
      * Renders the edit billing_email element template.
1195 1195
      */
1196
-    public function edit_billing_email_template( $field ) {
1197
-        $restrict = $this->get_restrict_markup( $field, 'billing_email' );
1198
-        $label    = __( 'Field Label', 'invoicing' );
1196
+    public function edit_billing_email_template($field) {
1197
+        $restrict = $this->get_restrict_markup($field, 'billing_email');
1198
+        $label    = __('Field Label', 'invoicing');
1199 1199
         $id       = $field . '.id + "_edit"';
1200
-        $label2   = __( 'Placeholder text', 'invoicing' );
1200
+        $label2   = __('Placeholder text', 'invoicing');
1201 1201
         $id2      = $field . '.id + "_edit2"';
1202
-        $label3   = __( 'Help text', 'invoicing' );
1203
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1202
+        $label3   = __('Help text', 'invoicing');
1203
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1204 1204
         $id3      = $field . '.id + "_edit3"';
1205
-        $label5   = __( 'Is this field required?', 'invoicing' );
1205
+        $label5   = __('Is this field required?', 'invoicing');
1206 1206
         $id4      = $field . '.id + "_edit4"';
1207 1207
         echo "
1208 1208
             <div $restrict>
@@ -1226,8 +1226,8 @@  discard block
 block discarded – undo
1226 1226
     /**
1227 1227
      * Renders the website element template.
1228 1228
      */
1229
-    public function render_website_template( $field ) {
1230
-        $restrict = $this->get_restrict_markup( $field, 'website' );
1229
+    public function render_website_template($field) {
1230
+        $restrict = $this->get_restrict_markup($field, 'website');
1231 1231
         $label    = "$field.label";
1232 1232
         echo "
1233 1233
             <div $restrict>
@@ -1241,24 +1241,24 @@  discard block
 block discarded – undo
1241 1241
     /**
1242 1242
      * Renders the website element on the frontend.
1243 1243
      */
1244
-    public function frontend_render_website_template( $field ) {
1244
+    public function frontend_render_website_template($field) {
1245 1245
         
1246 1246
         echo "<div class='form-group'>";
1247 1247
 
1248 1248
         echo aui()->input(
1249 1249
             array(
1250
-                'name'       => esc_attr( $field['id'] ),
1251
-                'id'         => esc_attr( $field['id'] ),
1250
+                'name'       => esc_attr($field['id']),
1251
+                'id'         => esc_attr($field['id']),
1252 1252
                 'required'   => (bool) $field['required'],
1253
-                'label'      => wp_kses_post( $field['label'] ),
1253
+                'label'      => wp_kses_post($field['label']),
1254 1254
                 'no_wrap'    => true,
1255
-                'placeholder' => esc_attr( $field['placeholder'] ),
1255
+                'placeholder' => esc_attr($field['placeholder']),
1256 1256
                 'type'       => 'url',
1257 1257
             )
1258 1258
         );
1259 1259
 
1260
-        if ( ! empty( $field['description'] ) ) {
1261
-            $description = wp_kses_post( $field['description'] );
1260
+        if (!empty($field['description'])) {
1261
+            $description = wp_kses_post($field['description']);
1262 1262
             echo "<small class='form-text text-muted'>$description</small>";
1263 1263
         }
1264 1264
 
@@ -1269,16 +1269,16 @@  discard block
 block discarded – undo
1269 1269
     /**
1270 1270
      * Renders the edit website element template.
1271 1271
      */
1272
-    public function edit_website_template( $field ) {
1273
-        $restrict = $this->get_restrict_markup( $field, 'website' );
1274
-        $label    = __( 'Field Label', 'invoicing' );
1272
+    public function edit_website_template($field) {
1273
+        $restrict = $this->get_restrict_markup($field, 'website');
1274
+        $label    = __('Field Label', 'invoicing');
1275 1275
         $id       = $field . '.id + "_edit"';
1276
-        $label2   = __( 'Placeholder text', 'invoicing' );
1276
+        $label2   = __('Placeholder text', 'invoicing');
1277 1277
         $id2      = $field . '.id + "_edit2"';
1278
-        $label3   = __( 'Help text', 'invoicing' );
1279
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1278
+        $label3   = __('Help text', 'invoicing');
1279
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1280 1280
         $id3      = $field . '.id + "_edit3"';
1281
-        $label5   = __( 'Is this field required?', 'invoicing' );
1281
+        $label5   = __('Is this field required?', 'invoicing');
1282 1282
         $id4      = $field . '.id + "_edit4"';
1283 1283
         echo "
1284 1284
             <div $restrict>
@@ -1306,8 +1306,8 @@  discard block
 block discarded – undo
1306 1306
     /**
1307 1307
      * Renders the date element template.
1308 1308
      */
1309
-    public function render_date_template( $field ) {
1310
-        $restrict = $this->get_restrict_markup( $field, 'date' );
1309
+    public function render_date_template($field) {
1310
+        $restrict = $this->get_restrict_markup($field, 'date');
1311 1311
         $label    = "$field.label";
1312 1312
         echo "
1313 1313
             <div $restrict>
@@ -1321,24 +1321,24 @@  discard block
 block discarded – undo
1321 1321
     /**
1322 1322
      * Renders the date element on the frontend.
1323 1323
      */
1324
-    public function frontend_render_date_template( $field ) {
1324
+    public function frontend_render_date_template($field) {
1325 1325
         
1326 1326
         echo "<div class='form-group'>";
1327 1327
 
1328 1328
         echo aui()->input(
1329 1329
             array(
1330
-                'name'       => esc_attr( $field['id'] ),
1331
-                'id'         => esc_attr( $field['id'] ),
1330
+                'name'       => esc_attr($field['id']),
1331
+                'id'         => esc_attr($field['id']),
1332 1332
                 'required'   => (bool) $field['required'],
1333
-                'label'      => wp_kses_post( $field['label'] ),
1334
-                'placeholder' => esc_attr( $field['placeholder'] ),
1333
+                'label'      => wp_kses_post($field['label']),
1334
+                'placeholder' => esc_attr($field['placeholder']),
1335 1335
                 'no_wrap'    => true,
1336 1336
                 'type'       => 'date',
1337 1337
             )
1338 1338
         );
1339 1339
 
1340
-        if ( ! empty( $field['description'] ) ) {
1341
-            $description = wp_kses_post( $field['description'] );
1340
+        if (!empty($field['description'])) {
1341
+            $description = wp_kses_post($field['description']);
1342 1342
             echo "<small class='form-text text-muted'>$description</small>";
1343 1343
         }
1344 1344
 
@@ -1349,16 +1349,16 @@  discard block
 block discarded – undo
1349 1349
     /**
1350 1350
      * Renders the edit date element template.
1351 1351
      */
1352
-    public function edit_date_template( $field ) {
1353
-        $restrict = $this->get_restrict_markup( $field, 'date' );
1354
-        $label    = __( 'Field Label', 'invoicing' );
1352
+    public function edit_date_template($field) {
1353
+        $restrict = $this->get_restrict_markup($field, 'date');
1354
+        $label    = __('Field Label', 'invoicing');
1355 1355
         $id       = $field . '.id + "_edit"';
1356
-        $label2   = __( 'Placeholder text', 'invoicing' );
1356
+        $label2   = __('Placeholder text', 'invoicing');
1357 1357
         $id2      = $field . '.id + "_edit2"';
1358
-        $label3   = __( 'Help text', 'invoicing' );
1359
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1358
+        $label3   = __('Help text', 'invoicing');
1359
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1360 1360
         $id3      = $field . '.id + "_edit3"';
1361
-        $label5   = __( 'Is this field required?', 'invoicing' );
1361
+        $label5   = __('Is this field required?', 'invoicing');
1362 1362
         $id4      = $field . '.id + "_edit4"';
1363 1363
         echo "
1364 1364
             <div $restrict>
@@ -1386,8 +1386,8 @@  discard block
 block discarded – undo
1386 1386
     /**
1387 1387
      * Renders the time element template.
1388 1388
      */
1389
-    public function render_time_template( $field ) {
1390
-        $restrict = $this->get_restrict_markup( $field, 'time' );
1389
+    public function render_time_template($field) {
1390
+        $restrict = $this->get_restrict_markup($field, 'time');
1391 1391
         $label    = "$field.label";
1392 1392
         echo "
1393 1393
             <div $restrict>
@@ -1401,24 +1401,24 @@  discard block
 block discarded – undo
1401 1401
     /**
1402 1402
      * Renders the time element on the frontend.
1403 1403
      */
1404
-    public function frontend_render_time_template( $field ) {
1404
+    public function frontend_render_time_template($field) {
1405 1405
         
1406 1406
         echo "<div class='form-group'>";
1407 1407
 
1408 1408
         echo aui()->input(
1409 1409
             array(
1410
-                'name'       => esc_attr( $field['id'] ),
1411
-                'id'         => esc_attr( $field['id'] ),
1410
+                'name'       => esc_attr($field['id']),
1411
+                'id'         => esc_attr($field['id']),
1412 1412
                 'required'   => (bool) $field['required'],
1413
-                'label'      => wp_kses_post( $field['label'] ),
1413
+                'label'      => wp_kses_post($field['label']),
1414 1414
                 'no_wrap'    => true,
1415
-                'placeholder' => esc_attr( $field['placeholder'] ),
1415
+                'placeholder' => esc_attr($field['placeholder']),
1416 1416
                 'type'       => 'time',
1417 1417
             )
1418 1418
         );
1419 1419
 
1420
-        if ( ! empty( $field['description'] ) ) {
1421
-            $description = wp_kses_post( $field['description'] );
1420
+        if (!empty($field['description'])) {
1421
+            $description = wp_kses_post($field['description']);
1422 1422
             echo "<small class='form-text text-muted'>$description</small>";
1423 1423
         }
1424 1424
 
@@ -1429,16 +1429,16 @@  discard block
 block discarded – undo
1429 1429
     /**
1430 1430
      * Renders the edit time element template.
1431 1431
      */
1432
-    public function edit_time_template( $field ) {
1433
-        $restrict = $this->get_restrict_markup( $field, 'time' );
1434
-        $label    = __( 'Field Label', 'invoicing' );
1432
+    public function edit_time_template($field) {
1433
+        $restrict = $this->get_restrict_markup($field, 'time');
1434
+        $label    = __('Field Label', 'invoicing');
1435 1435
         $id       = $field . '.id + "_edit"';
1436
-        $label2   = __( 'Placeholder text', 'invoicing' );
1436
+        $label2   = __('Placeholder text', 'invoicing');
1437 1437
         $id2      = $field . '.id + "_edit2"';
1438
-        $label3   = __( 'Help text', 'invoicing' );
1439
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1438
+        $label3   = __('Help text', 'invoicing');
1439
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1440 1440
         $id3      = $field . '.id + "_edit3"';
1441
-        $label5   = __( 'Is this field required?', 'invoicing' );
1441
+        $label5   = __('Is this field required?', 'invoicing');
1442 1442
         $id4      = $field . '.id + "_edit4"';
1443 1443
         echo "
1444 1444
             <div $restrict>
@@ -1466,8 +1466,8 @@  discard block
 block discarded – undo
1466 1466
     /**
1467 1467
      * Renders the number element template.
1468 1468
      */
1469
-    public function render_number_template( $field ) {
1470
-        $restrict = $this->get_restrict_markup( $field, 'number' );
1469
+    public function render_number_template($field) {
1470
+        $restrict = $this->get_restrict_markup($field, 'number');
1471 1471
         $label    = "$field.label";
1472 1472
         echo "
1473 1473
             <div $restrict>
@@ -1481,24 +1481,24 @@  discard block
 block discarded – undo
1481 1481
     /**
1482 1482
      * Renders the number element on the frontend.
1483 1483
      */
1484
-    public function frontend_render_number_template( $field ) {
1484
+    public function frontend_render_number_template($field) {
1485 1485
         
1486 1486
         echo "<div class='form-group'>";
1487 1487
 
1488 1488
         echo aui()->input(
1489 1489
             array(
1490
-                'name'       => esc_attr( $field['id'] ),
1491
-                'id'         => esc_attr( $field['id'] ),
1490
+                'name'       => esc_attr($field['id']),
1491
+                'id'         => esc_attr($field['id']),
1492 1492
                 'required'   => (bool) $field['required'],
1493
-                'label'      => wp_kses_post( $field['label'] ),
1494
-                'placeholder' => esc_attr( $field['placeholder'] ),
1493
+                'label'      => wp_kses_post($field['label']),
1494
+                'placeholder' => esc_attr($field['placeholder']),
1495 1495
                 'no_wrap'    => true,
1496 1496
                 'type'       => 'number',
1497 1497
             )
1498 1498
         );
1499 1499
 
1500
-        if ( ! empty( $field['description'] ) ) {
1501
-            $description = wp_kses_post( $field['description'] );
1500
+        if (!empty($field['description'])) {
1501
+            $description = wp_kses_post($field['description']);
1502 1502
             echo "<small class='form-text text-muted'>$description</small>";
1503 1503
         }
1504 1504
 
@@ -1509,16 +1509,16 @@  discard block
 block discarded – undo
1509 1509
     /**
1510 1510
      * Renders the edit number element template.
1511 1511
      */
1512
-    public function edit_number_template( $field ) {
1513
-        $restrict = $this->get_restrict_markup( $field, 'number' );
1514
-        $label    = __( 'Field Label', 'invoicing' );
1512
+    public function edit_number_template($field) {
1513
+        $restrict = $this->get_restrict_markup($field, 'number');
1514
+        $label    = __('Field Label', 'invoicing');
1515 1515
         $id       = $field . '.id + "_edit"';
1516
-        $label2   = __( 'Placeholder text', 'invoicing' );
1516
+        $label2   = __('Placeholder text', 'invoicing');
1517 1517
         $id2      = $field . '.id + "_edit2"';
1518
-        $label3   = __( 'Help text', 'invoicing' );
1519
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1518
+        $label3   = __('Help text', 'invoicing');
1519
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1520 1520
         $id3      = $field . '.id + "_edit3"';
1521
-        $label5   = __( 'Is this field required?', 'invoicing' );
1521
+        $label5   = __('Is this field required?', 'invoicing');
1522 1522
         $id4      = $field . '.id + "_edit4"';
1523 1523
         echo "
1524 1524
             <div $restrict>
@@ -1546,23 +1546,23 @@  discard block
 block discarded – undo
1546 1546
     /**
1547 1547
      * Renders the separator element template.
1548 1548
      */
1549
-    public function render_separator_template( $field ) {
1550
-        $restrict = $this->get_restrict_markup( $field, 'separator' );
1549
+    public function render_separator_template($field) {
1550
+        $restrict = $this->get_restrict_markup($field, 'separator');
1551 1551
         echo "<hr class='featurette-divider mt-0 mb-2' $restrict>";
1552 1552
     }
1553 1553
 
1554 1554
     /**
1555 1555
      * Renders the separator element on the frontend.
1556 1556
      */
1557
-    public function frontend_render_separator_template( $field ) {
1557
+    public function frontend_render_separator_template($field) {
1558 1558
         echo '<hr class="featurette-divider mt-0 mb-2" />';
1559 1559
     }
1560 1560
 
1561 1561
     /**
1562 1562
      * Renders the pay button element template.
1563 1563
      */
1564
-    public function render_pay_button_template( $field ) {
1565
-        $restrict = $this->get_restrict_markup( $field, 'pay_button' );
1564
+    public function render_pay_button_template($field) {
1565
+        $restrict = $this->get_restrict_markup($field, 'pay_button');
1566 1566
         $label    = "$field.label";
1567 1567
         echo "
1568 1568
             <div $restrict>
@@ -1575,28 +1575,28 @@  discard block
 block discarded – undo
1575 1575
     /**
1576 1576
      * Renders the pay_button element on the frontend.
1577 1577
      */
1578
-    public function frontend_render_pay_button_template( $field ) {
1578
+    public function frontend_render_pay_button_template($field) {
1579 1579
 
1580 1580
         echo "<div class='mt-4 mb-4'>";
1581
-            do_action( 'wpinv_payment_mode_select' );
1581
+            do_action('wpinv_payment_mode_select');
1582 1582
         echo "</div>";
1583 1583
 
1584 1584
         echo "<div class='form-group'>";
1585 1585
 
1586
-        $class = 'wpinv-payment-form-submit btn btn-block submit-button ' . sanitize_html_class( $field['class'] );
1586
+        $class = 'wpinv-payment-form-submit btn btn-block submit-button ' . sanitize_html_class($field['class']);
1587 1587
         echo aui()->input(
1588 1588
             array(
1589
-                'name'       => esc_attr( $field['id'] ),
1590
-                'id'         => esc_attr( $field['id'] ),
1591
-                'value'      => esc_attr( $field['label'] ),
1589
+                'name'       => esc_attr($field['id']),
1590
+                'id'         => esc_attr($field['id']),
1591
+                'value'      => esc_attr($field['label']),
1592 1592
                 'no_wrap'    => true,
1593 1593
                 'type'       => 'submit',
1594 1594
                 'class'      => $class,
1595 1595
             )
1596 1596
         );
1597 1597
 
1598
-        if ( ! empty( $field['description'] ) ) {
1599
-            $description = wp_kses_post( $field['description'] );
1598
+        if (!empty($field['description'])) {
1599
+            $description = wp_kses_post($field['description']);
1600 1600
             echo "<small class='form-text text-muted'>$description</small>";
1601 1601
         }
1602 1602
 
@@ -1607,14 +1607,14 @@  discard block
 block discarded – undo
1607 1607
     /**
1608 1608
      * Renders the pay button element template.
1609 1609
      */
1610
-    public function edit_pay_button_template( $field ) {
1611
-        $restrict = $this->get_restrict_markup( $field, 'pay_button' );
1612
-        $label    = __( 'Button Text', 'invoicing' );
1610
+    public function edit_pay_button_template($field) {
1611
+        $restrict = $this->get_restrict_markup($field, 'pay_button');
1612
+        $label    = __('Button Text', 'invoicing');
1613 1613
         $id       = $field . '.id + "_edit"';
1614
-        $label2   = __( 'Help text', 'invoicing' );
1615
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1614
+        $label2   = __('Help text', 'invoicing');
1615
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
1616 1616
         $id2      = $field . '.id + "_edit2"';
1617
-        $label4   = esc_attr__( 'Button Type', 'invoicing' );
1617
+        $label4   = esc_attr__('Button Type', 'invoicing');
1618 1618
         $id3      = $field . '.id + "_edit3"';
1619 1619
         echo "
1620 1620
             <div $restrict>
@@ -1630,15 +1630,15 @@  discard block
 block discarded – undo
1630 1630
                     <label :for='$id3'>$label4</label>
1631 1631
 
1632 1632
                     <select class='form-control custom-select' :id='$id3' v-model='$field.class'>
1633
-                        <option value='btn-primary'>"   . __( 'Primary', 'invoicing' ) ."</option>
1634
-                        <option value='btn-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option>
1635
-                        <option value='btn-success'>"   . __( 'Success', 'invoicing' ) ."</option>
1636
-                        <option value='btn-danger'>"    . __( 'Danger', 'invoicing' ) ."</option>
1637
-                        <option value='btn-warning'>"   . __( 'Warning', 'invoicing' ) ."</option>
1638
-                        <option value='btn-info'>"      . __( 'Info', 'invoicing' ) ."</option>
1639
-                        <option value='btn-light'>"     . __( 'Light', 'invoicing' ) ."</option>
1640
-                        <option value='btn-dark'>"      . __( 'Dark', 'invoicing' ) ."</option>
1641
-                        <option value='btn-link'>"      . __( 'Link', 'invoicing' ) ."</option>
1633
+                        <option value='btn-primary'>" . __('Primary', 'invoicing') . "</option>
1634
+                        <option value='btn-secondary'>" . __('Secondary', 'invoicing') . "</option>
1635
+                        <option value='btn-success'>"   . __('Success', 'invoicing') . "</option>
1636
+                        <option value='btn-danger'>"    . __('Danger', 'invoicing') . "</option>
1637
+                        <option value='btn-warning'>"   . __('Warning', 'invoicing') . "</option>
1638
+                        <option value='btn-info'>"      . __('Info', 'invoicing') . "</option>
1639
+                        <option value='btn-light'>"     . __('Light', 'invoicing') . "</option>
1640
+                        <option value='btn-dark'>"      . __('Dark', 'invoicing') . "</option>
1641
+                        <option value='btn-link'>"      . __('Link', 'invoicing') . "</option>
1642 1642
                     </select>
1643 1643
                 </div>
1644 1644
             </div>
@@ -1649,8 +1649,8 @@  discard block
 block discarded – undo
1649 1649
     /**
1650 1650
      * Renders the alert element template.
1651 1651
      */
1652
-    public function render_alert_template( $field ) {
1653
-        $restrict = $this->get_restrict_markup( $field, 'alert' );
1652
+    public function render_alert_template($field) {
1653
+        $restrict = $this->get_restrict_markup($field, 'alert');
1654 1654
         $text     = "$field.text";
1655 1655
         echo "
1656 1656
             <div $restrict class='alert' :class='$field.class' role='alert'>
@@ -1665,15 +1665,15 @@  discard block
 block discarded – undo
1665 1665
     /**
1666 1666
      * Renders the alert element on the frontend.
1667 1667
      */
1668
-    public function frontend_render_alert_template( $field ) {
1668
+    public function frontend_render_alert_template($field) {
1669 1669
         
1670 1670
         echo "<div class='form-group'>";
1671 1671
 
1672 1672
         echo aui()->alert(
1673 1673
             array(
1674
-                'content'     => wp_kses_post( $field['text'] ),
1674
+                'content'     => wp_kses_post($field['text']),
1675 1675
                 'dismissible' => $field['dismissible'],
1676
-                'type'        => str_replace( 'alert-', '', $field['class'] ),
1676
+                'type'        => str_replace('alert-', '', $field['class']),
1677 1677
             )
1678 1678
         );
1679 1679
 
@@ -1684,14 +1684,14 @@  discard block
 block discarded – undo
1684 1684
     /**
1685 1685
      * Renders the alert element template.
1686 1686
      */
1687
-    public function edit_alert_template( $field ) {
1688
-        $restrict = $this->get_restrict_markup( $field, 'alert' );
1689
-        $label    = __( 'Alert Text', 'invoicing' );
1690
-        $label2   = esc_attr__( 'Enter your alert text here', 'invoicing' );
1687
+    public function edit_alert_template($field) {
1688
+        $restrict = $this->get_restrict_markup($field, 'alert');
1689
+        $label    = __('Alert Text', 'invoicing');
1690
+        $label2   = esc_attr__('Enter your alert text here', 'invoicing');
1691 1691
         $id       = $field . '.id + "_edit"';
1692
-        $label3   = __( 'Is Dismissible?', 'invoicing' );
1692
+        $label3   = __('Is Dismissible?', 'invoicing');
1693 1693
         $id2      = $field . '.id + "_edit2"';
1694
-        $label4   = esc_attr__( 'Alert Type', 'invoicing' );
1694
+        $label4   = esc_attr__('Alert Type', 'invoicing');
1695 1695
         $id3      = $field . '.id + "_edit3"';
1696 1696
         echo "
1697 1697
             <div $restrict>
@@ -1707,14 +1707,14 @@  discard block
 block discarded – undo
1707 1707
                     <label :for='$id3'>$label4</label>
1708 1708
 
1709 1709
                     <select class='form-control custom-select' :id='$id3' v-model='$field.class'>
1710
-                        <option value='alert-primary'>"   . __( 'Primary', 'invoicing' ) ."</option>
1711
-                        <option value='alert-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option>
1712
-                        <option value='alert-success'>"   . __( 'Success', 'invoicing' ) ."</option>
1713
-                        <option value='alert-danger'>"    . __( 'Danger', 'invoicing' ) ."</option>
1714
-                        <option value='alert-warning'>"   . __( 'Warning', 'invoicing' ) ."</option>
1715
-                        <option value='alert-info'>"      . __( 'Info', 'invoicing' ) ."</option>
1716
-                        <option value='alert-light'>"     . __( 'Light', 'invoicing' ) ."</option>
1717
-                        <option value='alert-dark'>"      . __( 'Dark', 'invoicing' ) ."</option>
1710
+                        <option value='alert-primary'>" . __('Primary', 'invoicing') . "</option>
1711
+                        <option value='alert-secondary'>" . __('Secondary', 'invoicing') . "</option>
1712
+                        <option value='alert-success'>"   . __('Success', 'invoicing') . "</option>
1713
+                        <option value='alert-danger'>"    . __('Danger', 'invoicing') . "</option>
1714
+                        <option value='alert-warning'>"   . __('Warning', 'invoicing') . "</option>
1715
+                        <option value='alert-info'>"      . __('Info', 'invoicing') . "</option>
1716
+                        <option value='alert-light'>"     . __('Light', 'invoicing') . "</option>
1717
+                        <option value='alert-dark'>"      . __('Dark', 'invoicing') . "</option>
1718 1718
                     </select>
1719 1719
                 </div>
1720 1720
             </div>
@@ -1725,8 +1725,8 @@  discard block
 block discarded – undo
1725 1725
     /**
1726 1726
      * Renders the discount element template.
1727 1727
      */
1728
-    public function render_discount_template( $field ) {
1729
-        $restrict  = $this->get_restrict_markup( $field, 'discount' );
1728
+    public function render_discount_template($field) {
1729
+        $restrict = $this->get_restrict_markup($field, 'discount');
1730 1730
         ?>
1731 1731
 
1732 1732
             <div <?php echo $restrict; ?> class="discount_field  border rounded p-3">
@@ -1743,13 +1743,13 @@  discard block
 block discarded – undo
1743 1743
     /**
1744 1744
      * Renders the discount element on the frontend.
1745 1745
      */
1746
-    public function frontend_render_discount_template( $field ) {
1746
+    public function frontend_render_discount_template($field) {
1747 1747
         
1748
-        $placeholder = esc_attr( $field['input_label'] );
1749
-        $label       = sanitize_text_field( $field['button_label'] );
1748
+        $placeholder = esc_attr($field['input_label']);
1749
+        $label       = sanitize_text_field($field['button_label']);
1750 1750
         $description = '';
1751 1751
 
1752
-        if ( ! empty( $field['description'] ) ) {
1752
+        if (!empty($field['description'])) {
1753 1753
             $description = "<small class='form-text text-muted'>{$field['description']}</small>";
1754 1754
         }
1755 1755
 ?>
@@ -1770,12 +1770,12 @@  discard block
 block discarded – undo
1770 1770
     /**
1771 1771
      * Renders the discount element template.
1772 1772
      */
1773
-    public function edit_discount_template( $field ) {
1774
-        $restrict = $this->get_restrict_markup( $field, 'discount' );
1775
-        $label    = __( 'Discount Input Placeholder', 'invoicing' );
1776
-        $label2   = __( 'Help Text', 'invoicing' );
1777
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1778
-        $label4   = __( 'Button Text', 'invoicing' );
1773
+    public function edit_discount_template($field) {
1774
+        $restrict = $this->get_restrict_markup($field, 'discount');
1775
+        $label    = __('Discount Input Placeholder', 'invoicing');
1776
+        $label2   = __('Help Text', 'invoicing');
1777
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
1778
+        $label4   = __('Button Text', 'invoicing');
1779 1779
         $id       = $field . '.id + "_edit"';
1780 1780
         $id2      = $field . '.id + "_edit2"';
1781 1781
         $id3      = $field . '.id + "_edit3"';
@@ -1804,21 +1804,21 @@  discard block
 block discarded – undo
1804 1804
     /**
1805 1805
      * Renders the items element template.
1806 1806
      */
1807
-    public function render_items_template( $field ) {
1808
-        $restrict  = $this->get_restrict_markup( $field, 'items' );
1809
-        $label     = __( 'Item totals will appear here. Click to set items.', 'invoicing' );
1807
+    public function render_items_template($field) {
1808
+        $restrict  = $this->get_restrict_markup($field, 'items');
1809
+        $label     = __('Item totals will appear here. Click to set items.', 'invoicing');
1810 1810
         echo "<div $restrict class='item_totals p-4 bg-warning text-center'>$label</div>";
1811 1811
     }
1812 1812
 
1813 1813
     /**
1814 1814
      * Renders the items element on the frontend.
1815 1815
      */
1816
-    public function frontend_render_items_template( $field, $items ) {
1816
+    public function frontend_render_items_template($field, $items) {
1817 1817
         
1818 1818
         echo "<div class='form-group item_totals'>";
1819 1819
         
1820
-        $id = esc_attr( $field['id'] );
1821
-        if ( 'total' == $field[ 'items_type' ] ) {
1820
+        $id = esc_attr($field['id']);
1821
+        if ('total' == $field['items_type']) {
1822 1822
             $total     = 0;
1823 1823
             $tax       = 0;
1824 1824
             $sub_total = 0;
@@ -1827,16 +1827,16 @@  discard block
 block discarded – undo
1827 1827
             <div class="border item_totals_type_total">
1828 1828
 
1829 1829
                 <?php
1830
-                    foreach( $items as $item ) {
1830
+                    foreach ($items as $item) {
1831 1831
 
1832
-                        $amount = floatval( $item['price'] );
1832
+                        $amount = floatval($item['price']);
1833 1833
 
1834
-                        if ( wpinv_use_taxes() ) {
1834
+                        if (wpinv_use_taxes()) {
1835 1835
 
1836
-                            $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] );
1836
+                            $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']);
1837 1837
 
1838
-                            if ( wpinv_prices_include_tax() ) {
1839
-                                $pre_tax  = ( $amount - $amount * $rate * 0.01 );
1838
+                            if (wpinv_prices_include_tax()) {
1839
+                                $pre_tax  = ($amount - $amount * $rate * 0.01);
1840 1840
                                 $item_tax = $amount - $pre_tax;
1841 1841
                             } else {
1842 1842
                                 $pre_tax  = $amount;
@@ -1848,27 +1848,27 @@  discard block
 block discarded – undo
1848 1848
                             $total     = $sub_total + $tax;
1849 1849
 
1850 1850
                         } else {
1851
-                            $total  = $total + $amount;
1851
+                            $total = $total + $amount;
1852 1852
                         }
1853 1853
 
1854 1854
                         $class  = 'col-8';
1855 1855
                         $class2 = '';
1856 1856
 
1857
-                        if ( ! empty( $item['allow_quantities'] ) ) {
1857
+                        if (!empty($item['allow_quantities'])) {
1858 1858
                             $class = 'col-6 pt-2';
1859 1859
                             $class2 = 'pt-2';
1860 1860
                         }
1861 1861
 
1862
-                        if ( ! empty( $item['custom_price'] ) ) {
1862
+                        if (!empty($item['custom_price'])) {
1863 1863
                             $class .= ' pt-2';
1864 1864
                         }
1865 1865
             
1866 1866
                 ?>
1867 1867
                     <div  class="item_totals_item">
1868 1868
                         <div class='row pl-2 pr-2 pt-2'>
1869
-                            <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div>
1869
+                            <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div>
1870 1870
 
1871
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
1871
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
1872 1872
 
1873 1873
                                 <div class='col-2'>
1874 1874
                                     <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required>
@@ -1876,11 +1876,11 @@  discard block
 block discarded – undo
1876 1876
 
1877 1877
                             <?php } else { ?>
1878 1878
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
1879
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
1879
+                            <?php } if (empty($item['custom_price'])) { ?>
1880 1880
 
1881 1881
                                 <div class='col-4 <?php echo $class2; ?>'>
1882
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
1883
-                                    <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
1882
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
1883
+                                    <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
1884 1884
                                 </div>
1885 1885
 
1886 1886
                             <?php } else {?>
@@ -1888,15 +1888,15 @@  discard block
 block discarded – undo
1888 1888
                                 <div class='col-4'>
1889 1889
                                     <div class='input-group'>
1890 1890
 
1891
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
1891
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
1892 1892
                                             <div class='input-group-prepend'>
1893 1893
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
1894 1894
                                             </div>
1895 1895
                                         <?php } ?>
1896 1896
 
1897
-                                        <input type='number' name='wpinv-items[<?php echo (int) $item['id']; ?>]' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'>
1897
+                                        <input type='number' name='wpinv-items[<?php echo (int) $item['id']; ?>]' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'>
1898 1898
                                     
1899
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
1899
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
1900 1900
                                             <div class='input-group-append'>
1901 1901
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
1902 1902
                                             </div>
@@ -1907,28 +1907,28 @@  discard block
 block discarded – undo
1907 1907
                             <?php } ?>
1908 1908
 
1909 1909
                         </div>
1910
-                        <?php if ( ! empty( $item['description'] )) { ?>
1911
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
1910
+                        <?php if (!empty($item['description'])) { ?>
1911
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
1912 1912
                         <?php } ?>
1913 1913
                     </div>
1914 1914
                 <?php } ?>
1915 1915
 
1916 1916
                 <div class='mt-4 border-top item_totals_total p-2'>
1917 1917
 
1918
-                    <?php if ( wpinv_use_taxes() ) { ?>
1918
+                    <?php if (wpinv_use_taxes()) { ?>
1919 1919
                         <div class='row'>
1920
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div>
1921
-                            <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div>
1920
+                            <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div>
1921
+                            <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div>
1922 1922
                         </div>
1923 1923
                         <div class='row'>
1924
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div>
1925
-                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div>
1924
+                            <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div>
1925
+                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div>
1926 1926
                         </div>
1927 1927
                     <?php } ?>
1928 1928
 
1929 1929
                     <div class='row'>
1930
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
1931
-                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
1930
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
1931
+                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
1932 1932
                     </div>
1933 1933
 
1934 1934
                 </div>
@@ -1936,22 +1936,22 @@  discard block
 block discarded – undo
1936 1936
             </div>
1937 1937
         <?php } ?>
1938 1938
 
1939
-        <?php if ( 'radio' == $field[ 'items_type' ] ) { ?>
1939
+        <?php if ('radio' == $field['items_type']) { ?>
1940 1940
             <div class="item_totals_type_radio">
1941 1941
 
1942 1942
                 <?php
1943
-                    foreach( $items as $index => $item ) {
1943
+                    foreach ($items as $index => $item) {
1944 1944
 
1945
-                        if ( ! empty( $item['required'] ) ) {
1945
+                        if (!empty($item['required'])) {
1946 1946
                             continue;
1947 1947
                         }
1948 1948
                 ?>
1949 1949
                     <div  class="form-check">
1950
-                        <input class='form-check-input wpinv-items-selector' <?php checked( ! isset( $selected_radio_item ) ); $selected_radio_item = 1; ?> type='radio' value='<?php echo $item['id']; ?>' id='<?php echo $id . $index; ?>' name='wpinv-payment-form-selected-item'>
1951
-                        <label class='form-check-label' for='<?php echo $id . $index; ?>'><?php echo sanitize_text_field( $item['title'] ); ?>&nbsp;<strong><?php echo wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) ); ?></strong></label>
1950
+                        <input class='form-check-input wpinv-items-selector' <?php checked(!isset($selected_radio_item)); $selected_radio_item = 1; ?> type='radio' value='<?php echo $item['id']; ?>' id='<?php echo $id . $index; ?>' name='wpinv-payment-form-selected-item'>
1951
+                        <label class='form-check-label' for='<?php echo $id . $index; ?>'><?php echo sanitize_text_field($item['title']); ?>&nbsp;<strong><?php echo wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); ?></strong></label>
1952 1952
                     </div>
1953
-                    <?php if ( ! empty( $item['description'] )) { ?>
1954
-                        <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
1953
+                    <?php if (!empty($item['description'])) { ?>
1954
+                        <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
1955 1955
                     <?php } ?>
1956 1956
                 <?php } ?>
1957 1957
 
@@ -1963,32 +1963,32 @@  discard block
 block discarded – undo
1963 1963
                         $tax       = 0;
1964 1964
                         $sub_total = 0;
1965 1965
 
1966
-                        foreach ( $items as $item ) {
1966
+                        foreach ($items as $item) {
1967 1967
 
1968 1968
                             $class  = 'col-8';
1969 1969
                             $class2 = '';
1970 1970
 
1971
-                            if ( ! empty( $item['allow_quantities'] ) ) {
1971
+                            if (!empty($item['allow_quantities'])) {
1972 1972
                                 $class = 'col-6 pt-2';
1973 1973
                                 $class2 = 'pt-2';
1974 1974
                             }
1975 1975
 
1976
-                            if ( ! empty( $item['custom_price'] ) ) {
1976
+                            if (!empty($item['custom_price'])) {
1977 1977
                                 $class .= ' pt-2';
1978 1978
                             }
1979 1979
 
1980 1980
                             $class3 = 'd-none';
1981 1981
                             $name   = '';
1982
-                            if ( ! empty( $item['required'] ) || ! isset( $totals_selected_radio_item ) ) {
1982
+                            if (!empty($item['required']) || !isset($totals_selected_radio_item)) {
1983 1983
 
1984
-                                $amount = floatval( $item['price'] );
1984
+                                $amount = floatval($item['price']);
1985 1985
 
1986
-                                if ( wpinv_use_taxes() ) {
1986
+                                if (wpinv_use_taxes()) {
1987 1987
 
1988
-                                    $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] );
1988
+                                    $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']);
1989 1989
 
1990
-                                    if ( wpinv_prices_include_tax() ) {
1991
-                                        $pre_tax  = ( $amount - $amount * $rate * 0.01 );
1990
+                                    if (wpinv_prices_include_tax()) {
1991
+                                        $pre_tax  = ($amount - $amount * $rate * 0.01);
1992 1992
                                         $item_tax = $amount - $pre_tax;
1993 1993
                                     } else {
1994 1994
                                         $pre_tax  = $amount;
@@ -2000,13 +2000,13 @@  discard block
 block discarded – undo
2000 2000
                                     $total     = $sub_total + $tax;
2001 2001
 
2002 2002
                                 } else {
2003
-                                    $total  = $total + $amount;
2003
+                                    $total = $total + $amount;
2004 2004
                                 }
2005 2005
 
2006 2006
                                 $class3 = '';
2007 2007
                                 $name   = "wpinv-items[{$item['id']}]";
2008 2008
 
2009
-                                if ( empty( $item['required'] ) ) {
2009
+                                if (empty($item['required'])) {
2010 2010
                                     $totals_selected_radio_item = 1;
2011 2011
                                 }
2012 2012
 
@@ -2018,9 +2018,9 @@  discard block
 block discarded – undo
2018 2018
 
2019 2019
                     <div  class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>">
2020 2020
                         <div class='row pl-2 pr-2 pt-2'>
2021
-                            <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div>
2021
+                            <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div>
2022 2022
 
2023
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
2023
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
2024 2024
 
2025 2025
                                 <div class='col-2'>
2026 2026
                                     <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required>
@@ -2028,11 +2028,11 @@  discard block
 block discarded – undo
2028 2028
 
2029 2029
                             <?php } else { ?>
2030 2030
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
2031
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
2031
+                            <?php } if (empty($item['custom_price'])) { ?>
2032 2032
 
2033 2033
                                 <div class='col-4 <?php echo $class2; ?>'>
2034
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
2035
-                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
2034
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
2035
+                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
2036 2036
                                 </div>
2037 2037
 
2038 2038
                             <?php } else {?>
@@ -2040,15 +2040,15 @@  discard block
 block discarded – undo
2040 2040
                                 <div class='col-4'>
2041 2041
                                     <div class='input-group'>
2042 2042
 
2043
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
2043
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
2044 2044
                                             <div class='input-group-prepend'>
2045 2045
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2046 2046
                                             </div>
2047 2047
                                         <?php } ?>
2048 2048
 
2049
-                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'>
2049
+                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'>
2050 2050
                                     
2051
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
2051
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
2052 2052
                                             <div class='input-group-append'>
2053 2053
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2054 2054
                                             </div>
@@ -2059,27 +2059,27 @@  discard block
 block discarded – undo
2059 2059
                             <?php } ?>
2060 2060
 
2061 2061
                         </div>
2062
-                        <?php if ( ! empty( $item['description'] )) { ?>
2063
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
2062
+                        <?php if (!empty($item['description'])) { ?>
2063
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
2064 2064
                         <?php } ?>
2065 2065
                     </div>
2066 2066
                 <?php } ?>
2067 2067
 
2068 2068
                 <div class='mt-4 border-top item_totals_total p-2'>
2069
-                    <?php if ( wpinv_use_taxes() ) { ?>
2069
+                    <?php if (wpinv_use_taxes()) { ?>
2070 2070
                         <div class='row'>
2071
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div>
2072
-                            <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div>
2071
+                            <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div>
2072
+                            <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div>
2073 2073
                         </div>
2074 2074
                         <div class='row'>
2075
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div>
2076
-                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div>
2075
+                            <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div>
2076
+                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div>
2077 2077
                         </div>
2078 2078
                     <?php } ?>
2079 2079
 
2080 2080
                     <div class='row'>
2081
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
2082
-                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
2081
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
2082
+                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
2083 2083
                     </div>
2084 2084
                 </div>
2085 2085
 
@@ -2087,22 +2087,22 @@  discard block
 block discarded – undo
2087 2087
             </div>
2088 2088
         <?php } ?>
2089 2089
 
2090
-        <?php if ( 'checkbox' == $field[ 'items_type' ] ) { ?>
2090
+        <?php if ('checkbox' == $field['items_type']) { ?>
2091 2091
 
2092 2092
             <div class="item_totals_type_checkbox">
2093 2093
 
2094 2094
                 <?php
2095
-                    foreach ( $items as $index => $item ) {
2095
+                    foreach ($items as $index => $item) {
2096 2096
 
2097
-                        if ( ! empty( $item['required'] ) ) {
2097
+                        if (!empty($item['required'])) {
2098 2098
                             continue;
2099 2099
                         }
2100 2100
 
2101
-                        $title = sanitize_text_field(  $item['title'] );
2102
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
2103
-                        $item_id    = esc_attr( $id . "_$index" );
2104
-                        $value = esc_attr( $item['id'] );
2105
-                        $checked = checked( ! isset( $selected_checkbox_item ), true, false );
2101
+                        $title = sanitize_text_field($item['title']);
2102
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
2103
+                        $item_id = esc_attr($id . "_$index");
2104
+                        $value = esc_attr($item['id']);
2105
+                        $checked = checked(!isset($selected_checkbox_item), true, false);
2106 2106
                         $selected_checkbox_item = 1;
2107 2107
 
2108 2108
                         echo "
@@ -2111,7 +2111,7 @@  discard block
 block discarded – undo
2111 2111
                                 <label for='$item_id' class='custom-control-label'>$title &nbsp; ($price)</label>
2112 2112
                             </div>";
2113 2113
 
2114
-                        if ( ! empty( $item['description'] ) ) {
2114
+                        if (!empty($item['description'])) {
2115 2115
                             echo "<small class='form-text text-muted'>{$item['description']}</small>";
2116 2116
                         }
2117 2117
                     }
@@ -2125,31 +2125,31 @@  discard block
 block discarded – undo
2125 2125
                         $tax       = 0;
2126 2126
                         $sub_total = 0;
2127 2127
 
2128
-                        foreach ( $items as $item ) {
2128
+                        foreach ($items as $item) {
2129 2129
 
2130 2130
                             $class  = 'col-8';
2131 2131
                             $class2 = '';
2132 2132
 
2133
-                            if ( ! empty( $item['allow_quantities'] ) ) {
2133
+                            if (!empty($item['allow_quantities'])) {
2134 2134
                                 $class = 'col-6 pt-2';
2135 2135
                                 $class2 = 'pt-2';
2136 2136
                             }
2137 2137
 
2138
-                            if ( ! empty( $item['custom_price'] ) ) {
2138
+                            if (!empty($item['custom_price'])) {
2139 2139
                                 $class .= ' pt-2';
2140 2140
                             }
2141 2141
 
2142 2142
                             $class3 = 'd-none';
2143
-                            $name  = '';
2144
-                            if ( ! empty( $item['required'] ) || ! isset( $totals_selected_checkbox_item ) ) {
2143
+                            $name = '';
2144
+                            if (!empty($item['required']) || !isset($totals_selected_checkbox_item)) {
2145 2145
 
2146
-                                $amount = floatval( $item['price'] );
2147
-                                if ( wpinv_use_taxes() ) {
2146
+                                $amount = floatval($item['price']);
2147
+                                if (wpinv_use_taxes()) {
2148 2148
 
2149
-                                    $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] );
2149
+                                    $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']);
2150 2150
 
2151
-                                    if ( wpinv_prices_include_tax() ) {
2152
-                                        $pre_tax  = ( $amount - $amount * $rate * 0.01 );
2151
+                                    if (wpinv_prices_include_tax()) {
2152
+                                        $pre_tax  = ($amount - $amount * $rate * 0.01);
2153 2153
                                         $item_tax = $amount - $pre_tax;
2154 2154
                                     } else {
2155 2155
                                         $pre_tax  = $amount;
@@ -2161,13 +2161,13 @@  discard block
 block discarded – undo
2161 2161
                                     $total     = $sub_total + $tax;
2162 2162
 
2163 2163
                                 } else {
2164
-                                    $total  = $total + $amount;
2164
+                                    $total = $total + $amount;
2165 2165
                                 }
2166 2166
 
2167 2167
                                 $class3 = '';
2168
-                                $name  = "wpinv-items[{$item['id']}]";
2168
+                                $name = "wpinv-items[{$item['id']}]";
2169 2169
 
2170
-                                if ( empty( $item['required'] ) ) {
2170
+                                if (empty($item['required'])) {
2171 2171
                                     $totals_selected_checkbox_item = 1;
2172 2172
                                 }
2173 2173
 
@@ -2179,9 +2179,9 @@  discard block
 block discarded – undo
2179 2179
 
2180 2180
                     <div  class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>">
2181 2181
                         <div class='row pl-2 pr-2 pt-2'>
2182
-                            <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div>
2182
+                            <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div>
2183 2183
 
2184
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
2184
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
2185 2185
 
2186 2186
                                 <div class='col-2'>
2187 2187
                                     <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required>
@@ -2189,11 +2189,11 @@  discard block
 block discarded – undo
2189 2189
 
2190 2190
                             <?php } else { ?>
2191 2191
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
2192
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
2192
+                            <?php } if (empty($item['custom_price'])) { ?>
2193 2193
 
2194 2194
                                 <div class='col-4 <?php echo $class2; ?>'>
2195
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
2196
-                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
2195
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
2196
+                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
2197 2197
                                 </div>
2198 2198
 
2199 2199
                             <?php } else {?>
@@ -2201,15 +2201,15 @@  discard block
 block discarded – undo
2201 2201
                                 <div class='col-4'>
2202 2202
                                     <div class='input-group'>
2203 2203
 
2204
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
2204
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
2205 2205
                                             <div class='input-group-prepend'>
2206 2206
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2207 2207
                                             </div>
2208 2208
                                         <?php } ?>
2209 2209
 
2210
-                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'>
2210
+                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'>
2211 2211
                                     
2212
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
2212
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
2213 2213
                                             <div class='input-group-append'>
2214 2214
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2215 2215
                                             </div>
@@ -2220,35 +2220,35 @@  discard block
 block discarded – undo
2220 2220
                             <?php } ?>
2221 2221
 
2222 2222
                         </div>
2223
-                        <?php if ( ! empty( $item['description'] )) { ?>
2224
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
2223
+                        <?php if (!empty($item['description'])) { ?>
2224
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
2225 2225
                         <?php } ?>
2226 2226
                     </div>
2227 2227
                 <?php } ?>
2228 2228
 
2229 2229
                 <div class='mt-4 border-top item_totals_total p-2'>
2230 2230
 
2231
-                    <?php if ( wpinv_use_taxes() ) { ?>
2231
+                    <?php if (wpinv_use_taxes()) { ?>
2232 2232
                         <div class='row'>
2233
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div>
2234
-                            <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div>
2233
+                            <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div>
2234
+                            <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div>
2235 2235
                         </div>
2236 2236
                         <div class='row'>
2237
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div>
2238
-                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div>
2237
+                            <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div>
2238
+                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div>
2239 2239
                         </div>
2240 2240
                     <?php } ?>
2241 2241
 
2242 2242
                     <div class='row'>
2243
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
2244
-                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
2243
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
2244
+                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
2245 2245
                     </div>
2246 2246
                 </div>
2247 2247
             </div>
2248 2248
             </div>
2249 2249
         <?php } ?>
2250 2250
 
2251
-        <?php if ( 'select' == $field[ 'items_type' ] ) { ?>
2251
+        <?php if ('select' == $field['items_type']) { ?>
2252 2252
 
2253 2253
             <div class="item_totals_type_select">
2254 2254
 
@@ -2256,17 +2256,17 @@  discard block
 block discarded – undo
2256 2256
 
2257 2257
                     $options  = array();
2258 2258
                     $selected = '';
2259
-                    foreach ( $items as $index => $item ) {
2259
+                    foreach ($items as $index => $item) {
2260 2260
 
2261
-                        if ( ! empty( $item['required'] ) ) {
2261
+                        if (!empty($item['required'])) {
2262 2262
                             continue;
2263 2263
                         }
2264 2264
 
2265
-                        $title = sanitize_text_field(  $item['title'] );
2266
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
2267
-                        $options[ $item['id'] ] = "$title &nbsp; ($price)";
2265
+                        $title = sanitize_text_field($item['title']);
2266
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
2267
+                        $options[$item['id']] = "$title &nbsp; ($price)";
2268 2268
 
2269
-                        if ( ! isset( $selected_item ) ) {
2269
+                        if (!isset($selected_item)) {
2270 2270
                             $selected = $item['id'];
2271 2271
                             $selected_item = 1;
2272 2272
                         }
@@ -2277,7 +2277,7 @@  discard block
 block discarded – undo
2277 2277
                         array(
2278 2278
                                 'name'        => 'payment-form-items',
2279 2279
                                 'id'          => $id,
2280
-                                'placeholder' => __( 'Select an item', 'invoicing' ),
2280
+                                'placeholder' => __('Select an item', 'invoicing'),
2281 2281
                                 'no_wrap'     => true,
2282 2282
                                 'options'     => $options,
2283 2283
                                 'class'       => 'wpi_select2 wpinv-items-select-selector',
@@ -2294,31 +2294,31 @@  discard block
 block discarded – undo
2294 2294
                         $tax       = 0;
2295 2295
                         $sub_total = 0;
2296 2296
 
2297
-                        foreach ( $items as $item ) {
2297
+                        foreach ($items as $item) {
2298 2298
 
2299 2299
                             $class  = 'col-8';
2300 2300
                             $class2 = '';
2301 2301
 
2302
-                            if ( ! empty( $item['allow_quantities'] ) ) {
2302
+                            if (!empty($item['allow_quantities'])) {
2303 2303
                                 $class = 'col-6 pt-2';
2304 2304
                                 $class2 = 'pt-2';
2305 2305
                             }
2306 2306
 
2307
-                            if ( ! empty( $item['custom_price'] ) ) {
2307
+                            if (!empty($item['custom_price'])) {
2308 2308
                                 $class .= ' pt-2';
2309 2309
                             }
2310 2310
 
2311 2311
                             $class3 = 'd-none';
2312
-                            $name  = '';
2313
-                            if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) {
2312
+                            $name = '';
2313
+                            if (!empty($item['required']) || !isset($totals_selected_select_item)) {
2314 2314
 
2315
-                                $amount = floatval( $item['price'] );
2316
-                                if ( wpinv_use_taxes() ) {
2315
+                                $amount = floatval($item['price']);
2316
+                                if (wpinv_use_taxes()) {
2317 2317
 
2318
-                                    $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] );
2318
+                                    $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']);
2319 2319
 
2320
-                                    if ( wpinv_prices_include_tax() ) {
2321
-                                        $pre_tax  = ( $amount - $amount * $rate * 0.01 );
2320
+                                    if (wpinv_prices_include_tax()) {
2321
+                                        $pre_tax  = ($amount - $amount * $rate * 0.01);
2322 2322
                                         $item_tax = $amount - $pre_tax;
2323 2323
                                     } else {
2324 2324
                                         $pre_tax  = $amount;
@@ -2330,13 +2330,13 @@  discard block
 block discarded – undo
2330 2330
                                     $total     = $sub_total + $tax;
2331 2331
 
2332 2332
                                 } else {
2333
-                                    $total  = $total + $amount;
2333
+                                    $total = $total + $amount;
2334 2334
                                 }
2335 2335
 
2336 2336
                                 $class3 = '';
2337
-                                $name  = "wpinv-items[{$item['id']}]";
2337
+                                $name = "wpinv-items[{$item['id']}]";
2338 2338
 
2339
-                                if ( empty( $item['required'] ) ) {
2339
+                                if (empty($item['required'])) {
2340 2340
                                     $totals_selected_select_item = 1;
2341 2341
                                 }
2342 2342
 
@@ -2348,9 +2348,9 @@  discard block
 block discarded – undo
2348 2348
 
2349 2349
                     <div  class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>">
2350 2350
                         <div class='row pl-2 pr-2 pt-2'>
2351
-                            <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div>
2351
+                            <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div>
2352 2352
 
2353
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
2353
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
2354 2354
 
2355 2355
                                 <div class='col-2'>
2356 2356
                                     <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required>
@@ -2358,11 +2358,11 @@  discard block
 block discarded – undo
2358 2358
 
2359 2359
                             <?php } else { ?>
2360 2360
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
2361
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
2361
+                            <?php } if (empty($item['custom_price'])) { ?>
2362 2362
 
2363 2363
                                 <div class='col-4 <?php echo $class2; ?>'>
2364
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
2365
-                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
2364
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
2365
+                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
2366 2366
                                 </div>
2367 2367
 
2368 2368
                             <?php } else {?>
@@ -2370,15 +2370,15 @@  discard block
 block discarded – undo
2370 2370
                                 <div class='col-4'>
2371 2371
                                     <div class='input-group'>
2372 2372
 
2373
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
2373
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
2374 2374
                                             <div class='input-group-prepend'>
2375 2375
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2376 2376
                                             </div>
2377 2377
                                         <?php } ?>
2378 2378
 
2379
-                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'>
2379
+                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'>
2380 2380
                                     
2381
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
2381
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
2382 2382
                                             <div class='input-group-append'>
2383 2383
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2384 2384
                                             </div>
@@ -2389,34 +2389,34 @@  discard block
 block discarded – undo
2389 2389
                             <?php } ?>
2390 2390
 
2391 2391
                         </div>
2392
-                        <?php if ( ! empty( $item['description'] )) { ?>
2393
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
2392
+                        <?php if (!empty($item['description'])) { ?>
2393
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
2394 2394
                         <?php } ?>
2395 2395
                     </div>
2396 2396
                 <?php } ?>
2397 2397
 
2398 2398
                 <div class='mt-4 border-top item_totals_total p-2'>
2399 2399
 
2400
-                    <?php if ( wpinv_use_taxes() ) { ?>
2400
+                    <?php if (wpinv_use_taxes()) { ?>
2401 2401
                         <div class='row'>
2402
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div>
2403
-                            <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div>
2402
+                            <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div>
2403
+                            <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div>
2404 2404
                         </div>
2405 2405
                         <div class='row'>
2406
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div>
2407
-                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div>
2406
+                            <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div>
2407
+                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div>
2408 2408
                         </div>
2409 2409
                     <?php } ?>
2410 2410
                     <div class='row'>
2411
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
2412
-                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
2411
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
2412
+                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
2413 2413
                     </div>
2414 2414
                 </div>
2415 2415
 
2416 2416
             </div>
2417 2417
         <?php } ?>
2418 2418
 
2419
-        <?php if ( 'multi_select' == $field[ 'items_type' ] ) { ?>
2419
+        <?php if ('multi_select' == $field['items_type']) { ?>
2420 2420
 
2421 2421
             <div class="item_totals_type_multi_select">
2422 2422
 
@@ -2425,18 +2425,18 @@  discard block
 block discarded – undo
2425 2425
                     $options  = array();
2426 2426
                     $selected = array();
2427 2427
 
2428
-                    foreach ( $items as $index => $item ) {
2428
+                    foreach ($items as $index => $item) {
2429 2429
 
2430
-                        if ( ! empty( $item['required'] ) ) {
2430
+                        if (!empty($item['required'])) {
2431 2431
                             continue;
2432 2432
                         }
2433 2433
 
2434
-                        $title = sanitize_text_field(  $item['title'] );
2435
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
2436
-                        $options[ $item['id'] ] = "$title &nbsp; ($price)";
2434
+                        $title = sanitize_text_field($item['title']);
2435
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
2436
+                        $options[$item['id']] = "$title &nbsp; ($price)";
2437 2437
 
2438
-                        if ( ! isset( $selected_item ) ) {
2439
-                            $selected = array( $item['id'] );
2438
+                        if (!isset($selected_item)) {
2439
+                            $selected = array($item['id']);
2440 2440
                             $selected_item = 1;
2441 2441
                         }
2442 2442
 
@@ -2463,31 +2463,31 @@  discard block
 block discarded – undo
2463 2463
                         $tax       = 0;
2464 2464
                         $sub_total = 0;
2465 2465
 
2466
-                        foreach ( $items as $item ) {
2466
+                        foreach ($items as $item) {
2467 2467
 
2468 2468
                             $class  = 'col-8';
2469 2469
                             $class2 = '';
2470 2470
 
2471
-                            if ( ! empty( $item['allow_quantities'] ) ) {
2471
+                            if (!empty($item['allow_quantities'])) {
2472 2472
                                 $class = 'col-6 pt-2';
2473 2473
                                 $class2 = 'pt-2';
2474 2474
                             }
2475 2475
 
2476
-                            if ( ! empty( $item['custom_price'] ) ) {
2476
+                            if (!empty($item['custom_price'])) {
2477 2477
                                 $class .= ' pt-2';
2478 2478
                             }
2479 2479
 
2480 2480
                             $class3 = 'd-none';
2481
-                            $name  = '';
2482
-                            if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) {
2481
+                            $name = '';
2482
+                            if (!empty($item['required']) || !isset($totals_selected_select_item)) {
2483 2483
 
2484
-                                $amount = floatval( $item['price'] );
2485
-                                if ( wpinv_use_taxes() ) {
2484
+                                $amount = floatval($item['price']);
2485
+                                if (wpinv_use_taxes()) {
2486 2486
 
2487
-                                    $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] );
2487
+                                    $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']);
2488 2488
 
2489
-                                    if ( wpinv_prices_include_tax() ) {
2490
-                                        $pre_tax  = ( $amount - $amount * $rate * 0.01 );
2489
+                                    if (wpinv_prices_include_tax()) {
2490
+                                        $pre_tax  = ($amount - $amount * $rate * 0.01);
2491 2491
                                         $item_tax = $amount - $pre_tax;
2492 2492
                                     } else {
2493 2493
                                         $pre_tax  = $amount;
@@ -2499,13 +2499,13 @@  discard block
 block discarded – undo
2499 2499
                                     $total     = $sub_total + $tax;
2500 2500
 
2501 2501
                                 } else {
2502
-                                    $total  = $total + $amount;
2502
+                                    $total = $total + $amount;
2503 2503
                                 }
2504 2504
 
2505 2505
                                 $class3 = '';
2506
-                                $name  = "wpinv-items[{$item['id']}]";
2506
+                                $name = "wpinv-items[{$item['id']}]";
2507 2507
 
2508
-                                if ( empty( $item['required'] ) ) {
2508
+                                if (empty($item['required'])) {
2509 2509
                                     $totals_selected_select_item = 1;
2510 2510
                                 }
2511 2511
 
@@ -2517,9 +2517,9 @@  discard block
 block discarded – undo
2517 2517
 
2518 2518
                     <div  class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>">
2519 2519
                         <div class='row pl-2 pr-2 pt-2'>
2520
-                            <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div>
2520
+                            <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div>
2521 2521
 
2522
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
2522
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
2523 2523
 
2524 2524
                                 <div class='col-2'>
2525 2525
                                     <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required>
@@ -2527,11 +2527,11 @@  discard block
 block discarded – undo
2527 2527
 
2528 2528
                             <?php } else { ?>
2529 2529
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
2530
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
2530
+                            <?php } if (empty($item['custom_price'])) { ?>
2531 2531
 
2532 2532
                                 <div class='col-4 <?php echo $class2; ?>'>
2533
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
2534
-                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
2533
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
2534
+                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
2535 2535
                                 </div>
2536 2536
 
2537 2537
                             <?php } else {?>
@@ -2539,15 +2539,15 @@  discard block
 block discarded – undo
2539 2539
                                 <div class='col-4'>
2540 2540
                                     <div class='input-group'>
2541 2541
 
2542
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
2542
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
2543 2543
                                             <div class='input-group-prepend'>
2544 2544
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2545 2545
                                             </div>
2546 2546
                                         <?php } ?>
2547 2547
 
2548
-                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'>
2548
+                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'>
2549 2549
                                     
2550
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
2550
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
2551 2551
                                             <div class='input-group-append'>
2552 2552
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2553 2553
                                             </div>
@@ -2558,35 +2558,35 @@  discard block
 block discarded – undo
2558 2558
                             <?php } ?>
2559 2559
 
2560 2560
                         </div>
2561
-                        <?php if ( ! empty( $item['description'] )) { ?>
2562
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
2561
+                        <?php if (!empty($item['description'])) { ?>
2562
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
2563 2563
                         <?php } ?>
2564 2564
                     </div>
2565 2565
                 <?php } ?>
2566 2566
 
2567 2567
                 <div class='mt-4 border-top item_totals_total p-2'>
2568 2568
 
2569
-                    <?php if ( wpinv_use_taxes() ) { ?>
2569
+                    <?php if (wpinv_use_taxes()) { ?>
2570 2570
                         <div class='row'>
2571
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div>
2572
-                            <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div>
2571
+                            <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div>
2572
+                            <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div>
2573 2573
                         </div>
2574 2574
                         <div class='row'>
2575
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div>
2576
-                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div>
2575
+                            <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div>
2576
+                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div>
2577 2577
                         </div>
2578 2578
                     <?php } ?>
2579 2579
 
2580 2580
                     <div class='row'>
2581
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
2582
-                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
2581
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
2582
+                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
2583 2583
                     </div>
2584 2584
                 </div>
2585 2585
 
2586 2586
             </div>
2587 2587
         <?php } ?>
2588
-        <?php if ( ! empty( $field[ 'description' ] ) ) { ?>
2589
-            <small class='form-text text-muted'><?php echo wp_kses_post( $field[ 'description' ] ); ?></small>
2588
+        <?php if (!empty($field['description'])) { ?>
2589
+            <small class='form-text text-muted'><?php echo wp_kses_post($field['description']); ?></small>
2590 2590
         <?php } ?>
2591 2591
         </div>
2592 2592
         <?php
@@ -2595,20 +2595,20 @@  discard block
 block discarded – undo
2595 2595
     /**
2596 2596
      * Renders the items element template.
2597 2597
      */
2598
-    public function edit_items_template( $field ) {
2599
-        $restrict = $this->get_restrict_markup( $field, 'items' );
2600
-        $label    = __( 'Let customers...', 'invoicing' );
2601
-        $label2   = __( 'Available Items', 'invoicing' );
2602
-        $label3   = esc_attr__( 'Add some help text for this element', 'invoicing' );
2598
+    public function edit_items_template($field) {
2599
+        $restrict = $this->get_restrict_markup($field, 'items');
2600
+        $label    = __('Let customers...', 'invoicing');
2601
+        $label2   = __('Available Items', 'invoicing');
2602
+        $label3   = esc_attr__('Add some help text for this element', 'invoicing');
2603 2603
         $id       = $field . '.id + "_edit"';
2604 2604
         $id2      = $field . '.id + "_edit2"';
2605 2605
         $id3      = $field . '.id + "_edit3"';
2606 2606
         $id4      = $field . '.id + "_edit4"';
2607
-        $label4   = esc_attr__( 'This will be shown to the customer as the recommended price', 'invoicing' );
2608
-        $label5   = esc_attr__( 'Allow users to pay what they want', 'invoicing' );
2609
-        $label6   = esc_attr__( 'Enter the minimum price that a user can pay', 'invoicing' );
2610
-        $label7   = esc_attr__( 'Allow users to buy several quantities', 'invoicing' );
2611
-        $label8   = esc_attr__( 'This item is required', 'invoicing' );
2607
+        $label4   = esc_attr__('This will be shown to the customer as the recommended price', 'invoicing');
2608
+        $label5   = esc_attr__('Allow users to pay what they want', 'invoicing');
2609
+        $label6   = esc_attr__('Enter the minimum price that a user can pay', 'invoicing');
2610
+        $label7   = esc_attr__('Allow users to buy several quantities', 'invoicing');
2611
+        $label8   = esc_attr__('This item is required', 'invoicing');
2612 2612
         echo "<div $restrict>
2613 2613
 
2614 2614
                 <label>$label2</label>
@@ -2678,7 +2678,7 @@  discard block
 block discarded – undo
2678 2678
                 <div class='form-group mt-2'>
2679 2679
 
2680 2680
                     <select class='form-control custom-select' v-model='selected_item' @change='addSelectedItem'>
2681
-                        <option value=''>"        . __( 'Add an existing item to the form', 'invoicing' ) ."</option>
2681
+                        <option value=''>" . __('Add an existing item to the form', 'invoicing') . "</option>
2682 2682
                         <option v-for='(item, index) in all_items' :value='index'>{{item.title}}</option>
2683 2683
                     </select>
2684 2684
 
@@ -2693,11 +2693,11 @@  discard block
 block discarded – undo
2693 2693
                     <label :for='$id2'>$label</label>
2694 2694
 
2695 2695
                     <select class='form-control custom-select' :id='$id2' v-model='$field.items_type'>
2696
-                        <option value='total'>"        . __( 'Buy all items on the list', 'invoicing' ) ."</option>
2697
-                        <option value='radio'>"        . __( 'Select a single item from the list', 'invoicing' ) ."</option>
2698
-                        <option value='checkbox'>"     . __( 'Select one or more items on the list', 'invoicing' ) ."</option>
2699
-                        <option value='select'>"       . __( 'Select a single item from a dropdown', 'invoicing' ) ."</option>
2700
-                        <option value='multi_select'>" . __( 'Select a one or more items from a dropdown', 'invoicing' ) ."</option>
2696
+                        <option value='total'>" . __('Buy all items on the list', 'invoicing') . "</option>
2697
+                        <option value='radio'>"        . __('Select a single item from the list', 'invoicing') . "</option>
2698
+                        <option value='checkbox'>"     . __('Select one or more items on the list', 'invoicing') . "</option>
2699
+                        <option value='select'>"       . __('Select a single item from a dropdown', 'invoicing') . "</option>
2700
+                        <option value='multi_select'>" . __('Select a one or more items from a dropdown', 'invoicing') . "</option>
2701 2701
                     </select>
2702 2702
 
2703 2703
                 </div>
@@ -2722,7 +2722,7 @@  discard block
 block discarded – undo
2722 2722
             'orderby'        => 'title',
2723 2723
             'order'          => 'ASC',
2724 2724
             'posts_per_page' => -1,
2725
-            'post_status'    => array( 'publish' ),
2725
+            'post_status'    => array('publish'),
2726 2726
             'meta_query'     => array(
2727 2727
                 array(
2728 2728
                     'key'       => '_wpinv_type',
@@ -2732,24 +2732,24 @@  discard block
 block discarded – undo
2732 2732
             )
2733 2733
         );
2734 2734
     
2735
-        $items = get_posts( apply_filters( 'wpinv_payment_form_item_dropdown_query_args', $item_args ) );
2735
+        $items = get_posts(apply_filters('wpinv_payment_form_item_dropdown_query_args', $item_args));
2736 2736
 
2737
-        if ( empty( $items ) ) {
2737
+        if (empty($items)) {
2738 2738
             return array();
2739 2739
         }
2740 2740
 
2741
-        $options    = array();
2742
-        foreach ( $items as $item ) {
2743
-            $title            = esc_html( $item->post_title );
2744
-            $title           .= wpinv_get_item_suffix( $item->ID, false );
2745
-            $id               = absint( $item->ID );
2746
-            $price            = wpinv_sanitize_amount( get_post_meta( $id, '_wpinv_price', true ) );
2747
-            $recurring        = (bool) get_post_meta( $id, '_wpinv_is_recurring', true );
2741
+        $options = array();
2742
+        foreach ($items as $item) {
2743
+            $title            = esc_html($item->post_title);
2744
+            $title           .= wpinv_get_item_suffix($item->ID, false);
2745
+            $id               = absint($item->ID);
2746
+            $price            = wpinv_sanitize_amount(get_post_meta($id, '_wpinv_price', true));
2747
+            $recurring        = (bool) get_post_meta($id, '_wpinv_is_recurring', true);
2748 2748
             $description      = $item->post_excerpt;
2749
-            $custom_price     = (bool) get_post_meta( $id, '_wpinv_dynamic_pricing', true );
2750
-            $minimum_price    = (float) get_post_meta( $id, '_minimum_price', true );
2749
+            $custom_price     = (bool) get_post_meta($id, '_wpinv_dynamic_pricing', true);
2750
+            $minimum_price    = (float) get_post_meta($id, '_minimum_price', true);
2751 2751
             $allow_quantities = false;
2752
-            $options[]        = compact( 'title', 'id', 'price', 'recurring', 'description', 'custom_price', 'minimum_price', 'allow_quantities' );
2752
+            $options[]        = compact('title', 'id', 'price', 'recurring', 'description', 'custom_price', 'minimum_price', 'allow_quantities');
2753 2753
 
2754 2754
         }
2755 2755
         return $options;
@@ -2759,47 +2759,47 @@  discard block
 block discarded – undo
2759 2759
     /**
2760 2760
      * Returns an array of items for the currently being edited form.
2761 2761
      */
2762
-    public function get_form_items( $id = false ) {
2762
+    public function get_form_items($id = false) {
2763 2763
         
2764
-        if ( empty( $id ) ) {
2765
-            return wpinv_get_data( 'sample-payment-form-items' );
2764
+        if (empty($id)) {
2765
+            return wpinv_get_data('sample-payment-form-items');
2766 2766
         }
2767 2767
         
2768
-        $form_elements = get_post_meta( $id, 'wpinv_form_items', true );
2768
+        $form_elements = get_post_meta($id, 'wpinv_form_items', true);
2769 2769
 
2770
-        if ( is_array( $form_elements ) ) {
2770
+        if (is_array($form_elements)) {
2771 2771
             return $form_elements;
2772 2772
         }
2773 2773
 
2774
-        return wpinv_get_data( 'sample-payment-form-items' );
2774
+        return wpinv_get_data('sample-payment-form-items');
2775 2775
 
2776 2776
     }
2777 2777
 
2778 2778
     /**
2779 2779
      * Returns an array of elements for the currently being edited form.
2780 2780
      */
2781
-    public function get_form_elements( $id = false ) {
2781
+    public function get_form_elements($id = false) {
2782 2782
 
2783
-        if ( empty( $id ) ) {
2784
-            return wpinv_get_data( 'sample-payment-form' );
2783
+        if (empty($id)) {
2784
+            return wpinv_get_data('sample-payment-form');
2785 2785
         }
2786 2786
         
2787
-        $form_elements = get_post_meta( $id, 'wpinv_form_elements', true );
2787
+        $form_elements = get_post_meta($id, 'wpinv_form_elements', true);
2788 2788
 
2789
-        if ( is_array( $form_elements ) ) {
2789
+        if (is_array($form_elements)) {
2790 2790
             return $form_elements;
2791 2791
         }
2792 2792
 
2793
-        return wpinv_get_data( 'sample-payment-form' );
2793
+        return wpinv_get_data('sample-payment-form');
2794 2794
     }
2795 2795
 
2796 2796
     /**
2797 2797
      * Sends a redrect response to payment details.
2798 2798
      *
2799 2799
      */
2800
-    public function send_redirect_response( $url ) {
2801
-        $url = urlencode( $url );
2802
-        wp_send_json_success( $url );
2800
+    public function send_redirect_response($url) {
2801
+        $url = urlencode($url);
2802
+        wp_send_json_success($url);
2803 2803
     }
2804 2804
 
2805 2805
     /**
@@ -2810,12 +2810,12 @@  discard block
 block discarded – undo
2810 2810
 
2811 2811
         $errors = wpinv_get_errors();
2812 2812
 
2813
-        if ( ! empty( $errors ) ) {
2813
+        if (!empty($errors)) {
2814 2814
             wpinv_print_errors();
2815 2815
             exit;
2816 2816
         }
2817 2817
 
2818
-        wp_send_json_error( __( 'An error occured while processing your payment. Please try again.', 'invoicing' ) );
2818
+        wp_send_json_error(__('An error occured while processing your payment. Please try again.', 'invoicing'));
2819 2819
         exit;
2820 2820
 
2821 2821
     }
Please login to merge, or discard this patch.