Passed
Push — master ( 0f89d8...20b97c )
by Brian
04:46
created
templates/invoice/company-address.php 1 patch
Spacing   +15 added lines, -15 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 company name.
13
-$company_name = wpinv_get_option( 'vat_company_name' );
13
+$company_name = wpinv_get_option('vat_company_name');
14 14
 
15
-if ( empty( $company_name ) ) {
15
+if (empty($company_name)) {
16 16
     $company_name = wpinv_get_business_name();
17 17
 }
18 18
 
19 19
 // Prepare the VAT number.
20
-$vat_number = wpinv_get_option( 'vat_number' );
20
+$vat_number = wpinv_get_option('vat_number');
21 21
 
22 22
 ?>
23 23
     <div class="getpaid-company-address form-group">
@@ -25,36 +25,36 @@  discard block
 block discarded – undo
25 25
         <div class="row">
26 26
 
27 27
             <div class="invoice-company-address-label col-2">
28
-                <strong><?php esc_html_e( 'From:', 'invoicing' ); ?></strong>
28
+                <strong><?php esc_html_e('From:', 'invoicing'); ?></strong>
29 29
             </div>
30 30
 
31 31
             <div class="invoice-company-address-value col-10">
32 32
 
33
-                <?php do_action( 'getpaid_company_address_top' ); ?>
33
+                <?php do_action('getpaid_company_address_top'); ?>
34 34
 
35 35
                 <div class="name">
36
-                    <a target="_blank" class="text-dark" href="<?php echo esc_url( wpinv_get_business_website() ); ?>">
37
-                        <?php echo esc_html( $company_name ); ?>
36
+                    <a target="_blank" class="text-dark" href="<?php echo esc_url(wpinv_get_business_website()); ?>">
37
+                        <?php echo esc_html($company_name); ?>
38 38
                     </a>
39 39
                 </div>
40 40
 
41
-                <?php if ( $address = wpinv_get_business_address() ) { ?>
42
-                    <?php echo wp_kses_post( $address ); ?>
41
+                <?php if ($address = wpinv_get_business_address()) { ?>
42
+                    <?php echo wp_kses_post($address); ?>
43 43
                 <?php } ?>
44 44
 
45
-                <?php if ( $email_from = wpinv_mail_get_from_address() ) { ?>
45
+                <?php if ($email_from = wpinv_mail_get_from_address()) { ?>
46 46
                     <div class="email_from">
47
-                        <?php echo wp_sprintf( __( 'Email: %s', 'invoicing' ), sanitize_email( $email_from ) ); ?>
47
+                        <?php echo wp_sprintf(__('Email: %s', 'invoicing'), sanitize_email($email_from)); ?>
48 48
                     </div>
49 49
                 <?php } ?>
50 50
 
51
-                <?php if ( ! empty( $vat_number ) ) { ?>
51
+                <?php if (!empty($vat_number)) { ?>
52 52
                     <div class="email_from">
53
-                        <?php echo wp_sprintf( __( 'VAT Number: %s', 'invoicing' ), esc_html( $vat_number ) ); ?>
53
+                        <?php echo wp_sprintf(__('VAT Number: %s', 'invoicing'), esc_html($vat_number)); ?>
54 54
                     </div>
55 55
                 <?php } ?>
56 56
 
57
-                <?php do_action( 'getpaid_company_address_bottom' ); ?>
57
+                <?php do_action('getpaid_company_address_bottom'); ?>
58 58
 
59 59
             </div>
60 60
 
Please login to merge, or discard this patch.
templates/invoice/header-left-actions.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,25 +8,25 @@
 block discarded – undo
8 8
  * @var WPInv_Invoice $invoice
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 ?>
14 14
 
15 15
         <div class="getpaid-header-left-actions">
16 16
 
17
-            <?php if ( $invoice->is_type( 'invoice' ) && $invoice->needs_payment() && ! $invoice->is_held() ) : ?>
18
-                <a class="btn btn-sm btn-primary m-1 d-inline-block invoice-action-pay" href="<?php echo esc_url( $invoice->get_checkout_payment_url() ); ?>">
19
-                    <?php esc_html_e( 'Pay For Invoice', 'invoicing' ); ?>
17
+            <?php if ($invoice->is_type('invoice') && $invoice->needs_payment() && !$invoice->is_held()) : ?>
18
+                <a class="btn btn-sm btn-primary m-1 d-inline-block invoice-action-pay" href="<?php echo esc_url($invoice->get_checkout_payment_url()); ?>">
19
+                    <?php esc_html_e('Pay For Invoice', 'invoicing'); ?>
20 20
                 </a>
21 21
             <?php endif; ?>
22 22
 
23
-            <?php if ( $invoice->is_type( 'invoice' ) && $invoice->is_paid() ) : ?>
24
-                <a class="btn btn-sm btn-info m-1 d-inline-block invoice-action-receipt" href="<?php echo esc_url( $invoice->get_receipt_url() ); ?>">
25
-                    <?php esc_html_e( 'View Receipt', 'invoicing' ); ?>
23
+            <?php if ($invoice->is_type('invoice') && $invoice->is_paid()) : ?>
24
+                <a class="btn btn-sm btn-info m-1 d-inline-block invoice-action-receipt" href="<?php echo esc_url($invoice->get_receipt_url()); ?>">
25
+                    <?php esc_html_e('View Receipt', 'invoicing'); ?>
26 26
                 </a>
27 27
             <?php endif; ?>
28 28
 
29
-            <?php do_action( 'wpinv_invoice_display_left_actions', $invoice ); ?>
29
+            <?php do_action('wpinv_invoice_display_left_actions', $invoice); ?>
30 30
 
31 31
         </div>
32 32
 
Please login to merge, or discard this patch.
templates/wpinv-invalid-access.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@  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
 // Fetch the invoice.
13
-if ( empty( $invoice ) ) {
14
-    $invoice = new WPInv_Invoice( $GLOBALS['post'] );
13
+if (empty($invoice)) {
14
+    $invoice = new WPInv_Invoice($GLOBALS['post']);
15 15
 }
16 16
 
17 17
 ?><!DOCTYPE html>
@@ -21,16 +21,16 @@  discard block
 block discarded – undo
21 21
 
22 22
     <head>
23 23
 
24
-		<meta charset="<?php bloginfo( 'charset' ); ?>">
24
+		<meta charset="<?php bloginfo('charset'); ?>">
25 25
         <meta name="viewport" content="width=device-width, initial-scale=1.0" >
26 26
 
27 27
         <meta name="robots" content="noindex,nofollow">
28 28
 
29 29
 		<link rel="profile" href="https://gmpg.org/xfn/11">
30 30
 
31
-        <title><?php esc_html_e( 'Invalid Access', 'invoicing' ); ?></title>
31
+        <title><?php esc_html_e('Invalid Access', 'invoicing'); ?></title>
32 32
 
33
-        <?php do_action( 'wpinv_invoice_print_head', $invoice ); ?>
33
+        <?php do_action('wpinv_invoice_print_head', $invoice); ?>
34 34
 
35 35
     </head>
36 36
 
@@ -39,20 +39,20 @@  discard block
 block discarded – undo
39 39
 
40 40
         <?php
41 41
 
42
-            if ( ! $invoice->exists() || $invoice->is_draft() ) {
43
-			$error = __( 'This invoice was deleted or is not visible.', 'invoicing' );
42
+            if (!$invoice->exists() || $invoice->is_draft()) {
43
+			$error = __('This invoice was deleted or is not visible.', 'invoicing');
44 44
             } else {
45 45
 
46 46
 			$user_id = get_current_user_id();
47
-			if ( wpinv_require_login_to_checkout() && empty( $user_id ) ) {
48
-				$error  = __( 'You must be logged in to view this invoice.', 'invoicing' );
47
+			if (wpinv_require_login_to_checkout() && empty($user_id)) {
48
+				$error  = __('You must be logged in to view this invoice.', 'invoicing');
49 49
 				$error .= sprintf(
50 50
 					' <a href="%s">%s</a>',
51
-					wp_login_url( $invoice->get_view_url() ),
52
-					__( 'Login.', 'invoicing' )
51
+					wp_login_url($invoice->get_view_url()),
52
+					__('Login.', 'invoicing')
53 53
 				);
54 54
 			} else {
55
-				$error = __( 'This invoice is only viewable by clicking on the invoice link that was sent to you via email.', 'invoicing' );
55
+				$error = __('This invoice is only viewable by clicking on the invoice link that was sent to you via email.', 'invoicing');
56 56
                 }
57 57
 }
58 58
 
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 
61 61
         <div class="container">
62 62
             <div class="alert alert-danger m-5" role="alert">
63
-                <h4 class="alert-heading"><?php esc_html_e( 'Access Denied', 'invoicing' ); ?></h4>
64
-                <p><?php echo wp_kses_post( $error ); ?></p>
63
+                <h4 class="alert-heading"><?php esc_html_e('Access Denied', 'invoicing'); ?></h4>
64
+                <p><?php echo wp_kses_post($error); ?></p>
65 65
             </div>
66 66
         </div>
67 67
 
Please login to merge, or discard this patch.
templates/subscriptions/subscriptions-table-row.php 3 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -13,42 +13,42 @@
 block discarded – undo
13 13
 
14 14
 foreach ( array_keys( $widget->get_subscriptions_table_columns() ) as $column ) :
15 15
 
16
-	$class = sanitize_html_class( $column );
17
-	echo "<td class='getpaid-subscriptions-table-column-" . esc_attr( $class ) . "'>";
16
+    $class = sanitize_html_class( $column );
17
+    echo "<td class='getpaid-subscriptions-table-column-" . esc_attr( $class ) . "'>";
18 18
 
19
-		do_action( "getpaid_subscriptions_before_frontend_subscription_table_$column", $subscription );
19
+        do_action( "getpaid_subscriptions_before_frontend_subscription_table_$column", $subscription );
20 20
 
21
-		switch ( $column ) :
21
+        switch ( $column ) :
22 22
 
23
-		case 'subscription':
24
-			$subscription_id = (int) $subscription->get_id();
25
-			$url             = esc_url( $subscription->get_view_url() );
26
-			$id_label        = sprintf(
27
-				esc_attr_x( '#%s', 'subscription id', 'invoicing' ),
28
-				(int) $subscription->get_id()
29
-			);
30
-			echo wp_kses_post( $widget->add_row_actions( "<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>", $subscription ) );
31
-			break;
23
+        case 'subscription':
24
+            $subscription_id = (int) $subscription->get_id();
25
+            $url             = esc_url( $subscription->get_view_url() );
26
+            $id_label        = sprintf(
27
+                esc_attr_x( '#%s', 'subscription id', 'invoicing' ),
28
+                (int) $subscription->get_id()
29
+            );
30
+            echo wp_kses_post( $widget->add_row_actions( "<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>", $subscription ) );
31
+            break;
32 32
 
33
-		case 'status':
34
-			echo esc_html( $subscription->get_status_label() );
35
-			break;
33
+        case 'status':
34
+            echo esc_html( $subscription->get_status_label() );
35
+            break;
36 36
 
37
-		case 'renewal-date':
38
-			$renewal = getpaid_format_date_value( $subscription->get_next_renewal_date() );
39
-			echo $subscription->is_active() ? esc_html( $renewal ) : '&mdash;';
40
-			break;
37
+        case 'renewal-date':
38
+            $renewal = getpaid_format_date_value( $subscription->get_next_renewal_date() );
39
+            echo $subscription->is_active() ? esc_html( $renewal ) : '&mdash;';
40
+            break;
41 41
 
42
-		case 'amount':
43
-			$frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' );
44
-			$amount    = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() );
45
-			echo wp_kses_post( "<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>" );
46
-			break;
42
+        case 'amount':
43
+            $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' );
44
+            $amount    = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() );
45
+            echo wp_kses_post( "<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>" );
46
+            break;
47 47
 
48
-		endswitch;
48
+        endswitch;
49 49
 
50
-		do_action( "getpaid_subscriptions_frontend_subscription_table_$column", $subscription );
50
+        do_action( "getpaid_subscriptions_frontend_subscription_table_$column", $subscription );
51 51
 
52
-	echo '</td>';
52
+    echo '</td>';
53 53
 
54 54
 endforeach;
Please login to merge, or discard this patch.
Switch Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -20,35 +20,35 @@
 block discarded – undo
20 20
 
21 21
 		switch ( $column ) :
22 22
 
23
-		case 'subscription':
24
-			$subscription_id = (int) $subscription->get_id();
25
-			$url             = esc_url( $subscription->get_view_url() );
26
-			$id_label        = sprintf(
27
-				esc_attr_x( '#%s', 'subscription id', 'invoicing' ),
28
-				(int) $subscription->get_id()
29
-			);
30
-			echo wp_kses_post( $widget->add_row_actions( "<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>", $subscription ) );
31
-			break;
32
-
33
-		case 'status':
34
-			echo esc_html( $subscription->get_status_label() );
35
-			break;
36
-
37
-		case 'renewal-date':
38
-			$renewal = getpaid_format_date_value( $subscription->get_next_renewal_date() );
39
-			echo $subscription->is_active() ? esc_html( $renewal ) : '&mdash;';
40
-			break;
41
-
42
-		case 'amount':
43
-			$frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' );
44
-			$amount    = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() );
45
-			echo wp_kses_post( "<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>" );
46
-			break;
47
-
48
-		endswitch;
49
-
50
-		do_action( "getpaid_subscriptions_frontend_subscription_table_$column", $subscription );
51
-
52
-	echo '</td>';
53
-
54
-endforeach;
23
+		    case 'subscription':
24
+			    $subscription_id = (int) $subscription->get_id();
25
+			    $url             = esc_url( $subscription->get_view_url() );
26
+			    $id_label        = sprintf(
27
+				    esc_attr_x( '#%s', 'subscription id', 'invoicing' ),
28
+				    (int) $subscription->get_id()
29
+			    );
30
+			    echo wp_kses_post( $widget->add_row_actions( "<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>", $subscription ) );
31
+			    break;
32
+
33
+		    case 'status':
34
+			    echo esc_html( $subscription->get_status_label() );
35
+			    break;
36
+
37
+		    case 'renewal-date':
38
+			    $renewal = getpaid_format_date_value( $subscription->get_next_renewal_date() );
39
+			    echo $subscription->is_active() ? esc_html( $renewal ) : '&mdash;';
40
+			    break;
41
+
42
+		    case 'amount':
43
+			    $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' );
44
+			    $amount    = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() );
45
+			    echo wp_kses_post( "<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>" );
46
+			    break;
47
+
48
+		    endswitch;
49
+
50
+		    do_action( "getpaid_subscriptions_frontend_subscription_table_$column", $subscription );
51
+
52
+	    echo '</td>';
53
+
54
+    endforeach;
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -9,45 +9,45 @@
 block discarded – undo
9 9
  * @var WPInv_Subscriptions_Widget $widget
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) || exit;
12
+defined('ABSPATH') || exit;
13 13
 
14
-foreach ( array_keys( $widget->get_subscriptions_table_columns() ) as $column ) :
14
+foreach (array_keys($widget->get_subscriptions_table_columns()) as $column) :
15 15
 
16
-	$class = sanitize_html_class( $column );
17
-	echo "<td class='getpaid-subscriptions-table-column-" . esc_attr( $class ) . "'>";
16
+	$class = sanitize_html_class($column);
17
+	echo "<td class='getpaid-subscriptions-table-column-" . esc_attr($class) . "'>";
18 18
 
19
-		do_action( "getpaid_subscriptions_before_frontend_subscription_table_$column", $subscription );
19
+		do_action("getpaid_subscriptions_before_frontend_subscription_table_$column", $subscription);
20 20
 
21
-		switch ( $column ) :
21
+		switch ($column) :
22 22
 
23 23
 		case 'subscription':
24 24
 			$subscription_id = (int) $subscription->get_id();
25
-			$url             = esc_url( $subscription->get_view_url() );
25
+			$url             = esc_url($subscription->get_view_url());
26 26
 			$id_label        = sprintf(
27
-				esc_attr_x( '#%s', 'subscription id', 'invoicing' ),
27
+				esc_attr_x('#%s', 'subscription id', 'invoicing'),
28 28
 				(int) $subscription->get_id()
29 29
 			);
30
-			echo wp_kses_post( $widget->add_row_actions( "<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>", $subscription ) );
30
+			echo wp_kses_post($widget->add_row_actions("<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>", $subscription));
31 31
 			break;
32 32
 
33 33
 		case 'status':
34
-			echo esc_html( $subscription->get_status_label() );
34
+			echo esc_html($subscription->get_status_label());
35 35
 			break;
36 36
 
37 37
 		case 'renewal-date':
38
-			$renewal = getpaid_format_date_value( $subscription->get_next_renewal_date() );
39
-			echo $subscription->is_active() ? esc_html( $renewal ) : '&mdash;';
38
+			$renewal = getpaid_format_date_value($subscription->get_next_renewal_date());
39
+			echo $subscription->is_active() ? esc_html($renewal) : '&mdash;';
40 40
 			break;
41 41
 
42 42
 		case 'amount':
43
-			$frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' );
44
-			$amount    = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() );
45
-			echo wp_kses_post( "<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>" );
43
+			$frequency = getpaid_get_subscription_period_label($subscription->get_period(), $subscription->get_frequency(), '');
44
+			$amount    = wpinv_price($subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency());
45
+			echo wp_kses_post("<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>");
46 46
 			break;
47 47
 
48 48
 		endswitch;
49 49
 
50
-		do_action( "getpaid_subscriptions_frontend_subscription_table_$column", $subscription );
50
+		do_action("getpaid_subscriptions_frontend_subscription_table_$column", $subscription);
51 51
 
52 52
 	echo '</td>';
53 53
 
Please login to merge, or discard this patch.
templates/subscriptions/subscription-details.php 3 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -46,62 +46,62 @@  discard block
 block discarded – undo
46 46
 				<td style="width: 65%">
47 47
 					<?php
48 48
 
49
-						switch ( $key ) {
49
+                        switch ( $key ) {
50 50
 
51
-						case 'status':
52
-							echo esc_html( $subscription->get_status_label() );
53
-							break;
51
+                        case 'status':
52
+                            echo esc_html( $subscription->get_status_label() );
53
+                            break;
54 54
 
55
-						case 'start_date':
56
-							echo esc_html( getpaid_format_date_value( $subscription->get_date_created() ) );
57
-							break;
55
+                        case 'start_date':
56
+                            echo esc_html( getpaid_format_date_value( $subscription->get_date_created() ) );
57
+                            break;
58 58
 
59
-						case 'expiry_date':
60
-							echo esc_html( getpaid_format_date_value( $subscription->get_next_renewal_date() ) );
61
-							break;
59
+                        case 'expiry_date':
60
+                            echo esc_html( getpaid_format_date_value( $subscription->get_next_renewal_date() ) );
61
+                            break;
62 62
 
63
-						case 'initial_amount':
64
-							echo wp_kses_post( wpinv_price( $subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency() ) );
63
+                        case 'initial_amount':
64
+                            echo wp_kses_post( wpinv_price( $subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency() ) );
65 65
 
66
-							if ( $subscription->has_trial_period() ) {
66
+                            if ( $subscription->has_trial_period() ) {
67 67
 
68
-								echo "<small class='text-muted'>&nbsp;";
69
-								printf(
70
-									esc_html_x( '( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing' ),
71
-									esc_html( $subscription->get_trial_period() )
72
-								);
73
-								echo '</small>';
68
+                                echo "<small class='text-muted'>&nbsp;";
69
+                                printf(
70
+                                    esc_html_x( '( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing' ),
71
+                                    esc_html( $subscription->get_trial_period() )
72
+                                );
73
+                                echo '</small>';
74 74
 
75
-							}
75
+                            }
76 76
 
77
-							break;
77
+                            break;
78 78
 
79
-						case 'recurring_amount':
80
-							$frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' );
81
-							$amount    = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() );
82
-							echo wp_kses_post( strtolower( "<strong style='font-weight: 500;'>$amount</strong> / <span class='getpaid-item-recurring-period'>$frequency</span>" ) );
83
-							break;
79
+                        case 'recurring_amount':
80
+                            $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' );
81
+                            $amount    = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() );
82
+                            echo wp_kses_post( strtolower( "<strong style='font-weight: 500;'>$amount</strong> / <span class='getpaid-item-recurring-period'>$frequency</span>" ) );
83
+                            break;
84 84
 
85
-						case 'item':
86
-							if ( empty( $subscription_group ) ) {
87
-								echo wp_kses_post( WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() ) );
88
-								} else {
89
-								$markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) );
90
-								echo wp_kses_post( implode( ' | ', $markup ) );
91
-								}
85
+                        case 'item':
86
+                            if ( empty( $subscription_group ) ) {
87
+                                echo wp_kses_post( WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() ) );
88
+                                } else {
89
+                                $markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) );
90
+                                echo wp_kses_post( implode( ' | ', $markup ) );
91
+                                }
92 92
 
