Passed
Push — master ( 8bce0d...f3425f )
by Brian
12:59
created
includes/class-wpinv-ajax.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -14,70 +14,70 @@  discard block
 block discarded – undo
14 14
 class WPInv_Ajax {
15 15
 
16 16
     /**
17
-	 * Hook in ajax handlers.
18
-	 */
19
-	public static function init() {
20
-		add_action( 'init', array( __CLASS__, 'define_ajax' ), 0 );
21
-		add_action( 'template_redirect', array( __CLASS__, 'do_wpinv_ajax' ), 0 );
22
-		self::add_ajax_events();
17
+     * Hook in ajax handlers.
18
+     */
19
+    public static function init() {
20
+        add_action( 'init', array( __CLASS__, 'define_ajax' ), 0 );
21
+        add_action( 'template_redirect', array( __CLASS__, 'do_wpinv_ajax' ), 0 );
22
+        self::add_ajax_events();
23 23
     }
24 24
 
25 25
     /**
26
-	 * Set GetPaid AJAX constant and headers.
27
-	 */
28
-	public static function define_ajax() {
29
-
30
-		if ( ! empty( $_GET['wpinv-ajax'] ) ) {
31
-			getpaid_maybe_define_constant( 'DOING_AJAX', true );
32
-			getpaid_maybe_define_constant( 'WPInv_DOING_AJAX', true );
33
-			if ( ! WP_DEBUG || ( WP_DEBUG && ! WP_DEBUG_DISPLAY ) ) {
34
-				/** @scrutinizer ignore-unhandled */ @ini_set( 'display_errors', 0 );
35
-			}
36
-			$GLOBALS['wpdb']->hide_errors();
37
-		}
26
+     * Set GetPaid AJAX constant and headers.
27
+     */
28
+    public static function define_ajax() {
29
+
30
+        if ( ! empty( $_GET['wpinv-ajax'] ) ) {
31
+            getpaid_maybe_define_constant( 'DOING_AJAX', true );
32
+            getpaid_maybe_define_constant( 'WPInv_DOING_AJAX', true );
33
+            if ( ! WP_DEBUG || ( WP_DEBUG && ! WP_DEBUG_DISPLAY ) ) {
34
+                /** @scrutinizer ignore-unhandled */ @ini_set( 'display_errors', 0 );
35
+            }
36
+            $GLOBALS['wpdb']->hide_errors();
37
+        }
38 38
 
39 39
     }
40 40
 
41 41
     /**
42
-	 * Send headers for GetPaid Ajax Requests.
43
-	 *
44
-	 * @since 1.0.18
45
-	 */
46
-	private static function wpinv_ajax_headers() {
47
-		if ( ! headers_sent() ) {
48
-			send_origin_headers();
49
-			send_nosniff_header();
50
-			nocache_headers();
51
-			header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
52
-			header( 'X-Robots-Tag: noindex' );
53
-			status_header( 200 );
54
-		}
42
+     * Send headers for GetPaid Ajax Requests.
43
+     *
44
+     * @since 1.0.18
45
+     */
46
+    private static function wpinv_ajax_headers() {
47
+        if ( ! headers_sent() ) {
48
+            send_origin_headers();
49
+            send_nosniff_header();
50
+            nocache_headers();
51
+            header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
52
+            header( 'X-Robots-Tag: noindex' );
53
+            status_header( 200 );
54
+        }
55 55
     }
56 56
 
57 57
     /**
58
-	 * Check for GetPaid Ajax request and fire action.
59
-	 */
60
-	public static function do_wpinv_ajax() {
61
-		global $wp_query;
58
+     * Check for GetPaid Ajax request and fire action.
59
+     */
60
+    public static function do_wpinv_ajax() {
61
+        global $wp_query;
62 62
 
63
-		if ( ! empty( $_GET['wpinv-ajax'] ) ) {
64
-			$wp_query->set( 'wpinv-ajax', sanitize_text_field( wp_unslash( $_GET['wpinv-ajax'] ) ) );
65
-		}
63
+        if ( ! empty( $_GET['wpinv-ajax'] ) ) {
64
+            $wp_query->set( 'wpinv-ajax', sanitize_text_field( wp_unslash( $_GET['wpinv-ajax'] ) ) );
65
+        }
66 66
 
67
-		$action = $wp_query->get( 'wpinv-ajax' );
67
+        $action = $wp_query->get( 'wpinv-ajax' );
68 68
 
69
-		if ( $action ) {
70
-			self::wpinv_ajax_headers();
71
-			$action = sanitize_text_field( $action );
72
-			do_action( 'wpinv_ajax_' . $action );
73
-			wp_die();
74
-		}
69
+        if ( $action ) {
70
+            self::wpinv_ajax_headers();
71
+            $action = sanitize_text_field( $action );
72
+            do_action( 'wpinv_ajax_' . $action );
73
+            wp_die();
74
+        }
75 75
 
76 76
     }
77 77
 
78 78
     /**
79
-	 * Hook in ajax methods.
80
-	 */
79
+     * Hook in ajax methods.
80
+     */
81 81
     public static function add_ajax_events() {
82 82
 
83 83
         // array( 'event' => is_frontend )
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
         check_ajax_referer( 'getpaid_form_nonce' );
262 262
 
263 263
         // Is the request set up correctly?
264
-		if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) && empty( $_GET['invoice'] ) ) {
265
-			aui()->alert(
266
-				array(
267
-					'type'    => 'warning',
268
-					'content' => __( 'No payment form or item provided', 'invoicing' ),
264
+        if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) && empty( $_GET['invoice'] ) ) {
265
+            aui()->alert(
266
+                array(
267
+                    'type'    => 'warning',
268
+                    'content' => __( 'No payment form or item provided', 'invoicing' ),
269 269
                 ),
270 270
                 true
271 271
             );
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
         }
274 274
 
275 275
         // Payment form or button?
276
-		if ( ! empty( $_GET['form'] ) ) {
276
+        if ( ! empty( $_GET['form'] ) ) {
277 277
             $form = sanitize_text_field( urldecode( $_GET['form'] ) );
278 278
 
279 279
             if ( false !== strpos( $form, '|' ) ) {
@@ -326,10 +326,10 @@  discard block
 block discarded – undo
326 326
                 getpaid_display_payment_form( $form );
327 327
             }
328 328
 } elseif ( ! empty( $_GET['invoice'] ) ) {
329
-		    getpaid_display_invoice_payment_form( (int) urldecode( $_GET['invoice'] ) );
329
+            getpaid_display_invoice_payment_form( (int) urldecode( $_GET['invoice'] ) );
330 330
         } else {
331
-			$items = getpaid_convert_items_to_array( sanitize_text_field( urldecode( $_GET['item'] ) ) );
332
-		    getpaid_display_item_payment_form( $items );
331
+            $items = getpaid_convert_items_to_array( sanitize_text_field( urldecode( $_GET['item'] ) ) );
332
+            getpaid_display_item_payment_form( $items );
333 333
         }
334 334
 
335 335
         exit;
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
         if ( is_wp_error( $error ) ) {
650 650
             $alert = $error->get_error_message();
651 651
             wp_send_json_success( compact( 'alert' ) );
652
-         }
652
+            }
653 653
 
654 654
         // Update totals.
655 655
         $invoice->recalculate_total();
@@ -1084,12 +1084,12 @@  discard block
 block discarded – undo
1084 1084
     }
1085 1085
 
1086 1086
     /**
1087
-	 * Handles file uploads.
1088
-	 *
1089
-	 * @since       1.0.0
1090
-	 * @return      void
1091
-	 */
1092
-	public static function file_upload() {
1087
+     * Handles file uploads.
1088
+     *
1089
+     * @since       1.0.0
1090
+     * @return      void
1091
+     */
1092
+    public static function file_upload() {
1093 1093
 
1094 1094
         // Check nonce.
1095 1095
         check_ajax_referer( 'getpaid_form_nonce' );
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
 
1151 1151
         wp_send_json_success( $response );
1152 1152
 
1153
-	}
1153
+    }
1154 1154
 
1155 1155
 }
1156 1156
 
Please login to merge, or discard this patch.
templates/invoice/fee-item.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -31,21 +31,21 @@  discard block
 block discarded – undo
31 31
                     // Item name.
32 32
                     if ( 'name' == $column ) {
33 33
 
34
-					// Display the name.
35
-					echo '<div class="mb-1">' . esc_html( $fee['name'] ) . '</div>';
34
+                    // Display the name.
35
+                    echo '<div class="mb-1">' . esc_html( $fee['name'] ) . '</div>';
36 36
 
37
-					// And an optional description.
38
-					$description = empty( $fee['description'] ) ? esc_html__( 'Fee', 'invoicing' ) : esc_html( $fee['description'] );
39
-					echo wp_kses_post( "<small class='form-text text-muted pr-2 m-0'>$description</small>" );
37
+                    // And an optional description.
38
+                    $description = empty( $fee['description'] ) ? esc_html__( 'Fee', 'invoicing' ) : esc_html( $fee['description'] );
39
+                    echo wp_kses_post( "<small class='form-text text-muted pr-2 m-0'>$description</small>" );
40 40
 
41 41
                     }
42 42
 
43 43
                     // Item price.
44 44
                     if ( 'price' == $column ) {
45 45
 
46
-					// Display the item price (or recurring price if this is a renewal invoice)
47
-					if ( $invoice->is_recurring() && $invoice->is_renewal() ) {
48
-						wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() );
46
+                    // Display the item price (or recurring price if this is a renewal invoice)
47
+                    if ( $invoice->is_recurring() && $invoice->is_renewal() ) {
48
+                        wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() );
49 49
                         } else {
50 50
                             wpinv_the_price( $fee['initial_fee'], $invoice->get_currency() );
51 51
                         }
@@ -53,20 +53,20 @@  discard block
 block discarded – undo
53 53
 
54 54
                     // Item quantity.
55 55
                     if ( 'quantity' == $column ) {
56
-					echo '&mdash;';
56
+                    echo '&mdash;';
57 57
                     }
58 58
 
59 59
                     // Item tax.
60 60
                     if ( 'tax_rate' == $column ) {
61
-					echo '&mdash;';
61
+                    echo '&mdash;';
62 62
                     }
63 63
 
64 64
                     // Item sub total.
65 65
                     if ( 'subtotal' == $column ) {
66 66
 
67
-					// Display the item price (or recurring price if this is a renewal invoice)
68
-					if ( $invoice->is_recurring() && $invoice->is_renewal() ) {
69
-						wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() );
67
+                    // Display the item price (or recurring price if this is a renewal invoice)
68
+                    if ( $invoice->is_recurring() && $invoice->is_renewal() ) {
69
+                        wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() );
70 70
                         } else {
71 71
                             wpinv_the_price( $fee['initial_fee'], $invoice->get_currency() );
72 72
                         }
Please login to merge, or discard this patch.
templates/payment-forms/elements/gateway_select.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,8 +64,8 @@
 block discarded – undo
64 64
                         $description = wpinv_get_gateway_description( $gateway );
65 65
 
66 66
                         if ( wpinv_is_test_mode( $gateway ) ) {
67
-						$sandbox_notice = apply_filters( "getpaid_{$gateway}_sandbox_notice", __( 'SANDBOX ENABLED: No real payments will occur.', 'invoicing' ) );
68
-						$description = "$description $sandbox_notice";
67
+                        $sandbox_notice = apply_filters( "getpaid_{$gateway}_sandbox_notice", __( 'SANDBOX ENABLED: No real payments will occur.', 'invoicing' ) );
68
+                        $description = "$description $sandbox_notice";
69 69
                         }
70 70
 
71 71
                         echo wp_kses_post( wpautop( $description ) );
Please login to merge, or discard this patch.
templates/payment-forms/cart-totals.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -11,26 +11,26 @@  discard block
 block discarded – undo
11 11
 
12 12
 // Totals rows.
13 13
 $totals = apply_filters(
14
-	'getpaid_payment_form_cart_table_totals',
15
-	array(
16
-		'subtotal' => __( 'Subtotal', 'invoicing' ),
17
-		'tax'      => __( 'Tax', 'invoicing' ),
18
-		'fees'     => __( 'Fee', 'invoicing' ),
19
-		'discount' => __( 'Discount', 'invoicing' ),
20
-		'total'    => __( 'Total', 'invoicing' ),
21
-	),
22
-	$form
14
+    'getpaid_payment_form_cart_table_totals',
15
+    array(
16
+        'subtotal' => __( 'Subtotal', 'invoicing' ),
17
+        'tax'      => __( 'Tax', 'invoicing' ),
18
+        'fees'     => __( 'Fee', 'invoicing' ),
19
+        'discount' => __( 'Discount', 'invoicing' ),
20
+        'total'    => __( 'Total', 'invoicing' ),
21
+    ),
22
+    $form
23 23
 );
24 24
 
25 25
 $currency = $form->get_currency();
26 26
 $country  = wpinv_get_default_country();
27 27
 
28 28
 if ( ! empty( $form->invoice ) ) {
29
-	$country  = $form->invoice->get_country();
29
+    $country  = $form->invoice->get_country();
30 30
 }
31 31
 
32 32
 if ( ! wpinv_use_taxes() && isset( $totals['tax'] ) ) {
33
-	unset( $totals['tax'] );
33
+    unset( $totals['tax'] );
34 34
 }
35 35
 
36 36
 do_action( 'getpaid_before_payment_form_cart_totals', $form, $totals );
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
 
62 62
 							<?php
63 63
 
64
-								// Total tax.
65
-								if ( in_array( $key, array( 'tax', 'discount', 'subtotal', 'total', 'fees' ) ) ) {
66
-								wpinv_the_price( 0, $currency );
67
-								}
64
+                                // Total tax.
65
+                                if ( in_array( $key, array( 'tax', 'discount', 'subtotal', 'total', 'fees' ) ) ) {
66
+                                wpinv_the_price( 0, $currency );
67
+                                }
68 68
 
69
-								do_action( "getpaid_payment_form_cart_totals_$key", $form );
70
-							?>
69
+                                do_action( "getpaid_payment_form_cart_totals_$key", $form );
70
+                            ?>
71 71
 
72 72
 						</div>
73 73
 
Please login to merge, or discard this patch.
templates/emails/invoice-item.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -30,40 +30,40 @@
 block discarded – undo
30 30
                 // Item name.
31 31
                 if ( 'name' == $column ) {
32 32
 
33
-				// Display the name.
34
-				echo '<div class="wpinv_email_cart_item_title">' . esc_html( $item->get_name() ) . '</div>';
33
+                // Display the name.
34
+                echo '<div class="wpinv_email_cart_item_title">' . esc_html( $item->get_name() ) . '</div>';
35 35
 
36
-				// And an optional description.
37
-				$description = $item->get_description();
36
+                // And an optional description.
37
+                $description = $item->get_description();
38 38
 
39
-				if ( ! empty( $description ) ) {
40
-					echo "<p class='small'>" . wp_kses_post( $description ) . "</p>";
39
+                if ( ! empty( $description ) ) {
40
+                    echo "<p class='small'>" . wp_kses_post( $description ) . "</p>";
41 41
                     }
42 42
 }
43 43
 
44 44
                 // Item price.
45 45
                 if ( 'price' == $column ) {
46 46
 
47
-				// Display the item price (or recurring price if this is a renewal invoice)
48
-				$price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price();
49
-				wpinv_the_price( $price, $invoice->get_currency() );
47
+                // Display the item price (or recurring price if this is a renewal invoice)
48
+                $price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price();
49
+                wpinv_the_price( $price, $invoice->get_currency() );
50 50
 
51 51
                 }
52 52
 
53 53
                 // Item quantity.
54 54
                 if ( 'quantity' == $column ) {
55
-				echo (float) $item->get_quantity();
55
+                echo (float) $item->get_quantity();
56 56
                 }
57 57
 
58 58
                 // Tax rate.
59 59
                 if ( 'tax_rate' == $column ) {
60
-				echo floatval( round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%';
60
+                echo floatval( round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%';
61 61
                 }
62 62
 
63 63
                 // Item sub total.
64 64
                 if ( 'subtotal' == $column ) {
65
-				$subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total();
66
-				wpinv_the_price( $subtotal, $invoice->get_currency() );
65
+                $subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total();
66
+                wpinv_the_price( $subtotal, $invoice->get_currency() );
67 67
                 }
68 68
 
69 69
                 // Fires when printing a line item column.
Please login to merge, or discard this patch.
templates/emails/fee-item.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -30,21 +30,21 @@  discard block
 block discarded – undo
30 30
                 // Item name.
31 31
                 if ( 'name' == $column ) {
32 32
 
33
-				// Display the name.
34
-				echo '<div class="wpinv_email_cart_item_title">' . esc_html( $fee['name'] ) . '</div>';
33
+                // Display the name.
34
+                echo '<div class="wpinv_email_cart_item_title">' . esc_html( $fee['name'] ) . '</div>';
35 35
 
36
-				// And an optional description.
37
-				$description = empty( $fee['description'] ) ? esc_html__( 'Fee', 'invoicing' ) : esc_html( $fee['description'] );
38
-				echo wp_kses_post( "<p class='small'>$description</p>" );
36
+                // And an optional description.
37
+                $description = empty( $fee['description'] ) ? esc_html__( 'Fee', 'invoicing' ) : esc_html( $fee['description'] );
38
+                echo wp_kses_post( "<p class='small'>$description</p>" );
39 39
 
40 40
                 }
41 41
 
42 42
                 // Item price.
43 43
                 if ( 'price' == $column ) {
44 44
 
45
-				// Display the item price (or recurring price if this is a renewal invoice)
46
-				if ( $invoice->is_recurring() && $invoice->is_renewal() ) {
47
-					wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() );
45
+                // Display the item price (or recurring price if this is a renewal invoice)
46
+                if ( $invoice->is_recurring() && $invoice->is_renewal() ) {
47
+                    wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() );
48 48
                     } else {
49 49
                         wpinv_the_price( $fee['initial_fee'], $invoice->get_currency() );
50 50
                     }
@@ -52,18 +52,18 @@  discard block
 block discarded – undo
52 52
 
53 53
                 // Item quantity.
54 54
                 if ( 'quantity' == $column ) {
55
-				echo '&mdash;';
55
+                echo '&mdash;';
56 56
                 }
57 57
 
58 58
                 // Item tax.
59 59
                 if ( 'tax_rate' == $column ) {
60
-				echo '&mdash;';
60
+                echo '&mdash;';
61 61
                 }
62 62
 
63 63
                 // Item sub total.
64 64
                 if ( 'subtotal' == $column ) {
65
-				if ( $invoice->is_recurring() && $invoice->is_renewal() ) {
66
-					wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() );
65
+                if ( $invoice->is_recurring() && $invoice->is_renewal() ) {
66
+                    wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() );
67 67
                 } else {
68 68
                     wpinv_the_price( $fee['initial_fee'], $invoice->get_currency() );
69 69
                 }
Please login to merge, or discard this patch.
templates/invoice-receipt.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -126,25 +126,25 @@
 block discarded – undo
126 126
 
127 127
             if ( ! empty( $invoice_actions ) ) {
128 128
 
129
-			echo '<div class="wpinv-receipt-actions text-right mt-1 mb-4">';
129
+            echo '<div class="wpinv-receipt-actions text-right mt-1 mb-4">';
130 130
 
131
-			foreach ( $invoice_actions as $key => $invoice_action ) {
131
+            foreach ( $invoice_actions as $key => $invoice_action ) {
132 132
 
133
-				$key    = sanitize_html_class( $key );
134
-				$class  = empty( $invoice_action['class'] ) ? 'btn-dark' : sanitize_html_class( $invoice_action['class'] );
135
-				$url    = empty( $invoice_action['url'] ) ? '#' : esc_url( $invoice_action['url'] );
136
-				$attrs  = empty( $invoice_action['attrs'] ) ? '' : $invoice_action['attrs'];
137
-				$anchor = esc_html( $invoice_action['name'] );
133
+                $key    = sanitize_html_class( $key );
134
+                $class  = empty( $invoice_action['class'] ) ? 'btn-dark' : sanitize_html_class( $invoice_action['class'] );
135
+                $url    = empty( $invoice_action['url'] ) ? '#' : esc_url( $invoice_action['url'] );
136
+                $attrs  = empty( $invoice_action['attrs'] ) ? '' : $invoice_action['attrs'];
137
+                $anchor = esc_html( $invoice_action['name'] );
138 138
 
139
-				echo wp_kses_post( "<a href='$url' class='btn btn-sm ml-1 $class $key' $attrs>$anchor</a>" );
139
+                echo wp_kses_post( "<a href='$url' class='btn btn-sm ml-1 $class $key' $attrs>$anchor</a>" );
140 140
                 }
141 141
 
142
-			echo '</div>';
142
+            echo '</div>';
143 143
 
144 144
             }
145 145
 
146 146
             if ( ! empty( $alert ) ) {
147
-			echo wp_kses_post( $alert );
147
+            echo wp_kses_post( $alert );
148 148
             }
149 149
 
150 150
         ?>
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-invoice-address.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 if ( ! defined( 'ABSPATH' ) ) {
11
-	exit; // Exit if accessed directly
11
+    exit; // Exit if accessed directly
12 12
 }
13 13
 
14 14
 /**
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 class GetPaid_Meta_Box_Invoice_Address {
18 18
 
19 19
     /**
20
-	 * Output the metabox.
21
-	 *
22
-	 * @param WP_Post $post
23
-	 */
20
+     * Output the metabox.
21
+     *
22
+     * @param WP_Post $post
23
+     */
24 24
     public static function output( $post ) {
25 25
 
26 26
         // Prepare the invoice.
@@ -225,37 +225,37 @@  discard block
 block discarded – undo
225 225
 
226 226
                                 if ( empty( $states ) ) {
227 227
 
228
-								aui()->input(
229
-								array(
230
-								'type'        => 'text',
231
-								'id'          => 'wpinv_state',
232
-								'name'        => 'wpinv_state',
233
-								'label'       => __( 'State', 'invoicing' ),
234
-								'label_type'  => 'vertical',
235
-								'placeholder' => '',
236
-								'class'       => 'form-control-sm',
237
-								'value'       => $invoice->get_state( 'edit' ),
238
-								),
239
-								true
240
-							);
228
+                                aui()->input(
229
+                                array(
230
+                                'type'        => 'text',
231
+                                'id'          => 'wpinv_state',
232
+                                'name'        => 'wpinv_state',
233
+                                'label'       => __( 'State', 'invoicing' ),
234
+                                'label_type'  => 'vertical',
235
+                                'placeholder' => '',
236
+                                'class'       => 'form-control-sm',
237
+                                'value'       => $invoice->get_state( 'edit' ),
238
+                                ),
239
+                                true
240
+                            );
241 241
 
242 242
                                 } else {
243 243
 
244
-								aui()->select(
245
-								array(
246
-								'id'               => 'wpinv_state',
247
-								'name'             => 'wpinv_state',
248
-								'label'            => __( 'State', 'invoicing' ),
249
-								'label_type'       => 'vertical',
250
-								'placeholder'      => __( 'Select a state', 'invoicing' ),
251
-								'class'            => 'form-control-sm',
252
-								'value'            => $invoice->get_state( 'edit' ),
253
-								'options'          => $states,
254
-								'data-allow-clear' => 'false',
255
-								'select2'          => true,
256
-								),
257
-								true
258
-								);
244
+                                aui()->select(
245
+                                array(
246
+                                'id'               => 'wpinv_state',
247
+                                'name'             => 'wpinv_state',
248
+                                'label'            => __( 'State', 'invoicing' ),
249
+                                'label_type'       => 'vertical',
250
+                                'placeholder'      => __( 'Select a state', 'invoicing' ),
251
+                                'class'            => 'form-control-sm',
252
+                                'value'            => $invoice->get_state( 'edit' ),
253
+                                'options'          => $states,
254
+                                'data-allow-clear' => 'false',
255
+                                'select2'          => true,
256
+                                ),
257
+                                true
258
+                                );
259 259
 
260 260
                                 }
261 261
 
@@ -381,18 +381,18 @@  discard block
 block discarded – undo
381 381
     }
382 382
 
383 383
     /**
384
-	 * Save meta box data.
385
-	 *
386
-	 * @param int $post_id
387
-	 */
388
-	public static function save( $post_id ) {
384
+     * Save meta box data.
385
+     *
386
+     * @param int $post_id
387
+     */
388
+    public static function save( $post_id ) {
389 389
 
390 390
         // Prepare the invoice.
391 391
         $invoice = new WPInv_Invoice( $post_id );
392 392
 
393 393
         // Load new data.
394 394
         $invoice->set_props(
395
-			array(
395
+            array(
396 396
                 'template'       => isset( $_POST['wpinv_template'] ) ? wpinv_clean( $_POST['wpinv_template'] ) : null,
397 397
                 'email_cc'       => isset( $_POST['wpinv_cc'] ) ? wpinv_clean( $_POST['wpinv_cc'] ) : null,
398 398
                 'disable_taxes'  => ! empty( $_POST['disable_taxes'] ),
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
                 'due_date'       => isset( $_POST['wpinv_due_date'] ) ? wpinv_clean( $_POST['wpinv_due_date'] ) : null,
416 416
                 'number'         => isset( $_POST['wpinv_number'] ) ? wpinv_clean( $_POST['wpinv_number'] ) : null,
417 417
                 'status'         => isset( $_POST['wpinv_status'] ) ? wpinv_clean( $_POST['wpinv_status'] ) : null,
418
-			)
418
+            )
419 419
         );
420 420
 
421 421
         // Discount code.
@@ -471,6 +471,6 @@  discard block
 block discarded – undo
471 471
         }
472 472
 
473 473
         // Fires after an invoice is saved.
474
-		do_action( 'wpinv_invoice_metabox_saved', $invoice );
475
-	}
474
+        do_action( 'wpinv_invoice_metabox_saved', $invoice );
475
+    }
476 476
 }
Please login to merge, or discard this patch.
includes/wpinv-address-functions.php 1 patch
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
 
14 14
 
15 15
 function wpinv_get_default_country() {
16
-	$country = wpinv_get_option( 'default_country', 'UK' );
16
+    $country = wpinv_get_option( 'default_country', 'UK' );
17 17
 
18
-	return apply_filters( 'wpinv_default_country', $country );
18
+    return apply_filters( 'wpinv_default_country', $country );
19 19
 }
20 20
 
21 21
 /**
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
  */
37 37
 function wpinv_sanitize_country( $country ) {
38 38
 
39
-	// Enure the country is specified
39
+    // Enure the country is specified
40 40
     if ( empty( $country ) ) {
41 41
         $country = wpinv_get_default_country();
42 42
     }
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 }
67 67
 
68 68
 function wpinv_get_default_state() {
69
-	$state = wpinv_get_option( 'default_state', '' );
69
+    $state = wpinv_get_option( 'default_state', '' );
70 70
 
71
-	return apply_filters( 'wpinv_default_state', $state );
71
+    return apply_filters( 'wpinv_default_state', $state );
72 72
 }
73 73
 
74 74
 function wpinv_state_name( $state_code = '', $country_code = '' ) {
@@ -303,11 +303,11 @@  discard block
 block discarded – undo
303 303
 
304 304
     $country = wpinv_sanitize_country( $country );
305 305
 
306
-	foreach ( wpinv_get_continents( 'countries' ) as $continent_code => $countries ) {
307
-		if ( false !== array_search( $country, $countries, true ) ) {
308
-			return $continent_code;
309
-		}
310
-	}
306
+    foreach ( wpinv_get_continents( 'countries' ) as $continent_code => $countries ) {
307
+        if ( false !== array_search( $country, $countries, true ) ) {
308
+            return $continent_code;
309
+        }
310
+    }
311 311
 
312 312
     return '';
313 313
 
@@ -599,31 +599,31 @@  discard block
 block discarded – undo
599 599
 }
600 600
 
601 601
 function wpinv_get_states_field() {
602
-	if ( empty( $_POST['country'] ) ) {
603
-		$_POST['country'] = wpinv_get_default_country();
604
-	}
605
-	$states = wpinv_get_country_states( sanitize_text_field( $_POST['country'] ) );
602
+    if ( empty( $_POST['country'] ) ) {
603
+        $_POST['country'] = wpinv_get_default_country();
604
+    }
605
+    $states = wpinv_get_country_states( sanitize_text_field( $_POST['country'] ) );
606 606
 
607
-	if ( ! empty( $states ) ) {
608
-		$sanitized_field_name = sanitize_text_field( $_POST['field_name'] );
607
+    if ( ! empty( $states ) ) {
608
+        $sanitized_field_name = sanitize_text_field( $_POST['field_name'] );
609 609
 
610 610
         $class  = isset( $_POST['class'] ) ? esc_attr( sanitize_text_field( $_POST['class'] ) ) : '';
611 611
         $class .= " $sanitized_field_name getpaid_js_field-state custom-select wpinv-select wpi_select2";
612 612
 
613 613
         $args  = array(
614
-			'name'             => $sanitized_field_name,
615
-			'id'               => $sanitized_field_name,
616
-			'class'            => implode( ' ', array_unique( explode( ' ', $class ) ) ),
617
-			'options'          => array_merge( array( '' => '' ), $states ),
618
-			'show_option_all'  => false,
619
-			'show_option_none' => false,
620
-		);
621
-
622
-		wpinv_html_select( $args );
623
-
624
-	} else {
625
-		echo 'nostates';
626
-	}
614
+            'name'             => $sanitized_field_name,
615
+            'id'               => $sanitized_field_name,
616
+            'class'            => implode( ' ', array_unique( explode( ' ', $class ) ) ),
617
+            'options'          => array_merge( array( '' => '' ), $states ),
618
+            'show_option_all'  => false,
619
+            'show_option_none' => false,
620
+        );
621
+
622
+        wpinv_html_select( $args );
623
+
624
+    } else {
625
+        echo 'nostates';
626
+    }
627 627
 
628 628
 }
629 629
 
@@ -642,47 +642,47 @@  discard block
 block discarded – undo
642 642
  */
643 643
 function wpinv_get_address_formats() {
644 644
 
645
-		return apply_filters(
645
+        return apply_filters(
646 646
             'wpinv_localisation_address_formats',
647
-			array(
648
-				'default' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}}\n{{zip}}\n{{country}}",
649
-				'AU'      => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}} {{zip}}\n{{country}}",
650
-				'AT'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
651
-				'BE'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
652
-				'CA'      => "{{company}}\n{{name}}\n{{address}}\n{{city}} {{state_code}}&nbsp;&nbsp;{{zip}}\n{{country}}",
653
-				'CH'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
654
-				'CL'      => "{{company}}\n{{name}}\n{{address}}\n{{state}}\n{{zip}} {{city}}\n{{country}}",
655
-				'CN'      => "{{country}} {{zip}}\n{{state}}, {{city}}, {{address}}\n{{company}}\n{{name}}",
656
-				'CZ'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
657
-				'DE'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
658
-				'EE'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
659
-				'FI'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
660
-				'DK'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
661
-				'FR'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city_upper}}\n{{country}}",
662
-				'HK'      => "{{company}}\n{{first_name}} {{last_name_upper}}\n{{address}}\n{{city_upper}}\n{{state_upper}}\n{{country}}",
663
-				'HU'      => "{{name}}\n{{company}}\n{{city}}\n{{address}}\n{{zip}}\n{{country}}",
664
-				'IN'      => "{{company}}\n{{name}}\n{{address}}\n{{city}} {{zip}}\n{{state}}, {{country}}",
665
-				'IS'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
666
-				'IT'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}}\n{{city}}\n{{state_upper}}\n{{country}}",
667
-				'JP'      => "{{zip}}\n{{state}} {{city}} {{address}}\n{{company}}\n{{last_name}} {{first_name}}\n{{country}}",
668
-				'TW'      => "{{company}}\n{{last_name}} {{first_name}}\n{{address}}\n{{state}}, {{city}} {{zip}}\n{{country}}",
669
-				'LI'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
670
-				'NL'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
671
-				'NZ'      => "{{name}}\n{{company}}\n{{address}}\n{{city}} {{zip}}\n{{country}}",
672
-				'NO'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
673
-				'PL'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
674
-				'PT'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
675
-				'SK'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
676
-				'RS'      => "{{name}}\n{{company}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
677
-				'SI'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
678
-				'ES'      => "{{name}}\n{{company}}\n{{address}}\n{{zip}} {{city}}\n{{state}}\n{{country}}",
679
-				'SE'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
680
-				'TR'      => "{{name}}\n{{company}}\n{{address}}\n{{zip}} {{city}} {{state}}\n{{country}}",
681
-				'UG'      => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}}, {{country}}",
682
-				'US'      => "{{name}}\n{{company}}\n{{address}}\n{{city}}, {{state_code}} {{zip}}\n{{country}}",
683
-				'VN'      => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{country}}",
684
-			)
685
-		);
647
+            array(
648
+                'default' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}}\n{{zip}}\n{{country}}",
649
+                'AU'      => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}} {{zip}}\n{{country}}",
650
+                'AT'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
651
+                'BE'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
652
+                'CA'      => "{{company}}\n{{name}}\n{{address}}\n{{city}} {{state_code}}&nbsp;&nbsp;{{zip}}\n{{country}}",
653
+                'CH'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
654
+                'CL'      => "{{company}}\n{{name}}\n{{address}}\n{{state}}\n{{zip}} {{city}}\n{{country}}",
655
+                'CN'      => "{{country}} {{zip}}\n{{state}}, {{city}}, {{address}}\n{{company}}\n{{name}}",
656
+                'CZ'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
657
+                'DE'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
658
+                'EE'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
659
+                'FI'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
660
+                'DK'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
661
+                'FR'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city_upper}}\n{{country}}",
662
+                'HK'      => "{{company}}\n{{first_name}} {{last_name_upper}}\n{{address}}\n{{city_upper}}\n{{state_upper}}\n{{country}}",
663
+                'HU'      => "{{name}}\n{{company}}\n{{city}}\n{{address}}\n{{zip}}\n{{country}}",
664
+                'IN'      => "{{company}}\n{{name}}\n{{address}}\n{{city}} {{zip}}\n{{state}}, {{country}}",
665
+                'IS'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
666
+                'IT'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}}\n{{city}}\n{{state_upper}}\n{{country}}",
667
+                'JP'      => "{{zip}}\n{{state}} {{city}} {{address}}\n{{company}}\n{{last_name}} {{first_name}}\n{{country}}",
668
+                'TW'      => "{{company}}\n{{last_name}} {{first_name}}\n{{address}}\n{{state}}, {{city}} {{zip}}\n{{country}}",
669
+                'LI'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
670
+                'NL'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
671
+                'NZ'      => "{{name}}\n{{company}}\n{{address}}\n{{city}} {{zip}}\n{{country}}",
672
+                'NO'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
673
+                'PL'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
674
+                'PT'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
675
+                'SK'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
676
+                'RS'      => "{{name}}\n{{company}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
677
+                'SI'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
678
+                'ES'      => "{{name}}\n{{company}}\n{{address}}\n{{zip}} {{city}}\n{{state}}\n{{country}}",
679
+                'SE'      => "{{company}}\n{{name}}\n{{address}}\n{{zip}} {{city}}\n{{country}}",
680
+                'TR'      => "{{name}}\n{{company}}\n{{address}}\n{{zip}} {{city}} {{state}}\n{{country}}",
681
+                'UG'      => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}}, {{country}}",
682
+                'US'      => "{{name}}\n{{company}}\n{{address}}\n{{city}}, {{state_code}} {{zip}}\n{{country}}",
683
+                'VN'      => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{country}}",
684
+            )
685
+        );
686 686
 }
