Passed
Pull Request — master (#126)
by Kiran
03:53
created
invoicing.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,19 +10,19 @@
 block discarded – undo
10 10
 */
11 11
 
12 12
 // MUST have WordPress.
13
-if ( !defined( 'WPINC' ) ) {
14
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
13
+if (!defined('WPINC')) {
14
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
15 15
 }
16 16
 
17
-if ( !defined( 'WPINV_VERSION' ) ) {
18
-    define( 'WPINV_VERSION', '1.0.2' );
17
+if (!defined('WPINV_VERSION')) {
18
+    define('WPINV_VERSION', '1.0.2');
19 19
 }
20 20
 
21
-if ( !defined( 'WPINV_PLUGIN_FILE' ) ) {
22
-    define( 'WPINV_PLUGIN_FILE', __FILE__ );
21
+if (!defined('WPINV_PLUGIN_FILE')) {
22
+    define('WPINV_PLUGIN_FILE', __FILE__);
23 23
 }
24 24
 
25
-require plugin_dir_path( __FILE__ ) . 'includes/class-wpinv.php';
25
+require plugin_dir_path(__FILE__) . 'includes/class-wpinv.php';
26 26
 
27 27
 function wpinv_run() {
28 28
     global $invoicing;
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,256 +72,256 @@  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
                         'class'             => 'medium-text',
200
-                        'placeholder'       => __( 'Select one or more Items', 'invoicing' ),
200
+                        'placeholder'       => __('Select one or more Items', 'invoicing'),
201 201
                         'show_recurring'    => true,
202
-                    ) ); ?>
202
+                    )); ?>
203 203
                 </p>
204
-                <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>
204
+                <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 205
             </td>
206 206
         </tr>
207
-        <?php do_action( 'wpinv_discount_form_before_excluded_items', $post ); ?>
207
+        <?php do_action('wpinv_discount_form_before_excluded_items', $post); ?>
208 208
         <tr>
209 209
             <th valign="top" scope="row">
210
-                <label for="wpinv_discount_excluded_items"><?php _e( 'Excluded Items', 'invoicing' ); ?></label>
210
+                <label for="wpinv_discount_excluded_items"><?php _e('Excluded Items', 'invoicing'); ?></label>
211 211
             </th>
212 212
             <td>
213
-                <p><?php echo wpinv_item_dropdown( array(
213
+                <p><?php echo wpinv_item_dropdown(array(
214 214
                         'name'              => 'excluded_items[]',
215 215
                         'id'                => 'excluded_items',
216 216
                         'selected'          => $excluded_items,
217 217
                         'multiple'          => true,
218 218
                         'class'             => 'medium-text',
219
-                        'placeholder'       => __( 'Select one or more Items', 'invoicing' ),
219
+                        'placeholder'       => __('Select one or more Items', 'invoicing'),
220 220
                         'show_recurring'    => true,
221
-                    ) ); ?>
221
+                    )); ?>
222 222
                 </p>
223
-                <p class="description"><?php _e( 'Items which are NOT allowed to use this discount.', 'invoicing' ); ?></p>
223
+                <p class="description"><?php _e('Items which are NOT allowed to use this discount.', 'invoicing'); ?></p>
224 224
             </td>
225 225
         </tr>
226
-        <?php do_action( 'wpinv_discount_form_before_start', $post ); ?>
226
+        <?php do_action('wpinv_discount_form_before_start', $post); ?>
227 227
         <tr>
228 228
             <th valign="top" scope="row">
229
-                <label for="wpinv_discount_start"><?php _e( 'Start Date', 'invoicing' ); ?></label>
229
+                <label for="wpinv_discount_start"><?php _e('Start Date', 'invoicing'); ?></label>
230 230
             </th>
231 231
             <td>
232
-                <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 ) ); ?>">
233
-                <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>
232
+                <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)); ?>">
233
+                <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 234
             </td>
235 235
         </tr>
236
-        <?php do_action( 'wpinv_discount_form_before_expiration', $post ); ?>
236
+        <?php do_action('wpinv_discount_form_before_expiration', $post); ?>
237 237
         <tr>
238 238
             <th valign="top" scope="row">
239
-                <label for="wpinv_discount_expiration"><?php _e( 'Expiration Date', 'invoicing' ); ?></label>
239
+                <label for="wpinv_discount_expiration"><?php _e('Expiration Date', 'invoicing'); ?></label>
240 240
             </th>
241 241
             <td>
242
-                <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 ) ); ?>">
243
-                <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>
242
+                <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)); ?>">
243
+                <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 244
             </td>
245 245
         </tr>
246
-        <?php do_action( 'wpinv_discount_form_before_min_total', $post ); ?>
246
+        <?php do_action('wpinv_discount_form_before_min_total', $post); ?>
247 247
         <tr>
248 248
             <th valign="top" scope="row">
249
-                <label for="wpinv_discount_min_total"><?php _e( 'Minimum Amount', 'invoicing' ); ?></label>
249
+                <label for="wpinv_discount_min_total"><?php _e('Minimum Amount', 'invoicing'); ?></label>
250 250
             </th>
251 251
             <td>
252 252
                 <input type="text" name="min_total" id="wpinv_discount_min_total" class="wpi-field-price wpi-price" value="<?php echo $min_total; ?>">
253
-                <p class="description"><?php _e( 'This allows you to set the minimum amount (subtotal, including taxes) allowed when using the discount.', 'invoicing' ); ?></p>
253
+                <p class="description"><?php _e('This allows you to set the minimum amount (subtotal, including taxes) allowed when using the discount.', 'invoicing'); ?></p>
254 254
             </td>
255 255
         </tr>
256
-        <?php do_action( 'wpinv_discount_form_before_max_total', $post ); ?>
256
+        <?php do_action('wpinv_discount_form_before_max_total', $post); ?>
257 257
         <tr>
258 258
             <th valign="top" scope="row">
259
-                <label for="wpinv_discount_max_total"><?php _e( 'Maximum Amount', 'invoicing' ); ?></label>
259
+                <label for="wpinv_discount_max_total"><?php _e('Maximum Amount', 'invoicing'); ?></label>
260 260
             </th>
261 261
             <td>
262 262
                 <input type="text" name="max_total" id="wpinv_discount_max_total" class="wpi-field-price wpi-price" value="<?php echo $max_total; ?>">
263
-                <p class="description"><?php _e( 'This allows you to set the maximum amount (subtotal, including taxes) allowed when using the discount.', 'invoicing' ); ?></p>
263
+                <p class="description"><?php _e('This allows you to set the maximum amount (subtotal, including taxes) allowed when using the discount.', 'invoicing'); ?></p>
264 264
             </td>
265 265
         </tr>
266
-        <?php do_action( 'wpinv_discount_form_before_recurring', $post ); ?>
266
+        <?php do_action('wpinv_discount_form_before_recurring', $post); ?>
267 267
         <tr>
268 268
             <th valign="top" scope="row">
269
-                <label for="wpinv_discount_recurring"><?php _e( 'For recurring apply to', 'invoicing' ); ?></label>
269
+                <label for="wpinv_discount_recurring"><?php _e('For recurring apply to', 'invoicing'); ?></label>
270 270
             </th>
271 271
             <td>
272 272
                 <select id="wpinv_discount_recurring" name="recurring" class="medium-text">
273
-                    <option value="0" <?php selected( false, $recurring ); ?>><?php _e( 'All payments', 'invoicing' ); ?></option>
274
-                    <option value="1" <?php selected( true, $recurring ); ?>><?php _e( 'First payment only', 'invoicing' ); ?></option>
273
+                    <option value="0" <?php selected(false, $recurring); ?>><?php _e('All payments', 'invoicing'); ?></option>
274
+                    <option value="1" <?php selected(true, $recurring); ?>><?php _e('First payment only', 'invoicing'); ?></option>
275 275
                 </select>
276
-                <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>
276
+                <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>
277 277
             </td>
278 278
         </tr>
279
-        <?php do_action( 'wpinv_discount_form_before_max_uses', $post ); ?>
279
+        <?php do_action('wpinv_discount_form_before_max_uses', $post); ?>
280 280
         <tr>
281 281
             <th valign="top" scope="row">
282
-                <label for="wpinv_discount_max_uses"><?php _e( 'Max Uses', 'invoicing' ); ?></label>
282
+                <label for="wpinv_discount_max_uses"><?php _e('Max Uses', 'invoicing'); ?></label>
283 283
             </th>
284 284
             <td>
285 285
                 <input type="number" min="0" step="1" id="wpinv_discount_max_uses" name="max_uses" class="medium-text" value="<?php echo $max_uses; ?>">
286
-                <p class="description"><?php _e( 'The maximum number of times this discount can be used. Leave blank for unlimited.', 'invoicing' ); ?></p>
286
+                <p class="description"><?php _e('The maximum number of times this discount can be used. Leave blank for unlimited.', 'invoicing'); ?></p>
287 287
             </td>
288 288
         </tr>
289
-        <?php do_action( 'wpinv_discount_form_before_single_use', $post ); ?>
289
+        <?php do_action('wpinv_discount_form_before_single_use', $post); ?>
290 290
         <tr>
291 291
             <th valign="top" scope="row">
292
-                <label for="wpinv_discount_single_use"><?php _e( 'Use Once Per User', 'invoicing' ); ?></label>
292
+                <label for="wpinv_discount_single_use"><?php _e('Use Once Per User', 'invoicing'); ?></label>
293 293
             </th>
294 294
             <td>
295
-                <input type="checkbox" value="1" name="single_use" id="wpinv_discount_single_use" <?php checked( true, $single_use ); ?>>
296
-                <span class="description"><?php _e( 'Limit this discount to a single use per user?', 'invoicing' ); ?></span>
295
+                <input type="checkbox" value="1" name="single_use" id="wpinv_discount_single_use" <?php checked(true, $single_use); ?>>
296
+                <span class="description"><?php _e('Limit this discount to a single use per user?', 'invoicing'); ?></span>
297 297
             </td>
298 298
         </tr>
299
-        <?php do_action( 'wpinv_discount_form_last', $post ); ?>
299
+        <?php do_action('wpinv_discount_form_last', $post); ?>
300 300
     </tbody>
301 301
 </table>
302
-<?php do_action( 'wpinv_discount_form_bottom', $post ); ?>
302
+<?php do_action('wpinv_discount_form_bottom', $post); ?>
303 303
     <?php
304 304
 }
305 305
 
