Passed
Push — master ( 8aff18...2c4223 )
by Brian
06:32
created
includes/class-wpinv-invoice.php 1 patch
Spacing   +790 added lines, -790 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package Invoicing
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Invoice class.
@@ -144,40 +144,40 @@  discard block
 block discarded – undo
144 144
 	 *
145 145
 	 * @param  int|string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, transaction id, number or object to read.
146 146
 	 */
147
-    public function __construct( $invoice = 0 ) {
147
+    public function __construct($invoice = 0) {
148 148
 
149
-        parent::__construct( $invoice );
149
+        parent::__construct($invoice);
150 150
 
151
-		if ( ! empty( $invoice ) && is_numeric( $invoice ) && getpaid_is_invoice_post_type( get_post_type( (int) $invoice ) ) ) {
152
-			$this->set_id( (int) $invoice );
153
-		} elseif ( $invoice instanceof self ) {
154
-			$this->set_id( $invoice->get_id() );
155
-		} elseif ( ! empty( $invoice->ID ) ) {
156
-			$this->set_id( $invoice->ID );
157
-		} elseif ( is_array( $invoice ) ) {
158
-			$this->set_props( $invoice );
151
+		if (!empty($invoice) && is_numeric($invoice) && getpaid_is_invoice_post_type(get_post_type((int) $invoice))) {
152
+			$this->set_id((int) $invoice);
153
+		} elseif ($invoice instanceof self) {
154
+			$this->set_id($invoice->get_id());
155
+		} elseif (!empty($invoice->ID)) {
156
+			$this->set_id($invoice->ID);
157
+		} elseif (is_array($invoice)) {
158
+			$this->set_props($invoice);
159 159
 
160
-			if ( isset( $invoice['ID'] ) ) {
161
-				$this->set_id( $invoice['ID'] );
160
+			if (isset($invoice['ID'])) {
161
+				$this->set_id($invoice['ID']);
162 162
 			}
163 163
 
164
-		} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'key' ) ) {
165
-			$this->set_id( $invoice_id );
166
-		} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'number' ) ) {
167
-			$this->set_id( $invoice_id );
168
-		} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'transaction_id' ) ) {
169
-			$this->set_id( $invoice_id );
164
+		} elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'key')) {
165
+			$this->set_id($invoice_id);
166
+		} elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'number')) {
167
+			$this->set_id($invoice_id);
168
+		} elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'transaction_id')) {
169
+			$this->set_id($invoice_id);
170 170
 		} else {
171
-			$this->set_object_read( true );
171
+			$this->set_object_read(true);
172 172
 		}
173 173
 
174 174
         // Load the datastore.
175
-		$this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
175
+		$this->data_store = GetPaid_Data_Store::load($this->data_store_name);
176 176
 
177
-		if ( $this->get_id() > 0 ) {
178
-            $this->post = get_post( $this->get_id() );
177
+		if ($this->get_id() > 0) {
178
+            $this->post = get_post($this->get_id());
179 179
             $this->ID   = $this->get_id();
180
-			$this->data_store->read( $this );
180
+			$this->data_store->read($this);
181 181
         }
182 182
 
183 183
     }
@@ -192,38 +192,38 @@  discard block
 block discarded – undo
192 192
 	 * @since 1.0.15
193 193
 	 * @return int
194 194
 	 */
