Passed
Push — master ( 3a0618...5aee45 )
by Stiofan
05:13
created
includes/admin/register-settings.php 2 patches
Indentation   +296 added lines, -296 removed lines patch added patch discarded remove patch
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
     $cb      = "wpinv_{$option['type']}_callback";
197 197
     $section = "wpinv_settings_{$tab}_$section";
198 198
 
199
-	if ( isset( $option['desc'] ) && ! empty( $option['help-tip'] ) ) {
200
-		$tip   = wpinv_clean( $option['desc'] );
201
-		$name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>";
202
-		unset( $option['desc'] );
203
-	}
199
+    if ( isset( $option['desc'] ) && ! empty( $option['help-tip'] ) ) {
200
+        $tip   = wpinv_clean( $option['desc'] );
201
+        $name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>";
202
+        unset( $option['desc'] );
203
+    }
204 204
 
205 205
     // Loop through all tabs.
206 206
     add_settings_field(
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
             'faux'        => isset( $option['faux'] )        ? $option['faux']        : false,
228 228
             'onchange'    => isset( $option['onchange'] )   ? $option['onchange']     : '',
229 229
             'custom'      => isset( $option['custom'] )     ? $option['custom']       : '',
230
-			'default_content' => isset( $option['default_content'] )     ? $option['default_content']       : '',
231
-			'class'       => isset( $option['class'] )     ? $option['class']         : '',
232
-			'style'       => isset( $option['style'] )     ? $option['style']         : '',
230
+            'default_content' => isset( $option['default_content'] )     ? $option['default_content']       : '',
231
+            'class'       => isset( $option['class'] )     ? $option['class']         : '',
232
+            'style'       => isset( $option['style'] )     ? $option['style']         : '',
233 233
             'cols'        => isset( $option['cols'] ) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50,
234 234
             'rows'        => isset( $option['rows'] ) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5,
235 235
         )
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
  * @return array
244 244
  */
245 245
 function wpinv_get_registered_settings() {
246
-	return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) );
246
+    return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) );
247 247
 }
248 248
 
249 249
 /**
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
  */
263 263
 function wpinv_settings_sanitize( $input = array() ) {
264 264
 
265
-	$wpinv_options = wpinv_get_options();
266
-	$raw_referrer  = wp_get_raw_referer();
265
+    $wpinv_options = wpinv_get_options();
266
+    $raw_referrer  = wp_get_raw_referer();
267 267
 
268 268
     if ( empty( $raw_referrer ) ) {
269 269
         return $input;
@@ -271,9 +271,9 @@  discard block
 block discarded – undo
271 271
 
272 272
     wp_parse_str( $raw_referrer, $referrer );
273 273
 
274
-	if ( empty( $referrer['tab'] ) ) {
274
+    if ( empty( $referrer['tab'] ) ) {
275 275
         return $input;
276
-	}
276
+    }
277 277
 
278 278
     $settings = wpinv_get_registered_settings();
279 279
     $tab      = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general';
@@ -295,10 +295,10 @@  discard block
 block discarded – undo
295 295
         }
296 296
 
297 297
         // General filter
298
-		$input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
298
+        $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
299 299
 
300
-		// Key specific filter.
301
-		$input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] );
300
+        // Key specific filter.
301
+        $input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] );
302 302
     }
303 303
 
304 304
     // Loop through the whitelist and unset any that are empty for the tab being saved
@@ -354,14 +354,14 @@  discard block
 block discarded – undo
354 354
 
355 355
     foreach ( $new_rates as $rate ) {
356 356
 
357
-		$rate['rate']    = wpinv_sanitize_amount( $rate['rate'] );
358
-		$rate['name']    = sanitize_text_field( $rate['name'] );
359
-		$rate['state']   = sanitize_text_field( $rate['state'] );
360
-		$rate['country'] = sanitize_text_field( $rate['country'] );
361
-		$rate['global']  = empty( $rate['state'] );
362
-		$tax_rates[]     = $rate;
357
+        $rate['rate']    = wpinv_sanitize_amount( $rate['rate'] );
358
+        $rate['name']    = sanitize_text_field( $rate['name'] );
359
+        $rate['state']   = sanitize_text_field( $rate['state'] );
360
+        $rate['country'] = sanitize_text_field( $rate['country'] );
361
+        $rate['global']  = empty( $rate['state'] );
362
+        $tax_rates[]     = $rate;
363 363
 
364
-	}
364
+    }
365 365
 
366 366
     update_option( 'wpinv_tax_rates', $tax_rates );
367 367
 
@@ -379,11 +379,11 @@  discard block
 block discarded – undo
379 379
     $tabs['general']  = __( 'General', 'invoicing' );
380 380
     $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' );
381 381
     $tabs['taxes']    = __( 'Taxes', 'invoicing' );
382
-	$tabs['emails']   = __( 'Emails', 'invoicing' );
382
+    $tabs['emails']   = __( 'Emails', 'invoicing' );
383 383
 
384
-	if ( count( getpaid_get_integration_settings() ) > 0 ) {
385
-		$tabs['integrations'] = __( 'Integrations', 'invoicing' );
386
-	}
384
+    if ( count( getpaid_get_integration_settings() ) > 0 ) {
385
+        $tabs['integrations'] = __( 'Integrations', 'invoicing' );
386
+    }
387 387
 
388 388
     $tabs['privacy']  = __( 'Privacy', 'invoicing' );
389 389
     $tabs['misc']     = __( 'Misc', 'invoicing' );
@@ -421,14 +421,14 @@  discard block
 block discarded – undo
421 421
         ) ),
422 422
         'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array(
423 423
             'main'  => __( 'Tax Settings', 'invoicing' ),
424
-			'rates' => __( 'Tax Rates', 'invoicing' ),
425
-			'vat'   => __( 'EU VAT Settings', 'invoicing' )
424
+            'rates' => __( 'Tax Rates', 'invoicing' ),
425
+            'vat'   => __( 'EU VAT Settings', 'invoicing' )
426 426
         ) ),
427 427
         'emails' => apply_filters( 'wpinv_settings_sections_emails', array(
428 428
             'main' => __( 'Email Settings', 'invoicing' ),
429
-		) ),
429
+        ) ),
430 430
 
431
-		'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ),
431
+        'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ),
432 432
 
433 433
         'privacy' => apply_filters( 'wpinv_settings_sections_privacy', array(
434 434
             'main' => __( 'Privacy policy', 'invoicing' ),
@@ -448,48 +448,48 @@  discard block
 block discarded – undo
448 448
 }
449 449
 
450 450
 function wpinv_get_pages( $with_slug = false, $default_label = NULL ) {
451
-	$pages_options = array();
451
+    $pages_options = array();
452 452
 
453
-	if( $default_label !== NULL && $default_label !== false ) {
454
-		$pages_options = array( '' => $default_label ); // Blank option
455
-	}
453
+    if( $default_label !== NULL && $default_label !== false ) {
454
+        $pages_options = array( '' => $default_label ); // Blank option
455
+    }
456 456
 
457
-	$pages = get_pages();
458
-	if ( $pages ) {
459
-		foreach ( $pages as $page ) {
460
-			$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
457
+    $pages = get_pages();
458
+    if ( $pages ) {
459
+        foreach ( $pages as $page ) {
460
+            $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
461 461
             $pages_options[ $page->ID ] = $title;
462
-		}
463
-	}
462
+        }
463
+    }
464 464
 
465
-	return $pages_options;
465
+    return $pages_options;
466 466
 }
467 467
 
468 468
 function wpinv_header_callback( $args ) {
469
-	if ( !empty( $args['desc'] ) ) {
469
+    if ( !empty( $args['desc'] ) ) {
470 470
         echo $args['desc'];
471 471
     }
472 472
 }
473 473
 
474 474
 function wpinv_hidden_callback( $args ) {
475 475
 
476
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
477
-	$value   = wpinv_get_option( $args['id'], $std );
476
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
477
+    $value   = wpinv_get_option( $args['id'], $std );
478 478
 
479
-	if ( isset( $args['set_value'] ) ) {
480
-		$value = $args['set_value'];
481
-	}
479
+    if ( isset( $args['set_value'] ) ) {
480
+        $value = $args['set_value'];
481
+    }
482 482
 
483
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
484
-		$args['readonly'] = true;
485
-		$name  = '';
486
-	} else {
487
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
488
-	}
483
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
484
+        $args['readonly'] = true;
485
+        $name  = '';
486
+    } else {
487
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
488
+    }
489 489
 
490
-	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
490
+    $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
491 491
     
492
-	echo $html;
492
+    echo $html;
493 493
 }
494 494
 
495 495
 /**
@@ -497,12 +497,12 @@  discard block
 block discarded – undo
497 497
  */
498 498
 function wpinv_checkbox_callback( $args ) {
499 499
 
500
-	$std = isset( $args['std'] ) ? $args['std'] : '';
501
-	$std = wpinv_get_option( $args['id'], $std );
502
-	$id  = esc_attr( $args['id'] );
500
+    $std = isset( $args['std'] ) ? $args['std'] : '';
501
+    $std = wpinv_get_option( $args['id'], $std );
502
+    $id  = esc_attr( $args['id'] );
503 503
 
504
-	getpaid_hidden_field( "wpinv_settings[$id]", '0' );
505
-	?>
504
+    getpaid_hidden_field( "wpinv_settings[$id]", '0' );
505
+    ?>
506 506
 		<fieldset>
507 507
 			<label>
508 508
 				<input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked( empty( $std ), false ); ?> value="1" type="checkbox">
@@ -514,75 +514,75 @@  discard block
 block discarded – undo
514 514
 
515 515
 function wpinv_multicheck_callback( $args ) {
516 516
 
517
-	$sanitize_id = wpinv_sanitize_key( $args['id'] );
518
-	$class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
517
+    $sanitize_id = wpinv_sanitize_key( $args['id'] );
518
+    $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
519 519
 
520
-	if ( ! empty( $args['options'] ) ) {
520
+    if ( ! empty( $args['options'] ) ) {
521 521
 
522
-		$std     = isset( $args['std'] ) ? $args['std'] : array();
523
-		$value   = wpinv_get_option( $args['id'], $std );
522
+        $std     = isset( $args['std'] ) ? $args['std'] : array();
523
+        $value   = wpinv_get_option( $args['id'], $std );
524 524
 
525
-		echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
525
+        echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
526 526
         foreach( $args['options'] as $key => $option ):
527
-			$sanitize_key = wpinv_sanitize_key( $key );
528
-			if ( in_array( $sanitize_key, $value ) ) { 
529
-				$enabled = $sanitize_key;
530
-			} else { 
531
-				$enabled = NULL; 
532
-			}
533
-			echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/>&nbsp;';
534
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
535
-		endforeach;
536
-		echo '</div>';
537
-		echo '<p class="description">' . $args['desc'] . '</p>';
538
-	}
527
+            $sanitize_key = wpinv_sanitize_key( $key );
528
+            if ( in_array( $sanitize_key, $value ) ) { 
529
+                $enabled = $sanitize_key;
530
+            } else { 
531
+                $enabled = NULL; 
532
+            }
533
+            echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/>&nbsp;';
534
+            echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
535
+        endforeach;
536
+        echo '</div>';
537
+        echo '<p class="description">' . $args['desc'] . '</p>';
538
+    }
539 539
 }
540 540
 
541 541
 function wpinv_payment_icons_callback( $args ) {
542 542
     
543 543
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
544
-	$value   = wpinv_get_option( $args['id'], false);
544
+    $value   = wpinv_get_option( $args['id'], false);
545 545
 
546
-	if ( ! empty( $args['options'] ) ) {
547
-		foreach( $args['options'] as $key => $option ) {
546
+    if ( ! empty( $args['options'] ) ) {
547
+        foreach( $args['options'] as $key => $option ) {
548 548
             $sanitize_key = wpinv_sanitize_key( $key );
549 549
             
550
-			if( empty( $value ) ) {
551
-				$enabled = $option;
552
-			} else {
553
-				$enabled = NULL;
554
-			}
555
-
556
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
557
-
558
-				echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/>&nbsp;';
559
-
560
-				if ( wpinv_string_is_image_url( $key ) ) {
561
-					echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
562
-				} else {
563
-					$card = strtolower( str_replace( ' ', '', $option ) );
564
-
565
-					if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
566
-						$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
567
-					} else {
568
-						$image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
569
-						$content_dir = WP_CONTENT_DIR;
570
-
571
-						if ( function_exists( 'wp_normalize_path' ) ) {
572
-							// Replaces backslashes with forward slashes for Windows systems
573
-							$image = wp_normalize_path( $image );
574
-							$content_dir = wp_normalize_path( $content_dir );
575
-						}
576
-
577
-						$image = str_replace( $content_dir, content_url(), $image );
578
-					}
579
-
580
-					echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
581
-				}
582
-			echo $option . '</label>';
583
-		}
584
-		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
585
-	}
550
+            if( empty( $value ) ) {
551
+                $enabled = $option;
552
+            } else {
553
+                $enabled = NULL;
554
+            }
555
+
556
+            echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
557
+
558
+                echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/>&nbsp;';
559
+
560
+                if ( wpinv_string_is_image_url( $key ) ) {
561
+                    echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
562
+                } else {
563
+                    $card = strtolower( str_replace( ' ', '', $option ) );
564
+
565
+                    if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
566
+                        $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
567
+                    } else {
568
+                        $image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
569
+                        $content_dir = WP_CONTENT_DIR;
570
+
571
+                        if ( function_exists( 'wp_normalize_path' ) ) {
572
+                            // Replaces backslashes with forward slashes for Windows systems
573
+                            $image = wp_normalize_path( $image );
574
+                            $content_dir = wp_normalize_path( $content_dir );
575
+                        }
576
+
577
+                        $image = str_replace( $content_dir, content_url(), $image );
578
+                    }
579
+
580
+                    echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
581
+                }
582
+            echo $option . '</label>';
583
+        }
584
+        echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
585
+    }
586 586
 }
587 587
 
588 588
 /**
@@ -590,9 +590,9 @@  discard block
 block discarded – undo
590 590
  */
591 591
 function wpinv_radio_callback( $args ) {
592 592
 
593
-	$std = isset( $args['std'] ) ? $args['std'] : '';
594
-	$std = wpinv_get_option( $args['id'], $std );
595
-	?>
593
+    $std = isset( $args['std'] ) ? $args['std'] : '';
594
+    $std = wpinv_get_option( $args['id'], $std );
595
+    ?>
596 596
 		<fieldset>
597 597
 			<ul id="wpinv-settings-<?php echo esc_attr( $args['id'] ); ?>" style="margin-top: 0;">
598 598
 				<?php foreach( $args['options'] as $key => $option ) : ?>
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 			</ul>
607 607
 		</fieldset>
608 608
 	<?php
609
-	getpaid_settings_description_callback( $args );
609
+    getpaid_settings_description_callback( $args );
610 610
 }
611 611
 
612 612
 /**
@@ -614,10 +614,10 @@  discard block
 block discarded – undo
614 614
  */
615 615
 function getpaid_settings_description_callback( $args ) {
616 616
 
617
-	if ( ! empty( $args['desc'] ) ) {
618
-		$description = wp_kses_post( $args['desc'] );
619
-		echo "<p class='description'>$description</p>";
620
-	}
617
+    if ( ! empty( $args['desc'] ) ) {
618
+        $description = wp_kses_post( $args['desc'] );
619
+        echo "<p class='description'>$description</p>";
620
+    }
621 621
 
622 622
 }
623 623
 
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
  */
627 627
 function wpinv_gateways_callback() {
628 628
 
629
-	?>
629
+    ?>
630 630
 		</td>
631 631
 	</tr>
632 632
 	<tr class="bsui">
@@ -640,22 +640,22 @@  discard block
 block discarded – undo
640 640
     
641 641
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
642 642
     $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
643
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
644
-	$value   = wpinv_get_option( $args['id'], $std );
643
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
644
+    $value   = wpinv_get_option( $args['id'], $std );
645 645
 
646
-	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >';
646
+    echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >';
647 647
 
648
-	foreach ( $args['options'] as $key => $option ) :
649
-		if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
648
+    foreach ( $args['options'] as $key => $option ) :
649
+        if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
650 650
             $selected = selected( $key, $args['selected'], false );
651 651
         } else {
652 652
             $selected = selected( $key, $value, false );
653 653
         }
654
-		echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
655
-	endforeach;
654
+        echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
655
+    endforeach;
656 656
 
657
-	echo '</select>';
658
-	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
657
+    echo '</select>';
658
+    echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
659 659
 }
660 660
 
661 661
 /**
@@ -666,29 +666,29 @@  discard block
 block discarded – undo
666 666
  */
667 667
 function wpinv_settings_attrs_helper( $args ) {
668 668
 
669
-	$value        = isset( $args['std'] ) ? $args['std'] : '';
670
-	$id           = esc_attr( $args['id'] );
671
-	$placeholder  = esc_attr( $args['placeholder'] );
669
+    $value        = isset( $args['std'] ) ? $args['std'] : '';
670
+    $id           = esc_attr( $args['id'] );
671
+    $placeholder  = esc_attr( $args['placeholder'] );
672 672
 
673
-	if ( ! empty( $args['faux'] ) ) {
674
-		$args['readonly'] = true;
675
-		$name             = '';
676
-	} else {
677
-		$value  = wpinv_get_option( $args['id'], $value );
678
-		$name   = "wpinv_settings[$id]";
679
-	}
673
+    if ( ! empty( $args['faux'] ) ) {
674
+        $args['readonly'] = true;
675
+        $name             = '';
676
+    } else {
677
+        $value  = wpinv_get_option( $args['id'], $value );
678
+        $name   = "wpinv_settings[$id]";
679
+    }
680 680
 
681
-	$value    = is_scalar( $value ) ? esc_attr( $value ) : '';
682
-	$class    = esc_attr( $args['class'] );
683
-	$style    = esc_attr( $args['style'] );
684
-	$readonly = empty( $args['readonly'] ) ? '' : 'readonly onclick="this.select()"';
681
+    $value    = is_scalar( $value ) ? esc_attr( $value ) : '';
682
+    $class    = esc_attr( $args['class'] );
683
+    $style    = esc_attr( $args['style'] );
684
+    $readonly = empty( $args['readonly'] ) ? '' : 'readonly onclick="this.select()"';
685 685
 
686
-	$onchange = '';
686
+    $onchange = '';
687 687
     if ( ! empty( $args['onchange'] ) ) {
688 688
         $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"';
689
-	}
689
+    }
690 690
 
691
-	return "name='$name' id='wpinv-settings-$id' style='$style' value='$value' class='$class' placeholder='$placeholder' data-placeholder='$placeholder' $onchange $readonly";
691
+    return "name='$name' id='wpinv-settings-$id' style='$style' value='$value' class='$class' placeholder='$placeholder' data-placeholder='$placeholder' $onchange $readonly";
692 692
 }
693 693
 
694 694
 /**
@@ -696,11 +696,11 @@  discard block
 block discarded – undo
696 696
  */
697 697
 function wpinv_text_callback( $args ) {
698 698
 
699
-	$desc = wp_kses_post( $args['desc'] );
700
-	$desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
701
-	$attr = wpinv_settings_attrs_helper( $args );
699
+    $desc = wp_kses_post( $args['desc'] );
700
+    $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
701
+    $attr = wpinv_settings_attrs_helper( $args );
702 702
 
703
-	?>
703
+    ?>
704 704
 		<label style="width: 100%;">
705 705
 			<input type="text" <?php echo $attr; ?>>
706 706
 			<?php echo $desc; ?>
@@ -714,14 +714,14 @@  discard block
 block discarded – undo
714 714
  */
715 715
 function wpinv_number_callback( $args ) {
716 716
 
717
-	$desc = wp_kses_post( $args['desc'] );
718
-	$desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
719
-	$attr = wpinv_settings_attrs_helper( $args );
720
-	$max  = intval( $args['max'] );
721
-	$min  = intval( $args['min'] );
722
-	$step = floatval( $args['step'] );
717
+    $desc = wp_kses_post( $args['desc'] );
718
+    $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
719
+    $attr = wpinv_settings_attrs_helper( $args );
720
+    $max  = intval( $args['max'] );
721
+    $min  = intval( $args['min'] );
722
+    $step = floatval( $args['step'] );
723 723
 
724
-	?>
724
+    ?>
725 725
 		<label style="width: 100%;">
726 726
 			<input type="number" step="<?php echo $step; ?>" max="<?php echo $max; ?>" min="<?php echo $min; ?>" <?php echo $attr; ?>>
727 727
 			<?php echo $desc; ?>
@@ -733,36 +733,36 @@  discard block
 block discarded – undo
733 733
 function wpinv_textarea_callback( $args ) {
734 734
     
735 735
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
736
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
737
-	$value   = wpinv_get_option( $args['id'], $std );
736
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
737
+    $value   = wpinv_get_option( $args['id'], $std );
738 738
 
739 739
     $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
740 740
     $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text';
741 741
 
742
-	$html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
743
-	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
742
+    $html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
743
+    $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
744 744
 
745
-	echo $html;
745
+    echo $html;
746 746
 }
747 747
 
748 748
 function wpinv_password_callback( $args ) {
749 749
     
750 750
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
751
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
752
-	$value   = wpinv_get_option( $args['id'], $std );
751
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
752
+    $value   = wpinv_get_option( $args['id'], $std );
753 753
 
754
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
755
-	$html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>';
756
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
754
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
755
+    $html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>';
756
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
757 757
 
758
-	echo $html;
758
+    echo $html;
759 759
 }
760 760
 
761 761
 function wpinv_missing_callback($args) {
762
-	printf(
763
-		__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
764
-		'<strong>' . $args['id'] . '</strong>'
765
-	);
762
+    printf(
763
+        __( 'The callback function used for the %s setting is missing.', 'invoicing' ),
764
+        '<strong>' . $args['id'] . '</strong>'
765
+    );
766 766
 }
767 767
 
768 768
 /**
@@ -770,14 +770,14 @@  discard block
 block discarded – undo
770 770
  */
771 771
 function wpinv_select_callback( $args ) {
772 772
 
773
-	$desc   = wp_kses_post( $args['desc'] );
774
-	$desc   = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
775
-	$attr   = wpinv_settings_attrs_helper( $args );
776
-	$value  = isset( $args['std'] ) ? $args['std'] : '';
777
-	$value  = wpinv_get_option( $args['id'], $value );
778
-	$rand   = uniqid( 'random_id' );
773
+    $desc   = wp_kses_post( $args['desc'] );
774
+    $desc   = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
775
+    $attr   = wpinv_settings_attrs_helper( $args );
776
+    $value  = isset( $args['std'] ) ? $args['std'] : '';
777
+    $value  = wpinv_get_option( $args['id'], $value );
778
+    $rand   = uniqid( 'random_id' );
779 779
 
780
-	?>
780
+    ?>
781 781
 		<label style="width: 100%;">
782 782
 			<select <?php echo $attr; ?>>
783 783
 				<?php foreach ( $args['options'] as $option => $name ) : ?>
@@ -810,104 +810,104 @@  discard block
 block discarded – undo
810 810
 function wpinv_color_select_callback( $args ) {
811 811
     
812 812
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
813
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
814
-	$value   = wpinv_get_option( $args['id'], $std );
813
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
814
+    $value   = wpinv_get_option( $args['id'], $std );
815 815
 
816
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
816
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
817 817
 
818
-	foreach ( $args['options'] as $option => $color ) {
819
-		$selected = selected( $option, $value, false );
820
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
821
-	}
818
+    foreach ( $args['options'] as $option => $color ) {
819
+        $selected = selected( $option, $value, false );
820
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
821
+    }
822 822
 
823
-	$html .= '</select>';
824
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
823
+    $html .= '</select>';
824
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
825 825
 
826
-	echo $html;
826
+    echo $html;
827 827
 }
828 828
 
829 829
 function wpinv_rich_editor_callback( $args ) {
830
-	global $wp_version;
830
+    global $wp_version;
831 831
     
832 832
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
833 833
 
834
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
835
-	$value   = wpinv_get_option( $args['id'], $std );
834
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
835
+    $value   = wpinv_get_option( $args['id'], $std );
836 836
 	
837
-	if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) {
838
-		$value = $std;
839
-	}
837
+    if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) {
838
+        $value = $std;
839
+    }
840 840
 
841
-	$rows = isset( $args['size'] ) ? $args['size'] : 20;
841
+    $rows = isset( $args['size'] ) ? $args['size'] : 20;
842 842
 
843
-	$html = '<div class="getpaid-settings-editor-input">';
844
-	if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
845
-		ob_start();
846
-		wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) );
847
-		$html .= ob_get_clean();
848
-	} else {
849
-		$html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
850
-	}
843
+    $html = '<div class="getpaid-settings-editor-input">';
844
+    if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
845
+        ob_start();
846
+        wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) );
847
+        $html .= ob_get_clean();
848
+    } else {
849
+        $html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
850
+    }
851 851
 
852
-	$html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
852
+    $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
853 853
 
854
-	echo $html;
854
+    echo $html;
855 855
 }
856 856
 
857 857
 function wpinv_upload_callback( $args ) {
858 858
     
859 859
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
860 860
 
861
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
862
-	$value   = wpinv_get_option( $args['id'], $std );
861
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
862
+    $value   = wpinv_get_option( $args['id'], $std );
863 863
 
864
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
865
-	$html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
866
-	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
867
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
864
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
865
+    $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
866
+    $html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
867
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
868 868
 
869
-	echo $html;
869
+    echo $html;
870 870
 }
871 871
 
872 872
 function wpinv_color_callback( $args ) {
873 873
 
874
-	$std         = isset( $args['std'] ) ? $args['std'] : '';
875
-	$value       = wpinv_get_option( $args['id'], $std );
874
+    $std         = isset( $args['std'] ) ? $args['std'] : '';
875
+    $value       = wpinv_get_option( $args['id'], $std );
876 876
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
877 877
 
878
-	$html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $std ) . '" />';
879
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
878
+    $html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $std ) . '" />';
879
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
880 880
 
881
-	echo $html;
881
+    echo $html;
882 882
 }
883 883
 
884 884
 function wpinv_country_states_callback($args) {
885 885
 
886
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
887
-	$value   = wpinv_get_option( $args['id'], $std );
886
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
887
+    $value   = wpinv_get_option( $args['id'], $std );
888 888
 
889 889
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
890 890
 
891
-	if ( isset( $args['placeholder'] ) ) {
892
-		$placeholder = $args['placeholder'];
893
-	} else {
894
-		$placeholder = '';
895
-	}
891
+    if ( isset( $args['placeholder'] ) ) {
892
+        $placeholder = $args['placeholder'];
893
+    } else {
894
+        $placeholder = '';
895
+    }
896 896
 
897
-	$states = wpinv_get_country_states();
897
+    $states = wpinv_get_country_states();
898 898
 
899
-	$class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
900
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
899
+    $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
900
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
901 901
 
902
-	foreach ( $states as $option => $name ) {
903
-		$selected = selected( $option, $value, false );
904
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
905
-	}
902
+    foreach ( $states as $option => $name ) {
903
+        $selected = selected( $option, $value, false );
904
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
905
+    }
906 906
 
907
-	$html .= '</select>';
908
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
907
+    $html .= '</select>';
908
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
909 909
 
910
-	echo $html;
910
+    echo $html;
911 911
 }
912 912
 
913 913
 /**
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
  */
916 916
 function wpinv_tax_rates_callback() {
917 917
 	
918
-	?>
918
+    ?>
919 919
 		</td>
920 920
 	</tr>
921 921
 	<tr class="bsui">
@@ -930,17 +930,17 @@  discard block
 block discarded – undo
930 930
  * Displays a tax rate' edit row.
931 931
  */
932 932
 function wpinv_tax_rate_callback( $tax_rate, $key, $echo = true ) {
933
-	ob_start();
933
+    ob_start();
934 934
 
935
-	$key                      = sanitize_key( $key );
936
-	$tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate'];
937
-	include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php';
935
+    $key                      = sanitize_key( $key );
936
+    $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate'];
937
+    include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php';
938 938
 
939
-	if ( $echo ) {
940
-		echo ob_get_clean();
941
-	} else {
942
-		return ob_get_clean(); 
943
-	}
939
+    if ( $echo ) {
940
+        echo ob_get_clean();
941
+    } else {
942
+        return ob_get_clean(); 
943
+    }
944 944
 
945 945
 }
946 946
 
@@ -968,14 +968,14 @@  discard block
 block discarded – undo
968 968
                 </td>
969 969
                 <td>
970 970
 					<a href="<?php
971
-						echo esc_url(
972
-							wp_nonce_url(
973
-								add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ),
974
-								'getpaid-nonce',
975
-								'getpaid-nonce'
976
-							)
977
-						);
978
-					?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
971
+                        echo esc_url(
972
+                            wp_nonce_url(
973
+                                add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ),
974
+                                'getpaid-nonce',
975
+                                'getpaid-nonce'
976
+                            )
977
+                        );
978
+                    ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
979 979
                 </td>
980 980
             </tr>
981 981
 			<tr>
@@ -985,14 +985,14 @@  discard block
 block discarded – undo
