Passed
Push — master ( cb75a2...6929e7 )
by Brian
05:54 queued 11s
created
includes/wpinv-template-functions.php 2 patches
Spacing   +592 added lines, -592 removed lines patch added patch discarded remove patch
@@ -4,99 +4,99 @@  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
  * Displays an invoice.
11 11
  * 
12 12
  * @param WPInv_Invoice $invoice.
13 13
  */
14
-function getpaid_invoice( $invoice ) {
15
-    if ( ! empty( $invoice ) ) {
16
-        wpinv_get_template( 'invoice/invoice.php', compact( 'invoice' ) );
14
+function getpaid_invoice($invoice) {
15
+    if (!empty($invoice)) {
16
+        wpinv_get_template('invoice/invoice.php', compact('invoice'));
17 17
     }
18 18
 }
19
-add_action( 'getpaid_invoice', 'getpaid_invoice', 10 );
19
+add_action('getpaid_invoice', 'getpaid_invoice', 10);
20 20
 
21 21
 /**
22 22
  * Displays the invoice footer.
23 23
  */
24
-function getpaid_invoice_footer( $invoice ) {
25
-    if ( ! empty( $invoice ) ) {
26
-        wpinv_get_template( 'invoice/footer.php', compact( 'invoice' ) );
24
+function getpaid_invoice_footer($invoice) {
25
+    if (!empty($invoice)) {
26
+        wpinv_get_template('invoice/footer.php', compact('invoice'));
27 27
     }
28 28
 }
29
-add_action( 'getpaid_invoice_footer', 'getpaid_invoice_footer', 10 );
29
+add_action('getpaid_invoice_footer', 'getpaid_invoice_footer', 10);
30 30
 
31 31
 /**
32 32
  * Displays the invoice top bar.
33 33
  */
34
-function getpaid_invoice_header( $invoice ) {
35
-    if ( ! empty( $invoice ) ) {
36
-        wpinv_get_template( 'invoice/header.php', compact( 'invoice' ) );
34
+function getpaid_invoice_header($invoice) {
35
+    if (!empty($invoice)) {
36
+        wpinv_get_template('invoice/header.php', compact('invoice'));
37 37
     }
38 38
 }
39
-add_action( 'getpaid_invoice_header', 'getpaid_invoice_header', 10 );
39
+add_action('getpaid_invoice_header', 'getpaid_invoice_header', 10);
40 40
 
41 41
 /**
42 42
  * Displays actions on the left side of the header.
43 43
  */
44
-function getpaid_invoice_header_left_actions( $invoice ) {
45
-    if ( ! empty( $invoice ) ) {
46
-        wpinv_get_template( 'invoice/header-left-actions.php', compact( 'invoice' ) );
44
+function getpaid_invoice_header_left_actions($invoice) {
45
+    if (!empty($invoice)) {
46
+        wpinv_get_template('invoice/header-left-actions.php', compact('invoice'));
47 47
     }
48 48
 }
49
-add_action( 'getpaid_invoice_header_left', 'getpaid_invoice_header_left_actions', 10 );
49
+add_action('getpaid_invoice_header_left', 'getpaid_invoice_header_left_actions', 10);
50 50
 
51 51
 /**
52 52
  * Displays actions on the right side of the invoice top bar.
53 53
  */
54
-function getpaid_invoice_header_right_actions( $invoice ) {
55
-    if ( ! empty( $invoice ) ) {
56
-        wpinv_get_template( 'invoice/header-right-actions.php', compact( 'invoice' ) );
54
+function getpaid_invoice_header_right_actions($invoice) {
55
+    if (!empty($invoice)) {
56
+        wpinv_get_template('invoice/header-right-actions.php', compact('invoice'));
57 57
     }
58 58
 }
59
-add_action( 'getpaid_invoice_header_right', 'getpaid_invoice_header_right_actions', 10 );
59
+add_action('getpaid_invoice_header_right', 'getpaid_invoice_header_right_actions', 10);
60 60
 
61 61
 /**
62 62
  * Displays the invoice title, watermark, logo etc.
63 63
  */
64
-function getpaid_invoice_details_top( $invoice ) {
65
-    if ( ! empty( $invoice ) ) {
66
-        wpinv_get_template( 'invoice/details-top.php', compact( 'invoice' ) );
64
+function getpaid_invoice_details_top($invoice) {
65
+    if (!empty($invoice)) {
66
+        wpinv_get_template('invoice/details-top.php', compact('invoice'));
67 67
     }
68 68
 }
69
-add_action( 'getpaid_invoice_details', 'getpaid_invoice_details_top', 10 );
69
+add_action('getpaid_invoice_details', 'getpaid_invoice_details_top', 10);
70 70
 
71 71
 /**
72 72
  * Displays the company logo.
73 73
  */
74
-function getpaid_invoice_logo( $invoice ) {
75
-    if ( ! empty( $invoice ) ) {
76
-        wpinv_get_template( 'invoice/invoice-logo.php', compact( 'invoice' ) );
74
+function getpaid_invoice_logo($invoice) {
75
+    if (!empty($invoice)) {
76
+        wpinv_get_template('invoice/invoice-logo.php', compact('invoice'));
77 77
     }
78 78
 }
79
-add_action( 'getpaid_invoice_details_top_left', 'getpaid_invoice_logo' );
79
+add_action('getpaid_invoice_details_top_left', 'getpaid_invoice_logo');
80 80
 
81 81
 /**
82 82
  * Displays the type of invoice.
83 83
  */
84
-function getpaid_invoice_type( $invoice ) {
85
-    if ( ! empty( $invoice ) ) {
86
-        wpinv_get_template( 'invoice/invoice-type.php', compact( 'invoice' ) );
84
+function getpaid_invoice_type($invoice) {
85
+    if (!empty($invoice)) {
86
+        wpinv_get_template('invoice/invoice-type.php', compact('invoice'));
87 87
     }
88 88
 }
89
-add_action( 'getpaid_invoice_details_top_right', 'getpaid_invoice_type' );
89
+add_action('getpaid_invoice_details_top_right', 'getpaid_invoice_type');
90 90
 
91 91
 /**
92 92
  * Displays the invoice details.
93 93
  */
94
-function getpaid_invoice_details_main( $invoice ) {
95
-    if ( ! empty( $invoice ) ) {
96
-        wpinv_get_template( 'invoice/details.php', compact( 'invoice' ) );
94
+function getpaid_invoice_details_main($invoice) {
95
+    if (!empty($invoice)) {
96
+        wpinv_get_template('invoice/details.php', compact('invoice'));
97 97
     }
98 98
 }
99
-add_action( 'getpaid_invoice_details', 'getpaid_invoice_details_main', 50 );
99
+add_action('getpaid_invoice_details', 'getpaid_invoice_details_main', 50);
100 100
 
101 101
 /**
102 102
  * Returns a path to the templates directory.
@@ -125,30 +125,30 @@  discard block
 block discarded – undo
125 125
  * @param string $template_path The templates directory relative to the theme's root dir. Defaults to 'invoicing'.
126 126
  * @param string $default_path The root path to the default template. Defaults to invoicing/templates
127 127
  */
128
-function wpinv_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
128
+function wpinv_get_template($template_name, $args = array(), $template_path = '', $default_path = '') {
129 129
 
130 130
     // Make variables available to the template.
131
-    if ( ! empty( $args ) && is_array( $args ) ) {
132
-		extract( $args );
131
+    if (!empty($args) && is_array($args)) {
132
+		extract($args);
133 133
 	}
134 134
 
135 135
     // Locate the template.
136
-	$located = wpinv_locate_template( $template_name, $template_path, $default_path );
136
+	$located = wpinv_locate_template($template_name, $template_path, $default_path);
137 137
 
138 138
     // Abort if the file does not exist.
139
-	if ( ! file_exists( $located ) ) {
140
-        _doing_it_wrong( __FUNCTION__, sprintf( '<code>%s</code> does not exist.', $located ), '2.1' );
139
+	if (!file_exists($located)) {
140
+        _doing_it_wrong(__FUNCTION__, sprintf('<code>%s</code> does not exist.', $located), '2.1');
141 141
 		return;
142 142
 	}
143 143
 
144 144
     // Fires before loading a template.
145
-	do_action( 'wpinv_before_template_part', $template_name, $template_path, $located, $args );
145
+	do_action('wpinv_before_template_part', $template_name, $template_path, $located, $args);
146 146
 
147 147
     // Load the template.
148
-	include( $located );
148
+	include($located);
149 149
 
150 150
     // Fires after loading a template.
151
-	do_action( 'wpinv_after_template_part', $template_name, $template_path, $located, $args );
151
+	do_action('wpinv_after_template_part', $template_name, $template_path, $located, $args);
152 152
 }
153 153
 
154 154
 /**
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
  * @param string $template_path The templates directory relative to the theme's root dir. Defaults to 'invoicing'.
161 161
  * @param string $default_path The root path to the default template. Defaults to invoicing/templates
162 162
  */
163
-function wpinv_get_template_html( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
163
+function wpinv_get_template_html($template_name, $args = array(), $template_path = '', $default_path = '') {
164 164
 	ob_start();
165
-	wpinv_get_template( $template_name, $args, $template_path, $default_path );
165
+	wpinv_get_template($template_name, $args, $template_path, $default_path);
166 166
 	return ob_get_clean();
167 167
 }
168 168
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
  * @return string
173 173
  */
174 174
 function wpinv_template_path() {
175
-    return apply_filters( 'wpinv_template_path', wpinv_get_theme_template_dir_name() );
175
+    return apply_filters('wpinv_template_path', wpinv_get_theme_template_dir_name());
176 176
 }
177 177
 
178 178
 /**
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
  * @return string
182 182
  */
183 183
 function wpinv_get_theme_template_dir_name() {
184
-	return trailingslashit( apply_filters( 'wpinv_templates_dir', 'invoicing' ) );
184
+	return trailingslashit(apply_filters('wpinv_templates_dir', 'invoicing'));
185 185
 }
186 186
 
187 187
 /**
@@ -193,72 +193,72 @@  discard block
 block discarded – undo
193 193
  * @param string $template_path The template path relative to the theme's root dir. Defaults to 'invoicing'.
194 194
  * @param string $default_path The root path to the default template. Defaults to invoicing/templates
195 195
  */
196
-function wpinv_locate_template( $template_name, $template_path = '', $default_path = '' ) {
196
+function wpinv_locate_template($template_name, $template_path = '', $default_path = '') {
197 197
 
198 198
     // Load the defaults for the template path and default path.
199
-    $template_path = empty( $template_path ) ? wpinv_template_path() : $template_path;
200
-    $default_path  = empty( $default_path ) ? WPINV_PLUGIN_DIR . 'templates/' : $default_path;
199
+    $template_path = empty($template_path) ? wpinv_template_path() : $template_path;
200
+    $default_path  = empty($default_path) ? WPINV_PLUGIN_DIR . 'templates/' : $default_path;
201 201
 
202 202
     // Check if the template was overidden.
203 203
     $template = locate_template(
204
-        array( trailingslashit( $template_path ) . $template_name )
204
+        array(trailingslashit($template_path) . $template_name)
205 205
     );
206 206
 
207 207
     // Maybe replace it with a default path.
208
-    if ( empty( $template ) && ! empty( $default_path ) ) {
209
-        $template = trailingslashit( $default_path ) . $template_name;
208
+    if (empty($template) && !empty($default_path)) {
209
+        $template = trailingslashit($default_path) . $template_name;
210 210
     }
211 211
 
212 212
     // Return what we found.
213
-    return apply_filters( 'wpinv_locate_template', $template, $template_name, $template_path, $default_path );
213
+    return apply_filters('wpinv_locate_template', $template, $template_name, $template_path, $default_path);
214 214
 }
215 215
 
216
-function wpinv_get_template_part( $slug, $name = null, $load = true ) {
217
-	do_action( 'get_template_part_' . $slug, $slug, $name );
216
+function wpinv_get_template_part($slug, $name = null, $load = true) {
217
+	do_action('get_template_part_' . $slug, $slug, $name);
218 218
 
219 219
 	// Setup possible parts
220 220
 	$templates = array();
221
-	if ( isset( $name ) )
221
+	if (isset($name))
222 222
 		$templates[] = $slug . '-' . $name . '.php';
223 223
 	$templates[] = $slug . '.php';
224 224
 
225 225
 	// Allow template parts to be filtered
226
-	$templates = apply_filters( 'wpinv_get_template_part', $templates, $slug, $name );
226
+	$templates = apply_filters('wpinv_get_template_part', $templates, $slug, $name);
227 227
 
228 228
 	// Return the part that is found
229
-	return wpinv_locate_tmpl( $templates, $load, false );
229
+	return wpinv_locate_tmpl($templates, $load, false);
230 230
 }
231 231
 
232
-function wpinv_locate_tmpl( $template_names, $load = false, $require_once = true ) {
232
+function wpinv_locate_tmpl($template_names, $load = false, $require_once = true) {
233 233
 	// No file found yet
234 234
 	$located = false;
235 235
 
236 236
 	// Try to find a template file
237
-	foreach ( (array)$template_names as $template_name ) {
237
+	foreach ((array) $template_names as $template_name) {
238 238
 
239 239
 		// Continue if template is empty
240
-		if ( empty( $template_name ) )
240
+		if (empty($template_name))
241 241
 			continue;
242 242
 
243 243
 		// Trim off any slashes from the template name
244
-		$template_name = ltrim( $template_name, '/' );
244
+		$template_name = ltrim($template_name, '/');
245 245
 
246 246
 		// try locating this template file by looping through the template paths
247
-		foreach( wpinv_get_theme_template_paths() as $template_path ) {
247
+		foreach (wpinv_get_theme_template_paths() as $template_path) {
248 248
 
249
-			if( file_exists( $template_path . $template_name ) ) {
249
+			if (file_exists($template_path . $template_name)) {
250 250
 				$located = $template_path . $template_name;
251 251
 				break;
252 252
 			}
253 253
 		}
254 254
 
255
-		if( !empty( $located ) ) {
255
+		if (!empty($located)) {
256 256
 			break;
257 257
 		}
258 258
 	}
259 259
 
260
-	if ( ( true == $load ) && ! empty( $located ) )
261
-		load_template( $located, $require_once );
260
+	if ((true == $load) && !empty($located))
261
+		load_template($located, $require_once);
262 262
 
263 263
 	return $located;
264 264
 }
@@ -267,155 +267,155 @@  discard block
 block discarded – undo
267 267
 	$template_dir = wpinv_get_theme_template_dir_name();
268 268
 
269 269
 	$file_paths = array(
270
-		1 => trailingslashit( get_stylesheet_directory() ) . $template_dir,
271
-		10 => trailingslashit( get_template_directory() ) . $template_dir,
270
+		1 => trailingslashit(get_stylesheet_directory()) . $template_dir,
271
+		10 => trailingslashit(get_template_directory()) . $template_dir,
272 272
 		100 => wpinv_get_templates_dir()
273 273
 	);
274 274
 
275
-	$file_paths = apply_filters( 'wpinv_template_paths', $file_paths );
275
+	$file_paths = apply_filters('wpinv_template_paths', $file_paths);
276 276
 
277 277
 	// sort the file paths based on priority
278
-	ksort( $file_paths, SORT_NUMERIC );
278
+	ksort($file_paths, SORT_NUMERIC);
279 279
 
280
-	return array_map( 'trailingslashit', $file_paths );
280
+	return array_map('trailingslashit', $file_paths);
281 281
 }
282 282
 
283 283
 function wpinv_checkout_meta_tags() {
284 284
 
285 285
 	$pages   = array();
286
-	$pages[] = wpinv_get_option( 'success_page' );
287
-	$pages[] = wpinv_get_option( 'failure_page' );
288
-	$pages[] = wpinv_get_option( 'invoice_history_page' );
289
-	$pages[] = wpinv_get_option( 'invoice_subscription_page' );
286
+	$pages[] = wpinv_get_option('success_page');
287
+	$pages[] = wpinv_get_option('failure_page');
288
+	$pages[] = wpinv_get_option('invoice_history_page');
289
+	$pages[] = wpinv_get_option('invoice_subscription_page');
290 290
 
291
-	if( !wpinv_is_checkout() && !is_page( $pages ) ) {
291
+	if (!wpinv_is_checkout() && !is_page($pages)) {
292 292
 		return;
293 293
 	}
294 294
 
295 295
 	echo '<meta name="robots" content="noindex,nofollow" />' . "\n";
296 296
 }
297
-add_action( 'wp_head', 'wpinv_checkout_meta_tags' );
297
+add_action('wp_head', 'wpinv_checkout_meta_tags');
298 298
 
299
-function wpinv_add_body_classes( $class ) {
300
-	$classes = (array)$class;
299
+function wpinv_add_body_classes($class) {
300
+	$classes = (array) $class;
301 301
 
302
-	if( wpinv_is_checkout() ) {
302
+	if (wpinv_is_checkout()) {
303 303
 		$classes[] = 'wpinv-checkout';
304 304
 		$classes[] = 'wpinv-page';
305 305
 	}
306 306
 
307
-	if( wpinv_is_success_page() ) {
307
+	if (wpinv_is_success_page()) {
308 308
 		$classes[] = 'wpinv-success';
309 309
 		$classes[] = 'wpinv-page';
310 310
 	}
311 311
 
312
-	if( wpinv_is_failed_transaction_page() ) {
312
+	if (wpinv_is_failed_transaction_page()) {
313 313
 		$classes[] = 'wpinv-failed-transaction';
314 314
 		$classes[] = 'wpinv-page';
315 315
 	}
316 316
 
317
-	if( wpinv_is_invoice_history_page() ) {
317
+	if (wpinv_is_invoice_history_page()) {
318 318
 		$classes[] = 'wpinv-history';
319 319
 		$classes[] = 'wpinv-page';
320 320
 	}
321 321
 
322
-	if( wpinv_is_subscriptions_history_page() ) {
322
+	if (wpinv_is_subscriptions_history_page()) {
323 323
 		$classes[] = 'wpinv-subscription';
324 324
 		$classes[] = 'wpinv-page';
325 325
 	}
326 326
 
327
-	if( wpinv_is_test_mode() ) {
327
+	if (wpinv_is_test_mode()) {
328 328
 		$classes[] = 'wpinv-test-mode';
329 329
 		$classes[] = 'wpinv-page';
330 330
 	}
331 331
 
332
-	return array_unique( $classes );
332
+	return array_unique($classes);
333 333
 }
334
-add_filter( 'body_class', 'wpinv_add_body_classes' );
334
+add_filter('body_class', 'wpinv_add_body_classes');
335 335
 
336
-function wpinv_html_dropdown( $name = 'wpinv_discounts', $selected = 0, $status = '' ) {
337
-    $args = array( 'nopaging' => true );
336
+function wpinv_html_dropdown($name = 'wpinv_discounts', $selected = 0, $status = '') {
337
+    $args = array('nopaging' => true);
338 338
 
339
-    if ( ! empty( $status ) )
339
+    if (!empty($status))
340 340
         $args['post_status'] = $status;
341 341
 
342
-    $discounts = wpinv_get_discounts( $args );
342
+    $discounts = wpinv_get_discounts($args);
343 343
     $options   = array();
344 344
 
345
-    if ( $discounts ) {
346
-        foreach ( $discounts as $discount ) {
347
-            $options[ absint( $discount->ID ) ] = esc_html( get_the_title( $discount->ID ) );
345
+    if ($discounts) {
346
+        foreach ($discounts as $discount) {
347
+            $options[absint($discount->ID)] = esc_html(get_the_title($discount->ID));
348 348
         }
349 349
     } else {
350
-        $options[0] = __( 'No discounts found', 'invoicing' );
350
+        $options[0] = __('No discounts found', 'invoicing');
351 351
     }
352 352
 
353
-    $output = wpinv_html_select( array(
353
+    $output = wpinv_html_select(array(
354 354
         'name'             => $name,
355 355
         'selected'         => $selected,
356 356
         'options'          => $options,
357 357
         'show_option_all'  => false,
358 358
         'show_option_none' => false,
359
-    ) );
359
+    ));
360 360
 
361 361
     return $output;
362 362
 }
363 363
 
364
-function wpinv_html_year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) {
365
-    $current     = date( 'Y' );
366
-    $start_year  = $current - absint( $years_before );
367
-    $end_year    = $current + absint( $years_after );
368
-    $selected    = empty( $selected ) ? date( 'Y' ) : $selected;
364
+function wpinv_html_year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) {
365
+    $current     = date('Y');
366
+    $start_year  = $current - absint($years_before);
367
+    $end_year    = $current + absint($years_after);
368
+    $selected    = empty($selected) ? date('Y') : $selected;
369 369
     $options     = array();
370 370
 
371
-    while ( $start_year <= $end_year ) {
372
-        $options[ absint( $start_year ) ] = $start_year;
371
+    while ($start_year <= $end_year) {
372
+        $options[absint($start_year)] = $start_year;
373 373
         $start_year++;
374 374
     }
375 375
 
376
-    $output = wpinv_html_select( array(
376
+    $output = wpinv_html_select(array(
377 377
         'name'             => $name,
378 378
         'selected'         => $selected,
379 379
         'options'          => $options,
380 380
         'show_option_all'  => false,
381 381
         'show_option_none' => false
382
-    ) );
382
+    ));
383 383
 
384 384
     return $output;
385 385
 }
386 386
 
387
-function wpinv_html_month_dropdown( $name = 'month', $selected = 0 ) {
387
+function wpinv_html_month_dropdown($name = 'month', $selected = 0) {
388 388
 
389 389
     $options = array(
390
-        '1'  => __( 'January', 'invoicing' ),
391
-        '2'  => __( 'February', 'invoicing' ),
392
-        '3'  => __( 'March', 'invoicing' ),
393
-        '4'  => __( 'April', 'invoicing' ),
394
-        '5'  => __( 'May', 'invoicing' ),
395
-        '6'  => __( 'June', 'invoicing' ),
396
-        '7'  => __( 'July', 'invoicing' ),
397
-        '8'  => __( 'August', 'invoicing' ),
398
-        '9'  => __( 'September', 'invoicing' ),
399
-        '10' => __( 'October', 'invoicing' ),
400
-        '11' => __( 'November', 'invoicing' ),
401
-        '12' => __( 'December', 'invoicing' ),
390
+        '1'  => __('January', 'invoicing'),
391
+        '2'  => __('February', 'invoicing'),
392
+        '3'  => __('March', 'invoicing'),
393
+        '4'  => __('April', 'invoicing'),
394
+        '5'  => __('May', 'invoicing'),
395
+        '6'  => __('June', 'invoicing'),
396
+        '7'  => __('July', 'invoicing'),
397
+        '8'  => __('August', 'invoicing'),
398
+        '9'  => __('September', 'invoicing'),
399
+        '10' => __('October', 'invoicing'),
400
+        '11' => __('November', 'invoicing'),
401
+        '12' => __('December', 'invoicing'),
402 402
     );
403 403
 
404 404
     // If no month is selected, default to the current month
405
-    $selected = empty( $selected ) ? date( 'n' ) : $selected;
405
+    $selected = empty($selected) ? date('n') : $selected;
406 406
 
407
-    $output = wpinv_html_select( array(
407
+    $output = wpinv_html_select(array(
408 408
         'name'             => $name,
409 409
         'selected'         => $selected,
410 410
         'options'          => $options,
411 411
         'show_option_all'  => false,
412 412
         'show_option_none' => false
413
-    ) );
413
+    ));
414 414
 
415 415
     return $output;
416 416
 }
417 417
 
418
-function wpinv_html_select( $args = array() ) {
418
+function wpinv_html_select($args = array()) {
419 419
     $defaults = array(
420 420
         'options'          => array(),
421 421
         'name'             => null,
@@ -424,8 +424,8 @@  discard block
 block discarded – undo
424 424
         'selected'         => 0,
425 425
         'placeholder'      => null,
426 426
         'multiple'         => false,
427
-        'show_option_all'  => _x( 'All', 'all dropdown items', 'invoicing' ),
428
-        'show_option_none' => _x( 'None', 'no dropdown items', 'invoicing' ),
427
+        'show_option_all'  => _x('All', 'all dropdown items', 'invoicing'),
428
+        'show_option_none' => _x('None', 'no dropdown items', 'invoicing'),
429 429
         'data'             => array(),
430 430
         'onchange'         => null,
431 431
         'required'         => false,
@@ -433,74 +433,74 @@  discard block
 block discarded – undo
433 433
         'readonly'         => false,
434 434
     );
435 435
 
436
-    $args = wp_parse_args( $args, $defaults );
436
+    $args = wp_parse_args($args, $defaults);
437 437
 
438 438
     $data_elements = '';
439
-    foreach ( $args['data'] as $key => $value ) {
440
-        $data_elements .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
439
+    foreach ($args['data'] as $key => $value) {
440
+        $data_elements .= ' data-' . esc_attr($key) . '="' . esc_attr($value) . '"';
441 441
     }
442 442
 
443
-    if( $args['multiple'] ) {
443
+    if ($args['multiple']) {
444 444
         $multiple = ' MULTIPLE';
445 445
     } else {
446 446
         $multiple = '';
447 447
     }
448 448
 
449
-    if( $args['placeholder'] ) {
449
+    if ($args['placeholder']) {
450 450
         $placeholder = $args['placeholder'];
451 451
     } else {
452 452
         $placeholder = '';
453 453
     }
454 454
     
455 455
     $options = '';
456
-    if( !empty( $args['onchange'] ) ) {
457
-        $options .= ' onchange="' . esc_attr( $args['onchange'] ) . '"';
456
+    if (!empty($args['onchange'])) {
457
+        $options .= ' onchange="' . esc_attr($args['onchange']) . '"';
458 458
     }
459 459
     
460
-    if( !empty( $args['required'] ) ) {
460
+    if (!empty($args['required'])) {
461 461
         $options .= ' required="required"';
462 462
     }
463 463
     
464
-    if( !empty( $args['disabled'] ) ) {
464
+    if (!empty($args['disabled'])) {
465 465
         $options .= ' disabled';
466 466
     }
467 467
     
468
-    if( !empty( $args['readonly'] ) ) {
468
+    if (!empty($args['readonly'])) {
469 469
         $options .= ' readonly';
470 470
     }
471 471
 
472
-    $class  = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
473
-    $output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['id'] ) . '" class="wpinv-select ' . $class . '"' . $multiple . ' data-placeholder="' . $placeholder . '" ' . trim( $options ) . $data_elements . '>';
472
+    $class  = implode(' ', array_map('sanitize_html_class', explode(' ', $args['class'])));
473
+    $output = '<select name="' . esc_attr($args['name']) . '" id="' . esc_attr($args['id']) . '" class="wpinv-select ' . $class . '"' . $multiple . ' data-placeholder="' . $placeholder . '" ' . trim($options) . $data_elements . '>';
474 474
 
475
-    if ( $args['show_option_all'] ) {
476
-        if( $args['multiple'] ) {
477
-            $selected = selected( true, in_array( 0, $args['selected'] ), false );
475
+    if ($args['show_option_all']) {
476
+        if ($args['multiple']) {
477
+            $selected = selected(true, in_array(0, $args['selected']), false);
478 478
         } else {
479
-            $selected = selected( $args['selected'], 0, false );
479
+            $selected = selected($args['selected'], 0, false);
480 480
         }
481
-        $output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
481
+        $output .= '<option value="all"' . $selected . '>' . esc_html($args['show_option_all']) . '</option>';
482 482
     }
483 483
 
484
-    if ( !empty( $args['options'] ) ) {
484
+    if (!empty($args['options'])) {
485 485
 
486
-        if ( $args['show_option_none'] ) {
487
-            if( $args['multiple'] ) {
488
-                $selected = selected( true, in_array( "", $args['selected'] ), false );
486
+        if ($args['show_option_none']) {
487
+            if ($args['multiple']) {
488
+                $selected = selected(true, in_array("", $args['selected']), false);
489 489
             } else {
490
-                $selected = selected( $args['selected'] === "", true, false );
490
+                $selected = selected($args['selected'] === "", true, false);
491 491
             }
492
-            $output .= '<option value=""' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
492
+            $output .= '<option value=""' . $selected . '>' . esc_html($args['show_option_none']) . '</option>';
493 493
         }
494 494
 
495
-        foreach( $args['options'] as $key => $option ) {
495
+        foreach ($args['options'] as $key => $option) {
496 496
 
497
-            if( $args['multiple'] && is_array( $args['selected'] ) ) {
498
-                $selected = selected( true, (bool)in_array( $key, $args['selected'] ), false );
497
+            if ($args['multiple'] && is_array($args['selected'])) {
498
+                $selected = selected(true, (bool) in_array($key, $args['selected']), false);
499 499
             } else {
500
-                $selected = selected( $args['selected'], $key, false );
500
+                $selected = selected($args['selected'], $key, false);
501 501
             }
502 502
 
503
-            $output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
503
+            $output .= '<option value="' . esc_attr($key) . '"' . $selected . '>' . esc_html($option) . '</option>';
504 504
         }
505 505
     }
506 506
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
     return $output;
510 510
 }
511 511
 
512
-function wpinv_item_dropdown( $args = array() ) {
512
+function wpinv_item_dropdown($args = array()) {
513 513
     $defaults = array(
514 514
         'name'              => 'wpi_item',
515 515
         'id'                => 'wpi_item',
@@ -517,14 +517,14 @@  discard block
 block discarded – undo
517 517
         'multiple'          => false,
518 518
         'selected'          => 0,
519 519
         'number'            => 100,
520
-        'placeholder'       => __( 'Choose a item', 'invoicing' ),
521
-        'data'              => array( 'search-type' => 'item' ),
520
+        'placeholder'       => __('Choose a item', 'invoicing'),
521
+        'data'              => array('search-type' => 'item'),
522 522
         'show_option_all'   => false,
523 523
         'show_option_none'  => false,
524 524
         'show_recurring'    => false,
525 525
     );
526 526
 
527
-    $args = wp_parse_args( $args, $defaults );
527
+    $args = wp_parse_args($args, $defaults);
528 528
 
529 529
     $item_args = array(
530 530
         'post_type'      => 'wpi_item',
@@ -533,44 +533,44 @@  discard block
 block discarded – undo
533 533
         'posts_per_page' => $args['number']
534 534
     );
535 535
 
536
-    $item_args  = apply_filters( 'wpinv_item_dropdown_query_args', $item_args, $args, $defaults );
536
+    $item_args  = apply_filters('wpinv_item_dropdown_query_args', $item_args, $args, $defaults);
537 537
 
538
-    $items      = get_posts( $item_args );
538
+    $items      = get_posts($item_args);
539 539
     $options    = array();
540
-    if ( $items ) {
541
-        foreach ( $items as $item ) {
542
-            $title = esc_html( $item->post_title );
540
+    if ($items) {
541
+        foreach ($items as $item) {
542
+            $title = esc_html($item->post_title);
543 543
             
544
-            if ( !empty( $args['show_recurring'] ) ) {
545
-                $title .= wpinv_get_item_suffix( $item->ID, false );
544
+            if (!empty($args['show_recurring'])) {
545
+                $title .= wpinv_get_item_suffix($item->ID, false);
546 546
             }
547 547
             
548
-            $options[ absint( $item->ID ) ] = $title;
548
+            $options[absint($item->ID)] = $title;
549 549
         }
550 550
     }
551 551
 
552 552
     // This ensures that any selected items are included in the drop down
553
-    if( is_array( $args['selected'] ) ) {
554
-        foreach( $args['selected'] as $item ) {
555
-            if( ! in_array( $item, $options ) ) {
556
-                $title = get_the_title( $item );
557
-                if ( !empty( $args['show_recurring'] ) ) {
558
-                    $title .= wpinv_get_item_suffix( $item, false );
553
+    if (is_array($args['selected'])) {
554
+        foreach ($args['selected'] as $item) {
555
+            if (!in_array($item, $options)) {
556
+                $title = get_the_title($item);
557
+                if (!empty($args['show_recurring'])) {
558
+                    $title .= wpinv_get_item_suffix($item, false);
559 559
                 }
560 560
                 $options[$item] = $title;
561 561
             }
562 562
         }
563
-    } elseif ( is_numeric( $args['selected'] ) && $args['selected'] !== 0 ) {
564
-        if ( ! in_array( $args['selected'], $options ) ) {
565
-            $title = get_the_title( $args['selected'] );
566
-            if ( !empty( $args['show_recurring'] ) ) {
567
-                $title .= wpinv_get_item_suffix( $args['selected'], false );
563
+    } elseif (is_numeric($args['selected']) && $args['selected'] !== 0) {
564
+        if (!in_array($args['selected'], $options)) {
565
+            $title = get_the_title($args['selected']);
566
+            if (!empty($args['show_recurring'])) {
567
+                $title .= wpinv_get_item_suffix($args['selected'], false);
568 568
             }
569
-            $options[$args['selected']] = get_the_title( $args['selected'] );
569
+            $options[$args['selected']] = get_the_title($args['selected']);
570 570
         }
571 571
     }
572 572
 
573
-    $output = wpinv_html_select( array(
573
+    $output = wpinv_html_select(array(
574 574
         'name'             => $args['name'],
575 575
         'selected'         => $args['selected'],
576 576
         'id'               => $args['id'],
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
         'show_option_all'  => $args['show_option_all'],
582 582
         'show_option_none' => $args['show_option_none'],
583 583
         'data'             => $args['data'],
584
-    ) );
584
+    ));
585 585
 
586 586
     return $output;
587 587
 }
@@ -601,16 +601,16 @@  discard block
 block discarded – undo
601 601
     );
602 602
 
603 603
     $options = array();
604
-    if ( $items ) {
605
-        foreach ( $items as $item ) {
606
-            $options[ $item->ID ] = esc_html( $item->post_title ) . wpinv_get_item_suffix( $item->ID, false );
604
+    if ($items) {
605
+        foreach ($items as $item) {
606
+            $options[$item->ID] = esc_html($item->post_title) . wpinv_get_item_suffix($item->ID, false);
607 607
         }
608 608
     }
609 609
 
610 610
     return $options;
611 611
 }
612 612
 
613
-function wpinv_html_checkbox( $args = array() ) {
613
+function wpinv_html_checkbox($args = array()) {
614 614
     $defaults = array(
615 615
         'name'     => null,
616 616
         'current'  => null,
@@ -621,17 +621,17 @@  discard block
 block discarded – undo
621 621
         )
622 622
     );
623 623
 
624
-    $args = wp_parse_args( $args, $defaults );
624
+    $args = wp_parse_args($args, $defaults);
625 625
 
626
-    $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
626
+    $class = implode(' ', array_map('sanitize_html_class', explode(' ', $args['class'])));
627 627
     $options = '';
628
-    if ( ! empty( $args['options']['disabled'] ) ) {
628
+    if (!empty($args['options']['disabled'])) {
629 629
         $options .= ' disabled="disabled"';
630
-    } elseif ( ! empty( $args['options']['readonly'] ) ) {
630
+    } elseif (!empty($args['options']['readonly'])) {
631 631
         $options .= ' readonly';
632 632
     }
633 633
 
634
-    $output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $class . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />';
634
+    $output = '<input type="checkbox"' . $options . ' name="' . esc_attr($args['name']) . '" id="' . esc_attr($args['name']) . '" class="' . $class . ' ' . esc_attr($args['name']) . '" ' . checked(1, $args['current'], false) . ' />';
635 635
 
636 636
     return $output;
637 637
 }
@@ -639,30 +639,30 @@  discard block
 block discarded – undo
639 639
 /**
640 640
  * Displays a hidden field.
641 641
  */
642
-function getpaid_hidden_field( $name, $value ) {
643
-    $name  = sanitize_text_field( $name );
644
-    $value = esc_attr( $value );
642
+function getpaid_hidden_field($name, $value) {
643
+    $name  = sanitize_text_field($name);
644
+    $value = esc_attr($value);
645 645
 
646 646
     echo "<input type='hidden' name='$name' value='$value' />";
647 647
 }
648 648
 
649
-function wpinv_html_text( $args = array() ) {
649
+function wpinv_html_text($args = array()) {
650 650
     // Backwards compatibility
651
-    if ( func_num_args() > 1 ) {
651
+    if (func_num_args() > 1) {
652 652
         $args = func_get_args();
653 653
 
654 654
         $name  = $args[0];
655
-        $value = isset( $args[1] ) ? $args[1] : '';
656
-        $label = isset( $args[2] ) ? $args[2] : '';
657
-        $desc  = isset( $args[3] ) ? $args[3] : '';
655
+        $value = isset($args[1]) ? $args[1] : '';
656
+        $label = isset($args[2]) ? $args[2] : '';
657
+        $desc  = isset($args[3]) ? $args[3] : '';
658 658
     }
659 659
 
660 660
     $defaults = array(
661 661
         'id'           => '',
662
-        'name'         => isset( $name )  ? $name  : 'text',
663
-        'value'        => isset( $value ) ? $value : null,
664
-        'label'        => isset( $label ) ? $label : null,
665
-        'desc'         => isset( $desc )  ? $desc  : null,
662
+        'name'         => isset($name) ? $name : 'text',
663
+        'value'        => isset($value) ? $value : null,
664
+        'label'        => isset($label) ? $label : null,
665
+        'desc'         => isset($desc) ? $desc : null,
666 666
         'placeholder'  => '',
667 667
         'class'        => 'regular-text',
668 668
         'disabled'     => false,
@@ -672,51 +672,51 @@  discard block
 block discarded – undo
672 672
         'data'         => false
673 673
     );
674 674
 
675
-    $args = wp_parse_args( $args, $defaults );
675
+    $args = wp_parse_args($args, $defaults);
676 676
 
677
-    $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
677
+    $class = implode(' ', array_map('sanitize_html_class', explode(' ', $args['class'])));
678 678
     $options = '';
679
-    if( $args['required'] ) {
679
+    if ($args['required']) {
680 680
         $options .= ' required="required"';
681 681
     }
682
-    if( $args['readonly'] ) {
682
+    if ($args['readonly']) {
683 683
         $options .= ' readonly';
684 684
     }
685
-    if( $args['readonly'] ) {
685
+    if ($args['readonly']) {
686 686
         $options .= ' readonly';
687 687
     }
688 688
 
689 689
     $data = '';
690
-    if ( !empty( $args['data'] ) ) {
691
-        foreach ( $args['data'] as $key => $value ) {
692
-            $data .= 'data-' . wpinv_sanitize_key( $key ) . '="' . esc_attr( $value ) . '" ';
690
+    if (!empty($args['data'])) {
691
+        foreach ($args['data'] as $key => $value) {
692
+            $data .= 'data-' . wpinv_sanitize_key($key) . '="' . esc_attr($value) . '" ';
693 693
         }
694 694
     }
695 695
 
696
-    $output = '<span id="wpinv-' . wpinv_sanitize_key( $args['name'] ) . '-wrap">';
697
-    $output .= '<label class="wpinv-label" for="' . wpinv_sanitize_key( $args['id'] ) . '">' . esc_html( $args['label'] ) . '</label>';
698
-    if ( ! empty( $args['desc'] ) ) {
699
-        $output .= '<span class="wpinv-description">' . esc_html( $args['desc'] ) . '</span>';
696
+    $output = '<span id="wpinv-' . wpinv_sanitize_key($args['name']) . '-wrap">';
697
+    $output .= '<label class="wpinv-label" for="' . wpinv_sanitize_key($args['id']) . '">' . esc_html($args['label']) . '</label>';
698
+    if (!empty($args['desc'])) {
699
+        $output .= '<span class="wpinv-description">' . esc_html($args['desc']) . '</span>';
700 700
     }
701 701
 
702
-    $output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['id'] )  . '" autocomplete="' . esc_attr( $args['autocomplete'] )  . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $class . '" ' . $data . ' ' . trim( $options ) . '/>';
702
+    $output .= '<input type="text" name="' . esc_attr($args['name']) . '" id="' . esc_attr($args['id']) . '" autocomplete="' . esc_attr($args['autocomplete']) . '" value="' . esc_attr($args['value']) . '" placeholder="' . esc_attr($args['placeholder']) . '" class="' . $class . '" ' . $data . ' ' . trim($options) . '/>';
703 703
 
704 704
     $output .= '</span>';
705 705
 
706 706
     return $output;
707 707
 }
708 708
 
709
-function wpinv_html_date_field( $args = array() ) {
710
-    if( empty( $args['class'] ) ) {
709
+function wpinv_html_date_field($args = array()) {
710
+    if (empty($args['class'])) {
711 711
         $args['class'] = 'wpiDatepicker';
712
-    } elseif( ! strpos( $args['class'], 'wpiDatepicker' ) ) {
712
+    } elseif (!strpos($args['class'], 'wpiDatepicker')) {
713 713
         $args['class'] .= ' wpiDatepicker';
714 714
     }
715 715
 
716
-    return wpinv_html_text( $args );
716
+    return wpinv_html_text($args);
717 717
 }
718 718
 
719
-function wpinv_html_textarea( $args = array() ) {
719
+function wpinv_html_textarea($args = array()) {
720 720
     $defaults = array(
721 721
         'name'        => 'textarea',
722 722
         'value'       => null,
@@ -727,31 +727,31 @@  discard block
 block discarded – undo
727 727
         'placeholder' => '',
728 728
     );
729 729
 
730
-    $args = wp_parse_args( $args, $defaults );
730
+    $args = wp_parse_args($args, $defaults);
731 731
 
732
-    $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
732
+    $class = implode(' ', array_map('sanitize_html_class', explode(' ', $args['class'])));
733 733
     $disabled = '';
734
-    if( $args['disabled'] ) {
734
+    if ($args['disabled']) {
735 735
         $disabled = ' disabled="disabled"';
736 736
     }
737 737
 
738
-    $output = '<span id="wpinv-' . wpinv_sanitize_key( $args['name'] ) . '-wrap">';
739
-    $output .= '<label class="wpinv-label" for="' . wpinv_sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
740
-    $output .= '<textarea name="' . esc_attr( $args['name'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" id="' . wpinv_sanitize_key( $args['name'] ) . '" class="' . $class . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>';
738
+    $output = '<span id="wpinv-' . wpinv_sanitize_key($args['name']) . '-wrap">';
739
+    $output .= '<label class="wpinv-label" for="' . wpinv_sanitize_key($args['name']) . '">' . esc_html($args['label']) . '</label>';
740
+    $output .= '<textarea name="' . esc_attr($args['name']) . '" placeholder="' . esc_attr($args['placeholder']) . '" id="' . wpinv_sanitize_key($args['name']) . '" class="' . $class . '"' . $disabled . '>' . esc_attr($args['value']) . '</textarea>';
741 741
 
742
-    if ( ! empty( $args['desc'] ) ) {
743
-        $output .= '<span class="wpinv-description">' . esc_html( $args['desc'] ) . '</span>';
742
+    if (!empty($args['desc'])) {
743
+        $output .= '<span class="wpinv-description">' . esc_html($args['desc']) . '</span>';
744 744
     }
745 745
     $output .= '</span>';
746 746
 
747 747
     return $output;
748 748
 }
749 749
 
750
-function wpinv_html_ajax_user_search( $args = array() ) {
750
+function wpinv_html_ajax_user_search($args = array()) {
751 751
     $defaults = array(
752 752
         'name'        => 'user_id',
753 753
         'value'       => null,
754
-        'placeholder' => __( 'Enter username', 'invoicing' ),
754
+        'placeholder' => __('Enter username', 'invoicing'),
755 755
         'label'       => null,
756 756
         'desc'        => null,
757 757
         'class'       => '',
@@ -760,13 +760,13 @@  discard block
 block discarded – undo
760 760
         'data'        => false
761 761
     );
762 762
 
763
-    $args = wp_parse_args( $args, $defaults );
763
+    $args = wp_parse_args($args, $defaults);
764 764
 
765 765
     $args['class'] = 'wpinv-ajax-user-search ' . $args['class'];
766 766
 
767 767
     $output  = '<span class="wpinv_user_search_wrap">';
768
-        $output .= wpinv_html_text( $args );
769
-        $output .= '<span class="wpinv_user_search_results hidden"><a class="wpinv-ajax-user-cancel" title="' . __( 'Cancel', 'invoicing' ) . '" aria-label="' . __( 'Cancel', 'invoicing' ) . '" href="#">x</a><span></span></span>';
768
+        $output .= wpinv_html_text($args);
769
+        $output .= '<span class="wpinv_user_search_results hidden"><a class="wpinv-ajax-user-cancel" title="' . __('Cancel', 'invoicing') . '" aria-label="' . __('Cancel', 'invoicing') . '" href="#">x</a><span></span></span>';
770 770
     $output .= '</span>';
771 771
 
772 772
     return $output;
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 function wpinv_ip_geolocation() {
776 776
     global $wpinv_euvat;
777 777
     
778
-    $ip         = !empty( $_GET['ip'] ) ? sanitize_text_field( $_GET['ip'] ) : '';    
778
+    $ip         = !empty($_GET['ip']) ? sanitize_text_field($_GET['ip']) : '';    
779 779
     $content    = '';
780 780
     $iso        = '';
781 781
     $country    = '';
@@ -786,69 +786,69 @@  discard block
 block discarded – undo
786 786
     $credit     = '';
787 787
     $address    = '';
788 788
     
789
-    if ( wpinv_get_option( 'vat_ip_lookup' ) == 'geoip2' && $geoip2_city = $wpinv_euvat->geoip2_city_record( $ip ) ) {
789
+    if (wpinv_get_option('vat_ip_lookup') == 'geoip2' && $geoip2_city = $wpinv_euvat->geoip2_city_record($ip)) {
790 790
         try {
791 791
             $iso        = $geoip2_city->country->isoCode;
792 792
             $country    = $geoip2_city->country->name;
793
-            $region     = !empty( $geoip2_city->subdivisions ) && !empty( $geoip2_city->subdivisions[0]->name ) ? $geoip2_city->subdivisions[0]->name : '';
793
+            $region     = !empty($geoip2_city->subdivisions) && !empty($geoip2_city->subdivisions[0]->name) ? $geoip2_city->subdivisions[0]->name : '';
794 794
             $city       = $geoip2_city->city->name;
795 795
             $longitude  = $geoip2_city->location->longitude;
796 796
             $latitude   = $geoip2_city->location->latitude;
797
-            $credit     = __( 'Geolocated using the information by MaxMind, available from <a href="http://www.maxmind.com" target="_blank">www.maxmind.com</a>', 'invoicing' );
798
-        } catch( Exception $e ) { }
797
+            $credit     = __('Geolocated using the information by MaxMind, available from <a href="http://www.maxmind.com" target="_blank">www.maxmind.com</a>', 'invoicing');
798
+        } catch (Exception $e) { }
799 799
     }
800 800
     
801
-    if ( !( $iso && $longitude && $latitude ) && function_exists( 'simplexml_load_file' ) ) {
801
+    if (!($iso && $longitude && $latitude) && function_exists('simplexml_load_file')) {
802 802
         try {
803
-            $load_xml = simplexml_load_file( 'http://www.geoplugin.net/xml.gp?ip=' . $ip );
803
+            $load_xml = simplexml_load_file('http://www.geoplugin.net/xml.gp?ip=' . $ip);
804 804
             
805
-            if ( !empty( $load_xml ) && isset( $load_xml->geoplugin_countryCode ) && !empty( $load_xml->geoplugin_latitude ) && !empty( $load_xml->geoplugin_longitude ) ) {
805
+            if (!empty($load_xml) && isset($load_xml->geoplugin_countryCode) && !empty($load_xml->geoplugin_latitude) && !empty($load_xml->geoplugin_longitude)) {
806 806
                 $iso        = $load_xml->geoplugin_countryCode;
807 807
                 $country    = $load_xml->geoplugin_countryName;
808
-                $region     = !empty( $load_xml->geoplugin_regionName ) ? $load_xml->geoplugin_regionName : '';
809
-                $city       = !empty( $load_xml->geoplugin_city ) ? $load_xml->geoplugin_city : '';
808
+                $region     = !empty($load_xml->geoplugin_regionName) ? $load_xml->geoplugin_regionName : '';
809
+                $city       = !empty($load_xml->geoplugin_city) ? $load_xml->geoplugin_city : '';
810 810
                 $longitude  = $load_xml->geoplugin_longitude;
811 811
                 $latitude   = $load_xml->geoplugin_latitude;
812 812
                 $credit     = $load_xml->geoplugin_credit;
813
-                $credit     = __( 'Geolocated using the information by geoPlugin, available from <a href="http://www.geoplugin.com" target="_blank">www.geoplugin.com</a>', 'invoicing' ) . '<br>' . $load_xml->geoplugin_credit;
813
+                $credit     = __('Geolocated using the information by geoPlugin, available from <a href="http://www.geoplugin.com" target="_blank">www.geoplugin.com</a>', 'invoicing') . '<br>' . $load_xml->geoplugin_credit;
814 814
             }
815
-        } catch( Exception $e ) { }
815
+        } catch (Exception $e) { }
816 816
     }
817 817
     
818
-    if ( $iso && $longitude && $latitude ) {
819
-        if ( $city ) {
818
+    if ($iso && $longitude && $latitude) {
819
+        if ($city) {
820 820
             $address .= $city . ', ';
821 821
         }
822 822
         
823
-        if ( $region ) {
823
+        if ($region) {
824 824
             $address .= $region . ', ';
825 825
         }
826 826
         
827 827
         $address .= $country . ' (' . $iso . ')';
828
-        $content = '<p>'. sprintf( __( '<b>Address:</b> %s', 'invoicing' ), $address ) . '</p>';
829
-        $content .= '<p>'. $credit . '</p>';
828
+        $content = '<p>' . sprintf(__('<b>Address:</b> %s', 'invoicing'), $address) . '</p>';
829
+        $content .= '<p>' . $credit . '</p>';
830 830
     } else {
831
-        $content = '<p>'. sprintf( __( 'Unable to find geolocation for the IP address: %s', 'invoicing' ), $ip ) . '</p>';
831
+        $content = '<p>' . sprintf(__('Unable to find geolocation for the IP address: %s', 'invoicing'), $ip) . '</p>';
832 832
     }
833 833
     ?>
834 834
 <!DOCTYPE html>
835
-<html><head><title><?php echo sprintf( __( 'IP: %s', 'invoicing' ), $ip );?></title><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-rc.1/leaflet.css" /><style>html,body{height:100%;margin:0;padding:0;width:100%}body{text-align:center;background:#fff;color:#222;font-size:small;}body,p{font-family: arial,sans-serif}#map{margin:auto;width:100%;height:calc(100% - 120px);min-height:240px}</style></head>
835
+<html><head><title><?php echo sprintf(__('IP: %s', 'invoicing'), $ip); ?></title><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-rc.1/leaflet.css" /><style>html,body{height:100%;margin:0;padding:0;width:100%}body{text-align:center;background:#fff;color:#222;font-size:small;}body,p{font-family: arial,sans-serif}#map{margin:auto;width:100%;height:calc(100% - 120px);min-height:240px}</style></head>
836 836
 <body>
837
-    <?php if ( $latitude && $latitude ) { ?>
837
+    <?php if ($latitude && $latitude) { ?>
838 838
     <div id="map"></div>
839 839
         <script src="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-rc.1/leaflet.js"></script>
840 840
         <script type="text/javascript">
841 841
         var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
842 842
             osmAttrib = '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
843 843
             osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}),
844
-            latlng = new L.LatLng(<?php echo $latitude;?>, <?php echo $longitude;?>);
844
+            latlng = new L.LatLng(<?php echo $latitude; ?>, <?php echo $longitude; ?>);
845 845
 
846 846
         var map = new L.Map('map', {center: latlng, zoom: 12, layers: [osm]});
847 847
 
848 848
         var marker = new L.Marker(latlng);
849 849
         map.addLayer(marker);
850 850
 
851
-        marker.bindPopup("<p><?php esc_attr_e( $address );?></p>");
851
+        marker.bindPopup("<p><?php esc_attr_e($address); ?></p>");
852 852
     </script>
853 853
     <?php } ?>
854 854
     <div style="height:100px"><?php echo $content; ?></div>
@@ -856,28 +856,28 @@  discard block
 block discarded – undo
856 856
 <?php
857 857
     exit;
858 858
 }
859
-add_action( 'wp_ajax_wpinv_ip_geolocation', 'wpinv_ip_geolocation' );
860
-add_action( 'wp_ajax_nopriv_wpinv_ip_geolocation', 'wpinv_ip_geolocation' );
859
+add_action('wp_ajax_wpinv_ip_geolocation', 'wpinv_ip_geolocation');
860
+add_action('wp_ajax_nopriv_wpinv_ip_geolocation', 'wpinv_ip_geolocation');
861 861
 
862 862
 /**
863 863
  * Use our template to display invoices.
864 864
  * 
865 865
  * @param string $template the template that is currently being used.
866 866
  */
867
-function wpinv_template( $template ) {
867
+function wpinv_template($template) {
868 868
     global $post;
869 869
 
870
-    if ( ! is_admin() && ( is_single() || is_404() ) && ! empty( $post->ID ) && getpaid_is_invoice_post_type( get_post_type( $post->ID ) ) ) {
870
+    if (!is_admin() && (is_single() || is_404()) && !empty($post->ID) && getpaid_is_invoice_post_type(get_post_type($post->ID))) {
871 871
 
872 872
         // If the user can view this invoice, display it.
873
-        if ( wpinv_user_can_view_invoice( $post->ID ) ) {
873
+        if (wpinv_user_can_view_invoice($post->ID)) {
874 874
 
875
-            return wpinv_get_template_part( 'wpinv-invoice-print', false, false );
875
+            return wpinv_get_template_part('wpinv-invoice-print', false, false);
876 876
 
877 877
         // Else display an error message.
878 878
         } else {
879 879
 
880
-            return wpinv_get_template_part( 'wpinv-invalid-access', false, false );
880
+            return wpinv_get_template_part('wpinv-invalid-access', false, false);
881 881
 
882 882
         }
883 883
 
@@ -885,46 +885,46 @@  discard block
 block discarded – undo
885 885
 
886 886
     return $template;
887 887
 }
888
-add_filter( 'template_include', 'wpinv_template', 10, 1 );
888
+add_filter('template_include', 'wpinv_template', 10, 1);
889 889
 
890 890
 function wpinv_get_business_address() {
891 891
     $business_address   = wpinv_store_address();
892
-    $business_address   = !empty( $business_address ) ? wpautop( wp_kses_post( $business_address ) ) : '';
892
+    $business_address   = !empty($business_address) ? wpautop(wp_kses_post($business_address)) : '';
893 893
     
894 894
     $business_address = $business_address ? '<div class="address">' . $business_address . '</div>' : '';
895 895
     
896
-    return apply_filters( 'wpinv_get_business_address', $business_address );
896
+    return apply_filters('wpinv_get_business_address', $business_address);
897 897
 }
898 898
 
899 899
 /**
900 900
  * Displays the company address.
901 901
  */
902 902
 function wpinv_display_from_address() {
903
-    wpinv_get_template( 'invoice/company-address.php' );
903
+    wpinv_get_template('invoice/company-address.php');
904 904
 }
905
-add_action( 'getpaid_invoice_details_left', 'wpinv_display_from_address', 10 );
905
+add_action('getpaid_invoice_details_left', 'wpinv_display_from_address', 10);
906 906
 
907
-function wpinv_watermark( $id = 0 ) {
908
-    $output = wpinv_get_watermark( $id );
909
-    return apply_filters( 'wpinv_get_watermark', $output, $id );
907
+function wpinv_watermark($id = 0) {
908
+    $output = wpinv_get_watermark($id);
909
+    return apply_filters('wpinv_get_watermark', $output, $id);
910 910
 }
911 911
 
912
-function wpinv_get_watermark( $id ) {
913
-    if ( !$id > 0 ) {
912
+function wpinv_get_watermark($id) {
913
+    if (!$id > 0) {
914 914
         return NULL;
915 915
     }
916 916
 
917
-    $invoice = wpinv_get_invoice( $id );
917
+    $invoice = wpinv_get_invoice($id);
918 918
     
919
-    if ( !empty( $invoice ) && "wpi_invoice" === $invoice->post_type ) {
920
-        if ( $invoice->is_paid() ) {
921
-            return __( 'Paid', 'invoicing' );
919
+    if (!empty($invoice) && "wpi_invoice" === $invoice->post_type) {
920
+        if ($invoice->is_paid()) {
921
+            return __('Paid', 'invoicing');
922 922
         }
923
-        if ( $invoice->is_refunded() ) {
924
-            return __( 'Refunded', 'invoicing' );
923
+        if ($invoice->is_refunded()) {
924
+            return __('Refunded', 'invoicing');
925 925
         }
926
-        if ( $invoice->has_status( array( 'wpi-cancelled' ) ) ) {
927
-            return __( 'Cancelled', 'invoicing' );
926
+        if ($invoice->has_status(array('wpi-cancelled'))) {
927
+            return __('Cancelled', 'invoicing');
928 928
         }
929 929
     }
930 930
     
@@ -934,131 +934,131 @@  discard block
 block discarded – undo
934 934
 /**
935 935
  * @deprecated
936 936
  */
937
-function wpinv_display_invoice_details( $invoice ) {
938
-    return getpaid_invoice_meta( $invoice );
937
+function wpinv_display_invoice_details($invoice) {
938
+    return getpaid_invoice_meta($invoice);
939 939
 }
940 940
 
941 941
 /**
942 942
  * Displays invoice meta.
943 943
  */
944
-function getpaid_invoice_meta( $invoice ) {
944
+function getpaid_invoice_meta($invoice) {
945 945
 
946
-    $invoice = new WPInv_Invoice( $invoice );
946
+    $invoice = new WPInv_Invoice($invoice);
947 947
 
948 948
     // Ensure that we have an invoice.
949
-    if ( 0 == $invoice->get_id() ) {
949
+    if (0 == $invoice->get_id()) {
950 950
         return;
951 951
     }
952 952
 
953 953
     // Load the invoice meta.
954
-    $meta    = array(
954
+    $meta = array(
955 955
 
956 956
         'number' => array(
957 957
             'label' => sprintf(
958
-                __( '%s Number', 'invoicing' ),
959
-                ucfirst( $invoice->get_type() )
958
+                __('%s Number', 'invoicing'),
959
+                ucfirst($invoice->get_type())
960 960
             ),
961
-            'value' => sanitize_text_field( $invoice->get_number() ),
961
+            'value' => sanitize_text_field($invoice->get_number()),
962 962
         ),
963 963
 
964 964
         'status' => array(
965 965
             'label' => sprintf(
966
-                __( '%s Status', 'invoicing' ),
967
-                ucfirst( $invoice->get_type() )
966
+                __('%s Status', 'invoicing'),
967
+                ucfirst($invoice->get_type())
968 968
             ),
969
-            'value' => sanitize_text_field( $invoice->get_status_nicename() ),
969
+            'value' => sanitize_text_field($invoice->get_status_nicename()),
970 970
         ),
971 971
 
972 972
         'date' => array(
973 973
             'label' => sprintf(
974
-                __( '%s Date', 'invoicing' ),
975
-                ucfirst( $invoice->get_type() )
974
+                __('%s Date', 'invoicing'),
975
+                ucfirst($invoice->get_type())
976 976
             ),
977
-            'value' => getpaid_format_date( $invoice->get_created_date() ),
977
+            'value' => getpaid_format_date($invoice->get_created_date()),
978 978
         ),
979 979
 
980 980
         'date_paid' => array(
981
-            'label' => __( 'Paid On', 'invoicing' ),
982
-            'value' => getpaid_format_date( $invoice->get_completed_date() ),
981
+            'label' => __('Paid On', 'invoicing'),
982
+            'value' => getpaid_format_date($invoice->get_completed_date()),
983 983
         ),
984 984
 
985 985
         'transaction_id' => array(
986
-            'label' => __( 'Transaction ID', 'invoicing' ),
987
-            'value' => sanitize_text_field( $invoice->get_transaction_id() ),
986
+            'label' => __('Transaction ID', 'invoicing'),
987
+            'value' => sanitize_text_field($invoice->get_transaction_id()),
988 988
         ),
989 989
 
990 990
         'due_date'  => array(
991
-            'label' => __( 'Due Date', 'invoicing' ),
992
-            'value' => getpaid_format_date( $invoice->get_due_date() ),
991
+            'label' => __('Due Date', 'invoicing'),
992
+            'value' => getpaid_format_date($invoice->get_due_date()),
993 993
         ),
994 994
 
995 995
         'vat_number' => array(
996 996
             'label' => sprintf(
997
-                __( '%s Number', 'invoicing' ),
997
+                __('%s Number', 'invoicing'),
998 998
                 $GLOBALS['wpinv_euvat']->get_vat_name()
999 999
             ),
1000
-            'value' => sanitize_text_field( $invoice->get_vat_number() ),
1000
+            'value' => sanitize_text_field($invoice->get_vat_number()),
1001 1001
         ),
1002 1002
 
1003 1003
     );
1004 1004
 
1005 1005
     // If it is not paid, remove the date of payment.
1006
-    if ( ! $invoice->is_paid() ) {
1007
-        unset( $meta[ 'date_paid' ] );
1008
-        unset( $meta[ 'transaction_id' ] );
1006
+    if (!$invoice->is_paid()) {
1007
+        unset($meta['date_paid']);
1008
+        unset($meta['transaction_id']);
1009 1009
     }
1010 1010
 
1011 1011
     // Only display the due date if due dates are enabled.
1012
-    if ( ! $invoice->needs_payment() || ! wpinv_get_option( 'overdue_active' ) ) {
1013
-        unset( $meta[ 'due_date' ] );
1012
+    if (!$invoice->needs_payment() || !wpinv_get_option('overdue_active')) {
1013
+        unset($meta['due_date']);
1014 1014
     }
1015 1015
 
1016 1016
     // Only display the vat number if taxes are enabled.
1017
-    if ( ! wpinv_use_taxes() ) {
1018
-        unset( $meta[ 'vat_number' ] );
1017
+    if (!wpinv_use_taxes()) {
1018
+        unset($meta['vat_number']);
1019 1019
     }
1020 1020
 
1021
-    if ( $invoice->is_recurring() ) {
1021
+    if ($invoice->is_recurring()) {
1022 1022
 
1023 1023
         // Link to the parent invoice.
1024
-        if ( $invoice->is_renewal() ) {
1024
+        if ($invoice->is_renewal()) {
1025 1025
 
1026
-            $meta[ 'parent' ] = array(
1026
+            $meta['parent'] = array(
1027 1027
 
1028 1028
                 'label' => sprintf(
1029
-                    __( 'Parent %s', 'invoicing' ),
1030
-                    ucfirst( $invoice->get_type() )
1029
+                    __('Parent %s', 'invoicing'),
1030
+                    ucfirst($invoice->get_type())
1031 1031
                 ),
1032 1032
 
1033
-                'value' => wpinv_invoice_link( $invoice->get_parent_id() ),
1033
+                'value' => wpinv_invoice_link($invoice->get_parent_id()),
1034 1034
 
1035 1035
             );
1036 1036
 
1037 1037
         }
1038 1038
 
1039
-        $subscription = wpinv_get_subscription( $invoice );
1039
+        $subscription = wpinv_get_subscription($invoice);
1040 1040
 
1041
-        if ( ! empty ( $subscription ) ) {
1041
+        if (!empty ($subscription)) {
1042 1042
 
1043 1043
             // Display the renewal date.
1044
-            if ( $subscription->is_active() && 'cancelled' != $subscription->status ) {
1044
+            if ($subscription->is_active() && 'cancelled' != $subscription->status) {
1045 1045
 
1046
-                $meta[ 'renewal_date' ] = array(
1046
+                $meta['renewal_date'] = array(
1047 1047
 
1048
-                    'label' => __( 'Renews On', 'invoicing' ),
1049
-                    'value' => getpaid_format_date( $subscription->expiration ),
1048
+                    'label' => __('Renews On', 'invoicing'),
1049
+                    'value' => getpaid_format_date($subscription->expiration),
1050 1050
         
1051 1051
                 );
1052 1052
 
1053 1053
             }
1054 1054
 
1055
-            if ( $invoice->is_parent() ) {
1055
+            if ($invoice->is_parent()) {
1056 1056
 
1057 1057
                 // Display the recurring amount.
1058
-                $meta[ 'recurring_total' ] = array(
1058
+                $meta['recurring_total'] = array(
1059 1059
 
1060
-                    'label' => __( 'Recurring Amount', 'invoicing' ),
1061
-                    'value' => wpinv_price( wpinv_format_amount( $subscription->recurring_amount ), $invoice->get_currency() ),
1060
+                    'label' => __('Recurring Amount', 'invoicing'),
1061
+                    'value' => wpinv_price(wpinv_format_amount($subscription->recurring_amount), $invoice->get_currency()),
1062 1062
         
1063 1063
                 );
1064 1064
 
@@ -1068,20 +1068,20 @@  discard block
 block discarded – undo
1068 1068
     }
1069 1069
 
1070 1070
     // Add the invoice total to the meta.
1071
-    $meta[ 'invoice_total' ] = array(
1071
+    $meta['invoice_total'] = array(
1072 1072
 
1073
-        'label' => __( 'Total Amount', 'invoicing' ),
1074
-        'value' => wpinv_price( wpinv_format_amount( $invoice->get_total() ), $invoice->get_currency() ),
1073
+        'label' => __('Total Amount', 'invoicing'),
1074
+        'value' => wpinv_price(wpinv_format_amount($invoice->get_total()), $invoice->get_currency()),
1075 1075
 
1076 1076
     );
1077 1077
 
1078 1078
     // Provide a way for third party plugins to filter the meta.
1079
-    $meta = apply_filters( 'getpaid_invoice_meta_data', $meta, $invoice );
1079
+    $meta = apply_filters('getpaid_invoice_meta_data', $meta, $invoice);
1080 1080
 
1081
-    wpinv_get_template( 'invoice/invoice-meta.php', compact( 'invoice', 'meta' ) );
1081
+    wpinv_get_template('invoice/invoice-meta.php', compact('invoice', 'meta'));
1082 1082
 
1083 1083
 }
1084
-add_action( 'getpaid_invoice_details_right', 'getpaid_invoice_meta', 10 );
1084
+add_action('getpaid_invoice_details_right', 'getpaid_invoice_meta', 10);
1085 1085
 
1086 1086
 /**
1087 1087
  * Retrieves the address markup to use on Invoices.
@@ -1093,29 +1093,29 @@  discard block
 block discarded – undo
1093 1093
  * @param  string $separator How to separate address lines.
1094 1094
  * @return string
1095 1095
  */
1096
-function wpinv_get_invoice_address_markup( $billing_details, $separator = '<br/>' ) {
1096
+function wpinv_get_invoice_address_markup($billing_details, $separator = '<br/>') {
1097 1097
 
1098 1098
     // Retrieve the address markup...
1099
-    $country= empty( $billing_details['country'] ) ? '' : $billing_details['country'];
1100
-    $format = wpinv_get_full_address_format( $country );
1099
+    $country = empty($billing_details['country']) ? '' : $billing_details['country'];
1100
+    $format = wpinv_get_full_address_format($country);
1101 1101
 
1102 1102
     // ... and the replacements.
1103
-    $replacements = wpinv_get_invoice_address_replacements( $billing_details );
1103
+    $replacements = wpinv_get_invoice_address_replacements($billing_details);
1104 1104
 
1105
-    $formatted_address = str_ireplace( array_keys( $replacements ), $replacements, $format );
1105
+    $formatted_address = str_ireplace(array_keys($replacements), $replacements, $format);
1106 1106
     
1107 1107
 	// Remove unavailable tags.
1108
-    $formatted_address = preg_replace( "/\{\{\w+\}\}/", '', $formatted_address );
1108
+    $formatted_address = preg_replace("/\{\{\w+\}\}/", '', $formatted_address);
1109 1109
 
1110 1110
     // Clean up white space.
1111
-	$formatted_address = preg_replace( '/  +/', ' ', trim( $formatted_address ) );
1112
-    $formatted_address = preg_replace( '/\n\n+/', "\n", $formatted_address );
1111
+	$formatted_address = preg_replace('/  +/', ' ', trim($formatted_address));
1112
+    $formatted_address = preg_replace('/\n\n+/', "\n", $formatted_address);
1113 1113
     
1114 1114
     // Break newlines apart and remove empty lines/trim commas and white space.
1115
-	$formatted_address = array_filter( array_map( 'wpinv_trim_formatted_address_line', explode( "\n", $formatted_address ) ) );
1115
+	$formatted_address = array_filter(array_map('wpinv_trim_formatted_address_line', explode("\n", $formatted_address)));
1116 1116
 
1117 1117
     // Add html breaks.
1118
-	$formatted_address = implode( $separator, $formatted_address );
1118
+	$formatted_address = implode($separator, $formatted_address);
1119 1119
 
1120 1120
 	// We're done!
1121 1121
 	return $formatted_address;
@@ -1127,61 +1127,61 @@  discard block
 block discarded – undo
1127 1127
  * 
1128 1128
  * @param WPInv_Invoice $invoice
1129 1129
  */
1130
-function wpinv_display_to_address( $invoice = 0 ) {
1131
-    if ( ! empty( $invoice ) ) {
1132
-        wpinv_get_template( 'invoice/billing-address.php', compact( 'invoice' ) );
1130
+function wpinv_display_to_address($invoice = 0) {
1131
+    if (!empty($invoice)) {
1132
+        wpinv_get_template('invoice/billing-address.php', compact('invoice'));
1133 1133
     }
1134 1134
 }
1135
-add_action( 'getpaid_invoice_details_left', 'wpinv_display_to_address', 40 );
1135
+add_action('getpaid_invoice_details_left', 'wpinv_display_to_address', 40);
1136 1136
 
1137 1137
 
1138 1138
 /**
1139 1139
  * Displays invoice line items.
1140 1140
  */
1141
-function wpinv_display_line_items( $invoice_id = 0 ) {
1141
+function wpinv_display_line_items($invoice_id = 0) {
1142 1142
 
1143 1143
     // Prepare the invoice.
1144
-    $invoice = new WPInv_Invoice( $invoice_id );
1144
+    $invoice = new WPInv_Invoice($invoice_id);
1145 1145
 
1146 1146
     // Abort if there is no invoice.
1147
-    if ( 0 == $invoice->get_id() ) {
1147
+    if (0 == $invoice->get_id()) {
1148 1148
         return;
1149 1149
     }
1150 1150
 
1151 1151
     // Line item columns.
1152
-    $columns = getpaid_invoice_item_columns( $invoice );
1153
-    $columns = apply_filters( 'getpaid_invoice_line_items_table_columns', $columns, $invoice );
1152
+    $columns = getpaid_invoice_item_columns($invoice);
1153
+    $columns = apply_filters('getpaid_invoice_line_items_table_columns', $columns, $invoice);
1154 1154
 
1155
-    wpinv_get_template( 'invoice/line-items.php', compact( 'invoice', 'columns' ) );
1155
+    wpinv_get_template('invoice/line-items.php', compact('invoice', 'columns'));
1156 1156
 }
1157
-add_action( 'getpaid_invoice_line_items', 'wpinv_display_line_items', 10 );
1157
+add_action('getpaid_invoice_line_items', 'wpinv_display_line_items', 10);
1158 1158
 
1159 1159
 /**
1160 1160
  * @param WPInv_Invoice $invoice
1161 1161
  */
1162
-function wpinv_display_invoice_notes( $invoice ) {
1162
+function wpinv_display_invoice_notes($invoice) {
1163 1163
 
1164 1164
     // Retrieve the notes.
1165
-    $notes = wpinv_get_invoice_notes( $invoice->get_id(), 'customer' );
1165
+    $notes = wpinv_get_invoice_notes($invoice->get_id(), 'customer');
1166 1166
 
1167 1167
     // Abort if we have non.
1168
-    if ( empty( $notes ) ) {
1168
+    if (empty($notes)) {
1169 1169
         return;
1170 1170
     }
1171 1171
 
1172 1172
     // Echo the note.
1173 1173
     echo '<div class="getpaid-invoice-notes-wrapper border position-relative w-100 mb-4 p-0">';
1174
-    echo '<h3 class="getpaid-invoice-notes-title text-dark bg-light border-bottom m-0 d-block">' . __( 'Notes', 'invoicing' ) .'</h3>';
1174
+    echo '<h3 class="getpaid-invoice-notes-title text-dark bg-light border-bottom m-0 d-block">' . __('Notes', 'invoicing') . '</h3>';
1175 1175
     echo '<ul class="getpaid-invoice-notes mt-4 p-0">';
1176 1176
 
1177
-    foreach( $notes as $note ) {
1178
-        wpinv_get_invoice_note_line_item( $note );
1177
+    foreach ($notes as $note) {
1178
+        wpinv_get_invoice_note_line_item($note);
1179 1179
     }
1180 1180
 
1181 1181
     echo '</ul>';
1182 1182
     echo '</div>';
1183 1183
 }
1184
-add_action( 'getpaid_invoice_line_items', 'wpinv_display_invoice_notes', 60 );
1184
+add_action('getpaid_invoice_line_items', 'wpinv_display_invoice_notes', 60);
1185 1185
 
1186 1186
 /**
1187 1187
  * Loads scripts on our invoice templates.
@@ -1189,32 +1189,32 @@  discard block
 block discarded – undo
1189 1189
 function wpinv_display_style() {
1190 1190
 
1191 1191
     // Make sure that all scripts have been loaded.
1192
-    if ( ! did_action( 'wp_enqueue_scripts' ) ) {
1193
-        do_action( 'wp_enqueue_scripts' );
1192
+    if (!did_action('wp_enqueue_scripts')) {
1193
+        do_action('wp_enqueue_scripts');
1194 1194
     }
1195 1195
 
1196 1196
     // Register the invoices style.
1197
-    wp_register_style( 'wpinv-single-style', WPINV_PLUGIN_URL . 'assets/css/invoice.css', array(), filemtime( WPINV_PLUGIN_DIR . 'assets/css/invoice.css' ) );
1197
+    wp_register_style('wpinv-single-style', WPINV_PLUGIN_URL . 'assets/css/invoice.css', array(), filemtime(WPINV_PLUGIN_DIR . 'assets/css/invoice.css'));
1198 1198
 
1199 1199
     // Load required styles
1200
-    wp_print_styles( 'open-sans' );
1201
-    wp_print_styles( 'wpinv-single-style' );
1202
-    wp_print_styles( 'ayecode-ui' );
1200
+    wp_print_styles('open-sans');
1201
+    wp_print_styles('wpinv-single-style');
1202
+    wp_print_styles('ayecode-ui');
1203 1203
 
1204 1204
     // Maybe load custom css.
1205
-    $custom_css = wpinv_get_option( 'template_custom_css' );
1205
+    $custom_css = wpinv_get_option('template_custom_css');
1206 1206
 
1207
-    if ( isset( $custom_css ) && ! empty( $custom_css ) ) {
1208
-        $custom_css     = wp_kses( $custom_css, array( '\'', '\"' ) );
1209
-        $custom_css     = str_replace( '&gt;', '>', $custom_css );
1207
+    if (isset($custom_css) && !empty($custom_css)) {
1208
+        $custom_css     = wp_kses($custom_css, array('\'', '\"'));
1209
+        $custom_css     = str_replace('&gt;', '>', $custom_css);
1210 1210
         echo '<style type="text/css">';
1211 1211
         echo $custom_css;
1212 1212
         echo '</style>';
1213 1213
     }
1214 1214
 
1215 1215
 }
1216
-add_action( 'wpinv_invoice_print_head', 'wpinv_display_style' );
1217
-add_action( 'wpinv_invalid_invoice_head', 'wpinv_display_style' );
1216
+add_action('wpinv_invoice_print_head', 'wpinv_display_style');
1217
+add_action('wpinv_invalid_invoice_head', 'wpinv_display_style');
1218 1218
 
1219 1219
 
1220 1220
 /**
@@ -1226,41 +1226,41 @@  discard block
 block discarded – undo
1226 1226
     // Retrieve the current invoice.
1227 1227
     $invoice_id = getpaid_get_current_invoice_id();
1228 1228
 
1229
-    if ( empty( $invoice_id ) ) {
1229
+    if (empty($invoice_id)) {
1230 1230
 
1231 1231
         return aui()->alert(
1232 1232
             array(
1233 1233
                 'type'    => 'warning',
1234
-                'content' => __( 'Invalid invoice', 'invoicing' ),
1234
+                'content' => __('Invalid invoice', 'invoicing'),
1235 1235
             )
1236 1236
         );
1237 1237
 
1238 1238
     }
1239 1239
 
1240 1240
     // Can the user view this invoice?
1241
-    if ( ! wpinv_user_can_view_invoice( $invoice_id ) ) {
1241
+    if (!wpinv_user_can_view_invoice($invoice_id)) {
1242 1242
 
1243 1243
         return aui()->alert(
1244 1244
             array(
1245 1245
                 'type'    => 'warning',
1246
-                'content' => __( 'You are not allowed to view this invoice', 'invoicing' ),
1246
+                'content' => __('You are not allowed to view this invoice', 'invoicing'),
1247 1247
             )
1248 1248
         );
1249 1249
 
1250 1250
     }
1251 1251
 
1252 1252
     // Ensure that it is not yet paid for.
1253
-    $invoice = new WPInv_Invoice( $invoice_id );
1253
+    $invoice = new WPInv_Invoice($invoice_id);
1254 1254
 
1255 1255
     // Maybe mark it as viewed.
1256
-    getpaid_maybe_mark_invoice_as_viewed( $invoice );
1256
+    getpaid_maybe_mark_invoice_as_viewed($invoice);
1257 1257
 
1258
-    if ( $invoice->is_paid() ) {
1258
+    if ($invoice->is_paid()) {
1259 1259
 
1260 1260
         return aui()->alert(
1261 1261
             array(
1262 1262
                 'type'    => 'success',
1263
-                'content' => __( 'This invoice has already been paid.', 'invoicing' ),
1263
+                'content' => __('This invoice has already been paid.', 'invoicing'),
1264 1264
             )
1265 1265
         );
1266 1266
 
@@ -1270,14 +1270,14 @@  discard block
 block discarded – undo
1270 1270
     $wpi_checkout_id = $invoice_id;
1271 1271
 
1272 1272
     // We'll display this invoice via the default form.
1273
-    $form = new GetPaid_Payment_Form( wpinv_get_default_payment_form() );
1273
+    $form = new GetPaid_Payment_Form(wpinv_get_default_payment_form());
1274 1274
 
1275
-    if ( 0 == $form->get_id() ) {
1275
+    if (0 == $form->get_id()) {
1276 1276
 
1277 1277
         return aui()->alert(
1278 1278
             array(
1279 1279
                 'type'    => 'warning',
1280
-                'content' => __( 'Error loading the payment form', 'invoicing' ),
1280
+                'content' => __('Error loading the payment form', 'invoicing'),
1281 1281
             )
1282 1282
         );
1283 1283
 
@@ -1285,37 +1285,37 @@  discard block
 block discarded – undo
1285 1285
 
1286 1286
     // Set the invoice.
1287 1287
     $form->invoice = $invoice;
1288
-    $form->set_items( $invoice->get_items() );
1288
+    $form->set_items($invoice->get_items());
1289 1289
 
1290 1290
     // Generate the html.
1291 1291
     return $form->get_html();
1292 1292
 
1293 1293
 }
1294 1294
 
1295
-function wpinv_checkout_cart( $cart_details = array(), $echo = true ) {
1295
+function wpinv_checkout_cart($cart_details = array(), $echo = true) {
1296 1296
     global $ajax_cart_details;
1297 1297
     $ajax_cart_details = $cart_details;
1298 1298
 
1299 1299
     ob_start();
1300
-    do_action( 'wpinv_before_checkout_cart' );
1300
+    do_action('wpinv_before_checkout_cart');
1301 1301
     echo '<div id="wpinv_checkout_cart_form" method="post">';
1302 1302
         echo '<div id="wpinv_checkout_cart_wrap">';
1303
-            wpinv_get_template_part( 'wpinv-checkout-cart' );
1303
+            wpinv_get_template_part('wpinv-checkout-cart');
1304 1304
         echo '</div>';
1305 1305
     echo '</div>';
1306
-    do_action( 'wpinv_after_checkout_cart' );
1306
+    do_action('wpinv_after_checkout_cart');
1307 1307
     $content = ob_get_clean();
1308 1308
 
1309
-    if ( $echo ) {
1309
+    if ($echo) {
1310 1310
         echo $content;
1311 1311
     } else {
1312 1312
         return $content;
1313 1313
     }
1314 1314
 }
1315
-add_action( 'wpinv_checkout_cart', 'wpinv_checkout_cart', 10 );
1315
+add_action('wpinv_checkout_cart', 'wpinv_checkout_cart', 10);
1316 1316
 
1317 1317
 function wpinv_empty_cart_message() {
1318
-	return apply_filters( 'wpinv_empty_cart_message', '<span class="wpinv_empty_cart">' . __( 'Your cart is empty.', 'invoicing' ) . '</span>' );
1318
+	return apply_filters('wpinv_empty_cart_message', '<span class="wpinv_empty_cart">' . __('Your cart is empty.', 'invoicing') . '</span>');
1319 1319
 }
1320 1320
 
1321 1321
 /**
@@ -1332,51 +1332,51 @@  discard block
 block discarded – undo
1332 1332
         )
1333 1333
     );
1334 1334
 }
1335
-add_action( 'wpinv_cart_empty', 'wpinv_empty_checkout_cart' );
1335
+add_action('wpinv_cart_empty', 'wpinv_empty_checkout_cart');
1336 1336
 
1337 1337
 function wpinv_checkout_cart_columns() {
1338 1338
     $default = 3;
1339
-    if ( wpinv_item_quantities_enabled() ) {
1339
+    if (wpinv_item_quantities_enabled()) {
1340 1340
         $default++;
1341 1341
     }
1342 1342
 
1343
-    if ( wpinv_use_taxes() ) {
1343
+    if (wpinv_use_taxes()) {
1344 1344
         $default++;
1345 1345
     }
1346 1346
 
1347
-    return apply_filters( 'wpinv_checkout_cart_columns', $default );
1347
+    return apply_filters('wpinv_checkout_cart_columns', $default);
1348 1348
 }
1349 1349
 
1350
-function wpinv_receipt_billing_address( $invoice_id = 0 ) {
1351
-    $invoice = wpinv_get_invoice( $invoice_id );
1350
+function wpinv_receipt_billing_address($invoice_id = 0) {
1351
+    $invoice = wpinv_get_invoice($invoice_id);
1352 1352
 
1353
-    if ( empty( $invoice ) ) {
1353
+    if (empty($invoice)) {
1354 1354
         return NULL;
1355 1355
     }
1356 1356
 
1357 1357
     $billing_details = $invoice->get_user_info();
1358
-    $address_row = wpinv_get_invoice_address_markup( $billing_details );
1358
+    $address_row = wpinv_get_invoice_address_markup($billing_details);
1359 1359
 
1360 1360
     ob_start();
1361 1361
     ?>
1362 1362
     <table class="table table-bordered table-sm wpi-billing-details">
1363 1363
         <tbody>
1364 1364
             <tr class="wpi-receipt-name">
1365
-                <th class="text-left"><?php _e( 'Name', 'invoicing' ); ?></th>
1366
-                <td><?php echo esc_html( trim( $billing_details['first_name'] . ' ' . $billing_details['last_name'] ) ) ;?></td>
1365
+                <th class="text-left"><?php _e('Name', 'invoicing'); ?></th>
1366
+                <td><?php echo esc_html(trim($billing_details['first_name'] . ' ' . $billing_details['last_name'])); ?></td>
1367 1367
             </tr>
1368 1368
             <tr class="wpi-receipt-email">
1369
-                <th class="text-left"><?php _e( 'Email', 'invoicing' ); ?></th>
1370
-                <td><?php echo $billing_details['email'] ;?></td>
1369
+                <th class="text-left"><?php _e('Email', 'invoicing'); ?></th>
1370
+                <td><?php echo $billing_details['email']; ?></td>
1371 1371
             </tr>
1372 1372
             <tr class="wpi-receipt-address">
1373
-                <th class="text-left"><?php _e( 'Address', 'invoicing' ); ?></th>
1374
-                <td><?php echo $address_row ;?></td>
1373
+                <th class="text-left"><?php _e('Address', 'invoicing'); ?></th>
1374
+                <td><?php echo $address_row; ?></td>
1375 1375
             </tr>
1376
-            <?php if ( $billing_details['phone'] ) { ?>
1376
+            <?php if ($billing_details['phone']) { ?>
1377 1377
             <tr class="wpi-receipt-phone">
1378
-                <th class="text-left"><?php _e( 'Phone', 'invoicing' ); ?></th>
1379
-                <td><?php echo esc_html( $billing_details['phone'] ) ;?></td>
1378
+                <th class="text-left"><?php _e('Phone', 'invoicing'); ?></th>
1379
+                <td><?php echo esc_html($billing_details['phone']); ?></td>
1380 1380
             </tr>
1381 1381
             <?php } ?>
1382 1382
         </tbody>
@@ -1384,7 +1384,7 @@  discard block
 block discarded – undo
1384 1384
     <?php
1385 1385
     $output = ob_get_clean();
1386 1386
     
1387
-    $output = apply_filters( 'wpinv_receipt_billing_address', $output, $invoice_id );
1387
+    $output = apply_filters('wpinv_receipt_billing_address', $output, $invoice_id);
1388 1388
 
1389 1389
     echo $output;
1390 1390
 }
@@ -1392,56 +1392,56 @@  discard block
 block discarded – undo
1392 1392
 /**
1393 1393
  * Filters the receipt page.
1394 1394
  */
1395
-function wpinv_filter_success_page_content( $content ) {
1395
+function wpinv_filter_success_page_content($content) {
1396 1396
 
1397 1397
     // Ensure this is our page.
1398
-    if ( isset( $_GET['payment-confirm'] ) && wpinv_is_success_page() ) {
1398
+    if (isset($_GET['payment-confirm']) && wpinv_is_success_page()) {
1399 1399
 
1400
-        $gateway = sanitize_text_field( $_GET['payment-confirm'] );
1401
-        return apply_filters( "wpinv_payment_confirm_$gateway", $content );
1400
+        $gateway = sanitize_text_field($_GET['payment-confirm']);
1401
+        return apply_filters("wpinv_payment_confirm_$gateway", $content);
1402 1402
 
1403 1403
     }
1404 1404
 
1405 1405
     return $content;
1406 1406
 }
1407
-add_filter( 'the_content', 'wpinv_filter_success_page_content', 99999 );
1407
+add_filter('the_content', 'wpinv_filter_success_page_content', 99999);
1408 1408
 
1409
-function wpinv_invoice_link( $invoice_id ) {
1410
-    $invoice = wpinv_get_invoice( $invoice_id );
1409
+function wpinv_invoice_link($invoice_id) {
1410
+    $invoice = wpinv_get_invoice($invoice_id);
1411 1411
 
1412
-    if ( empty( $invoice ) ) {
1412
+    if (empty($invoice)) {
1413 1413
         return NULL;
1414 1414
     }
1415 1415
 
1416
-    $invoice_link = '<a href="' . esc_url( $invoice->get_view_url() ) . '">' . $invoice->get_number() . '</a>';
1416
+    $invoice_link = '<a href="' . esc_url($invoice->get_view_url()) . '">' . $invoice->get_number() . '</a>';
1417 1417
 
1418
-    return apply_filters( 'wpinv_get_invoice_link', $invoice_link, $invoice );
1418
+    return apply_filters('wpinv_get_invoice_link', $invoice_link, $invoice);
1419 1419
 }
1420 1420
 
1421
-function wpinv_invoice_subscription_details( $invoice ) {
1422
-    if ( !empty( $invoice ) && $invoice->is_recurring() && ! wpinv_is_subscription_payment( $invoice ) ) {
1423
-        $subscription = wpinv_get_subscription( $invoice, true );
1421
+function wpinv_invoice_subscription_details($invoice) {
1422
+    if (!empty($invoice) && $invoice->is_recurring() && !wpinv_is_subscription_payment($invoice)) {
1423
+        $subscription = wpinv_get_subscription($invoice, true);
1424 1424
 
1425
-        if ( empty( $subscription ) ) {
1425
+        if (empty($subscription)) {
1426 1426
             return;
1427 1427
         }
1428 1428
 
1429 1429
         $frequency = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency($subscription->period, $subscription->frequency);
1430
-        $billing = wpinv_price(wpinv_format_amount($subscription->recurring_amount), $invoice->get_currency() ) . ' / ' . $frequency;
1431
-        $initial = wpinv_price(wpinv_format_amount($subscription->initial_amount), $invoice->get_currency() );
1430
+        $billing = wpinv_price(wpinv_format_amount($subscription->recurring_amount), $invoice->get_currency()) . ' / ' . $frequency;
1431
+        $initial = wpinv_price(wpinv_format_amount($subscription->initial_amount), $invoice->get_currency());
1432 1432
 
1433 1433
         $payments = $subscription->get_child_payments();
1434 1434
         ?>
1435 1435
         <div class="wpinv-subscriptions-details">
1436
-            <h3 class="wpinv-subscriptions-t"><?php echo apply_filters( 'wpinv_subscription_details_title', __( 'Subscription Details', 'invoicing' ) ); ?></h3>
1436
+            <h3 class="wpinv-subscriptions-t"><?php echo apply_filters('wpinv_subscription_details_title', __('Subscription Details', 'invoicing')); ?></h3>
1437 1437
             <table class="table">
1438 1438
                 <thead>
1439 1439
                     <tr>
1440
-                        <th><?php _e( 'Billing Cycle', 'invoicing' ) ;?></th>
1441
-                        <th><?php _e( 'Start Date', 'invoicing' ) ;?></th>
1442
-                        <th><?php _e( 'Expiration Date', 'invoicing' ) ;?></th>
1443
-                        <th class="text-center"><?php _e( 'Times Billed', 'invoicing' ) ;?></th>
1444
-                        <th class="text-center"><?php _e( 'Status', 'invoicing' ) ;?></th>
1440
+                        <th><?php _e('Billing Cycle', 'invoicing'); ?></th>
1441
+                        <th><?php _e('Start Date', 'invoicing'); ?></th>
1442
+                        <th><?php _e('Expiration Date', 'invoicing'); ?></th>
1443
+                        <th class="text-center"><?php _e('Times Billed', 'invoicing'); ?></th>
1444
+                        <th class="text-center"><?php _e('Status', 'invoicing'); ?></th>
1445 1445
                     </tr>
1446 1446
                 </thead>
1447 1447
                 <tbody>
@@ -1455,29 +1455,29 @@  discard block
 block discarded – undo
1455 1455
                 </tbody>
1456 1456
             </table>
1457 1457
         </div>
1458
-        <?php if ( !empty( $payments ) ) { ?>
1458
+        <?php if (!empty($payments)) { ?>
1459 1459
         <div class="wpinv-renewal-payments">
1460
-            <h3 class="wpinv-renewals-t"><?php echo apply_filters( 'wpinv_renewal_payments_title', __( 'Renewal Payments', 'invoicing' ) ); ?></h3>
1460
+            <h3 class="wpinv-renewals-t"><?php echo apply_filters('wpinv_renewal_payments_title', __('Renewal Payments', 'invoicing')); ?></h3>
1461 1461
             <table class="table">
1462 1462
                 <thead>
1463 1463
                     <tr>
1464 1464
                         <th>#</th>
1465
-                        <th><?php _e( 'Invoice', 'invoicing' ) ;?></th>
1466
-                        <th><?php _e( 'Date', 'invoicing' ) ;?></th>
1467
-                        <th class="text-right"><?php _e( 'Amount', 'invoicing' ) ;?></th>
1465
+                        <th><?php _e('Invoice', 'invoicing'); ?></th>
1466
+                        <th><?php _e('Date', 'invoicing'); ?></th>
1467
+                        <th class="text-right"><?php _e('Amount', 'invoicing'); ?></th>
1468 1468
                     </tr>
1469 1469
                 </thead>
1470 1470
                 <tbody>
1471 1471
                     <?php
1472 1472
                         $i = 1;
1473
-                        foreach ( $payments as $payment ) {
1473
+                        foreach ($payments as $payment) {
1474 1474
                             $invoice_id = $payment->ID;
1475 1475
                     ?>
1476 1476
                     <tr>
1477
-                        <th scope="row"><?php echo $i;?></th>
1478
-                        <td><?php echo wpinv_invoice_link( $invoice_id ) ;?></td>
1477
+                        <th scope="row"><?php echo $i; ?></th>
1478
+                        <td><?php echo wpinv_invoice_link($invoice_id); ?></td>
1479 1479
                         <td><?php echo$invoice->get_date_created(); ?></td>
1480
-                        <td class="text-right"><?php echo wpinv_price( wpinv_format_amount( $invoice->get_total() ), $invoice->get_currency() ); ?></td>
1480
+                        <td class="text-right"><?php echo wpinv_price(wpinv_format_amount($invoice->get_total()), $invoice->get_currency()); ?></td>
1481 1481
                     </tr>
1482 1482
                     <?php $i++; } ?>
1483 1483
                 </tbody>
@@ -1487,64 +1487,64 @@  discard block
 block discarded – undo
1487 1487
         <?php
1488 1488
     }
1489 1489
 }
1490
-add_action( 'getpaid_invoice_line_items', 'wpinv_invoice_subscription_details', 20 );
1490
+add_action('getpaid_invoice_line_items', 'wpinv_invoice_subscription_details', 20);
1491 1491
 
1492
-function wpinv_cart_total_label( $label, $invoice ) {
1493
-    if ( empty( $invoice ) ) {
1492
+function wpinv_cart_total_label($label, $invoice) {
1493
+    if (empty($invoice)) {
1494 1494
         return $label;
1495 1495
     }
1496 1496
 
1497 1497
     $prefix_label = '';
1498
-    if ( $invoice->is_parent() && $item_id = $invoice->get_recurring() ) {
1499
-        $prefix_label   = '<span class="label label-primary label-recurring">' . __( 'Recurring Payment', 'invoicing' ) . '</span> ' . wpinv_subscription_payment_desc( $invoice );
1500
-    } else if ( $invoice->is_renewal() ) {
1501
-        $prefix_label   = '<span class="label label-primary label-renewal">' . __( 'Renewal Payment', 'invoicing' ) . '</span> ';        
1498
+    if ($invoice->is_parent() && $item_id = $invoice->get_recurring()) {
1499
+        $prefix_label   = '<span class="label label-primary label-recurring">' . __('Recurring Payment', 'invoicing') . '</span> ' . wpinv_subscription_payment_desc($invoice);
1500
+    } else if ($invoice->is_renewal()) {
1501
+        $prefix_label   = '<span class="label label-primary label-renewal">' . __('Renewal Payment', 'invoicing') . '</span> ';        
1502 1502
     }
1503 1503
 
1504
-    if ( $prefix_label != '' ) {
1505
-        $label  = '<span class="wpinv-cart-sub-desc">' . $prefix_label . '</span> ' . $label;
1504
+    if ($prefix_label != '') {
1505
+        $label = '<span class="wpinv-cart-sub-desc">' . $prefix_label . '</span> ' . $label;
1506 1506
     }
1507 1507
 
1508 1508
     return $label;
1509 1509
 }
1510
-add_filter( 'wpinv_cart_total_label', 'wpinv_cart_total_label', 10, 2 );
1511
-add_filter( 'wpinv_email_cart_total_label', 'wpinv_cart_total_label', 10, 2 );
1512
-add_filter( 'wpinv_print_cart_total_label', 'wpinv_cart_total_label', 10, 2 );
1510
+add_filter('wpinv_cart_total_label', 'wpinv_cart_total_label', 10, 2);
1511
+add_filter('wpinv_email_cart_total_label', 'wpinv_cart_total_label', 10, 2);
1512
+add_filter('wpinv_print_cart_total_label', 'wpinv_cart_total_label', 10, 2);
1513 1513
 
1514
-function wpinv_get_invoice_note_line_item( $note, $echo = true ) {
1515
-    if ( empty( $note ) ) {
1514
+function wpinv_get_invoice_note_line_item($note, $echo = true) {
1515
+    if (empty($note)) {
1516 1516
         return NULL;
1517 1517
     }
1518 1518
 
1519
-    if ( is_int( $note ) ) {
1520
-        $note = get_comment( $note );
1519
+    if (is_int($note)) {
1520
+        $note = get_comment($note);
1521 1521
     }
1522 1522
 
1523
-    if ( !( is_object( $note ) && is_a( $note, 'WP_Comment' ) ) ) {
1523
+    if (!(is_object($note) && is_a($note, 'WP_Comment'))) {
1524 1524
         return NULL;
1525 1525
     }
1526 1526
 
1527
-    $note_classes   = array( 'note' );
1528
-    $note_classes[] = get_comment_meta( $note->comment_ID, '_wpi_customer_note', true ) ? 'customer-note' : '';
1527
+    $note_classes   = array('note');
1528
+    $note_classes[] = get_comment_meta($note->comment_ID, '_wpi_customer_note', true) ? 'customer-note' : '';
1529 1529
     $note_classes[] = $note->comment_author === 'System' ? 'system-note' : '';
1530
-    $note_classes   = apply_filters( 'wpinv_invoice_note_class', array_filter( $note_classes ), $note );
1531
-    $note_classes   = !empty( $note_classes ) ? implode( ' ', $note_classes ) : '';
1530
+    $note_classes   = apply_filters('wpinv_invoice_note_class', array_filter($note_classes), $note);
1531
+    $note_classes   = !empty($note_classes) ? implode(' ', $note_classes) : '';
1532 1532
 
1533 1533
     ob_start();
1534 1534
     ?>
1535
-    <li rel="<?php echo absint( $note->comment_ID ) ; ?>" class="<?php echo esc_attr( $note_classes ); ?> mt-4 pl-3 pr-3">
1535
+    <li rel="<?php echo absint($note->comment_ID); ?>" class="<?php echo esc_attr($note_classes); ?> mt-4 pl-3 pr-3">
1536 1536
         <div class="note_content bg-light border position-relative p-4">
1537 1537
 
1538
-            <?php echo wpautop( wptexturize( wp_kses_post( $note->comment_content ) ) ); ?>
1538
+            <?php echo wpautop(wptexturize(wp_kses_post($note->comment_content))); ?>
1539 1539
 
1540
-            <?php if ( ! is_admin() ) : ?>
1540
+            <?php if (!is_admin()) : ?>
1541 1541
                 <em class="meta position-absolute form-text">
1542 1542
                     <?php
1543 1543
                         printf(
1544
-                            __( '%1$s - %2$s at %3$s', 'invoicing' ),
1544
+                            __('%1$s - %2$s at %3$s', 'invoicing'),
1545 1545
                             $note->comment_author,
1546
-                            date_i18n( get_option( 'date_format' ), strtotime( $note->comment_date ) ),
1547
-                            date_i18n( get_option( 'time_format' ), strtotime( $note->comment_date ) )
1546
+                            date_i18n(get_option('date_format'), strtotime($note->comment_date)),
1547
+                            date_i18n(get_option('time_format'), strtotime($note->comment_date))
1548 1548
                         );
1549 1549
                     ?>
1550 1550
                 </em>
@@ -1552,12 +1552,12 @@  discard block
 block discarded – undo
1552 1552
 
1553 1553
         </div>
1554 1554
 
1555
-        <?php if ( is_admin() ) : ?>
1555
+        <?php if (is_admin()) : ?>
1556 1556
 
1557 1557
             <p class="meta px-4 py-2">
1558
-                <abbr class="exact-date" title="<?php echo esc_attr( $note->comment_date ); ?>"><?php printf( __( '%1$s - %2$s at %3$s', 'invoicing' ), $note->comment_author, date_i18n( get_option( 'date_format' ), strtotime( $note->comment_date ) ), date_i18n( get_option( 'time_format' ), strtotime( $note->comment_date ) ) ); ?></abbr>&nbsp;&nbsp;
1559
-                <?php if ( $note->comment_author !== 'System' && wpinv_current_user_can_manage_invoicing() ) { ?>
1560
-                    <a href="#" class="delete_note"><?php _e( 'Delete note', 'invoicing' ); ?></a>
1558
+                <abbr class="exact-date" title="<?php echo esc_attr($note->comment_date); ?>"><?php printf(__('%1$s - %2$s at %3$s', 'invoicing'), $note->comment_author, date_i18n(get_option('date_format'), strtotime($note->comment_date)), date_i18n(get_option('time_format'), strtotime($note->comment_date))); ?></abbr>&nbsp;&nbsp;
1559
+                <?php if ($note->comment_author !== 'System' && wpinv_current_user_can_manage_invoicing()) { ?>
1560
+                    <a href="#" class="delete_note"><?php _e('Delete note', 'invoicing'); ?></a>
1561 1561
                 <?php } ?>
1562 1562
             </p>
1563 1563
 
@@ -1566,9 +1566,9 @@  discard block
 block discarded – undo
1566 1566
     </li>
1567 1567
     <?php
1568 1568
     $note_content = ob_get_clean();
1569
-    $note_content = apply_filters( 'wpinv_get_invoice_note_line_item', $note_content, $note, $echo );
1569
+    $note_content = apply_filters('wpinv_get_invoice_note_line_item', $note_content, $note, $echo);
1570 1570
 
1571
-    if ( $echo ) {
1571
+    if ($echo) {
1572 1572
         echo $note_content;
1573 1573
     } else {
1574 1574
         return $note_content;
@@ -1578,36 +1578,36 @@  discard block
 block discarded – undo
1578 1578
 function wpinv_invalid_invoice_content() {
1579 1579
     global $post;
1580 1580
 
1581
-    $invoice = wpinv_get_invoice( $post->ID );
1581
+    $invoice = wpinv_get_invoice($post->ID);
1582 1582
 
1583
-    $error = __( 'This invoice is only viewable by clicking on the invoice link that was sent to you via email.', 'invoicing' );
1584
-    if ( !empty( $invoice->get_id() ) && $invoice->has_status( array_keys( wpinv_get_invoice_statuses() ) ) ) {
1585
-        if ( is_user_logged_in() ) {
1586
-            if ( wpinv_require_login_to_checkout() ) {
1587
-                if ( isset( $_GET['invoice_key'] ) && $_GET['invoice_key'] === $invoice->get_key() ) {
1588
-                    $error = __( 'You are not allowed to view this invoice.', 'invoicing' );
1583
+    $error = __('This invoice is only viewable by clicking on the invoice link that was sent to you via email.', 'invoicing');
1584
+    if (!empty($invoice->get_id()) && $invoice->has_status(array_keys(wpinv_get_invoice_statuses()))) {
1585
+        if (is_user_logged_in()) {
1586
+            if (wpinv_require_login_to_checkout()) {
1587
+                if (isset($_GET['invoice_key']) && $_GET['invoice_key'] === $invoice->get_key()) {
1588
+                    $error = __('You are not allowed to view this invoice.', 'invoicing');
1589 1589
                 }
1590 1590
             }
1591 1591
         } else {
1592
-            if ( wpinv_require_login_to_checkout() ) {
1593
-                if ( isset( $_GET['invoice_key'] ) && $_GET['invoice_key'] === $invoice->get_key() ) {
1594
-                    $error = __( 'You must be logged in to view this invoice.', 'invoicing' );
1592
+            if (wpinv_require_login_to_checkout()) {
1593
+                if (isset($_GET['invoice_key']) && $_GET['invoice_key'] === $invoice->get_key()) {
1594
+                    $error = __('You must be logged in to view this invoice.', 'invoicing');
1595 1595
                 }
1596 1596
             }
1597 1597
         }
1598 1598
     } else {
1599
-        $error = __( 'This invoice is deleted or does not exist.', 'invoicing' );
1599
+        $error = __('This invoice is deleted or does not exist.', 'invoicing');
1600 1600
     }
1601 1601
     ?>
1602 1602
     <div class="row wpinv-row-invalid">
1603 1603
         <div class="col-md-6 col-md-offset-3 wpinv-message error">
1604
-            <h3><?php _e( 'Access Denied', 'invoicing' ); ?></h3>
1604
+            <h3><?php _e('Access Denied', 'invoicing'); ?></h3>
1605 1605
             <p class="wpinv-msg-text"><?php echo $error; ?></p>
1606 1606
         </div>
1607 1607
     </div>
1608 1608
     <?php
1609 1609
 }
1610
-add_action( 'wpinv_invalid_invoice_content', 'wpinv_invalid_invoice_content' );
1610
+add_action('wpinv_invalid_invoice_content', 'wpinv_invalid_invoice_content');
1611 1611
 
1612 1612
 /**
1613 1613
  * Function to get privacy policy text.
@@ -1616,21 +1616,21 @@  discard block
 block discarded – undo
1616 1616
  * @return string
1617 1617
  */
1618 1618
 function wpinv_get_policy_text() {
1619
-    $privacy_page_id = get_option( 'wp_page_for_privacy_policy', 0 );
1619
+    $privacy_page_id = get_option('wp_page_for_privacy_policy', 0);
1620 1620
 
1621
-    $text = wpinv_get_option('invoicing_privacy_checkout_message', sprintf( __( 'Your personal data will be used to process your invoice, payment and for other purposes described in our %s.', 'invoicing' ), '[wpinv_privacy_policy]' ));
1621
+    $text = wpinv_get_option('invoicing_privacy_checkout_message', sprintf(__('Your personal data will be used to process your invoice, payment and for other purposes described in our %s.', 'invoicing'), '[wpinv_privacy_policy]'));
1622 1622
 
1623
-    if(!$privacy_page_id){
1624
-        $privacy_page_id = wpinv_get_option( 'privacy_page', 0 );
1623
+    if (!$privacy_page_id) {
1624
+        $privacy_page_id = wpinv_get_option('privacy_page', 0);
1625 1625
     }
1626 1626
 
1627
-    $privacy_link    = $privacy_page_id ? '<a href="' . esc_url( get_permalink( $privacy_page_id ) ) . '" class="wpinv-privacy-policy-link" target="_blank">' . __( 'privacy policy', 'invoicing' ) . '</a>' : __( 'privacy policy', 'invoicing' );
1627
+    $privacy_link = $privacy_page_id ? '<a href="' . esc_url(get_permalink($privacy_page_id)) . '" class="wpinv-privacy-policy-link" target="_blank">' . __('privacy policy', 'invoicing') . '</a>' : __('privacy policy', 'invoicing');
1628 1628
 
1629 1629
     $find_replace = array(
1630 1630
         '[wpinv_privacy_policy]' => $privacy_link,
1631 1631
     );
1632 1632
 
1633
-    $privacy_text = str_replace( array_keys( $find_replace ), array_values( $find_replace ), $text );
1633
+    $privacy_text = str_replace(array_keys($find_replace), array_values($find_replace), $text);
1634 1634
 
1635 1635
     return wp_kses_post(wpautop($privacy_text));
1636 1636
 }
@@ -1639,25 +1639,25 @@  discard block
 block discarded – undo
1639 1639
 /**
1640 1640
  * Allows the user to set their own price for an invoice item
1641 1641
  */
1642
-function wpinv_checkout_cart_item_name_your_price( $cart_item, $key ) {
1642
+function wpinv_checkout_cart_item_name_your_price($cart_item, $key) {
1643 1643
     
1644 1644
     //Ensure we have an item id
1645
-    if(! is_array( $cart_item ) || empty( $cart_item['id'] ) ) {
1645
+    if (!is_array($cart_item) || empty($cart_item['id'])) {
1646 1646
         return;
1647 1647
     }
1648 1648
 
1649 1649
     //Fetch the item
1650 1650
     $item_id = $cart_item['id'];
1651
-    $item    = new WPInv_Item( $item_id );
1651
+    $item    = new WPInv_Item($item_id);
1652 1652
     
1653
-    if(! $item->supports_dynamic_pricing() || !$item->get_is_dynamic_pricing() ) {
1653
+    if (!$item->supports_dynamic_pricing() || !$item->get_is_dynamic_pricing()) {
1654 1654
         return;
1655 1655
     }
1656 1656
 
1657 1657
     //Fetch the dynamic pricing "strings"
1658
-    $suggested_price_text = esc_html( wpinv_get_option( 'suggested_price_text', __( 'Suggested Price:', 'invoicing' ) ) );
1659
-    $minimum_price_text   = esc_html( wpinv_get_option( 'minimum_price_text', __( 'Minimum Price:', 'invoicing' ) ) );
1660
-    $name_your_price_text = esc_html( wpinv_get_option( 'name_your_price_text', __( 'Name Your Price', 'invoicing' ) ) );
1658
+    $suggested_price_text = esc_html(wpinv_get_option('suggested_price_text', __('Suggested Price:', 'invoicing')));
1659
+    $minimum_price_text   = esc_html(wpinv_get_option('minimum_price_text', __('Minimum Price:', 'invoicing')));
1660
+    $name_your_price_text = esc_html(wpinv_get_option('name_your_price_text', __('Name Your Price', 'invoicing')));
1661 1661
 
1662 1662
     //Display a "name_your_price" button
1663 1663
     echo " &mdash; <a href='#' class='wpinv-name-your-price-frontend small'>$name_your_price_text</a></div>";
@@ -1666,7 +1666,7 @@  discard block
 block discarded – undo
1666 1666
     echo '<div class="name-your-price-miniform">';
1667 1667
     
1668 1668
     //Maybe display the recommended price
1669
-    if( $item->get_price() > 0 && !empty( $suggested_price_text ) ) {
1669
+    if ($item->get_price() > 0 && !empty($suggested_price_text)) {
1670 1670
         $suggested_price = $item->get_the_price();
1671 1671
         echo "<div>$suggested_price_text &mdash; $suggested_price</div>";
1672 1672
     }
@@ -1674,52 +1674,52 @@  discard block
 block discarded – undo
1674 1674
     //Display the update price form
1675 1675
     $symbol         = wpinv_currency_symbol();
1676 1676
     $position       = wpinv_currency_position();
1677
-    $minimum        = esc_attr( $item->get_minimum_price() );
1678
-    $price          = esc_attr( $cart_item['item_price'] );
1679
-    $update         = esc_attr__( "Update", 'invoicing' );
1677
+    $minimum        = esc_attr($item->get_minimum_price());
1678
+    $price          = esc_attr($cart_item['item_price']);
1679
+    $update         = esc_attr__("Update", 'invoicing');
1680 1680
 
1681 1681
     //Ensure it supports dynamic prici
1682
-    if( $price < $minimum ) {
1682
+    if ($price < $minimum) {
1683 1683
         $price = $minimum;
1684 1684
     }
1685 1685
 
1686 1686
     echo '<label>';
1687 1687
     echo $position != 'right' ? $symbol . '&nbsp;' : '';
1688 1688
     echo "<input type='number' min='$minimum' placeholder='$price' value='$price' class='wpi-field-price' />";
1689
-    echo $position == 'right' ? '&nbsp;' . $symbol : '' ;
1689
+    echo $position == 'right' ? '&nbsp;' . $symbol : '';
1690 1690
     echo "</label>";
1691 1691
     echo "<input type='hidden' value='$item_id' class='wpi-field-item' />";
1692 1692
     echo "<a class='btn btn-success wpinv-submit wpinv-update-dynamic-price-frontend'>$update</a>";
1693 1693
 
1694 1694
     //Maybe display the minimum price
1695
-    if( $item->get_minimum_price() > 0 && !empty( $minimum_price_text ) ) {
1696
-        $minimum_price = wpinv_price( wpinv_format_amount( $item->get_minimum_price() ) );
1695
+    if ($item->get_minimum_price() > 0 && !empty($minimum_price_text)) {
1696
+        $minimum_price = wpinv_price(wpinv_format_amount($item->get_minimum_price()));
1697 1697
         echo "<div>$minimum_price_text &mdash; $minimum_price</div>";
1698 1698
     }
1699 1699
 
1700 1700
     echo "</div>";
1701 1701
 
1702 1702
 }
1703
-add_action( 'wpinv_checkout_cart_item_price_after', 'wpinv_checkout_cart_item_name_your_price', 10, 2 );
1703
+add_action('wpinv_checkout_cart_item_price_after', 'wpinv_checkout_cart_item_name_your_price', 10, 2);
1704 1704
 
1705 1705
 function wpinv_oxygen_fix_conflict() {
1706 1706
     global $ct_ignore_post_types;
1707 1707
 
1708
-    if ( ! is_array( $ct_ignore_post_types ) ) {
1708
+    if (!is_array($ct_ignore_post_types)) {
1709 1709
         $ct_ignore_post_types = array();
1710 1710
     }
1711 1711
 
1712
-    $post_types = array( 'wpi_discount', 'wpi_invoice', 'wpi_item' );
1712
+    $post_types = array('wpi_discount', 'wpi_invoice', 'wpi_item');
1713 1713
 
1714
-    foreach ( $post_types as $post_type ) {
1714
+    foreach ($post_types as $post_type) {
1715 1715
         $ct_ignore_post_types[] = $post_type;
1716 1716
 
1717 1717
         // Ignore post type
1718
-        add_filter( 'pre_option_oxygen_vsb_ignore_post_type_' . $post_type, '__return_true', 999 );
1718
+        add_filter('pre_option_oxygen_vsb_ignore_post_type_' . $post_type, '__return_true', 999);
1719 1719
     }
1720 1720
 
1721
-    remove_filter( 'template_include', 'wpinv_template', 10, 1 );
1722
-    add_filter( 'template_include', 'wpinv_template', 999, 1 );
1721
+    remove_filter('template_include', 'wpinv_template', 10, 1);
1722
+    add_filter('template_include', 'wpinv_template', 999, 1);
1723 1723
 }
1724 1724
 
1725 1725
 /**
@@ -1727,10 +1727,10 @@  discard block
 block discarded – undo
1727 1727
  * 
1728 1728
  * @param GetPaid_Payment_Form $form
1729 1729
  */
1730
-function getpaid_display_payment_form( $form ) {
1730
+function getpaid_display_payment_form($form) {
1731 1731
 
1732
-    if ( is_numeric( $form ) ) {
1733
-        $form = new GetPaid_Payment_Form( $form );
1732
+    if (is_numeric($form)) {
1733
+        $form = new GetPaid_Payment_Form($form);
1734 1734
     }
1735 1735
 
1736 1736
     $form->display();
@@ -1740,124 +1740,124 @@  discard block
 block discarded – undo
1740 1740
 /**
1741 1741
  * Helper function to display a item payment form on the frontend.
1742 1742
  */
1743
-function getpaid_display_item_payment_form( $items ) {
1743
+function getpaid_display_item_payment_form($items) {
1744 1744
     global $invoicing;
1745 1745
 
1746
-    foreach ( array_keys( $items ) as $id ) {
1747
-	    if ( 'publish' != get_post_status( $id ) ) {
1748
-		    unset( $items[ $id ] );
1746
+    foreach (array_keys($items) as $id) {
1747
+	    if ('publish' != get_post_status($id)) {
1748
+		    unset($items[$id]);
1749 1749
 	    }
1750 1750
     }
1751 1751
 
1752
-    if ( empty( $items ) ) {
1752
+    if (empty($items)) {
1753 1753
 		return aui()->alert(
1754 1754
 			array(
1755 1755
 				'type'    => 'warning',
1756
-				'content' => __( 'No published items found', 'invoicing' ),
1756
+				'content' => __('No published items found', 'invoicing'),
1757 1757
 			)
1758 1758
 		);
1759 1759
     }
1760 1760
 
1761
-    $item_key = getpaid_convert_items_to_string( $items );
1761
+    $item_key = getpaid_convert_items_to_string($items);
1762 1762
 
1763 1763
     // Get the form elements and items.
1764 1764
     $form     = wpinv_get_default_payment_form();
1765
-	$elements = $invoicing->form_elements->get_form_elements( $form );
1766
-	$items    = $invoicing->form_elements->convert_normal_items( $items );
1765
+	$elements = $invoicing->form_elements->get_form_elements($form);
1766
+	$items    = $invoicing->form_elements->convert_normal_items($items);
1767 1767
 
1768 1768
 	ob_start();
1769 1769
 	echo "<form class='wpinv_payment_form'>";
1770
-	do_action( 'wpinv_payment_form_top' );
1770
+	do_action('wpinv_payment_form_top');
1771 1771
     echo "<input type='hidden' name='form_id' value='$form'/>";
1772 1772
     echo "<input type='hidden' name='form_items' value='$item_key'/>";
1773
-	wp_nonce_field( 'wpinv_payment_form', 'wpinv_payment_form' );
1774
-	wp_nonce_field( 'vat_validation', '_wpi_nonce' );
1773
+	wp_nonce_field('wpinv_payment_form', 'wpinv_payment_form');
1774
+	wp_nonce_field('vat_validation', '_wpi_nonce');
1775 1775
 
1776
-	foreach ( $elements as $element ) {
1777
-		do_action( 'wpinv_frontend_render_payment_form_element', $element, $items, $form );
1778
-		do_action( "wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $form );
1776
+	foreach ($elements as $element) {
1777
+		do_action('wpinv_frontend_render_payment_form_element', $element, $items, $form);
1778
+		do_action("wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $form);
1779 1779
 	}
1780 1780
 
1781 1781
 	echo "<div class='wpinv_payment_form_errors alert alert-danger d-none'></div>";
1782
-	do_action( 'wpinv_payment_form_bottom' );
1782
+	do_action('wpinv_payment_form_bottom');
1783 1783
 	echo '</form>';
1784 1784
 
1785 1785
 	$content = ob_get_clean();
1786
-	return str_replace( 'sr-only', '', $content );
1786
+	return str_replace('sr-only', '', $content);
1787 1787
 }
1788 1788
 
1789 1789
 /**
1790 1790
  * Helper function to display an invoice payment form on the frontend.
1791 1791
  */
1792
-function getpaid_display_invoice_payment_form( $invoice_id ) {
1792
+function getpaid_display_invoice_payment_form($invoice_id) {
1793 1793
     global $invoicing;
1794 1794
 
1795
-    $invoice = wpinv_get_invoice( $invoice_id );
1795
+    $invoice = wpinv_get_invoice($invoice_id);
1796 1796
 
1797
-    if ( empty( $invoice ) ) {
1797
+    if (empty($invoice)) {
1798 1798
 		return aui()->alert(
1799 1799
 			array(
1800 1800
 				'type'    => 'warning',
1801
-				'content' => __( 'Invoice not found', 'invoicing' ),
1801
+				'content' => __('Invoice not found', 'invoicing'),
1802 1802
 			)
1803 1803
 		);
1804 1804
     }
1805 1805
 
1806
-    if ( $invoice->is_paid() ) {
1806
+    if ($invoice->is_paid()) {
1807 1807
 		return aui()->alert(
1808 1808
 			array(
1809 1809
 				'type'    => 'warning',
1810
-				'content' => __( 'Invoice has already been paid', 'invoicing' ),
1810
+				'content' => __('Invoice has already been paid', 'invoicing'),
1811 1811
 			)
1812 1812
 		);
1813 1813
     }
1814 1814
 
1815 1815
     // Get the form elements and items.
1816
-    $form     = wpinv_get_default_payment_form();
1817
-	$elements = $invoicing->form_elements->get_form_elements( $form );
1818
-	$items    = $invoicing->form_elements->convert_checkout_items( $invoice->cart_details, $invoice );
1816
+    $form = wpinv_get_default_payment_form();
1817
+	$elements = $invoicing->form_elements->get_form_elements($form);
1818
+	$items    = $invoicing->form_elements->convert_checkout_items($invoice->cart_details, $invoice);
1819 1819
 
1820 1820
 	ob_start();
1821 1821
 	echo "<form class='wpinv_payment_form'>";
1822
-	do_action( 'wpinv_payment_form_top' );
1822
+	do_action('wpinv_payment_form_top');
1823 1823
     echo "<input type='hidden' name='form_id' value='$form'/>";
1824 1824
     echo "<input type='hidden' name='invoice_id' value='$invoice_id'/>";
1825
-	wp_nonce_field( 'wpinv_payment_form', 'wpinv_payment_form' );
1826
-	wp_nonce_field( 'vat_validation', '_wpi_nonce' );
1825
+	wp_nonce_field('wpinv_payment_form', 'wpinv_payment_form');
1826
+	wp_nonce_field('vat_validation', '_wpi_nonce');
1827 1827
 
1828
-	foreach ( $elements as $element ) {
1829
-		do_action( 'wpinv_frontend_render_payment_form_element', $element, $items, $form );
1830
-		do_action( "wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $form );
1828
+	foreach ($elements as $element) {
1829
+		do_action('wpinv_frontend_render_payment_form_element', $element, $items, $form);
1830
+		do_action("wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $form);
1831 1831
 	}
1832 1832
 
1833 1833
 	echo "<div class='wpinv_payment_form_errors alert alert-danger d-none'></div>";
1834
-	do_action( 'wpinv_payment_form_bottom' );
1834
+	do_action('wpinv_payment_form_bottom');
1835 1835
 	echo '</form>';
1836 1836
 
1837 1837
 	$content = ob_get_clean();
1838
-	return str_replace( 'sr-only', '', $content );
1838
+	return str_replace('sr-only', '', $content);
1839 1839
 }
1840 1840
 
1841 1841
 /**
1842 1842
  * Helper function to convert item string to array.
1843 1843
  */
1844
-function getpaid_convert_items_to_array( $items ) {
1845
-    $items    = array_filter( array_map( 'trim', explode( ',', $items ) ) );
1844
+function getpaid_convert_items_to_array($items) {
1845
+    $items    = array_filter(array_map('trim', explode(',', $items)));
1846 1846
     $prepared = array();
1847 1847
 
1848
-    foreach ( $items as $item ) {
1849
-        $data = array_map( 'trim', explode( '|', $item ) );
1848
+    foreach ($items as $item) {
1849
+        $data = array_map('trim', explode('|', $item));
1850 1850
 
1851
-        if ( empty( $data[0] ) || ! is_numeric( $data[0] ) ) {
1851
+        if (empty($data[0]) || !is_numeric($data[0])) {
1852 1852
             continue;
1853 1853
         }
1854 1854
 
1855 1855
         $quantity = 1;
1856
-        if ( isset( $data[1] ) && is_numeric( $data[1] ) ) {
1856
+        if (isset($data[1]) && is_numeric($data[1])) {
1857 1857
             $quantity = $data[1];
1858 1858
         }
1859 1859
 
1860
-        $prepared[ $data[0] ] = $quantity;
1860
+        $prepared[$data[0]] = $quantity;
1861 1861
 
1862 1862
     }
1863 1863
 
@@ -1867,13 +1867,13 @@  discard block
 block discarded – undo
1867 1867
 /**
1868 1868
  * Helper function to convert item array to string.
1869 1869
  */
1870
-function getpaid_convert_items_to_string( $items ) {
1870
+function getpaid_convert_items_to_string($items) {
1871 1871
     $prepared = array();
1872 1872
 
1873
-    foreach ( $items as $item => $quantity ) {
1873
+    foreach ($items as $item => $quantity) {
1874 1874
         $prepared[] = "$item|$quantity";
1875 1875
     }
1876
-    return implode( ',', $prepared );
1876
+    return implode(',', $prepared);
1877 1877
 }
1878 1878
 
1879 1879
 /**
@@ -1881,22 +1881,22 @@  discard block
 block discarded – undo
1881 1881
  * 
1882 1882
  * Provide a label and one of $form, $items or $invoice.
1883 1883
  */
1884
-function getpaid_get_payment_button( $label, $form = null, $items = null, $invoice = null ) {
1885
-    $label = sanitize_text_field( $label );
1884
+function getpaid_get_payment_button($label, $form = null, $items = null, $invoice = null) {
1885
+    $label = sanitize_text_field($label);
1886 1886
     $nonce = wp_create_nonce('getpaid_ajax_form');
1887 1887
 
1888
-    if ( ! empty( $form ) ) {
1889
-        $form  = esc_attr( $form );
1888
+    if (!empty($form)) {
1889
+        $form = esc_attr($form);
1890 1890
         return "<button class='btn btn-primary getpaid-payment-button' type='button' data-nonce='$nonce' data-form='$form'>$label</button>"; 
1891 1891
     }
1892 1892
 	
1893
-	if ( ! empty( $items ) ) {
1894
-        $items  = esc_attr( $items );
1893
+	if (!empty($items)) {
1894
+        $items = esc_attr($items);
1895 1895
         return "<button class='btn btn-primary getpaid-payment-button' type='button' data-nonce='$nonce' data-item='$items'>$label</button>"; 
1896 1896
     }
1897 1897
     
1898
-    if ( ! empty( $invoice ) ) {
1899
-        $invoice  = esc_attr( $invoice );
1898
+    if (!empty($invoice)) {
1899
+        $invoice = esc_attr($invoice);
1900 1900
         return "<button class='btn btn-primary getpaid-payment-button' type='button' data-nonce='$nonce' data-invoice='$invoice'>$label</button>"; 
1901 1901
     }
1902 1902
 
@@ -1907,17 +1907,17 @@  discard block
 block discarded – undo
1907 1907
  *
1908 1908
  * @param WPInv_Invoice $invoice
1909 1909
  */
1910
-function getpaid_the_invoice_description( $invoice ) {
1910
+function getpaid_the_invoice_description($invoice) {
1911 1911
     $description = $invoice->get_description();
1912 1912
 
1913
-    if ( empty( $description ) ) {
1913
+    if (empty($description)) {
1914 1914
         return;
1915 1915
     }
1916 1916
 
1917
-    $description = wp_kses_post( $description );
1917
+    $description = wp_kses_post($description);
1918 1918
     echo "<small class='getpaid-invoice-description text-dark p-2 form-text'><em>$description</em></small>";
1919 1919
 }
1920
-add_action( 'getpaid_invoice_line_items', 'getpaid_the_invoice_description', 100 );
1920
+add_action('getpaid_invoice_line_items', 'getpaid_the_invoice_description', 100);
1921 1921
 
1922 1922
 /**
1923 1923
  * Render element on a form.
@@ -1925,41 +1925,41 @@  discard block
 block discarded – undo
1925 1925
  * @param array $element
1926 1926
  * @param GetPaid_Payment_Form $form
1927 1927
  */
1928
-function getpaid_payment_form_element( $element, $form ) {
1928
+function getpaid_payment_form_element($element, $form) {
1929 1929
 
1930 1930
     // Set up the args.
1931
-    $element_type    = trim( $element['type'] );
1931
+    $element_type    = trim($element['type']);
1932 1932
     $element['form'] = $form;
1933
-    extract( $element );
1933
+    extract($element);
1934 1934
 
1935 1935
     // Try to locate the appropriate template.
1936
-    $located = wpinv_locate_template( "payment-forms/elements/$element_type.php" );
1936
+    $located = wpinv_locate_template("payment-forms/elements/$element_type.php");
1937 1937
     
1938 1938
     // Abort if this is not our element.
1939
-    if ( empty( $located ) || ! file_exists( $located ) ) {
1939
+    if (empty($located) || !file_exists($located)) {
1940 1940
         return;
1941 1941
     }
1942 1942
 
1943 1943
     // Generate the class and id of the element.
1944
-    $wrapper_class = 'getpaid-payment-form-element-' . trim( esc_attr( $element_type ) );
1945
-    $id            = isset( $id ) ? $id : uniqid( 'gp' );
1944
+    $wrapper_class = 'getpaid-payment-form-element-' . trim(esc_attr($element_type));
1945
+    $id            = isset($id) ? $id : uniqid('gp');
1946 1946
 
1947 1947
     // Echo the opening wrapper.
1948 1948
     echo "<div class='getpaid-payment-form-element $wrapper_class'>";
1949 1949
 
1950 1950
     // Fires before displaying a given element type's content.
1951
-    do_action( "getpaid_before_payment_form_{$element_type}_element", $element, $form );
1951
+    do_action("getpaid_before_payment_form_{$element_type}_element", $element, $form);
1952 1952
 
1953 1953
     // Include the template for the element.
1954 1954
     include $located;
1955 1955
 
1956 1956
     // Fires after displaying a given element type's content.
1957
-    do_action( "getpaid_payment_form_{$element_type}_element", $element, $form );
1957
+    do_action("getpaid_payment_form_{$element_type}_element", $element, $form);
1958 1958
 
1959 1959
     // Echo the closing wrapper.
1960 1960
     echo '</div>';
1961 1961
 }
1962
-add_action( 'getpaid_payment_form_element', 'getpaid_payment_form_element', 10, 2 );
1962
+add_action('getpaid_payment_form_element', 'getpaid_payment_form_element', 10, 2);
1963 1963
 
1964 1964
 /**
1965 1965
  * Shows a list of gateways that support recurring payments.
@@ -1967,16 +1967,16 @@  discard block
 block discarded – undo
1967 1967
 function wpinv_get_recurring_gateways_text() {
1968 1968
     $gateways = array();
1969 1969
 
1970
-    foreach ( wpinv_get_payment_gateways() as $key => $gateway ) {
1971
-        if ( wpinv_gateway_support_subscription( $key ) ) {
1972
-            $gateways[] = sanitize_text_field( $gateway['admin_label'] );
1970
+    foreach (wpinv_get_payment_gateways() as $key => $gateway) {
1971
+        if (wpinv_gateway_support_subscription($key)) {
1972
+            $gateways[] = sanitize_text_field($gateway['admin_label']);
1973 1973
         }
1974 1974
     }
1975 1975
 
1976
-    if ( empty( $gateways ) ) {
1977
-        return "<span class='form-text text-danger'>" . __( 'No active gateways support subscription payments.', 'invoicing' ) ."</span>";
1976
+    if (empty($gateways)) {
1977
+        return "<span class='form-text text-danger'>" . __('No active gateways support subscription payments.', 'invoicing') . "</span>";
1978 1978
     }
1979 1979
 
1980
-    return "<span class='form-text text-muted'>" . wp_sprintf( __( 'Subscription payments only supported by: %s', 'invoicing' ), implode( ', ', $gateways ) ) ."</span>";
1980
+    return "<span class='form-text text-muted'>" . wp_sprintf(__('Subscription payments only supported by: %s', 'invoicing'), implode(', ', $gateways)) . "</span>";
1981 1981
 
1982 1982
 }
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -218,8 +218,9 @@  discard block
 block discarded – undo
218 218
 
219 219
 	// Setup possible parts
220 220
 	$templates = array();
221
-	if ( isset( $name ) )
222
-		$templates[] = $slug . '-' . $name . '.php';
221
+	if ( isset( $name ) ) {
222
+			$templates[] = $slug . '-' . $name . '.php';
223
+	}
223 224
 	$templates[] = $slug . '.php';
224 225
 
225 226
 	// Allow template parts to be filtered
@@ -237,8 +238,9 @@  discard block
 block discarded – undo
237 238
 	foreach ( (array)$template_names as $template_name ) {
238 239
 
239 240
 		// Continue if template is empty
240
-		if ( empty( $template_name ) )
241
-			continue;
241
+		if ( empty( $template_name ) ) {
242
+					continue;
243
+		}
242 244
 
243 245
 		// Trim off any slashes from the template name
244 246
 		$template_name = ltrim( $template_name, '/' );
@@ -257,8 +259,9 @@  discard block
 block discarded – undo
257 259
 		}
258 260
 	}
259 261
 
260
-	if ( ( true == $load ) && ! empty( $located ) )
261
-		load_template( $located, $require_once );
262
+	if ( ( true == $load ) && ! empty( $located ) ) {
263
+			load_template( $located, $require_once );
264
+	}
262 265
 
263 266
 	return $located;
264 267
 }
@@ -336,8 +339,9 @@  discard block
 block discarded – undo
336 339
 function wpinv_html_dropdown( $name = 'wpinv_discounts', $selected = 0, $status = '' ) {
337 340
     $args = array( 'nopaging' => true );
338 341
 
339
-    if ( ! empty( $status ) )
340
-        $args['post_status'] = $status;
342
+    if ( ! empty( $status ) ) {
343
+            $args['post_status'] = $status;
344
+    }
341 345
 
342 346
     $discounts = wpinv_get_discounts( $args );
343 347
     $options   = array();
Please login to merge, or discard this patch.
includes/data/zip-regexes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  * @package Invoicing/data
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 return array(
12 12
     "AD" => "AD\d{3}",
Please login to merge, or discard this patch.
includes/class-wpinv-invoice.php 3 patches
Indentation   +2108 added lines, -2108 removed lines patch added patch discarded remove patch
@@ -14,30 +14,30 @@  discard block
 block discarded – undo
14 14
 class WPInv_Invoice extends GetPaid_Data {
15 15
 
16 16
     /**
17
-	 * Which data store to load.
18
-	 *
19
-	 * @var string
20
-	 */
17
+     * Which data store to load.
18
+     *
19
+     * @var string
20
+     */
21 21
     protected $data_store_name = 'invoice';
22 22
 
23 23
     /**
24
-	 * This is the name of this object type.
25
-	 *
26
-	 * @var string
27
-	 */
24
+     * This is the name of this object type.
25
+     *
26
+     * @var string
27
+     */
28 28
     protected $object_type = 'invoice';
29 29
 
30 30
     /**
31
-	 * Item Data array. This is the core item data exposed in APIs.
32
-	 *
33
-	 * @since 1.0.19
34
-	 * @var array
35
-	 */
36
-	protected $data = array(
37
-		'parent_id'            => 0,
38
-		'status'               => 'wpi-pending',
39
-		'version'              => '',
40
-		'date_created'         => null,
31
+     * Item Data array. This is the core item data exposed in APIs.
32
+     *
33
+     * @since 1.0.19
34
+     * @var array
35
+     */
36
+    protected $data = array(
37
+        'parent_id'            => 0,
38
+        'status'               => 'wpi-pending',
39
+        'version'              => '',
40
+        'date_created'         => null,
41 41
         'date_modified'        => null,
42 42
         'due_date'             => null,
43 43
         'completed_date'       => null,
@@ -79,20 +79,20 @@  discard block
 block discarded – undo
79 79
         'transaction_id'       => '',
80 80
         'currency'             => '',
81 81
         'disable_taxes'        => false,
82
-		'subscription_id'      => null,
83
-		'is_viewed'            => false,
84
-		'email_cc'             => '',
85
-		'template'             => 'quantity', // hours, amount only
82
+        'subscription_id'      => null,
83
+        'is_viewed'            => false,
84
+        'email_cc'             => '',
85
+        'template'             => 'quantity', // hours, amount only
86 86
     );
87 87
 
88 88
     /**
89
-	 * Stores meta in cache for future reads.
90
-	 *
91
-	 * A group must be set to to enable caching.
92
-	 *
93
-	 * @var string
94
-	 */
95
-	protected $cache_group = 'getpaid_invoices';
89
+     * Stores meta in cache for future reads.
90
+     *
91
+     * A group must be set to to enable caching.
92
+     *
93
+     * @var string
94
+     */
95
+    protected $cache_group = 'getpaid_invoices';
96 96
 
97 97
     /**
98 98
      * Stores a reference to the original WP_Post object
@@ -106,104 +106,104 @@  discard block
 block discarded – undo
106 106
      *
107 107
      * @var int
108 108
      */
109
-	protected $recurring_item = null;
109
+    protected $recurring_item = null;
110 110
 
111
-	/**
111
+    /**
112 112
      * Stores an array of item totals.
113
-	 *
114
-	 * e.g $totals['discount'] = array(
115
-	 * 		'initial'   => 10,
116
-	 * 		'recurring' => 10,
117
-	 * )
113
+     *
114
+     * e.g $totals['discount'] = array(
115
+     * 		'initial'   => 10,
116
+     * 		'recurring' => 10,
117
+     * )
118 118
      *
119 119
      * @var array
120 120
      */
121
-	protected $totals = array();
121
+    protected $totals = array();
122 122
 
123
-	/**
124
-	 * Stores the status transition information.
125
-	 *
126
-	 * @since 1.0.19
127
-	 * @var bool
128
-	 */
129
-	protected $status_transition = false;
123
+    /**
124
+     * Stores the status transition information.
125
+     *
126
+     * @since 1.0.19
127
+     * @var bool
128
+     */
129
+    protected $status_transition = false;
130 130
 
131 131
     /**
132
-	 * Get the invoice if ID is passed, otherwise the invoice is new and empty.
133
-	 *
134
-	 * @param  int|string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, transaction id, number or object to read.
135
-	 */
132
+     * Get the invoice if ID is passed, otherwise the invoice is new and empty.
133
+     *
134
+     * @param  int|string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, transaction id, number or object to read.
135
+     */
136 136
     public function __construct( $invoice = false ) {
137 137
 
138 138
         parent::__construct( $invoice );
139 139
 
140
-		if ( ! empty( $invoice ) && is_numeric( $invoice ) && getpaid_is_invoice_post_type( get_post_type( $invoice ) ) ) {
141
-			$this->set_id( $invoice );
142
-		} elseif ( $invoice instanceof self ) {
143
-			$this->set_id( $invoice->get_id() );
144
-		} elseif ( ! empty( $invoice->ID ) ) {
145
-			$this->set_id( $invoice->ID );
146
-		} elseif ( is_array( $invoice ) ) {
147
-			$this->set_props( $invoice );
148
-
149
-			if ( isset( $invoice['ID'] ) ) {
150
-				$this->set_id( $invoice['ID'] );
151
-			}
152
-
153
-		} elseif ( is_scalar( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'key' ) ) {
154
-			$this->set_id( $invoice_id );
155
-		} elseif ( is_scalar( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'number' ) ) {
156
-			$this->set_id( $invoice_id );
157
-		} elseif ( is_scalar( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'transaction_id' ) ) {
158
-			$this->set_id( $invoice_id );
159
-		}else {
160
-			$this->set_object_read( true );
161
-		}
140
+        if ( ! empty( $invoice ) && is_numeric( $invoice ) && getpaid_is_invoice_post_type( get_post_type( $invoice ) ) ) {
141
+            $this->set_id( $invoice );
142
+        } elseif ( $invoice instanceof self ) {
143
+            $this->set_id( $invoice->get_id() );
144
+        } elseif ( ! empty( $invoice->ID ) ) {
145
+            $this->set_id( $invoice->ID );
146
+        } elseif ( is_array( $invoice ) ) {
147
+            $this->set_props( $invoice );
148
+
149
+            if ( isset( $invoice['ID'] ) ) {
150
+                $this->set_id( $invoice['ID'] );
151
+            }
152
+
153
+        } elseif ( is_scalar( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'key' ) ) {
154
+            $this->set_id( $invoice_id );
155
+        } elseif ( is_scalar( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'number' ) ) {
156
+            $this->set_id( $invoice_id );
157
+        } elseif ( is_scalar( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'transaction_id' ) ) {
158
+            $this->set_id( $invoice_id );
159
+        }else {
160
+            $this->set_object_read( true );
161
+        }
162 162
 
163 163
         // Load the datastore.
164
-		$this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
164
+        $this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
165 165
 
166
-		if ( $this->get_id() > 0 ) {
166
+        if ( $this->get_id() > 0 ) {
167 167
             $this->post = get_post( $this->get_id() );
168 168
             $this->ID   = $this->get_id();
169
-			$this->data_store->read( $this );
169
+            $this->data_store->read( $this );
170 170
         }
171 171
 
172 172
     }
173 173
 
174 174
     /**
175
-	 * Given an invoice key/number, it returns its id.
176
-	 *
177
-	 *
178
-	 * @static
179
-	 * @param string $value The invoice key or number
180
-	 * @param string $field Either key, transaction_id or number.
181
-	 * @since 1.0.15
182
-	 * @return int
183
-	 */
184
-	public static function get_invoice_id_by_field( $value, $field = 'key' ) {
175
+     * Given an invoice key/number, it returns its id.
176
+     *
177
+     *
178
+     * @static
179
+     * @param string $value The invoice key or number
180
+     * @param string $field Either key, transaction_id or number.
181
+     * @since 1.0.15
182
+     * @return int
183
+     */
184
+    public static function get_invoice_id_by_field( $value, $field = 'key' ) {
185 185
         global $wpdb;
186 186
 
187
-		// Trim the value.
188
-		$value = trim( $value );
187
+        // Trim the value.
188
+        $value = trim( $value );
189 189
 
190
-		if ( empty( $value ) ) {
191
-			return 0;
192
-		}
190
+        if ( empty( $value ) ) {
191
+            return 0;
192
+        }
193 193
 
194 194
         // Valid fields.
195 195
         $fields = array( 'key', 'number', 'transaction_id' );
196 196
 
197
-		// Ensure a field has been passed.
198
-		if ( empty( $field ) || ! in_array( $field, $fields ) ) {
199
-			return 0;
200
-		}
197
+        // Ensure a field has been passed.
198
+        if ( empty( $field ) || ! in_array( $field, $fields ) ) {
199
+            return 0;
200
+        }
201 201
 
202
-		// Maybe retrieve from the cache.
203
-		$invoice_id   = wp_cache_get( $value, "getpaid_invoice_{$field}s_to_invoice_ids" );
204
-		if ( ! empty( $invoice_id ) ) {
205
-			return $invoice_id;
206
-		}
202
+        // Maybe retrieve from the cache.
203
+        $invoice_id   = wp_cache_get( $value, "getpaid_invoice_{$field}s_to_invoice_ids" );
204
+        if ( ! empty( $invoice_id ) ) {
205
+            return $invoice_id;
206
+        }
207 207
 
208 208
         // Fetch from the db.
209 209
         $table       = $wpdb->prefix . 'getpaid_invoices';
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
             $wpdb->prepare( "SELECT `post_id` FROM $table WHERE `$field`=%s LIMIT 1", $value )
212 212
         );
213 213
 
214
-		if ( empty( $invoice_id ) ) {
215
-			return 0;
216
-		}
214
+        if ( empty( $invoice_id ) ) {
215
+            return 0;
216
+        }
217 217
 
218
-		// Update the cache with our data
219
-		wp_cache_set( $value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids" );
218
+        // Update the cache with our data
219
+        wp_cache_set( $value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids" );
220 220
 
221
-		return $invoice_id;
221
+        return $invoice_id;
222 222
     }
223 223
 
224 224
     /**
@@ -244,73 +244,73 @@  discard block
 block discarded – undo
244 244
     */
245 245
 
246 246
     /**
247
-	 * Get parent invoice ID.
248
-	 *
249
-	 * @since 1.0.19
250
-	 * @param  string $context View or edit context.
251
-	 * @return int
252
-	 */
253
-	public function get_parent_id( $context = 'view' ) {
254
-		return (int) $this->get_prop( 'parent_id', $context );
247
+     * Get parent invoice ID.
248
+     *
249
+     * @since 1.0.19
250
+     * @param  string $context View or edit context.
251
+     * @return int
252
+     */
253
+    public function get_parent_id( $context = 'view' ) {
254
+        return (int) $this->get_prop( 'parent_id', $context );
255 255
     }
256 256
 
257 257
     /**
258
-	 * Get parent invoice.
259
-	 *
260
-	 * @since 1.0.19
261
-	 * @return WPInv_Invoice
262
-	 */
258
+     * Get parent invoice.
259
+     *
260
+     * @since 1.0.19
261
+     * @return WPInv_Invoice
262
+     */
263 263
     public function get_parent_payment() {
264 264
         return new WPInv_Invoice( $this->get_parent_id() );
265 265
     }
266 266
 
267 267
     /**
268
-	 * Alias for self::get_parent_payment().
269
-	 *
270
-	 * @since 1.0.19
271
-	 * @return WPInv_Invoice
272
-	 */
268
+     * Alias for self::get_parent_payment().
269
+     *
270
+     * @since 1.0.19
271
+     * @return WPInv_Invoice
272
+     */
273 273
     public function get_parent() {
274 274
         return $this->get_parent_payment();
275 275
     }
276 276
 
277 277
     /**
278
-	 * Get invoice status.
279
-	 *
280
-	 * @since 1.0.19
281
-	 * @param  string $context View or edit context.
282
-	 * @return string
283
-	 */
284
-	public function get_status( $context = 'view' ) {
285
-		return $this->get_prop( 'status', $context );
286
-	}
278
+     * Get invoice status.
279
+     *
280
+     * @since 1.0.19
281
+     * @param  string $context View or edit context.
282
+     * @return string
283
+     */
284
+    public function get_status( $context = 'view' ) {
285
+        return $this->get_prop( 'status', $context );
286
+    }
287 287
 	
288
-	/**
289
-	 * Retrieves an array of possible invoice statuses.
290
-	 *
291
-	 * @since 1.0.19
292
-	 * @return array
293
-	 */
294
-	public function get_all_statuses() {
288
+    /**
289
+     * Retrieves an array of possible invoice statuses.
290
+     *
291
+     * @since 1.0.19
292
+     * @return array
293
+     */
294
+    public function get_all_statuses() {
295 295
 		
296
-		$statuses = wpinv_get_invoice_statuses( true, true, $this );
296
+        $statuses = wpinv_get_invoice_statuses( true, true, $this );
297 297
 
298
-		// For backwards compatibility.
299
-		if ( $this->is_quote() && class_exists( 'Wpinv_Quotes_Shared' ) ) {
298
+        // For backwards compatibility.
299
+        if ( $this->is_quote() && class_exists( 'Wpinv_Quotes_Shared' ) ) {
300 300
             $statuses = Wpinv_Quotes_Shared::wpinv_get_quote_statuses();
301
-		}
301
+        }
302 302
 
303
-		return $statuses;
303
+        return $statuses;
304 304
     }
305 305
 
306 306
     /**
307
-	 * Get invoice status nice name.
308
-	 *
309
-	 * @since 1.0.19
310
-	 * @return string
311
-	 */
307
+     * Get invoice status nice name.
308
+     *
309
+     * @since 1.0.19
310
+     * @return string
311
+     */
312 312
     public function get_status_nicename() {
313
-		$statuses = $this->get_all_statuses();
313
+        $statuses = $this->get_all_statuses();
314 314
 
315 315
         $status = isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : $this->get_status();
316 316
 
@@ -318,20 +318,20 @@  discard block
 block discarded – undo
318 318
     }
319 319
 
320 320
     /**
321
-	 * Get plugin version when the invoice was created.
322
-	 *
323
-	 * @since 1.0.19
324
-	 * @param  string $context View or edit context.
325
-	 * @return string
326
-	 */
327
-	public function get_version( $context = 'view' ) {
328
-		return $this->get_prop( 'version', $context );
329
-	}
321
+     * Get plugin version when the invoice was created.
322
+     *
323
+     * @since 1.0.19
324
+     * @param  string $context View or edit context.
325
+     * @return string
326
+     */
327
+    public function get_version( $context = 'view' ) {
328
+        return $this->get_prop( 'version', $context );
329
+    }
330 330
 
331
-	/**
332
-	 * @deprecated
333
-	 */
334
-	public function get_invoice_date( $formatted = true ) {
331
+    /**
332
+     * @deprecated
333
+     */
334
+    public function get_invoice_date( $formatted = true ) {
335 335
         $date_completed = $this->get_date_completed();
336 336
         $invoice_date   = $date_completed != '0000-00-00 00:00:00' ? $date_completed : '';
337 337
 
@@ -348,187 +348,187 @@  discard block
 block discarded – undo
348 348
     }
349 349
 
350 350
     /**
351
-	 * Get date when the invoice was created.
352
-	 *
353
-	 * @since 1.0.19
354
-	 * @param  string $context View or edit context.
355
-	 * @return string
356
-	 */
357
-	public function get_date_created( $context = 'view' ) {
358
-		return $this->get_prop( 'date_created', $context );
359
-	}
351
+     * Get date when the invoice was created.
352
+     *
353
+     * @since 1.0.19
354
+     * @param  string $context View or edit context.
355
+     * @return string
356
+     */
357
+    public function get_date_created( $context = 'view' ) {
358
+        return $this->get_prop( 'date_created', $context );
359
+    }
360 360
 	
361
-	/**
362
-	 * Alias for self::get_date_created().
363
-	 *
364
-	 * @since 1.0.19
365
-	 * @param  string $context View or edit context.
366
-	 * @return string
367
-	 */
368
-	public function get_created_date( $context = 'view' ) {
369
-		return $this->get_date_created( $context );
370
-    }
371
-
372
-    /**
373
-	 * Get GMT date when the invoice was created.
374
-	 *
375
-	 * @since 1.0.19
376
-	 * @param  string $context View or edit context.
377
-	 * @return string
378
-	 */
379
-	public function get_date_created_gmt( $context = 'view' ) {
361
+    /**
362
+     * Alias for self::get_date_created().
363
+     *
364
+     * @since 1.0.19
365
+     * @param  string $context View or edit context.
366
+     * @return string
367
+     */
368
+    public function get_created_date( $context = 'view' ) {
369
+        return $this->get_date_created( $context );
370
+    }
371
+
372
+    /**
373
+     * Get GMT date when the invoice was created.
374
+     *
375
+     * @since 1.0.19
376
+     * @param  string $context View or edit context.
377
+     * @return string
378
+     */
379
+    public function get_date_created_gmt( $context = 'view' ) {
380 380
         $date = $this->get_date_created( $context );
381 381
 
382 382
         if ( $date ) {
383 383
             $date = get_gmt_from_date( $date );
384 384
         }
385
-		return $date;
385
+        return $date;
386 386
     }
387 387
 
388 388
     /**
389
-	 * Get date when the invoice was last modified.
390
-	 *
391
-	 * @since 1.0.19
392
-	 * @param  string $context View or edit context.
393
-	 * @return string
394
-	 */
395
-	public function get_date_modified( $context = 'view' ) {
396
-		return $this->get_prop( 'date_modified', $context );
397
-	}
389
+     * Get date when the invoice was last modified.
390
+     *
391
+     * @since 1.0.19
392
+     * @param  string $context View or edit context.
393
+     * @return string
394
+     */
395
+    public function get_date_modified( $context = 'view' ) {
396
+        return $this->get_prop( 'date_modified', $context );
397
+    }
398 398
 
399
-	/**
400
-	 * Alias for self::get_date_modified().
401
-	 *
402
-	 * @since 1.0.19
403
-	 * @param  string $context View or edit context.
404
-	 * @return string
405
-	 */
406
-	public function get_modified_date( $context = 'view' ) {
407
-		return $this->get_date_modified( $context );
399
+    /**
400
+     * Alias for self::get_date_modified().
401
+     *
402
+     * @since 1.0.19
403
+     * @param  string $context View or edit context.
404
+     * @return string
405
+     */
406
+    public function get_modified_date( $context = 'view' ) {
407
+        return $this->get_date_modified( $context );
408 408
     }
409 409
 
410 410
     /**
411
-	 * Get GMT date when the invoice was last modified.
412
-	 *
413
-	 * @since 1.0.19
414
-	 * @param  string $context View or edit context.
415
-	 * @return string
416
-	 */
417
-	public function get_date_modified_gmt( $context = 'view' ) {
411
+     * Get GMT date when the invoice was last modified.
412
+     *
413
+     * @since 1.0.19
414
+     * @param  string $context View or edit context.
415
+     * @return string
416
+     */
417
+    public function get_date_modified_gmt( $context = 'view' ) {
418 418
         $date = $this->get_date_modified( $context );
419 419
 
420 420
         if ( $date ) {
421 421
             $date = get_gmt_from_date( $date );
422 422
         }
423
-		return $date;
423
+        return $date;
424 424
     }
425 425
 
426 426
     /**
427
-	 * Get the invoice due date.
428
-	 *
429
-	 * @since 1.0.19
430
-	 * @param  string $context View or edit context.
431
-	 * @return string
432
-	 */
433
-	public function get_due_date( $context = 'view' ) {
434
-		return $this->get_prop( 'due_date', $context );
427
+     * Get the invoice due date.
428
+     *
429
+     * @since 1.0.19
430
+     * @param  string $context View or edit context.
431
+     * @return string
432
+     */
433
+    public function get_due_date( $context = 'view' ) {
434
+        return $this->get_prop( 'due_date', $context );
435 435
     }
436 436
 
437 437
     /**
438
-	 * Alias for self::get_due_date().
439
-	 *
440
-	 * @since 1.0.19
441
-	 * @param  string $context View or edit context.
442
-	 * @return string
443
-	 */
444
-	public function get_date_due( $context = 'view' ) {
445
-		return $this->get_due_date( $context );
438
+     * Alias for self::get_due_date().
439
+     *
440
+     * @since 1.0.19
441
+     * @param  string $context View or edit context.
442
+     * @return string
443
+     */
444
+    public function get_date_due( $context = 'view' ) {
445
+        return $this->get_due_date( $context );
446 446
     }
447 447
 
448 448
     /**
449
-	 * Get the invoice GMT due date.
450
-	 *
451
-	 * @since 1.0.19
452
-	 * @param  string $context View or edit context.
453
-	 * @return string
454
-	 */
455
-	public function get_due_date_gmt( $context = 'view' ) {
449
+     * Get the invoice GMT due date.
450
+     *
451
+     * @since 1.0.19
452
+     * @param  string $context View or edit context.
453
+     * @return string
454
+     */
455
+    public function get_due_date_gmt( $context = 'view' ) {
456 456
         $date = $this->get_due_date( $context );
457 457
 
458 458
         if ( $date ) {
459 459
             $date = get_gmt_from_date( $date );
460 460
         }
461
-		return $date;
461
+        return $date;
462 462
     }
463 463
 
464 464
     /**
465
-	 * Alias for self::get_due_date_gmt().
466
-	 *
467
-	 * @since 1.0.19
468
-	 * @param  string $context View or edit context.
469
-	 * @return string
470
-	 */
471
-	public function get_gmt_date_due( $context = 'view' ) {
472
-		return $this->get_due_date_gmt( $context );
465
+     * Alias for self::get_due_date_gmt().
466
+     *
467
+     * @since 1.0.19
468
+     * @param  string $context View or edit context.
469
+     * @return string
470
+     */
471
+    public function get_gmt_date_due( $context = 'view' ) {
472
+        return $this->get_due_date_gmt( $context );
473 473
     }
474 474
 
475 475
     /**
476
-	 * Get date when the invoice was completed.
477
-	 *
478
-	 * @since 1.0.19
479
-	 * @param  string $context View or edit context.
480
-	 * @return string
481
-	 */
482
-	public function get_completed_date( $context = 'view' ) {
483
-		return $this->get_prop( 'completed_date', $context );
476
+     * Get date when the invoice was completed.
477
+     *
478
+     * @since 1.0.19
479
+     * @param  string $context View or edit context.
480
+     * @return string
481
+     */
482
+    public function get_completed_date( $context = 'view' ) {
483
+        return $this->get_prop( 'completed_date', $context );
484 484
     }
485 485
 
486 486
     /**
487
-	 * Alias for self::get_completed_date().
488
-	 *
489
-	 * @since 1.0.19
490
-	 * @param  string $context View or edit context.
491
-	 * @return string
492
-	 */
493
-	public function get_date_completed( $context = 'view' ) {
494
-		return $this->get_completed_date( $context );
487
+     * Alias for self::get_completed_date().
488
+     *
489
+     * @since 1.0.19
490
+     * @param  string $context View or edit context.
491
+     * @return string
492
+     */
493
+    public function get_date_completed( $context = 'view' ) {
494
+        return $this->get_completed_date( $context );
495 495
     }
496 496
 
497 497
     /**
498
-	 * Get GMT date when the invoice was was completed.
499
-	 *
500
-	 * @since 1.0.19
501
-	 * @param  string $context View or edit context.
502
-	 * @return string
503
-	 */
504
-	public function get_completed_date_gmt( $context = 'view' ) {
498
+     * Get GMT date when the invoice was was completed.
499
+     *
500
+     * @since 1.0.19
501
+     * @param  string $context View or edit context.
502
+     * @return string
503
+     */
504
+    public function get_completed_date_gmt( $context = 'view' ) {
505 505
         $date = $this->get_completed_date( $context );
506 506
 
507 507
         if ( $date ) {
508 508
             $date = get_gmt_from_date( $date );
509 509
         }
510
-		return $date;
510
+        return $date;
511 511
     }
512 512
 
513 513
     /**
514
-	 * Alias for self::get_completed_date_gmt().
515
-	 *
516
-	 * @since 1.0.19
517
-	 * @param  string $context View or edit context.
518
-	 * @return string
519
-	 */
520
-	public function get_gmt_completed_date( $context = 'view' ) {
521
-		return $this->get_completed_date_gmt( $context );
514
+     * Alias for self::get_completed_date_gmt().
515
+     *
516
+     * @since 1.0.19
517
+     * @param  string $context View or edit context.
518
+     * @return string
519
+     */
520
+    public function get_gmt_completed_date( $context = 'view' ) {
521
+        return $this->get_completed_date_gmt( $context );
522 522
     }
523 523
 
524 524
     /**
525
-	 * Get the invoice number.
526
-	 *
527
-	 * @since 1.0.19
528
-	 * @param  string $context View or edit context.
529
-	 * @return string
530
-	 */
531
-	public function get_number( $context = 'view' ) {
525
+     * Get the invoice number.
526
+     *
527
+     * @since 1.0.19
528
+     * @param  string $context View or edit context.
529
+     * @return string
530
+     */
531
+    public function get_number( $context = 'view' ) {
532 532
         $number = $this->get_prop( 'number', $context );
533 533
 
534 534
         if ( empty( $number ) ) {
@@ -536,17 +536,17 @@  discard block
 block discarded – undo
536 536
             $this->set_number( $number );
537 537
         }
538 538
 
539
-		return $number;
539
+        return $number;
540 540
     }
541 541
 
542 542
     /**
543
-	 * Get the invoice key.
544
-	 *
545
-	 * @since 1.0.19
546
-	 * @param  string $context View or edit context.
547
-	 * @return string
548
-	 */
549
-	public function get_key( $context = 'view' ) {
543
+     * Get the invoice key.
544
+     *
545
+     * @since 1.0.19
546
+     * @param  string $context View or edit context.
547
+     * @return string
548
+     */
549
+    public function get_key( $context = 'view' ) {
550 550
         $key = $this->get_prop( 'key', $context );
551 551
 
552 552
         if ( empty( $key ) ) {
@@ -554,24 +554,24 @@  discard block
 block discarded – undo
554 554
             $this->set_key( $key );
555 555
         }
556 556
 
557
-		return $key;
557
+        return $key;
558 558
     }
559 559
 
560 560
     /**
561
-	 * Get the invoice type.
562
-	 *
563
-	 * @since 1.0.19
564
-	 * @param  string $context View or edit context.
565
-	 * @return string
566
-	 */
567
-	public function get_type( $context = 'view' ) {
561
+     * Get the invoice type.
562
+     *
563
+     * @since 1.0.19
564
+     * @param  string $context View or edit context.
565
+     * @return string
566
+     */
567
+    public function get_type( $context = 'view' ) {
568 568
         return $this->get_prop( 'type', $context );
569
-	}
569
+    }
570 570
 
571
-	/**
572
-	 * @deprecated
573
-	 */
574
-	public function get_invoice_quote_type( $post_id ) {
571
+    /**
572
+     * @deprecated
573
+     */
574
+    public function get_invoice_quote_type( $post_id ) {
575 575
         if ( empty( $post_id ) ) {
576 576
             return '';
577 577
         }
@@ -588,35 +588,35 @@  discard block
 block discarded – undo
588 588
     }
589 589
 
590 590
     /**
591
-	 * Get the invoice post type.
592
-	 *
593
-	 * @since 1.0.19
594
-	 * @param  string $context View or edit context.
595
-	 * @return string
596
-	 */
597
-	public function get_post_type( $context = 'view' ) {
591
+     * Get the invoice post type.
592
+     *
593
+     * @since 1.0.19
594
+     * @param  string $context View or edit context.
595
+     * @return string
596
+     */
597
+    public function get_post_type( $context = 'view' ) {
598 598
         return $this->get_prop( 'post_type', $context );
599 599
     }
600 600
 
601 601
     /**
602
-	 * Get the invoice mode.
603
-	 *
604
-	 * @since 1.0.19
605
-	 * @param  string $context View or edit context.
606
-	 * @return string
607
-	 */
608
-	public function get_mode( $context = 'view' ) {
602
+     * Get the invoice mode.
603
+     *
604
+     * @since 1.0.19
605
+     * @param  string $context View or edit context.
606
+     * @return string
607
+     */
608
+    public function get_mode( $context = 'view' ) {
609 609
         return $this->get_prop( 'mode', $context );
610 610
     }
611 611
 
612 612
     /**
613
-	 * Get the invoice path.
614
-	 *
615
-	 * @since 1.0.19
616
-	 * @param  string $context View or edit context.
617
-	 * @return string
618
-	 */
619
-	public function get_path( $context = 'view' ) {
613
+     * Get the invoice path.
614
+     *
615
+     * @since 1.0.19
616
+     * @param  string $context View or edit context.
617
+     * @return string
618
+     */
619
+    public function get_path( $context = 'view' ) {
620 620
         $path = $this->get_prop( 'path', $context );
621 621
 
622 622
         if ( empty( $path ) ) {
@@ -624,73 +624,73 @@  discard block
 block discarded – undo
624 624
             $path   = sanitize_title( $prefix . $this->get_id() );
625 625
         }
626 626
 
627
-		return $path;
627
+        return $path;
628 628
     }
629 629
 
630 630
     /**
631
-	 * Get the invoice name/title.
632
-	 *
633
-	 * @since 1.0.19
634
-	 * @param  string $context View or edit context.
635
-	 * @return string
636
-	 */
637
-	public function get_name( $context = 'view' ) {
631
+     * Get the invoice name/title.
632
+     *
633
+     * @since 1.0.19
634
+     * @param  string $context View or edit context.
635
+     * @return string
636
+     */
637
+    public function get_name( $context = 'view' ) {
638 638
         $name = $this->get_prop( 'title', $context );
639 639
 
640
-		return empty( $name ) ? $this->get_number( $context ) : $name;
640
+        return empty( $name ) ? $this->get_number( $context ) : $name;
641 641
     }
642 642
 
643 643
     /**
644
-	 * Alias of self::get_name().
645
-	 *
646
-	 * @since 1.0.19
647
-	 * @param  string $context View or edit context.
648
-	 * @return string
649
-	 */
650
-	public function get_title( $context = 'view' ) {
651
-		return $this->get_name( $context );
644
+     * Alias of self::get_name().
645
+     *
646
+     * @since 1.0.19
647
+     * @param  string $context View or edit context.
648
+     * @return string
649
+     */
650
+    public function get_title( $context = 'view' ) {
651
+        return $this->get_name( $context );
652 652
     }
653 653
 
654 654
     /**
655
-	 * Get the invoice description.
656
-	 *
657
-	 * @since 1.0.19
658
-	 * @param  string $context View or edit context.
659
-	 * @return string
660
-	 */
661
-	public function get_description( $context = 'view' ) {
662
-		return $this->get_prop( 'description', $context );
655
+     * Get the invoice description.
656
+     *
657
+     * @since 1.0.19
658
+     * @param  string $context View or edit context.
659
+     * @return string
660
+     */
661
+    public function get_description( $context = 'view' ) {
662
+        return $this->get_prop( 'description', $context );
663 663
     }
664 664
 
665 665
     /**
666
-	 * Alias of self::get_description().
667
-	 *
668
-	 * @since 1.0.19
669
-	 * @param  string $context View or edit context.
670
-	 * @return string
671
-	 */
672
-	public function get_excerpt( $context = 'view' ) {
673
-		return $this->get_description( $context );
666
+     * Alias of self::get_description().
667
+     *
668
+     * @since 1.0.19
669
+     * @param  string $context View or edit context.
670
+     * @return string
671
+     */
672
+    public function get_excerpt( $context = 'view' ) {
673
+        return $this->get_description( $context );
674 674
     }
675 675
 
676 676
     /**
677
-	 * Alias of self::get_description().
678
-	 *
679
-	 * @since 1.0.19
680
-	 * @param  string $context View or edit context.
681
-	 * @return string
682
-	 */
683
-	public function get_summary( $context = 'view' ) {
684
-		return $this->get_description( $context );
677
+     * Alias of self::get_description().
678
+     *
679
+     * @since 1.0.19
680
+     * @param  string $context View or edit context.
681
+     * @return string
682
+     */
683
+    public function get_summary( $context = 'view' ) {
684
+        return $this->get_description( $context );
685 685
     }
686 686
 
687 687
     /**
688
-	 * Returns the user info.
689
-	 *
690
-	 * @since 1.0.19
688
+     * Returns the user info.
689
+     *
690
+     * @since 1.0.19
691 691
      * @param  string $context View or edit context.
692
-	 * @return array
693
-	 */
692
+     * @return array
693
+     */
694 694
     public function get_user_info( $context = 'view' ) {
695 695
 
696 696
         $user_info = array(
@@ -707,605 +707,605 @@  discard block
 block discarded – undo
707 707
             'company'    => $this->get_company( $context ),
708 708
             'vat_number' => $this->get_vat_number( $context ),
709 709
             'discount'   => $this->get_discount_code( $context ),
710
-		);
710
+        );
711 711
 
712
-		return apply_filters( 'wpinv_user_info', $user_info, $this->get_id(), $this );
712
+        return apply_filters( 'wpinv_user_info', $user_info, $this->get_id(), $this );
713 713
 
714 714
     }
715 715
 
716 716
     /**
717
-	 * Get the customer id.
718
-	 *
719
-	 * @since 1.0.19
720
-	 * @param  string $context View or edit context.
721
-	 * @return int
722
-	 */
723
-	public function get_author( $context = 'view' ) {
724
-		return (int) $this->get_prop( 'author', $context );
717
+     * Get the customer id.
718
+     *
719
+     * @since 1.0.19
720
+     * @param  string $context View or edit context.
721
+     * @return int
722
+     */
723
+    public function get_author( $context = 'view' ) {
724
+        return (int) $this->get_prop( 'author', $context );
725 725
     }
726 726
 
727 727
     /**
728
-	 * Alias of self::get_author().
729
-	 *
730
-	 * @since 1.0.19
731
-	 * @param  string $context View or edit context.
732
-	 * @return int
733
-	 */
734
-	public function get_user_id( $context = 'view' ) {
735
-		return $this->get_author( $context );
728
+     * Alias of self::get_author().
729
+     *
730
+     * @since 1.0.19
731
+     * @param  string $context View or edit context.
732
+     * @return int
733
+     */
734
+    public function get_user_id( $context = 'view' ) {
735
+        return $this->get_author( $context );
736 736
     }
737 737
 
738
-     /**
739
-	 * Alias of self::get_author().
740
-	 *
741
-	 * @since 1.0.19
742
-	 * @param  string $context View or edit context.
743
-	 * @return int
744
-	 */
745
-	public function get_customer_id( $context = 'view' ) {
746
-		return $this->get_author( $context );
738
+        /**
739
+         * Alias of self::get_author().
740
+         *
741
+         * @since 1.0.19
742
+         * @param  string $context View or edit context.
743
+         * @return int
744
+         */
745
+    public function get_customer_id( $context = 'view' ) {
746
+        return $this->get_author( $context );
747 747
     }
748 748
 
749 749
     /**
750
-	 * Get the customer's ip.
751
-	 *
752
-	 * @since 1.0.19
753
-	 * @param  string $context View or edit context.
754
-	 * @return string
755
-	 */
756
-	public function get_ip( $context = 'view' ) {
757
-		return $this->get_prop( 'user_ip', $context );
750
+     * Get the customer's ip.
751
+     *
752
+     * @since 1.0.19
753
+     * @param  string $context View or edit context.
754
+     * @return string
755
+     */
756
+    public function get_ip( $context = 'view' ) {
757
+        return $this->get_prop( 'user_ip', $context );
758 758
     }
759 759
 
760 760
     /**
761
-	 * Alias of self::get_ip().
762
-	 *
763
-	 * @since 1.0.19
764
-	 * @param  string $context View or edit context.
765
-	 * @return string
766
-	 */
767
-	public function get_user_ip( $context = 'view' ) {
768
-		return $this->get_ip( $context );
761
+     * Alias of self::get_ip().
762
+     *
763
+     * @since 1.0.19
764
+     * @param  string $context View or edit context.
765
+     * @return string
766
+     */
767
+    public function get_user_ip( $context = 'view' ) {
768
+        return $this->get_ip( $context );
769 769
     }
770 770
 
771
-     /**
772
-	 * Alias of self::get_ip().
773
-	 *
774
-	 * @since 1.0.19
775
-	 * @param  string $context View or edit context.
776
-	 * @return string
777
-	 */
778
-	public function get_customer_ip( $context = 'view' ) {
779
-		return $this->get_ip( $context );
771
+        /**
772
+         * Alias of self::get_ip().
773
+         *
774
+         * @since 1.0.19
775
+         * @param  string $context View or edit context.
776
+         * @return string
777
+         */
778
+    public function get_customer_ip( $context = 'view' ) {
779
+        return $this->get_ip( $context );
780 780
     }
781 781
 
782 782
     /**
783
-	 * Get the customer's first name.
784
-	 *
785
-	 * @since 1.0.19
786
-	 * @param  string $context View or edit context.
787
-	 * @return string
788
-	 */
789
-	public function get_first_name( $context = 'view' ) {
790
-		return $this->get_prop( 'first_name', $context );
783
+     * Get the customer's first name.
784
+     *
785
+     * @since 1.0.19
786
+     * @param  string $context View or edit context.
787
+     * @return string
788
+     */
789
+    public function get_first_name( $context = 'view' ) {
790
+        return $this->get_prop( 'first_name', $context );
791 791
     }
792 792
 
793 793
     /**
794
-	 * Alias of self::get_first_name().
795
-	 *
796
-	 * @since 1.0.19
797
-	 * @param  string $context View or edit context.
798
-	 * @return int
799
-	 */
800
-	public function get_user_first_name( $context = 'view' ) {
801
-		return $this->get_first_name( $context );
794
+     * Alias of self::get_first_name().
795
+     *
796
+     * @since 1.0.19
797
+     * @param  string $context View or edit context.
798
+     * @return int
799
+     */
800
+    public function get_user_first_name( $context = 'view' ) {
801
+        return $this->get_first_name( $context );
802 802
     }
803 803
 
804
-     /**
805
-	 * Alias of self::get_first_name().
806
-	 *
807
-	 * @since 1.0.19
808
-	 * @param  string $context View or edit context.
809
-	 * @return int
810
-	 */
811
-	public function get_customer_first_name( $context = 'view' ) {
812
-		return $this->get_first_name( $context );
804
+        /**
805
+         * Alias of self::get_first_name().
806
+         *
807
+         * @since 1.0.19
808
+         * @param  string $context View or edit context.
809
+         * @return int
810
+         */
811
+    public function get_customer_first_name( $context = 'view' ) {
812
+        return $this->get_first_name( $context );
813 813
     }
814 814
 
815 815
     /**
816
-	 * Get the customer's last name.
817
-	 *
818
-	 * @since 1.0.19
819
-	 * @param  string $context View or edit context.
820
-	 * @return string
821
-	 */
822
-	public function get_last_name( $context = 'view' ) {
823
-		return $this->get_prop( 'last_name', $context );
816
+     * Get the customer's last name.
817
+     *
818
+     * @since 1.0.19
819
+     * @param  string $context View or edit context.
820
+     * @return string
821
+     */
822
+    public function get_last_name( $context = 'view' ) {
823
+        return $this->get_prop( 'last_name', $context );
824 824
     }
825 825
 
826 826
     /**
827
-	 * Alias of self::get_last_name().
828
-	 *
829
-	 * @since 1.0.19
830
-	 * @param  string $context View or edit context.
831
-	 * @return int
832
-	 */
833
-	public function get_user_last_name( $context = 'view' ) {
834
-		return $this->get_last_name( $context );
827
+     * Alias of self::get_last_name().
828
+     *
829
+     * @since 1.0.19
830
+     * @param  string $context View or edit context.
831
+     * @return int
832
+     */
833
+    public function get_user_last_name( $context = 'view' ) {
834
+        return $this->get_last_name( $context );
835 835
     }
836 836
 
837 837
     /**
838
-	 * Alias of self::get_last_name().
839
-	 *
840
-	 * @since 1.0.19
841
-	 * @param  string $context View or edit context.
842
-	 * @return int
843
-	 */
844
-	public function get_customer_last_name( $context = 'view' ) {
845
-		return $this->get_last_name( $context );
838
+     * Alias of self::get_last_name().
839
+     *
840
+     * @since 1.0.19
841
+     * @param  string $context View or edit context.
842
+     * @return int
843
+     */
844
+    public function get_customer_last_name( $context = 'view' ) {
845
+        return $this->get_last_name( $context );
846 846
     }
847 847
 
848 848
     /**
849
-	 * Get the customer's full name.
850
-	 *
851
-	 * @since 1.0.19
852
-	 * @param  string $context View or edit context.
853
-	 * @return string
854
-	 */
855
-	public function get_full_name( $context = 'view' ) {
856
-		return trim( $this->get_first_name( $context ) . ' ' . $this->get_last_name( $context ) );
849
+     * Get the customer's full name.
850
+     *
851
+     * @since 1.0.19
852
+     * @param  string $context View or edit context.
853
+     * @return string
854
+     */
855
+    public function get_full_name( $context = 'view' ) {
856
+        return trim( $this->get_first_name( $context ) . ' ' . $this->get_last_name( $context ) );
857 857
     }
858 858
 
859 859
     /**
860
-	 * Alias of self::get_full_name().
861
-	 *
862
-	 * @since 1.0.19
863
-	 * @param  string $context View or edit context.
864
-	 * @return int
865
-	 */
866
-	public function get_user_full_name( $context = 'view' ) {
867
-		return $this->get_full_name( $context );
860
+     * Alias of self::get_full_name().
861
+     *
862
+     * @since 1.0.19
863
+     * @param  string $context View or edit context.
864
+     * @return int
865
+     */
866
+    public function get_user_full_name( $context = 'view' ) {
867
+        return $this->get_full_name( $context );
868 868
     }
869 869
 
870 870
     /**
871
-	 * Alias of self::get_full_name().
872
-	 *
873
-	 * @since 1.0.19
874
-	 * @param  string $context View or edit context.
875
-	 * @return int
876
-	 */
877
-	public function get_customer_full_name( $context = 'view' ) {
878
-		return $this->get_full_name( $context );
871
+     * Alias of self::get_full_name().
872
+     *
873
+     * @since 1.0.19
874
+     * @param  string $context View or edit context.
875
+     * @return int
876
+     */
877
+    public function get_customer_full_name( $context = 'view' ) {
878
+        return $this->get_full_name( $context );
879 879
     }
880 880
 
881 881
     /**
882
-	 * Get the customer's phone number.
883
-	 *
884
-	 * @since 1.0.19
885
-	 * @param  string $context View or edit context.
886
-	 * @return string
887
-	 */
888
-	public function get_phone( $context = 'view' ) {
889
-		return $this->get_prop( 'phone', $context );
882
+     * Get the customer's phone number.
883
+     *
884
+     * @since 1.0.19
885
+     * @param  string $context View or edit context.
886
+     * @return string
887
+     */
888
+    public function get_phone( $context = 'view' ) {
889
+        return $this->get_prop( 'phone', $context );
890 890
     }
891 891
 
892 892
     /**
893
-	 * Alias of self::get_phone().
894
-	 *
895
-	 * @since 1.0.19
896
-	 * @param  string $context View or edit context.
897
-	 * @return int
898
-	 */
899
-	public function get_phone_number( $context = 'view' ) {
900
-		return $this->get_phone( $context );
893
+     * Alias of self::get_phone().
894
+     *
895
+     * @since 1.0.19
896
+     * @param  string $context View or edit context.
897
+     * @return int
898
+     */
899
+    public function get_phone_number( $context = 'view' ) {
900
+        return $this->get_phone( $context );
901 901
     }
902 902
 
903 903
     /**
904
-	 * Alias of self::get_phone().
905
-	 *
906
-	 * @since 1.0.19
907
-	 * @param  string $context View or edit context.
908
-	 * @return int
909
-	 */
910
-	public function get_user_phone( $context = 'view' ) {
911
-		return $this->get_phone( $context );
904
+     * Alias of self::get_phone().
905
+     *
906
+     * @since 1.0.19
907
+     * @param  string $context View or edit context.
908
+     * @return int
909
+     */
910
+    public function get_user_phone( $context = 'view' ) {
911
+        return $this->get_phone( $context );
912 912
     }
913 913
 
914 914
     /**
915
-	 * Alias of self::get_phone().
916
-	 *
917
-	 * @since 1.0.19
918
-	 * @param  string $context View or edit context.
919
-	 * @return int
920
-	 */
921
-	public function get_customer_phone( $context = 'view' ) {
922
-		return $this->get_phone( $context );
915
+     * Alias of self::get_phone().
916
+     *
917
+     * @since 1.0.19
918
+     * @param  string $context View or edit context.
919
+     * @return int
920
+     */
921
+    public function get_customer_phone( $context = 'view' ) {
922
+        return $this->get_phone( $context );
923 923
     }
924 924
 
925 925
     /**
926
-	 * Get the customer's email address.
927
-	 *
928
-	 * @since 1.0.19
929
-	 * @param  string $context View or edit context.
930
-	 * @return string
931
-	 */
932
-	public function get_email( $context = 'view' ) {
933
-		return $this->get_prop( 'email', $context );
926
+     * Get the customer's email address.
927
+     *
928
+     * @since 1.0.19
929
+     * @param  string $context View or edit context.
930
+     * @return string
931
+     */
932
+    public function get_email( $context = 'view' ) {
933
+        return $this->get_prop( 'email', $context );
934 934
     }
935 935
 
936 936
     /**
937
-	 * Alias of self::get_email().
938
-	 *
939
-	 * @since 1.0.19
940
-	 * @param  string $context View or edit context.
941
-	 * @return string
942
-	 */
943
-	public function get_email_address( $context = 'view' ) {
944
-		return $this->get_email( $context );
937
+     * Alias of self::get_email().
938
+     *
939
+     * @since 1.0.19
940
+     * @param  string $context View or edit context.
941
+     * @return string
942
+     */
943
+    public function get_email_address( $context = 'view' ) {
944
+        return $this->get_email( $context );
945 945
     }
946 946
 
947 947
     /**
948
-	 * Alias of self::get_email().
949
-	 *
950
-	 * @since 1.0.19
951
-	 * @param  string $context View or edit context.
952
-	 * @return int
953
-	 */
954
-	public function get_user_email( $context = 'view' ) {
955
-		return $this->get_email( $context );
948
+     * Alias of self::get_email().
949
+     *
950
+     * @since 1.0.19
951
+     * @param  string $context View or edit context.
952
+     * @return int
953
+     */
954
+    public function get_user_email( $context = 'view' ) {
955
+        return $this->get_email( $context );
956 956
     }
957 957
 
958 958
     /**
959
-	 * Alias of self::get_email().
960
-	 *
961
-	 * @since 1.0.19
962
-	 * @param  string $context View or edit context.
963
-	 * @return int
964
-	 */
965
-	public function get_customer_email( $context = 'view' ) {
966
-		return $this->get_email( $context );
959
+     * Alias of self::get_email().
960
+     *
961
+     * @since 1.0.19
962
+     * @param  string $context View or edit context.
963
+     * @return int
964
+     */
965
+    public function get_customer_email( $context = 'view' ) {
966
+        return $this->get_email( $context );
967 967
     }
968 968
 
969 969
     /**
970
-	 * Get the customer's country.
971
-	 *
972
-	 * @since 1.0.19
973
-	 * @param  string $context View or edit context.
974
-	 * @return string
975
-	 */
976
-	public function get_country( $context = 'view' ) {
977
-		$country = $this->get_prop( 'country', $context );
978
-		return empty( $country ) ? wpinv_get_default_country() : $country;
970
+     * Get the customer's country.
971
+     *
972
+     * @since 1.0.19
973
+     * @param  string $context View or edit context.
974
+     * @return string
975
+     */
976
+    public function get_country( $context = 'view' ) {
977
+        $country = $this->get_prop( 'country', $context );
978
+        return empty( $country ) ? wpinv_get_default_country() : $country;
979 979
     }
980 980
 
981 981
     /**
982
-	 * Alias of self::get_country().
983
-	 *
984
-	 * @since 1.0.19
985
-	 * @param  string $context View or edit context.
986
-	 * @return int
987
-	 */
988
-	public function get_user_country( $context = 'view' ) {
989
-		return $this->get_country( $context );
982
+     * Alias of self::get_country().
983
+     *
984
+     * @since 1.0.19
985
+     * @param  string $context View or edit context.
986
+     * @return int
987
+     */
988
+    public function get_user_country( $context = 'view' ) {
989
+        return $this->get_country( $context );
990 990
     }
991 991
 
992 992
     /**
993
-	 * Alias of self::get_country().
994
-	 *
995
-	 * @since 1.0.19
996
-	 * @param  string $context View or edit context.
997
-	 * @return int
998
-	 */
999
-	public function get_customer_country( $context = 'view' ) {
1000
-		return $this->get_country( $context );
993
+     * Alias of self::get_country().
994
+     *
995
+     * @since 1.0.19
996
+     * @param  string $context View or edit context.
997
+     * @return int
998
+     */
999
+    public function get_customer_country( $context = 'view' ) {
1000
+        return $this->get_country( $context );
1001 1001
     }
1002 1002
 
1003 1003
     /**
1004
-	 * Get the customer's state.
1005
-	 *
1006
-	 * @since 1.0.19
1007
-	 * @param  string $context View or edit context.
1008
-	 * @return string
1009
-	 */
1010
-	public function get_state( $context = 'view' ) {
1011
-		$state = $this->get_prop( 'state', $context );
1012
-		return empty( $state ) ? wpinv_get_default_state() : $state;
1004
+     * Get the customer's state.
1005
+     *
1006
+     * @since 1.0.19
1007
+     * @param  string $context View or edit context.
1008
+     * @return string
1009
+     */
1010
+    public function get_state( $context = 'view' ) {
1011
+        $state = $this->get_prop( 'state', $context );
1012
+        return empty( $state ) ? wpinv_get_default_state() : $state;
1013 1013
     }
1014 1014
 
1015 1015
     /**
1016
-	 * Alias of self::get_state().
1017
-	 *
1018
-	 * @since 1.0.19
1019
-	 * @param  string $context View or edit context.
1020
-	 * @return int
1021
-	 */
1022
-	public function get_user_state( $context = 'view' ) {
1023
-		return $this->get_state( $context );
1016
+     * Alias of self::get_state().
1017
+     *
1018
+     * @since 1.0.19
1019
+     * @param  string $context View or edit context.
1020
+     * @return int
1021
+     */
1022
+    public function get_user_state( $context = 'view' ) {
1023
+        return $this->get_state( $context );
1024 1024
     }
1025 1025
 
1026 1026
     /**
1027
-	 * Alias of self::get_state().
1028
-	 *
1029
-	 * @since 1.0.19
1030
-	 * @param  string $context View or edit context.
1031
-	 * @return int
1032
-	 */
1033
-	public function get_customer_state( $context = 'view' ) {
1034
-		return $this->get_state( $context );
1027
+     * Alias of self::get_state().
1028
+     *
1029
+     * @since 1.0.19
1030
+     * @param  string $context View or edit context.
1031
+     * @return int
1032
+     */
1033
+    public function get_customer_state( $context = 'view' ) {
1034
+        return $this->get_state( $context );
1035 1035
     }
1036 1036
 
1037 1037
     /**
1038
-	 * Get the customer's city.
1039
-	 *
1040
-	 * @since 1.0.19
1041
-	 * @param  string $context View or edit context.
1042
-	 * @return string
1043
-	 */
1044
-	public function get_city( $context = 'view' ) {
1045
-		return $this->get_prop( 'city', $context );
1038
+     * Get the customer's city.
1039
+     *
1040
+     * @since 1.0.19
1041
+     * @param  string $context View or edit context.
1042
+     * @return string
1043
+     */
1044
+    public function get_city( $context = 'view' ) {
1045
+        return $this->get_prop( 'city', $context );
1046 1046
     }
1047 1047
 
1048 1048
     /**
1049
-	 * Alias of self::get_city().
1050
-	 *
1051
-	 * @since 1.0.19
1052
-	 * @param  string $context View or edit context.
1053
-	 * @return string
1054
-	 */
1055
-	public function get_user_city( $context = 'view' ) {
1056
-		return $this->get_city( $context );
1049
+     * Alias of self::get_city().
1050
+     *
1051
+     * @since 1.0.19
1052
+     * @param  string $context View or edit context.
1053
+     * @return string
1054
+     */
1055
+    public function get_user_city( $context = 'view' ) {
1056
+        return $this->get_city( $context );
1057 1057
     }
1058 1058
 
1059 1059
     /**
1060
-	 * Alias of self::get_city().
1061
-	 *
1062
-	 * @since 1.0.19
1063
-	 * @param  string $context View or edit context.
1064
-	 * @return string
1065
-	 */
1066
-	public function get_customer_city( $context = 'view' ) {
1067
-		return $this->get_city( $context );
1060
+     * Alias of self::get_city().
1061
+     *
1062
+     * @since 1.0.19
1063
+     * @param  string $context View or edit context.
1064
+     * @return string
1065
+     */
1066
+    public function get_customer_city( $context = 'view' ) {
1067
+        return $this->get_city( $context );
1068 1068
     }
1069 1069
 
1070 1070
     /**
1071
-	 * Get the customer's zip.
1072
-	 *
1073
-	 * @since 1.0.19
1074
-	 * @param  string $context View or edit context.
1075
-	 * @return string
1076
-	 */
1077
-	public function get_zip( $context = 'view' ) {
1078
-		return $this->get_prop( 'zip', $context );
1071
+     * Get the customer's zip.
1072
+     *
1073
+     * @since 1.0.19
1074
+     * @param  string $context View or edit context.
1075
+     * @return string
1076
+     */
1077
+    public function get_zip( $context = 'view' ) {
1078
+        return $this->get_prop( 'zip', $context );
1079 1079
     }
1080 1080
 
1081 1081
     /**
1082
-	 * Alias of self::get_zip().
1083
-	 *
1084
-	 * @since 1.0.19
1085
-	 * @param  string $context View or edit context.
1086
-	 * @return string
1087
-	 */
1088
-	public function get_user_zip( $context = 'view' ) {
1089
-		return $this->get_zip( $context );
1082
+     * Alias of self::get_zip().
1083
+     *
1084
+     * @since 1.0.19
1085
+     * @param  string $context View or edit context.
1086
+     * @return string
1087
+     */
1088
+    public function get_user_zip( $context = 'view' ) {
1089
+        return $this->get_zip( $context );
1090 1090
     }
1091 1091
 
1092 1092
     /**
1093
-	 * Alias of self::get_zip().
1094
-	 *
1095
-	 * @since 1.0.19
1096
-	 * @param  string $context View or edit context.
1097
-	 * @return string
1098
-	 */
1099
-	public function get_customer_zip( $context = 'view' ) {
1100
-		return $this->get_zip( $context );
1093
+     * Alias of self::get_zip().
1094
+     *
1095
+     * @since 1.0.19
1096
+     * @param  string $context View or edit context.
1097
+     * @return string
1098
+     */
1099
+    public function get_customer_zip( $context = 'view' ) {
1100
+        return $this->get_zip( $context );
1101 1101
     }
1102 1102
 
1103 1103
     /**
1104
-	 * Get the customer's company.
1105
-	 *
1106
-	 * @since 1.0.19
1107
-	 * @param  string $context View or edit context.
1108
-	 * @return string
1109
-	 */
1110
-	public function get_company( $context = 'view' ) {
1111
-		return $this->get_prop( 'company', $context );
1104
+     * Get the customer's company.
1105
+     *
1106
+     * @since 1.0.19
1107
+     * @param  string $context View or edit context.
1108
+     * @return string
1109
+     */
1110
+    public function get_company( $context = 'view' ) {
1111
+        return $this->get_prop( 'company', $context );
1112 1112
     }
1113 1113
 
1114 1114
     /**
1115
-	 * Alias of self::get_company().
1116
-	 *
1117
-	 * @since 1.0.19
1118
-	 * @param  string $context View or edit context.
1119
-	 * @return string
1120
-	 */
1121
-	public function get_user_company( $context = 'view' ) {
1122
-		return $this->get_company( $context );
1115
+     * Alias of self::get_company().
1116
+     *
1117
+     * @since 1.0.19
1118
+     * @param  string $context View or edit context.
1119
+     * @return string
1120
+     */
1121
+    public function get_user_company( $context = 'view' ) {
1122
+        return $this->get_company( $context );
1123 1123
     }
1124 1124
 
1125 1125
     /**
1126
-	 * Alias of self::get_company().
1127
-	 *
1128
-	 * @since 1.0.19
1129
-	 * @param  string $context View or edit context.
1130
-	 * @return string
1131
-	 */
1132
-	public function get_customer_company( $context = 'view' ) {
1133
-		return $this->get_company( $context );
1126
+     * Alias of self::get_company().
1127
+     *
1128
+     * @since 1.0.19
1129
+     * @param  string $context View or edit context.
1130
+     * @return string
1131
+     */
1132
+    public function get_customer_company( $context = 'view' ) {
1133
+        return $this->get_company( $context );
1134 1134
     }
1135 1135
 
1136 1136
     /**
1137
-	 * Get the customer's vat number.
1138
-	 *
1139
-	 * @since 1.0.19
1140
-	 * @param  string $context View or edit context.
1141
-	 * @return string
1142
-	 */
1143
-	public function get_vat_number( $context = 'view' ) {
1144
-		return $this->get_prop( 'vat_number', $context );
1137
+     * Get the customer's vat number.
1138
+     *
1139
+     * @since 1.0.19
1140
+     * @param  string $context View or edit context.
1141
+     * @return string
1142
+     */
1143
+    public function get_vat_number( $context = 'view' ) {
1144
+        return $this->get_prop( 'vat_number', $context );
1145 1145
     }
1146 1146
 
1147 1147
     /**
1148
-	 * Alias of self::get_vat_number().
1149
-	 *
1150
-	 * @since 1.0.19
1151
-	 * @param  string $context View or edit context.
1152
-	 * @return string
1153
-	 */
1154
-	public function get_user_vat_number( $context = 'view' ) {
1155
-		return $this->get_vat_number( $context );
1148
+     * Alias of self::get_vat_number().
1149
+     *
1150
+     * @since 1.0.19
1151
+     * @param  string $context View or edit context.
1152
+     * @return string
1153
+     */
1154
+    public function get_user_vat_number( $context = 'view' ) {
1155
+        return $this->get_vat_number( $context );
1156 1156
     }
1157 1157
 
1158 1158
     /**
1159
-	 * Alias of self::get_vat_number().
1160
-	 *
1161
-	 * @since 1.0.19
1162
-	 * @param  string $context View or edit context.
1163
-	 * @return string
1164
-	 */
1165
-	public function get_customer_vat_number( $context = 'view' ) {
1166
-		return $this->get_vat_number( $context );
1159
+     * Alias of self::get_vat_number().
1160
+     *
1161
+     * @since 1.0.19
1162
+     * @param  string $context View or edit context.
1163
+     * @return string
1164
+     */
1165
+    public function get_customer_vat_number( $context = 'view' ) {
1166
+        return $this->get_vat_number( $context );
1167 1167
     }
1168 1168
 
1169 1169
     /**
1170
-	 * Get the customer's vat rate.
1171
-	 *
1172
-	 * @since 1.0.19
1173
-	 * @param  string $context View or edit context.
1174
-	 * @return string
1175
-	 */
1176
-	public function get_vat_rate( $context = 'view' ) {
1177
-		return $this->get_prop( 'vat_rate', $context );
1170
+     * Get the customer's vat rate.
1171
+     *
1172
+     * @since 1.0.19
1173
+     * @param  string $context View or edit context.
1174
+     * @return string
1175
+     */
1176
+    public function get_vat_rate( $context = 'view' ) {
1177
+        return $this->get_prop( 'vat_rate', $context );
1178
+    }
1179
+
1180
+    /**
1181
+     * Alias of self::get_vat_rate().
1182
+     *
1183
+     * @since 1.0.19
1184
+     * @param  string $context View or edit context.
1185
+     * @return string
1186
+     */
1187
+    public function get_user_vat_rate( $context = 'view' ) {
1188
+        return $this->get_vat_rate( $context );
1189
+    }
1190
+
1191
+    /**
1192
+     * Alias of self::get_vat_rate().
1193
+     *
1194
+     * @since 1.0.19
1195
+     * @param  string $context View or edit context.
1196
+     * @return string
1197
+     */
1198
+    public function get_customer_vat_rate( $context = 'view' ) {
1199
+        return $this->get_vat_rate( $context );
1200
+    }
1201
+
1202
+    /**
1203
+     * Get the customer's address.
1204
+     *
1205
+     * @since 1.0.19
1206
+     * @param  string $context View or edit context.
1207
+     * @return string
1208
+     */
1209
+    public function get_address( $context = 'view' ) {
1210
+        return $this->get_prop( 'address', $context );
1211
+    }
1212
+
1213
+    /**
1214
+     * Alias of self::get_address().
1215
+     *
1216
+     * @since 1.0.19
1217
+     * @param  string $context View or edit context.
1218
+     * @return string
1219
+     */
1220
+    public function get_user_address( $context = 'view' ) {
1221
+        return $this->get_address( $context );
1222
+    }
1223
+
1224
+    /**
1225
+     * Alias of self::get_address().
1226
+     *
1227
+     * @since 1.0.19
1228
+     * @param  string $context View or edit context.
1229
+     * @return string
1230
+     */
1231
+    public function get_customer_address( $context = 'view' ) {
1232
+        return $this->get_address( $context );
1233
+    }
1234
+
1235
+    /**
1236
+     * Get whether the customer has viewed the invoice or not.
1237
+     *
1238
+     * @since 1.0.19
1239
+     * @param  string $context View or edit context.
1240
+     * @return bool
1241
+     */
1242
+    public function get_is_viewed( $context = 'view' ) {
1243
+        return (bool) $this->get_prop( 'is_viewed', $context );
1244
+    }
1245
+
1246
+    /**
1247
+     * Get other recipients for invoice communications.
1248
+     *
1249
+     * @since 1.0.19
1250
+     * @param  string $context View or edit context.
1251
+     * @return bool
1252
+     */
1253
+    public function get_email_cc( $context = 'view' ) {
1254
+        return $this->get_prop( 'email_cc', $context );
1255
+    }
1256
+
1257
+    /**
1258
+     * Get invoice template.
1259
+     *
1260
+     * @since 1.0.19
1261
+     * @param  string $context View or edit context.
1262
+     * @return bool
1263
+     */
1264
+    public function get_template( $context = 'view' ) {
1265
+        return $this->get_prop( 'template', $context );
1266
+    }
1267
+
1268
+    /**
1269
+     * Get whether the customer has confirmed their address.
1270
+     *
1271
+     * @since 1.0.19
1272
+     * @param  string $context View or edit context.
1273
+     * @return bool
1274
+     */
1275
+    public function get_address_confirmed( $context = 'view' ) {
1276
+        return (bool) $this->get_prop( 'address_confirmed', $context );
1178 1277
     }
1179 1278
 
1180 1279
     /**
1181
-	 * Alias of self::get_vat_rate().
1182
-	 *
1183
-	 * @since 1.0.19
1184
-	 * @param  string $context View or edit context.
1185
-	 * @return string
1186
-	 */
1187
-	public function get_user_vat_rate( $context = 'view' ) {
1188
-		return $this->get_vat_rate( $context );
1280
+     * Alias of self::get_address_confirmed().
1281
+     *
1282
+     * @since 1.0.19
1283
+     * @param  string $context View or edit context.
1284
+     * @return bool
1285
+     */
1286
+    public function get_user_address_confirmed( $context = 'view' ) {
1287
+        return $this->get_address_confirmed( $context );
1189 1288
     }
1190 1289
 
1191 1290
     /**
1192
-	 * Alias of self::get_vat_rate().
1193
-	 *
1194
-	 * @since 1.0.19
1195
-	 * @param  string $context View or edit context.
1196
-	 * @return string
1197
-	 */
1198
-	public function get_customer_vat_rate( $context = 'view' ) {
1199
-		return $this->get_vat_rate( $context );
1291
+     * Alias of self::get_address().
1292
+     *
1293
+     * @since 1.0.19
1294
+     * @param  string $context View or edit context.
1295
+     * @return bool
1296
+     */
1297
+    public function get_customer_address_confirmed( $context = 'view' ) {
1298
+        return $this->get_address_confirmed( $context );
1200 1299
     }
1201 1300
 
1202 1301
     /**
1203
-	 * Get the customer's address.
1204
-	 *
1205
-	 * @since 1.0.19
1206
-	 * @param  string $context View or edit context.
1207
-	 * @return string
1208
-	 */
1209
-	public function get_address( $context = 'view' ) {
1210
-		return $this->get_prop( 'address', $context );
1211
-    }
1212
-
1213
-    /**
1214
-	 * Alias of self::get_address().
1215
-	 *
1216
-	 * @since 1.0.19
1217
-	 * @param  string $context View or edit context.
1218
-	 * @return string
1219
-	 */
1220
-	public function get_user_address( $context = 'view' ) {
1221
-		return $this->get_address( $context );
1222
-    }
1223
-
1224
-    /**
1225
-	 * Alias of self::get_address().
1226
-	 *
1227
-	 * @since 1.0.19
1228
-	 * @param  string $context View or edit context.
1229
-	 * @return string
1230
-	 */
1231
-	public function get_customer_address( $context = 'view' ) {
1232
-		return $this->get_address( $context );
1233
-    }
1234
-
1235
-    /**
1236
-	 * Get whether the customer has viewed the invoice or not.
1237
-	 *
1238
-	 * @since 1.0.19
1239
-	 * @param  string $context View or edit context.
1240
-	 * @return bool
1241
-	 */
1242
-	public function get_is_viewed( $context = 'view' ) {
1243
-		return (bool) $this->get_prop( 'is_viewed', $context );
1244
-	}
1245
-
1246
-	/**
1247
-	 * Get other recipients for invoice communications.
1248
-	 *
1249
-	 * @since 1.0.19
1250
-	 * @param  string $context View or edit context.
1251
-	 * @return bool
1252
-	 */
1253
-	public function get_email_cc( $context = 'view' ) {
1254
-		return $this->get_prop( 'email_cc', $context );
1255
-	}
1256
-
1257
-	/**
1258
-	 * Get invoice template.
1259
-	 *
1260
-	 * @since 1.0.19
1261
-	 * @param  string $context View or edit context.
1262
-	 * @return bool
1263
-	 */
1264
-	public function get_template( $context = 'view' ) {
1265
-		return $this->get_prop( 'template', $context );
1266
-	}
1267
-
1268
-	/**
1269
-	 * Get whether the customer has confirmed their address.
1270
-	 *
1271
-	 * @since 1.0.19
1272
-	 * @param  string $context View or edit context.
1273
-	 * @return bool
1274
-	 */
1275
-	public function get_address_confirmed( $context = 'view' ) {
1276
-		return (bool) $this->get_prop( 'address_confirmed', $context );
1277
-    }
1278
-
1279
-    /**
1280
-	 * Alias of self::get_address_confirmed().
1281
-	 *
1282
-	 * @since 1.0.19
1283
-	 * @param  string $context View or edit context.
1284
-	 * @return bool
1285
-	 */
1286
-	public function get_user_address_confirmed( $context = 'view' ) {
1287
-		return $this->get_address_confirmed( $context );
1288
-    }
1289
-
1290
-    /**
1291
-	 * Alias of self::get_address().
1292
-	 *
1293
-	 * @since 1.0.19
1294
-	 * @param  string $context View or edit context.
1295
-	 * @return bool
1296
-	 */
1297
-	public function get_customer_address_confirmed( $context = 'view' ) {
1298
-		return $this->get_address_confirmed( $context );
1299
-    }
1300
-
1301
-    /**
1302
-	 * Get the invoice subtotal.
1303
-	 *
1304
-	 * @since 1.0.19
1305
-	 * @param  string $context View or edit context.
1306
-	 * @return float
1307
-	 */
1308
-	public function get_subtotal( $context = 'view' ) {
1302
+     * Get the invoice subtotal.
1303
+     *
1304
+     * @since 1.0.19
1305
+     * @param  string $context View or edit context.
1306
+     * @return float
1307
+     */
1308
+    public function get_subtotal( $context = 'view' ) {
1309 1309
         $subtotal = (float) $this->get_prop( 'subtotal', $context );
1310 1310
 
1311 1311
         // Backwards compatibility.
@@ -1317,155 +1317,155 @@  discard block
 block discarded – undo
1317 1317
     }
1318 1318
 
1319 1319
     /**
1320
-	 * Get the invoice discount total.
1321
-	 *
1322
-	 * @since 1.0.19
1323
-	 * @param  string $context View or edit context.
1324
-	 * @return float
1325
-	 */
1326
-	public function get_total_discount( $context = 'view' ) {
1327
-		return (float) $this->get_prop( 'total_discount', $context );
1320
+     * Get the invoice discount total.
1321
+     *
1322
+     * @since 1.0.19
1323
+     * @param  string $context View or edit context.
1324
+     * @return float
1325
+     */
1326
+    public function get_total_discount( $context = 'view' ) {
1327
+        return (float) $this->get_prop( 'total_discount', $context );
1328 1328
     }
1329 1329
 
1330 1330
     /**
1331
-	 * Get the invoice tax total.
1332
-	 *
1333
-	 * @since 1.0.19
1334
-	 * @param  string $context View or edit context.
1335
-	 * @return float
1336
-	 */
1337
-	public function get_total_tax( $context = 'view' ) {
1338
-		return (float) $this->get_prop( 'total_tax', $context );
1339
-	}
1331
+     * Get the invoice tax total.
1332
+     *
1333
+     * @since 1.0.19
1334
+     * @param  string $context View or edit context.
1335
+     * @return float
1336
+     */
1337
+    public function get_total_tax( $context = 'view' ) {
1338
+        return (float) $this->get_prop( 'total_tax', $context );
1339
+    }
1340 1340
 
1341
-	/**
1342
-	 * @deprecated
1343
-	 */
1344
-	public function get_final_tax( $currency = false ) {
1345
-		$tax = $this->get_total_tax();
1341
+    /**
1342
+     * @deprecated
1343
+     */
1344
+    public function get_final_tax( $currency = false ) {
1345
+        $tax = $this->get_total_tax();
1346 1346
 
1347 1347
         if ( $currency ) {
1348
-			return wpinv_price( wpinv_format_amount( $tax, NULL, false ), $this->get_currency() );
1348
+            return wpinv_price( wpinv_format_amount( $tax, NULL, false ), $this->get_currency() );
1349 1349
         }
1350 1350
 
1351 1351
         return $tax;
1352 1352
     }
1353 1353
 
1354 1354
     /**
1355
-	 * Get the invoice fees total.
1356
-	 *
1357
-	 * @since 1.0.19
1358
-	 * @param  string $context View or edit context.
1359
-	 * @return float
1360
-	 */
1361
-	public function get_total_fees( $context = 'view' ) {
1362
-		return (float) $this->get_prop( 'total_fees', $context );
1355
+     * Get the invoice fees total.
1356
+     *
1357
+     * @since 1.0.19
1358
+     * @param  string $context View or edit context.
1359
+     * @return float
1360
+     */
1361
+    public function get_total_fees( $context = 'view' ) {
1362
+        return (float) $this->get_prop( 'total_fees', $context );
1363 1363
     }
1364 1364
 
1365 1365
     /**
1366
-	 * Alias for self::get_total_fees().
1367
-	 *
1368
-	 * @since 1.0.19
1369
-	 * @param  string $context View or edit context.
1370
-	 * @return float
1371
-	 */
1372
-	public function get_fees_total( $context = 'view' ) {
1373
-		return $this->get_total_fees( $context );
1366
+     * Alias for self::get_total_fees().
1367
+     *
1368
+     * @since 1.0.19
1369
+     * @param  string $context View or edit context.
1370
+     * @return float
1371
+     */
1372
+    public function get_fees_total( $context = 'view' ) {
1373
+        return $this->get_total_fees( $context );
1374 1374
     }
1375 1375
 
1376 1376
     /**
1377
-	 * Get the invoice total.
1378
-	 *
1379
-	 * @since 1.0.19
1377
+     * Get the invoice total.
1378
+     *
1379
+     * @since 1.0.19
1380 1380
      * @return float
1381
-	 */
1382
-	public function get_total() {
1383
-		$total = $this->is_renewal() ? $this->get_recurring_total() : $this->get_initial_total();
1384
-		return apply_filters( 'getpaid_get_invoice_total_amount', $total, $this  );
1381
+     */
1382
+    public function get_total() {
1383
+        $total = $this->is_renewal() ? $this->get_recurring_total() : $this->get_initial_total();
1384
+        return apply_filters( 'getpaid_get_invoice_total_amount', $total, $this  );
1385 1385
     }
1386 1386
 
1387 1387
     /**
1388
-	 * Get the initial invoice total.
1389
-	 *
1390
-	 * @since 1.0.19
1388
+     * Get the initial invoice total.
1389
+     *
1390
+     * @since 1.0.19
1391 1391
      * @param  string $context View or edit context.
1392 1392
      * @return float
1393
-	 */
1393
+     */
1394 1394
     public function get_initial_total() {
1395 1395
 
1396
-		if ( empty( $this->totals ) ) {
1397
-			$this->recalculate_total();
1398
-		}
1396
+        if ( empty( $this->totals ) ) {
1397
+            $this->recalculate_total();
1398
+        }
1399 1399
 
1400
-		$tax      = $this->totals['tax']['initial'];
1401
-		$fee      = $this->totals['fee']['initial'];
1402
-		$discount = $this->totals['discount']['initial'];
1403
-		$subtotal = $this->totals['subtotal']['initial'];
1404
-		$total    = $tax + $fee - $discount + $subtotal;
1400
+        $tax      = $this->totals['tax']['initial'];
1401
+        $fee      = $this->totals['fee']['initial'];
1402
+        $discount = $this->totals['discount']['initial'];
1403
+        $subtotal = $this->totals['subtotal']['initial'];
1404
+        $total    = $tax + $fee - $discount + $subtotal;
1405 1405
 
1406
-		if ( 0 > $total ) {
1407
-			$total = 0;
1408
-		}
1406
+        if ( 0 > $total ) {
1407
+            $total = 0;
1408
+        }
1409 1409
 
1410 1410
         return apply_filters( 'wpinv_get_initial_invoice_total', $total, $this );
1411
-	}
1411
+    }
1412 1412
 
1413
-	/**
1414
-	 * Get the recurring invoice total.
1415
-	 *
1416
-	 * @since 1.0.19
1413
+    /**
1414
+     * Get the recurring invoice total.
1415
+     *
1416
+     * @since 1.0.19
1417 1417
      * @param  string $context View or edit context.
1418 1418
      * @return float
1419
-	 */
1419
+     */
1420 1420
     public function get_recurring_total() {
1421 1421
 
1422
-		if ( empty( $this->totals ) ) {
1423
-			$this->recalculate_total();
1424
-		}
1422
+        if ( empty( $this->totals ) ) {
1423
+            $this->recalculate_total();
1424
+        }
1425 1425
 
1426
-		$tax      = $this->totals['tax']['recurring'];
1427
-		$fee      = $this->totals['fee']['recurring'];
1428
-		$discount = $this->totals['discount']['recurring'];
1429
-		$subtotal = $this->totals['subtotal']['recurring'];
1430
-		$total    = $tax + $fee - $discount + $subtotal;
1426
+        $tax      = $this->totals['tax']['recurring'];
1427
+        $fee      = $this->totals['fee']['recurring'];
1428
+        $discount = $this->totals['discount']['recurring'];
1429
+        $subtotal = $this->totals['subtotal']['recurring'];
1430
+        $total    = $tax + $fee - $discount + $subtotal;
1431 1431
 
1432
-		if ( 0 > $total ) {
1433
-			$total = 0;
1434
-		}
1432
+        if ( 0 > $total ) {
1433
+            $total = 0;
1434
+        }
1435 1435
 
1436 1436
         return apply_filters( 'wpinv_get_recurring_invoice_total', $total, $this );
1437
-	}
1437
+    }
1438 1438
 
1439
-	/**
1440
-	 * Returns recurring payment details.
1441
-	 *
1442
-	 * @since 1.0.19
1439
+    /**
1440
+     * Returns recurring payment details.
1441
+     *
1442
+     * @since 1.0.19
1443 1443
      * @param  string $field Optionally provide a field to return.
1444
-	 * @param string $currency Whether to include the currency.
1444
+     * @param string $currency Whether to include the currency.
1445 1445
      * @return float
1446
-	 */
1446
+     */
1447 1447
     public function get_recurring_details( $field = '', $currency = false ) {
1448 1448
 
1449
-		// Maybe recalculate totals.
1450
-		if ( empty( $this->totals ) ) {
1451
-			$this->recalculate_total();
1452
-		}
1449
+        // Maybe recalculate totals.
1450
+        if ( empty( $this->totals ) ) {
1451
+            $this->recalculate_total();
1452
+        }
1453 1453
 
1454
-		// Prepare recurring totals.
1454
+        // Prepare recurring totals.
1455 1455
         $data = apply_filters(
1456
-			'wpinv_get_invoice_recurring_details',
1457
-			array(
1458
-				'cart_details' => $this->get_cart_details(),
1459
-				'subtotal'     => $this->totals['subtotal']['recurring'],
1460
-				'discount'     => $this->totals['discount']['recurring'],
1461
-				'tax'          => $this->totals['tax']['recurring'],
1462
-				'fee'          => $this->totals['fee']['recurring'],
1463
-				'total'        => $this->get_recurring_total(),
1464
-			),
1465
-			$this,
1466
-			$field,
1467
-			$currency
1468
-		);
1456
+            'wpinv_get_invoice_recurring_details',
1457
+            array(
1458
+                'cart_details' => $this->get_cart_details(),
1459
+                'subtotal'     => $this->totals['subtotal']['recurring'],
1460
+                'discount'     => $this->totals['discount']['recurring'],
1461
+                'tax'          => $this->totals['tax']['recurring'],
1462
+                'fee'          => $this->totals['fee']['recurring'],
1463
+                'total'        => $this->get_recurring_total(),
1464
+            ),
1465
+            $this,
1466
+            $field,
1467
+            $currency
1468
+        );
1469 1469
 
1470 1470
         if ( isset( $data[$field] ) ) {
1471 1471
             return ( $currency ? wpinv_price( $data[$field], $this->get_currency() ) : $data[$field] );
@@ -1475,145 +1475,145 @@  discard block
 block discarded – undo
1475 1475
     }
1476 1476
 
1477 1477
     /**
1478
-	 * Get the invoice fees.
1479
-	 *
1480
-	 * @since 1.0.19
1481
-	 * @param  string $context View or edit context.
1482
-	 * @return array
1483
-	 */
1484
-	public function get_fees( $context = 'view' ) {
1485
-		return wpinv_parse_list( $this->get_prop( 'fees', $context ) );
1478
+     * Get the invoice fees.
1479
+     *
1480
+     * @since 1.0.19
1481
+     * @param  string $context View or edit context.
1482
+     * @return array
1483
+     */
1484
+    public function get_fees( $context = 'view' ) {
1485
+        return wpinv_parse_list( $this->get_prop( 'fees', $context ) );
1486 1486
     }
1487 1487
 
1488 1488
     /**
1489
-	 * Get the invoice discounts.
1490
-	 *
1491
-	 * @since 1.0.19
1492
-	 * @param  string $context View or edit context.
1493
-	 * @return array
1494
-	 */
1495
-	public function get_discounts( $context = 'view' ) {
1496
-		return wpinv_parse_list( $this->get_prop( 'discounts', $context ) );
1489
+     * Get the invoice discounts.
1490
+     *
1491
+     * @since 1.0.19
1492
+     * @param  string $context View or edit context.
1493
+     * @return array
1494
+     */
1495
+    public function get_discounts( $context = 'view' ) {
1496
+        return wpinv_parse_list( $this->get_prop( 'discounts', $context ) );
1497 1497
     }
1498 1498
 
1499 1499
     /**
1500
-	 * Get the invoice taxes.
1501
-	 *
1502
-	 * @since 1.0.19
1503
-	 * @param  string $context View or edit context.
1504
-	 * @return array
1505
-	 */
1506
-	public function get_taxes( $context = 'view' ) {
1507
-		return wpinv_parse_list( $this->get_prop( 'taxes', $context ) );
1500
+     * Get the invoice taxes.
1501
+     *
1502
+     * @since 1.0.19
1503
+     * @param  string $context View or edit context.
1504
+     * @return array
1505
+     */
1506
+    public function get_taxes( $context = 'view' ) {
1507
+        return wpinv_parse_list( $this->get_prop( 'taxes', $context ) );
1508 1508
     }
1509 1509
 
1510 1510
     /**
1511
-	 * Get the invoice items.
1512
-	 *
1513
-	 * @since 1.0.19
1514
-	 * @param  string $context View or edit context.
1515
-	 * @return GetPaid_Form_Item[]
1516
-	 */
1517
-	public function get_items( $context = 'view' ) {
1511
+     * Get the invoice items.
1512
+     *
1513
+     * @since 1.0.19
1514
+     * @param  string $context View or edit context.
1515
+     * @return GetPaid_Form_Item[]
1516
+     */
1517
+    public function get_items( $context = 'view' ) {
1518 1518
         return $this->get_prop( 'items', $context );
1519 1519
     }
1520 1520
 
1521 1521
     /**
1522
-	 * Get the invoice's payment form.
1523
-	 *
1524
-	 * @since 1.0.19
1525
-	 * @param  string $context View or edit context.
1526
-	 * @return int
1527
-	 */
1528
-	public function get_payment_form( $context = 'view' ) {
1529
-		return intval( $this->get_prop( 'payment_form', $context ) );
1522
+     * Get the invoice's payment form.
1523
+     *
1524
+     * @since 1.0.19
1525
+     * @param  string $context View or edit context.
1526
+     * @return int
1527
+     */
1528
+    public function get_payment_form( $context = 'view' ) {
1529
+        return intval( $this->get_prop( 'payment_form', $context ) );
1530 1530
     }
1531 1531
 
1532 1532
     /**
1533
-	 * Get the invoice's submission id.
1534
-	 *
1535
-	 * @since 1.0.19
1536
-	 * @param  string $context View or edit context.
1537
-	 * @return string
1538
-	 */
1539
-	public function get_submission_id( $context = 'view' ) {
1540
-		return $this->get_prop( 'submission_id', $context );
1533
+     * Get the invoice's submission id.
1534
+     *
1535
+     * @since 1.0.19
1536
+     * @param  string $context View or edit context.
1537
+     * @return string
1538
+     */
1539
+    public function get_submission_id( $context = 'view' ) {
1540
+        return $this->get_prop( 'submission_id', $context );
1541 1541
     }
1542 1542
 
1543 1543
     /**
1544
-	 * Get the invoice's discount code.
1545
-	 *
1546
-	 * @since 1.0.19
1547
-	 * @param  string $context View or edit context.
1548
-	 * @return string
1549
-	 */
1550
-	public function get_discount_code( $context = 'view' ) {
1551
-		return $this->get_prop( 'discount_code', $context );
1544
+     * Get the invoice's discount code.
1545
+     *
1546
+     * @since 1.0.19
1547
+     * @param  string $context View or edit context.
1548
+     * @return string
1549
+     */
1550
+    public function get_discount_code( $context = 'view' ) {
1551
+        return $this->get_prop( 'discount_code', $context );
1552 1552
     }
1553 1553
 
1554 1554
     /**
1555
-	 * Get the invoice's gateway.
1556
-	 *
1557
-	 * @since 1.0.19
1558
-	 * @param  string $context View or edit context.
1559
-	 * @return string
1560
-	 */
1561
-	public function get_gateway( $context = 'view' ) {
1562
-		return $this->get_prop( 'gateway', $context );
1555
+     * Get the invoice's gateway.
1556
+     *
1557
+     * @since 1.0.19
1558
+     * @param  string $context View or edit context.
1559
+     * @return string
1560
+     */
1561
+    public function get_gateway( $context = 'view' ) {
1562
+        return $this->get_prop( 'gateway', $context );
1563 1563
     }
1564 1564
 
1565 1565
     /**
1566
-	 * Get the invoice's gateway display title.
1567
-	 *
1568
-	 * @since 1.0.19
1569
-	 * @return string
1570
-	 */
1566
+     * Get the invoice's gateway display title.
1567
+     *
1568
+     * @since 1.0.19
1569
+     * @return string
1570
+     */
1571 1571
     public function get_gateway_title() {
1572 1572
         $title =  wpinv_get_gateway_checkout_label( $this->get_gateway() );
1573 1573
         return apply_filters( 'wpinv_gateway_title', $title, $this->get_id(), $this );
1574 1574
     }
1575 1575
 
1576 1576
     /**
1577
-	 * Get the invoice's transaction id.
1578
-	 *
1579
-	 * @since 1.0.19
1580
-	 * @param  string $context View or edit context.
1581
-	 * @return string
1582
-	 */
1583
-	public function get_transaction_id( $context = 'view' ) {
1584
-		return $this->get_prop( 'transaction_id', $context );
1577
+     * Get the invoice's transaction id.
1578
+     *
1579
+     * @since 1.0.19
1580
+     * @param  string $context View or edit context.
1581
+     * @return string
1582
+     */
1583
+    public function get_transaction_id( $context = 'view' ) {
1584
+        return $this->get_prop( 'transaction_id', $context );
1585 1585
     }
1586 1586
 
1587 1587
     /**
1588
-	 * Get the invoice's currency.
1589
-	 *
1590
-	 * @since 1.0.19
1591
-	 * @param  string $context View or edit context.
1592
-	 * @return string
1593
-	 */
1594
-	public function get_currency( $context = 'view' ) {
1588
+     * Get the invoice's currency.
1589
+     *
1590
+     * @since 1.0.19
1591
+     * @param  string $context View or edit context.
1592
+     * @return string
1593
+     */
1594
+    public function get_currency( $context = 'view' ) {
1595 1595
         $currency = $this->get_prop( 'currency', $context );
1596 1596
         return empty( $currency ) ? wpinv_get_currency() : $currency;
1597 1597
     }
1598 1598
 
1599 1599
     /**
1600
-	 * Checks if we are charging taxes for this invoice.
1601
-	 *
1602
-	 * @since 1.0.19
1603
-	 * @param  string $context View or edit context.
1604
-	 * @return bool
1605
-	 */
1606
-	public function get_disable_taxes( $context = 'view' ) {
1600
+     * Checks if we are charging taxes for this invoice.
1601
+     *
1602
+     * @since 1.0.19
1603
+     * @param  string $context View or edit context.
1604
+     * @return bool
1605
+     */
1606
+    public function get_disable_taxes( $context = 'view' ) {
1607 1607
         return (bool) $this->get_prop( 'disable_taxes', $context );
1608 1608
     }
1609 1609
 
1610 1610
     /**
1611
-	 * Retrieves the subscription id for an invoice.
1612
-	 *
1613
-	 * @since 1.0.19
1614
-	 * @param  string $context View or edit context.
1615
-	 * @return int
1616
-	 */
1611
+     * Retrieves the subscription id for an invoice.
1612
+     *
1613
+     * @since 1.0.19
1614
+     * @param  string $context View or edit context.
1615
+     * @return int
1616
+     */
1617 1617
     public function get_subscription_id( $context = 'view' ) {
1618 1618
         $subscription_id = $this->get_prop( 'subscription_id', $context );
1619 1619
 
@@ -1626,12 +1626,12 @@  discard block
 block discarded – undo
1626 1626
     }
1627 1627
 
1628 1628
     /**
1629
-	 * Retrieves the payment meta for an invoice.
1630
-	 *
1631
-	 * @since 1.0.19
1632
-	 * @param  string $context View or edit context.
1633
-	 * @return array
1634
-	 */
1629
+     * Retrieves the payment meta for an invoice.
1630
+     *
1631
+     * @since 1.0.19
1632
+     * @param  string $context View or edit context.
1633
+     * @return array
1634
+     */
1635 1635
     public function get_payment_meta( $context = 'view' ) {
1636 1636
 
1637 1637
         return array(
@@ -1651,11 +1651,11 @@  discard block
 block discarded – undo
1651 1651
     }
1652 1652
 
1653 1653
     /**
1654
-	 * Retrieves the cart details for an invoice.
1655
-	 *
1656
-	 * @since 1.0.19
1657
-	 * @return array
1658
-	 */
1654
+     * Retrieves the cart details for an invoice.
1655
+     *
1656
+     * @since 1.0.19
1657
+     * @return array
1658
+     */
1659 1659
     public function get_cart_details() {
1660 1660
         $items        = $this->get_items();
1661 1661
         $cart_details = array();
@@ -1665,16 +1665,16 @@  discard block
 block discarded – undo
1665 1665
         }
1666 1666
 
1667 1667
         return $cart_details;
1668
-	}
1668
+    }
1669 1669
 
1670
-	/**
1671
-	 * Retrieves the recurring item.
1672
-	 *
1673
-	 * @return null|GetPaid_Form_Item
1674
-	 */
1675
-	public function get_recurring( $object = false ) {
1670
+    /**
1671
+     * Retrieves the recurring item.
1672
+     *
1673
+     * @return null|GetPaid_Form_Item
1674
+     */
1675
+    public function get_recurring( $object = false ) {
1676 1676
 
1677
-		// Are we returning an object?
1677
+        // Are we returning an object?
1678 1678
         if ( $object ) {
1679 1679
             return $this->get_item( $this->recurring_item );
1680 1680
         }
@@ -1682,100 +1682,100 @@  discard block
 block discarded – undo
1682 1682
         return $this->recurring_item;
1683 1683
     }
1684 1684
 
1685
-	/**
1686
-	 * Retrieves the subscription name.
1687
-	 *
1688
-	 * @since 1.0.19
1689
-	 * @return string
1690
-	 */
1691
-	public function get_subscription_name() {
1685
+    /**
1686
+     * Retrieves the subscription name.
1687
+     *
1688
+     * @since 1.0.19
1689
+     * @return string
1690
+     */
1691
+    public function get_subscription_name() {
1692 1692
 
1693
-		// Retrieve the recurring name
1693
+        // Retrieve the recurring name
1694 1694
         $item = $this->get_recurring( true );
1695 1695
 
1696
-		// Abort if it does not exist.
1696
+        // Abort if it does not exist.
1697 1697
         if ( empty( $item ) ) {
1698 1698
             return '';
1699 1699
         }
1700 1700
 
1701
-		// Return the item name.
1701
+        // Return the item name.
1702 1702
         return apply_filters( 'wpinv_invoice_get_subscription_name', $item->get_name(), $this );
1703
-	}
1704
-
1705
-	/**
1706
-	 * Retrieves the view url.
1707
-	 *
1708
-	 * @since 1.0.19
1709
-	 * @return string
1710
-	 */
1711
-	public function get_view_url() {
1703
+    }
1704
+
1705
+    /**
1706
+     * Retrieves the view url.
1707
+     *
1708
+     * @since 1.0.19
1709
+     * @return string
1710
+     */
1711
+    public function get_view_url() {
1712 1712
         $invoice_url = get_permalink( $this->get_id() );
1713
-		$invoice_url = add_query_arg( 'invoice_key', $this->get_key(), $invoice_url );
1713
+        $invoice_url = add_query_arg( 'invoice_key', $this->get_key(), $invoice_url );
1714 1714
         return apply_filters( 'wpinv_get_view_url', $invoice_url, $this );
1715
-	}
1715
+    }
1716 1716
 
1717
-	/**
1718
-	 * Retrieves the payment url.
1719
-	 *
1720
-	 * @since 1.0.19
1721
-	 * @return string
1722
-	 */
1723
-	public function get_checkout_payment_url( $deprecated = false, $secret = false ) {
1717
+    /**
1718
+     * Retrieves the payment url.
1719
+     *
1720
+     * @since 1.0.19
1721
+     * @return string
1722
+     */
1723
+    public function get_checkout_payment_url( $deprecated = false, $secret = false ) {
1724 1724
 
1725
-		// Retrieve the checkout url.
1725
+        // Retrieve the checkout url.
1726 1726
         $pay_url = wpinv_get_checkout_uri();
1727 1727
 
1728
-		// Maybe force ssl.
1728
+        // Maybe force ssl.
1729 1729
         if ( is_ssl() ) {
1730 1730
             $pay_url = str_replace( 'http:', 'https:', $pay_url );
1731 1731
         }
1732 1732
 
1733
-		// Add the invoice key.
1734
-		$pay_url = add_query_arg( 'invoice_key', $this->get_key(), $pay_url );
1733
+        // Add the invoice key.
1734
+        $pay_url = add_query_arg( 'invoice_key', $this->get_key(), $pay_url );
1735 1735
 
1736
-		// (Maybe?) add a secret
1736
+        // (Maybe?) add a secret
1737 1737
         if ( $secret ) {
1738 1738
             $pay_url = add_query_arg( array( '_wpipay' => md5( $this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key() ) ), $pay_url );
1739 1739
         }
1740 1740
 
1741 1741
         return apply_filters( 'wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret );
1742
-	}
1742
+    }
1743 1743
 	
1744
-	/**
1745
-	 * Retrieves the receipt url.
1746
-	 *
1747
-	 * @since 1.0.19
1748
-	 * @return string
1749
-	 */
1750
-	public function get_receipt_url() {
1751
-
1752
-		// Retrieve the checkout url.
1744
+    /**
1745
+     * Retrieves the receipt url.
1746
+     *
1747
+     * @since 1.0.19
1748
+     * @return string
1749
+     */
1750
+    public function get_receipt_url() {
1751
+
1752
+        // Retrieve the checkout url.
1753 1753
         $receipt_url = wpinv_get_success_page_uri();
1754 1754
 
1755
-		// Maybe force ssl.
1755
+        // Maybe force ssl.
1756 1756
         if ( is_ssl() ) {
1757 1757
             $receipt_url = str_replace( 'http:', 'https:', $receipt_url );
1758 1758
         }
1759 1759
 
1760
-		// Add the invoice key.
1761
-		$receipt_url = add_query_arg( 'invoice_key', $this->get_key(), $receipt_url );
1760
+        // Add the invoice key.
1761
+        $receipt_url = add_query_arg( 'invoice_key', $this->get_key(), $receipt_url );
1762 1762
 
1763 1763
         return apply_filters( 'getpaid_get_invoice_receipt_url', $receipt_url, $this );
1764 1764
     }
1765 1765
 
1766 1766
     /**
1767
-	 * Magic method for accessing invoice properties.
1768
-	 *
1769
-	 * @since 1.0.15
1770
-	 * @access public
1771
-	 *
1772
-	 * @param string $key Discount data to retrieve
1773
-	 * @param  string $context View or edit context.
1774
-	 * @return mixed Value of the given invoice property (if set).
1775
-	 */
1776
-	public function get( $key, $context = 'view' ) {
1767
+     * Magic method for accessing invoice properties.
1768
+     *
1769
+     * @since 1.0.15
1770
+     * @access public
1771
+     *
1772
+     * @param string $key Discount data to retrieve
1773
+     * @param  string $context View or edit context.
1774
+     * @return mixed Value of the given invoice property (if set).
1775
+     */
1776
+    public function get( $key, $context = 'view' ) {
1777 1777
         return $this->get_prop( $key, $context );
1778
-	}
1778
+    }
1779 1779
 
1780 1780
     /*
1781 1781
 	|--------------------------------------------------------------------------
@@ -1788,126 +1788,126 @@  discard block
 block discarded – undo
1788 1788
     */
1789 1789
 
1790 1790
     /**
1791
-	 * Magic method for setting invoice properties.
1792
-	 *
1793
-	 * @since 1.0.19
1794
-	 * @access public
1795
-	 *
1796
-	 * @param string $key Discount data to retrieve
1797
-	 * @param  mixed $value new value.
1798
-	 * @return mixed Value of the given invoice property (if set).
1799
-	 */
1800
-	public function set( $key, $value ) {
1791
+     * Magic method for setting invoice properties.
1792
+     *
1793
+     * @since 1.0.19
1794
+     * @access public
1795
+     *
1796
+     * @param string $key Discount data to retrieve
1797
+     * @param  mixed $value new value.
1798
+     * @return mixed Value of the given invoice property (if set).
1799
+     */
1800
+    public function set( $key, $value ) {
1801 1801
 
1802 1802
         $setter = "set_$key";
1803 1803
         if ( is_callable( array( $this, $setter ) ) ) {
1804 1804
             $this->{$setter}( $value );
1805 1805
         }
1806 1806
 
1807
-	}
1807
+    }
1808 1808
 
1809
-	/**
1810
-	 * Sets item status.
1811
-	 *
1812
-	 * @since 1.0.19
1813
-	 * @param string $new_status    New status.
1814
-	 * @param string $note          Optional note to add.
1815
-	 * @param bool   $manual_update Is this a manual status change?.
1816
-	 * @return array details of change.
1817
-	 */
1818
-	public function set_status( $new_status, $note = '', $manual_update = false ) {
1819
-		$old_status = $this->get_status();
1809
+    /**
1810
+     * Sets item status.
1811
+     *
1812
+     * @since 1.0.19
1813
+     * @param string $new_status    New status.
1814
+     * @param string $note          Optional note to add.
1815
+     * @param bool   $manual_update Is this a manual status change?.
1816
+     * @return array details of change.
1817
+     */
1818
+    public function set_status( $new_status, $note = '', $manual_update = false ) {
1819
+        $old_status = $this->get_status();
1820 1820
 
1821
-		$statuses = $this->get_all_statuses();
1821
+        $statuses = $this->get_all_statuses();
1822 1822
 
1823
-		if ( isset( $statuses[ 'draft' ] ) ) {
1824
-			unset( $statuses[ 'draft' ] );
1825
-		}
1823
+        if ( isset( $statuses[ 'draft' ] ) ) {
1824
+            unset( $statuses[ 'draft' ] );
1825
+        }
1826 1826
 
1827 1827
 
1828
-		$this->set_prop( 'status', $new_status );
1828
+        $this->set_prop( 'status', $new_status );
1829 1829
 
1830
-		// If setting the status, ensure it's set to a valid status.
1831
-		if ( true === $this->object_read ) {
1830
+        // If setting the status, ensure it's set to a valid status.
1831
+        if ( true === $this->object_read ) {
1832 1832
 
1833
-			// Only allow valid new status.
1834
-			if ( ! array_key_exists( $new_status, $statuses ) ) {
1835
-				$new_status = 'wpi-pending';
1836
-			}
1833
+            // Only allow valid new status.
1834
+            if ( ! array_key_exists( $new_status, $statuses ) ) {
1835
+                $new_status = 'wpi-pending';
1836
+            }
1837 1837
 
1838
-			// If the old status is set but unknown (e.g. draft) assume its pending for action usage.
1839
-			if ( $old_status && ! array_key_exists( $new_status, $statuses ) ) {
1840
-				$old_status = 'wpi-pending';
1841
-			}
1838
+            // If the old status is set but unknown (e.g. draft) assume its pending for action usage.
1839
+            if ( $old_status && ! array_key_exists( $new_status, $statuses ) ) {
1840
+                $old_status = 'wpi-pending';
1841
+            }
1842 1842
 
1843
-		}
1843
+        }
1844 1844
 
1845
-		if ( true === $this->object_read && $old_status !== $new_status ) {
1846
-			$this->status_transition = array(
1847
-				'from'   => ! empty( $this->status_transition['from'] ) ? $this->status_transition['from'] : $old_status,
1848
-				'to'     => $new_status,
1849
-				'note'   => $note,
1850
-				'manual' => (bool) $manual_update,
1851
-			);
1845
+        if ( true === $this->object_read && $old_status !== $new_status ) {
1846
+            $this->status_transition = array(
1847
+                'from'   => ! empty( $this->status_transition['from'] ) ? $this->status_transition['from'] : $old_status,
1848
+                'to'     => $new_status,
1849
+                'note'   => $note,
1850
+                'manual' => (bool) $manual_update,
1851
+            );
1852 1852
 
1853
-			if ( $manual_update ) {
1854
-				do_action( 'getpaid_' . $this->object_type .'_edit_status', $this->get_id(), $new_status );
1855
-			}
1853
+            if ( $manual_update ) {
1854
+                do_action( 'getpaid_' . $this->object_type .'_edit_status', $this->get_id(), $new_status );
1855
+            }
1856 1856
 
1857
-			$this->maybe_set_date_paid();
1857
+            $this->maybe_set_date_paid();
1858 1858
 
1859
-		}
1859
+        }
1860 1860
 
1861
-		return array(
1862
-			'from' => $old_status,
1863
-			'to'   => $new_status,
1864
-		);
1865
-	}
1861
+        return array(
1862
+            'from' => $old_status,
1863
+            'to'   => $new_status,
1864
+        );
1865
+    }
1866 1866
 
1867
-	/**
1868
-	 * Maybe set date paid.
1869
-	 *
1870
-	 * Sets the date paid variable when transitioning to the payment complete
1871
-	 * order status.
1872
-	 *
1873
-	 * @since 1.0.19
1874
-	 */
1875
-	public function maybe_set_date_paid() {
1867
+    /**
1868
+     * Maybe set date paid.
1869
+     *
1870
+     * Sets the date paid variable when transitioning to the payment complete
1871
+     * order status.
1872
+     *
1873
+     * @since 1.0.19
1874
+     */
1875
+    public function maybe_set_date_paid() {
1876 1876
 
1877
-		if ( ! $this->get_date_completed( 'edit' ) && $this->is_paid() ) {
1878
-			$this->set_date_completed( current_time( 'mysql' ) );
1879
-		}
1880
-	}
1877
+        if ( ! $this->get_date_completed( 'edit' ) && $this->is_paid() ) {
1878
+            $this->set_date_completed( current_time( 'mysql' ) );
1879
+        }
1880
+    }
1881 1881
 
1882 1882
     /**
1883
-	 * Set parent invoice ID.
1884
-	 *
1885
-	 * @since 1.0.19
1886
-	 */
1887
-	public function set_parent_id( $value ) {
1888
-		if ( $value && ( $value === $this->get_id() ) ) {
1889
-			return;
1890
-		}
1891
-		$this->set_prop( 'parent_id', absint( $value ) );
1883
+     * Set parent invoice ID.
1884
+     *
1885
+     * @since 1.0.19
1886
+     */
1887
+    public function set_parent_id( $value ) {
1888
+        if ( $value && ( $value === $this->get_id() ) ) {
1889
+            return;
1890
+        }
1891
+        $this->set_prop( 'parent_id', absint( $value ) );
1892 1892
     }
1893 1893
 
1894 1894
     /**
1895
-	 * Set plugin version when the invoice was created.
1896
-	 *
1897
-	 * @since 1.0.19
1898
-	 */
1899
-	public function set_version( $value ) {
1900
-		$this->set_prop( 'version', $value );
1895
+     * Set plugin version when the invoice was created.
1896
+     *
1897
+     * @since 1.0.19
1898
+     */
1899
+    public function set_version( $value ) {
1900
+        $this->set_prop( 'version', $value );
1901 1901
     }
1902 1902
 
1903 1903
     /**
1904
-	 * Set date when the invoice was created.
1905
-	 *
1906
-	 * @since 1.0.19
1907
-	 * @param string $value Value to set.
1904
+     * Set date when the invoice was created.
1905
+     *
1906
+     * @since 1.0.19
1907
+     * @param string $value Value to set.
1908 1908
      * @return bool Whether or not the date was set.
1909
-	 */
1910
-	public function set_date_created( $value ) {
1909
+     */
1910
+    public function set_date_created( $value ) {
1911 1911
         $date = strtotime( $value );
1912 1912
 
1913 1913
         if ( $date && $value !== '0000-00-00 00:00:00' ) {
@@ -1920,13 +1920,13 @@  discard block
 block discarded – undo
1920 1920
     }
1921 1921
 
1922 1922
     /**
1923
-	 * Set date invoice due date.
1924
-	 *
1925
-	 * @since 1.0.19
1926
-	 * @param string $value Value to set.
1923
+     * Set date invoice due date.
1924
+     *
1925
+     * @since 1.0.19
1926
+     * @param string $value Value to set.
1927 1927
      * @return bool Whether or not the date was set.
1928
-	 */
1929
-	public function set_due_date( $value ) {
1928
+     */
1929
+    public function set_due_date( $value ) {
1930 1930
         $date = strtotime( $value );
1931 1931
 
1932 1932
         if ( $date && $value !== '0000-00-00 00:00:00' ) {
@@ -1934,29 +1934,29 @@  discard block
 block discarded – undo
1934 1934
             return true;
1935 1935
         }
1936 1936
 
1937
-		$this->set_prop( 'due_date', '' );
1937
+        $this->set_prop( 'due_date', '' );
1938 1938
         return false;
1939 1939
 
1940 1940
     }
1941 1941
 
1942 1942
     /**
1943
-	 * Alias of self::set_due_date().
1944
-	 *
1945
-	 * @since 1.0.19
1946
-	 * @param  string $value New name.
1947
-	 */
1948
-	public function set_date_due( $value ) {
1949
-		$this->set_due_date( $value );
1943
+     * Alias of self::set_due_date().
1944
+     *
1945
+     * @since 1.0.19
1946
+     * @param  string $value New name.
1947
+     */
1948
+    public function set_date_due( $value ) {
1949
+        $this->set_due_date( $value );
1950 1950
     }
1951 1951
 
1952 1952
     /**
1953
-	 * Set date invoice was completed.
1954
-	 *
1955
-	 * @since 1.0.19
1956
-	 * @param string $value Value to set.
1953
+     * Set date invoice was completed.
1954
+     *
1955
+     * @since 1.0.19
1956
+     * @param string $value Value to set.
1957 1957
      * @return bool Whether or not the date was set.
1958
-	 */
1959
-	public function set_completed_date( $value ) {
1958
+     */
1959
+    public function set_completed_date( $value ) {
1960 1960
         $date = strtotime( $value );
1961 1961
 
1962 1962
         if ( $date && $value !== '0000-00-00 00:00:00'  ) {
@@ -1964,29 +1964,29 @@  discard block
 block discarded – undo
1964 1964
             return true;
1965 1965
         }
1966 1966
 
1967
-		$this->set_prop( 'completed_date', '' );
1967
+        $this->set_prop( 'completed_date', '' );
1968 1968
         return false;
1969 1969
 
1970 1970
     }
1971 1971
 
1972 1972
     /**
1973
-	 * Alias of self::set_completed_date().
1974
-	 *
1975
-	 * @since 1.0.19
1976
-	 * @param  string $value New name.
1977
-	 */
1978
-	public function set_date_completed( $value ) {
1979
-		$this->set_completed_date( $value );
1973
+     * Alias of self::set_completed_date().
1974
+     *
1975
+     * @since 1.0.19
1976
+     * @param  string $value New name.
1977
+     */
1978
+    public function set_date_completed( $value ) {
1979
+        $this->set_completed_date( $value );
1980 1980
     }
1981 1981
 
1982 1982
     /**
1983
-	 * Set date when the invoice was last modified.
1984
-	 *
1985
-	 * @since 1.0.19
1986
-	 * @param string $value Value to set.
1983
+     * Set date when the invoice was last modified.
1984
+     *
1985
+     * @since 1.0.19
1986
+     * @param string $value Value to set.
1987 1987
      * @return bool Whether or not the date was set.
1988
-	 */
1989
-	public function set_date_modified( $value ) {
1988
+     */
1989
+    public function set_date_modified( $value ) {
1990 1990
         $date = strtotime( $value );
1991 1991
 
1992 1992
         if ( $date && $value !== '0000-00-00 00:00:00' ) {
@@ -1994,706 +1994,706 @@  discard block
 block discarded – undo
1994 1994
             return true;
1995 1995
         }
1996 1996
 
1997
-		$this->set_prop( 'date_modified', '' );
1997
+        $this->set_prop( 'date_modified', '' );
1998 1998
         return false;
1999 1999
 
2000 2000
     }
2001 2001
 
2002 2002
     /**
2003
-	 * Set the invoice number.
2004
-	 *
2005
-	 * @since 1.0.19
2006
-	 * @param  string $value New number.
2007
-	 */
2008
-	public function set_number( $value ) {
2003
+     * Set the invoice number.
2004
+     *
2005
+     * @since 1.0.19
2006
+     * @param  string $value New number.
2007
+     */
2008
+    public function set_number( $value ) {
2009 2009
         $number = sanitize_text_field( $value );
2010
-		$this->set_prop( 'number', $number );
2010
+        $this->set_prop( 'number', $number );
2011 2011
     }
2012 2012
 
2013 2013
     /**
2014
-	 * Set the invoice type.
2015
-	 *
2016
-	 * @since 1.0.19
2017
-	 * @param  string $value Type.
2018
-	 */
2019
-	public function set_type( $value ) {
2014
+     * Set the invoice type.
2015
+     *
2016
+     * @since 1.0.19
2017
+     * @param  string $value Type.
2018
+     */
2019
+    public function set_type( $value ) {
2020 2020
         $type = sanitize_text_field( str_replace( 'wpi_', '', $value ) );
2021
-		$this->set_prop( 'type', $type );
2022
-	}
2021
+        $this->set_prop( 'type', $type );
2022
+    }
2023 2023
 
2024 2024
     /**
2025
-	 * Set the invoice post type.
2026
-	 *
2027
-	 * @since 1.0.19
2028
-	 * @param  string $value Post type.
2029
-	 */
2030
-	public function set_post_type( $value ) {
2025
+     * Set the invoice post type.
2026
+     *
2027
+     * @since 1.0.19
2028
+     * @param  string $value Post type.
2029
+     */
2030
+    public function set_post_type( $value ) {
2031 2031
         if ( getpaid_is_invoice_post_type( $value ) ) {
2032
-			$this->set_type( $value );
2032
+            $this->set_type( $value );
2033 2033
             $this->set_prop( 'post_type', $value );
2034 2034
         }
2035 2035
     }
2036 2036
 
2037 2037
     /**
2038
-	 * Set the invoice key.
2039
-	 *
2040
-	 * @since 1.0.19
2041
-	 * @param  string $value New key.
2042
-	 */
2043
-	public function set_key( $value ) {
2038
+     * Set the invoice key.
2039
+     *
2040
+     * @since 1.0.19
2041
+     * @param  string $value New key.
2042
+     */
2043
+    public function set_key( $value ) {
2044 2044
         $key = sanitize_text_field( $value );
2045
-		$this->set_prop( 'key', $key );
2045
+        $this->set_prop( 'key', $key );
2046 2046
     }
2047 2047
 
2048 2048
     /**
2049
-	 * Set the invoice mode.
2050
-	 *
2051
-	 * @since 1.0.19
2052
-	 * @param  string $value mode.
2053
-	 */
2054
-	public function set_mode( $value ) {
2049
+     * Set the invoice mode.
2050
+     *
2051
+     * @since 1.0.19
2052
+     * @param  string $value mode.
2053
+     */
2054
+    public function set_mode( $value ) {
2055 2055
         if ( ! in_array( $value, array( 'live', 'test' ) ) ) {
2056 2056
             $this->set_prop( 'value', $value );
2057 2057
         }
2058 2058
     }
2059 2059
 
2060 2060
     /**
2061
-	 * Set the invoice path.
2062
-	 *
2063
-	 * @since 1.0.19
2064
-	 * @param  string $value path.
2065
-	 */
2066
-	public function set_path( $value ) {
2061
+     * Set the invoice path.
2062
+     *
2063
+     * @since 1.0.19
2064
+     * @param  string $value path.
2065
+     */
2066
+    public function set_path( $value ) {
2067 2067
         $this->set_prop( 'path', $value );
2068 2068
     }
2069 2069
 
2070 2070
     /**
2071
-	 * Set the invoice name.
2072
-	 *
2073
-	 * @since 1.0.19
2074
-	 * @param  string $value New name.
2075
-	 */
2076
-	public function set_name( $value ) {
2071
+     * Set the invoice name.
2072
+     *
2073
+     * @since 1.0.19
2074
+     * @param  string $value New name.
2075
+     */
2076
+    public function set_name( $value ) {
2077 2077
         $name = sanitize_text_field( $value );
2078
-		$this->set_prop( 'name', $name );
2078
+        $this->set_prop( 'name', $name );
2079 2079
     }
2080 2080
 
2081 2081
     /**
2082
-	 * Alias of self::set_name().
2083
-	 *
2084
-	 * @since 1.0.19
2085
-	 * @param  string $value New name.
2086
-	 */
2087
-	public function set_title( $value ) {
2088
-		$this->set_name( $value );
2082
+     * Alias of self::set_name().
2083
+     *
2084
+     * @since 1.0.19
2085
+     * @param  string $value New name.
2086
+     */
2087
+    public function set_title( $value ) {
2088
+        $this->set_name( $value );
2089 2089
     }
2090 2090
 
2091 2091
     /**
2092
-	 * Set the invoice description.
2093
-	 *
2094
-	 * @since 1.0.19
2095
-	 * @param  string $value New description.
2096
-	 */
2097
-	public function set_description( $value ) {
2092
+     * Set the invoice description.
2093
+     *
2094
+     * @since 1.0.19
2095
+     * @param  string $value New description.
2096
+     */
2097
+    public function set_description( $value ) {
2098 2098
         $description = wp_kses_post( $value );
2099
-		return $this->set_prop( 'description', $description );
2099
+        return $this->set_prop( 'description', $description );
2100 2100
     }
2101 2101
 
2102 2102
     /**
2103
-	 * Alias of self::set_description().
2104
-	 *
2105
-	 * @since 1.0.19
2106
-	 * @param  string $value New description.
2107
-	 */
2108
-	public function set_excerpt( $value ) {
2109
-		$this->set_description( $value );
2103
+     * Alias of self::set_description().
2104
+     *
2105
+     * @since 1.0.19
2106
+     * @param  string $value New description.
2107
+     */
2108
+    public function set_excerpt( $value ) {
2109
+        $this->set_description( $value );
2110
+    }
2111
+
2112
+    /**
2113
+     * Alias of self::set_description().
2114
+     *
2115
+     * @since 1.0.19
2116
+     * @param  string $value New description.
2117
+     */
2118
+    public function set_summary( $value ) {
2119
+        $this->set_description( $value );
2120
+    }
2121
+
2122
+    /**
2123
+     * Set the receiver of the invoice.
2124
+     *
2125
+     * @since 1.0.19
2126
+     * @param  int $value New author.
2127
+     */
2128
+    public function set_author( $value ) {
2129
+        $user = get_user_by( 'id', (int) $value );
2130
+
2131
+        if ( $user && $user->ID ) {
2132
+            $this->set_prop( 'author', $user->ID );
2133
+            $this->set_prop( 'email', $user->user_email );
2134
+        }
2135
+		
2136
+    }
2137
+
2138
+    /**
2139
+     * Alias of self::set_author().
2140
+     *
2141
+     * @since 1.0.19
2142
+     * @param  int $value New user id.
2143
+     */
2144
+    public function set_user_id( $value ) {
2145
+        $this->set_author( $value );
2110 2146
     }
2111 2147
 
2112 2148
     /**
2113
-	 * Alias of self::set_description().
2114
-	 *
2115
-	 * @since 1.0.19
2116
-	 * @param  string $value New description.
2117
-	 */
2118
-	public function set_summary( $value ) {
2119
-		$this->set_description( $value );
2149
+     * Alias of self::set_author().
2150
+     *
2151
+     * @since 1.0.19
2152
+     * @param  int $value New user id.
2153
+     */
2154
+    public function set_customer_id( $value ) {
2155
+        $this->set_author( $value );
2120 2156
     }
2121 2157
 
2122 2158
     /**
2123
-	 * Set the receiver of the invoice.
2124
-	 *
2125
-	 * @since 1.0.19
2126
-	 * @param  int $value New author.
2127
-	 */
2128
-	public function set_author( $value ) {
2129
-		$user = get_user_by( 'id', (int) $value );
2130
-
2131
-		if ( $user && $user->ID ) {
2132
-			$this->set_prop( 'author', $user->ID );
2133
-			$this->set_prop( 'email', $user->user_email );
2134
-		}
2135
-		
2159
+     * Set the customer's ip.
2160
+     *
2161
+     * @since 1.0.19
2162
+     * @param  string $value ip address.
2163
+     */
2164
+    public function set_ip( $value ) {
2165
+        $this->set_prop( 'ip', $value );
2136 2166
     }
2137 2167
 
2138 2168
     /**
2139
-	 * Alias of self::set_author().
2140
-	 *
2141
-	 * @since 1.0.19
2142
-	 * @param  int $value New user id.
2143
-	 */
2144
-	public function set_user_id( $value ) {
2145
-		$this->set_author( $value );
2169
+     * Alias of self::set_ip().
2170
+     *
2171
+     * @since 1.0.19
2172
+     * @param  string $value ip address.
2173
+     */
2174
+    public function set_user_ip( $value ) {
2175
+        $this->set_ip( $value );
2146 2176
     }
2147 2177
 
2148 2178
     /**
2149
-	 * Alias of self::set_author().
2150
-	 *
2151
-	 * @since 1.0.19
2152
-	 * @param  int $value New user id.
2153
-	 */
2154
-	public function set_customer_id( $value ) {
2155
-		$this->set_author( $value );
2179
+     * Set the customer's first name.
2180
+     *
2181
+     * @since 1.0.19
2182
+     * @param  string $value first name.
2183
+     */
2184
+    public function set_first_name( $value ) {
2185
+        $this->set_prop( 'first_name', $value );
2156 2186
     }
2157 2187
 
2158 2188
     /**
2159
-	 * Set the customer's ip.
2160
-	 *
2161
-	 * @since 1.0.19
2162
-	 * @param  string $value ip address.
2163
-	 */
2164
-	public function set_ip( $value ) {
2165
-		$this->set_prop( 'ip', $value );
2189
+     * Alias of self::set_first_name().
2190
+     *
2191
+     * @since 1.0.19
2192
+     * @param  string $value first name.
2193
+     */
2194
+    public function set_user_first_name( $value ) {
2195
+        $this->set_first_name( $value );
2166 2196
     }
2167 2197
 
2168 2198
     /**
2169
-	 * Alias of self::set_ip().
2170
-	 *
2171
-	 * @since 1.0.19
2172
-	 * @param  string $value ip address.
2173
-	 */
2174
-	public function set_user_ip( $value ) {
2175
-		$this->set_ip( $value );
2199
+     * Alias of self::set_first_name().
2200
+     *
2201
+     * @since 1.0.19
2202
+     * @param  string $value first name.
2203
+     */
2204
+    public function set_customer_first_name( $value ) {
2205
+        $this->set_first_name( $value );
2176 2206
     }
2177 2207
 
2178 2208
     /**
2179
-	 * Set the customer's first name.
2180
-	 *
2181
-	 * @since 1.0.19
2182
-	 * @param  string $value first name.
2183
-	 */
2184
-	public function set_first_name( $value ) {
2185
-		$this->set_prop( 'first_name', $value );
2209
+     * Set the customer's last name.
2210
+     *
2211
+     * @since 1.0.19
2212
+     * @param  string $value last name.
2213
+     */
2214
+    public function set_last_name( $value ) {
2215
+        $this->set_prop( 'last_name', $value );
2186 2216
     }
2187 2217
 
2188 2218
     /**
2189
-	 * Alias of self::set_first_name().
2190
-	 *
2191
-	 * @since 1.0.19
2192
-	 * @param  string $value first name.
2193
-	 */
2194
-	public function set_user_first_name( $value ) {
2195
-		$this->set_first_name( $value );
2219
+     * Alias of self::set_last_name().
2220
+     *
2221
+     * @since 1.0.19
2222
+     * @param  string $value last name.
2223
+     */
2224
+    public function set_user_last_name( $value ) {
2225
+        $this->set_last_name( $value );
2196 2226
     }
2197 2227
 
2198 2228
     /**
2199
-	 * Alias of self::set_first_name().
2200
-	 *
2201
-	 * @since 1.0.19
2202
-	 * @param  string $value first name.
2203
-	 */
2204
-	public function set_customer_first_name( $value ) {
2205
-		$this->set_first_name( $value );
2229
+     * Alias of self::set_last_name().
2230
+     *
2231
+     * @since 1.0.19
2232
+     * @param  string $value last name.
2233
+     */
2234
+    public function set_customer_last_name( $value ) {
2235
+        $this->set_last_name( $value );
2206 2236
     }
2207 2237
 
2208 2238
     /**
2209
-	 * Set the customer's last name.
2210
-	 *
2211
-	 * @since 1.0.19
2212
-	 * @param  string $value last name.
2213
-	 */
2214
-	public function set_last_name( $value ) {
2215
-		$this->set_prop( 'last_name', $value );
2239
+     * Set the customer's phone number.
2240
+     *
2241
+     * @since 1.0.19
2242
+     * @param  string $value phone.
2243
+     */
2244
+    public function set_phone( $value ) {
2245
+        $this->set_prop( 'phone', $value );
2216 2246
     }
2217 2247
 
2218 2248
     /**
2219
-	 * Alias of self::set_last_name().
2220
-	 *
2221
-	 * @since 1.0.19
2222
-	 * @param  string $value last name.
2223
-	 */
2224
-	public function set_user_last_name( $value ) {
2225
-		$this->set_last_name( $value );
2249
+     * Alias of self::set_phone().
2250
+     *
2251
+     * @since 1.0.19
2252
+     * @param  string $value phone.
2253
+     */
2254
+    public function set_user_phone( $value ) {
2255
+        $this->set_phone( $value );
2226 2256
     }
2227 2257
 
2228 2258
     /**
2229
-	 * Alias of self::set_last_name().
2230
-	 *
2231
-	 * @since 1.0.19
2232
-	 * @param  string $value last name.
2233
-	 */
2234
-	public function set_customer_last_name( $value ) {
2235
-		$this->set_last_name( $value );
2259
+     * Alias of self::set_phone().
2260
+     *
2261
+     * @since 1.0.19
2262
+     * @param  string $value phone.
2263
+     */
2264
+    public function set_customer_phone( $value ) {
2265
+        $this->set_phone( $value );
2236 2266
     }
2237 2267
 
2238 2268
     /**
2239
-	 * Set the customer's phone number.
2240
-	 *
2241
-	 * @since 1.0.19
2242
-	 * @param  string $value phone.
2243
-	 */
2244
-	public function set_phone( $value ) {
2245
-		$this->set_prop( 'phone', $value );
2269
+     * Alias of self::set_phone().
2270
+     *
2271
+     * @since 1.0.19
2272
+     * @param  string $value phone.
2273
+     */
2274
+    public function set_phone_number( $value ) {
2275
+        $this->set_phone( $value );
2246 2276
     }
2247 2277
 
2248 2278
     /**
2249
-	 * Alias of self::set_phone().
2250
-	 *
2251
-	 * @since 1.0.19
2252
-	 * @param  string $value phone.
2253
-	 */
2254
-	public function set_user_phone( $value ) {
2255
-		$this->set_phone( $value );
2279
+     * Set the customer's email address.
2280
+     *
2281
+     * @since 1.0.19
2282
+     * @param  string $value email address.
2283
+     */
2284
+    public function set_email( $value ) {
2285
+        $this->set_prop( 'email', $value );
2256 2286
     }
2257 2287
 
2258 2288
     /**
2259
-	 * Alias of self::set_phone().
2260
-	 *
2261
-	 * @since 1.0.19
2262
-	 * @param  string $value phone.
2263
-	 */
2264
-	public function set_customer_phone( $value ) {
2265
-		$this->set_phone( $value );
2289
+     * Alias of self::set_email().
2290
+     *
2291
+     * @since 1.0.19
2292
+     * @param  string $value email address.
2293
+     */
2294
+    public function set_user_email( $value ) {
2295
+        $this->set_email( $value );
2266 2296
     }
2267 2297
 
2268 2298
     /**
2269
-	 * Alias of self::set_phone().
2270
-	 *
2271
-	 * @since 1.0.19
2272
-	 * @param  string $value phone.
2273
-	 */
2274
-	public function set_phone_number( $value ) {
2275
-		$this->set_phone( $value );
2299
+     * Alias of self::set_email().
2300
+     *
2301
+     * @since 1.0.19
2302
+     * @param  string $value email address.
2303
+     */
2304
+    public function set_email_address( $value ) {
2305
+        $this->set_email( $value );
2276 2306
     }
2277 2307
 
2278 2308
     /**
2279
-	 * Set the customer's email address.
2280
-	 *
2281
-	 * @since 1.0.19
2282
-	 * @param  string $value email address.
2283
-	 */
2284
-	public function set_email( $value ) {
2285
-		$this->set_prop( 'email', $value );
2309
+     * Alias of self::set_email().
2310
+     *
2311
+     * @since 1.0.19
2312
+     * @param  string $value email address.
2313
+     */
2314
+    public function set_customer_email( $value ) {
2315
+        $this->set_email( $value );
2286 2316
     }
2287 2317
 
2288 2318
     /**
2289
-	 * Alias of self::set_email().
2290
-	 *
2291
-	 * @since 1.0.19
2292
-	 * @param  string $value email address.
2293
-	 */
2294
-	public function set_user_email( $value ) {
2295
-		$this->set_email( $value );
2319
+     * Set the customer's country.
2320
+     *
2321
+     * @since 1.0.19
2322
+     * @param  string $value country.
2323
+     */
2324
+    public function set_country( $value ) {
2325
+        $this->set_prop( 'country', $value );
2296 2326
     }
2297 2327
 
2298 2328
     /**
2299
-	 * Alias of self::set_email().
2300
-	 *
2301
-	 * @since 1.0.19
2302
-	 * @param  string $value email address.
2303
-	 */
2304
-	public function set_email_address( $value ) {
2305
-		$this->set_email( $value );
2329
+     * Alias of self::set_country().
2330
+     *
2331
+     * @since 1.0.19
2332
+     * @param  string $value country.
2333
+     */
2334
+    public function set_user_country( $value ) {
2335
+        $this->set_country( $value );
2306 2336
     }
2307 2337
 
2308 2338
     /**
2309
-	 * Alias of self::set_email().
2310
-	 *
2311
-	 * @since 1.0.19
2312
-	 * @param  string $value email address.
2313
-	 */
2314
-	public function set_customer_email( $value ) {
2315
-		$this->set_email( $value );
2339
+     * Alias of self::set_country().
2340
+     *
2341
+     * @since 1.0.19
2342
+     * @param  string $value country.
2343
+     */
2344
+    public function set_customer_country( $value ) {
2345
+        $this->set_country( $value );
2316 2346
     }
2317 2347
 
2318 2348
     /**
2319
-	 * Set the customer's country.
2320
-	 *
2321
-	 * @since 1.0.19
2322
-	 * @param  string $value country.
2323
-	 */
2324
-	public function set_country( $value ) {
2325
-		$this->set_prop( 'country', $value );
2349
+     * Set the customer's state.
2350
+     *
2351
+     * @since 1.0.19
2352
+     * @param  string $value state.
2353
+     */
2354
+    public function set_state( $value ) {
2355
+        $this->set_prop( 'state', $value );
2326 2356
     }
2327 2357
 
2328 2358
     /**
2329
-	 * Alias of self::set_country().
2330
-	 *
2331
-	 * @since 1.0.19
2332
-	 * @param  string $value country.
2333
-	 */
2334
-	public function set_user_country( $value ) {
2335
-		$this->set_country( $value );
2359
+     * Alias of self::set_state().
2360
+     *
2361
+     * @since 1.0.19
2362
+     * @param  string $value state.
2363
+     */
2364
+    public function set_user_state( $value ) {
2365
+        $this->set_state( $value );
2336 2366
     }
2337 2367
 
2338 2368
     /**
2339
-	 * Alias of self::set_country().
2340
-	 *
2341
-	 * @since 1.0.19
2342
-	 * @param  string $value country.
2343
-	 */
2344
-	public function set_customer_country( $value ) {
2345
-		$this->set_country( $value );
2369
+     * Alias of self::set_state().
2370
+     *
2371
+     * @since 1.0.19
2372
+     * @param  string $value state.
2373
+     */
2374
+    public function set_customer_state( $value ) {
2375
+        $this->set_state( $value );
2346 2376
     }
2347 2377
 
2348 2378
     /**
2349
-	 * Set the customer's state.
2350
-	 *
2351
-	 * @since 1.0.19
2352
-	 * @param  string $value state.
2353
-	 */
2354
-	public function set_state( $value ) {
2355
-		$this->set_prop( 'state', $value );
2379
+     * Set the customer's city.
2380
+     *
2381
+     * @since 1.0.19
2382
+     * @param  string $value city.
2383
+     */
2384
+    public function set_city( $value ) {
2385
+        $this->set_prop( 'city', $value );
2356 2386
     }
2357 2387
 
2358 2388
     /**
2359
-	 * Alias of self::set_state().
2360
-	 *
2361
-	 * @since 1.0.19
2362
-	 * @param  string $value state.
2363
-	 */
2364
-	public function set_user_state( $value ) {
2365
-		$this->set_state( $value );
2389
+     * Alias of self::set_city().
2390
+     *
2391
+     * @since 1.0.19
2392
+     * @param  string $value city.
2393
+     */
2394
+    public function set_user_city( $value ) {
2395
+        $this->set_city( $value );
2366 2396
     }
2367 2397
 
2368 2398
     /**
2369
-	 * Alias of self::set_state().
2370
-	 *
2371
-	 * @since 1.0.19
2372
-	 * @param  string $value state.
2373
-	 */
2374
-	public function set_customer_state( $value ) {
2375
-		$this->set_state( $value );
2399
+     * Alias of self::set_city().
2400
+     *
2401
+     * @since 1.0.19
2402
+     * @param  string $value city.
2403
+     */
2404
+    public function set_customer_city( $value ) {
2405
+        $this->set_city( $value );
2376 2406
     }
2377 2407
 
2378 2408
     /**
2379
-	 * Set the customer's city.
2380
-	 *
2381
-	 * @since 1.0.19
2382
-	 * @param  string $value city.
2383
-	 */
2384
-	public function set_city( $value ) {
2385
-		$this->set_prop( 'city', $value );
2409
+     * Set the customer's zip code.
2410
+     *
2411
+     * @since 1.0.19
2412
+     * @param  string $value zip.
2413
+     */
2414
+    public function set_zip( $value ) {
2415
+        $this->set_prop( 'zip', $value );
2386 2416
     }
2387 2417
 
2388 2418
     /**
2389
-	 * Alias of self::set_city().
2390
-	 *
2391
-	 * @since 1.0.19
2392
-	 * @param  string $value city.
2393
-	 */
2394
-	public function set_user_city( $value ) {
2395
-		$this->set_city( $value );
2419
+     * Alias of self::set_zip().
2420
+     *
2421
+     * @since 1.0.19
2422
+     * @param  string $value zip.
2423
+     */
2424
+    public function set_user_zip( $value ) {
2425
+        $this->set_zip( $value );
2396 2426
     }
2397 2427
 
2398 2428
     /**
2399
-	 * Alias of self::set_city().
2400
-	 *
2401
-	 * @since 1.0.19
2402
-	 * @param  string $value city.
2403
-	 */
2404
-	public function set_customer_city( $value ) {
2405
-		$this->set_city( $value );
2429
+     * Alias of self::set_zip().
2430
+     *
2431
+     * @since 1.0.19
2432
+     * @param  string $value zip.
2433
+     */
2434
+    public function set_customer_zip( $value ) {
2435
+        $this->set_zip( $value );
2406 2436
     }
2407 2437
 
2408 2438
     /**
2409
-	 * Set the customer's zip code.
2410
-	 *
2411
-	 * @since 1.0.19
2412
-	 * @param  string $value zip.
2413
-	 */
2414
-	public function set_zip( $value ) {
2415
-		$this->set_prop( 'zip', $value );
2439
+     * Set the customer's company.
2440
+     *
2441
+     * @since 1.0.19
2442
+     * @param  string $value company.
2443
+     */
2444
+    public function set_company( $value ) {
2445
+        $this->set_prop( 'company', $value );
2416 2446
     }
2417 2447
 
2418 2448
     /**
2419
-	 * Alias of self::set_zip().
2420
-	 *
2421
-	 * @since 1.0.19
2422
-	 * @param  string $value zip.
2423
-	 */
2424
-	public function set_user_zip( $value ) {
2425
-		$this->set_zip( $value );
2449
+     * Alias of self::set_company().
2450
+     *
2451
+     * @since 1.0.19
2452
+     * @param  string $value company.
2453
+     */
2454
+    public function set_user_company( $value ) {
2455
+        $this->set_company( $value );
2426 2456
     }
2427 2457
 
2428 2458
     /**
2429
-	 * Alias of self::set_zip().
2430
-	 *
2431
-	 * @since 1.0.19
2432
-	 * @param  string $value zip.
2433
-	 */
2434
-	public function set_customer_zip( $value ) {
2435
-		$this->set_zip( $value );
2459
+     * Alias of self::set_company().
2460
+     *
2461
+     * @since 1.0.19
2462
+     * @param  string $value company.
2463
+     */
2464
+    public function set_customer_company( $value ) {
2465
+        $this->set_company( $value );
2436 2466
     }
2437 2467
 
2438 2468
     /**
2439
-	 * Set the customer's company.
2440
-	 *
2441
-	 * @since 1.0.19
2442
-	 * @param  string $value company.
2443
-	 */
2444
-	public function set_company( $value ) {
2445
-		$this->set_prop( 'company', $value );
2469
+     * Set the customer's var number.
2470
+     *
2471
+     * @since 1.0.19
2472
+     * @param  string $value var number.
2473
+     */
2474
+    public function set_vat_number( $value ) {
2475
+        $this->set_prop( 'vat_number', $value );
2446 2476
     }
2447 2477
 
2448 2478
     /**
2449
-	 * Alias of self::set_company().
2450
-	 *
2451
-	 * @since 1.0.19
2452
-	 * @param  string $value company.
2453
-	 */
2454
-	public function set_user_company( $value ) {
2455
-		$this->set_company( $value );
2479
+     * Alias of self::set_vat_number().
2480
+     *
2481
+     * @since 1.0.19
2482
+     * @param  string $value var number.
2483
+     */
2484
+    public function set_user_vat_number( $value ) {
2485
+        $this->set_vat_number( $value );
2456 2486
     }
2457 2487
 
2458 2488
     /**
2459
-	 * Alias of self::set_company().
2460
-	 *
2461
-	 * @since 1.0.19
2462
-	 * @param  string $value company.
2463
-	 */
2464
-	public function set_customer_company( $value ) {
2465
-		$this->set_company( $value );
2489
+     * Alias of self::set_vat_number().
2490
+     *
2491
+     * @since 1.0.19
2492
+     * @param  string $value var number.
2493
+     */
2494
+    public function set_customer_vat_number( $value ) {
2495
+        $this->set_vat_number( $value );
2466 2496
     }
2467 2497
 
2468 2498
     /**
2469
-	 * Set the customer's var number.
2470
-	 *
2471
-	 * @since 1.0.19
2472
-	 * @param  string $value var number.
2473
-	 */
2474
-	public function set_vat_number( $value ) {
2475
-		$this->set_prop( 'vat_number', $value );
2499
+     * Set the customer's vat rate.
2500
+     *
2501
+     * @since 1.0.19
2502
+     * @param  string $value var rate.
2503
+     */
2504
+    public function set_vat_rate( $value ) {
2505
+        $this->set_prop( 'vat_rate', $value );
2476 2506
     }
2477 2507
 
2478 2508
     /**
2479
-	 * Alias of self::set_vat_number().
2480
-	 *
2481
-	 * @since 1.0.19
2482
-	 * @param  string $value var number.
2483
-	 */
2484
-	public function set_user_vat_number( $value ) {
2485
-		$this->set_vat_number( $value );
2509
+     * Alias of self::set_vat_rate().
2510
+     *
2511
+     * @since 1.0.19
2512
+     * @param  string $value var number.
2513
+     */
2514
+    public function set_user_vat_rate( $value ) {
2515
+        $this->set_vat_rate( $value );
2486 2516
     }
2487 2517
 
2488 2518
     /**
2489
-	 * Alias of self::set_vat_number().
2490
-	 *
2491
-	 * @since 1.0.19
2492
-	 * @param  string $value var number.
2493
-	 */
2494
-	public function set_customer_vat_number( $value ) {
2495
-		$this->set_vat_number( $value );
2519
+     * Alias of self::set_vat_rate().
2520
+     *
2521
+     * @since 1.0.19
2522
+     * @param  string $value var number.
2523
+     */
2524
+    public function set_customer_vat_rate( $value ) {
2525
+        $this->set_vat_rate( $value );
2496 2526
     }
2497 2527
 
2498 2528
     /**
2499
-	 * Set the customer's vat rate.
2500
-	 *
2501
-	 * @since 1.0.19
2502
-	 * @param  string $value var rate.
2503
-	 */
2504
-	public function set_vat_rate( $value ) {
2505
-		$this->set_prop( 'vat_rate', $value );
2529
+     * Set the customer's address.
2530
+     *
2531
+     * @since 1.0.19
2532
+     * @param  string $value address.
2533
+     */
2534
+    public function set_address( $value ) {
2535
+        $this->set_prop( 'address', $value );
2506 2536
     }
2507 2537
 
2508 2538
     /**
2509
-	 * Alias of self::set_vat_rate().
2510
-	 *
2511
-	 * @since 1.0.19
2512
-	 * @param  string $value var number.
2513
-	 */
2514
-	public function set_user_vat_rate( $value ) {
2515
-		$this->set_vat_rate( $value );
2539
+     * Alias of self::set_address().
2540
+     *
2541
+     * @since 1.0.19
2542
+     * @param  string $value address.
2543
+     */
2544
+    public function set_user_address( $value ) {
2545
+        $this->set_address( $value );
2516 2546
     }
2517 2547
 
2518 2548
     /**
2519
-	 * Alias of self::set_vat_rate().
2520
-	 *
2521
-	 * @since 1.0.19
2522
-	 * @param  string $value var number.
2523
-	 */
2524
-	public function set_customer_vat_rate( $value ) {
2525
-		$this->set_vat_rate( $value );
2549
+     * Alias of self::set_address().
2550
+     *
2551
+     * @since 1.0.19
2552
+     * @param  string $value address.
2553
+     */
2554
+    public function set_customer_address( $value ) {
2555
+        $this->set_address( $value );
2526 2556
     }
2527 2557
 
2528 2558
     /**
2529
-	 * Set the customer's address.
2530
-	 *
2531
-	 * @since 1.0.19
2532
-	 * @param  string $value address.
2533
-	 */
2534
-	public function set_address( $value ) {
2535
-		$this->set_prop( 'address', $value );
2559
+     * Set whether the customer has viewed the invoice or not.
2560
+     *
2561
+     * @since 1.0.19
2562
+     * @param  int|bool $value confirmed.
2563
+     */
2564
+    public function set_is_viewed( $value ) {
2565
+        $this->set_prop( 'is_viewed', $value );
2536 2566
     }
2537 2567
 
2538 2568
     /**
2539
-	 * Alias of self::set_address().
2540
-	 *
2541
-	 * @since 1.0.19
2542
-	 * @param  string $value address.
2543
-	 */
2544
-	public function set_user_address( $value ) {
2545
-		$this->set_address( $value );
2569
+     * Set extra email recipients.
2570
+     *
2571
+     * @since 1.0.19
2572
+     * @param  string $value email recipients.
2573
+     */
2574
+    public function set_email_cc( $value ) {
2575
+        $this->set_prop( 'email_cc', $value );
2546 2576
     }
2547 2577
 
2548 2578
     /**
2549
-	 * Alias of self::set_address().
2550
-	 *
2551
-	 * @since 1.0.19
2552
-	 * @param  string $value address.
2553
-	 */
2554
-	public function set_customer_address( $value ) {
2555
-		$this->set_address( $value );
2579
+     * Set the invoice template.
2580
+     *
2581
+     * @since 1.0.19
2582
+     * @param  string $value email recipients.
2583
+     */
2584
+    public function set_template( $value ) {
2585
+        if ( in_array( $value, array( 'quantity', 'hours', 'amount' ) ) ) {
2586
+            $this->set_prop( 'template', $value );
2587
+        }
2556 2588
     }
2557 2589
 
2558 2590
     /**
2559
-	 * Set whether the customer has viewed the invoice or not.
2560
-	 *
2561
-	 * @since 1.0.19
2562
-	 * @param  int|bool $value confirmed.
2563
-	 */
2564
-	public function set_is_viewed( $value ) {
2565
-		$this->set_prop( 'is_viewed', $value );
2566
-	}
2567
-
2568
-	/**
2569
-	 * Set extra email recipients.
2570
-	 *
2571
-	 * @since 1.0.19
2572
-	 * @param  string $value email recipients.
2573
-	 */
2574
-	public function set_email_cc( $value ) {
2575
-		$this->set_prop( 'email_cc', $value );
2576
-	}
2577
-
2578
-	/**
2579
-	 * Set the invoice template.
2580
-	 *
2581
-	 * @since 1.0.19
2582
-	 * @param  string $value email recipients.
2583
-	 */
2584
-	public function set_template( $value ) {
2585
-		if ( in_array( $value, array( 'quantity', 'hours', 'amount' ) ) ) {
2586
-			$this->set_prop( 'template', $value );
2587
-		}
2588
-	}
2589
-
2590
-	/**
2591
-	 * Set the customer's address confirmed status.
2592
-	 *
2593
-	 * @since 1.0.19
2594
-	 * @param  int|bool $value confirmed.
2595
-	 */
2596
-	public function set_address_confirmed( $value ) {
2597
-		$this->set_prop( 'address_confirmed', $value );
2591
+     * Set the customer's address confirmed status.
2592
+     *
2593
+     * @since 1.0.19
2594
+     * @param  int|bool $value confirmed.
2595
+     */
2596
+    public function set_address_confirmed( $value ) {
2597
+        $this->set_prop( 'address_confirmed', $value );
2598 2598
     }
2599 2599
 
2600 2600
     /**
2601
-	 * Alias of self::set_address_confirmed().
2602
-	 *
2603
-	 * @since 1.0.19
2604
-	 * @param  int|bool $value confirmed.
2605
-	 */
2606
-	public function set_user_address_confirmed( $value ) {
2607
-		$this->set_address_confirmed( $value );
2601
+     * Alias of self::set_address_confirmed().
2602
+     *
2603
+     * @since 1.0.19
2604
+     * @param  int|bool $value confirmed.
2605
+     */
2606
+    public function set_user_address_confirmed( $value ) {
2607
+        $this->set_address_confirmed( $value );
2608 2608
     }
2609 2609
 
2610 2610
     /**
2611
-	 * Alias of self::set_address_confirmed().
2612
-	 *
2613
-	 * @since 1.0.19
2614
-	 * @param  int|bool $value confirmed.
2615
-	 */
2616
-	public function set_customer_address_confirmed( $value ) {
2617
-		$this->set_address_confirmed( $value );
2611
+     * Alias of self::set_address_confirmed().
2612
+     *
2613
+     * @since 1.0.19
2614
+     * @param  int|bool $value confirmed.
2615
+     */
2616
+    public function set_customer_address_confirmed( $value ) {
2617
+        $this->set_address_confirmed( $value );
2618 2618
     }
2619 2619
 
2620 2620
     /**
2621
-	 * Set the invoice sub total.
2622
-	 *
2623
-	 * @since 1.0.19
2624
-	 * @param  float $value sub total.
2625
-	 */
2626
-	public function set_subtotal( $value ) {
2627
-		$this->set_prop( 'subtotal', $value );
2621
+     * Set the invoice sub total.
2622
+     *
2623
+     * @since 1.0.19
2624
+     * @param  float $value sub total.
2625
+     */
2626
+    public function set_subtotal( $value ) {
2627
+        $this->set_prop( 'subtotal', $value );
2628 2628
     }
2629 2629
 
2630 2630
     /**
2631
-	 * Set the invoice discount amount.
2632
-	 *
2633
-	 * @since 1.0.19
2634
-	 * @param  float $value discount total.
2635
-	 */
2636
-	public function set_total_discount( $value ) {
2637
-		$this->set_prop( 'total_discount', $value );
2631
+     * Set the invoice discount amount.
2632
+     *
2633
+     * @since 1.0.19
2634
+     * @param  float $value discount total.
2635
+     */
2636
+    public function set_total_discount( $value ) {
2637
+        $this->set_prop( 'total_discount', $value );
2638 2638
     }
2639 2639
 
2640 2640
     /**
2641
-	 * Alias of self::set_total_discount().
2642
-	 *
2643
-	 * @since 1.0.19
2644
-	 * @param  float $value discount total.
2645
-	 */
2646
-	public function set_discount( $value ) {
2647
-		$this->set_total_discount( $value );
2641
+     * Alias of self::set_total_discount().
2642
+     *
2643
+     * @since 1.0.19
2644
+     * @param  float $value discount total.
2645
+     */
2646
+    public function set_discount( $value ) {
2647
+        $this->set_total_discount( $value );
2648 2648
     }
2649 2649
 
2650 2650
     /**
2651
-	 * Set the invoice tax amount.
2652
-	 *
2653
-	 * @since 1.0.19
2654
-	 * @param  float $value tax total.
2655
-	 */
2656
-	public function set_total_tax( $value ) {
2657
-		$this->set_prop( 'total_tax', $value );
2651
+     * Set the invoice tax amount.
2652
+     *
2653
+     * @since 1.0.19
2654
+     * @param  float $value tax total.
2655
+     */
2656
+    public function set_total_tax( $value ) {
2657
+        $this->set_prop( 'total_tax', $value );
2658 2658
     }
2659 2659
 
2660 2660
     /**
2661
-	 * Alias of self::set_total_tax().
2662
-	 *
2663
-	 * @since 1.0.19
2664
-	 * @param  float $value tax total.
2665
-	 */
2666
-	public function set_tax_total( $value ) {
2667
-		$this->set_total_tax( $value );
2661
+     * Alias of self::set_total_tax().
2662
+     *
2663
+     * @since 1.0.19
2664
+     * @param  float $value tax total.
2665
+     */
2666
+    public function set_tax_total( $value ) {
2667
+        $this->set_total_tax( $value );
2668 2668
     }
2669 2669
 
2670 2670
     /**
2671
-	 * Set the invoice fees amount.
2672
-	 *
2673
-	 * @since 1.0.19
2674
-	 * @param  float $value fees total.
2675
-	 */
2676
-	public function set_total_fees( $value ) {
2677
-		$this->set_prop( 'total_fees', $value );
2671
+     * Set the invoice fees amount.
2672
+     *
2673
+     * @since 1.0.19
2674
+     * @param  float $value fees total.
2675
+     */
2676
+    public function set_total_fees( $value ) {
2677
+        $this->set_prop( 'total_fees', $value );
2678 2678
     }
2679 2679
 
2680 2680
     /**
2681
-	 * Alias of self::set_total_fees().
2682
-	 *
2683
-	 * @since 1.0.19
2684
-	 * @param  float $value fees total.
2685
-	 */
2686
-	public function set_fees_total( $value ) {
2687
-		$this->set_total_fees( $value );
2681
+     * Alias of self::set_total_fees().
2682
+     *
2683
+     * @since 1.0.19
2684
+     * @param  float $value fees total.
2685
+     */
2686
+    public function set_fees_total( $value ) {
2687
+        $this->set_total_fees( $value );
2688 2688
     }
2689 2689
 
2690 2690
     /**
2691
-	 * Set the invoice fees.
2692
-	 *
2693
-	 * @since 1.0.19
2694
-	 * @param  array $value fees.
2695
-	 */
2696
-	public function set_fees( $value ) {
2691
+     * Set the invoice fees.
2692
+     *
2693
+     * @since 1.0.19
2694
+     * @param  array $value fees.
2695
+     */
2696
+    public function set_fees( $value ) {
2697 2697
 
2698 2698
         $this->set_prop( 'fees', array() );
2699 2699
 
@@ -2711,23 +2711,23 @@  discard block
 block discarded – undo
2711 2711
     }
2712 2712
 
2713 2713
     /**
2714
-	 * Set the invoice taxes.
2715
-	 *
2716
-	 * @since 1.0.19
2717
-	 * @param  array $value taxes.
2718
-	 */
2719
-	public function set_taxes( $value ) {
2720
-		$this->set_prop( 'taxes', $value );
2714
+     * Set the invoice taxes.
2715
+     *
2716
+     * @since 1.0.19
2717
+     * @param  array $value taxes.
2718
+     */
2719
+    public function set_taxes( $value ) {
2720
+        $this->set_prop( 'taxes', $value );
2721 2721
     }
2722 2722
 
2723 2723
     /**
2724
-	 * Set the invoice discounts.
2725
-	 *
2726
-	 * @since 1.0.19
2727
-	 * @param  array $value discounts.
2728
-	 */
2729
-	public function set_discounts( $value ) {
2730
-		$this->set_prop( 'discounts', array() );
2724
+     * Set the invoice discounts.
2725
+     *
2726
+     * @since 1.0.19
2727
+     * @param  array $value discounts.
2728
+     */
2729
+    public function set_discounts( $value ) {
2730
+        $this->set_prop( 'discounts', array() );
2731 2731
 
2732 2732
         // Ensure that we have an array.
2733 2733
         if ( ! is_array( $value ) ) {
@@ -2742,12 +2742,12 @@  discard block
 block discarded – undo
2742 2742
     }
2743 2743
 
2744 2744
     /**
2745
-	 * Set the invoice items.
2746
-	 *
2747
-	 * @since 1.0.19
2748
-	 * @param  GetPaid_Form_Item[] $value items.
2749
-	 */
2750
-	public function set_items( $value ) {
2745
+     * Set the invoice items.
2746
+     *
2747
+     * @since 1.0.19
2748
+     * @param  GetPaid_Form_Item[] $value items.
2749
+     */
2750
+    public function set_items( $value ) {
2751 2751
 
2752 2752
         // Remove existing items.
2753 2753
         $this->set_prop( 'items', array() );
@@ -2764,83 +2764,83 @@  discard block
 block discarded – undo
2764 2764
     }
2765 2765
 
2766 2766
     /**
2767
-	 * Set the payment form.
2768
-	 *
2769
-	 * @since 1.0.19
2770
-	 * @param  int $value payment form.
2771
-	 */
2772
-	public function set_payment_form( $value ) {
2773
-		$this->set_prop( 'payment_form', $value );
2767
+     * Set the payment form.
2768
+     *
2769
+     * @since 1.0.19
2770
+     * @param  int $value payment form.
2771
+     */
2772
+    public function set_payment_form( $value ) {
2773
+        $this->set_prop( 'payment_form', $value );
2774 2774
     }
2775 2775
 
2776 2776
     /**
2777
-	 * Set the submission id.
2778
-	 *
2779
-	 * @since 1.0.19
2780
-	 * @param  string $value submission id.
2781
-	 */
2782
-	public function set_submission_id( $value ) {
2783
-		$this->set_prop( 'submission_id', $value );
2777
+     * Set the submission id.
2778
+     *
2779
+     * @since 1.0.19
2780
+     * @param  string $value submission id.
2781
+     */
2782
+    public function set_submission_id( $value ) {
2783
+        $this->set_prop( 'submission_id', $value );
2784 2784
     }
2785 2785
 
2786 2786
     /**
2787
-	 * Set the discount code.
2788
-	 *
2789
-	 * @since 1.0.19
2790
-	 * @param  string $value discount code.
2791
-	 */
2792
-	public function set_discount_code( $value ) {
2793
-		$this->set_prop( 'discount_code', $value );
2787
+     * Set the discount code.
2788
+     *
2789
+     * @since 1.0.19
2790
+     * @param  string $value discount code.
2791
+     */
2792
+    public function set_discount_code( $value ) {
2793
+        $this->set_prop( 'discount_code', $value );
2794 2794
     }
2795 2795
 
2796 2796
     /**
2797
-	 * Set the gateway.
2798
-	 *
2799
-	 * @since 1.0.19
2800
-	 * @param  string $value gateway.
2801
-	 */
2802
-	public function set_gateway( $value ) {
2803
-		$this->set_prop( 'gateway', $value );
2797
+     * Set the gateway.
2798
+     *
2799
+     * @since 1.0.19
2800
+     * @param  string $value gateway.
2801
+     */
2802
+    public function set_gateway( $value ) {
2803
+        $this->set_prop( 'gateway', $value );
2804 2804
     }
2805 2805
 
2806 2806
     /**
2807
-	 * Set the transaction id.
2808
-	 *
2809
-	 * @since 1.0.19
2810
-	 * @param  string $value transaction id.
2811
-	 */
2812
-	public function set_transaction_id( $value ) {
2813
-		$this->set_prop( 'transaction_id', $value );
2807
+     * Set the transaction id.
2808
+     *
2809
+     * @since 1.0.19
2810
+     * @param  string $value transaction id.
2811
+     */
2812
+    public function set_transaction_id( $value ) {
2813
+        $this->set_prop( 'transaction_id', $value );
2814 2814
     }
2815 2815
 
2816 2816
     /**
2817
-	 * Set the currency id.
2818
-	 *
2819
-	 * @since 1.0.19
2820
-	 * @param  string $value currency id.
2821
-	 */
2822
-	public function set_currency( $value ) {
2823
-		$this->set_prop( 'currency', $value );
2817
+     * Set the currency id.
2818
+     *
2819
+     * @since 1.0.19
2820
+     * @param  string $value currency id.
2821
+     */
2822
+    public function set_currency( $value ) {
2823
+        $this->set_prop( 'currency', $value );
2824 2824
     }
2825 2825
 
2826
-	/**
2827
-	 * Set whether to disable taxes.
2828
-	 *
2829
-	 * @since 1.0.19
2830
-	 * @param  bool $value value.
2831
-	 */
2832
-	public function set_disable_taxes( $value ) {
2833
-		$this->set_prop( 'disable_taxes', (bool) $value );
2834
-	}
2826
+    /**
2827
+     * Set whether to disable taxes.
2828
+     *
2829
+     * @since 1.0.19
2830
+     * @param  bool $value value.
2831
+     */
2832
+    public function set_disable_taxes( $value ) {
2833
+        $this->set_prop( 'disable_taxes', (bool) $value );
2834
+    }
2835 2835
 
2836 2836
     /**
2837
-	 * Set the subscription id.
2838
-	 *
2839
-	 * @since 1.0.19
2840
-	 * @param  string $value subscription id.
2841
-	 */
2842
-	public function set_subscription_id( $value ) {
2843
-		$this->set_prop( 'subscription_id', $value );
2837
+     * Set the subscription id.
2838
+     *
2839
+     * @since 1.0.19
2840
+     * @param  string $value subscription id.
2841
+     */
2842
+    public function set_subscription_id( $value ) {
2843
+        $this->set_prop( 'subscription_id', $value );
2844 2844
     }
2845 2845
 
2846 2846
     /*
@@ -2879,12 +2879,12 @@  discard block
 block discarded – undo
2879 2879
      */
2880 2880
     public function is_taxable() {
2881 2881
         return $this->get_disable_taxes();
2882
-	}
2882
+    }
2883 2883
 
2884
-	/**
2885
-	 * @deprecated
2886
-	 */
2887
-	public function has_vat() {
2884
+    /**
2885
+     * @deprecated
2886
+     */
2887
+    public function has_vat() {
2888 2888
         global $wpinv_euvat, $wpi_country;
2889 2889
 
2890 2890
         $requires_vat = false;
@@ -2895,17 +2895,17 @@  discard block
 block discarded – undo
2895 2895
         }
2896 2896
 
2897 2897
         return apply_filters( 'wpinv_invoice_has_vat', $requires_vat, $this );
2898
-	}
2898
+    }
2899 2899
 
2900
-	/**
2901
-	 * Checks to see if the invoice requires payment.
2902
-	 */
2903
-	public function is_free() {
2900
+    /**
2901
+     * Checks to see if the invoice requires payment.
2902
+     */
2903
+    public function is_free() {
2904 2904
         $is_free = ! ( (float) wpinv_round_amount( $this->get_initial_total() ) > 0 );
2905 2905
 
2906
-		if ( $is_free && $this->is_recurring() ) {
2907
-			$is_free = ! ( (float) wpinv_round_amount( $this->get_recurring_total() ) > 0 );
2908
-		}
2906
+        if ( $is_free && $this->is_recurring() ) {
2907
+            $is_free = ! ( (float) wpinv_round_amount( $this->get_recurring_total() ) > 0 );
2908
+        }
2909 2909
 
2910 2910
         return apply_filters( 'wpinv_invoice_is_free', $is_free, $this );
2911 2911
     }
@@ -2916,38 +2916,38 @@  discard block
 block discarded – undo
2916 2916
     public function is_paid() {
2917 2917
         $is_paid = $this->has_status( array( 'publish', 'wpi-processing', 'wpi-renewal' ) );
2918 2918
         return apply_filters( 'wpinv_invoice_is_paid', $is_paid, $this );
2919
-	}
2919
+    }
2920 2920
 
2921
-	/**
2921
+    /**
2922 2922
      * Checks if the invoice needs payment.
2923 2923
      */
2924
-	public function needs_payment() {
2925
-		$needs_payment = ! $this->is_paid() && ! $this->is_refunded() && ! $this->is_free();
2924
+    public function needs_payment() {
2925
+        $needs_payment = ! $this->is_paid() && ! $this->is_refunded() && ! $this->is_free();
2926 2926
         return apply_filters( 'wpinv_needs_payment', $needs_payment, $this );
2927 2927
     }
2928 2928
 
2929
-	/**
2929
+    /**
2930 2930
      * Checks if the invoice is refunded.
2931 2931
      */
2932
-	public function is_refunded() {
2932
+    public function is_refunded() {
2933 2933
         $is_refunded = $this->has_status( 'wpi-refunded' );
2934 2934
         return apply_filters( 'wpinv_invoice_is_refunded', $is_refunded, $this );
2935
-	}
2935
+    }
2936 2936
 
2937
-	/**
2937
+    /**
2938 2938
      * Checks if the invoice is due.
2939 2939
      */
2940
-	public function is_due() {
2941
-		$due_date = $this->get_due_date();
2942
-		return empty( $due_date ) ? false : current_time( 'timestamp' ) > strtotime( $due_date );
2943
-	}
2940
+    public function is_due() {
2941
+        $due_date = $this->get_due_date();
2942
+        return empty( $due_date ) ? false : current_time( 'timestamp' ) > strtotime( $due_date );
2943
+    }
2944 2944
 
2945
-	/**
2945
+    /**
2946 2946
      * Checks if the invoice is draft.
2947 2947
      */
2948
-	public function is_draft() {
2948
+    public function is_draft() {
2949 2949
         return $this->has_status( 'draft, auto-draft' );
2950
-	}
2950
+    }
2951 2951
 
2952 2952
     /**
2953 2953
      * Checks if the invoice has a given status.
@@ -2955,9 +2955,9 @@  discard block
 block discarded – undo
2955 2955
     public function has_status( $status ) {
2956 2956
         $status = wpinv_parse_list( $status );
2957 2957
         return apply_filters( 'wpinv_has_status', in_array( $this->get_status(), $status ), $status );
2958
-	}
2958
+    }
2959 2959
 
2960
-	/**
2960
+    /**
2961 2961
      * Checks if the invoice is of a given type.
2962 2962
      */
2963 2963
     public function is_type( $type ) {
@@ -2980,25 +2980,25 @@  discard block
 block discarded – undo
2980 2980
      */
2981 2981
     public function has_free_trial() {
2982 2982
         return $this->is_recurring() && 0 == $this->get_initial_total();
2983
-	}
2983
+    }
2984 2984
 
2985
-	/**
2985
+    /**
2986 2986
      * @deprecated
2987 2987
      */
2988 2988
     public function is_free_trial() {
2989 2989
         $this->has_free_trial();
2990 2990
     }
2991 2991
 
2992
-	/**
2992
+    /**
2993 2993
      * Check if the initial payment if 0.
2994 2994
      *
2995 2995
      */
2996
-	public function is_initial_free() {
2996
+    public function is_initial_free() {
2997 2997
         $is_initial_free = ! ( (float) wpinv_round_amount( $this->get_initial_total() ) > 0 );
2998 2998
         return apply_filters( 'wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this );
2999 2999
     }
3000 3000
 	
3001
-	/**
3001
+    /**
3002 3002
      * Check if the recurring item has a free trial.
3003 3003
      *
3004 3004
      */
@@ -3011,21 +3011,21 @@  discard block
 block discarded – undo
3011 3011
 
3012 3012
         $item = new WPInv_Item( $this->recurring_item );
3013 3013
         return $item->has_free_trial();
3014
-	}
3014
+    }
3015 3015
 
3016
-	/**
3016
+    /**
3017 3017
      * Check if the free trial is a result of a discount.
3018 3018
      */
3019 3019
     public function is_free_trial_from_discount() {
3020
-		return $this->has_free_trial() && ! $this->item_has_free_trial();
3021
-	}
3020
+        return $this->has_free_trial() && ! $this->item_has_free_trial();
3021
+    }
3022 3022
 	
3023
-	/**
3023
+    /**
3024 3024
      * @deprecated
3025 3025
      */
3026 3026
     public function discount_first_payment_only() {
3027 3027
 
3028
-		$discount_code = $this->get_discount_code();
3028
+        $discount_code = $this->get_discount_code();
3029 3029
         if ( empty( $this->discount_code ) || ! $this->is_recurring() ) {
3030 3030
             return true;
3031 3031
         }
@@ -3057,19 +3057,19 @@  discard block
 block discarded – undo
3057 3057
     public function add_item( $item ) {
3058 3058
 
3059 3059
         // Make sure that it is available for purchase.
3060
-		if ( $item->get_id() > 0 && ! $item->can_purchase() ) {
3061
-			return new WP_Error( 'invalid_item', __( 'This item is not available for purchase', 'invoicing' ) );
3060
+        if ( $item->get_id() > 0 && ! $item->can_purchase() ) {
3061
+            return new WP_Error( 'invalid_item', __( 'This item is not available for purchase', 'invoicing' ) );
3062 3062
         }
3063 3063
 
3064 3064
         // Do we have a recurring item?
3065
-		if ( $item->is_recurring() ) {
3065
+        if ( $item->is_recurring() ) {
3066 3066
 
3067
-			// An invoice can only contain one recurring item.
3068
-			if ( ! empty( $this->recurring_item ) ) {
3069
-				return false;
3070
-			}
3067
+            // An invoice can only contain one recurring item.
3068
+            if ( ! empty( $this->recurring_item ) ) {
3069
+                return false;
3070
+            }
3071 3071
 
3072
-			$this->recurring_item = $item->get_id();
3072
+            $this->recurring_item = $item->get_id();
3073 3073
         }
3074 3074
 
3075 3075
         // Invoice id.
@@ -3080,25 +3080,25 @@  discard block
 block discarded – undo
3080 3080
         $items[ $item->get_id() ] = $item;
3081 3081
 
3082 3082
         $this->set_prop( 'items', $items );
3083
-		return true;
3083
+        return true;
3084 3084
     }
3085 3085
 
3086 3086
     /**
3087
-	 * Retrieves a specific item.
3088
-	 *
3089
-	 * @since 1.0.19
3090
-	 */
3091
-	public function get_item( $item_id ) {
3087
+     * Retrieves a specific item.
3088
+     *
3089
+     * @since 1.0.19
3090
+     */
3091
+    public function get_item( $item_id ) {
3092 3092
         $items = $this->get_items();
3093
-		return ( ! empty( $item_id ) && isset( $items[ $item_id ] ) ) ? $items[ $item_id ] : null;
3093
+        return ( ! empty( $item_id ) && isset( $items[ $item_id ] ) ) ? $items[ $item_id ] : null;
3094 3094
     }
3095 3095
 
3096 3096
     /**
3097
-	 * Removes a specific item.
3098
-	 *
3099
-	 * @since 1.0.19
3100
-	 */
3101
-	public function remove_item( $item_id ) {
3097
+     * Removes a specific item.
3098
+     *
3099
+     * @since 1.0.19
3100
+     */
3101
+    public function remove_item( $item_id ) {
3102 3102
         $items = $this->get_items();
3103 3103
 
3104 3104
         if ( $item_id == $this->recurring_item ) {
@@ -3126,38 +3126,38 @@  discard block
 block discarded – undo
3126 3126
         if ( isset( $fees[ $fee ] ) && isset( $fees[ $fee ]['amount'] ) ) {
3127 3127
 
3128 3128
             $amount = $fees[ $fee ]['amount'] += $amount;
3129
-			$fees[ $fee ] = array(
3129
+            $fees[ $fee ] = array(
3130 3130
                 'amount'    => $amount,
3131 3131
                 'recurring' => (bool) $recurring,
3132 3132
             );
3133 3133
 
3134
-		} else {
3135
-			$fees[ $fee ] = array(
3134
+        } else {
3135
+            $fees[ $fee ] = array(
3136 3136
                 'amount'    => $amount,
3137 3137
                 'recurring' => (bool) $recurring,
3138 3138
             );
3139
-		}
3139
+        }
3140 3140
 
3141 3141
         $this->set_prop( 'fees', $fee );
3142 3142
 
3143 3143
     }
3144 3144
 
3145 3145
     /**
3146
-	 * Retrieves a specific fee.
3147
-	 *
3148
-	 * @since 1.0.19
3149
-	 */
3150
-	public function get_fee( $fee ) {
3146
+     * Retrieves a specific fee.
3147
+     *
3148
+     * @since 1.0.19
3149
+     */
3150
+    public function get_fee( $fee ) {
3151 3151
         $fees = $this->get_fees();
3152
-		return isset( $fees[ $fee ] ) ? $fees[ $fee ] : null;
3152
+        return isset( $fees[ $fee ] ) ? $fees[ $fee ] : null;
3153 3153
     }
3154 3154
 
3155 3155
     /**
3156
-	 * Removes a specific fee.
3157
-	 *
3158
-	 * @since 1.0.19
3159
-	 */
3160
-	public function remove_fee( $fee ) {
3156
+     * Removes a specific fee.
3157
+     *
3158
+     * @since 1.0.19
3159
+     */
3160
+    public function remove_fee( $fee ) {
3161 3161
         $fees = $this->get_fees();
3162 3162
         if ( isset( $fees[ $fee ] ) ) {
3163 3163
             unset( $fees[ $fee ] );
@@ -3180,44 +3180,44 @@  discard block
 block discarded – undo
3180 3180
         if ( isset( $discounts[ $discount ] ) && isset( $discounts[ $discount ]['amount'] ) ) {
3181 3181
 
3182 3182
             $amount = $discounts[ $discount ]['amount'] += $amount;
3183
-			$discounts[ $discount ] = array(
3183
+            $discounts[ $discount ] = array(
3184 3184
                 'amount'    => $amount,
3185 3185
                 'recurring' => (bool) $recurring,
3186 3186
             );
3187 3187
 
3188
-		} else {
3189
-			$discounts[ $discount ] = array(
3188
+        } else {
3189
+            $discounts[ $discount ] = array(
3190 3190
                 'amount'    => $amount,
3191 3191
                 'recurring' => (bool) $recurring,
3192 3192
             );
3193
-		}
3193
+        }
3194 3194
 
3195 3195
         $this->set_prop( 'discounts', $discount );
3196 3196
 
3197 3197
     }
3198 3198
 
3199 3199
     /**
3200
-	 * Retrieves a specific discount.
3201
-	 *
3202
-	 * @since 1.0.19
3203
-	 */
3204
-	public function get_discount( $discount = false ) {
3200
+     * Retrieves a specific discount.
3201
+     *
3202
+     * @since 1.0.19
3203
+     */
3204
+    public function get_discount( $discount = false ) {
3205 3205
 
3206
-		// Backwards compatibilty.
3207
-		if ( empty( $discount ) ) {
3208
-			return $this->get_total_discount();
3209
-		}
3206
+        // Backwards compatibilty.
3207
+        if ( empty( $discount ) ) {
3208
+            return $this->get_total_discount();
3209
+        }
3210 3210
 
3211 3211
         $discounts = $this->get_discounts();
3212
-		return isset( $discounts[ $discount ] ) ? $discounts[ $discount ] : null;
3212
+        return isset( $discounts[ $discount ] ) ? $discounts[ $discount ] : null;
3213 3213
     }
3214 3214
 
3215 3215
     /**
3216
-	 * Removes a specific discount.
3217
-	 *
3218
-	 * @since 1.0.19
3219
-	 */
3220
-	public function remove_discount( $discount ) {
3216
+     * Removes a specific discount.
3217
+     *
3218
+     * @since 1.0.19
3219
+     */
3220
+    public function remove_discount( $discount ) {
3221 3221
         $discounts = $this->get_discounts();
3222 3222
         if ( isset( $discounts[ $discount ] ) ) {
3223 3223
             unset( $discounts[ $discount ] );
@@ -3243,38 +3243,38 @@  discard block
 block discarded – undo
3243 3243
         if ( isset( $taxes[ $tax ] ) && isset( $taxes[ $tax ]['amount'] ) ) {
3244 3244
 
3245 3245
             $amount = $taxes[ $tax ]['amount'] += $amount;
3246
-			$taxes[ $tax ] = array(
3246
+            $taxes[ $tax ] = array(
3247 3247
                 'amount'    => $amount,
3248 3248
                 'recurring' => (bool) $recurring,
3249 3249
             );
3250 3250
 
3251
-		} else {
3252
-			$taxes[ $tax ] = array(
3251
+        } else {
3252
+            $taxes[ $tax ] = array(
3253 3253
                 'amount'    => $amount,
3254 3254
                 'recurring' => (bool) $recurring,
3255 3255
             );
3256
-		}
3256
+        }
3257 3257
 
3258 3258
         $this->set_prop( 'taxes', $tax );
3259 3259
 
3260 3260
     }
3261 3261
 
3262 3262
     /**
3263
-	 * Retrieves a specific tax.
3264
-	 *
3265
-	 * @since 1.0.19
3266
-	 */
3267
-	public function get_tax( $tax ) {
3263
+     * Retrieves a specific tax.
3264
+     *
3265
+     * @since 1.0.19
3266
+     */
3267
+    public function get_tax( $tax ) {
3268 3268
         $taxes = $this->get_taxes();
3269
-		return isset( $taxes[ $tax ] ) ? $taxes[ $tax ] : null;
3269
+        return isset( $taxes[ $tax ] ) ? $taxes[ $tax ] : null;
3270 3270
     }
3271 3271
 
3272 3272
     /**
3273
-	 * Removes a specific tax.
3274
-	 *
3275
-	 * @since 1.0.19
3276
-	 */
3277
-	public function remove_tax( $tax ) {
3273
+     * Removes a specific tax.
3274
+     *
3275
+     * @since 1.0.19
3276
+     */
3277
+    public function remove_tax( $tax ) {
3278 3278
         $taxes = $this->get_discounts();
3279 3279
         if ( isset( $taxes[ $tax ] ) ) {
3280 3280
             unset( $taxes[ $tax ] );
@@ -3283,160 +3283,160 @@  discard block
 block discarded – undo
3283 3283
     }
3284 3284
 
3285 3285
     /**
3286
-	 * Recalculates the invoice subtotal.
3287
-	 *
3288
-	 * @since 1.0.19
3289
-	 * @return float The recalculated subtotal
3290
-	 */
3291
-	public function recalculate_subtotal() {
3286
+     * Recalculates the invoice subtotal.
3287
+     *
3288
+     * @since 1.0.19
3289
+     * @return float The recalculated subtotal
3290
+     */
3291
+    public function recalculate_subtotal() {
3292 3292
         $items     = $this->get_items();
3293
-		$subtotal  = 0;
3294
-		$recurring = 0;
3293
+        $subtotal  = 0;
3294
+        $recurring = 0;
3295 3295
 
3296 3296
         foreach ( $items as $item ) {
3297
-			$subtotal  += $item->get_sub_total();
3298
-			$recurring += $item->get_recurring_sub_total();
3297
+            $subtotal  += $item->get_sub_total();
3298
+            $recurring += $item->get_recurring_sub_total();
3299 3299
         }
3300 3300
 
3301
-		if ( $this->is_renewal() ) {
3302
-			$this->set_subtotal( $recurring );
3303
-		} else {
3304
-			$this->set_subtotal( $subtotal );
3305
-		}
3301
+        if ( $this->is_renewal() ) {
3302
+            $this->set_subtotal( $recurring );
3303
+        } else {
3304
+            $this->set_subtotal( $subtotal );
3305
+        }
3306 3306
 
3307
-		$this->totals['subtotal'] = array(
3308
-			'initial'   => $subtotal,
3309
-			'recurring' => $recurring,
3310
-		);
3307
+        $this->totals['subtotal'] = array(
3308
+            'initial'   => $subtotal,
3309
+            'recurring' => $recurring,
3310
+        );
3311 3311
 
3312 3312
         return $this->is_renewal() ? $recurring : $subtotal;
3313 3313
     }
3314 3314
 
3315 3315
     /**
3316
-	 * Recalculates the invoice discount total.
3317
-	 *
3318
-	 * @since 1.0.19
3319
-	 * @return float The recalculated discount
3320
-	 */
3321
-	public function recalculate_total_discount() {
3316
+     * Recalculates the invoice discount total.
3317
+     *
3318
+     * @since 1.0.19
3319
+     * @return float The recalculated discount
3320
+     */
3321
+    public function recalculate_total_discount() {
3322 3322
         $discounts = $this->get_discounts();
3323
-		$discount  = 0;
3324
-		$recurring = 0;
3323
+        $discount  = 0;
3324
+        $recurring = 0;
3325 3325
 
3326 3326
         foreach ( $discounts as $data ) {
3327 3327
 
3328
-			if ( $data['recurring'] ) {
3329
-				$recurring += $data['amount'];
3330
-			} else {
3331
-				$discount += $data['amount'];
3332
-			}
3328
+            if ( $data['recurring'] ) {
3329
+                $recurring += $data['amount'];
3330
+            } else {
3331
+                $discount += $data['amount'];
3332
+            }
3333 3333
 
3334
-		}
3334
+        }
3335 3335
 
3336
-		if ( $this->is_renewal() ) {
3337
-			$this->set_total_discount( $recurring );
3338
-		} else {
3339
-			$this->set_total_discount( $discount );
3340
-		}
3336
+        if ( $this->is_renewal() ) {
3337
+            $this->set_total_discount( $recurring );
3338
+        } else {
3339
+            $this->set_total_discount( $discount );
3340
+        }
3341 3341
 
3342
-		$this->totals['discount'] = array(
3343
-			'initial'   => $discount,
3344
-			'recurring' => $recurring,
3345
-		);
3342
+        $this->totals['discount'] = array(
3343
+            'initial'   => $discount,
3344
+            'recurring' => $recurring,
3345
+        );
3346 3346
 
3347
-		return $this->is_renewal() ? $recurring : $discount;
3347
+        return $this->is_renewal() ? $recurring : $discount;
3348 3348
 
3349 3349
     }
3350 3350
 
3351 3351
     /**
3352
-	 * Recalculates the invoice tax total.
3353
-	 *
3354
-	 * @since 1.0.19
3355
-	 * @return float The recalculated tax
3356
-	 */
3357
-	public function recalculate_total_tax() {
3352
+     * Recalculates the invoice tax total.
3353
+     *
3354
+     * @since 1.0.19
3355
+     * @return float The recalculated tax
3356
+     */
3357
+    public function recalculate_total_tax() {
3358 3358
         $taxes     = $this->get_taxes();
3359
-		$tax       = 0;
3360
-		$recurring = 0;
3359
+        $tax       = 0;
3360
+        $recurring = 0;
3361 3361
 
3362 3362
         foreach ( $taxes as $data ) {
3363 3363
 
3364
-			if ( $data['recurring'] ) {
3365
-				$recurring += $data['amount'];
3366
-			} else {
3367
-				$tax += $data['amount'];
3368
-			}
3364
+            if ( $data['recurring'] ) {
3365
+                $recurring += $data['amount'];
3366
+            } else {
3367
+                $tax += $data['amount'];
3368
+            }
3369 3369
 
3370
-		}
3370
+        }
3371 3371
 
3372
-		if ( $this->is_renewal() ) {
3373
-			$this->set_total_tax( $recurring );
3374
-		} else {
3375
-			$this->set_total_tax( $tax );
3376
-		}
3372
+        if ( $this->is_renewal() ) {
3373
+            $this->set_total_tax( $recurring );
3374
+        } else {
3375
+            $this->set_total_tax( $tax );
3376
+        }
3377 3377
 
3378
-		$this->totals['tax'] = array(
3379
-			'initial'   => $tax,
3380
-			'recurring' => $recurring,
3381
-		);
3378
+        $this->totals['tax'] = array(
3379
+            'initial'   => $tax,
3380
+            'recurring' => $recurring,
3381
+        );
3382 3382
 
3383
-		return $this->is_renewal() ? $recurring : $tax;
3383
+        return $this->is_renewal() ? $recurring : $tax;
3384 3384
 
3385 3385
     }
3386 3386
 
3387 3387
     /**
3388
-	 * Recalculates the invoice fees total.
3389
-	 *
3390
-	 * @since 1.0.19
3391
-	 * @return float The recalculated fee
3392
-	 */
3393
-	public function recalculate_total_fees() {
3394
-		$fees      = $this->get_fees();
3395
-		$fee       = 0;
3396
-		$recurring = 0;
3388
+     * Recalculates the invoice fees total.
3389
+     *
3390
+     * @since 1.0.19
3391
+     * @return float The recalculated fee
3392
+     */
3393
+    public function recalculate_total_fees() {
3394
+        $fees      = $this->get_fees();
3395
+        $fee       = 0;
3396
+        $recurring = 0;
3397 3397
 
3398 3398
         foreach ( $fees as $data ) {
3399 3399
 
3400
-			if ( $data['recurring'] ) {
3401
-				$recurring += $data['amount'];
3402
-			} else {
3403
-				$fee += $data['amount'];
3404
-			}
3400
+            if ( $data['recurring'] ) {
3401
+                $recurring += $data['amount'];
3402
+            } else {
3403
+                $fee += $data['amount'];
3404
+            }
3405 3405
 
3406
-		}
3406
+        }
3407 3407
 
3408 3408
         if ( $this->is_renewal() ) {
3409
-			$this->set_total_fees( $recurring );
3410
-		} else {
3411
-			$this->set_total_fees( $fee );
3412
-		}
3409
+            $this->set_total_fees( $recurring );
3410
+        } else {
3411
+            $this->set_total_fees( $fee );
3412
+        }
3413 3413
 
3414
-		$this->totals['fee'] = array(
3415
-			'initial'   => $fee,
3416
-			'recurring' => $recurring,
3417
-		);
3414
+        $this->totals['fee'] = array(
3415
+            'initial'   => $fee,
3416
+            'recurring' => $recurring,
3417
+        );
3418 3418
 
3419 3419
         $this->set_total_fees( $fee );
3420 3420
         return $this->is_renewal() ? $recurring : $fee;
3421 3421
     }
3422 3422
 
3423 3423
     /**
3424
-	 * Recalculates the invoice total.
3425
-	 *
3426
-	 * @since 1.0.19
3424
+     * Recalculates the invoice total.
3425
+     *
3426
+     * @since 1.0.19
3427 3427
      * @return float The invoice total
3428
-	 */
3429
-	public function recalculate_total() {
3428
+     */
3429
+    public function recalculate_total() {
3430 3430
         $this->recalculate_subtotal();
3431 3431
         $this->recalculate_total_fees();
3432 3432
         $this->recalculate_total_discount();
3433 3433
         $this->recalculate_total_tax();
3434
-		return $this->get_total();
3435
-	}
3434
+        return $this->get_total();
3435
+    }
3436 3436
 
3437
-	/**
3438
-	 * @deprecated
3439
-	 */
3437
+    /**
3438
+     * @deprecated
3439
+     */
3440 3440
     public function recalculate_totals( $temp = false ) {
3441 3441
         $this->update_items( $temp );
3442 3442
         $this->save( true );
@@ -3500,9 +3500,9 @@  discard block
 block discarded – undo
3500 3500
         }
3501 3501
 
3502 3502
         return $note_id;
3503
-	}
3503
+    }
3504 3504
 
3505
-	/**
3505
+    /**
3506 3506
      * Generates a unique key for the invoice.
3507 3507
      */
3508 3508
     public function generate_key( $string = '' ) {
@@ -3522,106 +3522,106 @@  discard block
 block discarded – undo
3522 3522
             $number = wpinv_get_next_invoice_number( $this->post_type );
3523 3523
         }
3524 3524
 
3525
-		$number = wpinv_format_invoice_number( $number, $this->post_type );
3525
+        $number = wpinv_format_invoice_number( $number, $this->post_type );
3526 3526
 
3527
-		return $number;
3528
-	}
3527
+        return $number;
3528
+    }
3529 3529
 
3530
-	/**
3531
-	 * Handle the status transition.
3532
-	 */
3533
-	protected function status_transition() {
3534
-		$status_transition = $this->status_transition;
3530
+    /**
3531
+     * Handle the status transition.
3532
+     */
3533
+    protected function status_transition() {
3534
+        $status_transition = $this->status_transition;
3535 3535
 
3536
-		// Reset status transition variable.
3537
-		$this->status_transition = false;
3536
+        // Reset status transition variable.
3537
+        $this->status_transition = false;
3538 3538
 
3539
-		if ( $status_transition ) {
3540
-			try {
3539
+        if ( $status_transition ) {
3540
+            try {
3541 3541
 
3542
-				// Fire a hook for the status change.
3543
-				do_action( 'getpaid_invoice_status_' . $status_transition['to'], $this->get_id(), $this, $status_transition );
3542
+                // Fire a hook for the status change.
3543
+                do_action( 'getpaid_invoice_status_' . $status_transition['to'], $this->get_id(), $this, $status_transition );
3544 3544
 
3545
-				// @deprecated this is deprecated and will be removed in the future.
3546
-				do_action( 'wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3545
+                // @deprecated this is deprecated and will be removed in the future.
3546
+                do_action( 'wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3547 3547
 
3548
-				if ( ! empty( $status_transition['from'] ) ) {
3548
+                if ( ! empty( $status_transition['from'] ) ) {
3549 3549
 
3550
-					/* translators: 1: old invoice status 2: new invoice status */
3551
-					$transition_note = sprintf( __( 'Status changed from %1$s to %2$s.', 'invoicing' ), wpinv_status_nicename( $status_transition['from'] ), wpinv_status_nicename( $status_transition['to'] ) );
3550
+                    /* translators: 1: old invoice status 2: new invoice status */
3551
+                    $transition_note = sprintf( __( 'Status changed from %1$s to %2$s.', 'invoicing' ), wpinv_status_nicename( $status_transition['from'] ), wpinv_status_nicename( $status_transition['to'] ) );
3552 3552
 
3553
-					// Fire another hook.
3554
-					do_action( 'getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $this );
3555
-					do_action( 'getpaid_invoice_status_changed', $this->get_id(), $status_transition['from'], $status_transition['to'], $this );
3553
+                    // Fire another hook.
3554
+                    do_action( 'getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $this );
3555
+                    do_action( 'getpaid_invoice_status_changed', $this->get_id(), $status_transition['from'], $status_transition['to'], $this );
3556 3556
 
3557
-					// @deprecated this is deprecated and will be removed in the future.
3558
-					do_action( 'wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3557
+                    // @deprecated this is deprecated and will be removed in the future.
3558
+                    do_action( 'wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3559 3559
 
3560
-					// Note the transition occurred.
3561
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
3560
+                    // Note the transition occurred.
3561
+                    $this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
3562 3562
 
3563
-					// Work out if this was for a payment, and trigger a payment_status hook instead.
3564
-					if (
3565
-						in_array( $status_transition['from'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded' ), true )
3566
-						&& in_array( $status_transition['to'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3567
-					) {
3568
-						do_action( 'getpaid_invoice_payment_status_changed', $this->get_id(), $this, $status_transition );
3569
-					}
3570
-				} else {
3571
-					/* translators: %s: new invoice status */
3572
-					$transition_note = sprintf( __( 'Status set to %s.', 'invoicing' ), wpinv_status_nicename( $status_transition['to'] ) );
3563
+                    // Work out if this was for a payment, and trigger a payment_status hook instead.
3564
+                    if (
3565
+                        in_array( $status_transition['from'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded' ), true )
3566
+                        && in_array( $status_transition['to'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3567
+                    ) {
3568
+                        do_action( 'getpaid_invoice_payment_status_changed', $this->get_id(), $this, $status_transition );
3569
+                    }
3570
+                } else {
3571
+                    /* translators: %s: new invoice status */
3572
+                    $transition_note = sprintf( __( 'Status set to %s.', 'invoicing' ), wpinv_status_nicename( $status_transition['to'] ) );
3573 3573
 
3574
-					// Note the transition occurred.
3575
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
3574
+                    // Note the transition occurred.
3575
+                    $this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
3576 3576
 
3577
-				}
3578
-			} catch ( Exception $e ) {
3579
-				$this->add_note( __( 'Error during status transition.', 'invoicing' ) . ' ' . $e->getMessage() );
3580
-			}
3581
-		}
3582
-	}
3577
+                }
3578
+            } catch ( Exception $e ) {
3579
+                $this->add_note( __( 'Error during status transition.', 'invoicing' ) . ' ' . $e->getMessage() );
3580
+            }
3581
+        }
3582
+    }
3583 3583
 
3584
-	/**
3585
-	 * Updates an invoice status.
3586
-	 */
3587
-	public function update_status( $new_status = false, $note = '', $manual = false ) {
3584
+    /**
3585
+     * Updates an invoice status.
3586
+     */
3587
+    public function update_status( $new_status = false, $note = '', $manual = false ) {
3588 3588
 
3589
-		// Fires before updating a status.
3590
-		do_action( 'wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status( 'edit' ) );
3589
+        // Fires before updating a status.
3590
+        do_action( 'wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status( 'edit' ) );
3591 3591
 
3592
-		// Update the status.
3593
-		$this->set_status( $new_status, $note, $manual );
3592
+        // Update the status.
3593
+        $this->set_status( $new_status, $note, $manual );
3594 3594
 
3595
-		// Save the order.
3596
-		return $this->save();
3595
+        // Save the order.
3596
+        return $this->save();
3597 3597
 
3598
-	}
3598
+    }
3599 3599
 
3600
-	/**
3601
-	 * @deprecated
3602
-	 */
3603
-	public function refresh_item_ids() {
3600
+    /**
3601
+     * @deprecated
3602
+     */
3603
+    public function refresh_item_ids() {
3604 3604
         $item_ids = implode( ',', array_unique( array_keys( $this->get_items() ) ) );
3605 3605
         update_post_meta( $this->get_id(), '_wpinv_item_ids', $item_ids );
3606
-	}
3606
+    }
3607 3607
 
3608
-	/**
3609
-	 * @deprecated
3610
-	 */
3611
-	public function update_items( $temp = false ) {
3608
+    /**
3609
+     * @deprecated
3610
+     */
3611
+    public function update_items( $temp = false ) {
3612 3612
 
3613
-		$this->set_items( $this->get_items() );
3613
+        $this->set_items( $this->get_items() );
3614 3614
 
3615
-		if ( ! $temp ) {
3616
-			$this->save();
3617
-		}
3615
+        if ( ! $temp ) {
3616
+            $this->save();
3617
+        }
3618 3618
 
3619 3619
         return $this;
3620
-	}
3620
+    }
3621 3621
 
3622
-	/**
3623
-	 * @deprecated
3624
-	 */
3622
+    /**
3623
+     * @deprecated
3624
+     */
3625 3625
     public function validate_discount() {
3626 3626
 
3627 3627
         $discount_code = $this->get_discount_code();
@@ -3637,25 +3637,25 @@  discard block
 block discarded – undo
3637 3637
 
3638 3638
     }
3639 3639
 
3640
-	/**
3641
-	 * Refunds an invoice.
3642
-	 */
3640
+    /**
3641
+     * Refunds an invoice.
3642
+     */
3643 3643
     public function refund() {
3644
-		$this->set_status( 'wpi-refunded' );
3644
+        $this->set_status( 'wpi-refunded' );
3645 3645
         $this->save();
3646 3646
     }
3647 3647
 
3648
-	/**
3649
-	 * Save data to the database.
3650
-	 *
3651
-	 * @since 1.0.19
3652
-	 * @return int invoice ID
3653
-	 */
3654
-	public function save() {
3655
-		$this->maybe_set_date_paid();
3656
-		parent::save();
3657
-		$this->status_transition();
3658
-		return $this->get_id();
3659
-	}
3648
+    /**
3649
+     * Save data to the database.
3650
+     *
3651
+     * @since 1.0.19
3652
+     * @return int invoice ID
3653
+     */
3654
+    public function save() {
3655
+        $this->maybe_set_date_paid();
3656
+        parent::save();
3657
+        $this->status_transition();
3658
+        return $this->get_id();
3659
+    }
3660 3660
 
3661 3661
 }
Please login to merge, or discard this patch.
Spacing   +724 added lines, -724 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
  * Invoice class.
@@ -133,40 +133,40 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @param  int|string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, transaction id, number or object to read.
135 135
 	 */
136
-    public function __construct( $invoice = false ) {
136
+    public function __construct($invoice = false) {
137 137
 
138
-        parent::__construct( $invoice );
138
+        parent::__construct($invoice);
139 139
 
140
-		if ( ! empty( $invoice ) && is_numeric( $invoice ) && getpaid_is_invoice_post_type( get_post_type( $invoice ) ) ) {
141
-			$this->set_id( $invoice );
142
-		} elseif ( $invoice instanceof self ) {
143
-			$this->set_id( $invoice->get_id() );
144
-		} elseif ( ! empty( $invoice->ID ) ) {
145
-			$this->set_id( $invoice->ID );
146
-		} elseif ( is_array( $invoice ) ) {
147
-			$this->set_props( $invoice );
140
+		if (!empty($invoice) && is_numeric($invoice) && getpaid_is_invoice_post_type(get_post_type($invoice))) {
141
+			$this->set_id($invoice);
142
+		} elseif ($invoice instanceof self) {
143
+			$this->set_id($invoice->get_id());
144
+		} elseif (!empty($invoice->ID)) {
145
+			$this->set_id($invoice->ID);
146
+		} elseif (is_array($invoice)) {
147
+			$this->set_props($invoice);
148 148
 
149
-			if ( isset( $invoice['ID'] ) ) {
150
-				$this->set_id( $invoice['ID'] );
149
+			if (isset($invoice['ID'])) {
150
+				$this->set_id($invoice['ID']);
151 151
 			}
152 152
 
153
-		} elseif ( is_scalar( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'key' ) ) {
154
-			$this->set_id( $invoice_id );
155
-		} elseif ( is_scalar( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'number' ) ) {
156
-			$this->set_id( $invoice_id );
157
-		} elseif ( is_scalar( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'transaction_id' ) ) {
158
-			$this->set_id( $invoice_id );
159
-		}else {
160
-			$this->set_object_read( true );
153
+		} elseif (is_scalar($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'key')) {
154
+			$this->set_id($invoice_id);
155
+		} elseif (is_scalar($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'number')) {
156
+			$this->set_id($invoice_id);
157
+		} elseif (is_scalar($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'transaction_id')) {
158
+			$this->set_id($invoice_id);
159
+		} else {
160
+			$this->set_object_read(true);
161 161
 		}
162 162
 
163 163
         // Load the datastore.
164
-		$this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
164
+		$this->data_store = GetPaid_Data_Store::load($this->data_store_name);
165 165
 
166
-		if ( $this->get_id() > 0 ) {
167
-            $this->post = get_post( $this->get_id() );
166
+		if ($this->get_id() > 0) {
167
+            $this->post = get_post($this->get_id());
168 168
             $this->ID   = $this->get_id();
169
-			$this->data_store->read( $this );
169
+			$this->data_store->read($this);
170 170
         }
171 171
 
172 172
     }
@@ -181,42 +181,42 @@  discard block
 block discarded – undo
181 181
 	 * @since 1.0.15
182 182
 	 * @return int
183 183
 	 */
184
-	public static function get_invoice_id_by_field( $value, $field = 'key' ) {
184
+	public static function get_invoice_id_by_field($value, $field = 'key') {
185 185
         global $wpdb;
186 186
 
187 187
 		// Trim the value.
188
-		$value = trim( $value );
188
+		$value = trim($value);
189 189
 
190
-		if ( empty( $value ) ) {
190
+		if (empty($value)) {
191 191
 			return 0;
192 192
 		}
193 193
 
194 194
         // Valid fields.
195
-        $fields = array( 'key', 'number', 'transaction_id' );
195
+        $fields = array('key', 'number', 'transaction_id');
196 196
 
197 197
 		// Ensure a field has been passed.
198
-		if ( empty( $field ) || ! in_array( $field, $fields ) ) {
198
+		if (empty($field) || !in_array($field, $fields)) {
199 199
 			return 0;
200 200
 		}
201 201
 
202 202
 		// Maybe retrieve from the cache.
203
-		$invoice_id   = wp_cache_get( $value, "getpaid_invoice_{$field}s_to_invoice_ids" );
204
-		if ( ! empty( $invoice_id ) ) {
203
+		$invoice_id = wp_cache_get($value, "getpaid_invoice_{$field}s_to_invoice_ids");
204
+		if (!empty($invoice_id)) {
205 205
 			return $invoice_id;
206 206
 		}
207 207
 
208 208
         // Fetch from the db.
209 209
         $table       = $wpdb->prefix . 'getpaid_invoices';
210 210
         $invoice_id  = $wpdb->get_var(
211
-            $wpdb->prepare( "SELECT `post_id` FROM $table WHERE `$field`=%s LIMIT 1", $value )
211
+            $wpdb->prepare("SELECT `post_id` FROM $table WHERE `$field`=%s LIMIT 1", $value)
212 212
         );
213 213
 
214
-		if ( empty( $invoice_id ) ) {
214
+		if (empty($invoice_id)) {
215 215
 			return 0;
216 216
 		}
217 217
 
218 218
 		// Update the cache with our data
219
-		wp_cache_set( $value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids" );
219
+		wp_cache_set($value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids");
220 220
 
221 221
 		return $invoice_id;
222 222
     }
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
     /**
225 225
      * Checks if an invoice key is set.
226 226
      */
227
-    public function _isset( $key ) {
228
-        return isset( $this->data[$key] ) || method_exists( $this, "get_$key" );
227
+    public function _isset($key) {
228
+        return isset($this->data[$key]) || method_exists($this, "get_$key");
229 229
     }
230 230
 
231 231
     /*
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 	 * @param  string $context View or edit context.
251 251
 	 * @return int
252 252
 	 */
253
-	public function get_parent_id( $context = 'view' ) {
254
-		return (int) $this->get_prop( 'parent_id', $context );
253
+	public function get_parent_id($context = 'view') {
254
+		return (int) $this->get_prop('parent_id', $context);
255 255
     }
256 256
 
257 257
     /**
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 * @return WPInv_Invoice
262 262
 	 */
263 263
     public function get_parent_payment() {
264
-        return new WPInv_Invoice( $this->get_parent_id() );
264
+        return new WPInv_Invoice($this->get_parent_id());
265 265
     }
266 266
 
267 267
     /**
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 	 * @param  string $context View or edit context.
282 282
 	 * @return string
283 283
 	 */
284
-	public function get_status( $context = 'view' ) {
285
-		return $this->get_prop( 'status', $context );
284
+	public function get_status($context = 'view') {
285
+		return $this->get_prop('status', $context);
286 286
 	}
287 287
 	
288 288
 	/**
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
 	 */
294 294
 	public function get_all_statuses() {
295 295
 		
296
-		$statuses = wpinv_get_invoice_statuses( true, true, $this );
296
+		$statuses = wpinv_get_invoice_statuses(true, true, $this);
297 297
 
298 298
 		// For backwards compatibility.
299
-		if ( $this->is_quote() && class_exists( 'Wpinv_Quotes_Shared' ) ) {
299
+		if ($this->is_quote() && class_exists('Wpinv_Quotes_Shared')) {
300 300
             $statuses = Wpinv_Quotes_Shared::wpinv_get_quote_statuses();
301 301
 		}
302 302
 
@@ -312,9 +312,9 @@  discard block
 block discarded – undo
312 312
     public function get_status_nicename() {
313 313
 		$statuses = $this->get_all_statuses();
314 314
 
315
-        $status = isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : $this->get_status();
315
+        $status = isset($statuses[$this->get_status()]) ? $statuses[$this->get_status()] : $this->get_status();
316 316
 
317
-        return apply_filters( 'wpinv_get_invoice_status_nicename', $status, $this );
317
+        return apply_filters('wpinv_get_invoice_status_nicename', $status, $this);
318 318
     }
319 319
 
320 320
     /**
@@ -324,27 +324,27 @@  discard block
 block discarded – undo
324 324
 	 * @param  string $context View or edit context.
325 325
 	 * @return string
326 326
 	 */
327
-	public function get_version( $context = 'view' ) {
328
-		return $this->get_prop( 'version', $context );
327
+	public function get_version($context = 'view') {
328
+		return $this->get_prop('version', $context);
329 329
 	}
330 330
 
331 331
 	/**
332 332
 	 * @deprecated
333 333
 	 */
334
-	public function get_invoice_date( $formatted = true ) {
334
+	public function get_invoice_date($formatted = true) {
335 335
         $date_completed = $this->get_date_completed();
336 336
         $invoice_date   = $date_completed != '0000-00-00 00:00:00' ? $date_completed : '';
337 337
 
338
-        if ( $invoice_date == '' ) {
338
+        if ($invoice_date == '') {
339 339
             $date_created   = $this->get_date_created();
340 340
             $invoice_date   = $date_created != '0000-00-00 00:00:00' ? $date_created : '';
341 341
         }
342 342
 
343
-        if ( $formatted && $invoice_date ) {
344
-            $invoice_date   = date_i18n( get_option( 'date_format' ), strtotime( $invoice_date ) );
343
+        if ($formatted && $invoice_date) {
344
+            $invoice_date = date_i18n(get_option('date_format'), strtotime($invoice_date));
345 345
         }
346 346
 
347
-        return apply_filters( 'wpinv_get_invoice_date', $invoice_date, $formatted, $this->get_id(), $this );
347
+        return apply_filters('wpinv_get_invoice_date', $invoice_date, $formatted, $this->get_id(), $this);
348 348
     }
349 349
 
350 350
     /**
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 	 * @param  string $context View or edit context.
355 355
 	 * @return string
356 356
 	 */
357
-	public function get_date_created( $context = 'view' ) {
358
-		return $this->get_prop( 'date_created', $context );
357
+	public function get_date_created($context = 'view') {
358
+		return $this->get_prop('date_created', $context);
359 359
 	}
360 360
 	
361 361
 	/**
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
 	 * @param  string $context View or edit context.
366 366
 	 * @return string
367 367
 	 */
368
-	public function get_created_date( $context = 'view' ) {
369
-		return $this->get_date_created( $context );
368
+	public function get_created_date($context = 'view') {
369
+		return $this->get_date_created($context);
370 370
     }
371 371
 
372 372
     /**
@@ -376,11 +376,11 @@  discard block
 block discarded – undo
376 376
 	 * @param  string $context View or edit context.
377 377
 	 * @return string
378 378
 	 */
379
-	public function get_date_created_gmt( $context = 'view' ) {
380
-        $date = $this->get_date_created( $context );
379
+	public function get_date_created_gmt($context = 'view') {
380
+        $date = $this->get_date_created($context);
381 381
 
382
-        if ( $date ) {
383
-            $date = get_gmt_from_date( $date );
382
+        if ($date) {
383
+            $date = get_gmt_from_date($date);
384 384
         }
385 385
 		return $date;
386 386
     }
@@ -392,8 +392,8 @@  discard block
 block discarded – undo
392 392
 	 * @param  string $context View or edit context.
393 393
 	 * @return string
394 394
 	 */
395
-	public function get_date_modified( $context = 'view' ) {
396
-		return $this->get_prop( 'date_modified', $context );
395
+	public function get_date_modified($context = 'view') {
396
+		return $this->get_prop('date_modified', $context);
397 397
 	}
398 398
 
399 399
 	/**
@@ -403,8 +403,8 @@  discard block
 block discarded – undo
403 403
 	 * @param  string $context View or edit context.
404 404
 	 * @return string
405 405
 	 */
406
-	public function get_modified_date( $context = 'view' ) {
407
-		return $this->get_date_modified( $context );
406
+	public function get_modified_date($context = 'view') {
407
+		return $this->get_date_modified($context);
408 408
     }
409 409
 
410 410
     /**
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
 	 * @param  string $context View or edit context.
415 415
 	 * @return string
416 416
 	 */
417
-	public function get_date_modified_gmt( $context = 'view' ) {
418
-        $date = $this->get_date_modified( $context );
417
+	public function get_date_modified_gmt($context = 'view') {
418
+        $date = $this->get_date_modified($context);
419 419
 
420
-        if ( $date ) {
421
-            $date = get_gmt_from_date( $date );
420
+        if ($date) {
421
+            $date = get_gmt_from_date($date);
422 422
         }
423 423
 		return $date;
424 424
     }
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
 	 * @param  string $context View or edit context.
431 431
 	 * @return string
432 432
 	 */
433
-	public function get_due_date( $context = 'view' ) {
434
-		return $this->get_prop( 'due_date', $context );
433
+	public function get_due_date($context = 'view') {
434
+		return $this->get_prop('due_date', $context);
435 435
     }
436 436
 
437 437
     /**
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
 	 * @param  string $context View or edit context.
442 442
 	 * @return string
443 443
 	 */
444
-	public function get_date_due( $context = 'view' ) {
445
-		return $this->get_due_date( $context );
444
+	public function get_date_due($context = 'view') {
445
+		return $this->get_due_date($context);
446 446
     }
447 447
 
448 448
     /**
@@ -452,11 +452,11 @@  discard block
 block discarded – undo
452 452
 	 * @param  string $context View or edit context.
453 453
 	 * @return string
454 454
 	 */
455
-	public function get_due_date_gmt( $context = 'view' ) {
456
-        $date = $this->get_due_date( $context );
455
+	public function get_due_date_gmt($context = 'view') {
456
+        $date = $this->get_due_date($context);
457 457
 
458
-        if ( $date ) {
459
-            $date = get_gmt_from_date( $date );
458
+        if ($date) {
459
+            $date = get_gmt_from_date($date);
460 460
         }
461 461
 		return $date;
462 462
     }
@@ -468,8 +468,8 @@  discard block
 block discarded – undo
468 468
 	 * @param  string $context View or edit context.
469 469
 	 * @return string
470 470
 	 */
471
-	public function get_gmt_date_due( $context = 'view' ) {
472
-		return $this->get_due_date_gmt( $context );
471
+	public function get_gmt_date_due($context = 'view') {
472
+		return $this->get_due_date_gmt($context);
473 473
     }
474 474
 
475 475
     /**
@@ -479,8 +479,8 @@  discard block
 block discarded – undo
479 479
 	 * @param  string $context View or edit context.
480 480
 	 * @return string
481 481
 	 */
482
-	public function get_completed_date( $context = 'view' ) {
483
-		return $this->get_prop( 'completed_date', $context );
482
+	public function get_completed_date($context = 'view') {
483
+		return $this->get_prop('completed_date', $context);
484 484
     }
485 485
 
486 486
     /**
@@ -490,8 +490,8 @@  discard block
 block discarded – undo
490 490
 	 * @param  string $context View or edit context.
491 491
 	 * @return string
492 492
 	 */
493
-	public function get_date_completed( $context = 'view' ) {
494
-		return $this->get_completed_date( $context );
493
+	public function get_date_completed($context = 'view') {
494
+		return $this->get_completed_date($context);
495 495
     }
496 496
 
497 497
     /**
@@ -501,11 +501,11 @@  discard block
 block discarded – undo
501 501
 	 * @param  string $context View or edit context.
502 502
 	 * @return string
503 503
 	 */
504
-	public function get_completed_date_gmt( $context = 'view' ) {
505
-        $date = $this->get_completed_date( $context );
504
+	public function get_completed_date_gmt($context = 'view') {
505
+        $date = $this->get_completed_date($context);
506 506
 
507
-        if ( $date ) {
508
-            $date = get_gmt_from_date( $date );
507
+        if ($date) {
508
+            $date = get_gmt_from_date($date);
509 509
         }
510 510
 		return $date;
511 511
     }
@@ -517,8 +517,8 @@  discard block
 block discarded – undo
517 517
 	 * @param  string $context View or edit context.
518 518
 	 * @return string
519 519
 	 */
520
-	public function get_gmt_completed_date( $context = 'view' ) {
521
-		return $this->get_completed_date_gmt( $context );
520
+	public function get_gmt_completed_date($context = 'view') {
521
+		return $this->get_completed_date_gmt($context);
522 522
     }
523 523
 
524 524
     /**
@@ -528,12 +528,12 @@  discard block
 block discarded – undo
528 528
 	 * @param  string $context View or edit context.
529 529
 	 * @return string
530 530
 	 */
531
-	public function get_number( $context = 'view' ) {
532
-        $number = $this->get_prop( 'number', $context );
531
+	public function get_number($context = 'view') {
532
+        $number = $this->get_prop('number', $context);
533 533
 
534
-        if ( empty( $number ) ) {
534
+        if (empty($number)) {
535 535
             $number = $this->generate_number();
536
-            $this->set_number( $number );
536
+            $this->set_number($number);
537 537
         }
538 538
 
539 539
 		return $number;
@@ -546,12 +546,12 @@  discard block
 block discarded – undo
546 546
 	 * @param  string $context View or edit context.
547 547
 	 * @return string
548 548
 	 */
549
-	public function get_key( $context = 'view' ) {
550
-        $key = $this->get_prop( 'key', $context );
549
+	public function get_key($context = 'view') {
550
+        $key = $this->get_prop('key', $context);
551 551
 
552
-        if ( empty( $key ) ) {
553
-            $key = $this->generate_key( $this->post_type );
554
-            $this->set_key( $key );
552
+        if (empty($key)) {
553
+            $key = $this->generate_key($this->post_type);
554
+            $this->set_key($key);
555 555
         }
556 556
 
557 557
 		return $key;
@@ -564,23 +564,23 @@  discard block
 block discarded – undo
564 564
 	 * @param  string $context View or edit context.
565 565
 	 * @return string
566 566
 	 */
567
-	public function get_type( $context = 'view' ) {
568
-        return $this->get_prop( 'type', $context );
567
+	public function get_type($context = 'view') {
568
+        return $this->get_prop('type', $context);
569 569
 	}
570 570
 
571 571
 	/**
572 572
 	 * @deprecated
573 573
 	 */
574
-	public function get_invoice_quote_type( $post_id ) {
575
-        if ( empty( $post_id ) ) {
574
+	public function get_invoice_quote_type($post_id) {
575
+        if (empty($post_id)) {
576 576
             return '';
577 577
         }
578 578
 
579
-        $type = get_post_type( $post_id );
579
+        $type = get_post_type($post_id);
580 580
 
581
-        if ( 'wpi_invoice' === $type ) {
581
+        if ('wpi_invoice' === $type) {
582 582
             $post_type = __('Invoice', 'invoicing');
583
-        } else{
583
+        } else {
584 584
             $post_type = __('Quote', 'invoicing');
585 585
         }
586 586
 
@@ -594,8 +594,8 @@  discard block
 block discarded – undo
594 594
 	 * @param  string $context View or edit context.
595 595
 	 * @return string
596 596
 	 */
597
-	public function get_post_type( $context = 'view' ) {
598
-        return $this->get_prop( 'post_type', $context );
597
+	public function get_post_type($context = 'view') {
598
+        return $this->get_prop('post_type', $context);
599 599
     }
600 600
 
601 601
     /**
@@ -605,8 +605,8 @@  discard block
 block discarded – undo
605 605
 	 * @param  string $context View or edit context.
606 606
 	 * @return string
607 607
 	 */
608
-	public function get_mode( $context = 'view' ) {
609
-        return $this->get_prop( 'mode', $context );
608
+	public function get_mode($context = 'view') {
609
+        return $this->get_prop('mode', $context);
610 610
     }
611 611
 
612 612
     /**
@@ -616,12 +616,12 @@  discard block
 block discarded – undo
616 616
 	 * @param  string $context View or edit context.
617 617
 	 * @return string
618 618
 	 */
619
-	public function get_path( $context = 'view' ) {
620
-        $path = $this->get_prop( 'path', $context );
619
+	public function get_path($context = 'view') {
620
+        $path = $this->get_prop('path', $context);
621 621
 
622
-        if ( empty( $path ) ) {
623
-            $prefix = apply_filters( 'wpinv_post_name_prefix', 'inv-', $this->post_type );
624
-            $path   = sanitize_title( $prefix . $this->get_id() );
622
+        if (empty($path)) {
623
+            $prefix = apply_filters('wpinv_post_name_prefix', 'inv-', $this->post_type);
624
+            $path   = sanitize_title($prefix . $this->get_id());
625 625
         }
626 626
 
627 627
 		return $path;
@@ -634,10 +634,10 @@  discard block
 block discarded – undo
634 634
 	 * @param  string $context View or edit context.
635 635
 	 * @return string
636 636
 	 */
637
-	public function get_name( $context = 'view' ) {
638
-        $name = $this->get_prop( 'title', $context );
637
+	public function get_name($context = 'view') {
638
+        $name = $this->get_prop('title', $context);
639 639
 
640
-		return empty( $name ) ? $this->get_number( $context ) : $name;
640
+		return empty($name) ? $this->get_number($context) : $name;
641 641
     }
642 642
 
643 643
     /**
@@ -647,8 +647,8 @@  discard block
 block discarded – undo
647 647
 	 * @param  string $context View or edit context.
648 648
 	 * @return string
649 649
 	 */
650
-	public function get_title( $context = 'view' ) {
651
-		return $this->get_name( $context );
650
+	public function get_title($context = 'view') {
651
+		return $this->get_name($context);
652 652
     }
653 653
 
654 654
     /**
@@ -658,8 +658,8 @@  discard block
 block discarded – undo
658 658
 	 * @param  string $context View or edit context.
659 659
 	 * @return string
660 660
 	 */
661
-	public function get_description( $context = 'view' ) {
662
-		return $this->get_prop( 'description', $context );
661
+	public function get_description($context = 'view') {
662
+		return $this->get_prop('description', $context);
663 663
     }
664 664
 
665 665
     /**
@@ -669,8 +669,8 @@  discard block
 block discarded – undo
669 669
 	 * @param  string $context View or edit context.
670 670
 	 * @return string
671 671
 	 */
672
-	public function get_excerpt( $context = 'view' ) {
673
-		return $this->get_description( $context );
672
+	public function get_excerpt($context = 'view') {
673
+		return $this->get_description($context);
674 674
     }
675 675
 
676 676
     /**
@@ -680,8 +680,8 @@  discard block
 block discarded – undo
680 680
 	 * @param  string $context View or edit context.
681 681
 	 * @return string
682 682
 	 */
683
-	public function get_summary( $context = 'view' ) {
684
-		return $this->get_description( $context );
683
+	public function get_summary($context = 'view') {
684
+		return $this->get_description($context);
685 685
     }
686 686
 
687 687
     /**
@@ -691,25 +691,25 @@  discard block
 block discarded – undo
691 691
      * @param  string $context View or edit context.
692 692
 	 * @return array
693 693
 	 */
694
-    public function get_user_info( $context = 'view' ) {
694
+    public function get_user_info($context = 'view') {
695 695
 
696 696
         $user_info = array(
697
-            'user_id'    => $this->get_user_id( $context ),
698
-            'email'      => $this->get_email( $context ),
699
-            'first_name' => $this->get_first_name( $context ),
700
-            'last_name'  => $this->get_last_name( $context ),
701
-            'address'    => $this->get_address( $context ),
702
-            'phone'      => $this->get_phone( $context ),
703
-            'city'       => $this->get_city( $context ),
704
-            'country'    => $this->get_country( $context ),
705
-            'state'      => $this->get_state( $context ),
706
-            'zip'        => $this->get_zip( $context ),
707
-            'company'    => $this->get_company( $context ),
708
-            'vat_number' => $this->get_vat_number( $context ),
709
-            'discount'   => $this->get_discount_code( $context ),
697
+            'user_id'    => $this->get_user_id($context),
698
+            'email'      => $this->get_email($context),
699
+            'first_name' => $this->get_first_name($context),
700
+            'last_name'  => $this->get_last_name($context),
701
+            'address'    => $this->get_address($context),
702
+            'phone'      => $this->get_phone($context),
703
+            'city'       => $this->get_city($context),
704
+            'country'    => $this->get_country($context),
705
+            'state'      => $this->get_state($context),
706
+            'zip'        => $this->get_zip($context),
707
+            'company'    => $this->get_company($context),
708
+            'vat_number' => $this->get_vat_number($context),
709
+            'discount'   => $this->get_discount_code($context),
710 710
 		);
711 711
 
712
-		return apply_filters( 'wpinv_user_info', $user_info, $this->get_id(), $this );
712
+		return apply_filters('wpinv_user_info', $user_info, $this->get_id(), $this);
713 713
 
714 714
     }
715 715
 
@@ -720,8 +720,8 @@  discard block
 block discarded – undo
720 720
 	 * @param  string $context View or edit context.
721 721
 	 * @return int
722 722
 	 */
723
-	public function get_author( $context = 'view' ) {
724
-		return (int) $this->get_prop( 'author', $context );
723
+	public function get_author($context = 'view') {
724
+		return (int) $this->get_prop('author', $context);
725 725
     }
726 726
 
727 727
     /**
@@ -731,8 +731,8 @@  discard block
 block discarded – undo
731 731
 	 * @param  string $context View or edit context.
732 732
 	 * @return int
733 733
 	 */
734
-	public function get_user_id( $context = 'view' ) {
735
-		return $this->get_author( $context );
734
+	public function get_user_id($context = 'view') {
735
+		return $this->get_author($context);
736 736
     }
737 737
 
738 738
      /**
@@ -742,8 +742,8 @@  discard block
 block discarded – undo
742 742
 	 * @param  string $context View or edit context.
743 743
 	 * @return int
744 744
 	 */
745
-	public function get_customer_id( $context = 'view' ) {
746
-		return $this->get_author( $context );
745
+	public function get_customer_id($context = 'view') {
746
+		return $this->get_author($context);
747 747
     }
748 748
 
749 749
     /**
@@ -753,8 +753,8 @@  discard block
 block discarded – undo
753 753
 	 * @param  string $context View or edit context.
754 754
 	 * @return string
755 755
 	 */
756
-	public function get_ip( $context = 'view' ) {
757
-		return $this->get_prop( 'user_ip', $context );
756
+	public function get_ip($context = 'view') {
757
+		return $this->get_prop('user_ip', $context);
758 758
     }
759 759
 
760 760
     /**
@@ -764,8 +764,8 @@  discard block
 block discarded – undo
764 764
 	 * @param  string $context View or edit context.
765 765
 	 * @return string
766 766
 	 */
767
-	public function get_user_ip( $context = 'view' ) {
768
-		return $this->get_ip( $context );
767
+	public function get_user_ip($context = 'view') {
768
+		return $this->get_ip($context);
769 769
     }
770 770
 
771 771
      /**
@@ -775,8 +775,8 @@  discard block
 block discarded – undo
775 775
 	 * @param  string $context View or edit context.
776 776
 	 * @return string
777 777
 	 */
778
-	public function get_customer_ip( $context = 'view' ) {
779
-		return $this->get_ip( $context );
778
+	public function get_customer_ip($context = 'view') {
779
+		return $this->get_ip($context);
780 780
     }
781 781
 
782 782
     /**
@@ -786,8 +786,8 @@  discard block
 block discarded – undo
786 786
 	 * @param  string $context View or edit context.
787 787
 	 * @return string
788 788
 	 */
789
-	public function get_first_name( $context = 'view' ) {
790
-		return $this->get_prop( 'first_name', $context );
789
+	public function get_first_name($context = 'view') {
790
+		return $this->get_prop('first_name', $context);
791 791
     }
792 792
 
793 793
     /**
@@ -797,8 +797,8 @@  discard block
 block discarded – undo
797 797
 	 * @param  string $context View or edit context.
798 798
 	 * @return int
799 799
 	 */
800
-	public function get_user_first_name( $context = 'view' ) {
801
-		return $this->get_first_name( $context );
800
+	public function get_user_first_name($context = 'view') {
801
+		return $this->get_first_name($context);
802 802
     }
803 803
 
804 804
      /**
@@ -808,8 +808,8 @@  discard block
 block discarded – undo
808 808
 	 * @param  string $context View or edit context.
809 809
 	 * @return int
810 810
 	 */
811
-	public function get_customer_first_name( $context = 'view' ) {
812
-		return $this->get_first_name( $context );
811
+	public function get_customer_first_name($context = 'view') {
812
+		return $this->get_first_name($context);
813 813
     }
814 814
 
815 815
     /**
@@ -819,8 +819,8 @@  discard block
 block discarded – undo
819 819
 	 * @param  string $context View or edit context.
820 820
 	 * @return string
821 821
 	 */
822
-	public function get_last_name( $context = 'view' ) {
823
-		return $this->get_prop( 'last_name', $context );
822
+	public function get_last_name($context = 'view') {
823
+		return $this->get_prop('last_name', $context);
824 824
     }
825 825
 
826 826
     /**
@@ -830,8 +830,8 @@  discard block
 block discarded – undo
830 830
 	 * @param  string $context View or edit context.
831 831
 	 * @return int
832 832
 	 */
833
-	public function get_user_last_name( $context = 'view' ) {
834
-		return $this->get_last_name( $context );
833
+	public function get_user_last_name($context = 'view') {
834
+		return $this->get_last_name($context);
835 835
     }
836 836
 
837 837
     /**
@@ -841,8 +841,8 @@  discard block
 block discarded – undo
841 841
 	 * @param  string $context View or edit context.
842 842
 	 * @return int
843 843
 	 */
844
-	public function get_customer_last_name( $context = 'view' ) {
845
-		return $this->get_last_name( $context );
844
+	public function get_customer_last_name($context = 'view') {
845
+		return $this->get_last_name($context);
846 846
     }
847 847
 
848 848
     /**
@@ -852,8 +852,8 @@  discard block
 block discarded – undo
852 852
 	 * @param  string $context View or edit context.
853 853
 	 * @return string
854 854
 	 */
855
-	public function get_full_name( $context = 'view' ) {
856
-		return trim( $this->get_first_name( $context ) . ' ' . $this->get_last_name( $context ) );
855
+	public function get_full_name($context = 'view') {
856
+		return trim($this->get_first_name($context) . ' ' . $this->get_last_name($context));
857 857
     }
858 858
 
859 859
     /**
@@ -863,8 +863,8 @@  discard block
 block discarded – undo
863 863
 	 * @param  string $context View or edit context.
864 864
 	 * @return int
865 865
 	 */
866
-	public function get_user_full_name( $context = 'view' ) {
867
-		return $this->get_full_name( $context );
866
+	public function get_user_full_name($context = 'view') {
867
+		return $this->get_full_name($context);
868 868
     }
869 869
 
870 870
     /**
@@ -874,8 +874,8 @@  discard block
 block discarded – undo
874 874
 	 * @param  string $context View or edit context.
875 875
 	 * @return int
876 876
 	 */
877
-	public function get_customer_full_name( $context = 'view' ) {
878
-		return $this->get_full_name( $context );
877
+	public function get_customer_full_name($context = 'view') {
878
+		return $this->get_full_name($context);
879 879
     }
880 880
 
881 881
     /**
@@ -885,8 +885,8 @@  discard block
 block discarded – undo
885 885
 	 * @param  string $context View or edit context.
886 886
 	 * @return string
887 887
 	 */
888
-	public function get_phone( $context = 'view' ) {
889
-		return $this->get_prop( 'phone', $context );
888
+	public function get_phone($context = 'view') {
889
+		return $this->get_prop('phone', $context);
890 890
     }
891 891
 
892 892
     /**
@@ -896,8 +896,8 @@  discard block
 block discarded – undo
896 896
 	 * @param  string $context View or edit context.
897 897
 	 * @return int
898 898
 	 */
899
-	public function get_phone_number( $context = 'view' ) {
900
-		return $this->get_phone( $context );
899
+	public function get_phone_number($context = 'view') {
900
+		return $this->get_phone($context);
901 901
     }
902 902
 
903 903
     /**
@@ -907,8 +907,8 @@  discard block
 block discarded – undo
907 907
 	 * @param  string $context View or edit context.
908 908
 	 * @return int
909 909
 	 */
910
-	public function get_user_phone( $context = 'view' ) {
911
-		return $this->get_phone( $context );
910
+	public function get_user_phone($context = 'view') {
911
+		return $this->get_phone($context);
912 912
     }
913 913
 
914 914
     /**
@@ -918,8 +918,8 @@  discard block
 block discarded – undo
918 918
 	 * @param  string $context View or edit context.
919 919
 	 * @return int
920 920
 	 */
921
-	public function get_customer_phone( $context = 'view' ) {
922
-		return $this->get_phone( $context );
921
+	public function get_customer_phone($context = 'view') {
922
+		return $this->get_phone($context);
923 923
     }
924 924
 
925 925
     /**
@@ -929,8 +929,8 @@  discard block
 block discarded – undo
929 929
 	 * @param  string $context View or edit context.
930 930
 	 * @return string
931 931
 	 */
932
-	public function get_email( $context = 'view' ) {
933
-		return $this->get_prop( 'email', $context );
932
+	public function get_email($context = 'view') {
933
+		return $this->get_prop('email', $context);
934 934
     }
935 935
 
936 936
     /**
@@ -940,8 +940,8 @@  discard block
 block discarded – undo
940 940
 	 * @param  string $context View or edit context.
941 941
 	 * @return string
942 942
 	 */
943
-	public function get_email_address( $context = 'view' ) {
944
-		return $this->get_email( $context );
943
+	public function get_email_address($context = 'view') {
944
+		return $this->get_email($context);
945 945
     }
946 946
 
947 947
     /**
@@ -951,8 +951,8 @@  discard block
 block discarded – undo
951 951
 	 * @param  string $context View or edit context.
952 952
 	 * @return int
953 953
 	 */
954
-	public function get_user_email( $context = 'view' ) {
955
-		return $this->get_email( $context );
954
+	public function get_user_email($context = 'view') {
955
+		return $this->get_email($context);
956 956
     }
957 957
 
958 958
     /**
@@ -962,8 +962,8 @@  discard block
 block discarded – undo
962 962
 	 * @param  string $context View or edit context.
963 963
 	 * @return int
964 964
 	 */
965
-	public function get_customer_email( $context = 'view' ) {
966
-		return $this->get_email( $context );
965
+	public function get_customer_email($context = 'view') {
966
+		return $this->get_email($context);
967 967
     }
968 968
 
969 969
     /**
@@ -973,9 +973,9 @@  discard block
 block discarded – undo
973 973
 	 * @param  string $context View or edit context.
974 974
 	 * @return string
975 975
 	 */
976
-	public function get_country( $context = 'view' ) {
977
-		$country = $this->get_prop( 'country', $context );
978
-		return empty( $country ) ? wpinv_get_default_country() : $country;
976
+	public function get_country($context = 'view') {
977
+		$country = $this->get_prop('country', $context);
978
+		return empty($country) ? wpinv_get_default_country() : $country;
979 979
     }
980 980
 
981 981
     /**
@@ -985,8 +985,8 @@  discard block
 block discarded – undo
985 985
 	 * @param  string $context View or edit context.
986 986
 	 * @return int
987 987
 	 */
988
-	public function get_user_country( $context = 'view' ) {
989
-		return $this->get_country( $context );
988
+	public function get_user_country($context = 'view') {
989
+		return $this->get_country($context);
990 990
     }
991 991
 
992 992
     /**
@@ -996,8 +996,8 @@  discard block
 block discarded – undo
996 996
 	 * @param  string $context View or edit context.
997 997
 	 * @return int
998 998
 	 */
999
-	public function get_customer_country( $context = 'view' ) {
1000
-		return $this->get_country( $context );
999
+	public function get_customer_country($context = 'view') {
1000
+		return $this->get_country($context);
1001 1001
     }
1002 1002
 
1003 1003
     /**
@@ -1007,9 +1007,9 @@  discard block
 block discarded – undo
1007 1007
 	 * @param  string $context View or edit context.
1008 1008
 	 * @return string
1009 1009
 	 */
1010
-	public function get_state( $context = 'view' ) {
1011
-		$state = $this->get_prop( 'state', $context );
1012
-		return empty( $state ) ? wpinv_get_default_state() : $state;
1010
+	public function get_state($context = 'view') {
1011
+		$state = $this->get_prop('state', $context);
1012
+		return empty($state) ? wpinv_get_default_state() : $state;
1013 1013
     }
1014 1014
 
1015 1015
     /**
@@ -1019,8 +1019,8 @@  discard block
 block discarded – undo
1019 1019
 	 * @param  string $context View or edit context.
1020 1020
 	 * @return int
1021 1021
 	 */
1022
-	public function get_user_state( $context = 'view' ) {
1023
-		return $this->get_state( $context );
1022
+	public function get_user_state($context = 'view') {
1023
+		return $this->get_state($context);
1024 1024
     }
1025 1025
 
1026 1026
     /**
@@ -1030,8 +1030,8 @@  discard block
 block discarded – undo
1030 1030
 	 * @param  string $context View or edit context.
1031 1031
 	 * @return int
1032 1032
 	 */
1033
-	public function get_customer_state( $context = 'view' ) {
1034
-		return $this->get_state( $context );
1033
+	public function get_customer_state($context = 'view') {
1034
+		return $this->get_state($context);
1035 1035
     }
1036 1036
 
1037 1037
     /**
@@ -1041,8 +1041,8 @@  discard block
 block discarded – undo
1041 1041
 	 * @param  string $context View or edit context.
1042 1042
 	 * @return string
1043 1043
 	 */
1044
-	public function get_city( $context = 'view' ) {
1045
-		return $this->get_prop( 'city', $context );
1044
+	public function get_city($context = 'view') {
1045
+		return $this->get_prop('city', $context);
1046 1046
     }
1047 1047
 
1048 1048
     /**
@@ -1052,8 +1052,8 @@  discard block
 block discarded – undo
1052 1052
 	 * @param  string $context View or edit context.
1053 1053
 	 * @return string
1054 1054
 	 */
1055
-	public function get_user_city( $context = 'view' ) {
1056
-		return $this->get_city( $context );
1055
+	public function get_user_city($context = 'view') {
1056
+		return $this->get_city($context);
1057 1057
     }
1058 1058
 
1059 1059
     /**
@@ -1063,8 +1063,8 @@  discard block
 block discarded – undo
1063 1063
 	 * @param  string $context View or edit context.
1064 1064
 	 * @return string
1065 1065
 	 */
1066
-	public function get_customer_city( $context = 'view' ) {
1067
-		return $this->get_city( $context );
1066
+	public function get_customer_city($context = 'view') {
1067
+		return $this->get_city($context);
1068 1068
     }
1069 1069
 
1070 1070
     /**
@@ -1074,8 +1074,8 @@  discard block
 block discarded – undo
1074 1074
 	 * @param  string $context View or edit context.
1075 1075
 	 * @return string
1076 1076
 	 */
1077
-	public function get_zip( $context = 'view' ) {
1078
-		return $this->get_prop( 'zip', $context );
1077
+	public function get_zip($context = 'view') {
1078
+		return $this->get_prop('zip', $context);
1079 1079
     }
1080 1080
 
1081 1081
     /**
@@ -1085,8 +1085,8 @@  discard block
 block discarded – undo
1085 1085
 	 * @param  string $context View or edit context.
1086 1086
 	 * @return string
1087 1087
 	 */
1088
-	public function get_user_zip( $context = 'view' ) {
1089
-		return $this->get_zip( $context );
1088
+	public function get_user_zip($context = 'view') {
1089
+		return $this->get_zip($context);
1090 1090
     }
1091 1091
 
1092 1092
     /**
@@ -1096,8 +1096,8 @@  discard block
 block discarded – undo
1096 1096
 	 * @param  string $context View or edit context.
1097 1097
 	 * @return string
1098 1098
 	 */
1099
-	public function get_customer_zip( $context = 'view' ) {
1100
-		return $this->get_zip( $context );
1099
+	public function get_customer_zip($context = 'view') {
1100
+		return $this->get_zip($context);
1101 1101
     }
1102 1102
 
1103 1103
     /**
@@ -1107,8 +1107,8 @@  discard block
 block discarded – undo
1107 1107
 	 * @param  string $context View or edit context.
1108 1108
 	 * @return string
1109 1109
 	 */
1110
-	public function get_company( $context = 'view' ) {
1111
-		return $this->get_prop( 'company', $context );
1110
+	public function get_company($context = 'view') {
1111
+		return $this->get_prop('company', $context);
1112 1112
     }
1113 1113
 
1114 1114
     /**
@@ -1118,8 +1118,8 @@  discard block
 block discarded – undo
1118 1118
 	 * @param  string $context View or edit context.
1119 1119
 	 * @return string
1120 1120
 	 */
1121
-	public function get_user_company( $context = 'view' ) {
1122
-		return $this->get_company( $context );
1121
+	public function get_user_company($context = 'view') {
1122
+		return $this->get_company($context);
1123 1123
     }
1124 1124
 
1125 1125
     /**
@@ -1129,8 +1129,8 @@  discard block
 block discarded – undo
1129 1129
 	 * @param  string $context View or edit context.
1130 1130
 	 * @return string
1131 1131
 	 */
1132
-	public function get_customer_company( $context = 'view' ) {
1133
-		return $this->get_company( $context );
1132
+	public function get_customer_company($context = 'view') {
1133
+		return $this->get_company($context);
1134 1134
     }
1135 1135
 
1136 1136
     /**
@@ -1140,8 +1140,8 @@  discard block
 block discarded – undo
1140 1140
 	 * @param  string $context View or edit context.
1141 1141
 	 * @return string
1142 1142
 	 */
1143
-	public function get_vat_number( $context = 'view' ) {
1144
-		return $this->get_prop( 'vat_number', $context );
1143
+	public function get_vat_number($context = 'view') {
1144
+		return $this->get_prop('vat_number', $context);
1145 1145
     }
1146 1146
 
1147 1147
     /**
@@ -1151,8 +1151,8 @@  discard block
 block discarded – undo
1151 1151
 	 * @param  string $context View or edit context.
1152 1152
 	 * @return string
1153 1153
 	 */
1154
-	public function get_user_vat_number( $context = 'view' ) {
1155
-		return $this->get_vat_number( $context );
1154
+	public function get_user_vat_number($context = 'view') {
1155
+		return $this->get_vat_number($context);
1156 1156
     }
1157 1157
 
1158 1158
     /**
@@ -1162,8 +1162,8 @@  discard block
 block discarded – undo
1162 1162
 	 * @param  string $context View or edit context.
1163 1163
 	 * @return string
1164 1164
 	 */
1165
-	public function get_customer_vat_number( $context = 'view' ) {
1166
-		return $this->get_vat_number( $context );
1165
+	public function get_customer_vat_number($context = 'view') {
1166
+		return $this->get_vat_number($context);
1167 1167
     }
1168 1168
 
1169 1169
     /**
@@ -1173,8 +1173,8 @@  discard block
 block discarded – undo
1173 1173
 	 * @param  string $context View or edit context.
1174 1174
 	 * @return string
1175 1175
 	 */
1176
-	public function get_vat_rate( $context = 'view' ) {
1177
-		return $this->get_prop( 'vat_rate', $context );
1176
+	public function get_vat_rate($context = 'view') {
1177
+		return $this->get_prop('vat_rate', $context);
1178 1178
     }
1179 1179
 
1180 1180
     /**
@@ -1184,8 +1184,8 @@  discard block
 block discarded – undo
1184 1184
 	 * @param  string $context View or edit context.
1185 1185
 	 * @return string
1186 1186
 	 */
1187
-	public function get_user_vat_rate( $context = 'view' ) {
1188
-		return $this->get_vat_rate( $context );
1187
+	public function get_user_vat_rate($context = 'view') {
1188
+		return $this->get_vat_rate($context);
1189 1189
     }
1190 1190
 
1191 1191
     /**
@@ -1195,8 +1195,8 @@  discard block
 block discarded – undo
1195 1195
 	 * @param  string $context View or edit context.
1196 1196
 	 * @return string
1197 1197
 	 */
1198
-	public function get_customer_vat_rate( $context = 'view' ) {
1199
-		return $this->get_vat_rate( $context );
1198
+	public function get_customer_vat_rate($context = 'view') {
1199
+		return $this->get_vat_rate($context);
1200 1200
     }
1201 1201
 
1202 1202
     /**
@@ -1206,8 +1206,8 @@  discard block
 block discarded – undo
1206 1206
 	 * @param  string $context View or edit context.
1207 1207
 	 * @return string
1208 1208
 	 */
1209
-	public function get_address( $context = 'view' ) {
1210
-		return $this->get_prop( 'address', $context );
1209
+	public function get_address($context = 'view') {
1210
+		return $this->get_prop('address', $context);
1211 1211
     }
1212 1212
 
1213 1213
     /**
@@ -1217,8 +1217,8 @@  discard block
 block discarded – undo
1217 1217
 	 * @param  string $context View or edit context.
1218 1218
 	 * @return string
1219 1219
 	 */
1220
-	public function get_user_address( $context = 'view' ) {
1221
-		return $this->get_address( $context );
1220
+	public function get_user_address($context = 'view') {
1221
+		return $this->get_address($context);
1222 1222
     }
1223 1223
 
1224 1224
     /**
@@ -1228,8 +1228,8 @@  discard block
 block discarded – undo
1228 1228
 	 * @param  string $context View or edit context.
1229 1229
 	 * @return string
1230 1230
 	 */
1231
-	public function get_customer_address( $context = 'view' ) {
1232
-		return $this->get_address( $context );
1231
+	public function get_customer_address($context = 'view') {
1232
+		return $this->get_address($context);
1233 1233
     }
1234 1234
 
1235 1235
     /**
@@ -1239,8 +1239,8 @@  discard block
 block discarded – undo
1239 1239
 	 * @param  string $context View or edit context.
1240 1240
 	 * @return bool
1241 1241
 	 */
1242
-	public function get_is_viewed( $context = 'view' ) {
1243
-		return (bool) $this->get_prop( 'is_viewed', $context );
1242
+	public function get_is_viewed($context = 'view') {
1243
+		return (bool) $this->get_prop('is_viewed', $context);
1244 1244
 	}
1245 1245
 
1246 1246
 	/**
@@ -1250,8 +1250,8 @@  discard block
 block discarded – undo
1250 1250
 	 * @param  string $context View or edit context.
1251 1251
 	 * @return bool
1252 1252
 	 */
1253
-	public function get_email_cc( $context = 'view' ) {
1254
-		return $this->get_prop( 'email_cc', $context );
1253
+	public function get_email_cc($context = 'view') {
1254
+		return $this->get_prop('email_cc', $context);
1255 1255
 	}
1256 1256
 
1257 1257
 	/**
@@ -1261,8 +1261,8 @@  discard block
 block discarded – undo
1261 1261
 	 * @param  string $context View or edit context.
1262 1262
 	 * @return bool
1263 1263
 	 */
1264
-	public function get_template( $context = 'view' ) {
1265
-		return $this->get_prop( 'template', $context );
1264
+	public function get_template($context = 'view') {
1265
+		return $this->get_prop('template', $context);
1266 1266
 	}
1267 1267
 
1268 1268
 	/**
@@ -1272,8 +1272,8 @@  discard block
 block discarded – undo
1272 1272
 	 * @param  string $context View or edit context.
1273 1273
 	 * @return bool
1274 1274
 	 */
1275
-	public function get_address_confirmed( $context = 'view' ) {
1276
-		return (bool) $this->get_prop( 'address_confirmed', $context );
1275
+	public function get_address_confirmed($context = 'view') {
1276
+		return (bool) $this->get_prop('address_confirmed', $context);
1277 1277
     }
1278 1278
 
1279 1279
     /**
@@ -1283,8 +1283,8 @@  discard block
 block discarded – undo
1283 1283
 	 * @param  string $context View or edit context.
1284 1284
 	 * @return bool
1285 1285
 	 */
1286
-	public function get_user_address_confirmed( $context = 'view' ) {
1287
-		return $this->get_address_confirmed( $context );
1286
+	public function get_user_address_confirmed($context = 'view') {
1287
+		return $this->get_address_confirmed($context);
1288 1288
     }
1289 1289
 
1290 1290
     /**
@@ -1294,8 +1294,8 @@  discard block
 block discarded – undo
1294 1294
 	 * @param  string $context View or edit context.
1295 1295
 	 * @return bool
1296 1296
 	 */
1297
-	public function get_customer_address_confirmed( $context = 'view' ) {
1298
-		return $this->get_address_confirmed( $context );
1297
+	public function get_customer_address_confirmed($context = 'view') {
1298
+		return $this->get_address_confirmed($context);
1299 1299
     }
1300 1300
 
1301 1301
     /**
@@ -1305,12 +1305,12 @@  discard block
 block discarded – undo
1305 1305
 	 * @param  string $context View or edit context.
1306 1306
 	 * @return float
1307 1307
 	 */
1308
-	public function get_subtotal( $context = 'view' ) {
1309
-        $subtotal = (float) $this->get_prop( 'subtotal', $context );
1308
+	public function get_subtotal($context = 'view') {
1309
+        $subtotal = (float) $this->get_prop('subtotal', $context);
1310 1310
 
1311 1311
         // Backwards compatibility.
1312
-        if ( is_bool( $context ) && $context ) {
1313
-            return wpinv_price( wpinv_format_amount( $subtotal ), $this->get_currency() );
1312
+        if (is_bool($context) && $context) {
1313
+            return wpinv_price(wpinv_format_amount($subtotal), $this->get_currency());
1314 1314
         }
1315 1315
 
1316 1316
         return $subtotal;
@@ -1323,8 +1323,8 @@  discard block
 block discarded – undo
1323 1323
 	 * @param  string $context View or edit context.
1324 1324
 	 * @return float
1325 1325
 	 */
1326
-	public function get_total_discount( $context = 'view' ) {
1327
-		return (float) $this->get_prop( 'total_discount', $context );
1326
+	public function get_total_discount($context = 'view') {
1327
+		return (float) $this->get_prop('total_discount', $context);
1328 1328
     }
1329 1329
 
1330 1330
     /**
@@ -1334,18 +1334,18 @@  discard block
 block discarded – undo
1334 1334
 	 * @param  string $context View or edit context.
1335 1335
 	 * @return float
1336 1336
 	 */
1337
-	public function get_total_tax( $context = 'view' ) {
1338
-		return (float) $this->get_prop( 'total_tax', $context );
1337
+	public function get_total_tax($context = 'view') {
1338
+		return (float) $this->get_prop('total_tax', $context);
1339 1339
 	}
1340 1340
 
1341 1341
 	/**
1342 1342
 	 * @deprecated
1343 1343
 	 */
1344
-	public function get_final_tax( $currency = false ) {
1344
+	public function get_final_tax($currency = false) {
1345 1345
 		$tax = $this->get_total_tax();
1346 1346
 
1347
-        if ( $currency ) {
1348
-			return wpinv_price( wpinv_format_amount( $tax, NULL, false ), $this->get_currency() );
1347
+        if ($currency) {
1348
+			return wpinv_price(wpinv_format_amount($tax, NULL, false), $this->get_currency());
1349 1349
         }
1350 1350
 
1351 1351
         return $tax;
@@ -1358,8 +1358,8 @@  discard block
 block discarded – undo
1358 1358
 	 * @param  string $context View or edit context.
1359 1359
 	 * @return float
1360 1360
 	 */
1361
-	public function get_total_fees( $context = 'view' ) {
1362
-		return (float) $this->get_prop( 'total_fees', $context );
1361
+	public function get_total_fees($context = 'view') {
1362
+		return (float) $this->get_prop('total_fees', $context);
1363 1363
     }
1364 1364
 
1365 1365
     /**
@@ -1369,8 +1369,8 @@  discard block
 block discarded – undo
1369 1369
 	 * @param  string $context View or edit context.
1370 1370
 	 * @return float
1371 1371
 	 */
1372
-	public function get_fees_total( $context = 'view' ) {
1373
-		return $this->get_total_fees( $context );
1372
+	public function get_fees_total($context = 'view') {
1373
+		return $this->get_total_fees($context);
1374 1374
     }
1375 1375
 
1376 1376
     /**
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
 	 */
1382 1382
 	public function get_total() {
1383 1383
 		$total = $this->is_renewal() ? $this->get_recurring_total() : $this->get_initial_total();
1384
-		return apply_filters( 'getpaid_get_invoice_total_amount', $total, $this  );
1384
+		return apply_filters('getpaid_get_invoice_total_amount', $total, $this);
1385 1385
     }
1386 1386
 
1387 1387
     /**
@@ -1393,7 +1393,7 @@  discard block
 block discarded – undo
1393 1393
 	 */
1394 1394
     public function get_initial_total() {
1395 1395
 
1396
-		if ( empty( $this->totals ) ) {
1396
+		if (empty($this->totals)) {
1397 1397
 			$this->recalculate_total();
1398 1398
 		}
1399 1399
 
@@ -1403,11 +1403,11 @@  discard block
 block discarded – undo
1403 1403
 		$subtotal = $this->totals['subtotal']['initial'];
1404 1404
 		$total    = $tax + $fee - $discount + $subtotal;
1405 1405
 
1406
-		if ( 0 > $total ) {
1406
+		if (0 > $total) {
1407 1407
 			$total = 0;
1408 1408
 		}
1409 1409
 
1410
-        return apply_filters( 'wpinv_get_initial_invoice_total', $total, $this );
1410
+        return apply_filters('wpinv_get_initial_invoice_total', $total, $this);
1411 1411
 	}
1412 1412
 
1413 1413
 	/**
@@ -1419,7 +1419,7 @@  discard block
 block discarded – undo
1419 1419
 	 */
1420 1420
     public function get_recurring_total() {
1421 1421
 
1422
-		if ( empty( $this->totals ) ) {
1422
+		if (empty($this->totals)) {
1423 1423
 			$this->recalculate_total();
1424 1424
 		}
1425 1425
 
@@ -1429,11 +1429,11 @@  discard block
 block discarded – undo
1429 1429
 		$subtotal = $this->totals['subtotal']['recurring'];
1430 1430
 		$total    = $tax + $fee - $discount + $subtotal;
1431 1431
 
1432
-		if ( 0 > $total ) {
1432
+		if (0 > $total) {
1433 1433
 			$total = 0;
1434 1434
 		}
1435 1435
 
1436
-        return apply_filters( 'wpinv_get_recurring_invoice_total', $total, $this );
1436
+        return apply_filters('wpinv_get_recurring_invoice_total', $total, $this);
1437 1437
 	}
1438 1438
 
1439 1439
 	/**
@@ -1444,10 +1444,10 @@  discard block
 block discarded – undo
1444 1444
 	 * @param string $currency Whether to include the currency.
1445 1445
      * @return float
1446 1446
 	 */
1447
-    public function get_recurring_details( $field = '', $currency = false ) {
1447
+    public function get_recurring_details($field = '', $currency = false) {
1448 1448
 
1449 1449
 		// Maybe recalculate totals.
1450
-		if ( empty( $this->totals ) ) {
1450
+		if (empty($this->totals)) {
1451 1451
 			$this->recalculate_total();
1452 1452
 		}
1453 1453
 
@@ -1467,8 +1467,8 @@  discard block
 block discarded – undo
1467 1467
 			$currency
1468 1468
 		);
1469 1469
 
1470
-        if ( isset( $data[$field] ) ) {
1471
-            return ( $currency ? wpinv_price( $data[$field], $this->get_currency() ) : $data[$field] );
1470
+        if (isset($data[$field])) {
1471
+            return ($currency ? wpinv_price($data[$field], $this->get_currency()) : $data[$field]);
1472 1472
         }
1473 1473
 
1474 1474
         return $data;
@@ -1481,8 +1481,8 @@  discard block
 block discarded – undo
1481 1481
 	 * @param  string $context View or edit context.
1482 1482
 	 * @return array
1483 1483
 	 */
1484
-	public function get_fees( $context = 'view' ) {
1485
-		return wpinv_parse_list( $this->get_prop( 'fees', $context ) );
1484
+	public function get_fees($context = 'view') {
1485
+		return wpinv_parse_list($this->get_prop('fees', $context));
1486 1486
     }
1487 1487
 
1488 1488
     /**
@@ -1492,8 +1492,8 @@  discard block
 block discarded – undo
1492 1492
 	 * @param  string $context View or edit context.
1493 1493
 	 * @return array
1494 1494
 	 */
1495
-	public function get_discounts( $context = 'view' ) {
1496
-		return wpinv_parse_list( $this->get_prop( 'discounts', $context ) );
1495
+	public function get_discounts($context = 'view') {
1496
+		return wpinv_parse_list($this->get_prop('discounts', $context));
1497 1497
     }
1498 1498
 
1499 1499
     /**
@@ -1503,8 +1503,8 @@  discard block
 block discarded – undo
1503 1503
 	 * @param  string $context View or edit context.
1504 1504
 	 * @return array
1505 1505
 	 */
1506
-	public function get_taxes( $context = 'view' ) {
1507
-		return wpinv_parse_list( $this->get_prop( 'taxes', $context ) );
1506
+	public function get_taxes($context = 'view') {
1507
+		return wpinv_parse_list($this->get_prop('taxes', $context));
1508 1508
     }
1509 1509
 
1510 1510
     /**
@@ -1514,8 +1514,8 @@  discard block
 block discarded – undo
1514 1514
 	 * @param  string $context View or edit context.
1515 1515
 	 * @return GetPaid_Form_Item[]
1516 1516
 	 */
1517
-	public function get_items( $context = 'view' ) {
1518
-        return $this->get_prop( 'items', $context );
1517
+	public function get_items($context = 'view') {
1518
+        return $this->get_prop('items', $context);
1519 1519
     }
1520 1520
 
1521 1521
     /**
@@ -1525,8 +1525,8 @@  discard block
 block discarded – undo
1525 1525
 	 * @param  string $context View or edit context.
1526 1526
 	 * @return int
1527 1527
 	 */
1528
-	public function get_payment_form( $context = 'view' ) {
1529
-		return intval( $this->get_prop( 'payment_form', $context ) );
1528
+	public function get_payment_form($context = 'view') {
1529
+		return intval($this->get_prop('payment_form', $context));
1530 1530
     }
1531 1531
 
1532 1532
     /**
@@ -1536,8 +1536,8 @@  discard block
 block discarded – undo
1536 1536
 	 * @param  string $context View or edit context.
1537 1537
 	 * @return string
1538 1538
 	 */
1539
-	public function get_submission_id( $context = 'view' ) {
1540
-		return $this->get_prop( 'submission_id', $context );
1539
+	public function get_submission_id($context = 'view') {
1540
+		return $this->get_prop('submission_id', $context);
1541 1541
     }
1542 1542
 
1543 1543
     /**
@@ -1547,8 +1547,8 @@  discard block
 block discarded – undo
1547 1547
 	 * @param  string $context View or edit context.
1548 1548
 	 * @return string
1549 1549
 	 */
1550
-	public function get_discount_code( $context = 'view' ) {
1551
-		return $this->get_prop( 'discount_code', $context );
1550
+	public function get_discount_code($context = 'view') {
1551
+		return $this->get_prop('discount_code', $context);
1552 1552
     }
1553 1553
 
1554 1554
     /**
@@ -1558,8 +1558,8 @@  discard block
 block discarded – undo
1558 1558
 	 * @param  string $context View or edit context.
1559 1559
 	 * @return string
1560 1560
 	 */
1561
-	public function get_gateway( $context = 'view' ) {
1562
-		return $this->get_prop( 'gateway', $context );
1561
+	public function get_gateway($context = 'view') {
1562
+		return $this->get_prop('gateway', $context);
1563 1563
     }
1564 1564
 
1565 1565
     /**
@@ -1569,8 +1569,8 @@  discard block
 block discarded – undo
1569 1569
 	 * @return string
1570 1570
 	 */
1571 1571
     public function get_gateway_title() {
1572
-        $title =  wpinv_get_gateway_checkout_label( $this->get_gateway() );
1573
-        return apply_filters( 'wpinv_gateway_title', $title, $this->get_id(), $this );
1572
+        $title = wpinv_get_gateway_checkout_label($this->get_gateway());
1573
+        return apply_filters('wpinv_gateway_title', $title, $this->get_id(), $this);
1574 1574
     }
1575 1575
 
1576 1576
     /**
@@ -1580,8 +1580,8 @@  discard block
 block discarded – undo
1580 1580
 	 * @param  string $context View or edit context.
1581 1581
 	 * @return string
1582 1582
 	 */
1583
-	public function get_transaction_id( $context = 'view' ) {
1584
-		return $this->get_prop( 'transaction_id', $context );
1583
+	public function get_transaction_id($context = 'view') {
1584
+		return $this->get_prop('transaction_id', $context);
1585 1585
     }
1586 1586
 
1587 1587
     /**
@@ -1591,9 +1591,9 @@  discard block
 block discarded – undo
1591 1591
 	 * @param  string $context View or edit context.
1592 1592
 	 * @return string
1593 1593
 	 */
1594
-	public function get_currency( $context = 'view' ) {
1595
-        $currency = $this->get_prop( 'currency', $context );
1596
-        return empty( $currency ) ? wpinv_get_currency() : $currency;
1594
+	public function get_currency($context = 'view') {
1595
+        $currency = $this->get_prop('currency', $context);
1596
+        return empty($currency) ? wpinv_get_currency() : $currency;
1597 1597
     }
1598 1598
 
1599 1599
     /**
@@ -1603,8 +1603,8 @@  discard block
 block discarded – undo
1603 1603
 	 * @param  string $context View or edit context.
1604 1604
 	 * @return bool
1605 1605
 	 */
1606
-	public function get_disable_taxes( $context = 'view' ) {
1607
-        return (bool) $this->get_prop( 'disable_taxes', $context );
1606
+	public function get_disable_taxes($context = 'view') {
1607
+        return (bool) $this->get_prop('disable_taxes', $context);
1608 1608
     }
1609 1609
 
1610 1610
     /**
@@ -1614,12 +1614,12 @@  discard block
 block discarded – undo
1614 1614
 	 * @param  string $context View or edit context.
1615 1615
 	 * @return int
1616 1616
 	 */
1617
-    public function get_subscription_id( $context = 'view' ) {
1618
-        $subscription_id = $this->get_prop( 'subscription_id', $context );
1617
+    public function get_subscription_id($context = 'view') {
1618
+        $subscription_id = $this->get_prop('subscription_id', $context);
1619 1619
 
1620
-        if ( empty( $subscription_id ) && $this->is_renewal() ) {
1620
+        if (empty($subscription_id) && $this->is_renewal()) {
1621 1621
             $parent = $this->get_parent();
1622
-            return $parent->get_subscription_id( $context );
1622
+            return $parent->get_subscription_id($context);
1623 1623
         }
1624 1624
 
1625 1625
         return $subscription_id;
@@ -1632,20 +1632,20 @@  discard block
 block discarded – undo
1632 1632
 	 * @param  string $context View or edit context.
1633 1633
 	 * @return array
1634 1634
 	 */
1635
-    public function get_payment_meta( $context = 'view' ) {
1635
+    public function get_payment_meta($context = 'view') {
1636 1636
 
1637 1637
         return array(
1638
-            'price'        => $this->get_total( $context ),
1639
-            'date'         => $this->get_date_created( $context ),
1640
-            'user_email'   => $this->get_email( $context ),
1641
-            'invoice_key'  => $this->get_key( $context ),
1642
-            'currency'     => $this->get_currency( $context ),
1643
-            'items'        => $this->get_items( $context ),
1644
-            'user_info'    => $this->get_user_info( $context ),
1638
+            'price'        => $this->get_total($context),
1639
+            'date'         => $this->get_date_created($context),
1640
+            'user_email'   => $this->get_email($context),
1641
+            'invoice_key'  => $this->get_key($context),
1642
+            'currency'     => $this->get_currency($context),
1643
+            'items'        => $this->get_items($context),
1644
+            'user_info'    => $this->get_user_info($context),
1645 1645
             'cart_details' => $this->get_cart_details(),
1646
-            'status'       => $this->get_status( $context ),
1647
-            'fees'         => $this->get_fees( $context ),
1648
-            'taxes'        => $this->get_taxes( $context ),
1646
+            'status'       => $this->get_status($context),
1647
+            'fees'         => $this->get_fees($context),
1648
+            'taxes'        => $this->get_taxes($context),
1649 1649
         );
1650 1650
 
1651 1651
     }
@@ -1660,7 +1660,7 @@  discard block
 block discarded – undo
1660 1660
         $items        = $this->get_items();
1661 1661
         $cart_details = array();
1662 1662
 
1663
-        foreach ( $items as $item_id => $item ) {
1663
+        foreach ($items as $item_id => $item) {
1664 1664
             $cart_details[] = $item->prepare_data_for_saving();
1665 1665
         }
1666 1666
 
@@ -1672,11 +1672,11 @@  discard block
 block discarded – undo
1672 1672
 	 *
1673 1673
 	 * @return null|GetPaid_Form_Item
1674 1674
 	 */
1675
-	public function get_recurring( $object = false ) {
1675
+	public function get_recurring($object = false) {
1676 1676
 
1677 1677
 		// Are we returning an object?
1678
-        if ( $object ) {
1679
-            return $this->get_item( $this->recurring_item );
1678
+        if ($object) {
1679
+            return $this->get_item($this->recurring_item);
1680 1680
         }
1681 1681
 
1682 1682
         return $this->recurring_item;
@@ -1691,15 +1691,15 @@  discard block
 block discarded – undo
1691 1691
 	public function get_subscription_name() {
1692 1692
 
1693 1693
 		// Retrieve the recurring name
1694
-        $item = $this->get_recurring( true );
1694
+        $item = $this->get_recurring(true);
1695 1695
 
1696 1696
 		// Abort if it does not exist.
1697
-        if ( empty( $item ) ) {
1697
+        if (empty($item)) {
1698 1698
             return '';
1699 1699
         }
1700 1700
 
1701 1701
 		// Return the item name.
1702
-        return apply_filters( 'wpinv_invoice_get_subscription_name', $item->get_name(), $this );
1702
+        return apply_filters('wpinv_invoice_get_subscription_name', $item->get_name(), $this);
1703 1703
 	}
1704 1704
 
1705 1705
 	/**
@@ -1709,9 +1709,9 @@  discard block
 block discarded – undo
1709 1709
 	 * @return string
1710 1710
 	 */
1711 1711
 	public function get_view_url() {
1712
-        $invoice_url = get_permalink( $this->get_id() );
1713
-		$invoice_url = add_query_arg( 'invoice_key', $this->get_key(), $invoice_url );
1714
-        return apply_filters( 'wpinv_get_view_url', $invoice_url, $this );
1712
+        $invoice_url = get_permalink($this->get_id());
1713
+		$invoice_url = add_query_arg('invoice_key', $this->get_key(), $invoice_url);
1714
+        return apply_filters('wpinv_get_view_url', $invoice_url, $this);
1715 1715
 	}
1716 1716
 
1717 1717
 	/**
@@ -1720,25 +1720,25 @@  discard block
 block discarded – undo
1720 1720
 	 * @since 1.0.19
1721 1721
 	 * @return string
1722 1722
 	 */
1723
-	public function get_checkout_payment_url( $deprecated = false, $secret = false ) {
1723
+	public function get_checkout_payment_url($deprecated = false, $secret = false) {
1724 1724
 
1725 1725
 		// Retrieve the checkout url.
1726 1726
         $pay_url = wpinv_get_checkout_uri();
1727 1727
 
1728 1728
 		// Maybe force ssl.
1729
-        if ( is_ssl() ) {
1730
-            $pay_url = str_replace( 'http:', 'https:', $pay_url );
1729
+        if (is_ssl()) {
1730
+            $pay_url = str_replace('http:', 'https:', $pay_url);
1731 1731
         }
1732 1732
 
1733 1733
 		// Add the invoice key.
1734
-		$pay_url = add_query_arg( 'invoice_key', $this->get_key(), $pay_url );
1734
+		$pay_url = add_query_arg('invoice_key', $this->get_key(), $pay_url);
1735 1735
 
1736 1736
 		// (Maybe?) add a secret
1737
-        if ( $secret ) {
1738
-            $pay_url = add_query_arg( array( '_wpipay' => md5( $this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key() ) ), $pay_url );
1737
+        if ($secret) {
1738
+            $pay_url = add_query_arg(array('_wpipay' => md5($this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key())), $pay_url);
1739 1739
         }
1740 1740
 
1741
-        return apply_filters( 'wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret );
1741
+        return apply_filters('wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret);
1742 1742
 	}
1743 1743
 	
1744 1744
 	/**
@@ -1753,14 +1753,14 @@  discard block
 block discarded – undo
1753 1753
         $receipt_url = wpinv_get_success_page_uri();
1754 1754
 
1755 1755
 		// Maybe force ssl.
1756
-        if ( is_ssl() ) {
1757
-            $receipt_url = str_replace( 'http:', 'https:', $receipt_url );
1756
+        if (is_ssl()) {
1757
+            $receipt_url = str_replace('http:', 'https:', $receipt_url);
1758 1758
         }
1759 1759
 
1760 1760
 		// Add the invoice key.
1761
-		$receipt_url = add_query_arg( 'invoice_key', $this->get_key(), $receipt_url );
1761
+		$receipt_url = add_query_arg('invoice_key', $this->get_key(), $receipt_url);
1762 1762
 
1763
-        return apply_filters( 'getpaid_get_invoice_receipt_url', $receipt_url, $this );
1763
+        return apply_filters('getpaid_get_invoice_receipt_url', $receipt_url, $this);
1764 1764
     }
1765 1765
 
1766 1766
     /**
@@ -1773,8 +1773,8 @@  discard block
 block discarded – undo
1773 1773
 	 * @param  string $context View or edit context.
1774 1774
 	 * @return mixed Value of the given invoice property (if set).
1775 1775
 	 */
1776
-	public function get( $key, $context = 'view' ) {
1777
-        return $this->get_prop( $key, $context );
1776
+	public function get($key, $context = 'view') {
1777
+        return $this->get_prop($key, $context);
1778 1778
 	}
1779 1779
 
1780 1780
     /*
@@ -1797,11 +1797,11 @@  discard block
 block discarded – undo
1797 1797
 	 * @param  mixed $value new value.
1798 1798
 	 * @return mixed Value of the given invoice property (if set).
1799 1799
 	 */
1800
-	public function set( $key, $value ) {
1800
+	public function set($key, $value) {
1801 1801
 
1802 1802
         $setter = "set_$key";
1803
-        if ( is_callable( array( $this, $setter ) ) ) {
1804
-            $this->{$setter}( $value );
1803
+        if (is_callable(array($this, $setter))) {
1804
+            $this->{$setter}($value);
1805 1805
         }
1806 1806
 
1807 1807
 	}
@@ -1815,43 +1815,43 @@  discard block
 block discarded – undo
1815 1815
 	 * @param bool   $manual_update Is this a manual status change?.
1816 1816
 	 * @return array details of change.
1817 1817
 	 */
1818
-	public function set_status( $new_status, $note = '', $manual_update = false ) {
1818
+	public function set_status($new_status, $note = '', $manual_update = false) {
1819 1819
 		$old_status = $this->get_status();
1820 1820
 
1821 1821
 		$statuses = $this->get_all_statuses();
1822 1822
 
1823
-		if ( isset( $statuses[ 'draft' ] ) ) {
1824
-			unset( $statuses[ 'draft' ] );
1823
+		if (isset($statuses['draft'])) {
1824
+			unset($statuses['draft']);
1825 1825
 		}
1826 1826
 
1827 1827
 
1828
-		$this->set_prop( 'status', $new_status );
1828
+		$this->set_prop('status', $new_status);
1829 1829
 
1830 1830
 		// If setting the status, ensure it's set to a valid status.
1831
-		if ( true === $this->object_read ) {
1831
+		if (true === $this->object_read) {
1832 1832
 
1833 1833
 			// Only allow valid new status.
1834
-			if ( ! array_key_exists( $new_status, $statuses ) ) {
1834
+			if (!array_key_exists($new_status, $statuses)) {
1835 1835
 				$new_status = 'wpi-pending';
1836 1836
 			}
1837 1837
 
1838 1838
 			// If the old status is set but unknown (e.g. draft) assume its pending for action usage.
1839
-			if ( $old_status && ! array_key_exists( $new_status, $statuses ) ) {
1839
+			if ($old_status && !array_key_exists($new_status, $statuses)) {
1840 1840
 				$old_status = 'wpi-pending';
1841 1841
 			}
1842 1842
 
1843 1843
 		}
1844 1844
 
1845
-		if ( true === $this->object_read && $old_status !== $new_status ) {
1845
+		if (true === $this->object_read && $old_status !== $new_status) {
1846 1846
 			$this->status_transition = array(
1847
-				'from'   => ! empty( $this->status_transition['from'] ) ? $this->status_transition['from'] : $old_status,
1847
+				'from'   => !empty($this->status_transition['from']) ? $this->status_transition['from'] : $old_status,
1848 1848
 				'to'     => $new_status,
1849 1849
 				'note'   => $note,
1850 1850
 				'manual' => (bool) $manual_update,
1851 1851
 			);
1852 1852
 
1853
-			if ( $manual_update ) {
1854
-				do_action( 'getpaid_' . $this->object_type .'_edit_status', $this->get_id(), $new_status );
1853
+			if ($manual_update) {
1854
+				do_action('getpaid_' . $this->object_type . '_edit_status', $this->get_id(), $new_status);
1855 1855
 			}
1856 1856
 
1857 1857
 			$this->maybe_set_date_paid();
@@ -1874,8 +1874,8 @@  discard block
 block discarded – undo
1874 1874
 	 */
1875 1875
 	public function maybe_set_date_paid() {
1876 1876
 
1877
-		if ( ! $this->get_date_completed( 'edit' ) && $this->is_paid() ) {
1878
-			$this->set_date_completed( current_time( 'mysql' ) );
1877
+		if (!$this->get_date_completed('edit') && $this->is_paid()) {
1878
+			$this->set_date_completed(current_time('mysql'));
1879 1879
 		}
1880 1880
 	}
1881 1881
 
@@ -1884,11 +1884,11 @@  discard block
 block discarded – undo
1884 1884
 	 *
1885 1885
 	 * @since 1.0.19
1886 1886
 	 */
1887
-	public function set_parent_id( $value ) {
1888
-		if ( $value && ( $value === $this->get_id() ) ) {
1887
+	public function set_parent_id($value) {
1888
+		if ($value && ($value === $this->get_id())) {
1889 1889
 			return;
1890 1890
 		}
1891
-		$this->set_prop( 'parent_id', absint( $value ) );
1891
+		$this->set_prop('parent_id', absint($value));
1892 1892
     }
1893 1893
 
1894 1894
     /**
@@ -1896,8 +1896,8 @@  discard block
 block discarded – undo
1896 1896
 	 *
1897 1897
 	 * @since 1.0.19
1898 1898
 	 */
1899
-	public function set_version( $value ) {
1900
-		$this->set_prop( 'version', $value );
1899
+	public function set_version($value) {
1900
+		$this->set_prop('version', $value);
1901 1901
     }
1902 1902
 
1903 1903
     /**
@@ -1907,15 +1907,15 @@  discard block
 block discarded – undo
1907 1907
 	 * @param string $value Value to set.
1908 1908
      * @return bool Whether or not the date was set.
1909 1909
 	 */
1910
-	public function set_date_created( $value ) {
1911
-        $date = strtotime( $value );
1910
+	public function set_date_created($value) {
1911
+        $date = strtotime($value);
1912 1912
 
1913
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
1914
-            $this->set_prop( 'date_created', date( 'Y-m-d H:i:s', $date ) );
1913
+        if ($date && $value !== '0000-00-00 00:00:00') {
1914
+            $this->set_prop('date_created', date('Y-m-d H:i:s', $date));
1915 1915
             return true;
1916 1916
         }
1917 1917
 
1918
-        return $this->set_prop( 'date_created', '' );
1918
+        return $this->set_prop('date_created', '');
1919 1919
 
1920 1920
     }
1921 1921
 
@@ -1926,15 +1926,15 @@  discard block
 block discarded – undo
1926 1926
 	 * @param string $value Value to set.
1927 1927
      * @return bool Whether or not the date was set.
1928 1928
 	 */
1929
-	public function set_due_date( $value ) {
1930
-        $date = strtotime( $value );
1929
+	public function set_due_date($value) {
1930
+        $date = strtotime($value);
1931 1931
 
1932
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
1933
-            $this->set_prop( 'due_date', date( 'Y-m-d H:i:s', $date ) );
1932
+        if ($date && $value !== '0000-00-00 00:00:00') {
1933
+            $this->set_prop('due_date', date('Y-m-d H:i:s', $date));
1934 1934
             return true;
1935 1935
         }
1936 1936
 
1937
-		$this->set_prop( 'due_date', '' );
1937
+		$this->set_prop('due_date', '');
1938 1938
         return false;
1939 1939
 
1940 1940
     }
@@ -1945,8 +1945,8 @@  discard block
 block discarded – undo
1945 1945
 	 * @since 1.0.19
1946 1946
 	 * @param  string $value New name.
1947 1947
 	 */
1948
-	public function set_date_due( $value ) {
1949
-		$this->set_due_date( $value );
1948
+	public function set_date_due($value) {
1949
+		$this->set_due_date($value);
1950 1950
     }
1951 1951
 
1952 1952
     /**
@@ -1956,15 +1956,15 @@  discard block
 block discarded – undo
1956 1956
 	 * @param string $value Value to set.
1957 1957
      * @return bool Whether or not the date was set.
1958 1958
 	 */
1959
-	public function set_completed_date( $value ) {
1960
-        $date = strtotime( $value );
1959
+	public function set_completed_date($value) {
1960
+        $date = strtotime($value);
1961 1961
 
1962
-        if ( $date && $value !== '0000-00-00 00:00:00'  ) {
1963
-            $this->set_prop( 'completed_date', date( 'Y-m-d H:i:s', $date ) );
1962
+        if ($date && $value !== '0000-00-00 00:00:00') {
1963
+            $this->set_prop('completed_date', date('Y-m-d H:i:s', $date));
1964 1964
             return true;
1965 1965
         }
1966 1966
 
1967
-		$this->set_prop( 'completed_date', '' );
1967
+		$this->set_prop('completed_date', '');
1968 1968
         return false;
1969 1969
 
1970 1970
     }
@@ -1975,8 +1975,8 @@  discard block
 block discarded – undo
1975 1975
 	 * @since 1.0.19
1976 1976
 	 * @param  string $value New name.
1977 1977
 	 */
1978
-	public function set_date_completed( $value ) {
1979
-		$this->set_completed_date( $value );
1978
+	public function set_date_completed($value) {
1979
+		$this->set_completed_date($value);
1980 1980
     }
1981 1981
 
1982 1982
     /**
@@ -1986,15 +1986,15 @@  discard block
 block discarded – undo
1986 1986
 	 * @param string $value Value to set.
1987 1987
      * @return bool Whether or not the date was set.
1988 1988
 	 */
1989
-	public function set_date_modified( $value ) {
1990
-        $date = strtotime( $value );
1989
+	public function set_date_modified($value) {
1990
+        $date = strtotime($value);
1991 1991
 
1992
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
1993
-            $this->set_prop( 'date_modified', date( 'Y-m-d H:i:s', $date ) );
1992
+        if ($date && $value !== '0000-00-00 00:00:00') {
1993
+            $this->set_prop('date_modified', date('Y-m-d H:i:s', $date));
1994 1994
             return true;
1995 1995
         }
1996 1996
 
1997
-		$this->set_prop( 'date_modified', '' );
1997
+		$this->set_prop('date_modified', '');
1998 1998
         return false;
1999 1999
 
2000 2000
     }
@@ -2005,9 +2005,9 @@  discard block
 block discarded – undo
2005 2005
 	 * @since 1.0.19
2006 2006
 	 * @param  string $value New number.
2007 2007
 	 */
2008
-	public function set_number( $value ) {
2009
-        $number = sanitize_text_field( $value );
2010
-		$this->set_prop( 'number', $number );
2008
+	public function set_number($value) {
2009
+        $number = sanitize_text_field($value);
2010
+		$this->set_prop('number', $number);
2011 2011
     }
2012 2012
 
2013 2013
     /**
@@ -2016,9 +2016,9 @@  discard block
 block discarded – undo
2016 2016
 	 * @since 1.0.19
2017 2017
 	 * @param  string $value Type.
2018 2018
 	 */
2019
-	public function set_type( $value ) {
2020
-        $type = sanitize_text_field( str_replace( 'wpi_', '', $value ) );
2021
-		$this->set_prop( 'type', $type );
2019
+	public function set_type($value) {
2020
+        $type = sanitize_text_field(str_replace('wpi_', '', $value));
2021
+		$this->set_prop('type', $type);
2022 2022
 	}
2023 2023
 
2024 2024
     /**
@@ -2027,10 +2027,10 @@  discard block
 block discarded – undo
2027 2027
 	 * @since 1.0.19
2028 2028
 	 * @param  string $value Post type.
2029 2029
 	 */
2030
-	public function set_post_type( $value ) {
2031
-        if ( getpaid_is_invoice_post_type( $value ) ) {
2032
-			$this->set_type( $value );
2033
-            $this->set_prop( 'post_type', $value );
2030
+	public function set_post_type($value) {
2031
+        if (getpaid_is_invoice_post_type($value)) {
2032
+			$this->set_type($value);
2033
+            $this->set_prop('post_type', $value);
2034 2034
         }
2035 2035
     }
2036 2036
 
@@ -2040,9 +2040,9 @@  discard block
 block discarded – undo
2040 2040
 	 * @since 1.0.19
2041 2041
 	 * @param  string $value New key.
2042 2042
 	 */
2043
-	public function set_key( $value ) {
2044
-        $key = sanitize_text_field( $value );
2045
-		$this->set_prop( 'key', $key );
2043
+	public function set_key($value) {
2044
+        $key = sanitize_text_field($value);
2045
+		$this->set_prop('key', $key);
2046 2046
     }
2047 2047
 
2048 2048
     /**
@@ -2051,9 +2051,9 @@  discard block
 block discarded – undo
2051 2051
 	 * @since 1.0.19
2052 2052
 	 * @param  string $value mode.
2053 2053
 	 */
2054
-	public function set_mode( $value ) {
2055
-        if ( ! in_array( $value, array( 'live', 'test' ) ) ) {
2056
-            $this->set_prop( 'value', $value );
2054
+	public function set_mode($value) {
2055
+        if (!in_array($value, array('live', 'test'))) {
2056
+            $this->set_prop('value', $value);
2057 2057
         }
2058 2058
     }
2059 2059
 
@@ -2063,8 +2063,8 @@  discard block
 block discarded – undo
2063 2063
 	 * @since 1.0.19
2064 2064
 	 * @param  string $value path.
2065 2065
 	 */
2066
-	public function set_path( $value ) {
2067
-        $this->set_prop( 'path', $value );
2066
+	public function set_path($value) {
2067
+        $this->set_prop('path', $value);
2068 2068
     }
2069 2069
 
2070 2070
     /**
@@ -2073,9 +2073,9 @@  discard block
 block discarded – undo
2073 2073
 	 * @since 1.0.19
2074 2074
 	 * @param  string $value New name.
2075 2075
 	 */
2076
-	public function set_name( $value ) {
2077
-        $name = sanitize_text_field( $value );
2078
-		$this->set_prop( 'name', $name );
2076
+	public function set_name($value) {
2077
+        $name = sanitize_text_field($value);
2078
+		$this->set_prop('name', $name);
2079 2079
     }
2080 2080
 
2081 2081
     /**
@@ -2084,8 +2084,8 @@  discard block
 block discarded – undo
2084 2084
 	 * @since 1.0.19
2085 2085
 	 * @param  string $value New name.
2086 2086
 	 */
2087
-	public function set_title( $value ) {
2088
-		$this->set_name( $value );
2087
+	public function set_title($value) {
2088
+		$this->set_name($value);
2089 2089
     }
2090 2090
 
2091 2091
     /**
@@ -2094,9 +2094,9 @@  discard block
 block discarded – undo
2094 2094
 	 * @since 1.0.19
2095 2095
 	 * @param  string $value New description.
2096 2096
 	 */
2097
-	public function set_description( $value ) {
2098
-        $description = wp_kses_post( $value );
2099
-		return $this->set_prop( 'description', $description );
2097
+	public function set_description($value) {
2098
+        $description = wp_kses_post($value);
2099
+		return $this->set_prop('description', $description);
2100 2100
     }
2101 2101
 
2102 2102
     /**
@@ -2105,8 +2105,8 @@  discard block
 block discarded – undo
2105 2105
 	 * @since 1.0.19
2106 2106
 	 * @param  string $value New description.
2107 2107
 	 */
2108
-	public function set_excerpt( $value ) {
2109
-		$this->set_description( $value );
2108
+	public function set_excerpt($value) {
2109
+		$this->set_description($value);
2110 2110
     }
2111 2111
 
2112 2112
     /**
@@ -2115,8 +2115,8 @@  discard block
 block discarded – undo
2115 2115
 	 * @since 1.0.19
2116 2116
 	 * @param  string $value New description.
2117 2117
 	 */
2118
-	public function set_summary( $value ) {
2119
-		$this->set_description( $value );
2118
+	public function set_summary($value) {
2119
+		$this->set_description($value);
2120 2120
     }
2121 2121
 
2122 2122
     /**
@@ -2125,12 +2125,12 @@  discard block
 block discarded – undo
2125 2125
 	 * @since 1.0.19
2126 2126
 	 * @param  int $value New author.
2127 2127
 	 */
2128
-	public function set_author( $value ) {
2129
-		$user = get_user_by( 'id', (int) $value );
2128
+	public function set_author($value) {
2129
+		$user = get_user_by('id', (int) $value);
2130 2130
 
2131
-		if ( $user && $user->ID ) {
2132
-			$this->set_prop( 'author', $user->ID );
2133
-			$this->set_prop( 'email', $user->user_email );
2131
+		if ($user && $user->ID) {
2132
+			$this->set_prop('author', $user->ID);
2133
+			$this->set_prop('email', $user->user_email);
2134 2134
 		}
2135 2135
 		
2136 2136
     }
@@ -2141,8 +2141,8 @@  discard block
 block discarded – undo
2141 2141
 	 * @since 1.0.19
2142 2142
 	 * @param  int $value New user id.
2143 2143
 	 */
2144
-	public function set_user_id( $value ) {
2145
-		$this->set_author( $value );
2144
+	public function set_user_id($value) {
2145
+		$this->set_author($value);
2146 2146
     }
2147 2147
 
2148 2148
     /**
@@ -2151,8 +2151,8 @@  discard block
 block discarded – undo
2151 2151
 	 * @since 1.0.19
2152 2152
 	 * @param  int $value New user id.
2153 2153
 	 */
2154
-	public function set_customer_id( $value ) {
2155
-		$this->set_author( $value );
2154
+	public function set_customer_id($value) {
2155
+		$this->set_author($value);
2156 2156
     }
2157 2157
 
2158 2158
     /**
@@ -2161,8 +2161,8 @@  discard block
 block discarded – undo
2161 2161
 	 * @since 1.0.19
2162 2162
 	 * @param  string $value ip address.
2163 2163
 	 */
2164
-	public function set_ip( $value ) {
2165
-		$this->set_prop( 'ip', $value );
2164
+	public function set_ip($value) {
2165
+		$this->set_prop('ip', $value);
2166 2166
     }
2167 2167
 
2168 2168
     /**
@@ -2171,8 +2171,8 @@  discard block
 block discarded – undo
2171 2171
 	 * @since 1.0.19
2172 2172
 	 * @param  string $value ip address.
2173 2173
 	 */
2174
-	public function set_user_ip( $value ) {
2175
-		$this->set_ip( $value );
2174
+	public function set_user_ip($value) {
2175
+		$this->set_ip($value);
2176 2176
     }
2177 2177
 
2178 2178
     /**
@@ -2181,8 +2181,8 @@  discard block
 block discarded – undo
2181 2181
 	 * @since 1.0.19
2182 2182
 	 * @param  string $value first name.
2183 2183
 	 */
2184
-	public function set_first_name( $value ) {
2185
-		$this->set_prop( 'first_name', $value );
2184
+	public function set_first_name($value) {
2185
+		$this->set_prop('first_name', $value);
2186 2186
     }
2187 2187
 
2188 2188
     /**
@@ -2191,8 +2191,8 @@  discard block
 block discarded – undo
2191 2191
 	 * @since 1.0.19
2192 2192
 	 * @param  string $value first name.
2193 2193
 	 */
2194
-	public function set_user_first_name( $value ) {
2195
-		$this->set_first_name( $value );
2194
+	public function set_user_first_name($value) {
2195
+		$this->set_first_name($value);
2196 2196
     }
2197 2197
 
2198 2198
     /**
@@ -2201,8 +2201,8 @@  discard block
 block discarded – undo
2201 2201
 	 * @since 1.0.19
2202 2202
 	 * @param  string $value first name.
2203 2203
 	 */
2204
-	public function set_customer_first_name( $value ) {
2205
-		$this->set_first_name( $value );
2204
+	public function set_customer_first_name($value) {
2205
+		$this->set_first_name($value);
2206 2206
     }
2207 2207
 
2208 2208
     /**
@@ -2211,8 +2211,8 @@  discard block
 block discarded – undo
2211 2211
 	 * @since 1.0.19
2212 2212
 	 * @param  string $value last name.
2213 2213
 	 */
2214
-	public function set_last_name( $value ) {
2215
-		$this->set_prop( 'last_name', $value );
2214
+	public function set_last_name($value) {
2215
+		$this->set_prop('last_name', $value);
2216 2216
     }
2217 2217
 
2218 2218
     /**
@@ -2221,8 +2221,8 @@  discard block
 block discarded – undo
2221 2221
 	 * @since 1.0.19
2222 2222
 	 * @param  string $value last name.
2223 2223
 	 */
2224
-	public function set_user_last_name( $value ) {
2225
-		$this->set_last_name( $value );
2224
+	public function set_user_last_name($value) {
2225
+		$this->set_last_name($value);
2226 2226
     }
2227 2227
 
2228 2228
     /**
@@ -2231,8 +2231,8 @@  discard block
 block discarded – undo
2231 2231
 	 * @since 1.0.19
2232 2232
 	 * @param  string $value last name.
2233 2233
 	 */
2234
-	public function set_customer_last_name( $value ) {
2235
-		$this->set_last_name( $value );
2234
+	public function set_customer_last_name($value) {
2235
+		$this->set_last_name($value);
2236 2236
     }
2237 2237
 
2238 2238
     /**
@@ -2241,8 +2241,8 @@  discard block
 block discarded – undo
2241 2241
 	 * @since 1.0.19
2242 2242
 	 * @param  string $value phone.
2243 2243
 	 */
2244
-	public function set_phone( $value ) {
2245
-		$this->set_prop( 'phone', $value );
2244
+	public function set_phone($value) {
2245
+		$this->set_prop('phone', $value);
2246 2246
     }
2247 2247
 
2248 2248
     /**
@@ -2251,8 +2251,8 @@  discard block
 block discarded – undo
2251 2251
 	 * @since 1.0.19
2252 2252
 	 * @param  string $value phone.
2253 2253
 	 */
2254
-	public function set_user_phone( $value ) {
2255
-		$this->set_phone( $value );
2254
+	public function set_user_phone($value) {
2255
+		$this->set_phone($value);
2256 2256
     }
2257 2257
 
2258 2258
     /**
@@ -2261,8 +2261,8 @@  discard block
 block discarded – undo
2261 2261
 	 * @since 1.0.19
2262 2262
 	 * @param  string $value phone.
2263 2263
 	 */
2264
-	public function set_customer_phone( $value ) {
2265
-		$this->set_phone( $value );
2264
+	public function set_customer_phone($value) {
2265
+		$this->set_phone($value);
2266 2266
     }
2267 2267
 
2268 2268
     /**
@@ -2271,8 +2271,8 @@  discard block
 block discarded – undo
2271 2271
 	 * @since 1.0.19
2272 2272
 	 * @param  string $value phone.
2273 2273
 	 */
2274
-	public function set_phone_number( $value ) {
2275
-		$this->set_phone( $value );
2274
+	public function set_phone_number($value) {
2275
+		$this->set_phone($value);
2276 2276
     }
2277 2277
 
2278 2278
     /**
@@ -2281,8 +2281,8 @@  discard block
 block discarded – undo
2281 2281
 	 * @since 1.0.19
2282 2282
 	 * @param  string $value email address.
2283 2283
 	 */
2284
-	public function set_email( $value ) {
2285
-		$this->set_prop( 'email', $value );
2284
+	public function set_email($value) {
2285
+		$this->set_prop('email', $value);
2286 2286
     }
2287 2287
 
2288 2288
     /**
@@ -2291,8 +2291,8 @@  discard block
 block discarded – undo
2291 2291
 	 * @since 1.0.19
2292 2292
 	 * @param  string $value email address.
2293 2293
 	 */
2294
-	public function set_user_email( $value ) {
2295
-		$this->set_email( $value );
2294
+	public function set_user_email($value) {
2295
+		$this->set_email($value);
2296 2296
     }
2297 2297
 
2298 2298
     /**
@@ -2301,8 +2301,8 @@  discard block
 block discarded – undo
2301 2301
 	 * @since 1.0.19
2302 2302
 	 * @param  string $value email address.
2303 2303
 	 */
2304
-	public function set_email_address( $value ) {
2305
-		$this->set_email( $value );
2304
+	public function set_email_address($value) {
2305
+		$this->set_email($value);
2306 2306
     }
2307 2307
 
2308 2308
     /**
@@ -2311,8 +2311,8 @@  discard block
 block discarded – undo
2311 2311
 	 * @since 1.0.19
2312 2312
 	 * @param  string $value email address.
2313 2313
 	 */
2314
-	public function set_customer_email( $value ) {
2315
-		$this->set_email( $value );
2314
+	public function set_customer_email($value) {
2315
+		$this->set_email($value);
2316 2316
     }
2317 2317
 
2318 2318
     /**
@@ -2321,8 +2321,8 @@  discard block
 block discarded – undo
2321 2321
 	 * @since 1.0.19
2322 2322
 	 * @param  string $value country.
2323 2323
 	 */
2324
-	public function set_country( $value ) {
2325
-		$this->set_prop( 'country', $value );
2324
+	public function set_country($value) {
2325
+		$this->set_prop('country', $value);
2326 2326
     }
2327 2327
 
2328 2328
     /**
@@ -2331,8 +2331,8 @@  discard block
 block discarded – undo
2331 2331
 	 * @since 1.0.19
2332 2332
 	 * @param  string $value country.
2333 2333
 	 */
2334
-	public function set_user_country( $value ) {
2335
-		$this->set_country( $value );
2334
+	public function set_user_country($value) {
2335
+		$this->set_country($value);
2336 2336
     }
2337 2337
 
2338 2338
     /**
@@ -2341,8 +2341,8 @@  discard block
 block discarded – undo
2341 2341
 	 * @since 1.0.19
2342 2342
 	 * @param  string $value country.
2343 2343
 	 */
2344
-	public function set_customer_country( $value ) {
2345
-		$this->set_country( $value );
2344
+	public function set_customer_country($value) {
2345
+		$this->set_country($value);
2346 2346
     }
2347 2347
 
2348 2348
     /**
@@ -2351,8 +2351,8 @@  discard block
 block discarded – undo
2351 2351
 	 * @since 1.0.19
2352 2352
 	 * @param  string $value state.
2353 2353
 	 */
2354
-	public function set_state( $value ) {
2355
-		$this->set_prop( 'state', $value );
2354
+	public function set_state($value) {
2355
+		$this->set_prop('state', $value);
2356 2356
     }
2357 2357
 
2358 2358
     /**
@@ -2361,8 +2361,8 @@  discard block
 block discarded – undo
2361 2361
 	 * @since 1.0.19
2362 2362
 	 * @param  string $value state.
2363 2363
 	 */
2364
-	public function set_user_state( $value ) {
2365
-		$this->set_state( $value );
2364
+	public function set_user_state($value) {
2365
+		$this->set_state($value);
2366 2366
     }
2367 2367
 
2368 2368
     /**
@@ -2371,8 +2371,8 @@  discard block
 block discarded – undo
2371 2371
 	 * @since 1.0.19
2372 2372
 	 * @param  string $value state.
2373 2373
 	 */
2374
-	public function set_customer_state( $value ) {
2375
-		$this->set_state( $value );
2374
+	public function set_customer_state($value) {
2375
+		$this->set_state($value);
2376 2376
     }
2377 2377
 
2378 2378
     /**
@@ -2381,8 +2381,8 @@  discard block
 block discarded – undo
2381 2381
 	 * @since 1.0.19
2382 2382
 	 * @param  string $value city.
2383 2383
 	 */
2384
-	public function set_city( $value ) {
2385
-		$this->set_prop( 'city', $value );
2384
+	public function set_city($value) {
2385
+		$this->set_prop('city', $value);
2386 2386
     }
2387 2387
 
2388 2388
     /**
@@ -2391,8 +2391,8 @@  discard block
 block discarded – undo
2391 2391
 	 * @since 1.0.19
2392 2392
 	 * @param  string $value city.
2393 2393
 	 */
2394
-	public function set_user_city( $value ) {
2395
-		$this->set_city( $value );
2394
+	public function set_user_city($value) {
2395
+		$this->set_city($value);
2396 2396
     }
2397 2397
 
2398 2398
     /**
@@ -2401,8 +2401,8 @@  discard block
 block discarded – undo
2401 2401
 	 * @since 1.0.19
2402 2402
 	 * @param  string $value city.
2403 2403
 	 */
2404
-	public function set_customer_city( $value ) {
2405
-		$this->set_city( $value );
2404
+	public function set_customer_city($value) {
2405
+		$this->set_city($value);
2406 2406
     }
2407 2407
 
2408 2408
     /**
@@ -2411,8 +2411,8 @@  discard block
 block discarded – undo
2411 2411
 	 * @since 1.0.19
2412 2412
 	 * @param  string $value zip.
2413 2413
 	 */
2414
-	public function set_zip( $value ) {
2415
-		$this->set_prop( 'zip', $value );
2414
+	public function set_zip($value) {
2415
+		$this->set_prop('zip', $value);
2416 2416
     }
2417 2417
 
2418 2418
     /**
@@ -2421,8 +2421,8 @@  discard block
 block discarded – undo
2421 2421
 	 * @since 1.0.19
2422 2422
 	 * @param  string $value zip.
2423 2423
 	 */
2424
-	public function set_user_zip( $value ) {
2425
-		$this->set_zip( $value );
2424
+	public function set_user_zip($value) {
2425
+		$this->set_zip($value);
2426 2426
     }
2427 2427
 
2428 2428
     /**
@@ -2431,8 +2431,8 @@  discard block
 block discarded – undo
2431 2431
 	 * @since 1.0.19
2432 2432
 	 * @param  string $value zip.
2433 2433
 	 */
2434
-	public function set_customer_zip( $value ) {
2435
-		$this->set_zip( $value );
2434
+	public function set_customer_zip($value) {
2435
+		$this->set_zip($value);
2436 2436
     }
2437 2437
 
2438 2438
     /**
@@ -2441,8 +2441,8 @@  discard block
 block discarded – undo
2441 2441
 	 * @since 1.0.19
2442 2442
 	 * @param  string $value company.
2443 2443
 	 */
2444
-	public function set_company( $value ) {
2445
-		$this->set_prop( 'company', $value );
2444
+	public function set_company($value) {
2445
+		$this->set_prop('company', $value);
2446 2446
     }
2447 2447
 
2448 2448
     /**
@@ -2451,8 +2451,8 @@  discard block
 block discarded – undo
2451 2451
 	 * @since 1.0.19
2452 2452
 	 * @param  string $value company.
2453 2453
 	 */
2454
-	public function set_user_company( $value ) {
2455
-		$this->set_company( $value );
2454
+	public function set_user_company($value) {
2455
+		$this->set_company($value);
2456 2456
     }
2457 2457
 
2458 2458
     /**
@@ -2461,8 +2461,8 @@  discard block
 block discarded – undo
2461 2461
 	 * @since 1.0.19
2462 2462
 	 * @param  string $value company.
2463 2463
 	 */
2464
-	public function set_customer_company( $value ) {
2465
-		$this->set_company( $value );
2464
+	public function set_customer_company($value) {
2465
+		$this->set_company($value);
2466 2466
     }
2467 2467
 
2468 2468
     /**
@@ -2471,8 +2471,8 @@  discard block
 block discarded – undo
2471 2471
 	 * @since 1.0.19
2472 2472
 	 * @param  string $value var number.
2473 2473
 	 */
2474
-	public function set_vat_number( $value ) {
2475
-		$this->set_prop( 'vat_number', $value );
2474
+	public function set_vat_number($value) {
2475
+		$this->set_prop('vat_number', $value);
2476 2476
     }
2477 2477
 
2478 2478
     /**
@@ -2481,8 +2481,8 @@  discard block
 block discarded – undo
2481 2481
 	 * @since 1.0.19
2482 2482
 	 * @param  string $value var number.
2483 2483
 	 */
2484
-	public function set_user_vat_number( $value ) {
2485
-		$this->set_vat_number( $value );
2484
+	public function set_user_vat_number($value) {
2485
+		$this->set_vat_number($value);
2486 2486
     }
2487 2487
 
2488 2488
     /**
@@ -2491,8 +2491,8 @@  discard block
 block discarded – undo
2491 2491
 	 * @since 1.0.19
2492 2492
 	 * @param  string $value var number.
2493 2493
 	 */
2494
-	public function set_customer_vat_number( $value ) {
2495
-		$this->set_vat_number( $value );
2494
+	public function set_customer_vat_number($value) {
2495
+		$this->set_vat_number($value);
2496 2496
     }
2497 2497
 
2498 2498
     /**
@@ -2501,8 +2501,8 @@  discard block
 block discarded – undo
2501 2501
 	 * @since 1.0.19
2502 2502
 	 * @param  string $value var rate.
2503 2503
 	 */
2504
-	public function set_vat_rate( $value ) {
2505
-		$this->set_prop( 'vat_rate', $value );
2504
+	public function set_vat_rate($value) {
2505
+		$this->set_prop('vat_rate', $value);
2506 2506
     }
2507 2507
 
2508 2508
     /**
@@ -2511,8 +2511,8 @@  discard block
 block discarded – undo
2511 2511
 	 * @since 1.0.19
2512 2512
 	 * @param  string $value var number.
2513 2513
 	 */
2514
-	public function set_user_vat_rate( $value ) {
2515
-		$this->set_vat_rate( $value );
2514
+	public function set_user_vat_rate($value) {
2515
+		$this->set_vat_rate($value);
2516 2516
     }
2517 2517
 
2518 2518
     /**
@@ -2521,8 +2521,8 @@  discard block
 block discarded – undo
2521 2521
 	 * @since 1.0.19
2522 2522
 	 * @param  string $value var number.
2523 2523
 	 */
2524
-	public function set_customer_vat_rate( $value ) {
2525
-		$this->set_vat_rate( $value );
2524
+	public function set_customer_vat_rate($value) {
2525
+		$this->set_vat_rate($value);
2526 2526
     }
2527 2527
 
2528 2528
     /**
@@ -2531,8 +2531,8 @@  discard block
 block discarded – undo
2531 2531
 	 * @since 1.0.19
2532 2532
 	 * @param  string $value address.
2533 2533
 	 */
2534
-	public function set_address( $value ) {
2535
-		$this->set_prop( 'address', $value );
2534
+	public function set_address($value) {
2535
+		$this->set_prop('address', $value);
2536 2536
     }
2537 2537
 
2538 2538
     /**
@@ -2541,8 +2541,8 @@  discard block
 block discarded – undo
2541 2541
 	 * @since 1.0.19
2542 2542
 	 * @param  string $value address.
2543 2543
 	 */
2544
-	public function set_user_address( $value ) {
2545
-		$this->set_address( $value );
2544
+	public function set_user_address($value) {
2545
+		$this->set_address($value);
2546 2546
     }
2547 2547
 
2548 2548
     /**
@@ -2551,8 +2551,8 @@  discard block
 block discarded – undo
2551 2551
 	 * @since 1.0.19
2552 2552
 	 * @param  string $value address.
2553 2553
 	 */
2554
-	public function set_customer_address( $value ) {
2555
-		$this->set_address( $value );
2554
+	public function set_customer_address($value) {
2555
+		$this->set_address($value);
2556 2556
     }
2557 2557
 
2558 2558
     /**
@@ -2561,8 +2561,8 @@  discard block
 block discarded – undo
2561 2561
 	 * @since 1.0.19
2562 2562
 	 * @param  int|bool $value confirmed.
2563 2563
 	 */
2564
-	public function set_is_viewed( $value ) {
2565
-		$this->set_prop( 'is_viewed', $value );
2564
+	public function set_is_viewed($value) {
2565
+		$this->set_prop('is_viewed', $value);
2566 2566
 	}
2567 2567
 
2568 2568
 	/**
@@ -2571,8 +2571,8 @@  discard block
 block discarded – undo
2571 2571
 	 * @since 1.0.19
2572 2572
 	 * @param  string $value email recipients.
2573 2573
 	 */
2574
-	public function set_email_cc( $value ) {
2575
-		$this->set_prop( 'email_cc', $value );
2574
+	public function set_email_cc($value) {
2575
+		$this->set_prop('email_cc', $value);
2576 2576
 	}
2577 2577
 
2578 2578
 	/**
@@ -2581,9 +2581,9 @@  discard block
 block discarded – undo
2581 2581
 	 * @since 1.0.19
2582 2582
 	 * @param  string $value email recipients.
2583 2583
 	 */
2584
-	public function set_template( $value ) {
2585
-		if ( in_array( $value, array( 'quantity', 'hours', 'amount' ) ) ) {
2586
-			$this->set_prop( 'template', $value );
2584
+	public function set_template($value) {
2585
+		if (in_array($value, array('quantity', 'hours', 'amount'))) {
2586
+			$this->set_prop('template', $value);
2587 2587
 		}
2588 2588
 	}
2589 2589
 
@@ -2593,8 +2593,8 @@  discard block
 block discarded – undo
2593 2593
 	 * @since 1.0.19
2594 2594
 	 * @param  int|bool $value confirmed.
2595 2595
 	 */
2596
-	public function set_address_confirmed( $value ) {
2597
-		$this->set_prop( 'address_confirmed', $value );
2596
+	public function set_address_confirmed($value) {
2597
+		$this->set_prop('address_confirmed', $value);
2598 2598
     }
2599 2599
 
2600 2600
     /**
@@ -2603,8 +2603,8 @@  discard block
 block discarded – undo
2603 2603
 	 * @since 1.0.19
2604 2604
 	 * @param  int|bool $value confirmed.
2605 2605
 	 */
2606
-	public function set_user_address_confirmed( $value ) {
2607
-		$this->set_address_confirmed( $value );
2606
+	public function set_user_address_confirmed($value) {
2607
+		$this->set_address_confirmed($value);
2608 2608
     }
2609 2609
 
2610 2610
     /**
@@ -2613,8 +2613,8 @@  discard block
 block discarded – undo
2613 2613
 	 * @since 1.0.19
2614 2614
 	 * @param  int|bool $value confirmed.
2615 2615
 	 */
2616
-	public function set_customer_address_confirmed( $value ) {
2617
-		$this->set_address_confirmed( $value );
2616
+	public function set_customer_address_confirmed($value) {
2617
+		$this->set_address_confirmed($value);
2618 2618
     }
2619 2619
 
2620 2620
     /**
@@ -2623,8 +2623,8 @@  discard block
 block discarded – undo
2623 2623
 	 * @since 1.0.19
2624 2624
 	 * @param  float $value sub total.
2625 2625
 	 */
2626
-	public function set_subtotal( $value ) {
2627
-		$this->set_prop( 'subtotal', $value );
2626
+	public function set_subtotal($value) {
2627
+		$this->set_prop('subtotal', $value);
2628 2628
     }
2629 2629
 
2630 2630
     /**
@@ -2633,8 +2633,8 @@  discard block
 block discarded – undo
2633 2633
 	 * @since 1.0.19
2634 2634
 	 * @param  float $value discount total.
2635 2635
 	 */
2636
-	public function set_total_discount( $value ) {
2637
-		$this->set_prop( 'total_discount', $value );
2636
+	public function set_total_discount($value) {
2637
+		$this->set_prop('total_discount', $value);
2638 2638
     }
2639 2639
 
2640 2640
     /**
@@ -2643,8 +2643,8 @@  discard block
 block discarded – undo
2643 2643
 	 * @since 1.0.19
2644 2644
 	 * @param  float $value discount total.
2645 2645
 	 */
2646
-	public function set_discount( $value ) {
2647
-		$this->set_total_discount( $value );
2646
+	public function set_discount($value) {
2647
+		$this->set_total_discount($value);
2648 2648
     }
2649 2649
 
2650 2650
     /**
@@ -2653,8 +2653,8 @@  discard block
 block discarded – undo
2653 2653
 	 * @since 1.0.19
2654 2654
 	 * @param  float $value tax total.
2655 2655
 	 */
2656
-	public function set_total_tax( $value ) {
2657
-		$this->set_prop( 'total_tax', $value );
2656
+	public function set_total_tax($value) {
2657
+		$this->set_prop('total_tax', $value);
2658 2658
     }
2659 2659
 
2660 2660
     /**
@@ -2663,8 +2663,8 @@  discard block
 block discarded – undo
2663 2663
 	 * @since 1.0.19
2664 2664
 	 * @param  float $value tax total.
2665 2665
 	 */
2666
-	public function set_tax_total( $value ) {
2667
-		$this->set_total_tax( $value );
2666
+	public function set_tax_total($value) {
2667
+		$this->set_total_tax($value);
2668 2668
     }
2669 2669
 
2670 2670
     /**
@@ -2673,8 +2673,8 @@  discard block
 block discarded – undo
2673 2673
 	 * @since 1.0.19
2674 2674
 	 * @param  float $value fees total.
2675 2675
 	 */
2676
-	public function set_total_fees( $value ) {
2677
-		$this->set_prop( 'total_fees', $value );
2676
+	public function set_total_fees($value) {
2677
+		$this->set_prop('total_fees', $value);
2678 2678
     }
2679 2679
 
2680 2680
     /**
@@ -2683,8 +2683,8 @@  discard block
 block discarded – undo
2683 2683
 	 * @since 1.0.19
2684 2684
 	 * @param  float $value fees total.
2685 2685
 	 */
2686
-	public function set_fees_total( $value ) {
2687
-		$this->set_total_fees( $value );
2686
+	public function set_fees_total($value) {
2687
+		$this->set_total_fees($value);
2688 2688
     }
2689 2689
 
2690 2690
     /**
@@ -2693,18 +2693,18 @@  discard block
 block discarded – undo
2693 2693
 	 * @since 1.0.19
2694 2694
 	 * @param  array $value fees.
2695 2695
 	 */
2696
-	public function set_fees( $value ) {
2696
+	public function set_fees($value) {
2697 2697
 
2698
-        $this->set_prop( 'fees', array() );
2698
+        $this->set_prop('fees', array());
2699 2699
 
2700 2700
         // Ensure that we have an array.
2701
-        if ( ! is_array( $value ) ) {
2701
+        if (!is_array($value)) {
2702 2702
             return;
2703 2703
         }
2704 2704
 
2705
-        foreach ( $value as $name => $data ) {
2706
-            if ( isset( $data['amount'] ) ) {
2707
-                $this->add_fee( $name, $data['amount'], $data['recurring'] );
2705
+        foreach ($value as $name => $data) {
2706
+            if (isset($data['amount'])) {
2707
+                $this->add_fee($name, $data['amount'], $data['recurring']);
2708 2708
             }
2709 2709
         }
2710 2710
 
@@ -2716,8 +2716,8 @@  discard block
 block discarded – undo
2716 2716
 	 * @since 1.0.19
2717 2717
 	 * @param  array $value taxes.
2718 2718
 	 */
2719
-	public function set_taxes( $value ) {
2720
-		$this->set_prop( 'taxes', $value );
2719
+	public function set_taxes($value) {
2720
+		$this->set_prop('taxes', $value);
2721 2721
     }
2722 2722
 
2723 2723
     /**
@@ -2726,17 +2726,17 @@  discard block
 block discarded – undo
2726 2726
 	 * @since 1.0.19
2727 2727
 	 * @param  array $value discounts.
2728 2728
 	 */
2729
-	public function set_discounts( $value ) {
2730
-		$this->set_prop( 'discounts', array() );
2729
+	public function set_discounts($value) {
2730
+		$this->set_prop('discounts', array());
2731 2731
 
2732 2732
         // Ensure that we have an array.
2733
-        if ( ! is_array( $value ) ) {
2733
+        if (!is_array($value)) {
2734 2734
             return;
2735 2735
         }
2736 2736
 
2737
-        foreach ( $value as $name => $data ) {
2738
-            if ( isset( $data['amount'] ) ) {
2739
-                $this->add_discount( $name, $data['amount'], $data['recurring'] );
2737
+        foreach ($value as $name => $data) {
2738
+            if (isset($data['amount'])) {
2739
+                $this->add_discount($name, $data['amount'], $data['recurring']);
2740 2740
             }
2741 2741
         }
2742 2742
     }
@@ -2747,18 +2747,18 @@  discard block
 block discarded – undo
2747 2747
 	 * @since 1.0.19
2748 2748
 	 * @param  GetPaid_Form_Item[] $value items.
2749 2749
 	 */
2750
-	public function set_items( $value ) {
2750
+	public function set_items($value) {
2751 2751
 
2752 2752
         // Remove existing items.
2753
-        $this->set_prop( 'items', array() );
2753
+        $this->set_prop('items', array());
2754 2754
 
2755 2755
         // Ensure that we have an array.
2756
-        if ( ! is_array( $value ) ) {
2756
+        if (!is_array($value)) {
2757 2757
             return;
2758 2758
         }
2759 2759
 
2760
-        foreach ( $value as $item ) {
2761
-            $this->add_item( $item );
2760
+        foreach ($value as $item) {
2761
+            $this->add_item($item);
2762 2762
         }
2763 2763
 
2764 2764
     }
@@ -2769,8 +2769,8 @@  discard block
 block discarded – undo
2769 2769
 	 * @since 1.0.19
2770 2770
 	 * @param  int $value payment form.
2771 2771
 	 */
2772
-	public function set_payment_form( $value ) {
2773
-		$this->set_prop( 'payment_form', $value );
2772
+	public function set_payment_form($value) {
2773
+		$this->set_prop('payment_form', $value);
2774 2774
     }
2775 2775
 
2776 2776
     /**
@@ -2779,8 +2779,8 @@  discard block
 block discarded – undo
2779 2779
 	 * @since 1.0.19
2780 2780
 	 * @param  string $value submission id.
2781 2781
 	 */
2782
-	public function set_submission_id( $value ) {
2783
-		$this->set_prop( 'submission_id', $value );
2782
+	public function set_submission_id($value) {
2783
+		$this->set_prop('submission_id', $value);
2784 2784
     }
2785 2785
 
2786 2786
     /**
@@ -2789,8 +2789,8 @@  discard block
 block discarded – undo
2789 2789
 	 * @since 1.0.19
2790 2790
 	 * @param  string $value discount code.
2791 2791
 	 */
2792
-	public function set_discount_code( $value ) {
2793
-		$this->set_prop( 'discount_code', $value );
2792
+	public function set_discount_code($value) {
2793
+		$this->set_prop('discount_code', $value);
2794 2794
     }
2795 2795
 
2796 2796
     /**
@@ -2799,8 +2799,8 @@  discard block
 block discarded – undo
2799 2799
 	 * @since 1.0.19
2800 2800
 	 * @param  string $value gateway.
2801 2801
 	 */
2802
-	public function set_gateway( $value ) {
2803
-		$this->set_prop( 'gateway', $value );
2802
+	public function set_gateway($value) {
2803
+		$this->set_prop('gateway', $value);
2804 2804
     }
2805 2805
 
2806 2806
     /**
@@ -2809,8 +2809,8 @@  discard block
 block discarded – undo
2809 2809
 	 * @since 1.0.19
2810 2810
 	 * @param  string $value transaction id.
2811 2811
 	 */
2812
-	public function set_transaction_id( $value ) {
2813
-		$this->set_prop( 'transaction_id', $value );
2812
+	public function set_transaction_id($value) {
2813
+		$this->set_prop('transaction_id', $value);
2814 2814
     }
2815 2815
 
2816 2816
     /**
@@ -2819,8 +2819,8 @@  discard block
 block discarded – undo
2819 2819
 	 * @since 1.0.19
2820 2820
 	 * @param  string $value currency id.
2821 2821
 	 */
2822
-	public function set_currency( $value ) {
2823
-		$this->set_prop( 'currency', $value );
2822
+	public function set_currency($value) {
2823
+		$this->set_prop('currency', $value);
2824 2824
     }
2825 2825
 
2826 2826
 	/**
@@ -2829,8 +2829,8 @@  discard block
 block discarded – undo
2829 2829
 	 * @since 1.0.19
2830 2830
 	 * @param  bool $value value.
2831 2831
 	 */
2832
-	public function set_disable_taxes( $value ) {
2833
-		$this->set_prop( 'disable_taxes', (bool) $value );
2832
+	public function set_disable_taxes($value) {
2833
+		$this->set_prop('disable_taxes', (bool) $value);
2834 2834
 	}
2835 2835
 
2836 2836
     /**
@@ -2839,8 +2839,8 @@  discard block
 block discarded – undo
2839 2839
 	 * @since 1.0.19
2840 2840
 	 * @param  string $value subscription id.
2841 2841
 	 */
2842
-	public function set_subscription_id( $value ) {
2843
-		$this->set_prop( 'subscription_id', $value );
2842
+	public function set_subscription_id($value) {
2843
+		$this->set_prop('subscription_id', $value);
2844 2844
     }
2845 2845
 
2846 2846
     /*
@@ -2857,21 +2857,21 @@  discard block
 block discarded – undo
2857 2857
      */
2858 2858
     public function is_parent() {
2859 2859
         $parent = $this->get_parent_id();
2860
-        return apply_filters( 'wpinv_invoice_is_parent', empty( $parent ), $this );
2860
+        return apply_filters('wpinv_invoice_is_parent', empty($parent), $this);
2861 2861
     }
2862 2862
 
2863 2863
     /**
2864 2864
      * Checks if this is a renewal invoice.
2865 2865
      */
2866 2866
     public function is_renewal() {
2867
-        return ! $this->is_parent();
2867
+        return !$this->is_parent();
2868 2868
     }
2869 2869
 
2870 2870
     /**
2871 2871
      * Checks if this is a recurring invoice.
2872 2872
      */
2873 2873
     public function is_recurring() {
2874
-        return $this->is_renewal() || ! empty( $this->recurring_item );
2874
+        return $this->is_renewal() || !empty($this->recurring_item);
2875 2875
     }
2876 2876
 
2877 2877
     /**
@@ -2889,49 +2889,49 @@  discard block
 block discarded – undo
2889 2889
 
2890 2890
         $requires_vat = false;
2891 2891
 
2892
-        if ( $this->country ) {
2892
+        if ($this->country) {
2893 2893
             $wpi_country        = $this->country;
2894
-            $requires_vat       = $wpinv_euvat->requires_vat( $requires_vat, $this->get_user_id(), $wpinv_euvat->invoice_has_digital_rule( $this ) );
2894
+            $requires_vat       = $wpinv_euvat->requires_vat($requires_vat, $this->get_user_id(), $wpinv_euvat->invoice_has_digital_rule($this));
2895 2895
         }
2896 2896
 
2897
-        return apply_filters( 'wpinv_invoice_has_vat', $requires_vat, $this );
2897
+        return apply_filters('wpinv_invoice_has_vat', $requires_vat, $this);
2898 2898
 	}
2899 2899
 
2900 2900
 	/**
2901 2901
 	 * Checks to see if the invoice requires payment.
2902 2902
 	 */
2903 2903
 	public function is_free() {
2904
-        $is_free = ! ( (float) wpinv_round_amount( $this->get_initial_total() ) > 0 );
2904
+        $is_free = !((float) wpinv_round_amount($this->get_initial_total()) > 0);
2905 2905
 
2906
-		if ( $is_free && $this->is_recurring() ) {
2907
-			$is_free = ! ( (float) wpinv_round_amount( $this->get_recurring_total() ) > 0 );
2906
+		if ($is_free && $this->is_recurring()) {
2907
+			$is_free = !((float) wpinv_round_amount($this->get_recurring_total()) > 0);
2908 2908
 		}
2909 2909
 
2910
-        return apply_filters( 'wpinv_invoice_is_free', $is_free, $this );
2910
+        return apply_filters('wpinv_invoice_is_free', $is_free, $this);
2911 2911
     }
2912 2912
 
2913 2913
     /**
2914 2914
      * Checks if the invoice is paid.
2915 2915
      */
2916 2916
     public function is_paid() {
2917
-        $is_paid = $this->has_status( array( 'publish', 'wpi-processing', 'wpi-renewal' ) );
2918
-        return apply_filters( 'wpinv_invoice_is_paid', $is_paid, $this );
2917
+        $is_paid = $this->has_status(array('publish', 'wpi-processing', 'wpi-renewal'));
2918
+        return apply_filters('wpinv_invoice_is_paid', $is_paid, $this);
2919 2919
 	}
2920 2920
 
2921 2921
 	/**
2922 2922
      * Checks if the invoice needs payment.
2923 2923
      */
2924 2924
 	public function needs_payment() {
2925
-		$needs_payment = ! $this->is_paid() && ! $this->is_refunded() && ! $this->is_free();
2926
-        return apply_filters( 'wpinv_needs_payment', $needs_payment, $this );
2925
+		$needs_payment = !$this->is_paid() && !$this->is_refunded() && !$this->is_free();
2926
+        return apply_filters('wpinv_needs_payment', $needs_payment, $this);
2927 2927
     }
2928 2928
 
2929 2929
 	/**
2930 2930
      * Checks if the invoice is refunded.
2931 2931
      */
2932 2932
 	public function is_refunded() {
2933
-        $is_refunded = $this->has_status( 'wpi-refunded' );
2934
-        return apply_filters( 'wpinv_invoice_is_refunded', $is_refunded, $this );
2933
+        $is_refunded = $this->has_status('wpi-refunded');
2934
+        return apply_filters('wpinv_invoice_is_refunded', $is_refunded, $this);
2935 2935
 	}
2936 2936
 
2937 2937
 	/**
@@ -2939,30 +2939,30 @@  discard block
 block discarded – undo
2939 2939
      */
2940 2940
 	public function is_due() {
2941 2941
 		$due_date = $this->get_due_date();
2942
-		return empty( $due_date ) ? false : current_time( 'timestamp' ) > strtotime( $due_date );
2942
+		return empty($due_date) ? false : current_time('timestamp') > strtotime($due_date);
2943 2943
 	}
2944 2944
 
2945 2945
 	/**
2946 2946
      * Checks if the invoice is draft.
2947 2947
      */
2948 2948
 	public function is_draft() {
2949
-        return $this->has_status( 'draft, auto-draft' );
2949
+        return $this->has_status('draft, auto-draft');
2950 2950
 	}
2951 2951
 
2952 2952
     /**
2953 2953
      * Checks if the invoice has a given status.
2954 2954
      */
2955
-    public function has_status( $status ) {
2956
-        $status = wpinv_parse_list( $status );
2957
-        return apply_filters( 'wpinv_has_status', in_array( $this->get_status(), $status ), $status );
2955
+    public function has_status($status) {
2956
+        $status = wpinv_parse_list($status);
2957
+        return apply_filters('wpinv_has_status', in_array($this->get_status(), $status), $status);
2958 2958
 	}
2959 2959
 
2960 2960
 	/**
2961 2961
      * Checks if the invoice is of a given type.
2962 2962
      */
2963
-    public function is_type( $type ) {
2964
-        $type = wpinv_parse_list( $type );
2965
-        return in_array( $this->get_type(), $type );
2963
+    public function is_type($type) {
2964
+        $type = wpinv_parse_list($type);
2965
+        return in_array($this->get_type(), $type);
2966 2966
     }
2967 2967
 
2968 2968
     /**
@@ -2994,8 +2994,8 @@  discard block
 block discarded – undo
2994 2994
      *
2995 2995
      */
2996 2996
 	public function is_initial_free() {
2997
-        $is_initial_free = ! ( (float) wpinv_round_amount( $this->get_initial_total() ) > 0 );
2998
-        return apply_filters( 'wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this );
2997
+        $is_initial_free = !((float) wpinv_round_amount($this->get_initial_total()) > 0);
2998
+        return apply_filters('wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this);
2999 2999
     }
3000 3000
 	
3001 3001
 	/**
@@ -3005,11 +3005,11 @@  discard block
 block discarded – undo
3005 3005
     public function item_has_free_trial() {
3006 3006
 
3007 3007
         // Ensure we have a recurring item.
3008
-        if ( ! $this->is_recurring() ) {
3008
+        if (!$this->is_recurring()) {
3009 3009
             return false;
3010 3010
         }
3011 3011
 
3012
-        $item = new WPInv_Item( $this->recurring_item );
3012
+        $item = new WPInv_Item($this->recurring_item);
3013 3013
         return $item->has_free_trial();
3014 3014
 	}
3015 3015
 
@@ -3017,7 +3017,7 @@  discard block
 block discarded – undo
3017 3017
      * Check if the free trial is a result of a discount.
3018 3018
      */
3019 3019
     public function is_free_trial_from_discount() {
3020
-		return $this->has_free_trial() && ! $this->item_has_free_trial();
3020
+		return $this->has_free_trial() && !$this->item_has_free_trial();
3021 3021
 	}
3022 3022
 	
3023 3023
 	/**
@@ -3026,17 +3026,17 @@  discard block
 block discarded – undo
3026 3026
     public function discount_first_payment_only() {
3027 3027
 
3028 3028
 		$discount_code = $this->get_discount_code();
3029
-        if ( empty( $this->discount_code ) || ! $this->is_recurring() ) {
3029
+        if (empty($this->discount_code) || !$this->is_recurring()) {
3030 3030
             return true;
3031 3031
         }
3032 3032
 
3033
-        $discount = wpinv_get_discount_obj( $discount_code );
3033
+        $discount = wpinv_get_discount_obj($discount_code);
3034 3034
 
3035
-        if ( ! $discount || ! $discount->exists() ) {
3035
+        if (!$discount || !$discount->exists()) {
3036 3036
             return true;
3037 3037
         }
3038 3038
 
3039
-        return ! $discount->get_is_recurring();
3039
+        return !$discount->get_is_recurring();
3040 3040
     }
3041 3041
 
3042 3042
     /*
@@ -3054,18 +3054,18 @@  discard block
 block discarded – undo
3054 3054
      * @param GetPaid_Form_Item $item
3055 3055
      * @return WP_Error|Bool
3056 3056
      */
3057
-    public function add_item( $item ) {
3057
+    public function add_item($item) {
3058 3058
 
3059 3059
         // Make sure that it is available for purchase.
3060
-		if ( $item->get_id() > 0 && ! $item->can_purchase() ) {
3061
-			return new WP_Error( 'invalid_item', __( 'This item is not available for purchase', 'invoicing' ) );
3060
+		if ($item->get_id() > 0 && !$item->can_purchase()) {
3061
+			return new WP_Error('invalid_item', __('This item is not available for purchase', 'invoicing'));
3062 3062
         }
3063 3063
 
3064 3064
         // Do we have a recurring item?
3065
-		if ( $item->is_recurring() ) {
3065
+		if ($item->is_recurring()) {
3066 3066
 
3067 3067
 			// An invoice can only contain one recurring item.
3068
-			if ( ! empty( $this->recurring_item ) ) {
3068
+			if (!empty($this->recurring_item)) {
3069 3069
 				return false;
3070 3070
 			}
3071 3071
 
@@ -3077,9 +3077,9 @@  discard block
 block discarded – undo
3077 3077
 
3078 3078
         // Retrieve all items.
3079 3079
         $items = $this->get_items();
3080
-        $items[ $item->get_id() ] = $item;
3080
+        $items[$item->get_id()] = $item;
3081 3081
 
3082
-        $this->set_prop( 'items', $items );
3082
+        $this->set_prop('items', $items);
3083 3083
 		return true;
3084 3084
     }
3085 3085
 
@@ -3088,9 +3088,9 @@  discard block
 block discarded – undo
3088 3088
 	 *
3089 3089
 	 * @since 1.0.19
3090 3090
 	 */
3091
-	public function get_item( $item_id ) {
3091
+	public function get_item($item_id) {
3092 3092
         $items = $this->get_items();
3093
-		return ( ! empty( $item_id ) && isset( $items[ $item_id ] ) ) ? $items[ $item_id ] : null;
3093
+		return (!empty($item_id) && isset($items[$item_id])) ? $items[$item_id] : null;
3094 3094
     }
3095 3095
 
3096 3096
     /**
@@ -3098,16 +3098,16 @@  discard block
 block discarded – undo
3098 3098
 	 *
3099 3099
 	 * @since 1.0.19
3100 3100
 	 */
3101
-	public function remove_item( $item_id ) {
3101
+	public function remove_item($item_id) {
3102 3102
         $items = $this->get_items();
3103 3103
 
3104
-        if ( $item_id == $this->recurring_item ) {
3104
+        if ($item_id == $this->recurring_item) {
3105 3105
             $this->recurring_item = null;
3106 3106
         }
3107 3107
 
3108
-        if ( isset( $items[ $item_id ] ) ) {
3109
-            unset( $items[ $item_id ] );
3110
-            $this->set_prop( 'items', $items );
3108
+        if (isset($items[$item_id])) {
3109
+            unset($items[$item_id]);
3110
+            $this->set_prop('items', $items);
3111 3111
         }
3112 3112
     }
3113 3113
 
@@ -3118,27 +3118,27 @@  discard block
 block discarded – undo
3118 3118
      * @param float $value
3119 3119
      * @return WP_Error|Bool
3120 3120
      */
3121
-    public function add_fee( $fee, $value, $recurring = false ) {
3121
+    public function add_fee($fee, $value, $recurring = false) {
3122 3122
 
3123
-        $amount = wpinv_sanitize_amount( $value );
3123
+        $amount = wpinv_sanitize_amount($value);
3124 3124
         $fees   = $this->get_fees();
3125 3125
 
3126
-        if ( isset( $fees[ $fee ] ) && isset( $fees[ $fee ]['amount'] ) ) {
3126
+        if (isset($fees[$fee]) && isset($fees[$fee]['amount'])) {
3127 3127
 
3128
-            $amount = $fees[ $fee ]['amount'] += $amount;
3129
-			$fees[ $fee ] = array(
3128
+            $amount = $fees[$fee]['amount'] += $amount;
3129
+			$fees[$fee] = array(
3130 3130
                 'amount'    => $amount,
3131 3131
                 'recurring' => (bool) $recurring,
3132 3132
             );
3133 3133
 
3134 3134
 		} else {
3135
-			$fees[ $fee ] = array(
3135
+			$fees[$fee] = array(
3136 3136
                 'amount'    => $amount,
3137 3137
                 'recurring' => (bool) $recurring,
3138 3138
             );
3139 3139
 		}
3140 3140
 
3141
-        $this->set_prop( 'fees', $fee );
3141
+        $this->set_prop('fees', $fee);
3142 3142
 
3143 3143
     }
3144 3144
 
@@ -3147,9 +3147,9 @@  discard block
 block discarded – undo
3147 3147
 	 *
3148 3148
 	 * @since 1.0.19
3149 3149
 	 */
3150
-	public function get_fee( $fee ) {
3150
+	public function get_fee($fee) {
3151 3151
         $fees = $this->get_fees();
3152
-		return isset( $fees[ $fee ] ) ? $fees[ $fee ] : null;
3152
+		return isset($fees[$fee]) ? $fees[$fee] : null;
3153 3153
     }
3154 3154
 
3155 3155
     /**
@@ -3157,11 +3157,11 @@  discard block
 block discarded – undo
3157 3157
 	 *
3158 3158
 	 * @since 1.0.19
3159 3159
 	 */
3160
-	public function remove_fee( $fee ) {
3160
+	public function remove_fee($fee) {
3161 3161
         $fees = $this->get_fees();
3162
-        if ( isset( $fees[ $fee ] ) ) {
3163
-            unset( $fees[ $fee ] );
3164
-            $this->set_prop( 'fees', $fees );
3162
+        if (isset($fees[$fee])) {
3163
+            unset($fees[$fee]);
3164
+            $this->set_prop('fees', $fees);
3165 3165
         }
3166 3166
     }
3167 3167
 
@@ -3172,27 +3172,27 @@  discard block
 block discarded – undo
3172 3172
      * @param float $value
3173 3173
      * @return WP_Error|Bool
3174 3174
      */
3175
-    public function add_discount( $discount, $value, $recurring = false ) {
3175
+    public function add_discount($discount, $value, $recurring = false) {
3176 3176
 
3177
-        $amount    = wpinv_sanitize_amount( $value );
3177
+        $amount    = wpinv_sanitize_amount($value);
3178 3178
         $discounts = $this->get_discounts();
3179 3179
 
3180
-        if ( isset( $discounts[ $discount ] ) && isset( $discounts[ $discount ]['amount'] ) ) {
3180
+        if (isset($discounts[$discount]) && isset($discounts[$discount]['amount'])) {
3181 3181
 
3182
-            $amount = $discounts[ $discount ]['amount'] += $amount;
3183
-			$discounts[ $discount ] = array(
3182
+            $amount = $discounts[$discount]['amount'] += $amount;
3183
+			$discounts[$discount] = array(
3184 3184
                 'amount'    => $amount,
3185 3185
                 'recurring' => (bool) $recurring,
3186 3186
             );
3187 3187
 
3188 3188
 		} else {
3189
-			$discounts[ $discount ] = array(
3189
+			$discounts[$discount] = array(
3190 3190
                 'amount'    => $amount,
3191 3191
                 'recurring' => (bool) $recurring,
3192 3192
             );
3193 3193
 		}
3194 3194
 
3195
-        $this->set_prop( 'discounts', $discount );
3195
+        $this->set_prop('discounts', $discount);
3196 3196
 
3197 3197
     }
3198 3198
 
@@ -3201,15 +3201,15 @@  discard block
 block discarded – undo
3201 3201
 	 *
3202 3202
 	 * @since 1.0.19
3203 3203
 	 */
3204
-	public function get_discount( $discount = false ) {
3204
+	public function get_discount($discount = false) {
3205 3205
 
3206 3206
 		// Backwards compatibilty.
3207
-		if ( empty( $discount ) ) {
3207
+		if (empty($discount)) {
3208 3208
 			return $this->get_total_discount();
3209 3209
 		}
3210 3210
 
3211 3211
         $discounts = $this->get_discounts();
3212
-		return isset( $discounts[ $discount ] ) ? $discounts[ $discount ] : null;
3212
+		return isset($discounts[$discount]) ? $discounts[$discount] : null;
3213 3213
     }
3214 3214
 
3215 3215
     /**
@@ -3217,11 +3217,11 @@  discard block
 block discarded – undo
3217 3217
 	 *
3218 3218
 	 * @since 1.0.19
3219 3219
 	 */
3220
-	public function remove_discount( $discount ) {
3220
+	public function remove_discount($discount) {
3221 3221
         $discounts = $this->get_discounts();
3222
-        if ( isset( $discounts[ $discount ] ) ) {
3223
-            unset( $discounts[ $discount ] );
3224
-            $this->set_prop( 'discounts', $discounts );
3222
+        if (isset($discounts[$discount])) {
3223
+            unset($discounts[$discount]);
3224
+            $this->set_prop('discounts', $discounts);
3225 3225
         }
3226 3226
     }
3227 3227
 
@@ -3231,31 +3231,31 @@  discard block
 block discarded – undo
3231 3231
      * @param string $tax
3232 3232
      * @param float $value
3233 3233
      */
3234
-    public function add_tax( $tax, $value, $recurring = true ) {
3234
+    public function add_tax($tax, $value, $recurring = true) {
3235 3235
 
3236
-        if ( ! $this->is_taxable() ) {
3236
+        if (!$this->is_taxable()) {
3237 3237
             return;
3238 3238
         }
3239 3239
 
3240
-        $amount    = wpinv_sanitize_amount( $value );
3240
+        $amount    = wpinv_sanitize_amount($value);
3241 3241
         $taxes     = $this->get_taxes();
3242 3242
 
3243
-        if ( isset( $taxes[ $tax ] ) && isset( $taxes[ $tax ]['amount'] ) ) {
3243
+        if (isset($taxes[$tax]) && isset($taxes[$tax]['amount'])) {
3244 3244
 
3245
-            $amount = $taxes[ $tax ]['amount'] += $amount;
3246
-			$taxes[ $tax ] = array(
3245
+            $amount = $taxes[$tax]['amount'] += $amount;
3246
+			$taxes[$tax] = array(
3247 3247
                 'amount'    => $amount,
3248 3248
                 'recurring' => (bool) $recurring,
3249 3249
             );
3250 3250
 
3251 3251
 		} else {
3252
-			$taxes[ $tax ] = array(
3252
+			$taxes[$tax] = array(
3253 3253
                 'amount'    => $amount,
3254 3254
                 'recurring' => (bool) $recurring,
3255 3255
             );
3256 3256
 		}
3257 3257
 
3258
-        $this->set_prop( 'taxes', $tax );
3258
+        $this->set_prop('taxes', $tax);
3259 3259
 
3260 3260
     }
3261 3261
 
@@ -3264,9 +3264,9 @@  discard block
 block discarded – undo
3264 3264
 	 *
3265 3265
 	 * @since 1.0.19
3266 3266
 	 */
3267
-	public function get_tax( $tax ) {
3267
+	public function get_tax($tax) {
3268 3268
         $taxes = $this->get_taxes();
3269
-		return isset( $taxes[ $tax ] ) ? $taxes[ $tax ] : null;
3269
+		return isset($taxes[$tax]) ? $taxes[$tax] : null;
3270 3270
     }
3271 3271
 
3272 3272
     /**
@@ -3274,11 +3274,11 @@  discard block
 block discarded – undo
3274 3274
 	 *
3275 3275
 	 * @since 1.0.19
3276 3276
 	 */
3277
-	public function remove_tax( $tax ) {
3277
+	public function remove_tax($tax) {
3278 3278
         $taxes = $this->get_discounts();
3279
-        if ( isset( $taxes[ $tax ] ) ) {
3280
-            unset( $taxes[ $tax ] );
3281
-            $this->set_prop( 'taxes', $taxes );
3279
+        if (isset($taxes[$tax])) {
3280
+            unset($taxes[$tax]);
3281
+            $this->set_prop('taxes', $taxes);
3282 3282
         }
3283 3283
     }
3284 3284
 
@@ -3289,19 +3289,19 @@  discard block
 block discarded – undo
3289 3289
 	 * @return float The recalculated subtotal
3290 3290
 	 */
3291 3291
 	public function recalculate_subtotal() {
3292
-        $items     = $this->get_items();
3292
+        $items = $this->get_items();
3293 3293
 		$subtotal  = 0;
3294 3294
 		$recurring = 0;
3295 3295
 
3296
-        foreach ( $items as $item ) {
3296
+        foreach ($items as $item) {
3297 3297
 			$subtotal  += $item->get_sub_total();
3298 3298
 			$recurring += $item->get_recurring_sub_total();
3299 3299
         }
3300 3300
 
3301
-		if ( $this->is_renewal() ) {
3302
-			$this->set_subtotal( $recurring );
3301
+		if ($this->is_renewal()) {
3302
+			$this->set_subtotal($recurring);
3303 3303
 		} else {
3304
-			$this->set_subtotal( $subtotal );
3304
+			$this->set_subtotal($subtotal);
3305 3305
 		}
3306 3306
 
3307 3307
 		$this->totals['subtotal'] = array(
@@ -3323,9 +3323,9 @@  discard block
 block discarded – undo
3323 3323
 		$discount  = 0;
3324 3324
 		$recurring = 0;
3325 3325
 
3326
-        foreach ( $discounts as $data ) {
3326
+        foreach ($discounts as $data) {
3327 3327
 
3328
-			if ( $data['recurring'] ) {
3328
+			if ($data['recurring']) {
3329 3329
 				$recurring += $data['amount'];
3330 3330
 			} else {
3331 3331
 				$discount += $data['amount'];
@@ -3333,10 +3333,10 @@  discard block
 block discarded – undo
3333 3333
 
3334 3334
 		}
3335 3335
 
3336
-		if ( $this->is_renewal() ) {
3337
-			$this->set_total_discount( $recurring );
3336
+		if ($this->is_renewal()) {
3337
+			$this->set_total_discount($recurring);
3338 3338
 		} else {
3339
-			$this->set_total_discount( $discount );
3339
+			$this->set_total_discount($discount);
3340 3340
 		}
3341 3341
 
3342 3342
 		$this->totals['discount'] = array(
@@ -3355,13 +3355,13 @@  discard block
 block discarded – undo
3355 3355
 	 * @return float The recalculated tax
3356 3356
 	 */
3357 3357
 	public function recalculate_total_tax() {
3358
-        $taxes     = $this->get_taxes();
3358
+        $taxes = $this->get_taxes();
3359 3359
 		$tax       = 0;
3360 3360
 		$recurring = 0;
3361 3361
 
3362
-        foreach ( $taxes as $data ) {
3362
+        foreach ($taxes as $data) {
3363 3363
 
3364
-			if ( $data['recurring'] ) {
3364
+			if ($data['recurring']) {
3365 3365
 				$recurring += $data['amount'];
3366 3366
 			} else {
3367 3367
 				$tax += $data['amount'];
@@ -3369,10 +3369,10 @@  discard block
 block discarded – undo
3369 3369
 
3370 3370
 		}
3371 3371
 
3372
-		if ( $this->is_renewal() ) {
3373
-			$this->set_total_tax( $recurring );
3372
+		if ($this->is_renewal()) {
3373
+			$this->set_total_tax($recurring);
3374 3374
 		} else {
3375
-			$this->set_total_tax( $tax );
3375
+			$this->set_total_tax($tax);
3376 3376
 		}
3377 3377
 
3378 3378
 		$this->totals['tax'] = array(
@@ -3395,9 +3395,9 @@  discard block
 block discarded – undo
3395 3395
 		$fee       = 0;
3396 3396
 		$recurring = 0;
3397 3397
 
3398
-        foreach ( $fees as $data ) {
3398
+        foreach ($fees as $data) {
3399 3399
 
3400
-			if ( $data['recurring'] ) {
3400
+			if ($data['recurring']) {
3401 3401
 				$recurring += $data['amount'];
3402 3402
 			} else {
3403 3403
 				$fee += $data['amount'];
@@ -3405,10 +3405,10 @@  discard block
 block discarded – undo
3405 3405
 
3406 3406
 		}
3407 3407
 
3408
-        if ( $this->is_renewal() ) {
3409
-			$this->set_total_fees( $recurring );
3408
+        if ($this->is_renewal()) {
3409
+			$this->set_total_fees($recurring);
3410 3410
 		} else {
3411
-			$this->set_total_fees( $fee );
3411
+			$this->set_total_fees($fee);
3412 3412
 		}
3413 3413
 
3414 3414
 		$this->totals['fee'] = array(
@@ -3416,7 +3416,7 @@  discard block
 block discarded – undo
3416 3416
 			'recurring' => $recurring,
3417 3417
 		);
3418 3418
 
3419
-        $this->set_total_fees( $fee );
3419
+        $this->set_total_fees($fee);
3420 3420
         return $this->is_renewal() ? $recurring : $fee;
3421 3421
     }
3422 3422
 
@@ -3437,9 +3437,9 @@  discard block
 block discarded – undo
3437 3437
 	/**
3438 3438
 	 * @deprecated
3439 3439
 	 */
3440
-    public function recalculate_totals( $temp = false ) {
3441
-        $this->update_items( $temp );
3442
-        $this->save( true );
3440
+    public function recalculate_totals($temp = false) {
3441
+        $this->update_items($temp);
3442
+        $this->save(true);
3443 3443
         return $this;
3444 3444
     }
3445 3445
 
@@ -3456,33 +3456,33 @@  discard block
 block discarded – undo
3456 3456
      * @param string $note The note being added.
3457 3457
      *
3458 3458
      */
3459
-    public function add_note( $note = '', $customer_type = false, $added_by_user = false, $system = false ) {
3459
+    public function add_note($note = '', $customer_type = false, $added_by_user = false, $system = false) {
3460 3460
 
3461 3461
         // Bail if no note specified or this invoice is not yet saved.
3462
-        if ( ! $note || $this->get_id() == 0 ) {
3462
+        if (!$note || $this->get_id() == 0) {
3463 3463
             return false;
3464 3464
         }
3465 3465
 
3466
-        if ( ( ( is_user_logged_in() && wpinv_current_user_can_manage_invoicing() ) || $added_by_user ) && !$system ) {
3467
-            $user                 = get_user_by( 'id', get_current_user_id() );
3466
+        if (((is_user_logged_in() && wpinv_current_user_can_manage_invoicing()) || $added_by_user) && !$system) {
3467
+            $user                 = get_user_by('id', get_current_user_id());
3468 3468
             $comment_author       = $user->display_name;
3469 3469
             $comment_author_email = $user->user_email;
3470 3470
         } else {
3471 3471
             $comment_author       = 'System';
3472 3472
             $comment_author_email = 'system@';
3473
-            $comment_author_email .= isset( $_SERVER['HTTP_HOST'] ) ? str_replace( 'www.', '', $_SERVER['HTTP_HOST'] ) : 'noreply.com';
3474
-            $comment_author_email = sanitize_email( $comment_author_email );
3473
+            $comment_author_email .= isset($_SERVER['HTTP_HOST']) ? str_replace('www.', '', $_SERVER['HTTP_HOST']) : 'noreply.com';
3474
+            $comment_author_email = sanitize_email($comment_author_email);
3475 3475
         }
3476 3476
 
3477
-        do_action( 'wpinv_pre_insert_invoice_note', $this->get_id(), $note, $customer_type );
3477
+        do_action('wpinv_pre_insert_invoice_note', $this->get_id(), $note, $customer_type);
3478 3478
 
3479
-        $note_id = wp_insert_comment( wp_filter_comment( array(
3479
+        $note_id = wp_insert_comment(wp_filter_comment(array(
3480 3480
             'comment_post_ID'      => $this->get_id(),
3481 3481
             'comment_content'      => $note,
3482 3482
             'comment_agent'        => 'GetPaid',
3483 3483
             'user_id'              => is_admin() ? get_current_user_id() : 0,
3484
-            'comment_date'         => current_time( 'mysql' ),
3485
-            'comment_date_gmt'     => current_time( 'mysql', 1 ),
3484
+            'comment_date'         => current_time('mysql'),
3485
+            'comment_date_gmt'     => current_time('mysql', 1),
3486 3486
             'comment_approved'     => 1,
3487 3487
             'comment_parent'       => 0,
3488 3488
             'comment_author'       => $comment_author,
@@ -3490,13 +3490,13 @@  discard block
 block discarded – undo
3490 3490
             'comment_author_url'   => '',
3491 3491
             'comment_author_email' => $comment_author_email,
3492 3492
             'comment_type'         => 'wpinv_note'
3493
-        ) ) );
3493
+        )));
3494 3494
 
3495
-        do_action( 'wpinv_insert_payment_note', $note_id, $this->get_id(), $note );
3495
+        do_action('wpinv_insert_payment_note', $note_id, $this->get_id(), $note);
3496 3496
 
3497
-        if ( $customer_type ) {
3498
-            add_comment_meta( $note_id, '_wpi_customer_note', 1 );
3499
-            do_action( 'wpinv_new_customer_note', array( 'invoice_id' => $this->get_id(), 'user_note' => $note ) );
3497
+        if ($customer_type) {
3498
+            add_comment_meta($note_id, '_wpi_customer_note', 1);
3499
+            do_action('wpinv_new_customer_note', array('invoice_id' => $this->get_id(), 'user_note' => $note));
3500 3500
         }
3501 3501
 
3502 3502
         return $note_id;
@@ -3505,10 +3505,10 @@  discard block
 block discarded – undo
3505 3505
 	/**
3506 3506
      * Generates a unique key for the invoice.
3507 3507
      */
3508
-    public function generate_key( $string = '' ) {
3509
-        $auth_key  = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
3508
+    public function generate_key($string = '') {
3509
+        $auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
3510 3510
         return strtolower(
3511
-            md5( $this->get_id() . $string . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'wpinv', true ) )
3511
+            md5($this->get_id() . $string . date('Y-m-d H:i:s') . $auth_key . uniqid('wpinv', true))
3512 3512
         );
3513 3513
     }
3514 3514
 
@@ -3518,11 +3518,11 @@  discard block
 block discarded – undo
3518 3518
     public function generate_number() {
3519 3519
         $number = $this->get_id();
3520 3520
 
3521
-        if ( $this->has_status( 'auto-draft' ) && wpinv_sequential_number_active( $this->post_type ) ) {
3522
-            $number = wpinv_get_next_invoice_number( $this->post_type );
3521
+        if ($this->has_status('auto-draft') && wpinv_sequential_number_active($this->post_type)) {
3522
+            $number = wpinv_get_next_invoice_number($this->post_type);
3523 3523
         }
3524 3524
 
3525
-		$number = wpinv_format_invoice_number( $number, $this->post_type );
3525
+		$number = wpinv_format_invoice_number($number, $this->post_type);
3526 3526
 
3527 3527
 		return $number;
3528 3528
 	}
@@ -3536,47 +3536,47 @@  discard block
 block discarded – undo
3536 3536
 		// Reset status transition variable.
3537 3537
 		$this->status_transition = false;
3538 3538
 
3539
-		if ( $status_transition ) {
3539
+		if ($status_transition) {
3540 3540
 			try {
3541 3541
 
3542 3542
 				// Fire a hook for the status change.
3543
-				do_action( 'getpaid_invoice_status_' . $status_transition['to'], $this->get_id(), $this, $status_transition );
3543
+				do_action('getpaid_invoice_status_' . $status_transition['to'], $this->get_id(), $this, $status_transition);
3544 3544
 
3545 3545
 				// @deprecated this is deprecated and will be removed in the future.
3546
-				do_action( 'wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3546
+				do_action('wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from']);
3547 3547
 
3548
-				if ( ! empty( $status_transition['from'] ) ) {
3548
+				if (!empty($status_transition['from'])) {
3549 3549
 
3550 3550
 					/* translators: 1: old invoice status 2: new invoice status */
3551
-					$transition_note = sprintf( __( 'Status changed from %1$s to %2$s.', 'invoicing' ), wpinv_status_nicename( $status_transition['from'] ), wpinv_status_nicename( $status_transition['to'] ) );
3551
+					$transition_note = sprintf(__('Status changed from %1$s to %2$s.', 'invoicing'), wpinv_status_nicename($status_transition['from']), wpinv_status_nicename($status_transition['to']));
3552 3552
 
3553 3553
 					// Fire another hook.
3554
-					do_action( 'getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $this );
3555
-					do_action( 'getpaid_invoice_status_changed', $this->get_id(), $status_transition['from'], $status_transition['to'], $this );
3554
+					do_action('getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $this);
3555
+					do_action('getpaid_invoice_status_changed', $this->get_id(), $status_transition['from'], $status_transition['to'], $this);
3556 3556
 
3557 3557
 					// @deprecated this is deprecated and will be removed in the future.
3558
-					do_action( 'wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3558
+					do_action('wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from']);
3559 3559
 
3560 3560
 					// Note the transition occurred.
3561
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
3561
+					$this->add_note(trim($status_transition['note'] . ' ' . $transition_note), 0, $status_transition['manual']);
3562 3562
 
3563 3563
 					// Work out if this was for a payment, and trigger a payment_status hook instead.
3564 3564
 					if (
3565
-						in_array( $status_transition['from'], array( 'wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded' ), true )
3566
-						&& in_array( $status_transition['to'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3565
+						in_array($status_transition['from'], array('wpi-cancelled', 'wpi-pending', 'wpi-failed', 'wpi-refunded'), true)
3566
+						&& in_array($status_transition['to'], array('publish', 'wpi-processing', 'wpi-renewal'), true)
3567 3567
 					) {
3568
-						do_action( 'getpaid_invoice_payment_status_changed', $this->get_id(), $this, $status_transition );
3568
+						do_action('getpaid_invoice_payment_status_changed', $this->get_id(), $this, $status_transition);
3569 3569
 					}
3570 3570
 				} else {
3571 3571
 					/* translators: %s: new invoice status */
3572
-					$transition_note = sprintf( __( 'Status set to %s.', 'invoicing' ), wpinv_status_nicename( $status_transition['to'] ) );
3572
+					$transition_note = sprintf(__('Status set to %s.', 'invoicing'), wpinv_status_nicename($status_transition['to']));
3573 3573
 
3574 3574
 					// Note the transition occurred.
3575
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
3575
+					$this->add_note(trim($status_transition['note'] . ' ' . $transition_note), 0, $status_transition['manual']);
3576 3576
 
3577 3577
 				}
3578
-			} catch ( Exception $e ) {
3579
-				$this->add_note( __( 'Error during status transition.', 'invoicing' ) . ' ' . $e->getMessage() );
3578
+			} catch (Exception $e) {
3579
+				$this->add_note(__('Error during status transition.', 'invoicing') . ' ' . $e->getMessage());
3580 3580
 			}
3581 3581
 		}
3582 3582
 	}
@@ -3584,13 +3584,13 @@  discard block
 block discarded – undo
3584 3584
 	/**
3585 3585
 	 * Updates an invoice status.
3586 3586
 	 */
3587
-	public function update_status( $new_status = false, $note = '', $manual = false ) {
3587
+	public function update_status($new_status = false, $note = '', $manual = false) {
3588 3588
 
3589 3589
 		// Fires before updating a status.
3590
-		do_action( 'wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status( 'edit' ) );
3590
+		do_action('wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status('edit'));
3591 3591
 
3592 3592
 		// Update the status.
3593
-		$this->set_status( $new_status, $note, $manual );
3593
+		$this->set_status($new_status, $note, $manual);
3594 3594
 
3595 3595
 		// Save the order.
3596 3596
 		return $this->save();
@@ -3601,18 +3601,18 @@  discard block
 block discarded – undo
3601 3601
 	 * @deprecated
3602 3602
 	 */
3603 3603
 	public function refresh_item_ids() {
3604
-        $item_ids = implode( ',', array_unique( array_keys( $this->get_items() ) ) );
3605
-        update_post_meta( $this->get_id(), '_wpinv_item_ids', $item_ids );
3604
+        $item_ids = implode(',', array_unique(array_keys($this->get_items())));
3605
+        update_post_meta($this->get_id(), '_wpinv_item_ids', $item_ids);
3606 3606
 	}
3607 3607
 
3608 3608
 	/**
3609 3609
 	 * @deprecated
3610 3610
 	 */
3611
-	public function update_items( $temp = false ) {
3611
+	public function update_items($temp = false) {
3612 3612
 
3613
-		$this->set_items( $this->get_items() );
3613
+		$this->set_items($this->get_items());
3614 3614
 
3615
-		if ( ! $temp ) {
3615
+		if (!$temp) {
3616 3616
 			$this->save();
3617 3617
 		}
3618 3618
 
@@ -3626,11 +3626,11 @@  discard block
 block discarded – undo
3626 3626
 
3627 3627
         $discount_code = $this->get_discount_code();
3628 3628
 
3629
-        if ( empty( $discount_code ) ) {
3629
+        if (empty($discount_code)) {
3630 3630
             return false;
3631 3631
         }
3632 3632
 
3633
-        $discount = wpinv_get_discount_obj( $discount_code );
3633
+        $discount = wpinv_get_discount_obj($discount_code);
3634 3634
 
3635 3635
         // Ensure it is active.
3636 3636
         return $discount->exists();
@@ -3641,7 +3641,7 @@  discard block
 block discarded – undo
3641 3641
 	 * Refunds an invoice.
3642 3642
 	 */
3643 3643
     public function refund() {
3644
-		$this->set_status( 'wpi-refunded' );
3644
+		$this->set_status('wpi-refunded');
3645 3645
         $this->save();
3646 3646
     }
3647 3647
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@
 block discarded – undo
156 156
 			$this->set_id( $invoice_id );
157 157
 		} elseif ( is_scalar( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'transaction_id' ) ) {
158 158
 			$this->set_id( $invoice_id );
159
-		}else {
159
+		} else {
160 160
 			$this->set_object_read( true );
161 161
 		}
162 162
 
Please login to merge, or discard this patch.
includes/wpinv-helper-functions.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
  * @return array
97 97
  */
98 98
 function wpinv_get_invoice_statuses( $draft = false, $trashed = false, $invoice = false ) {
99
-	$invoice_statuses = array(
100
-		'wpi-pending'    => _x( 'Pending payment', 'Invoice status', 'invoicing' ),
99
+    $invoice_statuses = array(
100
+        'wpi-pending'    => _x( 'Pending payment', 'Invoice status', 'invoicing' ),
101 101
         'publish'        => _x( 'Paid', 'Invoice status', 'invoicing' ),
102 102
         'wpi-processing' => _x( 'Processing', 'Invoice status', 'invoicing' ),
103
-		'wpi-onhold'     => _x( 'On hold', 'Invoice status', 'invoicing' ),
104
-		'wpi-cancelled'  => _x( 'Cancelled', 'Invoice status', 'invoicing' ),
105
-		'wpi-refunded'   => _x( 'Refunded', 'Invoice status', 'invoicing' ),
103
+        'wpi-onhold'     => _x( 'On hold', 'Invoice status', 'invoicing' ),
104
+        'wpi-cancelled'  => _x( 'Cancelled', 'Invoice status', 'invoicing' ),
105
+        'wpi-refunded'   => _x( 'Refunded', 'Invoice status', 'invoicing' ),
106 106
         'wpi-failed'     => _x( 'Failed', 'Invoice status', 'invoicing' ),
107 107
         'wpi-renewal'    => _x( 'Renewal Payment', 'Invoice status', 'invoicing' ),
108 108
     );
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         $invoice_statuses['trash'] = __( 'Trash', 'invoicing' );
116 116
     }
117 117
 
118
-	return apply_filters( 'wpinv_statuses', $invoice_statuses, $invoice );
118
+    return apply_filters( 'wpinv_statuses', $invoice_statuses, $invoice );
119 119
 }
120 120
 
121 121
 function wpinv_status_nicename( $status ) {
@@ -712,13 +712,13 @@  discard block
 block discarded – undo
712 712
  * @param mixed  $value Value.
713 713
  */
714 714
 function getpaid_maybe_define_constant( $name, $value ) {
715
-	if ( ! defined( $name ) ) {
716
-		define( $name, $value );
717
-	}
715
+    if ( ! defined( $name ) ) {
716
+        define( $name, $value );
717
+    }
718 718
 }
719 719
 
720 720
 function wpinv_get_php_arg_separator_output() {
721
-	return ini_get( 'arg_separator.output' );
721
+    return ini_get( 'arg_separator.output' );
722 722
 }
723 723
 
724 724
 function wpinv_rgb_from_hex( $color ) {
@@ -1067,11 +1067,11 @@  discard block
 block discarded – undo
1067 1067
         $list = array();
1068 1068
     }
1069 1069
 
1070
-	if ( ! is_array( $list ) ) {
1071
-		return preg_split( '/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY );
1072
-	}
1070
+    if ( ! is_array( $list ) ) {
1071
+        return preg_split( '/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY );
1072
+    }
1073 1073
 
1074
-	return $list;
1074
+    return $list;
1075 1075
 }
1076 1076
 
1077 1077
 /**
@@ -1091,9 +1091,9 @@  discard block
 block discarded – undo
1091 1091
     }
1092 1092
 
1093 1093
     $data = apply_filters( "wpinv_get_$key", include WPINV_PLUGIN_DIR . "includes/data/$key.php" );
1094
-	wp_cache_set( "wpinv-data-$key", $data, 'wpinv' );
1094
+    wp_cache_set( "wpinv-data-$key", $data, 'wpinv' );
1095 1095
 
1096
-	return $data;
1096
+    return $data;
1097 1097
 }
1098 1098
 
1099 1099
 /**
@@ -1122,17 +1122,17 @@  discard block
 block discarded – undo
1122 1122
  */
1123 1123
 function wpinv_clean( $var ) {
1124 1124
 
1125
-	if ( is_array( $var ) ) {
1126
-		return array_map( 'wpinv_clean', $var );
1125
+    if ( is_array( $var ) ) {
1126
+        return array_map( 'wpinv_clean', $var );
1127 1127
     }
1128 1128
 
1129 1129
     if ( is_object( $var ) ) {
1130
-		$object_vars = get_object_vars( $var );
1131
-		foreach ( $object_vars as $property_name => $property_value ) {
1132
-			$var->$property_name = wpinv_clean( $property_value );
1130
+        $object_vars = get_object_vars( $var );
1131
+        foreach ( $object_vars as $property_name => $property_value ) {
1132
+            $var->$property_name = wpinv_clean( $property_value );
1133 1133
         }
1134 1134
         return $var;
1135
-	}
1135
+    }
1136 1136
     
1137 1137
     return is_string( $var ) ? sanitize_text_field( $var ) : $var;
1138 1138
 }
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
  */
1146 1146
 function getpaid_convert_price_string_to_options( $str ) {
1147 1147
 
1148
-	$raw_options = array_map( 'trim', explode( ',', $str ) );
1148
+    $raw_options = array_map( 'trim', explode( ',', $str ) );
1149 1149
     $options     = array();
1150 1150
 
1151 1151
     foreach ( $raw_options as $option ) {
Please login to merge, or discard this patch.
Spacing   +434 added lines, -434 removed lines patch added patch discarded remove patch
@@ -7,86 +7,86 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // MUST have WordPress.
10
-if ( !defined( 'WPINC' ) ) {
11
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
10
+if (!defined('WPINC')) {
11
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
12 12
 }
13 13
 
14 14
 function wpinv_item_quantities_enabled() {
15
-    $ret = wpinv_get_option( 'item_quantities', true );
15
+    $ret = wpinv_get_option('item_quantities', true);
16 16
 
17
-    return (bool) apply_filters( 'wpinv_item_quantities_enabled', $ret );
17
+    return (bool) apply_filters('wpinv_item_quantities_enabled', $ret);
18 18
 }
19 19
 
20 20
 function wpinv_get_ip() {
21 21
     $ip = '127.0.0.1';
22 22
 
23
-    if ( !empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
24
-        $ip = sanitize_text_field( $_SERVER['HTTP_CLIENT_IP'] );
25
-    } elseif ( !empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
26
-        $ip = sanitize_text_field( $_SERVER['HTTP_X_FORWARDED_FOR'] );
27
-    } elseif( !empty( $_SERVER['REMOTE_ADDR'] ) ) {
28
-        $ip = sanitize_text_field( $_SERVER['REMOTE_ADDR'] );
23
+    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
24
+        $ip = sanitize_text_field($_SERVER['HTTP_CLIENT_IP']);
25
+    } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
26
+        $ip = sanitize_text_field($_SERVER['HTTP_X_FORWARDED_FOR']);
27
+    } elseif (!empty($_SERVER['REMOTE_ADDR'])) {
28
+        $ip = sanitize_text_field($_SERVER['REMOTE_ADDR']);
29 29
     }
30 30
 
31
-    return apply_filters( 'wpinv_get_ip', $ip );
31
+    return apply_filters('wpinv_get_ip', $ip);
32 32
 }
33 33
 
34 34
 function wpinv_get_user_agent() {
35
-    if ( ! empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
36
-        $user_agent = sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] );
35
+    if (!empty($_SERVER['HTTP_USER_AGENT'])) {
36
+        $user_agent = sanitize_text_field($_SERVER['HTTP_USER_AGENT']);
37 37
     } else {
38 38
         $user_agent = '';
39 39
     }
40 40
 
41
-    return apply_filters( 'wpinv_get_user_agent', $user_agent );
41
+    return apply_filters('wpinv_get_user_agent', $user_agent);
42 42
 }
43 43
 
44
-function wpinv_sanitize_amount( $amount, $decimals = NULL ) {
44
+function wpinv_sanitize_amount($amount, $decimals = NULL) {
45 45
     $is_negative   = false;
46 46
     $thousands_sep = wpinv_thousands_separator();
47 47
     $decimal_sep   = wpinv_decimal_separator();
48
-    if ( $decimals === NULL ) {
48
+    if ($decimals === NULL) {
49 49
         $decimals = wpinv_decimals();
50 50
     }
51 51
 
52 52
     // Sanitize the amount
53
-    if ( $decimal_sep == ',' && false !== ( $found = strpos( $amount, $decimal_sep ) ) ) {
54
-        if ( ( $thousands_sep == '.' || $thousands_sep == ' ' ) && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
55
-            $amount = str_replace( $thousands_sep, '', $amount );
56
-        } elseif( empty( $thousands_sep ) && false !== ( $found = strpos( $amount, '.' ) ) ) {
57
-            $amount = str_replace( '.', '', $amount );
53
+    if ($decimal_sep == ',' && false !== ($found = strpos($amount, $decimal_sep))) {
54
+        if (($thousands_sep == '.' || $thousands_sep == ' ') && false !== ($found = strpos($amount, $thousands_sep))) {
55
+            $amount = str_replace($thousands_sep, '', $amount);
56
+        } elseif (empty($thousands_sep) && false !== ($found = strpos($amount, '.'))) {
57
+            $amount = str_replace('.', '', $amount);
58 58
         }
59 59
 
60
-        $amount = str_replace( $decimal_sep, '.', $amount );
61
-    } elseif( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
62
-        $amount = str_replace( $thousands_sep, '', $amount );
60
+        $amount = str_replace($decimal_sep, '.', $amount);
61
+    } elseif ($thousands_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) {
62
+        $amount = str_replace($thousands_sep, '', $amount);
63 63
     }
64 64
 
65
-    if( $amount < 0 ) {
65
+    if ($amount < 0) {
66 66
         $is_negative = true;
67 67
     }
68 68
 
69
-    $amount   = preg_replace( '/[^0-9\.]/', '', $amount );
69
+    $amount   = preg_replace('/[^0-9\.]/', '', $amount);
70 70
 
71
-    $decimals = apply_filters( 'wpinv_sanitize_amount_decimals', absint( $decimals ), $amount );
72
-    $amount   = number_format( (double) $amount, absint( $decimals ), '.', '' );
71
+    $decimals = apply_filters('wpinv_sanitize_amount_decimals', absint($decimals), $amount);
72
+    $amount   = number_format((double) $amount, absint($decimals), '.', '');
73 73
 
74
-    if( $is_negative ) {
74
+    if ($is_negative) {
75 75
         $amount *= -1;
76 76
     }
77 77
 
78
-    return apply_filters( 'wpinv_sanitize_amount', $amount, $decimals );
78
+    return apply_filters('wpinv_sanitize_amount', $amount, $decimals);
79 79
 }
80
-add_filter( 'wpinv_sanitize_amount_decimals', 'wpinv_currency_decimal_filter', 10, 1 );
80
+add_filter('wpinv_sanitize_amount_decimals', 'wpinv_currency_decimal_filter', 10, 1);
81 81
 
82
-function wpinv_round_amount( $amount, $decimals = NULL ) {
83
-    if ( $decimals === NULL ) {
82
+function wpinv_round_amount($amount, $decimals = NULL) {
83
+    if ($decimals === NULL) {
84 84
         $decimals = wpinv_decimals();
85 85
     }
86 86
     
87
-    $amount = round( (double)$amount, wpinv_currency_decimal_filter( absint( $decimals ) ) );
87
+    $amount = round((double) $amount, wpinv_currency_decimal_filter(absint($decimals)));
88 88
 
89
-    return apply_filters( 'wpinv_round_amount', $amount, $decimals );
89
+    return apply_filters('wpinv_round_amount', $amount, $decimals);
90 90
 }
91 91
 
92 92
 /**
@@ -95,48 +95,48 @@  discard block
 block discarded – undo
95 95
  * @since 1.0.19
96 96
  * @return array
97 97
  */
98
-function wpinv_get_invoice_statuses( $draft = false, $trashed = false, $invoice = false ) {
98
+function wpinv_get_invoice_statuses($draft = false, $trashed = false, $invoice = false) {
99 99
 	$invoice_statuses = array(
100
-		'wpi-pending'    => _x( 'Pending payment', 'Invoice status', 'invoicing' ),
101
-        'publish'        => _x( 'Paid', 'Invoice status', 'invoicing' ),
102
-        'wpi-processing' => _x( 'Processing', 'Invoice status', 'invoicing' ),
103
-		'wpi-onhold'     => _x( 'On hold', 'Invoice status', 'invoicing' ),
104
-		'wpi-cancelled'  => _x( 'Cancelled', 'Invoice status', 'invoicing' ),
105
-		'wpi-refunded'   => _x( 'Refunded', 'Invoice status', 'invoicing' ),
106
-        'wpi-failed'     => _x( 'Failed', 'Invoice status', 'invoicing' ),
107
-        'wpi-renewal'    => _x( 'Renewal Payment', 'Invoice status', 'invoicing' ),
100
+		'wpi-pending'    => _x('Pending payment', 'Invoice status', 'invoicing'),
101
+        'publish'        => _x('Paid', 'Invoice status', 'invoicing'),
102
+        'wpi-processing' => _x('Processing', 'Invoice status', 'invoicing'),
103
+		'wpi-onhold'     => _x('On hold', 'Invoice status', 'invoicing'),
104
+		'wpi-cancelled'  => _x('Cancelled', 'Invoice status', 'invoicing'),
105
+		'wpi-refunded'   => _x('Refunded', 'Invoice status', 'invoicing'),
106
+        'wpi-failed'     => _x('Failed', 'Invoice status', 'invoicing'),
107
+        'wpi-renewal'    => _x('Renewal Payment', 'Invoice status', 'invoicing'),
108 108
     );
109 109
 
110
-    if ( $draft ) {
111
-        $invoice_statuses['draft'] = __( 'Draft', 'invoicing' );
110
+    if ($draft) {
111
+        $invoice_statuses['draft'] = __('Draft', 'invoicing');
112 112
     }
113 113
 
114
-    if ( $trashed ) {
115
-        $invoice_statuses['trash'] = __( 'Trash', 'invoicing' );
114
+    if ($trashed) {
115
+        $invoice_statuses['trash'] = __('Trash', 'invoicing');
116 116
     }
117 117
 
118
-	return apply_filters( 'wpinv_statuses', $invoice_statuses, $invoice );
118
+	return apply_filters('wpinv_statuses', $invoice_statuses, $invoice);
119 119
 }
120 120
 
121
-function wpinv_status_nicename( $status ) {
122
-    $statuses = wpinv_get_invoice_statuses( true, true );
123
-    $status   = isset( $statuses[$status] ) ? $statuses[$status] : __( $status, 'invoicing' );
121
+function wpinv_status_nicename($status) {
122
+    $statuses = wpinv_get_invoice_statuses(true, true);
123
+    $status   = isset($statuses[$status]) ? $statuses[$status] : __($status, 'invoicing');
124 124
 
125 125
     return $status;
126 126
 }
127 127
 
128 128
 function wpinv_get_currency() {
129
-    $currency = wpinv_get_option( 'currency', 'USD' );
129
+    $currency = wpinv_get_option('currency', 'USD');
130 130
     
131
-    return apply_filters( 'wpinv_currency', $currency );
131
+    return apply_filters('wpinv_currency', $currency);
132 132
 }
133 133
 
134
-function wpinv_currency_symbol( $currency = '' ) {
135
-    if ( empty( $currency ) ) {
134
+function wpinv_currency_symbol($currency = '') {
135
+    if (empty($currency)) {
136 136
         $currency = wpinv_get_currency();
137 137
     }
138 138
     
139
-    $symbols = apply_filters( 'wpinv_currency_symbols', array(
139
+    $symbols = apply_filters('wpinv_currency_symbols', array(
140 140
         'AED' => '&#x62f;.&#x625;',
141 141
         'AFN' => '&#x60b;',
142 142
         'ALL' => 'L',
@@ -299,209 +299,209 @@  discard block
 block discarded – undo
299 299
         'YER' => '&#xfdfc;',
300 300
         'ZAR' => '&#82;',
301 301
         'ZMW' => 'ZK',
302
-    ) );
302
+    ));
303 303
 
304
-    $currency_symbol = isset( $symbols[$currency] ) ? $symbols[$currency] : $currency;
304
+    $currency_symbol = isset($symbols[$currency]) ? $symbols[$currency] : $currency;
305 305
 
306
-    return apply_filters( 'wpinv_currency_symbol', $currency_symbol, $currency );
306
+    return apply_filters('wpinv_currency_symbol', $currency_symbol, $currency);
307 307
 }
308 308
 
309 309
 function wpinv_currency_position() {
310
-    $position = wpinv_get_option( 'currency_position', 'left' );
310
+    $position = wpinv_get_option('currency_position', 'left');
311 311
     
312
-    return apply_filters( 'wpinv_currency_position', $position );
312
+    return apply_filters('wpinv_currency_position', $position);
313 313
 }
314 314
 
315 315
 function wpinv_thousands_separator() {
316
-    $thousand_sep = wpinv_get_option( 'thousands_separator', ',' );
316
+    $thousand_sep = wpinv_get_option('thousands_separator', ',');
317 317
     
318
-    return apply_filters( 'wpinv_thousands_separator', $thousand_sep );
318
+    return apply_filters('wpinv_thousands_separator', $thousand_sep);
319 319
 }
320 320
 
321 321
 function wpinv_decimal_separator() {
322
-    $decimal_sep = wpinv_get_option( 'decimal_separator', '.' );
322
+    $decimal_sep = wpinv_get_option('decimal_separator', '.');
323 323
     
324
-    return apply_filters( 'wpinv_decimal_separator', $decimal_sep );
324
+    return apply_filters('wpinv_decimal_separator', $decimal_sep);
325 325
 }
326 326
 
327 327
 function wpinv_decimals() {
328
-    $decimals = apply_filters( 'wpinv_decimals', wpinv_get_option( 'decimals', 2 ) );
328
+    $decimals = apply_filters('wpinv_decimals', wpinv_get_option('decimals', 2));
329 329
     
330
-    return absint( $decimals );
330
+    return absint($decimals);
331 331
 }
332 332
 
333 333
 function wpinv_get_currencies() {
334 334
     $currencies = array(
335
-        'USD' => __( 'US Dollar', 'invoicing' ),
336
-        'EUR' => __( 'Euro', 'invoicing' ),
337
-        'GBP' => __( 'Pound Sterling', 'invoicing' ),
338
-        'AED' => __( 'United Arab Emirates', 'invoicing' ),
339
-        'AFN' => __( 'Afghan Afghani', 'invoicing' ),
340
-        'ALL' => __( 'Albanian Lek', 'invoicing' ),
341
-        'AMD' => __( 'Armenian Dram', 'invoicing' ),
342
-        'ANG' => __( 'Netherlands Antillean Guilder', 'invoicing' ),
343
-        'AOA' => __( 'Angolan Kwanza', 'invoicing' ),
344
-        'ARS' => __( 'Argentine Peso', 'invoicing' ),
345
-        'AUD' => __( 'Australian Dollar', 'invoicing' ),
346
-        'AWG' => __( 'Aruban Florin', 'invoicing' ),
347
-        'AZN' => __( 'Azerbaijani Manat', 'invoicing' ),
348
-        'BAM' => __( 'Bosnia and Herzegovina Convertible Marka', 'invoicing' ),
349
-        'BBD' => __( 'Barbadian Dollar', 'invoicing' ),
350
-        'BDT' => __( 'Bangladeshi Taka', 'invoicing' ),
351
-        'BGN' => __( 'Bulgarian Lev', 'invoicing' ),
352
-        'BHD' => __( 'Bahraini Dinar', 'invoicing' ),
353
-        'BIF' => __( 'Burundian Franc', 'invoicing' ),
354
-        'BMD' => __( 'Bermudian Dollar', 'invoicing' ),
355
-        'BND' => __( 'Brunei Dollar', 'invoicing' ),
356
-        'BOB' => __( 'Bolivian Boliviano', 'invoicing' ),
357
-        'BRL' => __( 'Brazilian Real', 'invoicing' ),
358
-        'BSD' => __( 'Bahamian Dollar', 'invoicing' ),
359
-        'BTC' => __( 'Bitcoin', 'invoicing' ),
360
-        'BTN' => __( 'Bhutanese Ngultrum', 'invoicing' ),
361
-        'BWP' => __( 'Botswana Pula', 'invoicing' ),
362
-        'BYN' => __( 'Belarusian Ruble', 'invoicing' ),
363
-        'BZD' => __( 'Belize Dollar', 'invoicing' ),
364
-        'CAD' => __( 'Canadian Dollar', 'invoicing' ),
365
-        'CDF' => __( 'Congolese Franc', 'invoicing' ),
366
-        'CHF' => __( 'Swiss Franc', 'invoicing' ),
367
-        'CLP' => __( 'Chilean Peso', 'invoicing' ),
368
-        'CNY' => __( 'Chinese Yuan', 'invoicing' ),
369
-        'COP' => __( 'Colombian Peso', 'invoicing' ),
370
-        'CRC' => __( 'Costa Rican Colon', 'invoicing' ),
371
-        'CUC' => __( 'Cuban Convertible Peso', 'invoicing' ),
372
-        'CUP' => __( 'Cuban Peso', 'invoicing' ),
373
-        'CVE' => __( 'Cape Verdean escudo', 'invoicing' ),
374
-        'CZK' => __( 'Czech Koruna', 'invoicing' ),
375
-        'DJF' => __( 'Djiboutian Franc', 'invoicing' ),
376
-        'DKK' => __( 'Danish Krone', 'invoicing' ),
377
-        'DOP' => __( 'Dominican Peso', 'invoicing' ),
378
-        'DZD' => __( 'Algerian Dinar', 'invoicing' ),
379
-        'EGP' => __( 'Egyptian Pound', 'invoicing' ),
380
-        'ERN' => __( 'Eritrean Nakfa', 'invoicing' ),
381
-        'ETB' => __( 'Ethiopian Irr', 'invoicing' ),
382
-        'FJD' => __( 'Fijian Dollar', 'invoicing' ),
383
-        'FKP' => __( 'Falkland Islands Pound', 'invoicing' ),
384
-        'GEL' => __( 'Georgian Lari', 'invoicing' ),
385
-        'GGP' => __( 'Guernsey Pound', 'invoicing' ),
386
-        'GHS' => __( 'Ghana Cedi', 'invoicing' ),
387
-        'GIP' => __( 'Gibraltar Pound', 'invoicing' ),
388
-        'GMD' => __( 'Gambian Dalasi', 'invoicing' ),
389
-        'GNF' => __( 'Guinean Franc', 'invoicing' ),
390
-        'GTQ' => __( 'Guatemalan Quetzal', 'invoicing' ),
391
-        'GYD' => __( 'Guyanese Dollar', 'invoicing' ),
392
-        'HKD' => __( 'Hong Kong Dollar', 'invoicing' ),
393
-        'HNL' => __( 'Honduran Lempira', 'invoicing' ),
394
-        'HRK' => __( 'Croatian Kuna', 'invoicing' ),
395
-        'HTG' => __( 'Haitian Gourde', 'invoicing' ),
396
-        'HUF' => __( 'Hungarian Forint', 'invoicing' ),
397
-        'IDR' => __( 'Indonesian Rupiah', 'invoicing' ),
398
-        'ILS' => __( 'Israeli New Shekel', 'invoicing' ),
399
-        'IMP' => __( 'Manx Pound', 'invoicing' ),
400
-        'INR' => __( 'Indian Rupee', 'invoicing' ),
401
-        'IQD' => __( 'Iraqi Dinar', 'invoicing' ),
402
-        'IRR' => __( 'Iranian Rial', 'invoicing' ),
403
-        'IRT' => __( 'Iranian Toman', 'invoicing' ),
404
-        'ISK' => __( 'Icelandic Krona', 'invoicing' ),
405
-        'JEP' => __( 'Jersey Pound', 'invoicing' ),
406
-        'JMD' => __( 'Jamaican Dollar', 'invoicing' ),
407
-        'JOD' => __( 'Jordanian Dinar', 'invoicing' ),
408
-        'JPY' => __( 'Japanese Yen', 'invoicing' ),
409
-        'KES' => __( 'Kenyan Shilling', 'invoicing' ),
410
-        'KGS' => __( 'Kyrgyzstani Som', 'invoicing' ),
411
-        'KHR' => __( 'Cambodian Riel', 'invoicing' ),
412
-        'KMF' => __( 'Comorian Franc', 'invoicing' ),
413
-        'KPW' => __( 'North Korean Won', 'invoicing' ),
414
-        'KRW' => __( 'South Korean Won', 'invoicing' ),
415
-        'KWD' => __( 'Kuwaiti Dinar', 'invoicing' ),
416
-        'KYD' => __( 'Cayman Islands Dollar', 'invoicing' ),
417
-        'KZT' => __( 'Kazakhstani Tenge', 'invoicing' ),
418
-        'LAK' => __( 'Lao Kip', 'invoicing' ),
419
-        'LBP' => __( 'Lebanese Pound', 'invoicing' ),
420
-        'LKR' => __( 'Sri Lankan Rupee', 'invoicing' ),
421
-        'LRD' => __( 'Liberian Dollar', 'invoicing' ),
422
-        'LSL' => __( 'Lesotho Loti', 'invoicing' ),
423
-        'LYD' => __( 'Libyan Dinar', 'invoicing' ),
424
-        'MAD' => __( 'Moroccan Dirham', 'invoicing' ),
425
-        'MDL' => __( 'Moldovan Leu', 'invoicing' ),
426
-        'MGA' => __( 'Malagasy Ariary', 'invoicing' ),
427
-        'MKD' => __( 'Macedonian Denar', 'invoicing' ),
428
-        'MMK' => __( 'Burmese Kyat', 'invoicing' ),
429
-        'MNT' => __( 'Mongolian Tughrik', 'invoicing' ),
430
-        'MOP' => __( 'Macanese Pataca', 'invoicing' ),
431
-        'MRO' => __( 'Mauritanian Ouguiya', 'invoicing' ),
432
-        'MUR' => __( 'Mauritian Rupee', 'invoicing' ),
433
-        'MVR' => __( 'Maldivian Rufiyaa', 'invoicing' ),
434
-        'MWK' => __( 'Malawian Kwacha', 'invoicing' ),
435
-        'MXN' => __( 'Mexican Peso', 'invoicing' ),
436
-        'MYR' => __( 'Malaysian Ringgit', 'invoicing' ),
437
-        'MZN' => __( 'Mozambican Metical', 'invoicing' ),
438
-        'NAD' => __( 'Namibian Dollar', 'invoicing' ),
439
-        'NGN' => __( 'Nigerian Naira', 'invoicing' ),
440
-        'NIO' => __( 'Nicaraguan Cordoba', 'invoicing' ),
441
-        'NOK' => __( 'Norwegian Krone', 'invoicing' ),
442
-        'NPR' => __( 'Nepalese Rupee', 'invoicing' ),
443
-        'NZD' => __( 'New Zealand Dollar', 'invoicing' ),
444
-        'OMR' => __( 'Omani Rial', 'invoicing' ),
445
-        'PAB' => __( 'Panamanian Balboa', 'invoicing' ),
446
-        'PEN' => __( 'Peruvian Nuevo Sol', 'invoicing' ),
447
-        'PGK' => __( 'Papua New Guinean Kina', 'invoicing' ),
448
-        'PHP' => __( 'Philippine Peso', 'invoicing' ),
449
-        'PKR' => __( 'Pakistani Rupee', 'invoicing' ),
450
-        'PLN' => __( 'Polish Zloty', 'invoicing' ),
451
-        'PRB' => __( 'Transnistrian Ruble', 'invoicing' ),
452
-        'PYG' => __( 'Paraguayan Guarani', 'invoicing' ),
453
-        'QAR' => __( 'Qatari Riyal', 'invoicing' ),
454
-        'RON' => __( 'Romanian Leu', 'invoicing' ),
455
-        'RSD' => __( 'Serbian Dinar', 'invoicing' ),
456
-        'RUB' => __( 'Russian Ruble', 'invoicing' ),
457
-        'RWF' => __( 'Rwandan Franc', 'invoicing' ),
458
-        'SAR' => __( 'Saudi Riyal', 'invoicing' ),
459
-        'SBD' => __( 'Solomon Islands Dollar', 'invoicing' ),
460
-        'SCR' => __( 'Seychellois Rupee', 'invoicing' ),
461
-        'SDG' => __( 'Sudanese Pound', 'invoicing' ),
462
-        'SEK' => __( 'Swedish Krona', 'invoicing' ),
463
-        'SGD' => __( 'Singapore Dollar', 'invoicing' ),
464
-        'SHP' => __( 'Saint Helena Pound', 'invoicing' ),
465
-        'SLL' => __( 'Sierra Leonean Leone', 'invoicing' ),
466
-        'SOS' => __( 'Somali Shilling', 'invoicing' ),
467
-        'SRD' => __( 'Surinamese Dollar', 'invoicing' ),
468
-        'SSP' => __( 'South Sudanese Pound', 'invoicing' ),
469
-        'STD' => __( 'Sao Tomean Dobra', 'invoicing' ),
470
-        'SYP' => __( 'Syrian Pound', 'invoicing' ),
471
-        'SZL' => __( 'Swazi Lilangeni', 'invoicing' ),
472
-        'THB' => __( 'Thai Baht', 'invoicing' ),
473
-        'TJS' => __( 'Tajikistani Somoni', 'invoicing' ),
474
-        'TMT' => __( 'Turkmenistan Manat', 'invoicing' ),
475
-        'TND' => __( 'Tunisian Dinar', 'invoicing' ),
476
-        'TOP' => __( 'Tongan Pa&#x2bb;anga', 'invoicing' ),
477
-        'TRY' => __( 'Turkish Lira', 'invoicing' ),
478
-        'TTD' => __( 'Trinidad and Tobago Dollar', 'invoicing' ),
479
-        'TWD' => __( 'New Taiwan Dollar', 'invoicing' ),
480
-        'TZS' => __( 'Tanzanian Shilling', 'invoicing' ),
481
-        'UAH' => __( 'Ukrainian Hryvnia', 'invoicing' ),
482
-        'UGX' => __( 'Ugandan Shilling', 'invoicing' ),
483
-        'UYU' => __( 'Uruguayan Peso', 'invoicing' ),
484
-        'UZS' => __( 'Uzbekistani Som', 'invoicing' ),
485
-        'VEF' => __( 'Venezuelan Bol&iacute;var', 'invoicing' ),
486
-        'VND' => __( 'Vietnamese Dong', 'invoicing' ),
487
-        'VUV' => __( 'Vanuatu Vatu', 'invoicing' ),
488
-        'WST' => __( 'Samoan Tala', 'invoicing' ),
489
-        'XAF' => __( 'Central African CFA Franc', 'invoicing' ),
490
-        'XCD' => __( 'East Caribbean Dollar', 'invoicing' ),
491
-        'XOF' => __( 'West African CFA Franc', 'invoicing' ),
492
-        'XPF' => __( 'CFP Franc', 'invoicing' ),
493
-        'YER' => __( 'Yemeni Rial', 'invoicing' ),
494
-        'ZAR' => __( 'South African Rand', 'invoicing' ),
495
-        'ZMW' => __( 'Zambian Kwacha', 'invoicing' ),
335
+        'USD' => __('US Dollar', 'invoicing'),
336
+        'EUR' => __('Euro', 'invoicing'),
337
+        'GBP' => __('Pound Sterling', 'invoicing'),
338
+        'AED' => __('United Arab Emirates', 'invoicing'),
339
+        'AFN' => __('Afghan Afghani', 'invoicing'),
340
+        'ALL' => __('Albanian Lek', 'invoicing'),
341
+        'AMD' => __('Armenian Dram', 'invoicing'),
342
+        'ANG' => __('Netherlands Antillean Guilder', 'invoicing'),
343
+        'AOA' => __('Angolan Kwanza', 'invoicing'),
344
+        'ARS' => __('Argentine Peso', 'invoicing'),
345
+        'AUD' => __('Australian Dollar', 'invoicing'),
346
+        'AWG' => __('Aruban Florin', 'invoicing'),
347
+        'AZN' => __('Azerbaijani Manat', 'invoicing'),
348
+        'BAM' => __('Bosnia and Herzegovina Convertible Marka', 'invoicing'),
349
+        'BBD' => __('Barbadian Dollar', 'invoicing'),
350
+        'BDT' => __('Bangladeshi Taka', 'invoicing'),
351
+        'BGN' => __('Bulgarian Lev', 'invoicing'),
352
+        'BHD' => __('Bahraini Dinar', 'invoicing'),
353
+        'BIF' => __('Burundian Franc', 'invoicing'),
354
+        'BMD' => __('Bermudian Dollar', 'invoicing'),
355
+        'BND' => __('Brunei Dollar', 'invoicing'),
356
+        'BOB' => __('Bolivian Boliviano', 'invoicing'),
357
+        'BRL' => __('Brazilian Real', 'invoicing'),
358
+        'BSD' => __('Bahamian Dollar', 'invoicing'),
359
+        'BTC' => __('Bitcoin', 'invoicing'),
360
+        'BTN' => __('Bhutanese Ngultrum', 'invoicing'),
361
+        'BWP' => __('Botswana Pula', 'invoicing'),
362
+        'BYN' => __('Belarusian Ruble', 'invoicing'),
363
+        'BZD' => __('Belize Dollar', 'invoicing'),
364
+        'CAD' => __('Canadian Dollar', 'invoicing'),
365
+        'CDF' => __('Congolese Franc', 'invoicing'),
366
+        'CHF' => __('Swiss Franc', 'invoicing'),
367
+        'CLP' => __('Chilean Peso', 'invoicing'),
368
+        'CNY' => __('Chinese Yuan', 'invoicing'),
369
+        'COP' => __('Colombian Peso', 'invoicing'),
370
+        'CRC' => __('Costa Rican Colon', 'invoicing'),
371
+        'CUC' => __('Cuban Convertible Peso', 'invoicing'),
372
+        'CUP' => __('Cuban Peso', 'invoicing'),
373
+        'CVE' => __('Cape Verdean escudo', 'invoicing'),
374
+        'CZK' => __('Czech Koruna', 'invoicing'),
375
+        'DJF' => __('Djiboutian Franc', 'invoicing'),
376
+        'DKK' => __('Danish Krone', 'invoicing'),
377
+        'DOP' => __('Dominican Peso', 'invoicing'),
378
+        'DZD' => __('Algerian Dinar', 'invoicing'),
379
+        'EGP' => __('Egyptian Pound', 'invoicing'),
380
+        'ERN' => __('Eritrean Nakfa', 'invoicing'),
381
+        'ETB' => __('Ethiopian Irr', 'invoicing'),
382
+        'FJD' => __('Fijian Dollar', 'invoicing'),
383
+        'FKP' => __('Falkland Islands Pound', 'invoicing'),
384
+        'GEL' => __('Georgian Lari', 'invoicing'),
385
+        'GGP' => __('Guernsey Pound', 'invoicing'),
386
+        'GHS' => __('Ghana Cedi', 'invoicing'),
387
+        'GIP' => __('Gibraltar Pound', 'invoicing'),
388
+        'GMD' => __('Gambian Dalasi', 'invoicing'),
389
+        'GNF' => __('Guinean Franc', 'invoicing'),
390
+        'GTQ' => __('Guatemalan Quetzal', 'invoicing'),
391
+        'GYD' => __('Guyanese Dollar', 'invoicing'),
392
+        'HKD' => __('Hong Kong Dollar', 'invoicing'),
393
+        'HNL' => __('Honduran Lempira', 'invoicing'),
394
+        'HRK' => __('Croatian Kuna', 'invoicing'),
395
+        'HTG' => __('Haitian Gourde', 'invoicing'),
396
+        'HUF' => __('Hungarian Forint', 'invoicing'),
397
+        'IDR' => __('Indonesian Rupiah', 'invoicing'),
398
+        'ILS' => __('Israeli New Shekel', 'invoicing'),
399
+        'IMP' => __('Manx Pound', 'invoicing'),
400
+        'INR' => __('Indian Rupee', 'invoicing'),
401
+        'IQD' => __('Iraqi Dinar', 'invoicing'),
402
+        'IRR' => __('Iranian Rial', 'invoicing'),
403
+        'IRT' => __('Iranian Toman', 'invoicing'),
404
+        'ISK' => __('Icelandic Krona', 'invoicing'),
405
+        'JEP' => __('Jersey Pound', 'invoicing'),
406
+        'JMD' => __('Jamaican Dollar', 'invoicing'),
407
+        'JOD' => __('Jordanian Dinar', 'invoicing'),
408
+        'JPY' => __('Japanese Yen', 'invoicing'),
409
+        'KES' => __('Kenyan Shilling', 'invoicing'),
410
+        'KGS' => __('Kyrgyzstani Som', 'invoicing'),
411
+        'KHR' => __('Cambodian Riel', 'invoicing'),
412
+        'KMF' => __('Comorian Franc', 'invoicing'),
413
+        'KPW' => __('North Korean Won', 'invoicing'),
414
+        'KRW' => __('South Korean Won', 'invoicing'),
415
+        'KWD' => __('Kuwaiti Dinar', 'invoicing'),
416
+        'KYD' => __('Cayman Islands Dollar', 'invoicing'),
417
+        'KZT' => __('Kazakhstani Tenge', 'invoicing'),
418
+        'LAK' => __('Lao Kip', 'invoicing'),
419
+        'LBP' => __('Lebanese Pound', 'invoicing'),
420
+        'LKR' => __('Sri Lankan Rupee', 'invoicing'),
421
+        'LRD' => __('Liberian Dollar', 'invoicing'),
422
+        'LSL' => __('Lesotho Loti', 'invoicing'),
423
+        'LYD' => __('Libyan Dinar', 'invoicing'),
424
+        'MAD' => __('Moroccan Dirham', 'invoicing'),
425
+        'MDL' => __('Moldovan Leu', 'invoicing'),
426
+        'MGA' => __('Malagasy Ariary', 'invoicing'),
427
+        'MKD' => __('Macedonian Denar', 'invoicing'),
428
+        'MMK' => __('Burmese Kyat', 'invoicing'),
429
+        'MNT' => __('Mongolian Tughrik', 'invoicing'),
430
+        'MOP' => __('Macanese Pataca', 'invoicing'),
431
+        'MRO' => __('Mauritanian Ouguiya', 'invoicing'),
432
+        'MUR' => __('Mauritian Rupee', 'invoicing'),
433
+        'MVR' => __('Maldivian Rufiyaa', 'invoicing'),
434
+        'MWK' => __('Malawian Kwacha', 'invoicing'),
435
+        'MXN' => __('Mexican Peso', 'invoicing'),
436
+        'MYR' => __('Malaysian Ringgit', 'invoicing'),
437
+        'MZN' => __('Mozambican Metical', 'invoicing'),
438
+        'NAD' => __('Namibian Dollar', 'invoicing'),
439
+        'NGN' => __('Nigerian Naira', 'invoicing'),
440
+        'NIO' => __('Nicaraguan Cordoba', 'invoicing'),
441
+        'NOK' => __('Norwegian Krone', 'invoicing'),
442
+        'NPR' => __('Nepalese Rupee', 'invoicing'),
443
+        'NZD' => __('New Zealand Dollar', 'invoicing'),
444
+        'OMR' => __('Omani Rial', 'invoicing'),
445
+        'PAB' => __('Panamanian Balboa', 'invoicing'),
446
+        'PEN' => __('Peruvian Nuevo Sol', 'invoicing'),
447
+        'PGK' => __('Papua New Guinean Kina', 'invoicing'),
448
+        'PHP' => __('Philippine Peso', 'invoicing'),
449
+        'PKR' => __('Pakistani Rupee', 'invoicing'),
450
+        'PLN' => __('Polish Zloty', 'invoicing'),
451
+        'PRB' => __('Transnistrian Ruble', 'invoicing'),
452
+        'PYG' => __('Paraguayan Guarani', 'invoicing'),
453
+        'QAR' => __('Qatari Riyal', 'invoicing'),
454
+        'RON' => __('Romanian Leu', 'invoicing'),
455
+        'RSD' => __('Serbian Dinar', 'invoicing'),
456
+        'RUB' => __('Russian Ruble', 'invoicing'),
457
+        'RWF' => __('Rwandan Franc', 'invoicing'),
458
+        'SAR' => __('Saudi Riyal', 'invoicing'),
459
+        'SBD' => __('Solomon Islands Dollar', 'invoicing'),
460
+        'SCR' => __('Seychellois Rupee', 'invoicing'),
461
+        'SDG' => __('Sudanese Pound', 'invoicing'),
462
+        'SEK' => __('Swedish Krona', 'invoicing'),
463
+        'SGD' => __('Singapore Dollar', 'invoicing'),
464
+        'SHP' => __('Saint Helena Pound', 'invoicing'),
465
+        'SLL' => __('Sierra Leonean Leone', 'invoicing'),
466
+        'SOS' => __('Somali Shilling', 'invoicing'),
467
+        'SRD' => __('Surinamese Dollar', 'invoicing'),
468
+        'SSP' => __('South Sudanese Pound', 'invoicing'),
469
+        'STD' => __('Sao Tomean Dobra', 'invoicing'),
470
+        'SYP' => __('Syrian Pound', 'invoicing'),
471
+        'SZL' => __('Swazi Lilangeni', 'invoicing'),
472
+        'THB' => __('Thai Baht', 'invoicing'),
473
+        'TJS' => __('Tajikistani Somoni', 'invoicing'),
474
+        'TMT' => __('Turkmenistan Manat', 'invoicing'),
475
+        'TND' => __('Tunisian Dinar', 'invoicing'),
476
+        'TOP' => __('Tongan Pa&#x2bb;anga', 'invoicing'),
477
+        'TRY' => __('Turkish Lira', 'invoicing'),
478
+        'TTD' => __('Trinidad and Tobago Dollar', 'invoicing'),
479
+        'TWD' => __('New Taiwan Dollar', 'invoicing'),
480
+        'TZS' => __('Tanzanian Shilling', 'invoicing'),
481
+        'UAH' => __('Ukrainian Hryvnia', 'invoicing'),
482
+        'UGX' => __('Ugandan Shilling', 'invoicing'),
483
+        'UYU' => __('Uruguayan Peso', 'invoicing'),
484
+        'UZS' => __('Uzbekistani Som', 'invoicing'),
485
+        'VEF' => __('Venezuelan Bol&iacute;var', 'invoicing'),
486
+        'VND' => __('Vietnamese Dong', 'invoicing'),
487
+        'VUV' => __('Vanuatu Vatu', 'invoicing'),
488
+        'WST' => __('Samoan Tala', 'invoicing'),
489
+        'XAF' => __('Central African CFA Franc', 'invoicing'),
490
+        'XCD' => __('East Caribbean Dollar', 'invoicing'),
491
+        'XOF' => __('West African CFA Franc', 'invoicing'),
492
+        'XPF' => __('CFP Franc', 'invoicing'),
493
+        'YER' => __('Yemeni Rial', 'invoicing'),
494
+        'ZAR' => __('South African Rand', 'invoicing'),
495
+        'ZMW' => __('Zambian Kwacha', 'invoicing'),
496 496
     );
497 497
     
498 498
     //asort( $currencies ); // this
499 499
 
500
-    return apply_filters( 'wpinv_currencies', $currencies );
500
+    return apply_filters('wpinv_currencies', $currencies);
501 501
 }
502 502
 
503
-function wpinv_price( $amount = '', $currency = '' ) {
504
-    if( empty( $currency ) ) {
503
+function wpinv_price($amount = '', $currency = '') {
504
+    if (empty($currency)) {
505 505
         $currency = wpinv_get_currency();
506 506
     }
507 507
 
@@ -509,14 +509,14 @@  discard block
 block discarded – undo
509 509
 
510 510
     $negative = $amount < 0;
511 511
 
512
-    if ( $negative ) {
513
-        $amount = substr( $amount, 1 );
512
+    if ($negative) {
513
+        $amount = substr($amount, 1);
514 514
     }
515 515
 
516
-    $symbol = wpinv_currency_symbol( $currency );
516
+    $symbol = wpinv_currency_symbol($currency);
517 517
 
518
-    if ( $position == 'left' || $position == 'left_space' ) {
519
-        switch ( $currency ) {
518
+    if ($position == 'left' || $position == 'left_space') {
519
+        switch ($currency) {
520 520
             case "GBP" :
521 521
             case "BRL" :
522 522
             case "EUR" :
@@ -528,15 +528,15 @@  discard block
 block discarded – undo
528 528
             case "NZD" :
529 529
             case "SGD" :
530 530
             case "JPY" :
531
-                $price = $position == 'left_space' ? $symbol . ' ' .  $amount : $symbol . $amount;
531
+                $price = $position == 'left_space' ? $symbol . ' ' . $amount : $symbol . $amount;
532 532
                 break;
533 533
             default :
534 534
                 //$price = $currency . ' ' . $amount;
535
-                $price = $position == 'left_space' ? $symbol . ' ' .  $amount : $symbol . $amount;
535
+                $price = $position == 'left_space' ? $symbol . ' ' . $amount : $symbol . $amount;
536 536
                 break;
537 537
         }
538 538
     } else {
539
-        switch ( $currency ) {
539
+        switch ($currency) {
540 540
             case "GBP" :
541 541
             case "BRL" :
542 542
             case "EUR" :
@@ -547,83 +547,83 @@  discard block
 block discarded – undo
547 547
             case "MXN" :
548 548
             case "SGD" :
549 549
             case "JPY" :
550
-                $price = $position == 'right_space' ? $amount . ' ' .  $symbol : $amount . $symbol;
550
+                $price = $position == 'right_space' ? $amount . ' ' . $symbol : $amount . $symbol;
551 551
                 break;
552 552
             default :
553 553
                 //$price = $amount . ' ' . $currency;
554
-                $price = $position == 'right_space' ? $amount . ' ' .  $symbol : $amount . $symbol;
554
+                $price = $position == 'right_space' ? $amount . ' ' . $symbol : $amount . $symbol;
555 555
                 break;
556 556
         }
557 557
     }
558 558
     
559
-    if ( $negative ) {
559
+    if ($negative) {
560 560
         $price = '-' . $price;
561 561
     }
562 562
     
563
-    $price = apply_filters( 'wpinv_' . strtolower( $currency ) . '_currency_filter_' . $position, $price, $currency, $amount );
563
+    $price = apply_filters('wpinv_' . strtolower($currency) . '_currency_filter_' . $position, $price, $currency, $amount);
564 564
 
565 565
     return $price;
566 566
 }
567 567
 
568
-function wpinv_format_amount( $amount, $decimals = NULL, $calculate = false ) {
568
+function wpinv_format_amount($amount, $decimals = NULL, $calculate = false) {
569 569
     $thousands_sep = wpinv_thousands_separator();
570 570
     $decimal_sep   = wpinv_decimal_separator();
571 571
 
572
-    if ( $decimals === NULL ) {
572
+    if ($decimals === NULL) {
573 573
         $decimals = wpinv_decimals();
574 574
     }
575 575
 
576
-    if ( $decimal_sep == ',' && false !== ( $sep_found = strpos( $amount, $decimal_sep ) ) ) {
577
-        $whole = substr( $amount, 0, $sep_found );
578
-        $part = substr( $amount, $sep_found + 1, ( strlen( $amount ) - 1 ) );
576
+    if ($decimal_sep == ',' && false !== ($sep_found = strpos($amount, $decimal_sep))) {
577
+        $whole = substr($amount, 0, $sep_found);
578
+        $part = substr($amount, $sep_found + 1, (strlen($amount) - 1));
579 579
         $amount = $whole . '.' . $part;
580 580
     }
581 581
 
582
-    if ( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
583
-        $amount = str_replace( ',', '', $amount );
582
+    if ($thousands_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) {
583
+        $amount = str_replace(',', '', $amount);
584 584
     }
585 585
 
586
-    if ( $thousands_sep == ' ' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
587
-        $amount = str_replace( ' ', '', $amount );
586
+    if ($thousands_sep == ' ' && false !== ($found = strpos($amount, $thousands_sep))) {
587
+        $amount = str_replace(' ', '', $amount);
588 588
     }
589 589
 
590
-    if ( empty( $amount ) ) {
590
+    if (empty($amount)) {
591 591
         $amount = 0;
592 592
     }
593 593
     
594
-    $decimals  = apply_filters( 'wpinv_amount_format_decimals', $decimals ? $decimals : 0, $amount, $calculate );
595
-    $formatted = number_format( (float)$amount, $decimals, $decimal_sep, $thousands_sep );
594
+    $decimals  = apply_filters('wpinv_amount_format_decimals', $decimals ? $decimals : 0, $amount, $calculate);
595
+    $formatted = number_format((float) $amount, $decimals, $decimal_sep, $thousands_sep);
596 596
     
597
-    if ( $calculate ) {
598
-        if ( $thousands_sep === "," ) {
599
-            $formatted = str_replace( ",", "", $formatted );
597
+    if ($calculate) {
598
+        if ($thousands_sep === ",") {
599
+            $formatted = str_replace(",", "", $formatted);
600 600
         }
601 601
         
602
-        if ( $decimal_sep === "," ) {
603
-            $formatted = str_replace( ",", ".", $formatted );
602
+        if ($decimal_sep === ",") {
603
+            $formatted = str_replace(",", ".", $formatted);
604 604
         }
605 605
     }
606 606
 
607
-    return apply_filters( 'wpinv_amount_format', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep, $calculate );
607
+    return apply_filters('wpinv_amount_format', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep, $calculate);
608 608
 }
609
-add_filter( 'wpinv_amount_format_decimals', 'wpinv_currency_decimal_filter', 10, 1 );
609
+add_filter('wpinv_amount_format_decimals', 'wpinv_currency_decimal_filter', 10, 1);
610 610
 
611
-function wpinv_sanitize_key( $key ) {
611
+function wpinv_sanitize_key($key) {
612 612
     $raw_key = $key;
613
-    $key = preg_replace( '/[^a-zA-Z0-9_\-\.\:\/]/', '', $key );
613
+    $key = preg_replace('/[^a-zA-Z0-9_\-\.\:\/]/', '', $key);
614 614
 
615
-    return apply_filters( 'wpinv_sanitize_key', $key, $raw_key );
615
+    return apply_filters('wpinv_sanitize_key', $key, $raw_key);
616 616
 }
617 617
 
618
-function wpinv_get_file_extension( $str ) {
619
-    $parts = explode( '.', $str );
620
-    return end( $parts );
618
+function wpinv_get_file_extension($str) {
619
+    $parts = explode('.', $str);
620
+    return end($parts);
621 621
 }
622 622
 
623
-function wpinv_string_is_image_url( $str ) {
624
-    $ext = wpinv_get_file_extension( $str );
623
+function wpinv_string_is_image_url($str) {
624
+    $ext = wpinv_get_file_extension($str);
625 625
 
626
-    switch ( strtolower( $ext ) ) {
626
+    switch (strtolower($ext)) {
627 627
         case 'jpeg';
628 628
         case 'jpg';
629 629
             $return = true;
@@ -639,33 +639,33 @@  discard block
 block discarded – undo
639 639
             break;
640 640
     }
641 641
 
642
-    return (bool)apply_filters( 'wpinv_string_is_image', $return, $str );
642
+    return (bool) apply_filters('wpinv_string_is_image', $return, $str);
643 643
 }
644 644
 
645
-function wpinv_error_log( $log, $title = '', $file = '', $line = '', $exit = false ) {
646
-    $should_log = apply_filters( 'wpinv_log_errors', WP_DEBUG );
645
+function wpinv_error_log($log, $title = '', $file = '', $line = '', $exit = false) {
646
+    $should_log = apply_filters('wpinv_log_errors', WP_DEBUG);
647 647
     
648
-    if ( true === $should_log ) {
648
+    if (true === $should_log) {
649 649
         $label = '';
650
-        if ( $file && $file !== '' ) {
651
-            $label .= basename( $file ) . ( $line ? '(' . $line . ')' : '' );
650
+        if ($file && $file !== '') {
651
+            $label .= basename($file) . ($line ? '(' . $line . ')' : '');
652 652
         }
653 653
         
654
-        if ( $title && $title !== '' ) {
654
+        if ($title && $title !== '') {
655 655
             $label = $label !== '' ? $label . ' ' : '';
656 656
             $label .= $title . ' ';
657 657
         }
658 658
         
659
-        $label = $label !== '' ? trim( $label ) . ' : ' : '';
659
+        $label = $label !== '' ? trim($label) . ' : ' : '';
660 660
         
661
-        if ( is_array( $log ) || is_object( $log ) ) {
662
-            error_log( $label . print_r( $log, true ) );
661
+        if (is_array($log) || is_object($log)) {
662
+            error_log($label . print_r($log, true));
663 663
         } else {
664
-            error_log( $label . $log );
664
+            error_log($label . $log);
665 665
         }
666 666
 
667
-        error_log( wp_debug_backtrace_summary() );
668
-        if ( $exit ) {
667
+        error_log(wp_debug_backtrace_summary());
668
+        if ($exit) {
669 669
             exit;
670 670
         }
671 671
     }
@@ -673,32 +673,32 @@  discard block
 block discarded – undo
673 673
 
674 674
 function wpinv_is_ajax_disabled() {
675 675
     $retval = false;
676
-    return apply_filters( 'wpinv_is_ajax_disabled', $retval );
676
+    return apply_filters('wpinv_is_ajax_disabled', $retval);
677 677
 }
678 678
 
679
-function wpinv_get_current_page_url( $nocache = false ) {
679
+function wpinv_get_current_page_url($nocache = false) {
680 680
     global $wp;
681 681
 
682
-    if ( get_option( 'permalink_structure' ) ) {
683
-        $base = trailingslashit( home_url( $wp->request ) );
682
+    if (get_option('permalink_structure')) {
683
+        $base = trailingslashit(home_url($wp->request));
684 684
     } else {
685
-        $base = add_query_arg( $wp->query_string, '', trailingslashit( home_url( $wp->request ) ) );
686
-        $base = remove_query_arg( array( 'post_type', 'name' ), $base );
685
+        $base = add_query_arg($wp->query_string, '', trailingslashit(home_url($wp->request)));
686
+        $base = remove_query_arg(array('post_type', 'name'), $base);
687 687
     }
688 688
 
689 689
     $scheme = is_ssl() ? 'https' : 'http';
690
-    $uri    = set_url_scheme( $base, $scheme );
690
+    $uri    = set_url_scheme($base, $scheme);
691 691
 
692
-    if ( is_front_page() ) {
693
-        $uri = home_url( '/' );
694
-    } elseif ( wpinv_is_checkout( array(), false ) ) {
692
+    if (is_front_page()) {
693
+        $uri = home_url('/');
694
+    } elseif (wpinv_is_checkout(array(), false)) {
695 695
         $uri = wpinv_get_checkout_uri();
696 696
     }
697 697
 
698
-    $uri = apply_filters( 'wpinv_get_current_page_url', $uri );
698
+    $uri = apply_filters('wpinv_get_current_page_url', $uri);
699 699
 
700
-    if ( $nocache ) {
701
-        $uri = wpinv_add_cache_busting( $uri );
700
+    if ($nocache) {
701
+        $uri = wpinv_add_cache_busting($uri);
702 702
     }
703 703
 
704 704
     return $uri;
@@ -711,46 +711,46 @@  discard block
 block discarded – undo
711 711
  * @param string $name  Constant name.
712 712
  * @param mixed  $value Value.
713 713
  */
714
-function getpaid_maybe_define_constant( $name, $value ) {
715
-	if ( ! defined( $name ) ) {
716
-		define( $name, $value );
714
+function getpaid_maybe_define_constant($name, $value) {
715
+	if (!defined($name)) {
716
+		define($name, $value);
717 717
 	}
718 718
 }
719 719
 
720 720
 function wpinv_get_php_arg_separator_output() {
721
-	return ini_get( 'arg_separator.output' );
721
+	return ini_get('arg_separator.output');
722 722
 }
723 723
 
724
-function wpinv_rgb_from_hex( $color ) {
725
-    $color = str_replace( '#', '', $color );
724
+function wpinv_rgb_from_hex($color) {
725
+    $color = str_replace('#', '', $color);
726 726
 
727 727
     // Convert shorthand colors to full format, e.g. "FFF" -> "FFFFFF"
728
-    $color = preg_replace( '~^(.)(.)(.)$~', '$1$1$2$2$3$3', $color );
729
-    if ( empty( $color ) ) {
728
+    $color = preg_replace('~^(.)(.)(.)$~', '$1$1$2$2$3$3', $color);
729
+    if (empty($color)) {
730 730
         return NULL;
731 731
     }
732 732
 
733
-    $color = str_split( $color );
733
+    $color = str_split($color);
734 734
 
735 735
     $rgb      = array();
736
-    $rgb['R'] = hexdec( $color[0] . $color[1] );
737
-    $rgb['G'] = hexdec( $color[2] . $color[3] );
738
-    $rgb['B'] = hexdec( $color[4] . $color[5] );
736
+    $rgb['R'] = hexdec($color[0] . $color[1]);
737
+    $rgb['G'] = hexdec($color[2] . $color[3]);
738
+    $rgb['B'] = hexdec($color[4] . $color[5]);
739 739
 
740 740
     return $rgb;
741 741
 }
742 742
 
743
-function wpinv_hex_darker( $color, $factor = 30 ) {
744
-    $base  = wpinv_rgb_from_hex( $color );
743
+function wpinv_hex_darker($color, $factor = 30) {
744
+    $base  = wpinv_rgb_from_hex($color);
745 745
     $color = '#';
746 746
 
747
-    foreach ( $base as $k => $v ) {
747
+    foreach ($base as $k => $v) {
748 748
         $amount      = $v / 100;
749
-        $amount      = round( $amount * $factor );
749
+        $amount      = round($amount * $factor);
750 750
         $new_decimal = $v - $amount;
751 751
 
752
-        $new_hex_component = dechex( $new_decimal );
753
-        if ( strlen( $new_hex_component ) < 2 ) {
752
+        $new_hex_component = dechex($new_decimal);
753
+        if (strlen($new_hex_component) < 2) {
754 754
             $new_hex_component = "0" . $new_hex_component;
755 755
         }
756 756
         $color .= $new_hex_component;
@@ -759,18 +759,18 @@  discard block
 block discarded – undo
759 759
     return $color;
760 760
 }
761 761
 
762
-function wpinv_hex_lighter( $color, $factor = 30 ) {
763
-    $base  = wpinv_rgb_from_hex( $color );
762
+function wpinv_hex_lighter($color, $factor = 30) {
763
+    $base  = wpinv_rgb_from_hex($color);
764 764
     $color = '#';
765 765
 
766
-    foreach ( $base as $k => $v ) {
766
+    foreach ($base as $k => $v) {
767 767
         $amount      = 255 - $v;
768 768
         $amount      = $amount / 100;
769
-        $amount      = round( $amount * $factor );
769
+        $amount      = round($amount * $factor);
770 770
         $new_decimal = $v + $amount;
771 771
 
772
-        $new_hex_component = dechex( $new_decimal );
773
-        if ( strlen( $new_hex_component ) < 2 ) {
772
+        $new_hex_component = dechex($new_decimal);
773
+        if (strlen($new_hex_component) < 2) {
774 774
             $new_hex_component = "0" . $new_hex_component;
775 775
         }
776 776
         $color .= $new_hex_component;
@@ -779,22 +779,22 @@  discard block
 block discarded – undo
779 779
     return $color;
780 780
 }
781 781
 
782
-function wpinv_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) {
783
-    $hex = str_replace( '#', '', $color );
782
+function wpinv_light_or_dark($color, $dark = '#000000', $light = '#FFFFFF') {
783
+    $hex = str_replace('#', '', $color);
784 784
 
785
-    $c_r = hexdec( substr( $hex, 0, 2 ) );
786
-    $c_g = hexdec( substr( $hex, 2, 2 ) );
787
-    $c_b = hexdec( substr( $hex, 4, 2 ) );
785
+    $c_r = hexdec(substr($hex, 0, 2));
786
+    $c_g = hexdec(substr($hex, 2, 2));
787
+    $c_b = hexdec(substr($hex, 4, 2));
788 788
 
789
-    $brightness = ( ( $c_r * 299 ) + ( $c_g * 587 ) + ( $c_b * 114 ) ) / 1000;
789
+    $brightness = (($c_r * 299) + ($c_g * 587) + ($c_b * 114)) / 1000;
790 790
 
791 791
     return $brightness > 155 ? $dark : $light;
792 792
 }
793 793
 
794
-function wpinv_format_hex( $hex ) {
795
-    $hex = trim( str_replace( '#', '', $hex ) );
794
+function wpinv_format_hex($hex) {
795
+    $hex = trim(str_replace('#', '', $hex));
796 796
 
797
-    if ( strlen( $hex ) == 3 ) {
797
+    if (strlen($hex) == 3) {
798 798
         $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
799 799
     }
800 800
 
@@ -814,12 +814,12 @@  discard block
 block discarded – undo
814 814
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
815 815
  * @return string
816 816
  */
817
-function wpinv_utf8_strimwidth( $str, $start, $width, $trimmaker = '', $encoding = 'UTF-8' ) {
818
-    if ( function_exists( 'mb_strimwidth' ) ) {
819
-        return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding );
817
+function wpinv_utf8_strimwidth($str, $start, $width, $trimmaker = '', $encoding = 'UTF-8') {
818
+    if (function_exists('mb_strimwidth')) {
819
+        return mb_strimwidth($str, $start, $width, $trimmaker, $encoding);
820 820
     }
821 821
     
822
-    return wpinv_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker;
822
+    return wpinv_utf8_substr($str, $start, $width, $encoding) . $trimmaker;
823 823
 }
824 824
 
825 825
 /**
@@ -831,28 +831,28 @@  discard block
 block discarded – undo
831 831
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
832 832
  * @return int Returns the number of characters in string.
833 833
  */
834
-function wpinv_utf8_strlen( $str, $encoding = 'UTF-8' ) {
835
-    if ( function_exists( 'mb_strlen' ) ) {
836
-        return mb_strlen( $str, $encoding );
834
+function wpinv_utf8_strlen($str, $encoding = 'UTF-8') {
835
+    if (function_exists('mb_strlen')) {
836
+        return mb_strlen($str, $encoding);
837 837
     }
838 838
         
839
-    return strlen( $str );
839
+    return strlen($str);
840 840
 }
841 841
 
842
-function wpinv_utf8_strtolower( $str, $encoding = 'UTF-8' ) {
843
-    if ( function_exists( 'mb_strtolower' ) ) {
844
-        return mb_strtolower( $str, $encoding );
842
+function wpinv_utf8_strtolower($str, $encoding = 'UTF-8') {
843
+    if (function_exists('mb_strtolower')) {
844
+        return mb_strtolower($str, $encoding);
845 845
     }
846 846
     
847
-    return strtolower( $str );
847
+    return strtolower($str);
848 848
 }
849 849
 
850
-function wpinv_utf8_strtoupper( $str, $encoding = 'UTF-8' ) {
851
-    if ( function_exists( 'mb_strtoupper' ) ) {
852
-        return mb_strtoupper( $str, $encoding );
850
+function wpinv_utf8_strtoupper($str, $encoding = 'UTF-8') {
851
+    if (function_exists('mb_strtoupper')) {
852
+        return mb_strtoupper($str, $encoding);
853 853
     }
854 854
     
855
-    return strtoupper( $str );
855
+    return strtoupper($str);
856 856
 }
857 857
 
858 858
 /**
@@ -866,12 +866,12 @@  discard block
 block discarded – undo
866 866
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
867 867
  * @return int Returns the position of the first occurrence of search in the string.
868 868
  */
869
-function wpinv_utf8_strpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
870
-    if ( function_exists( 'mb_strpos' ) ) {
871
-        return mb_strpos( $str, $find, $offset, $encoding );
869
+function wpinv_utf8_strpos($str, $find, $offset = 0, $encoding = 'UTF-8') {
870
+    if (function_exists('mb_strpos')) {
871
+        return mb_strpos($str, $find, $offset, $encoding);
872 872
     }
873 873
         
874
-    return strpos( $str, $find, $offset );
874
+    return strpos($str, $find, $offset);
875 875
 }
876 876
 
877 877
 /**
@@ -885,12 +885,12 @@  discard block
 block discarded – undo
885 885
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
886 886
  * @return int Returns the position of the last occurrence of search.
887 887
  */
888
-function wpinv_utf8_strrpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
889
-    if ( function_exists( 'mb_strrpos' ) ) {
890
-        return mb_strrpos( $str, $find, $offset, $encoding );
888
+function wpinv_utf8_strrpos($str, $find, $offset = 0, $encoding = 'UTF-8') {
889
+    if (function_exists('mb_strrpos')) {
890
+        return mb_strrpos($str, $find, $offset, $encoding);
891 891
     }
892 892
         
893
-    return strrpos( $str, $find, $offset );
893
+    return strrpos($str, $find, $offset);
894 894
 }
895 895
 
896 896
 /**
@@ -905,16 +905,16 @@  discard block
 block discarded – undo
905 905
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
906 906
  * @return string
907 907
  */
908
-function wpinv_utf8_substr( $str, $start, $length = null, $encoding = 'UTF-8' ) {
909
-    if ( function_exists( 'mb_substr' ) ) {
910
-        if ( $length === null ) {
911
-            return mb_substr( $str, $start, wpinv_utf8_strlen( $str, $encoding ), $encoding );
908
+function wpinv_utf8_substr($str, $start, $length = null, $encoding = 'UTF-8') {
909
+    if (function_exists('mb_substr')) {
910
+        if ($length === null) {
911
+            return mb_substr($str, $start, wpinv_utf8_strlen($str, $encoding), $encoding);
912 912
         } else {
913
-            return mb_substr( $str, $start, $length, $encoding );
913
+            return mb_substr($str, $start, $length, $encoding);
914 914
         }
915 915
     }
916 916
         
917
-    return substr( $str, $start, $length );
917
+    return substr($str, $start, $length);
918 918
 }
919 919
 
920 920
 /**
@@ -926,48 +926,48 @@  discard block
 block discarded – undo
926 926
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
927 927
  * @return string The width of string.
928 928
  */
929
-function wpinv_utf8_strwidth( $str, $encoding = 'UTF-8' ) {
930
-    if ( function_exists( 'mb_strwidth' ) ) {
931
-        return mb_strwidth( $str, $encoding );
929
+function wpinv_utf8_strwidth($str, $encoding = 'UTF-8') {
930
+    if (function_exists('mb_strwidth')) {
931
+        return mb_strwidth($str, $encoding);
932 932
     }
933 933
     
934
-    return wpinv_utf8_strlen( $str, $encoding );
934
+    return wpinv_utf8_strlen($str, $encoding);
935 935
 }
936 936
 
937
-function wpinv_utf8_ucfirst( $str, $lower_str_end = false, $encoding = 'UTF-8' ) {
938
-    if ( function_exists( 'mb_strlen' ) ) {
939
-        $first_letter = wpinv_utf8_strtoupper( wpinv_utf8_substr( $str, 0, 1, $encoding ), $encoding );
937
+function wpinv_utf8_ucfirst($str, $lower_str_end = false, $encoding = 'UTF-8') {
938
+    if (function_exists('mb_strlen')) {
939
+        $first_letter = wpinv_utf8_strtoupper(wpinv_utf8_substr($str, 0, 1, $encoding), $encoding);
940 940
         $str_end = "";
941 941
         
942
-        if ( $lower_str_end ) {
943
-            $str_end = wpinv_utf8_strtolower( wpinv_utf8_substr( $str, 1, wpinv_utf8_strlen( $str, $encoding ), $encoding ), $encoding );
942
+        if ($lower_str_end) {
943
+            $str_end = wpinv_utf8_strtolower(wpinv_utf8_substr($str, 1, wpinv_utf8_strlen($str, $encoding), $encoding), $encoding);
944 944
         } else {
945
-            $str_end = wpinv_utf8_substr( $str, 1, wpinv_utf8_strlen( $str, $encoding ), $encoding );
945
+            $str_end = wpinv_utf8_substr($str, 1, wpinv_utf8_strlen($str, $encoding), $encoding);
946 946
         }
947 947
 
948 948
         return $first_letter . $str_end;
949 949
     }
950 950
     
951
-    return ucfirst( $str );
951
+    return ucfirst($str);
952 952
 }
953 953
 
954
-function wpinv_utf8_ucwords( $str, $encoding = 'UTF-8' ) {
955
-    if ( function_exists( 'mb_convert_case' ) ) {
956
-        return mb_convert_case( $str, MB_CASE_TITLE, $encoding );
954
+function wpinv_utf8_ucwords($str, $encoding = 'UTF-8') {
955
+    if (function_exists('mb_convert_case')) {
956
+        return mb_convert_case($str, MB_CASE_TITLE, $encoding);
957 957
     }
958 958
     
959
-    return ucwords( $str );
959
+    return ucwords($str);
960 960
 }
961 961
 
962
-function wpinv_period_in_days( $period, $unit ) {
963
-    $period = absint( $period );
962
+function wpinv_period_in_days($period, $unit) {
963
+    $period = absint($period);
964 964
     
965
-    if ( $period > 0 ) {
966
-        if ( in_array( strtolower( $unit ), array( 'w', 'week', 'weeks' ) ) ) {
965
+    if ($period > 0) {
966
+        if (in_array(strtolower($unit), array('w', 'week', 'weeks'))) {
967 967
             $period = $period * 7;
968
-        } else if ( in_array( strtolower( $unit ), array( 'm', 'month', 'months' ) ) ) {
968
+        } else if (in_array(strtolower($unit), array('m', 'month', 'months'))) {
969 969
             $period = $period * 30;
970
-        } else if ( in_array( strtolower( $unit ), array( 'y', 'year', 'years' ) ) ) {
970
+        } else if (in_array(strtolower($unit), array('y', 'year', 'years'))) {
971 971
             $period = $period * 365;
972 972
         }
973 973
     }
@@ -975,14 +975,14 @@  discard block
 block discarded – undo
975 975
     return $period;
976 976
 }
977 977
 
978
-function wpinv_cal_days_in_month( $calendar, $month, $year ) {
979
-    if ( function_exists( 'cal_days_in_month' ) ) {
980
-        return cal_days_in_month( $calendar, $month, $year );
978
+function wpinv_cal_days_in_month($calendar, $month, $year) {
979
+    if (function_exists('cal_days_in_month')) {
980
+        return cal_days_in_month($calendar, $month, $year);
981 981
     }
982 982
 
983 983
     // Fallback in case the calendar extension is not loaded in PHP
984 984
     // Only supports Gregorian calendar
985
-    return date( 't', mktime( 0, 0, 0, $month, 1, $year ) );
985
+    return date('t', mktime(0, 0, 0, $month, 1, $year));
986 986
 }
987 987
 
988 988
 /**
@@ -993,11 +993,11 @@  discard block
 block discarded – undo
993 993
  *
994 994
  * @return string
995 995
  */
996
-function wpi_help_tip( $tip, $allow_html = false ) {
997
-    if ( $allow_html ) {
998
-        $tip = wpi_sanitize_tooltip( $tip );
996
+function wpi_help_tip($tip, $allow_html = false) {
997
+    if ($allow_html) {
998
+        $tip = wpi_sanitize_tooltip($tip);
999 999
     } else {
1000
-        $tip = esc_attr( $tip );
1000
+        $tip = esc_attr($tip);
1001 1001
     }
1002 1002
 
1003 1003
     return '<span class="wpi-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
@@ -1011,8 +1011,8 @@  discard block
 block discarded – undo
1011 1011
  * @param string $var
1012 1012
  * @return string
1013 1013
  */
1014
-function wpi_sanitize_tooltip( $var ) {
1015
-    return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
1014
+function wpi_sanitize_tooltip($var) {
1015
+    return htmlspecialchars(wp_kses(html_entity_decode($var), array(
1016 1016
         'br'     => array(),
1017 1017
         'em'     => array(),
1018 1018
         'strong' => array(),
@@ -1022,7 +1022,7 @@  discard block
 block discarded – undo
1022 1022
         'li'     => array(),
1023 1023
         'ol'     => array(),
1024 1024
         'p'      => array(),
1025
-    ) ) );
1025
+    )));
1026 1026
 }
1027 1027
 
1028 1028
 /**
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
  */
1033 1033
 function wpinv_get_screen_ids() {
1034 1034
 
1035
-    $screen_id = sanitize_title( __( 'Invoicing', 'invoicing' ) );
1035
+    $screen_id = sanitize_title(__('Invoicing', 'invoicing'));
1036 1036
 
1037 1037
     $screen_ids = array(
1038 1038
         'toplevel_page_' . $screen_id,
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
         'invoicing_page_wpi-addons',
1051 1051
     );
1052 1052
 
1053
-    return apply_filters( 'wpinv_screen_ids', $screen_ids );
1053
+    return apply_filters('wpinv_screen_ids', $screen_ids);
1054 1054
 }
1055 1055
 
1056 1056
 /**
@@ -1061,14 +1061,14 @@  discard block
 block discarded – undo
1061 1061
  * @param array|string $list List of values.
1062 1062
  * @return array Sanitized array of values.
1063 1063
  */
1064
-function wpinv_parse_list( $list ) {
1064
+function wpinv_parse_list($list) {
1065 1065
 
1066
-    if ( empty( $list ) ) {
1066
+    if (empty($list)) {
1067 1067
         $list = array();
1068 1068
     }
1069 1069
 
1070
-	if ( ! is_array( $list ) ) {
1071
-		return preg_split( '/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY );
1070
+	if (!is_array($list)) {
1071
+		return preg_split('/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY);
1072 1072
 	}
1073 1073
 
1074 1074
 	return $list;
@@ -1082,16 +1082,16 @@  discard block
 block discarded – undo
1082 1082
  * @param string $key Type of data to fetch.
1083 1083
  * @return mixed Fetched data.
1084 1084
  */
1085
-function wpinv_get_data( $key ) {
1085
+function wpinv_get_data($key) {
1086 1086
     
1087 1087
     // Try fetching it from the cache.
1088
-    $data = wp_cache_get( "wpinv-data-$key", 'wpinv' );
1089
-    if( $data ) {
1088
+    $data = wp_cache_get("wpinv-data-$key", 'wpinv');
1089
+    if ($data) {
1090 1090
         return $data;
1091 1091
     }
1092 1092
 
1093
-    $data = apply_filters( "wpinv_get_$key", include WPINV_PLUGIN_DIR . "includes/data/$key.php" );
1094
-	wp_cache_set( "wpinv-data-$key", $data, 'wpinv' );
1093
+    $data = apply_filters("wpinv_get_$key", include WPINV_PLUGIN_DIR . "includes/data/$key.php");
1094
+	wp_cache_set("wpinv-data-$key", $data, 'wpinv');
1095 1095
 
1096 1096
 	return $data;
1097 1097
 }
@@ -1105,10 +1105,10 @@  discard block
 block discarded – undo
1105 1105
  * @param bool $first_empty Whether or not the first item in the list should be empty
1106 1106
  * @return mixed Fetched data.
1107 1107
  */
1108
-function wpinv_maybe_add_empty_option( $options, $first_empty ) {
1108
+function wpinv_maybe_add_empty_option($options, $first_empty) {
1109 1109
 
1110
-    if ( ! empty( $options ) && $first_empty ) {
1111
-        return array_merge( array( '' => '' ), $options );
1110
+    if (!empty($options) && $first_empty) {
1111
+        return array_merge(array('' => ''), $options);
1112 1112
     }
1113 1113
     return $options;
1114 1114
 
@@ -1120,21 +1120,21 @@  discard block
 block discarded – undo
1120 1120
  * @param mixed $var Data to sanitize.
1121 1121
  * @return string|array
1122 1122
  */
1123
-function wpinv_clean( $var ) {
1123
+function wpinv_clean($var) {
1124 1124
 
1125
-	if ( is_array( $var ) ) {
1126
-		return array_map( 'wpinv_clean', $var );
1125
+	if (is_array($var)) {
1126
+		return array_map('wpinv_clean', $var);
1127 1127
     }
1128 1128
 
1129
-    if ( is_object( $var ) ) {
1130
-		$object_vars = get_object_vars( $var );
1131
-		foreach ( $object_vars as $property_name => $property_value ) {
1132
-			$var->$property_name = wpinv_clean( $property_value );
1129
+    if (is_object($var)) {
1130
+		$object_vars = get_object_vars($var);
1131
+		foreach ($object_vars as $property_name => $property_value) {
1132
+			$var->$property_name = wpinv_clean($property_value);
1133 1133
         }
1134 1134
         return $var;
1135 1135
 	}
1136 1136
     
1137
-    return is_string( $var ) ? sanitize_text_field( $var ) : $var;
1137
+    return is_string($var) ? sanitize_text_field($var) : $var;
1138 1138
 }
1139 1139
 
1140 1140
 /**
@@ -1143,43 +1143,43 @@  discard block
 block discarded – undo
1143 1143
  * @param string $str Data to convert.
1144 1144
  * @return string|array
1145 1145
  */
1146
-function getpaid_convert_price_string_to_options( $str ) {
1146
+function getpaid_convert_price_string_to_options($str) {
1147 1147
 
1148
-	$raw_options = array_map( 'trim', explode( ',', $str ) );
1149
-    $options     = array();
1148
+	$raw_options = array_map('trim', explode(',', $str));
1149
+    $options = array();
1150 1150
 
1151
-    foreach ( $raw_options as $option ) {
1151
+    foreach ($raw_options as $option) {
1152 1152
 
1153
-        if ( '' == $option ) {
1153
+        if ('' == $option) {
1154 1154
             continue;
1155 1155
         }
1156 1156
 
1157
-        $option = array_map( 'trim', explode( '|', $option ) );
1157
+        $option = array_map('trim', explode('|', $option));
1158 1158
 
1159 1159
         $price = null;
1160 1160
         $label = null;
1161 1161
 
1162
-        if ( isset( $option[0] ) && '' !=  $option[0] ) {
1163
-            $label  = $option[0];
1162
+        if (isset($option[0]) && '' != $option[0]) {
1163
+            $label = $option[0];
1164 1164
         }
1165 1165
 
1166
-        if ( isset( $option[1] ) && '' !=  $option[1] ) {
1166
+        if (isset($option[1]) && '' != $option[1]) {
1167 1167
             $price = $option[1];
1168 1168
         }
1169 1169
 
1170
-        if ( ! isset( $price ) ) {
1170
+        if (!isset($price)) {
1171 1171
             $price = $label;
1172 1172
         }
1173 1173
 
1174
-        if ( ! isset( $price ) || ! is_numeric( $price ) ) {
1174
+        if (!isset($price) || !is_numeric($price)) {
1175 1175
             continue;
1176 1176
         }
1177 1177
 
1178
-        if ( ! isset( $label ) ) {
1178
+        if (!isset($label)) {
1179 1179
             $label = $price;
1180 1180
         }
1181 1181
 
1182
-        $options[ $price ] = $label;
1182
+        $options[$price] = $label;
1183 1183
     }
1184 1184
 
1185 1185
     return $options;
@@ -1188,22 +1188,22 @@  discard block
 block discarded – undo
1188 1188
 /**
1189 1189
  * Returns the help tip.
1190 1190
  */
1191
-function getpaid_get_help_tip( $tip, $additional_classes = '' ) {
1192
-    $additional_classes = sanitize_html_class( $additional_classes );
1193
-    $tip                = esc_attr__( $tip );
1191
+function getpaid_get_help_tip($tip, $additional_classes = '') {
1192
+    $additional_classes = sanitize_html_class($additional_classes);
1193
+    $tip                = esc_attr__($tip);
1194 1194
     return "<span class='wpi-help-tip dashicons dashicons-editor-help $additional_classes' title='$tip'></span>";
1195 1195
 }
1196 1196
 
1197 1197
 /**
1198 1198
  * Formats a date
1199 1199
  */
1200
-function getpaid_format_date( $date ) {
1200
+function getpaid_format_date($date) {
1201 1201
 
1202
-    if ( empty( $date ) || $date == '0000-00-00 00:00:00' ) {
1202
+    if (empty($date) || $date == '0000-00-00 00:00:00') {
1203 1203
         return '';
1204 1204
     }
1205 1205
 
1206 1206
 
1207
-    return date_i18n( get_option( 'date_format' ), strtotime( $date ) );
1207
+    return date_i18n(get_option('date_format'), strtotime($date));
1208 1208
 
1209 1209
 }
Please login to merge, or discard this patch.
includes/wpinv-gateway-functions.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -286,26 +286,26 @@  discard block
 block discarded – undo
286 286
 }
287 287
 
288 288
 function wpinv_get_chosen_gateway( $invoice_id = 0 ) {
289
-	$gateways = array_keys( wpinv_get_enabled_payment_gateways() );
289
+    $gateways = array_keys( wpinv_get_enabled_payment_gateways() );
290 290
 
291 291
     $chosen = false;
292 292
     if ( $invoice_id > 0 && $invoice = wpinv_get_invoice( $invoice_id ) ) {
293 293
         $chosen = $invoice->get_gateway();
294 294
     }
295 295
 
296
-	$chosen   = isset( $_REQUEST['payment-mode'] ) ? sanitize_text_field( $_REQUEST['payment-mode'] ) : $chosen;
296
+    $chosen   = isset( $_REQUEST['payment-mode'] ) ? sanitize_text_field( $_REQUEST['payment-mode'] ) : $chosen;
297 297
 
298
-	if ( false !== $chosen ) {
299
-		$chosen = preg_replace('/[^a-zA-Z0-9-_]+/', '', $chosen );
300
-	}
298
+    if ( false !== $chosen ) {
299
+        $chosen = preg_replace('/[^a-zA-Z0-9-_]+/', '', $chosen );
300
+    }
301 301
 
302
-	if ( ! empty ( $chosen ) ) {
303
-		$enabled_gateway = urldecode( $chosen );
304
-	} else if (  !empty( $invoice ) && (float)$invoice->get_subtotal() <= 0 ) {
305
-		$enabled_gateway = 'manual';
306
-	} else {
307
-		$enabled_gateway = wpinv_get_default_gateway();
308
-	}
302
+    if ( ! empty ( $chosen ) ) {
303
+        $enabled_gateway = urldecode( $chosen );
304
+    } else if (  !empty( $invoice ) && (float)$invoice->get_subtotal() <= 0 ) {
305
+        $enabled_gateway = 'manual';
306
+    } else {
307
+        $enabled_gateway = wpinv_get_default_gateway();
308
+    }
309 309
     
310 310
     if ( !wpinv_is_gateway_active( $enabled_gateway ) && !empty( $gateways ) ) {
311 311
         if(wpinv_is_gateway_active( wpinv_get_default_gateway()) ){
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 
317 317
     }
318 318
 
319
-	return apply_filters( 'wpinv_chosen_gateway', $enabled_gateway );
319
+    return apply_filters( 'wpinv_chosen_gateway', $enabled_gateway );
320 320
 }
321 321
 
322 322
 function wpinv_record_gateway_error( $title = '', $message = '', $parent = 0 ) {
@@ -324,21 +324,21 @@  discard block
 block discarded – undo
324 324
 }
325 325
 
326 326
 function wpinv_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) {
327
-	$ret  = 0;
328
-	$args = array(
329
-		'meta_key'    => '_wpinv_gateway',
330
-		'meta_value'  => $gateway_id,
331
-		'nopaging'    => true,
332
-		'post_type'   => 'wpi_invoice',
333
-		'post_status' => $status,
334
-		'fields'      => 'ids'
335
-	);
336
-
337
-	$payments = new WP_Query( $args );
338
-
339
-	if( $payments )
340
-		$ret = $payments->post_count;
341
-	return $ret;
327
+    $ret  = 0;
328
+    $args = array(
329
+        'meta_key'    => '_wpinv_gateway',
330
+        'meta_value'  => $gateway_id,
331
+        'nopaging'    => true,
332
+        'post_type'   => 'wpi_invoice',
333
+        'post_status' => $status,
334
+        'fields'      => 'ids'
335
+    );
336
+
337
+    $payments = new WP_Query( $args );
338
+
339
+    if( $payments )
340
+        $ret = $payments->post_count;
341
+    return $ret;
342 342
 }
343 343
 
344 344
 function wpinv_settings_update_gateways( $input ) {
@@ -900,20 +900,20 @@  discard block
 block discarded – undo
900 900
 }
901 901
 
902 902
 function wpinv_checkout_get_cc_info() {
903
-	$cc_info = array();
904
-	$cc_info['card_name']      = isset( $_POST['card_name'] )       ? sanitize_text_field( $_POST['card_name'] )       : '';
905
-	$cc_info['card_number']    = isset( $_POST['card_number'] )     ? sanitize_text_field( $_POST['card_number'] )     : '';
906
-	$cc_info['card_cvc']       = isset( $_POST['card_cvc'] )        ? sanitize_text_field( $_POST['card_cvc'] )        : '';
907
-	$cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] )  ? sanitize_text_field( $_POST['card_exp_month'] )  : '';
908
-	$cc_info['card_exp_year']  = isset( $_POST['card_exp_year'] )   ? sanitize_text_field( $_POST['card_exp_year'] )   : '';
909
-	$cc_info['card_address']   = isset( $_POST['wpinv_address'] )  ? sanitize_text_field( $_POST['wpinv_address'] ) : '';
910
-	$cc_info['card_city']      = isset( $_POST['wpinv_city'] )     ? sanitize_text_field( $_POST['wpinv_city'] )    : '';
911
-	$cc_info['card_state']     = isset( $_POST['wpinv_state'] )    ? sanitize_text_field( $_POST['wpinv_state'] )   : '';
912
-	$cc_info['card_country']   = isset( $_POST['wpinv_country'] )  ? sanitize_text_field( $_POST['wpinv_country'] ) : '';
913
-	$cc_info['card_zip']       = isset( $_POST['wpinv_zip'] )      ? sanitize_text_field( $_POST['wpinv_zip'] )     : '';
914
-
915
-	// Return cc info
916
-	return $cc_info;
903
+    $cc_info = array();
904
+    $cc_info['card_name']      = isset( $_POST['card_name'] )       ? sanitize_text_field( $_POST['card_name'] )       : '';
905
+    $cc_info['card_number']    = isset( $_POST['card_number'] )     ? sanitize_text_field( $_POST['card_number'] )     : '';
906
+    $cc_info['card_cvc']       = isset( $_POST['card_cvc'] )        ? sanitize_text_field( $_POST['card_cvc'] )        : '';
907
+    $cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] )  ? sanitize_text_field( $_POST['card_exp_month'] )  : '';
908
+    $cc_info['card_exp_year']  = isset( $_POST['card_exp_year'] )   ? sanitize_text_field( $_POST['card_exp_year'] )   : '';
909
+    $cc_info['card_address']   = isset( $_POST['wpinv_address'] )  ? sanitize_text_field( $_POST['wpinv_address'] ) : '';
910
+    $cc_info['card_city']      = isset( $_POST['wpinv_city'] )     ? sanitize_text_field( $_POST['wpinv_city'] )    : '';
911
+    $cc_info['card_state']     = isset( $_POST['wpinv_state'] )    ? sanitize_text_field( $_POST['wpinv_state'] )   : '';
912
+    $cc_info['card_country']   = isset( $_POST['wpinv_country'] )  ? sanitize_text_field( $_POST['wpinv_country'] ) : '';
913
+    $cc_info['card_zip']       = isset( $_POST['wpinv_zip'] )      ? sanitize_text_field( $_POST['wpinv_zip'] )     : '';
914
+
915
+    // Return cc info
916
+    return $cc_info;
917 917
 }
918 918
 
919 919
 /**
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
         $required_fields  = wpinv_checkout_required_fields();
970 970
 
971 971
         // Loop through required fields and show error messages
972
-         if ( !empty( $required_fields ) ) {
972
+            if ( !empty( $required_fields ) ) {
973 973
             foreach ( $required_fields as $field_name => $value ) {
974 974
                 if ( in_array( $value, $required_fields ) && empty( $_POST[ 'wpinv_' . $field_name ] ) ) {
975 975
                     wpinv_set_error( $value['error_id'], $value['error_message'] );
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
         $response['data']['taxf']       = $invoice->get_tax( true );
1130 1130
         $response['data']['total']      = $invoice->get_total();
1131 1131
         $response['data']['totalf']     = $invoice->get_total( true );
1132
-	    $response['data']['free']       = $invoice->is_free() && ( ! ( (float) $response['data']['total'] > 0 ) || $invoice->has_free_trial() ) ? true : false;
1132
+        $response['data']['free']       = $invoice->is_free() && ( ! ( (float) $response['data']['total'] > 0 ) || $invoice->has_free_trial() ) ? true : false;
1133 1133
 
1134 1134
         wp_send_json( $response );
1135 1135
     }
@@ -1199,8 +1199,8 @@  discard block
 block discarded – undo
1199 1199
     // Allow themes and plugins to hook before the gateway
1200 1200
     do_action( 'wpinv_checkout_before_gateway', $_POST, $user_info, $valid_data );
1201 1201
 
1202
-     // If it is free, abort.
1203
-     if ( $invoice->is_free() && ( ! $invoice->is_recurring() || 0 ==  $invoice->get_recurring_details( 'total' ) ) ) {
1202
+        // If it is free, abort.
1203
+        if ( $invoice->is_free() && ( ! $invoice->is_recurring() || 0 ==  $invoice->get_recurring_details( 'total' ) ) ) {
1204 1204
         $invoice_data['gateway'] = 'manual';
1205 1205
         $_POST['wpi-gateway'] = 'manual';
1206 1206
     }
Please login to merge, or discard this patch.
Spacing   +386 added lines, -386 removed lines patch added patch discarded remove patch
@@ -7,206 +7,206 @@  discard block
 block discarded – undo
7 7
  */
8 8
  
9 9
 // MUST have WordPress.
10
-if ( !defined( 'WPINC' ) ) {
11
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
10
+if (!defined('WPINC')) {
11
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
12 12
 }
13 13
 
14 14
 function wpinv_get_payment_gateways() {
15 15
     // Default, built-in gateways
16 16
     $gateways = array(
17 17
         'paypal' => array(
18
-            'admin_label'    => __( 'PayPal Standard', 'invoicing' ),
19
-            'checkout_label' => __( 'PayPal Standard', 'invoicing' ),
18
+            'admin_label'    => __('PayPal Standard', 'invoicing'),
19
+            'checkout_label' => __('PayPal Standard', 'invoicing'),
20 20
             'ordering'       => 1,
21 21
         ),
22 22
         'authorizenet' => array(
23
-            'admin_label'    => __( 'Authorize.Net (AIM)', 'invoicing' ),
24
-            'checkout_label' => __( 'Authorize.Net - Credit Card / Debit Card', 'invoicing' ),
23
+            'admin_label'    => __('Authorize.Net (AIM)', 'invoicing'),
24
+            'checkout_label' => __('Authorize.Net - Credit Card / Debit Card', 'invoicing'),
25 25
             'ordering'       => 4,
26 26
         ),
27 27
         'worldpay' => array(
28
-            'admin_label'    => __( 'Worldpay', 'invoicing' ),
29
-            'checkout_label' => __( 'Worldpay - Credit Card / Debit Card', 'invoicing' ),
28
+            'admin_label'    => __('Worldpay', 'invoicing'),
29
+            'checkout_label' => __('Worldpay - Credit Card / Debit Card', 'invoicing'),
30 30
             'ordering'       => 5,
31 31
         ),
32 32
         'bank_transfer' => array(
33
-            'admin_label'    => __( 'Pre Bank Transfer', 'invoicing' ),
34
-            'checkout_label' => __( 'Pre Bank Transfer', 'invoicing' ),
33
+            'admin_label'    => __('Pre Bank Transfer', 'invoicing'),
34
+            'checkout_label' => __('Pre Bank Transfer', 'invoicing'),
35 35
             'ordering'       => 11,
36 36
         ),
37 37
         'manual' => array(
38
-            'admin_label'    => __( 'Manual Payment', 'invoicing' ),
39
-            'checkout_label' => __( 'Manual Payment', 'invoicing' ),
38
+            'admin_label'    => __('Manual Payment', 'invoicing'),
39
+            'checkout_label' => __('Manual Payment', 'invoicing'),
40 40
             'ordering'       => 12,
41 41
         ),
42 42
     );
43 43
 
44
-    return apply_filters( 'wpinv_payment_gateways', $gateways );
44
+    return apply_filters('wpinv_payment_gateways', $gateways);
45 45
 }
46 46
 
47
-function wpinv_payment_gateway_titles( $all_gateways ) {
47
+function wpinv_payment_gateway_titles($all_gateways) {
48 48
     global $wpinv_options;
49 49
 
50 50
     $gateways = array();
51
-    foreach ( $all_gateways as $key => $gateway ) {
52
-        if ( !empty( $wpinv_options[$key . '_title'] ) ) {
53
-            $all_gateways[$key]['checkout_label'] = __( $wpinv_options[$key . '_title'], 'invoicing' );
51
+    foreach ($all_gateways as $key => $gateway) {
52
+        if (!empty($wpinv_options[$key . '_title'])) {
53
+            $all_gateways[$key]['checkout_label'] = __($wpinv_options[$key . '_title'], 'invoicing');
54 54
         }
55 55
 
56
-        $gateways[$key] = isset( $wpinv_options[$key . '_ordering'] ) ? $wpinv_options[$key . '_ordering'] : ( isset( $gateway['ordering'] ) ? $gateway['ordering'] : '' );
56
+        $gateways[$key] = isset($wpinv_options[$key . '_ordering']) ? $wpinv_options[$key . '_ordering'] : (isset($gateway['ordering']) ? $gateway['ordering'] : '');
57 57
     }
58 58
 
59
-    asort( $gateways );
59
+    asort($gateways);
60 60
 
61
-    foreach ( $gateways as $gateway => $key ) {
61
+    foreach ($gateways as $gateway => $key) {
62 62
         $gateways[$gateway] = $all_gateways[$gateway];
63 63
     }
64 64
 
65 65
     return $gateways;
66 66
 }
67
-add_filter( 'wpinv_payment_gateways', 'wpinv_payment_gateway_titles', 1000, 1 );
67
+add_filter('wpinv_payment_gateways', 'wpinv_payment_gateway_titles', 1000, 1);
68 68
 
69
-function wpinv_get_enabled_payment_gateways( $sort = false ) {
69
+function wpinv_get_enabled_payment_gateways($sort = false) {
70 70
     $gateways = wpinv_get_payment_gateways();
71
-    $enabled  = wpinv_get_option( 'gateways', false );
71
+    $enabled  = wpinv_get_option('gateways', false);
72 72
 
73 73
     $gateway_list = array();
74 74
 
75
-    foreach ( $gateways as $key => $gateway ) {
76
-        if ( isset( $enabled[ $key ] ) && $enabled[ $key ] == 1 ) {
77
-            $gateway_list[ $key ] = $gateway;
75
+    foreach ($gateways as $key => $gateway) {
76
+        if (isset($enabled[$key]) && $enabled[$key] == 1) {
77
+            $gateway_list[$key] = $gateway;
78 78
         }
79 79
     }
80 80
 
81
-    if ( true === $sort ) {
82
-        uasort( $gateway_list, 'wpinv_sort_gateway_order' );
81
+    if (true === $sort) {
82
+        uasort($gateway_list, 'wpinv_sort_gateway_order');
83 83
         
84 84
         // Reorder our gateways so the default is first
85 85
         $default_gateway_id = wpinv_get_default_gateway();
86 86
 
87
-        if ( wpinv_is_gateway_active( $default_gateway_id ) ) {
88
-            $default_gateway    = array( $default_gateway_id => $gateway_list[ $default_gateway_id ] );
89
-            unset( $gateway_list[ $default_gateway_id ] );
87
+        if (wpinv_is_gateway_active($default_gateway_id)) {
88
+            $default_gateway = array($default_gateway_id => $gateway_list[$default_gateway_id]);
89
+            unset($gateway_list[$default_gateway_id]);
90 90
 
91
-            $gateway_list = array_merge( $default_gateway, $gateway_list );
91
+            $gateway_list = array_merge($default_gateway, $gateway_list);
92 92
         }
93 93
     }
94 94
 
95
-    return apply_filters( 'wpinv_enabled_payment_gateways', $gateway_list );
95
+    return apply_filters('wpinv_enabled_payment_gateways', $gateway_list);
96 96
 }
97 97
 
98
-function wpinv_sort_gateway_order( $a, $b ) {
98
+function wpinv_sort_gateway_order($a, $b) {
99 99
     return $a['ordering'] - $b['ordering'];
100 100
 }
101 101
 
102
-function wpinv_is_gateway_active( $gateway ) {
102
+function wpinv_is_gateway_active($gateway) {
103 103
     $gateways = wpinv_get_enabled_payment_gateways();
104 104
 
105
-    $ret = is_array($gateways) && $gateway ?  array_key_exists( $gateway, $gateways ) : false;
105
+    $ret = is_array($gateways) && $gateway ?  array_key_exists($gateway, $gateways) : false;
106 106
 
107
-    return apply_filters( 'wpinv_is_gateway_active', $ret, $gateway, $gateways );
107
+    return apply_filters('wpinv_is_gateway_active', $ret, $gateway, $gateways);
108 108
 }
109 109
 
110 110
 function wpinv_get_default_gateway() {
111
-    $default = wpinv_get_option( 'default_gateway', 'paypal' );
111
+    $default = wpinv_get_option('default_gateway', 'paypal');
112 112
 
113
-    if ( !wpinv_is_gateway_active( $default ) ) {
113
+    if (!wpinv_is_gateway_active($default)) {
114 114
         $gateways = wpinv_get_enabled_payment_gateways();
115
-        $gateways = array_keys( $gateways );
116
-        $default  = reset( $gateways );
115
+        $gateways = array_keys($gateways);
116
+        $default  = reset($gateways);
117 117
     }
118 118
 
119
-    return apply_filters( 'wpinv_default_gateway', $default );
119
+    return apply_filters('wpinv_default_gateway', $default);
120 120
 }
121 121
 
122
-function wpinv_get_gateway_admin_label( $gateway ) {
122
+function wpinv_get_gateway_admin_label($gateway) {
123 123
     $gateways = wpinv_get_payment_gateways();
124
-    $label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway;
125
-    $payment  = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : false;
124
+    $label    = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway;
125
+    $payment  = isset($_GET['id']) ? absint($_GET['id']) : false;
126 126
 
127
-    if( $gateway == 'manual' && $payment ) {
128
-        if( !( (float)wpinv_payment_total( $payment ) > 0 ) ) {
129
-            $label = __( 'Free Purchase', 'invoicing' );
127
+    if ($gateway == 'manual' && $payment) {
128
+        if (!((float) wpinv_payment_total($payment) > 0)) {
129
+            $label = __('Free Purchase', 'invoicing');
130 130
         }
131 131
     }
132 132
 
133
-    return apply_filters( 'wpinv_gateway_admin_label', $label, $gateway );
133
+    return apply_filters('wpinv_gateway_admin_label', $label, $gateway);
134 134
 }
135 135
 
136
-function wpinv_get_gateway_description( $gateway ) {
136
+function wpinv_get_gateway_description($gateway) {
137 137
     global $wpinv_options;
138 138
 
139
-    $description = ! empty( $wpinv_options[$gateway . '_desc'] ) ? $wpinv_options[$gateway . '_desc'] : '';
139
+    $description = !empty($wpinv_options[$gateway . '_desc']) ? $wpinv_options[$gateway . '_desc'] : '';
140 140
 
141
-    return apply_filters( 'wpinv_gateway_description', $description, $gateway );
141
+    return apply_filters('wpinv_gateway_description', $description, $gateway);
142 142
 }
143 143
 
144
-function wpinv_get_gateway_button_label( $gateway ) {
145
-    return apply_filters( 'wpinv_gateway_' . $gateway . '_button_label', '' );
144
+function wpinv_get_gateway_button_label($gateway) {
145
+    return apply_filters('wpinv_gateway_' . $gateway . '_button_label', '');
146 146
 }
147 147
 
148
-function wpinv_get_gateway_checkout_label( $gateway ) {
148
+function wpinv_get_gateway_checkout_label($gateway) {
149 149
     $gateways = wpinv_get_payment_gateways();
150
-    $label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway;
150
+    $label    = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway;
151 151
 
152
-    if( $gateway == 'manual' ) {
153
-        $label = __( 'Manual Payment', 'invoicing' );
152
+    if ($gateway == 'manual') {
153
+        $label = __('Manual Payment', 'invoicing');
154 154
     }
155 155
 
156
-    return apply_filters( 'wpinv_gateway_checkout_label', $label, $gateway );
156
+    return apply_filters('wpinv_gateway_checkout_label', $label, $gateway);
157 157
 }
158 158
 
159
-function wpinv_settings_sections_gateways( $settings ) {
159
+function wpinv_settings_sections_gateways($settings) {
160 160
     $gateways = wpinv_get_payment_gateways();
161 161
     
162 162
     if (!empty($gateways)) {
163
-        foreach  ($gateways as $key => $gateway) {
163
+        foreach ($gateways as $key => $gateway) {
164 164
             $settings[$key] = $gateway['admin_label'];
165 165
         }
166 166
     }
167 167
     
168 168
     return $settings;    
169 169
 }
170
-add_filter( 'wpinv_settings_sections_gateways', 'wpinv_settings_sections_gateways', 10, 1 );
170
+add_filter('wpinv_settings_sections_gateways', 'wpinv_settings_sections_gateways', 10, 1);
171 171
 
172
-function wpinv_settings_gateways( $settings ) {
172
+function wpinv_settings_gateways($settings) {
173 173
     $gateways = wpinv_get_payment_gateways();
174 174
     
175 175
     if (!empty($gateways)) {
176
-        foreach  ($gateways as $key => $gateway) {
176
+        foreach ($gateways as $key => $gateway) {
177 177
             $setting = array();
178 178
             $setting[$key . '_header'] = array(
179 179
                     'id'   => 'gateway_header',
180
-                    'name' => '<h3>' . wp_sprintf( __( '%s Settings', 'invoicing' ), $gateway['admin_label'] ) . '</h3>',
180
+                    'name' => '<h3>' . wp_sprintf(__('%s Settings', 'invoicing'), $gateway['admin_label']) . '</h3>',
181 181
                     'custom' => $key,
182 182
                     'type' => 'gateway_header',
183 183
                 );
184 184
             $setting[$key . '_active'] = array(
185 185
                     'id'   => $key . '_active',
186
-                    'name' => __( 'Active', 'invoicing' ),
187
-                    'desc' => wp_sprintf( __( 'Enable %s', 'invoicing' ), $gateway['admin_label'] ),
186
+                    'name' => __('Active', 'invoicing'),
187
+                    'desc' => wp_sprintf(__('Enable %s', 'invoicing'), $gateway['admin_label']),
188 188
                     'type' => 'checkbox',
189 189
                 );
190 190
                 
191 191
             $setting[$key . '_title'] = array(
192 192
                     'id'   => $key . '_title',
193
-                    'name' => __( 'Title', 'invoicing' ),
194
-                    'desc' => __( 'This controls the title which the user sees during checkout.', 'invoicing' ),
193
+                    'name' => __('Title', 'invoicing'),
194
+                    'desc' => __('This controls the title which the user sees during checkout.', 'invoicing'),
195 195
                     'type' => 'text',
196 196
                     'std' => isset($gateway['checkout_label']) ? $gateway['checkout_label'] : ''
197 197
                 );
198 198
             
199 199
             $setting[$key . '_desc'] = array(
200 200
                     'id'   => $key . '_desc',
201
-                    'name' => __( 'Description', 'invoicing' ),
202
-                    'desc' => __( 'This controls the description which the user sees during checkout.', 'invoicing' ),
201
+                    'name' => __('Description', 'invoicing'),
202
+                    'desc' => __('This controls the description which the user sees during checkout.', 'invoicing'),
203 203
                     'type' => 'text',
204 204
                     'size' => 'large'
205 205
                 );
206 206
                 
207 207
             $setting[$key . '_ordering'] = array(
208 208
                     'id'   => $key . '_ordering',
209
-                    'name' => __( 'Display Order', 'invoicing' ),
209
+                    'name' => __('Display Order', 'invoicing'),
210 210
                     'type' => 'number',
211 211
                     'size' => 'small',
212 212
                     'std'  => isset($gateway['ordering']) ? $gateway['ordering'] : '10',
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
                     'step' => '1'
216 216
                 );
217 217
                 
218
-            $setting = apply_filters( 'wpinv_gateway_settings', $setting, $key );
219
-            $setting = apply_filters( 'wpinv_gateway_settings_' . $key, $setting );
218
+            $setting = apply_filters('wpinv_gateway_settings', $setting, $key);
219
+            $setting = apply_filters('wpinv_gateway_settings_' . $key, $setting);
220 220
             
221 221
             $settings[$key] = $setting;
222 222
         }
@@ -224,106 +224,106 @@  discard block
 block discarded – undo
224 224
     
225 225
     return $settings;    
226 226
 }
227
-add_filter( 'wpinv_settings_gateways', 'wpinv_settings_gateways', 10, 1 );
227
+add_filter('wpinv_settings_gateways', 'wpinv_settings_gateways', 10, 1);
228 228
 
229
-function wpinv_gateway_header_callback( $args ) {
230
-    echo '<input type="hidden" id="wpinv_settings[save_gateway]" name="wpinv_settings[save_gateway]" value="' . esc_attr( $args['custom'] ) . '" />';
229
+function wpinv_gateway_header_callback($args) {
230
+    echo '<input type="hidden" id="wpinv_settings[save_gateway]" name="wpinv_settings[save_gateway]" value="' . esc_attr($args['custom']) . '" />';
231 231
 }
232 232
 
233
-function wpinv_get_gateway_supports( $gateway ) {
233
+function wpinv_get_gateway_supports($gateway) {
234 234
     $gateways = wpinv_get_enabled_payment_gateways();
235
-    $supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array();
236
-    return apply_filters( 'wpinv_gateway_supports', $supports, $gateway );
235
+    $supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array();
236
+    return apply_filters('wpinv_gateway_supports', $supports, $gateway);
237 237
 }
238 238
 
239
-function wpinv_gateway_supports_buy_now( $gateway ) {
240
-    $supports = wpinv_get_gateway_supports( $gateway );
241
-    $ret = in_array( 'buy_now', $supports );
242
-    return apply_filters( 'wpinv_gateway_supports_buy_now', $ret, $gateway );
239
+function wpinv_gateway_supports_buy_now($gateway) {
240
+    $supports = wpinv_get_gateway_supports($gateway);
241
+    $ret = in_array('buy_now', $supports);
242
+    return apply_filters('wpinv_gateway_supports_buy_now', $ret, $gateway);
243 243
 }
244 244
 
245 245
 function wpinv_shop_supports_buy_now() {
246 246
     $gateways = wpinv_get_enabled_payment_gateways();
247 247
     $ret      = false;
248 248
 
249
-    if ( !wpinv_use_taxes()  && $gateways ) {
250
-        foreach ( $gateways as $gateway_id => $gateway ) {
251
-            if ( wpinv_gateway_supports_buy_now( $gateway_id ) ) {
249
+    if (!wpinv_use_taxes() && $gateways) {
250
+        foreach ($gateways as $gateway_id => $gateway) {
251
+            if (wpinv_gateway_supports_buy_now($gateway_id)) {
252 252
                 $ret = true;
253 253
                 break;
254 254
             }
255 255
         }
256 256
     }
257 257
 
258
-    return apply_filters( 'wpinv_shop_supports_buy_now', $ret );
258
+    return apply_filters('wpinv_shop_supports_buy_now', $ret);
259 259
 }
260 260
 
261
-function wpinv_send_to_gateway( $gateway, $payment_data ) {
262
-    $payment_data['gateway_nonce'] = wp_create_nonce( 'wpi-gateway' );
261
+function wpinv_send_to_gateway($gateway, $payment_data) {
262
+    $payment_data['gateway_nonce'] = wp_create_nonce('wpi-gateway');
263 263
 
264 264
     // $gateway must match the ID used when registering the gateway
265
-    do_action( 'wpinv_gateway_' . $gateway, $payment_data );
265
+    do_action('wpinv_gateway_' . $gateway, $payment_data);
266 266
 }
267 267
 
268 268
 function wpinv_show_gateways() {
269 269
     $gateways = wpinv_get_enabled_payment_gateways();
270 270
     $show_gateways = false;
271 271
 
272
-    $chosen_gateway = isset( $_GET['payment-mode'] ) ? preg_replace('/[^a-zA-Z0-9-_]+/', '', $_GET['payment-mode'] ) : false;
272
+    $chosen_gateway = isset($_GET['payment-mode']) ? preg_replace('/[^a-zA-Z0-9-_]+/', '', $_GET['payment-mode']) : false;
273 273
 
274
-    if ( count( $gateways ) > 1 && empty( $chosen_gateway ) ) {
274
+    if (count($gateways) > 1 && empty($chosen_gateway)) {
275 275
         $show_gateways = true;
276
-        if ( wpinv_get_cart_total() <= 0 ) {
276
+        if (wpinv_get_cart_total() <= 0) {
277 277
             $show_gateways = false;
278 278
         }
279 279
     }
280 280
     
281
-    if ( !$show_gateways && wpinv_cart_has_recurring_item() ) {
281
+    if (!$show_gateways && wpinv_cart_has_recurring_item()) {
282 282
         $show_gateways = true;
283 283
     }
284 284
 
285
-    return apply_filters( 'wpinv_show_gateways', $show_gateways );
285
+    return apply_filters('wpinv_show_gateways', $show_gateways);
286 286
 }
287 287
 
288
-function wpinv_get_chosen_gateway( $invoice_id = 0 ) {
289
-	$gateways = array_keys( wpinv_get_enabled_payment_gateways() );
288
+function wpinv_get_chosen_gateway($invoice_id = 0) {
289
+	$gateways = array_keys(wpinv_get_enabled_payment_gateways());
290 290
 
291 291
     $chosen = false;
292
-    if ( $invoice_id > 0 && $invoice = wpinv_get_invoice( $invoice_id ) ) {
292
+    if ($invoice_id > 0 && $invoice = wpinv_get_invoice($invoice_id)) {
293 293
         $chosen = $invoice->get_gateway();
294 294
     }
295 295
 
296
-	$chosen   = isset( $_REQUEST['payment-mode'] ) ? sanitize_text_field( $_REQUEST['payment-mode'] ) : $chosen;
296
+	$chosen = isset($_REQUEST['payment-mode']) ? sanitize_text_field($_REQUEST['payment-mode']) : $chosen;
297 297
 
298
-	if ( false !== $chosen ) {
299
-		$chosen = preg_replace('/[^a-zA-Z0-9-_]+/', '', $chosen );
298
+	if (false !== $chosen) {
299
+		$chosen = preg_replace('/[^a-zA-Z0-9-_]+/', '', $chosen);
300 300
 	}
301 301
 
302
-	if ( ! empty ( $chosen ) ) {
303
-		$enabled_gateway = urldecode( $chosen );
304
-	} else if (  !empty( $invoice ) && (float)$invoice->get_subtotal() <= 0 ) {
302
+	if (!empty ($chosen)) {
303
+		$enabled_gateway = urldecode($chosen);
304
+	} else if (!empty($invoice) && (float) $invoice->get_subtotal() <= 0) {
305 305
 		$enabled_gateway = 'manual';
306 306
 	} else {
307 307
 		$enabled_gateway = wpinv_get_default_gateway();
308 308
 	}
309 309
     
310
-    if ( !wpinv_is_gateway_active( $enabled_gateway ) && !empty( $gateways ) ) {
311
-        if(wpinv_is_gateway_active( wpinv_get_default_gateway()) ){
310
+    if (!wpinv_is_gateway_active($enabled_gateway) && !empty($gateways)) {
311
+        if (wpinv_is_gateway_active(wpinv_get_default_gateway())) {
312 312
             $enabled_gateway = wpinv_get_default_gateway();
313
-        }else{
313
+        } else {
314 314
             $enabled_gateway = $gateways[0];
315 315
         }
316 316
 
317 317
     }
318 318
 
319
-	return apply_filters( 'wpinv_chosen_gateway', $enabled_gateway );
319
+	return apply_filters('wpinv_chosen_gateway', $enabled_gateway);
320 320
 }
321 321
 
322
-function wpinv_record_gateway_error( $title = '', $message = '', $parent = 0 ) {
323
-    return wpinv_error_log( $message, $title );
322
+function wpinv_record_gateway_error($title = '', $message = '', $parent = 0) {
323
+    return wpinv_error_log($message, $title);
324 324
 }
325 325
 
326
-function wpinv_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) {
326
+function wpinv_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') {
327 327
 	$ret  = 0;
328 328
 	$args = array(
329 329
 		'meta_key'    => '_wpinv_gateway',
@@ -334,48 +334,48 @@  discard block
 block discarded – undo
334 334
 		'fields'      => 'ids'
335 335
 	);
336 336
 
337
-	$payments = new WP_Query( $args );
337
+	$payments = new WP_Query($args);
338 338
 
339
-	if( $payments )
339
+	if ($payments)
340 340
 		$ret = $payments->post_count;
341 341
 	return $ret;
342 342
 }
343 343
 
344
-function wpinv_settings_update_gateways( $input ) {
344
+function wpinv_settings_update_gateways($input) {
345 345
     global $wpinv_options;
346 346
     
347
-    if ( !empty( $input['save_gateway'] ) ) {
348
-        $gateways = wpinv_get_option( 'gateways', false );
347
+    if (!empty($input['save_gateway'])) {
348
+        $gateways = wpinv_get_option('gateways', false);
349 349
         $gateways = !empty($gateways) ? $gateways : array();
350 350
         $gateway = $input['save_gateway'];
351 351
         
352
-        if ( !empty( $input[$gateway . '_active'] ) ) {
352
+        if (!empty($input[$gateway . '_active'])) {
353 353
             $gateways[$gateway] = 1;
354 354
         } else {
355
-            if ( isset( $gateways[$gateway] ) ) {
356
-                unset( $gateways[$gateway] );
355
+            if (isset($gateways[$gateway])) {
356
+                unset($gateways[$gateway]);
357 357
             }
358 358
         }
359 359
         
360 360
         $input['gateways'] = $gateways;
361 361
     }
362 362
     
363
-    if ( !empty( $input['default_gateway'] ) ) {
363
+    if (!empty($input['default_gateway'])) {
364 364
         $gateways = wpinv_get_payment_gateways();
365 365
         
366
-        foreach ( $gateways as $key => $gateway ) {
367
-            $active   = 0;
368
-            if ( !empty( $input['gateways'] ) && !empty( $input['gateways'][$key] ) ) {
366
+        foreach ($gateways as $key => $gateway) {
367
+            $active = 0;
368
+            if (!empty($input['gateways']) && !empty($input['gateways'][$key])) {
369 369
                 $active = 1;
370 370
             }
371 371
             
372 372
             $input[$key . '_active'] = $active;
373 373
             
374
-            if ( empty( $wpinv_options[$key . '_title'] ) ) {
374
+            if (empty($wpinv_options[$key . '_title'])) {
375 375
                 $input[$key . '_title'] = $gateway['checkout_label'];
376 376
             }
377 377
             
378
-            if ( !isset( $wpinv_options[$key . '_ordering'] ) && isset( $gateway['ordering'] ) ) {
378
+            if (!isset($wpinv_options[$key . '_ordering']) && isset($gateway['ordering'])) {
379 379
                 $input[$key . '_ordering'] = $gateway['ordering'];
380 380
             }
381 381
         }
@@ -383,27 +383,27 @@  discard block
 block discarded – undo
383 383
     
384 384
     return $input;
385 385
 }
386
-add_filter( 'wpinv_settings_tab_gateways_sanitize', 'wpinv_settings_update_gateways', 10, 1 );
386
+add_filter('wpinv_settings_tab_gateways_sanitize', 'wpinv_settings_update_gateways', 10, 1);
387 387
 
388 388
 // PayPal Standard settings
389
-function wpinv_gateway_settings_paypal( $setting ) {    
390
-    $setting['paypal_active']['desc'] = $setting['paypal_active']['desc'] . ' ' . __( '( Supported Currencies: AUD, BRL, CAD, CZK, DKK, EUR, HKD, HUF, ILS, JPY, MYR, MXN, NOK, NZD, PHP, PLN, GBP, SGD, SEK, CHF, TWD, THB, USD )', 'invoicing' );
391
-    $setting['paypal_desc']['std'] = __( 'Pay via PayPal: you can pay with your credit card if you don\'t have a PayPal account.', 'invoicing' );
389
+function wpinv_gateway_settings_paypal($setting) {    
390
+    $setting['paypal_active']['desc'] = $setting['paypal_active']['desc'] . ' ' . __('( Supported Currencies: AUD, BRL, CAD, CZK, DKK, EUR, HKD, HUF, ILS, JPY, MYR, MXN, NOK, NZD, PHP, PLN, GBP, SGD, SEK, CHF, TWD, THB, USD )', 'invoicing');
391
+    $setting['paypal_desc']['std'] = __('Pay via PayPal: you can pay with your credit card if you don\'t have a PayPal account.', 'invoicing');
392 392
     
393 393
     $setting['paypal_sandbox'] = array(
394 394
             'type' => 'checkbox',
395 395
             'id'   => 'paypal_sandbox',
396
-            'name' => __( 'PayPal Sandbox', 'invoicing' ),
397
-            'desc' => __( 'PayPal sandbox can be used to test payments.', 'invoicing' ),
396
+            'name' => __('PayPal Sandbox', 'invoicing'),
397
+            'desc' => __('PayPal sandbox can be used to test payments.', 'invoicing'),
398 398
             'std'  => 1
399 399
         );
400 400
         
401 401
     $setting['paypal_email'] = array(
402 402
             'type' => 'text',
403 403
             'id'   => 'paypal_email',
404
-            'name' => __( 'PayPal Email', 'invoicing' ),
405
-            'desc' => __( 'Please enter your PayPal account\'s email address. Ex: [email protected]', 'invoicing' ),
406
-            'std' => __( '[email protected]', 'invoicing' ),
404
+            'name' => __('PayPal Email', 'invoicing'),
405
+            'desc' => __('Please enter your PayPal account\'s email address. Ex: [email protected]', 'invoicing'),
406
+            'std' => __('[email protected]', 'invoicing'),
407 407
         );
408 408
     /*
409 409
     $setting['paypal_ipn_url'] = array(
@@ -417,139 +417,139 @@  discard block
 block discarded – undo
417 417
         
418 418
     return $setting;
419 419
 }
420
-add_filter( 'wpinv_gateway_settings_paypal', 'wpinv_gateway_settings_paypal', 10, 1 );
420
+add_filter('wpinv_gateway_settings_paypal', 'wpinv_gateway_settings_paypal', 10, 1);
421 421
 
422 422
 // Pre Bank Transfer settings
423
-function wpinv_gateway_settings_bank_transfer( $setting ) {
424
-    $setting['bank_transfer_desc']['std'] = __( 'Make your payment directly into our bank account. Please use your Invoice ID as the payment reference. Your invoice won\'t be processed until the funds have cleared in our account.', 'invoicing' );
423
+function wpinv_gateway_settings_bank_transfer($setting) {
424
+    $setting['bank_transfer_desc']['std'] = __('Make your payment directly into our bank account. Please use your Invoice ID as the payment reference. Your invoice won\'t be processed until the funds have cleared in our account.', 'invoicing');
425 425
     
426 426
     $setting['bank_transfer_ac_name'] = array(
427 427
             'type' => 'text',
428 428
             'id' => 'bank_transfer_ac_name',
429
-            'name' => __( 'Account Name', 'invoicing' ),
430
-            'desc' => __( 'Enter the bank account name to which you want to transfer payment.', 'invoicing' ),
431
-            'std'  =>  __( 'Mr. John Martin', 'invoicing' ),
429
+            'name' => __('Account Name', 'invoicing'),
430
+            'desc' => __('Enter the bank account name to which you want to transfer payment.', 'invoicing'),
431
+            'std'  =>  __('Mr. John Martin', 'invoicing'),
432 432
         );
433 433
     
434 434
     $setting['bank_transfer_ac_no'] = array(
435 435
             'type' => 'text',
436 436
             'id' => 'bank_transfer_ac_no',
437
-            'name' => __( 'Account Number', 'invoicing' ),
438
-            'desc' => __( 'Enter your bank account number.', 'invoicing' ),
439
-            'std'  =>  __( 'TEST1234567890', 'invoicing' ),
437
+            'name' => __('Account Number', 'invoicing'),
438
+            'desc' => __('Enter your bank account number.', 'invoicing'),
439
+            'std'  =>  __('TEST1234567890', 'invoicing'),
440 440
         );
441 441
     
442 442
     $setting['bank_transfer_bank_name'] = array(
443 443
             'type' => 'text',
444 444
             'id'   => 'bank_transfer_bank_name',
445
-            'name' => __( 'Bank Name', 'invoicing' ),
446
-            'desc' => __( 'Enter the bank name to which you want to transfer payment.', 'invoicing' ),
447
-            'std' => __( 'ICICI Bank', 'invoicing' ),
445
+            'name' => __('Bank Name', 'invoicing'),
446
+            'desc' => __('Enter the bank name to which you want to transfer payment.', 'invoicing'),
447
+            'std' => __('ICICI Bank', 'invoicing'),
448 448
         );
449 449
     
450 450
     $setting['bank_transfer_ifsc'] = array(
451 451
             'type' => 'text',
452 452
             'id'   => 'bank_transfer_ifsc',
453
-            'name' => __( 'IFSC Code', 'invoicing' ),
454
-            'desc' => __( 'Enter your bank IFSC code.', 'invoicing' ),
455
-            'std'  =>  __( 'ICIC0001234', 'invoicing' ),
453
+            'name' => __('IFSC Code', 'invoicing'),
454
+            'desc' => __('Enter your bank IFSC code.', 'invoicing'),
455
+            'std'  =>  __('ICIC0001234', 'invoicing'),
456 456
         );
457 457
         
458 458
     $setting['bank_transfer_iban'] = array(
459 459
             'type' => 'text',
460 460
             'id'   => 'bank_transfer_iban',
461
-            'name' => __( 'IBAN', 'invoicing' ),
462
-            'desc' => __( 'Enter your International Bank Account Number(IBAN).', 'invoicing' ),
463
-            'std'  =>  __( 'GB29NWBK60161331926819', 'invoicing' ),
461
+            'name' => __('IBAN', 'invoicing'),
462
+            'desc' => __('Enter your International Bank Account Number(IBAN).', 'invoicing'),
463
+            'std'  =>  __('GB29NWBK60161331926819', 'invoicing'),
464 464
         );
465 465
         
466 466
     $setting['bank_transfer_bic'] = array(
467 467
             'type' => 'text',
468 468
             'id'   => 'bank_transfer_bic',
469
-            'name' => __( 'BIC/Swift Code', 'invoicing' ),
470
-            'std'  =>  __( 'ICICGB2L129', 'invoicing' ),
469
+            'name' => __('BIC/Swift Code', 'invoicing'),
470
+            'std'  =>  __('ICICGB2L129', 'invoicing'),
471 471
         );
472 472
 
473 473
     $setting['bank_transfer_sort_code'] = array(
474 474
         'type' => 'text',
475 475
         'id'   => 'bank_transfer_sort_code',
476
-        'name' => __( 'Sort Code', 'invoicing' ),
477
-        'std'  =>  __( '12-34-56', 'invoicing' ),
476
+        'name' => __('Sort Code', 'invoicing'),
477
+        'std'  =>  __('12-34-56', 'invoicing'),
478 478
     );
479 479
         
480 480
     $setting['bank_transfer_info'] = array(
481 481
             'id'   => 'bank_transfer_info',
482
-            'name' => __( 'Instructions', 'invoicing' ),
483
-            'desc' => __( 'Instructions that will be added to the thank you page and emails.', 'invoicing' ),
482
+            'name' => __('Instructions', 'invoicing'),
483
+            'desc' => __('Instructions that will be added to the thank you page and emails.', 'invoicing'),
484 484
             'type' => 'textarea',
485
-            'std' => __( 'Make your payment directly into our bank account. Please use your Invoice ID as the payment reference. Your invoice won\'t be processed until the funds have cleared in our account.', 'invoicing' ),
485
+            'std' => __('Make your payment directly into our bank account. Please use your Invoice ID as the payment reference. Your invoice won\'t be processed until the funds have cleared in our account.', 'invoicing'),
486 486
             'cols' => 37,
487 487
             'rows' => 5
488 488
         );
489 489
         
490 490
     return $setting;
491 491
 }
492
-add_filter( 'wpinv_gateway_settings_bank_transfer', 'wpinv_gateway_settings_bank_transfer', 10, 1 );
492
+add_filter('wpinv_gateway_settings_bank_transfer', 'wpinv_gateway_settings_bank_transfer', 10, 1);
493 493
 
494 494
 // Authorize.Net settings
495
-function wpinv_gateway_settings_authorizenet( $setting ) {
496
-    $setting['authorizenet_active']['desc'] = $setting['authorizenet_active']['desc'] . ' ' . __( '( Supported Currencies: AUD, CAD, CHF, DKK, EUR, GBP, JPY, NOK, NZD, PLN, SEK, USD, ZAR )', 'invoicing' );
497
-    $setting['authorizenet_desc']['std'] = __( 'Pay using a Authorize.Net to process Credit card / Debit card transactions.', 'invoicing' );
495
+function wpinv_gateway_settings_authorizenet($setting) {
496
+    $setting['authorizenet_active']['desc'] = $setting['authorizenet_active']['desc'] . ' ' . __('( Supported Currencies: AUD, CAD, CHF, DKK, EUR, GBP, JPY, NOK, NZD, PLN, SEK, USD, ZAR )', 'invoicing');
497
+    $setting['authorizenet_desc']['std'] = __('Pay using a Authorize.Net to process Credit card / Debit card transactions.', 'invoicing');
498 498
     
499 499
     $setting['authorizenet_sandbox'] = array(
500 500
             'type' => 'checkbox',
501 501
             'id'   => 'authorizenet_sandbox',
502
-            'name' => __( 'Authorize.Net Test Mode', 'invoicing' ),
503
-            'desc' => __( 'Enable Authorize.Net test mode to test payments.', 'invoicing' ),
502
+            'name' => __('Authorize.Net Test Mode', 'invoicing'),
503
+            'desc' => __('Enable Authorize.Net test mode to test payments.', 'invoicing'),
504 504
             'std'  => 1
505 505
         );
506 506
         
507 507
     $setting['authorizenet_login_id'] = array(
508 508
             'type' => 'text',
509 509
             'id'   => 'authorizenet_login_id',
510
-            'name' => __( 'API Login ID', 'invoicing' ),
511
-            'desc' => __( 'API Login ID can be obtained from Authorize.Net Account > Settings > Security Settings > General Security Settings > API Credentials & Keys. Example : 2j4rBekUnD', 'invoicing' ),
510
+            'name' => __('API Login ID', 'invoicing'),
511
+            'desc' => __('API Login ID can be obtained from Authorize.Net Account > Settings > Security Settings > General Security Settings > API Credentials & Keys. Example : 2j4rBekUnD', 'invoicing'),
512 512
             'std' => '2j4rBekUnD',
513 513
         );
514 514
     
515 515
     $setting['authorizenet_transaction_key'] = array(
516 516
             'type' => 'text',
517 517
             'id'   => 'authorizenet_transaction_key',
518
-            'name' => __( 'Transaction Key', 'invoicing' ),
519
-            'desc' => __( 'Transaction Key can be obtained from Authorize.Net Account > Settings > Security Settings > General Security Settings > API Credentials & Keys. Example : 4vyBUOJgR74679xa', 'invoicing' ),
518
+            'name' => __('Transaction Key', 'invoicing'),
519
+            'desc' => __('Transaction Key can be obtained from Authorize.Net Account > Settings > Security Settings > General Security Settings > API Credentials & Keys. Example : 4vyBUOJgR74679xa', 'invoicing'),
520 520
             'std' => '4vyBUOJgR74679xa',
521 521
         );
522 522
         
523 523
     $setting['authorizenet_md5_hash'] = array(
524 524
             'type' => 'text',
525 525
             'id'   => 'authorizenet_md5_hash',
526
-            'name' => __( 'MD5-Hash', 'invoicing' ),
527
-            'desc' => __( 'The MD5 Hash security feature allows to authenticate transaction responses from the Authorize.Net for recurring payments. It can be obtained from Authorize.Net Account > Settings > Security Settings > General Settings > MD5 Hash.', 'invoicing' ),
526
+            'name' => __('MD5-Hash', 'invoicing'),
527
+            'desc' => __('The MD5 Hash security feature allows to authenticate transaction responses from the Authorize.Net for recurring payments. It can be obtained from Authorize.Net Account > Settings > Security Settings > General Settings > MD5 Hash.', 'invoicing'),
528 528
             'std' => '',
529 529
         );
530 530
 
531 531
     $setting['authorizenet_transaction_type'] = array(
532 532
         'id'          => 'authorizenet_transaction_type',
533
-        'name'        => __( 'Transaction Type', 'invoicing' ),
534
-        'desc'        => __( 'Choose transaction type.', 'invoicing' ),
533
+        'name'        => __('Transaction Type', 'invoicing'),
534
+        'desc'        => __('Choose transaction type.', 'invoicing'),
535 535
         'type'        => 'select',
536 536
         'class'       => 'wpi_select2',
537 537
         'options'     => array(
538
-            'authorize_capture' => __( 'Authorize And Capture', 'invoicing' ),
539
-            'authorize_only' => __( 'Authorize Only', 'invoicing' ),
538
+            'authorize_capture' => __('Authorize And Capture', 'invoicing'),
539
+            'authorize_only' => __('Authorize Only', 'invoicing'),
540 540
         ),
541 541
         'std'         => 'authorize_capture'
542 542
     );
543 543
 
544 544
     $setting['authorizenet_transaction_type_recurring'] = array(
545 545
         'id'          => 'authorizenet_transaction_type_recurring',
546
-        'name'        => __( 'Transaction Type for Recurring', 'invoicing' ),
547
-        'desc'        => __( 'Choose transaction type for recurring payments.', 'invoicing' ),
546
+        'name'        => __('Transaction Type for Recurring', 'invoicing'),
547
+        'desc'        => __('Choose transaction type for recurring payments.', 'invoicing'),
548 548
         'type'        => 'select',
549 549
         'class'       => 'wpi_select2',
550 550
         'options'     => array(
551
-            'authorize_capture' => __( 'Authorize And Capture', 'invoicing' ),
552
-            'authorize_only' => __( 'Authorize Only', 'invoicing' ),
551
+            'authorize_capture' => __('Authorize And Capture', 'invoicing'),
552
+            'authorize_only' => __('Authorize Only', 'invoicing'),
553 553
         ),
554 554
         'std'         => 'authorize_only'
555 555
     );
@@ -557,9 +557,9 @@  discard block
 block discarded – undo
557 557
     $setting['authorizenet_ipn_url'] = array(
558 558
             'type' => 'ipn_url',
559 559
             'id'   => 'authorizenet_ipn_url',
560
-            'name' => __( 'Silent Post URL', 'invoicing' ),
561
-            'std' => wpinv_get_ipn_url( 'authorizenet' ),
562
-            'desc' => __( 'If you are accepting recurring payments then you must set this url at Authorize.Net Account > Settings > Transaction Format Settings > Transaction Response Settings > Silent Post URL.', 'invoicing' ),
560
+            'name' => __('Silent Post URL', 'invoicing'),
561
+            'std' => wpinv_get_ipn_url('authorizenet'),
562
+            'desc' => __('If you are accepting recurring payments then you must set this url at Authorize.Net Account > Settings > Transaction Format Settings > Transaction Response Settings > Silent Post URL.', 'invoicing'),
563 563
             'size' => 'large',
564 564
             'custom' => 'authorizenet',
565 565
             'readonly' => true
@@ -567,26 +567,26 @@  discard block
 block discarded – undo
567 567
         
568 568
     return $setting;
569 569
 }
570
-add_filter( 'wpinv_gateway_settings_authorizenet', 'wpinv_gateway_settings_authorizenet', 10, 1 );
570
+add_filter('wpinv_gateway_settings_authorizenet', 'wpinv_gateway_settings_authorizenet', 10, 1);
571 571
 
572 572
 // Worldpay settings
573
-function wpinv_gateway_settings_worldpay( $setting ) {
574
-    $setting['worldpay_active']['desc'] = $setting['worldpay_active']['desc'] . ' ' . __( '( Supported Currencies: AUD, ARS, CAD, CHF, DKK, EUR, HKD, MYR, GBP, NZD, NOK, SGD, LKR, SEK, TRY, USD, ZAR )', 'invoicing' );
575
-    $setting['worldpay_desc']['std'] = __( 'Pay using a Worldpay account to process Credit card / Debit card transactions.', 'invoicing' );
573
+function wpinv_gateway_settings_worldpay($setting) {
574
+    $setting['worldpay_active']['desc'] = $setting['worldpay_active']['desc'] . ' ' . __('( Supported Currencies: AUD, ARS, CAD, CHF, DKK, EUR, HKD, MYR, GBP, NZD, NOK, SGD, LKR, SEK, TRY, USD, ZAR )', 'invoicing');
575
+    $setting['worldpay_desc']['std'] = __('Pay using a Worldpay account to process Credit card / Debit card transactions.', 'invoicing');
576 576
     
577 577
     $setting['worldpay_sandbox'] = array(
578 578
             'type' => 'checkbox',
579 579
             'id'   => 'worldpay_sandbox',
580
-            'name' => __( 'Worldpay Test Mode', 'invoicing' ),
581
-            'desc' => __( 'This provides a special Test Environment to enable you to test your installation and integration to your website before going live.', 'invoicing' ),
580
+            'name' => __('Worldpay Test Mode', 'invoicing'),
581
+            'desc' => __('This provides a special Test Environment to enable you to test your installation and integration to your website before going live.', 'invoicing'),
582 582
             'std'  => 1
583 583
         );
584 584
         
585 585
     $setting['worldpay_instId'] = array(
586 586
             'type' => 'text',
587 587
             'id'   => 'worldpay_instId',
588
-            'name' => __( 'Installation Id', 'invoicing' ),
589
-            'desc' => __( 'Your installation id. Ex: 211616', 'invoicing' ),
588
+            'name' => __('Installation Id', 'invoicing'),
589
+            'desc' => __('Your installation id. Ex: 211616', 'invoicing'),
590 590
             'std' => '211616',
591 591
         );
592 592
     /*
@@ -602,9 +602,9 @@  discard block
 block discarded – undo
602 602
     $setting['worldpay_ipn_url'] = array(
603 603
             'type' => 'ipn_url',
604 604
             'id'   => 'worldpay_ipn_url',
605
-            'name' => __( 'Worldpay Callback Url', 'invoicing' ),
606
-            'std' => wpinv_get_ipn_url( 'worldpay' ),
607
-            'desc' => wp_sprintf( __( 'Login to your Worldpay Merchant Interface then enable Payment Response & Shopper Response. Next, go to the Payment Response URL field and type "%s" or "%s" for a dynamic payment response.', 'invoicing' ), '<font style="color:#000;font-style:normal">' . wpinv_get_ipn_url( 'worldpay' ) . '</font>', '<font style="color:#000;font-style:normal">&lt;wpdisplay item=MC_callback&gt;</font>' ),
605
+            'name' => __('Worldpay Callback Url', 'invoicing'),
606
+            'std' => wpinv_get_ipn_url('worldpay'),
607
+            'desc' => wp_sprintf(__('Login to your Worldpay Merchant Interface then enable Payment Response & Shopper Response. Next, go to the Payment Response URL field and type "%s" or "%s" for a dynamic payment response.', 'invoicing'), '<font style="color:#000;font-style:normal">' . wpinv_get_ipn_url('worldpay') . '</font>', '<font style="color:#000;font-style:normal">&lt;wpdisplay item=MC_callback&gt;</font>'),
608 608
             'size' => 'large',
609 609
             'custom' => 'worldpay',
610 610
             'readonly' => true
@@ -612,99 +612,99 @@  discard block
 block discarded – undo
612 612
         
613 613
     return $setting;
614 614
 }
615
-add_filter( 'wpinv_gateway_settings_worldpay', 'wpinv_gateway_settings_worldpay', 10, 1 );
615
+add_filter('wpinv_gateway_settings_worldpay', 'wpinv_gateway_settings_worldpay', 10, 1);
616 616
 
617
-function wpinv_ipn_url_callback( $args ) {    
618
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
617
+function wpinv_ipn_url_callback($args) {    
618
+    $sanitize_id = wpinv_sanitize_key($args['id']);
619 619
     
620 620
     $attrs = $args['readonly'] ? ' readonly' : '';
621 621
 
622
-    $html = '<input style="background-color:#fefefe" type="text" ' . $attrs . ' value="' . esc_attr( $args['std'] ) . '" name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . ']" class="large-text">';
623
-    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']">'  . $args['desc'] . '</label>';
622
+    $html = '<input style="background-color:#fefefe" type="text" ' . $attrs . ' value="' . esc_attr($args['std']) . '" name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . ']" class="large-text">';
623
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']">' . $args['desc'] . '</label>';
624 624
 
625 625
     echo $html;
626 626
 }
627 627
 
628
-function wpinv_is_test_mode( $gateway = '' ) {
629
-    if ( empty( $gateway ) ) {
628
+function wpinv_is_test_mode($gateway = '') {
629
+    if (empty($gateway)) {
630 630
         return false;
631 631
     }
632 632
     
633
-    $is_test_mode = wpinv_get_option( $gateway . '_sandbox', false );
633
+    $is_test_mode = wpinv_get_option($gateway . '_sandbox', false);
634 634
     
635
-    return apply_filters( 'wpinv_is_test_mode', $is_test_mode, $gateway );
635
+    return apply_filters('wpinv_is_test_mode', $is_test_mode, $gateway);
636 636
 }
637 637
 
638
-function wpinv_get_ipn_url( $gateway = '', $args = array() ) {
639
-    $data = array( 'wpi-listener' => 'IPN' );
638
+function wpinv_get_ipn_url($gateway = '', $args = array()) {
639
+    $data = array('wpi-listener' => 'IPN');
640 640
     
641
-    if ( !empty( $gateway ) ) {
642
-        $data['wpi-gateway'] = wpinv_sanitize_key( $gateway );
641
+    if (!empty($gateway)) {
642
+        $data['wpi-gateway'] = wpinv_sanitize_key($gateway);
643 643
     }
644 644
     
645
-    $args = !empty( $args ) && is_array( $args ) ? array_merge( $data, $args ) : $data;
645
+    $args = !empty($args) && is_array($args) ? array_merge($data, $args) : $data;
646 646
     
647
-    $ipn_url = add_query_arg( $args,  home_url( 'index.php' ) );
647
+    $ipn_url = add_query_arg($args, home_url('index.php'));
648 648
     
649
-    return apply_filters( 'wpinv_ipn_url', $ipn_url );
649
+    return apply_filters('wpinv_ipn_url', $ipn_url);
650 650
 }
651 651
 
652 652
 function wpinv_listen_for_payment_ipn() {
653 653
     // Regular PayPal IPN
654
-    if ( isset( $_GET['wpi-listener'] ) && $_GET['wpi-listener'] == 'IPN' ) {
655
-        do_action( 'wpinv_verify_payment_ipn' );
654
+    if (isset($_GET['wpi-listener']) && $_GET['wpi-listener'] == 'IPN') {
655
+        do_action('wpinv_verify_payment_ipn');
656 656
         
657
-        if ( !empty( $_GET['wpi-gateway'] ) ) {
658
-            wpinv_error_log( sanitize_text_field( $_GET['wpi-gateway'] ), 'WP Invoicing IPN', __FILE__, __LINE__ );
659
-            do_action( 'wpinv_verify_' . sanitize_text_field( $_GET['wpi-gateway'] ) . '_ipn' );
657
+        if (!empty($_GET['wpi-gateway'])) {
658
+            wpinv_error_log(sanitize_text_field($_GET['wpi-gateway']), 'WP Invoicing IPN', __FILE__, __LINE__);
659
+            do_action('wpinv_verify_' . sanitize_text_field($_GET['wpi-gateway']) . '_ipn');
660 660
         }
661 661
     }
662 662
 }
663
-add_action( 'init', 'wpinv_listen_for_payment_ipn' );
663
+add_action('init', 'wpinv_listen_for_payment_ipn');
664 664
 
665 665
 function wpinv_get_bank_instructions() {
666
-    $bank_instructions = wpinv_get_option( 'bank_transfer_info' );
666
+    $bank_instructions = wpinv_get_option('bank_transfer_info');
667 667
     
668
-    return apply_filters( 'wpinv_bank_instructions', $bank_instructions );
668
+    return apply_filters('wpinv_bank_instructions', $bank_instructions);
669 669
 }
670 670
 
671
-function wpinv_get_bank_info( $filtered = false ) {
671
+function wpinv_get_bank_info($filtered = false) {
672 672
     $bank_fields = array(
673
-        'bank_transfer_ac_name'     => __( 'Account Name', 'invoicing' ),
674
-        'bank_transfer_ac_no'       => __( 'Account Number', 'invoicing' ),
675
-        'bank_transfer_bank_name'   => __( 'Bank Name', 'invoicing' ),
676
-        'bank_transfer_ifsc'        => __( 'IFSC code', 'invoicing' ),
677
-        'bank_transfer_iban'        => __( 'IBAN', 'invoicing' ),
678
-        'bank_transfer_bic'         => __( 'BIC/Swift code', 'invoicing' ),
679
-        'bank_transfer_sort_code'   => __( 'Sort Code', 'invoicing' )
673
+        'bank_transfer_ac_name'     => __('Account Name', 'invoicing'),
674
+        'bank_transfer_ac_no'       => __('Account Number', 'invoicing'),
675
+        'bank_transfer_bank_name'   => __('Bank Name', 'invoicing'),
676
+        'bank_transfer_ifsc'        => __('IFSC code', 'invoicing'),
677
+        'bank_transfer_iban'        => __('IBAN', 'invoicing'),
678
+        'bank_transfer_bic'         => __('BIC/Swift code', 'invoicing'),
679
+        'bank_transfer_sort_code'   => __('Sort Code', 'invoicing')
680 680
     );
681 681
     
682 682
     $bank_info = array();
683
-    foreach ( $bank_fields as $field => $label ) {
684
-        if ( $filtered && !( $value = wpinv_get_option( $field ) ) ) {
683
+    foreach ($bank_fields as $field => $label) {
684
+        if ($filtered && !($value = wpinv_get_option($field))) {
685 685
             continue;
686 686
         }
687 687
         
688
-        $bank_info[$field] = array( 'label' => $label, 'value' => $value );
688
+        $bank_info[$field] = array('label' => $label, 'value' => $value);
689 689
     }
690 690
     
691
-    return apply_filters( 'wpinv_bank_info', $bank_info, $filtered );
691
+    return apply_filters('wpinv_bank_info', $bank_info, $filtered);
692 692
 }
693 693
 
694
-function wpinv_get_post_data( $method = 'request' ) {
694
+function wpinv_get_post_data($method = 'request') {
695 695
     $data       = array();
696 696
     $request    = $_REQUEST;
697 697
     
698
-    if ( $method == 'post' ) {
699
-        if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'POST' ) {
698
+    if ($method == 'post') {
699
+        if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') {
700 700
             return $data;
701 701
         }
702 702
         
703 703
         $request = $_POST;
704 704
     }
705 705
     
706
-    if ( $method == 'get' ) {
707
-        if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'GET' ) {
706
+    if ($method == 'get') {
707
+        if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'GET') {
708 708
             return $data;
709 709
         }
710 710
         
@@ -715,11 +715,11 @@  discard block
 block discarded – undo
715 715
     $post_data = '';
716 716
     
717 717
     // Fallback just in case post_max_size is lower than needed
718
-    if ( ini_get( 'allow_url_fopen' ) ) {
719
-        $post_data = file_get_contents( 'php://input' );
718
+    if (ini_get('allow_url_fopen')) {
719
+        $post_data = file_get_contents('php://input');
720 720
     } else {
721 721
         // If allow_url_fopen is not enabled, then make sure that post_max_size is large enough
722
-        ini_set( 'post_max_size', '12M' );
722
+        ini_set('post_max_size', '12M');
723 723
     }
724 724
     // Start the encoded data collection with notification command
725 725
     $encoded_data = 'cmd=_notify-validate';
@@ -728,33 +728,33 @@  discard block
 block discarded – undo
728 728
     $arg_separator = wpinv_get_php_arg_separator_output();
729 729
 
730 730
     // Verify there is a post_data
731
-    if ( $post_data || strlen( $post_data ) > 0 ) {
731
+    if ($post_data || strlen($post_data) > 0) {
732 732
         // Append the data
733 733
         $encoded_data .= $arg_separator . $post_data;
734 734
     } else {
735 735
         // Check if POST is empty
736
-        if ( empty( $request ) ) {
736
+        if (empty($request)) {
737 737
             // Nothing to do
738 738
             return;
739 739
         } else {
740 740
             // Loop through each POST
741
-            foreach ( $request as $key => $value ) {
741
+            foreach ($request as $key => $value) {
742 742
                 // Encode the value and append the data
743
-                $encoded_data .= $arg_separator . "$key=" . urlencode( $value );
743
+                $encoded_data .= $arg_separator . "$key=" . urlencode($value);
744 744
             }
745 745
         }
746 746
     }
747 747
 
748 748
     // Convert collected post data to an array
749
-    wp_parse_str( $encoded_data, $data );
749
+    wp_parse_str($encoded_data, $data);
750 750
 
751
-    foreach ( $data as $key => $value ) {
752
-        if ( false !== strpos( $key, 'amp;' ) ) {
753
-            $new_key = str_replace( '&amp;', '&', $key );
754
-            $new_key = str_replace( 'amp;', '&' , $new_key );
751
+    foreach ($data as $key => $value) {
752
+        if (false !== strpos($key, 'amp;')) {
753
+            $new_key = str_replace('&amp;', '&', $key);
754
+            $new_key = str_replace('amp;', '&', $new_key);
755 755
 
756
-            unset( $data[ $key ] );
757
-            $data[ $new_key ] = sanitize_text_field( $value );
756
+            unset($data[$key]);
757
+            $data[$new_key] = sanitize_text_field($value);
758 758
         }
759 759
     }
760 760
     
@@ -764,12 +764,12 @@  discard block
 block discarded – undo
764 764
 /**
765 765
  * Checks if a given gateway supports subscription payments.
766 766
  */
767
-function wpinv_gateway_support_subscription( $gateway ) {
767
+function wpinv_gateway_support_subscription($gateway) {
768 768
     $supports = false;
769 769
 
770
-    if ( wpinv_is_gateway_active( $gateway ) ) {
771
-        $supports = apply_filters( 'wpinv_' . $gateway . '_support_subscription', $supports );
772
-        $supports = apply_filters( 'getapid_gateway_supports_subscription', $supports, $gateway );
770
+    if (wpinv_is_gateway_active($gateway)) {
771
+        $supports = apply_filters('wpinv_' . $gateway . '_support_subscription', $supports);
772
+        $supports = apply_filters('getapid_gateway_supports_subscription', $supports, $gateway);
773 773
     }
774 774
 
775 775
     return $supports;
@@ -781,14 +781,14 @@  discard block
 block discarded – undo
781 781
  * @param array $gateways an array of gateways.
782 782
  * @param GetPaid_Payment_Form $form payment form.
783 783
  */
784
-function wpinv_payment_gateways_on_cart( $gateways, $form ) {
784
+function wpinv_payment_gateways_on_cart($gateways, $form) {
785 785
 
786
-    if ( $form->is_recurring() ) {
786
+    if ($form->is_recurring()) {
787 787
 
788
-        foreach ( array_keys( $gateways ) as $gateway ) {
788
+        foreach (array_keys($gateways) as $gateway) {
789 789
 
790
-            if ( ! wpinv_gateway_support_subscription( $gateway ) ) {
791
-                unset( $gateways[$gateway] );
790
+            if (!wpinv_gateway_support_subscription($gateway)) {
791
+                unset($gateways[$gateway]);
792 792
             }
793 793
 
794 794
         }
@@ -797,11 +797,11 @@  discard block
 block discarded – undo
797 797
 
798 798
     return $gateways;
799 799
 }
800
-add_filter( 'getpaid_payment_form_gateways', 'wpinv_payment_gateways_on_cart', 10, 2 );
800
+add_filter('getpaid_payment_form_gateways', 'wpinv_payment_gateways_on_cart', 10, 2);
801 801
 
802 802
 function wpinv_validate_checkout_fields() {
803 803
     // Check if there is $_POST
804
-    if ( empty( $_POST ) ) {
804
+    if (empty($_POST)) {
805 805
         return false;
806 806
     }
807 807
 
@@ -824,28 +824,28 @@  discard block
 block discarded – undo
824 824
     
825 825
     $invoice = wpinv_get_invoice_cart();
826 826
     $has_subscription = $invoice->is_recurring();
827
-    if ( empty( $invoice ) ) {
828
-        wpinv_set_error( 'invalid_invoice', __( 'Your cart is empty.', 'invoicing' ) );
827
+    if (empty($invoice)) {
828
+        wpinv_set_error('invalid_invoice', __('Your cart is empty.', 'invoicing'));
829 829
         return $gateway;
830 830
     }
831 831
 
832 832
     // Check if a gateway value is present
833
-    if ( !empty( $_REQUEST['wpi-gateway'] ) ) {
834
-        $gateway = sanitize_text_field( $_REQUEST['wpi-gateway'] );
833
+    if (!empty($_REQUEST['wpi-gateway'])) {
834
+        $gateway = sanitize_text_field($_REQUEST['wpi-gateway']);
835 835
 
836
-        if ( $invoice->is_free() ) {
836
+        if ($invoice->is_free()) {
837 837
             $gateway = 'manual';
838
-        } elseif ( !wpinv_is_gateway_active( $gateway ) ) {
839
-            wpinv_set_error( 'invalid_gateway', __( 'The selected payment gateway is not enabled', 'invoicing' ) );
840
-        } elseif ( $has_subscription && !wpinv_gateway_support_subscription( $gateway ) ) {
841
-            if ( apply_filters( 'wpinv_reject_non_recurring_gateway', true ) ) {
842
-                wpinv_set_error( 'invalid_gateway', __( 'The selected payment gateway does not support subscription payment', 'invoicing' ) );
838
+        } elseif (!wpinv_is_gateway_active($gateway)) {
839
+            wpinv_set_error('invalid_gateway', __('The selected payment gateway is not enabled', 'invoicing'));
840
+        } elseif ($has_subscription && !wpinv_gateway_support_subscription($gateway)) {
841
+            if (apply_filters('wpinv_reject_non_recurring_gateway', true)) {
842
+                wpinv_set_error('invalid_gateway', __('The selected payment gateway does not support subscription payment', 'invoicing'));
843 843
             }
844 844
         }
845 845
     }
846 846
 
847
-    if ( $has_subscription && count( wpinv_get_cart_contents() ) > 1 ) {
848
-        wpinv_set_error( 'subscription_invalid', __( 'Only one subscription may be purchased through payment per checkout.', 'invoicing' ) );
847
+    if ($has_subscription && count(wpinv_get_cart_contents()) > 1) {
848
+        wpinv_set_error('subscription_invalid', __('Only one subscription may be purchased through payment per checkout.', 'invoicing'));
849 849
     }
850 850
 
851 851
     return $gateway;
@@ -857,41 +857,41 @@  discard block
 block discarded – undo
857 857
     // Retrieve the discount stored in cookies
858 858
     $discounts = wpinv_get_cart_discounts();
859 859
 
860
-    if ( ! is_array( $discounts ) ) {
860
+    if (!is_array($discounts)) {
861 861
         return NULL;
862 862
     }
863 863
 
864
-    $discounts = array_filter( $discounts );
865
-    $error    = false;
864
+    $discounts = array_filter($discounts);
865
+    $error = false;
866 866
 
867
-    if ( empty( $discounts ) ) {
867
+    if (empty($discounts)) {
868 868
         return NULL;
869 869
     }
870 870
 
871 871
     // If we have discounts, loop through them
872
-    foreach ( $discounts as $discount ) {
872
+    foreach ($discounts as $discount) {
873 873
         // Check if valid
874
-        if (  ! wpinv_is_discount_valid( $discount, (int) $wpi_cart->get_user_id() ) ) {
874
+        if (!wpinv_is_discount_valid($discount, (int) $wpi_cart->get_user_id())) {
875 875
             // Discount is not valid
876 876
             $error = true;
877 877
         }
878 878
 
879 879
     }
880 880
 
881
-    if ( $error && ! wpinv_get_errors() ) {
882
-        wpinv_set_error( 'invalid_discount', __( 'Discount code you entered is invalid', 'invoicing' ) );
881
+    if ($error && !wpinv_get_errors()) {
882
+        wpinv_set_error('invalid_discount', __('Discount code you entered is invalid', 'invoicing'));
883 883
     }
884 884
 
885
-    return implode( ',', $discounts );
885
+    return implode(',', $discounts);
886 886
 }
887 887
 
888 888
 function wpinv_checkout_validate_cc() {
889 889
     $card_data = wpinv_checkout_get_cc_info();
890 890
 
891 891
     // Validate the card zip
892
-    if ( !empty( $card_data['wpinv_zip'] ) ) {
893
-        if ( !wpinv_checkout_validate_cc_zip( $card_data['wpinv_zip'], $card_data['wpinv_country'] ) ) {
894
-            wpinv_set_error( 'invalid_cc_zip', __( 'The zip / postcode you entered for your billing address is invalid', 'invoicing' ) );
892
+    if (!empty($card_data['wpinv_zip'])) {
893
+        if (!wpinv_checkout_validate_cc_zip($card_data['wpinv_zip'], $card_data['wpinv_country'])) {
894
+            wpinv_set_error('invalid_cc_zip', __('The zip / postcode you entered for your billing address is invalid', 'invoicing'));
895 895
         }
896 896
     }
897 897
 
@@ -901,16 +901,16 @@  discard block
 block discarded – undo
901 901
 
902 902
 function wpinv_checkout_get_cc_info() {
903 903
 	$cc_info = array();
904
-	$cc_info['card_name']      = isset( $_POST['card_name'] )       ? sanitize_text_field( $_POST['card_name'] )       : '';
905
-	$cc_info['card_number']    = isset( $_POST['card_number'] )     ? sanitize_text_field( $_POST['card_number'] )     : '';
906
-	$cc_info['card_cvc']       = isset( $_POST['card_cvc'] )        ? sanitize_text_field( $_POST['card_cvc'] )        : '';
907
-	$cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] )  ? sanitize_text_field( $_POST['card_exp_month'] )  : '';
908
-	$cc_info['card_exp_year']  = isset( $_POST['card_exp_year'] )   ? sanitize_text_field( $_POST['card_exp_year'] )   : '';
909
-	$cc_info['card_address']   = isset( $_POST['wpinv_address'] )  ? sanitize_text_field( $_POST['wpinv_address'] ) : '';
910
-	$cc_info['card_city']      = isset( $_POST['wpinv_city'] )     ? sanitize_text_field( $_POST['wpinv_city'] )    : '';
911
-	$cc_info['card_state']     = isset( $_POST['wpinv_state'] )    ? sanitize_text_field( $_POST['wpinv_state'] )   : '';
912
-	$cc_info['card_country']   = isset( $_POST['wpinv_country'] )  ? sanitize_text_field( $_POST['wpinv_country'] ) : '';
913
-	$cc_info['card_zip']       = isset( $_POST['wpinv_zip'] )      ? sanitize_text_field( $_POST['wpinv_zip'] )     : '';
904
+	$cc_info['card_name']      = isset($_POST['card_name']) ? sanitize_text_field($_POST['card_name']) : '';
905
+	$cc_info['card_number']    = isset($_POST['card_number']) ? sanitize_text_field($_POST['card_number']) : '';
906
+	$cc_info['card_cvc']       = isset($_POST['card_cvc']) ? sanitize_text_field($_POST['card_cvc']) : '';
907
+	$cc_info['card_exp_month'] = isset($_POST['card_exp_month']) ? sanitize_text_field($_POST['card_exp_month']) : '';
908
+	$cc_info['card_exp_year']  = isset($_POST['card_exp_year']) ? sanitize_text_field($_POST['card_exp_year']) : '';
909
+	$cc_info['card_address']   = isset($_POST['wpinv_address']) ? sanitize_text_field($_POST['wpinv_address']) : '';
910
+	$cc_info['card_city']      = isset($_POST['wpinv_city']) ? sanitize_text_field($_POST['wpinv_city']) : '';
911
+	$cc_info['card_state']     = isset($_POST['wpinv_state']) ? sanitize_text_field($_POST['wpinv_state']) : '';
912
+	$cc_info['card_country']   = isset($_POST['wpinv_country']) ? sanitize_text_field($_POST['wpinv_country']) : '';
913
+	$cc_info['card_zip']       = isset($_POST['wpinv_zip']) ? sanitize_text_field($_POST['wpinv_zip']) : '';
914 914
 
915 915
 	// Return cc info
916 916
 	return $cc_info;
@@ -919,84 +919,84 @@  discard block
 block discarded – undo
919 919
 /**
920 920
  * Validates a zip code.
921 921
  */
922
-function wpinv_checkout_validate_cc_zip( $zip = 0, $country_code = '' ) {
922
+function wpinv_checkout_validate_cc_zip($zip = 0, $country_code = '') {
923 923
 
924
-    if ( empty( $zip ) || empty( $country_code ) ){
924
+    if (empty($zip) || empty($country_code)) {
925 925
         return false;
926 926
     }
927 927
 
928 928
     // Prepare the country code.
929
-    $country_code = strtoupper( trim( $country_code ) );
929
+    $country_code = strtoupper(trim($country_code));
930 930
 
931 931
     // Fetch the regexes.
932
-    $zip_regex = wpinv_get_data( 'zip-regexes' );
932
+    $zip_regex = wpinv_get_data('zip-regexes');
933 933
 
934 934
     // Check if it is valid.
935
-    $is_valid = ! isset ( $zip_regex[ $country_code ] ) || preg_match( "/" . $zip_regex[ $country_code ] . "/i", $zip );
935
+    $is_valid = !isset ($zip_regex[$country_code]) || preg_match("/" . $zip_regex[$country_code] . "/i", $zip);
936 936
 
937
-    return apply_filters( 'wpinv_is_zip_valid', $is_valid, $zip, $country_code );
937
+    return apply_filters('wpinv_is_zip_valid', $is_valid, $zip, $country_code);
938 938
 }
939 939
 
940 940
 function wpinv_checkout_validate_agree_to_terms() {
941 941
     // Validate agree to terms
942
-    if ( ! isset( $_POST['wpi_agree_to_terms'] ) || $_POST['wpi_agree_to_terms'] != 1 ) {
942
+    if (!isset($_POST['wpi_agree_to_terms']) || $_POST['wpi_agree_to_terms'] != 1) {
943 943
         // User did not agree
944
-        wpinv_set_error( 'agree_to_terms', apply_filters( 'wpinv_agree_to_terms_text', __( 'You must agree to the terms of use', 'invoicing' ) ) );
944
+        wpinv_set_error('agree_to_terms', apply_filters('wpinv_agree_to_terms_text', __('You must agree to the terms of use', 'invoicing')));
945 945
     }
946 946
 }
947 947
 
948 948
 function wpinv_checkout_validate_invoice_user() {
949 949
     global $wpi_cart, $user_ID;
950 950
 
951
-    if(empty($wpi_cart)){
951
+    if (empty($wpi_cart)) {
952 952
         $wpi_cart = wpinv_get_invoice_cart();
953 953
     }
954 954
 
955
-    $invoice_user = (int)$wpi_cart->get_user_id();
955
+    $invoice_user = (int) $wpi_cart->get_user_id();
956 956
     $valid_user_data = array(
957 957
         'user_id' => $invoice_user
958 958
     );
959 959
 
960 960
     // If guest checkout allowed
961
-    if ( !wpinv_require_login_to_checkout() ) {
961
+    if (!wpinv_require_login_to_checkout()) {
962 962
         return $valid_user_data;
963 963
     }
964 964
     
965 965
     // Verify there is a user_ID
966
-    if ( $user_ID == $invoice_user ) {
966
+    if ($user_ID == $invoice_user) {
967 967
         // Get the logged in user data
968
-        $user_data = get_userdata( $user_ID );
969
-        $required_fields  = wpinv_checkout_required_fields();
968
+        $user_data = get_userdata($user_ID);
969
+        $required_fields = wpinv_checkout_required_fields();
970 970
 
971 971
         // Loop through required fields and show error messages
972
-         if ( !empty( $required_fields ) ) {
973
-            foreach ( $required_fields as $field_name => $value ) {
974
-                if ( in_array( $value, $required_fields ) && empty( $_POST[ 'wpinv_' . $field_name ] ) ) {
975
-                    wpinv_set_error( $value['error_id'], $value['error_message'] );
972
+         if (!empty($required_fields)) {
973
+            foreach ($required_fields as $field_name => $value) {
974
+                if (in_array($value, $required_fields) && empty($_POST['wpinv_' . $field_name])) {
975
+                    wpinv_set_error($value['error_id'], $value['error_message']);
976 976
                 }
977 977
             }
978 978
         }
979 979
 
980 980
         // Verify data
981
-        if ( $user_data ) {
981
+        if ($user_data) {
982 982
             // Collected logged in user data
983 983
             $valid_user_data = array(
984 984
                 'user_id'     => $user_ID,
985
-                'email'       => isset( $_POST['wpinv_email'] ) ? sanitize_email( $_POST['wpinv_email'] ) : $user_data->user_email,
986
-                'first_name'  => isset( $_POST['wpinv_first_name'] ) && ! empty( $_POST['wpinv_first_name'] ) ? sanitize_text_field( $_POST['wpinv_first_name'] ) : $user_data->first_name,
987
-                'last_name'   => isset( $_POST['wpinv_last_name'] ) && ! empty( $_POST['wpinv_last_name']  ) ? sanitize_text_field( $_POST['wpinv_last_name']  ) : $user_data->last_name,
985
+                'email'       => isset($_POST['wpinv_email']) ? sanitize_email($_POST['wpinv_email']) : $user_data->user_email,
986
+                'first_name'  => isset($_POST['wpinv_first_name']) && !empty($_POST['wpinv_first_name']) ? sanitize_text_field($_POST['wpinv_first_name']) : $user_data->first_name,
987
+                'last_name'   => isset($_POST['wpinv_last_name']) && !empty($_POST['wpinv_last_name']) ? sanitize_text_field($_POST['wpinv_last_name']) : $user_data->last_name,
988 988
             );
989 989
 
990
-            if ( !empty( $_POST[ 'wpinv_email' ] ) && !is_email( $_POST[ 'wpinv_email' ] ) ) {
991
-                wpinv_set_error( 'invalid_email', __( 'Please enter a valid email address', 'invoicing' ) );
990
+            if (!empty($_POST['wpinv_email']) && !is_email($_POST['wpinv_email'])) {
991
+                wpinv_set_error('invalid_email', __('Please enter a valid email address', 'invoicing'));
992 992
             }
993 993
         } else {
994 994
             // Set invalid user error
995
-            wpinv_set_error( 'invalid_user', __( 'The user billing information is invalid', 'invoicing' ) );
995
+            wpinv_set_error('invalid_user', __('The user billing information is invalid', 'invoicing'));
996 996
         }
997 997
     } else {
998 998
         // Set invalid user error
999
-        wpinv_set_error( 'invalid_user_id', __( 'The invalid invoice user id', 'invoicing' ) );
999
+        wpinv_set_error('invalid_user_id', __('The invalid invoice user id', 'invoicing'));
1000 1000
     }
1001 1001
 
1002 1002
     // Return user data
@@ -1008,27 +1008,27 @@  discard block
 block discarded – undo
1008 1008
 
1009 1009
     $data = array();
1010 1010
     
1011
-    if ( is_user_logged_in() ) {
1012
-        if ( !wpinv_require_login_to_checkout() || ( wpinv_require_login_to_checkout() && (int)$wpi_cart->get_user_id() === (int)get_current_user_id() ) ) {
1013
-            $data['user_id'] = (int)get_current_user_id();
1011
+    if (is_user_logged_in()) {
1012
+        if (!wpinv_require_login_to_checkout() || (wpinv_require_login_to_checkout() && (int) $wpi_cart->get_user_id() === (int) get_current_user_id())) {
1013
+            $data['user_id'] = (int) get_current_user_id();
1014 1014
         } else {
1015
-            wpinv_set_error( 'logged_in_only', __( 'You are not allowed to pay for this invoice', 'invoicing' ) );
1015
+            wpinv_set_error('logged_in_only', __('You are not allowed to pay for this invoice', 'invoicing'));
1016 1016
         }
1017 1017
     } else {
1018 1018
         // If guest checkout allowed
1019
-        if ( !wpinv_require_login_to_checkout() ) {
1019
+        if (!wpinv_require_login_to_checkout()) {
1020 1020
             $data['user_id'] = 0;
1021 1021
         } else {
1022
-            wpinv_set_error( 'logged_in_only', __( 'You must be logged in to pay for this invoice', 'invoicing' ) );
1022
+            wpinv_set_error('logged_in_only', __('You must be logged in to pay for this invoice', 'invoicing'));
1023 1023
         }
1024 1024
     }
1025 1025
 
1026 1026
     return $data;
1027 1027
 }
1028 1028
 
1029
-function wpinv_checkout_form_get_user( $valid_data = array() ) {
1029
+function wpinv_checkout_form_get_user($valid_data = array()) {
1030 1030
 
1031
-    if ( !empty( $valid_data['current_user']['user_id'] ) ) {
1031
+    if (!empty($valid_data['current_user']['user_id'])) {
1032 1032
         $user = $valid_data['current_user'];
1033 1033
     } else {
1034 1034
         // Set the valid invoice user
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
     }
1037 1037
 
1038 1038
     // Verify invoice have an user
1039
-    if ( false === $user || empty( $user ) ) {
1039
+    if (false === $user || empty($user)) {
1040 1040
         return false;
1041 1041
     }
1042 1042
 
@@ -1053,11 +1053,11 @@  discard block
 block discarded – undo
1053 1053
         'zip',
1054 1054
     );
1055 1055
     
1056
-    foreach ( $address_fields as $field ) {
1057
-        $user[$field]  = !empty( $_POST['wpinv_' . $field] ) ? sanitize_text_field( $_POST['wpinv_' . $field] ) : false;
1056
+    foreach ($address_fields as $field) {
1057
+        $user[$field] = !empty($_POST['wpinv_' . $field]) ? sanitize_text_field($_POST['wpinv_' . $field]) : false;
1058 1058
         
1059
-        if ( !empty( $user['user_id'] ) && !empty( $valid_data['current_user']['user_id'] ) && $valid_data['current_user']['user_id'] == $valid_data['invoice_user']['user_id'] ) {
1060
-            update_user_meta( $user['user_id'], '_wpinv_' . $field, $user[$field] );
1059
+        if (!empty($user['user_id']) && !empty($valid_data['current_user']['user_id']) && $valid_data['current_user']['user_id'] == $valid_data['invoice_user']['user_id']) {
1060
+            update_user_meta($user['user_id'], '_wpinv_' . $field, $user[$field]);
1061 1061
         }
1062 1062
     }
1063 1063
 
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
     wpinv_clear_errors();
1072 1072
 
1073 1073
     $invoice = wpinv_get_invoice_cart();
1074
-    if ( empty( $invoice ) ) {
1074
+    if (empty($invoice)) {
1075 1075
         return false;
1076 1076
     }
1077 1077
 
@@ -1079,42 +1079,42 @@  discard block
 block discarded – undo
1079 1079
 
1080 1080
     $wpi_checkout_id = $invoice->ID;
1081 1081
 
1082
-    do_action( 'wpinv_pre_process_checkout' );
1082
+    do_action('wpinv_pre_process_checkout');
1083 1083
     
1084
-    if ( !wpinv_get_cart_contents() ) { // Make sure the cart isn't empty
1084
+    if (!wpinv_get_cart_contents()) { // Make sure the cart isn't empty
1085 1085
         $valid_data = false;
1086
-        wpinv_set_error( 'empty_cart', __( 'Your cart is empty', 'invoicing' ) );
1086
+        wpinv_set_error('empty_cart', __('Your cart is empty', 'invoicing'));
1087 1087
     } else {
1088 1088
         // Validate the form $_POST data
1089 1089
         $valid_data = wpinv_validate_checkout_fields();
1090 1090
         
1091 1091
         // Allow themes and plugins to hook to errors
1092
-        do_action( 'wpinv_checkout_error_checks', $valid_data, $_POST );
1092
+        do_action('wpinv_checkout_error_checks', $valid_data, $_POST);
1093 1093
     }
1094 1094
     
1095
-    $is_ajax    = defined( 'DOING_AJAX' ) && DOING_AJAX;
1095
+    $is_ajax = defined('DOING_AJAX') && DOING_AJAX;
1096 1096
     
1097 1097
     // Validate the user
1098
-    $user = wpinv_checkout_form_get_user( $valid_data );
1098
+    $user = wpinv_checkout_form_get_user($valid_data);
1099 1099
 
1100 1100
     // Let extensions validate fields after user is logged in if user has used login/registration form
1101
-    do_action( 'wpinv_checkout_user_error_checks', $user, $valid_data, $_POST );
1101
+    do_action('wpinv_checkout_user_error_checks', $user, $valid_data, $_POST);
1102 1102
     
1103
-    if ( false === $valid_data || wpinv_get_errors() || ! $user ) {
1104
-        if ( $is_ajax && 'wpinv_payment_form' != $_REQUEST['action'] ) {
1105
-            do_action( 'wpinv_ajax_checkout_errors' );
1103
+    if (false === $valid_data || wpinv_get_errors() || !$user) {
1104
+        if ($is_ajax && 'wpinv_payment_form' != $_REQUEST['action']) {
1105
+            do_action('wpinv_ajax_checkout_errors');
1106 1106
             die();
1107 1107
         } else {
1108 1108
             return false;
1109 1109
         }
1110 1110
     }
1111 1111
 
1112
-    if ( $is_ajax && 'wpinv_payment_form' != $_REQUEST['action'] ) {
1112
+    if ($is_ajax && 'wpinv_payment_form' != $_REQUEST['action']) {
1113 1113
         // Save address fields.
1114
-        $address_fields = array( 'first_name', 'last_name', 'phone', 'address', 'city', 'country', 'state', 'zip', 'company' );
1115
-        foreach ( $address_fields as $field ) {
1116
-            if ( isset( $user[$field] ) ) {
1117
-                $invoice->set( $field, $user[$field] );
1114
+        $address_fields = array('first_name', 'last_name', 'phone', 'address', 'city', 'country', 'state', 'zip', 'company');
1115
+        foreach ($address_fields as $field) {
1116
+            if (isset($user[$field])) {
1117
+                $invoice->set($field, $user[$field]);
1118 1118
             }
1119 1119
 
1120 1120
             $invoice->save();
@@ -1122,16 +1122,16 @@  discard block
 block discarded – undo
1122 1122
 
1123 1123
         $response['success']            = true;
1124 1124
         $response['data']['subtotal']   = $invoice->get_subtotal();
1125
-        $response['data']['subtotalf']  = $invoice->get_subtotal( true );
1125
+        $response['data']['subtotalf']  = $invoice->get_subtotal(true);
1126 1126
         $response['data']['discount']   = $invoice->get_discount();
1127
-        $response['data']['discountf']  = $invoice->get_discount( true );
1127
+        $response['data']['discountf']  = $invoice->get_discount(true);
1128 1128
         $response['data']['tax']        = $invoice->get_tax();
1129
-        $response['data']['taxf']       = $invoice->get_tax( true );
1129
+        $response['data']['taxf']       = $invoice->get_tax(true);
1130 1130
         $response['data']['total']      = $invoice->get_total();
1131
-        $response['data']['totalf']     = $invoice->get_total( true );
1132
-	    $response['data']['free']       = $invoice->is_free() && ( ! ( (float) $response['data']['total'] > 0 ) || $invoice->has_free_trial() ) ? true : false;
1131
+        $response['data']['totalf']     = $invoice->get_total(true);
1132
+	    $response['data']['free'] = $invoice->is_free() && (!((float) $response['data']['total'] > 0) || $invoice->has_free_trial()) ? true : false;
1133 1133
 
1134
-        wp_send_json( $response );
1134
+        wp_send_json($response);
1135 1135
     }
1136 1136
     
1137 1137
     $user_info = array(
@@ -1153,42 +1153,42 @@  discard block
 block discarded – undo
1153 1153
     
1154 1154
     // Setup invoice information
1155 1155
     $invoice_data = array(
1156
-        'invoice_id'        => !empty( $invoice ) ? $invoice->ID : 0,
1156
+        'invoice_id'        => !empty($invoice) ? $invoice->ID : 0,
1157 1157
         'items'             => $cart_items,
1158 1158
         'cart_discounts'    => $discounts,
1159
-        'fees'              => wpinv_get_cart_fees(),        // Any arbitrary fees that have been added to the cart
1160
-        'subtotal'          => wpinv_get_cart_subtotal( $cart_items ),    // Amount before taxes and discounts
1161
-        'discount'          => wpinv_get_cart_items_discount_amount( $cart_items, $discounts ), // Discounted amount
1162
-        'tax'               => wpinv_get_cart_tax( $cart_items, $invoice ),               // Taxed amount
1163
-        'price'             => wpinv_get_cart_total( $cart_items, $discounts ),    // Amount after taxes
1159
+        'fees'              => wpinv_get_cart_fees(), // Any arbitrary fees that have been added to the cart
1160
+        'subtotal'          => wpinv_get_cart_subtotal($cart_items), // Amount before taxes and discounts
1161
+        'discount'          => wpinv_get_cart_items_discount_amount($cart_items, $discounts), // Discounted amount
1162
+        'tax'               => wpinv_get_cart_tax($cart_items, $invoice), // Taxed amount
1163
+        'price'             => wpinv_get_cart_total($cart_items, $discounts), // Amount after taxes
1164 1164
         'invoice_key'       => $invoice->get_key() ? $invoice->get_key() : $invoice->generate_key(),
1165 1165
         'user_email'        => $invoice->get_email(),
1166
-        'date'              => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
1167
-        'user_info'         => stripslashes_deep( $user_info ),
1166
+        'date'              => date('Y-m-d H:i:s', current_time('timestamp')),
1167
+        'user_info'         => stripslashes_deep($user_info),
1168 1168
         'post_data'         => $_POST,
1169 1169
         'cart_details'      => $cart_items,
1170 1170
         'gateway'           => $valid_data['gateway'],
1171 1171
         'card_info'         => $valid_data['cc_info']
1172 1172
     );
1173 1173
     
1174
-    $vat_info   = $wpinv_euvat->current_vat_data();
1175
-    if ( is_array( $vat_info ) ) {
1174
+    $vat_info = $wpinv_euvat->current_vat_data();
1175
+    if (is_array($vat_info)) {
1176 1176
         $invoice_data['user_info']['vat_number']        = $vat_info['number'];
1177 1177
         $invoice_data['user_info']['vat_rate']          = wpinv_get_tax_rate($invoice_data['user_info']['country'], $invoice_data['user_info']['state']);
1178
-        $invoice_data['user_info']['adddress_confirmed']    = isset($vat_info['adddress_confirmed']) ? $vat_info['adddress_confirmed'] : false;
1178
+        $invoice_data['user_info']['adddress_confirmed'] = isset($vat_info['adddress_confirmed']) ? $vat_info['adddress_confirmed'] : false;
1179 1179
 
1180 1180
         // Add the VAT rate to each item in the cart
1181
-        foreach( $invoice_data['cart_details'] as $key => $item_data) {
1181
+        foreach ($invoice_data['cart_details'] as $key => $item_data) {
1182 1182
             $rate = wpinv_get_tax_rate($invoice_data['user_info']['country'], $invoice_data['user_info']['state'], $item_data['id']);
1183
-            $invoice_data['cart_details'][$key]['vat_rate'] = wpinv_round_amount( $rate, 4 );
1183
+            $invoice_data['cart_details'][$key]['vat_rate'] = wpinv_round_amount($rate, 4);
1184 1184
         }
1185 1185
     }
1186 1186
     
1187 1187
     // Save vat fields.
1188
-    $address_fields = array( 'vat_number', 'vat_rate', 'adddress_confirmed' );
1189
-    foreach ( $address_fields as $field ) {
1190
-        if ( isset( $invoice_data['user_info'][$field] ) ) {
1191
-            $invoice->set( $field, $invoice_data['user_info'][$field] );
1188
+    $address_fields = array('vat_number', 'vat_rate', 'adddress_confirmed');
1189
+    foreach ($address_fields as $field) {
1190
+        if (isset($invoice_data['user_info'][$field])) {
1191
+            $invoice->set($field, $invoice_data['user_info'][$field]);
1192 1192
         }
1193 1193
     }
1194 1194
     $invoice->save();
@@ -1197,42 +1197,42 @@  discard block
 block discarded – undo
1197 1197
     $valid_data['user'] = $user;
1198 1198
     
1199 1199
     // Allow themes and plugins to hook before the gateway
1200
-    do_action( 'wpinv_checkout_before_gateway', $_POST, $user_info, $valid_data );
1200
+    do_action('wpinv_checkout_before_gateway', $_POST, $user_info, $valid_data);
1201 1201
 
1202 1202
      // If it is free, abort.
1203
-     if ( $invoice->is_free() && ( ! $invoice->is_recurring() || 0 ==  $invoice->get_recurring_details( 'total' ) ) ) {
1203
+     if ($invoice->is_free() && (!$invoice->is_recurring() || 0 == $invoice->get_recurring_details('total'))) {
1204 1204
         $invoice_data['gateway'] = 'manual';
1205 1205
         $_POST['wpi-gateway'] = 'manual';
1206 1206
     }
1207 1207
 
1208 1208
     // Allow the invoice data to be modified before it is sent to the gateway
1209
-    $invoice_data = apply_filters( 'wpinv_data_before_gateway', $invoice_data, $valid_data );
1209
+    $invoice_data = apply_filters('wpinv_data_before_gateway', $invoice_data, $valid_data);
1210 1210
     
1211
-    if ( $invoice_data['price'] && $invoice_data['gateway'] == 'manual' ) {
1211
+    if ($invoice_data['price'] && $invoice_data['gateway'] == 'manual') {
1212 1212
         $mode = 'test';
1213 1213
     } else {
1214
-        $mode = wpinv_is_test_mode( $invoice_data['gateway'] ) ? 'test' : 'live';
1214
+        $mode = wpinv_is_test_mode($invoice_data['gateway']) ? 'test' : 'live';
1215 1215
     }
1216 1216
 
1217 1217
     // Setup the data we're storing in the purchase session
1218 1218
     $session_data = $invoice_data;
1219 1219
     // Make sure credit card numbers are never stored in sessions
1220
-    if ( !empty( $session_data['card_info']['card_number'] ) ) {
1221
-        unset( $session_data['card_info']['card_number'] );
1220
+    if (!empty($session_data['card_info']['card_number'])) {
1221
+        unset($session_data['card_info']['card_number']);
1222 1222
     }
1223 1223
     
1224 1224
     // Used for showing item links to non logged-in users after purchase, and for other plugins needing purchase data.
1225
-    wpinv_set_checkout_session( $invoice_data );
1225
+    wpinv_set_checkout_session($invoice_data);
1226 1226
     
1227 1227
     // Set gateway
1228
-    $invoice->update_meta( '_wpinv_gateway', $invoice_data['gateway'] );
1229
-    $invoice->update_meta( '_wpinv_mode', $mode );
1230
-    $invoice->update_meta( '_wpinv_checkout', date_i18n( 'Y-m-d H:i:s', current_time( 'timestamp' ) ) );
1228
+    $invoice->update_meta('_wpinv_gateway', $invoice_data['gateway']);
1229
+    $invoice->update_meta('_wpinv_mode', $mode);
1230
+    $invoice->update_meta('_wpinv_checkout', date_i18n('Y-m-d H:i:s', current_time('timestamp')));
1231 1231
     
1232
-    do_action( 'wpinv_checkout_before_send_to_gateway', $invoice, $invoice_data );
1232
+    do_action('wpinv_checkout_before_send_to_gateway', $invoice, $invoice_data);
1233 1233
 
1234 1234
     // Send info to the gateway for payment processing
1235
-    wpinv_send_to_gateway( $invoice_data['gateway'], $invoice_data );
1235
+    wpinv_send_to_gateway($invoice_data['gateway'], $invoice_data);
1236 1236
     die();
1237 1237
 }
1238
-add_action( 'wpinv_payment', 'wpinv_process_checkout' );
1238
+add_action('wpinv_payment', 'wpinv_process_checkout');
Please login to merge, or discard this patch.
includes/wpinv-general-functions.php 2 patches
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -31,36 +31,36 @@  discard block
 block discarded – undo
31 31
 }
32 32
 
33 33
 function wpinv_can_checkout() {
34
-	$can_checkout = true; // Always true for now
34
+    $can_checkout = true; // Always true for now
35 35
 
36
-	return (bool) apply_filters( 'wpinv_can_checkout', $can_checkout );
36
+    return (bool) apply_filters( 'wpinv_can_checkout', $can_checkout );
37 37
 }
38 38
 
39 39
 function wpinv_get_success_page_uri() {
40
-	$page_id = wpinv_get_option( 'success_page', 0 );
41
-	$page_id = absint( $page_id );
40
+    $page_id = wpinv_get_option( 'success_page', 0 );
41
+    $page_id = absint( $page_id );
42 42
 
43
-	return apply_filters( 'wpinv_get_success_page_uri', get_permalink( $page_id ) );
43
+    return apply_filters( 'wpinv_get_success_page_uri', get_permalink( $page_id ) );
44 44
 }
45 45
 
46 46
 function wpinv_get_history_page_uri() {
47
-	$page_id = wpinv_get_option( 'invoice_history_page', 0 );
48
-	$page_id = absint( $page_id );
47
+    $page_id = wpinv_get_option( 'invoice_history_page', 0 );
48
+    $page_id = absint( $page_id );
49 49
 
50
-	return apply_filters( 'wpinv_get_history_page_uri', get_permalink( $page_id ) );
50
+    return apply_filters( 'wpinv_get_history_page_uri', get_permalink( $page_id ) );
51 51
 }
52 52
 
53 53
 function wpinv_is_success_page() {
54
-	$is_success_page = wpinv_get_option( 'success_page', false );
55
-	$is_success_page = ! empty( $is_success_page ) ? is_page( $is_success_page ) : false;
54
+    $is_success_page = wpinv_get_option( 'success_page', false );
55
+    $is_success_page = ! empty( $is_success_page ) ? is_page( $is_success_page ) : false;
56 56
 
57
-	return apply_filters( 'wpinv_is_success_page', $is_success_page );
57
+    return apply_filters( 'wpinv_is_success_page', $is_success_page );
58 58
 }
59 59
 
60 60
 function wpinv_is_invoice_history_page() {
61
-	$ret = wpinv_get_option( 'invoice_history_page', false );
62
-	$ret = $ret ? is_page( $ret ) : false;
63
-	return apply_filters( 'wpinv_is_invoice_history_page', $ret );
61
+    $ret = wpinv_get_option( 'invoice_history_page', false );
62
+    $ret = $ret ? is_page( $ret ) : false;
63
+    return apply_filters( 'wpinv_is_invoice_history_page', $ret );
64 64
 }
65 65
 
66 66
 function wpinv_is_subscriptions_history_page() {
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 }
71 71
 
72 72
 function wpinv_send_to_success_page( $args = null ) {
73
-	$redirect = wpinv_get_success_page_uri();
73
+    $redirect = wpinv_get_success_page_uri();
74 74
     
75 75
     if ( !empty( $args ) ) {
76 76
         // Check for backward compatibility
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 }
91 91
 
92 92
 function wpinv_send_to_failed_page( $args = null ) {
93
-	$redirect = wpinv_get_failed_transaction_uri();
93
+    $redirect = wpinv_get_failed_transaction_uri();
94 94
     
95 95
     if ( !empty( $args ) ) {
96 96
         // Check for backward compatibility
@@ -110,73 +110,73 @@  discard block
 block discarded – undo
110 110
 }
111 111
 
112 112
 function wpinv_get_checkout_uri( $args = array() ) {
113
-	$uri = wpinv_get_option( 'checkout_page', false );
114
-	$uri = isset( $uri ) ? get_permalink( $uri ) : NULL;
113
+    $uri = wpinv_get_option( 'checkout_page', false );
114
+    $uri = isset( $uri ) ? get_permalink( $uri ) : NULL;
115 115
 
116
-	if ( !empty( $args ) ) {
117
-		// Check for backward compatibility
118
-		if ( is_string( $args ) )
119
-			$args = str_replace( '?', '', $args );
116
+    if ( !empty( $args ) ) {
117
+        // Check for backward compatibility
118
+        if ( is_string( $args ) )
119
+            $args = str_replace( '?', '', $args );
120 120
 
121
-		$args = wp_parse_args( $args );
121
+        $args = wp_parse_args( $args );
122 122
 
123
-		$uri = add_query_arg( $args, $uri );
124
-	}
123
+        $uri = add_query_arg( $args, $uri );
124
+    }
125 125
 
126
-	$scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin';
126
+    $scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin';
127 127
 
128
-	$ajax_url = admin_url( 'admin-ajax.php', $scheme );
128
+    $ajax_url = admin_url( 'admin-ajax.php', $scheme );
129 129
 
130
-	if ( ( ! preg_match( '/^https/', $uri ) && preg_match( '/^https/', $ajax_url ) ) || wpinv_is_ssl_enforced() ) {
131
-		$uri = preg_replace( '/^http:/', 'https:', $uri );
132
-	}
130
+    if ( ( ! preg_match( '/^https/', $uri ) && preg_match( '/^https/', $ajax_url ) ) || wpinv_is_ssl_enforced() ) {
131
+        $uri = preg_replace( '/^http:/', 'https:', $uri );
132
+    }
133 133
 
134
-	return apply_filters( 'wpinv_get_checkout_uri', $uri );
134
+    return apply_filters( 'wpinv_get_checkout_uri', $uri );
135 135
 }
136 136
 
137 137
 function wpinv_send_back_to_checkout( $args = array() ) {
138
-	$redirect = wpinv_get_checkout_uri();
138
+    $redirect = wpinv_get_checkout_uri();
139 139
 
140
-	if ( ! empty( $args ) ) {
141
-		// Check for backward compatibility
142
-		if ( is_string( $args ) )
143
-			$args = str_replace( '?', '', $args );
140
+    if ( ! empty( $args ) ) {
141
+        // Check for backward compatibility
142
+        if ( is_string( $args ) )
143
+            $args = str_replace( '?', '', $args );
144 144
 
145
-		$args = wp_parse_args( $args );
145
+        $args = wp_parse_args( $args );
146 146
 
147
-		$redirect = add_query_arg( $args, $redirect );
148
-	}
147
+        $redirect = add_query_arg( $args, $redirect );
148
+    }
149 149
 
150 150
     do_action( 'wpinv_pre_send_back_to_checkout', $args );
151
-	wp_redirect( apply_filters( 'wpinv_send_back_to_checkout', $redirect, $args ) );
152
-	exit;
151
+    wp_redirect( apply_filters( 'wpinv_send_back_to_checkout', $redirect, $args ) );
152
+    exit;
153 153
 }
154 154
 
155 155
 function wpinv_get_success_page_url( $query_string = null ) {
156
-	$success_page = wpinv_get_option( 'success_page', 0 );
157
-	$success_page = get_permalink( $success_page );
156
+    $success_page = wpinv_get_option( 'success_page', 0 );
157
+    $success_page = get_permalink( $success_page );
158 158
 
159
-	if ( $query_string )
160
-		$success_page .= $query_string;
159
+    if ( $query_string )
160
+        $success_page .= $query_string;
161 161
 
162
-	return apply_filters( 'wpinv_success_page_url', $success_page );
162
+    return apply_filters( 'wpinv_success_page_url', $success_page );
163 163
 }
164 164
 
165 165
 function wpinv_get_failed_transaction_uri( $extras = false ) {
166
-	$uri = wpinv_get_option( 'failure_page', '' );
167
-	$uri = ! empty( $uri ) ? trailingslashit( get_permalink( $uri ) ) : home_url();
166
+    $uri = wpinv_get_option( 'failure_page', '' );
167
+    $uri = ! empty( $uri ) ? trailingslashit( get_permalink( $uri ) ) : home_url();
168 168
 
169
-	if ( $extras )
170
-		$uri .= $extras;
169
+    if ( $extras )
170
+        $uri .= $extras;
171 171
 
172
-	return apply_filters( 'wpinv_get_failed_transaction_uri', $uri );
172
+    return apply_filters( 'wpinv_get_failed_transaction_uri', $uri );
173 173
 }
174 174
 
175 175
 function wpinv_is_failed_transaction_page() {
176
-	$ret = wpinv_get_option( 'failure_page', false );
177
-	$ret = isset( $ret ) ? is_page( $ret ) : false;
176
+    $ret = wpinv_get_option( 'failure_page', false );
177
+    $ret = isset( $ret ) ? is_page( $ret ) : false;
178 178
 
179
-	return apply_filters( 'wpinv_is_failure_page', $ret );
179
+    return apply_filters( 'wpinv_is_failure_page', $ret );
180 180
 }
181 181
 
182 182
 function wpinv_transaction_query( $type = 'start' ) {
@@ -251,36 +251,36 @@  discard block
 block discarded – undo
251 251
     $require_billing_details = apply_filters( 'wpinv_checkout_required_billing_details', wpinv_use_taxes() );
252 252
     
253 253
     if ( $require_billing_details ) {
254
-		if ( (bool)wpinv_get_option( 'fname_mandatory' ) ) {
255
-			$required_fields['first_name'] = array(
256
-				'error_id' => 'invalid_first_name',
257
-				'error_message' => __( 'Please enter your first name', 'invoicing' )
258
-			);
259
-		}
260
-		if ( (bool)wpinv_get_option( 'address_mandatory' ) ) {
261
-			$required_fields['address'] = array(
262
-				'error_id' => 'invalid_address',
263
-				'error_message' => __( 'Please enter your address', 'invoicing' )
264
-			);
265
-		}
266
-		if ( (bool)wpinv_get_option( 'city_mandatory' ) ) {
267
-			$required_fields['city'] = array(
268
-				'error_id' => 'invalid_city',
269
-				'error_message' => __( 'Please enter your billing city', 'invoicing' )
270
-			);
271
-		}
272
-		if ( (bool)wpinv_get_option( 'state_mandatory' ) ) {
273
-			$required_fields['state'] = array(
274
-				'error_id' => 'invalid_state',
275
-				'error_message' => __( 'Please enter billing state / province', 'invoicing' )
276
-			);
277
-		}
278
-		if ( (bool)wpinv_get_option( 'country_mandatory' ) ) {
279
-			$required_fields['country'] = array(
280
-				'error_id' => 'invalid_country',
281
-				'error_message' => __( 'Please select your billing country', 'invoicing' )
282
-			);
283
-		}
254
+        if ( (bool)wpinv_get_option( 'fname_mandatory' ) ) {
255
+            $required_fields['first_name'] = array(
256
+                'error_id' => 'invalid_first_name',
257
+                'error_message' => __( 'Please enter your first name', 'invoicing' )
258
+            );
259
+        }
260
+        if ( (bool)wpinv_get_option( 'address_mandatory' ) ) {
261
+            $required_fields['address'] = array(
262
+                'error_id' => 'invalid_address',
263
+                'error_message' => __( 'Please enter your address', 'invoicing' )
264
+            );
265
+        }
266
+        if ( (bool)wpinv_get_option( 'city_mandatory' ) ) {
267
+            $required_fields['city'] = array(
268
+                'error_id' => 'invalid_city',
269
+                'error_message' => __( 'Please enter your billing city', 'invoicing' )
270
+            );
271
+        }
272
+        if ( (bool)wpinv_get_option( 'state_mandatory' ) ) {
273
+            $required_fields['state'] = array(
274
+                'error_id' => 'invalid_state',
275
+                'error_message' => __( 'Please enter billing state / province', 'invoicing' )
276
+            );
277
+        }
278
+        if ( (bool)wpinv_get_option( 'country_mandatory' ) ) {
279
+            $required_fields['country'] = array(
280
+                'error_id' => 'invalid_country',
281
+                'error_message' => __( 'Please select your billing country', 'invoicing' )
282
+            );
283
+        }
284 284
     }
285 285
 
286 286
     return apply_filters( 'wpinv_checkout_required_fields', $required_fields );
Please login to merge, or discard this patch.
Spacing   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -7,197 +7,197 @@  discard block
 block discarded – undo
7 7
  */
8 8
  
9 9
 // MUST have WordPress.
10
-if ( !defined( 'WPINC' ) ) {
11
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
10
+if (!defined('WPINC')) {
11
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
12 12
 }
13 13
 
14 14
 function wpinv_is_checkout() {
15 15
     global $wp_query;
16 16
 
17
-    $is_object_set    = isset( $wp_query->queried_object );
18
-    $is_object_id_set = isset( $wp_query->queried_object_id );
19
-    $checkout_page    = wpinv_get_option( 'checkout_page' );
20
-    $is_checkout      = ! empty( $checkout_page ) && is_page( $checkout_page );
17
+    $is_object_set    = isset($wp_query->queried_object);
18
+    $is_object_id_set = isset($wp_query->queried_object_id);
19
+    $checkout_page    = wpinv_get_option('checkout_page');
20
+    $is_checkout      = !empty($checkout_page) && is_page($checkout_page);
21 21
 
22
-    if ( !$is_object_set ) {
23
-        unset( $wp_query->queried_object );
22
+    if (!$is_object_set) {
23
+        unset($wp_query->queried_object);
24 24
     }
25 25
 
26
-    if ( !$is_object_id_set ) {
27
-        unset( $wp_query->queried_object_id );
26
+    if (!$is_object_id_set) {
27
+        unset($wp_query->queried_object_id);
28 28
     }
29 29
 
30
-    return apply_filters( 'wpinv_is_checkout', $is_checkout );
30
+    return apply_filters('wpinv_is_checkout', $is_checkout);
31 31
 }
32 32
 
33 33
 function wpinv_can_checkout() {
34 34
 	$can_checkout = true; // Always true for now
35 35
 
36
-	return (bool) apply_filters( 'wpinv_can_checkout', $can_checkout );
36
+	return (bool) apply_filters('wpinv_can_checkout', $can_checkout);
37 37
 }
38 38
 
39 39
 function wpinv_get_success_page_uri() {
40
-	$page_id = wpinv_get_option( 'success_page', 0 );
41
-	$page_id = absint( $page_id );
40
+	$page_id = wpinv_get_option('success_page', 0);
41
+	$page_id = absint($page_id);
42 42
 
43
-	return apply_filters( 'wpinv_get_success_page_uri', get_permalink( $page_id ) );
43
+	return apply_filters('wpinv_get_success_page_uri', get_permalink($page_id));
44 44
 }
45 45
 
46 46
 function wpinv_get_history_page_uri() {
47
-	$page_id = wpinv_get_option( 'invoice_history_page', 0 );
48
-	$page_id = absint( $page_id );
47
+	$page_id = wpinv_get_option('invoice_history_page', 0);
48
+	$page_id = absint($page_id);
49 49
 
50
-	return apply_filters( 'wpinv_get_history_page_uri', get_permalink( $page_id ) );
50
+	return apply_filters('wpinv_get_history_page_uri', get_permalink($page_id));
51 51
 }
52 52
 
53 53
 function wpinv_is_success_page() {
54
-	$is_success_page = wpinv_get_option( 'success_page', false );
55
-	$is_success_page = ! empty( $is_success_page ) ? is_page( $is_success_page ) : false;
54
+	$is_success_page = wpinv_get_option('success_page', false);
55
+	$is_success_page = !empty($is_success_page) ? is_page($is_success_page) : false;
56 56
 
57
-	return apply_filters( 'wpinv_is_success_page', $is_success_page );
57
+	return apply_filters('wpinv_is_success_page', $is_success_page);
58 58
 }
59 59
 
60 60
 function wpinv_is_invoice_history_page() {
61
-	$ret = wpinv_get_option( 'invoice_history_page', false );
62
-	$ret = $ret ? is_page( $ret ) : false;
63
-	return apply_filters( 'wpinv_is_invoice_history_page', $ret );
61
+	$ret = wpinv_get_option('invoice_history_page', false);
62
+	$ret = $ret ? is_page($ret) : false;
63
+	return apply_filters('wpinv_is_invoice_history_page', $ret);
64 64
 }
65 65
 
66 66
 function wpinv_is_subscriptions_history_page() {
67
-    $ret = wpinv_get_option( 'invoice_subscription_page', false );
68
-    $ret = $ret ? is_page( $ret ) : false;
69
-    return apply_filters( 'wpinv_is_subscriptions_history_page', $ret );
67
+    $ret = wpinv_get_option('invoice_subscription_page', false);
68
+    $ret = $ret ? is_page($ret) : false;
69
+    return apply_filters('wpinv_is_subscriptions_history_page', $ret);
70 70
 }
71 71
 
72
-function wpinv_send_to_success_page( $args = null ) {
72
+function wpinv_send_to_success_page($args = null) {
73 73
 	$redirect = wpinv_get_success_page_uri();
74 74
     
75
-    if ( !empty( $args ) ) {
75
+    if (!empty($args)) {
76 76
         // Check for backward compatibility
77
-        if ( is_string( $args ) )
78
-            $args = str_replace( '?', '', $args );
77
+        if (is_string($args))
78
+            $args = str_replace('?', '', $args);
79 79
 
80
-        $args = wp_parse_args( $args );
80
+        $args = wp_parse_args($args);
81 81
 
82
-        $redirect = add_query_arg( $args, $redirect );
82
+        $redirect = add_query_arg($args, $redirect);
83 83
     }
84 84
 
85
-    $gateway = isset( $_REQUEST['wpi-gateway'] ) ? $_REQUEST['wpi-gateway'] : '';
85
+    $gateway = isset($_REQUEST['wpi-gateway']) ? $_REQUEST['wpi-gateway'] : '';
86 86
     
87
-    $redirect = apply_filters( 'wpinv_success_page_redirect', $redirect, $gateway, $args );
88
-    wp_redirect( $redirect );
87
+    $redirect = apply_filters('wpinv_success_page_redirect', $redirect, $gateway, $args);
88
+    wp_redirect($redirect);
89 89
     exit;
90 90
 }
91 91
 
92
-function wpinv_send_to_failed_page( $args = null ) {
92
+function wpinv_send_to_failed_page($args = null) {
93 93
 	$redirect = wpinv_get_failed_transaction_uri();
94 94
     
95
-    if ( !empty( $args ) ) {
95
+    if (!empty($args)) {
96 96
         // Check for backward compatibility
97
-        if ( is_string( $args ) )
98
-            $args = str_replace( '?', '', $args );
97
+        if (is_string($args))
98
+            $args = str_replace('?', '', $args);
99 99
 
100
-        $args = wp_parse_args( $args );
100
+        $args = wp_parse_args($args);
101 101
 
102
-        $redirect = add_query_arg( $args, $redirect );
102
+        $redirect = add_query_arg($args, $redirect);
103 103
     }
104 104
 
105
-    $gateway = isset( $_REQUEST['wpi-gateway'] ) ? $_REQUEST['wpi-gateway'] : '';
105
+    $gateway = isset($_REQUEST['wpi-gateway']) ? $_REQUEST['wpi-gateway'] : '';
106 106
     
107
-    $redirect = apply_filters( 'wpinv_failed_page_redirect', $redirect, $gateway, $args );
108
-    wp_redirect( $redirect );
107
+    $redirect = apply_filters('wpinv_failed_page_redirect', $redirect, $gateway, $args);
108
+    wp_redirect($redirect);
109 109
     exit;
110 110
 }
111 111
 
112
-function wpinv_get_checkout_uri( $args = array() ) {
113
-	$uri = wpinv_get_option( 'checkout_page', false );
114
-	$uri = isset( $uri ) ? get_permalink( $uri ) : NULL;
112
+function wpinv_get_checkout_uri($args = array()) {
113
+	$uri = wpinv_get_option('checkout_page', false);
114
+	$uri = isset($uri) ? get_permalink($uri) : NULL;
115 115
 
116
-	if ( !empty( $args ) ) {
116
+	if (!empty($args)) {
117 117
 		// Check for backward compatibility
118
-		if ( is_string( $args ) )
119
-			$args = str_replace( '?', '', $args );
118
+		if (is_string($args))
119
+			$args = str_replace('?', '', $args);
120 120
 
121
-		$args = wp_parse_args( $args );
121
+		$args = wp_parse_args($args);
122 122
 
123
-		$uri = add_query_arg( $args, $uri );
123
+		$uri = add_query_arg($args, $uri);
124 124
 	}
125 125
 
126
-	$scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin';
126
+	$scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin';
127 127
 
128
-	$ajax_url = admin_url( 'admin-ajax.php', $scheme );
128
+	$ajax_url = admin_url('admin-ajax.php', $scheme);
129 129
 
130
-	if ( ( ! preg_match( '/^https/', $uri ) && preg_match( '/^https/', $ajax_url ) ) || wpinv_is_ssl_enforced() ) {
131
-		$uri = preg_replace( '/^http:/', 'https:', $uri );
130
+	if ((!preg_match('/^https/', $uri) && preg_match('/^https/', $ajax_url)) || wpinv_is_ssl_enforced()) {
131
+		$uri = preg_replace('/^http:/', 'https:', $uri);
132 132
 	}
133 133
 
134
-	return apply_filters( 'wpinv_get_checkout_uri', $uri );
134
+	return apply_filters('wpinv_get_checkout_uri', $uri);
135 135
 }
136 136
 
137
-function wpinv_send_back_to_checkout( $args = array() ) {
137
+function wpinv_send_back_to_checkout($args = array()) {
138 138
 	$redirect = wpinv_get_checkout_uri();
139 139
 
140
-	if ( ! empty( $args ) ) {
140
+	if (!empty($args)) {
141 141
 		// Check for backward compatibility
142
-		if ( is_string( $args ) )
143
-			$args = str_replace( '?', '', $args );
142
+		if (is_string($args))
143
+			$args = str_replace('?', '', $args);
144 144
 
145
-		$args = wp_parse_args( $args );
145
+		$args = wp_parse_args($args);
146 146
 
147
-		$redirect = add_query_arg( $args, $redirect );
147
+		$redirect = add_query_arg($args, $redirect);
148 148
 	}
149 149
 
150
-    do_action( 'wpinv_pre_send_back_to_checkout', $args );
151
-	wp_redirect( apply_filters( 'wpinv_send_back_to_checkout', $redirect, $args ) );
150
+    do_action('wpinv_pre_send_back_to_checkout', $args);
151
+	wp_redirect(apply_filters('wpinv_send_back_to_checkout', $redirect, $args));
152 152
 	exit;
153 153
 }
154 154
 
155
-function wpinv_get_success_page_url( $query_string = null ) {
156
-	$success_page = wpinv_get_option( 'success_page', 0 );
157
-	$success_page = get_permalink( $success_page );
155
+function wpinv_get_success_page_url($query_string = null) {
156
+	$success_page = wpinv_get_option('success_page', 0);
157
+	$success_page = get_permalink($success_page);
158 158
 
159
-	if ( $query_string )
159
+	if ($query_string)
160 160
 		$success_page .= $query_string;
161 161
 
162
-	return apply_filters( 'wpinv_success_page_url', $success_page );
162
+	return apply_filters('wpinv_success_page_url', $success_page);
163 163
 }
164 164
 
165
-function wpinv_get_failed_transaction_uri( $extras = false ) {
166
-	$uri = wpinv_get_option( 'failure_page', '' );
167
-	$uri = ! empty( $uri ) ? trailingslashit( get_permalink( $uri ) ) : home_url();
165
+function wpinv_get_failed_transaction_uri($extras = false) {
166
+	$uri = wpinv_get_option('failure_page', '');
167
+	$uri = !empty($uri) ? trailingslashit(get_permalink($uri)) : home_url();
168 168
 
169
-	if ( $extras )
169
+	if ($extras)
170 170
 		$uri .= $extras;
171 171
 
172
-	return apply_filters( 'wpinv_get_failed_transaction_uri', $uri );
172
+	return apply_filters('wpinv_get_failed_transaction_uri', $uri);
173 173
 }
174 174
 
175 175
 function wpinv_is_failed_transaction_page() {
176
-	$ret = wpinv_get_option( 'failure_page', false );
177
-	$ret = isset( $ret ) ? is_page( $ret ) : false;
176
+	$ret = wpinv_get_option('failure_page', false);
177
+	$ret = isset($ret) ? is_page($ret) : false;
178 178
 
179
-	return apply_filters( 'wpinv_is_failure_page', $ret );
179
+	return apply_filters('wpinv_is_failure_page', $ret);
180 180
 }
181 181
 
182
-function wpinv_transaction_query( $type = 'start' ) {
182
+function wpinv_transaction_query($type = 'start') {
183 183
     global $wpdb;
184 184
 
185 185
     $wpdb->hide_errors();
186 186
 
187
-    if ( ! defined( 'WPINV_USE_TRANSACTIONS' ) ) {
188
-        define( 'WPINV_USE_TRANSACTIONS', true );
187
+    if (!defined('WPINV_USE_TRANSACTIONS')) {
188
+        define('WPINV_USE_TRANSACTIONS', true);
189 189
     }
190 190
 
191
-    if ( WPINV_USE_TRANSACTIONS ) {
192
-        switch ( $type ) {
191
+    if (WPINV_USE_TRANSACTIONS) {
192
+        switch ($type) {
193 193
             case 'commit' :
194
-                $wpdb->query( 'COMMIT' );
194
+                $wpdb->query('COMMIT');
195 195
                 break;
196 196
             case 'rollback' :
197
-                $wpdb->query( 'ROLLBACK' );
197
+                $wpdb->query('ROLLBACK');
198 198
                 break;
199 199
             default :
200
-                $wpdb->query( 'START TRANSACTION' );
200
+                $wpdb->query('START TRANSACTION');
201 201
             break;
202 202
         }
203 203
     }
@@ -206,157 +206,157 @@  discard block
 block discarded – undo
206 206
 function wpinv_get_prefix() {
207 207
     $invoice_prefix = 'INV-';
208 208
     
209
-    return apply_filters( 'wpinv_get_prefix', $invoice_prefix );
209
+    return apply_filters('wpinv_get_prefix', $invoice_prefix);
210 210
 }
211 211
 
212 212
 function wpinv_get_business_logo() {
213
-    $business_logo = wpinv_get_option( 'logo' );
214
-    return apply_filters( 'wpinv_get_business_logo', $business_logo );
213
+    $business_logo = wpinv_get_option('logo');
214
+    return apply_filters('wpinv_get_business_logo', $business_logo);
215 215
 }
216 216
 
217 217
 function wpinv_get_business_name() {
218 218
     $business_name = wpinv_get_option('store_name');
219
-    return apply_filters( 'wpinv_get_business_name', $business_name );
219
+    return apply_filters('wpinv_get_business_name', $business_name);
220 220
 }
221 221
 
222 222
 function wpinv_get_blogname() {
223
-    return wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
223
+    return wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
224 224
 }
225 225
 
226 226
 function wpinv_get_admin_email() {
227
-    $admin_email = wpinv_get_option( 'admin_email', get_option( 'admin_email' ) );
228
-    return apply_filters( 'wpinv_admin_email', $admin_email );
227
+    $admin_email = wpinv_get_option('admin_email', get_option('admin_email'));
228
+    return apply_filters('wpinv_admin_email', $admin_email);
229 229
 }
230 230
 
231 231
 function wpinv_get_business_website() {
232
-    $business_website = home_url( '/' );
233
-    return apply_filters( 'wpinv_get_business_website', $business_website );
232
+    $business_website = home_url('/');
233
+    return apply_filters('wpinv_get_business_website', $business_website);
234 234
 }
235 235
 
236
-function wpinv_get_terms_text( $invoice_id = 0 ) {
236
+function wpinv_get_terms_text($invoice_id = 0) {
237 237
     $terms_text = '';
238
-    return apply_filters( 'wpinv_get_terms_text', $terms_text, $invoice_id );
238
+    return apply_filters('wpinv_get_terms_text', $terms_text, $invoice_id);
239 239
 }
240 240
 
241 241
 function wpinv_get_business_footer() {
242
-    $site_link = '<a target="_blank" href="' . esc_url( wpinv_get_business_website() ) . '">' . esc_html( wpinv_get_business_name() ) . '</a>';
243
-    $business_footer = wp_sprintf( __( 'Thanks for using %s', 'invoicing' ), $site_link );
244
-    return apply_filters( 'wpinv_get_business_footer', $business_footer );
242
+    $site_link = '<a target="_blank" href="' . esc_url(wpinv_get_business_website()) . '">' . esc_html(wpinv_get_business_name()) . '</a>';
243
+    $business_footer = wp_sprintf(__('Thanks for using %s', 'invoicing'), $site_link);
244
+    return apply_filters('wpinv_get_business_footer', $business_footer);
245 245
 }
246 246
 
247 247
 function wpinv_checkout_required_fields() {
248 248
     $required_fields = array();
249 249
     
250 250
     // Let payment gateways and other extensions determine if address fields should be required
251
-    $require_billing_details = apply_filters( 'wpinv_checkout_required_billing_details', wpinv_use_taxes() );
251
+    $require_billing_details = apply_filters('wpinv_checkout_required_billing_details', wpinv_use_taxes());
252 252
     
253
-    if ( $require_billing_details ) {
254
-		if ( (bool)wpinv_get_option( 'fname_mandatory' ) ) {
253
+    if ($require_billing_details) {
254
+		if ((bool) wpinv_get_option('fname_mandatory')) {
255 255
 			$required_fields['first_name'] = array(
256 256
 				'error_id' => 'invalid_first_name',
257
-				'error_message' => __( 'Please enter your first name', 'invoicing' )
257
+				'error_message' => __('Please enter your first name', 'invoicing')
258 258
 			);
259 259
 		}
260
-		if ( (bool)wpinv_get_option( 'address_mandatory' ) ) {
260
+		if ((bool) wpinv_get_option('address_mandatory')) {
261 261
 			$required_fields['address'] = array(
262 262
 				'error_id' => 'invalid_address',
263
-				'error_message' => __( 'Please enter your address', 'invoicing' )
263
+				'error_message' => __('Please enter your address', 'invoicing')
264 264
 			);
265 265
 		}
266
-		if ( (bool)wpinv_get_option( 'city_mandatory' ) ) {
266
+		if ((bool) wpinv_get_option('city_mandatory')) {
267 267
 			$required_fields['city'] = array(
268 268
 				'error_id' => 'invalid_city',
269
-				'error_message' => __( 'Please enter your billing city', 'invoicing' )
269
+				'error_message' => __('Please enter your billing city', 'invoicing')
270 270
 			);
271 271
 		}
272
-		if ( (bool)wpinv_get_option( 'state_mandatory' ) ) {
272
+		if ((bool) wpinv_get_option('state_mandatory')) {
273 273
 			$required_fields['state'] = array(
274 274
 				'error_id' => 'invalid_state',
275
-				'error_message' => __( 'Please enter billing state / province', 'invoicing' )
275
+				'error_message' => __('Please enter billing state / province', 'invoicing')
276 276
 			);
277 277
 		}
278
-		if ( (bool)wpinv_get_option( 'country_mandatory' ) ) {
278
+		if ((bool) wpinv_get_option('country_mandatory')) {
279 279
 			$required_fields['country'] = array(
280 280
 				'error_id' => 'invalid_country',
281
-				'error_message' => __( 'Please select your billing country', 'invoicing' )
281
+				'error_message' => __('Please select your billing country', 'invoicing')
282 282
 			);
283 283
 		}
284 284
     }
285 285
 
286
-    return apply_filters( 'wpinv_checkout_required_fields', $required_fields );
286
+    return apply_filters('wpinv_checkout_required_fields', $required_fields);
287 287
 }
288 288
 
289 289
 function wpinv_is_ssl_enforced() {
290
-    $ssl_enforced = wpinv_get_option( 'enforce_ssl', false );
291
-    return (bool) apply_filters( 'wpinv_is_ssl_enforced', $ssl_enforced );
290
+    $ssl_enforced = wpinv_get_option('enforce_ssl', false);
291
+    return (bool) apply_filters('wpinv_is_ssl_enforced', $ssl_enforced);
292 292
 }
293 293
 
294 294
 function wpinv_schedule_events() {
295 295
 
296 296
     // Get the timestamp for the next event.
297
-    $timestamp = wp_next_scheduled( 'wpinv_register_schedule_event_twicedaily' );
297
+    $timestamp = wp_next_scheduled('wpinv_register_schedule_event_twicedaily');
298 298
 
299
-    if ( $timestamp ) {
300
-        wp_unschedule_event( $timestamp, 'wpinv_register_schedule_event_twicedaily' );
299
+    if ($timestamp) {
300
+        wp_unschedule_event($timestamp, 'wpinv_register_schedule_event_twicedaily');
301 301
     }
302 302
 
303
-    if ( ! wp_next_scheduled( 'wpinv_register_schedule_event_daily' ) ) {
304
-        wp_schedule_event( current_time( 'timestamp' ), 'daily', 'wpinv_register_schedule_event_daily' );
303
+    if (!wp_next_scheduled('wpinv_register_schedule_event_daily')) {
304
+        wp_schedule_event(current_time('timestamp'), 'daily', 'wpinv_register_schedule_event_daily');
305 305
     }
306 306
 }
307
-add_action( 'wp', 'wpinv_schedule_events' );
307
+add_action('wp', 'wpinv_schedule_events');
308 308
 
309 309
 function wpinv_schedule_event_twicedaily() {
310 310
     wpinv_email_payment_reminders();
311 311
     wpinv_email_renewal_reminders();
312 312
 }
313
-add_action( 'wpinv_register_schedule_event_daily', 'wpinv_schedule_event_twicedaily' );
313
+add_action('wpinv_register_schedule_event_daily', 'wpinv_schedule_event_twicedaily');
314 314
 
315 315
 function wpinv_require_login_to_checkout() {
316
-    $return = wpinv_get_option( 'login_to_checkout', false );
317
-    return (bool) apply_filters( 'wpinv_require_login_to_checkout', $return );
316
+    $return = wpinv_get_option('login_to_checkout', false);
317
+    return (bool) apply_filters('wpinv_require_login_to_checkout', $return);
318 318
 }
319 319
 
320
-function wpinv_sequential_number_active( $type = '' ) {
321
-    $check = apply_filters( 'wpinv_pre_check_sequential_number_active', null, $type );
322
-    if ( null !== $check ) {
320
+function wpinv_sequential_number_active($type = '') {
321
+    $check = apply_filters('wpinv_pre_check_sequential_number_active', null, $type);
322
+    if (null !== $check) {
323 323
         return $check;
324 324
     }
325 325
     
326
-    return wpinv_get_option( 'sequential_invoice_number' );
326
+    return wpinv_get_option('sequential_invoice_number');
327 327
 }
328 328
 
329
-function wpinv_switch_to_locale( $locale = NULL ) {
329
+function wpinv_switch_to_locale($locale = NULL) {
330 330
     global $invoicing, $wpi_switch_locale;
331 331
 
332
-    if ( ! empty( $invoicing ) && function_exists( 'switch_to_locale' ) ) {
333
-        $locale = empty( $locale ) ? get_locale() : $locale;
332
+    if (!empty($invoicing) && function_exists('switch_to_locale')) {
333
+        $locale = empty($locale) ? get_locale() : $locale;
334 334
 
335
-        switch_to_locale( $locale );
335
+        switch_to_locale($locale);
336 336
 
337 337
         $wpi_switch_locale = $locale;
338 338
 
339
-        add_filter( 'plugin_locale', 'get_locale' );
339
+        add_filter('plugin_locale', 'get_locale');
340 340
 
341 341
         $invoicing->load_textdomain();
342 342
 
343
-        do_action( 'wpinv_switch_to_locale', $locale );
343
+        do_action('wpinv_switch_to_locale', $locale);
344 344
     }
345 345
 }
346 346
 
347 347
 function wpinv_restore_locale() {
348 348
     global $invoicing, $wpi_switch_locale;
349 349
     
350
-    if ( ! empty( $invoicing ) && function_exists( 'restore_previous_locale' ) && $wpi_switch_locale ) {
350
+    if (!empty($invoicing) && function_exists('restore_previous_locale') && $wpi_switch_locale) {
351 351
         restore_previous_locale();
352 352
 
353 353
         $wpi_switch_locale = NULL;
354 354
 
355
-        remove_filter( 'plugin_locale', 'get_locale' );
355
+        remove_filter('plugin_locale', 'get_locale');
356 356
 
357 357
         $invoicing->load_textdomain();
358 358
 
359
-        do_action( 'wpinv_restore_locale' );
359
+        do_action('wpinv_restore_locale');
360 360
     }
361 361
 }
362 362
 
@@ -364,22 +364,22 @@  discard block
 block discarded – undo
364 364
  * Returns the default form's id.
365 365
  */
366 366
 function wpinv_get_default_payment_form() {
367
-    $form = get_option( 'wpinv_default_payment_form' );
367
+    $form = get_option('wpinv_default_payment_form');
368 368
 
369
-    if ( empty( $form ) || 'publish' != get_post_status( $form ) ) {
369
+    if (empty($form) || 'publish' != get_post_status($form)) {
370 370
         $form = wp_insert_post(
371 371
             array(
372 372
                 'post_type'   => 'wpi_payment_form',
373
-                'post_title'  => __( 'Checkout (default)', 'invoicing' ),
373
+                'post_title'  => __('Checkout (default)', 'invoicing'),
374 374
                 'post_status' => 'publish',
375 375
                 'meta_input'  => array(
376
-                    'wpinv_form_elements' => wpinv_get_data( 'default-payment-form' ),
376
+                    'wpinv_form_elements' => wpinv_get_data('default-payment-form'),
377 377
                     'wpinv_form_items'    => array(),
378 378
                 )
379 379
             )
380 380
         );
381 381
 
382
-        update_option( 'wpinv_default_payment_form', $form );
382
+        update_option('wpinv_default_payment_form', $form);
383 383
     }
384 384
 
385 385
     return $form;
Please login to merge, or discard this patch.
widgets/invoice-history.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -44,15 +44,15 @@
 block discarded – undo
44 44
         parent::__construct( $options );
45 45
     }
46 46
 
47
-	/**
48
-	 * The Super block output function.
49
-	 *
50
-	 * @param array $args
51
-	 * @param array $widget_args
52
-	 * @param string $content
53
-	 *
54
-	 * @return mixed|string|bool
55
-	 */
47
+    /**
48
+     * The Super block output function.
49
+     *
50
+     * @param array $args
51
+     * @param array $widget_args
52
+     * @param string $content
53
+     *
54
+     * @return mixed|string|bool
55
+     */
56 56
     public function output( $args = array(), $widget_args = array(), $content = '' ) {
57 57
         return getpaid_invoice_history();
58 58
     }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
     exit;
4 4
 }
5 5
 
@@ -22,15 +22,15 @@  discard block
 block discarded – undo
22 22
             'block-keywords'=> "['invoicing','history']",
23 23
             'class_name'     => __CLASS__,
24 24
             'base_id'       => 'wpinv_history',
25
-            'name'          => __('GetPaid > Invoice History','invoicing'),
25
+            'name'          => __('GetPaid > Invoice History', 'invoicing'),
26 26
             'widget_ops'    => array(
27 27
                 'classname'   => 'wpinv-history-class bsui',
28
-                'description' => esc_html__('Displays invoice history.','invoicing'),
28
+                'description' => esc_html__('Displays invoice history.', 'invoicing'),
29 29
             ),
30 30
             'arguments'     => array(
31 31
                 'title'  => array(
32
-                    'title'       => __( 'Widget title', 'invoicing' ),
33
-                    'desc'        => __( 'Enter widget title.', 'invoicing' ),
32
+                    'title'       => __('Widget title', 'invoicing'),
33
+                    'desc'        => __('Enter widget title.', 'invoicing'),
34 34
                     'type'        => 'text',
35 35
                     'desc_tip'    => true,
36 36
                     'default'     => '',
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         );
42 42
 
43 43
 
44
-        parent::__construct( $options );
44
+        parent::__construct($options);
45 45
     }
46 46
 
47 47
 	/**
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @return mixed|string|bool
55 55
 	 */
56
-    public function output( $args = array(), $widget_args = array(), $content = '' ) {
56
+    public function output($args = array(), $widget_args = array(), $content = '') {
57 57
         return getpaid_invoice_history();
58 58
     }
59 59
 
Please login to merge, or discard this patch.
widgets/invoice-receipt.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -44,15 +44,15 @@
 block discarded – undo
44 44
         parent::__construct( $options );
45 45
     }
46 46
 
47
-	/**
48
-	 * The Super block output function.
49
-	 *
50
-	 * @param array $args
51
-	 * @param array $widget_args
52
-	 * @param string $content
53
-	 *
54
-	 * @return mixed|string|bool
55
-	 */
47
+    /**
48
+     * The Super block output function.
49
+     *
50
+     * @param array $args
51
+     * @param array $widget_args
52
+     * @param string $content
53
+     *
54
+     * @return mixed|string|bool
55
+     */
56 56
     public function output( $args = array(), $widget_args = array(), $content = '' ) {
57 57
         return wpinv_payment_receipt();
58 58
     }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
     exit;
4 4
 }
5 5
 
@@ -22,15 +22,15 @@  discard block
 block discarded – undo
22 22
             'block-keywords'=> "['invoicing','receipt']",
23 23
             'class_name'     => __CLASS__,
24 24
             'base_id'       => 'wpinv_receipt',
25
-            'name'          => __('GetPaid > Invoice Receipt','invoicing'),
25
+            'name'          => __('GetPaid > Invoice Receipt', 'invoicing'),
26 26
             'widget_ops'    => array(
27 27
                 'classname'   => 'wpinv-receipt-class bsui',
28
-                'description' => esc_html__('Displays invoice receipt after checkout.','invoicing'),
28
+                'description' => esc_html__('Displays invoice receipt after checkout.', 'invoicing'),
29 29
             ),
30 30
             'arguments'     => array(
31 31
                 'title'  => array(
32
-                    'title'       => __( 'Widget title', 'invoicing' ),
33
-                    'desc'        => __( 'Enter widget title.', 'invoicing' ),
32
+                    'title'       => __('Widget title', 'invoicing'),
33
+                    'desc'        => __('Enter widget title.', 'invoicing'),
34 34
                     'type'        => 'text',
35 35
                     'desc_tip'    => true,
36 36
                     'default'     => '',
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         );
42 42
 
43 43
 
44
-        parent::__construct( $options );
44
+        parent::__construct($options);
45 45
     }
46 46
 
47 47
 	/**
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @return mixed|string|bool
55 55
 	 */
56
-    public function output( $args = array(), $widget_args = array(), $content = '' ) {
56
+    public function output($args = array(), $widget_args = array(), $content = '') {
57 57
         return wpinv_payment_receipt();
58 58
     }
59 59
 
Please login to merge, or discard this patch.