306
-function wpinv_discount_metabox_save( $post_id, $post, $update = false ) {
307
-    $post_type = !empty( $post ) ? $post->post_type : '';
306
+function wpinv_discount_metabox_save($post_id, $post, $update = false) {
307
+    $post_type = !empty($post) ? $post->post_type : '';
308 308
     
309
-    if ( $post_type != 'wpi_discount' ) {
309
+    if ($post_type != 'wpi_discount') {
310 310
         return;
311 311
     }
312 312
     
313
-    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' ) ) ) {
313
+    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'))) {
314 314
         return;
315 315
     }
316 316
     
317
-    if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ( defined( 'DOING_AJAX') && DOING_AJAX ) || isset( $_REQUEST['bulk_edit'] ) ) {
317
+    if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || (defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit'])) {
318 318
         return;
319 319
     }
320 320
     
321
-    if ( !current_user_can( 'manage_options', $post_id ) ) {
321
+    if (!current_user_can('manage_options', $post_id)) {
322 322
         return;
323 323
     }
324 324
     
325
-    return wpinv_store_discount( $post_id, $_POST, $post, $update );
325
+    return wpinv_store_discount($post_id, $_POST, $post, $update);
326 326
 }
327
-add_action( 'save_post', 'wpinv_discount_metabox_save', 10, 3 );
328 327
\ No newline at end of file
328
+add_action('save_post', 'wpinv_discount_metabox_save', 10, 3);
329 329
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-mb-invoice-address.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -1,34 +1,34 @@  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_Billing_Details {
8
-    public static function output( $post ) {
8
+    public static function output($post) {
9 9
         global $user_ID;
10
-        $post_id    = !empty( $post->ID ) ? $post->ID : 0;
11
-        $invoice    = new WPInv_Invoice( $post_id );
10
+        $post_id    = !empty($post->ID) ? $post->ID : 0;
11
+        $invoice    = new WPInv_Invoice($post_id);
12 12
 ?>
13 13
 <div class="gdmbx2-wrap form-table">
14 14
     <div id="gdmbx2-metabox-wpinv_address" class="gdmbx2-metabox gdmbx-field-list wpinv-address gdmbx-row">
15 15
         <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-user-id table-layout">
16 16
             <div class="gdmbx-th">
17
-                <label for="post_author_override"><?php _e( 'Customer', 'invoicing' );?></label>
17
+                <label for="post_author_override"><?php _e('Customer', 'invoicing'); ?></label>
18 18
             </div>
19 19
             <div class="gdmbx-td gdmbx-customer-div">
20
-            <?php wpinv_dropdown_users( array(
20
+            <?php wpinv_dropdown_users(array(
21 21
                             'name' => 'post_author_override',
22 22
                             'selected' => empty($post->ID) ? $user_ID : $post->post_author,
23 23
                             'include_selected' => true,
24 24
                             'show' => 'user_email',
25 25
                             'orderby' => 'user_email',
26 26
                             'class' => 'gdmbx2-text-large'
27
-                        ) ); ?>
27
+                        )); ?>
28 28
             </div>
29 29
         </div>
30 30
         <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-email table-layout" style="display:none">
31
-            <div class="gdmbx-th"><label for="wpinv_email"><?php _e( 'Email', 'invoicing' );?> <span class="required">*</span></label>
31
+            <div class="gdmbx-th"><label for="wpinv_email"><?php _e('Email', 'invoicing'); ?> <span class="required">*</span></label>
32 32
             </div>
33 33
             <div class="gdmbx-td">
34 34
                 <input type="hidden" id="wpinv_new_user" name="wpinv_new_user" value="" />
@@ -36,122 +36,122 @@  discard block
 block discarded – undo
36 36
             </div>
37 37
         </div>
38 38
         <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-btns table-layout">
39
-            <div class="gdmbx-th"><label><?php _e( 'Actions', 'invoicing' );?></label>
39
+            <div class="gdmbx-th"><label><?php _e('Actions', 'invoicing'); ?></label>
40 40
             </div>
41
-            <?php if($invoice->has_status(array('auto-draft', 'wpi-pending', 'wpi-quote-pending'))){ ?>
41
+            <?php if ($invoice->has_status(array('auto-draft', 'wpi-pending', 'wpi-quote-pending'))) { ?>
42 42
                 <div class="gdmbx-td">
43
-                    <a id="wpinv-fill-user-details" class="button button-small button-secondary" title="<?php esc_attr_e( 'Fill User Details', 'invoicing' );?>" href="javascript:void(0)"><i aria-hidden="true" class="fa fa-refresh"></i><?php _e( 'Fill User Details', 'invoicing' );?></a>
44
-                    <a class="wpinv-new-user button button-small button-secondary" href="javascript:void(0)"><i aria-hidden="true" class="fa fa-plus"></i><?php _e( 'Add New User', 'invoicing' );?></a>
45
-                    <a style="display:none" class="wpinv-new-cancel button button-small button-secondary" href="javascript:void(0)"><i aria-hidden="true" class="fa fa-close"></i><?php _e( 'Cancel', 'invoicing' );?> </a>
43
+                    <a id="wpinv-fill-user-details" class="button button-small button-secondary" title="<?php esc_attr_e('Fill User Details', 'invoicing'); ?>" href="javascript:void(0)"><i aria-hidden="true" class="fa fa-refresh"></i><?php _e('Fill User Details', 'invoicing'); ?></a>
44
+                    <a class="wpinv-new-user button button-small button-secondary" href="javascript:void(0)"><i aria-hidden="true" class="fa fa-plus"></i><?php _e('Add New User', 'invoicing'); ?></a>
45
+                    <a style="display:none" class="wpinv-new-cancel button button-small button-secondary" href="javascript:void(0)"><i aria-hidden="true" class="fa fa-close"></i><?php _e('Cancel', 'invoicing'); ?> </a>
46 46
                 </div>
47 47
             <?php } ?>
48 48
         </div>
49 49
         <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-first-name table-layout">
50
-            <div class="gdmbx-th"><label for="wpinv_first_name"><?php _e( 'First Name', 'invoicing' );?></label></div>
50
+            <div class="gdmbx-th"><label for="wpinv_first_name"><?php _e('First Name', 'invoicing'); ?></label></div>
51 51
             <div class="gdmbx-td">
52
-                <input type="text" class="gdmbx2-text-large" name="wpinv_first_name" id="wpinv_first_name" value="<?php echo esc_attr( $invoice->first_name );?>" />
52
+                <input type="text" class="gdmbx2-text-large" name="wpinv_first_name" id="wpinv_first_name" value="<?php echo esc_attr($invoice->first_name); ?>" />
53 53
             </div>
54 54
         </div>
55 55
         <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-last-name table-layout">
56
-            <div class="gdmbx-th"><label for="wpinv_last_name"><?php _e( 'Last Name', 'invoicing' );?></label></div>
56
+            <div class="gdmbx-th"><label for="wpinv_last_name"><?php _e('Last Name', 'invoicing'); ?></label></div>
57 57
             <div class="gdmbx-td">
58
-                <input type="text" class="gdmbx2-text-large" name="wpinv_last_name" id="wpinv_last_name" value="<?php echo esc_attr( $invoice->last_name );?>" />
58
+                <input type="text" class="gdmbx2-text-large" name="wpinv_last_name" id="wpinv_last_name" value="<?php echo esc_attr($invoice->last_name); ?>" />
59 59
             </div>
60 60
         </div>
61 61
         <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-company table-layout">
62
-            <div class="gdmbx-th"><label for="wpinv_company"><?php _e( 'Company', 'invoicing' );?></label></div>
62
+            <div class="gdmbx-th"><label for="wpinv_company"><?php _e('Company', 'invoicing'); ?></label></div>
63 63
             <div class="gdmbx-td">
64
-                <input type="text" class="gdmbx2-text-large" name="wpinv_company" id="wpinv_company" value="<?php echo esc_attr( $invoice->company );?>" />
64
+                <input type="text" class="gdmbx2-text-large" name="wpinv_company" id="wpinv_company" value="<?php echo esc_attr($invoice->company); ?>" />
65 65
             </div>
66 66
         </div>
67 67
         <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-vat-number table-layout">
68
-            <div class="gdmbx-th"><label for="wpinv_vat_number"><?php _e( 'Vat Number', 'invoicing' );?></label></div>
68
+            <div class="gdmbx-th"><label for="wpinv_vat_number"><?php _e('Vat Number', 'invoicing'); ?></label></div>
69 69
             <div class="gdmbx-td">
70
-                <input type="text" class="gdmbx2-text-large" name="wpinv_vat_number" id="wpinv_vat_number" value="<?php echo esc_attr( $invoice->vat_number );?>" />
70
+                <input type="text" class="gdmbx2-text-large" name="wpinv_vat_number" id="wpinv_vat_number" value="<?php echo esc_attr($invoice->vat_number); ?>" />
71 71
             </div>
72 72
         </div>
73 73
         <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-address table-layout">
74
-            <div class="gdmbx-th"><label for="wpinv_address"><?php _e( 'Address', 'invoicing' );?></label></div>
74
+            <div class="gdmbx-th"><label for="wpinv_address"><?php _e('Address', 'invoicing'); ?></label></div>
75 75
             <div class="gdmbx-td">
76
-                <input type="text" class="gdmbx2-text-large" name="wpinv_address" id="wpinv_address" value="<?php echo esc_attr( $invoice->address );?>" />
76
+                <input type="text" class="gdmbx2-text-large" name="wpinv_address" id="wpinv_address" value="<?php echo esc_attr($invoice->address); ?>" />
77 77
             </div>
78 78
         </div>
79 79
         <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-city table-layout">
80
-            <div class="gdmbx-th"><label for="wpinv_city"><?php _e( 'City', 'invoicing' );?></label></div>
80
+            <div class="gdmbx-th"><label for="wpinv_city"><?php _e('City', 'invoicing'); ?></label></div>
81 81
             <div class="gdmbx-td">
82
-                <input type="text" class="gdmbx2-text-large" name="wpinv_city" id="wpinv_city" value="<?php echo esc_attr( $invoice->city );?>" />
82
+                <input type="text" class="gdmbx2-text-large" name="wpinv_city" id="wpinv_city" value="<?php echo esc_attr($invoice->city); ?>" />
83 83
             </div>
84 84
         </div>
85 85
         <div class="gdmbx-row gdmbx-type-select gdmbx-wpinv-country table-layout">
86
-            <div class="gdmbx-th"><label for="wpinv_country"><?php _e( 'Country', 'invoicing' );?> <span class="wpi-loader"><i class="fa fa-refresh fa-spin"></i></span></label></div>
86
+            <div class="gdmbx-th"><label for="wpinv_country"><?php _e('Country', 'invoicing'); ?> <span class="wpi-loader"><i class="fa fa-refresh fa-spin"></i></span></label></div>
87 87
             <div class="gdmbx-td">
88 88
                 <?php
89
-                echo wpinv_html_select( array(
90
-                    'options'          => array_merge( array( '' => __( 'Choose a country', 'invoicing' ) ), wpinv_get_country_list() ),
89
+                echo wpinv_html_select(array(
90
+                    'options'          => array_merge(array('' => __('Choose a country', 'invoicing')), wpinv_get_country_list()),
91 91
                     'name'             => 'wpinv_country',
92 92
                     'id'               => 'wpinv_country',
93 93
                     'selected'         => $invoice->country,
94 94
                     'show_option_all'  => false,
95 95
                     'show_option_none' => false,
96 96
                     'class'            => 'gdmbx2-text-large',
97
-                    'placeholder'      => __( 'Choose a country', 'invoicing' ),
97
+                    'placeholder'      => __('Choose a country', 'invoicing'),
98 98
                     'required'         => false,
99
-                ) );
99
+                ));
100 100
                 ?>
101 101
             </div>
102 102
         </div>
103 103
         <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-state table-layout">
104
-            <div class="gdmbx-th"><label for="wpinv_state"><?php _e( 'State', 'invoicing' );?></label></div>
104
+            <div class="gdmbx-th"><label for="wpinv_state"><?php _e('State', 'invoicing'); ?></label></div>
105 105
             <div class="gdmbx-td">
106 106
                 <?php
107
-                $states = wpinv_get_country_states( $invoice->country );
108
-                if( !empty( $states ) ) {
109
-                    echo wpinv_html_select( array(
110
-                        'options'          => array_merge( array( '' => __( 'Choose a state', 'invoicing' ) ), $states ),
107
+                $states = wpinv_get_country_states($invoice->country);
108
+                if (!empty($states)) {
109
+                    echo wpinv_html_select(array(
110
+                        'options'          => array_merge(array('' => __('Choose a state', 'invoicing')), $states),
111 111
                         'name'             => 'wpinv_state',
112 112
                         'id'               => 'wpinv_state',
113 113
                         'selected'         => $invoice->state,
114 114
                         'show_option_all'  => false,
115 115
                         'show_option_none' => false,
116 116
                         'class'            => 'gdmbx2-text-large',
117
-                        'placeholder'      => __( 'Choose a state', 'invoicing' ),
117
+                        'placeholder'      => __('Choose a state', 'invoicing'),
118 118
                         'required'         => false,
119
-                    ) );
119
+                    ));
120 120
                 } else {
121
-                    echo wpinv_html_text( array(
121
+                    echo wpinv_html_text(array(
122 122
                         'name'  => 'wpinv_state',
123
-                        'value' => ! empty( $invoice->state ) ? $invoice->state : '',
123
+                        'value' => !empty($invoice->state) ? $invoice->state : '',
124 124
                         'id'    => 'wpinv_state',
125 125
                         'class' => 'gdmbx2-text-large',
126 126
                         'required' => false,
127
-                    ) );
127
+                    ));
128 128
                 }
129 129
                 ?>
130 130
             </div>
131 131
         </div>
132 132
         <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-zip table-layout">
133
-            <div class="gdmbx-th"><label for="wpinv_zip"><?php _e( 'Zipcode', 'invoicing' );?></label></div>
133
+            <div class="gdmbx-th"><label for="wpinv_zip"><?php _e('Zipcode', 'invoicing'); ?></label></div>
134 134
             <div class="gdmbx-td">
135
-                <input type="text" class="gdmbx2-text-large" name="wpinv_zip" id="wpinv_zip" value="<?php echo esc_attr( $invoice->zip );?>" />
135
+                <input type="text" class="gdmbx2-text-large" name="wpinv_zip" id="wpinv_zip" value="<?php echo esc_attr($invoice->zip); ?>" />
136 136
             </div>
137 137
         </div>
138 138
         <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-phone table-layout">
139
-            <div class="gdmbx-th"><label for="wpinv_phone"><?php _e( 'Phone', 'invoicing' );?></label></div>
139
+            <div class="gdmbx-th"><label for="wpinv_phone"><?php _e('Phone', 'invoicing'); ?></label></div>
140 140
             <div class="gdmbx-td">
141
-                <input type="text" class="gdmbx2-text-large" name="wpinv_phone" id="wpinv_phone" value="<?php echo esc_attr( $invoice->phone );?>" />
141
+                <input type="text" class="gdmbx2-text-large" name="wpinv_phone" id="wpinv_phone" value="<?php echo esc_attr($invoice->phone); ?>" />
142 142
             </div>
143 143
         </div>
144 144
         <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-ip table-layout">
145
-            <div class="gdmbx-th"><label for="wpinv_ip"><?php _e( 'IP Address', 'invoicing' );?><?php if ($invoice->ip) { ?>
146
-                &nbsp;&nbsp;<a href="<?php echo admin_url( 'admin-ajax.php?action=wpinv_ip_geolocation&ip=' . $invoice->ip ); ?>" title="<?php esc_attr_e( 'View IP information', 'invoicing' );?>" target="_blank"><i class="fa fa-external-link" aria-hidden="true"></i></a>
145
+            <div class="gdmbx-th"><label for="wpinv_ip"><?php _e('IP Address', 'invoicing'); ?><?php if ($invoice->ip) { ?>
146
+                &nbsp;&nbsp;<a href="<?php echo admin_url('admin-ajax.php?action=wpinv_ip_geolocation&ip=' . $invoice->ip); ?>" title="<?php esc_attr_e('View IP information', 'invoicing'); ?>" target="_blank"><i class="fa fa-external-link" aria-hidden="true"></i></a>
147 147
                 <?php } ?></label></div>
148 148
             <div class="gdmbx-td">
149
-                <input type="text" class="gdmbx2-text-large" value="<?php echo esc_attr( $invoice->ip );?>" readonly />
149
+                <input type="text" class="gdmbx2-text-large" value="<?php echo esc_attr($invoice->ip); ?>" readonly />
150 150
             </div>
151 151
         </div>
152 152
     </div>
153 153
 </div>
154
-<?php wp_nonce_field( 'wpinv_save_invoice', 'wpinv_save_invoice' ) ;?>
154
+<?php wp_nonce_field('wpinv_save_invoice', 'wpinv_save_invoice'); ?>
155 155
 <?php
156 156
     }
157 157
 }
Please login to merge, or discard this patch.
includes/admin/register-settings.php 3 patches
Indentation   +326 added lines, -326 removed lines patch added patch discarded remove patch
@@ -868,322 +868,322 @@  discard block
 block discarded – undo
868 868
 }
869 869
 
870 870
 function wpinv_get_pages( $with_slug = false, $default_label = NULL ) {
871
-	$pages_options = array();
871
+    $pages_options = array();
872 872
 
873
-	if( $default_label !== NULL && $default_label !== false ) {
874
-		$pages_options = array( '' => $default_label ); // Blank option
875
-	}
873
+    if( $default_label !== NULL && $default_label !== false ) {
874
+        $pages_options = array( '' => $default_label ); // Blank option
875
+    }
876 876
 
877
-	$pages = get_pages();
878
-	if ( $pages ) {
879
-		foreach ( $pages as $page ) {
880
-			$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
877
+    $pages = get_pages();
878
+    if ( $pages ) {
879
+        foreach ( $pages as $page ) {
880
+            $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
881 881
             $pages_options[ $page->ID ] = $title;
882
-		}
883
-	}
882
+        }
883
+    }
884 884
 
885
-	return $pages_options;
885
+    return $pages_options;
886 886
 }
887 887
 
888 888
 function wpinv_header_callback( $args ) {
889
-	if ( !empty( $args['desc'] ) ) {
889
+    if ( !empty( $args['desc'] ) ) {
890 890
         echo $args['desc'];
891 891
     }
892 892
 }
893 893
 
894 894
 function wpinv_hidden_callback( $args ) {
895
-	global $wpinv_options;
896
-
897
-	if ( isset( $args['set_value'] ) ) {
898
-		$value = $args['set_value'];
899
-	} elseif ( isset( $wpinv_options[ $args['id'] ] ) ) {
900
-		$value = $wpinv_options[ $args['id'] ];
901
-	} else {
902
-		$value = isset( $args['std'] ) ? $args['std'] : '';
903
-	}
904
-
905
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
906
-		$args['readonly'] = true;
907
-		$value = isset( $args['std'] ) ? $args['std'] : '';
908
-		$name  = '';
909
-	} else {
910
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
911
-	}
912
-
913
-	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
895
+    global $wpinv_options;
896
+
897
+    if ( isset( $args['set_value'] ) ) {
898
+        $value = $args['set_value'];
899
+    } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) {
900
+        $value = $wpinv_options[ $args['id'] ];
901
+    } else {
902
+        $value = isset( $args['std'] ) ? $args['std'] : '';
903
+    }
904
+
905
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
906
+        $args['readonly'] = true;
907
+        $value = isset( $args['std'] ) ? $args['std'] : '';
908
+        $name  = '';
909
+    } else {
910
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
911
+    }
912
+
913
+    $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
914 914
     
915
-	echo $html;
915
+    echo $html;
916 916
 }
917 917
 
918 918
 function wpinv_checkbox_callback( $args ) {
919
-	global $wpinv_options;
919
+    global $wpinv_options;
920 920
     
921 921
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
922 922
 
923
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
924
-		$name = '';
925
-	} else {
926
-		$name = 'name="wpinv_settings[' . $sanitize_id . ']"';
927
-	}
923
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
924
+        $name = '';
925
+    } else {
926
+        $name = 'name="wpinv_settings[' . $sanitize_id . ']"';
927
+    }
928 928
 
929
-	$checked = isset( $wpinv_options[ $args['id'] ] ) ? checked( 1, $wpinv_options[ $args['id'] ], false ) : '';
930
-	$html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>';
931
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
929
+    $checked = isset( $wpinv_options[ $args['id'] ] ) ? checked( 1, $wpinv_options[ $args['id'] ], false ) : '';
930
+    $html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>';
931
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
932 932
 
933
-	echo $html;
933
+    echo $html;
934 934
 }
935 935
 
936 936
 function wpinv_multicheck_callback( $args ) {
937
-	global $wpinv_options;
937
+    global $wpinv_options;
938 938
 	
939
-	$sanitize_id = wpinv_sanitize_key( $args['id'] );
939
+    $sanitize_id = wpinv_sanitize_key( $args['id'] );
940 940
 	
941
-	if ( ! empty( $args['options'] ) ) {
942
-		foreach( $args['options'] as $key => $option ):
943
-			$sanitize_key = wpinv_sanitize_key( $key );
944
-			if ( isset( $wpinv_options[$args['id']][$sanitize_key] ) ) { 
945
-				$enabled = $sanitize_key;
946
-			} else { 
947
-				$enabled = NULL; 
948
-			}
949
-			echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/>&nbsp;';
950
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label><br/>';
951
-		endforeach;
952
-		echo '<p class="description">' . $args['desc'] . '</p>';
953
-	}
941
+    if ( ! empty( $args['options'] ) ) {
942
+        foreach( $args['options'] as $key => $option ):
943
+            $sanitize_key = wpinv_sanitize_key( $key );
944
+            if ( isset( $wpinv_options[$args['id']][$sanitize_key] ) ) { 
945
+                $enabled = $sanitize_key;
946
+            } else { 
947
+                $enabled = NULL; 
948
+            }
949
+            echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/>&nbsp;';
950
+            echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label><br/>';
951
+        endforeach;
952
+        echo '<p class="description">' . $args['desc'] . '</p>';
953
+    }
954 954
 }
955 955
 
956 956
 function wpinv_payment_icons_callback( $args ) {
957
-	global $wpinv_options;
957
+    global $wpinv_options;
958 958
     
959 959
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
960 960
 
961
-	if ( ! empty( $args['options'] ) ) {
962
-		foreach( $args['options'] as $key => $option ) {
961
+    if ( ! empty( $args['options'] ) ) {
962
+        foreach( $args['options'] as $key => $option ) {
963 963
             $sanitize_key = wpinv_sanitize_key( $key );
964 964
             
965
-			if( isset( $wpinv_options[$args['id']][$key] ) ) {
966
-				$enabled = $option;
967
-			} else {
968
-				$enabled = NULL;
969
-			}
970
-
971
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
972
-
973
-				echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/>&nbsp;';
974
-
975
-				if ( wpinv_string_is_image_url( $key ) ) {
976
-					echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
977
-				} else {
978
-					$card = strtolower( str_replace( ' ', '', $option ) );
979
-
980
-					if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
981
-						$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
982
-					} else {
983
-						$image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
984
-						$content_dir = WP_CONTENT_DIR;
985
-
986
-						if ( function_exists( 'wp_normalize_path' ) ) {
987
-							// Replaces backslashes with forward slashes for Windows systems
988
-							$image = wp_normalize_path( $image );
989
-							$content_dir = wp_normalize_path( $content_dir );
990
-						}
991
-
992
-						$image = str_replace( $content_dir, content_url(), $image );
993
-					}
994
-
995
-					echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
996
-				}
997
-			echo $option . '</label>';
998
-		}
999
-		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
1000
-	}
965
+            if( isset( $wpinv_options[$args['id']][$key] ) ) {
966
+                $enabled = $option;
967
+            } else {
968
+                $enabled = NULL;
969
+            }
970
+
971
+            echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
972
+
973
+                echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/>&nbsp;';
974
+
975
+                if ( wpinv_string_is_image_url( $key ) ) {
976
+                    echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
977
+                } else {
978
+                    $card = strtolower( str_replace( ' ', '', $option ) );
979
+
980
+                    if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
981
+                        $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
982
+                    } else {
983
+                        $image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
984
+                        $content_dir = WP_CONTENT_DIR;
985
+
986
+                        if ( function_exists( 'wp_normalize_path' ) ) {
987
+                            // Replaces backslashes with forward slashes for Windows systems
988
+                            $image = wp_normalize_path( $image );
989
+                            $content_dir = wp_normalize_path( $content_dir );
990
+                        }
991
+
992
+                        $image = str_replace( $content_dir, content_url(), $image );
993
+                    }
994
+
995
+                    echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
996
+                }
997
+            echo $option . '</label>';
998
+        }
999
+        echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
1000
+    }
1001 1001
 }
1002 1002
 
1003 1003
 function wpinv_radio_callback( $args ) {
1004
-	global $wpinv_options;
1004
+    global $wpinv_options;
1005 1005
     
1006 1006
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1007 1007
     
1008 1008
     foreach ( $args['options'] as $key => $option ) :
1009
-		$sanitize_key = wpinv_sanitize_key( $key );
1009
+        $sanitize_key = wpinv_sanitize_key( $key );
1010 1010
         
1011 1011
         $checked = false;
1012 1012
 
1013
-		if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key )
1014
-			$checked = true;
1015
-		elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) )
1016
-			$checked = true;
1013
+        if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key )
1014
+            $checked = true;
1015
+        elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) )
1016
+            $checked = true;
1017 1017
 
1018
-		echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/>&nbsp;';
1019
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>';
1020
-	endforeach;
1018
+        echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/>&nbsp;';
1019
+        echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>';
1020
+    endforeach;
1021 1021
 
1022
-	echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
1022
+    echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
1023 1023
 }
1024 1024
 
1025 1025
 function wpinv_gateways_callback( $args ) {
1026
-	global $wpinv_options;
1026
+    global $wpinv_options;
1027 1027
     
1028 1028
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1029 1029
 
1030
-	foreach ( $args['options'] as $key => $option ) :
1031
-		$sanitize_key = wpinv_sanitize_key( $key );
1030
+    foreach ( $args['options'] as $key => $option ) :
1031
+        $sanitize_key = wpinv_sanitize_key( $key );
1032 1032
         
1033 1033
         if ( isset( $wpinv_options['gateways'][ $key ] ) )
1034
-			$enabled = '1';
1035
-		else
1036
-			$enabled = null;
1034
+            $enabled = '1';
1035
+        else
1036
+            $enabled = null;
1037 1037
 
1038
-		echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/>&nbsp;';
1039
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
1040
-	endforeach;
1038
+        echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/>&nbsp;';
1039
+        echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
1040
+    endforeach;
1041 1041
 }
1042 1042
 
1043 1043
 function wpinv_gateway_select_callback($args) {
1044
-	global $wpinv_options;
1044
+    global $wpinv_options;
1045 1045
     
1046 1046
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1047 1047
 
1048
-	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']">';
1048
+    echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']">';
1049 1049
 
1050
-	foreach ( $args['options'] as $key => $option ) :
1051
-		if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
1050
+    foreach ( $args['options'] as $key => $option ) :
1051
+        if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
1052 1052
             $selected = selected( $key, $args['selected'], false );
1053 1053
         } else {
1054 1054
             $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : '';
1055 1055
         }
1056
-		echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1057
-	endforeach;
1056
+        echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1057
+    endforeach;
1058 1058
 
1059
-	echo '</select>';
1060
-	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1059
+    echo '</select>';
1060
+    echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1061 1061
 }
1062 1062
 
1063 1063
 function wpinv_text_callback( $args ) {
1064
-	global $wpinv_options;
1064
+    global $wpinv_options;
1065 1065
     
1066 1066
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1067 1067
 
1068
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1069
-		$value = $wpinv_options[ $args['id'] ];
1070
-	} else {
1071
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1072
-	}
1073
-
1074
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1075
-		$args['readonly'] = true;
1076
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1077
-		$name  = '';
1078
-	} else {
1079
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1080
-	}
1081
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
1082
-
1083
-	$readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
1084
-	$size     = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1085
-	$html     = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>';
1086
-	$html    .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1087
-
1088
-	echo $html;
1068
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1069
+        $value = $wpinv_options[ $args['id'] ];
1070
+    } else {
1071
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1072
+    }
1073
+
1074
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1075
+        $args['readonly'] = true;
1076
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1077
+        $name  = '';
1078
+    } else {
1079
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1080
+    }
1081
+    $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
1082
+
1083
+    $readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
1084
+    $size     = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1085
+    $html     = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>';
1086
+    $html    .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1087
+
1088
+    echo $html;
1089 1089
 }
1090 1090
 
1091 1091
 function wpinv_number_callback( $args ) {
1092
-	global $wpinv_options;
1092
+    global $wpinv_options;
1093 1093
     
1094 1094
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1095 1095
 
1096
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1097
-		$value = $wpinv_options[ $args['id'] ];
1098
-	} else {
1099
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1100
-	}
1101
-
1102
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1103
-		$args['readonly'] = true;
1104
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1105
-		$name  = '';
1106
-	} else {
1107
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1108
-	}
1109
-
1110
-	$max  = isset( $args['max'] ) ? $args['max'] : 999999;
1111
-	$min  = isset( $args['min'] ) ? $args['min'] : 0;
1112
-	$step = isset( $args['step'] ) ? $args['step'] : 1;
1113
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
1114
-
1115
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1116
-	$html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"/>';
1117
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1118
-
1119
-	echo $html;
1096
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1097
+        $value = $wpinv_options[ $args['id'] ];
1098
+    } else {
1099
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1100
+    }
1101
+
1102
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1103
+        $args['readonly'] = true;
1104
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1105
+        $name  = '';
1106
+    } else {
1107
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1108
+    }
1109
+
1110
+    $max  = isset( $args['max'] ) ? $args['max'] : 999999;
1111
+    $min  = isset( $args['min'] ) ? $args['min'] : 0;
1112
+    $step = isset( $args['step'] ) ? $args['step'] : 1;
1113
+    $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
1114
+
1115
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1116
+    $html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"/>';
1117
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1118
+
1119
+    echo $html;
1120 1120
 }
1121 1121
 
1122 1122
 function wpinv_textarea_callback( $args ) {
1123
-	global $wpinv_options;
1123
+    global $wpinv_options;
1124 1124
     
1125 1125
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1126 1126
 
1127
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1128
-		$value = $wpinv_options[ $args['id'] ];
1129
-	} else {
1130
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1131
-	}
1127
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1128
+        $value = $wpinv_options[ $args['id'] ];
1129
+    } else {
1130
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1131
+    }
1132 1132
     
1133 1133
     $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1134 1134
     $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text';
1135 1135
 
1136
-	$html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
1137
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1136
+    $html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
1137
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1138 1138
 
1139
-	echo $html;
1139
+    echo $html;
1140 1140
 }
1141 1141
 
1142 1142
 function wpinv_password_callback( $args ) {
1143
-	global $wpinv_options;
1143
+    global $wpinv_options;
1144 1144
     
1145 1145
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1146 1146
 
1147
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1148
-		$value = $wpinv_options[ $args['id'] ];
1149
-	} else {
1150
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1151
-	}
1147
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1148
+        $value = $wpinv_options[ $args['id'] ];
1149
+    } else {
1150
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1151
+    }
1152 1152
 
1153
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1154
-	$html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>';
1155
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1153
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1154
+    $html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>';
1155
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1156 1156
 
1157
-	echo $html;
1157
+    echo $html;
1158 1158
 }
1159 1159
 
1160 1160
 function wpinv_missing_callback($args) {
1161
-	printf(
1162
-		__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
1163
-		'<strong>' . $args['id'] . '</strong>'
1164
-	);
1161
+    printf(
1162
+        __( 'The callback function used for the %s setting is missing.', 'invoicing' ),
1163
+        '<strong>' . $args['id'] . '</strong>'
1164
+    );
1165 1165
 }
1166 1166
 
1167 1167
 function wpinv_select_callback($args) {
1168
-	global $wpinv_options;
1168
+    global $wpinv_options;
1169 1169
     
1170 1170
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1171 1171
 
1172
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1173
-		$value = $wpinv_options[ $args['id'] ];
1174
-	} else {
1175
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1176
-	}
1172
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1173
+        $value = $wpinv_options[ $args['id'] ];
1174
+    } else {
1175
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1176
+    }
1177 1177
     
1178 1178
     if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
1179 1179
         $value = $args['selected'];
1180 1180
     }
1181 1181
 
1182
-	if ( isset( $args['placeholder'] ) ) {
1183
-		$placeholder = $args['placeholder'];
1184
-	} else {
1185
-		$placeholder = '';
1186
-	}
1182
+    if ( isset( $args['placeholder'] ) ) {
1183
+        $placeholder = $args['placeholder'];
1184
+    } else {
1185
+        $placeholder = '';
1186
+    }
1187 1187
     
1188 1188
     if( !empty( $args['onchange'] ) ) {
1189 1189
         $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"';
@@ -1191,142 +1191,142 @@  discard block
 block discarded – undo
1191 1191
         $onchange = '';
1192 1192
     }
1193 1193
 
1194
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />';
1194
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />';
1195 1195
 
