Passed
Push — master ( ff3d3b...35d84f )
by Brian
05:12
created
includes/admin/meta-boxes/class-mb-invoice-details.php 1 patch
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -1,32 +1,32 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // MUST have WordPress.
3
-if ( !defined( 'WPINC' ) ) {
4
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
3
+if (!defined('WPINC')) {
4
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
5 5
 }
6 6
 
7 7
 class WPInv_Meta_Box_Details {
8
-    public static function output( $post ) {
8
+    public static function output($post) {
9 9
         global $wpinv_euvat;
10 10
 
11 11
         $currency_symbol    = wpinv_currency_symbol();
12
-        $statuses           = wpinv_get_invoice_statuses( true );
12
+        $statuses           = wpinv_get_invoice_statuses(true);
13 13
 
14
-        $post_id            = !empty( $post->ID ) ? $post->ID : 0;
15
-        $invoice            = new WPInv_Invoice( $post_id );
16
-        $status             = $invoice->get_status( false ); // Current status    
14
+        $post_id            = !empty($post->ID) ? $post->ID : 0;
15
+        $invoice            = new WPInv_Invoice($post_id);
16
+        $status             = $invoice->get_status(false); // Current status    
17 17
         $discount           = $invoice->get_discount();
18 18
         $discount_code      = $discount > 0 ? $invoice->get_discount_code() : '';
19 19
         $invoice_number     = $invoice->get_number();
20 20
         $taxable            = $invoice->is_taxable();
21 21
 
22 22
         $date_created       = $invoice->get_created_date();
23
-        $datetime_created   = strtotime( $date_created );
24
-        $date_created       = $date_created != '' && $date_created != '0000-00-00 00:00:00' ? date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $datetime_created ) : '';
23
+        $datetime_created   = strtotime($date_created);
24
+        $date_created       = $date_created != '' && $date_created != '0000-00-00 00:00:00' ? date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $datetime_created) : '';
25 25
         $date_completed     = $invoice->get_completed_date();
26
-        $date_completed     = $date_completed != '' && $date_completed != '0000-00-00 00:00:00' ? date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), strtotime( $date_completed ) ) : 'n/a';
27
-        $title['status'] = __( 'Invoice Status:', 'invoicing' );
28
-        $title['number'] = __( 'Invoice Number:', 'invoicing' );
29
-        $mail_notice = esc_attr__( 'After saving invoice, this will send a copy of the invoice to the user&#8217;s email address.', 'invoicing' );
26
+        $date_completed     = $date_completed != '' && $date_completed != '0000-00-00 00:00:00' ? date_i18n(get_option('date_format') . ' ' . get_option('time_format'), strtotime($date_completed)) : 'n/a';
27
+        $title['status'] = __('Invoice Status:', 'invoicing');
28
+        $title['number'] = __('Invoice Number:', 'invoicing');
29
+        $mail_notice = esc_attr__('After saving invoice, this will send a copy of the invoice to the user&#8217;s email address.', 'invoicing');
30 30
 
31 31
         $title = apply_filters('wpinv_details_metabox_titles', $title, $invoice);
32 32
         $statuses = apply_filters('wpinv_invoice_statuses', $statuses, $invoice);
@@ -36,36 +36,36 @@  discard block
 block discarded – undo
36 36
 <div class="gdmbx2-wrap form-table">
37 37
     <div class="gdmbx2-metabox gdmbx-field-list" id="gdmbx2-metabox-wpinv_details">
38 38
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-created">
39
-            <div class="gdmbx-th"><label><?php _e( 'Date Created:', 'invoicing' );?></label></div>
40
-            <div class="gdmbx-td"><?php echo $date_created;?></div>
39
+            <div class="gdmbx-th"><label><?php _e('Date Created:', 'invoicing'); ?></label></div>
40
+            <div class="gdmbx-td"><?php echo $date_created; ?></div>
41 41
         </div>
