Passed
Push — master ( e50c18...f198a7 )
by Stiofan
86:03 queued 31:21
created
includes/data/admin-settings.php 1 patch
Spacing   +170 added lines, -170 removed lines patch added patch discarded remove patch
@@ -8,99 +8,99 @@  discard block
 block discarded – undo
8 8
  * @version 1.0.19
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 $getpaid_pages = GetPaid_Installer::get_pages();
14
-$pages         = wpinv_get_pages( true );
14
+$pages         = wpinv_get_pages(true);
15 15
     
16 16
 $currencies = wpinv_get_currencies();
17 17
     
18 18
 $currency_code_options = array();
19
-foreach ( $currencies as $code => $name ) {
20
-    $currency_code_options[ $code ] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol( $code ) . ')';
19
+foreach ($currencies as $code => $name) {
20
+    $currency_code_options[$code] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol($code) . ')';
21 21
 }
22 22
 
23 23
 $invoice_number_padd_options = array();
24
-for ( $i = 0; $i <= 20; $i++ ) {
24
+for ($i = 0; $i <= 20; $i++) {
25 25
     $invoice_number_padd_options[$i] = $i;
26 26
 }
27 27
     
28 28
 $currency_symbol = wpinv_currency_symbol();
29 29
     
30 30
 $last_number = $reset_number = '';
31
-if ( $last_invoice_number = get_option( 'wpinv_last_invoice_number' ) ) {
32
-    $last_invoice_number = preg_replace( '/[^0-9]/', '', $last_invoice_number );
31
+if ($last_invoice_number = get_option('wpinv_last_invoice_number')) {
32
+    $last_invoice_number = preg_replace('/[^0-9]/', '', $last_invoice_number);
33 33
 
34
-    if ( !empty( $last_invoice_number ) ) {
35
-        $last_number = ' ' . wp_sprintf( __( "( Last Invoice's sequential number: <b>%s</b> )", 'invoicing' ), $last_invoice_number );
34
+    if (!empty($last_invoice_number)) {
35
+        $last_number = ' ' . wp_sprintf(__("( Last Invoice's sequential number: <b>%s</b> )", 'invoicing'), $last_invoice_number);
36 36
     }
37 37
 
38 38
     $nonce = wp_create_nonce('reset_invoice_count');
39
-    $reset_number = '<a href="'.add_query_arg(array('reset_invoice_count' => 1, '_nonce' => $nonce)).'" class="btn button">'.__('Force Reset Sequence', 'invoicing' ). '</a>';
39
+    $reset_number = '<a href="' . add_query_arg(array('reset_invoice_count' => 1, '_nonce' => $nonce)) . '" class="btn button">' . __('Force Reset Sequence', 'invoicing') . '</a>';
40 40
 }
41 41
     
42 42
 $alert_wrapper_start = '<p style="color: #F00">';
43 43
 $alert_wrapper_close = '</p>';
44 44
 
45 45
 return array(
46
-    'general' => apply_filters( 'wpinv_settings_general',
46
+    'general' => apply_filters('wpinv_settings_general',
47 47
         array(
48 48
             'main' => array(
49 49
                 'location_settings' => array(
50 50
                     'id'   => 'location_settings',
51
-                    'name' => '<h3>' . __( 'Default Location', 'invoicing' ) . '</h3>',
51
+                    'name' => '<h3>' . __('Default Location', 'invoicing') . '</h3>',
52 52
                     'desc' => '',
53 53
                     'type' => 'header',
54 54
                 ),
55 55
                 'default_country' => array(
56 56
                     'id'      => 'default_country',
57
-                    'name'    => __( 'Default Country', 'invoicing' ),
58
-                    'desc'    => __( 'Where does your store operate from?', 'invoicing' ),
57
+                    'name'    => __('Default Country', 'invoicing'),
58
+                    'desc'    => __('Where does your store operate from?', 'invoicing'),
59 59
                     'type'    => 'select',
60 60
                     'options' => wpinv_get_country_list(),
61 61
                     'std'     => 'GB',
62 62
                     'class'   => 'wpi_select2',
63
-                    'placeholder' => __( 'Select a country', 'invoicing' ),
63
+                    'placeholder' => __('Select a country', 'invoicing'),
64 64
                 ),
65 65
                 'default_state' => array(
66 66
                     'id'      => 'default_state',
67
-                    'name'    => __( 'Default State / Province', 'invoicing' ),
68
-                    'desc'    => __( 'What state / province does your store operate from?', 'invoicing' ),
67
+                    'name'    => __('Default State / Province', 'invoicing'),
68
+                    'desc'    => __('What state / province does your store operate from?', 'invoicing'),
69 69
                     'type'    => 'country_states',
70 70
                     'class'   => 'wpi_select2',
71
-                    'placeholder' => __( 'Select a state', 'invoicing' ),
71
+                    'placeholder' => __('Select a state', 'invoicing'),
72 72
                 ),
73 73
                 'store_name' => array(
74 74
                     'id'   => 'store_name',
75
-                    'name' => __( 'Store Name', 'invoicing' ),
76
-                    'desc' => __( 'Store name to print on invoices.', 'invoicing' ),
75
+                    'name' => __('Store Name', 'invoicing'),
76
+                    'desc' => __('Store name to print on invoices.', 'invoicing'),
77 77
                     'std'     => get_option('blogname'),
78 78
                     'type' => 'text',
79 79
                 ),
80 80
                 'logo' => array(
81 81
                     'id'   => 'logo',
82
-                    'name' => __( 'Logo URL', 'invoicing' ),
83
-                    'desc' => __( 'Store logo to print on invoices.', 'invoicing' ),
82
+                    'name' => __('Logo URL', 'invoicing'),
83
+                    'desc' => __('Store logo to print on invoices.', 'invoicing'),
84 84
                     'type' => 'text',
85 85
                 ),
86 86
                 'logo_width'      => array(
87 87
                     'id'          => 'logo_width',
88
-                    'name'        => __( 'Logo width', 'invoicing' ),
89
-                    'desc'        => __( 'Logo width to use in invoice image.', 'invoicing' ),
88
+                    'name'        => __('Logo width', 'invoicing'),
89
+                    'desc'        => __('Logo width to use in invoice image.', 'invoicing'),
90 90
                     'type'        => 'number',
91
-                    'placeholder' => __( 'Auto', 'invoicing' ),
91
+                    'placeholder' => __('Auto', 'invoicing'),
92 92
                 ),
93 93
                 'logo_height'     => array(
94 94
                     'id'          => 'logo_height',
95
-                    'name'        => __( 'Logo height', 'invoicing' ),
96
-                    'desc'        => __( 'Logo height to use in invoice image.', 'invoicing' ),
95
+                    'name'        => __('Logo height', 'invoicing'),
96
+                    'desc'        => __('Logo height to use in invoice image.', 'invoicing'),
97 97
                     'type'        => 'number',
98
-                    'placeholder' => __( 'Auto', 'invoicing' ),
98
+                    'placeholder' => __('Auto', 'invoicing'),
99 99
                 ),
100 100
                 'store_address' => array(
101 101
                     'id'   => 'store_address',
102
-                    'name' => __( 'Store Address', 'invoicing' ),
103
-                    'desc' => __( 'Enter the store address to display on invoice', 'invoicing' ),
102
+                    'name' => __('Store Address', 'invoicing'),
103
+                    'desc' => __('Enter the store address to display on invoice', 'invoicing'),
104 104
                     'type' => 'textarea',
105 105
                 ),
106 106
 
@@ -108,114 +108,114 @@  discard block
 block discarded – undo
108 108
             'page_section' => array(
109 109
                 'page_settings' => array(
110 110
                     'id'   => 'page_settings',
111
-                    'name' => '<h3>' . __( 'Page Settings', 'invoicing' ) . '</h3>',
111
+                    'name' => '<h3>' . __('Page Settings', 'invoicing') . '</h3>',
112 112
                     'desc' => '',
113 113
                     'type' => 'header',
114 114
                 ),
115 115
                 'checkout_page' => array(
116 116
                     'id'          => 'checkout_page',
117
-                    'name'        => __( 'Checkout Page', 'invoicing' ),
118
-                    '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' ),
117
+                    'name'        => __('Checkout Page', 'invoicing'),
118
+                    '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'),
119 119
                     'type'        => 'select',
120 120
                     'options'     => $pages,
121 121
                     'class'       => 'wpi_select2',
122
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
123
-                    'default_content' => empty( $getpaid_pages['checkout_page'] ) ? '' : $getpaid_pages['checkout_page']['content'],
122
+                    'placeholder' => __('Select a page', 'invoicing'),
123
+                    'default_content' => empty($getpaid_pages['checkout_page']) ? '' : $getpaid_pages['checkout_page']['content'],
124 124
                     'help-tip'    => true,
125 125
                 ),
126 126
                 'success_page' => array(
127 127
                     'id'          => 'success_page',
128
-                    'name'        => __( 'Success Page', 'invoicing' ),
129
-                    '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' ),
128
+                    'name'        => __('Success Page', 'invoicing'),
129
+                    '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'),
130 130
                     'type'        => 'select',
131 131
                     'options'     => $pages,
132 132
                     'class'       => 'wpi_select2',
133
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
134
-                    'default_content' => empty( $getpaid_pages['success_page'] ) ? '' : $getpaid_pages['success_page']['content'],
133
+                    'placeholder' => __('Select a page', 'invoicing'),
134
+                    'default_content' => empty($getpaid_pages['success_page']) ? '' : $getpaid_pages['success_page']['content'],
135 135
                     'help-tip'    => true,
136 136
                 ),
137 137
                 'failure_page' => array(
138 138
                     'id'          => 'failure_page',
139
-                    'name'        => __( 'Failed Transaction Page', 'invoicing' ),
140
-                    'desc'        => __( 'This is the page buyers are sent to if their transaction is cancelled or fails.', 'invoicing' ),
139
+                    'name'        => __('Failed Transaction Page', 'invoicing'),
140
+                    'desc'        => __('This is the page buyers are sent to if their transaction is cancelled or fails.', 'invoicing'),
141 141
                     'type'        => 'select',
142 142
                     'options'     => $pages,
143 143
                     'class'       => 'wpi_select2',
144
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
145
-                    'default_content' => empty( $getpaid_pages['failure_page'] ) ? '' : $getpaid_pages['failure_page']['content'],
144
+                    'placeholder' => __('Select a page', 'invoicing'),
145
+                    'default_content' => empty($getpaid_pages['failure_page']) ? '' : $getpaid_pages['failure_page']['content'],
146 146
                     'help-tip'    => true,
147 147
                 ),
148 148
                 'invoice_history_page' => array(
149 149
                     'id'          => 'invoice_history_page',
150
-                    'name'        => __( 'Invoice History Page', 'invoicing' ),
151
-                    'desc'        => __( 'This page shows an invoice history for the current user. The <b>[wpinv_history]</b> short code should be on this page.', 'invoicing' ),
150
+                    'name'        => __('Invoice History Page', 'invoicing'),
151
+                    'desc'        => __('This page shows an invoice history for the current user. The <b>[wpinv_history]</b> short code should be on this page.', 'invoicing'),
152 152
                     'type'        => 'select',
153 153
                     'options'     => $pages,
154 154
                     'class'       => 'wpi_select2',
155
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
156
-                    'default_content' => empty( $getpaid_pages['invoice_history_page'] ) ? '' : $getpaid_pages['invoice_history_page']['content'],
155
+                    'placeholder' => __('Select a page', 'invoicing'),
156
+                    'default_content' => empty($getpaid_pages['invoice_history_page']) ? '' : $getpaid_pages['invoice_history_page']['content'],
157 157
                     'help-tip'    => true,
158 158
                 ),
159 159
                 'invoice_subscription_page' => array(
160 160
                     'id'          => 'invoice_subscription_page',
161
-                    'name'        => __( 'Invoice Subscriptions Page', 'invoicing' ),
162
-                    'desc'        => __( 'This page shows subscriptions history for the current user. The <b>[wpinv_subscriptions]</b> short code should be on this page.', 'invoicing' ),
161
+                    'name'        => __('Invoice Subscriptions Page', 'invoicing'),
162
+                    'desc'        => __('This page shows subscriptions history for the current user. The <b>[wpinv_subscriptions]</b> short code should be on this page.', 'invoicing'),
163 163
                     'type'        => 'select',
164 164
                     'options'     => $pages,
165 165
                     'class'       => 'wpi_select2',
166
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
167
-                    'default_content' => empty( $getpaid_pages['invoice_subscription_page'] ) ? '' : $getpaid_pages['invoice_subscription_page']['content'],
166
+                    'placeholder' => __('Select a page', 'invoicing'),
167
+                    'default_content' => empty($getpaid_pages['invoice_subscription_page']) ? '' : $getpaid_pages['invoice_subscription_page']['content'],
168 168
                     'help-tip'    => true,
169 169
                 ),
170 170
             ),
171 171
             'currency_section' => array(
172 172
                 'currency_settings' => array(
173 173
                     'id'   => 'currency_settings',
174
-                    'name' => '<h3>' . __( 'Currency Settings', 'invoicing' ) . '</h3>',
174
+                    'name' => '<h3>' . __('Currency Settings', 'invoicing') . '</h3>',
175 175
                     'desc' => '',
176 176
                     'type' => 'header',
177 177
                 ),
178 178
                 'currency' => array(
179 179
                     'id'      => 'currency',
180
-                    'name'    => __( 'Currency', 'invoicing' ),
181
-                    'desc'    => __( 'Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing' ),
180
+                    'name'    => __('Currency', 'invoicing'),
181
+                    'desc'    => __('Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing'),
182 182
                     'type'    => 'select',
183 183
                     'class'       => 'wpi_select2',
184 184
                     'options' => $currency_code_options,
185 185
                 ),
186 186
                 'currency_position' => array(
187 187
                     'id'      => 'currency_position',
188
-                    'name'    => __( 'Currency Position', 'invoicing' ),
189
-                    'desc'    => __( 'Choose the location of the currency sign.', 'invoicing' ),
188
+                    'name'    => __('Currency Position', 'invoicing'),
189
+                    'desc'    => __('Choose the location of the currency sign.', 'invoicing'),
190 190
                     'type'    => 'select',
191 191
                     'class'   => 'wpi_select2',
192 192
                     'options'  => array(
193
-                        'left'        => __( 'Left', 'invoicing' ) . ' (' . $currency_symbol . wpinv_format_amount( '99.99' ) . ')',
194
-                        'right'       => __( 'Right', 'invoicing' ) . ' ('. wpinv_format_amount( '99.99' ) . $currency_symbol . ')',
195
-                        'left_space'  => __( 'Left with space', 'invoicing' ) . ' (' . $currency_symbol . ' ' . wpinv_format_amount( '99.99' ) . ')',
196
-                        'right_space' => __( 'Right with space', 'invoicing' ) . ' (' . wpinv_format_amount( '99.99' ) . ' ' . $currency_symbol . ')'
193
+                        'left'        => __('Left', 'invoicing') . ' (' . $currency_symbol . wpinv_format_amount('99.99') . ')',
194
+                        'right'       => __('Right', 'invoicing') . ' (' . wpinv_format_amount('99.99') . $currency_symbol . ')',
195
+                        'left_space'  => __('Left with space', 'invoicing') . ' (' . $currency_symbol . ' ' . wpinv_format_amount('99.99') . ')',
196
+                        'right_space' => __('Right with space', 'invoicing') . ' (' . wpinv_format_amount('99.99') . ' ' . $currency_symbol . ')'
197 197
                     )
198 198
                 ),
199 199
                 'thousands_separator' => array(
200 200
                     'id'   => 'thousands_separator',
201
-                    'name' => __( 'Thousands Separator', 'invoicing' ),
202
-                    'desc' => __( 'The symbol (usually , or .) to separate thousands', 'invoicing' ),
201
+                    'name' => __('Thousands Separator', 'invoicing'),
202
+                    'desc' => __('The symbol (usually , or .) to separate thousands', 'invoicing'),
203 203
                     'type' => 'text',
204 204
                     'size' => 'small',
205 205
                     'std'  => ',',
206 206
                 ),
207 207
                 'decimal_separator' => array(
208 208
                     'id'   => 'decimal_separator',
209
-                    'name' => __( 'Decimal Separator', 'invoicing' ),
210
-                    'desc' => __( 'The symbol (usually , or .) to separate decimal points', 'invoicing' ),
209
+                    'name' => __('Decimal Separator', 'invoicing'),
210
+                    'desc' => __('The symbol (usually , or .) to separate decimal points', 'invoicing'),
211 211
                     'type' => 'text',
212 212
                     'size' => 'small',
213 213
                     'std'  => '.',
214 214
                 ),
215 215
                 'decimals' => array(
216 216
                     'id'   => 'decimals',
217
-                    'name' => __( 'Number of Decimals', 'invoicing' ),
218
-                    'desc' => __( 'This sets the number of decimal points shown in displayed prices.', 'invoicing' ),
217
+                    'name' => __('Number of Decimals', 'invoicing'),
218
+                    'desc' => __('This sets the number of decimal points shown in displayed prices.', 'invoicing'),
219 219
                     'type' => 'number',
220 220
                     'size' => 'small',
221 221
                     'std'  => '2',
@@ -227,21 +227,21 @@  discard block
 block discarded – undo
227 227
             'labels' => array(
228 228
                 'labels' => array(
229 229
                     'id'   => 'labels_settings',
230
-                    'name' => '<h3>' . __( 'Invoice Labels', 'invoicing' ) . '</h3>',
230
+                    'name' => '<h3>' . __('Invoice Labels', 'invoicing') . '</h3>',
231 231
                     'desc' => '',
232 232
                     'type' => 'header',
233 233
                 ),
234 234
                 'vat_invoice_notice_label' => array(
235 235
                     'id' => 'vat_invoice_notice_label',
236
-                    'name' => __( 'Invoice Notice Label', 'invoicing' ),
237
-                    'desc' => __( 'Use this to add an invoice notice section (label) to your invoices', 'invoicing' ),
236
+                    'name' => __('Invoice Notice Label', 'invoicing'),
237
+                    'desc' => __('Use this to add an invoice notice section (label) to your invoices', 'invoicing'),
238 238
                     'type' => 'text',
239 239
                     'size' => 'regular',
240 240
                 ),
241 241
                 'vat_invoice_notice' => array(
242 242
                     'id' => 'vat_invoice_notice',
243
-                    'name' => __( 'Invoice notice', 'invoicing' ),
244
-                    'desc' =>   __( 'Use this to add an invoice notice section (description) to your invoices', 'invoicing' ),
243
+                    'name' => __('Invoice notice', 'invoicing'),
244
+                    'desc' =>   __('Use this to add an invoice notice section (description) to your invoices', 'invoicing'),
245 245
                     'type' => 'text',
246 246
                     'size' => 'regular',
247 247
                 ),
@@ -253,22 +253,22 @@  discard block
 block discarded – undo
253 253
             'main' => array(
254 254
                 'gateway_settings' => array(
255 255
                     'id'   => 'api_header',
256
-                    'name' => '<h3>' . __( 'Gateway Settings', 'invoicing' ) . '</h3>',
256
+                    'name' => '<h3>' . __('Gateway Settings', 'invoicing') . '</h3>',
257 257
                     'desc' => '',
258 258
                     'type' => 'header',
259 259
                 ),
260 260
                 'gateways' => array(
261 261
                     'id'      => 'gateways',
262
-                    'name'    => __( 'Payment Gateways', 'invoicing' ),
263
-                    'desc'    => __( 'Choose the payment gateways you want to enable.', 'invoicing' ),
262
+                    'name'    => __('Payment Gateways', 'invoicing'),
263
+                    'desc'    => __('Choose the payment gateways you want to enable.', 'invoicing'),
264 264
                     'type'    => 'gateways',
265
-                    'std'     => array( 'manual'=>1 ),
265
+                    'std'     => array('manual'=>1),
266 266
                     'options' => wpinv_get_payment_gateways(),
267 267
                 ),
268 268
                 'default_gateway' => array(
269 269
                     'id'      => 'default_gateway',
270
-                    'name'    => __( 'Default Gateway', 'invoicing' ),
271
-                    'desc'    => __( 'This gateway will be loaded automatically with the checkout page.', 'invoicing' ),
270
+                    'name'    => __('Default Gateway', 'invoicing'),
271
+                    'desc'    => __('This gateway will be loaded automatically with the checkout page.', 'invoicing'),
272 272
                     'type'    => 'gateway_select',
273 273
                     'std'     => 'manual',
274 274
                     'class'   => 'wpi_select2',
@@ -283,32 +283,32 @@  discard block
 block discarded – undo
283 283
             'main' => array(
284 284
                 'tax_settings' => array(
285 285
                     'id'   => 'tax_settings',
286
-                    'name' => '<h3>' . __( 'Tax Settings', 'invoicing' ) . '</h3>',
286
+                    'name' => '<h3>' . __('Tax Settings', 'invoicing') . '</h3>',
287 287
                     'type' => 'header',
288 288
                 ),
289 289
 
290 290
                 'enable_taxes' => array(
291 291
                     'id'       => 'enable_taxes',
292
-                    'name'     => __( 'Enable Taxes', 'invoicing' ),
293
-                    'desc'     => __( 'Enable tax rates and calculations.', 'invoicing' ),
292
+                    'name'     => __('Enable Taxes', 'invoicing'),
293
+                    'desc'     => __('Enable tax rates and calculations.', 'invoicing'),
294 294
                     'type'     => 'checkbox',
295 295
                     'std'      => 0,
296 296
                 ),
297 297
 
298 298
                 'tax_subtotal_rounding' => array(
299 299
                     'id'                => 'tax_subtotal_rounding',
300
-                    'name'              => __( 'Rounding', 'invoicing' ),
301
-                    'desc'              => __( 'Round tax at subtotal level, instead of rounding per tax rate', 'invoicing' ),
300
+                    'name'              => __('Rounding', 'invoicing'),
301
+                    'desc'              => __('Round tax at subtotal level, instead of rounding per tax rate', 'invoicing'),
302 302
                     'type'              => 'checkbox',
303 303
                     'std'               => 1,
304 304
                 ),
305 305
 
306 306
                 'prices_include_tax' => array(
307 307
                     'id'      => 'prices_include_tax',
308
-                    'name'    => __( 'Prices entered with tax', 'invoicing' ),
308
+                    'name'    => __('Prices entered with tax', 'invoicing'),
309 309
                     'options' => array(
310
-                        'yes' => __( 'Yes, I will enter prices inclusive of tax', 'invoicing' ),
311
-                        'no'  => __( 'No, I will enter prices exclusive of tax', 'invoicing' ),
310
+                        'yes' => __('Yes, I will enter prices inclusive of tax', 'invoicing'),
311
+                        'no'  => __('No, I will enter prices exclusive of tax', 'invoicing'),
312 312
                     ),
313 313
                     'type'    => 'select',
314 314
                     'std'     => 'no',
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
 
317 317
                 'tax_base'              => array(
318 318
                     'id'                => 'tax_base',
319
-                    'name'              => __( 'Calculate tax based on', 'invoicing' ),
319
+                    'name'              => __('Calculate tax based on', 'invoicing'),
320 320
                     'options'           => array(
321
-                        'billing'       => __( 'Customer billing address', 'invoicing' ),
322
-                        'base'          => __( 'Shop base address', 'invoicing' ),
321
+                        'billing'       => __('Customer billing address', 'invoicing'),
322
+                        'base'          => __('Shop base address', 'invoicing'),
323 323
                     ),
324 324
                     'type'              => 'select',
325 325
                     'std'               => 'billing',
@@ -327,10 +327,10 @@  discard block
 block discarded – undo
327 327
 
328 328
                 'tax_display_totals'    => array(
329 329
                     'id'                => 'tax_display_totals',
330
-                    'name'              => __( 'Display tax totals', 'invoicing' ),
330
+                    'name'              => __('Display tax totals', 'invoicing'),
331 331
                     'options'           => array(
332
-                        'single'        => __( 'As a single total', 'invoicing' ),
333
-                        'individual'    => __( 'As individual tax rates', 'invoicing' ),
332
+                        'single'        => __('As a single total', 'invoicing'),
333
+                        'individual'    => __('As individual tax rates', 'invoicing'),
334 334
                     ),
335 335
                     'type'              => 'select',
336 336
                     'std'               => 'individual',
@@ -338,8 +338,8 @@  discard block
 block discarded – undo
338 338
 
339 339
                 'tax_rate' => array(
340 340
                     'id'   => 'tax_rate',
341
-                    'name' => __( 'Fallback Tax Rate', 'invoicing' ),
342
-                    'desc' => __( 'Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing' ),
341
+                    'name' => __('Fallback Tax Rate', 'invoicing'),
342
+                    'desc' => __('Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing'),
343 343
                     'type' => 'number',
344 344
                     'size' => 'small',
345 345
                     'min'  => '0',
@@ -351,8 +351,8 @@  discard block
 block discarded – undo
351 351
             'rates' => array(
352 352
                 'tax_rates' => array(
353 353
                     'id'   => 'tax_rates',
354
-                    'name' => '<h3>' . __( 'Tax Rates', 'invoicing' ) . '</h3>',
355
-                    'desc' => __( 'Enter tax rates for specific regions.', 'invoicing' ),
354
+                    'name' => '<h3>' . __('Tax Rates', 'invoicing') . '</h3>',
355
+                    'desc' => __('Enter tax rates for specific regions.', 'invoicing'),
356 356
                     'type' => 'tax_rates',
357 357
                 ),
358 358
             ),
@@ -361,45 +361,45 @@  discard block
 block discarded – undo
361 361
 
362 362
                 'vat_company_name' => array(
363 363
                     'id' => 'vat_company_name',
364
-                    'name' => __( 'Company Name', 'invoicing' ),
365
-                    'desc' => wp_sprintf(__( 'Verify your company name and  VAT number on the %sEU VIES System.%s', 'invoicing' ), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>' ),
364
+                    'name' => __('Company Name', 'invoicing'),
365
+                    'desc' => wp_sprintf(__('Verify your company name and  VAT number on the %sEU VIES System.%s', 'invoicing'), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>'),
366 366
                     'type' => 'text',
367 367
                     'size' => 'regular',
368 368
                 ),
369 369
 
370 370
                 'vat_number' => array(
371 371
                     'id'   => 'vat_number',
372
-                    'name' => __( 'VAT Number', 'invoicing' ),
373
-                    'desc' => __( 'Enter your VAT number including the country identifier, eg: GB123456789', 'invoicing' ),
372
+                    'name' => __('VAT Number', 'invoicing'),
373
+                    'desc' => __('Enter your VAT number including the country identifier, eg: GB123456789', 'invoicing'),
374 374
                     'type' => 'text',
375 375
                     'size' => 'regular',
376 376
                 ),
377 377
 
378 378
                 'vat_prevent_b2c_purchase' => array(
379 379
                     'id' => 'vat_prevent_b2c_purchase',
380
-                    'name' => __( 'Prevent B2C Sales', 'invoicing' ),
381
-                    'desc' => __( 'Require everyone in the EU to provide a VAT number.', 'invoicing' ),
380
+                    'name' => __('Prevent B2C Sales', 'invoicing'),
381
+                    'desc' => __('Require everyone in the EU to provide a VAT number.', 'invoicing'),
382 382
                     'type' => 'checkbox'
383 383
                 ),
384 384
 
385 385
                 'validate_vat_number' => array(
386 386
                     'id'   => 'validate_vat_number',
387
-                    'name' => __( 'Validate VAT Number', 'invoicing' ),
388
-                    'desc' => __( 'Validate VAT numbers with VIES.', 'invoicing' ),
387
+                    'name' => __('Validate VAT Number', 'invoicing'),
388
+                    'desc' => __('Validate VAT numbers with VIES.', 'invoicing'),
389 389
                     'type' => 'checkbox'
390 390
                 ),
391 391
 
392 392
                 'vat_same_country_rule' => array(
393 393
                     'id'          => 'vat_same_country_rule',
394
-                    'name'        => __( 'Same Country Rule', 'invoicing' ),
395
-                    'desc'        => __( 'What should happen if a customer is from the same country as your business?', 'invoicing' ),
394
+                    'name'        => __('Same Country Rule', 'invoicing'),
395
+                    'desc'        => __('What should happen if a customer is from the same country as your business?', 'invoicing'),
396 396
                     'type'        => 'select',
397 397
                     'options'     => array(
398
-                        'no'        => __( 'Do not charge tax', 'invoicing' ),
399
-                        'always'    => __( 'Charge tax unless vat number is validated', 'invoicing' ),
400
-                        'vat_too'   => __( 'Charge tax even if vat number is validated', 'invoicing' )
398
+                        'no'        => __('Do not charge tax', 'invoicing'),
399
+                        'always'    => __('Charge tax unless vat number is validated', 'invoicing'),
400
+                        'vat_too'   => __('Charge tax even if vat number is validated', 'invoicing')
401 401
                     ),
402
-                    'placeholder' => __( 'Select an option', 'invoicing' ),
402
+                    'placeholder' => __('Select an option', 'invoicing'),
403 403
                     'std'         => 'vat_too',
404 404
                 ),
405 405
 
@@ -413,66 +413,66 @@  discard block
 block discarded – undo
413 413
             'main' => array(
414 414
                 'email_settings_header' => array(
415 415
                     'id'   => 'email_settings_header',
416
-                    'name' => '<h3>' . __( 'Email Sender Options', 'invoicing' ) . '</h3>',
416
+                    'name' => '<h3>' . __('Email Sender Options', 'invoicing') . '</h3>',
417 417
                     'type' => 'header',
418 418
                 ),
419 419
                 'email_from_name' => array(
420 420
                     'id'   => 'email_from_name',
421
-                    'name' => __( 'From Name', 'invoicing' ),
422
-                    'desc' => __( 'Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing' ),
423
-                    'std' => esc_attr( get_bloginfo( 'name', 'display' ) ),
421
+                    'name' => __('From Name', 'invoicing'),
422
+                    'desc' => __('Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing'),
423
+                    'std' => esc_attr(get_bloginfo('name', 'display')),
424 424
                     'type' => 'text',
425 425
                 ),
426 426
                 'email_from' => array(
427 427
                     'id'   => 'email_from',
428
-                    'name' => __( 'From Email', 'invoicing' ),
429
-                    'desc' => sprintf (__( 'Email address to send invoice emails from. This will act as the "from" 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),
430
-                    'std' => get_option( 'admin_email' ),
428
+                    'name' => __('From Email', 'invoicing'),
429
+                    'desc' => sprintf(__('Email address to send invoice emails from. This will act as the "from" 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),
430
+                    'std' => get_option('admin_email'),
431 431
                     'type' => 'text',
432 432
                 ),
433 433
                 'admin_email' => array(
434 434
                     'id'   => 'admin_email',
435
-                    'name' => __( 'Admin Email', 'invoicing' ),
436
-                    'desc' => __( 'Where should we send admin notifications? This will is also act as the "reply-to" address for invoice emails', 'invoicing' ),
437
-                    'std' => get_option( 'admin_email' ),
435
+                    'name' => __('Admin Email', 'invoicing'),
436
+                    'desc' => __('Where should we send admin notifications? This will is also act as the "reply-to" address for invoice emails', 'invoicing'),
437
+                    'std' => get_option('admin_email'),
438 438
                     'type' => 'text',
439 439
                 ),
440 440
                 'skip_email_free_invoice' => array(
441 441
                     'id'   => 'skip_email_free_invoice',
442
-                    'name' => __( 'Skip Free Invoices', 'invoicing' ),
443
-                    'desc' => __( 'Check this to disable sending emails for free invoices.', 'invoicing' ),
442
+                    'name' => __('Skip Free Invoices', 'invoicing'),
443
+                    'desc' => __('Check this to disable sending emails for free invoices.', 'invoicing'),
444 444
                     'type' => 'checkbox',
445 445
                     'std'  => false,
446 446
                 ),
447 447
                 'overdue_settings_header' => array(
448 448
                     'id'   => 'overdue_settings_header',
449
-                    'name' => '<h3>' . __( 'Due Date Settings', 'invoicing' ) . '</h3>',
449
+                    'name' => '<h3>' . __('Due Date Settings', 'invoicing') . '</h3>',
450 450
                     'type' => 'header',
451 451
                 ),
452 452
                 'overdue_active' => array(
453 453
                     'id'   => 'overdue_active',
454
-                    'name' => __( 'Enable Due Date', 'invoicing' ),
455
-                    'desc' => __( 'Check this to enable due date option for invoices.', 'invoicing' ),
454
+                    'name' => __('Enable Due Date', 'invoicing'),
455
+                    'desc' => __('Check this to enable due date option for invoices.', 'invoicing'),
456 456
                     'type' => 'checkbox',
457 457
                     'std'  => false,
458 458
                 ),
459 459
                 'email_template_header' => array(
460 460
                     'id'   => 'email_template_header',
461
-                    'name' => '<h3>' . __( 'Email Template', 'invoicing' ) . '</h3>',
461
+                    'name' => '<h3>' . __('Email Template', 'invoicing') . '</h3>',
462 462
                     'type' => 'header',
463 463
                 ),
464 464
                 'email_header_image' => array(
465 465
                     'id'   => 'email_header_image',
466
-                    'name' => __( 'Header Image', 'invoicing' ),
467
-                    'desc' => __( 'URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing' ),
466
+                    'name' => __('Header Image', 'invoicing'),
467
+                    'desc' => __('URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing'),
468 468
                     'std' => '',
469 469
                     'type' => 'text',
470 470
                 ),
471 471
                 'email_footer_text' => array(
472 472
                     'id'   => 'email_footer_text',
473
-                    'name' => __( 'Footer Text', 'invoicing' ),
474
-                    'desc' => __( 'The text to appear in the footer of all invoice emails.', 'invoicing' ),
475
-                    'std' => get_bloginfo( 'name', 'display' ) . ' - ' . __( 'Powered by GetPaid', 'invoicing' ),
473
+                    'name' => __('Footer Text', 'invoicing'),
474
+                    'desc' => __('The text to appear in the footer of all invoice emails.', 'invoicing'),
475
+                    'std' => get_bloginfo('name', 'display') . ' - ' . __('Powered by GetPaid', 'invoicing'),
476 476
                     'type' => 'textarea',
477 477
                     'class' => 'regular-text',
478 478
                     'rows' => 2,
@@ -480,29 +480,29 @@  discard block
 block discarded – undo
480 480
                 ),
481 481
                 'email_base_color' => array(
482 482
                     'id'   => 'email_base_color',
483
-                    'name' => __( 'Base Color', 'invoicing' ),
484
-                    'desc' => __( 'The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing' ),
483
+                    'name' => __('Base Color', 'invoicing'),
484
+                    'desc' => __('The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing'),
485 485
                     'std' => '#557da2',
486 486
                     'type' => 'color',
487 487
                 ),
488 488
                 'email_background_color' => array(
489 489
                     'id'   => 'email_background_color',
490
-                    'name' => __( 'Background Color', 'invoicing' ),
491
-                    'desc' => __( 'The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing' ),
490
+                    'name' => __('Background Color', 'invoicing'),
491
+                    'desc' => __('The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing'),
492 492
                     'std' => '#f5f5f5',
493 493
                     'type' => 'color',
494 494
                 ),
495 495
                 'email_body_background_color' => array(
496 496
                     'id'   => 'email_body_background_color',
497
-                    'name' => __( 'Body Background Color', 'invoicing' ),
498
-                    'desc' => __( 'The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing' ),
497
+                    'name' => __('Body Background Color', 'invoicing'),
498
+                    'desc' => __('The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing'),
499 499
                     'std' => '#fdfdfd',
500 500
                     'type' => 'color',
501 501
                 ),
502 502
                 'email_text_color' => array(
503 503
                     'id'   => 'email_text_color',
504
-                    'name' => __( 'Body Text Color', 'invoicing' ),
505
-                    'desc' => __( 'The main body text color. Default <code>#505050</code>.', 'invoicing' ),
504
+                    'name' => __('Body Text Color', 'invoicing'),
505
+                    'desc' => __('The main body text color. Default <code>#505050</code>.', 'invoicing'),
506 506
                     'std' => '#505050',
507 507
                     'type' => 'color',
508 508
                 ),
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
     ),
518 518
 
519 519
     // Integrations.
520
-    'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'settings', 'id' ),
520
+    'integrations' => wp_list_pluck(getpaid_get_integration_settings(), 'settings', 'id'),
521 521
 
522 522
     /** Privacy Settings */
523 523
     'privacy' => apply_filters('wpinv_settings_privacy',
@@ -525,17 +525,17 @@  discard block
 block discarded – undo
525 525
             'main' => array(
526 526
                 'invoicing_privacy_policy_settings' => array(
527 527
                     'id'   => 'invoicing_privacy_policy_settings',
528
-                    'name' => '<h3>' . __( 'Privacy Policy', 'invoicing' ) . '</h3>',
528
+                    'name' => '<h3>' . __('Privacy Policy', 'invoicing') . '</h3>',
529 529
                     'type' => 'header',
530 530
                 ),
531 531
                 'privacy_page' => array(
532 532
                     'id'          => 'privacy_page',
533
-                    'name'        => __( 'Privacy Page', 'invoicing' ),
534
-                    'desc'        => __( 'If no privacy policy page set in Settings->Privacy default settings, this page will be used on checkout page.', 'invoicing' ),
533
+                    'name'        => __('Privacy Page', 'invoicing'),
534
+                    'desc'        => __('If no privacy policy page set in Settings->Privacy default settings, this page will be used on checkout page.', 'invoicing'),
535 535
                     'type'        => 'select',
536
-                    'options'     => wpinv_get_pages( true,  __( 'Select a page', 'invoicing' )),
536
+                    'options'     => wpinv_get_pages(true, __('Select a page', 'invoicing')),
537 537
                     'class'       => 'wpi_select2',
538
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
538
+                    'placeholder' => __('Select a page', 'invoicing'),
539 539
                 ),
540 540
             ),
541 541
         )
@@ -546,19 +546,19 @@  discard block
 block discarded – undo
546 546
             'main' => array(
547 547
                 'invoice_number_format_settings' => array(
548 548
                     'id'   => 'invoice_number_format_settings',
549
-                    'name' => '<h3>' . __( 'Invoice Number', 'invoicing' ) . '</h3>',
549
+                    'name' => '<h3>' . __('Invoice Number', 'invoicing') . '</h3>',
550 550
                     'type' => 'header',
551 551
                 ),
552 552
                 'sequential_invoice_number' => array(
553 553
                     'id'   => 'sequential_invoice_number',
554
-                    'name' => __( 'Sequential Invoice Numbers', 'invoicing' ),
555
-                    'desc' => __('Check this box to enable sequential invoice numbers.', 'invoicing' ) . $reset_number,
554
+                    'name' => __('Sequential Invoice Numbers', 'invoicing'),
555
+                    'desc' => __('Check this box to enable sequential invoice numbers.', 'invoicing') . $reset_number,
556 556
                     'type' => 'checkbox',
557 557
                 ),
558 558
                 'invoice_sequence_start' => array(
559 559
                     'id'   => 'invoice_sequence_start',
560
-                    'name' => __( 'Sequential Starting Number', 'invoicing' ),
561
-                    'desc' => __( 'The number at which the invoice number sequence should begin.', 'invoicing' ) . $last_number,
560
+                    'name' => __('Sequential Starting Number', 'invoicing'),
561
+                    'desc' => __('The number at which the invoice number sequence should begin.', 'invoicing') . $last_number,
562 562
                     'type' => 'number',
563 563
                     'size' => 'small',
564 564
                     'std'  => '1',
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
                 ),
567 567
                 'invoice_number_padd' => array(
568 568
                     'id'      => 'invoice_number_padd',
569
-                    'name'    => __( 'Minimum Digits', 'invoicing' ),
570
-                    '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' ),
569
+                    'name'    => __('Minimum Digits', 'invoicing'),
570
+                    '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'),
571 571
                     'type'    => 'select',
572 572
                     'options' => $invoice_number_padd_options,
573 573
                     'std'     => 5,
@@ -575,8 +575,8 @@  discard block
 block discarded – undo
575 575
                 ),
576 576
                 'invoice_number_prefix' => array(
577 577
                     'id' => 'invoice_number_prefix',
578
-                    'name' => __( 'Invoice Number Prefix', 'invoicing' ),
579
-                    'desc' => __( 'Prefix for all invoice numbers. Ex: INV-', 'invoicing' ),
578
+                    'name' => __('Invoice Number Prefix', 'invoicing'),
579
+                    'desc' => __('Prefix for all invoice numbers. Ex: INV-', 'invoicing'),
580 580
                     'type' => 'text',
581 581
                     'size' => 'regular',
582 582
                     'std' => 'INV-',
@@ -584,46 +584,46 @@  discard block
 block discarded – undo
584 584
                 ),
585 585
                 'invoice_number_postfix' => array(
586 586
                     'id' => 'invoice_number_postfix',
587
-                    'name' => __( 'Invoice Number Postfix', 'invoicing' ),
588
-                    'desc' => __( 'Postfix for all invoice numbers.', 'invoicing' ),
587
+                    'name' => __('Invoice Number Postfix', 'invoicing'),
588
+                    'desc' => __('Postfix for all invoice numbers.', 'invoicing'),
589 589
                     'type' => 'text',
590 590
                     'size' => 'regular',
591 591
                     'std' => ''
592 592
                 ),
593 593
                 'checkout_settings' => array(
594 594
                     'id'   => 'checkout_settings',
595
-                    'name' => '<h3>' . __( 'Checkout Settings', 'invoicing' ) . '</h3>',
595
+                    'name' => '<h3>' . __('Checkout Settings', 'invoicing') . '</h3>',
596 596
                     'type' => 'header',
597 597
                 ),
598 598
                 'disable_new_user_emails' => array(
599 599
                     'id'   => 'disable_new_user_emails',
600
-                    'name' => __( 'Disable new user emails', 'invoicing' ),
601
-                    'desc' => __( 'Do not send an email to customers when a new user account is created for them.', 'invoicing' ),
600
+                    'name' => __('Disable new user emails', 'invoicing'),
601
+                    'desc' => __('Do not send an email to customers when a new user account is created for them.', 'invoicing'),
602 602
                     'type' => 'checkbox',
603 603
                 ),
604 604
                 'login_to_checkout' => array(
605 605
                     'id'   => 'login_to_checkout',
606
-                    'name' => __( 'Require Login To Checkout', 'invoicing' ),
607
-                    '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' ),
606
+                    'name' => __('Require Login To Checkout', 'invoicing'),
607
+                    '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'),
608 608
                     'type' => 'checkbox',
609 609
                 ),
610 610
                 'maxmind_license_key' => array(
611 611
                     'id'   => 'maxmind_license_key',
612
-                    'name' => __( 'MaxMind License Key', 'invoicing' ),
612
+                    'name' => __('MaxMind License Key', 'invoicing'),
613 613
                     'type' => 'text',
614 614
                     'size' => 'regular',
615
-                    'desc' => __( "Enter you license key if you would like to use MaxMind to automatically detect a customer's country.", 'invoicing' ) . ' <a href="https://support.maxmind.com/account-faq/license-keys/how-do-i-generate-a-license-key/">' . __( 'How to generate a free license key.', 'invoicing' ) . '</a>',
615
+                    'desc' => __("Enter you license key if you would like to use MaxMind to automatically detect a customer's country.", 'invoicing') . ' <a href="https://support.maxmind.com/account-faq/license-keys/how-do-i-generate-a-license-key/">' . __('How to generate a free license key.', 'invoicing') . '</a>',
616 616
                 ),
617 617
 
618 618
                 'uninstall_settings' => array(
619 619
                     'id'   => 'uninstall_settings',
620
-                    'name' => '<h3>' . __( 'Uninstall Settings', 'invoicing' ) . '</h3>',
620
+                    'name' => '<h3>' . __('Uninstall Settings', 'invoicing') . '</h3>',
621 621
                     'type' => 'header',
622 622
                 ),
623 623
                 'remove_data_on_unistall' => array(
624 624
                     'id'   => 'remove_data_on_unistall',
625
-                    'name' => __( 'Remove Data on Uninstall?', 'invoicing' ),
626
-                    'desc' => __( 'Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing' ),
625
+                    'name' => __('Remove Data on Uninstall?', 'invoicing'),
626
+                    'desc' => __('Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing'),
627 627
                     'type' => 'checkbox',
628 628
                     'std'  => ''
629 629
                 ),
@@ -632,13 +632,13 @@  discard block
 block discarded – undo
632 632
             'custom-css' => array(
633 633
                 'css_settings' => array(
634 634
                     'id'   => 'css_settings',
635
-                    'name' => '<h3>' . __( 'Custom CSS', 'invoicing' ) . '</h3>',
635
+                    'name' => '<h3>' . __('Custom CSS', 'invoicing') . '</h3>',
636 636
                     'type' => 'header',
637 637
                 ),
638 638
                 'template_custom_css' => array(
639 639
                     'id' => 'template_custom_css',
640
-                    'name' => __( 'Invoice Template CSS', 'invoicing' ),
641
-                    'desc' => __( 'Add CSS to modify appearance of the print invoice page.', 'invoicing' ),
640
+                    'name' => __('Invoice Template CSS', 'invoicing'),
641
+                    'desc' => __('Add CSS to modify appearance of the print invoice page.', 'invoicing'),
642 642
                     'type' => 'textarea',
643 643
                     'class'=> 'regular-text',
644 644
                     'rows' => 10,
@@ -652,8 +652,8 @@  discard block
 block discarded – undo
652 652
             'main' => array(
653 653
                 'tool_settings' => array(
654 654
                     'id'   => 'tool_settings',
655
-                    'name' => '<h3>' . __( 'Diagnostic Tools', 'invoicing' ) . '</h3>',
656
-                    'desc' => __( 'Invoicing diagnostic tools', 'invoicing' ),
655
+                    'name' => '<h3>' . __('Diagnostic Tools', 'invoicing') . '</h3>',
656
+                    'desc' => __('Invoicing diagnostic tools', 'invoicing'),
657 657
                     'type' => 'tools',
658 658
                 ),
659 659
             ),
Please login to merge, or discard this patch.
includes/admin/class-getpaid-admin-setup-wizard.php 3 patches
Indentation   +434 added lines, -434 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @info        GetPaid Setup Wizard.
12 12
  */
13 13
 if ( ! defined( 'ABSPATH' ) ) {
14
-	exit;
14
+    exit;
15 15
 }
16 16
 
17 17
 /**
@@ -19,84 +19,84 @@  discard block
 block discarded – undo
19 19
  */
20 20
 class GetPaid_Admin_Setup_Wizard {
21 21
 
22
-	/** @var string Current Step */
23
-	private $step = '';
24
-
25
-	/** @var array Steps for the setup wizard */
26
-	private $steps = array();
27
-
28
-	/**
29
-	 * Hook in tabs.
30
-	 */
31
-	public function __construct() {
32
-		if ( apply_filters( 'getpaid_enable_setup_wizard', true ) && current_user_can( 'manage_options' ) ) {
33
-			add_action( 'admin_menu', array( $this, 'admin_menus' ) );
34
-			add_action( 'current_screen', array( $this, 'setup_wizard' ) );
35
-
36
-			// add default content action
37
-			add_action( 'geodir_wizard_content_dummy_data', array( __CLASS__, 'content_dummy_data' ) );
38
-			add_action( 'geodir_wizard_content_sidebars', array( __CLASS__, 'content_sidebars' ) );
39
-			add_action( 'geodir_wizard_content_menus', array( __CLASS__, 'content_menus' ) );
40
-		}
41
-	}
42
-
43
-	/**
44
-	 * Add admin menus/screens.
45
-	 */
46
-	public function admin_menus() {
47
-		add_dashboard_page( '', '', 'manage_options', 'gp-setup', '' );
48
-	}
49
-
50
-	/**
51
-	 * Show the setup wizard.
52
-	 *
53
-	 * @since 2.0.0
54
-	 */
55
-	public function setup_wizard() {
56
-		if ( empty( $_GET['page'] ) || 'gp-setup' !== $_GET['page'] ) {
57
-			return;
58
-		}
59
-		$default_steps = array(
60
-			'introduction'     => array(
61
-				'name'    => __( 'Introduction', 'invoicing' ),
62
-				'view'    => array( $this, 'setup_introduction' ),
63
-				'handler' => '',
64
-			),
65
-			'business_details'             => array(
66
-				'name'    => __( "Business Details", 'invoicing' ),
67
-				'view'    => array( $this, 'setup_business' ),
68
-				'handler' => array( $this, 'setup_business_save' ),
69
-			),
70
-			'currency' => array(
71
-				'name'    => __( 'Currency', 'invoicing' ),
72
-				'view'    => array( $this, 'setup_currency' ),
73
-				'handler' => array( $this, 'setup_currency_save' ),
74
-			),
75
-			'payments'        => array(
76
-				'name'    => __( 'Payment Gateways', 'invoicing' ),
77
-				'view'    => array( $this, 'setup_payments' ),
78
-				'handler' => array( $this, 'setup_payments_save' ),
79
-			),
80
-			'recommend'          => array(
81
-				'name'    => __( 'Recommend', 'invoicing' ),
82
-				'view'    => array( $this, 'setup_recommend' ),
83
-				'handler' => array( $this, 'setup_recommend_save' ),
84
-			),
85
-			'next_steps'       => array(
86
-				'name'    => __( 'Get Paid', 'invoicing' ),
87
-				'view'    => array( $this, 'setup_ready' ),
88
-				'handler' => '',
89
-			),
90
-		);
91
-
92
-		$this->steps     = apply_filters( 'getpaid_setup_wizard_steps', $default_steps );
93
-		$this->step      = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
94
-
95
-
96
-		// enqueue the script
97
-		$aui_settings = AyeCode_UI_Settings::instance();
98
-		$aui_settings->enqueue_scripts();
99
-		$aui_settings->enqueue_style();
22
+    /** @var string Current Step */
23
+    private $step = '';
24
+
25
+    /** @var array Steps for the setup wizard */
26
+    private $steps = array();
27
+
28
+    /**
29
+     * Hook in tabs.
30
+     */
31
+    public function __construct() {
32
+        if ( apply_filters( 'getpaid_enable_setup_wizard', true ) && current_user_can( 'manage_options' ) ) {
33
+            add_action( 'admin_menu', array( $this, 'admin_menus' ) );
34
+            add_action( 'current_screen', array( $this, 'setup_wizard' ) );
35
+
36
+            // add default content action
37
+            add_action( 'geodir_wizard_content_dummy_data', array( __CLASS__, 'content_dummy_data' ) );
38
+            add_action( 'geodir_wizard_content_sidebars', array( __CLASS__, 'content_sidebars' ) );
39
+            add_action( 'geodir_wizard_content_menus', array( __CLASS__, 'content_menus' ) );
40
+        }
41
+    }
42
+
43
+    /**
44
+     * Add admin menus/screens.
45
+     */
46
+    public function admin_menus() {
47
+        add_dashboard_page( '', '', 'manage_options', 'gp-setup', '' );
48
+    }
49
+
50
+    /**
51
+     * Show the setup wizard.
52
+     *
53
+     * @since 2.0.0
54
+     */
55
+    public function setup_wizard() {
56
+        if ( empty( $_GET['page'] ) || 'gp-setup' !== $_GET['page'] ) {
57
+            return;
58
+        }
59
+        $default_steps = array(
60
+            'introduction'     => array(
61
+                'name'    => __( 'Introduction', 'invoicing' ),
62
+                'view'    => array( $this, 'setup_introduction' ),
63
+                'handler' => '',
64
+            ),
65
+            'business_details'             => array(
66
+                'name'    => __( "Business Details", 'invoicing' ),
67
+                'view'    => array( $this, 'setup_business' ),
68
+                'handler' => array( $this, 'setup_business_save' ),
69
+            ),
70
+            'currency' => array(
71
+                'name'    => __( 'Currency', 'invoicing' ),
72
+                'view'    => array( $this, 'setup_currency' ),
73
+                'handler' => array( $this, 'setup_currency_save' ),
74
+            ),
75
+            'payments'        => array(
76
+                'name'    => __( 'Payment Gateways', 'invoicing' ),
77
+                'view'    => array( $this, 'setup_payments' ),
78
+                'handler' => array( $this, 'setup_payments_save' ),
79
+            ),
80
+            'recommend'          => array(
81
+                'name'    => __( 'Recommend', 'invoicing' ),
82
+                'view'    => array( $this, 'setup_recommend' ),
83
+                'handler' => array( $this, 'setup_recommend_save' ),
84
+            ),
85
+            'next_steps'       => array(
86
+                'name'    => __( 'Get Paid', 'invoicing' ),
87
+                'view'    => array( $this, 'setup_ready' ),
88
+                'handler' => '',
89
+            ),
90
+        );
91
+
92
+        $this->steps     = apply_filters( 'getpaid_setup_wizard_steps', $default_steps );
93
+        $this->step      = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
94
+
95
+
96
+        // enqueue the script
97
+        $aui_settings = AyeCode_UI_Settings::instance();
98
+        $aui_settings->enqueue_scripts();
99
+        $aui_settings->enqueue_style();
100 100
 
101 101
 
102 102
 
@@ -108,21 +108,21 @@  discard block
 block discarded – undo
108 108
 //			call_user_func( $this->steps[ $this->step ]['handler'], $this );
109 109
 //		}
110 110
 
111
-		ob_start();
112
-		$this->setup_wizard_header();
111
+        ob_start();
112
+        $this->setup_wizard_header();
113 113
 //		$this->setup_wizard_steps();
114
-		$this->setup_wizard_content();
115
-		$this->setup_wizard_footer();
116
-		exit;
117
-	}
118
-
119
-	/**
120
-	 * Setup Wizard Header.
121
-	 *
122
-	 * @since 2.0.0
123
-	 */
114
+        $this->setup_wizard_content();
115
+        $this->setup_wizard_footer();
116
+        exit;
117
+    }
118
+
119
+    /**
120
+     * Setup Wizard Header.
121
+     *
122
+     * @since 2.0.0
123
+     */
124 124
 public function setup_wizard_header() {
125
-	?>
125
+    ?>
126 126
 	<!DOCTYPE html>
127 127
 	<html <?php language_attributes(); ?> class="bsui">
128 128
 	<head>
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
 		<title><?php esc_html_e( 'GetPaid &rsaquo; Setup Wizard', 'invoicing' ); ?></title>
132 132
 		<?php
133 133
 
134
-		wp_register_style( 'font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(  ), WPINV_VERSION );
135
-		wp_enqueue_style( 'font-awesome' );
136
-		do_action( 'admin_print_styles' ); ?>
134
+        wp_register_style( 'font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(  ), WPINV_VERSION );
135
+        wp_enqueue_style( 'font-awesome' );
136
+        do_action( 'admin_print_styles' ); ?>
137 137
 		<?php do_action( 'admin_head' ); ?>
138 138
 		<style>
139 139
 			body,p{
@@ -142,22 +142,22 @@  discard block
 block discarded – undo
142 142
 			}
143 143
 
144 144
 			<?php
145
-				$aui_settings = AyeCode_UI_Settings::instance();
146
-				echo $aui_settings::css_primary('#009874',true);
147
-			 ?>
145
+                $aui_settings = AyeCode_UI_Settings::instance();
146
+                echo $aui_settings::css_primary('#009874',true);
147
+                ?>
148 148
 
149 149
 
150 150
 		</style>
151 151
 	</head>
152 152
 	<body class="gp-setup wp-core-ui bg-lightx mx-auto text-dark scrollbars-ios" style="background: #f3f6ff;">
153 153
 	<?php
154
-	if(isset($_REQUEST['step'])){
155
-	$this->setup_wizard_steps();
156
-	}else{
157
-	echo "<div class='mb-3'>&nbsp;</div>";
158
-	}
154
+    if(isset($_REQUEST['step'])){
155
+    $this->setup_wizard_steps();
156
+    }else{
157
+    echo "<div class='mb-3'>&nbsp;</div>";
158
+    }
159 159
 
160
-	?>
160
+    ?>
161 161
 	<h1 class="h2 text-center pb-3">
162 162
 		<a class=" text-decoration-none" href="https://wpgetpaid.com/">
163 163
 			<span class="text-black-50">
@@ -166,57 +166,57 @@  discard block
 block discarded – undo
166 166
 		</a>
167 167
 	</h1>
168 168
 	<?php
169
-	}
170
-
171
-	/**
172
-	 * Output the steps.
173
-	 *
174
-	 * @since 2.0.0
175
-	 */
176
-	public function setup_wizard_steps() {
177
-		$ouput_steps = $this->steps;
178
-		array_shift( $ouput_steps );
179
-		?>
169
+    }
170
+
171
+    /**
172
+     * Output the steps.
173
+     *
174
+     * @since 2.0.0
175
+     */
176
+    public function setup_wizard_steps() {
177
+        $ouput_steps = $this->steps;
178
+        array_shift( $ouput_steps );
179
+        ?>
180 180
 		<ol class="gp-setup-steps mb-0 pb-4 mw-100 list-group list-group-horizontal text-center">
181 181
 			<?php
182
-			$current = '';
183
-			foreach ( $ouput_steps as $step_key => $step ) : ?>
182
+            $current = '';
183
+            foreach ( $ouput_steps as $step_key => $step ) : ?>
184 184
 				<li class="list-group-item flex-fill rounded-0 <?php
185
-				if ( $step_key === $this->step ) {
186
-					$current = $this->step;
187
-					echo 'active';
188
-				} elseif ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) {
189
-					echo 'done';
190
-				}
191
-				$done = !$current ? 'text-success' : '';
192
-				?>"><i class="far fa-check-circle <?php echo $done ;?>"></i> <?php echo esc_html( $step['name'] ); ?></li>
185
+                if ( $step_key === $this->step ) {
186
+                    $current = $this->step;
187
+                    echo 'active';
188
+                } elseif ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) {
189
+                    echo 'done';
190
+                }
191
+                $done = !$current ? 'text-success' : '';
192
+                ?>"><i class="far fa-check-circle <?php echo $done ;?>"></i> <?php echo esc_html( $step['name'] ); ?></li>
193 193
 			<?php endforeach; ?>
194 194
 		</ol>
195 195
 		<?php
196
-	}
197
-
198
-	/**
199
-	 * Output the content for the current step.
200
-	 *
201
-	 * @since 2.0.0
202
-	 */
203
-	public function setup_wizard_content() {
204
-		echo '<div class="gp-setup-content rowx mw-100 text-center mb-3">';
205
-		echo '<div class="col-5 m-auto">';
206
-		echo '<div class="card shadow-sm">';
207
-		call_user_func( $this->steps[ $this->step ]['view'], $this );
208
-		echo '</div>';
209
-		echo '</div>';
210
-		echo '</div>';
211
-	}
212
-
213
-	/**
214
-	 * Setup Wizard Footer.
215
-	 *
216
-	 * @since 2.0.0
217
-	 */
218
-	public function setup_wizard_footer() {
219
-	?>
196
+    }
197
+
198
+    /**
199
+     * Output the content for the current step.
200
+     *
201
+     * @since 2.0.0
202
+     */
203
+    public function setup_wizard_content() {
204
+        echo '<div class="gp-setup-content rowx mw-100 text-center mb-3">';
205
+        echo '<div class="col-5 m-auto">';
206
+        echo '<div class="card shadow-sm">';
207
+        call_user_func( $this->steps[ $this->step ]['view'], $this );
208
+        echo '</div>';
209
+        echo '</div>';
210
+        echo '</div>';
211
+    }
212
+
213
+    /**
214
+     * Setup Wizard Footer.
215
+     *
216
+     * @since 2.0.0
217
+     */
218
+    public function setup_wizard_footer() {
219
+    ?>
220 220
 	<?php if ( 'next_steps' === $this->step ){ ?>
221 221
 		<p class="gd-return-to-dashboard-wrap"><a class="gd-return-to-dashboard btn btn-link d-block text-muted"
222 222
 		                                          href="<?php echo esc_url( admin_url() ); ?>"><?php esc_html_e( 'Return to the WordPress Dashboard', 'invoicing' ); ?></a>
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
 	<?php
231 231
 }
232 232
 
233
-	/**
234
-	 * Introduction step.
235
-	 *
236
-	 * @since 2.0.0
237
-	 */
238
-	public function setup_introduction() {
239
-		?>
233
+    /**
234
+     * Introduction step.
235
+     *
236
+     * @since 2.0.0
237
+     */
238
+    public function setup_introduction() {
239
+        ?>
240 240
 		<h1 class="h4 card-header bg-white border-bottom-0 pt-4 pb-1"><?php esc_html_e( 'Welcome to GetPaid!', 'invoicing' ); ?></h1>
241 241
 		<div class="card-body text-muted ">
242 242
 			<p class=""><?php _e( 'Thank you for choosing GetPaid - The most Powerful Payments Plugin for WordPress', 'invoicing' ); ?></p>
@@ -342,50 +342,50 @@  discard block
 block discarded – undo
342 342
 			   class="btn btn-link d-block mt-2 "><?php esc_html_e( 'Not right now', 'invoicing' ); ?></a>
343 343
 		</div>
344 344
 		<?php
345
-	}
346
-
347
-	/**
348
-	 * Get the URL for the next step's screen.
349
-	 *
350
-	 * @param string step   slug (default: current step)
351
-	 *
352
-	 * @return string       URL for next step if a next step exists.
353
-	 *                      Admin URL if it's the last step.
354
-	 *                      Empty string on failure.
355
-	 * @since 3.0.0
356
-	 */
357
-	public function get_next_step_link( $step = '' ) {
358
-		if ( ! $step ) {
359
-			$step = $this->step;
360
-		}
361
-
362
-		$keys = array_keys( $this->steps );
363
-		if ( end( $keys ) === $step ) {
364
-			return admin_url();
365
-		}
366
-
367
-		$step_index = array_search( $step, $keys );
368
-		if ( false === $step_index ) {
369
-			return '';
370
-		}
371
-
372
-		return remove_query_arg('settings-updated', add_query_arg( 'step', $keys[ $step_index + 1 ] ));
373
-	}
374
-
375
-	/**
376
-	 * Setup maps api.
377
-	 *
378
-	 * @since 2.0.0
379
-	 */
380
-	public function setup_business() {
381
-		?>
345
+    }
346
+
347
+    /**
348
+     * Get the URL for the next step's screen.
349
+     *
350
+     * @param string step   slug (default: current step)
351
+     *
352
+     * @return string       URL for next step if a next step exists.
353
+     *                      Admin URL if it's the last step.
354
+     *                      Empty string on failure.
355
+     * @since 3.0.0
356
+     */
357
+    public function get_next_step_link( $step = '' ) {
358
+        if ( ! $step ) {
359
+            $step = $this->step;
360
+        }
361
+
362
+        $keys = array_keys( $this->steps );
363
+        if ( end( $keys ) === $step ) {
364
+            return admin_url();
365
+        }
366
+
367
+        $step_index = array_search( $step, $keys );
368
+        if ( false === $step_index ) {
369
+            return '';
370
+        }
371
+
372
+        return remove_query_arg('settings-updated', add_query_arg( 'step', $keys[ $step_index + 1 ] ));
373
+    }
374
+
375
+    /**
376
+     * Setup maps api.
377
+     *
378
+     * @since 2.0.0
379
+     */
380
+    public function setup_business() {
381
+        ?>
382 382
 		<form method="post" class="text-left card-body" action="options.php">
383 383
 			<?php
384 384
 
385
-			settings_fields( 'wpinv_settings' );
385
+            settings_fields( 'wpinv_settings' );
386 386
 
387
-			// override http referer to make it send back to the next step
388
-				?>
387
+            // override http referer to make it send back to the next step
388
+                ?>
389 389
 			<input type="hidden" name="_wp_http_referer" value="<?php echo esc_url( $this->get_next_step_link() ); ?>">
390 390
 
391 391
 			<table class="gp-setup-maps w-100 " cellspacing="0">
@@ -394,21 +394,21 @@  discard block
 block discarded – undo
394 394
 
395 395
 				<?php
396 396
 
397
-				global $wp_settings_fields;
397
+                global $wp_settings_fields;
398 398
 
399
-				$page = 'wpinv_settings_general_main';
400
-				$section = 'wpinv_settings_general_main';
401
-				if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) {
402
-			        return;
403
-			    }
399
+                $page = 'wpinv_settings_general_main';
400
+                $section = 'wpinv_settings_general_main';
401
+                if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) {
402
+                    return;
403
+                }
404 404
 
405
-			    $settings =  $wp_settings_fields[ $page ][ $section ];
405
+                $settings =  $wp_settings_fields[ $page ][ $section ];
406 406
 
407
-				// unset title
408
-				unset($settings["wpinv_settings[location_settings]"]);
407
+                // unset title
408
+                unset($settings["wpinv_settings[location_settings]"]);
409 409
 
410
-			    $this->output_fields($settings);
411
-				?>
410
+                $this->output_fields($settings);
411
+                ?>
412 412
 
413 413
 
414 414
 				</tbody>
@@ -421,64 +421,64 @@  discard block
 block discarded – undo
421 421
 			</p>
422 422
 		</form>
423 423
 		<?php
424
-	}
424
+    }
425 425
 
426
-	public function output_fields($settings){
426
+    public function output_fields($settings){
427 427
 
428
-	    if ( empty($settings)) {
429
-	        return;
430
-	    }
428
+        if ( empty($settings)) {
429
+            return;
430
+        }
431 431
 
432 432
 //print_r($settings);
433
-	    foreach ( (array) $settings as $key => $field ) {
433
+        foreach ( (array) $settings as $key => $field ) {
434 434
 
435 435
 
436
-	        $class = '';
436
+            $class = '';
437 437
 
438
-	        if ( ! empty( $field['args']['class'] ) ) {
439
-	            $class = esc_attr( $field['args']['class'] );
440
-	        }
438
+            if ( ! empty( $field['args']['class'] ) ) {
439
+                $class = esc_attr( $field['args']['class'] );
440
+            }
441 441
 
442
-	       // echo '<div class="form-group '.$class.'">';
442
+            // echo '<div class="form-group '.$class.'">';
443 443
 
444 444
 
445
-	        if ( ! empty( $field['args']['label_for'] ) ) {
446
-	            $for = ' for="' . esc_attr( $field['args']['label_for'] ) . '" ';
447
-	        } else {
448
-	            $for = '';
449
-	        }
445
+            if ( ! empty( $field['args']['label_for'] ) ) {
446
+                $for = ' for="' . esc_attr( $field['args']['label_for'] ) . '" ';
447
+            } else {
448
+                $for = '';
449
+            }
450 450
 
451
-			$value  = isset( $field['args']['std'] ) ? $field['args']['std'] : '';
452
-			$value  = wpinv_get_option( $field['args']['id'], $value );
451
+            $value  = isset( $field['args']['std'] ) ? $field['args']['std'] : '';
452
+            $value  = wpinv_get_option( $field['args']['id'], $value );
453 453
 
454
-			if($field['callback'] == 'wpinv_text_callback' || $field['callback'] == 'wpinv_number_callback' ){
454
+            if($field['callback'] == 'wpinv_text_callback' || $field['callback'] == 'wpinv_number_callback' ){
455 455
 
456 456
 
457
-			// hide the logo inputs, we need to set them as hidden so they don't blank the current values.
458
-			$help_text = isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '';
459
-			$type = $field['callback'] == 'wpinv_number_callback'  ? 'number' : 'text';
460
-			$label = isset($field['args']['name']) ? esc_attr($field['args']['name']) : '';
457
+            // hide the logo inputs, we need to set them as hidden so they don't blank the current values.
458
+            $help_text = isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '';
459
+            $type = $field['callback'] == 'wpinv_number_callback'  ? 'number' : 'text';
460
+            $label = isset($field['args']['name']) ? esc_attr($field['args']['name']) : '';
461 461
 
462
-			if(in_array($field['id'],array('wpinv_settings[logo]','wpinv_settings[logo_width]','wpinv_settings[logo_height]'))){
463
-				$type = 'hidden';
464
-				$help_text = '';
465
-				$label = '';
466
-			}
462
+            if(in_array($field['id'],array('wpinv_settings[logo]','wpinv_settings[logo_width]','wpinv_settings[logo_height]'))){
463
+                $type = 'hidden';
464
+                $help_text = '';
465
+                $label = '';
466
+            }
467 467
 
468
-				echo aui()->input(array(
469
-									'type'  =>  $type,
470
-									'id'    =>  isset($field['args']['id']) ? esc_attr($field['args']['id']) : '',
471
-									'name'    =>  isset($field['id']) ? esc_attr($field['id']) : '',
472
-									'value' =>   is_scalar( $value ) ? esc_attr( $value ) : '',
473
-									'required'  => false,
474
-									'help_text' => $help_text,
475
-									'label' => $label,
476
-									'label_type'    => 'floating'
477
-								));
478
-			}elseif($field['callback'] == 'wpinv_select_callback' || $field['callback'] == 'wpinv_country_states_callback'){
468
+                echo aui()->input(array(
469
+                                    'type'  =>  $type,
470
+                                    'id'    =>  isset($field['args']['id']) ? esc_attr($field['args']['id']) : '',
471
+                                    'name'    =>  isset($field['id']) ? esc_attr($field['id']) : '',
472
+                                    'value' =>   is_scalar( $value ) ? esc_attr( $value ) : '',
473
+                                    'required'  => false,
474
+                                    'help_text' => $help_text,
475
+                                    'label' => $label,
476
+                                    'label_type'    => 'floating'
477
+                                ));
478
+            }elseif($field['callback'] == 'wpinv_select_callback' || $field['callback'] == 'wpinv_country_states_callback'){
479 479
 
480 480
 if($field['id']=='wpinv_settings[default_state]'){
481
-			$country_value  = wpinv_get_option( 'wpinv_settings[default_country]', 'US');
481
+            $country_value  = wpinv_get_option( 'wpinv_settings[default_country]', 'US');
482 482
 $options = wpinv_get_country_states($country_value);//echo $value .'###'.$country_value;
483 483
 }else{
484 484
 $options = isset($field['args']['options']) ? $field['args']['options'] : array();
@@ -486,78 +486,78 @@  discard block
 block discarded – undo
486 486
 
487 487
 //print_r($options );echo '###';
488 488
 
489
-				echo aui()->select( array(
490
-					'id'              =>  isset($field['args']['id']) ? esc_attr($field['args']['id']) : '',
491
-					'name'            =>  isset($field['id']) ? esc_attr($field['id']) : '',
492
-					'placeholder'     => '',
489
+                echo aui()->select( array(
490
+                    'id'              =>  isset($field['args']['id']) ? esc_attr($field['args']['id']) : '',
491
+                    'name'            =>  isset($field['id']) ? esc_attr($field['id']) : '',
492
+                    'placeholder'     => '',
493 493
 //					'title'           => $site_title,
494
-					'value'           => is_scalar( $value ) ? esc_attr( $value ) : '',
495
-					'required'        => false,
496
-					'help_text'       => isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '',
497
-					'label'           => isset($field['args']['name']) ? esc_attr($field['args']['name']) : '',
498
-					'options'         => $options,
499
-					'select2'         => true,
500
-					'label_type'    => 'floating'
494
+                    'value'           => is_scalar( $value ) ? esc_attr( $value ) : '',
495
+                    'required'        => false,
496
+                    'help_text'       => isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '',
497
+                    'label'           => isset($field['args']['name']) ? esc_attr($field['args']['name']) : '',
498
+                    'options'         => $options,
499
+                    'select2'         => true,
500
+                    'label_type'    => 'floating'
501 501
 //					'wrap_class'      => isset( $field->css_class ) ? $field->css_class : '',
502
-				) );
503
-			}elseif($field['callback'] == 'wpinv_textarea_callback'){
504
-				$textarea =  aui()->textarea( array(
505
-					'id'              => isset($field['args']['id']) ? esc_attr($field['args']['id']) : '',
506
-					'name'            => isset($field['id']) ? esc_attr($field['id']) : '',
507
-					'placeholder'     => '',
502
+                ) );
503
+            }elseif($field['callback'] == 'wpinv_textarea_callback'){
504
+                $textarea =  aui()->textarea( array(
505
+                    'id'              => isset($field['args']['id']) ? esc_attr($field['args']['id']) : '',
506
+                    'name'            => isset($field['id']) ? esc_attr($field['id']) : '',
507
+                    'placeholder'     => '',
508 508
 //					'title'           => $site_title,
509
-					'value'           => is_scalar( $value ) ? esc_attr( $value ) : '',
510
-					'required'        => false,
511
-					'help_text'       => isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '',
512
-					'label'           => isset($field['args']['name']) ? esc_attr($field['args']['name']) : '',
513
-					'rows'            => '4',
514
-					'label_type'    => 'floating'
509
+                    'value'           => is_scalar( $value ) ? esc_attr( $value ) : '',
510
+                    'required'        => false,
511
+                    'help_text'       => isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '',
512
+                    'label'           => isset($field['args']['name']) ? esc_attr($field['args']['name']) : '',
513
+                    'rows'            => '4',
514
+                    'label_type'    => 'floating'
515 515
 //					'wrap_class'      => isset( $field->css_class ) ? $field->css_class : '',
516
-				) );
516
+                ) );
517 517
 
518
-				// bug fixed in AUI 0.1.51 for name stripping []
519
-				$textarea = str_replace(sanitize_html_class($field['args']['id']),esc_attr($field['args']['id']),$textarea );
518
+                // bug fixed in AUI 0.1.51 for name stripping []
519
+                $textarea = str_replace(sanitize_html_class($field['args']['id']),esc_attr($field['args']['id']),$textarea );
520 520
 
521
-				echo $textarea;
522
-			}
521
+                echo $textarea;
522
+            }
523 523
 
524
-			//echo "<div>";
524
+            //echo "<div>";
525 525
 
526
-	    }
527
-	}
526
+        }
527
+    }
528 528
 
529
-	/**
530
-	 * Save Maps Settings.
531
-	 *
532
-	 * @since 2.0.0
533
-	 */
534
-	public function setup_business_save() {
529
+    /**
530
+     * Save Maps Settings.
531
+     *
532
+     * @since 2.0.0
533
+     */
534
+    public function setup_business_save() {
535 535
 
536
-	// nothing required here as options.php will send to next step
537
-		//check_admin_referer( 'gp-setup' );
536
+    // nothing required here as options.php will send to next step
537
+        //check_admin_referer( 'gp-setup' );
538 538
 
539 539
 //print_r($_POST);exit;
540 540
 //		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
541 541
 //		exit;
542
-	}
542
+    }
543 543
 
544
-	/**
545
-	 * Default Location settings.
546
-	 *
547
-	 * @since 2.0.0
548
-	 */
549
-	public function setup_currency() {
544
+    /**
545
+     * Default Location settings.
546
+     *
547
+     * @since 2.0.0
548
+     */
549
+    public function setup_currency() {
550 550
 
551
-		?>
551
+        ?>
552 552
 
553 553
 		<form method="post" class="text-left card-body" action="options.php">
554 554
 			<?php
555 555
 
556 556
 
557
-			settings_fields( 'wpinv_settings' );
557
+            settings_fields( 'wpinv_settings' );
558 558
 
559
-			// override http referer to make it send back to the next step
560
-				?>
559
+            // override http referer to make it send back to the next step
560
+                ?>
561 561
 			<input type="hidden" name="_wp_http_referer" value="<?php echo esc_url( $this->get_next_step_link() ); ?>">
562 562
 
563 563
 			<table class="gp-setup-maps w-100 " cellspacing="0">
@@ -566,20 +566,20 @@  discard block
 block discarded – undo
566 566
 
567 567
 				<?php
568 568
 
569
-				global $wp_settings_fields;
569
+                global $wp_settings_fields;
570 570
 
571
-				$page = 'wpinv_settings_general_currency_section';
572
-				$section = 'wpinv_settings_general_currency_section';
573
-				if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) {
574
-			        return;
575
-			    }
571
+                $page = 'wpinv_settings_general_currency_section';
572
+                $section = 'wpinv_settings_general_currency_section';
573
+                if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) {
574
+                    return;
575
+                }
576 576
 
577
-			    $settings =  $wp_settings_fields[ $page ][ $section ];
577
+                $settings =  $wp_settings_fields[ $page ][ $section ];
578 578
 
579 579
 //				print_r($settings);exit;
580 580
 
581
-			    $this->output_fields($settings);
582
-				?>
581
+                $this->output_fields($settings);
582
+                ?>
583 583
 
584 584
 
585 585
 				</tbody>
@@ -593,35 +593,35 @@  discard block
 block discarded – undo
593 593
 		</form>
594 594
 
595 595
 		<?php
596
-	}
596
+    }
597 597
 
598 598
 
599
-	/**
600
-	 * Save Default Location Settings.
601
-	 *
602
-	 * @since 2.0.0
603
-	 */
604
-	public function setup_currency_save() {
605
-		check_admin_referer( 'gp-setup' );
599
+    /**
600
+     * Save Default Location Settings.
601
+     *
602
+     * @since 2.0.0
603
+     */
604
+    public function setup_currency_save() {
605
+        check_admin_referer( 'gp-setup' );
606 606
 
607
-		$generalSettings = new GeoDir_Settings_General();
608
-		$settings        = $generalSettings->get_settings( 'location' );
609
-		GeoDir_Admin_Settings::save_fields( $settings );
607
+        $generalSettings = new GeoDir_Settings_General();
608
+        $settings        = $generalSettings->get_settings( 'location' );
609
+        GeoDir_Admin_Settings::save_fields( $settings );
610 610
 
611
-		do_action( 'geodir_setup_wizard_default_location_saved', $settings );
611
+        do_action( 'geodir_setup_wizard_default_location_saved', $settings );
612 612
 
613
-		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
614
-		exit;
615
-	}
613
+        wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
614
+        exit;
615
+    }
616 616
 
617
-	/**
618
-	 * Dummy Data setup.
619
-	 *
620
-	 * @since 2.0.0
621
-	 */
622
-	public function setup_recommend() {
617
+    /**
618
+     * Dummy Data setup.
619
+     *
620
+     * @since 2.0.0
621
+     */
622
+    public function setup_recommend() {
623 623
 
624
-		?>
624
+        ?>
625 625
 		<form method="post" class="text-center card-body">
626 626
 			<div class="gd-wizard-recommend">
627 627
 
@@ -632,22 +632,22 @@  discard block
 block discarded – undo
632 632
 
633 633
 				<?php
634 634
 
635
-				include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
635
+                include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
636 636
 
637
-				$recommend_wp_plugins = self::get_recommend_wp_plugins();
637
+                $recommend_wp_plugins = self::get_recommend_wp_plugins();
638 638
 
639
-				//			$status = install_plugin_install_status( array("slug"=>"two-factor","version"=>""));
640
-				//			print_r($status);
639
+                //			$status = install_plugin_install_status( array("slug"=>"two-factor","version"=>""));
640
+                //			print_r($status);
641 641
 
642
-				if ( ! empty( $recommend_wp_plugins ) ) {
642
+                if ( ! empty( $recommend_wp_plugins ) ) {
643 643
 
644
-				?>
644
+                ?>
645 645
 				<ul class="list-group">
646 646
 					<?php
647
-						foreach ( $recommend_wp_plugins as $plugin ) {
648
-						$status = install_plugin_install_status( array( "slug" => $plugin['slug'], "version" => "" ) );
649
-						$plugin_status = isset( $status['status'] ) ? $status['status'] : '';
650
-						?>
647
+                        foreach ( $recommend_wp_plugins as $plugin ) {
648
+                        $status = install_plugin_install_status( array( "slug" => $plugin['slug'], "version" => "" ) );
649
+                        $plugin_status = isset( $status['status'] ) ? $status['status'] : '';
650
+                        ?>
651 651
 							<li class="list-group-item d-flex justify-content-between align-items-center flex-wrap text-left">
652 652
 							    <span class="mr-auto"><?php echo esc_attr($plugin['name']); ?></span>
653 653
 								<div class="spinner-border spinner-border-sm mr-2 d-none text-muted" role="status">
@@ -660,16 +660,16 @@  discard block
 block discarded – undo
660 660
 								<small class="w-100"><?php echo esc_attr($plugin['desc'] );?></small>
661 661
 							 </li>
662 662
 						<?php
663
-						}
663
+                        }
664 664
                     ?>
665 665
 				</ul>
666 666
 				<?php
667 667
 
668
-				}
668
+                }
669 669
 
670 670
 
671 671
 
672
-				?>
672
+                ?>
673 673
 
674 674
 
675 675
 
@@ -680,57 +680,57 @@  discard block
 block discarded – undo
680 680
 			</p>
681 681
 		</form>
682 682
 		<?php
683
-	}
684
-
685
-		/**
686
-	 * A list of recommended wp.org plugins.
687
-	 * @return array
688
-	 */
689
-	public static function get_recommend_wp_plugins(){
690
-		$plugins = array(
691
-			'ayecode-connect' => array(
692
-				'url'   => 'https://wordpress.org/plugins/ayecode-connect/',
693
-				'slug'   => 'ayecode-connect',
694
-				'name'   => 'AyeCode Connect',
695
-				'desc'   => __( 'Documentation and Support from within your WordPress admin.', 'geodirectory' ),
696
-			),
697
-			'ninja-forms' => array(
698
-				'url'   => 'https://wordpress.org/plugins/invoicing-quotes/',
699
-				'slug'   => 'invoicing-quotes',
700
-				'name'   => 'Customer Quotes',
701
-				'desc'   => __('Create & Send Quotes to Customers and have them accept and pay.','geodirectory'),
702
-			),
703
-			'userswp' => array(
704
-				'url'   => 'https://wordpress.org/plugins/userswp/',
705
-				'slug'   => 'userswp',
706
-				'name'   => 'UsersWP',
707
-				'desc'   => __('Frontend user login and registration as well as slick profile pages.','geodirectory'),
708
-			),
709
-		);
710
-
711
-		return $plugins;
712
-	}
713
-
714
-	/**
715
-	 * Dummy data save.
716
-	 *
717
-	 * This is done via ajax so we just pass onto the next step.
718
-	 *
719
-	 * @since 2.0.0
720
-	 */
721
-	public function setup_recommend_save() {
722
-		check_admin_referer( 'gp-setup' );
723
-		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
724
-		exit;
725
-	}
726
-
727
-	/**
728
-	 * Dummy Data setup.
729
-	 *
730
-	 * @since 2.0.0
731
-	 */
732
-	public function setup_payments() {
733
-		?>
683
+    }
684
+
685
+        /**
686
+         * A list of recommended wp.org plugins.
687
+         * @return array
688
+         */
689
+    public static function get_recommend_wp_plugins(){
690
+        $plugins = array(
691
+            'ayecode-connect' => array(
692
+                'url'   => 'https://wordpress.org/plugins/ayecode-connect/',
693
+                'slug'   => 'ayecode-connect',
694
+                'name'   => 'AyeCode Connect',
695
+                'desc'   => __( 'Documentation and Support from within your WordPress admin.', 'geodirectory' ),
696
+            ),
697
+            'ninja-forms' => array(
698
+                'url'   => 'https://wordpress.org/plugins/invoicing-quotes/',
699
+                'slug'   => 'invoicing-quotes',
700
+                'name'   => 'Customer Quotes',
701
+                'desc'   => __('Create & Send Quotes to Customers and have them accept and pay.','geodirectory'),
702
+            ),
703
+            'userswp' => array(
704
+                'url'   => 'https://wordpress.org/plugins/userswp/',
705
+                'slug'   => 'userswp',
706
+                'name'   => 'UsersWP',
707
+                'desc'   => __('Frontend user login and registration as well as slick profile pages.','geodirectory'),
708
+            ),
709
+        );
710
+
711
+        return $plugins;
712
+    }
713
+
714
+    /**
715
+     * Dummy data save.
716
+     *
717
+     * This is done via ajax so we just pass onto the next step.
718
+     *
719
+     * @since 2.0.0
720
+     */
721
+    public function setup_recommend_save() {
722
+        check_admin_referer( 'gp-setup' );
723
+        wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
724
+        exit;
725
+    }
726
+
727
+    /**
728
+     * Dummy Data setup.
729
+     *
730
+     * @since 2.0.0
731
+     */
732
+    public function setup_payments() {
733
+        ?>
734 734
 		<form method="post" class="text-center card-body">
735 735
 			<div class="gp-wizard-payments">
736 736
 
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 
772 772
 
773 773
 
774
-				?>
774
+                ?>
775 775
 
776 776
 
777 777
 			</div>
@@ -781,29 +781,29 @@  discard block
 block discarded – undo
781 781
 			</p>
782 782
 		</form>
783 783
 		<?php
784
-	}
785
-
786
-	/**
787
-	 * Dummy data save.
788
-	 *
789
-	 * This is done via ajax so we just pass onto the next step.
790
-	 *
791
-	 * @since 2.0.0
792
-	 */
793
-	public function setup_payments_save() {
794
-		check_admin_referer( 'gp-setup' );
795
-		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
796
-		exit;
797
-	}
798
-
799
-	/**
800
-	 * Final step.
801
-	 *
802
-	 * @since 2.0.0
803
-	 */
804
-	public function setup_ready() {
805
-		$this->setup_ready_actions();
806
-		?>
784
+    }
785
+
786
+    /**
787
+     * Dummy data save.
788
+     *
789
+     * This is done via ajax so we just pass onto the next step.
790
+     *
791
+     * @since 2.0.0
792
+     */
793
+    public function setup_payments_save() {
794
+        check_admin_referer( 'gp-setup' );
795
+        wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
796
+        exit;
797
+    }
798
+
799
+    /**
800
+     * Final step.
801
+     *
802
+     * @since 2.0.0
803
+     */
804
+    public function setup_ready() {
805
+        $this->setup_ready_actions();
806
+        ?>
807 807
 
808 808
 		<div class="text-center card-body">
809 809
 			<h1 class="h3"><?php esc_html_e( 'Awesome, you are ready to GetPaid', 'invoicing' ); ?></h1>
@@ -844,24 +844,24 @@  discard block
 block discarded – undo
844 844
 			</div>
845 845
 		</div>
846 846
 		<?php
847
-	}
848
-
849
-	/**
850
-	 * Actions on the final step.
851
-	 *
852
-	 * @since 2.0.0
853
-	 */
854
-	private function setup_ready_actions() {
855
-		GeoDir_Admin_Notices::remove_notice( 'install' );
856
-
857
-		if ( isset( $_GET['gd_tracker_optin'] ) && isset( $_GET['gd_tracker_nonce'] ) && wp_verify_nonce( $_GET['gd_tracker_nonce'], 'gd_tracker_optin' ) ) {
858
-			geodir_update_option( 'usage_tracking', true );
859
-			GeoDir_Admin_Tracker::send_tracking_data( true );
860
-
861
-		} elseif ( isset( $_GET['gd_tracker_optout'] ) && isset( $_GET['gd_tracker_nonce'] ) && wp_verify_nonce( $_GET['gd_tracker_nonce'], 'gd_tracker_optout' ) ) {
862
-			geodir_update_option( 'usage_tracking', false );
863
-		}
864
-	}
847
+    }
848
+
849
+    /**
850
+     * Actions on the final step.
851
+     *
852
+     * @since 2.0.0
853
+     */
854
+    private function setup_ready_actions() {
855
+        GeoDir_Admin_Notices::remove_notice( 'install' );
856
+
857
+        if ( isset( $_GET['gd_tracker_optin'] ) && isset( $_GET['gd_tracker_nonce'] ) && wp_verify_nonce( $_GET['gd_tracker_nonce'], 'gd_tracker_optin' ) ) {
858
+            geodir_update_option( 'usage_tracking', true );
859
+            GeoDir_Admin_Tracker::send_tracking_data( true );
860
+
861
+        } elseif ( isset( $_GET['gd_tracker_optout'] ) && isset( $_GET['gd_tracker_nonce'] ) && wp_verify_nonce( $_GET['gd_tracker_nonce'], 'gd_tracker_optout' ) ) {
862
+            geodir_update_option( 'usage_tracking', false );
863
+        }
864
+    }
865 865
 
866 866
 
867 867
 }
Please login to merge, or discard this patch.
Spacing   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @version     2.4.0
11 11
  * @info        GetPaid Setup Wizard.
12 12
  */
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if (!defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 	 * Hook in tabs.
30 30
 	 */
31 31
 	public function __construct() {
32
-		if ( apply_filters( 'getpaid_enable_setup_wizard', true ) && current_user_can( 'manage_options' ) ) {
33
-			add_action( 'admin_menu', array( $this, 'admin_menus' ) );
34
-			add_action( 'current_screen', array( $this, 'setup_wizard' ) );
32
+		if (apply_filters('getpaid_enable_setup_wizard', true) && current_user_can('manage_options')) {
33
+			add_action('admin_menu', array($this, 'admin_menus'));
34
+			add_action('current_screen', array($this, 'setup_wizard'));
35 35
 
36 36
 			// add default content action
37
-			add_action( 'geodir_wizard_content_dummy_data', array( __CLASS__, 'content_dummy_data' ) );
38
-			add_action( 'geodir_wizard_content_sidebars', array( __CLASS__, 'content_sidebars' ) );
39
-			add_action( 'geodir_wizard_content_menus', array( __CLASS__, 'content_menus' ) );
37
+			add_action('geodir_wizard_content_dummy_data', array(__CLASS__, 'content_dummy_data'));
38
+			add_action('geodir_wizard_content_sidebars', array(__CLASS__, 'content_sidebars'));
39
+			add_action('geodir_wizard_content_menus', array(__CLASS__, 'content_menus'));
40 40
 		}
41 41
 	}
42 42
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * Add admin menus/screens.
45 45
 	 */
46 46
 	public function admin_menus() {
47
-		add_dashboard_page( '', '', 'manage_options', 'gp-setup', '' );
47
+		add_dashboard_page('', '', 'manage_options', 'gp-setup', '');
48 48
 	}
49 49
 
50 50
 	/**
@@ -53,44 +53,44 @@  discard block
 block discarded – undo
53 53
 	 * @since 2.0.0
54 54
 	 */
55 55
 	public function setup_wizard() {
56
-		if ( empty( $_GET['page'] ) || 'gp-setup' !== $_GET['page'] ) {
56
+		if (empty($_GET['page']) || 'gp-setup' !== $_GET['page']) {
57 57
 			return;
58 58
 		}
59 59
 		$default_steps = array(
60 60
 			'introduction'     => array(
61
-				'name'    => __( 'Introduction', 'invoicing' ),
62
-				'view'    => array( $this, 'setup_introduction' ),
61
+				'name'    => __('Introduction', 'invoicing'),
62
+				'view'    => array($this, 'setup_introduction'),
63 63
 				'handler' => '',
64 64
 			),
65 65
 			'business_details'             => array(
66
-				'name'    => __( "Business Details", 'invoicing' ),
67
-				'view'    => array( $this, 'setup_business' ),
68
-				'handler' => array( $this, 'setup_business_save' ),
66
+				'name'    => __("Business Details", 'invoicing'),
67
+				'view'    => array($this, 'setup_business'),
68
+				'handler' => array($this, 'setup_business_save'),
69 69
 			),
70 70
 			'currency' => array(
71
-				'name'    => __( 'Currency', 'invoicing' ),
72
-				'view'    => array( $this, 'setup_currency' ),
73
-				'handler' => array( $this, 'setup_currency_save' ),
71
+				'name'    => __('Currency', 'invoicing'),
72
+				'view'    => array($this, 'setup_currency'),
73
+				'handler' => array($this, 'setup_currency_save'),
74 74
 			),
75 75
 			'payments'        => array(
76
-				'name'    => __( 'Payment Gateways', 'invoicing' ),
77
-				'view'    => array( $this, 'setup_payments' ),
78
-				'handler' => array( $this, 'setup_payments_save' ),
76
+				'name'    => __('Payment Gateways', 'invoicing'),
77
+				'view'    => array($this, 'setup_payments'),
78
+				'handler' => array($this, 'setup_payments_save'),
79 79
 			),
80 80
 			'recommend'          => array(
81
-				'name'    => __( 'Recommend', 'invoicing' ),
82
-				'view'    => array( $this, 'setup_recommend' ),
83
-				'handler' => array( $this, 'setup_recommend_save' ),
81
+				'name'    => __('Recommend', 'invoicing'),
82
+				'view'    => array($this, 'setup_recommend'),
83
+				'handler' => array($this, 'setup_recommend_save'),
84 84
 			),
85 85
 			'next_steps'       => array(
86
-				'name'    => __( 'Get Paid', 'invoicing' ),
87
-				'view'    => array( $this, 'setup_ready' ),
86
+				'name'    => __('Get Paid', 'invoicing'),
87
+				'view'    => array($this, 'setup_ready'),
88 88
 				'handler' => '',
89 89
 			),
90 90
 		);
91 91
 
92
-		$this->steps     = apply_filters( 'getpaid_setup_wizard_steps', $default_steps );
93
-		$this->step      = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
92
+		$this->steps     = apply_filters('getpaid_setup_wizard_steps', $default_steps);
93
+		$this->step      = isset($_GET['step']) ? sanitize_key($_GET['step']) : current(array_keys($this->steps));
94 94
 
95 95
 
96 96
 		// enqueue the script
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
 	<head>
129 129
 		<meta name="viewport" content="width=device-width"/>
130 130
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
131
-		<title><?php esc_html_e( 'GetPaid &rsaquo; Setup Wizard', 'invoicing' ); ?></title>
131
+		<title><?php esc_html_e('GetPaid &rsaquo; Setup Wizard', 'invoicing'); ?></title>
132 132
 		<?php
133 133
 
134
-		wp_register_style( 'font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(  ), WPINV_VERSION );
135
-		wp_enqueue_style( 'font-awesome' );
136
-		do_action( 'admin_print_styles' ); ?>
137
-		<?php do_action( 'admin_head' ); ?>
134
+		wp_register_style('font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(  ), WPINV_VERSION);
135
+		wp_enqueue_style('font-awesome');
136
+		do_action('admin_print_styles'); ?>
137
+		<?php do_action('admin_head'); ?>
138 138
 		<style>
139 139
 			body,p{
140 140
 				font-size: 16px;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
 			<?php
145 145
 				$aui_settings = AyeCode_UI_Settings::instance();
146
-				echo $aui_settings::css_primary('#009874',true);
146
+				echo $aui_settings::css_primary('#009874', true);
147 147
 			 ?>
148 148
 
149 149
 
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 	</head>
152 152
 	<body class="gp-setup wp-core-ui bg-lightx mx-auto text-dark scrollbars-ios" style="background: #f3f6ff;">
153 153
 	<?php
154
-	if(isset($_REQUEST['step'])){
154
+	if (isset($_REQUEST['step'])) {
155 155
 	$this->setup_wizard_steps();
156
-	}else{
156
+	} else {
157 157
 	echo "<div class='mb-3'>&nbsp;</div>";
158 158
 	}
159 159
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	<h1 class="h2 text-center pb-3">
162 162
 		<a class=" text-decoration-none" href="https://wpgetpaid.com/">
163 163
 			<span class="text-black-50">
164
-				<img class="ml-n3x" src="<?php echo WPINV_PLUGIN_URL . 'assets/images/getpaid-logo.png';?>" />
164
+				<img class="ml-n3x" src="<?php echo WPINV_PLUGIN_URL . 'assets/images/getpaid-logo.png'; ?>" />
165 165
 			</span>
166 166
 		</a>
167 167
 	</h1>
@@ -175,21 +175,21 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	public function setup_wizard_steps() {
177 177
 		$ouput_steps = $this->steps;
178
-		array_shift( $ouput_steps );
178
+		array_shift($ouput_steps);
179 179
 		?>
180 180
 		<ol class="gp-setup-steps mb-0 pb-4 mw-100 list-group list-group-horizontal text-center">
181 181
 			<?php
182 182
 			$current = '';
183
-			foreach ( $ouput_steps as $step_key => $step ) : ?>
183
+			foreach ($ouput_steps as $step_key => $step) : ?>
184 184
 				<li class="list-group-item flex-fill rounded-0 <?php
185
-				if ( $step_key === $this->step ) {
185
+				if ($step_key === $this->step) {
186 186
 					$current = $this->step;
187 187
 					echo 'active';
188
-				} elseif ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) {
188
+				} elseif (array_search($this->step, array_keys($this->steps)) > array_search($step_key, array_keys($this->steps))) {
189 189
 					echo 'done';
190 190
 				}
191 191
 				$done = !$current ? 'text-success' : '';
192
-				?>"><i class="far fa-check-circle <?php echo $done ;?>"></i> <?php echo esc_html( $step['name'] ); ?></li>
192
+				?>"><i class="far fa-check-circle <?php echo $done; ?>"></i> <?php echo esc_html($step['name']); ?></li>
193 193
 			<?php endforeach; ?>
194 194
 		</ol>
195 195
 		<?php
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 		echo '<div class="gp-setup-content rowx mw-100 text-center mb-3">';
205 205
 		echo '<div class="col-5 m-auto">';
206 206
 		echo '<div class="card shadow-sm">';
207
-		call_user_func( $this->steps[ $this->step ]['view'], $this );
207
+		call_user_func($this->steps[$this->step]['view'], $this);
208 208
 		echo '</div>';
209 209
 		echo '</div>';
210 210
 		echo '</div>';
@@ -217,13 +217,13 @@  discard block
 block discarded – undo
217 217
 	 */
218 218
 	public function setup_wizard_footer() {
219 219
 	?>
220
-	<?php if ( 'next_steps' === $this->step ){ ?>
220
+	<?php if ('next_steps' === $this->step) { ?>
221 221
 		<p class="gd-return-to-dashboard-wrap"><a class="gd-return-to-dashboard btn btn-link d-block text-muted"
222
-		                                          href="<?php echo esc_url( admin_url() ); ?>"><?php esc_html_e( 'Return to the WordPress Dashboard', 'invoicing' ); ?></a>
222
+		                                          href="<?php echo esc_url(admin_url()); ?>"><?php esc_html_e('Return to the WordPress Dashboard', 'invoicing'); ?></a>
223 223
 		</p>
224
-	<?php }else{ ?>
225
-	<p class="gd-return-to-dashboard-wrap"><a href="<?php echo esc_url( $this->get_next_step_link() ); ?>"
226
-		                class="btn btn-link d-block text-muted"><?php esc_html_e( 'Skip this step', 'invoicing' ); ?></a></p>
224
+	<?php } else { ?>
225
+	<p class="gd-return-to-dashboard-wrap"><a href="<?php echo esc_url($this->get_next_step_link()); ?>"
226
+		                class="btn btn-link d-block text-muted"><?php esc_html_e('Skip this step', 'invoicing'); ?></a></p>
227 227
 	<?php } ?>
228 228
 	</body>
229 229
 	</html>
@@ -237,61 +237,61 @@  discard block
 block discarded – undo
237 237
 	 */
238 238
 	public function setup_introduction() {
239 239
 		?>
240
-		<h1 class="h4 card-header bg-white border-bottom-0 pt-4 pb-1"><?php esc_html_e( 'Welcome to GetPaid!', 'invoicing' ); ?></h1>
240
+		<h1 class="h4 card-header bg-white border-bottom-0 pt-4 pb-1"><?php esc_html_e('Welcome to GetPaid!', 'invoicing'); ?></h1>
241 241
 		<div class="card-body text-muted ">
242
-			<p class=""><?php _e( 'Thank you for choosing GetPaid - The most Powerful Payments Plugin for WordPress', 'invoicing' ); ?></p>
242
+			<p class=""><?php _e('Thank you for choosing GetPaid - The most Powerful Payments Plugin for WordPress', 'invoicing'); ?></p>
243 243
 			<hr class="mt-4 pt-3 pb-0" />
244
-			<p class="small"><?php _e( 'This quick setup wizard will help you <b>configure the basic settings</b>. It’s <b>completely optional</b> and shouldn’t take longer than <b>five minutes<b/>.', 'invoicing' ); ?></p>
244
+			<p class="small"><?php _e('This quick setup wizard will help you <b>configure the basic settings</b>. It’s <b>completely optional</b> and shouldn’t take longer than <b>five minutes<b/>.', 'invoicing'); ?></p>
245 245
 		</div>
246 246
 		<div class="card-footer mb-0 bg-white gp-setup-actions step border-top-0">
247
-			<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>"
248
-			   class="btn btn-primary button-next"><?php esc_html_e( 'Let\'s go!', 'invoicing' ); ?></a>
249
-			<a href="<?php echo esc_url( admin_url() ); ?>"
250
-			   class="btn btn-link d-block mt-2 "><?php esc_html_e( 'Not right now', 'invoicing' ); ?></a>
247
+			<a href="<?php echo esc_url($this->get_next_step_link()); ?>"
248
+			   class="btn btn-primary button-next"><?php esc_html_e('Let\'s go!', 'invoicing'); ?></a>
249
+			<a href="<?php echo esc_url(admin_url()); ?>"
250
+			   class="btn btn-link d-block mt-2 "><?php esc_html_e('Not right now', 'invoicing'); ?></a>
251 251
 		</div>
252 252
 
253 253
 
254 254
 		</div>
255 255
 		<div class="card shadow-sm my-5">
256
-		<h1 class="h4 card-header bg-white border-bottom-0  pt-4 pb-1"><?php esc_html_e( 'GetPaid Features & Addons!', 'invoicing' ); ?></h1>
256
+		<h1 class="h4 card-header bg-white border-bottom-0  pt-4 pb-1"><?php esc_html_e('GetPaid Features & Addons!', 'invoicing'); ?></h1>
257 257
 		<div class="card-body text-muted overflow-hidden">
258
-			<p class=""><?php _e( 'Collect one time & recurring payments online within minutes. No complex setup required.', 'invoicing' ); ?></p>
258
+			<p class=""><?php _e('Collect one time & recurring payments online within minutes. No complex setup required.', 'invoicing'); ?></p>
259 259
 			<hr class="">
260 260
 
261 261
 			<div class="row row row-cols-2 text-left">
262 262
 				<div class="col mt-3">
263 263
 					<div class="media">
264
-					  <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/buy.svg';?>" class="mr-3" alt="...">
264
+					  <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/buy.svg'; ?>" class="mr-3" alt="...">
265 265
 					  <div class="media-body">
266
-					    <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Buy Now Buttons','invoicing');?></h6>
267
-					    <small><?php _e('Sell via buy now buttons anywhere on your site','invoicing');?></small>
266
+					    <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Buy Now Buttons', 'invoicing'); ?></h6>
267
+					    <small><?php _e('Sell via buy now buttons anywhere on your site', 'invoicing'); ?></small>
268 268
 					  </div>
269 269
 					</div>
270 270
 				</div>
271 271
 			    <div class="col mt-3">
272 272
 					<div class="media">
273
-					  <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/report.svg';?>" class="mr-3" alt="...">
273
+					  <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/report.svg'; ?>" class="mr-3" alt="...">
274 274
 					  <div class="media-body">
275
-					    <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via payment form','invoicing');?></h6>
276
-					    <small><?php _e('Payment forms are conversion-optimized checkout forms','invoicing');?></small>
275
+					    <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via payment form', 'invoicing'); ?></h6>
276
+					    <small><?php _e('Payment forms are conversion-optimized checkout forms', 'invoicing'); ?></small>
277 277
 					  </div>
278 278
 					</div>
279 279
 				</div>
280 280
 				<div class="col mt-3">
281 281
 					<div class="media">
282
-					  <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/invoices.svg';?>" class="mr-3" alt="...">
282
+					  <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/invoices.svg'; ?>" class="mr-3" alt="...">
283 283
 					  <div class="media-body">
284
-					    <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Invoice','invoicing');?></h6>
285
-					    <small><?php _e('Create and send invoices for just about anything from the WOrdPress dashboard','invoicing');?></small>
284
+					    <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Invoice', 'invoicing'); ?></h6>
285
+					    <small><?php _e('Create and send invoices for just about anything from the WOrdPress dashboard', 'invoicing'); ?></small>
286 286
 					  </div>
287 287
 					</div>
288 288
 				</div>
289 289
 				<div class="col mt-3">
290 290
 					<div class="media">
291
-					  <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/payment.svg';?>" class="mr-3" alt="...">
291
+					  <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/payment.svg'; ?>" class="mr-3" alt="...">
292 292
 					  <div class="media-body">
293
-					    <h6 class="mt-0 font-weight-bold"><?php _e('Affordable payment gateways','invoicing');?></h6>
294
-					    <small><?php _e('On average our gateways are over 66% cheaper than our competition','invoicing');?></small>
293
+					    <h6 class="mt-0 font-weight-bold"><?php _e('Affordable payment gateways', 'invoicing'); ?></h6>
294
+					    <small><?php _e('On average our gateways are over 66% cheaper than our competition', 'invoicing'); ?></small>
295 295
 					  </div>
296 296
 					</div>
297 297
 				</div>
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
 
300 300
 			<div class="mt-5">
301 301
 				<a href="https://wpgetpaid.com/features-list/"
302
-				   class="btn btn-primary"><?php esc_html_e( 'View All Features!', 'invoicing' ); ?></a>
302
+				   class="btn btn-primary"><?php esc_html_e('View All Features!', 'invoicing'); ?></a>
303 303
 			</div>
304 304
 			<div class="mt-5 mx-n4 py-4" style="background:#eafaf6;">
305
-				<h4 class="mt-0 font-weight-bold text-dark mb-4"><?php _e('More with Membership!','invoicing');?></h4>
305
+				<h4 class="mt-0 font-weight-bold text-dark mb-4"><?php _e('More with Membership!', 'invoicing'); ?></h4>
306 306
 				<div class="row row-cols-2 text-left px-5">
307 307
 					<div class="col">
308 308
 						<ul class="list-unstyled">
@@ -321,12 +321,12 @@  discard block
 block discarded – undo
321 321
 					</div>
322 322
 				</div>
323 323
 
324
-				<h5 class="mt-4 font-weight-bold text-dark mb-3"><?php _e('Membership Starts From','invoicing');?></h5>
324
+				<h5 class="mt-4 font-weight-bold text-dark mb-3"><?php _e('Membership Starts From', 'invoicing'); ?></h5>
325 325
 				<h1 class="mt-0 font-weight-bold text-dark mb-4 display-3">$49</h1>
326 326
 
327 327
 				<div class="mt-2">
328 328
 				<a href="https://wpgetpaid.com/downloads/membership/"
329
-				   class="btn btn-primary"><?php esc_html_e( 'Buy Membership Now!', 'invoicing' ); ?></a>
329
+				   class="btn btn-primary"><?php esc_html_e('Buy Membership Now!', 'invoicing'); ?></a>
330 330
 			</div>
331 331
 
332 332
 
@@ -334,12 +334,12 @@  discard block
 block discarded – undo
334 334
 
335 335
 		</div>
336 336
 		<div class="card-footer mb-0 bg-white gp-setup-actions step border-top-0">
337
-			<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>"
338
-			   class="btn btn-outline-primary button-next"><?php esc_html_e( 'Launch the Setup Wizard!', 'invoicing' ); ?></a>
337
+			<a href="<?php echo esc_url($this->get_next_step_link()); ?>"
338
+			   class="btn btn-outline-primary button-next"><?php esc_html_e('Launch the Setup Wizard!', 'invoicing'); ?></a>
339 339
 			   <a href="https://docs.wpgetpaid.com/"
340
-			   class="btn btn-outline-primary ml-4"><?php esc_html_e( 'Documentation', 'invoicing' ); ?></a>
341
-			<a href="<?php echo esc_url( admin_url() ); ?>"
342
-			   class="btn btn-link d-block mt-2 "><?php esc_html_e( 'Not right now', 'invoicing' ); ?></a>
340
+			   class="btn btn-outline-primary ml-4"><?php esc_html_e('Documentation', 'invoicing'); ?></a>
341
+			<a href="<?php echo esc_url(admin_url()); ?>"
342
+			   class="btn btn-link d-block mt-2 "><?php esc_html_e('Not right now', 'invoicing'); ?></a>
343 343
 		</div>
344 344
 		<?php
345 345
 	}
@@ -354,22 +354,22 @@  discard block
 block discarded – undo
354 354
 	 *                      Empty string on failure.
355 355
 	 * @since 3.0.0
356 356
 	 */
357
-	public function get_next_step_link( $step = '' ) {
358
-		if ( ! $step ) {
357
+	public function get_next_step_link($step = '') {
358
+		if (!$step) {
359 359
 			$step = $this->step;
360 360
 		}
361 361
 
362
-		$keys = array_keys( $this->steps );
363
-		if ( end( $keys ) === $step ) {
362
+		$keys = array_keys($this->steps);
363
+		if (end($keys) === $step) {
364 364
 			return admin_url();
365 365
 		}
366 366
 
367
-		$step_index = array_search( $step, $keys );
368
-		if ( false === $step_index ) {
367
+		$step_index = array_search($step, $keys);
368
+		if (false === $step_index) {
369 369
 			return '';
370 370
 		}
371 371
 
372
-		return remove_query_arg('settings-updated', add_query_arg( 'step', $keys[ $step_index + 1 ] ));
372
+		return remove_query_arg('settings-updated', add_query_arg('step', $keys[$step_index + 1]));
373 373
 	}
374 374
 
375 375
 	/**
@@ -382,11 +382,11 @@  discard block
 block discarded – undo
382 382
 		<form method="post" class="text-left card-body" action="options.php">
383 383
 			<?php
384 384
 
385
-			settings_fields( 'wpinv_settings' );
385
+			settings_fields('wpinv_settings');
386 386
 
387 387
 			// override http referer to make it send back to the next step
388 388
 				?>
389
-			<input type="hidden" name="_wp_http_referer" value="<?php echo esc_url( $this->get_next_step_link() ); ?>">
389
+			<input type="hidden" name="_wp_http_referer" value="<?php echo esc_url($this->get_next_step_link()); ?>">
390 390
 
391 391
 			<table class="gp-setup-maps w-100 " cellspacing="0">
392 392
 
@@ -398,11 +398,11 @@  discard block
 block discarded – undo
398 398
 
399 399
 				$page = 'wpinv_settings_general_main';
400 400
 				$section = 'wpinv_settings_general_main';
401
-				if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) {
401
+				if (!isset($wp_settings_fields[$page][$section])) {
402 402
 			        return;
403 403
 			    }
404 404
 
405
-			    $settings =  $wp_settings_fields[ $page ][ $section ];
405
+			    $settings = $wp_settings_fields[$page][$section];
406 406
 
407 407
 				// unset title
408 408
 				unset($settings["wpinv_settings[location_settings]"]);
@@ -417,49 +417,49 @@  discard block
 block discarded – undo
417 417
 
418 418
 			<p class="gp-setup-actions step text-center mt-4">
419 419
 				<input type="submit" class="btn btn-primary button-next"
420
-				       value="<?php esc_attr_e( 'Continue', 'invoicing' ); ?>" name="save_step"/>
420
+				       value="<?php esc_attr_e('Continue', 'invoicing'); ?>" name="save_step"/>
421 421
 			</p>
422 422
 		</form>
423 423
 		<?php
424 424
 	}
425 425
 
426
-	public function output_fields($settings){
426
+	public function output_fields($settings) {
427 427
 
428
-	    if ( empty($settings)) {
428
+	    if (empty($settings)) {
429 429
 	        return;
430 430
 	    }
431 431
 
432 432
 //print_r($settings);
433
-	    foreach ( (array) $settings as $key => $field ) {
433
+	    foreach ((array) $settings as $key => $field) {
434 434
 
435 435
 
436 436
 	        $class = '';
437 437
 
438
-	        if ( ! empty( $field['args']['class'] ) ) {
439
-	            $class = esc_attr( $field['args']['class'] );
438
+	        if (!empty($field['args']['class'])) {
439
+	            $class = esc_attr($field['args']['class']);
440 440
 	        }
441 441
 
442 442
 	       // echo '<div class="form-group '.$class.'">';
443 443
 
444 444
 
445
-	        if ( ! empty( $field['args']['label_for'] ) ) {
446
-	            $for = ' for="' . esc_attr( $field['args']['label_for'] ) . '" ';
445
+	        if (!empty($field['args']['label_for'])) {
446
+	            $for = ' for="' . esc_attr($field['args']['label_for']) . '" ';
447 447
 	        } else {
448 448
 	            $for = '';
449 449
 	        }
450 450
 
451
-			$value  = isset( $field['args']['std'] ) ? $field['args']['std'] : '';
452
-			$value  = wpinv_get_option( $field['args']['id'], $value );
451
+			$value  = isset($field['args']['std']) ? $field['args']['std'] : '';
452
+			$value  = wpinv_get_option($field['args']['id'], $value);
453 453
 
454
-			if($field['callback'] == 'wpinv_text_callback' || $field['callback'] == 'wpinv_number_callback' ){
454
+			if ($field['callback'] == 'wpinv_text_callback' || $field['callback'] == 'wpinv_number_callback') {
455 455
 
456 456
 
457 457
 			// hide the logo inputs, we need to set them as hidden so they don't blank the current values.
458 458
 			$help_text = isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '';
459
-			$type = $field['callback'] == 'wpinv_number_callback'  ? 'number' : 'text';
459
+			$type = $field['callback'] == 'wpinv_number_callback' ? 'number' : 'text';
460 460
 			$label = isset($field['args']['name']) ? esc_attr($field['args']['name']) : '';
461 461
 
462
-			if(in_array($field['id'],array('wpinv_settings[logo]','wpinv_settings[logo_width]','wpinv_settings[logo_height]'))){
462
+			if (in_array($field['id'], array('wpinv_settings[logo]', 'wpinv_settings[logo_width]', 'wpinv_settings[logo_height]'))) {
463 463
 				$type = 'hidden';
464 464
 				$help_text = '';
465 465
 				$label = '';
@@ -469,29 +469,29 @@  discard block
 block discarded – undo
469 469
 									'type'  =>  $type,
470 470
 									'id'    =>  isset($field['args']['id']) ? esc_attr($field['args']['id']) : '',
471 471
 									'name'    =>  isset($field['id']) ? esc_attr($field['id']) : '',
472
-									'value' =>   is_scalar( $value ) ? esc_attr( $value ) : '',
472
+									'value' =>   is_scalar($value) ? esc_attr($value) : '',
473 473
 									'required'  => false,
474 474
 									'help_text' => $help_text,
475 475
 									'label' => $label,
476 476
 									'label_type'    => 'floating'
477 477
 								));
478
-			}elseif($field['callback'] == 'wpinv_select_callback' || $field['callback'] == 'wpinv_country_states_callback'){
478
+			}elseif ($field['callback'] == 'wpinv_select_callback' || $field['callback'] == 'wpinv_country_states_callback') {
479 479
 
480
-if($field['id']=='wpinv_settings[default_state]'){
481
-			$country_value  = wpinv_get_option( 'wpinv_settings[default_country]', 'US');
482
-$options = wpinv_get_country_states($country_value);//echo $value .'###'.$country_value;
483
-}else{
480
+if ($field['id'] == 'wpinv_settings[default_state]') {
481
+			$country_value = wpinv_get_option('wpinv_settings[default_country]', 'US');
482
+$options = wpinv_get_country_states($country_value); //echo $value .'###'.$country_value;
483
+} else {
484 484
 $options = isset($field['args']['options']) ? $field['args']['options'] : array();
485 485
 }
486 486
 
487 487
 //print_r($options );echo '###';
488 488
 
489
-				echo aui()->select( array(
489
+				echo aui()->select(array(
490 490
 					'id'              =>  isset($field['args']['id']) ? esc_attr($field['args']['id']) : '',
491 491
 					'name'            =>  isset($field['id']) ? esc_attr($field['id']) : '',
492 492
 					'placeholder'     => '',
493 493
 //					'title'           => $site_title,
494
-					'value'           => is_scalar( $value ) ? esc_attr( $value ) : '',
494
+					'value'           => is_scalar($value) ? esc_attr($value) : '',
495 495
 					'required'        => false,
496 496
 					'help_text'       => isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '',
497 497
 					'label'           => isset($field['args']['name']) ? esc_attr($field['args']['name']) : '',
@@ -499,24 +499,24 @@  discard block
 block discarded – undo
499 499
 					'select2'         => true,
500 500
 					'label_type'    => 'floating'
501 501
 //					'wrap_class'      => isset( $field->css_class ) ? $field->css_class : '',
502
-				) );
503
-			}elseif($field['callback'] == 'wpinv_textarea_callback'){
504
-				$textarea =  aui()->textarea( array(
502
+				));
503
+			}elseif ($field['callback'] == 'wpinv_textarea_callback') {
504
+				$textarea = aui()->textarea(array(
505 505
 					'id'              => isset($field['args']['id']) ? esc_attr($field['args']['id']) : '',
506 506
 					'name'            => isset($field['id']) ? esc_attr($field['id']) : '',
507 507
 					'placeholder'     => '',
508 508
 //					'title'           => $site_title,
509
-					'value'           => is_scalar( $value ) ? esc_attr( $value ) : '',
509
+					'value'           => is_scalar($value) ? esc_attr($value) : '',
510 510
 					'required'        => false,
511 511
 					'help_text'       => isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '',
512 512
 					'label'           => isset($field['args']['name']) ? esc_attr($field['args']['name']) : '',
513 513
 					'rows'            => '4',
514 514
 					'label_type'    => 'floating'
515 515
 //					'wrap_class'      => isset( $field->css_class ) ? $field->css_class : '',
516
-				) );
516
+				));
517 517
 
518 518
 				// bug fixed in AUI 0.1.51 for name stripping []
519
-				$textarea = str_replace(sanitize_html_class($field['args']['id']),esc_attr($field['args']['id']),$textarea );
519
+				$textarea = str_replace(sanitize_html_class($field['args']['id']), esc_attr($field['args']['id']), $textarea);
520 520
 
521 521
 				echo $textarea;
522 522
 			}
@@ -554,11 +554,11 @@  discard block
 block discarded – undo
554 554
 			<?php
555 555
 
556 556
 
557
-			settings_fields( 'wpinv_settings' );
557
+			settings_fields('wpinv_settings');
558 558
 
559 559
 			// override http referer to make it send back to the next step
560 560
 				?>
561
-			<input type="hidden" name="_wp_http_referer" value="<?php echo esc_url( $this->get_next_step_link() ); ?>">
561
+			<input type="hidden" name="_wp_http_referer" value="<?php echo esc_url($this->get_next_step_link()); ?>">
562 562
 
563 563
 			<table class="gp-setup-maps w-100 " cellspacing="0">
564 564
 
@@ -570,11 +570,11 @@  discard block
 block discarded – undo
570 570
 
571 571
 				$page = 'wpinv_settings_general_currency_section';
572 572
 				$section = 'wpinv_settings_general_currency_section';
573
-				if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) {
573
+				if (!isset($wp_settings_fields[$page][$section])) {
574 574
 			        return;
575 575
 			    }
576 576
 
577
-			    $settings =  $wp_settings_fields[ $page ][ $section ];
577
+			    $settings = $wp_settings_fields[$page][$section];
578 578
 
579 579
 //				print_r($settings);exit;
580 580
 
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 
589 589
 			<p class="gp-setup-actions step text-center mt-4">
590 590
 				<input type="submit" class="btn btn-primary"
591
-				       value="<?php esc_attr_e( 'Continue', 'invoicing' ); ?>" name="save_step"/>
591
+				       value="<?php esc_attr_e('Continue', 'invoicing'); ?>" name="save_step"/>
592 592
 			</p>
593 593
 		</form>
594 594
 
@@ -602,15 +602,15 @@  discard block
 block discarded – undo
602 602
 	 * @since 2.0.0
603 603
 	 */
604 604
 	public function setup_currency_save() {
605
-		check_admin_referer( 'gp-setup' );
605
+		check_admin_referer('gp-setup');
606 606
 
607 607
 		$generalSettings = new GeoDir_Settings_General();
608
-		$settings        = $generalSettings->get_settings( 'location' );
609
-		GeoDir_Admin_Settings::save_fields( $settings );
608
+		$settings        = $generalSettings->get_settings('location');
609
+		GeoDir_Admin_Settings::save_fields($settings);
610 610
 
611
-		do_action( 'geodir_setup_wizard_default_location_saved', $settings );
611
+		do_action('geodir_setup_wizard_default_location_saved', $settings);
612 612
 
613
-		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
613
+		wp_redirect(esc_url_raw($this->get_next_step_link()));
614 614
 		exit;
615 615
 	}
616 616
 
@@ -625,28 +625,28 @@  discard block
 block discarded – undo
625 625
 		<form method="post" class="text-center card-body">
626 626
 			<div class="gd-wizard-recommend">
627 627
 
628
-				<h2 class="gd-settings-title h3 "><?php _e( "Recommend Plugins", "geodirectory" ); ?></h2>
628
+				<h2 class="gd-settings-title h3 "><?php _e("Recommend Plugins", "geodirectory"); ?></h2>
629 629
 
630
-				<p><?php _e( "Below are a few of our own plugins that may help you.", "geodirectory" ); ?></p>
630
+				<p><?php _e("Below are a few of our own plugins that may help you.", "geodirectory"); ?></p>
631 631
 
632 632
 
633 633
 				<?php
634 634
 
635
-				include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
635
+				include_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); //for plugins_api..
636 636
 
637 637
 				$recommend_wp_plugins = self::get_recommend_wp_plugins();
638 638
 
639 639
 				//			$status = install_plugin_install_status( array("slug"=>"two-factor","version"=>""));
640 640
 				//			print_r($status);
641 641
 
642
-				if ( ! empty( $recommend_wp_plugins ) ) {
642
+				if (!empty($recommend_wp_plugins)) {
643 643
 
644 644
 				?>
645 645
 				<ul class="list-group">
646 646
 					<?php
647
-						foreach ( $recommend_wp_plugins as $plugin ) {
648
-						$status = install_plugin_install_status( array( "slug" => $plugin['slug'], "version" => "" ) );
649
-						$plugin_status = isset( $status['status'] ) ? $status['status'] : '';
647
+						foreach ($recommend_wp_plugins as $plugin) {
648
+						$status = install_plugin_install_status(array("slug" => $plugin['slug'], "version" => ""));
649
+						$plugin_status = isset($status['status']) ? $status['status'] : '';
650 650
 						?>
651 651
 							<li class="list-group-item d-flex justify-content-between align-items-center flex-wrap text-left">
652 652
 							    <span class="mr-auto"><?php echo esc_attr($plugin['name']); ?></span>
@@ -654,10 +654,10 @@  discard block
 block discarded – undo
654 654
 									<span class="sr-only">Loading...</span>
655 655
 								</div>
656 656
 								<div class="custom-control custom-switch  mr-n2">
657
-									<input type="checkbox" class="custom-control-input"  <?php if( is_plugin_active( $plugin['slug'] ) ){echo "checked";} ?> onclick="if(jQuery(this).is(':checked')){}else{}">
657
+									<input type="checkbox" class="custom-control-input"  <?php if (is_plugin_active($plugin['slug'])) {echo "checked"; } ?> onclick="if(jQuery(this).is(':checked')){}else{}">
658 658
 									<label class="custom-control-label" for="ac-setting-updates"></label>
659 659
 								</div>
660
-								<small class="w-100"><?php echo esc_attr($plugin['desc'] );?></small>
660
+								<small class="w-100"><?php echo esc_attr($plugin['desc']); ?></small>
661 661
 							 </li>
662 662
 						<?php
663 663
 						}
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 			</div>
677 677
 
678 678
 			<p class="gp-setup-actions step text-center mt-4">
679
-				<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="btn btn-primary"><?php esc_attr_e( 'Continue', 'invoicing' ); ?></a>
679
+				<a href="<?php echo esc_url($this->get_next_step_link()); ?>" class="btn btn-primary"><?php esc_attr_e('Continue', 'invoicing'); ?></a>
680 680
 			</p>
681 681
 		</form>
682 682
 		<?php
@@ -686,25 +686,25 @@  discard block
 block discarded – undo
686 686
 	 * A list of recommended wp.org plugins.
687 687
 	 * @return array
688 688
 	 */
689
-	public static function get_recommend_wp_plugins(){
689
+	public static function get_recommend_wp_plugins() {
690 690
 		$plugins = array(
691 691
 			'ayecode-connect' => array(
692 692
 				'url'   => 'https://wordpress.org/plugins/ayecode-connect/',
693 693
 				'slug'   => 'ayecode-connect',
694 694
 				'name'   => 'AyeCode Connect',
695
-				'desc'   => __( 'Documentation and Support from within your WordPress admin.', 'geodirectory' ),
695
+				'desc'   => __('Documentation and Support from within your WordPress admin.', 'geodirectory'),
696 696
 			),
697 697
 			'ninja-forms' => array(
698 698
 				'url'   => 'https://wordpress.org/plugins/invoicing-quotes/',
699 699
 				'slug'   => 'invoicing-quotes',
700 700
 				'name'   => 'Customer Quotes',
701
-				'desc'   => __('Create & Send Quotes to Customers and have them accept and pay.','geodirectory'),
701
+				'desc'   => __('Create & Send Quotes to Customers and have them accept and pay.', 'geodirectory'),
702 702
 			),
703 703
 			'userswp' => array(
704 704
 				'url'   => 'https://wordpress.org/plugins/userswp/',
705 705
 				'slug'   => 'userswp',
706 706
 				'name'   => 'UsersWP',
707
-				'desc'   => __('Frontend user login and registration as well as slick profile pages.','geodirectory'),
707
+				'desc'   => __('Frontend user login and registration as well as slick profile pages.', 'geodirectory'),
708 708
 			),
709 709
 		);
710 710
 
@@ -719,8 +719,8 @@  discard block
 block discarded – undo
719 719
 	 * @since 2.0.0
720 720
 	 */
721 721
 	public function setup_recommend_save() {
722
-		check_admin_referer( 'gp-setup' );
723
-		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
722
+		check_admin_referer('gp-setup');
723
+		wp_redirect(esc_url_raw($this->get_next_step_link()));
724 724
 		exit;
725 725
 	}
726 726
 
@@ -734,20 +734,20 @@  discard block
 block discarded – undo
734 734
 		<form method="post" class="text-center card-body">
735 735
 			<div class="gp-wizard-payments">
736 736
 
737
-				<h2 class="gd-settings-title h3 "><?php _e( "Gateway Setup", "geodirectory" ); ?></h2>
737
+				<h2 class="gd-settings-title h3 "><?php _e("Gateway Setup", "geodirectory"); ?></h2>
738 738
 
739
-				<p><?php _e( "Below are a few gateways that can be setup in a few seconds.", "geodirectory" ); ?><br><?php _e( "We have 20+ Gateways that can be setup later.", "geodirectory" ); ?></p>
739
+				<p><?php _e("Below are a few gateways that can be setup in a few seconds.", "geodirectory"); ?><br><?php _e("We have 20+ Gateways that can be setup later.", "geodirectory"); ?></p>
740 740
 
741 741
 				<ul class="list-group">
742 742
 				  <li class="list-group-item d-flex justify-content-between align-items-center">
743
-				    <span class="mr-auto"><img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/stripe-verified.svg';?>" class="ml-n2" alt="Stripe"></span>
743
+				    <span class="mr-auto"><img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/stripe-verified.svg'; ?>" class="ml-n2" alt="Stripe"></span>
744 744
 					<div class="spinner-border spinner-border-sm mr-2 d-none text-muted" role="status">
745 745
 						<span class="sr-only">Loading...</span>
746 746
 					</div>
747 747
 				    <span class="btn btn-sm btn-outline-primary">Connect</span>
748 748
 				  </li>
749 749
 				  <li class="list-group-item d-flex justify-content-between align-items-center">
750
-				    <span class="mr-auto"><img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/pp-logo-150px.webp';?>" class="" alt="PayPal" height="25"></span>
750
+				    <span class="mr-auto"><img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/pp-logo-150px.webp'; ?>" class="" alt="PayPal" height="25"></span>
751 751
 					<div class="spinner-border spinner-border-sm mr-2 d-none text-muted" role="status">
752 752
 						<span class="sr-only">Loading...</span>
753 753
 					</div>
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 			</div>
778 778
 
779 779
 			<p class="gp-setup-actions step text-center mt-4">
780
-				<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="btn btn-primary"><?php esc_attr_e( 'Continue', 'invoicing' ); ?></a>
780
+				<a href="<?php echo esc_url($this->get_next_step_link()); ?>" class="btn btn-primary"><?php esc_attr_e('Continue', 'invoicing'); ?></a>
781 781
 			</p>
782 782
 		</form>
783 783
 		<?php
@@ -791,8 +791,8 @@  discard block
 block discarded – undo
791 791
 	 * @since 2.0.0
792 792
 	 */
793 793
 	public function setup_payments_save() {
794
-		check_admin_referer( 'gp-setup' );
795
-		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
794
+		check_admin_referer('gp-setup');
795
+		wp_redirect(esc_url_raw($this->get_next_step_link()));
796 796
 		exit;
797 797
 	}
798 798
 
@@ -806,40 +806,40 @@  discard block
 block discarded – undo
806 806
 		?>
807 807
 
808 808
 		<div class="text-center card-body">
809
-			<h1 class="h3"><?php esc_html_e( 'Awesome, you are ready to GetPaid', 'invoicing' ); ?></h1>
809
+			<h1 class="h3"><?php esc_html_e('Awesome, you are ready to GetPaid', 'invoicing'); ?></h1>
810 810
 
811 811
 
812 812
 			<div class="geodirectory-message geodirectory-tracker">
813
-				<p><?php _e( 'Thank you for choosing GetPaid!', 'invoicing' ); ?> <i class="far fa-smile-beam"></i></p>
813
+				<p><?php _e('Thank you for choosing GetPaid!', 'invoicing'); ?> <i class="far fa-smile-beam"></i></p>
814 814
 			</div>
815 815
 
816 816
 			<div class="gp-setup-next-steps">
817 817
 				<div class="gp-setup-next-steps-first mb-4">
818
-					<h2 class="h3"><?php esc_html_e( 'Next steps', 'invoicing' ); ?></h2>
818
+					<h2 class="h3"><?php esc_html_e('Next steps', 'invoicing'); ?></h2>
819 819
 					<a class="btn btn-primary btn-sm"
820
-						                             href="<?php echo esc_url( admin_url( 'post-new.php?post_type=wpi_item' ) ); ?>"><?php esc_html_e( 'Create your first Item!', 'invoicing' ); ?></a>
820
+						                             href="<?php echo esc_url(admin_url('post-new.php?post_type=wpi_item')); ?>"><?php esc_html_e('Create your first Item!', 'invoicing'); ?></a>
821 821
 				</div>
822 822
 				<div class="gp-setup-next-steps-first mb-4">
823
-					<h2 class="h3"><?php esc_html_e( 'Examples', 'invoicing' ); ?></h2>
823
+					<h2 class="h3"><?php esc_html_e('Examples', 'invoicing'); ?></h2>
824 824
 					<a class="btn btn-primary btn-sm"
825
-					target="_blank" href="https://demos.ayecode.io/getpaid/"><?php esc_html_e( "View What's Possible", 'invoicing' ); ?></a>
825
+					target="_blank" href="https://demos.ayecode.io/getpaid/"><?php esc_html_e("View What's Possible", 'invoicing'); ?></a>
826 826
 
827 827
                      <a class="btn btn-outline-primary btn-sm"
828
-                     target="_blank" href="https://demos.ayecode.io/getpaid/"><?php esc_html_e( "View What's Possible", 'invoicing' ); ?></a>
828
+                     target="_blank" href="https://demos.ayecode.io/getpaid/"><?php esc_html_e("View What's Possible", 'invoicing'); ?></a>
829 829
 				</div>
830 830
 				<div class="gp-setup-next-steps-last">
831
-					<h2 class="h3"><?php _e( 'Learn more', 'invoicing' ); ?></h2>
831
+					<h2 class="h3"><?php _e('Learn more', 'invoicing'); ?></h2>
832 832
 					<a class="btn btn-outline-primary btn-sm" href="https://docs.wpgetpaid.com/collection/114-getting-started?utm_source=setupwizard&utm_medium=product&utm_content=getting-started&utm_campaign=invoicingplugin"
833
-								target="_blank"><?php esc_html_e( 'Getting Started', 'invoicing' ); ?></a>
833
+								target="_blank"><?php esc_html_e('Getting Started', 'invoicing'); ?></a>
834 834
 						<a class="btn btn-outline-primary btn-sm"
835 835
 								href="https://docs.wpgetpaid.com/?utm_source=setupwizard&utm_medium=product&utm_content=docs&utm_campaign=invoicingplugin"
836
-								target="_blank"><?php esc_html_e( 'Documentation', 'invoicing' ); ?></a>
836
+								target="_blank"><?php esc_html_e('Documentation', 'invoicing'); ?></a>
837 837
 						<a class="btn btn-outline-primary btn-sm"
838 838
 								href="https://wpgetpaid.com/support/?utm_source=setupwizard&utm_medium=product&utm_content=docs&utm_campaign=invoicingyplugin"
839
-								target="_blank"><?php esc_html_e( 'Support', 'invoicing' ); ?></a>
839
+								target="_blank"><?php esc_html_e('Support', 'invoicing'); ?></a>
840 840
 								<a class="btn btn-outline-primary btn-sm"
841 841
 								href="https://demos.ayecode.io/getpaid/?utm_source=setupwizard&utm_medium=product&utm_content=demos&utm_campaign=invoicingyplugin"
842
-								target="_blank"><?php esc_html_e( 'Demos', 'invoicing' ); ?></a>
842
+								target="_blank"><?php esc_html_e('Demos', 'invoicing'); ?></a>
843 843
 				</div>
844 844
 			</div>
845 845
 		</div>
@@ -852,14 +852,14 @@  discard block
 block discarded – undo
852 852
 	 * @since 2.0.0
853 853
 	 */
854 854
 	private function setup_ready_actions() {
855
-		GeoDir_Admin_Notices::remove_notice( 'install' );
855
+		GeoDir_Admin_Notices::remove_notice('install');
856 856
 
857
-		if ( isset( $_GET['gd_tracker_optin'] ) && isset( $_GET['gd_tracker_nonce'] ) && wp_verify_nonce( $_GET['gd_tracker_nonce'], 'gd_tracker_optin' ) ) {
858
-			geodir_update_option( 'usage_tracking', true );
859
-			GeoDir_Admin_Tracker::send_tracking_data( true );
857
+		if (isset($_GET['gd_tracker_optin']) && isset($_GET['gd_tracker_nonce']) && wp_verify_nonce($_GET['gd_tracker_nonce'], 'gd_tracker_optin')) {
858
+			geodir_update_option('usage_tracking', true);
859
+			GeoDir_Admin_Tracker::send_tracking_data(true);
860 860
 
861
-		} elseif ( isset( $_GET['gd_tracker_optout'] ) && isset( $_GET['gd_tracker_nonce'] ) && wp_verify_nonce( $_GET['gd_tracker_nonce'], 'gd_tracker_optout' ) ) {
862
-			geodir_update_option( 'usage_tracking', false );
861
+		} elseif (isset($_GET['gd_tracker_optout']) && isset($_GET['gd_tracker_nonce']) && wp_verify_nonce($_GET['gd_tracker_nonce'], 'gd_tracker_optout')) {
862
+			geodir_update_option('usage_tracking', false);
863 863
 		}
864 864
 	}
865 865
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	<?php
154 154
 	if(isset($_REQUEST['step'])){
155 155
 	$this->setup_wizard_steps();
156
-	}else{
156
+	} else{
157 157
 	echo "<div class='mb-3'>&nbsp;</div>";
158 158
 	}
159 159
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		<p class="gd-return-to-dashboard-wrap"><a class="gd-return-to-dashboard btn btn-link d-block text-muted"
222 222
 		                                          href="<?php echo esc_url( admin_url() ); ?>"><?php esc_html_e( 'Return to the WordPress Dashboard', 'invoicing' ); ?></a>
223 223
 		</p>
224
-	<?php }else{ ?>
224
+	<?php } else{ ?>
225 225
 	<p class="gd-return-to-dashboard-wrap"><a href="<?php echo esc_url( $this->get_next_step_link() ); ?>"
226 226
 		                class="btn btn-link d-block text-muted"><?php esc_html_e( 'Skip this step', 'invoicing' ); ?></a></p>
227 227
 	<?php } ?>
@@ -475,12 +475,12 @@  discard block
 block discarded – undo
475 475
 									'label' => $label,
476 476
 									'label_type'    => 'floating'
477 477
 								));
478
-			}elseif($field['callback'] == 'wpinv_select_callback' || $field['callback'] == 'wpinv_country_states_callback'){
478
+			} elseif($field['callback'] == 'wpinv_select_callback' || $field['callback'] == 'wpinv_country_states_callback'){
479 479
 
480 480
 if($field['id']=='wpinv_settings[default_state]'){
481 481
 			$country_value  = wpinv_get_option( 'wpinv_settings[default_country]', 'US');
482 482
 $options = wpinv_get_country_states($country_value);//echo $value .'###'.$country_value;
483
-}else{
483
+} else{
484 484
 $options = isset($field['args']['options']) ? $field['args']['options'] : array();
485 485
 }
486 486
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 					'label_type'    => 'floating'
501 501
 //					'wrap_class'      => isset( $field->css_class ) ? $field->css_class : '',
502 502
 				) );
503
-			}elseif($field['callback'] == 'wpinv_textarea_callback'){
503
+			} elseif($field['callback'] == 'wpinv_textarea_callback'){
504 504
 				$textarea =  aui()->textarea( array(
505 505
 					'id'              => isset($field['args']['id']) ? esc_attr($field['args']['id']) : '',
506 506
 					'name'            => isset($field['id']) ? esc_attr($field['id']) : '',
Please login to merge, or discard this patch.
includes/admin/register-settings.php 1 patch
Spacing   +366 added lines, -366 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @since   1.0.0
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Retrieves all default settings.
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 function wpinv_get_settings() {
17 17
     $defaults = array();
18 18
 
19
-    foreach ( array_values( wpinv_get_registered_settings() ) as $tab_settings ) {
19
+    foreach (array_values(wpinv_get_registered_settings()) as $tab_settings) {
20 20
 
21
-        foreach ( array_values( $tab_settings ) as $section_settings ) {
21
+        foreach (array_values($tab_settings) as $section_settings) {
22 22
 
23
-            foreach ( $section_settings as $key => $setting ) {
24
-                if ( isset( $setting['std'] ) ) {
25
-                    $defaults[ $key ] = $setting['std'];
23
+            foreach ($section_settings as $key => $setting) {
24
+                if (isset($setting['std'])) {
25
+                    $defaults[$key] = $setting['std'];
26 26
                 }
27 27
             }
28 28
 
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
     global $wpinv_options;
44 44
 
45 45
     // Try fetching the saved options.
46
-    if ( empty( $wpinv_options ) ) {
47
-        $wpinv_options = get_option( 'wpinv_settings' );
46
+    if (empty($wpinv_options)) {
47
+        $wpinv_options = get_option('wpinv_settings');
48 48
     }
49 49
 
50 50
     // If that fails, don't fetch the default settings to prevent a loop.
51
-    if ( ! is_array( $wpinv_options ) ) {
51
+    if (!is_array($wpinv_options)) {
52 52
         $wpinv_options = array();
53 53
     }
54 54
 
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
  * @param mixed $default The default value to use if the setting has not been set.
63 63
  * @return mixed
64 64
  */
65
-function wpinv_get_option( $key = '', $default = false ) {
65
+function wpinv_get_option($key = '', $default = false) {
66 66
 
67 67
     $options = wpinv_get_options();
68
-    $value   = isset( $options[ $key ] ) ? $options[ $key ] : $default;
69
-    $value   = apply_filters( 'wpinv_get_option', $value, $key, $default );
68
+    $value   = isset($options[$key]) ? $options[$key] : $default;
69
+    $value   = apply_filters('wpinv_get_option', $value, $key, $default);
70 70
 
71
-    return apply_filters( 'wpinv_get_option_' . $key, $value, $key, $default );
71
+    return apply_filters('wpinv_get_option_' . $key, $value, $key, $default);
72 72
 }
73 73
 
74 74
 /**
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
  * @param array $options the new options.
78 78
  * @return bool
79 79
  */
80
-function wpinv_update_options( $options ) {
80
+function wpinv_update_options($options) {
81 81
     global $wpinv_options;
82 82
 
83 83
     // update the option.
84
-    if ( is_array( $options ) && update_option( 'wpinv_settings', $options ) ) {
84
+    if (is_array($options) && update_option('wpinv_settings', $options)) {
85 85
         $wpinv_options = $options;
86 86
         return true;
87 87
     }
@@ -96,24 +96,24 @@  discard block
 block discarded – undo
96 96
  * @param mixed $value The setting value.
97 97
  * @return bool
98 98
  */
99
-function wpinv_update_option( $key = '', $value = false ) {
99
+function wpinv_update_option($key = '', $value = false) {
100 100
 
101 101
     // If no key, exit.
102
-    if ( empty( $key ) ) {
102
+    if (empty($key)) {
103 103
         return false;
104 104
     }
105 105
 
106 106
     // Maybe delete the option instead.
107
-    if ( is_null( $value ) ) {
108
-        return wpinv_delete_option( $key );
107
+    if (is_null($value)) {
108
+        return wpinv_delete_option($key);
109 109
     }
110 110
 
111 111
     // Prepare the new options.
112 112
     $options         = wpinv_get_options();
113
-    $options[ $key ] = apply_filters( 'wpinv_update_option', $value, $key );
113
+    $options[$key] = apply_filters('wpinv_update_option', $value, $key);
114 114
 
115 115
     // Save the new options.
116
-    return wpinv_update_options( $options );
116
+    return wpinv_update_options($options);
117 117
 
118 118
 }
119 119
 
@@ -123,18 +123,18 @@  discard block
 block discarded – undo
123 123
  * @param string $key the setting key.
124 124
  * @return bool
125 125
  */
126
-function wpinv_delete_option( $key = '' ) {
126
+function wpinv_delete_option($key = '') {
127 127
 
128 128
     // If no key, exit
129
-    if ( empty( $key ) ) {
129
+    if (empty($key)) {
130 130
         return false;
131 131
     }
132 132
 
133 133
     $options = wpinv_get_options();
134 134
 
135
-    if ( isset( $options[ $key ] ) ) {
136
-        unset( $options[ $key ] );
137
-        return wpinv_update_options( $options );
135
+    if (isset($options[$key])) {
136
+        unset($options[$key]);
137
+        return wpinv_update_options($options);
138 138
     }
139 139
 
140 140
     return true;
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
 function wpinv_register_settings() {
149 149
 
150 150
     // Loop through all tabs.
151
-    foreach ( wpinv_get_registered_settings() as $tab => $sections ) {
151
+    foreach (wpinv_get_registered_settings() as $tab => $sections) {
152 152
 
153 153
         // In each tab, loop through sections.
154
-        foreach ( $sections as $section => $settings ) {
154
+        foreach ($sections as $section => $settings) {
155 155
 
156 156
             // Check for backwards compatibility
157
-            $section_tabs = wpinv_get_settings_tab_sections( $tab );
158
-            if ( ! is_array( $section_tabs ) || ! array_key_exists( $section, $section_tabs ) ) {
157
+            $section_tabs = wpinv_get_settings_tab_sections($tab);
158
+            if (!is_array($section_tabs) || !array_key_exists($section, $section_tabs)) {
159 159
                 $section = 'main';
160 160
                 $settings = $sections;
161 161
             }
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
                 'wpinv_settings_' . $tab . '_' . $section
169 169
             );
170 170
 
171
-            foreach ( $settings as $option ) {
172
-                if ( ! empty( $option['id'] ) ) {
173
-                    wpinv_register_settings_option( $tab, $section, $option );
171
+            foreach ($settings as $option) {
172
+                if (!empty($option['id'])) {
173
+                    wpinv_register_settings_option($tab, $section, $option);
174 174
                 }
175 175
             }
176 176
 
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
     }
179 179
 
180 180
     // Creates our settings in the options table.
181
-    register_setting( 'wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize' );
181
+    register_setting('wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize');
182 182
 }
183
-add_action( 'admin_init', 'wpinv_register_settings' );
183
+add_action('admin_init', 'wpinv_register_settings');
184 184
 
185 185
 /**
186 186
  * Register a single settings option.
@@ -190,48 +190,48 @@  discard block
 block discarded – undo
190 190
  * @param string $option
191 191
  * 
192 192
  */
193
-function wpinv_register_settings_option( $tab, $section, $option ) {
193
+function wpinv_register_settings_option($tab, $section, $option) {
194 194
 
195
-    $name    = isset( $option['name'] ) ? $option['name'] : '';
195
+    $name    = isset($option['name']) ? $option['name'] : '';
196 196
     $cb      = "wpinv_{$option['type']}_callback";
197 197
     $section = "wpinv_settings_{$tab}_$section";
198 198
 
199
-	if ( isset( $option['desc'] ) && ! empty( $option['help-tip'] ) ) {
200
-		$tip   = wpinv_clean( $option['desc'] );
199
+	if (isset($option['desc']) && !empty($option['help-tip'])) {
200
+		$tip   = wpinv_clean($option['desc']);
201 201
 		$name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>";
202
-		unset( $option['desc'] );
202
+		unset($option['desc']);
203 203
 	}
204 204
 
205 205
     // Loop through all tabs.
206 206
     add_settings_field(
207 207
         'wpinv_settings[' . $option['id'] . ']',
208 208
         $name,
209
-        function_exists( $cb ) ? $cb : 'wpinv_missing_callback',
209
+        function_exists($cb) ? $cb : 'wpinv_missing_callback',
210 210
         $section,
211 211
         $section,
212 212
         array(
213 213
             'section'     => $section,
214
-            'id'          => isset( $option['id'] )          ? $option['id']          : uniqid( 'wpinv-' ),
215
-            'desc'        => isset( $option['desc'] )        ? $option['desc']        : '',
214
+            'id'          => isset($option['id']) ? $option['id'] : uniqid('wpinv-'),
215
+            'desc'        => isset($option['desc']) ? $option['desc'] : '',
216 216
             'name'        => $name,
217
-            'size'        => isset( $option['size'] )        ? $option['size']        : null,
218
-            'options'     => isset( $option['options'] )     ? $option['options']     : '',
219
-            'selected'    => isset( $option['selected'] )    ? $option['selected']    : null,
220
-            'std'         => isset( $option['std'] )         ? $option['std']         : '',
221
-            'min'         => isset( $option['min'] )         ? $option['min']         : 0,
222
-            'max'         => isset( $option['max'] )         ? $option['max']         : 999999,
223
-            'step'        => isset( $option['step'] )        ? $option['step']        : 1,
224
-            'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : null,
225
-            'allow_blank' => isset( $option['allow_blank'] ) ? $option['allow_blank'] : true,
226
-            'readonly'    => isset( $option['readonly'] )    ? $option['readonly']    : false,
227
-            'faux'        => isset( $option['faux'] )        ? $option['faux']        : false,
228
-            'onchange'    => isset( $option['onchange'] )   ? $option['onchange']     : '',
229
-            'custom'      => isset( $option['custom'] )     ? $option['custom']       : '',
230
-			'default_content' => isset( $option['default_content'] )     ? $option['default_content']       : '',
231
-			'class'       => isset( $option['class'] )     ? $option['class']         : '',
232
-			'style'       => isset( $option['style'] )     ? $option['style']         : '',
233
-            'cols'        => isset( $option['cols'] ) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50,
234
-            'rows'        => isset( $option['rows'] ) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5,
217
+            'size'        => isset($option['size']) ? $option['size'] : null,
218
+            'options'     => isset($option['options']) ? $option['options'] : '',
219
+            'selected'    => isset($option['selected']) ? $option['selected'] : null,
220
+            'std'         => isset($option['std']) ? $option['std'] : '',
221
+            'min'         => isset($option['min']) ? $option['min'] : 0,
222
+            'max'         => isset($option['max']) ? $option['max'] : 999999,
223
+            'step'        => isset($option['step']) ? $option['step'] : 1,
224
+            'placeholder' => isset($option['placeholder']) ? $option['placeholder'] : null,
225
+            'allow_blank' => isset($option['allow_blank']) ? $option['allow_blank'] : true,
226
+            'readonly'    => isset($option['readonly']) ? $option['readonly'] : false,
227
+            'faux'        => isset($option['faux']) ? $option['faux'] : false,
228
+            'onchange'    => isset($option['onchange']) ? $option['onchange'] : '',
229
+            'custom'      => isset($option['custom']) ? $option['custom'] : '',
230
+			'default_content' => isset($option['default_content']) ? $option['default_content'] : '',
231
+			'class'       => isset($option['class']) ? $option['class'] : '',
232
+			'style'       => isset($option['style']) ? $option['style'] : '',
233
+            'cols'        => isset($option['cols']) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50,
234
+            'rows'        => isset($option['rows']) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5,
235 235
         )
236 236
     );
237 237
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
  * @return array
244 244
  */
245 245
 function wpinv_get_registered_settings() {
246
-	return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) );
246
+	return array_filter(apply_filters('wpinv_registered_settings', wpinv_get_data('admin-settings')));
247 247
 }
248 248
 
249 249
 /**
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
  * @return array
253 253
  */
254 254
 function getpaid_get_integration_settings() {
255
-    return apply_filters( 'getpaid_integration_settings', array() );
255
+    return apply_filters('getpaid_integration_settings', array());
256 256
 }
257 257
 
258 258
 /**
@@ -260,122 +260,122 @@  discard block
 block discarded – undo
260 260
  * 
261 261
  * @return array
262 262
  */
263
-function wpinv_settings_sanitize( $input = array() ) {
263
+function wpinv_settings_sanitize($input = array()) {
264 264
 
265 265
 	$wpinv_options = wpinv_get_options();
266 266
 	$raw_referrer  = wp_get_raw_referer();
267 267
 
268
-    if ( empty( $raw_referrer ) ) {
269
-		return array_merge( $wpinv_options, $input );
268
+    if (empty($raw_referrer)) {
269
+		return array_merge($wpinv_options, $input);
270 270
     }
271 271
 
272
-    wp_parse_str( $raw_referrer, $referrer );
272
+    wp_parse_str($raw_referrer, $referrer);
273 273
 
274 274
     $settings = wpinv_get_registered_settings();
275
-    $tab      = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general';
276
-    $section  = isset( $referrer['section'] ) ? $referrer['section'] : 'main';
275
+    $tab      = isset($referrer['tab']) ? $referrer['tab'] : 'general';
276
+    $section  = isset($referrer['section']) ? $referrer['section'] : 'main';
277 277
 
278 278
     $input = $input ? $input : array();
279
-    $input = apply_filters( 'wpinv_settings_tab_' . $tab . '_sanitize', $input );
280
-    $input = apply_filters( 'wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input );
279
+    $input = apply_filters('wpinv_settings_tab_' . $tab . '_sanitize', $input);
280
+    $input = apply_filters('wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input);
281 281
 
282 282
     // Loop through each setting being saved and pass it through a sanitization filter
283
-    foreach ( $input as $key => $value ) {
283
+    foreach ($input as $key => $value) {
284 284
 
285 285
         // Get the setting type (checkbox, select, etc)
286
-        $type = isset( $settings[ $tab ][$section][ $key ]['type'] ) ? $settings[ $tab ][$section][ $key ]['type'] : false;
286
+        $type = isset($settings[$tab][$section][$key]['type']) ? $settings[$tab][$section][$key]['type'] : false;
287 287
 
288
-        if ( $type ) {
288
+        if ($type) {
289 289
             // Field type specific filter
290
-            $input[$key] = apply_filters( "wpinv_settings_sanitize_$type", $value, $key );
290
+            $input[$key] = apply_filters("wpinv_settings_sanitize_$type", $value, $key);
291 291
         }
292 292
 
293 293
         // General filter
294
-		$input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
294
+		$input[$key] = apply_filters('wpinv_settings_sanitize', $input[$key], $key);
295 295
 
296 296
 		// Key specific filter.
297
-		$input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] );
297
+		$input[$key] = apply_filters("wpinv_settings_sanitize_$key", $input[$key]);
298 298
     }
299 299
 
300 300
     // Loop through the whitelist and unset any that are empty for the tab being saved
301
-    $main_settings    = isset( $settings[ $tab ] ) ? $settings[ $tab ] : array(); // Check for extensions that aren't using new sections
302
-    $section_settings = ! empty( $settings[ $tab ][ $section ] ) ? $settings[ $tab ][ $section ] : array();
301
+    $main_settings    = isset($settings[$tab]) ? $settings[$tab] : array(); // Check for extensions that aren't using new sections
302
+    $section_settings = !empty($settings[$tab][$section]) ? $settings[$tab][$section] : array();
303 303
 
304
-    $found_settings   = array_merge( $main_settings, $section_settings );
304
+    $found_settings   = array_merge($main_settings, $section_settings);
305 305
 
306
-    if ( ! empty( $found_settings ) ) {
307
-        foreach ( $found_settings as $key => $value ) {
306
+    if (!empty($found_settings)) {
307
+        foreach ($found_settings as $key => $value) {
308 308
 
309 309
             // settings used to have numeric keys, now they have keys that match the option ID. This ensures both methods work
310
-            if ( is_numeric( $key ) ) {
310
+            if (is_numeric($key)) {
311 311
                 $key = $value['id'];
312 312
             }
313 313
 
314
-            if ( ! isset( $input[ $key ] ) && isset( $wpinv_options[ $key ] ) ) {
315
-                unset( $wpinv_options[ $key ] );
314
+            if (!isset($input[$key]) && isset($wpinv_options[$key])) {
315
+                unset($wpinv_options[$key]);
316 316
             }
317 317
         }
318 318
     }
319 319
 
320 320
     // Merge our new settings with the existing
321
-    $output = array_merge( $wpinv_options, $input );
321
+    $output = array_merge($wpinv_options, $input);
322 322
 
323
-    add_settings_error( 'wpinv-notices', '', __( 'Settings updated.', 'invoicing' ), 'updated' );
323
+    add_settings_error('wpinv-notices', '', __('Settings updated.', 'invoicing'), 'updated');
324 324
 
325 325
     return $output;
326 326
 }
327
-add_filter( 'wpinv_settings_sanitize_text', 'trim', 10, 1 );
328
-add_filter( 'wpinv_settings_sanitize_tax_rate', 'wpinv_sanitize_amount' );
327
+add_filter('wpinv_settings_sanitize_text', 'trim', 10, 1);
328
+add_filter('wpinv_settings_sanitize_tax_rate', 'wpinv_sanitize_amount');
329 329
 
330
-function wpinv_settings_sanitize_tax_rates( $input ) {
331
-    if( ! wpinv_current_user_can_manage_invoicing() ) {
330
+function wpinv_settings_sanitize_tax_rates($input) {
331
+    if (!wpinv_current_user_can_manage_invoicing()) {
332 332
         return $input;
333 333
     }
334 334
 
335
-    $new_rates = ! empty( $_POST['tax_rates'] ) ? array_values( $_POST['tax_rates'] ) : array();
335
+    $new_rates = !empty($_POST['tax_rates']) ? array_values($_POST['tax_rates']) : array();
336 336
     $tax_rates = array();
337 337
 
338
-    foreach ( $new_rates as $rate ) {
338
+    foreach ($new_rates as $rate) {
339 339
 
340
-		$rate['rate']    = wpinv_sanitize_amount( $rate['rate'] );
341
-		$rate['name']    = sanitize_text_field( $rate['name'] );
342
-		$rate['state']   = sanitize_text_field( $rate['state'] );
343
-		$rate['country'] = sanitize_text_field( $rate['country'] );
344
-		$rate['global']  = empty( $rate['state'] );
340
+		$rate['rate']    = wpinv_sanitize_amount($rate['rate']);
341
+		$rate['name']    = sanitize_text_field($rate['name']);
342
+		$rate['state']   = sanitize_text_field($rate['state']);
343
+		$rate['country'] = sanitize_text_field($rate['country']);
344
+		$rate['global']  = empty($rate['state']);
345 345
 		$tax_rates[]     = $rate;
346 346
 
347 347
 	}
348 348
 
349
-    update_option( 'wpinv_tax_rates', $tax_rates );
349
+    update_option('wpinv_tax_rates', $tax_rates);
350 350
 
351 351
     return $input;
352 352
 }
353
-add_filter( 'wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates' );
353
+add_filter('wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates');
354 354
 
355 355
 function wpinv_get_settings_tabs() {
356 356
     $tabs             = array();
357
-    $tabs['general']  = __( 'General', 'invoicing' );
358
-    $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' );
359
-    $tabs['taxes']    = __( 'Taxes', 'invoicing' );
360
-	$tabs['emails']   = __( 'Emails', 'invoicing' );
357
+    $tabs['general']  = __('General', 'invoicing');
358
+    $tabs['gateways'] = __('Payment Gateways', 'invoicing');
359
+    $tabs['taxes']    = __('Taxes', 'invoicing');
360
+	$tabs['emails'] = __('Emails', 'invoicing');
361 361
 
362
-	if ( count( getpaid_get_integration_settings() ) > 0 ) {
363
-		$tabs['integrations'] = __( 'Integrations', 'invoicing' );
362
+	if (count(getpaid_get_integration_settings()) > 0) {
363
+		$tabs['integrations'] = __('Integrations', 'invoicing');
364 364
 	}
365 365
 
366
-    $tabs['privacy']  = __( 'Privacy', 'invoicing' );
367
-    $tabs['misc']     = __( 'Misc', 'invoicing' );
368
-    $tabs['tools']    = __( 'Tools', 'invoicing' );
366
+    $tabs['privacy']  = __('Privacy', 'invoicing');
367
+    $tabs['misc']     = __('Misc', 'invoicing');
368
+    $tabs['tools']    = __('Tools', 'invoicing');
369 369
 
370
-    return apply_filters( 'wpinv_settings_tabs', $tabs );
370
+    return apply_filters('wpinv_settings_tabs', $tabs);
371 371
 }
372 372
 
373
-function wpinv_get_settings_tab_sections( $tab = false ) {
373
+function wpinv_get_settings_tab_sections($tab = false) {
374 374
     $tabs     = false;
375 375
     $sections = wpinv_get_registered_settings_sections();
376 376
 
377
-    if( $tab && ! empty( $sections[ $tab ] ) ) {
378
-        $tabs = $sections[ $tab ];
377
+    if ($tab && !empty($sections[$tab])) {
378
+        $tabs = $sections[$tab];
379 379
     }
380 380
 
381 381
     return $tabs;
@@ -384,89 +384,89 @@  discard block
 block discarded – undo
384 384
 function wpinv_get_registered_settings_sections() {
385 385
     static $sections = false;
386 386
 
387
-    if ( false !== $sections ) {
387
+    if (false !== $sections) {
388 388
         return $sections;
389 389
     }
390 390
 
391 391
     $sections = array(
392
-        'general' => apply_filters( 'wpinv_settings_sections_general', array(
393
-            'main' => __( 'General Settings', 'invoicing' ),
394
-            'page_section' => __( 'Page Settings', 'invoicing' ),
395
-            'currency_section' => __( 'Currency Settings', 'invoicing' ),
396
-            'labels' => __( 'Label Texts', 'invoicing' ),
397
-        ) ),
398
-        'gateways' => apply_filters( 'wpinv_settings_sections_gateways', array(
399
-            'main' => __( 'Gateway Settings', 'invoicing' ),
400
-        ) ),
401
-        'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array(
402
-            'main'  => __( 'Tax Settings', 'invoicing' ),
403
-			'rates' => __( 'Tax Rates', 'invoicing' ),
404
-			'vat'   => __( 'EU VAT Settings', 'invoicing' )
405
-        ) ),
406
-        'emails' => apply_filters( 'wpinv_settings_sections_emails', array(
407
-            'main' => __( 'Email Settings', 'invoicing' ),
408
-		) ),
409
-
410
-		'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ),
411
-
412
-        'privacy' => apply_filters( 'wpinv_settings_sections_privacy', array(
413
-            'main' => __( 'Privacy policy', 'invoicing' ),
414
-        ) ),
415
-        'misc' => apply_filters( 'wpinv_settings_sections_misc', array(
416
-            'main' => __( 'Miscellaneous', 'invoicing' ),
417
-            'custom-css' => __( 'Custom CSS', 'invoicing' ),
418
-        ) ),
419
-        'tools' => apply_filters( 'wpinv_settings_sections_tools', array(
420
-            'main' => __( 'Diagnostic Tools', 'invoicing' ),
421
-        ) ),
392
+        'general' => apply_filters('wpinv_settings_sections_general', array(
393
+            'main' => __('General Settings', 'invoicing'),
394
+            'page_section' => __('Page Settings', 'invoicing'),
395
+            'currency_section' => __('Currency Settings', 'invoicing'),
396
+            'labels' => __('Label Texts', 'invoicing'),
397
+        )),
398
+        'gateways' => apply_filters('wpinv_settings_sections_gateways', array(
399
+            'main' => __('Gateway Settings', 'invoicing'),
400
+        )),
401
+        'taxes' => apply_filters('wpinv_settings_sections_taxes', array(
402
+            'main'  => __('Tax Settings', 'invoicing'),
403
+			'rates' => __('Tax Rates', 'invoicing'),
404
+			'vat'   => __('EU VAT Settings', 'invoicing')
405
+        )),
406
+        'emails' => apply_filters('wpinv_settings_sections_emails', array(
407
+            'main' => __('Email Settings', 'invoicing'),
408
+		)),
409
+
410
+		'integrations' => wp_list_pluck(getpaid_get_integration_settings(), 'label', 'id'),
411
+
412
+        'privacy' => apply_filters('wpinv_settings_sections_privacy', array(
413
+            'main' => __('Privacy policy', 'invoicing'),
414
+        )),
415
+        'misc' => apply_filters('wpinv_settings_sections_misc', array(
416
+            'main' => __('Miscellaneous', 'invoicing'),
417
+            'custom-css' => __('Custom CSS', 'invoicing'),
418
+        )),
419
+        'tools' => apply_filters('wpinv_settings_sections_tools', array(
420
+            'main' => __('Diagnostic Tools', 'invoicing'),
421
+        )),
422 422
     );
423 423
 
424
-    $sections = apply_filters( 'wpinv_settings_sections', $sections );
424
+    $sections = apply_filters('wpinv_settings_sections', $sections);
425 425
 
426 426
     return $sections;
427 427
 }
428 428
 
429
-function wpinv_get_pages( $with_slug = false, $default_label = NULL ) {
429
+function wpinv_get_pages($with_slug = false, $default_label = NULL) {
430 430
 	$pages_options = array();
431 431
 
432
-	if( $default_label !== NULL && $default_label !== false ) {
433
-		$pages_options = array( '' => $default_label ); // Blank option
432
+	if ($default_label !== NULL && $default_label !== false) {
433
+		$pages_options = array('' => $default_label); // Blank option
434 434
 	}
435 435
 
436 436
 	$pages = get_pages();
437
-	if ( $pages ) {
438
-		foreach ( $pages as $page ) {
437
+	if ($pages) {
438
+		foreach ($pages as $page) {
439 439
 			$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
440
-            $pages_options[ $page->ID ] = $title;
440
+            $pages_options[$page->ID] = $title;
441 441
 		}
442 442
 	}
443 443
 
444 444
 	return $pages_options;
445 445
 }
446 446
 
447
-function wpinv_header_callback( $args ) {
448
-	if ( !empty( $args['desc'] ) ) {
447
+function wpinv_header_callback($args) {
448
+	if (!empty($args['desc'])) {
449 449
         echo $args['desc'];
450 450
     }
451 451
 }
452 452
 
453
-function wpinv_hidden_callback( $args ) {
453
+function wpinv_hidden_callback($args) {
454 454
 
455
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
456
-	$value   = wpinv_get_option( $args['id'], $std );
455
+	$std     = isset($args['std']) ? $args['std'] : '';
456
+	$value   = wpinv_get_option($args['id'], $std);
457 457
 
458
-	if ( isset( $args['set_value'] ) ) {
458
+	if (isset($args['set_value'])) {
459 459
 		$value = $args['set_value'];
460 460
 	}
461 461
 
462
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
462
+	if (isset($args['faux']) && true === $args['faux']) {
463 463
 		$args['readonly'] = true;
464
-		$name  = '';
464
+		$name = '';
465 465
 	} else {
466
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
466
+		$name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"';
467 467
 	}
468 468
 
469
-	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
469
+	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key($args['id']) . ']" ' . $name . ' value="' . esc_attr(stripslashes($value)) . '" />';
470 470
     
471 471
 	echo $html;
472 472
 }
@@ -474,59 +474,59 @@  discard block
 block discarded – undo
474 474
 /**
475 475
  * Displays a checkbox settings callback.
476 476
  */
477
-function wpinv_checkbox_callback( $args ) {
477
+function wpinv_checkbox_callback($args) {
478 478
 
479
-	$std = isset( $args['std'] ) ? $args['std'] : '';
480
-	$std = wpinv_get_option( $args['id'], $std );
481
-	$id  = esc_attr( $args['id'] );
479
+	$std = isset($args['std']) ? $args['std'] : '';
480
+	$std = wpinv_get_option($args['id'], $std);
481
+	$id  = esc_attr($args['id']);
482 482
 
483
-	getpaid_hidden_field( "wpinv_settings[$id]", '0' );
483
+	getpaid_hidden_field("wpinv_settings[$id]", '0');
484 484
 	?>
485 485
 		<fieldset>
486 486
 			<label>
487
-				<input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked( empty( $std ), false ); ?> value="1" type="checkbox">
488
-				<?php echo wp_kses_post( $args['desc'] ); ?>
487
+				<input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked(empty($std), false); ?> value="1" type="checkbox">
488
+				<?php echo wp_kses_post($args['desc']); ?>
489 489
 			</label>
490 490
 		</fieldset>
491 491
 	<?php
492 492
 }
493 493
 
494
-function wpinv_multicheck_callback( $args ) {
494
+function wpinv_multicheck_callback($args) {
495 495
 
496
-	$sanitize_id = wpinv_sanitize_key( $args['id'] );
497
-	$class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
496
+	$sanitize_id = wpinv_sanitize_key($args['id']);
497
+	$class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : '';
498 498
 
499
-	if ( ! empty( $args['options'] ) ) {
499
+	if (!empty($args['options'])) {
500 500
 
501
-		$std     = isset( $args['std'] ) ? $args['std'] : array();
502
-		$value   = wpinv_get_option( $args['id'], $std );
501
+		$std     = isset($args['std']) ? $args['std'] : array();
502
+		$value   = wpinv_get_option($args['id'], $std);
503 503
 
504 504
 		echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
505
-        foreach( $args['options'] as $key => $option ):
506
-			$sanitize_key = wpinv_sanitize_key( $key );
507
-			if ( in_array( $sanitize_key, $value ) ) { 
505
+        foreach ($args['options'] as $key => $option):
506
+			$sanitize_key = wpinv_sanitize_key($key);
507
+			if (in_array($sanitize_key, $value)) { 
508 508
 				$enabled = $sanitize_key;
509 509
 			} else { 
510 510
 				$enabled = NULL; 
511 511
 			}
512
-			echo '<div class="wpi-mcheck-row"><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;';
513
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
512
+			echo '<div class="wpi-mcheck-row"><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;';
513
+			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post($option) . '</label></div>';
514 514
 		endforeach;
515 515
 		echo '</div>';
516 516
 		echo '<p class="description">' . $args['desc'] . '</p>';
517 517
 	}
518 518
 }
519 519
 
520
-function wpinv_payment_icons_callback( $args ) {
520
+function wpinv_payment_icons_callback($args) {
521 521
     
522
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
523
-	$value   = wpinv_get_option( $args['id'], false);
522
+    $sanitize_id = wpinv_sanitize_key($args['id']);
523
+	$value = wpinv_get_option($args['id'], false);
524 524
 
525
-	if ( ! empty( $args['options'] ) ) {
526
-		foreach( $args['options'] as $key => $option ) {
527
-            $sanitize_key = wpinv_sanitize_key( $key );
525
+	if (!empty($args['options'])) {
526
+		foreach ($args['options'] as $key => $option) {
527
+            $sanitize_key = wpinv_sanitize_key($key);
528 528
             
529
-			if( empty( $value ) ) {
529
+			if (empty($value)) {
530 530
 				$enabled = $option;
531 531
 			} else {
532 532
 				$enabled = NULL;
@@ -534,67 +534,67 @@  discard block
 block discarded – undo
534 534
 
535 535
 			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
536 536
 
537
-				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;';
537
+				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;';
538 538
 
539
-				if ( wpinv_string_is_image_url( $key ) ) {
540
-					echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
539
+				if (wpinv_string_is_image_url($key)) {
540
+					echo '<img class="payment-icon" src="' . esc_url($key) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
541 541
 				} else {
542
-					$card = strtolower( str_replace( ' ', '', $option ) );
542
+					$card = strtolower(str_replace(' ', '', $option));
543 543
 
544
-					if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
545
-						$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
544
+					if (has_filter('wpinv_accepted_payment_' . $card . '_image')) {
545
+						$image = apply_filters('wpinv_accepted_payment_' . $card . '_image', '');
546 546
 					} else {
547
-						$image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
547
+						$image       = wpinv_locate_template('images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false);
548 548
 						$content_dir = WP_CONTENT_DIR;
549 549
 
550
-						if ( function_exists( 'wp_normalize_path' ) ) {
550
+						if (function_exists('wp_normalize_path')) {
551 551
 							// Replaces backslashes with forward slashes for Windows systems
552
-							$image = wp_normalize_path( $image );
553
-							$content_dir = wp_normalize_path( $content_dir );
552
+							$image = wp_normalize_path($image);
553
+							$content_dir = wp_normalize_path($content_dir);
554 554
 						}
555 555
 
556
-						$image = str_replace( $content_dir, content_url(), $image );
556
+						$image = str_replace($content_dir, content_url(), $image);
557 557
 					}
558 558
 
559
-					echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
559
+					echo '<img class="payment-icon" src="' . esc_url($image) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
560 560
 				}
561 561
 			echo $option . '</label>';
562 562
 		}
563
-		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
563
+		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post($args['desc']) . '</p>';
564 564
 	}
565 565
 }
566 566
 
567 567
 /**
568 568
  * Displays a radio settings field.
569 569
  */
570
-function wpinv_radio_callback( $args ) {
570
+function wpinv_radio_callback($args) {
571 571
 
572
-	$std = isset( $args['std'] ) ? $args['std'] : '';
573
-	$std = wpinv_get_option( $args['id'], $std );
572
+	$std = isset($args['std']) ? $args['std'] : '';
573
+	$std = wpinv_get_option($args['id'], $std);
574 574
 	?>
575 575
 		<fieldset>
576
-			<ul id="wpinv-settings-<?php echo esc_attr( $args['id'] ); ?>" style="margin-top: 0;">
577
-				<?php foreach( $args['options'] as $key => $option ) : ?>
576
+			<ul id="wpinv-settings-<?php echo esc_attr($args['id']); ?>" style="margin-top: 0;">
577
+				<?php foreach ($args['options'] as $key => $option) : ?>
578 578
 					<li>
579 579
 						<label>
580
-							<input name="wpinv_settings[<?php echo esc_attr( $args['id'] ); ?>]" <?php checked( $std, $key ); ?> value="<?php echo esc_attr( $key ); ?>" type="radio">
581
-							<?php echo wp_kses_post( $option ); ?>
580
+							<input name="wpinv_settings[<?php echo esc_attr($args['id']); ?>]" <?php checked($std, $key); ?> value="<?php echo esc_attr($key); ?>" type="radio">
581
+							<?php echo wp_kses_post($option); ?>
582 582
 						</label>
583 583
 					</li>
584 584
 				<?php endforeach; ?>
585 585
 			</ul>
586 586
 		</fieldset>
587 587
 	<?php
588
-	getpaid_settings_description_callback( $args );
588
+	getpaid_settings_description_callback($args);
589 589
 }
590 590
 
591 591
 /**
592 592
  * Displays a description if available.
593 593
  */
594
-function getpaid_settings_description_callback( $args ) {
594
+function getpaid_settings_description_callback($args) {
595 595
 
596
-	if ( ! empty( $args['desc'] ) ) {
597
-		$description = wp_kses_post( $args['desc'] );
596
+	if (!empty($args['desc'])) {
597
+		$description = wp_kses_post($args['desc']);
598 598
 		echo "<p class='description'>$description</p>";
599 599
 	}
600 600
 
@@ -610,31 +610,31 @@  discard block
 block discarded – undo
610 610
 	</tr>
611 611
 	<tr class="bsui">
612 612
     	<td colspan="2" class="p-0">
613
-			<?php include plugin_dir_path( __FILE__ ) . 'views/html-gateways-edit.php'; ?>
613
+			<?php include plugin_dir_path(__FILE__) . 'views/html-gateways-edit.php'; ?>
614 614
 
615 615
 	<?php
616 616
 }
617 617
 
618 618
 function wpinv_gateway_select_callback($args) {
619 619
     
620
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
621
-    $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
622
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
623
-	$value   = wpinv_get_option( $args['id'], $std );
620
+    $sanitize_id = wpinv_sanitize_key($args['id']);
621
+    $class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : '';
622
+	$std     = isset($args['std']) ? $args['std'] : '';
623
+	$value   = wpinv_get_option($args['id'], $std);
624 624
 
625
-	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >';
625
+	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="' . $class . '" >';
626 626
 
627
-	foreach ( $args['options'] as $key => $option ) :
628
-		if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
629
-            $selected = selected( $key, $args['selected'], false );
627
+	foreach ($args['options'] as $key => $option) :
628
+		if (isset($args['selected']) && $args['selected'] !== null && $args['selected'] !== false) {
629
+            $selected = selected($key, $args['selected'], false);
630 630
         } else {
631
-            $selected = selected( $key, $value, false );
631
+            $selected = selected($key, $value, false);
632 632
         }
633
-		echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
633
+		echo '<option value="' . wpinv_sanitize_key($key) . '"' . $selected . '>' . esc_html($option['admin_label']) . '</option>';
634 634
 	endforeach;
635 635
 
636 636
 	echo '</select>';
637
-	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
637
+	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
638 638
 }
639 639
 
640 640
 /**
@@ -643,28 +643,28 @@  discard block
 block discarded – undo
643 643
  * @param array $args
644 644
  * @return string
645 645
  */
646
-function wpinv_settings_attrs_helper( $args ) {
646
+function wpinv_settings_attrs_helper($args) {
647 647
 
648
-	$value        = isset( $args['std'] ) ? $args['std'] : '';
649
-	$id           = esc_attr( $args['id'] );
650
-	$placeholder  = esc_attr( $args['placeholder'] );
648
+	$value        = isset($args['std']) ? $args['std'] : '';
649
+	$id           = esc_attr($args['id']);
650
+	$placeholder  = esc_attr($args['placeholder']);
651 651
 
652
-	if ( ! empty( $args['faux'] ) ) {
652
+	if (!empty($args['faux'])) {
653 653
 		$args['readonly'] = true;
654 654
 		$name             = '';
655 655
 	} else {
656
-		$value  = wpinv_get_option( $args['id'], $value );
656
+		$value  = wpinv_get_option($args['id'], $value);
657 657
 		$name   = "wpinv_settings[$id]";
658 658
 	}
659 659
 
660
-	$value    = is_scalar( $value ) ? esc_attr( $value ) : '';
661
-	$class    = esc_attr( $args['class'] );
662
-	$style    = esc_attr( $args['style'] );
663
-	$readonly = empty( $args['readonly'] ) ? '' : 'readonly onclick="this.select()"';
660
+	$value    = is_scalar($value) ? esc_attr($value) : '';
661
+	$class    = esc_attr($args['class']);
662
+	$style    = esc_attr($args['style']);
663
+	$readonly = empty($args['readonly']) ? '' : 'readonly onclick="this.select()"';
664 664
 
665 665
 	$onchange = '';
666
-    if ( ! empty( $args['onchange'] ) ) {
667
-        $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"';
666
+    if (!empty($args['onchange'])) {
667
+        $onchange = ' onchange="' . esc_attr($args['onchange']) . '"';
668 668
 	}
669 669
 
670 670
 	return "name='$name' id='wpinv-settings-$id' style='$style' value='$value' class='$class' placeholder='$placeholder' data-placeholder='$placeholder' $onchange $readonly";
@@ -673,11 +673,11 @@  discard block
 block discarded – undo
673 673
 /**
674 674
  * Displays a text input settings callback.
675 675
  */
676
-function wpinv_text_callback( $args ) {
676
+function wpinv_text_callback($args) {
677 677
 
678
-	$desc = wp_kses_post( $args['desc'] );
679
-	$desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
680
-	$attr = wpinv_settings_attrs_helper( $args );
678
+	$desc = wp_kses_post($args['desc']);
679
+	$desc = empty($desc) ? '' : "<p class='description'>$desc</p>";
680
+	$attr = wpinv_settings_attrs_helper($args);
681 681
 
682 682
 	?>
683 683
 		<label style="width: 100%;">
@@ -691,14 +691,14 @@  discard block
 block discarded – undo
691 691
 /**
692 692
  * Displays a number input settings callback.
693 693
  */
694
-function wpinv_number_callback( $args ) {
694
+function wpinv_number_callback($args) {
695 695
 
696
-	$desc = wp_kses_post( $args['desc'] );
697
-	$desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
698
-	$attr = wpinv_settings_attrs_helper( $args );
699
-	$max  = intval( $args['max'] );
700
-	$min  = intval( $args['min'] );
701
-	$step = floatval( $args['step'] );
696
+	$desc = wp_kses_post($args['desc']);
697
+	$desc = empty($desc) ? '' : "<p class='description'>$desc</p>";
698
+	$attr = wpinv_settings_attrs_helper($args);
699
+	$max  = intval($args['max']);
700
+	$min  = intval($args['min']);
701
+	$step = floatval($args['step']);
702 702
 
703 703
 	?>
704 704
 		<label style="width: 100%;">
@@ -709,37 +709,37 @@  discard block
 block discarded – undo
709 709
 
710 710
 }
711 711
 
712
-function wpinv_textarea_callback( $args ) {
712
+function wpinv_textarea_callback($args) {
713 713
     
714
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
715
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
716
-	$value   = wpinv_get_option( $args['id'], $std );
714
+    $sanitize_id = wpinv_sanitize_key($args['id']);
715
+	$std     = isset($args['std']) ? $args['std'] : '';
716
+	$value   = wpinv_get_option($args['id'], $std);
717 717
 
718
-    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
719
-    $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text';
718
+    $size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
719
+    $class = (isset($args['class']) && !is_null($args['class'])) ? $args['class'] : 'large-text';
720 720
 
721
-	$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>';
722
-	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
721
+	$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>';
722
+	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
723 723
 
724 724
 	echo $html;
725 725
 }
726 726
 
727
-function wpinv_password_callback( $args ) {
727
+function wpinv_password_callback($args) {
728 728
     
729
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
730
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
731
-	$value   = wpinv_get_option( $args['id'], $std );
729
+    $sanitize_id = wpinv_sanitize_key($args['id']);
730
+	$std     = isset($args['std']) ? $args['std'] : '';
731
+	$value   = wpinv_get_option($args['id'], $std);
732 732
 
733
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
734
-	$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 ) . '"/>';
735
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
733
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
734
+	$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) . '"/>';
735
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
736 736
 
737 737
 	echo $html;
738 738
 }
739 739
 
740 740
 function wpinv_missing_callback($args) {
741 741
 	printf(
742
-		__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
742
+		__('The callback function used for the %s setting is missing.', 'invoicing'),
743 743
 		'<strong>' . $args['id'] . '</strong>'
744 744
 	);
745 745
 }
@@ -747,35 +747,35 @@  discard block
 block discarded – undo
747 747
 /**
748 748
  * Displays a number input settings callback.
749 749
  */
750
-function wpinv_select_callback( $args ) {
750
+function wpinv_select_callback($args) {
751 751
 
752
-	$desc   = wp_kses_post( $args['desc'] );
753
-	$desc   = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
754
-	$attr   = wpinv_settings_attrs_helper( $args );
755
-	$value  = isset( $args['std'] ) ? $args['std'] : '';
756
-	$value  = wpinv_get_option( $args['id'], $value );
757
-	$rand   = uniqid( 'random_id' );
752
+	$desc   = wp_kses_post($args['desc']);
753
+	$desc   = empty($desc) ? '' : "<p class='description'>$desc</p>";
754
+	$attr   = wpinv_settings_attrs_helper($args);
755
+	$value  = isset($args['std']) ? $args['std'] : '';
756
+	$value  = wpinv_get_option($args['id'], $value);
757
+	$rand   = uniqid('random_id');
758 758
 
759 759
 	?>
760 760
 		<label style="width: 100%;">
761 761
 			<select <?php echo $attr; ?>>
762
-				<?php foreach ( $args['options'] as $option => $name ) : ?>
763
-					<option value="<?php echo esc_attr( $option ); ?>" <?php echo selected( $option, $value ); ?>><?php echo wpinv_clean( $name ); ?></option>
764
-				<?php endforeach;?>
762
+				<?php foreach ($args['options'] as $option => $name) : ?>
763
+					<option value="<?php echo esc_attr($option); ?>" <?php echo selected($option, $value); ?>><?php echo wpinv_clean($name); ?></option>
764
+				<?php endforeach; ?>
765 765
 			</select>
766 766
 
767
-			<?php if ( substr( $args['id'], -5 ) === '_page' && is_numeric( $value ) ) : ?>
768
-				<a href="<?php echo get_edit_post_link( $value ); ?>" target="_blank" class="button getpaid-page-setting-edit"><?php _e( 'Edit Page', 'invoicing' ) ?></a>
767
+			<?php if (substr($args['id'], -5) === '_page' && is_numeric($value)) : ?>
768
+				<a href="<?php echo get_edit_post_link($value); ?>" target="_blank" class="button getpaid-page-setting-edit"><?php _e('Edit Page', 'invoicing') ?></a>
769 769
 			<?php endif; ?>
770 770
 
771
-			<?php if ( substr( $args['id'], -5 ) === '_page' && ! empty( $args['default_content'] ) ) : ?>
772
-				&nbsp;<a href="#TB_inline?&width=400&height=550&inlineId=<?php echo $rand; ?>" class="button thickbox getpaid-page-setting-view-default"><?php _e( 'View Default Content', 'invoicing' ) ?></a>
771
+			<?php if (substr($args['id'], -5) === '_page' && !empty($args['default_content'])) : ?>
772
+				&nbsp;<a href="#TB_inline?&width=400&height=550&inlineId=<?php echo $rand; ?>" class="button thickbox getpaid-page-setting-view-default"><?php _e('View Default Content', 'invoicing') ?></a>
773 773
 				<div id='<?php echo $rand; ?>' style='display:none;'>
774 774
 					<div>
775
-						<h3><?php _e( 'Original Content', 'invoicing' ) ?></h3>
776
-						<textarea readonly onclick="this.select()" rows="8" style="width: 100%;"><?php echo gepaid_trim_lines( wp_kses_post( $args['default_content'] ) ); ?></textarea>
777
-						<h3><?php _e( 'Current Content', 'invoicing' ) ?></h3>
778
-						<textarea readonly onclick="this.select()" rows="8" style="width: 100%;"><?php $_post = get_post( $value ); echo empty( $_post ) ? '' : gepaid_trim_lines( wp_kses_post( $_post->post_content ) ); ?></textarea>
775
+						<h3><?php _e('Original Content', 'invoicing') ?></h3>
776
+						<textarea readonly onclick="this.select()" rows="8" style="width: 100%;"><?php echo gepaid_trim_lines(wp_kses_post($args['default_content'])); ?></textarea>
777
+						<h3><?php _e('Current Content', 'invoicing') ?></h3>
778
+						<textarea readonly onclick="this.select()" rows="8" style="width: 100%;"><?php $_post = get_post($value); echo empty($_post) ? '' : gepaid_trim_lines(wp_kses_post($_post->post_content)); ?></textarea>
779 779
 					</div>
780 780
 				</div>
781 781
 			<?php endif; ?>
@@ -786,88 +786,88 @@  discard block
 block discarded – undo
786 786
 
787 787
 }
788 788
 
789
-function wpinv_color_select_callback( $args ) {
789
+function wpinv_color_select_callback($args) {
790 790
     
791
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
792
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
793
-	$value   = wpinv_get_option( $args['id'], $std );
791
+    $sanitize_id = wpinv_sanitize_key($args['id']);
792
+	$std     = isset($args['std']) ? $args['std'] : '';
793
+	$value   = wpinv_get_option($args['id'], $std);
794 794
 
795
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
795
+	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']"/>';
796 796
 
797
-	foreach ( $args['options'] as $option => $color ) {
798
-		$selected = selected( $option, $value, false );
799
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
797
+	foreach ($args['options'] as $option => $color) {
798
+		$selected = selected($option, $value, false);
799
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($color['label']) . '</option>';
800 800
 	}
801 801
 
802 802
 	$html .= '</select>';
803
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
803
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
804 804
 
805 805
 	echo $html;
806 806
 }
807 807
 
808
-function wpinv_rich_editor_callback( $args ) {
808
+function wpinv_rich_editor_callback($args) {
809 809
 	global $wp_version;
810 810
     
811
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
811
+    $sanitize_id = wpinv_sanitize_key($args['id']);
812 812
 
813
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
814
-	$value   = wpinv_get_option( $args['id'], $std );
813
+	$std     = isset($args['std']) ? $args['std'] : '';
814
+	$value   = wpinv_get_option($args['id'], $std);
815 815
 	
816
-	if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) {
816
+	if (!empty($args['allow_blank']) && empty($value)) {
817 817
 		$value = $std;
818 818
 	}
819 819
 
820
-	$rows = isset( $args['size'] ) ? $args['size'] : 20;
820
+	$rows = isset($args['size']) ? $args['size'] : 20;
821 821
 
822 822
 	$html = '<div class="getpaid-settings-editor-input">';
823
-	if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
823
+	if ($wp_version >= 3.3 && function_exists('wp_editor')) {
824 824
 		ob_start();
825
-		wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) );
825
+		wp_editor(stripslashes($value), 'wpinv_settings_' . esc_attr($args['id']), array('textarea_name' => 'wpinv_settings[' . esc_attr($args['id']) . ']', 'textarea_rows' => absint($rows), 'media_buttons' => false));
826 826
 		$html .= ob_get_clean();
827 827
 	} else {
828
-		$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>';
828
+		$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>';
829 829
 	}
830 830
 
831
-	$html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
831
+	$html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
832 832
 
833 833
 	echo $html;
834 834
 }
835 835
 
836
-function wpinv_upload_callback( $args ) {
836
+function wpinv_upload_callback($args) {
837 837
     
838
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
838
+    $sanitize_id = wpinv_sanitize_key($args['id']);
839 839
 
840
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
841
-	$value   = wpinv_get_option( $args['id'], $std );
840
+	$std     = isset($args['std']) ? $args['std'] : '';
841
+	$value   = wpinv_get_option($args['id'], $std);
842 842
 
843
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
844
-	$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 ) ) . '"/>';
845
-	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
846
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
843
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
844
+	$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)) . '"/>';
845
+	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __('Upload File', 'invoicing') . '"/></span>';
846
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
847 847
 
848 848
 	echo $html;
849 849
 }
850 850
 
851
-function wpinv_color_callback( $args ) {
851
+function wpinv_color_callback($args) {
852 852
 
853
-	$std         = isset( $args['std'] ) ? $args['std'] : '';
854
-	$value       = wpinv_get_option( $args['id'], $std );
855
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
853
+	$std         = isset($args['std']) ? $args['std'] : '';
854
+	$value       = wpinv_get_option($args['id'], $std);
855
+    $sanitize_id = wpinv_sanitize_key($args['id']);
856 856
 
857
-	$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( $std ) . '" />';
858
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
857
+	$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($std) . '" />';
858
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
859 859
 
860 860
 	echo $html;
861 861
 }
862 862
 
863 863
 function wpinv_country_states_callback($args) {
864 864
 
865
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
866
-	$value   = wpinv_get_option( $args['id'], $std );
865
+	$std     = isset($args['std']) ? $args['std'] : '';
866
+	$value   = wpinv_get_option($args['id'], $std);
867 867
 
868
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
868
+    $sanitize_id = wpinv_sanitize_key($args['id']);
869 869
 
870
-	if ( isset( $args['placeholder'] ) ) {
870
+	if (isset($args['placeholder'])) {
871 871
 		$placeholder = $args['placeholder'];
872 872
 	} else {
873 873
 		$placeholder = '';
@@ -875,16 +875,16 @@  discard block
 block discarded – undo
875 875
 
876 876
 	$states = wpinv_get_country_states();
877 877
 
878
-	$class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
879
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
878
+	$class = empty($states) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
879
+	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']"' . $class . 'data-placeholder="' . esc_html($placeholder) . '"/>';
880 880
 
881
-	foreach ( $states as $option => $name ) {
882
-		$selected = selected( $option, $value, false );
883
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
881
+	foreach ($states as $option => $name) {
882
+		$selected = selected($option, $value, false);
883
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($name) . '</option>';
884 884
 	}
885 885
 
886 886
 	$html .= '</select>';
887
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
887
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
888 888
 
889 889
 	echo $html;
890 890
 }
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 	</tr>
900 900
 	<tr class="bsui">
901 901
     	<td colspan="2" class="p-0">
902
-			<?php include plugin_dir_path( __FILE__ ) . 'views/html-tax-rates-edit.php'; ?>
902
+			<?php include plugin_dir_path(__FILE__) . 'views/html-tax-rates-edit.php'; ?>
903 903
 
904 904
 	<?php
905 905
 
@@ -908,14 +908,14 @@  discard block
 block discarded – undo
908 908
 /**
909 909
  * Displays a tax rate' edit row.
910 910
  */
911
-function wpinv_tax_rate_callback( $tax_rate, $key, $echo = true ) {
911
+function wpinv_tax_rate_callback($tax_rate, $key, $echo = true) {
912 912
 	ob_start();
913 913
 
914
-	$key                      = sanitize_key( $key );
915
-	$tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate'];
916
-	include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php';
914
+	$key                      = sanitize_key($key);
915
+	$tax_rate['reduced_rate'] = empty($tax_rate['reduced_rate']) ? 0 : $tax_rate['reduced_rate'];
916
+	include plugin_dir_path(__FILE__) . 'views/html-tax-rate-edit.php';
917 917
 
918
-	if ( $echo ) {
918
+	if ($echo) {
919 919
 		echo ob_get_clean();
920 920
 	} else {
921 921
 		return ob_get_clean(); 
@@ -928,124 +928,124 @@  discard block
 block discarded – undo
928 928
     ob_start(); ?>
929 929
     </td><tr>
930 930
     <td colspan="2" class="wpinv_tools_tdbox">
931
-    <?php if ( $args['desc'] ) { ?><p><?php echo $args['desc']; ?></p><?php } ?>
932
-    <?php do_action( 'wpinv_tools_before' ); ?>
931
+    <?php if ($args['desc']) { ?><p><?php echo $args['desc']; ?></p><?php } ?>
932
+    <?php do_action('wpinv_tools_before'); ?>
933 933
     <table id="wpinv_tools_table" class="wp-list-table widefat fixed posts">
934 934
         <thead>
935 935
             <tr>
936
-                <th scope="col" class="wpinv-th-tool"><?php _e( 'Tool', 'invoicing' ); ?></th>
937
-                <th scope="col" class="wpinv-th-desc"><?php _e( 'Description', 'invoicing' ); ?></th>
938
-                <th scope="col" class="wpinv-th-action"><?php _e( 'Action', 'invoicing' ); ?></th>
936
+                <th scope="col" class="wpinv-th-tool"><?php _e('Tool', 'invoicing'); ?></th>
937
+                <th scope="col" class="wpinv-th-desc"><?php _e('Description', 'invoicing'); ?></th>
938
+                <th scope="col" class="wpinv-th-action"><?php _e('Action', 'invoicing'); ?></th>
939 939
             </tr>
940 940
         </thead>
941 941
 
942 942
         <tbody>
943 943
 			<tr>
944
-                <td><?php _e( 'Check Pages', 'invoicing' );?></td>
944
+                <td><?php _e('Check Pages', 'invoicing'); ?></td>
945 945
                 <td>
946
-                    <small><?php _e( 'Creates any missing GetPaid pages.', 'invoicing' ); ?></small>
946
+                    <small><?php _e('Creates any missing GetPaid pages.', 'invoicing'); ?></small>
947 947
                 </td>
948 948
                 <td>
949 949
 					<a href="<?php
950 950
 						echo esc_url(
951 951
 							wp_nonce_url(
952
-								add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ),
952
+								add_query_arg('getpaid-admin-action', 'create_missing_pages'),
953 953
 								'getpaid-nonce',
954 954
 								'getpaid-nonce'
955 955
 							)
956 956
 						);
957
-					?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
957
+					?>" class="button button-primary"><?php _e('Run', 'invoicing'); ?></a>
958 958
                 </td>
959 959
             </tr>
960 960
 			<tr>
961
-                <td><?php _e( 'Create Database Tables', 'invoicing' );?></td>
961
+                <td><?php _e('Create Database Tables', 'invoicing'); ?></td>
962 962
                 <td>
963
-                    <small><?php _e( 'Run this tool to create any missing database tables.', 'invoicing' ); ?></small>
963
+                    <small><?php _e('Run this tool to create any missing database tables.', 'invoicing'); ?></small>
964 964
                 </td>
965 965
                 <td>
966 966
 					<a href="<?php
967 967
 						echo esc_url(
968 968
 							wp_nonce_url(
969
-								add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ),
969
+								add_query_arg('getpaid-admin-action', 'create_missing_tables'),
970 970
 								'getpaid-nonce',
971 971
 								'getpaid-nonce'
972 972
 							)
973 973
 						);
974
-					?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
974
+					?>" class="button button-primary"><?php _e('Run', 'invoicing'); ?></a>
975 975
                 </td>
976 976
             </tr>
977 977
 			<tr>
978
-                <td><?php _e( 'Migrate old invoices', 'invoicing' );?></td>
978
+                <td><?php _e('Migrate old invoices', 'invoicing'); ?></td>
979 979
                 <td>
980
-                    <small><?php _e( 'If your old invoices were not migrated after updating from Invoicing to GetPaid, you can use this tool to migrate them.', 'invoicing' ); ?></small>
980
+                    <small><?php _e('If your old invoices were not migrated after updating from Invoicing to GetPaid, you can use this tool to migrate them.', 'invoicing'); ?></small>
981 981
                 </td>
982 982
                 <td>
983 983
 					<a href="<?php
984 984
 						echo esc_url(
985 985
 							wp_nonce_url(
986
-								add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ),
986
+								add_query_arg('getpaid-admin-action', 'migrate_old_invoices'),
987 987
 								'getpaid-nonce',
988 988
 								'getpaid-nonce'
989 989
 							)
990 990
 						);
991
-					?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
991
+					?>" class="button button-primary"><?php _e('Run', 'invoicing'); ?></a>
992 992
                 </td>
993 993
             </tr>
994 994
 
995 995
 			<tr>
996
-                <td><?php _e( 'Recalculate Discounts', 'invoicing' );?></td>
996
+                <td><?php _e('Recalculate Discounts', 'invoicing'); ?></td>
997 997
                 <td>
998
-                    <small><?php _e( 'Recalculate discounts for existing invoices that have discount codes but are not discounted.', 'invoicing' ); ?></small>
998
+                    <small><?php _e('Recalculate discounts for existing invoices that have discount codes but are not discounted.', 'invoicing'); ?></small>
999 999
                 </td>
1000 1000
                 <td>
1001 1001
 					<a href="<?php
1002 1002
 						echo esc_url(
1003 1003
 							wp_nonce_url(
1004
-								add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ),
1004
+								add_query_arg('getpaid-admin-action', 'recalculate_discounts'),
1005 1005
 								'getpaid-nonce',
1006 1006
 								'getpaid-nonce'
1007 1007
 							)
1008 1008
 						);
1009
-					?>" class="button button-primary"><?php _e( 'Run', 'invoicing' );?></a>
1009
+					?>" class="button button-primary"><?php _e('Run', 'invoicing'); ?></a>
1010 1010
                 </td>
1011 1011
             </tr>
1012 1012
 
1013
-			<?php do_action( 'wpinv_tools_row' ); ?>
1013
+			<?php do_action('wpinv_tools_row'); ?>
1014 1014
         </tbody>
1015 1015
     </table>
1016
-    <?php do_action( 'wpinv_tools_after' ); ?>
1016
+    <?php do_action('wpinv_tools_after'); ?>
1017 1017
     <?php
1018 1018
     echo ob_get_clean();
1019 1019
 }
1020 1020
 
1021 1021
 
1022
-function wpinv_descriptive_text_callback( $args ) {
1023
-	echo wp_kses_post( $args['desc'] );
1022
+function wpinv_descriptive_text_callback($args) {
1023
+	echo wp_kses_post($args['desc']);
1024 1024
 }
1025 1025
 
1026
-function wpinv_raw_html_callback( $args ) {
1026
+function wpinv_raw_html_callback($args) {
1027 1027
 	echo $args['desc'];
1028 1028
 }
1029 1029
 
1030
-function wpinv_hook_callback( $args ) {
1031
-	do_action( 'wpinv_' . $args['id'], $args );
1030
+function wpinv_hook_callback($args) {
1031
+	do_action('wpinv_' . $args['id'], $args);
1032 1032
 }
1033 1033
 
1034 1034
 function wpinv_set_settings_cap() {
1035 1035
 	return wpinv_get_capability();
1036 1036
 }
1037
-add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' );
1037
+add_filter('option_page_capability_wpinv_settings', 'wpinv_set_settings_cap');
1038 1038
 
1039 1039
 
1040
-function wpinv_on_update_settings( $old_value, $value, $option ) {
1041
-    $old = !empty( $old_value['remove_data_on_unistall'] ) ? 1 : '';
1042
-    $new = !empty( $value['remove_data_on_unistall'] ) ? 1 : '';
1040
+function wpinv_on_update_settings($old_value, $value, $option) {
1041
+    $old = !empty($old_value['remove_data_on_unistall']) ? 1 : '';
1042
+    $new = !empty($value['remove_data_on_unistall']) ? 1 : '';
1043 1043
     
1044
-    if ( $old != $new ) {
1045
-        update_option( 'wpinv_remove_data_on_invoice_unistall', $new );
1044
+    if ($old != $new) {
1045
+        update_option('wpinv_remove_data_on_invoice_unistall', $new);
1046 1046
     }
1047 1047
 }
1048
-add_action( 'update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3 );
1048
+add_action('update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3);
1049 1049
 
1050 1050
 /**
1051 1051
  * Returns the merge tags help text.
@@ -1054,16 +1054,16 @@  discard block
 block discarded – undo
1054 1054
  * 
1055 1055
  * @return string
1056 1056
  */
1057
-function wpinv_get_merge_tags_help_text( $subscription = false ) {
1057
+function wpinv_get_merge_tags_help_text($subscription = false) {
1058 1058
 
1059 1059
 	$url  = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f';
1060 1060
 	$link = sprintf(
1061 1061
 		'<strong><a href="%s" target="_blank">%s</a></strong>',
1062 1062
 		$url,
1063
-		esc_html__( 'View available merge tags.', 'wpinv-quotes' )
1063
+		esc_html__('View available merge tags.', 'wpinv-quotes')
1064 1064
 	);
1065 1065
 
1066
-	$description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' );
1066
+	$description = esc_html__('The content of the email (Merge Tags and HTML are allowed).', 'invoicing');
1067 1067
 
1068 1068
 	return "$description $link";
1069 1069
 
Please login to merge, or discard this patch.
includes/admin/class-getpaid-admin.php 2 patches
Indentation   +482 added lines, -482 removed lines patch added patch discarded remove patch
@@ -14,87 +14,87 @@  discard block
 block discarded – undo
14 14
 class GetPaid_Admin {
15 15
 
16 16
     /**
17
-	 * Local path to this plugins admin directory
18
-	 *
19
-	 * @var         string
20
-	 */
21
-	public $admin_path;
22
-
23
-	/**
24
-	 * Web path to this plugins admin directory
25
-	 *
26
-	 * @var         string
27
-	 */
28
-	public $admin_url;
17
+     * Local path to this plugins admin directory
18
+     *
19
+     * @var         string
20
+     */
21
+    public $admin_path;
22
+
23
+    /**
24
+     * Web path to this plugins admin directory
25
+     *
26
+     * @var         string
27
+     */
28
+    public $admin_url;
29 29
 	
30
-	/**
31
-	 * Reports components.
32
-	 *
33
-	 * @var GetPaid_Reports
34
-	 */
30
+    /**
31
+     * Reports components.
32
+     *
33
+     * @var GetPaid_Reports
34
+     */
35 35
     public $reports;
36 36
 
37 37
     /**
38
-	 * Class constructor.
39
-	 */
40
-	public function __construct(){
38
+     * Class constructor.
39
+     */
40
+    public function __construct(){
41 41
 
42 42
         $this->admin_path  = plugin_dir_path( __FILE__ );
43
-		$this->admin_url   = plugins_url( '/', __FILE__ );
44
-		$this->reports     = new GetPaid_Reports();
43
+        $this->admin_url   = plugins_url( '/', __FILE__ );
44
+        $this->reports     = new GetPaid_Reports();
45 45
 
46 46
         if ( is_admin() ) {
47
-			$this->init_admin_hooks();
47
+            $this->init_admin_hooks();
48 48
         }
49 49
 
50 50
     }
51 51
 
52 52
     /**
53
-	 * Init action and filter hooks
54
-	 *
55
-	 */
56
-	private function init_admin_hooks() {
53
+     * Init action and filter hooks
54
+     *
55
+     */
56
+    private function init_admin_hooks() {
57 57
         add_action( 'admin_enqueue_scripts', array( $this, 'enqeue_scripts' ) );
58 58
         add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
59 59
         add_action( 'admin_init', array( $this, 'init_ayecode_connect_helper' ) );
60 60
         add_action( 'admin_init', array( $this, 'activation_redirect') );
61 61
         add_action( 'admin_init', array( $this, 'maybe_do_admin_action') );
62
-		add_action( 'admin_notices', array( $this, 'show_notices' ) );
63
-		add_action( 'getpaid_authenticated_admin_action_rate_plugin', array( $this, 'redirect_to_wordpress_rating_page' ) );
64
-		add_action( 'getpaid_authenticated_admin_action_send_invoice', array( $this, 'send_customer_invoice' ) );
65
-		add_action( 'getpaid_authenticated_admin_action_send_invoice_reminder', array( $this, 'send_customer_payment_reminder' ) );
62
+        add_action( 'admin_notices', array( $this, 'show_notices' ) );
63
+        add_action( 'getpaid_authenticated_admin_action_rate_plugin', array( $this, 'redirect_to_wordpress_rating_page' ) );
64
+        add_action( 'getpaid_authenticated_admin_action_send_invoice', array( $this, 'send_customer_invoice' ) );
65
+        add_action( 'getpaid_authenticated_admin_action_send_invoice_reminder', array( $this, 'send_customer_payment_reminder' ) );
66 66
         add_action( 'getpaid_authenticated_admin_action_reset_tax_rates', array( $this, 'admin_reset_tax_rates' ) );
67
-		add_action( 'getpaid_authenticated_admin_action_create_missing_pages', array( $this, 'admin_create_missing_pages' ) );
68
-		add_action( 'getpaid_authenticated_admin_action_create_missing_tables', array( $this, 'admin_create_missing_tables' ) );
69
-		add_action( 'getpaid_authenticated_admin_action_migrate_old_invoices', array( $this, 'admin_migrate_old_invoices' ) );
70
-		add_action( 'getpaid_authenticated_admin_action_download_customers', array( $this, 'admin_download_customers' ) );
71
-		add_action( 'getpaid_authenticated_admin_action_recalculate_discounts', array( $this, 'admin_recalculate_discounts' ) );
72
-		add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) );
73
-		do_action( 'getpaid_init_admin_hooks', $this );
74
-
75
-		// Setup/welcome
76
-		if ( ! empty( $_GET['page'] ) ) {
77
-			switch ( $_GET['page'] ) {
78
-				case 'gp-setup' :
79
-					include_once( dirname( __FILE__ ) . '/class-getpaid-admin-setup-wizard.php' );
80
-					break;
81
-			}
82
-		}
67
+        add_action( 'getpaid_authenticated_admin_action_create_missing_pages', array( $this, 'admin_create_missing_pages' ) );
68
+        add_action( 'getpaid_authenticated_admin_action_create_missing_tables', array( $this, 'admin_create_missing_tables' ) );
69
+        add_action( 'getpaid_authenticated_admin_action_migrate_old_invoices', array( $this, 'admin_migrate_old_invoices' ) );
70
+        add_action( 'getpaid_authenticated_admin_action_download_customers', array( $this, 'admin_download_customers' ) );
71
+        add_action( 'getpaid_authenticated_admin_action_recalculate_discounts', array( $this, 'admin_recalculate_discounts' ) );
72
+        add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) );
73
+        do_action( 'getpaid_init_admin_hooks', $this );
74
+
75
+        // Setup/welcome
76
+        if ( ! empty( $_GET['page'] ) ) {
77
+            switch ( $_GET['page'] ) {
78
+                case 'gp-setup' :
79
+                    include_once( dirname( __FILE__ ) . '/class-getpaid-admin-setup-wizard.php' );
80
+                    break;
81
+            }
82
+        }
83 83
 
84 84
     }
85 85
 
86 86
     /**
87
-	 * Register admin scripts
88
-	 *
89
-	 */
90
-	public function enqeue_scripts() {
87
+     * Register admin scripts
88
+     *
89
+     */
90
+    public function enqeue_scripts() {
91 91
         global $current_screen, $pagenow;
92 92
 
93
-		$page    = isset( $_GET['page'] ) ? $_GET['page'] : '';
94
-		$editing = $pagenow == 'post.php' || $pagenow == 'post-new.php';
93
+        $page    = isset( $_GET['page'] ) ? $_GET['page'] : '';
94
+        $editing = $pagenow == 'post.php' || $pagenow == 'post-new.php';
95 95
 
96 96
         if ( ! empty( $current_screen->post_type ) ) {
97
-			$page = $current_screen->post_type;
97
+            $page = $current_screen->post_type;
98 98
         }
99 99
 
100 100
         // General styles.
@@ -115,54 +115,54 @@  discard block
 block discarded – undo
115 115
         }
116 116
 
117 117
         // Payment form scripts.
118
-		if ( 'wpi_payment_form' == $page && $editing ) {
118
+        if ( 'wpi_payment_form' == $page && $editing ) {
119 119
             $this->load_payment_form_scripts();
120 120
         }
121 121
 
122
-		if ( $page == 'wpinv-subscriptions' ) {
123
-			wp_enqueue_script( 'postbox' );
124
-		}
122
+        if ( $page == 'wpinv-subscriptions' ) {
123
+            wp_enqueue_script( 'postbox' );
124
+        }
125 125
 
126 126
     }
127 127
 
128 128
     /**
129
-	 * Returns admin js translations.
130
-	 *
131
-	 */
132
-	protected function get_admin_i18() {
129
+     * Returns admin js translations.
130
+     *
131
+     */
132
+    protected function get_admin_i18() {
133 133
         global $post;
134 134
 
135
-		$date_range = array(
136
-			'period' => isset( $_GET['date_range'] ) ? sanitize_text_field( $_GET['date_range'] ) : '7_days'
137
-		);
135
+        $date_range = array(
136
+            'period' => isset( $_GET['date_range'] ) ? sanitize_text_field( $_GET['date_range'] ) : '7_days'
137
+        );
138 138
 
139
-		if ( $date_range['period'] == 'custom' ) {
139
+        if ( $date_range['period'] == 'custom' ) {
140 140
 			
141
-			if ( isset( $_GET['from'] ) ) {
142
-				$date_range[ 'after' ] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['from'] ), current_time( 'timestamp' ) ) - DAY_IN_SECONDS );
143
-			}
141
+            if ( isset( $_GET['from'] ) ) {
142
+                $date_range[ 'after' ] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['from'] ), current_time( 'timestamp' ) ) - DAY_IN_SECONDS );
143
+            }
144 144
 
145
-			if ( isset( $_GET['to'] ) ) {
146
-				$date_range[ 'before' ] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['to'] ), current_time( 'timestamp' ) ) + DAY_IN_SECONDS );
147
-			}
145
+            if ( isset( $_GET['to'] ) ) {
146
+                $date_range[ 'before' ] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['to'] ), current_time( 'timestamp' ) ) + DAY_IN_SECONDS );
147
+            }
148 148
 
149
-		}
149
+        }
150 150
 
151 151
         $i18n = array(
152 152
             'ajax_url'                  => admin_url( 'admin-ajax.php' ),
153 153
             'post_ID'                   => isset( $post->ID ) ? $post->ID : '',
154
-			'wpinv_nonce'               => wp_create_nonce( 'wpinv-nonce' ),
155
-			'rest_nonce'                => wp_create_nonce( 'wp_rest' ),
156
-			'rest_root'                 => esc_url_raw( rest_url() ),
157
-			'date_range'                => $date_range,
154
+            'wpinv_nonce'               => wp_create_nonce( 'wpinv-nonce' ),
155
+            'rest_nonce'                => wp_create_nonce( 'wp_rest' ),
156
+            'rest_root'                 => esc_url_raw( rest_url() ),
157
+            'date_range'                => $date_range,
158 158
             'add_invoice_note_nonce'    => wp_create_nonce( 'add-invoice-note' ),
159 159
             'delete_invoice_note_nonce' => wp_create_nonce( 'delete-invoice-note' ),
160 160
             'invoice_item_nonce'        => wp_create_nonce( 'invoice-item' ),
161 161
             'billing_details_nonce'     => wp_create_nonce( 'get-billing-details' ),
162 162
             'tax'                       => wpinv_tax_amount(),
163 163
             'discount'                  => 0,
164
-			'currency_symbol'           => wpinv_currency_symbol(),
165
-			'currency'                  => wpinv_get_currency(),
164
+            'currency_symbol'           => wpinv_currency_symbol(),
165
+            'currency'                  => wpinv_get_currency(),
166 166
             'currency_pos'              => wpinv_currency_position(),
167 167
             'thousand_sep'              => wpinv_thousands_separator(),
168 168
             'decimal_sep'               => wpinv_decimal_separator(),
@@ -182,118 +182,118 @@  discard block
 block discarded – undo
182 182
             'item_description'          => __( 'Item Description', 'invoicing' ),
183 183
             'invoice_description'       => __( 'Invoice Description', 'invoicing' ),
184 184
             'discount_description'      => __( 'Discount Description', 'invoicing' ),
185
-			'searching'                 => __( 'Searching', 'invoicing' ),
186
-			'loading'                   => __( 'Loading...', 'invoicing' ),
187
-			'search_customers'          => __( 'Enter customer name or email', 'invoicing' ),
188
-			'search_items'              => __( 'Enter item name', 'invoicing' ),
185
+            'searching'                 => __( 'Searching', 'invoicing' ),
186
+            'loading'                   => __( 'Loading...', 'invoicing' ),
187
+            'search_customers'          => __( 'Enter customer name or email', 'invoicing' ),
188
+            'search_items'              => __( 'Enter item name', 'invoicing' ),
189 189
         );
190 190
 
191
-		if ( ! empty( $post ) && getpaid_is_invoice_post_type( $post->post_type ) ) {
191
+        if ( ! empty( $post ) && getpaid_is_invoice_post_type( $post->post_type ) ) {
192 192
 
193
-			$invoice              = new WPInv_Invoice( $post );
194
-			$i18n['save_invoice'] = sprintf(
195
-				__( 'Save %s', 'invoicing' ),
196
-				ucfirst( $invoice->get_invoice_quote_type() )
197
-			);
193
+            $invoice              = new WPInv_Invoice( $post );
194
+            $i18n['save_invoice'] = sprintf(
195
+                __( 'Save %s', 'invoicing' ),
196
+                ucfirst( $invoice->get_invoice_quote_type() )
197
+            );
198 198
 
199
-			$i18n['invoice_description'] = sprintf(
200
-				__( '%s Description', 'invoicing' ),
201
-				ucfirst( $invoice->get_invoice_quote_type() )
202
-			);
199
+            $i18n['invoice_description'] = sprintf(
200
+                __( '%s Description', 'invoicing' ),
201
+                ucfirst( $invoice->get_invoice_quote_type() )
202
+            );
203 203
 
204
-		}
205
-		return $i18n;
206
-	}
204
+        }
205
+        return $i18n;
206
+    }
207 207
 
208
-	/**
209
-	 * Change the admin footer text on GetPaid admin pages.
210
-	 *
211
-	 * @since  2.0.0
212
-	 * @param  string $footer_text
213
-	 * @return string
214
-	 */
215
-	public function admin_footer_text( $footer_text ) {
216
-		global $current_screen;
208
+    /**
209
+     * Change the admin footer text on GetPaid admin pages.
210
+     *
211
+     * @since  2.0.0
212
+     * @param  string $footer_text
213
+     * @return string
214
+     */
215
+    public function admin_footer_text( $footer_text ) {
216
+        global $current_screen;
217 217
 
218
-		$page    = isset( $_GET['page'] ) ? $_GET['page'] : '';
218
+        $page    = isset( $_GET['page'] ) ? $_GET['page'] : '';
219 219
 
220 220
         if ( ! empty( $current_screen->post_type ) ) {
221
-			$page = $current_screen->post_type;
221
+            $page = $current_screen->post_type;
222 222
         }
223 223
 
224 224
         // General styles.
225 225
         if ( apply_filters( 'getpaid_display_admin_footer_text', wpinv_current_user_can_manage_invoicing() ) && false !== stripos( $page, 'wpi' ) ) {
226 226
 
227
-			// Change the footer text
228
-			if ( ! get_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', true ) ) {
229
-
230
-				$rating_url  = esc_url(
231
-					wp_nonce_url(
232
-						admin_url( 'admin.php?page=wpinv-reports&getpaid-admin-action=rate_plugin' ),
233
-						'getpaid-nonce',
234
-						'getpaid-nonce'
235
-						)
236
-				);
237
-
238
-				$footer_text = sprintf(
239
-					/* translators: %s: five stars */
240
-					__( 'If you like <strong>GetPaid</strong>, please leave us a %s rating. A huge thanks in advance!', 'invoicing' ),
241
-					"<a href='$rating_url'>&#9733;&#9733;&#9733;&#9733;&#9733;</a>"
242
-				);
243
-
244
-			} else {
245
-
246
-				$footer_text = sprintf(
247
-					/* translators: %s: GetPaid */
248
-					__( 'Thank you for using %s!', 'invoicing' ),
249
-					"<a href='https://wpgetpaid.com/' target='_blank'><strong>GetPaid</strong></a>"
250
-				);
251
-
252
-			}
253
-
254
-		}
255
-
256
-		return $footer_text;
257
-	}
258
-
259
-	/**
260
-	 * Redirects to wp.org to rate the plugin.
261
-	 *
262
-	 * @since  2.0.0
263
-	 */
264
-	public function redirect_to_wordpress_rating_page() {
265
-		update_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', 1 );
266
-		wp_redirect( 'https://wordpress.org/support/plugin/invoicing/reviews?rate=5#new-post' );
267
-		exit;
268
-	}
227
+            // Change the footer text
228
+            if ( ! get_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', true ) ) {
229
+
230
+                $rating_url  = esc_url(
231
+                    wp_nonce_url(
232
+                        admin_url( 'admin.php?page=wpinv-reports&getpaid-admin-action=rate_plugin' ),
233
+                        'getpaid-nonce',
234
+                        'getpaid-nonce'
235
+                        )
236
+                );
237
+
238
+                $footer_text = sprintf(
239
+                    /* translators: %s: five stars */
240
+                    __( 'If you like <strong>GetPaid</strong>, please leave us a %s rating. A huge thanks in advance!', 'invoicing' ),
241
+                    "<a href='$rating_url'>&#9733;&#9733;&#9733;&#9733;&#9733;</a>"
242
+                );
243
+
244
+            } else {
245
+
246
+                $footer_text = sprintf(
247
+                    /* translators: %s: GetPaid */
248
+                    __( 'Thank you for using %s!', 'invoicing' ),
249
+                    "<a href='https://wpgetpaid.com/' target='_blank'><strong>GetPaid</strong></a>"
250
+                );
251
+
252
+            }
253
+
254
+        }
255
+
256
+        return $footer_text;
257
+    }
269 258
 
270 259
     /**
271
-	 * Loads payment form js.
272
-	 *
273
-	 */
274
-	protected function load_payment_form_scripts() {
260
+     * Redirects to wp.org to rate the plugin.
261
+     *
262
+     * @since  2.0.0
263
+     */
264
+    public function redirect_to_wordpress_rating_page() {
265
+        update_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', 1 );
266
+        wp_redirect( 'https://wordpress.org/support/plugin/invoicing/reviews?rate=5#new-post' );
267
+        exit;
268
+    }
269
+
270
+    /**
271
+     * Loads payment form js.
272
+     *
273
+     */
274
+    protected function load_payment_form_scripts() {
275 275
         global $post;
276 276
 
277 277
         wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION );
278
-		wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION );
279
-		wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION );
278
+        wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION );
279
+        wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION );
280 280
 
281
-		$version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' );
282
-		wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ),  $version );
281
+        $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' );
282
+        wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ),  $version );
283 283
 
284
-		wp_localize_script(
284
+        wp_localize_script(
285 285
             'wpinv-admin-payment-form-script',
286 286
             'wpinvPaymentFormAdmin',
287 287
             array(
288
-				'elements'      => wpinv_get_data( 'payment-form-elements' ),
289
-				'form_elements' => getpaid_get_payment_form_elements( $post->ID ),
290
-				'currency'      => wpinv_currency_symbol(),
291
-				'position'      => wpinv_currency_position(),
292
-				'decimals'      => (int) wpinv_decimals(),
293
-				'thousands_sep' => wpinv_thousands_separator(),
294
-				'decimals_sep'  => wpinv_decimal_separator(),
295
-				'form_items'    => gepaid_get_form_items( $post->ID ),
296
-				'is_default'    => $post->ID == wpinv_get_default_payment_form(),
288
+                'elements'      => wpinv_get_data( 'payment-form-elements' ),
289
+                'form_elements' => getpaid_get_payment_form_elements( $post->ID ),
290
+                'currency'      => wpinv_currency_symbol(),
291
+                'position'      => wpinv_currency_position(),
292
+                'decimals'      => (int) wpinv_decimals(),
293
+                'thousands_sep' => wpinv_thousands_separator(),
294
+                'decimals_sep'  => wpinv_decimal_separator(),
295
+                'form_items'    => gepaid_get_form_items( $post->ID ),
296
+                'is_default'    => $post->ID == wpinv_get_default_payment_form(),
297 297
             )
298 298
         );
299 299
 
@@ -302,20 +302,20 @@  discard block
 block discarded – undo
302 302
     }
303 303
 
304 304
     /**
305
-	 * Add our classes to admin pages.
305
+     * Add our classes to admin pages.
306 306
      *
307 307
      * @param string $classes
308 308
      * @return string
309
-	 *
310
-	 */
309
+     *
310
+     */
311 311
     public function admin_body_class( $classes ) {
312
-		global $pagenow, $post, $current_screen;
312
+        global $pagenow, $post, $current_screen;
313 313
 
314 314
 
315 315
         $page = isset( $_GET['page'] ) ? $_GET['page'] : '';
316 316
 
317 317
         if ( ! empty( $current_screen->post_type ) ) {
318
-			$page = $current_screen->post_type;
318
+            $page = $current_screen->post_type;
319 319
         }
320 320
 
321 321
         if ( false !== stripos( $page, 'wpi' ) ) {
@@ -324,59 +324,59 @@  discard block
 block discarded – undo
324 324
 
325 325
         if ( in_array( $page, wpinv_parse_list( 'wpi_invoice wpi_payment_form wpi_quote' ) ) ) {
326 326
             $classes .= ' wpinv-cpt wpinv';
327
-		}
327
+        }
328 328
 		
329
-		if ( getpaid_is_invoice_post_type( $page ) ) {
329
+        if ( getpaid_is_invoice_post_type( $page ) ) {
330 330
             $classes .= ' getpaid-is-invoice-cpt';
331 331
         }
332 332
 
333
-		return $classes;
333
+        return $classes;
334 334
     }
335 335
 
336 336
     /**
337
-	 * Maybe show the AyeCode Connect Notice.
338
-	 */
339
-	public function init_ayecode_connect_helper(){
337
+     * Maybe show the AyeCode Connect Notice.
338
+     */
339
+    public function init_ayecode_connect_helper(){
340 340
 
341 341
         new AyeCode_Connect_Helper(
342 342
             array(
343
-				'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"),
344
-				'connect_external'  => __( "Please confirm you wish to connect your site?","invoicing" ),
345
-				'connect'           => sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s","invoicing" ),"<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>","</a>" ),
346
-				'connect_button'    => __("Connect Site","invoicing"),
347
-				'connecting_button'    => __("Connecting...","invoicing"),
348
-				'error_localhost'   => __( "This service will only work with a live domain, not a localhost.","invoicing" ),
349
-				'error'             => __( "Something went wrong, please refresh and try again.","invoicing" ),
343
+                'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"),
344
+                'connect_external'  => __( "Please confirm you wish to connect your site?","invoicing" ),
345
+                'connect'           => sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s","invoicing" ),"<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>","</a>" ),
346
+                'connect_button'    => __("Connect Site","invoicing"),
347
+                'connecting_button'    => __("Connecting...","invoicing"),
348
+                'error_localhost'   => __( "This service will only work with a live domain, not a localhost.","invoicing" ),
349
+                'error'             => __( "Something went wrong, please refresh and try again.","invoicing" ),
350 350
             ),
351 351
             array( 'wpi-addons' )
352 352
         );
353 353
 
354 354
     }
355 355
 
356
-	/**
357
-	 * Redirect users to settings on activation.
358
-	 *
359
-	 * @return void
360
-	 */
361
-	public function activation_redirect() {
356
+    /**
357
+     * Redirect users to settings on activation.
358
+     *
359
+     * @return void
360
+     */
361
+    public function activation_redirect() {
362 362
 
363
-		$redirected = get_option( 'wpinv_redirected_to_settings' );
363
+        $redirected = get_option( 'wpinv_redirected_to_settings' );
364 364
 
365
-		if ( ! empty( $redirected ) || wp_doing_ajax() || ! current_user_can( 'manage_options' ) ) {
366
-			return;
367
-		}
365
+        if ( ! empty( $redirected ) || wp_doing_ajax() || ! current_user_can( 'manage_options' ) ) {
366
+            return;
367
+        }
368 368
 
369
-		// Bail if activating from network, or bulk
370
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
371
-			return;
372
-		}
369
+        // Bail if activating from network, or bulk
370
+        if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
371
+            return;
372
+        }
373 373
 
374
-	    update_option( 'wpinv_redirected_to_settings', 1 );
374
+        update_option( 'wpinv_redirected_to_settings', 1 );
375 375
 
376 376
         wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) );
377 377
         exit;
378 378
 
379
-	}
379
+    }
380 380
 
381 381
     /**
382 382
      * Fires an admin action after verifying that a user can fire them.
@@ -390,384 +390,384 @@  discard block
 block discarded – undo
390 390
 
391 391
     }
392 392
 
393
-	/**
393
+    /**
394 394
      * Sends a payment reminder to a customer.
395
-	 * 
396
-	 * @param array $args
395
+     * 
396
+     * @param array $args
397 397
      */
398 398
     public function send_customer_invoice( $args ) {
399
-		$sent = getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $args['invoice_id'] ), true );
399
+        $sent = getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $args['invoice_id'] ), true );
400 400
 
401
-		if ( $sent ) {
402
-			$this->show_success( __( 'Invoice was successfully sent to the customer', 'invoicing' ) );
403
-		} else {
404
-			$this->show_error( __( 'Could not send the invoice to the customer', 'invoicing' ) );
405
-		}
401
+        if ( $sent ) {
402
+            $this->show_success( __( 'Invoice was successfully sent to the customer', 'invoicing' ) );
403
+        } else {
404
+            $this->show_error( __( 'Could not send the invoice to the customer', 'invoicing' ) );
405
+        }
406 406
 
407
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
408
-		exit;
409
-	}
407
+        wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
408
+        exit;
409
+    }
410 410
 
411
-	/**
411
+    /**
412 412
      * Sends a payment reminder to a customer.
413
-	 * 
414
-	 * @param array $args
413
+     * 
414
+     * @param array $args
415 415
      */
416 416
     public function send_customer_payment_reminder( $args ) {
417
-		$sent = getpaid()->get( 'invoice_emails' )->force_send_overdue_notice( new WPInv_Invoice( $args['invoice_id'] ) );
417
+        $sent = getpaid()->get( 'invoice_emails' )->force_send_overdue_notice( new WPInv_Invoice( $args['invoice_id'] ) );
418 418
 
419
-		if ( $sent ) {
420
-			$this->show_success( __( 'Payment reminder was successfully sent to the customer', 'invoicing' ) );
421
-		} else {
422
-			$this->show_error( __( 'Could not sent payment reminder to the customer', 'invoicing' ) );
423
-		}
419
+        if ( $sent ) {
420
+            $this->show_success( __( 'Payment reminder was successfully sent to the customer', 'invoicing' ) );
421
+        } else {
422
+            $this->show_error( __( 'Could not sent payment reminder to the customer', 'invoicing' ) );
423
+        }
424 424
 
425
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
426
-		exit;
427
-	}
425
+        wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
426
+        exit;
427
+    }
428 428
 
429
-	/**
429
+    /**
430 430
      * Resets tax rates.
431
-	 * 
431
+     * 
432 432
      */
433 433
     public function admin_reset_tax_rates() {
434 434
 
435
-		update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) );
436
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
437
-		exit;
435
+        update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) );
436
+        wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
437
+        exit;
438 438
 
439
-	}
439
+    }
440 440
 
441
-	/**
441
+    /**
442 442
      * Resets admin pages.
443
-	 * 
443
+     * 
444 444
      */
445 445
     public function admin_create_missing_pages() {
446
-		$installer = new GetPaid_Installer();
447
-		$installer->create_pages();
448
-		$this->show_success( __( 'GetPaid pages updated.', 'invoicing' ) );
449
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
450
-		exit;
451
-	}
452
-
453
-	/**
446
+        $installer = new GetPaid_Installer();
447
+        $installer->create_pages();
448
+        $this->show_success( __( 'GetPaid pages updated.', 'invoicing' ) );
449
+        wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
450
+        exit;
451
+    }
452
+
453
+    /**
454 454
      * Creates an missing admin tables.
455
-	 * 
455
+     * 
456 456
      */
457 457
     public function admin_create_missing_tables() {
458
-		global $wpdb;
459
-		$installer = new GetPaid_Installer();
458
+        global $wpdb;
459
+        $installer = new GetPaid_Installer();
460 460
 
461
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}wpinv_subscriptions'" ) != $wpdb->prefix . 'wpinv_subscriptions' ) {
462
-			$installer->create_subscriptions_table();
461
+        if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}wpinv_subscriptions'" ) != $wpdb->prefix . 'wpinv_subscriptions' ) {
462
+            $installer->create_subscriptions_table();
463 463
 
464
-			if ( $wpdb->last_error !== '' ) {
465
-				$this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error );
466
-			}
467
-		}
464
+            if ( $wpdb->last_error !== '' ) {
465
+                $this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error );
466
+            }
467
+        }
468 468
 
469
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoices'" ) != $wpdb->prefix . 'getpaid_invoices' ) {
470
-			$installer->create_invoices_table();
469
+        if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoices'" ) != $wpdb->prefix . 'getpaid_invoices' ) {
470
+            $installer->create_invoices_table();
471 471
 
472
-			if ( $wpdb->last_error !== '' ) {
473
-				$this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error );
474
-			}
475
-		}
472
+            if ( $wpdb->last_error !== '' ) {
473
+                $this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error );
474
+            }
475
+        }
476 476
 
477
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoice_items'" ) != $wpdb->prefix . 'getpaid_invoice_items' ) {
478
-			$installer->create_invoice_items_table();
477
+        if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoice_items'" ) != $wpdb->prefix . 'getpaid_invoice_items' ) {
478
+            $installer->create_invoice_items_table();
479 479
 
480
-			if ( $wpdb->last_error !== '' ) {
481
-				$this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error );
482
-			}
483
-		}
480
+            if ( $wpdb->last_error !== '' ) {
481
+                $this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error );
482
+            }
483
+        }
484 484
 
485
-		if ( ! $this->has_notices() ) {
486
-			$this->show_success( __( 'Your GetPaid tables have been updated.', 'invoicing' ) );
487
-		}
485
+        if ( ! $this->has_notices() ) {
486
+            $this->show_success( __( 'Your GetPaid tables have been updated.', 'invoicing' ) );
487
+        }
488 488
 
489
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
490
-		exit;
491
-	}
489
+        wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
490
+        exit;
491
+    }
492 492
 
493
-	/**
493
+    /**
494 494
      * Migrates old invoices to the new database tables.
495
-	 * 
495
+     * 
496 496
      */
497 497
     public function admin_migrate_old_invoices() {
498 498
 
499
-		// Migrate the invoices.
500
-		$installer = new GetPaid_Installer();
501
-		$installer->migrate_old_invoices();
499
+        // Migrate the invoices.
500
+        $installer = new GetPaid_Installer();
501
+        $installer->migrate_old_invoices();
502 502
 
503
-		// Show an admin message.
504
-		$this->show_success( __( 'Your invoices have been migrated.', 'invoicing' ) );
503
+        // Show an admin message.
504
+        $this->show_success( __( 'Your invoices have been migrated.', 'invoicing' ) );
505 505
 
506
-		// Redirect the admin.
507
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
508
-		exit;
506
+        // Redirect the admin.
507
+        wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
508
+        exit;
509 509
 
510
-	}
510
+    }
511 511
 
512
-	/**
512
+    /**
513 513
      * Download customers.
514
-	 * 
514
+     * 
515 515
      */
516 516
     public function admin_download_customers() {
517
-		global $wpdb;
517
+        global $wpdb;
518 518
 
519
-		$output = fopen( 'php://output', 'w' ) or die( __( 'Unsupported server', 'invoicing' ) );
519
+        $output = fopen( 'php://output', 'w' ) or die( __( 'Unsupported server', 'invoicing' ) );
520 520
 
521
-		header( "Content-Type:text/csv" );
522
-		header( "Content-Disposition:attachment;filename=customers.csv" );
521
+        header( "Content-Type:text/csv" );
522
+        header( "Content-Disposition:attachment;filename=customers.csv" );
523 523
 
524
-		$post_types = '';
524
+        $post_types = '';
525 525
 
526
-		foreach ( array_keys( getpaid_get_invoice_post_types() ) as $post_type ) {
527
-			$post_types .= $wpdb->prepare( "post_type=%s OR ", $post_type );
528
-		}
526
+        foreach ( array_keys( getpaid_get_invoice_post_types() ) as $post_type ) {
527
+            $post_types .= $wpdb->prepare( "post_type=%s OR ", $post_type );
528
+        }
529 529
 
530
-		$post_types = rtrim( $post_types, ' OR' );
530
+        $post_types = rtrim( $post_types, ' OR' );
531 531
 
532
-		$customers = $wpdb->get_col(
533
-			$wpdb->prepare(
534
-				"SELECT DISTINCT( post_author ) FROM $wpdb->posts WHERE $post_types"
535
-			)
536
-		);
532
+        $customers = $wpdb->get_col(
533
+            $wpdb->prepare(
534
+                "SELECT DISTINCT( post_author ) FROM $wpdb->posts WHERE $post_types"
535
+            )
536
+        );
537 537
 
538
-		$columns = array(
539
-			'name'     => __( 'Name', 'invoicing' ),
540
-			'email'    => __( 'Email', 'invoicing' ),
541
-			'country'  => __( 'Country', 'invoicing' ),
542
-			'state'    => __( 'State', 'invoicing' ),
543
-			'city'     => __( 'City', 'invoicing' ),
544
-			'zip'      => __( 'ZIP', 'invoicing' ),
545
-			'address'  => __( 'Address', 'invoicing' ),
546
-			'phone'    => __( 'Phone', 'invoicing' ),
547
-			'company'  => __( 'Company', 'invoicing' ),
548
-			'invoices' => __( 'Invoices', 'invoicing' ),
549
-			'total'    => __( 'Total Spend', 'invoicing' ),
550
-			'signup'   => __( 'Date created', 'invoicing' ),
551
-		);
538
+        $columns = array(
539
+            'name'     => __( 'Name', 'invoicing' ),
540
+            'email'    => __( 'Email', 'invoicing' ),
541
+            'country'  => __( 'Country', 'invoicing' ),
542
+            'state'    => __( 'State', 'invoicing' ),
543
+            'city'     => __( 'City', 'invoicing' ),
544
+            'zip'      => __( 'ZIP', 'invoicing' ),
545
+            'address'  => __( 'Address', 'invoicing' ),
546
+            'phone'    => __( 'Phone', 'invoicing' ),
547
+            'company'  => __( 'Company', 'invoicing' ),
548
+            'invoices' => __( 'Invoices', 'invoicing' ),
549
+            'total'    => __( 'Total Spend', 'invoicing' ),
550
+            'signup'   => __( 'Date created', 'invoicing' ),
551
+        );
552 552
 
553
-		// Output the csv column headers.
554
-		fputcsv( $output, array_values( $columns ) );
553
+        // Output the csv column headers.
554
+        fputcsv( $output, array_values( $columns ) );
555 555
 
556
-		// Loop through
557
-		$table = new WPInv_Customers_Table();
558
-		foreach ( $customers as $customer_id ) {
556
+        // Loop through
557
+        $table = new WPInv_Customers_Table();
558
+        foreach ( $customers as $customer_id ) {
559 559
 
560
-			$user = get_user_by( 'id', $customer_id );
561
-			$row  = array();
562
-			if ( empty( $user ) ) {
563
-				continue;
564
-			}
560
+            $user = get_user_by( 'id', $customer_id );
561
+            $row  = array();
562
+            if ( empty( $user ) ) {
563
+                continue;
564
+            }
565 565
 
566
-			foreach ( array_keys( $columns ) as $column ) {
566
+            foreach ( array_keys( $columns ) as $column ) {
567 567
 
568
-				$method = 'column_' . $column;
568
+                $method = 'column_' . $column;
569 569
 
570
-				if ( 'name' == $column ) {
571
-					$value = sanitize_text_field( $user->display_name );
572
-				} else if( 'email' == $column ) {
573
-					$value = sanitize_email( $user->user_email );
574
-				} else if ( is_callable( array( $table, $method ) ) ) {
575
-					$value = strip_tags( $table->$method( $user ) );
576
-				}
570
+                if ( 'name' == $column ) {
571
+                    $value = sanitize_text_field( $user->display_name );
572
+                } else if( 'email' == $column ) {
573
+                    $value = sanitize_email( $user->user_email );
574
+                } else if ( is_callable( array( $table, $method ) ) ) {
575
+                    $value = strip_tags( $table->$method( $user ) );
576
+                }
577 577
 
578
-				if ( empty( $value ) ) {
579
-					$value = sanitize_text_field( get_user_meta( $user->ID, '_wpinv_' . $column, true ) );
580
-				}
578
+                if ( empty( $value ) ) {
579
+                    $value = sanitize_text_field( get_user_meta( $user->ID, '_wpinv_' . $column, true ) );
580
+                }
581 581
 
582
-				$row[] = $value;
582
+                $row[] = $value;
583 583
 
584
-			}
584
+            }
585 585
 
586
-			fputcsv( $output, $row );
587
-		}
586
+            fputcsv( $output, $row );
587
+        }
588 588
 
589
-		fclose( $output );
590
-		exit;
589
+        fclose( $output );
590
+        exit;
591 591
 
592
-	}
592
+    }
593 593
 
594
-	/**
594
+    /**
595 595
      * Recalculates discounts.
596
-	 * 
596
+     * 
597 597
      */
598 598
     public function admin_recalculate_discounts() {
599
-		global $wpdb;
599
+        global $wpdb;
600 600
 
601
-		// Fetch all invoices that have discount codes.
602
-		$table    = $wpdb->prefix . 'getpaid_invoices';
603
-		$invoices = $wpdb->get_col( "SELECT `post_id` FROM `$table` WHERE `discount` = 0 && `discount_code` <> ''" );
601
+        // Fetch all invoices that have discount codes.
602
+        $table    = $wpdb->prefix . 'getpaid_invoices';
603
+        $invoices = $wpdb->get_col( "SELECT `post_id` FROM `$table` WHERE `discount` = 0 && `discount_code` <> ''" );
604 604
 
605
-		foreach ( $invoices as $invoice ) {
605
+        foreach ( $invoices as $invoice ) {
606 606
 
607
-			$invoice = new WPInv_Invoice( $invoice );
607
+            $invoice = new WPInv_Invoice( $invoice );
608 608
 
609
-			if ( ! $invoice->exists() ) {
610
-				continue;
611
-			}
609
+            if ( ! $invoice->exists() ) {
610
+                continue;
611
+            }
612 612
 
613
-			// Abort if the discount does not exist or does not apply here.
614
-			$discount = new WPInv_Discount( $invoice->get_discount_code() );
615
-			if ( ! $discount->exists() ) {
616
-				continue;
617
-			}
613
+            // Abort if the discount does not exist or does not apply here.
614
+            $discount = new WPInv_Discount( $invoice->get_discount_code() );
615
+            if ( ! $discount->exists() ) {
616
+                continue;
617
+            }
618 618
 
619
-			$invoice->add_discount( getpaid_calculate_invoice_discount( $invoice, $discount ) );
620
-			$invoice->recalculate_total();
619
+            $invoice->add_discount( getpaid_calculate_invoice_discount( $invoice, $discount ) );
620
+            $invoice->recalculate_total();
621 621
 
622
-			if ( $invoice->get_total_discount() > 0 ) {
623
-				$invoice->save();
624
-			}
622
+            if ( $invoice->get_total_discount() > 0 ) {
623
+                $invoice->save();
624
+            }
625 625
 
626
-		}
626
+        }
627 627
 
628
-		// Show an admin message.
629
-		$this->show_success( __( 'Discounts have been recalculated.', 'invoicing' ) );
628
+        // Show an admin message.
629
+        $this->show_success( __( 'Discounts have been recalculated.', 'invoicing' ) );
630 630
 
631
-		// Redirect the admin.
632
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
633
-		exit;
631
+        // Redirect the admin.
632
+        wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
633
+        exit;
634 634
 
635
-	}
635
+    }
636 636
 
637 637
     /**
638
-	 * Returns an array of admin notices.
639
-	 *
640
-	 * @since       1.0.19
638
+     * Returns an array of admin notices.
639
+     *
640
+     * @since       1.0.19
641 641
      * @return array
642
-	 */
643
-	public function get_notices() {
644
-		$notices = get_option( 'wpinv_admin_notices' );
642
+     */
643
+    public function get_notices() {
644
+        $notices = get_option( 'wpinv_admin_notices' );
645 645
         return is_array( $notices ) ? $notices : array();
646
-	}
646
+    }
647 647
 
648
-	/**
649
-	 * Checks if we have any admin notices.
650
-	 *
651
-	 * @since       2.0.4
648
+    /**
649
+     * Checks if we have any admin notices.
650
+     *
651
+     * @since       2.0.4
652 652
      * @return array
653
-	 */
654
-	public function has_notices() {
655
-		return count( $this->get_notices() ) > 0;
656
-	}
657
-
658
-	/**
659
-	 * Clears all admin notices
660
-	 *
661
-	 * @access      public
662
-	 * @since       1.0.19
663
-	 */
664
-	public function clear_notices() {
665
-		delete_option( 'wpinv_admin_notices' );
666
-	}
667
-
668
-	/**
669
-	 * Saves a new admin notice
670
-	 *
671
-	 * @access      public
672
-	 * @since       1.0.19
673
-	 */
674
-	public function save_notice( $type, $message ) {
675
-		$notices = $this->get_notices();
676
-
677
-		if ( empty( $notices[ $type ] ) || ! is_array( $notices[ $type ]) ) {
678
-			$notices[ $type ] = array();
679
-		}
680
-
681
-		$notices[ $type ][] = $message;
682
-
683
-		update_option( 'wpinv_admin_notices', $notices );
684
-	}
685
-
686
-	/**
687
-	 * Displays a success notice
688
-	 *
689
-	 * @param       string $msg The message to qeue.
690
-	 * @access      public
691
-	 * @since       1.0.19
692
-	 */
693
-	public function show_success( $msg ) {
694
-		$this->save_notice( 'success', $msg );
695
-	}
696
-
697
-	/**
698
-	 * Displays a error notice
699
-	 *
700
-	 * @access      public
701
-	 * @param       string $msg The message to qeue.
702
-	 * @since       1.0.19
703
-	 */
704
-	public function show_error( $msg ) {
705
-		$this->save_notice( 'error', $msg );
706
-	}
707
-
708
-	/**
709
-	 * Displays a warning notice
710
-	 *
711
-	 * @access      public
712
-	 * @param       string $msg The message to qeue.
713
-	 * @since       1.0.19
714
-	 */
715
-	public function show_warning( $msg ) {
716
-		$this->save_notice( 'warning', $msg );
717
-	}
718
-
719
-	/**
720
-	 * Displays a info notice
721
-	 *
722
-	 * @access      public
723
-	 * @param       string $msg The message to qeue.
724
-	 * @since       1.0.19
725
-	 */
726
-	public function show_info( $msg ) {
727
-		$this->save_notice( 'info', $msg );
728
-	}
729
-
730
-	/**
731
-	 * Show notices
732
-	 *
733
-	 * @access      public
734
-	 * @since       1.0.19
735
-	 */
736
-	public function show_notices() {
653
+     */
654
+    public function has_notices() {
655
+        return count( $this->get_notices() ) > 0;
656
+    }
657
+
658
+    /**
659
+     * Clears all admin notices
660
+     *
661
+     * @access      public
662
+     * @since       1.0.19
663
+     */
664
+    public function clear_notices() {
665
+        delete_option( 'wpinv_admin_notices' );
666
+    }
667
+
668
+    /**
669
+     * Saves a new admin notice
670
+     *
671
+     * @access      public
672
+     * @since       1.0.19
673
+     */
674
+    public function save_notice( $type, $message ) {
675
+        $notices = $this->get_notices();
676
+
677
+        if ( empty( $notices[ $type ] ) || ! is_array( $notices[ $type ]) ) {
678
+            $notices[ $type ] = array();
679
+        }
680
+
681
+        $notices[ $type ][] = $message;
682
+
683
+        update_option( 'wpinv_admin_notices', $notices );
684
+    }
685
+
686
+    /**
687
+     * Displays a success notice
688
+     *
689
+     * @param       string $msg The message to qeue.
690
+     * @access      public
691
+     * @since       1.0.19
692
+     */
693
+    public function show_success( $msg ) {
694
+        $this->save_notice( 'success', $msg );
695
+    }
696
+
697
+    /**
698
+     * Displays a error notice
699
+     *
700
+     * @access      public
701
+     * @param       string $msg The message to qeue.
702
+     * @since       1.0.19
703
+     */
704
+    public function show_error( $msg ) {
705
+        $this->save_notice( 'error', $msg );
706
+    }
707
+
708
+    /**
709
+     * Displays a warning notice
710
+     *
711
+     * @access      public
712
+     * @param       string $msg The message to qeue.
713
+     * @since       1.0.19
714
+     */
715
+    public function show_warning( $msg ) {
716
+        $this->save_notice( 'warning', $msg );
717
+    }
718
+
719
+    /**
720
+     * Displays a info notice
721
+     *
722
+     * @access      public
723
+     * @param       string $msg The message to qeue.
724
+     * @since       1.0.19
725
+     */
726
+    public function show_info( $msg ) {
727
+        $this->save_notice( 'info', $msg );
728
+    }
729
+
730
+    /**
731
+     * Show notices
732
+     *
733
+     * @access      public
734
+     * @since       1.0.19
735
+     */
736
+    public function show_notices() {
737 737
 
738 738
         $notices = $this->get_notices();
739 739
         $this->clear_notices();
740 740
 
741
-		foreach ( $notices as $type => $messages ) {
741
+        foreach ( $notices as $type => $messages ) {
742 742
 
743
-			if ( ! is_array( $messages ) ) {
744
-				continue;
745
-			}
743
+            if ( ! is_array( $messages ) ) {
744
+                continue;
745
+            }
746 746
 
747 747
             $type  = sanitize_key( $type );
748
-			foreach ( $messages as $message ) {
748
+            foreach ( $messages as $message ) {
749 749
                 $message = wp_kses_post( $message );
750
-				echo "<div class='notice notice-$type is-dismissible'><p>$message</p></div>";
750
+                echo "<div class='notice notice-$type is-dismissible'><p>$message</p></div>";
751 751
             }
752 752
 
753 753
         }
754 754
 
755
-		foreach ( array( 'checkout_page', 'invoice_history_page', 'success_page', 'failure_page', 'invoice_subscription_page' ) as $page ) {
756
-
757
-			if ( ! is_numeric( wpinv_get_option( $page, false ) ) ) {
758
-				$url     = wp_nonce_url(
759
-					add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ),
760
-					'getpaid-nonce',
761
-					'getpaid-nonce'
762
-				);
763
-				$message  = __( 'Some GetPaid pages are missing. To use GetPaid without any issues, click the button below to generate the missing pages.', 'invoicing' );
764
-				$message2 = __( 'Generate Pages', 'invoicing' );
765
-				echo "<div class='notice notice-warning is-dismissible'><p>$message<br><br><a href='$url' class='button button-primary'>$message2</a></p></div>";
766
-				break;
767
-			}
755
+        foreach ( array( 'checkout_page', 'invoice_history_page', 'success_page', 'failure_page', 'invoice_subscription_page' ) as $page ) {
756
+
757
+            if ( ! is_numeric( wpinv_get_option( $page, false ) ) ) {
758
+                $url     = wp_nonce_url(
759
+                    add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ),
760
+                    'getpaid-nonce',
761
+                    'getpaid-nonce'
762
+                );
763
+                $message  = __( 'Some GetPaid pages are missing. To use GetPaid without any issues, click the button below to generate the missing pages.', 'invoicing' );
764
+                $message2 = __( 'Generate Pages', 'invoicing' );
765
+                echo "<div class='notice notice-warning is-dismissible'><p>$message<br><br><a href='$url' class='button button-primary'>$message2</a></p></div>";
766
+                break;
767
+            }
768 768
 
769
-		}
769
+        }
770 770
 
771
-	}
771
+    }
772 772
 
773 773
 }
Please login to merge, or discard this patch.
Spacing   +223 added lines, -223 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * The main admin class.
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
     /**
38 38
 	 * Class constructor.
39 39
 	 */
40
-	public function __construct(){
40
+	public function __construct() {
41 41
 
42
-        $this->admin_path  = plugin_dir_path( __FILE__ );
43
-		$this->admin_url   = plugins_url( '/', __FILE__ );
42
+        $this->admin_path = plugin_dir_path(__FILE__);
43
+		$this->admin_url   = plugins_url('/', __FILE__);
44 44
 		$this->reports     = new GetPaid_Reports();
45 45
 
46
-        if ( is_admin() ) {
46
+        if (is_admin()) {
47 47
 			$this->init_admin_hooks();
48 48
         }
49 49
 
@@ -54,29 +54,29 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 */
56 56
 	private function init_admin_hooks() {
57
-        add_action( 'admin_enqueue_scripts', array( $this, 'enqeue_scripts' ) );
58
-        add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
59
-        add_action( 'admin_init', array( $this, 'init_ayecode_connect_helper' ) );
60
-        add_action( 'admin_init', array( $this, 'activation_redirect') );
61
-        add_action( 'admin_init', array( $this, 'maybe_do_admin_action') );
62
-		add_action( 'admin_notices', array( $this, 'show_notices' ) );
63
-		add_action( 'getpaid_authenticated_admin_action_rate_plugin', array( $this, 'redirect_to_wordpress_rating_page' ) );
64
-		add_action( 'getpaid_authenticated_admin_action_send_invoice', array( $this, 'send_customer_invoice' ) );
65
-		add_action( 'getpaid_authenticated_admin_action_send_invoice_reminder', array( $this, 'send_customer_payment_reminder' ) );
66
-        add_action( 'getpaid_authenticated_admin_action_reset_tax_rates', array( $this, 'admin_reset_tax_rates' ) );
67
-		add_action( 'getpaid_authenticated_admin_action_create_missing_pages', array( $this, 'admin_create_missing_pages' ) );
68
-		add_action( 'getpaid_authenticated_admin_action_create_missing_tables', array( $this, 'admin_create_missing_tables' ) );
69
-		add_action( 'getpaid_authenticated_admin_action_migrate_old_invoices', array( $this, 'admin_migrate_old_invoices' ) );
70
-		add_action( 'getpaid_authenticated_admin_action_download_customers', array( $this, 'admin_download_customers' ) );
71
-		add_action( 'getpaid_authenticated_admin_action_recalculate_discounts', array( $this, 'admin_recalculate_discounts' ) );
72
-		add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) );
73
-		do_action( 'getpaid_init_admin_hooks', $this );
57
+        add_action('admin_enqueue_scripts', array($this, 'enqeue_scripts'));
58
+        add_filter('admin_body_class', array($this, 'admin_body_class'));
59
+        add_action('admin_init', array($this, 'init_ayecode_connect_helper'));
60
+        add_action('admin_init', array($this, 'activation_redirect'));
61
+        add_action('admin_init', array($this, 'maybe_do_admin_action'));
62
+		add_action('admin_notices', array($this, 'show_notices'));
63
+		add_action('getpaid_authenticated_admin_action_rate_plugin', array($this, 'redirect_to_wordpress_rating_page'));
64
+		add_action('getpaid_authenticated_admin_action_send_invoice', array($this, 'send_customer_invoice'));
65
+		add_action('getpaid_authenticated_admin_action_send_invoice_reminder', array($this, 'send_customer_payment_reminder'));
66
+        add_action('getpaid_authenticated_admin_action_reset_tax_rates', array($this, 'admin_reset_tax_rates'));
67
+		add_action('getpaid_authenticated_admin_action_create_missing_pages', array($this, 'admin_create_missing_pages'));
68
+		add_action('getpaid_authenticated_admin_action_create_missing_tables', array($this, 'admin_create_missing_tables'));
69
+		add_action('getpaid_authenticated_admin_action_migrate_old_invoices', array($this, 'admin_migrate_old_invoices'));
70
+		add_action('getpaid_authenticated_admin_action_download_customers', array($this, 'admin_download_customers'));
71
+		add_action('getpaid_authenticated_admin_action_recalculate_discounts', array($this, 'admin_recalculate_discounts'));
72
+		add_filter('admin_footer_text', array($this, 'admin_footer_text'));
73
+		do_action('getpaid_init_admin_hooks', $this);
74 74
 
75 75
 		// Setup/welcome
76
-		if ( ! empty( $_GET['page'] ) ) {
77
-			switch ( $_GET['page'] ) {
76
+		if (!empty($_GET['page'])) {
77
+			switch ($_GET['page']) {
78 78
 				case 'gp-setup' :
79
-					include_once( dirname( __FILE__ ) . '/class-getpaid-admin-setup-wizard.php' );
79
+					include_once(dirname(__FILE__) . '/class-getpaid-admin-setup-wizard.php');
80 80
 					break;
81 81
 			}
82 82
 		}
@@ -90,37 +90,37 @@  discard block
 block discarded – undo
90 90
 	public function enqeue_scripts() {
91 91
         global $current_screen, $pagenow;
92 92
 
93
-		$page    = isset( $_GET['page'] ) ? $_GET['page'] : '';
93
+		$page    = isset($_GET['page']) ? $_GET['page'] : '';
94 94
 		$editing = $pagenow == 'post.php' || $pagenow == 'post-new.php';
95 95
 
96
-        if ( ! empty( $current_screen->post_type ) ) {
96
+        if (!empty($current_screen->post_type)) {
97 97
 			$page = $current_screen->post_type;
98 98
         }
99 99
 
100 100
         // General styles.
101
-        if ( false !== stripos( $page, 'wpi' ) ) {
101
+        if (false !== stripos($page, 'wpi')) {
102 102
 
103 103
             // Styles.
104
-            $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/admin.css' );
105
-            wp_enqueue_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array( 'wp-color-picker' ), $version );
106
-            wp_enqueue_style( 'select2', WPINV_PLUGIN_URL . 'assets/css/select2/select2.min.css', array(), '4.0.13', 'all' );
104
+            $version = filemtime(WPINV_PLUGIN_DIR . 'assets/css/admin.css');
105
+            wp_enqueue_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array('wp-color-picker'), $version);
106
+            wp_enqueue_style('select2', WPINV_PLUGIN_URL . 'assets/css/select2/select2.min.css', array(), '4.0.13', 'all');
107 107
 
108 108
             // Scripts.
109
-            wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full.min.js', array( 'jquery' ), WPINV_VERSION );
109
+            wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full.min.js', array('jquery'), WPINV_VERSION);
110 110
 
111
-            $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin.js' );
112
-            wp_enqueue_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array( 'jquery', 'wp-color-picker' ),  $version );
113
-            wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', apply_filters( 'wpinv_admin_js_localize', $this->get_admin_i18() ) );
111
+            $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin.js');
112
+            wp_enqueue_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array('jquery', 'wp-color-picker'), $version);
113
+            wp_localize_script('wpinv-admin-script', 'WPInv_Admin', apply_filters('wpinv_admin_js_localize', $this->get_admin_i18()));
114 114
 
115 115
         }
116 116
 
117 117
         // Payment form scripts.
118
-		if ( 'wpi_payment_form' == $page && $editing ) {
118
+		if ('wpi_payment_form' == $page && $editing) {
119 119
             $this->load_payment_form_scripts();
120 120
         }
121 121
 
122
-		if ( $page == 'wpinv-subscriptions' ) {
123
-			wp_enqueue_script( 'postbox' );
122
+		if ($page == 'wpinv-subscriptions') {
123
+			wp_enqueue_script('postbox');
124 124
 		}
125 125
 
126 126
     }
@@ -133,32 +133,32 @@  discard block
 block discarded – undo
133 133
         global $post;
134 134
 
135 135
 		$date_range = array(
136
-			'period' => isset( $_GET['date_range'] ) ? sanitize_text_field( $_GET['date_range'] ) : '7_days'
136
+			'period' => isset($_GET['date_range']) ? sanitize_text_field($_GET['date_range']) : '7_days'
137 137
 		);
138 138
 
139
-		if ( $date_range['period'] == 'custom' ) {
139
+		if ($date_range['period'] == 'custom') {
140 140
 			
141
-			if ( isset( $_GET['from'] ) ) {
142
-				$date_range[ 'after' ] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['from'] ), current_time( 'timestamp' ) ) - DAY_IN_SECONDS );
141
+			if (isset($_GET['from'])) {
142
+				$date_range['after'] = date('Y-m-d', strtotime(sanitize_text_field($_GET['from']), current_time('timestamp')) - DAY_IN_SECONDS);
143 143
 			}
144 144
 
145
-			if ( isset( $_GET['to'] ) ) {
146
-				$date_range[ 'before' ] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['to'] ), current_time( 'timestamp' ) ) + DAY_IN_SECONDS );
145
+			if (isset($_GET['to'])) {
146
+				$date_range['before'] = date('Y-m-d', strtotime(sanitize_text_field($_GET['to']), current_time('timestamp')) + DAY_IN_SECONDS);
147 147
 			}
148 148
 
149 149
 		}
150 150
 
151 151
         $i18n = array(
152
-            'ajax_url'                  => admin_url( 'admin-ajax.php' ),
153
-            'post_ID'                   => isset( $post->ID ) ? $post->ID : '',
154
-			'wpinv_nonce'               => wp_create_nonce( 'wpinv-nonce' ),
155
-			'rest_nonce'                => wp_create_nonce( 'wp_rest' ),
156
-			'rest_root'                 => esc_url_raw( rest_url() ),
152
+            'ajax_url'                  => admin_url('admin-ajax.php'),
153
+            'post_ID'                   => isset($post->ID) ? $post->ID : '',
154
+			'wpinv_nonce'               => wp_create_nonce('wpinv-nonce'),
155
+			'rest_nonce'                => wp_create_nonce('wp_rest'),
156
+			'rest_root'                 => esc_url_raw(rest_url()),
157 157
 			'date_range'                => $date_range,
158
-            'add_invoice_note_nonce'    => wp_create_nonce( 'add-invoice-note' ),
159
-            'delete_invoice_note_nonce' => wp_create_nonce( 'delete-invoice-note' ),
160
-            'invoice_item_nonce'        => wp_create_nonce( 'invoice-item' ),
161
-            'billing_details_nonce'     => wp_create_nonce( 'get-billing-details' ),
158
+            'add_invoice_note_nonce'    => wp_create_nonce('add-invoice-note'),
159
+            'delete_invoice_note_nonce' => wp_create_nonce('delete-invoice-note'),
160
+            'invoice_item_nonce'        => wp_create_nonce('invoice-item'),
161
+            'billing_details_nonce'     => wp_create_nonce('get-billing-details'),
162 162
             'tax'                       => wpinv_tax_amount(),
163 163
             'discount'                  => 0,
164 164
 			'currency_symbol'           => wpinv_currency_symbol(),
@@ -167,38 +167,38 @@  discard block
 block discarded – undo
167 167
             'thousand_sep'              => wpinv_thousands_separator(),
168 168
             'decimal_sep'               => wpinv_decimal_separator(),
169 169
             'decimals'                  => wpinv_decimals(),
170
-            'save_invoice'              => __( 'Save Invoice', 'invoicing' ),
171
-            'status_publish'            => wpinv_status_nicename( 'publish' ),
172
-            'status_pending'            => wpinv_status_nicename( 'wpi-pending' ),
173
-            'delete_tax_rate'           => __( 'Are you sure you wish to delete this tax rate?', 'invoicing' ),
174
-            'status_pending'            => wpinv_status_nicename( 'wpi-pending' ),
175
-            'FillBillingDetails'        => __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' ),
176
-            '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' ),
177
-            'AreYouSure'                => __( 'Are you sure?', 'invoicing' ),
178
-            'errDeleteItem'             => __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' ),
179
-            'delete_subscription'       => __( 'Are you sure you want to delete this subscription?', 'invoicing' ),
180
-            'action_edit'               => __( 'Edit', 'invoicing' ),
181
-            'action_cancel'             => __( 'Cancel', 'invoicing' ),
182
-            'item_description'          => __( 'Item Description', 'invoicing' ),
183
-            'invoice_description'       => __( 'Invoice Description', 'invoicing' ),
184
-            'discount_description'      => __( 'Discount Description', 'invoicing' ),
185
-			'searching'                 => __( 'Searching', 'invoicing' ),
186
-			'loading'                   => __( 'Loading...', 'invoicing' ),
187
-			'search_customers'          => __( 'Enter customer name or email', 'invoicing' ),
188
-			'search_items'              => __( 'Enter item name', 'invoicing' ),
170
+            'save_invoice'              => __('Save Invoice', 'invoicing'),
171
+            'status_publish'            => wpinv_status_nicename('publish'),
172
+            'status_pending'            => wpinv_status_nicename('wpi-pending'),
173
+            'delete_tax_rate'           => __('Are you sure you wish to delete this tax rate?', 'invoicing'),
174
+            'status_pending'            => wpinv_status_nicename('wpi-pending'),
175
+            'FillBillingDetails'        => __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing'),
176
+            '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'),
177
+            'AreYouSure'                => __('Are you sure?', 'invoicing'),
178
+            'errDeleteItem'             => __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing'),
179
+            'delete_subscription'       => __('Are you sure you want to delete this subscription?', 'invoicing'),
180
+            'action_edit'               => __('Edit', 'invoicing'),
181
+            'action_cancel'             => __('Cancel', 'invoicing'),
182
+            'item_description'          => __('Item Description', 'invoicing'),
183
+            'invoice_description'       => __('Invoice Description', 'invoicing'),
184
+            'discount_description'      => __('Discount Description', 'invoicing'),
185
+			'searching'                 => __('Searching', 'invoicing'),
186
+			'loading'                   => __('Loading...', 'invoicing'),
187
+			'search_customers'          => __('Enter customer name or email', 'invoicing'),
188
+			'search_items'              => __('Enter item name', 'invoicing'),
189 189
         );
190 190
 
191
-		if ( ! empty( $post ) && getpaid_is_invoice_post_type( $post->post_type ) ) {
191
+		if (!empty($post) && getpaid_is_invoice_post_type($post->post_type)) {
192 192
 
193
-			$invoice              = new WPInv_Invoice( $post );
193
+			$invoice              = new WPInv_Invoice($post);
194 194
 			$i18n['save_invoice'] = sprintf(
195
-				__( 'Save %s', 'invoicing' ),
196
-				ucfirst( $invoice->get_invoice_quote_type() )
195
+				__('Save %s', 'invoicing'),
196
+				ucfirst($invoice->get_invoice_quote_type())
197 197
 			);
198 198
 
199 199
 			$i18n['invoice_description'] = sprintf(
200
-				__( '%s Description', 'invoicing' ),
201
-				ucfirst( $invoice->get_invoice_quote_type() )
200
+				__('%s Description', 'invoicing'),
201
+				ucfirst($invoice->get_invoice_quote_type())
202 202
 			);
203 203
 
204 204
 		}
@@ -212,24 +212,24 @@  discard block
 block discarded – undo
212 212
 	 * @param  string $footer_text
213 213
 	 * @return string
214 214
 	 */
215
-	public function admin_footer_text( $footer_text ) {
215
+	public function admin_footer_text($footer_text) {
216 216
 		global $current_screen;
217 217
 
218
-		$page    = isset( $_GET['page'] ) ? $_GET['page'] : '';
218
+		$page = isset($_GET['page']) ? $_GET['page'] : '';
219 219
 
220
-        if ( ! empty( $current_screen->post_type ) ) {
220
+        if (!empty($current_screen->post_type)) {
221 221
 			$page = $current_screen->post_type;
222 222
         }
223 223
 
224 224
         // General styles.
225
-        if ( apply_filters( 'getpaid_display_admin_footer_text', wpinv_current_user_can_manage_invoicing() ) && false !== stripos( $page, 'wpi' ) ) {
225
+        if (apply_filters('getpaid_display_admin_footer_text', wpinv_current_user_can_manage_invoicing()) && false !== stripos($page, 'wpi')) {
226 226
 
227 227
 			// Change the footer text
228
-			if ( ! get_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', true ) ) {
228
+			if (!get_user_meta(get_current_user_id(), 'getpaid_admin_footer_text_rated', true)) {
229 229
 
230
-				$rating_url  = esc_url(
230
+				$rating_url = esc_url(
231 231
 					wp_nonce_url(
232
-						admin_url( 'admin.php?page=wpinv-reports&getpaid-admin-action=rate_plugin' ),
232
+						admin_url('admin.php?page=wpinv-reports&getpaid-admin-action=rate_plugin'),
233 233
 						'getpaid-nonce',
234 234
 						'getpaid-nonce'
235 235
 						)
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
 				$footer_text = sprintf(
239 239
 					/* translators: %s: five stars */
240
-					__( 'If you like <strong>GetPaid</strong>, please leave us a %s rating. A huge thanks in advance!', 'invoicing' ),
240
+					__('If you like <strong>GetPaid</strong>, please leave us a %s rating. A huge thanks in advance!', 'invoicing'),
241 241
 					"<a href='$rating_url'>&#9733;&#9733;&#9733;&#9733;&#9733;</a>"
242 242
 				);
243 243
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 
246 246
 				$footer_text = sprintf(
247 247
 					/* translators: %s: GetPaid */
248
-					__( 'Thank you for using %s!', 'invoicing' ),
248
+					__('Thank you for using %s!', 'invoicing'),
249 249
 					"<a href='https://wpgetpaid.com/' target='_blank'><strong>GetPaid</strong></a>"
250 250
 				);
251 251
 
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
 	 * @since  2.0.0
263 263
 	 */
264 264
 	public function redirect_to_wordpress_rating_page() {
265
-		update_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', 1 );
266
-		wp_redirect( 'https://wordpress.org/support/plugin/invoicing/reviews?rate=5#new-post' );
265
+		update_user_meta(get_current_user_id(), 'getpaid_admin_footer_text_rated', 1);
266
+		wp_redirect('https://wordpress.org/support/plugin/invoicing/reviews?rate=5#new-post');
267 267
 		exit;
268 268
 	}
269 269
 
@@ -274,30 +274,30 @@  discard block
 block discarded – undo
274 274
 	protected function load_payment_form_scripts() {
275 275
         global $post;
276 276
 
277
-        wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION );
278
-		wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION );
279
-		wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION );
277
+        wp_enqueue_script('vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION);
278
+		wp_enqueue_script('sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION);
279
+		wp_enqueue_script('vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array('sortable', 'vue'), WPINV_VERSION);
280 280
 
281
-		$version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' );
282
-		wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ),  $version );
281
+		$version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js');
282
+		wp_register_script('wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array('wpinv-admin-script', 'vue_draggable'), $version);
283 283
 
284 284
 		wp_localize_script(
285 285
             'wpinv-admin-payment-form-script',
286 286
             'wpinvPaymentFormAdmin',
287 287
             array(
288
-				'elements'      => wpinv_get_data( 'payment-form-elements' ),
289
-				'form_elements' => getpaid_get_payment_form_elements( $post->ID ),
288
+				'elements'      => wpinv_get_data('payment-form-elements'),
289
+				'form_elements' => getpaid_get_payment_form_elements($post->ID),
290 290
 				'currency'      => wpinv_currency_symbol(),
291 291
 				'position'      => wpinv_currency_position(),
292 292
 				'decimals'      => (int) wpinv_decimals(),
293 293
 				'thousands_sep' => wpinv_thousands_separator(),
294 294
 				'decimals_sep'  => wpinv_decimal_separator(),
295
-				'form_items'    => gepaid_get_form_items( $post->ID ),
295
+				'form_items'    => gepaid_get_form_items($post->ID),
296 296
 				'is_default'    => $post->ID == wpinv_get_default_payment_form(),
297 297
             )
298 298
         );
299 299
 
300
-        wp_enqueue_script( 'wpinv-admin-payment-form-script' );
300
+        wp_enqueue_script('wpinv-admin-payment-form-script');
301 301
 
302 302
     }
303 303
 
@@ -308,25 +308,25 @@  discard block
 block discarded – undo
308 308
      * @return string
309 309
 	 *
310 310
 	 */
311
-    public function admin_body_class( $classes ) {
311
+    public function admin_body_class($classes) {
312 312
 		global $pagenow, $post, $current_screen;
313 313
 
314 314
 
315
-        $page = isset( $_GET['page'] ) ? $_GET['page'] : '';
315
+        $page = isset($_GET['page']) ? $_GET['page'] : '';
316 316
 
317
-        if ( ! empty( $current_screen->post_type ) ) {
317
+        if (!empty($current_screen->post_type)) {
318 318
 			$page = $current_screen->post_type;
319 319
         }
320 320
 
321
-        if ( false !== stripos( $page, 'wpi' ) ) {
322
-            $classes .= ' wpi-' . sanitize_key( $page );
321
+        if (false !== stripos($page, 'wpi')) {
322
+            $classes .= ' wpi-' . sanitize_key($page);
323 323
         }
324 324
 
325
-        if ( in_array( $page, wpinv_parse_list( 'wpi_invoice wpi_payment_form wpi_quote' ) ) ) {
325
+        if (in_array($page, wpinv_parse_list('wpi_invoice wpi_payment_form wpi_quote'))) {
326 326
             $classes .= ' wpinv-cpt wpinv';
327 327
 		}
328 328
 		
329
-		if ( getpaid_is_invoice_post_type( $page ) ) {
329
+		if (getpaid_is_invoice_post_type($page)) {
330 330
             $classes .= ' getpaid-is-invoice-cpt';
331 331
         }
332 332
 
@@ -336,19 +336,19 @@  discard block
 block discarded – undo
336 336
     /**
337 337
 	 * Maybe show the AyeCode Connect Notice.
338 338
 	 */
339
-	public function init_ayecode_connect_helper(){
339
+	public function init_ayecode_connect_helper() {
340 340
 
341 341
         new AyeCode_Connect_Helper(
342 342
             array(
343
-				'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"),
344
-				'connect_external'  => __( "Please confirm you wish to connect your site?","invoicing" ),
345
-				'connect'           => sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s","invoicing" ),"<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>","</a>" ),
346
-				'connect_button'    => __("Connect Site","invoicing"),
347
-				'connecting_button'    => __("Connecting...","invoicing"),
348
-				'error_localhost'   => __( "This service will only work with a live domain, not a localhost.","invoicing" ),
349
-				'error'             => __( "Something went wrong, please refresh and try again.","invoicing" ),
343
+				'connect_title' => __("WP Invoicing - an AyeCode product!", "invoicing"),
344
+				'connect_external'  => __("Please confirm you wish to connect your site?", "invoicing"),
345
+				'connect'           => sprintf(__("<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s", "invoicing"), "<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>", "</a>"),
346
+				'connect_button'    => __("Connect Site", "invoicing"),
347
+				'connecting_button'    => __("Connecting...", "invoicing"),
348
+				'error_localhost'   => __("This service will only work with a live domain, not a localhost.", "invoicing"),
349
+				'error'             => __("Something went wrong, please refresh and try again.", "invoicing"),
350 350
             ),
351
-            array( 'wpi-addons' )
351
+            array('wpi-addons')
352 352
         );
353 353
 
354 354
     }
@@ -360,20 +360,20 @@  discard block
 block discarded – undo
360 360
 	 */
361 361
 	public function activation_redirect() {
362 362
 
363
-		$redirected = get_option( 'wpinv_redirected_to_settings' );
363
+		$redirected = get_option('wpinv_redirected_to_settings');
364 364
 
365
-		if ( ! empty( $redirected ) || wp_doing_ajax() || ! current_user_can( 'manage_options' ) ) {
365
+		if (!empty($redirected) || wp_doing_ajax() || !current_user_can('manage_options')) {
366 366
 			return;
367 367
 		}
368 368
 
369 369
 		// Bail if activating from network, or bulk
370
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
370
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
371 371
 			return;
372 372
 		}
373 373
 
374
-	    update_option( 'wpinv_redirected_to_settings', 1 );
374
+	    update_option('wpinv_redirected_to_settings', 1);
375 375
 
376
-        wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) );
376
+        wp_safe_redirect(admin_url('admin.php?page=wpinv-settings&tab=general'));
377 377
         exit;
378 378
 
379 379
 	}
@@ -383,9 +383,9 @@  discard block
 block discarded – undo
383 383
      */
384 384
     public function maybe_do_admin_action() {
385 385
 
386
-        if ( wpinv_current_user_can_manage_invoicing() && isset( $_REQUEST['getpaid-admin-action'] ) && isset( $_REQUEST['getpaid-nonce'] ) && wp_verify_nonce( $_REQUEST['getpaid-nonce'], 'getpaid-nonce' ) ) {
387
-            $key = sanitize_key( $_REQUEST['getpaid-admin-action'] );
388
-            do_action( "getpaid_authenticated_admin_action_$key", $_REQUEST );
386
+        if (wpinv_current_user_can_manage_invoicing() && isset($_REQUEST['getpaid-admin-action']) && isset($_REQUEST['getpaid-nonce']) && wp_verify_nonce($_REQUEST['getpaid-nonce'], 'getpaid-nonce')) {
387
+            $key = sanitize_key($_REQUEST['getpaid-admin-action']);
388
+            do_action("getpaid_authenticated_admin_action_$key", $_REQUEST);
389 389
         }
390 390
 
391 391
     }
@@ -395,16 +395,16 @@  discard block
 block discarded – undo
395 395
 	 * 
396 396
 	 * @param array $args
397 397
      */
398
-    public function send_customer_invoice( $args ) {
399
-		$sent = getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $args['invoice_id'] ), true );
398
+    public function send_customer_invoice($args) {
399
+		$sent = getpaid()->get('invoice_emails')->user_invoice(new WPInv_Invoice($args['invoice_id']), true);
400 400
 
401
-		if ( $sent ) {
402
-			$this->show_success( __( 'Invoice was successfully sent to the customer', 'invoicing' ) );
401
+		if ($sent) {
402
+			$this->show_success(__('Invoice was successfully sent to the customer', 'invoicing'));
403 403
 		} else {
404
-			$this->show_error( __( 'Could not send the invoice to the customer', 'invoicing' ) );
404
+			$this->show_error(__('Could not send the invoice to the customer', 'invoicing'));
405 405
 		}
406 406
 
407
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
407
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce', 'invoice_id')));
408 408
 		exit;
409 409
 	}
410 410
 
@@ -413,16 +413,16 @@  discard block
 block discarded – undo
413 413
 	 * 
414 414
 	 * @param array $args
415 415
      */
416
-    public function send_customer_payment_reminder( $args ) {
417
-		$sent = getpaid()->get( 'invoice_emails' )->force_send_overdue_notice( new WPInv_Invoice( $args['invoice_id'] ) );
416
+    public function send_customer_payment_reminder($args) {
417
+		$sent = getpaid()->get('invoice_emails')->force_send_overdue_notice(new WPInv_Invoice($args['invoice_id']));
418 418
 
419
-		if ( $sent ) {
420
-			$this->show_success( __( 'Payment reminder was successfully sent to the customer', 'invoicing' ) );
419
+		if ($sent) {
420
+			$this->show_success(__('Payment reminder was successfully sent to the customer', 'invoicing'));
421 421
 		} else {
422
-			$this->show_error( __( 'Could not sent payment reminder to the customer', 'invoicing' ) );
422
+			$this->show_error(__('Could not sent payment reminder to the customer', 'invoicing'));
423 423
 		}
424 424
 
425
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
425
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce', 'invoice_id')));
426 426
 		exit;
427 427
 	}
428 428
 
@@ -432,8 +432,8 @@  discard block
 block discarded – undo
432 432
      */
433 433
     public function admin_reset_tax_rates() {
434 434
 
435
-		update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) );
436
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
435
+		update_option('wpinv_tax_rates', wpinv_get_data('tax-rates'));
436
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
437 437
 		exit;
438 438
 
439 439
 	}
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
     public function admin_create_missing_pages() {
446 446
 		$installer = new GetPaid_Installer();
447 447
 		$installer->create_pages();
448
-		$this->show_success( __( 'GetPaid pages updated.', 'invoicing' ) );
449
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
448
+		$this->show_success(__('GetPaid pages updated.', 'invoicing'));
449
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
450 450
 		exit;
451 451
 	}
452 452
 
@@ -458,35 +458,35 @@  discard block
 block discarded – undo
458 458
 		global $wpdb;
459 459
 		$installer = new GetPaid_Installer();
460 460
 
461
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}wpinv_subscriptions'" ) != $wpdb->prefix . 'wpinv_subscriptions' ) {
461
+		if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}wpinv_subscriptions'") != $wpdb->prefix . 'wpinv_subscriptions') {
462 462
 			$installer->create_subscriptions_table();
463 463
 
464
-			if ( $wpdb->last_error !== '' ) {
465
-				$this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error );
464
+			if ($wpdb->last_error !== '') {
465
+				$this->show_error(__('Your GetPaid tables have been updated:', 'invoicing') . ' ' . $wpdb->last_error);
466 466
 			}
467 467
 		}
468 468
 
469
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoices'" ) != $wpdb->prefix . 'getpaid_invoices' ) {
469
+		if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoices'") != $wpdb->prefix . 'getpaid_invoices') {
470 470
 			$installer->create_invoices_table();
471 471
 
472
-			if ( $wpdb->last_error !== '' ) {
473
-				$this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error );
472
+			if ($wpdb->last_error !== '') {
473
+				$this->show_error(__('Your GetPaid tables have been updated:', 'invoicing') . ' ' . $wpdb->last_error);
474 474
 			}
475 475
 		}
476 476
 
477
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoice_items'" ) != $wpdb->prefix . 'getpaid_invoice_items' ) {
477
+		if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoice_items'") != $wpdb->prefix . 'getpaid_invoice_items') {
478 478
 			$installer->create_invoice_items_table();
479 479
 
480
-			if ( $wpdb->last_error !== '' ) {
481
-				$this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error );
480
+			if ($wpdb->last_error !== '') {
481
+				$this->show_error(__('Your GetPaid tables have been updated:', 'invoicing') . ' ' . $wpdb->last_error);
482 482
 			}
483 483
 		}
484 484
 
485
-		if ( ! $this->has_notices() ) {
486
-			$this->show_success( __( 'Your GetPaid tables have been updated.', 'invoicing' ) );
485
+		if (!$this->has_notices()) {
486
+			$this->show_success(__('Your GetPaid tables have been updated.', 'invoicing'));
487 487
 		}
488 488
 
489
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
489
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
490 490
 		exit;
491 491
 	}
492 492
 
@@ -501,10 +501,10 @@  discard block
 block discarded – undo
501 501
 		$installer->migrate_old_invoices();
502 502
 
503 503
 		// Show an admin message.
504
-		$this->show_success( __( 'Your invoices have been migrated.', 'invoicing' ) );
504
+		$this->show_success(__('Your invoices have been migrated.', 'invoicing'));
505 505
 
506 506
 		// Redirect the admin.
507
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
507
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
508 508
 		exit;
509 509
 
510 510
 	}
@@ -516,18 +516,18 @@  discard block
 block discarded – undo
516 516
     public function admin_download_customers() {
517 517
 		global $wpdb;
518 518
 
519
-		$output = fopen( 'php://output', 'w' ) or die( __( 'Unsupported server', 'invoicing' ) );
519
+		$output = fopen('php://output', 'w') or die(__('Unsupported server', 'invoicing'));
520 520
 
521
-		header( "Content-Type:text/csv" );
522
-		header( "Content-Disposition:attachment;filename=customers.csv" );
521
+		header("Content-Type:text/csv");
522
+		header("Content-Disposition:attachment;filename=customers.csv");
523 523
 
524 524
 		$post_types = '';
525 525
 
526
-		foreach ( array_keys( getpaid_get_invoice_post_types() ) as $post_type ) {
527
-			$post_types .= $wpdb->prepare( "post_type=%s OR ", $post_type );
526
+		foreach (array_keys(getpaid_get_invoice_post_types()) as $post_type) {
527
+			$post_types .= $wpdb->prepare("post_type=%s OR ", $post_type);
528 528
 		}
529 529
 
530
-		$post_types = rtrim( $post_types, ' OR' );
530
+		$post_types = rtrim($post_types, ' OR');
531 531
 
532 532
 		$customers = $wpdb->get_col(
533 533
 			$wpdb->prepare(
@@ -536,57 +536,57 @@  discard block
 block discarded – undo
536 536
 		);
537 537
 
538 538
 		$columns = array(
539
-			'name'     => __( 'Name', 'invoicing' ),
540
-			'email'    => __( 'Email', 'invoicing' ),
541
-			'country'  => __( 'Country', 'invoicing' ),
542
-			'state'    => __( 'State', 'invoicing' ),
543
-			'city'     => __( 'City', 'invoicing' ),
544
-			'zip'      => __( 'ZIP', 'invoicing' ),
545
-			'address'  => __( 'Address', 'invoicing' ),
546
-			'phone'    => __( 'Phone', 'invoicing' ),
547
-			'company'  => __( 'Company', 'invoicing' ),
548
-			'invoices' => __( 'Invoices', 'invoicing' ),
549
-			'total'    => __( 'Total Spend', 'invoicing' ),
550
-			'signup'   => __( 'Date created', 'invoicing' ),
539
+			'name'     => __('Name', 'invoicing'),
540
+			'email'    => __('Email', 'invoicing'),
541
+			'country'  => __('Country', 'invoicing'),
542
+			'state'    => __('State', 'invoicing'),
543
+			'city'     => __('City', 'invoicing'),
544
+			'zip'      => __('ZIP', 'invoicing'),
545
+			'address'  => __('Address', 'invoicing'),
546
+			'phone'    => __('Phone', 'invoicing'),
547
+			'company'  => __('Company', 'invoicing'),
548
+			'invoices' => __('Invoices', 'invoicing'),
549
+			'total'    => __('Total Spend', 'invoicing'),
550
+			'signup'   => __('Date created', 'invoicing'),
551 551
 		);
552 552
 
553 553
 		// Output the csv column headers.
554
-		fputcsv( $output, array_values( $columns ) );
554
+		fputcsv($output, array_values($columns));
555 555
 
556 556
 		// Loop through
557 557
 		$table = new WPInv_Customers_Table();
558
-		foreach ( $customers as $customer_id ) {
558
+		foreach ($customers as $customer_id) {
559 559
 
560
-			$user = get_user_by( 'id', $customer_id );
560
+			$user = get_user_by('id', $customer_id);
561 561
 			$row  = array();
562
-			if ( empty( $user ) ) {
562
+			if (empty($user)) {
563 563
 				continue;
564 564
 			}
565 565
 
566
-			foreach ( array_keys( $columns ) as $column ) {
566
+			foreach (array_keys($columns) as $column) {
567 567
 
568 568
 				$method = 'column_' . $column;
569 569
 
570
-				if ( 'name' == $column ) {
571
-					$value = sanitize_text_field( $user->display_name );
572
-				} else if( 'email' == $column ) {
573
-					$value = sanitize_email( $user->user_email );
574
-				} else if ( is_callable( array( $table, $method ) ) ) {
575
-					$value = strip_tags( $table->$method( $user ) );
570
+				if ('name' == $column) {
571
+					$value = sanitize_text_field($user->display_name);
572
+				} else if ('email' == $column) {
573
+					$value = sanitize_email($user->user_email);
574
+				} else if (is_callable(array($table, $method))) {
575
+					$value = strip_tags($table->$method($user));
576 576
 				}
577 577
 
578
-				if ( empty( $value ) ) {
579
-					$value = sanitize_text_field( get_user_meta( $user->ID, '_wpinv_' . $column, true ) );
578
+				if (empty($value)) {
579
+					$value = sanitize_text_field(get_user_meta($user->ID, '_wpinv_' . $column, true));
580 580
 				}
581 581
 
582 582
 				$row[] = $value;
583 583
 
584 584
 			}
585 585
 
586
-			fputcsv( $output, $row );
586
+			fputcsv($output, $row);
587 587
 		}
588 588
 
589
-		fclose( $output );
589
+		fclose($output);
590 590
 		exit;
591 591
 
592 592
 	}
@@ -600,36 +600,36 @@  discard block
 block discarded – undo
600 600
 
601 601
 		// Fetch all invoices that have discount codes.
602 602
 		$table    = $wpdb->prefix . 'getpaid_invoices';
603
-		$invoices = $wpdb->get_col( "SELECT `post_id` FROM `$table` WHERE `discount` = 0 && `discount_code` <> ''" );
603
+		$invoices = $wpdb->get_col("SELECT `post_id` FROM `$table` WHERE `discount` = 0 && `discount_code` <> ''");
604 604
 
605
-		foreach ( $invoices as $invoice ) {
605
+		foreach ($invoices as $invoice) {
606 606
 
607
-			$invoice = new WPInv_Invoice( $invoice );
607
+			$invoice = new WPInv_Invoice($invoice);
608 608
 
609
-			if ( ! $invoice->exists() ) {
609
+			if (!$invoice->exists()) {
610 610
 				continue;
611 611
 			}
612 612
 
613 613
 			// Abort if the discount does not exist or does not apply here.
614
-			$discount = new WPInv_Discount( $invoice->get_discount_code() );
615
-			if ( ! $discount->exists() ) {
614
+			$discount = new WPInv_Discount($invoice->get_discount_code());
615
+			if (!$discount->exists()) {
616 616
 				continue;
617 617
 			}
618 618
 
619
-			$invoice->add_discount( getpaid_calculate_invoice_discount( $invoice, $discount ) );
619
+			$invoice->add_discount(getpaid_calculate_invoice_discount($invoice, $discount));
620 620
 			$invoice->recalculate_total();
621 621
 
622
-			if ( $invoice->get_total_discount() > 0 ) {
622
+			if ($invoice->get_total_discount() > 0) {
623 623
 				$invoice->save();
624 624
 			}
625 625
 
626 626
 		}
627 627
 
628 628
 		// Show an admin message.
629
-		$this->show_success( __( 'Discounts have been recalculated.', 'invoicing' ) );
629
+		$this->show_success(__('Discounts have been recalculated.', 'invoicing'));
630 630
 
631 631
 		// Redirect the admin.
632
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
632
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
633 633
 		exit;
634 634
 
635 635
 	}
@@ -641,8 +641,8 @@  discard block
 block discarded – undo
641 641
      * @return array
642 642
 	 */
643 643
 	public function get_notices() {
644
-		$notices = get_option( 'wpinv_admin_notices' );
645
-        return is_array( $notices ) ? $notices : array();
644
+		$notices = get_option('wpinv_admin_notices');
645
+        return is_array($notices) ? $notices : array();
646 646
 	}
647 647
 
648 648
 	/**
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
      * @return array
653 653
 	 */
654 654
 	public function has_notices() {
655
-		return count( $this->get_notices() ) > 0;
655
+		return count($this->get_notices()) > 0;
656 656
 	}
657 657
 
658 658
 	/**
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 	 * @since       1.0.19
663 663
 	 */
664 664
 	public function clear_notices() {
665
-		delete_option( 'wpinv_admin_notices' );
665
+		delete_option('wpinv_admin_notices');
666 666
 	}
667 667
 
668 668
 	/**
@@ -671,16 +671,16 @@  discard block
 block discarded – undo
671 671
 	 * @access      public
672 672
 	 * @since       1.0.19
673 673
 	 */
674
-	public function save_notice( $type, $message ) {
674
+	public function save_notice($type, $message) {
675 675
 		$notices = $this->get_notices();
676 676
 
677
-		if ( empty( $notices[ $type ] ) || ! is_array( $notices[ $type ]) ) {
678
-			$notices[ $type ] = array();
677
+		if (empty($notices[$type]) || !is_array($notices[$type])) {
678
+			$notices[$type] = array();
679 679
 		}
680 680
 
681
-		$notices[ $type ][] = $message;
681
+		$notices[$type][] = $message;
682 682
 
683
-		update_option( 'wpinv_admin_notices', $notices );
683
+		update_option('wpinv_admin_notices', $notices);
684 684
 	}
685 685
 
686 686
 	/**
@@ -690,8 +690,8 @@  discard block
 block discarded – undo
690 690
 	 * @access      public
691 691
 	 * @since       1.0.19
692 692
 	 */
693
-	public function show_success( $msg ) {
694
-		$this->save_notice( 'success', $msg );
693
+	public function show_success($msg) {
694
+		$this->save_notice('success', $msg);
695 695
 	}
696 696
 
697 697
 	/**
@@ -701,8 +701,8 @@  discard block
 block discarded – undo
701 701
 	 * @param       string $msg The message to qeue.
702 702
 	 * @since       1.0.19
703 703
 	 */
704
-	public function show_error( $msg ) {
705
-		$this->save_notice( 'error', $msg );
704
+	public function show_error($msg) {
705
+		$this->save_notice('error', $msg);
706 706
 	}
707 707
 
708 708
 	/**
@@ -712,8 +712,8 @@  discard block
 block discarded – undo
712 712
 	 * @param       string $msg The message to qeue.
713 713
 	 * @since       1.0.19
714 714
 	 */
715
-	public function show_warning( $msg ) {
716
-		$this->save_notice( 'warning', $msg );
715
+	public function show_warning($msg) {
716
+		$this->save_notice('warning', $msg);
717 717
 	}
718 718
 
719 719
 	/**
@@ -723,8 +723,8 @@  discard block
 block discarded – undo
723 723
 	 * @param       string $msg The message to qeue.
724 724
 	 * @since       1.0.19
725 725
 	 */
726
-	public function show_info( $msg ) {
727
-		$this->save_notice( 'info', $msg );
726
+	public function show_info($msg) {
727
+		$this->save_notice('info', $msg);
728 728
 	}
729 729
 
730 730
 	/**
@@ -738,30 +738,30 @@  discard block
 block discarded – undo
738 738
         $notices = $this->get_notices();
739 739
         $this->clear_notices();
740 740
 
741
-		foreach ( $notices as $type => $messages ) {
741
+		foreach ($notices as $type => $messages) {
742 742
 
743
-			if ( ! is_array( $messages ) ) {
743
+			if (!is_array($messages)) {
744 744
 				continue;
745 745
 			}
746 746
 
747
-            $type  = sanitize_key( $type );
748
-			foreach ( $messages as $message ) {
749
-                $message = wp_kses_post( $message );
747
+            $type = sanitize_key($type);
748
+			foreach ($messages as $message) {
749
+                $message = wp_kses_post($message);
750 750
 				echo "<div class='notice notice-$type is-dismissible'><p>$message</p></div>";
751 751
             }
752 752
 
753 753
         }
754 754
 
755
-		foreach ( array( 'checkout_page', 'invoice_history_page', 'success_page', 'failure_page', 'invoice_subscription_page' ) as $page ) {
755
+		foreach (array('checkout_page', 'invoice_history_page', 'success_page', 'failure_page', 'invoice_subscription_page') as $page) {
756 756
 
757
-			if ( ! is_numeric( wpinv_get_option( $page, false ) ) ) {
758
-				$url     = wp_nonce_url(
759
-					add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ),
757
+			if (!is_numeric(wpinv_get_option($page, false))) {
758
+				$url = wp_nonce_url(
759
+					add_query_arg('getpaid-admin-action', 'create_missing_pages'),
760 760
 					'getpaid-nonce',
761 761
 					'getpaid-nonce'
762 762
 				);
763
-				$message  = __( 'Some GetPaid pages are missing. To use GetPaid without any issues, click the button below to generate the missing pages.', 'invoicing' );
764
-				$message2 = __( 'Generate Pages', 'invoicing' );
763
+				$message  = __('Some GetPaid pages are missing. To use GetPaid without any issues, click the button below to generate the missing pages.', 'invoicing');
764
+				$message2 = __('Generate Pages', 'invoicing');
765 765
 				echo "<div class='notice notice-warning is-dismissible'><p>$message<br><br><a href='$url' class='button button-primary'>$message2</a></p></div>";
766 766
 				break;
767 767
 			}
Please login to merge, or discard this patch.
includes/admin/html-admin-page-addons.php 3 patches
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 if ( ! defined( 'ABSPATH' ) ) {
7
-	exit;
7
+    exit;
8 8
 }
9 9
 add_ThickBox();
10 10
 ?>
@@ -14,18 +14,18 @@  discard block
 block discarded – undo
14 14
 	<?php if ( $tabs ){ ?>
15 15
 		<nav class="nav-tab-wrapper wpi-nav-tab-wrapper">
16 16
 			<?php
17
-			foreach ( $tabs as $name => $label ) {
18
-				echo '<a href="' . admin_url( 'admin.php?page=wpi-addons&tab=' . $name ) . '" class="nav-tab ' . ( $current_tab == $name ? 'nav-tab-active' : '' ) . '">' . $label . '</a>';
19
-			}
20
-			do_action( 'wpi_addons_tabs' );
21
-			?>
17
+            foreach ( $tabs as $name => $label ) {
18
+                echo '<a href="' . admin_url( 'admin.php?page=wpi-addons&tab=' . $name ) . '" class="nav-tab ' . ( $current_tab == $name ? 'nav-tab-active' : '' ) . '">' . $label . '</a>';
19
+            }
20
+            do_action( 'wpi_addons_tabs' );
21
+            ?>
22 22
 		</nav>
23 23
 
24 24
 		<?php
25 25
 
26
-		if($current_tab == 'membership'){
26
+        if($current_tab == 'membership'){
27 27
 
28
-			?>
28
+            ?>
29 29
 
30 30
 			<div class="wpi-membership-tab-conatiner">
31 31
 				<div class="membership-content">
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 					<h2><?php _e("Have a membership key?","invoicing");?></h2>
37 37
 					<p>
38 38
 						<?php
39
-						$wpeu_admin = new External_Updates_Admin('wpinvoicing.com','1');
40
-						echo $wpeu_admin->render_licence_actions('wpinvoicing.com', 'membership',array(95, 106, 108,12351));
41
-						?>
39
+                        $wpeu_admin = new External_Updates_Admin('wpinvoicing.com','1');
40
+                        echo $wpeu_admin->render_licence_actions('wpinvoicing.com', 'membership',array(95, 106, 108,12351));
41
+                        ?>
42 42
 					</p>
43 43
 				<?php }?>
44 44
 
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 							<div class="feature-list">
49 49
 								<ul>
50 50
 									<?php
51
-									$addon_obj = new WPInv_Admin_Addons();
52
-									if ($addons = $addon_obj->get_section_data( 'addons' ) ) {
53
-										foreach ( $addons as $addon ) {
54
-											echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>';
55
-										}
56
-									}
57
-									?>
51
+                                    $addon_obj = new WPInv_Admin_Addons();
52
+                                    if ($addons = $addon_obj->get_section_data( 'addons' ) ) {
53
+                                        foreach ( $addons as $addon ) {
54
+                                            echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>';
55
+                                        }
56
+                                    }
57
+                                    ?>
58 58
 									</ul>
59 59
 
60 60
 									<div class="feature-cta">
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
 									<h3><?php _e("Included Gateways:","invoicing");?></h3>
66 66
 									<ul>
67 67
 										<?php
68
-										if ($addons = $addon_obj->get_section_data( 'gateways' ) ) {
69
-											foreach ( $addons as $addon ) {
70
-												echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>';
71
-											}
72
-										}
73
-										?>
68
+                                        if ($addons = $addon_obj->get_section_data( 'gateways' ) ) {
69
+                                            foreach ( $addons as $addon ) {
70
+                                                echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>';
71
+                                            }
72
+                                        }
73
+                                        ?>
74 74
 								</ul>
75 75
 							</div>
76 76
 
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 						<div class="testimonial-content">
82 82
 							<div class="t-image">
83 83
 								<?php
84
-									echo '<img src="' . plugins_url( 'images/t-image2.png', dirname(__FILE__) ) . '" > ';
85
-								?>
84
+                                    echo '<img src="' . plugins_url( 'images/t-image2.png', dirname(__FILE__) ) . '" > ';
85
+                                ?>
86 86
 							</div>
87 87
 							<div class="t-content">
88 88
 								<p>
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 						<div class="testimonial-content">
102 102
 							<div class="t-image">
103 103
 								<?php
104
-									echo '<img src="' . plugins_url( 'images/t-image1.png', dirname(__FILE__) ) . '" > ';
105
-								?>
104
+                                    echo '<img src="' . plugins_url( 'images/t-image1.png', dirname(__FILE__) ) . '" > ';
105
+                                ?>
106 106
 							</div>
107 107
 							<div class="t-content">
108 108
 								<p>
@@ -126,21 +126,21 @@  discard block
 block discarded – undo
126 126
 			</div>
127 127
 		</div>
128 128
 			<?php
129
-		}else{
130
-			$installed_plugins = get_plugins();
129
+        }else{
130
+            $installed_plugins = get_plugins();
131 131
             $addon_obj = new WPInv_Admin_Addons();
132
-			if ($addons = $addon_obj->get_section_data( $current_tab ) ) :
133
-				//print_r($addons);
134
-				?>
132
+            if ($addons = $addon_obj->get_section_data( $current_tab ) ) :
133
+                //print_r($addons);
134
+                ?>
135 135
 				<ul class="wpi-products"><?php foreach ( $addons as $addon ) :
136 136
                         if(965==$addon->info->id){continue;}// don't show quote add on
137
-						?><li class="wpi-product">
137
+                        ?><li class="wpi-product">
138 138
 								<div class="wpi-product-title">
139 139
 									<h3><?php
140
-										if ( ! empty( $addon->info->excerpt) ){
141
-											echo wpi_help_tip( $addon->info->excerpt );
142
-										}
143
-										echo esc_html( $addon->info->title ); ?></h3>
140
+                                        if ( ! empty( $addon->info->excerpt) ){
141
+                                            echo wpi_help_tip( $addon->info->excerpt );
142
+                                        }
143
+                                        echo esc_html( $addon->info->title ); ?></h3>
144 144
 								</div>
145 145
 
146 146
 								<span class="wpi-product-image">
@@ -148,32 +148,32 @@  discard block
 block discarded – undo
148 148
 										<img src="<?php echo esc_attr( $addon->info->thumbnail ); ?>"/>
149 149
 									<?php endif;
150 150
 
151
-									if ( 'stripe-payment-gateway' == $addon->info->slug ) {
152
-										$addon->info->slug = 'getpaid-stripe-payments';
153
-										$addon->info->link = 'https://wordpress.org/plugins/getpaid-stripe-payments/';
154
-									}
155
-
156
-									if(isset($addon->info->link) && substr( $addon->info->link, 0, 21 ) === "https://wordpress.org"){
157
-										echo '<a href="'.admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug).'&width=770&height=660&TB_iframe=true" class="thickbox" >';
158
-										echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>';
159
-										echo '</a>';
160
-									}elseif(isset($addon->info->link) && ( substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com" || substr( $addon->info->link, 0, 21 ) === "https://wpgetpaid.com" ) ){
161
-										if(defined('WP_EASY_UPDATES_ACTIVE')){
162
-											$url = admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug.'&width=770&height=660&item_id='.$addon->info->id.'&update_url=https://wpgetpaid.com&TB_iframe=true');
163
-										}else{
164
-											// if installed show activation link
165
-											if(isset($installed_plugins['wp-easy-updates/external-updates.php'])){
166
-												$url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-activation';
167
-											}else{
168
-												$url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-for-external';
169
-											}
170
-										}
171
-										echo '<a href="'.$url.'" class="thickbox">';
172
-										echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>';
173
-										echo '</a>';
174
-									}
175
-
176
-									?>
151
+                                    if ( 'stripe-payment-gateway' == $addon->info->slug ) {
152
+                                        $addon->info->slug = 'getpaid-stripe-payments';
153
+                                        $addon->info->link = 'https://wordpress.org/plugins/getpaid-stripe-payments/';
154
+                                    }
155
+
156
+                                    if(isset($addon->info->link) && substr( $addon->info->link, 0, 21 ) === "https://wordpress.org"){
157
+                                        echo '<a href="'.admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug).'&width=770&height=660&TB_iframe=true" class="thickbox" >';
158
+                                        echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>';
159
+                                        echo '</a>';
160
+                                    }elseif(isset($addon->info->link) && ( substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com" || substr( $addon->info->link, 0, 21 ) === "https://wpgetpaid.com" ) ){
161
+                                        if(defined('WP_EASY_UPDATES_ACTIVE')){
162
+                                            $url = admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug.'&width=770&height=660&item_id='.$addon->info->id.'&update_url=https://wpgetpaid.com&TB_iframe=true');
163
+                                        }else{
164
+                                            // if installed show activation link
165
+                                            if(isset($installed_plugins['wp-easy-updates/external-updates.php'])){
166
+                                                $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-activation';
167
+                                            }else{
168
+                                                $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-for-external';
169
+                                            }
170
+                                        }
171
+                                        echo '<a href="'.$url.'" class="thickbox">';
172
+                                        echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>';
173
+                                        echo '</a>';
174
+                                    }
175
+
176
+                                    ?>
177 177
 
178 178
 								</span>
179 179
 
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
 								<span class="wpi-product-button">
182 182
 									<?php
183 183
                                     $addon_obj->output_button( $addon );
184
-									?>
184
+                                    ?>
185 185
 								</span>
186 186
 
187 187
 								<span class="wpi-price"><?php //print_r($addon); //echo wp_kses_post( $addon->price ); ?></span></li><?php endforeach; ?></ul>
188 188
 			<?php endif;
189
-		}
189
+        }
190 190
 
191
-	}
192
-	?>
191
+    }
192
+    ?>
193 193
 
194 194
 
195 195
 	<div class="clearfix" ></div>
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 			<input class="wpeu-licence-key" type="text" placeholder="<?php _e("Enter your licence key",'invoicing');?>"> <button class="button-primary wpeu-licence-popup-button" ><?php _e("Install",'invoicing');?></button>
209 209
 			<br>
210 210
 			<?php
211
-			echo sprintf( __('%sFind your licence key here%s OR %sBuy one here%s', 'invoicing'), '<a href="https://wpinvoicing.com/your-account/" target="_blank">','</a>','<a class="wpeu-licence-link" href="https://wpinvoicing.com/downloads/category/addons/" target="_blank">','</a>' );
212
-			?>
211
+            echo sprintf( __('%sFind your licence key here%s OR %sBuy one here%s', 'invoicing'), '<a href="https://wpinvoicing.com/your-account/" target="_blank">','</a>','<a class="wpeu-licence-link" href="https://wpinvoicing.com/downloads/category/addons/" target="_blank">','</a>' );
212
+            ?>
213 213
 		</span>
214 214
 	</div>
215 215
 
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Admin View: Page - Addons
4 4
  *
5 5
  */
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if (!defined('ABSPATH')) {
7 7
 	exit;
8 8
 }
9 9
 add_ThickBox();
@@ -11,19 +11,19 @@  discard block
 block discarded – undo
11 11
 <div class="wrap wpi_addons_wrap">
12 12
 	<h1><?php echo get_admin_page_title(); ?></h1>
13 13
 
14
-	<?php if ( $tabs ){ ?>
14
+	<?php if ($tabs) { ?>
15 15
 		<nav class="nav-tab-wrapper wpi-nav-tab-wrapper">
16 16
 			<?php
17
-			foreach ( $tabs as $name => $label ) {
18
-				echo '<a href="' . admin_url( 'admin.php?page=wpi-addons&tab=' . $name ) . '" class="nav-tab ' . ( $current_tab == $name ? 'nav-tab-active' : '' ) . '">' . $label . '</a>';
17
+			foreach ($tabs as $name => $label) {
18
+				echo '<a href="' . admin_url('admin.php?page=wpi-addons&tab=' . $name) . '" class="nav-tab ' . ($current_tab == $name ? 'nav-tab-active' : '') . '">' . $label . '</a>';
19 19
 			}
20
-			do_action( 'wpi_addons_tabs' );
20
+			do_action('wpi_addons_tabs');
21 21
 			?>
22 22
 		</nav>
23 23
 
24 24
 		<?php
25 25
 
26
-		if($current_tab == 'membership'){
26
+		if ($current_tab == 'membership') {
27 27
 
28 28
 			?>
29 29
 
@@ -32,42 +32,42 @@  discard block
 block discarded – undo
32 32
 <!--
33 33
 				<h2>With our WPInvoicing Membership you get access to all our products!</h2>
34 34
 				<p><a class="button button-primary" href="https://wpinvoicing.com/downloads/membership/">View Memberships</a></p>-->
35
-				<?php if(defined('WP_EASY_UPDATES_ACTIVE')){?>
36
-					<h2><?php _e("Have a membership key?","invoicing");?></h2>
35
+				<?php if (defined('WP_EASY_UPDATES_ACTIVE')) {?>
36
+					<h2><?php _e("Have a membership key?", "invoicing"); ?></h2>
37 37
 					<p>
38 38
 						<?php
39
-						$wpeu_admin = new External_Updates_Admin('wpinvoicing.com','1');
40
-						echo $wpeu_admin->render_licence_actions('wpinvoicing.com', 'membership',array(95, 106, 108,12351));
39
+						$wpeu_admin = new External_Updates_Admin('wpinvoicing.com', '1');
40
+						echo $wpeu_admin->render_licence_actions('wpinvoicing.com', 'membership', array(95, 106, 108, 12351));
41 41
 						?>
42 42
 					</p>
43 43
 				<?php }?>
44 44
 
45 45
 				<div class="membership-cta-contet">
46 46
 					<div class="main-cta">
47
-							<h2><?php _e("Membership benefits Include:","invoicing");?></h2>
47
+							<h2><?php _e("Membership benefits Include:", "invoicing"); ?></h2>
48 48
 							<div class="feature-list">
49 49
 								<ul>
50 50
 									<?php
51 51
 									$addon_obj = new WPInv_Admin_Addons();
52
-									if ($addons = $addon_obj->get_section_data( 'addons' ) ) {
53
-										foreach ( $addons as $addon ) {
54
-											echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>';
52
+									if ($addons = $addon_obj->get_section_data('addons')) {
53
+										foreach ($addons as $addon) {
54
+											echo '<li><i class="far fa-check-circle fa-sm"></i> ' . esc_html($addon->info->title) . '</li>';
55 55
 										}
56 56
 									}
57 57
 									?>
58 58
 									</ul>
59 59
 
60 60
 									<div class="feature-cta">
61
-										<h3><?php _e("Membership Starts from","invoicing");?></h3>
61
+										<h3><?php _e("Membership Starts from", "invoicing"); ?></h3>
62 62
 										<h4>$99</h4>
63
-										<a href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php _e("Buy Membership","invoicing");?></a>
63
+										<a href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php _e("Buy Membership", "invoicing"); ?></a>
64 64
 									</div>
65
-									<h3><?php _e("Included Gateways:","invoicing");?></h3>
65
+									<h3><?php _e("Included Gateways:", "invoicing"); ?></h3>
66 66
 									<ul>
67 67
 										<?php
68
-										if ($addons = $addon_obj->get_section_data( 'gateways' ) ) {
69
-											foreach ( $addons as $addon ) {
70
-												echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>';
68
+										if ($addons = $addon_obj->get_section_data('gateways')) {
69
+											foreach ($addons as $addon) {
70
+												echo '<li><i class="far fa-check-circle fa-sm"></i> ' . esc_html($addon->info->title) . '</li>';
71 71
 											}
72 72
 										}
73 73
 										?>
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 						<div class="testimonial-content">
82 82
 							<div class="t-image">
83 83
 								<?php
84
-									echo '<img src="' . plugins_url( 'images/t-image2.png', dirname(__FILE__) ) . '" > ';
84
+									echo '<img src="' . plugins_url('images/t-image2.png', dirname(__FILE__)) . '" > ';
85 85
 								?>
86 86
 							</div>
87 87
 							<div class="t-content">
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 						<div class="testimonial-content">
102 102
 							<div class="t-image">
103 103
 								<?php
104
-									echo '<img src="' . plugins_url( 'images/t-image1.png', dirname(__FILE__) ) . '" > ';
104
+									echo '<img src="' . plugins_url('images/t-image1.png', dirname(__FILE__)) . '" > ';
105 105
 								?>
106 106
 							</div>
107 107
 							<div class="t-content">
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 						</div>
118 118
 					</div>
119 119
 					<div class="member-footer">
120
-						<a class="footer-btn" href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php _e("Buy Membership","invoicing");?></a>
121
-						<a class="footer-link" href="post-new.php?post_type=wpi_invoice"><?php _e("Create Invoice","invoicing");?></a>
120
+						<a class="footer-btn" href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php _e("Buy Membership", "invoicing"); ?></a>
121
+						<a class="footer-link" href="post-new.php?post_type=wpi_invoice"><?php _e("Create Invoice", "invoicing"); ?></a>
122 122
 					</div>
123 123
 				</div>
124 124
 
@@ -126,50 +126,50 @@  discard block
 block discarded – undo
126 126
 			</div>
127 127
 		</div>
128 128
 			<?php
129
-		}else{
129
+		} else {
130 130
 			$installed_plugins = get_plugins();
131 131
             $addon_obj = new WPInv_Admin_Addons();
132
-			if ($addons = $addon_obj->get_section_data( $current_tab ) ) :
132
+			if ($addons = $addon_obj->get_section_data($current_tab)) :
133 133
 				//print_r($addons);
134 134
 				?>
135
-				<ul class="wpi-products"><?php foreach ( $addons as $addon ) :
136
-                        if(965==$addon->info->id){continue;}// don't show quote add on
135
+				<ul class="wpi-products"><?php foreach ($addons as $addon) :
136
+                        if (965 == $addon->info->id) {continue; }// don't show quote add on
137 137
 						?><li class="wpi-product">
138 138
 								<div class="wpi-product-title">
139 139
 									<h3><?php
140
-										if ( ! empty( $addon->info->excerpt) ){
141
-											echo wpi_help_tip( $addon->info->excerpt );
140
+										if (!empty($addon->info->excerpt)) {
141
+											echo wpi_help_tip($addon->info->excerpt);
142 142
 										}
143
-										echo esc_html( $addon->info->title ); ?></h3>
143
+										echo esc_html($addon->info->title); ?></h3>
144 144
 								</div>
145 145
 
146 146
 								<span class="wpi-product-image">
147
-									<?php if ( ! empty( $addon->info->thumbnail) ) : ?>
148
-										<img src="<?php echo esc_attr( $addon->info->thumbnail ); ?>"/>
147
+									<?php if (!empty($addon->info->thumbnail)) : ?>
148
+										<img src="<?php echo esc_attr($addon->info->thumbnail); ?>"/>
149 149
 									<?php endif;
150 150
 
151
-									if ( 'stripe-payment-gateway' == $addon->info->slug ) {
151
+									if ('stripe-payment-gateway' == $addon->info->slug) {
152 152
 										$addon->info->slug = 'getpaid-stripe-payments';
153 153
 										$addon->info->link = 'https://wordpress.org/plugins/getpaid-stripe-payments/';
154 154
 									}
155 155
 
156
-									if(isset($addon->info->link) && substr( $addon->info->link, 0, 21 ) === "https://wordpress.org"){
157
-										echo '<a href="'.admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug).'&width=770&height=660&TB_iframe=true" class="thickbox" >';
158
-										echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>';
156
+									if (isset($addon->info->link) && substr($addon->info->link, 0, 21) === "https://wordpress.org") {
157
+										echo '<a href="' . admin_url('/plugin-install.php?tab=plugin-information&plugin=' . $addon->info->slug) . '&width=770&height=660&TB_iframe=true" class="thickbox" >';
158
+										echo '<span class="wpi-product-info">' . __('More info', 'invoicing') . '</span>';
159 159
 										echo '</a>';
160
-									}elseif(isset($addon->info->link) && ( substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com" || substr( $addon->info->link, 0, 21 ) === "https://wpgetpaid.com" ) ){
161
-										if(defined('WP_EASY_UPDATES_ACTIVE')){
162
-											$url = admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug.'&width=770&height=660&item_id='.$addon->info->id.'&update_url=https://wpgetpaid.com&TB_iframe=true');
163
-										}else{
160
+									}elseif (isset($addon->info->link) && (substr($addon->info->link, 0, 23) === "https://wpinvoicing.com" || substr($addon->info->link, 0, 21) === "https://wpgetpaid.com")) {
161
+										if (defined('WP_EASY_UPDATES_ACTIVE')) {
162
+											$url = admin_url('/plugin-install.php?tab=plugin-information&plugin=' . $addon->info->slug . '&width=770&height=660&item_id=' . $addon->info->id . '&update_url=https://wpgetpaid.com&TB_iframe=true');
163
+										} else {
164 164
 											// if installed show activation link
165
-											if(isset($installed_plugins['wp-easy-updates/external-updates.php'])){
165
+											if (isset($installed_plugins['wp-easy-updates/external-updates.php'])) {
166 166
 												$url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-activation';
167
-											}else{
167
+											} else {
168 168
 												$url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-for-external';
169 169
 											}
170 170
 										}
171
-										echo '<a href="'.$url.'" class="thickbox">';
172
-										echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>';
171
+										echo '<a href="' . $url . '" class="thickbox">';
172
+										echo '<span class="wpi-product-info">' . __('More info', 'invoicing') . '</span>';
173 173
 										echo '</a>';
174 174
 									}
175 175
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
 								<span class="wpi-product-button">
182 182
 									<?php
183
-                                    $addon_obj->output_button( $addon );
183
+                                    $addon_obj->output_button($addon);
184 184
 									?>
185 185
 								</span>
186 186
 
@@ -194,21 +194,21 @@  discard block
 block discarded – undo
194 194
 
195 195
 	<div class="clearfix" ></div>
196 196
 
197
-	<?php if($current_tab =='addons'){ ?>
198
-	<p><?php printf( __( 'All of our Invoicing Addons can be found on WPInvoicing.com here: <a href="%s">Invoicing Addons</a>', 'invoicing' ), 'https://wpinvoicing.com/downloads/category/addons/' ); ?></p>
199
-	<?php } if($current_tab =='gateways'){  ?>
200
-    <p><?php printf( __( 'All of our Invoicing Payment Gateways can be found on WPInvoicing.com here: <a href="%s">Invoicing Payment Gateways</a>', 'invoicing' ), 'https://wpinvoicing.com/downloads/category/gateways/' ); ?></p>
197
+	<?php if ($current_tab == 'addons') { ?>
198
+	<p><?php printf(__('All of our Invoicing Addons can be found on WPInvoicing.com here: <a href="%s">Invoicing Addons</a>', 'invoicing'), 'https://wpinvoicing.com/downloads/category/addons/'); ?></p>
199
+	<?php } if ($current_tab == 'gateways') {  ?>
200
+    <p><?php printf(__('All of our Invoicing Payment Gateways can be found on WPInvoicing.com here: <a href="%s">Invoicing Payment Gateways</a>', 'invoicing'), 'https://wpinvoicing.com/downloads/category/gateways/'); ?></p>
201 201
     <?php } ?>
202 202
 
203
-	<div id="wpi-wpeu-required-activation" style="display:none;"><span class="wpi-notification "><?php printf( __("The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s'>activate</a> it now.",'invoicing'),wp_nonce_url(admin_url('plugins.php?action=activate&plugin=wp-easy-updates/external-updates.php'), 'activate-plugin_wp-easy-updates/external-updates.php'));?></span></div>
204
-	<div id="wpi-wpeu-required-for-external" style="display:none;"><span class="wpi-notification "><?php printf(  __("The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s' onclick='window.open(\"https://wpeasyupdates.com/wp-easy-updates.zip\", \"_blank\");' >download</a> and install it now.",'invoicing'),admin_url("plugin-install.php?tab=upload&wpeu-install=true"));?></span></div>
203
+	<div id="wpi-wpeu-required-activation" style="display:none;"><span class="wpi-notification "><?php printf(__("The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s'>activate</a> it now.", 'invoicing'), wp_nonce_url(admin_url('plugins.php?action=activate&plugin=wp-easy-updates/external-updates.php'), 'activate-plugin_wp-easy-updates/external-updates.php')); ?></span></div>
204
+	<div id="wpi-wpeu-required-for-external" style="display:none;"><span class="wpi-notification "><?php printf(__("The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s' onclick='window.open(\"https://wpeasyupdates.com/wp-easy-updates.zip\", \"_blank\");' >download</a> and install it now.", 'invoicing'), admin_url("plugin-install.php?tab=upload&wpeu-install=true")); ?></span></div>
205 205
 	<div id="wpeu-licence-popup" style="display:none;">
206 206
 		<span class="wpi-notification noti-white">
207
-			<h3 class="wpeu-licence-title"><?php _e("Licence key",'invoicing');?></h3>
208
-			<input class="wpeu-licence-key" type="text" placeholder="<?php _e("Enter your licence key",'invoicing');?>"> <button class="button-primary wpeu-licence-popup-button" ><?php _e("Install",'invoicing');?></button>
207
+			<h3 class="wpeu-licence-title"><?php _e("Licence key", 'invoicing'); ?></h3>
208
+			<input class="wpeu-licence-key" type="text" placeholder="<?php _e("Enter your licence key", 'invoicing'); ?>"> <button class="button-primary wpeu-licence-popup-button" ><?php _e("Install", 'invoicing'); ?></button>
209 209
 			<br>
210 210
 			<?php
211
-			echo sprintf( __('%sFind your licence key here%s OR %sBuy one here%s', 'invoicing'), '<a href="https://wpinvoicing.com/your-account/" target="_blank">','</a>','<a class="wpeu-licence-link" href="https://wpinvoicing.com/downloads/category/addons/" target="_blank">','</a>' );
211
+			echo sprintf(__('%sFind your licence key here%s OR %sBuy one here%s', 'invoicing'), '<a href="https://wpinvoicing.com/your-account/" target="_blank">', '</a>', '<a class="wpeu-licence-link" href="https://wpinvoicing.com/downloads/category/addons/" target="_blank">', '</a>');
212 212
 			?>
213 213
 		</span>
214 214
 	</div>
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 			</div>
127 127
 		</div>
128 128
 			<?php
129
-		}else{
129
+		} else{
130 130
 			$installed_plugins = get_plugins();
131 131
             $addon_obj = new WPInv_Admin_Addons();
132 132
 			if ($addons = $addon_obj->get_section_data( $current_tab ) ) :
@@ -157,14 +157,14 @@  discard block
 block discarded – undo
157 157
 										echo '<a href="'.admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug).'&width=770&height=660&TB_iframe=true" class="thickbox" >';
158 158
 										echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>';
159 159
 										echo '</a>';
160
-									}elseif(isset($addon->info->link) && ( substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com" || substr( $addon->info->link, 0, 21 ) === "https://wpgetpaid.com" ) ){
160
+									} elseif(isset($addon->info->link) && ( substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com" || substr( $addon->info->link, 0, 21 ) === "https://wpgetpaid.com" ) ){
161 161
 										if(defined('WP_EASY_UPDATES_ACTIVE')){
162 162
 											$url = admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug.'&width=770&height=660&item_id='.$addon->info->id.'&update_url=https://wpgetpaid.com&TB_iframe=true');
163
-										}else{
163
+										} else{
164 164
 											// if installed show activation link
165 165
 											if(isset($installed_plugins['wp-easy-updates/external-updates.php'])){
166 166
 												$url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-activation';
167
-											}else{
167
+											} else{
168 168
 												$url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-for-external';
169 169
 											}
170 170
 										}
Please login to merge, or discard this patch.
includes/wpinv-helper-functions.php 1 patch
Spacing   +260 added lines, -260 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package Invoicing
7 7
  */
8 8
  
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Are we supporting item quantities?
@@ -20,35 +20,35 @@  discard block
 block discarded – undo
20 20
  */
21 21
 function wpinv_get_ip() {
22 22
 
23
-    if ( isset( $_SERVER['HTTP_X_REAL_IP'] ) ) {
24
-        return sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_REAL_IP'] ) );
23
+    if (isset($_SERVER['HTTP_X_REAL_IP'])) {
24
+        return sanitize_text_field(wp_unslash($_SERVER['HTTP_X_REAL_IP']));
25 25
     }
26 26
 
27
-    if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
27
+    if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
28 28
         // Proxy servers can send through this header like this: X-Forwarded-For: client1, proxy1, proxy2
29 29
         // Make sure we always only send through the first IP in the list which should always be the client IP.
30
-        return (string) rest_is_ip_address( trim( current( preg_split( '/,/', sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) ) ) ) );
30
+        return (string) rest_is_ip_address(trim(current(preg_split('/,/', sanitize_text_field(wp_unslash($_SERVER['HTTP_X_FORWARDED_FOR']))))));
31 31
     }
32 32
 
33
-    if ( isset( $_SERVER['HTTP_CLIENT_IP'] ) ) {
34
-        return sanitize_text_field( wp_unslash( $_SERVER['HTTP_CLIENT_IP'] ) );
33
+    if (isset($_SERVER['HTTP_CLIENT_IP'])) {
34
+        return sanitize_text_field(wp_unslash($_SERVER['HTTP_CLIENT_IP']));
35 35
     }
36 36
 
37
-    if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
38
-        return sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) );
37
+    if (isset($_SERVER['REMOTE_ADDR'])) {
38
+        return sanitize_text_field(wp_unslash($_SERVER['REMOTE_ADDR']));
39 39
     }
40 40
 
41 41
     return '';
42 42
 }
43 43
 
44 44
 function wpinv_get_user_agent() {
45
-    if ( ! empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
46
-        $user_agent = sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] );
45
+    if (!empty($_SERVER['HTTP_USER_AGENT'])) {
46
+        $user_agent = sanitize_text_field($_SERVER['HTTP_USER_AGENT']);
47 47
     } else {
48 48
         $user_agent = '';
49 49
     }
50 50
 
51
-    return apply_filters( 'wpinv_get_user_agent', $user_agent );
51
+    return apply_filters('wpinv_get_user_agent', $user_agent);
52 52
 }
53 53
 
54 54
 /**
@@ -56,23 +56,23 @@  discard block
 block discarded – undo
56 56
  * 
57 57
  * @param string $amount The amount to sanitize.
58 58
  */
59
-function wpinv_sanitize_amount( $amount ) {
59
+function wpinv_sanitize_amount($amount) {
60 60
 
61
-    if ( is_numeric( $amount ) ) {
62
-        return floatval( $amount );
61
+    if (is_numeric($amount)) {
62
+        return floatval($amount);
63 63
     }
64 64
 
65 65
     // Separate the decimals and thousands.
66
-    $amount    = explode( wpinv_decimal_separator(), $amount );
66
+    $amount    = explode(wpinv_decimal_separator(), $amount);
67 67
 
68 68
     // Remove thousands.
69
-    $amount[0] = str_replace( wpinv_thousands_separator(), '', $amount[0] );
69
+    $amount[0] = str_replace(wpinv_thousands_separator(), '', $amount[0]);
70 70
 
71 71
     // Convert back to string.
72
-    $amount = count( $amount ) > 1 ? "{$amount[0]}.{$amount[1]}" : $amount[0];
72
+    $amount = count($amount) > 1 ? "{$amount[0]}.{$amount[1]}" : $amount[0];
73 73
 
74 74
     // Cast the remaining to a float.
75
-    return (float) preg_replace( '/[^0-9\.\-]/', '', $amount );
75
+    return (float) preg_replace('/[^0-9\.\-]/', '', $amount);
76 76
 
77 77
 }
78 78
 
@@ -82,19 +82,19 @@  discard block
 block discarded – undo
82 82
  * @param float $amount
83 83
  * @param float|string|int|null $decimals
84 84
  */
85
-function wpinv_round_amount( $amount, $decimals = null, $use_sprintf = false ) {
85
+function wpinv_round_amount($amount, $decimals = null, $use_sprintf = false) {
86 86
 
87
-    if ( $decimals === null ) {
87
+    if ($decimals === null) {
88 88
         $decimals = wpinv_decimals();
89 89
     }
90 90
 
91
-    if ( $use_sprintf ) {
92
-        $amount = sprintf( "%.{$decimals}f", (float) $amount );
91
+    if ($use_sprintf) {
92
+        $amount = sprintf("%.{$decimals}f", (float) $amount);
93 93
     } else {
94
-        $amount = round( (float) $amount, absint( $decimals ) );
94
+        $amount = round((float) $amount, absint($decimals));
95 95
     }
96 96
 
97
-    return apply_filters( 'wpinv_round_amount', $amount, $decimals );
97
+    return apply_filters('wpinv_round_amount', $amount, $decimals);
98 98
 }
99 99
 
100 100
 /**
@@ -106,32 +106,32 @@  discard block
 block discarded – undo
106 106
  * @param string|WPInv_Invoice $invoice The invoice object|post type|type
107 107
  * @return array
108 108
  */
109
-function wpinv_get_invoice_statuses( $draft = false, $trashed = false, $invoice = false ) {
109
+function wpinv_get_invoice_statuses($draft = false, $trashed = false, $invoice = false) {
110 110
 
111 111
 	$invoice_statuses = array(
112
-		'wpi-pending'    => _x( 'Pending payment', 'Invoice status', 'invoicing' ),
113
-        'publish'        => _x( 'Paid', 'Invoice status', 'invoicing' ),
114
-        'wpi-processing' => _x( 'Processing', 'Invoice status', 'invoicing' ),
115
-		'wpi-onhold'     => _x( 'On hold', 'Invoice status', 'invoicing' ),
116
-		'wpi-cancelled'  => _x( 'Cancelled', 'Invoice status', 'invoicing' ),
117
-		'wpi-refunded'   => _x( 'Refunded', 'Invoice status', 'invoicing' ),
118
-        'wpi-failed'     => _x( 'Failed', 'Invoice status', 'invoicing' ),
119
-        'wpi-renewal'    => _x( 'Renewal Payment', 'Invoice status', 'invoicing' ),
112
+		'wpi-pending'    => _x('Pending payment', 'Invoice status', 'invoicing'),
113
+        'publish'        => _x('Paid', 'Invoice status', 'invoicing'),
114
+        'wpi-processing' => _x('Processing', 'Invoice status', 'invoicing'),
115
+		'wpi-onhold'     => _x('On hold', 'Invoice status', 'invoicing'),
116
+		'wpi-cancelled'  => _x('Cancelled', 'Invoice status', 'invoicing'),
117
+		'wpi-refunded'   => _x('Refunded', 'Invoice status', 'invoicing'),
118
+        'wpi-failed'     => _x('Failed', 'Invoice status', 'invoicing'),
119
+        'wpi-renewal'    => _x('Renewal Payment', 'Invoice status', 'invoicing'),
120 120
     );
121 121
 
122
-    if ( $draft ) {
123
-        $invoice_statuses['draft'] = __( 'Draft', 'invoicing' );
122
+    if ($draft) {
123
+        $invoice_statuses['draft'] = __('Draft', 'invoicing');
124 124
     }
125 125
 
126
-    if ( $trashed ) {
127
-        $invoice_statuses['trash'] = __( 'Trash', 'invoicing' );
126
+    if ($trashed) {
127
+        $invoice_statuses['trash'] = __('Trash', 'invoicing');
128 128
     }
129 129
 
130
-    if ( $invoice instanceof WPInv_Invoice ) {
130
+    if ($invoice instanceof WPInv_Invoice) {
131 131
         $invoice = $invoice->get_post_type();
132 132
     }
133 133
 
134
-	return apply_filters( 'wpinv_statuses', $invoice_statuses, $invoice );
134
+	return apply_filters('wpinv_statuses', $invoice_statuses, $invoice);
135 135
 }
136 136
 
137 137
 /**
@@ -140,11 +140,11 @@  discard block
 block discarded – undo
140 140
  * @param string $status The raw status
141 141
  * @param string|WPInv_Invoice $invoice The invoice object|post type|type
142 142
  */
143
-function wpinv_status_nicename( $status, $invoice = false ) {
144
-    $statuses = wpinv_get_invoice_statuses( true, true, $invoice );
145
-    $status   = isset( $statuses[$status] ) ? $statuses[$status] : $status;
143
+function wpinv_status_nicename($status, $invoice = false) {
144
+    $statuses = wpinv_get_invoice_statuses(true, true, $invoice);
145
+    $status   = isset($statuses[$status]) ? $statuses[$status] : $status;
146 146
 
147
-    return sanitize_text_field( $status );
147
+    return sanitize_text_field($status);
148 148
 }
149 149
 
150 150
 /**
@@ -152,13 +152,13 @@  discard block
 block discarded – undo
152 152
  * 
153 153
  * @param string $current
154 154
  */
155
-function wpinv_get_currency( $current = '' ) {
155
+function wpinv_get_currency($current = '') {
156 156
 
157
-    if ( empty( $current ) ) {
158
-        $current = apply_filters( 'wpinv_currency', wpinv_get_option( 'currency', 'USD' ) );
157
+    if (empty($current)) {
158
+        $current = apply_filters('wpinv_currency', wpinv_get_option('currency', 'USD'));
159 159
     }
160 160
 
161
-    return trim( strtoupper( $current ) );
161
+    return trim(strtoupper($current));
162 162
 }
163 163
 
164 164
 /**
@@ -166,25 +166,25 @@  discard block
 block discarded – undo
166 166
  * 
167 167
  * @param string|null $currency The currency code. Defaults to the default currency.
168 168
  */
169
-function wpinv_currency_symbol( $currency = null ) {
169
+function wpinv_currency_symbol($currency = null) {
170 170
 
171 171
     // Prepare the currency.
172
-    $currency = empty( $currency ) ? wpinv_get_currency() : wpinv_clean( $currency );
172
+    $currency = empty($currency) ? wpinv_get_currency() : wpinv_clean($currency);
173 173
 
174 174
     // Fetch all symbols.
175 175
     $symbols = wpinv_get_currency_symbols();
176 176
 
177 177
     // Fetch this currencies symbol.
178
-    $currency_symbol = isset( $symbols[$currency] ) ? $symbols[$currency] : $currency;
178
+    $currency_symbol = isset($symbols[$currency]) ? $symbols[$currency] : $currency;
179 179
 
180 180
     // Filter the symbol.
181
-    return apply_filters( 'wpinv_currency_symbol', $currency_symbol, $currency );
181
+    return apply_filters('wpinv_currency_symbol', $currency_symbol, $currency);
182 182
 }
183 183
 
184 184
 function wpinv_currency_position() {
185
-    $position = wpinv_get_option( 'currency_position', 'left' );
185
+    $position = wpinv_get_option('currency_position', 'left');
186 186
     
187
-    return apply_filters( 'wpinv_currency_position', $position );
187
+    return apply_filters('wpinv_currency_position', $position);
188 188
 }
189 189
 
190 190
 /**
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
  * 
193 193
  * @param $string|null $current
194 194
  */
195
-function wpinv_thousands_separator( $current = null ) {
195
+function wpinv_thousands_separator($current = null) {
196 196
 
197
-    if ( null == $current ) {
198
-        $current = wpinv_get_option( 'thousands_separator', ',' );
197
+    if (null == $current) {
198
+        $current = wpinv_get_option('thousands_separator', ',');
199 199
     }
200 200
 
201
-    return trim( $current );
201
+    return trim($current);
202 202
 }
203 203
 
204 204
 /**
@@ -206,13 +206,13 @@  discard block
 block discarded – undo
206 206
  * 
207 207
  * @param $string|null $current
208 208
  */
209
-function wpinv_decimal_separator( $current = null ) {
209
+function wpinv_decimal_separator($current = null) {
210 210
 
211
-    if ( null == $current ) {
212
-        $current = wpinv_get_option( 'decimal_separator', '.' );
211
+    if (null == $current) {
212
+        $current = wpinv_get_option('decimal_separator', '.');
213 213
     }
214 214
     
215
-    return trim( $current );
215
+    return trim($current);
216 216
 }
217 217
 
218 218
 /**
@@ -220,27 +220,27 @@  discard block
 block discarded – undo
220 220
  * 
221 221
  * @param $string|null $current
222 222
  */
223
-function wpinv_decimals( $current = null ) {
223
+function wpinv_decimals($current = null) {
224 224
 
225
-    if ( null == $current ) {
226
-        $current = wpinv_get_option( 'decimals', 2 );
225
+    if (null == $current) {
226
+        $current = wpinv_get_option('decimals', 2);
227 227
     }
228 228
     
229
-    return absint( $current );
229
+    return absint($current);
230 230
 }
231 231
 
232 232
 /**
233 233
  * Retrieves a list of all supported currencies.
234 234
  */
235 235
 function wpinv_get_currencies() {
236
-    return apply_filters( 'wpinv_currencies', wpinv_get_data( 'currencies' ) );
236
+    return apply_filters('wpinv_currencies', wpinv_get_data('currencies'));
237 237
 }
238 238
 
239 239
 /**
240 240
  * Retrieves a list of all currency symbols.
241 241
  */
242 242
 function wpinv_get_currency_symbols() {
243
-    return apply_filters( 'wpinv_currency_symbols', wpinv_get_data( 'currency-symbols' ) );
243
+    return apply_filters('wpinv_currency_symbols', wpinv_get_data('currency-symbols'));
244 244
 }
245 245
 
246 246
 /**
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	$currency_pos = wpinv_currency_position();
253 253
 	$format       = '%1$s%2$s';
254 254
 
255
-	switch ( $currency_pos ) {
255
+	switch ($currency_pos) {
256 256
 		case 'left':
257 257
 			$format = '%1$s%2$s';
258 258
 			break;
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 			break;
268 268
 	}
269 269
 
270
-	return apply_filters( 'getpaid_price_format', $format, $currency_pos );
270
+	return apply_filters('getpaid_price_format', $format, $currency_pos);
271 271
 }
272 272
 
273 273
 /**
@@ -277,25 +277,25 @@  discard block
 block discarded – undo
277 277
  * @param  string $currency Currency.
278 278
  * @return string
279 279
  */
280
-function wpinv_price( $amount = 0, $currency = '' ) {
280
+function wpinv_price($amount = 0, $currency = '') {
281 281
 
282 282
     // Backwards compatibility.
283
-    $amount             = wpinv_sanitize_amount( $amount );
283
+    $amount             = wpinv_sanitize_amount($amount);
284 284
 
285 285
     // Prepare variables.
286
-    $currency           = wpinv_get_currency( $currency );
286
+    $currency           = wpinv_get_currency($currency);
287 287
     $amount             = (float) $amount;
288 288
     $unformatted_amount = $amount;
289 289
     $negative           = $amount < 0;
290
-    $amount             = apply_filters( 'getpaid_raw_amount', floatval( $negative ? $amount * -1 : $amount ) );
291
-    $amount             = wpinv_format_amount( $amount );
290
+    $amount             = apply_filters('getpaid_raw_amount', floatval($negative ? $amount * -1 : $amount));
291
+    $amount             = wpinv_format_amount($amount);
292 292
 
293 293
     // Format the amount.
294 294
     $format             = getpaid_get_price_format();
295
-    $formatted_amount   = ( $negative ? '-' : '' ) . sprintf( $format, '<span class="getpaid-currency__symbol">' . wpinv_currency_symbol( $currency ) . '</span>', $amount );
295
+    $formatted_amount   = ($negative ? '-' : '') . sprintf($format, '<span class="getpaid-currency__symbol">' . wpinv_currency_symbol($currency) . '</span>', $amount);
296 296
 
297 297
     // Filter the formatting.
298
-    return apply_filters( 'wpinv_price', $formatted_amount, $amount, $currency, $unformatted_amount );
298
+    return apply_filters('wpinv_price', $formatted_amount, $amount, $currency, $unformatted_amount);
299 299
 }
300 300
 
301 301
 /**
@@ -306,25 +306,25 @@  discard block
 block discarded – undo
306 306
  * @param  bool     $calculate Whether or not to apply separators.
307 307
  * @return string
308 308
  */
309
-function wpinv_format_amount( $amount, $decimals = null, $calculate = false ) {
309
+function wpinv_format_amount($amount, $decimals = null, $calculate = false) {
310 310
     $thousands_sep = wpinv_thousands_separator();
311 311
     $decimal_sep   = wpinv_decimal_separator();
312
-    $decimals      = wpinv_decimals( $decimals );
313
-    $amount        = wpinv_sanitize_amount( $amount );
312
+    $decimals      = wpinv_decimals($decimals);
313
+    $amount        = wpinv_sanitize_amount($amount);
314 314
 
315
-    if ( $calculate ) {
315
+    if ($calculate) {
316 316
         return $amount;
317 317
     }
318 318
 
319 319
     // Fomart the amount.
320
-    return number_format( $amount, $decimals, $decimal_sep, $thousands_sep );
320
+    return number_format($amount, $decimals, $decimal_sep, $thousands_sep);
321 321
 }
322 322
 
323
-function wpinv_sanitize_key( $key ) {
323
+function wpinv_sanitize_key($key) {
324 324
     $raw_key = $key;
325
-    $key = preg_replace( '/[^a-zA-Z0-9_\-\.\:\/]/', '', $key );
325
+    $key = preg_replace('/[^a-zA-Z0-9_\-\.\:\/]/', '', $key);
326 326
 
327
-    return apply_filters( 'wpinv_sanitize_key', $key, $raw_key );
327
+    return apply_filters('wpinv_sanitize_key', $key, $raw_key);
328 328
 }
329 329
 
330 330
 /**
@@ -332,8 +332,8 @@  discard block
 block discarded – undo
332 332
  * 
333 333
  * @param $str the file whose extension should be retrieved.
334 334
  */
335
-function wpinv_get_file_extension( $str ) {
336
-    $filetype = wp_check_filetype( $str );
335
+function wpinv_get_file_extension($str) {
336
+    $filetype = wp_check_filetype($str);
337 337
     return $filetype['ext'];
338 338
 }
339 339
 
@@ -342,16 +342,16 @@  discard block
 block discarded – undo
342 342
  * 
343 343
  * @param string $string
344 344
  */
345
-function wpinv_string_is_image_url( $string ) {
346
-    $extension = strtolower( wpinv_get_file_extension( $string ) );
347
-    return in_array( $extension, array( 'jpeg', 'jpg', 'png', 'gif', 'ico' ), true );
345
+function wpinv_string_is_image_url($string) {
346
+    $extension = strtolower(wpinv_get_file_extension($string));
347
+    return in_array($extension, array('jpeg', 'jpg', 'png', 'gif', 'ico'), true);
348 348
 }
349 349
 
350 350
 /**
351 351
  * Returns the current URL.
352 352
  */
353 353
 function wpinv_get_current_page_url() {
354
-    return ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
354
+    return (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
355 355
 }
356 356
 
357 357
 /**
@@ -361,46 +361,46 @@  discard block
 block discarded – undo
361 361
  * @param string $name  Constant name.
362 362
  * @param mixed  $value Value.
363 363
  */
364
-function getpaid_maybe_define_constant( $name, $value ) {
365
-	if ( ! defined( $name ) ) {
366
-		define( $name, $value );
364
+function getpaid_maybe_define_constant($name, $value) {
365
+	if (!defined($name)) {
366
+		define($name, $value);
367 367
 	}
368 368
 }
369 369
 
370 370
 function wpinv_get_php_arg_separator_output() {
371
-	return ini_get( 'arg_separator.output' );
371
+	return ini_get('arg_separator.output');
372 372
 }
373 373
 
374
-function wpinv_rgb_from_hex( $color ) {
375
-    $color = str_replace( '#', '', $color );
374
+function wpinv_rgb_from_hex($color) {
375
+    $color = str_replace('#', '', $color);
376 376
 
377 377
     // Convert shorthand colors to full format, e.g. "FFF" -> "FFFFFF"
378
-    $color = preg_replace( '~^(.)(.)(.)$~', '$1$1$2$2$3$3', $color );
379
-    if ( empty( $color ) ) {
378
+    $color = preg_replace('~^(.)(.)(.)$~', '$1$1$2$2$3$3', $color);
379
+    if (empty($color)) {
380 380
         return NULL;
381 381
     }
382 382
 
383
-    $color = str_split( $color );
383
+    $color = str_split($color);
384 384
 
385 385
     $rgb      = array();
386
-    $rgb['R'] = hexdec( $color[0] . $color[1] );
387
-    $rgb['G'] = hexdec( $color[2] . $color[3] );
388
-    $rgb['B'] = hexdec( $color[4] . $color[5] );
386
+    $rgb['R'] = hexdec($color[0] . $color[1]);
387
+    $rgb['G'] = hexdec($color[2] . $color[3]);
388
+    $rgb['B'] = hexdec($color[4] . $color[5]);
389 389
 
390 390
     return $rgb;
391 391
 }
392 392
 
393
-function wpinv_hex_darker( $color, $factor = 30 ) {
394
-    $base  = wpinv_rgb_from_hex( $color );
393
+function wpinv_hex_darker($color, $factor = 30) {
394
+    $base  = wpinv_rgb_from_hex($color);
395 395
     $color = '#';
396 396
 
397
-    foreach ( $base as $k => $v ) {
397
+    foreach ($base as $k => $v) {
398 398
         $amount      = $v / 100;
399
-        $amount      = round( $amount * $factor );
399
+        $amount      = round($amount * $factor);
400 400
         $new_decimal = $v - $amount;
401 401
 
402
-        $new_hex_component = dechex( $new_decimal );
403
-        if ( strlen( $new_hex_component ) < 2 ) {
402
+        $new_hex_component = dechex($new_decimal);
403
+        if (strlen($new_hex_component) < 2) {
404 404
             $new_hex_component = "0" . $new_hex_component;
405 405
         }
406 406
         $color .= $new_hex_component;
@@ -409,18 +409,18 @@  discard block
 block discarded – undo
409 409
     return $color;
410 410
 }
411 411
 
412
-function wpinv_hex_lighter( $color, $factor = 30 ) {
413
-    $base  = wpinv_rgb_from_hex( $color );
412
+function wpinv_hex_lighter($color, $factor = 30) {
413
+    $base  = wpinv_rgb_from_hex($color);
414 414
     $color = '#';
415 415
 
416
-    foreach ( $base as $k => $v ) {
416
+    foreach ($base as $k => $v) {
417 417
         $amount      = 255 - $v;
418 418
         $amount      = $amount / 100;
419
-        $amount      = round( $amount * $factor );
419
+        $amount      = round($amount * $factor);
420 420
         $new_decimal = $v + $amount;
421 421
 
422
-        $new_hex_component = dechex( $new_decimal );
423
-        if ( strlen( $new_hex_component ) < 2 ) {
422
+        $new_hex_component = dechex($new_decimal);
423
+        if (strlen($new_hex_component) < 2) {
424 424
             $new_hex_component = "0" . $new_hex_component;
425 425
         }
426 426
         $color .= $new_hex_component;
@@ -429,22 +429,22 @@  discard block
 block discarded – undo
429 429
     return $color;
430 430
 }
431 431
 
432
-function wpinv_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) {
433
-    $hex = str_replace( '#', '', $color );
432
+function wpinv_light_or_dark($color, $dark = '#000000', $light = '#FFFFFF') {
433
+    $hex = str_replace('#', '', $color);
434 434
 
435
-    $c_r = hexdec( substr( $hex, 0, 2 ) );
436
-    $c_g = hexdec( substr( $hex, 2, 2 ) );
437
-    $c_b = hexdec( substr( $hex, 4, 2 ) );
435
+    $c_r = hexdec(substr($hex, 0, 2));
436
+    $c_g = hexdec(substr($hex, 2, 2));
437
+    $c_b = hexdec(substr($hex, 4, 2));
438 438
 
439
-    $brightness = ( ( $c_r * 299 ) + ( $c_g * 587 ) + ( $c_b * 114 ) ) / 1000;
439
+    $brightness = (($c_r * 299) + ($c_g * 587) + ($c_b * 114)) / 1000;
440 440
 
441 441
     return $brightness > 155 ? $dark : $light;
442 442
 }
443 443
 
444
-function wpinv_format_hex( $hex ) {
445
-    $hex = trim( str_replace( '#', '', $hex ) );
444
+function wpinv_format_hex($hex) {
445
+    $hex = trim(str_replace('#', '', $hex));
446 446
 
447
-    if ( strlen( $hex ) == 3 ) {
447
+    if (strlen($hex) == 3) {
448 448
         $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
449 449
     }
450 450
 
@@ -464,12 +464,12 @@  discard block
 block discarded – undo
464 464
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
465 465
  * @return string
466 466
  */
467
-function wpinv_utf8_strimwidth( $str, $start, $width, $trimmaker = '', $encoding = 'UTF-8' ) {
468
-    if ( function_exists( 'mb_strimwidth' ) ) {
469
-        return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding );
467
+function wpinv_utf8_strimwidth($str, $start, $width, $trimmaker = '', $encoding = 'UTF-8') {
468
+    if (function_exists('mb_strimwidth')) {
469
+        return mb_strimwidth($str, $start, $width, $trimmaker, $encoding);
470 470
     }
471 471
     
472
-    return wpinv_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker;
472
+    return wpinv_utf8_substr($str, $start, $width, $encoding) . $trimmaker;
473 473
 }
474 474
 
475 475
 /**
@@ -481,28 +481,28 @@  discard block
 block discarded – undo
481 481
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
482 482
  * @return int Returns the number of characters in string.
483 483
  */
484
-function wpinv_utf8_strlen( $str, $encoding = 'UTF-8' ) {
485
-    if ( function_exists( 'mb_strlen' ) ) {
486
-        return mb_strlen( $str, $encoding );
484
+function wpinv_utf8_strlen($str, $encoding = 'UTF-8') {
485
+    if (function_exists('mb_strlen')) {
486
+        return mb_strlen($str, $encoding);
487 487
     }
488 488
         
489
-    return strlen( $str );
489
+    return strlen($str);
490 490
 }
491 491
 
492
-function wpinv_utf8_strtolower( $str, $encoding = 'UTF-8' ) {
493
-    if ( function_exists( 'mb_strtolower' ) ) {
494
-        return mb_strtolower( $str, $encoding );
492
+function wpinv_utf8_strtolower($str, $encoding = 'UTF-8') {
493
+    if (function_exists('mb_strtolower')) {
494
+        return mb_strtolower($str, $encoding);
495 495
     }
496 496
     
497
-    return strtolower( $str );
497
+    return strtolower($str);
498 498
 }
499 499
 
500
-function wpinv_utf8_strtoupper( $str, $encoding = 'UTF-8' ) {
501
-    if ( function_exists( 'mb_strtoupper' ) ) {
502
-        return mb_strtoupper( $str, $encoding );
500
+function wpinv_utf8_strtoupper($str, $encoding = 'UTF-8') {
501
+    if (function_exists('mb_strtoupper')) {
502
+        return mb_strtoupper($str, $encoding);
503 503
     }
504 504
     
505
-    return strtoupper( $str );
505
+    return strtoupper($str);
506 506
 }
507 507
 
508 508
 /**
@@ -516,12 +516,12 @@  discard block
 block discarded – undo
516 516
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
517 517
  * @return int Returns the position of the first occurrence of search in the string.
518 518
  */
519
-function wpinv_utf8_strpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
520
-    if ( function_exists( 'mb_strpos' ) ) {
521
-        return mb_strpos( $str, $find, $offset, $encoding );
519
+function wpinv_utf8_strpos($str, $find, $offset = 0, $encoding = 'UTF-8') {
520
+    if (function_exists('mb_strpos')) {
521
+        return mb_strpos($str, $find, $offset, $encoding);
522 522
     }
523 523
         
524
-    return strpos( $str, $find, $offset );
524
+    return strpos($str, $find, $offset);
525 525
 }
526 526
 
527 527
 /**
@@ -535,12 +535,12 @@  discard block
 block discarded – undo
535 535
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
536 536
  * @return int Returns the position of the last occurrence of search.
537 537
  */
538
-function wpinv_utf8_strrpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
539
-    if ( function_exists( 'mb_strrpos' ) ) {
540
-        return mb_strrpos( $str, $find, $offset, $encoding );
538
+function wpinv_utf8_strrpos($str, $find, $offset = 0, $encoding = 'UTF-8') {
539
+    if (function_exists('mb_strrpos')) {
540
+        return mb_strrpos($str, $find, $offset, $encoding);
541 541
     }
542 542
         
543
-    return strrpos( $str, $find, $offset );
543
+    return strrpos($str, $find, $offset);
544 544
 }
545 545
 
546 546
 /**
@@ -555,16 +555,16 @@  discard block
 block discarded – undo
555 555
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
556 556
  * @return string
557 557
  */
558
-function wpinv_utf8_substr( $str, $start, $length = null, $encoding = 'UTF-8' ) {
559
-    if ( function_exists( 'mb_substr' ) ) {
560
-        if ( $length === null ) {
561
-            return mb_substr( $str, $start, wpinv_utf8_strlen( $str, $encoding ), $encoding );
558
+function wpinv_utf8_substr($str, $start, $length = null, $encoding = 'UTF-8') {
559
+    if (function_exists('mb_substr')) {
560
+        if ($length === null) {
561
+            return mb_substr($str, $start, wpinv_utf8_strlen($str, $encoding), $encoding);
562 562
         } else {
563
-            return mb_substr( $str, $start, $length, $encoding );
563
+            return mb_substr($str, $start, $length, $encoding);
564 564
         }
565 565
     }
566 566
         
567
-    return substr( $str, $start, $length );
567
+    return substr($str, $start, $length);
568 568
 }
569 569
 
570 570
 /**
@@ -576,48 +576,48 @@  discard block
 block discarded – undo
576 576
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
577 577
  * @return string The width of string.
578 578
  */
579
-function wpinv_utf8_strwidth( $str, $encoding = 'UTF-8' ) {
580
-    if ( function_exists( 'mb_strwidth' ) ) {
581
-        return mb_strwidth( $str, $encoding );
579
+function wpinv_utf8_strwidth($str, $encoding = 'UTF-8') {
580
+    if (function_exists('mb_strwidth')) {
581
+        return mb_strwidth($str, $encoding);
582 582
     }
583 583
     
584
-    return wpinv_utf8_strlen( $str, $encoding );
584
+    return wpinv_utf8_strlen($str, $encoding);
585 585
 }
586 586
 
587
-function wpinv_utf8_ucfirst( $str, $lower_str_end = false, $encoding = 'UTF-8' ) {
588
-    if ( function_exists( 'mb_strlen' ) ) {
589
-        $first_letter = wpinv_utf8_strtoupper( wpinv_utf8_substr( $str, 0, 1, $encoding ), $encoding );
587
+function wpinv_utf8_ucfirst($str, $lower_str_end = false, $encoding = 'UTF-8') {
588
+    if (function_exists('mb_strlen')) {
589
+        $first_letter = wpinv_utf8_strtoupper(wpinv_utf8_substr($str, 0, 1, $encoding), $encoding);
590 590
         $str_end = "";
591 591
         
592
-        if ( $lower_str_end ) {
593
-            $str_end = wpinv_utf8_strtolower( wpinv_utf8_substr( $str, 1, wpinv_utf8_strlen( $str, $encoding ), $encoding ), $encoding );
592
+        if ($lower_str_end) {
593
+            $str_end = wpinv_utf8_strtolower(wpinv_utf8_substr($str, 1, wpinv_utf8_strlen($str, $encoding), $encoding), $encoding);
594 594
         } else {
595
-            $str_end = wpinv_utf8_substr( $str, 1, wpinv_utf8_strlen( $str, $encoding ), $encoding );
595
+            $str_end = wpinv_utf8_substr($str, 1, wpinv_utf8_strlen($str, $encoding), $encoding);
596 596
         }
597 597
 
598 598
         return $first_letter . $str_end;
599 599
     }
600 600
     
601
-    return ucfirst( $str );
601
+    return ucfirst($str);
602 602
 }
603 603
 
604
-function wpinv_utf8_ucwords( $str, $encoding = 'UTF-8' ) {
605
-    if ( function_exists( 'mb_convert_case' ) ) {
606
-        return mb_convert_case( $str, MB_CASE_TITLE, $encoding );
604
+function wpinv_utf8_ucwords($str, $encoding = 'UTF-8') {
605
+    if (function_exists('mb_convert_case')) {
606
+        return mb_convert_case($str, MB_CASE_TITLE, $encoding);
607 607
     }
608 608
     
609
-    return ucwords( $str );
609
+    return ucwords($str);
610 610
 }
611 611
 
612
-function wpinv_period_in_days( $period, $unit ) {
613
-    $period = absint( $period );
612
+function wpinv_period_in_days($period, $unit) {
613
+    $period = absint($period);
614 614
     
615
-    if ( $period > 0 ) {
616
-        if ( in_array( strtolower( $unit ), array( 'w', 'week', 'weeks' ) ) ) {
615
+    if ($period > 0) {
616
+        if (in_array(strtolower($unit), array('w', 'week', 'weeks'))) {
617 617
             $period = $period * 7;
618
-        } else if ( in_array( strtolower( $unit ), array( 'm', 'month', 'months' ) ) ) {
618
+        } else if (in_array(strtolower($unit), array('m', 'month', 'months'))) {
619 619
             $period = $period * 30;
620
-        } else if ( in_array( strtolower( $unit ), array( 'y', 'year', 'years' ) ) ) {
620
+        } else if (in_array(strtolower($unit), array('y', 'year', 'years'))) {
621 621
             $period = $period * 365;
622 622
         }
623 623
     }
@@ -625,14 +625,14 @@  discard block
 block discarded – undo
625 625
     return $period;
626 626
 }
627 627
 
628
-function wpinv_cal_days_in_month( $calendar, $month, $year ) {
629
-    if ( function_exists( 'cal_days_in_month' ) ) {
630
-        return cal_days_in_month( $calendar, $month, $year );
628
+function wpinv_cal_days_in_month($calendar, $month, $year) {
629
+    if (function_exists('cal_days_in_month')) {
630
+        return cal_days_in_month($calendar, $month, $year);
631 631
     }
632 632
 
633 633
     // Fallback in case the calendar extension is not loaded in PHP
634 634
     // Only supports Gregorian calendar
635
-    return date( 't', mktime( 0, 0, 0, $month, 1, $year ) );
635
+    return date('t', mktime(0, 0, 0, $month, 1, $year));
636 636
 }
637 637
 
638 638
 /**
@@ -643,12 +643,12 @@  discard block
 block discarded – undo
643 643
  *
644 644
  * @return string
645 645
  */
646
-function wpi_help_tip( $tip, $allow_html = false ) {
646
+function wpi_help_tip($tip, $allow_html = false) {
647 647
 
648
-    if ( $allow_html ) {
649
-        $tip = wpi_sanitize_tooltip( $tip );
648
+    if ($allow_html) {
649
+        $tip = wpi_sanitize_tooltip($tip);
650 650
     } else {
651
-        $tip = esc_attr( $tip );
651
+        $tip = esc_attr($tip);
652 652
     }
653 653
 
654 654
     return '<span class="wpi-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
@@ -662,8 +662,8 @@  discard block
 block discarded – undo
662 662
  * @param string $var
663 663
  * @return string
664 664
  */
665
-function wpi_sanitize_tooltip( $var ) {
666
-    return wp_kses( html_entity_decode( $var ), array(
665
+function wpi_sanitize_tooltip($var) {
666
+    return wp_kses(html_entity_decode($var), array(
667 667
         'br'     => array(),
668 668
         'em'     => array(),
669 669
         'strong' => array(),
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
         'li'     => array(),
675 675
         'ol'     => array(),
676 676
         'p'      => array(),
677
-    ) );
677
+    ));
678 678
 }
679 679
 
680 680
 /**
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
  */
685 685
 function wpinv_get_screen_ids() {
686 686
 
687
-    $screen_id = sanitize_title( __( 'Invoicing', 'invoicing' ) );
687
+    $screen_id = sanitize_title(__('Invoicing', 'invoicing'));
688 688
 
689 689
     $screen_ids = array(
690 690
         'toplevel_page_' . $screen_id,
@@ -703,10 +703,10 @@  discard block
 block discarded – undo
703 703
         'getpaid_page_wpinv-reports',
704 704
         'getpaid_page_wpi-addons',
705 705
         'getpaid_page_wpinv-customers',
706
-        'gp-setup',// setup wizard
706
+        'gp-setup', // setup wizard
707 707
     );
708 708
 
709
-    return apply_filters( 'wpinv_screen_ids', $screen_ids );
709
+    return apply_filters('wpinv_screen_ids', $screen_ids);
710 710
 }
711 711
 
712 712
 /**
@@ -717,14 +717,14 @@  discard block
 block discarded – undo
717 717
  * @param array|string $list List of values.
718 718
  * @return array Sanitized array of values.
719 719
  */
720
-function wpinv_parse_list( $list ) {
720
+function wpinv_parse_list($list) {
721 721
 
722
-    if ( empty( $list ) ) {
722
+    if (empty($list)) {
723 723
         $list = array();
724 724
     }
725 725
 
726
-	if ( ! is_array( $list ) ) {
727
-		return preg_split( '/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY );
726
+	if (!is_array($list)) {
727
+		return preg_split('/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY);
728 728
 	}
729 729
 
730 730
 	return $list;
@@ -738,16 +738,16 @@  discard block
 block discarded – undo
738 738
  * @param string $key Type of data to fetch.
739 739
  * @return mixed Fetched data.
740 740
  */
741
-function wpinv_get_data( $key ) {
741
+function wpinv_get_data($key) {
742 742
 
743 743
     // Try fetching it from the cache.
744
-    $data = wp_cache_get( "wpinv-data-$key", 'wpinv' );
745
-    if( $data ) {
744
+    $data = wp_cache_get("wpinv-data-$key", 'wpinv');
745
+    if ($data) {
746 746
         return $data;
747 747
     }
748 748
 
749
-    $data = apply_filters( "wpinv_get_$key", include WPINV_PLUGIN_DIR . "includes/data/$key.php" );
750
-	wp_cache_set( "wpinv-data-$key", $data, 'wpinv' );
749
+    $data = apply_filters("wpinv_get_$key", include WPINV_PLUGIN_DIR . "includes/data/$key.php");
750
+	wp_cache_set("wpinv-data-$key", $data, 'wpinv');
751 751
 
752 752
 	return $data;
753 753
 }
@@ -761,10 +761,10 @@  discard block
 block discarded – undo
761 761
  * @param bool $first_empty Whether or not the first item in the list should be empty
762 762
  * @return mixed Fetched data.
763 763
  */
764
-function wpinv_maybe_add_empty_option( $options, $first_empty ) {
764
+function wpinv_maybe_add_empty_option($options, $first_empty) {
765 765
 
766
-    if ( ! empty( $options ) && $first_empty ) {
767
-        return array_merge( array( '' => '' ), $options );
766
+    if (!empty($options) && $first_empty) {
767
+        return array_merge(array('' => ''), $options);
768 768
     }
769 769
     return $options;
770 770
 
@@ -776,21 +776,21 @@  discard block
 block discarded – undo
776 776
  * @param mixed $var Data to sanitize.
777 777
  * @return string|array
778 778
  */
779
-function wpinv_clean( $var ) {
779
+function wpinv_clean($var) {
780 780
 
781
-	if ( is_array( $var ) ) {
782
-		return array_map( 'wpinv_clean', $var );
781
+	if (is_array($var)) {
782
+		return array_map('wpinv_clean', $var);
783 783
     }
784 784
 
785
-    if ( is_object( $var ) ) {
786
-		$object_vars = get_object_vars( $var );
787
-		foreach ( $object_vars as $property_name => $property_value ) {
788
-			$var->$property_name = wpinv_clean( $property_value );
785
+    if (is_object($var)) {
786
+		$object_vars = get_object_vars($var);
787
+		foreach ($object_vars as $property_name => $property_value) {
788
+			$var->$property_name = wpinv_clean($property_value);
789 789
         }
790 790
         return $var;
791 791
 	}
792 792
 
793
-    return is_string( $var ) ? sanitize_text_field( stripslashes( $var ) ) : $var;
793
+    return is_string($var) ? sanitize_text_field(stripslashes($var)) : $var;
794 794
 }
795 795
 
796 796
 /**
@@ -799,43 +799,43 @@  discard block
 block discarded – undo
799 799
  * @param string $str Data to convert.
800 800
  * @return string|array
801 801
  */
802
-function getpaid_convert_price_string_to_options( $str ) {
802
+function getpaid_convert_price_string_to_options($str) {
803 803
 
804
-	$raw_options = array_map( 'trim', explode( ',', $str ) );
805
-    $options     = array();
804
+	$raw_options = array_map('trim', explode(',', $str));
805
+    $options = array();
806 806
 
807
-    foreach ( $raw_options as $option ) {
807
+    foreach ($raw_options as $option) {
808 808
 
809
-        if ( '' == $option ) {
809
+        if ('' == $option) {
810 810
             continue;
811 811
         }
812 812
 
813
-        $option = array_map( 'trim', explode( '|', $option ) );
813
+        $option = array_map('trim', explode('|', $option));
814 814
 
815 815
         $price = null;
816 816
         $label = null;
817 817
 
818
-        if ( isset( $option[0] ) && '' !=  $option[0] ) {
819
-            $label  = $option[0];
818
+        if (isset($option[0]) && '' != $option[0]) {
819
+            $label = $option[0];
820 820
         }
821 821
 
822
-        if ( isset( $option[1] ) && '' !=  $option[1] ) {
822
+        if (isset($option[1]) && '' != $option[1]) {
823 823
             $price = $option[1];
824 824
         }
825 825
 
826
-        if ( ! isset( $price ) ) {
826
+        if (!isset($price)) {
827 827
             $price = $label;
828 828
         }
829 829
 
830
-        if ( ! isset( $price ) || ! is_numeric( $price ) ) {
830
+        if (!isset($price) || !is_numeric($price)) {
831 831
             continue;
832 832
         }
833 833
 
834
-        if ( ! isset( $label ) ) {
834
+        if (!isset($label)) {
835 835
             $label = $price;
836 836
         }
837 837
 
838
-        $options[ "$label|$price" ] = $label;
838
+        $options["$label|$price"] = $label;
839 839
     }
840 840
 
841 841
     return $options;
@@ -844,27 +844,27 @@  discard block
 block discarded – undo
844 844
 /**
845 845
  * Returns the help tip.
846 846
  */
847
-function getpaid_get_help_tip( $tip, $additional_classes = '' ) {
848
-    $additional_classes = sanitize_html_class( $additional_classes );
849
-    $tip                = esc_attr__( $tip );
847
+function getpaid_get_help_tip($tip, $additional_classes = '') {
848
+    $additional_classes = sanitize_html_class($additional_classes);
849
+    $tip                = esc_attr__($tip);
850 850
     return "<span class='wpi-help-tip dashicons dashicons-editor-help $additional_classes' title='$tip'></span>";
851 851
 }
852 852
 
853 853
 /**
854 854
  * Formats a date
855 855
  */
856
-function getpaid_format_date( $date, $with_time = false ) {
856
+function getpaid_format_date($date, $with_time = false) {
857 857
 
858
-    if ( empty( $date ) || $date == '0000-00-00 00:00:00' ) {
858
+    if (empty($date) || $date == '0000-00-00 00:00:00') {
859 859
         return '';
860 860
     }
861 861
 
862 862
     $format = getpaid_date_format();
863 863
 
864
-    if ( $with_time ) {
864
+    if ($with_time) {
865 865
         $format .= ' ' . getpaid_time_format();
866 866
     }
867
-    return date_i18n( $format, strtotime( $date ) );
867
+    return date_i18n($format, strtotime($date));
868 868
 
869 869
 }
870 870
 
@@ -873,9 +873,9 @@  discard block
 block discarded – undo
873 873
  *
874 874
  * @return string
875 875
  */
876
-function getpaid_format_date_value( $date, $default = "&mdash;", $with_time = false ) {
877
-    $date = getpaid_format_date( $date, $with_time );
878
-    return empty( $date ) ? $default : $date;
876
+function getpaid_format_date_value($date, $default = "&mdash;", $with_time = false) {
877
+    $date = getpaid_format_date($date, $with_time);
878
+    return empty($date) ? $default : $date;
879 879
 }
880 880
 
881 881
 /**
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
  * @return string
885 885
  */
886 886
 function getpaid_date_format() {
887
-	return apply_filters( 'getpaid_date_format', get_option( 'date_format' ) );
887
+	return apply_filters('getpaid_date_format', get_option('date_format'));
888 888
 }
889 889
 
890 890
 /**
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
  * @return string
894 894
  */
895 895
 function getpaid_time_format() {
896
-	return apply_filters( 'getpaid_time_format', get_option( 'time_format' ) );
896
+	return apply_filters('getpaid_time_format', get_option('time_format'));
897 897
 }
898 898
 
899 899
 /**
@@ -903,16 +903,16 @@  discard block
 block discarded – undo
903 903
  * @param  integer $limit Limit size in characters.
904 904
  * @return string
905 905
  */
906
-function getpaid_limit_length( $string, $limit ) {
906
+function getpaid_limit_length($string, $limit) {
907 907
     $str_limit = $limit - 3;
908 908
 
909
-	if ( function_exists( 'mb_strimwidth' ) ) {
910
-		if ( mb_strlen( $string ) > $limit ) {
911
-			$string = mb_strimwidth( $string, 0, $str_limit ) . '...';
909
+	if (function_exists('mb_strimwidth')) {
910
+		if (mb_strlen($string) > $limit) {
911
+			$string = mb_strimwidth($string, 0, $str_limit) . '...';
912 912
 		}
913 913
 	} else {
914
-		if ( strlen( $string ) > $limit ) {
915
-			$string = substr( $string, 0, $str_limit ) . '...';
914
+		if (strlen($string) > $limit) {
915
+			$string = substr($string, 0, $str_limit) . '...';
916 916
 		}
917 917
 	}
918 918
     return $string;
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
  * @since 1.0.19
927 927
  */
928 928
 function getpaid_api() {
929
-    return getpaid()->get( 'api' );
929
+    return getpaid()->get('api');
930 930
 }
931 931
 
932 932
 /**
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
  * @since 1.0.19
937 937
  */
938 938
 function getpaid_post_types() {
939
-    return getpaid()->get( 'post_types' );
939
+    return getpaid()->get('post_types');
940 940
 }
941 941
 
942 942
 /**
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
  * @since 1.0.19
947 947
  */
948 948
 function getpaid_session() {
949
-    return getpaid()->get( 'session' );
949
+    return getpaid()->get('session');
950 950
 }
951 951
 
952 952
 /**
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
  * @since 1.0.19
957 957
  */
958 958
 function getpaid_notes() {
959
-    return getpaid()->get( 'notes' );
959
+    return getpaid()->get('notes');
960 960
 }
961 961
 
962 962
 /**
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
  * @return GetPaid_Admin
966 966
  */
967 967
 function getpaid_admin() {
968
-    return getpaid()->get( 'admin' );
968
+    return getpaid()->get('admin');
969 969
 }
970 970
 
971 971
 /**
@@ -975,8 +975,8 @@  discard block
 block discarded – undo
975 975
  * @param string $base the base url
976 976
  * @return string
977 977
  */
978
-function getpaid_get_authenticated_action_url( $action, $base = false ) {
979
-    return wp_nonce_url( add_query_arg( 'getpaid-action', $action, $base ), 'getpaid-nonce', 'getpaid-nonce' );
978
+function getpaid_get_authenticated_action_url($action, $base = false) {
979
+    return wp_nonce_url(add_query_arg('getpaid-action', $action, $base), 'getpaid-nonce', 'getpaid-nonce');
980 980
 }
981 981
 
982 982
 /**
@@ -984,11 +984,11 @@  discard block
 block discarded – undo
984 984
  *
985 985
  * @return string
986 986
  */
987
-function getpaid_get_post_type_label( $post_type, $plural = true ) {
987
+function getpaid_get_post_type_label($post_type, $plural = true) {
988 988
 
989
-    $post_type = get_post_type_object( $post_type );
989
+    $post_type = get_post_type_object($post_type);
990 990
 
991
-    if ( ! is_object( $post_type ) ) {
991
+    if (!is_object($post_type)) {
992 992
         return null;
993 993
     }
994 994
 
@@ -1001,18 +1001,18 @@  discard block
 block discarded – undo
1001 1001
  *
1002 1002
  * @return mixed|null
1003 1003
  */
1004
-function getpaid_get_array_field( $array, $key, $secondary_key = null ) {
1004
+function getpaid_get_array_field($array, $key, $secondary_key = null) {
1005 1005
 
1006
-    if ( ! is_array( $array ) ) {
1006
+    if (!is_array($array)) {
1007 1007
         return null;
1008 1008
     }
1009 1009
 
1010
-    if ( ! empty( $secondary_key ) ) {
1011
-        $array = isset( $array[ $secondary_key ] ) ? $array[ $secondary_key ] : array();
1012
-        return getpaid_get_array_field( $array, $key );
1010
+    if (!empty($secondary_key)) {
1011
+        $array = isset($array[$secondary_key]) ? $array[$secondary_key] : array();
1012
+        return getpaid_get_array_field($array, $key);
1013 1013
     }
1014 1014
 
1015
-    return isset( $array[ $key ] ) ? $array[ $key ] : null;
1015
+    return isset($array[$key]) ? $array[$key] : null;
1016 1016
 
1017 1017
 }
1018 1018
 
@@ -1021,12 +1021,12 @@  discard block
 block discarded – undo
1021 1021
  *
1022 1022
  * @return array
1023 1023
  */
1024
-function getpaid_array_merge_if_empty( $args, $defaults ) {
1024
+function getpaid_array_merge_if_empty($args, $defaults) {
1025 1025
 
1026
-    foreach ( $defaults as $key => $value ) {
1026
+    foreach ($defaults as $key => $value) {
1027 1027
 
1028
-        if ( array_key_exists( $key, $args ) && empty( $args[ $key ] ) ) {
1029
-            $args[ $key ] = $value;
1028
+        if (array_key_exists($key, $args) && empty($args[$key])) {
1029
+            $args[$key] = $value;
1030 1030
         }
1031 1031
 
1032 1032
     }
Please login to merge, or discard this patch.