687 687
 
688 688
 /**
@@ -699,21 +699,21 @@  discard block
 block discarded – undo
699 699
     }
700 700
 
701 701
     // Get all formats.
702
-	$formats = wpinv_get_address_formats();
702
+    $formats = wpinv_get_address_formats();
703 703
 
704
-	// Get format for the specified country.
705
-	$format = ( $country && isset( $formats[ $country ] ) ) ? $formats[ $country ] : $formats['default'];
704
+    // Get format for the specified country.
705
+    $format = ( $country && isset( $formats[ $country ] ) ) ? $formats[ $country ] : $formats['default'];
706 706
 
707 707
     /**
708
-	 * Filters the address format to use on Invoices.
708
+     * Filters the address format to use on Invoices.
709 709
      *
710 710
      * New lines will be replaced by a `br` element. Double new lines will be replaced by a paragraph. HTML tags are allowed.
711
-	 *
712
-	 * @since 1.0.13
713
-	 *
714
-	 * @param string $format  The address format to use.
711
+     *
712
+     * @since 1.0.13
713
+     *
714
+     * @param string $format  The address format to use.
715 715
      * @param string $country The country who's address format is being retrieved.
716
-	 */
716
+     */
717 717
     return apply_filters( 'wpinv_get_full_address_format', $format, $country );
