Passed
Push — master ( a00066...d57609 )
by Brian
05:08
created
includes/admin/register-settings.php 1 patch
Indentation   +310 added lines, -310 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   = esc_attr( $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   = esc_attr( $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(
@@ -279,10 +279,10 @@  discard block
 block discarded – undo
279 279
         }
280 280
 
281 281
         // General filter
282
-		$input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
282
+        $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
283 283
 
284
-		// Key specific filter.
285
-		$input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] );
284
+        // Key specific filter.
285
+        $input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] );
286 286
     }
287 287
 
288 288
     // Loop through the whitelist and unset any that are empty for the tab being saved
@@ -338,14 +338,14 @@  discard block
 block discarded – undo
338 338
 
339 339
     foreach ( $new_rates as $rate ) {
340 340
 
341
-		$rate['rate']    = wpinv_sanitize_amount( $rate['rate'] );
342
-		$rate['name']    = sanitize_text_field( $rate['name'] );
343
-		$rate['state']   = sanitize_text_field( $rate['state'] );
344
-		$rate['country'] = sanitize_text_field( $rate['country'] );
345
-		$rate['global']  = empty( $rate['state'] );
346
-		$tax_rates[]     = $rate;
341
+        $rate['rate']    = wpinv_sanitize_amount( $rate['rate'] );
342
+        $rate['name']    = sanitize_text_field( $rate['name'] );
343
+        $rate['state']   = sanitize_text_field( $rate['state'] );
344
+        $rate['country'] = sanitize_text_field( $rate['country'] );
345
+        $rate['global']  = empty( $rate['state'] );
346
+        $tax_rates[]     = $rate;
347 347
 
348
-	}
348
+    }
349 349
 
350 350
     update_option( 'wpinv_tax_rates', $tax_rates );
351 351
 
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
         ) ),
403 403
         'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array(
404 404
             'main'  => __( 'Tax Settings', 'invoicing' ),
405
-			'rates' => __( 'Tax Rates', 'invoicing' ),
406
-			'vat'   => __( 'EU VAT Settings', 'invoicing' )
405
+            'rates' => __( 'Tax Rates', 'invoicing' ),
406
+            'vat'   => __( 'EU VAT Settings', 'invoicing' )
407 407
         ) ),
408 408
         'emails' => apply_filters( 'wpinv_settings_sections_emails', array(
409 409
             'main' => __( 'Email Settings', 'invoicing' ),
@@ -426,51 +426,51 @@  discard block
 block discarded – undo
426 426
 }
427 427
 
428 428
 function wpinv_get_pages( $with_slug = false, $default_label = NULL ) {
429
-	$pages_options = array();
429
+    $pages_options = array();
430 430
 
431
-	if( $default_label !== NULL && $default_label !== false ) {
432
-		$pages_options = array( '' => $default_label ); // Blank option
433
-	}
431
+    if( $default_label !== NULL && $default_label !== false ) {
432
+        $pages_options = array( '' => $default_label ); // Blank option
433
+    }
434 434
 
435
-	$pages = get_pages();
436
-	if ( $pages ) {
437
-		foreach ( $pages as $page ) {
438
-			$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
435
+    $pages = get_pages();
436
+    if ( $pages ) {
437
+        foreach ( $pages as $page ) {
438
+            $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
439 439
             $pages_options[ $page->ID ] = $title;
440
-		}
441
-	}
440
+        }
441
+    }
442 442
 
443
-	return $pages_options;
443
+    return $pages_options;
444 444
 }
445 445
 
446 446
 function wpinv_header_callback( $args ) {
447
-	if ( !empty( $args['desc'] ) ) {
447
+    if ( !empty( $args['desc'] ) ) {
448 448
         echo $args['desc'];
449 449
     }
450 450
 }
451 451
 
452 452
 function wpinv_hidden_callback( $args ) {
453
-	global $wpinv_options;
454
-
455
-	if ( isset( $args['set_value'] ) ) {
456
-		$value = $args['set_value'];
457
-	} elseif ( isset( $wpinv_options[ $args['id'] ] ) ) {
458
-		$value = $wpinv_options[ $args['id'] ];
459
-	} else {
460
-		$value = isset( $args['std'] ) ? $args['std'] : '';
461
-	}
462
-
463
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
464
-		$args['readonly'] = true;
465
-		$value = isset( $args['std'] ) ? $args['std'] : '';
466
-		$name  = '';
467
-	} else {
468
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
469
-	}
470
-
471
-	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
453
+    global $wpinv_options;
454
+
455
+    if ( isset( $args['set_value'] ) ) {
456
+        $value = $args['set_value'];
457
+    } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) {
458
+        $value = $wpinv_options[ $args['id'] ];
459
+    } else {
460
+        $value = isset( $args['std'] ) ? $args['std'] : '';
461
+    }
462
+
463
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
464
+        $args['readonly'] = true;
465
+        $value = isset( $args['std'] ) ? $args['std'] : '';
466
+        $name  = '';
467
+    } else {
468
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
469
+    }
470
+
471
+    $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
472 472
     
473
-	echo $html;
473
+    echo $html;
474 474
 }
475 475
 
476 476
 /**
@@ -478,12 +478,12 @@  discard block
 block discarded – undo
478 478
  */
