Passed
Push — master ( e60b65...f2523a )
by Brian
05:03
created
includes/admin/meta-boxes/class-getpaid-meta-box-invoice-payment-meta.php 1 patch
Indentation   +141 added lines, -141 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_Payment_Meta {
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.
@@ -42,163 +42,163 @@  discard block
 block discarded – undo
42 42
 
43 43
                         if ( $invoice->is_draft() ) {
44 44
 
45
-						// Set gateway.
46
-						aui()->select(
45
+                        // Set gateway.
46
+                        aui()->select(
47 47
                             array(
48
-						'id'               => 'wpinv_gateway',
49
-						'name'             => 'wpinv_gateway',
50
-						'label'            => __( 'Gateway:', 'invoicing' ),
51
-						'label_type'       => 'vertical',
52
-						'placeholder'      => __( 'Select Gateway', 'invoicing' ),
53
-						'value'            => wpinv_get_default_gateway(),
54
-						'select2'          => true,
55
-						'data-allow-clear' => 'false',
56
-						'options'          => wp_list_pluck( wpinv_get_enabled_payment_gateways( true ), 'admin_label' ),
48
+                        'id'               => 'wpinv_gateway',
49
+                        'name'             => 'wpinv_gateway',
50
+                        'label'            => __( 'Gateway:', 'invoicing' ),
51
+                        'label_type'       => 'vertical',
52
+                        'placeholder'      => __( 'Select Gateway', 'invoicing' ),
53
+                        'value'            => wpinv_get_default_gateway(),
54
+                        'select2'          => true,
55
+                        'data-allow-clear' => 'false',
56
+                        'options'          => wp_list_pluck( wpinv_get_enabled_payment_gateways( true ), 'admin_label' ),
57 57
                             ),
58 58
                             true
59 59
                         );
60 60
 
61 61
                         } else {
62
-						// Invoice key.
63
-						aui()->input(
62
+                        // Invoice key.
63
+                        aui()->input(
64 64
                             array(
65
-						'type'             => 'text',
66
-						'id'               => 'wpinv_key',
67
-						'name'             => 'wpinv_key',
68
-						'label'            => sprintf(
65
+                        'type'             => 'text',
66
+                        'id'               => 'wpinv_key',
67
+                        'name'             => 'wpinv_key',
68
+                        'label'            => sprintf(
69 69
                             __( '%s Key:', 'invoicing' ),
70 70
                             ucfirst( $invoice->get_invoice_quote_type() )
71
-						),
72
-						'label_type'       => 'vertical',
73
-						'class'            => 'form-control-sm',
74
-						'value'            => $invoice->get_key( 'edit' ),
75
-						'extra_attributes' => array(
71
+                        ),
72
+                        'label_type'       => 'vertical',
73
+                        'class'            => 'form-control-sm',
74
+                        'value'            => $invoice->get_key( 'edit' ),
75
+                        'extra_attributes' => array(
76 76
                             'onclick'  => 'this.select();',
77 77
                             'readonly' => 'true',
78
-						),
78
+                        ),
79 79
                             ),
80 80
                             true
81
-						);
81
+                        );
82 82
 
83
-						// View URL.
84
-						aui()->input(
83
+                        // View URL.
84
+                        aui()->input(
85 85
                             array(
86
-						'type'             => 'text',
87
-						'id'               => 'wpinv_view_url',
88
-						'name'             => 'wpinv_view_url',
89
-						'label'            => sprintf(
86
+                        'type'             => 'text',
87
+                        'id'               => 'wpinv_view_url',
88
+                        'name'             => 'wpinv_view_url',
89
+                        'label'            => sprintf(
90 90
                             __( '%s URL:', 'invoicing' ),
91 91
                             ucfirst( $invoice->get_invoice_quote_type() )
92
-						) . '&nbsp;<a href="' . esc_url_raw( $invoice->get_view_url() ) . '" title="' . __( 'View invoice', 'invoicing' ) . '" target="_blank"><i class="fas fa-external-link-alt fa-fw"></i></a>',
93
-						'label_type'       => 'vertical',
94
-						'class'            => 'form-control-sm',
95
-						'value'            => $invoice->get_view_url(),
96
-						'extra_attributes' => array(
92
+                        ) . '&nbsp;<a href="' . esc_url_raw( $invoice->get_view_url() ) . '" title="' . __( 'View invoice', 'invoicing' ) . '" target="_blank"><i class="fas fa-external-link-alt fa-fw"></i></a>',
93
+                        'label_type'       => 'vertical',
94
+                        'class'            => 'form-control-sm',
95
+                        'value'            => $invoice->get_view_url(),
96
+                        'extra_attributes' => array(
97 97
                             'onclick'  => 'this.select();',
98 98
                             'readonly' => 'true',
99
-						),
99
+                        ),
100 100
                             ),
101 101
                             true
102
-						);
103
-
104
-						// If the invoice is paid...
105
-						if ( $invoice->is_paid() || $invoice->is_refunded() ) {
106
-
107
-							// Gateway.
108
-							aui()->input(
109
-								array(
110
-									'type'             => 'text',
111
-									'id'               => 'wpinv_gateway',
112
-									'name'             => '',
113
-									'label'            => __( 'Gateway:', 'invoicing' ),
114
-									'label_type'       => 'vertical',
115
-									'class'            => 'form-control-sm',
116
-									'value'            => wpinv_get_gateway_admin_label( $invoice->get_gateway( 'edit' ) ),
117
-									'extra_attributes' => array(
118
-										'onclick'  => 'this.select();',
119
-										'readonly' => 'true',
120
-									),
121
-								),
122
-								true
123
-							);
124
-
125
-							// Transaction ID.
126
-							$transaction_url = $invoice->get_transaction_url();
127
-							aui()->input(
128
-								array(
129
-									'type'             => 'text',
130
-									'id'               => 'wpinv_transaction_id',
131
-									'name'             => 'wpinv_transaction_id',
132
-									'label'            => __( 'Transaction ID:', 'invoicing' ) . ( $transaction_url ? '&nbsp;<a href="' . esc_url( $transaction_url ) . '" title="' . __( 'View details', 'invoicing' ) . '" target="_blank"><i class="fas fa-external-link-alt fa-fw"></i></a>' : '' ),
133
-									'label_type'       => 'vertical',
134
-									'class'            => 'form-control-sm',
135
-									'value'            => $invoice->get_transaction_id( 'edit' ),
136
-									'help_text'        => apply_filters( 'wpinv_invoice_transaction_link_' . $invoice->get_gateway( 'edit' ), '', $invoice->get_transaction_id(), $invoice ),
137
-									'extra_attributes' => array(
138
-										'onclick'  => 'this.select();',
139
-										'readonly' => 'true',
140
-									),
141
-								),
142
-								true
143
-							);
144
-
145
-							// Currency.
146
-							aui()->input(
147
-								array(
148
-									'type'             => 'text',
149
-									'id'               => 'wpinv_currency',
150
-									'name'             => 'wpinv_currency',
151
-									'label'            => __( 'Currency:', 'invoicing' ),
152
-									'label_type'       => 'vertical',
153
-									'class'            => 'form-control-sm',
154
-									'value'            => $invoice->get_currency( 'edit' ),
155
-									'extra_attributes' => array(
156
-										'onclick'  => 'this.select();',
157
-										'readonly' => 'true',
158
-									),
159
-								),
160
-								true
161
-							);
162
-
163
-						} else {
164
-
165
-							if ( 'wpi_invoice' == $invoice->get_post_type() ) {
166
-
167
-								// Payment URL.
168
-								aui()->input(
169
-									array(
170
-										'type'             => 'text',
171
-										'id'               => 'wpinv_payment_url',
172
-										'name'             => 'wpinv_payment_url',
173
-										'label'            => __( 'Payment URL:', 'invoicing' ),
174
-										'label_type'       => 'vertical',
175
-										'class'            => 'form-control-sm',
176
-										'value'            => $invoice->get_checkout_payment_url(),
177
-										'extra_attributes' => array(
178
-											'onclick'  => 'this.select();',
179
-											'readonly' => 'true',
180
-										),
181
-									),
182
-									true
183
-								);
184
-
185
-								// Set gateway.
186
-								aui()->select(
187
-									array(
188
-										'id'               => 'wpinv_gateway',
189
-										'name'             => 'wpinv_gateway',
190
-										'label'            => __( 'Gateway:', 'invoicing' ),
191
-										'label_type'       => 'vertical',
192
-										'placeholder'      => __( 'Select Gateway', 'invoicing' ),
193
-										'value'            => $invoice->get_gateway( 'edit' ),
194
-										'select2'          => true,
195
-										'data-allow-clear' => 'false',
196
-										'options'          => wp_list_pluck( wpinv_get_enabled_payment_gateways( true ), 'admin_label' ),
197
-									),
198
-									true
199
-								);
200
-
201
-							}
102
+                        );
103
+
104
+                        // If the invoice is paid...
105
+                        if ( $invoice->is_paid() || $invoice->is_refunded() ) {
106
+
107
+                            // Gateway.
108
+                            aui()->input(
109
+                                array(
110
+                                    'type'             => 'text',
111
+                                    'id'               => 'wpinv_gateway',
112
+                                    'name'             => '',
113
+                                    'label'            => __( 'Gateway:', 'invoicing' ),
114
+                                    'label_type'       => 'vertical',
115
+                                    'class'            => 'form-control-sm',
116
+                                    'value'            => wpinv_get_gateway_admin_label( $invoice->get_gateway( 'edit' ) ),
117
+                                    'extra_attributes' => array(
118
+                                        'onclick'  => 'this.select();',
119
+                                        'readonly' => 'true',
120
+                                    ),
121
+                                ),
122
+                                true
123
+                            );
124
+
125
+                            // Transaction ID.
126
+                            $transaction_url = $invoice->get_transaction_url();
127
+                            aui()->input(
128
+                                array(
129
+                                    'type'             => 'text',
130
+                                    'id'               => 'wpinv_transaction_id',
131
+                                    'name'             => 'wpinv_transaction_id',
132
+                                    'label'            => __( 'Transaction ID:', 'invoicing' ) . ( $transaction_url ? '&nbsp;<a href="' . esc_url( $transaction_url ) . '" title="' . __( 'View details', 'invoicing' ) . '" target="_blank"><i class="fas fa-external-link-alt fa-fw"></i></a>' : '' ),
133
+                                    'label_type'       => 'vertical',
134
+                                    'class'            => 'form-control-sm',
135
+                                    'value'            => $invoice->get_transaction_id( 'edit' ),
136
+                                    'help_text'        => apply_filters( 'wpinv_invoice_transaction_link_' . $invoice->get_gateway( 'edit' ), '', $invoice->get_transaction_id(), $invoice ),
137
+                                    'extra_attributes' => array(
138
+                                        'onclick'  => 'this.select();',
139
+                                        'readonly' => 'true',
140
+                                    ),
141
+                                ),
142
+                                true
143
+                            );
144
+
145
+                            // Currency.
146
+                            aui()->input(
147
+                                array(
148
+                                    'type'             => 'text',
149
+                                    'id'               => 'wpinv_currency',
150
+                                    'name'             => 'wpinv_currency',
151
+                                    'label'            => __( 'Currency:', 'invoicing' ),
152
+                                    'label_type'       => 'vertical',
153
+                                    'class'            => 'form-control-sm',
154
+                                    'value'            => $invoice->get_currency( 'edit' ),
155
+                                    'extra_attributes' => array(
156
+                                        'onclick'  => 'this.select();',
157
+                                        'readonly' => 'true',
158
+                                    ),
159
+                                ),
160
+                                true
161
+                            );
162
+
163
+                        } else {
164
+
165
+                            if ( 'wpi_invoice' == $invoice->get_post_type() ) {
166
+
167
+                                // Payment URL.
168
+                                aui()->input(
169
+                                    array(
170
+                                        'type'             => 'text',
171
+                                        'id'               => 'wpinv_payment_url',
172
+                                        'name'             => 'wpinv_payment_url',
173
+                                        'label'            => __( 'Payment URL:', 'invoicing' ),
174
+                                        'label_type'       => 'vertical',
175
+                                        'class'            => 'form-control-sm',
176
+                                        'value'            => $invoice->get_checkout_payment_url(),
177
+                                        'extra_attributes' => array(
178
+                                            'onclick'  => 'this.select();',
179
+                                            'readonly' => 'true',
180
+                                        ),
181
+                                    ),
182
+                                    true
183
+                                );
184
+
185
+                                // Set gateway.
186
+                                aui()->select(
187
+                                    array(
188
+                                        'id'               => 'wpinv_gateway',
189
+                                        'name'             => 'wpinv_gateway',
190
+                                        'label'            => __( 'Gateway:', 'invoicing' ),
191
+                                        'label_type'       => 'vertical',
192
+                                        'placeholder'      => __( 'Select Gateway', 'invoicing' ),
193
+                                        'value'            => $invoice->get_gateway( 'edit' ),
194
+                                        'select2'          => true,
195
+                                        'data-allow-clear' => 'false',
196
+                                        'options'          => wp_list_pluck( wpinv_get_enabled_payment_gateways( true ), 'admin_label' ),
197
+                                    ),
198
+                                    true
199
+                                );
200
+
201
+                            }
202 202
 }
203 203
                         }
204 204
                     ?>
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-item-details.php 1 patch
Indentation   +38 added lines, -38 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_Item_Details {
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 item.
@@ -114,23 +114,23 @@  discard block
 block discarded – undo
114 114
                                 // Dynamic pricing.
115 115
                                 if ( $item->supports_dynamic_pricing() ) {
116 116
 
117
-								do_action( 'wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item );
117
+                                do_action( 'wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item );
118 118
 
119
-								// NYP toggle.
120
-								aui()->input(
119
+                                // NYP toggle.
120
+                                aui()->input(
121 121
                                     array(
122
-								'id'      => 'wpinv_name_your_price',
123
-								'name'    => 'wpinv_name_your_price',
124
-								'type'    => 'checkbox',
125
-								'label'   => apply_filters( 'wpinv_name_your_price_toggle_text', __( 'Let customers name their price', 'invoicing' ) ),
126
-								'value'   => '1',
127
-								'checked' => $item->user_can_set_their_price(),
128
-								'no_wrap' => true,
122
+                                'id'      => 'wpinv_name_your_price',
123
+                                'name'    => 'wpinv_name_your_price',
124
+                                'type'    => 'checkbox',
125
+                                'label'   => apply_filters( 'wpinv_name_your_price_toggle_text', __( 'Let customers name their price', 'invoicing' ) ),
126
+                                'value'   => '1',
127
+                                'checked' => $item->user_can_set_their_price(),
128
+                                'no_wrap' => true,
129 129
                                     ),
130 130
                                     true
131 131
                                 );
132 132
 
133
-							do_action( 'wpinv_item_details_metabox_dynamic_pricing_checkbox', $item );
133
+                            do_action( 'wpinv_item_details_metabox_dynamic_pricing_checkbox', $item );
134 134
 
135 135
                                 }
136 136
 
@@ -274,35 +274,35 @@  discard block
 block discarded – undo
274 274
     }
275 275
 
276 276
     /**
277
-	 * Save meta box data.
278
-	 *
279
-	 * @param int $post_id
280
-	 */
281
-	public static function save( $post_id ) {
277
+     * Save meta box data.
278
+     *
279
+     * @param int $post_id
280
+     */
281
+    public static function save( $post_id ) {
282 282
 
283 283
         // Prepare the item.
284 284
         $item = new WPInv_Item( $post_id );
285 285
 
286 286
         // Load new data.
287 287
         $item->set_props(
288
-			array(
289
-				'price'              => isset( $_POST['wpinv_item_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_item_price'] ) : null,
290
-				'vat_rule'           => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null,
291
-				'vat_class'          => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null,
292
-				'type'               => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null,
293
-				'is_dynamic_pricing' => ! empty( $_POST['wpinv_name_your_price'] ),
288
+            array(
289
+                'price'              => isset( $_POST['wpinv_item_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_item_price'] ) : null,
290
+                'vat_rule'           => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null,
291
+                'vat_class'          => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null,
292
+                'type'               => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null,
293
+                'is_dynamic_pricing' => ! empty( $_POST['wpinv_name_your_price'] ),
294 294
                 'minimum_price'      => isset( $_POST['wpinv_minimum_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_minimum_price'] ) : null,
295
-				'is_recurring'       => ! empty( $_POST['wpinv_is_recurring'] ),
296
-				'recurring_period'   => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null,
297
-				'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : 1,
298
-				'recurring_limit'    => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null,
299
-				'is_free_trial'      => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null,
300
-				'trial_period'       => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null,
301
-				'trial_interval'     => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null,
302
-			)
295
+                'is_recurring'       => ! empty( $_POST['wpinv_is_recurring'] ),
296
+                'recurring_period'   => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null,
297
+                'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : 1,
298
+                'recurring_limit'    => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null,
299
+                'is_free_trial'      => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null,
300
+                'trial_period'       => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null,
301
+                'trial_interval'     => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null,
302
+            )
303 303
         );
304 304
 
305
-		$item->save();
306
-		do_action( 'getpaid_item_metabox_save', $post_id, $item );
307
-	}
305
+        $item->save();
306
+        do_action( 'getpaid_item_metabox_save', $post_id, $item );
307
+    }
308 308
 }
Please login to merge, or discard this patch.
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/line-totals.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -39,40 +39,40 @@
 block discarded – undo
39 39
                                 if ( 'tax' == $key ) {
40 40
                                     wpinv_the_price( $invoice->get_total_tax(), $invoice->get_currency() );
41 41
 
42
-								if ( wpinv_use_taxes() && ! $invoice->get_disable_taxes() ) {
42
+                                if ( wpinv_use_taxes() && ! $invoice->get_disable_taxes() ) {
43 43
 
44
-									$taxes = $invoice->get_total_tax();
45
-									if ( empty( $taxes ) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $invoice->get_country() ) ) {
46
-										echo ' <em class="text-muted small">';
47
-										_x( '(Reverse charged)', 'This is a legal term for reverse charging tax in the EU', 'invoicing' );
48
-										echo '</em>';
44
+                                    $taxes = $invoice->get_total_tax();
45
+                                    if ( empty( $taxes ) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $invoice->get_country() ) ) {
46
+                                        echo ' <em class="text-muted small">';
47
+                                        _x( '(Reverse charged)', 'This is a legal term for reverse charging tax in the EU', 'invoicing' );
48
+                                        echo '</em>';
49 49
                                         }
50 50
 }
51 51
 }
52 52
 
53 53
                                 // Total Fee.
54 54
                                 if ( 'fee' == $key ) {
55
-								wpinv_the_price( $invoice->get_total_fees(), $invoice->get_currency() );
55
+                                wpinv_the_price( $invoice->get_total_fees(), $invoice->get_currency() );
56 56
                                 }
57 57
 
58 58
                                 // Total discount.
59 59
                                 if ( 'discount' == $key ) {
60
-								wpinv_the_price( $invoice->get_total_discount(), $invoice->get_currency() );
60
+                                wpinv_the_price( $invoice->get_total_discount(), $invoice->get_currency() );
61 61
                                 }
62 62
 
63 63
                                 // Shipping.
64 64
                                 if ( 'shipping' == $key ) {
65
-								wpinv_the_price( $invoice->get_shipping(), $invoice->get_currency() );
65
+                                wpinv_the_price( $invoice->get_shipping(), $invoice->get_currency() );
66 66
                                 }
67 67
 
68 68
                                 // Sub total.
69 69
                                 if ( 'subtotal' == $key ) {
70
-								wpinv_the_price( $invoice->get_subtotal(), $invoice->get_currency() );
70
+                                wpinv_the_price( $invoice->get_subtotal(), $invoice->get_currency() );
71 71
                                 }
72 72
 
73 73
                                 // Total.
74 74
                                 if ( 'total' == $key ) {
75
-								wpinv_the_price( $invoice->get_total(), $invoice->get_currency() );
75
+                                wpinv_the_price( $invoice->get_total(), $invoice->get_currency() );
76 76
                                 }
77 77
 
78 78
                                 // Fires when printing a cart total.
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/payment-forms/form.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
         // And the optional invoice id.
50 50
         if ( ! empty( $form->invoice ) ) {
51
-		    getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() );
51
+            getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() );
52 52
         }
53 53
 
54 54
         // We also want to include the form id.
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
 
69 69
                     foreach ( $form->get_elements() as $element ) {
70 70
 
71
-					if ( isset( $element['type'] ) ) {
72
-						$grid_class = getpaid_get_form_element_grid_class( $element );
73
-						echo "<div class='" . esc_attr( $grid_class ) . "'>";
74
-						do_action( 'getpaid_payment_form_element', $element, $form );
75
-						do_action( "getpaid_payment_form_element_{$element['type']}_template", $element, $form );
76
-						echo '</div>';
71
+                    if ( isset( $element['type'] ) ) {
72
+                        $grid_class = getpaid_get_form_element_grid_class( $element );
73
+                        echo "<div class='" . esc_attr( $grid_class ) . "'>";
74
+                        do_action( 'getpaid_payment_form_element', $element, $form );
75
+                        do_action( "getpaid_payment_form_element_{$element['type']}_template", $element, $form );
76
+                        echo '</div>';
77 77
                         }
78 78
 }
79 79
 
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.