718 718
 }
719 719
 
@@ -734,8 +734,8 @@  discard block
 block discarded – undo
734 734
         'country'    => '',
735 735
         'zip'        => '',
736 736
         'first_name' => '',
737
-		'last_name'  => '',
738
-		'company'    => '',
737
+        'last_name'  => '',
738
+        'company'    => '',
739 739
     );
740 740
 
741 741
     $args    = map_deep( wp_parse_args( $billing_details, $default_args ), 'trim' );
@@ -756,14 +756,14 @@  discard block
 block discarded – undo
756 756
     $args['country_code'] = $country;
757 757
 
758 758
     /**
759
-	 * Filters the address format replacements to use on Invoices.
759
+     * Filters the address format replacements to use on Invoices.
760
+     *
761
+     *
762
+     * @since 1.0.13
760 763
      *
761
-	 *
762
-	 * @since 1.0.13
763
-	 *
764
-	 * @param array $replacements  The address replacements to use.
764
+     * @param array $replacements  The address replacements to use.
765 765
      * @param array $billing_details  The billing details to use.
766
-	 */
766
+     */
767 767
     $replacements = apply_filters( 'wpinv_get_invoice_address_replacements', $args, $billing_details );
768 768
 
769 769
     $return = array();
@@ -786,5 +786,5 @@  discard block
 block discarded – undo
786 786
  * @return string
787 787
  */
788 788
 function wpinv_trim_formatted_address_line( $line ) {
789
-	return trim( $line, ', ' );
789
+    return trim( $line, ', ' );
790 790
 }
Please login to merge, or discard this patch.