479 479
 function wpinv_checkbox_callback( $args ) {
480 480
 
481
-	$std = isset( $args['std'] ) ? $args['std'] : '';
482
-	$std = wpinv_get_option( $args['id'], $std );
483
-	$id  = esc_attr( $args['id'] );
481
+    $std = isset( $args['std'] ) ? $args['std'] : '';
482
+    $std = wpinv_get_option( $args['id'], $std );
483
+    $id  = esc_attr( $args['id'] );
484 484
 
485
-	getpaid_hidden_field( "wpinv_settings[$id]", '0' );
486
-	?>
485
+    getpaid_hidden_field( "wpinv_settings[$id]", '0' );
486
+    ?>
487 487
 		<fieldset>
488 488
 			<label>
489 489
 				<input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked( empty( $std ), false ); ?> value="1" type="checkbox">
@@ -495,77 +495,77 @@  discard block
 block discarded – undo
495 495
 
496 496
 function wpinv_multicheck_callback( $args ) {
497 497
 	
498
-	global $wpinv_options;
498
+    global $wpinv_options;
499 499
 
500
-	$sanitize_id = wpinv_sanitize_key( $args['id'] );
501
-	$class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
500
+    $sanitize_id = wpinv_sanitize_key( $args['id'] );
501
+    $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
502 502
 
503
-	if ( ! empty( $args['options'] ) ) {
503
+    if ( ! empty( $args['options'] ) ) {
504 504
 
505
-		$std     = isset( $args['std'] ) ? $args['std'] : array();
506
-		$value   = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std;
505
+        $std     = isset( $args['std'] ) ? $args['std'] : array();
506
+        $value   = isset( $wpinv_options[ $args['id'] ] ) ? $wpinv_options[ $args['id'] ] : $std;
507 507
 
508
-		echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
508
+        echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
509 509
         foreach( $args['options'] as $key => $option ):
510
-			$sanitize_key = wpinv_sanitize_key( $key );
511
-			if ( in_array( $sanitize_key, $value ) ) { 
512
-				$enabled = $sanitize_key;
513
-			} else { 
514
-				$enabled = NULL; 
515
-			}
516
-			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;';
517
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
518
-		endforeach;
519
-		echo '</div>';
520
-		echo '<p class="description">' . $args['desc'] . '</p>';
521
-	}
510
+            $sanitize_key = wpinv_sanitize_key( $key );
511
+            if ( in_array( $sanitize_key, $value ) ) { 
512
+                $enabled = $sanitize_key;
513
+            } else { 
514
+                $enabled = NULL; 
515
+            }
516
+            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;';
517
+            echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
518
+        endforeach;
519
+        echo '</div>';
520
+        echo '<p class="description">' . $args['desc'] . '</p>';
521
+    }
522 522
 }
523 523
 
524 524
 function wpinv_payment_icons_callback( $args ) {
525
-	global $wpinv_options;
525
+    global $wpinv_options;
526 526
     
527 527
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
528 528
 
529
-	if ( ! empty( $args['options'] ) ) {
530
-		foreach( $args['options'] as $key => $option ) {
529
+    if ( ! empty( $args['options'] ) ) {
530
+        foreach( $args['options'] as $key => $option ) {
531 531
             $sanitize_key = wpinv_sanitize_key( $key );
532 532
             
533
-			if( isset( $wpinv_options[$args['id']][$key] ) ) {
534
-				$enabled = $option;
535
-			} else {
536
-				$enabled = NULL;
537
-			}
538
-
539
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
540
-
541
-				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;';
542
-
543
-				if ( wpinv_string_is_image_url( $key ) ) {
544
-					echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
545
-				} else {
546
-					$card = strtolower( str_replace( ' ', '', $option ) );
547
-
548
-					if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
549
-						$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
550
-					} else {
551
-						$image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
552
-						$content_dir = WP_CONTENT_DIR;
553
-
554
-						if ( function_exists( 'wp_normalize_path' ) ) {
555
-							// Replaces backslashes with forward slashes for Windows systems
556
-							$image = wp_normalize_path( $image );
557
-							$content_dir = wp_normalize_path( $content_dir );
558
-						}
559
-
560
-						$image = str_replace( $content_dir, content_url(), $image );
561
-					}
562
-
563
-					echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
564
-				}
565
-			echo $option . '</label>';
566
-		}
567
-		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
568
-	}
533
+            if( isset( $wpinv_options[$args['id']][$key] ) ) {
534
+                $enabled = $option;
535
+            } else {
536
+                $enabled = NULL;
537
+            }
538
+
539
+            echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
540
+
541
+                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;';
542
+
543
+                if ( wpinv_string_is_image_url( $key ) ) {
544
+                    echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
545
+                } else {
546
+                    $card = strtolower( str_replace( ' ', '', $option ) );
547
+
548
+                    if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
549
+                        $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
550
+                    } else {
551
+                        $image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
552
+                        $content_dir = WP_CONTENT_DIR;
553
+
554
+                        if ( function_exists( 'wp_normalize_path' ) ) {
555
+                            // Replaces backslashes with forward slashes for Windows systems
556
+                            $image = wp_normalize_path( $image );
557
+                            $content_dir = wp_normalize_path( $content_dir );
558
+                        }
559
+
560
+                        $image = str_replace( $content_dir, content_url(), $image );
561
+                    }
562
+
563
+                    echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
564
+                }
565
+            echo $option . '</label>';
566
+        }
567
+        echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
568
+    }
569 569
 }
570 570
 
571 571
 /**
@@ -573,9 +573,9 @@  discard block
 block discarded – undo
573 573
  */
574 574
 function wpinv_radio_callback( $args ) {
575 575
 
576
-	$std = isset( $args['std'] ) ? $args['std'] : '';
577
-	$std = wpinv_get_option( $args['id'], $std );
578
-	?>
576
+    $std = isset( $args['std'] ) ? $args['std'] : '';
577
+    $std = wpinv_get_option( $args['id'], $std );
578
+    ?>
579 579
 		<fieldset>
580 580
 			<ul id="wpinv-settings-<?php echo esc_attr( $args['id'] ); ?>" style="margin-top: 0;">
581 581
 				<?php foreach( $args['options'] as $key => $option ) : ?>
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 			</ul>
590 590
 		</fieldset>
591 591
 	<?php
592
-	getpaid_settings_description_callback( $args );
592
+    getpaid_settings_description_callback( $args );
593 593
 }
594 594
 
595 595
 /**
@@ -597,176 +597,176 @@  discard block
 block discarded – undo
597 597
  */
598 598
 function getpaid_settings_description_callback( $args ) {
599 599
 
600
-	if ( ! empty( $args['desc'] ) ) {
601
-		$description = wp_kses_post( $args['desc'] );
602
-		echo "<p class='description'>$description</p>";
603
-	}
600
+    if ( ! empty( $args['desc'] ) ) {
601
+        $description = wp_kses_post( $args['desc'] );
602
+        echo "<p class='description'>$description</p>";
603
+    }
604 604
 
605 605
 }
606 606
 