985 985
                 </td>
986 986
                 <td>
987 987
 					<a href="<?php
988
-						echo esc_url(
989
-							wp_nonce_url(
990
-								add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ),
991
-								'getpaid-nonce',
992
-								'getpaid-nonce'
993
-							)
994
-						);
995
-					?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
988
+                        echo esc_url(
989
+                            wp_nonce_url(
990
+                                add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ),
991
+                                'getpaid-nonce',
992
+                                'getpaid-nonce'
993
+                            )
994
+                        );
995
+                    ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
996 996
                 </td>
997 997
             </tr>
998 998
 			<tr>
@@ -1002,14 +1002,14 @@  discard block
 block discarded – undo
1002 1002
                 </td>
1003 1003
                 <td>
1004 1004
 					<a href="<?php
1005
-						echo esc_url(
1006
-							wp_nonce_url(
1007
-								add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ),
1008
-								'getpaid-nonce',
1009
-								'getpaid-nonce'
1010
-							)
1011
-						);
1012
-					?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
1005
+                        echo esc_url(
1006
+                            wp_nonce_url(
1007
+                                add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ),
1008
+                                'getpaid-nonce',
1009
+                                'getpaid-nonce'
1010
+                            )
1011
+                        );
1012
+                    ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
1013 1013
                 </td>
1014 1014
             </tr>
1015 1015
 
@@ -1020,14 +1020,14 @@  discard block
 block discarded – undo
1020 1020
                 </td>
1021 1021
                 <td>
1022 1022
 					<a href="<?php
1023
-						echo esc_url(
1024
-							wp_nonce_url(
1025
-								add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ),
1026
-								'getpaid-nonce',
1027
-								'getpaid-nonce'
1028
-							)
1029
-						);
1030
-					?>" class="button button-primary"><?php _e( 'Run', 'invoicing' );?></a>
1023
+                        echo esc_url(
1024
+                            wp_nonce_url(
1025
+                                add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ),
1026
+                                'getpaid-nonce',
1027
+                                'getpaid-nonce'
1028
+                            )
1029
+                        );
1030
+                    ?>" class="button button-primary"><?php _e( 'Run', 'invoicing' );?></a>
1031 1031
                 </td>
1032 1032
             </tr>
1033 1033
 
@@ -1041,19 +1041,19 @@  discard block
 block discarded – undo
1041 1041
 
1042 1042
 
1043 1043
 function wpinv_descriptive_text_callback( $args ) {
1044
-	echo wp_kses_post( $args['desc'] );
1044
+    echo wp_kses_post( $args['desc'] );
1045 1045
 }
1046 1046
 
1047 1047
 function wpinv_raw_html_callback( $args ) {
1048
-	echo $args['desc'];
1048
+    echo $args['desc'];
1049 1049
 }
1050 1050
 
1051 1051
 function wpinv_hook_callback( $args ) {
1052
-	do_action( 'wpinv_' . $args['id'], $args );
1052
+    do_action( 'wpinv_' . $args['id'], $args );
1053 1053
 }
1054 1054
 
1055 1055
 function wpinv_set_settings_cap() {
1056
-	return wpinv_get_capability();
1056
+    return wpinv_get_capability();
1057 1057
 }
1058 1058
 add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' );
1059 1059
 
@@ -1087,15 +1087,15 @@  discard block
 block discarded – undo
1087 1087
  */
1088 1088
 function wpinv_get_merge_tags_help_text( $subscription = false ) {
1089 1089
 
1090
-	$url  = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f';
1091
-	$link = sprintf(
1092
-		'<strong><a href="%s" target="_blank">%s</a></strong>',
1093
-		$url,
1094
-		esc_html__( 'View available merge tags.', 'wpinv-quotes' )
1095
-	);
1090
+    $url  = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f';
1091
+    $link = sprintf(
1092
+        '<strong><a href="%s" target="_blank">%s</a></strong>',
1093
+        $url,
1094
+        esc_html__( 'View available merge tags.', 'wpinv-quotes' )
1095
+    );
1096 1096
 
1097
-	$description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' );
1097
+    $description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' );
1098 1098
 
1099
-	return "$description $link";
1099
+    return "$description $link";
1100 1100
 
1101 1101
 }
