Passed
Push — master ( 38ae5c...d76375 )
by Stiofan
04:14
created
includes/admin/meta-boxes/class-mb-invoice-items.php 1 patch
Spacing   +150 added lines, -150 removed lines patch added patch discarded remove patch
@@ -1,44 +1,44 @@  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
-        $item_types         = apply_filters( 'wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post );
22
+        $item_types         = apply_filters('wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post);
23 23
         $is_recurring       = $invoice->is_recurring();
24 24
         $post_type_object   = get_post_type_object($invoice->post_type);
25 25
         $type_title         = $post_type_object->labels->singular_name;
26 26
         
27 27
         $cols = 5;
28
-        if ( $item_quantities ) {
28
+        if ($item_quantities) {
29 29
             $cols++;
30 30
         }
31
-        if ( $use_taxes ) {
31
+        if ($use_taxes) {
32 32
             $cols++;
33 33
         }
34 34
         $class = '';
35
-        if ( $invoice->is_paid() ) {
35
+        if ($invoice->is_paid()) {
36 36
             $class .= ' wpinv-paid';
37 37
         }
38
-        if ( $invoice->is_refunded() ) {
38
+        if ($invoice->is_refunded()) {
39 39
             $class .= ' wpinv-refunded';
40 40
         }
41
-        if ( $is_recurring ) {
41
+        if ($is_recurring) {
42 42
             $class .= ' wpi-recurring';
43 43
         }
44 44
         ?>
@@ -46,21 +46,21 @@  discard block
 block discarded – undo
46 46
             <table id="wpinv_items" class="wpinv-items" cellspacing="0" cellpadding="0">
47 47
                 <thead>
48 48
                     <tr>
49
-                        <th class="id"><?php _e( 'ID', 'invoicing' );?></th>
50
-                        <th class="title"><?php _e( 'Item', 'invoicing' );?></th>
51
-                        <th class="price"><?php _e( 'Price', 'invoicing' );?></th>
52
-                        <?php if ( $item_quantities ) { ?>
53
-                        <th class="qty"><?php _e( 'Qty', 'invoicing' );?></th>
49
+                        <th class="id"><?php _e('ID', 'invoicing'); ?></th>
50
+                        <th class="title"><?php _e('Item', 'invoicing'); ?></th>
51
+                        <th class="price"><?php _e('Price', 'invoicing'); ?></th>
52
+                        <?php if ($item_quantities) { ?>
53
+                        <th class="qty"><?php _e('Qty', 'invoicing'); ?></th>
54 54
                         <?php } ?>
55
-                        <th class="total"><?php _e( 'Total', 'invoicing' );?></th>
56
-                        <?php if ( $use_taxes ) { ?>
57
-                        <th class="tax"><?php _e( 'Tax (%)', 'invoicing' );?></th>
55
+                        <th class="total"><?php _e('Total', 'invoicing'); ?></th>
56
+                        <?php if ($use_taxes) { ?>
57
+                        <th class="tax"><?php _e('Tax (%)', 'invoicing'); ?></th>
58 58
                         <?php } ?>
59 59
                         <th class="action"></th>
60 60
                     </tr>
61 61
                 </thead>
62 62
                 <tbody class="wpinv-line-items">
63
-                    <?php echo wpinv_admin_get_line_items( $invoice ); ?>
63
+                    <?php echo wpinv_admin_get_line_items($invoice); ?>
64 64
                 </tbody>
65 65
                 <tfoot class="wpinv-totals">
66 66
                     <tr>
@@ -72,44 +72,44 @@  discard block
 block discarded – undo
72 72
                                         </td>
73 73
                                         <td class="title">
74 74
                                             <input type="text" class="regular-text" placeholder="Item name" value="" name="_wpinv_quick[name]">
75
-                                            <?php if ( $wpinv_euvat->allow_vat_rules() ) { ?>
75
+                                            <?php if ($wpinv_euvat->allow_vat_rules()) { ?>
76 76
                                             <div class="wp-clearfix">
77 77
                                                 <label class="wpi-vat-rule">
78
-                                                    <span class="title"><?php _e( 'VAT rule type', 'invoicing' );?></span>
78
+                                                    <span class="title"><?php _e('VAT rule type', 'invoicing'); ?></span>
79 79
                                                     <span class="input-text-wrap">
80
-                                                        <?php echo wpinv_html_select( array(
80
+                                                        <?php echo wpinv_html_select(array(
81 81
                                                             'options'          => $wpinv_euvat->get_rules(),
82 82
                                                             'name'             => '_wpinv_quick[vat_rule]',
83 83
                                                             'id'               => '_wpinv_quick_vat_rule',
84 84
                                                             'show_option_all'  => false,
85 85
                                                             'show_option_none' => false,
86 86
                                                             'class'            => 'gdmbx2-text-medium wpinv-quick-vat-rule',
87
-                                                        ) ); ?>
87
+                                                        )); ?>
88 88
                                                     </span>
89 89
                                                 </label>
90 90
                                             </div>
91
-                                            <?php } if ( $wpinv_euvat->allow_vat_classes() ) { ?>
91
+                                            <?php } if ($wpinv_euvat->allow_vat_classes()) { ?>
92 92
                                             <div class="wp-clearfix">
93 93
                                                 <label class="wpi-vat-class">
94
-                                                    <span class="title"><?php _e( 'VAT class', 'invoicing' );?></span>
94
+                                                    <span class="title"><?php _e('VAT class', 'invoicing'); ?></span>
95 95
                                                     <span class="input-text-wrap">
96
-                                                        <?php echo wpinv_html_select( array(
96
+                                                        <?php echo wpinv_html_select(array(
97 97
                                                             'options'          => $wpinv_euvat->get_all_classes(),
98 98
                                                             'name'             => '_wpinv_quick[vat_class]',
99 99
                                                             'id'               => '_wpinv_quick_vat_class',
100 100
                                                             'show_option_all'  => false,
101 101
                                                             'show_option_none' => false,
102 102
                                                             'class'            => 'gdmbx2-text-medium wpinv-quick-vat-class',
103
-                                                        ) ); ?>
103
+                                                        )); ?>
104 104
                                                     </span>
105 105
                                                 </label>
106 106
                                             </div>
107 107
                                             <?php } ?>
108 108
                                             <div class="wp-clearfix">
109 109
                                                 <label class="wpi-item-type">
110
-                                                    <span class="title"><?php _e( 'Item type', 'invoicing' );?></span>
110
+                                                    <span class="title"><?php _e('Item type', 'invoicing'); ?></span>
111 111
                                                     <span class="input-text-wrap">
112
-                                                        <?php echo wpinv_html_select( array(
112
+                                                        <?php echo wpinv_html_select(array(
113 113
                                                             'options'          => $item_types,
114 114
                                                             'name'             => '_wpinv_quick[type]',
115 115
                                                             'id'               => '_wpinv_quick_type',
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                                                             'show_option_all'  => false,
118 118
                                                             'show_option_none' => false,
119 119
                                                             'class'            => 'gdmbx2-text-medium wpinv-quick-type',
120
-                                                        ) ); ?>
120
+                                                        )); ?>
121 121
                                                     </span>
122 122
                                                 </label>
123 123
                                             </div>
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
                                             </div>
131 131
                                         </td>
132 132
                                         <td class="price"><input type="text" placeholder="0.00" class="wpi-field-price wpi-price" name="_wpinv_quick[price]" /></td>
133
-                                        <?php if ( $item_quantities ) { ?>
133
+                                        <?php if ($item_quantities) { ?>
134 134
                                         <td class="qty"><input type="number" class="small-text" step="1" min="1" value="1" name="_wpinv_quick[qty]" /></td>
135 135
                                         <?php } ?>
136 136
                                         <td class="total"></td>
137
-                                        <?php if ( $use_taxes ) { ?>
137
+                                        <?php if ($use_taxes) { ?>
138 138
                                         <td class="tax"></td>
139 139
                                         <?php } ?>
140 140
                                         <td class="action"></td>
@@ -147,29 +147,29 @@  discard block
 block discarded – undo
147 147
                         <td colspan="<?php echo $cols; ?>"></td>
148 148
                     </tr>
149 149
                     <tr class="totals">
150
-                        <td colspan="<?php echo ( $cols - 4 ); ?>"></td>
150
+                        <td colspan="<?php echo ($cols - 4); ?>"></td>
151 151
                         <td colspan="4">
152 152
                             <table cellspacing="0" cellpadding="0">
153 153
                                 <tr class="subtotal">
154
-                                    <td class="name"><?php _e( 'Sub Total:', 'invoicing' );?></td>
155
-                                    <td class="total"><?php echo $subtotal;?></td>
154
+                                    <td class="name"><?php _e('Sub Total:', 'invoicing'); ?></td>
155
+                                    <td class="total"><?php echo $subtotal; ?></td>
156 156
                                     <td class="action"></td>
157 157
                                 </tr>
158 158
                                 <tr class="discount">
159
-                                    <td class="name"><?php wpinv_get_discount_label( wpinv_discount_code( $invoice->ID ) ); ?>:</td>
160
-                                    <td class="total"><?php echo wpinv_discount( $invoice->ID, true, true ); ?></td>
159
+                                    <td class="name"><?php wpinv_get_discount_label(wpinv_discount_code($invoice->ID)); ?>:</td>
160
+                                    <td class="total"><?php echo wpinv_discount($invoice->ID, true, true); ?></td>
161 161
                                     <td class="action"></td>
162 162
                                 </tr>
163
-                                <?php if ( $use_taxes ) { ?>
163
+                                <?php if ($use_taxes) { ?>
164 164
                                 <tr class="tax">
165
-                                    <td class="name"><?php _e( 'Tax:', 'invoicing' );?></td>
166
-                                    <td class="total"><?php echo $tax;?></td>
165
+                                    <td class="name"><?php _e('Tax:', 'invoicing'); ?></td>
166
+                                    <td class="total"><?php echo $tax; ?></td>
167 167
                                     <td class="action"></td>
168 168
                                 </tr>
169 169
                                 <?php } ?>
170 170
                                 <tr class="total">
171
-                                    <td class="name"><?php echo apply_filters( 'wpinv_invoice_items_total_label', __( 'Invoice Total:', 'invoicing' ), $invoice );?></td>
172
-                                    <td class="total"><?php echo $total;?></td>
171
+                                    <td class="name"><?php echo apply_filters('wpinv_invoice_items_total_label', __('Invoice Total:', 'invoicing'), $invoice); ?></td>
172
+                                    <td class="total"><?php echo $total; ?></td>
173 173
                                     <td class="action"></td>
174 174
                                 </tr>
175 175
                             </table>
@@ -179,86 +179,86 @@  discard block
 block discarded – undo
179 179
             </table>
180 180
             <div class="wpinv-actions">
181 181
                 <?php
182
-                    if ( !$invoice->is_paid() && !$invoice->is_refunded() ) {
183
-                    if ( !$invoice->is_recurring() ) {
184
-                    echo wpinv_item_dropdown( array(
182
+                    if (!$invoice->is_paid() && !$invoice->is_refunded()) {
183
+                    if (!$invoice->is_recurring()) {
184
+                    echo wpinv_item_dropdown(array(
185 185
                         'name'             => 'wpinv_invoice_item',
186 186
                         'id'               => 'wpinv_invoice_item',
187 187
                         'show_recurring'   => true,
188
-                    ) );
188
+                    ));
189 189
                     ?>
190
-                <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">
190
+                <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">
191 191
                     <?php } ?>
192
-                <?php do_action( 'wpinv_invoice_items_actions', $invoice ); ?>
192
+                <?php do_action('wpinv_invoice_items_actions', $invoice); ?>
193 193
             </div>
194 194
         </div>
195 195
         <?php
196 196
     }
197 197
     
198
-    public static function prices( $post ) {        
198
+    public static function prices($post) {        
199 199
         $symbol         = wpinv_currency_symbol();
200 200
         $position       = wpinv_currency_position();
201
-        $item           = new WPInv_Item( $post->ID );
201
+        $item           = new WPInv_Item($post->ID);
202 202
         
203 203
         $price          = $item->get_price();
204 204
         $is_recurring   = $item->is_recurring();
205 205
         $period         = $item->get_recurring_period();
206
-        $interval       = absint( $item->get_recurring_interval() );
207
-        $times          = absint( $item->get_recurring_limit() );
206
+        $interval       = absint($item->get_recurring_interval());
207
+        $times          = absint($item->get_recurring_limit());
208 208
         $free_trial     = $item->has_free_trial();
209 209
         $trial_interval = $item->get_trial_interval();
210 210
         $trial_period   = $item->get_trial_period();
211 211
         
212 212
         $intervals      = array();
213
-        for ( $i = 1; $i <= 90; $i++ ) {
213
+        for ($i = 1; $i <= 90; $i++) {
214 214
             $intervals[$i] = $i;
215 215
         }
216 216
         
217
-        $interval       = $interval > 0 ? $interval : 1;
217
+        $interval = $interval > 0 ? $interval : 1;
218 218
         
219 219
         $class = $is_recurring ? 'wpinv-recurring-y' : 'wpinv-recurring-n';
220 220
         ?>
221
-        <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' ) ;?>" />
222
-        <?php do_action( 'wpinv_prices_metabox_price', $item ); ?>
221
+        <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'); ?>" />
222
+        <?php do_action('wpinv_prices_metabox_price', $item); ?>
223 223
         </p>
224 224
         <p class="wpinv-row-is-recurring">
225 225
             <label for="wpinv_is_recurring">
226
-                <input type="checkbox" name="wpinv_is_recurring" id="wpinv_is_recurring" value="1" <?php checked( 1, $is_recurring ); ?> />
227
-                <?php echo apply_filters( 'wpinv_is_recurring_toggle_text', __( 'Is Recurring Item?', 'invoicing' ) ); ?>
226
+                <input type="checkbox" name="wpinv_is_recurring" id="wpinv_is_recurring" value="1" <?php checked(1, $is_recurring); ?> />
227
+                <?php echo apply_filters('wpinv_is_recurring_toggle_text', __('Is Recurring Item?', 'invoicing')); ?>
228 228
             </label>
229 229
         </p>
230
-        <p class="wpinv-row-recurring-fields <?php echo $class;?>">
231
-                <label class="wpinv-period" for="wpinv_recurring_period"><?php _e( 'Recurring', 'invoicing' );?> <select class="wpinv-select " 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>
232
-                <label class="wpinv-interval" for="wpinv_recurring_interval"> <?php _e( 'at every', 'invoicing' );?> <?php echo wpinv_html_select( array(
230
+        <p class="wpinv-row-recurring-fields <?php echo $class; ?>">
231
+                <label class="wpinv-period" for="wpinv_recurring_period"><?php _e('Recurring', 'invoicing'); ?> <select class="wpinv-select " 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>
232
+                <label class="wpinv-interval" for="wpinv_recurring_interval"> <?php _e('at every', 'invoicing'); ?> <?php echo wpinv_html_select(array(
233 233
                     'options'          => $intervals,
234 234
                     'name'             => 'wpinv_recurring_interval',
235 235
                     'id'               => 'wpinv_recurring_interval',
236 236
                     'selected'         => $interval,
237 237
                     'show_option_all'  => false,
238 238
                     'show_option_none' => false
239
-                ) ); ?> <span id="wpinv_interval_text"><?php _e( 'day(s)', 'invoicing' );?></span></label>
240
-                <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>
239
+                )); ?> <span id="wpinv_interval_text"><?php _e('day(s)', 'invoicing'); ?></span></label>
240
+                <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>
241 241
                 <span class="clear wpi-trial-clr"></span>
242 242
                 <label class="wpinv-free-trial" for="wpinv_free_trial">
243
-                    <input type="checkbox" name="wpinv_free_trial" id="wpinv_free_trial" value="1" <?php checked( true, (bool)$free_trial ); ?> /> 
244
-                    <?php echo __( 'Offer free trial for', 'invoicing' ); ?>
243
+                    <input type="checkbox" name="wpinv_free_trial" id="wpinv_free_trial" value="1" <?php checked(true, (bool)$free_trial); ?> /> 
244
+                    <?php echo __('Offer free trial for', 'invoicing'); ?>
245 245
                 </label>
246 246
                 <label class="wpinv-trial-interval" for="wpinv_trial_interval">
247
-                    <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" 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>
247
+                    <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" 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>
248 248
                 </label>
249 249
         </p>
250
-        <input type="hidden" id="_wpi_current_type" value="<?php echo wpinv_get_item_type( $post->ID ); ?>" />
251
-        <?php do_action( 'wpinv_item_price_field', $post->ID ); ?>
250
+        <input type="hidden" id="_wpi_current_type" value="<?php echo wpinv_get_item_type($post->ID); ?>" />
251
+        <?php do_action('wpinv_item_price_field', $post->ID); ?>
252 252
         <?php
253 253
     }
254 254
     
255
-    public static function vat_rules( $post ) {
255
+    public static function vat_rules($post) {
256 256
         global $wpinv_euvat;
257 257
         
258
-        $rule_type = $wpinv_euvat->get_item_rule( $post->ID );
258
+        $rule_type = $wpinv_euvat->get_item_rule($post->ID);
259 259
         ?>
260
-        <p><label for="wpinv_vat_rules"><strong><?php _e( 'Select how VAT rules will be applied:', 'invoicing' );?></strong></label>&nbsp;&nbsp;&nbsp;
261
-        <?php echo wpinv_html_select( array(
260
+        <p><label for="wpinv_vat_rules"><strong><?php _e('Select how VAT rules will be applied:', 'invoicing'); ?></strong></label>&nbsp;&nbsp;&nbsp;
261
+        <?php echo wpinv_html_select(array(
262 262
                     'options'          => $wpinv_euvat->get_rules(),
263 263
                     'name'             => 'wpinv_vat_rules',
264 264
                     'id'               => 'wpinv_vat_rules',
@@ -266,19 +266,19 @@  discard block
 block discarded – undo
266 266
                     'show_option_all'  => false,
267 267
                     'show_option_none' => false,
268 268
                     'class'            => 'gdmbx2-text-medium wpinv-vat-rules',
269
-                ) ); ?>
269
+                )); ?>
270 270
         </p>
271
-        <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>
272
-        <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>
271
+        <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>
272
+        <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>
273 273
         <?php
274 274
     }
275 275
     
276
-    public static function vat_classes( $post ) {
276
+    public static function vat_classes($post) {
277 277
         global $wpinv_euvat;
278 278
         
279
-        $vat_class = $wpinv_euvat->get_item_class( $post->ID );
279
+        $vat_class = $wpinv_euvat->get_item_class($post->ID);
280 280
         ?>
281
-        <p><?php echo wpinv_html_select( array(
281
+        <p><?php echo wpinv_html_select(array(
282 282
                     'options'          => $wpinv_euvat->get_all_classes(),
283 283
                     'name'             => 'wpinv_vat_class',
284 284
                     'id'               => 'wpinv_vat_class',
@@ -286,18 +286,18 @@  discard block
 block discarded – undo
286 286
                     'show_option_all'  => false,
287 287
                     'show_option_none' => false,
288 288
                     'class'            => 'gdmbx2-text-medium wpinv-vat-class',
289
-                ) ); ?>
289
+                )); ?>
290 290
         </p>
291
-        <p class="wpi-m0"><?php _e( 'Select the VAT rate class to use for this invoice item.', 'invoicing' ); ?></p>
291
+        <p class="wpi-m0"><?php _e('Select the VAT rate class to use for this invoice item.', 'invoicing'); ?></p>
292 292
         <?php
293 293
     }
294 294
     
295
-    public static function item_info( $post ) {
296
-        $item_type = wpinv_get_item_type( $post->ID );
297
-        do_action( 'wpinv_item_info_metabox_before', $post );
295
+    public static function item_info($post) {
296
+        $item_type = wpinv_get_item_type($post->ID);
297
+        do_action('wpinv_item_info_metabox_before', $post);
298 298
         ?>
299
-        <p><label for="wpinv_item_type"><strong><?php _e( 'Type:', 'invoicing' );?></strong></label>&nbsp;&nbsp;&nbsp;
300
-        <?php echo wpinv_html_select( array(
299
+        <p><label for="wpinv_item_type"><strong><?php _e('Type:', 'invoicing'); ?></strong></label>&nbsp;&nbsp;&nbsp;
300
+        <?php echo wpinv_html_select(array(
301 301
                     'options'          => wpinv_get_item_types(),
302 302
                     'name'             => 'wpinv_item_type',
303 303
                     'id'               => 'wpinv_item_type',
@@ -305,114 +305,114 @@  discard block
 block discarded – undo
305 305
                     'show_option_all'  => false,
306 306
                     'show_option_none' => false,
307 307
                     'class'            => 'gdmbx2-text-medium wpinv-item-type',
308
-                ) ); ?>
308
+                )); ?>
309 309
         </p>
310
-        <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>
310
+        <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>
311 311
         <?php
312
-        do_action( 'wpinv_item_info_metabox_after', $post );
312
+        do_action('wpinv_item_info_metabox_after', $post);
313 313
     }
314 314
     
315
-    public static function meta_values( $post ) {
316
-        $meta_keys = apply_filters( 'wpinv_show_meta_values_for_keys', array(
315
+    public static function meta_values($post) {
316
+        $meta_keys = apply_filters('wpinv_show_meta_values_for_keys', array(
317 317
             'type',
318 318
             'custom_id'
319
-        ) );
319
+        ));
320 320
         
321
-        if ( empty( $meta_keys ) ) {
321
+        if (empty($meta_keys)) {
322 322
             return;
323 323
         }
324 324
         
325
-        do_action( 'wpinv_meta_values_metabox_before', $post );
325
+        do_action('wpinv_meta_values_metabox_before', $post);
326 326
         
327
-        foreach ( $meta_keys as $meta_key ) {
327
+        foreach ($meta_keys as $meta_key) {
328 328
             ?>
329
-            <p class="wpi-mtb05"><label><strong><?php echo $meta_key; ?></strong>: <?php echo get_post_meta( $post->ID, '_wpinv_' . $meta_key, true ); ?></label></p>
329
+            <p class="wpi-mtb05"><label><strong><?php echo $meta_key; ?></strong>: <?php echo get_post_meta($post->ID, '_wpinv_' . $meta_key, true); ?></label></p>
330 330
             <?php 
331 331
         }
332 332
         
333
-        do_action( 'wpinv_meta_values_metabox_after', $post );
333
+        do_action('wpinv_meta_values_metabox_after', $post);
334 334
     }
335 335
     
336
-    public static function save( $post_id, $data, $post ) {
337
-        $invoice        = new WPInv_Invoice( $post_id );
336
+    public static function save($post_id, $data, $post) {
337
+        $invoice        = new WPInv_Invoice($post_id);
338 338
         
339 339
         // Billing
340
-        $first_name     = sanitize_text_field( $data['wpinv_first_name'] );
341
-        $last_name      = sanitize_text_field( $data['wpinv_last_name'] );
342
-        $company        = sanitize_text_field( $data['wpinv_company'] );
343
-        $vat_number     = sanitize_text_field( $data['wpinv_vat_number'] );
344
-        $phone          = sanitize_text_field( $data['wpinv_phone'] );
345
-        $address        = sanitize_text_field( $data['wpinv_address'] );
346
-        $city           = sanitize_text_field( $data['wpinv_city'] );
347
-        $zip            = sanitize_text_field( $data['wpinv_zip'] );
348
-        $country        = sanitize_text_field( $data['wpinv_country'] );
349
-        $state          = sanitize_text_field( $data['wpinv_state'] );
340
+        $first_name     = sanitize_text_field($data['wpinv_first_name']);
341
+        $last_name      = sanitize_text_field($data['wpinv_last_name']);
342
+        $company        = sanitize_text_field($data['wpinv_company']);
343
+        $vat_number     = sanitize_text_field($data['wpinv_vat_number']);
344
+        $phone          = sanitize_text_field($data['wpinv_phone']);
345
+        $address        = sanitize_text_field($data['wpinv_address']);
346
+        $city           = sanitize_text_field($data['wpinv_city']);
347
+        $zip            = sanitize_text_field($data['wpinv_zip']);
348
+        $country        = sanitize_text_field($data['wpinv_country']);
349
+        $state          = sanitize_text_field($data['wpinv_state']);
350 350
         
351 351
         // Details
352
-        $status         = sanitize_text_field( $data['wpinv_status'] );
353
-        $old_status     = !empty( $data['original_post_status'] ) ? sanitize_text_field( $data['original_post_status'] ) : $status;
354
-        $number         = sanitize_text_field( $data['wpinv_number'] );
355
-        $due_date       = isset( $data['wpinv_due_date'] ) ? sanitize_text_field( $data['wpinv_due_date'] ) : '';
352
+        $status         = sanitize_text_field($data['wpinv_status']);
353
+        $old_status     = !empty($data['original_post_status']) ? sanitize_text_field($data['original_post_status']) : $status;
354
+        $number         = sanitize_text_field($data['wpinv_number']);
355
+        $due_date       = isset($data['wpinv_due_date']) ? sanitize_text_field($data['wpinv_due_date']) : '';
356 356
         //$discounts      = sanitize_text_field( $data['wpinv_discounts'] );
357 357
         //$discount       = sanitize_text_field( $data['wpinv_discount'] );
358 358
         
359
-        $ip             = $invoice->get_ip() ? $invoice->get_ip() : wpinv_get_ip();
359
+        $ip = $invoice->get_ip() ? $invoice->get_ip() : wpinv_get_ip();
360 360
         
361
-        $invoice->set( 'due_date', $due_date );
362
-        $invoice->set( 'first_name', $first_name );
363
-        $invoice->set( 'last_name', $last_name );
364
-        $invoice->set( 'company', $company );
365
-        $invoice->set( 'vat_number', $vat_number );
366
-        $invoice->set( 'phone', $phone );
367
-        $invoice->set( 'address', $address );
368
-        $invoice->set( 'city', $city );
369
-        $invoice->set( 'zip', $zip );
370
-        $invoice->set( 'country', $country );
371
-        $invoice->set( 'state', $state );
372
-        $invoice->set( 'status', $status );
361
+        $invoice->set('due_date', $due_date);
362
+        $invoice->set('first_name', $first_name);
363
+        $invoice->set('last_name', $last_name);
364
+        $invoice->set('company', $company);
365
+        $invoice->set('vat_number', $vat_number);
366
+        $invoice->set('phone', $phone);
367
+        $invoice->set('address', $address);
368
+        $invoice->set('city', $city);
369
+        $invoice->set('zip', $zip);
370
+        $invoice->set('country', $country);
371
+        $invoice->set('state', $state);
372
+        $invoice->set('status', $status);
373 373
         //$invoice->set( 'number', $number );
374 374
         //$invoice->set( 'discounts', $discounts );
375 375
         //$invoice->set( 'discount', $discount );
376
-        $invoice->set( 'ip', $ip );
376
+        $invoice->set('ip', $ip);
377 377
         $invoice->old_status = $_POST['original_post_status'];
378 378
         $invoice->currency = wpinv_get_currency();
379
-        if ( !empty( $data['wpinv_gateway'] ) ) {
380
-            $invoice->set( 'gateway', sanitize_text_field( $data['wpinv_gateway'] ) );
379
+        if (!empty($data['wpinv_gateway'])) {
380
+            $invoice->set('gateway', sanitize_text_field($data['wpinv_gateway']));
381 381
         }
382 382
         $saved = $invoice->save();
383 383
         
384 384
         // Check for payment notes
385
-        if ( !empty( $data['invoice_note'] ) ) {
386
-            $note               = wp_kses( $data['invoice_note'], array() );
387
-            $note_type          = sanitize_text_field( $data['invoice_note_type'] );
385
+        if (!empty($data['invoice_note'])) {
386
+            $note               = wp_kses($data['invoice_note'], array());
387
+            $note_type          = sanitize_text_field($data['invoice_note_type']);
388 388
             $is_customer_note   = $note_type == 'customer' ? 1 : 0;
389 389
         
390
-            wpinv_insert_payment_note( $invoice->ID, $note, $is_customer_note );
390
+            wpinv_insert_payment_note($invoice->ID, $note, $is_customer_note);
391 391
         }
392 392
         
393 393
         // Update user address if empty.
394
-        if ( $saved && !empty( $invoice ) ) {
395
-            if ( $user_id = $invoice->get_user_id() ) {
396
-                $user_address = wpinv_get_user_address( $user_id, false );
394
+        if ($saved && !empty($invoice)) {
395
+            if ($user_id = $invoice->get_user_id()) {
396
+                $user_address = wpinv_get_user_address($user_id, false);
397 397
                 
398 398
                 if (empty($user_address['first_name'])) {
399
-                    update_user_meta( $user_id, '_wpinv_first_name', $first_name );
400
-                    update_user_meta( $user_id, '_wpinv_last_name', $last_name );
399
+                    update_user_meta($user_id, '_wpinv_first_name', $first_name);
400
+                    update_user_meta($user_id, '_wpinv_last_name', $last_name);
401 401
                 } else if (empty($user_address['last_name']) && $user_address['first_name'] == $first_name) {
402
-                    update_user_meta( $user_id, '_wpinv_last_name', $last_name );
402
+                    update_user_meta($user_id, '_wpinv_last_name', $last_name);
403 403
                 }
404 404
                 
405 405
                 if (empty($user_address['address']) || empty($user_address['city']) || empty($user_address['state']) || empty($user_address['country'])) {
406
-                    update_user_meta( $user_id, '_wpinv_address', $address );
407
-                    update_user_meta( $user_id, '_wpinv_city', $city );
408
-                    update_user_meta( $user_id, '_wpinv_state', $state );
409
-                    update_user_meta( $user_id, '_wpinv_country', $country );
410
-                    update_user_meta( $user_id, '_wpinv_zip', $zip );
411
-                    update_user_meta( $user_id, '_wpinv_phone', $phone );
406
+                    update_user_meta($user_id, '_wpinv_address', $address);
407
+                    update_user_meta($user_id, '_wpinv_city', $city);
408
+                    update_user_meta($user_id, '_wpinv_state', $state);
409
+                    update_user_meta($user_id, '_wpinv_country', $country);
410
+                    update_user_meta($user_id, '_wpinv_zip', $zip);
411
+                    update_user_meta($user_id, '_wpinv_phone', $phone);
412 412
                 }
413 413
             }
414 414
             
415
-            do_action( 'wpinv_invoice_metabox_saved', $invoice );
415
+            do_action('wpinv_invoice_metabox_saved', $invoice);
416 416
         }
417 417
         
418 418
         return $saved;
Please login to merge, or discard this patch.
includes/admin/admin-meta-boxes.php 1 patch
Spacing   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -1,65 +1,65 @@  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
-function wpinv_add_meta_boxes( $post_type, $post ) {
7
+function wpinv_add_meta_boxes($post_type, $post) {
8 8
     global $wpi_mb_invoice;
9
-    if ( $post_type == 'wpi_invoice' && !empty( $post->ID ) ) {
10
-        $wpi_mb_invoice = wpinv_get_invoice( $post->ID );
9
+    if ($post_type == 'wpi_invoice' && !empty($post->ID)) {
10
+        $wpi_mb_invoice = wpinv_get_invoice($post->ID);
11 11
     }
12 12
     
13
-    if ( !empty( $wpi_mb_invoice ) && !$wpi_mb_invoice->has_status( array( 'draft', 'auto-draft' ) ) ) {
14
-        add_meta_box( 'wpinv-mb-resend-invoice', __( 'Resend Invoice', 'invoicing' ), 'WPInv_Meta_Box_Details::resend_invoice', 'wpi_invoice', 'side', 'high' );
13
+    if (!empty($wpi_mb_invoice) && !$wpi_mb_invoice->has_status(array('draft', 'auto-draft'))) {
14
+        add_meta_box('wpinv-mb-resend-invoice', __('Resend Invoice', 'invoicing'), 'WPInv_Meta_Box_Details::resend_invoice', 'wpi_invoice', 'side', 'high');
15 15
     }
16 16
     
17
-    if ( !empty( $wpi_mb_invoice ) && $wpi_mb_invoice->is_recurring() && $wpi_mb_invoice->is_parent() ) {
18
-        add_meta_box( 'wpinv-mb-subscriptions', __( 'Subscriptions', 'invoicing' ), 'WPInv_Meta_Box_Details::subscriptions', 'wpi_invoice', 'side', 'high' );
17
+    if (!empty($wpi_mb_invoice) && $wpi_mb_invoice->is_recurring() && $wpi_mb_invoice->is_parent()) {
18
+        add_meta_box('wpinv-mb-subscriptions', __('Subscriptions', 'invoicing'), 'WPInv_Meta_Box_Details::subscriptions', 'wpi_invoice', 'side', 'high');
19 19
     }
20 20
     
21
-    if ( wpinv_is_subscription_payment( $wpi_mb_invoice ) ) {
22
-        add_meta_box( 'wpinv-mb-renewals', __( 'Renewal Payment', 'invoicing' ), 'WPInv_Meta_Box_Details::renewals', 'wpi_invoice', 'side', 'high' );
21
+    if (wpinv_is_subscription_payment($wpi_mb_invoice)) {
22
+        add_meta_box('wpinv-mb-renewals', __('Renewal Payment', 'invoicing'), 'WPInv_Meta_Box_Details::renewals', 'wpi_invoice', 'side', 'high');
23 23
     }
24 24
     
25
-    add_meta_box( 'wpinv-details', __( 'Invoice Details', 'invoicing' ), 'WPInv_Meta_Box_Details::output', 'wpi_invoice', 'side', 'default' );
26
-    add_meta_box( 'wpinv-payment-meta', __( 'Payment Meta', 'invoicing' ), 'WPInv_Meta_Box_Details::payment_meta', 'wpi_invoice', 'side', 'default' );
25
+    add_meta_box('wpinv-details', __('Invoice Details', 'invoicing'), 'WPInv_Meta_Box_Details::output', 'wpi_invoice', 'side', 'default');
26
+    add_meta_box('wpinv-payment-meta', __('Payment Meta', 'invoicing'), 'WPInv_Meta_Box_Details::payment_meta', 'wpi_invoice', 'side', 'default');
27 27
    
28
-    add_meta_box( 'wpinv-address', __( 'Billing Details', 'invoicing' ), 'WPInv_Meta_Box_Billing_Details::output', 'wpi_invoice', 'normal', 'high' );
29
-    add_meta_box( 'wpinv-items', __( 'Invoice Items', 'invoicing' ), 'WPInv_Meta_Box_Items::output', 'wpi_invoice', 'normal', 'high' );
30
-    add_meta_box( 'wpinv-notes', __( 'Invoice Notes', 'invoicing' ), 'WPInv_Meta_Box_Notes::output', 'wpi_invoice', 'normal', 'high' );
28
+    add_meta_box('wpinv-address', __('Billing Details', 'invoicing'), 'WPInv_Meta_Box_Billing_Details::output', 'wpi_invoice', 'normal', 'high');
29
+    add_meta_box('wpinv-items', __('Invoice Items', 'invoicing'), 'WPInv_Meta_Box_Items::output', 'wpi_invoice', 'normal', 'high');
30
+    add_meta_box('wpinv-notes', __('Invoice Notes', 'invoicing'), 'WPInv_Meta_Box_Notes::output', 'wpi_invoice', 'normal', 'high');
31 31
 }
32
-add_action( 'add_meta_boxes', 'wpinv_add_meta_boxes', 30, 2 );
32
+add_action('add_meta_boxes', 'wpinv_add_meta_boxes', 30, 2);
33 33
 
34
-function wpinv_save_meta_boxes( $post_id, $post, $update = false ) {
35
-    remove_action( 'save_post', __FUNCTION__ );
34
+function wpinv_save_meta_boxes($post_id, $post, $update = false) {
35
+    remove_action('save_post', __FUNCTION__);
36 36
     
37 37
     // $post_id and $post are required
38
-    if ( empty( $post_id ) || empty( $post ) ) {
38
+    if (empty($post_id) || empty($post)) {
39 39
         return;
40 40
     }
41 41
         
42
-    if ( !current_user_can( 'edit_post', $post_id ) || empty( $post->post_type ) ) {
42
+    if (!current_user_can('edit_post', $post_id) || empty($post->post_type)) {
43 43
         return;
44 44
     }
45 45
     
46 46
     // Dont' save meta boxes for revisions or autosaves
47
-    if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
47
+    if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) {
48 48
         return;
49 49
     }
50 50
         
51
-    if ( $post->post_type == 'wpi_invoice' or $post->post_type == 'wpi_quote' ) {
52
-        if ( ( defined( 'DOING_AJAX') && DOING_AJAX ) || isset( $_REQUEST['bulk_edit'] ) ) {
51
+    if ($post->post_type == 'wpi_invoice' or $post->post_type == 'wpi_quote') {
52
+        if ((defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit'])) {
53 53
             return;
54 54
         }
55 55
     
56
-        if ( isset( $_POST['wpinv_save_invoice'] ) && wp_verify_nonce( $_POST['wpinv_save_invoice'], 'wpinv_save_invoice' ) ) {
57
-            WPInv_Meta_Box_Items::save( $post_id, $_POST, $post );
56
+        if (isset($_POST['wpinv_save_invoice']) && wp_verify_nonce($_POST['wpinv_save_invoice'], 'wpinv_save_invoice')) {
57
+            WPInv_Meta_Box_Items::save($post_id, $_POST, $post);
58 58
         }
59
-    } else if ( $post->post_type == 'wpi_item' ) {
59
+    } else if ($post->post_type == 'wpi_item') {
60 60
         // verify nonce
61
-        if ( isset( $_POST['wpinv_vat_meta_box_nonce'] ) && wp_verify_nonce( $_POST['wpinv_vat_meta_box_nonce'], 'wpinv_item_meta_box_save' ) ) {
62
-            $fields                                 = array();
61
+        if (isset($_POST['wpinv_vat_meta_box_nonce']) && wp_verify_nonce($_POST['wpinv_vat_meta_box_nonce'], 'wpinv_item_meta_box_save')) {
62
+            $fields = array();
63 63
             $fields['_wpinv_price']              = 'wpinv_item_price';
64 64
             $fields['_wpinv_vat_class']          = 'wpinv_vat_class';
65 65
             $fields['_wpinv_vat_rule']           = 'wpinv_vat_rules';
@@ -72,258 +72,258 @@  discard block
 block discarded – undo
72 72
             $fields['_wpinv_trial_period']       = 'wpinv_trial_period';
73 73
             $fields['_wpinv_trial_interval']     = 'wpinv_trial_interval';
74 74
             
75
-            if ( !isset( $_POST['wpinv_is_recurring'] ) ) {
75
+            if (!isset($_POST['wpinv_is_recurring'])) {
76 76
                 $_POST['wpinv_is_recurring'] = 0;
77 77
             }
78 78
             
79
-            if ( !isset( $_POST['wpinv_free_trial'] ) || empty( $_POST['wpinv_is_recurring'] ) ) {
79
+            if (!isset($_POST['wpinv_free_trial']) || empty($_POST['wpinv_is_recurring'])) {
80 80
                 $_POST['wpinv_free_trial'] = 0;
81 81
             }
82 82
             
83
-            foreach ( $fields as $field => $name ) {
84
-                if ( isset( $_POST[ $name ] ) ) {
85
-                    $allowed = apply_filters( 'wpinv_item_allowed_save_meta_value', true, $field, $post_id );
83
+            foreach ($fields as $field => $name) {
84
+                if (isset($_POST[$name])) {
85
+                    $allowed = apply_filters('wpinv_item_allowed_save_meta_value', true, $field, $post_id);
86 86
 
87
-                    if ( !$allowed ) {
87
+                    if (!$allowed) {
88 88
                         continue;
89 89
                     }
90 90
 
91
-                    if ( $field == '_wpinv_price' ) {
92
-                        $value = wpinv_sanitize_amount( $_POST[ $name ] );
91
+                    if ($field == '_wpinv_price') {
92
+                        $value = wpinv_sanitize_amount($_POST[$name]);
93 93
                     } else {
94
-                        $value = is_string( $_POST[ $name ] ) ? sanitize_text_field( $_POST[ $name ] ) : $_POST[ $name ];
94
+                        $value = is_string($_POST[$name]) ? sanitize_text_field($_POST[$name]) : $_POST[$name];
95 95
                     }
96 96
                     
97
-                    $value = apply_filters( 'wpinv_item_metabox_save_' . $field, $value, $name );
98
-                    update_post_meta( $post_id, $field, $value );
97
+                    $value = apply_filters('wpinv_item_metabox_save_' . $field, $value, $name);
98
+                    update_post_meta($post_id, $field, $value);
99 99
                 }
100 100
             }
101 101
             
102
-            if ( !get_post_meta( $post_id, '_wpinv_custom_id', true ) ) {
103
-                update_post_meta( $post_id, '_wpinv_custom_id', $post_id );
102
+            if (!get_post_meta($post_id, '_wpinv_custom_id', true)) {
103
+                update_post_meta($post_id, '_wpinv_custom_id', $post_id);
104 104
             }
105 105
         }
106 106
     }
107 107
 }
108
-add_action( 'save_post', 'wpinv_save_meta_boxes', 10, 3 );
108
+add_action('save_post', 'wpinv_save_meta_boxes', 10, 3);
109 109
 
110 110
 function wpinv_register_item_meta_boxes() {    
111 111
     global $wpinv_euvat;
112 112
     
113
-    add_meta_box( 'wpinv_field_prices', __( 'Item Price', 'invoicing' ), 'WPInv_Meta_Box_Items::prices', 'wpi_item', 'normal', 'high' );
113
+    add_meta_box('wpinv_field_prices', __('Item Price', 'invoicing'), 'WPInv_Meta_Box_Items::prices', 'wpi_item', 'normal', 'high');
114 114
 
115
-    if ( $wpinv_euvat->allow_vat_rules() ) {
116
-        add_meta_box( 'wpinv_field_vat_rules', __( 'VAT rules type to use', 'invoicing' ), 'WPInv_Meta_Box_Items::vat_rules', 'wpi_item', 'normal', 'high' );
115
+    if ($wpinv_euvat->allow_vat_rules()) {
116
+        add_meta_box('wpinv_field_vat_rules', __('VAT rules type to use', 'invoicing'), 'WPInv_Meta_Box_Items::vat_rules', 'wpi_item', 'normal', 'high');
117 117
     }
118 118
     
119
-    if ( $wpinv_euvat->allow_vat_classes() ) {
120
-        add_meta_box( 'wpinv_field_vat_classes', __( 'VAT rates class to use', 'invoicing' ), 'WPInv_Meta_Box_Items::vat_classes', 'wpi_item', 'normal', 'high' );
119
+    if ($wpinv_euvat->allow_vat_classes()) {
120
+        add_meta_box('wpinv_field_vat_classes', __('VAT rates class to use', 'invoicing'), 'WPInv_Meta_Box_Items::vat_classes', 'wpi_item', 'normal', 'high');
121 121
     }
122 122
     
123
-    add_meta_box( 'wpinv_field_item_info', __( 'Item info', 'invoicing' ), 'WPInv_Meta_Box_Items::item_info', 'wpi_item', 'side', 'core' );
124
-    add_meta_box( 'wpinv_field_meta_values', __( 'Item Meta Values', 'invoicing' ), 'WPInv_Meta_Box_Items::meta_values', 'wpi_item', 'side', 'core' );
123
+    add_meta_box('wpinv_field_item_info', __('Item info', 'invoicing'), 'WPInv_Meta_Box_Items::item_info', 'wpi_item', 'side', 'core');
124
+    add_meta_box('wpinv_field_meta_values', __('Item Meta Values', 'invoicing'), 'WPInv_Meta_Box_Items::meta_values', 'wpi_item', 'side', 'core');
125 125
 }
126 126
 
127 127
 function wpinv_register_discount_meta_boxes() {
128
-    add_meta_box( 'wpinv_discount_fields', __( 'Discount Details', 'invoicing' ), 'wpinv_discount_metabox_details', 'wpi_discount', 'normal', 'high' );
128
+    add_meta_box('wpinv_discount_fields', __('Discount Details', 'invoicing'), 'wpinv_discount_metabox_details', 'wpi_discount', 'normal', 'high');
129 129
 }
130 130
 
131
-function wpinv_discount_metabox_details( $post ) {
131
+function wpinv_discount_metabox_details($post) {
132 132
     $discount_id    = $post->ID;
133
-    $discount       = wpinv_get_discount( $discount_id );
133
+    $discount       = wpinv_get_discount($discount_id);
134 134
     
135
-    $type           = wpinv_get_discount_type( $discount_id );
136
-    $item_reqs      = wpinv_get_discount_item_reqs( $discount_id );
137
-    $excluded_items = wpinv_get_discount_excluded_items( $discount_id );
138
-    $min_total      = wpinv_get_discount_min_total( $discount_id );
139
-    $max_total      = wpinv_get_discount_max_total( $discount_id );
140
-    $max_uses       = wpinv_get_discount_max_uses( $discount_id );
141
-    $single_use     = wpinv_discount_is_single_use( $discount_id );
142
-    $recurring      = (bool)wpinv_discount_is_recurring( $discount_id );
135
+    $type           = wpinv_get_discount_type($discount_id);
136
+    $item_reqs      = wpinv_get_discount_item_reqs($discount_id);
137
+    $excluded_items = wpinv_get_discount_excluded_items($discount_id);
138
+    $min_total      = wpinv_get_discount_min_total($discount_id);
139
+    $max_total      = wpinv_get_discount_max_total($discount_id);
140
+    $max_uses       = wpinv_get_discount_max_uses($discount_id);
141
+    $single_use     = wpinv_discount_is_single_use($discount_id);
142
+    $recurring      = (bool)wpinv_discount_is_recurring($discount_id);
143 143
     
144 144
     $min_total      = $min_total > 0 ? $min_total : '';
145 145
     $max_total      = $max_total > 0 ? $max_total : '';
146 146
     $max_uses       = $max_uses > 0 ? $max_uses : '';
147 147
 ?>
148
-<?php do_action( 'wpinv_discount_form_top', $post ); ?>
149
-<?php wp_nonce_field( 'wpinv_discount_metabox_nonce', 'wpinv_discount_metabox_nonce' ); ;?>
148
+<?php do_action('wpinv_discount_form_top', $post); ?>
149
+<?php wp_nonce_field('wpinv_discount_metabox_nonce', 'wpinv_discount_metabox_nonce'); ;?>
150 150
 <table class="form-table wpi-form-table">
151 151
     <tbody>
152
-        <?php do_action( 'wpinv_discount_form_first', $post ); ?>
153
-        <?php do_action( 'wpinv_discount_form_before_code', $post ); ?>
152
+        <?php do_action('wpinv_discount_form_first', $post); ?>
153
+        <?php do_action('wpinv_discount_form_before_code', $post); ?>
154 154
         <tr>
155 155
             <th valign="top" scope="row">
156
-                <label for="wpinv_discount_code"><?php _e( 'Discount Code', 'invoicing' ); ?></label>
156
+                <label for="wpinv_discount_code"><?php _e('Discount Code', 'invoicing'); ?></label>
157 157
             </th>
158 158
             <td>
159
-                <input type="text" name="code" id="wpinv_discount_code" class="medium-text" value="<?php echo esc_attr( wpinv_get_discount_code( $discount_id ) ); ?>" required>
160
-                <p class="description"><?php _e( 'Enter a code for this discount, such as 10OFF', 'invoicing' ); ?></p>
159
+                <input type="text" name="code" id="wpinv_discount_code" class="medium-text" value="<?php echo esc_attr(wpinv_get_discount_code($discount_id)); ?>" required>
160
+                <p class="description"><?php _e('Enter a code for this discount, such as 10OFF', 'invoicing'); ?></p>
161 161
             </td>
162 162
         </tr>
163
-        <?php do_action( 'wpinv_discount_form_before_type', $post ); ?>
163
+        <?php do_action('wpinv_discount_form_before_type', $post); ?>
164 164
         <tr>
165 165
             <th valign="top" scope="row">
166
-                <label for="wpinv_discount_type"><?php _e( 'Discount Type', 'invoicing' ); ?></label>
166
+                <label for="wpinv_discount_type"><?php _e('Discount Type', 'invoicing'); ?></label>
167 167
             </th>
168 168
             <td>
169 169
                 <select id="wpinv_discount_type" name="type" class="medium-text">
170
-                    <?php foreach ( wpinv_get_discount_types() as $value => $label ) { ?>
171
-                    <option value="<?php echo $value ;?>" <?php selected( $type, $value ); ?>><?php echo $label; ?></option>
170
+                    <?php foreach (wpinv_get_discount_types() as $value => $label) { ?>
171
+                    <option value="<?php echo $value; ?>" <?php selected($type, $value); ?>><?php echo $label; ?></option>
172 172
                     <?php } ?>
173 173
                 </select>
174
-                <p class="description"><?php _e( 'The kind of discount to apply for this discount.', 'invoicing' ); ?></p>
174
+                <p class="description"><?php _e('The kind of discount to apply for this discount.', 'invoicing'); ?></p>
175 175
             </td>
176 176
         </tr>
177
-        <?php do_action( 'wpinv_discount_form_before_amount', $post ); ?>
177
+        <?php do_action('wpinv_discount_form_before_amount', $post); ?>
178 178
         <tr>
179 179
             <th valign="top" scope="row">
180
-                <label for="wpinv_discount_amount"><?php _e( 'Amount', 'invoicing' ); ?></label>
180
+                <label for="wpinv_discount_amount"><?php _e('Amount', 'invoicing'); ?></label>
181 181
             </th>
182 182
             <td>
183
-                <input type="text" name="amount" id="wpinv_discount_amount" class="wpi-field-price wpi-price" value="<?php echo esc_attr( wpinv_get_discount_amount( $discount_id ) ); ?>" required> <font class="wpi-discount-p">%</font><font class="wpi-discount-f" style="display:none;"><?php echo wpinv_currency_symbol() ;?></font>
184
-                <p style="display:none;" class="description"><?php _e( 'Enter the discount amount in USD', 'invoicing' ); ?></p>
185
-                <p class="description"><?php _e( 'Enter the discount value. Ex: 10', 'invoicing' ); ?></p>
183
+                <input type="text" name="amount" id="wpinv_discount_amount" class="wpi-field-price wpi-price" value="<?php echo esc_attr(wpinv_get_discount_amount($discount_id)); ?>" required> <font class="wpi-discount-p">%</font><font class="wpi-discount-f" style="display:none;"><?php echo wpinv_currency_symbol(); ?></font>
184
+                <p style="display:none;" class="description"><?php _e('Enter the discount amount in USD', 'invoicing'); ?></p>
185
+                <p class="description"><?php _e('Enter the discount value. Ex: 10', 'invoicing'); ?></p>
186 186
             </td>
187 187
         </tr>
188
-        <?php do_action( 'wpinv_discount_form_before_items', $post ); ?>
188
+        <?php do_action('wpinv_discount_form_before_items', $post); ?>
189 189
         <tr>
190 190
             <th valign="top" scope="row">
191
-                <label for="wpinv_discount_items"><?php _e( 'Items', 'invoicing' ); ?></label>
191
+                <label for="wpinv_discount_items"><?php _e('Items', 'invoicing'); ?></label>
192 192
             </th>
193 193
             <td>
194
-                <p><?php echo wpinv_item_dropdown( array(
194
+                <p><?php echo wpinv_item_dropdown(array(
195 195
                         'name'              => 'items[]',
196 196
                         'id'                => 'items',
197 197
                         'selected'          => $item_reqs,
198 198
                         'multiple'          => true,
199 199
                         'chosen'            => true,
200 200
                         'class'             => 'medium-text',
201
-                        'placeholder'       => __( 'Select one or more Items', 'invoicing' ),
201
+                        'placeholder'       => __('Select one or more Items', 'invoicing'),
202 202
                         'show_recurring'    => true,
203
-                    ) ); ?>
203
+                    )); ?>
204 204
                 </p>
205
-                <p class="description"><?php _e( 'Items which need to be in the cart to use this discount or, for "Item Discounts", which items are discounted. If left blank, this discount can be used on any item.', 'invoicing' ); ?></p>
205
+                <p class="description"><?php _e('Items which need to be in the cart to use this discount or, for "Item Discounts", which items are discounted. If left blank, this discount can be used on any item.', 'invoicing'); ?></p>
206 206
             </td>
207 207
         </tr>
208
-        <?php do_action( 'wpinv_discount_form_before_excluded_items', $post ); ?>
208
+        <?php do_action('wpinv_discount_form_before_excluded_items', $post); ?>
209 209
         <tr>
210 210
             <th valign="top" scope="row">
211
-                <label for="wpinv_discount_excluded_items"><?php _e( 'Excluded Items', 'invoicing' ); ?></label>
211
+                <label for="wpinv_discount_excluded_items"><?php _e('Excluded Items', 'invoicing'); ?></label>
212 212
             </th>
213 213
             <td>
214
-                <p><?php echo wpinv_item_dropdown( array(
214
+                <p><?php echo wpinv_item_dropdown(array(
215 215
                         'name'              => 'excluded_items[]',
216 216
                         'id'                => 'excluded_items',
217 217
                         'selected'          => $excluded_items,
218 218
                         'multiple'          => true,
219 219
                         'chosen'            => true,
220 220
                         'class'             => 'medium-text',
221
-                        'placeholder'       => __( 'Select one or more Items', 'invoicing' ),
221
+                        'placeholder'       => __('Select one or more Items', 'invoicing'),
222 222
                         'show_recurring'    => true,
223
-                    ) ); ?>
223
+                    )); ?>
224 224
                 </p>
225
-                <p class="description"><?php _e( 'Items which are NOT allowed to use this discount.', 'invoicing' ); ?></p>
225
+                <p class="description"><?php _e('Items which are NOT allowed to use this discount.', 'invoicing'); ?></p>
226 226
             </td>
227 227
         </tr>
228
-        <?php do_action( 'wpinv_discount_form_before_start', $post ); ?>
228
+        <?php do_action('wpinv_discount_form_before_start', $post); ?>
229 229
         <tr>
230 230
             <th valign="top" scope="row">
231
-                <label for="wpinv_discount_start"><?php _e( 'Start Date', 'invoicing' ); ?></label>
231
+                <label for="wpinv_discount_start"><?php _e('Start Date', 'invoicing'); ?></label>
232 232
             </th>
233 233
             <td>
234
-                <input type="text" class="medium-text wpiDatepicker" id="wpinv_discount_start" data-dateFormat="yy-mm-dd" name="start" value="<?php echo esc_attr( wpinv_get_discount_start_date( $discount_id ) ); ?>">
235
-                <p class="description"><?php _e( 'Enter the start date for this discount code in the format of yyyy-mm-dd. For no start date, leave blank. If entered, the discount can only be used after or on this date.', 'invoicing' ); ?></p>
234
+                <input type="text" class="medium-text wpiDatepicker" id="wpinv_discount_start" data-dateFormat="yy-mm-dd" name="start" value="<?php echo esc_attr(wpinv_get_discount_start_date($discount_id)); ?>">
235
+                <p class="description"><?php _e('Enter the start date for this discount code in the format of yyyy-mm-dd. For no start date, leave blank. If entered, the discount can only be used after or on this date.', 'invoicing'); ?></p>
236 236
             </td>
237 237
         </tr>
238
-        <?php do_action( 'wpinv_discount_form_before_expiration', $post ); ?>
238
+        <?php do_action('wpinv_discount_form_before_expiration', $post); ?>
239 239
         <tr>
240 240
             <th valign="top" scope="row">
241
-                <label for="wpinv_discount_expiration"><?php _e( 'Expiration Date', 'invoicing' ); ?></label>
241
+                <label for="wpinv_discount_expiration"><?php _e('Expiration Date', 'invoicing'); ?></label>
242 242
             </th>
243 243
             <td>
244
-                <input type="text" class="medium-text wpiDatepicker" id="wpinv_discount_expiration" data-dateFormat="yy-mm-dd" name="expiration" value="<?php echo esc_attr( wpinv_get_discount_expiration( $discount_id ) ); ?>">
245
-                <p class="description"><?php _e( 'Enter the expiration date for this discount code in the format of yyyy-mm-dd. Leave blank for no expiration.', 'invoicing' ); ?></p>
244
+                <input type="text" class="medium-text wpiDatepicker" id="wpinv_discount_expiration" data-dateFormat="yy-mm-dd" name="expiration" value="<?php echo esc_attr(wpinv_get_discount_expiration($discount_id)); ?>">
245
+                <p class="description"><?php _e('Enter the expiration date for this discount code in the format of yyyy-mm-dd. Leave blank for no expiration.', 'invoicing'); ?></p>
246 246
             </td>
247 247
         </tr>
248
-        <?php do_action( 'wpinv_discount_form_before_min_total', $post ); ?>
248
+        <?php do_action('wpinv_discount_form_before_min_total', $post); ?>
249 249
         <tr>
250 250
             <th valign="top" scope="row">
251
-                <label for="wpinv_discount_min_total"><?php _e( 'Minimum Amount', 'invoicing' ); ?></label>
251
+                <label for="wpinv_discount_min_total"><?php _e('Minimum Amount', 'invoicing'); ?></label>
252 252
             </th>
253 253
             <td>
254 254
                 <input type="text" name="min_total" id="wpinv_discount_min_total" class="wpi-field-price wpi-price" value="<?php echo $min_total; ?>">
255
-                <p class="description"><?php _e( 'This allows you to set the minimum amount (subtotal, including taxes) allowed when using the discount.', 'invoicing' ); ?></p>
255
+                <p class="description"><?php _e('This allows you to set the minimum amount (subtotal, including taxes) allowed when using the discount.', 'invoicing'); ?></p>
256 256
             </td>
257 257
         </tr>
258
-        <?php do_action( 'wpinv_discount_form_before_max_total', $post ); ?>
258
+        <?php do_action('wpinv_discount_form_before_max_total', $post); ?>
259 259
         <tr>
260 260
             <th valign="top" scope="row">
261
-                <label for="wpinv_discount_max_total"><?php _e( 'Maximum Amount', 'invoicing' ); ?></label>
261
+                <label for="wpinv_discount_max_total"><?php _e('Maximum Amount', 'invoicing'); ?></label>
262 262
             </th>
263 263
             <td>
264 264
                 <input type="text" name="max_total" id="wpinv_discount_max_total" class="wpi-field-price wpi-price" value="<?php echo $max_total; ?>">
265
-                <p class="description"><?php _e( 'This allows you to set the maximum amount (subtotal, including taxes) allowed when using the discount.', 'invoicing' ); ?></p>
265
+                <p class="description"><?php _e('This allows you to set the maximum amount (subtotal, including taxes) allowed when using the discount.', 'invoicing'); ?></p>
266 266
             </td>
267 267
         </tr>
268
-        <?php do_action( 'wpinv_discount_form_before_recurring', $post ); ?>
268
+        <?php do_action('wpinv_discount_form_before_recurring', $post); ?>
269 269
         <tr>
270 270
             <th valign="top" scope="row">
271
-                <label for="wpinv_discount_recurring"><?php _e( 'For recurring apply to', 'invoicing' ); ?></label>
271
+                <label for="wpinv_discount_recurring"><?php _e('For recurring apply to', 'invoicing'); ?></label>
272 272
             </th>
273 273
             <td>
274 274
                 <select id="wpinv_discount_recurring" name="recurring" class="medium-text">
275
-                    <option value="0" <?php selected( false, $recurring ); ?>><?php _e( 'All payments', 'invoicing' ); ?></option>
276
-                    <option value="1" <?php selected( true, $recurring ); ?>><?php _e( 'First payment only', 'invoicing' ); ?></option>
275
+                    <option value="0" <?php selected(false, $recurring); ?>><?php _e('All payments', 'invoicing'); ?></option>
276
+                    <option value="1" <?php selected(true, $recurring); ?>><?php _e('First payment only', 'invoicing'); ?></option>
277 277
                 </select>
278
-                <p class="description"><?php _e( '<b>All payments:</b> Apply this discount to all recurring payments of the recurring invoice. <br><b>First payment only:</b> Apply this discount to only first payment of the recurring invoice.', 'invoicing' ); ?></p>
278
+                <p class="description"><?php _e('<b>All payments:</b> Apply this discount to all recurring payments of the recurring invoice. <br><b>First payment only:</b> Apply this discount to only first payment of the recurring invoice.', 'invoicing'); ?></p>
279 279
             </td>
280 280
         </tr>
281
-        <?php do_action( 'wpinv_discount_form_before_max_uses', $post ); ?>
281
+        <?php do_action('wpinv_discount_form_before_max_uses', $post); ?>
282 282
         <tr>
283 283
             <th valign="top" scope="row">
284
-                <label for="wpinv_discount_max_uses"><?php _e( 'Max Uses', 'invoicing' ); ?></label>
284
+                <label for="wpinv_discount_max_uses"><?php _e('Max Uses', 'invoicing'); ?></label>
285 285
             </th>
286 286
             <td>
287 287
                 <input type="number" min="0" step="1" id="wpinv_discount_max_uses" name="max_uses" class="medium-text" value="<?php echo $max_uses; ?>">
288
-                <p class="description"><?php _e( 'The maximum number of times this discount can be used. Leave blank for unlimited.', 'invoicing' ); ?></p>
288
+                <p class="description"><?php _e('The maximum number of times this discount can be used. Leave blank for unlimited.', 'invoicing'); ?></p>
289 289
             </td>
290 290
         </tr>
291
-        <?php do_action( 'wpinv_discount_form_before_single_use', $post ); ?>
291
+        <?php do_action('wpinv_discount_form_before_single_use', $post); ?>
292 292
         <tr>
293 293
             <th valign="top" scope="row">
294
-                <label for="wpinv_discount_single_use"><?php _e( 'Use Once Per User', 'invoicing' ); ?></label>
294
+                <label for="wpinv_discount_single_use"><?php _e('Use Once Per User', 'invoicing'); ?></label>
295 295
             </th>
296 296
             <td>
297
-                <input type="checkbox" value="1" name="single_use" id="wpinv_discount_single_use" <?php checked( true, $single_use ); ?>>
298
-                <span class="description"><?php _e( 'Limit this discount to a single use per user?', 'invoicing' ); ?></span>
297
+                <input type="checkbox" value="1" name="single_use" id="wpinv_discount_single_use" <?php checked(true, $single_use); ?>>
298
+                <span class="description"><?php _e('Limit this discount to a single use per user?', 'invoicing'); ?></span>
299 299
             </td>
300 300
         </tr>
301
-        <?php do_action( 'wpinv_discount_form_last', $post ); ?>
301
+        <?php do_action('wpinv_discount_form_last', $post); ?>
302 302
     </tbody>
303 303
 </table>
304
-<?php do_action( 'wpinv_discount_form_bottom', $post ); ?>
304
+<?php do_action('wpinv_discount_form_bottom', $post); ?>
305 305
     <?php
306 306
 }
307 307
 
308
-function wpinv_discount_metabox_save( $post_id, $post, $update = false ) {
309
-    $post_type = !empty( $post ) ? $post->post_type : '';
308
+function wpinv_discount_metabox_save($post_id, $post, $update = false) {
309
+    $post_type = !empty($post) ? $post->post_type : '';
310 310
     
311
-    if ( $post_type != 'wpi_discount' ) {
311
+    if ($post_type != 'wpi_discount') {
312 312
         return;
313 313
     }
314 314
     
315
-    if ( !isset( $_POST['wpinv_discount_metabox_nonce'] ) || ( isset( $_POST['wpinv_discount_metabox_nonce'] ) && !wp_verify_nonce( $_POST['wpinv_discount_metabox_nonce'], 'wpinv_discount_metabox_nonce' ) ) ) {
315
+    if (!isset($_POST['wpinv_discount_metabox_nonce']) || (isset($_POST['wpinv_discount_metabox_nonce']) && !wp_verify_nonce($_POST['wpinv_discount_metabox_nonce'], 'wpinv_discount_metabox_nonce'))) {
316 316
         return;
317 317
     }
318 318
     
319
-    if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ( defined( 'DOING_AJAX') && DOING_AJAX ) || isset( $_REQUEST['bulk_edit'] ) ) {
319
+    if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || (defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit'])) {
320 320
         return;
321 321
     }
322 322
     
323
-    if ( !current_user_can( 'manage_options', $post_id ) ) {
323
+    if (!current_user_can('manage_options', $post_id)) {
324 324
         return;
325 325
     }
326 326
     
327
-    return wpinv_store_discount( $post_id, $_POST, $post, $update );
327
+    return wpinv_store_discount($post_id, $_POST, $post, $update);
328 328
 }
329
-add_action( 'save_post', 'wpinv_discount_metabox_save', 10, 3 );
330 329
\ No newline at end of file
330
+add_action('save_post', 'wpinv_discount_metabox_save', 10, 3);
331 331
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-mb-invoice-details.php 1 patch
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -1,30 +1,30 @@  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
         $currency_symbol    = wpinv_currency_symbol();
10 10
         $statuses           = wpinv_get_invoice_statuses();
11 11
         
12
-        $post_id            = !empty( $post->ID ) ? $post->ID : 0;
13
-        $invoice            = new WPInv_Invoice( $post_id );
12
+        $post_id            = !empty($post->ID) ? $post->ID : 0;
13
+        $invoice            = new WPInv_Invoice($post_id);
14 14
         
15
-        $status             = $invoice->get_status( false ); // Current status    
15
+        $status             = $invoice->get_status(false); // Current status    
16 16
         $discount           = $invoice->get_discount();
17 17
         $discount_code      = $discount > 0 ? $invoice->get_discount_code() : '';
18 18
         $invoice_number     = $invoice->get_number();
19 19
         
20 20
         $date_created       = $invoice->get_created_date();
21
-        $datetime_created   = strtotime( $date_created );
22
-        $date_created       = $date_created != '' && $date_created != '0000-00-00 00:00:00' ? date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $datetime_created ) : '';
21
+        $datetime_created   = strtotime($date_created);
22
+        $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 23
         $date_completed     = $invoice->get_completed_date();
24
-        $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';
25
-        $title['status'] = __( 'Invoice Status:', 'invoicing' );
26
-        $title['number'] = __( 'Invoice Number:', 'invoicing' );
27
-        $mail_notice = esc_attr__( 'After saving invoice, this will send a copy of the invoice to the user&#8217;s email address.', 'invoicing' );
24
+        $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';
25
+        $title['status'] = __('Invoice Status:', 'invoicing');
26
+        $title['number'] = __('Invoice Number:', 'invoicing');
27
+        $mail_notice = esc_attr__('After saving invoice, this will send a copy of the invoice to the user&#8217;s email address.', 'invoicing');
28 28
         
29 29
         $title = apply_filters('wpinv_details_metabox_titles', $title, $invoice);
30 30
         $statuses = apply_filters('wpinv_invoice_statuses', $statuses, $invoice);
@@ -34,29 +34,29 @@  discard block
 block discarded – undo
34 34
 <div class="gdmbx2-wrap form-table">
35 35
     <div class="gdmbx2-metabox gdmbx-field-list" id="gdmbx2-metabox-wpinv_details">
36 36
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-created">
37
-            <div class="gdmbx-th"><label><?php _e( 'Date Created:', 'invoicing' );?></label></div>
38
-            <div class="gdmbx-td"><?php echo $date_created;?></div>
37
+            <div class="gdmbx-th"><label><?php _e('Date Created:', 'invoicing'); ?></label></div>
38
+            <div class="gdmbx-td"><?php echo $date_created; ?></div>
39 39
         </div>
40
-        <?php if ( $invoice->post_type == 'wpi_invoice' && wpinv_get_option( 'overdue_active' ) && ( $invoice->needs_payment() || $invoice->has_status( array( 'auto-draft' ) ) ) ) { ?>
40
+        <?php if ($invoice->post_type == 'wpi_invoice' && wpinv_get_option('overdue_active') && ($invoice->needs_payment() || $invoice->has_status(array('auto-draft')))) { ?>
41 41
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-overdue">
42
-            <div class="gdmbx-th"><label for="wpinv_due_date"><?php _e( 'Due Date:', 'invoicing' );?></label></div>
42
+            <div class="gdmbx-th"><label for="wpinv_due_date"><?php _e('Due Date:', 'invoicing'); ?></label></div>
43 43
             <div class="gdmbx-td">
44
-                <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">
44
+                <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">
45 45
             </div>
46 46
         </div>
47 47
         <?php } ?>
48
-        <?php if ( $date_completed && $date_completed != 'n/a' ) { ?>
48
+        <?php if ($date_completed && $date_completed != 'n/a') { ?>
49 49
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-completed">
50
-            <div class="gdmbx-th"><label><?php _e( 'Payment Date:', 'invoicing' );?></label></div>
51
-            <div class="gdmbx-td"><?php echo $date_completed;?></div>
50
+            <div class="gdmbx-th"><label><?php _e('Payment Date:', 'invoicing'); ?></label></div>
51
+            <div class="gdmbx-td"><?php echo $date_completed; ?></div>
52 52
         </div>
53 53
         <?php } ?>
54 54
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-status">
55 55
             <div class="gdmbx-th"><label for="wpinv_status"><?php echo $title['status']; ?></label></div>
56 56
             <div class="gdmbx-td">
57 57
                 <select required="required" id="wpinv_status" name="wpinv_status" class="gdmbx2_select">
58
-                    <?php foreach ( $statuses as $value => $label ) { ?>
59
-                    <option value="<?php echo $value;?>" <?php selected( $status, $value );?>><?php echo $label;?></option>
58
+                    <?php foreach ($statuses as $value => $label) { ?>
59
+                    <option value="<?php echo $value; ?>" <?php selected($status, $value); ?>><?php echo $label; ?></option>
60 60
                     <?php } ?>
61 61
                 </select>
62 62
             </div>
@@ -64,107 +64,107 @@  discard block
 block discarded – undo
64 64
         <div class="gdmbx-row gdmbx-type-text gdmbx2-id-wpinv-number table-layout">
65 65
             <div class="gdmbx-th"><label for="wpinv_number"><?php echo $title['number']; ?></label></div>
66 66
             <div class="gdmbx-td">
67
-                <input type="text" value="<?php echo esc_attr( $invoice_number );?>" id="wpinv_number" name="wpinv_number" class="regular-text" readonly>
67
+                <input type="text" value="<?php echo esc_attr($invoice_number); ?>" id="wpinv_number" name="wpinv_number" class="regular-text" readonly>
68 68
             </div>
69 69
         </div>
70
-        <?php do_action( 'wpinv_meta_box_details_inner', $post_id ); ?>
71
-        <?php if ( !( $is_paid = ( $invoice->is_paid() || $invoice->is_refunded() ) ) || $discount_code ) { ?>
70
+        <?php do_action('wpinv_meta_box_details_inner', $post_id); ?>
71
+        <?php if (!($is_paid = ($invoice->is_paid() || $invoice->is_refunded())) || $discount_code) { ?>
72 72
         <div class="gdmbx-row gdmbx-type-text gdmbx2-id-wpinv-discount-code table-layout">
73
-            <div class="gdmbx-th"><label for="wpinv_discount_code"><?php _e( 'Discount Code:', 'invoicing' );?></label></div>
73
+            <div class="gdmbx-th"><label for="wpinv_discount_code"><?php _e('Discount Code:', 'invoicing'); ?></label></div>
74 74
             <div class="gdmbx-td">
75
-                <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 ) { ?><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 } ?>
75
+                <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) { ?><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 } ?>
76 76
             </div>
77 77
         </div>
78 78
         <?php } ?>
79 79
     </div>
80 80
 </div>
81 81
 <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-save-send table-layout">
82
-    <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>
82
+    <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>
83 83
         <select id="wpi_save_send" name="wpi_save_send">
84
-            <option value="1"><?php _e( 'Yes', 'invoicing' ); ?></option>
85
-            <option value="" selected="selected"><?php _e( 'No', 'invoicing' ); ?></option>
84
+            <option value="1"><?php _e('Yes', 'invoicing'); ?></option>
85
+            <option value="" selected="selected"><?php _e('No', 'invoicing'); ?></option>
86 86
         </select>
87 87
     </p>
88 88
     <p class="wpi-meta-row wpi-send-info"><?php echo $mail_notice; ?></p>
89 89
 </div>
90
-<?php wp_nonce_field( 'wpinv_details', 'wpinv_details_nonce' ) ;?>
90
+<?php wp_nonce_field('wpinv_details', 'wpinv_details_nonce'); ?>
91 91
         <?php
92 92
     }
93 93
     
94
-    public static function resend_invoice( $post ) {
94
+    public static function resend_invoice($post) {
95 95
         global $wpi_mb_invoice;
96 96
         
97
-        if ( empty( $wpi_mb_invoice ) ) {
97
+        if (empty($wpi_mb_invoice)) {
98 98
             return;
99 99
         }
100 100
         
101 101
         $text = array(
102
-            'message'       => esc_attr__( 'This will send a copy of the invoice to the customer&#8217;s email address.', 'invoicing' ),
103
-            'button_text'   =>  __( 'Resend Invoice', 'invoicing' ),
102
+            'message'       => esc_attr__('This will send a copy of the invoice to the customer&#8217;s email address.', 'invoicing'),
103
+            'button_text'   =>  __('Resend Invoice', 'invoicing'),
104 104
         );
105 105
             
106 106
         $text = apply_filters('wpinv_resend_invoice_metabox_text', $text);
107
-        do_action( 'wpinv_metabox_resend_invoice_before', $wpi_mb_invoice );
107
+        do_action('wpinv_metabox_resend_invoice_before', $wpi_mb_invoice);
108 108
         
109
-        if ( $email = $wpi_mb_invoice->get_email() ) {
109
+        if ($email = $wpi_mb_invoice->get_email()) {
110 110
             $email_actions = array();
111
-            $email_actions['email_url']      = add_query_arg( array( 'wpi_action' => 'send_invoice', 'invoice_id' => $post->ID ) );
112
-            $email_actions['reminder_url']   = add_query_arg( array( 'wpi_action' => 'send_reminder', 'invoice_id' => $post->ID ) );
111
+            $email_actions['email_url']      = add_query_arg(array('wpi_action' => 'send_invoice', 'invoice_id' => $post->ID));
112
+            $email_actions['reminder_url']   = add_query_arg(array('wpi_action' => 'send_reminder', 'invoice_id' => $post->ID));
113 113
             
114
-            $email_actions = apply_filters('wpinv_resend_invoice_email_actions', $email_actions );
114
+            $email_actions = apply_filters('wpinv_resend_invoice_email_actions', $email_actions);
115 115
         ?>
116 116
         <p class="wpi-meta-row wpi-resend-info"><?php echo $text['message']; ?></p>
117
-        <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>
118
-        <?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() ) ) { ?>
119
-        <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>
117
+        <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>
118
+        <?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())) { ?>
119
+        <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>
120 120
         <?php } ?>
121 121
         <?php
122 122
         }
123 123
         
124
-        do_action( 'wpinv_metabox_resend_invoice_after', $wpi_mb_invoice );
124
+        do_action('wpinv_metabox_resend_invoice_after', $wpi_mb_invoice);
125 125
     }
126 126
     
127
-    public static function subscriptions( $post ) {
127
+    public static function subscriptions($post) {
128 128
         global $wpi_mb_invoice;
129 129
         
130 130
         $invoice = $wpi_mb_invoice;
131 131
         
132
-        if ( !empty( $invoice ) && $invoice->is_recurring() && $invoice->is_parent() ) {
132
+        if (!empty($invoice) && $invoice->is_recurring() && $invoice->is_parent()) {
133 133
             $payments       = $invoice->get_child_payments();
134 134
             
135 135
             $total_payments = (int)$invoice->get_total_payments();
136 136
             $subscription   = $invoice->get_subscription_data();
137 137
 
138
-            $billing_cycle  = wpinv_get_billing_cycle( $subscription['initial_amount'], $subscription['recurring_amount'], $subscription['period'], $subscription['interval'], $subscription['bill_times'], $subscription['trial_period'], $subscription['trial_interval'], $invoice->get_currency() );
139
-            $times_billed   = $total_payments . ' / ' . ( ( (int)$subscription['bill_times'] == 0 ) ? __( 'Until cancelled', 'invoicing' ) : $subscription['bill_times'] );
138
+            $billing_cycle  = wpinv_get_billing_cycle($subscription['initial_amount'], $subscription['recurring_amount'], $subscription['period'], $subscription['interval'], $subscription['bill_times'], $subscription['trial_period'], $subscription['trial_interval'], $invoice->get_currency());
139
+            $times_billed   = $total_payments . ' / ' . (((int)$subscription['bill_times'] == 0) ? __('Until cancelled', 'invoicing') : $subscription['bill_times']);
140 140
             $subscription_status = $invoice->get_subscription_status();
141 141
             ?>
142
-            <p class="wpi-meta-row wpi-sub-label"><?php _e( 'Recurring Payment', 'invoicing' );?></p>
143
-            <?php if ( $subscription_id = $invoice->get_subscription_id() ) { ?>
144
-            <p class="wpi-meta-row wpi-sub-id"><label><?php _e( 'Subscription ID:', 'invoicing' );?> </label><?php echo $subscription_id; ?></p>
142
+            <p class="wpi-meta-row wpi-sub-label"><?php _e('Recurring Payment', 'invoicing'); ?></p>
143
+            <?php if ($subscription_id = $invoice->get_subscription_id()) { ?>
144
+            <p class="wpi-meta-row wpi-sub-id"><label><?php _e('Subscription ID:', 'invoicing'); ?> </label><?php echo $subscription_id; ?></p>
145 145
             <?php } ?>
146
-            <p class="wpi-meta-row wpi-bill-cycle"><label><?php _e( 'Billing Cycle:', 'invoicing' );?> </label><?php echo $billing_cycle; ?></p>
147
-            <p class="wpi-meta-row wpi-billed-times"><label><?php _e( 'Times Billed:', 'invoicing' );?> </label><?php echo $times_billed; ?></p>
148
-            <?php if ( !empty( $payments ) || ( $invoice->is_paid() || $invoice->is_refunded() ) ) { ?>
149
-                <p class="wpi-meta-row wpi-start-date"><label><?php _e( 'Start Date:', 'invoicing' );?> </label><?php echo $invoice->get_subscription_start(); ?></p>
150
-                <p class="wpi-meta-row wpi-end-date"><label><?php _e( 'Expiration Date:', 'invoicing' );?> </label><?php echo $invoice->get_subscription_end(); ?></p>
151
-                <?php if ( $status_label = $invoice->get_subscription_status_label( $subscription_status ) ) { ?>
152
-                <p class="wpi-meta-row wpi-sub-status"><label><?php _e( 'Subscription Status:', 'invoicing' );?> </label><?php echo $status_label; ?></p>
146
+            <p class="wpi-meta-row wpi-bill-cycle"><label><?php _e('Billing Cycle:', 'invoicing'); ?> </label><?php echo $billing_cycle; ?></p>
147
+            <p class="wpi-meta-row wpi-billed-times"><label><?php _e('Times Billed:', 'invoicing'); ?> </label><?php echo $times_billed; ?></p>
148
+            <?php if (!empty($payments) || ($invoice->is_paid() || $invoice->is_refunded())) { ?>
149
+                <p class="wpi-meta-row wpi-start-date"><label><?php _e('Start Date:', 'invoicing'); ?> </label><?php echo $invoice->get_subscription_start(); ?></p>
150
+                <p class="wpi-meta-row wpi-end-date"><label><?php _e('Expiration Date:', 'invoicing'); ?> </label><?php echo $invoice->get_subscription_end(); ?></p>
151
+                <?php if ($status_label = $invoice->get_subscription_status_label($subscription_status)) { ?>
152
+                <p class="wpi-meta-row wpi-sub-status"><label><?php _e('Subscription Status:', 'invoicing'); ?> </label><?php echo $status_label; ?></p>
153 153
                 <?php } ?>
154
-                <?php if ( $subscription_status == 'trialing' && $trial_end_date = $invoice->get_trial_end_date() ) { ?>
155
-                <p class="wpi-meta-row wpi-trial-date"><label><?php _e( 'Trial Until:', 'invoicing' );?> </label><?php echo $trial_end_date; ?></p>
154
+                <?php if ($subscription_status == 'trialing' && $trial_end_date = $invoice->get_trial_end_date()) { ?>
155
+                <p class="wpi-meta-row wpi-trial-date"><label><?php _e('Trial Until:', 'invoicing'); ?> </label><?php echo $trial_end_date; ?></p>
156 156
                 <?php } ?>
157
-                <?php if ( $cancelled_date = $invoice->get_cancelled_date() ) { ?>
158
-                <p class="wpi-meta-row wpi-cancel-date"><label><?php _e( 'Cancelled On:', 'invoicing' );?> </label><?php echo $cancelled_date; ?></p>
157
+                <?php if ($cancelled_date = $invoice->get_cancelled_date()) { ?>
158
+                <p class="wpi-meta-row wpi-cancel-date"><label><?php _e('Cancelled On:', 'invoicing'); ?> </label><?php echo $cancelled_date; ?></p>
159 159
                 <?php } ?>
160
-                <?php if ( !empty( $payments ) ) { ?>
161
-                <p><strong><?php _e( 'Renewal Payments:', 'invoicing' ); ?></strong></p>
160
+                <?php if (!empty($payments)) { ?>
161
+                <p><strong><?php _e('Renewal Payments:', 'invoicing'); ?></strong></p>
162 162
                 <ul id="wpi-sub-payments">
163
-                <?php foreach ( $payments as $invoice_id ) { ?>
163
+                <?php foreach ($payments as $invoice_id) { ?>
164 164
                     <li>
165
-                        <a href="<?php echo esc_url( get_edit_post_link( $invoice_id ) ); ?>"><?php echo wpinv_get_invoice_number( $invoice_id ); ?></a>&nbsp;&ndash;&nbsp;
166
-                        <span><?php echo wpinv_get_invoice_date( $invoice_id ); ?>&nbsp;&ndash;&nbsp;</span>
167
-                        <span><?php echo wpinv_payment_total( $invoice_id, true ); ?></span>
165
+                        <a href="<?php echo esc_url(get_edit_post_link($invoice_id)); ?>"><?php echo wpinv_get_invoice_number($invoice_id); ?></a>&nbsp;&ndash;&nbsp;
166
+                        <span><?php echo wpinv_get_invoice_date($invoice_id); ?>&nbsp;&ndash;&nbsp;</span>
167
+                        <span><?php echo wpinv_payment_total($invoice_id, true); ?></span>
168 168
                     </li>
169 169
                 <?php } ?>
170 170
                 </ul>
@@ -172,49 +172,49 @@  discard block
 block discarded – undo
172 172
         }
173 173
     }
174 174
     
175
-    public static function renewals( $post ) {
175
+    public static function renewals($post) {
176 176
         global $wpi_mb_invoice;
177 177
         
178
-        if ( wpinv_is_subscription_payment( $wpi_mb_invoice ) ) {
179
-            $parent_url = get_edit_post_link( $wpi_mb_invoice->parent_invoice );
180
-            $parent_id  = wpinv_get_invoice_number( $wpi_mb_invoice->parent_invoice );
178
+        if (wpinv_is_subscription_payment($wpi_mb_invoice)) {
179
+            $parent_url = get_edit_post_link($wpi_mb_invoice->parent_invoice);
180
+            $parent_id  = wpinv_get_invoice_number($wpi_mb_invoice->parent_invoice);
181 181
         ?>
182
-        <p class="wpi-meta-row wpi-sub-id"><label><?php _e( 'Subscription ID:', 'invoicing' );?> </label><?php echo $wpi_mb_invoice->get_subscription_id(); ?></p>
183
-        <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>
182
+        <p class="wpi-meta-row wpi-sub-id"><label><?php _e('Subscription ID:', 'invoicing'); ?> </label><?php echo $wpi_mb_invoice->get_subscription_id(); ?></p>
183
+        <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>
184 184
         <?php
185 185
         }
186 186
     }
187 187
     
188
-    public static function payment_meta( $post ) {
188
+    public static function payment_meta($post) {
189 189
         global $wpi_mb_invoice;
190 190
 
191
-        $set_dateway = empty( $wpi_mb_invoice->gateway ) ? true : false;
192
-        if ( !$set_dateway && !$wpi_mb_invoice->get_meta( '_wpinv_checkout', true ) && !$wpi_mb_invoice->is_paid() && !$wpi_mb_invoice->is_refunded() ) {
191
+        $set_dateway = empty($wpi_mb_invoice->gateway) ? true : false;
192
+        if (!$set_dateway && !$wpi_mb_invoice->get_meta('_wpinv_checkout', true) && !$wpi_mb_invoice->is_paid() && !$wpi_mb_invoice->is_refunded()) {
193 193
             $set_dateway = true;
194 194
         }
195 195
         
196 196
         ?>
197 197
         <p class="wpi-meta-row">
198
-        <?php if ( $set_dateway ) { $gateways = wpinv_get_enabled_payment_gateways( true ); ?>
199
-            <label for="wpinv_gateway"><?php _e( 'Gateway:', 'invoicing' ) ; ?></label>
198
+        <?php if ($set_dateway) { $gateways = wpinv_get_enabled_payment_gateways(true); ?>
199
+            <label for="wpinv_gateway"><?php _e('Gateway:', 'invoicing'); ?></label>
200 200
             <select required="required" id="wpinv_gateway" name="wpinv_gateway">
201
-                <?php foreach ( $gateways as $name => $gateway ) {
202
-                    if ( $wpi_mb_invoice->is_recurring() && !wpinv_gateway_support_subscription( $name ) ) {
201
+                <?php foreach ($gateways as $name => $gateway) {
202
+                    if ($wpi_mb_invoice->is_recurring() && !wpinv_gateway_support_subscription($name)) {
203 203
                         continue;
204 204
                     }
205 205
                     ?>
206
-                <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>
206
+                <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>
207 207
                 <?php } ?>
208 208
             </select>
209 209
         <?php } else { 
210
-            echo wp_sprintf( __( '<label>Gateway:</label> %s', 'invoicing' ), wpinv_get_gateway_checkout_label( $wpi_mb_invoice->gateway ) );
210
+            echo wp_sprintf(__('<label>Gateway:</label> %s', 'invoicing'), wpinv_get_gateway_checkout_label($wpi_mb_invoice->gateway));
211 211
         } ?>
212 212
         </p>
213
-        <?php if ( $key = $wpi_mb_invoice->get_key() ) { ?>
214
-        <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Key:</label> %s', 'invoicing' ), $key ); ?></p>
213
+        <?php if ($key = $wpi_mb_invoice->get_key()) { ?>
214
+        <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Key:</label> %s', 'invoicing'), $key); ?></p>
215 215
         <?php } ?>
216
-        <?php if ( $wpi_mb_invoice->is_paid() || $wpi_mb_invoice->is_refunded() ) { ?>
217
-        <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Transaction ID:</label> %s', 'invoicing' ), wpinv_payment_link_transaction_id( $wpi_mb_invoice ) ); ?></p>
216
+        <?php if ($wpi_mb_invoice->is_paid() || $wpi_mb_invoice->is_refunded()) { ?>
217
+        <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Transaction ID:</label> %s', 'invoicing'), wpinv_payment_link_transaction_id($wpi_mb_invoice)); ?></p>
218 218
         <?php } ?>
219 219
         <?php
220 220
     }
Please login to merge, or discard this patch.
includes/class-wpinv-cache-helper.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
     exit; // Exit if accessed directly
4 4
 }
5 5
 
@@ -14,17 +14,17 @@  discard block
 block discarded – undo
14 14
      * Hook in methods.
15 15
      */
16 16
     public static function init() {
17
-        add_action( 'init', array( __CLASS__, 'init_hooks' ), 0 );
18
-        add_action( 'admin_notices', array( __CLASS__, 'notices' ) );
17
+        add_action('init', array(__CLASS__, 'init_hooks'), 0);
18
+        add_action('admin_notices', array(__CLASS__, 'notices'));
19 19
     }
20 20
 
21 21
     public static function init_hooks() {
22
-        if ( false === ( $page_uris = get_transient( 'wpinv_cache_excluded_uris' ) ) ) {
23
-            $checkout_page = wpinv_get_option( 'checkout_page', '' );
24
-            $success_page  = wpinv_get_option( 'success_page', '' );
25
-            $failure_page  = wpinv_get_option( 'failure_page', '' );
26
-            $history_page  = wpinv_get_option( 'invoice_history_page', '' );
27
-            if ( empty( $checkout_page ) || empty( $success_page ) || empty( $failure_page ) || empty( $history_page ) ) {
22
+        if (false === ($page_uris = get_transient('wpinv_cache_excluded_uris'))) {
23
+            $checkout_page = wpinv_get_option('checkout_page', '');
24
+            $success_page  = wpinv_get_option('success_page', '');
25
+            $failure_page  = wpinv_get_option('failure_page', '');
26
+            $history_page  = wpinv_get_option('invoice_history_page', '');
27
+            if (empty($checkout_page) || empty($success_page) || empty($failure_page) || empty($history_page)) {
28 28
                 return;
29 29
             }
30 30
 
@@ -37,30 +37,30 @@  discard block
 block discarded – undo
37 37
             $page_uris[] = 'p=' . $history_page;
38 38
 
39 39
             // Exclude permalinks
40
-            $checkout_page  = get_post( $checkout_page );
41
-            $success_page   = get_post( $success_page );
42
-            $failure_page   = get_post( $failure_page );
43
-            $history_page   = get_post( $history_page );
40
+            $checkout_page  = get_post($checkout_page);
41
+            $success_page   = get_post($success_page);
42
+            $failure_page   = get_post($failure_page);
43
+            $history_page   = get_post($history_page);
44 44
 
45
-            if ( ! is_null( $checkout_page ) ) {
45
+            if (!is_null($checkout_page)) {
46 46
                 $page_uris[] = '/' . $checkout_page->post_name;
47 47
             }
48
-            if ( ! is_null( $success_page ) ) {
48
+            if (!is_null($success_page)) {
49 49
                 $page_uris[] = '/' . $success_page->post_name;
50 50
             }
51
-            if ( ! is_null( $failure_page ) ) {
51
+            if (!is_null($failure_page)) {
52 52
                 $page_uris[] = '/' . $failure_page->post_name;
53 53
             }
54
-            if ( ! is_null( $history_page ) ) {
54
+            if (!is_null($history_page)) {
55 55
                 $page_uris[] = '/' . $history_page->post_name;
56 56
             }
57 57
 
58
-            set_transient( 'wpinv_cache_excluded_uris', $page_uris );
58
+            set_transient('wpinv_cache_excluded_uris', $page_uris);
59 59
         }
60 60
 
61
-        if ( is_array( $page_uris ) ) {
62
-            foreach( $page_uris as $uri ) {
63
-                if ( strstr( $_SERVER['REQUEST_URI'], $uri ) ) {
61
+        if (is_array($page_uris)) {
62
+            foreach ($page_uris as $uri) {
63
+                if (strstr($_SERVER['REQUEST_URI'], $uri)) {
64 64
                     self::nocache();
65 65
                     break;
66 66
                 }
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
      * @access private
74 74
      */
75 75
     private static function nocache() {
76
-        if ( ! defined( 'DONOTCACHEPAGE' ) ) {
77
-            define( "DONOTCACHEPAGE", true );
76
+        if (!defined('DONOTCACHEPAGE')) {
77
+            define("DONOTCACHEPAGE", true);
78 78
         }
79
-        if ( ! defined( 'DONOTCACHEOBJECT' ) ) {
80
-            define( "DONOTCACHEOBJECT", true );
79
+        if (!defined('DONOTCACHEOBJECT')) {
80
+            define("DONOTCACHEOBJECT", true);
81 81
         }
82
-        if ( ! defined( 'DONOTCACHEDB' ) ) {
83
-            define( "DONOTCACHEDB", true );
82
+        if (!defined('DONOTCACHEDB')) {
83
+            define("DONOTCACHEDB", true);
84 84
         }
85 85
         nocache_headers();
86 86
     }
@@ -89,18 +89,18 @@  discard block
 block discarded – undo
89 89
      * notices function.
90 90
      */
91 91
     public static function notices() {
92
-        if ( ! function_exists( 'w3tc_pgcache_flush' ) || ! function_exists( 'w3_instance' ) ) {
92
+        if (!function_exists('w3tc_pgcache_flush') || !function_exists('w3_instance')) {
93 93
             return;
94 94
         }
95 95
 
96
-        $config   = w3_instance( 'W3_Config' );
97
-        $enabled  = $config->get_integer( 'dbcache.enabled' );
98
-        $settings = array_map( 'trim', $config->get_array( 'dbcache.reject.sql' ) );
96
+        $config   = w3_instance('W3_Config');
97
+        $enabled  = $config->get_integer('dbcache.enabled');
98
+        $settings = array_map('trim', $config->get_array('dbcache.reject.sql'));
99 99
 
100
-        if ( $enabled && ! in_array( '_wp_session_', $settings ) ) {
100
+        if ($enabled && !in_array('_wp_session_', $settings)) {
101 101
             ?>
102 102
             <div class="error">
103
-                <p><?php printf( __( 'In order for <strong>database caching</strong> to work with Invoicing you must add %1$s to the "Ignored Query Strings" option in <a href="%2$s">W3 Total Cache settings</a>.', 'invoicing' ), '<code>_wp_session_</code>', admin_url( 'admin.php?page=w3tc_dbcache' ) ); ?></p>
103
+                <p><?php printf(__('In order for <strong>database caching</strong> to work with Invoicing you must add %1$s to the "Ignored Query Strings" option in <a href="%2$s">W3 Total Cache settings</a>.', 'invoicing'), '<code>_wp_session_</code>', admin_url('admin.php?page=w3tc_dbcache')); ?></p>
104 104
             </div>
105 105
             <?php
106 106
         }
Please login to merge, or discard this patch.
includes/class-wpinv.php 1 patch
Spacing   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
7 7
  */
8 8
  
9 9
 // MUST have WordPress.
10
-if ( !defined( 'WPINC' ) ) {
11
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
10
+if (!defined('WPINC')) {
11
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
12 12
 }
13 13
 
14 14
 class WPInv_Plugin {
15 15
     private static $instance;
16 16
     
17 17
     public static function run() {
18
-        if ( !isset( self::$instance ) && !( self::$instance instanceof WPInv_Plugin ) ) {
18
+        if (!isset(self::$instance) && !(self::$instance instanceof WPInv_Plugin)) {
19 19
             self::$instance = new WPInv_Plugin;
20 20
             self::$instance->includes();
21 21
             self::$instance->actions();
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
             self::$instance->reports    = new WPInv_Reports();
24 24
         }
25 25
         
26
-        do_action( 'wpinv_loaded' );
26
+        do_action('wpinv_loaded');
27 27
         
28 28
         return self::$instance;
29 29
     }
@@ -33,31 +33,31 @@  discard block
 block discarded – undo
33 33
     }
34 34
     
35 35
     public function define_constants() {
36
-        define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) );
37
-        define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) );
36
+        define('WPINV_PLUGIN_DIR', plugin_dir_path(WPINV_PLUGIN_FILE));
37
+        define('WPINV_PLUGIN_URL', plugin_dir_url(WPINV_PLUGIN_FILE));
38 38
     }
39 39
     
40 40
     private function actions() {
41 41
         /* Internationalize the text strings used. */
42
-        add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) );
42
+        add_action('plugins_loaded', array(&$this, 'plugins_loaded'));
43 43
         
44 44
         /* Perform actions on admin initialization. */
45
-        add_action( 'admin_init', array( &$this, 'admin_init') );
46
-        add_action( 'init', array( &$this, 'init' ), 3 );
47
-        add_action( 'init', array( 'WPInv_Shortcodes', 'init' ) );
48
-        add_action( 'init', array( &$this, 'wpinv_actions' ) );
45
+        add_action('admin_init', array(&$this, 'admin_init'));
46
+        add_action('init', array(&$this, 'init'), 3);
47
+        add_action('init', array('WPInv_Shortcodes', 'init'));
48
+        add_action('init', array(&$this, 'wpinv_actions'));
49 49
         
50
-        if ( class_exists( 'BuddyPress' ) ) {
51
-            add_action( 'bp_include', array( &$this, 'bp_invoicing_init' ) );
50
+        if (class_exists('BuddyPress')) {
51
+            add_action('bp_include', array(&$this, 'bp_invoicing_init'));
52 52
         }
53 53
 
54
-        add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_scripts' ) );
54
+        add_action('wp_enqueue_scripts', array(&$this, 'enqueue_scripts'));
55 55
         
56
-        if ( is_admin() ) {
57
-            add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) );
58
-            add_action( 'admin_body_class', array( &$this, 'admin_body_class' ) );
56
+        if (is_admin()) {
57
+            add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts'));
58
+            add_action('admin_body_class', array(&$this, 'admin_body_class'));
59 59
         } else {
60
-            add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) );
60
+            add_filter('pre_get_posts', array(&$this, 'pre_get_posts'));
61 61
         }
62 62
         
63 63
         /**
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
          *
68 68
          * @param WPInv_Plugin $this. Current WPInv_Plugin instance. Passed by reference.
69 69
          */
70
-        do_action_ref_array( 'wpinv_actions', array( &$this ) );
70
+        do_action_ref_array('wpinv_actions', array(&$this));
71 71
 
72
-        add_action( 'admin_init', array( &$this, 'activation_redirect') );
72
+        add_action('admin_init', array(&$this, 'activation_redirect'));
73 73
     }
74 74
     
75 75
     public function plugins_loaded() {
@@ -83,192 +83,192 @@  discard block
 block discarded – undo
83 83
      * @since 1.0
84 84
      */
85 85
     public function load_textdomain() {
86
-        $locale = apply_filters( 'plugin_locale', get_locale(), 'invoicing' );
86
+        $locale = apply_filters('plugin_locale', get_locale(), 'invoicing');
87 87
         
88
-        load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' );
89
-        load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' );
88
+        load_textdomain('invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo');
89
+        load_plugin_textdomain('invoicing', false, WPINV_PLUGIN_DIR . 'languages');
90 90
         
91 91
         /**
92 92
          * Define language constants.
93 93
          */
94
-        require_once( WPINV_PLUGIN_DIR . 'language.php' );
94
+        require_once(WPINV_PLUGIN_DIR . 'language.php');
95 95
     }
96 96
         
97 97
     public function includes() {
98 98
         global $wpinv_options;
99 99
         
100
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' );
100
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php');
101 101
         $wpinv_options = wpinv_get_settings();
102 102
         
103
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php' );
104
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' );
105
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' );
106
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' );
107
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' );
108
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' );
109
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' );
110
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php' );
111
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' );
112
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' );
113
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' );
114
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' );
115
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php' );
116
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php' );
103
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php');
104
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php');
105
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php');
106
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php');
107
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php');
108
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php');
109
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php');
110
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php');
111
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php');
112
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php');
113
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php');
114
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php');
115
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php');
116
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php');
117 117
         //require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' );
118 118
         //require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' );
119
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php' );
119
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php');
120 120
         //require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscription.php' );
121
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php' );
122
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php' );
123
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session.php' );
124
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' );
125
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' );
126
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php' );
127
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-shortcodes.php' );
128
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' );
129
-        if ( !class_exists( 'WPInv_EUVat' ) ) {
130
-            require_once( WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php' );
121
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php');
122
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php');
123
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-session.php');
124
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php');
125
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php');
126
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php');
127
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-shortcodes.php');
128
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php');
129
+        if (!class_exists('WPInv_EUVat')) {
130
+            require_once(WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php');
131 131
         }
132 132
         
133
-        $gateways = array_keys( wpinv_get_enabled_payment_gateways() );
134
-        if ( !empty( $gateways ) ) {
135
-            foreach ( $gateways as $gateway ) {
136
-                if ( $gateway == 'manual' ) {
133
+        $gateways = array_keys(wpinv_get_enabled_payment_gateways());
134
+        if (!empty($gateways)) {
135
+            foreach ($gateways as $gateway) {
136
+                if ($gateway == 'manual') {
137 137
                     continue;
138 138
                 }
139 139
                 
140 140
                 $gateway_file = WPINV_PLUGIN_DIR . 'includes/gateways/' . $gateway . '.php';
141 141
                 
142
-                if ( file_exists( $gateway_file ) ) {
143
-                    require_once( $gateway_file );
142
+                if (file_exists($gateway_file)) {
143
+                    require_once($gateway_file);
144 144
                 }
145 145
             }
146 146
         }
147
-        require_once( WPINV_PLUGIN_DIR . 'includes/gateways/manual.php' );
147
+        require_once(WPINV_PLUGIN_DIR . 'includes/gateways/manual.php');
148 148
         
149
-        if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
150
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php' );
151
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' );
152
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php' );
149
+        if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
150
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php');
151
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php');
152
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php');
153 153
             //require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-recurring-admin.php' );
154
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php' );
155
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php' );
156
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' );
157
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php' );
158
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' );
154
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php');
155
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php');
156
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php');
157
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php');
158
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php');
159 159
             //require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' );
160 160
         }
161 161
         
162 162
         // include css inliner
163
-        if ( ! class_exists( 'Emogrifier' ) && class_exists( 'DOMDocument' ) ) {
164
-            include_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php' );
163
+        if (!class_exists('Emogrifier') && class_exists('DOMDocument')) {
164
+            include_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php');
165 165
         }
166 166
         
167
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/install.php' );
167
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/install.php');
168 168
     }
169 169
     
170 170
     public function init() {
171 171
     }
172 172
     
173 173
     public function admin_init() {
174
-        if (!(defined( 'DOING_AJAX' ) && DOING_AJAX)) {
174
+        if (!(defined('DOING_AJAX') && DOING_AJAX)) {
175 175
         }
176 176
         
177
-        add_action( 'admin_print_scripts-edit.php', array( &$this, 'admin_print_scripts_edit_php' ) );
177
+        add_action('admin_print_scripts-edit.php', array(&$this, 'admin_print_scripts_edit_php'));
178 178
     }
179 179
 
180 180
     public function activation_redirect() {
181 181
         // Bail if no activation redirect
182
-        if ( !get_transient( '_wpinv_activation_redirect' ) ) {
182
+        if (!get_transient('_wpinv_activation_redirect')) {
183 183
             return;
184 184
         }
185 185
 
186 186
         // Delete the redirect transient
187
-        delete_transient( '_wpinv_activation_redirect' );
187
+        delete_transient('_wpinv_activation_redirect');
188 188
 
189 189
         // Bail if activating from network, or bulk
190
-        if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
190
+        if (is_network_admin() || isset($_GET['activate-multi'])) {
191 191
             return;
192 192
         }
193 193
 
194
-        wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) );
194
+        wp_safe_redirect(admin_url('admin.php?page=wpinv-settings&tab=general'));
195 195
         exit;
196 196
     }
197 197
     
198 198
     public function enqueue_scripts() {
199
-        $suffix       = '';//defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
199
+        $suffix = ''; //defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
200 200
         
201
-        wp_deregister_style( 'font-awesome' );
202
-        wp_register_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome' . $suffix . '.css', array(), '4.7.0' );
203
-        wp_enqueue_style( 'font-awesome' );
201
+        wp_deregister_style('font-awesome');
202
+        wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome' . $suffix . '.css', array(), '4.7.0');
203
+        wp_enqueue_style('font-awesome');
204 204
         
205
-        wp_register_style( 'wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION );
206
-        wp_enqueue_style( 'wpinv_front_style' );
205
+        wp_register_style('wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION);
206
+        wp_enqueue_style('wpinv_front_style');
207 207
                
208 208
         // Register scripts
209
-        wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true );
210
-        wp_register_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front' . $suffix . '.js', array( 'jquery', 'wpinv-vat-script' ),  WPINV_VERSION );
209
+        wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true);
210
+        wp_register_script('wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front' . $suffix . '.js', array('jquery', 'wpinv-vat-script'), WPINV_VERSION);
211 211
         
212 212
         $localize                         = array();
213
-        $localize['ajax_url']             = admin_url( 'admin-ajax.php' );
214
-        $localize['nonce']                = wp_create_nonce( 'wpinv-nonce' );
213
+        $localize['ajax_url']             = admin_url('admin-ajax.php');
214
+        $localize['nonce']                = wp_create_nonce('wpinv-nonce');
215 215
         $localize['currency_symbol']      = wpinv_currency_symbol();
216 216
         $localize['currency_pos']         = wpinv_currency_position();
217 217
         $localize['thousand_sep']         = wpinv_thousands_separator();
218 218
         $localize['decimal_sep']          = wpinv_decimal_separator();
219 219
         $localize['decimals']             = wpinv_decimals();
220 220
         
221
-        $localize = apply_filters( 'wpinv_front_js_localize', $localize );
221
+        $localize = apply_filters('wpinv_front_js_localize', $localize);
222 222
         
223
-        wp_enqueue_script( 'jquery-blockui' );
223
+        wp_enqueue_script('jquery-blockui');
224 224
         $autofill_api = wpinv_get_option('address_autofill_api');
225 225
         $autofill_active = wpinv_get_option('address_autofill_active');
226
-        if ( isset( $autofill_active ) && 1 == $autofill_active && !empty( $autofill_api ) && wpinv_is_checkout() ) {
227
-            if ( wp_script_is( 'google-maps-api', 'enqueued' ) ) {
228
-                wp_dequeue_script( 'google-maps-api' );
226
+        if (isset($autofill_active) && 1 == $autofill_active && !empty($autofill_api) && wpinv_is_checkout()) {
227
+            if (wp_script_is('google-maps-api', 'enqueued')) {
228
+                wp_dequeue_script('google-maps-api');
229 229
             }
230
-            wp_enqueue_script( 'google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array( 'jquery' ), '', false );
231
-            wp_enqueue_script( 'google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array( 'jquery', 'google-maps-api' ), '', true );
230
+            wp_enqueue_script('google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array('jquery'), '', false);
231
+            wp_enqueue_script('google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array('jquery', 'google-maps-api'), '', true);
232 232
         }
233
-        wp_enqueue_script( 'wpinv-front-script' );
234
-        wp_localize_script( 'wpinv-front-script', 'WPInv', $localize );
233
+        wp_enqueue_script('wpinv-front-script');
234
+        wp_localize_script('wpinv-front-script', 'WPInv', $localize);
235 235
     }
236 236
 
237 237
     public function admin_enqueue_scripts() {
238 238
         global $post, $pagenow;
239 239
         
240 240
         $post_type  = wpinv_admin_post_type();
241
-        $suffix     = '';//defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
241
+        $suffix     = ''; //defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
242 242
         
243
-        wp_deregister_style( 'font-awesome' );
244
-        wp_register_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome' . $suffix . '.css', array(), '4.7.0' );
245
-        wp_enqueue_style( 'font-awesome' );
243
+        wp_deregister_style('font-awesome');
244
+        wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome' . $suffix . '.css', array(), '4.7.0');
245
+        wp_enqueue_style('font-awesome');
246 246
         
247 247
         if ($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
248
-            wp_register_style( 'jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16' );
249
-            wp_enqueue_style( 'jquery-ui-css' );
248
+            wp_register_style('jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16');
249
+            wp_enqueue_style('jquery-ui-css');
250 250
         }
251 251
         
252
-        wp_register_style( 'jquery-chosen', WPINV_PLUGIN_URL . 'assets/css/chosen' . $suffix . '.css', array(), '1.6.2' );
253
-        wp_enqueue_style( 'jquery-chosen' );
252
+        wp_register_style('jquery-chosen', WPINV_PLUGIN_URL . 'assets/css/chosen' . $suffix . '.css', array(), '1.6.2');
253
+        wp_enqueue_style('jquery-chosen');
254 254
 
255
-        wp_register_script( 'jquery-chosen', WPINV_PLUGIN_URL . 'assets/js/chosen.jquery' . $suffix . '.js', array( 'jquery' ), '1.6.2' );
256
-        wp_enqueue_script( 'jquery-chosen' );
255
+        wp_register_script('jquery-chosen', WPINV_PLUGIN_URL . 'assets/js/chosen.jquery' . $suffix . '.js', array('jquery'), '1.6.2');
256
+        wp_enqueue_script('jquery-chosen');
257 257
         
258
-        wp_register_style( 'wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION );
259
-        wp_enqueue_style( 'wpinv_meta_box_style' );
258
+        wp_register_style('wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION);
259
+        wp_enqueue_style('wpinv_meta_box_style');
260 260
         
261
-        wp_register_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), WPINV_VERSION );
262
-        wp_enqueue_style( 'wpinv_admin_style' );
261
+        wp_register_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), WPINV_VERSION);
262
+        wp_enqueue_style('wpinv_admin_style');
263 263
         
264
-        if ( $post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) ) {
265
-            wp_enqueue_script( 'jquery-ui-datepicker' );
264
+        if ($post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
265
+            wp_enqueue_script('jquery-ui-datepicker');
266 266
         }
267 267
 
268
-        wp_enqueue_style( 'wp-color-picker' );
269
-        wp_enqueue_script( 'wp-color-picker' );
268
+        wp_enqueue_style('wp-color-picker');
269
+        wp_enqueue_script('wp-color-picker');
270 270
         
271
-        wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true );
271
+        wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true);
272 272
 
273 273
         if ($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
274 274
             $autofill_api = wpinv_get_option('address_autofill_api');
@@ -279,17 +279,17 @@  discard block
 block discarded – undo
279 279
             }
280 280
         }
281 281
 
282
-        wp_register_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin' . $suffix . '.js', array( 'jquery', 'jquery-blockui','jquery-ui-tooltip' ),  WPINV_VERSION );
283
-        wp_enqueue_script( 'wpinv-admin-script' );
282
+        wp_register_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin' . $suffix . '.js', array('jquery', 'jquery-blockui', 'jquery-ui-tooltip'), WPINV_VERSION);
283
+        wp_enqueue_script('wpinv-admin-script');
284 284
         
285 285
         $localize                               = array();
286
-        $localize['ajax_url']                   = admin_url( 'admin-ajax.php' );
287
-        $localize['post_ID']                    = isset( $post->ID ) ? $post->ID : '';
288
-        $localize['wpinv_nonce']                = wp_create_nonce( 'wpinv-nonce' );
289
-        $localize['add_invoice_note_nonce']     = wp_create_nonce( 'add-invoice-note' );
290
-        $localize['delete_invoice_note_nonce']  = wp_create_nonce( 'delete-invoice-note' );
291
-        $localize['invoice_item_nonce']         = wp_create_nonce( 'invoice-item' );
292
-        $localize['billing_details_nonce']      = wp_create_nonce( 'get-billing-details' );
286
+        $localize['ajax_url']                   = admin_url('admin-ajax.php');
287
+        $localize['post_ID']                    = isset($post->ID) ? $post->ID : '';
288
+        $localize['wpinv_nonce']                = wp_create_nonce('wpinv-nonce');
289
+        $localize['add_invoice_note_nonce']     = wp_create_nonce('add-invoice-note');
290
+        $localize['delete_invoice_note_nonce']  = wp_create_nonce('delete-invoice-note');
291
+        $localize['invoice_item_nonce']         = wp_create_nonce('invoice-item');
292
+        $localize['billing_details_nonce']      = wp_create_nonce('get-billing-details');
293 293
         $localize['tax']                        = wpinv_tax_amount();
294 294
         $localize['discount']                   = wpinv_discount_amount();
295 295
         $localize['currency_symbol']            = wpinv_currency_symbol();
@@ -297,60 +297,60 @@  discard block
 block discarded – undo
297 297
         $localize['thousand_sep']               = wpinv_thousands_separator();
298 298
         $localize['decimal_sep']                = wpinv_decimal_separator();
299 299
         $localize['decimals']                   = wpinv_decimals();
300
-        $localize['save_invoice']               = __( 'Save Invoice', 'invoicing' );
301
-        $localize['status_publish']             = wpinv_status_nicename( 'publish' );
302
-        $localize['status_pending']             = wpinv_status_nicename( 'wpi-pending' );
303
-        $localize['delete_tax_rate']            = __( 'Are you sure you wish to delete this tax rate?', 'invoicing' );
304
-        $localize['OneItemMin']                 = __( 'Invoice must contain at least one item', 'invoicing' );
305
-        $localize['DeleteInvoiceItem']          = __( 'Are you sure you wish to delete this item?', 'invoicing' );
306
-        $localize['FillBillingDetails']         = __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' );
307
-        $localize['confirmCalcTotals']          = __( 'Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing' );
308
-        $localize['AreYouSure']                 = __( 'Are you sure?', 'invoicing' );
309
-        $localize['errDeleteItem']              = __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' );
300
+        $localize['save_invoice']               = __('Save Invoice', 'invoicing');
301
+        $localize['status_publish']             = wpinv_status_nicename('publish');
302
+        $localize['status_pending']             = wpinv_status_nicename('wpi-pending');
303
+        $localize['delete_tax_rate']            = __('Are you sure you wish to delete this tax rate?', 'invoicing');
304
+        $localize['OneItemMin']                 = __('Invoice must contain at least one item', 'invoicing');
305
+        $localize['DeleteInvoiceItem']          = __('Are you sure you wish to delete this item?', 'invoicing');
306
+        $localize['FillBillingDetails']         = __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing');
307
+        $localize['confirmCalcTotals']          = __('Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing');
308
+        $localize['AreYouSure']                 = __('Are you sure?', 'invoicing');
309
+        $localize['errDeleteItem']              = __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing');
310 310
 
311
-        $localize = apply_filters( 'wpinv_admin_js_localize', $localize );
311
+        $localize = apply_filters('wpinv_admin_js_localize', $localize);
312 312
 
313
-        wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', $localize );
313
+        wp_localize_script('wpinv-admin-script', 'WPInv_Admin', $localize);
314 314
     }
315 315
     
316
-    public function admin_body_class( $classes ) {
316
+    public function admin_body_class($classes) {
317 317
         global $pagenow, $post, $current_screen;
318 318
         
319
-        if ( !empty( $current_screen->post_type ) && ( $current_screen->post_type == 'wpi_invoice' || $current_screen->post_type == 'wpi_quote' ) ) {
319
+        if (!empty($current_screen->post_type) && ($current_screen->post_type == 'wpi_invoice' || $current_screen->post_type == 'wpi_quote')) {
320 320
             $classes .= ' wpinv-cpt';
321 321
         }
322 322
         
323
-        $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false;
323
+        $page = isset($_GET['page']) ? strtolower($_GET['page']) : false;
324 324
 
325 325
         $add_class = false;
326
-        if ( $pagenow == 'admin.php' && $page ) {
327
-            $add_class = strpos( $page, 'wpinv-' );
326
+        if ($pagenow == 'admin.php' && $page) {
327
+            $add_class = strpos($page, 'wpinv-');
328 328
         }
329 329
         
330 330
         $settings_class = array();
331
-        if ( $page == 'wpinv-settings' ) {
332
-            if ( !empty( $_REQUEST['tab'] ) ) {
333
-                $settings_class[] = sanitize_text_field( $_REQUEST['tab'] );
331
+        if ($page == 'wpinv-settings') {
332
+            if (!empty($_REQUEST['tab'])) {
333
+                $settings_class[] = sanitize_text_field($_REQUEST['tab']);
334 334
             }
335 335
             
336
-            if ( !empty( $_REQUEST['section'] ) ) {
337
-                $settings_class[] = sanitize_text_field( $_REQUEST['section'] );
336
+            if (!empty($_REQUEST['section'])) {
337
+                $settings_class[] = sanitize_text_field($_REQUEST['section']);
338 338
             }
339 339
             
340
-            $settings_class[] = isset( $_REQUEST['wpi_sub'] ) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field( $_REQUEST['wpi_sub'] ) : 'main';
340
+            $settings_class[] = isset($_REQUEST['wpi_sub']) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field($_REQUEST['wpi_sub']) : 'main';
341 341
         }
342 342
         
343
-        if ( !empty( $settings_class ) ) {
344
-            $classes .= ' wpi-' . wpinv_sanitize_key( implode( $settings_class, '-' ) );
343
+        if (!empty($settings_class)) {
344
+            $classes .= ' wpi-' . wpinv_sanitize_key(implode($settings_class, '-'));
345 345
         }
346 346
         
347 347
         $post_type = wpinv_admin_post_type();
348 348
 
349
-        if ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false ) {
349
+        if ($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false) {
350 350
             return $classes .= ' wpinv';
351 351
         }
352 352
         
353
-        if ( $pagenow == 'post.php' && $post_type == 'wpi_item' && !empty( $post ) && !wpinv_item_is_editable( $post ) ) {
353
+        if ($pagenow == 'post.php' && $post_type == 'wpi_item' && !empty($post) && !wpinv_item_is_editable($post)) {
354 354
             $classes .= ' wpi-editable-n';
355 355
         }
356 356
 
@@ -362,20 +362,20 @@  discard block
 block discarded – undo
362 362
     }
363 363
     
364 364
     public function wpinv_actions() {
365
-        if ( isset( $_REQUEST['wpi_action'] ) ) {
366
-            do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST );
365
+        if (isset($_REQUEST['wpi_action'])) {
366
+            do_action('wpinv_' . wpinv_sanitize_key($_REQUEST['wpi_action']), $_REQUEST);
367 367
         }
368 368
     }
369 369
     
370
-    public function pre_get_posts( $wp_query ) {
371
-        if ( !empty( $wp_query->query_vars['post_type'] ) && $wp_query->query_vars['post_type'] == 'wpi_invoice' && is_user_logged_in() && is_single() && $wp_query->is_main_query() ) {
372
-            $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses() );
370
+    public function pre_get_posts($wp_query) {
371
+        if (!empty($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == 'wpi_invoice' && is_user_logged_in() && is_single() && $wp_query->is_main_query()) {
372
+            $wp_query->query_vars['post_status'] = array_keys(wpinv_get_invoice_statuses());
373 373
         }
374 374
         
375 375
         return $wp_query;
376 376
     }
377 377
     
378 378
     public function bp_invoicing_init() {
379
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' );
379
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php');
380 380
     }
381 381
 }
382 382
\ No newline at end of file
Please login to merge, or discard this patch.