607 607
 function wpinv_gateways_callback( $args ) {
608
-	global $wpinv_options;
608
+    global $wpinv_options;
609 609
     
610 610
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
611 611
 
612
-	foreach ( $args['options'] as $key => $option ) :
613
-		$sanitize_key = wpinv_sanitize_key( $key );
612
+    foreach ( $args['options'] as $key => $option ) :
613
+        $sanitize_key = wpinv_sanitize_key( $key );
614 614
         
615 615
         if ( isset( $wpinv_options['gateways'][ $key ] ) )
616
-			$enabled = '1';
617
-		else
618
-			$enabled = null;
616
+            $enabled = '1';
617
+        else
618
+            $enabled = null;
619 619
 
620
-		echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/>&nbsp;';
621
-		echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
622
-	endforeach;
620
+        echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/>&nbsp;';
621
+        echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>';
622
+    endforeach;
623 623
 }
624 624
 
625 625
 function wpinv_gateway_select_callback($args) {
626
-	global $wpinv_options;
626
+    global $wpinv_options;
627 627
     
628 628
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
629 629
     $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
630 630
 
631
-	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >';
631
+    echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >';
632 632
 
633
-	foreach ( $args['options'] as $key => $option ) :
634
-		if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
633
+    foreach ( $args['options'] as $key => $option ) :
634
+        if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
635 635
             $selected = selected( $key, $args['selected'], false );
636 636
         } else {
637 637
             $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : '';
638 638
         }
639
-		echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
640
-	endforeach;
639
+        echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
640
+    endforeach;
641 641
 
642
-	echo '</select>';
643
-	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
642
+    echo '</select>';
643
+    echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
644 644
 }
645 645
 
646 646
 function wpinv_text_callback( $args ) {
647
-	global $wpinv_options;
647
+    global $wpinv_options;
648 648
     
649 649
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
650 650
 
651
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
652
-		$value = $wpinv_options[ $args['id'] ];
653
-	} else {
654
-		$value = isset( $args['std'] ) ? $args['std'] : '';
655
-	}
656
-
657
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
658
-		$args['readonly'] = true;
659
-		$value = isset( $args['std'] ) ? $args['std'] : '';
660
-		$name  = '';
661
-	} else {
662
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
663
-	}
664
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
665
-
666
-	$readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
667
-	$size     = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
668
-	$html     = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>';
669
-	$html    .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
670
-
671
-	echo $html;
651
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
652
+        $value = $wpinv_options[ $args['id'] ];
653
+    } else {
654
+        $value = isset( $args['std'] ) ? $args['std'] : '';
655
+    }
656
+
657
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
658
+        $args['readonly'] = true;
659
+        $value = isset( $args['std'] ) ? $args['std'] : '';
660
+        $name  = '';
661
+    } else {
662
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
663
+    }
664
+    $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
665
+
666
+    $readonly = $args['readonly'] === true ? ' readonly="readonly"' : '';
667
+    $size     = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
668
+    $html     = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>';
669
+    $html    .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
670
+
671
+    echo $html;
672 672
 }
673 673
 
674 674
 function wpinv_number_callback( $args ) {
675
-	global $wpinv_options;
675
+    global $wpinv_options;
676 676
     
677 677
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
678 678
 
679
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
680
-		$value = $wpinv_options[ $args['id'] ];
681
-	} else {
682
-		$value = isset( $args['std'] ) ? $args['std'] : '';
683
-	}
684
-
685
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
686
-		$args['readonly'] = true;
687
-		$value = isset( $args['std'] ) ? $args['std'] : '';
688
-		$name  = '';
689
-	} else {
690
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
691
-	}
692
-
693
-	$max  = isset( $args['max'] ) ? $args['max'] : 999999;
694
-	$min  = isset( $args['min'] ) ? $args['min'] : 0;
695
-	$step = isset( $args['step'] ) ? $args['step'] : 1;
696
-	$class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
697
-
698
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
699
-	$html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"/>';
700
-	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
701
-
702
-	echo $html;
679
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
680
+        $value = $wpinv_options[ $args['id'] ];
681
+    } else {
682
+        $value = isset( $args['std'] ) ? $args['std'] : '';
683
+    }
684
+
685
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
686
+        $args['readonly'] = true;
687
+        $value = isset( $args['std'] ) ? $args['std'] : '';
688
+        $name  = '';
689
+    } else {
690
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
691
+    }
692
+
693
+    $max  = isset( $args['max'] ) ? $args['max'] : 999999;
694
+    $min  = isset( $args['min'] ) ? $args['min'] : 0;
695
+    $step = isset( $args['step'] ) ? $args['step'] : 1;
696
+    $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : '';
697
+
698
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
699
+    $html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"/>';
700
+    $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
701
+
702
+    echo $html;
703 703
 }
704 704
 
705 705
 function wpinv_textarea_callback( $args ) {
706
-	global $wpinv_options;
706
+    global $wpinv_options;
707 707
     
708 708
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
709 709
 
710
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
711
-		$value = $wpinv_options[ $args['id'] ];
712
-	} else {
713
-		$value = isset( $args['std'] ) ? $args['std'] : '';
714
-	}
710
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
711
+        $value = $wpinv_options[ $args['id'] ];
712
+    } else {
713
+        $value = isset( $args['std'] ) ? $args['std'] : '';
714
+    }
715 715
     
716 716
     $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
717 717
     $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text';
718 718
 
719
-	$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>';
720
-	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
719
+    $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>';
720
+    $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
721 721
 
722
-	echo $html;
722
+    echo $html;
723 723
 }
724 724
 
725 725
 function wpinv_password_callback( $args ) {
726
-	global $wpinv_options;
726
+    global $wpinv_options;
727 727
     
728 728
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
729 729
 
730
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
731
-		$value = $wpinv_options[ $args['id'] ];
732
-	} else {
733
-		$value = isset( $args['std'] ) ? $args['std'] : '';
734
-	}
730
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
731
+        $value = $wpinv_options[ $args['id'] ];
732
+    } else {
733
+        $value = isset( $args['std'] ) ? $args['std'] : '';
734
+    }
735 735
 
736
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
737
-	$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 ) . '"/>';
738
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
736
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
737
+    $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 ) . '"/>';
738
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
739 739
 
740
-	echo $html;
740
+    echo $html;
741 741
 }
742 742
 