Please login to merge, or discard this patch.
Spacing   +376 added lines, -376 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @since   1.0.0
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Retrieves all default settings.
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 function wpinv_get_settings() {
17 17
     $defaults = array();
18 18
 
19
-    foreach ( array_values( wpinv_get_registered_settings() ) as $tab_settings ) {
19
+    foreach (array_values(wpinv_get_registered_settings()) as $tab_settings) {
20 20
 
21
-        foreach ( array_values( $tab_settings ) as $section_settings ) {
21
+        foreach (array_values($tab_settings) as $section_settings) {
22 22
 
23
-            foreach ( $section_settings as $key => $setting ) {
24
-                if ( isset( $setting['std'] ) ) {
25
-                    $defaults[ $key ] = $setting['std'];
23
+            foreach ($section_settings as $key => $setting) {
24
+                if (isset($setting['std'])) {
25
+                    $defaults[$key] = $setting['std'];
26 26
                 }
27 27
             }
28 28
 
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
     global $wpinv_options;
44 44
 
45 45
     // Try fetching the saved options.
46
-    if ( empty( $wpinv_options ) ) {
47
-        $wpinv_options = get_option( 'wpinv_settings' );
46
+    if (empty($wpinv_options)) {
47
+        $wpinv_options = get_option('wpinv_settings');
48 48
     }
49 49
 
50 50
     // If that fails, don't fetch the default settings to prevent a loop.
51
-    if ( ! is_array( $wpinv_options ) ) {
51
+    if (!is_array($wpinv_options)) {
52 52
         $wpinv_options = array();
53 53
     }
54 54
 
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
  * @param mixed $default The default value to use if the setting has not been set.
63 63
  * @return mixed
64 64
  */
65
-function wpinv_get_option( $key = '', $default = false ) {
65
+function wpinv_get_option($key = '', $default = false) {
66 66
 
67 67
     $options = wpinv_get_options();
68
-    $value   = isset( $options[ $key ] ) ? $options[ $key ] : $default;
69
-    $value   = apply_filters( 'wpinv_get_option', $value, $key, $default );
68
+    $value   = isset($options[$key]) ? $options[$key] : $default;
69
+    $value   = apply_filters('wpinv_get_option', $value, $key, $default);
70 70
 
71
-    return apply_filters( 'wpinv_get_option_' . $key, $value, $key, $default );
71
+    return apply_filters('wpinv_get_option_' . $key, $value, $key, $default);
72 72
 }
73 73
 
74 74
 /**
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
  * @param array $options the new options.
78 78
  * @return bool
79 79
  */
80
-function wpinv_update_options( $options ) {
80
+function wpinv_update_options($options) {
81 81
     global $wpinv_options;
82 82
 
83 83
     // update the option.
84
-    if ( is_array( $options ) && update_option( 'wpinv_settings', $options ) ) {
84
+    if (is_array($options) && update_option('wpinv_settings', $options)) {
85 85
         $wpinv_options = $options;
86 86
         return true;
87 87
     }
@@ -96,24 +96,24 @@  discard block
 block discarded – undo
96 96
  * @param mixed $value The setting value.
97 97
  * @return bool
98 98
  */
99
-function wpinv_update_option( $key = '', $value = false ) {
99
+function wpinv_update_option($key = '', $value = false) {
100 100
 
101 101
     // If no key, exit.
102
-    if ( empty( $key ) ) {
102
+    if (empty($key)) {
103 103
         return false;
104 104
     }
105 105
 
106 106
     // Maybe delete the option instead.
107
-    if ( is_null( $value ) ) {
108
-        return wpinv_delete_option( $key );
107
+    if (is_null($value)) {
108
+        return wpinv_delete_option($key);
109 109
     }
110 110
 
111 111
     // Prepare the new options.
112 112
     $options         = wpinv_get_options();
113
-    $options[ $key ] = apply_filters( 'wpinv_update_option', $value, $key );
113
+    $options[$key] = apply_filters('wpinv_update_option', $value, $key);
114 114
 
115 115
     // Save the new options.
116
-    return wpinv_update_options( $options );
116
+    return wpinv_update_options($options);
117 117
 
118 118
 }
119 119
 
@@ -123,18 +123,18 @@  discard block
 block discarded – undo
123 123
  * @param string $key the setting key.
124 124
  * @return bool
125 125
  */
126
-function wpinv_delete_option( $key = '' ) {
126
+function wpinv_delete_option($key = '') {
127 127
 
128 128
     // If no key, exit
129
-    if ( empty( $key ) ) {
129
+    if (empty($key)) {
130 130
         return false;
131 131
     }
132 132
 
133 133
     $options = wpinv_get_options();
134 134
 
135
-    if ( isset( $options[ $key ] ) ) {
136
-        unset( $options[ $key ] );
137
-        return wpinv_update_options( $options );
135
+    if (isset($options[$key])) {
136
+        unset($options[$key]);
137
+        return wpinv_update_options($options);
138 138
     }
139 139
 
140 140
     return true;
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
 function wpinv_register_settings() {
149 149
 
150 150
     // Loop through all tabs.
151
-    foreach ( wpinv_get_registered_settings() as $tab => $sections ) {
151
+    foreach (wpinv_get_registered_settings() as $tab => $sections) {
152 152
 
153 153
         // In each tab, loop through sections.
154
-        foreach ( $sections as $section => $settings ) {
154
+        foreach ($sections as $section => $settings) {
155 155
 
156 156
             // Check for backwards compatibility
157
-            $section_tabs = wpinv_get_settings_tab_sections( $tab );
158
-            if ( ! is_array( $section_tabs ) || ! array_key_exists( $section, $section_tabs ) ) {
157
+            $section_tabs = wpinv_get_settings_tab_sections($tab);
158
+            if (!is_array($section_tabs) || !array_key_exists($section, $section_tabs)) {
159 159
                 $section = 'main';
160 160
                 $settings = $sections;
161 161
             }
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
                 'wpinv_settings_' . $tab . '_' . $section
169 169
             );
170 170
 
171
-            foreach ( $settings as $option ) {
172
-                if ( ! empty( $option['id'] ) ) {
173
-                    wpinv_register_settings_option( $tab, $section, $option );
171
+            foreach ($settings as $option) {
172
+                if (!empty($option['id'])) {
173
+                    wpinv_register_settings_option($tab, $section, $option);
174 174
                 }
175 175
             }
176 176
 
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
     }
179 179
 
180 180
     // Creates our settings in the options table.
181
-    register_setting( 'wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize' );
181
+    register_setting('wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize');
182 182
 }
183
-add_action( 'admin_init', 'wpinv_register_settings' );
183
+add_action('admin_init', 'wpinv_register_settings');
184 184
 
185 185
 /**
186 186
  * Register a single settings option.
@@ -190,48 +190,48 @@  discard block
 block discarded – undo
190 190
  * @param string $option
191 191
  * 
192 192
  */
193
-function wpinv_register_settings_option( $tab, $section, $option ) {
193
+function wpinv_register_settings_option($tab, $section, $option) {
194 194
 
195
-    $name    = isset( $option['name'] ) ? $option['name'] : '';
195
+    $name    = isset($option['name']) ? $option['name'] : '';
196 196
     $cb      = "wpinv_{$option['type']}_callback";
197 197
     $section = "wpinv_settings_{$tab}_$section";
198 198
 
199
-	if ( isset( $option['desc'] ) && ! empty( $option['help-tip'] ) ) {
200
-		$tip   = wpinv_clean( $option['desc'] );
199
+	if (isset($option['desc']) && !empty($option['help-tip'])) {
200
+		$tip   = wpinv_clean($option['desc']);
201 201
 		$name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>";
202
-		unset( $option['desc'] );
202
+		unset($option['desc']);
203 203
 	}
204 204
 
205 205
     // Loop through all tabs.
206 206
     add_settings_field(
207 207
         'wpinv_settings[' . $option['id'] . ']',
208 208
         $name,
209
-        function_exists( $cb ) ? $cb : 'wpinv_missing_callback',
209
+        function_exists($cb) ? $cb : 'wpinv_missing_callback',
210 210
         $section,
211 211
         $section,
212 212
         array(
213 213
             'section'     => $section,
214
-            'id'          => isset( $option['id'] )          ? $option['id']          : uniqid( 'wpinv-' ),
215
-            'desc'        => isset( $option['desc'] )        ? $option['desc']        : '',
214
+            'id'          => isset($option['id']) ? $option['id'] : uniqid('wpinv-'),
215
+            'desc'        => isset($option['desc']) ? $option['desc'] : '',
216 216
             'name'        => $name,
217
-            'size'        => isset( $option['size'] )        ? $option['size']        : null,
218
-            'options'     => isset( $option['options'] )     ? $option['options']     : '',
219
-            'selected'    => isset( $option['selected'] )    ? $option['selected']    : null,
220
-            'std'         => isset( $option['std'] )         ? $option['std']         : '',
221
-            'min'         => isset( $option['min'] )         ? $option['min']         : 0,
222
-            'max'         => isset( $option['max'] )         ? $option['max']         : 999999,
223
-            'step'        => isset( $option['step'] )        ? $option['step']        : 1,
224
-            'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : null,
225
-            'allow_blank' => isset( $option['allow_blank'] ) ? $option['allow_blank'] : true,
226
-            'readonly'    => isset( $option['readonly'] )    ? $option['readonly']    : false,
227
-            'faux'        => isset( $option['faux'] )        ? $option['faux']        : false,
228
-            'onchange'    => isset( $option['onchange'] )   ? $option['onchange']     : '',
229
-            'custom'      => isset( $option['custom'] )     ? $option['custom']       : '',
230
-			'default_content' => isset( $option['default_content'] )     ? $option['default_content']       : '',
231
-			'class'       => isset( $option['class'] )     ? $option['class']         : '',
232
-			'style'       => isset( $option['style'] )     ? $option['style']         : '',
233
-            'cols'        => isset( $option['cols'] ) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50,
234
-            'rows'        => isset( $option['rows'] ) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5,
217
+            'size'        => isset($option['size']) ? $option['size'] : null,
218
+            'options'     => isset($option['options']) ? $option['options'] : '',
219
+            'selected'    => isset($option['selected']) ? $option['selected'] : null,
220
+            'std'         => isset($option['std']) ? $option['std'] : '',
221
+            'min'         => isset($option['min']) ? $option['min'] : 0,
222
+            'max'         => isset($option['max']) ? $option['max'] : 999999,
223
+            'step'        => isset($option['step']) ? $option['step'] : 1,
224
+            'placeholder' => isset($option['placeholder']) ? $option['placeholder'] : null,
225
+            'allow_blank' => isset($option['allow_blank']) ? $option['allow_blank'] : true,
226
+            'readonly'    => isset($option['readonly']) ? $option['readonly'] : false,
227
+            'faux'        => isset($option['faux']) ? $option['faux'] : false,
228
+            'onchange'    => isset($option['onchange']) ? $option['onchange'] : '',
229
+            'custom'      => isset($option['custom']) ? $option['custom'] : '',
230
+			'default_content' => isset($option['default_content']) ? $option['default_content'] : '',
231
+			'class'       => isset($option['class']) ? $option['class'] : '',
232
+			'style'       => isset($option['style']) ? $option['style'] : '',
233
+            'cols'        => isset($option['cols']) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50,
234
+            'rows'        => isset($option['rows']) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5,
235 235
         )
236 236
     );
237 237
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
  * @return array
244 244
  */
245 245
 function wpinv_get_registered_settings() {
246
-	return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) );
246
+	return array_filter(apply_filters('wpinv_registered_settings', wpinv_get_data('admin-settings')));
247 247
 }
248 248
 
249 249
 /**
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
  * @return array
253 253
  */
254 254
 function getpaid_get_integration_settings() {
255
-    return apply_filters( 'getpaid_integration_settings', array() );
255
+    return apply_filters('getpaid_integration_settings', array());
256 256
 }
257 257
 
258 258
 /**
@@ -260,144 +260,144 @@  discard block
 block discarded – undo
260 260
  * 
261 261
  * @return array
262 262
  */
263
-function wpinv_settings_sanitize( $input = array() ) {
263
+function wpinv_settings_sanitize($input = array()) {
264 264
 
265 265
 	$wpinv_options = wpinv_get_options();
266 266
 	$raw_referrer  = wp_get_raw_referer();
267 267
 
268
-    if ( empty( $raw_referrer ) ) {
268
+    if (empty($raw_referrer)) {
269 269
         return $input;
270 270
     }
271 271
 
272
-    wp_parse_str( $raw_referrer, $referrer );
272
+    wp_parse_str($raw_referrer, $referrer);
273 273
 
274
-	if ( empty( $referrer['tab'] ) ) {
274
+	if (empty($referrer['tab'])) {
275 275
         return $input;
276 276
 	}
277 277
 
278 278
     $settings = wpinv_get_registered_settings();
279
-    $tab      = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general';
280
-    $section  = isset( $referrer['section'] ) ? $referrer['section'] : 'main';
279
+    $tab      = isset($referrer['tab']) ? $referrer['tab'] : 'general';
280
+    $section  = isset($referrer['section']) ? $referrer['section'] : 'main';
281 281
 
282 282
     $input = $input ? $input : array();
283
-    $input = apply_filters( 'wpinv_settings_tab_' . $tab . '_sanitize', $input );
284
-    $input = apply_filters( 'wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input );
283
+    $input = apply_filters('wpinv_settings_tab_' . $tab . '_sanitize', $input);
284
+    $input = apply_filters('wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input);
285 285
 
286 286
     // Loop through each setting being saved and pass it through a sanitization filter
287
-    foreach ( $input as $key => $value ) {
287
+    foreach ($input as $key => $value) {
288 288
 
289 289
         // Get the setting type (checkbox, select, etc)
290
-        $type = isset( $settings[ $tab ][$section][ $key ]['type'] ) ? $settings[ $tab ][$section][ $key ]['type'] : false;
290
+        $type = isset($settings[$tab][$section][$key]['type']) ? $settings[$tab][$section][$key]['type'] : false;
291 291
 
292
-        if ( $type ) {
292
+        if ($type) {
293 293
             // Field type specific filter
294
-            $input[$key] = apply_filters( 'wpinv_settings_sanitize_' . $type, $value, $key );
294
+            $input[$key] = apply_filters('wpinv_settings_sanitize_' . $type, $value, $key);
295 295
         }
296 296
 
297 297
         // General filter
298
-		$input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
298
+		$input[$key] = apply_filters('wpinv_settings_sanitize', $input[$key], $key);
299 299
 
300 300
 		// Key specific filter.
301
-		$input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] );
301
+		$input[$key] = apply_filters("wpinv_settings_sanitize_$key", $input[$key]);
302 302
     }
303 303
 
304 304
     // Loop through the whitelist and unset any that are empty for the tab being saved
305
-    $main_settings    = isset( $settings[ $tab ] ) ? $settings[ $tab ] : array(); // Check for extensions that aren't using new sections
306
-    $section_settings = ! empty( $settings[ $tab ][ $section ] ) ? $settings[ $tab ][ $section ] : array();
305
+    $main_settings    = isset($settings[$tab]) ? $settings[$tab] : array(); // Check for extensions that aren't using new sections
306
+    $section_settings = !empty($settings[$tab][$section]) ? $settings[$tab][$section] : array();
307 307
 
308
-    $found_settings   = array_merge( $main_settings, $section_settings );
308
+    $found_settings   = array_merge($main_settings, $section_settings);
309 309
 
310
-    if ( ! empty( $found_settings ) ) {
311
-        foreach ( $found_settings as $key => $value ) {
310
+    if (!empty($found_settings)) {
311
+        foreach ($found_settings as $key => $value) {
312 312
 
313 313
             // settings used to have numeric keys, now they have keys that match the option ID. This ensures both methods work
314
-            if ( is_numeric( $key ) ) {
314
+            if (is_numeric($key)) {
315 315
                 $key = $value['id'];
316 316
             }
317 317
 
318
-            if ( ! isset( $input[ $key ] ) && isset( $wpinv_options[ $key ] ) ) {
319
-                unset( $wpinv_options[ $key ] );
318
+            if (!isset($input[$key]) && isset($wpinv_options[$key])) {
319
+                unset($wpinv_options[$key]);
320 320
             }
321 321
         }
322 322
     }
323 323
 
324 324
     // Merge our new settings with the existing
325
-    $output = array_merge( $wpinv_options, $input );
325
+    $output = array_merge($wpinv_options, $input);
326 326
 
327
-    add_settings_error( 'wpinv-notices', '', __( 'Settings updated.', 'invoicing' ), 'updated' );
327
+    add_settings_error('wpinv-notices', '', __('Settings updated.', 'invoicing'), 'updated');
328 328
 
329 329
     return $output;
330 330
 }
331 331
 
332
-function wpinv_settings_sanitize_misc_accounting( $input ) {
332
+function wpinv_settings_sanitize_misc_accounting($input) {
333 333
 
334
-    if ( ! wpinv_current_user_can_manage_invoicing() ) {
334
+    if (!wpinv_current_user_can_manage_invoicing()) {
335 335
         return $input;
336 336
     }
337 337
 
338
-    if( ! empty( $input['enable_sequential'] ) && !wpinv_get_option( 'enable_sequential' ) ) {
338
+    if (!empty($input['enable_sequential']) && !wpinv_get_option('enable_sequential')) {
339 339
         // Shows an admin notice about upgrading previous order numbers
340
-        getpaid_session()->set( 'upgrade_sequential', '1' );
340
+        getpaid_session()->set('upgrade_sequential', '1');
341 341
     }
342 342
 
343 343
     return $input;
344 344
 }
345
-add_filter( 'wpinv_settings_misc-accounting_sanitize', 'wpinv_settings_sanitize_misc_accounting' );
345
+add_filter('wpinv_settings_misc-accounting_sanitize', 'wpinv_settings_sanitize_misc_accounting');
346 346
 
347
-function wpinv_settings_sanitize_tax_rates( $input ) {
348
-    if( ! wpinv_current_user_can_manage_invoicing() ) {
347
+function wpinv_settings_sanitize_tax_rates($input) {
348
+    if (!wpinv_current_user_can_manage_invoicing()) {
349 349
         return $input;
350 350
     }
351 351
 
352
-    $new_rates = ! empty( $_POST['tax_rates'] ) ? array_values( $_POST['tax_rates'] ) : array();
352
+    $new_rates = !empty($_POST['tax_rates']) ? array_values($_POST['tax_rates']) : array();
353 353
     $tax_rates = array();
354 354
 
355
-    foreach ( $new_rates as $rate ) {
355
+    foreach ($new_rates as $rate) {
356 356
 
357
-		$rate['rate']    = wpinv_sanitize_amount( $rate['rate'] );
358
-		$rate['name']    = sanitize_text_field( $rate['name'] );
359
-		$rate['state']   = sanitize_text_field( $rate['state'] );
360
-		$rate['country'] = sanitize_text_field( $rate['country'] );
361
-		$rate['global']  = empty( $rate['state'] );
357
+		$rate['rate']    = wpinv_sanitize_amount($rate['rate']);
358
+		$rate['name']    = sanitize_text_field($rate['name']);
359
+		$rate['state']   = sanitize_text_field($rate['state']);
360
+		$rate['country'] = sanitize_text_field($rate['country']);
361
+		$rate['global']  = empty($rate['state']);
362 362
 		$tax_rates[]     = $rate;
363 363
 
364 364
 	}
365 365
 
366
-    update_option( 'wpinv_tax_rates', $tax_rates );
366
+    update_option('wpinv_tax_rates', $tax_rates);
367 367
 
368 368
     return $input;
369 369
 }
370
-add_filter( 'wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates' );
370
+add_filter('wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates');
371 371
 
372
-function wpinv_sanitize_text_field( $input ) {
373
-    return trim( $input );
372
+function wpinv_sanitize_text_field($input) {
373
+    return trim($input);
374 374
 }
375
-add_filter( 'wpinv_settings_sanitize_text', 'wpinv_sanitize_text_field' );
375
+add_filter('wpinv_settings_sanitize_text', 'wpinv_sanitize_text_field');
376 376
 
377 377
 function wpinv_get_settings_tabs() {
378 378
     $tabs             = array();
379
-    $tabs['general']  = __( 'General', 'invoicing' );
380
-    $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' );
381
-    $tabs['taxes']    = __( 'Taxes', 'invoicing' );
382
-	$tabs['emails']   = __( 'Emails', 'invoicing' );
379
+    $tabs['general']  = __('General', 'invoicing');
380
+    $tabs['gateways'] = __('Payment Gateways', 'invoicing');
381
+    $tabs['taxes']    = __('Taxes', 'invoicing');
382
+	$tabs['emails'] = __('Emails', 'invoicing');
383 383
 
384
-	if ( count( getpaid_get_integration_settings() ) > 0 ) {
385
-		$tabs['integrations'] = __( 'Integrations', 'invoicing' );
384
+	if (count(getpaid_get_integration_settings()) > 0) {
385
+		$tabs['integrations'] = __('Integrations', 'invoicing');
386 386
 	}
387 387
 
388
-    $tabs['privacy']  = __( 'Privacy', 'invoicing' );
389
-    $tabs['misc']     = __( 'Misc', 'invoicing' );
390
-    $tabs['tools']    = __( 'Tools', 'invoicing' );
388
+    $tabs['privacy']  = __('Privacy', 'invoicing');
389
+    $tabs['misc']     = __('Misc', 'invoicing');
390
+    $tabs['tools']    = __('Tools', 'invoicing');
391 391
 
392
-    return apply_filters( 'wpinv_settings_tabs', $tabs );
392
+    return apply_filters('wpinv_settings_tabs', $tabs);
393 393
 }
394 394
 
395
-function wpinv_get_settings_tab_sections( $tab = false ) {
395
+function wpinv_get_settings_tab_sections($tab = false) {
396 396
     $tabs     = false;
397 397
     $sections = wpinv_get_registered_settings_sections();
398 398
 
399
-    if( $tab && ! empty( $sections[ $tab ] ) ) {
400
-        $tabs = $sections[ $tab ];
399
+    if ($tab && !empty($sections[$tab])) {
400
+        $tabs = $sections[$tab];
401 401
     }
402 402
 
403 403
     return $tabs;
@@ -406,88 +406,88 @@  discard block
 block discarded – undo
406 406
 function wpinv_get_registered_settings_sections() {
407 407
     static $sections = false;
408 408
 
409
-    if ( false !== $sections ) {
409
+    if (false !== $sections) {
410 410
         return $sections;
411 411
     }
412 412
 
413 413
     $sections = array(
414
-        'general' => apply_filters( 'wpinv_settings_sections_general', array(
415
-            'main' => __( 'General Settings', 'invoicing' ),
416
-            'currency_section' => __( 'Currency Settings', 'invoicing' ),
417
-            'labels' => __( 'Label Texts', 'invoicing' ),
418
-        ) ),
419
-        'gateways' => apply_filters( 'wpinv_settings_sections_gateways', array(
420
-            'main' => __( 'Gateway Settings', 'invoicing' ),
421
-        ) ),
422
-        'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array(
423
-            'main'  => __( 'Tax Settings', 'invoicing' ),
424
-			'rates' => __( 'Tax Rates', 'invoicing' ),
425
-			'vat'   => __( 'EU VAT Settings', 'invoicing' )
426
-        ) ),
427
-        'emails' => apply_filters( 'wpinv_settings_sections_emails', array(
428
-            'main' => __( 'Email Settings', 'invoicing' ),
429
-		) ),
430
-
431
-		'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ),
432
-
433
-        'privacy' => apply_filters( 'wpinv_settings_sections_privacy', array(
434
-            'main' => __( 'Privacy policy', 'invoicing' ),
435
-        ) ),
436
-        'misc' => apply_filters( 'wpinv_settings_sections_misc', array(
437
-            'main' => __( 'Miscellaneous', 'invoicing' ),
438
-            'custom-css' => __( 'Custom CSS', 'invoicing' ),
439
-        ) ),
440
-        'tools' => apply_filters( 'wpinv_settings_sections_tools', array(
441
-            'main' => __( 'Diagnostic Tools', 'invoicing' ),
442
-        ) ),
414
+        'general' => apply_filters('wpinv_settings_sections_general', array(
415
+            'main' => __('General Settings', 'invoicing'),
416
+            'currency_section' => __('Currency Settings', 'invoicing'),
417
+            'labels' => __('Label Texts', 'invoicing'),
418
+        )),
419
+        'gateways' => apply_filters('wpinv_settings_sections_gateways', array(
420
+            'main' => __('Gateway Settings', 'invoicing'),
421
+        )),
422
+        'taxes' => apply_filters('wpinv_settings_sections_taxes', array(
423
+            'main'  => __('Tax Settings', 'invoicing'),
424
+			'rates' => __('Tax Rates', 'invoicing'),
425
+			'vat'   => __('EU VAT Settings', 'invoicing')
426
+        )),
427
+        'emails' => apply_filters('wpinv_settings_sections_emails', array(
428
+            'main' => __('Email Settings', 'invoicing'),
429
+		)),
430
+
431
+		'integrations' => wp_list_pluck(getpaid_get_integration_settings(), 'label', 'id'),
432
+
433
+        'privacy' => apply_filters('wpinv_settings_sections_privacy', array(
434
+            'main' => __('Privacy policy', 'invoicing'),
435
+        )),
436
+        'misc' => apply_filters('wpinv_settings_sections_misc', array(
437
+            'main' => __('Miscellaneous', 'invoicing'),
438
+            'custom-css' => __('Custom CSS', 'invoicing'),
439
+        )),
440
+        'tools' => apply_filters('wpinv_settings_sections_tools', array(
441
+            'main' => __('Diagnostic Tools', 'invoicing'),
442
+        )),
443 443
     );
444 444
 
445
-    $sections = apply_filters( 'wpinv_settings_sections', $sections );
445
+    $sections = apply_filters('wpinv_settings_sections', $sections);
446 446
 
447 447
     return $sections;
448 448
 }
449 449
 
450
-function wpinv_get_pages( $with_slug = false, $default_label = NULL ) {
450
+function wpinv_get_pages($with_slug = false, $default_label = NULL) {
451 451
 	$pages_options = array();
452 452
 
453
-	if( $default_label !== NULL && $default_label !== false ) {
454
-		$pages_options = array( '' => $default_label ); // Blank option
453
+	if ($default_label !== NULL && $default_label !== false) {
454
+		$pages_options = array('' => $default_label); // Blank option
455 455
 	}
456 456
 
457 457
 	$pages = get_pages();
458
-	if ( $pages ) {
459
-		foreach ( $pages as $page ) {
458
+	if ($pages) {
459
+		foreach ($pages as $page) {
460 460
 			$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
461
-            $pages_options[ $page->ID ] = $title;
461
+            $pages_options[$page->ID] = $title;
462 462
 		}
463 463
 	}
464 464
 
465 465
 	return $pages_options;
466 466
 }
467 467
 
468
-function wpinv_header_callback( $args ) {
469
-	if ( !empty( $args['desc'] ) ) {
468
+function wpinv_header_callback($args) {
469
+	if (!empty($args['desc'])) {
470 470
         echo $args['desc'];
471 471
     }
472 472
 }
473 473
 
474
-function wpinv_hidden_callback( $args ) {
474
+function wpinv_hidden_callback($args) {
475 475
 
476
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
477
-	$value   = wpinv_get_option( $args['id'], $std );
476
+	$std     = isset($args['std']) ? $args['std'] : '';
477
+	$value   = wpinv_get_option($args['id'], $std);
478 478
 
479
-	if ( isset( $args['set_value'] ) ) {
479
+	if (isset($args['set_value'])) {
480 480
 		$value = $args['set_value'];
481 481
 	}
482 482
 
483
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
483
+	if (isset($args['faux']) && true === $args['faux']) {
484 484
 		$args['readonly'] = true;
485
-		$name  = '';
485
+		$name = '';
486 486
 	} else {
487
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
487
+		$name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"';
488 488
 	}
489 489
 
490
-	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
490
+	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key($args['id']) . ']" ' . $name . ' value="' . esc_attr(stripslashes($value)) . '" />';
491 491
     
492 492
 	echo $html;
493 493
 }
@@ -495,59 +495,59 @@  discard block
 block discarded – undo
495 495
 /**
496 496
  * Displays a checkbox settings callback.
497 497
  */
498
-function wpinv_checkbox_callback( $args ) {
498
+function wpinv_checkbox_callback($args) {
499 499
 
500
-	$std = isset( $args['std'] ) ? $args['std'] : '';
501
-	$std = wpinv_get_option( $args['id'], $std );
502
-	$id  = esc_attr( $args['id'] );
500
+	$std = isset($args['std']) ? $args['std'] : '';
501
+	$std = wpinv_get_option($args['id'], $std);
502
+	$id  = esc_attr($args['id']);
503 503
 
504
-	getpaid_hidden_field( "wpinv_settings[$id]", '0' );
504
+	getpaid_hidden_field("wpinv_settings[$id]", '0');
505 505
 	?>
506 506
 		<fieldset>
507 507
 			<label>
508
-				<input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked( empty( $std ), false ); ?> value="1" type="checkbox">
509
-				<?php echo wp_kses_post( $args['desc'] ); ?>
508
+				<input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked(empty($std), false); ?> value="1" type="checkbox">
509
+				<?php echo wp_kses_post($args['desc']); ?>
510 510
 			</label>
511 511
 		</fieldset>
512 512
 	<?php
513 513
 }
514 514
 
515
-function wpinv_multicheck_callback( $args ) {
515
+function wpinv_multicheck_callback($args) {
516 516
 
517
-	$sanitize_id = wpinv_sanitize_key( $args['id'] );
518
-	$class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
517
+	$sanitize_id = wpinv_sanitize_key($args['id']);
518
+	$class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : '';
519 519
 
520
-	if ( ! empty( $args['options'] ) ) {
520
+	if (!empty($args['options'])) {
521 521
 
522
-		$std     = isset( $args['std'] ) ? $args['std'] : array();
523
-		$value   = wpinv_get_option( $args['id'], $std );
522
+		$std     = isset($args['std']) ? $args['std'] : array();
523
+		$value   = wpinv_get_option($args['id'], $std);
524 524
 
525 525
 		echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
526
-        foreach( $args['options'] as $key => $option ):
527
-			$sanitize_key = wpinv_sanitize_key( $key );
528
-			if ( in_array( $sanitize_key, $value ) ) { 
526
+        foreach ($args['options'] as $key => $option):
527
+			$sanitize_key = wpinv_sanitize_key($key);
528
+			if (in_array($sanitize_key, $value)) { 
529 529
 				$enabled = $sanitize_key;
530 530
 			} else { 
531 531
 				$enabled = NULL; 
532 532
 			}
533
-			echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/>&nbsp;';
534
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
533
+			echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr($sanitize_key) . '" ' . checked($sanitize_key, $enabled, false) . '/>&nbsp;';
534
+			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post($option) . '</label></div>';
535 535
 		endforeach;
536 536
 		echo '</div>';
537 537
 		echo '<p class="description">' . $args['desc'] . '</p>';
538 538
 	}
539 539
 }
540 540
 
541
-function wpinv_payment_icons_callback( $args ) {
541
+function wpinv_payment_icons_callback($args) {
542 542
     
543
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
544
-	$value   = wpinv_get_option( $args['id'], false);
543
+    $sanitize_id = wpinv_sanitize_key($args['id']);
544
+	$value = wpinv_get_option($args['id'], false);
545 545
 
546
-	if ( ! empty( $args['options'] ) ) {
547
-		foreach( $args['options'] as $key => $option ) {
548
-            $sanitize_key = wpinv_sanitize_key( $key );
546
+	if (!empty($args['options'])) {
547
+		foreach ($args['options'] as $key => $option) {
548
+            $sanitize_key = wpinv_sanitize_key($key);
549 549
             
550
-			if( empty( $value ) ) {
550
+			if (empty($value)) {
551 551
 				$enabled = $option;
552 552
 			} else {
553 553
 				$enabled = NULL;
@@ -555,67 +555,67 @@  discard block
 block discarded – undo
555 555
 
556 556
 			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
557 557
 
558
-				echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/>&nbsp;';
558
+				echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr($option) . '" ' . checked($option, $enabled, false) . '/>&nbsp;';
559 559
 
560
-				if ( wpinv_string_is_image_url( $key ) ) {
561
-					echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
560
+				if (wpinv_string_is_image_url($key)) {
561
+					echo '<img class="payment-icon" src="' . esc_url($key) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
562 562
 				} else {
563
-					$card = strtolower( str_replace( ' ', '', $option ) );
563
+					$card = strtolower(str_replace(' ', '', $option));
564 564
 
565
-					if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
566
-						$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
565
+					if (has_filter('wpinv_accepted_payment_' . $card . '_image')) {
566
+						$image = apply_filters('wpinv_accepted_payment_' . $card . '_image', '');
567 567
 					} else {
568
-						$image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
568
+						$image       = wpinv_locate_template('images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false);
569 569
 						$content_dir = WP_CONTENT_DIR;
570 570
 
571
-						if ( function_exists( 'wp_normalize_path' ) ) {
571
+						if (function_exists('wp_normalize_path')) {
572 572
 							// Replaces backslashes with forward slashes for Windows systems
573
-							$image = wp_normalize_path( $image );
574
-							$content_dir = wp_normalize_path( $content_dir );
573
+							$image = wp_normalize_path($image);
574
+							$content_dir = wp_normalize_path($content_dir);
575 575
 						}
576 576
 
577
-						$image = str_replace( $content_dir, content_url(), $image );
577
+						$image = str_replace($content_dir, content_url(), $image);
578 578
 					}
579 579
 
580
-					echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
580
+					echo '<img class="payment-icon" src="' . esc_url($image) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
581 581
 				}
582 582
 			echo $option . '</label>';
583 583
 		}
584
-		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
584
+		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post($args['desc']) . '</p>';
585 585
 	}
586 586
 }
587 587
 
588 588
 /**
589 589
  * Displays a radio settings field.
590 590
  */
591
-function wpinv_radio_callback( $args ) {
591
+function wpinv_radio_callback($args) {
592 592
 
593
-	$std = isset( $args['std'] ) ? $args['std'] : '';
594
-	$std = wpinv_get_option( $args['id'], $std );
593
+	$std = isset($args['std']) ? $args['std'] : '';
594
+	$std = wpinv_get_option($args['id'], $std);
595 595
 	?>
596 596
 		<fieldset>
597
-			<ul id="wpinv-settings-<?php echo esc_attr( $args['id'] ); ?>" style="margin-top: 0;">
598
-				<?php foreach( $args['options'] as $key => $option ) : ?>
597
+			<ul id="wpinv-settings-<?php echo esc_attr($args['id']); ?>" style="margin-top: 0;">
598
+				<?php foreach ($args['options'] as $key => $option) : ?>
599 599
 					<li>
600 600
 						<label>
601
-							<input name="wpinv_settings[<?php echo esc_attr( $args['id'] ); ?>]" <?php checked( $std, $key ); ?> value="<?php echo esc_attr( $key ); ?>" type="radio">
602
-							<?php echo wp_kses_post( $option ); ?>
601
+							<input name="wpinv_settings[<?php echo esc_attr($args['id']); ?>]" <?php checked($std, $key); ?> value="<?php echo esc_attr($key); ?>" type="radio">
602
+							<?php echo wp_kses_post($option); ?>
603 603
 						</label>
604 604
 					</li>
605 605
 				<?php endforeach; ?>
606 606
 			</ul>
607 607
 		</fieldset>
608 608
 	<?php
609
-	getpaid_settings_description_callback( $args );
609
+	getpaid_settings_description_callback($args);
610 610
 }
611 611
 
612 612
 /**
613 613
  * Displays a description if available.
614 614
  */
615
-function getpaid_settings_description_callback( $args ) {
615
+function getpaid_settings_description_callback($args) {
616 616
 
617
-	if ( ! empty( $args['desc'] ) ) {
618
-		$description = wp_kses_post( $args['desc'] );
617
+	if (!empty($args['desc'])) {
618
+		$description = wp_kses_post($args['desc']);
619 619
 		echo "<p class='description'>$description</p>";
620 620
 	}
621 621
 
@@ -631,31 +631,31 @@  discard block
 block discarded – undo
631 631
 	</tr>
632 632
 	<tr class="bsui">
633 633
     	<td colspan="2" class="p-0">
634
-			<?php include plugin_dir_path( __FILE__ ) . 'views/html-gateways-edit.php'; ?>
634
+			<?php include plugin_dir_path(__FILE__) . 'views/html-gateways-edit.php'; ?>
635 635
 
636 636
 	<?php
637 637
 }
638 638
 
639 639
 function wpinv_gateway_select_callback($args) {
640 640
     
641
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
642
-    $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
643
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
644
-	$value   = wpinv_get_option( $args['id'], $std );
641
+    $sanitize_id = wpinv_sanitize_key($args['id']);
642
+    $class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : '';
643
+	$std     = isset($args['std']) ? $args['std'] : '';
644
+	$value   = wpinv_get_option($args['id'], $std);
645 645
 
646
-	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >';
646
+	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="' . $class . '" >';
647 647
 
648
-	foreach ( $args['options'] as $key => $option ) :
649
-		if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
650
-            $selected = selected( $key, $args['selected'], false );
648
+	foreach ($args['options'] as $key => $option) :
649
+		if (isset($args['selected']) && $args['selected'] !== null && $args['selected'] !== false) {
650
+            $selected = selected($key, $args['selected'], false);
651 651
         } else {
652
-            $selected = selected( $key, $value, false );
652
+            $selected = selected($key, $value, false);
653 653
         }
654
-		echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
654
+		echo '<option value="' . wpinv_sanitize_key($key) . '"' . $selected . '>' . esc_html($option['admin_label']) . '</option>';
655 655
 	endforeach;
656 656
 
657 657
 	echo '</select>';
658
-	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
658
+	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
659 659
 }
660 660
 
661 661
 /**
@@ -664,28 +664,28 @@  discard block
 block discarded – undo
664 664
  * @param array $args
665 665
  * @return string
666 666
  */
667
-function wpinv_settings_attrs_helper( $args ) {
667
+function wpinv_settings_attrs_helper($args) {
668 668
 
669
-	$value        = isset( $args['std'] ) ? $args['std'] : '';
670
-	$id           = esc_attr( $args['id'] );
671
-	$placeholder  = esc_attr( $args['placeholder'] );
669
+	$value        = isset($args['std']) ? $args['std'] : '';
670
+	$id           = esc_attr($args['id']);
671
+	$placeholder  = esc_attr($args['placeholder']);
672 672
 
673
-	if ( ! empty( $args['faux'] ) ) {
673
+	if (!empty($args['faux'])) {
674 674
 		$args['readonly'] = true;
675 675
 		$name             = '';
676 676
 	} else {
677
-		$value  = wpinv_get_option( $args['id'], $value );
677
+		$value  = wpinv_get_option($args['id'], $value);
678 678
 		$name   = "wpinv_settings[$id]";
679 679
 	}
680 680
 
681
-	$value    = is_scalar( $value ) ? esc_attr( $value ) : '';
682
-	$class    = esc_attr( $args['class'] );
683
-	$style    = esc_attr( $args['style'] );
684
-	$readonly = empty( $args['readonly'] ) ? '' : 'readonly onclick="this.select()"';
681
+	$value    = is_scalar($value) ? esc_attr($value) : '';
682
+	$class    = esc_attr($args['class']);
683
+	$style    = esc_attr($args['style']);
684
+	$readonly = empty($args['readonly']) ? '' : 'readonly onclick="this.select()"';
685 685
 
686 686
 	$onchange = '';
687
-    if ( ! empty( $args['onchange'] ) ) {
688
-        $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"';
687
+    if (!empty($args['onchange'])) {
688
+        $onchange = ' onchange="' . esc_attr($args['onchange']) . '"';
689 689
 	}
690 690
 
691 691
 	return "name='$name' id='wpinv-settings-$id' style='$style' value='$value' class='$class' placeholder='$placeholder' data-placeholder='$placeholder' $onchange $readonly";
@@ -694,11 +694,11 @@  discard block
 block discarded – undo
694 694
 /**
695 695
  * Displays a text input settings callback.
696 696
  */
697
-function wpinv_text_callback( $args ) {
697
+function wpinv_text_callback($args) {
698 698
 
699
-	$desc = wp_kses_post( $args['desc'] );
700
-	$desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
701
-	$attr = wpinv_settings_attrs_helper( $args );
699
+	$desc = wp_kses_post($args['desc']);
700
+	$desc = empty($desc) ? '' : "<p class='description'>$desc</p>";
701
+	$attr = wpinv_settings_attrs_helper($args);
702 702
 
703 703
 	?>
704 704
 		<label style="width: 100%;">
@@ -712,14 +712,14 @@  discard block
 block discarded – undo
712 712
 /**
713 713
  * Displays a number input settings callback.
714 714
  */
715
-function wpinv_number_callback( $args ) {
715
+function wpinv_number_callback($args) {
716 716
 
717
-	$desc = wp_kses_post( $args['desc'] );
718
-	$desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
719
-	$attr = wpinv_settings_attrs_helper( $args );
720
-	$max  = intval( $args['max'] );
721
-	$min  = intval( $args['min'] );
722
-	$step = floatval( $args['step'] );
717
+	$desc = wp_kses_post($args['desc']);
718
+	$desc = empty($desc) ? '' : "<p class='description'>$desc</p>";
719
+	$attr = wpinv_settings_attrs_helper($args);
720
+	$max  = intval($args['max']);
721
+	$min  = intval($args['min']);
722
+	$step = floatval($args['step']);
723 723
 
724 724
 	?>
725 725
 		<label style="width: 100%;">
@@ -730,37 +730,37 @@  discard block
 block discarded – undo
730 730
 
731 731
 }
732 732
 
733
-function wpinv_textarea_callback( $args ) {
733
+function wpinv_textarea_callback($args) {
734 734
     
735
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
736
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
737
-	$value   = wpinv_get_option( $args['id'], $std );
735
+    $sanitize_id = wpinv_sanitize_key($args['id']);
736
+	$std     = isset($args['std']) ? $args['std'] : '';
737
+	$value   = wpinv_get_option($args['id'], $std);
738 738
 
739
-    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
740
-    $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text';
739
+    $size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
740
+    $class = (isset($args['class']) && !is_null($args['class'])) ? $args['class'] : 'large-text';
741 741
 
742
-	$html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
743
-	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
742
+	$html = '<textarea class="' . sanitize_html_class($class) . ' txtarea-' . sanitize_html_class($size) . ' wpi-' . esc_attr(sanitize_html_class($sanitize_id)) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']">' . esc_textarea(stripslashes($value)) . '</textarea>';
743
+	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
744 744
 
745 745
 	echo $html;
746 746
 }
747 747
 
748
-function wpinv_password_callback( $args ) {
748
+function wpinv_password_callback($args) {
749 749
     
750
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
751
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
752
-	$value   = wpinv_get_option( $args['id'], $std );
750
+    $sanitize_id = wpinv_sanitize_key($args['id']);
751
+	$std     = isset($args['std']) ? $args['std'] : '';
752
+	$value   = wpinv_get_option($args['id'], $std);
753 753
 
754
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
755
-	$html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>';
756
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
754
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
755
+	$html = '<input type="password" class="' . sanitize_html_class($size) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr($value) . '"/>';
756
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
757 757
 
758 758
 	echo $html;
759 759
 }
760 760
 
761 761
 function wpinv_missing_callback($args) {
762 762
 	printf(
763
-		__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
763
+		__('The callback function used for the %s setting is missing.', 'invoicing'),
764 764
 		'<strong>' . $args['id'] . '</strong>'
765 765
 	);
766 766
 }
@@ -768,35 +768,35 @@  discard block
 block discarded – undo
768 768
 /**
769 769
  * Displays a number input settings callback.
770 770
  */
771
-function wpinv_select_callback( $args ) {
771
+function wpinv_select_callback($args) {
772 772
 
773
-	$desc   = wp_kses_post( $args['desc'] );
774
-	$desc   = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
775
-	$attr   = wpinv_settings_attrs_helper( $args );
776
-	$value  = isset( $args['std'] ) ? $args['std'] : '';
777
-	$value  = wpinv_get_option( $args['id'], $value );
778
-	$rand   = uniqid( 'random_id' );
773
+	$desc   = wp_kses_post($args['desc']);
774
+	$desc   = empty($desc) ? '' : "<p class='description'>$desc</p>";
775
+	$attr   = wpinv_settings_attrs_helper($args);
776
+	$value  = isset($args['std']) ? $args['std'] : '';
777
+	$value  = wpinv_get_option($args['id'], $value);
778
+	$rand   = uniqid('random_id');
779 779
 
780 780
 	?>
781 781
 		<label style="width: 100%;">
782 782
 			<select <?php echo $attr; ?>>
783
-				<?php foreach ( $args['options'] as $option => $name ) : ?>
784
-					<option value="<?php echo esc_attr( $option ); ?>" <?php echo selected( $option, $value ); ?>><?php echo wpinv_clean( $name ); ?></option>
785
-				<?php endforeach;?>
783
+				<?php foreach ($args['options'] as $option => $name) : ?>
784
+					<option value="<?php echo esc_attr($option); ?>" <?php echo selected($option, $value); ?>><?php echo wpinv_clean($name); ?></option>
785
+				<?php endforeach; ?>
786 786
 			</select>
787 787
 
788
-			<?php if ( substr( $args['id'], -5 ) === '_page' && is_numeric( $value ) ) : ?>
789
-				<a href="<?php echo get_edit_post_link( $value ); ?>" target="_blank" class="button getpaid-page-setting-edit"><?php _e( 'Edit Page', 'invoicing' ) ?></a>
788
+			<?php if (substr($args['id'], -5) === '_page' && is_numeric($value)) : ?>
789
+				<a href="<?php echo get_edit_post_link($value); ?>" target="_blank" class="button getpaid-page-setting-edit"><?php _e('Edit Page', 'invoicing') ?></a>
790 790
 			<?php endif; ?>
791 791
 
792
-			<?php if ( substr( $args['id'], -5 ) === '_page' && ! empty( $args['default_content'] ) ) : ?>
793
-				&nbsp;<a href="#TB_inline?&width=400&height=550&inlineId=<?php echo $rand; ?>" class="button thickbox getpaid-page-setting-view-default"><?php _e( 'View Default Content', 'invoicing' ) ?></a>
792
+			<?php if (substr($args['id'], -5) === '_page' && !empty($args['default_content'])) : ?>
793
+				&nbsp;<a href="#TB_inline?&width=400&height=550&inlineId=<?php echo $rand; ?>" class="button thickbox getpaid-page-setting-view-default"><?php _e('View Default Content', 'invoicing') ?></a>
794 794
 				<div id='<?php echo $rand; ?>' style='display:none;'>
795 795
 					<div>
796
-						<h3><?php _e( 'Original Content', 'invoicing' ) ?></h3>
797
-						<textarea readonly onclick="this.select()" rows="8" style="width: 100%;"><?php echo gepaid_trim_lines( wp_kses_post( $args['default_content'] ) ); ?></textarea>
798
-						<h3><?php _e( 'Current Content', 'invoicing' ) ?></h3>
799
-						<textarea readonly onclick="this.select()" rows="8" style="width: 100%;"><?php $_post = get_post( $value ); echo empty( $_post ) ? '' : gepaid_trim_lines( wp_kses_post( $_post->post_content ) ); ?></textarea>
796
+						<h3><?php _e('Original Content', 'invoicing') ?></h3>
797
+						<textarea readonly onclick="this.select()" rows="8" style="width: 100%;"><?php echo gepaid_trim_lines(wp_kses_post($args['default_content'])); ?></textarea>
798
+						<h3><?php _e('Current Content', 'invoicing') ?></h3>
799
+						<textarea readonly onclick="this.select()" rows="8" style="width: 100%;"><?php $_post = get_post($value); echo empty($_post) ? '' : gepaid_trim_lines(wp_kses_post($_post->post_content)); ?></textarea>
800 800
 					</div>
801 801
 				</div>
802 802
 			<?php endif; ?>
@@ -807,88 +807,88 @@  discard block
 block discarded – undo
807 807
 
808 808
 }
809 809
 
810
-function wpinv_color_select_callback( $args ) {
810
+function wpinv_color_select_callback($args) {
811 811
     
812
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
813
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
814
-	$value   = wpinv_get_option( $args['id'], $std );
812
+    $sanitize_id = wpinv_sanitize_key($args['id']);
813
+	$std     = isset($args['std']) ? $args['std'] : '';
814
+	$value   = wpinv_get_option($args['id'], $std);
815 815
 
816
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
816
+	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']"/>';
817 817
 
818
-	foreach ( $args['options'] as $option => $color ) {
819
-		$selected = selected( $option, $value, false );
820
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
818
+	foreach ($args['options'] as $option => $color) {
819
+		$selected = selected($option, $value, false);
820
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($color['label']) . '</option>';
821 821
 	}
822 822
 
823 823
 	$html .= '</select>';
824
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
824
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
825 825
 
826 826
 	echo $html;
827 827
 }
828 828
 
829
-function wpinv_rich_editor_callback( $args ) {
829
+function wpinv_rich_editor_callback($args) {
830 830
 	global $wp_version;
831 831
     
832
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
832
+    $sanitize_id = wpinv_sanitize_key($args['id']);
833 833
 
834
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
835
-	$value   = wpinv_get_option( $args['id'], $std );
834
+	$std     = isset($args['std']) ? $args['std'] : '';
835
+	$value   = wpinv_get_option($args['id'], $std);
836 836
 	
837
-	if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) {
837
+	if (!empty($args['allow_blank']) && empty($value)) {
838 838
 		$value = $std;
839 839
 	}
840 840
 
841
-	$rows = isset( $args['size'] ) ? $args['size'] : 20;
841
+	$rows = isset($args['size']) ? $args['size'] : 20;
842 842
 
843 843
 	$html = '<div class="getpaid-settings-editor-input">';
844
-	if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
844
+	if ($wp_version >= 3.3 && function_exists('wp_editor')) {
845 845
 		ob_start();
846
-		wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) );
846
+		wp_editor(stripslashes($value), 'wpinv_settings_' . esc_attr($args['id']), array('textarea_name' => 'wpinv_settings[' . esc_attr($args['id']) . ']', 'textarea_rows' => absint($rows), 'media_buttons' => false));
847 847
 		$html .= ob_get_clean();
848 848
 	} else {
849
-		$html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
849
+		$html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" class="wpi-' . esc_attr(sanitize_html_class($args['id'])) . '">' . esc_textarea(stripslashes($value)) . '</textarea>';
850 850
 	}
851 851
 
852
-	$html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
852
+	$html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
853 853
 
854 854
 	echo $html;
855 855
 }
856 856
 
857
-function wpinv_upload_callback( $args ) {
857
+function wpinv_upload_callback($args) {
858 858
     
859
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
859
+    $sanitize_id = wpinv_sanitize_key($args['id']);
860 860
 
861
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
862
-	$value   = wpinv_get_option( $args['id'], $std );
861
+	$std     = isset($args['std']) ? $args['std'] : '';
862
+	$value   = wpinv_get_option($args['id'], $std);
863 863
 
864
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
865
-	$html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
866
-	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
867
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
864
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
865
+	$html = '<input type="text" class="' . sanitize_html_class($size) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr(stripslashes($value)) . '"/>';
866
+	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __('Upload File', 'invoicing') . '"/></span>';
867
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
868 868
 
869 869
 	echo $html;
870 870
 }
871 871
 
872
-function wpinv_color_callback( $args ) {
872
+function wpinv_color_callback($args) {
873 873
 
874
-	$std         = isset( $args['std'] ) ? $args['std'] : '';
875
-	$value       = wpinv_get_option( $args['id'], $std );
876
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
874
+	$std         = isset($args['std']) ? $args['std'] : '';
875
+	$value       = wpinv_get_option($args['id'], $std);
876
+    $sanitize_id = wpinv_sanitize_key($args['id']);
877 877
 
878
-	$html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $std ) . '" />';
879
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
878
+	$html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr($value) . '" data-default-color="' . esc_attr($std) . '" />';
879
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
880 880
 
881 881
 	echo $html;
882 882
 }
883 883
 
884 884
 function wpinv_country_states_callback($args) {
885 885
 
886
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
887
-	$value   = wpinv_get_option( $args['id'], $std );
886
+	$std     = isset($args['std']) ? $args['std'] : '';
887
+	$value   = wpinv_get_option($args['id'], $std);
888 888
 
889
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
889
+    $sanitize_id = wpinv_sanitize_key($args['id']);
890 890
 
891
-	if ( isset( $args['placeholder'] ) ) {
891
+	if (isset($args['placeholder'])) {
892 892
 		$placeholder = $args['placeholder'];
893 893
 	} else {
894 894
 		$placeholder = '';
@@ -896,16 +896,16 @@  discard block
 block discarded – undo
896 896
 
897 897
 	$states = wpinv_get_country_states();
898 898
 
899
-	$class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
900
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
899
+	$class = empty($states) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
900
+	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']"' . $class . 'data-placeholder="' . esc_html($placeholder) . '"/>';
901 901
 
902
-	foreach ( $states as $option => $name ) {
903
-		$selected = selected( $option, $value, false );
904
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
902
+	foreach ($states as $option => $name) {
903
+		$selected = selected($option, $value, false);
904
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($name) . '</option>';
905 905
 	}
906 906
 
907 907
 	$html .= '</select>';
908
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
908
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
909 909
 
910 910
 	echo $html;
911 911
 }
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
 	</tr>
921 921
 	<tr class="bsui">
922 922
     	<td colspan="2" class="p-0">
923
-			<?php include plugin_dir_path( __FILE__ ) . 'views/html-tax-rates-edit.php'; ?>
923
+			<?php include plugin_dir_path(__FILE__) . 'views/html-tax-rates-edit.php'; ?>
924 924
 
925 925
 	<?php
926 926
 
@@ -929,14 +929,14 @@  discard block
 block discarded – undo
929 929
 /**
930 930
  * Displays a tax rate' edit row.
931 931
  */
932
-function wpinv_tax_rate_callback( $tax_rate, $key, $echo = true ) {
932
+function wpinv_tax_rate_callback($tax_rate, $key, $echo = true) {
933 933
 	ob_start();
934 934
 
935
-	$key                      = sanitize_key( $key );
936
-	$tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate'];
937
-	include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php';
935
+	$key                      = sanitize_key($key);
936
+	$tax_rate['reduced_rate'] = empty($tax_rate['reduced_rate']) ? 0 : $tax_rate['reduced_rate'];
937
+	include plugin_dir_path(__FILE__) . 'views/html-tax-rate-edit.php';
938 938
 
939
-	if ( $echo ) {
939
+	if ($echo) {
940 940
 		echo ob_get_clean();
941 941
 	} else {
942 942
 		return ob_get_clean(); 
@@ -949,134 +949,134 @@  discard block
 block discarded – undo
949 949
     ob_start(); ?>
950 950
     </td><tr>
951 951
     <td colspan="2" class="wpinv_tools_tdbox">
952
-    <?php if ( $args['desc'] ) { ?><p><?php echo $args['desc']; ?></p><?php } ?>
953
-    <?php do_action( 'wpinv_tools_before' ); ?>
952
+    <?php if ($args['desc']) { ?><p><?php echo $args['desc']; ?></p><?php } ?>
953
+    <?php do_action('wpinv_tools_before'); ?>
954 954
     <table id="wpinv_tools_table" class="wp-list-table widefat fixed posts">
955 955
         <thead>
956 956
             <tr>
957
-                <th scope="col" class="wpinv-th-tool"><?php _e( 'Tool', 'invoicing' ); ?></th>
958
-                <th scope="col" class="wpinv-th-desc"><?php _e( 'Description', 'invoicing' ); ?></th>
959
-                <th scope="col" class="wpinv-th-action"><?php _e( 'Action', 'invoicing' ); ?></th>
957
+                <th scope="col" class="wpinv-th-tool"><?php _e('Tool', 'invoicing'); ?></th>
958
+                <th scope="col" class="wpinv-th-desc"><?php _e('Description', 'invoicing'); ?></th>
959
+                <th scope="col" class="wpinv-th-action"><?php _e('Action', 'invoicing'); ?></th>
960 960
             </tr>
961 961
         </thead>
962 962
 
963 963
         <tbody>
964 964
 			<tr>
965
-                <td><?php _e( 'Check Pages', 'invoicing' );?></td>
965
+                <td><?php _e('Check Pages', 'invoicing'); ?></td>
966 966
                 <td>
967
-                    <small><?php _e( 'Creates any missing GetPaid pages.', 'invoicing' ); ?></small>
967
+                    <small><?php _e('Creates any missing GetPaid pages.', 'invoicing'); ?></small>
968 968
                 </td>
969 969
                 <td>
970 970
 					<a href="<?php
971 971
 						echo esc_url(
972 972
 							wp_nonce_url(
973
-								add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ),
973
+								add_query_arg('getpaid-admin-action', 'create_missing_pages'),
974 974
 								'getpaid-nonce',
975 975
 								'getpaid-nonce'
976 976
 							)
977 977
 						);
978
-					?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
978
+					?>" class="button button-primary"><?php _e('Run', 'invoicing'); ?></a>
979 979
                 </td>
980 980
             </tr>
981 981
 			<tr>
982
-                <td><?php _e( 'Create Database Tables', 'invoicing' );?></td>
982
+                <td><?php _e('Create Database Tables', 'invoicing'); ?></td>
983 983
                 <td>
984
-                    <small><?php _e( 'Run this tool to create any missing database tables.', 'invoicing' ); ?></small>
984
+                    <small><?php _e('Run this tool to create any missing database tables.', 'invoicing'); ?></small>
985 985
                 </td>
986 986
                 <td>
987 987
 					<a href="<?php
988 988
 						echo esc_url(
989 989
 							wp_nonce_url(
990
-								add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ),
990
+								add_query_arg('getpaid-admin-action', 'create_missing_tables'),
991 991
 								'getpaid-nonce',
992 992
 								'getpaid-nonce'
993 993
 							)
994 994
 						);
995
-					?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
995
+					?>" class="button button-primary"><?php _e('Run', 'invoicing'); ?></a>
996 996
                 </td>
997 997
             </tr>
998 998
 			<tr>
999
-                <td><?php _e( 'Migrate old invoices', 'invoicing' );?></td>
999
+                <td><?php _e('Migrate old invoices', 'invoicing'); ?></td>
1000 1000
                 <td>
1001
-                    <small><?php _e( 'If your old invoices were not migrated after updating from Invoicing to GetPaid, you can use this tool to migrate them.', 'invoicing' ); ?></small>
1001
+                    <small><?php _e('If your old invoices were not migrated after updating from Invoicing to GetPaid, you can use this tool to migrate them.', 'invoicing'); ?></small>
1002 1002
                 </td>
1003 1003
                 <td>
1004 1004
 					<a href="<?php
1005 1005
 						echo esc_url(
1006 1006
 							wp_nonce_url(
1007
-								add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ),
1007
+								add_query_arg('getpaid-admin-action', 'migrate_old_invoices'),
1008 1008
 								'getpaid-nonce',
1009 1009
 								'getpaid-nonce'
1010 1010
 							)
1011 1011
 						);
1012
-					?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
1012
+					?>" class="button button-primary"><?php _e('Run', 'invoicing'); ?></a>
1013 1013
                 </td>
1014 1014
             </tr>
1015 1015
 
1016 1016
 			<tr>
1017
-                <td><?php _e( 'Recalculate Discounts', 'invoicing' );?></td>
1017
+                <td><?php _e('Recalculate Discounts', 'invoicing'); ?></td>
1018 1018
                 <td>
1019
-                    <small><?php _e( 'Recalculate discounts for existing invoices that have discount codes but are not discounted.', 'invoicing' ); ?></small>
1019
+                    <small><?php _e('Recalculate discounts for existing invoices that have discount codes but are not discounted.', 'invoicing'); ?></small>
1020 1020
                 </td>
1021 1021
                 <td>
1022 1022
 					<a href="<?php
1023 1023
 						echo esc_url(
1024 1024
 							wp_nonce_url(
1025
-								add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ),
1025
+								add_query_arg('getpaid-admin-action', 'recalculate_discounts'),
1026 1026
 								'getpaid-nonce',
1027 1027
 								'getpaid-nonce'
1028 1028
 							)
1029 1029
 						);
1030
-					?>" class="button button-primary"><?php _e( 'Run', 'invoicing' );?></a>
1030
+					?>" class="button button-primary"><?php _e('Run', 'invoicing'); ?></a>
1031 1031
                 </td>
1032 1032
             </tr>
1033 1033
 
1034
-			<?php do_action( 'wpinv_tools_row' ); ?>
1034
+			<?php do_action('wpinv_tools_row'); ?>
1035 1035
         </tbody>
1036 1036
     </table>
1037
-    <?php do_action( 'wpinv_tools_after' ); ?>
1037
+    <?php do_action('wpinv_tools_after'); ?>
1038 1038
     <?php
1039 1039
     echo ob_get_clean();
1040 1040
 }
1041 1041
 
1042 1042
 
1043
-function wpinv_descriptive_text_callback( $args ) {
1044
-	echo wp_kses_post( $args['desc'] );
1043
+function wpinv_descriptive_text_callback($args) {
1044
+	echo wp_kses_post($args['desc']);
1045 1045
 }
1046 1046
 
1047
-function wpinv_raw_html_callback( $args ) {
1047
+function wpinv_raw_html_callback($args) {
1048 1048
 	echo $args['desc'];
1049 1049
 }
1050 1050
 
1051
-function wpinv_hook_callback( $args ) {
1052
-	do_action( 'wpinv_' . $args['id'], $args );
1051
+function wpinv_hook_callback($args) {
1052
+	do_action('wpinv_' . $args['id'], $args);
1053 1053
 }
1054 1054
 
1055 1055
 function wpinv_set_settings_cap() {
1056 1056
 	return wpinv_get_capability();
1057 1057
 }
1058
-add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' );
1058
+add_filter('option_page_capability_wpinv_settings', 'wpinv_set_settings_cap');
1059 1059
 
1060
-function wpinv_settings_sanitize_input( $value, $key ) {
1060
+function wpinv_settings_sanitize_input($value, $key) {
1061 1061
 
1062
-    if ( $key == 'tax_rate' ) {
1063
-        $value = wpinv_sanitize_amount( $value );
1064
-        $value = absint( min( $value, 99 ) );
1062
+    if ($key == 'tax_rate') {
1063
+        $value = wpinv_sanitize_amount($value);
1064
+        $value = absint(min($value, 99));
1065 1065
     }
1066 1066
 
1067 1067
     return $value;
1068 1068
 }
1069
-add_filter( 'wpinv_settings_sanitize', 'wpinv_settings_sanitize_input', 10, 2 );
1069
+add_filter('wpinv_settings_sanitize', 'wpinv_settings_sanitize_input', 10, 2);
1070 1070
 
1071
-function wpinv_on_update_settings( $old_value, $value, $option ) {
1072
-    $old = !empty( $old_value['remove_data_on_unistall'] ) ? 1 : '';
1073
-    $new = !empty( $value['remove_data_on_unistall'] ) ? 1 : '';
1071
+function wpinv_on_update_settings($old_value, $value, $option) {
1072
+    $old = !empty($old_value['remove_data_on_unistall']) ? 1 : '';
1073
+    $new = !empty($value['remove_data_on_unistall']) ? 1 : '';
1074 1074
     
1075
-    if ( $old != $new ) {
1076
-        update_option( 'wpinv_remove_data_on_invoice_unistall', $new );
1075
+    if ($old != $new) {
1076
+        update_option('wpinv_remove_data_on_invoice_unistall', $new);
1077 1077
     }
1078 1078
 }
1079
-add_action( 'update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3 );
1079
+add_action('update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3);
1080 1080
 
1081 1081
 /**
1082 1082
  * Returns the merge tags help text.
@@ -1085,16 +1085,16 @@  discard block
 block discarded – undo
1085 1085
  * 
1086 1086
  * @return string
1087 1087
  */
1088
-function wpinv_get_merge_tags_help_text( $subscription = false ) {
1088
+function wpinv_get_merge_tags_help_text($subscription = false) {
1089 1089
 
1090 1090
 	$url  = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f';
1091 1091
 	$link = sprintf(
1092 1092
 		'<strong><a href="%s" target="_blank">%s</a></strong>',
1093 1093
 		$url,
1094
-		esc_html__( 'View available merge tags.', 'wpinv-quotes' )
1094
+		esc_html__('View available merge tags.', 'wpinv-quotes')
1095 1095
 	);
1096 1096
 
1097
-	$description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' );
1097
+	$description = esc_html__('The content of the email (Merge Tags and HTML are allowed).', 'invoicing');
1098 1098
 
1099 1099
 	return "$description $link";
1100 1100
 
Please login to merge, or discard this patch.
templates/emails/invoice-item.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -10,66 +10,66 @@  discard block
 block discarded – undo
10 10
  * @var array $columns
11 11
  */
12 12
 
13
-defined( 'ABSPATH' ) || exit;
13
+defined('ABSPATH') || exit;
14 14
 
15 15
 ?>
16 16
 
17
-<?php do_action( 'getpaid_before_email_line_item', $invoice, $item ); ?>
17
+<?php do_action('getpaid_before_email_line_item', $invoice, $item); ?>
18 18
 
19
-<tr class="wpinv_cart_item item-type-<?php echo sanitize_html_class( $item->get_type() ); ?>">
19
+<tr class="wpinv_cart_item item-type-<?php echo sanitize_html_class($item->get_type()); ?>">
20 20
 
21
-    <?php foreach ( array_keys( $columns ) as $column ): ?>
21
+    <?php foreach (array_keys($columns) as $column): ?>
22 22
 
23
-        <td class="<?php echo 'name' == $column ? 'text-left' : 'text-right' ?> wpinv_cart_item_<?php echo sanitize_html_class( $column ); ?>">
23
+        <td class="<?php echo 'name' == $column ? 'text-left' : 'text-right' ?> wpinv_cart_item_<?php echo sanitize_html_class($column); ?>">
24 24
             
25 25
             <?php
26 26
 
27 27
                 // Fires before printing a line item column.
28
-                do_action( "getpaid_email_line_item_before_$column", $item, $invoice );
28
+                do_action("getpaid_email_line_item_before_$column", $item, $invoice);
29 29
 
30 30
                 // Item name.
31
-                if ( 'name' == $column ) {
31
+                if ('name' == $column) {
32 32
 
33 33
                     // Display the name.
34
-                    echo '<div class="wpinv_email_cart_item_title">' . sanitize_text_field( $item->get_name() ) . '</div>';
34
+                    echo '<div class="wpinv_email_cart_item_title">' . sanitize_text_field($item->get_name()) . '</div>';
35 35
 
36 36
                     // And an optional description.
37 37
                     $description = $item->get_description();
38 38
 
39
-                    if ( ! empty( $description ) ) {
40
-                        $description = wp_kses_post( $description );
39
+                    if (!empty($description)) {
40
+                        $description = wp_kses_post($description);
41 41
                         echo "<p class='small'>$description</p>";
42 42
                     }
43 43
 
44 44
                 }
45 45
 
46 46
                 // Item price.
47
-                if ( 'price' == $column ) {
47
+                if ('price' == $column) {
48 48
 
49 49
                     // Display the item price (or recurring price if this is a renewal invoice)
50 50
                     $price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price();
51
-                    echo wpinv_price( $price, $invoice->get_currency() );
51
+                    echo wpinv_price($price, $invoice->get_currency());
52 52
 
53 53
                 }
54 54
 
55 55
                 // Item quantity.
56
-                if ( 'quantity' == $column ) {
56
+                if ('quantity' == $column) {
57 57
                     echo (float) $item->get_quantity();
58 58
                 }
59 59
 
60 60
                 // Tax rate.
61
-                if ( 'tax_rate' == $column ) {
62
-                    echo round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) . '%';
61
+                if ('tax_rate' == $column) {
62
+                    echo round(getpaid_get_invoice_tax_rate($invoice, $item), 2) . '%';
63 63
                 }
64 64
 
65 65
                 // Item sub total.
66
-                if ( 'subtotal' == $column ) {
66
+                if ('subtotal' == $column) {
67 67
                     $subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total();
68
-                    echo wpinv_price( $subtotal, $invoice->get_currency() );
68
+                    echo wpinv_price($subtotal, $invoice->get_currency());
69 69
                 }
70 70
 
71 71
                 // Fires when printing a line item column.
72
-                do_action( "getpaid_email_line_item_$column", $item, $invoice );
72
+                do_action("getpaid_email_line_item_$column", $item, $invoice);
73 73
 
74 74
             ?>
75 75
 
@@ -79,4 +79,4 @@  discard block
 block discarded – undo
79 79
 
80 80
 </tr>
81 81
 
82
-<?php do_action( 'getpaid_after_email_line_item', $invoice, $item ); ?>
82
+<?php do_action('getpaid_after_email_line_item', $invoice, $item); ?>
Please login to merge, or discard this patch.
templates/invoice/line-item.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -10,55 +10,55 @@  discard block
 block discarded – undo
10 10
  * @var array $columns
11 11
  */
12 12
 
13
-defined( 'ABSPATH' ) || exit;
13
+defined('ABSPATH') || exit;
14 14
 
15
-do_action( 'getpaid_before_invoice_line_item', $invoice, $item );
15
+do_action('getpaid_before_invoice_line_item', $invoice, $item);
16 16
 
17 17
 ?>
18 18
 
19
-<div class='getpaid-invoice-item item-<?php echo (int) $item->get_id(); ?> item-type-<?php echo sanitize_html_class( $item->get_type() ); ?> border-bottom'>
19
+<div class='getpaid-invoice-item item-<?php echo (int) $item->get_id(); ?> item-type-<?php echo sanitize_html_class($item->get_type()); ?> border-bottom'>
20 20
 
21 21
     <div class="form-row">
22 22
 
23
-        <?php foreach ( array_keys( $columns ) as $column ): ?>
23
+        <?php foreach (array_keys($columns) as $column): ?>
24 24
 
25
-            <div class="<?php echo 'name' == $column ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> getpaid-invoice-item-<?php echo sanitize_html_class( $column ); ?>">
25
+            <div class="<?php echo 'name' == $column ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> getpaid-invoice-item-<?php echo sanitize_html_class($column); ?>">
26 26
 
27 27
                 <?php
28 28
 
29 29
                     // Fires before printing a line item column.
30
-                    do_action( "getpaid_invoice_line_item_before_$column", $item, $invoice );
30
+                    do_action("getpaid_invoice_line_item_before_$column", $item, $invoice);
31 31
 
32 32
                     // Item name.
33
-                    if ( 'name' == $column ) {
33
+                    if ('name' == $column) {
34 34
 
35 35
                         // Display the name.
36
-                        echo '<div class="mb-1">' . sanitize_text_field( $item->get_name() ) . '</div>';
36
+                        echo '<div class="mb-1">' . sanitize_text_field($item->get_name()) . '</div>';
37 37
 
38 38
                         // And an optional description.
39 39
                         $description = $item->get_description();
40 40
 
41
-                        if ( ! empty( $description ) ) {
42
-                            $description = wp_kses_post( $description );
41
+                        if (!empty($description)) {
42
+                            $description = wp_kses_post($description);
43 43
                             echo "<small class='form-text text-muted pr-2 m-0'>$description</small>";
44 44
                         }
45 45
 
46 46
                         // Fires before printing the line item actions.
47
-                        do_action( "getpaid_before_invoice_line_item_actions", $item, $invoice );
47
+                        do_action("getpaid_before_invoice_line_item_actions", $item, $invoice);
48 48
 
49
-                        $actions = apply_filters( 'getpaid-invoice-page-line-item-actions', array(), $item, $invoice );
49
+                        $actions = apply_filters('getpaid-invoice-page-line-item-actions', array(), $item, $invoice);
50 50
 
51
-                        if ( ! empty( $actions ) ) {
51
+                        if (!empty($actions)) {
52 52
 
53
-                            $sanitized  = array();
54
-                            foreach ( $actions as $key => $action ) {
55
-                                $key         = sanitize_html_class( $key );
56
-                                $action      = wp_kses_post( $action );
53
+                            $sanitized = array();
54
+                            foreach ($actions as $key => $action) {
55
+                                $key         = sanitize_html_class($key);
56
+                                $action      = wp_kses_post($action);
57 57
                                 $sanitized[] = "<span class='$key'>$action</span>";
58 58
                             }
59 59
 
60 60
                             echo "<small class='form-text getpaid-line-item-actions'>";
61
-                            echo implode( ' | ', $sanitized );
61
+                            echo implode(' | ', $sanitized);
62 62
                             echo '</small>';
63 63
 
64 64
                         }
@@ -66,35 +66,35 @@  discard block
 block discarded – undo
66 66
                     }
67 67
 
68 68
                     // Item price.
69
-                    if ( 'price' == $column ) {
69
+                    if ('price' == $column) {
70 70
 
71 71
                         // Display the item price (or recurring price if this is a renewal invoice)
72 72
                         $price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price();
73
-                        echo wpinv_price( $price, $invoice->get_currency() );
73
+                        echo wpinv_price($price, $invoice->get_currency());
74 74
 
75 75
                     }
76 76
 
77 77
                     // Tax rate.
78
-                    if ( 'tax_rate' == $column ) {
79
-                        echo round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) . '%';
78
+                    if ('tax_rate' == $column) {
79
+                        echo round(getpaid_get_invoice_tax_rate($invoice, $item), 2) . '%';
80 80
                     }
81 81
 
82 82
                     // Item quantity.
83
-                    if ( 'quantity' == $column ) {
83
+                    if ('quantity' == $column) {
84 84
                         echo (float) $item->get_quantity();
85 85
                     }
86 86
 
87 87
                     // Item sub total.
88
-                    if ( 'subtotal' == $column ) {
88
+                    if ('subtotal' == $column) {
89 89
                         $subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total();
90
-                        echo wpinv_price( $subtotal, $invoice->get_currency() );
90
+                        echo wpinv_price($subtotal, $invoice->get_currency());
91 91
                     }
92 92
 
93 93
                     // Fires when printing a line item column.
94
-                    do_action( "getpaid_invoice_line_item_$column", $item, $invoice );
94
+                    do_action("getpaid_invoice_line_item_$column", $item, $invoice);
95 95
 
96 96
                     // Fires after printing a line item column.
97
-                    do_action( "getpaid_invoice_line_item_after_$column", $item, $invoice );
97
+                    do_action("getpaid_invoice_line_item_after_$column", $item, $invoice);
98 98
 
99 99
                 ?>
100 100
 
Please login to merge, or discard this patch.
includes/class-getpaid-post-types.php 2 patches
Indentation   +305 added lines, -305 removed lines patch added patch discarded remove patch
@@ -15,331 +15,331 @@
 block discarded – undo
15 15
 class GetPaid_Post_Types {
16 16
 
17 17
     /**
18
-	 * Hook in methods.
19
-	 */
20
-	public function __construct() {
21
-		add_action( 'init', array( __CLASS__, 'register_post_types' ), 1 );
22
-		add_action( 'init', array( __CLASS__, 'register_post_status' ), 4 );
23
-		add_action( 'getpaid_flush_rewrite_rules', array( __CLASS__, 'flush_rewrite_rules' ) );
24
-		add_action( 'getpaid_after_register_post_types', array( __CLASS__, 'maybe_flush_rewrite_rules' ) );
25
-	}
18
+     * Hook in methods.
19
+     */
20
+    public function __construct() {
21
+        add_action( 'init', array( __CLASS__, 'register_post_types' ), 1 );
22
+        add_action( 'init', array( __CLASS__, 'register_post_status' ), 4 );
23
+        add_action( 'getpaid_flush_rewrite_rules', array( __CLASS__, 'flush_rewrite_rules' ) );
24
+        add_action( 'getpaid_after_register_post_types', array( __CLASS__, 'maybe_flush_rewrite_rules' ) );
25
+    }
26 26
 
27
-	/**
28
-	 * Register core post types.
29
-	 */
30
-	public static function register_post_types() {
27
+    /**
28
+     * Register core post types.
29
+     */
30
+    public static function register_post_types() {
31 31
 
32
-		if ( ! is_blog_installed() || post_type_exists( 'wpi_item' ) ) {
33
-			return;
34
-		}
32
+        if ( ! is_blog_installed() || post_type_exists( 'wpi_item' ) ) {
33
+            return;
34
+        }
35 35
 
36
-		$capabilities = wpinv_current_user_can_manage_invoicing();
36
+        $capabilities = wpinv_current_user_can_manage_invoicing();
37 37
 
38
-		// Fires before registering post types.
39
-		do_action( 'getpaid_register_post_types' );
38
+        // Fires before registering post types.
39
+        do_action( 'getpaid_register_post_types' );
40 40
 
41
-		// Register item post type.
42
-		register_post_type(
43
-			'wpi_item',
44
-			apply_filters(
45
-				'wpinv_register_post_type_invoice_item',
46
-				array(
47
-					'labels'             => array(
48
-						'name'               => _x( 'Items', 'post type general name', 'invoicing' ),
49
-						'singular_name'      => _x( 'Item', 'post type singular name', 'invoicing' ),
50
-						'menu_name'          => _x( 'Items', 'admin menu', 'invoicing' ),
51
-						'name_admin_bar'     => _x( 'Item', 'add new on admin bar', 'invoicing' ),
52
-						'add_new'            => _x( 'Add New', 'Item', 'invoicing' ),
53
-						'add_new_item'       => __( 'Add New Item', 'invoicing' ),
54
-						'new_item'           => __( 'New Item', 'invoicing' ),
55
-						'edit_item'          => __( 'Edit Item', 'invoicing' ),
56
-						'view_item'          => __( 'View Item', 'invoicing' ),
57
-						'all_items'          => __( 'Items', 'invoicing' ),
58
-						'search_items'       => __( 'Search items', 'invoicing' ),
59
-						'parent_item_colon'  => __( 'Parent item:', 'invoicing' ),
60
-						'not_found'          => __( 'No items found.', 'invoicing' ),
61
-						'not_found_in_trash' => __( 'No items found in trash.', 'invoicing' )
62
-					),
63
-					'description'           => __( 'This is where you can add new invoice items.', 'invoicing' ),
64
-					'public'                => false,
65
-					'has_archive'           => false,
66
-					'_builtin'              => false,
67
-					'show_ui'               => true,
68
-					'show_in_menu'          => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
69
-					'show_in_nav_menus'     => false,
70
-					'supports'              => array( 'title', 'excerpt', 'thumbnail' ),
71
-					'rewrite'               => false,
72
-					'query_var'             => false,
73
-					'map_meta_cap'          => true,
74
-					'show_in_admin_bar'     => true,
75
-					'can_export'            => true,
76
-				)
77
-			)
78
-		);
41
+        // Register item post type.
42
+        register_post_type(
43
+            'wpi_item',
44
+            apply_filters(
45
+                'wpinv_register_post_type_invoice_item',
46
+                array(
47
+                    'labels'             => array(
48
+                        'name'               => _x( 'Items', 'post type general name', 'invoicing' ),
49
+                        'singular_name'      => _x( 'Item', 'post type singular name', 'invoicing' ),
50
+                        'menu_name'          => _x( 'Items', 'admin menu', 'invoicing' ),
51
+                        'name_admin_bar'     => _x( 'Item', 'add new on admin bar', 'invoicing' ),
52
+                        'add_new'            => _x( 'Add New', 'Item', 'invoicing' ),
53
+                        'add_new_item'       => __( 'Add New Item', 'invoicing' ),
54
+                        'new_item'           => __( 'New Item', 'invoicing' ),
55
+                        'edit_item'          => __( 'Edit Item', 'invoicing' ),
56
+                        'view_item'          => __( 'View Item', 'invoicing' ),
57
+                        'all_items'          => __( 'Items', 'invoicing' ),
58
+                        'search_items'       => __( 'Search items', 'invoicing' ),
59
+                        'parent_item_colon'  => __( 'Parent item:', 'invoicing' ),
60
+                        'not_found'          => __( 'No items found.', 'invoicing' ),
61
+                        'not_found_in_trash' => __( 'No items found in trash.', 'invoicing' )
62
+                    ),
63
+                    'description'           => __( 'This is where you can add new invoice items.', 'invoicing' ),
64
+                    'public'                => false,
65
+                    'has_archive'           => false,
66
+                    '_builtin'              => false,
67
+                    'show_ui'               => true,
68
+                    'show_in_menu'          => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
69
+                    'show_in_nav_menus'     => false,
70
+                    'supports'              => array( 'title', 'excerpt', 'thumbnail' ),
71
+                    'rewrite'               => false,
72
+                    'query_var'             => false,
73
+                    'map_meta_cap'          => true,
74
+                    'show_in_admin_bar'     => true,
75
+                    'can_export'            => true,
76
+                )
77
+            )
78
+        );
79 79
 
80
-		// Register payment form post type.
81
-		register_post_type(
82
-			'wpi_payment_form',
83
-			apply_filters(
84
-				'wpinv_register_post_type_payment_form',
85
-				array(
86
-					'labels'             => array(
87
-						'name'               => _x( 'Payment Forms', 'post type general name', 'invoicing' ),
88
-						'singular_name'      => _x( 'Payment Form', 'post type singular name', 'invoicing' ),
89
-						'menu_name'          => _x( 'Payment Forms', 'admin menu', 'invoicing' ),
90
-						'name_admin_bar'     => _x( 'Payment Form', 'add new on admin bar', 'invoicing' ),
91
-						'add_new'            => _x( 'Add New', 'Payment Form', 'invoicing' ),
92
-						'add_new_item'       => __( 'Add New Payment Form', 'invoicing' ),
93
-						'new_item'           => __( 'New Payment Form', 'invoicing' ),
94
-						'edit_item'          => __( 'Edit Payment Form', 'invoicing' ),
95
-						'view_item'          => __( 'View Payment Form', 'invoicing' ),
96
-						'all_items'          => __( 'Payment Forms', 'invoicing' ),
97
-						'search_items'       => __( 'Search Payment Forms', 'invoicing' ),
98
-						'parent_item_colon'  => __( 'Parent Payment Forms:', 'invoicing' ),
99
-						'not_found'          => __( 'No payment forms found.', 'invoicing' ),
100
-						'not_found_in_trash' => __( 'No payment forms found in trash.', 'invoicing' )
101
-					),
102
-					'description'        => __( 'Add new payment forms.', 'invoicing' ),
103
-					'public'             => false,
104
-					'show_ui'            => true,
105
-					'show_in_menu'       => $capabilities ? 'wpinv' : true,
106
-					'show_in_nav_menus'  => false,
107
-					'query_var'          => false,
108
-					'rewrite'            => true,
109
-					'map_meta_cap'       => true,
110
-					'has_archive'        => false,
111
-					'hierarchical'       => false,
112
-					'menu_position'      => null,
113
-					'supports'           => array( 'title' ),
114
-					'menu_icon'          => 'dashicons-media-form',
115
-					'capabilities' => array(
116
-						'edit_post'          => $capabilities,
117
-						'read_post'          => $capabilities,
118
-						'delete_post'        => $capabilities,
119
-						'edit_posts'         => 'update_core',
120
-						'edit_others_posts'  => 'update_core',
121
-						'delete_posts'       => 'update_core',
122
-						'publish_posts'      => 'update_core',
123
-						'read_private_posts' => 'update_core'
124
-					),
125
-				)
126
-			)
127
-		);
80
+        // Register payment form post type.
81
+        register_post_type(
82
+            'wpi_payment_form',
83
+            apply_filters(
84
+                'wpinv_register_post_type_payment_form',
85
+                array(
86
+                    'labels'             => array(
87
+                        'name'               => _x( 'Payment Forms', 'post type general name', 'invoicing' ),
88
+                        'singular_name'      => _x( 'Payment Form', 'post type singular name', 'invoicing' ),
89
+                        'menu_name'          => _x( 'Payment Forms', 'admin menu', 'invoicing' ),
90
+                        'name_admin_bar'     => _x( 'Payment Form', 'add new on admin bar', 'invoicing' ),
91
+                        'add_new'            => _x( 'Add New', 'Payment Form', 'invoicing' ),
92
+                        'add_new_item'       => __( 'Add New Payment Form', 'invoicing' ),
93
+                        'new_item'           => __( 'New Payment Form', 'invoicing' ),
94
+                        'edit_item'          => __( 'Edit Payment Form', 'invoicing' ),
95
+                        'view_item'          => __( 'View Payment Form', 'invoicing' ),
96
+                        'all_items'          => __( 'Payment Forms', 'invoicing' ),
97
+                        'search_items'       => __( 'Search Payment Forms', 'invoicing' ),
98
+                        'parent_item_colon'  => __( 'Parent Payment Forms:', 'invoicing' ),
99
+                        'not_found'          => __( 'No payment forms found.', 'invoicing' ),
100
+                        'not_found_in_trash' => __( 'No payment forms found in trash.', 'invoicing' )
101
+                    ),
102
+                    'description'        => __( 'Add new payment forms.', 'invoicing' ),
103
+                    'public'             => false,
104
+                    'show_ui'            => true,
105
+                    'show_in_menu'       => $capabilities ? 'wpinv' : true,
106
+                    'show_in_nav_menus'  => false,
107
+                    'query_var'          => false,
108
+                    'rewrite'            => true,
109
+                    'map_meta_cap'       => true,
110
+                    'has_archive'        => false,
111
+                    'hierarchical'       => false,
112
+                    'menu_position'      => null,
113
+                    'supports'           => array( 'title' ),
114
+                    'menu_icon'          => 'dashicons-media-form',
115
+                    'capabilities' => array(
116
+                        'edit_post'          => $capabilities,
117
+                        'read_post'          => $capabilities,
118
+                        'delete_post'        => $capabilities,
119
+                        'edit_posts'         => 'update_core',
120
+                        'edit_others_posts'  => 'update_core',
121
+                        'delete_posts'       => 'update_core',
122
+                        'publish_posts'      => 'update_core',
123
+                        'read_private_posts' => 'update_core'
124
+                    ),
125
+                )
126
+            )
127
+        );
128 128
 
129
-		// Register invoice post type.
130
-		register_post_type(
131
-			'wpi_invoice',
132
-			apply_filters(
133
-				'wpinv_register_post_type_invoice',
134
-				array(
135
-					'labels'                 => array(
136
-						'name'                  => __( 'Invoices', 'invoicing' ),
137
-						'singular_name'         => __( 'Invoice', 'invoicing' ),
138
-						'all_items'             => __( 'Invoices', 'invoicing' ),
139
-						'menu_name'             => _x( 'Invoices', 'Admin menu name', 'invoicing' ),
140
-						'add_new'               => __( 'Add New', 'invoicing' ),
141
-						'add_new_item'          => __( 'Add new invoice', 'invoicing' ),
142
-						'edit'                  => __( 'Edit', 'invoicing' ),
143
-						'edit_item'             => __( 'Edit invoice', 'invoicing' ),
144
-						'new_item'              => __( 'New invoice', 'invoicing' ),
145
-						'view_item'             => __( 'View invoice', 'invoicing' ),
146
-						'view_items'            => __( 'View Invoices', 'invoicing' ),
147
-						'search_items'          => __( 'Search invoices', 'invoicing' ),
148
-						'not_found'             => __( 'No invoices found', 'invoicing' ),
149
-						'not_found_in_trash'    => __( 'No invoices found in trash', 'invoicing' ),
150
-						'parent'                => __( 'Parent invoice', 'invoicing' ),
151
-						'featured_image'        => __( 'Invoice image', 'invoicing' ),
152
-						'set_featured_image'    => __( 'Set invoice image', 'invoicing' ),
153
-						'remove_featured_image' => __( 'Remove invoice image', 'invoicing' ),
154
-						'use_featured_image'    => __( 'Use as invoice image', 'invoicing' ),
155
-						'insert_into_item'      => __( 'Insert into invoice', 'invoicing' ),
156
-						'uploaded_to_this_item' => __( 'Uploaded to this invoice', 'invoicing' ),
157
-						'filter_items_list'     => __( 'Filter invoices', 'invoicing' ),
158
-						'items_list_navigation' => __( 'Invoices navigation', 'invoicing' ),
159
-						'items_list'            => __( 'Invoices list', 'invoicing' ),
160
-					),
161
-					'description'           => __( 'This is where invoices are stored.', 'invoicing' ),
162
-					'public'                => true,
163
-					'has_archive'           => false,
164
-					'publicly_queryable'    => true,
165
-        			'exclude_from_search'   => true,
166
-        			'show_ui'               => true,
167
-					'show_in_menu'          => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
168
-					'show_in_nav_menus'     => false,
169
-					'supports'              => array( 'title', 'author', 'excerpt'  ),
170
-					'rewrite'               => array(
171
-						'slug'              => 'invoice',
172
-						'with_front'        => false,
173
-					),
174
-					'query_var'             => false,
175
-					'map_meta_cap'          => true,
176
-					'show_in_admin_bar'     => true,
177
-					'can_export'            => true,
178
-					'hierarchical'          => false,
179
-					'menu_position'         => null,
180
-					'menu_icon'             => 'dashicons-media-spreadsheet',
181
-				)
182
-			)
183
-		);
129
+        // Register invoice post type.
130
+        register_post_type(
131
+            'wpi_invoice',
132
+            apply_filters(
133
+                'wpinv_register_post_type_invoice',
134
+                array(
135
+                    'labels'                 => array(
136
+                        'name'                  => __( 'Invoices', 'invoicing' ),
137
+                        'singular_name'         => __( 'Invoice', 'invoicing' ),
138
+                        'all_items'             => __( 'Invoices', 'invoicing' ),
139
+                        'menu_name'             => _x( 'Invoices', 'Admin menu name', 'invoicing' ),
140
+                        'add_new'               => __( 'Add New', 'invoicing' ),
141
+                        'add_new_item'          => __( 'Add new invoice', 'invoicing' ),
142
+                        'edit'                  => __( 'Edit', 'invoicing' ),
143
+                        'edit_item'             => __( 'Edit invoice', 'invoicing' ),
144
+                        'new_item'              => __( 'New invoice', 'invoicing' ),
145
+                        'view_item'             => __( 'View invoice', 'invoicing' ),
146
+                        'view_items'            => __( 'View Invoices', 'invoicing' ),
147
+                        'search_items'          => __( 'Search invoices', 'invoicing' ),
148
+                        'not_found'             => __( 'No invoices found', 'invoicing' ),
149
+                        'not_found_in_trash'    => __( 'No invoices found in trash', 'invoicing' ),
150
+                        'parent'                => __( 'Parent invoice', 'invoicing' ),
151
+                        'featured_image'        => __( 'Invoice image', 'invoicing' ),
152
+                        'set_featured_image'    => __( 'Set invoice image', 'invoicing' ),
153
+                        'remove_featured_image' => __( 'Remove invoice image', 'invoicing' ),
154
+                        'use_featured_image'    => __( 'Use as invoice image', 'invoicing' ),
155
+                        'insert_into_item'      => __( 'Insert into invoice', 'invoicing' ),
156
+                        'uploaded_to_this_item' => __( 'Uploaded to this invoice', 'invoicing' ),
157
+                        'filter_items_list'     => __( 'Filter invoices', 'invoicing' ),
158
+                        'items_list_navigation' => __( 'Invoices navigation', 'invoicing' ),
159
+                        'items_list'            => __( 'Invoices list', 'invoicing' ),
160
+                    ),
161
+                    'description'           => __( 'This is where invoices are stored.', 'invoicing' ),
162
+                    'public'                => true,
163
+                    'has_archive'           => false,
164
+                    'publicly_queryable'    => true,
165
+                    'exclude_from_search'   => true,
166
+                    'show_ui'               => true,
167
+                    'show_in_menu'          => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
168
+                    'show_in_nav_menus'     => false,
169
+                    'supports'              => array( 'title', 'author', 'excerpt'  ),
170
+                    'rewrite'               => array(
171
+                        'slug'              => 'invoice',
172
+                        'with_front'        => false,
173
+                    ),
174
+                    'query_var'             => false,
175
+                    'map_meta_cap'          => true,
176
+                    'show_in_admin_bar'     => true,
177
+                    'can_export'            => true,
178
+                    'hierarchical'          => false,
179
+                    'menu_position'         => null,
180
+                    'menu_icon'             => 'dashicons-media-spreadsheet',
181
+                )
182
+            )
183
+        );
184 184
 
185
-		// Register discount post type.
186
-		register_post_type(
187
-			'wpi_discount',
188
-			apply_filters(
189
-				'wpinv_register_post_type_discount',
190
-				array(
191
-					'labels'                 => array(
192
-						'name'                  => __( 'Discounts', 'invoicing' ),
193
-						'singular_name'         => __( 'Discount', 'invoicing' ),
194
-						'all_items'             => __( 'Discounts', 'invoicing' ),
195
-						'menu_name'             => _x( 'Discounts', 'Admin menu name', 'invoicing' ),
196
-						'add_new'               => __( 'Add New', 'invoicing' ),
197
-						'add_new_item'          => __( 'Add new discount', 'invoicing' ),
198
-						'edit'                  => __( 'Edit', 'invoicing' ),
199
-						'edit_item'             => __( 'Edit discount', 'invoicing' ),
200
-						'new_item'              => __( 'New discount', 'invoicing' ),
201
-						'view_item'             => __( 'View discount', 'invoicing' ),
202
-						'view_items'            => __( 'View Discounts', 'invoicing' ),
203
-						'search_items'          => __( 'Search discounts', 'invoicing' ),
204
-						'not_found'             => __( 'No discounts found', 'invoicing' ),
205
-						'not_found_in_trash'    => __( 'No discounts found in trash', 'invoicing' ),
206
-						'parent'                => __( 'Parent discount', 'invoicing' ),
207
-						'featured_image'        => __( 'Discount image', 'invoicing' ),
208
-						'set_featured_image'    => __( 'Set discount image', 'invoicing' ),
209
-						'remove_featured_image' => __( 'Remove discount image', 'invoicing' ),
210
-						'use_featured_image'    => __( 'Use as discount image', 'invoicing' ),
211
-						'insert_into_item'      => __( 'Insert into discount', 'invoicing' ),
212
-						'uploaded_to_this_item' => __( 'Uploaded to this discount', 'invoicing' ),
213
-						'filter_items_list'     => __( 'Filter discounts', 'invoicing' ),
214
-						'items_list_navigation' => __( 'Discount navigation', 'invoicing' ),
215
-						'items_list'            => __( 'Discounts list', 'invoicing' ),
216
-					),
217
-					'description'        => __( 'This is where you can add new discounts that users can use in invoices.', 'invoicing' ),
218
-					'public'             => false,
219
-					'can_export'         => true,
220
-					'_builtin'           => false,
221
-					'publicly_queryable' => false,
222
-					'exclude_from_search'=> true,
223
-					'show_ui'            => true,
224
-					'show_in_menu'       => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
225
-					'query_var'          => false,
226
-					'rewrite'            => false,
227
-					'map_meta_cap'       => true,
228
-					'has_archive'        => false,
229
-					'hierarchical'       => false,
230
-					'supports'           => array( 'title', 'excerpt' ),
231
-					'show_in_nav_menus'  => false,
232
-					'show_in_admin_bar'  => true,
233
-					'menu_position'      => null,
234
-				)
235
-			)
236
-		);
185
+        // Register discount post type.
186
+        register_post_type(
187
+            'wpi_discount',
188
+            apply_filters(
189
+                'wpinv_register_post_type_discount',
190
+                array(
191
+                    'labels'                 => array(
192
+                        'name'                  => __( 'Discounts', 'invoicing' ),
193
+                        'singular_name'         => __( 'Discount', 'invoicing' ),
194
+                        'all_items'             => __( 'Discounts', 'invoicing' ),
195
+                        'menu_name'             => _x( 'Discounts', 'Admin menu name', 'invoicing' ),
196
+                        'add_new'               => __( 'Add New', 'invoicing' ),
197
+                        'add_new_item'          => __( 'Add new discount', 'invoicing' ),
198
+                        'edit'                  => __( 'Edit', 'invoicing' ),
199
+                        'edit_item'             => __( 'Edit discount', 'invoicing' ),
200
+                        'new_item'              => __( 'New discount', 'invoicing' ),
201
+                        'view_item'             => __( 'View discount', 'invoicing' ),
202
+                        'view_items'            => __( 'View Discounts', 'invoicing' ),
203
+                        'search_items'          => __( 'Search discounts', 'invoicing' ),
204
+                        'not_found'             => __( 'No discounts found', 'invoicing' ),
205
+                        'not_found_in_trash'    => __( 'No discounts found in trash', 'invoicing' ),
206
+                        'parent'                => __( 'Parent discount', 'invoicing' ),
207
+                        'featured_image'        => __( 'Discount image', 'invoicing' ),
208
+                        'set_featured_image'    => __( 'Set discount image', 'invoicing' ),
209
+                        'remove_featured_image' => __( 'Remove discount image', 'invoicing' ),
210
+                        'use_featured_image'    => __( 'Use as discount image', 'invoicing' ),
211
+                        'insert_into_item'      => __( 'Insert into discount', 'invoicing' ),
212
+                        'uploaded_to_this_item' => __( 'Uploaded to this discount', 'invoicing' ),
213
+                        'filter_items_list'     => __( 'Filter discounts', 'invoicing' ),
214
+                        'items_list_navigation' => __( 'Discount navigation', 'invoicing' ),
215
+                        'items_list'            => __( 'Discounts list', 'invoicing' ),
216
+                    ),
217
+                    'description'        => __( 'This is where you can add new discounts that users can use in invoices.', 'invoicing' ),
218
+                    'public'             => false,
219
+                    'can_export'         => true,
220
+                    '_builtin'           => false,
221
+                    'publicly_queryable' => false,
222
+                    'exclude_from_search'=> true,
223
+                    'show_ui'            => true,
224
+                    'show_in_menu'       => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
225
+                    'query_var'          => false,
226
+                    'rewrite'            => false,
227
+                    'map_meta_cap'       => true,
228
+                    'has_archive'        => false,
229
+                    'hierarchical'       => false,
230
+                    'supports'           => array( 'title', 'excerpt' ),
231
+                    'show_in_nav_menus'  => false,
232
+                    'show_in_admin_bar'  => true,
233
+                    'menu_position'      => null,
234
+                )
235
+            )
236
+        );
237 237
 
238
-		do_action( 'getpaid_after_register_post_types' );
239
-	}
238
+        do_action( 'getpaid_after_register_post_types' );
239
+    }
240 240
 
241
-	/**
242
-	 * Register our custom post statuses.
243
-	 */
244
-	public static function register_post_status() {
241
+    /**
242
+     * Register our custom post statuses.
243
+     */
244
+    public static function register_post_status() {
245 245
 
246
-		$invoice_statuses = apply_filters(
247
-			'getpaid_register_invoice_post_statuses',
248
-			array(
246
+        $invoice_statuses = apply_filters(
247
+            'getpaid_register_invoice_post_statuses',
248
+            array(
249 249
 
250
-				'wpi-pending' => array(
251
-					'label'                     => _x( 'Pending Payment', 'Invoice status', 'invoicing' ),
252
-        			'public'                    => true,
253
-        			'exclude_from_search'       => true,
254
-        			'show_in_admin_all_list'    => true,
255
-					'show_in_admin_status_list' => true,
256
-					/* translators: %s: number of invoices */
257
-        			'label_count'               => _n_noop( 'Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing' )
258
-				),
250
+                'wpi-pending' => array(
251
+                    'label'                     => _x( 'Pending Payment', 'Invoice status', 'invoicing' ),
252
+                    'public'                    => true,
253
+                    'exclude_from_search'       => true,
254
+                    'show_in_admin_all_list'    => true,
255
+                    'show_in_admin_status_list' => true,
256
+                    /* translators: %s: number of invoices */
257
+                    'label_count'               => _n_noop( 'Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing' )
258
+                ),
259 259
 
260
-				'wpi-processing' => array(
261
-					'label'                     => _x( 'Processing', 'Invoice status', 'invoicing' ),
262
-        			'public'                    => true,
263
-        			'exclude_from_search'       => true,
264
-        			'show_in_admin_all_list'    => true,
265
-					'show_in_admin_status_list' => true,
266
-					/* translators: %s: number of invoices */
267
-        			'label_count'               => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing' )
268
-				),
260
+                'wpi-processing' => array(
261
+                    'label'                     => _x( 'Processing', 'Invoice status', 'invoicing' ),
262
+                    'public'                    => true,
263
+                    'exclude_from_search'       => true,
264
+                    'show_in_admin_all_list'    => true,
265
+                    'show_in_admin_status_list' => true,
266
+                    /* translators: %s: number of invoices */
267
+                    'label_count'               => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing' )
268
+                ),
269 269
 
270
-				'wpi-onhold' => array(
271
-					'label'                     => _x( 'On Hold', 'Invoice status', 'invoicing' ),
272
-        			'public'                    => true,
273
-        			'exclude_from_search'       => true,
274
-        			'show_in_admin_all_list'    => true,
275
-					'show_in_admin_status_list' => true,
276
-					/* translators: %s: number of invoices */
277
-        			'label_count'               => _n_noop( 'On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing' )
278
-				),
270
+                'wpi-onhold' => array(
271
+                    'label'                     => _x( 'On Hold', 'Invoice status', 'invoicing' ),
272
+                    'public'                    => true,
273
+                    'exclude_from_search'       => true,
274
+                    'show_in_admin_all_list'    => true,
275
+                    'show_in_admin_status_list' => true,
276
+                    /* translators: %s: number of invoices */
277
+                    'label_count'               => _n_noop( 'On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing' )
278
+                ),
279 279
 
280
-				'wpi-cancelled' => array(
281
-					'label'                     => _x( 'Cancelled', 'Invoice status', 'invoicing' ),
282
-        			'public'                    => true,
283
-        			'exclude_from_search'       => true,
284
-        			'show_in_admin_all_list'    => true,
285
-					'show_in_admin_status_list' => true,
286
-					/* translators: %s: number of invoices */
287
-        			'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing' )
288
-				),
280
+                'wpi-cancelled' => array(
281
+                    'label'                     => _x( 'Cancelled', 'Invoice status', 'invoicing' ),
282
+                    'public'                    => true,
283
+                    'exclude_from_search'       => true,
284
+                    'show_in_admin_all_list'    => true,
285
+                    'show_in_admin_status_list' => true,
286
+                    /* translators: %s: number of invoices */
287
+                    'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing' )
288
+                ),
289 289
 
290
-				'wpi-refunded' => array(
291
-					'label'                     => _x( 'Refunded', 'Invoice status', 'invoicing' ),
292
-        			'public'                    => true,
293
-        			'exclude_from_search'       => true,
294
-        			'show_in_admin_all_list'    => true,
295
-					'show_in_admin_status_list' => true,
296
-					/* translators: %s: number of invoices */
297
-        			'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing' )
298
-				),
290
+                'wpi-refunded' => array(
291
+                    'label'                     => _x( 'Refunded', 'Invoice status', 'invoicing' ),
292
+                    'public'                    => true,
293
+                    'exclude_from_search'       => true,
294
+                    'show_in_admin_all_list'    => true,
295
+                    'show_in_admin_status_list' => true,
296
+                    /* translators: %s: number of invoices */
297
+                    'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing' )
298
+                ),
299 299
 
300
-				'wpi-failed' => array(
301
-					'label'                     => _x( 'Failed', 'Invoice status', 'invoicing' ),
302
-        			'public'                    => true,
303
-        			'exclude_from_search'       => true,
304
-        			'show_in_admin_all_list'    => true,
305
-					'show_in_admin_status_list' => true,
306
-					/* translators: %s: number of invoices */
307
-        			'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing' )
308
-				),
300
+                'wpi-failed' => array(
301
+                    'label'                     => _x( 'Failed', 'Invoice status', 'invoicing' ),
302
+                    'public'                    => true,
303
+                    'exclude_from_search'       => true,
304
+                    'show_in_admin_all_list'    => true,
305
+                    'show_in_admin_status_list' => true,
306
+                    /* translators: %s: number of invoices */
307
+                    'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing' )
308
+                ),
309 309
 
310
-				'wpi-renewal' => array(
311
-					'label'                     => _x( 'Renewal', 'Invoice status', 'invoicing' ),
312
-        			'public'                    => true,
313
-        			'exclude_from_search'       => true,
314
-        			'show_in_admin_all_list'    => true,
315
-					'show_in_admin_status_list' => true,
316
-					/* translators: %s: number of invoices */
317
-        			'label_count'               => _n_noop( 'Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing' )
318
-				)
319
-			)
320
-		);
310
+                'wpi-renewal' => array(
311
+                    'label'                     => _x( 'Renewal', 'Invoice status', 'invoicing' ),
312
+                    'public'                    => true,
313
+                    'exclude_from_search'       => true,
314
+                    'show_in_admin_all_list'    => true,
315
+                    'show_in_admin_status_list' => true,
316
+                    /* translators: %s: number of invoices */
317
+                    'label_count'               => _n_noop( 'Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing' )
318
+                )
319
+            )
320
+        );
321 321
 
322
-		foreach ( $invoice_statuses as $invoice_statuse => $args ) {
323
-			register_post_status( $invoice_statuse, $args );
324
-		}
325
-	}
322
+        foreach ( $invoice_statuses as $invoice_statuse => $args ) {
323
+            register_post_status( $invoice_statuse, $args );
324
+        }
325
+    }
326 326
 
327
-	/**
328
-	 * Flush rewrite rules.
329
-	 */
330
-	public static function flush_rewrite_rules() {
331
-		flush_rewrite_rules();
332
-	}
327
+    /**
328
+     * Flush rewrite rules.
329
+     */
330
+    public static function flush_rewrite_rules() {
331
+        flush_rewrite_rules();
332
+    }
333 333
 
334
-	/**
335
-	 * Flush rules to prevent 404.
336
-	 *
337
-	 */
338
-	public static function maybe_flush_rewrite_rules() {
339
-		if ( ! get_option( 'getpaid_flushed_rewrite_rules' ) ) {
340
-			update_option( 'getpaid_flushed_rewrite_rules', '1' );
341
-			self::flush_rewrite_rules();
342
-		}
343
-	}
334
+    /**
335
+     * Flush rules to prevent 404.
336
+     *
337
+     */
338
+    public static function maybe_flush_rewrite_rules() {
339
+        if ( ! get_option( 'getpaid_flushed_rewrite_rules' ) ) {
340
+            update_option( 'getpaid_flushed_rewrite_rules', '1' );
341
+            self::flush_rewrite_rules();
342
+        }
343
+    }
344 344
 
345 345
 }
Please login to merge, or discard this patch.
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  *
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Post types Class
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 	 * Hook in methods.
19 19
 	 */
20 20
 	public function __construct() {
21
-		add_action( 'init', array( __CLASS__, 'register_post_types' ), 1 );
22
-		add_action( 'init', array( __CLASS__, 'register_post_status' ), 4 );
23
-		add_action( 'getpaid_flush_rewrite_rules', array( __CLASS__, 'flush_rewrite_rules' ) );
24
-		add_action( 'getpaid_after_register_post_types', array( __CLASS__, 'maybe_flush_rewrite_rules' ) );
21
+		add_action('init', array(__CLASS__, 'register_post_types'), 1);
22
+		add_action('init', array(__CLASS__, 'register_post_status'), 4);
23
+		add_action('getpaid_flush_rewrite_rules', array(__CLASS__, 'flush_rewrite_rules'));
24
+		add_action('getpaid_after_register_post_types', array(__CLASS__, 'maybe_flush_rewrite_rules'));
25 25
 	}
26 26
 
27 27
 	/**
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public static function register_post_types() {
31 31
 
32
-		if ( ! is_blog_installed() || post_type_exists( 'wpi_item' ) ) {
32
+		if (!is_blog_installed() || post_type_exists('wpi_item')) {
33 33
 			return;
34 34
 		}
35 35
 
36 36
 		$capabilities = wpinv_current_user_can_manage_invoicing();
37 37
 
38 38
 		// Fires before registering post types.
39
-		do_action( 'getpaid_register_post_types' );
39
+		do_action('getpaid_register_post_types');
40 40
 
41 41
 		// Register item post type.
42 42
 		register_post_type(
@@ -45,29 +45,29 @@  discard block
 block discarded – undo
45 45
 				'wpinv_register_post_type_invoice_item',
46 46
 				array(
47 47
 					'labels'             => array(
48
-						'name'               => _x( 'Items', 'post type general name', 'invoicing' ),
49
-						'singular_name'      => _x( 'Item', 'post type singular name', 'invoicing' ),
50
-						'menu_name'          => _x( 'Items', 'admin menu', 'invoicing' ),
51
-						'name_admin_bar'     => _x( 'Item', 'add new on admin bar', 'invoicing' ),
52
-						'add_new'            => _x( 'Add New', 'Item', 'invoicing' ),
53
-						'add_new_item'       => __( 'Add New Item', 'invoicing' ),
54
-						'new_item'           => __( 'New Item', 'invoicing' ),
55
-						'edit_item'          => __( 'Edit Item', 'invoicing' ),
56
-						'view_item'          => __( 'View Item', 'invoicing' ),
57
-						'all_items'          => __( 'Items', 'invoicing' ),
58
-						'search_items'       => __( 'Search items', 'invoicing' ),
59
-						'parent_item_colon'  => __( 'Parent item:', 'invoicing' ),
60
-						'not_found'          => __( 'No items found.', 'invoicing' ),
61
-						'not_found_in_trash' => __( 'No items found in trash.', 'invoicing' )
48
+						'name'               => _x('Items', 'post type general name', 'invoicing'),
49
+						'singular_name'      => _x('Item', 'post type singular name', 'invoicing'),
50
+						'menu_name'          => _x('Items', 'admin menu', 'invoicing'),
51
+						'name_admin_bar'     => _x('Item', 'add new on admin bar', 'invoicing'),
52
+						'add_new'            => _x('Add New', 'Item', 'invoicing'),
53
+						'add_new_item'       => __('Add New Item', 'invoicing'),
54
+						'new_item'           => __('New Item', 'invoicing'),
55
+						'edit_item'          => __('Edit Item', 'invoicing'),
56
+						'view_item'          => __('View Item', 'invoicing'),
57
+						'all_items'          => __('Items', 'invoicing'),
58
+						'search_items'       => __('Search items', 'invoicing'),
59
+						'parent_item_colon'  => __('Parent item:', 'invoicing'),
60
+						'not_found'          => __('No items found.', 'invoicing'),
61
+						'not_found_in_trash' => __('No items found in trash.', 'invoicing')
62 62
 					),
63
-					'description'           => __( 'This is where you can add new invoice items.', 'invoicing' ),
63
+					'description'           => __('This is where you can add new invoice items.', 'invoicing'),
64 64
 					'public'                => false,
65 65
 					'has_archive'           => false,
66 66
 					'_builtin'              => false,
67 67
 					'show_ui'               => true,
68 68
 					'show_in_menu'          => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
69 69
 					'show_in_nav_menus'     => false,
70
-					'supports'              => array( 'title', 'excerpt', 'thumbnail' ),
70
+					'supports'              => array('title', 'excerpt', 'thumbnail'),
71 71
 					'rewrite'               => false,
72 72
 					'query_var'             => false,
73 73
 					'map_meta_cap'          => true,
@@ -84,22 +84,22 @@  discard block
 block discarded – undo
84 84
 				'wpinv_register_post_type_payment_form',
85 85
 				array(
86 86
 					'labels'             => array(
87
-						'name'               => _x( 'Payment Forms', 'post type general name', 'invoicing' ),
88
-						'singular_name'      => _x( 'Payment Form', 'post type singular name', 'invoicing' ),
89
-						'menu_name'          => _x( 'Payment Forms', 'admin menu', 'invoicing' ),
90
-						'name_admin_bar'     => _x( 'Payment Form', 'add new on admin bar', 'invoicing' ),
91
-						'add_new'            => _x( 'Add New', 'Payment Form', 'invoicing' ),
92
-						'add_new_item'       => __( 'Add New Payment Form', 'invoicing' ),
93
-						'new_item'           => __( 'New Payment Form', 'invoicing' ),
94
-						'edit_item'          => __( 'Edit Payment Form', 'invoicing' ),
95
-						'view_item'          => __( 'View Payment Form', 'invoicing' ),
96
-						'all_items'          => __( 'Payment Forms', 'invoicing' ),
97
-						'search_items'       => __( 'Search Payment Forms', 'invoicing' ),
98
-						'parent_item_colon'  => __( 'Parent Payment Forms:', 'invoicing' ),
99
-						'not_found'          => __( 'No payment forms found.', 'invoicing' ),
100
-						'not_found_in_trash' => __( 'No payment forms found in trash.', 'invoicing' )
87
+						'name'               => _x('Payment Forms', 'post type general name', 'invoicing'),
88
+						'singular_name'      => _x('Payment Form', 'post type singular name', 'invoicing'),
89
+						'menu_name'          => _x('Payment Forms', 'admin menu', 'invoicing'),
90
+						'name_admin_bar'     => _x('Payment Form', 'add new on admin bar', 'invoicing'),
91
+						'add_new'            => _x('Add New', 'Payment Form', 'invoicing'),
92
+						'add_new_item'       => __('Add New Payment Form', 'invoicing'),
93
+						'new_item'           => __('New Payment Form', 'invoicing'),
94
+						'edit_item'          => __('Edit Payment Form', 'invoicing'),
95
+						'view_item'          => __('View Payment Form', 'invoicing'),
96
+						'all_items'          => __('Payment Forms', 'invoicing'),
97
+						'search_items'       => __('Search Payment Forms', 'invoicing'),
98
+						'parent_item_colon'  => __('Parent Payment Forms:', 'invoicing'),
99
+						'not_found'          => __('No payment forms found.', 'invoicing'),
100
+						'not_found_in_trash' => __('No payment forms found in trash.', 'invoicing')
101 101
 					),
102
-					'description'        => __( 'Add new payment forms.', 'invoicing' ),
102
+					'description'        => __('Add new payment forms.', 'invoicing'),
103 103
 					'public'             => false,
104 104
 					'show_ui'            => true,
105 105
 					'show_in_menu'       => $capabilities ? 'wpinv' : true,
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 					'has_archive'        => false,
111 111
 					'hierarchical'       => false,
112 112
 					'menu_position'      => null,
113
-					'supports'           => array( 'title' ),
113
+					'supports'           => array('title'),
114 114
 					'menu_icon'          => 'dashicons-media-form',
115 115
 					'capabilities' => array(
116 116
 						'edit_post'          => $capabilities,
@@ -133,32 +133,32 @@  discard block
 block discarded – undo
133 133
 				'wpinv_register_post_type_invoice',
134 134
 				array(
135 135
 					'labels'                 => array(
136
-						'name'                  => __( 'Invoices', 'invoicing' ),
137
-						'singular_name'         => __( 'Invoice', 'invoicing' ),
138
-						'all_items'             => __( 'Invoices', 'invoicing' ),
139
-						'menu_name'             => _x( 'Invoices', 'Admin menu name', 'invoicing' ),
140
-						'add_new'               => __( 'Add New', 'invoicing' ),
141
-						'add_new_item'          => __( 'Add new invoice', 'invoicing' ),
142
-						'edit'                  => __( 'Edit', 'invoicing' ),
143
-						'edit_item'             => __( 'Edit invoice', 'invoicing' ),
144
-						'new_item'              => __( 'New invoice', 'invoicing' ),
145
-						'view_item'             => __( 'View invoice', 'invoicing' ),
146
-						'view_items'            => __( 'View Invoices', 'invoicing' ),
147
-						'search_items'          => __( 'Search invoices', 'invoicing' ),
148
-						'not_found'             => __( 'No invoices found', 'invoicing' ),
149
-						'not_found_in_trash'    => __( 'No invoices found in trash', 'invoicing' ),
150
-						'parent'                => __( 'Parent invoice', 'invoicing' ),
151
-						'featured_image'        => __( 'Invoice image', 'invoicing' ),
152
-						'set_featured_image'    => __( 'Set invoice image', 'invoicing' ),
153
-						'remove_featured_image' => __( 'Remove invoice image', 'invoicing' ),
154
-						'use_featured_image'    => __( 'Use as invoice image', 'invoicing' ),
155
-						'insert_into_item'      => __( 'Insert into invoice', 'invoicing' ),
156
-						'uploaded_to_this_item' => __( 'Uploaded to this invoice', 'invoicing' ),
157
-						'filter_items_list'     => __( 'Filter invoices', 'invoicing' ),
158
-						'items_list_navigation' => __( 'Invoices navigation', 'invoicing' ),
159
-						'items_list'            => __( 'Invoices list', 'invoicing' ),
136
+						'name'                  => __('Invoices', 'invoicing'),
137
+						'singular_name'         => __('Invoice', 'invoicing'),
138
+						'all_items'             => __('Invoices', 'invoicing'),
139
+						'menu_name'             => _x('Invoices', 'Admin menu name', 'invoicing'),
140
+						'add_new'               => __('Add New', 'invoicing'),
141
+						'add_new_item'          => __('Add new invoice', 'invoicing'),
142
+						'edit'                  => __('Edit', 'invoicing'),
143
+						'edit_item'             => __('Edit invoice', 'invoicing'),
144
+						'new_item'              => __('New invoice', 'invoicing'),
145
+						'view_item'             => __('View invoice', 'invoicing'),
146
+						'view_items'            => __('View Invoices', 'invoicing'),
147
+						'search_items'          => __('Search invoices', 'invoicing'),
148
+						'not_found'             => __('No invoices found', 'invoicing'),
149
+						'not_found_in_trash'    => __('No invoices found in trash', 'invoicing'),
150
+						'parent'                => __('Parent invoice', 'invoicing'),
151
+						'featured_image'        => __('Invoice image', 'invoicing'),
152
+						'set_featured_image'    => __('Set invoice image', 'invoicing'),
153
+						'remove_featured_image' => __('Remove invoice image', 'invoicing'),
154
+						'use_featured_image'    => __('Use as invoice image', 'invoicing'),
155
+						'insert_into_item'      => __('Insert into invoice', 'invoicing'),
156
+						'uploaded_to_this_item' => __('Uploaded to this invoice', 'invoicing'),
157
+						'filter_items_list'     => __('Filter invoices', 'invoicing'),
158
+						'items_list_navigation' => __('Invoices navigation', 'invoicing'),
159
+						'items_list'            => __('Invoices list', 'invoicing'),
160 160
 					),
161
-					'description'           => __( 'This is where invoices are stored.', 'invoicing' ),
161
+					'description'           => __('This is where invoices are stored.', 'invoicing'),
162 162
 					'public'                => true,
163 163
 					'has_archive'           => false,
164 164
 					'publicly_queryable'    => true,
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         			'show_ui'               => true,
167 167
 					'show_in_menu'          => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
168 168
 					'show_in_nav_menus'     => false,
169
-					'supports'              => array( 'title', 'author', 'excerpt'  ),
169
+					'supports'              => array('title', 'author', 'excerpt'),
170 170
 					'rewrite'               => array(
171 171
 						'slug'              => 'invoice',
172 172
 						'with_front'        => false,
@@ -189,32 +189,32 @@  discard block
 block discarded – undo
189 189
 				'wpinv_register_post_type_discount',
190 190
 				array(
191 191
 					'labels'                 => array(
192
-						'name'                  => __( 'Discounts', 'invoicing' ),
193
-						'singular_name'         => __( 'Discount', 'invoicing' ),
194
-						'all_items'             => __( 'Discounts', 'invoicing' ),
195
-						'menu_name'             => _x( 'Discounts', 'Admin menu name', 'invoicing' ),
196
-						'add_new'               => __( 'Add New', 'invoicing' ),
197
-						'add_new_item'          => __( 'Add new discount', 'invoicing' ),
198
-						'edit'                  => __( 'Edit', 'invoicing' ),
199
-						'edit_item'             => __( 'Edit discount', 'invoicing' ),
200
-						'new_item'              => __( 'New discount', 'invoicing' ),
201
-						'view_item'             => __( 'View discount', 'invoicing' ),
202
-						'view_items'            => __( 'View Discounts', 'invoicing' ),
203
-						'search_items'          => __( 'Search discounts', 'invoicing' ),
204
-						'not_found'             => __( 'No discounts found', 'invoicing' ),
205
-						'not_found_in_trash'    => __( 'No discounts found in trash', 'invoicing' ),
206
-						'parent'                => __( 'Parent discount', 'invoicing' ),
207
-						'featured_image'        => __( 'Discount image', 'invoicing' ),
208
-						'set_featured_image'    => __( 'Set discount image', 'invoicing' ),
209
-						'remove_featured_image' => __( 'Remove discount image', 'invoicing' ),
210
-						'use_featured_image'    => __( 'Use as discount image', 'invoicing' ),
211
-						'insert_into_item'      => __( 'Insert into discount', 'invoicing' ),
212
-						'uploaded_to_this_item' => __( 'Uploaded to this discount', 'invoicing' ),
213
-						'filter_items_list'     => __( 'Filter discounts', 'invoicing' ),
214
-						'items_list_navigation' => __( 'Discount navigation', 'invoicing' ),
215
-						'items_list'            => __( 'Discounts list', 'invoicing' ),
192
+						'name'                  => __('Discounts', 'invoicing'),
193
+						'singular_name'         => __('Discount', 'invoicing'),
194
+						'all_items'             => __('Discounts', 'invoicing'),
195
+						'menu_name'             => _x('Discounts', 'Admin menu name', 'invoicing'),
196
+						'add_new'               => __('Add New', 'invoicing'),
197
+						'add_new_item'          => __('Add new discount', 'invoicing'),
198
+						'edit'                  => __('Edit', 'invoicing'),
199
+						'edit_item'             => __('Edit discount', 'invoicing'),
200
+						'new_item'              => __('New discount', 'invoicing'),
201
+						'view_item'             => __('View discount', 'invoicing'),
202
+						'view_items'            => __('View Discounts', 'invoicing'),
203
+						'search_items'          => __('Search discounts', 'invoicing'),
204
+						'not_found'             => __('No discounts found', 'invoicing'),
205
+						'not_found_in_trash'    => __('No discounts found in trash', 'invoicing'),
206
+						'parent'                => __('Parent discount', 'invoicing'),
207
+						'featured_image'        => __('Discount image', 'invoicing'),
208
+						'set_featured_image'    => __('Set discount image', 'invoicing'),
209
+						'remove_featured_image' => __('Remove discount image', 'invoicing'),
210
+						'use_featured_image'    => __('Use as discount image', 'invoicing'),
211
+						'insert_into_item'      => __('Insert into discount', 'invoicing'),
212
+						'uploaded_to_this_item' => __('Uploaded to this discount', 'invoicing'),
213
+						'filter_items_list'     => __('Filter discounts', 'invoicing'),
214
+						'items_list_navigation' => __('Discount navigation', 'invoicing'),
215
+						'items_list'            => __('Discounts list', 'invoicing'),
216 216
 					),
217
-					'description'        => __( 'This is where you can add new discounts that users can use in invoices.', 'invoicing' ),
217
+					'description'        => __('This is where you can add new discounts that users can use in invoices.', 'invoicing'),
218 218
 					'public'             => false,
219 219
 					'can_export'         => true,
220 220
 					'_builtin'           => false,
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 					'map_meta_cap'       => true,
228 228
 					'has_archive'        => false,
229 229
 					'hierarchical'       => false,
230
-					'supports'           => array( 'title', 'excerpt' ),
230
+					'supports'           => array('title', 'excerpt'),
231 231
 					'show_in_nav_menus'  => false,
232 232
 					'show_in_admin_bar'  => true,
233 233
 					'menu_position'      => null,
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 			)
236 236
 		);
237 237
 
238
-		do_action( 'getpaid_after_register_post_types' );
238
+		do_action('getpaid_after_register_post_types');
239 239
 	}
240 240
 
241 241
 	/**
@@ -248,79 +248,79 @@  discard block
 block discarded – undo
248 248
 			array(
249 249
 
250 250
 				'wpi-pending' => array(
251
-					'label'                     => _x( 'Pending Payment', 'Invoice status', 'invoicing' ),
251
+					'label'                     => _x('Pending Payment', 'Invoice status', 'invoicing'),
252 252
         			'public'                    => true,
253 253
         			'exclude_from_search'       => true,
254 254
         			'show_in_admin_all_list'    => true,
255 255
 					'show_in_admin_status_list' => true,
256 256
 					/* translators: %s: number of invoices */
257
-        			'label_count'               => _n_noop( 'Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing' )
257
+        			'label_count'               => _n_noop('Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing')
258 258
 				),
259 259
 
260 260
 				'wpi-processing' => array(
261
-					'label'                     => _x( 'Processing', 'Invoice status', 'invoicing' ),
261
+					'label'                     => _x('Processing', 'Invoice status', 'invoicing'),
262 262
         			'public'                    => true,
263 263
         			'exclude_from_search'       => true,
264 264
         			'show_in_admin_all_list'    => true,
265 265
 					'show_in_admin_status_list' => true,
266 266
 					/* translators: %s: number of invoices */
267
-        			'label_count'               => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing' )
267
+        			'label_count'               => _n_noop('Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing')
268 268
 				),
269 269
 
270 270
 				'wpi-onhold' => array(
271
-					'label'                     => _x( 'On Hold', 'Invoice status', 'invoicing' ),
271
+					'label'                     => _x('On Hold', 'Invoice status', 'invoicing'),
272 272
         			'public'                    => true,
273 273
         			'exclude_from_search'       => true,
274 274
         			'show_in_admin_all_list'    => true,
275 275
 					'show_in_admin_status_list' => true,
276 276
 					/* translators: %s: number of invoices */
277
-        			'label_count'               => _n_noop( 'On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing' )
277
+        			'label_count'               => _n_noop('On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing')
278 278
 				),
279 279
 
280 280
 				'wpi-cancelled' => array(
281
-					'label'                     => _x( 'Cancelled', 'Invoice status', 'invoicing' ),
281
+					'label'                     => _x('Cancelled', 'Invoice status', 'invoicing'),
282 282
         			'public'                    => true,
283 283
         			'exclude_from_search'       => true,
284 284
         			'show_in_admin_all_list'    => true,
285 285
 					'show_in_admin_status_list' => true,
286 286
 					/* translators: %s: number of invoices */
287
-        			'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing' )
287
+        			'label_count'               => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing')
288 288
 				),
289 289
 
290 290
 				'wpi-refunded' => array(
291
-					'label'                     => _x( 'Refunded', 'Invoice status', 'invoicing' ),
291
+					'label'                     => _x('Refunded', 'Invoice status', 'invoicing'),
292 292
         			'public'                    => true,
293 293
         			'exclude_from_search'       => true,
294 294
         			'show_in_admin_all_list'    => true,
295 295
 					'show_in_admin_status_list' => true,
296 296
 					/* translators: %s: number of invoices */
297
-        			'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing' )
297
+        			'label_count'               => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing')
298 298
 				),
299 299
 
300 300
 				'wpi-failed' => array(
301
-					'label'                     => _x( 'Failed', 'Invoice status', 'invoicing' ),
301
+					'label'                     => _x('Failed', 'Invoice status', 'invoicing'),
302 302
         			'public'                    => true,
303 303
         			'exclude_from_search'       => true,
304 304
         			'show_in_admin_all_list'    => true,
305 305
 					'show_in_admin_status_list' => true,
306 306
 					/* translators: %s: number of invoices */
307
-        			'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing' )
307
+        			'label_count'               => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing')
308 308
 				),
309 309
 
310 310
 				'wpi-renewal' => array(
311
-					'label'                     => _x( 'Renewal', 'Invoice status', 'invoicing' ),
311
+					'label'                     => _x('Renewal', 'Invoice status', 'invoicing'),
312 312
         			'public'                    => true,
313 313
         			'exclude_from_search'       => true,
314 314
         			'show_in_admin_all_list'    => true,
315 315
 					'show_in_admin_status_list' => true,
316 316
 					/* translators: %s: number of invoices */
317
-        			'label_count'               => _n_noop( 'Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing' )
317
+        			'label_count'               => _n_noop('Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing')
318 318
 				)
319 319
 			)
320 320
 		);
321 321
 
322
-		foreach ( $invoice_statuses as $invoice_statuse => $args ) {
323
-			register_post_status( $invoice_statuse, $args );
322
+		foreach ($invoice_statuses as $invoice_statuse => $args) {
323
+			register_post_status($invoice_statuse, $args);
324 324
 		}
325 325
 	}
326 326
 
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
 	 *
337 337
 	 */
338 338
 	public static function maybe_flush_rewrite_rules() {
339
-		if ( ! get_option( 'getpaid_flushed_rewrite_rules' ) ) {
340
-			update_option( 'getpaid_flushed_rewrite_rules', '1' );
339
+		if (!get_option('getpaid_flushed_rewrite_rules')) {
340
+			update_option('getpaid_flushed_rewrite_rules', '1');
341 341
 			self::flush_rewrite_rules();
342 342
 		}
343 343
 	}
Please login to merge, or discard this patch.
includes/payments/class-getpaid-payment-form.php 2 patches
Indentation   +536 added lines, -536 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined( 'ABSPATH' ) ) {
3
-	exit;
3
+    exit;
4 4
 }
5 5
 
6 6
 /**
@@ -10,55 +10,55 @@  discard block
 block discarded – undo
10 10
 class GetPaid_Payment_Form extends GetPaid_Data {
11 11
 
12 12
     /**
13
-	 * Which data store to load.
14
-	 *
15
-	 * @var string
16
-	 */
13
+     * Which data store to load.
14
+     *
15
+     * @var string
16
+     */
17 17
     protected $data_store_name = 'payment_form';
18 18
 
19 19
     /**
20
-	 * This is the name of this object type.
21
-	 *
22
-	 * @var string
23
-	 */
24
-	protected $object_type = 'payment_form';
20
+     * This is the name of this object type.
21
+     *
22
+     * @var string
23
+     */
24
+    protected $object_type = 'payment_form';
25 25
 
26 26
     /**
27
-	 * Form Data array. This is the core form data exposed in APIs.
28
-	 *
29
-	 * @since 1.0.19
30
-	 * @var array
31
-	 */
32
-	protected $data = array(
33
-		'status'               => 'draft',
34
-		'version'              => '',
35
-		'date_created'         => null,
27
+     * Form Data array. This is the core form data exposed in APIs.
28
+     *
29
+     * @since 1.0.19
30
+     * @var array
31
+     */
32
+    protected $data = array(
33
+        'status'               => 'draft',
34
+        'version'              => '',
35
+        'date_created'         => null,
36 36
         'date_modified'        => null,
37 37
         'name'                 => '',
38 38
         'author'               => 1,
39 39
         'elements'             => null,
40
-		'items'                => null,
41
-		'earned'               => 0,
42
-		'refunded'             => 0,
43
-		'cancelled'            => 0,
44
-		'failed'               => 0,
45
-	);
46
-
47
-    /**
48
-	 * Stores meta in cache for future reads.
49
-	 *
50
-	 * A group must be set to to enable caching.
51
-	 *
52
-	 * @var string
53
-	 */
54
-	protected $cache_group = 'getpaid_forms';
55
-
56
-	/**
57
-	 * Stores a reference to the invoice if the form is for an invoice..
58
-	 *
59
-	 * @var WPInv_Invoice
60
-	 */
61
-	public $invoice = 0;
40
+        'items'                => null,
41
+        'earned'               => 0,
42
+        'refunded'             => 0,
43
+        'cancelled'            => 0,
44
+        'failed'               => 0,
45
+    );
46
+
47
+    /**
48
+     * Stores meta in cache for future reads.
49
+     *
50
+     * A group must be set to to enable caching.
51
+     *
52
+     * @var string
53
+     */
54
+    protected $cache_group = 'getpaid_forms';
55
+
56
+    /**
57
+     * Stores a reference to the invoice if the form is for an invoice..
58
+     *
59
+     * @var WPInv_Invoice
60
+     */
61
+    public $invoice = 0;
62 62
 
63 63
     /**
64 64
      * Stores a reference to the original WP_Post object
@@ -68,35 +68,35 @@  discard block
 block discarded – undo
68 68
     protected $post = null;
69 69
 
70 70
     /**
71
-	 * Get the form if ID is passed, otherwise the form is new and empty.
72
-	 *
73
-	 * @param  int|object|GetPaid_Payment_Form|WP_Post $form Form to read.
74
-	 */
75
-	public function __construct( $form = 0 ) {
76
-		parent::__construct( $form );
71
+     * Get the form if ID is passed, otherwise the form is new and empty.
72
+     *
73
+     * @param  int|object|GetPaid_Payment_Form|WP_Post $form Form to read.
74
+     */
75
+    public function __construct( $form = 0 ) {
76
+        parent::__construct( $form );
77 77
 
78
-		if ( is_numeric( $form ) && $form > 0 ) {
79
-			$this->set_id( $form );
80
-		} elseif ( $form instanceof self ) {
78
+        if ( is_numeric( $form ) && $form > 0 ) {
79
+            $this->set_id( $form );
80
+        } elseif ( $form instanceof self ) {
81 81
 
82
-			$this->set_id( $form->get_id() );
83
-			$this->invoice = $form->invoice;
82
+            $this->set_id( $form->get_id() );
83
+            $this->invoice = $form->invoice;
84 84
 
85
-		} elseif ( ! empty( $form->ID ) ) {
86
-			$this->set_id( $form->ID );
87
-		} else {
88
-			$this->set_object_read( true );
89
-		}
85
+        } elseif ( ! empty( $form->ID ) ) {
86
+            $this->set_id( $form->ID );
87
+        } else {
88
+            $this->set_object_read( true );
89
+        }
90 90
 
91 91
         // Load the datastore.
92
-		$this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
92
+        $this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
93 93
 
94
-		if ( $this->get_id() > 0 ) {
94
+        if ( $this->get_id() > 0 ) {
95 95
             $this->post = get_post( $this->get_id() );
96
-			$this->data_store->read( $this );
96
+            $this->data_store->read( $this );
97 97
         }
98 98
 
99
-	}
99
+    }
100 100
 
101 101
     /*
102 102
 	|--------------------------------------------------------------------------
@@ -114,358 +114,358 @@  discard block
 block discarded – undo
114 114
     */
115 115
 
116 116
     /**
117
-	 * Get plugin version when the form was created.
118
-	 *
119
-	 * @since 1.0.19
120
-	 * @param  string $context View or edit context.
121
-	 * @return string
122
-	 */
123
-	public function get_version( $context = 'view' ) {
124
-		return $this->get_prop( 'version', $context );
117
+     * Get plugin version when the form was created.
118
+     *
119
+     * @since 1.0.19
120
+     * @param  string $context View or edit context.
121
+     * @return string
122
+     */
123
+    public function get_version( $context = 'view' ) {
124
+        return $this->get_prop( 'version', $context );
125 125
     }
126 126
 
127 127
     /**
128
-	 * Get date when the form was created.
129
-	 *
130
-	 * @since 1.0.19
131
-	 * @param  string $context View or edit context.
132
-	 * @return string
133
-	 */
134
-	public function get_date_created( $context = 'view' ) {
135
-		return $this->get_prop( 'date_created', $context );
128
+     * Get date when the form was created.
129
+     *
130
+     * @since 1.0.19
131
+     * @param  string $context View or edit context.
132
+     * @return string
133
+     */
134
+    public function get_date_created( $context = 'view' ) {
135
+        return $this->get_prop( 'date_created', $context );
136 136
     }
137 137
 
138 138
     /**
139
-	 * Get GMT date when the form was created.
140
-	 *
141
-	 * @since 1.0.19
142
-	 * @param  string $context View or edit context.
143
-	 * @return string
144
-	 */
145
-	public function get_date_created_gmt( $context = 'view' ) {
139
+     * Get GMT date when the form was created.
140
+     *
141
+     * @since 1.0.19
142
+     * @param  string $context View or edit context.
143
+     * @return string
144
+     */
145
+    public function get_date_created_gmt( $context = 'view' ) {
146 146
         $date = $this->get_date_created( $context );
147 147
 
148 148
         if ( $date ) {
149 149
             $date = get_gmt_from_date( $date );
150 150
         }
151
-		return $date;
151
+        return $date;
152 152
     }
153 153
 
154 154
     /**
155
-	 * Get date when the form was last modified.
156
-	 *
157
-	 * @since 1.0.19
158
-	 * @param  string $context View or edit context.
159
-	 * @return string
160
-	 */
161
-	public function get_date_modified( $context = 'view' ) {
162
-		return $this->get_prop( 'date_modified', $context );
155
+     * Get date when the form was last modified.
156
+     *
157
+     * @since 1.0.19
158
+     * @param  string $context View or edit context.
159
+     * @return string
160
+     */
161
+    public function get_date_modified( $context = 'view' ) {
162
+        return $this->get_prop( 'date_modified', $context );
163 163
     }
164 164
 
165 165
     /**
166
-	 * Get GMT date when the form was last modified.
167
-	 *
168
-	 * @since 1.0.19
169
-	 * @param  string $context View or edit context.
170
-	 * @return string
171
-	 */
172
-	public function get_date_modified_gmt( $context = 'view' ) {
166
+     * Get GMT date when the form was last modified.
167
+     *
168
+     * @since 1.0.19
169
+     * @param  string $context View or edit context.
170
+     * @return string
171
+     */
172
+    public function get_date_modified_gmt( $context = 'view' ) {
173 173
         $date = $this->get_date_modified( $context );
174 174
 
175 175
         if ( $date ) {
176 176
             $date = get_gmt_from_date( $date );
177 177
         }
178
-		return $date;
178
+        return $date;
179 179
     }
180 180
 
181 181
     /**
182
-	 * Get the form name.
183
-	 *
184
-	 * @since 1.0.19
185
-	 * @param  string $context View or edit context.
186
-	 * @return string
187
-	 */
188
-	public function get_name( $context = 'view' ) {
189
-		return $this->get_prop( 'name', $context );
182
+     * Get the form name.
183
+     *
184
+     * @since 1.0.19
185
+     * @param  string $context View or edit context.
186
+     * @return string
187
+     */
188
+    public function get_name( $context = 'view' ) {
189
+        return $this->get_prop( 'name', $context );
190 190
     }
191 191
 
192 192
     /**
193
-	 * Alias of self::get_name().
194
-	 *
195
-	 * @since 1.0.19
196
-	 * @param  string $context View or edit context.
197
-	 * @return string
198
-	 */
199
-	public function get_title( $context = 'view' ) {
200
-		return $this->get_name( $context );
201
-	}
193
+     * Alias of self::get_name().
194
+     *
195
+     * @since 1.0.19
196
+     * @param  string $context View or edit context.
197
+     * @return string
198
+     */
199
+    public function get_title( $context = 'view' ) {
200
+        return $this->get_name( $context );
201
+    }
202 202
 
203 203
     /**
204
-	 * Get the owner of the form.
205
-	 *
206
-	 * @since 1.0.19
207
-	 * @param  string $context View or edit context.
208
-	 * @return int
209
-	 */
210
-	public function get_author( $context = 'view' ) {
211
-		return (int) $this->get_prop( 'author', $context );
204
+     * Get the owner of the form.
205
+     *
206
+     * @since 1.0.19
207
+     * @param  string $context View or edit context.
208
+     * @return int
209
+     */
210
+    public function get_author( $context = 'view' ) {
211
+        return (int) $this->get_prop( 'author', $context );
212 212
     }
213 213
 
214 214
     /**
215
-	 * Get the elements that make up the form.
216
-	 *
217
-	 * @since 1.0.19
218
-	 * @param  string $context View or edit context.
219
-	 * @return array
220
-	 */
221
-	public function get_elements( $context = 'view' ) {
222
-		$elements = $this->get_prop( 'elements', $context );
215
+     * Get the elements that make up the form.
216
+     *
217
+     * @since 1.0.19
218
+     * @param  string $context View or edit context.
219
+     * @return array
220
+     */
221
+    public function get_elements( $context = 'view' ) {
222
+        $elements = $this->get_prop( 'elements', $context );
223 223
 
224
-		if ( empty( $elements ) || ! is_array( $elements ) ) {
224
+        if ( empty( $elements ) || ! is_array( $elements ) ) {
225 225
             return wpinv_get_data( 'sample-payment-form' );
226
-		}
226
+        }
227 227
 
228
-		// Ensure that all required elements exist.
229
-		$_elements = array();
230
-		foreach ( $elements as $element ) {
228
+        // Ensure that all required elements exist.
229
+        $_elements = array();
230
+        foreach ( $elements as $element ) {
231 231
 
232
-			if ( $element['type'] == 'pay_button' && ! $this->has_element_type( 'gateway_select' ) ) {
232
+            if ( $element['type'] == 'pay_button' && ! $this->has_element_type( 'gateway_select' ) ) {
233 233
 
234
-				$_elements[] = array(
235
-					'text'        => __( 'Select Payment Method', 'invoicing' ),
236
-					'id'          => 'gtscicd',
237
-					'name'        => 'gtscicd',
238
-					'type'        => 'gateway_select',
239
-					'premade'     => true
234
+                $_elements[] = array(
235
+                    'text'        => __( 'Select Payment Method', 'invoicing' ),
236
+                    'id'          => 'gtscicd',
237
+                    'name'        => 'gtscicd',
238
+                    'type'        => 'gateway_select',
239
+                    'premade'     => true
240 240
 			
241
-				);
241
+                );
242 242
 
243
-			}
243
+            }
244 244
 
245
-			$_elements[] = $element;
245
+            $_elements[] = $element;
246 246
 
247
-		}
247
+        }
248 248
 
249 249
         return $_elements;
250
-	}
251
-
252
-	/**
253
-	 * Get the items sold via the form.
254
-	 *
255
-	 * @since 1.0.19
256
-	 * @param  string $context View or edit context.
257
-	 * @param  string $return objects or arrays.
258
-	 * @return GetPaid_Form_Item[]
259
-	 */
260
-	public function get_items( $context = 'view', $return = 'objects' ) {
261
-		$items = $this->get_prop( 'items', $context );
262
-
263
-		if ( empty( $items ) || ! is_array( $items ) ) {
250
+    }
251
+
252
+    /**
253
+     * Get the items sold via the form.
254
+     *
255
+     * @since 1.0.19
256
+     * @param  string $context View or edit context.
257
+     * @param  string $return objects or arrays.
258
+     * @return GetPaid_Form_Item[]
259
+     */
260
+    public function get_items( $context = 'view', $return = 'objects' ) {
261
+        $items = $this->get_prop( 'items', $context );
262
+
263
+        if ( empty( $items ) || ! is_array( $items ) ) {
264 264
             $items = wpinv_get_data( 'sample-payment-form-items' );
265
-		}
265
+        }
266 266
 
267
-		// Convert the items.
268
-		$prepared = array();
267
+        // Convert the items.
268
+        $prepared = array();
269 269
 
270
-		foreach ( $items as $key => $value ) {
270
+        foreach ( $items as $key => $value ) {
271 271
 
272
-			// Form items.
273
-			if ( $value instanceof GetPaid_Form_Item ) {
272
+            // Form items.
273
+            if ( $value instanceof GetPaid_Form_Item ) {
274 274
 
275
-				if ( $value->can_purchase() ) {
276
-					$prepared[] = $value;
277
-				}
275
+                if ( $value->can_purchase() ) {
276
+                    $prepared[] = $value;
277
+                }
278 278
 
279
-				continue;
279
+                continue;
280 280
 
281
-			}
281
+            }
282 282
 
283
-			// $item_id => $quantity (buy buttons)
284
-			if ( is_numeric( $key ) && is_numeric( $value ) ) {
285
-				$item = new GetPaid_Form_Item( $key );
283
+            // $item_id => $quantity (buy buttons)
284
+            if ( is_numeric( $key ) && is_numeric( $value ) ) {
285
+                $item = new GetPaid_Form_Item( $key );
286 286
 
287
-				if ( $item->can_purchase() ) {
287
+                if ( $item->can_purchase() ) {
288 288
 
289
-					$value = (float) $value;
290
-					$item->set_quantity( $value );
291
-					if ( 0 == $value ) {
292
-						$item->set_quantity( 1 );
293
-						$item->set_allow_quantities( true );
294
-					}
289
+                    $value = (float) $value;
290
+                    $item->set_quantity( $value );
291
+                    if ( 0 == $value ) {
292
+                        $item->set_quantity( 1 );
293
+                        $item->set_allow_quantities( true );
294
+                    }
295 295
 
296
-					$prepared[] = $item;
297
-				}
296
+                    $prepared[] = $item;
297
+                }
298 298
 
299
-				continue;
300
-			}
299
+                continue;
300
+            }
301 301
 
302
-			// Items saved via payment forms editor.
303
-			if ( is_array( $value ) && isset( $value['id'] ) ) {
302
+            // Items saved via payment forms editor.
303
+            if ( is_array( $value ) && isset( $value['id'] ) ) {
304 304
 
305
-				$item = new GetPaid_Form_Item( $value['id'] );
305
+                $item = new GetPaid_Form_Item( $value['id'] );
306 306
 
307
-				if ( ! $item->can_purchase() ) {
308
-					continue;
309
-				}
307
+                if ( ! $item->can_purchase() ) {
308
+                    continue;
309
+                }
310 310
 
311
-				// Sub-total (Cart items).
312
-				if ( isset( $value['subtotal'] ) ) {
313
-					$item->set_price( $value['subtotal'] );
314
-				}
311
+                // Sub-total (Cart items).
312
+                if ( isset( $value['subtotal'] ) ) {
313
+                    $item->set_price( $value['subtotal'] );
314
+                }
315 315
 
316
-				if ( isset( $value['quantity'] ) ) {
317
-					$item->set_quantity( $value['quantity'] );
318
-				}
316
+                if ( isset( $value['quantity'] ) ) {
317
+                    $item->set_quantity( $value['quantity'] );
318
+                }
319 319
 
320
-				if ( isset( $value['allow_quantities'] ) ) {
321
-					$item->set_allow_quantities( $value['allow_quantities'] );
322
-				}
320
+                if ( isset( $value['allow_quantities'] ) ) {
321
+                    $item->set_allow_quantities( $value['allow_quantities'] );
322
+                }
323 323
 
324
-				if ( isset( $value['required'] ) ) {
325
-					$item->set_is_required( $value['required'] );
326
-				}
324
+                if ( isset( $value['required'] ) ) {
325
+                    $item->set_is_required( $value['required'] );
326
+                }
327 327
 
328
-				if ( isset( $value['description'] ) ) {
329
-					$item->set_custom_description( $value['description'] );
330
-				}
328
+                if ( isset( $value['description'] ) ) {
329
+                    $item->set_custom_description( $value['description'] );
330
+                }
331 331
 
332
-				$prepared[] = $item;
333
-				continue;
332
+                $prepared[] = $item;
333
+                continue;
334
+
335
+            }
336
+
337
+            // $item_id => array( 'price' => 10 ) (item variations)
338
+            if ( is_numeric( $key ) && is_array( $value ) ) {
339
+                $item = new GetPaid_Form_Item( $key );
340
+
341
+                if ( isset( $value['price'] ) && $item->user_can_set_their_price() ) {
342
+                    $item->set_price( $value['price'] );
343
+                }
344
+
345
+                if ( $item->can_purchase() ) {
346
+                    $prepared[] = $item;
347
+                }
348
+
349
+                continue;
350
+            }
351
+
352
+        }
353
+
354
+        if ( 'objects' == $return && 'view' == $context ) {
355
+            return $prepared;
356
+        }
357
+
358
+        $items = array();
359
+        foreach ( $prepared as $item ) {
360
+            $items[] = $item->prepare_data_for_use();
361
+        }
362
+
363
+        return $items;
364
+    }
365
+
366
+    /**
367
+     * Get a single item belonging to the form.
368
+     *
369
+     * @since 1.0.19
370
+     * @param  int $item_id The item id to return.
371
+     * @return GetPaid_Form_Item|bool
372
+     */
373
+    public function get_item( $item_id ) {
374
+
375
+        if ( empty( $item_id ) || ! is_numeric( $item_id ) ) {
376
+            return false;
377
+        }
378
+
379
+        foreach( $this->get_items() as $item ) {
380
+            if ( $item->get_id() == (int) $item_id ) {
381
+                return $item;
382
+            }
383
+        }
384
+
385
+        return false;
386
+
387
+    }
388
+
389
+    /**
390
+     * Gets a single element.
391
+     *
392
+     * @since 1.0.19
393
+     * @param  string $element_type The element type to return.
394
+     * @return array|bool
395
+     */
396
+    public function get_element_type( $element_type ) {
397
+
398
+        if ( empty( $element_type ) || ! is_scalar( $element_type ) ) {
399
+            return false;
400
+        }
401
+
402
+        foreach ( $this->get_prop( 'elements' ) as $element ) {
403
+
404
+            if ( $element['type'] == $element_type ) {
405
+                return $element;
406
+            }
407
+
408
+        }
409
+
410
+        return false;
411
+
412
+    }
413
+
414
+    /**
415
+     * Get the total amount earned via this form.
416
+     *
417
+     * @since 1.0.19
418
+     * @param  string $context View or edit context.
419
+     * @return float
420
+     */
421
+    public function get_earned( $context = 'view' ) {
422
+        return $this->get_prop( 'earned', $context );
423
+    }
424
+
425
+    /**
426
+     * Get the total amount refunded via this form.
427
+     *
428
+     * @since 1.0.19
429
+     * @param  string $context View or edit context.
430
+     * @return float
431
+     */
432
+    public function get_refunded( $context = 'view' ) {
433
+        return $this->get_prop( 'refunded', $context );
434
+    }
334 435
 
335
-			}
436
+    /**
437
+     * Get the total amount cancelled via this form.
438
+     *
439
+     * @since 1.0.19
440
+     * @param  string $context View or edit context.
441
+     * @return float
442
+     */
443
+    public function get_cancelled( $context = 'view' ) {
444
+        return $this->get_prop( 'cancelled', $context );
445
+    }
336 446
 
337
-			// $item_id => array( 'price' => 10 ) (item variations)
338
-			if ( is_numeric( $key ) && is_array( $value ) ) {
339
-				$item = new GetPaid_Form_Item( $key );
447
+    /**
448
+     * Get the total amount failed via this form.
449
+     *
450
+     * @since 1.0.19
451
+     * @param  string $context View or edit context.
452
+     * @return float
453
+     */
454
+    public function get_failed( $context = 'view' ) {
455
+        return $this->get_prop( 'failed', $context );
456
+    }
340 457
 
341
-				if ( isset( $value['price'] ) && $item->user_can_set_their_price() ) {
342
-					$item->set_price( $value['price'] );
343
-				}
344
-
345
-				if ( $item->can_purchase() ) {
346
-					$prepared[] = $item;
347
-				}
348
-
349
-				continue;
350
-			}
351
-
352
-		}
353
-
354
-		if ( 'objects' == $return && 'view' == $context ) {
355
-			return $prepared;
356
-		}
357
-
358
-		$items = array();
359
-		foreach ( $prepared as $item ) {
360
-			$items[] = $item->prepare_data_for_use();
361
-		}
362
-
363
-		return $items;
364
-	}
365
-
366
-	/**
367
-	 * Get a single item belonging to the form.
368
-	 *
369
-	 * @since 1.0.19
370
-	 * @param  int $item_id The item id to return.
371
-	 * @return GetPaid_Form_Item|bool
372
-	 */
373
-	public function get_item( $item_id ) {
374
-
375
-		if ( empty( $item_id ) || ! is_numeric( $item_id ) ) {
376
-			return false;
377
-		}
378
-
379
-		foreach( $this->get_items() as $item ) {
380
-			if ( $item->get_id() == (int) $item_id ) {
381
-				return $item;
382
-			}
383
-		}
384
-
385
-		return false;
386
-
387
-	}
388
-
389
-	/**
390
-	 * Gets a single element.
391
-	 *
392
-	 * @since 1.0.19
393
-	 * @param  string $element_type The element type to return.
394
-	 * @return array|bool
395
-	 */
396
-	public function get_element_type( $element_type ) {
397
-
398
-		if ( empty( $element_type ) || ! is_scalar( $element_type ) ) {
399
-			return false;
400
-		}
401
-
402
-		foreach ( $this->get_prop( 'elements' ) as $element ) {
403
-
404
-			if ( $element['type'] == $element_type ) {
405
-				return $element;
406
-			}
407
-
408
-		}
409
-
410
-		return false;
411
-
412
-	}
413
-
414
-	/**
415
-	 * Get the total amount earned via this form.
416
-	 *
417
-	 * @since 1.0.19
418
-	 * @param  string $context View or edit context.
419
-	 * @return float
420
-	 */
421
-	public function get_earned( $context = 'view' ) {
422
-		return $this->get_prop( 'earned', $context );
423
-	}
424
-
425
-	/**
426
-	 * Get the total amount refunded via this form.
427
-	 *
428
-	 * @since 1.0.19
429
-	 * @param  string $context View or edit context.
430
-	 * @return float
431
-	 */
432
-	public function get_refunded( $context = 'view' ) {
433
-		return $this->get_prop( 'refunded', $context );
434
-	}
435
-
436
-	/**
437
-	 * Get the total amount cancelled via this form.
438
-	 *
439
-	 * @since 1.0.19
440
-	 * @param  string $context View or edit context.
441
-	 * @return float
442
-	 */
443
-	public function get_cancelled( $context = 'view' ) {
444
-		return $this->get_prop( 'cancelled', $context );
445
-	}
446
-
447
-	/**
448
-	 * Get the total amount failed via this form.
449
-	 *
450
-	 * @since 1.0.19
451
-	 * @param  string $context View or edit context.
452
-	 * @return float
453
-	 */
454
-	public function get_failed( $context = 'view' ) {
455
-		return $this->get_prop( 'failed', $context );
456
-	}
457
-
458
-	/**
459
-	 * Get the currency.
460
-	 *
461
-	 * @since 1.0.19
462
-	 * @param  string $context View or edit context.
463
-	 * @return string
464
-	 */
465
-	public function get_currency() {
466
-		$currency = empty( $this->invoice ) ? wpinv_get_currency() : $this->invoice->get_currency();
467
-		return apply_filters( 'getpaid-payment-form-currency', $currency, $this );
468
-	}
458
+    /**
459
+     * Get the currency.
460
+     *
461
+     * @since 1.0.19
462
+     * @param  string $context View or edit context.
463
+     * @return string
464
+     */
465
+    public function get_currency() {
466
+        $currency = empty( $this->invoice ) ? wpinv_get_currency() : $this->invoice->get_currency();
467
+        return apply_filters( 'getpaid-payment-form-currency', $currency, $this );
468
+    }
469 469
 
470 470
     /*
471 471
 	|--------------------------------------------------------------------------
@@ -478,22 +478,22 @@  discard block
 block discarded – undo
478 478
     */
479 479
 
480 480
     /**
481
-	 * Set plugin version when the item was created.
482
-	 *
483
-	 * @since 1.0.19
484
-	 */
485
-	public function set_version( $value ) {
486
-		$this->set_prop( 'version', $value );
481
+     * Set plugin version when the item was created.
482
+     *
483
+     * @since 1.0.19
484
+     */
485
+    public function set_version( $value ) {
486
+        $this->set_prop( 'version', $value );
487 487
     }
488 488
 
489 489
     /**
490
-	 * Set date when the item was created.
491
-	 *
492
-	 * @since 1.0.19
493
-	 * @param string $value Value to set.
490
+     * Set date when the item was created.
491
+     *
492
+     * @since 1.0.19
493
+     * @param string $value Value to set.
494 494
      * @return bool Whether or not the date was set.
495
-	 */
496
-	public function set_date_created( $value ) {
495
+     */
496
+    public function set_date_created( $value ) {
497 497
         $date = strtotime( $value );
498 498
 
499 499
         if ( $date ) {
@@ -506,13 +506,13 @@  discard block
 block discarded – undo
506 506
     }
507 507
 
508 508
     /**
509
-	 * Set date when the item was last modified.
510
-	 *
511
-	 * @since 1.0.19
512
-	 * @param string $value Value to set.
509
+     * Set date when the item was last modified.
510
+     *
511
+     * @since 1.0.19
512
+     * @param string $value Value to set.
513 513
      * @return bool Whether or not the date was set.
514
-	 */
515
-	public function set_date_modified( $value ) {
514
+     */
515
+    public function set_date_modified( $value ) {
516 516
         $date = strtotime( $value );
517 517
 
518 518
         if ( $date ) {
@@ -525,131 +525,131 @@  discard block
 block discarded – undo
525 525
     }
526 526
 
527 527
     /**
528
-	 * Set the item name.
529
-	 *
530
-	 * @since 1.0.19
531
-	 * @param  string $value New name.
532
-	 */
533
-	public function set_name( $value ) {
534
-		$this->set_prop( 'name', sanitize_text_field( $value ) );
528
+     * Set the item name.
529
+     *
530
+     * @since 1.0.19
531
+     * @param  string $value New name.
532
+     */
533
+    public function set_name( $value ) {
534
+        $this->set_prop( 'name', sanitize_text_field( $value ) );
535 535
     }
536 536
 
537 537
     /**
538
-	 * Alias of self::set_name().
539
-	 *
540
-	 * @since 1.0.19
541
-	 * @param  string $value New name.
542
-	 */
543
-	public function set_title( $value ) {
544
-		$this->set_name( $value );
538
+     * Alias of self::set_name().
539
+     *
540
+     * @since 1.0.19
541
+     * @param  string $value New name.
542
+     */
543
+    public function set_title( $value ) {
544
+        $this->set_name( $value );
545 545
     }
546 546
 
547 547
     /**
548
-	 * Set the owner of the item.
549
-	 *
550
-	 * @since 1.0.19
551
-	 * @param  int $value New author.
552
-	 */
553
-	public function set_author( $value ) {
554
-		$this->set_prop( 'author', (int) $value );
555
-	}
548
+     * Set the owner of the item.
549
+     *
550
+     * @since 1.0.19
551
+     * @param  int $value New author.
552
+     */
553
+    public function set_author( $value ) {
554
+        $this->set_prop( 'author', (int) $value );
555
+    }
556 556
 
557
-	/**
558
-	 * Set the form elements.
559
-	 *
560
-	 * @since 1.0.19
561
-	 * @sinve 2.3.4 Array values sanitized.
562
-	 * @param  array $value Form elements.
563
-	 */
564
-	public function set_elements( $value ) {
565
-		if ( is_array( $value ) ) {
557
+    /**
558
+     * Set the form elements.
559
+     *
560
+     * @since 1.0.19
561
+     * @sinve 2.3.4 Array values sanitized.
562
+     * @param  array $value Form elements.
563
+     */
564
+    public function set_elements( $value ) {
565
+        if ( is_array( $value ) ) {
566 566
 
567
-			// sanitize
568
-			if(!empty($value )){
567
+            // sanitize
568
+            if(!empty($value )){
569 569
 
570
-				foreach($value as $key => $val_arr){
571
-					$help_text = !empty($val_arr['description']) ? wp_kses_post($val_arr['description']) : '';
572
-					$value[$key] = array_map( 'sanitize_text_field', $val_arr );
573
-					$value[$key]['description'] = $help_text;
574
-				}
570
+                foreach($value as $key => $val_arr){
571
+                    $help_text = !empty($val_arr['description']) ? wp_kses_post($val_arr['description']) : '';
572
+                    $value[$key] = array_map( 'sanitize_text_field', $val_arr );
573
+                    $value[$key]['description'] = $help_text;
574
+                }
575 575
 				
576
-			}
577
-
578
-			$this->set_prop( 'elements', $value );
579
-		}
580
-	}
581
-
582
-	/**
583
-	 * Set the form items.
584
-	 *
585
-	 * @since 1.0.19
586
-	 * @param  array $value Form elements.
587
-	 */
588
-	public function set_items( $value ) {
589
-		if ( is_array( $value ) ) {
590
-			$this->set_prop( 'items', $value );
591
-		}
592
-	}
593
-
594
-	/**
595
-	 * Set the total amount earned via this form.
596
-	 *
597
-	 * @since 1.0.19
598
-	 * @param  float $value Amount earned.
599
-	 */
600
-	public function set_earned( $value ) {
601
-		$value = max( (float) $value, 0 );
602
-		$this->set_prop( 'earned', $value );
603
-	}
604
-
605
-	/**
606
-	 * Set the total amount refunded via this form.
607
-	 *
608
-	 * @since 1.0.19
609
-	 * @param  float $value Amount refunded.
610
-	 */
611
-	public function set_refunded( $value ) {
612
-		$value = max( (float) $value, 0 );
613
-		$this->set_prop( 'refunded', $value );
614
-	}
615
-
616
-	/**
617
-	 * Set the total amount cancelled via this form.
618
-	 *
619
-	 * @since 1.0.19
620
-	 * @param  float $value Amount cancelled.
621
-	 */
622
-	public function set_cancelled( $value ) {
623
-		$value = max( (float) $value, 0 );
624
-		$this->set_prop( 'cancelled', $value );
625
-	}
626
-
627
-	/**
628
-	 * Set the total amount failed via this form.
629
-	 *
630
-	 * @since 1.0.19
631
-	 * @param  float $value Amount cancelled.
632
-	 */
633
-	public function set_failed( $value ) {
634
-		$value = max( (float) $value, 0 );
635
-		$this->set_prop( 'failed', $value );
636
-	}
576
+            }
577
+
578
+            $this->set_prop( 'elements', $value );
579
+        }
580
+    }
581
+
582
+    /**
583
+     * Set the form items.
584
+     *
585
+     * @since 1.0.19
586
+     * @param  array $value Form elements.
587
+     */
588
+    public function set_items( $value ) {
589
+        if ( is_array( $value ) ) {
590
+            $this->set_prop( 'items', $value );
591
+        }
592
+    }
593
+
594
+    /**
595
+     * Set the total amount earned via this form.
596
+     *
597
+     * @since 1.0.19
598
+     * @param  float $value Amount earned.
599
+     */
600
+    public function set_earned( $value ) {
601
+        $value = max( (float) $value, 0 );
602
+        $this->set_prop( 'earned', $value );
603
+    }
604
+
605
+    /**
606
+     * Set the total amount refunded via this form.
607
+     *
608
+     * @since 1.0.19
609
+     * @param  float $value Amount refunded.
610
+     */
611
+    public function set_refunded( $value ) {
612
+        $value = max( (float) $value, 0 );
613
+        $this->set_prop( 'refunded', $value );
614
+    }
615
+
616
+    /**
617
+     * Set the total amount cancelled via this form.
618
+     *
619
+     * @since 1.0.19
620
+     * @param  float $value Amount cancelled.
621
+     */
622
+    public function set_cancelled( $value ) {
623
+        $value = max( (float) $value, 0 );
624
+        $this->set_prop( 'cancelled', $value );
625
+    }
626
+
627
+    /**
628
+     * Set the total amount failed via this form.
629
+     *
630
+     * @since 1.0.19
631
+     * @param  float $value Amount cancelled.
632
+     */
633
+    public function set_failed( $value ) {
634
+        $value = max( (float) $value, 0 );
635
+        $this->set_prop( 'failed', $value );
636
+    }
637 637
 
638 638
     /**
639 639
      * Create an item. For backwards compatibilty.
640 640
      *
641 641
      * @deprecated
642
-	 * @return int item id
642
+     * @return int item id
643 643
      */
644 644
     public function create( $data = array() ) {
645 645
 
646
-		// Set the properties.
647
-		if ( is_array( $data ) ) {
648
-			$this->set_props( $data );
649
-		}
646
+        // Set the properties.
647
+        if ( is_array( $data ) ) {
648
+            $this->set_props( $data );
649
+        }
650 650
 
651
-		// Save the item.
652
-		return $this->save();
651
+        // Save the item.
652
+        return $this->save();
653 653
 
654 654
     }
655 655
 
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
      * Updates an item. For backwards compatibilty.
658 658
      *
659 659
      * @deprecated
660
-	 * @return int item id
660
+     * @return int item id
661 661
      */
662 662
     public function update( $data = array() ) {
663 663
         return $this->create( $data );
@@ -673,22 +673,22 @@  discard block
 block discarded – undo
673 673
 	*/
674 674
 
675 675
     /**
676
-	 * Checks whether this is the default payment form.
677
-	 *
678
-	 * @since 1.0.19
679
-	 * @return bool
680
-	 */
676
+     * Checks whether this is the default payment form.
677
+     *
678
+     * @since 1.0.19
679
+     * @return bool
680
+     */
681 681
     public function is_default() {
682 682
         $is_default = $this->get_id() == wpinv_get_default_payment_form();
683 683
         return (bool) apply_filters( 'wpinv_is_default_payment_form', $is_default, $this->get_id(), $this );
684
-	}
684
+    }
685 685
 
686 686
     /**
687
-	 * Checks whether the form is active.
688
-	 *
689
-	 * @since 1.0.19
690
-	 * @return bool
691
-	 */
687
+     * Checks whether the form is active.
688
+     *
689
+     * @since 1.0.19
690
+     * @return bool
691
+     */
692 692
     public function is_active() {
693 693
         $is_active = 0 !== (int) $this->get_id();
694 694
 
@@ -697,76 +697,76 @@  discard block
 block discarded – undo
697 697
         }
698 698
 
699 699
         return (bool) apply_filters( 'wpinv_is_payment_form_active', $is_active, $this );
700
-	}
701
-
702
-	/**
703
-	 * Checks whether the form has a given item.
704
-	 *
705
-	 * @since 1.0.19
706
-	 * @return bool
707
-	 */
700
+    }
701
+
702
+    /**
703
+     * Checks whether the form has a given item.
704
+     *
705
+     * @since 1.0.19
706
+     * @return bool
707
+     */
708 708
     public function has_item( $item_id ) {
709 709
         return false !== $this->get_item( $item_id );
710
-	}
711
-
712
-	/**
713
-	 * Checks whether the form has a given element.
714
-	 *
715
-	 * @since 1.0.19
716
-	 * @return bool
717
-	 */
710
+    }
711
+
712
+    /**
713
+     * Checks whether the form has a given element.
714
+     *
715
+     * @since 1.0.19
716
+     * @return bool
717
+     */
718 718
     public function has_element_type( $element_type ) {
719 719
         return false !== $this->get_element_type( $element_type );
720
-	}
721
-
722
-	/**
723
-	 * Checks whether this form is recurring or not.
724
-	 *
725
-	 * @since 1.0.19
726
-	 * @return bool
727
-	 */
720
+    }
721
+
722
+    /**
723
+     * Checks whether this form is recurring or not.
724
+     *
725
+     * @since 1.0.19
726
+     * @return bool
727
+     */
728 728
     public function is_recurring() {
729 729
 
730
-		if ( ! empty( $this->invoice ) ) {
731
-			return $this->invoice->is_recurring();
732
-		}
730
+        if ( ! empty( $this->invoice ) ) {
731
+            return $this->invoice->is_recurring();
732
+        }
733 733
 
734
-		foreach ( $this->get_items() as $item ) {
734
+        foreach ( $this->get_items() as $item ) {
735 735
 
736
-			if ( $item->is_recurring() ) {
737
-				return true;
738
-			}
736
+            if ( $item->is_recurring() ) {
737
+                return true;
738
+            }
739 739
 
740
-		}
740
+        }
741 741
 
742 742
         return false;
743
-	}
743
+    }
744 744
 
745
-	/**
746
-	 * Retrieves the form's html.
747
-	 *
748
-	 * @since 1.0.19
749
-	 */
745
+    /**
746
+     * Retrieves the form's html.
747
+     *
748
+     * @since 1.0.19
749
+     */
750 750
     public function get_html( $extra_markup = '' ) {
751 751
 
752
-		// Return the HTML.
753
-		return wpinv_get_template_html(
754
-			'payment-forms/form.php',
755
-			array(
756
-				'form'         => $this,
757
-				'extra_markup' => $extra_markup,
758
-			)
759
-		);
760
-
761
-	}
762
-
763
-	/**
764
-	 * Displays the payment form.
765
-	 *
766
-	 * @since 1.0.19
767
-	 */
752
+        // Return the HTML.
753
+        return wpinv_get_template_html(
754
+            'payment-forms/form.php',
755
+            array(
756
+                'form'         => $this,
757
+                'extra_markup' => $extra_markup,
758
+            )
759
+        );
760
+
761
+    }
762
+
763
+    /**
764
+     * Displays the payment form.
765
+     *
766
+     * @since 1.0.19
767
+     */
768 768
     public function display( $extra_markup = '' ) {
769
-		echo $this->get_html( $extra_markup );
769
+        echo $this->get_html( $extra_markup );
770 770
     }
771 771
 
772 772
 }
Please login to merge, or discard this patch.
Spacing   +148 added lines, -148 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
 
@@ -72,28 +72,28 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @param  int|object|GetPaid_Payment_Form|WP_Post $form Form to read.
74 74
 	 */
75
-	public function __construct( $form = 0 ) {
76
-		parent::__construct( $form );
75
+	public function __construct($form = 0) {
76
+		parent::__construct($form);
77 77
 
78
-		if ( is_numeric( $form ) && $form > 0 ) {
79
-			$this->set_id( $form );
80
-		} elseif ( $form instanceof self ) {
78
+		if (is_numeric($form) && $form > 0) {
79
+			$this->set_id($form);
80
+		} elseif ($form instanceof self) {
81 81
 
82
-			$this->set_id( $form->get_id() );
82
+			$this->set_id($form->get_id());
83 83
 			$this->invoice = $form->invoice;
84 84
 
85
-		} elseif ( ! empty( $form->ID ) ) {
86
-			$this->set_id( $form->ID );
85
+		} elseif (!empty($form->ID)) {
86
+			$this->set_id($form->ID);
87 87
 		} else {
88
-			$this->set_object_read( true );
88
+			$this->set_object_read(true);
89 89
 		}
90 90
 
91 91
         // Load the datastore.
92
-		$this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
92
+		$this->data_store = GetPaid_Data_Store::load($this->data_store_name);
93 93
 
94
-		if ( $this->get_id() > 0 ) {
95
-            $this->post = get_post( $this->get_id() );
96
-			$this->data_store->read( $this );
94
+		if ($this->get_id() > 0) {
95
+            $this->post = get_post($this->get_id());
96
+			$this->data_store->read($this);
97 97
         }
98 98
 
99 99
 	}
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
 	 * @param  string $context View or edit context.
121 121
 	 * @return string
122 122
 	 */
123
-	public function get_version( $context = 'view' ) {
124
-		return $this->get_prop( 'version', $context );
123
+	public function get_version($context = 'view') {
124
+		return $this->get_prop('version', $context);
125 125
     }
126 126
 
127 127
     /**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 	 * @param  string $context View or edit context.
132 132
 	 * @return string
133 133
 	 */
134
-	public function get_date_created( $context = 'view' ) {
135
-		return $this->get_prop( 'date_created', $context );
134
+	public function get_date_created($context = 'view') {
135
+		return $this->get_prop('date_created', $context);
136 136
     }
137 137
 
138 138
     /**
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 	 * @param  string $context View or edit context.
143 143
 	 * @return string
144 144
 	 */
145
-	public function get_date_created_gmt( $context = 'view' ) {
146
-        $date = $this->get_date_created( $context );
145
+	public function get_date_created_gmt($context = 'view') {
146
+        $date = $this->get_date_created($context);
147 147
 
148
-        if ( $date ) {
149
-            $date = get_gmt_from_date( $date );
148
+        if ($date) {
149
+            $date = get_gmt_from_date($date);
150 150
         }
151 151
 		return $date;
152 152
     }
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 	 * @param  string $context View or edit context.
159 159
 	 * @return string
160 160
 	 */
161
-	public function get_date_modified( $context = 'view' ) {
162
-		return $this->get_prop( 'date_modified', $context );
161
+	public function get_date_modified($context = 'view') {
162
+		return $this->get_prop('date_modified', $context);
163 163
     }
164 164
 
165 165
     /**
@@ -169,11 +169,11 @@  discard block
 block discarded – undo
169 169
 	 * @param  string $context View or edit context.
170 170
 	 * @return string
171 171
 	 */
172
-	public function get_date_modified_gmt( $context = 'view' ) {
173
-        $date = $this->get_date_modified( $context );
172
+	public function get_date_modified_gmt($context = 'view') {
173
+        $date = $this->get_date_modified($context);
174 174
 
175
-        if ( $date ) {
176
-            $date = get_gmt_from_date( $date );
175
+        if ($date) {
176
+            $date = get_gmt_from_date($date);
177 177
         }
178 178
 		return $date;
179 179
     }
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
 	 * @param  string $context View or edit context.
186 186
 	 * @return string
187 187
 	 */
188
-	public function get_name( $context = 'view' ) {
189
-		return $this->get_prop( 'name', $context );
188
+	public function get_name($context = 'view') {
189
+		return $this->get_prop('name', $context);
190 190
     }
191 191
 
192 192
     /**
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
 	 * @param  string $context View or edit context.
197 197
 	 * @return string
198 198
 	 */
199
-	public function get_title( $context = 'view' ) {
200
-		return $this->get_name( $context );
199
+	public function get_title($context = 'view') {
200
+		return $this->get_name($context);
201 201
 	}
202 202
 
203 203
     /**
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 	 * @param  string $context View or edit context.
208 208
 	 * @return int
209 209
 	 */
210
-	public function get_author( $context = 'view' ) {
211
-		return (int) $this->get_prop( 'author', $context );
210
+	public function get_author($context = 'view') {
211
+		return (int) $this->get_prop('author', $context);
212 212
     }
213 213
 
214 214
     /**
@@ -218,21 +218,21 @@  discard block
 block discarded – undo
218 218
 	 * @param  string $context View or edit context.
219 219
 	 * @return array
220 220
 	 */
221
-	public function get_elements( $context = 'view' ) {
222
-		$elements = $this->get_prop( 'elements', $context );
221
+	public function get_elements($context = 'view') {
222
+		$elements = $this->get_prop('elements', $context);
223 223
 
224
-		if ( empty( $elements ) || ! is_array( $elements ) ) {
225
-            return wpinv_get_data( 'sample-payment-form' );
224
+		if (empty($elements) || !is_array($elements)) {
225
+            return wpinv_get_data('sample-payment-form');
226 226
 		}
227 227
 
228 228
 		// Ensure that all required elements exist.
229 229
 		$_elements = array();
230
-		foreach ( $elements as $element ) {
230
+		foreach ($elements as $element) {
231 231
 
232
-			if ( $element['type'] == 'pay_button' && ! $this->has_element_type( 'gateway_select' ) ) {
232
+			if ($element['type'] == 'pay_button' && !$this->has_element_type('gateway_select')) {
233 233
 
234 234
 				$_elements[] = array(
235
-					'text'        => __( 'Select Payment Method', 'invoicing' ),
235
+					'text'        => __('Select Payment Method', 'invoicing'),
236 236
 					'id'          => 'gtscicd',
237 237
 					'name'        => 'gtscicd',
238 238
 					'type'        => 'gateway_select',
@@ -257,22 +257,22 @@  discard block
 block discarded – undo
257 257
 	 * @param  string $return objects or arrays.
258 258
 	 * @return GetPaid_Form_Item[]
259 259
 	 */
260
-	public function get_items( $context = 'view', $return = 'objects' ) {
261
-		$items = $this->get_prop( 'items', $context );
260
+	public function get_items($context = 'view', $return = 'objects') {
261
+		$items = $this->get_prop('items', $context);
262 262
 
263
-		if ( empty( $items ) || ! is_array( $items ) ) {
264
-            $items = wpinv_get_data( 'sample-payment-form-items' );
263
+		if (empty($items) || !is_array($items)) {
264
+            $items = wpinv_get_data('sample-payment-form-items');
265 265
 		}
266 266
 
267 267
 		// Convert the items.
268 268
 		$prepared = array();
269 269
 
270
-		foreach ( $items as $key => $value ) {
270
+		foreach ($items as $key => $value) {
271 271
 
272 272
 			// Form items.
273
-			if ( $value instanceof GetPaid_Form_Item ) {
273
+			if ($value instanceof GetPaid_Form_Item) {
274 274
 
275
-				if ( $value->can_purchase() ) {
275
+				if ($value->can_purchase()) {
276 276
 					$prepared[] = $value;
277 277
 				}
278 278
 
@@ -281,16 +281,16 @@  discard block
 block discarded – undo
281 281
 			}
282 282
 
283 283
 			// $item_id => $quantity (buy buttons)
284
-			if ( is_numeric( $key ) && is_numeric( $value ) ) {
285
-				$item = new GetPaid_Form_Item( $key );
284
+			if (is_numeric($key) && is_numeric($value)) {
285
+				$item = new GetPaid_Form_Item($key);
286 286
 
287
-				if ( $item->can_purchase() ) {
287
+				if ($item->can_purchase()) {
288 288
 
289 289
 					$value = (float) $value;
290
-					$item->set_quantity( $value );
291
-					if ( 0 == $value ) {
292
-						$item->set_quantity( 1 );
293
-						$item->set_allow_quantities( true );
290
+					$item->set_quantity($value);
291
+					if (0 == $value) {
292
+						$item->set_quantity(1);
293
+						$item->set_allow_quantities(true);
294 294
 					}
295 295
 
296 296
 					$prepared[] = $item;
@@ -300,33 +300,33 @@  discard block
 block discarded – undo
300 300
 			}
301 301
 
302 302
 			// Items saved via payment forms editor.
303
-			if ( is_array( $value ) && isset( $value['id'] ) ) {
303
+			if (is_array($value) && isset($value['id'])) {
304 304
 
305
-				$item = new GetPaid_Form_Item( $value['id'] );
305
+				$item = new GetPaid_Form_Item($value['id']);
306 306
 
307
-				if ( ! $item->can_purchase() ) {
307
+				if (!$item->can_purchase()) {
308 308
 					continue;
309 309
 				}
310 310
 
311 311
 				// Sub-total (Cart items).
312
-				if ( isset( $value['subtotal'] ) ) {
313
-					$item->set_price( $value['subtotal'] );
312
+				if (isset($value['subtotal'])) {
313
+					$item->set_price($value['subtotal']);
314 314
 				}
315 315
 
316
-				if ( isset( $value['quantity'] ) ) {
317
-					$item->set_quantity( $value['quantity'] );
316
+				if (isset($value['quantity'])) {
317
+					$item->set_quantity($value['quantity']);
318 318
 				}
319 319
 
320
-				if ( isset( $value['allow_quantities'] ) ) {
321
-					$item->set_allow_quantities( $value['allow_quantities'] );
320
+				if (isset($value['allow_quantities'])) {
321
+					$item->set_allow_quantities($value['allow_quantities']);
322 322
 				}
323 323
 
324
-				if ( isset( $value['required'] ) ) {
325
-					$item->set_is_required( $value['required'] );
324
+				if (isset($value['required'])) {
325
+					$item->set_is_required($value['required']);
326 326
 				}
327 327
 
328
-				if ( isset( $value['description'] ) ) {
329
-					$item->set_custom_description( $value['description'] );
328
+				if (isset($value['description'])) {
329
+					$item->set_custom_description($value['description']);
330 330
 				}
331 331
 
332 332
 				$prepared[] = $item;
@@ -335,14 +335,14 @@  discard block
 block discarded – undo
335 335
 			}
336 336
 
337 337
 			// $item_id => array( 'price' => 10 ) (item variations)
338
-			if ( is_numeric( $key ) && is_array( $value ) ) {
339
-				$item = new GetPaid_Form_Item( $key );
338
+			if (is_numeric($key) && is_array($value)) {
339
+				$item = new GetPaid_Form_Item($key);
340 340
 
341
-				if ( isset( $value['price'] ) && $item->user_can_set_their_price() ) {
342
-					$item->set_price( $value['price'] );
341
+				if (isset($value['price']) && $item->user_can_set_their_price()) {
342
+					$item->set_price($value['price']);
343 343
 				}
344 344
 
345
-				if ( $item->can_purchase() ) {
345
+				if ($item->can_purchase()) {
346 346
 					$prepared[] = $item;
347 347
 				}
348 348
 
@@ -351,12 +351,12 @@  discard block
 block discarded – undo
351 351
 
352 352
 		}
353 353
 
354
-		if ( 'objects' == $return && 'view' == $context ) {
354
+		if ('objects' == $return && 'view' == $context) {
355 355
 			return $prepared;
356 356
 		}
357 357
 
358 358
 		$items = array();
359
-		foreach ( $prepared as $item ) {
359
+		foreach ($prepared as $item) {
360 360
 			$items[] = $item->prepare_data_for_use();
361 361
 		}
362 362
 
@@ -370,14 +370,14 @@  discard block
 block discarded – undo
370 370
 	 * @param  int $item_id The item id to return.
371 371
 	 * @return GetPaid_Form_Item|bool
372 372
 	 */
373
-	public function get_item( $item_id ) {
373
+	public function get_item($item_id) {
374 374
 
375
-		if ( empty( $item_id ) || ! is_numeric( $item_id ) ) {
375
+		if (empty($item_id) || !is_numeric($item_id)) {
376 376
 			return false;
377 377
 		}
378 378
 
379
-		foreach( $this->get_items() as $item ) {
380
-			if ( $item->get_id() == (int) $item_id ) {
379
+		foreach ($this->get_items() as $item) {
380
+			if ($item->get_id() == (int) $item_id) {
381 381
 				return $item;
382 382
 			}
383 383
 		}
@@ -393,15 +393,15 @@  discard block
 block discarded – undo
393 393
 	 * @param  string $element_type The element type to return.
394 394
 	 * @return array|bool
395 395
 	 */
396
-	public function get_element_type( $element_type ) {
396
+	public function get_element_type($element_type) {
397 397
 
398
-		if ( empty( $element_type ) || ! is_scalar( $element_type ) ) {
398
+		if (empty($element_type) || !is_scalar($element_type)) {
399 399
 			return false;
400 400
 		}
401 401
 
402
-		foreach ( $this->get_prop( 'elements' ) as $element ) {
402
+		foreach ($this->get_prop('elements') as $element) {
403 403
 
404
-			if ( $element['type'] == $element_type ) {
404
+			if ($element['type'] == $element_type) {
405 405
 				return $element;
406 406
 			}
407 407
 
@@ -418,8 +418,8 @@  discard block
 block discarded – undo
418 418
 	 * @param  string $context View or edit context.
419 419
 	 * @return float
420 420
 	 */
421
-	public function get_earned( $context = 'view' ) {
422
-		return $this->get_prop( 'earned', $context );
421
+	public function get_earned($context = 'view') {
422
+		return $this->get_prop('earned', $context);
423 423
 	}
424 424
 
425 425
 	/**
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
 	 * @param  string $context View or edit context.
430 430
 	 * @return float
431 431
 	 */
432
-	public function get_refunded( $context = 'view' ) {
433
-		return $this->get_prop( 'refunded', $context );
432
+	public function get_refunded($context = 'view') {
433
+		return $this->get_prop('refunded', $context);
434 434
 	}
435 435
 
436 436
 	/**
@@ -440,8 +440,8 @@  discard block
 block discarded – undo
440 440
 	 * @param  string $context View or edit context.
441 441
 	 * @return float
442 442
 	 */
443
-	public function get_cancelled( $context = 'view' ) {
444
-		return $this->get_prop( 'cancelled', $context );
443
+	public function get_cancelled($context = 'view') {
444
+		return $this->get_prop('cancelled', $context);
445 445
 	}
446 446
 
447 447
 	/**
@@ -451,8 +451,8 @@  discard block
 block discarded – undo
451 451
 	 * @param  string $context View or edit context.
452 452
 	 * @return float
453 453
 	 */
454
-	public function get_failed( $context = 'view' ) {
455
-		return $this->get_prop( 'failed', $context );
454
+	public function get_failed($context = 'view') {
455
+		return $this->get_prop('failed', $context);
456 456
 	}
457 457
 
458 458
 	/**
@@ -463,8 +463,8 @@  discard block
 block discarded – undo
463 463
 	 * @return string
464 464
 	 */
465 465
 	public function get_currency() {
466
-		$currency = empty( $this->invoice ) ? wpinv_get_currency() : $this->invoice->get_currency();
467
-		return apply_filters( 'getpaid-payment-form-currency', $currency, $this );
466
+		$currency = empty($this->invoice) ? wpinv_get_currency() : $this->invoice->get_currency();
467
+		return apply_filters('getpaid-payment-form-currency', $currency, $this);
468 468
 	}
469 469
 
470 470
     /*
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 	 *
483 483
 	 * @since 1.0.19
484 484
 	 */
485
-	public function set_version( $value ) {
486
-		$this->set_prop( 'version', $value );
485
+	public function set_version($value) {
486
+		$this->set_prop('version', $value);
487 487
     }
488 488
 
489 489
     /**
@@ -493,11 +493,11 @@  discard block
 block discarded – undo
493 493
 	 * @param string $value Value to set.
494 494
      * @return bool Whether or not the date was set.
495 495
 	 */
496
-	public function set_date_created( $value ) {
497
-        $date = strtotime( $value );
496
+	public function set_date_created($value) {
497
+        $date = strtotime($value);
498 498
 
499
-        if ( $date ) {
500
-            $this->set_prop( 'date_created', date( 'Y-m-d H:i:s', $date ) );
499
+        if ($date) {
500
+            $this->set_prop('date_created', date('Y-m-d H:i:s', $date));
501 501
             return true;
502 502
         }
503 503
 
@@ -512,11 +512,11 @@  discard block
 block discarded – undo
512 512
 	 * @param string $value Value to set.
513 513
      * @return bool Whether or not the date was set.
514 514
 	 */
515
-	public function set_date_modified( $value ) {
516
-        $date = strtotime( $value );
515
+	public function set_date_modified($value) {
516
+        $date = strtotime($value);
517 517
 
518
-        if ( $date ) {
519
-            $this->set_prop( 'date_modified', date( 'Y-m-d H:i:s', $date ) );
518
+        if ($date) {
519
+            $this->set_prop('date_modified', date('Y-m-d H:i:s', $date));
520 520
             return true;
521 521
         }
522 522
 
@@ -530,8 +530,8 @@  discard block
 block discarded – undo
530 530
 	 * @since 1.0.19
531 531
 	 * @param  string $value New name.
532 532
 	 */
533
-	public function set_name( $value ) {
534
-		$this->set_prop( 'name', sanitize_text_field( $value ) );
533
+	public function set_name($value) {
534
+		$this->set_prop('name', sanitize_text_field($value));
535 535
     }
536 536
 
537 537
     /**
@@ -540,8 +540,8 @@  discard block
 block discarded – undo
540 540
 	 * @since 1.0.19
541 541
 	 * @param  string $value New name.
542 542
 	 */
543
-	public function set_title( $value ) {
544
-		$this->set_name( $value );
543
+	public function set_title($value) {
544
+		$this->set_name($value);
545 545
     }
546 546
 
547 547
     /**
@@ -550,8 +550,8 @@  discard block
 block discarded – undo
550 550
 	 * @since 1.0.19
551 551
 	 * @param  int $value New author.
552 552
 	 */
553
-	public function set_author( $value ) {
554
-		$this->set_prop( 'author', (int) $value );
553
+	public function set_author($value) {
554
+		$this->set_prop('author', (int) $value);
555 555
 	}
556 556
 
557 557
 	/**
@@ -561,21 +561,21 @@  discard block
 block discarded – undo
561 561
 	 * @sinve 2.3.4 Array values sanitized.
562 562
 	 * @param  array $value Form elements.
563 563
 	 */
564
-	public function set_elements( $value ) {
565
-		if ( is_array( $value ) ) {
564
+	public function set_elements($value) {
565
+		if (is_array($value)) {
566 566
 
567 567
 			// sanitize
568
-			if(!empty($value )){
568
+			if (!empty($value)) {
569 569
 
570
-				foreach($value as $key => $val_arr){
570
+				foreach ($value as $key => $val_arr) {
571 571
 					$help_text = !empty($val_arr['description']) ? wp_kses_post($val_arr['description']) : '';
572
-					$value[$key] = array_map( 'sanitize_text_field', $val_arr );
572
+					$value[$key] = array_map('sanitize_text_field', $val_arr);
573 573
 					$value[$key]['description'] = $help_text;
574 574
 				}
575 575
 				
576 576
 			}
577 577
 
578
-			$this->set_prop( 'elements', $value );
578
+			$this->set_prop('elements', $value);
579 579
 		}
580 580
 	}
581 581
 
@@ -585,9 +585,9 @@  discard block
 block discarded – undo
585 585
 	 * @since 1.0.19
586 586
 	 * @param  array $value Form elements.
587 587
 	 */
588
-	public function set_items( $value ) {
589
-		if ( is_array( $value ) ) {
590
-			$this->set_prop( 'items', $value );
588
+	public function set_items($value) {
589
+		if (is_array($value)) {
590
+			$this->set_prop('items', $value);
591 591
 		}
592 592
 	}
593 593
 
@@ -597,9 +597,9 @@  discard block
 block discarded – undo
597 597
 	 * @since 1.0.19
598 598
 	 * @param  float $value Amount earned.
599 599
 	 */
600
-	public function set_earned( $value ) {
601
-		$value = max( (float) $value, 0 );
602
-		$this->set_prop( 'earned', $value );
600
+	public function set_earned($value) {
601
+		$value = max((float) $value, 0);
602
+		$this->set_prop('earned', $value);
603 603
 	}
604 604
 
605 605
 	/**
@@ -608,9 +608,9 @@  discard block
 block discarded – undo
608 608
 	 * @since 1.0.19
609 609
 	 * @param  float $value Amount refunded.
610 610
 	 */
611
-	public function set_refunded( $value ) {
612
-		$value = max( (float) $value, 0 );
613
-		$this->set_prop( 'refunded', $value );
611
+	public function set_refunded($value) {
612
+		$value = max((float) $value, 0);
613
+		$this->set_prop('refunded', $value);
614 614
 	}
615 615
 
616 616
 	/**
@@ -619,9 +619,9 @@  discard block
 block discarded – undo
619 619
 	 * @since 1.0.19
620 620
 	 * @param  float $value Amount cancelled.
621 621
 	 */
622
-	public function set_cancelled( $value ) {
623
-		$value = max( (float) $value, 0 );
624
-		$this->set_prop( 'cancelled', $value );
622
+	public function set_cancelled($value) {
623
+		$value = max((float) $value, 0);
624
+		$this->set_prop('cancelled', $value);
625 625
 	}
626 626
 
627 627
 	/**
@@ -630,9 +630,9 @@  discard block
 block discarded – undo
630 630
 	 * @since 1.0.19
631 631
 	 * @param  float $value Amount cancelled.
632 632
 	 */
633
-	public function set_failed( $value ) {
634
-		$value = max( (float) $value, 0 );
635
-		$this->set_prop( 'failed', $value );
633
+	public function set_failed($value) {
634
+		$value = max((float) $value, 0);
635
+		$this->set_prop('failed', $value);
636 636
 	}
637 637
 
638 638
     /**
@@ -641,11 +641,11 @@  discard block
 block discarded – undo
641 641
      * @deprecated
642 642
 	 * @return int item id
643 643
      */
644
-    public function create( $data = array() ) {
644
+    public function create($data = array()) {
645 645
 
646 646
 		// Set the properties.
647
-		if ( is_array( $data ) ) {
648
-			$this->set_props( $data );
647
+		if (is_array($data)) {
648
+			$this->set_props($data);
649 649
 		}
650 650
 
651 651
 		// Save the item.
@@ -659,8 +659,8 @@  discard block
 block discarded – undo
659 659
      * @deprecated
660 660
 	 * @return int item id
661 661
      */
662
-    public function update( $data = array() ) {
663
-        return $this->create( $data );
662
+    public function update($data = array()) {
663
+        return $this->create($data);
664 664
     }
665 665
 
666 666
     /*
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 	 */
681 681
     public function is_default() {
682 682
         $is_default = $this->get_id() == wpinv_get_default_payment_form();
683
-        return (bool) apply_filters( 'wpinv_is_default_payment_form', $is_default, $this->get_id(), $this );
683
+        return (bool) apply_filters('wpinv_is_default_payment_form', $is_default, $this->get_id(), $this);
684 684
 	}
685 685
 
686 686
     /**
@@ -692,11 +692,11 @@  discard block
 block discarded – undo
692 692
     public function is_active() {
693 693
         $is_active = 0 !== (int) $this->get_id();
694 694
 
695
-        if ( $is_active && ! current_user_can( 'edit_post', $this->get_id() ) && $this->get_status() != 'publish' ) {
695
+        if ($is_active && !current_user_can('edit_post', $this->get_id()) && $this->get_status() != 'publish') {
696 696
             $is_active = false;
697 697
         }
698 698
 
699
-        return (bool) apply_filters( 'wpinv_is_payment_form_active', $is_active, $this );
699
+        return (bool) apply_filters('wpinv_is_payment_form_active', $is_active, $this);
700 700
 	}
701 701
 
702 702
 	/**
@@ -705,8 +705,8 @@  discard block
 block discarded – undo
705 705
 	 * @since 1.0.19
706 706
 	 * @return bool
707 707
 	 */
708
-    public function has_item( $item_id ) {
709
-        return false !== $this->get_item( $item_id );
708
+    public function has_item($item_id) {
709
+        return false !== $this->get_item($item_id);
710 710
 	}
711 711
 
712 712
 	/**
@@ -715,8 +715,8 @@  discard block
 block discarded – undo
715 715
 	 * @since 1.0.19
716 716
 	 * @return bool
717 717
 	 */
718
-    public function has_element_type( $element_type ) {
719
-        return false !== $this->get_element_type( $element_type );
718
+    public function has_element_type($element_type) {
719
+        return false !== $this->get_element_type($element_type);
720 720
 	}
721 721
 
722 722
 	/**
@@ -727,13 +727,13 @@  discard block
 block discarded – undo
727 727
 	 */
728 728
     public function is_recurring() {
729 729
 
730
-		if ( ! empty( $this->invoice ) ) {
730
+		if (!empty($this->invoice)) {
731 731
 			return $this->invoice->is_recurring();
732 732
 		}
733 733
 
734
-		foreach ( $this->get_items() as $item ) {
734
+		foreach ($this->get_items() as $item) {
735 735
 
736
-			if ( $item->is_recurring() ) {
736
+			if ($item->is_recurring()) {
737 737
 				return true;
738 738
 			}
739 739
 
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 	 *
748 748
 	 * @since 1.0.19
749 749
 	 */
750
-    public function get_html( $extra_markup = '' ) {
750
+    public function get_html($extra_markup = '') {
751 751
 
752 752
 		// Return the HTML.
753 753
 		return wpinv_get_template_html(
@@ -765,8 +765,8 @@  discard block
 block discarded – undo
765 765
 	 *
766 766
 	 * @since 1.0.19
767 767
 	 */
768
-    public function display( $extra_markup = '' ) {
769
-		echo $this->get_html( $extra_markup );
768
+    public function display($extra_markup = '') {
769
+		echo $this->get_html($extra_markup);
770 770
     }
771 771
 
772 772
 }
Please login to merge, or discard this patch.
invoicing.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,16 +19,16 @@  discard block
 block discarded – undo
19 19
 
20 20
 // Define constants.
21 21
 if ( ! defined( 'WPINV_PLUGIN_FILE' ) ) {
22
-	define( 'WPINV_PLUGIN_FILE', __FILE__ );
22
+    define( 'WPINV_PLUGIN_FILE', __FILE__ );
23 23
 }
24 24
 
25 25
 if ( ! defined( 'WPINV_VERSION' ) ) {
26
-	define( 'WPINV_VERSION', '2.3.4' );
26
+    define( 'WPINV_VERSION', '2.3.4' );
27 27
 }
28 28
 
29 29
 // Include the main Invoicing class.
30 30
 if ( ! class_exists( 'WPInv_Plugin', false ) ) {
31
-	require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php';
31
+    require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php';
32 32
 }
33 33
 
34 34
 /**
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $GLOBALS['invoicing'] = new WPInv_Plugin();
44 44
     }
45 45
 
46
-	return $GLOBALS['invoicing'];
46
+    return $GLOBALS['invoicing'];
47 47
 }
48 48
 
49 49
 /**
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -15,20 +15,20 @@  discard block
 block discarded – undo
15 15
  * @package GetPaid
16 16
  */
17 17
 
18
-defined( 'ABSPATH' ) || exit;
18
+defined('ABSPATH') || exit;
19 19
 
20 20
 // Define constants.
21
-if ( ! defined( 'WPINV_PLUGIN_FILE' ) ) {
22
-	define( 'WPINV_PLUGIN_FILE', __FILE__ );
21
+if (!defined('WPINV_PLUGIN_FILE')) {
22
+	define('WPINV_PLUGIN_FILE', __FILE__);
23 23
 }
24 24
 
25
-if ( ! defined( 'WPINV_VERSION' ) ) {
26
-	define( 'WPINV_VERSION', '2.3.4' );
25
+if (!defined('WPINV_VERSION')) {
26
+	define('WPINV_VERSION', '2.3.4');
27 27
 }
28 28
 
29 29
 // Include the main Invoicing class.
30
-if ( ! class_exists( 'WPInv_Plugin', false ) ) {
31
-	require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php';
30
+if (!class_exists('WPInv_Plugin', false)) {
31
+	require_once plugin_dir_path(WPINV_PLUGIN_FILE) . 'includes/class-wpinv.php';
32 32
 }
33 33
 
34 34
 /**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
  */
40 40
 function getpaid() {
41 41
 
42
-    if ( empty( $GLOBALS['invoicing'] ) ) {
42
+    if (empty($GLOBALS['invoicing'])) {
43 43
         $GLOBALS['invoicing'] = new WPInv_Plugin();
44 44
     }
45 45
 
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
  * @since  2.0.8
53 53
  */
54 54
 function getpaid_deactivation_hook() {
55
-    update_option( 'wpinv_flush_permalinks', 1 );
55
+    update_option('wpinv_flush_permalinks', 1);
56 56
 }
57
-register_deactivation_hook( __FILE__, 'getpaid_deactivation_hook' );
57
+register_deactivation_hook(__FILE__, 'getpaid_deactivation_hook');
58 58
 
59 59
 /**
60 60
  * @deprecated
@@ -64,4 +64,4 @@  discard block
 block discarded – undo
64 64
 }
65 65
 
66 66
 // Kickstart the plugin.
67
-add_action( 'plugins_loaded', 'getpaid', -100 );
67
+add_action('plugins_loaded', 'getpaid', -100);
Please login to merge, or discard this patch.