195
-	public static function get_invoice_id_by_field( $value, $field = 'key' ) {
195
+	public static function get_invoice_id_by_field($value, $field = 'key') {
196 196
         global $wpdb;
197 197
 
198 198
 		// Trim the value.
199
-		$value = trim( $value );
199
+		$value = trim($value);
200 200
 
201
-		if ( empty( $value ) ) {
201
+		if (empty($value)) {
202 202
 			return 0;
203 203
 		}
204 204
 
205 205
         // Valid fields.
206
-        $fields = array( 'key', 'number', 'transaction_id' );
206
+        $fields = array('key', 'number', 'transaction_id');
207 207
 
208 208
 		// Ensure a field has been passed.
209
-		if ( empty( $field ) || ! in_array( $field, $fields ) ) {
209
+		if (empty($field) || !in_array($field, $fields)) {
210 210
 			return 0;
211 211
 		}
212 212
 
213 213
 		// Maybe retrieve from the cache.
214
-		$invoice_id   = wp_cache_get( $value, "getpaid_invoice_{$field}s_to_invoice_ids" );
215
-		if ( false !== $invoice_id ) {
214
+		$invoice_id = wp_cache_get($value, "getpaid_invoice_{$field}s_to_invoice_ids");
215
+		if (false !== $invoice_id) {
216 216
 			return $invoice_id;
217 217
 		}
218 218
 
219 219
         // Fetch from the db.
220 220
         $table       = $wpdb->prefix . 'getpaid_invoices';
221 221
         $invoice_id  = (int) $wpdb->get_var(
222
-            $wpdb->prepare( "SELECT `post_id` FROM $table WHERE `$field`=%s LIMIT 1", $value )
222
+            $wpdb->prepare("SELECT `post_id` FROM $table WHERE `$field`=%s LIMIT 1", $value)
223 223
         );
224 224
 
225 225
 		// Update the cache with our data
226
-		wp_cache_set( $value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids" );
226
+		wp_cache_set($value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids");
227 227
 
228 228
 		return $invoice_id;
229 229
     }
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
     /**
232 232
      * Checks if an invoice key is set.
233 233
      */
234
-    public function _isset( $key ) {
235
-        return isset( $this->data[$key] ) || method_exists( $this, "get_$key" );
234
+    public function _isset($key) {
235
+        return isset($this->data[$key]) || method_exists($this, "get_$key");
236 236
     }
237 237
 
238 238
     /*
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
 	 * @param  string $context View or edit context.
258 258
 	 * @return int
259 259
 	 */
260
-	public function get_parent_id( $context = 'view' ) {
261
-		return (int) $this->get_prop( 'parent_id', $context );
260
+	public function get_parent_id($context = 'view') {
261
+		return (int) $this->get_prop('parent_id', $context);
262 262
     }
263 263
 
264 264
     /**
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	 * @return WPInv_Invoice
269 269
 	 */
270 270
     public function get_parent_payment() {
271
-        return new WPInv_Invoice( $this->get_parent_id() );
271
+        return new WPInv_Invoice($this->get_parent_id());
272 272
     }
273 273
 
274 274
     /**
@@ -288,8 +288,8 @@  discard block
 block discarded – undo
288 288
 	 * @param  string $context View or edit context.
289 289
 	 * @return string
290 290
 	 */
291
-	public function get_status( $context = 'view' ) {
292
-		return $this->get_prop( 'status', $context );
291
+	public function get_status($context = 'view') {
292
+		return $this->get_prop('status', $context);
293 293
 	}
294 294
 	
295 295
 	/**
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 * @return array
300 300
 	 */
301 301
 	public function get_all_statuses() {
302
-		return wpinv_get_invoice_statuses( true, true, $this );
302
+		return wpinv_get_invoice_statuses(true, true, $this);
303 303
     }
304 304
 
305 305
     /**
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
     public function get_status_nicename() {
312 312
 		$statuses = $this->get_all_statuses();
313 313
 
314
-        $status = isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : $this->get_status();
314
+        $status = isset($statuses[$this->get_status()]) ? $statuses[$this->get_status()] : $this->get_status();
315 315
 
316
-        return apply_filters( 'wpinv_get_invoice_status_nicename', $status, $this );
316
+        return apply_filters('wpinv_get_invoice_status_nicename', $status, $this);
317 317
     }
318 318
 
319 319
 	/**
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	 */
325 325
 	public function get_status_class() {
326 326
 		$statuses = getpaid_get_invoice_status_classes();
327
-		return isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : 'badge-dark';
327
+		return isset($statuses[$this->get_status()]) ? $statuses[$this->get_status()] : 'badge-dark';
328 328
 	}
329 329
 
330 330
 	/**
@@ -335,9 +335,9 @@  discard block
 block discarded – undo
335 335
      */
336 336
     public function get_status_label_html() {
337 337
 
338
-		$status_label = sanitize_text_field( $this->get_status_nicename() );
339
-		$status       = sanitize_html_class( $this->get_status() );
340
-		$class        = esc_attr( $this->get_status_class() );
338
+		$status_label = sanitize_text_field($this->get_status_nicename());
339
+		$status       = sanitize_html_class($this->get_status());
340
+		$class        = esc_attr($this->get_status_class());
341 341
 
342 342
 		return "<span class='bsui'><span class='badge $class $status'>$status_label</span></span>";
343 343
 	}
@@ -349,23 +349,23 @@  discard block
 block discarded – undo
349 349
 	 * @param  string $context View or edit context.
350 350
 	 * @return string
351 351
 	 */
352
-	public function get_version( $context = 'view' ) {
353
-		return $this->get_prop( 'version', $context );
352
+	public function get_version($context = 'view') {
353
+		return $this->get_prop('version', $context);
354 354
 	}
355 355
 
356 356
 	/**
357 357
 	 * @deprecated
358 358
 	 */
359
-	public function get_invoice_date( $format = true ) {
360
-		$date      = getpaid_format_date( $this->get_date_completed() );
361
-		$date      = empty( $date ) ? $this->get_date_created() : $this->get_date_completed();
362
-		$formatted = getpaid_format_date( $date );
359
+	public function get_invoice_date($format = true) {
360
+		$date      = getpaid_format_date($this->get_date_completed());
361
+		$date      = empty($date) ? $this->get_date_created() : $this->get_date_completed();
362
+		$formatted = getpaid_format_date($date);
363 363
 
364
-		if ( $format ) {
364
+		if ($format) {
365 365
 			return $formatted;
366 366
 		}
367 367
 
368
-		return empty( $formatted ) ? '' : $date;
368
+		return empty($formatted) ? '' : $date;
369 369
 
370 370
     }
371 371
 
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
 	 * @param  string $context View or edit context.
377 377
 	 * @return string
378 378
 	 */
379
-	public function get_date_created( $context = 'view' ) {
380
-		return $this->get_prop( 'date_created', $context );
379
+	public function get_date_created($context = 'view') {
380
+		return $this->get_prop('date_created', $context);
381 381
 	}
382 382
 	
383 383
 	/**
@@ -387,8 +387,8 @@  discard block
 block discarded – undo
387 387
 	 * @param  string $context View or edit context.
388 388
 	 * @return string
389 389
 	 */
390
-	public function get_created_date( $context = 'view' ) {
391
-		return $this->get_date_created( $context );
390
+	public function get_created_date($context = 'view') {
391
+		return $this->get_date_created($context);
392 392
     }
393 393
 
394 394
     /**
@@ -398,11 +398,11 @@  discard block
 block discarded – undo
398 398
 	 * @param  string $context View or edit context.
399 399
 	 * @return string
400 400
 	 */
401
-	public function get_date_created_gmt( $context = 'view' ) {
402
-        $date = $this->get_date_created( $context );
401
+	public function get_date_created_gmt($context = 'view') {
402
+        $date = $this->get_date_created($context);
403 403
 
404
-        if ( $date ) {
405
-            $date = get_gmt_from_date( $date );
404
+        if ($date) {
405
+            $date = get_gmt_from_date($date);
406 406
         }
407 407
 		return $date;
408 408
     }
@@ -414,8 +414,8 @@  discard block
 block discarded – undo
414 414
 	 * @param  string $context View or edit context.
415 415
 	 * @return string
416 416
 	 */
417
-	public function get_date_modified( $context = 'view' ) {
418
-		return $this->get_prop( 'date_modified', $context );
417
+	public function get_date_modified($context = 'view') {
418
+		return $this->get_prop('date_modified', $context);
419 419
 	}
420 420
 
421 421
 	/**
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
 	 * @param  string $context View or edit context.
426 426
 	 * @return string
427 427
 	 */
428
-	public function get_modified_date( $context = 'view' ) {
429
-		return $this->get_date_modified( $context );
428
+	public function get_modified_date($context = 'view') {
429
+		return $this->get_date_modified($context);
430 430
     }
431 431
 
432 432
     /**
@@ -436,11 +436,11 @@  discard block
 block discarded – undo
436 436
 	 * @param  string $context View or edit context.
437 437
 	 * @return string
438 438
 	 */
439
-	public function get_date_modified_gmt( $context = 'view' ) {
440
-        $date = $this->get_date_modified( $context );
439
+	public function get_date_modified_gmt($context = 'view') {
440
+        $date = $this->get_date_modified($context);
441 441
 
442
-        if ( $date ) {
443
-            $date = get_gmt_from_date( $date );
442
+        if ($date) {
443
+            $date = get_gmt_from_date($date);
444 444
         }
445 445
 		return $date;
446 446
     }
@@ -452,8 +452,8 @@  discard block
 block discarded – undo
452 452
 	 * @param  string $context View or edit context.
453 453
 	 * @return string
454 454
 	 */
455
-	public function get_due_date( $context = 'view' ) {
456
-		return $this->get_prop( 'due_date', $context );
455
+	public function get_due_date($context = 'view') {
456
+		return $this->get_prop('due_date', $context);
457 457
     }
458 458
 
459 459
     /**
@@ -463,8 +463,8 @@  discard block
 block discarded – undo
463 463
 	 * @param  string $context View or edit context.
464 464
 	 * @return string
465 465
 	 */
466
-	public function get_date_due( $context = 'view' ) {
467
-		return $this->get_due_date( $context );
466
+	public function get_date_due($context = 'view') {
467
+		return $this->get_due_date($context);
468 468
     }
469 469
 
470 470
     /**
@@ -474,11 +474,11 @@  discard block
 block discarded – undo
474 474
 	 * @param  string $context View or edit context.
475 475
 	 * @return string
476 476
 	 */
477
-	public function get_due_date_gmt( $context = 'view' ) {
478
-        $date = $this->get_due_date( $context );
477
+	public function get_due_date_gmt($context = 'view') {
478
+        $date = $this->get_due_date($context);
479 479
 
480
-        if ( $date ) {
481
-            $date = get_gmt_from_date( $date );
480
+        if ($date) {
481
+            $date = get_gmt_from_date($date);
482 482
         }
483 483
 		return $date;
484 484
     }
@@ -490,8 +490,8 @@  discard block
 block discarded – undo
490 490
 	 * @param  string $context View or edit context.
491 491
 	 * @return string
492 492
 	 */
493
-	public function get_gmt_date_due( $context = 'view' ) {
494
-		return $this->get_due_date_gmt( $context );
493
+	public function get_gmt_date_due($context = 'view') {
494
+		return $this->get_due_date_gmt($context);
495 495
     }
496 496
 
497 497
     /**
@@ -501,8 +501,8 @@  discard block
 block discarded – undo
501 501
 	 * @param  string $context View or edit context.
502 502
 	 * @return string
503 503
 	 */
504
-	public function get_completed_date( $context = 'view' ) {
505
-		return $this->get_prop( 'completed_date', $context );
504
+	public function get_completed_date($context = 'view') {
505
+		return $this->get_prop('completed_date', $context);
506 506
     }
507 507
 
508 508
     /**
@@ -512,8 +512,8 @@  discard block
 block discarded – undo
512 512
 	 * @param  string $context View or edit context.
513 513
 	 * @return string
514 514
 	 */
515
-	public function get_date_completed( $context = 'view' ) {
516
-		return $this->get_completed_date( $context );
515
+	public function get_date_completed($context = 'view') {
516
+		return $this->get_completed_date($context);
517 517
     }
518 518
 
519 519
     /**
@@ -523,11 +523,11 @@  discard block
 block discarded – undo
523 523
 	 * @param  string $context View or edit context.
524 524
 	 * @return string
525 525
 	 */
526
-	public function get_completed_date_gmt( $context = 'view' ) {
527
-        $date = $this->get_completed_date( $context );
526
+	public function get_completed_date_gmt($context = 'view') {
527
+        $date = $this->get_completed_date($context);
528 528
 
529
-        if ( $date ) {
530
-            $date = get_gmt_from_date( $date );
529
+        if ($date) {
530
+            $date = get_gmt_from_date($date);
531 531
         }
532 532
 		return $date;
533 533
     }
@@ -539,8 +539,8 @@  discard block
 block discarded – undo
539 539
 	 * @param  string $context View or edit context.
540 540
 	 * @return string
541 541
 	 */
542
-	public function get_gmt_completed_date( $context = 'view' ) {
543
-		return $this->get_completed_date_gmt( $context );
542
+	public function get_gmt_completed_date($context = 'view') {
543
+		return $this->get_completed_date_gmt($context);
544 544
     }
545 545
 
546 546
     /**
@@ -550,12 +550,12 @@  discard block
 block discarded – undo
550 550
 	 * @param  string $context View or edit context.
551 551
 	 * @return string
552 552
 	 */
553
-	public function get_number( $context = 'view' ) {
554
-		$number = $this->get_prop( 'number', $context );
553
+	public function get_number($context = 'view') {
554
+		$number = $this->get_prop('number', $context);
555 555
 
556
-		if ( empty( $number ) ) {
556
+		if (empty($number)) {
557 557
 			$number = $this->generate_number();
558
-			$this->set_number( $this->generate_number() );
558
+			$this->set_number($this->generate_number());
559 559
 		}
560 560
 
561 561
 		return $number;
@@ -569,8 +569,8 @@  discard block
 block discarded – undo
569 569
 	public function maybe_set_number() {
570 570
         $number = $this->get_number();
571 571
 
572
-        if ( empty( $number ) || $this->get_id() == $number ) {
573
-			$this->set_number( $this->generate_number() );
572
+        if (empty($number) || $this->get_id() == $number) {
573
+			$this->set_number($this->generate_number());
574 574
         }
575 575
 
576 576
 	}
@@ -582,8 +582,8 @@  discard block
 block discarded – undo
582 582
 	 * @param  string $context View or edit context.
583 583
 	 * @return string
584 584
 	 */
585
-	public function get_key( $context = 'view' ) {
586
-        return $this->get_prop( 'key', $context );
585
+	public function get_key($context = 'view') {
586
+        return $this->get_prop('key', $context);
587 587
 	}
588 588
 
589 589
 	/**
@@ -594,9 +594,9 @@  discard block
 block discarded – undo
594 594
 	public function maybe_set_key() {
595 595
         $key = $this->get_key();
596 596
 
597
-        if ( empty( $key ) ) {
598
-            $key = $this->generate_key( $this->get_type() . '_' );
599
-            $this->set_key( $key );
597
+        if (empty($key)) {
598
+            $key = $this->generate_key($this->get_type() . '_');
599
+            $this->set_key($key);
600 600
         }
601 601
 
602 602
     }
@@ -608,8 +608,8 @@  discard block
 block discarded – undo
608 608
 	 * @param  string $context View or edit context.
609 609
 	 * @return string
610 610
 	 */
611
-	public function get_type( $context = 'view' ) {
612
-        return $this->get_prop( 'type', $context );
611
+	public function get_type($context = 'view') {
612
+        return $this->get_prop('type', $context);
613 613
 	}
614 614
 
615 615
 	/**
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 	 * @return string
620 620
 	 */
621 621
 	public function get_invoice_quote_type() {
622
-        return getpaid_get_post_type_label( $this->get_post_type(), false );
622
+        return getpaid_get_post_type_label($this->get_post_type(), false);
623 623
     }
624 624
 
625 625
     /**
@@ -629,8 +629,8 @@  discard block
 block discarded – undo
629 629
 	 * @param  string $context View or edit context.
630 630
 	 * @return string
631 631
 	 */
632
-	public function get_label( $context = 'view' ) {
633
-        return getpaid_get_post_type_label( $this->get_post_type( $context ), false );
632
+	public function get_label($context = 'view') {
633
+        return getpaid_get_post_type_label($this->get_post_type($context), false);
634 634
 	}
635 635
 
636 636
 	/**
@@ -640,8 +640,8 @@  discard block
 block discarded – undo
640 640
 	 * @param  string $context View or edit context.
641 641
 	 * @return string
642 642
 	 */
643
-	public function get_post_type( $context = 'view' ) {
644
-        return $this->get_prop( 'post_type', $context );
643
+	public function get_post_type($context = 'view') {
644
+        return $this->get_prop('post_type', $context);
645 645
     }
646 646
 
647 647
     /**
@@ -651,8 +651,8 @@  discard block
 block discarded – undo
651 651
 	 * @param  string $context View or edit context.
652 652
 	 * @return string
653 653
 	 */
654
-	public function get_mode( $context = 'view' ) {
655
-        return $this->get_prop( 'mode', $context );
654
+	public function get_mode($context = 'view') {
655
+        return $this->get_prop('mode', $context);
656 656
     }
657 657
 
658 658
     /**
@@ -662,13 +662,13 @@  discard block
 block discarded – undo
662 662
 	 * @param  string $context View or edit context.
663 663
 	 * @return string
664 664
 	 */
665
-	public function get_path( $context = 'view' ) {
666
-        $path   = $this->get_prop( 'path', $context );
665
+	public function get_path($context = 'view') {
666
+        $path = $this->get_prop('path', $context);
667 667
 		$prefix = $this->get_type();
668 668
 
669
-		if ( 0 !== strpos( $path, $prefix ) ) {
670
-			$path = sanitize_title(  $prefix . '-' . $this->get_id()  );
671
-			$this->set_path( $path );
669
+		if (0 !== strpos($path, $prefix)) {
670
+			$path = sanitize_title($prefix . '-' . $this->get_id());
671
+			$this->set_path($path);
672 672
 		}
673 673
 
674 674
 		return $path;
@@ -681,8 +681,8 @@  discard block
 block discarded – undo
681 681
 	 * @param  string $context View or edit context.
682 682
 	 * @return string
683 683
 	 */
684
-	public function get_name( $context = 'view' ) {
685
-        return $this->get_prop( 'title', $context );
684
+	public function get_name($context = 'view') {
685
+        return $this->get_prop('title', $context);
686 686
     }
687 687
 
688 688
     /**
@@ -692,8 +692,8 @@  discard block
 block discarded – undo
692 692
 	 * @param  string $context View or edit context.
693 693
 	 * @return string
694 694
 	 */
695
-	public function get_title( $context = 'view' ) {
696
-		return $this->get_name( $context );
695
+	public function get_title($context = 'view') {
696
+		return $this->get_name($context);
697 697
     }
698 698
 
699 699
     /**
@@ -703,8 +703,8 @@  discard block
 block discarded – undo
703 703
 	 * @param  string $context View or edit context.
704 704
 	 * @return string
705 705
 	 */
706
-	public function get_description( $context = 'view' ) {
707
-		return $this->get_prop( 'description', $context );
706
+	public function get_description($context = 'view') {
707
+		return $this->get_prop('description', $context);
708 708
     }
709 709
 
710 710
     /**
@@ -714,8 +714,8 @@  discard block
 block discarded – undo
714 714
 	 * @param  string $context View or edit context.
715 715
 	 * @return string
716 716
 	 */
717
-	public function get_excerpt( $context = 'view' ) {
718
-		return $this->get_description( $context );
717
+	public function get_excerpt($context = 'view') {
718
+		return $this->get_description($context);
719 719
     }
720 720
 
721 721
     /**
@@ -725,8 +725,8 @@  discard block
 block discarded – undo
725 725
 	 * @param  string $context View or edit context.
726 726
 	 * @return string
727 727
 	 */
728
-	public function get_summary( $context = 'view' ) {
729
-		return $this->get_description( $context );
728
+	public function get_summary($context = 'view') {
729
+		return $this->get_description($context);
730 730
     }
731 731
 
732 732
     /**
@@ -736,26 +736,26 @@  discard block
 block discarded – undo
736 736
      * @param  string $context View or edit context.
737 737
 	 * @return array
738 738
 	 */
739
-    public function get_user_info( $context = 'view' ) {
739
+    public function get_user_info($context = 'view') {
740 740
 
741 741
         $user_info = array(
742
-            'user_id'    => $this->get_user_id( $context ),
743
-            'email'      => $this->get_email( $context ),
744
-            'first_name' => $this->get_first_name( $context ),
745
-            'last_name'  => $this->get_last_name( $context ),
746
-            'address'    => $this->get_address( $context ),
747
-            'phone'      => $this->get_phone( $context ),
748
-            'city'       => $this->get_city( $context ),
749
-            'country'    => $this->get_country( $context ),
750
-            'state'      => $this->get_state( $context ),
751
-            'zip'        => $this->get_zip( $context ),
752
-            'company'    => $this->get_company( $context ),
753
-			'company_id' => $this->get_company_id( $context ),
754
-            'vat_number' => $this->get_vat_number( $context ),
755
-            'discount'   => $this->get_discount_code( $context ),
742
+            'user_id'    => $this->get_user_id($context),
743
+            'email'      => $this->get_email($context),
744
+            'first_name' => $this->get_first_name($context),
745
+            'last_name'  => $this->get_last_name($context),
746
+            'address'    => $this->get_address($context),
747
+            'phone'      => $this->get_phone($context),
748
+            'city'       => $this->get_city($context),
749
+            'country'    => $this->get_country($context),
750
+            'state'      => $this->get_state($context),
751
+            'zip'        => $this->get_zip($context),
752
+            'company'    => $this->get_company($context),
753
+			'company_id' => $this->get_company_id($context),
754
+            'vat_number' => $this->get_vat_number($context),
755
+            'discount'   => $this->get_discount_code($context),
756 756
 		);
757 757
 
758
-		return apply_filters( 'wpinv_user_info', $user_info, $this->get_id(), $this );
758
+		return apply_filters('wpinv_user_info', $user_info, $this->get_id(), $this);
759 759
 
760 760
     }
761 761
 
@@ -766,8 +766,8 @@  discard block
 block discarded – undo
766 766
 	 * @param  string $context View or edit context.
767 767
 	 * @return int
768 768
 	 */
769
-	public function get_author( $context = 'view' ) {
770
-		return (int) $this->get_prop( 'author', $context );
769
+	public function get_author($context = 'view') {
770
+		return (int) $this->get_prop('author', $context);
771 771
     }
772 772
 
773 773
     /**
@@ -777,8 +777,8 @@  discard block
 block discarded – undo
777 777
 	 * @param  string $context View or edit context.
778 778
 	 * @return int
779 779
 	 */
780
-	public function get_user_id( $context = 'view' ) {
781
-		return $this->get_author( $context );
780
+	public function get_user_id($context = 'view') {
781
+		return $this->get_author($context);
782 782
     }
783 783
 
784 784
      /**
@@ -788,8 +788,8 @@  discard block
 block discarded – undo
788 788
 	 * @param  string $context View or edit context.
789 789
 	 * @return int
790 790
 	 */
791
-	public function get_customer_id( $context = 'view' ) {
792
-		return $this->get_author( $context );
791
+	public function get_customer_id($context = 'view') {
792
+		return $this->get_author($context);
793 793
     }
794 794
 
795 795
     /**
@@ -799,8 +799,8 @@  discard block
 block discarded – undo
799 799
 	 * @param  string $context View or edit context.
800 800
 	 * @return string
801 801
 	 */
802
-	public function get_ip( $context = 'view' ) {
803
-		return $this->get_prop( 'user_ip', $context );
802
+	public function get_ip($context = 'view') {
803
+		return $this->get_prop('user_ip', $context);
804 804
     }
805 805
 
806 806
     /**
@@ -810,8 +810,8 @@  discard block
 block discarded – undo
810 810
 	 * @param  string $context View or edit context.
811 811
 	 * @return string
812 812
 	 */
813
-	public function get_user_ip( $context = 'view' ) {
814
-		return $this->get_ip( $context );
813
+	public function get_user_ip($context = 'view') {
814
+		return $this->get_ip($context);
815 815
     }
816 816
 
817 817
      /**
@@ -821,8 +821,8 @@  discard block
 block discarded – undo
821 821
 	 * @param  string $context View or edit context.
822 822
 	 * @return string
823 823
 	 */
824
-	public function get_customer_ip( $context = 'view' ) {
825
-		return $this->get_ip( $context );
824
+	public function get_customer_ip($context = 'view') {
825
+		return $this->get_ip($context);
826 826
     }
827 827
 
828 828
     /**
@@ -832,8 +832,8 @@  discard block
 block discarded – undo
832 832
 	 * @param  string $context View or edit context.
833 833
 	 * @return string
834 834
 	 */
835
-	public function get_first_name( $context = 'view' ) {
836
-		return $this->get_prop( 'first_name', $context );
835
+	public function get_first_name($context = 'view') {
836
+		return $this->get_prop('first_name', $context);
837 837
     }
838 838
 
839 839
     /**
@@ -843,8 +843,8 @@  discard block
 block discarded – undo
843 843
 	 * @param  string $context View or edit context.
844 844
 	 * @return string
845 845
 	 */
846
-	public function get_user_first_name( $context = 'view' ) {
847
-		return $this->get_first_name( $context );
846
+	public function get_user_first_name($context = 'view') {
847
+		return $this->get_first_name($context);
848 848
     }
849 849
 
850 850
      /**
@@ -854,8 +854,8 @@  discard block
 block discarded – undo
854 854
 	 * @param  string $context View or edit context.
855 855
 	 * @return string
856 856
 	 */
857
-	public function get_customer_first_name( $context = 'view' ) {
858
-		return $this->get_first_name( $context );
857
+	public function get_customer_first_name($context = 'view') {
858
+		return $this->get_first_name($context);
859 859
     }
860 860
 
861 861
     /**
@@ -865,8 +865,8 @@  discard block
 block discarded – undo
865 865
 	 * @param  string $context View or edit context.
866 866
 	 * @return string
867 867
 	 */
868
-	public function get_last_name( $context = 'view' ) {
869
-		return $this->get_prop( 'last_name', $context );
868
+	public function get_last_name($context = 'view') {
869
+		return $this->get_prop('last_name', $context);
870 870
     }
871 871
 
872 872
     /**
@@ -876,8 +876,8 @@  discard block
 block discarded – undo
876 876
 	 * @param  string $context View or edit context.
877 877
 	 * @return string
878 878
 	 */
879
-	public function get_user_last_name( $context = 'view' ) {
880
-		return $this->get_last_name( $context );
879
+	public function get_user_last_name($context = 'view') {
880
+		return $this->get_last_name($context);
881 881
     }
882 882
 
883 883
     /**
@@ -887,8 +887,8 @@  discard block
 block discarded – undo
887 887
 	 * @param  string $context View or edit context.
888 888
 	 * @return string
889 889
 	 */
890
-	public function get_customer_last_name( $context = 'view' ) {
891
-		return $this->get_last_name( $context );
890
+	public function get_customer_last_name($context = 'view') {
891
+		return $this->get_last_name($context);
892 892
     }
893 893
 
894 894
     /**
@@ -898,8 +898,8 @@  discard block
 block discarded – undo
898 898
 	 * @param  string $context View or edit context.
899 899
 	 * @return string
900 900
 	 */
901
-	public function get_full_name( $context = 'view' ) {
902
-		return trim( $this->get_first_name( $context ) . ' ' . $this->get_last_name( $context ) );
901
+	public function get_full_name($context = 'view') {
902
+		return trim($this->get_first_name($context) . ' ' . $this->get_last_name($context));
903 903
     }
904 904
 
905 905
     /**
@@ -909,8 +909,8 @@  discard block
 block discarded – undo
909 909
 	 * @param  string $context View or edit context.
910 910
 	 * @return string
911 911
 	 */
912
-	public function get_user_full_name( $context = 'view' ) {
913
-		return $this->get_full_name( $context );
912
+	public function get_user_full_name($context = 'view') {
913
+		return $this->get_full_name($context);
914 914
     }
915 915
 
916 916
     /**
@@ -920,8 +920,8 @@  discard block
 block discarded – undo
920 920
 	 * @param  string $context View or edit context.
921 921
 	 * @return string
922 922
 	 */
923
-	public function get_customer_full_name( $context = 'view' ) {
924
-		return $this->get_full_name( $context );
923
+	public function get_customer_full_name($context = 'view') {
924
+		return $this->get_full_name($context);
925 925
     }
926 926
 
927 927
     /**
@@ -931,8 +931,8 @@  discard block
 block discarded – undo
931 931
 	 * @param  string $context View or edit context.
932 932
 	 * @return string
933 933
 	 */
934
-	public function get_phone( $context = 'view' ) {
935
-		return $this->get_prop( 'phone', $context );
934
+	public function get_phone($context = 'view') {
935
+		return $this->get_prop('phone', $context);
936 936
     }
937 937
 
938 938
     /**
@@ -942,8 +942,8 @@  discard block
 block discarded – undo
942 942
 	 * @param  string $context View or edit context.
943 943
 	 * @return string
944 944
 	 */
945
-	public function get_phone_number( $context = 'view' ) {
946
-		return $this->get_phone( $context );
945
+	public function get_phone_number($context = 'view') {
946
+		return $this->get_phone($context);
947 947
     }
948 948
 
949 949
     /**
@@ -953,8 +953,8 @@  discard block
 block discarded – undo
953 953
 	 * @param  string $context View or edit context.
954 954
 	 * @return string
955 955
 	 */
956
-	public function get_user_phone( $context = 'view' ) {
957
-		return $this->get_phone( $context );
956
+	public function get_user_phone($context = 'view') {
957
+		return $this->get_phone($context);
958 958
     }
959 959
 
960 960
     /**
@@ -964,8 +964,8 @@  discard block
 block discarded – undo
964 964
 	 * @param  string $context View or edit context.
965 965
 	 * @return string
966 966
 	 */
967
-	public function get_customer_phone( $context = 'view' ) {
968
-		return $this->get_phone( $context );
967
+	public function get_customer_phone($context = 'view') {
968
+		return $this->get_phone($context);
969 969
     }
970 970
 
971 971
     /**
@@ -975,8 +975,8 @@  discard block
 block discarded – undo
975 975
 	 * @param  string $context View or edit context.
976 976
 	 * @return string
977 977
 	 */
978
-	public function get_email( $context = 'view' ) {
979
-		return $this->get_prop( 'email', $context );
978
+	public function get_email($context = 'view') {
979
+		return $this->get_prop('email', $context);
980 980
     }
981 981
 
982 982
     /**
@@ -986,8 +986,8 @@  discard block
 block discarded – undo
986 986
 	 * @param  string $context View or edit context.
987 987
 	 * @return string
988 988
 	 */
989
-	public function get_email_address( $context = 'view' ) {
990
-		return $this->get_email( $context );
989
+	public function get_email_address($context = 'view') {
990
+		return $this->get_email($context);
991 991
     }
992 992
 
993 993
     /**
@@ -997,8 +997,8 @@  discard block
 block discarded – undo
997 997
 	 * @param  string $context View or edit context.
998 998
 	 * @return string
999 999
 	 */
1000
-	public function get_user_email( $context = 'view' ) {
1001
-		return $this->get_email( $context );
1000
+	public function get_user_email($context = 'view') {
1001
+		return $this->get_email($context);
1002 1002
     }
1003 1003
 
1004 1004
     /**
@@ -1008,8 +1008,8 @@  discard block
 block discarded – undo
1008 1008
 	 * @param  string $context View or edit context.
1009 1009
 	 * @return string
1010 1010
 	 */
1011
-	public function get_customer_email( $context = 'view' ) {
1012
-		return $this->get_email( $context );
1011
+	public function get_customer_email($context = 'view') {
1012
+		return $this->get_email($context);
1013 1013
     }
1014 1014
 
1015 1015
     /**
@@ -1019,9 +1019,9 @@  discard block
 block discarded – undo
1019 1019
 	 * @param  string $context View or edit context.
1020 1020
 	 * @return string
1021 1021
 	 */
1022
-	public function get_country( $context = 'view' ) {
1023
-		$country = $this->get_prop( 'country', $context );
1024
-		return empty( $country ) ? wpinv_get_default_country() : $country;
1022
+	public function get_country($context = 'view') {
1023
+		$country = $this->get_prop('country', $context);
1024
+		return empty($country) ? wpinv_get_default_country() : $country;
1025 1025
     }
1026 1026
 
1027 1027
     /**
@@ -1031,8 +1031,8 @@  discard block
 block discarded – undo
1031 1031
 	 * @param  string $context View or edit context.
1032 1032
 	 * @return string
1033 1033
 	 */
1034
-	public function get_user_country( $context = 'view' ) {
1035
-		return $this->get_country( $context );
1034
+	public function get_user_country($context = 'view') {
1035
+		return $this->get_country($context);
1036 1036
     }
1037 1037
 
1038 1038
     /**
@@ -1042,8 +1042,8 @@  discard block
 block discarded – undo
1042 1042
 	 * @param  string $context View or edit context.
1043 1043
 	 * @return string
1044 1044
 	 */
1045
-	public function get_customer_country( $context = 'view' ) {
1046
-		return $this->get_country( $context );
1045
+	public function get_customer_country($context = 'view') {
1046
+		return $this->get_country($context);
1047 1047
     }
1048 1048
 
1049 1049
     /**
@@ -1053,9 +1053,9 @@  discard block
 block discarded – undo
1053 1053
 	 * @param  string $context View or edit context.
1054 1054
 	 * @return string
1055 1055
 	 */
1056
-	public function get_state( $context = 'view' ) {
1057
-		$state = $this->get_prop( 'state', $context );
1058
-		return empty( $state ) ? wpinv_get_default_state() : $state;
1056
+	public function get_state($context = 'view') {
1057
+		$state = $this->get_prop('state', $context);
1058
+		return empty($state) ? wpinv_get_default_state() : $state;
1059 1059
     }
1060 1060
 
1061 1061
     /**
@@ -1065,8 +1065,8 @@  discard block
 block discarded – undo
1065 1065
 	 * @param  string $context View or edit context.
1066 1066
 	 * @return string
1067 1067
 	 */
1068
-	public function get_user_state( $context = 'view' ) {
1069
-		return $this->get_state( $context );
1068
+	public function get_user_state($context = 'view') {
1069
+		return $this->get_state($context);
1070 1070
     }
1071 1071
 
1072 1072
     /**
@@ -1076,8 +1076,8 @@  discard block
 block discarded – undo
1076 1076
 	 * @param  string $context View or edit context.
1077 1077
 	 * @return string
1078 1078
 	 */
1079
-	public function get_customer_state( $context = 'view' ) {
1080
-		return $this->get_state( $context );
1079
+	public function get_customer_state($context = 'view') {
1080
+		return $this->get_state($context);
1081 1081
     }
1082 1082
 
1083 1083
     /**
@@ -1087,8 +1087,8 @@  discard block
 block discarded – undo
1087 1087
 	 * @param  string $context View or edit context.
1088 1088
 	 * @return string
1089 1089
 	 */
1090
-	public function get_city( $context = 'view' ) {
1091
-		return $this->get_prop( 'city', $context );
1090
+	public function get_city($context = 'view') {
1091
+		return $this->get_prop('city', $context);
1092 1092
     }
1093 1093
 
1094 1094
     /**
@@ -1098,8 +1098,8 @@  discard block
 block discarded – undo
1098 1098
 	 * @param  string $context View or edit context.
1099 1099
 	 * @return string
1100 1100
 	 */
1101
-	public function get_user_city( $context = 'view' ) {
1102
-		return $this->get_city( $context );
1101
+	public function get_user_city($context = 'view') {
1102
+		return $this->get_city($context);
1103 1103
     }
1104 1104
 
1105 1105
     /**
@@ -1109,8 +1109,8 @@  discard block
 block discarded – undo
1109 1109
 	 * @param  string $context View or edit context.
1110 1110
 	 * @return string
1111 1111
 	 */
1112
-	public function get_customer_city( $context = 'view' ) {
1113
-		return $this->get_city( $context );
1112
+	public function get_customer_city($context = 'view') {
1113
+		return $this->get_city($context);
1114 1114
     }
1115 1115
 
1116 1116
     /**
@@ -1120,8 +1120,8 @@  discard block
 block discarded – undo
1120 1120
 	 * @param  string $context View or edit context.
1121 1121
 	 * @return string
1122 1122
 	 */
1123
-	public function get_zip( $context = 'view' ) {
1124
-		return $this->get_prop( 'zip', $context );
1123
+	public function get_zip($context = 'view') {
1124
+		return $this->get_prop('zip', $context);
1125 1125
     }
1126 1126
 
1127 1127
     /**
@@ -1131,8 +1131,8 @@  discard block
 block discarded – undo
1131 1131
 	 * @param  string $context View or edit context.
1132 1132
 	 * @return string
1133 1133
 	 */
1134
-	public function get_user_zip( $context = 'view' ) {
1135
-		return $this->get_zip( $context );
1134
+	public function get_user_zip($context = 'view') {
1135
+		return $this->get_zip($context);
1136 1136
     }
1137 1137
 
1138 1138
     /**
@@ -1142,8 +1142,8 @@  discard block
 block discarded – undo
1142 1142
 	 * @param  string $context View or edit context.
1143 1143
 	 * @return string
1144 1144
 	 */
1145
-	public function get_customer_zip( $context = 'view' ) {
1146
-		return $this->get_zip( $context );
1145
+	public function get_customer_zip($context = 'view') {
1146
+		return $this->get_zip($context);
1147 1147
     }
1148 1148
 
1149 1149
     /**
@@ -1153,8 +1153,8 @@  discard block
 block discarded – undo
1153 1153
 	 * @param  string $context View or edit context.
1154 1154
 	 * @return string
1155 1155
 	 */
1156
-	public function get_company( $context = 'view' ) {
1157
-		return $this->get_prop( 'company', $context );
1156
+	public function get_company($context = 'view') {
1157
+		return $this->get_prop('company', $context);
1158 1158
     }
1159 1159
 
1160 1160
     /**
@@ -1164,8 +1164,8 @@  discard block
 block discarded – undo
1164 1164
 	 * @param  string $context View or edit context.
1165 1165
 	 * @return string
1166 1166
 	 */
1167
-	public function get_user_company( $context = 'view' ) {
1168
-		return $this->get_company( $context );
1167
+	public function get_user_company($context = 'view') {
1168
+		return $this->get_company($context);
1169 1169
     }
1170 1170
 
1171 1171
     /**
@@ -1175,8 +1175,8 @@  discard block
 block discarded – undo
1175 1175
 	 * @param  string $context View or edit context.
1176 1176
 	 * @return string
1177 1177
 	 */
1178
-	public function get_customer_company( $context = 'view' ) {
1179
-		return $this->get_company( $context );
1178
+	public function get_customer_company($context = 'view') {
1179
+		return $this->get_company($context);
1180 1180
     }
1181 1181
 
1182 1182
 	/**
@@ -1186,8 +1186,8 @@  discard block
 block discarded – undo
1186 1186
 	 * @param  string $context View or edit context.
1187 1187
 	 * @return string
1188 1188
 	 */
1189
-	public function get_company_id( $context = 'view' ) {
1190
-		return $this->get_prop( 'company_id', $context );
1189
+	public function get_company_id($context = 'view') {
1190
+		return $this->get_prop('company_id', $context);
1191 1191
     }
1192 1192
 
1193 1193
     /**
@@ -1197,8 +1197,8 @@  discard block
 block discarded – undo
1197 1197
 	 * @param  string $context View or edit context.
1198 1198
 	 * @return string
1199 1199
 	 */
1200
-	public function get_vat_number( $context = 'view' ) {
1201
-		return $this->get_prop( 'vat_number', $context );
1200
+	public function get_vat_number($context = 'view') {
1201
+		return $this->get_prop('vat_number', $context);
1202 1202
     }
1203 1203
 
1204 1204
     /**
@@ -1208,8 +1208,8 @@  discard block
 block discarded – undo
1208 1208
 	 * @param  string $context View or edit context.
1209 1209
 	 * @return string
1210 1210
 	 */
1211
-	public function get_user_vat_number( $context = 'view' ) {
1212
-		return $this->get_vat_number( $context );
1211
+	public function get_user_vat_number($context = 'view') {
1212
+		return $this->get_vat_number($context);
1213 1213
     }
1214 1214
 
1215 1215
     /**
@@ -1219,8 +1219,8 @@  discard block
 block discarded – undo
1219 1219
 	 * @param  string $context View or edit context.
1220 1220
 	 * @return string
1221 1221
 	 */
1222
-	public function get_customer_vat_number( $context = 'view' ) {
1223
-		return $this->get_vat_number( $context );
1222
+	public function get_customer_vat_number($context = 'view') {
1223
+		return $this->get_vat_number($context);
1224 1224
     }
1225 1225
 
1226 1226
     /**
@@ -1230,8 +1230,8 @@  discard block
 block discarded – undo
1230 1230
 	 * @param  string $context View or edit context.
1231 1231
 	 * @return string
1232 1232
 	 */
1233
-	public function get_vat_rate( $context = 'view' ) {
1234
-		return $this->get_prop( 'vat_rate', $context );
1233
+	public function get_vat_rate($context = 'view') {
1234
+		return $this->get_prop('vat_rate', $context);
1235 1235
     }
1236 1236
 
1237 1237
     /**
@@ -1241,8 +1241,8 @@  discard block
 block discarded – undo
1241 1241
 	 * @param  string $context View or edit context.
1242 1242
 	 * @return string
1243 1243
 	 */
1244
-	public function get_user_vat_rate( $context = 'view' ) {
1245
-		return $this->get_vat_rate( $context );
1244
+	public function get_user_vat_rate($context = 'view') {
1245
+		return $this->get_vat_rate($context);
1246 1246
     }
1247 1247
 
1248 1248
     /**
@@ -1252,8 +1252,8 @@  discard block
 block discarded – undo
1252 1252
 	 * @param  string $context View or edit context.
1253 1253
 	 * @return string
1254 1254
 	 */
1255
-	public function get_customer_vat_rate( $context = 'view' ) {
1256
-		return $this->get_vat_rate( $context );
1255
+	public function get_customer_vat_rate($context = 'view') {
1256
+		return $this->get_vat_rate($context);
1257 1257
     }
1258 1258
 
1259 1259
     /**
@@ -1263,8 +1263,8 @@  discard block
 block discarded – undo
1263 1263
 	 * @param  string $context View or edit context.
1264 1264
 	 * @return string
1265 1265
 	 */
1266
-	public function get_address( $context = 'view' ) {
1267
-		return $this->get_prop( 'address', $context );
1266
+	public function get_address($context = 'view') {
1267
+		return $this->get_prop('address', $context);
1268 1268
     }
1269 1269
 
1270 1270
     /**
@@ -1274,8 +1274,8 @@  discard block
 block discarded – undo
1274 1274
 	 * @param  string $context View or edit context.
1275 1275
 	 * @return string
1276 1276
 	 */
1277
-	public function get_user_address( $context = 'view' ) {
1278
-		return $this->get_address( $context );
1277
+	public function get_user_address($context = 'view') {
1278
+		return $this->get_address($context);
1279 1279
     }
1280 1280
 
1281 1281
     /**
@@ -1285,8 +1285,8 @@  discard block
 block discarded – undo
1285 1285
 	 * @param  string $context View or edit context.
1286 1286
 	 * @return string
1287 1287
 	 */
1288
-	public function get_customer_address( $context = 'view' ) {
1289
-		return $this->get_address( $context );
1288
+	public function get_customer_address($context = 'view') {
1289
+		return $this->get_address($context);
1290 1290
     }
1291 1291
 
1292 1292
     /**
@@ -1296,8 +1296,8 @@  discard block
 block discarded – undo
1296 1296
 	 * @param  string $context View or edit context.
1297 1297
 	 * @return bool
1298 1298
 	 */
1299
-	public function get_is_viewed( $context = 'view' ) {
1300
-		return (bool) $this->get_prop( 'is_viewed', $context );
1299
+	public function get_is_viewed($context = 'view') {
1300
+		return (bool) $this->get_prop('is_viewed', $context);
1301 1301
 	}
1302 1302
 
1303 1303
 	/**
@@ -1307,8 +1307,8 @@  discard block
 block discarded – undo
1307 1307
 	 * @param  string $context View or edit context.
1308 1308
 	 * @return bool
1309 1309
 	 */
1310
-	public function get_email_cc( $context = 'view' ) {
1311
-		return $this->get_prop( 'email_cc', $context );
1310
+	public function get_email_cc($context = 'view') {
1311
+		return $this->get_prop('email_cc', $context);
1312 1312
 	}
1313 1313
 
1314 1314
 	/**
@@ -1318,8 +1318,8 @@  discard block
 block discarded – undo
1318 1318
 	 * @param  string $context View or edit context.
1319 1319
 	 * @return bool
1320 1320
 	 */
1321
-	public function get_template( $context = 'view' ) {
1322
-		return $this->get_prop( 'template', $context );
1321
+	public function get_template($context = 'view') {
1322
+		return $this->get_prop('template', $context);
1323 1323
 	}
1324 1324
 
1325 1325
 	/**
@@ -1329,8 +1329,8 @@  discard block
 block discarded – undo
1329 1329
 	 * @param  string $context View or edit context.
1330 1330
 	 * @return bool
1331 1331
 	 */
1332
-	public function get_created_via( $context = 'view' ) {
1333
-		return $this->get_prop( 'created_via', $context );
1332
+	public function get_created_via($context = 'view') {
1333
+		return $this->get_prop('created_via', $context);
1334 1334
 	}
1335 1335
 
1336 1336
 	/**
@@ -1340,8 +1340,8 @@  discard block
 block discarded – undo
1340 1340
 	 * @param  string $context View or edit context.
1341 1341
 	 * @return bool
1342 1342
 	 */
1343
-	public function get_address_confirmed( $context = 'view' ) {
1344
-		return (bool) $this->get_prop( 'address_confirmed', $context );
1343
+	public function get_address_confirmed($context = 'view') {
1344
+		return (bool) $this->get_prop('address_confirmed', $context);
1345 1345
     }
1346 1346
 
1347 1347
     /**
@@ -1351,8 +1351,8 @@  discard block
 block discarded – undo
1351 1351
 	 * @param  string $context View or edit context.
1352 1352
 	 * @return bool
1353 1353
 	 */
1354
-	public function get_user_address_confirmed( $context = 'view' ) {
1355
-		return $this->get_address_confirmed( $context );
1354
+	public function get_user_address_confirmed($context = 'view') {
1355
+		return $this->get_address_confirmed($context);
1356 1356
     }
1357 1357
 
1358 1358
     /**
@@ -1362,8 +1362,8 @@  discard block
 block discarded – undo
1362 1362
 	 * @param  string $context View or edit context.
1363 1363
 	 * @return bool
1364 1364
 	 */
1365
-	public function get_customer_address_confirmed( $context = 'view' ) {
1366
-		return $this->get_address_confirmed( $context );
1365
+	public function get_customer_address_confirmed($context = 'view') {
1366
+		return $this->get_address_confirmed($context);
1367 1367
     }
1368 1368
 
1369 1369
     /**
@@ -1373,12 +1373,12 @@  discard block
 block discarded – undo
1373 1373
 	 * @param  string $context View or edit context.
1374 1374
 	 * @return float
1375 1375
 	 */
1376
-	public function get_subtotal( $context = 'view' ) {
1377
-        $subtotal = (float) $this->get_prop( 'subtotal', $context );
1376
+	public function get_subtotal($context = 'view') {
1377
+        $subtotal = (float) $this->get_prop('subtotal', $context);
1378 1378
 
1379 1379
         // Backwards compatibility.
1380
-        if ( is_bool( $context ) && $context ) {
1381
-            return wpinv_price( $subtotal, $this->get_currency() );
1380
+        if (is_bool($context) && $context) {
1381
+            return wpinv_price($subtotal, $this->get_currency());
1382 1382
         }
1383 1383
 
1384 1384
         return $subtotal;
@@ -1391,8 +1391,8 @@  discard block
 block discarded – undo
1391 1391
 	 * @param  string $context View or edit context.
1392 1392
 	 * @return float
1393 1393
 	 */
1394
-	public function get_total_discount( $context = 'view' ) {
1395
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_discount', $context ) ) );
1394
+	public function get_total_discount($context = 'view') {
1395
+		return wpinv_round_amount(wpinv_sanitize_amount($this->get_prop('total_discount', $context)));
1396 1396
     }
1397 1397
 
1398 1398
     /**
@@ -1402,18 +1402,18 @@  discard block
 block discarded – undo
1402 1402
 	 * @param  string $context View or edit context.
1403 1403
 	 * @return float
1404 1404
 	 */
1405
-	public function get_total_tax( $context = 'view' ) {
1406
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_tax', $context ) ) );
1405
+	public function get_total_tax($context = 'view') {
1406
+		return wpinv_round_amount(wpinv_sanitize_amount($this->get_prop('total_tax', $context)));
1407 1407
 	}
1408 1408
 
1409 1409
 	/**
1410 1410
 	 * @deprecated
1411 1411
 	 */
1412
-	public function get_final_tax( $currency = false ) {
1412
+	public function get_final_tax($currency = false) {
1413 1413
 		$tax = $this->get_total_tax();
1414 1414
 
1415
-        if ( $currency ) {
1416
-			return wpinv_price( $tax, $this->get_currency() );
1415
+        if ($currency) {
1416
+			return wpinv_price($tax, $this->get_currency());
1417 1417
         }
1418 1418
 
1419 1419
         return $tax;
@@ -1426,8 +1426,8 @@  discard block
 block discarded – undo
1426 1426
 	 * @param  string $context View or edit context.
1427 1427
 	 * @return float
1428 1428
 	 */
1429
-	public function get_total_fees( $context = 'view' ) {
1430
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_fees', $context ) ) );
1429
+	public function get_total_fees($context = 'view') {
1430
+		return wpinv_round_amount(wpinv_sanitize_amount($this->get_prop('total_fees', $context)));
1431 1431
     }
1432 1432
 
1433 1433
     /**
@@ -1437,8 +1437,8 @@  discard block
 block discarded – undo
1437 1437
 	 * @param  string $context View or edit context.
1438 1438
 	 * @return float
1439 1439
 	 */
1440
-	public function get_fees_total( $context = 'view' ) {
1441
-		return $this->get_total_fees( $context );
1440
+	public function get_fees_total($context = 'view') {
1441
+		return $this->get_total_fees($context);
1442 1442
     }
1443 1443
 
1444 1444
     /**
@@ -1447,8 +1447,8 @@  discard block
 block discarded – undo
1447 1447
 	 * @since 1.0.19
1448 1448
      * @return float
1449 1449
 	 */
1450
-	public function get_total( $context = 'view' ) {
1451
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total', $context ) ) );
1450
+	public function get_total($context = 'view') {
1451
+		return wpinv_round_amount(wpinv_sanitize_amount($this->get_prop('total', $context)));
1452 1452
 	}
1453 1453
 
1454 1454
 	/**
@@ -1460,20 +1460,20 @@  discard block
 block discarded – undo
1460 1460
 	public function get_non_recurring_total() {
1461 1461
 
1462 1462
 		$subtotal = 0;
1463
-		foreach ( $this->get_items() as $item ) {
1464
-			if ( ! $item->is_recurring() ) {
1463
+		foreach ($this->get_items() as $item) {
1464
+			if (!$item->is_recurring()) {
1465 1465
 				$subtotal += $item->get_sub_total();
1466 1466
 			}
1467 1467
 		}
1468 1468
 
1469
-		foreach ( $this->get_fees() as $fee ) {
1470
-			if ( empty( $fee['recurring_fee'] ) ) {
1471
-				$subtotal += wpinv_sanitize_amount( $fee['initial_fee'] );
1469
+		foreach ($this->get_fees() as $fee) {
1470
+			if (empty($fee['recurring_fee'])) {
1471
+				$subtotal += wpinv_sanitize_amount($fee['initial_fee']);
1472 1472
 			}
1473 1473
 		}
1474 1474
 
1475
-		$subtotal = wpinv_round_amount( wpinv_sanitize_amount( $subtotal ) );
1476
-        return apply_filters( 'wpinv_get_non_recurring_invoice_total', $subtotal, $this );
1475
+		$subtotal = wpinv_round_amount(wpinv_sanitize_amount($subtotal));
1476
+        return apply_filters('wpinv_get_non_recurring_invoice_total', $subtotal, $this);
1477 1477
 
1478 1478
     }
1479 1479
 
@@ -1496,7 +1496,7 @@  discard block
 block discarded – undo
1496 1496
 	 */
1497 1497
     public function get_initial_total() {
1498 1498
 
1499
-		if ( empty( $this->totals ) ) {
1499
+		if (empty($this->totals)) {
1500 1500
 			$this->recalculate_total();
1501 1501
 		}
1502 1502
 
@@ -1506,12 +1506,12 @@  discard block
 block discarded – undo
1506 1506
 		$subtotal = $this->totals['subtotal']['initial'];
1507 1507
 		$total    = $tax + $fee - $discount + $subtotal;
1508 1508
 
1509
-		if ( 0 > $total ) {
1509
+		if (0 > $total) {
1510 1510
 			$total = 0;
1511 1511
 		}
1512 1512
 
1513
-		$total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1514
-        return apply_filters( 'wpinv_get_initial_invoice_total', $total, $this );
1513
+		$total = wpinv_round_amount(wpinv_sanitize_amount($total));
1514
+        return apply_filters('wpinv_get_initial_invoice_total', $total, $this);
1515 1515
 	}
1516 1516
 
1517 1517
 	/**
@@ -1523,7 +1523,7 @@  discard block
 block discarded – undo
1523 1523
 	 */
1524 1524
     public function get_recurring_total() {
1525 1525
 
1526
-		if ( empty( $this->totals ) ) {
1526
+		if (empty($this->totals)) {
1527 1527
 			$this->recalculate_total();
1528 1528
 		}
1529 1529
 
@@ -1533,12 +1533,12 @@  discard block
 block discarded – undo
1533 1533
 		$subtotal = $this->totals['subtotal']['recurring'];
1534 1534
 		$total    = $tax + $fee - $discount + $subtotal;
1535 1535
 
1536
-		if ( 0 > $total ) {
1536
+		if (0 > $total) {
1537 1537
 			$total = 0;
1538 1538
 		}
1539 1539
 
1540
-		$total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1541
-        return apply_filters( 'wpinv_get_recurring_invoice_total', $total, $this );
1540
+		$total = wpinv_round_amount(wpinv_sanitize_amount($total));
1541
+        return apply_filters('wpinv_get_recurring_invoice_total', $total, $this);
1542 1542
 	}
1543 1543
 
1544 1544
 	/**
@@ -1549,10 +1549,10 @@  discard block
 block discarded – undo
1549 1549
 	 * @param string $currency Whether to include the currency.
1550 1550
      * @return float|string
1551 1551
 	 */
1552
-    public function get_recurring_details( $field = '', $currency = false ) {
1552
+    public function get_recurring_details($field = '', $currency = false) {
1553 1553
 
1554 1554
 		// Maybe recalculate totals.
1555
-		if ( empty( $this->totals ) ) {
1555
+		if (empty($this->totals)) {
1556 1556
 			$this->recalculate_total();
1557 1557
 		}
1558 1558
 
@@ -1572,8 +1572,8 @@  discard block
 block discarded – undo
1572 1572
 			$currency
1573 1573
 		);
1574 1574
 
1575
-        if ( isset( $data[$field] ) ) {
1576
-            return ( $currency ? wpinv_price( $data[$field], $this->get_currency() ) : $data[$field] );
1575
+        if (isset($data[$field])) {
1576
+            return ($currency ? wpinv_price($data[$field], $this->get_currency()) : $data[$field]);
1577 1577
         }
1578 1578
 
1579 1579
         return $data;
@@ -1586,8 +1586,8 @@  discard block
 block discarded – undo
1586 1586
 	 * @param  string $context View or edit context.
1587 1587
 	 * @return array
1588 1588
 	 */
1589
-	public function get_fees( $context = 'view' ) {
1590
-		return wpinv_parse_list( $this->get_prop( 'fees', $context ) );
1589
+	public function get_fees($context = 'view') {
1590
+		return wpinv_parse_list($this->get_prop('fees', $context));
1591 1591
     }
1592 1592
 
1593 1593
     /**
@@ -1597,8 +1597,8 @@  discard block
 block discarded – undo
1597 1597
 	 * @param  string $context View or edit context.
1598 1598
 	 * @return array
1599 1599
 	 */
1600
-	public function get_discounts( $context = 'view' ) {
1601
-		return wpinv_parse_list( $this->get_prop( 'discounts', $context ) );
1600
+	public function get_discounts($context = 'view') {
1601
+		return wpinv_parse_list($this->get_prop('discounts', $context));
1602 1602
     }
1603 1603
 
1604 1604
     /**
@@ -1608,8 +1608,8 @@  discard block
 block discarded – undo
1608 1608
 	 * @param  string $context View or edit context.
1609 1609
 	 * @return array
1610 1610
 	 */
1611
-	public function get_taxes( $context = 'view' ) {
1612
-		return wpinv_parse_list( $this->get_prop( 'taxes', $context ) );
1611
+	public function get_taxes($context = 'view') {
1612
+		return wpinv_parse_list($this->get_prop('taxes', $context));
1613 1613
     }
1614 1614
 
1615 1615
     /**
@@ -1619,8 +1619,8 @@  discard block
 block discarded – undo
1619 1619
 	 * @param  string $context View or edit context.
1620 1620
 	 * @return GetPaid_Form_Item[]
1621 1621
 	 */
1622
-	public function get_items( $context = 'view' ) {
1623
-        return $this->get_prop( 'items', $context );
1622
+	public function get_items($context = 'view') {
1623
+        return $this->get_prop('items', $context);
1624 1624
 	}
1625 1625
 
1626 1626
 	/**
@@ -1630,7 +1630,7 @@  discard block
 block discarded – undo
1630 1630
 	 * @return string
1631 1631
 	 */
1632 1632
 	public function get_item_ids() {
1633
-		return implode( ', ', wp_list_pluck( $this->get_cart_details(), 'item_id' ) );
1633
+		return implode(', ', wp_list_pluck($this->get_cart_details(), 'item_id'));
1634 1634
     }
1635 1635
 
1636 1636
     /**
@@ -1640,8 +1640,8 @@  discard block
 block discarded – undo
1640 1640
 	 * @param  string $context View or edit context.
1641 1641
 	 * @return int
1642 1642
 	 */
1643
-	public function get_payment_form( $context = 'view' ) {
1644
-		return intval( $this->get_prop( 'payment_form', $context ) );
1643
+	public function get_payment_form($context = 'view') {
1644
+		return intval($this->get_prop('payment_form', $context));
1645 1645
     }
1646 1646
 
1647 1647
     /**
@@ -1651,8 +1651,8 @@  discard block
 block discarded – undo
1651 1651
 	 * @param  string $context View or edit context.
1652 1652
 	 * @return string
1653 1653
 	 */
1654
-	public function get_submission_id( $context = 'view' ) {
1655
-		return $this->get_prop( 'submission_id', $context );
1654
+	public function get_submission_id($context = 'view') {
1655
+		return $this->get_prop('submission_id', $context);
1656 1656
     }
1657 1657
 
1658 1658
     /**
@@ -1662,8 +1662,8 @@  discard block
 block discarded – undo
1662 1662
 	 * @param  string $context View or edit context.
1663 1663
 	 * @return string
1664 1664
 	 */
1665
-	public function get_discount_code( $context = 'view' ) {
1666
-		return $this->get_prop( 'discount_code', $context );
1665
+	public function get_discount_code($context = 'view') {
1666
+		return $this->get_prop('discount_code', $context);
1667 1667
     }
1668 1668
 
1669 1669
     /**
@@ -1673,8 +1673,8 @@  discard block
 block discarded – undo
1673 1673
 	 * @param  string $context View or edit context.
1674 1674
 	 * @return string
1675 1675
 	 */
1676
-	public function get_gateway( $context = 'view' ) {
1677
-		return $this->get_prop( 'gateway', $context );
1676
+	public function get_gateway($context = 'view') {
1677
+		return $this->get_prop('gateway', $context);
1678 1678
     }
1679 1679
 
1680 1680
     /**
@@ -1684,8 +1684,8 @@  discard block
 block discarded – undo
1684 1684
 	 * @return string
1685 1685
 	 */
1686 1686
     public function get_gateway_title() {
1687
-        $title =  wpinv_get_gateway_checkout_label( $this->get_gateway() );
1688
-        return apply_filters( 'wpinv_gateway_title', $title, $this->get_id(), $this );
1687
+        $title = wpinv_get_gateway_checkout_label($this->get_gateway());
1688
+        return apply_filters('wpinv_gateway_title', $title, $this->get_id(), $this);
1689 1689
     }
1690 1690
 
1691 1691
     /**
@@ -1695,8 +1695,8 @@  discard block
 block discarded – undo
1695 1695
 	 * @param  string $context View or edit context.
1696 1696
 	 * @return string
1697 1697
 	 */
1698
-	public function get_transaction_id( $context = 'view' ) {
1699
-		return $this->get_prop( 'transaction_id', $context );
1698
+	public function get_transaction_id($context = 'view') {
1699
+		return $this->get_prop('transaction_id', $context);
1700 1700
     }
1701 1701
 
1702 1702
     /**
@@ -1706,9 +1706,9 @@  discard block
 block discarded – undo
1706 1706
 	 * @param  string $context View or edit context.
1707 1707
 	 * @return string
1708 1708
 	 */
1709
-	public function get_currency( $context = 'view' ) {
1710
-        $currency = $this->get_prop( 'currency', $context );
1711
-        return empty( $currency ) ? wpinv_get_currency() : $currency;
1709
+	public function get_currency($context = 'view') {
1710
+        $currency = $this->get_prop('currency', $context);
1711
+        return empty($currency) ? wpinv_get_currency() : $currency;
1712 1712
     }
1713 1713
 
1714 1714
     /**
@@ -1718,8 +1718,8 @@  discard block
 block discarded – undo
1718 1718
 	 * @param  string $context View or edit context.
1719 1719
 	 * @return bool
1720 1720
 	 */
1721
-	public function get_disable_taxes( $context = 'view' ) {
1722
-        return (bool) $this->get_prop( 'disable_taxes', $context );
1721
+	public function get_disable_taxes($context = 'view') {
1722
+        return (bool) $this->get_prop('disable_taxes', $context);
1723 1723
     }
1724 1724
 
1725 1725
     /**
@@ -1729,8 +1729,8 @@  discard block
 block discarded – undo
1729 1729
 	 * @param  string $context View or edit context.
1730 1730
 	 * @return int
1731 1731
 	 */
1732
-    public function get_subscription_id( $context = 'view' ) {
1733
-		return $this->is_renewal() ? $this->get_parent()->get_subscription_id( $context ) : $this->get_prop( 'subscription_id', $context );
1732
+    public function get_subscription_id($context = 'view') {
1733
+		return $this->is_renewal() ? $this->get_parent()->get_subscription_id($context) : $this->get_prop('subscription_id', $context);
1734 1734
 	}
1735 1735
 
1736 1736
 	/**
@@ -1740,12 +1740,12 @@  discard block
 block discarded – undo
1740 1740
 	 * @param  string $context View or edit context.
1741 1741
 	 * @return int
1742 1742
 	 */
1743
-    public function get_remote_subscription_id( $context = 'view' ) {
1744
-        $subscription_id = $this->get_prop( 'remote_subscription_id', $context );
1743
+    public function get_remote_subscription_id($context = 'view') {
1744
+        $subscription_id = $this->get_prop('remote_subscription_id', $context);
1745 1745
 
1746
-        if ( empty( $subscription_id ) && $this->is_renewal() ) {
1746
+        if (empty($subscription_id) && $this->is_renewal()) {
1747 1747
             $parent = $this->get_parent();
1748
-            return $parent->get_remote_subscription_id( $context );
1748
+            return $parent->get_remote_subscription_id($context);
1749 1749
         }
1750 1750
 
1751 1751
         return $subscription_id;
@@ -1758,20 +1758,20 @@  discard block
 block discarded – undo
1758 1758
 	 * @param  string $context View or edit context.
1759 1759
 	 * @return array
1760 1760
 	 */
1761
-    public function get_payment_meta( $context = 'view' ) {
1761
+    public function get_payment_meta($context = 'view') {
1762 1762
 
1763 1763
         return array(
1764
-            'price'        => $this->get_total( $context ),
1765
-            'date'         => $this->get_date_created( $context ),
1766
-            'user_email'   => $this->get_email( $context ),
1767
-            'invoice_key'  => $this->get_key( $context ),
1768
-            'currency'     => $this->get_currency( $context ),
1769
-            'items'        => $this->get_items( $context ),
1770
-            'user_info'    => $this->get_user_info( $context ),
1764
+            'price'        => $this->get_total($context),
1765
+            'date'         => $this->get_date_created($context),
1766
+            'user_email'   => $this->get_email($context),
1767
+            'invoice_key'  => $this->get_key($context),
1768
+            'currency'     => $this->get_currency($context),
1769
+            'items'        => $this->get_items($context),
1770
+            'user_info'    => $this->get_user_info($context),
1771 1771
             'cart_details' => $this->get_cart_details(),
1772
-            'status'       => $this->get_status( $context ),
1773
-            'fees'         => $this->get_fees( $context ),
1774
-            'taxes'        => $this->get_taxes( $context ),
1772
+            'status'       => $this->get_status($context),
1773
+            'fees'         => $this->get_fees($context),
1774
+            'taxes'        => $this->get_taxes($context),
1775 1775
         );
1776 1776
 
1777 1777
     }
@@ -1786,9 +1786,9 @@  discard block
 block discarded – undo
1786 1786
         $items        = $this->get_items();
1787 1787
         $cart_details = array();
1788 1788
 
1789
-        foreach ( $items as $item ) {
1789
+        foreach ($items as $item) {
1790 1790
 			$item->invoice_id = $this->get_id();
1791
-            $cart_details[]   = $item->prepare_data_for_saving();
1791
+            $cart_details[] = $item->prepare_data_for_saving();
1792 1792
         }
1793 1793
 
1794 1794
         return $cart_details;
@@ -1799,11 +1799,11 @@  discard block
 block discarded – undo
1799 1799
 	 *
1800 1800
 	 * @return null|GetPaid_Form_Item|int
1801 1801
 	 */
1802
-	public function get_recurring( $object = false ) {
1802
+	public function get_recurring($object = false) {
1803 1803
 
1804 1804
 		// Are we returning an object?
1805
-        if ( $object ) {
1806
-            return $this->get_item( $this->recurring_item );
1805
+        if ($object) {
1806
+            return $this->get_item($this->recurring_item);
1807 1807
         }
1808 1808
 
1809 1809
         return $this->recurring_item;
@@ -1818,15 +1818,15 @@  discard block
 block discarded – undo
1818 1818
 	public function get_subscription_name() {
1819 1819
 
1820 1820
 		// Retrieve the recurring name
1821
-        $item = $this->get_recurring( true );
1821
+        $item = $this->get_recurring(true);
1822 1822
 
1823 1823
 		// Abort if it does not exist.
1824
-        if ( empty( $item ) ) {
1824
+        if (empty($item)) {
1825 1825
             return '';
1826 1826
         }
1827 1827
 
1828 1828
 		// Return the item name.
1829
-        return apply_filters( 'wpinv_invoice_get_subscription_name', $item->get_name(), $this );
1829
+        return apply_filters('wpinv_invoice_get_subscription_name', $item->get_name(), $this);
1830 1830
 	}
1831 1831
 
1832 1832
 	/**
@@ -1836,9 +1836,9 @@  discard block
 block discarded – undo
1836 1836
 	 * @return string
1837 1837
 	 */
1838 1838
 	public function get_view_url() {
1839
-        $invoice_url = get_permalink( $this->get_id() );
1840
-		$invoice_url = add_query_arg( 'invoice_key', $this->get_key(), $invoice_url );
1841
-        return apply_filters( 'wpinv_get_view_url', $invoice_url, $this );
1839
+        $invoice_url = get_permalink($this->get_id());
1840
+		$invoice_url = add_query_arg('invoice_key', $this->get_key(), $invoice_url);
1841
+        return apply_filters('wpinv_get_view_url', $invoice_url, $this);
1842 1842
 	}
1843 1843
 
1844 1844
 	/**
@@ -1847,25 +1847,25 @@  discard block
 block discarded – undo
1847 1847
 	 * @since 1.0.19
1848 1848
 	 * @return string
1849 1849
 	 */
1850
-	public function get_checkout_payment_url( $deprecated = false, $secret = false ) {
1850
+	public function get_checkout_payment_url($deprecated = false, $secret = false) {
1851 1851
 
1852 1852
 		// Retrieve the checkout url.
1853 1853
         $pay_url = wpinv_get_checkout_uri();
1854 1854
 
1855 1855
 		// Maybe force ssl.
1856
-        if ( is_ssl() ) {
1857
-            $pay_url = str_replace( 'http:', 'https:', $pay_url );
1856
+        if (is_ssl()) {
1857
+            $pay_url = str_replace('http:', 'https:', $pay_url);
1858 1858
         }
1859 1859
 
1860 1860
 		// Add the invoice key.
1861
-		$pay_url = add_query_arg( 'invoice_key', $this->get_key(), $pay_url );
1861
+		$pay_url = add_query_arg('invoice_key', $this->get_key(), $pay_url);
1862 1862
 
1863 1863
 		// (Maybe?) add a secret
1864
-        if ( $secret ) {
1865
-            $pay_url = add_query_arg( array( '_wpipay' => md5( $this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key() ) ), $pay_url );
1864
+        if ($secret) {
1865
+            $pay_url = add_query_arg(array('_wpipay' => md5($this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key())), $pay_url);
1866 1866
         }
1867 1867
 
1868
-        return apply_filters( 'wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret );
1868
+        return apply_filters('wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret);
1869 1869
 	}
1870 1870
 	
1871 1871
 	/**
@@ -1880,14 +1880,14 @@  discard block
 block discarded – undo
1880 1880
         $receipt_url = wpinv_get_success_page_uri();
1881 1881
 
1882 1882
 		// Maybe force ssl.
1883
-        if ( is_ssl() ) {
1884
-            $receipt_url = str_replace( 'http:', 'https:', $receipt_url );
1883
+        if (is_ssl()) {
1884
+            $receipt_url = str_replace('http:', 'https:', $receipt_url);
1885 1885
         }
1886 1886
 
1887 1887
 		// Add the invoice key.
1888
-		$receipt_url = add_query_arg( 'invoice_key', $this->get_key(), $receipt_url );
1888
+		$receipt_url = add_query_arg('invoice_key', $this->get_key(), $receipt_url);
1889 1889
 
1890
-        return apply_filters( 'getpaid_get_invoice_receipt_url', $receipt_url, $this );
1890
+        return apply_filters('getpaid_get_invoice_receipt_url', $receipt_url, $this);
1891 1891
 	}
1892 1892
 	
1893 1893
 	/**
@@ -1900,7 +1900,7 @@  discard block
 block discarded – undo
1900 1900
 
1901 1901
 		$type   = $this->get_type();
1902 1902
 		$status = "wpi-$type-pending";
1903
-		return str_replace( '-invoice', '', $status );
1903
+		return str_replace('-invoice', '', $status);
1904 1904
 
1905 1905
 	}
1906 1906
 
@@ -1914,8 +1914,8 @@  discard block
 block discarded – undo
1914 1914
 	 * @param  string $context View or edit context.
1915 1915
 	 * @return mixed Value of the given invoice property (if set).
1916 1916
 	 */
1917
-	public function get( $key, $context = 'view' ) {
1918
-        return $this->get_prop( $key, $context );
1917
+	public function get($key, $context = 'view') {
1918
+        return $this->get_prop($key, $context);
1919 1919
 	}
1920 1920
 
1921 1921
     /*
@@ -1938,11 +1938,11 @@  discard block
 block discarded – undo
1938 1938
 	 * @param  mixed $value new value.
1939 1939
 	 * @return mixed Value of the given invoice property (if set).
1940 1940
 	 */
1941
-	public function set( $key, $value ) {
1941
+	public function set($key, $value) {
1942 1942
 
1943 1943
         $setter = "set_$key";
1944
-        if ( is_callable( array( $this, $setter ) ) ) {
1945
-            $this->{$setter}( $value );
1944
+        if (is_callable(array($this, $setter))) {
1945
+            $this->{$setter}($value);
1946 1946
         }
1947 1947
 
1948 1948
 	}
@@ -1956,45 +1956,45 @@  discard block
 block discarded – undo
1956 1956
 	 * @param bool   $manual_update Is this a manual status change?.
1957 1957
 	 * @return array details of change.
1958 1958
 	 */
1959
-	public function set_status( $new_status, $note = '', $manual_update = false ) {
1959
+	public function set_status($new_status, $note = '', $manual_update = false) {
1960 1960
 		$old_status = $this->get_status();
1961 1961
 
1962 1962
 		$statuses = $this->get_all_statuses();
1963 1963
 
1964
-		if ( isset( $statuses[ 'draft' ] ) ) {
1965
-			unset( $statuses[ 'draft' ] );
1964
+		if (isset($statuses['draft'])) {
1965
+			unset($statuses['draft']);
1966 1966
 		}
1967 1967
 
1968
-		$this->set_prop( 'status', $new_status );
1968
+		$this->set_prop('status', $new_status);
1969 1969
 
1970 1970
 		// If setting the status, ensure it's set to a valid status.
1971
-		if ( true === $this->object_read ) {
1971
+		if (true === $this->object_read) {
1972 1972
 
1973 1973
 			// Only allow valid new status.
1974
-			if ( ! array_key_exists( $new_status, $statuses ) ) {
1974
+			if (!array_key_exists($new_status, $statuses)) {
1975 1975
 				$new_status = $this->get_default_status();
1976 1976
 			}
1977 1977
 
1978 1978
 			// If the old status is set but unknown (e.g. draft) assume its pending for action usage.
1979
-			if ( $old_status && ! array_key_exists( $new_status, $statuses ) ) {
1979
+			if ($old_status && !array_key_exists($new_status, $statuses)) {
1980 1980
 				$old_status = $this->get_default_status();
1981 1981
 			}
1982 1982
 
1983 1983
 			// Paid - Renewal (i.e when duplicating a parent invoice )
1984
-			if ( $new_status == 'wpi-pending' && $old_status == 'publish' && ! $this->get_id() ) {
1984
+			if ($new_status == 'wpi-pending' && $old_status == 'publish' && !$this->get_id()) {
1985 1985
 				$old_status = 'wpi-pending';
1986 1986
 			}
1987 1987
 
1988
-			if ( $old_status !== $new_status ) {
1988
+			if ($old_status !== $new_status) {
1989 1989
 				$this->status_transition = array(
1990
-					'from'   => ! empty( $this->status_transition['from'] ) ? $this->status_transition['from'] : $old_status,
1990
+					'from'   => !empty($this->status_transition['from']) ? $this->status_transition['from'] : $old_status,
1991 1991
 					'to'     => $new_status,
1992 1992
 					'note'   => $note,
1993 1993
 					'manual' => (bool) $manual_update,
1994 1994
 				);
1995 1995
 
1996
-				if ( $manual_update ) {
1997
-					do_action( 'getpaid_' . $this->object_type .'_edit_status', $this->get_id(), $new_status );
1996
+				if ($manual_update) {
1997
+					do_action('getpaid_' . $this->object_type . '_edit_status', $this->get_id(), $new_status);
1998 1998
 				}
1999 1999
 
2000 2000
 				$this->maybe_set_date_paid();
@@ -2019,8 +2019,8 @@  discard block
 block discarded – undo
2019 2019
 	 */
2020 2020
 	public function maybe_set_date_paid() {
2021 2021
 
2022
-		if ( ! $this->get_date_completed( 'edit' ) && $this->is_paid() ) {
2023
-			$this->set_date_completed( current_time( 'mysql' ) );
2022
+		if (!$this->get_date_completed('edit') && $this->is_paid()) {
2023
+			$this->set_date_completed(current_time('mysql'));
2024 2024
 		}
2025 2025
 	}
2026 2026
 
@@ -2029,11 +2029,11 @@  discard block
 block discarded – undo
2029 2029
 	 *
2030 2030
 	 * @since 1.0.19
2031 2031
 	 */
2032
-	public function set_parent_id( $value ) {
2033
-		if ( $value && ( $value === $this->get_id() ) ) {
2032
+	public function set_parent_id($value) {
2033
+		if ($value && ($value === $this->get_id())) {
2034 2034
 			return;
2035 2035
 		}
2036
-		$this->set_prop( 'parent_id', absint( $value ) );
2036
+		$this->set_prop('parent_id', absint($value));
2037 2037
     }
2038 2038
 
2039 2039
     /**
@@ -2041,8 +2041,8 @@  discard block
 block discarded – undo
2041 2041
 	 *
2042 2042
 	 * @since 1.0.19
2043 2043
 	 */
2044
-	public function set_version( $value ) {
2045
-		$this->set_prop( 'version', $value );
2044
+	public function set_version($value) {
2045
+		$this->set_prop('version', $value);
2046 2046
     }
2047 2047
 
2048 2048
     /**
@@ -2052,15 +2052,15 @@  discard block
 block discarded – undo
2052 2052
 	 * @param string $value Value to set.
2053 2053
      * @return bool Whether or not the date was set.
2054 2054
 	 */
2055
-	public function set_date_created( $value ) {
2056
-        $date = strtotime( $value );
2055
+	public function set_date_created($value) {
2056
+        $date = strtotime($value);
2057 2057
 
2058
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
2059
-            $this->set_prop( 'date_created', date( 'Y-m-d H:i:s', $date ) );
2058
+        if ($date && $value !== '0000-00-00 00:00:00') {
2059
+            $this->set_prop('date_created', date('Y-m-d H:i:s', $date));
2060 2060
             return true;
2061 2061
         }
2062 2062
 
2063
-		$this->set_prop( 'date_created', '' );
2063
+		$this->set_prop('date_created', '');
2064 2064
 		return false;
2065 2065
 
2066 2066
     }
@@ -2072,15 +2072,15 @@  discard block
 block discarded – undo
2072 2072
 	 * @param string $value Value to set.
2073 2073
      * @return bool Whether or not the date was set.
2074 2074
 	 */
2075
-	public function set_due_date( $value ) {
2076
-        $date = strtotime( $value );
2075
+	public function set_due_date($value) {
2076
+        $date = strtotime($value);
2077 2077
 
2078
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
2079
-            $this->set_prop( 'due_date', date( 'Y-m-d H:i:s', $date ) );
2078
+        if ($date && $value !== '0000-00-00 00:00:00') {
2079
+            $this->set_prop('due_date', date('Y-m-d H:i:s', $date));
2080 2080
             return true;
2081 2081
         }
2082 2082
 
2083
-		$this->set_prop( 'due_date', '' );
2083
+		$this->set_prop('due_date', '');
2084 2084
         return false;
2085 2085
 
2086 2086
     }
@@ -2091,8 +2091,8 @@  discard block
 block discarded – undo
2091 2091
 	 * @since 1.0.19
2092 2092
 	 * @param  string $value New name.
2093 2093
 	 */
2094
-	public function set_date_due( $value ) {
2095
-		$this->set_due_date( $value );
2094
+	public function set_date_due($value) {
2095
+		$this->set_due_date($value);
2096 2096
     }
2097 2097
 
2098 2098
     /**
@@ -2102,15 +2102,15 @@  discard block
 block discarded – undo
2102 2102
 	 * @param string $value Value to set.
2103 2103
      * @return bool Whether or not the date was set.
2104 2104
 	 */
2105
-	public function set_completed_date( $value ) {
2106
-        $date = strtotime( $value );
2105
+	public function set_completed_date($value) {
2106
+        $date = strtotime($value);
2107 2107
 
2108
-        if ( $date && $value !== '0000-00-00 00:00:00'  ) {
2109
-            $this->set_prop( 'completed_date', date( 'Y-m-d H:i:s', $date ) );
2108
+        if ($date && $value !== '0000-00-00 00:00:00') {
2109
+            $this->set_prop('completed_date', date('Y-m-d H:i:s', $date));
2110 2110
             return true;
2111 2111
         }
2112 2112
 
2113
-		$this->set_prop( 'completed_date', '' );
2113
+		$this->set_prop('completed_date', '');
2114 2114
         return false;
2115 2115
 
2116 2116
     }
@@ -2121,8 +2121,8 @@  discard block
 block discarded – undo
2121 2121
 	 * @since 1.0.19
2122 2122
 	 * @param  string $value New name.
2123 2123
 	 */
2124
-	public function set_date_completed( $value ) {
2125
-		$this->set_completed_date( $value );
2124
+	public function set_date_completed($value) {
2125
+		$this->set_completed_date($value);
2126 2126
     }
2127 2127
 
2128 2128
     /**
@@ -2132,15 +2132,15 @@  discard block
 block discarded – undo
2132 2132
 	 * @param string $value Value to set.
2133 2133
      * @return bool Whether or not the date was set.
2134 2134
 	 */
2135
-	public function set_date_modified( $value ) {
2136
-        $date = strtotime( $value );
2135
+	public function set_date_modified($value) {
2136
+        $date = strtotime($value);
2137 2137
 
2138
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
2139
-            $this->set_prop( 'date_modified', date( 'Y-m-d H:i:s', $date ) );
2138
+        if ($date && $value !== '0000-00-00 00:00:00') {
2139
+            $this->set_prop('date_modified', date('Y-m-d H:i:s', $date));
2140 2140
             return true;
2141 2141
         }
2142 2142
 
2143
-		$this->set_prop( 'date_modified', '' );
2143
+		$this->set_prop('date_modified', '');
2144 2144
         return false;
2145 2145
 
2146 2146
     }
@@ -2151,9 +2151,9 @@  discard block
 block discarded – undo
2151 2151
 	 * @since 1.0.19
2152 2152
 	 * @param  string $value New number.
2153 2153
 	 */
2154
-	public function set_number( $value ) {
2155
-        $number = sanitize_text_field( $value );
2156
-		$this->set_prop( 'number', $number );
2154
+	public function set_number($value) {
2155
+        $number = sanitize_text_field($value);
2156
+		$this->set_prop('number', $number);
2157 2157
     }
2158 2158
 
2159 2159
     /**
@@ -2162,9 +2162,9 @@  discard block
 block discarded – undo
2162 2162
 	 * @since 1.0.19
2163 2163
 	 * @param  string $value Type.
2164 2164
 	 */
2165
-	public function set_type( $value ) {
2166
-        $type = sanitize_text_field( str_replace( 'wpi_', '', $value ) );
2167
-		$this->set_prop( 'type', $type );
2165
+	public function set_type($value) {
2166
+        $type = sanitize_text_field(str_replace('wpi_', '', $value));
2167
+		$this->set_prop('type', $type);
2168 2168
 	}
2169 2169
 
2170 2170
     /**
@@ -2173,10 +2173,10 @@  discard block
 block discarded – undo
2173 2173
 	 * @since 1.0.19
2174 2174
 	 * @param  string $value Post type.
2175 2175
 	 */
2176
-	public function set_post_type( $value ) {
2177
-        if ( getpaid_is_invoice_post_type( $value ) ) {
2178
-			$this->set_type( $value );
2179
-            $this->set_prop( 'post_type', $value );
2176
+	public function set_post_type($value) {
2177
+        if (getpaid_is_invoice_post_type($value)) {
2178
+			$this->set_type($value);
2179
+            $this->set_prop('post_type', $value);
2180 2180
         }
2181 2181
     }
2182 2182
 
@@ -2186,9 +2186,9 @@  discard block
 block discarded – undo
2186 2186
 	 * @since 1.0.19
2187 2187
 	 * @param  string $value New key.
2188 2188
 	 */
2189
-	public function set_key( $value ) {
2190
-        $key = sanitize_text_field( $value );
2191
-		$this->set_prop( 'key', $key );
2189
+	public function set_key($value) {
2190
+        $key = sanitize_text_field($value);
2191
+		$this->set_prop('key', $key);
2192 2192
     }
2193 2193
 
2194 2194
     /**
@@ -2197,9 +2197,9 @@  discard block
 block discarded – undo
2197 2197
 	 * @since 1.0.19
2198 2198
 	 * @param  string $value mode.
2199 2199
 	 */
2200
-	public function set_mode( $value ) {
2201
-        if ( in_array( $value, array( 'live', 'test' ) ) ) {
2202
-            $this->set_prop( 'mode', $value );
2200
+	public function set_mode($value) {
2201
+        if (in_array($value, array('live', 'test'))) {
2202
+            $this->set_prop('mode', $value);
2203 2203
         }
2204 2204
     }
2205 2205
 
@@ -2209,8 +2209,8 @@  discard block
 block discarded – undo
2209 2209
 	 * @since 1.0.19
2210 2210
 	 * @param  string $value path.
2211 2211
 	 */
2212
-	public function set_path( $value ) {
2213
-        $this->set_prop( 'path', $value );
2212
+	public function set_path($value) {
2213
+        $this->set_prop('path', $value);
2214 2214
     }
2215 2215
 
2216 2216
     /**
@@ -2219,9 +2219,9 @@  discard block
 block discarded – undo
2219 2219
 	 * @since 1.0.19
2220 2220
 	 * @param  string $value New name.
2221 2221
 	 */
2222
-	public function set_name( $value ) {
2223
-        $name = sanitize_text_field( $value );
2224
-		$this->set_prop( 'name', $name );
2222
+	public function set_name($value) {
2223
+        $name = sanitize_text_field($value);
2224
+		$this->set_prop('name', $name);
2225 2225
     }
2226 2226
 
2227 2227
     /**
@@ -2230,8 +2230,8 @@  discard block
 block discarded – undo
2230 2230
 	 * @since 1.0.19
2231 2231
 	 * @param  string $value New name.
2232 2232
 	 */
2233
-	public function set_title( $value ) {
2234
-		$this->set_name( $value );
2233
+	public function set_title($value) {
2234
+		$this->set_name($value);
2235 2235
     }
2236 2236
 
2237 2237
     /**
@@ -2240,9 +2240,9 @@  discard block
 block discarded – undo
2240 2240
 	 * @since 1.0.19
2241 2241
 	 * @param  string $value New description.
2242 2242
 	 */
2243
-	public function set_description( $value ) {
2244
-        $description = wp_kses_post( $value );
2245
-		$this->set_prop( 'description', $description );
2243
+	public function set_description($value) {
2244
+        $description = wp_kses_post($value);
2245
+		$this->set_prop('description', $description);
2246 2246
     }
2247 2247
 
2248 2248
     /**
@@ -2251,8 +2251,8 @@  discard block
 block discarded – undo
2251 2251
 	 * @since 1.0.19
2252 2252
 	 * @param  string $value New description.
2253 2253
 	 */
2254
-	public function set_excerpt( $value ) {
2255
-		$this->set_description( $value );
2254
+	public function set_excerpt($value) {
2255
+		$this->set_description($value);
2256 2256
     }
2257 2257
 
2258 2258
     /**
@@ -2261,8 +2261,8 @@  discard block
 block discarded – undo
2261 2261
 	 * @since 1.0.19
2262 2262
 	 * @param  string $value New description.
2263 2263
 	 */
2264
-	public function set_summary( $value ) {
2265
-		$this->set_description( $value );
2264
+	public function set_summary($value) {
2265
+		$this->set_description($value);
2266 2266
     }
2267 2267
 
2268 2268
     /**
@@ -2271,12 +2271,12 @@  discard block
 block discarded – undo
2271 2271
 	 * @since 1.0.19
2272 2272
 	 * @param  int $value New author.
2273 2273
 	 */
2274
-	public function set_author( $value ) {
2275
-		$user = get_user_by( 'id', (int) $value );
2274
+	public function set_author($value) {
2275
+		$user = get_user_by('id', (int) $value);
2276 2276
 
2277
-		if ( $user && $user->ID ) {
2278
-			$this->set_prop( 'author', $user->ID );
2279
-			$this->set_prop( 'email', $user->user_email );
2277
+		if ($user && $user->ID) {
2278
+			$this->set_prop('author', $user->ID);
2279
+			$this->set_prop('email', $user->user_email);
2280 2280
 		}
2281 2281
 
2282 2282
     }
@@ -2287,8 +2287,8 @@  discard block
 block discarded – undo
2287 2287
 	 * @since 1.0.19
2288 2288
 	 * @param  int $value New user id.
2289 2289
 	 */
2290
-	public function set_user_id( $value ) {
2291
-		$this->set_author( $value );
2290
+	public function set_user_id($value) {
2291
+		$this->set_author($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  int $value New user id.
2299 2299
 	 */
2300
-	public function set_customer_id( $value ) {
2301
-		$this->set_author( $value );
2300
+	public function set_customer_id($value) {
2301
+		$this->set_author($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 ip address.
2309 2309
 	 */
2310
-	public function set_ip( $value ) {
2311
-		$this->set_prop( 'ip', $value );
2310
+	public function set_ip($value) {
2311
+		$this->set_prop('ip', $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 ip address.
2319 2319
 	 */
2320
-	public function set_user_ip( $value ) {
2321
-		$this->set_ip( $value );
2320
+	public function set_user_ip($value) {
2321
+		$this->set_ip($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 first name.
2329 2329
 	 */
2330
-	public function set_first_name( $value ) {
2331
-		$this->set_prop( 'first_name', $value );
2330
+	public function set_first_name($value) {
2331
+		$this->set_prop('first_name', $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 first name.
2339 2339
 	 */
2340
-	public function set_user_first_name( $value ) {
2341
-		$this->set_first_name( $value );
2340
+	public function set_user_first_name($value) {
2341
+		$this->set_first_name($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 first name.
2349 2349
 	 */
2350
-	public function set_customer_first_name( $value ) {
2351
-		$this->set_first_name( $value );
2350
+	public function set_customer_first_name($value) {
2351
+		$this->set_first_name($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 last name.
2359 2359
 	 */
2360
-	public function set_last_name( $value ) {
2361
-		$this->set_prop( 'last_name', $value );
2360
+	public function set_last_name($value) {
2361
+		$this->set_prop('last_name', $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 last name.
2369 2369
 	 */
2370
-	public function set_user_last_name( $value ) {
2371
-		$this->set_last_name( $value );
2370
+	public function set_user_last_name($value) {
2371
+		$this->set_last_name($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 last name.
2379 2379
 	 */
2380
-	public function set_customer_last_name( $value ) {
2381
-		$this->set_last_name( $value );
2380
+	public function set_customer_last_name($value) {
2381
+		$this->set_last_name($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 phone.
2389 2389
 	 */
2390
-	public function set_phone( $value ) {
2391
-		$this->set_prop( 'phone', $value );
2390
+	public function set_phone($value) {
2391
+		$this->set_prop('phone', $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 phone.
2399 2399
 	 */
2400
-	public function set_user_phone( $value ) {
2401
-		$this->set_phone( $value );
2400
+	public function set_user_phone($value) {
2401
+		$this->set_phone($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 phone.
2409 2409
 	 */
2410
-	public function set_customer_phone( $value ) {
2411
-		$this->set_phone( $value );
2410
+	public function set_customer_phone($value) {
2411
+		$this->set_phone($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 phone.
2419 2419
 	 */
2420
-	public function set_phone_number( $value ) {
2421
-		$this->set_phone( $value );
2420
+	public function set_phone_number($value) {
2421
+		$this->set_phone($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 email address.
2429 2429
 	 */
2430
-	public function set_email( $value ) {
2431
-		$this->set_prop( 'email', $value );
2430
+	public function set_email($value) {
2431
+		$this->set_prop('email', $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 email address.
2439 2439
 	 */
2440
-	public function set_user_email( $value ) {
2441
-		$this->set_email( $value );
2440
+	public function set_user_email($value) {
2441
+		$this->set_email($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 email address.
2449 2449
 	 */
2450
-	public function set_email_address( $value ) {
2451
-		$this->set_email( $value );
2450
+	public function set_email_address($value) {
2451
+		$this->set_email($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 email address.
2459 2459
 	 */
2460
-	public function set_customer_email( $value ) {
2461
-		$this->set_email( $value );
2460
+	public function set_customer_email($value) {
2461
+		$this->set_email($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 country.
2469 2469
 	 */
2470
-	public function set_country( $value ) {
2471
-		$this->set_prop( 'country', $value );
2470
+	public function set_country($value) {
2471
+		$this->set_prop('country', $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 country.
2479 2479
 	 */
2480
-	public function set_user_country( $value ) {
2481
-		$this->set_country( $value );
2480
+	public function set_user_country($value) {
2481
+		$this->set_country($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 country.
2489 2489
 	 */
2490
-	public function set_customer_country( $value ) {
2491
-		$this->set_country( $value );
2490
+	public function set_customer_country($value) {
2491
+		$this->set_country($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  string $value state.
2499 2499
 	 */
2500
-	public function set_state( $value ) {
2501
-		$this->set_prop( 'state', $value );
2500
+	public function set_state($value) {
2501
+		$this->set_prop('state', $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 state.
2509 2509
 	 */
2510
-	public function set_user_state( $value ) {
2511
-		$this->set_state( $value );
2510
+	public function set_user_state($value) {
2511
+		$this->set_state($value);
2512 2512
     }
2513 2513
 
2514 2514
     /**
@@ -2517,8 +2517,8 @@  discard block
 block discarded – undo
2517 2517
 	 * @since 1.0.19
2518 2518
 	 * @param  string $value state.
2519 2519
 	 */
2520
-	public function set_customer_state( $value ) {
2521
-		$this->set_state( $value );
2520
+	public function set_customer_state($value) {
2521
+		$this->set_state($value);
2522 2522
     }
2523 2523
 
2524 2524
     /**
@@ -2527,8 +2527,8 @@  discard block
 block discarded – undo
2527 2527
 	 * @since 1.0.19
2528 2528
 	 * @param  string $value city.
2529 2529
 	 */
2530
-	public function set_city( $value ) {
2531
-		$this->set_prop( 'city', $value );
2530
+	public function set_city($value) {
2531
+		$this->set_prop('city', $value);
2532 2532
     }
2533 2533
 
2534 2534
     /**
@@ -2537,8 +2537,8 @@  discard block
 block discarded – undo
2537 2537
 	 * @since 1.0.19
2538 2538
 	 * @param  string $value city.
2539 2539
 	 */
2540
-	public function set_user_city( $value ) {
2541
-		$this->set_city( $value );
2540
+	public function set_user_city($value) {
2541
+		$this->set_city($value);
2542 2542
     }
2543 2543
 
2544 2544
     /**
@@ -2547,8 +2547,8 @@  discard block
 block discarded – undo
2547 2547
 	 * @since 1.0.19
2548 2548
 	 * @param  string $value city.
2549 2549
 	 */
2550
-	public function set_customer_city( $value ) {
2551
-		$this->set_city( $value );
2550
+	public function set_customer_city($value) {
2551
+		$this->set_city($value);
2552 2552
     }
2553 2553
 
2554 2554
     /**
@@ -2557,8 +2557,8 @@  discard block
 block discarded – undo
2557 2557
 	 * @since 1.0.19
2558 2558
 	 * @param  string $value zip.
2559 2559
 	 */
2560
-	public function set_zip( $value ) {
2561
-		$this->set_prop( 'zip', $value );
2560
+	public function set_zip($value) {
2561
+		$this->set_prop('zip', $value);
2562 2562
     }
2563 2563
 
2564 2564
     /**
@@ -2567,8 +2567,8 @@  discard block
 block discarded – undo
2567 2567
 	 * @since 1.0.19
2568 2568
 	 * @param  string $value zip.
2569 2569
 	 */
2570
-	public function set_user_zip( $value ) {
2571
-		$this->set_zip( $value );
2570
+	public function set_user_zip($value) {
2571
+		$this->set_zip($value);
2572 2572
     }
2573 2573
 
2574 2574
     /**
@@ -2577,8 +2577,8 @@  discard block
 block discarded – undo
2577 2577
 	 * @since 1.0.19
2578 2578
 	 * @param  string $value zip.
2579 2579
 	 */
2580
-	public function set_customer_zip( $value ) {
2581
-		$this->set_zip( $value );
2580
+	public function set_customer_zip($value) {
2581
+		$this->set_zip($value);
2582 2582
     }
2583 2583
 
2584 2584
     /**
@@ -2587,8 +2587,8 @@  discard block
 block discarded – undo
2587 2587
 	 * @since 1.0.19
2588 2588
 	 * @param  string $value company.
2589 2589
 	 */
2590
-	public function set_company( $value ) {
2591
-		$this->set_prop( 'company', $value );
2590
+	public function set_company($value) {
2591
+		$this->set_prop('company', $value);
2592 2592
     }
2593 2593
 
2594 2594
     /**
@@ -2597,8 +2597,8 @@  discard block
 block discarded – undo
2597 2597
 	 * @since 1.0.19
2598 2598
 	 * @param  string $value company.
2599 2599
 	 */
2600
-	public function set_user_company( $value ) {
2601
-		$this->set_company( $value );
2600
+	public function set_user_company($value) {
2601
+		$this->set_company($value);
2602 2602
     }
2603 2603
 
2604 2604
     /**
@@ -2607,8 +2607,8 @@  discard block
 block discarded – undo
2607 2607
 	 * @since 1.0.19
2608 2608
 	 * @param  string $value company.
2609 2609
 	 */
2610
-	public function set_customer_company( $value ) {
2611
-		$this->set_company( $value );
2610
+	public function set_customer_company($value) {
2611
+		$this->set_company($value);
2612 2612
     }
2613 2613
 
2614 2614
 	/**
@@ -2617,8 +2617,8 @@  discard block
 block discarded – undo
2617 2617
 	 * @since 1.0.19
2618 2618
 	 * @param  string $value company id.
2619 2619
 	 */
2620
-	public function set_company_id( $value ) {
2621
-		$this->set_prop( 'company_id', $value );
2620
+	public function set_company_id($value) {
2621
+		$this->set_prop('company_id', $value);
2622 2622
     }
2623 2623
 
2624 2624
     /**
@@ -2627,8 +2627,8 @@  discard block
 block discarded – undo
2627 2627
 	 * @since 1.0.19
2628 2628
 	 * @param  string $value var number.
2629 2629
 	 */
2630
-	public function set_vat_number( $value ) {
2631
-		$this->set_prop( 'vat_number', $value );
2630
+	public function set_vat_number($value) {
2631
+		$this->set_prop('vat_number', $value);
2632 2632
     }
2633 2633
 
2634 2634
     /**
@@ -2637,8 +2637,8 @@  discard block
 block discarded – undo
2637 2637
 	 * @since 1.0.19
2638 2638
 	 * @param  string $value var number.
2639 2639
 	 */
2640
-	public function set_user_vat_number( $value ) {
2641
-		$this->set_vat_number( $value );
2640
+	public function set_user_vat_number($value) {
2641
+		$this->set_vat_number($value);
2642 2642
     }
2643 2643
 
2644 2644
     /**
@@ -2647,8 +2647,8 @@  discard block
 block discarded – undo
2647 2647
 	 * @since 1.0.19
2648 2648
 	 * @param  string $value var number.
2649 2649
 	 */
2650
-	public function set_customer_vat_number( $value ) {
2651
-		$this->set_vat_number( $value );
2650
+	public function set_customer_vat_number($value) {
2651
+		$this->set_vat_number($value);
2652 2652
     }
2653 2653
 
2654 2654
     /**
@@ -2657,8 +2657,8 @@  discard block
 block discarded – undo
2657 2657
 	 * @since 1.0.19
2658 2658
 	 * @param  string $value var rate.
2659 2659
 	 */
2660
-	public function set_vat_rate( $value ) {
2661
-		$this->set_prop( 'vat_rate', $value );
2660
+	public function set_vat_rate($value) {
2661
+		$this->set_prop('vat_rate', $value);
2662 2662
     }
2663 2663
 
2664 2664
     /**
@@ -2667,8 +2667,8 @@  discard block
 block discarded – undo
2667 2667
 	 * @since 1.0.19
2668 2668
 	 * @param  string $value var number.
2669 2669
 	 */
2670
-	public function set_user_vat_rate( $value ) {
2671
-		$this->set_vat_rate( $value );
2670
+	public function set_user_vat_rate($value) {
2671
+		$this->set_vat_rate($value);
2672 2672
     }
2673 2673
 
2674 2674
     /**
@@ -2677,8 +2677,8 @@  discard block
 block discarded – undo
2677 2677
 	 * @since 1.0.19
2678 2678
 	 * @param  string $value var number.
2679 2679
 	 */
2680
-	public function set_customer_vat_rate( $value ) {
2681
-		$this->set_vat_rate( $value );
2680
+	public function set_customer_vat_rate($value) {
2681
+		$this->set_vat_rate($value);
2682 2682
     }
2683 2683
 
2684 2684
     /**
@@ -2687,8 +2687,8 @@  discard block
 block discarded – undo
2687 2687
 	 * @since 1.0.19
2688 2688
 	 * @param  string $value address.
2689 2689
 	 */
2690
-	public function set_address( $value ) {
2691
-		$this->set_prop( 'address', $value );
2690
+	public function set_address($value) {
2691
+		$this->set_prop('address', $value);
2692 2692
     }
2693 2693
 
2694 2694
     /**
@@ -2697,8 +2697,8 @@  discard block
 block discarded – undo
2697 2697
 	 * @since 1.0.19
2698 2698
 	 * @param  string $value address.
2699 2699
 	 */
2700
-	public function set_user_address( $value ) {
2701
-		$this->set_address( $value );
2700
+	public function set_user_address($value) {
2701
+		$this->set_address($value);
2702 2702
     }
2703 2703
 
2704 2704
     /**
@@ -2707,8 +2707,8 @@  discard block
 block discarded – undo
2707 2707
 	 * @since 1.0.19
2708 2708
 	 * @param  string $value address.
2709 2709
 	 */
2710
-	public function set_customer_address( $value ) {
2711
-		$this->set_address( $value );
2710
+	public function set_customer_address($value) {
2711
+		$this->set_address($value);
2712 2712
     }
2713 2713
 
2714 2714
     /**
@@ -2717,8 +2717,8 @@  discard block
 block discarded – undo
2717 2717
 	 * @since 1.0.19
2718 2718
 	 * @param  int|bool $value confirmed.
2719 2719
 	 */
2720
-	public function set_is_viewed( $value ) {
2721
-		$this->set_prop( 'is_viewed', $value );
2720
+	public function set_is_viewed($value) {
2721
+		$this->set_prop('is_viewed', $value);
2722 2722
 	}
2723 2723
 
2724 2724
 	/**
@@ -2727,8 +2727,8 @@  discard block
 block discarded – undo
2727 2727
 	 * @since 1.0.19
2728 2728
 	 * @param  string $value email recipients.
2729 2729
 	 */
2730
-	public function set_email_cc( $value ) {
2731
-		$this->set_prop( 'email_cc', $value );
2730
+	public function set_email_cc($value) {
2731
+		$this->set_prop('email_cc', $value);
2732 2732
 	}
2733 2733
 
2734 2734
 	/**
@@ -2737,9 +2737,9 @@  discard block
 block discarded – undo
2737 2737
 	 * @since 1.0.19
2738 2738
 	 * @param  string $value template.
2739 2739
 	 */
2740
-	public function set_template( $value ) {
2741
-		if ( in_array( $value, array( 'quantity', 'hours', 'amount' ) ) ) {
2742
-			$this->set_prop( 'template', $value );
2740
+	public function set_template($value) {
2741
+		if (in_array($value, array('quantity', 'hours', 'amount'))) {
2742
+			$this->set_prop('template', $value);
2743 2743
 		}
2744 2744
 	}
2745 2745
 
@@ -2750,8 +2750,8 @@  discard block
 block discarded – undo
2750 2750
 	 * @param  string $value source.
2751 2751
 	 * @deprecated
2752 2752
 	 */
2753
-	public function created_via( $value ) {
2754
-		$this->set_created_via( sanitize_text_field( $value ) );
2753
+	public function created_via($value) {
2754
+		$this->set_created_via(sanitize_text_field($value));
2755 2755
 	}
2756 2756
 
2757 2757
 	/**
@@ -2760,8 +2760,8 @@  discard block
 block discarded – undo
2760 2760
 	 * @since 1.0.19
2761 2761
 	 * @param  string $value source.
2762 2762
 	 */
2763
-	public function set_created_via( $value ) {
2764
-		$this->set_prop( 'created_via', sanitize_text_field( $value ) );
2763
+	public function set_created_via($value) {
2764
+		$this->set_prop('created_via', sanitize_text_field($value));
2765 2765
 	}
2766 2766
 
2767 2767
 	/**
@@ -2770,8 +2770,8 @@  discard block
 block discarded – undo
2770 2770
 	 * @since 1.0.19
2771 2771
 	 * @param  int|bool $value confirmed.
2772 2772
 	 */
2773
-	public function set_address_confirmed( $value ) {
2774
-		$this->set_prop( 'address_confirmed', $value );
2773
+	public function set_address_confirmed($value) {
2774
+		$this->set_prop('address_confirmed', $value);
2775 2775
     }
2776 2776
 
2777 2777
     /**
@@ -2780,8 +2780,8 @@  discard block
 block discarded – undo
2780 2780
 	 * @since 1.0.19
2781 2781
 	 * @param  int|bool $value confirmed.
2782 2782
 	 */
2783
-	public function set_user_address_confirmed( $value ) {
2784
-		$this->set_address_confirmed( $value );
2783
+	public function set_user_address_confirmed($value) {
2784
+		$this->set_address_confirmed($value);
2785 2785
     }
2786 2786
 
2787 2787
     /**
@@ -2790,8 +2790,8 @@  discard block
 block discarded – undo
2790 2790
 	 * @since 1.0.19
2791 2791
 	 * @param  int|bool $value confirmed.
2792 2792
 	 */
2793
-	public function set_customer_address_confirmed( $value ) {
2794
-		$this->set_address_confirmed( $value );
2793
+	public function set_customer_address_confirmed($value) {
2794
+		$this->set_address_confirmed($value);
2795 2795
     }
2796 2796
 
2797 2797
     /**
@@ -2800,8 +2800,8 @@  discard block
 block discarded – undo
2800 2800
 	 * @since 1.0.19
2801 2801
 	 * @param  float $value sub total.
2802 2802
 	 */
2803
-	public function set_subtotal( $value ) {
2804
-		$this->set_prop( 'subtotal', max( 0, $value ) );
2803
+	public function set_subtotal($value) {
2804
+		$this->set_prop('subtotal', max(0, $value));
2805 2805
 	}
2806 2806
 
2807 2807
 	/**
@@ -2810,8 +2810,8 @@  discard block
 block discarded – undo
2810 2810
 	 * @since 1.0.19
2811 2811
 	 * @param  float $value sub total.
2812 2812
 	 */
2813
-	public function set_total( $value ) {
2814
-		$this->set_prop( 'total', max( 0, $value ) );
2813
+	public function set_total($value) {
2814
+		$this->set_prop('total', max(0, $value));
2815 2815
     }
2816 2816
 
2817 2817
     /**
@@ -2820,8 +2820,8 @@  discard block
 block discarded – undo
2820 2820
 	 * @since 1.0.19
2821 2821
 	 * @param  float $value discount total.
2822 2822
 	 */
2823
-	public function set_total_discount( $value ) {
2824
-		$this->set_prop( 'total_discount', max( 0, $value ) );
2823
+	public function set_total_discount($value) {
2824
+		$this->set_prop('total_discount', max(0, $value));
2825 2825
     }
2826 2826
 
2827 2827
     /**
@@ -2830,8 +2830,8 @@  discard block
 block discarded – undo
2830 2830
 	 * @since 1.0.19
2831 2831
 	 * @param  float $value discount total.
2832 2832
 	 */
2833
-	public function set_discount( $value ) {
2834
-		$this->set_total_discount( $value );
2833
+	public function set_discount($value) {
2834
+		$this->set_total_discount($value);
2835 2835
     }
2836 2836
 
2837 2837
     /**
@@ -2840,8 +2840,8 @@  discard block
 block discarded – undo
2840 2840
 	 * @since 1.0.19
2841 2841
 	 * @param  float $value tax total.
2842 2842
 	 */
2843
-	public function set_total_tax( $value ) {
2844
-		$this->set_prop( 'total_tax', max( 0, $value ) );
2843
+	public function set_total_tax($value) {
2844
+		$this->set_prop('total_tax', max(0, $value));
2845 2845
     }
2846 2846
 
2847 2847
     /**
@@ -2850,8 +2850,8 @@  discard block
 block discarded – undo
2850 2850
 	 * @since 1.0.19
2851 2851
 	 * @param  float $value tax total.
2852 2852
 	 */
2853
-	public function set_tax_total( $value ) {
2854
-		$this->set_total_tax( $value );
2853
+	public function set_tax_total($value) {
2854
+		$this->set_total_tax($value);
2855 2855
     }
2856 2856
 
2857 2857
     /**
@@ -2860,8 +2860,8 @@  discard block
 block discarded – undo
2860 2860
 	 * @since 1.0.19
2861 2861
 	 * @param  float $value fees total.
2862 2862
 	 */
2863
-	public function set_total_fees( $value ) {
2864
-		$this->set_prop( 'total_fees', max( 0, $value ) );
2863
+	public function set_total_fees($value) {
2864
+		$this->set_prop('total_fees', max(0, $value));
2865 2865
     }
2866 2866
 
2867 2867
     /**
@@ -2870,8 +2870,8 @@  discard block
 block discarded – undo
2870 2870
 	 * @since 1.0.19
2871 2871
 	 * @param  float $value fees total.
2872 2872
 	 */
2873
-	public function set_fees_total( $value ) {
2874
-		$this->set_total_fees( $value );
2873
+	public function set_fees_total($value) {
2874
+		$this->set_total_fees($value);
2875 2875
     }
2876 2876
 
2877 2877
     /**
@@ -2880,13 +2880,13 @@  discard block
 block discarded – undo
2880 2880
 	 * @since 1.0.19
2881 2881
 	 * @param  array $value fees.
2882 2882
 	 */
2883
-	public function set_fees( $value ) {
2883
+	public function set_fees($value) {
2884 2884
 
2885
-		if ( ! is_array( $value ) ) {
2885
+		if (!is_array($value)) {
2886 2886
 			$value = array();
2887 2887
 		}
2888 2888
 
2889
-		$this->set_prop( 'fees', $value );
2889
+		$this->set_prop('fees', $value);
2890 2890
 
2891 2891
     }
2892 2892
 
@@ -2896,13 +2896,13 @@  discard block
 block discarded – undo
2896 2896
 	 * @since 1.0.19
2897 2897
 	 * @param  array $value taxes.
2898 2898
 	 */
2899
-	public function set_taxes( $value ) {
2899
+	public function set_taxes($value) {
2900 2900
 
2901
-		if ( ! is_array( $value ) ) {
2901
+		if (!is_array($value)) {
2902 2902
 			$value = array();
2903 2903
 		}
2904 2904
 
2905
-		$this->set_prop( 'taxes', $value );
2905
+		$this->set_prop('taxes', $value);
2906 2906
 
2907 2907
     }
2908 2908
 
@@ -2912,13 +2912,13 @@  discard block
 block discarded – undo
2912 2912
 	 * @since 1.0.19
2913 2913
 	 * @param  array $value discounts.
2914 2914
 	 */
2915
-	public function set_discounts( $value ) {
2915
+	public function set_discounts($value) {
2916 2916
 
2917
-		if ( ! is_array( $value ) ) {
2917
+		if (!is_array($value)) {
2918 2918
 			$value = array();
2919 2919
 		}
2920 2920
 
2921
-		$this->set_prop( 'discounts', $value );
2921
+		$this->set_prop('discounts', $value);
2922 2922
     }
2923 2923
 
2924 2924
     /**
@@ -2927,19 +2927,19 @@  discard block
 block discarded – undo
2927 2927
 	 * @since 1.0.19
2928 2928
 	 * @param  GetPaid_Form_Item[] $value items.
2929 2929
 	 */
2930
-	public function set_items( $value ) {
2930
+	public function set_items($value) {
2931 2931
 
2932 2932
         // Remove existing items.
2933
-        $this->set_prop( 'items', array() );
2933
+        $this->set_prop('items', array());
2934 2934
 		$this->recurring_item = null;
2935 2935
 
2936 2936
         // Ensure that we have an array.
2937
-        if ( ! is_array( $value ) ) {
2937
+        if (!is_array($value)) {
2938 2938
             return;
2939 2939
         }
2940 2940
 
2941
-        foreach ( $value as $item ) {
2942
-            $this->add_item( $item );
2941
+        foreach ($value as $item) {
2942
+            $this->add_item($item);
2943 2943
         }
2944 2944
 
2945 2945
     }
@@ -2950,8 +2950,8 @@  discard block
 block discarded – undo
2950 2950
 	 * @since 1.0.19
2951 2951
 	 * @param  int $value payment form.
2952 2952
 	 */
2953
-	public function set_payment_form( $value ) {
2954
-		$this->set_prop( 'payment_form', $value );
2953
+	public function set_payment_form($value) {
2954
+		$this->set_prop('payment_form', $value);
2955 2955
     }
2956 2956
 
2957 2957
     /**
@@ -2960,8 +2960,8 @@  discard block
 block discarded – undo
2960 2960
 	 * @since 1.0.19
2961 2961
 	 * @param  string $value submission id.
2962 2962
 	 */
2963
-	public function set_submission_id( $value ) {
2964
-		$this->set_prop( 'submission_id', $value );
2963
+	public function set_submission_id($value) {
2964
+		$this->set_prop('submission_id', $value);
2965 2965
     }
2966 2966
 
2967 2967
     /**
@@ -2970,8 +2970,8 @@  discard block
 block discarded – undo
2970 2970
 	 * @since 1.0.19
2971 2971
 	 * @param  string $value discount code.
2972 2972
 	 */
2973
-	public function set_discount_code( $value ) {
2974
-		$this->set_prop( 'discount_code', sanitize_text_field( $value ) );
2973
+	public function set_discount_code($value) {
2974
+		$this->set_prop('discount_code', sanitize_text_field($value));
2975 2975
     }
2976 2976
 
2977 2977
     /**
@@ -2980,8 +2980,8 @@  discard block
 block discarded – undo
2980 2980
 	 * @since 1.0.19
2981 2981
 	 * @param  string $value gateway.
2982 2982
 	 */
2983
-	public function set_gateway( $value ) {
2984
-		$this->set_prop( 'gateway', $value );
2983
+	public function set_gateway($value) {
2984
+		$this->set_prop('gateway', $value);
2985 2985
     }
2986 2986
 
2987 2987
     /**
@@ -2990,9 +2990,9 @@  discard block
 block discarded – undo
2990 2990
 	 * @since 1.0.19
2991 2991
 	 * @param  string $value transaction id.
2992 2992
 	 */
2993
-	public function set_transaction_id( $value ) {
2994
-		if ( ! empty( $value ) ) {
2995
-			$this->set_prop( 'transaction_id', $value );
2993
+	public function set_transaction_id($value) {
2994
+		if (!empty($value)) {
2995
+			$this->set_prop('transaction_id', $value);
2996 2996
 		}
2997 2997
     }
2998 2998
 
@@ -3002,8 +3002,8 @@  discard block
 block discarded – undo
3002 3002
 	 * @since 1.0.19
3003 3003
 	 * @param  string $value currency id.
3004 3004
 	 */
3005
-	public function set_currency( $value ) {
3006
-		$this->set_prop( 'currency', $value );
3005
+	public function set_currency($value) {
3006
+		$this->set_prop('currency', $value);
3007 3007
     }
3008 3008
 
3009 3009
 	/**
@@ -3012,8 +3012,8 @@  discard block
 block discarded – undo
3012 3012
 	 * @since 1.0.19
3013 3013
 	 * @param  bool $value value.
3014 3014
 	 */
3015
-	public function set_disable_taxes( $value ) {
3016
-		$this->set_prop( 'disable_taxes', (bool) $value );
3015
+	public function set_disable_taxes($value) {
3016
+		$this->set_prop('disable_taxes', (bool) $value);
3017 3017
 	}
3018 3018
 
3019 3019
     /**
@@ -3022,8 +3022,8 @@  discard block
 block discarded – undo
3022 3022
 	 * @since 1.0.19
3023 3023
 	 * @param  string $value subscription id.
3024 3024
 	 */
3025
-	public function set_subscription_id( $value ) {
3026
-		$this->set_prop( 'subscription_id', $value );
3025
+	public function set_subscription_id($value) {
3026
+		$this->set_prop('subscription_id', $value);
3027 3027
 	}
3028 3028
 	
3029 3029
 	/**
@@ -3032,8 +3032,8 @@  discard block
 block discarded – undo
3032 3032
 	 * @since 1.0.19
3033 3033
 	 * @param  string $value subscription id.
3034 3034
 	 */
3035
-	public function set_remote_subscription_id( $value ) {
3036
-		$this->set_prop( 'remote_subscription_id', $value );
3035
+	public function set_remote_subscription_id($value) {
3036
+		$this->set_prop('remote_subscription_id', $value);
3037 3037
     }
3038 3038
 
3039 3039
     /*
@@ -3050,28 +3050,28 @@  discard block
 block discarded – undo
3050 3050
      */
3051 3051
     public function is_parent() {
3052 3052
         $parent = $this->get_parent_id();
3053
-        return apply_filters( 'wpinv_invoice_is_parent', empty( $parent ), $this );
3053
+        return apply_filters('wpinv_invoice_is_parent', empty($parent), $this);
3054 3054
     }
3055 3055
 
3056 3056
     /**
3057 3057
      * Checks if this is a renewal invoice.
3058 3058
      */
3059 3059
     public function is_renewal() {
3060
-        return $this->is_recurring() && ! $this->is_parent();
3060
+        return $this->is_recurring() && !$this->is_parent();
3061 3061
     }
3062 3062
 
3063 3063
     /**
3064 3064
      * Checks if this is a recurring invoice.
3065 3065
      */
3066 3066
     public function is_recurring() {
3067
-        return ! empty( $this->recurring_item );
3067
+        return !empty($this->recurring_item);
3068 3068
     }
3069 3069
 
3070 3070
     /**
3071 3071
      * Checks if this is a taxable invoice.
3072 3072
      */
3073 3073
     public function is_taxable() {
3074
-        return ! $this->get_disable_taxes();
3074
+        return !$this->get_disable_taxes();
3075 3075
 	}
3076 3076
 
3077 3077
 	/**
@@ -3085,45 +3085,45 @@  discard block
 block discarded – undo
3085 3085
 	 * Checks to see if the invoice requires payment.
3086 3086
 	 */
3087 3087
 	public function is_free() {
3088
-        $is_free = ( (float) wpinv_round_amount( $this->get_initial_total() ) == 0 );
3088
+        $is_free = ((float) wpinv_round_amount($this->get_initial_total()) == 0);
3089 3089
 
3090
-		if ( $this->is_recurring() && $this->get_recurring_total() > 0 ) {
3090
+		if ($this->is_recurring() && $this->get_recurring_total() > 0) {
3091 3091
 			$is_free = false;
3092 3092
 		}
3093 3093
 
3094
-        return apply_filters( 'wpinv_invoice_is_free', $is_free, $this );
3094
+        return apply_filters('wpinv_invoice_is_free', $is_free, $this);
3095 3095
     }
3096 3096
 
3097 3097
     /**
3098 3098
      * Checks if the invoice is paid.
3099 3099
      */
3100 3100
     public function is_paid() {
3101
-        $is_paid = $this->has_status( array( 'publish', 'wpi-processing', 'wpi-renewal' ) );
3102
-        return apply_filters( 'wpinv_invoice_is_paid', $is_paid, $this );
3101
+        $is_paid = $this->has_status(array('publish', 'wpi-processing', 'wpi-renewal'));
3102
+        return apply_filters('wpinv_invoice_is_paid', $is_paid, $this);
3103 3103
 	}
3104 3104
 
3105 3105
 	/**
3106 3106
      * Checks if the invoice needs payment.
3107 3107
      */
3108 3108
 	public function needs_payment() {
3109
-		$needs_payment = ! $this->is_paid() && ! $this->is_refunded() && ! $this->is_free();
3110
-        return apply_filters( 'wpinv_needs_payment', $needs_payment, $this );
3109
+		$needs_payment = !$this->is_paid() && !$this->is_refunded() && !$this->is_free();
3110
+        return apply_filters('wpinv_needs_payment', $needs_payment, $this);
3111 3111
     }
3112 3112
   
3113 3113
 	/**
3114 3114
      * Checks if the invoice is refunded.
3115 3115
      */
3116 3116
 	public function is_refunded() {
3117
-        $is_refunded = $this->has_status( 'wpi-refunded' );
3118
-        return apply_filters( 'wpinv_invoice_is_refunded', $is_refunded, $this );
3117
+        $is_refunded = $this->has_status('wpi-refunded');
3118
+        return apply_filters('wpinv_invoice_is_refunded', $is_refunded, $this);
3119 3119
 	}
3120 3120
 
3121 3121
 	/**
3122 3122
      * Checks if the invoice is held.
3123 3123
      */
3124 3124
 	public function is_held() {
3125
-        $is_held = $this->has_status( 'wpi-onhold' );
3126
-        return apply_filters( 'wpinv_invoice_is_held', $is_held, $this );
3125
+        $is_held = $this->has_status('wpi-onhold');
3126
+        return apply_filters('wpinv_invoice_is_held', $is_held, $this);
3127 3127
 	}
3128 3128
 
3129 3129
 	/**
@@ -3131,30 +3131,30 @@  discard block
 block discarded – undo
3131 3131
      */
3132 3132
 	public function is_due() {
3133 3133
 		$due_date = $this->get_due_date();
3134
-		return empty( $due_date ) ? false : current_time( 'timestamp' ) > strtotime( $due_date );
3134
+		return empty($due_date) ? false : current_time('timestamp') > strtotime($due_date);
3135 3135
 	}
3136 3136
 
3137 3137
 	/**
3138 3138
      * Checks if the invoice is draft.
3139 3139
      */
3140 3140
 	public function is_draft() {
3141
-        return $this->has_status( 'draft, auto-draft' );
3141
+        return $this->has_status('draft, auto-draft');
3142 3142
 	}
3143 3143
 
3144 3144
     /**
3145 3145
      * Checks if the invoice has a given status.
3146 3146
      */
3147
-    public function has_status( $status ) {
3148
-        $status = wpinv_parse_list( $status );
3149
-        return apply_filters( 'wpinv_has_status', in_array( $this->get_status(), $status ), $status );
3147
+    public function has_status($status) {
3148
+        $status = wpinv_parse_list($status);
3149
+        return apply_filters('wpinv_has_status', in_array($this->get_status(), $status), $status);
3150 3150
 	}
3151 3151
 
3152 3152
 	/**
3153 3153
      * Checks if the invoice is of a given type.
3154 3154
      */
3155
-    public function is_type( $type ) {
3156
-        $type = wpinv_parse_list( $type );
3157
-        return in_array( $this->get_type(), $type );
3155
+    public function is_type($type) {
3156
+        $type = wpinv_parse_list($type);
3157
+        return in_array($this->get_type(), $type);
3158 3158
     }
3159 3159
 
3160 3160
     /**
@@ -3186,8 +3186,8 @@  discard block
 block discarded – undo
3186 3186
      *
3187 3187
      */
3188 3188
 	public function is_initial_free() {
3189
-        $is_initial_free = ! ( (float) wpinv_round_amount( $this->get_initial_total() ) > 0 );
3190
-        return apply_filters( 'wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this );
3189
+        $is_initial_free = !((float) wpinv_round_amount($this->get_initial_total()) > 0);
3190
+        return apply_filters('wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this);
3191 3191
     }
3192 3192
 	
3193 3193
 	/**
@@ -3197,11 +3197,11 @@  discard block
 block discarded – undo
3197 3197
     public function item_has_free_trial() {
3198 3198
 
3199 3199
         // Ensure we have a recurring item.
3200
-        if ( ! $this->is_recurring() ) {
3200
+        if (!$this->is_recurring()) {
3201 3201
             return false;
3202 3202
         }
3203 3203
 
3204
-        $item = $this->get_recurring( true );
3204
+        $item = $this->get_recurring(true);
3205 3205
         return $item->has_free_trial();
3206 3206
 	}
3207 3207
 
@@ -3209,7 +3209,7 @@  discard block
 block discarded – undo
3209 3209
      * Check if the free trial is a result of a discount.
3210 3210
      */
3211 3211
     public function is_free_trial_from_discount() {
3212
-		return $this->has_free_trial() && ! $this->item_has_free_trial();
3212
+		return $this->has_free_trial() && !$this->item_has_free_trial();
3213 3213
 	}
3214 3214
 	
3215 3215
 	/**
@@ -3217,12 +3217,12 @@  discard block
 block discarded – undo
3217 3217
      */
3218 3218
     public function discount_first_payment_only() {
3219 3219
 
3220
-		$discount = wpinv_get_discount_obj( $this->get_discount_code() );
3221
-        if ( ! $discount->exists() || ! $this->is_recurring() ) {
3220
+		$discount = wpinv_get_discount_obj($this->get_discount_code());
3221
+        if (!$discount->exists() || !$this->is_recurring()) {
3222 3222
             return true;
3223 3223
         }
3224 3224
 
3225
-        return ! $discount->get_is_recurring();
3225
+        return !$discount->get_is_recurring();
3226 3226
     }
3227 3227
 
3228 3228
     /*
@@ -3240,23 +3240,23 @@  discard block
 block discarded – undo
3240 3240
      * @param GetPaid_Form_Item|array $item
3241 3241
      * @return WP_Error|Bool
3242 3242
      */
3243
-    public function add_item( $item ) {
3243
+    public function add_item($item) {
3244 3244
 
3245
-		if ( is_array( $item ) ) {
3246
-			$item = $this->process_array_item( $item );
3245
+		if (is_array($item)) {
3246
+			$item = $this->process_array_item($item);
3247 3247
 		}
3248 3248
 
3249
-		if ( is_numeric( $item ) ) {
3250
-			$item = new GetPaid_Form_Item( $item );
3249
+		if (is_numeric($item)) {
3250
+			$item = new GetPaid_Form_Item($item);
3251 3251
 		}
3252 3252
 
3253 3253
         // Make sure that it is available for purchase.
3254
-		if ( $item->get_id() > 0 && ! $item->can_purchase() ) {
3255
-			return new WP_Error( 'invalid_item', __( 'This item is not available for purchase', 'invoicing' ) );
3254
+		if ($item->get_id() > 0 && !$item->can_purchase()) {
3255
+			return new WP_Error('invalid_item', __('This item is not available for purchase', 'invoicing'));
3256 3256
         }
3257 3257
 
3258 3258
         // Do we have a recurring item?
3259
-		if ( $item->is_recurring() ) {
3259
+		if ($item->is_recurring()) {
3260 3260
 			$this->recurring_item = $item->get_id();
3261 3261
         }
3262 3262
 
@@ -3264,9 +3264,9 @@  discard block
 block discarded – undo
3264 3264
         $item->invoice_id = (int) $this->get_id();
3265 3265
 
3266 3266
 		// Remove duplicates.
3267
-		$this->remove_item( $item->get_id() );
3267
+		$this->remove_item($item->get_id());
3268 3268
 
3269
-		if ( 0 == $item->get_quantity() ) {
3269
+		if (0 == $item->get_quantity()) {
3270 3270
 			return;
3271 3271
 		}
3272 3272
 
@@ -3276,7 +3276,7 @@  discard block
 block discarded – undo
3276 3276
 		// Add new item.
3277 3277
         $items[] = $item;
3278 3278
 
3279
-        $this->set_prop( 'items', $items );
3279
+        $this->set_prop('items', $items);
3280 3280
 
3281 3281
 		return true;
3282 3282
 	}
@@ -3287,26 +3287,26 @@  discard block
 block discarded – undo
3287 3287
 	 * @since 1.0.19
3288 3288
 	 * @return GetPaid_Form_Item
3289 3289
 	 */
3290
-	protected function process_array_item( $array ) {
3290
+	protected function process_array_item($array) {
3291 3291
 
3292
-		$item_id = isset( $array['item_id'] ) ? $array['item_id'] : 0;
3293
-		$item    = new GetPaid_Form_Item( $item_id );
3292
+		$item_id = isset($array['item_id']) ? $array['item_id'] : 0;
3293
+		$item    = new GetPaid_Form_Item($item_id);
3294 3294
 
3295 3295
 		// Set item data.
3296
-		foreach ( array( 'name', 'price', 'description' ) as $key ) {
3297
-			if ( isset( $array[ "item_$key" ] ) ) {
3296
+		foreach (array('name', 'price', 'description') as $key) {
3297
+			if (isset($array["item_$key"])) {
3298 3298
 				$method = "set_$key";
3299
-				$item->$method( $array[ "item_$key" ] );
3299
+				$item->$method($array["item_$key"]);
3300 3300
 			}
3301 3301
 		}
3302 3302
 
3303
-		if ( isset( $array['quantity'] ) ) {
3304
-			$item->set_quantity( $array['quantity'] );
3303
+		if (isset($array['quantity'])) {
3304
+			$item->set_quantity($array['quantity']);
3305 3305
 		}
3306 3306
 
3307 3307
 		// Set item meta.
3308
-		if ( isset( $array['meta'] ) && is_array( $array['meta'] ) ) {
3309
-			$item->set_item_meta( $array['meta'] );
3308
+		if (isset($array['meta']) && is_array($array['meta'])) {
3309
+			$item->set_item_meta($array['meta']);
3310 3310
 		}
3311 3311
 
3312 3312
 		return $item;
@@ -3319,10 +3319,10 @@  discard block
 block discarded – undo
3319 3319
 	 * @since 1.0.19
3320 3320
 	 * @return GetPaid_Form_Item|null
3321 3321
 	 */
3322
-	public function get_item( $item_id ) {
3322
+	public function get_item($item_id) {
3323 3323
 
3324
-		foreach ( $this->get_items() as $item ) {
3325
-			if ( (int) $item_id == $item->get_id() ) {
3324
+		foreach ($this->get_items() as $item) {
3325
+			if ((int) $item_id == $item->get_id()) {
3326 3326
 				return $item;
3327 3327
 			}
3328 3328
 		}
@@ -3335,16 +3335,16 @@  discard block
 block discarded – undo
3335 3335
 	 *
3336 3336
 	 * @since 1.0.19
3337 3337
 	 */
3338
-	public function remove_item( $item_id ) {
3338
+	public function remove_item($item_id) {
3339 3339
 		$items   = $this->get_items();
3340 3340
 		$item_id = (int) $item_id;
3341 3341
 
3342
-		foreach ( $items as $index => $item ) {
3343
-			if ( (int) $item_id == $item->get_id() ) {
3344
-				unset( $items[ $index ] );
3345
-				$this->set_prop( 'items', $items );
3342
+		foreach ($items as $index => $item) {
3343
+			if ((int) $item_id == $item->get_id()) {
3344
+				unset($items[$index]);
3345
+				$this->set_prop('items', $items);
3346 3346
 
3347
-				if ( $item_id == $this->recurring_item ) {
3347
+				if ($item_id == $this->recurring_item) {
3348 3348
 					$this->recurring_item = null;
3349 3349
 				}
3350 3350
 
@@ -3359,11 +3359,11 @@  discard block
 block discarded – undo
3359 3359
 	 * @param array $fee An array of fee details. name, initial_fee, and recurring_fee are required.
3360 3360
 	 * @since 1.0.19
3361 3361
 	 */
3362
-    public function add_fee( $fee ) {
3362
+    public function add_fee($fee) {
3363 3363
 
3364 3364
 		$fees                 = $this->get_fees();
3365
-		$fees[ $fee['name'] ] = $fee;
3366
-		$this->set_prop( 'fees', $fees );
3365
+		$fees[$fee['name']] = $fee;
3366
+		$this->set_prop('fees', $fees);
3367 3367
 
3368 3368
     }
3369 3369
 
@@ -3372,9 +3372,9 @@  discard block
 block discarded – undo
3372 3372
 	 *
3373 3373
 	 * @since 1.0.19
3374 3374
 	 */
3375
-	public function get_fee( $fee ) {
3375
+	public function get_fee($fee) {
3376 3376
         $fees = $this->get_fees();
3377
-		return isset( $fees[ $fee ] ) ? $fees[ $fee ] : null;
3377
+		return isset($fees[$fee]) ? $fees[$fee] : null;
3378 3378
     }
3379 3379
 
3380 3380
     /**
@@ -3382,11 +3382,11 @@  discard block
 block discarded – undo
3382 3382
 	 *
3383 3383
 	 * @since 1.0.19
3384 3384
 	 */
3385
-	public function remove_fee( $fee ) {
3385
+	public function remove_fee($fee) {
3386 3386
         $fees = $this->get_fees();
3387
-        if ( isset( $fees[ $fee ] ) ) {
3388
-            unset( $fees[ $fee ] );
3389
-            $this->set_prop( 'fees', $fees );
3387
+        if (isset($fees[$fee])) {
3388
+            unset($fees[$fee]);
3389
+            $this->set_prop('fees', $fees);
3390 3390
         }
3391 3391
     }
3392 3392
 
@@ -3396,11 +3396,11 @@  discard block
 block discarded – undo
3396 3396
 	 * @param array $discount An array of discount details. name, initial_discount, and recurring_discount are required. Include discount_code if the discount is from a discount code.
3397 3397
 	 * @since 1.0.19
3398 3398
 	 */
3399
-	public function add_discount( $discount ) {
3399
+	public function add_discount($discount) {
3400 3400
 
3401 3401
 		$discounts = $this->get_discounts();
3402
-		$discounts[ $discount['name'] ] = $discount;
3403
-		$this->set_prop( 'discounts', $discounts );
3402
+		$discounts[$discount['name']] = $discount;
3403
+		$this->set_prop('discounts', $discounts);
3404 3404
 
3405 3405
 	}
3406 3406
 
@@ -3410,15 +3410,15 @@  discard block
 block discarded – undo
3410 3410
 	 * @since 1.0.19
3411 3411
 	 * @return float
3412 3412
 	 */
3413
-	public function get_discount( $discount = false ) {
3413
+	public function get_discount($discount = false) {
3414 3414
 
3415 3415
 		// Backwards compatibilty.
3416
-		if ( empty( $discount ) ) {
3416
+		if (empty($discount)) {
3417 3417
 			return $this->get_total_discount();
3418 3418
 		}
3419 3419
 
3420 3420
         $discounts = $this->get_discounts();
3421
-		return isset( $discounts[ $discount ] ) ? $discounts[ $discount ] : null;
3421
+		return isset($discounts[$discount]) ? $discounts[$discount] : null;
3422 3422
     }
3423 3423
 
3424 3424
     /**
@@ -3426,15 +3426,15 @@  discard block
 block discarded – undo
3426 3426
 	 *
3427 3427
 	 * @since 1.0.19
3428 3428
 	 */
3429
-	public function remove_discount( $discount ) {
3429
+	public function remove_discount($discount) {
3430 3430
         $discounts = $this->get_discounts();
3431
-        if ( isset( $discounts[ $discount ] ) ) {
3432
-            unset( $discounts[ $discount ] );
3433
-            $this->set_prop( 'discounts', $discounts );
3431
+        if (isset($discounts[$discount])) {
3432
+            unset($discounts[$discount]);
3433
+            $this->set_prop('discounts', $discounts);
3434 3434
         }
3435 3435
 
3436
-		if ( 'discount_code' == $discount ) {
3437
-			foreach ( $this->get_items() as $item ) {
3436
+		if ('discount_code' == $discount) {
3437
+			foreach ($this->get_items() as $item) {
3438 3438
 				$item->item_discount           = 0;
3439 3439
 				$item->recurring_item_discount = 0;
3440 3440
 			}
@@ -3447,12 +3447,12 @@  discard block
 block discarded – undo
3447 3447
      *
3448 3448
      * @param array $tax An array of tax details. name, initial_tax, and recurring_tax are required.
3449 3449
      */
3450
-    public function add_tax( $tax ) {
3451
-        if ( $this->is_taxable() ) {
3450
+    public function add_tax($tax) {
3451
+        if ($this->is_taxable()) {
3452 3452
 
3453
-            $taxes                 = $this->get_taxes();
3454
-			$taxes[ $tax['name'] ] = $tax;
3455
-			$this->set_prop( 'taxes', $tax );
3453
+            $taxes = $this->get_taxes();
3454
+			$taxes[$tax['name']] = $tax;
3455
+			$this->set_prop('taxes', $tax);
3456 3456
 
3457 3457
         }
3458 3458
     }
@@ -3462,15 +3462,15 @@  discard block
 block discarded – undo
3462 3462
 	 *
3463 3463
 	 * @since 1.0.19
3464 3464
 	 */
3465
-	public function get_tax( $tax = null ) {
3465
+	public function get_tax($tax = null) {
3466 3466
 
3467 3467
 		// Backwards compatility.
3468
-		if ( empty( $tax ) ) {
3468
+		if (empty($tax)) {
3469 3469
 			return $this->get_total_tax();
3470 3470
 		}
3471 3471
 
3472 3472
         $taxes = $this->get_taxes();
3473
-		return isset( $taxes[ $tax ] ) ? $taxes[ $tax ] : null;
3473
+		return isset($taxes[$tax]) ? $taxes[$tax] : null;
3474 3474
     }
3475 3475
 
3476 3476
     /**
@@ -3478,11 +3478,11 @@  discard block
 block discarded – undo
3478 3478
 	 *
3479 3479
 	 * @since 1.0.19
3480 3480
 	 */
3481
-	public function remove_tax( $tax ) {
3481
+	public function remove_tax($tax) {
3482 3482
         $taxes = $this->get_taxes();
3483
-        if ( isset( $taxes[ $tax ] ) ) {
3484
-            unset( $taxes[ $tax ] );
3485
-            $this->set_prop( 'taxes', $taxes );
3483
+        if (isset($taxes[$tax])) {
3484
+            unset($taxes[$tax]);
3485
+            $this->set_prop('taxes', $taxes);
3486 3486
         }
3487 3487
     }
3488 3488
 
@@ -3493,22 +3493,22 @@  discard block
 block discarded – undo
3493 3493
 	 * @return float The recalculated subtotal
3494 3494
 	 */
3495 3495
 	public function recalculate_subtotal() {
3496
-        $items     = $this->get_items();
3496
+        $items = $this->get_items();
3497 3497
 		$subtotal  = 0;
3498 3498
 		$recurring = 0;
3499 3499
 
3500
-        foreach ( $items as $item ) {
3501
-			$subtotal  += $item->get_sub_total( 'edit' );
3502
-			$recurring += $item->get_recurring_sub_total( 'edit' );
3500
+        foreach ($items as $item) {
3501
+			$subtotal  += $item->get_sub_total('edit');
3502
+			$recurring += $item->get_recurring_sub_total('edit');
3503 3503
         }
3504 3504
 
3505
-		if ( wpinv_prices_include_tax() ) {
3506
-			$subtotal  = max( 0, $subtotal - $this->totals['tax']['initial'] );
3507
-			$recurring = max( 0, $recurring - $this->totals['tax']['recurring'] );
3505
+		if (wpinv_prices_include_tax()) {
3506
+			$subtotal  = max(0, $subtotal - $this->totals['tax']['initial']);
3507
+			$recurring = max(0, $recurring - $this->totals['tax']['recurring']);
3508 3508
 		}
3509 3509
 
3510 3510
 		$current = $this->is_renewal() ? $recurring : $subtotal;
3511
-		$this->set_subtotal( $current );
3511
+		$this->set_subtotal($current);
3512 3512
 
3513 3513
 		$this->totals['subtotal'] = array(
3514 3514
 			'initial'   => $subtotal,
@@ -3529,14 +3529,14 @@  discard block
 block discarded – undo
3529 3529
 		$discount  = 0;
3530 3530
 		$recurring = 0;
3531 3531
 
3532
-        foreach ( $discounts as $data ) {
3533
-			$discount  += wpinv_sanitize_amount( $data['initial_discount'] );
3534
-			$recurring += wpinv_sanitize_amount( $data['recurring_discount'] );
3532
+        foreach ($discounts as $data) {
3533
+			$discount  += wpinv_sanitize_amount($data['initial_discount']);
3534
+			$recurring += wpinv_sanitize_amount($data['recurring_discount']);
3535 3535
 		}
3536 3536
 
3537 3537
 		$current = $this->is_renewal() ? $recurring : $discount;
3538 3538
 
3539
-		$this->set_total_discount( $current );
3539
+		$this->set_total_discount($current);
3540 3540
 
3541 3541
 		$this->totals['discount'] = array(
3542 3542
 			'initial'   => $discount,
@@ -3557,13 +3557,13 @@  discard block
 block discarded – undo
3557 3557
 
3558 3558
 		// Maybe disable taxes.
3559 3559
 		$vat_number = $this->get_vat_number();
3560
-		$skip_tax   = GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $this->get_country() ) && ! empty( $vat_number );
3560
+		$skip_tax   = GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction($this->get_country()) && !empty($vat_number);
3561 3561
 
3562
-		if ( wpinv_is_base_country( $this->get_country() ) && 'vat_too' == wpinv_get_option( 'vat_same_country_rule', 'vat_too' ) ) {
3562
+		if (wpinv_is_base_country($this->get_country()) && 'vat_too' == wpinv_get_option('vat_same_country_rule', 'vat_too')) {
3563 3563
 			$skip_tax = false;
3564 3564
 		}
3565 3565
 
3566
-		if ( ! wpinv_use_taxes() || $this->get_disable_taxes() || ! wpinv_is_country_taxable( $this->get_country() ) || $skip_tax   ) {
3566
+		if (!wpinv_use_taxes() || $this->get_disable_taxes() || !wpinv_is_country_taxable($this->get_country()) || $skip_tax) {
3567 3567
 
3568 3568
 			$this->totals['tax'] = array(
3569 3569
 				'initial'   => 0,
@@ -3572,38 +3572,38 @@  discard block
 block discarded – undo
3572 3572
 
3573 3573
 			$this->tax_rate = 0;
3574 3574
 
3575
-			$this->set_taxes( array() );
3575
+			$this->set_taxes(array());
3576 3576
 			$current = 0;
3577 3577
 		} else {
3578 3578
 
3579 3579
 			$item_taxes = array();
3580 3580
 
3581
-			foreach ( $this->get_items() as $item ) {
3582
-				$rates    = getpaid_get_item_tax_rates( $item, $this->get_country(), $this->get_state() );
3583
-				$rates    = getpaid_filter_item_tax_rates( $item, $rates );
3584
-				$taxes    = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, false ), $rates );
3585
-				$r_taxes  = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, true ), $rates );
3586
-				foreach ( $taxes as $name => $amount ) {
3587
-					$recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0;
3588
-					$tax       = getpaid_prepare_item_tax( $item, $name, $amount, $recurring );
3589
-
3590
-					if ( ! isset( $item_taxes[ $name ] ) ) {
3591
-						$item_taxes[ $name ] = $tax;
3581
+			foreach ($this->get_items() as $item) {
3582
+				$rates    = getpaid_get_item_tax_rates($item, $this->get_country(), $this->get_state());
3583
+				$rates    = getpaid_filter_item_tax_rates($item, $rates);
3584
+				$taxes    = getpaid_calculate_item_taxes(getpaid_get_taxable_amount($item, false), $rates);
3585
+				$r_taxes  = getpaid_calculate_item_taxes(getpaid_get_taxable_amount($item, true), $rates);
3586
+				foreach ($taxes as $name => $amount) {
3587
+					$recurring = isset($r_taxes[$name]) ? $r_taxes[$name] : 0;
3588
+					$tax       = getpaid_prepare_item_tax($item, $name, $amount, $recurring);
3589
+
3590
+					if (!isset($item_taxes[$name])) {
3591
+						$item_taxes[$name] = $tax;
3592 3592
 						continue;
3593 3593
 					}
3594 3594
 
3595
-					$item_taxes[ $name ]['initial_tax']   += $tax['initial_tax'];
3596
-					$item_taxes[ $name ]['recurring_tax'] += $tax['recurring_tax'];
3595
+					$item_taxes[$name]['initial_tax']   += $tax['initial_tax'];
3596
+					$item_taxes[$name]['recurring_tax'] += $tax['recurring_tax'];
3597 3597
 
3598 3598
 				}
3599 3599
 
3600 3600
 			}
3601 3601
 
3602
-			$item_taxes = array_replace( $this->get_taxes(), $item_taxes );
3603
-			$this->set_taxes( $item_taxes );
3602
+			$item_taxes = array_replace($this->get_taxes(), $item_taxes);
3603
+			$this->set_taxes($item_taxes);
3604 3604
 
3605
-			$initial_tax   = array_sum( wp_list_pluck( $item_taxes, 'initial_tax' ) );
3606
-			$recurring_tax = array_sum( wp_list_pluck( $item_taxes, 'recurring_tax' ) );
3605
+			$initial_tax   = array_sum(wp_list_pluck($item_taxes, 'initial_tax'));
3606
+			$recurring_tax = array_sum(wp_list_pluck($item_taxes, 'recurring_tax'));
3607 3607
 
3608 3608
 			$current = $this->is_renewal() ? $recurring_tax : $initial_tax;
3609 3609
 
@@ -3614,7 +3614,7 @@  discard block
 block discarded – undo
3614 3614
 
3615 3615
 		}
3616 3616
 
3617
-		$this->set_total_tax( $current );
3617
+		$this->set_total_tax($current);
3618 3618
 
3619 3619
 		return $current;
3620 3620
 
@@ -3631,20 +3631,20 @@  discard block
 block discarded – undo
3631 3631
 		$fee       = 0;
3632 3632
 		$recurring = 0;
3633 3633
 
3634
-        foreach ( $fees as $data ) {
3635
-			$fee       += wpinv_sanitize_amount( $data['initial_fee'] );
3636
-			$recurring += wpinv_sanitize_amount( $data['recurring_fee'] );
3634
+        foreach ($fees as $data) {
3635
+			$fee       += wpinv_sanitize_amount($data['initial_fee']);
3636
+			$recurring += wpinv_sanitize_amount($data['recurring_fee']);
3637 3637
 		}
3638 3638
 
3639 3639
 		$current = $this->is_renewal() ? $recurring : $fee;
3640
-		$this->set_total_fees( $current );
3640
+		$this->set_total_fees($current);
3641 3641
 
3642 3642
 		$this->totals['fee'] = array(
3643 3643
 			'initial'   => $fee,
3644 3644
 			'recurring' => $recurring,
3645 3645
 		);
3646 3646
 
3647
-        $this->set_total_fees( $fee );
3647
+        $this->set_total_fees($fee);
3648 3648
         return $current;
3649 3649
     }
3650 3650
 
@@ -3659,7 +3659,7 @@  discard block
 block discarded – undo
3659 3659
         $this->recalculate_total_discount();
3660 3660
 		$this->recalculate_total_tax();
3661 3661
 		$this->recalculate_subtotal();
3662
-		$this->set_total( $this->get_total_tax( 'edit' ) + $this->get_total_fees( 'edit' ) + $this->get_subtotal( 'edit' ) - $this->get_total_discount( 'edit' ) );
3662
+		$this->set_total($this->get_total_tax('edit') + $this->get_total_fees('edit') + $this->get_subtotal('edit') - $this->get_total_discount('edit'));
3663 3663
 		return $this->get_total();
3664 3664
 	}
3665 3665
 
@@ -3668,7 +3668,7 @@  discard block
 block discarded – undo
3668 3668
 	 */
3669 3669
     public function recalculate_totals() {
3670 3670
         $this->recalculate_total();
3671
-        $this->save( true );
3671
+        $this->save(true);
3672 3672
         return $this;
3673 3673
     }
3674 3674
 
@@ -3686,8 +3686,8 @@  discard block
 block discarded – undo
3686 3686
 	 * @return int|false The new note's ID on success, false on failure.
3687 3687
      *
3688 3688
      */
3689
-    public function add_system_note( $note ) {
3690
-		return $this->add_note( $note, false, false, true );
3689
+    public function add_system_note($note) {
3690
+		return $this->add_note($note, false, false, true);
3691 3691
 	}
3692 3692
 
3693 3693
     /**
@@ -3697,10 +3697,10 @@  discard block
 block discarded – undo
3697 3697
 	 * @return int|false The new note's ID on success, false on failure.
3698 3698
      *
3699 3699
      */
3700
-    public function add_note( $note = '', $customer_type = false, $added_by_user = false, $system = false ) {
3700
+    public function add_note($note = '', $customer_type = false, $added_by_user = false, $system = false) {
3701 3701
 
3702 3702
         // Bail if no note specified or this invoice is not yet saved.
3703
-        if ( ! $note || $this->get_id() == 0 || ( ! is_user_logged_in() && ! $system ) ) {
3703
+        if (!$note || $this->get_id() == 0 || (!is_user_logged_in() && !$system)) {
3704 3704
             return false;
3705 3705
         }
3706 3706
 
@@ -3708,23 +3708,23 @@  discard block
 block discarded – undo
3708 3708
 		$author_email = '[email protected]';
3709 3709
 
3710 3710
 		// If this is an admin comment or it has been added by the user.
3711
-		if ( is_user_logged_in() && ( ! $system || $added_by_user ) ) {
3712
-			$user         = get_user_by( 'id', get_current_user_id() );
3711
+		if (is_user_logged_in() && (!$system || $added_by_user)) {
3712
+			$user = get_user_by('id', get_current_user_id());
3713 3713
             $author       = $user->display_name;
3714 3714
             $author_email = $user->user_email;
3715 3715
 		}
3716 3716
 
3717
-		return getpaid_notes()->add_invoice_note( $this, $note, $author, $author_email, $customer_type );
3717
+		return getpaid_notes()->add_invoice_note($this, $note, $author, $author_email, $customer_type);
3718 3718
 
3719 3719
 	}
3720 3720
 
3721 3721
 	/**
3722 3722
      * Generates a unique key for the invoice.
3723 3723
      */
3724
-    public function generate_key( $string = '' ) {
3725
-        $auth_key  = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
3724
+    public function generate_key($string = '') {
3725
+        $auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
3726 3726
         return strtolower(
3727
-            $string . md5( $this->get_id() . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'wpinv', true ) )
3727
+            $string . md5($this->get_id() . date('Y-m-d H:i:s') . $auth_key . uniqid('wpinv', true))
3728 3728
         );
3729 3729
     }
3730 3730
 
@@ -3734,11 +3734,11 @@  discard block
 block discarded – undo
3734 3734
     public function generate_number() {
3735 3735
         $number = $this->get_id();
3736 3736
 
3737
-        if ( wpinv_sequential_number_active( $this->get_post_type() ) ) {
3738
-            $number = wpinv_get_next_invoice_number( $this->get_post_type() );
3737
+        if (wpinv_sequential_number_active($this->get_post_type())) {
3738
+            $number = wpinv_get_next_invoice_number($this->get_post_type());
3739 3739
         }
3740 3740
 
3741
-		return wpinv_format_invoice_number( $number, $this->get_post_type() );
3741
+		return wpinv_format_invoice_number($number, $this->get_post_type());
3742 3742
 
3743 3743
 	}
3744 3744
 
@@ -3751,55 +3751,55 @@  discard block
 block discarded – undo
3751 3751
 		// Reset status transition variable.
3752 3752
 		$this->status_transition = false;
3753 3753
 
3754
-		if ( $status_transition ) {
3754
+		if ($status_transition) {
3755 3755
 			try {
3756 3756
 
3757 3757
 				// Fire a hook for the status change.
3758
-				do_action( 'getpaid_invoice_status_' . $status_transition['to'], $this, $status_transition );
3758
+				do_action('getpaid_invoice_status_' . $status_transition['to'], $this, $status_transition);
3759 3759
 
3760 3760
 				// @deprecated this is deprecated and will be removed in the future.
3761
-				do_action( 'wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3761
+				do_action('wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from']);
3762 3762
 
3763
-				if ( ! empty( $status_transition['from'] ) ) {
3763
+				if (!empty($status_transition['from'])) {
3764 3764
 
3765 3765
 					/* translators: 1: old invoice status 2: new invoice status */
3766
-					$transition_note = sprintf( __( 'Status changed from %1$s to %2$s.', 'invoicing' ), wpinv_status_nicename( $status_transition['from'], $this ), wpinv_status_nicename( $status_transition['to'], $this  ) );
3766
+					$transition_note = sprintf(__('Status changed from %1$s to %2$s.', 'invoicing'), wpinv_status_nicename($status_transition['from'], $this), wpinv_status_nicename($status_transition['to'], $this));
3767 3767
 
3768 3768
 					// Fire another hook.
3769
-					do_action( 'getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this );
3770
-					do_action( 'getpaid_invoice_status_changed', $this, $status_transition['from'], $status_transition['to'] );
3769
+					do_action('getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this);
3770
+					do_action('getpaid_invoice_status_changed', $this, $status_transition['from'], $status_transition['to']);
3771 3771
 
3772 3772
 					// @deprecated this is deprecated and will be removed in the future.
3773
-					do_action( 'wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3773
+					do_action('wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from']);
3774 3774
 
3775 3775
 					// Note the transition occurred.
3776
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), false, $status_transition['manual'] );
3776
+					$this->add_note(trim($status_transition['note'] . ' ' . $transition_note), false, $status_transition['manual']);
3777 3777
 
3778 3778
 					// Work out if this was for a payment, and trigger a payment_status hook instead.
3779 3779
 					if (
3780
-						in_array( $status_transition['from'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
3781
-						&& in_array( $status_transition['to'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3780
+						in_array($status_transition['from'], array('wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold'), true)
3781
+						&& in_array($status_transition['to'], array('publish', 'wpi-processing', 'wpi-renewal'), true)
3782 3782
 					) {
3783
-						do_action( 'getpaid_invoice_payment_status_changed', $this, $status_transition );
3783
+						do_action('getpaid_invoice_payment_status_changed', $this, $status_transition);
3784 3784
 					}
3785 3785
 
3786 3786
 					// Work out if this was for a payment reversal, and trigger a payment_status_reversed hook instead.
3787 3787
 					if (
3788
-						in_array( $status_transition['from'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3789
-						&& in_array( $status_transition['to'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
3788
+						in_array($status_transition['from'], array('publish', 'wpi-processing', 'wpi-renewal'), true)
3789
+						&& in_array($status_transition['to'], array('wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold'), true)
3790 3790
 					) {
3791
-						do_action( 'getpaid_invoice_payment_status_reversed', $this, $status_transition );
3791
+						do_action('getpaid_invoice_payment_status_reversed', $this, $status_transition);
3792 3792
 					}
3793 3793
 				} else {
3794 3794
 					/* translators: %s: new invoice status */
3795
-					$transition_note = sprintf( __( 'Status set to %s.', 'invoicing' ), wpinv_status_nicename( $status_transition['to'], $this  ) );
3795
+					$transition_note = sprintf(__('Status set to %s.', 'invoicing'), wpinv_status_nicename($status_transition['to'], $this));
3796 3796
 
3797 3797
 					// Note the transition occurred.
3798
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
3798
+					$this->add_note(trim($status_transition['note'] . ' ' . $transition_note), 0, $status_transition['manual']);
3799 3799
 
3800 3800
 				}
3801
-			} catch ( Exception $e ) {
3802
-				$this->add_note( __( 'Error during status transition.', 'invoicing' ) . ' ' . $e->getMessage() );
3801
+			} catch (Exception $e) {
3802
+				$this->add_note(__('Error during status transition.', 'invoicing') . ' ' . $e->getMessage());
3803 3803
 			}
3804 3804
 		}
3805 3805
 	}
@@ -3807,13 +3807,13 @@  discard block
 block discarded – undo
3807 3807
 	/**
3808 3808
 	 * Updates an invoice status.
3809 3809
 	 */
3810
-	public function update_status( $new_status = false, $note = '', $manual = false ) {
3810
+	public function update_status($new_status = false, $note = '', $manual = false) {
3811 3811
 
3812 3812
 		// Fires before updating a status.
3813
-		do_action( 'wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status( 'edit' ) );
3813
+		do_action('wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status('edit'));
3814 3814
 
3815 3815
 		// Update the status.
3816
-		$this->set_status( $new_status, $note, $manual );
3816
+		$this->set_status($new_status, $note, $manual);
3817 3817
 
3818 3818
 		// Save the order.
3819 3819
 		return $this->save();
@@ -3824,18 +3824,18 @@  discard block
 block discarded – undo
3824 3824
 	 * @deprecated
3825 3825
 	 */
3826 3826
 	public function refresh_item_ids() {
3827
-        $item_ids = implode( ',', array_unique( wp_list_pluck( $this->get_cart_details(), 'item_id' ) ) );
3828
-        update_post_meta( $this->get_id(), '_wpinv_item_ids', $item_ids );
3827
+        $item_ids = implode(',', array_unique(wp_list_pluck($this->get_cart_details(), 'item_id')));
3828
+        update_post_meta($this->get_id(), '_wpinv_item_ids', $item_ids);
3829 3829
 	}
3830 3830
 
3831 3831
 	/**
3832 3832
 	 * @deprecated
3833 3833
 	 */
3834
-	public function update_items( $temp = false ) {
3834
+	public function update_items($temp = false) {
3835 3835
 
3836
-		$this->set_items( $this->get_items() );
3836
+		$this->set_items($this->get_items());
3837 3837
 
3838
-		if ( ! $temp ) {
3838
+		if (!$temp) {
3839 3839
 			$this->save();
3840 3840
 		}
3841 3841
 
@@ -3849,11 +3849,11 @@  discard block
 block discarded – undo
3849 3849
 
3850 3850
         $discount_code = $this->get_discount_code();
3851 3851
 
3852
-        if ( empty( $discount_code ) ) {
3852
+        if (empty($discount_code)) {
3853 3853
             return false;
3854 3854
         }
3855 3855
 
3856
-        $discount = wpinv_get_discount_obj( $discount_code );
3856
+        $discount = wpinv_get_discount_obj($discount_code);
3857 3857
 
3858 3858
         // Ensure it is active.
3859 3859
         return $discount->exists();
@@ -3864,7 +3864,7 @@  discard block
 block discarded – undo
3864 3864
 	 * Refunds an invoice.
3865 3865
 	 */
3866 3866
     public function refund() {
3867
-		$this->set_status( 'wpi-refunded' );
3867
+		$this->set_status('wpi-refunded');
3868 3868
         $this->save();
3869 3869
 	}
3870 3870
 
@@ -3873,53 +3873,53 @@  discard block
 block discarded – undo
3873 3873
 	 * 
3874 3874
 	 * @param string $transaction_id
3875 3875
 	 */
3876
-    public function mark_paid( $transaction_id = null, $note = '' ) {
3876
+    public function mark_paid($transaction_id = null, $note = '') {
3877 3877
 
3878 3878
 		// Set the transaction id.
3879
-		if ( empty( $transaction_id ) ) {
3879
+		if (empty($transaction_id)) {
3880 3880
 			$transaction_id = $this->generate_key('trans_');
3881 3881
 		}
3882 3882
 
3883
-		if ( ! $this->get_transaction_id() ) {
3884
-			$this->set_transaction_id( $transaction_id );
3883
+		if (!$this->get_transaction_id()) {
3884
+			$this->set_transaction_id($transaction_id);
3885 3885
 		}
3886 3886
 
3887
-		if ( $this->is_paid() && 'wpi-processing' != $this->get_status() ) {
3887
+		if ($this->is_paid() && 'wpi-processing' != $this->get_status()) {
3888 3888
 			return $this->save();
3889 3889
 		}
3890 3890
 
3891 3891
 		// Set the completed date.
3892
-		$this->set_date_completed( current_time( 'mysql' ) );
3892
+		$this->set_date_completed(current_time('mysql'));
3893 3893
 
3894 3894
 		// Set the new status.
3895
-		$gateway = sanitize_text_field( $this->get_gateway_title() );
3896
-		if ( $this->is_renewal() || ! $this->is_parent() ) {
3895
+		$gateway = sanitize_text_field($this->get_gateway_title());
3896
+		if ($this->is_renewal() || !$this->is_parent()) {
3897 3897
 
3898
-			$_note = wp_sprintf( __( 'Renewed via %s', 'invoicing' ), $gateway );
3899
-			$_note = $_note . empty( $note ) ? '' : " ($note)";
3898
+			$_note = wp_sprintf(__('Renewed via %s', 'invoicing'), $gateway);
3899
+			$_note = $_note . empty($note) ? '' : " ($note)";
3900 3900
 
3901
-			if ( 'none' == $this->get_gateway() ) {
3901
+			if ('none' == $this->get_gateway()) {
3902 3902
 				$_note = $note;
3903 3903
 			}
3904 3904
 
3905
-			$this->set_status( 'wpi-renewal', $_note );
3905
+			$this->set_status('wpi-renewal', $_note);
3906 3906
 
3907 3907
 		} else {
3908 3908
 
3909
-			$_note = wp_sprintf( __( 'Paid via %s', 'invoicing' ), $gateway );
3910
-			$_note = $_note . empty( $note ) ? '' : " ($note)";
3909
+			$_note = wp_sprintf(__('Paid via %s', 'invoicing'), $gateway);
3910
+			$_note = $_note . empty($note) ? '' : " ($note)";
3911 3911
 
3912
-			if ( 'none' == $this->get_gateway() ) {
3912
+			if ('none' == $this->get_gateway()) {
3913 3913
 				$_note = $note;
3914 3914
 			}
3915 3915
 
3916
-			$this->set_status( 'publish', $_note );
3916
+			$this->set_status('publish', $_note);
3917 3917
 
3918 3918
 		}
3919 3919
 
3920 3920
 		// Set checkout mode.
3921
-		$mode = wpinv_is_test_mode( $this->get_gateway() ) ? 'test' : 'live';
3922
-		$this->set_mode( $mode );
3921
+		$mode = wpinv_is_test_mode($this->get_gateway()) ? 'test' : 'live';
3922
+		$this->set_mode($mode);
3923 3923
 
3924 3924
 		// Save the invoice.
3925 3925
         $this->save();
@@ -3944,9 +3944,9 @@  discard block
 block discarded – undo
3944 3944
      * Clears the subscription's cache.
3945 3945
      */
3946 3946
     public function clear_cache() {
3947
-		wp_cache_delete( $this->get_key(), 'getpaid_invoice_keys_to_invoice_ids' );
3948
-		wp_cache_delete( $this->get_number(), 'getpaid_invoice_numbers_to_invoice_ids' );
3949
-		wp_cache_delete( $this->get_transaction_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids' );
3947
+		wp_cache_delete($this->get_key(), 'getpaid_invoice_keys_to_invoice_ids');
3948
+		wp_cache_delete($this->get_number(), 'getpaid_invoice_numbers_to_invoice_ids');
3949
+		wp_cache_delete($this->get_transaction_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids');
3950 3950
 	}
3951 3951
 
3952 3952
 }
Please login to merge, or discard this patch.
includes/admin/class-getpaid-admin.php 1 patch
Spacing   +270 added lines, -270 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * The main admin class.
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
     /**
38 38
 	 * Class constructor.
39 39
 	 */
40
-	public function __construct(){
40
+	public function __construct() {
41 41
 
42
-        $this->admin_path  = plugin_dir_path( __FILE__ );
43
-		$this->admin_url   = plugins_url( '/', __FILE__ );
42
+        $this->admin_path = plugin_dir_path(__FILE__);
43
+		$this->admin_url   = plugins_url('/', __FILE__);
44 44
 		$this->reports     = new GetPaid_Reports();
45 45
 
46
-        if ( is_admin() ) {
46
+        if (is_admin()) {
47 47
 			$this->init_admin_hooks();
48 48
         }
49 49
 
@@ -54,32 +54,32 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 */
56 56
 	private function init_admin_hooks() {
57
-        add_action( 'admin_enqueue_scripts', array( $this, 'enqeue_scripts' ), 9 );
58
-        add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
59
-        add_action( 'admin_init', array( $this, 'init_ayecode_connect_helper' ) );
60
-        add_action( 'admin_init', array( $this, 'activation_redirect') );
61
-        add_action( 'admin_init', array( $this, 'maybe_do_admin_action') );
62
-		add_action( 'admin_notices', array( $this, 'show_notices' ) );
63
-		add_action( 'getpaid_authenticated_admin_action_rate_plugin', array( $this, 'redirect_to_wordpress_rating_page' ) );
64
-		add_action( 'getpaid_authenticated_admin_action_duplicate_form', array( $this, 'duplicate_payment_form' ) );
65
-		add_action( 'getpaid_authenticated_admin_action_send_invoice', array( $this, 'send_customer_invoice' ) );
66
-		add_action( 'getpaid_authenticated_admin_action_send_invoice_reminder', array( $this, 'send_customer_payment_reminder' ) );
67
-        add_action( 'getpaid_authenticated_admin_action_reset_tax_rates', array( $this, 'admin_reset_tax_rates' ) );
68
-		add_action( 'getpaid_authenticated_admin_action_create_missing_pages', array( $this, 'admin_create_missing_pages' ) );
69
-		add_action( 'getpaid_authenticated_admin_action_create_missing_tables', array( $this, 'admin_create_missing_tables' ) );
70
-		add_action( 'getpaid_authenticated_admin_action_migrate_old_invoices', array( $this, 'admin_migrate_old_invoices' ) );
71
-		add_action( 'getpaid_authenticated_admin_action_download_customers', array( $this, 'admin_download_customers' ) );
72
-		add_action( 'getpaid_authenticated_admin_action_recalculate_discounts', array( $this, 'admin_recalculate_discounts' ) );
73
-		add_action( 'getpaid_authenticated_admin_action_install_plugin', array( $this, 'admin_install_plugin' ) );
74
-		add_action( 'getpaid_authenticated_admin_action_connect_gateway', array( $this, 'admin_connect_gateway' ) );
75
-		add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) );
76
-		do_action( 'getpaid_init_admin_hooks', $this );
57
+        add_action('admin_enqueue_scripts', array($this, 'enqeue_scripts'), 9);
58
+        add_filter('admin_body_class', array($this, 'admin_body_class'));
59
+        add_action('admin_init', array($this, 'init_ayecode_connect_helper'));
60
+        add_action('admin_init', array($this, 'activation_redirect'));
61
+        add_action('admin_init', array($this, 'maybe_do_admin_action'));
62
+		add_action('admin_notices', array($this, 'show_notices'));
63
+		add_action('getpaid_authenticated_admin_action_rate_plugin', array($this, 'redirect_to_wordpress_rating_page'));
64
+		add_action('getpaid_authenticated_admin_action_duplicate_form', array($this, 'duplicate_payment_form'));
65
+		add_action('getpaid_authenticated_admin_action_send_invoice', array($this, 'send_customer_invoice'));
66
+		add_action('getpaid_authenticated_admin_action_send_invoice_reminder', array($this, 'send_customer_payment_reminder'));
67
+        add_action('getpaid_authenticated_admin_action_reset_tax_rates', array($this, 'admin_reset_tax_rates'));
68
+		add_action('getpaid_authenticated_admin_action_create_missing_pages', array($this, 'admin_create_missing_pages'));
69
+		add_action('getpaid_authenticated_admin_action_create_missing_tables', array($this, 'admin_create_missing_tables'));
70
+		add_action('getpaid_authenticated_admin_action_migrate_old_invoices', array($this, 'admin_migrate_old_invoices'));
71
+		add_action('getpaid_authenticated_admin_action_download_customers', array($this, 'admin_download_customers'));
72
+		add_action('getpaid_authenticated_admin_action_recalculate_discounts', array($this, 'admin_recalculate_discounts'));
73
+		add_action('getpaid_authenticated_admin_action_install_plugin', array($this, 'admin_install_plugin'));
74
+		add_action('getpaid_authenticated_admin_action_connect_gateway', array($this, 'admin_connect_gateway'));
75
+		add_filter('admin_footer_text', array($this, 'admin_footer_text'));
76
+		do_action('getpaid_init_admin_hooks', $this);
77 77
 
78 78
 		// Setup/welcome
79
-		if ( ! empty( $_GET['page'] ) ) {
80
-			switch ( $_GET['page'] ) {
79
+		if (!empty($_GET['page'])) {
80
+			switch ($_GET['page']) {
81 81
 				case 'gp-setup' :
82
-					include_once( dirname( __FILE__ ) . '/class-getpaid-admin-setup-wizard.php' );
82
+					include_once(dirname(__FILE__) . '/class-getpaid-admin-setup-wizard.php');
83 83
 					break;
84 84
 			}
85 85
 		}
@@ -93,37 +93,37 @@  discard block
 block discarded – undo
93 93
 	public function enqeue_scripts() {
94 94
         global $current_screen, $pagenow;
95 95
 
96
-		$page    = isset( $_GET['page'] ) ? $_GET['page'] : '';
96
+		$page    = isset($_GET['page']) ? $_GET['page'] : '';
97 97
 		$editing = $pagenow == 'post.php' || $pagenow == 'post-new.php';
98 98
 
99
-        if ( ! empty( $current_screen->post_type ) ) {
99
+        if (!empty($current_screen->post_type)) {
100 100
 			$page = $current_screen->post_type;
101 101
         }
102 102
 
103 103
         // General styles.
104
-        if ( false !== stripos( $page, 'wpi' ) || false !== stripos( $page, 'getpaid' ) || 'gp-setup' == $page ) {
104
+        if (false !== stripos($page, 'wpi') || false !== stripos($page, 'getpaid') || 'gp-setup' == $page) {
105 105
 
106 106
             // Styles.
107
-            $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/admin.css' );
108
-            wp_enqueue_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array( 'wp-color-picker' ), $version );
109
-            wp_enqueue_style( 'select2', WPINV_PLUGIN_URL . 'assets/css/select2/select2.min.css', array(), '4.0.13', 'all' );
107
+            $version = filemtime(WPINV_PLUGIN_DIR . 'assets/css/admin.css');
108
+            wp_enqueue_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array('wp-color-picker'), $version);
109
+            wp_enqueue_style('select2', WPINV_PLUGIN_URL . 'assets/css/select2/select2.min.css', array(), '4.0.13', 'all');
110 110
 
111 111
             // Scripts.
112
-            wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full.min.js', array( 'jquery' ), WPINV_VERSION );
112
+            wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full.min.js', array('jquery'), WPINV_VERSION);
113 113
 
114
-            $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin.js' );
115
-            wp_enqueue_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array( 'jquery', 'wp-color-picker', 'jquery-ui-tooltip' ),  $version );
116
-            wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', apply_filters( 'wpinv_admin_js_localize', $this->get_admin_i18() ) );
114
+            $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin.js');
115
+            wp_enqueue_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array('jquery', 'wp-color-picker', 'jquery-ui-tooltip'), $version);
116
+            wp_localize_script('wpinv-admin-script', 'WPInv_Admin', apply_filters('wpinv_admin_js_localize', $this->get_admin_i18()));
117 117
 
118 118
         }
119 119
 
120 120
         // Payment form scripts.
121
-		if ( 'wpi_payment_form' == $page && $editing ) {
121
+		if ('wpi_payment_form' == $page && $editing) {
122 122
             $this->load_payment_form_scripts();
123 123
         }
124 124
 
125
-		if ( $page == 'wpinv-subscriptions' ) {
126
-			wp_enqueue_script( 'postbox' );
125
+		if ($page == 'wpinv-subscriptions') {
126
+			wp_enqueue_script('postbox');
127 127
 		}
128 128
 
129 129
     }
@@ -136,32 +136,32 @@  discard block
 block discarded – undo
136 136
         global $post;
137 137
 
138 138
 		$date_range = array(
139
-			'period' => isset( $_GET['date_range'] ) ? sanitize_text_field( $_GET['date_range'] ) : '7_days'
139
+			'period' => isset($_GET['date_range']) ? sanitize_text_field($_GET['date_range']) : '7_days'
140 140
 		);
141 141
 
142
-		if ( $date_range['period'] == 'custom' ) {
142
+		if ($date_range['period'] == 'custom') {
143 143
 			
144
-			if ( isset( $_GET['from'] ) ) {
145
-				$date_range[ 'after' ] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['from'] ), current_time( 'timestamp' ) ) - DAY_IN_SECONDS );
144
+			if (isset($_GET['from'])) {
145
+				$date_range['after'] = date('Y-m-d', strtotime(sanitize_text_field($_GET['from']), current_time('timestamp')) - DAY_IN_SECONDS);
146 146
 			}
147 147
 
148
-			if ( isset( $_GET['to'] ) ) {
149
-				$date_range[ 'before' ] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['to'] ), current_time( 'timestamp' ) ) + DAY_IN_SECONDS );
148
+			if (isset($_GET['to'])) {
149
+				$date_range['before'] = date('Y-m-d', strtotime(sanitize_text_field($_GET['to']), current_time('timestamp')) + DAY_IN_SECONDS);
150 150
 			}
151 151
 
152 152
 		}
153 153
 
154 154
         $i18n = array(
155
-            'ajax_url'                  => admin_url( 'admin-ajax.php' ),
156
-            'post_ID'                   => isset( $post->ID ) ? $post->ID : '',
157
-			'wpinv_nonce'               => wp_create_nonce( 'wpinv-nonce' ),
158
-			'rest_nonce'                => wp_create_nonce( 'wp_rest' ),
159
-			'rest_root'                 => esc_url_raw( rest_url() ),
155
+            'ajax_url'                  => admin_url('admin-ajax.php'),
156
+            'post_ID'                   => isset($post->ID) ? $post->ID : '',
157
+			'wpinv_nonce'               => wp_create_nonce('wpinv-nonce'),
158
+			'rest_nonce'                => wp_create_nonce('wp_rest'),
159
+			'rest_root'                 => esc_url_raw(rest_url()),
160 160
 			'date_range'                => $date_range,
161
-            'add_invoice_note_nonce'    => wp_create_nonce( 'add-invoice-note' ),
162
-            'delete_invoice_note_nonce' => wp_create_nonce( 'delete-invoice-note' ),
163
-            'invoice_item_nonce'        => wp_create_nonce( 'invoice-item' ),
164
-            'billing_details_nonce'     => wp_create_nonce( 'get-billing-details' ),
161
+            'add_invoice_note_nonce'    => wp_create_nonce('add-invoice-note'),
162
+            'delete_invoice_note_nonce' => wp_create_nonce('delete-invoice-note'),
163
+            'invoice_item_nonce'        => wp_create_nonce('invoice-item'),
164
+            'billing_details_nonce'     => wp_create_nonce('get-billing-details'),
165 165
             'tax'                       => wpinv_tax_amount(),
166 166
             'discount'                  => 0,
167 167
 			'currency_symbol'           => wpinv_currency_symbol(),
@@ -170,38 +170,38 @@  discard block
 block discarded – undo
170 170
             'thousand_sep'              => wpinv_thousands_separator(),
171 171
             'decimal_sep'               => wpinv_decimal_separator(),
172 172
             'decimals'                  => wpinv_decimals(),
173
-            'save_invoice'              => __( 'Save Invoice', 'invoicing' ),
174
-            'status_publish'            => wpinv_status_nicename( 'publish' ),
175
-            'status_pending'            => wpinv_status_nicename( 'wpi-pending' ),
176
-            'delete_tax_rate'           => __( 'Are you sure you wish to delete this tax rate?', 'invoicing' ),
177
-            'status_pending'            => wpinv_status_nicename( 'wpi-pending' ),
178
-            'FillBillingDetails'        => __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' ),
179
-            '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' ),
180
-            'AreYouSure'                => __( 'Are you sure?', 'invoicing' ),
181
-            'errDeleteItem'             => __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' ),
182
-            'delete_subscription'       => __( 'Are you sure you want to delete this subscription?', 'invoicing' ),
183
-            'action_edit'               => __( 'Edit', 'invoicing' ),
184
-            'action_cancel'             => __( 'Cancel', 'invoicing' ),
185
-            'item_description'          => __( 'Item Description', 'invoicing' ),
186
-            'invoice_description'       => __( 'Invoice Description', 'invoicing' ),
187
-            'discount_description'      => __( 'Discount Description', 'invoicing' ),
188
-			'searching'                 => __( 'Searching', 'invoicing' ),
189
-			'loading'                   => __( 'Loading...', 'invoicing' ),
190
-			'search_customers'          => __( 'Enter customer name or email', 'invoicing' ),
191
-			'search_items'              => __( 'Enter item name', 'invoicing' ),
173
+            'save_invoice'              => __('Save Invoice', 'invoicing'),
174
+            'status_publish'            => wpinv_status_nicename('publish'),
175
+            'status_pending'            => wpinv_status_nicename('wpi-pending'),
176
+            'delete_tax_rate'           => __('Are you sure you wish to delete this tax rate?', 'invoicing'),
177
+            'status_pending'            => wpinv_status_nicename('wpi-pending'),
178
+            'FillBillingDetails'        => __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing'),
179
+            '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'),
180
+            'AreYouSure'                => __('Are you sure?', 'invoicing'),
181
+            'errDeleteItem'             => __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing'),
182
+            'delete_subscription'       => __('Are you sure you want to delete this subscription?', 'invoicing'),
183
+            'action_edit'               => __('Edit', 'invoicing'),
184
+            'action_cancel'             => __('Cancel', 'invoicing'),
185
+            'item_description'          => __('Item Description', 'invoicing'),
186
+            'invoice_description'       => __('Invoice Description', 'invoicing'),
187
+            'discount_description'      => __('Discount Description', 'invoicing'),
188
+			'searching'                 => __('Searching', 'invoicing'),
189
+			'loading'                   => __('Loading...', 'invoicing'),
190
+			'search_customers'          => __('Enter customer name or email', 'invoicing'),
191
+			'search_items'              => __('Enter item name', 'invoicing'),
192 192
         );
193 193
 
194
-		if ( ! empty( $post ) && getpaid_is_invoice_post_type( $post->post_type ) ) {
194
+		if (!empty($post) && getpaid_is_invoice_post_type($post->post_type)) {
195 195
 
196
-			$invoice              = new WPInv_Invoice( $post );
196
+			$invoice              = new WPInv_Invoice($post);
197 197
 			$i18n['save_invoice'] = sprintf(
198
-				__( 'Save %s', 'invoicing' ),
199
-				ucfirst( $invoice->get_invoice_quote_type() )
198
+				__('Save %s', 'invoicing'),
199
+				ucfirst($invoice->get_invoice_quote_type())
200 200
 			);
201 201
 
202 202
 			$i18n['invoice_description'] = sprintf(
203
-				__( '%s Description', 'invoicing' ),
204
-				ucfirst( $invoice->get_invoice_quote_type() )
203
+				__('%s Description', 'invoicing'),
204
+				ucfirst($invoice->get_invoice_quote_type())
205 205
 			);
206 206
 
207 207
 		}
@@ -215,24 +215,24 @@  discard block
 block discarded – undo
215 215
 	 * @param  string $footer_text
216 216
 	 * @return string
217 217
 	 */
218
-	public function admin_footer_text( $footer_text ) {
218
+	public function admin_footer_text($footer_text) {
219 219
 		global $current_screen;
220 220
 
221
-		$page    = isset( $_GET['page'] ) ? $_GET['page'] : '';
221
+		$page = isset($_GET['page']) ? $_GET['page'] : '';
222 222
 
223
-        if ( ! empty( $current_screen->post_type ) ) {
223
+        if (!empty($current_screen->post_type)) {
224 224
 			$page = $current_screen->post_type;
225 225
         }
226 226
 
227 227
         // General styles.
228
-        if ( apply_filters( 'getpaid_display_admin_footer_text', wpinv_current_user_can_manage_invoicing() ) && false !== stripos( $page, 'wpi' ) ) {
228
+        if (apply_filters('getpaid_display_admin_footer_text', wpinv_current_user_can_manage_invoicing()) && false !== stripos($page, 'wpi')) {
229 229
 
230 230
 			// Change the footer text
231
-			if ( ! get_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', true ) ) {
231
+			if (!get_user_meta(get_current_user_id(), 'getpaid_admin_footer_text_rated', true)) {
232 232
 
233
-				$rating_url  = esc_url(
233
+				$rating_url = esc_url(
234 234
 					wp_nonce_url(
235
-						admin_url( 'admin.php?page=wpinv-reports&getpaid-admin-action=rate_plugin' ),
235
+						admin_url('admin.php?page=wpinv-reports&getpaid-admin-action=rate_plugin'),
236 236
 						'getpaid-nonce',
237 237
 						'getpaid-nonce'
238 238
 						)
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
 				$footer_text = sprintf(
242 242
 					/* translators: %s: five stars */
243
-					__( 'If you like <strong>GetPaid</strong>, please leave us a %s rating. A huge thanks in advance!', 'invoicing' ),
243
+					__('If you like <strong>GetPaid</strong>, please leave us a %s rating. A huge thanks in advance!', 'invoicing'),
244 244
 					"<a href='$rating_url'>&#9733;&#9733;&#9733;&#9733;&#9733;</a>"
245 245
 				);
246 246
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
 				$footer_text = sprintf(
250 250
 					/* translators: %s: GetPaid */
251
-					__( 'Thank you for using %s!', 'invoicing' ),
251
+					__('Thank you for using %s!', 'invoicing'),
252 252
 					"<a href='https://wpgetpaid.com/' target='_blank'><strong>GetPaid</strong></a>"
253 253
 				);
254 254
 
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
 	 * @since  2.0.0
266 266
 	 */
267 267
 	public function redirect_to_wordpress_rating_page() {
268
-		update_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', 1 );
269
-		wp_redirect( 'https://wordpress.org/support/plugin/invoicing/reviews?rate=5#new-post' );
268
+		update_user_meta(get_current_user_id(), 'getpaid_admin_footer_text_rated', 1);
269
+		wp_redirect('https://wordpress.org/support/plugin/invoicing/reviews?rate=5#new-post');
270 270
 		exit;
271 271
 	}
272 272
 
@@ -277,30 +277,30 @@  discard block
 block discarded – undo
277 277
 	protected function load_payment_form_scripts() {
278 278
         global $post;
279 279
 
280
-        wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.min.js', array(), WPINV_VERSION );
281
-		wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION );
282
-		wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION );
280
+        wp_enqueue_script('vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.min.js', array(), WPINV_VERSION);
281
+		wp_enqueue_script('sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION);
282
+		wp_enqueue_script('vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array('sortable', 'vue'), WPINV_VERSION);
283 283
 
284
-		$version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' );
285
-		wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable', 'wp-hooks' ),  $version );
284
+		$version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js');
285
+		wp_register_script('wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array('wpinv-admin-script', 'vue_draggable', 'wp-hooks'), $version);
286 286
 
287 287
 		wp_localize_script(
288 288
             'wpinv-admin-payment-form-script',
289 289
             'wpinvPaymentFormAdmin',
290 290
             array(
291
-				'elements'      => wpinv_get_data( 'payment-form-elements' ),
292
-				'form_elements' => getpaid_get_payment_form_elements( $post->ID ),
291
+				'elements'      => wpinv_get_data('payment-form-elements'),
292
+				'form_elements' => getpaid_get_payment_form_elements($post->ID),
293 293
 				'currency'      => wpinv_currency_symbol(),
294 294
 				'position'      => wpinv_currency_position(),
295 295
 				'decimals'      => (int) wpinv_decimals(),
296 296
 				'thousands_sep' => wpinv_thousands_separator(),
297 297
 				'decimals_sep'  => wpinv_decimal_separator(),
298
-				'form_items'    => gepaid_get_form_items( $post->ID ),
298
+				'form_items'    => gepaid_get_form_items($post->ID),
299 299
 				'is_default'    => $post->ID == wpinv_get_default_payment_form(),
300 300
             )
301 301
         );
302 302
 
303
-        wp_enqueue_script( 'wpinv-admin-payment-form-script' );
303
+        wp_enqueue_script('wpinv-admin-payment-form-script');
304 304
 
305 305
     }
306 306
 
@@ -311,25 +311,25 @@  discard block
 block discarded – undo
311 311
      * @return string
312 312
 	 *
313 313
 	 */
314
-    public function admin_body_class( $classes ) {
314
+    public function admin_body_class($classes) {
315 315
 		global $pagenow, $post, $current_screen;
316 316
 
317 317
 
318
-        $page = isset( $_GET['page'] ) ? $_GET['page'] : '';
318
+        $page = isset($_GET['page']) ? $_GET['page'] : '';
319 319
 
320
-        if ( ! empty( $current_screen->post_type ) ) {
320
+        if (!empty($current_screen->post_type)) {
321 321
 			$page = $current_screen->post_type;
322 322
         }
323 323
 
324
-        if ( false !== stripos( $page, 'wpi' ) ) {
325
-            $classes .= ' wpi-' . sanitize_key( $page );
324
+        if (false !== stripos($page, 'wpi')) {
325
+            $classes .= ' wpi-' . sanitize_key($page);
326 326
         }
327 327
 
328
-        if ( in_array( $page, wpinv_parse_list( 'wpi_invoice wpi_payment_form wpi_quote' ) ) ) {
328
+        if (in_array($page, wpinv_parse_list('wpi_invoice wpi_payment_form wpi_quote'))) {
329 329
             $classes .= ' wpinv-cpt wpinv';
330 330
 		}
331 331
 		
332
-		if ( getpaid_is_invoice_post_type( $page ) ) {
332
+		if (getpaid_is_invoice_post_type($page)) {
333 333
             $classes .= ' getpaid-is-invoice-cpt';
334 334
         }
335 335
 
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
     /**
340 340
 	 * Maybe show the AyeCode Connect Notice.
341 341
 	 */
342
-	public function init_ayecode_connect_helper(){
342
+	public function init_ayecode_connect_helper() {
343 343
 
344 344
 		// Register with the deactivation survey class.
345 345
 		AyeCode_Deactivation_Survey::instance(array(
@@ -347,20 +347,20 @@  discard block
 block discarded – undo
347 347
 			'version'	        => WPINV_VERSION,
348 348
 			'support_url'       => 'https://wpgetpaid.com/support/',
349 349
 			'documentation_url' => 'https://docs.wpgetpaid.com/',
350
-			'activated'         => (int) get_option( 'gepaid_installed_on' ),
350
+			'activated'         => (int) get_option('gepaid_installed_on'),
351 351
 		));
352 352
 
353 353
         new AyeCode_Connect_Helper(
354 354
             array(
355
-				'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"),
356
-				'connect_external'  => __( "Please confirm you wish to connect your site?","invoicing" ),
357
-				'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>" ),
358
-				'connect_button'    => __("Connect Site","invoicing"),
359
-				'connecting_button'    => __("Connecting...","invoicing"),
360
-				'error_localhost'   => __( "This service will only work with a live domain, not a localhost.","invoicing" ),
361
-				'error'             => __( "Something went wrong, please refresh and try again.","invoicing" ),
355
+				'connect_title' => __("WP Invoicing - an AyeCode product!", "invoicing"),
356
+				'connect_external'  => __("Please confirm you wish to connect your site?", "invoicing"),
357
+				'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>"),
358
+				'connect_button'    => __("Connect Site", "invoicing"),
359
+				'connecting_button'    => __("Connecting...", "invoicing"),
360
+				'error_localhost'   => __("This service will only work with a live domain, not a localhost.", "invoicing"),
361
+				'error'             => __("Something went wrong, please refresh and try again.", "invoicing"),
362 362
             ),
363
-            array( 'wpi-addons' )
363
+            array('wpi-addons')
364 364
         );
365 365
 
366 366
     }
@@ -372,20 +372,20 @@  discard block
 block discarded – undo
372 372
 	 */
373 373
 	public function activation_redirect() {
374 374
 
375
-		$redirected = get_option( 'wpinv_redirected_to_settings' );
375
+		$redirected = get_option('wpinv_redirected_to_settings');
376 376
 
377
-		if ( ! empty( $redirected ) || wp_doing_ajax() || ! current_user_can( 'manage_options' ) ) {
377
+		if (!empty($redirected) || wp_doing_ajax() || !current_user_can('manage_options')) {
378 378
 			return;
379 379
 		}
380 380
 
381 381
 		// Bail if activating from network, or bulk
382
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
382
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
383 383
 			return;
384 384
 		}
385 385
 
386
-	    update_option( 'wpinv_redirected_to_settings', 1 );
386
+	    update_option('wpinv_redirected_to_settings', 1);
387 387
 
388
-        wp_safe_redirect( admin_url( 'index.php?page=gp-setup' ) );
388
+        wp_safe_redirect(admin_url('index.php?page=gp-setup'));
389 389
         exit;
390 390
 
391 391
 	}
@@ -395,9 +395,9 @@  discard block
 block discarded – undo
395 395
      */
396 396
     public function maybe_do_admin_action() {
397 397
 
398
-        if ( wpinv_current_user_can_manage_invoicing() && isset( $_REQUEST['getpaid-admin-action'] ) && isset( $_REQUEST['getpaid-nonce'] ) && wp_verify_nonce( $_REQUEST['getpaid-nonce'], 'getpaid-nonce' ) ) {
399
-            $key = sanitize_key( $_REQUEST['getpaid-admin-action'] );
400
-            do_action( "getpaid_authenticated_admin_action_$key", $_REQUEST );
398
+        if (wpinv_current_user_can_manage_invoicing() && isset($_REQUEST['getpaid-admin-action']) && isset($_REQUEST['getpaid-nonce']) && wp_verify_nonce($_REQUEST['getpaid-nonce'], 'getpaid-nonce')) {
399
+            $key = sanitize_key($_REQUEST['getpaid-admin-action']);
400
+            do_action("getpaid_authenticated_admin_action_$key", $_REQUEST);
401 401
         }
402 402
 
403 403
     }
@@ -407,34 +407,34 @@  discard block
 block discarded – undo
407 407
 	 * 
408 408
 	 * @param array $args
409 409
      */
410
-    public function duplicate_payment_form( $args ) {
410
+    public function duplicate_payment_form($args) {
411 411
 
412
-		if ( empty( $args['form_id'] ) ) {
412
+		if (empty($args['form_id'])) {
413 413
 			return;
414 414
 		}
415 415
 
416
-		$form = new GetPaid_Payment_Form( $args['form_id'] );
416
+		$form = new GetPaid_Payment_Form($args['form_id']);
417 417
 
418
-		if ( ! $form->exists() ) {
418
+		if (!$form->exists()) {
419 419
 			return;
420 420
 		}
421 421
 
422 422
 		$new_form = new GetPaid_Payment_Form();
423
-		$new_form->set_author( $form->get_author( 'edit' ) );
424
-		$new_form->set_name( $form->get_name( 'edit' ) . __( '(copy)', 'invoicing' ) );
425
-		$new_form->set_elements( $form->get_elements( 'edit' ) );
426
-		$new_form->set_items( $form->get_items( 'edit' ) );
423
+		$new_form->set_author($form->get_author('edit'));
424
+		$new_form->set_name($form->get_name('edit') . __('(copy)', 'invoicing'));
425
+		$new_form->set_elements($form->get_elements('edit'));
426
+		$new_form->set_items($form->get_items('edit'));
427 427
 		$new_form->save();
428 428
 
429
-		if ( $new_form->exists() ) {
430
-			$this->show_success( __( 'Form duplicated successfully', 'invoicing' ) );
431
-			$url = get_edit_post_link( $new_form->get_id(), 'edit' );
429
+		if ($new_form->exists()) {
430
+			$this->show_success(__('Form duplicated successfully', 'invoicing'));
431
+			$url = get_edit_post_link($new_form->get_id(), 'edit');
432 432
 		} else {
433
-			$this->show_error( __( 'Unable to duplicate form', 'invoicing' ) );
434
-			$url = remove_query_arg( array( 'getpaid-admin-action', 'form_id', 'getpaid-nonce' ) );
433
+			$this->show_error(__('Unable to duplicate form', 'invoicing'));
434
+			$url = remove_query_arg(array('getpaid-admin-action', 'form_id', 'getpaid-nonce'));
435 435
 		}
436 436
 
437
-		wp_redirect( $url );
437
+		wp_redirect($url);
438 438
 		exit;
439 439
 	}
440 440
 
@@ -443,16 +443,16 @@  discard block
 block discarded – undo
443 443
 	 * 
444 444
 	 * @param array $args
445 445
      */
446
-    public function send_customer_invoice( $args ) {
447
-		$sent = getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $args['invoice_id'] ), true );
446
+    public function send_customer_invoice($args) {
447
+		$sent = getpaid()->get('invoice_emails')->user_invoice(new WPInv_Invoice($args['invoice_id']), true);
448 448
 
449
-		if ( $sent ) {
450
-			$this->show_success( __( 'Invoice was successfully sent to the customer', 'invoicing' ) );
449
+		if ($sent) {
450
+			$this->show_success(__('Invoice was successfully sent to the customer', 'invoicing'));
451 451
 		} else {
452
-			$this->show_error( __( 'Could not send the invoice to the customer', 'invoicing' ) );
452
+			$this->show_error(__('Could not send the invoice to the customer', 'invoicing'));
453 453
 		}
454 454
 
455
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
455
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce', 'invoice_id')));
456 456
 		exit;
457 457
 	}
458 458
 
@@ -461,16 +461,16 @@  discard block
 block discarded – undo
461 461
 	 * 
462 462
 	 * @param array $args
463 463
      */
464
-    public function send_customer_payment_reminder( $args ) {
465
-		$sent = getpaid()->get( 'invoice_emails' )->force_send_overdue_notice( new WPInv_Invoice( $args['invoice_id'] ) );
464
+    public function send_customer_payment_reminder($args) {
465
+		$sent = getpaid()->get('invoice_emails')->force_send_overdue_notice(new WPInv_Invoice($args['invoice_id']));
466 466
 
467
-		if ( $sent ) {
468
-			$this->show_success( __( 'Payment reminder was successfully sent to the customer', 'invoicing' ) );
467
+		if ($sent) {
468
+			$this->show_success(__('Payment reminder was successfully sent to the customer', 'invoicing'));
469 469
 		} else {
470
-			$this->show_error( __( 'Could not sent payment reminder to the customer', 'invoicing' ) );
470
+			$this->show_error(__('Could not sent payment reminder to the customer', 'invoicing'));
471 471
 		}
472 472
 
473
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
473
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce', 'invoice_id')));
474 474
 		exit;
475 475
 	}
476 476
 
@@ -480,8 +480,8 @@  discard block
 block discarded – undo
480 480
      */
481 481
     public function admin_reset_tax_rates() {
482 482
 
483
-		update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) );
484
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
483
+		update_option('wpinv_tax_rates', wpinv_get_data('tax-rates'));
484
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
485 485
 		exit;
486 486
 
487 487
 	}
@@ -493,8 +493,8 @@  discard block
 block discarded – undo
493 493
     public function admin_create_missing_pages() {
494 494
 		$installer = new GetPaid_Installer();
495 495
 		$installer->create_pages();
496
-		$this->show_success( __( 'GetPaid pages updated.', 'invoicing' ) );
497
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
496
+		$this->show_success(__('GetPaid pages updated.', 'invoicing'));
497
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
498 498
 		exit;
499 499
 	}
500 500
 
@@ -506,35 +506,35 @@  discard block
 block discarded – undo
506 506
 		global $wpdb;
507 507
 		$installer = new GetPaid_Installer();
508 508
 
509
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}wpinv_subscriptions'" ) != $wpdb->prefix . 'wpinv_subscriptions' ) {
509
+		if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}wpinv_subscriptions'") != $wpdb->prefix . 'wpinv_subscriptions') {
510 510
 			$installer->create_subscriptions_table();
511 511
 
512
-			if ( $wpdb->last_error !== '' ) {
513
-				$this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error );
512
+			if ($wpdb->last_error !== '') {
513
+				$this->show_error(__('Your GetPaid tables have been updated:', 'invoicing') . ' ' . $wpdb->last_error);
514 514
 			}
515 515
 		}
516 516
 
517
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoices'" ) != $wpdb->prefix . 'getpaid_invoices' ) {
517
+		if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoices'") != $wpdb->prefix . 'getpaid_invoices') {
518 518
 			$installer->create_invoices_table();
519 519
 
520
-			if ( $wpdb->last_error !== '' ) {
521
-				$this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error );
520
+			if ($wpdb->last_error !== '') {
521
+				$this->show_error(__('Your GetPaid tables have been updated:', 'invoicing') . ' ' . $wpdb->last_error);
522 522
 			}
523 523
 		}
524 524
 
525
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoice_items'" ) != $wpdb->prefix . 'getpaid_invoice_items' ) {
525
+		if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoice_items'") != $wpdb->prefix . 'getpaid_invoice_items') {
526 526
 			$installer->create_invoice_items_table();
527 527
 
528
-			if ( $wpdb->last_error !== '' ) {
529
-				$this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error );
528
+			if ($wpdb->last_error !== '') {
529
+				$this->show_error(__('Your GetPaid tables have been updated:', 'invoicing') . ' ' . $wpdb->last_error);
530 530
 			}
531 531
 		}
532 532
 
533
-		if ( ! $this->has_notices() ) {
534
-			$this->show_success( __( 'Your GetPaid tables have been updated.', 'invoicing' ) );
533
+		if (!$this->has_notices()) {
534
+			$this->show_success(__('Your GetPaid tables have been updated.', 'invoicing'));
535 535
 		}
536 536
 
537
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
537
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
538 538
 		exit;
539 539
 	}
540 540
 
@@ -549,10 +549,10 @@  discard block
 block discarded – undo
549 549
 		$installer->migrate_old_invoices();
550 550
 
551 551
 		// Show an admin message.
552
-		$this->show_success( __( 'Your invoices have been migrated.', 'invoicing' ) );
552
+		$this->show_success(__('Your invoices have been migrated.', 'invoicing'));
553 553
 
554 554
 		// Redirect the admin.
555
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
555
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
556 556
 		exit;
557 557
 
558 558
 	}
@@ -564,18 +564,18 @@  discard block
 block discarded – undo
564 564
     public function admin_download_customers() {
565 565
 		global $wpdb;
566 566
 
567
-		$output = fopen( 'php://output', 'w' ) or die( __( 'Unsupported server', 'invoicing' ) );
567
+		$output = fopen('php://output', 'w') or die(__('Unsupported server', 'invoicing'));
568 568
 
569
-		header( "Content-Type:text/csv" );
570
-		header( "Content-Disposition:attachment;filename=customers.csv" );
569
+		header("Content-Type:text/csv");
570
+		header("Content-Disposition:attachment;filename=customers.csv");
571 571
 
572 572
 		$post_types = '';
573 573
 
574
-		foreach ( array_keys( getpaid_get_invoice_post_types() ) as $post_type ) {
575
-			$post_types .= $wpdb->prepare( "post_type=%s OR ", $post_type );
574
+		foreach (array_keys(getpaid_get_invoice_post_types()) as $post_type) {
575
+			$post_types .= $wpdb->prepare("post_type=%s OR ", $post_type);
576 576
 		}
577 577
 
578
-		$post_types = rtrim( $post_types, ' OR' );
578
+		$post_types = rtrim($post_types, ' OR');
579 579
 
580 580
 		$customers = $wpdb->get_col(
581 581
 			$wpdb->prepare(
@@ -584,58 +584,58 @@  discard block
 block discarded – undo
584 584
 		);
585 585
 
586 586
 		$columns = array(
587
-			'name'     => __( 'Name', 'invoicing' ),
588
-			'email'    => __( 'Email', 'invoicing' ),
589
-			'country'  => __( 'Country', 'invoicing' ),
590
-			'state'    => __( 'State', 'invoicing' ),
591
-			'city'     => __( 'City', 'invoicing' ),
592
-			'zip'      => __( 'ZIP', 'invoicing' ),
593
-			'address'  => __( 'Address', 'invoicing' ),
594
-			'phone'    => __( 'Phone', 'invoicing' ),
595
-			'company'  => __( 'Company', 'invoicing' ),
596
-			'company_id'  => __( 'Company ID', 'invoicing' ),
597
-			'invoices' => __( 'Invoices', 'invoicing' ),
598
-			'total_raw' => __( 'Total Spend', 'invoicing' ),
599
-			'signup'   => __( 'Date created', 'invoicing' ),
587
+			'name'     => __('Name', 'invoicing'),
588
+			'email'    => __('Email', 'invoicing'),
589
+			'country'  => __('Country', 'invoicing'),
590
+			'state'    => __('State', 'invoicing'),
591
+			'city'     => __('City', 'invoicing'),
592
+			'zip'      => __('ZIP', 'invoicing'),
593
+			'address'  => __('Address', 'invoicing'),
594
+			'phone'    => __('Phone', 'invoicing'),
595
+			'company'  => __('Company', 'invoicing'),
596
+			'company_id'  => __('Company ID', 'invoicing'),
597
+			'invoices' => __('Invoices', 'invoicing'),
598
+			'total_raw' => __('Total Spend', 'invoicing'),
599
+			'signup'   => __('Date created', 'invoicing'),
600 600
 		);
601 601
 
602 602
 		// Output the csv column headers.
603
-		fputcsv( $output, array_values( $columns ) );
603
+		fputcsv($output, array_values($columns));
604 604
 
605 605
 		// Loop through
606 606
 		$table = new WPInv_Customers_Table();
607
-		foreach ( $customers as $customer_id ) {
607
+		foreach ($customers as $customer_id) {
608 608
 
609
-			$user = get_user_by( 'id', $customer_id );
609
+			$user = get_user_by('id', $customer_id);
610 610
 			$row  = array();
611
-			if ( empty( $user ) ) {
611
+			if (empty($user)) {
612 612
 				continue;
613 613
 			}
614 614
 
615
-			foreach ( array_keys( $columns ) as $column ) {
615
+			foreach (array_keys($columns) as $column) {
616 616
 
617 617
 				$method = 'column_' . $column;
618 618
 
619
-				if ( 'name' == $column ) {
620
-					$value = esc_html( $user->display_name );
621
-				} else if( 'email' == $column ) {
622
-					$value = sanitize_email( $user->user_email );
623
-				} else if ( is_callable( array( $table, $method ) ) ) {
624
-					$value = strip_tags( $table->$method( $user ) );
619
+				if ('name' == $column) {
620
+					$value = esc_html($user->display_name);
621
+				} else if ('email' == $column) {
622
+					$value = sanitize_email($user->user_email);
623
+				} else if (is_callable(array($table, $method))) {
624
+					$value = strip_tags($table->$method($user));
625 625
 				}
626 626
 
627
-				if ( empty( $value ) ) {
628
-					$value = esc_html( get_user_meta( $user->ID, '_wpinv_' . $column, true ) );
627
+				if (empty($value)) {
628
+					$value = esc_html(get_user_meta($user->ID, '_wpinv_' . $column, true));
629 629
 				}
630 630
 
631 631
 				$row[] = $value;
632 632
 
633 633
 			}
634 634
 
635
-			fputcsv( $output, $row );
635
+			fputcsv($output, $row);
636 636
 		}
637 637
 
638
-		fclose( $output );
638
+		fclose($output);
639 639
 		exit;
640 640
 
641 641
 	}
@@ -645,29 +645,29 @@  discard block
 block discarded – undo
645 645
 	 *
646 646
 	 * @param array $data
647 647
      */
648
-    public function admin_install_plugin( $data ) {
648
+    public function admin_install_plugin($data) {
649 649
 
650
-		if ( ! empty( $data['plugins'] ) ) {
650
+		if (!empty($data['plugins'])) {
651 651
 			include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
652 652
 			wp_cache_flush();
653 653
 
654
-			foreach ( $data['plugins'] as $slug => $file ) {
655
-				$plugin_zip = esc_url( 'https://downloads.wordpress.org/plugin/' . $slug . '.latest-stable.zip' );
656
-				$upgrader   = new Plugin_Upgrader( new Automatic_Upgrader_Skin() );
657
-				$installed  = $upgrader->install( $plugin_zip );
654
+			foreach ($data['plugins'] as $slug => $file) {
655
+				$plugin_zip = esc_url('https://downloads.wordpress.org/plugin/' . $slug . '.latest-stable.zip');
656
+				$upgrader   = new Plugin_Upgrader(new Automatic_Upgrader_Skin());
657
+				$installed  = $upgrader->install($plugin_zip);
658 658
 
659
-				if ( ! is_wp_error( $installed ) && $installed ) {
660
-					activate_plugin( $file, '', false, true );
659
+				if (!is_wp_error($installed) && $installed) {
660
+					activate_plugin($file, '', false, true);
661 661
 				} else {
662
-					wpinv_error_log( $upgrader->skin->get_upgrade_messages(), false );
662
+					wpinv_error_log($upgrader->skin->get_upgrade_messages(), false);
663 663
 				}
664 664
 
665 665
 			}
666 666
 
667 667
 		}
668 668
 
669
-		$redirect = isset( $data['redirect'] ) ? esc_url_raw( $data['redirect'] ) : admin_url( 'plugins.php' );
670
-		wp_safe_redirect( $redirect );
669
+		$redirect = isset($data['redirect']) ? esc_url_raw($data['redirect']) : admin_url('plugins.php');
670
+		wp_safe_redirect($redirect);
671 671
 		exit;
672 672
 
673 673
 	}
@@ -677,42 +677,42 @@  discard block
 block discarded – undo
677 677
 	 *
678 678
 	 * @param array $data
679 679
      */
680
-    public function admin_connect_gateway( $data ) {
680
+    public function admin_connect_gateway($data) {
681 681
 
682
-		if ( ! empty( $data['plugin'] ) ) {
682
+		if (!empty($data['plugin'])) {
683 683
 
684
-			$gateway     = sanitize_key( $data['plugin'] );
685
-			$connect_url = apply_filters( "getpaid_get_{$gateway}_connect_url", false, $data );
684
+			$gateway     = sanitize_key($data['plugin']);
685
+			$connect_url = apply_filters("getpaid_get_{$gateway}_connect_url", false, $data);
686 686
 
687
-			if ( ! empty( $connect_url ) ) {
688
-				wp_redirect( $connect_url );
687
+			if (!empty($connect_url)) {
688
+				wp_redirect($connect_url);
689 689
 				exit;
690 690
 			}
691 691
 
692
-			if ( 'stripe' == $data['plugin'] ) {
692
+			if ('stripe' == $data['plugin']) {
693 693
 				require_once ABSPATH . 'wp-admin/includes/plugin.php';
694 694
 				include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
695 695
 				wp_cache_flush();
696 696
 
697
-				if ( ! array_key_exists( 'getpaid-stripe-payments/getpaid-stripe-payments.php', get_plugins() ) ) {
698
-					$plugin_zip = esc_url( 'https://downloads.wordpress.org/plugin/getpaid-stripe-payments.latest-stable.zip' );
699
-					$upgrader   = new Plugin_Upgrader( new Automatic_Upgrader_Skin() );
700
-					$upgrader->install( $plugin_zip );
697
+				if (!array_key_exists('getpaid-stripe-payments/getpaid-stripe-payments.php', get_plugins())) {
698
+					$plugin_zip = esc_url('https://downloads.wordpress.org/plugin/getpaid-stripe-payments.latest-stable.zip');
699
+					$upgrader   = new Plugin_Upgrader(new Automatic_Upgrader_Skin());
700
+					$upgrader->install($plugin_zip);
701 701
 				}
702 702
 
703
-				activate_plugin( 'getpaid-stripe-payments/getpaid-stripe-payments.php', '', false, true );
703
+				activate_plugin('getpaid-stripe-payments/getpaid-stripe-payments.php', '', false, true);
704 704
 			}
705 705
 
706
-			$connect_url = apply_filters( "getpaid_get_{$gateway}_connect_url", false, $data );
707
-			if ( ! empty( $connect_url ) ) {
708
-				wp_redirect( $connect_url );
706
+			$connect_url = apply_filters("getpaid_get_{$gateway}_connect_url", false, $data);
707
+			if (!empty($connect_url)) {
708
+				wp_redirect($connect_url);
709 709
 				exit;
710 710
 			}
711 711
 
712 712
 		}
713 713
 
714
-		$redirect = isset( $data['redirect'] ) ? esc_url_raw( urldecode( $data['redirect'] ) ) : admin_url( 'admin.php?page=wpinv-settings&tab=gateways' );
715
-		wp_safe_redirect( $redirect );
714
+		$redirect = isset($data['redirect']) ? esc_url_raw(urldecode($data['redirect'])) : admin_url('admin.php?page=wpinv-settings&tab=gateways');
715
+		wp_safe_redirect($redirect);
716 716
 		exit;
717 717
 
718 718
 	}
@@ -726,36 +726,36 @@  discard block
 block discarded – undo
726 726
 
727 727
 		// Fetch all invoices that have discount codes.
728 728
 		$table    = $wpdb->prefix . 'getpaid_invoices';
729
-		$invoices = $wpdb->get_col( "SELECT `post_id` FROM `$table` WHERE `discount` = 0 && `discount_code` <> ''" );
729
+		$invoices = $wpdb->get_col("SELECT `post_id` FROM `$table` WHERE `discount` = 0 && `discount_code` <> ''");
730 730
 
731
-		foreach ( $invoices as $invoice ) {
731
+		foreach ($invoices as $invoice) {
732 732
 
733
-			$invoice = new WPInv_Invoice( $invoice );
733
+			$invoice = new WPInv_Invoice($invoice);
734 734
 
735
-			if ( ! $invoice->exists() ) {
735
+			if (!$invoice->exists()) {
736 736
 				continue;
737 737
 			}
738 738
 
739 739
 			// Abort if the discount does not exist or does not apply here.
740
-			$discount = new WPInv_Discount( $invoice->get_discount_code() );
741
-			if ( ! $discount->exists() ) {
740
+			$discount = new WPInv_Discount($invoice->get_discount_code());
741
+			if (!$discount->exists()) {
742 742
 				continue;
743 743
 			}
744 744
 
745
-			$invoice->add_discount( getpaid_calculate_invoice_discount( $invoice, $discount ) );
745
+			$invoice->add_discount(getpaid_calculate_invoice_discount($invoice, $discount));
746 746
 			$invoice->recalculate_total();
747 747
 
748
-			if ( $invoice->get_total_discount() > 0 ) {
748
+			if ($invoice->get_total_discount() > 0) {
749 749
 				$invoice->save();
750 750
 			}
751 751
 
752 752
 		}
753 753
 
754 754
 		// Show an admin message.
755
-		$this->show_success( __( 'Discounts have been recalculated.', 'invoicing' ) );
755
+		$this->show_success(__('Discounts have been recalculated.', 'invoicing'));
756 756
 
757 757
 		// Redirect the admin.
758
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
758
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
759 759
 		exit;
760 760
 
761 761
 	}
@@ -767,8 +767,8 @@  discard block
 block discarded – undo
767 767
      * @return array
768 768
 	 */
769 769
 	public function get_notices() {
770
-		$notices = get_option( 'wpinv_admin_notices' );
771
-        return is_array( $notices ) ? $notices : array();
770
+		$notices = get_option('wpinv_admin_notices');
771
+        return is_array($notices) ? $notices : array();
772 772
 	}
773 773
 
774 774
 	/**
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
      * @return array
779 779
 	 */
780 780
 	public function has_notices() {
781
-		return count( $this->get_notices() ) > 0;
781
+		return count($this->get_notices()) > 0;
782 782
 	}
783 783
 
784 784
 	/**
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 	 * @since       1.0.19
789 789
 	 */
790 790
 	public function clear_notices() {
791
-		delete_option( 'wpinv_admin_notices' );
791
+		delete_option('wpinv_admin_notices');
792 792
 	}
793 793
 
794 794
 	/**
@@ -797,16 +797,16 @@  discard block
 block discarded – undo
797 797
 	 * @access      public
798 798
 	 * @since       1.0.19
799 799
 	 */
800
-	public function save_notice( $type, $message ) {
800
+	public function save_notice($type, $message) {
801 801
 		$notices = $this->get_notices();
802 802
 
803
-		if ( empty( $notices[ $type ] ) || ! is_array( $notices[ $type ]) ) {
804
-			$notices[ $type ] = array();
803
+		if (empty($notices[$type]) || !is_array($notices[$type])) {
804
+			$notices[$type] = array();
805 805
 		}
806 806
 
807
-		$notices[ $type ][] = $message;
807
+		$notices[$type][] = $message;
808 808
 
809
-		update_option( 'wpinv_admin_notices', $notices );
809
+		update_option('wpinv_admin_notices', $notices);
810 810
 	}
811 811
 
812 812
 	/**
@@ -816,8 +816,8 @@  discard block
 block discarded – undo
816 816
 	 * @access      public
817 817
 	 * @since       1.0.19
818 818
 	 */
819
-	public function show_success( $msg ) {
820
-		$this->save_notice( 'success', $msg );
819
+	public function show_success($msg) {
820
+		$this->save_notice('success', $msg);
821 821
 	}
822 822
 
823 823
 	/**
@@ -827,8 +827,8 @@  discard block
 block discarded – undo
827 827
 	 * @param       string $msg The message to qeue.
828 828
 	 * @since       1.0.19
829 829
 	 */
830
-	public function show_error( $msg ) {
831
-		$this->save_notice( 'error', $msg );
830
+	public function show_error($msg) {
831
+		$this->save_notice('error', $msg);
832 832
 	}
833 833
 
834 834
 	/**
@@ -838,8 +838,8 @@  discard block
 block discarded – undo
838 838
 	 * @param       string $msg The message to qeue.
839 839
 	 * @since       1.0.19
840 840
 	 */
841
-	public function show_warning( $msg ) {
842
-		$this->save_notice( 'warning', $msg );
841
+	public function show_warning($msg) {
842
+		$this->save_notice('warning', $msg);
843 843
 	}
844 844
 
845 845
 	/**
@@ -849,8 +849,8 @@  discard block
 block discarded – undo
849 849
 	 * @param       string $msg The message to qeue.
850 850
 	 * @since       1.0.19
851 851
 	 */
852
-	public function show_info( $msg ) {
853
-		$this->save_notice( 'info', $msg );
852
+	public function show_info($msg) {
853
+		$this->save_notice('info', $msg);
854 854
 	}
855 855
 
856 856
 	/**
@@ -864,30 +864,30 @@  discard block
 block discarded – undo
864 864
         $notices = $this->get_notices();
865 865
         $this->clear_notices();
866 866
 
867
-		foreach ( $notices as $type => $messages ) {
867
+		foreach ($notices as $type => $messages) {
868 868
 
869
-			if ( ! is_array( $messages ) ) {
869
+			if (!is_array($messages)) {
870 870
 				continue;
871 871
 			}
872 872
 
873
-            $type  = sanitize_key( $type );
874
-			foreach ( $messages as $message ) {
875
-                $message = wp_kses_post( $message );
873
+            $type = sanitize_key($type);
874
+			foreach ($messages as $message) {
875
+                $message = wp_kses_post($message);
876 876
 				echo "<div class='notice notice-$type is-dismissible'><p>$message</p></div>";
877 877
             }
878 878
 
879 879
         }
880 880
 
881
-		foreach ( array( 'checkout_page', 'invoice_history_page', 'success_page', 'failure_page', 'invoice_subscription_page' ) as $page ) {
881
+		foreach (array('checkout_page', 'invoice_history_page', 'success_page', 'failure_page', 'invoice_subscription_page') as $page) {
882 882
 
883
-			if ( ! is_numeric( wpinv_get_option( $page, false ) ) ) {
884
-				$url     = wp_nonce_url(
885
-					add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ),
883
+			if (!is_numeric(wpinv_get_option($page, false))) {
884
+				$url = wp_nonce_url(
885
+					add_query_arg('getpaid-admin-action', 'create_missing_pages'),
886 886
 					'getpaid-nonce',
887 887
 					'getpaid-nonce'
888 888
 				);
889
-				$message  = __( 'Some GetPaid pages are missing. To use GetPaid without any issues, click the button below to generate the missing pages.', 'invoicing' );
890
-				$message2 = __( 'Generate Pages', 'invoicing' );
889
+				$message  = __('Some GetPaid pages are missing. To use GetPaid without any issues, click the button below to generate the missing pages.', 'invoicing');
890
+				$message2 = __('Generate Pages', 'invoicing');
891 891
 				echo "<div class='notice notice-warning is-dismissible'><p>$message<br><br><a href='$url' class='button button-primary'>$message2</a></p></div>";
892 892
 				break;
893 893
 			}
Please login to merge, or discard this patch.
includes/admin/class-wpinv-admin-menus.php 1 patch
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Setup menus in WP admin.
4 4
  */
5 5
 
6
-defined( 'ABSPATH' ) || exit;
6
+defined('ABSPATH') || exit;
7 7
 
8 8
 /**
9 9
  * WC_Admin_Menus Class.
@@ -13,14 +13,14 @@  discard block
 block discarded – undo
13 13
      * Hook in tabs.
14 14
      */
15 15
     public function __construct() {
16
-        add_action( 'admin_head', array( $this, 'set_admin_menu_class' ) );
17
-        add_action( 'admin_menu', array( $this, 'admin_menu' ), 10 );
18
-        add_action( 'admin_menu', array( $this, 'add_customers_menu' ), 18 );
19
-        add_action( 'admin_menu', array( $this, 'add_subscriptions_menu' ), 40 );
20
-        add_action( 'admin_menu', array( $this, 'add_addons_menu' ), 100 );
21
-        add_action( 'admin_menu', array( $this, 'add_settings_menu' ), 60 );
22
-        add_action( 'admin_menu', array( $this, 'remove_admin_submenus' ), 10 );
23
-        add_action( 'admin_head-nav-menus.php', array( $this, 'add_nav_menu_meta_boxes' ) );
16
+        add_action('admin_head', array($this, 'set_admin_menu_class'));
17
+        add_action('admin_menu', array($this, 'admin_menu'), 10);
18
+        add_action('admin_menu', array($this, 'add_customers_menu'), 18);
19
+        add_action('admin_menu', array($this, 'add_subscriptions_menu'), 40);
20
+        add_action('admin_menu', array($this, 'add_addons_menu'), 100);
21
+        add_action('admin_menu', array($this, 'add_settings_menu'), 60);
22
+        add_action('admin_menu', array($this, 'remove_admin_submenus'), 10);
23
+        add_action('admin_head-nav-menus.php', array($this, 'add_nav_menu_meta_boxes'));
24 24
     }
25 25
 
26 26
     /**
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	public function set_admin_menu_class() {
30 30
 		global $current_screen, $parent_file, $submenu_file;
31 31
 
32
-        if ( ! empty( $current_screen->id ) && in_array( $current_screen->id , array( 'wpi_discount', 'wpi_payment_form', 'wpi_invoice' ) ) ) {
32
+        if (!empty($current_screen->id) && in_array($current_screen->id, array('wpi_discount', 'wpi_payment_form', 'wpi_invoice'))) {
33 33
 			$parent_file = 'wpinv';
34 34
 			$submenu_file = 'edit.php?post_type=' . $current_screen->id;
35 35
         }
@@ -38,14 +38,14 @@  discard block
 block discarded – undo
38 38
 
39 39
     public function admin_menu() {
40 40
 
41
-        $capability = apply_filters( 'invoicing_capability', wpinv_get_capability() );
41
+        $capability = apply_filters('invoicing_capability', wpinv_get_capability());
42 42
         add_menu_page(
43
-            __( 'GetPaid', 'invoicing' ),
44
-            __( 'GetPaid', 'invoicing' ),
43
+            __('GetPaid', 'invoicing'),
44
+            __('GetPaid', 'invoicing'),
45 45
             $capability,
46 46
             'wpinv',
47 47
             null,
48
-            'data:image/svg+xml;base64,' . base64_encode( file_get_contents( WPINV_PLUGIN_DIR . 'assets/images/GetPaid.svg' ) ),
48
+            'data:image/svg+xml;base64,' . base64_encode(file_get_contents(WPINV_PLUGIN_DIR . 'assets/images/GetPaid.svg')),
49 49
             '54.123460'
50 50
         );
51 51
 
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
     public function add_customers_menu() {
58 58
         add_submenu_page(
59 59
             'wpinv',
60
-            __( 'Customers', 'invoicing' ),
61
-            __( 'Customers', 'invoicing' ),
60
+            __('Customers', 'invoicing'),
61
+            __('Customers', 'invoicing'),
62 62
             wpinv_get_capability(),
63 63
             'wpinv-customers',
64
-            array( $this, 'customers_page' )
64
+            array($this, 'customers_page')
65 65
         );
66 66
     }
67 67
 
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
     public function add_subscriptions_menu() {
72 72
         add_submenu_page(
73 73
             'wpinv',
74
-            __( 'Subscriptions', 'invoicing' ),
75
-            __( 'Subscriptions', 'invoicing' ),
74
+            __('Subscriptions', 'invoicing'),
75
+            __('Subscriptions', 'invoicing'),
76 76
             wpinv_get_capability(),
77 77
             'wpinv-subscriptions',
78 78
             'wpinv_subscriptions_page'
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      * Displays the customers page.
84 84
      */
85 85
     public function customers_page() {
86
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-customers-table.php' );
86
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-customers-table.php');
87 87
         ?>
88 88
         <div class="wrap wpi-customers-wrap">
89 89
             <style>
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
                     width: 30%;
92 92
                 }
93 93
             </style>
94
-            <h1><?php echo esc_html( __( 'Customers', 'invoicing' ) ); ?>&nbsp;<a href="<?php echo wp_nonce_url( add_query_arg( 'getpaid-admin-action', 'download_customers' ), 'getpaid-nonce', 'getpaid-nonce' ); ?>" class="page-title-action"><?php _e( 'Export', 'invoicing' ); ?></a></h1>
94
+            <h1><?php echo esc_html(__('Customers', 'invoicing')); ?>&nbsp;<a href="<?php echo wp_nonce_url(add_query_arg('getpaid-admin-action', 'download_customers'), 'getpaid-nonce', 'getpaid-nonce'); ?>" class="page-title-action"><?php _e('Export', 'invoicing'); ?></a></h1>
95 95
             <form method="post">
96 96
             <?php
97 97
                 $table = new WPInv_Customers_Table();
98 98
                 $table->prepare_items();
99
-                $table->search_box( __( 'Search Customers', 'invoicing' ), 'search-customers' );
99
+                $table->search_box(__('Search Customers', 'invoicing'), 'search-customers');
100 100
                 $table->display();
101 101
             ?>
102 102
             </form>
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
     public function add_settings_menu() {
111 111
         add_submenu_page(
112 112
             'wpinv',
113
-            __( 'Invoice Settings', 'invoicing' ),
114
-            __( 'Settings', 'invoicing' ),
115
-            apply_filters( 'invoicing_capability', wpinv_get_capability() ),
113
+            __('Invoice Settings', 'invoicing'),
114
+            __('Settings', 'invoicing'),
115
+            apply_filters('invoicing_capability', wpinv_get_capability()),
116 116
             'wpinv-settings',
117
-            array( $this, 'options_page' )
117
+            array($this, 'options_page')
118 118
         );
119 119
     }
120 120
 
121
-    public function add_addons_menu(){
122
-        if ( !apply_filters( 'wpi_show_addons_page', true ) ) {
121
+    public function add_addons_menu() {
122
+        if (!apply_filters('wpi_show_addons_page', true)) {
123 123
             return;
124 124
         }
125 125
 
@@ -129,78 +129,78 @@  discard block
 block discarded – undo
129 129
             __('Extensions', 'invoicing'),
130 130
             'manage_options',
131 131
             'wpi-addons',
132
-            array( $this, 'addons_page' )
132
+            array($this, 'addons_page')
133 133
         );
134 134
     }
135 135
 
136
-    public function addons_page(){
136
+    public function addons_page() {
137 137
         $addon_obj = new WPInv_Admin_Addons();
138 138
         $addon_obj->output();
139 139
     }
140 140
 
141 141
     function options_page() {
142 142
 
143
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
143
+        if (!wpinv_current_user_can_manage_invoicing()) {
144 144
             return;
145 145
         }
146 146
 
147 147
         $settings_tabs = wpinv_get_settings_tabs();
148 148
         $settings_tabs = empty($settings_tabs) ? array() : $settings_tabs;
149
-        $active_tab    = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $settings_tabs ) ? esc_html( $_GET['tab'] ) : 'general';
150
-        $sections      = wpinv_get_settings_tab_sections( $active_tab );
149
+        $active_tab    = isset($_GET['tab']) && array_key_exists($_GET['tab'], $settings_tabs) ? esc_html($_GET['tab']) : 'general';
150
+        $sections      = wpinv_get_settings_tab_sections($active_tab);
151 151
         $key           = 'main';
152 152
 
153
-        if ( is_array( $sections ) ) {
154
-            $key = key( $sections );
153
+        if (is_array($sections)) {
154
+            $key = key($sections);
155 155
         }
156 156
 
157 157
         add_thickbox();
158 158
 
159
-        $registered_sections = wpinv_get_settings_tab_sections( $active_tab );
160
-        $section             = isset( $_GET['section'] ) && ! empty( $registered_sections ) && array_key_exists( $_GET['section'], $registered_sections ) ? $_GET['section'] : $key;
159
+        $registered_sections = wpinv_get_settings_tab_sections($active_tab);
160
+        $section             = isset($_GET['section']) && !empty($registered_sections) && array_key_exists($_GET['section'], $registered_sections) ? $_GET['section'] : $key;
161 161
         ?>
162 162
         <div class="wrap">
163 163
             <h1 class="nav-tab-wrapper">
164 164
                 <?php
165
-                foreach( wpinv_get_settings_tabs() as $tab_id => $tab_name ) {
166
-                    $tab_url = add_query_arg( array(
165
+                foreach (wpinv_get_settings_tabs() as $tab_id => $tab_name) {
166
+                    $tab_url = add_query_arg(array(
167 167
                         'settings-updated' => false,
168 168
                         'tab' => $tab_id,
169
-                    ) );
169
+                    ));
170 170
 
171 171
                     // Remove the section from the tabs so we always end up at the main section
172
-                    $tab_url = remove_query_arg( 'section', $tab_url );
173
-                    $tab_url = remove_query_arg( 'wpi_sub', $tab_url );
172
+                    $tab_url = remove_query_arg('section', $tab_url);
173
+                    $tab_url = remove_query_arg('wpi_sub', $tab_url);
174 174
 
175 175
                     $active = $active_tab == $tab_id ? ' nav-tab-active' : '';
176 176
 
177
-                    echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab' . $active . '">';
178
-                    echo esc_html( $tab_name );
177
+                    echo '<a href="' . esc_url($tab_url) . '" title="' . esc_attr($tab_name) . '" class="nav-tab' . $active . '">';
178
+                    echo esc_html($tab_name);
179 179
                     echo '</a>';
180 180
                 }
181 181
                 ?>
182 182
             </h1>
183 183
             <?php
184
-            $number_of_sections = count( $sections );
184
+            $number_of_sections = count($sections);
185 185
             $number = 0;
186
-            if ( $number_of_sections > 1 ) {
186
+            if ($number_of_sections > 1) {
187 187
                 echo '<div><ul class="subsubsub">';
188
-                foreach( $sections as $section_id => $section_name ) {
188
+                foreach ($sections as $section_id => $section_name) {
189 189
                     echo '<li>';
190 190
                     $number++;
191
-                    $tab_url = add_query_arg( array(
191
+                    $tab_url = add_query_arg(array(
192 192
                         'settings-updated' => false,
193 193
                         'tab' => $active_tab,
194 194
                         'section' => $section_id
195
-                    ) );
196
-                    $tab_url = remove_query_arg( 'wpi_sub', $tab_url );
195
+                    ));
196
+                    $tab_url = remove_query_arg('wpi_sub', $tab_url);
197 197
                     $class = '';
198
-                    if ( $section == $section_id ) {
198
+                    if ($section == $section_id) {
199 199
                         $class = 'current';
200 200
                     }
201
-                    echo '<a class="' . $class . '" href="' . esc_url( $tab_url ) . '">' . $section_name . '</a>';
201
+                    echo '<a class="' . $class . '" href="' . esc_url($tab_url) . '">' . $section_name . '</a>';
202 202
 
203
-                    if ( $number != $number_of_sections ) {
203
+                    if ($number != $number_of_sections) {
204 204
                         echo ' | ';
205 205
                     }
206 206
                     echo '</li>';
@@ -212,20 +212,20 @@  discard block
 block discarded – undo
212 212
                 <form method="post" action="options.php">
213 213
                     <table class="form-table">
214 214
                         <?php
215
-                        settings_fields( 'wpinv_settings' );
215
+                        settings_fields('wpinv_settings');
216 216
 
217
-                        if ( 'main' === $section ) {
218
-                            do_action( 'wpinv_settings_tab_top', $active_tab );
217
+                        if ('main' === $section) {
218
+                            do_action('wpinv_settings_tab_top', $active_tab);
219 219
                         }
220 220
 
221
-                        do_action( 'wpinv_settings_tab_top_' . $active_tab . '_' . $section, $active_tab, $section );
222
-                        do_settings_sections( 'wpinv_settings_' . $active_tab . '_' . $section, $active_tab, $section );
223
-                        do_action( 'wpinv_settings_tab_bottom_' . $active_tab . '_' . $section, $active_tab, $section );
224
-                        do_action( 'getpaid_settings_tab_bottom', $active_tab, $section );
221
+                        do_action('wpinv_settings_tab_top_' . $active_tab . '_' . $section, $active_tab, $section);
222
+                        do_settings_sections('wpinv_settings_' . $active_tab . '_' . $section, $active_tab, $section);
223
+                        do_action('wpinv_settings_tab_bottom_' . $active_tab . '_' . $section, $active_tab, $section);
224
+                        do_action('getpaid_settings_tab_bottom', $active_tab, $section);
225 225
 
226 226
                         // For backwards compatibility
227
-                        if ( 'main' === $section ) {
228
-                            do_action( 'wpinv_settings_tab_bottom', $active_tab );
227
+                        if ('main' === $section) {
228
+                            do_action('wpinv_settings_tab_bottom', $active_tab);
229 229
                         }
230 230
                         ?>
231 231
                     </table>
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
     }
238 238
 
239 239
     public function remove_admin_submenus() {
240
-        remove_submenu_page( 'edit.php?post_type=wpi_invoice', 'post-new.php?post_type=wpi_invoice' );
240
+        remove_submenu_page('edit.php?post_type=wpi_invoice', 'post-new.php?post_type=wpi_invoice');
241 241
     }
242 242
 
243 243
     /**
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
 
248 248
         add_meta_box(
249 249
             'wpinv_endpoints_nav_link',
250
-            __( 'GetPaid endpoints', 'invoicing' ),
251
-            array( $this, 'nav_menu_links' ),
250
+            __('GetPaid endpoints', 'invoicing'),
251
+            array($this, 'nav_menu_links'),
252 252
             'nav-menus',
253 253
             'side',
254 254
             'low'
@@ -263,12 +263,12 @@  discard block
 block discarded – undo
263 263
         $endpoints = $this->get_menu_items();
264 264
         ?>
265 265
         <div id="invoicing-endpoints" class="posttypediv">
266
-            <?php if ( ! empty( $endpoints['pages'] ) ) : ?>
266
+            <?php if (!empty($endpoints['pages'])) : ?>
267 267
                 <div id="tabs-panel-invoicing-endpoints" class="tabs-panel tabs-panel-active">
268 268
                     <ul id="invoicing-endpoints-checklist" class="categorychecklist form-no-clear">
269 269
                         <?php
270
-                            $walker = new Walker_Nav_Menu_Checklist( array() );
271
-                            echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $endpoints['pages'] ), 0, (object) array( 'walker' => $walker ) );
270
+                            $walker = new Walker_Nav_Menu_Checklist(array());
271
+                            echo walk_nav_menu_tree(array_map('wp_setup_nav_menu_item', $endpoints['pages']), 0, (object) array('walker' => $walker));
272 272
                         ?>
273 273
                     </ul>
274 274
                 </div>
@@ -277,11 +277,11 @@  discard block
 block discarded – undo
277 277
             <p class="button-controls wp-clearfix" data-items-type="invoicing-endpoints">
278 278
                 <span class="list-controls hide-if-no-js">
279 279
                     <input type="checkbox" id="invoicing-endpoints-tab" class="select-all">
280
-                    <label for="invoicing-endpoints-tab"><?php _e( 'Select all', 'invoicing' ); ?></label>
280
+                    <label for="invoicing-endpoints-tab"><?php _e('Select all', 'invoicing'); ?></label>
281 281
                 </span>
282 282
 
283 283
                 <span class="add-to-menu">
284
-                    <input type="submit" class="button submit-add-to-menu right" value="<?php esc_attr_e( 'Add to menu', 'invoicing' ); ?>" name="add-invoicing-endpoints-item" id="submit-invoicing-endpoints">
284
+                    <input type="submit" class="button submit-add-to-menu right" value="<?php esc_attr_e('Add to menu', 'invoicing'); ?>" name="add-invoicing-endpoints-item" id="submit-invoicing-endpoints">
285 285
                     <span class="spinner"></span>
286 286
                 </span>
287 287
             </p>
@@ -294,35 +294,35 @@  discard block
 block discarded – undo
294 294
      *
295 295
      * @return array.
296 296
      */
297
-    public function get_menu_items(){
297
+    public function get_menu_items() {
298 298
         $items = array();
299 299
 
300 300
         $pages = array(
301 301
             array(
302
-                'id'    => wpinv_get_option( 'invoice_history_page' ),
303
-                'label' => __( 'My Invoices', 'invoicing' ),
302
+                'id'    => wpinv_get_option('invoice_history_page'),
303
+                'label' => __('My Invoices', 'invoicing'),
304 304
             ),
305 305
             array(
306
-                'id'    => wpinv_get_option( 'invoice_subscription_page' ),
307
-                'label' => __( 'My Subscriptions', 'invoicing' ),
306
+                'id'    => wpinv_get_option('invoice_subscription_page'),
307
+                'label' => __('My Subscriptions', 'invoicing'),
308 308
             )
309 309
         );
310 310
 
311
-        foreach ( apply_filters( 'getpaid_menu_pages', $pages ) as $page ) {
311
+        foreach (apply_filters('getpaid_menu_pages', $pages) as $page) {
312 312
 
313
-            if ( (int) $page['id'] > 0 ) {
313
+            if ((int) $page['id'] > 0) {
314 314
 
315 315
                 $item                   = new stdClass();
316 316
                 $item->object_id        = (int) $page['id'];
317 317
                 $item->db_id            = 0;
318
-                $item->object           =  'page';
318
+                $item->object           = 'page';
319 319
                 $item->menu_item_parent = 0;
320 320
                 $item->type             = 'post_type';
321
-                $item->title            = esc_html( $page['label'] );
322
-                $item->url              = get_permalink( (int) $page['id'] );
321
+                $item->title            = esc_html($page['label']);
322
+                $item->url              = get_permalink((int) $page['id']);
323 323
                 $item->target           = '';
324 324
                 $item->attr_title       = '';
325
-                $item->classes          = array( 'wpinv-menu-item' );
325
+                $item->classes          = array('wpinv-menu-item');
326 326
                 $item->xfn              = '';
327 327
 
328 328
                 $items['pages'][]       = $item;
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 
332 332
         }
333 333
 
334
-        return apply_filters( 'wpinv_menu_items', $items );
334
+        return apply_filters('wpinv_menu_items', $items);
335 335
     }
336 336
 
337 337
 }
Please login to merge, or discard this patch.