743 743
 function wpinv_missing_callback($args) {
744
-	printf(
745
-		__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
746
-		'<strong>' . $args['id'] . '</strong>'
747
-	);
744
+    printf(
745
+        __( 'The callback function used for the %s setting is missing.', 'invoicing' ),
746
+        '<strong>' . $args['id'] . '</strong>'
747
+    );
748 748
 }
749 749
 
750 750
 function wpinv_select_callback($args) {
751
-	global $wpinv_options;
751
+    global $wpinv_options;
752 752
     
753 753
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
754 754
 
755
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
756
-		$value = $wpinv_options[ $args['id'] ];
757
-	} else {
758
-		$value = isset( $args['std'] ) ? $args['std'] : '';
759
-	}
755
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
756
+        $value = $wpinv_options[ $args['id'] ];
757
+    } else {
758
+        $value = isset( $args['std'] ) ? $args['std'] : '';
759
+    }
760 760
     
761 761
     if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
762 762
         $value = $args['selected'];
763 763
     }
764 764
 
765
-	if ( isset( $args['placeholder'] ) ) {
766
-		$placeholder = $args['placeholder'];
767
-	} else {
768
-		$placeholder = '';
769
-	}
765
+    if ( isset( $args['placeholder'] ) ) {
766
+        $placeholder = $args['placeholder'];
767
+    } else {
768
+        $placeholder = '';
769
+    }
770 770
     
771 771
     if( !empty( $args['onchange'] ) ) {
772 772
         $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"';
@@ -776,137 +776,137 @@  discard block
 block discarded – undo
776 776
 
777 777
     $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
778 778
 
779
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'"  name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />';
779
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'"  name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />';
780 780
 
781
-	foreach ( $args['options'] as $option => $name ) {
782
-		$selected = selected( $option, $value, false );
783
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
784
-	}
781
+    foreach ( $args['options'] as $option => $name ) {
782
+        $selected = selected( $option, $value, false );
783
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
784
+    }
785 785
 
786
-	$html .= '</select>';
787
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
786
+    $html .= '</select>';
787
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
788 788
 
789
-	echo $html;
789
+    echo $html;
790 790
 }
791 791
 
792 792
 function wpinv_color_select_callback( $args ) {
793
-	global $wpinv_options;
793
+    global $wpinv_options;
794 794
     
795 795
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
796 796
 
797
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
798
-		$value = $wpinv_options[ $args['id'] ];
799
-	} else {
800
-		$value = isset( $args['std'] ) ? $args['std'] : '';
801
-	}
797
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
798
+        $value = $wpinv_options[ $args['id'] ];
799
+    } else {
800
+        $value = isset( $args['std'] ) ? $args['std'] : '';
801
+    }
802 802
 
803
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
803
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
804 804
 
805
-	foreach ( $args['options'] as $option => $color ) {
806
-		$selected = selected( $option, $value, false );
807
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
808
-	}
805
+    foreach ( $args['options'] as $option => $color ) {
806
+        $selected = selected( $option, $value, false );
807
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
808
+    }
809 809
 
810
-	$html .= '</select>';
811
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
810
+    $html .= '</select>';
811
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
812 812
 
813
-	echo $html;
813
+    echo $html;
814 814
 }
815 815
 
816 816
 function wpinv_rich_editor_callback( $args ) {
817
-	global $wpinv_options, $wp_version;
817
+    global $wpinv_options, $wp_version;
818 818
     
819 819
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
820 820
 
821
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
822
-		$value = $wpinv_options[ $args['id'] ];
821
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
822
+        $value = $wpinv_options[ $args['id'] ];
823 823
 
824
-		if( empty( $args['allow_blank'] ) && empty( $value ) ) {
825
-			$value = isset( $args['std'] ) ? $args['std'] : '';
826
-		}
827
-	} else {
828
-		$value = isset( $args['std'] ) ? $args['std'] : '';
829
-	}
824
+        if( empty( $args['allow_blank'] ) && empty( $value ) ) {
825
+            $value = isset( $args['std'] ) ? $args['std'] : '';
826
+        }
827
+    } else {
828
+        $value = isset( $args['std'] ) ? $args['std'] : '';
829
+    }
830 830
 
831
-	$rows = isset( $args['size'] ) ? $args['size'] : 20;
831
+    $rows = isset( $args['size'] ) ? $args['size'] : 20;
832 832
 
833
-	$html = '<div class="getpaid-settings-editor-input">';
834
-	if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
835
-		ob_start();
836
-		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 ) );
837
-		$html .= ob_get_clean();
838
-	} else {
839
-		$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>';
840
-	}
833
+    $html = '<div class="getpaid-settings-editor-input">';
834
+    if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
835
+        ob_start();
836
+        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 ) );
837
+        $html .= ob_get_clean();
838
+    } else {
839
+        $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>';
840
+    }
841 841
 
842
-	$html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
842
+    $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
843 843
 
844
-	echo $html;
844
+    echo $html;
845 845
 }
846 846
 
847 847
 function wpinv_upload_callback( $args ) {
848
-	global $wpinv_options;
848
+    global $wpinv_options;
849 849
     
850 850
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
851 851
 
852
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
853
-		$value = $wpinv_options[$args['id']];
854
-	} else {
855
-		$value = isset($args['std']) ? $args['std'] : '';
856
-	}
852
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
853
+        $value = $wpinv_options[$args['id']];
854
+    } else {
855
+        $value = isset($args['std']) ? $args['std'] : '';
856
+    }
857 857
 
858
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
859
-	$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 ) ) . '"/>';
860
-	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
861
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
858
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
859
+    $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 ) ) . '"/>';
860
+    $html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
861
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
862 862
 
863
-	echo $html;
863
+    echo $html;
864 864
 }
865 865
 
866 866
 function wpinv_color_callback( $args ) {
867
-	global $wpinv_options;
867
+    global $wpinv_options;
868 868
     
869 869
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
870 870
 
871
-	if ( isset( $wpinv_options[ $args['id'] ] ) ) {
872
-		$value = $wpinv_options[ $args['id'] ];
873
-	} else {
874
-		$value = isset( $args['std'] ) ? $args['std'] : '';
875
-	}
871
+    if ( isset( $wpinv_options[ $args['id'] ] ) ) {
872
+        $value = $wpinv_options[ $args['id'] ];
873
+    } else {
874
+        $value = isset( $args['std'] ) ? $args['std'] : '';
875
+    }
876 876
 
877
-	$default = isset( $args['std'] ) ? $args['std'] : '';
877
+    $default = isset( $args['std'] ) ? $args['std'] : '';
878 878
 
879
-	$html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $default ) . '" />';
880
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
879
+    $html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $default ) . '" />';
880
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
881 881
 
