Passed
Push — master ( 219dea...32accd )
by Brian
05:24
created
templates/emails/wpinv-email-footer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // don't load directly
3
-if ( ! defined( 'ABSPATH' ) ) {
4
-    die( '-1' );
3
+if (!defined('ABSPATH')) {
4
+    die('-1');
5 5
 }
6 6
 
7
-$email_footer = apply_filters( 'wpinv_email_footer_text', wpinv_get_option( 'email_footer_text', get_bloginfo( 'name', 'display' ) . ' - ' . __( 'Powered by GetPaid', 'invoicing' ) ) );
8
-$email_footer = $email_footer ? wp_kses_post( wpautop( wptexturize( $email_footer ) ) ) : '';
7
+$email_footer = apply_filters('wpinv_email_footer_text', wpinv_get_option('email_footer_text', get_bloginfo('name', 'display') . ' - ' . __('Powered by GetPaid', 'invoicing')));
8
+$email_footer = $email_footer ? wp_kses_post(wpautop(wptexturize($email_footer))) : '';
9 9
 ?>
10 10
                                                             </div>
11 11
                                                         </td>
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
                                                 <table border="0" cellpadding="10" cellspacing="0" width="100%">
28 28
                                                     <tr>
29 29
                                                         <td colspan="2" valign="middle" id="credit">
30
-                                                            <?php echo wp_kses_post( $email_footer ); ?>
30
+                                                            <?php echo wp_kses_post($email_footer); ?>
31 31
                                                         </td>
32 32
                                                     </tr>
33 33
                                                 </table>
Please login to merge, or discard this patch.
templates/emails/invoice-totals.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -8,22 +8,22 @@  discard block
 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
 // Totals rows.
14
-$totals = getpaid_invoice_totals_rows( $invoice );
14
+$totals = getpaid_invoice_totals_rows($invoice);
15 15
 
16
-do_action( 'getpaid_before_email_line_totals', $invoice, $totals );
16
+do_action('getpaid_before_email_line_totals', $invoice, $totals);
17 17
 
18 18
 ?>
19 19
 
20 20
 
21
-<?php if ( has_action( 'wpinv_email_footer_buttons' ) ) : ?>
21
+<?php if (has_action('wpinv_email_footer_buttons')) : ?>
22 22
 
23 23
     <tr class="wpinv_cart_footer_row">
24 24
 
25
-        <td colspan="<?php echo ( (int) $column_count ); ?>">
26
-            <?php do_action( 'wpinv_email_footer_buttons' ); ?>
25
+        <td colspan="<?php echo ((int) $column_count); ?>">
26
+            <?php do_action('wpinv_email_footer_buttons'); ?>
27 27
         </td>
28 28
 
29 29
     </tr>
@@ -31,44 +31,44 @@  discard block
 block discarded – undo
31 31
 <?php endif; ?>
32 32
 
33 33
 
34
-<?php foreach ( $totals as $key => $label ) : ?>
34
+<?php foreach ($totals as $key => $label) : ?>
35 35
 
36
-    <tr class="wpinv_cart_footer_row wpinv_cart_<?php echo esc_html( $key ); ?>_row">
36
+    <tr class="wpinv_cart_footer_row wpinv_cart_<?php echo esc_html($key); ?>_row">
37 37
 
38
-        <td colspan="<?php echo absint( ( $column_count - 1 ) ); ?>" class="wpinv_cart_<?php echo esc_html( $key ); ?>_label text-right">
39
-            <strong><?php echo esc_html( $label ); ?>:</strong>
38
+        <td colspan="<?php echo absint(($column_count - 1)); ?>" class="wpinv_cart_<?php echo esc_html($key); ?>_label text-right">
39
+            <strong><?php echo esc_html($label); ?>:</strong>
40 40
         </td>
41 41
 
42
-        <td class="wpinv_cart_<?php echo esc_html( $key ); ?> text-right">
42
+        <td class="wpinv_cart_<?php echo esc_html($key); ?> text-right">
43 43
 
44 44
             <?php
45 45
 
46 46
                 // Total tax.
47
-                if ( 'tax' == $key ) {
48
-                    wpinv_the_price( $invoice->get_total_tax(), $invoice->get_currency() );
47
+                if ('tax' == $key) {
48
+                    wpinv_the_price($invoice->get_total_tax(), $invoice->get_currency());
49 49
                 }
50 50
 
51
-                if ( 'fee' == $key ) {
52
-                    wpinv_the_price( $invoice->get_total_fees(), $invoice->get_currency() );
51
+                if ('fee' == $key) {
52
+                    wpinv_the_price($invoice->get_total_fees(), $invoice->get_currency());
53 53
                 }
54 54
 
55 55
                 // Total discount.
56
-                if ( 'discount' == $key ) {
57
-                    wpinv_the_price( $invoice->get_total_discount(), $invoice->get_currency() );
56
+                if ('discount' == $key) {
57
+                    wpinv_the_price($invoice->get_total_discount(), $invoice->get_currency());
58 58
                 }
59 59
 
60 60
                 // Sub total.
61
-                if ( 'subtotal' == $key ) {
62
-                    wpinv_the_price( $invoice->get_subtotal(), $invoice->get_currency() );
61
+                if ('subtotal' == $key) {
62
+                    wpinv_the_price($invoice->get_subtotal(), $invoice->get_currency());
63 63
                 }
64 64
 
65 65
                 // Total.
66
-                if ( 'total' == $key ) {
67
-                    wpinv_the_price( $invoice->get_total(), $invoice->get_currency() );
66
+                if ('total' == $key) {
67
+                    wpinv_the_price($invoice->get_total(), $invoice->get_currency());
68 68
                 }
69 69
 
70 70
                 // Fires when printing a cart total in an email.
71
-                do_action( "getpaid_email_cart_totals_$key", $invoice );
71
+                do_action("getpaid_email_cart_totals_$key", $invoice);
72 72
 
73 73
             ?>
74 74
 
@@ -80,4 +80,4 @@  discard block
 block discarded – undo
80 80
 
81 81
 <?php
82 82
 
83
-    do_action( 'getpaid_after_email_line_totals', $invoice, $totals );
83
+    do_action('getpaid_after_email_line_totals', $invoice, $totals);
Please login to merge, or discard this patch.
templates/emails/wpinv-email-user_note.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,21 +7,21 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin );
12
+do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin);
13 13
 
14
-do_action( 'wpinv_email_before_note_details', $invoice, $email_type, $sent_to_admin, $customer_note );
14
+do_action('wpinv_email_before_note_details', $invoice, $email_type, $sent_to_admin, $customer_note);
15 15
 
16 16
 // Generate the custom message body.
17
-echo wp_kses_post( wptexturize( str_replace( '{customer_note}', $customer_note, $message_body ) ) );
17
+echo wp_kses_post(wptexturize(str_replace('{customer_note}', $customer_note, $message_body)));
18 18
 
19
-do_action( 'wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin );
19
+do_action('wpinv_email_invoice_details', $invoice, $email_type, $sent_to_admin);
20 20
 
21
-do_action( 'wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin );
21
+do_action('wpinv_email_invoice_items', $invoice, $email_type, $sent_to_admin);
22 22
 
23
-do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin );
23
+do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin);
24 24
 
25
-do_action( 'wpinv_email_after_note_details', $invoice, $email_type, $sent_to_admin, $customer_note );
25
+do_action('wpinv_email_after_note_details', $invoice, $email_type, $sent_to_admin, $customer_note);
26 26
 
27
-do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin );
27
+do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin);
Please login to merge, or discard this patch.
templates/invoice-receipt.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -7,64 +7,64 @@  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
-$invoice = new WPInv_Invoice( $invoice );
13
+$invoice = new WPInv_Invoice($invoice);
14 14
 
15 15
 // @deprecated
16
-do_action( 'wpinv_success_content_before', $invoice );
17
-do_action( 'wpinv_before_receipt', $invoice );
16
+do_action('wpinv_success_content_before', $invoice);
17
+do_action('wpinv_before_receipt', $invoice);
18 18
 
19 19
 wpinv_print_errors();
20 20
 
21 21
 // Prepare header text.
22
-if ( $invoice->is_paid() ) {
22
+if ($invoice->is_paid()) {
23 23
 
24 24
     $alert = aui()->alert(
25 25
         array(
26 26
             'type'    => 'success',
27
-            'content' => __( 'Thank you for your payment!', 'invoicing' ),
27
+            'content' => __('Thank you for your payment!', 'invoicing'),
28 28
         )
29 29
     );
30 30
 
31
-} elseif ( $invoice->is_refunded() ) {
31
+} elseif ($invoice->is_refunded()) {
32 32
 
33 33
     $alert = aui()->alert(
34 34
         array(
35 35
             'type'    => 'info',
36
-            'content' => __( 'This invoice was refunded.', 'invoicing' ),
36
+            'content' => __('This invoice was refunded.', 'invoicing'),
37 37
         )
38 38
     );
39 39
 
40
-} elseif ( $invoice->is_held() ) {
40
+} elseif ($invoice->is_held()) {
41 41
 
42 42
     $alert = aui()->alert(
43 43
         array(
44 44
             'type'    => 'info',
45
-            'content' => __( 'This invoice will be processed as soon we verify your payment.', 'invoicing' ),
45
+            'content' => __('This invoice will be processed as soon we verify your payment.', 'invoicing'),
46 46
         )
47 47
     );
48 48
 
49
-} elseif ( $invoice->needs_payment() ) {
49
+} elseif ($invoice->needs_payment()) {
50 50
 
51
-    if ( ! empty( $_GET['token'] ) ) {
51
+    if (!empty($_GET['token'])) {
52 52
 
53 53
         $alert = aui()->alert(
54 54
             array(
55 55
                 'type'    => 'info',
56
-                'content' => __( "Sometimes it takes a few minutes for us to verify your payment. We'll notify you as soon as we've verified the payment.", 'invoicing' ),
56
+                'content' => __("Sometimes it takes a few minutes for us to verify your payment. We'll notify you as soon as we've verified the payment.", 'invoicing'),
57 57
             )
58 58
         );
59 59
 
60
-    } elseif ( $invoice->is_due() ) {
60
+    } elseif ($invoice->is_due()) {
61 61
 
62 62
         $alert = aui()->alert(
63 63
             array(
64 64
                 'type'    => 'danger',
65 65
                 'content' => sprintf(
66
-                    __( 'This invoice was due on %.', 'invoicing' ),
67
-                    getpaid_format_date_value( $invoice->get_due_date() )
66
+                    __('This invoice was due on %.', 'invoicing'),
67
+                    getpaid_format_date_value($invoice->get_due_date())
68 68
                 ),
69 69
             )
70 70
         );
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $alert = aui()->alert(
75 75
             array(
76 76
                 'type'    => 'warning',
77
-                'content' => __( 'This invoice needs payment.', 'invoicing' ),
77
+                'content' => __('This invoice needs payment.', 'invoicing'),
78 78
             )
79 79
         );
80 80
 
@@ -88,19 +88,19 @@  discard block
 block discarded – undo
88 88
 
89 89
         'pay'     => array(
90 90
             'url'   => $invoice->get_checkout_payment_url(),
91
-            'name'  => __( 'Pay For Invoice', 'invoicing' ),
91
+            'name'  => __('Pay For Invoice', 'invoicing'),
92 92
             'class' => 'btn-success',
93 93
         ),
94 94
 
95 95
         'view'    => array(
96 96
             'url'   => $invoice->get_view_url(),
97
-            'name'  => __( 'View Invoice', 'invoicing' ),
97
+            'name'  => __('View Invoice', 'invoicing'),
98 98
             'class' => 'btn-primary',
99 99
         ),
100 100
 
101 101
         'history' => array(
102 102
             'url'   => wpinv_get_history_page_uri(),
103
-            'name'  => __( 'Invoice History', 'invoicing' ),
103
+            'name'  => __('Invoice History', 'invoicing'),
104 104
             'class' => 'btn-warning',
105 105
         ),
106 106
 
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
     $invoice
109 109
 );
110 110
 
111
-if ( ( ! $invoice->needs_payment() || $invoice->is_held() ) && isset( $invoice_actions['pay'] ) ) {
112
-    unset( $invoice_actions['pay'] );
111
+if ((!$invoice->needs_payment() || $invoice->is_held()) && isset($invoice_actions['pay'])) {
112
+    unset($invoice_actions['pay']);
113 113
 }
114 114
 
115
-if ( ! is_user_logged_in() && isset( $invoice_actions['history'] ) ) {
116
-    unset( $invoice_actions['history'] );
115
+if (!is_user_logged_in() && isset($invoice_actions['history'])) {
116
+    unset($invoice_actions['history']);
117 117
 }
118 118
 
119 119
 ?>
@@ -122,29 +122,29 @@  discard block
 block discarded – undo
122 122
 
123 123
         <?php
124 124
 
125
-            do_action( 'wpinv_receipt_start', $invoice );
125
+            do_action('wpinv_receipt_start', $invoice);
126 126
 
127
-            if ( ! empty( $invoice_actions ) ) {
127
+            if (!empty($invoice_actions)) {
128 128
 
129 129
 			echo '<div class="wpinv-receipt-actions text-right mt-1 mb-4">';
130 130
 
131
-			foreach ( $invoice_actions as $key => $invoice_action ) {
131
+			foreach ($invoice_actions as $key => $invoice_action) {
132 132
 
133
-				$key    = sanitize_html_class( $key );
134
-				$class  = empty( $invoice_action['class'] ) ? 'btn-dark' : sanitize_html_class( $invoice_action['class'] );
135
-				$url    = empty( $invoice_action['url'] ) ? '#' : esc_url( $invoice_action['url'] );
136
-				$attrs  = empty( $invoice_action['attrs'] ) ? '' : $invoice_action['attrs'];
137
-				$anchor = esc_html( $invoice_action['name'] );
133
+				$key    = sanitize_html_class($key);
134
+				$class  = empty($invoice_action['class']) ? 'btn-dark' : sanitize_html_class($invoice_action['class']);
135
+				$url    = empty($invoice_action['url']) ? '#' : esc_url($invoice_action['url']);
136
+				$attrs  = empty($invoice_action['attrs']) ? '' : $invoice_action['attrs'];
137
+				$anchor = esc_html($invoice_action['name']);
138 138
 
139
-				echo wp_kses_post( "<a href='$url' class='btn btn-sm ml-1 $class $key' $attrs>$anchor</a>" );
139
+				echo wp_kses_post("<a href='$url' class='btn btn-sm ml-1 $class $key' $attrs>$anchor</a>");
140 140
                 }
141 141
 
142 142
 			echo '</div>';
143 143
 
144 144
             }
145 145
 
146
-            if ( ! empty( $alert ) ) {
147
-			echo wp_kses_post( $alert );
146
+            if (!empty($alert)) {
147
+			echo wp_kses_post($alert);
148 148
             }
149 149
 
150 150
         ?>
@@ -152,19 +152,19 @@  discard block
 block discarded – undo
152 152
         <div class="wpinv-receipt-details">
153 153
 
154 154
             <h4 class="wpinv-details-t mb-3 mt-3">
155
-                <?php echo esc_html( apply_filters( 'wpinv_receipt_details_title', __( 'Invoice Details', 'invoicing' ), $invoice ) ); ?>
155
+                <?php echo esc_html(apply_filters('wpinv_receipt_details_title', __('Invoice Details', 'invoicing'), $invoice)); ?>
156 156
             </h4>
157 157
 
158
-            <?php getpaid_invoice_meta( $invoice ); ?>
158
+            <?php getpaid_invoice_meta($invoice); ?>
159 159
 
160 160
         </div>
161 161
 
162
-        <?php do_action( 'wpinv_receipt_end', $invoice ); ?>
162
+        <?php do_action('wpinv_receipt_end', $invoice); ?>
163 163
 
164 164
     </div>
165 165
 
166 166
 <?php
167 167
 
168 168
 // @deprecated
169
-do_action( 'wpinv_success_content_after', $invoice );
170
-do_action( 'wpinv_after_receipt', $invoice );
169
+do_action('wpinv_success_content_after', $invoice);
170
+do_action('wpinv_after_receipt', $invoice);
Please login to merge, or discard this patch.
includes/admin/class-wpinv-users.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // MUST have WordPress.
10
-if ( ! defined( 'WPINC' ) ) {
10
+if (!defined('WPINC')) {
11 11
     exit;
12 12
 }
13 13
 
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     private static $instance;
16 16
 
17 17
     public static function run() {
18
-        if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WPInv_Admin_Users ) ) {
18
+        if (!isset(self::$instance) && !(self::$instance instanceof WPInv_Admin_Users)) {
19 19
             self::$instance = new WPInv_Admin_Users();
20 20
         }
21 21
 
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
     }
24 24
 
25 25
     public function __construct() {
26
-        add_filter( 'manage_users_columns', array( $this, 'wpinv_add_user_column' ) );
27
-        add_filter( 'manage_users_custom_column', array( $this, 'wpinv_user_column_content' ), 10, 3 );
26
+        add_filter('manage_users_columns', array($this, 'wpinv_add_user_column'));
27
+        add_filter('manage_users_custom_column', array($this, 'wpinv_user_column_content'), 10, 3);
28 28
     }
29 29
 
30 30
     /**
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
      *
35 35
      * @return mixed
36 36
      */
37
-    public function wpinv_add_user_column( $column ) {
38
-        $column['wpinvoicing'] = __( 'Invoicing', 'invoicing' );
37
+    public function wpinv_add_user_column($column) {
38
+        $column['wpinvoicing'] = __('Invoicing', 'invoicing');
39 39
         return $column;
40 40
     }
41 41
 
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @return string
50 50
      */
51
-    public function wpinv_user_column_content( $val, $column_name, $user_id ) {
52
-        switch ( $column_name ) {
51
+    public function wpinv_user_column_content($val, $column_name, $user_id) {
52
+        switch ($column_name) {
53 53
             case 'wpinvoicing':
54
-                return $this->get_user_invoices( $user_id );
54
+                return $this->get_user_invoices($user_id);
55 55
                 break;
56 56
             default:
57 57
         }
@@ -65,30 +65,30 @@  discard block
 block discarded – undo
65 65
      *
66 66
      * @return string
67 67
      */
68
-    public function get_user_invoices( $user_id ) {
68
+    public function get_user_invoices($user_id) {
69 69
         $output = '';
70 70
         $wp_query_args = array(
71 71
             'post_type'      => 'wpi_invoice',
72
-            'post_status'    => array( 'wpi-pending', 'publish', 'wpi-processing', 'wpi-onhold', 'wpi-refunded', 'wpi-cancelled', 'wpi-failed', 'wpi-renewal' ),
72
+            'post_status'    => array('wpi-pending', 'publish', 'wpi-processing', 'wpi-onhold', 'wpi-refunded', 'wpi-cancelled', 'wpi-failed', 'wpi-renewal'),
73 73
             'posts_per_page' => -1,
74 74
             'fields'         => 'ids',
75 75
             'author'         => $user_id,
76 76
         );
77 77
 
78
-        $wp_query_args = apply_filters( 'wpinv_get_user_invoices_args', $wp_query_args, $user_id );
78
+        $wp_query_args = apply_filters('wpinv_get_user_invoices_args', $wp_query_args, $user_id);
79 79
 
80
-        $invoices = new WP_Query( $wp_query_args );
81
-        $count = absint( $invoices->found_posts );
80
+        $invoices = new WP_Query($wp_query_args);
81
+        $count = absint($invoices->found_posts);
82 82
 
83
-        if ( empty( $count ) ) {
84
-            $output .= __( 'No Invoice(s)', 'invoicing' );
83
+        if (empty($count)) {
84
+            $output .= __('No Invoice(s)', 'invoicing');
85 85
         } else {
86
-            $link_url = admin_url( 'edit.php?post_type=wpi_invoice&author=' . absint( $user_id ) );
87
-            $link_text = sprintf( __( 'Invoices ( %d )', 'invoicing' ), $count );
86
+            $link_url = admin_url('edit.php?post_type=wpi_invoice&author=' . absint($user_id));
87
+            $link_text = sprintf(__('Invoices ( %d )', 'invoicing'), $count);
88 88
             $output .= "<a href='$link_url' >$link_text</a>";
89 89
         }
90 90
 
91
-        return apply_filters( 'wpinv_user_invoice_content', $output, $user_id );
91
+        return apply_filters('wpinv_user_invoice_content', $output, $user_id);
92 92
     }
93 93
 
94 94
 }
Please login to merge, or discard this patch.
includes/admin/wpinv-admin-functions.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -7,81 +7,81 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // MUST have WordPress.
10
-if ( ! defined( 'WPINC' ) ) {
10
+if (!defined('WPINC')) {
11 11
     exit;
12 12
 }
13 13
 
14
-function wpinv_bulk_actions( $actions ) {
15
-    if ( isset( $actions['edit'] ) ) {
16
-        unset( $actions['edit'] );
14
+function wpinv_bulk_actions($actions) {
15
+    if (isset($actions['edit'])) {
16
+        unset($actions['edit']);
17 17
     }
18 18
 
19 19
     return $actions;
20 20
 }
21
-add_filter( 'bulk_actions-edit-wpi_invoice', 'wpinv_bulk_actions' );
22
-add_filter( 'bulk_actions-edit-wpi_item', 'wpinv_bulk_actions' );
21
+add_filter('bulk_actions-edit-wpi_invoice', 'wpinv_bulk_actions');
22
+add_filter('bulk_actions-edit-wpi_item', 'wpinv_bulk_actions');
23 23
 
24
-function wpinv_admin_post_id( $id = 0 ) {
24
+function wpinv_admin_post_id($id = 0) {
25 25
     global $post;
26 26
 
27
-    if ( isset( $id ) && ! empty( $id ) ) {
28
-        return (int)$id;
29
-    } elseif ( get_the_ID() ) {
27
+    if (isset($id) && !empty($id)) {
28
+        return (int) $id;
29
+    } elseif (get_the_ID()) {
30 30
         return (int) get_the_ID();
31
-    } elseif ( isset( $post->ID ) && ! empty( $post->ID ) ) {
31
+    } elseif (isset($post->ID) && !empty($post->ID)) {
32 32
         return (int) $post->ID;
33
-    } elseif ( isset( $_GET['post'] ) && ! empty( $_GET['post'] ) ) {
33
+    } elseif (isset($_GET['post']) && !empty($_GET['post'])) {
34 34
         return (int) $_GET['post'];
35
-    } elseif ( isset( $_GET['id'] ) && ! empty( $_GET['id'] ) ) {
35
+    } elseif (isset($_GET['id']) && !empty($_GET['id'])) {
36 36
         return (int) $_GET['id'];
37
-    } elseif ( isset( $_POST['id'] ) && ! empty( $_POST['id'] ) ) {
37
+    } elseif (isset($_POST['id']) && !empty($_POST['id'])) {
38 38
         return (int) $_POST['id'];
39 39
     }
40 40
 
41 41
     return null;
42 42
 }
43 43
 
44
-function wpinv_admin_post_type( $id = 0 ) {
45
-    if ( ! $id ) {
44
+function wpinv_admin_post_type($id = 0) {
45
+    if (!$id) {
46 46
         $id = wpinv_admin_post_id();
47 47
     }
48 48
 
49
-    $type = get_post_type( $id );
49
+    $type = get_post_type($id);
50 50
 
51
-    if ( ! $type ) {
52
-        $type = isset( $_GET['post_type'] ) && ! empty( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : null;
51
+    if (!$type) {
52
+        $type = isset($_GET['post_type']) && !empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : null;
53 53
     }
54 54
 
55
-    return apply_filters( 'wpinv_admin_post_type', $type, $id );
55
+    return apply_filters('wpinv_admin_post_type', $type, $id);
56 56
 }
57 57
 
58 58
 function wpinv_admin_messages() {
59
-	settings_errors( 'wpinv-notices' );
59
+	settings_errors('wpinv-notices');
60 60
 }
61
-add_action( 'admin_notices', 'wpinv_admin_messages' );
61
+add_action('admin_notices', 'wpinv_admin_messages');
62 62
 
63
-add_action( 'admin_init', 'wpinv_show_test_payment_gateway_notice' );
63
+add_action('admin_init', 'wpinv_show_test_payment_gateway_notice');
64 64
 function wpinv_show_test_payment_gateway_notice() {
65
-    add_action( 'admin_notices', 'wpinv_test_payment_gateway_messages' );
65
+    add_action('admin_notices', 'wpinv_test_payment_gateway_messages');
66 66
 }
67 67
 
68 68
 function wpinv_test_payment_gateway_messages() {
69 69
     $gateways = wpinv_get_enabled_payment_gateways();
70 70
     $name = array(); $test_gateways = '';
71
-    if ( $gateways ) {
72
-        foreach ( $gateways as $id => $gateway ) {
73
-            if ( wpinv_is_test_mode( $id ) ) {
71
+    if ($gateways) {
72
+        foreach ($gateways as $id => $gateway) {
73
+            if (wpinv_is_test_mode($id)) {
74 74
                 $name[] = $gateway['checkout_label'];
75 75
             }
76 76
         }
77
-        $test_gateways = implode( ', ', $name );
77
+        $test_gateways = implode(', ', $name);
78 78
     }
79
-    if ( isset( $test_gateways ) && ! empty( $test_gateways ) && wpinv_current_user_can_manage_invoicing() ) {
80
-        $link = admin_url( 'admin.php?page=wpinv-settings&tab=gateways' );
81
-        $notice = wp_sprintf( __( '<strong>Important:</strong> Payment Gateway(s) %1$s are in testing mode and will not receive real payments. Go to <a href="%2$s"> Gateway Settings</a>.', 'invoicing' ), $test_gateways, $link );
79
+    if (isset($test_gateways) && !empty($test_gateways) && wpinv_current_user_can_manage_invoicing()) {
80
+        $link = admin_url('admin.php?page=wpinv-settings&tab=gateways');
81
+        $notice = wp_sprintf(__('<strong>Important:</strong> Payment Gateway(s) %1$s are in testing mode and will not receive real payments. Go to <a href="%2$s"> Gateway Settings</a>.', 'invoicing'), $test_gateways, $link);
82 82
         ?>
83 83
         <div class="notice notice-warning is-dismissible">
84
-            <p><?php echo wp_kses_post( $notice ); ?></p>
84
+            <p><?php echo wp_kses_post($notice); ?></p>
85 85
         </div>
86 86
         <?php
87 87
     }
@@ -95,37 +95,37 @@  discard block
 block discarded – undo
95 95
     global $wpdb;
96 96
 
97 97
     // Only do this on our settings page.
98
-    if ( empty( $_GET['page'] ) || 'wpinv-settings' !== $_GET['page'] ) {
98
+    if (empty($_GET['page']) || 'wpinv-settings' !== $_GET['page']) {
99 99
         return;
100 100
     }
101 101
 
102 102
     // Check tables.
103
-    $tables             = array(
103
+    $tables = array(
104 104
         "{$wpdb->prefix}wpinv_subscriptions",
105 105
         "{$wpdb->prefix}getpaid_invoices",
106 106
         "{$wpdb->prefix}getpaid_invoice_items",
107 107
     );
108 108
 
109
-    foreach ( $tables as $table ) {
110
-        if ( $table != $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) ) {
109
+    foreach ($tables as $table) {
110
+        if ($table != $wpdb->get_var("SHOW TABLES LIKE '$table'")) {
111 111
 
112
-            $url     = wp_nonce_url(
113
-                add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ),
112
+            $url = wp_nonce_url(
113
+                add_query_arg('getpaid-admin-action', 'create_missing_tables'),
114 114
                 'getpaid-nonce',
115 115
                 'getpaid-nonce'
116 116
             );
117
-            $message  = __( 'Some GetPaid database tables are missing. To use GetPaid without any issues, click on the button below to create the missing tables.', 'invoicing' );
118
-            $message2 = __( 'Create Tables', 'invoicing' );
119
-            echo wp_kses_post( "<div class='notice notice-warning is-dismissible'><p>$message<br><br><a href='$url' class='button button-primary'>$message2</a></p></div>" );
117
+            $message  = __('Some GetPaid database tables are missing. To use GetPaid without any issues, click on the button below to create the missing tables.', 'invoicing');
118
+            $message2 = __('Create Tables', 'invoicing');
119
+            echo wp_kses_post("<div class='notice notice-warning is-dismissible'><p>$message<br><br><a href='$url' class='button button-primary'>$message2</a></p></div>");
120 120
             break;
121 121
 
122 122
         }
123 123
     }
124 124
 
125 125
 }
126
-add_action( 'admin_notices', 'wpinv_check_for_missing_tables' );
126
+add_action('admin_notices', 'wpinv_check_for_missing_tables');
127 127
 
128
-add_action( 'admin_init', 'wpinv_admin_search_by_invoice' );
128
+add_action('admin_init', 'wpinv_admin_search_by_invoice');
129 129
 
130 130
 /**
131 131
  * hook the posts search if we're on the admin page for our type
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 function wpinv_admin_search_by_invoice() {
134 134
     global $typenow;
135 135
 
136
-    if ( $typenow === 'wpi_invoice' || $typenow === 'wpi_quote' ) {
137
-        add_filter( 'posts_search', 'wpinv_posts_search_example_type', 10, 2 );
136
+    if ($typenow === 'wpi_invoice' || $typenow === 'wpi_quote') {
137
+        add_filter('posts_search', 'wpinv_posts_search_example_type', 10, 2);
138 138
     }
139 139
 }
140 140
 
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
  * @param WP_Query $query
145 145
  * @return string
146 146
  */
147
-function wpinv_posts_search_example_type( $search, $query ) {
147
+function wpinv_posts_search_example_type($search, $query) {
148 148
     global $wpdb;
149 149
 
150
-    if ( $query->is_main_query() && ! empty( $query->query['s'] ) ) {
151
-        $conditions_str = "{$wpdb->posts}.post_author IN ( SELECT ID FROM {$wpdb->users} WHERE user_email LIKE '%" . esc_sql( $query->query['s'] ) . "%' )";
152
-        if ( ! empty( $search ) ) {
153
-            $search = preg_replace( '/^ AND /', '', $search );
150
+    if ($query->is_main_query() && !empty($query->query['s'])) {
151
+        $conditions_str = "{$wpdb->posts}.post_author IN ( SELECT ID FROM {$wpdb->users} WHERE user_email LIKE '%" . esc_sql($query->query['s']) . "%' )";
152
+        if (!empty($search)) {
153
+            $search = preg_replace('/^ AND /', '', $search);
154 154
             $search = " AND ( {$search} OR ( {$conditions_str} ) )";
155 155
         } else {
156 156
             $search = " AND ( {$conditions_str} )";
@@ -164,16 +164,16 @@  discard block
 block discarded – undo
164 164
  * Resets invoice counts.
165 165
  */
166 166
 function wpinv_reset_invoice_count() {
167
-    if ( ! empty( $_GET['reset_invoice_count'] ) && isset( $_GET['_nonce'] ) && wp_verify_nonce( sanitize_text_field( $_GET['_nonce'] ), 'reset_invoice_count' ) ) {
168
-        wpinv_update_option( 'invoice_sequence_start', 1 );
169
-        delete_option( 'wpinv_last_invoice_number' );
170
-        getpaid_admin()->show_success( __( 'Invoice number sequence reset successfully.', 'invoicing' ) );
171
-        $url = remove_query_arg( array( 'reset_invoice_count', '_nonce' ) );
172
-        wp_redirect( $url );
167
+    if (!empty($_GET['reset_invoice_count']) && isset($_GET['_nonce']) && wp_verify_nonce(sanitize_text_field($_GET['_nonce']), 'reset_invoice_count')) {
168
+        wpinv_update_option('invoice_sequence_start', 1);
169
+        delete_option('wpinv_last_invoice_number');
170
+        getpaid_admin()->show_success(__('Invoice number sequence reset successfully.', 'invoicing'));
171
+        $url = remove_query_arg(array('reset_invoice_count', '_nonce'));
172
+        wp_redirect($url);
173 173
         exit();
174 174
     }
175 175
 }
176
-add_action( 'admin_init', 'wpinv_reset_invoice_count' );
176
+add_action('admin_init', 'wpinv_reset_invoice_count');
177 177
 
178 178
 /**
179 179
  * Displays line items on the invoice edit page.
@@ -182,29 +182,29 @@  discard block
 block discarded – undo
182 182
  * @param array $columns
183 183
  * @return string
184 184
  */
185
-function wpinv_admin_get_line_items( $invoice, $columns ) {
185
+function wpinv_admin_get_line_items($invoice, $columns) {
186 186
 
187 187
     ob_start();
188 188
 
189
-    do_action( 'getpaid_admin_before_line_items', $invoice );
189
+    do_action('getpaid_admin_before_line_items', $invoice);
190 190
 
191 191
     $count = 0;
192
-    foreach ( $invoice->get_items() as $item ) {
192
+    foreach ($invoice->get_items() as $item) {
193 193
 
194
-        $item_price     = wpinv_price( $item->get_price(), $invoice->get_currency() );
194
+        $item_price     = wpinv_price($item->get_price(), $invoice->get_currency());
195 195
         $quantity       = (int) $item->get_quantity();
196
-        $item_subtotal  = wpinv_price( $item->get_sub_total(), $invoice->get_currency() );
197
-        $summary        = apply_filters( 'getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice );
196
+        $item_subtotal  = wpinv_price($item->get_sub_total(), $invoice->get_currency());
197
+        $summary        = apply_filters('getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice);
198 198
         $item_tax       = $item->item_tax;
199
-        $tax_rate       = wpinv_round_amount( getpaid_get_invoice_tax_rate( $invoice, $item ), 2, true ) . '%';
200
-        $tax_rate       = empty( $tax_rate ) ? ' <span class="tax-rate">(' . $tax_rate . '%)</span>' : '';
199
+        $tax_rate       = wpinv_round_amount(getpaid_get_invoice_tax_rate($invoice, $item), 2, true) . '%';
200
+        $tax_rate       = empty($tax_rate) ? ' <span class="tax-rate">(' . $tax_rate . '%)</span>' : '';
201 201
         $line_item_tax  = $item_tax . $tax_rate;
202
-        $line_item      = '<tr class="item item-' . ( ($count % 2 == 0) ? 'even' : 'odd' ) . '" data-item-id="' . esc_attr( $item->get_id() ) . '">';
202
+        $line_item      = '<tr class="item item-' . (($count % 2 == 0) ? 'even' : 'odd') . '" data-item-id="' . esc_attr($item->get_id()) . '">';
203 203
         $line_item     .= '<td class="id">' . (int) $item->get_id() . '</td>';
204
-        $line_item     .= '<td class="title"><a href="' . get_edit_post_link( $item->get_id() ) . '" target="_blank">' . $item->get_name() . '</a>';
204
+        $line_item     .= '<td class="title"><a href="' . get_edit_post_link($item->get_id()) . '" target="_blank">' . $item->get_name() . '</a>';
205 205
 
206
-        if ( $summary !== '' ) {
207
-            $line_item .= '<span class="meta">' . wp_kses_post( wpautop( $summary ) ) . '</span>';
206
+        if ($summary !== '') {
207
+            $line_item .= '<span class="meta">' . wp_kses_post(wpautop($summary)) . '</span>';
208 208
         }
209 209
 
210 210
         $line_item .= '</td>';
@@ -212,23 +212,23 @@  discard block
 block discarded – undo
212 212
         $line_item .= '<td class="qty" data-quantity="' . $quantity . '">&nbsp;&times;&nbsp;' . $quantity . '</td>';
213 213
         $line_item .= '<td class="total">' . $item_subtotal . '</td>';
214 214
 
215
-        if ( wpinv_use_taxes() && $invoice->is_taxable() ) {
215
+        if (wpinv_use_taxes() && $invoice->is_taxable()) {
216 216
             $line_item .= '<td class="tax">' . $line_item_tax . '</td>';
217 217
         }
218 218
 
219 219
         $line_item .= '<td class="action">';
220
-        if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
220
+        if (!$invoice->is_paid() && !$invoice->is_refunded()) {
221 221
             $line_item .= '<i class="fa fa-remove wpinv-item-remove"></i>';
222 222
         }
223 223
         $line_item .= '</td>';
224 224
         $line_item .= '</tr>';
225 225
 
226
-        echo wp_kses_post( apply_filters( 'getpaid_admin_line_item', $line_item, $item, $invoice ) );
226
+        echo wp_kses_post(apply_filters('getpaid_admin_line_item', $line_item, $item, $invoice));
227 227
 
228 228
         $count++;
229 229
     }
230 230
 
231
-    do_action( 'getpaid_admin_after_line_items', $invoice );
231
+    do_action('getpaid_admin_after_line_items', $invoice);
232 232
 
233 233
     return ob_get_clean();
234 234
 }
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-invoice-address.php 1 patch
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  *
8 8
  */
9 9
 
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if (!defined('ABSPATH')) {
11 11
 	exit; // Exit if accessed directly
12 12
 }
13 13
 
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @param WP_Post $post
23 23
 	 */
24
-    public static function output( $post ) {
24
+    public static function output($post) {
25 25
 
26 26
         // Prepare the invoice.
27
-        $invoice  = new WPInv_Invoice( $post );
28
-        $customer = $invoice->exists() ? $invoice->get_user_id( 'edit' ) : get_current_user_id();
29
-        $customer = new WP_User( $customer );
30
-        $display  = sprintf( _x( '%1$s (%2$s)', 'user dropdown', 'invoicing' ), $customer->display_name, $customer->user_email );
31
-        wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' );
27
+        $invoice  = new WPInv_Invoice($post);
28
+        $customer = $invoice->exists() ? $invoice->get_user_id('edit') : get_current_user_id();
29
+        $customer = new WP_User($customer);
30
+        $display  = sprintf(_x('%1$s (%2$s)', 'user dropdown', 'invoicing'), $customer->display_name, $customer->user_email);
31
+        wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce');
32 32
 
33 33
         ?>
34 34
 
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
                         <div class="col-12 col-sm-6">
44 44
                             <div id="getpaid-invoice-user-id-wrapper" class="form-group">
45 45
                                 <div>
46
-                                    <label for="post_author_override"><?php esc_html_e( 'Customer', 'invoicing' ); ?></label>
46
+                                    <label for="post_author_override"><?php esc_html_e('Customer', 'invoicing'); ?></label>
47 47
                                 </div>
48 48
                                 <div>
49
-                                    <select name="post_author_override" id="wpinv_post_author_override" class="getpaid-customer-search form-control regular-text" data-placeholder="<?php esc_attr_e( 'Search for a customer by email or name', 'invoicing' ); ?>">
50
-                                        <option selected="selected" value="<?php echo (int) $customer->ID; ?>"><?php echo esc_html( $display ); ?> </option>)
49
+                                    <select name="post_author_override" id="wpinv_post_author_override" class="getpaid-customer-search form-control regular-text" data-placeholder="<?php esc_attr_e('Search for a customer by email or name', 'invoicing'); ?>">
50
+                                        <option selected="selected" value="<?php echo (int) $customer->ID; ?>"><?php echo esc_html($display); ?> </option>)
51 51
                                     </select>
52 52
                                 </div>
53 53
                             </div>
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                                             'type'        => 'text',
61 61
                                             'id'          => 'getpaid-invoice-new-user-email',
62 62
                                             'name'        => 'wpinv_email',
63
-                                            'label'       => __( 'Email', 'invoicing' ) . '<span class="required">*</span>',
63
+                                            'label'       => __('Email', 'invoicing') . '<span class="required">*</span>',
64 64
                                             'label_type'  => 'vertical',
65 65
                                             'placeholder' => '[email protected]',
66 66
                                             'class'       => 'form-control-sm',
@@ -71,18 +71,18 @@  discard block
 block discarded – undo
71 71
                             </div>
72 72
                         </div>
73 73
                         <div class="col-12 col-sm-6 form-group mt-sm-4">
74
-                            <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?>
74
+                            <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?>
75 75
                                 <a id="getpaid-invoice-fill-user-details" class="button button-small button-secondary" href="javascript:void(0)">
76 76
                                     <i aria-hidden="true" class="fa fa-refresh"></i>
77
-                                    <?php esc_html_e( 'Fill User Details', 'invoicing' ); ?>
77
+                                    <?php esc_html_e('Fill User Details', 'invoicing'); ?>
78 78
                                 </a>
79 79
                                 <a id="getpaid-invoice-create-new-user-button" class="button button-small button-secondary" href="javascript:void(0)">
80 80
                                     <i aria-hidden="true" class="fa fa-plus"></i>
81
-                                    <?php esc_html_e( 'Add New User', 'invoicing' ); ?>
81
+                                    <?php esc_html_e('Add New User', 'invoicing'); ?>
82 82
                                 </a>
83 83
                                 <a id="getpaid-invoice-cancel-create-new-user" class="button button-small button-secondary d-none" href="javascript:void(0)">
84 84
                                     <i aria-hidden="true" class="fa fa-close"></i>
85
-                                    <?php esc_html_e( 'Cancel', 'invoicing' ); ?>
85
+                                    <?php esc_html_e('Cancel', 'invoicing'); ?>
86 86
                                 </a>
87 87
                             <?php endif; ?>
88 88
                         </div>
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
                                         'type'        => 'text',
96 96
                                         'id'          => 'wpinv_first_name',
97 97
                                         'name'        => 'wpinv_first_name',
98
-                                        'label'       => __( 'First Name', 'invoicing' ),
98
+                                        'label'       => __('First Name', 'invoicing'),
99 99
                                         'label_type'  => 'vertical',
100 100
                                         'placeholder' => '',
101 101
                                         'class'       => 'form-control-sm',
102
-                                        'value'       => $invoice->get_first_name( 'edit' ),
102
+                                        'value'       => $invoice->get_first_name('edit'),
103 103
                                     ),
104 104
                                     true
105 105
                                 );
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
                                         'type'        => 'text',
113 113
                                         'id'          => 'wpinv_last_name',
114 114
                                         'name'        => 'wpinv_last_name',
115
-                                        'label'       => __( 'Last Name', 'invoicing' ),
115
+                                        'label'       => __('Last Name', 'invoicing'),
116 116
                                         'label_type'  => 'vertical',
117 117
                                         'placeholder' => '',
118 118
                                         'class'       => 'form-control-sm',
119
-                                        'value'       => $invoice->get_last_name( 'edit' ),
119
+                                        'value'       => $invoice->get_last_name('edit'),
120 120
                                     ),
121 121
                                     true
122 122
                                 );
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
                                         'type'        => 'text',
133 133
                                         'id'          => 'wpinv_company',
134 134
                                         'name'        => 'wpinv_company',
135
-                                        'label'       => __( 'Company', 'invoicing' ),
135
+                                        'label'       => __('Company', 'invoicing'),
136 136
                                         'label_type'  => 'vertical',
137 137
                                         'placeholder' => '',
138 138
                                         'class'       => 'form-control-sm',
139
-                                        'value'       => $invoice->get_company( 'edit' ),
139
+                                        'value'       => $invoice->get_company('edit'),
140 140
                                     ),
141 141
                                     true
142 142
                                 );
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
                                         'type'        => 'text',
150 150
                                         'id'          => 'wpinv_vat_number',
151 151
                                         'name'        => 'wpinv_vat_number',
152
-                                        'label'       => __( 'Vat Number', 'invoicing' ),
152
+                                        'label'       => __('Vat Number', 'invoicing'),
153 153
                                         'label_type'  => 'vertical',
154 154
                                         'placeholder' => '',
155 155
                                         'class'       => 'form-control-sm getpaid-recalculate-prices-on-change',
156
-                                        'value'       => $invoice->get_vat_number( 'edit' ),
156
+                                        'value'       => $invoice->get_vat_number('edit'),
157 157
                                     ),
158 158
                                     true
159 159
                                 );
@@ -169,11 +169,11 @@  discard block
 block discarded – undo
169 169
                                         'type'        => 'text',
170 170
                                         'id'          => 'wpinv_address',
171 171
                                         'name'        => 'wpinv_address',
172
-                                        'label'       => __( 'Address', 'invoicing' ),
172
+                                        'label'       => __('Address', 'invoicing'),
173 173
                                         'label_type'  => 'vertical',
174 174
                                         'placeholder' => '',
175 175
                                         'class'       => 'form-control-sm',
176
-                                        'value'       => $invoice->get_address( 'edit' ),
176
+                                        'value'       => $invoice->get_address('edit'),
177 177
                                     ),
178 178
                                     true
179 179
                                 );
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
                                         'type'        => 'text',
187 187
                                         'id'          => 'wpinv_city',
188 188
                                         'name'        => 'wpinv_city',
189
-                                        'label'       => __( 'City', 'invoicing' ),
189
+                                        'label'       => __('City', 'invoicing'),
190 190
                                         'label_type'  => 'vertical',
191 191
                                         'placeholder' => '',
192 192
                                         'class'       => 'form-control-sm',
193
-                                        'value'       => $invoice->get_city( 'edit' ),
193
+                                        'value'       => $invoice->get_city('edit'),
194 194
                                     ),
195 195
                                     true
196 196
                                 );
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
                                     array(
206 206
                                         'id'               => 'wpinv_country',
207 207
                                         'name'             => 'wpinv_country',
208
-                                        'label'            => __( 'Country', 'invoicing' ),
208
+                                        'label'            => __('Country', 'invoicing'),
209 209
                                         'label_type'       => 'vertical',
210
-                                        'placeholder'      => __( 'Choose a country', 'invoicing' ),
210
+                                        'placeholder'      => __('Choose a country', 'invoicing'),
211 211
                                         'class'            => 'form-control-sm getpaid-recalculate-prices-on-change',
212
-                                        'value'            => $invoice->get_country( 'edit' ),
212
+                                        'value'            => $invoice->get_country('edit'),
213 213
                                         'options'          => wpinv_get_country_list(),
214 214
                                         'data-allow-clear' => 'false',
215 215
                                         'select2'          => true,
@@ -221,20 +221,20 @@  discard block
 block discarded – undo
221 221
                         <div class="col-12 col-sm-6">
222 222
                             <?php
223 223
 
224
-                                $states = wpinv_get_country_states( $invoice->get_country( 'edit' ) );
224
+                                $states = wpinv_get_country_states($invoice->get_country('edit'));
225 225
 
226
-                                if ( empty( $states ) ) {
226
+                                if (empty($states)) {
227 227
 
228 228
 								aui()->input(
229 229
 								array(
230 230
 								'type'        => 'text',
231 231
 								'id'          => 'wpinv_state',
232 232
 								'name'        => 'wpinv_state',
233
-								'label'       => __( 'State', 'invoicing' ),
233
+								'label'       => __('State', 'invoicing'),
234 234
 								'label_type'  => 'vertical',
235 235
 								'placeholder' => '',
236 236
 								'class'       => 'form-control-sm',
237
-								'value'       => $invoice->get_state( 'edit' ),
237
+								'value'       => $invoice->get_state('edit'),
238 238
 								),
239 239
 								true
240 240
 							);
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
 								array(
246 246
 								'id'               => 'wpinv_state',
247 247
 								'name'             => 'wpinv_state',
248
-								'label'            => __( 'State', 'invoicing' ),
248
+								'label'            => __('State', 'invoicing'),
249 249
 								'label_type'       => 'vertical',
250
-								'placeholder'      => __( 'Select a state', 'invoicing' ),
250
+								'placeholder'      => __('Select a state', 'invoicing'),
251 251
 								'class'            => 'form-control-sm',
252
-								'value'            => $invoice->get_state( 'edit' ),
252
+								'value'            => $invoice->get_state('edit'),
253 253
 								'options'          => $states,
254 254
 								'data-allow-clear' => 'false',
255 255
 								'select2'          => true,
@@ -271,11 +271,11 @@  discard block
 block discarded – undo
271 271
                                         'type'        => 'text',
272 272
                                         'id'          => 'wpinv_zip',
273 273
                                         'name'        => 'wpinv_zip',
274
-                                        'label'       => __( 'Zip / Postal Code', 'invoicing' ),
274
+                                        'label'       => __('Zip / Postal Code', 'invoicing'),
275 275
                                         'label_type'  => 'vertical',
276 276
                                         'placeholder' => '',
277 277
                                         'class'       => 'form-control-sm',
278
-                                        'value'       => $invoice->get_zip( 'edit' ),
278
+                                        'value'       => $invoice->get_zip('edit'),
279 279
                                     ),
280 280
                                     true
281 281
                                 );
@@ -288,11 +288,11 @@  discard block
 block discarded – undo
288 288
                                         'type'        => 'text',
289 289
                                         'id'          => 'wpinv_phone',
290 290
                                         'name'        => 'wpinv_phone',
291
-                                        'label'       => __( 'Phone', 'invoicing' ),
291
+                                        'label'       => __('Phone', 'invoicing'),
292 292
                                         'label_type'  => 'vertical',
293 293
                                         'placeholder' => '',
294 294
                                         'class'       => 'form-control-sm',
295
-                                        'value'       => $invoice->get_phone( 'edit' ),
295
+                                        'value'       => $invoice->get_phone('edit'),
296 296
                                     ),
297 297
                                     true
298 298
                                 );
@@ -300,8 +300,8 @@  discard block
 block discarded – undo
300 300
                         </div>
301 301
                     </div>
302 302
 
303
-                    <?php if ( ! apply_filters( 'getpaid_use_new_invoice_items_metabox', false ) ) : ?>
304
-                        <?php do_action( 'wpinv_meta_box_before_invoice_template_row', $invoice->get_id() ); ?>
303
+                    <?php if (!apply_filters('getpaid_use_new_invoice_items_metabox', false)) : ?>
304
+                        <?php do_action('wpinv_meta_box_before_invoice_template_row', $invoice->get_id()); ?>
305 305
 
306 306
                         <div class="row">
307 307
                             <div class="col-12 col-sm-6">
@@ -310,14 +310,14 @@  discard block
 block discarded – undo
310 310
                                         array(
311 311
                                             'id'          => 'wpinv_template',
312 312
                                             'name'        => 'wpinv_template',
313
-                                            'label'       => __( 'Template', 'invoicing' ),
313
+                                            'label'       => __('Template', 'invoicing'),
314 314
                                             'label_type'  => 'vertical',
315
-                                            'placeholder' => __( 'Choose a template', 'invoicing' ),
315
+                                            'placeholder' => __('Choose a template', 'invoicing'),
316 316
                                             'class'       => 'form-control-sm',
317
-                                            'value'       => $invoice->get_template( 'edit' ),
317
+                                            'value'       => $invoice->get_template('edit'),
318 318
                                             'options'     => array(
319
-                                                'quantity' => __( 'Quantity', 'invoicing' ),
320
-                                                'hours'    => __( 'Hours', 'invoicing' ),
319
+                                                'quantity' => __('Quantity', 'invoicing'),
320
+                                                'hours'    => __('Hours', 'invoicing'),
321 321
                                                 //'amount'   => __( 'Amount Only', 'invoicing' ),
322 322
                                             ),
323 323
                                             'data-allow-clear' => 'false',
@@ -335,11 +335,11 @@  discard block
 block discarded – undo
335 335
                                         array(
336 336
                                             'id'          => 'wpinv_currency',
337 337
                                             'name'        => 'wpinv_currency',
338
-                                            'label'       => __( 'Currency', 'invoicing' ),
338
+                                            'label'       => __('Currency', 'invoicing'),
339 339
                                             'label_type'  => 'vertical',
340
-                                            'placeholder' => __( 'Select Invoice Currency', 'invoicing' ),
340
+                                            'placeholder' => __('Select Invoice Currency', 'invoicing'),
341 341
                                             'class'       => 'form-control-sm getpaid-recalculate-prices-on-change',
342
-                                            'value'       => $invoice->get_currency( 'edit' ),
342
+                                            'value'       => $invoice->get_currency('edit'),
343 343
                                             'required'    => false,
344 344
                                             'data-allow-clear' => 'false',
345 345
                                             'select2'     => true,
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
                             </div>
353 353
                         </div>
354 354
 
355
-                        <?php do_action( 'wpinv_meta_box_invoice_template_row', $invoice->get_id() ); ?>
355
+                        <?php do_action('wpinv_meta_box_invoice_template_row', $invoice->get_id()); ?>
356 356
                     <?php endif; ?>
357 357
 
358 358
                     <div class="row">
@@ -363,11 +363,11 @@  discard block
 block discarded – undo
363 363
                                         'type'        => 'text',
364 364
                                         'id'          => 'wpinv_company_id',
365 365
                                         'name'        => 'wpinv_company_id',
366
-                                        'label'       => __( 'Company ID', 'invoicing' ),
366
+                                        'label'       => __('Company ID', 'invoicing'),
367 367
                                         'label_type'  => 'vertical',
368 368
                                         'placeholder' => '',
369 369
                                         'class'       => 'form-control-sm',
370
-                                        'value'       => $invoice->get_company_id( 'edit' ),
370
+                                        'value'       => $invoice->get_company_id('edit'),
371 371
                                     ),
372 372
                                     true
373 373
                                 );
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
                         </div>
376 376
                     </div>
377 377
 
378
-                    <?php do_action( 'getpaid_after_metabox_invoice_address', $invoice ); ?>
378
+                    <?php do_action('getpaid_after_metabox_invoice_address', $invoice); ?>
379 379
             </div>
380 380
         <?php
381 381
     }
@@ -385,51 +385,51 @@  discard block
 block discarded – undo
385 385
 	 *
386 386
 	 * @param int $post_id
387 387
 	 */
388
-	public static function save( $post_id ) {
388
+	public static function save($post_id) {
389 389
 
390 390
         // Prepare the invoice.
391
-        $invoice = new WPInv_Invoice( $post_id );
391
+        $invoice = new WPInv_Invoice($post_id);
392 392
 
393 393
         // Load new data.
394 394
         $invoice->set_props(
395 395
 			array(
396
-                'template'       => isset( $_POST['wpinv_template'] ) ? wpinv_clean( $_POST['wpinv_template'] ) : null,
397
-                'email_cc'       => isset( $_POST['wpinv_cc'] ) ? wpinv_clean( $_POST['wpinv_cc'] ) : null,
398
-                'disable_taxes'  => ! empty( $_POST['disable_taxes'] ),
399
-                'currency'       => isset( $_POST['wpinv_currency'] ) ? wpinv_clean( $_POST['wpinv_currency'] ) : null,
400
-                'gateway'        => ( $invoice->needs_payment() && isset( $_POST['wpinv_gateway'] ) ) ? wpinv_clean( $_POST['wpinv_gateway'] ) : null,
401
-                'address'        => isset( $_POST['wpinv_address'] ) ? wpinv_clean( $_POST['wpinv_address'] ) : null,
402
-                'vat_number'     => isset( $_POST['wpinv_vat_number'] ) ? wpinv_clean( $_POST['wpinv_vat_number'] ) : null,
403
-                'company'        => isset( $_POST['wpinv_company'] ) ? wpinv_clean( $_POST['wpinv_company'] ) : null,
404
-                'company_id'     => isset( $_POST['wpinv_company_id'] ) ? wpinv_clean( $_POST['wpinv_company_id'] ) : null,
405
-                'zip'            => isset( $_POST['wpinv_zip'] ) ? wpinv_clean( $_POST['wpinv_zip'] ) : null,
406
-                'state'          => isset( $_POST['wpinv_state'] ) ? wpinv_clean( $_POST['wpinv_state'] ) : null,
407
-                'city'           => isset( $_POST['wpinv_city'] ) ? wpinv_clean( $_POST['wpinv_city'] ) : null,
408
-                'country'        => isset( $_POST['wpinv_country'] ) ? wpinv_clean( $_POST['wpinv_country'] ) : null,
409
-                'phone'          => isset( $_POST['wpinv_phone'] ) ? wpinv_clean( $_POST['wpinv_phone'] ) : null,
410
-                'first_name'     => isset( $_POST['wpinv_first_name'] ) ? wpinv_clean( $_POST['wpinv_first_name'] ) : null,
411
-                'last_name'      => isset( $_POST['wpinv_last_name'] ) ? wpinv_clean( $_POST['wpinv_last_name'] ) : null,
412
-                'author'         => isset( $_POST['post_author_override'] ) ? wpinv_clean( $_POST['post_author_override'] ) : null,
413
-                'date_created'   => isset( $_POST['date_created'] ) ? wpinv_clean( $_POST['date_created'] ) : null,
414
-                'date_completed' => isset( $_POST['wpinv_date_completed'] ) ? wpinv_clean( $_POST['wpinv_date_completed'] ) : null,
415
-                'due_date'       => isset( $_POST['wpinv_due_date'] ) ? wpinv_clean( $_POST['wpinv_due_date'] ) : null,
416
-                'number'         => isset( $_POST['wpinv_number'] ) ? wpinv_clean( $_POST['wpinv_number'] ) : null,
417
-                'status'         => isset( $_POST['wpinv_status'] ) ? wpinv_clean( $_POST['wpinv_status'] ) : null,
396
+                'template'       => isset($_POST['wpinv_template']) ? wpinv_clean($_POST['wpinv_template']) : null,
397
+                'email_cc'       => isset($_POST['wpinv_cc']) ? wpinv_clean($_POST['wpinv_cc']) : null,
398
+                'disable_taxes'  => !empty($_POST['disable_taxes']),
399
+                'currency'       => isset($_POST['wpinv_currency']) ? wpinv_clean($_POST['wpinv_currency']) : null,
400
+                'gateway'        => ($invoice->needs_payment() && isset($_POST['wpinv_gateway'])) ? wpinv_clean($_POST['wpinv_gateway']) : null,
401
+                'address'        => isset($_POST['wpinv_address']) ? wpinv_clean($_POST['wpinv_address']) : null,
402
+                'vat_number'     => isset($_POST['wpinv_vat_number']) ? wpinv_clean($_POST['wpinv_vat_number']) : null,
403
+                'company'        => isset($_POST['wpinv_company']) ? wpinv_clean($_POST['wpinv_company']) : null,
404
+                'company_id'     => isset($_POST['wpinv_company_id']) ? wpinv_clean($_POST['wpinv_company_id']) : null,
405
+                'zip'            => isset($_POST['wpinv_zip']) ? wpinv_clean($_POST['wpinv_zip']) : null,
406
+                'state'          => isset($_POST['wpinv_state']) ? wpinv_clean($_POST['wpinv_state']) : null,
407
+                'city'           => isset($_POST['wpinv_city']) ? wpinv_clean($_POST['wpinv_city']) : null,
408
+                'country'        => isset($_POST['wpinv_country']) ? wpinv_clean($_POST['wpinv_country']) : null,
409
+                'phone'          => isset($_POST['wpinv_phone']) ? wpinv_clean($_POST['wpinv_phone']) : null,
410
+                'first_name'     => isset($_POST['wpinv_first_name']) ? wpinv_clean($_POST['wpinv_first_name']) : null,
411
+                'last_name'      => isset($_POST['wpinv_last_name']) ? wpinv_clean($_POST['wpinv_last_name']) : null,
412
+                'author'         => isset($_POST['post_author_override']) ? wpinv_clean($_POST['post_author_override']) : null,
413
+                'date_created'   => isset($_POST['date_created']) ? wpinv_clean($_POST['date_created']) : null,
414
+                'date_completed' => isset($_POST['wpinv_date_completed']) ? wpinv_clean($_POST['wpinv_date_completed']) : null,
415
+                'due_date'       => isset($_POST['wpinv_due_date']) ? wpinv_clean($_POST['wpinv_due_date']) : null,
416
+                'number'         => isset($_POST['wpinv_number']) ? wpinv_clean($_POST['wpinv_number']) : null,
417
+                'status'         => isset($_POST['wpinv_status']) ? wpinv_clean($_POST['wpinv_status']) : null,
418 418
 			)
419 419
         );
420 420
 
421 421
         // Discount code.
422
-        if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
422
+        if (!$invoice->is_paid() && !$invoice->is_refunded()) {
423 423
 
424
-            if ( isset( $_POST['wpinv_discount_code'] ) ) {
425
-                $invoice->set_discount_code( wpinv_clean( $_POST['wpinv_discount_code'] ) );
424
+            if (isset($_POST['wpinv_discount_code'])) {
425
+                $invoice->set_discount_code(wpinv_clean($_POST['wpinv_discount_code']));
426 426
             }
427 427
 
428
-            $discount = new WPInv_Discount( $invoice->get_discount_code() );
429
-            if ( $discount->exists() ) {
430
-                $invoice->add_discount( getpaid_calculate_invoice_discount( $invoice, $discount ) );
428
+            $discount = new WPInv_Discount($invoice->get_discount_code());
429
+            if ($discount->exists()) {
430
+                $invoice->add_discount(getpaid_calculate_invoice_discount($invoice, $discount));
431 431
             } else {
432
-                $invoice->remove_discount( 'discount_code' );
432
+                $invoice->remove_discount('discount_code');
433 433
             }
434 434
 
435 435
             // Recalculate totals.
@@ -438,16 +438,16 @@  discard block
 block discarded – undo
438 438
         }
439 439
 
440 440
         // If we're creating a new user...
441
-        if ( ! empty( $_POST['wpinv_new_user'] ) && is_email( stripslashes( $_POST['wpinv_email'] ) ) ) {
441
+        if (!empty($_POST['wpinv_new_user']) && is_email(stripslashes($_POST['wpinv_email']))) {
442 442
 
443 443
             // Attempt to create the user.
444
-            $user = wpinv_create_user( sanitize_email( stripslashes( $_POST['wpinv_email'] ) ) );
444
+            $user = wpinv_create_user(sanitize_email(stripslashes($_POST['wpinv_email'])));
445 445
 
446 446
             // If successful, update the invoice author.
447
-            if ( is_numeric( $user ) ) {
448
-                $invoice->set_author( $user );
447
+            if (is_numeric($user)) {
448
+                $invoice->set_author($user);
449 449
             } else {
450
-                wpinv_error_log( $user->get_error_message(), __( 'Invoice add new user', 'invoicing' ), __FILE__, __LINE__ );
450
+                wpinv_error_log($user->get_error_message(), __('Invoice add new user', 'invoicing'), __FILE__, __LINE__);
451 451
             }
452 452
         }
453 453
 
@@ -461,16 +461,16 @@  discard block
 block discarded – undo
461 461
         $GLOBALS['wpinv_skip_invoice_notification'] = false;
462 462
 
463 463
         // (Maybe) send new user notification.
464
-        $should_send_notification = wpinv_get_option( 'disable_new_user_emails' );
465
-        if ( ! empty( $user ) && is_numeric( $user ) && apply_filters( 'getpaid_send_new_user_notification', empty( $should_send_notification ) ) ) {
466
-            wp_send_new_user_notifications( $user, 'user' );
464
+        $should_send_notification = wpinv_get_option('disable_new_user_emails');
465
+        if (!empty($user) && is_numeric($user) && apply_filters('getpaid_send_new_user_notification', empty($should_send_notification))) {
466
+            wp_send_new_user_notifications($user, 'user');
467 467
         }
468 468
 
469
-        if ( ! empty( $_POST['send_to_customer'] ) && ! $invoice->is_draft() ) {
470
-            getpaid()->get( 'invoice_emails' )->user_invoice( $invoice, true );
469
+        if (!empty($_POST['send_to_customer']) && !$invoice->is_draft()) {
470
+            getpaid()->get('invoice_emails')->user_invoice($invoice, true);
471 471
         }
472 472
 
473 473
         // Fires after an invoice is saved.
474
-		do_action( 'wpinv_invoice_metabox_saved', $invoice );
474
+		do_action('wpinv_invoice_metabox_saved', $invoice);
475 475
 	}
476 476
 }
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-discount-details.php 1 patch
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  *
8 8
  */
9 9
 
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if (!defined('ABSPATH')) {
11 11
 	exit; // Exit if accessed directly
12 12
 }
13 13
 
@@ -21,24 +21,24 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @param WP_Post $post
23 23
 	 */
24
-    public static function output( $post ) {
24
+    public static function output($post) {
25 25
 
26 26
         // Prepare the discount.
27
-        $discount = new WPInv_Discount( $post );
27
+        $discount = new WPInv_Discount($post);
28 28
 
29 29
         // Nonce field.
30
-        wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' );
30
+        wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce');
31 31
 
32
-        do_action( 'wpinv_discount_form_top', $discount );
32
+        do_action('wpinv_discount_form_top', $discount);
33 33
 
34 34
         // Set the currency position.
35 35
         $position = wpinv_currency_position();
36 36
 
37
-        if ( $position == 'left_space' ) {
37
+        if ($position == 'left_space') {
38 38
             $position = 'left';
39 39
         }
40 40
 
41
-        if ( $position == 'right_space' ) {
41
+        if ($position == 'right_space') {
42 42
             $position = 'right';
43 43
         }
44 44
 
@@ -52,68 +52,68 @@  discard block
 block discarded – undo
52 52
         </style>
53 53
         <div class='bsui' style='max-width: 600px;padding-top: 10px;'>
54 54
 
55
-            <?php do_action( 'wpinv_discount_form_first', $discount ); ?>
55
+            <?php do_action('wpinv_discount_form_first', $discount); ?>
56 56
 
57
-            <?php do_action( 'wpinv_discount_form_before_code', $discount ); ?>
57
+            <?php do_action('wpinv_discount_form_before_code', $discount); ?>
58 58
             <div class="form-group row">
59 59
                 <label for="wpinv_discount_code" class="col-sm-3 col-form-label">
60
-                    <?php esc_html_e( 'Discount Code', 'invoicing' ); ?>
60
+                    <?php esc_html_e('Discount Code', 'invoicing'); ?>
61 61
                 </label>
62 62
                 <div class="col-sm-8">
63 63
                     <div class="row">
64 64
                         <div class="col-sm-12 form-group">
65
-                            <input type="text" value="<?php echo esc_attr( $discount->get_code( 'edit' ) ); ?>" placeholder="SUMMER_SALE" name="wpinv_discount_code" id="wpinv_discount_code" style="width: 100%;" />
65
+                            <input type="text" value="<?php echo esc_attr($discount->get_code('edit')); ?>" placeholder="SUMMER_SALE" name="wpinv_discount_code" id="wpinv_discount_code" style="width: 100%;" />
66 66
                         </div>
67 67
                         <div class="col-sm-12">
68 68
                             <?php
69
-                                do_action( 'wpinv_discount_form_before_single_use', $discount );
69
+                                do_action('wpinv_discount_form_before_single_use', $discount);
70 70
 
71 71
                                 aui()->input(
72 72
                                     array(
73 73
                                         'id'      => 'wpinv_discount_single_use',
74 74
                                         'name'    => 'wpinv_discount_single_use',
75 75
                                         'type'    => 'checkbox',
76
-                                        'label'   => __( 'Each customer can only use this discount once', 'invoicing' ),
76
+                                        'label'   => __('Each customer can only use this discount once', 'invoicing'),
77 77
                                         'value'   => '1',
78 78
                                         'checked' => $discount->is_single_use(),
79 79
                                     ),
80 80
                                     true
81 81
                                 );
82 82
 
83
-                                do_action( 'wpinv_discount_form_single_use', $discount );
83
+                                do_action('wpinv_discount_form_single_use', $discount);
84 84
                             ?>
85 85
                         </div>
86 86
                         <div class="col-sm-12">
87 87
                             <?php
88
-                                do_action( 'wpinv_discount_form_before_recurring', $discount );
88
+                                do_action('wpinv_discount_form_before_recurring', $discount);
89 89
 
90 90
                                 aui()->input(
91 91
                                     array(
92 92
                                         'id'      => 'wpinv_discount_recurring',
93 93
                                         'name'    => 'wpinv_discount_recurring',
94 94
                                         'type'    => 'checkbox',
95
-                                        'label'   => __( 'Apply this discount to all recurring payments for subscriptions', 'invoicing' ),
95
+                                        'label'   => __('Apply this discount to all recurring payments for subscriptions', 'invoicing'),
96 96
                                         'value'   => '1',
97 97
                                         'checked' => $discount->is_recurring(),
98 98
                                     ),
99 99
                                     true
100 100
                                 );
101 101
 
102
-                                do_action( 'wpinv_discount_form_recurring', $discount );
102
+                                do_action('wpinv_discount_form_recurring', $discount);
103 103
                             ?>
104 104
                         </div>
105 105
                     </div>
106 106
                 </div>
107 107
                 <div class="col-sm-1 pt-2 pl-0">
108
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter a discount code such as 10OFF.', 'invoicing' ); ?>"></span>
108
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter a discount code such as 10OFF.', 'invoicing'); ?>"></span>
109 109
                 </div>
110 110
             </div>
111
-            <?php do_action( 'wpinv_discount_form_code', $discount ); ?>
111
+            <?php do_action('wpinv_discount_form_code', $discount); ?>
112 112
 
113
-            <?php do_action( 'wpinv_discount_form_before_type', $discount ); ?>
113
+            <?php do_action('wpinv_discount_form_before_type', $discount); ?>
114 114
             <div class="form-group row">
115 115
                 <label for="wpinv_discount_type" class="col-sm-3 col-form-label">
116
-                    <?php esc_html_e( 'Discount Type', 'invoicing' ); ?>
116
+                    <?php esc_html_e('Discount Type', 'invoicing'); ?>
117 117
                 </label>
118 118
                 <div class="col-sm-8">
119 119
                     <?php
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
                             array(
122 122
                                 'id'               => 'wpinv_discount_type',
123 123
                                 'name'             => 'wpinv_discount_type',
124
-                                'label'            => __( 'Discount Type', 'invoicing' ),
125
-                                'placeholder'      => __( 'Select Discount Type', 'invoicing' ),
126
-                                'value'            => $discount->get_type( 'edit' ),
124
+                                'label'            => __('Discount Type', 'invoicing'),
125
+                                'placeholder'      => __('Select Discount Type', 'invoicing'),
126
+                                'value'            => $discount->get_type('edit'),
127 127
                                 'select2'          => true,
128 128
                                 'data-allow-clear' => 'false',
129 129
                                 'options'          => wpinv_get_discount_types(),
@@ -133,32 +133,32 @@  discard block
 block discarded – undo
133 133
                     ?>
134 134
                 </div>
135 135
                 <div class="col-sm-1 pt-2 pl-0">
136
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Discount type.', 'invoicing' ); ?>"></span>
136
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Discount type.', 'invoicing'); ?>"></span>
137 137
                 </div>
138 138
             </div>
139
-            <?php do_action( 'wpinv_discount_form_type', $discount ); ?>
139
+            <?php do_action('wpinv_discount_form_type', $discount); ?>
140 140
 
141
-            <?php do_action( 'wpinv_discount_form_before_amount', $discount ); ?>
142
-            <div class="form-group row <?php echo esc_attr( $discount->get_type( 'edit' ) ); ?>" id="wpinv_discount_amount_wrap">
141
+            <?php do_action('wpinv_discount_form_before_amount', $discount); ?>
142
+            <div class="form-group row <?php echo esc_attr($discount->get_type('edit')); ?>" id="wpinv_discount_amount_wrap">
143 143
                 <label for="wpinv_discount_amount" class="col-sm-3 col-form-label">
144
-                    <?php esc_html_e( 'Discount Amount', 'invoicing' ); ?>
144
+                    <?php esc_html_e('Discount Amount', 'invoicing'); ?>
145 145
                 </label>
146 146
                 <div class="col-sm-8">
147 147
                     <div class="input-group input-group-sm">
148
-                        <?php if ( 'left' == $position ) : ?>
148
+                        <?php if ('left' == $position) : ?>
149 149
                             <div class="input-group-prepend left wpinv-if-flat">
150 150
                                 <span class="input-group-text">
151
-                                    <?php echo wp_kses_post( wpinv_currency_symbol() ); ?>
151
+                                    <?php echo wp_kses_post(wpinv_currency_symbol()); ?>
152 152
                                 </span>
153 153
                             </div>
154 154
                         <?php endif; ?>
155 155
 
156
-                        <input type="text" name="wpinv_discount_amount" id="wpinv_discount_amount" value="<?php echo esc_attr( $discount->get_amount( 'edit' ) ); ?>" placeholder="0" class="form-control">
156
+                        <input type="text" name="wpinv_discount_amount" id="wpinv_discount_amount" value="<?php echo esc_attr($discount->get_amount('edit')); ?>" placeholder="0" class="form-control">
157 157
 
158
-                        <?php if ( 'right' == $position ) : ?>
158
+                        <?php if ('right' == $position) : ?>
159 159
                             <div class="input-group-prepend left wpinv-if-flat">
160 160
                                 <span class="input-group-text">
161
-                                    <?php echo wp_kses_post( wpinv_currency_symbol() ); ?>
161
+                                    <?php echo wp_kses_post(wpinv_currency_symbol()); ?>
162 162
                                 </span>
163 163
                             </div>
164 164
                         <?php endif; ?>
@@ -168,15 +168,15 @@  discard block
 block discarded – undo
168 168
                     </div>
169 169
                 </div>
170 170
                 <div class="col-sm-1 pt-2 pl-0">
171
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter the discount value. Ex: 10', 'invoicing' ); ?>"></span>
171
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter the discount value. Ex: 10', 'invoicing'); ?>"></span>
172 172
                 </div>
173 173
             </div>
174
-            <?php do_action( 'wpinv_discount_form_amount', $discount ); ?>
174
+            <?php do_action('wpinv_discount_form_amount', $discount); ?>
175 175
 
176
-            <?php do_action( 'wpinv_discount_form_before_items', $discount ); ?>
176
+            <?php do_action('wpinv_discount_form_before_items', $discount); ?>
177 177
             <div class="form-group row">
178 178
                 <label for="wpinv_discount_items" class="col-sm-3 col-form-label">
179
-                    <?php esc_html_e( 'Items', 'invoicing' ); ?>
179
+                    <?php esc_html_e('Items', 'invoicing'); ?>
180 180
                 </label>
181 181
                 <div class="col-sm-8">
182 182
                     <?php
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
                             array(
185 185
                                 'id'               => 'wpinv_discount_items',
186 186
                                 'name'             => 'wpinv_discount_items[]',
187
-                                'label'            => __( 'Items', 'invoicing' ),
188
-                                'placeholder'      => __( 'Select Items', 'invoicing' ),
189
-                                'value'            => $discount->get_items( 'edit' ),
187
+                                'label'            => __('Items', 'invoicing'),
188
+                                'placeholder'      => __('Select Items', 'invoicing'),
189
+                                'value'            => $discount->get_items('edit'),
190 190
                                 'select2'          => true,
191 191
                                 'multiple'         => true,
192 192
                                 'data-allow-clear' => 'false',
@@ -197,15 +197,15 @@  discard block
 block discarded – undo
197 197
                     ?>
198 198
                 </div>
199 199
                 <div class="col-sm-1 pt-2 pl-0">
200
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Select the items that are allowed to use this discount or leave blank to use this discount all items.', 'invoicing' ); ?>"></span>
200
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Select the items that are allowed to use this discount or leave blank to use this discount all items.', 'invoicing'); ?>"></span>
201 201
                 </div>
202 202
             </div>
203
-            <?php do_action( 'wpinv_discount_form_items', $discount ); ?>
203
+            <?php do_action('wpinv_discount_form_items', $discount); ?>
204 204
 
205
-            <?php do_action( 'wpinv_discount_form_before_excluded_items', $discount ); ?>
205
+            <?php do_action('wpinv_discount_form_before_excluded_items', $discount); ?>
206 206
             <div class="form-group row">
207 207
                 <label for="wpinv_discount_excluded_items" class="col-sm-3 col-form-label">
208
-                    <?php esc_html_e( 'Excluded Items', 'invoicing' ); ?>
208
+                    <?php esc_html_e('Excluded Items', 'invoicing'); ?>
209 209
                 </label>
210 210
                 <div class="col-sm-8">
211 211
                     <?php
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
                             array(
214 214
                                 'id'               => 'wpinv_discount_excluded_items',
215 215
                                 'name'             => 'wpinv_discount_excluded_items[]',
216
-                                'label'            => __( 'Excluded Items', 'invoicing' ),
217
-                                'placeholder'      => __( 'Select Items', 'invoicing' ),
218
-                                'value'            => $discount->get_excluded_items( 'edit' ),
216
+                                'label'            => __('Excluded Items', 'invoicing'),
217
+                                'placeholder'      => __('Select Items', 'invoicing'),
218
+                                'value'            => $discount->get_excluded_items('edit'),
219 219
                                 'select2'          => true,
220 220
                                 'multiple'         => true,
221 221
                                 'data-allow-clear' => 'false',
@@ -226,15 +226,15 @@  discard block
 block discarded – undo
226 226
                     ?>
227 227
                 </div>
228 228
                 <div class="col-sm-1 pt-2 pl-0">
229
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Select all the items that are not allowed to use this discount.', 'invoicing' ); ?>"></span>
229
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Select all the items that are not allowed to use this discount.', 'invoicing'); ?>"></span>
230 230
                 </div>
231 231
             </div>
232
-            <?php do_action( 'wpinv_discount_form_excluded_items', $discount ); ?>
232
+            <?php do_action('wpinv_discount_form_excluded_items', $discount); ?>
233 233
 
234
-            <?php do_action( 'wpinv_discount_form_before_required_items', $discount ); ?>
234
+            <?php do_action('wpinv_discount_form_before_required_items', $discount); ?>
235 235
             <div class="form-group row">
236 236
                 <label for="wpinv_discount_required_items" class="col-sm-3 col-form-label">
237
-                    <?php esc_html_e( 'Required Items', 'invoicing' ); ?>
237
+                    <?php esc_html_e('Required Items', 'invoicing'); ?>
238 238
                 </label>
239 239
                 <div class="col-sm-8">
240 240
                     <?php
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
                             array(
243 243
                                 'id'               => 'wpinv_discount_required_items',
244 244
                                 'name'             => 'wpinv_discount_required_items[]',
245
-                                'label'            => __( 'Required Items', 'invoicing' ),
246
-                                'placeholder'      => __( 'Select Items', 'invoicing' ),
247
-                                'value'            => $discount->get_required_items( 'edit' ),
245
+                                'label'            => __('Required Items', 'invoicing'),
246
+                                'placeholder'      => __('Select Items', 'invoicing'),
247
+                                'value'            => $discount->get_required_items('edit'),
248 248
                                 'select2'          => true,
249 249
                                 'multiple'         => true,
250 250
                                 'data-allow-clear' => 'false',
@@ -255,15 +255,15 @@  discard block
 block discarded – undo
255 255
                     ?>
256 256
                 </div>
257 257
                 <div class="col-sm-1 pt-2 pl-0">
258
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Select all the items that are required to be in the cart before using this discount.', 'invoicing' ); ?>"></span>
258
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Select all the items that are required to be in the cart before using this discount.', 'invoicing'); ?>"></span>
259 259
                 </div>
260 260
             </div>
261
-            <?php do_action( 'wpinv_discount_form_required_items', $discount ); ?>
261
+            <?php do_action('wpinv_discount_form_required_items', $discount); ?>
262 262
 
263
-            <?php do_action( 'wpinv_discount_form_before_start', $discount ); ?>
263
+            <?php do_action('wpinv_discount_form_before_start', $discount); ?>
264 264
             <div class="form-group row">
265 265
                 <label for="wpinv_discount_start" class="col-sm-3 col-form-label">
266
-                    <?php esc_html_e( 'Start Date', 'invoicing' ); ?>
266
+                    <?php esc_html_e('Start Date', 'invoicing'); ?>
267 267
                 </label>
268 268
                 <div class="col-sm-8">
269 269
                     <?php
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
                                 'type'             => 'datepicker',
273 273
                                 'id'               => 'wpinv_discount_start',
274 274
                                 'name'             => 'wpinv_discount_start',
275
-                                'label'            => __( 'Start Date', 'invoicing' ),
275
+                                'label'            => __('Start Date', 'invoicing'),
276 276
                                 'placeholder'      => 'YYYY-MM-DD 00:00',
277 277
                                 'class'            => 'form-control-sm',
278
-                                'value'            => $discount->get_start_date( 'edit' ),
278
+                                'value'            => $discount->get_start_date('edit'),
279 279
                                 'extra_attributes' => array(
280 280
                                     'data-enable-time' => 'true',
281 281
                                     'data-time_24hr'   => 'true',
@@ -287,15 +287,15 @@  discard block
 block discarded – undo
287 287
                     ?>
288 288
                 </div>
289 289
                 <div class="col-sm-1 pt-2 pl-0">
290
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'For no start date, leave blank. If entered, the discount can only be used after or on this date.', 'invoicing' ); ?>"></span>
290
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('For no start date, leave blank. If entered, the discount can only be used after or on this date.', 'invoicing'); ?>"></span>
291 291
                 </div>
292 292
             </div>
293
-            <?php do_action( 'wpinv_discount_form_start', $discount ); ?>
293
+            <?php do_action('wpinv_discount_form_start', $discount); ?>
294 294
 
295
-            <?php do_action( 'wpinv_discount_form_before_expiration', $discount ); ?>
295
+            <?php do_action('wpinv_discount_form_before_expiration', $discount); ?>
296 296
             <div class="form-group row">
297 297
                 <label for="wpinv_discount_expiration" class="col-sm-3 col-form-label">
298
-                    <?php esc_html_e( 'Expiration Date', 'invoicing' ); ?>
298
+                    <?php esc_html_e('Expiration Date', 'invoicing'); ?>
299 299
                 </label>
300 300
                 <div class="col-sm-8">
301 301
                     <?php
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
                                 'type'             => 'datepicker',
305 305
                                 'id'               => 'wpinv_discount_expiration',
306 306
                                 'name'             => 'wpinv_discount_expiration',
307
-                                'label'            => __( 'Expiration Date', 'invoicing' ),
307
+                                'label'            => __('Expiration Date', 'invoicing'),
308 308
                                 'placeholder'      => 'YYYY-MM-DD 00:00',
309 309
                                 'class'            => 'form-control-sm',
310
-                                'value'            => $discount->get_end_date( 'edit' ),
310
+                                'value'            => $discount->get_end_date('edit'),
311 311
                                 'extra_attributes' => array(
312 312
                                     'data-enable-time' => 'true',
313 313
                                     'data-time_24hr'   => 'true',
@@ -321,86 +321,86 @@  discard block
 block discarded – undo
321 321
                     ?>
322 322
                 </div>
323 323
                 <div class="col-sm-1 pt-2 pl-0">
324
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the date after which the discount will expire.', 'invoicing' ); ?>"></span>
324
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the date after which the discount will expire.', 'invoicing'); ?>"></span>
325 325
                 </div>
326 326
             </div>
327
-            <?php do_action( 'wpinv_discount_form_expiration', $discount ); ?>
327
+            <?php do_action('wpinv_discount_form_expiration', $discount); ?>
328 328
 
329
-            <?php do_action( 'wpinv_discount_form_before_min_total', $discount ); ?>
329
+            <?php do_action('wpinv_discount_form_before_min_total', $discount); ?>
330 330
             <div class="form-group row">
331 331
                 <label for="wpinv_discount_min_total" class="col-sm-3 col-form-label">
332
-                    <?php esc_html_e( 'Minimum Amount', 'invoicing' ); ?>
332
+                    <?php esc_html_e('Minimum Amount', 'invoicing'); ?>
333 333
                 </label>
334 334
                 <div class="col-sm-8">
335 335
                     <div class="input-group input-group-sm">
336
-                        <?php if ( 'left' == $position ) : ?>
336
+                        <?php if ('left' == $position) : ?>
337 337
                             <div class="input-group-prepend">
338
-                                <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span>
338
+                                <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span>
339 339
                             </div>
340 340
                         <?php endif; ?>
341 341
 
342
-                        <input type="text" name="wpinv_discount_min_total" id="wpinv_discount_min_total" value="<?php echo esc_attr( $discount->get_minimum_total( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'No minimum', 'invoicing' ); ?>" class="form-control">
342
+                        <input type="text" name="wpinv_discount_min_total" id="wpinv_discount_min_total" value="<?php echo esc_attr($discount->get_minimum_total('edit')); ?>" placeholder="<?php esc_attr_e('No minimum', 'invoicing'); ?>" class="form-control">
343 343
 
344
-                        <?php if ( 'left' != $position ) : ?>
344
+                        <?php if ('left' != $position) : ?>
345 345
                             <div class="input-group-append">
346
-                                <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span>
346
+                                <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span>
347 347
                             </div>
348 348
                         <?php endif; ?>
349 349
                     </div>
350 350
                 </div>
351 351
                 <div class="col-sm-1 pt-2 pl-0">
352
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the minimum amount (including taxes) required to use this discount.', 'invoicing' ); ?>"></span>
352
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the minimum amount (including taxes) required to use this discount.', 'invoicing'); ?>"></span>
353 353
                 </div>
354 354
             </div>
355
-            <?php do_action( 'wpinv_discount_form_min_total', $discount ); ?>
355
+            <?php do_action('wpinv_discount_form_min_total', $discount); ?>
356 356
 
357
-            <?php do_action( 'wpinv_discount_form_before_max_total', $discount ); ?>
357
+            <?php do_action('wpinv_discount_form_before_max_total', $discount); ?>
358 358
             <div class="form-group row">
359 359
                 <label for="wpinv_discount_max_total" class="col-sm-3 col-form-label">
360
-                    <?php esc_html_e( 'Maximum Amount', 'invoicing' ); ?>
360
+                    <?php esc_html_e('Maximum Amount', 'invoicing'); ?>
361 361
                 </label>
362 362
                 <div class="col-sm-8">
363 363
                     <div class="input-group input-group-sm">
364
-                        <?php if ( 'left' == $position ) : ?>
364
+                        <?php if ('left' == $position) : ?>
365 365
                             <div class="input-group-prepend">
366
-                                <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span>
366
+                                <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span>
367 367
                             </div>
368 368
                         <?php endif; ?>
369 369
 
370
-                        <input type="text" name="wpinv_discount_max_total" id="wpinv_discount_max_total" value="<?php echo esc_attr( $discount->get_maximum_total( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'No maximum', 'invoicing' ); ?>" class="form-control">
370
+                        <input type="text" name="wpinv_discount_max_total" id="wpinv_discount_max_total" value="<?php echo esc_attr($discount->get_maximum_total('edit')); ?>" placeholder="<?php esc_attr_e('No maximum', 'invoicing'); ?>" class="form-control">
371 371
 
372
-                        <?php if ( 'left' != $position ) : ?>
372
+                        <?php if ('left' != $position) : ?>
373 373
                             <div class="input-group-append">
374
-                                <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span>
374
+                                <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span>
375 375
                             </div>
376 376
                         <?php endif; ?>
377 377
                     </div>
378 378
                 </div>
379 379
                 <div class="col-sm-1 pt-2 pl-0">
380
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the maximum amount (including taxes) allowed when using this discount.', 'invoicing' ); ?>"></span>
380
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the maximum amount (including taxes) allowed when using this discount.', 'invoicing'); ?>"></span>
381 381
                 </div>
382 382
             </div>
383
-            <?php do_action( 'wpinv_discount_form_before_max_total', $discount ); ?>
383
+            <?php do_action('wpinv_discount_form_before_max_total', $discount); ?>
384 384
 
385
-            <?php do_action( 'wpinv_discount_form_before_max_uses', $discount ); ?>
385
+            <?php do_action('wpinv_discount_form_before_max_uses', $discount); ?>
386 386
             <div class="form-group row">
387 387
                 <label for="wpinv_discount_max_uses" class="col-sm-3 col-form-label">
388
-                    <?php esc_html_e( 'Maximum Uses', 'invoicing' ); ?>
388
+                    <?php esc_html_e('Maximum Uses', 'invoicing'); ?>
389 389
                 </label>
390 390
                 <div class="col-sm-8">
391
-                    <input type="text" value="<?php echo esc_attr( $discount->get_max_uses( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'Unlimited', 'invoicing' ); ?>" name="wpinv_discount_max_uses" id="wpinv_discount_max_uses" style="width: 100%;" />
391
+                    <input type="text" value="<?php echo esc_attr($discount->get_max_uses('edit')); ?>" placeholder="<?php esc_attr_e('Unlimited', 'invoicing'); ?>" name="wpinv_discount_max_uses" id="wpinv_discount_max_uses" style="width: 100%;" />
392 392
                 </div>
393 393
                 <div class="col-sm-1 pt-2 pl-0">
394
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the maximum number of times that this discount code can be used.', 'invoicing' ); ?>"></span>
394
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the maximum number of times that this discount code can be used.', 'invoicing'); ?>"></span>
395 395
                 </div>
396 396
             </div>
397
-            <?php do_action( 'wpinv_discount_form_max_uses', $discount ); ?>
397
+            <?php do_action('wpinv_discount_form_max_uses', $discount); ?>
398 398
 
399
-            <?php do_action( 'wpinv_discount_form_last', $discount ); ?>
399
+            <?php do_action('wpinv_discount_form_last', $discount); ?>
400 400
 
401 401
         </div>
402 402
         <?php
403
-        do_action( 'wpinv_discount_form_bottom', $post );
403
+        do_action('wpinv_discount_form_bottom', $post);
404 404
     }
405 405
 
406 406
     /**
@@ -408,31 +408,31 @@  discard block
 block discarded – undo
408 408
 	 *
409 409
 	 * @param int $post_id
410 410
 	 */
411
-	public static function save( $post_id ) {
411
+	public static function save($post_id) {
412 412
 
413 413
         // Prepare the discount.
414
-        $discount = new WPInv_Discount( $post_id );
414
+        $discount = new WPInv_Discount($post_id);
415 415
 
416 416
         // Load new data.
417 417
         $discount->set_props(
418 418
 			array(
419
-				'code'           => isset( $_POST['wpinv_discount_code'] ) ? wpinv_clean( $_POST['wpinv_discount_code'] ) : null,
420
-				'amount'         => isset( $_POST['wpinv_discount_amount'] ) ? floatval( $_POST['wpinv_discount_amount'] ) : null,
421
-				'start'          => isset( $_POST['wpinv_discount_start'] ) ? wpinv_clean( $_POST['wpinv_discount_start'] ) : null,
422
-				'expiration'     => isset( $_POST['wpinv_discount_expiration'] ) ? wpinv_clean( $_POST['wpinv_discount_expiration'] ) : null,
423
-				'is_single_use'  => ! empty( $_POST['wpinv_discount_single_use'] ),
424
-                'type'           => isset( $_POST['wpinv_discount_type'] ) ? wpinv_clean( $_POST['wpinv_discount_type'] ) : null,
425
-				'is_recurring'   => ! empty( $_POST['wpinv_discount_recurring'] ),
426
-				'items'          => isset( $_POST['wpinv_discount_items'] ) ? wpinv_clean( $_POST['wpinv_discount_items'] ) : array(),
427
-				'excluded_items' => isset( $_POST['wpinv_discount_excluded_items'] ) ? wpinv_clean( $_POST['wpinv_discount_excluded_items'] ) : array(),
428
-                'required_items' => isset( $_POST['wpinv_discount_required_items'] ) ? wpinv_clean( $_POST['wpinv_discount_required_items'] ) : array(),
429
-				'max_uses'       => isset( $_POST['wpinv_discount_max_uses'] ) ? intval( $_POST['wpinv_discount_max_uses'] ) : null,
430
-				'min_total'      => isset( $_POST['wpinv_discount_min_total'] ) ? floatval( $_POST['wpinv_discount_min_total'] ) : null,
431
-				'max_total'      => isset( $_POST['wpinv_discount_max_total'] ) ? floatval( $_POST['wpinv_discount_max_total'] ) : null,
419
+				'code'           => isset($_POST['wpinv_discount_code']) ? wpinv_clean($_POST['wpinv_discount_code']) : null,
420
+				'amount'         => isset($_POST['wpinv_discount_amount']) ? floatval($_POST['wpinv_discount_amount']) : null,
421
+				'start'          => isset($_POST['wpinv_discount_start']) ? wpinv_clean($_POST['wpinv_discount_start']) : null,
422
+				'expiration'     => isset($_POST['wpinv_discount_expiration']) ? wpinv_clean($_POST['wpinv_discount_expiration']) : null,
423
+				'is_single_use'  => !empty($_POST['wpinv_discount_single_use']),
424
+                'type'           => isset($_POST['wpinv_discount_type']) ? wpinv_clean($_POST['wpinv_discount_type']) : null,
425
+				'is_recurring'   => !empty($_POST['wpinv_discount_recurring']),
426
+				'items'          => isset($_POST['wpinv_discount_items']) ? wpinv_clean($_POST['wpinv_discount_items']) : array(),
427
+				'excluded_items' => isset($_POST['wpinv_discount_excluded_items']) ? wpinv_clean($_POST['wpinv_discount_excluded_items']) : array(),
428
+                'required_items' => isset($_POST['wpinv_discount_required_items']) ? wpinv_clean($_POST['wpinv_discount_required_items']) : array(),
429
+				'max_uses'       => isset($_POST['wpinv_discount_max_uses']) ? intval($_POST['wpinv_discount_max_uses']) : null,
430
+				'min_total'      => isset($_POST['wpinv_discount_min_total']) ? floatval($_POST['wpinv_discount_min_total']) : null,
431
+				'max_total'      => isset($_POST['wpinv_discount_max_total']) ? floatval($_POST['wpinv_discount_max_total']) : null,
432 432
 			)
433 433
         );
434 434
 
435 435
 		$discount->save();
436
-		do_action( 'getpaid_discount_metabox_save', $post_id, $discount );
436
+		do_action('getpaid_discount_metabox_save', $post_id, $discount);
437 437
 	}
438 438
 }
Please login to merge, or discard this patch.
includes/admin/views/html-tax-rate-edit.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @var array $tax_rate
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 ?>
12 12
 
@@ -18,13 +18,13 @@  discard block
 block discarded – undo
18 18
             aui()->select(
19 19
                 array(
20 20
                     'options' => array_merge(
21
-                        array( '' => __( 'All Countries', 'invoicing' ) ),
21
+                        array('' => __('All Countries', 'invoicing')),
22 22
                         wpinv_get_country_list()
23 23
                     ),
24 24
                     'name'    => "tax_rates[$key][country]",
25
-                    'id'      => uniqid( 'tax_rate_country' ),
26
-                    'value'   => esc_html( $tax_rate['country'] ),
27
-                    'label'   => __( 'Country', 'invoicing' ),
25
+                    'id'      => uniqid('tax_rate_country'),
26
+                    'value'   => esc_html($tax_rate['country']),
27
+                    'label'   => __('Country', 'invoicing'),
28 28
                     'class'   => 'wpinv_country',
29 29
                     'no_wrap' => true,
30 30
                 ),
@@ -37,35 +37,35 @@  discard block
 block discarded – undo
37 37
     <td class="wpinv_tax_state">
38 38
 
39 39
         <label class="w-100">
40
-            <span class="screen-reader-text"><?php esc_html_e( 'States', 'invoicing' ); ?></span>
41
-            <input type="text" placeholder="<?php esc_attr_e( 'Apply to whole country', 'invoicing' ); ?>" name="tax_rates[<?php echo esc_attr( $key ); ?>][state]" value="<?php echo empty( $tax_rate['global'] ) ? esc_attr( $tax_rate['state'] ) : ''; ?>"/>
40
+            <span class="screen-reader-text"><?php esc_html_e('States', 'invoicing'); ?></span>
41
+            <input type="text" placeholder="<?php esc_attr_e('Apply to whole country', 'invoicing'); ?>" name="tax_rates[<?php echo esc_attr($key); ?>][state]" value="<?php echo empty($tax_rate['global']) ? esc_attr($tax_rate['state']) : ''; ?>"/>
42 42
         </label>
43 43
 
44 44
     </td>
45 45
 
46 46
     <td class="wpinv_standard_rate">
47 47
         <label class="w-100">
48
-            <span class="screen-reader-text"><?php esc_html_e( 'Standard Rate', 'invoicing' ); ?></span>
49
-            <input type="number" step="any" min="0" max="99" name="tax_rates[<?php echo esc_attr( $key ); ?>][rate]" value="<?php echo esc_attr( $tax_rate['rate'] ); ?>"/>
48
+            <span class="screen-reader-text"><?php esc_html_e('Standard Rate', 'invoicing'); ?></span>
49
+            <input type="number" step="any" min="0" max="99" name="tax_rates[<?php echo esc_attr($key); ?>][rate]" value="<?php echo esc_attr($tax_rate['rate']); ?>"/>
50 50
         </label>
51 51
     </td>
52 52
 
53 53
     <td class="wpinv_reduced_rate">
54 54
         <label class="w-100">
55
-            <span class="screen-reader-text"><?php esc_html_e( 'Reduced Rate', 'invoicing' ); ?></span>
56
-            <input type="number" step="any" min="0" max="99" name="tax_rates[<?php echo esc_attr( $key ); ?>][reduced_rate]" value="<?php echo esc_attr( $tax_rate['reduced_rate'] ); ?>"/>
55
+            <span class="screen-reader-text"><?php esc_html_e('Reduced Rate', 'invoicing'); ?></span>
56
+            <input type="number" step="any" min="0" max="99" name="tax_rates[<?php echo esc_attr($key); ?>][reduced_rate]" value="<?php echo esc_attr($tax_rate['reduced_rate']); ?>"/>
57 57
         </label>
58 58
     </td>
59 59
 
60 60
     <td class="wpinv_tax_name">
61 61
         <label class="w-100">
62
-            <span class="screen-reader-text"><?php esc_html_e( 'Tax Name', 'invoicing' ); ?></span>
63
-            <input type="text" name="tax_rates[<?php echo esc_attr( $key ); ?>][name]" value="<?php echo esc_attr( $tax_rate['name'] ); ?>"/>
62
+            <span class="screen-reader-text"><?php esc_html_e('Tax Name', 'invoicing'); ?></span>
63
+            <input type="text" name="tax_rates[<?php echo esc_attr($key); ?>][name]" value="<?php echo esc_attr($tax_rate['name']); ?>"/>
64 64
         </label>
65 65
     </td>
66 66
 
67 67
     <td class="wpinv_tax_remove">
68
-        <button type="button" class="close wpinv_remove_tax_rate" aria-label="<?php esc_attr_e( 'Delete', 'invoicing' ); ?>" title="<?php esc_attr_e( 'Delete', 'invoicing' ); ?>">
68
+        <button type="button" class="close wpinv_remove_tax_rate" aria-label="<?php esc_attr_e('Delete', 'invoicing'); ?>" title="<?php esc_attr_e('Delete', 'invoicing'); ?>">
69 69
             <span aria-hidden="true">&times;</span>
70 70
         </button>
71 71
     </td>
Please login to merge, or discard this patch.