42
-        <?php if ( $invoice->post_type == 'wpi_invoice' && wpinv_get_option( 'overdue_active' ) && ( $invoice->needs_payment() || $invoice->has_status( array( 'auto-draft', 'draft' ) ) ) ) { ?>
42
+        <?php if ($invoice->post_type == 'wpi_invoice' && wpinv_get_option('overdue_active') && ($invoice->needs_payment() || $invoice->has_status(array('auto-draft', 'draft')))) { ?>
43 43
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-overdue">
44
-            <div class="gdmbx-th"><label for="wpinv_due_date"><?php _e( 'Due Date:', 'invoicing' );?></label></div>
44
+            <div class="gdmbx-th"><label for="wpinv_due_date"><?php _e('Due Date:', 'invoicing'); ?></label></div>
45 45
             <div class="gdmbx-td">
46
-                <input type="text" placeholder="<?php esc_attr_e( 'Y-m-d', 'invoicing' );?>" value="<?php echo esc_attr( $invoice->get_due_date() );?>" id="wpinv_due_date" name="wpinv_due_date" class="regular-text wpiDatepicker" data-minDate="<?php echo esc_attr( date_i18n( 'Y-m-d', $datetime_created ) );?>" data-dateFormat="yy-mm-dd">
47
-                <p class="wpi-meta-row wpi-meta-desc"><?php _e( 'Leave blank to disable sending auto reminder for this invoice.', 'invoicing' );?></p>
46
+                <input type="text" placeholder="<?php esc_attr_e('Y-m-d', 'invoicing'); ?>" value="<?php echo esc_attr($invoice->get_due_date()); ?>" id="wpinv_due_date" name="wpinv_due_date" class="regular-text wpiDatepicker" data-minDate="<?php echo esc_attr(date_i18n('Y-m-d', $datetime_created)); ?>" data-dateFormat="yy-mm-dd">
47
+                <p class="wpi-meta-row wpi-meta-desc"><?php _e('Leave blank to disable sending auto reminder for this invoice.', 'invoicing'); ?></p>
48 48
             </div>
49 49
         </div>
50 50
         <?php } ?>
51
-        <?php do_action( 'wpinv_meta_box_details_after_due_date', $post_id ); ?>
52
-        <?php if ( $date_completed && $date_completed != 'n/a' ) { ?>
51
+        <?php do_action('wpinv_meta_box_details_after_due_date', $post_id); ?>
52
+        <?php if ($date_completed && $date_completed != 'n/a') { ?>
53 53
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-completed">
54
-            <div class="gdmbx-th"><label><?php _e( 'Payment Date:', 'invoicing' );?></label></div>
55
-            <div class="gdmbx-td"><?php echo $date_completed;?></div>
54
+            <div class="gdmbx-th"><label><?php _e('Payment Date:', 'invoicing'); ?></label></div>
55
+            <div class="gdmbx-td"><?php echo $date_completed; ?></div>
56 56
         </div>
57 57
         <?php } ?>
58
-        <?php $is_viewed = wpinv_is_invoice_viewed( $post_id ); ?>
58
+        <?php $is_viewed = wpinv_is_invoice_viewed($post_id); ?>
59 59
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-customer-viewed">
60
-            <div class="gdmbx-th"><label><?php _e( 'Viewed by Customer:', 'invoicing' );?></label></div>
61
-            <div class="gdmbx-td"><?php ( 1 == $is_viewed ) ? _e( 'Yes', 'invoicing' ) : _e( 'No', 'invoicing' ); ?></div>
60
+            <div class="gdmbx-th"><label><?php _e('Viewed by Customer:', 'invoicing'); ?></label></div>
61
+            <div class="gdmbx-td"><?php (1 == $is_viewed) ? _e('Yes', 'invoicing') : _e('No', 'invoicing'); ?></div>
62 62
         </div>
63 63
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-status">
64 64
             <div class="gdmbx-th"><label for="wpinv_status"><?php echo $title['status']; ?></label></div>
65 65
             <div class="gdmbx-td">
66 66
                 <select required="required" id="wpinv_status" name="wpinv_status" class="gdmbx2_select wpi_select2">
67
-                    <?php foreach ( $statuses as $value => $label ) { ?>
68
-                    <option value="<?php echo $value;?>" <?php selected( $status, $value );?>><?php echo $label;?></option>
67
+                    <?php foreach ($statuses as $value => $label) { ?>
68
+                    <option value="<?php echo $value; ?>" <?php selected($status, $value); ?>><?php echo $label; ?></option>
69 69
                     <?php } ?>
70 70
                 </select>
71 71
             </div>
@@ -74,129 +74,129 @@  discard block
 block discarded – undo
74 74
         <div class="gdmbx-row gdmbx-type-text gdmbx2-id-wpinv-number table-layout">
75 75
             <div class="gdmbx-th"><label for="wpinv_number"><?php echo $title['number']; ?></label></div>
76 76
             <div class="gdmbx-td">
77
-                <input type="text" value="<?php echo esc_attr( $invoice_number );?>" id="wpinv_number" name="wpinv_number" class="regular-text" readonly>
77
+                <input type="text" value="<?php echo esc_attr($invoice_number); ?>" id="wpinv_number" name="wpinv_number" class="regular-text" readonly>
78 78
             </div>
79 79
         </div>
80
-        <?php do_action( 'wpinv_meta_box_details_inner', $post_id );
80
+        <?php do_action('wpinv_meta_box_details_inner', $post_id);
81 81
         $disable_discount = apply_filters('wpinv_disable_apply_discount', false, $invoice, $post_id);
82 82
         ?>
83 83
 
84
-        <?php if ( $wpinv_euvat->allow_vat_rules() && ! ( $invoice->is_paid() || $invoice->is_refunded() ) ) { ?>
84
+        <?php if ($wpinv_euvat->allow_vat_rules() && !($invoice->is_paid() || $invoice->is_refunded())) { ?>
85 85
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-taxable">
86 86
             <div class="gdmbx-th">
87 87
                 <label for="wpinv_taxable">
88
-                    <input type="checkbox" name="disable_taxes" value="1" <?php checked( $taxable, false ); ?> id="wpinv_taxable">
89
-                    <?php _e( 'Disable taxes', 'invoicing' ); ?>
88
+                    <input type="checkbox" name="disable_taxes" value="1" <?php checked($taxable, false); ?> id="wpinv_taxable">
89
+                    <?php _e('Disable taxes', 'invoicing'); ?>
90 90
                 </label>
91 91
             </div>
92 92
         </div>
93 93
         <?php } ?>
94 94
 
95
-        <?php if ( !( $is_paid = ( $invoice->is_paid() || $invoice->is_refunded() ) ) && !$disable_discount || $discount_code ) { ?>
95
+        <?php if (!($is_paid = ($invoice->is_paid() || $invoice->is_refunded())) && !$disable_discount || $discount_code) { ?>
96 96
         <div class="gdmbx-row gdmbx-type-text gdmbx2-id-wpinv-discount-code table-layout">
97
-            <div class="gdmbx-th"><label for="wpinv_discount_code"><?php _e( 'Discount Code:', 'invoicing' );?></label></div>
97
+            <div class="gdmbx-th"><label for="wpinv_discount_code"><?php _e('Discount Code:', 'invoicing'); ?></label></div>
98 98
             <div class="gdmbx-td">
99
-                <input type="text" value="<?php echo esc_attr( $discount_code ); ?>" id="wpinv_discount" class="medium-text" <?php echo ( $discount_code ? 'readonly' : '' ); ?> /><?php if ( !$is_paid && !$disable_discount ) { ?><input value="<?php echo esc_attr_e( 'Apply', 'invoicing' ); ?>" class="button button-small button-primary <?php echo ( $discount_code ? 'wpi-hide' : 'wpi-inlineb' ); ?>" id="wpinv-apply-code" type="button" /><input value="<?php echo esc_attr_e( 'Remove', 'invoicing' ); ?>" class="button button-small button-primary <?php echo ( $discount_code ? 'wpi-inlineb' : 'wpi-hide' ); ?>" id="wpinv-remove-code" type="button" /><?php } ?>
99
+                <input type="text" value="<?php echo esc_attr($discount_code); ?>" id="wpinv_discount" class="medium-text" <?php echo ($discount_code ? 'readonly' : ''); ?> /><?php if (!$is_paid && !$disable_discount) { ?><input value="<?php echo esc_attr_e('Apply', 'invoicing'); ?>" class="button button-small button-primary <?php echo ($discount_code ? 'wpi-hide' : 'wpi-inlineb'); ?>" id="wpinv-apply-code" type="button" /><input value="<?php echo esc_attr_e('Remove', 'invoicing'); ?>" class="button button-small button-primary <?php echo ($discount_code ? 'wpi-inlineb' : 'wpi-hide'); ?>" id="wpinv-remove-code" type="button" /><?php } ?>
100 100
             </div>
101 101
         </div>
102 102
         <?php } ?>
103 103
     </div>
104 104
 </div>
105 105
 <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-save-send table-layout">
106
-    <p class="wpi-meta-row wpi-save-send"><label for="wpi_save_send"><?php echo sprintf(__( 'Send %s:', 'invoicing' ),$post_obj->labels->singular_name) ; ?></label>
106
+    <p class="wpi-meta-row wpi-save-send"><label for="wpi_save_send"><?php echo sprintf(__('Send %s:', 'invoicing'), $post_obj->labels->singular_name); ?></label>
107 107
         <select id="wpi_save_send" name="wpi_save_send" class="wpi_select2">
108
-            <option value="1"><?php _e( 'Yes', 'invoicing' ); ?></option>
109
-            <option value="" selected="selected"><?php _e( 'No', 'invoicing' ); ?></option>
108
+            <option value="1"><?php _e('Yes', 'invoicing'); ?></option>
109
+            <option value="" selected="selected"><?php _e('No', 'invoicing'); ?></option>
110 110
         </select>
111 111
     </p>
112 112
     <p class="wpi-meta-row wpi-send-info"><?php echo $mail_notice; ?></p>
113 113
 </div>
114
-<?php wp_nonce_field( 'wpinv_details', 'wpinv_details_nonce' ) ;?>
114
+<?php wp_nonce_field('wpinv_details', 'wpinv_details_nonce'); ?>
115 115
         <?php
116 116
     }
117 117
     
118
-    public static function resend_invoice( $post ) {
118
+    public static function resend_invoice($post) {
119 119
         global $wpi_mb_invoice;
120 120
         
121
-        if ( empty( $wpi_mb_invoice ) ) {
121
+        if (empty($wpi_mb_invoice)) {
122 122
             return;
123 123
         }
124 124
         
125 125
         $text = array(
126
-            'message'       => esc_attr__( 'This will send a copy of the invoice to the customer&#8217;s email address.', 'invoicing' ),
127
-            'button_text'   =>  __( 'Resend Invoice', 'invoicing' ),
126
+            'message'       => esc_attr__('This will send a copy of the invoice to the customer&#8217;s email address.', 'invoicing'),
127
+            'button_text'   =>  __('Resend Invoice', 'invoicing'),
128 128
         );
129 129
             
130 130
         $text = apply_filters('wpinv_resend_invoice_metabox_text', $text);
131
-        do_action( 'wpinv_metabox_resend_invoice_before', $wpi_mb_invoice );
131
+        do_action('wpinv_metabox_resend_invoice_before', $wpi_mb_invoice);
132 132
         
133
-        if ( $email = $wpi_mb_invoice->get_email() ) {
133
+        if ($email = $wpi_mb_invoice->get_email()) {
134 134
             $email_actions = array();
135
-            $email_actions['email_url']      = remove_query_arg( 'wpinv-message', add_query_arg( array( 'wpi_action' => 'send_invoice', 'invoice_id' => $post->ID ) ) );
136
-            $email_actions['reminder_url']   = add_query_arg( array( 'wpi_action' => 'send_reminder', 'invoice_id' => $post->ID ) );
135
+            $email_actions['email_url']      = remove_query_arg('wpinv-message', add_query_arg(array('wpi_action' => 'send_invoice', 'invoice_id' => $post->ID)));
136
+            $email_actions['reminder_url']   = add_query_arg(array('wpi_action' => 'send_reminder', 'invoice_id' => $post->ID));
137 137
             
138
-            $email_actions = apply_filters('wpinv_resend_invoice_email_actions', $email_actions );
138
+            $email_actions = apply_filters('wpinv_resend_invoice_email_actions', $email_actions);
139 139
         ?>
140 140
         <p class="wpi-meta-row wpi-resend-info"><?php echo $text['message']; ?></p>
141
-        <p class="wpi-meta-row wpi-resend-email"><a href="<?php echo esc_url( $email_actions['email_url'] ); ?>" class="button button-secondary"><?php echo $text['button_text']; ?></a></p>
142
-        <?php if ( wpinv_get_option( 'overdue_active' ) && "wpi_invoice" === $wpi_mb_invoice->post_type && $wpi_mb_invoice->needs_payment() && ( $due_date = $wpi_mb_invoice->get_due_date() ) ) { ?>
143
-        <p class="wpi-meta-row wpi-send-reminder"><a title="<?php esc_attr_e( 'Send overdue reminder notification to customer', 'invoicing' ); ?>" href="<?php echo esc_url( $email_actions['reminder_url'] ); ?>" class="button button-secondary"><?php esc_attr_e( 'Send Reminder', 'invoicing' ); ?></a></p>
141
+        <p class="wpi-meta-row wpi-resend-email"><a href="<?php echo esc_url($email_actions['email_url']); ?>" class="button button-secondary"><?php echo $text['button_text']; ?></a></p>
142
+        <?php if (wpinv_get_option('overdue_active') && "wpi_invoice" === $wpi_mb_invoice->post_type && $wpi_mb_invoice->needs_payment() && ($due_date = $wpi_mb_invoice->get_due_date())) { ?>
143
+        <p class="wpi-meta-row wpi-send-reminder"><a title="<?php esc_attr_e('Send overdue reminder notification to customer', 'invoicing'); ?>" href="<?php echo esc_url($email_actions['reminder_url']); ?>" class="button button-secondary"><?php esc_attr_e('Send Reminder', 'invoicing'); ?></a></p>
144 144
         <?php } ?>
145 145
         <?php
146 146
         }
147 147
         
148
-        do_action( 'wpinv_metabox_resend_invoice_after', $wpi_mb_invoice );
148
+        do_action('wpinv_metabox_resend_invoice_after', $wpi_mb_invoice);
149 149
     }
150 150
     
151
-    public static function subscriptions( $post ) {
152
-        $invoice = wpinv_get_invoice( $post->ID );
151
+    public static function subscriptions($post) {
152
+        $invoice = wpinv_get_invoice($post->ID);
153 153
 
154
-        if ( ! empty( $invoice ) && $invoice->is_recurring() && $invoice->is_parent() ) {
155
-            $subscription = wpinv_get_subscription( $invoice );
154
+        if (!empty($invoice) && $invoice->is_recurring() && $invoice->is_parent()) {
155
+            $subscription = wpinv_get_subscription($invoice);
156 156
 
157
-            if ( empty( $subscription ) ) {
157
+            if (empty($subscription)) {
158 158
                 ?>
159
-                <p class="wpi-meta-row"><?php echo wp_sprintf( __( 'New Subscription will be created when customer will checkout and pay the invoice. Go to: %sSubscriptions%s', 'invoicing' ), '<a href="' . admin_url( 'admin.php?page=wpinv-subscriptions' ).'">', '</a>' ); ?></p>
159
+                <p class="wpi-meta-row"><?php echo wp_sprintf(__('New Subscription will be created when customer will checkout and pay the invoice. Go to: %sSubscriptions%s', 'invoicing'), '<a href="' . admin_url('admin.php?page=wpinv-subscriptions') . '">', '</a>'); ?></p>
160 160
                 <?php
161 161
                 return;
162 162
             }
163
-            $frequency = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency( $subscription->period, $subscription->frequency );
164
-            $billing = wpinv_price(wpinv_format_amount( $subscription->recurring_amount ), wpinv_get_invoice_currency_code( $subscription->parent_payment_id ) ) . ' / ' . $frequency;
165
-            $initial = wpinv_price(wpinv_format_amount( $subscription->initial_amount ), wpinv_get_invoice_currency_code( $subscription->parent_payment_id ) );
163
+            $frequency = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency($subscription->period, $subscription->frequency);
164
+            $billing = wpinv_price(wpinv_format_amount($subscription->recurring_amount), wpinv_get_invoice_currency_code($subscription->parent_payment_id)) . ' / ' . $frequency;
165
+            $initial = wpinv_price(wpinv_format_amount($subscription->initial_amount), wpinv_get_invoice_currency_code($subscription->parent_payment_id));
166 166
             $payments = $subscription->get_child_payments();
167 167
             ?>
168 168
             <p class="wpi-meta-row wpi-sub-label <?php echo 'status-' . $subscription->status; ?>"><?php _e('Recurring Payment', 'invoicing'); ?></p>
169
-            <?php if ( ! empty( $subscription ) && ! empty( $subscription->id ) ) { ?>
169
+            <?php if (!empty($subscription) && !empty($subscription->id)) { ?>
170 170
                 <p class="wpi-meta-row wpi-sub-id">
171
-                    <label><?php _e( 'Subscription ID:', 'invoicing' ); ?> </label><a href="<?php echo esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . $subscription->id ) ); ?>" title="<?php esc_attr_e( 'View or edit subscription', 'invoicing' ); ?>" target="_blank"><?php echo $subscription->id; ?></a></p>
171
+                    <label><?php _e('Subscription ID:', 'invoicing'); ?> </label><a href="<?php echo esc_url(admin_url('admin.php?page=wpinv-subscriptions&id=' . $subscription->id)); ?>" title="<?php esc_attr_e('View or edit subscription', 'invoicing'); ?>" target="_blank"><?php echo $subscription->id; ?></a></p>
172 172
             <?php } ?>
173 173
             <p class="wpi-meta-row wpi-bill-cycle">
174
-                <label><?php _e( 'Billing Cycle:', 'invoicing'); ?> </label><?php printf( _x( '%s then %s', 'Initial subscription amount then billing cycle and amount', 'invoicing' ), $initial, $billing ); ?>
174
+                <label><?php _e('Billing Cycle:', 'invoicing'); ?> </label><?php printf(_x('%s then %s', 'Initial subscription amount then billing cycle and amount', 'invoicing'), $initial, $billing); ?>
175 175
             </p>
176 176
             <p class="wpi-meta-row wpi-billed-times">
177
-                <label><?php _e( 'Times Billed:', 'invoicing' ); ?> </label><?php echo $subscription->get_times_billed() . ' / ' . ( ( $subscription->bill_times == 0 ) ? 'Until Cancelled' : $subscription->bill_times ); ?>
177
+                <label><?php _e('Times Billed:', 'invoicing'); ?> </label><?php echo $subscription->get_times_billed() . ' / ' . (($subscription->bill_times == 0) ? 'Until Cancelled' : $subscription->bill_times); ?>
178 178
             </p>
179 179
             <p class="wpi-meta-row wpi-start-date">
180
-                <label><?php _e( 'Start Date:', 'invoicing' ); ?> </label><?php echo date_i18n( get_option( 'date_format' ), strtotime( $subscription->created, current_time( 'timestamp' ) ) ); ?>
180
+                <label><?php _e('Start Date:', 'invoicing'); ?> </label><?php echo date_i18n(get_option('date_format'), strtotime($subscription->created, current_time('timestamp'))); ?>
181 181
             </p>
182 182
             <p class="wpi-meta-row wpi-end-date">
183
-                <label><?php echo ( 'trialling' == $subscription->status ? __( 'Trialling Until:', 'invoicing' ) : __( 'Expiration Date:', 'invoicing' ) ); ?> </label><?php echo date_i18n( get_option( 'date_format' ), strtotime( $subscription->expiration, current_time( 'timestamp' ) ) ); ?>
183
+                <label><?php echo ('trialling' == $subscription->status ? __('Trialling Until:', 'invoicing') : __('Expiration Date:', 'invoicing')); ?> </label><?php echo date_i18n(get_option('date_format'), strtotime($subscription->expiration, current_time('timestamp'))); ?>
184 184
             </p>
185
-            <?php if ( $subscription->status ) { ?>
185
+            <?php if ($subscription->status) { ?>
186 186
                 <p class="wpi-meta-row wpi-sub-status">
187
-                    <label><?php _e( 'Subscription Status:', 'invoicing'); ?> </label><?php echo $subscription->get_status_label(); ?>
187
+                    <label><?php _e('Subscription Status:', 'invoicing'); ?> </label><?php echo $subscription->get_status_label(); ?>
188 188
                 </p>
189 189
             <?php } ?>
190
-            <?php if ( !empty( $payments ) ) { ?>
191
-                <p><strong><?php _e( 'Renewal Payments:', 'invoicing' ); ?></strong></p>
190
+            <?php if (!empty($payments)) { ?>
191
+                <p><strong><?php _e('Renewal Payments:', 'invoicing'); ?></strong></p>
192 192
                 <ul id="wpi-sub-payments">
193
-                <?php foreach ( $payments as $payment ) {
193
+                <?php foreach ($payments as $payment) {
194 194
                     $invoice_id = $payment->ID;
195 195
                     ?>
196 196
                     <li>
197
-                        <a href="<?php echo esc_url( get_edit_post_link( $invoice_id ) ); ?>"><?php echo wpinv_get_invoice_number( $invoice_id ); ?></a>&nbsp;&ndash;&nbsp;
198
-                        <span><?php echo wpinv_get_invoice_date( $invoice_id ); ?>&nbsp;&ndash;&nbsp;</span>
199
-                        <span><?php echo wpinv_payment_total( $invoice_id, true ); ?></span>
197
+                        <a href="<?php echo esc_url(get_edit_post_link($invoice_id)); ?>"><?php echo wpinv_get_invoice_number($invoice_id); ?></a>&nbsp;&ndash;&nbsp;
198
+                        <span><?php echo wpinv_get_invoice_date($invoice_id); ?>&nbsp;&ndash;&nbsp;</span>
199
+                        <span><?php echo wpinv_payment_total($invoice_id, true); ?></span>
200 200
                     </li>
201 201
                 <?php } ?>
202 202
                 </ul>
@@ -204,16 +204,16 @@  discard block
 block discarded – undo
204 204
         }
205 205
     }
206 206
     
207
-    public static function renewals( $post ) {
208
-        $invoice = wpinv_get_invoice( $post->ID );
207
+    public static function renewals($post) {
208
+        $invoice = wpinv_get_invoice($post->ID);
209 209
         
210
-        if ( wpinv_is_subscription_payment( $invoice ) ) {
211
-            $parent_url = get_edit_post_link( $invoice->parent_invoice );
212
-            $parent_id  = wpinv_get_invoice_number( $invoice->parent_invoice );
213
-            $subscription = wpinv_get_subscription( $invoice );
210
+        if (wpinv_is_subscription_payment($invoice)) {
211
+            $parent_url = get_edit_post_link($invoice->parent_invoice);
212
+            $parent_id  = wpinv_get_invoice_number($invoice->parent_invoice);
213
+            $subscription = wpinv_get_subscription($invoice);
214 214
         ?>
215
-        <?php if ( ! empty( $subscription ) ) { ?><p class="wpi-meta-row wpi-sub-id"><label><?php _e('Subscription ID:', 'invoicing'); ?> </label><a href="<?php echo esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . $subscription->id ) ); ?>" title="<?php esc_attr_e( 'View or edit subscription', 'invoicing' ); ?>" target="_blank"><?php echo $subscription->id; ?></a></p><?php } ?>
216
-        <p class="wpi-meta-row wpi-parent-id"><label><?php _e( 'Parent Invoice:', 'invoicing' );?> </label><a href="<?php echo esc_url( $parent_url ); ?>"><?php echo $parent_id; ?></a></p>
215
+        <?php if (!empty($subscription)) { ?><p class="wpi-meta-row wpi-sub-id"><label><?php _e('Subscription ID:', 'invoicing'); ?> </label><a href="<?php echo esc_url(admin_url('admin.php?page=wpinv-subscriptions&id=' . $subscription->id)); ?>" title="<?php esc_attr_e('View or edit subscription', 'invoicing'); ?>" target="_blank"><?php echo $subscription->id; ?></a></p><?php } ?>
216
+        <p class="wpi-meta-row wpi-parent-id"><label><?php _e('Parent Invoice:', 'invoicing'); ?> </label><a href="<?php echo esc_url($parent_url); ?>"><?php echo $parent_id; ?></a></p>
217 217
         <?php
218 218
         }
219 219
     }
@@ -221,47 +221,47 @@  discard block
 block discarded – undo
221 221
     /**
222 222
      * Renders a metabox to edit a payment form.
223 223
      */
224
-    public static function payment_form( $post ) {
225
-        WPInv_Meta_Box_Form_Items::output_options( $post );
224
+    public static function payment_form($post) {
225
+        WPInv_Meta_Box_Form_Items::output_options($post);
226 226
     }
227 227
 
228 228
     /**
229 229
      * Renders a metabox to select items.
230 230
      */
231
-    public static function payment_form_items( $post ) {
232
-        WPInv_Meta_Box_Form_Items::output( $post );
231
+    public static function payment_form_items($post) {
232
+        WPInv_Meta_Box_Form_Items::output($post);
233 233
     }
234 234
     
235
-    public static function payment_meta( $post ) {
235
+    public static function payment_meta($post) {
236 236
         global $wpi_mb_invoice;
237 237
 
238
-        $set_dateway = empty( $wpi_mb_invoice->gateway ) ? true : false;
239
-        if ( !$set_dateway && !$wpi_mb_invoice->get_meta( '_wpinv_checkout', true ) && !$wpi_mb_invoice->is_paid() && !$wpi_mb_invoice->is_refunded() ) {
238
+        $set_dateway = empty($wpi_mb_invoice->gateway) ? true : false;
239
+        if (!$set_dateway && !$wpi_mb_invoice->get_meta('_wpinv_checkout', true) && !$wpi_mb_invoice->is_paid() && !$wpi_mb_invoice->is_refunded()) {
240 240
             $set_dateway = true;
241 241
         }
242 242
         
243 243
         ?>
244 244
         <p class="wpi-meta-row">
245
-        <?php if ( $set_dateway ) { $gateways = wpinv_get_enabled_payment_gateways( true ); ?>
246
-            <label for="wpinv_gateway"><?php _e( 'Gateway:', 'invoicing' ) ; ?></label>
245
+        <?php if ($set_dateway) { $gateways = wpinv_get_enabled_payment_gateways(true); ?>
246
+            <label for="wpinv_gateway"><?php _e('Gateway:', 'invoicing'); ?></label>
247 247
             <select required="required" id="wpinv_gateway" class="wpi_select2" name="wpinv_gateway">
248
-                <?php foreach ( $gateways as $name => $gateway ) {
249
-                    if ( $wpi_mb_invoice->is_recurring() && !wpinv_gateway_support_subscription( $name ) ) {
248
+                <?php foreach ($gateways as $name => $gateway) {
249
+                    if ($wpi_mb_invoice->is_recurring() && !wpinv_gateway_support_subscription($name)) {
250 250
                         continue;
251 251
                     }
252 252
                     ?>
253
-                <option value="<?php echo $name;?>" <?php selected( $wpi_mb_invoice->gateway, $name );?>><?php echo !empty( $gateway['admin_label'] ) ? $gateway['admin_label'] : $gateway['checkout_label']; ?></option>
253
+                <option value="<?php echo $name; ?>" <?php selected($wpi_mb_invoice->gateway, $name); ?>><?php echo !empty($gateway['admin_label']) ? $gateway['admin_label'] : $gateway['checkout_label']; ?></option>
254 254
                 <?php } ?>
255 255
             </select>
256 256
         <?php } else { 
257
-            echo wp_sprintf( __( '<label>Gateway:</label> %s', 'invoicing' ), wpinv_get_gateway_admin_label( $wpi_mb_invoice->gateway ) );
257
+            echo wp_sprintf(__('<label>Gateway:</label> %s', 'invoicing'), wpinv_get_gateway_admin_label($wpi_mb_invoice->gateway));
258 258
         } ?>
259 259
         </p>
260
-        <?php if ( $key = $wpi_mb_invoice->get_key() ) { ?>
261
-        <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Key:</label> %s', 'invoicing' ), $key ); ?></p>
260
+        <?php if ($key = $wpi_mb_invoice->get_key()) { ?>
261
+        <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Key:</label> %s', 'invoicing'), $key); ?></p>
262 262
         <?php } ?>
263
-        <?php if ( $wpi_mb_invoice->is_paid() || $wpi_mb_invoice->is_refunded() ) { ?>
264
-        <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Transaction ID:</label> %s', 'invoicing' ), wpinv_payment_link_transaction_id( $wpi_mb_invoice ) ); ?></p>
263
+        <?php if ($wpi_mb_invoice->is_paid() || $wpi_mb_invoice->is_refunded()) { ?>
264
+        <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Transaction ID:</label> %s', 'invoicing'), wpinv_payment_link_transaction_id($wpi_mb_invoice)); ?></p>
265 265
         <?php } ?>
266 266
         <?php
267 267
     }
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-mb-invoice-items.php 1 patch
Spacing   +176 added lines, -176 removed lines patch added patch discarded remove patch
@@ -1,47 +1,47 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // MUST have WordPress.
3
-if ( !defined( 'WPINC' ) ) {
4
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
3
+if (!defined('WPINC')) {
4
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
5 5
 }
6 6
 
7 7
 class WPInv_Meta_Box_Items {
8
-    public static function output( $post ) {
8
+    public static function output($post) {
9 9
         global $wpinv_euvat, $ajax_cart_details;
10 10
 
11
-        $post_id            = !empty( $post->ID ) ? $post->ID : 0;
12
-        $invoice            = new WPInv_Invoice( $post_id );
11
+        $post_id            = !empty($post->ID) ? $post->ID : 0;
12
+        $invoice            = new WPInv_Invoice($post_id);
13 13
         $ajax_cart_details  = $invoice->get_cart_details();
14
-        $subtotal           = $invoice->get_subtotal( true );
14
+        $subtotal           = $invoice->get_subtotal(true);
15 15
         $discount_raw       = $invoice->get_discount();
16
-        $discount           = wpinv_price( $discount_raw, $invoice->get_currency() );
16
+        $discount           = wpinv_price($discount_raw, $invoice->get_currency());
17 17
         $discounts          = $discount_raw > 0 ? $invoice->get_discounts() : '';
18
-        $tax                = $invoice->get_tax( true );
19
-        $total              = $invoice->get_total( true );
18
+        $tax                = $invoice->get_tax(true);
19
+        $total              = $invoice->get_total(true);
20 20
         $item_quantities    = wpinv_item_quantities_enabled();
21 21
         $use_taxes          = wpinv_use_taxes();
22
-        if ( !$use_taxes && (float)$invoice->get_tax() > 0 ) {
22
+        if (!$use_taxes && (float) $invoice->get_tax() > 0) {
23 23
             $use_taxes = true;
24 24
         }
25
-        $item_types         = apply_filters( 'wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post );
25
+        $item_types         = apply_filters('wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post);
26 26
         $is_recurring       = $invoice->is_recurring();
27 27
         $post_type_object   = get_post_type_object($invoice->post_type);
28 28
         $type_title         = $post_type_object->labels->singular_name;
29 29
 
30 30
         $cols = 5;
31
-        if ( $item_quantities ) {
31
+        if ($item_quantities) {
32 32
             $cols++;
33 33
         }
34
-        if ( $use_taxes ) {
34
+        if ($use_taxes) {
35 35
             $cols++;
36 36
         }
37 37
         $class = '';
38
-        if ( $invoice->is_paid() ) {
38
+        if ($invoice->is_paid()) {
39 39
             $class .= ' wpinv-paid';
40 40
         }
41
-        if ( $invoice->is_refunded() ) {
41
+        if ($invoice->is_refunded()) {
42 42
             $class .= ' wpinv-refunded';
43 43
         }
44
-        if ( $is_recurring ) {
44
+        if ($is_recurring) {
45 45
             $class .= ' wpi-recurring';
46 46
         }
47 47
         ?>
@@ -49,21 +49,21 @@  discard block
 block discarded – undo
49 49
             <table id="wpinv_items" class="wpinv-items" cellspacing="0" cellpadding="0">
50 50
                 <thead>
51 51
                     <tr>
52
-                        <th class="id"><?php _e( 'ID', 'invoicing' );?></th>
53
-                        <th class="title"><?php _e( 'Item', 'invoicing' );?></th>
54
-                        <th class="price"><?php _e( 'Price', 'invoicing' );?></th>
55
-                        <?php if ( $item_quantities ) { ?>
56
-                        <th class="qty"><?php _e( 'Qty', 'invoicing' );?></th>
52
+                        <th class="id"><?php _e('ID', 'invoicing'); ?></th>
53
+                        <th class="title"><?php _e('Item', 'invoicing'); ?></th>
54
+                        <th class="price"><?php _e('Price', 'invoicing'); ?></th>
55
+                        <?php if ($item_quantities) { ?>
56
+                        <th class="qty"><?php _e('Qty', 'invoicing'); ?></th>
57 57
                         <?php } ?>
58
-                        <th class="total"><?php _e( 'Total', 'invoicing' );?></th>
59
-                        <?php if ( $use_taxes ) { ?>
60
-                        <th class="tax"><?php _e( 'Tax (%)', 'invoicing' );?></th>
58
+                        <th class="total"><?php _e('Total', 'invoicing'); ?></th>
59
+                        <?php if ($use_taxes) { ?>
60
+                        <th class="tax"><?php _e('Tax (%)', 'invoicing'); ?></th>
61 61
                         <?php } ?>
62 62
                         <th class="action"></th>
63 63
                     </tr>
64 64
                 </thead>
65 65
                 <tbody class="wpinv-line-items">
66
-                    <?php echo wpinv_admin_get_line_items( $invoice ); ?>
66
+                    <?php echo wpinv_admin_get_line_items($invoice); ?>
67 67
                 </tbody>
68 68
                 <tfoot class="wpinv-totals">
69 69
                     <tr>
@@ -74,45 +74,45 @@  discard block
 block discarded – undo
74 74
                                         <td class="id">
75 75
                                         </td>
76 76
                                         <td class="title">
77
-                                            <input type="text" class="regular-text" placeholder="<?php _e( 'Item Name', 'invoicing' ); ?>" value="" name="_wpinv_quick[name]">
78
-                                            <?php if ( $wpinv_euvat->allow_vat_rules() ) { ?>
77
+                                            <input type="text" class="regular-text" placeholder="<?php _e('Item Name', 'invoicing'); ?>" value="" name="_wpinv_quick[name]">
78
+                                            <?php if ($wpinv_euvat->allow_vat_rules()) { ?>
79 79
                                             <div class="wp-clearfix">
80 80
                                                 <label class="wpi-vat-rule">
81
-                                                    <span class="title"><?php _e( 'VAT rule type', 'invoicing' );?></span>
81
+                                                    <span class="title"><?php _e('VAT rule type', 'invoicing'); ?></span>
82 82
                                                     <span class="input-text-wrap">
83
-                                                        <?php echo wpinv_html_select( array(
83
+                                                        <?php echo wpinv_html_select(array(
84 84
                                                             'options'          => $wpinv_euvat->get_rules(),
85 85
                                                             'name'             => '_wpinv_quick[vat_rule]',
86 86
                                                             'id'               => '_wpinv_quick_vat_rule',
87 87
                                                             'show_option_all'  => false,
88 88
                                                             'show_option_none' => false,
89 89
                                                             'class'            => 'gdmbx2-text-medium wpinv-quick-vat-rule wpi_select2',
90
-                                                        ) ); ?>
90
+                                                        )); ?>
91 91
                                                     </span>
92 92
                                                 </label>
93 93
                                             </div>
94
-                                            <?php } if ( $wpinv_euvat->allow_vat_classes() ) { ?>
94
+                                            <?php } if ($wpinv_euvat->allow_vat_classes()) { ?>
95 95
                                             <div class="wp-clearfix">
96 96
                                                 <label class="wpi-vat-class">
97
-                                                    <span class="title"><?php _e( 'VAT class', 'invoicing' );?></span>
97
+                                                    <span class="title"><?php _e('VAT class', 'invoicing'); ?></span>
98 98
                                                     <span class="input-text-wrap">
99
-                                                        <?php echo wpinv_html_select( array(
99
+                                                        <?php echo wpinv_html_select(array(
100 100
                                                             'options'          => $wpinv_euvat->get_all_classes(),
101 101
                                                             'name'             => '_wpinv_quick[vat_class]',
102 102
                                                             'id'               => '_wpinv_quick_vat_class',
103 103
                                                             'show_option_all'  => false,
104 104
                                                             'show_option_none' => false,
105 105
                                                             'class'            => 'gdmbx2-text-medium wpinv-quick-vat-class wpi_select2',
106
-                                                        ) ); ?>
106
+                                                        )); ?>
107 107
                                                     </span>
108 108
                                                 </label>
109 109
                                             </div>
110 110
                                             <?php } ?>
111 111
                                             <div class="wp-clearfix">
112 112
                                                 <label class="wpi-item-type">
113
-                                                    <span class="title"><?php _e( 'Item type', 'invoicing' );?></span>
113
+                                                    <span class="title"><?php _e('Item type', 'invoicing'); ?></span>
114 114
                                                     <span class="input-text-wrap">
115
-                                                        <?php echo wpinv_html_select( array(
115
+                                                        <?php echo wpinv_html_select(array(
116 116
                                                             'options'          => $item_types,
117 117
                                                             'name'             => '_wpinv_quick[type]',
118 118
                                                             'id'               => '_wpinv_quick_type',
@@ -120,37 +120,37 @@  discard block
 block discarded – undo
120 120
                                                             'show_option_all'  => false,
121 121
                                                             'show_option_none' => false,
122 122
                                                             'class'            => 'gdmbx2-text-medium wpinv-quick-type wpi_select2',
123
-                                                        ) ); ?>
123
+                                                        )); ?>
124 124
                                                     </span>
125 125
                                                 </label>
126 126
                                             </div>
127 127
 
128 128
                                             <div class="wp-clearfix">
129 129
                                                 <?php 
130
-                                                    echo wpinv_html_textarea( array(
130
+                                                    echo wpinv_html_textarea(array(
131 131
                                                         'name'  => '_wpinv_quick[excerpt]',
132 132
                                                         'id'    => '_wpinv_quick_excerpt',
133 133
                                                         'value' => '',
134 134
                                                         'class' => 'large-text',
135
-                                                        'label' => __( 'Item description', 'invoicing' ),
136
-                                                    ) ); 
135
+                                                        'label' => __('Item description', 'invoicing'),
136
+                                                    )); 
137 137
                                                 ?>
138 138
                                             </div>
139 139
 
140 140
                                             <div class="wp-clearfix">
141 141
                                                 <label class="wpi-item-actions">
142 142
                                                     <span class="input-text-wrap">
143
-                                                        <input type="button" value="<?php esc_attr_e( 'Add', 'invoicing' ); ?>" class="button button-primary" id="wpinv-save-item"><input type="button" value="Cancel" class="button button-secondary" id="wpinv-cancel-item">
143
+                                                        <input type="button" value="<?php esc_attr_e('Add', 'invoicing'); ?>" class="button button-primary" id="wpinv-save-item"><input type="button" value="Cancel" class="button button-secondary" id="wpinv-cancel-item">
144 144
                                                     </span>
145 145
                                                 </label>
146 146
                                             </div>
147 147
                                         </td>
148 148
                                         <td class="price"><input type="text" placeholder="0.00" class="wpi-field-price wpi-price" name="_wpinv_quick[price]" /></td>
149
-                                        <?php if ( $item_quantities ) { ?>
149
+                                        <?php if ($item_quantities) { ?>
150 150
                                         <td class="qty"><input type="number" class="small-text" step="1" min="1" value="1" name="_wpinv_quick[qty]" /></td>
151 151
                                         <?php } ?>
152 152
                                         <td class="total"></td>
153
-                                        <?php if ( $use_taxes ) { ?>
153
+                                        <?php if ($use_taxes) { ?>
154 154
                                         <td class="tax"></td>
155 155
                                         <?php } ?>
156 156
                                         <td class="action"></td>
@@ -163,29 +163,29 @@  discard block
 block discarded – undo
163 163
                         <td colspan="<?php echo $cols; ?>"></td>
164 164
                     </tr>
165 165
                     <tr class="totals">
166
-                        <td colspan="<?php echo ( $cols - 4 ); ?>"></td>
166
+                        <td colspan="<?php echo ($cols - 4); ?>"></td>
167 167
                         <td colspan="4">
168 168
                             <table cellspacing="0" cellpadding="0">
169 169
                                 <tr class="subtotal">
170
-                                    <td class="name"><?php _e( 'Sub Total:', 'invoicing' );?></td>
171
-                                    <td class="total"><?php echo $subtotal;?></td>
170
+                                    <td class="name"><?php _e('Sub Total:', 'invoicing'); ?></td>
171
+                                    <td class="total"><?php echo $subtotal; ?></td>
172 172
                                     <td class="action"></td>
173 173
                                 </tr>
174 174
                                 <tr class="discount">
175
-                                    <td class="name"><?php wpinv_get_discount_label( wpinv_discount_code( $invoice->ID ) ); ?>:</td>
176
-                                    <td class="total"><?php echo wpinv_discount( $invoice->ID, true, true ); ?></td>
175
+                                    <td class="name"><?php wpinv_get_discount_label(wpinv_discount_code($invoice->ID)); ?>:</td>
176
+                                    <td class="total"><?php echo wpinv_discount($invoice->ID, true, true); ?></td>
177 177
                                     <td class="action"></td>
178 178
                                 </tr>
179
-                                <?php if ( $use_taxes ) { ?>
179
+                                <?php if ($use_taxes) { ?>
180 180
                                 <tr class="tax">
181
-                                    <td class="name"><?php _e( 'Tax:', 'invoicing' );?></td>
182
-                                    <td class="total"><?php echo $tax;?></td>
181
+                                    <td class="name"><?php _e('Tax:', 'invoicing'); ?></td>
182
+                                    <td class="total"><?php echo $tax; ?></td>
183 183
                                     <td class="action"></td>
184 184
                                 </tr>
185 185
                                 <?php } ?>
186 186
                                 <tr class="total">
187
-                                    <td class="name"><?php echo apply_filters( 'wpinv_invoice_items_total_label', __( 'Invoice Total:', 'invoicing' ), $invoice );?></td>
188
-                                    <td class="total"><?php echo $total;?></td>
187
+                                    <td class="name"><?php echo apply_filters('wpinv_invoice_items_total_label', __('Invoice Total:', 'invoicing'), $invoice); ?></td>
188
+                                    <td class="total"><?php echo $total; ?></td>
189 189
                                     <td class="action"></td>
190 190
                                 </tr>
191 191
                             </table>
@@ -196,90 +196,90 @@  discard block
 block discarded – undo
196 196
             <div class="wpinv-actions">
197 197
                 <?php ob_start(); ?>
198 198
                 <?php
199
-                    if ( !$invoice->is_paid() && !$invoice->is_refunded() ) {
200
-                        if ( !$invoice->is_recurring() ) {
201
-                            echo wpinv_item_dropdown( array(
199
+                    if (!$invoice->is_paid() && !$invoice->is_refunded()) {
200
+                        if (!$invoice->is_recurring()) {
201
+                            echo wpinv_item_dropdown(array(
202 202
                                 'name'             => 'wpinv_invoice_item',
203 203
                                 'id'               => 'wpinv_invoice_item',
204 204
                                 'show_recurring'   => true,
205 205
                                 'class'            => 'wpi_select2',
206
-                            ) );
206
+                            ));
207 207
                     ?>
208
-                <input type="button" value="<?php echo sprintf(esc_attr__( 'Add item to %s', 'invoicing'), $type_title); ?>" class="button button-primary" id="wpinv-add-item"><input type="button" value="<?php esc_attr_e( 'Create new item', 'invoicing' );?>" class="button button-primary" id="wpinv-new-item"><?php } ?><input type="button" value="<?php esc_attr_e( 'Recalculate Totals', 'invoicing' );?>" class="button button-primary wpinv-flr" id="wpinv-recalc-totals">
208
+                <input type="button" value="<?php echo sprintf(esc_attr__('Add item to %s', 'invoicing'), $type_title); ?>" class="button button-primary" id="wpinv-add-item"><input type="button" value="<?php esc_attr_e('Create new item', 'invoicing'); ?>" class="button button-primary" id="wpinv-new-item"><?php } ?><input type="button" value="<?php esc_attr_e('Recalculate Totals', 'invoicing'); ?>" class="button button-primary wpinv-flr" id="wpinv-recalc-totals">
209 209
                     <?php } ?>
210
-                <?php do_action( 'wpinv_invoice_items_actions', $invoice ); ?>
211
-                <?php $item_actions = ob_get_clean(); echo apply_filters( 'wpinv_invoice_items_actions_content', $item_actions, $invoice, $post ); ?>
210
+                <?php do_action('wpinv_invoice_items_actions', $invoice); ?>
211
+                <?php $item_actions = ob_get_clean(); echo apply_filters('wpinv_invoice_items_actions_content', $item_actions, $invoice, $post); ?>
212 212
             </div>
213 213
         </div>
214 214
         <?php
215 215
     }
216 216
 
217
-    public static function prices( $post ) {        
217
+    public static function prices($post) {        
218 218
         $symbol         = wpinv_currency_symbol();
219 219
         $position       = wpinv_currency_position();
220
-        $item           = new WPInv_Item( $post->ID );
220
+        $item           = new WPInv_Item($post->ID);
221 221
 
222 222
         $price                = $item->get_price();
223 223
         $is_dynamic_pricing   = $item->get_is_dynamic_pricing();
224 224
         $minimum_price        = $item->get_minimum_price();
225 225
         $is_recurring         = $item->is_recurring();
226 226
         $period               = $item->get_recurring_period();
227
-        $interval             = absint( $item->get_recurring_interval() );
228
-        $times                = absint( $item->get_recurring_limit() );
227
+        $interval             = absint($item->get_recurring_interval());
228
+        $times                = absint($item->get_recurring_limit());
229 229
         $free_trial           = $item->has_free_trial();
230 230
         $trial_interval       = $item->get_trial_interval();
231 231
         $trial_period         = $item->get_trial_period();
232 232
 
233 233
         $intervals            = array();
234
-        for ( $i = 1; $i <= 90; $i++ ) {
234
+        for ($i = 1; $i <= 90; $i++) {
235 235
             $intervals[$i] = $i;
236 236
         }
237 237
 
238
-        $interval       = $interval > 0 ? $interval : 1;
238
+        $interval = $interval > 0 ? $interval : 1;
239 239
 
240 240
         $class = $is_recurring ? 'wpinv-recurring-y' : 'wpinv-recurring-n';
241 241
 
242 242
         $minimum_price_style = 'margin-left: 24px;';
243
-        if(! $is_dynamic_pricing ) {
243
+        if (!$is_dynamic_pricing) {
244 244
             $minimum_price_style .= 'display: none;';
245 245
         }
246 246
 
247 247
         ?>
248
-        <p class="wpinv-row-prices"><?php echo ( $position != 'right' ? $symbol . '&nbsp;' : '' );?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount( 0 ); ?>" value="<?php echo $price;?>" id="wpinv_item_price" name="wpinv_item_price" class="medium-text wpi-field-price wpi-price" <?php disabled( $item->is_editable(), false ); ?> /><?php echo ( $position == 'right' ? '&nbsp;' . $symbol : '' );?><input type="hidden" name="wpinv_vat_meta_box_nonce" value="<?php echo wp_create_nonce( 'wpinv_item_meta_box_save' ) ;?>" />
249
-        <?php do_action( 'wpinv_prices_metabox_price', $item ); ?>
248
+        <p class="wpinv-row-prices"><?php echo ($position != 'right' ? $symbol . '&nbsp;' : ''); ?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount(0); ?>" value="<?php echo $price; ?>" id="wpinv_item_price" name="wpinv_item_price" class="medium-text wpi-field-price wpi-price" <?php disabled($item->is_editable(), false); ?> /><?php echo ($position == 'right' ? '&nbsp;' . $symbol : ''); ?><input type="hidden" name="wpinv_vat_meta_box_nonce" value="<?php echo wp_create_nonce('wpinv_item_meta_box_save'); ?>" />
249
+        <?php do_action('wpinv_prices_metabox_price', $item); ?>
250 250
         </p>
251 251
 
252
-    <?php if( $item->supports_dynamic_pricing() ) { ?>
252
+    <?php if ($item->supports_dynamic_pricing()) { ?>
253 253
 
254 254
         <p class="wpinv-row-name-your-price">
255 255
             <label>
256
-                <input type="checkbox" name="wpinv_name_your_price" id="wpinv_name_your_price" value="1" <?php checked( 1, $is_dynamic_pricing ); ?> />
257
-                <?php echo apply_filters( 'wpinv_name_your_price_toggle_text', __( 'User can set a custom price', 'invoicing' ) ); ?>
256
+                <input type="checkbox" name="wpinv_name_your_price" id="wpinv_name_your_price" value="1" <?php checked(1, $is_dynamic_pricing); ?> />
257
+                <?php echo apply_filters('wpinv_name_your_price_toggle_text', __('User can set a custom price', 'invoicing')); ?>
258 258
             </label>
259
-            <?php do_action( 'wpinv_prices_metabox_name_your_price_field', $item ); ?>
259
+            <?php do_action('wpinv_prices_metabox_name_your_price_field', $item); ?>
260 260
         </p>
261 261
 
262 262
         <p class="wpinv-row-minimum-price" style="<?php echo $minimum_price_style; ?>">
263 263
             <label>
264
-                <?php _e( 'Minimum Price', 'invoicing' ); ?>
265
-                <?php echo ( $position != 'right' ? $symbol . '&nbsp;' : '' );?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount( 0 ); ?>" value="<?php echo $minimum_price;?>" id="wpinv_minimum_price" name="wpinv_minimum_price" class="medium-text wpi-field-price" <?php disabled( $item->is_editable(), false ); ?> /><?php echo ( $position == 'right' ? '&nbsp;' . $symbol : '' );?>
264
+                <?php _e('Minimum Price', 'invoicing'); ?>
265
+                <?php echo ($position != 'right' ? $symbol . '&nbsp;' : ''); ?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount(0); ?>" value="<?php echo $minimum_price; ?>" id="wpinv_minimum_price" name="wpinv_minimum_price" class="medium-text wpi-field-price" <?php disabled($item->is_editable(), false); ?> /><?php echo ($position == 'right' ? '&nbsp;' . $symbol : ''); ?>
266 266
             </label>
267 267
 
268
-            <?php do_action( 'wpinv_prices_metabox_minimum_price_field', $item ); ?>
268
+            <?php do_action('wpinv_prices_metabox_minimum_price_field', $item); ?>
269 269
         </p>
270 270
 
271 271
     <?php } ?>
272 272
 
273 273
         <p class="wpinv-row-is-recurring">
274 274
             <label for="wpinv_is_recurring">
275
-                <input type="checkbox" name="wpinv_is_recurring" id="wpinv_is_recurring" value="1" <?php checked( 1, $is_recurring ); ?> />
276
-                <?php echo apply_filters( 'wpinv_is_recurring_toggle_text', __( 'Is Recurring Item?', 'invoicing' ) ); ?>
275
+                <input type="checkbox" name="wpinv_is_recurring" id="wpinv_is_recurring" value="1" <?php checked(1, $is_recurring); ?> />
276
+                <?php echo apply_filters('wpinv_is_recurring_toggle_text', __('Is Recurring Item?', 'invoicing')); ?>
277 277
             </label>
278
-            <?php do_action( 'wpinv_prices_metabox_is_recurring_field', $item ); ?>
278
+            <?php do_action('wpinv_prices_metabox_is_recurring_field', $item); ?>
279 279
         </p>
280
-        <p class="wpinv-row-recurring-fields <?php echo $class;?>">
281
-            <label class="wpinv-period" for="wpinv_recurring_period"><?php _e( 'Recurring', 'invoicing' );?> <select class="wpinv-select wpi_select2" id="wpinv_recurring_period" name="wpinv_recurring_period"><option value="D" data-text="<?php esc_attr_e( 'day(s)', 'invoicing' ); ?>" <?php selected( 'D', $period );?>><?php _e( 'Daily', 'invoicing' ); ?></option><option value="W" data-text="<?php esc_attr_e( 'week(s)', 'invoicing' ); ?>" <?php selected( 'W', $period );?>><?php _e( 'Weekly', 'invoicing' ); ?></option><option value="M" data-text="<?php esc_attr_e( 'month(s)', 'invoicing' ); ?>" <?php selected( 'M', $period );?>><?php _e( 'Monthly', 'invoicing' ); ?></option><option value="Y" data-text="<?php esc_attr_e( 'year(s)', 'invoicing' ); ?>" <?php selected( 'Y', $period );?>><?php _e( 'Yearly', 'invoicing' ); ?></option></select></label>
282
-            <label class="wpinv-interval" for="wpinv_recurring_interval"> <?php _e( 'at every', 'invoicing' );?> <?php echo wpinv_html_select( array(
280
+        <p class="wpinv-row-recurring-fields <?php echo $class; ?>">
281
+            <label class="wpinv-period" for="wpinv_recurring_period"><?php _e('Recurring', 'invoicing'); ?> <select class="wpinv-select wpi_select2" id="wpinv_recurring_period" name="wpinv_recurring_period"><option value="D" data-text="<?php esc_attr_e('day(s)', 'invoicing'); ?>" <?php selected('D', $period); ?>><?php _e('Daily', 'invoicing'); ?></option><option value="W" data-text="<?php esc_attr_e('week(s)', 'invoicing'); ?>" <?php selected('W', $period); ?>><?php _e('Weekly', 'invoicing'); ?></option><option value="M" data-text="<?php esc_attr_e('month(s)', 'invoicing'); ?>" <?php selected('M', $period); ?>><?php _e('Monthly', 'invoicing'); ?></option><option value="Y" data-text="<?php esc_attr_e('year(s)', 'invoicing'); ?>" <?php selected('Y', $period); ?>><?php _e('Yearly', 'invoicing'); ?></option></select></label>
282
+            <label class="wpinv-interval" for="wpinv_recurring_interval"> <?php _e('at every', 'invoicing'); ?> <?php echo wpinv_html_select(array(
283 283
                 'options'          => $intervals,
284 284
                 'name'             => 'wpinv_recurring_interval',
285 285
                 'id'               => 'wpinv_recurring_interval',
@@ -287,30 +287,30 @@  discard block
 block discarded – undo
287 287
                 'show_option_all'  => false,
288 288
                 'show_option_none' => false,
289 289
                 'class'            => 'wpi_select2',
290
-            ) ); ?> <span id="wpinv_interval_text"><?php _e( 'day(s)', 'invoicing' );?></span></label>
291
-            <label class="wpinv-times" for="wpinv_recurring_limit"> <?php _e( 'for', 'invoicing' );?> <input class="small-text" type="number" value="<?php echo $times;?>" size="4" id="wpinv_recurring_limit" name="wpinv_recurring_limit" step="1" min="0"> <?php _e( 'time(s) <i>(select 0 for recurring forever until cancelled</i>)', 'invoicing' );?></label>
290
+            )); ?> <span id="wpinv_interval_text"><?php _e('day(s)', 'invoicing'); ?></span></label>
291
+            <label class="wpinv-times" for="wpinv_recurring_limit"> <?php _e('for', 'invoicing'); ?> <input class="small-text" type="number" value="<?php echo $times; ?>" size="4" id="wpinv_recurring_limit" name="wpinv_recurring_limit" step="1" min="0"> <?php _e('time(s) <i>(select 0 for recurring forever until cancelled</i>)', 'invoicing'); ?></label>
292 292
             <span class="clear wpi-trial-clr"></span>
293 293
             <label class="wpinv-free-trial" for="wpinv_free_trial">
294
-                <input type="checkbox" name="wpinv_free_trial" id="wpinv_free_trial" value="1" <?php checked( true, (bool)$free_trial ); ?> /> 
295
-                <?php echo __( 'Offer free trial for', 'invoicing' ); ?>
294
+                <input type="checkbox" name="wpinv_free_trial" id="wpinv_free_trial" value="1" <?php checked(true, (bool) $free_trial); ?> /> 
295
+                <?php echo __('Offer free trial for', 'invoicing'); ?>
296 296
             </label>
297 297
             <label class="wpinv-trial-interval" for="wpinv_trial_interval">
298
-                <input class="small-text" type="number" value="<?php echo $trial_interval;?>" size="4" id="wpinv_trial_interval" name="wpinv_trial_interval" step="1" min="1"> <select class="wpinv-select wpi_select2" id="wpinv_trial_period" name="wpinv_trial_period"><option value="D" <?php selected( 'D', $trial_period );?>><?php _e( 'day(s)', 'invoicing' ); ?></option><option value="W" <?php selected( 'W', $trial_period );?>><?php _e( 'week(s)', 'invoicing' ); ?></option><option value="M" <?php selected( 'M', $trial_period );?>><?php _e( 'month(s)', 'invoicing' ); ?></option><option value="Y" <?php selected( 'Y', $trial_period );?>><?php _e( 'year(s)', 'invoicing' ); ?></option></select>
298
+                <input class="small-text" type="number" value="<?php echo $trial_interval; ?>" size="4" id="wpinv_trial_interval" name="wpinv_trial_interval" step="1" min="1"> <select class="wpinv-select wpi_select2" id="wpinv_trial_period" name="wpinv_trial_period"><option value="D" <?php selected('D', $trial_period); ?>><?php _e('day(s)', 'invoicing'); ?></option><option value="W" <?php selected('W', $trial_period); ?>><?php _e('week(s)', 'invoicing'); ?></option><option value="M" <?php selected('M', $trial_period); ?>><?php _e('month(s)', 'invoicing'); ?></option><option value="Y" <?php selected('Y', $trial_period); ?>><?php _e('year(s)', 'invoicing'); ?></option></select>
299 299
             </label>
300
-            <?php do_action( 'wpinv_prices_metabox_recurring_fields', $item ); ?>
300
+            <?php do_action('wpinv_prices_metabox_recurring_fields', $item); ?>
301 301
         </p>
302
-        <input type="hidden" id="_wpi_current_type" value="<?php echo wpinv_get_item_type( $post->ID ); ?>" />
303
-        <?php do_action( 'wpinv_item_price_field', $post->ID ); ?>
302
+        <input type="hidden" id="_wpi_current_type" value="<?php echo wpinv_get_item_type($post->ID); ?>" />
303
+        <?php do_action('wpinv_item_price_field', $post->ID); ?>
304 304
         <?php
305 305
     }
306 306
 
307
-    public static function vat_rules( $post ) {
307
+    public static function vat_rules($post) {
308 308
         global $wpinv_euvat;
309 309
 
310
-        $rule_type = $wpinv_euvat->get_item_rule( $post->ID );
310
+        $rule_type = $wpinv_euvat->get_item_rule($post->ID);
311 311
         ?>
312
-        <p><label for="wpinv_vat_rules"><strong><?php _e( 'Select how VAT rules will be applied:', 'invoicing' );?></strong></label>&nbsp;&nbsp;&nbsp;
313
-        <?php echo wpinv_html_select( array(
312
+        <p><label for="wpinv_vat_rules"><strong><?php _e('Select how VAT rules will be applied:', 'invoicing'); ?></strong></label>&nbsp;&nbsp;&nbsp;
313
+        <?php echo wpinv_html_select(array(
314 314
                     'options'          => $wpinv_euvat->get_rules(),
315 315
                     'name'             => 'wpinv_vat_rules',
316 316
                     'id'               => 'wpinv_vat_rules',
@@ -318,20 +318,20 @@  discard block
 block discarded – undo
318 318
                     'show_option_all'  => false,
319 319
                     'show_option_none' => false,
320 320
                     'class'            => 'gdmbx2-text-medium wpinv-vat-rules wpi_select2',
321
-                ) ); ?>
321
+                )); ?>
322 322
         </p>
323
-        <p class="wpi-m0"><?php _e( 'When you select physical product rules, only consumers and businesses in your country will be charged VAT.  The VAT rate used will be the rate in your country.', 'invoicing' ); ?></p>
324
-        <p class="wpi-m0"><?php _e( 'If you select Digital product rules, VAT will be charged at the rate that applies in the country of the consumer.  Only businesses in your country will be charged VAT.', 'invoicing' ); ?></p>
325
-        <p class="wpi-m0"><?php _e( 'Select "Tax-Free" if you do not want to charge VAT for this item.', 'invoicing' ); ?></p>
323
+        <p class="wpi-m0"><?php _e('When you select physical product rules, only consumers and businesses in your country will be charged VAT.  The VAT rate used will be the rate in your country.', 'invoicing'); ?></p>
324
+        <p class="wpi-m0"><?php _e('If you select Digital product rules, VAT will be charged at the rate that applies in the country of the consumer.  Only businesses in your country will be charged VAT.', 'invoicing'); ?></p>
325
+        <p class="wpi-m0"><?php _e('Select "Tax-Free" if you do not want to charge VAT for this item.', 'invoicing'); ?></p>
326 326
         <?php
327 327
     }
328 328
 
329
-    public static function vat_classes( $post ) {
329
+    public static function vat_classes($post) {
330 330
         global $wpinv_euvat;
331 331
         
332
-        $vat_class = $wpinv_euvat->get_item_class( $post->ID );
332
+        $vat_class = $wpinv_euvat->get_item_class($post->ID);
333 333
         ?>
334
-        <p><?php echo wpinv_html_select( array(
334
+        <p><?php echo wpinv_html_select(array(
335 335
                     'options'          => $wpinv_euvat->get_all_classes(),
336 336
                     'name'             => 'wpinv_vat_class',
337 337
                     'id'               => 'wpinv_vat_class',
@@ -339,18 +339,18 @@  discard block
 block discarded – undo
339 339
                     'show_option_all'  => false,
340 340
                     'show_option_none' => false,
341 341
                     'class'            => 'gdmbx2-text-medium wpinv-vat-class wpi_select2',
342
-                ) ); ?>
342
+                )); ?>
343 343
         </p>
344
-        <p class="wpi-m0"><?php _e( 'Select the VAT rate class to use for this invoice item.', 'invoicing' ); ?></p>
344
+        <p class="wpi-m0"><?php _e('Select the VAT rate class to use for this invoice item.', 'invoicing'); ?></p>
345 345
         <?php
346 346
     }
347 347
 
348
-    public static function item_info( $post ) {
349
-        $item_type = wpinv_get_item_type( $post->ID );
350
-        do_action( 'wpinv_item_info_metabox_before', $post );
348
+    public static function item_info($post) {
349
+        $item_type = wpinv_get_item_type($post->ID);
350
+        do_action('wpinv_item_info_metabox_before', $post);
351 351
         ?>
352
-        <p><label for="wpinv_item_type"><strong><?php _e( 'Type:', 'invoicing' );?></strong></label>&nbsp;&nbsp;&nbsp;
353
-        <?php echo wpinv_html_select( array(
352
+        <p><label for="wpinv_item_type"><strong><?php _e('Type:', 'invoicing'); ?></strong></label>&nbsp;&nbsp;&nbsp;
353
+        <?php echo wpinv_html_select(array(
354 354
                     'options'          => wpinv_get_item_types(),
355 355
                     'name'             => 'wpinv_item_type',
356 356
                     'id'               => 'wpinv_item_type',
@@ -358,135 +358,135 @@  discard block
 block discarded – undo
358 358
                     'show_option_all'  => false,
359 359
                     'show_option_none' => false,
360 360
                     'class'            => 'gdmbx2-text-medium wpinv-item-type',
361
-                ) ); ?>
361
+                )); ?>
362 362
         </p>
363
-        <p class="wpi-m0"><?php _e( 'Select item type.', 'invoicing' );?><br><?php _e( '<b>Standard:</b> Standard item type', 'invoicing' );?><br><?php _e( '<b>Fee:</b> Like Registration Fee, Sign up Fee etc.', 'invoicing' );?></p>
363
+        <p class="wpi-m0"><?php _e('Select item type.', 'invoicing'); ?><br><?php _e('<b>Standard:</b> Standard item type', 'invoicing'); ?><br><?php _e('<b>Fee:</b> Like Registration Fee, Sign up Fee etc.', 'invoicing'); ?></p>
364 364
         <?php
365
-        do_action( 'wpinv_item_info_metabox_after', $post );
365
+        do_action('wpinv_item_info_metabox_after', $post);
366 366
     }
367 367
 
368
-    public static function meta_values( $post ) {
369
-        $meta_keys = apply_filters( 'wpinv_show_meta_values_for_keys', array(
368
+    public static function meta_values($post) {
369
+        $meta_keys = apply_filters('wpinv_show_meta_values_for_keys', array(
370 370
             'type',
371 371
             'custom_id'
372
-        ) );
372
+        ));
373 373
 
374
-        if ( empty( $meta_keys ) ) {
374
+        if (empty($meta_keys)) {
375 375
             return;
376 376
         }
377 377
 
378
-        do_action( 'wpinv_meta_values_metabox_before', $post );
378
+        do_action('wpinv_meta_values_metabox_before', $post);
379 379
 
380
-        foreach ( $meta_keys as $meta_key ) {
380
+        foreach ($meta_keys as $meta_key) {
381 381
             ?>
382
-            <p class="wpi-mtb05"><label><strong><?php echo $meta_key; ?></strong>: <?php echo get_post_meta( $post->ID, '_wpinv_' . $meta_key, true ); ?></label></p>
382
+            <p class="wpi-mtb05"><label><strong><?php echo $meta_key; ?></strong>: <?php echo get_post_meta($post->ID, '_wpinv_' . $meta_key, true); ?></label></p>
383 383
             <?php 
384 384
         }
385 385
 
386
-        do_action( 'wpinv_meta_values_metabox_after', $post );
386
+        do_action('wpinv_meta_values_metabox_after', $post);
387 387
     }
388 388
 
389
-    public static function save( $post_id, $data, $post ) {
390
-        $invoice        = new WPInv_Invoice( $post_id );
389
+    public static function save($post_id, $data, $post) {
390
+        $invoice        = new WPInv_Invoice($post_id);
391 391
 
392 392
         // Billing
393
-        $first_name     = sanitize_text_field( $data['wpinv_first_name'] );
394
-        $last_name      = sanitize_text_field( $data['wpinv_last_name'] );
395
-        $company        = sanitize_text_field( $data['wpinv_company'] );
396
-        $vat_number     = sanitize_text_field( $data['wpinv_vat_number'] );
397
-        $phone          = sanitize_text_field( $data['wpinv_phone'] );
398
-        $address        = sanitize_text_field( $data['wpinv_address'] );
399
-        $city           = sanitize_text_field( $data['wpinv_city'] );
400
-        $zip            = sanitize_text_field( $data['wpinv_zip'] );
401
-        $country        = sanitize_text_field( $data['wpinv_country'] );
402
-        $state          = sanitize_text_field( $data['wpinv_state'] );
393
+        $first_name     = sanitize_text_field($data['wpinv_first_name']);
394
+        $last_name      = sanitize_text_field($data['wpinv_last_name']);
395
+        $company        = sanitize_text_field($data['wpinv_company']);
396
+        $vat_number     = sanitize_text_field($data['wpinv_vat_number']);
397
+        $phone          = sanitize_text_field($data['wpinv_phone']);
398
+        $address        = sanitize_text_field($data['wpinv_address']);
399
+        $city           = sanitize_text_field($data['wpinv_city']);
400
+        $zip            = sanitize_text_field($data['wpinv_zip']);
401
+        $country        = sanitize_text_field($data['wpinv_country']);
402
+        $state          = sanitize_text_field($data['wpinv_state']);
403 403
 
404 404
         // Details
405
-        $status         = sanitize_text_field( $data['wpinv_status'] );
406
-        $old_status     = !empty( $data['original_post_status'] ) ? sanitize_text_field( $data['original_post_status'] ) : $status;
407
-        $number         = sanitize_text_field( $data['wpinv_number'] );
408
-        $due_date       = isset( $data['wpinv_due_date'] ) ? sanitize_text_field( $data['wpinv_due_date'] ) : '';
405
+        $status         = sanitize_text_field($data['wpinv_status']);
406
+        $old_status     = !empty($data['original_post_status']) ? sanitize_text_field($data['original_post_status']) : $status;
407
+        $number         = sanitize_text_field($data['wpinv_number']);
408
+        $due_date       = isset($data['wpinv_due_date']) ? sanitize_text_field($data['wpinv_due_date']) : '';
409 409
         //$discounts      = sanitize_text_field( $data['wpinv_discounts'] );
410 410
         //$discount       = sanitize_text_field( $data['wpinv_discount'] );
411 411
 
412 412
         $disable_taxes = 0;
413 413
 
414
-        if ( ! empty( $data['disable_taxes'] ) ) {
414
+        if (!empty($data['disable_taxes'])) {
415 415
             $disable_taxes = 1;
416 416
         }
417 417
 
418
-        $ip             = $invoice->get_ip() ? $invoice->get_ip() : wpinv_get_ip();
419
-
420
-        $invoice->set( 'due_date', $due_date );
421
-        $invoice->set( 'first_name', $first_name );
422
-        $invoice->set( 'last_name', $last_name );
423
-        $invoice->set( 'company', $company );
424
-        $invoice->set( 'vat_number', $vat_number );
425
-        $invoice->set( 'phone', $phone );
426
-        $invoice->set( 'address', $address );
427
-        $invoice->set( 'city', $city );
428
-        $invoice->set( 'zip', $zip );
429
-        $invoice->set( 'country', $country );
430
-        $invoice->set( 'state', $state );
431
-        $invoice->set( 'status', $status );
432
-        $invoice->set( 'set', $status );
418
+        $ip = $invoice->get_ip() ? $invoice->get_ip() : wpinv_get_ip();
419
+
420
+        $invoice->set('due_date', $due_date);
421
+        $invoice->set('first_name', $first_name);
422
+        $invoice->set('last_name', $last_name);
423
+        $invoice->set('company', $company);
424
+        $invoice->set('vat_number', $vat_number);
425
+        $invoice->set('phone', $phone);
426
+        $invoice->set('address', $address);
427
+        $invoice->set('city', $city);
428
+        $invoice->set('zip', $zip);
429
+        $invoice->set('country', $country);
430
+        $invoice->set('state', $state);
431
+        $invoice->set('status', $status);
432
+        $invoice->set('set', $status);
433 433
         //$invoice->set( 'number', $number );
434 434
         //$invoice->set( 'discounts', $discounts );
435 435
         //$invoice->set( 'discount', $discount );
436
-        $invoice->set( 'disable_taxes', $disable_taxes );
437
-        $invoice->set( 'ip', $ip );
436
+        $invoice->set('disable_taxes', $disable_taxes);
437
+        $invoice->set('ip', $ip);
438 438
         $invoice->old_status = $_POST['original_post_status'];
439 439
         
440 440
         $currency = $invoice->get_currency();
441
-        if ( ! empty( sanitize_text_field( $data['wpinv_currency'] ) ) ) {
442
-            $currency = sanitize_text_field( $data['wpinv_currency'] );
441
+        if (!empty(sanitize_text_field($data['wpinv_currency']))) {
442
+            $currency = sanitize_text_field($data['wpinv_currency']);
443 443
         }
444 444
 
445
-        if ( empty( $currency ) ) {
445
+        if (empty($currency)) {
446 446
             $currency = wpinv_get_currency();
447 447
         }
448 448
 
449
-        if ( ! $invoice->is_paid() ) {
449
+        if (!$invoice->is_paid()) {
450 450
             $invoice->currency = $currency;
451 451
         }
452 452
 
453
-        if ( !empty( $data['wpinv_gateway'] ) ) {
454
-            $invoice->set( 'gateway', sanitize_text_field( $data['wpinv_gateway'] ) );
453
+        if (!empty($data['wpinv_gateway'])) {
454
+            $invoice->set('gateway', sanitize_text_field($data['wpinv_gateway']));
455 455
         }
456 456
         $saved = $invoice->save();
457 457
 
458 458
         // Check for payment notes
459
-        if ( !empty( $data['invoice_note'] ) ) {
460
-            $note               = wp_kses( $data['invoice_note'], array() );
461
-            $note_type          = sanitize_text_field( $data['invoice_note_type'] );
459
+        if (!empty($data['invoice_note'])) {
460
+            $note               = wp_kses($data['invoice_note'], array());
461
+            $note_type          = sanitize_text_field($data['invoice_note_type']);
462 462
             $is_customer_note   = $note_type == 'customer' ? 1 : 0;
463 463
 
464
-            wpinv_insert_payment_note( $invoice->ID, $note, $is_customer_note );
464
+            wpinv_insert_payment_note($invoice->ID, $note, $is_customer_note);
465 465
         }
466 466
 
467 467
         // Update user address if empty.
468
-        if ( $saved && !empty( $invoice ) ) {
469
-            if ( $user_id = $invoice->get_user_id() ) {
470
-                $user_address = wpinv_get_user_address( $user_id, false );
468
+        if ($saved && !empty($invoice)) {
469
+            if ($user_id = $invoice->get_user_id()) {
470
+                $user_address = wpinv_get_user_address($user_id, false);
471 471
 
472 472
                 if (empty($user_address['first_name'])) {
473
-                    update_user_meta( $user_id, '_wpinv_first_name', $first_name );
474
-                    update_user_meta( $user_id, '_wpinv_last_name', $last_name );
473
+                    update_user_meta($user_id, '_wpinv_first_name', $first_name);
474
+                    update_user_meta($user_id, '_wpinv_last_name', $last_name);
475 475
                 } else if (empty($user_address['last_name']) && $user_address['first_name'] == $first_name) {
476
-                    update_user_meta( $user_id, '_wpinv_last_name', $last_name );
476
+                    update_user_meta($user_id, '_wpinv_last_name', $last_name);
477 477
                 }
478 478
 
479 479
                 if (empty($user_address['address']) || empty($user_address['city']) || empty($user_address['state']) || empty($user_address['country'])) {
480
-                    update_user_meta( $user_id, '_wpinv_address', $address );
481
-                    update_user_meta( $user_id, '_wpinv_city', $city );
482
-                    update_user_meta( $user_id, '_wpinv_state', $state );
483
-                    update_user_meta( $user_id, '_wpinv_country', $country );
484
-                    update_user_meta( $user_id, '_wpinv_zip', $zip );
485
-                    update_user_meta( $user_id, '_wpinv_phone', $phone );
480
+                    update_user_meta($user_id, '_wpinv_address', $address);
481
+                    update_user_meta($user_id, '_wpinv_city', $city);
482
+                    update_user_meta($user_id, '_wpinv_state', $state);
483
+                    update_user_meta($user_id, '_wpinv_country', $country);
484
+                    update_user_meta($user_id, '_wpinv_zip', $zip);
485
+                    update_user_meta($user_id, '_wpinv_phone', $phone);
486 486
                 }
487 487
             }
488 488
 
489
-            do_action( 'wpinv_invoice_metabox_saved', $invoice );
489
+            do_action('wpinv_invoice_metabox_saved', $invoice);
490 490
         }
491 491
 
492 492
         return $saved;
Please login to merge, or discard this patch.
includes/data/sample-payment-form-items.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
  * @version 1.0.19
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 return array(
14 14
 
Please login to merge, or discard this patch.
includes/data/sample-payment-form.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @version 1.0.19
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 return array(
14 14
 
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
         'placeholder' => '[email protected]',
18 18
         'value'       => '',
19
-        'label'       => __( 'Billing Email', 'invoicing' ),
19
+        'label'       => __('Billing Email', 'invoicing'),
20 20
         'description' => '',
21 21
         'required'    => true,
22 22
         'id'          => 'mmdwqzpox',
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 
42 42
         'value'       =>'',
43 43
         'class'       => 'btn-primary',
44
-        'label'       => __( 'Pay Now »', 'invoicing' ),
45
-        'description' => __( 'By continuing with your payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ),
44
+        'label'       => __('Pay Now »', 'invoicing'),
45
+        'description' => __('By continuing with your payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'),
46 46
         'id'          => 'rtqljyy',
47 47
         'name'        => 'rtqljyy',
48 48
         'type'        => 'pay_button',
Please login to merge, or discard this patch.
widgets/payment-form.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
     exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
 				'orderby'        => 'title',
23 23
 				'order'          => 'ASC',
24 24
 				'posts_per_page' => -1,
25
-				'post_status'    => array( 'publish' ),
25
+				'post_status'    => array('publish'),
26 26
 			)
27 27
 		);
28 28
 
29 29
 		$options = array(
30
-			'' => __('Select a Form','invoicing')
30
+			'' => __('Select a Form', 'invoicing')
31 31
 		);
32 32
 
33
-		foreach( $forms as $form ) {
34
-			$options[ $form->ID ] = $form->post_title;
33
+		foreach ($forms as $form) {
34
+			$options[$form->ID] = $form->post_title;
35 35
 		}
36 36
 
37 37
         $options = array(
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
             'block-keywords'=> "['invoicing','buy', 'buy item', 'pay', 'payment form']",
42 42
             'class_name'     => __CLASS__,
43 43
             'base_id'       => 'wpinv_payment_form',
44
-            'name'          => __('Invoicing > Payment Form','invoicing'),
44
+            'name'          => __('Invoicing > Payment Form', 'invoicing'),
45 45
             'widget_ops'    => array(
46 46
                 'classname'   => 'wpinv-payment-form-class bsui',
47
-                'description' => esc_html__('Displays a payment form.','invoicing'),
47
+                'description' => esc_html__('Displays a payment form.', 'invoicing'),
48 48
             ),
49 49
             'arguments'           => array(
50 50
                 'form'            => array(
51
-                    'title'       => __( 'Payment Form', 'invoicing' ),
52
-                    'desc'        => __( 'Select your payment form.', 'invoicing' ),
51
+                    'title'       => __('Payment Form', 'invoicing'),
52
+                    'desc'        => __('Select your payment form.', 'invoicing'),
53 53
 					'type'        => 'select',
54 54
 					'options'     =>  $options,
55 55
                     'desc_tip'    => true,
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         );
62 62
 
63 63
 
64
-        parent::__construct( $options );
64
+        parent::__construct($options);
65 65
     }
66 66
 
67 67
 	/**
@@ -73,43 +73,43 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return string
75 75
 	 */
76
-    public function output( $args = array(), $widget_args = array(), $content = '' ) {
76
+    public function output($args = array(), $widget_args = array(), $content = '') {
77 77
 		global $invoicing;
78 78
 
79 79
 		// Do we have a payment form?
80
-		if ( empty( $args['form'] ) ) {
80
+		if (empty($args['form'])) {
81 81
 			return aui()->alert(
82 82
 				array(
83 83
 					'type'    => 'warning',
84
-					'content' => __( 'No payment form selected', 'invoicing' ),
84
+					'content' => __('No payment form selected', 'invoicing'),
85 85
 				)
86 86
 			);
87 87
 
88 88
 		}
89 89
 
90 90
 		// If yes, ensure that it is published.
91
-		if ( 'publish' != get_post_status( $args['form'] ) ) {
91
+		if ('publish' != get_post_status($args['form'])) {
92 92
 			return aui()->alert(
93 93
 				array(
94 94
 					'type'    => 'warning',
95
-					'content' => __( 'This payment form is no longer active', 'invoicing' ),
95
+					'content' => __('This payment form is no longer active', 'invoicing'),
96 96
 				)
97 97
 			);
98 98
 		}
99 99
 
100 100
 		// Get the form elements and items.
101
-		$elements = $invoicing->form_elements->get_form_elements( $args['form'] );
102
-		$items    = $invoicing->form_elements->get_form_items( $args['form'] );
101
+		$elements = $invoicing->form_elements->get_form_elements($args['form']);
102
+		$items    = $invoicing->form_elements->get_form_items($args['form']);
103 103
 
104 104
 		ob_start();
105 105
 		echo "<form class='wpinv_payment_form'>";
106 106
 		echo "<input type='hidden' name='form_id' value='{$args['form']}'/>";
107
-		wp_nonce_field( 'wpinv_payment_form', 'wpinv_payment_form' );
108
-		wp_nonce_field( 'vat_validation', '_wpi_nonce' );
107
+		wp_nonce_field('wpinv_payment_form', 'wpinv_payment_form');
108
+		wp_nonce_field('vat_validation', '_wpi_nonce');
109 109
 
110
-		foreach ( $elements as $element ) {
111
-			do_action( 'wpinv_frontend_render_payment_form_element', $element, $items, $args['form'] );
112
-			do_action( "wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form'] );
110
+		foreach ($elements as $element) {
111
+			do_action('wpinv_frontend_render_payment_form_element', $element, $items, $args['form']);
112
+			do_action("wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form']);
113 113
 		}
114 114
 
115 115
 		echo "<div class='wpinv_payment_form_errors alert alert-danger d-none'></div>";
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 		$content = ob_get_clean();
119 119
 		
120
-		return str_replace( 'sr-only', '', $content );
120
+		return str_replace('sr-only', '', $content);
121 121
 
122 122
     }
123 123
 
Please login to merge, or discard this patch.
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -16,23 +16,23 @@  discard block
 block discarded – undo
16 16
      */
17 17
     public function __construct() {
18 18
 
19
-		$forms = get_posts(
20
-			array(
21
-				'post_type'      => 'wpi_payment_form',
22
-				'orderby'        => 'title',
23
-				'order'          => 'ASC',
24
-				'posts_per_page' => -1,
25
-				'post_status'    => array( 'publish' ),
26
-			)
27
-		);
28
-
29
-		$options = array(
30
-			'' => __('Select a Form','invoicing')
31
-		);
32
-
33
-		foreach( $forms as $form ) {
34
-			$options[ $form->ID ] = $form->post_title;
35
-		}
19
+        $forms = get_posts(
20
+            array(
21
+                'post_type'      => 'wpi_payment_form',
22
+                'orderby'        => 'title',
23
+                'order'          => 'ASC',
24
+                'posts_per_page' => -1,
25
+                'post_status'    => array( 'publish' ),
26
+            )
27
+        );
28
+
29
+        $options = array(
30
+            '' => __('Select a Form','invoicing')
31
+        );
32
+
33
+        foreach( $forms as $form ) {
34
+            $options[ $form->ID ] = $form->post_title;
35
+        }
36 36
 
37 37
         $options = array(
38 38
             'textdomain'    => 'invoicing',
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
                 'form'            => array(
51 51
                     'title'       => __( 'Payment Form', 'invoicing' ),
52 52
                     'desc'        => __( 'Select your payment form.', 'invoicing' ),
53
-					'type'        => 'select',
54
-					'options'     =>  $options,
53
+                    'type'        => 'select',
54
+                    'options'     =>  $options,
55 55
                     'desc_tip'    => true,
56 56
                     'default'     => '',
57 57
                     'advanced'    => false
@@ -64,60 +64,60 @@  discard block
 block discarded – undo
64 64
         parent::__construct( $options );
65 65
     }
66 66
 
67
-	/**
68
-	 * The Super block output function.
69
-	 *
70
-	 * @param array $args
71
-	 * @param array $widget_args
72
-	 * @param string $content
73
-	 *
74
-	 * @return string
75
-	 */
67
+    /**
68
+     * The Super block output function.
69
+     *
70
+     * @param array $args
71
+     * @param array $widget_args
72
+     * @param string $content
73
+     *
74
+     * @return string
75
+     */
76 76
     public function output( $args = array(), $widget_args = array(), $content = '' ) {
77
-		global $invoicing;
78
-
79
-		// Do we have a payment form?
80
-		if ( empty( $args['form'] ) ) {
81
-			return aui()->alert(
82
-				array(
83
-					'type'    => 'warning',
84
-					'content' => __( 'No payment form selected', 'invoicing' ),
85
-				)
86
-			);
87
-
88
-		}
89
-
90
-		// If yes, ensure that it is published.
91
-		if ( 'publish' != get_post_status( $args['form'] ) ) {
92
-			return aui()->alert(
93
-				array(
94
-					'type'    => 'warning',
95
-					'content' => __( 'This payment form is no longer active', 'invoicing' ),
96
-				)
97
-			);
98
-		}
99
-
100
-		// Get the form elements and items.
101
-		$elements = $invoicing->form_elements->get_form_elements( $args['form'] );
102
-		$items    = $invoicing->form_elements->get_form_items( $args['form'] );
103
-
104
-		ob_start();
105
-		echo "<form class='wpinv_payment_form'>";
106
-		echo "<input type='hidden' name='form_id' value='{$args['form']}'/>";
107
-		wp_nonce_field( 'wpinv_payment_form', 'wpinv_payment_form' );
108
-		wp_nonce_field( 'vat_validation', '_wpi_nonce' );
109
-
110
-		foreach ( $elements as $element ) {
111
-			do_action( 'wpinv_frontend_render_payment_form_element', $element, $items, $args['form'] );
112
-			do_action( "wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form'] );
113
-		}
114
-
115
-		echo "<div class='wpinv_payment_form_errors alert alert-danger d-none'></div>";
116
-		echo '</form>';
117
-
118
-		$content = ob_get_clean();
119
-
120
-		return str_replace( 'sr-only', '', $content );
77
+        global $invoicing;
78
+
79
+        // Do we have a payment form?
80
+        if ( empty( $args['form'] ) ) {
81
+            return aui()->alert(
82
+                array(
83
+                    'type'    => 'warning',
84
+                    'content' => __( 'No payment form selected', 'invoicing' ),
85
+                )
86
+            );
87
+
88
+        }
89
+
90
+        // If yes, ensure that it is published.
91
+        if ( 'publish' != get_post_status( $args['form'] ) ) {
92
+            return aui()->alert(
93
+                array(
94
+                    'type'    => 'warning',
95
+                    'content' => __( 'This payment form is no longer active', 'invoicing' ),
96
+                )
97
+            );
98
+        }
99
+
100
+        // Get the form elements and items.
101
+        $elements = $invoicing->form_elements->get_form_elements( $args['form'] );
102
+        $items    = $invoicing->form_elements->get_form_items( $args['form'] );
103
+
104
+        ob_start();
105
+        echo "<form class='wpinv_payment_form'>";
106
+        echo "<input type='hidden' name='form_id' value='{$args['form']}'/>";
107
+        wp_nonce_field( 'wpinv_payment_form', 'wpinv_payment_form' );
108
+        wp_nonce_field( 'vat_validation', '_wpi_nonce' );
109
+
110
+        foreach ( $elements as $element ) {
111
+            do_action( 'wpinv_frontend_render_payment_form_element', $element, $items, $args['form'] );
112
+            do_action( "wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form'] );
113
+        }
114
+
115
+        echo "<div class='wpinv_payment_form_errors alert alert-danger d-none'></div>";
116
+        echo '</form>';
117
+
118
+        $content = ob_get_clean();
119
+
120
+        return str_replace( 'sr-only', '', $content );
121 121
 
122 122
     }
123 123
 
Please login to merge, or discard this patch.
includes/class-wpinv-payment-form-elements.php 1 patch
Spacing   +581 added lines, -581 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
     exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -13,19 +13,19 @@  discard block
 block discarded – undo
13 13
 
14 14
     public function __construct() {
15 15
 
16
-        foreach( $this->get_elements() as $element ) {
16
+        foreach ($this->get_elements() as $element) {
17 17
             $element = $element['type'];
18 18
 
19
-            if ( method_exists( $this, "render_{$element}_template" ) ) {
20
-                add_action( 'wpinv_payment_form_render_element_template', array( $this, "render_{$element}_template" ), 10, 2 );
19
+            if (method_exists($this, "render_{$element}_template")) {
20
+                add_action('wpinv_payment_form_render_element_template', array($this, "render_{$element}_template"), 10, 2);
21 21
             }
22 22
 
23
-            if ( method_exists( $this, "edit_{$element}_template" ) ) {
24
-                add_action( 'wpinv_payment_form_edit_element_template', array( $this, "edit_{$element}_template" ), 10, 2 );
23
+            if (method_exists($this, "edit_{$element}_template")) {
24
+                add_action('wpinv_payment_form_edit_element_template', array($this, "edit_{$element}_template"), 10, 2);
25 25
             }
26 26
 
27
-            if ( method_exists( $this, "frontend_render_{$element}_template" ) ) {
28
-                add_action( "wpinv_frontend_render_payment_form_$element", array( $this, "frontend_render_{$element}_template" ), 10, 3 );
27
+            if (method_exists($this, "frontend_render_{$element}_template")) {
28
+                add_action("wpinv_frontend_render_payment_form_$element", array($this, "frontend_render_{$element}_template"), 10, 3);
29 29
             }
30 30
 
31 31
         }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function get_elements() {
39 39
 
40
-        if ( ! empty( $this->elements ) ) {
40
+        if (!empty($this->elements)) {
41 41
             return $this->elements;
42 42
         }
43 43
 
@@ -45,28 +45,28 @@  discard block
 block discarded – undo
45 45
 
46 46
             array(
47 47
                 'type'     => 'heading',
48
-                'name'     => __( 'Heading', 'invoicing' ),
48
+                'name'     => __('Heading', 'invoicing'),
49 49
                 'defaults' => array(
50 50
                     'level' => 'h2',
51
-                    'text'  => __( 'Heading', 'invoicing' ),
51
+                    'text'  => __('Heading', 'invoicing'),
52 52
                 )
53 53
             ),
54 54
 
55 55
             array(
56 56
                 'type' => 'paragraph',
57
-                'name' => __( 'Paragraph', 'invoicing' ),
57
+                'name' => __('Paragraph', 'invoicing'),
58 58
                 'defaults'  => array(
59
-                    'text'  => __( 'Paragraph text', 'invoicing' ),
59
+                    'text'  => __('Paragraph text', 'invoicing'),
60 60
                 )
61 61
             ),
62 62
 
63 63
             array( 
64 64
                 'type' => 'alert',
65
-                'name' => __( 'Alert', 'invoicing' ),
65
+                'name' => __('Alert', 'invoicing'),
66 66
                 'defaults'  => array(
67 67
                     'value'        => '',
68 68
                     'class'        => 'alert-warning',
69
-                    'text'         => __( 'Alert', 'invoicing' ),
69
+                    'text'         => __('Alert', 'invoicing'),
70 70
                     'dismissible'  => false,
71 71
                 )
72 72
             ),
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
 
83 83
             array(
84 84
                 'type' => 'text',
85
-                'name' => __( 'Text Input', 'invoicing' ),
85
+                'name' => __('Text Input', 'invoicing'),
86 86
                 'defaults'  => array(
87
-                    'placeholder'  => __( 'Enter some text', 'invoicing' ),
87
+                    'placeholder'  => __('Enter some text', 'invoicing'),
88 88
                     'value'        => '',
89
-                    'label'        => __( 'Field Label', 'invoicing' ),
89
+                    'label'        => __('Field Label', 'invoicing'),
90 90
                     'description'  => '',
91 91
                     'required'     => false,
92 92
                 )
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
 
95 95
             array(
96 96
                 'type' => 'textarea',
97
-                'name' => __( 'Textarea', 'invoicing' ),
97
+                'name' => __('Textarea', 'invoicing'),
98 98
                 'defaults'         => array(
99
-                    'placeholder'  => __( 'Enter your text hear', 'invoicing' ),
99
+                    'placeholder'  => __('Enter your text hear', 'invoicing'),
100 100
                     'value'        => '',
101
-                    'label'        => __( 'Textarea Label', 'invoicing' ),
101
+                    'label'        => __('Textarea Label', 'invoicing'),
102 102
                     'description'  => '',
103 103
                     'required'     => false,
104 104
                 )
@@ -106,27 +106,27 @@  discard block
 block discarded – undo
106 106
 
107 107
             array(
108 108
                 'type' => 'select',
109
-                'name' => __( 'Dropdown', 'invoicing' ),
109
+                'name' => __('Dropdown', 'invoicing'),
110 110
                 'defaults'         => array(
111
-                    'placeholder'  => __( 'Select a value', 'invoicing' ),
111
+                    'placeholder'  => __('Select a value', 'invoicing'),
112 112
                     'value'        => '',
113
-                    'label'        => __( 'Dropdown Label', 'invoicing' ),
113
+                    'label'        => __('Dropdown Label', 'invoicing'),
114 114
                     'description'  => '',
115 115
                     'required'     => false,
116 116
                     'options'      => array(
117
-                        esc_attr__( 'Option One', 'invoicing' ),
118
-                        esc_attr__( 'Option Two', 'invoicing' ),
119
-                        esc_attr__( 'Option Three', 'invoicing' )
117
+                        esc_attr__('Option One', 'invoicing'),
118
+                        esc_attr__('Option Two', 'invoicing'),
119
+                        esc_attr__('Option Three', 'invoicing')
120 120
                     ),
121 121
                 )
122 122
             ),
123 123
 
124 124
             array(
125 125
                 'type' => 'checkbox',
126
-                'name' => __( 'Checkbox', 'invoicing' ),
126
+                'name' => __('Checkbox', 'invoicing'),
127 127
                 'defaults'         => array(
128 128
                     'value'        => '',
129
-                    'label'        => __( 'Checkbox Label', 'invoicing' ),
129
+                    'label'        => __('Checkbox Label', 'invoicing'),
130 130
                     'description'  => '',
131 131
                     'required'     => false,
132 132
                 )
@@ -134,24 +134,24 @@  discard block
 block discarded – undo
134 134
 
135 135
             array( 
136 136
                 'type' => 'radio',
137
-                'name' => __( 'Multiple Choice', 'invoicing' ),
137
+                'name' => __('Multiple Choice', 'invoicing'),
138 138
                 'defaults'     => array(
139
-                    'label'    => __( 'Select one choice', 'invoicing' ),
139
+                    'label'    => __('Select one choice', 'invoicing'),
140 140
                     'options'  => array(
141
-                        esc_attr__( 'Choice One', 'invoicing' ),
142
-                        esc_attr__( 'Choice Two', 'invoicing' ),
143
-                        esc_attr__( 'Choice Three', 'invoicing' )
141
+                        esc_attr__('Choice One', 'invoicing'),
142
+                        esc_attr__('Choice Two', 'invoicing'),
143
+                        esc_attr__('Choice Three', 'invoicing')
144 144
                     ),
145 145
                 )
146 146
             ),
147 147
 
148 148
             array( 
149 149
                 'type' => 'date',
150
-                'name' => __( 'Date', 'invoicing' ),
150
+                'name' => __('Date', 'invoicing'),
151 151
                 'defaults' => array(
152 152
                     'placeholder'  => '',
153 153
                     'value'        => '',
154
-                    'label'        => __( 'Date', 'invoicing' ),
154
+                    'label'        => __('Date', 'invoicing'),
155 155
                     'description'  => '',
156 156
                     'required'     => false,
157 157
                 )
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 
160 160
             array( 
161 161
                 'type' => 'time',
162
-                'name' => __( 'Time', 'invoicing' ),
162
+                'name' => __('Time', 'invoicing'),
163 163
                 'defaults' => array(
164 164
                     'placeholder'  => '',
165 165
                     'value'        => '',
166
-                    'label'        => __( 'Time', 'invoicing' ),
166
+                    'label'        => __('Time', 'invoicing'),
167 167
                     'description'  => '',
168 168
                     'required'     => false,
169 169
                 )
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 
172 172
             array( 
173 173
                 'type' => 'number',
174
-                'name' => __( 'Number', 'invoicing' ),
174
+                'name' => __('Number', 'invoicing'),
175 175
                 'defaults' => array(
176 176
                     'placeholder'  => '',
177 177
                     'value'        => '',
178
-                    'label'        => __( 'Number', 'invoicing' ),
178
+                    'label'        => __('Number', 'invoicing'),
179 179
                     'description'  => '',
180 180
                     'required'     => false,
181 181
                 )
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 
184 184
             array( 
185 185
                 'type' => 'website',
186
-                'name' => __( 'Website', 'invoicing' ),
186
+                'name' => __('Website', 'invoicing'),
187 187
                 'defaults' => array(
188 188
                     'placeholder'  => 'http://example.com',
189 189
                     'value'        => '',
190
-                    'label'        => __( 'Website', 'invoicing' ),
190
+                    'label'        => __('Website', 'invoicing'),
191 191
                     'description'  => '',
192 192
                     'required'     => false,
193 193
                 )
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 
196 196
             array( 
197 197
                 'type' => 'email',
198
-                'name' => __( 'Email', 'invoicing' ),
198
+                'name' => __('Email', 'invoicing'),
199 199
                 'defaults'  => array(
200 200
                     'placeholder'  => '[email protected]',
201 201
                     'value'        => '',
202
-                    'label'        => __( 'Email Address', 'invoicing' ),
202
+                    'label'        => __('Email Address', 'invoicing'),
203 203
                     'description'  => '',
204 204
                     'required'     => false,
205 205
                 )
@@ -207,14 +207,14 @@  discard block
 block discarded – undo
207 207
 
208 208
             array( 
209 209
                 'type' => 'address',
210
-                'name' => __( 'Address', 'invoicing' ),
210
+                'name' => __('Address', 'invoicing'),
211 211
                 'defaults'  => array(
212 212
 
213 213
                     'fields' => array(
214 214
                         array(
215 215
                             'placeholder'  => 'Jon',
216 216
                             'value'        => '',
217
-                            'label'        => __( 'First Name', 'invoicing' ),
217
+                            'label'        => __('First Name', 'invoicing'),
218 218
                             'description'  => '',
219 219
                             'required'     => false,
220 220
                             'visible'      => true,
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
                         array(
225 225
                             'placeholder'  => 'Snow',
226 226
                             'value'        => '',
227
-                            'label'        => __( 'Last Name', 'invoicing' ),
227
+                            'label'        => __('Last Name', 'invoicing'),
228 228
                             'description'  => '',
229 229
                             'required'     => false,
230 230
                             'visible'      => true,
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
                         array(
235 235
                             'placeholder'  => '',
236 236
                             'value'        => '',
237
-                            'label'        => __( 'Address', 'invoicing' ),
237
+                            'label'        => __('Address', 'invoicing'),
238 238
                             'description'  => '',
239 239
                             'required'     => false,
240 240
                             'visible'      => true,
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
                         array(
245 245
                             'placeholder'  => '',
246 246
                             'value'        => '',
247
-                            'label'        => __( 'City', 'invoicing' ),
247
+                            'label'        => __('City', 'invoicing'),
248 248
                             'description'  => '',
249 249
                             'required'     => false,
250 250
                             'visible'      => true,
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
                         ),
253 253
 
254 254
                         array(
255
-                            'placeholder'  => __( 'Select your country' ),
255
+                            'placeholder'  => __('Select your country'),
256 256
                             'value'        => '',
257
-                            'label'        => __( 'Country', 'invoicing' ),
257
+                            'label'        => __('Country', 'invoicing'),
258 258
                             'description'  => '',
259 259
                             'required'     => false,
260 260
                             'visible'      => true,
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
                         ),
263 263
 
264 264
                         array(
265
-                            'placeholder'  => __( 'Choose a state', 'invoicing' ),
265
+                            'placeholder'  => __('Choose a state', 'invoicing'),
266 266
                             'value'        => '',
267
-                            'label'        => __( 'State / Province', 'invoicing' ),
267
+                            'label'        => __('State / Province', 'invoicing'),
268 268
                             'description'  => '',
269 269
                             'required'     => false,
270 270
                             'visible'      => true,
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
                         array(
275 275
                             'placeholder'  => '',
276 276
                             'value'        => '',
277
-                            'label'        => __( 'ZIP / Postcode', 'invoicing' ),
277
+                            'label'        => __('ZIP / Postcode', 'invoicing'),
278 278
                             'description'  => '',
279 279
                             'required'     => false,
280 280
                             'visible'      => true,
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
                         array(
285 285
                             'placeholder'  => '',
286 286
                             'value'        => '',
287
-                            'label'        => __( 'Phone', 'invoicing' ),
287
+                            'label'        => __('Phone', 'invoicing'),
288 288
                             'description'  => '',
289 289
                             'required'     => false,
290 290
                             'visible'      => true,
@@ -296,11 +296,11 @@  discard block
 block discarded – undo
296 296
 
297 297
             array( 
298 298
                 'type' => 'billing_email',
299
-                'name' => __( 'Billing Email', 'invoicing' ),
299
+                'name' => __('Billing Email', 'invoicing'),
300 300
                 'defaults'  => array(
301 301
                     'placeholder'  => '[email protected]',
302 302
                     'value'        => '',
303
-                    'label'        => __( 'Billing Email', 'invoicing' ),
303
+                    'label'        => __('Billing Email', 'invoicing'),
304 304
                     'description'  => '',
305 305
                     'premade'      => true,
306 306
                 )
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 
320 320
             array( 
321 321
                 'type' => 'items',
322
-                'name' => __( 'Items', 'invoicing' ),
322
+                'name' => __('Items', 'invoicing'),
323 323
                 'defaults'  => array(
324 324
                     'value'        => '',
325 325
                     'items_type'   => 'total',
@@ -330,25 +330,25 @@  discard block
 block discarded – undo
330 330
 
331 331
             array( 
332 332
                 'type'       => 'pay_button',
333
-                'name'       => __( 'Payment Button', 'invoicing' ),
333
+                'name'       => __('Payment Button', 'invoicing'),
334 334
                 'defaults'   => array(
335 335
                     'value'        => '',
336 336
                     'class'        => 'btn-primary',
337
-                    'label'        => __( 'Pay Now »', 'invoicing' ),
338
-                    'description'  => __( 'By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ),
337
+                    'label'        => __('Pay Now »', 'invoicing'),
338
+                    'description'  => __('By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'),
339 339
                     'premade'      => true,
340 340
                 )
341 341
             )
342 342
         );
343 343
 
344
-        $this->elements = apply_filters( 'wpinv_filter_core_payment_form_elements', $this->elements );
344
+        $this->elements = apply_filters('wpinv_filter_core_payment_form_elements', $this->elements);
345 345
         return $this->elements;
346 346
     }
347 347
 
348 348
     /**
349 349
      * Returns the restrict markup.
350 350
      */
351
-    public function get_restrict_markup( $field, $field_type ) {
351
+    public function get_restrict_markup($field, $field_type) {
352 352
         $restrict = "$field.type=='$field_type'";
353 353
         return "v-if=\"$restrict\"";
354 354
     }
@@ -356,15 +356,15 @@  discard block
 block discarded – undo
356 356
     /**
357 357
      * Renders the title element template.
358 358
      */
359
-    public function render_heading_template( $field ) {
360
-        $restrict = $this->get_restrict_markup( $field, 'heading' );
359
+    public function render_heading_template($field) {
360
+        $restrict = $this->get_restrict_markup($field, 'heading');
361 361
         echo "<component :is='$field.level' $restrict v-html='$field.text'></component>";
362 362
     }
363 363
 
364 364
     /**
365 365
      * Renders the title element on the frontend.
366 366
      */
367
-    public function frontend_render_heading_template( $field ) {
367
+    public function frontend_render_heading_template($field) {
368 368
         $tag = $field['level'];
369 369
         echo "<$tag>{$field['text']}</$tag>";
370 370
     }
@@ -372,10 +372,10 @@  discard block
 block discarded – undo
372 372
     /**
373 373
      * Renders the edit title element template.
374 374
      */
375
-    public function edit_heading_template( $field ) {
376
-        $restrict = $this->get_restrict_markup( $field, 'heading' );
377
-        $label    = __( 'Heading', 'invoicing' );
378
-        $label2   = __( 'Select Heading Level', 'invoicing' );
375
+    public function edit_heading_template($field) {
376
+        $restrict = $this->get_restrict_markup($field, 'heading');
377
+        $label    = __('Heading', 'invoicing');
378
+        $label2   = __('Select Heading Level', 'invoicing');
379 379
         $id       = $field . '.id + "_edit"';
380 380
         $id2      = $field . '.id + "_edit2"';
381 381
 
@@ -407,8 +407,8 @@  discard block
 block discarded – undo
407 407
     /**
408 408
      * Renders a paragraph element template.
409 409
      */
410
-    public function render_paragraph_template( $field ) {
411
-        $restrict = $this->get_restrict_markup( $field, 'paragraph' );
410
+    public function render_paragraph_template($field) {
411
+        $restrict = $this->get_restrict_markup($field, 'paragraph');
412 412
         $label    = "$field.text";
413 413
         echo "<p $restrict v-html='$label' style='font-size: 16px;'></p>";
414 414
     }
@@ -416,16 +416,16 @@  discard block
 block discarded – undo
416 416
     /**
417 417
      * Renders the paragraph element on the frontend.
418 418
      */
419
-    public function frontend_render_paragraph_template( $field ) {
419
+    public function frontend_render_paragraph_template($field) {
420 420
         echo "<p>{$field['text']}</p>";
421 421
     }
422 422
 
423 423
     /**
424 424
      * Renders the edit paragraph element template.
425 425
      */
426
-    public function edit_paragraph_template( $field ) {
427
-        $restrict = $this->get_restrict_markup( $field, 'paragraph' );
428
-        $label    = __( 'Enter your text', 'invoicing' );
426
+    public function edit_paragraph_template($field) {
427
+        $restrict = $this->get_restrict_markup($field, 'paragraph');
428
+        $label    = __('Enter your text', 'invoicing');
429 429
         $id       = $field . '.id + "_edit"';
430 430
         echo "
431 431
             <div $restrict>
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
     /**
442 442
      * Renders the text element template.
443 443
      */
444
-    public function render_text_template( $field ) {
445
-        $restrict = $this->get_restrict_markup( $field, 'text' );
444
+    public function render_text_template($field) {
445
+        $restrict = $this->get_restrict_markup($field, 'text');
446 446
         $label    = "$field.label";
447 447
         echo "
448 448
             <div $restrict>
@@ -456,23 +456,23 @@  discard block
 block discarded – undo
456 456
     /**
457 457
      * Renders the text element on the frontend.
458 458
      */
459
-    public function frontend_render_text_template( $field ) {
459
+    public function frontend_render_text_template($field) {
460 460
         
461 461
         echo "<div class='form-group'>";
462 462
 
463 463
         echo aui()->input(
464 464
             array(
465
-                'name'       => esc_attr( $field['id'] ),
466
-                'id'         => esc_attr( $field['id'] ),
467
-                'placeholder'=> esc_attr( $field['placeholder'] ),
465
+                'name'       => esc_attr($field['id']),
466
+                'id'         => esc_attr($field['id']),
467
+                'placeholder'=> esc_attr($field['placeholder']),
468 468
                 'required'   => (bool) $field['required'],
469
-                'label'      => wp_kses_post( $field['label'] ),
469
+                'label'      => wp_kses_post($field['label']),
470 470
                 'no_wrap'    => true,
471 471
             )
472 472
         );
473 473
 
474
-        if ( ! empty( $field['description'] ) ) {
475
-            $description = wp_kses_post( $field['description'] );
474
+        if (!empty($field['description'])) {
475
+            $description = wp_kses_post($field['description']);
476 476
             echo "<small class='form-text text-muted'>$description</small>";
477 477
         }
478 478
 
@@ -483,16 +483,16 @@  discard block
 block discarded – undo
483 483
     /**
484 484
      * Renders the edit text element template.
485 485
      */
486
-    public function edit_text_template( $field ) {
487
-        $restrict = $this->get_restrict_markup( $field, 'text' );
488
-        $label    = __( 'Field Label', 'invoicing' );
486
+    public function edit_text_template($field) {
487
+        $restrict = $this->get_restrict_markup($field, 'text');
488
+        $label    = __('Field Label', 'invoicing');
489 489
         $id       = $field . '.id + "_edit"';
490
-        $label2   = __( 'Placeholder text', 'invoicing' );
490
+        $label2   = __('Placeholder text', 'invoicing');
491 491
         $id2      = $field . '.id + "_edit2"';
492
-        $label3   = __( 'Help text', 'invoicing' );
493
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
492
+        $label3   = __('Help text', 'invoicing');
493
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
494 494
         $id3      = $field . '.id + "_edit3"';
495
-        $label5   = __( 'Is this field required?', 'invoicing' );
495
+        $label5   = __('Is this field required?', 'invoicing');
496 496
         $id4      = $field . '.id + "_edit4"';
497 497
         echo "
498 498
             <div $restrict>
@@ -520,8 +520,8 @@  discard block
 block discarded – undo
520 520
     /**
521 521
      * Renders the textarea element template.
522 522
      */
523
-    public function render_textarea_template( $field ) {
524
-        $restrict = $this->get_restrict_markup( $field, 'textarea' );
523
+    public function render_textarea_template($field) {
524
+        $restrict = $this->get_restrict_markup($field, 'textarea');
525 525
         $label    = "$field.label";
526 526
         echo "
527 527
             <div $restrict>
@@ -535,24 +535,24 @@  discard block
 block discarded – undo
535 535
     /**
536 536
      * Renders the textarea element on the frontend.
537 537
      */
538
-    public function frontend_render_textarea_template( $field ) {
538
+    public function frontend_render_textarea_template($field) {
539 539
         
540 540
         echo "<div class='form-group'>";
541 541
 
542 542
         echo aui()->textarea(
543 543
             array(
544
-                'name'       => esc_attr( $field['id'] ),
545
-                'id'         => esc_attr( $field['id'] ),
546
-                'placeholder'=> esc_attr( $field['placeholder'] ),
544
+                'name'       => esc_attr($field['id']),
545
+                'id'         => esc_attr($field['id']),
546
+                'placeholder'=> esc_attr($field['placeholder']),
547 547
                 'required'   => (bool) $field['required'],
548
-                'label'      => wp_kses_post( $field['label'] ),
548
+                'label'      => wp_kses_post($field['label']),
549 549
                 'no_wrap'    => true,
550 550
                 'rows'       => 3,
551 551
             )
552 552
         );
553 553
 
554
-        if ( ! empty( $field['description'] ) ) {
555
-            $description = wp_kses_post( $field['description'] );
554
+        if (!empty($field['description'])) {
555
+            $description = wp_kses_post($field['description']);
556 556
             echo "<small class='form-text text-muted'>$description</small>";
557 557
         }
558 558
 
@@ -563,16 +563,16 @@  discard block
 block discarded – undo
563 563
     /**
564 564
      * Renders the edit textarea element template.
565 565
      */
566
-    public function edit_textarea_template( $field ) {
567
-        $restrict = $this->get_restrict_markup( $field, 'textarea' );
568
-        $label    = __( 'Field Label', 'invoicing' );
566
+    public function edit_textarea_template($field) {
567
+        $restrict = $this->get_restrict_markup($field, 'textarea');
568
+        $label    = __('Field Label', 'invoicing');
569 569
         $id       = $field . '.id + "_edit"';
570
-        $label2   = __( 'Placeholder text', 'invoicing' );
570
+        $label2   = __('Placeholder text', 'invoicing');
571 571
         $id2      = $field . '.id + "_edit2"';
572
-        $label3   = __( 'Help text', 'invoicing' );
573
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
572
+        $label3   = __('Help text', 'invoicing');
573
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
574 574
         $id3      = $field . '.id + "_edit3"';
575
-        $label5   = __( 'Is this field required?', 'invoicing' );
575
+        $label5   = __('Is this field required?', 'invoicing');
576 576
         $id4      = $field . '.id + "_edit4"';
577 577
         echo "
578 578
             <div $restrict>
@@ -600,8 +600,8 @@  discard block
 block discarded – undo
600 600
     /**
601 601
      * Renders the select element template.
602 602
      */
603
-    public function render_select_template( $field ) {
604
-        $restrict    = $this->get_restrict_markup( $field, 'select' );
603
+    public function render_select_template($field) {
604
+        $restrict    = $this->get_restrict_markup($field, 'select');
605 605
         $label       = "$field.label";
606 606
         $placeholder = "$field.placeholder";
607 607
         $id          = $field . '.id';
@@ -620,24 +620,24 @@  discard block
 block discarded – undo
620 620
     /**
621 621
      * Renders the select element on the frontend.
622 622
      */
623
-    public function frontend_render_select_template( $field ) {
623
+    public function frontend_render_select_template($field) {
624 624
         
625 625
         echo "<div class='form-group'>";
626 626
 
627 627
         echo aui()->select(
628 628
             array(
629
-                'name'       => esc_attr( $field['id'] ),
630
-                'id'         => esc_attr( $field['id'] ),
631
-                'placeholder'=> esc_attr( $field['placeholder'] ),
629
+                'name'       => esc_attr($field['id']),
630
+                'id'         => esc_attr($field['id']),
631
+                'placeholder'=> esc_attr($field['placeholder']),
632 632
                 'required'   => (bool) $field['required'],
633
-                'label'      => wp_kses_post( $field['label'] ),
633
+                'label'      => wp_kses_post($field['label']),
634 634
                 'no_wrap'    => true,
635
-                'options'    => array_combine( $field['options'], $field['options'] ),
635
+                'options'    => array_combine($field['options'], $field['options']),
636 636
             )
637 637
         );
638 638
 
639
-        if ( ! empty( $field['description'] ) ) {
640
-            $description = wp_kses_post( $field['description'] );
639
+        if (!empty($field['description'])) {
640
+            $description = wp_kses_post($field['description']);
641 641
             echo "<small class='form-text text-muted'>$description</small>";
642 642
         }
643 643
 
@@ -648,18 +648,18 @@  discard block
 block discarded – undo
648 648
     /**
649 649
      * Renders the edit select element template.
650 650
      */
651
-    public function edit_select_template( $field ) {
652
-        $restrict = $this->get_restrict_markup( $field, 'select' );
653
-        $label    = __( 'Field Label', 'invoicing' );
651
+    public function edit_select_template($field) {
652
+        $restrict = $this->get_restrict_markup($field, 'select');
653
+        $label    = __('Field Label', 'invoicing');
654 654
         $id       = $field . '.id + "_edit"';
655
-        $label2   = __( 'Placeholder text', 'invoicing' );
655
+        $label2   = __('Placeholder text', 'invoicing');
656 656
         $id2      = $field . '.id + "_edit2"';
657
-        $label3   = __( 'Help text', 'invoicing' );
658
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
657
+        $label3   = __('Help text', 'invoicing');
658
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
659 659
         $id3      = $field . '.id + "_edit3"';
660
-        $label5   = __( 'Is this field required?', 'invoicing' );
660
+        $label5   = __('Is this field required?', 'invoicing');
661 661
         $id4      = $field . '.id + "_edit4"';
662
-        $label6   = __( 'Available Options', 'invoicing' );
662
+        $label6   = __('Available Options', 'invoicing');
663 663
         echo "
664 664
             <div $restrict>
665 665
                 <div class='form-group'>
@@ -697,8 +697,8 @@  discard block
 block discarded – undo
697 697
     /**
698 698
      * Renders the checkbox element template.
699 699
      */
700
-    public function render_checkbox_template( $field ) {
701
-        $restrict = $this->get_restrict_markup( $field, 'checkbox' );
700
+    public function render_checkbox_template($field) {
701
+        $restrict = $this->get_restrict_markup($field, 'checkbox');
702 702
         $label    = "$field.label";
703 703
         echo "
704 704
             <div class='form-check' $restrict>
@@ -712,24 +712,24 @@  discard block
 block discarded – undo
712 712
     /**
713 713
      * Renders the checkbox element on the frontend.
714 714
      */
715
-    public function frontend_render_checkbox_template( $field ) {
715
+    public function frontend_render_checkbox_template($field) {
716 716
         
717 717
         echo "<div class='form-group'>";
718 718
 
719 719
         echo aui()->input(
720 720
             array(
721
-                'name'       => esc_attr( $field['id'] ),
722
-                'id'         => esc_attr( $field['id'] ),
721
+                'name'       => esc_attr($field['id']),
722
+                'id'         => esc_attr($field['id']),
723 723
                 'required'   => (bool) $field['required'],
724
-                'label'      => wp_kses_post( $field['label'] ),
724
+                'label'      => wp_kses_post($field['label']),
725 725
                 'no_wrap'    => true,
726
-                'value'      => esc_attr__( 'Yes', 'invoicing' ),
726
+                'value'      => esc_attr__('Yes', 'invoicing'),
727 727
                 'type'       => 'checkbox',
728 728
             )
729 729
         );
730 730
 
731
-        if ( ! empty( $field['description'] ) ) {
732
-            $description = wp_kses_post( $field['description'] );
731
+        if (!empty($field['description'])) {
732
+            $description = wp_kses_post($field['description']);
733 733
             echo "<small class='form-text text-muted'>$description</small>";
734 734
         }
735 735
 
@@ -740,14 +740,14 @@  discard block
 block discarded – undo
740 740
     /**
741 741
      * Renders the edit checkbox element template.
742 742
      */
743
-    public function edit_checkbox_template( $field ) {
744
-        $restrict = $this->get_restrict_markup( $field, 'checkbox' );
745
-        $label    = __( 'Field Label', 'invoicing' );
743
+    public function edit_checkbox_template($field) {
744
+        $restrict = $this->get_restrict_markup($field, 'checkbox');
745
+        $label    = __('Field Label', 'invoicing');
746 746
         $id       = $field . '.id + "_edit"';
747
-        $label2   = __( 'Help text', 'invoicing' );
748
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
747
+        $label2   = __('Help text', 'invoicing');
748
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
749 749
         $id2      = $field . '.id + "_edit2"';
750
-        $label4   = __( 'Is this field required?', 'invoicing' );
750
+        $label4   = __('Is this field required?', 'invoicing');
751 751
         $id3      = $field . '.id + "_edit3"';
752 752
         echo "
753 753
             <div $restrict>
@@ -771,8 +771,8 @@  discard block
 block discarded – undo
771 771
     /**
772 772
      * Renders the radio element template.
773 773
      */
774
-    public function render_radio_template( $field ) {
775
-        $restrict    = $this->get_restrict_markup( $field, 'radio' );
774
+    public function render_radio_template($field) {
775
+        $restrict    = $this->get_restrict_markup($field, 'radio');
776 776
         $label       = "$field.label";
777 777
         $id          = $field . '.id';
778 778
         echo "
@@ -790,20 +790,20 @@  discard block
 block discarded – undo
790 790
     /**
791 791
      * Renders the radio element on the frontend.
792 792
      */
793
-    public function frontend_render_radio_template( $field ) {
793
+    public function frontend_render_radio_template($field) {
794 794
         
795 795
         echo "<div class='form-group'>";
796 796
 
797
-        if ( ! empty( $field['label'] ) ) {
798
-            $label = wp_kses_post( $field['label'] );
797
+        if (!empty($field['label'])) {
798
+            $label = wp_kses_post($field['label']);
799 799
             echo "<legend class='col-form-label'>$label</legend>";
800 800
         }
801 801
 
802
-        foreach( $field['options'] as $index => $option ) {
802
+        foreach ($field['options'] as $index => $option) {
803 803
             $id    = $field['id'] . $index;
804 804
             $name  = $field['id'];
805
-            $value = esc_attr( $option );
806
-            $label = wp_kses_post( $option );
805
+            $value = esc_attr($option);
806
+            $label = wp_kses_post($option);
807 807
 
808 808
             echo "
809 809
                 <div class='form-check'>
@@ -813,8 +813,8 @@  discard block
 block discarded – undo
813 813
             ";
814 814
         }
815 815
 
816
-        if ( ! empty( $field['description'] ) ) {
817
-            $description = wp_kses_post( $field['description'] );
816
+        if (!empty($field['description'])) {
817
+            $description = wp_kses_post($field['description']);
818 818
             echo "<small class='form-text text-muted'>$description</small>";
819 819
         }
820 820
 
@@ -825,16 +825,16 @@  discard block
 block discarded – undo
825 825
     /**
826 826
      * Renders the edit radio element template.
827 827
      */
828
-    public function edit_radio_template( $field ) {
829
-        $restrict = $this->get_restrict_markup( $field, 'radio' );
830
-        $label    = __( 'Field Label', 'invoicing' );
828
+    public function edit_radio_template($field) {
829
+        $restrict = $this->get_restrict_markup($field, 'radio');
830
+        $label    = __('Field Label', 'invoicing');
831 831
         $id       = $field . '.id + "_edit"';
832
-        $label2   = __( 'Help text', 'invoicing' );
833
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
832
+        $label2   = __('Help text', 'invoicing');
833
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
834 834
         $id2      = $field . '.id + "_edit3"';
835
-        $label4   = __( 'Is this field required?', 'invoicing' );
835
+        $label4   = __('Is this field required?', 'invoicing');
836 836
         $id3      = $field . '.id + "_edit4"';
837
-        $label5   = __( 'Available Options', 'invoicing' );
837
+        $label5   = __('Available Options', 'invoicing');
838 838
         echo "
839 839
             <div $restrict>
840 840
                 <div class='form-group'>
@@ -868,8 +868,8 @@  discard block
 block discarded – undo
868 868
     /**
869 869
      * Renders the address element template.
870 870
      */
871
-    public function render_address_template( $field ) {
872
-        $restrict    = $this->get_restrict_markup( $field, 'address' );
871
+    public function render_address_template($field) {
872
+        $restrict = $this->get_restrict_markup($field, 'address');
873 873
 
874 874
         echo "
875 875
             <div class='wpinv-address-wrapper' $restrict>
@@ -890,55 +890,55 @@  discard block
 block discarded – undo
890 890
     /**
891 891
      * Renders the address element on the frontend.
892 892
      */
893
-    public function frontend_render_address_template( $field ) {
893
+    public function frontend_render_address_template($field) {
894 894
         
895 895
         echo "<div class='wpinv-address-fields'>";
896 896
 
897
-        foreach( $field['fields'] as $address_field ) {
897
+        foreach ($field['fields'] as $address_field) {
898 898
 
899
-            if ( empty( $address_field['visible'] ) ) {
899
+            if (empty($address_field['visible'])) {
900 900
                 continue;
901 901
             }
902 902
 
903
-            $class = esc_attr( $address_field['name'] );
903
+            $class = esc_attr($address_field['name']);
904 904
             echo "<div class='form-group $class'>";
905 905
 
906 906
             $label = $address_field['label'];
907 907
 
908
-            if ( ! empty( $address_field['required'] ) ) {
908
+            if (!empty($address_field['required'])) {
909 909
                 $label .= "<span class='text-danger'> *</span>";
910 910
             }
911 911
 
912
-            if ( 'wpinv_country' == $address_field['name'] ) {
912
+            if ('wpinv_country' == $address_field['name']) {
913 913
 
914
-                echo aui()->select( array(
914
+                echo aui()->select(array(
915 915
                     'options'          => wpinv_get_country_list(),
916
-                    'name'             => esc_attr( $address_field['name'] ),
917
-                    'id'               => esc_attr( $address_field['name'] ),
916
+                    'name'             => esc_attr($address_field['name']),
917
+                    'id'               => esc_attr($address_field['name']),
918 918
                     'value'            => wpinv_get_default_country(),
919
-                    'placeholder'      => esc_attr( $address_field['placeholder'] ),
919
+                    'placeholder'      => esc_attr($address_field['placeholder']),
920 920
                     'required'         => (bool) $address_field['required'],
921 921
                     'no_wrap'          => true,
922
-                    'label'            => wp_kses_post( $label ),
922
+                    'label'            => wp_kses_post($label),
923 923
                     'select2'          => false,
924 924
                 ));
925 925
     
926
-            } else if ( 'wpinv_state' == $address_field['name'] ) {
926
+            } else if ('wpinv_state' == $address_field['name']) {
927 927
 
928
-                $states = wpinv_get_country_states( wpinv_get_default_country() );
928
+                $states = wpinv_get_country_states(wpinv_get_default_country());
929 929
                 $state  = wpinv_get_default_state();
930 930
 
931
-                if ( ! empty( $states ) ) {
931
+                if (!empty($states)) {
932 932
 
933
-                    echo aui()->select( array(
933
+                    echo aui()->select(array(
934 934
                         'options'          => $states,
935
-                        'name'             => esc_attr( $address_field['name'] ),
936
-                        'id'               => esc_attr( $address_field['name'] ),
935
+                        'name'             => esc_attr($address_field['name']),
936
+                        'id'               => esc_attr($address_field['name']),
937 937
                         'value'            => $state,
938
-                        'placeholder'      => esc_attr( $address_field['placeholder'] ),
938
+                        'placeholder'      => esc_attr($address_field['placeholder']),
939 939
                         'required'         => (bool) $address_field['required'],
940 940
                         'no_wrap'          => true,
941
-                        'label'            => wp_kses_post( $label ),
941
+                        'label'            => wp_kses_post($label),
942 942
                         'select2'          => false,
943 943
                     ));
944 944
 
@@ -946,10 +946,10 @@  discard block
 block discarded – undo
946 946
 
947 947
                     echo aui()->input(
948 948
                         array(
949
-                            'name'       => esc_attr( $address_field['name'] ),
950
-                            'id'         => esc_attr( $address_field['name'] ),
949
+                            'name'       => esc_attr($address_field['name']),
950
+                            'id'         => esc_attr($address_field['name']),
951 951
                             'required'   => (bool) $address_field['required'],
952
-                            'label'      => wp_kses_post( $label ),
952
+                            'label'      => wp_kses_post($label),
953 953
                             'no_wrap'    => true,
954 954
                             'type'       => 'text',
955 955
                         )
@@ -961,12 +961,12 @@  discard block
 block discarded – undo
961 961
 
962 962
                 echo aui()->input(
963 963
                     array(
964
-                        'name'       => esc_attr( $address_field['name'] ),
965
-                        'id'         => esc_attr( $address_field['name'] ),
964
+                        'name'       => esc_attr($address_field['name']),
965
+                        'id'         => esc_attr($address_field['name']),
966 966
                         'required'   => (bool) $address_field['required'],
967
-                        'label'      => wp_kses_post( $label ),
967
+                        'label'      => wp_kses_post($label),
968 968
                         'no_wrap'    => true,
969
-                        'placeholder' => esc_attr( $address_field['placeholder'] ),
969
+                        'placeholder' => esc_attr($address_field['placeholder']),
970 970
                         'type'       => 'text',
971 971
                     )
972 972
                 );
@@ -974,8 +974,8 @@  discard block
 block discarded – undo
974 974
             }
975 975
             
976 976
 
977
-            if ( ! empty( $address_field['description'] ) ) {
978
-                $description = wp_kses_post( $address_field['description'] );
977
+            if (!empty($address_field['description'])) {
978
+                $description = wp_kses_post($address_field['description']);
979 979
                 echo "<small class='form-text text-muted'>$description</small>";
980 980
             }
981 981
     
@@ -990,13 +990,13 @@  discard block
 block discarded – undo
990 990
     /**
991 991
      * Renders the edit address element template.
992 992
      */
993
-    public function edit_address_template( $field ) {
994
-        $restrict  = $this->get_restrict_markup( $field, 'address' );
995
-        $label     = __( 'Field Label', 'invoicing' );
996
-        $label2    = __( 'Placeholder', 'invoicing' );
997
-        $label3    = __( 'Description', 'invoicing' );
998
-        $label4    = __( 'Is required', 'invoicing' );
999
-        $label5    = __( 'Is visible', 'invoicing' );
993
+    public function edit_address_template($field) {
994
+        $restrict  = $this->get_restrict_markup($field, 'address');
995
+        $label     = __('Field Label', 'invoicing');
996
+        $label2    = __('Placeholder', 'invoicing');
997
+        $label3    = __('Description', 'invoicing');
998
+        $label4    = __('Is required', 'invoicing');
999
+        $label5    = __('Is visible', 'invoicing');
1000 1000
         $id        = $field . '.id + "_edit_label"';
1001 1001
         $id2       = $field . '.id + "_edit_placeholder"';
1002 1002
         $id3       = $field . '.id + "_edit_description"';
@@ -1064,8 +1064,8 @@  discard block
 block discarded – undo
1064 1064
     /**
1065 1065
      * Renders the email element template.
1066 1066
      */
1067
-    public function render_email_template( $field ) {
1068
-        $restrict = $this->get_restrict_markup( $field, 'email' );
1067
+    public function render_email_template($field) {
1068
+        $restrict = $this->get_restrict_markup($field, 'email');
1069 1069
         $label    = "$field.label";
1070 1070
         echo "
1071 1071
             <div $restrict>
@@ -1079,8 +1079,8 @@  discard block
 block discarded – undo
1079 1079
     /**
1080 1080
      * Renders the billing_email element template.
1081 1081
      */
1082
-    public function render_billing_email_template( $field ) {
1083
-        $restrict = $this->get_restrict_markup( $field, 'billing_email' );
1082
+    public function render_billing_email_template($field) {
1083
+        $restrict = $this->get_restrict_markup($field, 'billing_email');
1084 1084
         $label    = "$field.label";
1085 1085
         echo "
1086 1086
             <div $restrict>
@@ -1094,24 +1094,24 @@  discard block
 block discarded – undo
1094 1094
     /**
1095 1095
      * Renders the email element on the frontend.
1096 1096
      */
1097
-    public function frontend_render_email_template( $field ) {
1097
+    public function frontend_render_email_template($field) {
1098 1098
         
1099 1099
         echo "<div class='form-group'>";
1100 1100
 
1101 1101
         echo aui()->input(
1102 1102
             array(
1103
-                'name'       => esc_attr( $field['id'] ),
1104
-                'id'         => esc_attr( $field['id'] ),
1103
+                'name'       => esc_attr($field['id']),
1104
+                'id'         => esc_attr($field['id']),
1105 1105
                 'required'   => (bool) $field['required'],
1106
-                'label'      => wp_kses_post( $field['label'] ),
1106
+                'label'      => wp_kses_post($field['label']),
1107 1107
                 'no_wrap'    => true,
1108
-                'placeholder' => esc_attr( $field['placeholder'] ),
1108
+                'placeholder' => esc_attr($field['placeholder']),
1109 1109
                 'type'       => 'email',
1110 1110
             )
1111 1111
         );
1112 1112
 
1113
-        if ( ! empty( $field['description'] ) ) {
1114
-            $description = wp_kses_post( $field['description'] );
1113
+        if (!empty($field['description'])) {
1114
+            $description = wp_kses_post($field['description']);
1115 1115
             echo "<small class='form-text text-muted'>$description</small>";
1116 1116
         }
1117 1117
 
@@ -1122,30 +1122,30 @@  discard block
 block discarded – undo
1122 1122
     /**
1123 1123
      * Renders the billing email element on the frontend.
1124 1124
      */
1125
-    public function frontend_render_billing_email_template( $field ) {
1125
+    public function frontend_render_billing_email_template($field) {
1126 1126
         
1127 1127
         echo "<div class='form-group'>";
1128 1128
         $value = '';
1129 1129
 
1130
-        if ( is_user_logged_in() ) {
1130
+        if (is_user_logged_in()) {
1131 1131
             $user  = wp_get_current_user();
1132
-            $value = sanitize_email( $user->user_email );
1132
+            $value = sanitize_email($user->user_email);
1133 1133
         }
1134 1134
         echo aui()->input(
1135 1135
             array(
1136 1136
                 'name'       => 'billing_email',
1137 1137
                 'value'      => $value,
1138
-                'id'         => esc_attr( $field['id'] ),
1138
+                'id'         => esc_attr($field['id']),
1139 1139
                 'required'   => true,
1140
-                'label'      => wp_kses_post( $field['label'] ),
1140
+                'label'      => wp_kses_post($field['label']),
1141 1141
                 'no_wrap'    => true,
1142
-                'placeholder' => esc_attr( $field['placeholder'] ),
1142
+                'placeholder' => esc_attr($field['placeholder']),
1143 1143
                 'type'       => 'email',
1144 1144
             )
1145 1145
         );
1146 1146
 
1147
-        if ( ! empty( $field['description'] ) ) {
1148
-            $description = wp_kses_post( $field['description'] );
1147
+        if (!empty($field['description'])) {
1148
+            $description = wp_kses_post($field['description']);
1149 1149
             echo "<small class='form-text text-muted'>$description</small>";
1150 1150
         }
1151 1151
 
@@ -1156,16 +1156,16 @@  discard block
 block discarded – undo
1156 1156
     /**
1157 1157
      * Renders the edit email element template.
1158 1158
      */
1159
-    public function edit_email_template( $field ) {
1160
-        $restrict = $this->get_restrict_markup( $field, 'email' );
1161
-        $label    = __( 'Field Label', 'invoicing' );
1159
+    public function edit_email_template($field) {
1160
+        $restrict = $this->get_restrict_markup($field, 'email');
1161
+        $label    = __('Field Label', 'invoicing');
1162 1162
         $id       = $field . '.id + "_edit"';
1163
-        $label2   = __( 'Placeholder text', 'invoicing' );
1163
+        $label2   = __('Placeholder text', 'invoicing');
1164 1164
         $id2      = $field . '.id + "_edit2"';
1165
-        $label3   = __( 'Help text', 'invoicing' );
1166
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1165
+        $label3   = __('Help text', 'invoicing');
1166
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1167 1167
         $id3      = $field . '.id + "_edit3"';
1168
-        $label5   = __( 'Is this field required?', 'invoicing' );
1168
+        $label5   = __('Is this field required?', 'invoicing');
1169 1169
         $id4      = $field . '.id + "_edit4"';
1170 1170
         echo "
1171 1171
             <div $restrict>
@@ -1193,16 +1193,16 @@  discard block
 block discarded – undo
1193 1193
     /**
1194 1194
      * Renders the edit billing_email element template.
1195 1195
      */
1196
-    public function edit_billing_email_template( $field ) {
1197
-        $restrict = $this->get_restrict_markup( $field, 'billing_email' );
1198
-        $label    = __( 'Field Label', 'invoicing' );
1196
+    public function edit_billing_email_template($field) {
1197
+        $restrict = $this->get_restrict_markup($field, 'billing_email');
1198
+        $label    = __('Field Label', 'invoicing');
1199 1199
         $id       = $field . '.id + "_edit"';
1200
-        $label2   = __( 'Placeholder text', 'invoicing' );
1200
+        $label2   = __('Placeholder text', 'invoicing');
1201 1201
         $id2      = $field . '.id + "_edit2"';
1202
-        $label3   = __( 'Help text', 'invoicing' );
1203
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1202
+        $label3   = __('Help text', 'invoicing');
1203
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1204 1204
         $id3      = $field . '.id + "_edit3"';
1205
-        $label5   = __( 'Is this field required?', 'invoicing' );
1205
+        $label5   = __('Is this field required?', 'invoicing');
1206 1206
         $id4      = $field . '.id + "_edit4"';
1207 1207
         echo "
1208 1208
             <div $restrict>
@@ -1226,8 +1226,8 @@  discard block
 block discarded – undo
1226 1226
     /**
1227 1227
      * Renders the website element template.
1228 1228
      */
1229
-    public function render_website_template( $field ) {
1230
-        $restrict = $this->get_restrict_markup( $field, 'website' );
1229
+    public function render_website_template($field) {
1230
+        $restrict = $this->get_restrict_markup($field, 'website');
1231 1231
         $label    = "$field.label";
1232 1232
         echo "
1233 1233
             <div $restrict>
@@ -1241,24 +1241,24 @@  discard block
 block discarded – undo
1241 1241
     /**
1242 1242
      * Renders the website element on the frontend.
1243 1243
      */
1244
-    public function frontend_render_website_template( $field ) {
1244
+    public function frontend_render_website_template($field) {
1245 1245
         
1246 1246
         echo "<div class='form-group'>";
1247 1247
 
1248 1248
         echo aui()->input(
1249 1249
             array(
1250
-                'name'       => esc_attr( $field['id'] ),
1251
-                'id'         => esc_attr( $field['id'] ),
1250
+                'name'       => esc_attr($field['id']),
1251
+                'id'         => esc_attr($field['id']),
1252 1252
                 'required'   => (bool) $field['required'],
1253
-                'label'      => wp_kses_post( $field['label'] ),
1253
+                'label'      => wp_kses_post($field['label']),
1254 1254
                 'no_wrap'    => true,
1255
-                'placeholder' => esc_attr( $field['placeholder'] ),
1255
+                'placeholder' => esc_attr($field['placeholder']),
1256 1256
                 'type'       => 'url',
1257 1257
             )
1258 1258
         );
1259 1259
 
1260
-        if ( ! empty( $field['description'] ) ) {
1261
-            $description = wp_kses_post( $field['description'] );
1260
+        if (!empty($field['description'])) {
1261
+            $description = wp_kses_post($field['description']);
1262 1262
             echo "<small class='form-text text-muted'>$description</small>";
1263 1263
         }
1264 1264
 
@@ -1269,16 +1269,16 @@  discard block
 block discarded – undo
1269 1269
     /**
1270 1270
      * Renders the edit website element template.
1271 1271
      */
1272
-    public function edit_website_template( $field ) {
1273
-        $restrict = $this->get_restrict_markup( $field, 'website' );
1274
-        $label    = __( 'Field Label', 'invoicing' );
1272
+    public function edit_website_template($field) {
1273
+        $restrict = $this->get_restrict_markup($field, 'website');
1274
+        $label    = __('Field Label', 'invoicing');
1275 1275
         $id       = $field . '.id + "_edit"';
1276
-        $label2   = __( 'Placeholder text', 'invoicing' );
1276
+        $label2   = __('Placeholder text', 'invoicing');
1277 1277
         $id2      = $field . '.id + "_edit2"';
1278
-        $label3   = __( 'Help text', 'invoicing' );
1279
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1278
+        $label3   = __('Help text', 'invoicing');
1279
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1280 1280
         $id3      = $field . '.id + "_edit3"';
1281
-        $label5   = __( 'Is this field required?', 'invoicing' );
1281
+        $label5   = __('Is this field required?', 'invoicing');
1282 1282
         $id4      = $field . '.id + "_edit4"';
1283 1283
         echo "
1284 1284
             <div $restrict>
@@ -1306,8 +1306,8 @@  discard block
 block discarded – undo
1306 1306
     /**
1307 1307
      * Renders the date element template.
1308 1308
      */
1309
-    public function render_date_template( $field ) {
1310
-        $restrict = $this->get_restrict_markup( $field, 'date' );
1309
+    public function render_date_template($field) {
1310
+        $restrict = $this->get_restrict_markup($field, 'date');
1311 1311
         $label    = "$field.label";
1312 1312
         echo "
1313 1313
             <div $restrict>
@@ -1321,24 +1321,24 @@  discard block
 block discarded – undo
1321 1321
     /**
1322 1322
      * Renders the date element on the frontend.
1323 1323
      */
1324
-    public function frontend_render_date_template( $field ) {
1324
+    public function frontend_render_date_template($field) {
1325 1325
         
1326 1326
         echo "<div class='form-group'>";
1327 1327
 
1328 1328
         echo aui()->input(
1329 1329
             array(
1330
-                'name'       => esc_attr( $field['id'] ),
1331
-                'id'         => esc_attr( $field['id'] ),
1330
+                'name'       => esc_attr($field['id']),
1331
+                'id'         => esc_attr($field['id']),
1332 1332
                 'required'   => (bool) $field['required'],
1333
-                'label'      => wp_kses_post( $field['label'] ),
1334
-                'placeholder' => esc_attr( $field['placeholder'] ),
1333
+                'label'      => wp_kses_post($field['label']),
1334
+                'placeholder' => esc_attr($field['placeholder']),
1335 1335
                 'no_wrap'    => true,
1336 1336
                 'type'       => 'date',
1337 1337
             )
1338 1338
         );
1339 1339
 
1340
-        if ( ! empty( $field['description'] ) ) {
1341
-            $description = wp_kses_post( $field['description'] );
1340
+        if (!empty($field['description'])) {
1341
+            $description = wp_kses_post($field['description']);
1342 1342
             echo "<small class='form-text text-muted'>$description</small>";
1343 1343
         }
1344 1344
 
@@ -1349,16 +1349,16 @@  discard block
 block discarded – undo
1349 1349
     /**
1350 1350
      * Renders the edit date element template.
1351 1351
      */
1352
-    public function edit_date_template( $field ) {
1353
-        $restrict = $this->get_restrict_markup( $field, 'date' );
1354
-        $label    = __( 'Field Label', 'invoicing' );
1352
+    public function edit_date_template($field) {
1353
+        $restrict = $this->get_restrict_markup($field, 'date');
1354
+        $label    = __('Field Label', 'invoicing');
1355 1355
         $id       = $field . '.id + "_edit"';
1356
-        $label2   = __( 'Placeholder text', 'invoicing' );
1356
+        $label2   = __('Placeholder text', 'invoicing');
1357 1357
         $id2      = $field . '.id + "_edit2"';
1358
-        $label3   = __( 'Help text', 'invoicing' );
1359
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1358
+        $label3   = __('Help text', 'invoicing');
1359
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1360 1360
         $id3      = $field . '.id + "_edit3"';
1361
-        $label5   = __( 'Is this field required?', 'invoicing' );
1361
+        $label5   = __('Is this field required?', 'invoicing');
1362 1362
         $id4      = $field . '.id + "_edit4"';
1363 1363
         echo "
1364 1364
             <div $restrict>
@@ -1386,8 +1386,8 @@  discard block
 block discarded – undo
1386 1386
     /**
1387 1387
      * Renders the time element template.
1388 1388
      */
1389
-    public function render_time_template( $field ) {
1390
-        $restrict = $this->get_restrict_markup( $field, 'time' );
1389
+    public function render_time_template($field) {
1390
+        $restrict = $this->get_restrict_markup($field, 'time');
1391 1391
         $label    = "$field.label";
1392 1392
         echo "
1393 1393
             <div $restrict>
@@ -1401,24 +1401,24 @@  discard block
 block discarded – undo
1401 1401
     /**
1402 1402
      * Renders the time element on the frontend.
1403 1403
      */
1404
-    public function frontend_render_time_template( $field ) {
1404
+    public function frontend_render_time_template($field) {
1405 1405
         
1406 1406
         echo "<div class='form-group'>";
1407 1407
 
1408 1408
         echo aui()->input(
1409 1409
             array(
1410
-                'name'       => esc_attr( $field['id'] ),
1411
-                'id'         => esc_attr( $field['id'] ),
1410
+                'name'       => esc_attr($field['id']),
1411
+                'id'         => esc_attr($field['id']),
1412 1412
                 'required'   => (bool) $field['required'],
1413
-                'label'      => wp_kses_post( $field['label'] ),
1413
+                'label'      => wp_kses_post($field['label']),
1414 1414
                 'no_wrap'    => true,
1415
-                'placeholder' => esc_attr( $field['placeholder'] ),
1415
+                'placeholder' => esc_attr($field['placeholder']),
1416 1416
                 'type'       => 'time',
1417 1417
             )
1418 1418
         );
1419 1419
 
1420
-        if ( ! empty( $field['description'] ) ) {
1421
-            $description = wp_kses_post( $field['description'] );
1420
+        if (!empty($field['description'])) {
1421
+            $description = wp_kses_post($field['description']);
1422 1422
             echo "<small class='form-text text-muted'>$description</small>";
1423 1423
         }
1424 1424
 
@@ -1429,16 +1429,16 @@  discard block
 block discarded – undo
1429 1429
     /**
1430 1430
      * Renders the edit time element template.
1431 1431
      */
1432
-    public function edit_time_template( $field ) {
1433
-        $restrict = $this->get_restrict_markup( $field, 'time' );
1434
-        $label    = __( 'Field Label', 'invoicing' );
1432
+    public function edit_time_template($field) {
1433
+        $restrict = $this->get_restrict_markup($field, 'time');
1434
+        $label    = __('Field Label', 'invoicing');
1435 1435
         $id       = $field . '.id + "_edit"';
1436
-        $label2   = __( 'Placeholder text', 'invoicing' );
1436
+        $label2   = __('Placeholder text', 'invoicing');
1437 1437
         $id2      = $field . '.id + "_edit2"';
1438
-        $label3   = __( 'Help text', 'invoicing' );
1439
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1438
+        $label3   = __('Help text', 'invoicing');
1439
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1440 1440
         $id3      = $field . '.id + "_edit3"';
1441
-        $label5   = __( 'Is this field required?', 'invoicing' );
1441
+        $label5   = __('Is this field required?', 'invoicing');
1442 1442
         $id4      = $field . '.id + "_edit4"';
1443 1443
         echo "
1444 1444
             <div $restrict>
@@ -1466,8 +1466,8 @@  discard block
 block discarded – undo
1466 1466
     /**
1467 1467
      * Renders the number element template.
1468 1468
      */
1469
-    public function render_number_template( $field ) {
1470
-        $restrict = $this->get_restrict_markup( $field, 'number' );
1469
+    public function render_number_template($field) {
1470
+        $restrict = $this->get_restrict_markup($field, 'number');
1471 1471
         $label    = "$field.label";
1472 1472
         echo "
1473 1473
             <div $restrict>
@@ -1481,24 +1481,24 @@  discard block
 block discarded – undo
1481 1481
     /**
1482 1482
      * Renders the number element on the frontend.
1483 1483
      */
1484
-    public function frontend_render_number_template( $field ) {
1484
+    public function frontend_render_number_template($field) {
1485 1485
         
1486 1486
         echo "<div class='form-group'>";
1487 1487
 
1488 1488
         echo aui()->input(
1489 1489
             array(
1490
-                'name'       => esc_attr( $field['id'] ),
1491
-                'id'         => esc_attr( $field['id'] ),
1490
+                'name'       => esc_attr($field['id']),
1491
+                'id'         => esc_attr($field['id']),
1492 1492
                 'required'   => (bool) $field['required'],
1493
-                'label'      => wp_kses_post( $field['label'] ),
1494
-                'placeholder' => esc_attr( $field['placeholder'] ),
1493
+                'label'      => wp_kses_post($field['label']),
1494
+                'placeholder' => esc_attr($field['placeholder']),
1495 1495
                 'no_wrap'    => true,
1496 1496
                 'type'       => 'number',
1497 1497
             )
1498 1498
         );
1499 1499
 
1500
-        if ( ! empty( $field['description'] ) ) {
1501
-            $description = wp_kses_post( $field['description'] );
1500
+        if (!empty($field['description'])) {
1501
+            $description = wp_kses_post($field['description']);
1502 1502
             echo "<small class='form-text text-muted'>$description</small>";
1503 1503
         }
1504 1504
 
@@ -1509,16 +1509,16 @@  discard block
 block discarded – undo
1509 1509
     /**
1510 1510
      * Renders the edit number element template.
1511 1511
      */
1512
-    public function edit_number_template( $field ) {
1513
-        $restrict = $this->get_restrict_markup( $field, 'number' );
1514
-        $label    = __( 'Field Label', 'invoicing' );
1512
+    public function edit_number_template($field) {
1513
+        $restrict = $this->get_restrict_markup($field, 'number');
1514
+        $label    = __('Field Label', 'invoicing');
1515 1515
         $id       = $field . '.id + "_edit"';
1516
-        $label2   = __( 'Placeholder text', 'invoicing' );
1516
+        $label2   = __('Placeholder text', 'invoicing');
1517 1517
         $id2      = $field . '.id + "_edit2"';
1518
-        $label3   = __( 'Help text', 'invoicing' );
1519
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1518
+        $label3   = __('Help text', 'invoicing');
1519
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1520 1520
         $id3      = $field . '.id + "_edit3"';
1521
-        $label5   = __( 'Is this field required?', 'invoicing' );
1521
+        $label5   = __('Is this field required?', 'invoicing');
1522 1522
         $id4      = $field . '.id + "_edit4"';
1523 1523
         echo "
1524 1524
             <div $restrict>
@@ -1546,23 +1546,23 @@  discard block
 block discarded – undo
1546 1546
     /**
1547 1547
      * Renders the separator element template.
1548 1548
      */
1549
-    public function render_separator_template( $field ) {
1550
-        $restrict = $this->get_restrict_markup( $field, 'separator' );
1549
+    public function render_separator_template($field) {
1550
+        $restrict = $this->get_restrict_markup($field, 'separator');
1551 1551
         echo "<hr class='featurette-divider mt-0 mb-2' $restrict>";
1552 1552
     }
1553 1553
 
1554 1554
     /**
1555 1555
      * Renders the separator element on the frontend.
1556 1556
      */
1557
-    public function frontend_render_separator_template( $field ) {
1557
+    public function frontend_render_separator_template($field) {
1558 1558
         echo '<hr class="featurette-divider mt-0 mb-2" />';
1559 1559
     }
1560 1560
 
1561 1561
     /**
1562 1562
      * Renders the pay button element template.
1563 1563
      */
1564
-    public function render_pay_button_template( $field ) {
1565
-        $restrict = $this->get_restrict_markup( $field, 'pay_button' );
1564
+    public function render_pay_button_template($field) {
1565
+        $restrict = $this->get_restrict_markup($field, 'pay_button');
1566 1566
         $label    = "$field.label";
1567 1567
         echo "
1568 1568
             <div $restrict>
@@ -1575,28 +1575,28 @@  discard block
 block discarded – undo
1575 1575
     /**
1576 1576
      * Renders the pay_button element on the frontend.
1577 1577
      */
1578
-    public function frontend_render_pay_button_template( $field ) {
1578
+    public function frontend_render_pay_button_template($field) {
1579 1579
 
1580 1580
         echo "<div class='mt-4 mb-4'>";
1581
-            do_action( 'wpinv_payment_mode_select' );
1581
+            do_action('wpinv_payment_mode_select');
1582 1582
         echo "</div>";
1583 1583
 
1584 1584
         echo "<div class='form-group'>";
1585 1585
 
1586
-        $class = 'wpinv-payment-form-submit btn btn-block submit-button ' . sanitize_html_class( $field['class'] );
1586
+        $class = 'wpinv-payment-form-submit btn btn-block submit-button ' . sanitize_html_class($field['class']);
1587 1587
         echo aui()->input(
1588 1588
             array(
1589
-                'name'       => esc_attr( $field['id'] ),
1590
-                'id'         => esc_attr( $field['id'] ),
1591
-                'value'      => esc_attr( $field['label'] ),
1589
+                'name'       => esc_attr($field['id']),
1590
+                'id'         => esc_attr($field['id']),
1591
+                'value'      => esc_attr($field['label']),
1592 1592
                 'no_wrap'    => true,
1593 1593
                 'type'       => 'submit',
1594 1594
                 'class'      => $class,
1595 1595
             )
1596 1596
         );
1597 1597
 
1598
-        if ( ! empty( $field['description'] ) ) {
1599
-            $description = wp_kses_post( $field['description'] );
1598
+        if (!empty($field['description'])) {
1599
+            $description = wp_kses_post($field['description']);
1600 1600
             echo "<small class='form-text text-muted'>$description</small>";
1601 1601
         }
1602 1602
 
@@ -1607,14 +1607,14 @@  discard block
 block discarded – undo
1607 1607
     /**
1608 1608
      * Renders the pay button element template.
1609 1609
      */
1610
-    public function edit_pay_button_template( $field ) {
1611
-        $restrict = $this->get_restrict_markup( $field, 'pay_button' );
1612
-        $label    = __( 'Button Text', 'invoicing' );
1610
+    public function edit_pay_button_template($field) {
1611
+        $restrict = $this->get_restrict_markup($field, 'pay_button');
1612
+        $label    = __('Button Text', 'invoicing');
1613 1613
         $id       = $field . '.id + "_edit"';
1614
-        $label2   = __( 'Help text', 'invoicing' );
1615
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1614
+        $label2   = __('Help text', 'invoicing');
1615
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
1616 1616
         $id2      = $field . '.id + "_edit2"';
1617
-        $label4   = esc_attr__( 'Button Type', 'invoicing' );
1617
+        $label4   = esc_attr__('Button Type', 'invoicing');
1618 1618
         $id3      = $field . '.id + "_edit3"';
1619 1619
         echo "
1620 1620
             <div $restrict>
@@ -1630,15 +1630,15 @@  discard block
 block discarded – undo
1630 1630
                     <label :for='$id3'>$label4</label>
1631 1631
 
1632 1632
                     <select class='form-control custom-select' :id='$id3' v-model='$field.class'>
1633
-                        <option value='btn-primary'>"   . __( 'Primary', 'invoicing' ) ."</option>
1634
-                        <option value='btn-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option>
1635
-                        <option value='btn-success'>"   . __( 'Success', 'invoicing' ) ."</option>
1636
-                        <option value='btn-danger'>"    . __( 'Danger', 'invoicing' ) ."</option>
1637
-                        <option value='btn-warning'>"   . __( 'Warning', 'invoicing' ) ."</option>
1638
-                        <option value='btn-info'>"      . __( 'Info', 'invoicing' ) ."</option>
1639
-                        <option value='btn-light'>"     . __( 'Light', 'invoicing' ) ."</option>
1640
-                        <option value='btn-dark'>"      . __( 'Dark', 'invoicing' ) ."</option>
1641
-                        <option value='btn-link'>"      . __( 'Link', 'invoicing' ) ."</option>
1633
+                        <option value='btn-primary'>" . __('Primary', 'invoicing') . "</option>
1634
+                        <option value='btn-secondary'>" . __('Secondary', 'invoicing') . "</option>
1635
+                        <option value='btn-success'>"   . __('Success', 'invoicing') . "</option>
1636
+                        <option value='btn-danger'>"    . __('Danger', 'invoicing') . "</option>
1637
+                        <option value='btn-warning'>"   . __('Warning', 'invoicing') . "</option>
1638
+                        <option value='btn-info'>"      . __('Info', 'invoicing') . "</option>
1639
+                        <option value='btn-light'>"     . __('Light', 'invoicing') . "</option>
1640
+                        <option value='btn-dark'>"      . __('Dark', 'invoicing') . "</option>
1641
+                        <option value='btn-link'>"      . __('Link', 'invoicing') . "</option>
1642 1642
                     </select>
1643 1643
                 </div>
1644 1644
             </div>
@@ -1649,8 +1649,8 @@  discard block
 block discarded – undo
1649 1649
     /**
1650 1650
      * Renders the alert element template.
1651 1651
      */
1652
-    public function render_alert_template( $field ) {
1653
-        $restrict = $this->get_restrict_markup( $field, 'alert' );
1652
+    public function render_alert_template($field) {
1653
+        $restrict = $this->get_restrict_markup($field, 'alert');
1654 1654
         $text     = "$field.text";
1655 1655
         echo "
1656 1656
             <div $restrict class='alert' :class='$field.class' role='alert'>
@@ -1665,15 +1665,15 @@  discard block
 block discarded – undo
1665 1665
     /**
1666 1666
      * Renders the alert element on the frontend.
1667 1667
      */
1668
-    public function frontend_render_alert_template( $field ) {
1668
+    public function frontend_render_alert_template($field) {
1669 1669
         
1670 1670
         echo "<div class='form-group'>";
1671 1671
 
1672 1672
         echo aui()->alert(
1673 1673
             array(
1674
-                'content'     => wp_kses_post( $field['text'] ),
1674
+                'content'     => wp_kses_post($field['text']),
1675 1675
                 'dismissible' => $field['dismissible'],
1676
-                'type'        => str_replace( 'alert-', '', $field['class'] ),
1676
+                'type'        => str_replace('alert-', '', $field['class']),
1677 1677
             )
1678 1678
         );
1679 1679
 
@@ -1684,14 +1684,14 @@  discard block
 block discarded – undo
1684 1684
     /**
1685 1685
      * Renders the alert element template.
1686 1686
      */
1687
-    public function edit_alert_template( $field ) {
1688
-        $restrict = $this->get_restrict_markup( $field, 'alert' );
1689
-        $label    = __( 'Alert Text', 'invoicing' );
1690
-        $label2   = esc_attr__( 'Enter your alert text here', 'invoicing' );
1687
+    public function edit_alert_template($field) {
1688
+        $restrict = $this->get_restrict_markup($field, 'alert');
1689
+        $label    = __('Alert Text', 'invoicing');
1690
+        $label2   = esc_attr__('Enter your alert text here', 'invoicing');
1691 1691
         $id       = $field . '.id + "_edit"';
1692
-        $label3   = __( 'Is Dismissible?', 'invoicing' );
1692
+        $label3   = __('Is Dismissible?', 'invoicing');
1693 1693
         $id2      = $field . '.id + "_edit2"';
1694
-        $label4   = esc_attr__( 'Alert Type', 'invoicing' );
1694
+        $label4   = esc_attr__('Alert Type', 'invoicing');
1695 1695
         $id3      = $field . '.id + "_edit3"';
1696 1696
         echo "
1697 1697
             <div $restrict>
@@ -1707,14 +1707,14 @@  discard block
 block discarded – undo
1707 1707
                     <label :for='$id3'>$label4</label>
1708 1708
 
1709 1709
                     <select class='form-control custom-select' :id='$id3' v-model='$field.class'>
1710
-                        <option value='alert-primary'>"   . __( 'Primary', 'invoicing' ) ."</option>
1711
-                        <option value='alert-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option>
1712
-                        <option value='alert-success'>"   . __( 'Success', 'invoicing' ) ."</option>
1713
-                        <option value='alert-danger'>"    . __( 'Danger', 'invoicing' ) ."</option>
1714
-                        <option value='alert-warning'>"   . __( 'Warning', 'invoicing' ) ."</option>
1715
-                        <option value='alert-info'>"      . __( 'Info', 'invoicing' ) ."</option>
1716
-                        <option value='alert-light'>"     . __( 'Light', 'invoicing' ) ."</option>
1717
-                        <option value='alert-dark'>"      . __( 'Dark', 'invoicing' ) ."</option>
1710
+                        <option value='alert-primary'>" . __('Primary', 'invoicing') . "</option>
1711
+                        <option value='alert-secondary'>" . __('Secondary', 'invoicing') . "</option>
1712
+                        <option value='alert-success'>"   . __('Success', 'invoicing') . "</option>
1713
+                        <option value='alert-danger'>"    . __('Danger', 'invoicing') . "</option>
1714
+                        <option value='alert-warning'>"   . __('Warning', 'invoicing') . "</option>
1715
+                        <option value='alert-info'>"      . __('Info', 'invoicing') . "</option>
1716
+                        <option value='alert-light'>"     . __('Light', 'invoicing') . "</option>
1717
+                        <option value='alert-dark'>"      . __('Dark', 'invoicing') . "</option>
1718 1718
                     </select>
1719 1719
                 </div>
1720 1720
             </div>
@@ -1725,8 +1725,8 @@  discard block
 block discarded – undo
1725 1725
     /**
1726 1726
      * Renders the discount element template.
1727 1727
      */
1728
-    public function render_discount_template( $field ) {
1729
-        $restrict  = $this->get_restrict_markup( $field, 'discount' );
1728
+    public function render_discount_template($field) {
1729
+        $restrict = $this->get_restrict_markup($field, 'discount');
1730 1730
         ?>
1731 1731
 
1732 1732
             <div <?php echo $restrict; ?> class="discount_field  border rounded p-3">
@@ -1743,13 +1743,13 @@  discard block
 block discarded – undo
1743 1743
     /**
1744 1744
      * Renders the discount element on the frontend.
1745 1745
      */
1746
-    public function frontend_render_discount_template( $field ) {
1746
+    public function frontend_render_discount_template($field) {
1747 1747
         
1748
-        $placeholder = esc_attr( $field['input_label'] );
1749
-        $label       = sanitize_text_field( $field['button_label'] );
1748
+        $placeholder = esc_attr($field['input_label']);
1749
+        $label       = sanitize_text_field($field['button_label']);
1750 1750
         $description = '';
1751 1751
 
1752
-        if ( ! empty( $field['description'] ) ) {
1752
+        if (!empty($field['description'])) {
1753 1753
             $description = "<small class='form-text text-muted'>{$field['description']}</small>";
1754 1754
         }
1755 1755
 ?>
@@ -1770,12 +1770,12 @@  discard block
 block discarded – undo
1770 1770
     /**
1771 1771
      * Renders the discount element template.
1772 1772
      */
1773
-    public function edit_discount_template( $field ) {
1774
-        $restrict = $this->get_restrict_markup( $field, 'discount' );
1775
-        $label    = __( 'Discount Input Placeholder', 'invoicing' );
1776
-        $label2   = __( 'Help Text', 'invoicing' );
1777
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1778
-        $label4   = __( 'Button Text', 'invoicing' );
1773
+    public function edit_discount_template($field) {
1774
+        $restrict = $this->get_restrict_markup($field, 'discount');
1775
+        $label    = __('Discount Input Placeholder', 'invoicing');
1776
+        $label2   = __('Help Text', 'invoicing');
1777
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
1778
+        $label4   = __('Button Text', 'invoicing');
1779 1779
         $id       = $field . '.id + "_edit"';
1780 1780
         $id2      = $field . '.id + "_edit2"';
1781 1781
         $id3      = $field . '.id + "_edit3"';
@@ -1804,21 +1804,21 @@  discard block
 block discarded – undo
1804 1804
     /**
1805 1805
      * Renders the items element template.
1806 1806
      */
1807
-    public function render_items_template( $field ) {
1808
-        $restrict  = $this->get_restrict_markup( $field, 'items' );
1809
-        $label     = __( 'Item totals will appear here. Click to set items.', 'invoicing' );
1807
+    public function render_items_template($field) {
1808
+        $restrict  = $this->get_restrict_markup($field, 'items');
1809
+        $label     = __('Item totals will appear here. Click to set items.', 'invoicing');
1810 1810
         echo "<div $restrict class='item_totals p-4 bg-warning text-center'>$label</div>";
1811 1811
     }
1812 1812
 
1813 1813
     /**
1814 1814
      * Renders the items element on the frontend.
1815 1815
      */
1816
-    public function frontend_render_items_template( $field, $items ) {
1816
+    public function frontend_render_items_template($field, $items) {
1817 1817
         
1818 1818
         echo "<div class='form-group item_totals'>";
1819 1819
         
1820
-        $id = esc_attr( $field['id'] );
1821
-        if ( 'total' == $field[ 'items_type' ] ) {
1820
+        $id = esc_attr($field['id']);
1821
+        if ('total' == $field['items_type']) {
1822 1822
             $total     = 0;
1823 1823
             $tax       = 0;
1824 1824
             $sub_total = 0;
@@ -1827,16 +1827,16 @@  discard block
 block discarded – undo
1827 1827
             <div class="border item_totals_type_total">
1828 1828
 
1829 1829
                 <?php
1830
-                    foreach( $items as $item ) {
1830
+                    foreach ($items as $item) {
1831 1831
 
1832
-                        $amount = floatval( $item['price'] );
1832
+                        $amount = floatval($item['price']);
1833 1833
 
1834
-                        if ( wpinv_use_taxes() ) {
1834
+                        if (wpinv_use_taxes()) {
1835 1835
 
1836
-                            $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] );
1836
+                            $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']);
1837 1837
 
1838
-                            if ( wpinv_prices_include_tax() ) {
1839
-                                $pre_tax  = ( $amount - $amount * $rate * 0.01 );
1838
+                            if (wpinv_prices_include_tax()) {
1839
+                                $pre_tax  = ($amount - $amount * $rate * 0.01);
1840 1840
                                 $item_tax = $amount - $pre_tax;
1841 1841
                             } else {
1842 1842
                                 $pre_tax  = $amount;
@@ -1848,27 +1848,27 @@  discard block
 block discarded – undo
1848 1848
                             $total     = $sub_total + $tax;
1849 1849
 
1850 1850
                         } else {
1851
-                            $total  = $total + $amount;
1851
+                            $total = $total + $amount;
1852 1852
                         }
1853 1853
 
1854 1854
                         $class  = 'col-8';
1855 1855
                         $class2 = '';
1856 1856
 
1857
-                        if ( ! empty( $item['allow_quantities'] ) ) {
1857
+                        if (!empty($item['allow_quantities'])) {
1858 1858
                             $class = 'col-6 pt-2';
1859 1859
                             $class2 = 'pt-2';
1860 1860
                         }
1861 1861
 
1862
-                        if ( ! empty( $item['custom_price'] ) ) {
1862
+                        if (!empty($item['custom_price'])) {
1863 1863
                             $class .= ' pt-2';
1864 1864
                         }
1865 1865
             
1866 1866
                 ?>
1867 1867
                     <div  class="item_totals_item">
1868 1868
                         <div class='row pl-2 pr-2 pt-2'>
1869
-                            <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div>
1869
+                            <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div>
1870 1870
 
1871
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
1871
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
1872 1872
 
1873 1873
                                 <div class='col-2'>
1874 1874
                                     <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required>
@@ -1876,11 +1876,11 @@  discard block
 block discarded – undo
1876 1876
 
1877 1877
                             <?php } else { ?>
1878 1878
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
1879
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
1879
+                            <?php } if (empty($item['custom_price'])) { ?>
1880 1880
 
1881 1881
                                 <div class='col-4 <?php echo $class2; ?>'>
1882
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
1883
-                                    <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
1882
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
1883
+                                    <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
1884 1884
                                 </div>
1885 1885
 
1886 1886
                             <?php } else {?>
@@ -1888,15 +1888,15 @@  discard block
 block discarded – undo
1888 1888
                                 <div class='col-4'>
1889 1889
                                     <div class='input-group'>
1890 1890
 
1891
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
1891
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
1892 1892
                                             <div class='input-group-prepend'>
1893 1893
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
1894 1894
                                             </div>
1895 1895
                                         <?php } ?>
1896 1896
 
1897
-                                        <input type='number' name='wpinv-items[<?php echo (int) $item['id']; ?>]' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'>
1897
+                                        <input type='number' name='wpinv-items[<?php echo (int) $item['id']; ?>]' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'>
1898 1898
                                     
1899
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
1899
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
1900 1900
                                             <div class='input-group-append'>
1901 1901
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
1902 1902
                                             </div>
@@ -1907,28 +1907,28 @@  discard block
 block discarded – undo
1907 1907
                             <?php } ?>
1908 1908
 
1909 1909
                         </div>
1910
-                        <?php if ( ! empty( $item['description'] )) { ?>
1911
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
1910
+                        <?php if (!empty($item['description'])) { ?>
1911
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
1912 1912
                         <?php } ?>
1913 1913
                     </div>
1914 1914
                 <?php } ?>
1915 1915
 
1916 1916
                 <div class='mt-4 border-top item_totals_total p-2'>
1917 1917
 
1918
-                    <?php if ( wpinv_use_taxes() ) { ?>
1918
+                    <?php if (wpinv_use_taxes()) { ?>
1919 1919
                         <div class='row'>
1920
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div>
1921
-                            <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div>
1920
+                            <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div>
1921
+                            <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div>
1922 1922
                         </div>
1923 1923
                         <div class='row'>
1924
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div>
1925
-                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div>
1924
+                            <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div>
1925
+                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div>
1926 1926
                         </div>
1927 1927
                     <?php } ?>
1928 1928
 
1929 1929
                     <div class='row'>
1930
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
1931
-                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
1930
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
1931
+                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
1932 1932
                     </div>
1933 1933
 
1934 1934
                 </div>
@@ -1936,22 +1936,22 @@  discard block
 block discarded – undo
1936 1936
             </div>
1937 1937
         <?php } ?>
1938 1938
 
1939
-        <?php if ( 'radio' == $field[ 'items_type' ] ) { ?>
1939
+        <?php if ('radio' == $field['items_type']) { ?>
1940 1940
             <div class="item_totals_type_radio">
1941 1941
 
1942 1942
                 <?php
1943
-                    foreach( $items as $index => $item ) {
1943
+                    foreach ($items as $index => $item) {
1944 1944
 
1945
-                        if ( ! empty( $item['required'] ) ) {
1945
+                        if (!empty($item['required'])) {
1946 1946
                             continue;
1947 1947
                         }
1948 1948
                 ?>
1949 1949
                     <div  class="form-check">
1950
-                        <input class='form-check-input wpinv-items-selector' <?php checked( ! isset( $selected_radio_item ) ); $selected_radio_item = 1; ?> type='radio' value='<?php echo $item['id']; ?>' id='<?php echo $id . $index; ?>' name='wpinv-payment-form-selected-item'>
1951
-                        <label class='form-check-label' for='<?php echo $id . $index; ?>'><?php echo sanitize_text_field( $item['title'] ); ?>&nbsp;<strong><?php echo wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) ); ?></strong></label>
1950
+                        <input class='form-check-input wpinv-items-selector' <?php checked(!isset($selected_radio_item)); $selected_radio_item = 1; ?> type='radio' value='<?php echo $item['id']; ?>' id='<?php echo $id . $index; ?>' name='wpinv-payment-form-selected-item'>
1951
+                        <label class='form-check-label' for='<?php echo $id . $index; ?>'><?php echo sanitize_text_field($item['title']); ?>&nbsp;<strong><?php echo wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); ?></strong></label>
1952 1952
                     </div>
1953
-                    <?php if ( ! empty( $item['description'] )) { ?>
1954
-                        <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
1953
+                    <?php if (!empty($item['description'])) { ?>
1954
+                        <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
1955 1955
                     <?php } ?>
1956 1956
                 <?php } ?>
1957 1957
 
@@ -1963,32 +1963,32 @@  discard block
 block discarded – undo
1963 1963
                         $tax       = 0;
1964 1964
                         $sub_total = 0;
1965 1965
 
1966
-                        foreach ( $items as $item ) {
1966
+                        foreach ($items as $item) {
1967 1967
 
1968 1968
                             $class  = 'col-8';
1969 1969
                             $class2 = '';
1970 1970
 
1971
-                            if ( ! empty( $item['allow_quantities'] ) ) {
1971
+                            if (!empty($item['allow_quantities'])) {
1972 1972
                                 $class = 'col-6 pt-2';
1973 1973
                                 $class2 = 'pt-2';
1974 1974
                             }
1975 1975
 
1976
-                            if ( ! empty( $item['custom_price'] ) ) {
1976
+                            if (!empty($item['custom_price'])) {
1977 1977
                                 $class .= ' pt-2';
1978 1978
                             }
1979 1979
 
1980 1980
                             $class3 = 'd-none';
1981 1981
                             $name   = '';
1982
-                            if ( ! empty( $item['required'] ) || ! isset( $totals_selected_radio_item ) ) {
1982
+                            if (!empty($item['required']) || !isset($totals_selected_radio_item)) {
1983 1983
 
1984
-                                $amount = floatval( $item['price'] );
1984
+                                $amount = floatval($item['price']);
1985 1985
 
1986
-                                if ( wpinv_use_taxes() ) {
1986
+                                if (wpinv_use_taxes()) {
1987 1987
 
1988
-                                    $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] );
1988
+                                    $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']);
1989 1989
 
1990
-                                    if ( wpinv_prices_include_tax() ) {
1991
-                                        $pre_tax  = ( $amount - $amount * $rate * 0.01 );
1990
+                                    if (wpinv_prices_include_tax()) {
1991
+                                        $pre_tax  = ($amount - $amount * $rate * 0.01);
1992 1992
                                         $item_tax = $amount - $pre_tax;
1993 1993
                                     } else {
1994 1994
                                         $pre_tax  = $amount;
@@ -2000,13 +2000,13 @@  discard block
 block discarded – undo
2000 2000
                                     $total     = $sub_total + $tax;
2001 2001
 
2002 2002
                                 } else {
2003
-                                    $total  = $total + $amount;
2003
+                                    $total = $total + $amount;
2004 2004
                                 }
2005 2005
 
2006 2006
                                 $class3 = '';
2007 2007
                                 $name   = "wpinv-items[{$item['id']}]";
2008 2008
 
2009
-                                if ( empty( $item['required'] ) ) {
2009
+                                if (empty($item['required'])) {
2010 2010
                                     $totals_selected_radio_item = 1;
2011 2011
                                 }
2012 2012
 
@@ -2018,9 +2018,9 @@  discard block
 block discarded – undo
2018 2018
 
2019 2019
                     <div  class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>">
2020 2020
                         <div class='row pl-2 pr-2 pt-2'>
2021
-                            <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div>
2021
+                            <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div>
2022 2022
 
2023
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
2023
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
2024 2024
 
2025 2025
                                 <div class='col-2'>
2026 2026
                                     <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required>
@@ -2028,11 +2028,11 @@  discard block
 block discarded – undo
2028 2028
 
2029 2029
                             <?php } else { ?>
2030 2030
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
2031
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
2031
+                            <?php } if (empty($item['custom_price'])) { ?>
2032 2032
 
2033 2033
                                 <div class='col-4 <?php echo $class2; ?>'>
2034
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
2035
-                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
2034
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
2035
+                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
2036 2036
                                 </div>
2037 2037
 
2038 2038
                             <?php } else {?>
@@ -2040,15 +2040,15 @@  discard block
 block discarded – undo
2040 2040
                                 <div class='col-4'>
2041 2041
                                     <div class='input-group'>
2042 2042
 
2043
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
2043
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
2044 2044
                                             <div class='input-group-prepend'>
2045 2045
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2046 2046
                                             </div>
2047 2047
                                         <?php } ?>
2048 2048
 
2049
-                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'>
2049
+                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'>
2050 2050
                                     
2051
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
2051
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
2052 2052
                                             <div class='input-group-append'>
2053 2053
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2054 2054
                                             </div>
@@ -2059,27 +2059,27 @@  discard block
 block discarded – undo
2059 2059
                             <?php } ?>
2060 2060
 
2061 2061
                         </div>
2062
-                        <?php if ( ! empty( $item['description'] )) { ?>
2063
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
2062
+                        <?php if (!empty($item['description'])) { ?>
2063
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
2064 2064
                         <?php } ?>
2065 2065
                     </div>
2066 2066
                 <?php } ?>
2067 2067
 
2068 2068
                 <div class='mt-4 border-top item_totals_total p-2'>
2069
-                    <?php if ( wpinv_use_taxes() ) { ?>
2069
+                    <?php if (wpinv_use_taxes()) { ?>
2070 2070
                         <div class='row'>
2071
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div>
2072
-                            <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div>
2071
+                            <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div>
2072
+                            <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div>
2073 2073
                         </div>
2074 2074
                         <div class='row'>
2075
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div>
2076
-                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div>
2075
+                            <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div>
2076
+                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div>
2077 2077
                         </div>
2078 2078
                     <?php } ?>
2079 2079
 
2080 2080
                     <div class='row'>
2081
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
2082
-                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
2081
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
2082
+                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
2083 2083
                     </div>
2084 2084
                 </div>
2085 2085
 
@@ -2087,22 +2087,22 @@  discard block
 block discarded – undo
2087 2087
             </div>
2088 2088
         <?php } ?>
2089 2089
 
2090
-        <?php if ( 'checkbox' == $field[ 'items_type' ] ) { ?>
2090
+        <?php if ('checkbox' == $field['items_type']) { ?>
2091 2091
 
2092 2092
             <div class="item_totals_type_checkbox">
2093 2093
 
2094 2094
                 <?php
2095
-                    foreach ( $items as $index => $item ) {
2095
+                    foreach ($items as $index => $item) {
2096 2096
 
2097
-                        if ( ! empty( $item['required'] ) ) {
2097
+                        if (!empty($item['required'])) {
2098 2098
                             continue;
2099 2099
                         }
2100 2100
 
2101
-                        $title = sanitize_text_field(  $item['title'] );
2102
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
2103
-                        $item_id    = esc_attr( $id . "_$index" );
2104
-                        $value = esc_attr( $item['id'] );
2105
-                        $checked = checked( ! isset( $selected_checkbox_item ), true, false );
2101
+                        $title = sanitize_text_field($item['title']);
2102
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
2103
+                        $item_id = esc_attr($id . "_$index");
2104
+                        $value = esc_attr($item['id']);
2105
+                        $checked = checked(!isset($selected_checkbox_item), true, false);
2106 2106
                         $selected_checkbox_item = 1;
2107 2107
 
2108 2108
                         echo "
@@ -2111,7 +2111,7 @@  discard block
 block discarded – undo
2111 2111
                                 <label for='$item_id' class='custom-control-label'>$title &nbsp; ($price)</label>
2112 2112
                             </div>";
2113 2113
 
2114
-                        if ( ! empty( $item['description'] ) ) {
2114
+                        if (!empty($item['description'])) {
2115 2115
                             echo "<small class='form-text text-muted'>{$item['description']}</small>";
2116 2116
                         }
2117 2117
                     }
@@ -2125,31 +2125,31 @@  discard block
 block discarded – undo
2125 2125
                         $tax       = 0;
2126 2126
                         $sub_total = 0;
2127 2127
 
2128
-                        foreach ( $items as $item ) {
2128
+                        foreach ($items as $item) {
2129 2129
 
2130 2130
                             $class  = 'col-8';
2131 2131
                             $class2 = '';
2132 2132
 
2133
-                            if ( ! empty( $item['allow_quantities'] ) ) {
2133
+                            if (!empty($item['allow_quantities'])) {
2134 2134
                                 $class = 'col-6 pt-2';
2135 2135
                                 $class2 = 'pt-2';
2136 2136
                             }
2137 2137
 
2138
-                            if ( ! empty( $item['custom_price'] ) ) {
2138
+                            if (!empty($item['custom_price'])) {
2139 2139
                                 $class .= ' pt-2';
2140 2140
                             }
2141 2141
 
2142 2142
                             $class3 = 'd-none';
2143
-                            $name  = '';
2144
-                            if ( ! empty( $item['required'] ) || ! isset( $totals_selected_checkbox_item ) ) {
2143
+                            $name = '';
2144
+                            if (!empty($item['required']) || !isset($totals_selected_checkbox_item)) {
2145 2145
 
2146
-                                $amount = floatval( $item['price'] );
2147
-                                if ( wpinv_use_taxes() ) {
2146
+                                $amount = floatval($item['price']);
2147
+                                if (wpinv_use_taxes()) {
2148 2148
 
2149
-                                    $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] );
2149
+                                    $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']);
2150 2150
 
2151
-                                    if ( wpinv_prices_include_tax() ) {
2152
-                                        $pre_tax  = ( $amount - $amount * $rate * 0.01 );
2151
+                                    if (wpinv_prices_include_tax()) {
2152
+                                        $pre_tax  = ($amount - $amount * $rate * 0.01);
2153 2153
                                         $item_tax = $amount - $pre_tax;
2154 2154
                                     } else {
2155 2155
                                         $pre_tax  = $amount;
@@ -2161,13 +2161,13 @@  discard block
 block discarded – undo
2161 2161
                                     $total     = $sub_total + $tax;
2162 2162
 
2163 2163
                                 } else {
2164
-                                    $total  = $total + $amount;
2164
+                                    $total = $total + $amount;
2165 2165
                                 }
2166 2166
 
2167 2167
                                 $class3 = '';
2168
-                                $name  = "wpinv-items[{$item['id']}]";
2168
+                                $name = "wpinv-items[{$item['id']}]";
2169 2169
 
2170
-                                if ( empty( $item['required'] ) ) {
2170
+                                if (empty($item['required'])) {
2171 2171
                                     $totals_selected_checkbox_item = 1;
2172 2172
                                 }
2173 2173
 
@@ -2179,9 +2179,9 @@  discard block
 block discarded – undo
2179 2179
 
2180 2180
                     <div  class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>">
2181 2181
                         <div class='row pl-2 pr-2 pt-2'>
2182
-                            <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div>
2182
+                            <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div>
2183 2183
 
2184
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
2184
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
2185 2185
 
2186 2186
                                 <div class='col-2'>
2187 2187
                                     <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required>
@@ -2189,11 +2189,11 @@  discard block
 block discarded – undo
2189 2189
 
2190 2190
                             <?php } else { ?>
2191 2191
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
2192
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
2192
+                            <?php } if (empty($item['custom_price'])) { ?>
2193 2193
 
2194 2194
                                 <div class='col-4 <?php echo $class2; ?>'>
2195
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
2196
-                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
2195
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
2196
+                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
2197 2197
                                 </div>
2198 2198
 
2199 2199
                             <?php } else {?>
@@ -2201,15 +2201,15 @@  discard block
 block discarded – undo
2201 2201
                                 <div class='col-4'>
2202 2202
                                     <div class='input-group'>
2203 2203
 
2204
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
2204
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
2205 2205
                                             <div class='input-group-prepend'>
2206 2206
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2207 2207
                                             </div>
2208 2208
                                         <?php } ?>
2209 2209
 
2210
-                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'>
2210
+                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'>
2211 2211
                                     
2212
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
2212
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
2213 2213
                                             <div class='input-group-append'>
2214 2214
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2215 2215
                                             </div>
@@ -2220,35 +2220,35 @@  discard block
 block discarded – undo
2220 2220
                             <?php } ?>
2221 2221
 
2222 2222
                         </div>
2223
-                        <?php if ( ! empty( $item['description'] )) { ?>
2224
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
2223
+                        <?php if (!empty($item['description'])) { ?>
2224
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
2225 2225
                         <?php } ?>
2226 2226
                     </div>
2227 2227
                 <?php } ?>
2228 2228
 
2229 2229
                 <div class='mt-4 border-top item_totals_total p-2'>
2230 2230
 
2231
-                    <?php if ( wpinv_use_taxes() ) { ?>
2231
+                    <?php if (wpinv_use_taxes()) { ?>
2232 2232
                         <div class='row'>
2233
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div>
2234
-                            <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div>
2233
+                            <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div>
2234
+                            <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div>
2235 2235
                         </div>
2236 2236
                         <div class='row'>
2237
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div>
2238
-                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div>
2237
+                            <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div>
2238
+                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div>
2239 2239
                         </div>
2240 2240
                     <?php } ?>
2241 2241
 
2242 2242
                     <div class='row'>
2243
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
2244
-                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
2243
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
2244
+                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
2245 2245
                     </div>
2246 2246
                 </div>
2247 2247
             </div>
2248 2248
             </div>
2249 2249
         <?php } ?>
2250 2250
 
2251
-        <?php if ( 'select' == $field[ 'items_type' ] ) { ?>
2251
+        <?php if ('select' == $field['items_type']) { ?>
2252 2252
 
2253 2253
             <div class="item_totals_type_select">
2254 2254
 
@@ -2256,17 +2256,17 @@  discard block
 block discarded – undo
2256 2256
 
2257 2257
                     $options  = array();
2258 2258
                     $selected = '';
2259
-                    foreach ( $items as $index => $item ) {
2259
+                    foreach ($items as $index => $item) {
2260 2260
 
2261
-                        if ( ! empty( $item['required'] ) ) {
2261
+                        if (!empty($item['required'])) {
2262 2262
                             continue;
2263 2263
                         }
2264 2264
 
2265
-                        $title = sanitize_text_field(  $item['title'] );
2266
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
2267
-                        $options[ $item['id'] ] = "$title &nbsp; ($price)";
2265
+                        $title = sanitize_text_field($item['title']);
2266
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
2267
+                        $options[$item['id']] = "$title &nbsp; ($price)";
2268 2268
 
2269
-                        if ( ! isset( $selected_item ) ) {
2269
+                        if (!isset($selected_item)) {
2270 2270
                             $selected = $item['id'];
2271 2271
                             $selected_item = 1;
2272 2272
                         }
@@ -2277,7 +2277,7 @@  discard block
 block discarded – undo
2277 2277
                         array(
2278 2278
                                 'name'        => 'payment-form-items',
2279 2279
                                 'id'          => $id,
2280
-                                'placeholder' => __( 'Select an item', 'invoicing' ),
2280
+                                'placeholder' => __('Select an item', 'invoicing'),
2281 2281
                                 'no_wrap'     => true,
2282 2282
                                 'options'     => $options,
2283 2283
                                 'class'       => 'wpi_select2 wpinv-items-select-selector',
@@ -2294,31 +2294,31 @@  discard block
 block discarded – undo
2294 2294
                         $tax       = 0;
2295 2295
                         $sub_total = 0;
2296 2296
 
2297
-                        foreach ( $items as $item ) {
2297
+                        foreach ($items as $item) {
2298 2298
 
2299 2299
                             $class  = 'col-8';
2300 2300
                             $class2 = '';
2301 2301
 
2302
-                            if ( ! empty( $item['allow_quantities'] ) ) {
2302
+                            if (!empty($item['allow_quantities'])) {
2303 2303
                                 $class = 'col-6 pt-2';
2304 2304
                                 $class2 = 'pt-2';
2305 2305
                             }
2306 2306
 
2307
-                            if ( ! empty( $item['custom_price'] ) ) {
2307
+                            if (!empty($item['custom_price'])) {
2308 2308
                                 $class .= ' pt-2';
2309 2309
                             }
2310 2310
 
2311 2311
                             $class3 = 'd-none';
2312
-                            $name  = '';
2313
-                            if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) {
2312
+                            $name = '';
2313
+                            if (!empty($item['required']) || !isset($totals_selected_select_item)) {
2314 2314
 
2315
-                                $amount = floatval( $item['price'] );
2316
-                                if ( wpinv_use_taxes() ) {
2315
+                                $amount = floatval($item['price']);
2316
+                                if (wpinv_use_taxes()) {
2317 2317
 
2318
-                                    $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] );
2318
+                                    $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']);
2319 2319
 
2320
-                                    if ( wpinv_prices_include_tax() ) {
2321
-                                        $pre_tax  = ( $amount - $amount * $rate * 0.01 );
2320
+                                    if (wpinv_prices_include_tax()) {
2321
+                                        $pre_tax  = ($amount - $amount * $rate * 0.01);
2322 2322
                                         $item_tax = $amount - $pre_tax;
2323 2323
                                     } else {
2324 2324
                                         $pre_tax  = $amount;
@@ -2330,13 +2330,13 @@  discard block
 block discarded – undo
2330 2330
                                     $total     = $sub_total + $tax;
2331 2331
 
2332 2332
                                 } else {
2333
-                                    $total  = $total + $amount;
2333
+                                    $total = $total + $amount;
2334 2334
                                 }
2335 2335
 
2336 2336
                                 $class3 = '';
2337
-                                $name  = "wpinv-items[{$item['id']}]";
2337
+                                $name = "wpinv-items[{$item['id']}]";
2338 2338
 
2339
-                                if ( empty( $item['required'] ) ) {
2339
+                                if (empty($item['required'])) {
2340 2340
                                     $totals_selected_select_item = 1;
2341 2341
                                 }
2342 2342
 
@@ -2348,9 +2348,9 @@  discard block
 block discarded – undo
2348 2348
 
2349 2349
                     <div  class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>">
2350 2350
                         <div class='row pl-2 pr-2 pt-2'>
2351
-                            <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div>
2351
+                            <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div>
2352 2352
 
2353
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
2353
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
2354 2354
 
2355 2355
                                 <div class='col-2'>
2356 2356
                                     <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required>
@@ -2358,11 +2358,11 @@  discard block
 block discarded – undo
2358 2358
 
2359 2359
                             <?php } else { ?>
2360 2360
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
2361
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
2361
+                            <?php } if (empty($item['custom_price'])) { ?>
2362 2362
 
2363 2363
                                 <div class='col-4 <?php echo $class2; ?>'>
2364
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
2365
-                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
2364
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
2365
+                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
2366 2366
                                 </div>
2367 2367
 
2368 2368
                             <?php } else {?>
@@ -2370,15 +2370,15 @@  discard block
 block discarded – undo
2370 2370
                                 <div class='col-4'>
2371 2371
                                     <div class='input-group'>
2372 2372
 
2373
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
2373
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
2374 2374
                                             <div class='input-group-prepend'>
2375 2375
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2376 2376
                                             </div>
2377 2377
                                         <?php } ?>
2378 2378
 
2379
-                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'>
2379
+                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'>
2380 2380
                                     
2381
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
2381
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
2382 2382
                                             <div class='input-group-append'>
2383 2383
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2384 2384
                                             </div>
@@ -2389,34 +2389,34 @@  discard block
 block discarded – undo
2389 2389
                             <?php } ?>
2390 2390
 
2391 2391
                         </div>
2392
-                        <?php if ( ! empty( $item['description'] )) { ?>
2393
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
2392
+                        <?php if (!empty($item['description'])) { ?>
2393
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
2394 2394
                         <?php } ?>
2395 2395
                     </div>
2396 2396
                 <?php } ?>
2397 2397
 
2398 2398
                 <div class='mt-4 border-top item_totals_total p-2'>
2399 2399
 
2400
-                    <?php if ( wpinv_use_taxes() ) { ?>
2400
+                    <?php if (wpinv_use_taxes()) { ?>
2401 2401
                         <div class='row'>
2402
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div>
2403
-                            <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div>
2402
+                            <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div>
2403
+                            <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div>
2404 2404
                         </div>
2405 2405
                         <div class='row'>
2406
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div>
2407
-                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div>
2406
+                            <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div>
2407
+                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div>
2408 2408
                         </div>
2409 2409
                     <?php } ?>
2410 2410
                     <div class='row'>
2411
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
2412
-                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
2411
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
2412
+                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
2413 2413
                     </div>
2414 2414
                 </div>
2415 2415
 
2416 2416
             </div>
2417 2417
         <?php } ?>
2418 2418
 
2419
-        <?php if ( 'multi_select' == $field[ 'items_type' ] ) { ?>
2419
+        <?php if ('multi_select' == $field['items_type']) { ?>
2420 2420
 
2421 2421
             <div class="item_totals_type_multi_select">
2422 2422
 
@@ -2425,18 +2425,18 @@  discard block
 block discarded – undo
2425 2425
                     $options  = array();
2426 2426
                     $selected = array();
2427 2427
 
2428
-                    foreach ( $items as $index => $item ) {
2428
+                    foreach ($items as $index => $item) {
2429 2429
 
2430
-                        if ( ! empty( $item['required'] ) ) {
2430
+                        if (!empty($item['required'])) {
2431 2431
                             continue;
2432 2432
                         }
2433 2433
 
2434
-                        $title = sanitize_text_field(  $item['title'] );
2435
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
2436
-                        $options[ $item['id'] ] = "$title &nbsp; ($price)";
2434
+                        $title = sanitize_text_field($item['title']);
2435
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
2436
+                        $options[$item['id']] = "$title &nbsp; ($price)";
2437 2437
 
2438
-                        if ( ! isset( $selected_item ) ) {
2439
-                            $selected = array( $item['id'] );
2438
+                        if (!isset($selected_item)) {
2439
+                            $selected = array($item['id']);
2440 2440
                             $selected_item = 1;
2441 2441
                         }
2442 2442
 
@@ -2463,31 +2463,31 @@  discard block
 block discarded – undo
2463 2463
                         $tax       = 0;
2464 2464
                         $sub_total = 0;
2465 2465
 
2466
-                        foreach ( $items as $item ) {
2466
+                        foreach ($items as $item) {
2467 2467
 
2468 2468
                             $class  = 'col-8';
2469 2469
                             $class2 = '';
2470 2470
 
2471
-                            if ( ! empty( $item['allow_quantities'] ) ) {
2471
+                            if (!empty($item['allow_quantities'])) {
2472 2472
                                 $class = 'col-6 pt-2';
2473 2473
                                 $class2 = 'pt-2';
2474 2474
                             }
2475 2475
 
2476
-                            if ( ! empty( $item['custom_price'] ) ) {
2476
+                            if (!empty($item['custom_price'])) {
2477 2477
                                 $class .= ' pt-2';
2478 2478
                             }
2479 2479
 
2480 2480
                             $class3 = 'd-none';
2481
-                            $name  = '';
2482
-                            if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) {
2481
+                            $name = '';
2482
+                            if (!empty($item['required']) || !isset($totals_selected_select_item)) {
2483 2483
 
2484
-                                $amount = floatval( $item['price'] );
2485
-                                if ( wpinv_use_taxes() ) {
2484
+                                $amount = floatval($item['price']);
2485
+                                if (wpinv_use_taxes()) {
2486 2486
 
2487
-                                    $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] );
2487
+                                    $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']);
2488 2488
 
2489
-                                    if ( wpinv_prices_include_tax() ) {
2490
-                                        $pre_tax  = ( $amount - $amount * $rate * 0.01 );
2489
+                                    if (wpinv_prices_include_tax()) {
2490
+                                        $pre_tax  = ($amount - $amount * $rate * 0.01);
2491 2491
                                         $item_tax = $amount - $pre_tax;
2492 2492
                                     } else {
2493 2493
                                         $pre_tax  = $amount;
@@ -2499,13 +2499,13 @@  discard block
 block discarded – undo
2499 2499
                                     $total     = $sub_total + $tax;
2500 2500
 
2501 2501
                                 } else {
2502
-                                    $total  = $total + $amount;
2502
+                                    $total = $total + $amount;
2503 2503
                                 }
2504 2504
 
2505 2505
                                 $class3 = '';
2506
-                                $name  = "wpinv-items[{$item['id']}]";
2506
+                                $name = "wpinv-items[{$item['id']}]";
2507 2507
 
2508
-                                if ( empty( $item['required'] ) ) {
2508
+                                if (empty($item['required'])) {
2509 2509
                                     $totals_selected_select_item = 1;
2510 2510
                                 }
2511 2511
 
@@ -2517,9 +2517,9 @@  discard block
 block discarded – undo
2517 2517
 
2518 2518
                     <div  class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>">
2519 2519
                         <div class='row pl-2 pr-2 pt-2'>
2520
-                            <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div>
2520
+                            <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div>
2521 2521
 
2522
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
2522
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
2523 2523
 
2524 2524
                                 <div class='col-2'>
2525 2525
                                     <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required>
@@ -2527,11 +2527,11 @@  discard block
 block discarded – undo
2527 2527
 
2528 2528
                             <?php } else { ?>
2529 2529
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
2530
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
2530
+                            <?php } if (empty($item['custom_price'])) { ?>
2531 2531
 
2532 2532
                                 <div class='col-4 <?php echo $class2; ?>'>
2533
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
2534
-                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
2533
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
2534
+                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
2535 2535
                                 </div>
2536 2536
 
2537 2537
                             <?php } else {?>
@@ -2539,15 +2539,15 @@  discard block
 block discarded – undo
2539 2539
                                 <div class='col-4'>
2540 2540
                                     <div class='input-group'>
2541 2541
 
2542
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
2542
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
2543 2543
                                             <div class='input-group-prepend'>
2544 2544
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2545 2545
                                             </div>
2546 2546
                                         <?php } ?>
2547 2547
 
2548
-                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'>
2548
+                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'>
2549 2549
                                     
2550
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
2550
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
2551 2551
                                             <div class='input-group-append'>
2552 2552
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2553 2553
                                             </div>
@@ -2558,35 +2558,35 @@  discard block
 block discarded – undo
2558 2558
                             <?php } ?>
2559 2559
 
2560 2560
                         </div>
2561
-                        <?php if ( ! empty( $item['description'] )) { ?>
2562
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
2561
+                        <?php if (!empty($item['description'])) { ?>
2562
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
2563 2563
                         <?php } ?>
2564 2564
                     </div>
2565 2565
                 <?php } ?>
2566 2566
 
2567 2567
                 <div class='mt-4 border-top item_totals_total p-2'>
2568 2568
 
2569
-                    <?php if ( wpinv_use_taxes() ) { ?>
2569
+                    <?php if (wpinv_use_taxes()) { ?>
2570 2570
                         <div class='row'>
2571
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div>
2572
-                            <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div>
2571
+                            <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div>
2572
+                            <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div>
2573 2573
                         </div>
2574 2574
                         <div class='row'>
2575
-                            <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div>
2576
-                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div>
2575
+                            <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div>
2576
+                            <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div>
2577 2577
                         </div>
2578 2578
                     <?php } ?>
2579 2579
 
2580 2580
                     <div class='row'>
2581
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
2582
-                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
2581
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
2582
+                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
2583 2583
                     </div>
2584 2584
                 </div>
2585 2585
 
2586 2586
             </div>
2587 2587
         <?php } ?>
2588
-        <?php if ( ! empty( $field[ 'description' ] ) ) { ?>
2589
-            <small class='form-text text-muted'><?php echo wp_kses_post( $field[ 'description' ] ); ?></small>
2588
+        <?php if (!empty($field['description'])) { ?>
2589
+            <small class='form-text text-muted'><?php echo wp_kses_post($field['description']); ?></small>
2590 2590
         <?php } ?>
2591 2591
         </div>
2592 2592
         <?php
@@ -2595,20 +2595,20 @@  discard block
 block discarded – undo
2595 2595
     /**
2596 2596
      * Renders the items element template.
2597 2597
      */
2598
-    public function edit_items_template( $field ) {
2599
-        $restrict = $this->get_restrict_markup( $field, 'items' );
2600
-        $label    = __( 'Let customers...', 'invoicing' );
2601
-        $label2   = __( 'Available Items', 'invoicing' );
2602
-        $label3   = esc_attr__( 'Add some help text for this element', 'invoicing' );
2598
+    public function edit_items_template($field) {
2599
+        $restrict = $this->get_restrict_markup($field, 'items');
2600
+        $label    = __('Let customers...', 'invoicing');
2601
+        $label2   = __('Available Items', 'invoicing');
2602
+        $label3   = esc_attr__('Add some help text for this element', 'invoicing');
2603 2603
         $id       = $field . '.id + "_edit"';
2604 2604
         $id2      = $field . '.id + "_edit2"';
2605 2605
         $id3      = $field . '.id + "_edit3"';
2606 2606
         $id4      = $field . '.id + "_edit4"';
2607
-        $label4   = esc_attr__( 'This will be shown to the customer as the recommended price', 'invoicing' );
2608
-        $label5   = esc_attr__( 'Allow users to pay what they want', 'invoicing' );
2609
-        $label6   = esc_attr__( 'Enter the minimum price that a user can pay', 'invoicing' );
2610
-        $label7   = esc_attr__( 'Allow users to buy several quantities', 'invoicing' );
2611
-        $label8   = esc_attr__( 'This item is required', 'invoicing' );
2607
+        $label4   = esc_attr__('This will be shown to the customer as the recommended price', 'invoicing');
2608
+        $label5   = esc_attr__('Allow users to pay what they want', 'invoicing');
2609
+        $label6   = esc_attr__('Enter the minimum price that a user can pay', 'invoicing');
2610
+        $label7   = esc_attr__('Allow users to buy several quantities', 'invoicing');
2611
+        $label8   = esc_attr__('This item is required', 'invoicing');
2612 2612
         echo "<div $restrict>
2613 2613
 
2614 2614
                 <label>$label2</label>
@@ -2678,7 +2678,7 @@  discard block
 block discarded – undo
2678 2678
                 <div class='form-group mt-2'>
2679 2679
 
2680 2680
                     <select class='form-control custom-select' v-model='selected_item' @change='addSelectedItem'>
2681
-                        <option value=''>"        . __( 'Add an existing item to the form', 'invoicing' ) ."</option>
2681
+                        <option value=''>" . __('Add an existing item to the form', 'invoicing') . "</option>
2682 2682
                         <option v-for='(item, index) in all_items' :value='index'>{{item.title}}</option>
2683 2683
                     </select>
2684 2684
 
@@ -2693,11 +2693,11 @@  discard block
 block discarded – undo
2693 2693
                     <label :for='$id2'>$label</label>
2694 2694
 
2695 2695
                     <select class='form-control custom-select' :id='$id2' v-model='$field.items_type'>
2696
-                        <option value='total'>"        . __( 'Buy all items on the list', 'invoicing' ) ."</option>
2697
-                        <option value='radio'>"        . __( 'Select a single item from the list', 'invoicing' ) ."</option>
2698
-                        <option value='checkbox'>"     . __( 'Select one or more items on the list', 'invoicing' ) ."</option>
2699
-                        <option value='select'>"       . __( 'Select a single item from a dropdown', 'invoicing' ) ."</option>
2700
-                        <option value='multi_select'>" . __( 'Select a one or more items from a dropdown', 'invoicing' ) ."</option>
2696
+                        <option value='total'>" . __('Buy all items on the list', 'invoicing') . "</option>
2697
+                        <option value='radio'>"        . __('Select a single item from the list', 'invoicing') . "</option>
2698
+                        <option value='checkbox'>"     . __('Select one or more items on the list', 'invoicing') . "</option>
2699
+                        <option value='select'>"       . __('Select a single item from a dropdown', 'invoicing') . "</option>
2700
+                        <option value='multi_select'>" . __('Select a one or more items from a dropdown', 'invoicing') . "</option>
2701 2701
                     </select>
2702 2702
 
2703 2703
                 </div>
@@ -2722,27 +2722,27 @@  discard block
 block discarded – undo
2722 2722
             'orderby'        => 'title',
2723 2723
             'order'          => 'ASC',
2724 2724
             'posts_per_page' => -1,
2725
-            'post_status'    => array( 'publish' ),
2725
+            'post_status'    => array('publish'),
2726 2726
         );
2727 2727
     
2728
-        $items      = get_posts( apply_filters( 'wpinv_item_dropdown_query_args', $item_args ) );
2728
+        $items = get_posts(apply_filters('wpinv_item_dropdown_query_args', $item_args));
2729 2729
 
2730
-        if ( empty( $items ) ) {
2730
+        if (empty($items)) {
2731 2731
             return array();
2732 2732
         }
2733 2733
 
2734
-        $options    = array();
2735
-        foreach ( $items as $item ) {
2736
-            $title            = esc_html( $item->post_title );
2737
-            $title           .= wpinv_get_item_suffix( $item->ID, false );
2738
-            $id               = absint( $item->ID );
2739
-            $price            = wpinv_sanitize_amount( get_post_meta( $id, '_wpinv_price', true ) );
2740
-            $recurring        = (bool) get_post_meta( $id, '_wpinv_is_recurring', true );
2734
+        $options = array();
2735
+        foreach ($items as $item) {
2736
+            $title            = esc_html($item->post_title);
2737
+            $title           .= wpinv_get_item_suffix($item->ID, false);
2738
+            $id               = absint($item->ID);
2739
+            $price            = wpinv_sanitize_amount(get_post_meta($id, '_wpinv_price', true));
2740
+            $recurring        = (bool) get_post_meta($id, '_wpinv_is_recurring', true);
2741 2741
             $description      = $item->post_excerpt;
2742
-            $custom_price     = (bool) get_post_meta( $id, '_wpinv_dynamic_pricing', true );
2743
-            $minimum_price    = (float) get_post_meta( $id, '_minimum_price', true );
2742
+            $custom_price     = (bool) get_post_meta($id, '_wpinv_dynamic_pricing', true);
2743
+            $minimum_price    = (float) get_post_meta($id, '_minimum_price', true);
2744 2744
             $allow_quantities = false;
2745
-            $options[]        = compact( 'title', 'id', 'price', 'recurring', 'description', 'custom_price', 'minimum_price', 'allow_quantities' );
2745
+            $options[]        = compact('title', 'id', 'price', 'recurring', 'description', 'custom_price', 'minimum_price', 'allow_quantities');
2746 2746
 
2747 2747
         }
2748 2748
         return $options;
@@ -2752,47 +2752,47 @@  discard block
 block discarded – undo
2752 2752
     /**
2753 2753
      * Returns an array of items for the currently being edited form.
2754 2754
      */
2755
-    public function get_form_items( $id = false ) {
2755
+    public function get_form_items($id = false) {
2756 2756
         
2757
-        if ( empty( $id ) ) {
2758
-            return wpinv_get_data( 'sample-payment-form-items' );
2757
+        if (empty($id)) {
2758
+            return wpinv_get_data('sample-payment-form-items');
2759 2759
         }
2760 2760
         
2761
-        $form_elements = get_post_meta( $id, 'wpinv_form_items', true );
2761
+        $form_elements = get_post_meta($id, 'wpinv_form_items', true);
2762 2762
 
2763
-        if ( is_array( $form_elements ) ) {
2763
+        if (is_array($form_elements)) {
2764 2764
             return $form_elements;
2765 2765
         }
2766 2766
 
2767
-        return wpinv_get_data( 'sample-payment-form-items' );
2767
+        return wpinv_get_data('sample-payment-form-items');
2768 2768
 
2769 2769
     }
2770 2770
 
2771 2771
     /**
2772 2772
      * Returns an array of elements for the currently being edited form.
2773 2773
      */
2774
-    public function get_form_elements( $id = false ) {
2774
+    public function get_form_elements($id = false) {
2775 2775
 
2776
-        if ( empty( $id ) ) {
2777
-            return wpinv_get_data( 'sample-payment-form' );
2776
+        if (empty($id)) {
2777
+            return wpinv_get_data('sample-payment-form');
2778 2778
         }
2779 2779
         
2780
-        $form_elements = get_post_meta( $id, 'wpinv_form_elements', true );
2780
+        $form_elements = get_post_meta($id, 'wpinv_form_elements', true);
2781 2781
 
2782
-        if ( is_array( $form_elements ) ) {
2782
+        if (is_array($form_elements)) {
2783 2783
             return $form_elements;
2784 2784
         }
2785 2785
 
2786
-        return wpinv_get_data( 'sample-payment-form' );
2786
+        return wpinv_get_data('sample-payment-form');
2787 2787
     }
2788 2788
 
2789 2789
     /**
2790 2790
      * Sends a redrect response to payment details.
2791 2791
      *
2792 2792
      */
2793
-    public function send_redirect_response( $url ) {
2794
-        $url = urlencode( $url );
2795
-        wp_send_json_success( $url );
2793
+    public function send_redirect_response($url) {
2794
+        $url = urlencode($url);
2795
+        wp_send_json_success($url);
2796 2796
     }
2797 2797
 
2798 2798
     /**
@@ -2803,12 +2803,12 @@  discard block
 block discarded – undo
2803 2803
 
2804 2804
         $errors = wpinv_get_errors();
2805 2805
 
2806
-        if ( ! empty( $errors ) ) {
2806
+        if (!empty($errors)) {
2807 2807
             wpinv_print_errors();
2808 2808
             exit;
2809 2809
         }
2810 2810
 
2811
-        wp_send_json_error( __( 'An error occured while processing your payment. Please try again.', 'invoicing' ) );
2811
+        wp_send_json_error(__('An error occured while processing your payment. Please try again.', 'invoicing'));
2812 2812
         exit;
2813 2813
 
2814 2814
     }
Please login to merge, or discard this patch.