882
-	echo $html;
882
+    echo $html;
883 883
 }
884 884
 
885 885
 function wpinv_country_states_callback($args) {
886
-	global $wpinv_options;
886
+    global $wpinv_options;
887 887
     
888 888
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
889 889
 
890
-	if ( isset( $args['placeholder'] ) ) {
891
-		$placeholder = $args['placeholder'];
892
-	} else {
893
-		$placeholder = '';
894
-	}
890
+    if ( isset( $args['placeholder'] ) ) {
891
+        $placeholder = $args['placeholder'];
892
+    } else {
893
+        $placeholder = '';
894
+    }
895 895
 
896
-	$states = wpinv_get_country_states();
896
+    $states = wpinv_get_country_states();
897 897
 
898
-	$class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
899
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
898
+    $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
899
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
900 900
 
901
-	foreach ( $states as $option => $name ) {
902
-		$selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : '';
903
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
904
-	}
901
+    foreach ( $states as $option => $name ) {
902
+        $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : '';
903
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
904
+    }
905 905
 
906
-	$html .= '</select>';
907
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
906
+    $html .= '</select>';
907
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
908 908
 
909
-	echo $html;
909
+    echo $html;
910 910
 }
911 911
 
912 912
 /**
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
  */
915 915
 function wpinv_tax_rates_callback() {
916 916
 	
917
-	?>
917
+    ?>
918 918
 		</td>
919 919
 	</tr>
920 920
 	<tr class="bsui">
@@ -929,17 +929,17 @@  discard block
 block discarded – undo
929 929
  * Displays a tax rate' edit row.
930 930
  */
931 931
 function wpinv_tax_rate_callback( $tax_rate, $key, $echo = true ) {
932
-	ob_start();
932
+    ob_start();
933 933
 
934
-	$key                      = sanitize_key( $key );
935
-	$tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate'];
936
-	include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php';
934
+    $key                      = sanitize_key( $key );
935
+    $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate'];
936
+    include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php';
937 937
 
938
-	if ( $echo ) {
939
-		echo ob_get_clean();
940
-	} else {
941
-		return ob_get_clean(); 
942
-	}
938
+    if ( $echo ) {
939
+        echo ob_get_clean();
940
+    } else {
941
+        return ob_get_clean(); 
942
+    }
943 943
 
944 944
 }
945 945
 
@@ -967,15 +967,15 @@  discard block
 block discarded – undo
967 967
 }
968 968
 
969 969
 function wpinv_descriptive_text_callback( $args ) {
970
-	echo wp_kses_post( $args['desc'] );
970
+    echo wp_kses_post( $args['desc'] );
971 971
 }
972 972
 
973 973
 function wpinv_hook_callback( $args ) {
974
-	do_action( 'wpinv_' . $args['id'], $args );
974
+    do_action( 'wpinv_' . $args['id'], $args );
975 975
 }
976 976
 
977 977
 function wpinv_set_settings_cap() {
978
-	return wpinv_get_capability();
978
+    return wpinv_get_capability();
979 979
 }
980 980
 add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' );
981 981
 
Please login to merge, or discard this patch.
includes/admin/class-getpaid-metaboxes.php 1 patch
Indentation   +231 added lines, -231 removed lines patch added patch discarded remove patch
@@ -12,267 +12,267 @@
 block discarded – undo
12 12
  */