1196
-	foreach ( $args['options'] as $option => $name ) {
1197
-		$selected = selected( $option, $value, false );
1198
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
1199
-	}
1196
+    foreach ( $args['options'] as $option => $name ) {
1197
+        $selected = selected( $option, $value, false );
1198
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
1199
+    }
1200 1200
 
1201
-	$html .= '</select>';
1202
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1201
+    $html .= '</select>';
1202
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1203 1203
 
1204
-	echo $html;
1204
+    echo $html;
1205 1205
 }
1206 1206
 
1207 1207
 function wpinv_color_select_callback( $args ) {
1208
-	global $wpinv_options;
1208
+    global $wpinv_options;
1209 1209
     
1210 1210
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1211 1211
 
1212
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1213
-		$value = $wpinv_options[ $args['id'] ];
1214
-	} else {
1215
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1216
-	}
1212
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1213
+        $value = $wpinv_options[ $args['id'] ];
1214
+    } else {
1215
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1216
+    }
1217 1217
 
1218
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
1218
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
1219 1219
 
1220
-	foreach ( $args['options'] as $option => $color ) {
1221
-		$selected = selected( $option, $value, false );
1222
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
1223
-	}
1220
+    foreach ( $args['options'] as $option => $color ) {
1221
+        $selected = selected( $option, $value, false );
1222
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
1223
+    }
1224 1224
 
1225
-	$html .= '</select>';
1226
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1225
+    $html .= '</select>';
1226
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1227 1227
 
1228
-	echo $html;
1228
+    echo $html;
1229 1229
 }
1230 1230
 
1231 1231
 function wpinv_rich_editor_callback( $args ) {
1232
-	global $wpinv_options, $wp_version;
1232
+    global $wpinv_options, $wp_version;
1233 1233
     
1234 1234
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1235 1235
 
1236
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1237
-		$value = $wpinv_options[ $args['id'] ];
1236
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1237
+        $value = $wpinv_options[ $args['id'] ];
1238 1238
 
1239
-		if( empty( $args['allow_blank'] ) && empty( $value ) ) {
1240
-			$value = isset( $args['std'] ) ? $args['std'] : '';
1241
-		}
1242
-	} else {
1243
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1244
-	}
1239
+        if( empty( $args['allow_blank'] ) && empty( $value ) ) {
1240
+            $value = isset( $args['std'] ) ? $args['std'] : '';
1241
+        }
1242
+    } else {
1243
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1244
+    }
1245 1245
 
1246
-	$rows = isset( $args['size'] ) ? $args['size'] : 20;
1246
+    $rows = isset( $args['size'] ) ? $args['size'] : 20;
1247 1247
 
1248
-	if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
1249
-		ob_start();
1250
-		wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ) ) );
1251
-		$html = ob_get_clean();
1252
-	} else {
1253
-		$html = '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
1254
-	}
1248
+    if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
1249
+        ob_start();
1250
+        wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ) ) );
1251
+        $html = ob_get_clean();
1252
+    } else {
1253
+        $html = '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
1254
+    }
1255 1255
 
1256
-	$html .= '<br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1256
+    $html .= '<br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1257 1257
 
1258
-	echo $html;
1258
+    echo $html;
1259 1259
 }
1260 1260
 
1261 1261
 function wpinv_upload_callback( $args ) {
1262
-	global $wpinv_options;
1262
+    global $wpinv_options;
1263 1263
     
1264 1264
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1265 1265
 
1266
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1267
-		$value = $wpinv_options[$args['id']];
1268
-	} else {
1269
-		$value = isset($args['std']) ? $args['std'] : '';
1270
-	}
1266
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1267
+        $value = $wpinv_options[$args['id']];
1268
+    } else {
1269
+        $value = isset($args['std']) ? $args['std'] : '';
1270
+    }
1271 1271
 
1272
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1273
-	$html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
1274
-	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
1275
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1272
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1273
+    $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
1274
+    $html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
1275
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1276 1276
 
1277
-	echo $html;
1277
+    echo $html;
1278 1278
 }
1279 1279
 
1280 1280
 function wpinv_color_callback( $args ) {
1281
-	global $wpinv_options;
1281
+    global $wpinv_options;
1282 1282
     
1283 1283
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1284 1284
 
1285
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1286
-		$value = $wpinv_options[ $args['id'] ];
1287
-	} else {
1288
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1289
-	}
1285
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1286
+        $value = $wpinv_options[ $args['id'] ];
1287
+    } else {
1288
+        $value = isset( $args['std'] ) ? $args['std'] : '';
1289
+    }
1290 1290
 
1291
-	$default = isset( $args['std'] ) ? $args['std'] : '';
1291
+    $default = isset( $args['std'] ) ? $args['std'] : '';
1292 1292
 
1293
-	$html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $default ) . '" />';
1294
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1293
+    $html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $default ) . '" />';
1294
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1295 1295
 
1296
-	echo $html;
1296
+    echo $html;
1297 1297
 }
1298 1298
 
1299 1299
 function wpinv_country_states_callback($args) {
1300
-	global $wpinv_options;
1300
+    global $wpinv_options;
1301 1301
     
1302 1302
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
1303 1303
 
1304
-	if ( isset( $args['placeholder'] ) ) {
1305
-		$placeholder = $args['placeholder'];
1306
-	} else {
1307
-		$placeholder = '';
1308
-	}
1304
+    if ( isset( $args['placeholder'] ) ) {
1305
+        $placeholder = $args['placeholder'];
1306
+    } else {
1307
+        $placeholder = '';
1308
+    }
1309 1309
 
1310
-	$states = wpinv_get_country_states();
1310
+    $states = wpinv_get_country_states();
1311 1311
 
1312
-	$class = empty( $states ) ? ' class="wpinv-no-states"' : '';
1313
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
1312
+    $class = empty( $states ) ? ' class="wpinv-no-states"' : '';
1313
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
1314 1314
 
1315
-	foreach ( $states as $option => $name ) {
1316
-		$selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : '';
1317
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
1318
-	}
1315
+    foreach ( $states as $option => $name ) {
1316
+        $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : '';
1317
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
1318
+    }
1319 1319
 
1320
-	$html .= '</select>';
1321
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1320
+    $html .= '</select>';
1321
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1322 1322
 
1323
-	echo $html;
1323
+    echo $html;
1324 1324
 }
1325 1325
 
1326 1326
 function wpinv_tax_rates_callback($args) {
1327
-	global $wpinv_options;
1328
-	$rates = wpinv_get_tax_rates();
1329
-	ob_start(); ?>
1327
+    global $wpinv_options;
1328
+    $rates = wpinv_get_tax_rates();
1329
+    ob_start(); ?>
1330 1330
     </td><tr>
1331 1331
     <td colspan="2" class="wpinv_tax_tdbox">
1332 1332
 	<p><?php echo $args['desc']; ?></p>
@@ -1350,39 +1350,39 @@  discard block
 block discarded – undo
1350 1350
 			<tr>
1351 1351
 				<td class="wpinv_tax_country">
1352 1352
 					<?php
1353
-					echo wpinv_html_select( array(
1354
-						'options'          => wpinv_get_country_list( true ),
1355
-						'name'             => 'tax_rates[' . $sanitized_key . '][country]',
1353
+                    echo wpinv_html_select( array(
1354
+                        'options'          => wpinv_get_country_list( true ),
1355
+                        'name'             => 'tax_rates[' . $sanitized_key . '][country]',
1356 1356
                         'id'               => 'tax_rates[' . $sanitized_key . '][country]',
1357
-						'selected'         => $rate['country'],
1358
-						'show_option_all'  => false,
1359
-						'show_option_none' => false,
1360
-						'class'            => 'wpinv-tax-country',
1361
-						'placeholder'      => __( 'Choose a country', 'invoicing' )
1362
-					) );
1363
-					?>
1357
+                        'selected'         => $rate['country'],
1358
+                        'show_option_all'  => false,
1359
+                        'show_option_none' => false,
1360
+                        'class'            => 'wpinv-tax-country',
1361
+                        'placeholder'      => __( 'Choose a country', 'invoicing' )
1362
+                    ) );
1363
+                    ?>
1364 1364
 				</td>
1365 1365
 				<td class="wpinv_tax_state">
1366 1366
 					<?php
1367
-					$states = wpinv_get_country_states( $rate['country'] );
1368
-					if( !empty( $states ) ) {
1369
-						echo wpinv_html_select( array(
1370
-							'options'          => array_merge( array( '' => '' ), $states ),
1371
-							'name'             => 'tax_rates[' . $sanitized_key . '][state]',
1367
+                    $states = wpinv_get_country_states( $rate['country'] );
1368
+                    if( !empty( $states ) ) {
1369
+                        echo wpinv_html_select( array(
1370
+                            'options'          => array_merge( array( '' => '' ), $states ),
1371
+                            'name'             => 'tax_rates[' . $sanitized_key . '][state]',
1372 1372
                             'id'               => 'tax_rates[' . $sanitized_key . '][state]',
1373
-							'selected'         => $rate['state'],
1374
-							'show_option_all'  => false,
1375
-							'show_option_none' => false,
1376
-							'placeholder'      => __( 'Choose a state', 'invoicing' )
1377
-						) );
1378
-					} else {
1379
-						echo wpinv_html_text( array(
1380
-							'name'  => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'],
1381
-							'value' => ! empty( $rate['state'] ) ? $rate['state'] : '',
1373
+                            'selected'         => $rate['state'],
1374
+                            'show_option_all'  => false,
1375
+                            'show_option_none' => false,
1376
+                            'placeholder'      => __( 'Choose a state', 'invoicing' )
1377
+                        ) );
1378
+                    } else {
1379
+                        echo wpinv_html_text( array(
1380
+                            'name'  => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'],
1381
+                            'value' => ! empty( $rate['state'] ) ? $rate['state'] : '',
1382 1382
                             'id'    => 'tax_rates[' . $sanitized_key . '][state]',
1383
-						) );
1384
-					}
1385
-					?>
1383
+                        ) );
1384
+                    }
1385
+                    ?>
1386 1386
 				</td>
1387 1387
 				<td class="wpinv_tax_global">
1388 1388
 					<input type="checkbox" name="tax_rates[<?php echo $sanitized_key; ?>][global]" id="tax_rates[<?php echo $sanitized_key; ?>][global]" value="1"<?php checked( true, ! empty( $rate['global'] ) ); ?>/>
@@ -1397,19 +1397,19 @@  discard block
 block discarded – undo
1397 1397
 			<tr>
1398 1398
 				<td class="wpinv_tax_country">
1399 1399
 					<?php
1400
-					echo wpinv_html_select( array(
1401
-						'options'          => wpinv_get_country_list( true ),
1402
-						'name'             => 'tax_rates[0][country]',
1403
-						'show_option_all'  => false,
1404
-						'show_option_none' => false,
1405
-						'class'            => 'wpinv-tax-country',
1406
-						'placeholder'      => __( 'Choose a country', 'invoicing' )
1407
-					) ); ?>
1400
+                    echo wpinv_html_select( array(
1401
+                        'options'          => wpinv_get_country_list( true ),
1402
+                        'name'             => 'tax_rates[0][country]',
1403
+                        'show_option_all'  => false,
1404
+                        'show_option_none' => false,
1405
+                        'class'            => 'wpinv-tax-country',
1406
+                        'placeholder'      => __( 'Choose a country', 'invoicing' )
1407
+                    ) ); ?>
1408 1408
 				</td>
1409 1409
 				<td class="wpinv_tax_state">
1410 1410
 					<?php echo wpinv_html_text( array(
1411
-						'name' => 'tax_rates[0][state]'
1412
-					) ); ?>
1411
+                        'name' => 'tax_rates[0][state]'
1412
+                    ) ); ?>
1413 1413
 				</td>
1414 1414
 				<td class="wpinv_tax_global">
1415 1415
 					<input type="checkbox" name="tax_rates[0][global]" id="tax_rates[0][global]" value="1"/>
@@ -1424,7 +1424,7 @@  discard block
 block discarded – undo
1424 1424
         <tfoot><tr><td colspan="5"></td><td class="wpinv_tax_action"><span class="button-secondary" id="wpinv_add_tax_rate"><?php _e( 'Add Tax Rate', 'invoicing' ); ?></span></td></tr></tfoot>
1425 1425
 	</table>
1426 1426
 	<?php
1427
-	echo ob_get_clean();
1427
+    echo ob_get_clean();
1428 1428
 }
1429 1429
 
1430 1430
 function wpinv_tools_callback($args) {
@@ -1452,15 +1452,15 @@  discard block
 block discarded – undo
1452 1452
 }
1453 1453
 
1454 1454
 function wpinv_descriptive_text_callback( $args ) {
1455
-	echo wp_kses_post( $args['desc'] );
1455
+    echo wp_kses_post( $args['desc'] );
1456 1456
 }
1457 1457
 
1458 1458
 function wpinv_hook_callback( $args ) {
1459
-	do_action( 'wpinv_' . $args['id'], $args );
1459
+    do_action( 'wpinv_' . $args['id'], $args );
1460 1460
 }
1461 1461
 
1462 1462
 function wpinv_set_settings_cap() {
1463
-	return 'manage_options';
1463
+    return 'manage_options';
1464 1464
 }
1465 1465
 add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' );
1466 1466
 
