Passed
Push — master ( 47b6fc...99ae46 )
by Brian
05:46 queued 20s
created
templates/payment-forms/elements/radio.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,26 +7,26 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$label = empty( $label ) ? '' : wp_kses_post( $label );
13
-$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) );
12
+$label = empty($label) ? '' : wp_kses_post($label);
13
+$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label));
14 14
 
15
-if ( ! empty( $required ) ) {
15
+if (!empty($required)) {
16 16
     $label .= "<span class='text-danger'> *</span>";
17 17
 }
18 18
 
19 19
 aui()->radio(
20 20
     array(
21
-        'name'       => esc_attr( $id ),
22
-        'id'         => esc_attr( $id ) . uniqid( '_' ),
23
-        'required'   => ! empty( $required ),
21
+        'name'       => esc_attr($id),
22
+        'id'         => esc_attr($id) . uniqid('_'),
23
+        'required'   => !empty($required),
24 24
         'label'      => $label,
25 25
         'label_type' => 'vertical',
26 26
         'class'      => 'w-auto',
27 27
         'inline'     => false,
28
-        'options'    => empty( $options ) ? array() : array_combine( $options, $options ),
29
-        'help_text'  => empty( $description ) ? '' : wp_kses_post( $description ),
28
+        'options'    => empty($options) ? array() : array_combine($options, $options),
29
+        'help_text'  => empty($description) ? '' : wp_kses_post($description),
30 30
         'class'      => $label_class,
31 31
     ),
32 32
     true
Please login to merge, or discard this patch.
templates/payment-forms/variations/checkbox.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,31 +7,31 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 // Prepare the selectable items.
13 13
 $selectable = array();
14
-foreach ( $form->get_items() as $item ) {
15
-    if ( ! $item->is_required ) {
16
-        $selectable[ $item->get_id() ] = $item->get_name() . ' &mdash; ' . wpinv_price( $item->get_initial_price() );
14
+foreach ($form->get_items() as $item) {
15
+    if (!$item->is_required) {
16
+        $selectable[$item->get_id()] = $item->get_name() . ' &mdash; ' . wpinv_price($item->get_initial_price());
17 17
     }
18 18
 }
19 19
 
20
-if ( empty( $selectable ) ) {
20
+if (empty($selectable)) {
21 21
     return;
22 22
 }
23 23
 
24 24
 echo '<div class="getpaid-payment-form-items-checkbox form-group">';
25 25
 
26
-foreach ( $selectable as $item_id => $item_name ) {
26
+foreach ($selectable as $item_id => $item_name) {
27 27
 
28
-    $is_checked = get_post_meta( $item_id, 'selected_by_default', true );
28
+    $is_checked = get_post_meta($item_id, 'selected_by_default', true);
29 29
 
30 30
     aui()->input(
31 31
         array(
32 32
             'type'    => 'checkbox',
33 33
             'name'    => 'getpaid-payment-form-selected-item',
34
-            'id'      => 'getpaid-payment-form-selected-item' . uniqid( '_' ) . $item_id,
34
+            'id'      => 'getpaid-payment-form-selected-item' . uniqid('_') . $item_id,
35 35
             'label'   => $item_name,
36 36
             'value'   => $item_id,
37 37
             'no_wrap' => true,
Please login to merge, or discard this patch.
templates/payment-forms/variations/select.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 // Prepare the selectable items.
13 13
 $selectable = array();
14
-foreach ( $form->get_items() as $item ) {
15
-    if ( ! $item->is_required ) {
16
-        $selectable[ $item->get_id() ] = strip_tags( $item->get_name() . ' &mdash; ' . wpinv_price( $item->get_initial_price() ) );
14
+foreach ($form->get_items() as $item) {
15
+    if (!$item->is_required) {
16
+        $selectable[$item->get_id()] = strip_tags($item->get_name() . ' &mdash; ' . wpinv_price($item->get_initial_price()));
17 17
     }
18 18
 }
19 19
 
20
-if ( empty( $selectable ) ) {
20
+if (empty($selectable)) {
21 21
     return;
22 22
 }
23 23
 
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
 aui()->select(
28 28
     array(
29 29
         'name'       => 'getpaid-payment-form-selected-item',
30
-        'id'         => 'getpaid-payment-form-selected-item' . uniqid( '_' ),
30
+        'id'         => 'getpaid-payment-form-selected-item' . uniqid('_'),
31 31
         'required'   => true,
32
-        'label'      => __( 'Select Item', 'invoicing' ),
32
+        'label'      => __('Select Item', 'invoicing'),
33 33
         'label_type' => 'vertical',
34 34
         'inline'     => false,
35 35
         'options'    => $selectable,
Please login to merge, or discard this patch.
templates/payment-forms/variations/radio.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 // Prepare the selectable items.
13 13
 $selectable = array();
14
-foreach ( $form->get_items() as $item ) {
15
-    if ( ! $item->is_required ) {
16
-        $selectable[ $item->get_id() ] = $item->get_name() . ' &mdash; ' . wpinv_price( $item->get_initial_price() );
14
+foreach ($form->get_items() as $item) {
15
+    if (!$item->is_required) {
16
+        $selectable[$item->get_id()] = $item->get_name() . ' &mdash; ' . wpinv_price($item->get_initial_price());
17 17
     }
18 18
 }
19 19
 
20
-if ( empty( $selectable ) ) {
20
+if (empty($selectable)) {
21 21
     return;
22 22
 }
23 23
 
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
 aui()->radio(
28 28
     array(
29 29
         'name'       => 'getpaid-payment-form-selected-item',
30
-        'id'         => 'getpaid-payment-form-selected-item' . uniqid( '_' ),
30
+        'id'         => 'getpaid-payment-form-selected-item' . uniqid('_'),
31 31
         'required'   => true,
32
-        'label'      => __( 'Select Item', 'invoicing' ),
32
+        'label'      => __('Select Item', 'invoicing'),
33 33
         'label_type' => 'vertical',
34 34
         'class'      => 'w-auto',
35 35
         'inline'     => false,
Please login to merge, or discard this patch.
templates/payment-forms/form.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 // Make sure that the form is active.
13
-if ( ! $form->is_active() ) {
13
+if (!$form->is_active()) {
14 14
     aui()->alert(
15 15
         array(
16 16
             'type'    => 'warning',
17
-            'content' => __( 'This payment form is no longer active', 'invoicing' ),
17
+            'content' => __('This payment form is no longer active', 'invoicing'),
18 18
         ),
19 19
         true
20 20
     );
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
 }
23 23
 
24 24
 // Require login to checkout.
25
-if ( wpinv_require_login_to_checkout() && ! get_current_user_id() ) {
25
+if (wpinv_require_login_to_checkout() && !get_current_user_id()) {
26 26
 
27 27
     aui()->alert(
28 28
         array(
29 29
             'type'    => 'danger',
30
-            'content' => __( 'You must be logged in to checkout.', 'invoicing' ),
30
+            'content' => __('You must be logged in to checkout.', 'invoicing'),
31 31
         ),
32 32
         true
33 33
     );
@@ -36,29 +36,29 @@  discard block
 block discarded – undo
36 36
 }
37 37
 
38 38
 // Fires before displaying a payment form.
39
-do_action( 'getpaid_before_payment_form', $form );
39
+do_action('getpaid_before_payment_form', $form);
40 40
 ?>
41 41
 
42
-<form class='getpaid-payment-form getpaid-payment-form-<?php echo absint( $form->get_id() ); ?> bsui position-relative' method='POST' data-key='<?php echo uniqid( 'gpf' ); ?>' data-currency='<?php echo esc_attr( empty( $form->invoice ) ? wpinv_get_currency() : $form->invoice->get_currency() ); ?>' novalidate>
42
+<form class='getpaid-payment-form getpaid-payment-form-<?php echo absint($form->get_id()); ?> bsui position-relative' method='POST' data-key='<?php echo uniqid('gpf'); ?>' data-currency='<?php echo esc_attr(empty($form->invoice) ? wpinv_get_currency() : $form->invoice->get_currency()); ?>' novalidate>
43 43
 
44 44
     <?php
45 45
 
46 46
         // Fires when printing the top of a payment form.
47
-        do_action( 'getpaid_payment_form_top', $form );
47
+        do_action('getpaid_payment_form_top', $form);
48 48
 
49 49
         // And the optional invoice id.
50
-        if ( ! empty( $form->invoice ) ) {
51
-		echo getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() );
50
+        if (!empty($form->invoice)) {
51
+		echo getpaid_hidden_field('invoice_id', $form->invoice->get_id());
52 52
         }
53 53
 
54 54
         // We also want to include the form id.
55
-        echo getpaid_hidden_field( 'form_id', $form->get_id() );
55
+        echo getpaid_hidden_field('form_id', $form->get_id());
56 56
 
57 57
         // And an indication that this is a payment form submission.
58
-        echo getpaid_hidden_field( 'getpaid_payment_form_submission', '1' );
58
+        echo getpaid_hidden_field('getpaid_payment_form_submission', '1');
59 59
 
60 60
         // Fires before displaying payment form elements.
61
-        do_action( 'getpaid_payment_form_before_elements', $form );
61
+        do_action('getpaid_payment_form_before_elements', $form);
62 62
 
63 63
         // Display the elements.
64 64
         ?>
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
             <div class="row">
67 67
                 <?php
68 68
 
69
-                    foreach ( $form->get_elements() as $element ) {
69
+                    foreach ($form->get_elements() as $element) {
70 70
 
71
-					if ( isset( $element['type'] ) ) {
72
-						$grid_class = esc_attr( getpaid_get_form_element_grid_class( $element ) );
71
+					if (isset($element['type'])) {
72
+						$grid_class = esc_attr(getpaid_get_form_element_grid_class($element));
73 73
 						echo "<div class='$grid_class'>";
74
-						do_action( 'getpaid_payment_form_element', $element, $form );
75
-						do_action( "getpaid_payment_form_element_{$element['type']}_template", $element, $form );
74
+						do_action('getpaid_payment_form_element', $element, $form);
75
+						do_action("getpaid_payment_form_element_{$element['type']}_template", $element, $form);
76 76
 						echo '</div>';
77 77
                         }
78 78
 }
@@ -83,28 +83,28 @@  discard block
 block discarded – undo
83 83
 
84 84
         <?php
85 85
         // Fires after displaying payment form elements.
86
-        do_action( 'getpaid_payment_form_after_elements', $form );
86
+        do_action('getpaid_payment_form_after_elements', $form);
87 87
 
88 88
         echo "<div class='getpaid-payment-form-errors alert alert-danger d-none'></div>";
89 89
 
90
-        if ( wpinv_current_user_can_manage_invoicing() ) {
90
+        if (wpinv_current_user_can_manage_invoicing()) {
91 91
 
92 92
             edit_post_link(
93
-                __( 'Edit this form.', 'invoicing' ),
93
+                __('Edit this form.', 'invoicing'),
94 94
                 '<small class="form-text text-muted">',
95
-                '&nbsp;' . __( 'This is only visible to website administators.', 'invoicing' ) . '</small>',
95
+                '&nbsp;' . __('This is only visible to website administators.', 'invoicing') . '</small>',
96 96
                 $form->get_id(),
97 97
                 'text-danger'
98 98
             );
99 99
 
100 100
         }
101 101
 
102
-        echo wp_kses_post( $extra_markup );
102
+        echo wp_kses_post($extra_markup);
103 103
     ?>
104 104
 
105 105
     <div class="loading_div overlay overlay-black position-absolute row m-0 rounded overflow-hidden" style="height: 100%;width: 100%;top: 0px;z-index: 2;display:none;">
106 106
         <div class="spinner-border mx-auto align-self-center text-white" role="status">
107
-            <span class="sr-only"><?php esc_html_e( 'Loading...', 'invoicing' ); ?></span>
107
+            <span class="sr-only"><?php esc_html_e('Loading...', 'invoicing'); ?></span>
108 108
         </div>
109 109
     </div>
110 110
 
@@ -113,4 +113,4 @@  discard block
 block discarded – undo
113 113
 <?php
114 114
 
115 115
 // Fires after displaying a payment form.
116
-do_action( 'getpaid_after_payment_form', $form );
116
+do_action('getpaid_after_payment_form', $form);
Please login to merge, or discard this patch.
templates/emails/wpinv-email-billing-details.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,51 +1,51 @@
 block discarded – undo
1 1
 <?php
2 2
 // don't load directly
3
-if ( ! defined( 'ABSPATH' ) ) {
4
-    die( '-1' );
3
+if (!defined('ABSPATH')) {
4
+    die('-1');
5 5
 }
6 6
 
7
-do_action( 'wpinv_email_before_billing_details', $invoice ); ?>
7
+do_action('wpinv_email_before_billing_details', $invoice); ?>
8 8
 <div id="wpinv-email-billing">
9
-    <h3 class="wpinv-address-t"><?php echo esc_html( apply_filters( 'wpinv_email_billing_title', __( 'Billing Details', 'invoicing' ) ) ); ?></h3>
9
+    <h3 class="wpinv-address-t"><?php echo esc_html(apply_filters('wpinv_email_billing_title', __('Billing Details', 'invoicing'))); ?></h3>
10 10
 
11 11
     <table class="table table-bordered table-sm wpi-billing-details">
12 12
         <tbody>
13
-            <?php do_action( 'wpinv_email_billing_fields_first', $invoice ); ?>
13
+            <?php do_action('wpinv_email_billing_fields_first', $invoice); ?>
14 14
             <tr class="wpi-receipt-name">
15
-                <th class="text-left"><?php esc_html_e( 'Name', 'invoicing' ); ?></th>
15
+                <th class="text-left"><?php esc_html_e('Name', 'invoicing'); ?></th>
16 16
                 <td>
17 17
                 <?php
18
-                if ( $sent_to_admin && $invoice->get_user_id() ) {
18
+                if ($sent_to_admin && $invoice->get_user_id()) {
19 19
 ?>
20
-<a href="<?php echo esc_url( add_query_arg( 'user_id', $invoice->get_user_id(), self_admin_url( 'user-edit.php' ) ) ); ?>"><?php echo esc_html( $invoice->get_user_full_name() ); ?></a>
20
+<a href="<?php echo esc_url(add_query_arg('user_id', $invoice->get_user_id(), self_admin_url('user-edit.php'))); ?>"><?php echo esc_html($invoice->get_user_full_name()); ?></a>
21 21
                     <?php
22 22
 } else {
23
-					echo esc_html( $invoice->get_user_full_name() ); }
23
+					echo esc_html($invoice->get_user_full_name()); }
24 24
 ?>
25 25
 </td>
26 26
             </tr>
27 27
             <tr class="wpi-receipt-email">
28
-                <th class="text-left"><?php esc_html_e( 'Email', 'invoicing' ); ?></th>
29
-                <td><?php echo esc_html( sanitize_email( $invoice->get_email() ) ); ?></td>
28
+                <th class="text-left"><?php esc_html_e('Email', 'invoicing'); ?></th>
29
+                <td><?php echo esc_html(sanitize_email($invoice->get_email())); ?></td>
30 30
             </tr>
31
-            <?php if ( $invoice->get_company() ) { ?>
31
+            <?php if ($invoice->get_company()) { ?>
32 32
             <tr class="wpi-receipt-company">
33
-                <th class="text-left"><?php esc_html_e( 'Company', 'invoicing' ); ?></th>
34
-                <td><?php echo esc_html( $invoice->get_company() ); ?></td>
33
+                <th class="text-left"><?php esc_html_e('Company', 'invoicing'); ?></th>
34
+                <td><?php echo esc_html($invoice->get_company()); ?></td>
35 35
             </tr>
36 36
             <?php } ?>
37 37
             <tr class="wpi-receipt-address">
38
-                <th class="text-left"><?php esc_html_e( 'Address', 'invoicing' ); ?></th>
39
-                <td><?php echo wp_kses_post( wpinv_get_invoice_address_markup( $invoice->get_user_info() ) ); ?></td>
38
+                <th class="text-left"><?php esc_html_e('Address', 'invoicing'); ?></th>
39
+                <td><?php echo wp_kses_post(wpinv_get_invoice_address_markup($invoice->get_user_info())); ?></td>
40 40
             </tr>
41
-            <?php if ( $invoice->get_phone() ) { ?>
41
+            <?php if ($invoice->get_phone()) { ?>
42 42
             <tr class="wpi-receipt-phone">
43
-                <th class="text-left"><?php esc_html_e( 'Phone', 'invoicing' ); ?></th>
44
-                <td><?php echo esc_html( $invoice->get_phone() ); ?></td>
43
+                <th class="text-left"><?php esc_html_e('Phone', 'invoicing'); ?></th>
44
+                <td><?php echo esc_html($invoice->get_phone()); ?></td>
45 45
             </tr>
46 46
             <?php } ?>
47
-            <?php do_action( 'wpinv_email_billing_fields_last', $invoice ); ?>
47
+            <?php do_action('wpinv_email_billing_fields_last', $invoice); ?>
48 48
         </tbody>
49 49
     </table>
50 50
 </div>
51
-<?php do_action( 'wpinv_email_after_billing_details', $invoice ); ?>
51
+<?php do_action('wpinv_email_after_billing_details', $invoice); ?>
Please login to merge, or discard this patch.
templates/emails/wpinv-email-header.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // don't load directly
3
-if ( ! defined( 'ABSPATH' ) ) {
4
-    die( '-1' );
3
+if (!defined('ABSPATH')) {
4
+    die('-1');
5 5
 }
6 6
 
7
-if ( ! isset( $email_heading ) ) {
7
+if (!isset($email_heading)) {
8 8
     global $email_heading;
9 9
 }
10 10
 ?>
11 11
 <!DOCTYPE html>
12 12
 <html dir="<?php echo is_rtl() ? 'rtl' : 'ltr'; ?>">
13 13
     <head>
14
-        <meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo( 'charset' ); ?>" />
14
+        <meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo('charset'); ?>" />
15 15
         <meta name="viewport" content="width=device-width, initial-scale=1">
16 16
         <meta name="robots" content="noindex,nofollow">
17
-        <title><?php echo esc_html( wpinv_get_blogname() ); ?></title>
17
+        <title><?php echo esc_html(wpinv_get_blogname()); ?></title>
18 18
     </head>
19 19
     <body <?php echo is_rtl() ? 'rightmargin' : 'leftmargin'; ?>="0" marginwidth="0" topmargin="0" marginheight="0" offset="0">
20 20
         <div id="wrapper" dir="<?php echo is_rtl() ? 'rtl' : 'ltr'; ?>">
@@ -23,21 +23,21 @@  discard block
 block discarded – undo
23 23
                     <td align="center" valign="top">
24 24
                         <div id="template_header_image">
25 25
                         <?php
26
-                            $img = wpinv_get_option( 'email_header_image', '' );
27
-                            if ( $img ) {
28
-							echo '<p style="margin-top:0;"><img style="max-width:100%" src="' . esc_url( $img ) . '" alt="' . esc_attr( wpinv_get_blogname() ) . '" /></p>';
26
+                            $img = wpinv_get_option('email_header_image', '');
27
+                            if ($img) {
28
+							echo '<p style="margin-top:0;"><img style="max-width:100%" src="' . esc_url($img) . '" alt="' . esc_attr(wpinv_get_blogname()) . '" /></p>';
29 29
                             }
30 30
                         ?>
31 31
                         </div>
32 32
                         <table border="0" cellpadding="0" cellspacing="0" width="100%" id="template_container">
33
-                            <?php if ( ! empty( $email_heading ) ) { ?>
33
+                            <?php if (!empty($email_heading)) { ?>
34 34
                             <tr>
35 35
                                 <td align="center" valign="top">
36 36
                                     <!-- Header -->
37 37
                                     <table border="0" cellpadding="0" cellspacing="0" width="100%" id="template_header">
38 38
                                         <tr>
39 39
                                             <td id="header_wrapper">
40
-                                                <h1><?php echo esc_html( $email_heading ); ?></h1>
40
+                                                <h1><?php echo esc_html($email_heading); ?></h1>
41 41
                                             </td>
42 42
                                         </tr>
43 43
                                     </table>
Please login to merge, or discard this patch.
includes/user-functions.php 1 patch
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package GetPaid
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  *  Generates a users select dropdown.
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
  * @param array $args
17 17
  * @see wp_dropdown_users
18 18
  */
19
-function wpinv_dropdown_users( $args = '' ) {
19
+function wpinv_dropdown_users($args = '') {
20 20
 
21
-    if ( is_array( $args ) && ! empty( $args['show'] ) && 'display_name_with_email' == $args['show'] ) {
21
+    if (is_array($args) && !empty($args['show']) && 'display_name_with_email' == $args['show']) {
22 22
         $args['show'] = 'display_name_with_login';
23 23
     }
24 24
 
25
-    return wp_dropdown_users( $args );
25
+    return wp_dropdown_users($args);
26 26
 }
27 27
 
28 28
 /**
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
  * @return string capability to check against
33 33
  * @param string $capalibilty Optional. The alternative capability to check against.
34 34
  */
35
-function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) {
35
+function wpinv_get_capability($capalibilty = 'manage_invoicing') {
36 36
 
37
-	if ( current_user_can( 'manage_options' ) ) {
37
+	if (current_user_can('manage_options')) {
38 38
 		return 'manage_options';
39 39
 	};
40 40
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
  * @return bool
49 49
  */
50 50
 function wpinv_current_user_can_manage_invoicing() {
51
-    return current_user_can( wpinv_get_capability() );
51
+    return current_user_can(wpinv_get_capability());
52 52
 }
53 53
 
54 54
 /**
@@ -57,19 +57,19 @@  discard block
 block discarded – undo
57 57
  * @since 1.0.19
58 58
  * @return int|WP_Error
59 59
  */
60
-function wpinv_create_user( $email, $prefix = '' ) {
60
+function wpinv_create_user($email, $prefix = '') {
61 61
 
62 62
     // Prepare user values.
63
-    $prefix = preg_replace( '/\s+/', '', $prefix );
64
-    $prefix = empty( $prefix ) ? $email : $prefix;
65
-	$args   = array(
66
-		'user_login' => wpinv_generate_user_name( $prefix ),
63
+    $prefix = preg_replace('/\s+/', '', $prefix);
64
+    $prefix = empty($prefix) ? $email : $prefix;
65
+	$args = array(
66
+		'user_login' => wpinv_generate_user_name($prefix),
67 67
 		'user_pass'  => wp_generate_password(),
68 68
 		'user_email' => $email,
69 69
         'role'       => 'subscriber',
70 70
     );
71 71
 
72
-    return wp_insert_user( $args );
72
+    return wp_insert_user($args);
73 73
 
74 74
 }
75 75
 
@@ -79,26 +79,26 @@  discard block
 block discarded – undo
79 79
  * @since 1.0.19
80 80
  * @return bool|WP_User
81 81
  */
82
-function wpinv_generate_user_name( $prefix = '' ) {
82
+function wpinv_generate_user_name($prefix = '') {
83 83
 
84 84
     // If prefix is an email, retrieve the part before the email.
85
-	$prefix = strtok( $prefix, '@' );
86
-    $prefix = trim( $prefix, '.' );
85
+	$prefix = strtok($prefix, '@');
86
+    $prefix = trim($prefix, '.');
87 87
 
88 88
 	// Sanitize the username.
89
-	$prefix = sanitize_user( $prefix, true );
89
+	$prefix = sanitize_user($prefix, true);
90 90
 
91
-	$illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
92
-	if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) {
93
-		$prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 );
91
+	$illegal_logins = (array) apply_filters('illegal_user_logins', array());
92
+	if (empty($prefix) || in_array(strtolower($prefix), array_map('strtolower', $illegal_logins), true)) {
93
+		$prefix = 'gtp_' . zeroise(wp_rand(0, 9999), 4);
94 94
 	}
95 95
 
96 96
     $username = $prefix;
97 97
     $postfix  = 2;
98 98
 
99
-    while ( username_exists( $username ) ) {
99
+    while (username_exists($username)) {
100 100
         $username = $prefix + $postfix;
101
-        $postfix ++;
101
+        $postfix++;
102 102
     }
103 103
 
104 104
     return $username;
@@ -115,31 +115,31 @@  discard block
 block discarded – undo
115 115
     $tabs = array(
116 116
 
117 117
         'gp-invoices'      => array(
118
-            'label'   => __( 'Invoices', 'invoicing' ), // Name of the tab.
118
+            'label'   => __('Invoices', 'invoicing'), // Name of the tab.
119 119
             'content' => '[wpinv_history]', // Content of the tab. Or specify "callback" to provide a callback instead.
120 120
             'icon'    => 'fas fa-file-invoice', // Shown on some profile plugins.
121 121
         ),
122 122
 
123 123
         'gp-subscriptions' => array(
124
-            'label'   => __( 'Subscriptions', 'invoicing' ),
124
+            'label'   => __('Subscriptions', 'invoicing'),
125 125
             'content' => '[wpinv_subscriptions]',
126 126
             'icon'    => 'fas fa-redo',
127 127
         ),
128 128
 
129 129
         'gp-edit-address'  => array(
130
-            'label'    => __( 'Billing Address', 'invoicing' ),
130
+            'label'    => __('Billing Address', 'invoicing'),
131 131
             'callback' => 'getpaid_display_address_edit_tab',
132 132
             'icon'     => 'fas fa-credit-card',
133 133
         ),
134 134
 
135 135
     );
136 136
 
137
-    $tabs = apply_filters( 'getpaid_user_content_tabs', $tabs );
137
+    $tabs = apply_filters('getpaid_user_content_tabs', $tabs);
138 138
 
139 139
     // Make sure address editing is last on the list.
140
-    if ( isset( $tabs['gp-edit-address'] ) ) {
140
+    if (isset($tabs['gp-edit-address'])) {
141 141
         $address = $tabs['gp-edit-address'];
142
-        unset( $tabs['gp-edit-address'] );
142
+        unset($tabs['gp-edit-address']);
143 143
         $tabs['gp-edit-address'] = $address;
144 144
     }
145 145
 
@@ -153,19 +153,19 @@  discard block
 block discarded – undo
153 153
  * @param array $tab
154 154
  * @return array
155 155
  */
156
-function getpaid_prepare_user_content_tab( $tab ) {
156
+function getpaid_prepare_user_content_tab($tab) {
157 157
 
158
-    if ( ! empty( $tab['callback'] ) ) {
159
-        return call_user_func( $tab['callback'] );
158
+    if (!empty($tab['callback'])) {
159
+        return call_user_func($tab['callback']);
160 160
     }
161 161
 
162
-    if ( ! empty( $tab['content'] ) ) {
163
-        return convert_smilies( capital_P_dangit( wp_filter_content_tags( do_shortcode( shortcode_unautop( wpautop( wptexturize( do_blocks( $tab['content'] ) ) ) ) ) ) ) );
162
+    if (!empty($tab['content'])) {
163
+        return convert_smilies(capital_P_dangit(wp_filter_content_tags(do_shortcode(shortcode_unautop(wpautop(wptexturize(do_blocks($tab['content']))))))));
164 164
     }
165 165
 
166 166
     $notice = aui()->alert(
167 167
         array(
168
-            'content' => __( 'This tab has no content or content callback.', 'invoicing' ),
168
+            'content' => __('This tab has no content or content callback.', 'invoicing'),
169 169
             'type'    => 'error',
170 170
         )
171 171
     );
@@ -181,14 +181,14 @@  discard block
 block discarded – undo
181 181
  * @param string $default
182 182
  * @return array
183 183
  */
184
-function getpaid_get_tab_url( $tab, $default ) {
184
+function getpaid_get_tab_url($tab, $default) {
185 185
     global $getpaid_tab_url;
186 186
 
187
-    if ( empty( $getpaid_tab_url ) ) {
187
+    if (empty($getpaid_tab_url)) {
188 188
         return $default;
189 189
     }
190 190
 
191
-    return sprintf( $getpaid_tab_url, $tab );
191
+    return sprintf($getpaid_tab_url, $tab);
192 192
 
193 193
 }
194 194
 
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
  */
201 201
 function getpaid_display_address_edit_tab() {
202 202
 
203
-    if ( 0 === get_current_user_id() ) {
203
+    if (0 === get_current_user_id()) {
204 204
         return '<div class="bsui">' . aui()->alert(
205 205
             array(
206 206
                 'type'        => 'error',
207
-                'content'     => __( 'Your must be logged in to view this section', 'invoicing' ),
207
+                'content'     => __('Your must be logged in to view this section', 'invoicing'),
208 208
                 'dismissible' => false,
209 209
             )
210 210
         ) . '</div>';
@@ -218,19 +218,19 @@  discard block
 block discarded – undo
218 218
 
219 219
                 <?php
220 220
 
221
-                    foreach ( getpaid_user_address_fields() as $key => $label ) {
221
+                    foreach (getpaid_user_address_fields() as $key => $label) {
222 222
 
223 223
 					// Display the country.
224
-					if ( 'country' == $key ) {
224
+					if ('country' == $key) {
225 225
 
226 226
 						aui()->select(
227 227
 							array(
228 228
 								'options'     => wpinv_get_country_list(),
229
-								'name'        => 'getpaid_address[' . esc_attr( $key ) . ']',
230
-								'id'          => 'wpinv-' . sanitize_html_class( $key ),
231
-								'value'       => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ),
229
+								'name'        => 'getpaid_address[' . esc_attr($key) . ']',
230
+								'id'          => 'wpinv-' . sanitize_html_class($key),
231
+								'value'       => sanitize_text_field(getpaid_get_user_address_field(get_current_user_id(), $key)),
232 232
 								'placeholder' => $label,
233
-								'label'       => wp_kses_post( $label ),
233
+								'label'       => wp_kses_post($label),
234 234
 								'label_type'  => 'vertical',
235 235
 								'class'       => 'getpaid-address-field',
236 236
                             ),
@@ -240,30 +240,30 @@  discard block
 block discarded – undo
240 240
 					}
241 241
 
242 242
 					// Display the state.
243
-					elseif ( 'state' == $key ) {
243
+					elseif ('state' == $key) {
244 244
 
245 245
 						echo getpaid_get_states_select_markup(
246
-							getpaid_get_user_address_field( get_current_user_id(), 'country' ),
247
-							getpaid_get_user_address_field( get_current_user_id(), 'state' ),
246
+							getpaid_get_user_address_field(get_current_user_id(), 'country'),
247
+							getpaid_get_user_address_field(get_current_user_id(), 'state'),
248 248
 							$label,
249 249
 							$label,
250 250
 							'',
251 251
 							false,
252 252
 							'',
253
-							'getpaid_address[' . esc_attr( $key ) . ']'
253
+							'getpaid_address[' . esc_attr($key) . ']'
254 254
 						);
255 255
 
256 256
                         } else {
257 257
 
258 258
 						aui()->input(
259 259
                             array(
260
-                                'name'        => 'getpaid_address[' . esc_attr( $key ) . ']',
261
-                                'id'          => 'wpinv-' . sanitize_html_class( $key ),
260
+                                'name'        => 'getpaid_address[' . esc_attr($key) . ']',
261
+                                'id'          => 'wpinv-' . sanitize_html_class($key),
262 262
                                 'placeholder' => $label,
263
-                                'label'       => wp_kses_post( $label ),
263
+                                'label'       => wp_kses_post($label),
264 264
                                 'label_type'  => 'vertical',
265 265
                                 'type'        => 'text',
266
-                                'value'       => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ),
266
+                                'value'       => sanitize_text_field(getpaid_get_user_address_field(get_current_user_id(), $key)),
267 267
                                 'class'       => 'getpaid-address-field',
268 268
                             ),
269 269
                             true
@@ -277,32 +277,32 @@  discard block
 block discarded – undo
277 277
                             'name'        => 'getpaid_address[email_cc]',
278 278
                             'id'          => 'wpinv-email_cc',
279 279
                             'placeholder' => '[email protected], [email protected]',
280
-                            'label'       => __( 'Other email addresses', 'invoicing' ),
280
+                            'label'       => __('Other email addresses', 'invoicing'),
281 281
                             'label_type'  => 'vertical',
282 282
                             'type'        => 'text',
283
-                            'value'       => sanitize_text_field( get_user_meta( get_current_user_id(), '_wpinv_email_cc', true ) ),
283
+                            'value'       => sanitize_text_field(get_user_meta(get_current_user_id(), '_wpinv_email_cc', true)),
284 284
                             'class'       => 'getpaid-address-field',
285
-                            'help_text'   => __( 'Optionally provide other email addresses where we should send payment notifications', 'invoicing' ),
285
+                            'help_text'   => __('Optionally provide other email addresses where we should send payment notifications', 'invoicing'),
286 286
                         ),
287 287
                         true
288 288
                     );
289 289
 
290
-                    do_action( 'getpaid_display_address_edit_tab' );
290
+                    do_action('getpaid_display_address_edit_tab');
291 291
 
292 292
                     aui()->input(
293 293
                         array(
294 294
                             'name'      => 'getpaid_profile_edit_submit_button',
295 295
                             'id'        => 'getpaid_profile_edit_submit_button',
296
-                            'value'     => __( 'Save Address', 'invoicing' ),
297
-                            'help_text' => __( 'New invoices will use this address as the billing address.', 'invoicing' ),
296
+                            'value'     => __('Save Address', 'invoicing'),
297
+                            'help_text' => __('New invoices will use this address as the billing address.', 'invoicing'),
298 298
                             'type'      => 'submit',
299 299
                             'class'     => 'btn btn-primary btn-block submit-button',
300 300
                         ),
301 301
                         true
302 302
                     );
303 303
 
304
-                    wp_nonce_field( 'getpaid-nonce', 'getpaid-nonce' );
305
-                    getpaid_hidden_field( 'getpaid-action', 'edit_billing_details' );
304
+                    wp_nonce_field('getpaid-nonce', 'getpaid-nonce');
305
+                    getpaid_hidden_field('getpaid-action', 'edit_billing_details');
306 306
                 ?>
307 307
 
308 308
             </form>
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 
313 313
     return ob_get_clean();
314 314
 }
315
-add_shortcode( 'getpaid_edit_address', 'getpaid_display_address_edit_tab' );
315
+add_shortcode('getpaid_edit_address', 'getpaid_display_address_edit_tab');
316 316
 
317 317
 /**
318 318
  * Saves the billing address edit tab.
@@ -320,30 +320,30 @@  discard block
 block discarded – undo
320 320
  * @since 2.1.4
321 321
  * @param array $data
322 322
  */
323
-function getpaid_save_address_edit_tab( $data ) {
323
+function getpaid_save_address_edit_tab($data) {
324 324
 
325
-    if ( empty( $data['getpaid_address'] ) || ! is_array( $data['getpaid_address'] ) ) {
325
+    if (empty($data['getpaid_address']) || !is_array($data['getpaid_address'])) {
326 326
         return;
327 327
     }
328 328
 
329 329
     $data    = $data['getpaid_address'];
330 330
     $user_id = get_current_user_id();
331 331
 
332
-    foreach ( array_keys( getpaid_user_address_fields() ) as $field ) {
332
+    foreach (array_keys(getpaid_user_address_fields()) as $field) {
333 333
 
334
-        if ( isset( $data[ $field ] ) ) {
335
-            $value = sanitize_text_field( $data[ $field ] );
336
-            update_user_meta( $user_id, '_wpinv_' . $field, $value );
334
+        if (isset($data[$field])) {
335
+            $value = sanitize_text_field($data[$field]);
336
+            update_user_meta($user_id, '_wpinv_' . $field, $value);
337 337
         }
338 338
 }
339 339
 
340
-    if ( isset( $data['email_cc'] ) ) {
341
-        update_user_meta( $user_id, '_wpinv_email_cc', sanitize_text_field( $data['email_cc'] ) );
340
+    if (isset($data['email_cc'])) {
341
+        update_user_meta($user_id, '_wpinv_email_cc', sanitize_text_field($data['email_cc']));
342 342
     }
343 343
 
344
-    wpinv_set_error( 'address_updated', __( 'Your billing address has been updated', 'invoicing' ), 'success' );
344
+    wpinv_set_error('address_updated', __('Your billing address has been updated', 'invoicing'), 'success');
345 345
 }
346
-add_action( 'getpaid_authenticated_action_edit_billing_details', 'getpaid_save_address_edit_tab' );
346
+add_action('getpaid_authenticated_action_edit_billing_details', 'getpaid_save_address_edit_tab');
347 347
 
348 348
 
349 349
 /*
@@ -361,27 +361,27 @@  discard block
 block discarded – undo
361 361
  * @param  array $tabs
362 362
  * @return array
363 363
  */
364
-function getpaid_filter_userswp_account_tabs( $tabs ) {
364
+function getpaid_filter_userswp_account_tabs($tabs) {
365 365
 
366 366
     // Abort if the integration is inactive.
367
-    if ( ! getpaid_is_userswp_integration_active() ) {
367
+    if (!getpaid_is_userswp_integration_active()) {
368 368
         return $tabs;
369 369
     }
370 370
 
371
-    $new_tabs   = array();
371
+    $new_tabs = array();
372 372
 
373
-    foreach ( getpaid_get_user_content_tabs() as $slug => $tab ) {
373
+    foreach (getpaid_get_user_content_tabs() as $slug => $tab) {
374 374
 
375
-        $new_tabs[ $slug ] = array(
375
+        $new_tabs[$slug] = array(
376 376
             'title' => $tab['label'],
377 377
             'icon'  => $tab['icon'],
378 378
         );
379 379
 
380 380
     }
381 381
 
382
-    return array_merge( $tabs, $new_tabs );
382
+    return array_merge($tabs, $new_tabs);
383 383
 }
384
-add_filter( 'uwp_account_available_tabs', 'getpaid_filter_userswp_account_tabs' );
384
+add_filter('uwp_account_available_tabs', 'getpaid_filter_userswp_account_tabs');
385 385
 
386 386
 /**
387 387
  * Display our UsersWP account tabs.
@@ -390,18 +390,18 @@  discard block
 block discarded – undo
390 390
  * @param  array $tabs
391 391
  * @return array
392 392
  */
393
-function getpaid_display_userswp_account_tabs( $tab ) {
393
+function getpaid_display_userswp_account_tabs($tab) {
394 394
     global $getpaid_tab_url;
395 395
 
396 396
     $our_tabs = getpaid_get_user_content_tabs();
397 397
 
398
-    if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) {
399
-        $getpaid_tab_url = add_query_arg( 'type', '%s', uwp_get_account_page_url() );
400
-        echo getpaid_prepare_user_content_tab( $our_tabs[ $tab ] );
398
+    if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) {
399
+        $getpaid_tab_url = add_query_arg('type', '%s', uwp_get_account_page_url());
400
+        echo getpaid_prepare_user_content_tab($our_tabs[$tab]);
401 401
     }
402 402
 
403 403
 }
404
-add_action( 'uwp_account_form_display', 'getpaid_display_userswp_account_tabs' );
404
+add_action('uwp_account_form_display', 'getpaid_display_userswp_account_tabs');
405 405
 
406 406
 
407 407
 /**
@@ -412,17 +412,17 @@  discard block
 block discarded – undo
412 412
  * @param  string $tab   Current tab.
413 413
  * @return string Title.
414 414
  */
415
-function getpaid_filter_userswp_account_title( $title, $tab ) {
415
+function getpaid_filter_userswp_account_title($title, $tab) {
416 416
 
417
-    $our_tabs   = getpaid_get_user_content_tabs();
417
+    $our_tabs = getpaid_get_user_content_tabs();
418 418
 
419
-    if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) {
420
-        return $our_tabs[ $tab ]['label'];
419
+    if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) {
420
+        return $our_tabs[$tab]['label'];
421 421
     }
422 422
 
423 423
     return $title;
424 424
 }
425
-add_filter( 'uwp_account_page_title', 'getpaid_filter_userswp_account_title', 10, 2 );
425
+add_filter('uwp_account_page_title', 'getpaid_filter_userswp_account_title', 10, 2);
426 426
 
427 427
 /**
428 428
  * Registers the UsersWP integration settings.
@@ -431,26 +431,26 @@  discard block
 block discarded – undo
431 431
  * @param  array $settings An array of integration settings.
432 432
  * @return array
433 433
  */
434
-function getpaid_register_userswp_settings( $settings ) {
434
+function getpaid_register_userswp_settings($settings) {
435 435
 
436
-    if ( defined( 'USERSWP_PLUGIN_FILE' ) ) {
436
+    if (defined('USERSWP_PLUGIN_FILE')) {
437 437
 
438 438
         $settings[] = array(
439 439
 
440 440
             'id'       => 'userswp',
441
-            'label'    => __( 'UsersWP', 'invoicing' ),
441
+            'label'    => __('UsersWP', 'invoicing'),
442 442
             'settings' => array(
443 443
 
444 444
                 'userswp_settings' => array(
445 445
                     'id'   => 'userswp_settings',
446
-                    'name' => '<h3>' . __( 'UsersWP', 'invoicing' ) . '</h3>',
446
+                    'name' => '<h3>' . __('UsersWP', 'invoicing') . '</h3>',
447 447
                     'type' => 'header',
448 448
                 ),
449 449
 
450 450
                 'enable_userswp'   => array(
451 451
                     'id'   => 'enable_userswp',
452
-                    'name' => __( 'Enable Integration', 'invoicing' ),
453
-                    'desc' => __( 'Display GetPaid items on UsersWP account page.', 'invoicing' ),
452
+                    'name' => __('Enable Integration', 'invoicing'),
453
+                    'desc' => __('Display GetPaid items on UsersWP account page.', 'invoicing'),
454 454
                     'type' => 'checkbox',
455 455
                     'std'  => 1,
456 456
                 ),
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 
464 464
     return $settings;
465 465
 }
466
-add_filter( 'getpaid_integration_settings', 'getpaid_register_userswp_settings' );
466
+add_filter('getpaid_integration_settings', 'getpaid_register_userswp_settings');
467 467
 
468 468
 /**
469 469
  * Ovewrites the invoices history page to UsersWP.
@@ -471,18 +471,18 @@  discard block
 block discarded – undo
471 471
  * @since  2.3.1
472 472
  * @return bool
473 473
  */
474
-function getpaid_userswp_overwrite_invoice_history_page( $url, $post_type ) {
474
+function getpaid_userswp_overwrite_invoice_history_page($url, $post_type) {
475 475
 
476 476
     $our_tabs = getpaid_get_user_content_tabs();
477 477
     $tab      = "gp-{$post_type}s";
478
-    if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) {
479
-        return add_query_arg( 'type', $tab, uwp_get_account_page_url() );
478
+    if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) {
479
+        return add_query_arg('type', $tab, uwp_get_account_page_url());
480 480
     }
481 481
 
482 482
     return $url;
483 483
 
484 484
 }
485
-add_filter( 'wpinv_get_history_page_uri', 'getpaid_userswp_overwrite_invoice_history_page', 10, 2 );
485
+add_filter('wpinv_get_history_page_uri', 'getpaid_userswp_overwrite_invoice_history_page', 10, 2);
486 486
 
487 487
 /**
488 488
  * Checks if the integration is enabled.
@@ -491,8 +491,8 @@  discard block
 block discarded – undo
491 491
  * @return bool
492 492
  */
493 493
 function getpaid_is_userswp_integration_active() {
494
-    $enabled = wpinv_get_option( 'enable_userswp', 1 );
495
-    return defined( 'USERSWP_PLUGIN_FILE' ) && ! empty( $enabled );
494
+    $enabled = wpinv_get_option('enable_userswp', 1);
495
+    return defined('USERSWP_PLUGIN_FILE') && !empty($enabled);
496 496
 }
497 497
 
498 498
 /*
@@ -510,26 +510,26 @@  discard block
 block discarded – undo
510 510
  * @param  array $settings An array of integration settings.
511 511
  * @return array
512 512
  */
513
-function getpaid_register_buddypress_settings( $settings ) {
513
+function getpaid_register_buddypress_settings($settings) {
514 514
 
515
-    if ( class_exists( 'BuddyPress' ) ) {
515
+    if (class_exists('BuddyPress')) {
516 516
 
517 517
         $settings[] = array(
518 518
 
519 519
             'id'       => 'buddypress',
520
-            'label'    => __( 'BuddyPress', 'invoicing' ),
520
+            'label'    => __('BuddyPress', 'invoicing'),
521 521
             'settings' => array(
522 522
 
523 523
                 'buddypress_settings' => array(
524 524
                     'id'   => 'buddypress_settings',
525
-                    'name' => '<h3>' . __( 'BuddyPress', 'invoicing' ) . '</h3>',
525
+                    'name' => '<h3>' . __('BuddyPress', 'invoicing') . '</h3>',
526 526
                     'type' => 'header',
527 527
                 ),
528 528
 
529 529
                 'enable_buddypress'   => array(
530 530
                     'id'   => 'enable_buddypress',
531
-                    'name' => __( 'Enable Integration', 'invoicing' ),
532
-                    'desc' => __( 'Display GetPaid items on BuddyPress account pages.', 'invoicing' ),
531
+                    'name' => __('Enable Integration', 'invoicing'),
532
+                    'desc' => __('Display GetPaid items on BuddyPress account pages.', 'invoicing'),
533 533
                     'type' => 'checkbox',
534 534
                     'std'  => 1,
535 535
                 ),
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 
543 543
     return $settings;
544 544
 }
545
-add_filter( 'getpaid_integration_settings', 'getpaid_register_buddypress_settings' );
545
+add_filter('getpaid_integration_settings', 'getpaid_register_buddypress_settings');
546 546
 
547 547
 /**
548 548
  * Checks if the integration is enabled.
@@ -551,8 +551,8 @@  discard block
 block discarded – undo
551 551
  * @return bool
552 552
  */
553 553
 function getpaid_is_buddypress_integration_active() {
554
-    $enabled = wpinv_get_option( 'enable_buddypress', 1 );
555
-    return class_exists( 'BuddyPress' ) && ! empty( $enabled );
554
+    $enabled = wpinv_get_option('enable_buddypress', 1);
555
+    return class_exists('BuddyPress') && !empty($enabled);
556 556
 }
557 557
 
558 558
 /**
@@ -563,10 +563,10 @@  discard block
 block discarded – undo
563 563
  */
564 564
 function getpaid_setup_buddypress_integration() {
565 565
 
566
-    if ( getpaid_is_buddypress_integration_active() ) {
566
+    if (getpaid_is_buddypress_integration_active()) {
567 567
         require_once WPINV_PLUGIN_DIR . 'includes/class-bp-getpaid-component.php';
568 568
         buddypress()->getpaid = new BP_GetPaid_Component();
569 569
     }
570 570
 
571 571
 }
572
-add_action( 'bp_setup_components', 'getpaid_setup_buddypress_integration' );
572
+add_action('bp_setup_components', 'getpaid_setup_buddypress_integration');
Please login to merge, or discard this patch.
includes/admin/subscriptions.php 1 patch
Spacing   +204 added lines, -204 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Contains functions that display the subscriptions admin page.
4 4
  */
5 5
 
6
-defined( 'ABSPATH' ) || exit;
6
+defined('ABSPATH') || exit;
7 7
 
8 8
 /**
9 9
  * Render the Subscriptions page
@@ -17,23 +17,23 @@  discard block
 block discarded – undo
17 17
 	?>
18 18
 
19 19
 	<div class="wrap">
20
-		<h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
20
+		<h1><?php echo esc_html(get_admin_page_title()); ?></h1>
21 21
 		<div class="bsui">
22 22
 
23 23
 			<?php
24 24
 
25 25
 				// Verify user permissions.
26
-				if ( ! wpinv_current_user_can_manage_invoicing() ) {
26
+				if (!wpinv_current_user_can_manage_invoicing()) {
27 27
 
28 28
 				aui()->alert(
29 29
                     array(
30 30
 						'type'    => 'danger',
31
-						'content' => __( 'You are not permitted to view this page.', 'invoicing' ),
31
+						'content' => __('You are not permitted to view this page.', 'invoicing'),
32 32
 					),
33 33
 					true
34 34
                 );
35 35
 
36
-				} elseif ( ! empty( $_GET['id'] ) && is_numeric( $_GET['id'] ) ) {
36
+				} elseif (!empty($_GET['id']) && is_numeric($_GET['id'])) {
37 37
 
38 38
 				// Display a single subscription.
39 39
 				wpinv_recurring_subscription_details();
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	<?php $subscribers_table->views(); ?>
68 68
 	<form id="subscribers-filter" class="bsui" method="get">
69 69
 		<input type="hidden" name="page" value="wpinv-subscriptions" />
70
-		<?php $subscribers_table->search_box( __( 'Search Subscriptions', 'invoicing' ), 'getpaid-search-subscriptions' ); ?>
70
+		<?php $subscribers_table->search_box(__('Search Subscriptions', 'invoicing'), 'getpaid-search-subscriptions'); ?>
71 71
 		<?php $subscribers_table->display(); ?>
72 72
 	</form>
73 73
 	<?php
@@ -83,13 +83,13 @@  discard block
 block discarded – undo
83 83
 function wpinv_recurring_subscription_details() {
84 84
 
85 85
 	// Fetch the subscription.
86
-	$sub = new WPInv_Subscription( (int) $_GET['id'] );
87
-	if ( ! $sub->exists() ) {
86
+	$sub = new WPInv_Subscription((int) $_GET['id']);
87
+	if (!$sub->exists()) {
88 88
 
89 89
 		aui()->alert(
90 90
 			array(
91 91
 				'type'    => 'danger',
92
-				'content' => __( 'Subscription not found.', 'invoicing' ),
92
+				'content' => __('Subscription not found.', 'invoicing'),
93 93
 			),
94 94
 			true
95 95
 		);
@@ -98,32 +98,32 @@  discard block
 block discarded – undo
98 98
 	}
99 99
 
100 100
 	// Use metaboxes to display the subscription details.
101
-	add_meta_box( 'getpaid_admin_subscription_details_metabox', __( 'Subscription Details', 'invoicing' ), 'getpaid_admin_subscription_details_metabox', get_current_screen(), 'normal', 'high' );
102
-	add_meta_box( 'getpaid_admin_subscription_update_metabox', __( 'Change Status', 'invoicing' ), 'getpaid_admin_subscription_update_metabox', get_current_screen(), 'side' );
101
+	add_meta_box('getpaid_admin_subscription_details_metabox', __('Subscription Details', 'invoicing'), 'getpaid_admin_subscription_details_metabox', get_current_screen(), 'normal', 'high');
102
+	add_meta_box('getpaid_admin_subscription_update_metabox', __('Change Status', 'invoicing'), 'getpaid_admin_subscription_update_metabox', get_current_screen(), 'side');
103 103
 
104 104
 	$subscription_id     = $sub->get_id();
105
-	$subscription_groups = getpaid_get_invoice_subscription_groups( $sub->get_parent_invoice_id() );
106
-	$subscription_group  = wp_list_filter( $subscription_groups, compact( 'subscription_id' ) );
105
+	$subscription_groups = getpaid_get_invoice_subscription_groups($sub->get_parent_invoice_id());
106
+	$subscription_group  = wp_list_filter($subscription_groups, compact('subscription_id'));
107 107
 
108
-	if ( 1 < count( $subscription_groups ) ) {
109
-		add_meta_box( 'getpaid_admin_subscription_related_subscriptions_metabox', __( 'Related Subscriptions', 'invoicing' ), 'getpaid_admin_subscription_related_subscriptions_metabox', get_current_screen(), 'advanced' );
108
+	if (1 < count($subscription_groups)) {
109
+		add_meta_box('getpaid_admin_subscription_related_subscriptions_metabox', __('Related Subscriptions', 'invoicing'), 'getpaid_admin_subscription_related_subscriptions_metabox', get_current_screen(), 'advanced');
110 110
 	}
111 111
 
112
-	if ( ! empty( $subscription_group ) ) {
113
-		add_meta_box( 'getpaid_admin_subscription_item_details_metabox', __( 'Subscription Items', 'invoicing' ), 'getpaid_admin_subscription_item_details_metabox', get_current_screen(), 'normal', 'low' );
112
+	if (!empty($subscription_group)) {
113
+		add_meta_box('getpaid_admin_subscription_item_details_metabox', __('Subscription Items', 'invoicing'), 'getpaid_admin_subscription_item_details_metabox', get_current_screen(), 'normal', 'low');
114 114
 	}
115 115
 
116
-	add_meta_box( 'getpaid_admin_subscription_invoice_details_metabox', __( 'Related Invoices', 'invoicing' ), 'getpaid_admin_subscription_invoice_details_metabox', get_current_screen(), 'advanced' );
116
+	add_meta_box('getpaid_admin_subscription_invoice_details_metabox', __('Related Invoices', 'invoicing'), 'getpaid_admin_subscription_invoice_details_metabox', get_current_screen(), 'advanced');
117 117
 
118
-	do_action( 'getpaid_admin_single_subscription_register_metabox', $sub );
118
+	do_action('getpaid_admin_single_subscription_register_metabox', $sub);
119 119
 
120 120
 	?>
121 121
 
122
-		<form method="post" action="<?php echo admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $sub->get_id() ) ); ?>">
122
+		<form method="post" action="<?php echo admin_url('admin.php?page=wpinv-subscriptions&id=' . absint($sub->get_id())); ?>">
123 123
 
124
-			<?php wp_nonce_field( 'getpaid-nonce', 'getpaid-nonce' ); ?>
125
-			<?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
126
-			<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
124
+			<?php wp_nonce_field('getpaid-nonce', 'getpaid-nonce'); ?>
125
+			<?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?>
126
+			<?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?>
127 127
 			<input type="hidden" name="getpaid-admin-action" value="update_single_subscription" />
128 128
 			<input type="hidden" name="subscription_id" value="<?php echo (int) $sub->get_id(); ?>" />
129 129
 
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
 				<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
132 132
 
133 133
 					<div id="postbox-container-1" class="postbox-container">
134
-						<?php do_meta_boxes( get_current_screen(), 'side', $sub ); ?>
134
+						<?php do_meta_boxes(get_current_screen(), 'side', $sub); ?>
135 135
 					</div>
136 136
 
137 137
 					<div id="postbox-container-2" class="postbox-container">
138
-						<?php do_meta_boxes( get_current_screen(), 'normal', $sub ); ?>
139
-						<?php do_meta_boxes( get_current_screen(), 'advanced', $sub ); ?>
138
+						<?php do_meta_boxes(get_current_screen(), 'normal', $sub); ?>
139
+						<?php do_meta_boxes(get_current_screen(), 'advanced', $sub); ?>
140 140
 					</div>
141 141
 
142 142
 				</div>
@@ -155,43 +155,43 @@  discard block
 block discarded – undo
155 155
  *
156 156
  * @param WPInv_Subscription $sub
157 157
  */
158
-function getpaid_admin_subscription_details_metabox( $sub ) {
158
+function getpaid_admin_subscription_details_metabox($sub) {
159 159
 
160 160
 	// Subscription items.
161
-	$subscription_group = getpaid_get_invoice_subscription_group( $sub->get_parent_invoice_id(), $sub->get_id() );
162
-	$items_count        = empty( $subscription_group ) ? 1 : count( $subscription_group['items'] );
161
+	$subscription_group = getpaid_get_invoice_subscription_group($sub->get_parent_invoice_id(), $sub->get_id());
162
+	$items_count        = empty($subscription_group) ? 1 : count($subscription_group['items']);
163 163
 
164 164
 	// Prepare subscription detail columns.
165 165
 	$fields = apply_filters(
166 166
 		'getpaid_subscription_admin_page_fields',
167 167
 		array(
168
-			'subscription' => __( 'Subscription', 'invoicing' ),
169
-			'customer'     => __( 'Customer', 'invoicing' ),
170
-			'amount'       => __( 'Amount', 'invoicing' ),
171
-			'start_date'   => __( 'Start Date', 'invoicing' ),
172
-			'renews_on'    => __( 'Next Payment', 'invoicing' ),
173
-			'renewals'     => __( 'Payments', 'invoicing' ),
174
-			'item'         => _n( 'Item', 'Items', $items_count, 'invoicing' ),
175
-			'gateway'      => __( 'Payment Method', 'invoicing' ),
176
-			'profile_id'   => __( 'Profile ID', 'invoicing' ),
177
-			'status'       => __( 'Status', 'invoicing' ),
168
+			'subscription' => __('Subscription', 'invoicing'),
169
+			'customer'     => __('Customer', 'invoicing'),
170
+			'amount'       => __('Amount', 'invoicing'),
171
+			'start_date'   => __('Start Date', 'invoicing'),
172
+			'renews_on'    => __('Next Payment', 'invoicing'),
173
+			'renewals'     => __('Payments', 'invoicing'),
174
+			'item'         => _n('Item', 'Items', $items_count, 'invoicing'),
175
+			'gateway'      => __('Payment Method', 'invoicing'),
176
+			'profile_id'   => __('Profile ID', 'invoicing'),
177
+			'status'       => __('Status', 'invoicing'),
178 178
 		)
179 179
 	);
180 180
 
181
-	if ( ! $sub->is_active() ) {
181
+	if (!$sub->is_active()) {
182 182
 
183
-		if ( isset( $fields['renews_on'] ) ) {
184
-			unset( $fields['renews_on'] );
183
+		if (isset($fields['renews_on'])) {
184
+			unset($fields['renews_on']);
185 185
 		}
186 186
 
187
-		if ( isset( $fields['gateway'] ) ) {
188
-			unset( $fields['gateway'] );
187
+		if (isset($fields['gateway'])) {
188
+			unset($fields['gateway']);
189 189
 		}
190 190
 }
191 191
 
192 192
 	$profile_id = $sub->get_profile_id();
193
-	if ( empty( $profile_id ) && isset( $fields['profile_id'] ) ) {
194
-		unset( $fields['profile_id'] );
193
+	if (empty($profile_id) && isset($fields['profile_id'])) {
194
+		unset($fields['profile_id']);
195 195
 	}
196 196
 
197 197
 	?>
@@ -199,16 +199,16 @@  discard block
 block discarded – undo
199 199
 		<table class="table table-borderless" style="font-size: 14px;">
200 200
 			<tbody>
201 201
 
202
-				<?php foreach ( $fields as $key => $label ) : ?>
202
+				<?php foreach ($fields as $key => $label) : ?>
203 203
 
204
-					<tr class="getpaid-subscription-meta-<?php echo sanitize_html_class( $key ); ?>">
204
+					<tr class="getpaid-subscription-meta-<?php echo sanitize_html_class($key); ?>">
205 205
 
206 206
 						<th class="w-25" style="font-weight: 500;">
207
-							<?php echo esc_html( $label ); ?>
207
+							<?php echo esc_html($label); ?>
208 208
 						</th>
209 209
 
210 210
 						<td class="w-75 text-muted">
211
-							<?php do_action( 'getpaid_subscription_admin_display_' . sanitize_key( $key ), $sub, $subscription_group ); ?>
211
+							<?php do_action('getpaid_subscription_admin_display_' . sanitize_key($key), $sub, $subscription_group); ?>
212 212
 						</td>
213 213
 
214 214
 					</tr>
@@ -226,135 +226,135 @@  discard block
 block discarded – undo
226 226
  *
227 227
  * @param WPInv_Subscription $subscription
228 228
  */
229
-function getpaid_admin_subscription_metabox_display_customer( $subscription ) {
229
+function getpaid_admin_subscription_metabox_display_customer($subscription) {
230 230
 
231
-	$username = __( '(Missing User)', 'invoicing' );
231
+	$username = __('(Missing User)', 'invoicing');
232 232
 
233
-	$user = get_userdata( $subscription->get_customer_id() );
234
-	if ( $user ) {
233
+	$user = get_userdata($subscription->get_customer_id());
234
+	if ($user) {
235 235
 
236 236
 		$username = sprintf(
237 237
 			'<a href="user-edit.php?user_id=%s">%s</a>',
238
-			absint( $user->ID ),
239
-			! empty( $user->display_name ) ? esc_html( $user->display_name ) : sanitize_email( $user->user_email )
238
+			absint($user->ID),
239
+			!empty($user->display_name) ? esc_html($user->display_name) : sanitize_email($user->user_email)
240 240
 		);
241 241
 
242 242
 	}
243 243
 
244
-	echo wp_kses_post( $username );
244
+	echo wp_kses_post($username);
245 245
 }
246
-add_action( 'getpaid_subscription_admin_display_customer', 'getpaid_admin_subscription_metabox_display_customer' );
246
+add_action('getpaid_subscription_admin_display_customer', 'getpaid_admin_subscription_metabox_display_customer');
247 247
 
248 248
 /**
249 249
  * Displays the subscription amount.
250 250
  *
251 251
  * @param WPInv_Subscription $subscription
252 252
  */
253
-function getpaid_admin_subscription_metabox_display_amount( $subscription ) {
254
-	$amount    = wp_kses_post( getpaid_get_formatted_subscription_amount( $subscription ) );
253
+function getpaid_admin_subscription_metabox_display_amount($subscription) {
254
+	$amount = wp_kses_post(getpaid_get_formatted_subscription_amount($subscription));
255 255
 	echo "<span>$amount</span>";
256 256
 }
257
-add_action( 'getpaid_subscription_admin_display_amount', 'getpaid_admin_subscription_metabox_display_amount' );
257
+add_action('getpaid_subscription_admin_display_amount', 'getpaid_admin_subscription_metabox_display_amount');
258 258
 
259 259
 /**
260 260
  * Displays the subscription id.
261 261
  *
262 262
  * @param WPInv_Subscription $subscription
263 263
  */
264
-function getpaid_admin_subscription_metabox_display_id( $subscription ) {
264
+function getpaid_admin_subscription_metabox_display_id($subscription) {
265 265
 
266 266
 	printf(
267 267
 		'<a href="%s">#%s</a>',
268
-		esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $subscription->get_id() ) ) ),
269
-		absint( $subscription->get_id() )
268
+		esc_url(admin_url('admin.php?page=wpinv-subscriptions&id=' . absint($subscription->get_id()))),
269
+		absint($subscription->get_id())
270 270
 	);
271 271
 
272 272
 }
273
-add_action( 'getpaid_subscription_admin_display_subscription', 'getpaid_admin_subscription_metabox_display_id' );
273
+add_action('getpaid_subscription_admin_display_subscription', 'getpaid_admin_subscription_metabox_display_id');
274 274
 
275 275
 /**
276 276
  * Displays the subscription renewal date.
277 277
  *
278 278
  * @param WPInv_Subscription $subscription
279 279
  */
280
-function getpaid_admin_subscription_metabox_display_start_date( $subscription ) {
281
-	echo getpaid_format_date_value( $subscription->get_date_created() );
280
+function getpaid_admin_subscription_metabox_display_start_date($subscription) {
281
+	echo getpaid_format_date_value($subscription->get_date_created());
282 282
 }
283
-add_action( 'getpaid_subscription_admin_display_start_date', 'getpaid_admin_subscription_metabox_display_start_date' );
283
+add_action('getpaid_subscription_admin_display_start_date', 'getpaid_admin_subscription_metabox_display_start_date');
284 284
 
285 285
 /**
286 286
  * Displays the subscription renewal date.
287 287
  *
288 288
  * @param WPInv_Subscription $subscription
289 289
  */
290
-function getpaid_admin_subscription_metabox_display_renews_on( $subscription ) {
291
-	echo getpaid_format_date_value( $subscription->get_expiration() );
290
+function getpaid_admin_subscription_metabox_display_renews_on($subscription) {
291
+	echo getpaid_format_date_value($subscription->get_expiration());
292 292
 }
293
-add_action( 'getpaid_subscription_admin_display_renews_on', 'getpaid_admin_subscription_metabox_display_renews_on' );
293
+add_action('getpaid_subscription_admin_display_renews_on', 'getpaid_admin_subscription_metabox_display_renews_on');
294 294
 
295 295
 /**
296 296
  * Displays the subscription renewal count.
297 297
  *
298 298
  * @param WPInv_Subscription $subscription
299 299
  */
300
-function getpaid_admin_subscription_metabox_display_renewals( $subscription ) {
300
+function getpaid_admin_subscription_metabox_display_renewals($subscription) {
301 301
 	$max_bills = $subscription->get_bill_times();
302
-	echo ( (int) $subscription->get_times_billed() ) . ' / ' . ( empty( $max_bills ) ? '&infin;' : (int) $max_bills );
302
+	echo ((int) $subscription->get_times_billed()) . ' / ' . (empty($max_bills) ? '&infin;' : (int) $max_bills);
303 303
 }
304
-add_action( 'getpaid_subscription_admin_display_renewals', 'getpaid_admin_subscription_metabox_display_renewals' );
304
+add_action('getpaid_subscription_admin_display_renewals', 'getpaid_admin_subscription_metabox_display_renewals');
305 305
 /**
306 306
  * Displays the subscription item.
307 307
  *
308 308
  * @param WPInv_Subscription $subscription
309 309
  * @param false|array $subscription_group
310 310
  */
311
-function getpaid_admin_subscription_metabox_display_item( $subscription, $subscription_group = false ) {
311
+function getpaid_admin_subscription_metabox_display_item($subscription, $subscription_group = false) {
312 312
 
313
-	if ( empty( $subscription_group ) ) {
314
-		echo WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() );
313
+	if (empty($subscription_group)) {
314
+		echo WPInv_Subscriptions_List_Table::generate_item_markup($subscription->get_product_id());
315 315
 		return;
316 316
 	}
317 317
 
318
-	$markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) );
319
-	echo wp_kses_post( implode( ' | ', $markup ) );
318
+	$markup = array_map(array('WPInv_Subscriptions_List_Table', 'generate_item_markup'), array_keys($subscription_group['items']));
319
+	echo wp_kses_post(implode(' | ', $markup));
320 320
 
321 321
 }
322
-add_action( 'getpaid_subscription_admin_display_item', 'getpaid_admin_subscription_metabox_display_item', 10, 2 );
322
+add_action('getpaid_subscription_admin_display_item', 'getpaid_admin_subscription_metabox_display_item', 10, 2);
323 323
 
324 324
 /**
325 325
  * Displays the subscription gateway.
326 326
  *
327 327
  * @param WPInv_Subscription $subscription
328 328
  */
329
-function getpaid_admin_subscription_metabox_display_gateway( $subscription ) {
329
+function getpaid_admin_subscription_metabox_display_gateway($subscription) {
330 330
 
331 331
 	$gateway = $subscription->get_gateway();
332 332
 
333
-	if ( ! empty( $gateway ) ) {
334
-		echo esc_html( wpinv_get_gateway_admin_label( $gateway ) );
333
+	if (!empty($gateway)) {
334
+		echo esc_html(wpinv_get_gateway_admin_label($gateway));
335 335
 	} else {
336 336
 		echo '&mdash;';
337 337
 	}
338 338
 
339 339
 }
340
-add_action( 'getpaid_subscription_admin_display_gateway', 'getpaid_admin_subscription_metabox_display_gateway' );
340
+add_action('getpaid_subscription_admin_display_gateway', 'getpaid_admin_subscription_metabox_display_gateway');
341 341
 
342 342
 /**
343 343
  * Displays the subscription status.
344 344
  *
345 345
  * @param WPInv_Subscription $subscription
346 346
  */
347
-function getpaid_admin_subscription_metabox_display_status( $subscription ) {
348
-	echo wp_kses_post( $subscription->get_status_label_html() );
347
+function getpaid_admin_subscription_metabox_display_status($subscription) {
348
+	echo wp_kses_post($subscription->get_status_label_html());
349 349
 }
350
-add_action( 'getpaid_subscription_admin_display_status', 'getpaid_admin_subscription_metabox_display_status' );
350
+add_action('getpaid_subscription_admin_display_status', 'getpaid_admin_subscription_metabox_display_status');
351 351
 
352 352
 /**
353 353
  * Displays the subscription profile id.
354 354
  *
355 355
  * @param WPInv_Subscription $subscription
356 356
  */
357
-function getpaid_admin_subscription_metabox_display_profile_id( $subscription ) {
357
+function getpaid_admin_subscription_metabox_display_profile_id($subscription) {
358 358
 
359 359
 	$profile_id = $subscription->get_profile_id();
360 360
 
@@ -363,31 +363,31 @@  discard block
 block discarded – undo
363 363
 			'type'              => 'text',
364 364
 			'id'                => 'wpinv_subscription_profile_id',
365 365
 			'name'              => 'wpinv_subscription_profile_id',
366
-			'label'             => __( 'Profile Id', 'invoicing' ),
366
+			'label'             => __('Profile Id', 'invoicing'),
367 367
 			'label_type'        => 'hidden',
368
-			'placeholder'       => __( 'Profile Id', 'invoicing' ),
369
-			'value'             => esc_attr( $profile_id ),
368
+			'placeholder'       => __('Profile Id', 'invoicing'),
369
+			'value'             => esc_attr($profile_id),
370 370
 			'input_group_right' => '',
371 371
 			'no_wrap'           => true,
372 372
 		)
373 373
 	);
374 374
 
375
-	echo str_ireplace( 'form-control', 'regular-text', $input );
375
+	echo str_ireplace('form-control', 'regular-text', $input);
376 376
 
377
-	$url = apply_filters( 'getpaid_remote_subscription_profile_url', '', $subscription );
378
-	if ( ! empty( $url ) ) {
379
-		echo '&nbsp;<a href="' . esc_url_raw( $url ) . '" title="' . __( 'View in Gateway', 'invoicing' ) . '" target="_blank"><i class="fas fa-external-link-alt fa-xs fa-fw align-top"></i></a>';
377
+	$url = apply_filters('getpaid_remote_subscription_profile_url', '', $subscription);
378
+	if (!empty($url)) {
379
+		echo '&nbsp;<a href="' . esc_url_raw($url) . '" title="' . __('View in Gateway', 'invoicing') . '" target="_blank"><i class="fas fa-external-link-alt fa-xs fa-fw align-top"></i></a>';
380 380
 	}
381 381
 
382 382
 }
383
-add_action( 'getpaid_subscription_admin_display_profile_id', 'getpaid_admin_subscription_metabox_display_profile_id' );
383
+add_action('getpaid_subscription_admin_display_profile_id', 'getpaid_admin_subscription_metabox_display_profile_id');
384 384
 
385 385
 /**
386 386
  * Displays the subscriptions update metabox.
387 387
  *
388 388
  * @param WPInv_Subscription $subscription
389 389
  */
390
-function getpaid_admin_subscription_update_metabox( $subscription ) {
390
+function getpaid_admin_subscription_update_metabox($subscription) {
391 391
 
392 392
 	?>
393 393
 	<div class="mt-3">
@@ -400,10 +400,10 @@  discard block
 block discarded – undo
400 400
 					'id'        => 'subscription_status_update_select',
401 401
 					'required'  => true,
402 402
 					'no_wrap'   => false,
403
-					'label'     => __( 'Subscription Status', 'invoicing' ),
404
-					'help_text' => __( 'Updating the status will trigger related actions and hooks', 'invoicing' ),
403
+					'label'     => __('Subscription Status', 'invoicing'),
404
+					'help_text' => __('Updating the status will trigger related actions and hooks', 'invoicing'),
405 405
 					'select2'   => true,
406
-					'value'     => $subscription->get_status( 'edit' ),
406
+					'value'     => $subscription->get_status('edit'),
407 407
 				),
408 408
 				true
409 409
 			);
@@ -412,13 +412,13 @@  discard block
 block discarded – undo
412 412
 		<div class="mt-2 px-3 py-2 bg-light border-top" style="margin: -12px;">
413 413
 
414 414
 		<?php
415
-			submit_button( __( 'Update', 'invoicing' ), 'primary', 'submit', false );
415
+			submit_button(__('Update', 'invoicing'), 'primary', 'submit', false);
416 416
 
417
-			$url    = wp_nonce_url( add_query_arg( 'getpaid-admin-action', 'subscription_manual_renew' ), 'getpaid-nonce', 'getpaid-nonce' );
418
-			$anchor = __( 'Renew Subscription', 'invoicing' );
419
-			$title  = esc_attr__( 'Are you sure you want to extend the subscription and generate a new invoice that will be automatically marked as paid?', 'invoicing' );
417
+			$url    = wp_nonce_url(add_query_arg('getpaid-admin-action', 'subscription_manual_renew'), 'getpaid-nonce', 'getpaid-nonce');
418
+			$anchor = __('Renew Subscription', 'invoicing');
419
+			$title  = esc_attr__('Are you sure you want to extend the subscription and generate a new invoice that will be automatically marked as paid?', 'invoicing');
420 420
 
421
-			if ( $subscription->is_active() ) {
421
+			if ($subscription->is_active()) {
422 422
 			echo "<a href='$url' class='float-right text-muted' onclick='return confirm(\"$title\")'>$anchor</a>";
423 423
 			}
424 424
 
@@ -431,45 +431,45 @@  discard block
 block discarded – undo
431 431
  * @param WPInv_Subscription $subscription
432 432
  * @param bool $strict Whether or not to skip invoices of sibling subscriptions
433 433
  */
434
-function getpaid_admin_subscription_invoice_details_metabox( $subscription, $strict = true ) {
434
+function getpaid_admin_subscription_invoice_details_metabox($subscription, $strict = true) {
435 435
 
436 436
 	$columns = apply_filters(
437 437
 		'getpaid_subscription_related_invoices_columns',
438 438
 		array(
439
-			'invoice'      => __( 'Invoice', 'invoicing' ),
440
-			'relationship' => __( 'Relationship', 'invoicing' ),
441
-			'date'         => __( 'Date', 'invoicing' ),
442
-			'status'       => __( 'Status', 'invoicing' ),
443
-			'total'        => __( 'Total', 'invoicing' ),
439
+			'invoice'      => __('Invoice', 'invoicing'),
440
+			'relationship' => __('Relationship', 'invoicing'),
441
+			'date'         => __('Date', 'invoicing'),
442
+			'status'       => __('Status', 'invoicing'),
443
+			'total'        => __('Total', 'invoicing'),
444 444
 		),
445 445
 		$subscription
446 446
 	);
447 447
 
448 448
 	// Prepare the invoices.
449
-	$payments = $subscription->get_child_payments( ! is_admin() );
449
+	$payments = $subscription->get_child_payments(!is_admin());
450 450
 	$parent   = $subscription->get_parent_invoice();
451 451
 
452
-	if ( $parent->exists() ) {
453
-		$payments = array_merge( array( $parent ), $payments );
452
+	if ($parent->exists()) {
453
+		$payments = array_merge(array($parent), $payments);
454 454
 	}
455 455
 
456 456
 	$table_class = 'w-100 bg-white';
457 457
 
458
-	if ( ! is_admin() ) {
458
+	if (!is_admin()) {
459 459
 		$table_class = 'table table-bordered';
460 460
 	}
461 461
 
462 462
 	?>
463 463
 		<div class="m-0" style="overflow: auto;">
464 464
 
465
-			<table class="<?php echo esc_attr( $table_class ); ?>">
465
+			<table class="<?php echo esc_attr($table_class); ?>">
466 466
 
467 467
 				<thead>
468 468
 					<tr>
469 469
 						<?php
470
-							foreach ( $columns as $key => $label ) {
471
-							$key   = esc_attr( $key );
472
-							$label = esc_html( $label );
470
+							foreach ($columns as $key => $label) {
471
+							$key   = esc_attr($key);
472
+							$label = esc_html($label);
473 473
 							$class = 'text-left';
474 474
 
475 475
 							echo "<th class='subscription-invoice-field-$key bg-light p-2 $class color-dark font-weight-bold'>$label</th>";
@@ -480,70 +480,70 @@  discard block
 block discarded – undo
480 480
 
481 481
 				<tbody>
482 482
 
483
-					<?php if ( empty( $payments ) ) : ?>
483
+					<?php if (empty($payments)) : ?>
484 484
 						<tr>
485
-							<td colspan="<?php echo count( $columns ); ?>" class="p-2 text-left text-muted">
486
-								<?php esc_html_e( 'This subscription has no invoices.', 'invoicing' ); ?>
485
+							<td colspan="<?php echo count($columns); ?>" class="p-2 text-left text-muted">
486
+								<?php esc_html_e('This subscription has no invoices.', 'invoicing'); ?>
487 487
 							</td>
488 488
 						</tr>
489 489
 					<?php endif; ?>
490 490
 
491 491
 					<?php
492 492
 
493
-						foreach ( $payments as $payment ) :
493
+						foreach ($payments as $payment) :
494 494
 
495 495
 						// Ensure that we have an invoice.
496
-						$payment = new WPInv_Invoice( $payment );
496
+						$payment = new WPInv_Invoice($payment);
497 497
 
498 498
 						// Abort if the invoice is invalid...
499
-						if ( ! $payment->exists() ) {
499
+						if (!$payment->exists()) {
500 500
 							continue;
501 501
 							}
502 502
 
503 503
 						// ... or belongs to a different subscription.
504
-						if ( $strict && $payment->is_renewal() && $payment->get_subscription_id() && $payment->get_subscription_id() != $subscription->get_id() ) {
504
+						if ($strict && $payment->is_renewal() && $payment->get_subscription_id() && $payment->get_subscription_id() != $subscription->get_id()) {
505 505
 							continue;
506 506
 							}
507 507
 
508 508
 						echo '<tr>';
509 509
 
510
-						foreach ( array_keys( $columns ) as $key ) {
510
+						foreach (array_keys($columns) as $key) {
511 511
 
512 512
 							$class = 'text-left';
513 513
 
514 514
 							echo "<td class='p-2 text-left'>";
515 515
 
516
-								switch ( $key ) {
516
+								switch ($key) {
517 517
 
518 518
 								case 'total':
519
-										echo '<strong>' . wpinv_price( $payment->get_total(), $payment->get_currency() ) . '</strong>';
519
+										echo '<strong>' . wpinv_price($payment->get_total(), $payment->get_currency()) . '</strong>';
520 520
 									break;
521 521
 
522 522
 								case 'relationship':
523
-											echo $payment->is_renewal() ? __( 'Renewal Invoice', 'invoicing' ) : __( 'Initial Invoice', 'invoicing' );
523
+											echo $payment->is_renewal() ? __('Renewal Invoice', 'invoicing') : __('Initial Invoice', 'invoicing');
524 524
 									break;
525 525
 
526 526
 								case 'date':
527
-									echo getpaid_format_date_value( $payment->get_date_created() );
527
+									echo getpaid_format_date_value($payment->get_date_created());
528 528
 									break;
529 529
 
530 530
 								case 'status':
531 531
 										$status = $payment->get_status_nicename();
532
-										if ( is_admin() ) {
532
+										if (is_admin()) {
533 533
 										$status = $payment->get_status_label_html();
534 534
 										}
535 535
 
536
-										echo wp_kses_post( $status );
536
+										echo wp_kses_post($status);
537 537
 									break;
538 538
 
539 539
 								case 'invoice':
540
-										$link    = esc_url( get_edit_post_link( $payment->get_id() ) );
540
+										$link = esc_url(get_edit_post_link($payment->get_id()));
541 541
 
542
-										if ( ! is_admin() ) {
543
-										$link = esc_url( $payment->get_view_url() );
542
+										if (!is_admin()) {
543
+										$link = esc_url($payment->get_view_url());
544 544
 										}
545 545
 
546
-										$invoice = esc_html( $payment->get_number() );
546
+										$invoice = esc_html($payment->get_number());
547 547
 										echo "<a href='$link'>$invoice</a>";
548 548
 									break;
549 549
 										}
@@ -571,12 +571,12 @@  discard block
 block discarded – undo
571 571
  *
572 572
  * @param WPInv_Subscription $subscription
573 573
  */
574
-function getpaid_admin_subscription_item_details_metabox( $subscription ) {
574
+function getpaid_admin_subscription_item_details_metabox($subscription) {
575 575
 
576 576
 	// Fetch the subscription group.
577
-	$subscription_group = getpaid_get_invoice_subscription_group( $subscription->get_parent_payment_id(), $subscription->get_id() );
577
+	$subscription_group = getpaid_get_invoice_subscription_group($subscription->get_parent_payment_id(), $subscription->get_id());
578 578
 
579
-	if ( empty( $subscription_group ) || empty( $subscription_group['items'] ) ) {
579
+	if (empty($subscription_group) || empty($subscription_group['items'])) {
580 580
 		return;
581 581
 	}
582 582
 
@@ -584,12 +584,12 @@  discard block
 block discarded – undo
584 584
 	$columns = apply_filters(
585 585
 		'getpaid_subscription_item_details_columns',
586 586
 		array(
587
-			'item_name' => __( 'Item', 'invoicing' ),
588
-			'price'     => __( 'Price', 'invoicing' ),
589
-			'tax'       => __( 'Tax', 'invoicing' ),
590
-			'discount'  => __( 'Discount', 'invoicing' ),
587
+			'item_name' => __('Item', 'invoicing'),
588
+			'price'     => __('Price', 'invoicing'),
589
+			'tax'       => __('Tax', 'invoicing'),
590
+			'discount'  => __('Discount', 'invoicing'),
591 591
 			//'initial'      => __( 'Initial Amount', 'invoicing' ),
592
-			'recurring' => __( 'Subtotal', 'invoicing' ),
592
+			'recurring' => __('Subtotal', 'invoicing'),
593 593
 		),
594 594
 		$subscription
595 595
 	);
@@ -598,28 +598,28 @@  discard block
 block discarded – undo
598 598
 
599 599
 	$invoice = $subscription->get_parent_invoice();
600 600
 
601
-	if ( ( ! wpinv_use_taxes() || ! $invoice->is_taxable() ) && isset( $columns['tax'] ) ) {
602
-		unset( $columns['tax'] );
601
+	if ((!wpinv_use_taxes() || !$invoice->is_taxable()) && isset($columns['tax'])) {
602
+		unset($columns['tax']);
603 603
 	}
604 604
 
605 605
 	$table_class = 'w-100 bg-white';
606 606
 
607
-	if ( ! is_admin() ) {
607
+	if (!is_admin()) {
608 608
 		$table_class = 'table table-bordered';
609 609
 	}
610 610
 
611 611
 	?>
612 612
 		<div class="m-0" style="overflow: auto;">
613 613
 
614
-			<table class="<?php echo esc_attr( $table_class ); ?>">
614
+			<table class="<?php echo esc_attr($table_class); ?>">
615 615
 
616 616
 				<thead>
617 617
 					<tr>
618 618
 						<?php
619 619
 
620
-							foreach ( $columns as $key => $label ) {
621
-							$key   = esc_attr( $key );
622
-							$label = esc_html( $label );
620
+							foreach ($columns as $key => $label) {
621
+							$key   = esc_attr($key);
622
+							$label = esc_html($label);
623 623
 							$class = 'text-left';
624 624
 
625 625
 							echo "<th class='subscription-item-field-$key bg-light p-2 text-left color-dark font-weight-bold'>$label</th>";
@@ -632,48 +632,48 @@  discard block
 block discarded – undo
632 632
 
633 633
 					<?php
634 634
 
635
-						foreach ( $subscription_group['items'] as $subscription_group_item ) :
635
+						foreach ($subscription_group['items'] as $subscription_group_item) :
636 636
 
637 637
 						echo '<tr>';
638 638
 
639
-						foreach ( array_keys( $columns ) as $key ) {
639
+						foreach (array_keys($columns) as $key) {
640 640
 
641 641
 							$class = 'text-left';
642 642
 
643 643
 							echo "<td class='p-2 text-left'>";
644 644
 
645
-								switch ( $key ) {
645
+								switch ($key) {
646 646
 
647 647
 								case 'item_name':
648
-										$item_name = get_the_title( $subscription_group_item['item_id'] );
649
-										$item_name = empty( $item_name ) ? $subscription_group_item['item_name'] : $item_name;
648
+										$item_name = get_the_title($subscription_group_item['item_id']);
649
+										$item_name = empty($item_name) ? $subscription_group_item['item_name'] : $item_name;
650 650
 
651
-										if ( $invoice->get_template() == 'amount' || 1 == (float) $subscription_group_item['quantity'] ) {
652
-										echo esc_html( $item_name );
651
+										if ($invoice->get_template() == 'amount' || 1 == (float) $subscription_group_item['quantity']) {
652
+										echo esc_html($item_name);
653 653
 										} else {
654
-										printf( '%1$s x %2$d', esc_html( $item_name ), (float) $subscription_group_item['quantity'] );
654
+										printf('%1$s x %2$d', esc_html($item_name), (float) $subscription_group_item['quantity']);
655 655
 											}
656 656
 
657 657
 									break;
658 658
 
659 659
 								case 'price':
660
-											echo wpinv_price( $subscription_group_item['item_price'], $invoice->get_currency() );
660
+											echo wpinv_price($subscription_group_item['item_price'], $invoice->get_currency());
661 661
 									break;
662 662
 
663 663
 								case 'tax':
664
-									echo wpinv_price( $subscription_group_item['tax'], $invoice->get_currency() );
664
+									echo wpinv_price($subscription_group_item['tax'], $invoice->get_currency());
665 665
 									break;
666 666
 
667 667
 								case 'discount':
668
-										echo wpinv_price( $subscription_group_item['discount'], $invoice->get_currency() );
668
+										echo wpinv_price($subscription_group_item['discount'], $invoice->get_currency());
669 669
 									break;
670 670
 
671 671
 								case 'initial':
672
-										echo wpinv_price( $subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency() );
672
+										echo wpinv_price($subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency());
673 673
 									break;
674 674
 
675 675
 								case 'recurring':
676
-										echo '<strong>' . wpinv_price( $subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency() ) . '</strong>';
676
+										echo '<strong>' . wpinv_price($subscription_group_item['price'] * $subscription_group_item['quantity'], $invoice->get_currency()) . '</strong>';
677 677
 									break;
678 678
 
679 679
 										}
@@ -686,24 +686,24 @@  discard block
 block discarded – undo
686 686
 
687 687
 						endforeach;
688 688
 
689
-						foreach ( $subscription_group['fees'] as $subscription_group_fee ) :
689
+						foreach ($subscription_group['fees'] as $subscription_group_fee) :
690 690
 
691 691
 						echo '<tr>';
692 692
 
693
-						foreach ( array_keys( $columns ) as $key ) {
693
+						foreach (array_keys($columns) as $key) {
694 694
 
695 695
 							$class = 'text-left';
696 696
 
697 697
 							echo "<td class='p-2 text-left'>";
698 698
 
699
-								switch ( $key ) {
699
+								switch ($key) {
700 700
 
701 701
 								case 'item_name':
702
-										echo esc_html( $subscription_group_fee['name'] );
702
+										echo esc_html($subscription_group_fee['name']);
703 703
 									break;
704 704
 
705 705
 								case 'price':
706
-											echo wpinv_price( $subscription_group_fee['initial_fee'], $invoice->get_currency() );
706
+											echo wpinv_price($subscription_group_fee['initial_fee'], $invoice->get_currency());
707 707
 									break;
708 708
 
709 709
 								case 'tax':
@@ -715,11 +715,11 @@  discard block
 block discarded – undo
715 715
 									break;
716 716
 
717 717
 								case 'initial':
718
-										echo wpinv_price( $subscription_group_fee['initial_fee'], $invoice->get_currency() );
718
+										echo wpinv_price($subscription_group_fee['initial_fee'], $invoice->get_currency());
719 719
 									break;
720 720
 
721 721
 								case 'recurring':
722
-										echo '<strong>' . wpinv_price( $subscription_group_fee['recurring_fee'], $invoice->get_currency() ) . '</strong>';
722
+										echo '<strong>' . wpinv_price($subscription_group_fee['recurring_fee'], $invoice->get_currency()) . '</strong>';
723 723
 									break;
724 724
 
725 725
 										}
@@ -748,12 +748,12 @@  discard block
 block discarded – undo
748 748
  * @param WPInv_Subscription $subscription
749 749
  * @param bool $skip_current
750 750
  */
751
-function getpaid_admin_subscription_related_subscriptions_metabox( $subscription, $skip_current = true ) {
751
+function getpaid_admin_subscription_related_subscriptions_metabox($subscription, $skip_current = true) {
752 752
 
753 753
 	// Fetch the subscription groups.
754
-	$subscription_groups = getpaid_get_invoice_subscription_groups( $subscription->get_parent_payment_id() );
754
+	$subscription_groups = getpaid_get_invoice_subscription_groups($subscription->get_parent_payment_id());
755 755
 
756
-	if ( empty( $subscription_groups ) ) {
756
+	if (empty($subscription_groups)) {
757 757
 		return;
758 758
 	}
759 759
 
@@ -761,38 +761,38 @@  discard block
 block discarded – undo
761 761
 	$columns = apply_filters(
762 762
 		'getpaid_subscription_related_subscriptions_columns',
763 763
 		array(
764
-			'subscription' => __( 'Subscription', 'invoicing' ),
765
-			'start_date'   => __( 'Start Date', 'invoicing' ),
766
-			'renewal_date' => __( 'Next Payment', 'invoicing' ),
767
-			'renewals'     => __( 'Payments', 'invoicing' ),
768
-			'item'         => __( 'Items', 'invoicing' ),
769
-			'status'       => __( 'Status', 'invoicing' ),
764
+			'subscription' => __('Subscription', 'invoicing'),
765
+			'start_date'   => __('Start Date', 'invoicing'),
766
+			'renewal_date' => __('Next Payment', 'invoicing'),
767
+			'renewals'     => __('Payments', 'invoicing'),
768
+			'item'         => __('Items', 'invoicing'),
769
+			'status'       => __('Status', 'invoicing'),
770 770
 		),
771 771
 		$subscription
772 772
 	);
773 773
 
774
-	if ( $subscription->get_status() == 'pending' ) {
775
-		unset( $columns['start_date'], $columns['renewal_date'] );
774
+	if ($subscription->get_status() == 'pending') {
775
+		unset($columns['start_date'], $columns['renewal_date']);
776 776
 	}
777 777
 
778 778
 	$table_class = 'w-100 bg-white';
779 779
 
780
-	if ( ! is_admin() ) {
780
+	if (!is_admin()) {
781 781
 		$table_class = 'table table-bordered';
782 782
 	}
783 783
 
784 784
 	?>
785 785
 		<div class="m-0" style="overflow: auto;">
786 786
 
787
-			<table class="<?php echo esc_attr( $table_class ); ?>">
787
+			<table class="<?php echo esc_attr($table_class); ?>">
788 788
 
789 789
 				<thead>
790 790
 					<tr>
791 791
 						<?php
792 792
 
793
-							foreach ( $columns as $key => $label ) {
794
-							$key   = esc_attr( $key );
795
-							$label = esc_html( $label );
793
+							foreach ($columns as $key => $label) {
794
+							$key   = esc_attr($key);
795
+							$label = esc_html($label);
796 796
 							$class = 'text-left';
797 797
 
798 798
 							echo "<th class='related-subscription-field-$key bg-light p-2 text-left color-dark font-weight-bold'>$label</th>";
@@ -805,62 +805,62 @@  discard block
 block discarded – undo
805 805
 
806 806
 					<?php
807 807
 
808
-						foreach ( $subscription_groups as $subscription_group ) :
808
+						foreach ($subscription_groups as $subscription_group) :
809 809
 
810 810
 						// Do not list current subscription.
811
-						if ( $skip_current && (int) $subscription_group['subscription_id'] === $subscription->get_id() ) {
811
+						if ($skip_current && (int) $subscription_group['subscription_id'] === $subscription->get_id()) {
812 812
 							continue;
813 813
 							}
814 814
 
815 815
 						// Ensure the subscription exists.
816
-						$_suscription = new WPInv_Subscription( $subscription_group['subscription_id'] );
816
+						$_suscription = new WPInv_Subscription($subscription_group['subscription_id']);
817 817
 
818
-						if ( ! $_suscription->exists() ) {
818
+						if (!$_suscription->exists()) {
819 819
 							continue;
820 820
 							}
821 821
 
822 822
 						echo '<tr>';
823 823
 
824
-						foreach ( array_keys( $columns ) as $key ) {
824
+						foreach (array_keys($columns) as $key) {
825 825
 
826 826
 							$class = 'text-left';
827 827
 
828 828
 							echo "<td class='p-2 text-left'>";
829 829
 
830
-								switch ( $key ) {
830
+								switch ($key) {
831 831
 
832 832
 								case 'status':
833
-										echo wp_kses_post( $_suscription->get_status_label_html() );
833
+										echo wp_kses_post($_suscription->get_status_label_html());
834 834
 									break;
835 835
 
836 836
 								case 'item':
837
-											$markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) );
838
-											echo implode( ' | ', $markup );
837
+											$markup = array_map(array('WPInv_Subscriptions_List_Table', 'generate_item_markup'), array_keys($subscription_group['items']));
838
+											echo implode(' | ', $markup);
839 839
 									break;
840 840
 
841 841
 								case 'renewals':
842 842
 									$max_bills = $_suscription->get_bill_times();
843
-									echo ( (int) $_suscription->get_times_billed() ) . ' / ' . ( empty( $max_bills ) ? '&infin;' : (int) $max_bills );
843
+									echo ((int) $_suscription->get_times_billed()) . ' / ' . (empty($max_bills) ? '&infin;' : (int) $max_bills);
844 844
 									break;
845 845
 
846 846
 								case 'renewal_date':
847
-										echo $_suscription->is_active() ? getpaid_format_date_value( $_suscription->get_expiration() ) : '&mdash;';
847
+										echo $_suscription->is_active() ? getpaid_format_date_value($_suscription->get_expiration()) : '&mdash;';
848 848
 									break;
849 849
 
850 850
 								case 'start_date':
851
-										echo 'pending' == $_suscription->get_status() ? '&mdash;' : getpaid_format_date_value( $_suscription->get_date_created() );
851
+										echo 'pending' == $_suscription->get_status() ? '&mdash;' : getpaid_format_date_value($_suscription->get_date_created());
852 852
 									break;
853 853
 
854 854
 								case 'subscription':
855
-										$url = is_admin() ? admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $_suscription->get_id() ) ) : $_suscription->get_view_url();
855
+										$url = is_admin() ? admin_url('admin.php?page=wpinv-subscriptions&id=' . absint($_suscription->get_id())) : $_suscription->get_view_url();
856 856
 										printf(
857 857
                                             '%1$s#%2$s%3$s',
858
-                                            '<a href="' . esc_url( $url ) . '">',
859
-                                            '<strong>' . intval( $_suscription->get_id() ) . '</strong>',
858
+                                            '<a href="' . esc_url($url) . '">',
859
+                                            '<strong>' . intval($_suscription->get_id()) . '</strong>',
860 860
 											'</a>'
861 861
                                         );
862 862
 
863
-											echo WPInv_Subscriptions_List_Table::column_amount( $_suscription );
863
+											echo WPInv_Subscriptions_List_Table::column_amount($_suscription);
864 864
 									break;
865 865
 
866 866
 										}
Please login to merge, or discard this patch.