13 13
 class GetPaid_Metaboxes {
14 14
 
15
-	/**
16
-	 * Only save metaboxes once.
17
-	 *
18
-	 * @var boolean
19
-	 */
20
-	private static $saved_meta_boxes = false;
21
-
22 15
     /**
23
-	 * Hook in methods.
24
-	 */
25
-	public static function init() {
26
-
27
-		// Register metaboxes.
28
-		add_action( 'add_meta_boxes', 'GetPaid_Metaboxes::add_meta_boxes', 5, 2 );
29
-
30
-		// Remove metaboxes.
31
-		add_action( 'add_meta_boxes', 'GetPaid_Metaboxes::remove_meta_boxes', 30 );
32
-
33
-		// Rename metaboxes.
34
-		add_action( 'add_meta_boxes', 'GetPaid_Metaboxes::rename_meta_boxes', 45 );
35
-
36
-		// Save metaboxes.
37
-		add_action( 'save_post', 'GetPaid_Metaboxes::save_meta_boxes', 1, 2 );
38
-	}
16
+     * Only save metaboxes once.
17
+     *
18
+     * @var boolean
19
+     */
20
+    private static $saved_meta_boxes = false;
39 21
 
40
-	/**
41
-	 * Register core metaboxes.
42
-	 */
43
-	public static function add_meta_boxes( $post_type, $post ) {
44
-
45
-		// For invoices...
46
-		self::add_invoice_meta_boxes( $post_type, $post );
22
+    /**
23
+     * Hook in methods.
24
+     */
25
+    public static function init() {
47 26
 
48
-		// For payment forms.
49
-		self::add_payment_form_meta_boxes( $post_type );
27
+        // Register metaboxes.
28
+        add_action( 'add_meta_boxes', 'GetPaid_Metaboxes::add_meta_boxes', 5, 2 );
50 29
 
51
-		// For invoice items.
52
-		self::add_item_meta_boxes( $post_type );
30
+        // Remove metaboxes.
31
+        add_action( 'add_meta_boxes', 'GetPaid_Metaboxes::remove_meta_boxes', 30 );
53 32
 
54
-		// For invoice discounts.
55
-		if ( $post_type == 'wpi_discount' ) {
56
-			add_meta_box( 'wpinv_discount_details', __( 'Discount Details', 'invoicing' ), 'GetPaid_Meta_Box_Discount_Details::output', 'wpi_discount', 'normal', 'high' );
57
-		}
33
+        // Rename metaboxes.
34
+        add_action( 'add_meta_boxes', 'GetPaid_Metaboxes::rename_meta_boxes', 45 );
58 35
 
59
-	}
36
+        // Save metaboxes.
37
+        add_action( 'save_post', 'GetPaid_Metaboxes::save_meta_boxes', 1, 2 );
38
+    }
60 39
 
61
-	/**
62
-	 * Register core metaboxes.
63
-	 */
64
-	protected static function add_payment_form_meta_boxes( $post_type ) {
40
+    /**
41
+     * Register core metaboxes.
42
+     */
43
+    public static function add_meta_boxes( $post_type, $post ) {
65 44
 
66
-		// For payment forms.
67
-		if ( $post_type == 'wpi_payment_form' ) {
45
+        // For invoices...
46
+        self::add_invoice_meta_boxes( $post_type, $post );
68 47
 
69
-			// Design payment form.
70
-			add_meta_box( 'wpinv-payment-form-design', __( 'Payment Form', 'invoicing' ), 'GetPaid_Meta_Box_Payment_Form::output', 'wpi_payment_form', 'normal' );
48
+        // For payment forms.
49
+        self::add_payment_form_meta_boxes( $post_type );
71 50
 
72
-			// Payment form information.
73
-			add_meta_box( 'wpinv-payment-form-info', __( 'Details', 'invoicing' ), 'GetPaid_Meta_Box_Payment_Form_Info::output', 'wpi_payment_form', 'side' );
51
+        // For invoice items.
52
+        self::add_item_meta_boxes( $post_type );
74 53
 
75
-		}
54
+        // For invoice discounts.
55
+        if ( $post_type == 'wpi_discount' ) {
56
+            add_meta_box( 'wpinv_discount_details', __( 'Discount Details', 'invoicing' ), 'GetPaid_Meta_Box_Discount_Details::output', 'wpi_discount', 'normal', 'high' );
57
+        }
76 58
 
77
-	}
59
+    }
78 60
 
79
-	/**
80
-	 * Register core metaboxes.
81
-	 */
82
-	protected static function add_item_meta_boxes( $post_type ) {
61
+    /**
62
+     * Register core metaboxes.
63
+     */
64
+    protected static function add_payment_form_meta_boxes( $post_type ) {
83 65
 
84
-		if ( $post_type == 'wpi_item' ) {
66
+        // For payment forms.
67
+        if ( $post_type == 'wpi_payment_form' ) {
85 68
 
86
-			// Item details.
87
-			add_meta_box( 'wpinv_item_details', __( 'Item Details', 'invoicing' ), 'GetPaid_Meta_Box_Item_Details::output', 'wpi_item', 'normal', 'high' );
69
+            // Design payment form.
70
+            add_meta_box( 'wpinv-payment-form-design', __( 'Payment Form', 'invoicing' ), 'GetPaid_Meta_Box_Payment_Form::output', 'wpi_payment_form', 'normal' );
88 71
 
89
-			// If taxes are enabled, register the tax metabox.
90
-			if ( wpinv_use_taxes() ) {
91
-				add_meta_box( 'wpinv_item_vat', __( 'Tax', 'invoicing' ), 'GetPaid_Meta_Box_Item_VAT::output', 'wpi_item', 'normal', 'high' );
92
-			}
72
+            // Payment form information.
73
+            add_meta_box( 'wpinv-payment-form-info', __( 'Details', 'invoicing' ), 'GetPaid_Meta_Box_Payment_Form_Info::output', 'wpi_payment_form', 'side' );
93 74
 
94
-			// Item info.
95
-			add_meta_box( 'wpinv_field_item_info', __( 'Item info', 'invoicing' ), 'GetPaid_Meta_Box_Item_Info::output', 'wpi_item', 'side', 'core' );
75
+        }
96 76
 
97
-		}
77
+    }
98 78
 
99
-	}
79
+    /**
80
+     * Register core metaboxes.
81
+     */
82
+    protected static function add_item_meta_boxes( $post_type ) {
100 83
 
101
-	/**
102
-	 * Register invoice metaboxes.
103
-	 */
104
-	protected static function add_invoice_meta_boxes( $post_type, $post ) {
84
+        if ( $post_type == 'wpi_item' ) {
105 85
 
106
-		// For invoices...
107
-		if ( getpaid_is_invoice_post_type( $post_type ) ) {
108
-			$invoice = new WPInv_Invoice( $post );
86
+            // Item details.
87
+            add_meta_box( 'wpinv_item_details', __( 'Item Details', 'invoicing' ), 'GetPaid_Meta_Box_Item_Details::output', 'wpi_item', 'normal', 'high' );
109 88
 
110
-			// Resend invoice.
111
-			if ( ! $invoice->is_draft() && ! $invoice->is_paid() ) {
89
+            // If taxes are enabled, register the tax metabox.
90
+            if ( wpinv_use_taxes() ) {
91
+                add_meta_box( 'wpinv_item_vat', __( 'Tax', 'invoicing' ), 'GetPaid_Meta_Box_Item_VAT::output', 'wpi_item', 'normal', 'high' );
92
+            }
112 93
 
113
-				add_meta_box(
114
-					'wpinv-mb-resend-invoice',
115
-					sprintf(
116
-						__( 'Resend %s', 'invoicing' ),
117
-						ucfirst( $invoice->get_invoice_quote_type() )
118
-					),
119
-					'GetPaid_Meta_Box_Resend_Invoice::output',
120
-					$post_type,
121
-					'side',
122
-					'low'
123
-				);
94
+            // Item info.
95
+            add_meta_box( 'wpinv_field_item_info', __( 'Item info', 'invoicing' ), 'GetPaid_Meta_Box_Item_Info::output', 'wpi_item', 'side', 'core' );
124 96
 
125
-			}
97
+        }
126 98
 
127
-			// Subscriptions.
128
-			$subscription = getpaid_get_invoice_subscription( $invoice );
129
-			if ( ! empty( $subscription ) ) {
130
-				add_meta_box( 'wpinv-mb-subscriptions', __( 'Subscription Details', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Subscription::output', $post_type, 'advanced' );
131
-				add_meta_box( 'wpinv-mb-subscription-invoices', __( 'Related Payments', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Subscription::output_invoices', $post_type, 'advanced' );
132
-			}
133
-
134
-			// Invoice details.
135
-			add_meta_box(
136
-				'wpinv-details',
137
-				sprintf(
138
-					__( '%s Details', 'invoicing' ),
139
-					ucfirst( $invoice->get_invoice_quote_type() )
140
-				),
141
-				'GetPaid_Meta_Box_Invoice_Details::output',
142
-				$post_type,
143
-				'side'
144
-			);
145
-
146
-			// Payment details.
147
-			if ( ! $invoice->is_draft() ) {
148
-				add_meta_box( 'wpinv-payment-meta', __( 'Payment Meta', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Payment_Meta::output', $post_type, 'side', 'default' );
149
-			}
99
+    }
150 100
 
151
-			// Billing details.
152
-			add_meta_box( 'wpinv-address', __( 'Billing Details', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Address::output', $post_type, 'normal', 'high' );
101
+    /**
102
+     * Register invoice metaboxes.
103
+     */
104
+    protected static function add_invoice_meta_boxes( $post_type, $post ) {
105
+
106
+        // For invoices...
107
+        if ( getpaid_is_invoice_post_type( $post_type ) ) {
108
+            $invoice = new WPInv_Invoice( $post );
109
+
110
+            // Resend invoice.
111
+            if ( ! $invoice->is_draft() && ! $invoice->is_paid() ) {
112
+
113
+                add_meta_box(
114
+                    'wpinv-mb-resend-invoice',
115
+                    sprintf(
116
+                        __( 'Resend %s', 'invoicing' ),
117
+                        ucfirst( $invoice->get_invoice_quote_type() )
118
+                    ),
119
+                    'GetPaid_Meta_Box_Resend_Invoice::output',
120
+                    $post_type,
121
+                    'side',
122
+                    'low'
123
+                );
124
+
125
+            }
126
+
127
+            // Subscriptions.
128
+            $subscription = getpaid_get_invoice_subscription( $invoice );
129
+            if ( ! empty( $subscription ) ) {
130
+                add_meta_box( 'wpinv-mb-subscriptions', __( 'Subscription Details', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Subscription::output', $post_type, 'advanced' );
131
+                add_meta_box( 'wpinv-mb-subscription-invoices', __( 'Related Payments', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Subscription::output_invoices', $post_type, 'advanced' );
132
+            }
133
+
134
+            // Invoice details.
135
+            add_meta_box(
136
+                'wpinv-details',
137
+                sprintf(
138
+                    __( '%s Details', 'invoicing' ),
139
+                    ucfirst( $invoice->get_invoice_quote_type() )
140
+                ),
141
+                'GetPaid_Meta_Box_Invoice_Details::output',
142
+                $post_type,
143
+                'side'
144
+            );
145
+
146
+            // Payment details.
147
+            if ( ! $invoice->is_draft() ) {
148
+                add_meta_box( 'wpinv-payment-meta', __( 'Payment Meta', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Payment_Meta::output', $post_type, 'side', 'default' );
149
+            }
150
+
151
+            // Billing details.
152
+            add_meta_box( 'wpinv-address', __( 'Billing Details', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Address::output', $post_type, 'normal', 'high' );
153 153
 			
154
-			// Invoice items.
155
-			add_meta_box(
156
-				'wpinv-items',
157
-				sprintf(
158
-					__( '%s Items', 'invoicing' ),
159
-					ucfirst( $invoice->get_invoice_quote_type() )
160
-				),
161
-				'GetPaid_Meta_Box_Invoice_Items::output',
162
-				$post_type,
163
-				'normal',
164
-				'high'
165
-			);
154
+            // Invoice items.
155
+            add_meta_box(
156
+                'wpinv-items',
157
+                sprintf(
158
+                    __( '%s Items', 'invoicing' ),
159
+                    ucfirst( $invoice->get_invoice_quote_type() )
160
+                ),
161
+                'GetPaid_Meta_Box_Invoice_Items::output',
162
+                $post_type,
163
+                'normal',
164
+                'high'
165
+            );
166 166
 			
167
-			// Invoice notes.
168
-			add_meta_box(
169
-				'wpinv-notes',
170
-				sprintf(
171
-					__( '%s Notes', 'invoicing' ),
172
-					ucfirst( $invoice->get_invoice_quote_type() )
173
-				),
174
-				'WPInv_Meta_Box_Notes::output',
175
-				$post_type,
176
-				'side',
177
-				'low'
178
-			);
179
-
180
-			// Shipping Address.
181
-			if ( get_post_meta( $invoice->get_id(), 'shipping_address', true ) ) {
182
-				add_meta_box( 'wpinv-invoice-shipping-details', __( 'Shipping Address', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Shipping_Address::output', $post_type, 'side', 'high' );
183
-			}
184
-
185
-			// Payment form information.
186
-			if ( get_post_meta( $invoice->get_id(), 'payment_form_data', true ) ) {
187
-				add_meta_box( 'wpinv-invoice-payment-form-details', __( 'Payment Form Details', 'invoicing' ), 'WPInv_Meta_Box_Payment_Form::output_details', $post_type, 'side', 'high' );
188
-			}
189
-
190
-		}
191
-
192
-	}
193
-
194
-	/**
195
-	 * Remove some metaboxes.
196
-	 */
197
-	public static function remove_meta_boxes() {
198
-		remove_meta_box( 'wpseo_meta', 'wpi_invoice', 'normal' );
199
-	}
200
-
201
-	/**
202
-	 * Rename other metaboxes.
203
-	 */
204
-	public static function rename_meta_boxes() {
167
+            // Invoice notes.
168
+            add_meta_box(
169
+                'wpinv-notes',
170
+                sprintf(
171
+                    __( '%s Notes', 'invoicing' ),
172
+                    ucfirst( $invoice->get_invoice_quote_type() )
173
+                ),
174
+                'WPInv_Meta_Box_Notes::output',
175
+                $post_type,
176
+                'side',
177
+                'low'
178
+            );
179
+
180
+            // Shipping Address.
181
+            if ( get_post_meta( $invoice->get_id(), 'shipping_address', true ) ) {
182
+                add_meta_box( 'wpinv-invoice-shipping-details', __( 'Shipping Address', 'invoicing' ), 'GetPaid_Meta_Box_Invoice_Shipping_Address::output', $post_type, 'side', 'high' );
183
+            }
184
+
185
+            // Payment form information.
186
+            if ( get_post_meta( $invoice->get_id(), 'payment_form_data', true ) ) {
187
+                add_meta_box( 'wpinv-invoice-payment-form-details', __( 'Payment Form Details', 'invoicing' ), 'WPInv_Meta_Box_Payment_Form::output_details', $post_type, 'side', 'high' );
188
+            }
189
+
190
+        }
191
+
192
+    }
193
+
194
+    /**
195
+     * Remove some metaboxes.
196
+     */
197
+    public static function remove_meta_boxes() {
198
+        remove_meta_box( 'wpseo_meta', 'wpi_invoice', 'normal' );
199
+    }
200
+
201
+    /**
202
+     * Rename other metaboxes.
203
+     */
204
+    public static function rename_meta_boxes() {
205 205
 		
206
-	}
207
-
208
-	/**
209
-	 * Check if we're saving, then trigger an action based on the post type.
210
-	 *
211
-	 * @param  int    $post_id Post ID.
212
-	 * @param  object $post Post object.
213
-	 */
214
-	public static function save_meta_boxes( $post_id, $post ) {
215
-		$post_id = absint( $post_id );
216
-		$data    = wp_unslash( $_POST );
217
-
218
-		// Do not save for ajax requests.
219
-		if ( ( defined( 'DOING_AJAX') && DOING_AJAX ) || isset( $_REQUEST['bulk_edit'] ) ) {
220
-			return;
221
-		}
222
-
223
-		// $post_id and $post are required
224
-		if ( empty( $post_id ) || empty( $post ) || self::$saved_meta_boxes ) {
225
-			return;
226
-		}
227
-
228
-		// Dont' save meta boxes for revisions or autosaves.
229
-		if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
230
-			return;
231
-		}
232
-
233
-		// Check the nonce.
234
-		if ( empty( $data['getpaid_meta_nonce'] ) || ! wp_verify_nonce( $data['getpaid_meta_nonce'], 'getpaid_meta_nonce' ) ) {
235
-			return;
236
-		}
237
-
238
-		// Check the post being saved == the $post_id to prevent triggering this call for other save_post events.
239
-		if ( empty( $data['post_ID'] ) || absint( $data['post_ID'] ) !== $post_id ) {
240
-			return;
241
-		}
242
-
243
-		// Check user has permission to edit.
244
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
245
-			return;
246
-		}
247
-
248
-		if ( getpaid_is_invoice_post_type( $post->post_type ) ) {
249
-
250
-			// We need this save event to run once to avoid potential endless loops.
251
-			self::$saved_meta_boxes = true;
252
-
253
-			return GetPaid_Meta_Box_Invoice_Address::save( $post_id );
254
-
255
-		}
256
-
257
-		// Ensure this is our post type.
258
-		$post_types_map = array(
259
-			'wpi_item'         => 'GetPaid_Meta_Box_Item_Details',
260
-			'wpi_payment_form' => 'GetPaid_Meta_Box_Payment_Form',
261
-			'wpi_discount'     => 'GetPaid_Meta_Box_Discount_Details',
262
-		);
263
-
264
-		// Is this our post type?
265
-		if ( ! isset( $post_types_map[ $post->post_type ] ) ) {
266
-			return;
267
-		}
268
-
269
-		// We need this save event to run once to avoid potential endless loops.
270
-		self::$saved_meta_boxes = true;
206
+    }
207
+
208
+    /**
209
+     * Check if we're saving, then trigger an action based on the post type.
210
+     *
211
+     * @param  int    $post_id Post ID.
212
+     * @param  object $post Post object.
213
+     */
214
+    public static function save_meta_boxes( $post_id, $post ) {
215
+        $post_id = absint( $post_id );
216
+        $data    = wp_unslash( $_POST );
217
+
218
+        // Do not save for ajax requests.
219
+        if ( ( defined( 'DOING_AJAX') && DOING_AJAX ) || isset( $_REQUEST['bulk_edit'] ) ) {
220
+            return;
221
+        }
222
+
223
+        // $post_id and $post are required
224
+        if ( empty( $post_id ) || empty( $post ) || self::$saved_meta_boxes ) {
225
+            return;
226
+        }
227
+
228
+        // Dont' save meta boxes for revisions or autosaves.
229
+        if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
230
+            return;
231
+        }
232
+
233
+        // Check the nonce.
234
+        if ( empty( $data['getpaid_meta_nonce'] ) || ! wp_verify_nonce( $data['getpaid_meta_nonce'], 'getpaid_meta_nonce' ) ) {
235
+            return;
236
+        }
237
+
238
+        // Check the post being saved == the $post_id to prevent triggering this call for other save_post events.
239
+        if ( empty( $data['post_ID'] ) || absint( $data['post_ID'] ) !== $post_id ) {
240
+            return;
241
+        }
242
+
243
+        // Check user has permission to edit.
244
+        if ( ! current_user_can( 'edit_post', $post_id ) ) {
245
+            return;
246
+        }
247
+
248
+        if ( getpaid_is_invoice_post_type( $post->post_type ) ) {
249
+
250
+            // We need this save event to run once to avoid potential endless loops.
251
+            self::$saved_meta_boxes = true;
252
+
253
+            return GetPaid_Meta_Box_Invoice_Address::save( $post_id );
254
+
255
+        }
256
+
257
+        // Ensure this is our post type.
258
+        $post_types_map = array(
259
+            'wpi_item'         => 'GetPaid_Meta_Box_Item_Details',
260
+            'wpi_payment_form' => 'GetPaid_Meta_Box_Payment_Form',
261
+            'wpi_discount'     => 'GetPaid_Meta_Box_Discount_Details',
262
+        );
263
+
264
+        // Is this our post type?
265
+        if ( ! isset( $post_types_map[ $post->post_type ] ) ) {
266
+            return;
267
+        }
268
+
269
+        // We need this save event to run once to avoid potential endless loops.
270
+        self::$saved_meta_boxes = true;
271 271
 		
272
-		// Save the post.
273
-		$class = $post_types_map[ $post->post_type ];
274
-		$class::save( $post_id, $_POST, $post );
272
+        // Save the post.
273
+        $class = $post_types_map[ $post->post_type ];
274
+        $class::save( $post_id, $_POST, $post );
275 275
 
276
-	}
276
+    }
277 277
 
278 278
 }
Please login to merge, or discard this patch.