93
-							break;
93
+                            break;
94 94
 
95
-						case 'payments':
96
-							$max_activations = (int) $subscription->get_bill_times();
97
-							echo ( (int) $subscription->get_times_billed() ) . ' / ' . ( empty( $max_activations ) ? '&infin;' : (int) $max_activations );
95
+                        case 'payments':
96
+                            $max_activations = (int) $subscription->get_bill_times();
97
+                            echo ( (int) $subscription->get_times_billed() ) . ' / ' . ( empty( $max_activations ) ? '&infin;' : (int) $max_activations );
98 98
 
99
-							break;
99
+                            break;
100 100
 
101
-						}
102
-						do_action( "getpaid_render_single_subscription_column_$key", $subscription );
101
+                        }
102
+                        do_action( "getpaid_render_single_subscription_column_$key", $subscription );
103 103
 
104
-					?>
104
+                    ?>
105 105
 				</td>
106 106
 
107 107
 			</tr>
@@ -128,17 +128,17 @@  discard block
 block discarded – undo
128 128
 <span class="form-text">
129 129
 
130 130
 	<?php
131
-		if ( $subscription->can_cancel() ) {
132
-		printf(
131
+        if ( $subscription->can_cancel() ) {
132
+        printf(
133 133
             '<a href="%s" class="btn btn-danger btn-sm" onclick="return confirm(\'%s\')">%s</a>&nbsp;&nbsp;',
134 134
             esc_url( $subscription->get_cancel_url() ),
135 135
             esc_attr__( 'Are you sure you want to cancel this subscription?', 'invoicing' ),
136 136
             esc_html__( 'Cancel Subscription', 'invoicing' )
137 137
         );
138
-		}
138
+        }
139 139
 
140
-		do_action( 'getpaid-single-subscription-page-actions', $subscription );
141
-	?>
140
+        do_action( 'getpaid-single-subscription-page-actions', $subscription );
141
+    ?>
142 142
 
143 143
 	<a href="<?php echo esc_url( getpaid_get_tab_url( 'gp-subscriptions', get_permalink( (int) wpinv_get_option( 'invoice_subscription_page' ) ) ) ); ?>" class="btn btn-secondary btn-sm"><?php esc_html_e( 'Go Back', 'invoicing' ); ?></a>
144 144
 </span>
Please login to merge, or discard this patch.
Switch Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php
1
+    <?php
2 2
 /**
3 3
  * Template that prints a single subscription's details
4 4
  *
@@ -9,19 +9,19 @@  discard block
 block discarded – undo
9 9
  * @var WPInv_Subscriptions_Widget $widget
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) || exit;
12
+    defined( 'ABSPATH' ) || exit;
13 13
 
14
-do_action( 'getpaid_single_subscription_before_notices', $subscription );
14
+    do_action( 'getpaid_single_subscription_before_notices', $subscription );
15 15
 
16
-// Display errors and notices.
17
-wpinv_print_errors();
16
+    // Display errors and notices.
17
+    wpinv_print_errors();
18 18
 
19
-$subscription_groups = getpaid_get_invoice_subscription_groups( $subscription->get_parent_invoice_id() );
20
-$subscription_group  = getpaid_get_invoice_subscription_group( $subscription->get_parent_invoice_id(), $subscription->get_id() );
19
+    $subscription_groups = getpaid_get_invoice_subscription_groups( $subscription->get_parent_invoice_id() );
20
+    $subscription_group  = getpaid_get_invoice_subscription_group( $subscription->get_parent_invoice_id(), $subscription->get_id() );
21 21
 
22
-do_action( 'getpaid_before_single_subscription', $subscription, $subscription_groups );
22
+    do_action( 'getpaid_before_single_subscription', $subscription, $subscription_groups );
23 23
 
24
-?>
24
+    ?>
25 25
 
26 26
 <style>
27 27
 	.entry-header,
@@ -46,59 +46,59 @@  discard block
 block discarded – undo
46 46
 				<td style="width: 65%">
47 47
 					<?php
48 48
 
49
-						switch ( $key ) {
49
+						    switch ( $key ) {
50 50
 
51
-						case 'status':
52
-							echo esc_html( $subscription->get_status_label() );
53
-							break;
51
+						        case 'status':
52
+							        echo esc_html( $subscription->get_status_label() );
53
+							        break;
54 54
 
55
-						case 'start_date':
56
-							echo esc_html( getpaid_format_date_value( $subscription->get_date_created() ) );
57
-							break;
55
+						        case 'start_date':
56
+							        echo esc_html( getpaid_format_date_value( $subscription->get_date_created() ) );
57
+							        break;
58 58
 
59
-						case 'expiry_date':
60
-							echo esc_html( getpaid_format_date_value( $subscription->get_next_renewal_date() ) );
61
-							break;
59
+						        case 'expiry_date':
60
+							        echo esc_html( getpaid_format_date_value( $subscription->get_next_renewal_date() ) );
61
+							        break;
62 62
 
63
-						case 'initial_amount':
64
-							echo wp_kses_post( wpinv_price( $subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency() ) );
63
+						        case 'initial_amount':
64
+							        echo wp_kses_post( wpinv_price( $subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency() ) );
65 65
 
66
-							if ( $subscription->has_trial_period() ) {
66
+							        if ( $subscription->has_trial_period() ) {
67 67
 
68
-								echo "<small class='text-muted'>&nbsp;";
69
-								printf(
70
-									esc_html_x( '( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing' ),
71
-									esc_html( $subscription->get_trial_period() )
72
-								);
73
-								echo '</small>';
68
+								        echo "<small class='text-muted'>&nbsp;";
69
+								        printf(
70
+									        esc_html_x( '( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing' ),
71
+									        esc_html( $subscription->get_trial_period() )
72
+								        );
73
+								        echo '</small>';
74 74
 
75
-							}
75
+							        }
76 76
 
77
-							break;
77
+							        break;
78 78
 
79
-						case 'recurring_amount':
80
-							$frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' );
81
-							$amount    = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() );
82
-							echo wp_kses_post( strtolower( "<strong style='font-weight: 500;'>$amount</strong> / <span class='getpaid-item-recurring-period'>$frequency</span>" ) );
83
-							break;
79
+						        case 'recurring_amount':
80
+							        $frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' );
81
+							        $amount    = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() );
82
+							        echo wp_kses_post( strtolower( "<strong style='font-weight: 500;'>$amount</strong> / <span class='getpaid-item-recurring-period'>$frequency</span>" ) );
83
+							        break;
84 84
 
85
-						case 'item':
86
-							if ( empty( $subscription_group ) ) {
87
-								echo wp_kses_post( WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() ) );
88
-								} else {
89
-								$markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) );
90
-								echo wp_kses_post( implode( ' | ', $markup ) );
91
-								}
85
+						        case 'item':
86
+							        if ( empty( $subscription_group ) ) {
87
+								        echo wp_kses_post( WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() ) );
88
+								        } else {
89
+								        $markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) );
90
+								        echo wp_kses_post( implode( ' | ', $markup ) );
91
+								        }
92 92
 
93
-							break;
93
+							        break;
94 94
 
95
-						case 'payments':
96
-							$max_activations = (int) $subscription->get_bill_times();
97
-							echo ( (int) $subscription->get_times_billed() ) . ' / ' . ( empty( $max_activations ) ? '&infin;' : (int) $max_activations );
95
+						        case 'payments':
96
+							        $max_activations = (int) $subscription->get_bill_times();
97
+							        echo ( (int) $subscription->get_times_billed() ) . ' / ' . ( empty( $max_activations ) ? '&infin;' : (int) $max_activations );
98 98
 
99
-							break;
99
+							        break;
100 100
 
101
-						}
101
+						    }
102 102
 						do_action( "getpaid_render_single_subscription_column_$key", $subscription );
103 103
 
104 104
 					?>
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -9,17 +9,17 @@  discard block
 block discarded – undo
9 9
  * @var WPInv_Subscriptions_Widget $widget
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) || exit;
12
+defined('ABSPATH') || exit;
13 13
 
14
-do_action( 'getpaid_single_subscription_before_notices', $subscription );
14
+do_action('getpaid_single_subscription_before_notices', $subscription);
15 15
 
16 16
 // Display errors and notices.
17 17
 wpinv_print_errors();
18 18
 
19
-$subscription_groups = getpaid_get_invoice_subscription_groups( $subscription->get_parent_invoice_id() );
20
-$subscription_group  = getpaid_get_invoice_subscription_group( $subscription->get_parent_invoice_id(), $subscription->get_id() );
19
+$subscription_groups = getpaid_get_invoice_subscription_groups($subscription->get_parent_invoice_id());
20
+$subscription_group  = getpaid_get_invoice_subscription_group($subscription->get_parent_invoice_id(), $subscription->get_id());
21 21
 
22
-do_action( 'getpaid_before_single_subscription', $subscription, $subscription_groups );
22
+do_action('getpaid_before_single_subscription', $subscription, $subscription_groups);
23 23
 
24 24
 ?>
25 25
 
@@ -31,44 +31,44 @@  discard block
 block discarded – undo
31 31
 
32 32
 </style>
33 33
 
34
-<h2 class="mb-1 h4"><?php esc_html_e( 'Subscription Details', 'invoicing' ); ?></h2>
34
+<h2 class="mb-1 h4"><?php esc_html_e('Subscription Details', 'invoicing'); ?></h2>
35 35
 <table class="table table-bordered">
36 36
 	<tbody>
37 37
 
38
-		<?php foreach ( $widget->get_single_subscription_columns( $subscription ) as $key => $label ) : ?>
38
+		<?php foreach ($widget->get_single_subscription_columns($subscription) as $key => $label) : ?>
39 39
 
40
-			<tr class="getpaid-subscription-meta-<?php echo sanitize_html_class( $key ); ?>">
40
+			<tr class="getpaid-subscription-meta-<?php echo sanitize_html_class($key); ?>">
41 41
 
42 42
 				<th class="font-weight-bold" style="width: 35%">
43
-					<?php echo esc_html( $label ); ?>
43
+					<?php echo esc_html($label); ?>
44 44
 				</th>
45 45
 
46 46
 				<td style="width: 65%">
47 47
 					<?php
48 48
 
49
-						switch ( $key ) {
49
+						switch ($key) {
50 50
 
51 51
 						case 'status':
52
-							echo esc_html( $subscription->get_status_label() );
52
+							echo esc_html($subscription->get_status_label());
53 53
 							break;
54 54
 
55 55
 						case 'start_date':
56
-							echo esc_html( getpaid_format_date_value( $subscription->get_date_created() ) );
56
+							echo esc_html(getpaid_format_date_value($subscription->get_date_created()));
57 57
 							break;
58 58
 
59 59
 						case 'expiry_date':
60
-							echo esc_html( getpaid_format_date_value( $subscription->get_next_renewal_date() ) );
60
+							echo esc_html(getpaid_format_date_value($subscription->get_next_renewal_date()));
61 61
 							break;
62 62
 
63 63
 						case 'initial_amount':
64
-							echo wp_kses_post( wpinv_price( $subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency() ) );
64
+							echo wp_kses_post(wpinv_price($subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency()));
65 65
 
66
-							if ( $subscription->has_trial_period() ) {
66
+							if ($subscription->has_trial_period()) {
67 67
 
68 68
 								echo "<small class='text-muted'>&nbsp;";
69 69
 								printf(
70
-									esc_html_x( '( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing' ),
71
-									esc_html( $subscription->get_trial_period() )
70
+									esc_html_x('( %1$s trial )', 'Subscription trial period. (e.g.: 1 month trial)', 'invoicing'),
71
+									esc_html($subscription->get_trial_period())
72 72
 								);
73 73
 								echo '</small>';
74 74
 
@@ -77,29 +77,29 @@  discard block
 block discarded – undo
77 77
 							break;
78 78
 
79 79
 						case 'recurring_amount':
80
-							$frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' );
81
-							$amount    = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() );
82
-							echo wp_kses_post( strtolower( "<strong style='font-weight: 500;'>$amount</strong> / <span class='getpaid-item-recurring-period'>$frequency</span>" ) );
80
+							$frequency = getpaid_get_subscription_period_label($subscription->get_period(), $subscription->get_frequency(), '');
81
+							$amount    = wpinv_price($subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency());
82
+							echo wp_kses_post(strtolower("<strong style='font-weight: 500;'>$amount</strong> / <span class='getpaid-item-recurring-period'>$frequency</span>"));
83 83
 							break;
84 84
 
85 85
 						case 'item':
86
-							if ( empty( $subscription_group ) ) {
87
-								echo wp_kses_post( WPInv_Subscriptions_List_Table::generate_item_markup( $subscription->get_product_id() ) );
86
+							if (empty($subscription_group)) {
87
+								echo wp_kses_post(WPInv_Subscriptions_List_Table::generate_item_markup($subscription->get_product_id()));
88 88
 								} else {
89
-								$markup = array_map( array( 'WPInv_Subscriptions_List_Table', 'generate_item_markup' ), array_keys( $subscription_group['items'] ) );
90
-								echo wp_kses_post( implode( ' | ', $markup ) );
89
+								$markup = array_map(array('WPInv_Subscriptions_List_Table', 'generate_item_markup'), array_keys($subscription_group['items']));
90
+								echo wp_kses_post(implode(' | ', $markup));
91 91
 								}
92 92
 
93 93
 							break;
94 94
 
95 95
 						case 'payments':
96 96
 							$max_activations = (int) $subscription->get_bill_times();
97
-							echo ( (int) $subscription->get_times_billed() ) . ' / ' . ( empty( $max_activations ) ? '&infin;' : (int) $max_activations );
97
+							echo ((int) $subscription->get_times_billed()) . ' / ' . (empty($max_activations) ? '&infin;' : (int) $max_activations);
98 98
 
99 99
 							break;
100 100
 
101 101
 						}
102
-						do_action( "getpaid_render_single_subscription_column_$key", $subscription );
102
+						do_action("getpaid_render_single_subscription_column_$key", $subscription);
103 103
 
104 104
 					?>
105 105
 				</td>
@@ -111,34 +111,34 @@  discard block
 block discarded – undo
111 111
 	</tbody>
112 112
 </table>
113 113
 
114
-<?php if ( ! empty( $subscription_group ) ) : ?>
115
-	<h2 class='mt-5 mb-1 h4'><?php esc_html_e( 'Subscription Items', 'invoicing' ); ?></h2>
116
-	<?php getpaid_admin_subscription_item_details_metabox( $subscription ); ?>
114
+<?php if (!empty($subscription_group)) : ?>
115
+	<h2 class='mt-5 mb-1 h4'><?php esc_html_e('Subscription Items', 'invoicing'); ?></h2>
116
+	<?php getpaid_admin_subscription_item_details_metabox($subscription); ?>
117 117
 <?php endif; ?>
118 118
 
119
-<h2 class='mt-5 mb-1 h4'><?php esc_html_e( 'Related Invoices', 'invoicing' ); ?></h2>
119
+<h2 class='mt-5 mb-1 h4'><?php esc_html_e('Related Invoices', 'invoicing'); ?></h2>
120 120
 
121
-<?php echo wp_kses_post( getpaid_admin_subscription_invoice_details_metabox( $subscription ) ); ?>
121
+<?php echo wp_kses_post(getpaid_admin_subscription_invoice_details_metabox($subscription)); ?>
122 122
 
123
-<?php if ( 1 < count( $subscription_groups ) ) : ?>
124
-	<h2 class='mt-5 mb-1 h4'><?php esc_html_e( 'Related Subscriptions', 'invoicing' ); ?></h2>
125
-	<?php getpaid_admin_subscription_related_subscriptions_metabox( $subscription ); ?>
123
+<?php if (1 < count($subscription_groups)) : ?>
124
+	<h2 class='mt-5 mb-1 h4'><?php esc_html_e('Related Subscriptions', 'invoicing'); ?></h2>
125
+	<?php getpaid_admin_subscription_related_subscriptions_metabox($subscription); ?>
126 126
 <?php endif; ?>
127 127
 
128 128
 <span class="form-text">
129 129
 
130 130
 	<?php
131
-		if ( $subscription->can_cancel() ) {
131
+		if ($subscription->can_cancel()) {
132 132
 		printf(
133 133
             '<a href="%s" class="btn btn-danger btn-sm" onclick="return confirm(\'%s\')">%s</a>&nbsp;&nbsp;',
134
-            esc_url( $subscription->get_cancel_url() ),
135
-            esc_attr__( 'Are you sure you want to cancel this subscription?', 'invoicing' ),
136
-            esc_html__( 'Cancel Subscription', 'invoicing' )
134
+            esc_url($subscription->get_cancel_url()),
135
+            esc_attr__('Are you sure you want to cancel this subscription?', 'invoicing'),
136
+            esc_html__('Cancel Subscription', 'invoicing')
137 137
         );
138 138
 		}
139 139
 
140
-		do_action( 'getpaid-single-subscription-page-actions', $subscription );
140
+		do_action('getpaid-single-subscription-page-actions', $subscription);
141 141
 	?>
142 142
 
143
-	<a href="<?php echo esc_url( getpaid_get_tab_url( 'gp-subscriptions', get_permalink( (int) wpinv_get_option( 'invoice_subscription_page' ) ) ) ); ?>" class="btn btn-secondary btn-sm"><?php esc_html_e( 'Go Back', 'invoicing' ); ?></a>
143
+	<a href="<?php echo esc_url(getpaid_get_tab_url('gp-subscriptions', get_permalink((int) wpinv_get_option('invoice_subscription_page')))); ?>" class="btn btn-secondary btn-sm"><?php esc_html_e('Go Back', 'invoicing'); ?></a>
144 144
 </span>
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 apply_filters( 'wpinv_email_billing_title', __( 'Billing Details', 'invoicing' ) ); ?></h3>
9
+    <h3 class="wpinv-address-t"><?php echo 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.
includes/reports/class-getpaid-reports-export.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  *
6 6
  */
7 7
 
8
-defined( 'ABSPATH' ) || exit;
8
+defined('ABSPATH') || exit;
9 9
 
10 10
 /**
11 11
  * GetPaid_Reports_Export Class.
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 	public function display() {
20 20
 
21 21
 		echo "<div class='row mt-4' style='max-width: 920px;' >";
22
-		foreach ( array_keys( getpaid_get_invoice_post_types() ) as $post_type ) {
23
-			$this->display_post_type_export( $post_type );
22
+		foreach (array_keys(getpaid_get_invoice_post_types()) as $post_type) {
23
+			$this->display_post_type_export($post_type);
24 24
 		}
25 25
 		$this->display_subscription_export();
26 26
 		echo '</div>';
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
 	 * Retrieves the download url.
32 32
 	 *
33 33
 	 */
34
-	public function get_download_url( $post_type ) {
34
+	public function get_download_url($post_type) {
35 35
 
36 36
 		return wp_nonce_url(
37 37
 			add_query_arg(
38 38
 				array(
39 39
 					'getpaid-admin-action' => 'export_invoices',
40
-					'post_type'            => urlencode( $post_type ),
40
+					'post_type'            => urlencode($post_type),
41 41
 				)
42 42
 			),
43 43
 			'getpaid-nonce',
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * Displays a single post type export card.
51 51
 	 *
52 52
 	 */
53
-	public function display_post_type_export( $post_type ) {
53
+	public function display_post_type_export($post_type) {
54 54
 
55 55
 		?>
56 56
 
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 					<strong>
62 62
 						<?php
63 63
 							printf(
64
-								__( 'Export %s', 'invoicing' ),
65
-								sanitize_text_field( getpaid_get_post_type_label( $post_type ) )
64
+								__('Export %s', 'invoicing'),
65
+								sanitize_text_field(getpaid_get_post_type_label($post_type))
66 66
 							);
67 67
 						?>
68 68
 					</strong>
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
 
71 71
 				<div class="card-body">
72 72
 
73
-					<form method="post" action="<?php echo esc_url( $this->get_download_url( $post_type ) ); ?>">
73
+					<form method="post" action="<?php echo esc_url($this->get_download_url($post_type)); ?>">
74 74
 
75 75
 						<?php
76
-							$this->display_markup( $this->generate_from_date( $post_type ) );
77
-							$this->display_markup( $this->generate_to_date( $post_type ) );
78
-							$this->display_markup( $this->generate_post_status_select( $post_type ) );
79
-							$this->display_markup( $this->generate_file_type_select( $post_type ) );
80
-							submit_button( __( 'Download', 'invoicing' ) );
76
+							$this->display_markup($this->generate_from_date($post_type));
77
+							$this->display_markup($this->generate_to_date($post_type));
78
+							$this->display_markup($this->generate_post_status_select($post_type));
79
+							$this->display_markup($this->generate_file_type_select($post_type));
80
+							submit_button(__('Download', 'invoicing'));
81 81
 						?>
82 82
 
83 83
 					</form>
@@ -95,14 +95,14 @@  discard block
 block discarded – undo
95 95
 	 * Generates the from date input field.
96 96
 	 *
97 97
 	 */
98
-	public function generate_from_date( $post_type ) {
98
+	public function generate_from_date($post_type) {
99 99
 
100 100
 		return aui()->input(
101 101
 			array(
102 102
 				'name'        => 'from_date',
103
-				'id'          => esc_attr( "$post_type-from_date" ),
103
+				'id'          => esc_attr("$post_type-from_date"),
104 104
 				'placeholder' => 'yy-mm-dd',
105
-				'label'       => __( 'From Date', 'invoicing' ),
105
+				'label'       => __('From Date', 'invoicing'),
106 106
 				'label_type'  => 'vertical',
107 107
 				'label_class' => 'd-block',
108 108
 				'type'        => 'datepicker',
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
 	 * Generates the to date input field.
116 116
 	 *
117 117
 	 */
118
-	public function generate_to_date( $post_type ) {
118
+	public function generate_to_date($post_type) {
119 119
 
120 120
 		return aui()->input(
121 121
 			array(
122 122
 				'name'        => 'to_date',
123
-				'id'          => esc_attr( "$post_type-to_date" ),
123
+				'id'          => esc_attr("$post_type-to_date"),
124 124
 				'placeholder' => 'yy-mm-dd',
125
-				'label'       => __( 'To Date', 'invoicing' ),
125
+				'label'       => __('To Date', 'invoicing'),
126 126
 				'label_type'  => 'vertical',
127 127
 				'label_class' => 'd-block',
128 128
 				'type'        => 'datepicker',
@@ -135,20 +135,20 @@  discard block
 block discarded – undo
135 135
 	 * Generates the to post status select field.
136 136
 	 *
137 137
 	 */
138
-	public function generate_post_status_select( $post_type ) {
138
+	public function generate_post_status_select($post_type) {
139 139
 
140
-		if ( 'subscriptions' === $post_type ) {
140
+		if ('subscriptions' === $post_type) {
141 141
 			$options = getpaid_get_subscription_statuses();
142 142
 		} else {
143
-			$options = wpinv_get_invoice_statuses( true, false, $post_type );
143
+			$options = wpinv_get_invoice_statuses(true, false, $post_type);
144 144
 		}
145 145
 
146 146
 		return aui()->select(
147 147
 			array(
148 148
 				'name'        => 'status',
149
-				'id'          => esc_attr( "$post_type-status" ),
150
-				'placeholder' => __( 'All Statuses', 'invoicing' ),
151
-				'label'       => __( 'Status', 'invoicing' ),
149
+				'id'          => esc_attr("$post_type-status"),
150
+				'placeholder' => __('All Statuses', 'invoicing'),
151
+				'label'       => __('Status', 'invoicing'),
152 152
 				'label_type'  => 'vertical',
153 153
 				'label_class' => 'd-block',
154 154
 				'options'     => $options,
@@ -161,20 +161,20 @@  discard block
 block discarded – undo
161 161
 	 * Generates the to file type select field.
162 162
 	 *
163 163
 	 */
164
-	public function generate_file_type_select( $post_type ) {
164
+	public function generate_file_type_select($post_type) {
165 165
 
166 166
 		return aui()->select(
167 167
 			array(
168 168
 				'name'        => 'file_type',
169
-				'id'          => esc_attr( "$post_type-file_type" ),
170
-				'placeholder' => __( 'Select File Type', 'invoicing' ),
171
-				'label'       => __( 'Export File', 'invoicing' ),
169
+				'id'          => esc_attr("$post_type-file_type"),
170
+				'placeholder' => __('Select File Type', 'invoicing'),
171
+				'label'       => __('Export File', 'invoicing'),
172 172
 				'label_type'  => 'vertical',
173 173
 				'label_class' => 'd-block',
174 174
 				'options'     => array(
175
-					'csv'  => __( 'CSV', 'invoicing' ),
176
-					'xml'  => __( 'XML', 'invoicing' ),
177
-					'json' => __( 'JSON', 'invoicing' ),
175
+					'csv'  => __('CSV', 'invoicing'),
176
+					'xml'  => __('XML', 'invoicing'),
177
+					'json' => __('JSON', 'invoicing'),
178 178
 				),
179 179
 			)
180 180
 		);
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 * Displays a field's markup.
186 186
 	 *
187 187
 	 */
188
-	public function display_markup( $markup ) {
188
+	public function display_markup($markup) {
189 189
 
190 190
 		echo str_replace(
191 191
 			array(
@@ -211,20 +211,20 @@  discard block
 block discarded – undo
211 211
 
212 212
 				<div class="card-header">
213 213
 					<strong>
214
-						<?php esc_html_e( 'Export Subscriptions', 'invoicing' ); ?>
214
+						<?php esc_html_e('Export Subscriptions', 'invoicing'); ?>
215 215
 					</strong>
216 216
 				</div>
217 217
 
218 218
 				<div class="card-body">
219 219
 
220
-					<form method="post" action="<?php echo esc_url( $this->get_download_url( 'subscriptions' ) ); ?>">
220
+					<form method="post" action="<?php echo esc_url($this->get_download_url('subscriptions')); ?>">
221 221
 
222 222
 						<?php
223
-							$this->display_markup( $this->generate_from_date( 'subscriptions' ) );
224
-							$this->display_markup( $this->generate_to_date( 'subscriptions' ) );
225
-							$this->display_markup( $this->generate_post_status_select( 'subscriptions' ) );
226
-							$this->display_markup( $this->generate_file_type_select( 'subscriptions' ) );
227
-							submit_button( __( 'Download', 'invoicing' ) );
223
+							$this->display_markup($this->generate_from_date('subscriptions'));
224
+							$this->display_markup($this->generate_to_date('subscriptions'));
225
+							$this->display_markup($this->generate_post_status_select('subscriptions'));
226
+							$this->display_markup($this->generate_file_type_select('subscriptions'));
227
+							submit_button(__('Download', 'invoicing'));
228 228
 						?>
229 229
 
230 230
 					</form>
Please login to merge, or discard this patch.
includes/reports/class-getpaid-reports-report.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  *
6 6
  */
7 7
 
8
-defined( 'ABSPATH' ) || exit;
8
+defined('ABSPATH') || exit;
9 9
 
10 10
 /**
11 11
  * GetPaid_Reports_Report Class.
@@ -23,26 +23,26 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function __construct() {
25 25
 
26
-		$this->views        = array(
26
+		$this->views = array(
27 27
 
28 28
             'items'     => array(
29
-				'label' => __( 'Items', 'invoicing' ),
29
+				'label' => __('Items', 'invoicing'),
30 30
 				'class' => 'GetPaid_Reports_Report_Items',
31 31
 			),
32 32
 
33 33
 			'gateways'  => array(
34
-				'label' => __( 'Payment Methods', 'invoicing' ),
34
+				'label' => __('Payment Methods', 'invoicing'),
35 35
 				'class' => 'GetPaid_Reports_Report_Gateways',
36 36
 			),
37 37
 
38 38
 			'discounts' => array(
39
-				'label' => __( 'Discount Codes', 'invoicing' ),
39
+				'label' => __('Discount Codes', 'invoicing'),
40 40
 				'class' => 'GetPaid_Reports_Report_Discounts',
41 41
 			),
42 42
 
43 43
         );
44 44
 
45
-		$this->views        = apply_filters( 'wpinv_report_views', $this->views );
45
+		$this->views = apply_filters('wpinv_report_views', $this->views);
46 46
 
47 47
 	}
48 48
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 	public function get_range() {
54 54
 		$valid_ranges = $this->get_periods();
55 55
 
56
-		if ( isset( $_GET['date_range'] ) && array_key_exists( $_GET['date_range'], $valid_ranges ) ) {
57
-			return sanitize_key( $_GET['date_range'] );
56
+		if (isset($_GET['date_range']) && array_key_exists($_GET['date_range'], $valid_ranges)) {
57
+			return sanitize_key($_GET['date_range']);
58 58
 		}
59 59
 
60 60
 		return '7_days';
@@ -68,22 +68,22 @@  discard block
 block discarded – undo
68 68
 	public function get_periods() {
69 69
 
70 70
 		$periods = array(
71
-			'today'        => __( 'Today', 'invoicing' ),
72
-			'yesterday'    => __( 'Yesterday', 'invoicing' ),
73
-			'week'         => __( 'This week', 'invoicing' ),
74
-			'last_week'    => __( 'Last week', 'invoicing' ),
75
-			'7_days'       => __( 'Last 7 days', 'invoicing' ),
76
-			'month'        => __( 'This month', 'invoicing' ),
77
-			'last_month'   => __( 'Last month', 'invoicing' ),
78
-			'30_days'      => __( 'Last 30 days', 'invoicing' ),
79
-			'quarter'      => __( 'This Quarter', 'invoicing' ),
80
-			'last_quarter' => __( 'Last Quarter', 'invoicing' ),
81
-			'year'         => __( 'This year', 'invoicing' ),
82
-			'last_year'    => __( 'Last Year', 'invoicing' ),
83
-			'custom'       => __( 'Custom Date Range', 'invoicing' ),
71
+			'today'        => __('Today', 'invoicing'),
72
+			'yesterday'    => __('Yesterday', 'invoicing'),
73
+			'week'         => __('This week', 'invoicing'),
74
+			'last_week'    => __('Last week', 'invoicing'),
75
+			'7_days'       => __('Last 7 days', 'invoicing'),
76
+			'month'        => __('This month', 'invoicing'),
77
+			'last_month'   => __('Last month', 'invoicing'),
78
+			'30_days'      => __('Last 30 days', 'invoicing'),
79
+			'quarter'      => __('This Quarter', 'invoicing'),
80
+			'last_quarter' => __('Last Quarter', 'invoicing'),
81
+			'year'         => __('This year', 'invoicing'),
82
+			'last_year'    => __('Last Year', 'invoicing'),
83
+			'custom'       => __('Custom Date Range', 'invoicing'),
84 84
 		);
85 85
 
86
-		return apply_filters( 'getpaid_earning_periods', $periods );
86
+		return apply_filters('getpaid_earning_periods', $periods);
87 87
 	}
88 88
 
89 89
 	/**
@@ -96,21 +96,21 @@  discard block
 block discarded – undo
96 96
 		?>
97 97
 
98 98
 			<form method="get" class="getpaid-filter-earnings float-right">
99
-				<?php getpaid_hidden_field( 'page', isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : 'wpinv-reports' ); ?>
100
-				<?php getpaid_hidden_field( 'tab', 'reports' ); ?>
99
+				<?php getpaid_hidden_field('page', isset($_GET['page']) ? sanitize_text_field($_GET['page']) : 'wpinv-reports'); ?>
100
+				<?php getpaid_hidden_field('tab', 'reports'); ?>
101 101
 				<select name='date_range'>
102
-					<?php foreach ( $this->get_periods() as $key => $label ) : ?>
103
-						<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $range ); ?>><?php echo esc_html( $label ); ?></option>
102
+					<?php foreach ($this->get_periods() as $key => $label) : ?>
103
+						<option value="<?php echo esc_attr($key); ?>" <?php selected($key, $range); ?>><?php echo esc_html($label); ?></option>
104 104
 					<?php endforeach; ?>
105 105
 				</select>
106 106
 				<span class="getpaid-date-range-picker <?php echo 'custom' == $range ? '' : 'd-none'; ?>">
107 107
 					<input type="text" name="from" class="getpaid-from align-middle" />
108
-						<?php esc_html_e( 'to', 'invoicing' ); ?>
108
+						<?php esc_html_e('to', 'invoicing'); ?>
109 109
 					<input type="text" name="to" class="getpaid-to align-middle" />
110 110
 				</span>
111 111
 				<button type="submit" class="button button-primary">
112 112
 					<i class="fa fa-chevron-right fa-lg"></i>
113
-					<span class="screen-reader-text"><?php esc_html_e( 'View Reports', 'invoicing' ); ?></span>
113
+					<span class="screen-reader-text"><?php esc_html_e('View Reports', 'invoicing'); ?></span>
114 114
 				</button>
115 115
 			</form>
116 116
 
@@ -159,17 +159,17 @@  discard block
 block discarded – undo
159 159
 
160 160
 				<div class="col-12 col-md-4">
161 161
 					<div class="row getpaid-report-cards">
162
-						<?php foreach ( $this->get_cards() as $key => $card ) : ?>
162
+						<?php foreach ($this->get_cards() as $key => $card) : ?>
163 163
 							<div class="col-12 mb-4">
164 164
 
165
-								<!-- <?php echo esc_html( $card['label'] ); ?> Card -->
166
-								<div class="card p-0 m-0 shadow-none <?php echo sanitize_html_class( $key ); ?>">
165
+								<!-- <?php echo esc_html($card['label']); ?> Card -->
166
+								<div class="card p-0 m-0 shadow-none <?php echo sanitize_html_class($key); ?>">
167 167
 
168 168
 									<div class="card-body">
169 169
 
170 170
 										<p class="getpaid-current text-uppercase small mb-2">
171
-											<strong><?php echo esc_html( $card['label'] ); ?></strong>
172
-											<span title="<?php echo esc_attr( $card['description'] ); ?>" class="wpi-help-tip dashicons dashicons-editor-help text-muted" style="margin-top: -2px;"></span>
171
+											<strong><?php echo esc_html($card['label']); ?></strong>
172
+											<span title="<?php echo esc_attr($card['description']); ?>" class="wpi-help-tip dashicons dashicons-editor-help text-muted" style="margin-top: -2px;"></span>
173 173
 										</p>
174 174
 										<h5 class="font-weight-bold mb-0">
175 175
 											<span class="getpaid-report-card-value">
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
 										<hr>
182 182
 
183
-										<p class="getpaid-previous text-uppercase text-muted small mb-2"><strong><?php esc_html_e( 'Previous Period', 'invoicing' ); ?></strong></p>
183
+										<p class="getpaid-previous text-uppercase text-muted small mb-2"><strong><?php esc_html_e('Previous Period', 'invoicing'); ?></strong></p>
184 184
 										<h5 class="getpaid-report-card-previous-value font-weight-bold text-muted mb-0">
185 185
 											<span class="spinner is-active float-none"></span>
186 186
 										</h5>
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 									</div>
189 189
 
190 190
 								</div>
191
-								<!-- <?php echo esc_html( $card['label'] ); ?> Card -->
191
+								<!-- <?php echo esc_html($card['label']); ?> Card -->
192 192
 
193 193
 							</div>
194 194
 						<?php endforeach; ?>
@@ -213,15 +213,15 @@  discard block
 block discarded – undo
213 213
 
214 214
 		?>
215 215
 
216
-			<?php foreach ( $graphs as $key => $graph ) : ?>
216
+			<?php foreach ($graphs as $key => $graph) : ?>
217 217
 				<div class="row mb-4">
218 218
 					<div class="col-12">
219 219
 						<div class="card m-0 p-0 single-report-card" style="max-width:100%">
220 220
 							<div class="card-header">
221
-								<strong><?php echo esc_html( $graph ); ?></strong>
221
+								<strong><?php echo esc_html($graph); ?></strong>
222 222
 							</div>
223 223
 							<div class="card-body">
224
-								<canvas id="getpaid-chartjs-<?php echo esc_attr( $key ); ?>"></canvas>
224
+								<canvas id="getpaid-chartjs-<?php echo esc_attr($key); ?>"></canvas>
225 225
 							</div>
226 226
 						</div>
227 227
 					</div>
@@ -236,14 +236,14 @@  discard block
 block discarded – undo
236 236
 	 * Retrieves the download url.
237 237
 	 *
238 238
 	 */
239
-	public function get_download_url( $graph, $file_type ) {
239
+	public function get_download_url($graph, $file_type) {
240 240
 
241 241
 		return wp_nonce_url(
242 242
 			add_query_arg(
243 243
 				array(
244 244
 					'getpaid-admin-action' => 'download_graph',
245
-					'file_type'            => urlencode( $file_type ),
246
-					'graph'                => urlencode( $graph ),
245
+					'file_type'            => urlencode($file_type),
246
+					'graph'                => urlencode($graph),
247 247
 				)
248 248
 			),
249 249
 			'getpaid-nonce',
@@ -260,27 +260,27 @@  discard block
 block discarded – undo
260 260
 
261 261
 		?>
262 262
 
263
-			<?php foreach ( $this->views as $key => $view ) : ?>
263
+			<?php foreach ($this->views as $key => $view) : ?>
264 264
 				<div class="row mb-4">
265 265
 					<div class="col-12">
266 266
 						<div class="card m-0 p-0" style="max-width:100%">
267 267
 							<div class="card-header">
268 268
 								<div class="row">
269
-									<div class="<?php echo empty( $view['disable-downloads'] ) ? 'col-9' : 'col-12'; ?>">
270
-										<strong><?php echo esc_html( $view['label'] ); ?></strong>
269
+									<div class="<?php echo empty($view['disable-downloads']) ? 'col-9' : 'col-12'; ?>">
270
+										<strong><?php echo esc_html($view['label']); ?></strong>
271 271
 									</div>
272
-									<div class="<?php echo empty( $view['disable-downloads'] ) ? 'col-3' : 'd-none'; ?>">
273
-										<a title="<?php esc_attr_e( 'Download JSON', 'invoicing' ); ?>" href="<?php echo esc_url( $this->get_download_url( $key, 'json' ) ); ?>">
272
+									<div class="<?php echo empty($view['disable-downloads']) ? 'col-3' : 'd-none'; ?>">
273
+										<a title="<?php esc_attr_e('Download JSON', 'invoicing'); ?>" href="<?php echo esc_url($this->get_download_url($key, 'json')); ?>">
274 274
 											<i class="fa fa-download text-dark" style="font-size: 16px" aria-hidden="true"></i>
275
-											<span class="screen-reader-text"><?php esc_html_e( 'Download JSON', 'invoicing' ); ?></span>
275
+											<span class="screen-reader-text"><?php esc_html_e('Download JSON', 'invoicing'); ?></span>
276 276
 										</a>
277
-										<a title="<?php esc_attr_e( 'Download CSV', 'invoicing' ); ?>" href="<?php echo esc_url( $this->get_download_url( $key, 'csv' ) ); ?>">
277
+										<a title="<?php esc_attr_e('Download CSV', 'invoicing'); ?>" href="<?php echo esc_url($this->get_download_url($key, 'csv')); ?>">
278 278
 											<i class="fa fa-file-csv text-dark" style="font-size: 16px" aria-hidden="true"></i>
279
-											<span class="screen-reader-text"><?php esc_html_e( 'Download CSV', 'invoicing' ); ?></span>
279
+											<span class="screen-reader-text"><?php esc_html_e('Download CSV', 'invoicing'); ?></span>
280 280
 										</a>
281
-										<a title="<?php esc_attr_e( 'Download XML', 'invoicing' ); ?>" href="<?php echo esc_url( $this->get_download_url( $key, 'xml' ) ); ?>">
281
+										<a title="<?php esc_attr_e('Download XML', 'invoicing'); ?>" href="<?php echo esc_url($this->get_download_url($key, 'xml')); ?>">
282 282
 											<i class="fa fa-file-code text-dark" style="font-size: 16px" aria-hidden="true"></i>
283
-											<span class="screen-reader-text"><?php esc_html_e( 'Download XML', 'invoicing' ); ?></span>
283
+											<span class="screen-reader-text"><?php esc_html_e('Download XML', 'invoicing'); ?></span>
284 284
 										</a>
285 285
 									</div>
286 286
 								</div>
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 
300 300
 		<?php
301 301
 
302
-		do_action( 'getpaid_reports_display_right', $this );
302
+		do_action('getpaid_reports_display_right', $this);
303 303
 	}
304 304
 
305 305
 	/**
@@ -310,56 +310,56 @@  discard block
 block discarded – undo
310 310
 
311 311
 		$cards = array(
312 312
 			'total_sales'         => array(
313
-				'description' => __( 'Gross sales in the period.', 'invoicing' ),
314
-				'label'       => __( 'Gross Revenue', 'invoicing' ),
313
+				'description' => __('Gross sales in the period.', 'invoicing'),
314
+				'label'       => __('Gross Revenue', 'invoicing'),
315 315
 			),
316 316
 			'net_sales'           => array(
317
-				'description' => __( 'Net sales in the period.', 'invoicing' ),
318
-				'label'       => __( 'Net Revenue', 'invoicing' ),
317
+				'description' => __('Net sales in the period.', 'invoicing'),
318
+				'label'       => __('Net Revenue', 'invoicing'),
319 319
 			),
320 320
 			'average_sales'       => array(
321
-				'description' => __( 'Average net daily/monthly sales.', 'invoicing' ),
322
-				'label'       => __( 'Avg. Net Sales', 'invoicing' ),
321
+				'description' => __('Average net daily/monthly sales.', 'invoicing'),
322
+				'label'       => __('Avg. Net Sales', 'invoicing'),
323 323
 			),
324 324
 			'average_total_sales' => array(
325
-				'description' => __( 'Average gross daily/monthly sales.', 'invoicing' ),
326
-				'label'       => __( 'Avg. Gross Sales', 'invoicing' ),
325
+				'description' => __('Average gross daily/monthly sales.', 'invoicing'),
326
+				'label'       => __('Avg. Gross Sales', 'invoicing'),
327 327
 			),
328 328
 			'total_invoices'      => array(
329
-				'description' => __( 'Number of paid invoices.', 'invoicing' ),
330
-				'label'       => __( 'Paid Invoices', 'invoicing' ),
329
+				'description' => __('Number of paid invoices.', 'invoicing'),
330
+				'label'       => __('Paid Invoices', 'invoicing'),
331 331
 			),
332 332
 			'total_items'         => array(
333
-				'description' => __( 'Number of items purchased.', 'invoicing' ),
334
-				'label'       => __( 'Purchased Items', 'invoicing' ),
333
+				'description' => __('Number of items purchased.', 'invoicing'),
334
+				'label'       => __('Purchased Items', 'invoicing'),
335 335
 			),
336 336
 			'refunded_items'      => array(
337
-				'description' => __( 'Number of items refunded.', 'invoicing' ),
338
-				'label'       => __( 'Refunded Items', 'invoicing' ),
337
+				'description' => __('Number of items refunded.', 'invoicing'),
338
+				'label'       => __('Refunded Items', 'invoicing'),
339 339
 			),
340 340
 			'total_tax'           => array(
341
-				'description' => __( 'Total charged for taxes.', 'invoicing' ),
342
-				'label'       => __( 'Tax', 'invoicing' ),
341
+				'description' => __('Total charged for taxes.', 'invoicing'),
342
+				'label'       => __('Tax', 'invoicing'),
343 343
 			),
344 344
 			'total_refunded_tax'  => array(
345
-				'description' => __( 'Total refunded for taxes.', 'invoicing' ),
346
-				'label'       => __( 'Refunded Tax', 'invoicing' ),
345
+				'description' => __('Total refunded for taxes.', 'invoicing'),
346
+				'label'       => __('Refunded Tax', 'invoicing'),
347 347
 			),
348 348
 			'total_fees'          => array(
349
-				'description' => __( 'Total fees charged.', 'invoicing' ),
350
-				'label'       => __( 'Fees', 'invoicing' ),
349
+				'description' => __('Total fees charged.', 'invoicing'),
350
+				'label'       => __('Fees', 'invoicing'),
351 351
 			),
352 352
 			'total_refunds'       => array(
353
-				'description' => __( 'Total of refunded invoices.', 'invoicing' ),
354
-				'label'       => __( 'Refunded', 'invoicing' ),
353
+				'description' => __('Total of refunded invoices.', 'invoicing'),
354
+				'label'       => __('Refunded', 'invoicing'),
355 355
 			),
356 356
 			'total_discount'      => array(
357
-				'description' => __( 'Total of discounts used.', 'invoicing' ),
358
-				'label'       => __( 'Discounted', 'invoicing' ),
357
+				'description' => __('Total of discounts used.', 'invoicing'),
358
+				'label'       => __('Discounted', 'invoicing'),
359 359
 			),
360 360
 		);
361 361
 
362
-		return apply_filters( 'wpinv_report_cards', $cards );
362
+		return apply_filters('wpinv_report_cards', $cards);
363 363
 	}
364 364
 
365 365
 
Please login to merge, or discard this patch.
includes/wpinv-template-functions.php 1 patch
Spacing   +456 added lines, -456 removed lines patch added patch discarded remove patch
@@ -4,99 +4,99 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * Displays an invoice.
11 11
  *
12 12
  * @param WPInv_Invoice $invoice.
13 13
  */
14
-function getpaid_invoice( $invoice ) {
15
-    if ( ! empty( $invoice ) ) {
16
-        wpinv_get_template( 'invoice/invoice.php', compact( 'invoice' ) );
14
+function getpaid_invoice($invoice) {
15
+    if (!empty($invoice)) {
16
+        wpinv_get_template('invoice/invoice.php', compact('invoice'));
17 17
     }
18 18
 }
19
-add_action( 'getpaid_invoice', 'getpaid_invoice', 10 );
19
+add_action('getpaid_invoice', 'getpaid_invoice', 10);
20 20
 
21 21
 /**
22 22
  * Displays the invoice footer.
23 23
  */
24
-function getpaid_invoice_footer( $invoice ) {
25
-    if ( ! empty( $invoice ) ) {
26
-        wpinv_get_template( 'invoice/footer.php', compact( 'invoice' ) );
24
+function getpaid_invoice_footer($invoice) {
25
+    if (!empty($invoice)) {
26
+        wpinv_get_template('invoice/footer.php', compact('invoice'));
27 27
     }
28 28
 }
29
-add_action( 'getpaid_invoice_footer', 'getpaid_invoice_footer', 10 );
29
+add_action('getpaid_invoice_footer', 'getpaid_invoice_footer', 10);
30 30
 
31 31
 /**
32 32
  * Displays the invoice top bar.
33 33
  */
34
-function getpaid_invoice_header( $invoice ) {
35
-    if ( ! empty( $invoice ) ) {
36
-        wpinv_get_template( 'invoice/header.php', compact( 'invoice' ) );
34
+function getpaid_invoice_header($invoice) {
35
+    if (!empty($invoice)) {
36
+        wpinv_get_template('invoice/header.php', compact('invoice'));
37 37
     }
38 38
 }
39
-add_action( 'getpaid_invoice_header', 'getpaid_invoice_header', 10 );
39
+add_action('getpaid_invoice_header', 'getpaid_invoice_header', 10);
40 40
 
41 41
 /**
42 42
  * Displays actions on the left side of the header.
43 43
  */
44
-function getpaid_invoice_header_left_actions( $invoice ) {
45
-    if ( ! empty( $invoice ) ) {
46
-        wpinv_get_template( 'invoice/header-left-actions.php', compact( 'invoice' ) );
44
+function getpaid_invoice_header_left_actions($invoice) {
45
+    if (!empty($invoice)) {
46
+        wpinv_get_template('invoice/header-left-actions.php', compact('invoice'));
47 47
     }
48 48
 }
49
-add_action( 'getpaid_invoice_header_left', 'getpaid_invoice_header_left_actions', 10 );
49
+add_action('getpaid_invoice_header_left', 'getpaid_invoice_header_left_actions', 10);
50 50
 
51 51
 /**
52 52
  * Displays actions on the right side of the invoice top bar.
53 53
  */
54
-function getpaid_invoice_header_right_actions( $invoice ) {
55
-    if ( ! empty( $invoice ) ) {
56
-        wpinv_get_template( 'invoice/header-right-actions.php', compact( 'invoice' ) );
54
+function getpaid_invoice_header_right_actions($invoice) {
55
+    if (!empty($invoice)) {
56
+        wpinv_get_template('invoice/header-right-actions.php', compact('invoice'));
57 57
     }
58 58
 }
59
-add_action( 'getpaid_invoice_header_right', 'getpaid_invoice_header_right_actions', 10 );
59
+add_action('getpaid_invoice_header_right', 'getpaid_invoice_header_right_actions', 10);
60 60
 
61 61
 /**
62 62
  * Displays the invoice title, logo etc.
63 63
  */
64
-function getpaid_invoice_details_top( $invoice ) {
65
-    if ( ! empty( $invoice ) ) {
66
-        wpinv_get_template( 'invoice/details-top.php', compact( 'invoice' ) );
64
+function getpaid_invoice_details_top($invoice) {
65
+    if (!empty($invoice)) {
66
+        wpinv_get_template('invoice/details-top.php', compact('invoice'));
67 67
     }
68 68
 }
69
-add_action( 'getpaid_invoice_details', 'getpaid_invoice_details_top', 10 );
69
+add_action('getpaid_invoice_details', 'getpaid_invoice_details_top', 10);
70 70
 
71 71
 /**
72 72
  * Displays the company logo.
73 73
  */
74
-function getpaid_invoice_logo( $invoice ) {
75
-    if ( ! empty( $invoice ) ) {
76
-        wpinv_get_template( 'invoice/invoice-logo.php', compact( 'invoice' ) );
74
+function getpaid_invoice_logo($invoice) {
75
+    if (!empty($invoice)) {
76
+        wpinv_get_template('invoice/invoice-logo.php', compact('invoice'));
77 77
     }
78 78
 }
79
-add_action( 'getpaid_invoice_details_top_left', 'getpaid_invoice_logo' );
79
+add_action('getpaid_invoice_details_top_left', 'getpaid_invoice_logo');
80 80
 
81 81
 /**
82 82
  * Displays the type of invoice.
83 83
  */
84
-function getpaid_invoice_type( $invoice ) {
85
-    if ( ! empty( $invoice ) ) {
86
-        wpinv_get_template( 'invoice/invoice-type.php', compact( 'invoice' ) );
84
+function getpaid_invoice_type($invoice) {
85
+    if (!empty($invoice)) {
86
+        wpinv_get_template('invoice/invoice-type.php', compact('invoice'));
87 87
     }
88 88
 }
89
-add_action( 'getpaid_invoice_details_top_right', 'getpaid_invoice_type' );
89
+add_action('getpaid_invoice_details_top_right', 'getpaid_invoice_type');
90 90
 
91 91
 /**
92 92
  * Displays the invoice details.
93 93
  */
94
-function getpaid_invoice_details_main( $invoice ) {
95
-    if ( ! empty( $invoice ) ) {
96
-        wpinv_get_template( 'invoice/details.php', compact( 'invoice' ) );
94
+function getpaid_invoice_details_main($invoice) {
95
+    if (!empty($invoice)) {
96
+        wpinv_get_template('invoice/details.php', compact('invoice'));
97 97
     }
98 98
 }
99
-add_action( 'getpaid_invoice_details', 'getpaid_invoice_details_main', 50 );
99
+add_action('getpaid_invoice_details', 'getpaid_invoice_details_main', 50);
100 100
 
101 101
 /**
102 102
  * Returns a path to the templates directory.
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
  * @param string $template_path The templates directory relative to the theme's root dir. Defaults to 'invoicing'.
126 126
  * @param string $default_path The root path to the default template. Defaults to invoicing/templates
127 127
  */
128
-function wpinv_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
129
-    getpaid_template()->display_template( $template_name, $args, $template_path, $default_path );
128
+function wpinv_get_template($template_name, $args = array(), $template_path = '', $default_path = '') {
129
+    getpaid_template()->display_template($template_name, $args, $template_path, $default_path);
130 130
 }
131 131
 
132 132
 /**
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
  * @param string $template_path The templates directory relative to the theme's root dir. Defaults to 'invoicing'.
140 140
  * @param string $default_path The root path to the default template. Defaults to invoicing/templates
141 141
  */
142
-function wpinv_get_template_html( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
143
-	return getpaid_template()->get_template( $template_name, $args, $template_path, $default_path );
142
+function wpinv_get_template_html($template_name, $args = array(), $template_path = '', $default_path = '') {
143
+	return getpaid_template()->get_template($template_name, $args, $template_path, $default_path);
144 144
 }
145 145
 
146 146
 /**
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
  * @return string
150 150
  */
151 151
 function wpinv_template_path() {
152
-    return apply_filters( 'wpinv_template_path', wpinv_get_theme_template_dir_name() );
152
+    return apply_filters('wpinv_template_path', wpinv_get_theme_template_dir_name());
153 153
 }
154 154
 
155 155
 /**
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
  * @return string
159 159
  */
160 160
 function wpinv_get_theme_template_dir_name() {
161
-	return trailingslashit( apply_filters( 'wpinv_templates_dir', 'invoicing' ) );
161
+	return trailingslashit(apply_filters('wpinv_templates_dir', 'invoicing'));
162 162
 }
163 163
 
164 164
 /**
@@ -170,58 +170,58 @@  discard block
 block discarded – undo
170 170
  * @param string $template_path The template path relative to the theme's root dir. Defaults to 'invoicing'.
171 171
  * @param string $default_path The root path to the default template. Defaults to invoicing/templates
172 172
  */
173
-function wpinv_locate_template( $template_name, $template_path = '', $default_path = '' ) {
174
-    return getpaid_template()->locate_template( $template_name, $template_path, $default_path );
173
+function wpinv_locate_template($template_name, $template_path = '', $default_path = '') {
174
+    return getpaid_template()->locate_template($template_name, $template_path, $default_path);
175 175
 }
176 176
 
177
-function wpinv_get_template_part( $slug, $name = null, $load = true ) {
178
-	do_action( 'get_template_part_' . $slug, $slug, $name );
177
+function wpinv_get_template_part($slug, $name = null, $load = true) {
178
+	do_action('get_template_part_' . $slug, $slug, $name);
179 179
 
180 180
 	// Setup possible parts
181 181
 	$templates = array();
182
-	if ( isset( $name ) ) {
182
+	if (isset($name)) {
183 183
 		$templates[] = $slug . '-' . $name . '.php';
184 184
     }
185 185
 	$templates[] = $slug . '.php';
186 186
 
187 187
 	// Allow template parts to be filtered
188
-	$templates = apply_filters( 'wpinv_get_template_part', $templates, $slug, $name );
188
+	$templates = apply_filters('wpinv_get_template_part', $templates, $slug, $name);
189 189
 
190 190
 	// Return the part that is found
191
-	return wpinv_locate_tmpl( $templates, $load, false );
191
+	return wpinv_locate_tmpl($templates, $load, false);
192 192
 }
193 193
 
194
-function wpinv_locate_tmpl( $template_names, $load = false, $require_once = true ) {
194
+function wpinv_locate_tmpl($template_names, $load = false, $require_once = true) {
195 195
 	// No file found yet
196 196
 	$located = false;
197 197
 
198 198
 	// Try to find a template file
199
-	foreach ( (array)$template_names as $template_name ) {
199
+	foreach ((array) $template_names as $template_name) {
200 200
 
201 201
 		// Continue if template is empty
202
-		if ( empty( $template_name ) ) {
202
+		if (empty($template_name)) {
203 203
 			continue;
204 204
         }
205 205
 
206 206
 		// Trim off any slashes from the template name
207
-		$template_name = ltrim( $template_name, '/' );
207
+		$template_name = ltrim($template_name, '/');
208 208
 
209 209
 		// try locating this template file by looping through the template paths
210
-		foreach ( wpinv_get_theme_template_paths() as $template_path ) {
210
+		foreach (wpinv_get_theme_template_paths() as $template_path) {
211 211
 
212
-			if ( file_exists( $template_path . $template_name ) ) {
212
+			if (file_exists($template_path . $template_name)) {
213 213
 				$located = $template_path . $template_name;
214 214
 				break;
215 215
 			}
216 216
 		}
217 217
 
218
-		if ( ! empty( $located ) ) {
218
+		if (!empty($located)) {
219 219
 			break;
220 220
 		}
221 221
 	}
222 222
 
223
-	if ( ( true == $load ) && ! empty( $located ) ) {
224
-		load_template( $located, $require_once );
223
+	if ((true == $load) && !empty($located)) {
224
+		load_template($located, $require_once);
225 225
     }
226 226
 
227 227
 	return $located;
@@ -231,81 +231,81 @@  discard block
 block discarded – undo
231 231
 	$template_dir = wpinv_get_theme_template_dir_name();
232 232
 
233 233
 	$file_paths = array(
234
-		1   => trailingslashit( get_stylesheet_directory() ) . $template_dir,
235
-		10  => trailingslashit( get_template_directory() ) . $template_dir,
234
+		1   => trailingslashit(get_stylesheet_directory()) . $template_dir,
235
+		10  => trailingslashit(get_template_directory()) . $template_dir,
236 236
 		100 => wpinv_get_templates_dir(),
237 237
 	);
238 238
 
239
-	$file_paths = apply_filters( 'wpinv_template_paths', $file_paths );
239
+	$file_paths = apply_filters('wpinv_template_paths', $file_paths);
240 240
 
241 241
 	// sort the file paths based on priority
242
-	ksort( $file_paths, SORT_NUMERIC );
242
+	ksort($file_paths, SORT_NUMERIC);
243 243
 
244
-	return array_map( 'trailingslashit', $file_paths );
244
+	return array_map('trailingslashit', $file_paths);
245 245
 }
246 246
 
247 247
 function wpinv_checkout_meta_tags() {
248 248
 
249 249
 	$pages   = array();
250
-	$pages[] = wpinv_get_option( 'success_page' );
251
-	$pages[] = wpinv_get_option( 'failure_page' );
252
-	$pages[] = wpinv_get_option( 'invoice_history_page' );
253
-	$pages[] = wpinv_get_option( 'invoice_subscription_page' );
250
+	$pages[] = wpinv_get_option('success_page');
251
+	$pages[] = wpinv_get_option('failure_page');
252
+	$pages[] = wpinv_get_option('invoice_history_page');
253
+	$pages[] = wpinv_get_option('invoice_subscription_page');
254 254
 
255
-	if ( ! wpinv_is_checkout() && ! is_page( $pages ) ) {
255
+	if (!wpinv_is_checkout() && !is_page($pages)) {
256 256
 		return;
257 257
 	}
258 258
 
259 259
 	echo '<meta name="robots" content="noindex,nofollow" />' . "\n";
260 260
 }
261
-add_action( 'wp_head', 'wpinv_checkout_meta_tags' );
261
+add_action('wp_head', 'wpinv_checkout_meta_tags');
262 262
 
263
-function wpinv_add_body_classes( $class ) {
264
-	$classes = (array)$class;
263
+function wpinv_add_body_classes($class) {
264
+	$classes = (array) $class;
265 265
 
266
-	if ( wpinv_is_checkout() ) {
266
+	if (wpinv_is_checkout()) {
267 267
 		$classes[] = 'wpinv-checkout';
268 268
 		$classes[] = 'wpinv-page';
269 269
 	}
270 270
 
271
-	if ( wpinv_is_success_page() ) {
271
+	if (wpinv_is_success_page()) {
272 272
 		$classes[] = 'wpinv-success';
273 273
 		$classes[] = 'wpinv-page';
274 274
 	}
275 275
 
276
-	if ( wpinv_is_failed_transaction_page() ) {
276
+	if (wpinv_is_failed_transaction_page()) {
277 277
 		$classes[] = 'wpinv-failed-transaction';
278 278
 		$classes[] = 'wpinv-page';
279 279
 	}
280 280
 
281
-	if ( wpinv_is_invoice_history_page() ) {
281
+	if (wpinv_is_invoice_history_page()) {
282 282
 		$classes[] = 'wpinv-history';
283 283
 		$classes[] = 'wpinv-page';
284 284
 	}
285 285
 
286
-	if ( wpinv_is_subscriptions_history_page() ) {
286
+	if (wpinv_is_subscriptions_history_page()) {
287 287
 		$classes[] = 'wpinv-subscription';
288 288
 		$classes[] = 'wpinv-page';
289 289
 	}
290 290
 
291
-	if ( wpinv_is_test_mode() ) {
291
+	if (wpinv_is_test_mode()) {
292 292
 		$classes[] = 'wpinv-test-mode';
293 293
 		$classes[] = 'wpinv-page';
294 294
 	}
295 295
 
296
-	return array_unique( $classes );
296
+	return array_unique($classes);
297 297
 }
298
-add_filter( 'body_class', 'wpinv_add_body_classes' );
298
+add_filter('body_class', 'wpinv_add_body_classes');
299 299
 
300
-function wpinv_html_year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) {
301
-    $current     = date( 'Y' );
302
-    $start_year  = $current - absint( $years_before );
303
-    $end_year    = $current + absint( $years_after );
304
-    $selected    = empty( $selected ) ? date( 'Y' ) : $selected;
300
+function wpinv_html_year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) {
301
+    $current     = date('Y');
302
+    $start_year  = $current - absint($years_before);
303
+    $end_year    = $current + absint($years_after);
304
+    $selected    = empty($selected) ? date('Y') : $selected;
305 305
     $options     = array();
306 306
 
307
-    while ( $start_year <= $end_year ) {
308
-        $options[ absint( $start_year ) ] = $start_year;
307
+    while ($start_year <= $end_year) {
308
+        $options[absint($start_year)] = $start_year;
309 309
         $start_year++;
310 310
     }
311 311
 
@@ -322,25 +322,25 @@  discard block
 block discarded – undo
322 322
     return $output;
323 323
 }
324 324
 
325
-function wpinv_html_month_dropdown( $name = 'month', $selected = 0 ) {
325
+function wpinv_html_month_dropdown($name = 'month', $selected = 0) {
326 326
 
327 327
     $options = array(
328
-        '1'  => __( 'January', 'invoicing' ),
329
-        '2'  => __( 'February', 'invoicing' ),
330
-        '3'  => __( 'March', 'invoicing' ),
331
-        '4'  => __( 'April', 'invoicing' ),
332
-        '5'  => __( 'May', 'invoicing' ),
333
-        '6'  => __( 'June', 'invoicing' ),
334
-        '7'  => __( 'July', 'invoicing' ),
335
-        '8'  => __( 'August', 'invoicing' ),
336
-        '9'  => __( 'September', 'invoicing' ),
337
-        '10' => __( 'October', 'invoicing' ),
338
-        '11' => __( 'November', 'invoicing' ),
339
-        '12' => __( 'December', 'invoicing' ),
328
+        '1'  => __('January', 'invoicing'),
329
+        '2'  => __('February', 'invoicing'),
330
+        '3'  => __('March', 'invoicing'),
331
+        '4'  => __('April', 'invoicing'),
332
+        '5'  => __('May', 'invoicing'),
333
+        '6'  => __('June', 'invoicing'),
334
+        '7'  => __('July', 'invoicing'),
335
+        '8'  => __('August', 'invoicing'),
336
+        '9'  => __('September', 'invoicing'),
337
+        '10' => __('October', 'invoicing'),
338
+        '11' => __('November', 'invoicing'),
339
+        '12' => __('December', 'invoicing'),
340 340
     );
341 341
 
342 342
     // If no month is selected, default to the current month
343
-    $selected = empty( $selected ) ? date( 'n' ) : $selected;
343
+    $selected = empty($selected) ? date('n') : $selected;
344 344
 
345 345
     $output = wpinv_html_select(
346 346
         array(
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
     return $output;
356 356
 }
357 357
 
358
-function wpinv_html_select( $args = array() ) {
358
+function wpinv_html_select($args = array()) {
359 359
     $defaults = array(
360 360
         'options'          => array(),
361 361
         'name'             => null,
@@ -364,8 +364,8 @@  discard block
 block discarded – undo
364 364
         'selected'         => 0,
365 365
         'placeholder'      => null,
366 366
         'multiple'         => false,
367
-        'show_option_all'  => _x( 'All', 'all dropdown items', 'invoicing' ),
368
-        'show_option_none' => _x( 'None', 'no dropdown items', 'invoicing' ),
367
+        'show_option_all'  => _x('All', 'all dropdown items', 'invoicing'),
368
+        'show_option_none' => _x('None', 'no dropdown items', 'invoicing'),
369 369
         'data'             => array(),
370 370
         'onchange'         => null,
371 371
         'required'         => false,
@@ -373,74 +373,74 @@  discard block
 block discarded – undo
373 373
         'readonly'         => false,
374 374
     );
375 375
 
376
-    $args = wp_parse_args( $args, $defaults );
376
+    $args = wp_parse_args($args, $defaults);
377 377
 
378 378
     $data_elements = '';
379
-    foreach ( $args['data'] as $key => $value ) {
380
-        $data_elements .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
379
+    foreach ($args['data'] as $key => $value) {
380
+        $data_elements .= ' data-' . esc_attr($key) . '="' . esc_attr($value) . '"';
381 381
     }
382 382
 
383
-    if ( $args['multiple'] ) {
383
+    if ($args['multiple']) {
384 384
         $multiple = ' MULTIPLE';
385 385
     } else {
386 386
         $multiple = '';
387 387
     }
388 388
 
389
-    if ( $args['placeholder'] ) {
389
+    if ($args['placeholder']) {
390 390
         $placeholder = $args['placeholder'];
391 391
     } else {
392 392
         $placeholder = '';
393 393
     }
394 394
 
395 395
     $options = '';
396
-    if ( ! empty( $args['onchange'] ) ) {
397
-        $options .= ' onchange="' . esc_attr( $args['onchange'] ) . '"';
396
+    if (!empty($args['onchange'])) {
397
+        $options .= ' onchange="' . esc_attr($args['onchange']) . '"';
398 398
     }
399 399
 
400
-    if ( ! empty( $args['required'] ) ) {
400
+    if (!empty($args['required'])) {
401 401
         $options .= ' required="required"';
402 402
     }
403 403
 
404
-    if ( ! empty( $args['disabled'] ) ) {
404
+    if (!empty($args['disabled'])) {
405 405
         $options .= ' disabled';
406 406
     }
407 407
 
408
-    if ( ! empty( $args['readonly'] ) ) {
408
+    if (!empty($args['readonly'])) {
409 409
         $options .= ' readonly';
410 410
     }
411 411
 
412
-    $class  = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
413
-    $output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['id'] ) . '" class="wpinv-select ' . $class . '"' . $multiple . ' data-placeholder="' . $placeholder . '" ' . trim( $options ) . $data_elements . '>';
412
+    $class  = implode(' ', array_map('sanitize_html_class', explode(' ', $args['class'])));
413
+    $output = '<select name="' . esc_attr($args['name']) . '" id="' . esc_attr($args['id']) . '" class="wpinv-select ' . $class . '"' . $multiple . ' data-placeholder="' . $placeholder . '" ' . trim($options) . $data_elements . '>';
414 414
 
415
-    if ( $args['show_option_all'] ) {
416
-        if ( $args['multiple'] ) {
417
-            $selected = selected( true, in_array( 0, $args['selected'] ), false );
415
+    if ($args['show_option_all']) {
416
+        if ($args['multiple']) {
417
+            $selected = selected(true, in_array(0, $args['selected']), false);
418 418
         } else {
419
-            $selected = selected( $args['selected'], 0, false );
419
+            $selected = selected($args['selected'], 0, false);
420 420
         }
421
-        $output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
421
+        $output .= '<option value="all"' . $selected . '>' . esc_html($args['show_option_all']) . '</option>';
422 422
     }
423 423
 
424
-    if ( ! empty( $args['options'] ) ) {
424
+    if (!empty($args['options'])) {
425 425
 
426
-        if ( $args['show_option_none'] ) {
427
-            if ( $args['multiple'] ) {
428
-                $selected = selected( true, in_array( '', $args['selected'] ), false );
426
+        if ($args['show_option_none']) {
427
+            if ($args['multiple']) {
428
+                $selected = selected(true, in_array('', $args['selected']), false);
429 429
             } else {
430
-                $selected = selected( $args['selected'] === '', true, false );
430
+                $selected = selected($args['selected'] === '', true, false);
431 431
             }
432
-            $output .= '<option value=""' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
432
+            $output .= '<option value=""' . $selected . '>' . esc_html($args['show_option_none']) . '</option>';
433 433
         }
434 434
 
435
-        foreach ( $args['options'] as $key => $option ) {
435
+        foreach ($args['options'] as $key => $option) {
436 436
 
437
-            if ( $args['multiple'] && is_array( $args['selected'] ) ) {
438
-                $selected = selected( true, (bool)in_array( $key, $args['selected'] ), false );
437
+            if ($args['multiple'] && is_array($args['selected'])) {
438
+                $selected = selected(true, (bool) in_array($key, $args['selected']), false);
439 439
             } else {
440
-                $selected = selected( $args['selected'], $key, false );
440
+                $selected = selected($args['selected'], $key, false);
441 441
             }
442 442
 
443
-            $output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
443
+            $output .= '<option value="' . esc_attr($key) . '"' . $selected . '>' . esc_html($option) . '</option>';
444 444
         }
445 445
     }
446 446
 
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
     return $output;
450 450
 }
451 451
 
452
-function wpinv_item_dropdown( $args = array() ) {
452
+function wpinv_item_dropdown($args = array()) {
453 453
     $defaults = array(
454 454
         'name'             => 'wpi_item',
455 455
         'id'               => 'wpi_item',
@@ -457,14 +457,14 @@  discard block
 block discarded – undo
457 457
         'multiple'         => false,
458 458
         'selected'         => 0,
459 459
         'number'           => -1,
460
-        'placeholder'      => __( 'Choose a item', 'invoicing' ),
461
-        'data'             => array( 'search-type' => 'item' ),
460
+        'placeholder'      => __('Choose a item', 'invoicing'),
461
+        'data'             => array('search-type' => 'item'),
462 462
         'show_option_all'  => false,
463 463
         'show_option_none' => false,
464 464
         'show_recurring'   => false,
465 465
     );
466 466
 
467
-    $args = wp_parse_args( $args, $defaults );
467
+    $args = wp_parse_args($args, $defaults);
468 468
 
469 469
     $item_args = array(
470 470
         'post_type'      => 'wpi_item',
@@ -473,40 +473,40 @@  discard block
 block discarded – undo
473 473
         'posts_per_page' => $args['number'],
474 474
     );
475 475
 
476
-    $item_args  = apply_filters( 'wpinv_item_dropdown_query_args', $item_args, $args, $defaults );
476
+    $item_args  = apply_filters('wpinv_item_dropdown_query_args', $item_args, $args, $defaults);
477 477
 
478
-    $items      = get_posts( $item_args );
478
+    $items      = get_posts($item_args);
479 479
     $options    = array();
480
-    if ( $items ) {
481
-        foreach ( $items as $item ) {
482
-            $title = esc_html( $item->post_title );
480
+    if ($items) {
481
+        foreach ($items as $item) {
482
+            $title = esc_html($item->post_title);
483 483
 
484
-            if ( ! empty( $args['show_recurring'] ) ) {
485
-                $title .= wpinv_get_item_suffix( $item->ID, false );
484
+            if (!empty($args['show_recurring'])) {
485
+                $title .= wpinv_get_item_suffix($item->ID, false);
486 486
             }
487 487
 
488
-            $options[ absint( $item->ID ) ] = $title;
488
+            $options[absint($item->ID)] = $title;
489 489
         }
490 490
     }
491 491
 
492 492
     // This ensures that any selected items are included in the drop down
493
-    if ( is_array( $args['selected'] ) ) {
494
-        foreach ( $args['selected'] as $item ) {
495
-            if ( ! in_array( $item, $options ) ) {
496
-                $title = get_the_title( $item );
497
-                if ( ! empty( $args['show_recurring'] ) ) {
498
-                    $title .= wpinv_get_item_suffix( $item, false );
493
+    if (is_array($args['selected'])) {
494
+        foreach ($args['selected'] as $item) {
495
+            if (!in_array($item, $options)) {
496
+                $title = get_the_title($item);
497
+                if (!empty($args['show_recurring'])) {
498
+                    $title .= wpinv_get_item_suffix($item, false);
499 499
                 }
500
-                $options[ $item ] = $title;
500
+                $options[$item] = $title;
501 501
             }
502 502
         }
503
-    } elseif ( is_numeric( $args['selected'] ) && $args['selected'] !== 0 ) {
504
-        if ( ! in_array( $args['selected'], $options ) ) {
505
-            $title = get_the_title( $args['selected'] );
506
-            if ( ! empty( $args['show_recurring'] ) ) {
507
-                $title .= wpinv_get_item_suffix( $args['selected'], false );
503
+    } elseif (is_numeric($args['selected']) && $args['selected'] !== 0) {
504
+        if (!in_array($args['selected'], $options)) {
505
+            $title = get_the_title($args['selected']);
506
+            if (!empty($args['show_recurring'])) {
507
+                $title .= wpinv_get_item_suffix($args['selected'], false);
508 508
             }
509
-            $options[ $args['selected'] ] = get_the_title( $args['selected'] );
509
+            $options[$args['selected']] = get_the_title($args['selected']);
510 510
         }
511 511
     }
512 512
 
@@ -543,16 +543,16 @@  discard block
 block discarded – undo
543 543
     );
544 544
 
545 545
     $options = array();
546
-    if ( $items ) {
547
-        foreach ( $items as $item ) {
548
-            $options[ $item->ID ] = esc_html( $item->post_title ) . wpinv_get_item_suffix( $item->ID, false );
546
+    if ($items) {
547
+        foreach ($items as $item) {
548
+            $options[$item->ID] = esc_html($item->post_title) . wpinv_get_item_suffix($item->ID, false);
549 549
         }
550 550
     }
551 551
 
552 552
     return $options;
553 553
 }
554 554
 
555
-function wpinv_html_checkbox( $args = array() ) {
555
+function wpinv_html_checkbox($args = array()) {
556 556
     $defaults = array(
557 557
         'name'    => null,
558 558
         'current' => null,
@@ -563,17 +563,17 @@  discard block
 block discarded – undo
563 563
         ),
564 564
     );
565 565
 
566
-    $args = wp_parse_args( $args, $defaults );
566
+    $args = wp_parse_args($args, $defaults);
567 567
 
568
-    $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
568
+    $class = implode(' ', array_map('sanitize_html_class', explode(' ', $args['class'])));
569 569
     $attr  = '';
570
-    if ( ! empty( $args['options']['disabled'] ) ) {
570
+    if (!empty($args['options']['disabled'])) {
571 571
         $attr .= ' disabled="disabled"';
572
-    } elseif ( ! empty( $args['options']['readonly'] ) ) {
572
+    } elseif (!empty($args['options']['readonly'])) {
573 573
         $attr .= ' readonly';
574 574
     }
575 575
 
576
-    $output = '<input type="checkbox"' . $attr . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . esc_attr( $class ) . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />';
576
+    $output = '<input type="checkbox"' . $attr . ' name="' . esc_attr($args['name']) . '" id="' . esc_attr($args['name']) . '" class="' . esc_attr($class) . ' ' . esc_attr($args['name']) . '" ' . checked(1, $args['current'], false) . ' />';
577 577
 
578 578
     return $output;
579 579
 }
@@ -581,34 +581,34 @@  discard block
 block discarded – undo
581 581
 /**
582 582
  * Displays a hidden field.
583 583
  */
584
-function getpaid_hidden_field( $name, $value ) {
585
-    echo "<input type='hidden' name='" . esc_attr( $name ) . "' value=' " . esc_attr( $value ) . "' />";
584
+function getpaid_hidden_field($name, $value) {
585
+    echo "<input type='hidden' name='" . esc_attr($name) . "' value=' " . esc_attr($value) . "' />";
586 586
 }
587 587
 
588 588
 /**
589 589
  * Displays a submit field.
590 590
  */
591
-function getpaid_submit_field( $value, $name = 'submit', $class = 'btn-primary' ) {
592
-    echo "<input type='submit' name='" . esc_attr( $name ) . "' value='" . esc_attr( $value ) . "' class='btn " . esc_attr( $class ) . "' />";
591
+function getpaid_submit_field($value, $name = 'submit', $class = 'btn-primary') {
592
+    echo "<input type='submit' name='" . esc_attr($name) . "' value='" . esc_attr($value) . "' class='btn " . esc_attr($class) . "' />";
593 593
 }
594 594
 
595
-function wpinv_html_text( $args = array() ) {
595
+function wpinv_html_text($args = array()) {
596 596
     // Backwards compatibility
597
-    if ( func_num_args() > 1 ) {
597
+    if (func_num_args() > 1) {
598 598
         $args = func_get_args();
599 599
 
600 600
         $name  = $args[0];
601
-        $value = isset( $args[1] ) ? $args[1] : '';
602
-        $label = isset( $args[2] ) ? $args[2] : '';
603
-        $desc  = isset( $args[3] ) ? $args[3] : '';
601
+        $value = isset($args[1]) ? $args[1] : '';
602
+        $label = isset($args[2]) ? $args[2] : '';
603
+        $desc  = isset($args[3]) ? $args[3] : '';
604 604
     }
605 605
 
606 606
     $defaults = array(
607 607
         'id'           => '',
608
-        'name'         => isset( $name ) ? $name : 'text',
609
-        'value'        => isset( $value ) ? $value : null,
610
-        'label'        => isset( $label ) ? $label : null,
611
-        'desc'         => isset( $desc ) ? $desc : null,
608
+        'name'         => isset($name) ? $name : 'text',
609
+        'value'        => isset($value) ? $value : null,
610
+        'label'        => isset($label) ? $label : null,
611
+        'desc'         => isset($desc) ? $desc : null,
612 612
         'placeholder'  => '',
613 613
         'class'        => 'regular-text',
614 614
         'disabled'     => false,
@@ -618,41 +618,41 @@  discard block
 block discarded – undo
618 618
         'data'         => false,
619 619
     );
620 620
 
621
-    $args = wp_parse_args( $args, $defaults );
621
+    $args = wp_parse_args($args, $defaults);
622 622
 
623
-    $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
623
+    $class = implode(' ', array_map('sanitize_html_class', explode(' ', $args['class'])));
624 624
     $options = '';
625
-    if ( $args['required'] ) {
625
+    if ($args['required']) {
626 626
         $options .= ' required="required"';
627 627
     }
628
-    if ( $args['readonly'] ) {
628
+    if ($args['readonly']) {
629 629
         $options .= ' readonly';
630 630
     }
631
-    if ( $args['readonly'] ) {
631
+    if ($args['readonly']) {
632 632
         $options .= ' readonly';
633 633
     }
634 634
 
635 635
     $data = '';
636
-    if ( ! empty( $args['data'] ) ) {
637
-        foreach ( $args['data'] as $key => $value ) {
638
-            $data .= 'data-' . wpinv_sanitize_key( $key ) . '="' . esc_attr( $value ) . '" ';
636
+    if (!empty($args['data'])) {
637
+        foreach ($args['data'] as $key => $value) {
638
+            $data .= 'data-' . wpinv_sanitize_key($key) . '="' . esc_attr($value) . '" ';
639 639
         }
640 640
     }
641 641
 
642
-    $output = '<span id="wpinv-' . wpinv_sanitize_key( $args['name'] ) . '-wrap">';
643
-    $output .= '<label class="wpinv-label" for="' . wpinv_sanitize_key( $args['id'] ) . '">' . esc_html( $args['label'] ) . '</label>';
644
-    if ( ! empty( $args['desc'] ) ) {
645
-        $output .= '<span class="wpinv-description">' . esc_html( $args['desc'] ) . '</span>';
642
+    $output = '<span id="wpinv-' . wpinv_sanitize_key($args['name']) . '-wrap">';
643
+    $output .= '<label class="wpinv-label" for="' . wpinv_sanitize_key($args['id']) . '">' . esc_html($args['label']) . '</label>';
644
+    if (!empty($args['desc'])) {
645
+        $output .= '<span class="wpinv-description">' . esc_html($args['desc']) . '</span>';
646 646
     }
647 647
 
648
-    $output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['id'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $class . '" ' . $data . ' ' . trim( $options ) . '/>';
648
+    $output .= '<input type="text" name="' . esc_attr($args['name']) . '" id="' . esc_attr($args['id']) . '" autocomplete="' . esc_attr($args['autocomplete']) . '" value="' . esc_attr($args['value']) . '" placeholder="' . esc_attr($args['placeholder']) . '" class="' . $class . '" ' . $data . ' ' . trim($options) . '/>';
649 649
 
650 650
     $output .= '</span>';
651 651
 
652 652
     return $output;
653 653
 }
654 654
 
655
-function wpinv_html_textarea( $args = array() ) {
655
+function wpinv_html_textarea($args = array()) {
656 656
     $defaults = array(
657 657
         'name'        => 'textarea',
658 658
         'value'       => null,
@@ -663,31 +663,31 @@  discard block
 block discarded – undo
663 663
         'placeholder' => '',
664 664
     );
665 665
 
666
-    $args = wp_parse_args( $args, $defaults );
666
+    $args = wp_parse_args($args, $defaults);
667 667
 
668
-    $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
668
+    $class = implode(' ', array_map('sanitize_html_class', explode(' ', $args['class'])));
669 669
     $disabled = '';
670
-    if ( $args['disabled'] ) {
670
+    if ($args['disabled']) {
671 671
         $disabled = ' disabled="disabled"';
672 672
     }
673 673
 
674
-    $output = '<span id="wpinv-' . wpinv_sanitize_key( $args['name'] ) . '-wrap">';
675
-    $output .= '<label class="wpinv-label" for="' . wpinv_sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
676
-    $output .= '<textarea name="' . esc_attr( $args['name'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" id="' . wpinv_sanitize_key( $args['name'] ) . '" class="' . $class . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>';
674
+    $output = '<span id="wpinv-' . wpinv_sanitize_key($args['name']) . '-wrap">';
675
+    $output .= '<label class="wpinv-label" for="' . wpinv_sanitize_key($args['name']) . '">' . esc_html($args['label']) . '</label>';
676
+    $output .= '<textarea name="' . esc_attr($args['name']) . '" placeholder="' . esc_attr($args['placeholder']) . '" id="' . wpinv_sanitize_key($args['name']) . '" class="' . $class . '"' . $disabled . '>' . esc_attr($args['value']) . '</textarea>';
677 677
 
678
-    if ( ! empty( $args['desc'] ) ) {
679
-        $output .= '<span class="wpinv-description">' . esc_html( $args['desc'] ) . '</span>';
678
+    if (!empty($args['desc'])) {
679
+        $output .= '<span class="wpinv-description">' . esc_html($args['desc']) . '</span>';
680 680
     }
681 681
     $output .= '</span>';
682 682
 
683 683
     return $output;
684 684
 }
685 685
 
686
-function wpinv_html_ajax_user_search( $args = array() ) {
686
+function wpinv_html_ajax_user_search($args = array()) {
687 687
     $defaults = array(
688 688
         'name'         => 'user_id',
689 689
         'value'        => null,
690
-        'placeholder'  => __( 'Enter username', 'invoicing' ),
690
+        'placeholder'  => __('Enter username', 'invoicing'),
691 691
         'label'        => null,
692 692
         'desc'         => null,
693 693
         'class'        => '',
@@ -696,13 +696,13 @@  discard block
 block discarded – undo
696 696
         'data'         => false,
697 697
     );
698 698
 
699
-    $args = wp_parse_args( $args, $defaults );
699
+    $args = wp_parse_args($args, $defaults);
700 700
 
701 701
     $args['class'] = 'wpinv-ajax-user-search ' . $args['class'];
702 702
 
703 703
     $output  = '<span class="wpinv_user_search_wrap">';
704
-        $output .= wpinv_html_text( $args );
705
-        $output .= '<span class="wpinv_user_search_results hidden"><a class="wpinv-ajax-user-cancel" title="' . __( 'Cancel', 'invoicing' ) . '" aria-label="' . __( 'Cancel', 'invoicing' ) . '" href="#">x</a><span></span></span>';
704
+        $output .= wpinv_html_text($args);
705
+        $output .= '<span class="wpinv_user_search_results hidden"><a class="wpinv-ajax-user-cancel" title="' . __('Cancel', 'invoicing') . '" aria-label="' . __('Cancel', 'invoicing') . '" href="#">x</a><span></span></span>';
706 706
     $output .= '</span>';
707 707
 
708 708
     return $output;
@@ -713,44 +713,44 @@  discard block
 block discarded – undo
713 713
  *
714 714
  * @param string $template the template that is currently being used.
715 715
  */
716
-function wpinv_template( $template ) {
716
+function wpinv_template($template) {
717 717
     global $post;
718 718
 
719
-    if ( ! is_admin() && ( is_single() || is_404() ) && ! empty( $post->ID ) && getpaid_is_invoice_post_type( get_post_type( $post->ID ) ) ) {
719
+    if (!is_admin() && (is_single() || is_404()) && !empty($post->ID) && getpaid_is_invoice_post_type(get_post_type($post->ID))) {
720 720
 
721 721
         // If the user can view this invoice, display it.
722
-        if ( wpinv_user_can_view_invoice( $post->ID ) ) {
722
+        if (wpinv_user_can_view_invoice($post->ID)) {
723 723
 
724
-            return wpinv_get_template_part( 'wpinv-invoice-print', false, false );
724
+            return wpinv_get_template_part('wpinv-invoice-print', false, false);
725 725
 
726 726
         // Else display an error message.
727 727
         } else {
728 728
 
729
-            return wpinv_get_template_part( 'wpinv-invalid-access', false, false );
729
+            return wpinv_get_template_part('wpinv-invalid-access', false, false);
730 730
 
731 731
         }
732 732
 }
733 733
 
734 734
     return $template;
735 735
 }
736
-add_filter( 'template_include', 'wpinv_template', 10, 1 );
736
+add_filter('template_include', 'wpinv_template', 10, 1);
737 737
 
738 738
 function wpinv_get_business_address() {
739 739
     $business_address   = wpinv_store_address();
740
-    $business_address   = ! empty( $business_address ) ? wpautop( wp_kses_post( $business_address ) ) : '';
740
+    $business_address   = !empty($business_address) ? wpautop(wp_kses_post($business_address)) : '';
741 741
 
742 742
     $business_address = $business_address ? '<div class="address">' . $business_address . '</div>' : '';
743 743
 
744
-    return apply_filters( 'wpinv_get_business_address', $business_address );
744
+    return apply_filters('wpinv_get_business_address', $business_address);
745 745
 }
746 746
 
747 747
 /**
748 748
  * Displays the company address.
749 749
  */
750 750
 function wpinv_display_from_address() {
751
-    wpinv_get_template( 'invoice/company-address.php' );
751
+    wpinv_get_template('invoice/company-address.php');
752 752
 }
753
-add_action( 'getpaid_invoice_details_left', 'wpinv_display_from_address', 10 );
753
+add_action('getpaid_invoice_details_left', 'wpinv_display_from_address', 10);
754 754
 
755 755
 /**
756 756
  * Generates a watermark text for an invoice.
@@ -758,9 +758,9 @@  discard block
 block discarded – undo
758 758
  * @param WPInv_Invoice $invoice
759 759
  * @return string
760 760
  */
761
-function wpinv_watermark( $invoice ) {
762
-    $watermark = wpinv_get_watermark( $invoice );
763
-    return apply_filters( 'wpinv_get_watermark', $watermark, $invoice );
761
+function wpinv_watermark($invoice) {
762
+    $watermark = wpinv_get_watermark($invoice);
763
+    return apply_filters('wpinv_get_watermark', $watermark, $invoice);
764 764
 }
765 765
 
766 766
 /**
@@ -769,37 +769,37 @@  discard block
 block discarded – undo
769 769
  * @param WPInv_Invoice $invoice
770 770
  * @return string
771 771
  */
772
-function wpinv_get_watermark( $invoice ) {
772
+function wpinv_get_watermark($invoice) {
773 773
     return $invoice->get_status_nicename();
774 774
 }
775 775
 
776 776
 /**
777 777
  * @deprecated
778 778
  */
779
-function wpinv_display_invoice_details( $invoice ) {
780
-    return getpaid_invoice_meta( $invoice );
779
+function wpinv_display_invoice_details($invoice) {
780
+    return getpaid_invoice_meta($invoice);
781 781
 }
782 782
 
783 783
 /**
784 784
  * Displays invoice meta.
785 785
  */
786
-function getpaid_invoice_meta( $invoice ) {
786
+function getpaid_invoice_meta($invoice) {
787 787
 
788
-    $invoice = new WPInv_Invoice( $invoice );
788
+    $invoice = new WPInv_Invoice($invoice);
789 789
 
790 790
     // Ensure that we have an invoice.
791
-    if ( 0 == $invoice->get_id() ) {
791
+    if (0 == $invoice->get_id()) {
792 792
         return;
793 793
     }
794 794
 
795 795
     // Get the invoice meta.
796
-    $meta = getpaid_get_invoice_meta( $invoice );
796
+    $meta = getpaid_get_invoice_meta($invoice);
797 797
 
798 798
     // Display the meta.
799
-    wpinv_get_template( 'invoice/invoice-meta.php', compact( 'invoice', 'meta' ) );
799
+    wpinv_get_template('invoice/invoice-meta.php', compact('invoice', 'meta'));
800 800
 
801 801
 }
802
-add_action( 'getpaid_invoice_details_right', 'getpaid_invoice_meta', 10 );
802
+add_action('getpaid_invoice_details_right', 'getpaid_invoice_meta', 10);
803 803
 
804 804
 /**
805 805
  * Retrieves the address markup to use on Invoices.
@@ -811,29 +811,29 @@  discard block
 block discarded – undo
811 811
  * @param  string $separator How to separate address lines.
812 812
  * @return string
813 813
  */
814
-function wpinv_get_invoice_address_markup( $billing_details, $separator = '<br/>' ) {
814
+function wpinv_get_invoice_address_markup($billing_details, $separator = '<br/>') {
815 815
 
816 816
     // Retrieve the address markup...
817
-    $country = empty( $billing_details['country'] ) ? '' : $billing_details['country'];
818
-    $format = wpinv_get_full_address_format( $country );
817
+    $country = empty($billing_details['country']) ? '' : $billing_details['country'];
818
+    $format = wpinv_get_full_address_format($country);
819 819
 
820 820
     // ... and the replacements.
821
-    $replacements = wpinv_get_invoice_address_replacements( $billing_details );
821
+    $replacements = wpinv_get_invoice_address_replacements($billing_details);
822 822
 
823
-    $formatted_address = str_ireplace( array_keys( $replacements ), $replacements, $format );
823
+    $formatted_address = str_ireplace(array_keys($replacements), $replacements, $format);
824 824
 
825 825
 	// Remove unavailable tags.
826
-    $formatted_address = preg_replace( '/\{\{\w+\}\}/', '', $formatted_address );
826
+    $formatted_address = preg_replace('/\{\{\w+\}\}/', '', $formatted_address);
827 827
 
828 828
     // Clean up white space.
829
-	$formatted_address = preg_replace( '/  +/', ' ', trim( $formatted_address ) );
830
-    $formatted_address = preg_replace( '/\n\n+/', "\n", $formatted_address );
829
+	$formatted_address = preg_replace('/  +/', ' ', trim($formatted_address));
830
+    $formatted_address = preg_replace('/\n\n+/', "\n", $formatted_address);
831 831
 
832 832
     // Break newlines apart and remove empty lines/trim commas and white space.
833
-	$formatted_address = array_filter( array_map( 'wpinv_trim_formatted_address_line', explode( "\n", $formatted_address ) ) );
833
+	$formatted_address = array_filter(array_map('wpinv_trim_formatted_address_line', explode("\n", $formatted_address)));
834 834
 
835 835
     // Add html breaks.
836
-	$formatted_address = implode( $separator, $formatted_address );
836
+	$formatted_address = implode($separator, $formatted_address);
837 837
 
838 838
 	// We're done!
839 839
 	return $formatted_address;
@@ -845,119 +845,119 @@  discard block
 block discarded – undo
845 845
  *
846 846
  * @param WPInv_Invoice $invoice
847 847
  */
848
-function wpinv_display_to_address( $invoice = 0 ) {
849
-    if ( ! empty( $invoice ) ) {
850
-        wpinv_get_template( 'invoice/billing-address.php', compact( 'invoice' ) );
848
+function wpinv_display_to_address($invoice = 0) {
849
+    if (!empty($invoice)) {
850
+        wpinv_get_template('invoice/billing-address.php', compact('invoice'));
851 851
     }
852 852
 }
853
-add_action( 'getpaid_invoice_details_left', 'wpinv_display_to_address', 40 );
853
+add_action('getpaid_invoice_details_left', 'wpinv_display_to_address', 40);
854 854
 
855 855
 
856 856
 /**
857 857
  * Displays invoice line items.
858 858
  */
859
-function wpinv_display_line_items( $invoice_id = 0 ) {
859
+function wpinv_display_line_items($invoice_id = 0) {
860 860
 
861 861
     // Prepare the invoice.
862
-    $invoice = new WPInv_Invoice( $invoice_id );
862
+    $invoice = new WPInv_Invoice($invoice_id);
863 863
 
864 864
     // Abort if there is no invoice.
865
-    if ( 0 == $invoice->get_id() ) {
865
+    if (0 == $invoice->get_id()) {
866 866
         return;
867 867
     }
868 868
 
869 869
     // Line item columns.
870
-    $columns = getpaid_invoice_item_columns( $invoice );
871
-    $columns = apply_filters( 'getpaid_invoice_line_items_table_columns', $columns, $invoice );
870
+    $columns = getpaid_invoice_item_columns($invoice);
871
+    $columns = apply_filters('getpaid_invoice_line_items_table_columns', $columns, $invoice);
872 872
 
873
-    wpinv_get_template( 'invoice/line-items.php', compact( 'invoice', 'columns' ) );
873
+    wpinv_get_template('invoice/line-items.php', compact('invoice', 'columns'));
874 874
 }
875
-add_action( 'getpaid_invoice_line_items', 'wpinv_display_line_items', 10 );
875
+add_action('getpaid_invoice_line_items', 'wpinv_display_line_items', 10);
876 876
 
877 877
 /**
878 878
  * Displays invoice subscriptions.
879 879
  *
880 880
  * @param WPInv_Invoice $invoice
881 881
  */
882
-function getpaid_display_invoice_subscriptions( $invoice ) {
882
+function getpaid_display_invoice_subscriptions($invoice) {
883 883
 
884 884
     // Subscriptions.
885
-	$subscriptions = getpaid_get_invoice_subscriptions( $invoice );
885
+	$subscriptions = getpaid_get_invoice_subscriptions($invoice);
886 886
 
887
-    if ( empty( $subscriptions ) || ! $invoice->is_recurring() ) {
887
+    if (empty($subscriptions) || !$invoice->is_recurring()) {
888 888
         return;
889 889
     }
890 890
 
891
-    $main_subscription = getpaid_get_invoice_subscription( $invoice );
891
+    $main_subscription = getpaid_get_invoice_subscription($invoice);
892 892
 
893 893
     // Display related subscriptions.
894
-    if ( is_array( $subscriptions ) ) {
895
-        printf( '<h2 class="mt-5 mb-1 h4">%s</h2>', esc_html__( 'Related Subscriptions', 'invoicing' ) );
896
-        getpaid_admin_subscription_related_subscriptions_metabox( $main_subscription, false );
894
+    if (is_array($subscriptions)) {
895
+        printf('<h2 class="mt-5 mb-1 h4">%s</h2>', esc_html__('Related Subscriptions', 'invoicing'));
896
+        getpaid_admin_subscription_related_subscriptions_metabox($main_subscription, false);
897 897
     }
898 898
 
899
-    if ( $main_subscription->get_total_payments() > 1 ) {
900
-        printf( '<h2 class="mt-5 mb-1 h4">%s</h2>', esc_html__( 'Related Invoices', 'invoicing' ) );
901
-        getpaid_admin_subscription_invoice_details_metabox( $main_subscription, false );
899
+    if ($main_subscription->get_total_payments() > 1) {
900
+        printf('<h2 class="mt-5 mb-1 h4">%s</h2>', esc_html__('Related Invoices', 'invoicing'));
901
+        getpaid_admin_subscription_invoice_details_metabox($main_subscription, false);
902 902
     }
903 903
 
904 904
 }
905
-add_action( 'getpaid_invoice_line_items', 'getpaid_display_invoice_subscriptions', 55 );
906
-add_action( 'wpinv_receipt_end', 'getpaid_display_invoice_subscriptions', 11 );
905
+add_action('getpaid_invoice_line_items', 'getpaid_display_invoice_subscriptions', 55);
906
+add_action('wpinv_receipt_end', 'getpaid_display_invoice_subscriptions', 11);
907 907
 
908 908
 /**
909 909
  * Displays invoice notices on invoices.
910 910
  */
911 911
 function wpinv_display_invoice_notice() {
912 912
 
913
-    $label  = wpinv_get_option( 'vat_invoice_notice_label' );
914
-    $notice = wpinv_get_option( 'vat_invoice_notice' );
913
+    $label  = wpinv_get_option('vat_invoice_notice_label');
914
+    $notice = wpinv_get_option('vat_invoice_notice');
915 915
 
916
-    if ( empty( $label ) && empty( $notice ) ) {
916
+    if (empty($label) && empty($notice)) {
917 917
         return;
918 918
     }
919 919
 
920 920
     echo '<div class="mt-4 mb-4 wpinv-vat-notice">';
921 921
 
922
-    if ( ! empty( $label ) ) {
923
-        $label = esc_html( $label );
922
+    if (!empty($label)) {
923
+        $label = esc_html($label);
924 924
         echo "<h5>$label</h5>";
925 925
     }
926 926
 
927
-    if ( ! empty( $notice ) ) {
928
-        echo '<small class="form-text text-muted">' . wp_kses_post( wpautop( wptexturize( $notice ) ) ) . '</small>';
927
+    if (!empty($notice)) {
928
+        echo '<small class="form-text text-muted">' . wp_kses_post(wpautop(wptexturize($notice))) . '</small>';
929 929
     }
930 930
 
931 931
     echo '</div>';
932 932
 }
933
-add_action( 'getpaid_invoice_line_items', 'wpinv_display_invoice_notice', 100 );
933
+add_action('getpaid_invoice_line_items', 'wpinv_display_invoice_notice', 100);
934 934
 
935 935
 /**
936 936
  * @param WPInv_Invoice $invoice
937 937
  */
938
-function wpinv_display_invoice_notes( $invoice ) {
938
+function wpinv_display_invoice_notes($invoice) {
939 939
 
940 940
     // Retrieve the notes.
941
-    $notes = wpinv_get_invoice_notes( $invoice->get_id(), 'customer' );
941
+    $notes = wpinv_get_invoice_notes($invoice->get_id(), 'customer');
942 942
 
943 943
     // Abort if we have non.
944
-    if ( empty( $notes ) ) {
944
+    if (empty($notes)) {
945 945
         return;
946 946
     }
947 947
 
948 948
     // Echo the note.
949 949
     echo '<div class="getpaid-invoice-notes-wrapper position-relative my-4">';
950
-    echo '<h2 class="getpaid-invoice-notes-title mb-1 p-0 h4">' . __( 'Notes', 'invoicing' ) . '</h2>';
950
+    echo '<h2 class="getpaid-invoice-notes-title mb-1 p-0 h4">' . __('Notes', 'invoicing') . '</h2>';
951 951
     echo '<ul class="getpaid-invoice-notes text-break overflow-auto list-unstyled p-0 m-0">';
952 952
 
953
-    foreach ( $notes as $note ) {
954
-        wpinv_get_invoice_note_line_item( $note );
953
+    foreach ($notes as $note) {
954
+        wpinv_get_invoice_note_line_item($note);
955 955
     }
956 956
 
957 957
     echo '</ul>';
958 958
     echo '</div>';
959 959
 }
960
-add_action( 'getpaid_invoice_line_items', 'wpinv_display_invoice_notes', 60 );
960
+add_action('getpaid_invoice_line_items', 'wpinv_display_invoice_notes', 60);
961 961
 
962 962
 /**
963 963
  * Loads scripts on our invoice templates.
@@ -965,32 +965,32 @@  discard block
 block discarded – undo
965 965
 function wpinv_display_style() {
966 966
 
967 967
     // Make sure that all scripts have been loaded.
968
-    if ( ! did_action( 'wp_enqueue_scripts' ) ) {
969
-        do_action( 'wp_enqueue_scripts' );
968
+    if (!did_action('wp_enqueue_scripts')) {
969
+        do_action('wp_enqueue_scripts');
970 970
     }
971 971
 
972 972
     // Register the invoices style.
973
-    wp_register_style( 'wpinv-single-style', WPINV_PLUGIN_URL . 'assets/css/invoice.css', array(), filemtime( WPINV_PLUGIN_DIR . 'assets/css/invoice.css' ) );
973
+    wp_register_style('wpinv-single-style', WPINV_PLUGIN_URL . 'assets/css/invoice.css', array(), filemtime(WPINV_PLUGIN_DIR . 'assets/css/invoice.css'));
974 974
 
975 975
     // Load required styles
976
-    wp_print_styles( 'wpinv-single-style' );
977
-    wp_print_styles( 'ayecode-ui' );
976
+    wp_print_styles('wpinv-single-style');
977
+    wp_print_styles('ayecode-ui');
978 978
 
979 979
     // Maybe load custom css.
980
-    $custom_css = wpinv_get_option( 'template_custom_css' );
980
+    $custom_css = wpinv_get_option('template_custom_css');
981 981
 
982
-    if ( isset( $custom_css ) && ! empty( $custom_css ) ) {
983
-        $custom_css     = wp_kses( $custom_css, array( '\'', '\"' ) );
984
-        $custom_css     = str_replace( '&gt;', '>', $custom_css );
982
+    if (isset($custom_css) && !empty($custom_css)) {
983
+        $custom_css     = wp_kses($custom_css, array('\'', '\"'));
984
+        $custom_css     = str_replace('&gt;', '>', $custom_css);
985 985
         echo '<style type="text/css">';
986
-        echo wp_kses_post( $custom_css );
986
+        echo wp_kses_post($custom_css);
987 987
         echo '</style>';
988 988
     }
989 989
 
990 990
     wp_site_icon();
991 991
 }
992
-add_action( 'wpinv_invoice_print_head', 'wpinv_display_style' );
993
-add_action( 'wpinv_invalid_invoice_head', 'wpinv_display_style' );
992
+add_action('wpinv_invoice_print_head', 'wpinv_display_style');
993
+add_action('wpinv_invalid_invoice_head', 'wpinv_display_style');
994 994
 
995 995
 
996 996
 /**
@@ -1002,41 +1002,41 @@  discard block
 block discarded – undo
1002 1002
     // Retrieve the current invoice.
1003 1003
     $invoice_id = getpaid_get_current_invoice_id();
1004 1004
 
1005
-    if ( empty( $invoice_id ) ) {
1005
+    if (empty($invoice_id)) {
1006 1006
 
1007 1007
         return aui()->alert(
1008 1008
             array(
1009 1009
                 'type'    => 'warning',
1010
-                'content' => __( 'Invalid invoice', 'invoicing' ),
1010
+                'content' => __('Invalid invoice', 'invoicing'),
1011 1011
             )
1012 1012
         );
1013 1013
 
1014 1014
     }
1015 1015
 
1016 1016
     // Can the user view this invoice?
1017
-    if ( ! wpinv_user_can_view_invoice( $invoice_id ) ) {
1017
+    if (!wpinv_user_can_view_invoice($invoice_id)) {
1018 1018
 
1019 1019
         return aui()->alert(
1020 1020
             array(
1021 1021
                 'type'    => 'warning',
1022
-                'content' => __( 'You are not allowed to view this invoice', 'invoicing' ),
1022
+                'content' => __('You are not allowed to view this invoice', 'invoicing'),
1023 1023
             )
1024 1024
         );
1025 1025
 
1026 1026
     }
1027 1027
 
1028 1028
     // Ensure that it is not yet paid for.
1029
-    $invoice = new WPInv_Invoice( $invoice_id );
1029
+    $invoice = new WPInv_Invoice($invoice_id);
1030 1030
 
1031 1031
     // Maybe mark it as viewed.
1032
-    getpaid_maybe_mark_invoice_as_viewed( $invoice );
1032
+    getpaid_maybe_mark_invoice_as_viewed($invoice);
1033 1033
 
1034
-    if ( $invoice->is_paid() ) {
1034
+    if ($invoice->is_paid()) {
1035 1035
 
1036 1036
         return aui()->alert(
1037 1037
             array(
1038 1038
                 'type'    => 'success',
1039
-                'content' => __( 'This invoice has already been paid.', 'invoicing' ),
1039
+                'content' => __('This invoice has already been paid.', 'invoicing'),
1040 1040
             )
1041 1041
         );
1042 1042
 
@@ -1046,15 +1046,15 @@  discard block
 block discarded – undo
1046 1046
     $wpi_checkout_id = $invoice_id;
1047 1047
 
1048 1048
     // Retrieve appropriate payment form.
1049
-    $payment_form = new GetPaid_Payment_Form( $invoice->get_meta( 'force_payment_form' ) );
1050
-    $payment_form = $payment_form->exists() ? $payment_form : new GetPaid_Payment_Form( wpinv_get_default_payment_form() );
1049
+    $payment_form = new GetPaid_Payment_Form($invoice->get_meta('force_payment_form'));
1050
+    $payment_form = $payment_form->exists() ? $payment_form : new GetPaid_Payment_Form(wpinv_get_default_payment_form());
1051 1051
 
1052
-    if ( ! $payment_form->exists() ) {
1052
+    if (!$payment_form->exists()) {
1053 1053
 
1054 1054
         return aui()->alert(
1055 1055
             array(
1056 1056
                 'type'    => 'warning',
1057
-                'content' => __( 'Error loading the payment form', 'invoicing' ),
1057
+                'content' => __('Error loading the payment form', 'invoicing'),
1058 1058
             )
1059 1059
         );
1060 1060
 
@@ -1063,29 +1063,29 @@  discard block
 block discarded – undo
1063 1063
     // Set the invoice.
1064 1064
     $payment_form->invoice = $invoice;
1065 1065
 
1066
-    if ( ! $payment_form->is_default() ) {
1066
+    if (!$payment_form->is_default()) {
1067 1067
 
1068 1068
         $items    = array();
1069 1069
         $item_ids = array();
1070 1070
 
1071
-        foreach ( $invoice->get_items() as $item ) {
1072
-            if ( ! in_array( $item->get_id(), $item_ids ) ) {
1071
+        foreach ($invoice->get_items() as $item) {
1072
+            if (!in_array($item->get_id(), $item_ids)) {
1073 1073
                 $item_ids[] = $item->get_id();
1074 1074
                 $items[]    = $item;
1075 1075
             }
1076 1076
         }
1077 1077
 
1078
-        foreach ( $payment_form->get_items() as $item ) {
1079
-            if ( ! in_array( $item->get_id(), $item_ids ) ) {
1078
+        foreach ($payment_form->get_items() as $item) {
1079
+            if (!in_array($item->get_id(), $item_ids)) {
1080 1080
                 $item_ids[] = $item->get_id();
1081 1081
                 $items[]    = $item;
1082 1082
             }
1083 1083
         }
1084 1084
 
1085
-        $payment_form->set_items( $items );
1085
+        $payment_form->set_items($items);
1086 1086
 
1087 1087
     } else {
1088
-        $payment_form->set_items( $invoice->get_items() );
1088
+        $payment_form->set_items($invoice->get_items());
1089 1089
     }
1090 1090
 
1091 1091
     // Generate the html.
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 }
1095 1095
 
1096 1096
 function wpinv_empty_cart_message() {
1097
-	return apply_filters( 'wpinv_empty_cart_message', '<span class="wpinv_empty_cart">' . __( 'Your cart is empty.', 'invoicing' ) . '</span>' );
1097
+	return apply_filters('wpinv_empty_cart_message', '<span class="wpinv_empty_cart">' . __('Your cart is empty.', 'invoicing') . '</span>');
1098 1098
 }
1099 1099
 
1100 1100
 /**
@@ -1111,76 +1111,76 @@  discard block
 block discarded – undo
1111 1111
         )
1112 1112
     );
1113 1113
 }
1114
-add_action( 'wpinv_cart_empty', 'wpinv_empty_checkout_cart' );
1114
+add_action('wpinv_cart_empty', 'wpinv_empty_checkout_cart');
1115 1115
 
1116 1116
 /**
1117 1117
  * Filters the receipt page.
1118 1118
  */
1119
-function wpinv_filter_success_page_content( $content ) {
1119
+function wpinv_filter_success_page_content($content) {
1120 1120
 
1121 1121
     // Maybe abort early.
1122
-    if ( is_admin() || ! is_singular() || ! in_the_loop() || ! is_main_query() || is_preview() ) {
1122
+    if (is_admin() || !is_singular() || !in_the_loop() || !is_main_query() || is_preview()) {
1123 1123
         return $content;
1124 1124
     }
1125 1125
 
1126 1126
     // Ensure this is our page.
1127
-    if ( isset( $_GET['payment-confirm'] ) && wpinv_is_success_page() ) {
1127
+    if (isset($_GET['payment-confirm']) && wpinv_is_success_page()) {
1128 1128
 
1129
-        $gateway = sanitize_text_field( $_GET['payment-confirm'] );
1130
-        return apply_filters( "wpinv_payment_confirm_$gateway", $content );
1129
+        $gateway = sanitize_text_field($_GET['payment-confirm']);
1130
+        return apply_filters("wpinv_payment_confirm_$gateway", $content);
1131 1131
 
1132 1132
     }
1133 1133
 
1134 1134
     return $content;
1135 1135
 }
1136
-add_filter( 'the_content', 'wpinv_filter_success_page_content', 99999 );
1136
+add_filter('the_content', 'wpinv_filter_success_page_content', 99999);
1137 1137
 
1138
-function wpinv_invoice_link( $invoice_id ) {
1139
-    $invoice = wpinv_get_invoice( $invoice_id );
1138
+function wpinv_invoice_link($invoice_id) {
1139
+    $invoice = wpinv_get_invoice($invoice_id);
1140 1140
 
1141
-    if ( empty( $invoice ) ) {
1141
+    if (empty($invoice)) {
1142 1142
         return null;
1143 1143
     }
1144 1144
 
1145
-    $invoice_link = '<a href="' . esc_url( $invoice->get_view_url() ) . '">' . $invoice->get_number() . '</a>';
1145
+    $invoice_link = '<a href="' . esc_url($invoice->get_view_url()) . '">' . $invoice->get_number() . '</a>';
1146 1146
 
1147
-    return apply_filters( 'wpinv_get_invoice_link', $invoice_link, $invoice );
1147
+    return apply_filters('wpinv_get_invoice_link', $invoice_link, $invoice);
1148 1148
 }
1149 1149
 
1150
-function wpinv_get_invoice_note_line_item( $note, $echo = true ) {
1151
-    if ( empty( $note ) ) {
1150
+function wpinv_get_invoice_note_line_item($note, $echo = true) {
1151
+    if (empty($note)) {
1152 1152
         return null;
1153 1153
     }
1154 1154
 
1155
-    if ( is_int( $note ) ) {
1156
-        $note = get_comment( $note );
1155
+    if (is_int($note)) {
1156
+        $note = get_comment($note);
1157 1157
     }
1158 1158
 
1159
-    if ( ! ( is_object( $note ) && is_a( $note, 'WP_Comment' ) ) ) {
1159
+    if (!(is_object($note) && is_a($note, 'WP_Comment'))) {
1160 1160
         return null;
1161 1161
     }
1162 1162
 
1163
-    $note_classes   = array( 'note' );
1164
-    $note_classes[] = get_comment_meta( $note->comment_ID, '_wpi_customer_note', true ) ? 'customer-note' : '';
1163
+    $note_classes   = array('note');
1164
+    $note_classes[] = get_comment_meta($note->comment_ID, '_wpi_customer_note', true) ? 'customer-note' : '';
1165 1165
     $note_classes[] = $note->comment_author === 'System' ? 'system-note' : '';
1166
-    $note_classes   = apply_filters( 'wpinv_invoice_note_class', array_filter( $note_classes ), $note );
1167
-    $note_classes   = ! empty( $note_classes ) ? implode( ' ', $note_classes ) : '';
1166
+    $note_classes   = apply_filters('wpinv_invoice_note_class', array_filter($note_classes), $note);
1167
+    $note_classes   = !empty($note_classes) ? implode(' ', $note_classes) : '';
1168 1168
 
1169 1169
     ob_start();
1170 1170
     ?>
1171
-    <li rel="<?php echo absint( $note->comment_ID ); ?>" class="<?php echo esc_attr( $note_classes ); ?> mb-2">
1171
+    <li rel="<?php echo absint($note->comment_ID); ?>" class="<?php echo esc_attr($note_classes); ?> mb-2">
1172 1172
         <div class="note_content">
1173 1173
 
1174
-            <?php echo wptexturize( wp_kses_post( $note->comment_content ) ); ?>
1174
+            <?php echo wptexturize(wp_kses_post($note->comment_content)); ?>
1175 1175
 
1176
-            <?php if ( ! is_admin() ) : ?>
1176
+            <?php if (!is_admin()) : ?>
1177 1177
                 <em class="small form-text text-muted mt-0">
1178 1178
                     <?php
1179 1179
                         printf(
1180
-                            __( '%1$s - %2$s at %3$s', 'invoicing' ),
1180
+                            __('%1$s - %2$s at %3$s', 'invoicing'),
1181 1181
                             $note->comment_author,
1182
-                            getpaid_format_date_value( $note->comment_date ),
1183
-                            date_i18n( get_option( 'time_format' ), strtotime( $note->comment_date ) )
1182
+                            getpaid_format_date_value($note->comment_date),
1183
+                            date_i18n(get_option('time_format'), strtotime($note->comment_date))
1184 1184
                         );
1185 1185
                     ?>
1186 1186
                 </em>
@@ -1188,21 +1188,21 @@  discard block
 block discarded – undo
1188 1188
 
1189 1189
         </div>
1190 1190
 
1191
-        <?php if ( is_admin() ) : ?>
1191
+        <?php if (is_admin()) : ?>
1192 1192
 
1193 1193
             <p class="meta px-4 py-2">
1194
-                <abbr class="exact-date" title="<?php echo esc_attr( $note->comment_date ); ?>">
1194
+                <abbr class="exact-date" title="<?php echo esc_attr($note->comment_date); ?>">
1195 1195
                     <?php
1196 1196
                         printf(
1197
-                            __( '%1$s - %2$s at %3$s', 'invoicing' ),
1197
+                            __('%1$s - %2$s at %3$s', 'invoicing'),
1198 1198
                             $note->comment_author,
1199
-                            getpaid_format_date_value( $note->comment_date ),
1200
-                            date_i18n( get_option( 'time_format' ), strtotime( $note->comment_date ) )
1199
+                            getpaid_format_date_value($note->comment_date),
1200
+                            date_i18n(get_option('time_format'), strtotime($note->comment_date))
1201 1201
                         );
1202 1202
                     ?>
1203 1203
                 </abbr>&nbsp;&nbsp;
1204
-                <?php if ( $note->comment_author !== 'System' && wpinv_current_user_can_manage_invoicing() ) { ?>
1205
-                    <a href="#" class="delete_note"><?php esc_html_e( 'Delete note', 'invoicing' ); ?></a>
1204
+                <?php if ($note->comment_author !== 'System' && wpinv_current_user_can_manage_invoicing()) { ?>
1205
+                    <a href="#" class="delete_note"><?php esc_html_e('Delete note', 'invoicing'); ?></a>
1206 1206
                 <?php } ?>
1207 1207
             </p>
1208 1208
 
@@ -1211,10 +1211,10 @@  discard block
 block discarded – undo
1211 1211
     </li>
1212 1212
     <?php
1213 1213
     $note_content = ob_get_clean();
1214
-    $note_content = apply_filters( 'wpinv_get_invoice_note_line_item', $note_content, $note, $echo );
1214
+    $note_content = apply_filters('wpinv_get_invoice_note_line_item', $note_content, $note, $echo);
1215 1215
 
1216
-    if ( $echo ) {
1217
-        echo wp_kses_post( $note_content );
1216
+    if ($echo) {
1217
+        echo wp_kses_post($note_content);
1218 1218
     } else {
1219 1219
         return $note_content;
1220 1220
     }
@@ -1227,43 +1227,43 @@  discard block
 block discarded – undo
1227 1227
  * @return string
1228 1228
  */
1229 1229
 function wpinv_get_policy_text() {
1230
-    $privacy_page_id = get_option( 'wp_page_for_privacy_policy', 0 );
1230
+    $privacy_page_id = get_option('wp_page_for_privacy_policy', 0);
1231 1231
 
1232
-    $text = wpinv_get_option( 'invoicing_privacy_checkout_message', sprintf( __( 'Your personal data will be used to process your invoice, payment and for other purposes described in our %s.', 'invoicing' ), '[wpinv_privacy_policy]' ) );
1232
+    $text = wpinv_get_option('invoicing_privacy_checkout_message', sprintf(__('Your personal data will be used to process your invoice, payment and for other purposes described in our %s.', 'invoicing'), '[wpinv_privacy_policy]'));
1233 1233
 
1234
-    if ( ! $privacy_page_id ) {
1235
-        $privacy_page_id = wpinv_get_option( 'privacy_page', 0 );
1234
+    if (!$privacy_page_id) {
1235
+        $privacy_page_id = wpinv_get_option('privacy_page', 0);
1236 1236
     }
1237 1237
 
1238
-    $privacy_link    = $privacy_page_id ? '<a href="' . esc_url( get_permalink( $privacy_page_id ) ) . '" class="wpinv-privacy-policy-link" target="_blank">' . __( 'privacy policy', 'invoicing' ) . '</a>' : __( 'privacy policy', 'invoicing' );
1238
+    $privacy_link = $privacy_page_id ? '<a href="' . esc_url(get_permalink($privacy_page_id)) . '" class="wpinv-privacy-policy-link" target="_blank">' . __('privacy policy', 'invoicing') . '</a>' : __('privacy policy', 'invoicing');
1239 1239
 
1240 1240
     $find_replace = array(
1241 1241
         '[wpinv_privacy_policy]' => $privacy_link,
1242 1242
     );
1243 1243
 
1244
-    $privacy_text = str_replace( array_keys( $find_replace ), array_values( $find_replace ), $text );
1244
+    $privacy_text = str_replace(array_keys($find_replace), array_values($find_replace), $text);
1245 1245
 
1246
-    return wp_kses_post( wpautop( $privacy_text ) );
1246
+    return wp_kses_post(wpautop($privacy_text));
1247 1247
 }
1248 1248
 
1249 1249
 function wpinv_oxygen_fix_conflict() {
1250 1250
     global $ct_ignore_post_types;
1251 1251
 
1252
-    if ( ! is_array( $ct_ignore_post_types ) ) {
1252
+    if (!is_array($ct_ignore_post_types)) {
1253 1253
         $ct_ignore_post_types = array();
1254 1254
     }
1255 1255
 
1256
-    $post_types = array( 'wpi_discount', 'wpi_invoice', 'wpi_item', 'wpi_payment_form' );
1256
+    $post_types = array('wpi_discount', 'wpi_invoice', 'wpi_item', 'wpi_payment_form');
1257 1257
 
1258
-    foreach ( $post_types as $post_type ) {
1258
+    foreach ($post_types as $post_type) {
1259 1259
         $ct_ignore_post_types[] = $post_type;
1260 1260
 
1261 1261
         // Ignore post type
1262
-        add_filter( 'pre_option_oxygen_vsb_ignore_post_type_' . $post_type, '__return_true', 999 );
1262
+        add_filter('pre_option_oxygen_vsb_ignore_post_type_' . $post_type, '__return_true', 999);
1263 1263
     }
1264 1264
 
1265
-    remove_filter( 'template_include', 'wpinv_template', 10, 1 );
1266
-    add_filter( 'template_include', 'wpinv_template', 999, 1 );
1265
+    remove_filter('template_include', 'wpinv_template', 10, 1);
1266
+    add_filter('template_include', 'wpinv_template', 999, 1);
1267 1267
 }
1268 1268
 
1269 1269
 /**
@@ -1271,10 +1271,10 @@  discard block
 block discarded – undo
1271 1271
  *
1272 1272
  * @param GetPaid_Payment_Form $form
1273 1273
  */
1274
-function getpaid_display_payment_form( $form ) {
1274
+function getpaid_display_payment_form($form) {
1275 1275
 
1276
-    if ( is_numeric( $form ) ) {
1277
-        $form = new GetPaid_Payment_Form( $form );
1276
+    if (is_numeric($form)) {
1277
+        $form = new GetPaid_Payment_Form($form);
1278 1278
     }
1279 1279
 
1280 1280
     $form->display();
@@ -1284,58 +1284,58 @@  discard block
 block discarded – undo
1284 1284
 /**
1285 1285
  * Helper function to display a item payment form on the frontend.
1286 1286
  */
1287
-function getpaid_display_item_payment_form( $items ) {
1287
+function getpaid_display_item_payment_form($items) {
1288 1288
 
1289
-    $form = new GetPaid_Payment_Form( wpinv_get_default_payment_form() );
1290
-    $form->set_items( $items );
1289
+    $form = new GetPaid_Payment_Form(wpinv_get_default_payment_form());
1290
+    $form->set_items($items);
1291 1291
 
1292
-    if ( 0 == count( $form->get_items() ) ) {
1292
+    if (0 == count($form->get_items())) {
1293 1293
         echo aui()->alert(
1294 1294
 			array(
1295 1295
 				'type'    => 'warning',
1296
-				'content' => __( 'No published items found', 'invoicing' ),
1296
+				'content' => __('No published items found', 'invoicing'),
1297 1297
 			)
1298 1298
         );
1299 1299
         return;
1300 1300
     }
1301 1301
 
1302
-    $extra_items     = esc_attr( getpaid_convert_items_to_string( $items ) );
1303
-    $extra_items_key = md5( NONCE_KEY . AUTH_KEY . $extra_items );
1302
+    $extra_items     = esc_attr(getpaid_convert_items_to_string($items));
1303
+    $extra_items_key = md5(NONCE_KEY . AUTH_KEY . $extra_items);
1304 1304
     $extra_items     = "<input type='hidden' name='getpaid-form-items' value='$extra_items' />";
1305 1305
     $extra_items    .= "<input type='hidden' name='getpaid-form-items-key' value='$extra_items_key' />";
1306 1306
 
1307
-    $form->display( $extra_items );
1307
+    $form->display($extra_items);
1308 1308
 }
1309 1309
 
1310 1310
 /**
1311 1311
  * Helper function to display an invoice payment form on the frontend.
1312 1312
  */
1313
-function getpaid_display_invoice_payment_form( $invoice_id ) {
1313
+function getpaid_display_invoice_payment_form($invoice_id) {
1314 1314
 
1315
-    $invoice = wpinv_get_invoice( $invoice_id );
1315
+    $invoice = wpinv_get_invoice($invoice_id);
1316 1316
 
1317
-    if ( empty( $invoice ) ) {
1317
+    if (empty($invoice)) {
1318 1318
 		echo aui()->alert(
1319 1319
 			array(
1320 1320
 				'type'    => 'warning',
1321
-				'content' => __( 'Invoice not found', 'invoicing' ),
1321
+				'content' => __('Invoice not found', 'invoicing'),
1322 1322
 			)
1323 1323
         );
1324 1324
         return;
1325 1325
     }
1326 1326
 
1327
-    if ( $invoice->is_paid() ) {
1327
+    if ($invoice->is_paid()) {
1328 1328
 		echo aui()->alert(
1329 1329
 			array(
1330 1330
 				'type'    => 'warning',
1331
-				'content' => __( 'Invoice has already been paid', 'invoicing' ),
1331
+				'content' => __('Invoice has already been paid', 'invoicing'),
1332 1332
 			)
1333 1333
         );
1334 1334
         return;
1335 1335
     }
1336 1336
 
1337
-    $form = new GetPaid_Payment_Form( wpinv_get_default_payment_form() );
1338
-    $form->set_items( $invoice->get_items() );
1337
+    $form = new GetPaid_Payment_Form(wpinv_get_default_payment_form());
1338
+    $form->set_items($invoice->get_items());
1339 1339
 
1340 1340
     $form->display();
1341 1341
 }
@@ -1343,23 +1343,23 @@  discard block
 block discarded – undo
1343 1343
 /**
1344 1344
  * Helper function to convert item string to array.
1345 1345
  */
1346
-function getpaid_convert_items_to_array( $items ) {
1347
-    $items    = array_filter( array_map( 'trim', explode( ',', $items ) ) );
1346
+function getpaid_convert_items_to_array($items) {
1347
+    $items    = array_filter(array_map('trim', explode(',', $items)));
1348 1348
     $prepared = array();
1349 1349
 
1350
-    foreach ( $items as $item ) {
1351
-        $data = array_map( 'trim', explode( '|', $item ) );
1350
+    foreach ($items as $item) {
1351
+        $data = array_map('trim', explode('|', $item));
1352 1352
 
1353
-        if ( empty( $data[0] ) || ! is_numeric( $data[0] ) ) {
1353
+        if (empty($data[0]) || !is_numeric($data[0])) {
1354 1354
             continue;
1355 1355
         }
1356 1356
 
1357 1357
         $quantity = 1;
1358
-        if ( isset( $data[1] ) && is_numeric( $data[1] ) ) {
1358
+        if (isset($data[1]) && is_numeric($data[1])) {
1359 1359
             $quantity = (float) $data[1];
1360 1360
         }
1361 1361
 
1362
-        $prepared[ $data[0] ] = $quantity;
1362
+        $prepared[$data[0]] = $quantity;
1363 1363
 
1364 1364
     }
1365 1365
 
@@ -1369,13 +1369,13 @@  discard block
 block discarded – undo
1369 1369
 /**
1370 1370
  * Helper function to convert item array to string.
1371 1371
  */
1372
-function getpaid_convert_items_to_string( $items ) {
1372
+function getpaid_convert_items_to_string($items) {
1373 1373
     $prepared = array();
1374 1374
 
1375
-    foreach ( $items as $item => $quantity ) {
1375
+    foreach ($items as $item => $quantity) {
1376 1376
         $prepared[] = "$item|$quantity";
1377 1377
     }
1378
-    return implode( ',', $prepared );
1378
+    return implode(',', $prepared);
1379 1379
 }
1380 1380
 
1381 1381
 /**
@@ -1383,21 +1383,21 @@  discard block
 block discarded – undo
1383 1383
  *
1384 1384
  * Provide a label and one of $form, $items or $invoice.
1385 1385
  */
1386
-function getpaid_get_payment_button( $label, $form = null, $items = null, $invoice = null ) {
1387
-    $label = sanitize_text_field( $label );
1386
+function getpaid_get_payment_button($label, $form = null, $items = null, $invoice = null) {
1387
+    $label = sanitize_text_field($label);
1388 1388
 
1389
-    if ( ! empty( $form ) ) {
1390
-        $form  = esc_attr( $form );
1389
+    if (!empty($form)) {
1390
+        $form = esc_attr($form);
1391 1391
         return "<button class='btn btn-primary getpaid-payment-button' type='button' data-form='$form'>$label</button>";
1392 1392
     }
1393 1393
 
1394
-	if ( ! empty( $items ) ) {
1395
-        $items  = esc_attr( $items );
1394
+	if (!empty($items)) {
1395
+        $items = esc_attr($items);
1396 1396
         return "<button class='btn btn-primary getpaid-payment-button' type='button' data-item='$items'>$label</button>";
1397 1397
     }
1398 1398
 
1399
-    if ( ! empty( $invoice ) ) {
1400
-        $invoice  = esc_attr( $invoice );
1399
+    if (!empty($invoice)) {
1400
+        $invoice = esc_attr($invoice);
1401 1401
         return "<button class='btn btn-primary getpaid-payment-button' type='button' data-invoice='$invoice'>$label</button>";
1402 1402
     }
1403 1403
 
@@ -1408,18 +1408,18 @@  discard block
 block discarded – undo
1408 1408
  *
1409 1409
  * @param WPInv_Invoice $invoice
1410 1410
  */
1411
-function getpaid_the_invoice_description( $invoice ) {
1411
+function getpaid_the_invoice_description($invoice) {
1412 1412
     $description = $invoice->get_description();
1413 1413
 
1414
-    if ( empty( $description ) ) {
1414
+    if (empty($description)) {
1415 1415
         return;
1416 1416
     }
1417 1417
 
1418
-    $description = wp_kses_post( wpautop( $description ) );
1418
+    $description = wp_kses_post(wpautop($description));
1419 1419
     echo "<small class='getpaid-invoice-description text-dark p-2 form-text' style='margin-bottom: 20px; border-left: 2px solid #2196F3;'><em>$description</em></small>";
1420 1420
 }
1421
-add_action( 'getpaid_invoice_line_items', 'getpaid_the_invoice_description', 100 );
1422
-add_action( 'wpinv_email_billing_details', 'getpaid_the_invoice_description', 100 );
1421
+add_action('getpaid_invoice_line_items', 'getpaid_the_invoice_description', 100);
1422
+add_action('wpinv_email_billing_details', 'getpaid_the_invoice_description', 100);
1423 1423
 
1424 1424
 /**
1425 1425
  * Render element on a form.
@@ -1427,60 +1427,60 @@  discard block
 block discarded – undo
1427 1427
  * @param array $element
1428 1428
  * @param GetPaid_Payment_Form $form
1429 1429
  */
1430
-function getpaid_payment_form_element( $element, $form ) {
1430
+function getpaid_payment_form_element($element, $form) {
1431 1431
 
1432 1432
     // Set up the args.
1433
-    $element_type    = trim( $element['type'] );
1433
+    $element_type    = trim($element['type']);
1434 1434
     $element['form'] = $form;
1435
-    extract( $element );
1435
+    extract($element);
1436 1436
 
1437 1437
     // Try to locate the appropriate template.
1438
-    $located = wpinv_locate_template( "payment-forms/elements/$element_type.php" );
1438
+    $located = wpinv_locate_template("payment-forms/elements/$element_type.php");
1439 1439
 
1440 1440
     // Abort if this is not our element.
1441
-    if ( empty( $located ) || ! file_exists( $located ) ) {
1441
+    if (empty($located) || !file_exists($located)) {
1442 1442
         return;
1443 1443
     }
1444 1444
 
1445 1445
     // Generate the class and id of the element.
1446
-    $wrapper_class = 'getpaid-payment-form-element-' . trim( esc_attr( $element_type ) );
1447
-    $id            = isset( $id ) ? $id : uniqid( 'gp' );
1446
+    $wrapper_class = 'getpaid-payment-form-element-' . trim(esc_attr($element_type));
1447
+    $id            = isset($id) ? $id : uniqid('gp');
1448 1448
 
1449 1449
     // Echo the opening wrapper.
1450 1450
     echo "<div class='getpaid-payment-form-element $wrapper_class'>";
1451 1451
 
1452 1452
     // Fires before displaying a given element type's content.
1453
-    do_action( "getpaid_before_payment_form_{$element_type}_element", $element, $form );
1453
+    do_action("getpaid_before_payment_form_{$element_type}_element", $element, $form);
1454 1454
 
1455 1455
     // Include the template for the element.
1456 1456
     include $located;
1457 1457
 
1458 1458
     // Fires after displaying a given element type's content.
1459
-    do_action( "getpaid_payment_form_{$element_type}_element", $element, $form );
1459
+    do_action("getpaid_payment_form_{$element_type}_element", $element, $form);
1460 1460
 
1461 1461
     // Echo the closing wrapper.
1462 1462
     echo '</div>';
1463 1463
 }
1464
-add_action( 'getpaid_payment_form_element', 'getpaid_payment_form_element', 10, 2 );
1464
+add_action('getpaid_payment_form_element', 'getpaid_payment_form_element', 10, 2);
1465 1465
 
1466 1466
 /**
1467 1467
  * Render an element's edit page.
1468 1468
  *
1469 1469
  * @param WP_Post $post
1470 1470
  */
1471
-function getpaid_payment_form_edit_element_template( $post ) {
1471
+function getpaid_payment_form_edit_element_template($post) {
1472 1472
 
1473 1473
     // Retrieve all elements.
1474
-    $all_elements = wp_list_pluck( wpinv_get_data( 'payment-form-elements' ), 'type' );
1474
+    $all_elements = wp_list_pluck(wpinv_get_data('payment-form-elements'), 'type');
1475 1475
 
1476
-    foreach ( $all_elements as $element ) {
1476
+    foreach ($all_elements as $element) {
1477 1477
 
1478 1478
         // Try to locate the appropriate template.
1479
-        $element = esc_attr( sanitize_key( $element ) );
1480
-        $located = wpinv_locate_template( "payment-forms-admin/edit/$element.php" );
1479
+        $element = esc_attr(sanitize_key($element));
1480
+        $located = wpinv_locate_template("payment-forms-admin/edit/$element.php");
1481 1481
 
1482 1482
         // Continue if this is not our element.
1483
-        if ( empty( $located ) || ! file_exists( $located ) ) {
1483
+        if (empty($located) || !file_exists($located)) {
1484 1484
             continue;
1485 1485
         }
1486 1486
 
@@ -1491,7 +1491,7 @@  discard block
 block discarded – undo
1491 1491
     }
1492 1492
 
1493 1493
 }
1494
-add_action( 'getpaid_payment_form_edit_element_template', 'getpaid_payment_form_edit_element_template' );
1494
+add_action('getpaid_payment_form_edit_element_template', 'getpaid_payment_form_edit_element_template');
1495 1495
 
1496 1496
 /**
1497 1497
  * Render an element's preview.
@@ -1500,16 +1500,16 @@  discard block
 block discarded – undo
1500 1500
 function getpaid_payment_form_render_element_preview_template() {
1501 1501
 
1502 1502
     // Retrieve all elements.
1503
-    $all_elements = wp_list_pluck( wpinv_get_data( 'payment-form-elements' ), 'type' );
1503
+    $all_elements = wp_list_pluck(wpinv_get_data('payment-form-elements'), 'type');
1504 1504
 
1505
-    foreach ( $all_elements as $element ) {
1505
+    foreach ($all_elements as $element) {
1506 1506
 
1507 1507
         // Try to locate the appropriate template.
1508
-        $element = sanitize_key( $element );
1509
-        $located = wpinv_locate_template( "payment-forms-admin/previews/$element.php" );
1508
+        $element = sanitize_key($element);
1509
+        $located = wpinv_locate_template("payment-forms-admin/previews/$element.php");
1510 1510
 
1511 1511
         // Continue if this is not our element.
1512
-        if ( empty( $located ) || ! file_exists( $located ) ) {
1512
+        if (empty($located) || !file_exists($located)) {
1513 1513
             continue;
1514 1514
         }
1515 1515
 
@@ -1520,7 +1520,7 @@  discard block
 block discarded – undo
1520 1520
     }
1521 1521
 
1522 1522
 }
1523
-add_action( 'wpinv_payment_form_render_element_template', 'getpaid_payment_form_render_element_preview_template' );
1523
+add_action('wpinv_payment_form_render_element_template', 'getpaid_payment_form_render_element_preview_template');
1524 1524
 
1525 1525
 /**
1526 1526
  * Shows a list of gateways that support recurring payments.
@@ -1528,17 +1528,17 @@  discard block
 block discarded – undo
1528 1528
 function wpinv_get_recurring_gateways_text() {
1529 1529
     $gateways = array();
1530 1530
 
1531
-    foreach ( wpinv_get_payment_gateways() as $key => $gateway ) {
1532
-        if ( wpinv_gateway_support_subscription( $key ) ) {
1533
-            $gateways[] = sanitize_text_field( $gateway['admin_label'] );
1531
+    foreach (wpinv_get_payment_gateways() as $key => $gateway) {
1532
+        if (wpinv_gateway_support_subscription($key)) {
1533
+            $gateways[] = sanitize_text_field($gateway['admin_label']);
1534 1534
         }
1535 1535
     }
1536 1536
 
1537
-    if ( empty( $gateways ) ) {
1538
-        return "<span class='form-text text-danger'>" . __( 'No active gateways support subscription payments.', 'invoicing' ) . '</span>';
1537
+    if (empty($gateways)) {
1538
+        return "<span class='form-text text-danger'>" . __('No active gateways support subscription payments.', 'invoicing') . '</span>';
1539 1539
     }
1540 1540
 
1541
-    return "<span class='form-text text-muted'>" . wp_sprintf( __( 'Subscription payments only supported by: %s', 'invoicing' ), implode( ', ', $gateways ) ) . '</span>';
1541
+    return "<span class='form-text text-muted'>" . wp_sprintf(__('Subscription payments only supported by: %s', 'invoicing'), implode(', ', $gateways)) . '</span>';
1542 1542
 
1543 1543
 }
1544 1544
 
@@ -1548,7 +1548,7 @@  discard block
 block discarded – undo
1548 1548
  * @return GetPaid_Template
1549 1549
  */
1550 1550
 function getpaid_template() {
1551
-    return getpaid()->get( 'template' );
1551
+    return getpaid()->get('template');
1552 1552
 }
1553 1553
 
1554 1554
 /**
@@ -1557,8 +1557,8 @@  discard block
 block discarded – undo
1557 1557
  * @param array args
1558 1558
  * @return string
1559 1559
  */
1560
-function getpaid_paginate_links( $args ) {
1561
-    return str_replace( 'page-link dots', 'page-link text-dark', aui()->pagination( $args ) );
1560
+function getpaid_paginate_links($args) {
1561
+    return str_replace('page-link dots', 'page-link text-dark', aui()->pagination($args));
1562 1562
 }
1563 1563
 
1564 1564
 /**
@@ -1568,22 +1568,22 @@  discard block
 block discarded – undo
1568 1568
  * @param string state
1569 1569
  * @return string
1570 1570
  */
1571
-function getpaid_get_states_select_markup( $country, $state, $placeholder, $label, $help_text, $required = false, $wrapper_class = 'col-12', $field_name = 'wpinv_state' ) {
1571
+function getpaid_get_states_select_markup($country, $state, $placeholder, $label, $help_text, $required = false, $wrapper_class = 'col-12', $field_name = 'wpinv_state') {
1572 1572
 
1573
-    $states = wpinv_get_country_states( $country );
1574
-    $uniqid = uniqid( '_' );
1573
+    $states = wpinv_get_country_states($country);
1574
+    $uniqid = uniqid('_');
1575 1575
 
1576
-    if ( ! empty( $states ) ) {
1576
+    if (!empty($states)) {
1577 1577
 
1578 1578
         return aui()->select(
1579 1579
             array(
1580 1580
 				'options'          => $states,
1581
-				'name'             => esc_attr( $field_name ),
1582
-				'id'               => sanitize_html_class( $field_name ) . $uniqid,
1583
-				'value'            => sanitize_text_field( $state ),
1581
+				'name'             => esc_attr($field_name),
1582
+				'id'               => sanitize_html_class($field_name) . $uniqid,
1583
+				'value'            => sanitize_text_field($state),
1584 1584
 				'placeholder'      => $placeholder,
1585 1585
 				'required'         => $required,
1586
-				'label'            => wp_kses_post( $label ),
1586
+				'label'            => wp_kses_post($label),
1587 1587
 				'label_type'       => 'vertical',
1588 1588
 				'help_text'        => $help_text,
1589 1589
 				'class'            => 'getpaid-address-field wpinv_state',
@@ -1599,14 +1599,14 @@  discard block
 block discarded – undo
1599 1599
 
1600 1600
     return aui()->input(
1601 1601
         array(
1602
-            'name'             => esc_attr( $field_name ),
1603
-            'id'               => sanitize_html_class( $field_name ) . $uniqid,
1602
+            'name'             => esc_attr($field_name),
1603
+            'id'               => sanitize_html_class($field_name) . $uniqid,
1604 1604
             'placeholder'      => $placeholder,
1605 1605
             'required'         => $required,
1606
-            'label'            => wp_kses_post( $label ),
1606
+            'label'            => wp_kses_post($label),
1607 1607
             'label_type'       => 'vertical',
1608 1608
             'help_text'        => $help_text,
1609
-            'value'            => sanitize_text_field( $state ),
1609
+            'value'            => sanitize_text_field($state),
1610 1610
             'class'            => 'getpaid-address-field wpinv_state',
1611 1611
             'wrap_class'       => "$wrapper_class getpaid-address-field-wrapper__state",
1612 1612
             'label_class'      => 'getpaid-address-field-label getpaid-address-field-label__state',
@@ -1624,16 +1624,16 @@  discard block
 block discarded – undo
1624 1624
  * @param array $element
1625 1625
  * @return string
1626 1626
  */
1627
-function getpaid_get_form_element_grid_class( $element ) {
1627
+function getpaid_get_form_element_grid_class($element) {
1628 1628
 
1629 1629
     $class = 'col-12';
1630
-    $width = empty( $element['grid_width'] ) ? 'full' : $element['grid_width'];
1630
+    $width = empty($element['grid_width']) ? 'full' : $element['grid_width'];
1631 1631
 
1632
-    if ( $width == 'half' ) {
1632
+    if ($width == 'half') {
1633 1633
         $class .= ' col-md-6';
1634 1634
     }
1635 1635
 
1636
-    if ( $width == 'third' ) {
1636
+    if ($width == 'third') {
1637 1637
         $class .= ' col-md-4';
1638 1638
     }
1639 1639
 
@@ -1648,15 +1648,15 @@  discard block
 block discarded – undo
1648 1648
  *
1649 1649
  * @return string
1650 1650
  */
1651
-function getpaid_embed_url( $payment_form = false, $items = false ) {
1651
+function getpaid_embed_url($payment_form = false, $items = false) {
1652 1652
 
1653 1653
     return add_query_arg(
1654 1654
         array(
1655 1655
             'getpaid_embed' => 1,
1656
-            'form'          => $payment_form ? absint( $payment_form ) : false,
1657
-            'item'          => $items ? urlencode( $items ) : false,
1656
+            'form'          => $payment_form ? absint($payment_form) : false,
1657
+            'item'          => $items ? urlencode($items) : false,
1658 1658
         ),
1659
-        home_url( 'index.php' )
1659
+        home_url('index.php')
1660 1660
     );
1661 1661
 
1662 1662
 }
@@ -1666,13 +1666,13 @@  discard block
 block discarded – undo
1666 1666
  *
1667 1667
  * @return string
1668 1668
  */
1669
-function getpaid_filter_embed_template( $template ) {
1669
+function getpaid_filter_embed_template($template) {
1670 1670
 
1671
-    if ( isset( $_GET['getpaid_embed'] ) ) {
1672
-        wpinv_get_template( 'payment-forms/embed.php' );
1671
+    if (isset($_GET['getpaid_embed'])) {
1672
+        wpinv_get_template('payment-forms/embed.php');
1673 1673
         exit;
1674 1674
     }
1675 1675
 
1676 1676
     return $template;
1677 1677
 }
1678
-add_filter( 'template_include', 'getpaid_filter_embed_template' );
1678
+add_filter('template_include', 'getpaid_filter_embed_template');
Please login to merge, or discard this patch.