Please login to merge, or discard this patch.
Spacing   +506 added lines, -506 removed lines patch added patch discarded remove patch
@@ -1,66 +1,66 @@  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_get_option( $key = '', $default = false ) {
7
+function wpinv_get_option($key = '', $default = false) {
8 8
     global $wpinv_options;
9 9
 
10
-    $value = isset( $wpinv_options[ $key ] ) ? $wpinv_options[ $key ] : $default;
11
-    $value = apply_filters( 'wpinv_get_option', $value, $key, $default );
10
+    $value = isset($wpinv_options[$key]) ? $wpinv_options[$key] : $default;
11
+    $value = apply_filters('wpinv_get_option', $value, $key, $default);
12 12
 
13
-    return apply_filters( 'wpinv_get_option_' . $key, $value, $key, $default );
13
+    return apply_filters('wpinv_get_option_' . $key, $value, $key, $default);
14 14
 }
15 15
 
16
-function wpinv_update_option( $key = '', $value = false ) {
16
+function wpinv_update_option($key = '', $value = false) {
17 17
     // If no key, exit
18
-    if ( empty( $key ) ) {
18
+    if (empty($key)) {
19 19
         return false;
20 20
     }
21 21
 
22
-    if ( empty( $value ) ) {
23
-        $remove_option = wpinv_delete_option( $key );
22
+    if (empty($value)) {
23
+        $remove_option = wpinv_delete_option($key);
24 24
         return $remove_option;
25 25
     }
26 26
 
27 27
     // First let's grab the current settings
28
-    $options = get_option( 'wpinv_settings' );
28
+    $options = get_option('wpinv_settings');
29 29
 
30 30
     // Let other plugin alter the value
31
-    $value = apply_filters( 'wpinv_update_option', $value, $key );
31
+    $value = apply_filters('wpinv_update_option', $value, $key);
32 32
 
33 33
     // Next let's try to update the value
34
-    $options[ $key ] = $value;
35
-    $did_update = update_option( 'wpinv_settings', $options );
34
+    $options[$key] = $value;
35
+    $did_update = update_option('wpinv_settings', $options);
36 36
 
37 37
     // If it's updated, let's update the global variable
38
-    if ( $did_update ) {
38
+    if ($did_update) {
39 39
         global $wpinv_options;
40
-        $wpinv_options[ $key ] = $value;
40
+        $wpinv_options[$key] = $value;
41 41
     }
42 42
 
43 43
     return $did_update;
44 44
 }
45 45
 
46
-function wpinv_delete_option( $key = '' ) {
46
+function wpinv_delete_option($key = '') {
47 47
     // If no key, exit
48
-    if ( empty( $key ) ) {
48
+    if (empty($key)) {
49 49
         return false;
50 50
     }
51 51
 
52 52
     // First let's grab the current settings
53
-    $options = get_option( 'wpinv_settings' );
53
+    $options = get_option('wpinv_settings');
54 54
 
55 55
     // Next let's try to update the value
56
-    if( isset( $options[ $key ] ) ) {
57
-        unset( $options[ $key ] );
56
+    if (isset($options[$key])) {
57
+        unset($options[$key]);
58 58
     }
59 59
 
60
-    $did_update = update_option( 'wpinv_settings', $options );
60
+    $did_update = update_option('wpinv_settings', $options);
61 61
 
62 62
     // If it updated, let's update the global variable
63
-    if ( $did_update ){
63
+    if ($did_update) {
64 64
         global $wpinv_options;
65 65
         $wpinv_options = $options;
66 66
     }
@@ -69,37 +69,37 @@  discard block
 block discarded – undo
69 69
 }
70 70
 
71 71
 function wpinv_get_settings() {
72
-    $settings = get_option( 'wpinv_settings' );
72
+    $settings = get_option('wpinv_settings');
73 73
 
74
-    if ( empty( $settings ) ) {
74
+    if (empty($settings)) {
75 75
         // Update old settings with new single option
76
-        $general_settings   = is_array( get_option( 'wpinv_settings_general' ) )    ? get_option( 'wpinv_settings_general' )    : array();
77
-        $gateways_settings  = is_array( get_option( 'wpinv_settings_gateways' ) )   ? get_option( 'wpinv_settings_gateways' )   : array();
78
-        $email_settings     = is_array( get_option( 'wpinv_settings_emails' ) )     ? get_option( 'wpinv_settings_emails' )     : array();
79
-        $tax_settings       = is_array( get_option( 'wpinv_settings_taxes' ) )      ? get_option( 'wpinv_settings_taxes' )      : array();
80
-        $misc_settings      = is_array( get_option( 'wpinv_settings_misc' ) )       ? get_option( 'wpinv_settings_misc' )       : array();
81
-        $tool_settings      = is_array( get_option( 'wpinv_settings_tools' ) )      ? get_option( 'wpinv_settings_tools' )      : array();
76
+        $general_settings   = is_array(get_option('wpinv_settings_general')) ? get_option('wpinv_settings_general') : array();
77
+        $gateways_settings  = is_array(get_option('wpinv_settings_gateways')) ? get_option('wpinv_settings_gateways') : array();
78
+        $email_settings     = is_array(get_option('wpinv_settings_emails')) ? get_option('wpinv_settings_emails') : array();
79
+        $tax_settings       = is_array(get_option('wpinv_settings_taxes')) ? get_option('wpinv_settings_taxes') : array();
80
+        $misc_settings      = is_array(get_option('wpinv_settings_misc')) ? get_option('wpinv_settings_misc') : array();
81
+        $tool_settings      = is_array(get_option('wpinv_settings_tools')) ? get_option('wpinv_settings_tools') : array();
82 82
 
83
-        $settings = array_merge( $general_settings, $gateways_settings, $tax_settings, $tool_settings );
83
+        $settings = array_merge($general_settings, $gateways_settings, $tax_settings, $tool_settings);
84 84
 
85
-        update_option( 'wpinv_settings', $settings );
85
+        update_option('wpinv_settings', $settings);
86 86
 
87 87
     }
88
-    return apply_filters( 'wpinv_get_settings', $settings );
88
+    return apply_filters('wpinv_get_settings', $settings);
89 89
 }
90 90
 
91 91
 function wpinv_register_settings() {
92
-    if ( false == get_option( 'wpinv_settings' ) ) {
93
-        add_option( 'wpinv_settings' );
92
+    if (false == get_option('wpinv_settings')) {
93
+        add_option('wpinv_settings');
94 94
     }
95 95
     
96 96
     $register_settings = wpinv_get_registered_settings();
97 97
     
98
-    foreach ( $register_settings as $tab => $sections ) {
99
-        foreach ( $sections as $section => $settings) {
98
+    foreach ($register_settings as $tab => $sections) {
99
+        foreach ($sections as $section => $settings) {
100 100
             // Check for backwards compatibility
101
-            $section_tabs = wpinv_get_settings_tab_sections( $tab );
102
-            if ( ! is_array( $section_tabs ) || ! array_key_exists( $section, $section_tabs ) ) {
101
+            $section_tabs = wpinv_get_settings_tab_sections($tab);
102
+            if (!is_array($section_tabs) || !array_key_exists($section, $section_tabs)) {
103 103
                 $section = 'main';
104 104
                 $settings = $sections;
105 105
             }
@@ -111,41 +111,41 @@  discard block
 block discarded – undo
111 111
                 'wpinv_settings_' . $tab . '_' . $section
112 112
             );
113 113
 
114
-            foreach ( $settings as $option ) {
114
+            foreach ($settings as $option) {
115 115
                 // For backwards compatibility
116
-                if ( empty( $option['id'] ) ) {
116
+                if (empty($option['id'])) {
117 117
                     continue;
118 118
                 }
119 119
 
120
-                $name = isset( $option['name'] ) ? $option['name'] : '';
120
+                $name = isset($option['name']) ? $option['name'] : '';
121 121
 
122 122
                 add_settings_field(
123 123
                     'wpinv_settings[' . $option['id'] . ']',
124 124
                     $name,
125
-                    function_exists( 'wpinv_' . $option['type'] . '_callback' ) ? 'wpinv_' . $option['type'] . '_callback' : 'wpinv_missing_callback',
125
+                    function_exists('wpinv_' . $option['type'] . '_callback') ? 'wpinv_' . $option['type'] . '_callback' : 'wpinv_missing_callback',
126 126
                     'wpinv_settings_' . $tab . '_' . $section,
127 127
                     'wpinv_settings_' . $tab . '_' . $section,
128 128
                     array(
129 129
                         'section'     => $section,
130
-                        'id'          => isset( $option['id'] )          ? $option['id']          : null,
131
-                        'desc'        => ! empty( $option['desc'] )      ? $option['desc']        : '',
132
-                        'name'        => isset( $option['name'] )        ? $option['name']        : null,
133
-                        'size'        => isset( $option['size'] )        ? $option['size']        : null,
134
-                        'options'     => isset( $option['options'] )     ? $option['options']     : '',
135
-                        'selected'    => isset( $option['selected'] )    ? $option['selected']    : null,
136
-                        'std'         => isset( $option['std'] )         ? $option['std']         : '',
137
-                        'min'         => isset( $option['min'] )         ? $option['min']         : null,
138
-                        'max'         => isset( $option['max'] )         ? $option['max']         : null,
139
-                        'step'        => isset( $option['step'] )        ? $option['step']        : null,
140
-                        'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : null,
141
-                        'allow_blank' => isset( $option['allow_blank'] ) ? $option['allow_blank'] : true,
142
-                        'readonly'    => isset( $option['readonly'] )    ? $option['readonly']    : false,
143
-                        'faux'        => isset( $option['faux'] )        ? $option['faux']        : false,
144
-                        'onchange'    => !empty( $option['onchange'] )   ? $option['onchange']    : '',
145
-                        'custom'      => !empty( $option['custom'] )     ? $option['custom']      : '',
146
-                        'class'       =>  !empty( $option['class'] )     ? $option['class']      : '',
147
-                        'cols'        => !empty( $option['cols'] ) && (int)$option['cols'] > 0 ? (int)$option['cols'] : 50,
148
-                        'rows'        => !empty( $option['rows'] ) && (int)$option['rows'] > 0 ? (int)$option['rows'] : 5,
130
+                        'id'          => isset($option['id']) ? $option['id'] : null,
131
+                        'desc'        => !empty($option['desc']) ? $option['desc'] : '',
132
+                        'name'        => isset($option['name']) ? $option['name'] : null,
133
+                        'size'        => isset($option['size']) ? $option['size'] : null,
134
+                        'options'     => isset($option['options']) ? $option['options'] : '',
135
+                        'selected'    => isset($option['selected']) ? $option['selected'] : null,
136
+                        'std'         => isset($option['std']) ? $option['std'] : '',
137
+                        'min'         => isset($option['min']) ? $option['min'] : null,
138
+                        'max'         => isset($option['max']) ? $option['max'] : null,
139
+                        'step'        => isset($option['step']) ? $option['step'] : null,
140
+                        'placeholder' => isset($option['placeholder']) ? $option['placeholder'] : null,
141
+                        'allow_blank' => isset($option['allow_blank']) ? $option['allow_blank'] : true,
142
+                        'readonly'    => isset($option['readonly']) ? $option['readonly'] : false,
143
+                        'faux'        => isset($option['faux']) ? $option['faux'] : false,
144
+                        'onchange'    => !empty($option['onchange']) ? $option['onchange'] : '',
145
+                        'custom'      => !empty($option['custom']) ? $option['custom'] : '',
146
+                        'class'       =>  !empty($option['class']) ? $option['class'] : '',
147
+                        'cols'        => !empty($option['cols']) && (int)$option['cols'] > 0 ? (int)$option['cols'] : 50,
148
+                        'rows'        => !empty($option['rows']) && (int)$option['rows'] > 0 ? (int)$option['rows'] : 5,
149 149
                     )
150 150
                 );
151 151
             }
@@ -153,174 +153,174 @@  discard block
 block discarded – undo
153 153
     }
154 154
 
155 155
     // Creates our settings in the options table
156
-    register_setting( 'wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize' );
156
+    register_setting('wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize');
157 157
 }
158
-add_action( 'admin_init', 'wpinv_register_settings' );
158
+add_action('admin_init', 'wpinv_register_settings');
159 159
 
160 160
 function wpinv_get_registered_settings() {
161
-    $pages = wpinv_get_pages( true );
161
+    $pages = wpinv_get_pages(true);
162 162
     
163 163
     $currencies = wpinv_get_currencies();
164 164
     
165 165
     $currency_code_options = array();
166
-    foreach ( $currencies as $code => $name ) {
167
-        $currency_code_options[ $code ] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol( $code ) . ')';
166
+    foreach ($currencies as $code => $name) {
167
+        $currency_code_options[$code] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol($code) . ')';
168 168
     }
169 169
     
170 170
     $due_payment_options       = array();
171
-    $due_payment_options[0]    = __( 'Now', 'invoicing' );
172
-    for ( $i = 1; $i <= 30; $i++ ) {
171
+    $due_payment_options[0]    = __('Now', 'invoicing');
172
+    for ($i = 1; $i <= 30; $i++) {
173 173
         $due_payment_options[$i] = $i;
174 174
     }
175 175
     
176 176
     $invoice_number_padd_options = array();
177
-    for ( $i = 0; $i <= 20; $i++ ) {
177
+    for ($i = 0; $i <= 20; $i++) {
178 178
         $invoice_number_padd_options[$i] = $i;
179 179
     }
180 180
     
181 181
     $currency_symbol = wpinv_currency_symbol();
182 182
     
183 183
     $last_number = '';
184
-    if ( $last_invoice_number = get_option( 'wpinv_last_invoice_number' ) ) {
185
-        $last_invoice_number = is_numeric( $last_invoice_number ) ? $last_invoice_number : wpinv_clean_invoice_number( $last_invoice_number );
184
+    if ($last_invoice_number = get_option('wpinv_last_invoice_number')) {
185
+        $last_invoice_number = is_numeric($last_invoice_number) ? $last_invoice_number : wpinv_clean_invoice_number($last_invoice_number);
186 186
 
187
-        if ( !empty( $last_invoice_number ) ) {
188
-            $last_number = ' ' . wp_sprintf( __( "( Last Invoice's sequential number: <b>%s</b> )", 'invoicing' ), $last_invoice_number );
187
+        if (!empty($last_invoice_number)) {
188
+            $last_number = ' ' . wp_sprintf(__("( Last Invoice's sequential number: <b>%s</b> )", 'invoicing'), $last_invoice_number);
189 189
         }
190 190
     }
191 191
     
192 192
     $alert_wrapper_start = '<p style="color: #F00">';
193 193
     $alert_wrapper_close = '</p>';
194 194
     $wpinv_settings = array(
195
-        'general' => apply_filters( 'wpinv_settings_general',
195
+        'general' => apply_filters('wpinv_settings_general',
196 196
             array(
197 197
                 'main' => array(
198 198
                     'location_settings' => array(
199 199
                         'id'   => 'location_settings',
200
-                        'name' => '<h3>' . __( 'Default Location', 'invoicing' ) . '</h3>',
200
+                        'name' => '<h3>' . __('Default Location', 'invoicing') . '</h3>',
201 201
                         'desc' => '',
202 202
                         'type' => 'header',
203 203
                     ),
204 204
                     'default_country' => array(
205 205
                         'id'      => 'default_country',
206
-                        'name'    => __( 'Default Country', 'invoicing' ),
207
-                        'desc'    => __( 'Where does your store operate from?', 'invoicing' ),
206
+                        'name'    => __('Default Country', 'invoicing'),
207
+                        'desc'    => __('Where does your store operate from?', 'invoicing'),
208 208
                         'type'    => 'select',
209 209
                         'options' => wpinv_get_country_list(),
210 210
                         'std'     => 'GB',
211
-                        'placeholder' => __( 'Select a country', 'invoicing' ),
211
+                        'placeholder' => __('Select a country', 'invoicing'),
212 212
                     ),
213 213
                     'default_state' => array(
214 214
                         'id'      => 'default_state',
215
-                        'name'    => __( 'Default State / Province', 'invoicing' ),
216
-                        'desc'    => __( 'What state / province does your store operate from?', 'invoicing' ),
215
+                        'name'    => __('Default State / Province', 'invoicing'),
216
+                        'desc'    => __('What state / province does your store operate from?', 'invoicing'),
217 217
                         'type'    => 'country_states',
218
-                        'placeholder' => __( 'Select a state', 'invoicing' ),
218
+                        'placeholder' => __('Select a state', 'invoicing'),
219 219
                     ),
220 220
                     'store_name' => array(
221 221
                         'id'   => 'store_name',
222
-                        'name' => __( 'Store Name', 'invoicing' ),
223
-                        'desc' => __( 'Store name to print on invoices.', 'invoicing' ),
222
+                        'name' => __('Store Name', 'invoicing'),
223
+                        'desc' => __('Store name to print on invoices.', 'invoicing'),
224 224
                         'std'     => get_option('blogname'),
225 225
                         'type' => 'text',
226 226
                     ),
227 227
                     'logo' => array(
228 228
                         'id'   => 'logo',
229
-                        'name' => __( 'Logo URL', 'invoicing' ),
230
-                        'desc' => __( 'Store logo to print on invoices.', 'invoicing' ),
229
+                        'name' => __('Logo URL', 'invoicing'),
230
+                        'desc' => __('Store logo to print on invoices.', 'invoicing'),
231 231
                         'type' => 'text',
232 232
                     ),
233 233
                     'store_address' => array(
234 234
                         'id'   => 'store_address',
235
-                        'name' => __( 'Store Address', 'invoicing' ),
236
-                        'desc' => __( 'Enter the store address to display on invoice', 'invoicing' ),
235
+                        'name' => __('Store Address', 'invoicing'),
236
+                        'desc' => __('Enter the store address to display on invoice', 'invoicing'),
237 237
                         'type' => 'textarea',
238 238
                     ),
239 239
                     'page_settings' => array(
240 240
                         'id'   => 'page_settings',
241
-                        'name' => '<h3>' . __( 'Page Settings', 'invoicing' ) . '</h3>',
241
+                        'name' => '<h3>' . __('Page Settings', 'invoicing') . '</h3>',
242 242
                         'desc' => '',
243 243
                         'type' => 'header',
244 244
                     ),
245 245
                     'checkout_page' => array(
246 246
                         'id'          => 'checkout_page',
247
-                        'name'        => __( 'Checkout Page', 'invoicing' ),
248
-                        'desc'        => __( 'This is the checkout page where buyers will complete their payments. The <b>[wpinv_checkout]</b> short code must be on this page.', 'invoicing' ),
247
+                        'name'        => __('Checkout Page', 'invoicing'),
248
+                        'desc'        => __('This is the checkout page where buyers will complete their payments. The <b>[wpinv_checkout]</b> short code must be on this page.', 'invoicing'),
249 249
                         'type'        => 'select',
250 250
                         'options'     => $pages,
251
-                        'placeholder' => __( 'Select a page', 'invoicing' ),
251
+                        'placeholder' => __('Select a page', 'invoicing'),
252 252
                     ),
253 253
                     'success_page' => array(
254 254
                         'id'          => 'success_page',
255
-                        'name'        => __( 'Success Page', 'invoicing' ),
256
-                        'desc'        => __( 'This is the page buyers are sent to after completing their payments. The <b>[wpinv_receipt]</b> short code should be on this page.', 'invoicing' ),
255
+                        'name'        => __('Success Page', 'invoicing'),
256
+                        'desc'        => __('This is the page buyers are sent to after completing their payments. The <b>[wpinv_receipt]</b> short code should be on this page.', 'invoicing'),
257 257
                         'type'        => 'select',
258 258
                         'options'     => $pages,
259
-                        'placeholder' => __( 'Select a page', 'invoicing' ),
259
+                        'placeholder' => __('Select a page', 'invoicing'),
260 260
                     ),
261 261
                     'failure_page' => array(
262 262
                         'id'          => 'failure_page',
263
-                        'name'        => __( 'Failed Transaction Page', 'invoicing' ),
264
-                        'desc'        => __( 'This is the page buyers are sent to if their transaction is cancelled or fails', 'invoicing' ),
263
+                        'name'        => __('Failed Transaction Page', 'invoicing'),
264
+                        'desc'        => __('This is the page buyers are sent to if their transaction is cancelled or fails', 'invoicing'),
265 265
                         'type'        => 'select',
266 266
                         'options'     => $pages,
267
-                        'placeholder' => __( 'Select a page', 'invoicing' ),
267
+                        'placeholder' => __('Select a page', 'invoicing'),
268 268
                     ),
269 269
                     'invoice_history_page' => array(
270 270
                         'id'          => 'invoice_history_page',
271
-                        'name'        => __( 'Invoice History Page', 'invoicing' ),
272
-                        'desc'        => __( 'This page shows an invoice history for the current user', 'invoicing' ),
271
+                        'name'        => __('Invoice History Page', 'invoicing'),
272
+                        'desc'        => __('This page shows an invoice history for the current user', 'invoicing'),
273 273
                         'type'        => 'select',
274 274
                         'options'     => $pages,
275
-                        'placeholder' => __( 'Select a page', 'invoicing' ),
275
+                        'placeholder' => __('Select a page', 'invoicing'),
276 276
                     )
277 277
                 ),
278 278
                 'currency_section' => array(
279 279
                     'currency_settings' => array(
280 280
                         'id'   => 'currency_settings',
281
-                        'name' => '<h3>' . __( 'Currency Settings', 'invoicing' ) . '</h3>',
281
+                        'name' => '<h3>' . __('Currency Settings', 'invoicing') . '</h3>',
282 282
                         'desc' => '',
283 283
                         'type' => 'header',
284 284
                     ),
285 285
                     'currency' => array(
286 286
                         'id'      => 'currency',
287
-                        'name'    => __( 'Currency', 'invoicing' ),
288
-                        'desc'    => __( 'Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing' ),
287
+                        'name'    => __('Currency', 'invoicing'),
288
+                        'desc'    => __('Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing'),
289 289
                         'type'    => 'select',
290 290
                         'options' => $currency_code_options,
291 291
                     ),
292 292
                     'currency_position' => array(
293 293
                         'id'      => 'currency_position',
294
-                        'name'    => __( 'Currency Position', 'invoicing' ),
295
-                        'desc'    => __( 'Choose the location of the currency sign.', 'invoicing' ),
294
+                        'name'    => __('Currency Position', 'invoicing'),
295
+                        'desc'    => __('Choose the location of the currency sign.', 'invoicing'),
296 296
                         'type'    => 'select',
297 297
                         'options'  => array(
298
-                            'left'        => __( 'Left', 'invoicing' ) . ' (' . $currency_symbol . wpinv_format_amount( '99.99' ) . ')',
299
-                            'right'       => __( 'Right', 'invoicing' ) . ' ('. wpinv_format_amount( '99.99' ) . $currency_symbol . ')',
300
-                            'left_space'  => __( 'Left with space', 'invoicing' ) . ' (' . $currency_symbol . ' ' . wpinv_format_amount( '99.99' ) . ')',
301
-                            'right_space' => __( 'Right with space', 'invoicing' ) . ' (' . wpinv_format_amount( '99.99' ) . ' ' . $currency_symbol . ')'
298
+                            'left'        => __('Left', 'invoicing') . ' (' . $currency_symbol . wpinv_format_amount('99.99') . ')',
299
+                            'right'       => __('Right', 'invoicing') . ' (' . wpinv_format_amount('99.99') . $currency_symbol . ')',
300
+                            'left_space'  => __('Left with space', 'invoicing') . ' (' . $currency_symbol . ' ' . wpinv_format_amount('99.99') . ')',
301
+                            'right_space' => __('Right with space', 'invoicing') . ' (' . wpinv_format_amount('99.99') . ' ' . $currency_symbol . ')'
302 302
                         )
303 303
                     ),
304 304
                     'thousands_separator' => array(
305 305
                         'id'   => 'thousands_separator',
306
-                        'name' => __( 'Thousands Separator', 'invoicing' ),
307
-                        'desc' => __( 'The symbol (usually , or .) to separate thousands', 'invoicing' ),
306
+                        'name' => __('Thousands Separator', 'invoicing'),
307
+                        'desc' => __('The symbol (usually , or .) to separate thousands', 'invoicing'),
308 308
                         'type' => 'text',
309 309
                         'size' => 'small',
310 310
                         'std'  => ',',
311 311
                     ),
312 312
                     'decimal_separator' => array(
313 313
                         'id'   => 'decimal_separator',
314
-                        'name' => __( 'Decimal Separator', 'invoicing' ),
315
-                        'desc' => __( 'The symbol (usually , or .) to separate decimal points', 'invoicing' ),
314
+                        'name' => __('Decimal Separator', 'invoicing'),
315
+                        'desc' => __('The symbol (usually , or .) to separate decimal points', 'invoicing'),
316 316
                         'type' => 'text',
317 317
                         'size' => 'small',
318 318
                         'std'  => '.',
319 319
                     ),
320 320
                     'decimals' => array(
321 321
                         'id'   => 'decimals',
322
-                        'name' => __( 'Number of Decimals', 'invoicing' ),
323
-                        'desc' => __( 'This sets the number of decimal points shown in displayed prices.', 'invoicing' ),
322
+                        'name' => __('Number of Decimals', 'invoicing'),
323
+                        'desc' => __('This sets the number of decimal points shown in displayed prices.', 'invoicing'),
324 324
                         'type' => 'number',
325 325
                         'size' => 'small',
326 326
                         'std'  => '2',
@@ -332,29 +332,29 @@  discard block
 block discarded – undo
332 332
                 'labels' => array(
333 333
                     'labels' => array(
334 334
                         'id'   => 'labels_settings',
335
-                        'name' => '<h3>' . __( 'Invoice Labels', 'invoicing' ) . '</h3>',
335
+                        'name' => '<h3>' . __('Invoice Labels', 'invoicing') . '</h3>',
336 336
                         'desc' => '',
337 337
                         'type' => 'header',
338 338
                     ),
339 339
                     'vat_name' => array(
340 340
                         'id' => 'vat_name',
341
-                        'name' => __( 'VAT Name', 'invoicing' ),
342
-                        'desc' => __( 'Enter the VAT name', 'invoicing' ),
341
+                        'name' => __('VAT Name', 'invoicing'),
342
+                        'desc' => __('Enter the VAT name', 'invoicing'),
343 343
                         'type' => 'text',
344 344
                         'size' => 'regular',
345 345
                         'std' => 'VAT'
346 346
                     ),
347 347
                     'vat_invoice_notice_label' => array(
348 348
                         'id' => 'vat_invoice_notice_label',
349
-                        'name' => __( 'Invoice Notice Label', 'invoicing' ),
350
-                        'desc' => __( 'Use this to add an invoice notice section (label) to your invoices', 'invoicing' ),
349
+                        'name' => __('Invoice Notice Label', 'invoicing'),
350
+                        'desc' => __('Use this to add an invoice notice section (label) to your invoices', 'invoicing'),
351 351
                         'type' => 'text',
352 352
                         'size' => 'regular',
353 353
                     ),
354 354
                     'vat_invoice_notice' => array(
355 355
                         'id' => 'vat_invoice_notice',
356
-                        'name' => __( 'Invoice notice', 'invoicing' ),
357
-                        'desc' =>   __( 'Use this to add an invoice notice section (description) to your invoices', 'invoicing' ),
356
+                        'name' => __('Invoice notice', 'invoicing'),
357
+                        'desc' =>   __('Use this to add an invoice notice section (description) to your invoices', 'invoicing'),
358 358
                         'type' => 'text',
359 359
                         'size' => 'regular',
360 360
                     )
@@ -366,22 +366,22 @@  discard block
 block discarded – undo
366 366
                 'main' => array(
367 367
                     'gateway_settings' => array(
368 368
                         'id'   => 'api_header',
369
-                        'name' => '<h3>' . __( 'Gateway Settings', 'invoicing' ) . '</h3>',
369
+                        'name' => '<h3>' . __('Gateway Settings', 'invoicing') . '</h3>',
370 370
                         'desc' => '',
371 371
                         'type' => 'header',
372 372
                     ),
373 373
                     'gateways' => array(
374 374
                         'id'      => 'gateways',
375
-                        'name'    => __( 'Payment Gateways', 'invoicing' ),
376
-                        'desc'    => __( 'Choose the payment gateways you want to enable.', 'invoicing' ),
375
+                        'name'    => __('Payment Gateways', 'invoicing'),
376
+                        'desc'    => __('Choose the payment gateways you want to enable.', 'invoicing'),
377 377
                         'type'    => 'gateways',
378 378
                         'std'     => array('manual'=>1),
379 379
                         'options' => wpinv_get_payment_gateways(),
380 380
                     ),
381 381
                     'default_gateway' => array(
382 382
                         'id'      => 'default_gateway',
383
-                        'name'    => __( 'Default Gateway', 'invoicing' ),
384
-                        'desc'    => __( 'This gateway will be loaded automatically with the checkout page.', 'invoicing' ),
383
+                        'name'    => __('Default Gateway', 'invoicing'),
384
+                        'desc'    => __('This gateway will be loaded automatically with the checkout page.', 'invoicing'),
385 385
                         'type'    => 'gateway_select',
386 386
                         'std'     => 'manual',
387 387
                         'options' => wpinv_get_payment_gateways(),
@@ -395,19 +395,19 @@  discard block
 block discarded – undo
395 395
                 'main' => array(
396 396
                     'tax_settings' => array(
397 397
                         'id'   => 'tax_settings',
398
-                        'name' => '<h3>' . __( 'Tax Settings', 'invoicing' ) . '</h3>',
398
+                        'name' => '<h3>' . __('Tax Settings', 'invoicing') . '</h3>',
399 399
                         'type' => 'header',
400 400
                     ),
401 401
                     'enable_taxes' => array(
402 402
                         'id'   => 'enable_taxes',
403
-                        'name' => __( 'Enable Taxes', 'invoicing' ),
404
-                        'desc' => __( 'Check this to enable taxes on invoices.', 'invoicing' ),
403
+                        'name' => __('Enable Taxes', 'invoicing'),
404
+                        'desc' => __('Check this to enable taxes on invoices.', 'invoicing'),
405 405
                         'type' => 'checkbox',
406 406
                     ),
407 407
                     'tax_rate' => array(
408 408
                         'id'   => 'tax_rate',
409
-                        'name' => __( 'Fallback Tax Rate', 'invoicing' ),
410
-                        'desc' => __( 'Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing' ),
409
+                        'name' => __('Fallback Tax Rate', 'invoicing'),
410
+                        'desc' => __('Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing'),
411 411
                         'type' => 'number',
412 412
                         'size' => 'small',
413 413
                         'min'  => '0',
@@ -419,8 +419,8 @@  discard block
 block discarded – undo
419 419
                 'rates' => array(
420 420
                     'tax_rates' => array(
421 421
                         'id'   => 'tax_rates',
422
-                        'name' => '<h3>' . __( 'Tax Rates', 'invoicing' ) . '</h3>',
423
-                        'desc' => __( 'Enter tax rates for specific regions.', 'invoicing' ),
422
+                        'name' => '<h3>' . __('Tax Rates', 'invoicing') . '</h3>',
423
+                        'desc' => __('Enter tax rates for specific regions.', 'invoicing'),
424 424
                         'type' => 'tax_rates',
425 425
                     ),
426 426
                 )
@@ -432,61 +432,61 @@  discard block
 block discarded – undo
432 432
                 'main' => array(
433 433
                     'email_settings_header' => array(
434 434
                         'id'   => 'email_settings_header',
435
-                        'name' => '<h3>' . __( 'Email Sender Options', 'invoicing' ) . '</h3>',
435
+                        'name' => '<h3>' . __('Email Sender Options', 'invoicing') . '</h3>',
436 436
                         'type' => 'header',
437 437
                     ),
438 438
                     'email_from_name' => array(
439 439
                         'id'   => 'email_from_name',
440
-                        'name' => __( 'From Name', 'invoicing' ),
441
-                        'desc' => __( 'Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing' ),
442
-                        'std' => esc_attr( get_bloginfo( 'name', 'display' ) ),
440
+                        'name' => __('From Name', 'invoicing'),
441
+                        'desc' => __('Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing'),
442
+                        'std' => esc_attr(get_bloginfo('name', 'display')),
443 443
                         'type' => 'text',
444 444
                     ),
445 445
                     'email_from' => array(
446 446
                         'id'   => 'email_from',
447
-                        'name' => __( 'From Email', 'invoicing' ),
448
-                        'desc' => sprintf (__( 'Email address to send invoice emails from. This will act as the "from" and "reply-to" address. %s If emails are not being sent it may be that your hosting prevents emails being sent if the email domains do not match.%s', 'invoicing' ), $alert_wrapper_start, $alert_wrapper_close),
449
-                        'std' => get_option( 'admin_email' ),
447
+                        'name' => __('From Email', 'invoicing'),
448
+                        'desc' => sprintf(__('Email address to send invoice emails from. This will act as the "from" and "reply-to" address. %s If emails are not being sent it may be that your hosting prevents emails being sent if the email domains do not match.%s', 'invoicing'), $alert_wrapper_start, $alert_wrapper_close),
449
+                        'std' => get_option('admin_email'),
450 450
                         'type' => 'text',
451 451
                     ),
452 452
                     'overdue_settings_header' => array(
453 453
                         'id'   => 'overdue_settings_header',
454
-                        'name' => '<h3>' . __( 'Due Date Settings', 'invoicing' ) . '</h3>',
454
+                        'name' => '<h3>' . __('Due Date Settings', 'invoicing') . '</h3>',
455 455
                         'type' => 'header',
456 456
                     ),
457 457
                     'overdue_active' => array(
458 458
                         'id'   => 'overdue_active',
459
-                        'name' => __( 'Enable Due Date', 'invoicing' ),
460
-                        'desc' => __( 'Check this to enable due date option for invoices.', 'invoicing' ),
459
+                        'name' => __('Enable Due Date', 'invoicing'),
460
+                        'desc' => __('Check this to enable due date option for invoices.', 'invoicing'),
461 461
                         'type' => 'checkbox',
462 462
                         'std'  => false,
463 463
                     ),
464 464
                     'overdue_days' => array(
465 465
                         'id'          => 'overdue_days',
466
-                        'name'        => __( 'Default Due Date', 'invoicing' ),
467
-                        'desc'        => __( 'Number of days each Invoice is due after the created date. This will automatically set the date in the "Due Date" field. Can be overridden on individual Invoices.', 'invoicing' ),
466
+                        'name'        => __('Default Due Date', 'invoicing'),
467
+                        'desc'        => __('Number of days each Invoice is due after the created date. This will automatically set the date in the "Due Date" field. Can be overridden on individual Invoices.', 'invoicing'),
468 468
                         'type'        => 'select',
469 469
                         'options'     => $due_payment_options,
470 470
                         'std'         => 0,
471
-                        'placeholder' => __( 'Select a page', 'invoicing' ),
471
+                        'placeholder' => __('Select a page', 'invoicing'),
472 472
                     ),
473 473
                     'email_template_header' => array(
474 474
                         'id'   => 'email_template_header',
475
-                        'name' => '<h3>' . __( 'Email Template', 'invoicing' ) . '</h3>',
475
+                        'name' => '<h3>' . __('Email Template', 'invoicing') . '</h3>',
476 476
                         'type' => 'header',
477 477
                     ),
478 478
                     'email_header_image' => array(
479 479
                         'id'   => 'email_header_image',
480
-                        'name' => __( 'Header Image', 'invoicing' ),
481
-                        'desc' => __( 'URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing' ),
480
+                        'name' => __('Header Image', 'invoicing'),
481
+                        'desc' => __('URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing'),
482 482
                         'std' => '',
483 483
                         'type' => 'text',
484 484
                     ),
485 485
                     'email_footer_text' => array(
486 486
                         'id'   => 'email_footer_text',
487
-                        'name' => __( 'Footer Text', 'invoicing' ),
488
-                        'desc' => __( 'The text to appear in the footer of all invoice emails.', 'invoicing' ),
489
-                        'std' => get_bloginfo( 'name', 'display' ) . ' - ' . __( 'Powered by GeoDirectory', 'invoicing' ),
487
+                        'name' => __('Footer Text', 'invoicing'),
488
+                        'desc' => __('The text to appear in the footer of all invoice emails.', 'invoicing'),
489
+                        'std' => get_bloginfo('name', 'display') . ' - ' . __('Powered by GeoDirectory', 'invoicing'),
490 490
                         'type' => 'textarea',
491 491
                         'class' => 'regular-text',
492 492
                         'rows' => 2,
@@ -494,29 +494,29 @@  discard block
 block discarded – undo
494 494
                     ),
495 495
                     'email_base_color' => array(
496 496
                         'id'   => 'email_base_color',
497
-                        'name' => __( 'Base Color', 'invoicing' ),
498
-                        'desc' => __( 'The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing' ),
497
+                        'name' => __('Base Color', 'invoicing'),
498
+                        'desc' => __('The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing'),
499 499
                         'std' => '#557da2',
500 500
                         'type' => 'color',
501 501
                     ),
502 502
                     'email_background_color' => array(
503 503
                         'id'   => 'email_background_color',
504
-                        'name' => __( 'Background Color', 'invoicing' ),
505
-                        'desc' => __( 'The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing' ),
504
+                        'name' => __('Background Color', 'invoicing'),
505
+                        'desc' => __('The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing'),
506 506
                         'std' => '#f5f5f5',
507 507
                         'type' => 'color',
508 508
                     ),
509 509
                     'email_body_background_color' => array(
510 510
                         'id'   => 'email_body_background_color',
511
-                        'name' => __( 'Body Background Color', 'invoicing' ),
512
-                        'desc' => __( 'The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing' ),
511
+                        'name' => __('Body Background Color', 'invoicing'),
512
+                        'desc' => __('The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing'),
513 513
                         'std' => '#fdfdfd',
514 514
                         'type' => 'color',
515 515
                     ),
516 516
                     'email_text_color' => array(
517 517
                         'id'   => 'email_text_color',
518
-                        'name' => __( 'Body Text Color', 'invoicing' ),
519
-                        'desc' => __( 'The main body text color. Default <code>#505050</code>.', 'invoicing' ),
518
+                        'name' => __('Body Text Color', 'invoicing'),
519
+                        'desc' => __('The main body text color. Default <code>#505050</code>.', 'invoicing'),
520 520
                         'std' => '#505050',
521 521
                         'type' => 'color',
522 522
                     ),
@@ -535,19 +535,19 @@  discard block
 block discarded – undo
535 535
                 'main' => array(
536 536
                     'invoice_number_format_settings' => array(
537 537
                         'id'   => 'invoice_number_format_settings',
538
-                        'name' => '<h3>' . __( 'Invoice Number', 'invoicing' ) . '</h3>',
538
+                        'name' => '<h3>' . __('Invoice Number', 'invoicing') . '</h3>',
539 539
                         'type' => 'header',
540 540
                     ),
541 541
                     'sequential_invoice_number' => array(
542 542
                         'id'   => 'sequential_invoice_number',
543
-                        'name' => __( 'Sequential Invoice Numbers', 'invoicing' ),
544
-                        'desc' => __( 'Check this box to enable sequential invoice numbers.', 'invoicing' ),
543
+                        'name' => __('Sequential Invoice Numbers', 'invoicing'),
544
+                        'desc' => __('Check this box to enable sequential invoice numbers.', 'invoicing'),
545 545
                         'type' => 'checkbox',
546 546
                     ),
547 547
                     'invoice_sequence_start' => array(
548 548
                         'id'   => 'invoice_sequence_start',
549
-                        'name' => __( 'Sequential Starting Number', 'invoicing' ),
550
-                        'desc' => __( 'The number at which the invoice number sequence should begin.', 'invoicing' ) . $last_number,
549
+                        'name' => __('Sequential Starting Number', 'invoicing'),
550
+                        'desc' => __('The number at which the invoice number sequence should begin.', 'invoicing') . $last_number,
551 551
                         'type' => 'number',
552 552
                         'size' => 'small',
553 553
                         'std'  => '1',
@@ -555,16 +555,16 @@  discard block
 block discarded – undo
555 555
                     ),
556 556
                     'invoice_number_padd' => array(
557 557
                         'id'      => 'invoice_number_padd',
558
-                        'name'    => __( 'Minimum Digits', 'invoicing' ),
559
-                        'desc'    => __( 'If the invoice number has less digits than this number, it is left padded with 0s. Ex: invoice number 108 will padded to 00108 if digits set to 5. The default 0 means no padding.', 'invoicing' ),
558
+                        'name'    => __('Minimum Digits', 'invoicing'),
559
+                        'desc'    => __('If the invoice number has less digits than this number, it is left padded with 0s. Ex: invoice number 108 will padded to 00108 if digits set to 5. The default 0 means no padding.', 'invoicing'),
560 560
                         'type'    => 'select',
561 561
                         'options' => $invoice_number_padd_options,
562 562
                         'std'     => 5,
563 563
                     ),
564 564
                     'invoice_number_prefix' => array(
565 565
                         'id' => 'invoice_number_prefix',
566
-                        'name' => __( 'Invoice Number Prefix', 'invoicing' ),
567
-                        'desc' => __( 'Prefix for all invoice numbers. Ex: WPINV-', 'invoicing' ),
566
+                        'name' => __('Invoice Number Prefix', 'invoicing'),
567
+                        'desc' => __('Prefix for all invoice numbers. Ex: WPINV-', 'invoicing'),
568 568
                         'type' => 'text',
569 569
                         'size' => 'regular',
570 570
                         'std' => 'WPINV-',
@@ -572,32 +572,32 @@  discard block
 block discarded – undo
572 572
                     ),
573 573
                     'invoice_number_postfix' => array(
574 574
                         'id' => 'invoice_number_postfix',
575
-                        'name' => __( 'Invoice Number Postfix', 'invoicing' ),
576
-                        'desc' => __( 'Postfix for all invoice numbers.', 'invoicing' ),
575
+                        'name' => __('Invoice Number Postfix', 'invoicing'),
576
+                        'desc' => __('Postfix for all invoice numbers.', 'invoicing'),
577 577
                         'type' => 'text',
578 578
                         'size' => 'regular',
579 579
                         'std' => ''
580 580
                     ),
581 581
                     'checkout_settings' => array(
582 582
                         'id'   => 'checkout_settings',
583
-                        'name' => '<h3>' . __( 'Checkout Settings', 'invoicing' ) . '</h3>',
583
+                        'name' => '<h3>' . __('Checkout Settings', 'invoicing') . '</h3>',
584 584
                         'type' => 'header',
585 585
                     ),
586 586
                     'login_to_checkout' => array(
587 587
                         'id'   => 'login_to_checkout',
588
-                        'name' => __( 'Require Login To Checkout', 'invoicing' ),
589
-                        'desc' => __( 'If ticked then user needs to be logged in to view or pay invoice, can only view or pay their own invoice. If unticked then anyone can view or pay the invoice.', 'invoicing' ),
588
+                        'name' => __('Require Login To Checkout', 'invoicing'),
589
+                        'desc' => __('If ticked then user needs to be logged in to view or pay invoice, can only view or pay their own invoice. If unticked then anyone can view or pay the invoice.', 'invoicing'),
590 590
                         'type' => 'checkbox',
591 591
                     ),
592 592
                     'uninstall_settings' => array(
593 593
                         'id'   => 'uninstall_settings',
594
-                        'name' => '<h3>' . __( 'Uninstall Settings', 'invoicing' ) . '</h3>',
594
+                        'name' => '<h3>' . __('Uninstall Settings', 'invoicing') . '</h3>',
595 595
                         'type' => 'header',
596 596
                     ),
597 597
                     'remove_data_on_unistall' => array(
598 598
                         'id'   => 'remove_data_on_unistall',
599
-                        'name' => __( 'Remove Data on Uninstall?', 'invoicing' ),
600
-                        'desc' => __( 'Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing' ),
599
+                        'name' => __('Remove Data on Uninstall?', 'invoicing'),
600
+                        'desc' => __('Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing'),
601 601
                         'type' => 'checkbox',
602 602
                         'std'  => ''
603 603
                     ),
@@ -605,74 +605,74 @@  discard block
 block discarded – undo
605 605
                 'fields' => array(
606 606
                     'fields_settings' => array(
607 607
                         'id'   => 'fields_settings',
608
-                        'name' => '<h3>' . __( 'Address Fields', 'invoicing' ) . '</h3>',
609
-                        'desc' => __( 'Tick fields which are mandatory in invoice address fields.', 'invoicing' ),
608
+                        'name' => '<h3>' . __('Address Fields', 'invoicing') . '</h3>',
609
+                        'desc' => __('Tick fields which are mandatory in invoice address fields.', 'invoicing'),
610 610
                         'type' => 'header',
611 611
                     ),
612 612
                     'fname_mandatory' => array(
613 613
                         'id'   => 'fname_mandatory',
614
-                        'name' => __( 'First Name', 'invoicing' ),
614
+                        'name' => __('First Name', 'invoicing'),
615 615
                         'type' => 'checkbox',
616 616
                         'std'  => true,
617 617
                     ),
618 618
                     'lname_mandatory' => array(
619 619
                         'id'   => 'lname_mandatory',
620
-                        'name' => __( 'Last Name', 'invoicing' ),
620
+                        'name' => __('Last Name', 'invoicing'),
621 621
                         'type' => 'checkbox',
622 622
                         'std'  => true,
623 623
                     ),
624 624
                     'address_mandatory' => array(
625 625
                         'id'   => 'address_mandatory',
626
-                        'name' => __( 'Address', 'invoicing' ),
626
+                        'name' => __('Address', 'invoicing'),
627 627
                         'type' => 'checkbox',
628 628
                         'std'  => true,
629 629
                     ),
630 630
                     'city_mandatory' => array(
631 631
                         'id'   => 'city_mandatory',
632
-                        'name' => __( 'City', 'invoicing' ),
632
+                        'name' => __('City', 'invoicing'),
633 633
                         'type' => 'checkbox',
634 634
                         'std'  => true,
635 635
                     ),
636 636
                     'country_mandatory' => array(
637 637
                         'id'   => 'country_mandatory',
638
-                        'name' => __( 'Country', 'invoicing' ),
638
+                        'name' => __('Country', 'invoicing'),
639 639
                         'type' => 'checkbox',
640 640
                         'std'  => true,
641 641
                     ),
642 642
                     'state_mandatory' => array(
643 643
                         'id'   => 'state_mandatory',
644
-                        'name' => __( 'State / Province', 'invoicing' ),
644
+                        'name' => __('State / Province', 'invoicing'),
645 645
                         'type' => 'checkbox',
646 646
                         'std'  => true,
647 647
                     ),
648 648
                     'zip_mandatory' => array(
649 649
                         'id'   => 'zip_mandatory',
650
-                        'name' => __( 'ZIP / Postcode', 'invoicing' ),
650
+                        'name' => __('ZIP / Postcode', 'invoicing'),
651 651
                         'type' => 'checkbox',
652 652
                         'std'  => true,
653 653
                     ),
654 654
                     'phone_mandatory' => array(
655 655
                         'id'   => 'phone_mandatory',
656
-                        'name' => __( 'Phone Number', 'invoicing' ),
656
+                        'name' => __('Phone Number', 'invoicing'),
657 657
                         'type' => 'checkbox',
658 658
                         'std'  => true,
659 659
                     ),
660 660
                     'address_autofill_settings' => array(
661 661
                         'id'   => 'address_autofill_settings',
662
-                        'name' => '<h3>' . __( 'Google Address Auto Complete', 'invoicing' ) . '</h3>',
662
+                        'name' => '<h3>' . __('Google Address Auto Complete', 'invoicing') . '</h3>',
663 663
                         'type' => 'header',
664 664
                     ),
665 665
                     'address_autofill_active' => array(
666 666
                         'id'   => 'address_autofill_active',
667
-                        'name' => __( 'Enable/Disable', 'invoicing' ),
668
-                        'desc' => __( 'Enable google address auto complete', 'invoicing' ),
667
+                        'name' => __('Enable/Disable', 'invoicing'),
668
+                        'desc' => __('Enable google address auto complete', 'invoicing'),
669 669
                         'type' => 'checkbox',
670 670
                         'std'  => 0
671 671
                     ),
672 672
                     'address_autofill_api' => array(
673 673
                         'id' => 'address_autofill_api',
674
-                        'name' => __( 'Google Place API Key', 'invoicing' ),
675
-                        'desc' => wp_sprintf(__( 'Enter google place API key. For more information go to google place API %sdocumenation%s', 'invoicing' ), '<a href="https://developers.google.com/maps/documentation/javascript/places-autocomplete" target="_blank">', '</a>' ),
674
+                        'name' => __('Google Place API Key', 'invoicing'),
675
+                        'desc' => wp_sprintf(__('Enter google place API key. For more information go to google place API %sdocumenation%s', 'invoicing'), '<a href="https://developers.google.com/maps/documentation/javascript/places-autocomplete" target="_blank">', '</a>'),
676 676
                         'type' => 'text',
677 677
                         'size' => 'regular',
678 678
                         'std' => ''
@@ -686,8 +686,8 @@  discard block
 block discarded – undo
686 686
                 'main' => array(
687 687
                     'tool_settings' => array(
688 688
                         'id'   => 'tool_settings',
689
-                        'name' => '<h3>' . __( 'Diagnostic Tools', 'invoicing' ) . '</h3>',
690
-                        'desc' => __( 'Invoicing diagnostic tools', 'invoicing' ),
689
+                        'name' => '<h3>' . __('Diagnostic Tools', 'invoicing') . '</h3>',
690
+                        'desc' => __('Invoicing diagnostic tools', 'invoicing'),
691 691
                         'type' => 'tools',
692 692
                     ),
693 693
                 ),
@@ -695,135 +695,135 @@  discard block
 block discarded – undo
695 695
         )
696 696
     );
697 697
 
698
-    return apply_filters( 'wpinv_registered_settings', $wpinv_settings );
698
+    return apply_filters('wpinv_registered_settings', $wpinv_settings);
699 699
 }
700 700
 
701
-function wpinv_settings_sanitize( $input = array() ) {
701
+function wpinv_settings_sanitize($input = array()) {
702 702
     global $wpinv_options;
703 703
 
704
-    if ( empty( $_POST['_wp_http_referer'] ) ) {
704
+    if (empty($_POST['_wp_http_referer'])) {
705 705
         return $input;
706 706
     }
707 707
 
708
-    parse_str( $_POST['_wp_http_referer'], $referrer );
708
+    parse_str($_POST['_wp_http_referer'], $referrer);
709 709
 
710 710
     $settings = wpinv_get_registered_settings();
711
-    $tab      = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general';
712
-    $section  = isset( $referrer['section'] ) ? $referrer['section'] : 'main';
711
+    $tab      = isset($referrer['tab']) ? $referrer['tab'] : 'general';
712
+    $section  = isset($referrer['section']) ? $referrer['section'] : 'main';
713 713
 
714 714
     $input = $input ? $input : array();
715
-    $input = apply_filters( 'wpinv_settings_tab_' . $tab . '_sanitize', $input );
716
-    $input = apply_filters( 'wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input );
715
+    $input = apply_filters('wpinv_settings_tab_' . $tab . '_sanitize', $input);
716
+    $input = apply_filters('wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input);
717 717
 
718 718
     // Loop through each setting being saved and pass it through a sanitization filter
719
-    foreach ( $input as $key => $value ) {
719
+    foreach ($input as $key => $value) {
720 720
         // Get the setting type (checkbox, select, etc)
721
-        $type = isset( $settings[ $tab ][ $key ]['type'] ) ? $settings[ $tab ][ $key ]['type'] : false;
721
+        $type = isset($settings[$tab][$key]['type']) ? $settings[$tab][$key]['type'] : false;
722 722
 
723
-        if ( $type ) {
723
+        if ($type) {
724 724
             // Field type specific filter
725
-            $input[$key] = apply_filters( 'wpinv_settings_sanitize_' . $type, $value, $key );
725
+            $input[$key] = apply_filters('wpinv_settings_sanitize_' . $type, $value, $key);
726 726
         }
727 727
 
728 728
         // General filter
729
-        $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
729
+        $input[$key] = apply_filters('wpinv_settings_sanitize', $input[$key], $key);
730 730
     }
731 731
 
732 732
     // Loop through the whitelist and unset any that are empty for the tab being saved
733
-    $main_settings    = $section == 'main' ? $settings[ $tab ] : array(); // Check for extensions that aren't using new sections
734
-    $section_settings = ! empty( $settings[ $tab ][ $section ] ) ? $settings[ $tab ][ $section ] : array();
733
+    $main_settings    = $section == 'main' ? $settings[$tab] : array(); // Check for extensions that aren't using new sections
734
+    $section_settings = !empty($settings[$tab][$section]) ? $settings[$tab][$section] : array();
735 735
 
736
-    $found_settings = array_merge( $main_settings, $section_settings );
736
+    $found_settings = array_merge($main_settings, $section_settings);
737 737
 
738
-    if ( ! empty( $found_settings ) ) {
739
-        foreach ( $found_settings as $key => $value ) {
738
+    if (!empty($found_settings)) {
739
+        foreach ($found_settings as $key => $value) {
740 740
 
741 741
             // settings used to have numeric keys, now they have keys that match the option ID. This ensures both methods work
742
-            if ( is_numeric( $key ) ) {
742
+            if (is_numeric($key)) {
743 743
                 $key = $value['id'];
744 744
             }
745 745
 
746
-            if ( empty( $input[ $key ] ) ) {
747
-                unset( $wpinv_options[ $key ] );
746
+            if (empty($input[$key])) {
747
+                unset($wpinv_options[$key]);
748 748
             }
749 749
         }
750 750
     }
751 751
 
752 752
     // Merge our new settings with the existing
753
-    $output = array_merge( $wpinv_options, $input );
753
+    $output = array_merge($wpinv_options, $input);
754 754
 
755
-    add_settings_error( 'wpinv-notices', '', __( 'Settings updated.', 'invoicing' ), 'updated' );
755
+    add_settings_error('wpinv-notices', '', __('Settings updated.', 'invoicing'), 'updated');
756 756
 
757 757
     return $output;
758 758
 }
759 759
 
760
-function wpinv_settings_sanitize_misc_accounting( $input ) {
760
+function wpinv_settings_sanitize_misc_accounting($input) {
761 761
     global $wpinv_options, $wpi_session;
762 762
 
763
-    if ( !current_user_can( 'manage_options' ) ) {
763
+    if (!current_user_can('manage_options')) {
764 764
         return $input;
765 765
     }
766 766
 
767
-    if( ! empty( $input['enable_sequential'] ) && !wpinv_get_option( 'enable_sequential' ) ) {
767
+    if (!empty($input['enable_sequential']) && !wpinv_get_option('enable_sequential')) {
768 768
         // Shows an admin notice about upgrading previous order numbers
769
-        $wpi_session->set( 'upgrade_sequential', '1' );
769
+        $wpi_session->set('upgrade_sequential', '1');
770 770
     }
771 771
 
772 772
     return $input;
773 773
 }
774
-add_filter( 'wpinv_settings_misc-accounting_sanitize', 'wpinv_settings_sanitize_misc_accounting' );
774
+add_filter('wpinv_settings_misc-accounting_sanitize', 'wpinv_settings_sanitize_misc_accounting');
775 775
 
776
-function wpinv_settings_sanitize_tax_rates( $input ) {
777
-    if( !current_user_can( 'manage_options' ) ) {
776
+function wpinv_settings_sanitize_tax_rates($input) {
777
+    if (!current_user_can('manage_options')) {
778 778
         return $input;
779 779
     }
780 780
 
781
-    $new_rates = !empty( $_POST['tax_rates'] ) ? array_values( $_POST['tax_rates'] ) : array();
781
+    $new_rates = !empty($_POST['tax_rates']) ? array_values($_POST['tax_rates']) : array();
782 782
 
783 783
     $tax_rates = array();
784 784
 
785
-    if ( !empty( $new_rates ) ) {
786
-        foreach ( $new_rates as $rate ) {
787
-            if ( isset( $rate['country'] ) && empty( $rate['country'] ) && empty( $rate['state'] ) ) {
785
+    if (!empty($new_rates)) {
786
+        foreach ($new_rates as $rate) {
787
+            if (isset($rate['country']) && empty($rate['country']) && empty($rate['state'])) {
788 788
                 continue;
789 789
             }
790 790
             
791
-            $rate['rate'] = wpinv_sanitize_amount( $rate['rate'], 4 );
791
+            $rate['rate'] = wpinv_sanitize_amount($rate['rate'], 4);
792 792
             
793 793
             $tax_rates[] = $rate;
794 794
         }
795 795
     }
796 796
 
797
-    update_option( 'wpinv_tax_rates', $tax_rates );
797
+    update_option('wpinv_tax_rates', $tax_rates);
798 798
 
799 799
     return $input;
800 800
 }
801
-add_filter( 'wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates' );
801
+add_filter('wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates');
802 802
 
803
-function wpinv_sanitize_text_field( $input ) {
804
-    return trim( $input );
803
+function wpinv_sanitize_text_field($input) {
804
+    return trim($input);
805 805
 }
806
-add_filter( 'wpinv_settings_sanitize_text', 'wpinv_sanitize_text_field' );
806
+add_filter('wpinv_settings_sanitize_text', 'wpinv_sanitize_text_field');
807 807
 
808 808
 function wpinv_get_settings_tabs() {
809 809
     $tabs             = array();
810
-    $tabs['general']  = __( 'General', 'invoicing' );
811
-    $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' );
812
-    $tabs['taxes']    = __( 'Taxes', 'invoicing' );
813
-    $tabs['emails']   = __( 'Emails', 'invoicing' );
814
-    $tabs['misc']     = __( 'Misc', 'invoicing' );
815
-    $tabs['tools']    = __( 'Tools', 'invoicing' );
816
-
817
-    return apply_filters( 'wpinv_settings_tabs', $tabs );
810
+    $tabs['general']  = __('General', 'invoicing');
811
+    $tabs['gateways'] = __('Payment Gateways', 'invoicing');
812
+    $tabs['taxes']    = __('Taxes', 'invoicing');
813
+    $tabs['emails']   = __('Emails', 'invoicing');
814
+    $tabs['misc']     = __('Misc', 'invoicing');
815
+    $tabs['tools']    = __('Tools', 'invoicing');
816
+
817
+    return apply_filters('wpinv_settings_tabs', $tabs);
818 818
 }
819 819
 
820
-function wpinv_get_settings_tab_sections( $tab = false ) {
820
+function wpinv_get_settings_tab_sections($tab = false) {
821 821
     $tabs     = false;
822 822
     $sections = wpinv_get_registered_settings_sections();
823 823
 
824
-    if( $tab && ! empty( $sections[ $tab ] ) ) {
825
-        $tabs = $sections[ $tab ];
826
-    } else if ( $tab ) {
824
+    if ($tab && !empty($sections[$tab])) {
825
+        $tabs = $sections[$tab];
826
+    } else if ($tab) {
827 827
         $tabs = false;
828 828
     }
829 829
 
@@ -833,136 +833,136 @@  discard block
 block discarded – undo
833 833
 function wpinv_get_registered_settings_sections() {
834 834
     static $sections = false;
835 835
 
836
-    if ( false !== $sections ) {
836
+    if (false !== $sections) {
837 837
         return $sections;
838 838
     }
839 839
 
840 840
     $sections = array(
841
-        'general' => apply_filters( 'wpinv_settings_sections_general', array(
842
-            'main' => __( 'General Settings', 'invoicing' ),
843
-            'currency_section' => __( 'Currency Settings', 'invoicing' ),
844
-            'labels' => __( 'Label Texts', 'invoicing' ),
845
-        ) ),
846
-        'gateways' => apply_filters( 'wpinv_settings_sections_gateways', array(
847
-            'main' => __( 'Gateway Settings', 'invoicing' ),
848
-        ) ),
849
-        'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array(
850
-            'main' => __( 'Tax Settings', 'invoicing' ),
851
-            'rates' => __( 'Tax Rates', 'invoicing' ),
852
-        ) ),
853
-        'emails' => apply_filters( 'wpinv_settings_sections_emails', array(
854
-            'main' => __( 'Email Settings', 'invoicing' ),
855
-        ) ),
856
-        'misc' => apply_filters( 'wpinv_settings_sections_misc', array(
857
-            'main' => __( 'Miscellaneous', 'invoicing' ),
858
-            'fields' => __( 'Fields Settings', 'invoicing' ),
859
-        ) ),
860
-        'tools' => apply_filters( 'wpinv_settings_sections_tools', array(
861
-            'main' => __( 'Diagnostic Tools', 'invoicing' ),
862
-        ) ),
841
+        'general' => apply_filters('wpinv_settings_sections_general', array(
842
+            'main' => __('General Settings', 'invoicing'),
843
+            'currency_section' => __('Currency Settings', 'invoicing'),
844
+            'labels' => __('Label Texts', 'invoicing'),
845
+        )),
846
+        'gateways' => apply_filters('wpinv_settings_sections_gateways', array(
847
+            'main' => __('Gateway Settings', 'invoicing'),
848
+        )),
849
+        'taxes' => apply_filters('wpinv_settings_sections_taxes', array(
850
+            'main' => __('Tax Settings', 'invoicing'),
851
+            'rates' => __('Tax Rates', 'invoicing'),
852
+        )),
853
+        'emails' => apply_filters('wpinv_settings_sections_emails', array(
854
+            'main' => __('Email Settings', 'invoicing'),
855
+        )),
856
+        'misc' => apply_filters('wpinv_settings_sections_misc', array(
857
+            'main' => __('Miscellaneous', 'invoicing'),
858
+            'fields' => __('Fields Settings', 'invoicing'),
859
+        )),
860
+        'tools' => apply_filters('wpinv_settings_sections_tools', array(
861
+            'main' => __('Diagnostic Tools', 'invoicing'),
862
+        )),
863 863
     );
864 864
 
865
-    $sections = apply_filters( 'wpinv_settings_sections', $sections );
865
+    $sections = apply_filters('wpinv_settings_sections', $sections);
866 866
 
867 867
     return $sections;
868 868
 }
869 869
 
870
-function wpinv_get_pages( $with_slug = false, $default_label = NULL ) {
870
+function wpinv_get_pages($with_slug = false, $default_label = NULL) {
871 871
 	$pages_options = array();
872 872
 
873
-	if( $default_label !== NULL && $default_label !== false ) {
874
-		$pages_options = array( '' => $default_label ); // Blank option
873
+	if ($default_label !== NULL && $default_label !== false) {
874
+		$pages_options = array('' => $default_label); // Blank option
875 875
 	}
876 876
 
877 877
 	$pages = get_pages();
878
-	if ( $pages ) {
879
-		foreach ( $pages as $page ) {
878
+	if ($pages) {
879
+		foreach ($pages as $page) {
880 880
 			$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
881
-            $pages_options[ $page->ID ] = $title;
881
+            $pages_options[$page->ID] = $title;
882 882
 		}
883 883
 	}
884 884
 
885 885
 	return $pages_options;
886 886
 }
887 887
 
888
-function wpinv_header_callback( $args ) {
889
-	if ( !empty( $args['desc'] ) ) {
888
+function wpinv_header_callback($args) {
889
+	if (!empty($args['desc'])) {
890 890
         echo $args['desc'];
891 891
     }
892 892
 }
893 893
 
894
-function wpinv_hidden_callback( $args ) {
894
+function wpinv_hidden_callback($args) {
895 895
 	global $wpinv_options;
896 896
 
897
-	if ( isset( $args['set_value'] ) ) {
897
+	if (isset($args['set_value'])) {
898 898
 		$value = $args['set_value'];
899
-	} elseif ( isset( $wpinv_options[ $args['id'] ] ) ) {
900
-		$value = $wpinv_options[ $args['id'] ];
899
+	} elseif (isset($wpinv_options[$args['id']])) {
900
+		$value = $wpinv_options[$args['id']];
901 901
 	} else {
902
-		$value = isset( $args['std'] ) ? $args['std'] : '';
902
+		$value = isset($args['std']) ? $args['std'] : '';
903 903
 	}
904 904
 
905
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
905
+	if (isset($args['faux']) && true === $args['faux']) {
906 906
 		$args['readonly'] = true;
907
-		$value = isset( $args['std'] ) ? $args['std'] : '';
907
+		$value = isset($args['std']) ? $args['std'] : '';
908 908
 		$name  = '';
909 909
 	} else {
910
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
910
+		$name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"';
911 911
 	}
912 912
 
913
-	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
913
+	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key($args['id']) . ']" ' . $name . ' value="' . esc_attr(stripslashes($value)) . '" />';
914 914
     
915 915
 	echo $html;
916 916
 }
917 917
 
918
-function wpinv_checkbox_callback( $args ) {
918
+function wpinv_checkbox_callback($args) {
919 919
 	global $wpinv_options;
920 920
     
921
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
921
+    $sanitize_id = wpinv_sanitize_key($args['id']);
922 922
 
923
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
923
+	if (isset($args['faux']) && true === $args['faux']) {
924 924
 		$name = '';
925 925
 	} else {
926 926
 		$name = 'name="wpinv_settings[' . $sanitize_id . ']"';
927 927
 	}
928 928
 
929
-	$checked = isset( $wpinv_options[ $args['id'] ] ) ? checked( 1, $wpinv_options[ $args['id'] ], false ) : '';
929
+	$checked = isset($wpinv_options[$args['id']]) ? checked(1, $wpinv_options[$args['id']], false) : '';
930 930
 	$html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>';
931
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
931
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
932 932
 
933 933
 	echo $html;
934 934
 }
935 935
 
936
-function wpinv_multicheck_callback( $args ) {
936
+function wpinv_multicheck_callback($args) {
937 937
 	global $wpinv_options;
938 938
 	
939
-	$sanitize_id = wpinv_sanitize_key( $args['id'] );
939
+	$sanitize_id = wpinv_sanitize_key($args['id']);
940 940
 	
941
-	if ( ! empty( $args['options'] ) ) {
942
-		foreach( $args['options'] as $key => $option ):
943
-			$sanitize_key = wpinv_sanitize_key( $key );
944
-			if ( isset( $wpinv_options[$args['id']][$sanitize_key] ) ) { 
941
+	if (!empty($args['options'])) {
942
+		foreach ($args['options'] as $key => $option):
943
+			$sanitize_key = wpinv_sanitize_key($key);
944
+			if (isset($wpinv_options[$args['id']][$sanitize_key])) { 
945 945
 				$enabled = $sanitize_key;
946 946
 			} else { 
947 947
 				$enabled = NULL; 
948 948
 			}
949
-			echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/>&nbsp;';
950
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label><br/>';
949
+			echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr($sanitize_key) . '" ' . checked($sanitize_key, $enabled, false) . '/>&nbsp;';
950
+			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post($option) . '</label><br/>';
951 951
 		endforeach;
952 952
 		echo '<p class="description">' . $args['desc'] . '</p>';
953 953
 	}
954 954
 }
955 955
 
956
-function wpinv_payment_icons_callback( $args ) {
956
+function wpinv_payment_icons_callback($args) {
957 957
 	global $wpinv_options;
958 958
     
959
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
959
+    $sanitize_id = wpinv_sanitize_key($args['id']);
960 960
 
961
-	if ( ! empty( $args['options'] ) ) {
962
-		foreach( $args['options'] as $key => $option ) {
963
-            $sanitize_key = wpinv_sanitize_key( $key );
961
+	if (!empty($args['options'])) {
962
+		foreach ($args['options'] as $key => $option) {
963
+            $sanitize_key = wpinv_sanitize_key($key);
964 964
             
965
-			if( isset( $wpinv_options[$args['id']][$key] ) ) {
965
+			if (isset($wpinv_options[$args['id']][$key])) {
966 966
 				$enabled = $option;
967 967
 			} else {
968 968
 				$enabled = NULL;
@@ -970,196 +970,196 @@  discard block
 block discarded – undo
970 970
 
971 971
 			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
972 972
 
973
-				echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/>&nbsp;';
973
+				echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr($option) . '" ' . checked($option, $enabled, false) . '/>&nbsp;';
974 974
 
975
-				if ( wpinv_string_is_image_url( $key ) ) {
976
-					echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
975
+				if (wpinv_string_is_image_url($key)) {
976
+					echo '<img class="payment-icon" src="' . esc_url($key) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
977 977
 				} else {
978
-					$card = strtolower( str_replace( ' ', '', $option ) );
978
+					$card = strtolower(str_replace(' ', '', $option));
979 979
 
980
-					if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
981
-						$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
980
+					if (has_filter('wpinv_accepted_payment_' . $card . '_image')) {
981
+						$image = apply_filters('wpinv_accepted_payment_' . $card . '_image', '');
982 982
 					} else {
983
-						$image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
983
+						$image       = wpinv_locate_template('images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false);
984 984
 						$content_dir = WP_CONTENT_DIR;
985 985
 
986
-						if ( function_exists( 'wp_normalize_path' ) ) {
986
+						if (function_exists('wp_normalize_path')) {
987 987
 							// Replaces backslashes with forward slashes for Windows systems
988
-							$image = wp_normalize_path( $image );
989
-							$content_dir = wp_normalize_path( $content_dir );
988
+							$image = wp_normalize_path($image);
989
+							$content_dir = wp_normalize_path($content_dir);
990 990
 						}
991 991
 
992
-						$image = str_replace( $content_dir, content_url(), $image );
992
+						$image = str_replace($content_dir, content_url(), $image);
993 993
 					}
994 994
 
995
-					echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
995
+					echo '<img class="payment-icon" src="' . esc_url($image) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
996 996
 				}
997 997
 			echo $option . '</label>';
998 998
 		}
999
-		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
999
+		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post($args['desc']) . '</p>';
1000 1000
 	}
1001 1001
 }
1002 1002
 
1003
-function wpinv_radio_callback( $args ) {
1003
+function wpinv_radio_callback($args) {
1004 1004
 	global $wpinv_options;
1005 1005
     
1006
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1006
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1007 1007
     
1008
-    foreach ( $args['options'] as $key => $option ) :
1009
-		$sanitize_key = wpinv_sanitize_key( $key );
1008
+    foreach ($args['options'] as $key => $option) :
1009
+		$sanitize_key = wpinv_sanitize_key($key);
1010 1010
         
1011 1011
         $checked = false;
1012 1012
 
1013
-		if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key )
1013
+		if (isset($wpinv_options[$args['id']]) && $wpinv_options[$args['id']] == $key)
1014 1014
 			$checked = true;
1015
-		elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) )
1015
+		elseif (isset($args['std']) && $args['std'] == $key && !isset($wpinv_options[$args['id']]))
1016 1016
 			$checked = true;
1017 1017
 
1018 1018
 		echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/>&nbsp;';
1019
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>';
1019
+		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html($option) . '</label><br/>';
1020 1020
 	endforeach;
1021 1021
 
1022
-	echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
1022
+	echo '<p class="description">' . wp_kses_post($args['desc']) . '</p>';
1023 1023
 }
1024 1024
 
1025
-function wpinv_gateways_callback( $args ) {
1025
+function wpinv_gateways_callback($args) {
1026 1026
 	global $wpinv_options;
1027 1027
     
1028
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1028
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1029 1029
 
1030
-	foreach ( $args['options'] as $key => $option ) :
1031
-		$sanitize_key = wpinv_sanitize_key( $key );
1030
+	foreach ($args['options'] as $key => $option) :
1031
+		$sanitize_key = wpinv_sanitize_key($key);
1032 1032
         
1033
-        if ( isset( $wpinv_options['gateways'][ $key ] ) )
1033
+        if (isset($wpinv_options['gateways'][$key]))
1034 1034
 			$enabled = '1';
1035 1035
 		else
1036 1036
 			$enabled = null;
1037 1037
 
1038
-		echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/>&nbsp;';
1039
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
1038
+		echo '<input name="wpinv_settings[' . esc_attr($args['id']) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/>&nbsp;';
1039
+		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html($option['admin_label']) . '</label><br/>';
1040 1040
 	endforeach;
1041 1041
 }
1042 1042
 
1043 1043
 function wpinv_gateway_select_callback($args) {
1044 1044
 	global $wpinv_options;
1045 1045
     
1046
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1046
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1047 1047
 
1048 1048
 	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']">';
1049 1049
 
1050
-	foreach ( $args['options'] as $key => $option ) :
1051
-		if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
1052
-            $selected = selected( $key, $args['selected'], false );
1050
+	foreach ($args['options'] as $key => $option) :
1051
+		if (isset($args['selected']) && $args['selected'] !== null && $args['selected'] !== false) {
1052
+            $selected = selected($key, $args['selected'], false);
1053 1053
         } else {
1054
-            $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : '';
1054
+            $selected = isset($wpinv_options[$args['id']]) ? selected($key, $wpinv_options[$args['id']], false) : '';
1055 1055
         }
1056
-		echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1056
+		echo '<option value="' . wpinv_sanitize_key($key) . '"' . $selected . '>' . esc_html($option['admin_label']) . '</option>';
1057 1057
 	endforeach;
1058 1058
 
1059 1059
 	echo '</select>';
1060
-	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1060
+	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1061 1061
 }
1062 1062
 
1063
-function wpinv_text_callback( $args ) {
1063
+function wpinv_text_callback($args) {
1064 1064
 	global $wpinv_options;
1065 1065
     
1066
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1066
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1067 1067
 
1068
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1069
-		$value = $wpinv_options[ $args['id'] ];
1068
+	if (isset($wpinv_options[$args['id']])) {
1069
+		$value = $wpinv_options[$args['id']];
1070 1070
 	} else {
1071
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1071
+		$value = isset($args['std']) ? $args['std'] : '';
1072 1072
 	}
1073 1073
 
1074
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1074
+	if (isset($args['faux']) && true === $args['faux']) {
1075 1075
 		$args['readonly'] = true;
1076
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1076
+		$value = isset($args['std']) ? $args['std'] : '';
1077 1077
 		$name  = '';
1078 1078
 	} else {
1079
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1079
+		$name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"';
1080 1080
 	}
1081
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
1081
+	$class = !empty($args['class']) ? sanitize_html_class($args['class']) : '';
1082 1082
 
1083 1083
 	$readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
1084
-	$size     = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1085
-	$html     = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>';
1086
-	$html    .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1084
+	$size     = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
1085
+	$html     = '<input type="text" class="' . sanitize_html_class($size) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr(stripslashes($value)) . '"' . $readonly . '/>';
1086
+	$html    .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1087 1087
 
1088 1088
 	echo $html;
1089 1089
 }
1090 1090
 
1091
-function wpinv_number_callback( $args ) {
1091
+function wpinv_number_callback($args) {
1092 1092
 	global $wpinv_options;
1093 1093
     
1094
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1094
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1095 1095
 
1096
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1097
-		$value = $wpinv_options[ $args['id'] ];
1096
+	if (isset($wpinv_options[$args['id']])) {
1097
+		$value = $wpinv_options[$args['id']];
1098 1098
 	} else {
1099
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1099
+		$value = isset($args['std']) ? $args['std'] : '';
1100 1100
 	}
1101 1101
 
1102
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
1102
+	if (isset($args['faux']) && true === $args['faux']) {
1103 1103
 		$args['readonly'] = true;
1104
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1104
+		$value = isset($args['std']) ? $args['std'] : '';
1105 1105
 		$name  = '';
1106 1106
 	} else {
1107
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
1107
+		$name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"';
1108 1108
 	}
1109 1109
 
1110
-	$max  = isset( $args['max'] ) ? $args['max'] : 999999;
1111
-	$min  = isset( $args['min'] ) ? $args['min'] : 0;
1112
-	$step = isset( $args['step'] ) ? $args['step'] : 1;
1113
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
1110
+	$max  = isset($args['max']) ? $args['max'] : 999999;
1111
+	$min  = isset($args['min']) ? $args['min'] : 0;
1112
+	$step = isset($args['step']) ? $args['step'] : 1;
1113
+	$class = !empty($args['class']) ? sanitize_html_class($args['class']) : '';
1114 1114
 
1115
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1116
-	$html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"/>';
1117
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1115
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
1116
+	$html = '<input type="number" step="' . esc_attr($step) . '" max="' . esc_attr($max) . '" min="' . esc_attr($min) . '" class="' . sanitize_html_class($size) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr(stripslashes($value)) . '"/>';
1117
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1118 1118
 
1119 1119
 	echo $html;
1120 1120
 }
1121 1121
 
1122
-function wpinv_textarea_callback( $args ) {
1122
+function wpinv_textarea_callback($args) {
1123 1123
 	global $wpinv_options;
1124 1124
     
1125
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1125
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1126 1126
 
1127
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1128
-		$value = $wpinv_options[ $args['id'] ];
1127
+	if (isset($wpinv_options[$args['id']])) {
1128
+		$value = $wpinv_options[$args['id']];
1129 1129
 	} else {
1130
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1130
+		$value = isset($args['std']) ? $args['std'] : '';
1131 1131
 	}
1132 1132
     
1133
-    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1134
-    $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text';
1133
+    $size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
1134
+    $class = (isset($args['class']) && !is_null($args['class'])) ? $args['class'] : 'large-text';
1135 1135
 
1136
-	$html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
1137
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1136
+	$html = '<textarea class="' . sanitize_html_class($class) . ' txtarea-' . sanitize_html_class($size) . ' wpi-' . esc_attr(sanitize_html_class($sanitize_id)) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']">' . esc_textarea(stripslashes($value)) . '</textarea>';
1137
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1138 1138
 
1139 1139
 	echo $html;
1140 1140
 }
1141 1141
 
1142
-function wpinv_password_callback( $args ) {
1142
+function wpinv_password_callback($args) {
1143 1143
 	global $wpinv_options;
1144 1144
     
1145
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1145
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1146 1146
 
1147
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1148
-		$value = $wpinv_options[ $args['id'] ];
1147
+	if (isset($wpinv_options[$args['id']])) {
1148
+		$value = $wpinv_options[$args['id']];
1149 1149
 	} else {
1150
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1150
+		$value = isset($args['std']) ? $args['std'] : '';
1151 1151
 	}
1152 1152
 
1153
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1154
-	$html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>';
1155
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1153
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
1154
+	$html = '<input type="password" class="' . sanitize_html_class($size) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr($value) . '"/>';
1155
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1156 1156
 
1157 1157
 	echo $html;
1158 1158
 }
1159 1159
 
1160 1160
 function wpinv_missing_callback($args) {
1161 1161
 	printf(
1162
-		__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
1162
+		__('The callback function used for the %s setting is missing.', 'invoicing'),
1163 1163
 		'<strong>' . $args['id'] . '</strong>'
1164 1164
 	);
1165 1165
 }
@@ -1167,131 +1167,131 @@  discard block
 block discarded – undo
1167 1167
 function wpinv_select_callback($args) {
1168 1168
 	global $wpinv_options;
1169 1169
     
1170
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1170
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1171 1171
 
1172
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1173
-		$value = $wpinv_options[ $args['id'] ];
1172
+	if (isset($wpinv_options[$args['id']])) {
1173
+		$value = $wpinv_options[$args['id']];
1174 1174
 	} else {
1175
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1175
+		$value = isset($args['std']) ? $args['std'] : '';
1176 1176
 	}
1177 1177
     
1178
-    if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
1178
+    if (isset($args['selected']) && $args['selected'] !== null && $args['selected'] !== false) {
1179 1179
         $value = $args['selected'];
1180 1180
     }
1181 1181
 
1182
-	if ( isset( $args['placeholder'] ) ) {
1182
+	if (isset($args['placeholder'])) {
1183 1183
 		$placeholder = $args['placeholder'];
1184 1184
 	} else {
1185 1185
 		$placeholder = '';
1186 1186
 	}
1187 1187
     
1188
-    if( !empty( $args['onchange'] ) ) {
1189
-        $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"';
1188
+    if (!empty($args['onchange'])) {
1189
+        $onchange = ' onchange="' . esc_attr($args['onchange']) . '"';
1190 1190
     } else {
1191 1191
         $onchange = '';
1192 1192
     }
1193 1193
 
1194
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />';
1194
+	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" data-placeholder="' . esc_html($placeholder) . '"' . $onchange . ' />';
1195 1195
 
1196
-	foreach ( $args['options'] as $option => $name ) {
1197
-		$selected = selected( $option, $value, false );
1198
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
1196
+	foreach ($args['options'] as $option => $name) {
1197
+		$selected = selected($option, $value, false);
1198
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($name) . '</option>';
1199 1199
 	}
1200 1200
 
1201 1201
 	$html .= '</select>';
1202
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1202
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1203 1203
 
1204 1204
 	echo $html;
1205 1205
 }
1206 1206
 
1207
-function wpinv_color_select_callback( $args ) {
1207
+function wpinv_color_select_callback($args) {
1208 1208
 	global $wpinv_options;
1209 1209
     
1210
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1210
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1211 1211
 
1212
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1213
-		$value = $wpinv_options[ $args['id'] ];
1212
+	if (isset($wpinv_options[$args['id']])) {
1213
+		$value = $wpinv_options[$args['id']];
1214 1214
 	} else {
1215
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1215
+		$value = isset($args['std']) ? $args['std'] : '';
1216 1216
 	}
1217 1217
 
1218
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
1218
+	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']"/>';
1219 1219
 
1220
-	foreach ( $args['options'] as $option => $color ) {
1221
-		$selected = selected( $option, $value, false );
1222
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
1220
+	foreach ($args['options'] as $option => $color) {
1221
+		$selected = selected($option, $value, false);
1222
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($color['label']) . '</option>';
1223 1223
 	}
1224 1224
 
1225 1225
 	$html .= '</select>';
1226
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1226
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1227 1227
 
1228 1228
 	echo $html;
1229 1229
 }
1230 1230
 
1231
-function wpinv_rich_editor_callback( $args ) {
1231
+function wpinv_rich_editor_callback($args) {
1232 1232
 	global $wpinv_options, $wp_version;
1233 1233
     
1234
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1234
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1235 1235
 
1236
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1237
-		$value = $wpinv_options[ $args['id'] ];
1236
+	if (isset($wpinv_options[$args['id']])) {
1237
+		$value = $wpinv_options[$args['id']];
1238 1238
 
1239
-		if( empty( $args['allow_blank'] ) && empty( $value ) ) {
1240
-			$value = isset( $args['std'] ) ? $args['std'] : '';
1239
+		if (empty($args['allow_blank']) && empty($value)) {
1240
+			$value = isset($args['std']) ? $args['std'] : '';
1241 1241
 		}
1242 1242
 	} else {
1243
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1243
+		$value = isset($args['std']) ? $args['std'] : '';
1244 1244
 	}
1245 1245
 
1246
-	$rows = isset( $args['size'] ) ? $args['size'] : 20;
1246
+	$rows = isset($args['size']) ? $args['size'] : 20;
1247 1247
 
1248
-	if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
1248
+	if ($wp_version >= 3.3 && function_exists('wp_editor')) {
1249 1249
 		ob_start();
1250
-		wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ) ) );
1250
+		wp_editor(stripslashes($value), 'wpinv_settings_' . esc_attr($args['id']), array('textarea_name' => 'wpinv_settings[' . esc_attr($args['id']) . ']', 'textarea_rows' => absint($rows)));
1251 1251
 		$html = ob_get_clean();
1252 1252
 	} else {
1253
-		$html = '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
1253
+		$html = '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" class="wpi-' . esc_attr(sanitize_html_class($args['id'])) . '">' . esc_textarea(stripslashes($value)) . '</textarea>';
1254 1254
 	}
1255 1255
 
1256
-	$html .= '<br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1256
+	$html .= '<br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1257 1257
 
1258 1258
 	echo $html;
1259 1259
 }
1260 1260
 
1261
-function wpinv_upload_callback( $args ) {
1261
+function wpinv_upload_callback($args) {
1262 1262
 	global $wpinv_options;
1263 1263
     
1264
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1264
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1265 1265
 
1266
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1266
+	if (isset($wpinv_options[$args['id']])) {
1267 1267
 		$value = $wpinv_options[$args['id']];
1268 1268
 	} else {
1269 1269
 		$value = isset($args['std']) ? $args['std'] : '';
1270 1270
 	}
1271 1271
 
1272
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
1273
-	$html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
1274
-	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
1275
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
1272
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
1273
+	$html = '<input type="text" class="' . sanitize_html_class($size) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr(stripslashes($value)) . '"/>';
1274
+	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __('Upload File', 'invoicing') . '"/></span>';
1275
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1276 1276
 
1277 1277
 	echo $html;
1278 1278
 }
1279 1279
 
1280
-function wpinv_color_callback( $args ) {
1280
+function wpinv_color_callback($args) {
1281 1281
 	global $wpinv_options;
1282 1282
     
1283
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1283
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1284 1284
 
1285
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
1286
-		$value = $wpinv_options[ $args['id'] ];
1285
+	if (isset($wpinv_options[$args['id']])) {
1286
+		$value = $wpinv_options[$args['id']];
1287 1287
 	} else {
1288
-		$value = isset( $args['std'] ) ? $args['std'] : '';
1288
+		$value = isset($args['std']) ? $args['std'] : '';
1289 1289
 	}
1290 1290
 
1291
-	$default = isset( $args['std'] ) ? $args['std'] : '';
1291
+	$default = isset($args['std']) ? $args['std'] : '';
1292 1292
 
1293
-	$html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $default ) . '" />';
1294
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1293
+	$html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr($value) . '" data-default-color="' . esc_attr($default) . '" />';
1294
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1295 1295
 
1296 1296
 	echo $html;
1297 1297
 }
@@ -1299,9 +1299,9 @@  discard block
 block discarded – undo
1299 1299
 function wpinv_country_states_callback($args) {
1300 1300
 	global $wpinv_options;
1301 1301
     
1302
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
1302
+    $sanitize_id = wpinv_sanitize_key($args['id']);
1303 1303
 
1304
-	if ( isset( $args['placeholder'] ) ) {
1304
+	if (isset($args['placeholder'])) {
1305 1305
 		$placeholder = $args['placeholder'];
1306 1306
 	} else {
1307 1307
 		$placeholder = '';
@@ -1309,16 +1309,16 @@  discard block
 block discarded – undo
1309 1309
 
1310 1310
 	$states = wpinv_get_country_states();
1311 1311
 
1312
-	$class = empty( $states ) ? ' class="wpinv-no-states"' : '';
1313
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
1312
+	$class = empty($states) ? ' class="wpinv-no-states"' : '';
1313
+	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']"' . $class . 'data-placeholder="' . esc_html($placeholder) . '"/>';
1314 1314
 
1315
-	foreach ( $states as $option => $name ) {
1316
-		$selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : '';
1317
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
1315
+	foreach ($states as $option => $name) {
1316
+		$selected = isset($wpinv_options[$args['id']]) ? selected($option, $wpinv_options[$args['id']], false) : '';
1317
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($name) . '</option>';
1318 1318
 	}
1319 1319
 
1320 1320
 	$html .= '</select>';
1321
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
1321
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
1322 1322
 
1323 1323
 	echo $html;
1324 1324
 }
@@ -1333,95 +1333,95 @@  discard block
 block discarded – undo
1333 1333
 	<table id="wpinv_tax_rates" class="wp-list-table widefat fixed posts">
1334 1334
 		<thead>
1335 1335
 			<tr>
1336
-				<th scope="col" class="wpinv_tax_country"><?php _e( 'Country', 'invoicing' ); ?></th>
1337
-				<th scope="col" class="wpinv_tax_state"><?php _e( 'State / Province', 'invoicing' ); ?></th>
1338
-                <th scope="col" class="wpinv_tax_global" title="<?php esc_attr_e( 'Apply rate to whole country, regardless of state / province', 'invoicing' ); ?>"><?php _e( 'Country Wide', 'invoicing' ); ?></th>
1339
-                <th scope="col" class="wpinv_tax_rate"><?php _e( 'Rate %', 'invoicing' ); ?></th> 
1340
-                <th scope="col" class="wpinv_tax_name"><?php _e( 'Tax Name', 'invoicing' ); ?></th>
1341
-				<th scope="col" class="wpinv_tax_action"><?php _e( 'Remove', 'invoicing' ); ?></th>
1336
+				<th scope="col" class="wpinv_tax_country"><?php _e('Country', 'invoicing'); ?></th>
1337
+				<th scope="col" class="wpinv_tax_state"><?php _e('State / Province', 'invoicing'); ?></th>
1338
+                <th scope="col" class="wpinv_tax_global" title="<?php esc_attr_e('Apply rate to whole country, regardless of state / province', 'invoicing'); ?>"><?php _e('Country Wide', 'invoicing'); ?></th>
1339
+                <th scope="col" class="wpinv_tax_rate"><?php _e('Rate %', 'invoicing'); ?></th> 
1340
+                <th scope="col" class="wpinv_tax_name"><?php _e('Tax Name', 'invoicing'); ?></th>
1341
+				<th scope="col" class="wpinv_tax_action"><?php _e('Remove', 'invoicing'); ?></th>
1342 1342
 			</tr>
1343 1343
 		</thead>
1344 1344
         <tbody>
1345
-		<?php if( !empty( $rates ) ) : ?>
1346
-			<?php foreach( $rates as $key => $rate ) : ?>
1345
+		<?php if (!empty($rates)) : ?>
1346
+			<?php foreach ($rates as $key => $rate) : ?>
1347 1347
             <?php 
1348
-            $sanitized_key = wpinv_sanitize_key( $key );
1348
+            $sanitized_key = wpinv_sanitize_key($key);
1349 1349
             ?>
1350 1350
 			<tr>
1351 1351
 				<td class="wpinv_tax_country">
1352 1352
 					<?php
1353
-					echo wpinv_html_select( array(
1354
-						'options'          => wpinv_get_country_list( true ),
1353
+					echo wpinv_html_select(array(
1354
+						'options'          => wpinv_get_country_list(true),
1355 1355
 						'name'             => 'tax_rates[' . $sanitized_key . '][country]',
1356 1356
                         'id'               => 'tax_rates[' . $sanitized_key . '][country]',
1357 1357
 						'selected'         => $rate['country'],
1358 1358
 						'show_option_all'  => false,
1359 1359
 						'show_option_none' => false,
1360 1360
 						'class'            => 'wpinv-tax-country',
1361
-						'placeholder'      => __( 'Choose a country', 'invoicing' )
1362
-					) );
1361
+						'placeholder'      => __('Choose a country', 'invoicing')
1362
+					));
1363 1363
 					?>
1364 1364
 				</td>
1365 1365
 				<td class="wpinv_tax_state">
1366 1366
 					<?php
1367
-					$states = wpinv_get_country_states( $rate['country'] );
1368
-					if( !empty( $states ) ) {
1369
-						echo wpinv_html_select( array(
1370
-							'options'          => array_merge( array( '' => '' ), $states ),
1367
+					$states = wpinv_get_country_states($rate['country']);
1368
+					if (!empty($states)) {
1369
+						echo wpinv_html_select(array(
1370
+							'options'          => array_merge(array('' => ''), $states),
1371 1371
 							'name'             => 'tax_rates[' . $sanitized_key . '][state]',
1372 1372
                             'id'               => 'tax_rates[' . $sanitized_key . '][state]',
1373 1373
 							'selected'         => $rate['state'],
1374 1374
 							'show_option_all'  => false,
1375 1375
 							'show_option_none' => false,
1376
-							'placeholder'      => __( 'Choose a state', 'invoicing' )
1377
-						) );
1376
+							'placeholder'      => __('Choose a state', 'invoicing')
1377
+						));
1378 1378
 					} else {
1379
-						echo wpinv_html_text( array(
1379
+						echo wpinv_html_text(array(
1380 1380
 							'name'  => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'],
1381
-							'value' => ! empty( $rate['state'] ) ? $rate['state'] : '',
1381
+							'value' => !empty($rate['state']) ? $rate['state'] : '',
1382 1382
                             'id'    => 'tax_rates[' . $sanitized_key . '][state]',
1383
-						) );
1383
+						));
1384 1384
 					}
1385 1385
 					?>
1386 1386
 				</td>
1387 1387
 				<td class="wpinv_tax_global">
1388
-					<input type="checkbox" name="tax_rates[<?php echo $sanitized_key; ?>][global]" id="tax_rates[<?php echo $sanitized_key; ?>][global]" value="1"<?php checked( true, ! empty( $rate['global'] ) ); ?>/>
1389
-					<label for="tax_rates[<?php echo $sanitized_key; ?>][global]"><?php _e( 'Apply to whole country', 'invoicing' ); ?></label>
1388
+					<input type="checkbox" name="tax_rates[<?php echo $sanitized_key; ?>][global]" id="tax_rates[<?php echo $sanitized_key; ?>][global]" value="1"<?php checked(true, !empty($rate['global'])); ?>/>
1389
+					<label for="tax_rates[<?php echo $sanitized_key; ?>][global]"><?php _e('Apply to whole country', 'invoicing'); ?></label>
1390 1390
 				</td>
1391
-				<td class="wpinv_tax_rate"><input type="number" class="small-text" step="any" min="0" max="99" name="tax_rates[<?php echo $sanitized_key; ?>][rate]" value="<?php echo esc_html( $rate['rate'] ); ?>"/></td>
1392
-                <td class="wpinv_tax_name"><input type="text" class="regular-text" name="tax_rates[<?php echo $sanitized_key; ?>][name]" value="<?php echo esc_html( $rate['name'] ); ?>"/></td>
1393
-				<td class="wpinv_tax_action"><span class="wpinv_remove_tax_rate button-secondary"><?php _e( 'Remove Rate', 'invoicing' ); ?></span></td>
1391
+				<td class="wpinv_tax_rate"><input type="number" class="small-text" step="any" min="0" max="99" name="tax_rates[<?php echo $sanitized_key; ?>][rate]" value="<?php echo esc_html($rate['rate']); ?>"/></td>
1392
+                <td class="wpinv_tax_name"><input type="text" class="regular-text" name="tax_rates[<?php echo $sanitized_key; ?>][name]" value="<?php echo esc_html($rate['name']); ?>"/></td>
1393
+				<td class="wpinv_tax_action"><span class="wpinv_remove_tax_rate button-secondary"><?php _e('Remove Rate', 'invoicing'); ?></span></td>
1394 1394
 			</tr>
1395 1395
 			<?php endforeach; ?>
1396 1396
 		<?php else : ?>
1397 1397
 			<tr>
1398 1398
 				<td class="wpinv_tax_country">
1399 1399
 					<?php
1400
-					echo wpinv_html_select( array(
1401
-						'options'          => wpinv_get_country_list( true ),
1400
+					echo wpinv_html_select(array(
1401
+						'options'          => wpinv_get_country_list(true),
1402 1402
 						'name'             => 'tax_rates[0][country]',
1403 1403
 						'show_option_all'  => false,
1404 1404
 						'show_option_none' => false,
1405 1405
 						'class'            => 'wpinv-tax-country',
1406
-						'placeholder'      => __( 'Choose a country', 'invoicing' )
1407
-					) ); ?>
1406
+						'placeholder'      => __('Choose a country', 'invoicing')
1407
+					)); ?>
1408 1408
 				</td>
1409 1409
 				<td class="wpinv_tax_state">
1410
-					<?php echo wpinv_html_text( array(
1410
+					<?php echo wpinv_html_text(array(
1411 1411
 						'name' => 'tax_rates[0][state]'
1412
-					) ); ?>
1412
+					)); ?>
1413 1413
 				</td>
1414 1414
 				<td class="wpinv_tax_global">
1415 1415
 					<input type="checkbox" name="tax_rates[0][global]" id="tax_rates[0][global]" value="1"/>
1416
-					<label for="tax_rates[0][global]"><?php _e( 'Apply to whole country', 'invoicing' ); ?></label>
1416
+					<label for="tax_rates[0][global]"><?php _e('Apply to whole country', 'invoicing'); ?></label>
1417 1417
 				</td>
1418
-				<td class="wpinv_tax_rate"><input type="number" class="small-text" step="any" min="0" max="99" name="tax_rates[0][rate]" placeholder="<?php echo (float)wpinv_get_option( 'tax_rate', 0 ) ;?>" value="<?php echo (float)wpinv_get_option( 'tax_rate', 0 ) ;?>"/></td>
1418
+				<td class="wpinv_tax_rate"><input type="number" class="small-text" step="any" min="0" max="99" name="tax_rates[0][rate]" placeholder="<?php echo (float)wpinv_get_option('tax_rate', 0); ?>" value="<?php echo (float)wpinv_get_option('tax_rate', 0); ?>"/></td>
1419 1419
                 <td class="wpinv_tax_name"><input type="text" class="regular-text" name="tax_rates[0][name]" /></td>
1420
-				<td><span class="wpinv_remove_tax_rate button-secondary"><?php _e( 'Remove Rate', 'invoicing' ); ?></span></td>
1420
+				<td><span class="wpinv_remove_tax_rate button-secondary"><?php _e('Remove Rate', 'invoicing'); ?></span></td>
1421 1421
 			</tr>
1422 1422
 		<?php endif; ?>
1423 1423
         </tbody>
1424
-        <tfoot><tr><td colspan="5"></td><td class="wpinv_tax_action"><span class="button-secondary" id="wpinv_add_tax_rate"><?php _e( 'Add Tax Rate', 'invoicing' ); ?></span></td></tr></tfoot>
1424
+        <tfoot><tr><td colspan="5"></td><td class="wpinv_tax_action"><span class="button-secondary" id="wpinv_add_tax_rate"><?php _e('Add Tax Rate', 'invoicing'); ?></span></td></tr></tfoot>
1425 1425
 	</table>
1426 1426
 	<?php
1427 1427
 	echo ob_get_clean();
@@ -1432,54 +1432,54 @@  discard block
 block discarded – undo
1432 1432
     ob_start(); ?>
1433 1433
     </td><tr>
1434 1434
     <td colspan="2" class="wpinv_tools_tdbox">
1435
-    <?php if ( $args['desc'] ) { ?><p><?php echo $args['desc']; ?></p><?php } ?>
1436
-    <?php do_action( 'wpinv_tools_before' ); ?>
1435
+    <?php if ($args['desc']) { ?><p><?php echo $args['desc']; ?></p><?php } ?>
1436
+    <?php do_action('wpinv_tools_before'); ?>
1437 1437
     <table id="wpinv_tools_table" class="wp-list-table widefat fixed posts">
1438 1438
         <thead>
1439 1439
             <tr>
1440
-                <th scope="col" class="wpinv-th-tool"><?php _e( 'Tool', 'invoicing' ); ?></th>
1441
-                <th scope="col" class="wpinv-th-desc"><?php _e( 'Description', 'invoicing' ); ?></th>
1442
-                <th scope="col" class="wpinv-th-action"><?php _e( 'Action', 'invoicing' ); ?></th>
1440
+                <th scope="col" class="wpinv-th-tool"><?php _e('Tool', 'invoicing'); ?></th>
1441
+                <th scope="col" class="wpinv-th-desc"><?php _e('Description', 'invoicing'); ?></th>
1442
+                <th scope="col" class="wpinv-th-action"><?php _e('Action', 'invoicing'); ?></th>
1443 1443
             </tr>
1444 1444
         </thead>
1445
-            <?php do_action( 'wpinv_tools_row' ); ?>
1445
+            <?php do_action('wpinv_tools_row'); ?>
1446 1446
         <tbody>
1447 1447
         </tbody>
1448 1448
     </table>
1449
-    <?php do_action( 'wpinv_tools_after' ); ?>
1449
+    <?php do_action('wpinv_tools_after'); ?>
1450 1450
     <?php
1451 1451
     echo ob_get_clean();
1452 1452
 }
1453 1453
 
1454
-function wpinv_descriptive_text_callback( $args ) {
1455
-	echo wp_kses_post( $args['desc'] );
1454
+function wpinv_descriptive_text_callback($args) {
1455
+	echo wp_kses_post($args['desc']);
1456 1456
 }
1457 1457
 
1458
-function wpinv_hook_callback( $args ) {
1459
-	do_action( 'wpinv_' . $args['id'], $args );
1458
+function wpinv_hook_callback($args) {
1459
+	do_action('wpinv_' . $args['id'], $args);
1460 1460
 }
1461 1461
 
1462 1462
 function wpinv_set_settings_cap() {
1463 1463
 	return 'manage_options';
1464 1464
 }
1465
-add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' );
1465
+add_filter('option_page_capability_wpinv_settings', 'wpinv_set_settings_cap');
1466 1466
 
1467
-function wpinv_settings_sanitize_input( $value, $key ) {
1468
-    if ( $key == 'tax_rate' || $key == 'eu_fallback_rate' ) {
1469
-        $value = wpinv_sanitize_amount( $value, 4 );
1467
+function wpinv_settings_sanitize_input($value, $key) {
1468
+    if ($key == 'tax_rate' || $key == 'eu_fallback_rate') {
1469
+        $value = wpinv_sanitize_amount($value, 4);
1470 1470
         $value = $value >= 100 ? 99 : $value;
1471 1471
     }
1472 1472
         
1473 1473
     return $value;
1474 1474
 }
1475
-add_filter( 'wpinv_settings_sanitize', 'wpinv_settings_sanitize_input', 10, 2 );
1475
+add_filter('wpinv_settings_sanitize', 'wpinv_settings_sanitize_input', 10, 2);
1476 1476
 
1477
-function wpinv_on_update_settings( $old_value, $value, $option ) {
1478
-    $old = !empty( $old_value['remove_data_on_unistall'] ) ? 1 : '';
1479
-    $new = !empty( $value['remove_data_on_unistall'] ) ? 1 : '';
1477
+function wpinv_on_update_settings($old_value, $value, $option) {
1478
+    $old = !empty($old_value['remove_data_on_unistall']) ? 1 : '';
1479
+    $new = !empty($value['remove_data_on_unistall']) ? 1 : '';
1480 1480
     
1481
-    if ( $old != $new ) {
1482
-        update_option( 'wpinv_remove_data_on_invoice_unistall', $new );
1481
+    if ($old != $new) {
1482
+        update_option('wpinv_remove_data_on_invoice_unistall', $new);
1483 1483
     }
1484 1484
 }
1485
-add_action( 'update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3 );
1486 1485
\ No newline at end of file
1486
+add_action('update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3);
1487 1487
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1010,10 +1010,11 @@  discard block
 block discarded – undo
1010 1010
         
1011 1011
         $checked = false;
1012 1012
 
1013
-		if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key )
1014
-			$checked = true;
1015
-		elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) )
1016
-			$checked = true;
1013
+		if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key ) {
1014
+					$checked = true;
1015
+		} elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) ) {
1016
+					$checked = true;
1017
+		}
1017 1018
 
1018 1019
 		echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/>&nbsp;';
1019 1020
 		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>';
@@ -1030,10 +1031,11 @@  discard block
 block discarded – undo
1030 1031
 	foreach ( $args['options'] as $key => $option ) :
1031 1032
 		$sanitize_key = wpinv_sanitize_key( $key );
1032 1033
         
1033
-        if ( isset( $wpinv_options['gateways'][ $key ] ) )
1034
-			$enabled = '1';
1035
-		else
1036
-			$enabled = null;
1034
+        if ( isset( $wpinv_options['gateways'][ $key ] ) ) {
1035
+        			$enabled = '1';
1036
+        } else {
1037
+					$enabled = null;
1038
+		}
1037 1039
 
1038 1040
 		echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/>&nbsp;';
1039 1041
 		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
@@ -1393,7 +1395,8 @@  discard block
 block discarded – undo
1393 1395
 				<td class="wpinv_tax_action"><span class="wpinv_remove_tax_rate button-secondary"><?php _e( 'Remove Rate', 'invoicing' ); ?></span></td>
1394 1396
 			</tr>
1395 1397
 			<?php endforeach; ?>
1396
-		<?php else : ?>
1398
+		<?php else {
1399
+    : ?>
1397 1400
 			<tr>
1398 1401
 				<td class="wpinv_tax_country">
1399 1402
 					<?php
@@ -1404,7 +1407,9 @@  discard block
 block discarded – undo
1404 1407
 						'show_option_none' => false,
1405 1408
 						'class'            => 'wpinv-tax-country',
1406 1409
 						'placeholder'      => __( 'Choose a country', 'invoicing' )
1407
-					) ); ?>
1410
+					) );
1411
+}
1412
+?>
1408 1413
 				</td>
1409 1414
 				<td class="wpinv_tax_state">
1410 1415
 					<?php echo wpinv_html_text( array(
Please login to merge, or discard this patch.
includes/class-wpinv.php 1 patch
Spacing   +156 added lines, -156 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,194 +83,194 @@  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
-        $localize['txtComplete']          = __( 'Complete', 'invoicing' );
220
+        $localize['txtComplete']          = __('Complete', 'invoicing');
221 221
         
222
-        $localize = apply_filters( 'wpinv_front_js_localize', $localize );
222
+        $localize = apply_filters('wpinv_front_js_localize', $localize);
223 223
         
224
-        wp_enqueue_script( 'jquery-blockui' );
224
+        wp_enqueue_script('jquery-blockui');
225 225
         $autofill_api = wpinv_get_option('address_autofill_api');
226 226
         $autofill_active = wpinv_get_option('address_autofill_active');
227
-        if ( isset( $autofill_active ) && 1 == $autofill_active && !empty( $autofill_api ) && wpinv_is_checkout() ) {
228
-            if ( wp_script_is( 'google-maps-api', 'enqueued' ) ) {
229
-                wp_dequeue_script( 'google-maps-api' );
227
+        if (isset($autofill_active) && 1 == $autofill_active && !empty($autofill_api) && wpinv_is_checkout()) {
228
+            if (wp_script_is('google-maps-api', 'enqueued')) {
229
+                wp_dequeue_script('google-maps-api');
230 230
             }
231
-            wp_enqueue_script( 'google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array( 'jquery' ), '', false );
232
-            wp_enqueue_script( 'google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array( 'jquery', 'google-maps-api' ), '', true );
231
+            wp_enqueue_script('google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array('jquery'), '', false);
232
+            wp_enqueue_script('google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array('jquery', 'google-maps-api'), '', true);
233 233
         }
234
-        wp_enqueue_script( 'wpinv-front-script' );
235
-        wp_localize_script( 'wpinv-front-script', 'WPInv', $localize );
234
+        wp_enqueue_script('wpinv-front-script');
235
+        wp_localize_script('wpinv-front-script', 'WPInv', $localize);
236 236
     }
237 237
 
238 238
     public function admin_enqueue_scripts() {
239 239
         global $post, $pagenow;
240 240
         
241 241
         $post_type  = wpinv_admin_post_type();
242
-        $suffix     = '';//defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
243
-        $page       = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : '';
242
+        $suffix     = ''; //defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
243
+        $page       = isset($_GET['page']) ? strtolower($_GET['page']) : '';
244 244
 
245
-        wp_deregister_style( 'font-awesome' );
246
-        wp_register_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome' . $suffix . '.css', array(), '4.7.0' );
247
-        wp_enqueue_style( 'font-awesome' );
245
+        wp_deregister_style('font-awesome');
246
+        wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome' . $suffix . '.css', array(), '4.7.0');
247
+        wp_enqueue_style('font-awesome');
248 248
         
249 249
         $jquery_ui_css = false;
250
-        if ( ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $post_type == 'wpi_discount' ) && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) ) {
250
+        if (($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $post_type == 'wpi_discount') && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
251 251
             $jquery_ui_css = true;
252
-        } else if ( $page == 'wpinv-settings' || $page == 'wpinv-reports' ) {
252
+        } else if ($page == 'wpinv-settings' || $page == 'wpinv-reports') {
253 253
             $jquery_ui_css = true;
254 254
         }
255
-        if ( $jquery_ui_css ) {
256
-            wp_register_style( 'jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16' );
257
-            wp_enqueue_style( 'jquery-ui-css' );
255
+        if ($jquery_ui_css) {
256
+            wp_register_style('jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16');
257
+            wp_enqueue_style('jquery-ui-css');
258 258
         }
259 259
 
260
-        wp_register_style( 'wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION );
261
-        wp_enqueue_style( 'wpinv_meta_box_style' );
260
+        wp_register_style('wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION);
261
+        wp_enqueue_style('wpinv_meta_box_style');
262 262
         
263
-        wp_register_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), WPINV_VERSION );
264
-        wp_enqueue_style( 'wpinv_admin_style' );
263
+        wp_register_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), WPINV_VERSION);
264
+        wp_enqueue_style('wpinv_admin_style');
265 265
         
266
-        if ( $post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) ) {
267
-            wp_enqueue_script( 'jquery-ui-datepicker' );
266
+        if ($post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
267
+            wp_enqueue_script('jquery-ui-datepicker');
268 268
         }
269 269
 
270
-        wp_enqueue_style( 'wp-color-picker' );
271
-        wp_enqueue_script( 'wp-color-picker' );
270
+        wp_enqueue_style('wp-color-picker');
271
+        wp_enqueue_script('wp-color-picker');
272 272
         
273
-        wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true );
273
+        wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true);
274 274
 
275 275
         if ($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
276 276
             $autofill_api = wpinv_get_option('address_autofill_api');
@@ -281,17 +281,17 @@  discard block
 block discarded – undo
281 281
             }
282 282
         }
283 283
 
284
-        wp_register_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin' . $suffix . '.js', array( 'jquery', 'jquery-blockui','jquery-ui-tooltip' ),  WPINV_VERSION );
285
-        wp_enqueue_script( 'wpinv-admin-script' );
284
+        wp_register_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin' . $suffix . '.js', array('jquery', 'jquery-blockui', 'jquery-ui-tooltip'), WPINV_VERSION);
285
+        wp_enqueue_script('wpinv-admin-script');
286 286
         
287 287
         $localize                               = array();
288
-        $localize['ajax_url']                   = admin_url( 'admin-ajax.php' );
289
-        $localize['post_ID']                    = isset( $post->ID ) ? $post->ID : '';
290
-        $localize['wpinv_nonce']                = wp_create_nonce( 'wpinv-nonce' );
291
-        $localize['add_invoice_note_nonce']     = wp_create_nonce( 'add-invoice-note' );
292
-        $localize['delete_invoice_note_nonce']  = wp_create_nonce( 'delete-invoice-note' );
293
-        $localize['invoice_item_nonce']         = wp_create_nonce( 'invoice-item' );
294
-        $localize['billing_details_nonce']      = wp_create_nonce( 'get-billing-details' );
288
+        $localize['ajax_url']                   = admin_url('admin-ajax.php');
289
+        $localize['post_ID']                    = isset($post->ID) ? $post->ID : '';
290
+        $localize['wpinv_nonce']                = wp_create_nonce('wpinv-nonce');
291
+        $localize['add_invoice_note_nonce']     = wp_create_nonce('add-invoice-note');
292
+        $localize['delete_invoice_note_nonce']  = wp_create_nonce('delete-invoice-note');
293
+        $localize['invoice_item_nonce']         = wp_create_nonce('invoice-item');
294
+        $localize['billing_details_nonce']      = wp_create_nonce('get-billing-details');
295 295
         $localize['tax']                        = wpinv_tax_amount();
296 296
         $localize['discount']                   = wpinv_discount_amount();
297 297
         $localize['currency_symbol']            = wpinv_currency_symbol();
@@ -299,60 +299,60 @@  discard block
 block discarded – undo
299 299
         $localize['thousand_sep']               = wpinv_thousands_separator();
300 300
         $localize['decimal_sep']                = wpinv_decimal_separator();
301 301
         $localize['decimals']                   = wpinv_decimals();
302
-        $localize['save_invoice']               = __( 'Save Invoice', 'invoicing' );
303
-        $localize['status_publish']             = wpinv_status_nicename( 'publish' );
304
-        $localize['status_pending']             = wpinv_status_nicename( 'wpi-pending' );
305
-        $localize['delete_tax_rate']            = __( 'Are you sure you wish to delete this tax rate?', 'invoicing' );
306
-        $localize['OneItemMin']                 = __( 'Invoice must contain at least one item', 'invoicing' );
307
-        $localize['DeleteInvoiceItem']          = __( 'Are you sure you wish to delete this item?', 'invoicing' );
308
-        $localize['FillBillingDetails']         = __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' );
309
-        $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' );
310
-        $localize['AreYouSure']                 = __( 'Are you sure?', 'invoicing' );
311
-        $localize['errDeleteItem']              = __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' );
302
+        $localize['save_invoice']               = __('Save Invoice', 'invoicing');
303
+        $localize['status_publish']             = wpinv_status_nicename('publish');
304
+        $localize['status_pending']             = wpinv_status_nicename('wpi-pending');
305
+        $localize['delete_tax_rate']            = __('Are you sure you wish to delete this tax rate?', 'invoicing');
306
+        $localize['OneItemMin']                 = __('Invoice must contain at least one item', 'invoicing');
307
+        $localize['DeleteInvoiceItem']          = __('Are you sure you wish to delete this item?', 'invoicing');
308
+        $localize['FillBillingDetails']         = __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing');
309
+        $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');
310
+        $localize['AreYouSure']                 = __('Are you sure?', 'invoicing');
311
+        $localize['errDeleteItem']              = __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing');
312 312
 
313
-        $localize = apply_filters( 'wpinv_admin_js_localize', $localize );
313
+        $localize = apply_filters('wpinv_admin_js_localize', $localize);
314 314
 
315
-        wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', $localize );
315
+        wp_localize_script('wpinv-admin-script', 'WPInv_Admin', $localize);
316 316
     }
317 317
     
318
-    public function admin_body_class( $classes ) {
318
+    public function admin_body_class($classes) {
319 319
         global $pagenow, $post, $current_screen;
320 320
         
321
-        if ( !empty( $current_screen->post_type ) && ( $current_screen->post_type == 'wpi_invoice' || $current_screen->post_type == 'wpi_quote' ) ) {
321
+        if (!empty($current_screen->post_type) && ($current_screen->post_type == 'wpi_invoice' || $current_screen->post_type == 'wpi_quote')) {
322 322
             $classes .= ' wpinv-cpt';
323 323
         }
324 324
         
325
-        $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false;
325
+        $page = isset($_GET['page']) ? strtolower($_GET['page']) : false;
326 326
 
327 327
         $add_class = false;
328
-        if ( $pagenow == 'admin.php' && $page ) {
329
-            $add_class = strpos( $page, 'wpinv-' );
328
+        if ($pagenow == 'admin.php' && $page) {
329
+            $add_class = strpos($page, 'wpinv-');
330 330
         }
331 331
         
332 332
         $settings_class = array();
333
-        if ( $page == 'wpinv-settings' ) {
334
-            if ( !empty( $_REQUEST['tab'] ) ) {
335
-                $settings_class[] = sanitize_text_field( $_REQUEST['tab'] );
333
+        if ($page == 'wpinv-settings') {
334
+            if (!empty($_REQUEST['tab'])) {
335
+                $settings_class[] = sanitize_text_field($_REQUEST['tab']);
336 336
             }
337 337
             
338
-            if ( !empty( $_REQUEST['section'] ) ) {
339
-                $settings_class[] = sanitize_text_field( $_REQUEST['section'] );
338
+            if (!empty($_REQUEST['section'])) {
339
+                $settings_class[] = sanitize_text_field($_REQUEST['section']);
340 340
             }
341 341
             
342
-            $settings_class[] = isset( $_REQUEST['wpi_sub'] ) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field( $_REQUEST['wpi_sub'] ) : 'main';
342
+            $settings_class[] = isset($_REQUEST['wpi_sub']) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field($_REQUEST['wpi_sub']) : 'main';
343 343
         }
344 344
         
345
-        if ( !empty( $settings_class ) ) {
346
-            $classes .= ' wpi-' . wpinv_sanitize_key( implode( $settings_class, '-' ) );
345
+        if (!empty($settings_class)) {
346
+            $classes .= ' wpi-' . wpinv_sanitize_key(implode($settings_class, '-'));
347 347
         }
348 348
         
349 349
         $post_type = wpinv_admin_post_type();
350 350
 
351
-        if ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false ) {
351
+        if ($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false) {
352 352
             return $classes .= ' wpinv';
353 353
         }
354 354
         
355
-        if ( $pagenow == 'post.php' && $post_type == 'wpi_item' && !empty( $post ) && !wpinv_item_is_editable( $post ) ) {
355
+        if ($pagenow == 'post.php' && $post_type == 'wpi_item' && !empty($post) && !wpinv_item_is_editable($post)) {
356 356
             $classes .= ' wpi-editable-n';
357 357
         }
358 358
 
@@ -364,20 +364,20 @@  discard block
 block discarded – undo
364 364
     }
365 365
     
366 366
     public function wpinv_actions() {
367
-        if ( isset( $_REQUEST['wpi_action'] ) ) {
368
-            do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST );
367
+        if (isset($_REQUEST['wpi_action'])) {
368
+            do_action('wpinv_' . wpinv_sanitize_key($_REQUEST['wpi_action']), $_REQUEST);
369 369
         }
370 370
     }
371 371
     
372
-    public function pre_get_posts( $wp_query ) {
373
-        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() ) {
374
-            $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses() );
372
+    public function pre_get_posts($wp_query) {
373
+        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()) {
374
+            $wp_query->query_vars['post_status'] = array_keys(wpinv_get_invoice_statuses());
375 375
         }
376 376
         
377 377
         return $wp_query;
378 378
     }
379 379
     
380 380
     public function bp_invoicing_init() {
381
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' );
381
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php');
382 382
     }
383 383
 }
384 384
\ No newline at end of file
Please login to merge, or discard this patch.