Passed
Pull Request — master (#377)
by Brian
05:03
created
includes/class-wpinv-ajax.php 1 patch
Spacing   +421 added lines, -421 removed lines patch added patch discarded remove patch
@@ -7,28 +7,28 @@  discard block
 block discarded – undo
7 7
  */
8 8
  
9 9
 // MUST have WordPress.
10
-if ( !defined( 'WPINC' ) ) {
11
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
10
+if (!defined('WPINC')) {
11
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
12 12
 }
13 13
 
14 14
 class WPInv_Ajax {
15 15
     public static function init() {
16
-        add_action( 'init', array( __CLASS__, 'define_ajax' ), 0 );
17
-        add_action( 'template_redirect', array( __CLASS__, 'do_wpinv_ajax' ), 0 );
16
+        add_action('init', array(__CLASS__, 'define_ajax'), 0);
17
+        add_action('template_redirect', array(__CLASS__, 'do_wpinv_ajax'), 0);
18 18
         self::add_ajax_events();
19 19
     }
20 20
 
21 21
     public static function define_ajax() {
22
-        if ( !empty( $_GET['wpinv-ajax'] ) ) {
23
-            if ( ! defined( 'DOING_AJAX' ) ) {
24
-                define( 'DOING_AJAX', true );
22
+        if (!empty($_GET['wpinv-ajax'])) {
23
+            if (!defined('DOING_AJAX')) {
24
+                define('DOING_AJAX', true);
25 25
             }
26
-            if ( ! defined( 'WC_DOING_AJAX' ) ) {
27
-                define( 'WC_DOING_AJAX', true );
26
+            if (!defined('WC_DOING_AJAX')) {
27
+                define('WC_DOING_AJAX', true);
28 28
             }
29 29
             // Turn off display_errors during AJAX events to prevent malformed JSON
30
-            if ( ! WP_DEBUG || ( WP_DEBUG && ! WP_DEBUG_DISPLAY ) ) {
31
-                /** @scrutinizer ignore-unhandled */ @ini_set( 'display_errors', 0 );
30
+            if (!WP_DEBUG || (WP_DEBUG && !WP_DEBUG_DISPLAY)) {
31
+                /** @scrutinizer ignore-unhandled */ @ini_set('display_errors', 0);
32 32
             }
33 33
             $GLOBALS['wpdb']->hide_errors();
34 34
         }
@@ -37,24 +37,24 @@  discard block
 block discarded – undo
37 37
     public static function do_wpinv_ajax() {
38 38
         global $wp_query;
39 39
 
40
-        if ( !empty( $_GET['wpinv-ajax'] ) ) {
41
-            $wp_query->set( 'wpinv-ajax', sanitize_text_field( $_GET['wpinv-ajax'] ) );
40
+        if (!empty($_GET['wpinv-ajax'])) {
41
+            $wp_query->set('wpinv-ajax', sanitize_text_field($_GET['wpinv-ajax']));
42 42
         }
43 43
 
44
-        if ( $action = $wp_query->get( 'wpinv-ajax' ) ) {
44
+        if ($action = $wp_query->get('wpinv-ajax')) {
45 45
             self::wpinv_ajax_headers();
46
-            do_action( 'wpinv_ajax_' . sanitize_text_field( $action ) );
46
+            do_action('wpinv_ajax_' . sanitize_text_field($action));
47 47
             die();
48 48
         }
49 49
     }
50 50
     
51 51
     private static function wpinv_ajax_headers() {
52 52
         send_origin_headers();
53
-        /** @scrutinizer ignore-unhandled */ @header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
54
-        /** @scrutinizer ignore-unhandled */ @header( 'X-Robots-Tag: noindex' );
53
+        /** @scrutinizer ignore-unhandled */ @header('Content-Type: text/html; charset=' . get_option('blog_charset'));
54
+        /** @scrutinizer ignore-unhandled */ @header('X-Robots-Tag: noindex');
55 55
         send_nosniff_header();
56 56
         nocache_headers();
57
-        status_header( 200 );
57
+        status_header(200);
58 58
     }
59 59
     
60 60
     public static function add_ajax_events() {
@@ -86,41 +86,41 @@  discard block
 block discarded – undo
86 86
             'payment_form_refresh_prices' => true,
87 87
         );
88 88
 
89
-        foreach ( $ajax_events as $ajax_event => $nopriv ) {
90
-            add_action( 'wp_ajax_wpinv_' . $ajax_event, array( __CLASS__, $ajax_event ) );
91
-            add_action( 'wp_ajax_getpaid_' . $ajax_event, array( __CLASS__, $ajax_event ) );
89
+        foreach ($ajax_events as $ajax_event => $nopriv) {
90
+            add_action('wp_ajax_wpinv_' . $ajax_event, array(__CLASS__, $ajax_event));
91
+            add_action('wp_ajax_getpaid_' . $ajax_event, array(__CLASS__, $ajax_event));
92 92
             
93
-            if ( !defined( 'WPI_AJAX_' . strtoupper( $nopriv ) ) ) {
94
-                define( 'WPI_AJAX_' . strtoupper( $nopriv ), 1 );
93
+            if (!defined('WPI_AJAX_' . strtoupper($nopriv))) {
94
+                define('WPI_AJAX_' . strtoupper($nopriv), 1);
95 95
             }
96 96
 
97
-            if ( $nopriv ) {
98
-                add_action( 'wp_ajax_nopriv_wpinv_' . $ajax_event, array( __CLASS__, $ajax_event ) );
99
-                add_action( 'wp_ajax_nopriv_getpaid_' . $ajax_event, array( __CLASS__, $ajax_event ) );
97
+            if ($nopriv) {
98
+                add_action('wp_ajax_nopriv_wpinv_' . $ajax_event, array(__CLASS__, $ajax_event));
99
+                add_action('wp_ajax_nopriv_getpaid_' . $ajax_event, array(__CLASS__, $ajax_event));
100 100
 
101
-                add_action( 'wpinv_ajax_' . $ajax_event, array( __CLASS__, $ajax_event ) );
101
+                add_action('wpinv_ajax_' . $ajax_event, array(__CLASS__, $ajax_event));
102 102
             }
103 103
         }
104 104
     }
105 105
     
106 106
     public static function add_note() {
107
-        check_ajax_referer( 'add-invoice-note', '_nonce' );
107
+        check_ajax_referer('add-invoice-note', '_nonce');
108 108
 
109
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
109
+        if (!wpinv_current_user_can_manage_invoicing()) {
110 110
             die(-1);
111 111
         }
112 112
 
113
-        $post_id   = absint( $_POST['post_id'] );
114
-        $note      = wp_kses_post( trim( stripslashes( $_POST['note'] ) ) );
115
-        $note_type = sanitize_text_field( $_POST['note_type'] );
113
+        $post_id   = absint($_POST['post_id']);
114
+        $note      = wp_kses_post(trim(stripslashes($_POST['note'])));
115
+        $note_type = sanitize_text_field($_POST['note_type']);
116 116
 
117 117
         $is_customer_note = $note_type == 'customer' ? 1 : 0;
118 118
 
119
-        if ( $post_id > 0 ) {
120
-            $note_id = wpinv_insert_payment_note( $post_id, $note, $is_customer_note );
119
+        if ($post_id > 0) {
120
+            $note_id = wpinv_insert_payment_note($post_id, $note, $is_customer_note);
121 121
 
122
-            if ( $note_id > 0 && !is_wp_error( $note_id ) ) {
123
-                wpinv_get_invoice_note_line_item( $note_id );
122
+            if ($note_id > 0 && !is_wp_error($note_id)) {
123
+                wpinv_get_invoice_note_line_item($note_id);
124 124
             }
125 125
         }
126 126
 
@@ -128,16 +128,16 @@  discard block
 block discarded – undo
128 128
     }
129 129
 
130 130
     public static function delete_note() {
131
-        check_ajax_referer( 'delete-invoice-note', '_nonce' );
131
+        check_ajax_referer('delete-invoice-note', '_nonce');
132 132
 
133
-        if ( !wpinv_current_user_can_manage_invoicing() ) {
133
+        if (!wpinv_current_user_can_manage_invoicing()) {
134 134
             die(-1);
135 135
         }
136 136
 
137
-        $note_id = (int)$_POST['note_id'];
137
+        $note_id = (int) $_POST['note_id'];
138 138
 
139
-        if ( $note_id > 0 ) {
140
-            wp_delete_comment( $note_id, true );
139
+        if ($note_id > 0) {
140
+            wp_delete_comment($note_id, true);
141 141
         }
142 142
 
143 143
         die();
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
     }
151 151
     
152 152
     public static function checkout() {
153
-        if ( ! defined( 'WPINV_CHECKOUT' ) ) {
154
-            define( 'WPINV_CHECKOUT', true );
153
+        if (!defined('WPINV_CHECKOUT')) {
154
+            define('WPINV_CHECKOUT', true);
155 155
         }
156 156
 
157 157
         wpinv_process_checkout();
@@ -160,53 +160,53 @@  discard block
 block discarded – undo
160 160
     
161 161
     public static function add_invoice_item() {
162 162
         global $wpi_userID, $wpinv_ip_address_country;
163
-        check_ajax_referer( 'invoice-item', '_nonce' );
164
-        if ( !wpinv_current_user_can_manage_invoicing() ) {
163
+        check_ajax_referer('invoice-item', '_nonce');
164
+        if (!wpinv_current_user_can_manage_invoicing()) {
165 165
             die(-1);
166 166
         }
167 167
         
168
-        $item_id    = sanitize_text_field( $_POST['item_id'] );
169
-        $invoice_id = absint( $_POST['invoice_id'] );
168
+        $item_id    = sanitize_text_field($_POST['item_id']);
169
+        $invoice_id = absint($_POST['invoice_id']);
170 170
         
171
-        if ( !is_numeric( $invoice_id ) || !is_numeric( $item_id ) ) {
171
+        if (!is_numeric($invoice_id) || !is_numeric($item_id)) {
172 172
             die();
173 173
         }
174 174
         
175
-        $invoice    = wpinv_get_invoice( $invoice_id );
176
-        if ( empty( $invoice ) ) {
175
+        $invoice = wpinv_get_invoice($invoice_id);
176
+        if (empty($invoice)) {
177 177
             die();
178 178
         }
179 179
         
180
-        if ( $invoice->is_paid() || $invoice->is_refunded() ) {
180
+        if ($invoice->is_paid() || $invoice->is_refunded()) {
181 181
             die(); // Don't allow modify items for paid invoice.
182 182
         }
183 183
         
184
-        if ( !empty( $_POST['user_id'] ) ) {
185
-            $wpi_userID = absint( $_POST['user_id'] ); 
184
+        if (!empty($_POST['user_id'])) {
185
+            $wpi_userID = absint($_POST['user_id']); 
186 186
         }
187 187
 
188
-        $item = new WPInv_Item( $item_id );
189
-        if ( !( !empty( $item ) && $item->post_type == 'wpi_item' ) ) {
188
+        $item = new WPInv_Item($item_id);
189
+        if (!(!empty($item) && $item->post_type == 'wpi_item')) {
190 190
             die();
191 191
         }
192 192
         
193 193
         // Validate item before adding to invoice because recurring item must be paid individually.
194
-        if ( !empty( $invoice->cart_details ) ) {
194
+        if (!empty($invoice->cart_details)) {
195 195
             $valid = true;
196 196
             
197
-            if ( $recurring_item = $invoice->get_recurring() ) {
198
-                if ( $recurring_item != $item_id ) {
197
+            if ($recurring_item = $invoice->get_recurring()) {
198
+                if ($recurring_item != $item_id) {
199 199
                     $valid = false;
200 200
                 }
201
-            } else if ( wpinv_is_recurring_item( $item_id ) ) {
201
+            } else if (wpinv_is_recurring_item($item_id)) {
202 202
                 $valid = false;
203 203
             }
204 204
             
205
-            if ( !$valid ) {
205
+            if (!$valid) {
206 206
                 $response               = array();
207 207
                 $response['success']    = false;
208
-                $response['msg']        = __( 'You can not add item because recurring item must be paid individually!', 'invoicing' );
209
-                wp_send_json( $response );
208
+                $response['msg']        = __('You can not add item because recurring item must be paid individually!', 'invoicing');
209
+                wp_send_json($response);
210 210
             }
211 211
         }
212 212
         
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
         
215 215
         $data                   = array();
216 216
         $data['invoice_id']     = $invoice_id;
217
-        $data['cart_discounts'] = $invoice->get_discounts( true );
217
+        $data['cart_discounts'] = $invoice->get_discounts(true);
218 218
         
219
-        wpinv_set_checkout_session( $data );
219
+        wpinv_set_checkout_session($data);
220 220
         
221
-        $quantity = wpinv_item_quantities_enabled() && !empty($_POST['qty']) && (int)$_POST['qty'] > 0 ? (int)$_POST['qty'] : 1;
221
+        $quantity = wpinv_item_quantities_enabled() && !empty($_POST['qty']) && (int) $_POST['qty'] > 0 ? (int) $_POST['qty'] : 1;
222 222
 
223 223
         $args = array(
224 224
             'id'            => $item_id,
@@ -231,21 +231,21 @@  discard block
 block discarded – undo
231 231
             'fees'          => array()
232 232
         );
233 233
 
234
-        $invoice->add_item( $item_id, $args );
234
+        $invoice->add_item($item_id, $args);
235 235
         $invoice->save();
236 236
         
237
-        if ( empty( $_POST['country'] ) ) {
237
+        if (empty($_POST['country'])) {
238 238
             $_POST['country'] = !empty($invoice->country) ? $invoice->country : wpinv_get_default_country();
239 239
         }
240
-        if ( empty( $_POST['state'] ) ) {
240
+        if (empty($_POST['state'])) {
241 241
             $_POST['state'] = $invoice->state;
242 242
         }
243 243
          
244
-        $invoice->country   = sanitize_text_field( $_POST['country'] );
245
-        $invoice->state     = sanitize_text_field( $_POST['state'] );
244
+        $invoice->country   = sanitize_text_field($_POST['country']);
245
+        $invoice->state     = sanitize_text_field($_POST['state']);
246 246
         
247
-        $invoice->set( 'country', sanitize_text_field( $_POST['country'] ) );
248
-        $invoice->set( 'state', sanitize_text_field( $_POST['state'] ) );
247
+        $invoice->set('country', sanitize_text_field($_POST['country']));
248
+        $invoice->set('state', sanitize_text_field($_POST['state']));
249 249
         
250 250
         $wpinv_ip_address_country = $invoice->country;
251 251
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         
254 254
         $response                       = array();
255 255
         $response['success']            = true;
256
-        $response['data']['items']      = wpinv_admin_get_line_items( $invoice );
256
+        $response['data']['items']      = wpinv_admin_get_line_items($invoice);
257 257
         $response['data']['subtotal']   = $invoice->get_subtotal();
258 258
         $response['data']['subtotalf']  = $invoice->get_subtotal(true);
259 259
         $response['data']['tax']        = $invoice->get_tax();
@@ -265,41 +265,41 @@  discard block
 block discarded – undo
265 265
         
266 266
         wpinv_set_checkout_session($checkout_session);
267 267
         
268
-        wp_send_json( $response );
268
+        wp_send_json($response);
269 269
     }
270 270
 
271 271
 
272 272
     public static function remove_invoice_item() {
273 273
         global $wpi_userID, $wpinv_ip_address_country;
274 274
         
275
-        check_ajax_referer( 'invoice-item', '_nonce' );
276
-        if ( !wpinv_current_user_can_manage_invoicing() ) {
275
+        check_ajax_referer('invoice-item', '_nonce');
276
+        if (!wpinv_current_user_can_manage_invoicing()) {
277 277
             die(-1);
278 278
         }
279 279
         
280
-        $item_id    = sanitize_text_field( $_POST['item_id'] );
281
-        $invoice_id = absint( $_POST['invoice_id'] );
282
-        $cart_index = isset( $_POST['index'] ) && $_POST['index'] >= 0 ? $_POST['index'] : false;
280
+        $item_id    = sanitize_text_field($_POST['item_id']);
281
+        $invoice_id = absint($_POST['invoice_id']);
282
+        $cart_index = isset($_POST['index']) && $_POST['index'] >= 0 ? $_POST['index'] : false;
283 283
         
284
-        if ( !is_numeric( $invoice_id ) || !is_numeric( $item_id ) ) {
284
+        if (!is_numeric($invoice_id) || !is_numeric($item_id)) {
285 285
             die();
286 286
         }
287 287
 
288
-        $invoice    = wpinv_get_invoice( $invoice_id );
289
-        if ( empty( $invoice ) ) {
288
+        $invoice = wpinv_get_invoice($invoice_id);
289
+        if (empty($invoice)) {
290 290
             die();
291 291
         }
292 292
         
293
-        if ( $invoice->is_paid() || $invoice->is_refunded() ) {
293
+        if ($invoice->is_paid() || $invoice->is_refunded()) {
294 294
             die(); // Don't allow modify items for paid invoice.
295 295
         }
296 296
         
297
-        if ( !empty( $_POST['user_id'] ) ) {
298
-            $wpi_userID = absint( $_POST['user_id'] ); 
297
+        if (!empty($_POST['user_id'])) {
298
+            $wpi_userID = absint($_POST['user_id']); 
299 299
         }
300 300
 
301
-        $item       = new WPInv_Item( $item_id );
302
-        if ( !( !empty( $item ) && $item->post_type == 'wpi_item' ) ) {
301
+        $item = new WPInv_Item($item_id);
302
+        if (!(!empty($item) && $item->post_type == 'wpi_item')) {
303 303
             die();
304 304
         }
305 305
         
@@ -307,9 +307,9 @@  discard block
 block discarded – undo
307 307
         
308 308
         $data                   = array();
309 309
         $data['invoice_id']     = $invoice_id;
310
-        $data['cart_discounts'] = $invoice->get_discounts( true );
310
+        $data['cart_discounts'] = $invoice->get_discounts(true);
311 311
         
312
-        wpinv_set_checkout_session( $data );
312
+        wpinv_set_checkout_session($data);
313 313
 
314 314
         $args = array(
315 315
             'id'         => $item_id,
@@ -317,21 +317,21 @@  discard block
 block discarded – undo
317 317
             'cart_index' => $cart_index
318 318
         );
319 319
 
320
-        $invoice->remove_item( $item_id, $args );
320
+        $invoice->remove_item($item_id, $args);
321 321
         $invoice->save();
322 322
         
323
-        if ( empty( $_POST['country'] ) ) {
323
+        if (empty($_POST['country'])) {
324 324
             $_POST['country'] = !empty($invoice->country) ? $invoice->country : wpinv_get_default_country();
325 325
         }
326
-        if ( empty( $_POST['state'] ) ) {
326
+        if (empty($_POST['state'])) {
327 327
             $_POST['state'] = $invoice->state;
328 328
         }
329 329
          
330
-        $invoice->country   = sanitize_text_field( $_POST['country'] );
331
-        $invoice->state     = sanitize_text_field( $_POST['state'] );
330
+        $invoice->country   = sanitize_text_field($_POST['country']);
331
+        $invoice->state     = sanitize_text_field($_POST['state']);
332 332
         
333
-        $invoice->set( 'country', sanitize_text_field( $_POST['country'] ) );
334
-        $invoice->set( 'state', sanitize_text_field( $_POST['state'] ) );
333
+        $invoice->set('country', sanitize_text_field($_POST['country']));
334
+        $invoice->set('state', sanitize_text_field($_POST['state']));
335 335
         
336 336
         $wpinv_ip_address_country = $invoice->country;
337 337
         
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
         
340 340
         $response                       = array();
341 341
         $response['success']            = true;
342
-        $response['data']['items']      = wpinv_admin_get_line_items( $invoice );
342
+        $response['data']['items']      = wpinv_admin_get_line_items($invoice);
343 343
         $response['data']['subtotal']   = $invoice->get_subtotal();
344 344
         $response['data']['subtotalf']  = $invoice->get_subtotal(true);
345 345
         $response['data']['tax']        = $invoice->get_tax();
@@ -351,55 +351,55 @@  discard block
 block discarded – undo
351 351
         
352 352
         wpinv_set_checkout_session($checkout_session);
353 353
         
354
-        wp_send_json( $response );
354
+        wp_send_json($response);
355 355
     }
356 356
     
357 357
     public static function create_invoice_item() {
358
-        check_ajax_referer( 'invoice-item', '_nonce' );
359
-        if ( !wpinv_current_user_can_manage_invoicing() ) {
358
+        check_ajax_referer('invoice-item', '_nonce');
359
+        if (!wpinv_current_user_can_manage_invoicing()) {
360 360
             die(-1);
361 361
         }
362 362
         
363
-        $invoice_id = absint( $_POST['invoice_id'] );
363
+        $invoice_id = absint($_POST['invoice_id']);
364 364
 
365 365
         // Find the item
366
-        if ( !is_numeric( $invoice_id ) ) {
366
+        if (!is_numeric($invoice_id)) {
367 367
             die();
368 368
         }        
369 369
         
370
-        $invoice     = wpinv_get_invoice( $invoice_id );
371
-        if ( empty( $invoice ) ) {
370
+        $invoice = wpinv_get_invoice($invoice_id);
371
+        if (empty($invoice)) {
372 372
             die();
373 373
         }
374 374
         
375 375
         // Validate item before adding to invoice because recurring item must be paid individually.
376
-        if ( !empty( $invoice->cart_details ) && $invoice->get_recurring() ) {
376
+        if (!empty($invoice->cart_details) && $invoice->get_recurring()) {
377 377
             $response               = array();
378 378
             $response['success']    = false;
379
-            $response['msg']        = __( 'You can not add item because recurring item must be paid individually!', 'invoicing' );
380
-            wp_send_json( $response );
379
+            $response['msg']        = __('You can not add item because recurring item must be paid individually!', 'invoicing');
380
+            wp_send_json($response);
381 381
         }        
382 382
         
383
-        $save_item = wp_unslash( $_POST['_wpinv_quick'] );
383
+        $save_item = wp_unslash($_POST['_wpinv_quick']);
384 384
         
385 385
         $meta               = array();
386 386
         $meta['type']       = !empty($save_item['type']) ? sanitize_text_field($save_item['type']) : 'custom';
387
-        $meta['price']      = !empty($save_item['price']) ? wpinv_sanitize_amount( $save_item['price'] ) : 0;
387
+        $meta['price']      = !empty($save_item['price']) ? wpinv_sanitize_amount($save_item['price']) : 0;
388 388
         $meta['vat_rule']   = !empty($save_item['vat_rule']) ? sanitize_text_field($save_item['vat_rule']) : 'digital';
389 389
         $meta['vat_class']  = !empty($save_item['vat_class']) ? sanitize_text_field($save_item['vat_class']) : '_standard';
390 390
         
391 391
         $data                   = array();
392 392
         $data['post_title']     = sanitize_text_field($save_item['name']);
393 393
         $data['post_status']    = 'publish';
394
-        $data['post_excerpt']   = ! empty( $save_item['excerpt'] ) ? wp_kses_post( $save_item['excerpt'] ) : '';
394
+        $data['post_excerpt']   = !empty($save_item['excerpt']) ? wp_kses_post($save_item['excerpt']) : '';
395 395
         $data['meta']           = $meta;
396 396
         
397 397
         $item = new WPInv_Item();
398
-        $item->create( $data );
398
+        $item->create($data);
399 399
         
400
-        if ( !empty( $item ) ) {
400
+        if (!empty($item)) {
401 401
             $_POST['item_id']   = $item->ID;
402
-            $_POST['qty']       = !empty($save_item['qty']) && $save_item['qty'] > 0 ? (int)$save_item['qty'] : 1;
402
+            $_POST['qty']       = !empty($save_item['qty']) && $save_item['qty'] > 0 ? (int) $save_item['qty'] : 1;
403 403
             
404 404
             self::add_invoice_item();
405 405
         }
@@ -412,48 +412,48 @@  discard block
 block discarded – undo
412 412
     public static function get_billing_details() {
413 413
 
414 414
         // Verify nonce.
415
-        check_ajax_referer( 'wpinv-nonce' );
415
+        check_ajax_referer('wpinv-nonce');
416 416
 
417 417
         // Can the user manage the plugin?
418
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
418
+        if (!wpinv_current_user_can_manage_invoicing()) {
419 419
             die(-1);
420 420
         }
421 421
 
422 422
         // Do we have a user id?
423 423
         $user_id = $_GET['user_id'];
424 424
 
425
-        if ( empty( $user_id ) || ! is_numeric( $user_id ) ) {
425
+        if (empty($user_id) || !is_numeric($user_id)) {
426 426
             die(-1);
427 427
         }
428 428
 
429 429
         // Fetch the billing details.
430
-        $billing_details    = wpinv_get_user_address( $user_id );
431
-        $billing_details    = apply_filters( 'wpinv_ajax_billing_details', $billing_details, $user_id );
430
+        $billing_details    = wpinv_get_user_address($user_id);
431
+        $billing_details    = apply_filters('wpinv_ajax_billing_details', $billing_details, $user_id);
432 432
 
433 433
         // unset the user id and email.
434
-        $to_ignore = array( 'user_id', 'email' );
434
+        $to_ignore = array('user_id', 'email');
435 435
 
436
-        foreach ( $to_ignore as $key ) {
437
-            if ( isset( $billing_details[ $key ] ) ) {
438
-                unset( $billing_details[ $key ] );
436
+        foreach ($to_ignore as $key) {
437
+            if (isset($billing_details[$key])) {
438
+                unset($billing_details[$key]);
439 439
             }
440 440
         }
441 441
 
442
-        wp_send_json_success( $billing_details );
442
+        wp_send_json_success($billing_details);
443 443
 
444 444
     }
445 445
     
446 446
     public static function admin_recalculate_totals() {
447 447
         global $wpi_userID, $wpinv_ip_address_country;
448 448
         
449
-        check_ajax_referer( 'wpinv-nonce', '_nonce' );
450
-        if ( !wpinv_current_user_can_manage_invoicing() ) {
449
+        check_ajax_referer('wpinv-nonce', '_nonce');
450
+        if (!wpinv_current_user_can_manage_invoicing()) {
451 451
             die(-1);
452 452
         }
453 453
         
454
-        $invoice_id = absint( $_POST['invoice_id'] );        
455
-        $invoice    = wpinv_get_invoice( $invoice_id );
456
-        if ( empty( $invoice ) ) {
454
+        $invoice_id = absint($_POST['invoice_id']);        
455
+        $invoice    = wpinv_get_invoice($invoice_id);
456
+        if (empty($invoice)) {
457 457
             die();
458 458
         }
459 459
 
@@ -461,29 +461,29 @@  discard block
 block discarded – undo
461 461
 
462 462
         $data                   = array();
463 463
         $data['invoice_id']     = $invoice_id;
464
-        $data['cart_discounts'] = $invoice->get_discounts( true );
464
+        $data['cart_discounts'] = $invoice->get_discounts(true);
465 465
 
466
-        wpinv_set_checkout_session( $data );
466
+        wpinv_set_checkout_session($data);
467 467
         
468
-        if ( !empty( $_POST['user_id'] ) ) {
469
-            $wpi_userID = absint( $_POST['user_id'] ); 
468
+        if (!empty($_POST['user_id'])) {
469
+            $wpi_userID = absint($_POST['user_id']); 
470 470
         }
471 471
         
472
-        if ( empty( $_POST['country'] ) ) {
472
+        if (empty($_POST['country'])) {
473 473
             $_POST['country'] = !empty($invoice->country) ? $invoice->country : wpinv_get_default_country();
474 474
         }
475 475
 
476 476
         $disable_taxes = 0;
477
-        if ( ! empty( $_POST['disable_taxes'] ) ) {
477
+        if (!empty($_POST['disable_taxes'])) {
478 478
             $disable_taxes = 1;
479 479
         }
480
-        $invoice->set( 'disable_taxes', $disable_taxes );
480
+        $invoice->set('disable_taxes', $disable_taxes);
481 481
 
482
-        $invoice->country = sanitize_text_field( $_POST['country'] );
483
-        $invoice->set( 'country', sanitize_text_field( $_POST['country'] ) );
484
-        if ( isset( $_POST['state'] ) ) {
485
-            $invoice->state = sanitize_text_field( $_POST['state'] );
486
-            $invoice->set( 'state', sanitize_text_field( $_POST['state'] ) );
482
+        $invoice->country = sanitize_text_field($_POST['country']);
483
+        $invoice->set('country', sanitize_text_field($_POST['country']));
484
+        if (isset($_POST['state'])) {
485
+            $invoice->state = sanitize_text_field($_POST['state']);
486
+            $invoice->set('state', sanitize_text_field($_POST['state']));
487 487
         }
488 488
         
489 489
         $wpinv_ip_address_country = $invoice->country;
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
         
493 493
         $response                       = array();
494 494
         $response['success']            = true;
495
-        $response['data']['items']      = wpinv_admin_get_line_items( $invoice );
495
+        $response['data']['items']      = wpinv_admin_get_line_items($invoice);
496 496
         $response['data']['subtotal']   = $invoice->get_subtotal();
497 497
         $response['data']['subtotalf']  = $invoice->get_subtotal(true);
498 498
         $response['data']['tax']        = $invoice->get_tax();
@@ -504,25 +504,25 @@  discard block
 block discarded – undo
504 504
         
505 505
         wpinv_set_checkout_session($checkout_session);
506 506
 
507
-        wp_send_json( $response );
507
+        wp_send_json($response);
508 508
     }
509 509
     
510 510
     public static function admin_apply_discount() {
511 511
         global $wpi_userID;
512 512
         
513
-        check_ajax_referer( 'wpinv-nonce', '_nonce' );
514
-        if ( !wpinv_current_user_can_manage_invoicing() ) {
513
+        check_ajax_referer('wpinv-nonce', '_nonce');
514
+        if (!wpinv_current_user_can_manage_invoicing()) {
515 515
             die(-1);
516 516
         }
517 517
         
518
-        $invoice_id = absint( $_POST['invoice_id'] );
519
-        $discount_code = sanitize_text_field( $_POST['code'] );
520
-        if ( empty( $invoice_id ) || empty( $discount_code ) ) {
518
+        $invoice_id = absint($_POST['invoice_id']);
519
+        $discount_code = sanitize_text_field($_POST['code']);
520
+        if (empty($invoice_id) || empty($discount_code)) {
521 521
             die();
522 522
         }
523 523
         
524
-        $invoice = wpinv_get_invoice( $invoice_id );
525
-        if ( empty( $invoice ) || ( !empty( $invoice ) && ( $invoice->is_paid() || $invoice->is_refunded() ) ) ) {
524
+        $invoice = wpinv_get_invoice($invoice_id);
525
+        if (empty($invoice) || (!empty($invoice) && ($invoice->is_paid() || $invoice->is_refunded()))) {
526 526
             die();
527 527
         }
528 528
         
@@ -530,49 +530,49 @@  discard block
 block discarded – undo
530 530
         
531 531
         $data                   = array();
532 532
         $data['invoice_id']     = $invoice_id;
533
-        $data['cart_discounts'] = $invoice->get_discounts( true );
533
+        $data['cart_discounts'] = $invoice->get_discounts(true);
534 534
         
535
-        wpinv_set_checkout_session( $data );
535
+        wpinv_set_checkout_session($data);
536 536
         
537 537
         $response               = array();
538 538
         $response['success']    = false;
539
-        $response['msg']        = __( 'This discount is invalid.', 'invoicing' );
539
+        $response['msg']        = __('This discount is invalid.', 'invoicing');
540 540
         $response['data']['code'] = $discount_code;
541 541
         
542
-        if ( wpinv_is_discount_valid( $discount_code, $invoice->get_user_id() ) ) {
543
-            $discounts = wpinv_set_cart_discount( $discount_code );
542
+        if (wpinv_is_discount_valid($discount_code, $invoice->get_user_id())) {
543
+            $discounts = wpinv_set_cart_discount($discount_code);
544 544
             
545 545
             $response['success'] = true;
546
-            $response['msg'] = __( 'Discount has been applied successfully.', 'invoicing' );
547
-        }  else {
546
+            $response['msg'] = __('Discount has been applied successfully.', 'invoicing');
547
+        } else {
548 548
             $errors = wpinv_get_errors();
549
-            if ( !empty( $errors['wpinv-discount-error'] ) ) {
549
+            if (!empty($errors['wpinv-discount-error'])) {
550 550
                 $response['msg'] = $errors['wpinv-discount-error'];
551 551
             }
552
-            wpinv_unset_error( 'wpinv-discount-error' );
552
+            wpinv_unset_error('wpinv-discount-error');
553 553
         }
554 554
         
555 555
         wpinv_set_checkout_session($checkout_session);
556 556
         
557
-        wp_send_json( $response );
557
+        wp_send_json($response);
558 558
     }
559 559
     
560 560
     public static function admin_remove_discount() {
561 561
         global $wpi_userID;
562 562
         
563
-        check_ajax_referer( 'wpinv-nonce', '_nonce' );
564
-        if ( !wpinv_current_user_can_manage_invoicing() ) {
563
+        check_ajax_referer('wpinv-nonce', '_nonce');
564
+        if (!wpinv_current_user_can_manage_invoicing()) {
565 565
             die(-1);
566 566
         }
567 567
         
568
-        $invoice_id = absint( $_POST['invoice_id'] );
569
-        $discount_code = sanitize_text_field( $_POST['code'] );
570
-        if ( empty( $invoice_id ) || empty( $discount_code ) ) {
568
+        $invoice_id = absint($_POST['invoice_id']);
569
+        $discount_code = sanitize_text_field($_POST['code']);
570
+        if (empty($invoice_id) || empty($discount_code)) {
571 571
             die();
572 572
         }
573 573
         
574
-        $invoice = wpinv_get_invoice( $invoice_id );
575
-        if ( empty( $invoice ) || ( !empty( $invoice ) && ( $invoice->is_paid() || $invoice->is_refunded() ) ) ) {
574
+        $invoice = wpinv_get_invoice($invoice_id);
575
+        if (empty($invoice) || (!empty($invoice) && ($invoice->is_paid() || $invoice->is_refunded()))) {
576 576
             die();
577 577
         }
578 578
         
@@ -580,21 +580,21 @@  discard block
 block discarded – undo
580 580
         
581 581
         $data                   = array();
582 582
         $data['invoice_id']     = $invoice_id;
583
-        $data['cart_discounts'] = $invoice->get_discounts( true );
583
+        $data['cart_discounts'] = $invoice->get_discounts(true);
584 584
         
585
-        wpinv_set_checkout_session( $data );
585
+        wpinv_set_checkout_session($data);
586 586
         
587 587
         $response               = array();
588 588
         $response['success']    = false;
589 589
         $response['msg']        = NULL;
590 590
         
591
-        $discounts  = wpinv_unset_cart_discount( $discount_code );
591
+        $discounts = wpinv_unset_cart_discount($discount_code);
592 592
         $response['success'] = true;
593
-        $response['msg'] = __( 'Discount has been removed successfully.', 'invoicing' );
593
+        $response['msg'] = __('Discount has been removed successfully.', 'invoicing');
594 594
         
595 595
         wpinv_set_checkout_session($checkout_session);
596 596
         
597
-        wp_send_json( $response );
597
+        wp_send_json($response);
598 598
     }
599 599
 
600 600
     /**
@@ -603,80 +603,80 @@  discard block
 block discarded – undo
603 603
     public static function check_new_user_email() {
604 604
 
605 605
         // Verify nonce.
606
-        check_ajax_referer( 'wpinv-nonce' );
606
+        check_ajax_referer('wpinv-nonce');
607 607
 
608 608
         // Can the user manage the plugin?
609
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
609
+        if (!wpinv_current_user_can_manage_invoicing()) {
610 610
             die(-1);
611 611
         }
612 612
 
613 613
         // We need an email address.
614
-        if ( empty( $_GET['email'] ) ) {
615
-            _e( "Provide the new user's email address", 'invoicing' );
614
+        if (empty($_GET['email'])) {
615
+            _e("Provide the new user's email address", 'invoicing');
616 616
             exit;
617 617
         }
618 618
 
619 619
         // Ensure the email is valid.
620
-        $email = sanitize_text_field( $_GET['email'] );
621
-        if ( ! is_email( $email ) ) {
622
-            _e( 'Invalid email address', 'invoicing' );
620
+        $email = sanitize_text_field($_GET['email']);
621
+        if (!is_email($email)) {
622
+            _e('Invalid email address', 'invoicing');
623 623
             exit;
624 624
         }
625 625
 
626 626
         // And it does not exist.
627
-        if ( email_exists( $email ) ) {
628
-            _e( 'A user with this email address already exists', 'invoicing' );
627
+        if (email_exists($email)) {
628
+            _e('A user with this email address already exists', 'invoicing');
629 629
             exit;
630 630
         }
631 631
 
632
-        wp_send_json_success( true );
632
+        wp_send_json_success(true);
633 633
     }
634 634
     
635 635
     public static function run_tool() {
636
-        check_ajax_referer( 'wpinv-nonce', '_nonce' );
637
-        if ( !wpinv_current_user_can_manage_invoicing() ) {
636
+        check_ajax_referer('wpinv-nonce', '_nonce');
637
+        if (!wpinv_current_user_can_manage_invoicing()) {
638 638
             die(-1);
639 639
         }
640 640
         
641
-        $tool = sanitize_text_field( $_POST['tool'] );
641
+        $tool = sanitize_text_field($_POST['tool']);
642 642
         
643
-        do_action( 'wpinv_run_tool' );
643
+        do_action('wpinv_run_tool');
644 644
         
645
-        if ( !empty( $tool ) ) {
646
-            do_action( 'wpinv_tool_' . $tool );
645
+        if (!empty($tool)) {
646
+            do_action('wpinv_tool_' . $tool);
647 647
         }
648 648
     }
649 649
     
650 650
     public static function apply_discount() {
651 651
         global $wpi_userID;
652 652
         
653
-        check_ajax_referer( 'wpinv-nonce', '_nonce' );
653
+        check_ajax_referer('wpinv-nonce', '_nonce');
654 654
         
655 655
         $response = array();
656 656
         
657
-        if ( isset( $_POST['code'] ) ) {
658
-            $discount_code = sanitize_text_field( $_POST['code'] );
657
+        if (isset($_POST['code'])) {
658
+            $discount_code = sanitize_text_field($_POST['code']);
659 659
 
660 660
             $response['success']        = false;
661 661
             $response['msg']            = '';
662 662
             $response['data']['code']   = $discount_code;
663 663
             
664 664
             $invoice = wpinv_get_invoice_cart();
665
-            if ( empty( $invoice->ID ) ) {
666
-                $response['msg'] = __( 'Invalid checkout request.', 'invoicing' );
667
-                wp_send_json( $response );
665
+            if (empty($invoice->ID)) {
666
+                $response['msg'] = __('Invalid checkout request.', 'invoicing');
667
+                wp_send_json($response);
668 668
             }
669 669
 
670 670
             $wpi_userID = $invoice->get_user_id();
671 671
 
672
-            if ( wpinv_is_discount_valid( $discount_code, $wpi_userID ) ) {
673
-                $discount       = wpinv_get_discount_by_code( $discount_code );
674
-                $discounts      = wpinv_set_cart_discount( $discount_code );
675
-                $amount         = wpinv_format_discount_rate( wpinv_get_discount_type( $discount->ID ), wpinv_get_discount_amount( $discount->ID ) );
676
-                $total          = wpinv_get_cart_total( null, $discounts );
677
-                $cart_totals    = wpinv_recalculate_tax( true );
672
+            if (wpinv_is_discount_valid($discount_code, $wpi_userID)) {
673
+                $discount       = wpinv_get_discount_by_code($discount_code);
674
+                $discounts      = wpinv_set_cart_discount($discount_code);
675
+                $amount         = wpinv_format_discount_rate(wpinv_get_discount_type($discount->ID), wpinv_get_discount_amount($discount->ID));
676
+                $total          = wpinv_get_cart_total(null, $discounts);
677
+                $cart_totals    = wpinv_recalculate_tax(true);
678 678
             
679
-                if ( !empty( $cart_totals ) ) {
679
+                if (!empty($cart_totals)) {
680 680
                     $response['success']        = true;
681 681
                     $response['data']           = $cart_totals;
682 682
                     $response['data']['code']   = $discount_code;
@@ -685,29 +685,29 @@  discard block
 block discarded – undo
685 685
                 }
686 686
             } else {
687 687
                 $errors = wpinv_get_errors();
688
-                $response['msg']  = $errors['wpinv-discount-error'];
689
-                wpinv_unset_error( 'wpinv-discount-error' );
688
+                $response['msg'] = $errors['wpinv-discount-error'];
689
+                wpinv_unset_error('wpinv-discount-error');
690 690
             }
691 691
 
692 692
             // Allow for custom discount code handling
693
-            $response = apply_filters( 'wpinv_ajax_discount_response', $response );
693
+            $response = apply_filters('wpinv_ajax_discount_response', $response);
694 694
         }
695 695
         
696
-        wp_send_json( $response );
696
+        wp_send_json($response);
697 697
     }
698 698
     
699 699
     public static function remove_discount() {
700
-        check_ajax_referer( 'wpinv-nonce', '_nonce' );
700
+        check_ajax_referer('wpinv-nonce', '_nonce');
701 701
         
702 702
         $response = array();
703 703
         
704
-        if ( isset( $_POST['code'] ) ) {
705
-            $discount_code  = sanitize_text_field( $_POST['code'] );
706
-            $discounts      = wpinv_unset_cart_discount( $discount_code );
707
-            $total          = wpinv_get_cart_total( null, $discounts );
708
-            $cart_totals    = wpinv_recalculate_tax( true );
704
+        if (isset($_POST['code'])) {
705
+            $discount_code  = sanitize_text_field($_POST['code']);
706
+            $discounts      = wpinv_unset_cart_discount($discount_code);
707
+            $total          = wpinv_get_cart_total(null, $discounts);
708
+            $cart_totals    = wpinv_recalculate_tax(true);
709 709
             
710
-            if ( !empty( $cart_totals ) ) {
710
+            if (!empty($cart_totals)) {
711 711
                 $response['success']        = true;
712 712
                 $response['data']           = $cart_totals;
713 713
                 $response['data']['code']   = $discount_code;
@@ -716,10 +716,10 @@  discard block
 block discarded – undo
716 716
             }
717 717
             
718 718
             // Allow for custom discount code handling
719
-            $response = apply_filters( 'wpinv_ajax_discount_response', $response );
719
+            $response = apply_filters('wpinv_ajax_discount_response', $response);
720 720
         }
721 721
         
722
-        wp_send_json( $response );
722
+        wp_send_json($response);
723 723
     }
724 724
 
725 725
     /**
@@ -728,30 +728,30 @@  discard block
 block discarded – undo
728 728
     public static function get_payment_form() {
729 729
 
730 730
         // Check nonce.
731
-        if ( ! isset( $_GET['nonce'] ) || ! wp_verify_nonce( $_GET['nonce'], 'getpaid_ajax_form' ) ) {
732
-            _e( 'Error: Reload the page and try again.', 'invoicing' );
731
+        if (!isset($_GET['nonce']) || !wp_verify_nonce($_GET['nonce'], 'getpaid_ajax_form')) {
732
+            _e('Error: Reload the page and try again.', 'invoicing');
733 733
             exit;
734 734
         }
735 735
 
736 736
         // Is the request set up correctly?
737
-		if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) {
737
+		if (empty($_GET['form']) && empty($_GET['item'])) {
738 738
 			echo aui()->alert(
739 739
 				array(
740 740
 					'type'    => 'warning',
741
-					'content' => __( 'No payment form or item provided', 'invoicing' ),
741
+					'content' => __('No payment form or item provided', 'invoicing'),
742 742
 				)
743 743
             );
744 744
             exit;
745 745
         }
746 746
 
747 747
         // Payment form or button?
748
-		if ( ! empty( $_GET['form'] ) ) {
749
-            echo getpaid_display_payment_form( $_GET['form'] );
750
-		} else if( $_GET['invoice'] ) {
751
-		    echo getpaid_display_invoice_payment_form( $_GET['invoice'] );
748
+		if (!empty($_GET['form'])) {
749
+            echo getpaid_display_payment_form($_GET['form']);
750
+		} else if ($_GET['invoice']) {
751
+		    echo getpaid_display_invoice_payment_form($_GET['invoice']);
752 752
         } else {
753
-			$items = getpaid_convert_items_to_array( $_GET['item'] );
754
-		    echo getpaid_display_item_payment_form( $items );
753
+			$items = getpaid_convert_items_to_array($_GET['item']);
754
+		    echo getpaid_display_item_payment_form($items);
755 755
         }
756 756
         
757 757
         exit;
@@ -767,11 +767,11 @@  discard block
 block discarded – undo
767 767
         global $invoicing, $wpi_checkout_id, $cart_total;
768 768
 
769 769
         // Check nonce.
770
-        check_ajax_referer( 'getpaid_form_nonce' );
770
+        check_ajax_referer('getpaid_form_nonce');
771 771
 
772 772
         // ... form fields...
773
-        if ( empty( $_POST['getpaid_payment_form_submission'] ) ) {
774
-            _e( 'Error: Reload the page and try again.', 'invoicing' );
773
+        if (empty($_POST['getpaid_payment_form_submission'])) {
774
+            _e('Error: Reload the page and try again.', 'invoicing');
775 775
             exit;
776 776
         }
777 777
 
@@ -779,25 +779,25 @@  discard block
 block discarded – undo
779 779
         $submission = new GetPaid_Payment_Form_Submission();
780 780
 
781 781
         // Do we have an error?
782
-        if ( ! empty( $submission->last_error ) ) {
782
+        if (!empty($submission->last_error)) {
783 783
             echo $submission->last_error;
784 784
             exit;
785 785
         }
786 786
 
787 787
         // We need a billing email.
788
-        if ( ! $submission->has_billing_email() || ! is_email( $submission->get_billing_email() ) ) {
789
-            wp_send_json_error( __( 'Provide a valid billing email.', 'invoicing' ) );
788
+        if (!$submission->has_billing_email() || !is_email($submission->get_billing_email())) {
789
+            wp_send_json_error(__('Provide a valid billing email.', 'invoicing'));
790 790
         }
791 791
 
792 792
         // Prepare items.
793 793
         $items            = $submission->get_items();
794 794
         $prepared_items   = array();
795 795
 
796
-        if ( ! empty( $items ) ) {
796
+        if (!empty($items)) {
797 797
 
798
-            foreach( $items as $item_id => $item ) {
798
+            foreach ($items as $item_id => $item) {
799 799
 
800
-                if ( $item->can_purchase() ) {
800
+                if ($item->can_purchase()) {
801 801
                     $prepared_items[] = array(
802 802
                         'id'           => $item_id,
803 803
                         'item_price'   => $item->get_price(),
@@ -811,90 +811,90 @@  discard block
 block discarded – undo
811 811
 
812 812
         }
813 813
 
814
-        if ( empty( $prepared_items ) ) {
815
-            wp_send_json_error( __( 'You have not selected any items.', 'invoicing' ) );
814
+        if (empty($prepared_items)) {
815
+            wp_send_json_error(__('You have not selected any items.', 'invoicing'));
816 816
         }
817 817
 
818
-        if ( $submission->has_recurring && 1 != count( $prepared_items ) ) {
819
-            wp_send_json_error( __( 'Recurring items should be bought individually.', 'invoicing' ) );
818
+        if ($submission->has_recurring && 1 != count($prepared_items)) {
819
+            wp_send_json_error(__('Recurring items should be bought individually.', 'invoicing'));
820 820
         }
821 821
 
822 822
         // Prepare the submission details.
823 823
         $prepared = array(
824
-            'billing_email'                    => sanitize_email( $submission->get_billing_email() ),
825
-            __( 'Billing Email', 'invoicing' ) => sanitize_email( $submission->get_billing_email() ),
826
-            __( 'Form Id', 'invoicing' )       => absint( $submission->payment_form->get_id() ),
824
+            'billing_email'                    => sanitize_email($submission->get_billing_email()),
825
+            __('Billing Email', 'invoicing') => sanitize_email($submission->get_billing_email()),
826
+            __('Form Id', 'invoicing')       => absint($submission->payment_form->get_id()),
827 827
         );
828 828
 
829 829
         // Address fields.
830 830
         $address_fields = array();
831 831
 
832 832
         // Add discount code.
833
-        if ( $submission->has_discount_code() ) {
834
-            $address_fields['discount'] = array( $submission->get_discount_code() );
833
+        if ($submission->has_discount_code()) {
834
+            $address_fields['discount'] = array($submission->get_discount_code());
835 835
         }
836 836
 
837 837
         // Are all required fields provided?
838 838
         $data = $submission->get_data();
839 839
 
840
-        foreach ( $submission->payment_form->get_elements() as $field ) {
840
+        foreach ($submission->payment_form->get_elements() as $field) {
841 841
 
842
-            if ( ! empty( $field['premade'] ) ) {
842
+            if (!empty($field['premade'])) {
843 843
                 continue;
844 844
             }
845 845
 
846
-            if ( ! $submission->is_required_field_set( $field ) ) {
847
-                wp_send_json_error( __( 'Fill all required fields.', 'invoicing' ) );
846
+            if (!$submission->is_required_field_set($field)) {
847
+                wp_send_json_error(__('Fill all required fields.', 'invoicing'));
848 848
             }
849 849
 
850
-            if ( $field['type'] == 'address' ) {
850
+            if ($field['type'] == 'address') {
851 851
 
852
-                foreach ( $field['fields'] as $address_field ) {
852
+                foreach ($field['fields'] as $address_field) {
853 853
 
854
-                    if ( empty( $address_field['visible'] ) ) {
854
+                    if (empty($address_field['visible'])) {
855 855
                         continue;
856 856
                     }
857 857
 
858
-                    if ( ! empty( $address_field['required'] ) && empty( $data[ $address_field['name'] ] ) ) {
859
-                        wp_send_json_error( __( 'Some required fields have not been filled.', 'invoicing' ) );
858
+                    if (!empty($address_field['required']) && empty($data[$address_field['name']])) {
859
+                        wp_send_json_error(__('Some required fields have not been filled.', 'invoicing'));
860 860
                     }
861 861
 
862
-                    if ( isset( $data[ $address_field['name'] ] ) ) {
863
-                        $label = str_replace( 'wpinv_', '', $address_field['name'] );
864
-                        $address_fields[ $label ] = wpinv_clean( $data[ $address_field['name'] ] );
862
+                    if (isset($data[$address_field['name']])) {
863
+                        $label = str_replace('wpinv_', '', $address_field['name']);
864
+                        $address_fields[$label] = wpinv_clean($data[$address_field['name']]);
865 865
                     }
866 866
 
867 867
                 }
868 868
 
869
-            } else if ( isset( $data[ $field['id'] ] ) ) {
869
+            } else if (isset($data[$field['id']])) {
870 870
                 $label = $field['id'];
871 871
 
872
-                if ( isset( $field['label'] ) ) {
872
+                if (isset($field['label'])) {
873 873
                     $label = $field['label'];
874 874
                 }
875 875
 
876
-                $prepared[ wpinv_clean( $label ) ] = wpinv_clean( $data[ $field['id'] ] );
876
+                $prepared[wpinv_clean($label)] = wpinv_clean($data[$field['id']]);
877 877
             }
878 878
 
879 879
         }
880 880
 
881 881
         // (Maybe) create the user.
882
-        $user = get_user_by( 'email', $prepared['billing_email'] );
882
+        $user = get_user_by('email', $prepared['billing_email']);
883 883
 
884
-        if ( empty( $user ) ) {
885
-            $user = wpinv_create_user( $prepared['billing_email'] );
884
+        if (empty($user)) {
885
+            $user = wpinv_create_user($prepared['billing_email']);
886 886
         }
887 887
 
888
-        if ( is_wp_error( $user ) ) {
889
-            wp_send_json_error( $user->get_error_message() );
888
+        if (is_wp_error($user)) {
889
+            wp_send_json_error($user->get_error_message());
890 890
         }
891 891
 
892
-        if ( is_numeric( $user ) ) {
893
-            $user = get_user_by( 'id', $user );
892
+        if (is_numeric($user)) {
893
+            $user = get_user_by('id', $user);
894 894
         }
895 895
 
896 896
         // Create the invoice.
897
-        if ( ! $submission->has_invoice() ) {
897
+        if (!$submission->has_invoice()) {
898 898
 
899 899
             $invoice = wpinv_insert_invoice(
900 900
                 array(
@@ -911,8 +911,8 @@  discard block
 block discarded – undo
911 911
 
912 912
             $invoice = $submission->get_invoice();
913 913
 
914
-            if ( $invoice->is_paid() ) {
915
-                wp_send_json_error( __( 'This invoice has already been paid for.', 'invoicing' ) );
914
+            if ($invoice->is_paid()) {
915
+                wp_send_json_error(__('This invoice has already been paid for.', 'invoicing'));
916 916
             }
917 917
 
918 918
             $invoice = wpinv_update_invoice(
@@ -927,34 +927,34 @@  discard block
 block discarded – undo
927 927
 
928 928
         }
929 929
 
930
-        if ( is_wp_error( $invoice ) ) {
931
-            wp_send_json_error( $invoice->get_error_message() );
930
+        if (is_wp_error($invoice)) {
931
+            wp_send_json_error($invoice->get_error_message());
932 932
         }
933 933
 
934
-        if ( empty( $invoice ) ) {
935
-            wp_send_json_error( __( 'Could not create your invoice.', 'invoicing' ) );
934
+        if (empty($invoice)) {
935
+            wp_send_json_error(__('Could not create your invoice.', 'invoicing'));
936 936
         }
937 937
 
938
-        unset( $prepared['billing_email'] );
939
-        update_post_meta( $invoice->ID, 'payment_form_data', $prepared );
938
+        unset($prepared['billing_email']);
939
+        update_post_meta($invoice->ID, 'payment_form_data', $prepared);
940 940
 
941 941
         $wpi_checkout_id = $invoice->ID;
942 942
         $cart_total = wpinv_price(
943 943
             wpinv_format_amount(
944
-                wpinv_get_cart_total( $invoice->get_cart_details(), NULL, $invoice ) ),
944
+                wpinv_get_cart_total($invoice->get_cart_details(), NULL, $invoice) ),
945 945
                 $invoice->get_currency()
946 946
         );
947 947
 
948 948
         $data                   = array();
949 949
         $data['invoice_id']     = $invoice->ID;
950
-        $data['cart_discounts'] = $invoice->get_discounts( true );
950
+        $data['cart_discounts'] = $invoice->get_discounts(true);
951 951
 
952
-        wpinv_set_checkout_session( $data );
953
-        add_filter( 'wp_redirect', array( $invoicing->form_elements, 'send_redirect_response' ) );
954
-        add_action( 'wpinv_pre_send_back_to_checkout', array( $invoicing->form_elements, 'checkout_error' ) );
952
+        wpinv_set_checkout_session($data);
953
+        add_filter('wp_redirect', array($invoicing->form_elements, 'send_redirect_response'));
954
+        add_action('wpinv_pre_send_back_to_checkout', array($invoicing->form_elements, 'checkout_error'));
955 955
         
956
-        if ( ! defined( 'WPINV_CHECKOUT' ) ) {
957
-            define( 'WPINV_CHECKOUT', true );
956
+        if (!defined('WPINV_CHECKOUT')) {
957
+            define('WPINV_CHECKOUT', true);
958 958
         }
959 959
 
960 960
         wpinv_process_checkout();
@@ -972,51 +972,51 @@  discard block
 block discarded – undo
972 972
     public static function get_payment_form_states_field() {
973 973
         global $invoicing;
974 974
 
975
-        if ( empty( $_GET['country'] ) || empty( $_GET['form'] ) ) {
975
+        if (empty($_GET['country']) || empty($_GET['form'])) {
976 976
             exit;
977 977
         }
978 978
 
979
-        $elements = $invoicing->form_elements->get_form_elements( $_GET['form'] );
979
+        $elements = $invoicing->form_elements->get_form_elements($_GET['form']);
980 980
 
981
-        if ( empty( $elements ) ) {
981
+        if (empty($elements)) {
982 982
             exit;
983 983
         }
984 984
 
985 985
         $address_fields = array();
986
-        foreach ( $elements as $element ) {
987
-            if ( 'address' === $element['type'] ) {
986
+        foreach ($elements as $element) {
987
+            if ('address' === $element['type']) {
988 988
                 $address_fields = $element;
989 989
                 break;
990 990
             }
991 991
         }
992 992
 
993
-        if ( empty( $address_fields ) ) {
993
+        if (empty($address_fields)) {
994 994
             exit;
995 995
         }
996 996
 
997
-        foreach( $address_fields['fields'] as $address_field ) {
997
+        foreach ($address_fields['fields'] as $address_field) {
998 998
 
999
-            if ( 'wpinv_state' == $address_field['name'] ) {
999
+            if ('wpinv_state' == $address_field['name']) {
1000 1000
 
1001 1001
                 $label = $address_field['label'];
1002 1002
 
1003
-                if ( ! empty( $address_field['required'] ) ) {
1003
+                if (!empty($address_field['required'])) {
1004 1004
                     $label .= "<span class='text-danger'> *</span>";
1005 1005
                 }
1006 1006
 
1007
-                $states = wpinv_get_country_states( $_GET['country'] );
1007
+                $states = wpinv_get_country_states($_GET['country']);
1008 1008
 
1009
-                if ( ! empty( $states ) ) {
1009
+                if (!empty($states)) {
1010 1010
 
1011 1011
                     $html = aui()->select(
1012 1012
                             array(
1013 1013
                                 'options'          => $states,
1014
-                                'name'             => esc_attr( $address_field['name'] ),
1015
-                                'id'               => esc_attr( $address_field['name'] ),
1016
-                                'placeholder'      => esc_attr( $address_field['placeholder'] ),
1014
+                                'name'             => esc_attr($address_field['name']),
1015
+                                'id'               => esc_attr($address_field['name']),
1016
+                                'placeholder'      => esc_attr($address_field['placeholder']),
1017 1017
                                 'required'         => (bool) $address_field['required'],
1018 1018
                                 'no_wrap'          => true,
1019
-                                'label'            => wp_kses_post( $label ),
1019
+                                'label'            => wp_kses_post($label),
1020 1020
                                 'select2'          => false,
1021 1021
                             )
1022 1022
                         );
@@ -1025,10 +1025,10 @@  discard block
 block discarded – undo
1025 1025
 
1026 1026
                     $html = aui()->input(
1027 1027
                             array(
1028
-                                'name'       => esc_attr( $address_field['name'] ),
1029
-                                'id'         => esc_attr( $address_field['name'] ),
1028
+                                'name'       => esc_attr($address_field['name']),
1029
+                                'id'         => esc_attr($address_field['name']),
1030 1030
                                 'required'   => (bool) $address_field['required'],
1031
-                                'label'      => wp_kses_post( $label ),
1031
+                                'label'      => wp_kses_post($label),
1032 1032
                                 'no_wrap'    => true,
1033 1033
                                 'type'       => 'text',
1034 1034
                             )
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
 
1037 1037
                 }
1038 1038
 
1039
-                wp_send_json_success( str_replace( 'sr-only', '', $html ) );
1039
+                wp_send_json_success(str_replace('sr-only', '', $html));
1040 1040
                 exit;
1041 1041
 
1042 1042
             }
@@ -1052,33 +1052,33 @@  discard block
 block discarded – undo
1052 1052
     public static function get_invoice_items() {
1053 1053
 
1054 1054
         // Verify nonce.
1055
-        check_ajax_referer( 'wpinv-nonce' );
1055
+        check_ajax_referer('wpinv-nonce');
1056 1056
 
1057
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
1057
+        if (!wpinv_current_user_can_manage_invoicing()) {
1058 1058
             exit;
1059 1059
         }
1060 1060
 
1061 1061
         // We need an invoice and items.
1062
-        if ( empty( $_POST['post_id'] ) ) {
1062
+        if (empty($_POST['post_id'])) {
1063 1063
             exit;
1064 1064
         }
1065 1065
 
1066 1066
         // Fetch the invoice.
1067
-        $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) );
1067
+        $invoice = new WPInv_Invoice(trim($_POST['post_id']));
1068 1068
 
1069 1069
         // Ensure it exists.
1070
-        if ( ! $invoice->get_id() ) {
1070
+        if (!$invoice->get_id()) {
1071 1071
             exit;
1072 1072
         }
1073 1073
 
1074 1074
         // Return an array of invoice items.
1075 1075
         $items = array();
1076 1076
 
1077
-        foreach ( $invoice->get_items() as $item_id => $item ) {
1078
-            $items[ $item_id ] = $item->prepare_data_for_invoice_edit_ajax();
1077
+        foreach ($invoice->get_items() as $item_id => $item) {
1078
+            $items[$item_id] = $item->prepare_data_for_invoice_edit_ajax();
1079 1079
         }
1080 1080
 
1081
-        wp_send_json_success( compact( 'items' ) );
1081
+        wp_send_json_success(compact('items'));
1082 1082
     }
1083 1083
 
1084 1084
     /**
@@ -1087,48 +1087,48 @@  discard block
 block discarded – undo
1087 1087
     public static function edit_invoice_item() {
1088 1088
 
1089 1089
         // Verify nonce.
1090
-        check_ajax_referer( 'wpinv-nonce' );
1090
+        check_ajax_referer('wpinv-nonce');
1091 1091
 
1092
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
1092
+        if (!wpinv_current_user_can_manage_invoicing()) {
1093 1093
             exit;
1094 1094
         }
1095 1095
 
1096 1096
         // We need an invoice and item details.
1097
-        if ( empty( $_POST['post_id'] ) || empty( $_POST['data'] ) ) {
1097
+        if (empty($_POST['post_id']) || empty($_POST['data'])) {
1098 1098
             exit;
1099 1099
         }
1100 1100
 
1101 1101
         // Fetch the invoice.
1102
-        $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) );
1102
+        $invoice = new WPInv_Invoice(trim($_POST['post_id']));
1103 1103
 
1104 1104
         // Ensure it exists and its not been paid for.
1105
-        if ( ! $invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded() ) {
1105
+        if (!$invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded()) {
1106 1106
             exit;
1107 1107
         }
1108 1108
 
1109 1109
         // Format the data.
1110
-        $data = wp_list_pluck( $_POST['data'], 'value', 'field' );
1110
+        $data = wp_list_pluck($_POST['data'], 'value', 'field');
1111 1111
 
1112 1112
         // Ensure that we have an item id.
1113
-        if ( empty( $data['id'] ) ) {
1113
+        if (empty($data['id'])) {
1114 1114
             exit;
1115 1115
         }
1116 1116
 
1117 1117
         // Abort if the invoice does not have the specified item.
1118
-        $item = $invoice->get_item( (int) $data['id'] );
1118
+        $item = $invoice->get_item((int) $data['id']);
1119 1119
 
1120
-        if ( empty( $item ) ) {
1120
+        if (empty($item)) {
1121 1121
             exit;
1122 1122
         }
1123 1123
 
1124 1124
         // Update the item.
1125
-        $item->set_price( $data['price'] );
1126
-        $item->set_name( $data['name'] );
1127
-        $item->set_description( $data['description'] );
1128
-        $item->set_quantity( $data['quantity'] );
1125
+        $item->set_price($data['price']);
1126
+        $item->set_name($data['name']);
1127
+        $item->set_description($data['description']);
1128
+        $item->set_quantity($data['quantity']);
1129 1129
 
1130 1130
         // Add it to the invoice.
1131
-        $invoice->add_item( $item );
1131
+        $invoice->add_item($item);
1132 1132
 
1133 1133
         // Update totals.
1134 1134
         $invoice->recalculate_total();
@@ -1139,11 +1139,11 @@  discard block
 block discarded – undo
1139 1139
         // Return an array of invoice items.
1140 1140
         $items = array();
1141 1141
 
1142
-        foreach ( $invoice->get_items() as $item_id => $item ) {
1143
-            $items[ $item_id ] = $item->prepare_data_for_invoice_edit_ajax();
1142
+        foreach ($invoice->get_items() as $item_id => $item) {
1143
+            $items[$item_id] = $item->prepare_data_for_invoice_edit_ajax();
1144 1144
         }
1145 1145
 
1146
-        wp_send_json_success( compact( 'items' ) );
1146
+        wp_send_json_success(compact('items'));
1147 1147
     }
1148 1148
     /**
1149 1149
      * Adds a items to an invoice.
@@ -1151,38 +1151,38 @@  discard block
 block discarded – undo
1151 1151
     public static function add_invoice_items() {
1152 1152
 
1153 1153
         // Verify nonce.
1154
-        check_ajax_referer( 'wpinv-nonce' );
1154
+        check_ajax_referer('wpinv-nonce');
1155 1155
 
1156
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
1156
+        if (!wpinv_current_user_can_manage_invoicing()) {
1157 1157
             exit;
1158 1158
         }
1159 1159
 
1160 1160
         // We need an invoice and items.
1161
-        if ( empty( $_POST['post_id'] ) || empty( $_POST['items'] ) ) {
1161
+        if (empty($_POST['post_id']) || empty($_POST['items'])) {
1162 1162
             exit;
1163 1163
         }
1164 1164
 
1165 1165
         // Fetch the invoice.
1166
-        $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) );
1166
+        $invoice = new WPInv_Invoice(trim($_POST['post_id']));
1167 1167
         $alert   = false;
1168 1168
 
1169 1169
         // Ensure it exists and its not been paid for.
1170
-        if ( ! $invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded() ) {
1170
+        if (!$invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded()) {
1171 1171
             exit;
1172 1172
         }
1173 1173
 
1174 1174
         // Add the items.
1175
-        foreach ( $_POST['items'] as $data ) {
1175
+        foreach ($_POST['items'] as $data) {
1176 1176
 
1177
-            $item = new GetPaid_Form_Item( $data[ 'id' ] );
1177
+            $item = new GetPaid_Form_Item($data['id']);
1178 1178
 
1179
-            if ( is_numeric( $data[ 'qty' ] ) && (int) $data[ 'qty' ] > 0 ) {
1180
-                $item->set_quantity( $data[ 'qty' ] );
1179
+            if (is_numeric($data['qty']) && (int) $data['qty'] > 0) {
1180
+                $item->set_quantity($data['qty']);
1181 1181
             }
1182 1182
 
1183
-            if ( $item->get_id() > 0 ) {
1184
-                if ( ! $invoice->add_item( $item ) ) {
1185
-                    $alert = __( 'An invoice can only contain one recurring item', 'invoicing' );
1183
+            if ($item->get_id() > 0) {
1184
+                if (!$invoice->add_item($item)) {
1185
+                    $alert = __('An invoice can only contain one recurring item', 'invoicing');
1186 1186
                 }
1187 1187
             }
1188 1188
 
@@ -1195,11 +1195,11 @@  discard block
 block discarded – undo
1195 1195
         // Return an array of invoice items.
1196 1196
         $items = array();
1197 1197
 
1198
-        foreach ( $invoice->get_items() as $item_id => $item ) {
1199
-            $items[ $item_id ] = $item->prepare_data_for_invoice_edit_ajax();
1198
+        foreach ($invoice->get_items() as $item_id => $item) {
1199
+            $items[$item_id] = $item->prepare_data_for_invoice_edit_ajax();
1200 1200
         }
1201 1201
 
1202
-        wp_send_json_success( compact( 'items', 'alert' ) );
1202
+        wp_send_json_success(compact('items', 'alert'));
1203 1203
     }
1204 1204
 
1205 1205
     /**
@@ -1208,15 +1208,15 @@  discard block
 block discarded – undo
1208 1208
     public static function get_invoicing_items() {
1209 1209
 
1210 1210
         // Verify nonce.
1211
-        check_ajax_referer( 'wpinv-nonce' );
1211
+        check_ajax_referer('wpinv-nonce');
1212 1212
 
1213
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
1213
+        if (!wpinv_current_user_can_manage_invoicing()) {
1214 1214
             exit;
1215 1215
         }
1216 1216
 
1217 1217
         // We need a search term.
1218
-        if ( empty( $_GET['search'] ) ) {
1219
-            wp_send_json_success( array() );
1218
+        if (empty($_GET['search'])) {
1219
+            wp_send_json_success(array());
1220 1220
         }
1221 1221
 
1222 1222
         // Retrieve items.
@@ -1225,8 +1225,8 @@  discard block
 block discarded – undo
1225 1225
             'orderby'        => 'title',
1226 1226
             'order'          => 'ASC',
1227 1227
             'posts_per_page' => -1,
1228
-            'post_status'    => array( 'publish' ),
1229
-            's'              => trim( $_GET['search'] ),
1228
+            'post_status'    => array('publish'),
1229
+            's'              => trim($_GET['search']),
1230 1230
             'meta_query'     => array(
1231 1231
                 array(
1232 1232
                     'key'       => '_wpinv_type',
@@ -1236,18 +1236,18 @@  discard block
 block discarded – undo
1236 1236
             )
1237 1237
         );
1238 1238
 
1239
-        $items = get_posts( apply_filters( 'getpaid_ajax_invoice_items_query_args', $item_args ) );
1239
+        $items = get_posts(apply_filters('getpaid_ajax_invoice_items_query_args', $item_args));
1240 1240
         $data  = array();
1241 1241
 
1242
-        foreach ( $items as $item ) {
1243
-            $item      = new GetPaid_Form_Item( $item );
1242
+        foreach ($items as $item) {
1243
+            $item = new GetPaid_Form_Item($item);
1244 1244
             $data[] = array(
1245 1245
                 'id'   => $item->get_id(),
1246 1246
                 'text' => $item->get_name()
1247 1247
             );
1248 1248
         }
1249 1249
 
1250
-        wp_send_json_success( $data );
1250
+        wp_send_json_success($data);
1251 1251
 
1252 1252
     }
1253 1253
 
@@ -1257,24 +1257,24 @@  discard block
 block discarded – undo
1257 1257
     public static function get_aui_states_field() {
1258 1258
 
1259 1259
         // Verify nonce.
1260
-        check_ajax_referer( 'wpinv-nonce' );
1260
+        check_ajax_referer('wpinv-nonce');
1261 1261
 
1262 1262
         // We need a country.
1263
-        if ( empty( $_GET['country'] ) ) {
1263
+        if (empty($_GET['country'])) {
1264 1264
             exit;
1265 1265
         }
1266 1266
 
1267
-        $states = wpinv_get_country_states( trim( $_GET['country'] ) );
1268
-        $state  = isset( $_GET['state'] ) ? trim( $_GET['state'] ) : wpinv_get_default_state();
1267
+        $states = wpinv_get_country_states(trim($_GET['country']));
1268
+        $state  = isset($_GET['state']) ? trim($_GET['state']) : wpinv_get_default_state();
1269 1269
 
1270
-        if ( empty( $states ) ) {
1270
+        if (empty($states)) {
1271 1271
 
1272 1272
             $html = aui()->input(
1273 1273
                 array(
1274 1274
                     'type'        => 'text',
1275 1275
                     'id'          => 'wpinv_state',
1276 1276
                     'name'        => 'wpinv_state',
1277
-                    'label'       => __( 'State', 'invoicing' ),
1277
+                    'label'       => __('State', 'invoicing'),
1278 1278
                     'label_type'  => 'vertical',
1279 1279
                     'placeholder' => 'Liège',
1280 1280
                     'class'       => 'form-control-sm',
@@ -1288,9 +1288,9 @@  discard block
 block discarded – undo
1288 1288
                 array(
1289 1289
                     'id'          => 'wpinv_state',
1290 1290
                     'name'        => 'wpinv_state',
1291
-                    'label'       => __( 'State', 'invoicing' ),
1291
+                    'label'       => __('State', 'invoicing'),
1292 1292
                     'label_type'  => 'vertical',
1293
-                    'placeholder' => __( 'Select a state', 'invoicing' ),
1293
+                    'placeholder' => __('Select a state', 'invoicing'),
1294 1294
                     'class'       => 'form-control-sm',
1295 1295
                     'value'       => $state,
1296 1296
                     'options'     => $states,
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
         wp_send_json_success(
1305 1305
             array(
1306 1306
                 'html'   => $html,
1307
-                'select' => ! empty ( $states )
1307
+                'select' => !empty ($states)
1308 1308
             )
1309 1309
         );
1310 1310
 
@@ -1318,11 +1318,11 @@  discard block
 block discarded – undo
1318 1318
     public static function payment_form_refresh_prices() {
1319 1319
 
1320 1320
         // Check nonce.
1321
-        check_ajax_referer( 'getpaid_form_nonce' );
1321
+        check_ajax_referer('getpaid_form_nonce');
1322 1322
 
1323 1323
         // ... form fields...
1324
-        if ( empty( $_POST['getpaid_payment_form_submission'] ) ) {
1325
-            _e( 'Error: Reload the page and try again.', 'invoicing' );
1324
+        if (empty($_POST['getpaid_payment_form_submission'])) {
1325
+            _e('Error: Reload the page and try again.', 'invoicing');
1326 1326
             exit;
1327 1327
         }
1328 1328
 
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
         $submission = new GetPaid_Payment_Form_Submission();
1331 1331
 
1332 1332
         // Do we have an error?
1333
-        if ( ! empty( $submission->last_error ) ) {
1333
+        if (!empty($submission->last_error)) {
1334 1334
             echo $submission->last_error;
1335 1335
             exit;
1336 1336
         }
@@ -1341,38 +1341,38 @@  discard block
 block discarded – undo
1341 1341
             'has_recurring' => $submission->has_recurring,
1342 1342
             'is_free'       => $submission->get_payment_details(),
1343 1343
             'totals'        => array(
1344
-                'subtotal'  => wpinv_price( wpinv_format_amount( $submission->subtotal_amount ), $submission->get_currency() ),
1345
-                'discount'  => wpinv_price( wpinv_format_amount( $submission->get_total_discount() ), $submission->get_currency() ),
1346
-                'fees'      => wpinv_price( wpinv_format_amount( $submission->get_total_fees() ), $submission->get_currency() ),
1347
-                'tax'       => wpinv_price( wpinv_format_amount( $submission->get_total_tax() ), $submission->get_currency() ),
1348
-                'total'     => wpinv_price( wpinv_format_amount( $submission->get_total() ), $submission->get_currency() ),
1344
+                'subtotal'  => wpinv_price(wpinv_format_amount($submission->subtotal_amount), $submission->get_currency()),
1345
+                'discount'  => wpinv_price(wpinv_format_amount($submission->get_total_discount()), $submission->get_currency()),
1346
+                'fees'      => wpinv_price(wpinv_format_amount($submission->get_total_fees()), $submission->get_currency()),
1347
+                'tax'       => wpinv_price(wpinv_format_amount($submission->get_total_tax()), $submission->get_currency()),
1348
+                'total'     => wpinv_price(wpinv_format_amount($submission->get_total()), $submission->get_currency()),
1349 1349
             ),
1350 1350
         );
1351 1351
 
1352 1352
         // Add items.
1353 1353
         $items = $submission->get_items();
1354
-        if ( ! empty( $items ) ) {
1354
+        if (!empty($items)) {
1355 1355
             $result['items'] = array();
1356 1356
 
1357
-            foreach( $items as $item_id => $item ) {
1358
-                $result['items']["$item_id"] = wpinv_price( wpinv_format_amount( $item->get_price() * $item->get_qantity() ) );
1357
+            foreach ($items as $item_id => $item) {
1358
+                $result['items']["$item_id"] = wpinv_price(wpinv_format_amount($item->get_price() * $item->get_qantity()));
1359 1359
             }
1360 1360
         }
1361 1361
 
1362 1362
         // Add invoice.
1363
-        if ( $submission->has_invoice() ) {
1363
+        if ($submission->has_invoice()) {
1364 1364
             $result['invoice'] = $submission->get_invoice()->ID;
1365 1365
         }
1366 1366
 
1367 1367
         // Add discount code.
1368
-        if ( $submission->has_discount_code() ) {
1368
+        if ($submission->has_discount_code()) {
1369 1369
             $result['discount_code'] = $submission->get_discount_code();
1370 1370
         }
1371 1371
 
1372 1372
         // Filter the result.
1373
-        $result = apply_filters( 'getpaid_payment_form_ajax_refresh_prices', $result, $submission );
1373
+        $result = apply_filters('getpaid_payment_form_ajax_refresh_prices', $result, $submission);
1374 1374
 
1375
-        wp_send_json_success( $result );
1375
+        wp_send_json_success($result);
1376 1376
     }
1377 1377
 
1378 1378
     /**
@@ -1383,53 +1383,53 @@  discard block
 block discarded – undo
1383 1383
     public static function buy_items() {
1384 1384
         $user_id = get_current_user_id();
1385 1385
 
1386
-        if ( empty( $user_id ) ) { // If not logged in then lets redirect to the login page
1387
-            wp_send_json( array(
1388
-                'success' => wp_login_url( wp_get_referer() )
1389
-            ) );
1386
+        if (empty($user_id)) { // If not logged in then lets redirect to the login page
1387
+            wp_send_json(array(
1388
+                'success' => wp_login_url(wp_get_referer())
1389
+            ));
1390 1390
         } else {
1391 1391
             // Only check nonce if logged in as it could be cached when logged out.
1392
-            if ( ! isset( $_POST['wpinv_buy_nonce'] ) || ! wp_verify_nonce( $_POST['wpinv_buy_nonce'], 'wpinv_buy_items' ) ) {
1393
-                wp_send_json( array(
1394
-                    'error' => __( 'Security checks failed.', 'invoicing' )
1395
-                ) );
1392
+            if (!isset($_POST['wpinv_buy_nonce']) || !wp_verify_nonce($_POST['wpinv_buy_nonce'], 'wpinv_buy_items')) {
1393
+                wp_send_json(array(
1394
+                    'error' => __('Security checks failed.', 'invoicing')
1395
+                ));
1396 1396
                 wp_die();
1397 1397
             }
1398 1398
 
1399 1399
             // allow to set a custom price through post_id
1400 1400
             $items = $_POST['items'];
1401
-            $related_post_id = isset( $_POST['post_id'] ) ? (int)$_POST['post_id'] : 0;
1402
-            $custom_item_price = $related_post_id ? abs( get_post_meta( $related_post_id, '_wpi_custom_price', true ) ) : 0;
1401
+            $related_post_id = isset($_POST['post_id']) ? (int) $_POST['post_id'] : 0;
1402
+            $custom_item_price = $related_post_id ? abs(get_post_meta($related_post_id, '_wpi_custom_price', true)) : 0;
1403 1403
 
1404 1404
             $cart_items = array();
1405
-            if ( $items ) {
1406
-                $items = explode( ',', $items );
1405
+            if ($items) {
1406
+                $items = explode(',', $items);
1407 1407
 
1408
-                foreach( $items as $item ) {
1408
+                foreach ($items as $item) {
1409 1409
                     $item_id = $item;
1410 1410
                     $quantity = 1;
1411 1411
 
1412
-                    if ( strpos( $item, '|' ) !== false ) {
1413
-                        $item_parts = explode( '|', $item );
1412
+                    if (strpos($item, '|') !== false) {
1413
+                        $item_parts = explode('|', $item);
1414 1414
                         $item_id = $item_parts[0];
1415 1415
                         $quantity = $item_parts[1];
1416 1416
                     }
1417 1417
 
1418
-                    if ( $item_id && $quantity ) {
1418
+                    if ($item_id && $quantity) {
1419 1419
                         $cart_items_arr = array(
1420
-                            'id'            => (int)$item_id,
1421
-                            'quantity'      => (int)$quantity
1420
+                            'id'            => (int) $item_id,
1421
+                            'quantity'      => (int) $quantity
1422 1422
                         );
1423 1423
 
1424 1424
                         // If there is a related post id then add it to meta
1425
-                        if ( $related_post_id ) {
1425
+                        if ($related_post_id) {
1426 1426
                             $cart_items_arr['meta'] = array(
1427 1427
                                 'post_id'   => $related_post_id
1428 1428
                             );
1429 1429
                         }
1430 1430
 
1431 1431
                         // If there is a custom price then set it.
1432
-                        if ( $custom_item_price ) {
1432
+                        if ($custom_item_price) {
1433 1433
                             $cart_items_arr['custom_price'] = $custom_item_price;
1434 1434
                         }
1435 1435
 
@@ -1445,37 +1445,37 @@  discard block
 block discarded – undo
1445 1445
              * @param int $related_post_id The related post id if any.
1446 1446
              * @since 1.0.0
1447 1447
              */
1448
-            $cart_items = apply_filters( 'wpinv_buy_cart_items', $cart_items, $related_post_id );
1448
+            $cart_items = apply_filters('wpinv_buy_cart_items', $cart_items, $related_post_id);
1449 1449
 
1450 1450
             // Make sure its not in the cart already, if it is then redirect to checkout.
1451 1451
             $cart_invoice = wpinv_get_invoice_cart();
1452 1452
 
1453
-            if ( isset( $cart_invoice->items ) && !empty( $cart_invoice->items ) && !empty( $cart_items ) && serialize( $cart_invoice->items ) == serialize( $cart_items ) ) {
1454
-                wp_send_json( array(
1453
+            if (isset($cart_invoice->items) && !empty($cart_invoice->items) && !empty($cart_items) && serialize($cart_invoice->items) == serialize($cart_items)) {
1454
+                wp_send_json(array(
1455 1455
                     'success' =>  $cart_invoice->get_checkout_payment_url()
1456
-                ) );
1456
+                ));
1457 1457
                 wp_die();
1458 1458
             }
1459 1459
 
1460 1460
             // Check if user has invoice with same items waiting to be paid.
1461
-            $user_invoices = wpinv_get_users_invoices( $user_id , 10 , false , 'wpi-pending' );
1462
-            if ( !empty( $user_invoices ) ) {
1463
-                foreach( $user_invoices as $user_invoice ) {
1461
+            $user_invoices = wpinv_get_users_invoices($user_id, 10, false, 'wpi-pending');
1462
+            if (!empty($user_invoices)) {
1463
+                foreach ($user_invoices as $user_invoice) {
1464 1464
                     $user_cart_details = array();
1465
-                    $invoice  = wpinv_get_invoice( $user_invoice->ID );
1465
+                    $invoice = wpinv_get_invoice($user_invoice->ID);
1466 1466
                     $cart_details = $invoice->get_cart_details();
1467 1467
 
1468
-                    if ( !empty( $cart_details ) ) {
1469
-                        foreach ( $cart_details as $invoice_item ) {
1468
+                    if (!empty($cart_details)) {
1469
+                        foreach ($cart_details as $invoice_item) {
1470 1470
                             $ii_arr = array();
1471
-                            $ii_arr['id'] = (int)$invoice_item['id'];
1472
-                            $ii_arr['quantity'] = (int)$invoice_item['quantity'];
1471
+                            $ii_arr['id'] = (int) $invoice_item['id'];
1472
+                            $ii_arr['quantity'] = (int) $invoice_item['quantity'];
1473 1473
 
1474
-                            if (isset( $invoice_item['meta'] ) && !empty( $invoice_item['meta'] ) ) {
1474
+                            if (isset($invoice_item['meta']) && !empty($invoice_item['meta'])) {
1475 1475
                                 $ii_arr['meta'] = $invoice_item['meta'];
1476 1476
                             }
1477 1477
 
1478
-                            if ( isset( $invoice_item['custom_price'] ) && !empty( $invoice_item['custom_price'] ) ) {
1478
+                            if (isset($invoice_item['custom_price']) && !empty($invoice_item['custom_price'])) {
1479 1479
                                 $ii_arr['custom_price'] = $invoice_item['custom_price'];
1480 1480
                             }
1481 1481
 
@@ -1483,17 +1483,17 @@  discard block
 block discarded – undo
1483 1483
                         }
1484 1484
                     }
1485 1485
 
1486
-                    if ( !empty( $user_cart_details ) && serialize( $cart_items ) == serialize( $user_cart_details ) ) {
1487
-                        wp_send_json( array(
1486
+                    if (!empty($user_cart_details) && serialize($cart_items) == serialize($user_cart_details)) {
1487
+                        wp_send_json(array(
1488 1488
                             'success' =>  $invoice->get_checkout_payment_url()
1489
-                        ) );
1489
+                        ));
1490 1490
                         wp_die();
1491 1491
                     }
1492 1492
                 }
1493 1493
             }
1494 1494
 
1495 1495
             // Create invoice and send user to checkout
1496
-            if ( !empty( $cart_items ) ) {
1496
+            if (!empty($cart_items)) {
1497 1497
                 $invoice_data = array(
1498 1498
                     'status'        =>  'wpi-pending',
1499 1499
                     'created_via'   =>  'wpi',
@@ -1501,21 +1501,21 @@  discard block
 block discarded – undo
1501 1501
                     'cart_details'  =>  $cart_items,
1502 1502
                 );
1503 1503
 
1504
-                $invoice = wpinv_insert_invoice( $invoice_data, true );
1504
+                $invoice = wpinv_insert_invoice($invoice_data, true);
1505 1505
 
1506
-                if ( !empty( $invoice ) && isset( $invoice->ID ) ) {
1507
-                    wp_send_json( array(
1506
+                if (!empty($invoice) && isset($invoice->ID)) {
1507
+                    wp_send_json(array(
1508 1508
                         'success' =>  $invoice->get_checkout_payment_url()
1509
-                    ) );
1509
+                    ));
1510 1510
                 } else {
1511
-                    wp_send_json( array(
1512
-                        'error' => __( 'Invoice failed to create', 'invoicing' )
1513
-                    ) );
1511
+                    wp_send_json(array(
1512
+                        'error' => __('Invoice failed to create', 'invoicing')
1513
+                    ));
1514 1514
                 }
1515 1515
             } else {
1516
-                wp_send_json( array(
1517
-                    'error' => __( 'Items not valid.', 'invoicing' )
1518
-                ) );
1516
+                wp_send_json(array(
1517
+                    'error' => __('Items not valid.', 'invoicing')
1518
+                ));
1519 1519
             }
1520 1520
         }
1521 1521
 
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-invoice-payment-meta.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  *
8 8
  */
9 9
 
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if (!defined('ABSPATH')) {
11 11
 	exit; // Exit if accessed directly
12 12
 }
13 13
 
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @param WP_Post $post
23 23
 	 */
24
-    public static function output( $post ) {
24
+    public static function output($post) {
25 25
 
26 26
         // Prepare the invoice.
27
-        $invoice = new WPInv_Invoice( $post );
27
+        $invoice = new WPInv_Invoice($post);
28 28
 
29 29
         ?>
30 30
 
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
                                 'type'        => 'text',
46 46
                                 'id'          => 'wpinv_key',
47 47
                                 'name'        => 'wpinv_key',
48
-                                'label'       => __( 'Invoice Key:', 'invoicing' ),
48
+                                'label'       => __('Invoice Key:', 'invoicing'),
49 49
                                 'label_type'  => 'vertical',
50 50
                                 'class'       => 'form-control-sm',
51
-                                'value'       => $invoice->get_key( 'edit' ),
51
+                                'value'       => $invoice->get_key('edit'),
52 52
                                 'extra_attributes' => array(
53 53
                                     'onclick'  => 'this.select();',
54 54
                                     'readonly' => 'true',
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                                 'type'        => 'text',
63 63
                                 'id'          => 'wpinv_view_url',
64 64
                                 'name'        => 'wpinv_view_url',
65
-                                'label'       => __( 'Invoice URL:', 'invoicing' ),
65
+                                'label'       => __('Invoice URL:', 'invoicing'),
66 66
                                 'label_type'  => 'vertical',
67 67
                                 'class'       => 'form-control-sm',
68 68
                                 'value'       => $invoice->get_view_url(),
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
                         );
75 75
 
76 76
                         // If the invoice is paid...
77
-                        if ( $invoice->is_paid() || $invoice->is_refunded() ) {
77
+                        if ($invoice->is_paid() || $invoice->is_refunded()) {
78 78
 
79 79
                             // Payment date.
80 80
                             echo aui()->input(
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
                                     'type'        => 'datepicker',
83 83
                                     'id'          => 'wpinv_date_completed',
84 84
                                     'name'        => 'date_completed',
85
-                                    'label'       => __( 'Payment Date:', 'invoicing' ),
85
+                                    'label'       => __('Payment Date:', 'invoicing'),
86 86
                                     'label_type'  => 'vertical',
87 87
                                     'placeholder' => 'YYYY-MM-DD 00:00',
88 88
                                     'class'       => 'form-control-sm',
89
-                                    'value'       => $invoice->get_date_completed( 'edit' ),
89
+                                    'value'       => $invoice->get_date_completed('edit'),
90 90
                                     'extra_attributes' => array(
91 91
                                         'data-enable-time' => 'true',
92 92
                                         'data-time_24hr'   => 'true',
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
                                     'type'        => 'text',
102 102
                                     'id'          => 'wpinv_gateway',
103 103
                                     'name'        => 'wpinv_gateway',
104
-                                    'label'       => __( 'Gateway:', 'invoicing' ),
104
+                                    'label'       => __('Gateway:', 'invoicing'),
105 105
                                     'label_type'  => 'vertical',
106 106
                                     'class'       => 'form-control-sm',
107
-                                    'value'       => wpinv_get_gateway_admin_label( $invoice->get_gateway( 'edit' ) ),
107
+                                    'value'       => wpinv_get_gateway_admin_label($invoice->get_gateway('edit')),
108 108
                                     'extra_attributes' => array(
109 109
                                         'onclick'  => 'this.select();',
110 110
                                         'readonly' => 'true',
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
                                     'type'        => 'text',
119 119
                                     'id'          => 'wpinv_transaction_id',
120 120
                                     'name'        => 'wpinv_transaction_id',
121
-                                    'label'       => __( 'Transaction ID:', 'invoicing' ),
121
+                                    'label'       => __('Transaction ID:', 'invoicing'),
122 122
                                     'label_type'  => 'vertical',
123 123
                                     'class'       => 'form-control-sm',
124
-                                    'value'       => $invoice->get_transaction_id( 'edit' ),
125
-                                    'help_text'   => apply_filters( 'wpinv_invoice_transaction_link_' . $invoice->get_gateway( 'edit' ), $invoice->get_transaction_id(), $invoice ),
124
+                                    'value'       => $invoice->get_transaction_id('edit'),
125
+                                    'help_text'   => apply_filters('wpinv_invoice_transaction_link_' . $invoice->get_gateway('edit'), $invoice->get_transaction_id(), $invoice),
126 126
                                     'extra_attributes' => array(
127 127
                                         'onclick'  => 'this.select();',
128 128
                                         'readonly' => 'true',
@@ -136,10 +136,10 @@  discard block
 block discarded – undo
136 136
                                     'type'        => 'text',
137 137
                                     'id'          => 'wpinv_currency',
138 138
                                     'name'        => 'wpinv_currency',
139
-                                    'label'       => __( 'Currency:', 'invoicing' ),
139
+                                    'label'       => __('Currency:', 'invoicing'),
140 140
                                     'label_type'  => 'vertical',
141 141
                                     'class'       => 'form-control-sm',
142
-                                    'value'       => $invoice->get_currency( 'edit' ),
142
+                                    'value'       => $invoice->get_currency('edit'),
143 143
                                     'extra_attributes' => array(
144 144
                                         'onclick'  => 'this.select();',
145 145
                                         'readonly' => 'true',
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
                                     'type'        => 'text',
156 156
                                     'id'          => 'wpinv_payment_url',
157 157
                                     'name'        => 'wpinv_payment_url',
158
-                                    'label'       => __( 'Payment URL:', 'invoicing' ),
158
+                                    'label'       => __('Payment URL:', 'invoicing'),
159 159
                                     'label_type'  => 'vertical',
160 160
                                     'class'       => 'form-control-sm',
161 161
                                     'value'       => $invoice->get_checkout_payment_url(),
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
                                 array(
172 172
                                     'id'               => 'wpinv_gateway',
173 173
                                     'name'             => 'wpinv_gateway',
174
-                                    'label'            => __( 'Gateway:', 'invoicing' ),
174
+                                    'label'            => __('Gateway:', 'invoicing'),
175 175
                                     'label_type'       => 'vertical',
176
-                                    'placeholder'      => __( 'Select Gateway', 'invoicing' ),
177
-                                    'value'            => $invoice->get_gateway( 'edit' ),
176
+                                    'placeholder'      => __('Select Gateway', 'invoicing'),
177
+                                    'value'            => $invoice->get_gateway('edit'),
178 178
                                     'select2'          => true,
179 179
                                     'data-allow-clear' => 'false',
180
-                                    'options'          => wp_list_pluck( wpinv_get_enabled_payment_gateways( true ), 'admin_label' ),
180
+                                    'options'          => wp_list_pluck(wpinv_get_enabled_payment_gateways(true), 'admin_label'),
181 181
                                 )
182 182
                             );
183 183
 
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-invoice-items.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  *
8 8
  */
9 9
 
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if (!defined('ABSPATH')) {
11 11
 	exit; // Exit if accessed directly
12 12
 }
13 13
 
@@ -21,16 +21,16 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @param WP_Post $post
23 23
 	 */
24
-    public static function output( $post ) {
24
+    public static function output($post) {
25 25
 
26 26
         // Prepare the invoice.
27
-        $invoice = new WPInv_Invoice( $post );
27
+        $invoice = new WPInv_Invoice($post);
28 28
 
29 29
         // Invoice items.
30 30
         $items = $invoice->get_items();
31 31
 
32 32
         // New item url.
33
-        $new_item = admin_url( 'post-new.php?post_type=wpi_item' );
33
+        $new_item = admin_url('post-new.php?post_type=wpi_item');
34 34
         ?>
35 35
 
36 36
         <style>
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
             }
46 46
         </style>
47 47
 
48
-                <div class="bsui getpaid-invoice-items-inner <?php echo sanitize_html_class( $invoice->get_template( 'edit' ) ); ?> <?php echo empty( $items ) ? 'no-items' : 'has-items'; ?>" style="margin-top: 1.5rem">
48
+                <div class="bsui getpaid-invoice-items-inner <?php echo sanitize_html_class($invoice->get_template('edit')); ?> <?php echo empty($items) ? 'no-items' : 'has-items'; ?>" style="margin-top: 1.5rem">
49 49
 
50
-                    <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?>
51
-                        <?php do_action( 'wpinv_meta_box_before_invoice_template_row', $invoice->get_id() ); ?>
50
+                    <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?>
51
+                        <?php do_action('wpinv_meta_box_before_invoice_template_row', $invoice->get_id()); ?>
52 52
 
53 53
                         <div class="row">
54 54
                             <div class="col-12 col-sm-6">
@@ -57,15 +57,15 @@  discard block
 block discarded – undo
57 57
                                         array(
58 58
                                             'id'          => 'wpinv_template',
59 59
                                             'name'        => 'wpinv_template',
60
-                                            'label'       => __( 'Template', 'invoicing' ),
60
+                                            'label'       => __('Template', 'invoicing'),
61 61
                                             'label_type'  => 'vertical',
62
-                                            'placeholder' => __( 'Choose a template', 'invoicing' ),
62
+                                            'placeholder' => __('Choose a template', 'invoicing'),
63 63
                                             'class'       => 'form-control-sm',
64
-                                            'value'       => $invoice->get_template( 'edit' ),
64
+                                            'value'       => $invoice->get_template('edit'),
65 65
                                             'options'     => array(
66
-                                                'quantity' => __( 'Quantity', 'invoicing' ),
67
-                                                'hours'    => __( 'Hours', 'invoicing' ),
68
-                                                'amount'   => __( 'Amount Only', 'invoicing' ),
66
+                                                'quantity' => __('Quantity', 'invoicing'),
67
+                                                'hours'    => __('Hours', 'invoicing'),
68
+                                                'amount'   => __('Amount Only', 'invoicing'),
69 69
                                             ),
70 70
                                             'data-allow-clear' => 'false',
71 71
                                             'select2'          => true,
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
                                         array(
82 82
                                             'id'          => 'wpinv_currency',
83 83
                                             'name'        => 'wpinv_currency',
84
-                                            'label'       => __( 'Currency', 'invoicing' ),
84
+                                            'label'       => __('Currency', 'invoicing'),
85 85
                                             'label_type'  => 'vertical',
86
-                                            'placeholder' => __( 'Select Invoice Currency', 'invoicing' ),
86
+                                            'placeholder' => __('Select Invoice Currency', 'invoicing'),
87 87
                                             'class'       => 'form-control-sm',
88
-                                            'value'       => $invoice->get_currency( 'edit' ),
88
+                                            'value'       => $invoice->get_currency('edit'),
89 89
                                             'required'    => false,
90 90
                                             'data-allow-clear' => 'false',
91 91
                                             'select2'          => true,
@@ -97,24 +97,24 @@  discard block
 block discarded – undo
97 97
                             </div>
98 98
                         </div>
99 99
 
100
-                        <?php do_action( 'wpinv_meta_box_invoice_template_row', $invoice->get_id() ); ?>
100
+                        <?php do_action('wpinv_meta_box_invoice_template_row', $invoice->get_id()); ?>
101 101
                     <?php endif; ?>
102 102
 
103 103
                     <table cellpadding="0" cellspacing="0" class="getpaid_invoice_items">
104 104
                         <thead>
105 105
                             <tr>
106
-                                <th class="getpaid-item" colspan="2"><?php _e( 'Item', 'invoicing' ) ?></th>
106
+                                <th class="getpaid-item" colspan="2"><?php _e('Item', 'invoicing') ?></th>
107 107
                                 <th class="getpaid-quantity hide-if-amount text-right">
108
-                                    <span class="getpaid-hide-if-hours"><?php _e( 'Quantity', 'invoicing' ) ?></span>
109
-                                    <span class="getpaid-hide-if-quantity"><?php _e( 'Hours', 'invoicing' ) ?></span>
108
+                                    <span class="getpaid-hide-if-hours"><?php _e('Quantity', 'invoicing') ?></span>
109
+                                    <span class="getpaid-hide-if-quantity"><?php _e('Hours', 'invoicing') ?></span>
110 110
                                 </th>
111 111
                                 <th class="getpaid-price hide-if-amount text-right">
112
-                                    <span class="getpaid-hide-if-hours"><?php _e( 'Price', 'invoicing' ) ?></span>
113
-                                    <span class="getpaid-hide-if-quantity"><?php _e( 'Rate', 'invoicing' ) ?></span>
112
+                                    <span class="getpaid-hide-if-hours"><?php _e('Price', 'invoicing') ?></span>
113
+                                    <span class="getpaid-hide-if-quantity"><?php _e('Rate', 'invoicing') ?></span>
114 114
                                 </th>
115 115
                                 <th class="getpaid-item-subtotal text-right">
116
-                                    <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php _e( 'Amount', 'invoicing' ) ?></span>
117
-                                    <span class="hide-if-amount"><?php _e( 'Total', 'invoicing' ) ?></span>
116
+                                    <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php _e('Amount', 'invoicing') ?></span>
117
+                                    <span class="hide-if-amount"><?php _e('Total', 'invoicing') ?></span>
118 118
                                 </th>
119 119
                                 <th class="getpaid-item-actions" width="70px">&nbsp;</th>
120 120
                             </tr>
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 		                <tbody class="getpaid_invoice_line_items">
123 123
                             <tr class="hide-if-has-items">
124 124
                                 <td colspan="2" class="pt-4 pb-4">
125
-                                    <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e( 'Add Existing Items', 'invoicing' ) ?></button>
126
-	                                <a href="<?php echo esc_url( $new_item ); ?>" target="_blank" class="button button-secondary"><?php _e( 'Create New Item', 'invoicing' ) ?></a>
125
+                                    <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e('Add Existing Items', 'invoicing') ?></button>
126
+	                                <a href="<?php echo esc_url($new_item); ?>" target="_blank" class="button button-secondary"><?php _e('Create New Item', 'invoicing') ?></a>
127 127
                                 </td>
128 128
                                 <td class="hide-if-amount">&nbsp;</th>
129 129
                                 <td class="hide-if-amount">&nbsp;</th>
@@ -154,12 +154,12 @@  discard block
 block discarded – undo
154 154
                     <div class="getpaid-invoice-item-actions hide-if-no-items">
155 155
                         <div class="row">
156 156
                             <div class="text-left col-12 col-sm-8">
157
-                                <button type="button" class="button add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e( 'Add Existing Item', 'invoicing' ) ?></button>
158
-                                <a href="<?php echo esc_url( $new_item ); ?>" target="_blank" class="button button-secondary"><?php _e( 'Create New Item', 'invoicing' ) ?></a>
159
-                                <?php do_action( 'getpaid-invoice-items-actions', $invoice ); ?>
157
+                                <button type="button" class="button add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e('Add Existing Item', 'invoicing') ?></button>
158
+                                <a href="<?php echo esc_url($new_item); ?>" target="_blank" class="button button-secondary"><?php _e('Create New Item', 'invoicing') ?></a>
159
+                                <?php do_action('getpaid-invoice-items-actions', $invoice); ?>
160 160
                             </div>
161 161
                             <div class="text-right col-12 col-sm-4">
162
-                                <button type="button" class="button button-primary recalculate-totals-button"><?php _e( 'Recalculate Totals', 'invoicing' ) ?></button>
162
+                                <button type="button" class="button button-primary recalculate-totals-button"><?php _e('Recalculate Totals', 'invoicing') ?></button>
163 163
                             </div>
164 164
                         </div>
165 165
                     </div>
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
                         <div class="modal-dialog modal-dialog-centered" role="document">
170 170
                             <div class="modal-content">
171 171
                                 <div class="modal-header">
172
-                                    <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php _e( "Add Item(s)", 'invoicing' ); ?></h5>
173
-                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e( "Close", 'invoicing' ); ?>">
172
+                                    <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php _e("Add Item(s)", 'invoicing'); ?></h5>
173
+                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e("Close", 'invoicing'); ?>">
174 174
                                         <span aria-hidden="true">&times;</span>
175 175
                                     </button>
176 176
                                 </div>
@@ -178,17 +178,17 @@  discard block
 block discarded – undo
178 178
                                     <table class="widefat">
179 179
                                         <thead>
180 180
                                             <tr>
181
-                                                <th class="pl-0 text-left"><?php _e( 'Item', 'invoicing' ) ?></th>
181
+                                                <th class="pl-0 text-left"><?php _e('Item', 'invoicing') ?></th>
182 182
                                                 <th class="pr-0 text-right">
183
-                                                    <span class="getpaid-hide-if-hours"><?php _e( 'Quantity', 'invoicing' ) ?></span>
184
-                                                    <span class="getpaid-hide-if-quantity"><?php _e( 'Hours', 'invoicing' ) ?></span>
183
+                                                    <span class="getpaid-hide-if-hours"><?php _e('Quantity', 'invoicing') ?></span>
184
+                                                    <span class="getpaid-hide-if-quantity"><?php _e('Hours', 'invoicing') ?></span>
185 185
                                                 </th>
186 186
                                             </tr>
187 187
                                         </thead>
188 188
 										<tbody>
189 189
 								            <tr>
190 190
 									            <td class="pl-0 text-left">
191
-                                                    <select class="getpaid-item-search regular-text" data-placeholder="<?php esc_attr_e( 'Search for an item…', 'invoicing' ); ?>"></select>
191
+                                                    <select class="getpaid-item-search regular-text" data-placeholder="<?php esc_attr_e('Search for an item…', 'invoicing'); ?>"></select>
192 192
                                                 </td>
193 193
 									            <td class="pr-0 text-right">
194 194
                                                     <input type="number" class="w100" step="1" min="1" autocomplete="off" value="1" placeholder="1">
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
 						            </table>
199 199
                                 </div>
200 200
                                 <div class="modal-footer">
201
-                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e( 'Cancel', 'invoicing' ); ?></button>
202
-                                    <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php _e( 'Add', 'invoicing' ); ?></button>
201
+                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e('Cancel', 'invoicing'); ?></button>
202
+                                    <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php _e('Add', 'invoicing'); ?></button>
203 203
                                 </div>
204 204
                             </div>
205 205
                         </div>
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
                         <div class="modal-dialog modal-dialog-centered" role="document">
211 211
                             <div class="modal-content">
212 212
                                 <div class="modal-header">
213
-                                    <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php _e( "Edit Item", 'invoicing' ); ?></h5>
214
-                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e( "Close", 'invoicing' ); ?>">
213
+                                    <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php _e("Edit Item", 'invoicing'); ?></h5>
214
+                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e("Close", 'invoicing'); ?>">
215 215
                                         <span aria-hidden="true">&times;</span>
216 216
                                     </button>
217 217
                                 </div>
@@ -219,26 +219,26 @@  discard block
 block discarded – undo
219 219
                                     <div class="getpaid-edit-item-div">
220 220
                                         <input type="hidden" name="id" class="form-control form-control-sm item-id">
221 221
                                         <label class="form-group w-100">
222
-                                            <span><?php _e( 'Name', 'invoicing' ); ?></span>
223
-                                            <input type="text" name="name" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="form-control form-control-sm item-name">
222
+                                            <span><?php _e('Name', 'invoicing'); ?></span>
223
+                                            <input type="text" name="name" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="form-control form-control-sm item-name">
224 224
                                         </label>
225 225
                                         <label class="form-group w-100">
226
-                                            <span><?php _e( 'Price', 'invoicing' ); ?></span>
227
-                                            <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount( 0 ); ?>" class="form-control form-control-sm item-price">
226
+                                            <span><?php _e('Price', 'invoicing'); ?></span>
227
+                                            <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount(0); ?>" class="form-control form-control-sm item-price">
228 228
                                         </label>
229 229
                                         <label class="form-group w-100">
230
-                                            <span><?php _e( 'Quantity', 'invoicing' ); ?></span>
230
+                                            <span><?php _e('Quantity', 'invoicing'); ?></span>
231 231
                                             <input type="number" name="quantity" placeholder="1" class="form-control form-control-sm item-quantity">
232 232
                                         </label>
233 233
                                         <label class="form-group w-100">
234
-                                            <span><?php _e( 'Item Description', 'invoicing' ); ?></span>
235
-                                            <textarea name="description" placeholder="<?php esc_attr_e( 'Enter a description for this item', 'invoicing' ); ?>" class="form-control item-description"></textarea>
234
+                                            <span><?php _e('Item Description', 'invoicing'); ?></span>
235
+                                            <textarea name="description" placeholder="<?php esc_attr_e('Enter a description for this item', 'invoicing'); ?>" class="form-control item-description"></textarea>
236 236
                                         </label>
237 237
                                     </div>
238 238
                                 </div>
239 239
                                 <div class="modal-footer">
240
-                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e( 'Cancel', 'invoicing' ); ?></button>
241
-                                    <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php _e( 'Save', 'invoicing' ); ?></button>
240
+                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e('Cancel', 'invoicing'); ?></button>
241
+                                    <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php _e('Save', 'invoicing'); ?></button>
242 242
                                 </div>
243 243
                             </div>
244 244
                         </div>
Please login to merge, or discard this patch.
includes/class-wpinv.php 1 patch
Spacing   +273 added lines, -273 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
7 7
  */
8 8
  
9 9
 // MUST have WordPress.
10
-if ( !defined( 'WPINC' ) ) {
11
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
10
+if (!defined('WPINC')) {
11
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
12 12
 }
13 13
 
14 14
 class WPInv_Plugin {
15 15
     private static $instance;
16 16
     
17 17
     public static function run() {
18
-        if ( !isset( self::$instance ) && !( self::$instance instanceof WPInv_Plugin ) ) {
18
+        if (!isset(self::$instance) && !(self::$instance instanceof WPInv_Plugin)) {
19 19
             self::$instance = new WPInv_Plugin;
20 20
             self::$instance->includes();
21 21
             self::$instance->actions();
@@ -33,35 +33,35 @@  discard block
 block discarded – undo
33 33
     }
34 34
     
35 35
     public function define_constants() {
36
-        define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) );
37
-        define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) );
36
+        define('WPINV_PLUGIN_DIR', plugin_dir_path(WPINV_PLUGIN_FILE));
37
+        define('WPINV_PLUGIN_URL', plugin_dir_url(WPINV_PLUGIN_FILE));
38 38
     }
39 39
 
40 40
     private function actions() {
41 41
         /* Internationalize the text strings used. */
42
-        add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) );
42
+        add_action('plugins_loaded', array(&$this, 'plugins_loaded'));
43 43
         
44 44
         /* Perform actions on admin initialization. */
45
-        add_action( 'admin_init', array( &$this, 'admin_init') );
46
-        add_action( 'init', array( &$this, 'init' ), 3 );
47
-        add_action( 'init', array( &$this, 'wpinv_actions' ) );
45
+        add_action('admin_init', array(&$this, 'admin_init'));
46
+        add_action('init', array(&$this, 'init'), 3);
47
+        add_action('init', array(&$this, 'wpinv_actions'));
48 48
         
49
-        if ( class_exists( 'BuddyPress' ) ) {
50
-            add_action( 'bp_include', array( &$this, 'bp_invoicing_init' ) );
49
+        if (class_exists('BuddyPress')) {
50
+            add_action('bp_include', array(&$this, 'bp_invoicing_init'));
51 51
         }
52 52
 
53
-        add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_scripts' ) );
54
-        add_action( 'wp_footer', array( &$this, 'wp_footer' ) );
55
-        add_action( 'widgets_init', array( &$this, 'register_widgets' ) );
56
-        add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', array( $this, 'wpseo_exclude_from_sitemap_by_post_ids' ) );
53
+        add_action('wp_enqueue_scripts', array(&$this, 'enqueue_scripts'));
54
+        add_action('wp_footer', array(&$this, 'wp_footer'));
55
+        add_action('widgets_init', array(&$this, 'register_widgets'));
56
+        add_filter('wpseo_exclude_from_sitemap_by_post_ids', array($this, 'wpseo_exclude_from_sitemap_by_post_ids'));
57 57
 
58
-        if ( is_admin() ) {
59
-            add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) );
60
-            add_filter( 'admin_body_class', array( &$this, 'admin_body_class' ) );
61
-            add_action( 'admin_init', array( &$this, 'init_ayecode_connect_helper' ) );
58
+        if (is_admin()) {
59
+            add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts'));
60
+            add_filter('admin_body_class', array(&$this, 'admin_body_class'));
61
+            add_action('admin_init', array(&$this, 'init_ayecode_connect_helper'));
62 62
 
63 63
         } else {
64
-            add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) );
64
+            add_filter('pre_get_posts', array(&$this, 'pre_get_posts'));
65 65
         }
66 66
         
67 67
         /**
@@ -71,28 +71,28 @@  discard block
 block discarded – undo
71 71
          *
72 72
          * @param WPInv_Plugin $this. Current WPInv_Plugin instance. Passed by reference.
73 73
          */
74
-        do_action_ref_array( 'wpinv_actions', array( &$this ) );
74
+        do_action_ref_array('wpinv_actions', array(&$this));
75 75
 
76
-        add_action( 'admin_init', array( &$this, 'activation_redirect') );
76
+        add_action('admin_init', array(&$this, 'activation_redirect'));
77 77
     }
78 78
 
79 79
     /**
80 80
      * Maybe show the AyeCode Connect Notice.
81 81
      */
82
-    public function init_ayecode_connect_helper(){
82
+    public function init_ayecode_connect_helper() {
83 83
         // AyeCode Connect notice
84
-        if ( is_admin() ){
84
+        if (is_admin()) {
85 85
             // set the strings so they can be translated
86 86
             $strings = array(
87
-                'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"),
88
-                'connect_external'  => __( "Please confirm you wish to connect your site?","invoicing" ),
89
-                'connect'           => sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s","invoicing" ),"<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>","</a>" ),
90
-                'connect_button'    => __("Connect Site","invoicing"),
91
-                'connecting_button'    => __("Connecting...","invoicing"),
92
-                'error_localhost'   => __( "This service will only work with a live domain, not a localhost.","invoicing" ),
93
-                'error'             => __( "Something went wrong, please refresh and try again.","invoicing" ),
87
+                'connect_title' => __("WP Invoicing - an AyeCode product!", "invoicing"),
88
+                'connect_external'  => __("Please confirm you wish to connect your site?", "invoicing"),
89
+                'connect'           => sprintf(__("<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s", "invoicing"), "<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>", "</a>"),
90
+                'connect_button'    => __("Connect Site", "invoicing"),
91
+                'connecting_button'    => __("Connecting...", "invoicing"),
92
+                'error_localhost'   => __("This service will only work with a live domain, not a localhost.", "invoicing"),
93
+                'error'             => __("Something went wrong, please refresh and try again.", "invoicing"),
94 94
             );
95
-            new AyeCode_Connect_Helper($strings,array('wpi-addons'));
95
+            new AyeCode_Connect_Helper($strings, array('wpi-addons'));
96 96
         }
97 97
     }
98 98
     
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
         /* Internationalize the text strings used. */
101 101
         $this->load_textdomain();
102 102
 
103
-        do_action( 'wpinv_loaded' );
103
+        do_action('wpinv_loaded');
104 104
 
105 105
         // Fix oxygen page builder conflict
106
-        if ( function_exists( 'ct_css_output' ) ) {
106
+        if (function_exists('ct_css_output')) {
107 107
             wpinv_oxygen_fix_conflict();
108 108
         }
109 109
     }
@@ -113,144 +113,144 @@  discard block
 block discarded – undo
113 113
      *
114 114
      * @since 1.0
115 115
      */
116
-    public function load_textdomain( $locale = NULL ) {
117
-        if ( empty( $locale ) ) {
118
-            $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
116
+    public function load_textdomain($locale = NULL) {
117
+        if (empty($locale)) {
118
+            $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
119 119
         }
120 120
 
121
-        $locale = apply_filters( 'plugin_locale', $locale, 'invoicing' );
121
+        $locale = apply_filters('plugin_locale', $locale, 'invoicing');
122 122
         
123
-        unload_textdomain( 'invoicing' );
124
-        load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' );
125
-        load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' );
123
+        unload_textdomain('invoicing');
124
+        load_textdomain('invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo');
125
+        load_plugin_textdomain('invoicing', false, WPINV_PLUGIN_DIR . 'languages');
126 126
         
127 127
         /**
128 128
          * Define language constants.
129 129
          */
130
-        require_once( WPINV_PLUGIN_DIR . 'language.php' );
130
+        require_once(WPINV_PLUGIN_DIR . 'language.php');
131 131
     }
132 132
 
133 133
     public function includes() {
134 134
         global $wpinv_options;
135 135
 
136
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' );
136
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php');
137 137
         $wpinv_options = wpinv_get_settings();
138 138
 
139 139
         // Load composer packages.
140
-        require_once( WPINV_PLUGIN_DIR . 'vendor/autoload.php' );
140
+        require_once(WPINV_PLUGIN_DIR . 'vendor/autoload.php');
141 141
 
142 142
         // load AUI
143
-        require_once( WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php' );
143
+        require_once(WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php');
144 144
 
145 145
         // Load the action scheduler.
146
-        require_once( WPINV_PLUGIN_DIR . 'includes/libraries/action-scheduler/action-scheduler.php' );
146
+        require_once(WPINV_PLUGIN_DIR . 'includes/libraries/action-scheduler/action-scheduler.php');
147 147
 
148 148
         // Load functions.
149
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' );
150
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' );
151
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' );
152
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' );
153
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' );
154
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' );
155
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php' );
156
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' );
157
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' );
158
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' );
159
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' );
160
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php' );
161
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php' );
149
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php');
150
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php');
151
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php');
152
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php');
153
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php');
154
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php');
155
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php');
156
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php');
157
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php');
158
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php');
159
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php');
160
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php');
161
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php');
162 162
 
163 163
         // Register autoloader.
164 164
 		try {
165
-			spl_autoload_register( array( $this, 'autoload' ), true );
166
-		} catch ( Exception $e ) {
167
-			wpinv_error_log( $e->getMessage(), '', __FILE__, 149, true );
168
-        }
169
-
170
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php' );
171
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php' );
172
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-discount.php' );
173
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php' );
174
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php' );
175
-        require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php' );
176
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php' );
177
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' );
178
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' );
179
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php' );
180
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' );
181
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' );
182
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' );
183
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' );
184
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions.php' );
185
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php' );
186
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-subscriptions-list-table.php' );
187
-        require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php' );
188
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' );
189
-        require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' );
190
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' );
191
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
192
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
193
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
194
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
195
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
196
-        require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' );
197
-        require_once( WPINV_PLUGIN_DIR . 'widgets/getpaid.php' );
198
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php' );
199
-
200
-        if ( !class_exists( 'WPInv_EUVat' ) ) {
201
-            require_once( WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php' );
165
+			spl_autoload_register(array($this, 'autoload'), true);
166
+		} catch (Exception $e) {
167
+			wpinv_error_log($e->getMessage(), '', __FILE__, 149, true);
168
+        }
169
+
170
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php');
171
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php');
172
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-discount.php');
173
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php');
174
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php');
175
+        require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php');
176
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php');
177
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php');
178
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php');
179
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php');
180
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php');
181
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php');
182
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php');
183
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php');
184
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions.php');
185
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php');
186
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-subscriptions-list-table.php');
187
+        require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php');
188
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php');
189
+        require_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php');
190
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php');
191
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/checkout.php');
192
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-history.php');
193
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php');
194
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php');
195
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/subscriptions.php');
196
+        require_once(WPINV_PLUGIN_DIR . 'widgets/buy-item.php');
197
+        require_once(WPINV_PLUGIN_DIR . 'widgets/getpaid.php');
198
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php');
199
+
200
+        if (!class_exists('WPInv_EUVat')) {
201
+            require_once(WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php');
202 202
         }
203 203
         
204
-        $gateways = array_keys( wpinv_get_enabled_payment_gateways() );
205
-        if ( !empty( $gateways ) ) {
206
-            foreach ( $gateways as $gateway ) {
207
-                if ( $gateway == 'manual' ) {
204
+        $gateways = array_keys(wpinv_get_enabled_payment_gateways());
205
+        if (!empty($gateways)) {
206
+            foreach ($gateways as $gateway) {
207
+                if ($gateway == 'manual') {
208 208
                     continue;
209 209
                 }
210 210
                 
211 211
                 $gateway_file = WPINV_PLUGIN_DIR . 'includes/gateways/' . $gateway . '.php';
212 212
                 
213
-                if ( file_exists( $gateway_file ) ) {
214
-                    require_once( $gateway_file );
213
+                if (file_exists($gateway_file)) {
214
+                    require_once($gateway_file);
215 215
                 }
216 216
             }
217 217
         }
218
-        require_once( WPINV_PLUGIN_DIR . 'includes/gateways/manual.php' );
218
+        require_once(WPINV_PLUGIN_DIR . 'includes/gateways/manual.php');
219 219
         
220
-        if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
221
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php' );
222
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' );
223
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php' );
220
+        if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
221
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php');
222
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php');
223
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php');
224 224
             //require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-recurring-admin.php' );
225
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php' );
226
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php' );
227
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php' );
228
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' );
229
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php' );
230
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' );
231
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php' );
232
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php' );
233
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php' );
225
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php');
226
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php');
227
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php');
228
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php');
229
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php');
230
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php');
231
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php');
232
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php');
233
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php');
234 234
             //require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' );
235 235
             // load the user class only on the users.php page
236 236
             global $pagenow;
237
-            if($pagenow=='users.php'){
237
+            if ($pagenow == 'users.php') {
238 238
                 new WPInv_Admin_Users();
239 239
             }
240 240
         }
241 241
 
242 242
         // Register cli commands
243
-        if ( defined( 'WP_CLI' ) && WP_CLI ) {
244
-            require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php' );
245
-            WP_CLI::add_command( 'invoicing', 'WPInv_CLI' );
243
+        if (defined('WP_CLI') && WP_CLI) {
244
+            require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php');
245
+            WP_CLI::add_command('invoicing', 'WPInv_CLI');
246 246
         }
247 247
         
248 248
         // include css inliner
249
-        if ( ! class_exists( 'Emogrifier' ) && class_exists( 'DOMDocument' ) ) {
250
-            include_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php' );
249
+        if (!class_exists('Emogrifier') && class_exists('DOMDocument')) {
250
+            include_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php');
251 251
         }
252 252
         
253
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/install.php' );
253
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/install.php');
254 254
     }
255 255
 
256 256
     /**
@@ -261,18 +261,18 @@  discard block
 block discarded – undo
261 261
 	 * @since       1.0.19
262 262
 	 * @return      void
263 263
 	 */
264
-	public function autoload( $class_name ) {
264
+	public function autoload($class_name) {
265 265
 
266 266
 		// Normalize the class name...
267
-		$class_name  = strtolower( $class_name );
267
+		$class_name = strtolower($class_name);
268 268
 
269 269
 		// ... and make sure it is our class.
270
-		if ( false === strpos( $class_name, 'getpaid_' ) && false === strpos( $class_name, 'wpinv_' ) ) {
270
+		if (false === strpos($class_name, 'getpaid_') && false === strpos($class_name, 'wpinv_')) {
271 271
 			return;
272 272
 		}
273 273
 
274 274
 		// Next, prepare the file name from the class.
275
-		$file_name = 'class-' . str_replace( '_', '-', $class_name ) . '.php';
275
+		$file_name = 'class-' . str_replace('_', '-', $class_name) . '.php';
276 276
 
277 277
 		// And an array of possible locations in order of importance.
278 278
 		$locations = array(
@@ -283,11 +283,11 @@  discard block
 block discarded – undo
283 283
 		);
284 284
 
285 285
 		// Base path of the classes.
286
-		$plugin_path = untrailingslashit( WPINV_PLUGIN_DIR );
286
+		$plugin_path = untrailingslashit(WPINV_PLUGIN_DIR);
287 287
 
288
-		foreach ( $locations as $location ) {
288
+		foreach ($locations as $location) {
289 289
 
290
-			if ( file_exists( "$plugin_path/$location/$file_name" ) ) {
290
+			if (file_exists("$plugin_path/$location/$file_name")) {
291 291
 				include "$plugin_path/$location/$file_name";
292 292
 				break;
293 293
 			}
@@ -301,117 +301,117 @@  discard block
 block discarded – undo
301 301
     
302 302
     public function admin_init() {
303 303
         self::$instance->default_payment_form = wpinv_get_default_payment_form();
304
-        add_action( 'admin_print_scripts-edit.php', array( &$this, 'admin_print_scripts_edit_php' ) );
304
+        add_action('admin_print_scripts-edit.php', array(&$this, 'admin_print_scripts_edit_php'));
305 305
     }
306 306
 
307 307
     public function activation_redirect() {
308 308
         // Bail if no activation redirect
309
-        if ( !get_transient( '_wpinv_activation_redirect' ) ) {
309
+        if (!get_transient('_wpinv_activation_redirect')) {
310 310
             return;
311 311
         }
312 312
 
313 313
         // Delete the redirect transient
314
-        delete_transient( '_wpinv_activation_redirect' );
314
+        delete_transient('_wpinv_activation_redirect');
315 315
 
316 316
         // Bail if activating from network, or bulk
317
-        if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
317
+        if (is_network_admin() || isset($_GET['activate-multi'])) {
318 318
             return;
319 319
         }
320 320
 
321
-        wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) );
321
+        wp_safe_redirect(admin_url('admin.php?page=wpinv-settings&tab=general'));
322 322
         exit;
323 323
     }
324 324
     
325 325
     public function enqueue_scripts() {
326
-        $suffix       = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
326
+        $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
327 327
         
328
-        $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/invoice-front.css' );
329
-        wp_register_style( 'wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), $version );
330
-        wp_enqueue_style( 'wpinv_front_style' );
328
+        $version = filemtime(WPINV_PLUGIN_DIR . 'assets/css/invoice-front.css');
329
+        wp_register_style('wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), $version);
330
+        wp_enqueue_style('wpinv_front_style');
331 331
                
332 332
         // Register scripts
333
-        wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true );
334
-        wp_register_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front.js', array( 'jquery' ),  filemtime( WPINV_PLUGIN_DIR . 'assets/js/invoice-front.js' ) );
333
+        wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true);
334
+        wp_register_script('wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front.js', array('jquery'), filemtime(WPINV_PLUGIN_DIR . 'assets/js/invoice-front.js'));
335 335
 
336 336
         $localize                         = array();
337
-        $localize['ajax_url']             = admin_url( 'admin-ajax.php' );
338
-        $localize['nonce']                = wp_create_nonce( 'wpinv-nonce' );
337
+        $localize['ajax_url']             = admin_url('admin-ajax.php');
338
+        $localize['nonce']                = wp_create_nonce('wpinv-nonce');
339 339
         $localize['currency_symbol']      = wpinv_currency_symbol();
340 340
         $localize['currency_pos']         = wpinv_currency_position();
341 341
         $localize['thousand_sep']         = wpinv_thousands_separator();
342 342
         $localize['decimal_sep']          = wpinv_decimal_separator();
343 343
         $localize['decimals']             = wpinv_decimals();
344
-        $localize['txtComplete']          = __( 'Continue', 'invoicing' );
344
+        $localize['txtComplete']          = __('Continue', 'invoicing');
345 345
         $localize['UseTaxes']             = wpinv_use_taxes();
346
-        $localize['checkoutNonce']        = wp_create_nonce( 'wpinv_checkout_nonce' );
347
-        $localize['formNonce']            = wp_create_nonce( 'getpaid_form_nonce' );
348
-        $localize['connectionError']      = __( 'Could not establish a connection to the server.', 'invoicing' );
346
+        $localize['checkoutNonce']        = wp_create_nonce('wpinv_checkout_nonce');
347
+        $localize['formNonce']            = wp_create_nonce('getpaid_form_nonce');
348
+        $localize['connectionError']      = __('Could not establish a connection to the server.', 'invoicing');
349 349
 
350
-        $localize = apply_filters( 'wpinv_front_js_localize', $localize );
350
+        $localize = apply_filters('wpinv_front_js_localize', $localize);
351 351
         
352
-        wp_enqueue_script( 'jquery-blockui' );
352
+        wp_enqueue_script('jquery-blockui');
353 353
         $autofill_api = wpinv_get_option('address_autofill_api');
354 354
         $autofill_active = wpinv_get_option('address_autofill_active');
355
-        if ( isset( $autofill_active ) && 1 == $autofill_active && !empty( $autofill_api ) && wpinv_is_checkout() ) {
356
-            if ( wp_script_is( 'google-maps-api', 'enqueued' ) ) {
357
-                wp_dequeue_script( 'google-maps-api' );
355
+        if (isset($autofill_active) && 1 == $autofill_active && !empty($autofill_api) && wpinv_is_checkout()) {
356
+            if (wp_script_is('google-maps-api', 'enqueued')) {
357
+                wp_dequeue_script('google-maps-api');
358 358
             }
359
-            wp_enqueue_script( 'google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array( 'jquery' ), '', false );
360
-            wp_enqueue_script( 'google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array( 'jquery', 'google-maps-api' ), '', true );
359
+            wp_enqueue_script('google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array('jquery'), '', false);
360
+            wp_enqueue_script('google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array('jquery', 'google-maps-api'), '', true);
361 361
         }
362 362
 
363
-        wp_enqueue_style( "select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all' );
364
-        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), WPINV_VERSION );
363
+        wp_enqueue_style("select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all');
364
+        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array('jquery'), WPINV_VERSION);
365 365
 
366
-        wp_enqueue_script( 'wpinv-front-script' );
367
-        wp_localize_script( 'wpinv-front-script', 'WPInv', $localize );
366
+        wp_enqueue_script('wpinv-front-script');
367
+        wp_localize_script('wpinv-front-script', 'WPInv', $localize);
368 368
 
369
-        $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js' );
370
-        wp_enqueue_script( 'wpinv-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array( 'wpinv-front-script', 'wp-hooks' ),  $version, true );
369
+        $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js');
370
+        wp_enqueue_script('wpinv-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array('wpinv-front-script', 'wp-hooks'), $version, true);
371 371
     }
372 372
 
373
-    public function admin_enqueue_scripts( $hook ) {
373
+    public function admin_enqueue_scripts($hook) {
374 374
         global $post, $pagenow;
375 375
         
376 376
         $post_type  = wpinv_admin_post_type();
377
-        $suffix     = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
378
-        $page       = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : '';
377
+        $suffix     = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
378
+        $page       = isset($_GET['page']) ? strtolower($_GET['page']) : '';
379 379
 
380 380
         $jquery_ui_css = false;
381
-        if ( ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $post_type == 'wpi_discount' ) && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) ) {
381
+        if (($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $post_type == 'wpi_discount') && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
382 382
             $jquery_ui_css = true;
383
-        } else if ( $page == 'wpinv-settings' || $page == 'wpinv-reports' ) {
383
+        } else if ($page == 'wpinv-settings' || $page == 'wpinv-reports') {
384 384
             $jquery_ui_css = true;
385 385
         }
386
-        if ( $jquery_ui_css ) {
387
-            wp_register_style( 'jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16' );
388
-            wp_enqueue_style( 'jquery-ui-css' );
389
-            wp_deregister_style( 'yoast-seo-select2' );
390
-	        wp_deregister_style( 'yoast-seo-monorepo' );
386
+        if ($jquery_ui_css) {
387
+            wp_register_style('jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16');
388
+            wp_enqueue_style('jquery-ui-css');
389
+            wp_deregister_style('yoast-seo-select2');
390
+	        wp_deregister_style('yoast-seo-monorepo');
391 391
         }
392 392
 
393
-        wp_register_style( 'wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION );
394
-        wp_enqueue_style( 'wpinv_meta_box_style' );
393
+        wp_register_style('wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION);
394
+        wp_enqueue_style('wpinv_meta_box_style');
395 395
         
396
-        $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/admin.css' );
397
-        wp_register_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), $version );
398
-        wp_enqueue_style( 'wpinv_admin_style' );
396
+        $version = filemtime(WPINV_PLUGIN_DIR . 'assets/css/admin.css');
397
+        wp_register_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), $version);
398
+        wp_enqueue_style('wpinv_admin_style');
399 399
 
400
-        $enqueue = ( $post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) );
401
-        if ( $page == 'wpinv-subscriptions' ) {
402
-            wp_enqueue_script( 'jquery-ui-datepicker' );
403
-            wp_deregister_style( 'yoast-seo-select2' );
404
-	        wp_deregister_style( 'yoast-seo-monorepo' );
400
+        $enqueue = ($post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ($pagenow == 'post-new.php' || $pagenow == 'post.php'));
401
+        if ($page == 'wpinv-subscriptions') {
402
+            wp_enqueue_script('jquery-ui-datepicker');
403
+            wp_deregister_style('yoast-seo-select2');
404
+	        wp_deregister_style('yoast-seo-monorepo');
405 405
         }
406 406
         
407
-        if ( $enqueue_datepicker = apply_filters( 'wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue ) ) {
408
-            wp_enqueue_script( 'jquery-ui-datepicker' );
407
+        if ($enqueue_datepicker = apply_filters('wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue)) {
408
+            wp_enqueue_script('jquery-ui-datepicker');
409 409
         }
410 410
 
411
-        wp_enqueue_style( 'wp-color-picker' );
412
-        wp_enqueue_script( 'wp-color-picker' );
411
+        wp_enqueue_style('wp-color-picker');
412
+        wp_enqueue_script('wp-color-picker');
413 413
         
414
-        wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true );
414
+        wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true);
415 415
 
416 416
         if (($post_type == 'wpi_invoice' || $post_type == 'wpi_quote') && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
417 417
             $autofill_api = wpinv_get_option('address_autofill_api');
@@ -422,21 +422,21 @@  discard block
 block discarded – undo
422 422
             }
423 423
         }
424 424
 
425
-        wp_enqueue_style( "select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all' );
426
-        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), WPINV_VERSION );
425
+        wp_enqueue_style("select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all');
426
+        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array('jquery'), WPINV_VERSION);
427 427
 
428
-        $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin.js' );
429
-        wp_register_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array( 'jquery', 'jquery-blockui','jquery-ui-tooltip' ),  $version );
430
-        wp_enqueue_script( 'wpinv-admin-script' );
428
+        $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin.js');
429
+        wp_register_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array('jquery', 'jquery-blockui', 'jquery-ui-tooltip'), $version);
430
+        wp_enqueue_script('wpinv-admin-script');
431 431
         
432 432
         $localize                               = array();
433
-        $localize['ajax_url']                   = admin_url( 'admin-ajax.php' );
434
-        $localize['post_ID']                    = isset( $post->ID ) ? $post->ID : '';
435
-        $localize['wpinv_nonce']                = wp_create_nonce( 'wpinv-nonce' );
436
-        $localize['add_invoice_note_nonce']     = wp_create_nonce( 'add-invoice-note' );
437
-        $localize['delete_invoice_note_nonce']  = wp_create_nonce( 'delete-invoice-note' );
438
-        $localize['invoice_item_nonce']         = wp_create_nonce( 'invoice-item' );
439
-        $localize['billing_details_nonce']      = wp_create_nonce( 'get-billing-details' );
433
+        $localize['ajax_url']                   = admin_url('admin-ajax.php');
434
+        $localize['post_ID']                    = isset($post->ID) ? $post->ID : '';
435
+        $localize['wpinv_nonce']                = wp_create_nonce('wpinv-nonce');
436
+        $localize['add_invoice_note_nonce']     = wp_create_nonce('add-invoice-note');
437
+        $localize['delete_invoice_note_nonce']  = wp_create_nonce('delete-invoice-note');
438
+        $localize['invoice_item_nonce']         = wp_create_nonce('invoice-item');
439
+        $localize['billing_details_nonce']      = wp_create_nonce('get-billing-details');
440 440
         $localize['tax']                        = wpinv_tax_amount();
441 441
         $localize['discount']                   = wpinv_discount_amount();
442 442
         $localize['currency_symbol']            = wpinv_currency_symbol();
@@ -444,104 +444,104 @@  discard block
 block discarded – undo
444 444
         $localize['thousand_sep']               = wpinv_thousands_separator();
445 445
         $localize['decimal_sep']                = wpinv_decimal_separator();
446 446
         $localize['decimals']                   = wpinv_decimals();
447
-        $localize['save_invoice']               = __( 'Save Invoice', 'invoicing' );
448
-        $localize['status_publish']             = wpinv_status_nicename( 'publish' );
449
-        $localize['status_pending']             = wpinv_status_nicename( 'wpi-pending' );
450
-        $localize['delete_tax_rate']            = __( 'Are you sure you wish to delete this tax rate?', 'invoicing' );
451
-        $localize['OneItemMin']                 = __( 'Invoice must contain at least one item', 'invoicing' );
452
-        $localize['DeleteInvoiceItem']          = __( 'Are you sure you wish to delete this item?', 'invoicing' );
453
-        $localize['FillBillingDetails']         = __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' );
454
-        $localize['confirmCalcTotals']          = __( 'Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing' );
455
-        $localize['AreYouSure']                 = __( 'Are you sure?', 'invoicing' );
456
-        $localize['emptyInvoice']               = __( 'Add at least one item to save invoice!', 'invoicing' );
457
-        $localize['errDeleteItem']              = __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' );
458
-        $localize['delete_subscription']        = __( 'Are you sure you want to delete this subscription?', 'invoicing' );
459
-        $localize['action_edit']                = __( 'Edit', 'invoicing' );
460
-        $localize['action_cancel']              = __( 'Cancel', 'invoicing' );
461
-        $localize['item_description']           = __( 'Item Description', 'invoicing' );
462
-        $localize['discount_description']       = __( 'Discount Description', 'invoicing' );
463
-        $localize['invoice_description']        = __( 'Invoice Description', 'invoicing' );
464
-        $localize['searching']                  = __( 'Searching', 'invoicing' );
465
-
466
-        $localize = apply_filters( 'wpinv_admin_js_localize', $localize );
467
-
468
-        wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', $localize );
447
+        $localize['save_invoice']               = __('Save Invoice', 'invoicing');
448
+        $localize['status_publish']             = wpinv_status_nicename('publish');
449
+        $localize['status_pending']             = wpinv_status_nicename('wpi-pending');
450
+        $localize['delete_tax_rate']            = __('Are you sure you wish to delete this tax rate?', 'invoicing');
451
+        $localize['OneItemMin']                 = __('Invoice must contain at least one item', 'invoicing');
452
+        $localize['DeleteInvoiceItem']          = __('Are you sure you wish to delete this item?', 'invoicing');
453
+        $localize['FillBillingDetails']         = __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing');
454
+        $localize['confirmCalcTotals']          = __('Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing');
455
+        $localize['AreYouSure']                 = __('Are you sure?', 'invoicing');
456
+        $localize['emptyInvoice']               = __('Add at least one item to save invoice!', 'invoicing');
457
+        $localize['errDeleteItem']              = __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing');
458
+        $localize['delete_subscription']        = __('Are you sure you want to delete this subscription?', 'invoicing');
459
+        $localize['action_edit']                = __('Edit', 'invoicing');
460
+        $localize['action_cancel']              = __('Cancel', 'invoicing');
461
+        $localize['item_description']           = __('Item Description', 'invoicing');
462
+        $localize['discount_description']       = __('Discount Description', 'invoicing');
463
+        $localize['invoice_description']        = __('Invoice Description', 'invoicing');
464
+        $localize['searching']                  = __('Searching', 'invoicing');
465
+
466
+        $localize = apply_filters('wpinv_admin_js_localize', $localize);
467
+
468
+        wp_localize_script('wpinv-admin-script', 'WPInv_Admin', $localize);
469 469
 
470 470
         // Load payment form scripts on our admin pages only.
471
-        if ( ( $hook == 'post-new.php' || $hook == 'post.php' ) && 'wpi_payment_form' === $post->post_type ) {
471
+        if (($hook == 'post-new.php' || $hook == 'post.php') && 'wpi_payment_form' === $post->post_type) {
472 472
 
473
-            wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION );
474
-            wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION );
475
-            wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION );
473
+            wp_enqueue_script('vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION);
474
+            wp_enqueue_script('sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION);
475
+            wp_enqueue_script('vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array('sortable', 'vue'), WPINV_VERSION);
476 476
 
477
-            $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' );
478
-            wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ),  $version );
477
+            $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js');
478
+            wp_register_script('wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array('wpinv-admin-script', 'vue_draggable'), $version);
479 479
         
480
-            wp_localize_script( 'wpinv-admin-payment-form-script', 'wpinvPaymentFormAdmin', array(
480
+            wp_localize_script('wpinv-admin-payment-form-script', 'wpinvPaymentFormAdmin', array(
481 481
                 'elements'      => $this->form_elements->get_elements(),
482
-                'form_elements' => $this->form_elements->get_form_elements( $post->ID ),
482
+                'form_elements' => $this->form_elements->get_form_elements($post->ID),
483 483
                 'all_items'     => $this->form_elements->get_published_items(),
484 484
                 'currency'      => wpinv_currency_symbol(),
485 485
                 'position'      => wpinv_currency_position(),
486 486
                 'decimals'      => (int) wpinv_decimals(),
487 487
                 'thousands_sep' => wpinv_thousands_separator(),
488 488
                 'decimals_sep'  => wpinv_decimal_separator(),
489
-                'form_items'    => $this->form_elements->get_form_items( $post->ID ),
489
+                'form_items'    => $this->form_elements->get_form_items($post->ID),
490 490
                 'is_default'    => $post->ID == $this->default_payment_form,
491
-            ) );
491
+            ));
492 492
 
493
-            wp_enqueue_script( 'wpinv-admin-payment-form-script' );
493
+            wp_enqueue_script('wpinv-admin-payment-form-script');
494 494
         }
495 495
 
496
-        if ( $page == 'wpinv-subscriptions' ) {
497
-            wp_register_script( 'wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions.js', array( 'wpinv-admin-script' ),  WPINV_VERSION );
498
-            wp_enqueue_script( 'wpinv-sub-admin-script' );
496
+        if ($page == 'wpinv-subscriptions') {
497
+            wp_register_script('wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions.js', array('wpinv-admin-script'), WPINV_VERSION);
498
+            wp_enqueue_script('wpinv-sub-admin-script');
499 499
         }
500 500
 
501
-        if ( $page == 'wpinv-reports' ) {
502
-            wp_enqueue_script( 'jquery-flot', WPINV_PLUGIN_URL . 'assets/js/jquery.flot.min.js', array( 'jquery' ), '0.7' );
501
+        if ($page == 'wpinv-reports') {
502
+            wp_enqueue_script('jquery-flot', WPINV_PLUGIN_URL . 'assets/js/jquery.flot.min.js', array('jquery'), '0.7');
503 503
         }
504 504
 
505 505
     }
506 506
 
507
-    public function admin_body_class( $classes ) {
507
+    public function admin_body_class($classes) {
508 508
         global $pagenow, $post, $current_screen;
509 509
         
510
-        if ( !empty( $current_screen->post_type ) && ( $current_screen->post_type == 'wpi_invoice' || $current_screen->post_type == 'wpi_payment_form' || $current_screen->post_type == 'wpi_quote' ) ) {
510
+        if (!empty($current_screen->post_type) && ($current_screen->post_type == 'wpi_invoice' || $current_screen->post_type == 'wpi_payment_form' || $current_screen->post_type == 'wpi_quote')) {
511 511
             $classes .= ' wpinv-cpt';
512 512
         }
513 513
         
514
-        $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false;
514
+        $page = isset($_GET['page']) ? strtolower($_GET['page']) : false;
515 515
 
516
-        $add_class = $page && $pagenow == 'admin.php' && strpos( $page, 'wpinv-' ) === 0 ? true : false;
517
-        if ( $add_class ) {
518
-            $classes .= ' wpi-' . wpinv_sanitize_key( $page );
516
+        $add_class = $page && $pagenow == 'admin.php' && strpos($page, 'wpinv-') === 0 ? true : false;
517
+        if ($add_class) {
518
+            $classes .= ' wpi-' . wpinv_sanitize_key($page);
519 519
         }
520 520
         
521 521
         $settings_class = array();
522
-        if ( $page == 'wpinv-settings' ) {
523
-            if ( !empty( $_REQUEST['tab'] ) ) {
524
-                $settings_class[] = sanitize_text_field( $_REQUEST['tab'] );
522
+        if ($page == 'wpinv-settings') {
523
+            if (!empty($_REQUEST['tab'])) {
524
+                $settings_class[] = sanitize_text_field($_REQUEST['tab']);
525 525
             }
526 526
             
527
-            if ( !empty( $_REQUEST['section'] ) ) {
528
-                $settings_class[] = sanitize_text_field( $_REQUEST['section'] );
527
+            if (!empty($_REQUEST['section'])) {
528
+                $settings_class[] = sanitize_text_field($_REQUEST['section']);
529 529
             }
530 530
             
531
-            $settings_class[] = isset( $_REQUEST['wpi_sub'] ) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field( $_REQUEST['wpi_sub'] ) : 'main';
531
+            $settings_class[] = isset($_REQUEST['wpi_sub']) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field($_REQUEST['wpi_sub']) : 'main';
532 532
         }
533 533
         
534
-        if ( !empty( $settings_class ) ) {
535
-            $classes .= ' wpi-' . wpinv_sanitize_key( implode( $settings_class, '-' ) );
534
+        if (!empty($settings_class)) {
535
+            $classes .= ' wpi-' . wpinv_sanitize_key(implode($settings_class, '-'));
536 536
         }
537 537
         
538 538
         $post_type = wpinv_admin_post_type();
539 539
 
540
-        if ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false ) {
540
+        if ($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false) {
541 541
             return $classes .= ' wpinv';
542 542
         }
543 543
         
544
-        if ( $pagenow == 'post.php' && $post_type == 'wpi_item' && !empty( $post ) && !wpinv_item_is_editable( $post ) ) {
544
+        if ($pagenow == 'post.php' && $post_type == 'wpi_item' && !empty($post) && !wpinv_item_is_editable($post)) {
545 545
             $classes .= ' wpi-editable-n';
546 546
         }
547 547
 
@@ -553,21 +553,21 @@  discard block
 block discarded – undo
553 553
     }
554 554
     
555 555
     public function wpinv_actions() {
556
-        if ( isset( $_REQUEST['wpi_action'] ) ) {
557
-            do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST );
556
+        if (isset($_REQUEST['wpi_action'])) {
557
+            do_action('wpinv_' . wpinv_sanitize_key($_REQUEST['wpi_action']), $_REQUEST);
558 558
         }
559 559
     }
560 560
     
561
-    public function pre_get_posts( $wp_query ) {
562
-        if ( !empty( $wp_query->query_vars['post_type'] ) && $wp_query->query_vars['post_type'] == 'wpi_invoice' && is_user_logged_in() && is_single() && $wp_query->is_main_query() ) {
563
-            $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses() );
561
+    public function pre_get_posts($wp_query) {
562
+        if (!empty($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == 'wpi_invoice' && is_user_logged_in() && is_single() && $wp_query->is_main_query()) {
563
+            $wp_query->query_vars['post_status'] = array_keys(wpinv_get_invoice_statuses());
564 564
         }
565 565
         
566 566
         return $wp_query;
567 567
     }
568 568
     
569 569
     public function bp_invoicing_init() {
570
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' );
570
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php');
571 571
     }
572 572
 
573 573
 	/**
@@ -575,13 +575,13 @@  discard block
 block discarded – undo
575 575
 	 *
576 576
 	 */
577 577
 	public function register_widgets() {
578
-		register_widget( "WPInv_Checkout_Widget" );
579
-		register_widget( "WPInv_History_Widget" );
580
-		register_widget( "WPInv_Receipt_Widget" );
581
-		register_widget( "WPInv_Subscriptions_Widget" );
582
-		register_widget( "WPInv_Buy_Item_Widget" );
583
-        register_widget( "WPInv_Messages_Widget" );
584
-        register_widget( 'WPInv_GetPaid_Widget' );
578
+		register_widget("WPInv_Checkout_Widget");
579
+		register_widget("WPInv_History_Widget");
580
+		register_widget("WPInv_Receipt_Widget");
581
+		register_widget("WPInv_Subscriptions_Widget");
582
+		register_widget("WPInv_Buy_Item_Widget");
583
+        register_widget("WPInv_Messages_Widget");
584
+        register_widget('WPInv_GetPaid_Widget');
585 585
 	}
586 586
     
587 587
     /**
@@ -590,10 +590,10 @@  discard block
 block discarded – undo
590 590
      * @since 1.0.19
591 591
      * @param int[] $excluded_posts_ids
592 592
      */
593
-    public function wpseo_exclude_from_sitemap_by_post_ids( $excluded_posts_ids ){
593
+    public function wpseo_exclude_from_sitemap_by_post_ids($excluded_posts_ids) {
594 594
 
595 595
         // Ensure that we have an array.
596
-        if ( ! is_array( $excluded_posts_ids ) ) {
596
+        if (!is_array($excluded_posts_ids)) {
597 597
             $excluded_posts_ids = array();
598 598
         }
599 599
 
@@ -601,24 +601,24 @@  discard block
 block discarded – undo
601 601
         $our_pages = array();
602 602
     
603 603
         // Checkout page.
604
-        $our_pages[] = wpinv_get_option( 'checkout_page', false );
604
+        $our_pages[] = wpinv_get_option('checkout_page', false);
605 605
 
606 606
         // Success page.
607
-        $our_pages[] = wpinv_get_option( 'success_page', false );
607
+        $our_pages[] = wpinv_get_option('success_page', false);
608 608
 
609 609
         // Failure page.
610
-        $our_pages[] = wpinv_get_option( 'failure_page', false );
610
+        $our_pages[] = wpinv_get_option('failure_page', false);
611 611
 
612 612
         // History page.
613
-        $our_pages[] = wpinv_get_option( 'invoice_history_page', false );
613
+        $our_pages[] = wpinv_get_option('invoice_history_page', false);
614 614
 
615 615
         // Subscriptions page.
616
-        $our_pages[] = wpinv_get_option( 'invoice_subscription_page', false );
616
+        $our_pages[] = wpinv_get_option('invoice_subscription_page', false);
617 617
 
618
-        $our_pages   = array_map( 'intval', array_filter( $our_pages ) );
618
+        $our_pages   = array_map('intval', array_filter($our_pages));
619 619
 
620 620
         $excluded_posts_ids = $excluded_posts_ids + $our_pages;
621
-        return array_unique( $excluded_posts_ids );
621
+        return array_unique($excluded_posts_ids);
622 622
 
623 623
     }
624 624
 
Please login to merge, or discard this patch.
includes/class-getpaid-form-item.php 2 patches
Indentation   +293 added lines, -293 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined( 'ABSPATH' ) ) {
3
-	exit;
3
+    exit;
4 4
 }
5 5
 
6 6
 /**
@@ -10,53 +10,53 @@  discard block
 block discarded – undo
10 10
 class GetPaid_Form_Item  extends WPInv_Item {
11 11
 
12 12
     /**
13
-	 * Stores a custom description for the item.
14
-	 *
15
-	 * @var string
16
-	 */
17
-	protected $custom_description = '';
18
-
19
-	/**
20
-	 * Stores the item quantity.
21
-	 *
22
-	 * @var int
23
-	 */
24
-	protected $quantity = 1;
25
-
26
-	/**
27
-	 * Is this item required?
28
-	 *
29
-	 * @var int
30
-	 */
31
-	protected $is_required = true;
32
-
33
-	/**
34
-	 * Are quantities allowed?
35
-	 *
36
-	 * @var int
37
-	 */
38
-	protected $allow_quantities = false;
39
-
40
-	/**
41
-	 * Associated invoice.
42
-	 *
43
-	 * @var int
44
-	 */
45
-	public $invoice_id = 0;
46
-
47
-	/**
48
-	 * Item discount.
49
-	 *
50
-	 * @var float
51
-	 */
52
-	public $item_discount = 0;
53
-
54
-	/**
55
-	 * Item tax.
56
-	 *
57
-	 * @var float
58
-	 */
59
-	public $item_tax = 0;
13
+     * Stores a custom description for the item.
14
+     *
15
+     * @var string
16
+     */
17
+    protected $custom_description = '';
18
+
19
+    /**
20
+     * Stores the item quantity.
21
+     *
22
+     * @var int
23
+     */
24
+    protected $quantity = 1;
25
+
26
+    /**
27
+     * Is this item required?
28
+     *
29
+     * @var int
30
+     */
31
+    protected $is_required = true;
32
+
33
+    /**
34
+     * Are quantities allowed?
35
+     *
36
+     * @var int
37
+     */
38
+    protected $allow_quantities = false;
39
+
40
+    /**
41
+     * Associated invoice.
42
+     *
43
+     * @var int
44
+     */
45
+    public $invoice_id = 0;
46
+
47
+    /**
48
+     * Item discount.
49
+     *
50
+     * @var float
51
+     */
52
+    public $item_discount = 0;
53
+
54
+    /**
55
+     * Item tax.
56
+     *
57
+     * @var float
58
+     */
59
+    public $item_tax = 0;
60 60
 
61 61
     /*
62 62
 	|--------------------------------------------------------------------------
@@ -74,189 +74,189 @@  discard block
 block discarded – undo
74 74
     */
75 75
 
76 76
     /**
77
-	 * Get the item name.
78
-	 *
79
-	 * @since 1.0.19
80
-	 * @param  string $context View or edit context.
81
-	 * @return string
82
-	 */
83
-	public function get_name( $context = 'view' ) {
84
-		$name = parent::get_name( $context );
85
-		return $name . wpinv_get_item_suffix( $this );
86
-	}
87
-
88
-	/**
89
-	 * Get the item description.
90
-	 *
91
-	 * @since 1.0.19
92
-	 * @param  string $context View or edit context.
93
-	 * @return string
94
-	 */
95
-	public function get_description( $context = 'view' ) {
96
-
97
-		if ( ! empty( $this->custom_description ) ) {
98
-			return $this->custom_description;
99
-		}
100
-
101
-		return parent::get_description( $context );
102
-	}
103
-
104
-	/**
105
-	 * Returns the sub total.
106
-	 *
107
-	 * @since 1.0.19
108
-	 * @param  string $context View or edit context.
109
-	 * @return int
110
-	 */
111
-	public function get_sub_total( $context = 'view' ) {
112
-		return $this->get_quantity( $context ) * $this->get_initial_price( $context );
113
-	}
114
-
115
-	/**
116
-	 * Returns the recurring sub total.
117
-	 *
118
-	 * @since 1.0.19
119
-	 * @param  string $context View or edit context.
120
-	 * @return int
121
-	 */
122
-	public function get_recurring_sub_total( $context = 'view' ) {
123
-		return $this->get_quantity( $context ) * $this->get_price( $context );
124
-	}
125
-
126
-	/**
127
-	 * @deprecated
128
-	 */
129
-	public function get_qantity( $context = 'view' ) {
130
-		return $this->get_quantity( $context );
131
-	}
132
-
133
-	/**
134
-	 * Get the item quantity.
135
-	 *
136
-	 * @since 1.0.19
137
-	 * @param  string $context View or edit context.
138
-	 * @return int
139
-	 */
140
-	public function get_quantity( $context = 'view' ) {
141
-		$quantity = (int) $this->quantity;
142
-
143
-		if ( empty( $quantity ) || 1 > $quantity ) {
144
-			$quantity = 1;
145
-		}
146
-
147
-		if ( 'view' == $context ) {
148
-			return apply_filters( 'getpaid_payment_form_item_quanity', $quantity, $this );
149
-		}
150
-
151
-		return $quantity;
152
-
153
-	}
154
-
155
-	/**
156
-	 * Returns whether or not customers can update the item quantity.
157
-	 *
158
-	 * @since 1.0.19
159
-	 * @param  string $context View or edit context.
160
-	 * @return bool
161
-	 */
162
-	public function get_allow_quantities( $context = 'view' ) {
163
-		$allow_quantities = (bool) $this->allow_quantities;
164
-
165
-		if ( 'view' == $context ) {
166
-			return apply_filters( 'getpaid_payment_form_item_allow_quantities', $allow_quantities, $this );
167
-		}
168
-
169
-		return $allow_quantities;
170
-
171
-	}
172
-
173
-	/**
174
-	 * Returns whether or not the item is required.
175
-	 *
176
-	 * @since 1.0.19
177
-	 * @param  string $context View or edit context.
178
-	 * @return bool
179
-	 */
180
-	public function get_is_required( $context = 'view' ) {
181
-		$is_required = (bool) $this->is_required;
182
-
183
-		if ( 'view' == $context ) {
184
-			return apply_filters( 'getpaid_payment_form_item_is_required', $is_required, $this );
185
-		}
186
-
187
-		return $is_required;
188
-
189
-	}
190
-
191
-	/**
192
-	 * Prepares form data for use.
193
-	 *
194
-	 * @since 1.0.19
195
-	 * @return array
196
-	 */
197
-	public function prepare_data_for_use() {
198
-
199
-		return array(
200
-			'title'            => sanitize_text_field( $this->get_name() ),
201
-			'id'               => $this->get_id(),
202
-			'price'            => $this->get_price(),
203
-			'recurring'        => $this->is_recurring(),
204
-			'description'      => $this->get_description(),
205
-			'allow_quantities' => $this->allows_quantities(),
206
-			'required'         => $this->is_required(),
207
-		);
208
-
209
-	}
210
-
211
-	/**
212
-	 * Prepares form data for ajax use.
213
-	 *
214
-	 * @since 1.0.19
215
-	 * @return array
216
-	 */
217
-	public function prepare_data_for_invoice_edit_ajax() {
218
-
219
-		return array(
220
-			'id'     => $this->get_id(),
221
-			'texts'  => array(
222
-				'item-name'        => sanitize_text_field( $this->get_name() ),
223
-				'item-description' => wp_kses_post( $this->get_description() ),
224
-				'item-quantity'    => absint( $this->get_quantity() ),
225
-				'item-price'       => wpinv_price( $this->get_price() ),
226
-				'item-total'       => wpinv_price( $this->get_sub_total() ),
227
-			),
228
-			'inputs' => array(
229
-				'item-id'          => $this->get_id(),
230
-				'item-name'        => sanitize_text_field( $this->get_name() ),
231
-				'item-description' => wp_kses_post( $this->get_description() ),
232
-				'item-quantity'    => absint( $this->get_quantity() ),
233
-				'item-price'       => $this->get_price(),
234
-			)
235
-		);
236
-
237
-	}
238
-
239
-	/**
240
-	 * Prepares form data for saving (cart_details).
241
-	 *
242
-	 * @since 1.0.19
243
-	 * @return array
244
-	 */
245
-	public function prepare_data_for_saving() {
246
-
247
-		return array(
248
-			'post_id'           => $this->invoice_id,
249
-			'item_id'           => $this->get_id(),
250
-			'item_name'         => sanitize_text_field( $this->get_name() ),
251
-			'item_description'  => $this->get_description(),
252
-			'tax'               => $this->item_tax,
253
-			'item_price'        => $this->get_price(),
254
-			'quantity'          => (int) $this->get_quantity(),
255
-			'discount'          => $this->item_discount,
256
-			'subtotal'          => $this->get_sub_total(),
257
-			'price'             => $this->get_sub_total() + $this->item_tax + $this->item_discount
77
+     * Get the item name.
78
+     *
79
+     * @since 1.0.19
80
+     * @param  string $context View or edit context.
81
+     * @return string
82
+     */
83
+    public function get_name( $context = 'view' ) {
84
+        $name = parent::get_name( $context );
85
+        return $name . wpinv_get_item_suffix( $this );
86
+    }
87
+
88
+    /**
89
+     * Get the item description.
90
+     *
91
+     * @since 1.0.19
92
+     * @param  string $context View or edit context.
93
+     * @return string
94
+     */
95
+    public function get_description( $context = 'view' ) {
96
+
97
+        if ( ! empty( $this->custom_description ) ) {
98
+            return $this->custom_description;
99
+        }
100
+
101
+        return parent::get_description( $context );
102
+    }
103
+
104
+    /**
105
+     * Returns the sub total.
106
+     *
107
+     * @since 1.0.19
108
+     * @param  string $context View or edit context.
109
+     * @return int
110
+     */
111
+    public function get_sub_total( $context = 'view' ) {
112
+        return $this->get_quantity( $context ) * $this->get_initial_price( $context );
113
+    }
114
+
115
+    /**
116
+     * Returns the recurring sub total.
117
+     *
118
+     * @since 1.0.19
119
+     * @param  string $context View or edit context.
120
+     * @return int
121
+     */
122
+    public function get_recurring_sub_total( $context = 'view' ) {
123
+        return $this->get_quantity( $context ) * $this->get_price( $context );
124
+    }
125
+
126
+    /**
127
+     * @deprecated
128
+     */
129
+    public function get_qantity( $context = 'view' ) {
130
+        return $this->get_quantity( $context );
131
+    }
132
+
133
+    /**
134
+     * Get the item quantity.
135
+     *
136
+     * @since 1.0.19
137
+     * @param  string $context View or edit context.
138
+     * @return int
139
+     */
140
+    public function get_quantity( $context = 'view' ) {
141
+        $quantity = (int) $this->quantity;
142
+
143
+        if ( empty( $quantity ) || 1 > $quantity ) {
144
+            $quantity = 1;
145
+        }
146
+
147
+        if ( 'view' == $context ) {
148
+            return apply_filters( 'getpaid_payment_form_item_quanity', $quantity, $this );
149
+        }
150
+
151
+        return $quantity;
152
+
153
+    }
154
+
155
+    /**
156
+     * Returns whether or not customers can update the item quantity.
157
+     *
158
+     * @since 1.0.19
159
+     * @param  string $context View or edit context.
160
+     * @return bool
161
+     */
162
+    public function get_allow_quantities( $context = 'view' ) {
163
+        $allow_quantities = (bool) $this->allow_quantities;
164
+
165
+        if ( 'view' == $context ) {
166
+            return apply_filters( 'getpaid_payment_form_item_allow_quantities', $allow_quantities, $this );
167
+        }
168
+
169
+        return $allow_quantities;
170
+
171
+    }
172
+
173
+    /**
174
+     * Returns whether or not the item is required.
175
+     *
176
+     * @since 1.0.19
177
+     * @param  string $context View or edit context.
178
+     * @return bool
179
+     */
180
+    public function get_is_required( $context = 'view' ) {
181
+        $is_required = (bool) $this->is_required;
182
+
183
+        if ( 'view' == $context ) {
184
+            return apply_filters( 'getpaid_payment_form_item_is_required', $is_required, $this );
185
+        }
186
+
187
+        return $is_required;
188
+
189
+    }
190
+
191
+    /**
192
+     * Prepares form data for use.
193
+     *
194
+     * @since 1.0.19
195
+     * @return array
196
+     */
197
+    public function prepare_data_for_use() {
198
+
199
+        return array(
200
+            'title'            => sanitize_text_field( $this->get_name() ),
201
+            'id'               => $this->get_id(),
202
+            'price'            => $this->get_price(),
203
+            'recurring'        => $this->is_recurring(),
204
+            'description'      => $this->get_description(),
205
+            'allow_quantities' => $this->allows_quantities(),
206
+            'required'         => $this->is_required(),
207
+        );
208
+
209
+    }
210
+
211
+    /**
212
+     * Prepares form data for ajax use.
213
+     *
214
+     * @since 1.0.19
215
+     * @return array
216
+     */
217
+    public function prepare_data_for_invoice_edit_ajax() {
218
+
219
+        return array(
220
+            'id'     => $this->get_id(),
221
+            'texts'  => array(
222
+                'item-name'        => sanitize_text_field( $this->get_name() ),
223
+                'item-description' => wp_kses_post( $this->get_description() ),
224
+                'item-quantity'    => absint( $this->get_quantity() ),
225
+                'item-price'       => wpinv_price( $this->get_price() ),
226
+                'item-total'       => wpinv_price( $this->get_sub_total() ),
227
+            ),
228
+            'inputs' => array(
229
+                'item-id'          => $this->get_id(),
230
+                'item-name'        => sanitize_text_field( $this->get_name() ),
231
+                'item-description' => wp_kses_post( $this->get_description() ),
232
+                'item-quantity'    => absint( $this->get_quantity() ),
233
+                'item-price'       => $this->get_price(),
234
+            )
235
+        );
236
+
237
+    }
238
+
239
+    /**
240
+     * Prepares form data for saving (cart_details).
241
+     *
242
+     * @since 1.0.19
243
+     * @return array
244
+     */
245
+    public function prepare_data_for_saving() {
246
+
247
+        return array(
248
+            'post_id'           => $this->invoice_id,
249
+            'item_id'           => $this->get_id(),
250
+            'item_name'         => sanitize_text_field( $this->get_name() ),
251
+            'item_description'  => $this->get_description(),
252
+            'tax'               => $this->item_tax,
253
+            'item_price'        => $this->get_price(),
254
+            'quantity'          => (int) $this->get_quantity(),
255
+            'discount'          => $this->item_discount,
256
+            'subtotal'          => $this->get_sub_total(),
257
+            'price'             => $this->get_sub_total() + $this->item_tax + $this->item_discount
258 258
         );
259
-	}
259
+    }
260 260
 
261 261
     /*
262 262
 	|--------------------------------------------------------------------------
@@ -268,60 +268,60 @@  discard block
 block discarded – undo
268 268
 	| object.
269 269
     */
270 270
 
271
-	/**
272
-	 * Set the item qantity.
273
-	 *
274
-	 * @since 1.0.19
275
-	 * @param  int $quantity The item quantity.
276
-	 */
277
-	public function set_quantity( $quantity ) {
278
-
279
-		if ( empty( $quantity ) || ! is_numeric( $quantity ) ) {
280
-			$quantity = 1;
281
-		}
282
-
283
-		$this->quantity = $quantity;
284
-
285
-	}
286
-
287
-	/**
288
-	 * Set whether or not the quantities are allowed.
289
-	 *
290
-	 * @since 1.0.19
291
-	 * @param  bool $allow_quantities
292
-	 */
293
-	public function set_allow_quantities( $allow_quantities ) {
294
-		$this->allow_quantities = (bool) $allow_quantities;
295
-	}
296
-
297
-	/**
298
-	 * Set whether or not the item is required.
299
-	 *
300
-	 * @since 1.0.19
301
-	 * @param  bool $is_required
302
-	 */
303
-	public function set_is_required( $is_required ) {
304
-		$this->is_required = (bool) $is_required;
305
-	}
306
-
307
-	/**
308
-	 * Sets the custom item description.
309
-	 *
310
-	 * @since 1.0.19
311
-	 * @param  string $description
312
-	 */
313
-	public function set_custom_description( $description ) {
314
-		$this->custom_description = $description;
315
-	}
271
+    /**
272
+     * Set the item qantity.
273
+     *
274
+     * @since 1.0.19
275
+     * @param  int $quantity The item quantity.
276
+     */
277
+    public function set_quantity( $quantity ) {
278
+
279
+        if ( empty( $quantity ) || ! is_numeric( $quantity ) ) {
280
+            $quantity = 1;
281
+        }
282
+
283
+        $this->quantity = $quantity;
284
+
285
+    }
286
+
287
+    /**
288
+     * Set whether or not the quantities are allowed.
289
+     *
290
+     * @since 1.0.19
291
+     * @param  bool $allow_quantities
292
+     */
293
+    public function set_allow_quantities( $allow_quantities ) {
294
+        $this->allow_quantities = (bool) $allow_quantities;
295
+    }
296
+
297
+    /**
298
+     * Set whether or not the item is required.
299
+     *
300
+     * @since 1.0.19
301
+     * @param  bool $is_required
302
+     */
303
+    public function set_is_required( $is_required ) {
304
+        $this->is_required = (bool) $is_required;
305
+    }
306
+
307
+    /**
308
+     * Sets the custom item description.
309
+     *
310
+     * @since 1.0.19
311
+     * @param  string $description
312
+     */
313
+    public function set_custom_description( $description ) {
314
+        $this->custom_description = $description;
315
+    }
316 316
 
317 317
     /**
318 318
      * We do not want to save items to the database.
319 319
      * 
320
-	 * @return int item id
320
+     * @return int item id
321 321
      */
322 322
     public function save( $data = array() ) {
323 323
         return $this->get_id();
324
-	}
324
+    }
325 325
 
326 326
     /*
327 327
 	|--------------------------------------------------------------------------
@@ -333,23 +333,23 @@  discard block
 block discarded – undo
333 333
 	*/
334 334
 
335 335
     /**
336
-	 * Checks whether the item has enabled dynamic pricing.
337
-	 *
338
-	 * @since 1.0.19
339
-	 * @return bool
340
-	 */
341
-	public function is_required() {
336
+     * Checks whether the item has enabled dynamic pricing.
337
+     *
338
+     * @since 1.0.19
339
+     * @return bool
340
+     */
341
+    public function is_required() {
342 342
         return (bool) $this->get_is_required();
343
-	}
344
-
345
-	/**
346
-	 * Checks whether users can edit the quantities.
347
-	 *
348
-	 * @since 1.0.19
349
-	 * @return bool
350
-	 */
351
-	public function allows_quantities() {
343
+    }
344
+
345
+    /**
346
+     * Checks whether users can edit the quantities.
347
+     *
348
+     * @since 1.0.19
349
+     * @return bool
350
+     */
351
+    public function allows_quantities() {
352 352
         return (bool) $this->get_allow_quantities();
353
-	}
353
+    }
354 354
 
355 355
 }
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 	 * @param  string $context View or edit context.
81 81
 	 * @return string
82 82
 	 */
83
-	public function get_name( $context = 'view' ) {
84
-		$name = parent::get_name( $context );
85
-		return $name . wpinv_get_item_suffix( $this );
83
+	public function get_name($context = 'view') {
84
+		$name = parent::get_name($context);
85
+		return $name . wpinv_get_item_suffix($this);
86 86
 	}
87 87
 
88 88
 	/**
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
 	 * @param  string $context View or edit context.
93 93
 	 * @return string
94 94
 	 */
95
-	public function get_description( $context = 'view' ) {
95
+	public function get_description($context = 'view') {
96 96
 
97
-		if ( ! empty( $this->custom_description ) ) {
97
+		if (!empty($this->custom_description)) {
98 98
 			return $this->custom_description;
99 99
 		}
100 100
 
101
-		return parent::get_description( $context );
101
+		return parent::get_description($context);
102 102
 	}
103 103
 
104 104
 	/**
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 * @param  string $context View or edit context.
109 109
 	 * @return int
110 110
 	 */
111
-	public function get_sub_total( $context = 'view' ) {
112
-		return $this->get_quantity( $context ) * $this->get_initial_price( $context );
111
+	public function get_sub_total($context = 'view') {
112
+		return $this->get_quantity($context) * $this->get_initial_price($context);
113 113
 	}
114 114
 
115 115
 	/**
@@ -119,15 +119,15 @@  discard block
 block discarded – undo
119 119
 	 * @param  string $context View or edit context.
120 120
 	 * @return int
121 121
 	 */
122
-	public function get_recurring_sub_total( $context = 'view' ) {
123
-		return $this->get_quantity( $context ) * $this->get_price( $context );
122
+	public function get_recurring_sub_total($context = 'view') {
123
+		return $this->get_quantity($context) * $this->get_price($context);
124 124
 	}
125 125
 
126 126
 	/**
127 127
 	 * @deprecated
128 128
 	 */
129
-	public function get_qantity( $context = 'view' ) {
130
-		return $this->get_quantity( $context );
129
+	public function get_qantity($context = 'view') {
130
+		return $this->get_quantity($context);
131 131
 	}
132 132
 
133 133
 	/**
@@ -137,15 +137,15 @@  discard block
 block discarded – undo
137 137
 	 * @param  string $context View or edit context.
138 138
 	 * @return int
139 139
 	 */
140
-	public function get_quantity( $context = 'view' ) {
140
+	public function get_quantity($context = 'view') {
141 141
 		$quantity = (int) $this->quantity;
142 142
 
143
-		if ( empty( $quantity ) || 1 > $quantity ) {
143
+		if (empty($quantity) || 1 > $quantity) {
144 144
 			$quantity = 1;
145 145
 		}
146 146
 
147
-		if ( 'view' == $context ) {
148
-			return apply_filters( 'getpaid_payment_form_item_quanity', $quantity, $this );
147
+		if ('view' == $context) {
148
+			return apply_filters('getpaid_payment_form_item_quanity', $quantity, $this);
149 149
 		}
150 150
 
151 151
 		return $quantity;
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 	 * @param  string $context View or edit context.
160 160
 	 * @return bool
161 161
 	 */
162
-	public function get_allow_quantities( $context = 'view' ) {
162
+	public function get_allow_quantities($context = 'view') {
163 163
 		$allow_quantities = (bool) $this->allow_quantities;
164 164
 
165
-		if ( 'view' == $context ) {
166
-			return apply_filters( 'getpaid_payment_form_item_allow_quantities', $allow_quantities, $this );
165
+		if ('view' == $context) {
166
+			return apply_filters('getpaid_payment_form_item_allow_quantities', $allow_quantities, $this);
167 167
 		}
168 168
 
169 169
 		return $allow_quantities;
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 	 * @param  string $context View or edit context.
178 178
 	 * @return bool
179 179
 	 */
180
-	public function get_is_required( $context = 'view' ) {
180
+	public function get_is_required($context = 'view') {
181 181
 		$is_required = (bool) $this->is_required;
182 182
 
183
-		if ( 'view' == $context ) {
184
-			return apply_filters( 'getpaid_payment_form_item_is_required', $is_required, $this );
183
+		if ('view' == $context) {
184
+			return apply_filters('getpaid_payment_form_item_is_required', $is_required, $this);
185 185
 		}
186 186
 
187 187
 		return $is_required;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	public function prepare_data_for_use() {
198 198
 
199 199
 		return array(
200
-			'title'            => sanitize_text_field( $this->get_name() ),
200
+			'title'            => sanitize_text_field($this->get_name()),
201 201
 			'id'               => $this->get_id(),
202 202
 			'price'            => $this->get_price(),
203 203
 			'recurring'        => $this->is_recurring(),
@@ -219,17 +219,17 @@  discard block
 block discarded – undo
219 219
 		return array(
220 220
 			'id'     => $this->get_id(),
221 221
 			'texts'  => array(
222
-				'item-name'        => sanitize_text_field( $this->get_name() ),
223
-				'item-description' => wp_kses_post( $this->get_description() ),
224
-				'item-quantity'    => absint( $this->get_quantity() ),
225
-				'item-price'       => wpinv_price( $this->get_price() ),
226
-				'item-total'       => wpinv_price( $this->get_sub_total() ),
222
+				'item-name'        => sanitize_text_field($this->get_name()),
223
+				'item-description' => wp_kses_post($this->get_description()),
224
+				'item-quantity'    => absint($this->get_quantity()),
225
+				'item-price'       => wpinv_price($this->get_price()),
226
+				'item-total'       => wpinv_price($this->get_sub_total()),
227 227
 			),
228 228
 			'inputs' => array(
229 229
 				'item-id'          => $this->get_id(),
230
-				'item-name'        => sanitize_text_field( $this->get_name() ),
231
-				'item-description' => wp_kses_post( $this->get_description() ),
232
-				'item-quantity'    => absint( $this->get_quantity() ),
230
+				'item-name'        => sanitize_text_field($this->get_name()),
231
+				'item-description' => wp_kses_post($this->get_description()),
232
+				'item-quantity'    => absint($this->get_quantity()),
233 233
 				'item-price'       => $this->get_price(),
234 234
 			)
235 235
 		);
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 		return array(
248 248
 			'post_id'           => $this->invoice_id,
249 249
 			'item_id'           => $this->get_id(),
250
-			'item_name'         => sanitize_text_field( $this->get_name() ),
250
+			'item_name'         => sanitize_text_field($this->get_name()),
251 251
 			'item_description'  => $this->get_description(),
252 252
 			'tax'               => $this->item_tax,
253 253
 			'item_price'        => $this->get_price(),
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
 	 * @since 1.0.19
275 275
 	 * @param  int $quantity The item quantity.
276 276
 	 */
277
-	public function set_quantity( $quantity ) {
277
+	public function set_quantity($quantity) {
278 278
 
279
-		if ( empty( $quantity ) || ! is_numeric( $quantity ) ) {
279
+		if (empty($quantity) || !is_numeric($quantity)) {
280 280
 			$quantity = 1;
281 281
 		}
282 282
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	 * @since 1.0.19
291 291
 	 * @param  bool $allow_quantities
292 292
 	 */
293
-	public function set_allow_quantities( $allow_quantities ) {
293
+	public function set_allow_quantities($allow_quantities) {
294 294
 		$this->allow_quantities = (bool) $allow_quantities;
295 295
 	}
296 296
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 * @since 1.0.19
301 301
 	 * @param  bool $is_required
302 302
 	 */
303
-	public function set_is_required( $is_required ) {
303
+	public function set_is_required($is_required) {
304 304
 		$this->is_required = (bool) $is_required;
305 305
 	}
306 306
 
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	 * @since 1.0.19
311 311
 	 * @param  string $description
312 312
 	 */
313
-	public function set_custom_description( $description ) {
313
+	public function set_custom_description($description) {
314 314
 		$this->custom_description = $description;
315 315
 	}
316 316
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
      * 
320 320
 	 * @return int item id
321 321
      */
322
-    public function save( $data = array() ) {
322
+    public function save($data = array()) {
323 323
         return $this->get_id();
324 324
 	}
325 325
 
Please login to merge, or discard this patch.
includes/class-wpinv-invoice.php 2 patches
Indentation   +2067 added lines, -2067 removed lines patch added patch discarded remove patch
@@ -11,30 +11,30 @@  discard block
 block discarded – undo
11 11
 class WPInv_Invoice extends GetPaid_Data {
12 12
 
13 13
     /**
14
-	 * Which data store to load.
15
-	 *
16
-	 * @var string
17
-	 */
14
+     * Which data store to load.
15
+     *
16
+     * @var string
17
+     */
18 18
     protected $data_store_name = 'invoice';
19 19
 
20 20
     /**
21
-	 * This is the name of this object type.
22
-	 *
23
-	 * @var string
24
-	 */
21
+     * This is the name of this object type.
22
+     *
23
+     * @var string
24
+     */
25 25
     protected $object_type = 'invoice';
26 26
 
27 27
     /**
28
-	 * Item Data array. This is the core item data exposed in APIs.
29
-	 *
30
-	 * @since 1.0.19
31
-	 * @var array
32
-	 */
33
-	protected $data = array(
34
-		'parent_id'            => 0,
35
-		'status'               => 'wpi-pending',
36
-		'version'              => '',
37
-		'date_created'         => null,
28
+     * Item Data array. This is the core item data exposed in APIs.
29
+     *
30
+     * @since 1.0.19
31
+     * @var array
32
+     */
33
+    protected $data = array(
34
+        'parent_id'            => 0,
35
+        'status'               => 'wpi-pending',
36
+        'version'              => '',
37
+        'date_created'         => null,
38 38
         'date_modified'        => null,
39 39
         'due_date'             => null,
40 40
         'completed_date'       => null,
@@ -76,20 +76,20 @@  discard block
 block discarded – undo
76 76
         'transaction_id'       => '',
77 77
         'currency'             => '',
78 78
         'disable_taxes'        => 0,
79
-		'subscription_id'      => null,
80
-		'is_viewed'            => false,
81
-		'email_cc'             => '',
82
-		'template'             => 'quantity', // hours, amount only
79
+        'subscription_id'      => null,
80
+        'is_viewed'            => false,
81
+        'email_cc'             => '',
82
+        'template'             => 'quantity', // hours, amount only
83 83
     );
84 84
 
85 85
     /**
86
-	 * Stores meta in cache for future reads.
87
-	 *
88
-	 * A group must be set to to enable caching.
89
-	 *
90
-	 * @var string
91
-	 */
92
-	protected $cache_group = 'getpaid_invoices';
86
+     * Stores meta in cache for future reads.
87
+     *
88
+     * A group must be set to to enable caching.
89
+     *
90
+     * @var string
91
+     */
92
+    protected $cache_group = 'getpaid_invoices';
93 93
 
94 94
     /**
95 95
      * Stores a reference to the original WP_Post object
@@ -103,97 +103,97 @@  discard block
 block discarded – undo
103 103
      *
104 104
      * @var int
105 105
      */
106
-	protected $recurring_item = null;
106
+    protected $recurring_item = null;
107 107
 
108
-	/**
108
+    /**
109 109
      * Stores an array of item totals.
110
-	 *
111
-	 * e.g $totals['discount'] = array(
112
-	 * 		'initial'   => 10,
113
-	 * 		'recurring' => 10,
114
-	 * )
110
+     *
111
+     * e.g $totals['discount'] = array(
112
+     * 		'initial'   => 10,
113
+     * 		'recurring' => 10,
114
+     * )
115 115
      *
116 116
      * @var array
117 117
      */
118
-	protected $totals = array();
118
+    protected $totals = array();
119 119
 
120
-	/**
121
-	 * Stores the status transition information.
122
-	 *
123
-	 * @since 1.0.19
124
-	 * @var bool
125
-	 */
126
-	protected $status_transition = false;
120
+    /**
121
+     * Stores the status transition information.
122
+     *
123
+     * @since 1.0.19
124
+     * @var bool
125
+     */
126
+    protected $status_transition = false;
127 127
 
128 128
     /**
129
-	 * Get the invoice if ID is passed, otherwise the invoice is new and empty.
130
-	 *
131
-	 * @param  int/string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, number or object to read.
132
-	 */
129
+     * Get the invoice if ID is passed, otherwise the invoice is new and empty.
130
+     *
131
+     * @param  int/string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, number or object to read.
132
+     */
133 133
     public function __construct( $invoice = false ) {
134 134
 
135 135
         parent::__construct( $invoice );
136 136
 
137
-		if ( is_numeric( $invoice ) && getpaid_is_invoice_post_type( get_post_type( $invoice ) ) ) {
138
-			$this->set_id( $invoice );
139
-		} elseif ( $invoice instanceof self ) {
140
-			$this->set_id( $invoice->get_id() );
141
-		} elseif ( ! empty( $invoice->ID ) ) {
142
-			$this->set_id( $invoice->ID );
143
-		} elseif ( is_array( $invoice ) ) {
144
-			$this->set_props( $invoice );
145
-
146
-			if ( isset( $invoice['ID'] ) ) {
147
-				$this->set_id( $invoice['ID'] );
148
-			}
149
-
150
-		} elseif ( is_scalar( $invoice ) && $invoice_id = self::get_discount_id_by_code( $invoice, 'key' ) ) {
151
-			$this->set_id( $invoice_id );
152
-		} elseif ( is_scalar( $invoice ) && $invoice_id = self::get_discount_id_by_code( $invoice, 'number' ) ) {
153
-			$this->set_id( $invoice_id );
154
-		} else {
155
-			$this->set_object_read( true );
156
-		}
137
+        if ( is_numeric( $invoice ) && getpaid_is_invoice_post_type( get_post_type( $invoice ) ) ) {
138
+            $this->set_id( $invoice );
139
+        } elseif ( $invoice instanceof self ) {
140
+            $this->set_id( $invoice->get_id() );
141
+        } elseif ( ! empty( $invoice->ID ) ) {
142
+            $this->set_id( $invoice->ID );
143
+        } elseif ( is_array( $invoice ) ) {
144
+            $this->set_props( $invoice );
145
+
146
+            if ( isset( $invoice['ID'] ) ) {
147
+                $this->set_id( $invoice['ID'] );
148
+            }
149
+
150
+        } elseif ( is_scalar( $invoice ) && $invoice_id = self::get_discount_id_by_code( $invoice, 'key' ) ) {
151
+            $this->set_id( $invoice_id );
152
+        } elseif ( is_scalar( $invoice ) && $invoice_id = self::get_discount_id_by_code( $invoice, 'number' ) ) {
153
+            $this->set_id( $invoice_id );
154
+        } else {
155
+            $this->set_object_read( true );
156
+        }
157 157
 
158 158
         // Load the datastore.
159
-		$this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
159
+        $this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
160 160
 
161
-		if ( $this->get_id() > 0 ) {
161
+        if ( $this->get_id() > 0 ) {
162 162
             $this->post = get_post( $this->get_id() );
163 163
             $this->ID   = $this->get_id();
164
-			$this->data_store->read( $this );
164
+            $this->data_store->read( $this );
165 165
         }
166 166
 
167 167
     }
168 168
 
169 169
     /**
170
-	 * Given a discount code, it returns a discount id.
171
-	 *
172
-	 *
173
-	 * @static
174
-	 * @param string $discount_code
175
-	 * @since 1.0.15
176
-	 * @return int
177
-	 */
178
-	public static function get_discount_id_by_code( $invoice_key_or_number, $field = 'key' ) {
170
+     * Given a discount code, it returns a discount id.
171
+     *
172
+     *
173
+     * @static
174
+     * @param string $discount_code
175
+     * @since 1.0.15
176
+     * @return int
177
+     */
178
+    public static function get_discount_id_by_code( $invoice_key_or_number, $field = 'key' ) {
179 179
         global $wpdb;
180 180
 
181
-		// Trim the code.
181
+        // Trim the code.
182 182
         $key = trim( $invoice_key_or_number );
183 183
 
184 184
         // Valid fields.
185 185
         $fields = array( 'key', 'number' );
186 186
 
187
-		// Ensure a value has been passed.
188
-		if ( empty( $key ) || ! in_array( $field, $fields ) ) {
189
-			return 0;
190
-		}
187
+        // Ensure a value has been passed.
188
+        if ( empty( $key ) || ! in_array( $field, $fields ) ) {
189
+            return 0;
190
+        }
191 191
 
192
-		// Maybe retrieve from the cache.
193
-		$invoice_id   = wp_cache_get( $key, 'getpaid_invoice_keys_' . $field );
194
-		if ( ! empty( $invoice_id ) ) {
195
-			return $invoice_id;
196
-		}
192
+        // Maybe retrieve from the cache.
193
+        $invoice_id   = wp_cache_get( $key, 'getpaid_invoice_keys_' . $field );
194
+        if ( ! empty( $invoice_id ) ) {
195
+            return $invoice_id;
196
+        }
197 197
 
198 198
         // Fetch from the db.
199 199
         $table       = $wpdb->prefix . 'getpaid_invoices';
@@ -201,14 +201,14 @@  discard block
 block discarded – undo
201 201
             $wpdb->prepare( "SELECT `post_id` FROM $table WHERE $field=%s LIMIT 1", $key )
202 202
         );
203 203
 
204
-		if ( empty( $invoice_id ) ) {
205
-			return 0;
206
-		}
204
+        if ( empty( $invoice_id ) ) {
205
+            return 0;
206
+        }
207 207
 
208
-		// Update the cache with our data
209
-		wp_cache_set( $key, $invoice_id, 'getpaid_invoice_keys_' . $field );
208
+        // Update the cache with our data
209
+        wp_cache_set( $key, $invoice_id, 'getpaid_invoice_keys_' . $field );
210 210
 
211
-		return $invoice_id;
211
+        return $invoice_id;
212 212
     }
213 213
 
214 214
     /**
@@ -234,53 +234,53 @@  discard block
 block discarded – undo
234 234
     */
235 235
 
236 236
     /**
237
-	 * Get parent invoice ID.
238
-	 *
239
-	 * @since 1.0.19
240
-	 * @param  string $context View or edit context.
241
-	 * @return int
242
-	 */
243
-	public function get_parent_id( $context = 'view' ) {
244
-		return (int) $this->get_prop( 'parent_id', $context );
237
+     * Get parent invoice ID.
238
+     *
239
+     * @since 1.0.19
240
+     * @param  string $context View or edit context.
241
+     * @return int
242
+     */
243
+    public function get_parent_id( $context = 'view' ) {
244
+        return (int) $this->get_prop( 'parent_id', $context );
245 245
     }
246 246
 
247 247
     /**
248
-	 * Get parent invoice.
249
-	 *
250
-	 * @since 1.0.19
251
-	 * @return WPInv_Invoice
252
-	 */
248
+     * Get parent invoice.
249
+     *
250
+     * @since 1.0.19
251
+     * @return WPInv_Invoice
252
+     */
253 253
     public function get_parent_payment() {
254 254
         return new WPInv_Invoice( $this->get_parent_id() );
255 255
     }
256 256
 
257 257
     /**
258
-	 * Alias for self::get_parent_payment().
259
-	 *
260
-	 * @since 1.0.19
261
-	 * @return WPInv_Invoice
262
-	 */
258
+     * Alias for self::get_parent_payment().
259
+     *
260
+     * @since 1.0.19
261
+     * @return WPInv_Invoice
262
+     */
263 263
     public function get_parent() {
264 264
         return $this->get_parent_payment();
265 265
     }
266 266
 
267 267
     /**
268
-	 * Get invoice status.
269
-	 *
270
-	 * @since 1.0.19
271
-	 * @param  string $context View or edit context.
272
-	 * @return string
273
-	 */
274
-	public function get_status( $context = 'view' ) {
275
-		return $this->get_prop( 'status', $context );
268
+     * Get invoice status.
269
+     *
270
+     * @since 1.0.19
271
+     * @param  string $context View or edit context.
272
+     * @return string
273
+     */
274
+    public function get_status( $context = 'view' ) {
275
+        return $this->get_prop( 'status', $context );
276 276
     }
277 277
 
278 278
     /**
279
-	 * Get invoice status nice name.
280
-	 *
281
-	 * @since 1.0.19
282
-	 * @return string
283
-	 */
279
+     * Get invoice status nice name.
280
+     *
281
+     * @since 1.0.19
282
+     * @return string
283
+     */
284 284
     public function get_status_nicename() {
285 285
         $statuses = wpinv_get_invoice_statuses( true, true, $this );
286 286
 
@@ -294,20 +294,20 @@  discard block
 block discarded – undo
294 294
     }
295 295
 
296 296
     /**
297
-	 * Get plugin version when the invoice was created.
298
-	 *
299
-	 * @since 1.0.19
300
-	 * @param  string $context View or edit context.
301
-	 * @return string
302
-	 */
303
-	public function get_version( $context = 'view' ) {
304
-		return $this->get_prop( 'version', $context );
305
-	}
297
+     * Get plugin version when the invoice was created.
298
+     *
299
+     * @since 1.0.19
300
+     * @param  string $context View or edit context.
301
+     * @return string
302
+     */
303
+    public function get_version( $context = 'view' ) {
304
+        return $this->get_prop( 'version', $context );
305
+    }
306 306
 
307
-	/**
308
-	 * @deprecated
309
-	 */
310
-	public function get_invoice_date( $formatted = true ) {
307
+    /**
308
+     * @deprecated
309
+     */
310
+    public function get_invoice_date( $formatted = true ) {
311 311
         $date_completed = $this->get_date_completed();
312 312
         $invoice_date   = $date_completed != '0000-00-00 00:00:00' ? $date_completed : '';
313 313
 
@@ -324,187 +324,187 @@  discard block
 block discarded – undo
324 324
     }
325 325
 
326 326
     /**
327
-	 * Get date when the invoice was created.
328
-	 *
329
-	 * @since 1.0.19
330
-	 * @param  string $context View or edit context.
331
-	 * @return string
332
-	 */
333
-	public function get_date_created( $context = 'view' ) {
334
-		return $this->get_prop( 'date_created', $context );
335
-	}
327
+     * Get date when the invoice was created.
328
+     *
329
+     * @since 1.0.19
330
+     * @param  string $context View or edit context.
331
+     * @return string
332
+     */
333
+    public function get_date_created( $context = 'view' ) {
334
+        return $this->get_prop( 'date_created', $context );
335
+    }
336 336
 	
337
-	/**
338
-	 * Alias for self::get_date_created().
339
-	 *
340
-	 * @since 1.0.19
341
-	 * @param  string $context View or edit context.
342
-	 * @return string
343
-	 */
344
-	public function get_created_date( $context = 'view' ) {
345
-		return $this->get_date_created( $context );
346
-    }
347
-
348
-    /**
349
-	 * Get GMT date when the invoice was created.
350
-	 *
351
-	 * @since 1.0.19
352
-	 * @param  string $context View or edit context.
353
-	 * @return string
354
-	 */
355
-	public function get_date_created_gmt( $context = 'view' ) {
337
+    /**
338
+     * Alias for self::get_date_created().
339
+     *
340
+     * @since 1.0.19
341
+     * @param  string $context View or edit context.
342
+     * @return string
343
+     */
344
+    public function get_created_date( $context = 'view' ) {
345
+        return $this->get_date_created( $context );
346
+    }
347
+
348
+    /**
349
+     * Get GMT date when the invoice was created.
350
+     *
351
+     * @since 1.0.19
352
+     * @param  string $context View or edit context.
353
+     * @return string
354
+     */
355
+    public function get_date_created_gmt( $context = 'view' ) {
356 356
         $date = $this->get_date_created( $context );
357 357
 
358 358
         if ( $date ) {
359 359
             $date = get_gmt_from_date( $date );
360 360
         }
361
-		return $date;
361
+        return $date;
362 362
     }
363 363
 
364 364
     /**
365
-	 * Get date when the invoice was last modified.
366
-	 *
367
-	 * @since 1.0.19
368
-	 * @param  string $context View or edit context.
369
-	 * @return string
370
-	 */
371
-	public function get_date_modified( $context = 'view' ) {
372
-		return $this->get_prop( 'date_modified', $context );
373
-	}
365
+     * Get date when the invoice was last modified.
366
+     *
367
+     * @since 1.0.19
368
+     * @param  string $context View or edit context.
369
+     * @return string
370
+     */
371
+    public function get_date_modified( $context = 'view' ) {
372
+        return $this->get_prop( 'date_modified', $context );
373
+    }
374 374
 
375
-	/**
376
-	 * Alias for self::get_date_modified().
377
-	 *
378
-	 * @since 1.0.19
379
-	 * @param  string $context View or edit context.
380
-	 * @return string
381
-	 */
382
-	public function get_modified_date( $context = 'view' ) {
383
-		return $this->get_date_modified( $context );
375
+    /**
376
+     * Alias for self::get_date_modified().
377
+     *
378
+     * @since 1.0.19
379
+     * @param  string $context View or edit context.
380
+     * @return string
381
+     */
382
+    public function get_modified_date( $context = 'view' ) {
383
+        return $this->get_date_modified( $context );
384 384
     }
385 385
 
386 386
     /**
387
-	 * Get GMT date when the invoice was last modified.
388
-	 *
389
-	 * @since 1.0.19
390
-	 * @param  string $context View or edit context.
391
-	 * @return string
392
-	 */
393
-	public function get_date_modified_gmt( $context = 'view' ) {
387
+     * Get GMT date when the invoice was last modified.
388
+     *
389
+     * @since 1.0.19
390
+     * @param  string $context View or edit context.
391
+     * @return string
392
+     */
393
+    public function get_date_modified_gmt( $context = 'view' ) {
394 394
         $date = $this->get_date_modified( $context );
395 395
 
396 396
         if ( $date ) {
397 397
             $date = get_gmt_from_date( $date );
398 398
         }
399
-		return $date;
399
+        return $date;
400 400
     }
401 401
 
402 402
     /**
403
-	 * Get the invoice due date.
404
-	 *
405
-	 * @since 1.0.19
406
-	 * @param  string $context View or edit context.
407
-	 * @return string
408
-	 */
409
-	public function get_due_date( $context = 'view' ) {
410
-		return $this->get_prop( 'due_date', $context );
403
+     * Get the invoice due date.
404
+     *
405
+     * @since 1.0.19
406
+     * @param  string $context View or edit context.
407
+     * @return string
408
+     */
409
+    public function get_due_date( $context = 'view' ) {
410
+        return $this->get_prop( 'due_date', $context );
411 411
     }
412 412
 
413 413
     /**
414
-	 * Alias for self::get_due_date().
415
-	 *
416
-	 * @since 1.0.19
417
-	 * @param  string $context View or edit context.
418
-	 * @return string
419
-	 */
420
-	public function get_date_due( $context = 'view' ) {
421
-		return $this->get_due_date( $context );
414
+     * Alias for self::get_due_date().
415
+     *
416
+     * @since 1.0.19
417
+     * @param  string $context View or edit context.
418
+     * @return string
419
+     */
420
+    public function get_date_due( $context = 'view' ) {
421
+        return $this->get_due_date( $context );
422 422
     }
423 423
 
424 424
     /**
425
-	 * Get the invoice GMT due date.
426
-	 *
427
-	 * @since 1.0.19
428
-	 * @param  string $context View or edit context.
429
-	 * @return string
430
-	 */
431
-	public function get_due_date_gmt( $context = 'view' ) {
425
+     * Get the invoice GMT due date.
426
+     *
427
+     * @since 1.0.19
428
+     * @param  string $context View or edit context.
429
+     * @return string
430
+     */
431
+    public function get_due_date_gmt( $context = 'view' ) {
432 432
         $date = $this->get_due_date( $context );
433 433
 
434 434
         if ( $date ) {
435 435
             $date = get_gmt_from_date( $date );
436 436
         }
437
-		return $date;
437
+        return $date;
438 438
     }
439 439
 
440 440
     /**
441
-	 * Alias for self::get_due_date_gmt().
442
-	 *
443
-	 * @since 1.0.19
444
-	 * @param  string $context View or edit context.
445
-	 * @return string
446
-	 */
447
-	public function get_gmt_date_due( $context = 'view' ) {
448
-		return $this->get_due_date_gmt( $context );
441
+     * Alias for self::get_due_date_gmt().
442
+     *
443
+     * @since 1.0.19
444
+     * @param  string $context View or edit context.
445
+     * @return string
446
+     */
447
+    public function get_gmt_date_due( $context = 'view' ) {
448
+        return $this->get_due_date_gmt( $context );
449 449
     }
450 450
 
451 451
     /**
452
-	 * Get date when the invoice was completed.
453
-	 *
454
-	 * @since 1.0.19
455
-	 * @param  string $context View or edit context.
456
-	 * @return string
457
-	 */
458
-	public function get_completed_date( $context = 'view' ) {
459
-		return $this->get_prop( 'completed_date', $context );
452
+     * Get date when the invoice was completed.
453
+     *
454
+     * @since 1.0.19
455
+     * @param  string $context View or edit context.
456
+     * @return string
457
+     */
458
+    public function get_completed_date( $context = 'view' ) {
459
+        return $this->get_prop( 'completed_date', $context );
460 460
     }
461 461
 
462 462
     /**
463
-	 * Alias for self::get_completed_date().
464
-	 *
465
-	 * @since 1.0.19
466
-	 * @param  string $context View or edit context.
467
-	 * @return string
468
-	 */
469
-	public function get_date_completed( $context = 'view' ) {
470
-		return $this->get_completed_date( $context );
463
+     * Alias for self::get_completed_date().
464
+     *
465
+     * @since 1.0.19
466
+     * @param  string $context View or edit context.
467
+     * @return string
468
+     */
469
+    public function get_date_completed( $context = 'view' ) {
470
+        return $this->get_completed_date( $context );
471 471
     }
472 472
 
473 473
     /**
474
-	 * Get GMT date when the invoice was was completed.
475
-	 *
476
-	 * @since 1.0.19
477
-	 * @param  string $context View or edit context.
478
-	 * @return string
479
-	 */
480
-	public function get_completed_date_gmt( $context = 'view' ) {
474
+     * Get GMT date when the invoice was was completed.
475
+     *
476
+     * @since 1.0.19
477
+     * @param  string $context View or edit context.
478
+     * @return string
479
+     */
480
+    public function get_completed_date_gmt( $context = 'view' ) {
481 481
         $date = $this->get_completed_date( $context );
482 482
 
483 483
         if ( $date ) {
484 484
             $date = get_gmt_from_date( $date );
485 485
         }
486
-		return $date;
486
+        return $date;
487 487
     }
488 488
 
489 489
     /**
490
-	 * Alias for self::get_completed_date_gmt().
491
-	 *
492
-	 * @since 1.0.19
493
-	 * @param  string $context View or edit context.
494
-	 * @return string
495
-	 */
496
-	public function get_gmt_completed_date( $context = 'view' ) {
497
-		return $this->get_completed_date_gmt( $context );
490
+     * Alias for self::get_completed_date_gmt().
491
+     *
492
+     * @since 1.0.19
493
+     * @param  string $context View or edit context.
494
+     * @return string
495
+     */
496
+    public function get_gmt_completed_date( $context = 'view' ) {
497
+        return $this->get_completed_date_gmt( $context );
498 498
     }
499 499
 
500 500
     /**
501
-	 * Get the invoice number.
502
-	 *
503
-	 * @since 1.0.19
504
-	 * @param  string $context View or edit context.
505
-	 * @return string
506
-	 */
507
-	public function get_number( $context = 'view' ) {
501
+     * Get the invoice number.
502
+     *
503
+     * @since 1.0.19
504
+     * @param  string $context View or edit context.
505
+     * @return string
506
+     */
507
+    public function get_number( $context = 'view' ) {
508 508
         $number = $this->get_prop( 'number', $context );
509 509
 
510 510
         if ( empty( $number ) ) {
@@ -512,17 +512,17 @@  discard block
 block discarded – undo
512 512
             $this->set_number( $number );
513 513
         }
514 514
 
515
-		return $number;
515
+        return $number;
516 516
     }
517 517
 
518 518
     /**
519
-	 * Get the invoice key.
520
-	 *
521
-	 * @since 1.0.19
522
-	 * @param  string $context View or edit context.
523
-	 * @return string
524
-	 */
525
-	public function get_key( $context = 'view' ) {
519
+     * Get the invoice key.
520
+     *
521
+     * @since 1.0.19
522
+     * @param  string $context View or edit context.
523
+     * @return string
524
+     */
525
+    public function get_key( $context = 'view' ) {
526 526
         $key = $this->get_prop( 'key', $context );
527 527
 
528 528
         if ( empty( $key ) ) {
@@ -530,24 +530,24 @@  discard block
 block discarded – undo
530 530
             $this->set_key( $key );
531 531
         }
532 532
 
533
-		return $key;
533
+        return $key;
534 534
     }
535 535
 
536 536
     /**
537
-	 * Get the invoice type.
538
-	 *
539
-	 * @since 1.0.19
540
-	 * @param  string $context View or edit context.
541
-	 * @return string
542
-	 */
543
-	public function get_type( $context = 'view' ) {
537
+     * Get the invoice type.
538
+     *
539
+     * @since 1.0.19
540
+     * @param  string $context View or edit context.
541
+     * @return string
542
+     */
543
+    public function get_type( $context = 'view' ) {
544 544
         return $this->get_prop( 'type', $context );
545
-	}
545
+    }
546 546
 
547
-	/**
548
-	 * @deprecated
549
-	 */
550
-	public function get_invoice_quote_type( $post_id ) {
547
+    /**
548
+     * @deprecated
549
+     */
550
+    public function get_invoice_quote_type( $post_id ) {
551 551
         if ( empty( $post_id ) ) {
552 552
             return '';
553 553
         }
@@ -564,35 +564,35 @@  discard block
 block discarded – undo
564 564
     }
565 565
 
566 566
     /**
567
-	 * Get the invoice post type.
568
-	 *
569
-	 * @since 1.0.19
570
-	 * @param  string $context View or edit context.
571
-	 * @return string
572
-	 */
573
-	public function get_post_type( $context = 'view' ) {
567
+     * Get the invoice post type.
568
+     *
569
+     * @since 1.0.19
570
+     * @param  string $context View or edit context.
571
+     * @return string
572
+     */
573
+    public function get_post_type( $context = 'view' ) {
574 574
         return $this->get_prop( 'post_type', $context );
575 575
     }
576 576
 
577 577
     /**
578
-	 * Get the invoice mode.
579
-	 *
580
-	 * @since 1.0.19
581
-	 * @param  string $context View or edit context.
582
-	 * @return string
583
-	 */
584
-	public function get_mode( $context = 'view' ) {
578
+     * Get the invoice mode.
579
+     *
580
+     * @since 1.0.19
581
+     * @param  string $context View or edit context.
582
+     * @return string
583
+     */
584
+    public function get_mode( $context = 'view' ) {
585 585
         return $this->get_prop( 'mode', $context );
586 586
     }
587 587
 
588 588
     /**
589
-	 * Get the invoice path.
590
-	 *
591
-	 * @since 1.0.19
592
-	 * @param  string $context View or edit context.
593
-	 * @return string
594
-	 */
595
-	public function get_path( $context = 'view' ) {
589
+     * Get the invoice path.
590
+     *
591
+     * @since 1.0.19
592
+     * @param  string $context View or edit context.
593
+     * @return string
594
+     */
595
+    public function get_path( $context = 'view' ) {
596 596
         $path = $this->get_prop( 'path', $context );
597 597
 
598 598
         if ( empty( $path ) ) {
@@ -600,73 +600,73 @@  discard block
 block discarded – undo
600 600
             $path   = sanitize_title( $prefix . $this->get_id() );
601 601
         }
602 602
 
603
-		return $path;
603
+        return $path;
604 604
     }
605 605
 
606 606
     /**
607
-	 * Get the invoice name/title.
608
-	 *
609
-	 * @since 1.0.19
610
-	 * @param  string $context View or edit context.
611
-	 * @return string
612
-	 */
613
-	public function get_name( $context = 'view' ) {
607
+     * Get the invoice name/title.
608
+     *
609
+     * @since 1.0.19
610
+     * @param  string $context View or edit context.
611
+     * @return string
612
+     */
613
+    public function get_name( $context = 'view' ) {
614 614
         $name = $this->get_prop( 'title', $context );
615 615
 
616
-		return empty( $name ) ? $this->get_number( $context ) : $name;
616
+        return empty( $name ) ? $this->get_number( $context ) : $name;
617 617
     }
618 618
 
619 619
     /**
620
-	 * Alias of self::get_name().
621
-	 *
622
-	 * @since 1.0.19
623
-	 * @param  string $context View or edit context.
624
-	 * @return string
625
-	 */
626
-	public function get_title( $context = 'view' ) {
627
-		return $this->get_name( $context );
620
+     * Alias of self::get_name().
621
+     *
622
+     * @since 1.0.19
623
+     * @param  string $context View or edit context.
624
+     * @return string
625
+     */
626
+    public function get_title( $context = 'view' ) {
627
+        return $this->get_name( $context );
628 628
     }
629 629
 
630 630
     /**
631
-	 * Get the invoice description.
632
-	 *
633
-	 * @since 1.0.19
634
-	 * @param  string $context View or edit context.
635
-	 * @return string
636
-	 */
637
-	public function get_description( $context = 'view' ) {
638
-		return $this->get_prop( 'description', $context );
631
+     * Get the invoice description.
632
+     *
633
+     * @since 1.0.19
634
+     * @param  string $context View or edit context.
635
+     * @return string
636
+     */
637
+    public function get_description( $context = 'view' ) {
638
+        return $this->get_prop( 'description', $context );
639 639
     }
640 640
 
641 641
     /**
642
-	 * Alias of self::get_description().
643
-	 *
644
-	 * @since 1.0.19
645
-	 * @param  string $context View or edit context.
646
-	 * @return string
647
-	 */
648
-	public function get_excerpt( $context = 'view' ) {
649
-		return $this->get_description( $context );
642
+     * Alias of self::get_description().
643
+     *
644
+     * @since 1.0.19
645
+     * @param  string $context View or edit context.
646
+     * @return string
647
+     */
648
+    public function get_excerpt( $context = 'view' ) {
649
+        return $this->get_description( $context );
650 650
     }
651 651
 
652 652
     /**
653
-	 * Alias of self::get_description().
654
-	 *
655
-	 * @since 1.0.19
656
-	 * @param  string $context View or edit context.
657
-	 * @return string
658
-	 */
659
-	public function get_summary( $context = 'view' ) {
660
-		return $this->get_description( $context );
653
+     * Alias of self::get_description().
654
+     *
655
+     * @since 1.0.19
656
+     * @param  string $context View or edit context.
657
+     * @return string
658
+     */
659
+    public function get_summary( $context = 'view' ) {
660
+        return $this->get_description( $context );
661 661
     }
662 662
 
663 663
     /**
664
-	 * Returns the user info.
665
-	 *
666
-	 * @since 1.0.19
664
+     * Returns the user info.
665
+     *
666
+     * @since 1.0.19
667 667
      * @param  string $context View or edit context.
668
-	 * @return array
669
-	 */
668
+     * @return array
669
+     */
670 670
     public function get_user_info( $context = 'view' ) {
671 671
         $user_info = array(
672 672
             'user_id'    => $this->get_user_id( $context ),
@@ -687,598 +687,598 @@  discard block
 block discarded – undo
687 687
     }
688 688
 
689 689
     /**
690
-	 * Get the customer id.
691
-	 *
692
-	 * @since 1.0.19
693
-	 * @param  string $context View or edit context.
694
-	 * @return int
695
-	 */
696
-	public function get_author( $context = 'view' ) {
697
-		return (int) $this->get_prop( 'author', $context );
690
+     * Get the customer id.
691
+     *
692
+     * @since 1.0.19
693
+     * @param  string $context View or edit context.
694
+     * @return int
695
+     */
696
+    public function get_author( $context = 'view' ) {
697
+        return (int) $this->get_prop( 'author', $context );
698 698
     }
699 699
 
700 700
     /**
701
-	 * Alias of self::get_author().
702
-	 *
703
-	 * @since 1.0.19
704
-	 * @param  string $context View or edit context.
705
-	 * @return int
706
-	 */
707
-	public function get_user_id( $context = 'view' ) {
708
-		return $this->get_author( $context );
701
+     * Alias of self::get_author().
702
+     *
703
+     * @since 1.0.19
704
+     * @param  string $context View or edit context.
705
+     * @return int
706
+     */
707
+    public function get_user_id( $context = 'view' ) {
708
+        return $this->get_author( $context );
709 709
     }
710 710
 
711
-     /**
712
-	 * Alias of self::get_author().
713
-	 *
714
-	 * @since 1.0.19
715
-	 * @param  string $context View or edit context.
716
-	 * @return int
717
-	 */
718
-	public function get_customer_id( $context = 'view' ) {
719
-		return $this->get_author( $context );
711
+        /**
712
+         * Alias of self::get_author().
713
+         *
714
+         * @since 1.0.19
715
+         * @param  string $context View or edit context.
716
+         * @return int
717
+         */
718
+    public function get_customer_id( $context = 'view' ) {
719
+        return $this->get_author( $context );
720 720
     }
721 721
 
722 722
     /**
723
-	 * Get the customer's ip.
724
-	 *
725
-	 * @since 1.0.19
726
-	 * @param  string $context View or edit context.
727
-	 * @return string
728
-	 */
729
-	public function get_ip( $context = 'view' ) {
730
-		return $this->get_prop( 'user_ip', $context );
723
+     * Get the customer's ip.
724
+     *
725
+     * @since 1.0.19
726
+     * @param  string $context View or edit context.
727
+     * @return string
728
+     */
729
+    public function get_ip( $context = 'view' ) {
730
+        return $this->get_prop( 'user_ip', $context );
731 731
     }
732 732
 
733 733
     /**
734
-	 * Alias of self::get_ip().
735
-	 *
736
-	 * @since 1.0.19
737
-	 * @param  string $context View or edit context.
738
-	 * @return string
739
-	 */
740
-	public function get_user_ip( $context = 'view' ) {
741
-		return $this->get_ip( $context );
734
+     * Alias of self::get_ip().
735
+     *
736
+     * @since 1.0.19
737
+     * @param  string $context View or edit context.
738
+     * @return string
739
+     */
740
+    public function get_user_ip( $context = 'view' ) {
741
+        return $this->get_ip( $context );
742 742
     }
743 743
 
744
-     /**
745
-	 * Alias of self::get_ip().
746
-	 *
747
-	 * @since 1.0.19
748
-	 * @param  string $context View or edit context.
749
-	 * @return string
750
-	 */
751
-	public function get_customer_ip( $context = 'view' ) {
752
-		return $this->get_ip( $context );
744
+        /**
745
+         * Alias of self::get_ip().
746
+         *
747
+         * @since 1.0.19
748
+         * @param  string $context View or edit context.
749
+         * @return string
750
+         */
751
+    public function get_customer_ip( $context = 'view' ) {
752
+        return $this->get_ip( $context );
753 753
     }
754 754
 
755 755
     /**
756
-	 * Get the customer's first name.
757
-	 *
758
-	 * @since 1.0.19
759
-	 * @param  string $context View or edit context.
760
-	 * @return string
761
-	 */
762
-	public function get_first_name( $context = 'view' ) {
763
-		return $this->get_prop( 'first_name', $context );
756
+     * Get the customer's first name.
757
+     *
758
+     * @since 1.0.19
759
+     * @param  string $context View or edit context.
760
+     * @return string
761
+     */
762
+    public function get_first_name( $context = 'view' ) {
763
+        return $this->get_prop( 'first_name', $context );
764 764
     }
765 765
 
766 766
     /**
767
-	 * Alias of self::get_first_name().
768
-	 *
769
-	 * @since 1.0.19
770
-	 * @param  string $context View or edit context.
771
-	 * @return int
772
-	 */
773
-	public function get_user_first_name( $context = 'view' ) {
774
-		return $this->get_first_name( $context );
767
+     * Alias of self::get_first_name().
768
+     *
769
+     * @since 1.0.19
770
+     * @param  string $context View or edit context.
771
+     * @return int
772
+     */
773
+    public function get_user_first_name( $context = 'view' ) {
774
+        return $this->get_first_name( $context );
775 775
     }
776 776
 
777
-     /**
778
-	 * Alias of self::get_first_name().
779
-	 *
780
-	 * @since 1.0.19
781
-	 * @param  string $context View or edit context.
782
-	 * @return int
783
-	 */
784
-	public function get_customer_first_name( $context = 'view' ) {
785
-		return $this->get_first_name( $context );
777
+        /**
778
+         * Alias of self::get_first_name().
779
+         *
780
+         * @since 1.0.19
781
+         * @param  string $context View or edit context.
782
+         * @return int
783
+         */
784
+    public function get_customer_first_name( $context = 'view' ) {
785
+        return $this->get_first_name( $context );
786 786
     }
787 787
 
788 788
     /**
789
-	 * Get the customer's last name.
790
-	 *
791
-	 * @since 1.0.19
792
-	 * @param  string $context View or edit context.
793
-	 * @return string
794
-	 */
795
-	public function get_last_name( $context = 'view' ) {
796
-		return $this->get_prop( 'last_name', $context );
789
+     * Get the customer's last name.
790
+     *
791
+     * @since 1.0.19
792
+     * @param  string $context View or edit context.
793
+     * @return string
794
+     */
795
+    public function get_last_name( $context = 'view' ) {
796
+        return $this->get_prop( 'last_name', $context );
797 797
     }
798 798
 
799 799
     /**
800
-	 * Alias of self::get_last_name().
801
-	 *
802
-	 * @since 1.0.19
803
-	 * @param  string $context View or edit context.
804
-	 * @return int
805
-	 */
806
-	public function get_user_last_name( $context = 'view' ) {
807
-		return $this->get_last_name( $context );
800
+     * Alias of self::get_last_name().
801
+     *
802
+     * @since 1.0.19
803
+     * @param  string $context View or edit context.
804
+     * @return int
805
+     */
806
+    public function get_user_last_name( $context = 'view' ) {
807
+        return $this->get_last_name( $context );
808 808
     }
809 809
 
810 810
     /**
811
-	 * Alias of self::get_last_name().
812
-	 *
813
-	 * @since 1.0.19
814
-	 * @param  string $context View or edit context.
815
-	 * @return int
816
-	 */
817
-	public function get_customer_last_name( $context = 'view' ) {
818
-		return $this->get_last_name( $context );
811
+     * Alias of self::get_last_name().
812
+     *
813
+     * @since 1.0.19
814
+     * @param  string $context View or edit context.
815
+     * @return int
816
+     */
817
+    public function get_customer_last_name( $context = 'view' ) {
818
+        return $this->get_last_name( $context );
819 819
     }
820 820
 
821 821
     /**
822
-	 * Get the customer's full name.
823
-	 *
824
-	 * @since 1.0.19
825
-	 * @param  string $context View or edit context.
826
-	 * @return string
827
-	 */
828
-	public function get_full_name( $context = 'view' ) {
829
-		return trim( $this->get_first_name( $context ) . ' ' . $this->get_last_name( $context ) );
822
+     * Get the customer's full name.
823
+     *
824
+     * @since 1.0.19
825
+     * @param  string $context View or edit context.
826
+     * @return string
827
+     */
828
+    public function get_full_name( $context = 'view' ) {
829
+        return trim( $this->get_first_name( $context ) . ' ' . $this->get_last_name( $context ) );
830 830
     }
831 831
 
832 832
     /**
833
-	 * Alias of self::get_full_name().
834
-	 *
835
-	 * @since 1.0.19
836
-	 * @param  string $context View or edit context.
837
-	 * @return int
838
-	 */
839
-	public function get_user_full_name( $context = 'view' ) {
840
-		return $this->get_full_name( $context );
833
+     * Alias of self::get_full_name().
834
+     *
835
+     * @since 1.0.19
836
+     * @param  string $context View or edit context.
837
+     * @return int
838
+     */
839
+    public function get_user_full_name( $context = 'view' ) {
840
+        return $this->get_full_name( $context );
841 841
     }
842 842
 
843 843
     /**
844
-	 * Alias of self::get_full_name().
845
-	 *
846
-	 * @since 1.0.19
847
-	 * @param  string $context View or edit context.
848
-	 * @return int
849
-	 */
850
-	public function get_customer_full_name( $context = 'view' ) {
851
-		return $this->get_full_name( $context );
844
+     * Alias of self::get_full_name().
845
+     *
846
+     * @since 1.0.19
847
+     * @param  string $context View or edit context.
848
+     * @return int
849
+     */
850
+    public function get_customer_full_name( $context = 'view' ) {
851
+        return $this->get_full_name( $context );
852 852
     }
853 853
 
854 854
     /**
855
-	 * Get the customer's phone number.
856
-	 *
857
-	 * @since 1.0.19
858
-	 * @param  string $context View or edit context.
859
-	 * @return string
860
-	 */
861
-	public function get_phone( $context = 'view' ) {
862
-		return $this->get_prop( 'phone', $context );
855
+     * Get the customer's phone number.
856
+     *
857
+     * @since 1.0.19
858
+     * @param  string $context View or edit context.
859
+     * @return string
860
+     */
861
+    public function get_phone( $context = 'view' ) {
862
+        return $this->get_prop( 'phone', $context );
863 863
     }
864 864
 
865 865
     /**
866
-	 * Alias of self::get_phone().
867
-	 *
868
-	 * @since 1.0.19
869
-	 * @param  string $context View or edit context.
870
-	 * @return int
871
-	 */
872
-	public function get_phone_number( $context = 'view' ) {
873
-		return $this->get_phone( $context );
866
+     * Alias of self::get_phone().
867
+     *
868
+     * @since 1.0.19
869
+     * @param  string $context View or edit context.
870
+     * @return int
871
+     */
872
+    public function get_phone_number( $context = 'view' ) {
873
+        return $this->get_phone( $context );
874 874
     }
875 875
 
876 876
     /**
877
-	 * Alias of self::get_phone().
878
-	 *
879
-	 * @since 1.0.19
880
-	 * @param  string $context View or edit context.
881
-	 * @return int
882
-	 */
883
-	public function get_user_phone( $context = 'view' ) {
884
-		return $this->get_phone( $context );
877
+     * Alias of self::get_phone().
878
+     *
879
+     * @since 1.0.19
880
+     * @param  string $context View or edit context.
881
+     * @return int
882
+     */
883
+    public function get_user_phone( $context = 'view' ) {
884
+        return $this->get_phone( $context );
885 885
     }
886 886
 
887 887
     /**
888
-	 * Alias of self::get_phone().
889
-	 *
890
-	 * @since 1.0.19
891
-	 * @param  string $context View or edit context.
892
-	 * @return int
893
-	 */
894
-	public function get_customer_phone( $context = 'view' ) {
895
-		return $this->get_phone( $context );
888
+     * Alias of self::get_phone().
889
+     *
890
+     * @since 1.0.19
891
+     * @param  string $context View or edit context.
892
+     * @return int
893
+     */
894
+    public function get_customer_phone( $context = 'view' ) {
895
+        return $this->get_phone( $context );
896 896
     }
897 897
 
898 898
     /**
899
-	 * Get the customer's email address.
900
-	 *
901
-	 * @since 1.0.19
902
-	 * @param  string $context View or edit context.
903
-	 * @return string
904
-	 */
905
-	public function get_email( $context = 'view' ) {
906
-		return $this->get_prop( 'email', $context );
899
+     * Get the customer's email address.
900
+     *
901
+     * @since 1.0.19
902
+     * @param  string $context View or edit context.
903
+     * @return string
904
+     */
905
+    public function get_email( $context = 'view' ) {
906
+        return $this->get_prop( 'email', $context );
907 907
     }
908 908
 
909 909
     /**
910
-	 * Alias of self::get_email().
911
-	 *
912
-	 * @since 1.0.19
913
-	 * @param  string $context View or edit context.
914
-	 * @return string
915
-	 */
916
-	public function get_email_address( $context = 'view' ) {
917
-		return $this->get_email( $context );
910
+     * Alias of self::get_email().
911
+     *
912
+     * @since 1.0.19
913
+     * @param  string $context View or edit context.
914
+     * @return string
915
+     */
916
+    public function get_email_address( $context = 'view' ) {
917
+        return $this->get_email( $context );
918 918
     }
919 919
 
920 920
     /**
921
-	 * Alias of self::get_email().
922
-	 *
923
-	 * @since 1.0.19
924
-	 * @param  string $context View or edit context.
925
-	 * @return int
926
-	 */
927
-	public function get_user_email( $context = 'view' ) {
928
-		return $this->get_email( $context );
921
+     * Alias of self::get_email().
922
+     *
923
+     * @since 1.0.19
924
+     * @param  string $context View or edit context.
925
+     * @return int
926
+     */
927
+    public function get_user_email( $context = 'view' ) {
928
+        return $this->get_email( $context );
929 929
     }
930 930
 
931 931
     /**
932
-	 * Alias of self::get_email().
933
-	 *
934
-	 * @since 1.0.19
935
-	 * @param  string $context View or edit context.
936
-	 * @return int
937
-	 */
938
-	public function get_customer_email( $context = 'view' ) {
939
-		return $this->get_email( $context );
932
+     * Alias of self::get_email().
933
+     *
934
+     * @since 1.0.19
935
+     * @param  string $context View or edit context.
936
+     * @return int
937
+     */
938
+    public function get_customer_email( $context = 'view' ) {
939
+        return $this->get_email( $context );
940 940
     }
941 941
 
942 942
     /**
943
-	 * Get the customer's country.
944
-	 *
945
-	 * @since 1.0.19
946
-	 * @param  string $context View or edit context.
947
-	 * @return string
948
-	 */
949
-	public function get_country( $context = 'view' ) {
950
-		$country = $this->get_prop( 'country', $context );
951
-		return empty( $country ) ? wpinv_get_default_country() : $country;
943
+     * Get the customer's country.
944
+     *
945
+     * @since 1.0.19
946
+     * @param  string $context View or edit context.
947
+     * @return string
948
+     */
949
+    public function get_country( $context = 'view' ) {
950
+        $country = $this->get_prop( 'country', $context );
951
+        return empty( $country ) ? wpinv_get_default_country() : $country;
952 952
     }
953 953
 
954 954
     /**
955
-	 * Alias of self::get_country().
956
-	 *
957
-	 * @since 1.0.19
958
-	 * @param  string $context View or edit context.
959
-	 * @return int
960
-	 */
961
-	public function get_user_country( $context = 'view' ) {
962
-		return $this->get_country( $context );
955
+     * Alias of self::get_country().
956
+     *
957
+     * @since 1.0.19
958
+     * @param  string $context View or edit context.
959
+     * @return int
960
+     */
961
+    public function get_user_country( $context = 'view' ) {
962
+        return $this->get_country( $context );
963 963
     }
964 964
 
965 965
     /**
966
-	 * Alias of self::get_country().
967
-	 *
968
-	 * @since 1.0.19
969
-	 * @param  string $context View or edit context.
970
-	 * @return int
971
-	 */
972
-	public function get_customer_country( $context = 'view' ) {
973
-		return $this->get_country( $context );
966
+     * Alias of self::get_country().
967
+     *
968
+     * @since 1.0.19
969
+     * @param  string $context View or edit context.
970
+     * @return int
971
+     */
972
+    public function get_customer_country( $context = 'view' ) {
973
+        return $this->get_country( $context );
974 974
     }
975 975
 
976 976
     /**
977
-	 * Get the customer's state.
978
-	 *
979
-	 * @since 1.0.19
980
-	 * @param  string $context View or edit context.
981
-	 * @return string
982
-	 */
983
-	public function get_state( $context = 'view' ) {
984
-		$state = $this->get_prop( 'state', $context );
985
-		return empty( $state ) ? wpinv_get_default_state() : $state;
977
+     * Get the customer's state.
978
+     *
979
+     * @since 1.0.19
980
+     * @param  string $context View or edit context.
981
+     * @return string
982
+     */
983
+    public function get_state( $context = 'view' ) {
984
+        $state = $this->get_prop( 'state', $context );
985
+        return empty( $state ) ? wpinv_get_default_state() : $state;
986 986
     }
987 987
 
988 988
     /**
989
-	 * Alias of self::get_state().
990
-	 *
991
-	 * @since 1.0.19
992
-	 * @param  string $context View or edit context.
993
-	 * @return int
994
-	 */
995
-	public function get_user_state( $context = 'view' ) {
996
-		return $this->get_state( $context );
989
+     * Alias of self::get_state().
990
+     *
991
+     * @since 1.0.19
992
+     * @param  string $context View or edit context.
993
+     * @return int
994
+     */
995
+    public function get_user_state( $context = 'view' ) {
996
+        return $this->get_state( $context );
997 997
     }
998 998
 
999 999
     /**
1000
-	 * Alias of self::get_state().
1001
-	 *
1002
-	 * @since 1.0.19
1003
-	 * @param  string $context View or edit context.
1004
-	 * @return int
1005
-	 */
1006
-	public function get_customer_state( $context = 'view' ) {
1007
-		return $this->get_state( $context );
1000
+     * Alias of self::get_state().
1001
+     *
1002
+     * @since 1.0.19
1003
+     * @param  string $context View or edit context.
1004
+     * @return int
1005
+     */
1006
+    public function get_customer_state( $context = 'view' ) {
1007
+        return $this->get_state( $context );
1008 1008
     }
1009 1009
 
1010 1010
     /**
1011
-	 * Get the customer's city.
1012
-	 *
1013
-	 * @since 1.0.19
1014
-	 * @param  string $context View or edit context.
1015
-	 * @return string
1016
-	 */
1017
-	public function get_city( $context = 'view' ) {
1018
-		return $this->get_prop( 'city', $context );
1011
+     * Get the customer's city.
1012
+     *
1013
+     * @since 1.0.19
1014
+     * @param  string $context View or edit context.
1015
+     * @return string
1016
+     */
1017
+    public function get_city( $context = 'view' ) {
1018
+        return $this->get_prop( 'city', $context );
1019 1019
     }
1020 1020
 
1021 1021
     /**
1022
-	 * Alias of self::get_city().
1023
-	 *
1024
-	 * @since 1.0.19
1025
-	 * @param  string $context View or edit context.
1026
-	 * @return string
1027
-	 */
1028
-	public function get_user_city( $context = 'view' ) {
1029
-		return $this->get_city( $context );
1022
+     * Alias of self::get_city().
1023
+     *
1024
+     * @since 1.0.19
1025
+     * @param  string $context View or edit context.
1026
+     * @return string
1027
+     */
1028
+    public function get_user_city( $context = 'view' ) {
1029
+        return $this->get_city( $context );
1030 1030
     }
1031 1031
 
1032 1032
     /**
1033
-	 * Alias of self::get_city().
1034
-	 *
1035
-	 * @since 1.0.19
1036
-	 * @param  string $context View or edit context.
1037
-	 * @return string
1038
-	 */
1039
-	public function get_customer_city( $context = 'view' ) {
1040
-		return $this->get_city( $context );
1033
+     * Alias of self::get_city().
1034
+     *
1035
+     * @since 1.0.19
1036
+     * @param  string $context View or edit context.
1037
+     * @return string
1038
+     */
1039
+    public function get_customer_city( $context = 'view' ) {
1040
+        return $this->get_city( $context );
1041 1041
     }
1042 1042
 
1043 1043
     /**
1044
-	 * Get the customer's zip.
1045
-	 *
1046
-	 * @since 1.0.19
1047
-	 * @param  string $context View or edit context.
1048
-	 * @return string
1049
-	 */
1050
-	public function get_zip( $context = 'view' ) {
1051
-		return $this->get_prop( 'zip', $context );
1044
+     * Get the customer's zip.
1045
+     *
1046
+     * @since 1.0.19
1047
+     * @param  string $context View or edit context.
1048
+     * @return string
1049
+     */
1050
+    public function get_zip( $context = 'view' ) {
1051
+        return $this->get_prop( 'zip', $context );
1052 1052
     }
1053 1053
 
1054 1054
     /**
1055
-	 * Alias of self::get_zip().
1056
-	 *
1057
-	 * @since 1.0.19
1058
-	 * @param  string $context View or edit context.
1059
-	 * @return string
1060
-	 */
1061
-	public function get_user_zip( $context = 'view' ) {
1062
-		return $this->get_zip( $context );
1055
+     * Alias of self::get_zip().
1056
+     *
1057
+     * @since 1.0.19
1058
+     * @param  string $context View or edit context.
1059
+     * @return string
1060
+     */
1061
+    public function get_user_zip( $context = 'view' ) {
1062
+        return $this->get_zip( $context );
1063 1063
     }
1064 1064
 
1065 1065
     /**
1066
-	 * Alias of self::get_zip().
1067
-	 *
1068
-	 * @since 1.0.19
1069
-	 * @param  string $context View or edit context.
1070
-	 * @return string
1071
-	 */
1072
-	public function get_customer_zip( $context = 'view' ) {
1073
-		return $this->get_zip( $context );
1066
+     * Alias of self::get_zip().
1067
+     *
1068
+     * @since 1.0.19
1069
+     * @param  string $context View or edit context.
1070
+     * @return string
1071
+     */
1072
+    public function get_customer_zip( $context = 'view' ) {
1073
+        return $this->get_zip( $context );
1074 1074
     }
1075 1075
 
1076 1076
     /**
1077
-	 * Get the customer's company.
1078
-	 *
1079
-	 * @since 1.0.19
1080
-	 * @param  string $context View or edit context.
1081
-	 * @return string
1082
-	 */
1083
-	public function get_company( $context = 'view' ) {
1084
-		return $this->get_prop( 'company', $context );
1077
+     * Get the customer's company.
1078
+     *
1079
+     * @since 1.0.19
1080
+     * @param  string $context View or edit context.
1081
+     * @return string
1082
+     */
1083
+    public function get_company( $context = 'view' ) {
1084
+        return $this->get_prop( 'company', $context );
1085 1085
     }
1086 1086
 
1087 1087
     /**
1088
-	 * Alias of self::get_company().
1089
-	 *
1090
-	 * @since 1.0.19
1091
-	 * @param  string $context View or edit context.
1092
-	 * @return string
1093
-	 */
1094
-	public function get_user_company( $context = 'view' ) {
1095
-		return $this->get_company( $context );
1088
+     * Alias of self::get_company().
1089
+     *
1090
+     * @since 1.0.19
1091
+     * @param  string $context View or edit context.
1092
+     * @return string
1093
+     */
1094
+    public function get_user_company( $context = 'view' ) {
1095
+        return $this->get_company( $context );
1096 1096
     }
1097 1097
 
1098 1098
     /**
1099
-	 * Alias of self::get_company().
1100
-	 *
1101
-	 * @since 1.0.19
1102
-	 * @param  string $context View or edit context.
1103
-	 * @return string
1104
-	 */
1105
-	public function get_customer_company( $context = 'view' ) {
1106
-		return $this->get_company( $context );
1099
+     * Alias of self::get_company().
1100
+     *
1101
+     * @since 1.0.19
1102
+     * @param  string $context View or edit context.
1103
+     * @return string
1104
+     */
1105
+    public function get_customer_company( $context = 'view' ) {
1106
+        return $this->get_company( $context );
1107 1107
     }
1108 1108
 
1109 1109
     /**
1110
-	 * Get the customer's vat number.
1111
-	 *
1112
-	 * @since 1.0.19
1113
-	 * @param  string $context View or edit context.
1114
-	 * @return string
1115
-	 */
1116
-	public function get_vat_number( $context = 'view' ) {
1117
-		return $this->get_prop( 'vat_number', $context );
1110
+     * Get the customer's vat number.
1111
+     *
1112
+     * @since 1.0.19
1113
+     * @param  string $context View or edit context.
1114
+     * @return string
1115
+     */
1116
+    public function get_vat_number( $context = 'view' ) {
1117
+        return $this->get_prop( 'vat_number', $context );
1118 1118
     }
1119 1119
 
1120 1120
     /**
1121
-	 * Alias of self::get_vat_number().
1122
-	 *
1123
-	 * @since 1.0.19
1124
-	 * @param  string $context View or edit context.
1125
-	 * @return string
1126
-	 */
1127
-	public function get_user_vat_number( $context = 'view' ) {
1128
-		return $this->get_vat_number( $context );
1121
+     * Alias of self::get_vat_number().
1122
+     *
1123
+     * @since 1.0.19
1124
+     * @param  string $context View or edit context.
1125
+     * @return string
1126
+     */
1127
+    public function get_user_vat_number( $context = 'view' ) {
1128
+        return $this->get_vat_number( $context );
1129 1129
     }
1130 1130
 
1131 1131
     /**
1132
-	 * Alias of self::get_vat_number().
1133
-	 *
1134
-	 * @since 1.0.19
1135
-	 * @param  string $context View or edit context.
1136
-	 * @return string
1137
-	 */
1138
-	public function get_customer_vat_number( $context = 'view' ) {
1139
-		return $this->get_vat_number( $context );
1132
+     * Alias of self::get_vat_number().
1133
+     *
1134
+     * @since 1.0.19
1135
+     * @param  string $context View or edit context.
1136
+     * @return string
1137
+     */
1138
+    public function get_customer_vat_number( $context = 'view' ) {
1139
+        return $this->get_vat_number( $context );
1140 1140
     }
1141 1141
 
1142 1142
     /**
1143
-	 * Get the customer's vat rate.
1144
-	 *
1145
-	 * @since 1.0.19
1146
-	 * @param  string $context View or edit context.
1147
-	 * @return string
1148
-	 */
1149
-	public function get_vat_rate( $context = 'view' ) {
1150
-		return $this->get_prop( 'vat_rate', $context );
1143
+     * Get the customer's vat rate.
1144
+     *
1145
+     * @since 1.0.19
1146
+     * @param  string $context View or edit context.
1147
+     * @return string
1148
+     */
1149
+    public function get_vat_rate( $context = 'view' ) {
1150
+        return $this->get_prop( 'vat_rate', $context );
1151 1151
     }
1152 1152
 
1153 1153
     /**
1154
-	 * Alias of self::get_vat_rate().
1155
-	 *
1156
-	 * @since 1.0.19
1157
-	 * @param  string $context View or edit context.
1158
-	 * @return string
1159
-	 */
1160
-	public function get_user_vat_rate( $context = 'view' ) {
1161
-		return $this->get_vat_rate( $context );
1154
+     * Alias of self::get_vat_rate().
1155
+     *
1156
+     * @since 1.0.19
1157
+     * @param  string $context View or edit context.
1158
+     * @return string
1159
+     */
1160
+    public function get_user_vat_rate( $context = 'view' ) {
1161
+        return $this->get_vat_rate( $context );
1162
+    }
1163
+
1164
+    /**
1165
+     * Alias of self::get_vat_rate().
1166
+     *
1167
+     * @since 1.0.19
1168
+     * @param  string $context View or edit context.
1169
+     * @return string
1170
+     */
1171
+    public function get_customer_vat_rate( $context = 'view' ) {
1172
+        return $this->get_vat_rate( $context );
1173
+    }
1174
+
1175
+    /**
1176
+     * Get the customer's address.
1177
+     *
1178
+     * @since 1.0.19
1179
+     * @param  string $context View or edit context.
1180
+     * @return string
1181
+     */
1182
+    public function get_address( $context = 'view' ) {
1183
+        return $this->get_prop( 'address', $context );
1184
+    }
1185
+
1186
+    /**
1187
+     * Alias of self::get_address().
1188
+     *
1189
+     * @since 1.0.19
1190
+     * @param  string $context View or edit context.
1191
+     * @return string
1192
+     */
1193
+    public function get_user_address( $context = 'view' ) {
1194
+        return $this->get_address( $context );
1195
+    }
1196
+
1197
+    /**
1198
+     * Alias of self::get_address().
1199
+     *
1200
+     * @since 1.0.19
1201
+     * @param  string $context View or edit context.
1202
+     * @return string
1203
+     */
1204
+    public function get_customer_address( $context = 'view' ) {
1205
+        return $this->get_address( $context );
1206
+    }
1207
+
1208
+    /**
1209
+     * Get whether the customer has viewed the invoice or not.
1210
+     *
1211
+     * @since 1.0.19
1212
+     * @param  string $context View or edit context.
1213
+     * @return bool
1214
+     */
1215
+    public function get_is_viewed( $context = 'view' ) {
1216
+        return (bool) $this->get_prop( 'is_viewed', $context );
1217
+    }
1218
+
1219
+    /**
1220
+     * Get other recipients for invoice communications.
1221
+     *
1222
+     * @since 1.0.19
1223
+     * @param  string $context View or edit context.
1224
+     * @return bool
1225
+     */
1226
+    public function get_email_cc( $context = 'view' ) {
1227
+        return $this->get_prop( 'email_cc', $context );
1228
+    }
1229
+
1230
+    /**
1231
+     * Get invoice template.
1232
+     *
1233
+     * @since 1.0.19
1234
+     * @param  string $context View or edit context.
1235
+     * @return bool
1236
+     */
1237
+    public function get_template( $context = 'view' ) {
1238
+        return $this->get_prop( 'template', $context );
1239
+    }
1240
+
1241
+    /**
1242
+     * Get whether the customer has confirmed their address.
1243
+     *
1244
+     * @since 1.0.19
1245
+     * @param  string $context View or edit context.
1246
+     * @return bool
1247
+     */
1248
+    public function get_address_confirmed( $context = 'view' ) {
1249
+        return (bool) $this->get_prop( 'address_confirmed', $context );
1250
+    }
1251
+
1252
+    /**
1253
+     * Alias of self::get_address_confirmed().
1254
+     *
1255
+     * @since 1.0.19
1256
+     * @param  string $context View or edit context.
1257
+     * @return bool
1258
+     */
1259
+    public function get_user_address_confirmed( $context = 'view' ) {
1260
+        return $this->get_address_confirmed( $context );
1162 1261
     }
1163 1262
 
1164 1263
     /**
1165
-	 * Alias of self::get_vat_rate().
1166
-	 *
1167
-	 * @since 1.0.19
1168
-	 * @param  string $context View or edit context.
1169
-	 * @return string
1170
-	 */
1171
-	public function get_customer_vat_rate( $context = 'view' ) {
1172
-		return $this->get_vat_rate( $context );
1264
+     * Alias of self::get_address().
1265
+     *
1266
+     * @since 1.0.19
1267
+     * @param  string $context View or edit context.
1268
+     * @return bool
1269
+     */
1270
+    public function get_customer_address_confirmed( $context = 'view' ) {
1271
+        return $this->get_address_confirmed( $context );
1173 1272
     }
1174 1273
 
1175 1274
     /**
1176
-	 * Get the customer's address.
1177
-	 *
1178
-	 * @since 1.0.19
1179
-	 * @param  string $context View or edit context.
1180
-	 * @return string
1181
-	 */
1182
-	public function get_address( $context = 'view' ) {
1183
-		return $this->get_prop( 'address', $context );
1184
-    }
1185
-
1186
-    /**
1187
-	 * Alias of self::get_address().
1188
-	 *
1189
-	 * @since 1.0.19
1190
-	 * @param  string $context View or edit context.
1191
-	 * @return string
1192
-	 */
1193
-	public function get_user_address( $context = 'view' ) {
1194
-		return $this->get_address( $context );
1195
-    }
1196
-
1197
-    /**
1198
-	 * Alias of self::get_address().
1199
-	 *
1200
-	 * @since 1.0.19
1201
-	 * @param  string $context View or edit context.
1202
-	 * @return string
1203
-	 */
1204
-	public function get_customer_address( $context = 'view' ) {
1205
-		return $this->get_address( $context );
1206
-    }
1207
-
1208
-    /**
1209
-	 * Get whether the customer has viewed the invoice or not.
1210
-	 *
1211
-	 * @since 1.0.19
1212
-	 * @param  string $context View or edit context.
1213
-	 * @return bool
1214
-	 */
1215
-	public function get_is_viewed( $context = 'view' ) {
1216
-		return (bool) $this->get_prop( 'is_viewed', $context );
1217
-	}
1218
-
1219
-	/**
1220
-	 * Get other recipients for invoice communications.
1221
-	 *
1222
-	 * @since 1.0.19
1223
-	 * @param  string $context View or edit context.
1224
-	 * @return bool
1225
-	 */
1226
-	public function get_email_cc( $context = 'view' ) {
1227
-		return $this->get_prop( 'email_cc', $context );
1228
-	}
1229
-
1230
-	/**
1231
-	 * Get invoice template.
1232
-	 *
1233
-	 * @since 1.0.19
1234
-	 * @param  string $context View or edit context.
1235
-	 * @return bool
1236
-	 */
1237
-	public function get_template( $context = 'view' ) {
1238
-		return $this->get_prop( 'template', $context );
1239
-	}
1240
-
1241
-	/**
1242
-	 * Get whether the customer has confirmed their address.
1243
-	 *
1244
-	 * @since 1.0.19
1245
-	 * @param  string $context View or edit context.
1246
-	 * @return bool
1247
-	 */
1248
-	public function get_address_confirmed( $context = 'view' ) {
1249
-		return (bool) $this->get_prop( 'address_confirmed', $context );
1250
-    }
1251
-
1252
-    /**
1253
-	 * Alias of self::get_address_confirmed().
1254
-	 *
1255
-	 * @since 1.0.19
1256
-	 * @param  string $context View or edit context.
1257
-	 * @return bool
1258
-	 */
1259
-	public function get_user_address_confirmed( $context = 'view' ) {
1260
-		return $this->get_address_confirmed( $context );
1261
-    }
1262
-
1263
-    /**
1264
-	 * Alias of self::get_address().
1265
-	 *
1266
-	 * @since 1.0.19
1267
-	 * @param  string $context View or edit context.
1268
-	 * @return bool
1269
-	 */
1270
-	public function get_customer_address_confirmed( $context = 'view' ) {
1271
-		return $this->get_address_confirmed( $context );
1272
-    }
1273
-
1274
-    /**
1275
-	 * Get the invoice subtotal.
1276
-	 *
1277
-	 * @since 1.0.19
1278
-	 * @param  string $context View or edit context.
1279
-	 * @return float
1280
-	 */
1281
-	public function get_subtotal( $context = 'view' ) {
1275
+     * Get the invoice subtotal.
1276
+     *
1277
+     * @since 1.0.19
1278
+     * @param  string $context View or edit context.
1279
+     * @return float
1280
+     */
1281
+    public function get_subtotal( $context = 'view' ) {
1282 1282
         $subtotal = (float) $this->get_prop( 'subtotal', $context );
1283 1283
 
1284 1284
         // Backwards compatibility.
@@ -1290,155 +1290,155 @@  discard block
 block discarded – undo
1290 1290
     }
1291 1291
 
1292 1292
     /**
1293
-	 * Get the invoice discount total.
1294
-	 *
1295
-	 * @since 1.0.19
1296
-	 * @param  string $context View or edit context.
1297
-	 * @return float
1298
-	 */
1299
-	public function get_total_discount( $context = 'view' ) {
1300
-		return (float) $this->get_prop( 'total_discount', $context );
1293
+     * Get the invoice discount total.
1294
+     *
1295
+     * @since 1.0.19
1296
+     * @param  string $context View or edit context.
1297
+     * @return float
1298
+     */
1299
+    public function get_total_discount( $context = 'view' ) {
1300
+        return (float) $this->get_prop( 'total_discount', $context );
1301 1301
     }
1302 1302
 
1303 1303
     /**
1304
-	 * Get the invoice tax total.
1305
-	 *
1306
-	 * @since 1.0.19
1307
-	 * @param  string $context View or edit context.
1308
-	 * @return float
1309
-	 */
1310
-	public function get_total_tax( $context = 'view' ) {
1311
-		return (float) $this->get_prop( 'total_tax', $context );
1312
-	}
1304
+     * Get the invoice tax total.
1305
+     *
1306
+     * @since 1.0.19
1307
+     * @param  string $context View or edit context.
1308
+     * @return float
1309
+     */
1310
+    public function get_total_tax( $context = 'view' ) {
1311
+        return (float) $this->get_prop( 'total_tax', $context );
1312
+    }
1313 1313
 
1314
-	/**
1315
-	 * @deprecated
1316
-	 */
1317
-	public function get_final_tax( $currency = false ) {
1318
-		$tax = $this->get_total_tax();
1314
+    /**
1315
+     * @deprecated
1316
+     */
1317
+    public function get_final_tax( $currency = false ) {
1318
+        $tax = $this->get_total_tax();
1319 1319
 
1320 1320
         if ( $currency ) {
1321
-			return wpinv_price( wpinv_format_amount( $tax, NULL, false ), $this->get_currency() );
1321
+            return wpinv_price( wpinv_format_amount( $tax, NULL, false ), $this->get_currency() );
1322 1322
         }
1323 1323
 
1324 1324
         return $tax;
1325 1325
     }
1326 1326
 
1327 1327
     /**
1328
-	 * Get the invoice fees total.
1329
-	 *
1330
-	 * @since 1.0.19
1331
-	 * @param  string $context View or edit context.
1332
-	 * @return float
1333
-	 */
1334
-	public function get_total_fees( $context = 'view' ) {
1335
-		return (float) $this->get_prop( 'total_fees', $context );
1328
+     * Get the invoice fees total.
1329
+     *
1330
+     * @since 1.0.19
1331
+     * @param  string $context View or edit context.
1332
+     * @return float
1333
+     */
1334
+    public function get_total_fees( $context = 'view' ) {
1335
+        return (float) $this->get_prop( 'total_fees', $context );
1336 1336
     }
1337 1337
 
1338 1338
     /**
1339
-	 * Alias for self::get_total_fees().
1340
-	 *
1341
-	 * @since 1.0.19
1342
-	 * @param  string $context View or edit context.
1343
-	 * @return float
1344
-	 */
1345
-	public function get_fees_total( $context = 'view' ) {
1346
-		return $this->get_total_fees( $context );
1339
+     * Alias for self::get_total_fees().
1340
+     *
1341
+     * @since 1.0.19
1342
+     * @param  string $context View or edit context.
1343
+     * @return float
1344
+     */
1345
+    public function get_fees_total( $context = 'view' ) {
1346
+        return $this->get_total_fees( $context );
1347 1347
     }
1348 1348
 
1349 1349
     /**
1350
-	 * Get the invoice total.
1351
-	 *
1352
-	 * @since 1.0.19
1350
+     * Get the invoice total.
1351
+     *
1352
+     * @since 1.0.19
1353 1353
      * @return float
1354
-	 */
1355
-	public function get_total() {
1356
-		$total = $this->is_renewal() ? $this->get_recurring_total() : $this->get_initial_total();
1357
-		return apply_filters( 'getpaid_get_invoice_total_amount', $total, $this  );
1354
+     */
1355
+    public function get_total() {
1356
+        $total = $this->is_renewal() ? $this->get_recurring_total() : $this->get_initial_total();
1357
+        return apply_filters( 'getpaid_get_invoice_total_amount', $total, $this  );
1358 1358
     }
1359 1359
 
1360 1360
     /**
1361
-	 * Get the initial invoice total.
1362
-	 *
1363
-	 * @since 1.0.19
1361
+     * Get the initial invoice total.
1362
+     *
1363
+     * @since 1.0.19
1364 1364
      * @param  string $context View or edit context.
1365 1365
      * @return float
1366
-	 */
1366
+     */
1367 1367
     public function get_initial_total() {
1368 1368
 
1369
-		if ( empty( $this->totals ) ) {
1370
-			$this->recalculate_total();
1371
-		}
1369
+        if ( empty( $this->totals ) ) {
1370
+            $this->recalculate_total();
1371
+        }
1372 1372
 
1373
-		$tax      = $this->totals['tax']['initial'];
1374
-		$fee      = $this->totals['fee']['initial'];
1375
-		$discount = $this->totals['discount']['initial'];
1376
-		$subtotal = $this->totals['subtotal']['initial'];
1377
-		$total    = $tax + $fee - $discount + $subtotal;
1373
+        $tax      = $this->totals['tax']['initial'];
1374
+        $fee      = $this->totals['fee']['initial'];
1375
+        $discount = $this->totals['discount']['initial'];
1376
+        $subtotal = $this->totals['subtotal']['initial'];
1377
+        $total    = $tax + $fee - $discount + $subtotal;
1378 1378
 
1379
-		if ( 0 > $total ) {
1380
-			$total = 0;
1381
-		}
1379
+        if ( 0 > $total ) {
1380
+            $total = 0;
1381
+        }
1382 1382
 
1383 1383
         return apply_filters( 'wpinv_get_initial_invoice_total', $total, $this );
1384
-	}
1384
+    }
1385 1385
 
1386
-	/**
1387
-	 * Get the recurring invoice total.
1388
-	 *
1389
-	 * @since 1.0.19
1386
+    /**
1387
+     * Get the recurring invoice total.
1388
+     *
1389
+     * @since 1.0.19
1390 1390
      * @param  string $context View or edit context.
1391 1391
      * @return float
1392
-	 */
1392
+     */
1393 1393
     public function get_recurring_total() {
1394 1394
 
1395
-		if ( empty( $this->totals ) ) {
1396
-			$this->recalculate_total();
1397
-		}
1395
+        if ( empty( $this->totals ) ) {
1396
+            $this->recalculate_total();
1397
+        }
1398 1398
 
1399
-		$tax      = $this->totals['tax']['recurring'];
1400
-		$fee      = $this->totals['fee']['recurring'];
1401
-		$discount = $this->totals['discount']['recurring'];
1402
-		$subtotal = $this->totals['subtotal']['recurring'];
1403
-		$total    = $tax + $fee - $discount + $subtotal;
1399
+        $tax      = $this->totals['tax']['recurring'];
1400
+        $fee      = $this->totals['fee']['recurring'];
1401
+        $discount = $this->totals['discount']['recurring'];
1402
+        $subtotal = $this->totals['subtotal']['recurring'];
1403
+        $total    = $tax + $fee - $discount + $subtotal;
1404 1404
 
1405
-		if ( 0 > $total ) {
1406
-			$total = 0;
1407
-		}
1405
+        if ( 0 > $total ) {
1406
+            $total = 0;
1407
+        }
1408 1408
 
1409 1409
         return apply_filters( 'wpinv_get_recurring_invoice_total', $total, $this );
1410
-	}
1410
+    }
1411 1411
 
1412
-	/**
1413
-	 * Returns recurring payment details.
1414
-	 *
1415
-	 * @since 1.0.19
1412
+    /**
1413
+     * Returns recurring payment details.
1414
+     *
1415
+     * @since 1.0.19
1416 1416
      * @param  string $field Optionally provide a field to return.
1417
-	 * @param string $currency Whether to include the currency.
1417
+     * @param string $currency Whether to include the currency.
1418 1418
      * @return float
1419
-	 */
1419
+     */
1420 1420
     public function get_recurring_details( $field = '', $currency = false ) {
1421 1421
 
1422
-		// Maybe recalculate totals.
1423
-		if ( empty( $this->totals ) ) {
1424
-			$this->recalculate_total();
1425
-		}
1422
+        // Maybe recalculate totals.
1423
+        if ( empty( $this->totals ) ) {
1424
+            $this->recalculate_total();
1425
+        }
1426 1426
 
1427
-		// Prepare recurring totals.
1427
+        // Prepare recurring totals.
1428 1428
         $data = apply_filters(
1429
-			'wpinv_get_invoice_recurring_details',
1430
-			array(
1431
-				'cart_details' => $this->get_cart_details(),
1432
-				'subtotal'     => $this->totals['subtotal']['recurring'],
1433
-				'discount'     => $this->totals['discount']['recurring'],
1434
-				'tax'          => $this->totals['tax']['recurring'],
1435
-				'fee'          => $this->totals['fee']['recurring'],
1436
-				'total'        => $this->get_recurring_total(),
1437
-			),
1438
-			$this,
1439
-			$field,
1440
-			$currency
1441
-		);
1429
+            'wpinv_get_invoice_recurring_details',
1430
+            array(
1431
+                'cart_details' => $this->get_cart_details(),
1432
+                'subtotal'     => $this->totals['subtotal']['recurring'],
1433
+                'discount'     => $this->totals['discount']['recurring'],
1434
+                'tax'          => $this->totals['tax']['recurring'],
1435
+                'fee'          => $this->totals['fee']['recurring'],
1436
+                'total'        => $this->get_recurring_total(),
1437
+            ),
1438
+            $this,
1439
+            $field,
1440
+            $currency
1441
+        );
1442 1442
 
1443 1443
         if ( isset( $data[$field] ) ) {
1444 1444
             return ( $currency ? wpinv_price( $data[$field], $this->get_currency() ) : $data[$field] );
@@ -1448,145 +1448,145 @@  discard block
 block discarded – undo
1448 1448
     }
1449 1449
 
1450 1450
     /**
1451
-	 * Get the invoice fees.
1452
-	 *
1453
-	 * @since 1.0.19
1454
-	 * @param  string $context View or edit context.
1455
-	 * @return array
1456
-	 */
1457
-	public function get_fees( $context = 'view' ) {
1458
-		return wpinv_parse_list( $this->get_prop( 'fees', $context ) );
1451
+     * Get the invoice fees.
1452
+     *
1453
+     * @since 1.0.19
1454
+     * @param  string $context View or edit context.
1455
+     * @return array
1456
+     */
1457
+    public function get_fees( $context = 'view' ) {
1458
+        return wpinv_parse_list( $this->get_prop( 'fees', $context ) );
1459 1459
     }
1460 1460
 
1461 1461
     /**
1462
-	 * Get the invoice discounts.
1463
-	 *
1464
-	 * @since 1.0.19
1465
-	 * @param  string $context View or edit context.
1466
-	 * @return array
1467
-	 */
1468
-	public function get_discounts( $context = 'view' ) {
1469
-		return wpinv_parse_list( $this->get_prop( 'discounts', $context ) );
1462
+     * Get the invoice discounts.
1463
+     *
1464
+     * @since 1.0.19
1465
+     * @param  string $context View or edit context.
1466
+     * @return array
1467
+     */
1468
+    public function get_discounts( $context = 'view' ) {
1469
+        return wpinv_parse_list( $this->get_prop( 'discounts', $context ) );
1470 1470
     }
1471 1471
 
1472 1472
     /**
1473
-	 * Get the invoice taxes.
1474
-	 *
1475
-	 * @since 1.0.19
1476
-	 * @param  string $context View or edit context.
1477
-	 * @return array
1478
-	 */
1479
-	public function get_taxes( $context = 'view' ) {
1480
-		return wpinv_parse_list( $this->get_prop( 'taxes', $context ) );
1473
+     * Get the invoice taxes.
1474
+     *
1475
+     * @since 1.0.19
1476
+     * @param  string $context View or edit context.
1477
+     * @return array
1478
+     */
1479
+    public function get_taxes( $context = 'view' ) {
1480
+        return wpinv_parse_list( $this->get_prop( 'taxes', $context ) );
1481 1481
     }
1482 1482
 
1483 1483
     /**
1484
-	 * Get the invoice items.
1485
-	 *
1486
-	 * @since 1.0.19
1487
-	 * @param  string $context View or edit context.
1488
-	 * @return GetPaid_Form_Item[]
1489
-	 */
1490
-	public function get_items( $context = 'view' ) {
1484
+     * Get the invoice items.
1485
+     *
1486
+     * @since 1.0.19
1487
+     * @param  string $context View or edit context.
1488
+     * @return GetPaid_Form_Item[]
1489
+     */
1490
+    public function get_items( $context = 'view' ) {
1491 1491
         return $this->get_prop( 'items', $context );
1492 1492
     }
1493 1493
 
1494 1494
     /**
1495
-	 * Get the invoice's payment form.
1496
-	 *
1497
-	 * @since 1.0.19
1498
-	 * @param  string $context View or edit context.
1499
-	 * @return int
1500
-	 */
1501
-	public function get_payment_form( $context = 'view' ) {
1502
-		return intval( $this->get_prop( 'payment_form', $context ) );
1495
+     * Get the invoice's payment form.
1496
+     *
1497
+     * @since 1.0.19
1498
+     * @param  string $context View or edit context.
1499
+     * @return int
1500
+     */
1501
+    public function get_payment_form( $context = 'view' ) {
1502
+        return intval( $this->get_prop( 'payment_form', $context ) );
1503 1503
     }
1504 1504
 
1505 1505
     /**
1506
-	 * Get the invoice's submission id.
1507
-	 *
1508
-	 * @since 1.0.19
1509
-	 * @param  string $context View or edit context.
1510
-	 * @return string
1511
-	 */
1512
-	public function get_submission_id( $context = 'view' ) {
1513
-		return $this->get_prop( 'submission_id', $context );
1506
+     * Get the invoice's submission id.
1507
+     *
1508
+     * @since 1.0.19
1509
+     * @param  string $context View or edit context.
1510
+     * @return string
1511
+     */
1512
+    public function get_submission_id( $context = 'view' ) {
1513
+        return $this->get_prop( 'submission_id', $context );
1514 1514
     }
1515 1515
 
1516 1516
     /**
1517
-	 * Get the invoice's discount code.
1518
-	 *
1519
-	 * @since 1.0.19
1520
-	 * @param  string $context View or edit context.
1521
-	 * @return string
1522
-	 */
1523
-	public function get_discount_code( $context = 'view' ) {
1524
-		return $this->get_prop( 'discount_code', $context );
1517
+     * Get the invoice's discount code.
1518
+     *
1519
+     * @since 1.0.19
1520
+     * @param  string $context View or edit context.
1521
+     * @return string
1522
+     */
1523
+    public function get_discount_code( $context = 'view' ) {
1524
+        return $this->get_prop( 'discount_code', $context );
1525 1525
     }
1526 1526
 
1527 1527
     /**
1528
-	 * Get the invoice's gateway.
1529
-	 *
1530
-	 * @since 1.0.19
1531
-	 * @param  string $context View or edit context.
1532
-	 * @return string
1533
-	 */
1534
-	public function get_gateway( $context = 'view' ) {
1535
-		return $this->get_prop( 'gateway', $context );
1528
+     * Get the invoice's gateway.
1529
+     *
1530
+     * @since 1.0.19
1531
+     * @param  string $context View or edit context.
1532
+     * @return string
1533
+     */
1534
+    public function get_gateway( $context = 'view' ) {
1535
+        return $this->get_prop( 'gateway', $context );
1536 1536
     }
1537 1537
 
1538 1538
     /**
1539
-	 * Get the invoice's gateway display title.
1540
-	 *
1541
-	 * @since 1.0.19
1542
-	 * @return string
1543
-	 */
1539
+     * Get the invoice's gateway display title.
1540
+     *
1541
+     * @since 1.0.19
1542
+     * @return string
1543
+     */
1544 1544
     public function get_gateway_title() {
1545 1545
         $title =  wpinv_get_gateway_checkout_label( $this->get_gateway() );
1546 1546
         return apply_filters( 'wpinv_gateway_title', $title, $this->ID, $this );
1547 1547
     }
1548 1548
 
1549 1549
     /**
1550
-	 * Get the invoice's transaction id.
1551
-	 *
1552
-	 * @since 1.0.19
1553
-	 * @param  string $context View or edit context.
1554
-	 * @return string
1555
-	 */
1556
-	public function get_transaction_id( $context = 'view' ) {
1557
-		return $this->get_prop( 'transaction_id', $context );
1550
+     * Get the invoice's transaction id.
1551
+     *
1552
+     * @since 1.0.19
1553
+     * @param  string $context View or edit context.
1554
+     * @return string
1555
+     */
1556
+    public function get_transaction_id( $context = 'view' ) {
1557
+        return $this->get_prop( 'transaction_id', $context );
1558 1558
     }
1559 1559
 
1560 1560
     /**
1561
-	 * Get the invoice's currency.
1562
-	 *
1563
-	 * @since 1.0.19
1564
-	 * @param  string $context View or edit context.
1565
-	 * @return string
1566
-	 */
1567
-	public function get_currency( $context = 'view' ) {
1561
+     * Get the invoice's currency.
1562
+     *
1563
+     * @since 1.0.19
1564
+     * @param  string $context View or edit context.
1565
+     * @return string
1566
+     */
1567
+    public function get_currency( $context = 'view' ) {
1568 1568
         $currency = $this->get_prop( 'currency', $context );
1569 1569
         return empty( $currency ) ? wpinv_get_currency() : $currency;
1570 1570
     }
1571 1571
 
1572 1572
     /**
1573
-	 * Checks if we are charging taxes for this invoice.
1574
-	 *
1575
-	 * @since 1.0.19
1576
-	 * @param  string $context View or edit context.
1577
-	 * @return bool
1578
-	 */
1579
-	public function get_disable_taxes( $context = 'view' ) {
1573
+     * Checks if we are charging taxes for this invoice.
1574
+     *
1575
+     * @since 1.0.19
1576
+     * @param  string $context View or edit context.
1577
+     * @return bool
1578
+     */
1579
+    public function get_disable_taxes( $context = 'view' ) {
1580 1580
         return (bool) $this->get_prop( 'disable_taxes', $context );
1581 1581
     }
1582 1582
 
1583 1583
     /**
1584
-	 * Retrieves the subscription id for an invoice.
1585
-	 *
1586
-	 * @since 1.0.19
1587
-	 * @param  string $context View or edit context.
1588
-	 * @return int
1589
-	 */
1584
+     * Retrieves the subscription id for an invoice.
1585
+     *
1586
+     * @since 1.0.19
1587
+     * @param  string $context View or edit context.
1588
+     * @return int
1589
+     */
1590 1590
     public function get_subscription_id( $context = 'view' ) {
1591 1591
         $subscription_id = $this->get_prop( 'subscription_id', $context );
1592 1592
 
@@ -1599,12 +1599,12 @@  discard block
 block discarded – undo
1599 1599
     }
1600 1600
 
1601 1601
     /**
1602
-	 * Retrieves the payment meta for an invoice.
1603
-	 *
1604
-	 * @since 1.0.19
1605
-	 * @param  string $context View or edit context.
1606
-	 * @return array
1607
-	 */
1602
+     * Retrieves the payment meta for an invoice.
1603
+     *
1604
+     * @since 1.0.19
1605
+     * @param  string $context View or edit context.
1606
+     * @return array
1607
+     */
1608 1608
     public function get_payment_meta( $context = 'view' ) {
1609 1609
 
1610 1610
         return array(
@@ -1624,11 +1624,11 @@  discard block
 block discarded – undo
1624 1624
     }
1625 1625
 
1626 1626
     /**
1627
-	 * Retrieves the cart details for an invoice.
1628
-	 *
1629
-	 * @since 1.0.19
1630
-	 * @return array
1631
-	 */
1627
+     * Retrieves the cart details for an invoice.
1628
+     *
1629
+     * @since 1.0.19
1630
+     * @return array
1631
+     */
1632 1632
     public function get_cart_details() {
1633 1633
         $items        = $this->get_items();
1634 1634
         $cart_details = array();
@@ -1638,16 +1638,16 @@  discard block
 block discarded – undo
1638 1638
         }
1639 1639
 
1640 1640
         return $cart_details;
1641
-	}
1641
+    }
1642 1642
 
1643
-	/**
1644
-	 * Retrieves the recurring item.
1645
-	 *
1646
-	 * @return null|GetPaid_Form_Item
1647
-	 */
1648
-	public function get_recurring( $object = false ) {
1643
+    /**
1644
+     * Retrieves the recurring item.
1645
+     *
1646
+     * @return null|GetPaid_Form_Item
1647
+     */
1648
+    public function get_recurring( $object = false ) {
1649 1649
 
1650
-		// Are we returning an object?
1650
+        // Are we returning an object?
1651 1651
         if ( $object ) {
1652 1652
             return $this->get_item( $this->recurring_item );
1653 1653
         }
@@ -1655,58 +1655,58 @@  discard block
 block discarded – undo
1655 1655
         return $this->recurring_item;
1656 1656
     }
1657 1657
 
1658
-	/**
1659
-	 * Retrieves the subscription name.
1660
-	 *
1661
-	 * @since 1.0.19
1662
-	 * @return string
1663
-	 */
1664
-	public function get_subscription_name() {
1658
+    /**
1659
+     * Retrieves the subscription name.
1660
+     *
1661
+     * @since 1.0.19
1662
+     * @return string
1663
+     */
1664
+    public function get_subscription_name() {
1665 1665
 
1666
-		// Retrieve the recurring name
1666
+        // Retrieve the recurring name
1667 1667
         $item = $this->get_recurring( true );
1668 1668
 
1669
-		// Abort if it does not exist.
1669
+        // Abort if it does not exist.
1670 1670
         if ( empty( $item ) ) {
1671 1671
             return '';
1672 1672
         }
1673 1673
 
1674
-		// Return the item name.
1674
+        // Return the item name.
1675 1675
         return apply_filters( 'wpinv_invoice_get_subscription_name', $item->get_name(), $this );
1676
-	}
1677
-
1678
-	/**
1679
-	 * Retrieves the view url.
1680
-	 *
1681
-	 * @since 1.0.19
1682
-	 * @return string
1683
-	 */
1684
-	public function get_view_url() {
1676
+    }
1677
+
1678
+    /**
1679
+     * Retrieves the view url.
1680
+     *
1681
+     * @since 1.0.19
1682
+     * @return string
1683
+     */
1684
+    public function get_view_url() {
1685 1685
         $invoice_url = get_permalink( $this->get_id() );
1686
-		$invoice_url = add_query_arg( 'invoice_key', $this->get_key(), $invoice_url );
1686
+        $invoice_url = add_query_arg( 'invoice_key', $this->get_key(), $invoice_url );
1687 1687
         return apply_filters( 'wpinv_get_view_url', $invoice_url, $this );
1688
-	}
1688
+    }
1689 1689
 
1690
-	/**
1691
-	 * Retrieves the payment url.
1692
-	 *
1693
-	 * @since 1.0.19
1694
-	 * @return string
1695
-	 */
1696
-	public function get_checkout_payment_url( $deprecated = false, $secret = false ) {
1690
+    /**
1691
+     * Retrieves the payment url.
1692
+     *
1693
+     * @since 1.0.19
1694
+     * @return string
1695
+     */
1696
+    public function get_checkout_payment_url( $deprecated = false, $secret = false ) {
1697 1697
 
1698
-		// Retrieve the checkout url.
1698
+        // Retrieve the checkout url.
1699 1699
         $pay_url = wpinv_get_checkout_uri();
1700 1700
 
1701
-		// Maybe force ssl.
1701
+        // Maybe force ssl.
1702 1702
         if ( is_ssl() ) {
1703 1703
             $pay_url = str_replace( 'http:', 'https:', $pay_url );
1704 1704
         }
1705 1705
 
1706
-		// Add the invoice key.
1707
-		$pay_url = add_query_arg( 'invoice_key', $this->get_key(), $pay_url );
1706
+        // Add the invoice key.
1707
+        $pay_url = add_query_arg( 'invoice_key', $this->get_key(), $pay_url );
1708 1708
 
1709
-		// (Maybe?) add a secret
1709
+        // (Maybe?) add a secret
1710 1710
         if ( $secret ) {
1711 1711
             $pay_url = add_query_arg( array( '_wpipay' => md5( $this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key() ) ), $pay_url );
1712 1712
         }
@@ -1715,18 +1715,18 @@  discard block
 block discarded – undo
1715 1715
     }
1716 1716
 
1717 1717
     /**
1718
-	 * Magic method for accessing invoice properties.
1719
-	 *
1720
-	 * @since 1.0.15
1721
-	 * @access public
1722
-	 *
1723
-	 * @param string $key Discount data to retrieve
1724
-	 * @param  string $context View or edit context.
1725
-	 * @return mixed Value of the given invoice property (if set).
1726
-	 */
1727
-	public function get( $key, $context = 'view' ) {
1718
+     * Magic method for accessing invoice properties.
1719
+     *
1720
+     * @since 1.0.15
1721
+     * @access public
1722
+     *
1723
+     * @param string $key Discount data to retrieve
1724
+     * @param  string $context View or edit context.
1725
+     * @return mixed Value of the given invoice property (if set).
1726
+     */
1727
+    public function get( $key, $context = 'view' ) {
1728 1728
         return $this->get_prop( $key, $context );
1729
-	}
1729
+    }
1730 1730
 
1731 1731
     /*
1732 1732
 	|--------------------------------------------------------------------------
@@ -1739,118 +1739,118 @@  discard block
 block discarded – undo
1739 1739
     */
1740 1740
 
1741 1741
     /**
1742
-	 * Magic method for setting invoice properties.
1743
-	 *
1744
-	 * @since 1.0.19
1745
-	 * @access public
1746
-	 *
1747
-	 * @param string $key Discount data to retrieve
1748
-	 * @param  mixed $value new value.
1749
-	 * @return mixed Value of the given invoice property (if set).
1750
-	 */
1751
-	public function set( $key, $value ) {
1742
+     * Magic method for setting invoice properties.
1743
+     *
1744
+     * @since 1.0.19
1745
+     * @access public
1746
+     *
1747
+     * @param string $key Discount data to retrieve
1748
+     * @param  mixed $value new value.
1749
+     * @return mixed Value of the given invoice property (if set).
1750
+     */
1751
+    public function set( $key, $value ) {
1752 1752
 
1753 1753
         $setter = "set_$key";
1754 1754
         if ( is_callable( array( $this, $setter ) ) ) {
1755 1755
             $this->{$setter}( $value );
1756 1756
         }
1757 1757
 
1758
-	}
1759
-
1760
-	/**
1761
-	 * Sets item status.
1762
-	 *
1763
-	 * @since 1.0.19
1764
-	 * @param string $new_status    New status.
1765
-	 * @param string $note          Optional note to add.
1766
-	 * @param bool   $manual_update Is this a manual status change?.
1767
-	 * @return array details of change.
1768
-	 */
1769
-	public function set_status( $new_status, $note = '', $manual_update = false ) {
1770
-		$old_status = $this->get_status();
1771
-
1772
-		$this->set_prop( 'status', $new_status );
1773
-
1774
-		// If setting the status, ensure it's set to a valid status.
1775
-		if ( true === $this->object_read ) {
1776
-
1777
-			// Only allow valid new status.
1778
-			if ( ! array_key_exists( $new_status, wpinv_get_invoice_statuses( false, true ) ) ) {
1779
-				$new_status = 'wpi-pending';
1780
-			}
1781
-
1782
-			// If the old status is set but unknown (e.g. draft) assume its pending for action usage.
1783
-			if ( $old_status && ! array_key_exists( $new_status, wpinv_get_invoice_statuses( false, true ) ) ) {
1784
-				$old_status = 'wpi-pending';
1785
-			}
1786
-		}
1787
-
1788
-		if ( true === $this->object_read && $old_status !== $new_status ) {
1789
-			$this->status_transition = array(
1790
-				'from'   => ! empty( $this->status_transition['from'] ) ? $this->status_transition['from'] : $old_status,
1791
-				'to'     => $new_status,
1792
-				'note'   => $note,
1793
-				'manual' => (bool) $manual_update,
1794
-			);
1795
-
1796
-			if ( $manual_update ) {
1797
-				do_action( 'getpaid_' . $this->object_type .'_edit_status', $this->get_id(), $new_status );
1798
-			}
1799
-
1800
-			$this->maybe_set_date_paid();
1801
-
1802
-		}
1803
-
1804
-		return array(
1805
-			'from' => $old_status,
1806
-			'to'   => $new_status,
1807
-		);
1808
-	}
1809
-
1810
-	/**
1811
-	 * Maybe set date paid.
1812
-	 *
1813
-	 * Sets the date paid variable when transitioning to the payment complete
1814
-	 * order status.
1815
-	 *
1816
-	 * @since 1.0.19
1817
-	 */
1818
-	public function maybe_set_date_paid() {
1819
-
1820
-		if ( ! $this->get_date_completed( 'edit' ) && $this->is_paid() ) {
1821
-			$this->set_date_completed( current_time( 'mysql' ) );
1822
-		}
1823
-	}
1824
-
1825
-    /**
1826
-	 * Set parent invoice ID.
1827
-	 *
1828
-	 * @since 1.0.19
1829
-	 */
1830
-	public function set_parent_id( $value ) {
1831
-		if ( $value && ( $value === $this->get_id() || ! get_post( $value ) ) ) {
1832
-			return;
1833
-		}
1834
-		$this->set_prop( 'parent_id', absint( $value ) );
1835
-    }
1836
-
1837
-    /**
1838
-	 * Set plugin version when the invoice was created.
1839
-	 *
1840
-	 * @since 1.0.19
1841
-	 */
1842
-	public function set_version( $value ) {
1843
-		$this->set_prop( 'version', $value );
1844
-    }
1845
-
1846
-    /**
1847
-	 * Set date when the invoice was created.
1848
-	 *
1849
-	 * @since 1.0.19
1850
-	 * @param string $value Value to set.
1758
+    }
1759
+
1760
+    /**
1761
+     * Sets item status.
1762
+     *
1763
+     * @since 1.0.19
1764
+     * @param string $new_status    New status.
1765
+     * @param string $note          Optional note to add.
1766
+     * @param bool   $manual_update Is this a manual status change?.
1767
+     * @return array details of change.
1768
+     */
1769
+    public function set_status( $new_status, $note = '', $manual_update = false ) {
1770
+        $old_status = $this->get_status();
1771
+
1772
+        $this->set_prop( 'status', $new_status );
1773
+
1774
+        // If setting the status, ensure it's set to a valid status.
1775
+        if ( true === $this->object_read ) {
1776
+
1777
+            // Only allow valid new status.
1778
+            if ( ! array_key_exists( $new_status, wpinv_get_invoice_statuses( false, true ) ) ) {
1779
+                $new_status = 'wpi-pending';
1780
+            }
1781
+
1782
+            // If the old status is set but unknown (e.g. draft) assume its pending for action usage.
1783
+            if ( $old_status && ! array_key_exists( $new_status, wpinv_get_invoice_statuses( false, true ) ) ) {
1784
+                $old_status = 'wpi-pending';
1785
+            }
1786
+        }
1787
+
1788
+        if ( true === $this->object_read && $old_status !== $new_status ) {
1789
+            $this->status_transition = array(
1790
+                'from'   => ! empty( $this->status_transition['from'] ) ? $this->status_transition['from'] : $old_status,
1791
+                'to'     => $new_status,
1792
+                'note'   => $note,
1793
+                'manual' => (bool) $manual_update,
1794
+            );
1795
+
1796
+            if ( $manual_update ) {
1797
+                do_action( 'getpaid_' . $this->object_type .'_edit_status', $this->get_id(), $new_status );
1798
+            }
1799
+
1800
+            $this->maybe_set_date_paid();
1801
+
1802
+        }
1803
+
1804
+        return array(
1805
+            'from' => $old_status,
1806
+            'to'   => $new_status,
1807
+        );
1808
+    }
1809
+
1810
+    /**
1811
+     * Maybe set date paid.
1812
+     *
1813
+     * Sets the date paid variable when transitioning to the payment complete
1814
+     * order status.
1815
+     *
1816
+     * @since 1.0.19
1817
+     */
1818
+    public function maybe_set_date_paid() {
1819
+
1820
+        if ( ! $this->get_date_completed( 'edit' ) && $this->is_paid() ) {
1821
+            $this->set_date_completed( current_time( 'mysql' ) );
1822
+        }
1823
+    }
1824
+
1825
+    /**
1826
+     * Set parent invoice ID.
1827
+     *
1828
+     * @since 1.0.19
1829
+     */
1830
+    public function set_parent_id( $value ) {
1831
+        if ( $value && ( $value === $this->get_id() || ! get_post( $value ) ) ) {
1832
+            return;
1833
+        }
1834
+        $this->set_prop( 'parent_id', absint( $value ) );
1835
+    }
1836
+
1837
+    /**
1838
+     * Set plugin version when the invoice was created.
1839
+     *
1840
+     * @since 1.0.19
1841
+     */
1842
+    public function set_version( $value ) {
1843
+        $this->set_prop( 'version', $value );
1844
+    }
1845
+
1846
+    /**
1847
+     * Set date when the invoice was created.
1848
+     *
1849
+     * @since 1.0.19
1850
+     * @param string $value Value to set.
1851 1851
      * @return bool Whether or not the date was set.
1852
-	 */
1853
-	public function set_date_created( $value ) {
1852
+     */
1853
+    public function set_date_created( $value ) {
1854 1854
         $date = strtotime( $value );
1855 1855
 
1856 1856
         if ( $date && $date !== '0000-00-00 00:00:00' ) {
@@ -1863,13 +1863,13 @@  discard block
 block discarded – undo
1863 1863
     }
1864 1864
 
1865 1865
     /**
1866
-	 * Set date invoice due date.
1867
-	 *
1868
-	 * @since 1.0.19
1869
-	 * @param string $value Value to set.
1866
+     * Set date invoice due date.
1867
+     *
1868
+     * @since 1.0.19
1869
+     * @param string $value Value to set.
1870 1870
      * @return bool Whether or not the date was set.
1871
-	 */
1872
-	public function set_due_date( $value ) {
1871
+     */
1872
+    public function set_due_date( $value ) {
1873 1873
         $date = strtotime( $value );
1874 1874
 
1875 1875
         if ( $date && $date !== '0000-00-00 00:00:00' ) {
@@ -1877,29 +1877,29 @@  discard block
 block discarded – undo
1877 1877
             return true;
1878 1878
         }
1879 1879
 
1880
-		$this->set_prop( 'due_date', '' );
1880
+        $this->set_prop( 'due_date', '' );
1881 1881
         return false;
1882 1882
 
1883 1883
     }
1884 1884
 
1885 1885
     /**
1886
-	 * Alias of self::set_due_date().
1887
-	 *
1888
-	 * @since 1.0.19
1889
-	 * @param  string $value New name.
1890
-	 */
1891
-	public function set_date_due( $value ) {
1892
-		$this->set_due_date( $value );
1886
+     * Alias of self::set_due_date().
1887
+     *
1888
+     * @since 1.0.19
1889
+     * @param  string $value New name.
1890
+     */
1891
+    public function set_date_due( $value ) {
1892
+        $this->set_due_date( $value );
1893 1893
     }
1894 1894
 
1895 1895
     /**
1896
-	 * Set date invoice was completed.
1897
-	 *
1898
-	 * @since 1.0.19
1899
-	 * @param string $value Value to set.
1896
+     * Set date invoice was completed.
1897
+     *
1898
+     * @since 1.0.19
1899
+     * @param string $value Value to set.
1900 1900
      * @return bool Whether or not the date was set.
1901
-	 */
1902
-	public function set_completed_date( $value ) {
1901
+     */
1902
+    public function set_completed_date( $value ) {
1903 1903
         $date = strtotime( $value );
1904 1904
 
1905 1905
         if ( $date && $date !== '0000-00-00 00:00:00'  ) {
@@ -1907,29 +1907,29 @@  discard block
 block discarded – undo
1907 1907
             return true;
1908 1908
         }
1909 1909
 
1910
-		$this->set_prop( 'completed_date', '' );
1910
+        $this->set_prop( 'completed_date', '' );
1911 1911
         return false;
1912 1912
 
1913 1913
     }
1914 1914
 
1915 1915
     /**
1916
-	 * Alias of self::set_completed_date().
1917
-	 *
1918
-	 * @since 1.0.19
1919
-	 * @param  string $value New name.
1920
-	 */
1921
-	public function set_date_completed( $value ) {
1922
-		$this->set_completed_date( $value );
1916
+     * Alias of self::set_completed_date().
1917
+     *
1918
+     * @since 1.0.19
1919
+     * @param  string $value New name.
1920
+     */
1921
+    public function set_date_completed( $value ) {
1922
+        $this->set_completed_date( $value );
1923 1923
     }
1924 1924
 
1925 1925
     /**
1926
-	 * Set date when the invoice was last modified.
1927
-	 *
1928
-	 * @since 1.0.19
1929
-	 * @param string $value Value to set.
1926
+     * Set date when the invoice was last modified.
1927
+     *
1928
+     * @since 1.0.19
1929
+     * @param string $value Value to set.
1930 1930
      * @return bool Whether or not the date was set.
1931
-	 */
1932
-	public function set_date_modified( $value ) {
1931
+     */
1932
+    public function set_date_modified( $value ) {
1933 1933
         $date = strtotime( $value );
1934 1934
 
1935 1935
         if ( $date && $date !== '0000-00-00 00:00:00' ) {
@@ -1937,699 +1937,699 @@  discard block
 block discarded – undo
1937 1937
             return true;
1938 1938
         }
1939 1939
 
1940
-		$this->set_prop( 'date_modified', '' );
1940
+        $this->set_prop( 'date_modified', '' );
1941 1941
         return false;
1942 1942
 
1943 1943
     }
1944 1944
 
1945 1945
     /**
1946
-	 * Set the invoice number.
1947
-	 *
1948
-	 * @since 1.0.19
1949
-	 * @param  string $value New number.
1950
-	 */
1951
-	public function set_number( $value ) {
1946
+     * Set the invoice number.
1947
+     *
1948
+     * @since 1.0.19
1949
+     * @param  string $value New number.
1950
+     */
1951
+    public function set_number( $value ) {
1952 1952
         $number = sanitize_text_field( $value );
1953
-		$this->set_prop( 'number', $number );
1953
+        $this->set_prop( 'number', $number );
1954 1954
     }
1955 1955
 
1956 1956
     /**
1957
-	 * Set the invoice type.
1958
-	 *
1959
-	 * @since 1.0.19
1960
-	 * @param  string $value Type.
1961
-	 */
1962
-	public function set_type( $value ) {
1957
+     * Set the invoice type.
1958
+     *
1959
+     * @since 1.0.19
1960
+     * @param  string $value Type.
1961
+     */
1962
+    public function set_type( $value ) {
1963 1963
         $type = sanitize_text_field( str_replace( 'wpi_', '', $value ) );
1964
-		$this->set_prop( 'type', $type );
1964
+        $this->set_prop( 'type', $type );
1965 1965
     }
1966 1966
 
1967 1967
     /**
1968
-	 * Set the invoice post type.
1969
-	 *
1970
-	 * @since 1.0.19
1971
-	 * @param  string $value Post type.
1972
-	 */
1973
-	public function set_post_type( $value ) {
1968
+     * Set the invoice post type.
1969
+     *
1970
+     * @since 1.0.19
1971
+     * @param  string $value Post type.
1972
+     */
1973
+    public function set_post_type( $value ) {
1974 1974
         if ( getpaid_is_invoice_post_type( $value ) ) {
1975 1975
             $this->set_prop( 'post_type', $value );
1976 1976
         }
1977 1977
     }
1978 1978
 
1979 1979
     /**
1980
-	 * Set the invoice key.
1981
-	 *
1982
-	 * @since 1.0.19
1983
-	 * @param  string $value New key.
1984
-	 */
1985
-	public function set_key( $value ) {
1980
+     * Set the invoice key.
1981
+     *
1982
+     * @since 1.0.19
1983
+     * @param  string $value New key.
1984
+     */
1985
+    public function set_key( $value ) {
1986 1986
         $key = sanitize_text_field( $value );
1987
-		$this->set_prop( 'key', $key );
1987
+        $this->set_prop( 'key', $key );
1988 1988
     }
1989 1989
 
1990 1990
     /**
1991
-	 * Set the invoice mode.
1992
-	 *
1993
-	 * @since 1.0.19
1994
-	 * @param  string $value mode.
1995
-	 */
1996
-	public function set_mode( $value ) {
1991
+     * Set the invoice mode.
1992
+     *
1993
+     * @since 1.0.19
1994
+     * @param  string $value mode.
1995
+     */
1996
+    public function set_mode( $value ) {
1997 1997
         if ( ! in_array( $value, array( 'live', 'test' ) ) ) {
1998 1998
             $this->set_prop( 'value', $value );
1999 1999
         }
2000 2000
     }
2001 2001
 
2002 2002
     /**
2003
-	 * Set the invoice path.
2004
-	 *
2005
-	 * @since 1.0.19
2006
-	 * @param  string $value path.
2007
-	 */
2008
-	public function set_path( $value ) {
2003
+     * Set the invoice path.
2004
+     *
2005
+     * @since 1.0.19
2006
+     * @param  string $value path.
2007
+     */
2008
+    public function set_path( $value ) {
2009 2009
         $this->set_prop( 'path', $value );
2010 2010
     }
2011 2011
 
2012 2012
     /**
2013
-	 * Set the invoice name.
2014
-	 *
2015
-	 * @since 1.0.19
2016
-	 * @param  string $value New name.
2017
-	 */
2018
-	public function set_name( $value ) {
2013
+     * Set the invoice name.
2014
+     *
2015
+     * @since 1.0.19
2016
+     * @param  string $value New name.
2017
+     */
2018
+    public function set_name( $value ) {
2019 2019
         $name = sanitize_text_field( $value );
2020
-		$this->set_prop( 'name', $name );
2020
+        $this->set_prop( 'name', $name );
2021
+    }
2022
+
2023
+    /**
2024
+     * Alias of self::set_name().
2025
+     *
2026
+     * @since 1.0.19
2027
+     * @param  string $value New name.
2028
+     */
2029
+    public function set_title( $value ) {
2030
+        $this->set_name( $value );
2031
+    }
2032
+
2033
+    /**
2034
+     * Set the invoice description.
2035
+     *
2036
+     * @since 1.0.19
2037
+     * @param  string $value New description.
2038
+     */
2039
+    public function set_description( $value ) {
2040
+        $description = wp_kses_post( $value );
2041
+        return $this->set_prop( 'description', $description );
2042
+    }
2043
+
2044
+    /**
2045
+     * Alias of self::set_description().
2046
+     *
2047
+     * @since 1.0.19
2048
+     * @param  string $value New description.
2049
+     */
2050
+    public function set_excerpt( $value ) {
2051
+        $this->set_description( $value );
2021 2052
     }
2022 2053
 
2023 2054
     /**
2024
-	 * Alias of self::set_name().
2025
-	 *
2026
-	 * @since 1.0.19
2027
-	 * @param  string $value New name.
2028
-	 */
2029
-	public function set_title( $value ) {
2030
-		$this->set_name( $value );
2055
+     * Alias of self::set_description().
2056
+     *
2057
+     * @since 1.0.19
2058
+     * @param  string $value New description.
2059
+     */
2060
+    public function set_summary( $value ) {
2061
+        $this->set_description( $value );
2031 2062
     }
2032 2063
 
2033 2064
     /**
2034
-	 * Set the invoice description.
2035
-	 *
2036
-	 * @since 1.0.19
2037
-	 * @param  string $value New description.
2038
-	 */
2039
-	public function set_description( $value ) {
2040
-        $description = wp_kses_post( $value );
2041
-		return $this->set_prop( 'description', $description );
2065
+     * Set the receiver of the invoice.
2066
+     *
2067
+     * @since 1.0.19
2068
+     * @param  int $value New author.
2069
+     */
2070
+    public function set_author( $value ) {
2071
+        $this->set_prop( 'author', (int) $value );
2042 2072
     }
2043 2073
 
2044 2074
     /**
2045
-	 * Alias of self::set_description().
2046
-	 *
2047
-	 * @since 1.0.19
2048
-	 * @param  string $value New description.
2049
-	 */
2050
-	public function set_excerpt( $value ) {
2051
-		$this->set_description( $value );
2075
+     * Alias of self::set_author().
2076
+     *
2077
+     * @since 1.0.19
2078
+     * @param  int $value New user id.
2079
+     */
2080
+    public function set_user_id( $value ) {
2081
+        $this->set_author( $value );
2052 2082
     }
2053 2083
 
2054 2084
     /**
2055
-	 * Alias of self::set_description().
2056
-	 *
2057
-	 * @since 1.0.19
2058
-	 * @param  string $value New description.
2059
-	 */
2060
-	public function set_summary( $value ) {
2061
-		$this->set_description( $value );
2085
+     * Alias of self::set_author().
2086
+     *
2087
+     * @since 1.0.19
2088
+     * @param  int $value New user id.
2089
+     */
2090
+    public function set_customer_id( $value ) {
2091
+        $this->set_author( $value );
2062 2092
     }
2063 2093
 
2064 2094
     /**
2065
-	 * Set the receiver of the invoice.
2066
-	 *
2067
-	 * @since 1.0.19
2068
-	 * @param  int $value New author.
2069
-	 */
2070
-	public function set_author( $value ) {
2071
-		$this->set_prop( 'author', (int) $value );
2095
+     * Set the customer's ip.
2096
+     *
2097
+     * @since 1.0.19
2098
+     * @param  string $value ip address.
2099
+     */
2100
+    public function set_ip( $value ) {
2101
+        $this->set_prop( 'ip', $value );
2072 2102
     }
2073 2103
 
2074 2104
     /**
2075
-	 * Alias of self::set_author().
2076
-	 *
2077
-	 * @since 1.0.19
2078
-	 * @param  int $value New user id.
2079
-	 */
2080
-	public function set_user_id( $value ) {
2081
-		$this->set_author( $value );
2105
+     * Alias of self::set_ip().
2106
+     *
2107
+     * @since 1.0.19
2108
+     * @param  string $value ip address.
2109
+     */
2110
+    public function set_user_ip( $value ) {
2111
+        $this->set_ip( $value );
2082 2112
     }
2083 2113
 
2084 2114
     /**
2085
-	 * Alias of self::set_author().
2086
-	 *
2087
-	 * @since 1.0.19
2088
-	 * @param  int $value New user id.
2089
-	 */
2090
-	public function set_customer_id( $value ) {
2091
-		$this->set_author( $value );
2115
+     * Set the customer's first name.
2116
+     *
2117
+     * @since 1.0.19
2118
+     * @param  string $value first name.
2119
+     */
2120
+    public function set_first_name( $value ) {
2121
+        $this->set_prop( 'first_name', $value );
2092 2122
     }
2093 2123
 
2094 2124
     /**
2095
-	 * Set the customer's ip.
2096
-	 *
2097
-	 * @since 1.0.19
2098
-	 * @param  string $value ip address.
2099
-	 */
2100
-	public function set_ip( $value ) {
2101
-		$this->set_prop( 'ip', $value );
2125
+     * Alias of self::set_first_name().
2126
+     *
2127
+     * @since 1.0.19
2128
+     * @param  string $value first name.
2129
+     */
2130
+    public function set_user_first_name( $value ) {
2131
+        $this->set_first_name( $value );
2102 2132
     }
2103 2133
 
2104 2134
     /**
2105
-	 * Alias of self::set_ip().
2106
-	 *
2107
-	 * @since 1.0.19
2108
-	 * @param  string $value ip address.
2109
-	 */
2110
-	public function set_user_ip( $value ) {
2111
-		$this->set_ip( $value );
2135
+     * Alias of self::set_first_name().
2136
+     *
2137
+     * @since 1.0.19
2138
+     * @param  string $value first name.
2139
+     */
2140
+    public function set_customer_first_name( $value ) {
2141
+        $this->set_first_name( $value );
2112 2142
     }
2113 2143
 
2114 2144
     /**
2115
-	 * Set the customer's first name.
2116
-	 *
2117
-	 * @since 1.0.19
2118
-	 * @param  string $value first name.
2119
-	 */
2120
-	public function set_first_name( $value ) {
2121
-		$this->set_prop( 'first_name', $value );
2145
+     * Set the customer's last name.
2146
+     *
2147
+     * @since 1.0.19
2148
+     * @param  string $value last name.
2149
+     */
2150
+    public function set_last_name( $value ) {
2151
+        $this->set_prop( 'last_name', $value );
2122 2152
     }
2123 2153
 
2124 2154
     /**
2125
-	 * Alias of self::set_first_name().
2126
-	 *
2127
-	 * @since 1.0.19
2128
-	 * @param  string $value first name.
2129
-	 */
2130
-	public function set_user_first_name( $value ) {
2131
-		$this->set_first_name( $value );
2155
+     * Alias of self::set_last_name().
2156
+     *
2157
+     * @since 1.0.19
2158
+     * @param  string $value last name.
2159
+     */
2160
+    public function set_user_last_name( $value ) {
2161
+        $this->set_last_name( $value );
2132 2162
     }
2133 2163
 
2134 2164
     /**
2135
-	 * Alias of self::set_first_name().
2136
-	 *
2137
-	 * @since 1.0.19
2138
-	 * @param  string $value first name.
2139
-	 */
2140
-	public function set_customer_first_name( $value ) {
2141
-		$this->set_first_name( $value );
2165
+     * Alias of self::set_last_name().
2166
+     *
2167
+     * @since 1.0.19
2168
+     * @param  string $value last name.
2169
+     */
2170
+    public function set_customer_last_name( $value ) {
2171
+        $this->set_last_name( $value );
2142 2172
     }
2143 2173
 
2144 2174
     /**
2145
-	 * Set the customer's last name.
2146
-	 *
2147
-	 * @since 1.0.19
2148
-	 * @param  string $value last name.
2149
-	 */
2150
-	public function set_last_name( $value ) {
2151
-		$this->set_prop( 'last_name', $value );
2175
+     * Set the customer's phone number.
2176
+     *
2177
+     * @since 1.0.19
2178
+     * @param  string $value phone.
2179
+     */
2180
+    public function set_phone( $value ) {
2181
+        $this->set_prop( 'phone', $value );
2152 2182
     }
2153 2183
 
2154 2184
     /**
2155
-	 * Alias of self::set_last_name().
2156
-	 *
2157
-	 * @since 1.0.19
2158
-	 * @param  string $value last name.
2159
-	 */
2160
-	public function set_user_last_name( $value ) {
2161
-		$this->set_last_name( $value );
2185
+     * Alias of self::set_phone().
2186
+     *
2187
+     * @since 1.0.19
2188
+     * @param  string $value phone.
2189
+     */
2190
+    public function set_user_phone( $value ) {
2191
+        $this->set_phone( $value );
2162 2192
     }
2163 2193
 
2164 2194
     /**
2165
-	 * Alias of self::set_last_name().
2166
-	 *
2167
-	 * @since 1.0.19
2168
-	 * @param  string $value last name.
2169
-	 */
2170
-	public function set_customer_last_name( $value ) {
2171
-		$this->set_last_name( $value );
2195
+     * Alias of self::set_phone().
2196
+     *
2197
+     * @since 1.0.19
2198
+     * @param  string $value phone.
2199
+     */
2200
+    public function set_customer_phone( $value ) {
2201
+        $this->set_phone( $value );
2172 2202
     }
2173 2203
 
2174 2204
     /**
2175
-	 * Set the customer's phone number.
2176
-	 *
2177
-	 * @since 1.0.19
2178
-	 * @param  string $value phone.
2179
-	 */
2180
-	public function set_phone( $value ) {
2181
-		$this->set_prop( 'phone', $value );
2205
+     * Alias of self::set_phone().
2206
+     *
2207
+     * @since 1.0.19
2208
+     * @param  string $value phone.
2209
+     */
2210
+    public function set_phone_number( $value ) {
2211
+        $this->set_phone( $value );
2182 2212
     }
2183 2213
 
2184 2214
     /**
2185
-	 * Alias of self::set_phone().
2186
-	 *
2187
-	 * @since 1.0.19
2188
-	 * @param  string $value phone.
2189
-	 */
2190
-	public function set_user_phone( $value ) {
2191
-		$this->set_phone( $value );
2215
+     * Set the customer's email address.
2216
+     *
2217
+     * @since 1.0.19
2218
+     * @param  string $value email address.
2219
+     */
2220
+    public function set_email( $value ) {
2221
+        $this->set_prop( 'email', $value );
2192 2222
     }
2193 2223
 
2194 2224
     /**
2195
-	 * Alias of self::set_phone().
2196
-	 *
2197
-	 * @since 1.0.19
2198
-	 * @param  string $value phone.
2199
-	 */
2200
-	public function set_customer_phone( $value ) {
2201
-		$this->set_phone( $value );
2225
+     * Alias of self::set_email().
2226
+     *
2227
+     * @since 1.0.19
2228
+     * @param  string $value email address.
2229
+     */
2230
+    public function set_user_email( $value ) {
2231
+        $this->set_email( $value );
2202 2232
     }
2203 2233
 
2204 2234
     /**
2205
-	 * Alias of self::set_phone().
2206
-	 *
2207
-	 * @since 1.0.19
2208
-	 * @param  string $value phone.
2209
-	 */
2210
-	public function set_phone_number( $value ) {
2211
-		$this->set_phone( $value );
2235
+     * Alias of self::set_email().
2236
+     *
2237
+     * @since 1.0.19
2238
+     * @param  string $value email address.
2239
+     */
2240
+    public function set_email_address( $value ) {
2241
+        $this->set_email( $value );
2212 2242
     }
2213 2243
 
2214 2244
     /**
2215
-	 * Set the customer's email address.
2216
-	 *
2217
-	 * @since 1.0.19
2218
-	 * @param  string $value email address.
2219
-	 */
2220
-	public function set_email( $value ) {
2221
-		$this->set_prop( 'email', $value );
2245
+     * Alias of self::set_email().
2246
+     *
2247
+     * @since 1.0.19
2248
+     * @param  string $value email address.
2249
+     */
2250
+    public function set_customer_email( $value ) {
2251
+        $this->set_email( $value );
2222 2252
     }
2223 2253
 
2224 2254
     /**
2225
-	 * Alias of self::set_email().
2226
-	 *
2227
-	 * @since 1.0.19
2228
-	 * @param  string $value email address.
2229
-	 */
2230
-	public function set_user_email( $value ) {
2231
-		$this->set_email( $value );
2255
+     * Set the customer's country.
2256
+     *
2257
+     * @since 1.0.19
2258
+     * @param  string $value country.
2259
+     */
2260
+    public function set_country( $value ) {
2261
+        $this->set_prop( 'country', $value );
2232 2262
     }
2233 2263
 
2234 2264
     /**
2235
-	 * Alias of self::set_email().
2236
-	 *
2237
-	 * @since 1.0.19
2238
-	 * @param  string $value email address.
2239
-	 */
2240
-	public function set_email_address( $value ) {
2241
-		$this->set_email( $value );
2265
+     * Alias of self::set_country().
2266
+     *
2267
+     * @since 1.0.19
2268
+     * @param  string $value country.
2269
+     */
2270
+    public function set_user_country( $value ) {
2271
+        $this->set_country( $value );
2242 2272
     }
2243 2273
 
2244 2274
     /**
2245
-	 * Alias of self::set_email().
2246
-	 *
2247
-	 * @since 1.0.19
2248
-	 * @param  string $value email address.
2249
-	 */
2250
-	public function set_customer_email( $value ) {
2251
-		$this->set_email( $value );
2275
+     * Alias of self::set_country().
2276
+     *
2277
+     * @since 1.0.19
2278
+     * @param  string $value country.
2279
+     */
2280
+    public function set_customer_country( $value ) {
2281
+        $this->set_country( $value );
2252 2282
     }
2253 2283
 
2254 2284
     /**
2255
-	 * Set the customer's country.
2256
-	 *
2257
-	 * @since 1.0.19
2258
-	 * @param  string $value country.
2259
-	 */
2260
-	public function set_country( $value ) {
2261
-		$this->set_prop( 'country', $value );
2285
+     * Set the customer's state.
2286
+     *
2287
+     * @since 1.0.19
2288
+     * @param  string $value state.
2289
+     */
2290
+    public function set_state( $value ) {
2291
+        $this->set_prop( 'state', $value );
2262 2292
     }
2263 2293
 
2264 2294
     /**
2265
-	 * Alias of self::set_country().
2266
-	 *
2267
-	 * @since 1.0.19
2268
-	 * @param  string $value country.
2269
-	 */
2270
-	public function set_user_country( $value ) {
2271
-		$this->set_country( $value );
2295
+     * Alias of self::set_state().
2296
+     *
2297
+     * @since 1.0.19
2298
+     * @param  string $value state.
2299
+     */
2300
+    public function set_user_state( $value ) {
2301
+        $this->set_state( $value );
2272 2302
     }
2273 2303
 
2274 2304
     /**
2275
-	 * Alias of self::set_country().
2276
-	 *
2277
-	 * @since 1.0.19
2278
-	 * @param  string $value country.
2279
-	 */
2280
-	public function set_customer_country( $value ) {
2281
-		$this->set_country( $value );
2305
+     * Alias of self::set_state().
2306
+     *
2307
+     * @since 1.0.19
2308
+     * @param  string $value state.
2309
+     */
2310
+    public function set_customer_state( $value ) {
2311
+        $this->set_state( $value );
2282 2312
     }
2283 2313
 
2284 2314
     /**
2285
-	 * Set the customer's state.
2286
-	 *
2287
-	 * @since 1.0.19
2288
-	 * @param  string $value state.
2289
-	 */
2290
-	public function set_state( $value ) {
2291
-		$this->set_prop( 'state', $value );
2315
+     * Set the customer's city.
2316
+     *
2317
+     * @since 1.0.19
2318
+     * @param  string $value city.
2319
+     */
2320
+    public function set_city( $value ) {
2321
+        $this->set_prop( 'city', $value );
2292 2322
     }
2293 2323
 
2294 2324
     /**
2295
-	 * Alias of self::set_state().
2296
-	 *
2297
-	 * @since 1.0.19
2298
-	 * @param  string $value state.
2299
-	 */
2300
-	public function set_user_state( $value ) {
2301
-		$this->set_state( $value );
2325
+     * Alias of self::set_city().
2326
+     *
2327
+     * @since 1.0.19
2328
+     * @param  string $value city.
2329
+     */
2330
+    public function set_user_city( $value ) {
2331
+        $this->set_city( $value );
2302 2332
     }
2303 2333
 
2304 2334
     /**
2305
-	 * Alias of self::set_state().
2306
-	 *
2307
-	 * @since 1.0.19
2308
-	 * @param  string $value state.
2309
-	 */
2310
-	public function set_customer_state( $value ) {
2311
-		$this->set_state( $value );
2335
+     * Alias of self::set_city().
2336
+     *
2337
+     * @since 1.0.19
2338
+     * @param  string $value city.
2339
+     */
2340
+    public function set_customer_city( $value ) {
2341
+        $this->set_city( $value );
2312 2342
     }
2313 2343
 
2314 2344
     /**
2315
-	 * Set the customer's city.
2316
-	 *
2317
-	 * @since 1.0.19
2318
-	 * @param  string $value city.
2319
-	 */
2320
-	public function set_city( $value ) {
2321
-		$this->set_prop( 'city', $value );
2345
+     * Set the customer's zip code.
2346
+     *
2347
+     * @since 1.0.19
2348
+     * @param  string $value zip.
2349
+     */
2350
+    public function set_zip( $value ) {
2351
+        $this->set_prop( 'zip', $value );
2322 2352
     }
2323 2353
 
2324 2354
     /**
2325
-	 * Alias of self::set_city().
2326
-	 *
2327
-	 * @since 1.0.19
2328
-	 * @param  string $value city.
2329
-	 */
2330
-	public function set_user_city( $value ) {
2331
-		$this->set_city( $value );
2355
+     * Alias of self::set_zip().
2356
+     *
2357
+     * @since 1.0.19
2358
+     * @param  string $value zip.
2359
+     */
2360
+    public function set_user_zip( $value ) {
2361
+        $this->set_zip( $value );
2332 2362
     }
2333 2363
 
2334 2364
     /**
2335
-	 * Alias of self::set_city().
2336
-	 *
2337
-	 * @since 1.0.19
2338
-	 * @param  string $value city.
2339
-	 */
2340
-	public function set_customer_city( $value ) {
2341
-		$this->set_city( $value );
2365
+     * Alias of self::set_zip().
2366
+     *
2367
+     * @since 1.0.19
2368
+     * @param  string $value zip.
2369
+     */
2370
+    public function set_customer_zip( $value ) {
2371
+        $this->set_zip( $value );
2342 2372
     }
2343 2373
 
2344 2374
     /**
2345
-	 * Set the customer's zip code.
2346
-	 *
2347
-	 * @since 1.0.19
2348
-	 * @param  string $value zip.
2349
-	 */
2350
-	public function set_zip( $value ) {
2351
-		$this->set_prop( 'zip', $value );
2375
+     * Set the customer's company.
2376
+     *
2377
+     * @since 1.0.19
2378
+     * @param  string $value company.
2379
+     */
2380
+    public function set_company( $value ) {
2381
+        $this->set_prop( 'company', $value );
2352 2382
     }
2353 2383
 
2354 2384
     /**
2355
-	 * Alias of self::set_zip().
2356
-	 *
2357
-	 * @since 1.0.19
2358
-	 * @param  string $value zip.
2359
-	 */
2360
-	public function set_user_zip( $value ) {
2361
-		$this->set_zip( $value );
2385
+     * Alias of self::set_company().
2386
+     *
2387
+     * @since 1.0.19
2388
+     * @param  string $value company.
2389
+     */
2390
+    public function set_user_company( $value ) {
2391
+        $this->set_company( $value );
2362 2392
     }
2363 2393
 
2364 2394
     /**
2365
-	 * Alias of self::set_zip().
2366
-	 *
2367
-	 * @since 1.0.19
2368
-	 * @param  string $value zip.
2369
-	 */
2370
-	public function set_customer_zip( $value ) {
2371
-		$this->set_zip( $value );
2395
+     * Alias of self::set_company().
2396
+     *
2397
+     * @since 1.0.19
2398
+     * @param  string $value company.
2399
+     */
2400
+    public function set_customer_company( $value ) {
2401
+        $this->set_company( $value );
2372 2402
     }
2373 2403
 
2374 2404
     /**
2375
-	 * Set the customer's company.
2376
-	 *
2377
-	 * @since 1.0.19
2378
-	 * @param  string $value company.
2379
-	 */
2380
-	public function set_company( $value ) {
2381
-		$this->set_prop( 'company', $value );
2405
+     * Set the customer's var number.
2406
+     *
2407
+     * @since 1.0.19
2408
+     * @param  string $value var number.
2409
+     */
2410
+    public function set_vat_number( $value ) {
2411
+        $this->set_prop( 'vat_number', $value );
2382 2412
     }
2383 2413
 
2384 2414
     /**
2385
-	 * Alias of self::set_company().
2386
-	 *
2387
-	 * @since 1.0.19
2388
-	 * @param  string $value company.
2389
-	 */
2390
-	public function set_user_company( $value ) {
2391
-		$this->set_company( $value );
2415
+     * Alias of self::set_vat_number().
2416
+     *
2417
+     * @since 1.0.19
2418
+     * @param  string $value var number.
2419
+     */
2420
+    public function set_user_vat_number( $value ) {
2421
+        $this->set_vat_number( $value );
2392 2422
     }
2393 2423
 
2394 2424
     /**
2395
-	 * Alias of self::set_company().
2396
-	 *
2397
-	 * @since 1.0.19
2398
-	 * @param  string $value company.
2399
-	 */
2400
-	public function set_customer_company( $value ) {
2401
-		$this->set_company( $value );
2425
+     * Alias of self::set_vat_number().
2426
+     *
2427
+     * @since 1.0.19
2428
+     * @param  string $value var number.
2429
+     */
2430
+    public function set_customer_vat_number( $value ) {
2431
+        $this->set_vat_number( $value );
2402 2432
     }
2403 2433
 
2404 2434
     /**
2405
-	 * Set the customer's var number.
2406
-	 *
2407
-	 * @since 1.0.19
2408
-	 * @param  string $value var number.
2409
-	 */
2410
-	public function set_vat_number( $value ) {
2411
-		$this->set_prop( 'vat_number', $value );
2435
+     * Set the customer's vat rate.
2436
+     *
2437
+     * @since 1.0.19
2438
+     * @param  string $value var rate.
2439
+     */
2440
+    public function set_vat_rate( $value ) {
2441
+        $this->set_prop( 'vat_rate', $value );
2412 2442
     }
2413 2443
 
2414 2444
     /**
2415
-	 * Alias of self::set_vat_number().
2416
-	 *
2417
-	 * @since 1.0.19
2418
-	 * @param  string $value var number.
2419
-	 */
2420
-	public function set_user_vat_number( $value ) {
2421
-		$this->set_vat_number( $value );
2445
+     * Alias of self::set_vat_rate().
2446
+     *
2447
+     * @since 1.0.19
2448
+     * @param  string $value var number.
2449
+     */
2450
+    public function set_user_vat_rate( $value ) {
2451
+        $this->set_vat_rate( $value );
2422 2452
     }
2423 2453
 
2424 2454
     /**
2425
-	 * Alias of self::set_vat_number().
2426
-	 *
2427
-	 * @since 1.0.19
2428
-	 * @param  string $value var number.
2429
-	 */
2430
-	public function set_customer_vat_number( $value ) {
2431
-		$this->set_vat_number( $value );
2455
+     * Alias of self::set_vat_rate().
2456
+     *
2457
+     * @since 1.0.19
2458
+     * @param  string $value var number.
2459
+     */
2460
+    public function set_customer_vat_rate( $value ) {
2461
+        $this->set_vat_rate( $value );
2432 2462
     }
2433 2463
 
2434 2464
     /**
2435
-	 * Set the customer's vat rate.
2436
-	 *
2437
-	 * @since 1.0.19
2438
-	 * @param  string $value var rate.
2439
-	 */
2440
-	public function set_vat_rate( $value ) {
2441
-		$this->set_prop( 'vat_rate', $value );
2465
+     * Set the customer's address.
2466
+     *
2467
+     * @since 1.0.19
2468
+     * @param  string $value address.
2469
+     */
2470
+    public function set_address( $value ) {
2471
+        $this->set_prop( 'address', $value );
2442 2472
     }
2443 2473
 
2444 2474
     /**
2445
-	 * Alias of self::set_vat_rate().
2446
-	 *
2447
-	 * @since 1.0.19
2448
-	 * @param  string $value var number.
2449
-	 */
2450
-	public function set_user_vat_rate( $value ) {
2451
-		$this->set_vat_rate( $value );
2475
+     * Alias of self::set_address().
2476
+     *
2477
+     * @since 1.0.19
2478
+     * @param  string $value address.
2479
+     */
2480
+    public function set_user_address( $value ) {
2481
+        $this->set_address( $value );
2452 2482
     }
2453 2483
 
2454 2484
     /**
2455
-	 * Alias of self::set_vat_rate().
2456
-	 *
2457
-	 * @since 1.0.19
2458
-	 * @param  string $value var number.
2459
-	 */
2460
-	public function set_customer_vat_rate( $value ) {
2461
-		$this->set_vat_rate( $value );
2485
+     * Alias of self::set_address().
2486
+     *
2487
+     * @since 1.0.19
2488
+     * @param  string $value address.
2489
+     */
2490
+    public function set_customer_address( $value ) {
2491
+        $this->set_address( $value );
2462 2492
     }
2463 2493
 
2464 2494
     /**
2465
-	 * Set the customer's address.
2466
-	 *
2467
-	 * @since 1.0.19
2468
-	 * @param  string $value address.
2469
-	 */
2470
-	public function set_address( $value ) {
2471
-		$this->set_prop( 'address', $value );
2495
+     * Set whether the customer has viewed the invoice or not.
2496
+     *
2497
+     * @since 1.0.19
2498
+     * @param  int|bool $value confirmed.
2499
+     */
2500
+    public function set_is_viewed( $value ) {
2501
+        $this->set_prop( 'is_viewed', $value );
2472 2502
     }
2473 2503
 
2474 2504
     /**
2475
-	 * Alias of self::set_address().
2476
-	 *
2477
-	 * @since 1.0.19
2478
-	 * @param  string $value address.
2479
-	 */
2480
-	public function set_user_address( $value ) {
2481
-		$this->set_address( $value );
2505
+     * Set extra email recipients.
2506
+     *
2507
+     * @since 1.0.19
2508
+     * @param  string $value email recipients.
2509
+     */
2510
+    public function set_email_cc( $value ) {
2511
+        $this->set_prop( 'email_cc', $value );
2482 2512
     }
2483 2513
 
2484 2514
     /**
2485
-	 * Alias of self::set_address().
2486
-	 *
2487
-	 * @since 1.0.19
2488
-	 * @param  string $value address.
2489
-	 */
2490
-	public function set_customer_address( $value ) {
2491
-		$this->set_address( $value );
2515
+     * Set the invoice template.
2516
+     *
2517
+     * @since 1.0.19
2518
+     * @param  string $value email recipients.
2519
+     */
2520
+    public function set_template( $value ) {
2521
+        if ( in_array( $value, array( 'quantity', 'hours', 'amount' ) ) ) {
2522
+            $this->set_prop( 'template', $value );
2523
+        }
2492 2524
     }
2493 2525
 
2494 2526
     /**
2495
-	 * Set whether the customer has viewed the invoice or not.
2496
-	 *
2497
-	 * @since 1.0.19
2498
-	 * @param  int|bool $value confirmed.
2499
-	 */
2500
-	public function set_is_viewed( $value ) {
2501
-		$this->set_prop( 'is_viewed', $value );
2502
-	}
2503
-
2504
-	/**
2505
-	 * Set extra email recipients.
2506
-	 *
2507
-	 * @since 1.0.19
2508
-	 * @param  string $value email recipients.
2509
-	 */
2510
-	public function set_email_cc( $value ) {
2511
-		$this->set_prop( 'email_cc', $value );
2512
-	}
2513
-
2514
-	/**
2515
-	 * Set the invoice template.
2516
-	 *
2517
-	 * @since 1.0.19
2518
-	 * @param  string $value email recipients.
2519
-	 */
2520
-	public function set_template( $value ) {
2521
-		if ( in_array( $value, array( 'quantity', 'hours', 'amount' ) ) ) {
2522
-			$this->set_prop( 'template', $value );
2523
-		}
2524
-	}
2525
-
2526
-	/**
2527
-	 * Set the customer's address confirmed status.
2528
-	 *
2529
-	 * @since 1.0.19
2530
-	 * @param  int|bool $value confirmed.
2531
-	 */
2532
-	public function set_address_confirmed( $value ) {
2533
-		$this->set_prop( 'address_confirmed', $value );
2527
+     * Set the customer's address confirmed status.
2528
+     *
2529
+     * @since 1.0.19
2530
+     * @param  int|bool $value confirmed.
2531
+     */
2532
+    public function set_address_confirmed( $value ) {
2533
+        $this->set_prop( 'address_confirmed', $value );
2534 2534
     }
2535 2535
 
2536 2536
     /**
2537
-	 * Alias of self::set_address_confirmed().
2538
-	 *
2539
-	 * @since 1.0.19
2540
-	 * @param  int|bool $value confirmed.
2541
-	 */
2542
-	public function set_user_address_confirmed( $value ) {
2543
-		$this->set_address_confirmed( $value );
2537
+     * Alias of self::set_address_confirmed().
2538
+     *
2539
+     * @since 1.0.19
2540
+     * @param  int|bool $value confirmed.
2541
+     */
2542
+    public function set_user_address_confirmed( $value ) {
2543
+        $this->set_address_confirmed( $value );
2544 2544
     }
2545 2545
 
2546 2546
     /**
2547
-	 * Alias of self::set_address_confirmed().
2548
-	 *
2549
-	 * @since 1.0.19
2550
-	 * @param  int|bool $value confirmed.
2551
-	 */
2552
-	public function set_customer_address_confirmed( $value ) {
2553
-		$this->set_address_confirmed( $value );
2547
+     * Alias of self::set_address_confirmed().
2548
+     *
2549
+     * @since 1.0.19
2550
+     * @param  int|bool $value confirmed.
2551
+     */
2552
+    public function set_customer_address_confirmed( $value ) {
2553
+        $this->set_address_confirmed( $value );
2554 2554
     }
2555 2555
 
2556 2556
     /**
2557
-	 * Set the invoice sub total.
2558
-	 *
2559
-	 * @since 1.0.19
2560
-	 * @param  float $value sub total.
2561
-	 */
2562
-	public function set_subtotal( $value ) {
2563
-		$this->set_prop( 'subtotal', $value );
2557
+     * Set the invoice sub total.
2558
+     *
2559
+     * @since 1.0.19
2560
+     * @param  float $value sub total.
2561
+     */
2562
+    public function set_subtotal( $value ) {
2563
+        $this->set_prop( 'subtotal', $value );
2564 2564
     }
2565 2565
 
2566 2566
     /**
2567
-	 * Set the invoice discount amount.
2568
-	 *
2569
-	 * @since 1.0.19
2570
-	 * @param  float $value discount total.
2571
-	 */
2572
-	public function set_total_discount( $value ) {
2573
-		$this->set_prop( 'total_discount', $value );
2567
+     * Set the invoice discount amount.
2568
+     *
2569
+     * @since 1.0.19
2570
+     * @param  float $value discount total.
2571
+     */
2572
+    public function set_total_discount( $value ) {
2573
+        $this->set_prop( 'total_discount', $value );
2574 2574
     }
2575 2575
 
2576 2576
     /**
2577
-	 * Alias of self::set_total_discount().
2578
-	 *
2579
-	 * @since 1.0.19
2580
-	 * @param  float $value discount total.
2581
-	 */
2582
-	public function set_discount( $value ) {
2583
-		$this->set_total_discount( $value );
2577
+     * Alias of self::set_total_discount().
2578
+     *
2579
+     * @since 1.0.19
2580
+     * @param  float $value discount total.
2581
+     */
2582
+    public function set_discount( $value ) {
2583
+        $this->set_total_discount( $value );
2584 2584
     }
2585 2585
 
2586 2586
     /**
2587
-	 * Set the invoice tax amount.
2588
-	 *
2589
-	 * @since 1.0.19
2590
-	 * @param  float $value tax total.
2591
-	 */
2592
-	public function set_total_tax( $value ) {
2593
-		$this->set_prop( 'total_tax', $value );
2587
+     * Set the invoice tax amount.
2588
+     *
2589
+     * @since 1.0.19
2590
+     * @param  float $value tax total.
2591
+     */
2592
+    public function set_total_tax( $value ) {
2593
+        $this->set_prop( 'total_tax', $value );
2594 2594
     }
2595 2595
 
2596 2596
     /**
2597
-	 * Alias of self::set_total_tax().
2598
-	 *
2599
-	 * @since 1.0.19
2600
-	 * @param  float $value tax total.
2601
-	 */
2602
-	public function set_tax_total( $value ) {
2603
-		$this->set_total_tax( $value );
2597
+     * Alias of self::set_total_tax().
2598
+     *
2599
+     * @since 1.0.19
2600
+     * @param  float $value tax total.
2601
+     */
2602
+    public function set_tax_total( $value ) {
2603
+        $this->set_total_tax( $value );
2604 2604
     }
2605 2605
 
2606 2606
     /**
2607
-	 * Set the invoice fees amount.
2608
-	 *
2609
-	 * @since 1.0.19
2610
-	 * @param  float $value fees total.
2611
-	 */
2612
-	public function set_total_fees( $value ) {
2613
-		$this->set_prop( 'total_fees', $value );
2607
+     * Set the invoice fees amount.
2608
+     *
2609
+     * @since 1.0.19
2610
+     * @param  float $value fees total.
2611
+     */
2612
+    public function set_total_fees( $value ) {
2613
+        $this->set_prop( 'total_fees', $value );
2614 2614
     }
2615 2615
 
2616 2616
     /**
2617
-	 * Alias of self::set_total_fees().
2618
-	 *
2619
-	 * @since 1.0.19
2620
-	 * @param  float $value fees total.
2621
-	 */
2622
-	public function set_fees_total( $value ) {
2623
-		$this->set_total_fees( $value );
2617
+     * Alias of self::set_total_fees().
2618
+     *
2619
+     * @since 1.0.19
2620
+     * @param  float $value fees total.
2621
+     */
2622
+    public function set_fees_total( $value ) {
2623
+        $this->set_total_fees( $value );
2624 2624
     }
2625 2625
 
2626 2626
     /**
2627
-	 * Set the invoice fees.
2628
-	 *
2629
-	 * @since 1.0.19
2630
-	 * @param  array $value fees.
2631
-	 */
2632
-	public function set_fees( $value ) {
2627
+     * Set the invoice fees.
2628
+     *
2629
+     * @since 1.0.19
2630
+     * @param  array $value fees.
2631
+     */
2632
+    public function set_fees( $value ) {
2633 2633
 
2634 2634
         $this->set_prop( 'fees', array() );
2635 2635
 
@@ -2647,23 +2647,23 @@  discard block
 block discarded – undo
2647 2647
     }
2648 2648
 
2649 2649
     /**
2650
-	 * Set the invoice taxes.
2651
-	 *
2652
-	 * @since 1.0.19
2653
-	 * @param  array $value taxes.
2654
-	 */
2655
-	public function set_taxes( $value ) {
2656
-		$this->set_prop( 'taxes', $value );
2650
+     * Set the invoice taxes.
2651
+     *
2652
+     * @since 1.0.19
2653
+     * @param  array $value taxes.
2654
+     */
2655
+    public function set_taxes( $value ) {
2656
+        $this->set_prop( 'taxes', $value );
2657 2657
     }
2658 2658
 
2659 2659
     /**
2660
-	 * Set the invoice discounts.
2661
-	 *
2662
-	 * @since 1.0.19
2663
-	 * @param  array $value discounts.
2664
-	 */
2665
-	public function set_discounts( $value ) {
2666
-		$this->set_prop( 'discounts', array() );
2660
+     * Set the invoice discounts.
2661
+     *
2662
+     * @since 1.0.19
2663
+     * @param  array $value discounts.
2664
+     */
2665
+    public function set_discounts( $value ) {
2666
+        $this->set_prop( 'discounts', array() );
2667 2667
 
2668 2668
         // Ensure that we have an array.
2669 2669
         if ( ! is_array( $value ) ) {
@@ -2678,12 +2678,12 @@  discard block
 block discarded – undo
2678 2678
     }
2679 2679
 
2680 2680
     /**
2681
-	 * Set the invoice items.
2682
-	 *
2683
-	 * @since 1.0.19
2684
-	 * @param  GetPaid_Form_Item[] $value items.
2685
-	 */
2686
-	public function set_items( $value ) {
2681
+     * Set the invoice items.
2682
+     *
2683
+     * @since 1.0.19
2684
+     * @param  GetPaid_Form_Item[] $value items.
2685
+     */
2686
+    public function set_items( $value ) {
2687 2687
 
2688 2688
         // Remove existing items.
2689 2689
         $this->set_prop( 'items', array() );
@@ -2700,73 +2700,73 @@  discard block
 block discarded – undo
2700 2700
     }
2701 2701
 
2702 2702
     /**
2703
-	 * Set the payment form.
2704
-	 *
2705
-	 * @since 1.0.19
2706
-	 * @param  int $value payment form.
2707
-	 */
2708
-	public function set_payment_form( $value ) {
2709
-		$this->set_prop( 'payment_form', $value );
2703
+     * Set the payment form.
2704
+     *
2705
+     * @since 1.0.19
2706
+     * @param  int $value payment form.
2707
+     */
2708
+    public function set_payment_form( $value ) {
2709
+        $this->set_prop( 'payment_form', $value );
2710 2710
     }
2711 2711
 
2712 2712
     /**
2713
-	 * Set the submission id.
2714
-	 *
2715
-	 * @since 1.0.19
2716
-	 * @param  string $value submission id.
2717
-	 */
2718
-	public function set_submission_id( $value ) {
2719
-		$this->set_prop( 'submission_id', $value );
2713
+     * Set the submission id.
2714
+     *
2715
+     * @since 1.0.19
2716
+     * @param  string $value submission id.
2717
+     */
2718
+    public function set_submission_id( $value ) {
2719
+        $this->set_prop( 'submission_id', $value );
2720 2720
     }
2721 2721
 
2722 2722
     /**
2723
-	 * Set the discount code.
2724
-	 *
2725
-	 * @since 1.0.19
2726
-	 * @param  string $value discount code.
2727
-	 */
2728
-	public function set_discount_code( $value ) {
2729
-		$this->set_prop( 'discount_code', $value );
2723
+     * Set the discount code.
2724
+     *
2725
+     * @since 1.0.19
2726
+     * @param  string $value discount code.
2727
+     */
2728
+    public function set_discount_code( $value ) {
2729
+        $this->set_prop( 'discount_code', $value );
2730 2730
     }
2731 2731
 
2732 2732
     /**
2733
-	 * Set the gateway.
2734
-	 *
2735
-	 * @since 1.0.19
2736
-	 * @param  string $value gateway.
2737
-	 */
2738
-	public function set_gateway( $value ) {
2739
-		$this->set_prop( 'gateway', $value );
2733
+     * Set the gateway.
2734
+     *
2735
+     * @since 1.0.19
2736
+     * @param  string $value gateway.
2737
+     */
2738
+    public function set_gateway( $value ) {
2739
+        $this->set_prop( 'gateway', $value );
2740 2740
     }
2741 2741
 
2742 2742
     /**
2743
-	 * Set the transaction id.
2744
-	 *
2745
-	 * @since 1.0.19
2746
-	 * @param  string $value transaction id.
2747
-	 */
2748
-	public function set_transaction_id( $value ) {
2749
-		$this->set_prop( 'transaction_id', $value );
2743
+     * Set the transaction id.
2744
+     *
2745
+     * @since 1.0.19
2746
+     * @param  string $value transaction id.
2747
+     */
2748
+    public function set_transaction_id( $value ) {
2749
+        $this->set_prop( 'transaction_id', $value );
2750 2750
     }
2751 2751
 
2752 2752
     /**
2753
-	 * Set the currency id.
2754
-	 *
2755
-	 * @since 1.0.19
2756
-	 * @param  string $value currency id.
2757
-	 */
2758
-	public function set_currency( $value ) {
2759
-		$this->set_prop( 'currency', $value );
2753
+     * Set the currency id.
2754
+     *
2755
+     * @since 1.0.19
2756
+     * @param  string $value currency id.
2757
+     */
2758
+    public function set_currency( $value ) {
2759
+        $this->set_prop( 'currency', $value );
2760 2760
     }
2761 2761
 
2762 2762
     /**
2763
-	 * Set the subscription id.
2764
-	 *
2765
-	 * @since 1.0.19
2766
-	 * @param  string $value subscription id.
2767
-	 */
2768
-	public function set_subscription_id( $value ) {
2769
-		$this->set_prop( 'subscription_id', $value );
2763
+     * Set the subscription id.
2764
+     *
2765
+     * @since 1.0.19
2766
+     * @param  string $value subscription id.
2767
+     */
2768
+    public function set_subscription_id( $value ) {
2769
+        $this->set_prop( 'subscription_id', $value );
2770 2770
     }
2771 2771
 
2772 2772
     /*
@@ -2805,12 +2805,12 @@  discard block
 block discarded – undo
2805 2805
      */
2806 2806
     public function is_taxable() {
2807 2807
         return (int) $this->disable_taxes === 0;
2808
-	}
2808
+    }
2809 2809
 
2810
-	/**
2811
-	 * @deprecated
2812
-	 */
2813
-	public function has_vat() {
2810
+    /**
2811
+     * @deprecated
2812
+     */
2813
+    public function has_vat() {
2814 2814
         global $wpinv_euvat, $wpi_country;
2815 2815
 
2816 2816
         $requires_vat = false;
@@ -2821,17 +2821,17 @@  discard block
 block discarded – undo
2821 2821
         }
2822 2822
 
2823 2823
         return apply_filters( 'wpinv_invoice_has_vat', $requires_vat, $this );
2824
-	}
2824
+    }
2825 2825
 
2826
-	/**
2827
-	 * Checks to see if the invoice requires payment.
2828
-	 */
2829
-	public function is_free() {
2826
+    /**
2827
+     * Checks to see if the invoice requires payment.
2828
+     */
2829
+    public function is_free() {
2830 2830
         $is_free = ! ( (float) wpinv_round_amount( $this->get_initial_total() ) > 0 );
2831 2831
 
2832
-		if ( $is_free && $this->is_recurring() ) {
2833
-			$is_free = ! ( (float) wpinv_round_amount( $this->get_recurring_total() ) > 0 );
2834
-		}
2832
+        if ( $is_free && $this->is_recurring() ) {
2833
+            $is_free = ! ( (float) wpinv_round_amount( $this->get_recurring_total() ) > 0 );
2834
+        }
2835 2835
 
2836 2836
         return apply_filters( 'wpinv_invoice_is_free', $is_free, $this );
2837 2837
     }
@@ -2842,30 +2842,30 @@  discard block
 block discarded – undo
2842 2842
     public function is_paid() {
2843 2843
         $is_paid = $this->has_status( array( 'publish', 'wpi-processing', 'wpi-renewal' ) );
2844 2844
         return apply_filters( 'wpinv_invoice_is_paid', $is_paid, $this );
2845
-	}
2845
+    }
2846 2846
 
2847
-	/**
2847
+    /**
2848 2848
      * Checks if the invoice needs payment.
2849 2849
      */
2850
-	public function needs_payment() {
2851
-		$needs_payment = ! $this->is_paid() && ! $this->is_free();
2850
+    public function needs_payment() {
2851
+        $needs_payment = ! $this->is_paid() && ! $this->is_free();
2852 2852
         return apply_filters( 'wpinv_needs_payment', $needs_payment, $this );
2853 2853
     }
2854 2854
 
2855
-	/**
2855
+    /**
2856 2856
      * Checks if the invoice is refunded.
2857 2857
      */
2858
-	public function is_refunded() {
2858
+    public function is_refunded() {
2859 2859
         $is_refunded = $this->has_status( 'wpi-refunded' );
2860 2860
         return apply_filters( 'wpinv_invoice_is_refunded', $is_refunded, $this );
2861
-	}
2861
+    }
2862 2862
 
2863
-	/**
2863
+    /**
2864 2864
      * Checks if the invoice is draft.
2865 2865
      */
2866
-	public function is_draft() {
2866
+    public function is_draft() {
2867 2867
         return $this->has_status( 'draft, auto-draft' );
2868
-	}
2868
+    }
2869 2869
 
2870 2870
     /**
2871 2871
      * Checks if the invoice has a given status.
@@ -2873,9 +2873,9 @@  discard block
 block discarded – undo
2873 2873
     public function has_status( $status ) {
2874 2874
         $status = wpinv_parse_list( $status );
2875 2875
         return apply_filters( 'wpinv_has_status', in_array( $this->get_status(), $status ), $status );
2876
-	}
2876
+    }
2877 2877
 
2878
-	/**
2878
+    /**
2879 2879
      * Checks if the invoice is of a given type.
2880 2880
      */
2881 2881
     public function is_type( $type ) {
@@ -2898,25 +2898,25 @@  discard block
 block discarded – undo
2898 2898
      */
2899 2899
     public function has_free_trial() {
2900 2900
         return $this->is_recurring() && 0 == $this->get_initial_total();
2901
-	}
2901
+    }
2902 2902
 
2903
-	/**
2903
+    /**
2904 2904
      * @deprecated
2905 2905
      */
2906 2906
     public function is_free_trial() {
2907 2907
         $this->has_free_trial();
2908 2908
     }
2909 2909
 
2910
-	/**
2910
+    /**
2911 2911
      * Check if the initial payment if 0.
2912 2912
      *
2913 2913
      */
2914
-	public function is_initial_free() {
2914
+    public function is_initial_free() {
2915 2915
         $is_initial_free = ! ( (float) wpinv_round_amount( $this->get_initial_total() ) > 0 );
2916 2916
         return apply_filters( 'wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this );
2917 2917
     }
2918 2918
 	
2919
-	/**
2919
+    /**
2920 2920
      * Check if the recurring item has a free trial.
2921 2921
      *
2922 2922
      */
@@ -2929,21 +2929,21 @@  discard block
 block discarded – undo
2929 2929
 
2930 2930
         $item = new WPInv_Item( $this->recurring_item );
2931 2931
         return $item->has_free_trial();
2932
-	}
2932
+    }
2933 2933
 
2934
-	/**
2934
+    /**
2935 2935
      * Check if the free trial is a result of a discount.
2936 2936
      */
2937 2937
     public function is_free_trial_from_discount() {
2938
-		return $this->has_free_trial() && ! $this->item_has_free_trial();
2939
-	}
2938
+        return $this->has_free_trial() && ! $this->item_has_free_trial();
2939
+    }
2940 2940
 	
2941
-	/**
2941
+    /**
2942 2942
      * @deprecated
2943 2943
      */
2944 2944
     public function discount_first_payment_only() {
2945 2945
 
2946
-		$discount_code = $this->get_discount_code();
2946
+        $discount_code = $this->get_discount_code();
2947 2947
         if ( empty( $this->discount_code ) || ! $this->is_recurring() ) {
2948 2948
             return true;
2949 2949
         }
@@ -2975,19 +2975,19 @@  discard block
 block discarded – undo
2975 2975
     public function add_item( $item ) {
2976 2976
 
2977 2977
         // Make sure that it is available for purchase.
2978
-		if ( $item->get_id() > 0 && ! $item->can_purchase() ) {
2979
-			return new WP_Error( 'invalid_item', __( 'This item is not available for purchase', 'invoicing' ) );
2978
+        if ( $item->get_id() > 0 && ! $item->can_purchase() ) {
2979
+            return new WP_Error( 'invalid_item', __( 'This item is not available for purchase', 'invoicing' ) );
2980 2980
         }
2981 2981
 
2982 2982
         // Do we have a recurring item?
2983
-		if ( $item->is_recurring() ) {
2983
+        if ( $item->is_recurring() ) {
2984 2984
 
2985
-			// An invoice can only contain one recurring item.
2986
-			if ( ! empty( $this->recurring_item ) ) {
2987
-				return false;
2988
-			}
2985
+            // An invoice can only contain one recurring item.
2986
+            if ( ! empty( $this->recurring_item ) ) {
2987
+                return false;
2988
+            }
2989 2989
 
2990
-			$this->recurring_item = $item->get_id();
2990
+            $this->recurring_item = $item->get_id();
2991 2991
         }
2992 2992
 
2993 2993
         // Invoice id.
@@ -2998,25 +2998,25 @@  discard block
 block discarded – undo
2998 2998
         $items[ $item->get_id() ] = $item;
2999 2999
 
3000 3000
         $this->set_prop( 'items', $items );
3001
-		return true;
3001
+        return true;
3002 3002
     }
3003 3003
 
3004 3004
     /**
3005
-	 * Retrieves a specific item.
3006
-	 *
3007
-	 * @since 1.0.19
3008
-	 */
3009
-	public function get_item( $item_id ) {
3005
+     * Retrieves a specific item.
3006
+     *
3007
+     * @since 1.0.19
3008
+     */
3009
+    public function get_item( $item_id ) {
3010 3010
         $items = $this->get_items();
3011
-		return ( ! empty( $item_id ) && isset( $items[ $item_id ] ) ) ? $items[ $item_id ] : null;
3011
+        return ( ! empty( $item_id ) && isset( $items[ $item_id ] ) ) ? $items[ $item_id ] : null;
3012 3012
     }
3013 3013
 
3014 3014
     /**
3015
-	 * Removes a specific item.
3016
-	 *
3017
-	 * @since 1.0.19
3018
-	 */
3019
-	public function remove_item( $item_id ) {
3015
+     * Removes a specific item.
3016
+     *
3017
+     * @since 1.0.19
3018
+     */
3019
+    public function remove_item( $item_id ) {
3020 3020
         $items = $this->get_items();
3021 3021
 
3022 3022
         if ( $item_id == $this->recurring_item ) {
@@ -3044,38 +3044,38 @@  discard block
 block discarded – undo
3044 3044
         if ( isset( $fees[ $fee ] ) && isset( $fees[ $fee ]['amount'] ) ) {
3045 3045
 
3046 3046
             $amount = $fees[ $fee ]['amount'] += $amount;
3047
-			$fees[ $fee ] = array(
3047
+            $fees[ $fee ] = array(
3048 3048
                 'amount'    => $amount,
3049 3049
                 'recurring' => (bool) $recurring,
3050 3050
             );
3051 3051
 
3052
-		} else {
3053
-			$fees[ $fee ] = array(
3052
+        } else {
3053
+            $fees[ $fee ] = array(
3054 3054
                 'amount'    => $amount,
3055 3055
                 'recurring' => (bool) $recurring,
3056 3056
             );
3057
-		}
3057
+        }
3058 3058
 
3059 3059
         $this->set_prop( 'fees', $fee );
3060 3060
 
3061 3061
     }
3062 3062
 
3063 3063
     /**
3064
-	 * Retrieves a specific fee.
3065
-	 *
3066
-	 * @since 1.0.19
3067
-	 */
3068
-	public function get_fee( $fee ) {
3064
+     * Retrieves a specific fee.
3065
+     *
3066
+     * @since 1.0.19
3067
+     */
3068
+    public function get_fee( $fee ) {
3069 3069
         $fees = $this->get_fees();
3070
-		return isset( $fees[ $fee ] ) ? $fees[ $fee ] : null;
3070
+        return isset( $fees[ $fee ] ) ? $fees[ $fee ] : null;
3071 3071
     }
3072 3072
 
3073 3073
     /**
3074
-	 * Removes a specific fee.
3075
-	 *
3076
-	 * @since 1.0.19
3077
-	 */
3078
-	public function remove_fee( $fee ) {
3074
+     * Removes a specific fee.
3075
+     *
3076
+     * @since 1.0.19
3077
+     */
3078
+    public function remove_fee( $fee ) {
3079 3079
         $fees = $this->get_fees();
3080 3080
         if ( isset( $fees[ $fee ] ) ) {
3081 3081
             unset( $fees[ $fee ] );
@@ -3098,44 +3098,44 @@  discard block
 block discarded – undo
3098 3098
         if ( isset( $discounts[ $discount ] ) && isset( $discounts[ $discount ]['amount'] ) ) {
3099 3099
 
3100 3100
             $amount = $discounts[ $discount ]['amount'] += $amount;
3101
-			$discounts[ $discount ] = array(
3101
+            $discounts[ $discount ] = array(
3102 3102
                 'amount'    => $amount,
3103 3103
                 'recurring' => (bool) $recurring,
3104 3104
             );
3105 3105
 
3106
-		} else {
3107
-			$discounts[ $discount ] = array(
3106
+        } else {
3107
+            $discounts[ $discount ] = array(
3108 3108
                 'amount'    => $amount,
3109 3109
                 'recurring' => (bool) $recurring,
3110 3110
             );
3111
-		}
3111
+        }
3112 3112
 
3113 3113
         $this->set_prop( 'discounts', $discount );
3114 3114
 
3115 3115
     }
3116 3116
 
3117 3117
     /**
3118
-	 * Retrieves a specific discount.
3119
-	 *
3120
-	 * @since 1.0.19
3121
-	 */
3122
-	public function get_discount( $discount = false ) {
3118
+     * Retrieves a specific discount.
3119
+     *
3120
+     * @since 1.0.19
3121
+     */
3122
+    public function get_discount( $discount = false ) {
3123 3123
 
3124
-		// Backwards compatibilty.
3125
-		if ( empty( $discount ) ) {
3126
-			return $this->get_total_discount();
3127
-		}
3124
+        // Backwards compatibilty.
3125
+        if ( empty( $discount ) ) {
3126
+            return $this->get_total_discount();
3127
+        }
3128 3128
 
3129 3129
         $discounts = $this->get_discounts();
3130
-		return isset( $discounts[ $discount ] ) ? $discounts[ $discount ] : null;
3130
+        return isset( $discounts[ $discount ] ) ? $discounts[ $discount ] : null;
3131 3131
     }
3132 3132
 
3133 3133
     /**
3134
-	 * Removes a specific discount.
3135
-	 *
3136
-	 * @since 1.0.19
3137
-	 */
3138
-	public function remove_discount( $discount ) {
3134
+     * Removes a specific discount.
3135
+     *
3136
+     * @since 1.0.19
3137
+     */
3138
+    public function remove_discount( $discount ) {
3139 3139
         $discounts = $this->get_discounts();
3140 3140
         if ( isset( $discounts[ $discount ] ) ) {
3141 3141
             unset( $discounts[ $discount ] );
@@ -3161,38 +3161,38 @@  discard block
 block discarded – undo
3161 3161
         if ( isset( $taxes[ $tax ] ) && isset( $taxes[ $tax ]['amount'] ) ) {
3162 3162
 
3163 3163
             $amount = $taxes[ $tax ]['amount'] += $amount;
3164
-			$taxes[ $tax ] = array(
3164
+            $taxes[ $tax ] = array(
3165 3165
                 'amount'    => $amount,
3166 3166
                 'recurring' => (bool) $recurring,
3167 3167
             );
3168 3168
 
3169
-		} else {
3170
-			$taxes[ $tax ] = array(
3169
+        } else {
3170
+            $taxes[ $tax ] = array(
3171 3171
                 'amount'    => $amount,
3172 3172
                 'recurring' => (bool) $recurring,
3173 3173
             );
3174
-		}
3174
+        }
3175 3175
 
3176 3176
         $this->set_prop( 'taxes', $tax );
3177 3177
 
3178 3178
     }
3179 3179
 
3180 3180
     /**
3181
-	 * Retrieves a specific tax.
3182
-	 *
3183
-	 * @since 1.0.19
3184
-	 */
3185
-	public function get_tax( $tax ) {
3181
+     * Retrieves a specific tax.
3182
+     *
3183
+     * @since 1.0.19
3184
+     */
3185
+    public function get_tax( $tax ) {
3186 3186
         $taxes = $this->get_taxes();
3187
-		return isset( $taxes[ $tax ] ) ? $taxes[ $tax ] : null;
3187
+        return isset( $taxes[ $tax ] ) ? $taxes[ $tax ] : null;
3188 3188
     }
3189 3189
 
3190 3190
     /**
3191
-	 * Removes a specific tax.
3192
-	 *
3193
-	 * @since 1.0.19
3194
-	 */
3195
-	public function remove_tax( $tax ) {
3191
+     * Removes a specific tax.
3192
+     *
3193
+     * @since 1.0.19
3194
+     */
3195
+    public function remove_tax( $tax ) {
3196 3196
         $taxes = $this->get_discounts();
3197 3197
         if ( isset( $taxes[ $tax ] ) ) {
3198 3198
             unset( $taxes[ $tax ] );
@@ -3201,160 +3201,160 @@  discard block
 block discarded – undo
3201 3201
     }
3202 3202
 
3203 3203
     /**
3204
-	 * Recalculates the invoice subtotal.
3205
-	 *
3206
-	 * @since 1.0.19
3207
-	 * @return float The recalculated subtotal
3208
-	 */
3209
-	public function recalculate_subtotal() {
3204
+     * Recalculates the invoice subtotal.
3205
+     *
3206
+     * @since 1.0.19
3207
+     * @return float The recalculated subtotal
3208
+     */
3209
+    public function recalculate_subtotal() {
3210 3210
         $items     = $this->get_items();
3211
-		$subtotal  = 0;
3212
-		$recurring = 0;
3211
+        $subtotal  = 0;
3212
+        $recurring = 0;
3213 3213
 
3214 3214
         foreach ( $items as $item ) {
3215
-			$subtotal  += $item->get_sub_total();
3216
-			$recurring += $item->get_recurring_sub_total();
3215
+            $subtotal  += $item->get_sub_total();
3216
+            $recurring += $item->get_recurring_sub_total();
3217 3217
         }
3218 3218
 
3219
-		if ( $this->is_renewal() ) {
3220
-			$this->set_subtotal( $recurring );
3221
-		} else {
3222
-			$this->set_subtotal( $subtotal );
3223
-		}
3219
+        if ( $this->is_renewal() ) {
3220
+            $this->set_subtotal( $recurring );
3221
+        } else {
3222
+            $this->set_subtotal( $subtotal );
3223
+        }
3224 3224
 
3225
-		$this->totals['subtotal'] = array(
3226
-			'initial'   => $subtotal,
3227
-			'recurring' => $recurring,
3228
-		);
3225
+        $this->totals['subtotal'] = array(
3226
+            'initial'   => $subtotal,
3227
+            'recurring' => $recurring,
3228
+        );
3229 3229
 
3230 3230
         return $this->is_renewal() ? $recurring : $subtotal;
3231 3231
     }
3232 3232
 
3233 3233
     /**
3234
-	 * Recalculates the invoice discount total.
3235
-	 *
3236
-	 * @since 1.0.19
3237
-	 * @return float The recalculated discount
3238
-	 */
3239
-	public function recalculate_total_discount() {
3234
+     * Recalculates the invoice discount total.
3235
+     *
3236
+     * @since 1.0.19
3237
+     * @return float The recalculated discount
3238
+     */
3239
+    public function recalculate_total_discount() {
3240 3240
         $discounts = $this->get_discounts();
3241
-		$discount  = 0;
3242
-		$recurring = 0;
3241
+        $discount  = 0;
3242
+        $recurring = 0;
3243 3243
 
3244 3244
         foreach ( $discounts as $data ) {
3245 3245
 
3246
-			if ( $data['recurring'] ) {
3247
-				$recurring += $data['amount'];
3248
-			} else {
3249
-				$discount += $data['amount'];
3250
-			}
3246
+            if ( $data['recurring'] ) {
3247
+                $recurring += $data['amount'];
3248
+            } else {
3249
+                $discount += $data['amount'];
3250
+            }
3251 3251
 
3252
-		}
3252
+        }
3253 3253
 
3254
-		if ( $this->is_renewal() ) {
3255
-			$this->set_total_discount( $recurring );
3256
-		} else {
3257
-			$this->set_total_discount( $discount );
3258
-		}
3254
+        if ( $this->is_renewal() ) {
3255
+            $this->set_total_discount( $recurring );
3256
+        } else {
3257
+            $this->set_total_discount( $discount );
3258
+        }
3259 3259
 
3260
-		$this->totals['discount'] = array(
3261
-			'initial'   => $discount,
3262
-			'recurring' => $recurring,
3263
-		);
3260
+        $this->totals['discount'] = array(
3261
+            'initial'   => $discount,
3262
+            'recurring' => $recurring,
3263
+        );
3264 3264
 
3265
-		return $this->is_renewal() ? $recurring : $discount;
3265
+        return $this->is_renewal() ? $recurring : $discount;
3266 3266
 
3267 3267
     }
3268 3268
 
3269 3269
     /**
3270
-	 * Recalculates the invoice tax total.
3271
-	 *
3272
-	 * @since 1.0.19
3273
-	 * @return float The recalculated tax
3274
-	 */
3275
-	public function recalculate_total_tax() {
3270
+     * Recalculates the invoice tax total.
3271
+     *
3272
+     * @since 1.0.19
3273
+     * @return float The recalculated tax
3274
+     */
3275
+    public function recalculate_total_tax() {
3276 3276
         $taxes     = $this->get_taxes();
3277
-		$tax       = 0;
3278
-		$recurring = 0;
3277
+        $tax       = 0;
3278
+        $recurring = 0;
3279 3279
 
3280 3280
         foreach ( $taxes as $data ) {
3281 3281
 
3282
-			if ( $data['recurring'] ) {
3283
-				$recurring += $data['amount'];
3284
-			} else {
3285
-				$tax += $data['amount'];
3286
-			}
3282
+            if ( $data['recurring'] ) {
3283
+                $recurring += $data['amount'];
3284
+            } else {
3285
+                $tax += $data['amount'];
3286
+            }
3287 3287
 
3288
-		}
3288
+        }
3289 3289
 
3290
-		if ( $this->is_renewal() ) {
3291
-			$this->set_total_tax( $recurring );
3292
-		} else {
3293
-			$this->set_total_tax( $tax );
3294
-		}
3290
+        if ( $this->is_renewal() ) {
3291
+            $this->set_total_tax( $recurring );
3292
+        } else {
3293
+            $this->set_total_tax( $tax );
3294
+        }
3295 3295
 
3296
-		$this->totals['tax'] = array(
3297
-			'initial'   => $tax,
3298
-			'recurring' => $recurring,
3299
-		);
3296
+        $this->totals['tax'] = array(
3297
+            'initial'   => $tax,
3298
+            'recurring' => $recurring,
3299
+        );
3300 3300
 
3301
-		return $this->is_renewal() ? $recurring : $tax;
3301
+        return $this->is_renewal() ? $recurring : $tax;
3302 3302
 
3303 3303
     }
3304 3304
 
3305 3305
     /**
3306
-	 * Recalculates the invoice fees total.
3307
-	 *
3308
-	 * @since 1.0.19
3309
-	 * @return float The recalculated fee
3310
-	 */
3311
-	public function recalculate_total_fees() {
3312
-		$fees      = $this->get_fees();
3313
-		$fee       = 0;
3314
-		$recurring = 0;
3306
+     * Recalculates the invoice fees total.
3307
+     *
3308
+     * @since 1.0.19
3309
+     * @return float The recalculated fee
3310
+     */
3311
+    public function recalculate_total_fees() {
3312
+        $fees      = $this->get_fees();
3313
+        $fee       = 0;
3314
+        $recurring = 0;
3315 3315
 
3316 3316
         foreach ( $fees as $data ) {
3317 3317
 
3318
-			if ( $data['recurring'] ) {
3319
-				$recurring += $data['amount'];
3320
-			} else {
3321
-				$fee += $data['amount'];
3322
-			}
3318
+            if ( $data['recurring'] ) {
3319
+                $recurring += $data['amount'];
3320
+            } else {
3321
+                $fee += $data['amount'];
3322
+            }
3323 3323
 
3324
-		}
3324
+        }
3325 3325
 
3326 3326
         if ( $this->is_renewal() ) {
3327
-			$this->set_total_fees( $recurring );
3328
-		} else {
3329
-			$this->set_total_fees( $fee );
3330
-		}
3327
+            $this->set_total_fees( $recurring );
3328
+        } else {
3329
+            $this->set_total_fees( $fee );
3330
+        }
3331 3331
 
3332
-		$this->totals['fee'] = array(
3333
-			'initial'   => $fee,
3334
-			'recurring' => $recurring,
3335
-		);
3332
+        $this->totals['fee'] = array(
3333
+            'initial'   => $fee,
3334
+            'recurring' => $recurring,
3335
+        );
3336 3336
 
3337 3337
         $this->set_total_fees( $fee );
3338 3338
         return $this->is_renewal() ? $recurring : $fee;
3339 3339
     }
3340 3340
 
3341 3341
     /**
3342
-	 * Recalculates the invoice total.
3343
-	 *
3344
-	 * @since 1.0.19
3342
+     * Recalculates the invoice total.
3343
+     *
3344
+     * @since 1.0.19
3345 3345
      * @return float The invoice total
3346
-	 */
3347
-	public function recalculate_total() {
3346
+     */
3347
+    public function recalculate_total() {
3348 3348
         $this->recalculate_subtotal();
3349 3349
         $this->recalculate_total_fees();
3350 3350
         $this->recalculate_total_discount();
3351 3351
         $this->recalculate_total_tax();
3352
-		return $this->get_total();
3353
-	}
3352
+        return $this->get_total();
3353
+    }
3354 3354
 
3355
-	/**
3356
-	 * @deprecated
3357
-	 */
3355
+    /**
3356
+     * @deprecated
3357
+     */
3358 3358
     public function recalculate_totals( $temp = false ) {
3359 3359
         $this->update_items( $temp );
3360 3360
         $this->save( true );
@@ -3418,9 +3418,9 @@  discard block
 block discarded – undo
3418 3418
         }
3419 3419
 
3420 3420
         return $note_id;
3421
-	}
3421
+    }
3422 3422
 
3423
-	/**
3423
+    /**
3424 3424
      * Generates a unique key for the invoice.
3425 3425
      */
3426 3426
     public function generate_key( $string = '' ) {
@@ -3441,106 +3441,106 @@  discard block
 block discarded – undo
3441 3441
             $number      = $next_number;
3442 3442
         }
3443 3443
 
3444
-		$number = wpinv_format_invoice_number( $number, $this->post_type );
3444
+        $number = wpinv_format_invoice_number( $number, $this->post_type );
3445 3445
 
3446
-		return $number;
3447
-	}
3446
+        return $number;
3447
+    }
3448 3448
 
3449
-	/**
3450
-	 * Handle the status transition.
3451
-	 */
3452
-	protected function status_transition() {
3453
-		$status_transition = $this->status_transition;
3449
+    /**
3450
+     * Handle the status transition.
3451
+     */
3452
+    protected function status_transition() {
3453
+        $status_transition = $this->status_transition;
3454 3454
 
3455
-		// Reset status transition variable.
3456
-		$this->status_transition = false;
3455
+        // Reset status transition variable.
3456
+        $this->status_transition = false;
3457 3457
 
3458
-		if ( $status_transition ) {
3459
-			try {
3458
+        if ( $status_transition ) {
3459
+            try {
3460 3460
 
3461
-				// Fire a hook for the status change.
3462
-				do_action( 'getpaid_invoice_status_' . $status_transition['to'], $this->get_id(), $this, $status_transition );
3461
+                // Fire a hook for the status change.
3462
+                do_action( 'getpaid_invoice_status_' . $status_transition['to'], $this->get_id(), $this, $status_transition );
3463 3463
 
3464
-				// @deprecated this is deprecated and will be removed in the future.
3465
-				do_action( 'wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3464
+                // @deprecated this is deprecated and will be removed in the future.
3465
+                do_action( 'wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3466 3466
 
3467
-				if ( ! empty( $status_transition['from'] ) ) {
3467
+                if ( ! empty( $status_transition['from'] ) ) {
3468 3468
 
3469
-					/* translators: 1: old invoice status 2: new invoice status */
3470
-					$transition_note = sprintf( __( 'Status changed from %1$s to %2$s.', 'invoicing' ), wpinv_status_nicename( $status_transition['from'] ), wpinv_status_nicename( $status_transition['to'] ) );
3469
+                    /* translators: 1: old invoice status 2: new invoice status */
3470
+                    $transition_note = sprintf( __( 'Status changed from %1$s to %2$s.', 'invoicing' ), wpinv_status_nicename( $status_transition['from'] ), wpinv_status_nicename( $status_transition['to'] ) );
3471 3471
 
3472
-					// Fire another hook.
3473
-					do_action( 'getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $this );
3474
-					do_action( 'getpaid_invoice_status_changed', $this->get_id(), $status_transition['from'], $status_transition['to'], $this );
3472
+                    // Fire another hook.
3473
+                    do_action( 'getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $this );
3474
+                    do_action( 'getpaid_invoice_status_changed', $this->get_id(), $status_transition['from'], $status_transition['to'], $this );
3475 3475
 
3476
-					// @deprecated this is deprecated and will be removed in the future.
3477
-					do_action( 'wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->ID, $status_transition['from'] );
3476
+                    // @deprecated this is deprecated and will be removed in the future.
3477
+                    do_action( 'wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->ID, $status_transition['from'] );
3478 3478
 
3479
-					// Note the transition occurred.
3480
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
3479
+                    // Note the transition occurred.
3480
+                    $this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
3481 3481
 
3482
-					// Work out if this was for a payment, and trigger a payment_status hook instead.
3483
-					if (
3484
-						in_array( $status_transition['from'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed' ), true )
3485
-						&& in_array( $status_transition['to'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3486
-					) {
3487
-						do_action( 'getpaid_invoice_payment_status_changed', $this->get_id(), $this, $status_transition );
3488
-					}
3489
-				} else {
3490
-					/* translators: %s: new invoice status */
3491
-					$transition_note = sprintf( __( 'Status set to %s.', 'invoicing' ), wpinv_status_nicename( $status_transition['to'] ) );
3482
+                    // Work out if this was for a payment, and trigger a payment_status hook instead.
3483
+                    if (
3484
+                        in_array( $status_transition['from'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed' ), true )
3485
+                        && in_array( $status_transition['to'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3486
+                    ) {
3487
+                        do_action( 'getpaid_invoice_payment_status_changed', $this->get_id(), $this, $status_transition );
3488
+                    }
3489
+                } else {
3490
+                    /* translators: %s: new invoice status */
3491
+                    $transition_note = sprintf( __( 'Status set to %s.', 'invoicing' ), wpinv_status_nicename( $status_transition['to'] ) );
3492 3492
 
3493
-					// Note the transition occurred.
3494
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
3493
+                    // Note the transition occurred.
3494
+                    $this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
3495 3495
 
3496
-				}
3497
-			} catch ( Exception $e ) {
3498
-				$this->add_note( __( 'Error during status transition.', 'invoicing' ) . ' ' . $e->getMessage() );
3499
-			}
3500
-		}
3501
-	}
3496
+                }
3497
+            } catch ( Exception $e ) {
3498
+                $this->add_note( __( 'Error during status transition.', 'invoicing' ) . ' ' . $e->getMessage() );
3499
+            }
3500
+        }
3501
+    }
3502 3502
 
3503
-	/**
3504
-	 * Updates an invoice status.
3505
-	 */
3506
-	public function update_status( $new_status = false, $note = '', $manual = false ) {
3503
+    /**
3504
+     * Updates an invoice status.
3505
+     */
3506
+    public function update_status( $new_status = false, $note = '', $manual = false ) {
3507 3507
 
3508
-		// Fires before updating a status.
3509
-		do_action( 'wpinv_before_invoice_status_change', $this->ID, $new_status, $this->get_status( 'edit' ) );
3508
+        // Fires before updating a status.
3509
+        do_action( 'wpinv_before_invoice_status_change', $this->ID, $new_status, $this->get_status( 'edit' ) );
3510 3510
 
3511
-		// Update the status.
3512
-		$this->set_status( $new_status, $note, $manual );
3511
+        // Update the status.
3512
+        $this->set_status( $new_status, $note, $manual );
3513 3513
 
3514
-		// Save the order.
3515
-		return $this->save();
3514
+        // Save the order.
3515
+        return $this->save();
3516 3516
 
3517
-	}
3517
+    }
3518 3518
 
3519
-	/**
3520
-	 * @deprecated
3521
-	 */
3522
-	public function refresh_item_ids() {
3519
+    /**
3520
+     * @deprecated
3521
+     */
3522
+    public function refresh_item_ids() {
3523 3523
         $item_ids = implode( ',', array_unique( array_keys( $this->get_items() ) ) );
3524 3524
         update_post_meta( $this->get_id(), '_wpinv_item_ids', $item_ids );
3525
-	}
3525
+    }
3526 3526
 
3527
-	/**
3528
-	 * @deprecated
3529
-	 */
3530
-	public function update_items( $temp = false ) {
3527
+    /**
3528
+     * @deprecated
3529
+     */
3530
+    public function update_items( $temp = false ) {
3531 3531
 
3532
-		$this->set_items( $this->get_items() );
3532
+        $this->set_items( $this->get_items() );
3533 3533
 
3534
-		if ( ! $temp ) {
3535
-			$this->save();
3536
-		}
3534
+        if ( ! $temp ) {
3535
+            $this->save();
3536
+        }
3537 3537
 
3538 3538
         return $this;
3539
-	}
3539
+    }
3540 3540
 
3541
-	/**
3542
-	 * @deprecated
3543
-	 */
3541
+    /**
3542
+     * @deprecated
3543
+     */
3544 3544
     public function validate_discount() {
3545 3545
 
3546 3546
         $discount_code = $this->get_discount_code();
@@ -3556,25 +3556,25 @@  discard block
 block discarded – undo
3556 3556
 
3557 3557
     }
3558 3558
 
3559
-	/**
3560
-	 * Refunds an invoice.
3561
-	 */
3559
+    /**
3560
+     * Refunds an invoice.
3561
+     */
3562 3562
     public function refund() {
3563
-		$this->set_status( 'wpi-refunded' );
3563
+        $this->set_status( 'wpi-refunded' );
3564 3564
         $this->save();
3565 3565
     }
3566 3566
 
3567
-	/**
3568
-	 * Save data to the database.
3569
-	 *
3570
-	 * @since 1.0.19
3571
-	 * @return int invoice ID
3572
-	 */
3573
-	public function save() {
3574
-		$this->maybe_set_date_paid();
3575
-		parent::save();
3576
-		$this->status_transition();
3577
-		return $this->get_id();
3578
-	}
3567
+    /**
3568
+     * Save data to the database.
3569
+     *
3570
+     * @since 1.0.19
3571
+     * @return int invoice ID
3572
+     */
3573
+    public function save() {
3574
+        $this->maybe_set_date_paid();
3575
+        parent::save();
3576
+        $this->status_transition();
3577
+        return $this->get_id();
3578
+    }
3579 3579
 
3580 3580
 }
Please login to merge, or discard this patch.
Spacing   +709 added lines, -709 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // MUST have WordPress.
4
-if ( !defined( 'WPINC' ) ) {
5
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
4
+if (!defined('WPINC')) {
5
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
6 6
 }
7 7
 
8 8
 /**
@@ -130,38 +130,38 @@  discard block
 block discarded – undo
130 130
 	 *
131 131
 	 * @param  int/string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, number or object to read.
132 132
 	 */
133
-    public function __construct( $invoice = false ) {
133
+    public function __construct($invoice = false) {
134 134
 
135
-        parent::__construct( $invoice );
135
+        parent::__construct($invoice);
136 136
 
137
-		if ( is_numeric( $invoice ) && getpaid_is_invoice_post_type( get_post_type( $invoice ) ) ) {
138
-			$this->set_id( $invoice );
139
-		} elseif ( $invoice instanceof self ) {
140
-			$this->set_id( $invoice->get_id() );
141
-		} elseif ( ! empty( $invoice->ID ) ) {
142
-			$this->set_id( $invoice->ID );
143
-		} elseif ( is_array( $invoice ) ) {
144
-			$this->set_props( $invoice );
137
+		if (is_numeric($invoice) && getpaid_is_invoice_post_type(get_post_type($invoice))) {
138
+			$this->set_id($invoice);
139
+		} elseif ($invoice instanceof self) {
140
+			$this->set_id($invoice->get_id());
141
+		} elseif (!empty($invoice->ID)) {
142
+			$this->set_id($invoice->ID);
143
+		} elseif (is_array($invoice)) {
144
+			$this->set_props($invoice);
145 145
 
146
-			if ( isset( $invoice['ID'] ) ) {
147
-				$this->set_id( $invoice['ID'] );
146
+			if (isset($invoice['ID'])) {
147
+				$this->set_id($invoice['ID']);
148 148
 			}
149 149
 
150
-		} elseif ( is_scalar( $invoice ) && $invoice_id = self::get_discount_id_by_code( $invoice, 'key' ) ) {
151
-			$this->set_id( $invoice_id );
152
-		} elseif ( is_scalar( $invoice ) && $invoice_id = self::get_discount_id_by_code( $invoice, 'number' ) ) {
153
-			$this->set_id( $invoice_id );
150
+		} elseif (is_scalar($invoice) && $invoice_id = self::get_discount_id_by_code($invoice, 'key')) {
151
+			$this->set_id($invoice_id);
152
+		} elseif (is_scalar($invoice) && $invoice_id = self::get_discount_id_by_code($invoice, 'number')) {
153
+			$this->set_id($invoice_id);
154 154
 		} else {
155
-			$this->set_object_read( true );
155
+			$this->set_object_read(true);
156 156
 		}
157 157
 
158 158
         // Load the datastore.
159
-		$this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
159
+		$this->data_store = GetPaid_Data_Store::load($this->data_store_name);
160 160
 
161
-		if ( $this->get_id() > 0 ) {
162
-            $this->post = get_post( $this->get_id() );
161
+		if ($this->get_id() > 0) {
162
+            $this->post = get_post($this->get_id());
163 163
             $this->ID   = $this->get_id();
164
-			$this->data_store->read( $this );
164
+			$this->data_store->read($this);
165 165
         }
166 166
 
167 167
     }
@@ -175,38 +175,38 @@  discard block
 block discarded – undo
175 175
 	 * @since 1.0.15
176 176
 	 * @return int
177 177
 	 */
178
-	public static function get_discount_id_by_code( $invoice_key_or_number, $field = 'key' ) {
178
+	public static function get_discount_id_by_code($invoice_key_or_number, $field = 'key') {
179 179
         global $wpdb;
180 180
 
181 181
 		// Trim the code.
182
-        $key = trim( $invoice_key_or_number );
182
+        $key = trim($invoice_key_or_number);
183 183
 
184 184
         // Valid fields.
185
-        $fields = array( 'key', 'number' );
185
+        $fields = array('key', 'number');
186 186
 
187 187
 		// Ensure a value has been passed.
188
-		if ( empty( $key ) || ! in_array( $field, $fields ) ) {
188
+		if (empty($key) || !in_array($field, $fields)) {
189 189
 			return 0;
190 190
 		}
191 191
 
192 192
 		// Maybe retrieve from the cache.
193
-		$invoice_id   = wp_cache_get( $key, 'getpaid_invoice_keys_' . $field );
194
-		if ( ! empty( $invoice_id ) ) {
193
+		$invoice_id = wp_cache_get($key, 'getpaid_invoice_keys_' . $field);
194
+		if (!empty($invoice_id)) {
195 195
 			return $invoice_id;
196 196
 		}
197 197
 
198 198
         // Fetch from the db.
199 199
         $table       = $wpdb->prefix . 'getpaid_invoices';
200 200
         $invoice_id  = $wpdb->get_var(
201
-            $wpdb->prepare( "SELECT `post_id` FROM $table WHERE $field=%s LIMIT 1", $key )
201
+            $wpdb->prepare("SELECT `post_id` FROM $table WHERE $field=%s LIMIT 1", $key)
202 202
         );
203 203
 
204
-		if ( empty( $invoice_id ) ) {
204
+		if (empty($invoice_id)) {
205 205
 			return 0;
206 206
 		}
207 207
 
208 208
 		// Update the cache with our data
209
-		wp_cache_set( $key, $invoice_id, 'getpaid_invoice_keys_' . $field );
209
+		wp_cache_set($key, $invoice_id, 'getpaid_invoice_keys_' . $field);
210 210
 
211 211
 		return $invoice_id;
212 212
     }
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
     /**
215 215
      * Checks if an invoice key is set.
216 216
      */
217
-    public function _isset( $key ) {
218
-        return isset( $this->data[$key] ) || method_exists( $this, "get_$key" );
217
+    public function _isset($key) {
218
+        return isset($this->data[$key]) || method_exists($this, "get_$key");
219 219
     }
220 220
 
221 221
     /*
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 	 * @param  string $context View or edit context.
241 241
 	 * @return int
242 242
 	 */
243
-	public function get_parent_id( $context = 'view' ) {
244
-		return (int) $this->get_prop( 'parent_id', $context );
243
+	public function get_parent_id($context = 'view') {
244
+		return (int) $this->get_prop('parent_id', $context);
245 245
     }
246 246
 
247 247
     /**
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 * @return WPInv_Invoice
252 252
 	 */
253 253
     public function get_parent_payment() {
254
-        return new WPInv_Invoice( $this->get_parent_id() );
254
+        return new WPInv_Invoice($this->get_parent_id());
255 255
     }
256 256
 
257 257
     /**
@@ -271,8 +271,8 @@  discard block
 block discarded – undo
271 271
 	 * @param  string $context View or edit context.
272 272
 	 * @return string
273 273
 	 */
274
-	public function get_status( $context = 'view' ) {
275
-		return $this->get_prop( 'status', $context );
274
+	public function get_status($context = 'view') {
275
+		return $this->get_prop('status', $context);
276 276
     }
277 277
 
278 278
     /**
@@ -282,15 +282,15 @@  discard block
 block discarded – undo
282 282
 	 * @return string
283 283
 	 */
284 284
     public function get_status_nicename() {
285
-        $statuses = wpinv_get_invoice_statuses( true, true, $this );
285
+        $statuses = wpinv_get_invoice_statuses(true, true, $this);
286 286
 
287
-        if ( $this->is_quote() && class_exists( 'Wpinv_Quotes_Shared' ) ) {
287
+        if ($this->is_quote() && class_exists('Wpinv_Quotes_Shared')) {
288 288
             $statuses = Wpinv_Quotes_Shared::wpinv_get_quote_statuses();
289 289
         }
290 290
 
291
-        $status = isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : $this->get_status();
291
+        $status = isset($statuses[$this->get_status()]) ? $statuses[$this->get_status()] : $this->get_status();
292 292
 
293
-        return apply_filters( 'wpinv_get_invoice_status_nicename', $status );
293
+        return apply_filters('wpinv_get_invoice_status_nicename', $status);
294 294
     }
295 295
 
296 296
     /**
@@ -300,27 +300,27 @@  discard block
 block discarded – undo
300 300
 	 * @param  string $context View or edit context.
301 301
 	 * @return string
302 302
 	 */
303
-	public function get_version( $context = 'view' ) {
304
-		return $this->get_prop( 'version', $context );
303
+	public function get_version($context = 'view') {
304
+		return $this->get_prop('version', $context);
305 305
 	}
306 306
 
307 307
 	/**
308 308
 	 * @deprecated
309 309
 	 */
310
-	public function get_invoice_date( $formatted = true ) {
310
+	public function get_invoice_date($formatted = true) {
311 311
         $date_completed = $this->get_date_completed();
312 312
         $invoice_date   = $date_completed != '0000-00-00 00:00:00' ? $date_completed : '';
313 313
 
314
-        if ( $invoice_date == '' ) {
314
+        if ($invoice_date == '') {
315 315
             $date_created   = $this->get_date_created();
316 316
             $invoice_date   = $date_created != '0000-00-00 00:00:00' ? $date_created : '';
317 317
         }
318 318
 
319
-        if ( $formatted && $invoice_date ) {
320
-            $invoice_date   = date_i18n( get_option( 'date_format' ), strtotime( $invoice_date ) );
319
+        if ($formatted && $invoice_date) {
320
+            $invoice_date = date_i18n(get_option('date_format'), strtotime($invoice_date));
321 321
         }
322 322
 
323
-        return apply_filters( 'wpinv_get_invoice_date', $invoice_date, $formatted, $this->ID, $this );
323
+        return apply_filters('wpinv_get_invoice_date', $invoice_date, $formatted, $this->ID, $this);
324 324
     }
325 325
 
326 326
     /**
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
 	 * @param  string $context View or edit context.
331 331
 	 * @return string
332 332
 	 */
333
-	public function get_date_created( $context = 'view' ) {
334
-		return $this->get_prop( 'date_created', $context );
333
+	public function get_date_created($context = 'view') {
334
+		return $this->get_prop('date_created', $context);
335 335
 	}
336 336
 	
337 337
 	/**
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
 	 * @param  string $context View or edit context.
342 342
 	 * @return string
343 343
 	 */
344
-	public function get_created_date( $context = 'view' ) {
345
-		return $this->get_date_created( $context );
344
+	public function get_created_date($context = 'view') {
345
+		return $this->get_date_created($context);
346 346
     }
347 347
 
348 348
     /**
@@ -352,11 +352,11 @@  discard block
 block discarded – undo
352 352
 	 * @param  string $context View or edit context.
353 353
 	 * @return string
354 354
 	 */
355
-	public function get_date_created_gmt( $context = 'view' ) {
356
-        $date = $this->get_date_created( $context );
355
+	public function get_date_created_gmt($context = 'view') {
356
+        $date = $this->get_date_created($context);
357 357
 
358
-        if ( $date ) {
359
-            $date = get_gmt_from_date( $date );
358
+        if ($date) {
359
+            $date = get_gmt_from_date($date);
360 360
         }
361 361
 		return $date;
362 362
     }
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
 	 * @param  string $context View or edit context.
369 369
 	 * @return string
370 370
 	 */
371
-	public function get_date_modified( $context = 'view' ) {
372
-		return $this->get_prop( 'date_modified', $context );
371
+	public function get_date_modified($context = 'view') {
372
+		return $this->get_prop('date_modified', $context);
373 373
 	}
374 374
 
375 375
 	/**
@@ -379,8 +379,8 @@  discard block
 block discarded – undo
379 379
 	 * @param  string $context View or edit context.
380 380
 	 * @return string
381 381
 	 */
382
-	public function get_modified_date( $context = 'view' ) {
383
-		return $this->get_date_modified( $context );
382
+	public function get_modified_date($context = 'view') {
383
+		return $this->get_date_modified($context);
384 384
     }
385 385
 
386 386
     /**
@@ -390,11 +390,11 @@  discard block
 block discarded – undo
390 390
 	 * @param  string $context View or edit context.
391 391
 	 * @return string
392 392
 	 */
393
-	public function get_date_modified_gmt( $context = 'view' ) {
394
-        $date = $this->get_date_modified( $context );
393
+	public function get_date_modified_gmt($context = 'view') {
394
+        $date = $this->get_date_modified($context);
395 395
 
396
-        if ( $date ) {
397
-            $date = get_gmt_from_date( $date );
396
+        if ($date) {
397
+            $date = get_gmt_from_date($date);
398 398
         }
399 399
 		return $date;
400 400
     }
@@ -406,8 +406,8 @@  discard block
 block discarded – undo
406 406
 	 * @param  string $context View or edit context.
407 407
 	 * @return string
408 408
 	 */
409
-	public function get_due_date( $context = 'view' ) {
410
-		return $this->get_prop( 'due_date', $context );
409
+	public function get_due_date($context = 'view') {
410
+		return $this->get_prop('due_date', $context);
411 411
     }
412 412
 
413 413
     /**
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
 	 * @param  string $context View or edit context.
418 418
 	 * @return string
419 419
 	 */
420
-	public function get_date_due( $context = 'view' ) {
421
-		return $this->get_due_date( $context );
420
+	public function get_date_due($context = 'view') {
421
+		return $this->get_due_date($context);
422 422
     }
423 423
 
424 424
     /**
@@ -428,11 +428,11 @@  discard block
 block discarded – undo
428 428
 	 * @param  string $context View or edit context.
429 429
 	 * @return string
430 430
 	 */
431
-	public function get_due_date_gmt( $context = 'view' ) {
432
-        $date = $this->get_due_date( $context );
431
+	public function get_due_date_gmt($context = 'view') {
432
+        $date = $this->get_due_date($context);
433 433
 
434
-        if ( $date ) {
435
-            $date = get_gmt_from_date( $date );
434
+        if ($date) {
435
+            $date = get_gmt_from_date($date);
436 436
         }
437 437
 		return $date;
438 438
     }
@@ -444,8 +444,8 @@  discard block
 block discarded – undo
444 444
 	 * @param  string $context View or edit context.
445 445
 	 * @return string
446 446
 	 */
447
-	public function get_gmt_date_due( $context = 'view' ) {
448
-		return $this->get_due_date_gmt( $context );
447
+	public function get_gmt_date_due($context = 'view') {
448
+		return $this->get_due_date_gmt($context);
449 449
     }
450 450
 
451 451
     /**
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
 	 * @param  string $context View or edit context.
456 456
 	 * @return string
457 457
 	 */
458
-	public function get_completed_date( $context = 'view' ) {
459
-		return $this->get_prop( 'completed_date', $context );
458
+	public function get_completed_date($context = 'view') {
459
+		return $this->get_prop('completed_date', $context);
460 460
     }
461 461
 
462 462
     /**
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
 	 * @param  string $context View or edit context.
467 467
 	 * @return string
468 468
 	 */
469
-	public function get_date_completed( $context = 'view' ) {
470
-		return $this->get_completed_date( $context );
469
+	public function get_date_completed($context = 'view') {
470
+		return $this->get_completed_date($context);
471 471
     }
472 472
 
473 473
     /**
@@ -477,11 +477,11 @@  discard block
 block discarded – undo
477 477
 	 * @param  string $context View or edit context.
478 478
 	 * @return string
479 479
 	 */
480
-	public function get_completed_date_gmt( $context = 'view' ) {
481
-        $date = $this->get_completed_date( $context );
480
+	public function get_completed_date_gmt($context = 'view') {
481
+        $date = $this->get_completed_date($context);
482 482
 
483
-        if ( $date ) {
484
-            $date = get_gmt_from_date( $date );
483
+        if ($date) {
484
+            $date = get_gmt_from_date($date);
485 485
         }
486 486
 		return $date;
487 487
     }
@@ -493,8 +493,8 @@  discard block
 block discarded – undo
493 493
 	 * @param  string $context View or edit context.
494 494
 	 * @return string
495 495
 	 */
496
-	public function get_gmt_completed_date( $context = 'view' ) {
497
-		return $this->get_completed_date_gmt( $context );
496
+	public function get_gmt_completed_date($context = 'view') {
497
+		return $this->get_completed_date_gmt($context);
498 498
     }
499 499
 
500 500
     /**
@@ -504,12 +504,12 @@  discard block
 block discarded – undo
504 504
 	 * @param  string $context View or edit context.
505 505
 	 * @return string
506 506
 	 */
507
-	public function get_number( $context = 'view' ) {
508
-        $number = $this->get_prop( 'number', $context );
507
+	public function get_number($context = 'view') {
508
+        $number = $this->get_prop('number', $context);
509 509
 
510
-        if ( empty( $number ) ) {
510
+        if (empty($number)) {
511 511
             $number = $this->generate_number();
512
-            $this->set_number( $number );
512
+            $this->set_number($number);
513 513
         }
514 514
 
515 515
 		return $number;
@@ -522,12 +522,12 @@  discard block
 block discarded – undo
522 522
 	 * @param  string $context View or edit context.
523 523
 	 * @return string
524 524
 	 */
525
-	public function get_key( $context = 'view' ) {
526
-        $key = $this->get_prop( 'key', $context );
525
+	public function get_key($context = 'view') {
526
+        $key = $this->get_prop('key', $context);
527 527
 
528
-        if ( empty( $key ) ) {
529
-            $key = $this->generate_key( $this->post_type );
530
-            $this->set_key( $key );
528
+        if (empty($key)) {
529
+            $key = $this->generate_key($this->post_type);
530
+            $this->set_key($key);
531 531
         }
532 532
 
533 533
 		return $key;
@@ -540,23 +540,23 @@  discard block
 block discarded – undo
540 540
 	 * @param  string $context View or edit context.
541 541
 	 * @return string
542 542
 	 */
543
-	public function get_type( $context = 'view' ) {
544
-        return $this->get_prop( 'type', $context );
543
+	public function get_type($context = 'view') {
544
+        return $this->get_prop('type', $context);
545 545
 	}
546 546
 
547 547
 	/**
548 548
 	 * @deprecated
549 549
 	 */
550
-	public function get_invoice_quote_type( $post_id ) {
551
-        if ( empty( $post_id ) ) {
550
+	public function get_invoice_quote_type($post_id) {
551
+        if (empty($post_id)) {
552 552
             return '';
553 553
         }
554 554
 
555
-        $type = get_post_type( $post_id );
555
+        $type = get_post_type($post_id);
556 556
 
557
-        if ( 'wpi_invoice' === $type ) {
557
+        if ('wpi_invoice' === $type) {
558 558
             $post_type = __('Invoice', 'invoicing');
559
-        } else{
559
+        } else {
560 560
             $post_type = __('Quote', 'invoicing');
561 561
         }
562 562
 
@@ -570,8 +570,8 @@  discard block
 block discarded – undo
570 570
 	 * @param  string $context View or edit context.
571 571
 	 * @return string
572 572
 	 */
573
-	public function get_post_type( $context = 'view' ) {
574
-        return $this->get_prop( 'post_type', $context );
573
+	public function get_post_type($context = 'view') {
574
+        return $this->get_prop('post_type', $context);
575 575
     }
576 576
 
577 577
     /**
@@ -581,8 +581,8 @@  discard block
 block discarded – undo
581 581
 	 * @param  string $context View or edit context.
582 582
 	 * @return string
583 583
 	 */
584
-	public function get_mode( $context = 'view' ) {
585
-        return $this->get_prop( 'mode', $context );
584
+	public function get_mode($context = 'view') {
585
+        return $this->get_prop('mode', $context);
586 586
     }
587 587
 
588 588
     /**
@@ -592,12 +592,12 @@  discard block
 block discarded – undo
592 592
 	 * @param  string $context View or edit context.
593 593
 	 * @return string
594 594
 	 */
595
-	public function get_path( $context = 'view' ) {
596
-        $path = $this->get_prop( 'path', $context );
595
+	public function get_path($context = 'view') {
596
+        $path = $this->get_prop('path', $context);
597 597
 
598
-        if ( empty( $path ) ) {
599
-            $prefix = apply_filters( 'wpinv_post_name_prefix', 'inv-', $this->post_type );
600
-            $path   = sanitize_title( $prefix . $this->get_id() );
598
+        if (empty($path)) {
599
+            $prefix = apply_filters('wpinv_post_name_prefix', 'inv-', $this->post_type);
600
+            $path   = sanitize_title($prefix . $this->get_id());
601 601
         }
602 602
 
603 603
 		return $path;
@@ -610,10 +610,10 @@  discard block
 block discarded – undo
610 610
 	 * @param  string $context View or edit context.
611 611
 	 * @return string
612 612
 	 */
613
-	public function get_name( $context = 'view' ) {
614
-        $name = $this->get_prop( 'title', $context );
613
+	public function get_name($context = 'view') {
614
+        $name = $this->get_prop('title', $context);
615 615
 
616
-		return empty( $name ) ? $this->get_number( $context ) : $name;
616
+		return empty($name) ? $this->get_number($context) : $name;
617 617
     }
618 618
 
619 619
     /**
@@ -623,8 +623,8 @@  discard block
 block discarded – undo
623 623
 	 * @param  string $context View or edit context.
624 624
 	 * @return string
625 625
 	 */
626
-	public function get_title( $context = 'view' ) {
627
-		return $this->get_name( $context );
626
+	public function get_title($context = 'view') {
627
+		return $this->get_name($context);
628 628
     }
629 629
 
630 630
     /**
@@ -634,8 +634,8 @@  discard block
 block discarded – undo
634 634
 	 * @param  string $context View or edit context.
635 635
 	 * @return string
636 636
 	 */
637
-	public function get_description( $context = 'view' ) {
638
-		return $this->get_prop( 'description', $context );
637
+	public function get_description($context = 'view') {
638
+		return $this->get_prop('description', $context);
639 639
     }
640 640
 
641 641
     /**
@@ -645,8 +645,8 @@  discard block
 block discarded – undo
645 645
 	 * @param  string $context View or edit context.
646 646
 	 * @return string
647 647
 	 */
648
-	public function get_excerpt( $context = 'view' ) {
649
-		return $this->get_description( $context );
648
+	public function get_excerpt($context = 'view') {
649
+		return $this->get_description($context);
650 650
     }
651 651
 
652 652
     /**
@@ -656,8 +656,8 @@  discard block
 block discarded – undo
656 656
 	 * @param  string $context View or edit context.
657 657
 	 * @return string
658 658
 	 */
659
-	public function get_summary( $context = 'view' ) {
660
-		return $this->get_description( $context );
659
+	public function get_summary($context = 'view') {
660
+		return $this->get_description($context);
661 661
     }
662 662
 
663 663
     /**
@@ -667,23 +667,23 @@  discard block
 block discarded – undo
667 667
      * @param  string $context View or edit context.
668 668
 	 * @return array
669 669
 	 */
670
-    public function get_user_info( $context = 'view' ) {
670
+    public function get_user_info($context = 'view') {
671 671
         $user_info = array(
672
-            'user_id'    => $this->get_user_id( $context ),
673
-            'email'      => $this->get_email( $context ),
674
-            'first_name' => $this->get_first_name( $context ),
675
-            'last_name'  => $this->get_last_name( $context ),
676
-            'address'    => $this->get_address( $context ),
677
-            'phone'      => $this->get_phone( $context ),
678
-            'city'       => $this->get_city( $context ),
679
-            'country'    => $this->get_country( $context ),
680
-            'state'      => $this->get_state( $context ),
681
-            'zip'        => $this->get_zip( $context ),
682
-            'company'    => $this->get_company( $context ),
683
-            'vat_number' => $this->get_vat_number( $context ),
684
-            'discount'   => $this->get_discount_code( $context ),
672
+            'user_id'    => $this->get_user_id($context),
673
+            'email'      => $this->get_email($context),
674
+            'first_name' => $this->get_first_name($context),
675
+            'last_name'  => $this->get_last_name($context),
676
+            'address'    => $this->get_address($context),
677
+            'phone'      => $this->get_phone($context),
678
+            'city'       => $this->get_city($context),
679
+            'country'    => $this->get_country($context),
680
+            'state'      => $this->get_state($context),
681
+            'zip'        => $this->get_zip($context),
682
+            'company'    => $this->get_company($context),
683
+            'vat_number' => $this->get_vat_number($context),
684
+            'discount'   => $this->get_discount_code($context),
685 685
         );
686
-        return apply_filters( 'wpinv_user_info', $user_info, $this->ID, $this );
686
+        return apply_filters('wpinv_user_info', $user_info, $this->ID, $this);
687 687
     }
688 688
 
689 689
     /**
@@ -693,8 +693,8 @@  discard block
 block discarded – undo
693 693
 	 * @param  string $context View or edit context.
694 694
 	 * @return int
695 695
 	 */
696
-	public function get_author( $context = 'view' ) {
697
-		return (int) $this->get_prop( 'author', $context );
696
+	public function get_author($context = 'view') {
697
+		return (int) $this->get_prop('author', $context);
698 698
     }
699 699
 
700 700
     /**
@@ -704,8 +704,8 @@  discard block
 block discarded – undo
704 704
 	 * @param  string $context View or edit context.
705 705
 	 * @return int
706 706
 	 */
707
-	public function get_user_id( $context = 'view' ) {
708
-		return $this->get_author( $context );
707
+	public function get_user_id($context = 'view') {
708
+		return $this->get_author($context);
709 709
     }
710 710
 
711 711
      /**
@@ -715,8 +715,8 @@  discard block
 block discarded – undo
715 715
 	 * @param  string $context View or edit context.
716 716
 	 * @return int
717 717
 	 */
718
-	public function get_customer_id( $context = 'view' ) {
719
-		return $this->get_author( $context );
718
+	public function get_customer_id($context = 'view') {
719
+		return $this->get_author($context);
720 720
     }
721 721
 
722 722
     /**
@@ -726,8 +726,8 @@  discard block
 block discarded – undo
726 726
 	 * @param  string $context View or edit context.
727 727
 	 * @return string
728 728
 	 */
729
-	public function get_ip( $context = 'view' ) {
730
-		return $this->get_prop( 'user_ip', $context );
729
+	public function get_ip($context = 'view') {
730
+		return $this->get_prop('user_ip', $context);
731 731
     }
732 732
 
733 733
     /**
@@ -737,8 +737,8 @@  discard block
 block discarded – undo
737 737
 	 * @param  string $context View or edit context.
738 738
 	 * @return string
739 739
 	 */
740
-	public function get_user_ip( $context = 'view' ) {
741
-		return $this->get_ip( $context );
740
+	public function get_user_ip($context = 'view') {
741
+		return $this->get_ip($context);
742 742
     }
743 743
 
744 744
      /**
@@ -748,8 +748,8 @@  discard block
 block discarded – undo
748 748
 	 * @param  string $context View or edit context.
749 749
 	 * @return string
750 750
 	 */
751
-	public function get_customer_ip( $context = 'view' ) {
752
-		return $this->get_ip( $context );
751
+	public function get_customer_ip($context = 'view') {
752
+		return $this->get_ip($context);
753 753
     }
754 754
 
755 755
     /**
@@ -759,8 +759,8 @@  discard block
 block discarded – undo
759 759
 	 * @param  string $context View or edit context.
760 760
 	 * @return string
761 761
 	 */
762
-	public function get_first_name( $context = 'view' ) {
763
-		return $this->get_prop( 'first_name', $context );
762
+	public function get_first_name($context = 'view') {
763
+		return $this->get_prop('first_name', $context);
764 764
     }
765 765
 
766 766
     /**
@@ -770,8 +770,8 @@  discard block
 block discarded – undo
770 770
 	 * @param  string $context View or edit context.
771 771
 	 * @return int
772 772
 	 */
773
-	public function get_user_first_name( $context = 'view' ) {
774
-		return $this->get_first_name( $context );
773
+	public function get_user_first_name($context = 'view') {
774
+		return $this->get_first_name($context);
775 775
     }
776 776
 
777 777
      /**
@@ -781,8 +781,8 @@  discard block
 block discarded – undo
781 781
 	 * @param  string $context View or edit context.
782 782
 	 * @return int
783 783
 	 */
784
-	public function get_customer_first_name( $context = 'view' ) {
785
-		return $this->get_first_name( $context );
784
+	public function get_customer_first_name($context = 'view') {
785
+		return $this->get_first_name($context);
786 786
     }
787 787
 
788 788
     /**
@@ -792,8 +792,8 @@  discard block
 block discarded – undo
792 792
 	 * @param  string $context View or edit context.
793 793
 	 * @return string
794 794
 	 */
795
-	public function get_last_name( $context = 'view' ) {
796
-		return $this->get_prop( 'last_name', $context );
795
+	public function get_last_name($context = 'view') {
796
+		return $this->get_prop('last_name', $context);
797 797
     }
798 798
 
799 799
     /**
@@ -803,8 +803,8 @@  discard block
 block discarded – undo
803 803
 	 * @param  string $context View or edit context.
804 804
 	 * @return int
805 805
 	 */
806
-	public function get_user_last_name( $context = 'view' ) {
807
-		return $this->get_last_name( $context );
806
+	public function get_user_last_name($context = 'view') {
807
+		return $this->get_last_name($context);
808 808
     }
809 809
 
810 810
     /**
@@ -814,8 +814,8 @@  discard block
 block discarded – undo
814 814
 	 * @param  string $context View or edit context.
815 815
 	 * @return int
816 816
 	 */
817
-	public function get_customer_last_name( $context = 'view' ) {
818
-		return $this->get_last_name( $context );
817
+	public function get_customer_last_name($context = 'view') {
818
+		return $this->get_last_name($context);
819 819
     }
820 820
 
821 821
     /**
@@ -825,8 +825,8 @@  discard block
 block discarded – undo
825 825
 	 * @param  string $context View or edit context.
826 826
 	 * @return string
827 827
 	 */
828
-	public function get_full_name( $context = 'view' ) {
829
-		return trim( $this->get_first_name( $context ) . ' ' . $this->get_last_name( $context ) );
828
+	public function get_full_name($context = 'view') {
829
+		return trim($this->get_first_name($context) . ' ' . $this->get_last_name($context));
830 830
     }
831 831
 
832 832
     /**
@@ -836,8 +836,8 @@  discard block
 block discarded – undo
836 836
 	 * @param  string $context View or edit context.
837 837
 	 * @return int
838 838
 	 */
839
-	public function get_user_full_name( $context = 'view' ) {
840
-		return $this->get_full_name( $context );
839
+	public function get_user_full_name($context = 'view') {
840
+		return $this->get_full_name($context);
841 841
     }
842 842
 
843 843
     /**
@@ -847,8 +847,8 @@  discard block
 block discarded – undo
847 847
 	 * @param  string $context View or edit context.
848 848
 	 * @return int
849 849
 	 */
850
-	public function get_customer_full_name( $context = 'view' ) {
851
-		return $this->get_full_name( $context );
850
+	public function get_customer_full_name($context = 'view') {
851
+		return $this->get_full_name($context);
852 852
     }
853 853
 
854 854
     /**
@@ -858,8 +858,8 @@  discard block
 block discarded – undo
858 858
 	 * @param  string $context View or edit context.
859 859
 	 * @return string
860 860
 	 */
861
-	public function get_phone( $context = 'view' ) {
862
-		return $this->get_prop( 'phone', $context );
861
+	public function get_phone($context = 'view') {
862
+		return $this->get_prop('phone', $context);
863 863
     }
864 864
 
865 865
     /**
@@ -869,8 +869,8 @@  discard block
 block discarded – undo
869 869
 	 * @param  string $context View or edit context.
870 870
 	 * @return int
871 871
 	 */
872
-	public function get_phone_number( $context = 'view' ) {
873
-		return $this->get_phone( $context );
872
+	public function get_phone_number($context = 'view') {
873
+		return $this->get_phone($context);
874 874
     }
875 875
 
876 876
     /**
@@ -880,8 +880,8 @@  discard block
 block discarded – undo
880 880
 	 * @param  string $context View or edit context.
881 881
 	 * @return int
882 882
 	 */
883
-	public function get_user_phone( $context = 'view' ) {
884
-		return $this->get_phone( $context );
883
+	public function get_user_phone($context = 'view') {
884
+		return $this->get_phone($context);
885 885
     }
886 886
 
887 887
     /**
@@ -891,8 +891,8 @@  discard block
 block discarded – undo
891 891
 	 * @param  string $context View or edit context.
892 892
 	 * @return int
893 893
 	 */
894
-	public function get_customer_phone( $context = 'view' ) {
895
-		return $this->get_phone( $context );
894
+	public function get_customer_phone($context = 'view') {
895
+		return $this->get_phone($context);
896 896
     }
897 897
 
898 898
     /**
@@ -902,8 +902,8 @@  discard block
 block discarded – undo
902 902
 	 * @param  string $context View or edit context.
903 903
 	 * @return string
904 904
 	 */
905
-	public function get_email( $context = 'view' ) {
906
-		return $this->get_prop( 'email', $context );
905
+	public function get_email($context = 'view') {
906
+		return $this->get_prop('email', $context);
907 907
     }
908 908
 
909 909
     /**
@@ -913,8 +913,8 @@  discard block
 block discarded – undo
913 913
 	 * @param  string $context View or edit context.
914 914
 	 * @return string
915 915
 	 */
916
-	public function get_email_address( $context = 'view' ) {
917
-		return $this->get_email( $context );
916
+	public function get_email_address($context = 'view') {
917
+		return $this->get_email($context);
918 918
     }
919 919
 
920 920
     /**
@@ -924,8 +924,8 @@  discard block
 block discarded – undo
924 924
 	 * @param  string $context View or edit context.
925 925
 	 * @return int
926 926
 	 */
927
-	public function get_user_email( $context = 'view' ) {
928
-		return $this->get_email( $context );
927
+	public function get_user_email($context = 'view') {
928
+		return $this->get_email($context);
929 929
     }
930 930
 
931 931
     /**
@@ -935,8 +935,8 @@  discard block
 block discarded – undo
935 935
 	 * @param  string $context View or edit context.
936 936
 	 * @return int
937 937
 	 */
938
-	public function get_customer_email( $context = 'view' ) {
939
-		return $this->get_email( $context );
938
+	public function get_customer_email($context = 'view') {
939
+		return $this->get_email($context);
940 940
     }
941 941
 
942 942
     /**
@@ -946,9 +946,9 @@  discard block
 block discarded – undo
946 946
 	 * @param  string $context View or edit context.
947 947
 	 * @return string
948 948
 	 */
949
-	public function get_country( $context = 'view' ) {
950
-		$country = $this->get_prop( 'country', $context );
951
-		return empty( $country ) ? wpinv_get_default_country() : $country;
949
+	public function get_country($context = 'view') {
950
+		$country = $this->get_prop('country', $context);
951
+		return empty($country) ? wpinv_get_default_country() : $country;
952 952
     }
953 953
 
954 954
     /**
@@ -958,8 +958,8 @@  discard block
 block discarded – undo
958 958
 	 * @param  string $context View or edit context.
959 959
 	 * @return int
960 960
 	 */
961
-	public function get_user_country( $context = 'view' ) {
962
-		return $this->get_country( $context );
961
+	public function get_user_country($context = 'view') {
962
+		return $this->get_country($context);
963 963
     }
964 964
 
965 965
     /**
@@ -969,8 +969,8 @@  discard block
 block discarded – undo
969 969
 	 * @param  string $context View or edit context.
970 970
 	 * @return int
971 971
 	 */
972
-	public function get_customer_country( $context = 'view' ) {
973
-		return $this->get_country( $context );
972
+	public function get_customer_country($context = 'view') {
973
+		return $this->get_country($context);
974 974
     }
975 975
 
976 976
     /**
@@ -980,9 +980,9 @@  discard block
 block discarded – undo
980 980
 	 * @param  string $context View or edit context.
981 981
 	 * @return string
982 982
 	 */
983
-	public function get_state( $context = 'view' ) {
984
-		$state = $this->get_prop( 'state', $context );
985
-		return empty( $state ) ? wpinv_get_default_state() : $state;
983
+	public function get_state($context = 'view') {
984
+		$state = $this->get_prop('state', $context);
985
+		return empty($state) ? wpinv_get_default_state() : $state;
986 986
     }
987 987
 
988 988
     /**
@@ -992,8 +992,8 @@  discard block
 block discarded – undo
992 992
 	 * @param  string $context View or edit context.
993 993
 	 * @return int
994 994
 	 */
995
-	public function get_user_state( $context = 'view' ) {
996
-		return $this->get_state( $context );
995
+	public function get_user_state($context = 'view') {
996
+		return $this->get_state($context);
997 997
     }
998 998
 
999 999
     /**
@@ -1003,8 +1003,8 @@  discard block
 block discarded – undo
1003 1003
 	 * @param  string $context View or edit context.
1004 1004
 	 * @return int
1005 1005
 	 */
1006
-	public function get_customer_state( $context = 'view' ) {
1007
-		return $this->get_state( $context );
1006
+	public function get_customer_state($context = 'view') {
1007
+		return $this->get_state($context);
1008 1008
     }
1009 1009
 
1010 1010
     /**
@@ -1014,8 +1014,8 @@  discard block
 block discarded – undo
1014 1014
 	 * @param  string $context View or edit context.
1015 1015
 	 * @return string
1016 1016
 	 */
1017
-	public function get_city( $context = 'view' ) {
1018
-		return $this->get_prop( 'city', $context );
1017
+	public function get_city($context = 'view') {
1018
+		return $this->get_prop('city', $context);
1019 1019
     }
1020 1020
 
1021 1021
     /**
@@ -1025,8 +1025,8 @@  discard block
 block discarded – undo
1025 1025
 	 * @param  string $context View or edit context.
1026 1026
 	 * @return string
1027 1027
 	 */
1028
-	public function get_user_city( $context = 'view' ) {
1029
-		return $this->get_city( $context );
1028
+	public function get_user_city($context = 'view') {
1029
+		return $this->get_city($context);
1030 1030
     }
1031 1031
 
1032 1032
     /**
@@ -1036,8 +1036,8 @@  discard block
 block discarded – undo
1036 1036
 	 * @param  string $context View or edit context.
1037 1037
 	 * @return string
1038 1038
 	 */
1039
-	public function get_customer_city( $context = 'view' ) {
1040
-		return $this->get_city( $context );
1039
+	public function get_customer_city($context = 'view') {
1040
+		return $this->get_city($context);
1041 1041
     }
1042 1042
 
1043 1043
     /**
@@ -1047,8 +1047,8 @@  discard block
 block discarded – undo
1047 1047
 	 * @param  string $context View or edit context.
1048 1048
 	 * @return string
1049 1049
 	 */
1050
-	public function get_zip( $context = 'view' ) {
1051
-		return $this->get_prop( 'zip', $context );
1050
+	public function get_zip($context = 'view') {
1051
+		return $this->get_prop('zip', $context);
1052 1052
     }
1053 1053
 
1054 1054
     /**
@@ -1058,8 +1058,8 @@  discard block
 block discarded – undo
1058 1058
 	 * @param  string $context View or edit context.
1059 1059
 	 * @return string
1060 1060
 	 */
1061
-	public function get_user_zip( $context = 'view' ) {
1062
-		return $this->get_zip( $context );
1061
+	public function get_user_zip($context = 'view') {
1062
+		return $this->get_zip($context);
1063 1063
     }
1064 1064
 
1065 1065
     /**
@@ -1069,8 +1069,8 @@  discard block
 block discarded – undo
1069 1069
 	 * @param  string $context View or edit context.
1070 1070
 	 * @return string
1071 1071
 	 */
1072
-	public function get_customer_zip( $context = 'view' ) {
1073
-		return $this->get_zip( $context );
1072
+	public function get_customer_zip($context = 'view') {
1073
+		return $this->get_zip($context);
1074 1074
     }
1075 1075
 
1076 1076
     /**
@@ -1080,8 +1080,8 @@  discard block
 block discarded – undo
1080 1080
 	 * @param  string $context View or edit context.
1081 1081
 	 * @return string
1082 1082
 	 */
1083
-	public function get_company( $context = 'view' ) {
1084
-		return $this->get_prop( 'company', $context );
1083
+	public function get_company($context = 'view') {
1084
+		return $this->get_prop('company', $context);
1085 1085
     }
1086 1086
 
1087 1087
     /**
@@ -1091,8 +1091,8 @@  discard block
 block discarded – undo
1091 1091
 	 * @param  string $context View or edit context.
1092 1092
 	 * @return string
1093 1093
 	 */
1094
-	public function get_user_company( $context = 'view' ) {
1095
-		return $this->get_company( $context );
1094
+	public function get_user_company($context = 'view') {
1095
+		return $this->get_company($context);
1096 1096
     }
1097 1097
 
1098 1098
     /**
@@ -1102,8 +1102,8 @@  discard block
 block discarded – undo
1102 1102
 	 * @param  string $context View or edit context.
1103 1103
 	 * @return string
1104 1104
 	 */
1105
-	public function get_customer_company( $context = 'view' ) {
1106
-		return $this->get_company( $context );
1105
+	public function get_customer_company($context = 'view') {
1106
+		return $this->get_company($context);
1107 1107
     }
1108 1108
 
1109 1109
     /**
@@ -1113,8 +1113,8 @@  discard block
 block discarded – undo
1113 1113
 	 * @param  string $context View or edit context.
1114 1114
 	 * @return string
1115 1115
 	 */
1116
-	public function get_vat_number( $context = 'view' ) {
1117
-		return $this->get_prop( 'vat_number', $context );
1116
+	public function get_vat_number($context = 'view') {
1117
+		return $this->get_prop('vat_number', $context);
1118 1118
     }
1119 1119
 
1120 1120
     /**
@@ -1124,8 +1124,8 @@  discard block
 block discarded – undo
1124 1124
 	 * @param  string $context View or edit context.
1125 1125
 	 * @return string
1126 1126
 	 */
1127
-	public function get_user_vat_number( $context = 'view' ) {
1128
-		return $this->get_vat_number( $context );
1127
+	public function get_user_vat_number($context = 'view') {
1128
+		return $this->get_vat_number($context);
1129 1129
     }
1130 1130
 
1131 1131
     /**
@@ -1135,8 +1135,8 @@  discard block
 block discarded – undo
1135 1135
 	 * @param  string $context View or edit context.
1136 1136
 	 * @return string
1137 1137
 	 */
1138
-	public function get_customer_vat_number( $context = 'view' ) {
1139
-		return $this->get_vat_number( $context );
1138
+	public function get_customer_vat_number($context = 'view') {
1139
+		return $this->get_vat_number($context);
1140 1140
     }
1141 1141
 
1142 1142
     /**
@@ -1146,8 +1146,8 @@  discard block
 block discarded – undo
1146 1146
 	 * @param  string $context View or edit context.
1147 1147
 	 * @return string
1148 1148
 	 */
1149
-	public function get_vat_rate( $context = 'view' ) {
1150
-		return $this->get_prop( 'vat_rate', $context );
1149
+	public function get_vat_rate($context = 'view') {
1150
+		return $this->get_prop('vat_rate', $context);
1151 1151
     }
1152 1152
 
1153 1153
     /**
@@ -1157,8 +1157,8 @@  discard block
 block discarded – undo
1157 1157
 	 * @param  string $context View or edit context.
1158 1158
 	 * @return string
1159 1159
 	 */
1160
-	public function get_user_vat_rate( $context = 'view' ) {
1161
-		return $this->get_vat_rate( $context );
1160
+	public function get_user_vat_rate($context = 'view') {
1161
+		return $this->get_vat_rate($context);
1162 1162
     }
1163 1163
 
1164 1164
     /**
@@ -1168,8 +1168,8 @@  discard block
 block discarded – undo
1168 1168
 	 * @param  string $context View or edit context.
1169 1169
 	 * @return string
1170 1170
 	 */
1171
-	public function get_customer_vat_rate( $context = 'view' ) {
1172
-		return $this->get_vat_rate( $context );
1171
+	public function get_customer_vat_rate($context = 'view') {
1172
+		return $this->get_vat_rate($context);
1173 1173
     }
1174 1174
 
1175 1175
     /**
@@ -1179,8 +1179,8 @@  discard block
 block discarded – undo
1179 1179
 	 * @param  string $context View or edit context.
1180 1180
 	 * @return string
1181 1181
 	 */
1182
-	public function get_address( $context = 'view' ) {
1183
-		return $this->get_prop( 'address', $context );
1182
+	public function get_address($context = 'view') {
1183
+		return $this->get_prop('address', $context);
1184 1184
     }
1185 1185
 
1186 1186
     /**
@@ -1190,8 +1190,8 @@  discard block
 block discarded – undo
1190 1190
 	 * @param  string $context View or edit context.
1191 1191
 	 * @return string
1192 1192
 	 */
1193
-	public function get_user_address( $context = 'view' ) {
1194
-		return $this->get_address( $context );
1193
+	public function get_user_address($context = 'view') {
1194
+		return $this->get_address($context);
1195 1195
     }
1196 1196
 
1197 1197
     /**
@@ -1201,8 +1201,8 @@  discard block
 block discarded – undo
1201 1201
 	 * @param  string $context View or edit context.
1202 1202
 	 * @return string
1203 1203
 	 */
1204
-	public function get_customer_address( $context = 'view' ) {
1205
-		return $this->get_address( $context );
1204
+	public function get_customer_address($context = 'view') {
1205
+		return $this->get_address($context);
1206 1206
     }
1207 1207
 
1208 1208
     /**
@@ -1212,8 +1212,8 @@  discard block
 block discarded – undo
1212 1212
 	 * @param  string $context View or edit context.
1213 1213
 	 * @return bool
1214 1214
 	 */
1215
-	public function get_is_viewed( $context = 'view' ) {
1216
-		return (bool) $this->get_prop( 'is_viewed', $context );
1215
+	public function get_is_viewed($context = 'view') {
1216
+		return (bool) $this->get_prop('is_viewed', $context);
1217 1217
 	}
1218 1218
 
1219 1219
 	/**
@@ -1223,8 +1223,8 @@  discard block
 block discarded – undo
1223 1223
 	 * @param  string $context View or edit context.
1224 1224
 	 * @return bool
1225 1225
 	 */
1226
-	public function get_email_cc( $context = 'view' ) {
1227
-		return $this->get_prop( 'email_cc', $context );
1226
+	public function get_email_cc($context = 'view') {
1227
+		return $this->get_prop('email_cc', $context);
1228 1228
 	}
1229 1229
 
1230 1230
 	/**
@@ -1234,8 +1234,8 @@  discard block
 block discarded – undo
1234 1234
 	 * @param  string $context View or edit context.
1235 1235
 	 * @return bool
1236 1236
 	 */
1237
-	public function get_template( $context = 'view' ) {
1238
-		return $this->get_prop( 'template', $context );
1237
+	public function get_template($context = 'view') {
1238
+		return $this->get_prop('template', $context);
1239 1239
 	}
1240 1240
 
1241 1241
 	/**
@@ -1245,8 +1245,8 @@  discard block
 block discarded – undo
1245 1245
 	 * @param  string $context View or edit context.
1246 1246
 	 * @return bool
1247 1247
 	 */
1248
-	public function get_address_confirmed( $context = 'view' ) {
1249
-		return (bool) $this->get_prop( 'address_confirmed', $context );
1248
+	public function get_address_confirmed($context = 'view') {
1249
+		return (bool) $this->get_prop('address_confirmed', $context);
1250 1250
     }
1251 1251
 
1252 1252
     /**
@@ -1256,8 +1256,8 @@  discard block
 block discarded – undo
1256 1256
 	 * @param  string $context View or edit context.
1257 1257
 	 * @return bool
1258 1258
 	 */
1259
-	public function get_user_address_confirmed( $context = 'view' ) {
1260
-		return $this->get_address_confirmed( $context );
1259
+	public function get_user_address_confirmed($context = 'view') {
1260
+		return $this->get_address_confirmed($context);
1261 1261
     }
1262 1262
 
1263 1263
     /**
@@ -1267,8 +1267,8 @@  discard block
 block discarded – undo
1267 1267
 	 * @param  string $context View or edit context.
1268 1268
 	 * @return bool
1269 1269
 	 */
1270
-	public function get_customer_address_confirmed( $context = 'view' ) {
1271
-		return $this->get_address_confirmed( $context );
1270
+	public function get_customer_address_confirmed($context = 'view') {
1271
+		return $this->get_address_confirmed($context);
1272 1272
     }
1273 1273
 
1274 1274
     /**
@@ -1278,12 +1278,12 @@  discard block
 block discarded – undo
1278 1278
 	 * @param  string $context View or edit context.
1279 1279
 	 * @return float
1280 1280
 	 */
1281
-	public function get_subtotal( $context = 'view' ) {
1282
-        $subtotal = (float) $this->get_prop( 'subtotal', $context );
1281
+	public function get_subtotal($context = 'view') {
1282
+        $subtotal = (float) $this->get_prop('subtotal', $context);
1283 1283
 
1284 1284
         // Backwards compatibility.
1285
-        if ( is_bool( $context ) && $context ) {
1286
-            return wpinv_price( wpinv_format_amount( $subtotal ), $this->get_currency() );
1285
+        if (is_bool($context) && $context) {
1286
+            return wpinv_price(wpinv_format_amount($subtotal), $this->get_currency());
1287 1287
         }
1288 1288
 
1289 1289
         return $subtotal;
@@ -1296,8 +1296,8 @@  discard block
 block discarded – undo
1296 1296
 	 * @param  string $context View or edit context.
1297 1297
 	 * @return float
1298 1298
 	 */
1299
-	public function get_total_discount( $context = 'view' ) {
1300
-		return (float) $this->get_prop( 'total_discount', $context );
1299
+	public function get_total_discount($context = 'view') {
1300
+		return (float) $this->get_prop('total_discount', $context);
1301 1301
     }
1302 1302
 
1303 1303
     /**
@@ -1307,18 +1307,18 @@  discard block
 block discarded – undo
1307 1307
 	 * @param  string $context View or edit context.
1308 1308
 	 * @return float
1309 1309
 	 */
1310
-	public function get_total_tax( $context = 'view' ) {
1311
-		return (float) $this->get_prop( 'total_tax', $context );
1310
+	public function get_total_tax($context = 'view') {
1311
+		return (float) $this->get_prop('total_tax', $context);
1312 1312
 	}
1313 1313
 
1314 1314
 	/**
1315 1315
 	 * @deprecated
1316 1316
 	 */
1317
-	public function get_final_tax( $currency = false ) {
1317
+	public function get_final_tax($currency = false) {
1318 1318
 		$tax = $this->get_total_tax();
1319 1319
 
1320
-        if ( $currency ) {
1321
-			return wpinv_price( wpinv_format_amount( $tax, NULL, false ), $this->get_currency() );
1320
+        if ($currency) {
1321
+			return wpinv_price(wpinv_format_amount($tax, NULL, false), $this->get_currency());
1322 1322
         }
1323 1323
 
1324 1324
         return $tax;
@@ -1331,8 +1331,8 @@  discard block
 block discarded – undo
1331 1331
 	 * @param  string $context View or edit context.
1332 1332
 	 * @return float
1333 1333
 	 */
1334
-	public function get_total_fees( $context = 'view' ) {
1335
-		return (float) $this->get_prop( 'total_fees', $context );
1334
+	public function get_total_fees($context = 'view') {
1335
+		return (float) $this->get_prop('total_fees', $context);
1336 1336
     }
1337 1337
 
1338 1338
     /**
@@ -1342,8 +1342,8 @@  discard block
 block discarded – undo
1342 1342
 	 * @param  string $context View or edit context.
1343 1343
 	 * @return float
1344 1344
 	 */
1345
-	public function get_fees_total( $context = 'view' ) {
1346
-		return $this->get_total_fees( $context );
1345
+	public function get_fees_total($context = 'view') {
1346
+		return $this->get_total_fees($context);
1347 1347
     }
1348 1348
 
1349 1349
     /**
@@ -1354,7 +1354,7 @@  discard block
 block discarded – undo
1354 1354
 	 */
1355 1355
 	public function get_total() {
1356 1356
 		$total = $this->is_renewal() ? $this->get_recurring_total() : $this->get_initial_total();
1357
-		return apply_filters( 'getpaid_get_invoice_total_amount', $total, $this  );
1357
+		return apply_filters('getpaid_get_invoice_total_amount', $total, $this);
1358 1358
     }
1359 1359
 
1360 1360
     /**
@@ -1366,7 +1366,7 @@  discard block
 block discarded – undo
1366 1366
 	 */
1367 1367
     public function get_initial_total() {
1368 1368
 
1369
-		if ( empty( $this->totals ) ) {
1369
+		if (empty($this->totals)) {
1370 1370
 			$this->recalculate_total();
1371 1371
 		}
1372 1372
 
@@ -1376,11 +1376,11 @@  discard block
 block discarded – undo
1376 1376
 		$subtotal = $this->totals['subtotal']['initial'];
1377 1377
 		$total    = $tax + $fee - $discount + $subtotal;
1378 1378
 
1379
-		if ( 0 > $total ) {
1379
+		if (0 > $total) {
1380 1380
 			$total = 0;
1381 1381
 		}
1382 1382
 
1383
-        return apply_filters( 'wpinv_get_initial_invoice_total', $total, $this );
1383
+        return apply_filters('wpinv_get_initial_invoice_total', $total, $this);
1384 1384
 	}
1385 1385
 
1386 1386
 	/**
@@ -1392,7 +1392,7 @@  discard block
 block discarded – undo
1392 1392
 	 */
1393 1393
     public function get_recurring_total() {
1394 1394
 
1395
-		if ( empty( $this->totals ) ) {
1395
+		if (empty($this->totals)) {
1396 1396
 			$this->recalculate_total();
1397 1397
 		}
1398 1398
 
@@ -1402,11 +1402,11 @@  discard block
 block discarded – undo
1402 1402
 		$subtotal = $this->totals['subtotal']['recurring'];
1403 1403
 		$total    = $tax + $fee - $discount + $subtotal;
1404 1404
 
1405
-		if ( 0 > $total ) {
1405
+		if (0 > $total) {
1406 1406
 			$total = 0;
1407 1407
 		}
1408 1408
 
1409
-        return apply_filters( 'wpinv_get_recurring_invoice_total', $total, $this );
1409
+        return apply_filters('wpinv_get_recurring_invoice_total', $total, $this);
1410 1410
 	}
1411 1411
 
1412 1412
 	/**
@@ -1417,10 +1417,10 @@  discard block
 block discarded – undo
1417 1417
 	 * @param string $currency Whether to include the currency.
1418 1418
      * @return float
1419 1419
 	 */
1420
-    public function get_recurring_details( $field = '', $currency = false ) {
1420
+    public function get_recurring_details($field = '', $currency = false) {
1421 1421
 
1422 1422
 		// Maybe recalculate totals.
1423
-		if ( empty( $this->totals ) ) {
1423
+		if (empty($this->totals)) {
1424 1424
 			$this->recalculate_total();
1425 1425
 		}
1426 1426
 
@@ -1440,8 +1440,8 @@  discard block
 block discarded – undo
1440 1440
 			$currency
1441 1441
 		);
1442 1442
 
1443
-        if ( isset( $data[$field] ) ) {
1444
-            return ( $currency ? wpinv_price( $data[$field], $this->get_currency() ) : $data[$field] );
1443
+        if (isset($data[$field])) {
1444
+            return ($currency ? wpinv_price($data[$field], $this->get_currency()) : $data[$field]);
1445 1445
         }
1446 1446
 
1447 1447
         return $data;
@@ -1454,8 +1454,8 @@  discard block
 block discarded – undo
1454 1454
 	 * @param  string $context View or edit context.
1455 1455
 	 * @return array
1456 1456
 	 */
1457
-	public function get_fees( $context = 'view' ) {
1458
-		return wpinv_parse_list( $this->get_prop( 'fees', $context ) );
1457
+	public function get_fees($context = 'view') {
1458
+		return wpinv_parse_list($this->get_prop('fees', $context));
1459 1459
     }
1460 1460
 
1461 1461
     /**
@@ -1465,8 +1465,8 @@  discard block
 block discarded – undo
1465 1465
 	 * @param  string $context View or edit context.
1466 1466
 	 * @return array
1467 1467
 	 */
1468
-	public function get_discounts( $context = 'view' ) {
1469
-		return wpinv_parse_list( $this->get_prop( 'discounts', $context ) );
1468
+	public function get_discounts($context = 'view') {
1469
+		return wpinv_parse_list($this->get_prop('discounts', $context));
1470 1470
     }
1471 1471
 
1472 1472
     /**
@@ -1476,8 +1476,8 @@  discard block
 block discarded – undo
1476 1476
 	 * @param  string $context View or edit context.
1477 1477
 	 * @return array
1478 1478
 	 */
1479
-	public function get_taxes( $context = 'view' ) {
1480
-		return wpinv_parse_list( $this->get_prop( 'taxes', $context ) );
1479
+	public function get_taxes($context = 'view') {
1480
+		return wpinv_parse_list($this->get_prop('taxes', $context));
1481 1481
     }
1482 1482
 
1483 1483
     /**
@@ -1487,8 +1487,8 @@  discard block
 block discarded – undo
1487 1487
 	 * @param  string $context View or edit context.
1488 1488
 	 * @return GetPaid_Form_Item[]
1489 1489
 	 */
1490
-	public function get_items( $context = 'view' ) {
1491
-        return $this->get_prop( 'items', $context );
1490
+	public function get_items($context = 'view') {
1491
+        return $this->get_prop('items', $context);
1492 1492
     }
1493 1493
 
1494 1494
     /**
@@ -1498,8 +1498,8 @@  discard block
 block discarded – undo
1498 1498
 	 * @param  string $context View or edit context.
1499 1499
 	 * @return int
1500 1500
 	 */
1501
-	public function get_payment_form( $context = 'view' ) {
1502
-		return intval( $this->get_prop( 'payment_form', $context ) );
1501
+	public function get_payment_form($context = 'view') {
1502
+		return intval($this->get_prop('payment_form', $context));
1503 1503
     }
1504 1504
 
1505 1505
     /**
@@ -1509,8 +1509,8 @@  discard block
 block discarded – undo
1509 1509
 	 * @param  string $context View or edit context.
1510 1510
 	 * @return string
1511 1511
 	 */
1512
-	public function get_submission_id( $context = 'view' ) {
1513
-		return $this->get_prop( 'submission_id', $context );
1512
+	public function get_submission_id($context = 'view') {
1513
+		return $this->get_prop('submission_id', $context);
1514 1514
     }
1515 1515
 
1516 1516
     /**
@@ -1520,8 +1520,8 @@  discard block
 block discarded – undo
1520 1520
 	 * @param  string $context View or edit context.
1521 1521
 	 * @return string
1522 1522
 	 */
1523
-	public function get_discount_code( $context = 'view' ) {
1524
-		return $this->get_prop( 'discount_code', $context );
1523
+	public function get_discount_code($context = 'view') {
1524
+		return $this->get_prop('discount_code', $context);
1525 1525
     }
1526 1526
 
1527 1527
     /**
@@ -1531,8 +1531,8 @@  discard block
 block discarded – undo
1531 1531
 	 * @param  string $context View or edit context.
1532 1532
 	 * @return string
1533 1533
 	 */
1534
-	public function get_gateway( $context = 'view' ) {
1535
-		return $this->get_prop( 'gateway', $context );
1534
+	public function get_gateway($context = 'view') {
1535
+		return $this->get_prop('gateway', $context);
1536 1536
     }
1537 1537
 
1538 1538
     /**
@@ -1542,8 +1542,8 @@  discard block
 block discarded – undo
1542 1542
 	 * @return string
1543 1543
 	 */
1544 1544
     public function get_gateway_title() {
1545
-        $title =  wpinv_get_gateway_checkout_label( $this->get_gateway() );
1546
-        return apply_filters( 'wpinv_gateway_title', $title, $this->ID, $this );
1545
+        $title = wpinv_get_gateway_checkout_label($this->get_gateway());
1546
+        return apply_filters('wpinv_gateway_title', $title, $this->ID, $this);
1547 1547
     }
1548 1548
 
1549 1549
     /**
@@ -1553,8 +1553,8 @@  discard block
 block discarded – undo
1553 1553
 	 * @param  string $context View or edit context.
1554 1554
 	 * @return string
1555 1555
 	 */
1556
-	public function get_transaction_id( $context = 'view' ) {
1557
-		return $this->get_prop( 'transaction_id', $context );
1556
+	public function get_transaction_id($context = 'view') {
1557
+		return $this->get_prop('transaction_id', $context);
1558 1558
     }
1559 1559
 
1560 1560
     /**
@@ -1564,9 +1564,9 @@  discard block
 block discarded – undo
1564 1564
 	 * @param  string $context View or edit context.
1565 1565
 	 * @return string
1566 1566
 	 */
1567
-	public function get_currency( $context = 'view' ) {
1568
-        $currency = $this->get_prop( 'currency', $context );
1569
-        return empty( $currency ) ? wpinv_get_currency() : $currency;
1567
+	public function get_currency($context = 'view') {
1568
+        $currency = $this->get_prop('currency', $context);
1569
+        return empty($currency) ? wpinv_get_currency() : $currency;
1570 1570
     }
1571 1571
 
1572 1572
     /**
@@ -1576,8 +1576,8 @@  discard block
 block discarded – undo
1576 1576
 	 * @param  string $context View or edit context.
1577 1577
 	 * @return bool
1578 1578
 	 */
1579
-	public function get_disable_taxes( $context = 'view' ) {
1580
-        return (bool) $this->get_prop( 'disable_taxes', $context );
1579
+	public function get_disable_taxes($context = 'view') {
1580
+        return (bool) $this->get_prop('disable_taxes', $context);
1581 1581
     }
1582 1582
 
1583 1583
     /**
@@ -1587,12 +1587,12 @@  discard block
 block discarded – undo
1587 1587
 	 * @param  string $context View or edit context.
1588 1588
 	 * @return int
1589 1589
 	 */
1590
-    public function get_subscription_id( $context = 'view' ) {
1591
-        $subscription_id = $this->get_prop( 'subscription_id', $context );
1590
+    public function get_subscription_id($context = 'view') {
1591
+        $subscription_id = $this->get_prop('subscription_id', $context);
1592 1592
 
1593
-        if ( empty( $subscription_id ) && $this->is_renewal() ) {
1593
+        if (empty($subscription_id) && $this->is_renewal()) {
1594 1594
             $parent = $this->get_parent();
1595
-            return $parent->get_subscription_id( $context );
1595
+            return $parent->get_subscription_id($context);
1596 1596
         }
1597 1597
 
1598 1598
         return $subscription_id;
@@ -1605,20 +1605,20 @@  discard block
 block discarded – undo
1605 1605
 	 * @param  string $context View or edit context.
1606 1606
 	 * @return array
1607 1607
 	 */
1608
-    public function get_payment_meta( $context = 'view' ) {
1608
+    public function get_payment_meta($context = 'view') {
1609 1609
 
1610 1610
         return array(
1611
-            'price'        => $this->get_total( $context ),
1612
-            'date'         => $this->get_date_created( $context ),
1613
-            'user_email'   => $this->get_email( $context ),
1614
-            'invoice_key'  => $this->get_key( $context ),
1615
-            'currency'     => $this->get_currency( $context ),
1616
-            'items'        => $this->get_items( $context ),
1617
-            'user_info'    => $this->get_user_info( $context ),
1611
+            'price'        => $this->get_total($context),
1612
+            'date'         => $this->get_date_created($context),
1613
+            'user_email'   => $this->get_email($context),
1614
+            'invoice_key'  => $this->get_key($context),
1615
+            'currency'     => $this->get_currency($context),
1616
+            'items'        => $this->get_items($context),
1617
+            'user_info'    => $this->get_user_info($context),
1618 1618
             'cart_details' => $this->get_cart_details(),
1619
-            'status'       => $this->get_status( $context ),
1620
-            'fees'         => $this->get_fees( $context ),
1621
-            'taxes'        => $this->get_taxes( $context ),
1619
+            'status'       => $this->get_status($context),
1620
+            'fees'         => $this->get_fees($context),
1621
+            'taxes'        => $this->get_taxes($context),
1622 1622
         );
1623 1623
 
1624 1624
     }
@@ -1633,7 +1633,7 @@  discard block
 block discarded – undo
1633 1633
         $items        = $this->get_items();
1634 1634
         $cart_details = array();
1635 1635
 
1636
-        foreach ( $items as $item_id => $item ) {
1636
+        foreach ($items as $item_id => $item) {
1637 1637
             $cart_details[] = $item->prepare_data_for_saving();
1638 1638
         }
1639 1639
 
@@ -1645,11 +1645,11 @@  discard block
 block discarded – undo
1645 1645
 	 *
1646 1646
 	 * @return null|GetPaid_Form_Item
1647 1647
 	 */
1648
-	public function get_recurring( $object = false ) {
1648
+	public function get_recurring($object = false) {
1649 1649
 
1650 1650
 		// Are we returning an object?
1651
-        if ( $object ) {
1652
-            return $this->get_item( $this->recurring_item );
1651
+        if ($object) {
1652
+            return $this->get_item($this->recurring_item);
1653 1653
         }
1654 1654
 
1655 1655
         return $this->recurring_item;
@@ -1664,15 +1664,15 @@  discard block
 block discarded – undo
1664 1664
 	public function get_subscription_name() {
1665 1665
 
1666 1666
 		// Retrieve the recurring name
1667
-        $item = $this->get_recurring( true );
1667
+        $item = $this->get_recurring(true);
1668 1668
 
1669 1669
 		// Abort if it does not exist.
1670
-        if ( empty( $item ) ) {
1670
+        if (empty($item)) {
1671 1671
             return '';
1672 1672
         }
1673 1673
 
1674 1674
 		// Return the item name.
1675
-        return apply_filters( 'wpinv_invoice_get_subscription_name', $item->get_name(), $this );
1675
+        return apply_filters('wpinv_invoice_get_subscription_name', $item->get_name(), $this);
1676 1676
 	}
1677 1677
 
1678 1678
 	/**
@@ -1682,9 +1682,9 @@  discard block
 block discarded – undo
1682 1682
 	 * @return string
1683 1683
 	 */
1684 1684
 	public function get_view_url() {
1685
-        $invoice_url = get_permalink( $this->get_id() );
1686
-		$invoice_url = add_query_arg( 'invoice_key', $this->get_key(), $invoice_url );
1687
-        return apply_filters( 'wpinv_get_view_url', $invoice_url, $this );
1685
+        $invoice_url = get_permalink($this->get_id());
1686
+		$invoice_url = add_query_arg('invoice_key', $this->get_key(), $invoice_url);
1687
+        return apply_filters('wpinv_get_view_url', $invoice_url, $this);
1688 1688
 	}
1689 1689
 
1690 1690
 	/**
@@ -1693,25 +1693,25 @@  discard block
 block discarded – undo
1693 1693
 	 * @since 1.0.19
1694 1694
 	 * @return string
1695 1695
 	 */
1696
-	public function get_checkout_payment_url( $deprecated = false, $secret = false ) {
1696
+	public function get_checkout_payment_url($deprecated = false, $secret = false) {
1697 1697
 
1698 1698
 		// Retrieve the checkout url.
1699 1699
         $pay_url = wpinv_get_checkout_uri();
1700 1700
 
1701 1701
 		// Maybe force ssl.
1702
-        if ( is_ssl() ) {
1703
-            $pay_url = str_replace( 'http:', 'https:', $pay_url );
1702
+        if (is_ssl()) {
1703
+            $pay_url = str_replace('http:', 'https:', $pay_url);
1704 1704
         }
1705 1705
 
1706 1706
 		// Add the invoice key.
1707
-		$pay_url = add_query_arg( 'invoice_key', $this->get_key(), $pay_url );
1707
+		$pay_url = add_query_arg('invoice_key', $this->get_key(), $pay_url);
1708 1708
 
1709 1709
 		// (Maybe?) add a secret
1710
-        if ( $secret ) {
1711
-            $pay_url = add_query_arg( array( '_wpipay' => md5( $this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key() ) ), $pay_url );
1710
+        if ($secret) {
1711
+            $pay_url = add_query_arg(array('_wpipay' => md5($this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key())), $pay_url);
1712 1712
         }
1713 1713
 
1714
-        return apply_filters( 'wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret );
1714
+        return apply_filters('wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret);
1715 1715
     }
1716 1716
 
1717 1717
     /**
@@ -1724,8 +1724,8 @@  discard block
 block discarded – undo
1724 1724
 	 * @param  string $context View or edit context.
1725 1725
 	 * @return mixed Value of the given invoice property (if set).
1726 1726
 	 */
1727
-	public function get( $key, $context = 'view' ) {
1728
-        return $this->get_prop( $key, $context );
1727
+	public function get($key, $context = 'view') {
1728
+        return $this->get_prop($key, $context);
1729 1729
 	}
1730 1730
 
1731 1731
     /*
@@ -1748,11 +1748,11 @@  discard block
 block discarded – undo
1748 1748
 	 * @param  mixed $value new value.
1749 1749
 	 * @return mixed Value of the given invoice property (if set).
1750 1750
 	 */
1751
-	public function set( $key, $value ) {
1751
+	public function set($key, $value) {
1752 1752
 
1753 1753
         $setter = "set_$key";
1754
-        if ( is_callable( array( $this, $setter ) ) ) {
1755
-            $this->{$setter}( $value );
1754
+        if (is_callable(array($this, $setter))) {
1755
+            $this->{$setter}($value);
1756 1756
         }
1757 1757
 
1758 1758
 	}
@@ -1766,35 +1766,35 @@  discard block
 block discarded – undo
1766 1766
 	 * @param bool   $manual_update Is this a manual status change?.
1767 1767
 	 * @return array details of change.
1768 1768
 	 */
1769
-	public function set_status( $new_status, $note = '', $manual_update = false ) {
1769
+	public function set_status($new_status, $note = '', $manual_update = false) {
1770 1770
 		$old_status = $this->get_status();
1771 1771
 
1772
-		$this->set_prop( 'status', $new_status );
1772
+		$this->set_prop('status', $new_status);
1773 1773
 
1774 1774
 		// If setting the status, ensure it's set to a valid status.
1775
-		if ( true === $this->object_read ) {
1775
+		if (true === $this->object_read) {
1776 1776
 
1777 1777
 			// Only allow valid new status.
1778
-			if ( ! array_key_exists( $new_status, wpinv_get_invoice_statuses( false, true ) ) ) {
1778
+			if (!array_key_exists($new_status, wpinv_get_invoice_statuses(false, true))) {
1779 1779
 				$new_status = 'wpi-pending';
1780 1780
 			}
1781 1781
 
1782 1782
 			// If the old status is set but unknown (e.g. draft) assume its pending for action usage.
1783
-			if ( $old_status && ! array_key_exists( $new_status, wpinv_get_invoice_statuses( false, true ) ) ) {
1783
+			if ($old_status && !array_key_exists($new_status, wpinv_get_invoice_statuses(false, true))) {
1784 1784
 				$old_status = 'wpi-pending';
1785 1785
 			}
1786 1786
 		}
1787 1787
 
1788
-		if ( true === $this->object_read && $old_status !== $new_status ) {
1788
+		if (true === $this->object_read && $old_status !== $new_status) {
1789 1789
 			$this->status_transition = array(
1790
-				'from'   => ! empty( $this->status_transition['from'] ) ? $this->status_transition['from'] : $old_status,
1790
+				'from'   => !empty($this->status_transition['from']) ? $this->status_transition['from'] : $old_status,
1791 1791
 				'to'     => $new_status,
1792 1792
 				'note'   => $note,
1793 1793
 				'manual' => (bool) $manual_update,
1794 1794
 			);
1795 1795
 
1796
-			if ( $manual_update ) {
1797
-				do_action( 'getpaid_' . $this->object_type .'_edit_status', $this->get_id(), $new_status );
1796
+			if ($manual_update) {
1797
+				do_action('getpaid_' . $this->object_type . '_edit_status', $this->get_id(), $new_status);
1798 1798
 			}
1799 1799
 
1800 1800
 			$this->maybe_set_date_paid();
@@ -1817,8 +1817,8 @@  discard block
 block discarded – undo
1817 1817
 	 */
1818 1818
 	public function maybe_set_date_paid() {
1819 1819
 
1820
-		if ( ! $this->get_date_completed( 'edit' ) && $this->is_paid() ) {
1821
-			$this->set_date_completed( current_time( 'mysql' ) );
1820
+		if (!$this->get_date_completed('edit') && $this->is_paid()) {
1821
+			$this->set_date_completed(current_time('mysql'));
1822 1822
 		}
1823 1823
 	}
1824 1824
 
@@ -1827,11 +1827,11 @@  discard block
 block discarded – undo
1827 1827
 	 *
1828 1828
 	 * @since 1.0.19
1829 1829
 	 */
1830
-	public function set_parent_id( $value ) {
1831
-		if ( $value && ( $value === $this->get_id() || ! get_post( $value ) ) ) {
1830
+	public function set_parent_id($value) {
1831
+		if ($value && ($value === $this->get_id() || !get_post($value))) {
1832 1832
 			return;
1833 1833
 		}
1834
-		$this->set_prop( 'parent_id', absint( $value ) );
1834
+		$this->set_prop('parent_id', absint($value));
1835 1835
     }
1836 1836
 
1837 1837
     /**
@@ -1839,8 +1839,8 @@  discard block
 block discarded – undo
1839 1839
 	 *
1840 1840
 	 * @since 1.0.19
1841 1841
 	 */
1842
-	public function set_version( $value ) {
1843
-		$this->set_prop( 'version', $value );
1842
+	public function set_version($value) {
1843
+		$this->set_prop('version', $value);
1844 1844
     }
1845 1845
 
1846 1846
     /**
@@ -1850,15 +1850,15 @@  discard block
 block discarded – undo
1850 1850
 	 * @param string $value Value to set.
1851 1851
      * @return bool Whether or not the date was set.
1852 1852
 	 */
1853
-	public function set_date_created( $value ) {
1854
-        $date = strtotime( $value );
1853
+	public function set_date_created($value) {
1854
+        $date = strtotime($value);
1855 1855
 
1856
-        if ( $date && $date !== '0000-00-00 00:00:00' ) {
1857
-            $this->set_prop( 'date_created', date( 'Y-m-d H:i:s', $date ) );
1856
+        if ($date && $date !== '0000-00-00 00:00:00') {
1857
+            $this->set_prop('date_created', date('Y-m-d H:i:s', $date));
1858 1858
             return true;
1859 1859
         }
1860 1860
 
1861
-        return $this->set_prop( 'date_created', '' );
1861
+        return $this->set_prop('date_created', '');
1862 1862
 
1863 1863
     }
1864 1864
 
@@ -1869,15 +1869,15 @@  discard block
 block discarded – undo
1869 1869
 	 * @param string $value Value to set.
1870 1870
      * @return bool Whether or not the date was set.
1871 1871
 	 */
1872
-	public function set_due_date( $value ) {
1873
-        $date = strtotime( $value );
1872
+	public function set_due_date($value) {
1873
+        $date = strtotime($value);
1874 1874
 
1875
-        if ( $date && $date !== '0000-00-00 00:00:00' ) {
1876
-            $this->set_prop( 'due_date', date( 'Y-m-d H:i:s', $date ) );
1875
+        if ($date && $date !== '0000-00-00 00:00:00') {
1876
+            $this->set_prop('due_date', date('Y-m-d H:i:s', $date));
1877 1877
             return true;
1878 1878
         }
1879 1879
 
1880
-		$this->set_prop( 'due_date', '' );
1880
+		$this->set_prop('due_date', '');
1881 1881
         return false;
1882 1882
 
1883 1883
     }
@@ -1888,8 +1888,8 @@  discard block
 block discarded – undo
1888 1888
 	 * @since 1.0.19
1889 1889
 	 * @param  string $value New name.
1890 1890
 	 */
1891
-	public function set_date_due( $value ) {
1892
-		$this->set_due_date( $value );
1891
+	public function set_date_due($value) {
1892
+		$this->set_due_date($value);
1893 1893
     }
1894 1894
 
1895 1895
     /**
@@ -1899,15 +1899,15 @@  discard block
 block discarded – undo
1899 1899
 	 * @param string $value Value to set.
1900 1900
      * @return bool Whether or not the date was set.
1901 1901
 	 */
1902
-	public function set_completed_date( $value ) {
1903
-        $date = strtotime( $value );
1902
+	public function set_completed_date($value) {
1903
+        $date = strtotime($value);
1904 1904
 
1905
-        if ( $date && $date !== '0000-00-00 00:00:00'  ) {
1906
-            $this->set_prop( 'completed_date', date( 'Y-m-d H:i:s', $date ) );
1905
+        if ($date && $date !== '0000-00-00 00:00:00') {
1906
+            $this->set_prop('completed_date', date('Y-m-d H:i:s', $date));
1907 1907
             return true;
1908 1908
         }
1909 1909
 
1910
-		$this->set_prop( 'completed_date', '' );
1910
+		$this->set_prop('completed_date', '');
1911 1911
         return false;
1912 1912
 
1913 1913
     }
@@ -1918,8 +1918,8 @@  discard block
 block discarded – undo
1918 1918
 	 * @since 1.0.19
1919 1919
 	 * @param  string $value New name.
1920 1920
 	 */
1921
-	public function set_date_completed( $value ) {
1922
-		$this->set_completed_date( $value );
1921
+	public function set_date_completed($value) {
1922
+		$this->set_completed_date($value);
1923 1923
     }
1924 1924
 
1925 1925
     /**
@@ -1929,15 +1929,15 @@  discard block
 block discarded – undo
1929 1929
 	 * @param string $value Value to set.
1930 1930
      * @return bool Whether or not the date was set.
1931 1931
 	 */
1932
-	public function set_date_modified( $value ) {
1933
-        $date = strtotime( $value );
1932
+	public function set_date_modified($value) {
1933
+        $date = strtotime($value);
1934 1934
 
1935
-        if ( $date && $date !== '0000-00-00 00:00:00' ) {
1936
-            $this->set_prop( 'date_modified', date( 'Y-m-d H:i:s', $date ) );
1935
+        if ($date && $date !== '0000-00-00 00:00:00') {
1936
+            $this->set_prop('date_modified', date('Y-m-d H:i:s', $date));
1937 1937
             return true;
1938 1938
         }
1939 1939
 
1940
-		$this->set_prop( 'date_modified', '' );
1940
+		$this->set_prop('date_modified', '');
1941 1941
         return false;
1942 1942
 
1943 1943
     }
@@ -1948,9 +1948,9 @@  discard block
 block discarded – undo
1948 1948
 	 * @since 1.0.19
1949 1949
 	 * @param  string $value New number.
1950 1950
 	 */
1951
-	public function set_number( $value ) {
1952
-        $number = sanitize_text_field( $value );
1953
-		$this->set_prop( 'number', $number );
1951
+	public function set_number($value) {
1952
+        $number = sanitize_text_field($value);
1953
+		$this->set_prop('number', $number);
1954 1954
     }
1955 1955
 
1956 1956
     /**
@@ -1959,9 +1959,9 @@  discard block
 block discarded – undo
1959 1959
 	 * @since 1.0.19
1960 1960
 	 * @param  string $value Type.
1961 1961
 	 */
1962
-	public function set_type( $value ) {
1963
-        $type = sanitize_text_field( str_replace( 'wpi_', '', $value ) );
1964
-		$this->set_prop( 'type', $type );
1962
+	public function set_type($value) {
1963
+        $type = sanitize_text_field(str_replace('wpi_', '', $value));
1964
+		$this->set_prop('type', $type);
1965 1965
     }
1966 1966
 
1967 1967
     /**
@@ -1970,9 +1970,9 @@  discard block
 block discarded – undo
1970 1970
 	 * @since 1.0.19
1971 1971
 	 * @param  string $value Post type.
1972 1972
 	 */
1973
-	public function set_post_type( $value ) {
1974
-        if ( getpaid_is_invoice_post_type( $value ) ) {
1975
-            $this->set_prop( 'post_type', $value );
1973
+	public function set_post_type($value) {
1974
+        if (getpaid_is_invoice_post_type($value)) {
1975
+            $this->set_prop('post_type', $value);
1976 1976
         }
1977 1977
     }
1978 1978
 
@@ -1982,9 +1982,9 @@  discard block
 block discarded – undo
1982 1982
 	 * @since 1.0.19
1983 1983
 	 * @param  string $value New key.
1984 1984
 	 */
1985
-	public function set_key( $value ) {
1986
-        $key = sanitize_text_field( $value );
1987
-		$this->set_prop( 'key', $key );
1985
+	public function set_key($value) {
1986
+        $key = sanitize_text_field($value);
1987
+		$this->set_prop('key', $key);
1988 1988
     }
1989 1989
 
1990 1990
     /**
@@ -1993,9 +1993,9 @@  discard block
 block discarded – undo
1993 1993
 	 * @since 1.0.19
1994 1994
 	 * @param  string $value mode.
1995 1995
 	 */
1996
-	public function set_mode( $value ) {
1997
-        if ( ! in_array( $value, array( 'live', 'test' ) ) ) {
1998
-            $this->set_prop( 'value', $value );
1996
+	public function set_mode($value) {
1997
+        if (!in_array($value, array('live', 'test'))) {
1998
+            $this->set_prop('value', $value);
1999 1999
         }
2000 2000
     }
2001 2001
 
@@ -2005,8 +2005,8 @@  discard block
 block discarded – undo
2005 2005
 	 * @since 1.0.19
2006 2006
 	 * @param  string $value path.
2007 2007
 	 */
2008
-	public function set_path( $value ) {
2009
-        $this->set_prop( 'path', $value );
2008
+	public function set_path($value) {
2009
+        $this->set_prop('path', $value);
2010 2010
     }
2011 2011
 
2012 2012
     /**
@@ -2015,9 +2015,9 @@  discard block
 block discarded – undo
2015 2015
 	 * @since 1.0.19
2016 2016
 	 * @param  string $value New name.
2017 2017
 	 */
2018
-	public function set_name( $value ) {
2019
-        $name = sanitize_text_field( $value );
2020
-		$this->set_prop( 'name', $name );
2018
+	public function set_name($value) {
2019
+        $name = sanitize_text_field($value);
2020
+		$this->set_prop('name', $name);
2021 2021
     }
2022 2022
 
2023 2023
     /**
@@ -2026,8 +2026,8 @@  discard block
 block discarded – undo
2026 2026
 	 * @since 1.0.19
2027 2027
 	 * @param  string $value New name.
2028 2028
 	 */
2029
-	public function set_title( $value ) {
2030
-		$this->set_name( $value );
2029
+	public function set_title($value) {
2030
+		$this->set_name($value);
2031 2031
     }
2032 2032
 
2033 2033
     /**
@@ -2036,9 +2036,9 @@  discard block
 block discarded – undo
2036 2036
 	 * @since 1.0.19
2037 2037
 	 * @param  string $value New description.
2038 2038
 	 */
2039
-	public function set_description( $value ) {
2040
-        $description = wp_kses_post( $value );
2041
-		return $this->set_prop( 'description', $description );
2039
+	public function set_description($value) {
2040
+        $description = wp_kses_post($value);
2041
+		return $this->set_prop('description', $description);
2042 2042
     }
2043 2043
 
2044 2044
     /**
@@ -2047,8 +2047,8 @@  discard block
 block discarded – undo
2047 2047
 	 * @since 1.0.19
2048 2048
 	 * @param  string $value New description.
2049 2049
 	 */
2050
-	public function set_excerpt( $value ) {
2051
-		$this->set_description( $value );
2050
+	public function set_excerpt($value) {
2051
+		$this->set_description($value);
2052 2052
     }
2053 2053
 
2054 2054
     /**
@@ -2057,8 +2057,8 @@  discard block
 block discarded – undo
2057 2057
 	 * @since 1.0.19
2058 2058
 	 * @param  string $value New description.
2059 2059
 	 */
2060
-	public function set_summary( $value ) {
2061
-		$this->set_description( $value );
2060
+	public function set_summary($value) {
2061
+		$this->set_description($value);
2062 2062
     }
2063 2063
 
2064 2064
     /**
@@ -2067,8 +2067,8 @@  discard block
 block discarded – undo
2067 2067
 	 * @since 1.0.19
2068 2068
 	 * @param  int $value New author.
2069 2069
 	 */
2070
-	public function set_author( $value ) {
2071
-		$this->set_prop( 'author', (int) $value );
2070
+	public function set_author($value) {
2071
+		$this->set_prop('author', (int) $value);
2072 2072
     }
2073 2073
 
2074 2074
     /**
@@ -2077,8 +2077,8 @@  discard block
 block discarded – undo
2077 2077
 	 * @since 1.0.19
2078 2078
 	 * @param  int $value New user id.
2079 2079
 	 */
2080
-	public function set_user_id( $value ) {
2081
-		$this->set_author( $value );
2080
+	public function set_user_id($value) {
2081
+		$this->set_author($value);
2082 2082
     }
2083 2083
 
2084 2084
     /**
@@ -2087,8 +2087,8 @@  discard block
 block discarded – undo
2087 2087
 	 * @since 1.0.19
2088 2088
 	 * @param  int $value New user id.
2089 2089
 	 */
2090
-	public function set_customer_id( $value ) {
2091
-		$this->set_author( $value );
2090
+	public function set_customer_id($value) {
2091
+		$this->set_author($value);
2092 2092
     }
2093 2093
 
2094 2094
     /**
@@ -2097,8 +2097,8 @@  discard block
 block discarded – undo
2097 2097
 	 * @since 1.0.19
2098 2098
 	 * @param  string $value ip address.
2099 2099
 	 */
2100
-	public function set_ip( $value ) {
2101
-		$this->set_prop( 'ip', $value );
2100
+	public function set_ip($value) {
2101
+		$this->set_prop('ip', $value);
2102 2102
     }
2103 2103
 
2104 2104
     /**
@@ -2107,8 +2107,8 @@  discard block
 block discarded – undo
2107 2107
 	 * @since 1.0.19
2108 2108
 	 * @param  string $value ip address.
2109 2109
 	 */
2110
-	public function set_user_ip( $value ) {
2111
-		$this->set_ip( $value );
2110
+	public function set_user_ip($value) {
2111
+		$this->set_ip($value);
2112 2112
     }
2113 2113
 
2114 2114
     /**
@@ -2117,8 +2117,8 @@  discard block
 block discarded – undo
2117 2117
 	 * @since 1.0.19
2118 2118
 	 * @param  string $value first name.
2119 2119
 	 */
2120
-	public function set_first_name( $value ) {
2121
-		$this->set_prop( 'first_name', $value );
2120
+	public function set_first_name($value) {
2121
+		$this->set_prop('first_name', $value);
2122 2122
     }
2123 2123
 
2124 2124
     /**
@@ -2127,8 +2127,8 @@  discard block
 block discarded – undo
2127 2127
 	 * @since 1.0.19
2128 2128
 	 * @param  string $value first name.
2129 2129
 	 */
2130
-	public function set_user_first_name( $value ) {
2131
-		$this->set_first_name( $value );
2130
+	public function set_user_first_name($value) {
2131
+		$this->set_first_name($value);
2132 2132
     }
2133 2133
 
2134 2134
     /**
@@ -2137,8 +2137,8 @@  discard block
 block discarded – undo
2137 2137
 	 * @since 1.0.19
2138 2138
 	 * @param  string $value first name.
2139 2139
 	 */
2140
-	public function set_customer_first_name( $value ) {
2141
-		$this->set_first_name( $value );
2140
+	public function set_customer_first_name($value) {
2141
+		$this->set_first_name($value);
2142 2142
     }
2143 2143
 
2144 2144
     /**
@@ -2147,8 +2147,8 @@  discard block
 block discarded – undo
2147 2147
 	 * @since 1.0.19
2148 2148
 	 * @param  string $value last name.
2149 2149
 	 */
2150
-	public function set_last_name( $value ) {
2151
-		$this->set_prop( 'last_name', $value );
2150
+	public function set_last_name($value) {
2151
+		$this->set_prop('last_name', $value);
2152 2152
     }
2153 2153
 
2154 2154
     /**
@@ -2157,8 +2157,8 @@  discard block
 block discarded – undo
2157 2157
 	 * @since 1.0.19
2158 2158
 	 * @param  string $value last name.
2159 2159
 	 */
2160
-	public function set_user_last_name( $value ) {
2161
-		$this->set_last_name( $value );
2160
+	public function set_user_last_name($value) {
2161
+		$this->set_last_name($value);
2162 2162
     }
2163 2163
 
2164 2164
     /**
@@ -2167,8 +2167,8 @@  discard block
 block discarded – undo
2167 2167
 	 * @since 1.0.19
2168 2168
 	 * @param  string $value last name.
2169 2169
 	 */
2170
-	public function set_customer_last_name( $value ) {
2171
-		$this->set_last_name( $value );
2170
+	public function set_customer_last_name($value) {
2171
+		$this->set_last_name($value);
2172 2172
     }
2173 2173
 
2174 2174
     /**
@@ -2177,8 +2177,8 @@  discard block
 block discarded – undo
2177 2177
 	 * @since 1.0.19
2178 2178
 	 * @param  string $value phone.
2179 2179
 	 */
2180
-	public function set_phone( $value ) {
2181
-		$this->set_prop( 'phone', $value );
2180
+	public function set_phone($value) {
2181
+		$this->set_prop('phone', $value);
2182 2182
     }
2183 2183
 
2184 2184
     /**
@@ -2187,8 +2187,8 @@  discard block
 block discarded – undo
2187 2187
 	 * @since 1.0.19
2188 2188
 	 * @param  string $value phone.
2189 2189
 	 */
2190
-	public function set_user_phone( $value ) {
2191
-		$this->set_phone( $value );
2190
+	public function set_user_phone($value) {
2191
+		$this->set_phone($value);
2192 2192
     }
2193 2193
 
2194 2194
     /**
@@ -2197,8 +2197,8 @@  discard block
 block discarded – undo
2197 2197
 	 * @since 1.0.19
2198 2198
 	 * @param  string $value phone.
2199 2199
 	 */
2200
-	public function set_customer_phone( $value ) {
2201
-		$this->set_phone( $value );
2200
+	public function set_customer_phone($value) {
2201
+		$this->set_phone($value);
2202 2202
     }
2203 2203
 
2204 2204
     /**
@@ -2207,8 +2207,8 @@  discard block
 block discarded – undo
2207 2207
 	 * @since 1.0.19
2208 2208
 	 * @param  string $value phone.
2209 2209
 	 */
2210
-	public function set_phone_number( $value ) {
2211
-		$this->set_phone( $value );
2210
+	public function set_phone_number($value) {
2211
+		$this->set_phone($value);
2212 2212
     }
2213 2213
 
2214 2214
     /**
@@ -2217,8 +2217,8 @@  discard block
 block discarded – undo
2217 2217
 	 * @since 1.0.19
2218 2218
 	 * @param  string $value email address.
2219 2219
 	 */
2220
-	public function set_email( $value ) {
2221
-		$this->set_prop( 'email', $value );
2220
+	public function set_email($value) {
2221
+		$this->set_prop('email', $value);
2222 2222
     }
2223 2223
 
2224 2224
     /**
@@ -2227,8 +2227,8 @@  discard block
 block discarded – undo
2227 2227
 	 * @since 1.0.19
2228 2228
 	 * @param  string $value email address.
2229 2229
 	 */
2230
-	public function set_user_email( $value ) {
2231
-		$this->set_email( $value );
2230
+	public function set_user_email($value) {
2231
+		$this->set_email($value);
2232 2232
     }
2233 2233
 
2234 2234
     /**
@@ -2237,8 +2237,8 @@  discard block
 block discarded – undo
2237 2237
 	 * @since 1.0.19
2238 2238
 	 * @param  string $value email address.
2239 2239
 	 */
2240
-	public function set_email_address( $value ) {
2241
-		$this->set_email( $value );
2240
+	public function set_email_address($value) {
2241
+		$this->set_email($value);
2242 2242
     }
2243 2243
 
2244 2244
     /**
@@ -2247,8 +2247,8 @@  discard block
 block discarded – undo
2247 2247
 	 * @since 1.0.19
2248 2248
 	 * @param  string $value email address.
2249 2249
 	 */
2250
-	public function set_customer_email( $value ) {
2251
-		$this->set_email( $value );
2250
+	public function set_customer_email($value) {
2251
+		$this->set_email($value);
2252 2252
     }
2253 2253
 
2254 2254
     /**
@@ -2257,8 +2257,8 @@  discard block
 block discarded – undo
2257 2257
 	 * @since 1.0.19
2258 2258
 	 * @param  string $value country.
2259 2259
 	 */
2260
-	public function set_country( $value ) {
2261
-		$this->set_prop( 'country', $value );
2260
+	public function set_country($value) {
2261
+		$this->set_prop('country', $value);
2262 2262
     }
2263 2263
 
2264 2264
     /**
@@ -2267,8 +2267,8 @@  discard block
 block discarded – undo
2267 2267
 	 * @since 1.0.19
2268 2268
 	 * @param  string $value country.
2269 2269
 	 */
2270
-	public function set_user_country( $value ) {
2271
-		$this->set_country( $value );
2270
+	public function set_user_country($value) {
2271
+		$this->set_country($value);
2272 2272
     }
2273 2273
 
2274 2274
     /**
@@ -2277,8 +2277,8 @@  discard block
 block discarded – undo
2277 2277
 	 * @since 1.0.19
2278 2278
 	 * @param  string $value country.
2279 2279
 	 */
2280
-	public function set_customer_country( $value ) {
2281
-		$this->set_country( $value );
2280
+	public function set_customer_country($value) {
2281
+		$this->set_country($value);
2282 2282
     }
2283 2283
 
2284 2284
     /**
@@ -2287,8 +2287,8 @@  discard block
 block discarded – undo
2287 2287
 	 * @since 1.0.19
2288 2288
 	 * @param  string $value state.
2289 2289
 	 */
2290
-	public function set_state( $value ) {
2291
-		$this->set_prop( 'state', $value );
2290
+	public function set_state($value) {
2291
+		$this->set_prop('state', $value);
2292 2292
     }
2293 2293
 
2294 2294
     /**
@@ -2297,8 +2297,8 @@  discard block
 block discarded – undo
2297 2297
 	 * @since 1.0.19
2298 2298
 	 * @param  string $value state.
2299 2299
 	 */
2300
-	public function set_user_state( $value ) {
2301
-		$this->set_state( $value );
2300
+	public function set_user_state($value) {
2301
+		$this->set_state($value);
2302 2302
     }
2303 2303
 
2304 2304
     /**
@@ -2307,8 +2307,8 @@  discard block
 block discarded – undo
2307 2307
 	 * @since 1.0.19
2308 2308
 	 * @param  string $value state.
2309 2309
 	 */
2310
-	public function set_customer_state( $value ) {
2311
-		$this->set_state( $value );
2310
+	public function set_customer_state($value) {
2311
+		$this->set_state($value);
2312 2312
     }
2313 2313
 
2314 2314
     /**
@@ -2317,8 +2317,8 @@  discard block
 block discarded – undo
2317 2317
 	 * @since 1.0.19
2318 2318
 	 * @param  string $value city.
2319 2319
 	 */
2320
-	public function set_city( $value ) {
2321
-		$this->set_prop( 'city', $value );
2320
+	public function set_city($value) {
2321
+		$this->set_prop('city', $value);
2322 2322
     }
2323 2323
 
2324 2324
     /**
@@ -2327,8 +2327,8 @@  discard block
 block discarded – undo
2327 2327
 	 * @since 1.0.19
2328 2328
 	 * @param  string $value city.
2329 2329
 	 */
2330
-	public function set_user_city( $value ) {
2331
-		$this->set_city( $value );
2330
+	public function set_user_city($value) {
2331
+		$this->set_city($value);
2332 2332
     }
2333 2333
 
2334 2334
     /**
@@ -2337,8 +2337,8 @@  discard block
 block discarded – undo
2337 2337
 	 * @since 1.0.19
2338 2338
 	 * @param  string $value city.
2339 2339
 	 */
2340
-	public function set_customer_city( $value ) {
2341
-		$this->set_city( $value );
2340
+	public function set_customer_city($value) {
2341
+		$this->set_city($value);
2342 2342
     }
2343 2343
 
2344 2344
     /**
@@ -2347,8 +2347,8 @@  discard block
 block discarded – undo
2347 2347
 	 * @since 1.0.19
2348 2348
 	 * @param  string $value zip.
2349 2349
 	 */
2350
-	public function set_zip( $value ) {
2351
-		$this->set_prop( 'zip', $value );
2350
+	public function set_zip($value) {
2351
+		$this->set_prop('zip', $value);
2352 2352
     }
2353 2353
 
2354 2354
     /**
@@ -2357,8 +2357,8 @@  discard block
 block discarded – undo
2357 2357
 	 * @since 1.0.19
2358 2358
 	 * @param  string $value zip.
2359 2359
 	 */
2360
-	public function set_user_zip( $value ) {
2361
-		$this->set_zip( $value );
2360
+	public function set_user_zip($value) {
2361
+		$this->set_zip($value);
2362 2362
     }
2363 2363
 
2364 2364
     /**
@@ -2367,8 +2367,8 @@  discard block
 block discarded – undo
2367 2367
 	 * @since 1.0.19
2368 2368
 	 * @param  string $value zip.
2369 2369
 	 */
2370
-	public function set_customer_zip( $value ) {
2371
-		$this->set_zip( $value );
2370
+	public function set_customer_zip($value) {
2371
+		$this->set_zip($value);
2372 2372
     }
2373 2373
 
2374 2374
     /**
@@ -2377,8 +2377,8 @@  discard block
 block discarded – undo
2377 2377
 	 * @since 1.0.19
2378 2378
 	 * @param  string $value company.
2379 2379
 	 */
2380
-	public function set_company( $value ) {
2381
-		$this->set_prop( 'company', $value );
2380
+	public function set_company($value) {
2381
+		$this->set_prop('company', $value);
2382 2382
     }
2383 2383
 
2384 2384
     /**
@@ -2387,8 +2387,8 @@  discard block
 block discarded – undo
2387 2387
 	 * @since 1.0.19
2388 2388
 	 * @param  string $value company.
2389 2389
 	 */
2390
-	public function set_user_company( $value ) {
2391
-		$this->set_company( $value );
2390
+	public function set_user_company($value) {
2391
+		$this->set_company($value);
2392 2392
     }
2393 2393
 
2394 2394
     /**
@@ -2397,8 +2397,8 @@  discard block
 block discarded – undo
2397 2397
 	 * @since 1.0.19
2398 2398
 	 * @param  string $value company.
2399 2399
 	 */
2400
-	public function set_customer_company( $value ) {
2401
-		$this->set_company( $value );
2400
+	public function set_customer_company($value) {
2401
+		$this->set_company($value);
2402 2402
     }
2403 2403
 
2404 2404
     /**
@@ -2407,8 +2407,8 @@  discard block
 block discarded – undo
2407 2407
 	 * @since 1.0.19
2408 2408
 	 * @param  string $value var number.
2409 2409
 	 */
2410
-	public function set_vat_number( $value ) {
2411
-		$this->set_prop( 'vat_number', $value );
2410
+	public function set_vat_number($value) {
2411
+		$this->set_prop('vat_number', $value);
2412 2412
     }
2413 2413
 
2414 2414
     /**
@@ -2417,8 +2417,8 @@  discard block
 block discarded – undo
2417 2417
 	 * @since 1.0.19
2418 2418
 	 * @param  string $value var number.
2419 2419
 	 */
2420
-	public function set_user_vat_number( $value ) {
2421
-		$this->set_vat_number( $value );
2420
+	public function set_user_vat_number($value) {
2421
+		$this->set_vat_number($value);
2422 2422
     }
2423 2423
 
2424 2424
     /**
@@ -2427,8 +2427,8 @@  discard block
 block discarded – undo
2427 2427
 	 * @since 1.0.19
2428 2428
 	 * @param  string $value var number.
2429 2429
 	 */
2430
-	public function set_customer_vat_number( $value ) {
2431
-		$this->set_vat_number( $value );
2430
+	public function set_customer_vat_number($value) {
2431
+		$this->set_vat_number($value);
2432 2432
     }
2433 2433
 
2434 2434
     /**
@@ -2437,8 +2437,8 @@  discard block
 block discarded – undo
2437 2437
 	 * @since 1.0.19
2438 2438
 	 * @param  string $value var rate.
2439 2439
 	 */
2440
-	public function set_vat_rate( $value ) {
2441
-		$this->set_prop( 'vat_rate', $value );
2440
+	public function set_vat_rate($value) {
2441
+		$this->set_prop('vat_rate', $value);
2442 2442
     }
2443 2443
 
2444 2444
     /**
@@ -2447,8 +2447,8 @@  discard block
 block discarded – undo
2447 2447
 	 * @since 1.0.19
2448 2448
 	 * @param  string $value var number.
2449 2449
 	 */
2450
-	public function set_user_vat_rate( $value ) {
2451
-		$this->set_vat_rate( $value );
2450
+	public function set_user_vat_rate($value) {
2451
+		$this->set_vat_rate($value);
2452 2452
     }
2453 2453
 
2454 2454
     /**
@@ -2457,8 +2457,8 @@  discard block
 block discarded – undo
2457 2457
 	 * @since 1.0.19
2458 2458
 	 * @param  string $value var number.
2459 2459
 	 */
2460
-	public function set_customer_vat_rate( $value ) {
2461
-		$this->set_vat_rate( $value );
2460
+	public function set_customer_vat_rate($value) {
2461
+		$this->set_vat_rate($value);
2462 2462
     }
2463 2463
 
2464 2464
     /**
@@ -2467,8 +2467,8 @@  discard block
 block discarded – undo
2467 2467
 	 * @since 1.0.19
2468 2468
 	 * @param  string $value address.
2469 2469
 	 */
2470
-	public function set_address( $value ) {
2471
-		$this->set_prop( 'address', $value );
2470
+	public function set_address($value) {
2471
+		$this->set_prop('address', $value);
2472 2472
     }
2473 2473
 
2474 2474
     /**
@@ -2477,8 +2477,8 @@  discard block
 block discarded – undo
2477 2477
 	 * @since 1.0.19
2478 2478
 	 * @param  string $value address.
2479 2479
 	 */
2480
-	public function set_user_address( $value ) {
2481
-		$this->set_address( $value );
2480
+	public function set_user_address($value) {
2481
+		$this->set_address($value);
2482 2482
     }
2483 2483
 
2484 2484
     /**
@@ -2487,8 +2487,8 @@  discard block
 block discarded – undo
2487 2487
 	 * @since 1.0.19
2488 2488
 	 * @param  string $value address.
2489 2489
 	 */
2490
-	public function set_customer_address( $value ) {
2491
-		$this->set_address( $value );
2490
+	public function set_customer_address($value) {
2491
+		$this->set_address($value);
2492 2492
     }
2493 2493
 
2494 2494
     /**
@@ -2497,8 +2497,8 @@  discard block
 block discarded – undo
2497 2497
 	 * @since 1.0.19
2498 2498
 	 * @param  int|bool $value confirmed.
2499 2499
 	 */
2500
-	public function set_is_viewed( $value ) {
2501
-		$this->set_prop( 'is_viewed', $value );
2500
+	public function set_is_viewed($value) {
2501
+		$this->set_prop('is_viewed', $value);
2502 2502
 	}
2503 2503
 
2504 2504
 	/**
@@ -2507,8 +2507,8 @@  discard block
 block discarded – undo
2507 2507
 	 * @since 1.0.19
2508 2508
 	 * @param  string $value email recipients.
2509 2509
 	 */
2510
-	public function set_email_cc( $value ) {
2511
-		$this->set_prop( 'email_cc', $value );
2510
+	public function set_email_cc($value) {
2511
+		$this->set_prop('email_cc', $value);
2512 2512
 	}
2513 2513
 
2514 2514
 	/**
@@ -2517,9 +2517,9 @@  discard block
 block discarded – undo
2517 2517
 	 * @since 1.0.19
2518 2518
 	 * @param  string $value email recipients.
2519 2519
 	 */
2520
-	public function set_template( $value ) {
2521
-		if ( in_array( $value, array( 'quantity', 'hours', 'amount' ) ) ) {
2522
-			$this->set_prop( 'template', $value );
2520
+	public function set_template($value) {
2521
+		if (in_array($value, array('quantity', 'hours', 'amount'))) {
2522
+			$this->set_prop('template', $value);
2523 2523
 		}
2524 2524
 	}
2525 2525
 
@@ -2529,8 +2529,8 @@  discard block
 block discarded – undo
2529 2529
 	 * @since 1.0.19
2530 2530
 	 * @param  int|bool $value confirmed.
2531 2531
 	 */
2532
-	public function set_address_confirmed( $value ) {
2533
-		$this->set_prop( 'address_confirmed', $value );
2532
+	public function set_address_confirmed($value) {
2533
+		$this->set_prop('address_confirmed', $value);
2534 2534
     }
2535 2535
 
2536 2536
     /**
@@ -2539,8 +2539,8 @@  discard block
 block discarded – undo
2539 2539
 	 * @since 1.0.19
2540 2540
 	 * @param  int|bool $value confirmed.
2541 2541
 	 */
2542
-	public function set_user_address_confirmed( $value ) {
2543
-		$this->set_address_confirmed( $value );
2542
+	public function set_user_address_confirmed($value) {
2543
+		$this->set_address_confirmed($value);
2544 2544
     }
2545 2545
 
2546 2546
     /**
@@ -2549,8 +2549,8 @@  discard block
 block discarded – undo
2549 2549
 	 * @since 1.0.19
2550 2550
 	 * @param  int|bool $value confirmed.
2551 2551
 	 */
2552
-	public function set_customer_address_confirmed( $value ) {
2553
-		$this->set_address_confirmed( $value );
2552
+	public function set_customer_address_confirmed($value) {
2553
+		$this->set_address_confirmed($value);
2554 2554
     }
2555 2555
 
2556 2556
     /**
@@ -2559,8 +2559,8 @@  discard block
 block discarded – undo
2559 2559
 	 * @since 1.0.19
2560 2560
 	 * @param  float $value sub total.
2561 2561
 	 */
2562
-	public function set_subtotal( $value ) {
2563
-		$this->set_prop( 'subtotal', $value );
2562
+	public function set_subtotal($value) {
2563
+		$this->set_prop('subtotal', $value);
2564 2564
     }
2565 2565
 
2566 2566
     /**
@@ -2569,8 +2569,8 @@  discard block
 block discarded – undo
2569 2569
 	 * @since 1.0.19
2570 2570
 	 * @param  float $value discount total.
2571 2571
 	 */
2572
-	public function set_total_discount( $value ) {
2573
-		$this->set_prop( 'total_discount', $value );
2572
+	public function set_total_discount($value) {
2573
+		$this->set_prop('total_discount', $value);
2574 2574
     }
2575 2575
 
2576 2576
     /**
@@ -2579,8 +2579,8 @@  discard block
 block discarded – undo
2579 2579
 	 * @since 1.0.19
2580 2580
 	 * @param  float $value discount total.
2581 2581
 	 */
2582
-	public function set_discount( $value ) {
2583
-		$this->set_total_discount( $value );
2582
+	public function set_discount($value) {
2583
+		$this->set_total_discount($value);
2584 2584
     }
2585 2585
 
2586 2586
     /**
@@ -2589,8 +2589,8 @@  discard block
 block discarded – undo
2589 2589
 	 * @since 1.0.19
2590 2590
 	 * @param  float $value tax total.
2591 2591
 	 */
2592
-	public function set_total_tax( $value ) {
2593
-		$this->set_prop( 'total_tax', $value );
2592
+	public function set_total_tax($value) {
2593
+		$this->set_prop('total_tax', $value);
2594 2594
     }
2595 2595
 
2596 2596
     /**
@@ -2599,8 +2599,8 @@  discard block
 block discarded – undo
2599 2599
 	 * @since 1.0.19
2600 2600
 	 * @param  float $value tax total.
2601 2601
 	 */
2602
-	public function set_tax_total( $value ) {
2603
-		$this->set_total_tax( $value );
2602
+	public function set_tax_total($value) {
2603
+		$this->set_total_tax($value);
2604 2604
     }
2605 2605
 
2606 2606
     /**
@@ -2609,8 +2609,8 @@  discard block
 block discarded – undo
2609 2609
 	 * @since 1.0.19
2610 2610
 	 * @param  float $value fees total.
2611 2611
 	 */
2612
-	public function set_total_fees( $value ) {
2613
-		$this->set_prop( 'total_fees', $value );
2612
+	public function set_total_fees($value) {
2613
+		$this->set_prop('total_fees', $value);
2614 2614
     }
2615 2615
 
2616 2616
     /**
@@ -2619,8 +2619,8 @@  discard block
 block discarded – undo
2619 2619
 	 * @since 1.0.19
2620 2620
 	 * @param  float $value fees total.
2621 2621
 	 */
2622
-	public function set_fees_total( $value ) {
2623
-		$this->set_total_fees( $value );
2622
+	public function set_fees_total($value) {
2623
+		$this->set_total_fees($value);
2624 2624
     }
2625 2625
 
2626 2626
     /**
@@ -2629,18 +2629,18 @@  discard block
 block discarded – undo
2629 2629
 	 * @since 1.0.19
2630 2630
 	 * @param  array $value fees.
2631 2631
 	 */
2632
-	public function set_fees( $value ) {
2632
+	public function set_fees($value) {
2633 2633
 
2634
-        $this->set_prop( 'fees', array() );
2634
+        $this->set_prop('fees', array());
2635 2635
 
2636 2636
         // Ensure that we have an array.
2637
-        if ( ! is_array( $value ) ) {
2637
+        if (!is_array($value)) {
2638 2638
             return;
2639 2639
         }
2640 2640
 
2641
-        foreach ( $value as $name => $data ) {
2642
-            if ( isset( $data['amount'] ) ) {
2643
-                $this->add_fee( $name, $data['amount'], $data['recurring'] );
2641
+        foreach ($value as $name => $data) {
2642
+            if (isset($data['amount'])) {
2643
+                $this->add_fee($name, $data['amount'], $data['recurring']);
2644 2644
             }
2645 2645
         }
2646 2646
 
@@ -2652,8 +2652,8 @@  discard block
 block discarded – undo
2652 2652
 	 * @since 1.0.19
2653 2653
 	 * @param  array $value taxes.
2654 2654
 	 */
2655
-	public function set_taxes( $value ) {
2656
-		$this->set_prop( 'taxes', $value );
2655
+	public function set_taxes($value) {
2656
+		$this->set_prop('taxes', $value);
2657 2657
     }
2658 2658
 
2659 2659
     /**
@@ -2662,17 +2662,17 @@  discard block
 block discarded – undo
2662 2662
 	 * @since 1.0.19
2663 2663
 	 * @param  array $value discounts.
2664 2664
 	 */
2665
-	public function set_discounts( $value ) {
2666
-		$this->set_prop( 'discounts', array() );
2665
+	public function set_discounts($value) {
2666
+		$this->set_prop('discounts', array());
2667 2667
 
2668 2668
         // Ensure that we have an array.
2669
-        if ( ! is_array( $value ) ) {
2669
+        if (!is_array($value)) {
2670 2670
             return;
2671 2671
         }
2672 2672
 
2673
-        foreach ( $value as $name => $data ) {
2674
-            if ( isset( $data['amount'] ) ) {
2675
-                $this->add_discount( $name, $data['amount'], $data['recurring'] );
2673
+        foreach ($value as $name => $data) {
2674
+            if (isset($data['amount'])) {
2675
+                $this->add_discount($name, $data['amount'], $data['recurring']);
2676 2676
             }
2677 2677
         }
2678 2678
     }
@@ -2683,18 +2683,18 @@  discard block
 block discarded – undo
2683 2683
 	 * @since 1.0.19
2684 2684
 	 * @param  GetPaid_Form_Item[] $value items.
2685 2685
 	 */
2686
-	public function set_items( $value ) {
2686
+	public function set_items($value) {
2687 2687
 
2688 2688
         // Remove existing items.
2689
-        $this->set_prop( 'items', array() );
2689
+        $this->set_prop('items', array());
2690 2690
 
2691 2691
         // Ensure that we have an array.
2692
-        if ( ! is_array( $value ) ) {
2692
+        if (!is_array($value)) {
2693 2693
             return;
2694 2694
         }
2695 2695
 
2696
-        foreach ( $value as $item ) {
2697
-            $this->add_item( $item );
2696
+        foreach ($value as $item) {
2697
+            $this->add_item($item);
2698 2698
         }
2699 2699
 
2700 2700
     }
@@ -2705,8 +2705,8 @@  discard block
 block discarded – undo
2705 2705
 	 * @since 1.0.19
2706 2706
 	 * @param  int $value payment form.
2707 2707
 	 */
2708
-	public function set_payment_form( $value ) {
2709
-		$this->set_prop( 'payment_form', $value );
2708
+	public function set_payment_form($value) {
2709
+		$this->set_prop('payment_form', $value);
2710 2710
     }
2711 2711
 
2712 2712
     /**
@@ -2715,8 +2715,8 @@  discard block
 block discarded – undo
2715 2715
 	 * @since 1.0.19
2716 2716
 	 * @param  string $value submission id.
2717 2717
 	 */
2718
-	public function set_submission_id( $value ) {
2719
-		$this->set_prop( 'submission_id', $value );
2718
+	public function set_submission_id($value) {
2719
+		$this->set_prop('submission_id', $value);
2720 2720
     }
2721 2721
 
2722 2722
     /**
@@ -2725,8 +2725,8 @@  discard block
 block discarded – undo
2725 2725
 	 * @since 1.0.19
2726 2726
 	 * @param  string $value discount code.
2727 2727
 	 */
2728
-	public function set_discount_code( $value ) {
2729
-		$this->set_prop( 'discount_code', $value );
2728
+	public function set_discount_code($value) {
2729
+		$this->set_prop('discount_code', $value);
2730 2730
     }
2731 2731
 
2732 2732
     /**
@@ -2735,8 +2735,8 @@  discard block
 block discarded – undo
2735 2735
 	 * @since 1.0.19
2736 2736
 	 * @param  string $value gateway.
2737 2737
 	 */
2738
-	public function set_gateway( $value ) {
2739
-		$this->set_prop( 'gateway', $value );
2738
+	public function set_gateway($value) {
2739
+		$this->set_prop('gateway', $value);
2740 2740
     }
2741 2741
 
2742 2742
     /**
@@ -2745,8 +2745,8 @@  discard block
 block discarded – undo
2745 2745
 	 * @since 1.0.19
2746 2746
 	 * @param  string $value transaction id.
2747 2747
 	 */
2748
-	public function set_transaction_id( $value ) {
2749
-		$this->set_prop( 'transaction_id', $value );
2748
+	public function set_transaction_id($value) {
2749
+		$this->set_prop('transaction_id', $value);
2750 2750
     }
2751 2751
 
2752 2752
     /**
@@ -2755,8 +2755,8 @@  discard block
 block discarded – undo
2755 2755
 	 * @since 1.0.19
2756 2756
 	 * @param  string $value currency id.
2757 2757
 	 */
2758
-	public function set_currency( $value ) {
2759
-		$this->set_prop( 'currency', $value );
2758
+	public function set_currency($value) {
2759
+		$this->set_prop('currency', $value);
2760 2760
     }
2761 2761
 
2762 2762
     /**
@@ -2765,8 +2765,8 @@  discard block
 block discarded – undo
2765 2765
 	 * @since 1.0.19
2766 2766
 	 * @param  string $value subscription id.
2767 2767
 	 */
2768
-	public function set_subscription_id( $value ) {
2769
-		$this->set_prop( 'subscription_id', $value );
2768
+	public function set_subscription_id($value) {
2769
+		$this->set_prop('subscription_id', $value);
2770 2770
     }
2771 2771
 
2772 2772
     /*
@@ -2783,21 +2783,21 @@  discard block
 block discarded – undo
2783 2783
      */
2784 2784
     public function is_parent() {
2785 2785
         $parent = $this->get_parent_id();
2786
-        return apply_filters( 'wpinv_invoice_is_parent', empty( $parent ), $this );
2786
+        return apply_filters('wpinv_invoice_is_parent', empty($parent), $this);
2787 2787
     }
2788 2788
 
2789 2789
     /**
2790 2790
      * Checks if this is a renewal invoice.
2791 2791
      */
2792 2792
     public function is_renewal() {
2793
-        return ! $this->is_parent();
2793
+        return !$this->is_parent();
2794 2794
     }
2795 2795
 
2796 2796
     /**
2797 2797
      * Checks if this is a recurring invoice.
2798 2798
      */
2799 2799
     public function is_recurring() {
2800
-        return $this->is_renewal() || ! empty( $this->recurring_item );
2800
+        return $this->is_renewal() || !empty($this->recurring_item);
2801 2801
     }
2802 2802
 
2803 2803
     /**
@@ -2815,72 +2815,72 @@  discard block
 block discarded – undo
2815 2815
 
2816 2816
         $requires_vat = false;
2817 2817
 
2818
-        if ( $this->country ) {
2818
+        if ($this->country) {
2819 2819
             $wpi_country        = $this->country;
2820
-            $requires_vat       = $wpinv_euvat->requires_vat( $requires_vat, $this->get_user_id(), $wpinv_euvat->invoice_has_digital_rule( $this ) );
2820
+            $requires_vat       = $wpinv_euvat->requires_vat($requires_vat, $this->get_user_id(), $wpinv_euvat->invoice_has_digital_rule($this));
2821 2821
         }
2822 2822
 
2823
-        return apply_filters( 'wpinv_invoice_has_vat', $requires_vat, $this );
2823
+        return apply_filters('wpinv_invoice_has_vat', $requires_vat, $this);
2824 2824
 	}
2825 2825
 
2826 2826
 	/**
2827 2827
 	 * Checks to see if the invoice requires payment.
2828 2828
 	 */
2829 2829
 	public function is_free() {
2830
-        $is_free = ! ( (float) wpinv_round_amount( $this->get_initial_total() ) > 0 );
2830
+        $is_free = !((float) wpinv_round_amount($this->get_initial_total()) > 0);
2831 2831
 
2832
-		if ( $is_free && $this->is_recurring() ) {
2833
-			$is_free = ! ( (float) wpinv_round_amount( $this->get_recurring_total() ) > 0 );
2832
+		if ($is_free && $this->is_recurring()) {
2833
+			$is_free = !((float) wpinv_round_amount($this->get_recurring_total()) > 0);
2834 2834
 		}
2835 2835
 
2836
-        return apply_filters( 'wpinv_invoice_is_free', $is_free, $this );
2836
+        return apply_filters('wpinv_invoice_is_free', $is_free, $this);
2837 2837
     }
2838 2838
 
2839 2839
     /**
2840 2840
      * Checks if the invoice is paid.
2841 2841
      */
2842 2842
     public function is_paid() {
2843
-        $is_paid = $this->has_status( array( 'publish', 'wpi-processing', 'wpi-renewal' ) );
2844
-        return apply_filters( 'wpinv_invoice_is_paid', $is_paid, $this );
2843
+        $is_paid = $this->has_status(array('publish', 'wpi-processing', 'wpi-renewal'));
2844
+        return apply_filters('wpinv_invoice_is_paid', $is_paid, $this);
2845 2845
 	}
2846 2846
 
2847 2847
 	/**
2848 2848
      * Checks if the invoice needs payment.
2849 2849
      */
2850 2850
 	public function needs_payment() {
2851
-		$needs_payment = ! $this->is_paid() && ! $this->is_free();
2852
-        return apply_filters( 'wpinv_needs_payment', $needs_payment, $this );
2851
+		$needs_payment = !$this->is_paid() && !$this->is_free();
2852
+        return apply_filters('wpinv_needs_payment', $needs_payment, $this);
2853 2853
     }
2854 2854
 
2855 2855
 	/**
2856 2856
      * Checks if the invoice is refunded.
2857 2857
      */
2858 2858
 	public function is_refunded() {
2859
-        $is_refunded = $this->has_status( 'wpi-refunded' );
2860
-        return apply_filters( 'wpinv_invoice_is_refunded', $is_refunded, $this );
2859
+        $is_refunded = $this->has_status('wpi-refunded');
2860
+        return apply_filters('wpinv_invoice_is_refunded', $is_refunded, $this);
2861 2861
 	}
2862 2862
 
2863 2863
 	/**
2864 2864
      * Checks if the invoice is draft.
2865 2865
      */
2866 2866
 	public function is_draft() {
2867
-        return $this->has_status( 'draft, auto-draft' );
2867
+        return $this->has_status('draft, auto-draft');
2868 2868
 	}
2869 2869
 
2870 2870
     /**
2871 2871
      * Checks if the invoice has a given status.
2872 2872
      */
2873
-    public function has_status( $status ) {
2874
-        $status = wpinv_parse_list( $status );
2875
-        return apply_filters( 'wpinv_has_status', in_array( $this->get_status(), $status ), $status );
2873
+    public function has_status($status) {
2874
+        $status = wpinv_parse_list($status);
2875
+        return apply_filters('wpinv_has_status', in_array($this->get_status(), $status), $status);
2876 2876
 	}
2877 2877
 
2878 2878
 	/**
2879 2879
      * Checks if the invoice is of a given type.
2880 2880
      */
2881
-    public function is_type( $type ) {
2882
-        $type = wpinv_parse_list( $type );
2883
-        return in_array( $this->get_type(), $type );
2881
+    public function is_type($type) {
2882
+        $type = wpinv_parse_list($type);
2883
+        return in_array($this->get_type(), $type);
2884 2884
     }
2885 2885
 
2886 2886
     /**
@@ -2889,7 +2889,7 @@  discard block
 block discarded – undo
2889 2889
      * @since 1.0.15
2890 2890
      */
2891 2891
     public function is_quote() {
2892
-        return $this->has_status( 'wpi_quote' );
2892
+        return $this->has_status('wpi_quote');
2893 2893
     }
2894 2894
 
2895 2895
     /**
@@ -2912,8 +2912,8 @@  discard block
 block discarded – undo
2912 2912
      *
2913 2913
      */
2914 2914
 	public function is_initial_free() {
2915
-        $is_initial_free = ! ( (float) wpinv_round_amount( $this->get_initial_total() ) > 0 );
2916
-        return apply_filters( 'wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this );
2915
+        $is_initial_free = !((float) wpinv_round_amount($this->get_initial_total()) > 0);
2916
+        return apply_filters('wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this);
2917 2917
     }
2918 2918
 	
2919 2919
 	/**
@@ -2923,11 +2923,11 @@  discard block
 block discarded – undo
2923 2923
     public function item_has_free_trial() {
2924 2924
 
2925 2925
         // Ensure we have a recurring item.
2926
-        if ( ! $this->is_recurring() ) {
2926
+        if (!$this->is_recurring()) {
2927 2927
             return false;
2928 2928
         }
2929 2929
 
2930
-        $item = new WPInv_Item( $this->recurring_item );
2930
+        $item = new WPInv_Item($this->recurring_item);
2931 2931
         return $item->has_free_trial();
2932 2932
 	}
2933 2933
 
@@ -2935,7 +2935,7 @@  discard block
 block discarded – undo
2935 2935
      * Check if the free trial is a result of a discount.
2936 2936
      */
2937 2937
     public function is_free_trial_from_discount() {
2938
-		return $this->has_free_trial() && ! $this->item_has_free_trial();
2938
+		return $this->has_free_trial() && !$this->item_has_free_trial();
2939 2939
 	}
2940 2940
 	
2941 2941
 	/**
@@ -2944,17 +2944,17 @@  discard block
 block discarded – undo
2944 2944
     public function discount_first_payment_only() {
2945 2945
 
2946 2946
 		$discount_code = $this->get_discount_code();
2947
-        if ( empty( $this->discount_code ) || ! $this->is_recurring() ) {
2947
+        if (empty($this->discount_code) || !$this->is_recurring()) {
2948 2948
             return true;
2949 2949
         }
2950 2950
 
2951
-        $discount = wpinv_get_discount_obj( $discount_code );
2951
+        $discount = wpinv_get_discount_obj($discount_code);
2952 2952
 
2953
-        if ( ! $discount || ! $discount->exists() ) {
2953
+        if (!$discount || !$discount->exists()) {
2954 2954
             return true;
2955 2955
         }
2956 2956
 
2957
-        return ! $discount->get_is_recurring();
2957
+        return !$discount->get_is_recurring();
2958 2958
     }
2959 2959
 
2960 2960
     /*
@@ -2972,18 +2972,18 @@  discard block
 block discarded – undo
2972 2972
      * @param GetPaid_Form_Item $item
2973 2973
      * @return WP_Error|Bool
2974 2974
      */
2975
-    public function add_item( $item ) {
2975
+    public function add_item($item) {
2976 2976
 
2977 2977
         // Make sure that it is available for purchase.
2978
-		if ( $item->get_id() > 0 && ! $item->can_purchase() ) {
2979
-			return new WP_Error( 'invalid_item', __( 'This item is not available for purchase', 'invoicing' ) );
2978
+		if ($item->get_id() > 0 && !$item->can_purchase()) {
2979
+			return new WP_Error('invalid_item', __('This item is not available for purchase', 'invoicing'));
2980 2980
         }
2981 2981
 
2982 2982
         // Do we have a recurring item?
2983
-		if ( $item->is_recurring() ) {
2983
+		if ($item->is_recurring()) {
2984 2984
 
2985 2985
 			// An invoice can only contain one recurring item.
2986
-			if ( ! empty( $this->recurring_item ) ) {
2986
+			if (!empty($this->recurring_item)) {
2987 2987
 				return false;
2988 2988
 			}
2989 2989
 
@@ -2995,9 +2995,9 @@  discard block
 block discarded – undo
2995 2995
 
2996 2996
         // Retrieve all items.
2997 2997
         $items = $this->get_items();
2998
-        $items[ $item->get_id() ] = $item;
2998
+        $items[$item->get_id()] = $item;
2999 2999
 
3000
-        $this->set_prop( 'items', $items );
3000
+        $this->set_prop('items', $items);
3001 3001
 		return true;
3002 3002
     }
3003 3003
 
@@ -3006,9 +3006,9 @@  discard block
 block discarded – undo
3006 3006
 	 *
3007 3007
 	 * @since 1.0.19
3008 3008
 	 */
3009
-	public function get_item( $item_id ) {
3009
+	public function get_item($item_id) {
3010 3010
         $items = $this->get_items();
3011
-		return ( ! empty( $item_id ) && isset( $items[ $item_id ] ) ) ? $items[ $item_id ] : null;
3011
+		return (!empty($item_id) && isset($items[$item_id])) ? $items[$item_id] : null;
3012 3012
     }
3013 3013
 
3014 3014
     /**
@@ -3016,16 +3016,16 @@  discard block
 block discarded – undo
3016 3016
 	 *
3017 3017
 	 * @since 1.0.19
3018 3018
 	 */
3019
-	public function remove_item( $item_id ) {
3019
+	public function remove_item($item_id) {
3020 3020
         $items = $this->get_items();
3021 3021
 
3022
-        if ( $item_id == $this->recurring_item ) {
3022
+        if ($item_id == $this->recurring_item) {
3023 3023
             $this->recurring_item = null;
3024 3024
         }
3025 3025
 
3026
-        if ( isset( $items[ $item_id ] ) ) {
3027
-            unset( $items[ $item_id ] );
3028
-            $this->set_prop( 'items', $items );
3026
+        if (isset($items[$item_id])) {
3027
+            unset($items[$item_id]);
3028
+            $this->set_prop('items', $items);
3029 3029
         }
3030 3030
     }
3031 3031
 
@@ -3036,27 +3036,27 @@  discard block
 block discarded – undo
3036 3036
      * @param float $value
3037 3037
      * @return WP_Error|Bool
3038 3038
      */
3039
-    public function add_fee( $fee, $value, $recurring = false ) {
3039
+    public function add_fee($fee, $value, $recurring = false) {
3040 3040
 
3041
-        $amount = wpinv_sanitize_amount( $value );
3041
+        $amount = wpinv_sanitize_amount($value);
3042 3042
         $fees   = $this->get_fees();
3043 3043
 
3044
-        if ( isset( $fees[ $fee ] ) && isset( $fees[ $fee ]['amount'] ) ) {
3044
+        if (isset($fees[$fee]) && isset($fees[$fee]['amount'])) {
3045 3045
 
3046
-            $amount = $fees[ $fee ]['amount'] += $amount;
3047
-			$fees[ $fee ] = array(
3046
+            $amount = $fees[$fee]['amount'] += $amount;
3047
+			$fees[$fee] = array(
3048 3048
                 'amount'    => $amount,
3049 3049
                 'recurring' => (bool) $recurring,
3050 3050
             );
3051 3051
 
3052 3052
 		} else {
3053
-			$fees[ $fee ] = array(
3053
+			$fees[$fee] = array(
3054 3054
                 'amount'    => $amount,
3055 3055
                 'recurring' => (bool) $recurring,
3056 3056
             );
3057 3057
 		}
3058 3058
 
3059
-        $this->set_prop( 'fees', $fee );
3059
+        $this->set_prop('fees', $fee);
3060 3060
 
3061 3061
     }
3062 3062
 
@@ -3065,9 +3065,9 @@  discard block
 block discarded – undo
3065 3065
 	 *
3066 3066
 	 * @since 1.0.19
3067 3067
 	 */
3068
-	public function get_fee( $fee ) {
3068
+	public function get_fee($fee) {
3069 3069
         $fees = $this->get_fees();
3070
-		return isset( $fees[ $fee ] ) ? $fees[ $fee ] : null;
3070
+		return isset($fees[$fee]) ? $fees[$fee] : null;
3071 3071
     }
3072 3072
 
3073 3073
     /**
@@ -3075,11 +3075,11 @@  discard block
 block discarded – undo
3075 3075
 	 *
3076 3076
 	 * @since 1.0.19
3077 3077
 	 */
3078
-	public function remove_fee( $fee ) {
3078
+	public function remove_fee($fee) {
3079 3079
         $fees = $this->get_fees();
3080
-        if ( isset( $fees[ $fee ] ) ) {
3081
-            unset( $fees[ $fee ] );
3082
-            $this->set_prop( 'fees', $fees );
3080
+        if (isset($fees[$fee])) {
3081
+            unset($fees[$fee]);
3082
+            $this->set_prop('fees', $fees);
3083 3083
         }
3084 3084
     }
3085 3085
 
@@ -3090,27 +3090,27 @@  discard block
 block discarded – undo
3090 3090
      * @param float $value
3091 3091
      * @return WP_Error|Bool
3092 3092
      */
3093
-    public function add_discount( $discount, $value, $recurring = false ) {
3093
+    public function add_discount($discount, $value, $recurring = false) {
3094 3094
 
3095
-        $amount    = wpinv_sanitize_amount( $value );
3095
+        $amount    = wpinv_sanitize_amount($value);
3096 3096
         $discounts = $this->get_discounts();
3097 3097
 
3098
-        if ( isset( $discounts[ $discount ] ) && isset( $discounts[ $discount ]['amount'] ) ) {
3098
+        if (isset($discounts[$discount]) && isset($discounts[$discount]['amount'])) {
3099 3099
 
3100
-            $amount = $discounts[ $discount ]['amount'] += $amount;
3101
-			$discounts[ $discount ] = array(
3100
+            $amount = $discounts[$discount]['amount'] += $amount;
3101
+			$discounts[$discount] = array(
3102 3102
                 'amount'    => $amount,
3103 3103
                 'recurring' => (bool) $recurring,
3104 3104
             );
3105 3105
 
3106 3106
 		} else {
3107
-			$discounts[ $discount ] = array(
3107
+			$discounts[$discount] = array(
3108 3108
                 'amount'    => $amount,
3109 3109
                 'recurring' => (bool) $recurring,
3110 3110
             );
3111 3111
 		}
3112 3112
 
3113
-        $this->set_prop( 'discounts', $discount );
3113
+        $this->set_prop('discounts', $discount);
3114 3114
 
3115 3115
     }
3116 3116
 
@@ -3119,15 +3119,15 @@  discard block
 block discarded – undo
3119 3119
 	 *
3120 3120
 	 * @since 1.0.19
3121 3121
 	 */
3122
-	public function get_discount( $discount = false ) {
3122
+	public function get_discount($discount = false) {
3123 3123
 
3124 3124
 		// Backwards compatibilty.
3125
-		if ( empty( $discount ) ) {
3125
+		if (empty($discount)) {
3126 3126
 			return $this->get_total_discount();
3127 3127
 		}
3128 3128
 
3129 3129
         $discounts = $this->get_discounts();
3130
-		return isset( $discounts[ $discount ] ) ? $discounts[ $discount ] : null;
3130
+		return isset($discounts[$discount]) ? $discounts[$discount] : null;
3131 3131
     }
3132 3132
 
3133 3133
     /**
@@ -3135,11 +3135,11 @@  discard block
 block discarded – undo
3135 3135
 	 *
3136 3136
 	 * @since 1.0.19
3137 3137
 	 */
3138
-	public function remove_discount( $discount ) {
3138
+	public function remove_discount($discount) {
3139 3139
         $discounts = $this->get_discounts();
3140
-        if ( isset( $discounts[ $discount ] ) ) {
3141
-            unset( $discounts[ $discount ] );
3142
-            $this->set_prop( 'discounts', $discounts );
3140
+        if (isset($discounts[$discount])) {
3141
+            unset($discounts[$discount]);
3142
+            $this->set_prop('discounts', $discounts);
3143 3143
         }
3144 3144
     }
3145 3145
 
@@ -3149,31 +3149,31 @@  discard block
 block discarded – undo
3149 3149
      * @param string $tax
3150 3150
      * @param float $value
3151 3151
      */
3152
-    public function add_tax( $tax, $value, $recurring = true ) {
3152
+    public function add_tax($tax, $value, $recurring = true) {
3153 3153
 
3154
-        if ( ! $this->is_taxable() ) {
3154
+        if (!$this->is_taxable()) {
3155 3155
             return;
3156 3156
         }
3157 3157
 
3158
-        $amount    = wpinv_sanitize_amount( $value );
3158
+        $amount    = wpinv_sanitize_amount($value);
3159 3159
         $taxes     = $this->get_taxes();
3160 3160
 
3161
-        if ( isset( $taxes[ $tax ] ) && isset( $taxes[ $tax ]['amount'] ) ) {
3161
+        if (isset($taxes[$tax]) && isset($taxes[$tax]['amount'])) {
3162 3162
 
3163
-            $amount = $taxes[ $tax ]['amount'] += $amount;
3164
-			$taxes[ $tax ] = array(
3163
+            $amount = $taxes[$tax]['amount'] += $amount;
3164
+			$taxes[$tax] = array(
3165 3165
                 'amount'    => $amount,
3166 3166
                 'recurring' => (bool) $recurring,
3167 3167
             );
3168 3168
 
3169 3169
 		} else {
3170
-			$taxes[ $tax ] = array(
3170
+			$taxes[$tax] = array(
3171 3171
                 'amount'    => $amount,
3172 3172
                 'recurring' => (bool) $recurring,
3173 3173
             );
3174 3174
 		}
3175 3175
 
3176
-        $this->set_prop( 'taxes', $tax );
3176
+        $this->set_prop('taxes', $tax);
3177 3177
 
3178 3178
     }
3179 3179
 
@@ -3182,9 +3182,9 @@  discard block
 block discarded – undo
3182 3182
 	 *
3183 3183
 	 * @since 1.0.19
3184 3184
 	 */
3185
-	public function get_tax( $tax ) {
3185
+	public function get_tax($tax) {
3186 3186
         $taxes = $this->get_taxes();
3187
-		return isset( $taxes[ $tax ] ) ? $taxes[ $tax ] : null;
3187
+		return isset($taxes[$tax]) ? $taxes[$tax] : null;
3188 3188
     }
3189 3189
 
3190 3190
     /**
@@ -3192,11 +3192,11 @@  discard block
 block discarded – undo
3192 3192
 	 *
3193 3193
 	 * @since 1.0.19
3194 3194
 	 */
3195
-	public function remove_tax( $tax ) {
3195
+	public function remove_tax($tax) {
3196 3196
         $taxes = $this->get_discounts();
3197
-        if ( isset( $taxes[ $tax ] ) ) {
3198
-            unset( $taxes[ $tax ] );
3199
-            $this->set_prop( 'taxes', $taxes );
3197
+        if (isset($taxes[$tax])) {
3198
+            unset($taxes[$tax]);
3199
+            $this->set_prop('taxes', $taxes);
3200 3200
         }
3201 3201
     }
3202 3202
 
@@ -3207,19 +3207,19 @@  discard block
 block discarded – undo
3207 3207
 	 * @return float The recalculated subtotal
3208 3208
 	 */
3209 3209
 	public function recalculate_subtotal() {
3210
-        $items     = $this->get_items();
3210
+        $items = $this->get_items();
3211 3211
 		$subtotal  = 0;
3212 3212
 		$recurring = 0;
3213 3213
 
3214
-        foreach ( $items as $item ) {
3214
+        foreach ($items as $item) {
3215 3215
 			$subtotal  += $item->get_sub_total();
3216 3216
 			$recurring += $item->get_recurring_sub_total();
3217 3217
         }
3218 3218
 
3219
-		if ( $this->is_renewal() ) {
3220
-			$this->set_subtotal( $recurring );
3219
+		if ($this->is_renewal()) {
3220
+			$this->set_subtotal($recurring);
3221 3221
 		} else {
3222
-			$this->set_subtotal( $subtotal );
3222
+			$this->set_subtotal($subtotal);
3223 3223
 		}
3224 3224
 
3225 3225
 		$this->totals['subtotal'] = array(
@@ -3241,9 +3241,9 @@  discard block
 block discarded – undo
3241 3241
 		$discount  = 0;
3242 3242
 		$recurring = 0;
3243 3243
 
3244
-        foreach ( $discounts as $data ) {
3244
+        foreach ($discounts as $data) {
3245 3245
 
3246
-			if ( $data['recurring'] ) {
3246
+			if ($data['recurring']) {
3247 3247
 				$recurring += $data['amount'];
3248 3248
 			} else {
3249 3249
 				$discount += $data['amount'];
@@ -3251,10 +3251,10 @@  discard block
 block discarded – undo
3251 3251
 
3252 3252
 		}
3253 3253
 
3254
-		if ( $this->is_renewal() ) {
3255
-			$this->set_total_discount( $recurring );
3254
+		if ($this->is_renewal()) {
3255
+			$this->set_total_discount($recurring);
3256 3256
 		} else {
3257
-			$this->set_total_discount( $discount );
3257
+			$this->set_total_discount($discount);
3258 3258
 		}
3259 3259
 
3260 3260
 		$this->totals['discount'] = array(
@@ -3273,13 +3273,13 @@  discard block
 block discarded – undo
3273 3273
 	 * @return float The recalculated tax
3274 3274
 	 */
3275 3275
 	public function recalculate_total_tax() {
3276
-        $taxes     = $this->get_taxes();
3276
+        $taxes = $this->get_taxes();
3277 3277
 		$tax       = 0;
3278 3278
 		$recurring = 0;
3279 3279
 
3280
-        foreach ( $taxes as $data ) {
3280
+        foreach ($taxes as $data) {
3281 3281
 
3282
-			if ( $data['recurring'] ) {
3282
+			if ($data['recurring']) {
3283 3283
 				$recurring += $data['amount'];
3284 3284
 			} else {
3285 3285
 				$tax += $data['amount'];
@@ -3287,10 +3287,10 @@  discard block
 block discarded – undo
3287 3287
 
3288 3288
 		}
3289 3289
 
3290
-		if ( $this->is_renewal() ) {
3291
-			$this->set_total_tax( $recurring );
3290
+		if ($this->is_renewal()) {
3291
+			$this->set_total_tax($recurring);
3292 3292
 		} else {
3293
-			$this->set_total_tax( $tax );
3293
+			$this->set_total_tax($tax);
3294 3294
 		}
3295 3295
 
3296 3296
 		$this->totals['tax'] = array(
@@ -3313,9 +3313,9 @@  discard block
 block discarded – undo
3313 3313
 		$fee       = 0;
3314 3314
 		$recurring = 0;
3315 3315
 
3316
-        foreach ( $fees as $data ) {
3316
+        foreach ($fees as $data) {
3317 3317
 
3318
-			if ( $data['recurring'] ) {
3318
+			if ($data['recurring']) {
3319 3319
 				$recurring += $data['amount'];
3320 3320
 			} else {
3321 3321
 				$fee += $data['amount'];
@@ -3323,10 +3323,10 @@  discard block
 block discarded – undo
3323 3323
 
3324 3324
 		}
3325 3325
 
3326
-        if ( $this->is_renewal() ) {
3327
-			$this->set_total_fees( $recurring );
3326
+        if ($this->is_renewal()) {
3327
+			$this->set_total_fees($recurring);
3328 3328
 		} else {
3329
-			$this->set_total_fees( $fee );
3329
+			$this->set_total_fees($fee);
3330 3330
 		}
3331 3331
 
3332 3332
 		$this->totals['fee'] = array(
@@ -3334,7 +3334,7 @@  discard block
 block discarded – undo
3334 3334
 			'recurring' => $recurring,
3335 3335
 		);
3336 3336
 
3337
-        $this->set_total_fees( $fee );
3337
+        $this->set_total_fees($fee);
3338 3338
         return $this->is_renewal() ? $recurring : $fee;
3339 3339
     }
3340 3340
 
@@ -3355,9 +3355,9 @@  discard block
 block discarded – undo
3355 3355
 	/**
3356 3356
 	 * @deprecated
3357 3357
 	 */
3358
-    public function recalculate_totals( $temp = false ) {
3359
-        $this->update_items( $temp );
3360
-        $this->save( true );
3358
+    public function recalculate_totals($temp = false) {
3359
+        $this->update_items($temp);
3360
+        $this->save(true);
3361 3361
         return $this;
3362 3362
     }
3363 3363
 
@@ -3374,33 +3374,33 @@  discard block
 block discarded – undo
3374 3374
      * @param string $note The note being added.
3375 3375
      *
3376 3376
      */
3377
-    public function add_note( $note = '', $customer_type = false, $added_by_user = false, $system = false ) {
3377
+    public function add_note($note = '', $customer_type = false, $added_by_user = false, $system = false) {
3378 3378
 
3379 3379
         // Bail if no note specified or this invoice is not yet saved.
3380
-        if ( ! $note || $this->get_id() == 0 ) {
3380
+        if (!$note || $this->get_id() == 0) {
3381 3381
             return false;
3382 3382
         }
3383 3383
 
3384
-        if ( ( ( is_user_logged_in() && wpinv_current_user_can_manage_invoicing() ) || $added_by_user ) && !$system ) {
3385
-            $user                 = get_user_by( 'id', get_current_user_id() );
3384
+        if (((is_user_logged_in() && wpinv_current_user_can_manage_invoicing()) || $added_by_user) && !$system) {
3385
+            $user                 = get_user_by('id', get_current_user_id());
3386 3386
             $comment_author       = $user->display_name;
3387 3387
             $comment_author_email = $user->user_email;
3388 3388
         } else {
3389 3389
             $comment_author       = 'System';
3390 3390
             $comment_author_email = 'system@';
3391
-            $comment_author_email .= isset( $_SERVER['HTTP_HOST'] ) ? str_replace( 'www.', '', $_SERVER['HTTP_HOST'] ) : 'noreply.com';
3392
-            $comment_author_email = sanitize_email( $comment_author_email );
3391
+            $comment_author_email .= isset($_SERVER['HTTP_HOST']) ? str_replace('www.', '', $_SERVER['HTTP_HOST']) : 'noreply.com';
3392
+            $comment_author_email = sanitize_email($comment_author_email);
3393 3393
         }
3394 3394
 
3395
-        do_action( 'wpinv_pre_insert_invoice_note', $this->get_id(), $note, $customer_type );
3395
+        do_action('wpinv_pre_insert_invoice_note', $this->get_id(), $note, $customer_type);
3396 3396
 
3397
-        $note_id = wp_insert_comment( wp_filter_comment( array(
3397
+        $note_id = wp_insert_comment(wp_filter_comment(array(
3398 3398
             'comment_post_ID'      => $this->get_id(),
3399 3399
             'comment_content'      => $note,
3400 3400
             'comment_agent'        => 'GetPaid',
3401 3401
             'user_id'              => is_admin() ? get_current_user_id() : 0,
3402
-            'comment_date'         => current_time( 'mysql' ),
3403
-            'comment_date_gmt'     => current_time( 'mysql', 1 ),
3402
+            'comment_date'         => current_time('mysql'),
3403
+            'comment_date_gmt'     => current_time('mysql', 1),
3404 3404
             'comment_approved'     => 1,
3405 3405
             'comment_parent'       => 0,
3406 3406
             'comment_author'       => $comment_author,
@@ -3408,13 +3408,13 @@  discard block
 block discarded – undo
3408 3408
             'comment_author_url'   => '',
3409 3409
             'comment_author_email' => $comment_author_email,
3410 3410
             'comment_type'         => 'wpinv_note'
3411
-        ) ) );
3411
+        )));
3412 3412
 
3413
-        do_action( 'wpinv_insert_payment_note', $note_id, $this->get_id(), $note );
3413
+        do_action('wpinv_insert_payment_note', $note_id, $this->get_id(), $note);
3414 3414
 
3415
-        if ( $customer_type ) {
3416
-            add_comment_meta( $note_id, '_wpi_customer_note', 1 );
3417
-            do_action( 'wpinv_new_customer_note', array( 'invoice_id' => $this->get_id(), 'user_note' => $note ) );
3415
+        if ($customer_type) {
3416
+            add_comment_meta($note_id, '_wpi_customer_note', 1);
3417
+            do_action('wpinv_new_customer_note', array('invoice_id' => $this->get_id(), 'user_note' => $note));
3418 3418
         }
3419 3419
 
3420 3420
         return $note_id;
@@ -3423,10 +3423,10 @@  discard block
 block discarded – undo
3423 3423
 	/**
3424 3424
      * Generates a unique key for the invoice.
3425 3425
      */
3426
-    public function generate_key( $string = '' ) {
3427
-        $auth_key  = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
3426
+    public function generate_key($string = '') {
3427
+        $auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
3428 3428
         return strtolower(
3429
-            md5( $this->get_id() . $string . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'wpinv', true ) )
3429
+            md5($this->get_id() . $string . date('Y-m-d H:i:s') . $auth_key . uniqid('wpinv', true))
3430 3430
         );
3431 3431
     }
3432 3432
 
@@ -3436,12 +3436,12 @@  discard block
 block discarded – undo
3436 3436
     public function generate_number() {
3437 3437
         $number = $this->get_id();
3438 3438
 
3439
-        if ( $this->has_status( 'auto-draft' ) && wpinv_sequential_number_active( $this->post_type ) ) {
3440
-            $next_number = wpinv_get_next_invoice_number( $this->post_type );
3439
+        if ($this->has_status('auto-draft') && wpinv_sequential_number_active($this->post_type)) {
3440
+            $next_number = wpinv_get_next_invoice_number($this->post_type);
3441 3441
             $number      = $next_number;
3442 3442
         }
3443 3443
 
3444
-		$number = wpinv_format_invoice_number( $number, $this->post_type );
3444
+		$number = wpinv_format_invoice_number($number, $this->post_type);
3445 3445
 
3446 3446
 		return $number;
3447 3447
 	}
@@ -3455,47 +3455,47 @@  discard block
 block discarded – undo
3455 3455
 		// Reset status transition variable.
3456 3456
 		$this->status_transition = false;
3457 3457
 
3458
-		if ( $status_transition ) {
3458
+		if ($status_transition) {
3459 3459
 			try {
3460 3460
 
3461 3461
 				// Fire a hook for the status change.
3462
-				do_action( 'getpaid_invoice_status_' . $status_transition['to'], $this->get_id(), $this, $status_transition );
3462
+				do_action('getpaid_invoice_status_' . $status_transition['to'], $this->get_id(), $this, $status_transition);
3463 3463
 
3464 3464
 				// @deprecated this is deprecated and will be removed in the future.
3465
-				do_action( 'wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3465
+				do_action('wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from']);
3466 3466
 
3467
-				if ( ! empty( $status_transition['from'] ) ) {
3467
+				if (!empty($status_transition['from'])) {
3468 3468
 
3469 3469
 					/* translators: 1: old invoice status 2: new invoice status */
3470
-					$transition_note = sprintf( __( 'Status changed from %1$s to %2$s.', 'invoicing' ), wpinv_status_nicename( $status_transition['from'] ), wpinv_status_nicename( $status_transition['to'] ) );
3470
+					$transition_note = sprintf(__('Status changed from %1$s to %2$s.', 'invoicing'), wpinv_status_nicename($status_transition['from']), wpinv_status_nicename($status_transition['to']));
3471 3471
 
3472 3472
 					// Fire another hook.
3473
-					do_action( 'getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $this );
3474
-					do_action( 'getpaid_invoice_status_changed', $this->get_id(), $status_transition['from'], $status_transition['to'], $this );
3473
+					do_action('getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $this);
3474
+					do_action('getpaid_invoice_status_changed', $this->get_id(), $status_transition['from'], $status_transition['to'], $this);
3475 3475
 
3476 3476
 					// @deprecated this is deprecated and will be removed in the future.
3477
-					do_action( 'wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->ID, $status_transition['from'] );
3477
+					do_action('wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->ID, $status_transition['from']);
3478 3478
 
3479 3479
 					// Note the transition occurred.
3480
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
3480
+					$this->add_note(trim($status_transition['note'] . ' ' . $transition_note), 0, $status_transition['manual']);
3481 3481
 
3482 3482
 					// Work out if this was for a payment, and trigger a payment_status hook instead.
3483 3483
 					if (
3484
-						in_array( $status_transition['from'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed' ), true )
3485
-						&& in_array( $status_transition['to'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3484
+						in_array($status_transition['from'], array('wpi-cancelled', 'wpi-pending', 'wpi-failed'), true)
3485
+						&& in_array($status_transition['to'], array('publish', 'wpi-processing', 'wpi-renewal'), true)
3486 3486
 					) {
3487
-						do_action( 'getpaid_invoice_payment_status_changed', $this->get_id(), $this, $status_transition );
3487
+						do_action('getpaid_invoice_payment_status_changed', $this->get_id(), $this, $status_transition);
3488 3488
 					}
3489 3489
 				} else {
3490 3490
 					/* translators: %s: new invoice status */
3491
-					$transition_note = sprintf( __( 'Status set to %s.', 'invoicing' ), wpinv_status_nicename( $status_transition['to'] ) );
3491
+					$transition_note = sprintf(__('Status set to %s.', 'invoicing'), wpinv_status_nicename($status_transition['to']));
3492 3492
 
3493 3493
 					// Note the transition occurred.
3494
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
3494
+					$this->add_note(trim($status_transition['note'] . ' ' . $transition_note), 0, $status_transition['manual']);
3495 3495
 
3496 3496
 				}
3497
-			} catch ( Exception $e ) {
3498
-				$this->add_note( __( 'Error during status transition.', 'invoicing' ) . ' ' . $e->getMessage() );
3497
+			} catch (Exception $e) {
3498
+				$this->add_note(__('Error during status transition.', 'invoicing') . ' ' . $e->getMessage());
3499 3499
 			}
3500 3500
 		}
3501 3501
 	}
@@ -3503,13 +3503,13 @@  discard block
 block discarded – undo
3503 3503
 	/**
3504 3504
 	 * Updates an invoice status.
3505 3505
 	 */
3506
-	public function update_status( $new_status = false, $note = '', $manual = false ) {
3506
+	public function update_status($new_status = false, $note = '', $manual = false) {
3507 3507
 
3508 3508
 		// Fires before updating a status.
3509
-		do_action( 'wpinv_before_invoice_status_change', $this->ID, $new_status, $this->get_status( 'edit' ) );
3509
+		do_action('wpinv_before_invoice_status_change', $this->ID, $new_status, $this->get_status('edit'));
3510 3510
 
3511 3511
 		// Update the status.
3512
-		$this->set_status( $new_status, $note, $manual );
3512
+		$this->set_status($new_status, $note, $manual);
3513 3513
 
3514 3514
 		// Save the order.
3515 3515
 		return $this->save();
@@ -3520,18 +3520,18 @@  discard block
 block discarded – undo
3520 3520
 	 * @deprecated
3521 3521
 	 */
3522 3522
 	public function refresh_item_ids() {
3523
-        $item_ids = implode( ',', array_unique( array_keys( $this->get_items() ) ) );
3524
-        update_post_meta( $this->get_id(), '_wpinv_item_ids', $item_ids );
3523
+        $item_ids = implode(',', array_unique(array_keys($this->get_items())));
3524
+        update_post_meta($this->get_id(), '_wpinv_item_ids', $item_ids);
3525 3525
 	}
3526 3526
 
3527 3527
 	/**
3528 3528
 	 * @deprecated
3529 3529
 	 */
3530
-	public function update_items( $temp = false ) {
3530
+	public function update_items($temp = false) {
3531 3531
 
3532
-		$this->set_items( $this->get_items() );
3532
+		$this->set_items($this->get_items());
3533 3533
 
3534
-		if ( ! $temp ) {
3534
+		if (!$temp) {
3535 3535
 			$this->save();
3536 3536
 		}
3537 3537
 
@@ -3545,11 +3545,11 @@  discard block
 block discarded – undo
3545 3545
 
3546 3546
         $discount_code = $this->get_discount_code();
3547 3547
 
3548
-        if ( empty( $discount_code ) ) {
3548
+        if (empty($discount_code)) {
3549 3549
             return false;
3550 3550
         }
3551 3551
 
3552
-        $discount = wpinv_get_discount_obj( $discount_code );
3552
+        $discount = wpinv_get_discount_obj($discount_code);
3553 3553
 
3554 3554
         // Ensure it is active.
3555 3555
         return $discount->exists();
@@ -3560,7 +3560,7 @@  discard block
 block discarded – undo
3560 3560
 	 * Refunds an invoice.
3561 3561
 	 */
3562 3562
     public function refund() {
3563
-		$this->set_status( 'wpi-refunded' );
3563
+		$this->set_status('wpi-refunded');
3564 3564
         $this->save();
3565 3565
     }
3566 3566
 
Please login to merge, or discard this patch.