Passed
Push — master ( 305ace...b57ad0 )
by Brian
06:03
created
templates/wpinv-invoice-print.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,20 +7,20 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 // Fetch the invoice.
13
-if ( empty( $invoice ) ) {
14
-    $invoice = new WPInv_Invoice( $GLOBALS['post'] );
13
+if (empty($invoice)) {
14
+    $invoice = new WPInv_Invoice($GLOBALS['post']);
15 15
 }
16 16
 
17 17
 // Abort if it does not exist.
18
-if ( $invoice->get_id() == 0 ) {
18
+if ($invoice->get_id() == 0) {
19 19
     exit;
20 20
 }
21 21
 
22 22
 // Fires before printing an invoice.
23
-do_action( 'wpinv_invoice_print_before_display', $invoice );
23
+do_action('wpinv_invoice_print_before_display', $invoice);
24 24
 
25 25
 ?><!DOCTYPE html>
26 26
 
@@ -29,24 +29,24 @@  discard block
 block discarded – undo
29 29
 
30 30
     <head>
31 31
 
32
-		<meta charset="<?php bloginfo( 'charset' ); ?>">
32
+		<meta charset="<?php bloginfo('charset'); ?>">
33 33
         <meta name="viewport" content="width=device-width, initial-scale=1.0" >
34 34
 
35 35
         <meta name="robots" content="noindex,nofollow">
36 36
 
37 37
 		<link rel="profile" href="https://gmpg.org/xfn/11">
38 38
 
39
-        <title>#<?php echo sanitize_text_field( $invoice->get_number() ); ?></title>
39
+        <title>#<?php echo sanitize_text_field($invoice->get_number()); ?></title>
40 40
 
41
-        <?php do_action( 'wpinv_invoice_print_head', $invoice ); ?>
41
+        <?php do_action('wpinv_invoice_print_head', $invoice); ?>
42 42
 
43 43
     </head>
44 44
     
45 45
 
46 46
     <body class="body wpinv wpinv-print" style="font-weight: 400;">
47 47
 
48
-        <?php do_action( 'getpaid_invoice', $invoice ); ?>
49
-        <?php do_action( 'wpinv_invoice_print_body_end', $invoice ); ?>
48
+        <?php do_action('getpaid_invoice', $invoice); ?>
49
+        <?php do_action('wpinv_invoice_print_body_end', $invoice); ?>
50 50
 
51 51
     </body>
52 52
 
Please login to merge, or discard this patch.
vendor/composer/autoload_static.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,34 +6,34 @@  discard block
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5
8 8
 {
9
-    public static $files = array (
9
+    public static $files = array(
10 10
         '24583d3588ebda5228dd453cfaa070da' => __DIR__ . '/..' . '/ayecode/wp-font-awesome-settings/wp-font-awesome-settings.php',
11 11
         'e8d544c98e79f913e13eae1306ab635e' => __DIR__ . '/..' . '/ayecode/wp-ayecode-ui/ayecode-ui-loader.php',
12 12
     );
13 13
 
14
-    public static $prefixLengthsPsr4 = array (
14
+    public static $prefixLengthsPsr4 = array(
15 15
         'M' => 
16
-        array (
16
+        array(
17 17
             'MaxMind\\Db\\' => 11,
18 18
         ),
19 19
         'C' => 
20
-        array (
20
+        array(
21 21
             'Composer\\Installers\\' => 20,
22 22
         ),
23 23
     );
24 24
 
25
-    public static $prefixDirsPsr4 = array (
25
+    public static $prefixDirsPsr4 = array(
26 26
         'MaxMind\\Db\\' => 
27
-        array (
27
+        array(
28 28
             0 => __DIR__ . '/..' . '/maxmind-db/reader/src/MaxMind/Db',
29 29
         ),
30 30
         'Composer\\Installers\\' => 
31
-        array (
31
+        array(
32 32
             0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers',
33 33
         ),
34 34
     );
35 35
 
36
-    public static $classMap = array (
36
+    public static $classMap = array(
37 37
         'AyeCode_Connect_Helper' => __DIR__ . '/..' . '/ayecode/ayecode-connect-helper/ayecode-connect-helper.php',
38 38
         'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
39 39
         'WP_Super_Duper' => __DIR__ . '/..' . '/ayecode/wp-super-duper/wp-super-duper.php',
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
     public static function getInitializer(ClassLoader $loader)
43 43
     {
44
-        return \Closure::bind(function () use ($loader) {
44
+        return \Closure::bind(function() use ($loader) {
45 45
             $loader->prefixLengthsPsr4 = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$prefixLengthsPsr4;
46 46
             $loader->prefixDirsPsr4 = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$prefixDirsPsr4;
47 47
             $loader->classMap = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$classMap;
Please login to merge, or discard this patch.
templates/invoice/header-left-actions.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,25 +8,25 @@
 block discarded – undo
8 8
  * @var WPInv_Invoice $invoice
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 ?>
14 14
 
15 15
         <div class="getpaid-header-left-actions">
16 16
 
17
-            <?php if ( $invoice->is_type( 'invoice' ) && $invoice->needs_payment() && ! $invoice->is_held() ): ?>
18
-                <a class="btn btn-sm btn-primary m-1 d-inline-block invoice-action-pay" href="<?php echo esc_url( $invoice->get_checkout_payment_url() ); ?>">
19
-                    <?php _e( 'Pay For Invoice', 'invoicing' ); ?>
17
+            <?php if ($invoice->is_type('invoice') && $invoice->needs_payment() && !$invoice->is_held()): ?>
18
+                <a class="btn btn-sm btn-primary m-1 d-inline-block invoice-action-pay" href="<?php echo esc_url($invoice->get_checkout_payment_url()); ?>">
19
+                    <?php _e('Pay For Invoice', 'invoicing'); ?>
20 20
                 </a>
21 21
             <?php endif; ?>
22 22
 
23
-            <?php if ( $invoice->is_type( 'invoice' ) && $invoice->is_paid() ): ?>
24
-                <a class="btn btn-sm btn-info m-1 d-inline-block invoice-action-receipt" href="<?php echo esc_url( $invoice->get_receipt_url() ); ?>">
25
-                    <?php _e( 'View Receipt', 'invoicing' ); ?>
23
+            <?php if ($invoice->is_type('invoice') && $invoice->is_paid()): ?>
24
+                <a class="btn btn-sm btn-info m-1 d-inline-block invoice-action-receipt" href="<?php echo esc_url($invoice->get_receipt_url()); ?>">
25
+                    <?php _e('View Receipt', 'invoicing'); ?>
26 26
                 </a>
27 27
             <?php endif; ?>
28 28
 
29
-            <?php do_action( 'wpinv_invoice_display_left_actions', $invoice ); ?>
29
+            <?php do_action('wpinv_invoice_display_left_actions', $invoice); ?>
30 30
 
31 31
         </div>
32 32
 
Please login to merge, or discard this patch.
templates/invoice/footer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
14 14
     <div class="border-top pt-4 bg-white">
15 15
         <div class="container pr-0 pl-0">
16 16
 
17
-            <?php if ( $term_text = wpinv_get_terms_text() ) : ?>
17
+            <?php if ($term_text = wpinv_get_terms_text()) : ?>
18 18
                 <div class="terms-text">
19
-                    <?php echo wpautop( $term_text ); ?>
19
+                    <?php echo wpautop($term_text); ?>
20 20
                 </div>
21 21
             <?php endif; ?>
22 22
 
Please login to merge, or discard this patch.
templates/invoice/header.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
             <div class="row">
17 17
 
18 18
                 <div class="col-12 col-sm-6 text-sm-left pl-sm-0">
19
-                    <?php do_action( 'getpaid_invoice_header_left', $invoice );?>
19
+                    <?php do_action('getpaid_invoice_header_left', $invoice); ?>
20 20
                 </div>
21 21
 
22 22
                 <div class="col-12 col-sm-6 text-sm-right pr-sm-0">
23
-                    <?php do_action( 'getpaid_invoice_header_right', $invoice );?>
23
+                    <?php do_action('getpaid_invoice_header_right', $invoice); ?>
24 24
                 </div>
25 25
 
26 26
             </div>
Please login to merge, or discard this patch.
templates/invoice/details-top.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,24 +7,24 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
14
-        <?php do_action( 'getpaid_before_invoice_details_top', $invoice ); ?>
14
+        <?php do_action('getpaid_before_invoice_details_top', $invoice); ?>
15 15
 
16 16
         <div class="getpaid-invoice-details-top mb-5">
17 17
             <div class="row">
18 18
                 <div class="col-12 col-sm-6 text-sm-left">
19
-                    <?php do_action( 'getpaid_invoice_details_top_left', $invoice ); ?>
19
+                    <?php do_action('getpaid_invoice_details_top_left', $invoice); ?>
20 20
                 </div>
21 21
 
22 22
                 <div class="col-12 col-sm-6 text-sm-right">
23
-                    <?php do_action( 'getpaid_invoice_details_top_right', $invoice ); ?>
23
+                    <?php do_action('getpaid_invoice_details_top_right', $invoice); ?>
24 24
                 </div>
25 25
             </div>
26 26
         </div>
27 27
 
28
-        <?php do_action( 'getpaid_after_invoice_details_top', $invoice ); ?>
28
+        <?php do_action('getpaid_after_invoice_details_top', $invoice); ?>
29 29
 
30 30
 <?php
Please login to merge, or discard this patch.
templates/invoice/invoice.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         <?php
19 19
 
20 20
             // Fires when printing the header.
21
-            do_action( 'getpaid_invoice_header', $invoice );
21
+            do_action('getpaid_invoice_header', $invoice);
22 22
 
23 23
             // Print the opening wrapper.
24 24
             echo '<div class="container bg-white border mt-4 mb-4 p-4 position-relative flex-grow-1">';
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
27 27
             wpinv_print_errors();
28 28
 
29 29
             // Fires when printing the invoice details.
30
-            do_action( 'getpaid_invoice_details', $invoice );
30
+            do_action('getpaid_invoice_details', $invoice);
31 31
 
32 32
             // Fires when printing the invoice line items.
33
-            do_action( 'getpaid_invoice_line_items', $invoice );
33
+            do_action('getpaid_invoice_line_items', $invoice);
34 34
 
35 35
             // Print the closing wrapper.
36 36
             echo '</div>';
37 37
 
38 38
             // Fires when printing the invoice footer.
39
-            do_action( 'getpaid_invoice_footer', $invoice );
39
+            do_action('getpaid_invoice_footer', $invoice);
40 40
 
41 41
         ?>
42 42
 
Please login to merge, or discard this patch.
widgets/getpaid.php 2 patches
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -36,36 +36,36 @@  discard block
 block discarded – undo
36 36
                     'desc_tip'    => true,
37 37
                     'default'     => '',
38 38
                     'advanced'    => false
39
-				),
39
+                ),
40 40
 
41 41
                 'form'  => array(
42
-	                'title'       => __( 'Form', 'invoicing' ),
43
-	                'desc'        => __( 'Enter a form id in case you want to display a specific payment form', 'invoicing' ),
44
-	                'type'        => 'text',
45
-	                'desc_tip'    => true,
46
-	                'default'     => '',
47
-	                'placeholder' => __('1','invoicing'),
48
-	                'advanced'    => false
49
-				),
50
-
51
-				'item'  => array(
52
-	                'title'       => __( 'Items', 'invoicing' ),
53
-	                'desc'        => __( 'Enter comma separated list of invoicing item id and quantity (item_id|quantity). Ex. 101|2. This will be ignored in case you specify a form above. Enter 0 as the quantity to let users select their own quantities', 'invoicing' ),
54
-	                'type'        => 'text',
55
-	                'desc_tip'    => true,
56
-	                'default'     => '',
57
-	                'placeholder' => __('1','invoicing'),
58
-	                'advanced'    => false
59
-				),
42
+                    'title'       => __( 'Form', 'invoicing' ),
43
+                    'desc'        => __( 'Enter a form id in case you want to display a specific payment form', 'invoicing' ),
44
+                    'type'        => 'text',
45
+                    'desc_tip'    => true,
46
+                    'default'     => '',
47
+                    'placeholder' => __('1','invoicing'),
48
+                    'advanced'    => false
49
+                ),
50
+
51
+                'item'  => array(
52
+                    'title'       => __( 'Items', 'invoicing' ),
53
+                    'desc'        => __( 'Enter comma separated list of invoicing item id and quantity (item_id|quantity). Ex. 101|2. This will be ignored in case you specify a form above. Enter 0 as the quantity to let users select their own quantities', 'invoicing' ),
54
+                    'type'        => 'text',
55
+                    'desc_tip'    => true,
56
+                    'default'     => '',
57
+                    'placeholder' => __('1','invoicing'),
58
+                    'advanced'    => false
59
+                ),
60 60
 
61 61
                 'button'  => array(
62
-	                'title'       => __( 'Button', 'invoicing' ),
63
-	                'desc'        => __( 'Enter button label in case you would like to display the forms in a popup.', 'invoicing' ),
64
-	                'type'        => 'text',
65
-	                'desc_tip'    => true,
66
-	                'default'     => '',
67
-	                'advanced'    => false
68
-				)
62
+                    'title'       => __( 'Button', 'invoicing' ),
63
+                    'desc'        => __( 'Enter button label in case you would like to display the forms in a popup.', 'invoicing' ),
64
+                    'type'        => 'text',
65
+                    'desc_tip'    => true,
66
+                    'default'     => '',
67
+                    'advanced'    => false
68
+                )
69 69
 
70 70
             )
71 71
 
@@ -75,96 +75,96 @@  discard block
 block discarded – undo
75 75
         parent::__construct( $options );
76 76
     }
77 77
 
78
-	/**
79
-	 * The Super block output function.
80
-	 *
81
-	 * @param array $args
82
-	 * @param array $widget_args
83
-	 * @param string $content
84
-	 *
85
-	 * @return string
86
-	 */
78
+    /**
79
+     * The Super block output function.
80
+     *
81
+     * @param array $args
82
+     * @param array $widget_args
83
+     * @param string $content
84
+     *
85
+     * @return string
86
+     */
87 87
     public function output( $args = array(), $widget_args = array(), $content = '' ) {
88 88
 
89
-	    // Is the shortcode set up correctly?
90
-		if ( empty( $args['form'] ) && empty( $args['item'] ) ) {
91
-			return aui()->alert(
92
-				array(
93
-					'type'    => 'warning',
94
-					'content' => __( 'No payment form or item selected', 'invoicing' ),
95
-				)
96
-			);
97
-		}
98
-
99
-		// Payment form or button?
100
-		if ( ! empty( $args['form'] ) ) {
101
-			return $this->handle_payment_form(  $args );
102
-		} else {
103
-			return $this->handle_buy_item(  $args );
104
-		}
105
-
106
-	}
107
-
108
-	/**
109
-	 * Displaying a payment form
110
-	 *
111
-	 * @return string
112
-	 */
89
+        // Is the shortcode set up correctly?
90
+        if ( empty( $args['form'] ) && empty( $args['item'] ) ) {
91
+            return aui()->alert(
92
+                array(
93
+                    'type'    => 'warning',
94
+                    'content' => __( 'No payment form or item selected', 'invoicing' ),
95
+                )
96
+            );
97
+        }
98
+
99
+        // Payment form or button?
100
+        if ( ! empty( $args['form'] ) ) {
101
+            return $this->handle_payment_form(  $args );
102
+        } else {
103
+            return $this->handle_buy_item(  $args );
104
+        }
105
+
106
+    }
107
+
108
+    /**
109
+     * Displaying a payment form
110
+     *
111
+     * @return string
112
+     */
113 113
     protected function handle_payment_form( $args = array() ) {
114 114
 
115
-		if ( empty( $args['button'] ) ) {
116
-			ob_start();
117
-			getpaid_display_payment_form( $args['form'] );
118
-			return ob_get_clean();
119
-		}
115
+        if ( empty( $args['button'] ) ) {
116
+            ob_start();
117
+            getpaid_display_payment_form( $args['form'] );
118
+            return ob_get_clean();
119
+        }
120 120
 
121
-		return $this->payment_form_button( $args['form'], $args['button'] );
122
-	}
121
+        return $this->payment_form_button( $args['form'], $args['button'] );
122
+    }
123 123
 
124
-	/**
125
-	 * Displays a payment form button.
126
-	 *
127
-	 * @return string
128
-	 */
124
+    /**
125
+     * Displays a payment form button.
126
+     *
127
+     * @return string
128
+     */
129 129
     protected function payment_form_button( $form, $button ) {
130
-		return getpaid_get_payment_button( $button, $form );
131
-	}
132
-
133
-	/**
134
-	 * Selling an item
135
-	 *
136
-	 * @return string
137
-	 */
130
+        return getpaid_get_payment_button( $button, $form );
131
+    }
132
+
133
+    /**
134
+     * Selling an item
135
+     *
136
+     * @return string
137
+     */
138 138
     protected function handle_buy_item( $args = array() ) {
139 139
 
140
-		if ( empty( $args['button'] ) ) {
141
-			return $this->buy_item_form( $args['item'] );
142
-		}
140
+        if ( empty( $args['button'] ) ) {
141
+            return $this->buy_item_form( $args['item'] );
142
+        }
143 143
 
144
-		return $this->buy_item_button( $args['item'], $args['button'] );
144
+        return $this->buy_item_button( $args['item'], $args['button'] );
145 145
 
146
-	}
146
+    }
147 147
 
148
-	/**
149
-	 * Displays a buy item form.
150
-	 *
151
-	 * @return string
152
-	 */
148
+    /**
149
+     * Displays a buy item form.
150
+     *
151
+     * @return string
152
+     */
153 153
     protected function buy_item_form( $item ) {
154
-		$items = getpaid_convert_items_to_array( $item );
155
-		ob_start();
156
-		getpaid_display_item_payment_form( $items );
157
-		return ob_get_clean();
158
-	}
159
-
160
-	/**
161
-	 * Displays a buy item button.
162
-	 *
163
-	 * @return string
164
-	 */
154
+        $items = getpaid_convert_items_to_array( $item );
155
+        ob_start();
156
+        getpaid_display_item_payment_form( $items );
157
+        return ob_get_clean();
158
+    }
159
+
160
+    /**
161
+     * Displays a buy item button.
162
+     *
163
+     * @return string
164
+     */
165 165
     protected function buy_item_button( $item, $button ) {
166
-		$button = getpaid_get_payment_button( $button, null, $item );
167
-		return apply_filters( 'getpaid_buy_item_button_widget', $button, $item );
166
+        $button = getpaid_get_payment_button( $button, null, $item );
167
+        return apply_filters( 'getpaid_buy_item_button_widget', $button, $item );
168 168
     }
169 169
 
170 170
 }
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
     exit;
4 4
 }
5 5
 
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
             'block-keywords'=> "['invoicing','buy', 'buy item', 'form']",
23 23
             'class_name'     => __CLASS__,
24 24
             'base_id'       => 'getpaid',
25
-            'name'          => __('GetPaid','invoicing'),
25
+            'name'          => __('GetPaid', 'invoicing'),
26 26
             'widget_ops'    => array(
27 27
                 'classname'   => 'getpaid bsui',
28
-                'description' => esc_html__('Show payment forms or buttons.','invoicing'),
28
+                'description' => esc_html__('Show payment forms or buttons.', 'invoicing'),
29 29
             ),
30 30
             'arguments'     => array(
31 31
 
32 32
                 'title'  => array(
33
-                    'title'       => __( 'Widget title', 'invoicing' ),
34
-                    'desc'        => __( 'Enter widget title.', 'invoicing' ),
33
+                    'title'       => __('Widget title', 'invoicing'),
34
+                    'desc'        => __('Enter widget title.', 'invoicing'),
35 35
                     'type'        => 'text',
36 36
                     'desc_tip'    => true,
37 37
                     'default'     => '',
@@ -39,28 +39,28 @@  discard block
 block discarded – undo
39 39
 				),
40 40
 
41 41
                 'form'  => array(
42
-	                'title'       => __( 'Form', 'invoicing' ),
43
-	                'desc'        => __( 'Enter a form id in case you want to display a specific payment form', 'invoicing' ),
42
+	                'title'       => __('Form', 'invoicing'),
43
+	                'desc'        => __('Enter a form id in case you want to display a specific payment form', 'invoicing'),
44 44
 	                'type'        => 'text',
45 45
 	                'desc_tip'    => true,
46 46
 	                'default'     => '',
47
-	                'placeholder' => __('1','invoicing'),
47
+	                'placeholder' => __('1', 'invoicing'),
48 48
 	                'advanced'    => false
49 49
 				),
50 50
 
51 51
 				'item'  => array(
52
-	                'title'       => __( 'Items', 'invoicing' ),
53
-	                'desc'        => __( 'Enter comma separated list of invoicing item id and quantity (item_id|quantity). Ex. 101|2. This will be ignored in case you specify a form above. Enter 0 as the quantity to let users select their own quantities', 'invoicing' ),
52
+	                'title'       => __('Items', 'invoicing'),
53
+	                'desc'        => __('Enter comma separated list of invoicing item id and quantity (item_id|quantity). Ex. 101|2. This will be ignored in case you specify a form above. Enter 0 as the quantity to let users select their own quantities', 'invoicing'),
54 54
 	                'type'        => 'text',
55 55
 	                'desc_tip'    => true,
56 56
 	                'default'     => '',
57
-	                'placeholder' => __('1','invoicing'),
57
+	                'placeholder' => __('1', 'invoicing'),
58 58
 	                'advanced'    => false
59 59
 				),
60 60
 
61 61
                 'button'  => array(
62
-	                'title'       => __( 'Button', 'invoicing' ),
63
-	                'desc'        => __( 'Enter button label in case you would like to display the forms in a popup.', 'invoicing' ),
62
+	                'title'       => __('Button', 'invoicing'),
63
+	                'desc'        => __('Enter button label in case you would like to display the forms in a popup.', 'invoicing'),
64 64
 	                'type'        => 'text',
65 65
 	                'desc_tip'    => true,
66 66
 	                'default'     => '',
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         );
73 73
 
74 74
 
75
-        parent::__construct( $options );
75
+        parent::__construct($options);
76 76
     }
77 77
 
78 78
 	/**
@@ -84,23 +84,23 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @return string
86 86
 	 */
87
-    public function output( $args = array(), $widget_args = array(), $content = '' ) {
87
+    public function output($args = array(), $widget_args = array(), $content = '') {
88 88
 
89 89
 	    // Is the shortcode set up correctly?
90
-		if ( empty( $args['form'] ) && empty( $args['item'] ) ) {
90
+		if (empty($args['form']) && empty($args['item'])) {
91 91
 			return aui()->alert(
92 92
 				array(
93 93
 					'type'    => 'warning',
94
-					'content' => __( 'No payment form or item selected', 'invoicing' ),
94
+					'content' => __('No payment form or item selected', 'invoicing'),
95 95
 				)
96 96
 			);
97 97
 		}
98 98
 
99 99
 		// Payment form or button?
100
-		if ( ! empty( $args['form'] ) ) {
101
-			return $this->handle_payment_form(  $args );
100
+		if (!empty($args['form'])) {
101
+			return $this->handle_payment_form($args);
102 102
 		} else {
103
-			return $this->handle_buy_item(  $args );
103
+			return $this->handle_buy_item($args);
104 104
 		}
105 105
 
106 106
 	}
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @return string
112 112
 	 */
113
-    protected function handle_payment_form( $args = array() ) {
113
+    protected function handle_payment_form($args = array()) {
114 114
 
115
-		if ( empty( $args['button'] ) ) {
115
+		if (empty($args['button'])) {
116 116
 			ob_start();
117
-			getpaid_display_payment_form( $args['form'] );
117
+			getpaid_display_payment_form($args['form']);
118 118
 			return ob_get_clean();
119 119
 		}
120 120
 
121
-		return $this->payment_form_button( $args['form'], $args['button'] );
121
+		return $this->payment_form_button($args['form'], $args['button']);
122 122
 	}
123 123
 
124 124
 	/**
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @return string
128 128
 	 */
129
-    protected function payment_form_button( $form, $button ) {
130
-		return getpaid_get_payment_button( $button, $form );
129
+    protected function payment_form_button($form, $button) {
130
+		return getpaid_get_payment_button($button, $form);
131 131
 	}
132 132
 
133 133
 	/**
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * @return string
137 137
 	 */
138
-    protected function handle_buy_item( $args = array() ) {
138
+    protected function handle_buy_item($args = array()) {
139 139
 
140
-		if ( empty( $args['button'] ) ) {
141
-			return $this->buy_item_form( $args['item'] );
140
+		if (empty($args['button'])) {
141
+			return $this->buy_item_form($args['item']);
142 142
 		}
143 143
 
144
-		return $this->buy_item_button( $args['item'], $args['button'] );
144
+		return $this->buy_item_button($args['item'], $args['button']);
145 145
 
146 146
 	}
147 147
 
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
 	 *
151 151
 	 * @return string
152 152
 	 */
153
-    protected function buy_item_form( $item ) {
154
-		$items = getpaid_convert_items_to_array( $item );
153
+    protected function buy_item_form($item) {
154
+		$items = getpaid_convert_items_to_array($item);
155 155
 		ob_start();
156
-		getpaid_display_item_payment_form( $items );
156
+		getpaid_display_item_payment_form($items);
157 157
 		return ob_get_clean();
158 158
 	}
159 159
 
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 	 *
163 163
 	 * @return string
164 164
 	 */
165
-    protected function buy_item_button( $item, $button ) {
166
-		$button = getpaid_get_payment_button( $button, null, $item );
167
-		return apply_filters( 'getpaid_buy_item_button_widget', $button, $item );
165
+    protected function buy_item_button($item, $button) {
166
+		$button = getpaid_get_payment_button($button, null, $item);
167
+		return apply_filters('getpaid_buy_item_button_widget', $button, $item);
168 168
     }
169 169
 
170 170
 }
Please login to merge, or discard this patch.
includes/class-wpinv-ajax.php 2 patches
Indentation   +58 added lines, -58 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 )
@@ -255,24 +255,24 @@  discard block
 block discarded – undo
255 255
         check_ajax_referer( 'getpaid_form_nonce' );
256 256
 
257 257
         // Is the request set up correctly?
258
-		if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) {
259
-			echo aui()->alert(
260
-				array(
261
-					'type'    => 'warning',
262
-					'content' => __( 'No payment form or item provided', 'invoicing' ),
263
-				)
258
+        if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) {
259
+            echo aui()->alert(
260
+                array(
261
+                    'type'    => 'warning',
262
+                    'content' => __( 'No payment form or item provided', 'invoicing' ),
263
+                )
264 264
             );
265 265
             exit;
266 266
         }
267 267
 
268 268
         // Payment form or button?
269
-		if ( ! empty( $_GET['form'] ) ) {
269
+        if ( ! empty( $_GET['form'] ) ) {
270 270
             getpaid_display_payment_form( urldecode( $_GET['form'] ) );
271
-		} else if( ! empty( $_GET['invoice'] ) ) {
272
-		    getpaid_display_invoice_payment_form( urldecode( $_GET['invoice'] ) );
271
+        } else if( ! empty( $_GET['invoice'] ) ) {
272
+            getpaid_display_invoice_payment_form( urldecode( $_GET['invoice'] ) );
273 273
         } else {
274
-			$items = getpaid_convert_items_to_array( urldecode( $_GET['item'] ) );
275
-		    getpaid_display_item_payment_form( $items );
274
+            $items = getpaid_convert_items_to_array( urldecode( $_GET['item'] ) );
275
+            getpaid_display_item_payment_form( $items );
276 276
         }
277 277
 
278 278
         exit;
Please login to merge, or discard this patch.
Spacing   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package Invoicing
7 7
  */
8 8
  
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * WPInv_Ajax class.
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 	 * Hook in ajax handlers.
18 18
 	 */
19 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 );
20
+		add_action('init', array(__CLASS__, 'define_ajax'), 0);
21
+		add_action('template_redirect', array(__CLASS__, 'do_wpinv_ajax'), 0);
22 22
 		self::add_ajax_events();
23 23
     }
24 24
 
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public static function define_ajax() {
29 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 );
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 35
 			}
36 36
 			$GLOBALS['wpdb']->hide_errors();
37 37
 		}
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
 	 * @since 1.0.18
45 45
 	 */
46 46
 	private static function wpinv_ajax_headers() {
47
-		if ( ! headers_sent() ) {
47
+		if (!headers_sent()) {
48 48
 			send_origin_headers();
49 49
 			send_nosniff_header();
50 50
 			nocache_headers();
51
-			header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
52
-			header( 'X-Robots-Tag: noindex' );
53
-			status_header( 200 );
51
+			header('Content-Type: text/html; charset=' . get_option('blog_charset'));
52
+			header('X-Robots-Tag: noindex');
53
+			status_header(200);
54 54
 		}
55 55
     }
56 56
     
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
 	public static function do_wpinv_ajax() {
61 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'] ) ) );
63
+		if (!empty($_GET['wpinv-ajax'])) {
64
+			$wp_query->set('wpinv-ajax', sanitize_text_field(wp_unslash($_GET['wpinv-ajax'])));
65 65
 		}
66 66
 
67
-		$action = $wp_query->get( 'wpinv-ajax' );
67
+		$action = $wp_query->get('wpinv-ajax');
68 68
 
69
-		if ( $action ) {
69
+		if ($action) {
70 70
 			self::wpinv_ajax_headers();
71
-			$action = sanitize_text_field( $action );
72
-			do_action( 'wpinv_ajax_' . $action );
71
+			$action = sanitize_text_field($action);
72
+			do_action('wpinv_ajax_' . $action);
73 73
 			wp_die();
74 74
 		}
75 75
 
@@ -102,36 +102,36 @@  discard block
 block discarded – undo
102 102
             'payment_form_refresh_prices' => true,
103 103
         );
104 104
 
105
-        foreach ( $ajax_events as $ajax_event => $nopriv ) {
106
-            add_action( 'wp_ajax_wpinv_' . $ajax_event, array( __CLASS__, $ajax_event ) );
107
-            add_action( 'wp_ajax_getpaid_' . $ajax_event, array( __CLASS__, $ajax_event ) );
105
+        foreach ($ajax_events as $ajax_event => $nopriv) {
106
+            add_action('wp_ajax_wpinv_' . $ajax_event, array(__CLASS__, $ajax_event));
107
+            add_action('wp_ajax_getpaid_' . $ajax_event, array(__CLASS__, $ajax_event));
108 108
 
109
-            if ( $nopriv ) {
110
-                add_action( 'wp_ajax_nopriv_wpinv_' . $ajax_event, array( __CLASS__, $ajax_event ) );
111
-                add_action( 'wp_ajax_nopriv_getpaid_' . $ajax_event, array( __CLASS__, $ajax_event ) );
112
-                add_action( 'wpinv_ajax_' . $ajax_event, array( __CLASS__, $ajax_event ) );
109
+            if ($nopriv) {
110
+                add_action('wp_ajax_nopriv_wpinv_' . $ajax_event, array(__CLASS__, $ajax_event));
111
+                add_action('wp_ajax_nopriv_getpaid_' . $ajax_event, array(__CLASS__, $ajax_event));
112
+                add_action('wpinv_ajax_' . $ajax_event, array(__CLASS__, $ajax_event));
113 113
             }
114 114
         }
115 115
     }
116 116
     
117 117
     public static function add_note() {
118
-        check_ajax_referer( 'add-invoice-note', '_nonce' );
118
+        check_ajax_referer('add-invoice-note', '_nonce');
119 119
 
120
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
120
+        if (!wpinv_current_user_can_manage_invoicing()) {
121 121
             die(-1);
122 122
         }
123 123
 
124
-        $post_id   = absint( $_POST['post_id'] );
125
-        $note      = wp_kses_post( trim( stripslashes( $_POST['note'] ) ) );
126
-        $note_type = sanitize_text_field( $_POST['note_type'] );
124
+        $post_id   = absint($_POST['post_id']);
125
+        $note      = wp_kses_post(trim(stripslashes($_POST['note'])));
126
+        $note_type = sanitize_text_field($_POST['note_type']);
127 127
 
128 128
         $is_customer_note = $note_type == 'customer' ? 1 : 0;
129 129
 
130
-        if ( $post_id > 0 ) {
131
-            $note_id = wpinv_insert_payment_note( $post_id, $note, $is_customer_note );
130
+        if ($post_id > 0) {
131
+            $note_id = wpinv_insert_payment_note($post_id, $note, $is_customer_note);
132 132
 
133
-            if ( $note_id > 0 && !is_wp_error( $note_id ) ) {
134
-                wpinv_get_invoice_note_line_item( $note_id );
133
+            if ($note_id > 0 && !is_wp_error($note_id)) {
134
+                wpinv_get_invoice_note_line_item($note_id);
135 135
             }
136 136
         }
137 137
 
@@ -139,16 +139,16 @@  discard block
 block discarded – undo
139 139
     }
140 140
 
141 141
     public static function delete_note() {
142
-        check_ajax_referer( 'delete-invoice-note', '_nonce' );
142
+        check_ajax_referer('delete-invoice-note', '_nonce');
143 143
 
144
-        if ( !wpinv_current_user_can_manage_invoicing() ) {
144
+        if (!wpinv_current_user_can_manage_invoicing()) {
145 145
             die(-1);
146 146
         }
147 147
 
148
-        $note_id = (int)$_POST['note_id'];
148
+        $note_id = (int) $_POST['note_id'];
149 149
 
150
-        if ( $note_id > 0 ) {
151
-            wp_delete_comment( $note_id, true );
150
+        if ($note_id > 0) {
151
+            wp_delete_comment($note_id, true);
152 152
         }
153 153
 
154 154
         die();
@@ -166,34 +166,34 @@  discard block
 block discarded – undo
166 166
     public static function get_billing_details() {
167 167
 
168 168
         // Verify nonce.
169
-        check_ajax_referer( 'wpinv-nonce' );
169
+        check_ajax_referer('wpinv-nonce');
170 170
 
171 171
         // Can the user manage the plugin?
172
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
172
+        if (!wpinv_current_user_can_manage_invoicing()) {
173 173
             die(-1);
174 174
         }
175 175
 
176 176
         // Do we have a user id?
177 177
         $user_id = $_GET['user_id'];
178 178
 
179
-        if ( empty( $user_id ) || ! is_numeric( $user_id ) ) {
179
+        if (empty($user_id) || !is_numeric($user_id)) {
180 180
             die(-1);
181 181
         }
182 182
 
183 183
         // Fetch the billing details.
184
-        $billing_details    = wpinv_get_user_address( $user_id );
185
-        $billing_details    = apply_filters( 'wpinv_ajax_billing_details', $billing_details, $user_id );
184
+        $billing_details    = wpinv_get_user_address($user_id);
185
+        $billing_details    = apply_filters('wpinv_ajax_billing_details', $billing_details, $user_id);
186 186
 
187 187
         // unset the user id and email.
188
-        $to_ignore = array( 'user_id', 'email' );
188
+        $to_ignore = array('user_id', 'email');
189 189
 
190
-        foreach ( $to_ignore as $key ) {
191
-            if ( isset( $billing_details[ $key ] ) ) {
192
-                unset( $billing_details[ $key ] );
190
+        foreach ($to_ignore as $key) {
191
+            if (isset($billing_details[$key])) {
192
+                unset($billing_details[$key]);
193 193
             }
194 194
         }
195 195
 
196
-        wp_send_json_success( $billing_details );
196
+        wp_send_json_success($billing_details);
197 197
 
198 198
     }
199 199
 
@@ -203,47 +203,47 @@  discard block
 block discarded – undo
203 203
     public static function check_new_user_email() {
204 204
 
205 205
         // Verify nonce.
206
-        check_ajax_referer( 'wpinv-nonce' );
206
+        check_ajax_referer('wpinv-nonce');
207 207
 
208 208
         // Can the user manage the plugin?
209
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
209
+        if (!wpinv_current_user_can_manage_invoicing()) {
210 210
             die(-1);
211 211
         }
212 212
 
213 213
         // We need an email address.
214
-        if ( empty( $_GET['email'] ) ) {
215
-            _e( "Provide the new user's email address", 'invoicing' );
214
+        if (empty($_GET['email'])) {
215
+            _e("Provide the new user's email address", 'invoicing');
216 216
             exit;
217 217
         }
218 218
 
219 219
         // Ensure the email is valid.
220
-        $email = sanitize_text_field( $_GET['email'] );
221
-        if ( ! is_email( $email ) ) {
222
-            _e( 'Invalid email address', 'invoicing' );
220
+        $email = sanitize_text_field($_GET['email']);
221
+        if (!is_email($email)) {
222
+            _e('Invalid email address', 'invoicing');
223 223
             exit;
224 224
         }
225 225
 
226 226
         // And it does not exist.
227
-        $id = email_exists( $email );
228
-        if ( $id ) {
229
-            wp_send_json_success( compact( 'id' ) );
227
+        $id = email_exists($email);
228
+        if ($id) {
229
+            wp_send_json_success(compact('id'));
230 230
         }
231 231
 
232
-        wp_send_json_success( true );
232
+        wp_send_json_success(true);
233 233
     }
234 234
     
235 235
     public static function run_tool() {
236
-        check_ajax_referer( 'wpinv-nonce', '_nonce' );
237
-        if ( !wpinv_current_user_can_manage_invoicing() ) {
236
+        check_ajax_referer('wpinv-nonce', '_nonce');
237
+        if (!wpinv_current_user_can_manage_invoicing()) {
238 238
             die(-1);
239 239
         }
240 240
         
241
-        $tool = sanitize_text_field( $_POST['tool'] );
241
+        $tool = sanitize_text_field($_POST['tool']);
242 242
         
243
-        do_action( 'wpinv_run_tool' );
243
+        do_action('wpinv_run_tool');
244 244
         
245
-        if ( !empty( $tool ) ) {
246
-            do_action( 'wpinv_tool_' . $tool );
245
+        if (!empty($tool)) {
246
+            do_action('wpinv_tool_' . $tool);
247 247
         }
248 248
     }
249 249
 
@@ -253,27 +253,27 @@  discard block
 block discarded – undo
253 253
     public static function get_payment_form() {
254 254
 
255 255
         // Check nonce.
256
-        check_ajax_referer( 'getpaid_form_nonce' );
256
+        check_ajax_referer('getpaid_form_nonce');
257 257
 
258 258
         // Is the request set up correctly?
259
-		if ( empty( $_GET['form'] ) && empty( $_GET['item'] ) ) {
259
+		if (empty($_GET['form']) && empty($_GET['item'])) {
260 260
 			echo aui()->alert(
261 261
 				array(
262 262
 					'type'    => 'warning',
263
-					'content' => __( 'No payment form or item provided', 'invoicing' ),
263
+					'content' => __('No payment form or item provided', 'invoicing'),
264 264
 				)
265 265
             );
266 266
             exit;
267 267
         }
268 268
 
269 269
         // Payment form or button?
270
-		if ( ! empty( $_GET['form'] ) ) {
271
-            getpaid_display_payment_form( urldecode( $_GET['form'] ) );
272
-		} else if( ! empty( $_GET['invoice'] ) ) {
273
-		    getpaid_display_invoice_payment_form( urldecode( $_GET['invoice'] ) );
270
+		if (!empty($_GET['form'])) {
271
+            getpaid_display_payment_form(urldecode($_GET['form']));
272
+		} else if (!empty($_GET['invoice'])) {
273
+		    getpaid_display_invoice_payment_form(urldecode($_GET['invoice']));
274 274
         } else {
275
-			$items = getpaid_convert_items_to_array( urldecode( $_GET['item'] ) );
276
-		    getpaid_display_item_payment_form( $items );
275
+			$items = getpaid_convert_items_to_array(urldecode($_GET['item']));
276
+		    getpaid_display_item_payment_form($items);
277 277
         }
278 278
 
279 279
         exit;
@@ -288,17 +288,17 @@  discard block
 block discarded – undo
288 288
     public static function payment_form() {
289 289
 
290 290
         // Check nonce.
291
-        check_ajax_referer( 'getpaid_form_nonce' );
291
+        check_ajax_referer('getpaid_form_nonce');
292 292
 
293 293
         // ... form fields...
294
-        if ( empty( $_POST['getpaid_payment_form_submission'] ) ) {
295
-            _e( 'Error: Reload the page and try again.', 'invoicing' );
294
+        if (empty($_POST['getpaid_payment_form_submission'])) {
295
+            _e('Error: Reload the page and try again.', 'invoicing');
296 296
             exit;
297 297
         }
298 298
 
299 299
         // Process the payment form.
300
-        $checkout_class = apply_filters( 'getpaid_checkout_class', 'GetPaid_Checkout' );
301
-        $checkout       = new $checkout_class( new GetPaid_Payment_Form_Submission() );
300
+        $checkout_class = apply_filters('getpaid_checkout_class', 'GetPaid_Checkout');
301
+        $checkout       = new $checkout_class(new GetPaid_Payment_Form_Submission());
302 302
         $checkout->process_checkout();
303 303
 
304 304
         exit;
@@ -311,55 +311,55 @@  discard block
 block discarded – undo
311 311
      */
312 312
     public static function get_payment_form_states_field() {
313 313
 
314
-        if ( empty( $_GET['country'] ) || empty( $_GET['form'] ) ) {
314
+        if (empty($_GET['country']) || empty($_GET['form'])) {
315 315
             exit;
316 316
         }
317 317
 
318
-        $elements = getpaid_get_payment_form_elements( $_GET['form'] );
318
+        $elements = getpaid_get_payment_form_elements($_GET['form']);
319 319
 
320
-        if ( empty( $elements ) ) {
320
+        if (empty($elements)) {
321 321
             exit;
322 322
         }
323 323
 
324 324
         $address_fields = array();
325
-        foreach ( $elements as $element ) {
326
-            if ( 'address' === $element['type'] ) {
325
+        foreach ($elements as $element) {
326
+            if ('address' === $element['type']) {
327 327
                 $address_fields = $element;
328 328
                 break;
329 329
             }
330 330
         }
331 331
 
332
-        if ( empty( $address_fields ) ) {
332
+        if (empty($address_fields)) {
333 333
             exit;
334 334
         }
335 335
 
336
-        foreach ( $address_fields['fields'] as $address_field ) {
336
+        foreach ($address_fields['fields'] as $address_field) {
337 337
 
338
-            if ( 'wpinv_state' == $address_field['name'] ) {
338
+            if ('wpinv_state' == $address_field['name']) {
339 339
 
340
-                $wrap_class  = getpaid_get_form_element_grid_class( $address_field );
341
-                $wrap_class  = esc_attr( "$wrap_class getpaid-address-field-wrapper" );
342
-                $placeholder = empty( $address_field['placeholder'] ) ? '' : esc_attr( $address_field['placeholder'] );
343
-                $description = empty( $address_field['description'] ) ? '' : wp_kses_post( $address_field['description'] );
344
-                $value       = is_user_logged_in() ? get_user_meta( get_current_user_id(), '_wpinv_state', true ) : '';
345
-                $label       = empty( $address_field['label'] ) ? '' : wp_kses_post( $address_field['label'] );
340
+                $wrap_class  = getpaid_get_form_element_grid_class($address_field);
341
+                $wrap_class  = esc_attr("$wrap_class getpaid-address-field-wrapper");
342
+                $placeholder = empty($address_field['placeholder']) ? '' : esc_attr($address_field['placeholder']);
343
+                $description = empty($address_field['description']) ? '' : wp_kses_post($address_field['description']);
344
+                $value       = is_user_logged_in() ? get_user_meta(get_current_user_id(), '_wpinv_state', true) : '';
345
+                $label       = empty($address_field['label']) ? '' : wp_kses_post($address_field['label']);
346 346
 
347
-                if ( ! empty( $address_field['required'] ) ) {
347
+                if (!empty($address_field['required'])) {
348 348
                     $label .= "<span class='text-danger'> *</span>";
349 349
                 }
350 350
 
351
-                $html = getpaid_get_states_select_markup (
352
-                    sanitize_text_field( $_GET['country'] ),
351
+                $html = getpaid_get_states_select_markup(
352
+                    sanitize_text_field($_GET['country']),
353 353
                     $value,
354 354
                     $placeholder,
355 355
                     $label,
356 356
                     $description,
357
-                    ! empty( $address_field['required'] ),
357
+                    !empty($address_field['required']),
358 358
                     $wrap_class,
359
-                    wpinv_clean( $_GET['name'] )
359
+                    wpinv_clean($_GET['name'])
360 360
                 );
361 361
 
362
-                wp_send_json_success( $html );
362
+                wp_send_json_success($html);
363 363
                 exit;
364 364
 
365 365
             }
@@ -375,66 +375,66 @@  discard block
 block discarded – undo
375 375
     public static function recalculate_invoice_totals() {
376 376
 
377 377
         // Verify nonce.
378
-        check_ajax_referer( 'wpinv-nonce' );
378
+        check_ajax_referer('wpinv-nonce');
379 379
 
380
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
380
+        if (!wpinv_current_user_can_manage_invoicing()) {
381 381
             exit;
382 382
         }
383 383
 
384 384
         // We need an invoice.
385
-        if ( empty( $_POST['post_id'] ) ) {
385
+        if (empty($_POST['post_id'])) {
386 386
             exit;
387 387
         }
388 388
 
389 389
         // Fetch the invoice.
390
-        $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) );
390
+        $invoice = new WPInv_Invoice(trim($_POST['post_id']));
391 391
 
392 392
         // Ensure it exists.
393
-        if ( ! $invoice->get_id() ) {
393
+        if (!$invoice->get_id()) {
394 394
             exit;
395 395
         }
396 396
 
397 397
         // Maybe set the country, state, currency.
398
-        foreach ( array( 'country', 'state', 'currency', 'vat_number', 'discount_code' ) as $key ) {
399
-            if ( isset( $_POST[ $key ] ) ) {
398
+        foreach (array('country', 'state', 'currency', 'vat_number', 'discount_code') as $key) {
399
+            if (isset($_POST[$key])) {
400 400
                 $method = "set_$key";
401
-                $invoice->$method( sanitize_text_field( $_POST[ $key ] ) );
401
+                $invoice->$method(sanitize_text_field($_POST[$key]));
402 402
             }
403 403
         }
404 404
 
405 405
         // Maybe disable taxes.
406
-        $invoice->set_disable_taxes( ! empty( $_POST['taxes'] ) );
406
+        $invoice->set_disable_taxes(!empty($_POST['taxes']));
407 407
 
408 408
         // Discount code.
409
-        if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
410
-            $discount = new WPInv_Discount( $invoice->get_discount_code() );
411
-            if ( $discount->exists() ) {
412
-                $invoice->add_discount( getpaid_calculate_invoice_discount( $invoice, $discount ) );
409
+        if (!$invoice->is_paid() && !$invoice->is_refunded()) {
410
+            $discount = new WPInv_Discount($invoice->get_discount_code());
411
+            if ($discount->exists()) {
412
+                $invoice->add_discount(getpaid_calculate_invoice_discount($invoice, $discount));
413 413
             } else {
414
-                $invoice->remove_discount( 'discount_code' );
414
+                $invoice->remove_discount('discount_code');
415 415
             }
416 416
         }
417 417
 
418 418
         // Recalculate totals.
419 419
         $invoice->recalculate_total();
420 420
 
421
-        $total        = wpinv_price( $invoice->get_total(), $invoice->get_currency() );
422
-        $suscriptions = getpaid_get_invoice_subscriptions( $invoice );
423
-        if ( is_a( $suscriptions, 'WPInv_Subscription' ) && $invoice->is_recurring() && $invoice->is_parent() && $invoice->get_total() != $invoice->get_recurring_total() ) {
424
-            $recurring_total = wpinv_price( $invoice->get_recurring_total(), $invoice->get_currency() );
425
-            $total          .= '<small class="form-text text-muted">' . sprintf( __( 'Recurring Price: %s', 'invoicing' ), $recurring_total ) . '</small>';
421
+        $total        = wpinv_price($invoice->get_total(), $invoice->get_currency());
422
+        $suscriptions = getpaid_get_invoice_subscriptions($invoice);
423
+        if (is_a($suscriptions, 'WPInv_Subscription') && $invoice->is_recurring() && $invoice->is_parent() && $invoice->get_total() != $invoice->get_recurring_total()) {
424
+            $recurring_total = wpinv_price($invoice->get_recurring_total(), $invoice->get_currency());
425
+            $total          .= '<small class="form-text text-muted">' . sprintf(__('Recurring Price: %s', 'invoicing'), $recurring_total) . '</small>';
426 426
         }
427 427
 
428 428
         $totals = array(
429
-            'subtotal' => wpinv_price( $invoice->get_subtotal(), $invoice->get_currency() ),
430
-            'discount' => wpinv_price( $invoice->get_total_discount(), $invoice->get_currency() ),
431
-            'tax'      => wpinv_price( $invoice->get_total_tax(), $invoice->get_currency() ),
429
+            'subtotal' => wpinv_price($invoice->get_subtotal(), $invoice->get_currency()),
430
+            'discount' => wpinv_price($invoice->get_total_discount(), $invoice->get_currency()),
431
+            'tax'      => wpinv_price($invoice->get_total_tax(), $invoice->get_currency()),
432 432
             'total'    => $total,
433 433
         );
434 434
 
435
-        $totals = apply_filters( 'getpaid_invoice_totals', $totals, $invoice );
435
+        $totals = apply_filters('getpaid_invoice_totals', $totals, $invoice);
436 436
 
437
-        wp_send_json_success( compact( 'totals' ) );
437
+        wp_send_json_success(compact('totals'));
438 438
     }
439 439
 
440 440
     /**
@@ -443,33 +443,33 @@  discard block
 block discarded – undo
443 443
     public static function get_invoice_items() {
444 444
 
445 445
         // Verify nonce.
446
-        check_ajax_referer( 'wpinv-nonce' );
446
+        check_ajax_referer('wpinv-nonce');
447 447
 
448
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
448
+        if (!wpinv_current_user_can_manage_invoicing()) {
449 449
             exit;
450 450
         }
451 451
 
452 452
         // We need an invoice and items.
453
-        if ( empty( $_POST['post_id'] ) ) {
453
+        if (empty($_POST['post_id'])) {
454 454
             exit;
455 455
         }
456 456
 
457 457
         // Fetch the invoice.
458
-        $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) );
458
+        $invoice = new WPInv_Invoice(trim($_POST['post_id']));
459 459
 
460 460
         // Ensure it exists.
461
-        if ( ! $invoice->get_id() ) {
461
+        if (!$invoice->get_id()) {
462 462
             exit;
463 463
         }
464 464
 
465 465
         // Return an array of invoice items.
466 466
         $items = array();
467 467
 
468
-        foreach ( $invoice->get_items() as $item ) {
469
-            $items[] = $item->prepare_data_for_invoice_edit_ajax(  $invoice->get_currency(), $invoice->is_renewal()  );
468
+        foreach ($invoice->get_items() as $item) {
469
+            $items[] = $item->prepare_data_for_invoice_edit_ajax($invoice->get_currency(), $invoice->is_renewal());
470 470
         }
471 471
 
472
-        wp_send_json_success( compact( 'items' ) );
472
+        wp_send_json_success(compact('items'));
473 473
     }
474 474
 
475 475
     /**
@@ -478,50 +478,50 @@  discard block
 block discarded – undo
478 478
     public static function edit_invoice_item() {
479 479
 
480 480
         // Verify nonce.
481
-        check_ajax_referer( 'wpinv-nonce' );
481
+        check_ajax_referer('wpinv-nonce');
482 482
 
483
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
483
+        if (!wpinv_current_user_can_manage_invoicing()) {
484 484
             exit;
485 485
         }
486 486
 
487 487
         // We need an invoice and item details.
488
-        if ( empty( $_POST['post_id'] ) || empty( $_POST['data'] ) ) {
488
+        if (empty($_POST['post_id']) || empty($_POST['data'])) {
489 489
             exit;
490 490
         }
491 491
 
492 492
         // Fetch the invoice.
493
-        $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) );
493
+        $invoice = new WPInv_Invoice(trim($_POST['post_id']));
494 494
 
495 495
         // Ensure it exists and its not been paid for.
496
-        if ( ! $invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded() ) {
496
+        if (!$invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded()) {
497 497
             exit;
498 498
         }
499 499
 
500 500
         // Format the data.
501
-        $data = wp_unslash( wp_list_pluck( $_POST['data'], 'value', 'field' ) );
501
+        $data = wp_unslash(wp_list_pluck($_POST['data'], 'value', 'field'));
502 502
 
503 503
         // Ensure that we have an item id.
504
-        if ( empty( $data['id'] ) ) {
504
+        if (empty($data['id'])) {
505 505
             exit;
506 506
         }
507 507
 
508 508
         // Abort if the invoice does not have the specified item.
509
-        $item = $invoice->get_item( (int) $data['id'] );
509
+        $item = $invoice->get_item((int) $data['id']);
510 510
 
511
-        if ( empty( $item ) ) {
511
+        if (empty($item)) {
512 512
             exit;
513 513
         }
514 514
 
515 515
         // Update the item.
516
-        $item->set_price( floatval( $data['price'] ) );
517
-        $item->set_name( sanitize_text_field( $data['name'] ) );
518
-        $item->set_description( wp_kses_post( $data['description'] ) );
519
-        $item->set_quantity( floatval( $data['quantity'] ) );
516
+        $item->set_price(floatval($data['price']));
517
+        $item->set_name(sanitize_text_field($data['name']));
518
+        $item->set_description(wp_kses_post($data['description']));
519
+        $item->set_quantity(floatval($data['quantity']));
520 520
 
521 521
         // Add it to the invoice.
522
-        $error = $invoice->add_item( $item );
522
+        $error = $invoice->add_item($item);
523 523
         $alert = false;
524
-        if ( is_wp_error( $error ) ) {
524
+        if (is_wp_error($error)) {
525 525
             $alert = $error->get_error_message();
526 526
         }
527 527
 
@@ -534,11 +534,11 @@  discard block
 block discarded – undo
534 534
         // Return an array of invoice items.
535 535
         $items = array();
536 536
 
537
-        foreach ( $invoice->get_items() as $item ) {
538
-            $items[] = $item->prepare_data_for_invoice_edit_ajax(  $invoice->get_currency()  );
537
+        foreach ($invoice->get_items() as $item) {
538
+            $items[] = $item->prepare_data_for_invoice_edit_ajax($invoice->get_currency());
539 539
         }
540 540
 
541
-        wp_send_json_success( compact( 'items', 'alert' ) );
541
+        wp_send_json_success(compact('items', 'alert'));
542 542
     }
543 543
 
544 544
     /**
@@ -547,33 +547,33 @@  discard block
 block discarded – undo
547 547
     public static function remove_invoice_item() {
548 548
 
549 549
         // Verify nonce.
550
-        check_ajax_referer( 'wpinv-nonce' );
550
+        check_ajax_referer('wpinv-nonce');
551 551
 
552
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
552
+        if (!wpinv_current_user_can_manage_invoicing()) {
553 553
             exit;
554 554
         }
555 555
 
556 556
         // We need an invoice and an item.
557
-        if ( empty( $_POST['post_id'] ) || empty( $_POST['item_id'] ) ) {
557
+        if (empty($_POST['post_id']) || empty($_POST['item_id'])) {
558 558
             exit;
559 559
         }
560 560
 
561 561
         // Fetch the invoice.
562
-        $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) );
562
+        $invoice = new WPInv_Invoice(trim($_POST['post_id']));
563 563
 
564 564
         // Ensure it exists and its not been paid for.
565
-        if ( ! $invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded() ) {
565
+        if (!$invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded()) {
566 566
             exit;
567 567
         }
568 568
 
569 569
         // Abort if the invoice does not have the specified item.
570
-        $item = $invoice->get_item( (int) $_POST['item_id'] );
570
+        $item = $invoice->get_item((int) $_POST['item_id']);
571 571
 
572
-        if ( empty( $item ) ) {
572
+        if (empty($item)) {
573 573
             exit;
574 574
         }
575 575
 
576
-        $invoice->remove_item( (int) $_POST['item_id'] );
576
+        $invoice->remove_item((int) $_POST['item_id']);
577 577
 
578 578
         // Update totals.
579 579
         $invoice->recalculate_total();
@@ -584,11 +584,11 @@  discard block
 block discarded – undo
584 584
         // Return an array of invoice items.
585 585
         $items = array();
586 586
 
587
-        foreach ( $invoice->get_items() as $item ) {
588
-            $items[] = $item->prepare_data_for_invoice_edit_ajax(  $invoice->get_currency()  );
587
+        foreach ($invoice->get_items() as $item) {
588
+            $items[] = $item->prepare_data_for_invoice_edit_ajax($invoice->get_currency());
589 589
         }
590 590
 
591
-        wp_send_json_success( compact( 'items' ) );
591
+        wp_send_json_success(compact('items'));
592 592
     }
593 593
 
594 594
     /**
@@ -597,39 +597,39 @@  discard block
 block discarded – undo
597 597
     public static function add_invoice_items() {
598 598
 
599 599
         // Verify nonce.
600
-        check_ajax_referer( 'wpinv-nonce' );
600
+        check_ajax_referer('wpinv-nonce');
601 601
 
602
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
602
+        if (!wpinv_current_user_can_manage_invoicing()) {
603 603
             exit;
604 604
         }
605 605
 
606 606
         // We need an invoice and items.
607
-        if ( empty( $_POST['post_id'] ) || empty( $_POST['items'] ) ) {
607
+        if (empty($_POST['post_id']) || empty($_POST['items'])) {
608 608
             exit;
609 609
         }
610 610
 
611 611
         // Fetch the invoice.
612
-        $invoice = new WPInv_Invoice( trim( $_POST['post_id'] ) );
612
+        $invoice = new WPInv_Invoice(trim($_POST['post_id']));
613 613
         $alert   = false;
614 614
 
615 615
         // Ensure it exists and its not been paid for.
616
-        if ( ! $invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded() ) {
616
+        if (!$invoice->get_id() || $invoice->is_paid() || $invoice->is_refunded()) {
617 617
             exit;
618 618
         }
619 619
 
620 620
         // Add the items.
621
-        foreach ( $_POST['items'] as $data ) {
621
+        foreach ($_POST['items'] as $data) {
622 622
 
623
-            $item = new GetPaid_Form_Item( $data[ 'id' ] );
623
+            $item = new GetPaid_Form_Item($data['id']);
624 624
 
625
-            if ( is_numeric( $data[ 'qty' ] ) && (float) $data[ 'qty' ] > 0 ) {
626
-                $item->set_quantity( $data[ 'qty' ] );
625
+            if (is_numeric($data['qty']) && (float) $data['qty'] > 0) {
626
+                $item->set_quantity($data['qty']);
627 627
             }
628 628
 
629
-            if ( $item->get_id() > 0 ) {
630
-                $error = $invoice->add_item( $item );
629
+            if ($item->get_id() > 0) {
630
+                $error = $invoice->add_item($item);
631 631
 
632
-                if ( is_wp_error( $error ) ) {
632
+                if (is_wp_error($error)) {
633 633
                     $alert = $error->get_error_message();
634 634
                 }
635 635
 
@@ -644,11 +644,11 @@  discard block
 block discarded – undo
644 644
         // Return an array of invoice items.
645 645
         $items = array();
646 646
 
647
-        foreach ( $invoice->get_items() as $item ) {
648
-            $items[] = $item->prepare_data_for_invoice_edit_ajax( $invoice->get_currency() );
647
+        foreach ($invoice->get_items() as $item) {
648
+            $items[] = $item->prepare_data_for_invoice_edit_ajax($invoice->get_currency());
649 649
         }
650 650
 
651
-        wp_send_json_success( compact( 'items', 'alert' ) );
651
+        wp_send_json_success(compact('items', 'alert'));
652 652
     }
653 653
 
654 654
     /**
@@ -657,15 +657,15 @@  discard block
 block discarded – undo
657 657
     public static function get_invoicing_items() {
658 658
 
659 659
         // Verify nonce.
660
-        check_ajax_referer( 'wpinv-nonce' );
660
+        check_ajax_referer('wpinv-nonce');
661 661
 
662
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
662
+        if (!wpinv_current_user_can_manage_invoicing()) {
663 663
             exit;
664 664
         }
665 665
 
666 666
         // We need a search term.
667
-        if ( empty( $_GET['search'] ) ) {
668
-            wp_send_json_success( array() );
667
+        if (empty($_GET['search'])) {
668
+            wp_send_json_success(array());
669 669
         }
670 670
 
671 671
         // Retrieve items.
@@ -674,8 +674,8 @@  discard block
 block discarded – undo
674 674
             'orderby'        => 'title',
675 675
             'order'          => 'ASC',
676 676
             'posts_per_page' => -1,
677
-            'post_status'    => array( 'publish' ),
678
-            's'              => trim( $_GET['search'] ),
677
+            'post_status'    => array('publish'),
678
+            's'              => trim($_GET['search']),
679 679
             'meta_query'     => array(
680 680
                 array(
681 681
                     'key'       => '_wpinv_type',
@@ -685,22 +685,22 @@  discard block
 block discarded – undo
685 685
             )
686 686
         );
687 687
 
688
-        $items = get_posts( apply_filters( 'getpaid_ajax_invoice_items_query_args', $item_args ) );
688
+        $items = get_posts(apply_filters('getpaid_ajax_invoice_items_query_args', $item_args));
689 689
         $data  = array();
690 690
 
691 691
 
692
-        $is_payment_form = ( ! empty( $_GET['post_id'] ) && 'wpi_payment_form' == get_post_type( $_GET['post_id'] ) );
692
+        $is_payment_form = (!empty($_GET['post_id']) && 'wpi_payment_form' == get_post_type($_GET['post_id']));
693 693
 
694
-        foreach ( $items as $item ) {
695
-            $item      = new GetPaid_Form_Item( $item );
694
+        foreach ($items as $item) {
695
+            $item = new GetPaid_Form_Item($item);
696 696
             $data[] = array(
697 697
                 'id'        => (int) $item->get_id(),
698
-                'text'      => strip_tags( $item->get_name() ),
699
-                'form_data' => $is_payment_form ? $item->prepare_data_for_use( false ) : '',
698
+                'text'      => strip_tags($item->get_name()),
699
+                'form_data' => $is_payment_form ? $item->prepare_data_for_use(false) : '',
700 700
             );
701 701
         }
702 702
 
703
-        wp_send_json_success( $data );
703
+        wp_send_json_success($data);
704 704
 
705 705
     }
706 706
 
@@ -710,37 +710,37 @@  discard block
 block discarded – undo
710 710
     public static function get_customers() {
711 711
 
712 712
         // Verify nonce.
713
-        check_ajax_referer( 'wpinv-nonce' );
713
+        check_ajax_referer('wpinv-nonce');
714 714
 
715
-        if ( ! wpinv_current_user_can_manage_invoicing() ) {
715
+        if (!wpinv_current_user_can_manage_invoicing()) {
716 716
             exit;
717 717
         }
718 718
 
719 719
         // We need a search term.
720
-        if ( empty( $_GET['search'] ) ) {
721
-            wp_send_json_success( array() );
720
+        if (empty($_GET['search'])) {
721
+            wp_send_json_success(array());
722 722
         }
723 723
 
724 724
         // Retrieve customers.
725 725
     
726 726
         $customer_args = array(
727
-            'fields'         => array( 'ID', 'user_email', 'display_name' ),
727
+            'fields'         => array('ID', 'user_email', 'display_name'),
728 728
             'orderby'        => 'display_name',
729
-            'search'         => '*' . sanitize_text_field( $_GET['search'] ) . '*',
730
-            'search_columns' => array( 'user_login', 'user_email', 'display_name' ),
729
+            'search'         => '*' . sanitize_text_field($_GET['search']) . '*',
730
+            'search_columns' => array('user_login', 'user_email', 'display_name'),
731 731
         );
732 732
 
733
-        $customers = get_users( apply_filters( 'getpaid_ajax_invoice_customers_query_args', $customer_args ) );
733
+        $customers = get_users(apply_filters('getpaid_ajax_invoice_customers_query_args', $customer_args));
734 734
         $data      = array();
735 735
 
736
-        foreach ( $customers as $customer ) {
736
+        foreach ($customers as $customer) {
737 737
             $data[] = array(
738 738
                 'id'        => (int) $customer->ID,
739
-                'text'      => strip_tags( sprintf( _x( '%1$s (%2$s)', 'user dropdown', 'invoicing' ), $customer->display_name, $customer->user_email ) ),
739
+                'text'      => strip_tags(sprintf(_x('%1$s (%2$s)', 'user dropdown', 'invoicing'), $customer->display_name, $customer->user_email)),
740 740
             );
741 741
         }
742 742
 
743
-        wp_send_json_success( $data );
743
+        wp_send_json_success($data);
744 744
 
745 745
     }
746 746
 
@@ -750,28 +750,28 @@  discard block
 block discarded – undo
750 750
     public static function get_aui_states_field() {
751 751
 
752 752
         // Verify nonce.
753
-        check_ajax_referer( 'wpinv-nonce' );
753
+        check_ajax_referer('wpinv-nonce');
754 754
 
755 755
         // We need a country.
756
-        if ( empty( $_GET['country'] ) ) {
756
+        if (empty($_GET['country'])) {
757 757
             exit;
758 758
         }
759 759
 
760
-        $states = wpinv_get_country_states( sanitize_text_field( $_GET['country'] ) );
761
-        $state  = isset( $_GET['state'] ) ? sanitize_text_field( $_GET['state'] ) : wpinv_get_default_state();
762
-        $name   = isset( $_GET['name'] ) ? sanitize_text_field( $_GET['name'] ) : 'wpinv_state';
763
-        $class  = isset( $_GET['class'] ) ? sanitize_text_field( $_GET['class'] ) : 'form-control-sm';
760
+        $states = wpinv_get_country_states(sanitize_text_field($_GET['country']));
761
+        $state  = isset($_GET['state']) ? sanitize_text_field($_GET['state']) : wpinv_get_default_state();
762
+        $name   = isset($_GET['name']) ? sanitize_text_field($_GET['name']) : 'wpinv_state';
763
+        $class  = isset($_GET['class']) ? sanitize_text_field($_GET['class']) : 'form-control-sm';
764 764
 
765
-        if ( empty( $states ) ) {
765
+        if (empty($states)) {
766 766
 
767 767
             $html = aui()->input(
768 768
                 array(
769 769
                     'type'        => 'text',
770 770
                     'id'          => 'wpinv_state',
771 771
                     'name'        => $name,
772
-                    'label'       => __( 'State', 'invoicing' ),
772
+                    'label'       => __('State', 'invoicing'),
773 773
                     'label_type'  => 'vertical',
774
-                    'placeholder' => __( 'State', 'invoicing' ),
774
+                    'placeholder' => __('State', 'invoicing'),
775 775
                     'class'       => $class,
776 776
                     'value'       => $state,
777 777
                 )
@@ -783,9 +783,9 @@  discard block
 block discarded – undo
783 783
                 array(
784 784
                     'id'          => 'wpinv_state',
785 785
                     'name'        => $name,
786
-                    'label'       => __( 'State', 'invoicing' ),
786
+                    'label'       => __('State', 'invoicing'),
787 787
                     'label_type'  => 'vertical',
788
-                    'placeholder' => __( 'Select a state', 'invoicing' ),
788
+                    'placeholder' => __('Select a state', 'invoicing'),
789 789
                     'class'       => $class,
790 790
                     'value'       => $state,
791 791
                     'options'     => $states,
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
         wp_send_json_success(
800 800
             array(
801 801
                 'html'   => $html,
802
-                'select' => ! empty ( $states )
802
+                'select' => !empty ($states)
803 803
             )
804 804
         );
805 805
 
@@ -813,11 +813,11 @@  discard block
 block discarded – undo
813 813
     public static function payment_form_refresh_prices() {
814 814
 
815 815
         // Check nonce.
816
-        check_ajax_referer( 'getpaid_form_nonce' );
816
+        check_ajax_referer('getpaid_form_nonce');
817 817
 
818 818
         // ... form fields...
819
-        if ( empty( $_POST['getpaid_payment_form_submission'] ) ) {
820
-            _e( 'Error: Reload the page and try again.', 'invoicing' );
819
+        if (empty($_POST['getpaid_payment_form_submission'])) {
820
+            _e('Error: Reload the page and try again.', 'invoicing');
821 821
             exit;
822 822
         }
823 823
 
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
         $submission = new GetPaid_Payment_Form_Submission();
826 826
 
827 827
         // Do we have an error?
828
-        if ( ! empty( $submission->last_error ) ) {
828
+        if (!empty($submission->last_error)) {
829 829
             wp_send_json_error(
830 830
                 array(
831 831
                     'code'  => $submission->last_error_code,
@@ -835,12 +835,12 @@  discard block
 block discarded – undo
835 835
         }
836 836
 
837 837
         // Prepare the response.
838
-        $response = new GetPaid_Payment_Form_Submission_Refresh_Prices( $submission );
838
+        $response = new GetPaid_Payment_Form_Submission_Refresh_Prices($submission);
839 839
 
840 840
         // Filter the response.
841
-        $response = apply_filters( 'getpaid_payment_form_ajax_refresh_prices', $response->response, $submission );
841
+        $response = apply_filters('getpaid_payment_form_ajax_refresh_prices', $response->response, $submission);
842 842
 
843
-        wp_send_json_success( $response );
843
+        wp_send_json_success($response);
844 844
     }
845 845
 
846 846
 }
Please login to merge, or discard this patch.