Passed
Push — master ( e88989...0a9164 )
by Brian
06:02 queued 40s
created
includes/class-wpinv-payment-form-elements.php 1 patch
Spacing   +474 added lines, -474 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,11 +207,11 @@  discard block
 block discarded – undo
207 207
 
208 208
             array( 
209 209
                 'type' => 'billing_email',
210
-                'name' => __( 'Billing Email', 'invoicing' ),
210
+                'name' => __('Billing Email', 'invoicing'),
211 211
                 'defaults'  => array(
212 212
                     'placeholder'  => '[email protected]',
213 213
                     'value'        => '',
214
-                    'label'        => __( 'Billing Email', 'invoicing' ),
214
+                    'label'        => __('Billing Email', 'invoicing'),
215 215
                     'description'  => '',
216 216
                     'premade'      => true,
217 217
                 )
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
             array( 
232 232
                 'type' => 'items',
233
-                'name' => __( 'Items', 'invoicing' ),
233
+                'name' => __('Items', 'invoicing'),
234 234
                 'defaults'  => array(
235 235
                     'value'        => '',
236 236
                     'items_type'   => 'total',
@@ -241,25 +241,25 @@  discard block
 block discarded – undo
241 241
 
242 242
             array( 
243 243
                 'type'       => 'pay_button',
244
-                'name'       => __( 'Payment Button', 'invoicing' ),
244
+                'name'       => __('Payment Button', 'invoicing'),
245 245
                 'defaults'   => array(
246 246
                     'value'        => '',
247 247
                     'class'        => 'btn-primary',
248
-                    'label'        => __( 'Pay Now »', 'invoicing' ),
249
-                    'description'  => __( 'By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ),
248
+                    'label'        => __('Pay Now »', 'invoicing'),
249
+                    'description'  => __('By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'),
250 250
                     'premade'      => true,
251 251
                 )
252 252
             )
253 253
         );
254 254
 
255
-        $this->elements = apply_filters( 'wpinv_filter_core_payment_form_elements', $this->elements );
255
+        $this->elements = apply_filters('wpinv_filter_core_payment_form_elements', $this->elements);
256 256
         return $this->elements;
257 257
     }
258 258
 
259 259
     /**
260 260
      * Returns the restrict markup.
261 261
      */
262
-    public function get_restrict_markup( $field, $field_type ) {
262
+    public function get_restrict_markup($field, $field_type) {
263 263
         $restrict = "$field.type=='$field_type'";
264 264
         return "v-if=\"$restrict\"";
265 265
     }
@@ -267,15 +267,15 @@  discard block
 block discarded – undo
267 267
     /**
268 268
      * Renders the title element template.
269 269
      */
270
-    public function render_heading_template( $field ) {
271
-        $restrict = $this->get_restrict_markup( $field, 'heading' );
270
+    public function render_heading_template($field) {
271
+        $restrict = $this->get_restrict_markup($field, 'heading');
272 272
         echo "<component :is='$field.level' $restrict v-html='$field.text'></component>";
273 273
     }
274 274
 
275 275
     /**
276 276
      * Renders the title element on the frontend.
277 277
      */
278
-    public function frontend_render_heading_template( $field ) {
278
+    public function frontend_render_heading_template($field) {
279 279
         $tag = $field['level'];
280 280
         echo "<$tag>{$field['text']}</$tag>";
281 281
     }
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
     /**
284 284
      * Renders the edit title element template.
285 285
      */
286
-    public function edit_heading_template( $field ) {
287
-        $restrict = $this->get_restrict_markup( $field, 'heading' );
288
-        $label    = __( 'Heading', 'invoicing' );
289
-        $label2   = __( 'Select Heading Level', 'invoicing' );
286
+    public function edit_heading_template($field) {
287
+        $restrict = $this->get_restrict_markup($field, 'heading');
288
+        $label    = __('Heading', 'invoicing');
289
+        $label2   = __('Select Heading Level', 'invoicing');
290 290
         $id       = $field . '.id + "_edit"';
291 291
         $id2      = $field . '.id + "_edit2"';
292 292
 
@@ -318,8 +318,8 @@  discard block
 block discarded – undo
318 318
     /**
319 319
      * Renders a paragraph element template.
320 320
      */
321
-    public function render_paragraph_template( $field ) {
322
-        $restrict = $this->get_restrict_markup( $field, 'paragraph' );
321
+    public function render_paragraph_template($field) {
322
+        $restrict = $this->get_restrict_markup($field, 'paragraph');
323 323
         $label    = "$field.text";
324 324
         echo "<p $restrict v-html='$label' style='font-size: 16px;'></p>";
325 325
     }
@@ -327,16 +327,16 @@  discard block
 block discarded – undo
327 327
     /**
328 328
      * Renders the paragraph element on the frontend.
329 329
      */
330
-    public function frontend_render_paragraph_template( $field ) {
330
+    public function frontend_render_paragraph_template($field) {
331 331
         echo "<p>{$field['text']}</p>";
332 332
     }
333 333
 
334 334
     /**
335 335
      * Renders the edit paragraph element template.
336 336
      */
337
-    public function edit_paragraph_template( $field ) {
338
-        $restrict = $this->get_restrict_markup( $field, 'paragraph' );
339
-        $label    = __( 'Enter your text', 'invoicing' );
337
+    public function edit_paragraph_template($field) {
338
+        $restrict = $this->get_restrict_markup($field, 'paragraph');
339
+        $label    = __('Enter your text', 'invoicing');
340 340
         $id       = $field . '.id + "_edit"';
341 341
         echo "
342 342
             <div $restrict>
@@ -352,8 +352,8 @@  discard block
 block discarded – undo
352 352
     /**
353 353
      * Renders the text element template.
354 354
      */
355
-    public function render_text_template( $field ) {
356
-        $restrict = $this->get_restrict_markup( $field, 'text' );
355
+    public function render_text_template($field) {
356
+        $restrict = $this->get_restrict_markup($field, 'text');
357 357
         $label    = "$field.label";
358 358
         echo "
359 359
             <div $restrict>
@@ -367,23 +367,23 @@  discard block
 block discarded – undo
367 367
     /**
368 368
      * Renders the text element on the frontend.
369 369
      */
370
-    public function frontend_render_text_template( $field ) {
370
+    public function frontend_render_text_template($field) {
371 371
         
372 372
         echo "<div class='form-group'>";
373 373
 
374 374
         echo aui()->input(
375 375
             array(
376
-                'name'       => esc_attr( $field['id'] ),
377
-                'id'         => esc_attr( $field['id'] ),
378
-                'placeholder'=> esc_attr( $field['placeholder'] ),
376
+                'name'       => esc_attr($field['id']),
377
+                'id'         => esc_attr($field['id']),
378
+                'placeholder'=> esc_attr($field['placeholder']),
379 379
                 'required'   => (bool) $field['required'],
380
-                'label'      => wp_kses_post( $field['label'] ),
380
+                'label'      => wp_kses_post($field['label']),
381 381
                 'no_wrap'    => true,
382 382
             )
383 383
         );
384 384
 
385
-        if ( ! empty( $field['description'] ) ) {
386
-            $description = wp_kses_post( $field['description'] );
385
+        if (!empty($field['description'])) {
386
+            $description = wp_kses_post($field['description']);
387 387
             echo "<small class='form-text text-muted'>$description</small>";
388 388
         }
389 389
 
@@ -394,16 +394,16 @@  discard block
 block discarded – undo
394 394
     /**
395 395
      * Renders the edit text element template.
396 396
      */
397
-    public function edit_text_template( $field ) {
398
-        $restrict = $this->get_restrict_markup( $field, 'text' );
399
-        $label    = __( 'Field Label', 'invoicing' );
397
+    public function edit_text_template($field) {
398
+        $restrict = $this->get_restrict_markup($field, 'text');
399
+        $label    = __('Field Label', 'invoicing');
400 400
         $id       = $field . '.id + "_edit"';
401
-        $label2   = __( 'Placeholder text', 'invoicing' );
401
+        $label2   = __('Placeholder text', 'invoicing');
402 402
         $id2      = $field . '.id + "_edit2"';
403
-        $label3   = __( 'Help text', 'invoicing' );
404
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
403
+        $label3   = __('Help text', 'invoicing');
404
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
405 405
         $id3      = $field . '.id + "_edit3"';
406
-        $label5   = __( 'Is this field required?', 'invoicing' );
406
+        $label5   = __('Is this field required?', 'invoicing');
407 407
         $id4      = $field . '.id + "_edit4"';
408 408
         echo "
409 409
             <div $restrict>
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
     /**
432 432
      * Renders the textarea element template.
433 433
      */
434
-    public function render_textarea_template( $field ) {
435
-        $restrict = $this->get_restrict_markup( $field, 'textarea' );
434
+    public function render_textarea_template($field) {
435
+        $restrict = $this->get_restrict_markup($field, 'textarea');
436 436
         $label    = "$field.label";
437 437
         echo "
438 438
             <div $restrict>
@@ -446,24 +446,24 @@  discard block
 block discarded – undo
446 446
     /**
447 447
      * Renders the textarea element on the frontend.
448 448
      */
449
-    public function frontend_render_textarea_template( $field ) {
449
+    public function frontend_render_textarea_template($field) {
450 450
         
451 451
         echo "<div class='form-group'>";
452 452
 
453 453
         echo aui()->textarea(
454 454
             array(
455
-                'name'       => esc_attr( $field['id'] ),
456
-                'id'         => esc_attr( $field['id'] ),
457
-                'placeholder'=> esc_attr( $field['placeholder'] ),
455
+                'name'       => esc_attr($field['id']),
456
+                'id'         => esc_attr($field['id']),
457
+                'placeholder'=> esc_attr($field['placeholder']),
458 458
                 'required'   => (bool) $field['required'],
459
-                'label'      => wp_kses_post( $field['label'] ),
459
+                'label'      => wp_kses_post($field['label']),
460 460
                 'no_wrap'    => true,
461 461
                 'rows'       => 3,
462 462
             )
463 463
         );
464 464
 
465
-        if ( ! empty( $field['description'] ) ) {
466
-            $description = wp_kses_post( $field['description'] );
465
+        if (!empty($field['description'])) {
466
+            $description = wp_kses_post($field['description']);
467 467
             echo "<small class='form-text text-muted'>$description</small>";
468 468
         }
469 469
 
@@ -474,16 +474,16 @@  discard block
 block discarded – undo
474 474
     /**
475 475
      * Renders the edit textarea element template.
476 476
      */
477
-    public function edit_textarea_template( $field ) {
478
-        $restrict = $this->get_restrict_markup( $field, 'textarea' );
479
-        $label    = __( 'Field Label', 'invoicing' );
477
+    public function edit_textarea_template($field) {
478
+        $restrict = $this->get_restrict_markup($field, 'textarea');
479
+        $label    = __('Field Label', 'invoicing');
480 480
         $id       = $field . '.id + "_edit"';
481
-        $label2   = __( 'Placeholder text', 'invoicing' );
481
+        $label2   = __('Placeholder text', 'invoicing');
482 482
         $id2      = $field . '.id + "_edit2"';
483
-        $label3   = __( 'Help text', 'invoicing' );
484
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
483
+        $label3   = __('Help text', 'invoicing');
484
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
485 485
         $id3      = $field . '.id + "_edit3"';
486
-        $label5   = __( 'Is this field required?', 'invoicing' );
486
+        $label5   = __('Is this field required?', 'invoicing');
487 487
         $id4      = $field . '.id + "_edit4"';
488 488
         echo "
489 489
             <div $restrict>
@@ -511,8 +511,8 @@  discard block
 block discarded – undo
511 511
     /**
512 512
      * Renders the select element template.
513 513
      */
514
-    public function render_select_template( $field ) {
515
-        $restrict    = $this->get_restrict_markup( $field, 'select' );
514
+    public function render_select_template($field) {
515
+        $restrict    = $this->get_restrict_markup($field, 'select');
516 516
         $label       = "$field.label";
517 517
         $placeholder = "$field.placeholder";
518 518
         $id          = $field . '.id';
@@ -531,24 +531,24 @@  discard block
 block discarded – undo
531 531
     /**
532 532
      * Renders the select element on the frontend.
533 533
      */
534
-    public function frontend_render_select_template( $field ) {
534
+    public function frontend_render_select_template($field) {
535 535
         
536 536
         echo "<div class='form-group'>";
537 537
 
538 538
         echo aui()->select(
539 539
             array(
540
-                'name'       => esc_attr( $field['id'] ),
541
-                'id'         => esc_attr( $field['id'] ),
542
-                'placeholder'=> esc_attr( $field['placeholder'] ),
540
+                'name'       => esc_attr($field['id']),
541
+                'id'         => esc_attr($field['id']),
542
+                'placeholder'=> esc_attr($field['placeholder']),
543 543
                 'required'   => (bool) $field['required'],
544
-                'label'      => wp_kses_post( $field['label'] ),
544
+                'label'      => wp_kses_post($field['label']),
545 545
                 'no_wrap'    => true,
546
-                'options'    => array_combine( $field['options'], $field['options'] ),
546
+                'options'    => array_combine($field['options'], $field['options']),
547 547
             )
548 548
         );
549 549
 
550
-        if ( ! empty( $field['description'] ) ) {
551
-            $description = wp_kses_post( $field['description'] );
550
+        if (!empty($field['description'])) {
551
+            $description = wp_kses_post($field['description']);
552 552
             echo "<small class='form-text text-muted'>$description</small>";
553 553
         }
554 554
 
@@ -559,18 +559,18 @@  discard block
 block discarded – undo
559 559
     /**
560 560
      * Renders the edit select element template.
561 561
      */
562
-    public function edit_select_template( $field ) {
563
-        $restrict = $this->get_restrict_markup( $field, 'select' );
564
-        $label    = __( 'Field Label', 'invoicing' );
562
+    public function edit_select_template($field) {
563
+        $restrict = $this->get_restrict_markup($field, 'select');
564
+        $label    = __('Field Label', 'invoicing');
565 565
         $id       = $field . '.id + "_edit"';
566
-        $label2   = __( 'Placeholder text', 'invoicing' );
566
+        $label2   = __('Placeholder text', 'invoicing');
567 567
         $id2      = $field . '.id + "_edit2"';
568
-        $label3   = __( 'Help text', 'invoicing' );
569
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
568
+        $label3   = __('Help text', 'invoicing');
569
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
570 570
         $id3      = $field . '.id + "_edit3"';
571
-        $label5   = __( 'Is this field required?', 'invoicing' );
571
+        $label5   = __('Is this field required?', 'invoicing');
572 572
         $id4      = $field . '.id + "_edit4"';
573
-        $label6   = __( 'Available Options', 'invoicing' );
573
+        $label6   = __('Available Options', 'invoicing');
574 574
         echo "
575 575
             <div $restrict>
576 576
                 <div class='form-group'>
@@ -608,8 +608,8 @@  discard block
 block discarded – undo
608 608
     /**
609 609
      * Renders the checkbox element template.
610 610
      */
611
-    public function render_checkbox_template( $field ) {
612
-        $restrict = $this->get_restrict_markup( $field, 'checkbox' );
611
+    public function render_checkbox_template($field) {
612
+        $restrict = $this->get_restrict_markup($field, 'checkbox');
613 613
         $label    = "$field.label";
614 614
         echo "
615 615
             <div class='form-check' $restrict>
@@ -623,24 +623,24 @@  discard block
 block discarded – undo
623 623
     /**
624 624
      * Renders the checkbox element on the frontend.
625 625
      */
626
-    public function frontend_render_checkbox_template( $field ) {
626
+    public function frontend_render_checkbox_template($field) {
627 627
         
628 628
         echo "<div class='form-group'>";
629 629
 
630 630
         echo aui()->input(
631 631
             array(
632
-                'name'       => esc_attr( $field['id'] ),
633
-                'id'         => esc_attr( $field['id'] ),
632
+                'name'       => esc_attr($field['id']),
633
+                'id'         => esc_attr($field['id']),
634 634
                 'required'   => (bool) $field['required'],
635
-                'label'      => wp_kses_post( $field['label'] ),
635
+                'label'      => wp_kses_post($field['label']),
636 636
                 'no_wrap'    => true,
637
-                'value'      => esc_attr__( 'Yes', 'invoicing' ),
637
+                'value'      => esc_attr__('Yes', 'invoicing'),
638 638
                 'type'       => 'checkbox',
639 639
             )
640 640
         );
641 641
 
642
-        if ( ! empty( $field['description'] ) ) {
643
-            $description = wp_kses_post( $field['description'] );
642
+        if (!empty($field['description'])) {
643
+            $description = wp_kses_post($field['description']);
644 644
             echo "<small class='form-text text-muted'>$description</small>";
645 645
         }
646 646
 
@@ -651,14 +651,14 @@  discard block
 block discarded – undo
651 651
     /**
652 652
      * Renders the edit checkbox element template.
653 653
      */
654
-    public function edit_checkbox_template( $field ) {
655
-        $restrict = $this->get_restrict_markup( $field, 'checkbox' );
656
-        $label    = __( 'Field Label', 'invoicing' );
654
+    public function edit_checkbox_template($field) {
655
+        $restrict = $this->get_restrict_markup($field, 'checkbox');
656
+        $label    = __('Field Label', 'invoicing');
657 657
         $id       = $field . '.id + "_edit"';
658
-        $label2   = __( 'Help text', 'invoicing' );
659
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
658
+        $label2   = __('Help text', 'invoicing');
659
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
660 660
         $id2      = $field . '.id + "_edit2"';
661
-        $label4   = __( 'Is this field required?', 'invoicing' );
661
+        $label4   = __('Is this field required?', 'invoicing');
662 662
         $id3      = $field . '.id + "_edit3"';
663 663
         echo "
664 664
             <div $restrict>
@@ -682,8 +682,8 @@  discard block
 block discarded – undo
682 682
     /**
683 683
      * Renders the radio element template.
684 684
      */
685
-    public function render_radio_template( $field ) {
686
-        $restrict    = $this->get_restrict_markup( $field, 'radio' );
685
+    public function render_radio_template($field) {
686
+        $restrict    = $this->get_restrict_markup($field, 'radio');
687 687
         $label       = "$field.label";
688 688
         $id          = $field . '.id';
689 689
         echo "
@@ -701,20 +701,20 @@  discard block
 block discarded – undo
701 701
     /**
702 702
      * Renders the radio element on the frontend.
703 703
      */
704
-    public function frontend_render_radio_template( $field ) {
704
+    public function frontend_render_radio_template($field) {
705 705
         
706 706
         echo "<div class='form-group'>";
707 707
 
708
-        if ( ! empty( $field['label'] ) ) {
709
-            $label = wp_kses_post( $field['label'] );
708
+        if (!empty($field['label'])) {
709
+            $label = wp_kses_post($field['label']);
710 710
             echo "<legend class='col-form-label'>$label</legend>";
711 711
         }
712 712
 
713
-        foreach( $field['options'] as $index => $option ) {
713
+        foreach ($field['options'] as $index => $option) {
714 714
             $id    = $field['id'] . $index;
715 715
             $name  = $field['id'];
716
-            $value = esc_attr( $option );
717
-            $label = wp_kses_post( $option );
716
+            $value = esc_attr($option);
717
+            $label = wp_kses_post($option);
718 718
 
719 719
             echo "
720 720
                 <div class='form-check'>
@@ -724,8 +724,8 @@  discard block
 block discarded – undo
724 724
             ";
725 725
         }
726 726
 
727
-        if ( ! empty( $field['description'] ) ) {
728
-            $description = wp_kses_post( $field['description'] );
727
+        if (!empty($field['description'])) {
728
+            $description = wp_kses_post($field['description']);
729 729
             echo "<small class='form-text text-muted'>$description</small>";
730 730
         }
731 731
 
@@ -736,16 +736,16 @@  discard block
 block discarded – undo
736 736
     /**
737 737
      * Renders the edit radio element template.
738 738
      */
739
-    public function edit_radio_template( $field ) {
740
-        $restrict = $this->get_restrict_markup( $field, 'radio' );
741
-        $label    = __( 'Field Label', 'invoicing' );
739
+    public function edit_radio_template($field) {
740
+        $restrict = $this->get_restrict_markup($field, 'radio');
741
+        $label    = __('Field Label', 'invoicing');
742 742
         $id       = $field . '.id + "_edit"';
743
-        $label2   = __( 'Help text', 'invoicing' );
744
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
743
+        $label2   = __('Help text', 'invoicing');
744
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
745 745
         $id2      = $field . '.id + "_edit3"';
746
-        $label4   = __( 'Is this field required?', 'invoicing' );
746
+        $label4   = __('Is this field required?', 'invoicing');
747 747
         $id3      = $field . '.id + "_edit4"';
748
-        $label5   = __( 'Available Options', 'invoicing' );
748
+        $label5   = __('Available Options', 'invoicing');
749 749
         echo "
750 750
             <div $restrict>
751 751
                 <div class='form-group'>
@@ -779,8 +779,8 @@  discard block
 block discarded – undo
779 779
     /**
780 780
      * Renders the email element template.
781 781
      */
782
-    public function render_email_template( $field ) {
783
-        $restrict = $this->get_restrict_markup( $field, 'email' );
782
+    public function render_email_template($field) {
783
+        $restrict = $this->get_restrict_markup($field, 'email');
784 784
         $label    = "$field.label";
785 785
         echo "
786 786
             <div $restrict>
@@ -794,8 +794,8 @@  discard block
 block discarded – undo
794 794
     /**
795 795
      * Renders the billing_email element template.
796 796
      */
797
-    public function render_billing_email_template( $field ) {
798
-        $restrict = $this->get_restrict_markup( $field, 'billing_email' );
797
+    public function render_billing_email_template($field) {
798
+        $restrict = $this->get_restrict_markup($field, 'billing_email');
799 799
         $label    = "$field.label";
800 800
         echo "
801 801
             <div $restrict>
@@ -809,24 +809,24 @@  discard block
 block discarded – undo
809 809
     /**
810 810
      * Renders the email element on the frontend.
811 811
      */
812
-    public function frontend_render_email_template( $field ) {
812
+    public function frontend_render_email_template($field) {
813 813
         
814 814
         echo "<div class='form-group'>";
815 815
 
816 816
         echo aui()->input(
817 817
             array(
818
-                'name'       => esc_attr( $field['id'] ),
819
-                'id'         => esc_attr( $field['id'] ),
818
+                'name'       => esc_attr($field['id']),
819
+                'id'         => esc_attr($field['id']),
820 820
                 'required'   => (bool) $field['required'],
821
-                'label'      => wp_kses_post( $field['label'] ),
821
+                'label'      => wp_kses_post($field['label']),
822 822
                 'no_wrap'    => true,
823
-                'placeholder' => esc_attr( $field['placeholder'] ),
823
+                'placeholder' => esc_attr($field['placeholder']),
824 824
                 'type'       => 'email',
825 825
             )
826 826
         );
827 827
 
828
-        if ( ! empty( $field['description'] ) ) {
829
-            $description = wp_kses_post( $field['description'] );
828
+        if (!empty($field['description'])) {
829
+            $description = wp_kses_post($field['description']);
830 830
             echo "<small class='form-text text-muted'>$description</small>";
831 831
         }
832 832
 
@@ -837,30 +837,30 @@  discard block
 block discarded – undo
837 837
     /**
838 838
      * Renders the billing email element on the frontend.
839 839
      */
840
-    public function frontend_render_billing_email_template( $field ) {
840
+    public function frontend_render_billing_email_template($field) {
841 841
         
842 842
         echo "<div class='form-group'>";
843 843
         $value = '';
844 844
 
845
-        if ( is_user_logged_in() ) {
845
+        if (is_user_logged_in()) {
846 846
             $user  = wp_get_current_user();
847
-            $value = sanitize_email( $user->user_email );
847
+            $value = sanitize_email($user->user_email);
848 848
         }
849 849
         echo aui()->input(
850 850
             array(
851 851
                 'name'       => 'billing_email',
852 852
                 'value'      => $value,
853
-                'id'         => esc_attr( $field['id'] ),
853
+                'id'         => esc_attr($field['id']),
854 854
                 'required'   => true,
855
-                'label'      => wp_kses_post( $field['label'] ),
855
+                'label'      => wp_kses_post($field['label']),
856 856
                 'no_wrap'    => true,
857
-                'placeholder' => esc_attr( $field['placeholder'] ),
857
+                'placeholder' => esc_attr($field['placeholder']),
858 858
                 'type'       => 'email',
859 859
             )
860 860
         );
861 861
 
862
-        if ( ! empty( $field['description'] ) ) {
863
-            $description = wp_kses_post( $field['description'] );
862
+        if (!empty($field['description'])) {
863
+            $description = wp_kses_post($field['description']);
864 864
             echo "<small class='form-text text-muted'>$description</small>";
865 865
         }
866 866
 
@@ -871,16 +871,16 @@  discard block
 block discarded – undo
871 871
     /**
872 872
      * Renders the edit email element template.
873 873
      */
874
-    public function edit_email_template( $field ) {
875
-        $restrict = $this->get_restrict_markup( $field, 'email' );
876
-        $label    = __( 'Field Label', 'invoicing' );
874
+    public function edit_email_template($field) {
875
+        $restrict = $this->get_restrict_markup($field, 'email');
876
+        $label    = __('Field Label', 'invoicing');
877 877
         $id       = $field . '.id + "_edit"';
878
-        $label2   = __( 'Placeholder text', 'invoicing' );
878
+        $label2   = __('Placeholder text', 'invoicing');
879 879
         $id2      = $field . '.id + "_edit2"';
880
-        $label3   = __( 'Help text', 'invoicing' );
881
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
880
+        $label3   = __('Help text', 'invoicing');
881
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
882 882
         $id3      = $field . '.id + "_edit3"';
883
-        $label5   = __( 'Is this field required?', 'invoicing' );
883
+        $label5   = __('Is this field required?', 'invoicing');
884 884
         $id4      = $field . '.id + "_edit4"';
885 885
         echo "
886 886
             <div $restrict>
@@ -908,16 +908,16 @@  discard block
 block discarded – undo
908 908
     /**
909 909
      * Renders the edit billing_email element template.
910 910
      */
911
-    public function edit_billing_email_template( $field ) {
912
-        $restrict = $this->get_restrict_markup( $field, 'billing_email' );
913
-        $label    = __( 'Field Label', 'invoicing' );
911
+    public function edit_billing_email_template($field) {
912
+        $restrict = $this->get_restrict_markup($field, 'billing_email');
913
+        $label    = __('Field Label', 'invoicing');
914 914
         $id       = $field . '.id + "_edit"';
915
-        $label2   = __( 'Placeholder text', 'invoicing' );
915
+        $label2   = __('Placeholder text', 'invoicing');
916 916
         $id2      = $field . '.id + "_edit2"';
917
-        $label3   = __( 'Help text', 'invoicing' );
918
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
917
+        $label3   = __('Help text', 'invoicing');
918
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
919 919
         $id3      = $field . '.id + "_edit3"';
920
-        $label5   = __( 'Is this field required?', 'invoicing' );
920
+        $label5   = __('Is this field required?', 'invoicing');
921 921
         $id4      = $field . '.id + "_edit4"';
922 922
         echo "
923 923
             <div $restrict>
@@ -941,8 +941,8 @@  discard block
 block discarded – undo
941 941
     /**
942 942
      * Renders the website element template.
943 943
      */
944
-    public function render_website_template( $field ) {
945
-        $restrict = $this->get_restrict_markup( $field, 'website' );
944
+    public function render_website_template($field) {
945
+        $restrict = $this->get_restrict_markup($field, 'website');
946 946
         $label    = "$field.label";
947 947
         echo "
948 948
             <div $restrict>
@@ -956,24 +956,24 @@  discard block
 block discarded – undo
956 956
     /**
957 957
      * Renders the website element on the frontend.
958 958
      */
959
-    public function frontend_render_website_template( $field ) {
959
+    public function frontend_render_website_template($field) {
960 960
         
961 961
         echo "<div class='form-group'>";
962 962
 
963 963
         echo aui()->input(
964 964
             array(
965
-                'name'       => esc_attr( $field['id'] ),
966
-                'id'         => esc_attr( $field['id'] ),
965
+                'name'       => esc_attr($field['id']),
966
+                'id'         => esc_attr($field['id']),
967 967
                 'required'   => (bool) $field['required'],
968
-                'label'      => wp_kses_post( $field['label'] ),
968
+                'label'      => wp_kses_post($field['label']),
969 969
                 'no_wrap'    => true,
970
-                'placeholder' => esc_attr( $field['placeholder'] ),
970
+                'placeholder' => esc_attr($field['placeholder']),
971 971
                 'type'       => 'url',
972 972
             )
973 973
         );
974 974
 
975
-        if ( ! empty( $field['description'] ) ) {
976
-            $description = wp_kses_post( $field['description'] );
975
+        if (!empty($field['description'])) {
976
+            $description = wp_kses_post($field['description']);
977 977
             echo "<small class='form-text text-muted'>$description</small>";
978 978
         }
979 979
 
@@ -984,16 +984,16 @@  discard block
 block discarded – undo
984 984
     /**
985 985
      * Renders the edit website element template.
986 986
      */
987
-    public function edit_website_template( $field ) {
988
-        $restrict = $this->get_restrict_markup( $field, 'website' );
989
-        $label    = __( 'Field Label', 'invoicing' );
987
+    public function edit_website_template($field) {
988
+        $restrict = $this->get_restrict_markup($field, 'website');
989
+        $label    = __('Field Label', 'invoicing');
990 990
         $id       = $field . '.id + "_edit"';
991
-        $label2   = __( 'Placeholder text', 'invoicing' );
991
+        $label2   = __('Placeholder text', 'invoicing');
992 992
         $id2      = $field . '.id + "_edit2"';
993
-        $label3   = __( 'Help text', 'invoicing' );
994
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
993
+        $label3   = __('Help text', 'invoicing');
994
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
995 995
         $id3      = $field . '.id + "_edit3"';
996
-        $label5   = __( 'Is this field required?', 'invoicing' );
996
+        $label5   = __('Is this field required?', 'invoicing');
997 997
         $id4      = $field . '.id + "_edit4"';
998 998
         echo "
999 999
             <div $restrict>
@@ -1021,8 +1021,8 @@  discard block
 block discarded – undo
1021 1021
     /**
1022 1022
      * Renders the date element template.
1023 1023
      */
1024
-    public function render_date_template( $field ) {
1025
-        $restrict = $this->get_restrict_markup( $field, 'date' );
1024
+    public function render_date_template($field) {
1025
+        $restrict = $this->get_restrict_markup($field, 'date');
1026 1026
         $label    = "$field.label";
1027 1027
         echo "
1028 1028
             <div $restrict>
@@ -1036,24 +1036,24 @@  discard block
 block discarded – undo
1036 1036
     /**
1037 1037
      * Renders the date element on the frontend.
1038 1038
      */
1039
-    public function frontend_render_date_template( $field ) {
1039
+    public function frontend_render_date_template($field) {
1040 1040
         
1041 1041
         echo "<div class='form-group'>";
1042 1042
 
1043 1043
         echo aui()->input(
1044 1044
             array(
1045
-                'name'       => esc_attr( $field['id'] ),
1046
-                'id'         => esc_attr( $field['id'] ),
1045
+                'name'       => esc_attr($field['id']),
1046
+                'id'         => esc_attr($field['id']),
1047 1047
                 'required'   => (bool) $field['required'],
1048
-                'label'      => wp_kses_post( $field['label'] ),
1049
-                'placeholder' => esc_attr( $field['placeholder'] ),
1048
+                'label'      => wp_kses_post($field['label']),
1049
+                'placeholder' => esc_attr($field['placeholder']),
1050 1050
                 'no_wrap'    => true,
1051 1051
                 'type'       => 'date',
1052 1052
             )
1053 1053
         );
1054 1054
 
1055
-        if ( ! empty( $field['description'] ) ) {
1056
-            $description = wp_kses_post( $field['description'] );
1055
+        if (!empty($field['description'])) {
1056
+            $description = wp_kses_post($field['description']);
1057 1057
             echo "<small class='form-text text-muted'>$description</small>";
1058 1058
         }
1059 1059
 
@@ -1064,16 +1064,16 @@  discard block
 block discarded – undo
1064 1064
     /**
1065 1065
      * Renders the edit date element template.
1066 1066
      */
1067
-    public function edit_date_template( $field ) {
1068
-        $restrict = $this->get_restrict_markup( $field, 'date' );
1069
-        $label    = __( 'Field Label', 'invoicing' );
1067
+    public function edit_date_template($field) {
1068
+        $restrict = $this->get_restrict_markup($field, 'date');
1069
+        $label    = __('Field Label', 'invoicing');
1070 1070
         $id       = $field . '.id + "_edit"';
1071
-        $label2   = __( 'Placeholder text', 'invoicing' );
1071
+        $label2   = __('Placeholder text', 'invoicing');
1072 1072
         $id2      = $field . '.id + "_edit2"';
1073
-        $label3   = __( 'Help text', 'invoicing' );
1074
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1073
+        $label3   = __('Help text', 'invoicing');
1074
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1075 1075
         $id3      = $field . '.id + "_edit3"';
1076
-        $label5   = __( 'Is this field required?', 'invoicing' );
1076
+        $label5   = __('Is this field required?', 'invoicing');
1077 1077
         $id4      = $field . '.id + "_edit4"';
1078 1078
         echo "
1079 1079
             <div $restrict>
@@ -1101,8 +1101,8 @@  discard block
 block discarded – undo
1101 1101
     /**
1102 1102
      * Renders the time element template.
1103 1103
      */
1104
-    public function render_time_template( $field ) {
1105
-        $restrict = $this->get_restrict_markup( $field, 'time' );
1104
+    public function render_time_template($field) {
1105
+        $restrict = $this->get_restrict_markup($field, 'time');
1106 1106
         $label    = "$field.label";
1107 1107
         echo "
1108 1108
             <div $restrict>
@@ -1116,24 +1116,24 @@  discard block
 block discarded – undo
1116 1116
     /**
1117 1117
      * Renders the time element on the frontend.
1118 1118
      */
1119
-    public function frontend_render_time_template( $field ) {
1119
+    public function frontend_render_time_template($field) {
1120 1120
         
1121 1121
         echo "<div class='form-group'>";
1122 1122
 
1123 1123
         echo aui()->input(
1124 1124
             array(
1125
-                'name'       => esc_attr( $field['id'] ),
1126
-                'id'         => esc_attr( $field['id'] ),
1125
+                'name'       => esc_attr($field['id']),
1126
+                'id'         => esc_attr($field['id']),
1127 1127
                 'required'   => (bool) $field['required'],
1128
-                'label'      => wp_kses_post( $field['label'] ),
1128
+                'label'      => wp_kses_post($field['label']),
1129 1129
                 'no_wrap'    => true,
1130
-                'placeholder' => esc_attr( $field['placeholder'] ),
1130
+                'placeholder' => esc_attr($field['placeholder']),
1131 1131
                 'type'       => 'time',
1132 1132
             )
1133 1133
         );
1134 1134
 
1135
-        if ( ! empty( $field['description'] ) ) {
1136
-            $description = wp_kses_post( $field['description'] );
1135
+        if (!empty($field['description'])) {
1136
+            $description = wp_kses_post($field['description']);
1137 1137
             echo "<small class='form-text text-muted'>$description</small>";
1138 1138
         }
1139 1139
 
@@ -1144,16 +1144,16 @@  discard block
 block discarded – undo
1144 1144
     /**
1145 1145
      * Renders the edit time element template.
1146 1146
      */
1147
-    public function edit_time_template( $field ) {
1148
-        $restrict = $this->get_restrict_markup( $field, 'time' );
1149
-        $label    = __( 'Field Label', 'invoicing' );
1147
+    public function edit_time_template($field) {
1148
+        $restrict = $this->get_restrict_markup($field, 'time');
1149
+        $label    = __('Field Label', 'invoicing');
1150 1150
         $id       = $field . '.id + "_edit"';
1151
-        $label2   = __( 'Placeholder text', 'invoicing' );
1151
+        $label2   = __('Placeholder text', 'invoicing');
1152 1152
         $id2      = $field . '.id + "_edit2"';
1153
-        $label3   = __( 'Help text', 'invoicing' );
1154
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1153
+        $label3   = __('Help text', 'invoicing');
1154
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1155 1155
         $id3      = $field . '.id + "_edit3"';
1156
-        $label5   = __( 'Is this field required?', 'invoicing' );
1156
+        $label5   = __('Is this field required?', 'invoicing');
1157 1157
         $id4      = $field . '.id + "_edit4"';
1158 1158
         echo "
1159 1159
             <div $restrict>
@@ -1181,8 +1181,8 @@  discard block
 block discarded – undo
1181 1181
     /**
1182 1182
      * Renders the number element template.
1183 1183
      */
1184
-    public function render_number_template( $field ) {
1185
-        $restrict = $this->get_restrict_markup( $field, 'number' );
1184
+    public function render_number_template($field) {
1185
+        $restrict = $this->get_restrict_markup($field, 'number');
1186 1186
         $label    = "$field.label";
1187 1187
         echo "
1188 1188
             <div $restrict>
@@ -1196,24 +1196,24 @@  discard block
 block discarded – undo
1196 1196
     /**
1197 1197
      * Renders the number element on the frontend.
1198 1198
      */
1199
-    public function frontend_render_number_template( $field ) {
1199
+    public function frontend_render_number_template($field) {
1200 1200
         
1201 1201
         echo "<div class='form-group'>";
1202 1202
 
1203 1203
         echo aui()->input(
1204 1204
             array(
1205
-                'name'       => esc_attr( $field['id'] ),
1206
-                'id'         => esc_attr( $field['id'] ),
1205
+                'name'       => esc_attr($field['id']),
1206
+                'id'         => esc_attr($field['id']),
1207 1207
                 'required'   => (bool) $field['required'],
1208
-                'label'      => wp_kses_post( $field['label'] ),
1209
-                'placeholder' => esc_attr( $field['placeholder'] ),
1208
+                'label'      => wp_kses_post($field['label']),
1209
+                'placeholder' => esc_attr($field['placeholder']),
1210 1210
                 'no_wrap'    => true,
1211 1211
                 'type'       => 'number',
1212 1212
             )
1213 1213
         );
1214 1214
 
1215
-        if ( ! empty( $field['description'] ) ) {
1216
-            $description = wp_kses_post( $field['description'] );
1215
+        if (!empty($field['description'])) {
1216
+            $description = wp_kses_post($field['description']);
1217 1217
             echo "<small class='form-text text-muted'>$description</small>";
1218 1218
         }
1219 1219
 
@@ -1224,16 +1224,16 @@  discard block
 block discarded – undo
1224 1224
     /**
1225 1225
      * Renders the edit number element template.
1226 1226
      */
1227
-    public function edit_number_template( $field ) {
1228
-        $restrict = $this->get_restrict_markup( $field, 'number' );
1229
-        $label    = __( 'Field Label', 'invoicing' );
1227
+    public function edit_number_template($field) {
1228
+        $restrict = $this->get_restrict_markup($field, 'number');
1229
+        $label    = __('Field Label', 'invoicing');
1230 1230
         $id       = $field . '.id + "_edit"';
1231
-        $label2   = __( 'Placeholder text', 'invoicing' );
1231
+        $label2   = __('Placeholder text', 'invoicing');
1232 1232
         $id2      = $field . '.id + "_edit2"';
1233
-        $label3   = __( 'Help text', 'invoicing' );
1234
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1233
+        $label3   = __('Help text', 'invoicing');
1234
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1235 1235
         $id3      = $field . '.id + "_edit3"';
1236
-        $label5   = __( 'Is this field required?', 'invoicing' );
1236
+        $label5   = __('Is this field required?', 'invoicing');
1237 1237
         $id4      = $field . '.id + "_edit4"';
1238 1238
         echo "
1239 1239
             <div $restrict>
@@ -1261,23 +1261,23 @@  discard block
 block discarded – undo
1261 1261
     /**
1262 1262
      * Renders the separator element template.
1263 1263
      */
1264
-    public function render_separator_template( $field ) {
1265
-        $restrict = $this->get_restrict_markup( $field, 'separator' );
1264
+    public function render_separator_template($field) {
1265
+        $restrict = $this->get_restrict_markup($field, 'separator');
1266 1266
         echo "<hr class='featurette-divider mt-0 mb-2' $restrict>";
1267 1267
     }
1268 1268
 
1269 1269
     /**
1270 1270
      * Renders the separator element on the frontend.
1271 1271
      */
1272
-    public function frontend_render_separator_template( $field ) {
1272
+    public function frontend_render_separator_template($field) {
1273 1273
         echo '<hr class="featurette-divider mt-0 mb-2" />';
1274 1274
     }
1275 1275
 
1276 1276
     /**
1277 1277
      * Renders the pay button element template.
1278 1278
      */
1279
-    public function render_pay_button_template( $field ) {
1280
-        $restrict = $this->get_restrict_markup( $field, 'pay_button' );
1279
+    public function render_pay_button_template($field) {
1280
+        $restrict = $this->get_restrict_markup($field, 'pay_button');
1281 1281
         $label    = "$field.label";
1282 1282
         echo "
1283 1283
             <div $restrict>
@@ -1290,24 +1290,24 @@  discard block
 block discarded – undo
1290 1290
     /**
1291 1291
      * Renders the pay_button element on the frontend.
1292 1292
      */
1293
-    public function frontend_render_pay_button_template( $field ) {
1293
+    public function frontend_render_pay_button_template($field) {
1294 1294
         
1295 1295
         echo "<div class='form-group'>";
1296 1296
 
1297
-        $class = 'btn btn-block submit-button ' . sanitize_html_class( $field['class'] );
1297
+        $class = 'btn btn-block submit-button ' . sanitize_html_class($field['class']);
1298 1298
         echo aui()->input(
1299 1299
             array(
1300
-                'name'       => esc_attr( $field['id'] ),
1301
-                'id'         => esc_attr( $field['id'] ),
1302
-                'value'      => esc_attr( $field['label'] ),
1300
+                'name'       => esc_attr($field['id']),
1301
+                'id'         => esc_attr($field['id']),
1302
+                'value'      => esc_attr($field['label']),
1303 1303
                 'no_wrap'    => true,
1304 1304
                 'type'       => 'submit',
1305 1305
                 'class'      => $class,
1306 1306
             )
1307 1307
         );
1308 1308
 
1309
-        if ( ! empty( $field['description'] ) ) {
1310
-            $description = wp_kses_post( $field['description'] );
1309
+        if (!empty($field['description'])) {
1310
+            $description = wp_kses_post($field['description']);
1311 1311
             echo "<small class='form-text text-muted'>$description</small>";
1312 1312
         }
1313 1313
 
@@ -1318,14 +1318,14 @@  discard block
 block discarded – undo
1318 1318
     /**
1319 1319
      * Renders the pay button element template.
1320 1320
      */
1321
-    public function edit_pay_button_template( $field ) {
1322
-        $restrict = $this->get_restrict_markup( $field, 'pay_button' );
1323
-        $label    = __( 'Button Text', 'invoicing' );
1321
+    public function edit_pay_button_template($field) {
1322
+        $restrict = $this->get_restrict_markup($field, 'pay_button');
1323
+        $label    = __('Button Text', 'invoicing');
1324 1324
         $id       = $field . '.id + "_edit"';
1325
-        $label2   = __( 'Help text', 'invoicing' );
1326
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1325
+        $label2   = __('Help text', 'invoicing');
1326
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
1327 1327
         $id2      = $field . '.id + "_edit2"';
1328
-        $label4   = esc_attr__( 'Button Type', 'invoicing' );
1328
+        $label4   = esc_attr__('Button Type', 'invoicing');
1329 1329
         $id3      = $field . '.id + "_edit3"';
1330 1330
         echo "
1331 1331
             <div $restrict>
@@ -1341,15 +1341,15 @@  discard block
 block discarded – undo
1341 1341
                     <label :for='$id3'>$label4</label>
1342 1342
 
1343 1343
                     <select class='form-control custom-select' :id='$id3' v-model='$field.class'>
1344
-                        <option value='btn-primary'>"   . __( 'Primary', 'invoicing' ) ."</option>
1345
-                        <option value='btn-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option>
1346
-                        <option value='btn-success'>"   . __( 'Success', 'invoicing' ) ."</option>
1347
-                        <option value='btn-danger'>"    . __( 'Danger', 'invoicing' ) ."</option>
1348
-                        <option value='btn-warning'>"   . __( 'Warning', 'invoicing' ) ."</option>
1349
-                        <option value='btn-info'>"      . __( 'Info', 'invoicing' ) ."</option>
1350
-                        <option value='btn-light'>"     . __( 'Light', 'invoicing' ) ."</option>
1351
-                        <option value='btn-dark'>"      . __( 'Dark', 'invoicing' ) ."</option>
1352
-                        <option value='btn-link'>"      . __( 'Link', 'invoicing' ) ."</option>
1344
+                        <option value='btn-primary'>" . __('Primary', 'invoicing') . "</option>
1345
+                        <option value='btn-secondary'>" . __('Secondary', 'invoicing') . "</option>
1346
+                        <option value='btn-success'>"   . __('Success', 'invoicing') . "</option>
1347
+                        <option value='btn-danger'>"    . __('Danger', 'invoicing') . "</option>
1348
+                        <option value='btn-warning'>"   . __('Warning', 'invoicing') . "</option>
1349
+                        <option value='btn-info'>"      . __('Info', 'invoicing') . "</option>
1350
+                        <option value='btn-light'>"     . __('Light', 'invoicing') . "</option>
1351
+                        <option value='btn-dark'>"      . __('Dark', 'invoicing') . "</option>
1352
+                        <option value='btn-link'>"      . __('Link', 'invoicing') . "</option>
1353 1353
                     </select>
1354 1354
                 </div>
1355 1355
             </div>
@@ -1360,8 +1360,8 @@  discard block
 block discarded – undo
1360 1360
     /**
1361 1361
      * Renders the alert element template.
1362 1362
      */
1363
-    public function render_alert_template( $field ) {
1364
-        $restrict = $this->get_restrict_markup( $field, 'alert' );
1363
+    public function render_alert_template($field) {
1364
+        $restrict = $this->get_restrict_markup($field, 'alert');
1365 1365
         $text     = "$field.text";
1366 1366
         echo "
1367 1367
             <div $restrict class='alert' :class='$field.class' role='alert'>
@@ -1376,15 +1376,15 @@  discard block
 block discarded – undo
1376 1376
     /**
1377 1377
      * Renders the alert element on the frontend.
1378 1378
      */
1379
-    public function frontend_render_alert_template( $field ) {
1379
+    public function frontend_render_alert_template($field) {
1380 1380
         
1381 1381
         echo "<div class='form-group'>";
1382 1382
 
1383 1383
         echo aui()->alert(
1384 1384
             array(
1385
-                'content'     => wp_kses_post( $field['text'] ),
1385
+                'content'     => wp_kses_post($field['text']),
1386 1386
                 'dismissible' => $field['dismissible'],
1387
-                'type'        => str_replace( 'alert-', '', $field['class'] ),
1387
+                'type'        => str_replace('alert-', '', $field['class']),
1388 1388
             )
1389 1389
         );
1390 1390
 
@@ -1395,14 +1395,14 @@  discard block
 block discarded – undo
1395 1395
     /**
1396 1396
      * Renders the alert element template.
1397 1397
      */
1398
-    public function edit_alert_template( $field ) {
1399
-        $restrict = $this->get_restrict_markup( $field, 'alert' );
1400
-        $label    = __( 'Alert Text', 'invoicing' );
1401
-        $label2   = esc_attr__( 'Enter your alert text here', 'invoicing' );
1398
+    public function edit_alert_template($field) {
1399
+        $restrict = $this->get_restrict_markup($field, 'alert');
1400
+        $label    = __('Alert Text', 'invoicing');
1401
+        $label2   = esc_attr__('Enter your alert text here', 'invoicing');
1402 1402
         $id       = $field . '.id + "_edit"';
1403
-        $label3   = __( 'Is Dismissible?', 'invoicing' );
1403
+        $label3   = __('Is Dismissible?', 'invoicing');
1404 1404
         $id2      = $field . '.id + "_edit2"';
1405
-        $label4   = esc_attr__( 'Alert Type', 'invoicing' );
1405
+        $label4   = esc_attr__('Alert Type', 'invoicing');
1406 1406
         $id3      = $field . '.id + "_edit3"';
1407 1407
         echo "
1408 1408
             <div $restrict>
@@ -1418,14 +1418,14 @@  discard block
 block discarded – undo
1418 1418
                     <label :for='$id3'>$label4</label>
1419 1419
 
1420 1420
                     <select class='form-control custom-select' :id='$id3' v-model='$field.class'>
1421
-                        <option value='alert-primary'>"   . __( 'Primary', 'invoicing' ) ."</option>
1422
-                        <option value='alert-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option>
1423
-                        <option value='alert-success'>"   . __( 'Success', 'invoicing' ) ."</option>
1424
-                        <option value='alert-danger'>"    . __( 'Danger', 'invoicing' ) ."</option>
1425
-                        <option value='alert-warning'>"   . __( 'Warning', 'invoicing' ) ."</option>
1426
-                        <option value='alert-info'>"      . __( 'Info', 'invoicing' ) ."</option>
1427
-                        <option value='alert-light'>"     . __( 'Light', 'invoicing' ) ."</option>
1428
-                        <option value='alert-dark'>"      . __( 'Dark', 'invoicing' ) ."</option>
1421
+                        <option value='alert-primary'>" . __('Primary', 'invoicing') . "</option>
1422
+                        <option value='alert-secondary'>" . __('Secondary', 'invoicing') . "</option>
1423
+                        <option value='alert-success'>"   . __('Success', 'invoicing') . "</option>
1424
+                        <option value='alert-danger'>"    . __('Danger', 'invoicing') . "</option>
1425
+                        <option value='alert-warning'>"   . __('Warning', 'invoicing') . "</option>
1426
+                        <option value='alert-info'>"      . __('Info', 'invoicing') . "</option>
1427
+                        <option value='alert-light'>"     . __('Light', 'invoicing') . "</option>
1428
+                        <option value='alert-dark'>"      . __('Dark', 'invoicing') . "</option>
1429 1429
                     </select>
1430 1430
                 </div>
1431 1431
             </div>
@@ -1436,8 +1436,8 @@  discard block
 block discarded – undo
1436 1436
     /**
1437 1437
      * Renders the discount element template.
1438 1438
      */
1439
-    public function render_discount_template( $field ) {
1440
-        $restrict  = $this->get_restrict_markup( $field, 'discount' );
1439
+    public function render_discount_template($field) {
1440
+        $restrict = $this->get_restrict_markup($field, 'discount');
1441 1441
         ?>
1442 1442
 
1443 1443
             <div <?php echo $restrict; ?> class="discount_field  border rounded p-3">
@@ -1454,13 +1454,13 @@  discard block
 block discarded – undo
1454 1454
     /**
1455 1455
      * Renders the discount element on the frontend.
1456 1456
      */
1457
-    public function frontend_render_discount_template( $field ) {
1457
+    public function frontend_render_discount_template($field) {
1458 1458
         
1459
-        $placeholder = esc_attr( $field['input_label'] );
1460
-        $label       = sanitize_text_field( $field['button_label'] );
1459
+        $placeholder = esc_attr($field['input_label']);
1460
+        $label       = sanitize_text_field($field['button_label']);
1461 1461
         $description = '';
1462 1462
 
1463
-        if ( ! empty( $field['description'] ) ) {
1463
+        if (!empty($field['description'])) {
1464 1464
             $description = "<small class='form-text text-muted'>{$field['description']}</small>";
1465 1465
         }
1466 1466
 ?>
@@ -1481,12 +1481,12 @@  discard block
 block discarded – undo
1481 1481
     /**
1482 1482
      * Renders the discount element template.
1483 1483
      */
1484
-    public function edit_discount_template( $field ) {
1485
-        $restrict = $this->get_restrict_markup( $field, 'discount' );
1486
-        $label    = __( 'Discount Input Placeholder', 'invoicing' );
1487
-        $label2   = __( 'Help Text', 'invoicing' );
1488
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1489
-        $label4   = __( 'Button Text', 'invoicing' );
1484
+    public function edit_discount_template($field) {
1485
+        $restrict = $this->get_restrict_markup($field, 'discount');
1486
+        $label    = __('Discount Input Placeholder', 'invoicing');
1487
+        $label2   = __('Help Text', 'invoicing');
1488
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
1489
+        $label4   = __('Button Text', 'invoicing');
1490 1490
         $id       = $field . '.id + "_edit"';
1491 1491
         $id2      = $field . '.id + "_edit2"';
1492 1492
         $id3      = $field . '.id + "_edit3"';
@@ -1515,48 +1515,48 @@  discard block
 block discarded – undo
1515 1515
     /**
1516 1516
      * Renders the items element template.
1517 1517
      */
1518
-    public function render_items_template( $field ) {
1519
-        $restrict  = $this->get_restrict_markup( $field, 'items' );
1520
-        $label     = __( 'Item totals placeholder. Item totals will appear here. Click to set items.', 'invoicing' );
1518
+    public function render_items_template($field) {
1519
+        $restrict  = $this->get_restrict_markup($field, 'items');
1520
+        $label     = __('Item totals placeholder. Item totals will appear here. Click to set items.', 'invoicing');
1521 1521
         echo "<div $restrict class='item_totals p-4 bg-warning'>$label</div>";
1522 1522
     }
1523 1523
 
1524 1524
     /**
1525 1525
      * Renders the items element on the frontend.
1526 1526
      */
1527
-    public function frontend_render_items_template( $field, $items ) {
1527
+    public function frontend_render_items_template($field, $items) {
1528 1528
         
1529 1529
         echo "<div class='form-group item_totals'>";
1530 1530
         
1531
-        $id = esc_attr( $field['id'] );
1532
-        if ( 'total' == $field[ 'items_type' ] ) {
1531
+        $id = esc_attr($field['id']);
1532
+        if ('total' == $field['items_type']) {
1533 1533
             $total = 0;
1534 1534
 
1535 1535
             ?>
1536 1536
             <div class="border item_totals_type_total">
1537 1537
 
1538 1538
                 <?php
1539
-                    foreach( $items as $item ) {
1540
-                        $total = $total + floatval( $item['price'] );
1539
+                    foreach ($items as $item) {
1540
+                        $total = $total + floatval($item['price']);
1541 1541
 
1542 1542
                         $class  = 'col-8';
1543 1543
                         $class2 = '';
1544 1544
 
1545
-                        if ( ! empty( $item['allow_quantities'] ) ) {
1545
+                        if (!empty($item['allow_quantities'])) {
1546 1546
                             $class = 'col-6 pt-2';
1547 1547
                             $class2 = 'pt-2';
1548 1548
                         }
1549 1549
 
1550
-                        if ( ! empty( $item['custom_price'] ) ) {
1550
+                        if (!empty($item['custom_price'])) {
1551 1551
                             $class .= ' pt-2';
1552 1552
                         }
1553 1553
             
1554 1554
                 ?>
1555 1555
                     <div  class="item_totals_item">
1556 1556
                         <div class='row pl-2 pr-2 pt-2'>
1557
-                            <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div>
1557
+                            <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div>
1558 1558
 
1559
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
1559
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
1560 1560
 
1561 1561
                                 <div class='col-2'>
1562 1562
                                     <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>
@@ -1564,11 +1564,11 @@  discard block
 block discarded – undo
1564 1564
 
1565 1565
                             <?php } else { ?>
1566 1566
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
1567
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
1567
+                            <?php } if (empty($item['custom_price'])) { ?>
1568 1568
 
1569 1569
                                 <div class='col-4 <?php echo $class2; ?>'>
1570
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
1571
-                                    <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
1570
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
1571
+                                    <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
1572 1572
                                 </div>
1573 1573
 
1574 1574
                             <?php } else {?>
@@ -1576,15 +1576,15 @@  discard block
 block discarded – undo
1576 1576
                                 <div class='col-4'>
1577 1577
                                     <div class='input-group'>
1578 1578
 
1579
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
1579
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
1580 1580
                                             <div class='input-group-prepend'>
1581 1581
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
1582 1582
                                             </div>
1583 1583
                                         <?php } ?>
1584 1584
 
1585
-                                        <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'] ); ?>'>
1585
+                                        <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']); ?>'>
1586 1586
                                     
1587
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
1587
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
1588 1588
                                             <div class='input-group-append'>
1589 1589
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
1590 1590
                                             </div>
@@ -1595,38 +1595,38 @@  discard block
 block discarded – undo
1595 1595
                             <?php } ?>
1596 1596
 
1597 1597
                         </div>
1598
-                        <?php if ( ! empty( $item['description'] )) { ?>
1599
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
1598
+                        <?php if (!empty($item['description'])) { ?>
1599
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
1600 1600
                         <?php } ?>
1601 1601
                     </div>
1602 1602
                 <?php } ?>
1603 1603
 
1604 1604
                 <div class='mt-4 border-top item_totals_total'>
1605 1605
                     <div class='row p-2'>
1606
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
1607
-                        <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>
1606
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
1607
+                        <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>
1608 1608
                     </div>
1609 1609
                 </div>
1610 1610
 
1611 1611
             </div>
1612 1612
         <?php } ?>
1613 1613
 
1614
-        <?php if ( 'radio' == $field[ 'items_type' ] ) { ?>
1614
+        <?php if ('radio' == $field['items_type']) { ?>
1615 1615
             <div class="item_totals_type_radio">
1616 1616
 
1617 1617
                 <?php
1618
-                    foreach( $items as $index => $item ) {
1618
+                    foreach ($items as $index => $item) {
1619 1619
                 
1620
-                        if ( ! empty( $item['required'] ) ) {
1620
+                        if (!empty($item['required'])) {
1621 1621
                             continue;
1622 1622
                         }
1623 1623
                 ?>
1624 1624
                     <div  class="form-check">
1625
-                        <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'>
1626
-                        <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>
1625
+                        <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'>
1626
+                        <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>
1627 1627
                     </div>
1628
-                    <?php if ( ! empty( $item['description'] )) { ?>
1629
-                        <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
1628
+                    <?php if (!empty($item['description'])) { ?>
1629
+                        <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
1630 1630
                     <?php } ?>
1631 1631
                 <?php } ?>
1632 1632
 
@@ -1636,29 +1636,29 @@  discard block
 block discarded – undo
1636 1636
 
1637 1637
                         $total = 0;
1638 1638
 
1639
-                        foreach ( $items as $item ) {
1639
+                        foreach ($items as $item) {
1640 1640
 
1641 1641
                             $class  = 'col-8';
1642 1642
                             $class2 = '';
1643 1643
 
1644
-                            if ( ! empty( $item['allow_quantities'] ) ) {
1644
+                            if (!empty($item['allow_quantities'])) {
1645 1645
                                 $class = 'col-6 pt-2';
1646 1646
                                 $class2 = 'pt-2';
1647 1647
                             }
1648 1648
 
1649
-                            if ( ! empty( $item['custom_price'] ) ) {
1649
+                            if (!empty($item['custom_price'])) {
1650 1650
                                 $class .= ' pt-2';
1651 1651
                             }
1652 1652
 
1653 1653
                             $class3 = 'd-none';
1654 1654
                             $name   = '';
1655
-                            if ( ! empty( $item['required'] ) || ! isset( $totals_selected_radio_item ) ) {
1655
+                            if (!empty($item['required']) || !isset($totals_selected_radio_item)) {
1656 1656
 
1657
-                                $total = $total + floatval( $item['price'] );
1657
+                                $total = $total + floatval($item['price']);
1658 1658
                                 $class3 = '';
1659 1659
                                 $name   = "wpinv-items[{$item['id']}]";
1660 1660
 
1661
-                                if ( empty( $item['required'] ) ) {
1661
+                                if (empty($item['required'])) {
1662 1662
                                     $totals_selected_radio_item = 1;
1663 1663
                                 }
1664 1664
 
@@ -1670,9 +1670,9 @@  discard block
 block discarded – undo
1670 1670
 
1671 1671
                     <div  class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>">
1672 1672
                         <div class='row pl-2 pr-2 pt-2'>
1673
-                            <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div>
1673
+                            <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div>
1674 1674
 
1675
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
1675
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
1676 1676
 
1677 1677
                                 <div class='col-2'>
1678 1678
                                     <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>
@@ -1680,11 +1680,11 @@  discard block
 block discarded – undo
1680 1680
 
1681 1681
                             <?php } else { ?>
1682 1682
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
1683
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
1683
+                            <?php } if (empty($item['custom_price'])) { ?>
1684 1684
 
1685 1685
                                 <div class='col-4 <?php echo $class2; ?>'>
1686
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
1687
-                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
1686
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
1687
+                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
1688 1688
                                 </div>
1689 1689
 
1690 1690
                             <?php } else {?>
@@ -1692,15 +1692,15 @@  discard block
 block discarded – undo
1692 1692
                                 <div class='col-4'>
1693 1693
                                     <div class='input-group'>
1694 1694
 
1695
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
1695
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
1696 1696
                                             <div class='input-group-prepend'>
1697 1697
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
1698 1698
                                             </div>
1699 1699
                                         <?php } ?>
1700 1700
 
1701
-                                        <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'] ); ?>'>
1701
+                                        <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']); ?>'>
1702 1702
                                     
1703
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
1703
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
1704 1704
                                             <div class='input-group-append'>
1705 1705
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
1706 1706
                                             </div>
@@ -1711,16 +1711,16 @@  discard block
 block discarded – undo
1711 1711
                             <?php } ?>
1712 1712
 
1713 1713
                         </div>
1714
-                        <?php if ( ! empty( $item['description'] )) { ?>
1715
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
1714
+                        <?php if (!empty($item['description'])) { ?>
1715
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
1716 1716
                         <?php } ?>
1717 1717
                     </div>
1718 1718
                 <?php } ?>
1719 1719
 
1720 1720
                 <div class='mt-4 border-top item_totals_total'>
1721 1721
                     <div class='row p-2'>
1722
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
1723
-                        <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>
1722
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
1723
+                        <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>
1724 1724
                     </div>
1725 1725
                 </div>
1726 1726
 
@@ -1728,22 +1728,22 @@  discard block
 block discarded – undo
1728 1728
             </div>
1729 1729
         <?php } ?>
1730 1730
 
1731
-        <?php if ( 'checkbox' == $field[ 'items_type' ] ) { ?>
1731
+        <?php if ('checkbox' == $field['items_type']) { ?>
1732 1732
 
1733 1733
             <div class="item_totals_type_checkbox">
1734 1734
 
1735 1735
                 <?php
1736
-                    foreach ( $items as $index => $item ) {
1736
+                    foreach ($items as $index => $item) {
1737 1737
 
1738
-                        if ( ! empty( $item['required'] ) ) {
1738
+                        if (!empty($item['required'])) {
1739 1739
                             continue;
1740 1740
                         }
1741 1741
 
1742
-                        $title = sanitize_text_field(  $item['title'] );
1743
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
1744
-                        $item_id    = esc_attr( $id . "_$index" );
1745
-                        $value = esc_attr( $item['id'] );
1746
-                        $checked = checked( ! isset( $selected_checkbox_item ), true, false );
1742
+                        $title = sanitize_text_field($item['title']);
1743
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
1744
+                        $item_id = esc_attr($id . "_$index");
1745
+                        $value = esc_attr($item['id']);
1746
+                        $checked = checked(!isset($selected_checkbox_item), true, false);
1747 1747
                         $selected_checkbox_item = 1;
1748 1748
 
1749 1749
                         echo "
@@ -1752,7 +1752,7 @@  discard block
 block discarded – undo
1752 1752
                                 <label for='$item_id' class='custom-control-label'>$title &nbsp; ($price)</label>
1753 1753
                             </div>";
1754 1754
 
1755
-                        if ( ! empty( $item['description'] ) ) {
1755
+                        if (!empty($item['description'])) {
1756 1756
                             echo "<small class='form-text text-muted'>{$item['description']}</small>";
1757 1757
                         }
1758 1758
                     }
@@ -1764,29 +1764,29 @@  discard block
 block discarded – undo
1764 1764
 
1765 1765
                         $total = 0;
1766 1766
 
1767
-                        foreach ( $items as $item ) {
1767
+                        foreach ($items as $item) {
1768 1768
 
1769 1769
                             $class  = 'col-8';
1770 1770
                             $class2 = '';
1771 1771
 
1772
-                            if ( ! empty( $item['allow_quantities'] ) ) {
1772
+                            if (!empty($item['allow_quantities'])) {
1773 1773
                                 $class = 'col-6 pt-2';
1774 1774
                                 $class2 = 'pt-2';
1775 1775
                             }
1776 1776
 
1777
-                            if ( ! empty( $item['custom_price'] ) ) {
1777
+                            if (!empty($item['custom_price'])) {
1778 1778
                                 $class .= ' pt-2';
1779 1779
                             }
1780 1780
 
1781 1781
                             $class3 = 'd-none';
1782
-                            $name  = '';
1783
-                            if ( ! empty( $item['required'] ) || ! isset( $totals_selected_checkbox_item ) ) {
1782
+                            $name = '';
1783
+                            if (!empty($item['required']) || !isset($totals_selected_checkbox_item)) {
1784 1784
 
1785
-                                $total = $total + floatval( $item['price'] );
1785
+                                $total = $total + floatval($item['price']);
1786 1786
                                 $class3 = '';
1787 1787
                                 $name  = "wpinv-items[{$item['id']}]";
1788 1788
 
1789
-                                if ( empty( $item['required'] ) ) {
1789
+                                if (empty($item['required'])) {
1790 1790
                                     $totals_selected_checkbox_item = 1;
1791 1791
                                 }
1792 1792
 
@@ -1798,9 +1798,9 @@  discard block
 block discarded – undo
1798 1798
 
1799 1799
                     <div  class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>">
1800 1800
                         <div class='row pl-2 pr-2 pt-2'>
1801
-                            <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div>
1801
+                            <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div>
1802 1802
 
1803
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
1803
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
1804 1804
 
1805 1805
                                 <div class='col-2'>
1806 1806
                                     <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>
@@ -1808,11 +1808,11 @@  discard block
 block discarded – undo
1808 1808
 
1809 1809
                             <?php } else { ?>
1810 1810
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
1811
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
1811
+                            <?php } if (empty($item['custom_price'])) { ?>
1812 1812
 
1813 1813
                                 <div class='col-4 <?php echo $class2; ?>'>
1814
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
1815
-                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
1814
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
1815
+                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
1816 1816
                                 </div>
1817 1817
 
1818 1818
                             <?php } else {?>
@@ -1820,15 +1820,15 @@  discard block
 block discarded – undo
1820 1820
                                 <div class='col-4'>
1821 1821
                                     <div class='input-group'>
1822 1822
 
1823
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
1823
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
1824 1824
                                             <div class='input-group-prepend'>
1825 1825
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
1826 1826
                                             </div>
1827 1827
                                         <?php } ?>
1828 1828
 
1829
-                                        <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'] ); ?>'>
1829
+                                        <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']); ?>'>
1830 1830
                                     
1831
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
1831
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
1832 1832
                                             <div class='input-group-append'>
1833 1833
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
1834 1834
                                             </div>
@@ -1839,23 +1839,23 @@  discard block
 block discarded – undo
1839 1839
                             <?php } ?>
1840 1840
 
1841 1841
                         </div>
1842
-                        <?php if ( ! empty( $item['description'] )) { ?>
1843
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
1842
+                        <?php if (!empty($item['description'])) { ?>
1843
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
1844 1844
                         <?php } ?>
1845 1845
                     </div>
1846 1846
                 <?php } ?>
1847 1847
 
1848 1848
                 <div class='mt-4 border-top item_totals_total'>
1849 1849
                     <div class='row p-2'>
1850
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
1851
-                        <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>
1850
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
1851
+                        <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>
1852 1852
                     </div>
1853 1853
                 </div>
1854 1854
             </div>
1855 1855
             </div>
1856 1856
         <?php } ?>
1857 1857
 
1858
-        <?php if ( 'select' == $field[ 'items_type' ] ) { ?>
1858
+        <?php if ('select' == $field['items_type']) { ?>
1859 1859
 
1860 1860
             <div class="item_totals_type_select">
1861 1861
 
@@ -1863,17 +1863,17 @@  discard block
 block discarded – undo
1863 1863
 
1864 1864
                     $options  = array();
1865 1865
                     $selected = '';
1866
-                    foreach ( $items as $index => $item ) {
1866
+                    foreach ($items as $index => $item) {
1867 1867
 
1868
-                        if ( ! empty( $item['required'] ) ) {
1868
+                        if (!empty($item['required'])) {
1869 1869
                             continue;
1870 1870
                         }
1871 1871
 
1872
-                        $title = sanitize_text_field(  $item['title'] );
1873
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
1874
-                        $options[ $item['id'] ] = "$title &nbsp; ($price)";
1872
+                        $title = sanitize_text_field($item['title']);
1873
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
1874
+                        $options[$item['id']] = "$title &nbsp; ($price)";
1875 1875
 
1876
-                        if ( ! isset( $selected_item ) ) {
1876
+                        if (!isset($selected_item)) {
1877 1877
                             $selected = $item['id'];
1878 1878
                             $selected_item = 1;
1879 1879
                         }
@@ -1884,7 +1884,7 @@  discard block
 block discarded – undo
1884 1884
                         array(
1885 1885
                                 'name'        => 'payment-form-items',
1886 1886
                                 'id'          => $id,
1887
-                                'placeholder' => __( 'Select an item', 'invoicing' ),
1887
+                                'placeholder' => __('Select an item', 'invoicing'),
1888 1888
                                 'no_wrap'     => true,
1889 1889
                                 'options'     => $options,
1890 1890
                                 'class'       => 'wpi_select2 wpinv-items-select-selector',
@@ -1899,29 +1899,29 @@  discard block
 block discarded – undo
1899 1899
 
1900 1900
                         $total = 0;
1901 1901
 
1902
-                        foreach ( $items as $item ) {
1902
+                        foreach ($items as $item) {
1903 1903
 
1904 1904
                             $class  = 'col-8';
1905 1905
                             $class2 = '';
1906 1906
 
1907
-                            if ( ! empty( $item['allow_quantities'] ) ) {
1907
+                            if (!empty($item['allow_quantities'])) {
1908 1908
                                 $class = 'col-6 pt-2';
1909 1909
                                 $class2 = 'pt-2';
1910 1910
                             }
1911 1911
 
1912
-                            if ( ! empty( $item['custom_price'] ) ) {
1912
+                            if (!empty($item['custom_price'])) {
1913 1913
                                 $class .= ' pt-2';
1914 1914
                             }
1915 1915
 
1916 1916
                             $class3 = 'd-none';
1917
-                            $name  = '';
1918
-                            if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) {
1917
+                            $name = '';
1918
+                            if (!empty($item['required']) || !isset($totals_selected_select_item)) {
1919 1919
 
1920
-                                $total = $total + floatval( $item['price'] );
1920
+                                $total = $total + floatval($item['price']);
1921 1921
                                 $class3 = '';
1922 1922
                                 $name  = "wpinv-items[{$item['id']}]";
1923 1923
 
1924
-                                if ( empty( $item['required'] ) ) {
1924
+                                if (empty($item['required'])) {
1925 1925
                                     $totals_selected_select_item = 1;
1926 1926
                                 }
1927 1927
 
@@ -1933,9 +1933,9 @@  discard block
 block discarded – undo
1933 1933
 
1934 1934
                     <div  class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>">
1935 1935
                         <div class='row pl-2 pr-2 pt-2'>
1936
-                            <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div>
1936
+                            <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div>
1937 1937
 
1938
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
1938
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
1939 1939
 
1940 1940
                                 <div class='col-2'>
1941 1941
                                     <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>
@@ -1943,11 +1943,11 @@  discard block
 block discarded – undo
1943 1943
 
1944 1944
                             <?php } else { ?>
1945 1945
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
1946
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
1946
+                            <?php } if (empty($item['custom_price'])) { ?>
1947 1947
 
1948 1948
                                 <div class='col-4 <?php echo $class2; ?>'>
1949
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
1950
-                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
1949
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
1950
+                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
1951 1951
                                 </div>
1952 1952
 
1953 1953
                             <?php } else {?>
@@ -1955,15 +1955,15 @@  discard block
 block discarded – undo
1955 1955
                                 <div class='col-4'>
1956 1956
                                     <div class='input-group'>
1957 1957
 
1958
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
1958
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
1959 1959
                                             <div class='input-group-prepend'>
1960 1960
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
1961 1961
                                             </div>
1962 1962
                                         <?php } ?>
1963 1963
 
1964
-                                        <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'] ); ?>'>
1964
+                                        <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']); ?>'>
1965 1965
                                     
1966
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
1966
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
1967 1967
                                             <div class='input-group-append'>
1968 1968
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
1969 1969
                                             </div>
@@ -1974,23 +1974,23 @@  discard block
 block discarded – undo
1974 1974
                             <?php } ?>
1975 1975
 
1976 1976
                         </div>
1977
-                        <?php if ( ! empty( $item['description'] )) { ?>
1978
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
1977
+                        <?php if (!empty($item['description'])) { ?>
1978
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
1979 1979
                         <?php } ?>
1980 1980
                     </div>
1981 1981
                 <?php } ?>
1982 1982
 
1983 1983
                 <div class='mt-4 border-top item_totals_total'>
1984 1984
                     <div class='row p-2'>
1985
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
1986
-                        <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>
1985
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
1986
+                        <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>
1987 1987
                     </div>
1988 1988
                 </div>
1989 1989
 
1990 1990
             </div>
1991 1991
         <?php } ?>
1992 1992
 
1993
-        <?php if ( 'multi_select' == $field[ 'items_type' ] ) { ?>
1993
+        <?php if ('multi_select' == $field['items_type']) { ?>
1994 1994
 
1995 1995
             <div class="item_totals_type_multi_select">
1996 1996
 
@@ -1999,18 +1999,18 @@  discard block
 block discarded – undo
1999 1999
                     $options  = array();
2000 2000
                     $selected = array();
2001 2001
 
2002
-                    foreach ( $items as $index => $item ) {
2002
+                    foreach ($items as $index => $item) {
2003 2003
 
2004
-                        if ( ! empty( $item['required'] ) ) {
2004
+                        if (!empty($item['required'])) {
2005 2005
                             continue;
2006 2006
                         }
2007 2007
                     
2008
-                        $title = sanitize_text_field(  $item['title'] );
2009
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
2010
-                        $options[ $item['id'] ] = "$title &nbsp; ($price)";
2008
+                        $title = sanitize_text_field($item['title']);
2009
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
2010
+                        $options[$item['id']] = "$title &nbsp; ($price)";
2011 2011
 
2012
-                        if ( ! isset( $selected_item ) ) {
2013
-                            $selected = array( $item['id'] );
2012
+                        if (!isset($selected_item)) {
2013
+                            $selected = array($item['id']);
2014 2014
                             $selected_item = 1;
2015 2015
                         }
2016 2016
 
@@ -2035,29 +2035,29 @@  discard block
 block discarded – undo
2035 2035
 
2036 2036
                         $total = 0;
2037 2037
 
2038
-                        foreach ( $items as $item ) {
2038
+                        foreach ($items as $item) {
2039 2039
 
2040 2040
                             $class  = 'col-8';
2041 2041
                             $class2 = '';
2042 2042
 
2043
-                            if ( ! empty( $item['allow_quantities'] ) ) {
2043
+                            if (!empty($item['allow_quantities'])) {
2044 2044
                                 $class = 'col-6 pt-2';
2045 2045
                                 $class2 = 'pt-2';
2046 2046
                             }
2047 2047
 
2048
-                            if ( ! empty( $item['custom_price'] ) ) {
2048
+                            if (!empty($item['custom_price'])) {
2049 2049
                                 $class .= ' pt-2';
2050 2050
                             }
2051 2051
 
2052 2052
                             $class3 = 'd-none';
2053
-                            $name  = '';
2054
-                            if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) {
2053
+                            $name = '';
2054
+                            if (!empty($item['required']) || !isset($totals_selected_select_item)) {
2055 2055
 
2056
-                                $total = $total + floatval( $item['price'] );
2056
+                                $total = $total + floatval($item['price']);
2057 2057
                                 $class3 = '';
2058 2058
                                 $name  = "wpinv-items[{$item['id']}]";
2059 2059
 
2060
-                                if ( empty( $item['required'] ) ) {
2060
+                                if (empty($item['required'])) {
2061 2061
                                     $totals_selected_select_item = 1;
2062 2062
                                 }
2063 2063
 
@@ -2069,9 +2069,9 @@  discard block
 block discarded – undo
2069 2069
 
2070 2070
                     <div  class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>">
2071 2071
                         <div class='row pl-2 pr-2 pt-2'>
2072
-                            <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div>
2072
+                            <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div>
2073 2073
 
2074
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
2074
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
2075 2075
 
2076 2076
                                 <div class='col-2'>
2077 2077
                                     <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>
@@ -2079,11 +2079,11 @@  discard block
 block discarded – undo
2079 2079
 
2080 2080
                             <?php } else { ?>
2081 2081
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
2082
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
2082
+                            <?php } if (empty($item['custom_price'])) { ?>
2083 2083
 
2084 2084
                                 <div class='col-4 <?php echo $class2; ?>'>
2085
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
2086
-                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
2085
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
2086
+                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
2087 2087
                                 </div>
2088 2088
 
2089 2089
                             <?php } else {?>
@@ -2091,15 +2091,15 @@  discard block
 block discarded – undo
2091 2091
                                 <div class='col-4'>
2092 2092
                                     <div class='input-group'>
2093 2093
 
2094
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
2094
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
2095 2095
                                             <div class='input-group-prepend'>
2096 2096
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2097 2097
                                             </div>
2098 2098
                                         <?php } ?>
2099 2099
 
2100
-                                        <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'] ); ?>'>
2100
+                                        <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']); ?>'>
2101 2101
                                     
2102
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
2102
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
2103 2103
                                             <div class='input-group-append'>
2104 2104
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2105 2105
                                             </div>
@@ -2110,23 +2110,23 @@  discard block
 block discarded – undo
2110 2110
                             <?php } ?>
2111 2111
 
2112 2112
                         </div>
2113
-                        <?php if ( ! empty( $item['description'] )) { ?>
2114
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
2113
+                        <?php if (!empty($item['description'])) { ?>
2114
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
2115 2115
                         <?php } ?>
2116 2116
                     </div>
2117 2117
                 <?php } ?>
2118 2118
 
2119 2119
                 <div class='mt-4 border-top item_totals_total'>
2120 2120
                     <div class='row p-2'>
2121
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
2122
-                        <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>
2121
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
2122
+                        <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>
2123 2123
                     </div>
2124 2124
                 </div>
2125 2125
 
2126 2126
             </div>
2127 2127
         <?php } ?>
2128
-        <?php if ( ! empty( $field[ 'description' ] ) ) { ?>
2129
-            <small class='form-text text-muted'><?php echo wp_kses_post( $field[ 'description' ] ); ?></small>
2128
+        <?php if (!empty($field['description'])) { ?>
2129
+            <small class='form-text text-muted'><?php echo wp_kses_post($field['description']); ?></small>
2130 2130
         <?php } ?>
2131 2131
         </div>
2132 2132
         <?php
@@ -2135,20 +2135,20 @@  discard block
 block discarded – undo
2135 2135
     /**
2136 2136
      * Renders the items element template.
2137 2137
      */
2138
-    public function edit_items_template( $field ) {
2139
-        $restrict = $this->get_restrict_markup( $field, 'items' );
2140
-        $label    = __( 'Let customers...', 'invoicing' );
2141
-        $label2   = __( 'Available Items', 'invoicing' );
2142
-        $label3   = esc_attr__( 'Add some help text for this element', 'invoicing' );
2138
+    public function edit_items_template($field) {
2139
+        $restrict = $this->get_restrict_markup($field, 'items');
2140
+        $label    = __('Let customers...', 'invoicing');
2141
+        $label2   = __('Available Items', 'invoicing');
2142
+        $label3   = esc_attr__('Add some help text for this element', 'invoicing');
2143 2143
         $id       = $field . '.id + "_edit"';
2144 2144
         $id2      = $field . '.id + "_edit2"';
2145 2145
         $id3      = $field . '.id + "_edit3"';
2146 2146
         $id4      = $field . '.id + "_edit4"';
2147
-        $label4   = esc_attr__( 'This will be shown to the customer as the recommended price', 'invoicing' );
2148
-        $label5   = esc_attr__( 'Allow users to pay what they want', 'invoicing' );
2149
-        $label6   = esc_attr__( 'Enter the minimum price that a user can pay', 'invoicing' );
2150
-        $label7   = esc_attr__( 'Allow users to buy several quantities', 'invoicing' );
2151
-        $label8   = esc_attr__( 'This item is required', 'invoicing' );
2147
+        $label4   = esc_attr__('This will be shown to the customer as the recommended price', 'invoicing');
2148
+        $label5   = esc_attr__('Allow users to pay what they want', 'invoicing');
2149
+        $label6   = esc_attr__('Enter the minimum price that a user can pay', 'invoicing');
2150
+        $label7   = esc_attr__('Allow users to buy several quantities', 'invoicing');
2151
+        $label8   = esc_attr__('This item is required', 'invoicing');
2152 2152
         echo "<div $restrict>
2153 2153
 
2154 2154
                 <label>$label2</label>
@@ -2218,7 +2218,7 @@  discard block
 block discarded – undo
2218 2218
                 <div class='form-group mt-2'>
2219 2219
 
2220 2220
                     <select class='form-control custom-select' v-model='selected_item'>
2221
-                        <option value=''>"        . __( 'Add an existing item to the form', 'invoicing' ) ."</option>
2221
+                        <option value=''>" . __('Add an existing item to the form', 'invoicing') . "</option>
2222 2222
                         <option v-for='(item, index) in all_items' :value='index'>{{item.title}}</option>
2223 2223
                     </select>
2224 2224
 
@@ -2233,11 +2233,11 @@  discard block
 block discarded – undo
2233 2233
                     <label :for='$id2'>$label</label>
2234 2234
 
2235 2235
                     <select class='form-control custom-select' :id='$id2' v-model='$field.items_type'>
2236
-                        <option value='total'>"        . __( 'Buy all items on the list', 'invoicing' ) ."</option>
2237
-                        <option value='radio'>"        . __( 'Select a single item from the list', 'invoicing' ) ."</option>
2238
-                        <option value='checkbox'>"     . __( 'Select one or more items on the list', 'invoicing' ) ."</option>
2239
-                        <option value='select'>"       . __( 'Select a single item from a dropdown', 'invoicing' ) ."</option>
2240
-                        <option value='multi_select'>" . __( 'Select a one or more items from a dropdown', 'invoicing' ) ."</option>
2236
+                        <option value='total'>" . __('Buy all items on the list', 'invoicing') . "</option>
2237
+                        <option value='radio'>"        . __('Select a single item from the list', 'invoicing') . "</option>
2238
+                        <option value='checkbox'>"     . __('Select one or more items on the list', 'invoicing') . "</option>
2239
+                        <option value='select'>"       . __('Select a single item from a dropdown', 'invoicing') . "</option>
2240
+                        <option value='multi_select'>" . __('Select a one or more items from a dropdown', 'invoicing') . "</option>
2241 2241
                     </select>
2242 2242
 
2243 2243
                 </div>
@@ -2262,27 +2262,27 @@  discard block
 block discarded – undo
2262 2262
             'orderby'        => 'title',
2263 2263
             'order'          => 'ASC',
2264 2264
             'posts_per_page' => -1,
2265
-            'post_status'    => array( 'publish' ),
2265
+            'post_status'    => array('publish'),
2266 2266
         );
2267 2267
     
2268
-        $items      = get_posts( apply_filters( 'wpinv_item_dropdown_query_args', $item_args ) );
2268
+        $items = get_posts(apply_filters('wpinv_item_dropdown_query_args', $item_args));
2269 2269
 
2270
-        if ( empty( $items ) ) {
2270
+        if (empty($items)) {
2271 2271
             return array();
2272 2272
         }
2273 2273
 
2274
-        $options    = array();
2275
-        foreach ( $items as $item ) {
2276
-            $title            = esc_html( $item->post_title );
2277
-            $title           .= wpinv_get_item_suffix( $item->ID, false );
2278
-            $id               = absint( $item->ID );
2279
-            $price            = wpinv_sanitize_amount( get_post_meta( $id, '_wpinv_price', true ) );
2280
-            $recurring        = (bool) get_post_meta( $id, '_wpinv_is_recurring', true );
2274
+        $options = array();
2275
+        foreach ($items as $item) {
2276
+            $title            = esc_html($item->post_title);
2277
+            $title           .= wpinv_get_item_suffix($item->ID, false);
2278
+            $id               = absint($item->ID);
2279
+            $price            = wpinv_sanitize_amount(get_post_meta($id, '_wpinv_price', true));
2280
+            $recurring        = (bool) get_post_meta($id, '_wpinv_is_recurring', true);
2281 2281
             $description      = $item->post_excerpt;
2282
-            $custom_price     = (bool) get_post_meta( $id, '_wpinv_dynamic_pricing', true );
2283
-            $minimum_price    = (float) get_post_meta( $id, '_minimum_price', true );
2282
+            $custom_price     = (bool) get_post_meta($id, '_wpinv_dynamic_pricing', true);
2283
+            $minimum_price    = (float) get_post_meta($id, '_minimum_price', true);
2284 2284
             $allow_quantities = false;
2285
-            $options[]        = compact( 'title', 'id', 'price', 'recurring', 'description', 'custom_price', 'minimum_price', 'allow_quantities' );
2285
+            $options[]        = compact('title', 'id', 'price', 'recurring', 'description', 'custom_price', 'minimum_price', 'allow_quantities');
2286 2286
 
2287 2287
         }
2288 2288
         return $options;
@@ -2292,38 +2292,38 @@  discard block
 block discarded – undo
2292 2292
     /**
2293 2293
      * Returns an array of items for the currently being edited form.
2294 2294
      */
2295
-    public function get_form_items( $id = false ) {
2295
+    public function get_form_items($id = false) {
2296 2296
         
2297
-        if ( empty( $id ) ) {
2298
-            return wpinv_get_data( 'sample-payment-form-items' );
2297
+        if (empty($id)) {
2298
+            return wpinv_get_data('sample-payment-form-items');
2299 2299
         }
2300 2300
         
2301
-        $form_elements = get_post_meta( $id, 'wpinv_form_items', true );
2301
+        $form_elements = get_post_meta($id, 'wpinv_form_items', true);
2302 2302
 
2303
-        if ( is_array( $form_elements ) ) {
2303
+        if (is_array($form_elements)) {
2304 2304
             return $form_elements;
2305 2305
         }
2306 2306
 
2307
-        return wpinv_get_data( 'sample-payment-form-items' );
2307
+        return wpinv_get_data('sample-payment-form-items');
2308 2308
 
2309 2309
     }
2310 2310
 
2311 2311
     /**
2312 2312
      * Returns an array of elements for the currently being edited form.
2313 2313
      */
2314
-    public function get_form_elements( $id = false ) {
2314
+    public function get_form_elements($id = false) {
2315 2315
 
2316
-        if ( empty( $id ) ) {
2317
-            return wpinv_get_data( 'sample-payment-form' );
2316
+        if (empty($id)) {
2317
+            return wpinv_get_data('sample-payment-form');
2318 2318
         }
2319 2319
         
2320
-        $form_elements = get_post_meta( $id, 'wpinv_form_elements', true );
2320
+        $form_elements = get_post_meta($id, 'wpinv_form_elements', true);
2321 2321
 
2322
-        if ( is_array( $form_elements ) ) {
2322
+        if (is_array($form_elements)) {
2323 2323
             return $form_elements;
2324 2324
         }
2325 2325
 
2326
-        return wpinv_get_data( 'sample-payment-form' );
2326
+        return wpinv_get_data('sample-payment-form');
2327 2327
     }
2328 2328
 
2329 2329
 }
Please login to merge, or discard this patch.
includes/class-wpinv-addons.php 1 patch
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * All Invoicing extensions screen related functions can be found here.
6 6
  *
7 7
  */
8
-if ( ! defined( 'ABSPATH' ) ) {
8
+if (!defined('ABSPATH')) {
9 9
 	exit;
10 10
 }
11 11
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 *
21 21
 	 * @return array of tabs.
22 22
 	 */
23
-	public function get_tabs(){
23
+	public function get_tabs() {
24 24
 		$tabs = array(
25 25
 			'addons' => __("Addons", "invoicing"),
26 26
             'gateways' => __("Payment Gateways", "invoicing"),
@@ -38,28 +38,28 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @return array
40 40
 	 */
41
-	public function get_section_data( $section_id ) {
42
-		$section      = self::get_tab( $section_id );
41
+	public function get_section_data($section_id) {
42
+		$section      = self::get_tab($section_id);
43 43
 		$api_url = "https://wpinvoicing.com/edd-api/v2/products/";
44 44
 		$section_data = new stdClass();
45 45
 
46
-		if($section_id=='recommended_plugins'){
46
+		if ($section_id == 'recommended_plugins') {
47 47
 			$section_data->products = self::get_recommend_wp_plugins_edd_formatted();
48 48
 		}
49
-		elseif ( ! empty( $section ) ) {
50
-			if ( false === ( $section_data = get_transient( 'wpi_addons_section_' . $section_id ) ) ) { //@todo restore after testing
49
+		elseif (!empty($section)) {
50
+			if (false === ($section_data = get_transient('wpi_addons_section_' . $section_id))) { //@todo restore after testing
51 51
 			//if ( 1==1) {
52 52
 
53
-				$query_args = array( 'category' => $section_id, 'number' => 100);
54
-				$query_args = apply_filters('wpeu_edd_api_query_args',$query_args,$api_url,$section_id);
53
+				$query_args = array('category' => $section_id, 'number' => 100);
54
+				$query_args = apply_filters('wpeu_edd_api_query_args', $query_args, $api_url, $section_id);
55 55
 
56
-				$raw_section = wp_safe_remote_get( esc_url_raw( add_query_arg($query_args ,$api_url) ), array( 'user-agent' => 'Invoicing Addons Page','timeout'     => 15, ) );
56
+				$raw_section = wp_safe_remote_get(esc_url_raw(add_query_arg($query_args, $api_url)), array('user-agent' => 'Invoicing Addons Page', 'timeout'     => 15,));
57 57
 
58
-				if ( ! is_wp_error( $raw_section ) ) {
59
-					$section_data = json_decode( wp_remote_retrieve_body( $raw_section ) );
58
+				if (!is_wp_error($raw_section)) {
59
+					$section_data = json_decode(wp_remote_retrieve_body($raw_section));
60 60
 
61
-					if ( ! empty( $section_data->products ) ) {
62
-						set_transient( 'wpi_addons_section_' . $section_id, $section_data, DAY_IN_SECONDS );
61
+					if (!empty($section_data->products)) {
62
+						set_transient('wpi_addons_section_' . $section_id, $section_data, DAY_IN_SECONDS);
63 63
 					}
64 64
 				}
65 65
 			}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
 		$products = isset($section_data->products) ? $section_data->products : '';
69 69
 
70
-		return apply_filters( 'wpi_addons_section_data', $products, $section_id );
70
+		return apply_filters('wpi_addons_section_data', $products, $section_id);
71 71
 	}
72 72
 
73 73
 	/**
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 	 * @param string $theme
79 79
 	 * @param string $plugin
80 80
 	 */
81
-	public function output_button( $addon ) {
82
-		$current_tab     = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] );
81
+	public function output_button($addon) {
82
+		$current_tab = empty($_GET['tab']) ? 'addons' : sanitize_title($_GET['tab']);
83 83
 //		$button_text = __('Free','invoicing');
84 84
 //		$licensing = false;
85 85
 //		$installed = false;
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 //		$install_status = 'get';
92 92
 //		$onclick = '';
93 93
 
94
-		$wp_org_themes = array('supreme-directory','directory-starter');
94
+		$wp_org_themes = array('supreme-directory', 'directory-starter');
95 95
 
96 96
 		$button_args = array(
97
-			'type' => ($current_tab == 'addons' || $current_tab =='gateways') ? 'addons' : $current_tab,
97
+			'type' => ($current_tab == 'addons' || $current_tab == 'gateways') ? 'addons' : $current_tab,
98 98
 			'id' => isset($addon->info->id) ? absint($addon->info->id) : '',
99 99
 			'title' => isset($addon->info->title) ? $addon->info->title : '',
100
-			'button_text' => __('Free','invoicing'),
101
-			'price_text' => __('Free','invoicing'),
100
+			'button_text' => __('Free', 'invoicing'),
101
+			'price_text' => __('Free', 'invoicing'),
102 102
 			'link' => isset($addon->info->link) ? $addon->info->link : '', // link to product
103 103
 			'url' => isset($addon->info->link) ? $addon->info->link : '', // button url
104 104
 			'class' => 'button-primary',
@@ -114,83 +114,83 @@  discard block
 block discarded – undo
114 114
 			'update_url' => '',
115 115
 		);
116 116
 
117
-		if( ($current_tab == 'addons' || $current_tab =='gateways') && isset($addon->info->id) && $addon->info->id){
118
-			include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
119
-			if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;}
117
+		if (($current_tab == 'addons' || $current_tab == 'gateways') && isset($addon->info->id) && $addon->info->id) {
118
+			include_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); //for plugins_api..
119
+			if (!empty($addon->licensing->edd_slug)) {$button_args['slug'] = $addon->licensing->edd_slug; }
120 120
 			$status = self::install_plugin_install_status($addon);
121 121
 			$button_args['file'] = isset($status['file']) ? $status['file'] : '';
122
-			if(isset($status['status'])){$button_args['install_status'] = $status['status'];}
122
+			if (isset($status['status'])) {$button_args['install_status'] = $status['status']; }
123 123
 			$button_args['update_url'] = "https://wpinvoicing.com";
124
-		}elseif($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) {
125
-			if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;}
124
+		}elseif ($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) {
125
+			if (!empty($addon->licensing->edd_slug)) {$button_args['slug'] = $addon->licensing->edd_slug; }
126 126
 			$button_args['installed'] = self::is_theme_installed($addon);
127
-			if(!in_array($button_args['slug'],$wp_org_themes)){
127
+			if (!in_array($button_args['slug'], $wp_org_themes)) {
128 128
 				$button_args['update_url'] = "https://wpinvoicing.com";
129 129
 			}
130
-		}elseif($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug){
131
-			include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
132
-			$status = install_plugin_install_status(array("slug"=>$button_args['slug'],"version"=>""));
130
+		}elseif ($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug) {
131
+			include_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); //for plugins_api..
132
+			$status = install_plugin_install_status(array("slug"=>$button_args['slug'], "version"=>""));
133 133
 			$button_args['install_status'] = isset($status['status']) ? $status['status'] : 'install';
134 134
 			$button_args['file'] = isset($status['file']) ? $status['file'] : '';
135 135
 		}
136 136
 
137 137
 		// set price
138
-		if(isset($addon->pricing) && !empty($addon->pricing)){
139
-			if(is_object($addon->pricing)){
140
-				$prices = (Array)$addon->pricing;
138
+		if (isset($addon->pricing) && !empty($addon->pricing)) {
139
+			if (is_object($addon->pricing)) {
140
+				$prices = (Array) $addon->pricing;
141 141
 				$button_args['price'] = reset($prices);
142
-			}elseif(isset($addon->pricing)){
142
+			}elseif (isset($addon->pricing)) {
143 143
 				$button_args['price'] = $addon->pricing;
144 144
 			}
145 145
 		}
146 146
 
147 147
 		// set price text
148
-		if( $button_args['price'] && $button_args['price'] != '0.00' ){
149
-			$button_args['price_text'] = sprintf( __('From: $%d', 'invoicing'), $button_args['price']);
148
+		if ($button_args['price'] && $button_args['price'] != '0.00') {
149
+			$button_args['price_text'] = sprintf(__('From: $%d', 'invoicing'), $button_args['price']);
150 150
 		}
151 151
 
152 152
 
153 153
 		// set if installed
154
-		if(in_array($button_args['install_status'], array('installed','latest_installed','update_available','newer_installed'))){
154
+		if (in_array($button_args['install_status'], array('installed', 'latest_installed', 'update_available', 'newer_installed'))) {
155 155
 			$button_args['installed'] = true;
156 156
 		}
157 157
 
158 158
 //		print_r($button_args);
159 159
 		// set if active
160
-		if($button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes')){
161
-			if($button_args['type'] != 'themes'){
160
+		if ($button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes')) {
161
+			if ($button_args['type'] != 'themes') {
162 162
 				$button_args['active'] = is_plugin_active($button_args['file']);
163
-			}else{
163
+			} else {
164 164
 				$button_args['active'] = self::is_theme_active($addon);
165 165
 			}
166 166
 		}
167 167
 
168 168
 		// set button text and class
169
-		if($button_args['active']){
170
-			$button_args['button_text'] = __('Active','invoicing');
169
+		if ($button_args['active']) {
170
+			$button_args['button_text'] = __('Active', 'invoicing');
171 171
 			$button_args['class'] = ' button-secondary disabled ';
172
-		}elseif($button_args['installed']){
173
-			$button_args['button_text'] = __('Activate','invoicing');
172
+		}elseif ($button_args['installed']) {
173
+			$button_args['button_text'] = __('Activate', 'invoicing');
174 174
 
175
-			if($button_args['type'] != 'themes'){
176
-				if ( current_user_can( 'manage_options' ) ) {
177
-					$button_args['url'] = wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$button_args['file']), 'activate-plugin_' . $button_args['file']);
178
-				}else{
175
+			if ($button_args['type'] != 'themes') {
176
+				if (current_user_can('manage_options')) {
177
+					$button_args['url'] = wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . $button_args['file']), 'activate-plugin_' . $button_args['file']);
178
+				} else {
179 179
 					$button_args['url'] = '#';
180 180
 				}
181
-			}else{
182
-				if ( current_user_can( 'switch_themes' ) ) {
181
+			} else {
182
+				if (current_user_can('switch_themes')) {
183 183
 					$button_args['url'] = self::get_theme_activation_url($addon);
184
-				}else{
184
+				} else {
185 185
 					$button_args['url'] = '#';
186 186
 				}
187 187
 			}
188 188
 
189
-		}else{
190
-			if($button_args['type'] == 'recommended_plugins'){
191
-				$button_args['button_text'] = __('Install','invoicing');
192
-			}else{
193
-				$button_args['button_text'] = __('Get it','invoicing');
189
+		} else {
190
+			if ($button_args['type'] == 'recommended_plugins') {
191
+				$button_args['button_text'] = __('Install', 'invoicing');
192
+			} else {
193
+				$button_args['button_text'] = __('Get it', 'invoicing');
194 194
 
195 195
 				/*if($button_args['type'] == 'themes' && in_array($button_args['slug'],$wp_org_themes) ){
196 196
 					$button_args['button_text'] = __('Install','invoicing');
@@ -203,45 +203,45 @@  discard block
 block discarded – undo
203 203
 
204 204
 		
205 205
 		// filter the button arguments
206
-		$button_args = apply_filters('edd_api_button_args',$button_args);
206
+		$button_args = apply_filters('edd_api_button_args', $button_args);
207 207
 //		print_r($button_args);
208 208
 		// set price text
209
-		if(isset($button_args['price_text'])){
209
+		if (isset($button_args['price_text'])) {
210 210
 			?>
211 211
 			<a
212 212
 				target="_blank"
213 213
 				class="addons-price-text"
214
-				href="<?php echo esc_url( $button_args['link'] ); ?>">
215
-				<?php echo esc_html( $button_args['price_text'] ); ?>
214
+				href="<?php echo esc_url($button_args['link']); ?>">
215
+				<?php echo esc_html($button_args['price_text']); ?>
216 216
 			</a>
217 217
 			<?php
218 218
 		}
219 219
 
220 220
 
221 221
 		$target = '';
222
-		if ( ! empty( $button_args['url'] ) ) {
222
+		if (!empty($button_args['url'])) {
223 223
 			$target = strpos($button_args['url'], get_site_url()) !== false ? '' : ' target="_blank" ';
224 224
 		}
225 225
 
226 226
 		?>
227 227
 		<a
228
-			data-licence="<?php echo esc_attr($button_args['license']);?>"
229
-			data-licensing="<?php echo $button_args['licensing'] ? 1 : 0;?>"
230
-			data-title="<?php echo esc_attr($button_args['title']);?>"
231
-			data-type="<?php echo esc_attr($button_args['type']);?>"
232
-			data-text-error-message="<?php _e('Something went wrong!','invoicing');?>"
233
-			data-text-activate="<?php _e('Activate','invoicing');?>"
234
-			data-text-activating="<?php _e('Activating','invoicing');?>"
235
-			data-text-deactivate="<?php _e('Deactivate','invoicing');?>"
236
-			data-text-installed="<?php _e('Installed','invoicing');?>"
237
-			data-text-install="<?php _e('Install','invoicing');?>"
238
-			data-text-installing="<?php _e('Installing','invoicing');?>"
239
-			data-text-error="<?php _e('Error','invoicing');?>"
240
-			<?php if(!empty($button_args['onclick'])){echo " onclick='".$button_args['onclick']."' ";}?>
241
-			<?php echo $target;?>
242
-			class="addons-button  <?php echo esc_attr( $button_args['class'] ); ?>"
243
-			href="<?php echo esc_url( $button_args['url'] ); ?>">
244
-			<?php echo esc_html( $button_args['button_text'] ); ?>
228
+			data-licence="<?php echo esc_attr($button_args['license']); ?>"
229
+			data-licensing="<?php echo $button_args['licensing'] ? 1 : 0; ?>"
230
+			data-title="<?php echo esc_attr($button_args['title']); ?>"
231
+			data-type="<?php echo esc_attr($button_args['type']); ?>"
232
+			data-text-error-message="<?php _e('Something went wrong!', 'invoicing'); ?>"
233
+			data-text-activate="<?php _e('Activate', 'invoicing'); ?>"
234
+			data-text-activating="<?php _e('Activating', 'invoicing'); ?>"
235
+			data-text-deactivate="<?php _e('Deactivate', 'invoicing'); ?>"
236
+			data-text-installed="<?php _e('Installed', 'invoicing'); ?>"
237
+			data-text-install="<?php _e('Install', 'invoicing'); ?>"
238
+			data-text-installing="<?php _e('Installing', 'invoicing'); ?>"
239
+			data-text-error="<?php _e('Error', 'invoicing'); ?>"
240
+			<?php if (!empty($button_args['onclick'])) {echo " onclick='" . $button_args['onclick'] . "' "; }?>
241
+			<?php echo $target; ?>
242
+			class="addons-button  <?php echo esc_attr($button_args['class']); ?>"
243
+			href="<?php echo esc_url($button_args['url']); ?>">
244
+			<?php echo esc_html($button_args['button_text']); ?>
245 245
 		</a>
246 246
 		<?php
247 247
 
@@ -256,36 +256,36 @@  discard block
 block discarded – undo
256 256
 		$tabs            = self::get_tabs();
257 257
 		$sections        = self::get_sections();
258 258
 		$theme           = wp_get_theme();
259
-		$section_keys    = array_keys( $sections );
260
-		$current_section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : current( $section_keys );
261
-		$current_tab     = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] );
262
-		include_once( WPINV_PLUGIN_DIR . '/includes/admin/html-admin-page-addons.php' );
259
+		$section_keys    = array_keys($sections);
260
+		$current_section = isset($_GET['section']) ? sanitize_text_field($_GET['section']) : current($section_keys);
261
+		$current_tab     = empty($_GET['tab']) ? 'addons' : sanitize_title($_GET['tab']);
262
+		include_once(WPINV_PLUGIN_DIR . '/includes/admin/html-admin-page-addons.php');
263 263
 	}
264 264
 
265 265
 	/**
266 266
 	 * A list of recommended wp.org plugins.
267 267
 	 * @return array
268 268
 	 */
269
-	public function get_recommend_wp_plugins(){
269
+	public function get_recommend_wp_plugins() {
270 270
 		$plugins = array(
271 271
             'invoicing-quotes' => array(
272 272
                 'url'   => 'https://wordpress.org/plugins/invoicing-quotes/',
273 273
                 'slug'   => 'invoicing-quotes',
274 274
 				'name'   => 'Quotes',
275 275
 				'thumbnail'  => 'https://ps.w.org/invoicing-quotes/assets/banner-772x250.jpg',
276
-                'desc'   => __('Allows you to create quotes, send them to clients and convert them to Invoices when accepted by the customer.','invoicing'),
276
+                'desc'   => __('Allows you to create quotes, send them to clients and convert them to Invoices when accepted by the customer.', 'invoicing'),
277 277
             ),
278 278
             'geodirectory' => array(
279 279
                 'url'   => 'https://wordpress.org/plugins/geodirectory/',
280 280
                 'slug'   => 'geodirectory',
281 281
                 'name'   => 'GeoDirectory',
282
-                'desc'   => __('Turn any WordPress theme into a global business directory portal.','invoicing'),
282
+                'desc'   => __('Turn any WordPress theme into a global business directory portal.', 'invoicing'),
283 283
             ),
284 284
             'userswp' => array(
285 285
                 'url'   => 'https://wordpress.org/plugins/userswp/',
286 286
                 'slug'   => 'userswp',
287 287
                 'name'   => 'UsersWP',
288
-                'desc'   => __('Allow frontend user login and registration as well as have slick profile pages.','invoicing'),
288
+                'desc'   => __('Allow frontend user login and registration as well as have slick profile pages.', 'invoicing'),
289 289
             ),
290 290
 		);
291 291
 
Please login to merge, or discard this patch.