Passed
Push — master ( 3f789e...c58b71 )
by Brian
04:52
created
includes/payments/class-getpaid-checkout.php 1 patch
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * Main Checkout Class.
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 * 
23 23
 	 * @param GetPaid_Payment_Form_Submission $submission
24 24
 	 */
25
-	public function __construct( $submission ) {
25
+	public function __construct($submission) {
26 26
 		$this->payment_form_submission = $submission;
27 27
 	}
28 28
 
@@ -38,22 +38,22 @@  discard block
 block discarded – undo
38 38
 		// Prepare the invoice.
39 39
 		$items      = $this->get_submission_items();
40 40
 		$invoice    = $this->get_submission_invoice();
41
-		$invoice    = $this->process_submission_invoice( $invoice, $items );
41
+		$invoice    = $this->process_submission_invoice($invoice, $items);
42 42
 		$prepared   = $this->prepare_submission_data_for_saving();
43 43
 
44
-		$this->prepare_billing_info( $invoice );
44
+		$this->prepare_billing_info($invoice);
45 45
 
46
-		$shipping   = $this->prepare_shipping_info( $invoice );
46
+		$shipping = $this->prepare_shipping_info($invoice);
47 47
 
48 48
 		// Save the invoice.
49
-		$invoice->set_is_viewed( true );
49
+		$invoice->set_is_viewed(true);
50 50
 		$invoice->recalculate_total();
51 51
         $invoice->save();
52 52
 
53
-		do_action( 'getpaid_checkout_invoice_updated', $invoice );
53
+		do_action('getpaid_checkout_invoice_updated', $invoice);
54 54
 
55 55
 		// Send to the gateway.
56
-		$this->post_process_submission( $invoice, $prepared, $shipping );
56
+		$this->post_process_submission($invoice, $prepared, $shipping);
57 57
 	}
58 58
 
59 59
 	/**
@@ -66,34 +66,34 @@  discard block
 block discarded – undo
66 66
 		$data       = $submission->get_data();
67 67
 
68 68
 		// Do we have an error?
69
-        if ( ! empty( $submission->last_error ) ) {
70
-			wp_send_json_error( $submission->last_error );
69
+        if (!empty($submission->last_error)) {
70
+			wp_send_json_error($submission->last_error);
71 71
         }
72 72
 
73 73
 		// We need a billing email.
74
-        if ( ! $submission->has_billing_email() ) {
75
-            wp_send_json_error( __( 'Provide a valid billing email.', 'invoicing' ) );
74
+        if (!$submission->has_billing_email()) {
75
+            wp_send_json_error(__('Provide a valid billing email.', 'invoicing'));
76 76
 		}
77 77
 
78 78
 		// Non-recurring gateways should not be allowed to process recurring invoices.
79
-		if ( $submission->should_collect_payment_details() && $submission->has_recurring && ! wpinv_gateway_support_subscription( $data['wpi-gateway'] ) ) {
80
-			wp_send_json_error( __( 'The selected payment gateway does not support subscription payments.', 'invoicing' ) );
79
+		if ($submission->should_collect_payment_details() && $submission->has_recurring && !wpinv_gateway_support_subscription($data['wpi-gateway'])) {
80
+			wp_send_json_error(__('The selected payment gateway does not support subscription payments.', 'invoicing'));
81 81
 		}
82 82
 
83 83
 		// Ensure the gateway is active.
84
-		if ( $submission->should_collect_payment_details() && ! wpinv_is_gateway_active( $data['wpi-gateway'] ) ) {
85
-			wpinv_set_error( 'invalid_gateway', __( 'The selected payment gateway is not active', 'invoicing' ) );
84
+		if ($submission->should_collect_payment_details() && !wpinv_is_gateway_active($data['wpi-gateway'])) {
85
+			wpinv_set_error('invalid_gateway', __('The selected payment gateway is not active', 'invoicing'));
86 86
 		}
87 87
 
88 88
 		// Clear any existing errors.
89 89
 		wpinv_clear_errors();
90 90
 
91 91
 		// Allow themes and plugins to hook to errors
92
-		do_action( 'getpaid_checkout_error_checks', $submission );
92
+		do_action('getpaid_checkout_error_checks', $submission);
93 93
 
94 94
 		// Do we have any errors?
95
-        if ( wpinv_get_errors() ) {
96
-            wp_send_json_error( getpaid_get_errors_html() );
95
+        if (wpinv_get_errors()) {
96
+            wp_send_json_error(getpaid_get_errors_html());
97 97
 		}
98 98
 
99 99
 	}
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 		$items = $this->payment_form_submission->get_items();
109 109
 
110 110
         // Ensure that we have items.
111
-        if ( empty( $items ) && ! $this->payment_form_submission->has_fees() ) {
112
-            wp_send_json_error( __( 'Please provide at least one item or amount.', 'invoicing' ) );
111
+        if (empty($items) && !$this->payment_form_submission->has_fees()) {
112
+            wp_send_json_error(__('Please provide at least one item or amount.', 'invoicing'));
113 113
 		}
114 114
 
115 115
 		return $items;
@@ -123,17 +123,17 @@  discard block
 block discarded – undo
123 123
 	protected function get_submission_invoice() {
124 124
 		$submission = $this->payment_form_submission;
125 125
 
126
-		if ( ! $submission->has_invoice() ) {
126
+		if (!$submission->has_invoice()) {
127 127
 			$invoice = new WPInv_Invoice();
128
-			$invoice->set_created_via( 'payment_form' );
128
+			$invoice->set_created_via('payment_form');
129 129
 			return $invoice;
130 130
         }
131 131
 
132 132
 		$invoice = $submission->get_invoice();
133 133
 
134 134
 		// Make sure that it is neither paid or refunded.
135
-		if ( $invoice->is_paid() || $invoice->is_refunded() ) {
136
-			wp_send_json_error( __( 'This invoice has already been paid for.', 'invoicing' ) );
135
+		if ($invoice->is_paid() || $invoice->is_refunded()) {
136
+			wp_send_json_error(__('This invoice has already been paid for.', 'invoicing'));
137 137
 		}
138 138
 
139 139
 		return $invoice;
@@ -146,29 +146,29 @@  discard block
 block discarded – undo
146 146
 	 * @param GetPaid_Form_Item[] $items
147 147
 	 * @return WPInv_Invoice
148 148
 	 */
149
-	protected function process_submission_invoice( $invoice, $items ) {
149
+	protected function process_submission_invoice($invoice, $items) {
150 150
 
151 151
 		$submission = $this->payment_form_submission;
152 152
 		$data       = $submission->get_data();
153 153
 
154 154
 		// Set-up the invoice details.
155
-		$invoice->set_email( sanitize_email( $submission->get_billing_email() ) );
156
-		$invoice->set_user_id( $this->get_submission_customer() );
157
-		$invoice->set_payment_form( absint( $submission->get_payment_form()->get_id() ) );
158
-        $invoice->set_items( $items );
159
-        $invoice->set_fees( $submission->get_fees() );
160
-        $invoice->set_taxes( $submission->get_taxes() );
161
-		$invoice->set_discounts( $submission->get_discounts() );
162
-		$invoice->set_gateway( $data['wpi-gateway'] );
163
-
164
-		$address_confirmed = $submission->get_field( 'confirm-address' );
165
-		$invoice->set_address_confirmed( ! empty( $address_confirmed ) );
166
-
167
-		if ( $submission->has_discount_code() ) {
168
-            $invoice->set_discount_code( $submission->get_discount_code() );
155
+		$invoice->set_email(sanitize_email($submission->get_billing_email()));
156
+		$invoice->set_user_id($this->get_submission_customer());
157
+		$invoice->set_payment_form(absint($submission->get_payment_form()->get_id()));
158
+        $invoice->set_items($items);
159
+        $invoice->set_fees($submission->get_fees());
160
+        $invoice->set_taxes($submission->get_taxes());
161
+		$invoice->set_discounts($submission->get_discounts());
162
+		$invoice->set_gateway($data['wpi-gateway']);
163
+
164
+		$address_confirmed = $submission->get_field('confirm-address');
165
+		$invoice->set_address_confirmed(!empty($address_confirmed));
166
+
167
+		if ($submission->has_discount_code()) {
168
+            $invoice->set_discount_code($submission->get_discount_code());
169 169
 		}
170 170
 
171
-		getpaid_maybe_add_default_address( $invoice );
171
+		getpaid_maybe_add_default_address($invoice);
172 172
 		return $invoice;
173 173
 	}
174 174
 
@@ -181,33 +181,33 @@  discard block
 block discarded – undo
181 181
 		$submission = $this->payment_form_submission;
182 182
 
183 183
 		// If this is an existing invoice...
184
-		if ( $submission->has_invoice() ) {
184
+		if ($submission->has_invoice()) {
185 185
 			return $submission->get_invoice()->get_user_id();
186 186
 		}
187 187
 
188 188
 		// (Maybe) create the user.
189 189
         $user = get_current_user_id();
190 190
 
191
-        if ( empty( $user ) ) {
192
-            $user = get_user_by( 'email', $submission->get_billing_email() );
191
+        if (empty($user)) {
192
+            $user = get_user_by('email', $submission->get_billing_email());
193 193
         }
194 194
 
195
-        if ( empty( $user ) ) {
196
-            $user = wpinv_create_user( $submission->get_billing_email() );
195
+        if (empty($user)) {
196
+            $user = wpinv_create_user($submission->get_billing_email());
197 197
 
198 198
 			// (Maybe) send new user notification.
199
-			$should_send_notification = wpinv_get_option( 'disable_new_user_emails' );
200
-			if ( ! empty( $user ) && is_numeric( $user ) && apply_filters( 'getpaid_send_new_user_notification', empty( $should_send_notification ), $user ) ) {
201
-				wp_send_new_user_notifications( $user, 'user' );
199
+			$should_send_notification = wpinv_get_option('disable_new_user_emails');
200
+			if (!empty($user) && is_numeric($user) && apply_filters('getpaid_send_new_user_notification', empty($should_send_notification), $user)) {
201
+				wp_send_new_user_notifications($user, 'user');
202 202
 			}
203 203
 
204 204
         }
205 205
 
206
-        if ( is_wp_error( $user ) ) {
207
-            wp_send_json_error( $user->get_error_message() );
206
+        if (is_wp_error($user)) {
207
+            wp_send_json_error($user->get_error_message());
208 208
         }
209 209
 
210
-        if ( is_numeric( $user ) ) {
210
+        if (is_numeric($user)) {
211 211
             return $user;
212 212
 		}
213 213
 
@@ -228,30 +228,30 @@  discard block
 block discarded – undo
228 228
         $prepared = array();
229 229
 
230 230
         // Raw submission details.
231
-		$data     = $submission->get_data();
231
+		$data = $submission->get_data();
232 232
 
233 233
 		// Loop through the submitted details.
234
-        foreach ( $submission->get_payment_form()->get_elements() as $field ) {
234
+        foreach ($submission->get_payment_form()->get_elements() as $field) {
235 235
 
236 236
 			// Skip premade fields.
237
-            if ( ! empty( $field['premade'] ) || $field['type'] == 'address' ) {
237
+            if (!empty($field['premade']) || $field['type'] == 'address') {
238 238
                 continue;
239 239
             }
240 240
 
241 241
             // If it is required and not set, abort.
242
-            if ( ! $submission->is_required_field_set( $field ) ) {
243
-                wp_send_json_error( __( 'Please fill all required fields.', 'invoicing' ) );
242
+            if (!$submission->is_required_field_set($field)) {
243
+                wp_send_json_error(__('Please fill all required fields.', 'invoicing'));
244 244
             }
245 245
 
246 246
             // Handle misc fields.
247
-            if ( isset( $data[ $field['id'] ] ) ) {
247
+            if (isset($data[$field['id']])) {
248 248
                 $label = $field['id'];
249 249
 
250
-                if ( isset( $field['label'] ) ) {
250
+                if (isset($field['label'])) {
251 251
                     $label = $field['label'];
252 252
                 }
253 253
 
254
-				$prepared[ wpinv_clean( $label ) ] = wp_kses_post( $data[ $field['id'] ] );
254
+				$prepared[wpinv_clean($label)] = wp_kses_post($data[$field['id']]);
255 255
 
256 256
             }
257 257
 
@@ -268,30 +268,30 @@  discard block
 block discarded – undo
268 268
 	 * @param WPInv_Invoice $invoice
269 269
 	 * @param string $type
270 270
      */
271
-    public function prepare_address_details( $invoice, $type = 'billing' ) {
271
+    public function prepare_address_details($invoice, $type = 'billing') {
272 272
 
273 273
 		$data     = $this->payment_form_submission->get_data();
274
-		$type     = sanitize_key( $type );
274
+		$type     = sanitize_key($type);
275 275
 		$address  = array();
276 276
 		$prepared = array();
277 277
 
278
-		if ( ! empty( $data[ $type ] ) ) {
279
-			$address = $data[ $type ];
278
+		if (!empty($data[$type])) {
279
+			$address = $data[$type];
280 280
 		}
281 281
 
282 282
 		// Clean address details.
283
-		foreach ( $address as $key => $value ) {
284
-			$key             = sanitize_key( $key );
285
-			$key             = str_replace( 'wpinv_', '', $key );
286
-			$value           = wpinv_clean( $value );
287
-			$prepared[ $key] = apply_filters( "getpaid_checkout_{$type}_address_$key", $value, $this->payment_form_submission, $invoice );
283
+		foreach ($address as $key => $value) {
284
+			$key             = sanitize_key($key);
285
+			$key             = str_replace('wpinv_', '', $key);
286
+			$value           = wpinv_clean($value);
287
+			$prepared[$key] = apply_filters("getpaid_checkout_{$type}_address_$key", $value, $this->payment_form_submission, $invoice);
288 288
 		}
289 289
 
290 290
 		// Filter address details.
291
-		$prepared = apply_filters( "getpaid_checkout_{$type}_address", $prepared, $this->payment_form_submission, $invoice );
291
+		$prepared = apply_filters("getpaid_checkout_{$type}_address", $prepared, $this->payment_form_submission, $invoice);
292 292
 
293 293
 		// Remove non-whitelisted values.
294
-		return array_filter( $prepared, 'getpaid_is_address_field_whitelisted', ARRAY_FILTER_USE_KEY );
294
+		return array_filter($prepared, 'getpaid_is_address_field_whitelisted', ARRAY_FILTER_USE_KEY);
295 295
 
296 296
 	}
297 297
 
@@ -301,12 +301,12 @@  discard block
 block discarded – undo
301 301
 	 * @return array
302 302
 	 * @param WPInv_Invoice $invoice
303 303
      */
304
-    protected function prepare_billing_info( &$invoice ) {
304
+    protected function prepare_billing_info(&$invoice) {
305 305
 
306
-		$billing_address = $this->prepare_address_details( $invoice, 'billing' );
306
+		$billing_address = $this->prepare_address_details($invoice, 'billing');
307 307
 
308 308
 		// Update the invoice with the billing details.
309
-		$invoice->set_props( $billing_address );
309
+		$invoice->set_props($billing_address);
310 310
 
311 311
 	}
312 312
 
@@ -316,15 +316,15 @@  discard block
 block discarded – undo
316 316
 	 * @return array
317 317
 	 * @param WPInv_Invoice $invoice
318 318
      */
319
-    protected function prepare_shipping_info( $invoice ) {
319
+    protected function prepare_shipping_info($invoice) {
320 320
 
321 321
 		$data = $this->payment_form_submission->get_data();
322 322
 
323
-		if ( empty( $data['same-shipping-address'] ) ) {
324
-			return $this->prepare_address_details( $invoice, 'shipping' );
323
+		if (empty($data['same-shipping-address'])) {
324
+			return $this->prepare_address_details($invoice, 'shipping');
325 325
 		}
326 326
 
327
-		return $this->prepare_address_details( $invoice, 'billing' );
327
+		return $this->prepare_address_details($invoice, 'billing');
328 328
 
329 329
 	}
330 330
 
@@ -335,31 +335,31 @@  discard block
 block discarded – undo
335 335
 	 * @param array $prepared_payment_form_data
336 336
 	 * @param array $shipping
337 337
 	 */
338
-	protected function post_process_submission( $invoice, $prepared_payment_form_data, $shipping ) {
338
+	protected function post_process_submission($invoice, $prepared_payment_form_data, $shipping) {
339 339
 
340 340
 		// Ensure the invoice exists.
341
-        if ( ! $invoice->exists() ) {
342
-            wp_send_json_error( __( 'An error occured while saving your invoice. Please try again.', 'invoicing' ) );
341
+        if (!$invoice->exists()) {
342
+            wp_send_json_error(__('An error occured while saving your invoice. Please try again.', 'invoicing'));
343 343
         }
344 344
 
345 345
 		// Save payment form data.
346
-		$prepared_payment_form_data = apply_filters( 'getpaid_prepared_payment_form_data', $prepared_payment_form_data, $invoice );
347
-        if ( ! empty( $prepared_payment_form_data ) ) {
348
-            update_post_meta( $invoice->get_id(), 'payment_form_data', $prepared_payment_form_data );
346
+		$prepared_payment_form_data = apply_filters('getpaid_prepared_payment_form_data', $prepared_payment_form_data, $invoice);
347
+        if (!empty($prepared_payment_form_data)) {
348
+            update_post_meta($invoice->get_id(), 'payment_form_data', $prepared_payment_form_data);
349 349
 		}
350 350
 
351 351
 		// Save payment form data.
352
-        if ( ! empty( $shipping ) ) {
353
-            update_post_meta( $invoice->get_id(), 'shipping_address', $shipping );
352
+        if (!empty($shipping)) {
353
+            update_post_meta($invoice->get_id(), 'shipping_address', $shipping);
354 354
 		}
355 355
 
356 356
 		// Backwards compatibility.
357
-        add_filter( 'wp_redirect', array( $this, 'send_redirect_response' ) );
357
+        add_filter('wp_redirect', array($this, 'send_redirect_response'));
358 358
 
359
-		$this->process_payment( $invoice );
359
+		$this->process_payment($invoice);
360 360
 
361 361
         // If we are here, there was an error.
362
-		wpinv_send_back_to_checkout( $invoice );
362
+		wpinv_send_back_to_checkout($invoice);
363 363
 
364 364
 	}
365 365
 
@@ -368,41 +368,41 @@  discard block
 block discarded – undo
368 368
 	 *
369 369
 	 * @param WPInv_Invoice $invoice
370 370
 	 */
371
-	protected function process_payment( $invoice ) {
371
+	protected function process_payment($invoice) {
372 372
 
373 373
 		// Clear any checkout errors.
374 374
 		wpinv_clear_errors();
375 375
 
376 376
 		// No need to send free invoices to the gateway.
377
-		if ( $invoice->is_free() ) {
378
-			$this->process_free_payment( $invoice );
377
+		if ($invoice->is_free()) {
378
+			$this->process_free_payment($invoice);
379 379
 		}
380 380
 
381 381
 		$submission = $this->payment_form_submission;
382 382
 
383 383
 		// Fires before sending to the gateway.
384
-		do_action( 'getpaid_checkout_before_gateway', $invoice, $submission );
384
+		do_action('getpaid_checkout_before_gateway', $invoice, $submission);
385 385
 
386 386
 		// Allow the sumission data to be modified before it is sent to the gateway.
387 387
 		$submission_data    = $submission->get_data();
388
-		$submission_gateway = apply_filters( 'getpaid_gateway_submission_gateway', $invoice->get_gateway(), $submission, $invoice );
389
-		$submission_data    = apply_filters( 'getpaid_gateway_submission_data', $submission_data, $submission, $invoice );
388
+		$submission_gateway = apply_filters('getpaid_gateway_submission_gateway', $invoice->get_gateway(), $submission, $invoice);
389
+		$submission_data    = apply_filters('getpaid_gateway_submission_data', $submission_data, $submission, $invoice);
390 390
 
391 391
 		// Validate the currency.
392
-		if ( ! apply_filters( "getpaid_gateway_{$submission_gateway}_is_valid_for_currency", true, $invoice->get_currency() ) ) {
393
-			wpinv_set_error( 'invalid_currency', __( 'The chosen payment gateway does not support this currency', 'invoicing' ) );
392
+		if (!apply_filters("getpaid_gateway_{$submission_gateway}_is_valid_for_currency", true, $invoice->get_currency())) {
393
+			wpinv_set_error('invalid_currency', __('The chosen payment gateway does not support this currency', 'invoicing'));
394 394
 		}
395 395
 
396 396
 		// Check to see if we have any errors.
397
-		if ( wpinv_get_errors() ) {
398
-			wpinv_send_back_to_checkout( $invoice );
397
+		if (wpinv_get_errors()) {
398
+			wpinv_send_back_to_checkout($invoice);
399 399
 		}
400 400
 
401 401
 		// Send info to the gateway for payment processing
402
-		do_action( "getpaid_gateway_$submission_gateway", $invoice, $submission_data, $submission );
402
+		do_action("getpaid_gateway_$submission_gateway", $invoice, $submission_data, $submission);
403 403
 
404 404
 		// Backwards compatibility.
405
-		wpinv_send_to_gateway( $submission_gateway, $invoice );
405
+		wpinv_send_to_gateway($submission_gateway, $invoice);
406 406
 
407 407
 	}
408 408
 
@@ -411,12 +411,12 @@  discard block
 block discarded – undo
411 411
 	 *
412 412
 	 * @param WPInv_Invoice $invoice
413 413
 	 */
414
-	protected function process_free_payment( $invoice ) {
414
+	protected function process_free_payment($invoice) {
415 415
 
416
-		$invoice->set_gateway( 'none' );
417
-		$invoice->add_note( __( "This is a free invoice and won't be sent to the payment gateway", 'invoicing' ), false, false, true );
416
+		$invoice->set_gateway('none');
417
+		$invoice->add_note(__("This is a free invoice and won't be sent to the payment gateway", 'invoicing'), false, false, true);
418 418
 		$invoice->mark_paid();
419
-		wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) );
419
+		wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key()));
420 420
 
421 421
 	}
422 422
 
@@ -424,9 +424,9 @@  discard block
 block discarded – undo
424 424
      * Sends a redrect response to payment details.
425 425
      *
426 426
      */
427
-    public function send_redirect_response( $url ) {
428
-        $url = urlencode( $url );
429
-        wp_send_json_success( $url );
427
+    public function send_redirect_response($url) {
428
+        $url = urlencode($url);
429
+        wp_send_json_success($url);
430 430
     }
431 431
 
432 432
 }
Please login to merge, or discard this patch.
includes/admin/views/wizard-header.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 $aui_settings = AyeCode_UI_Settings::instance();
10 10
 $aui_settings->enqueue_scripts();
@@ -17,15 +17,15 @@  discard block
 block discarded – undo
17 17
 		<head>
18 18
 			<meta name="viewport" content="width=device-width"/>
19 19
 			<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
20
-			<title><?php esc_html_e( 'GetPaid &rsaquo; Setup Wizard', 'invoicing' ); ?></title>
20
+			<title><?php esc_html_e('GetPaid &rsaquo; Setup Wizard', 'invoicing'); ?></title>
21 21
 			<?php
22 22
                 getpaid_admin()->enqeue_scripts();
23
-				wp_enqueue_style( 'font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(), 'v5.13.0' );
24
-				wp_print_styles( 'select2' );
25
-                wp_print_scripts( 'select2' );
26
-				wp_print_scripts( 'wpinv-admin-script' );
27
-                do_action( 'admin_print_styles' );
28
-                do_action( 'admin_head' );
23
+				wp_enqueue_style('font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(), 'v5.13.0');
24
+				wp_print_styles('select2');
25
+                wp_print_scripts('select2');
26
+				wp_print_scripts('wpinv-admin-script');
27
+                do_action('admin_print_styles');
28
+                do_action('admin_head');
29 29
 			?>
30 30
 			<style>
31 31
 				body, p{
@@ -37,21 +37,21 @@  discard block
 block discarded – undo
37 37
                     font-weight: 500;
38 38
                     margin-bottom: .1rem;
39 39
                 }
40
-				<?php echo $aui_settings::css_primary( '#009874', true ); ?>
40
+				<?php echo $aui_settings::css_primary('#009874', true); ?>
41 41
 			</style>
42 42
 		</head>
43 43
 
44 44
         <body class="gp-setup wp-core-ui bg-lightx mx-auto text-dark scrollbars-ios" style="background: #f3f6ff;">
45 45
 
46
-            <?php if ( isset( $_REQUEST['step'] ) ) : ?>
46
+            <?php if (isset($_REQUEST['step'])) : ?>
47 47
                 <ol class="gp-setup-steps mb-0 pb-4 mw-100 list-group list-group-horizontal text-center">
48
-                    <?php foreach ( $steps as $step => $data ) : ?>
48
+                    <?php foreach ($steps as $step => $data) : ?>
49 49
                         <li class="list-group-item flex-fill rounded-0 <?php
50 50
                             echo $step == $current ? 'active' : 'd-none d-md-block';
51
-                            echo array_search( $current, array_keys( $steps ) ) > array_search( $step, array_keys( $steps ) ) ? ' done' : '';
51
+                            echo array_search($current, array_keys($steps)) > array_search($step, array_keys($steps)) ? ' done' : '';
52 52
                         ?>">
53
-                            <i class="far fa-check-circle <?php echo array_search( $current, array_keys( $steps ) ) > array_search( $step, array_keys( $steps ) ) ? 'text-success' : '' ;?>"></i>
54
-                            <?php echo esc_html( $data['name'] ); ?>
53
+                            <i class="far fa-check-circle <?php echo array_search($current, array_keys($steps)) > array_search($step, array_keys($steps)) ? 'text-success' : ''; ?>"></i>
54
+                            <?php echo esc_html($data['name']); ?>
55 55
                         </li>
56 56
                     <?php endforeach; ?>
57 57
                 </ol>
Please login to merge, or discard this patch.
includes/admin/views/wizard-gateways.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 ?>
10 10
 
@@ -12,44 +12,44 @@  discard block
 block discarded – undo
12 12
 
13 13
     <form method="post" class="text-center card-body">
14 14
         <div class="gp-wizard-payments">
15
-            <h2 class="gd-settings-title h3 "><?php _e( 'Gateway Setup', 'invoicing' ); ?></h2>
16
-            <p><?php _e( 'Below are a few gateways that can be setup in a few seconds.', 'invoicing' ); ?>
15
+            <h2 class="gd-settings-title h3 "><?php _e('Gateway Setup', 'invoicing'); ?></h2>
16
+            <p><?php _e('Below are a few gateways that can be setup in a few seconds.', 'invoicing'); ?>
17 17
                 <br>
18
-                <?php _e( 'We have 20+ Gateways that can be setup later.', 'invoicing' ); ?>
18
+                <?php _e('We have 20+ Gateways that can be setup later.', 'invoicing'); ?>
19 19
             </p>
20 20
 
21 21
             <ul class="list-group">
22 22
 
23 23
 				<li class="list-group-item d-flex justify-content-between align-items-center">
24
-				    <span class="mr-auto"><img src="<?php echo esc_url( WPINV_PLUGIN_URL . 'assets/images/stripe-verified.svg' );?>" class="ml-n2" alt="Stripe"></span>
24
+				    <span class="mr-auto"><img src="<?php echo esc_url(WPINV_PLUGIN_URL . 'assets/images/stripe-verified.svg'); ?>" class="ml-n2" alt="Stripe"></span>
25 25
 				    <a href="<?php echo wp_nonce_url(
26 26
                             add_query_arg(
27 27
                                 array(
28 28
                                     'getpaid-admin-action' => 'connect_plugin',
29 29
                                     'plugin'               => 'stripe',
30
-                                    'redirect'             => urlencode( $next_url ),
30
+                                    'redirect'             => urlencode($next_url),
31 31
                                 )
32 32
                             ),
33 33
                             'getpaid-nonce',
34 34
                             'getpaid-nonce'
35 35
                         ); ?>"
36
-                        class="btn btn-sm btn-outline-primary"><?php _e( 'Connect', 'invoicing' ); ?></a>
36
+                        class="btn btn-sm btn-outline-primary"><?php _e('Connect', 'invoicing'); ?></a>
37 37
 				</li>
38 38
 
39 39
 				<li class="list-group-item d-flex justify-content-between align-items-center">
40
-				    <span class="mr-auto"><img src="<?php echo esc_url( WPINV_PLUGIN_URL . 'assets/images/pp-logo-150px.webp' );?>" class="" alt="PayPal" height="25"></span>
40
+				    <span class="mr-auto"><img src="<?php echo esc_url(WPINV_PLUGIN_URL . 'assets/images/pp-logo-150px.webp'); ?>" class="" alt="PayPal" height="25"></span>
41 41
 				    <a href="<?php echo wp_nonce_url(
42 42
                             add_query_arg(
43 43
                                 array(
44 44
                                     'getpaid-admin-action' => 'connect_plugin',
45 45
                                     'plugin'               => 'paypal',
46
-                                    'redirect'             => urlencode( $next_url ),
46
+                                    'redirect'             => urlencode($next_url),
47 47
                                 )
48 48
                             ),
49 49
                             'getpaid-nonce',
50 50
                             'getpaid-nonce'
51 51
                         ); ?>"
52
-                        class="btn btn-sm btn-outline-primary"><?php _e( 'Connect', 'invoicing' ); ?></a>
52
+                        class="btn btn-sm btn-outline-primary"><?php _e('Connect', 'invoicing'); ?></a>
53 53
 				</li>
54 54
 
55 55
 				<li class="list-group-item d-flex justify-content-between align-items-center">
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
         </div>
65 65
 
66 66
         <p class="gp-setup-actions step text-center mt-4">
67
-			<a href="<?php echo esc_url( $next_url ); ?>" class="btn btn-primary"><?php esc_attr_e( 'Continue', 'invoicing' ); ?></a>
67
+			<a href="<?php echo esc_url($next_url); ?>" class="btn btn-primary"><?php esc_attr_e('Continue', 'invoicing'); ?></a>
68 68
 		</p>
69 69
 
70 70
     </form>
71 71
     <p class="gd-return-to-dashboard-wrap">
72
-		<a href="<?php echo esc_url( $next_url ); ?>" class="gd-return-to-dashboard btn btn-link d-block text-muted"><?php _e( 'Skip this step', 'invoicing' ); ?></a>
72
+		<a href="<?php echo esc_url($next_url); ?>" class="gd-return-to-dashboard btn btn-link d-block text-muted"><?php _e('Skip this step', 'invoicing'); ?></a>
73 73
 	</p>
74 74
 </div>
Please login to merge, or discard this patch.
includes/admin/views/wizard-thank-you.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -4,59 +4,59 @@
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 ?>
10 10
 
11 11
 <div class="card shadow-sm my-5">
12 12
 	<div class="text-center card-body">
13
-		<h1 class="h3"><?php esc_html_e( 'Awesome, you are ready to Get Paid', 'invoicing' ); ?></h1>
13
+		<h1 class="h3"><?php esc_html_e('Awesome, you are ready to Get Paid', 'invoicing'); ?></h1>
14 14
 
15 15
 		<div class="geodirectory-message geodirectory-tracker">
16
-			<p><?php _e( 'Thank you for choosing GetPaid!', 'invoicing' ); ?> <i class="far fa-smile-beam"></i></p>
16
+			<p><?php _e('Thank you for choosing GetPaid!', 'invoicing'); ?> <i class="far fa-smile-beam"></i></p>
17 17
 		</div>
18 18
 
19 19
 		<div class="gp-setup-next-steps">
20 20
 			<div class="gp-setup-next-steps-first mb-4">
21
-				<h2 class="h3"><?php esc_html_e( 'Next steps', 'invoicing' ); ?></h2>
21
+				<h2 class="h3"><?php esc_html_e('Next steps', 'invoicing'); ?></h2>
22 22
 					<a
23 23
 						class="btn btn-primary btn-sm"
24
-						href="<?php echo esc_url( admin_url( 'post-new.php?post_type=wpi_item' ) ); ?>"><?php esc_html_e( 'Create your first Item!', 'invoicing' ); ?></a>
24
+						href="<?php echo esc_url(admin_url('post-new.php?post_type=wpi_item')); ?>"><?php esc_html_e('Create your first Item!', 'invoicing'); ?></a>
25 25
 					<div class="gp-setup-next-steps-first mb-4">
26
-						<h2 class="h3"><?php esc_html_e( 'Examples', 'invoicing' ); ?></h2>
26
+						<h2 class="h3"><?php esc_html_e('Examples', 'invoicing'); ?></h2>
27 27
 						<a
28 28
 							class="btn btn-primary btn-sm"
29 29
 							target="_blank"
30
-							href="https://demos.ayecode.io/getpaid/"><?php esc_html_e( "View What's Possible", 'invoicing' ); ?></a>
30
+							href="https://demos.ayecode.io/getpaid/"><?php esc_html_e("View What's Possible", 'invoicing'); ?></a>
31 31
 
32 32
 						<a
33 33
 							class="btn btn-outline-primary btn-sm"
34 34
 							target="_blank"
35
-							href="https://demos.ayecode.io/getpaid/"><?php esc_html_e( "View What's Possible", 'invoicing' ); ?></a>
35
+							href="https://demos.ayecode.io/getpaid/"><?php esc_html_e("View What's Possible", 'invoicing'); ?></a>
36 36
 					</div>
37 37
 					<div class="gp-setup-next-steps-last">
38
-						<h2 class="h3"><?php _e( 'Learn more', 'invoicing' ); ?></h2>
38
+						<h2 class="h3"><?php _e('Learn more', 'invoicing'); ?></h2>
39 39
 						<a
40 40
 							class="btn btn-outline-primary btn-sm" href="https://docs.wpgetpaid.com/collection/114-getting-started?utm_source=setupwizard&utm_medium=product&utm_content=getting-started&utm_campaign=invoicingplugin"
41
-							target="_blank"><?php esc_html_e( 'Getting Started', 'invoicing' ); ?></a>
41
+							target="_blank"><?php esc_html_e('Getting Started', 'invoicing'); ?></a>
42 42
 						<a
43 43
 							class="btn btn-outline-primary btn-sm"
44 44
 							href="https://docs.wpgetpaid.com/?utm_source=setupwizard&utm_medium=product&utm_content=docs&utm_campaign=invoicingplugin"
45
-							target="_blank"><?php esc_html_e( 'Documentation', 'invoicing' ); ?></a>
45
+							target="_blank"><?php esc_html_e('Documentation', 'invoicing'); ?></a>
46 46
 						<a
47 47
 							class="btn btn-outline-primary btn-sm"
48 48
 							href="https://wpgetpaid.com/support/?utm_source=setupwizard&utm_medium=product&utm_content=docs&utm_campaign=invoicingyplugin"
49
-							target="_blank"><?php esc_html_e( 'Support', 'invoicing' ); ?></a>
49
+							target="_blank"><?php esc_html_e('Support', 'invoicing'); ?></a>
50 50
 						<a
51 51
 							class="btn btn-outline-primary btn-sm"
52 52
 							href="https://demos.ayecode.io/getpaid/?utm_source=setupwizard&utm_medium=product&utm_content=demos&utm_campaign=invoicingyplugin"
53
-							target="_blank"><?php esc_html_e( 'Demos', 'invoicing' ); ?></a>
53
+							target="_blank"><?php esc_html_e('Demos', 'invoicing'); ?></a>
54 54
 					</div>
55 55
 			</div>
56 56
 		</div>
57 57
 
58 58
 		<p class="gd-return-to-dashboard-wrap">
59
-			<a href="<?php echo esc_url( admin_url() ); ?>" class="gd-return-to-dashboard btn btn-link d-block text-muted"><?php _e( 'Return to the WordPress Dashboard', 'invoicing' ); ?></a>
59
+			<a href="<?php echo esc_url(admin_url()); ?>" class="gd-return-to-dashboard btn btn-link d-block text-muted"><?php _e('Return to the WordPress Dashboard', 'invoicing'); ?></a>
60 60
 		</p>
61 61
 	</div>
62 62
 </div>
Please login to merge, or discard this patch.
includes/admin/views/wizard-plugins.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -4,30 +4,30 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 ?>
10 10
 
11 11
 <div class="card shadow-sm my-5">'
12 12
 
13
-    <form method="post" class="text-center card-body" action="<?php echo esc_url( admin_url() ); ?>">
14
-		<?php getpaid_hidden_field( 'getpaid-admin-action', 'install_plugin' ); ?>
15
-		<?php wp_nonce_field( 'getpaid-nonce', 'getpaid-nonce' ); ?>
16
-		<?php getpaid_hidden_field( 'redirect', $next_url ); ?>
13
+    <form method="post" class="text-center card-body" action="<?php echo esc_url(admin_url()); ?>">
14
+		<?php getpaid_hidden_field('getpaid-admin-action', 'install_plugin'); ?>
15
+		<?php wp_nonce_field('getpaid-nonce', 'getpaid-nonce'); ?>
16
+		<?php getpaid_hidden_field('redirect', $next_url); ?>
17 17
 		<div class="gd-wizard-recommend">
18 18
 
19
-			<h2 class="gd-settings-title h3"><?php _e( 'Recommended Plugins', 'invoicing' ); ?></h2>
20
-			<p><?php _e( 'Below are a few of our own plugins that may help you.', 'invoicing' ); ?></p>
19
+			<h2 class="gd-settings-title h3"><?php _e('Recommended Plugins', 'invoicing'); ?></h2>
20
+			<p><?php _e('Below are a few of our own plugins that may help you.', 'invoicing'); ?></p>
21 21
 
22 22
 			<ul class="list-group">
23
-				<?php foreach ( $recommended_plugins as $plugin ) : ?>
23
+				<?php foreach ($recommended_plugins as $plugin) : ?>
24 24
 				<li class="list-group-item d-flex justify-content-between align-items-center flex-wrap text-left">
25
-					<span class="mr-auto"><?php echo esc_html( $plugin['name'] ); ?></span>
25
+					<span class="mr-auto"><?php echo esc_html($plugin['name']); ?></span>
26 26
 					<div class="custom-control custom-switch getpaid-install-plugin-siwtch-div mr-n2">
27
-						<input type="checkbox" name="plugins[<?php echo esc_attr( $plugin['slug'] ); ?>]" value="<?php echo esc_attr( $plugin['file'] ); ?>" class="custom-control-input"  <?php if( is_plugin_active( $plugin['slug'] ) ){echo "checked";} ?>>
27
+						<input type="checkbox" name="plugins[<?php echo esc_attr($plugin['slug']); ?>]" value="<?php echo esc_attr($plugin['file']); ?>" class="custom-control-input"  <?php if (is_plugin_active($plugin['slug'])) {echo "checked"; } ?>>
28 28
 						<label class="custom-control-label" for="ac-setting-updates"></label>
29 29
 					</div>
30
-					<small class="w-100"><?php echo esc_attr( $plugin['desc'] );?></small>
30
+					<small class="w-100"><?php echo esc_attr($plugin['desc']); ?></small>
31 31
 				</li>
32 32
 				<?php endforeach; ?>
33 33
 			</ul>
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
 				<input
37 37
                 	type="submit"
38 38
                 	class="btn btn-primary button-next"
39
-				    value="<?php esc_attr_e( 'Continue', 'invoicing' ); ?>" name="save_step"/>
39
+				    value="<?php esc_attr_e('Continue', 'invoicing'); ?>" name="save_step"/>
40 40
 			</p>
41 41
 
42 42
 		</div>
43 43
 
44 44
     </form>
45 45
 	<p class="gd-return-to-dashboard-wrap">
46
-		<a href="<?php echo esc_url( $next_url ); ?>" class="gd-return-to-dashboard btn btn-link d-block text-muted"><?php _e( 'Skip this step', 'invoicing' ); ?></a>
46
+		<a href="<?php echo esc_url($next_url); ?>" class="gd-return-to-dashboard btn btn-link d-block text-muted"><?php _e('Skip this step', 'invoicing'); ?></a>
47 47
 	</p>
48 48
 </div>
Please login to merge, or discard this patch.
includes/admin/views/wizard-introduction.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 ?>
10 10
 
@@ -12,77 +12,77 @@  discard block
 block discarded – undo
12 12
     <div class="text-center pb-3 mt-5">
13 13
         <a class=" text-decoration-none" href="https://wpgetpaid.com/">
14 14
             <span class="text-black-50">
15
-                <img class="ml-n3x" src="<?php echo WPINV_PLUGIN_URL . 'assets/images/getpaid-logo.png';?>" />
15
+                <img class="ml-n3x" src="<?php echo WPINV_PLUGIN_URL . 'assets/images/getpaid-logo.png'; ?>" />
16 16
             </span>
17 17
         </a>
18 18
 	</div>
19 19
 
20 20
     <h1 class="h4 card-header bg-white border-bottom-0 pt-4 pb-1">
21
-        <?php esc_html_e( 'Welcome to GetPaid!', 'invoicing' ); ?>
21
+        <?php esc_html_e('Welcome to GetPaid!', 'invoicing'); ?>
22 22
     </h1>
23 23
 
24 24
     <div class="card-body text-muted ">
25
-        <p><?php _e( 'Thank you for choosing GetPaid - The most Powerful Payments Plugin for WordPress', 'invoicing' ); ?></p>
25
+        <p><?php _e('Thank you for choosing GetPaid - The most Powerful Payments Plugin for WordPress', 'invoicing'); ?></p>
26 26
         <hr class="mt-4 pt-3 pb-0" />
27
-        <p class="small"><?php _e( 'This quick setup wizard will help you <b>configure the basic settings</b>. It’s <b>completely optional</b> and shouldn’t take longer than <b>five minutes</b>.', 'invoicing' ); ?></p>
27
+        <p class="small"><?php _e('This quick setup wizard will help you <b>configure the basic settings</b>. It’s <b>completely optional</b> and shouldn’t take longer than <b>five minutes</b>.', 'invoicing'); ?></p>
28 28
     </div>
29 29
 
30 30
     <div class="card-footer mb-0 bg-white gp-setup-actions step border-top-0">
31 31
         <a
32
-            href="<?php echo esc_url( $next_url ); ?>"
33
-            class="btn btn-primary button-next"><?php esc_html_e( "Let's go!", 'invoicing' ); ?></a>
32
+            href="<?php echo esc_url($next_url); ?>"
33
+            class="btn btn-primary button-next"><?php esc_html_e("Let's go!", 'invoicing'); ?></a>
34 34
         <a
35
-            href="<?php echo esc_url( admin_url() ); ?>"
36
-            class="btn btn-link d-block mt-2 "><?php esc_html_e( 'Not right now', 'invoicing' ); ?></a>
35
+            href="<?php echo esc_url(admin_url()); ?>"
36
+            class="btn btn-link d-block mt-2 "><?php esc_html_e('Not right now', 'invoicing'); ?></a>
37 37
     </div>
38 38
 </div>
39 39
 
40 40
 <div class="card shadow-sm my-5">
41 41
     <h1 class="h4 card-header bg-white border-bottom-0  pt-4 pb-1">
42
-        <?php esc_html_e( 'GetPaid Features & Addons!', 'invoicing' ); ?>
42
+        <?php esc_html_e('GetPaid Features & Addons!', 'invoicing'); ?>
43 43
     </h1>
44 44
 
45 45
     <div class="card-body text-muted overflow-hidden">
46
-		<p><?php _e( 'Collect one time & recurring payments online within minutes. No complex setup required.', 'invoicing' ); ?></p>
46
+		<p><?php _e('Collect one time & recurring payments online within minutes. No complex setup required.', 'invoicing'); ?></p>
47 47
 		<hr>
48 48
 
49 49
 		<div class="row row-cols-2 text-left">
50 50
 			<div class="col mt-3">
51 51
 				<div class="media">
52
-                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/buy.svg';?>" class="mr-3" alt="...">
52
+                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/buy.svg'; ?>" class="mr-3" alt="...">
53 53
                     <div class="media-body">
54
-                        <h6 class="mt-0 font-weight-bold"><?php _e( 'GetPaid via Buy Now Buttons', 'invoicing' );?></h6>
55
-                        <small><?php _e( 'Sell via buy now buttons anywhere on your site', 'invoicing' );?></small>
54
+                        <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Buy Now Buttons', 'invoicing'); ?></h6>
55
+                        <small><?php _e('Sell via buy now buttons anywhere on your site', 'invoicing'); ?></small>
56 56
                     </div>
57 57
                 </div>
58 58
 			</div>
59 59
 
60 60
             <div class="col mt-3">
61 61
                 <div class="media">
62
-                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/report.svg';?>" class="mr-3" alt="...">
62
+                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/report.svg'; ?>" class="mr-3" alt="...">
63 63
                         <div class="media-body">
64
-                        <h6 class="mt-0 font-weight-bold"><?php _e( 'GetPaid via payment form', 'invoicing' );?></h6>
65
-                        <small><?php _e( 'Payment forms are conversion-optimized checkout forms', 'invoicing' );?></small>
64
+                        <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via payment form', 'invoicing'); ?></h6>
65
+                        <small><?php _e('Payment forms are conversion-optimized checkout forms', 'invoicing'); ?></small>
66 66
                     </div>
67 67
                 </div>
68 68
 		    </div>
69 69
 
70 70
             <div class="col mt-3">
71 71
                 <div class="media">
72
-                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/invoices.svg';?>" class="mr-3" alt="...">
72
+                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/invoices.svg'; ?>" class="mr-3" alt="...">
73 73
                     <div class="media-body">
74
-                        <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Invoice','invoicing');?></h6>
75
-                        <small><?php _e('Create and send invoices for just about anything from the WordPress dashboard','invoicing');?></small>
74
+                        <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Invoice', 'invoicing'); ?></h6>
75
+                        <small><?php _e('Create and send invoices for just about anything from the WordPress dashboard', 'invoicing'); ?></small>
76 76
                     </div>
77 77
                 </div>
78 78
 		    </div>
79 79
 
80 80
             <div class="col mt-3">
81 81
                 <div class="media">
82
-                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/payment.svg';?>" class="mr-3" alt="...">
82
+                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/payment.svg'; ?>" class="mr-3" alt="...">
83 83
                     <div class="media-body">
84
-                        <h6 class="mt-0 font-weight-bold"><?php _e('Affordable payment gateways','invoicing');?></h6>
85
-                        <small><?php _e('On average our gateways are over 66% cheaper than our competition','invoicing');?></small>
84
+                        <h6 class="mt-0 font-weight-bold"><?php _e('Affordable payment gateways', 'invoicing'); ?></h6>
85
+                        <small><?php _e('On average our gateways are over 66% cheaper than our competition', 'invoicing'); ?></small>
86 86
                     </div>
87 87
                 </div>
88 88
 		    </div>
@@ -93,51 +93,51 @@  discard block
 block discarded – undo
93 93
 	<div class="mt-5">
94 94
 		<a
95 95
             href="https://wpgetpaid.com/features-list/"
96
-			class="btn btn-primary"><?php esc_html_e( 'View All Features!', 'invoicing' ); ?></a>
96
+			class="btn btn-primary"><?php esc_html_e('View All Features!', 'invoicing'); ?></a>
97 97
 	</div>
98 98
 
99 99
 	<div class="mt-5 mx-n4 py-4" style="background:#eafaf6;">
100
-		<h4 class="mt-0 font-weight-bold text-dark mb-4"><?php _e( 'More with Membership!' , 'invoicing' );?></h4>
100
+		<h4 class="mt-0 font-weight-bold text-dark mb-4"><?php _e('More with Membership!', 'invoicing'); ?></h4>
101 101
 		<div class="row row-cols-2 text-left px-5">
102 102
 
103 103
 			<div class="col">
104 104
 				<ul class="list-unstyled">
105
-					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'PDF Invoices' , 'invoicing' );?></li>
106
-					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'Gravity Forms' , 'invoicing' );?></li>
107
-					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'Contact form 7' , 'invoicing' );?></li>
108
-					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'AffiliateWP Integration' , 'invoicing' );?></li>
105
+					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('PDF Invoices', 'invoicing'); ?></li>
106
+					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('Gravity Forms', 'invoicing'); ?></li>
107
+					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('Contact form 7', 'invoicing'); ?></li>
108
+					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('AffiliateWP Integration', 'invoicing'); ?></li>
109 109
 				</ul>
110 110
 			</div>
111 111
 
112 112
 			<div class="col">
113 113
 				<ul class="list-unstyled">
114
-			    	<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'Ninja forms' , 'invoicing' );?></li>
115
-					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'Digital Downloads' , 'invoicing' );?></li>
116
-					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'Wallet' , 'invoicing' );?></li>
114
+			    	<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('Ninja forms', 'invoicing'); ?></li>
115
+					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('Digital Downloads', 'invoicing'); ?></li>
116
+					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('Wallet', 'invoicing'); ?></li>
117 117
 				</ul>
118 118
 			</div>
119 119
 		</div>
120 120
 
121
-		<h5 class="mt-4 font-weight-bold text-dark mb-3"><?php _e('Membership Starts From','invoicing');?></h5>
122
-		<h1 class="mt-0 font-weight-bold text-dark mb-4 display-3"><?php esc_html_e( '$49', 'invoicing' ); ?></h1>
121
+		<h5 class="mt-4 font-weight-bold text-dark mb-3"><?php _e('Membership Starts From', 'invoicing'); ?></h5>
122
+		<h1 class="mt-0 font-weight-bold text-dark mb-4 display-3"><?php esc_html_e('$49', 'invoicing'); ?></h1>
123 123
 
124 124
 		<div class="mt-2">
125 125
 			<a
126 126
                 href="https://wpgetpaid.com/downloads/membership/"
127
-				class="btn btn-primary"><?php esc_html_e( 'Buy Membership Now!', 'invoicing' ); ?></a>
127
+				class="btn btn-primary"><?php esc_html_e('Buy Membership Now!', 'invoicing'); ?></a>
128 128
 		</div>
129 129
 
130 130
 	</div>
131 131
 
132 132
     <div class="card-footer mb-0 bg-white gp-setup-actions step border-top-0">
133 133
         <a
134
-            href="<?php echo esc_url( $next_url ); ?>"
135
-            class="btn btn-outline-primary button-next"><?php esc_html_e( 'Launch the Setup Wizard!', 'invoicing' ); ?></a>
134
+            href="<?php echo esc_url($next_url); ?>"
135
+            class="btn btn-outline-primary button-next"><?php esc_html_e('Launch the Setup Wizard!', 'invoicing'); ?></a>
136 136
         <a
137 137
             href="https://docs.wpgetpaid.com/"
138
-            class="btn btn-outline-primary ml-4"><?php esc_html_e( 'Documentation', 'invoicing' ); ?></a>
138
+            class="btn btn-outline-primary ml-4"><?php esc_html_e('Documentation', 'invoicing'); ?></a>
139 139
         <a
140
-            href="<?php echo esc_url( admin_url() ); ?>"
141
-            class="btn btn-link d-block mt-2 "><?php esc_html_e( 'Not right now', 'invoicing' ); ?></a>
140
+            href="<?php echo esc_url(admin_url()); ?>"
141
+            class="btn btn-link d-block mt-2 "><?php esc_html_e('Not right now', 'invoicing'); ?></a>
142 142
     </div>
143 143
 </div>
Please login to merge, or discard this patch.
includes/admin/views/wizard-settings.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 ?>
10 10
 
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
     <div class="text-center pb-3 mt-5">
13 13
         <a class=" text-decoration-none" href="https://wpgetpaid.com/">
14 14
             <span class="text-black-50">
15
-                <img class="ml-n3x" src="<?php echo WPINV_PLUGIN_URL . 'assets/images/getpaid-logo.png';?>" />
15
+                <img class="ml-n3x" src="<?php echo WPINV_PLUGIN_URL . 'assets/images/getpaid-logo.png'; ?>" />
16 16
             </span>
17 17
         </a>
18 18
 	</div>
19 19
 
20 20
     <form method="post" class="text-left card-body" action="options.php">
21
-        <?php settings_fields( 'wpinv_settings' ); ?>
22
-        <input type="hidden" name="_wp_http_referer" value="<?php echo esc_url( $next_url ); ?>">
21
+        <?php settings_fields('wpinv_settings'); ?>
22
+        <input type="hidden" name="_wp_http_referer" value="<?php echo esc_url($next_url); ?>">
23 23
 
24 24
         <table class="gp-setup-maps w-100 " cellspacing="0">
25 25
             <tbody>
@@ -27,28 +27,28 @@  discard block
 block discarded – undo
27 27
 
28 28
                     global $wp_settings_fields;
29 29
 
30
-                    if ( isset( $wp_settings_fields[ $page ][ $section ] ) ) {
31
-                        $settings =  $wp_settings_fields[ $page ][ $section ];
30
+                    if (isset($wp_settings_fields[$page][$section])) {
31
+                        $settings = $wp_settings_fields[$page][$section];
32 32
 
33
-                        foreach ( $settings as $field ) {
33
+                        foreach ($settings as $field) {
34 34
 
35
-                            $name      = esc_attr( $field['id'] );
36
-                            $id        = sanitize_key( $name );
35
+                            $name      = esc_attr($field['id']);
36
+                            $id        = sanitize_key($name);
37 37
                             $class     = '';
38
-                            $value     = isset( $field['args']['std'] ) ? $field['args']['std'] : '';
39
-                            $value     = wpinv_clean( wpinv_get_option( $field['args']['id'], $value ) );
40
-                            $help_text = isset( $field['args']['desc'] ) ? wp_kses_post( $field['args']['desc'] ) : '';
41
-                            $type      = str_replace( 'wpinv_', '', str_replace( '_callback', '', $field['callback'] ) );
42
-                            $label     = isset( $field['args']['name'] ) ? wp_kses_post( $field['args']['name'] ) : '';
43
-                            $options   = isset( $field['args']['options'] ) ? $field['args']['options'] : array();
38
+                            $value     = isset($field['args']['std']) ? $field['args']['std'] : '';
39
+                            $value     = wpinv_clean(wpinv_get_option($field['args']['id'], $value));
40
+                            $help_text = isset($field['args']['desc']) ? wp_kses_post($field['args']['desc']) : '';
41
+                            $type      = str_replace('wpinv_', '', str_replace('_callback', '', $field['callback']));
42
+                            $label     = isset($field['args']['name']) ? wp_kses_post($field['args']['name']) : '';
43
+                            $options   = isset($field['args']['options']) ? $field['args']['options'] : array();
44 44
                         
45
-                            if ( false !== strpos( $name, 'logo') ) {
45
+                            if (false !== strpos($name, 'logo')) {
46 46
                                 $type = 'hidden';
47 47
                             }
48 48
                         
49
-                            if ( 'country_states' == $type ) {
49
+                            if ('country_states' == $type) {
50 50
                         
51
-                                if ( 0 == count( wpinv_get_country_states( wpinv_get_default_country() ) ) ) {
51
+                                if (0 == count(wpinv_get_country_states(wpinv_get_default_country()))) {
52 52
                                     $type = 'text';
53 53
                                 } else {
54 54
                                     $type = 'select';
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
                                 $class = 'getpaid_js_field-state';
58 58
                             }
59 59
                         
60
-                            if ( 'wpinv_settings[default_country]' == $name ) {
60
+                            if ('wpinv_settings[default_country]' == $name) {
61 61
                                 $class = 'getpaid_js_field-country';
62 62
                             }
63 63
                         
64
-                            switch ( $type ) {
64
+                            switch ($type) {
65 65
                         
66 66
                                 case 'hidden':
67 67
                                     echo "<input type='hidden' id='$id' name='$name' value='$value' />";
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                                             'type'       => $type,
74 74
                                             'id'         => $id,
75 75
                                             'name'       => $name,
76
-                                            'value'      => is_scalar( $value ) ? esc_attr( $value ) : '',
76
+                                            'value'      => is_scalar($value) ? esc_attr($value) : '',
77 77
                                             'required'   => false,
78 78
                                             'help_text'  => $help_text,
79 79
                                             'label'      => $label,
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
                                         array(
90 90
                                             'id'              => $id,
91 91
                                             'name'            => $name,
92
-                                            'value'           => is_scalar( $value ) ? esc_textarea( $value ) : '',
92
+                                            'value'           => is_scalar($value) ? esc_textarea($value) : '',
93 93
                                             'required'        => false,
94 94
                                             'help_text'       => $help_text,
95 95
                                             'label'           => $label,
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
                                     );
102 102
                         
103 103
                                     // Bug fixed in AUI 0.1.51 for name stripping []
104
-                                    echo str_replace( sanitize_html_class( $name ), esc_attr( $name ), $textarea );
104
+                                    echo str_replace(sanitize_html_class($name), esc_attr($name), $textarea);
105 105
                         
106 106
                                     break;
107 107
                                 case 'select':
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
                                             'id'              =>  $id,
111 111
                                             'name'            =>  $name,
112 112
                                             'placeholder'     => '',
113
-                                            'value'           => is_scalar( $value ) ? esc_attr( $value ) : '',
113
+                                            'value'           => is_scalar($value) ? esc_attr($value) : '',
114 114
                                             'required'        => false,
115 115
                                             'help_text'       => $help_text,
116 116
                                             'label'           => $label,
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
 				<input
136 136
                     type="submit"
137 137
                     class="btn btn-primary button-next"
138
-				    value="<?php esc_attr_e( 'Continue', 'invoicing' ); ?>" name="save_step"/>
138
+				    value="<?php esc_attr_e('Continue', 'invoicing'); ?>" name="save_step"/>
139 139
 			</p>
140 140
         </table>
141 141
     </form>
142 142
     <p class="gd-return-to-dashboard-wrap">
143
-		<a href="<?php echo esc_url( $next_url ); ?>" class="gd-return-to-dashboard btn btn-link d-block text-muted"><?php _e( 'Skip this step', 'invoicing' ); ?></a>
143
+		<a href="<?php echo esc_url($next_url); ?>" class="gd-return-to-dashboard btn btn-link d-block text-muted"><?php _e('Skip this step', 'invoicing'); ?></a>
144 144
 	</p>
145 145
 </div>
Please login to merge, or discard this patch.
includes/admin/class-getpaid-admin-setup-wizard.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @version     2.4.0
11 11
  * @info        GetPaid Setup Wizard.
12 12
  */
13
-defined( 'ABSPATH' ) || exit;
13
+defined('ABSPATH') || exit;
14 14
 
15 15
 /**
16 16
  * GetPaid_Admin_Setup_Wizard class.
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function __construct() {
46 46
 
47
-		if ( apply_filters( 'getpaid_enable_setup_wizard', true ) && wpinv_current_user_can_manage_invoicing() ) {
48
-			add_action( 'admin_menu', array( $this, 'add_menu' ) );
49
-			add_action( 'current_screen', array( $this, 'setup_wizard' ) );
47
+		if (apply_filters('getpaid_enable_setup_wizard', true) && wpinv_current_user_can_manage_invoicing()) {
48
+			add_action('admin_menu', array($this, 'add_menu'));
49
+			add_action('current_screen', array($this, 'setup_wizard'));
50 50
 		}
51 51
 
52 52
 	}
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * @since 2.4.0
58 58
 	 */
59 59
 	public function add_menu() {
60
-		add_dashboard_page( '', '', wpinv_get_capability(), 'gp-setup', '' );
60
+		add_dashboard_page('', '', wpinv_get_capability(), 'gp-setup', '');
61 61
 	}
62 62
 
63 63
 	/**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public function setup_wizard() {
69 69
 
70
-		if ( isset( $_GET['page'] ) && 'gp-setup' === $_GET['page'] ) {
70
+		if (isset($_GET['page']) && 'gp-setup' === $_GET['page']) {
71 71
 			$this->setup_globals();
72 72
 			$this->maybe_save_current_step();
73 73
 			$this->display_wizard();
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 	 * @since 2.4.0
95 95
 	 */
96 96
 	protected function maybe_save_current_step() {
97
-		if ( ! empty( $_POST['save_step'] ) && is_callable( $this->steps[ $this->step ]['handler'] ) ) {
98
-			call_user_func( $this->steps[ $this->step ]['handler'], $this );
97
+		if (!empty($_POST['save_step']) && is_callable($this->steps[$this->step]['handler'])) {
98
+			call_user_func($this->steps[$this->step]['handler'], $this);
99 99
 		}
100 100
 	}
101 101
 
@@ -110,44 +110,44 @@  discard block
 block discarded – undo
110 110
 		$steps = array(
111 111
 
112 112
 			'introduction'     => array(
113
-				'name'    => __( 'Introduction', 'invoicing' ),
114
-				'view'    => array( $this, 'setup_introduction' ),
113
+				'name'    => __('Introduction', 'invoicing'),
114
+				'view'    => array($this, 'setup_introduction'),
115 115
 				'handler' => '',
116 116
 			),
117 117
 
118 118
 			'business_details'             => array(
119
-				'name'    => __( "Business Details", 'invoicing' ),
120
-				'view'    => array( $this, 'setup_business' ),
121
-				'handler' => array( $this, 'setup_business_save' ),
119
+				'name'    => __("Business Details", 'invoicing'),
120
+				'view'    => array($this, 'setup_business'),
121
+				'handler' => array($this, 'setup_business_save'),
122 122
 			),
123 123
 
124 124
 			'currency' => array(
125
-				'name'    => __( 'Currency', 'invoicing' ),
126
-				'view'    => array( $this, 'setup_currency' ),
127
-				'handler' => array( $this, 'setup_currency_save' ),
125
+				'name'    => __('Currency', 'invoicing'),
126
+				'view'    => array($this, 'setup_currency'),
127
+				'handler' => array($this, 'setup_currency_save'),
128 128
 			),
129 129
 
130 130
 			'payments'        => array(
131
-				'name'    => __( 'Payment Gateways', 'invoicing' ),
132
-				'view'    => array( $this, 'setup_payments' ),
133
-				'handler' => array( $this, 'setup_payments_save' ),
131
+				'name'    => __('Payment Gateways', 'invoicing'),
132
+				'view'    => array($this, 'setup_payments'),
133
+				'handler' => array($this, 'setup_payments_save'),
134 134
 			),
135 135
 
136 136
 			'recommend'          => array(
137
-				'name'    => __( 'Recommend', 'invoicing' ),
138
-				'view'    => array( $this, 'setup_recommend' ),
139
-				'handler' => array( $this, 'setup_recommend_save' ),
137
+				'name'    => __('Recommend', 'invoicing'),
138
+				'view'    => array($this, 'setup_recommend'),
139
+				'handler' => array($this, 'setup_recommend_save'),
140 140
 			),
141 141
 
142 142
 			'next_steps'       => array(
143
-				'name'    => __( 'Get Paid', 'invoicing' ),
144
-				'view'    => array( $this, 'setup_ready' ),
143
+				'name'    => __('Get Paid', 'invoicing'),
144
+				'view'    => array($this, 'setup_ready'),
145 145
 				'handler' => '',
146 146
 			),
147 147
 
148 148
 		);
149 149
 
150
-		return apply_filters( 'getpaid_setup_wizard_steps', $steps );
150
+		return apply_filters('getpaid_setup_wizard_steps', $steps);
151 151
 
152 152
 	}
153 153
 
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 	 * @return string
159 159
 	 */
160 160
 	protected function get_current_step() {
161
-		$step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : '';
162
-		return ! empty( $step ) && in_array( $step, array_keys( $this->steps ) ) ? $step : current( array_keys( $this->steps ) );
161
+		$step = isset($_GET['step']) ? sanitize_key($_GET['step']) : '';
162
+		return !empty($step) && in_array($step, array_keys($this->steps)) ? $step : current(array_keys($this->steps));
163 163
 	}
164 164
 
165 165
 	/**
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 
173 173
 		$previous = false;
174 174
 		$current  = $this->step;
175
-		foreach ( array_keys( $this->steps ) as $step ) {
176
-			if ( $current === $step ) {
175
+		foreach (array_keys($this->steps) as $step) {
176
+			if ($current === $step) {
177 177
 				return $previous;
178 178
 			}
179 179
 
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
 
194 194
 		$on_current = false;
195 195
 		$current    = $this->step;
196
-		foreach ( array_keys( $this->steps ) as $step ) {
196
+		foreach (array_keys($this->steps) as $step) {
197 197
 
198
-			if ( $on_current ) {
198
+			if ($on_current) {
199 199
 				return $step;
200 200
 			}
201 201
 
202
-			if ( $current === $step ) {
202
+			if ($current === $step) {
203 203
 				return $on_current = true;
204 204
 			}
205 205
 
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
 		$steps     = $this->steps;
229 229
 		$current   = $this->step;
230 230
 		$next_step = $this->next_step;
231
-		array_shift( $steps );
232
-		include plugin_dir_path( __FILE__ ) . 'views/wizard-header.php';
231
+		array_shift($steps);
232
+		include plugin_dir_path(__FILE__) . 'views/wizard-header.php';
233 233
 	}
234 234
 
235 235
 	/**
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		?>
242 242
 			<div class="gp-setup-content rowx mw-100 text-center mb-3">
243 243
 				<div class="col-12 col-md-5 m-auto">
244
-					<?php call_user_func( $this->steps[ $this->step ]['view'], $this ); ?>
244
+					<?php call_user_func($this->steps[$this->step]['view'], $this); ?>
245 245
 				</div>
246 246
 			</div>
247 247
 		<?php
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	 */
264 264
 	public function setup_introduction() {
265 265
 		$next_url = $this->get_next_step_link();
266
-		include plugin_dir_path( __FILE__ ) . 'views/wizard-introduction.php';
266
+		include plugin_dir_path(__FILE__) . 'views/wizard-introduction.php';
267 267
 	}
268 268
 
269 269
 	/**
@@ -276,22 +276,22 @@  discard block
 block discarded – undo
276 276
 	 *                      Empty string on failure.
277 277
 	 * @since 3.0.0
278 278
 	 */
279
-	public function get_next_step_link( $step = '' ) {
280
-		if ( ! $step ) {
279
+	public function get_next_step_link($step = '') {
280
+		if (!$step) {
281 281
 			$step = $this->step;
282 282
 		}
283 283
 
284
-		$keys = array_keys( $this->steps );
285
-		if ( end( $keys ) === $step ) {
284
+		$keys = array_keys($this->steps);
285
+		if (end($keys) === $step) {
286 286
 			return admin_url();
287 287
 		}
288 288
 
289
-		$step_index = array_search( $step, $keys );
290
-		if ( false === $step_index ) {
289
+		$step_index = array_search($step, $keys);
290
+		if (false === $step_index) {
291 291
 			return '';
292 292
 		}
293 293
 
294
-		return remove_query_arg('settings-updated', add_query_arg( 'step', $keys[ $step_index + 1 ] ));
294
+		return remove_query_arg('settings-updated', add_query_arg('step', $keys[$step_index + 1]));
295 295
 	}
296 296
 
297 297
 	/**
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 		$wizard   = $this;
305 305
 		$page     = 'wpinv_settings_general_main';
306 306
 		$section  = 'wpinv_settings_general_main';
307
-		include plugin_dir_path( __FILE__ ) . 'views/wizard-settings.php';
307
+		include plugin_dir_path(__FILE__) . 'views/wizard-settings.php';
308 308
 	}
309 309
 
310 310
 	/**
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 		$wizard   = $this;
318 318
 		$page     = 'wpinv_settings_general_currency_section';
319 319
 		$section  = 'wpinv_settings_general_currency_section';
320
-		include plugin_dir_path( __FILE__ ) . 'views/wizard-settings.php';
320
+		include plugin_dir_path(__FILE__) . 'views/wizard-settings.php';
321 321
 	}
322 322
 
323 323
 	/**
@@ -328,35 +328,35 @@  discard block
 block discarded – undo
328 328
 	public function setup_recommend() {
329 329
 		$next_url            = $this->get_next_step_link();
330 330
 		$recommended_plugins = self::get_recommend_wp_plugins();
331
-		include plugin_dir_path( __FILE__ ) . 'views/wizard-plugins.php';
331
+		include plugin_dir_path(__FILE__) . 'views/wizard-plugins.php';
332 332
 	}
333 333
 
334 334
 	/**
335 335
 	 * A list of recommended wp.org plugins.
336 336
 	 * @return array
337 337
 	 */
338
-	public static function get_recommend_wp_plugins(){
338
+	public static function get_recommend_wp_plugins() {
339 339
 		return array(
340 340
 			'ayecode-connect' => array(
341 341
 				'file'   => 'ayecode-connect/ayecode-connect.php',
342 342
 				'url'    => 'https://wordpress.org/plugins/ayecode-connect/',
343 343
 				'slug'   => 'ayecode-connect',
344 344
 				'name'   => 'AyeCode Connect',
345
-				'desc'   => __( 'Documentation and Support from within your WordPress admin.', 'geodirectory' ),
345
+				'desc'   => __('Documentation and Support from within your WordPress admin.', 'geodirectory'),
346 346
 			),
347 347
 			'invoicing-quotes' => array(
348 348
 				'file'   => 'invoicing-quotes/wpinv-quote.php',
349 349
 				'url'    => 'https://wordpress.org/plugins/invoicing-quotes/',
350 350
 				'slug'   => 'invoicing-quotes',
351 351
 				'name'   => 'Customer Quotes',
352
-				'desc'   => __('Create & Send Quotes to Customers and have them accept and pay.','geodirectory'),
352
+				'desc'   => __('Create & Send Quotes to Customers and have them accept and pay.', 'geodirectory'),
353 353
 			),
354 354
 			'userswp'    => array(
355 355
 				'file'   => 'userswp/userswp.php',
356 356
 				'url'    => 'https://wordpress.org/plugins/userswp/',
357 357
 				'slug'   => 'userswp',
358 358
 				'name'   => 'UsersWP',
359
-				'desc'   => __('Frontend user login and registration as well as slick profile pages.','geodirectory'),
359
+				'desc'   => __('Frontend user login and registration as well as slick profile pages.', 'geodirectory'),
360 360
 			),
361 361
 		);
362 362
 	}
@@ -369,8 +369,8 @@  discard block
 block discarded – undo
369 369
 	 * @since 2.0.0
370 370
 	 */
371 371
 	public function setup_recommend_save() {
372
-		check_admin_referer( 'gp-setup' );
373
-		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
372
+		check_admin_referer('gp-setup');
373
+		wp_redirect(esc_url_raw($this->get_next_step_link()));
374 374
 		exit;
375 375
 	}
376 376
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 	 */
382 382
 	public function setup_payments() {
383 383
 		$next_url = $this->get_next_step_link();
384
-		include plugin_dir_path( __FILE__ ) . 'views/wizard-gateways.php';
384
+		include plugin_dir_path(__FILE__) . 'views/wizard-gateways.php';
385 385
 	}
386 386
 
387 387
 	/**
@@ -392,8 +392,8 @@  discard block
 block discarded – undo
392 392
 	 * @since 2.0.0
393 393
 	 */
394 394
 	public function setup_payments_save() {
395
-		check_admin_referer( 'gp-setup' );
396
-		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
395
+		check_admin_referer('gp-setup');
396
+		wp_redirect(esc_url_raw($this->get_next_step_link()));
397 397
 		exit;
398 398
 	}
399 399
 
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 	 * @since 2.0.0
404 404
 	 */
405 405
 	public function setup_ready() {
406
-		include plugin_dir_path( __FILE__ ) . 'views/wizard-thank-you.php';
406
+		include plugin_dir_path(__FILE__) . 'views/wizard-thank-you.php';
407 407
 	}
408 408
 
409 409
 }
Please login to merge, or discard this patch.
includes/admin/class-getpaid-admin.php 1 patch
Spacing   +235 added lines, -235 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * The main admin class.
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
     /**
38 38
 	 * Class constructor.
39 39
 	 */
40
-	public function __construct(){
40
+	public function __construct() {
41 41
 
42
-        $this->admin_path  = plugin_dir_path( __FILE__ );
43
-		$this->admin_url   = plugins_url( '/', __FILE__ );
42
+        $this->admin_path = plugin_dir_path(__FILE__);
43
+		$this->admin_url   = plugins_url('/', __FILE__);
44 44
 		$this->reports     = new GetPaid_Reports();
45 45
 
46
-        if ( is_admin() ) {
46
+        if (is_admin()) {
47 47
 			$this->init_admin_hooks();
48 48
         }
49 49
 
@@ -54,30 +54,30 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 */
56 56
 	private function init_admin_hooks() {
57
-        add_action( 'admin_enqueue_scripts', array( $this, 'enqeue_scripts' ) );
58
-        add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
59
-        add_action( 'admin_init', array( $this, 'init_ayecode_connect_helper' ) );
60
-        add_action( 'admin_init', array( $this, 'activation_redirect') );
61
-        add_action( 'admin_init', array( $this, 'maybe_do_admin_action') );
62
-		add_action( 'admin_notices', array( $this, 'show_notices' ) );
63
-		add_action( 'getpaid_authenticated_admin_action_rate_plugin', array( $this, 'redirect_to_wordpress_rating_page' ) );
64
-		add_action( 'getpaid_authenticated_admin_action_send_invoice', array( $this, 'send_customer_invoice' ) );
65
-		add_action( 'getpaid_authenticated_admin_action_send_invoice_reminder', array( $this, 'send_customer_payment_reminder' ) );
66
-        add_action( 'getpaid_authenticated_admin_action_reset_tax_rates', array( $this, 'admin_reset_tax_rates' ) );
67
-		add_action( 'getpaid_authenticated_admin_action_create_missing_pages', array( $this, 'admin_create_missing_pages' ) );
68
-		add_action( 'getpaid_authenticated_admin_action_create_missing_tables', array( $this, 'admin_create_missing_tables' ) );
69
-		add_action( 'getpaid_authenticated_admin_action_migrate_old_invoices', array( $this, 'admin_migrate_old_invoices' ) );
70
-		add_action( 'getpaid_authenticated_admin_action_download_customers', array( $this, 'admin_download_customers' ) );
71
-		add_action( 'getpaid_authenticated_admin_action_recalculate_discounts', array( $this, 'admin_recalculate_discounts' ) );
72
-		add_action( 'getpaid_authenticated_admin_action_install_plugin', array( $this, 'admin_install_plugin' ) );
73
-		add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) );
74
-		do_action( 'getpaid_init_admin_hooks', $this );
57
+        add_action('admin_enqueue_scripts', array($this, 'enqeue_scripts'));
58
+        add_filter('admin_body_class', array($this, 'admin_body_class'));
59
+        add_action('admin_init', array($this, 'init_ayecode_connect_helper'));
60
+        add_action('admin_init', array($this, 'activation_redirect'));
61
+        add_action('admin_init', array($this, 'maybe_do_admin_action'));
62
+		add_action('admin_notices', array($this, 'show_notices'));
63
+		add_action('getpaid_authenticated_admin_action_rate_plugin', array($this, 'redirect_to_wordpress_rating_page'));
64
+		add_action('getpaid_authenticated_admin_action_send_invoice', array($this, 'send_customer_invoice'));
65
+		add_action('getpaid_authenticated_admin_action_send_invoice_reminder', array($this, 'send_customer_payment_reminder'));
66
+        add_action('getpaid_authenticated_admin_action_reset_tax_rates', array($this, 'admin_reset_tax_rates'));
67
+		add_action('getpaid_authenticated_admin_action_create_missing_pages', array($this, 'admin_create_missing_pages'));
68
+		add_action('getpaid_authenticated_admin_action_create_missing_tables', array($this, 'admin_create_missing_tables'));
69
+		add_action('getpaid_authenticated_admin_action_migrate_old_invoices', array($this, 'admin_migrate_old_invoices'));
70
+		add_action('getpaid_authenticated_admin_action_download_customers', array($this, 'admin_download_customers'));
71
+		add_action('getpaid_authenticated_admin_action_recalculate_discounts', array($this, 'admin_recalculate_discounts'));
72
+		add_action('getpaid_authenticated_admin_action_install_plugin', array($this, 'admin_install_plugin'));
73
+		add_filter('admin_footer_text', array($this, 'admin_footer_text'));
74
+		do_action('getpaid_init_admin_hooks', $this);
75 75
 
76 76
 		// Setup/welcome
77
-		if ( ! empty( $_GET['page'] ) ) {
78
-			switch ( $_GET['page'] ) {
77
+		if (!empty($_GET['page'])) {
78
+			switch ($_GET['page']) {
79 79
 				case 'gp-setup' :
80
-					include_once( dirname( __FILE__ ) . '/class-getpaid-admin-setup-wizard.php' );
80
+					include_once(dirname(__FILE__) . '/class-getpaid-admin-setup-wizard.php');
81 81
 					break;
82 82
 			}
83 83
 		}
@@ -91,37 +91,37 @@  discard block
 block discarded – undo
91 91
 	public function enqeue_scripts() {
92 92
         global $current_screen, $pagenow;
93 93
 
94
-		$page    = isset( $_GET['page'] ) ? $_GET['page'] : '';
94
+		$page    = isset($_GET['page']) ? $_GET['page'] : '';
95 95
 		$editing = $pagenow == 'post.php' || $pagenow == 'post-new.php';
96 96
 
97
-        if ( ! empty( $current_screen->post_type ) ) {
97
+        if (!empty($current_screen->post_type)) {
98 98
 			$page = $current_screen->post_type;
99 99
         }
100 100
 
101 101
         // General styles.
102
-        if ( false !== stripos( $page, 'wpi' ) || 'gp-setup' == $page ) {
102
+        if (false !== stripos($page, 'wpi') || 'gp-setup' == $page) {
103 103
 
104 104
             // Styles.
105
-            $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/admin.css' );
106
-            wp_enqueue_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array( 'wp-color-picker' ), $version );
107
-            wp_enqueue_style( 'select2', WPINV_PLUGIN_URL . 'assets/css/select2/select2.min.css', array(), '4.0.13', 'all' );
105
+            $version = filemtime(WPINV_PLUGIN_DIR . 'assets/css/admin.css');
106
+            wp_enqueue_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array('wp-color-picker'), $version);
107
+            wp_enqueue_style('select2', WPINV_PLUGIN_URL . 'assets/css/select2/select2.min.css', array(), '4.0.13', 'all');
108 108
 
109 109
             // Scripts.
110
-            wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full.min.js', array( 'jquery' ), WPINV_VERSION );
110
+            wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full.min.js', array('jquery'), WPINV_VERSION);
111 111
 
112
-            $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin.js' );
113
-            wp_enqueue_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array( 'jquery', 'wp-color-picker', 'jquery-ui-tooltip' ),  $version );
114
-            wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', apply_filters( 'wpinv_admin_js_localize', $this->get_admin_i18() ) );
112
+            $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin.js');
113
+            wp_enqueue_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array('jquery', 'wp-color-picker', 'jquery-ui-tooltip'), $version);
114
+            wp_localize_script('wpinv-admin-script', 'WPInv_Admin', apply_filters('wpinv_admin_js_localize', $this->get_admin_i18()));
115 115
 
116 116
         }
117 117
 
118 118
         // Payment form scripts.
119
-		if ( 'wpi_payment_form' == $page && $editing ) {
119
+		if ('wpi_payment_form' == $page && $editing) {
120 120
             $this->load_payment_form_scripts();
121 121
         }
122 122
 
123
-		if ( $page == 'wpinv-subscriptions' ) {
124
-			wp_enqueue_script( 'postbox' );
123
+		if ($page == 'wpinv-subscriptions') {
124
+			wp_enqueue_script('postbox');
125 125
 		}
126 126
 
127 127
     }
@@ -134,32 +134,32 @@  discard block
 block discarded – undo
134 134
         global $post;
135 135
 
136 136
 		$date_range = array(
137
-			'period' => isset( $_GET['date_range'] ) ? sanitize_text_field( $_GET['date_range'] ) : '7_days'
137
+			'period' => isset($_GET['date_range']) ? sanitize_text_field($_GET['date_range']) : '7_days'
138 138
 		);
139 139
 
140
-		if ( $date_range['period'] == 'custom' ) {
140
+		if ($date_range['period'] == 'custom') {
141 141
 			
142
-			if ( isset( $_GET['from'] ) ) {
143
-				$date_range[ 'after' ] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['from'] ), current_time( 'timestamp' ) ) - DAY_IN_SECONDS );
142
+			if (isset($_GET['from'])) {
143
+				$date_range['after'] = date('Y-m-d', strtotime(sanitize_text_field($_GET['from']), current_time('timestamp')) - DAY_IN_SECONDS);
144 144
 			}
145 145
 
146
-			if ( isset( $_GET['to'] ) ) {
147
-				$date_range[ 'before' ] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['to'] ), current_time( 'timestamp' ) ) + DAY_IN_SECONDS );
146
+			if (isset($_GET['to'])) {
147
+				$date_range['before'] = date('Y-m-d', strtotime(sanitize_text_field($_GET['to']), current_time('timestamp')) + DAY_IN_SECONDS);
148 148
 			}
149 149
 
150 150
 		}
151 151
 
152 152
         $i18n = array(
153
-            'ajax_url'                  => admin_url( 'admin-ajax.php' ),
154
-            'post_ID'                   => isset( $post->ID ) ? $post->ID : '',
155
-			'wpinv_nonce'               => wp_create_nonce( 'wpinv-nonce' ),
156
-			'rest_nonce'                => wp_create_nonce( 'wp_rest' ),
157
-			'rest_root'                 => esc_url_raw( rest_url() ),
153
+            'ajax_url'                  => admin_url('admin-ajax.php'),
154
+            'post_ID'                   => isset($post->ID) ? $post->ID : '',
155
+			'wpinv_nonce'               => wp_create_nonce('wpinv-nonce'),
156
+			'rest_nonce'                => wp_create_nonce('wp_rest'),
157
+			'rest_root'                 => esc_url_raw(rest_url()),
158 158
 			'date_range'                => $date_range,
159
-            'add_invoice_note_nonce'    => wp_create_nonce( 'add-invoice-note' ),
160
-            'delete_invoice_note_nonce' => wp_create_nonce( 'delete-invoice-note' ),
161
-            'invoice_item_nonce'        => wp_create_nonce( 'invoice-item' ),
162
-            'billing_details_nonce'     => wp_create_nonce( 'get-billing-details' ),
159
+            'add_invoice_note_nonce'    => wp_create_nonce('add-invoice-note'),
160
+            'delete_invoice_note_nonce' => wp_create_nonce('delete-invoice-note'),
161
+            'invoice_item_nonce'        => wp_create_nonce('invoice-item'),
162
+            'billing_details_nonce'     => wp_create_nonce('get-billing-details'),
163 163
             'tax'                       => wpinv_tax_amount(),
164 164
             'discount'                  => 0,
165 165
 			'currency_symbol'           => wpinv_currency_symbol(),
@@ -168,38 +168,38 @@  discard block
 block discarded – undo
168 168
             'thousand_sep'              => wpinv_thousands_separator(),
169 169
             'decimal_sep'               => wpinv_decimal_separator(),
170 170
             'decimals'                  => wpinv_decimals(),
171
-            'save_invoice'              => __( 'Save Invoice', 'invoicing' ),
172
-            'status_publish'            => wpinv_status_nicename( 'publish' ),
173
-            'status_pending'            => wpinv_status_nicename( 'wpi-pending' ),
174
-            'delete_tax_rate'           => __( 'Are you sure you wish to delete this tax rate?', 'invoicing' ),
175
-            'status_pending'            => wpinv_status_nicename( 'wpi-pending' ),
176
-            'FillBillingDetails'        => __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' ),
177
-            'confirmCalcTotals'         => __( 'Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing' ),
178
-            'AreYouSure'                => __( 'Are you sure?', 'invoicing' ),
179
-            'errDeleteItem'             => __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' ),
180
-            'delete_subscription'       => __( 'Are you sure you want to delete this subscription?', 'invoicing' ),
181
-            'action_edit'               => __( 'Edit', 'invoicing' ),
182
-            'action_cancel'             => __( 'Cancel', 'invoicing' ),
183
-            'item_description'          => __( 'Item Description', 'invoicing' ),
184
-            'invoice_description'       => __( 'Invoice Description', 'invoicing' ),
185
-            'discount_description'      => __( 'Discount Description', 'invoicing' ),
186
-			'searching'                 => __( 'Searching', 'invoicing' ),
187
-			'loading'                   => __( 'Loading...', 'invoicing' ),
188
-			'search_customers'          => __( 'Enter customer name or email', 'invoicing' ),
189
-			'search_items'              => __( 'Enter item name', 'invoicing' ),
171
+            'save_invoice'              => __('Save Invoice', 'invoicing'),
172
+            'status_publish'            => wpinv_status_nicename('publish'),
173
+            'status_pending'            => wpinv_status_nicename('wpi-pending'),
174
+            'delete_tax_rate'           => __('Are you sure you wish to delete this tax rate?', 'invoicing'),
175
+            'status_pending'            => wpinv_status_nicename('wpi-pending'),
176
+            'FillBillingDetails'        => __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing'),
177
+            'confirmCalcTotals'         => __('Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing'),
178
+            'AreYouSure'                => __('Are you sure?', 'invoicing'),
179
+            'errDeleteItem'             => __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing'),
180
+            'delete_subscription'       => __('Are you sure you want to delete this subscription?', 'invoicing'),
181
+            'action_edit'               => __('Edit', 'invoicing'),
182
+            'action_cancel'             => __('Cancel', 'invoicing'),
183
+            'item_description'          => __('Item Description', 'invoicing'),
184
+            'invoice_description'       => __('Invoice Description', 'invoicing'),
185
+            'discount_description'      => __('Discount Description', 'invoicing'),
186
+			'searching'                 => __('Searching', 'invoicing'),
187
+			'loading'                   => __('Loading...', 'invoicing'),
188
+			'search_customers'          => __('Enter customer name or email', 'invoicing'),
189
+			'search_items'              => __('Enter item name', 'invoicing'),
190 190
         );
191 191
 
192
-		if ( ! empty( $post ) && getpaid_is_invoice_post_type( $post->post_type ) ) {
192
+		if (!empty($post) && getpaid_is_invoice_post_type($post->post_type)) {
193 193
 
194
-			$invoice              = new WPInv_Invoice( $post );
194
+			$invoice              = new WPInv_Invoice($post);
195 195
 			$i18n['save_invoice'] = sprintf(
196
-				__( 'Save %s', 'invoicing' ),
197
-				ucfirst( $invoice->get_invoice_quote_type() )
196
+				__('Save %s', 'invoicing'),
197
+				ucfirst($invoice->get_invoice_quote_type())
198 198
 			);
199 199
 
200 200
 			$i18n['invoice_description'] = sprintf(
201
-				__( '%s Description', 'invoicing' ),
202
-				ucfirst( $invoice->get_invoice_quote_type() )
201
+				__('%s Description', 'invoicing'),
202
+				ucfirst($invoice->get_invoice_quote_type())
203 203
 			);
204 204
 
205 205
 		}
@@ -213,24 +213,24 @@  discard block
 block discarded – undo
213 213
 	 * @param  string $footer_text
214 214
 	 * @return string
215 215
 	 */
216
-	public function admin_footer_text( $footer_text ) {
216
+	public function admin_footer_text($footer_text) {
217 217
 		global $current_screen;
218 218
 
219
-		$page    = isset( $_GET['page'] ) ? $_GET['page'] : '';
219
+		$page = isset($_GET['page']) ? $_GET['page'] : '';
220 220
 
221
-        if ( ! empty( $current_screen->post_type ) ) {
221
+        if (!empty($current_screen->post_type)) {
222 222
 			$page = $current_screen->post_type;
223 223
         }
224 224
 
225 225
         // General styles.
226
-        if ( apply_filters( 'getpaid_display_admin_footer_text', wpinv_current_user_can_manage_invoicing() ) && false !== stripos( $page, 'wpi' ) ) {
226
+        if (apply_filters('getpaid_display_admin_footer_text', wpinv_current_user_can_manage_invoicing()) && false !== stripos($page, 'wpi')) {
227 227
 
228 228
 			// Change the footer text
229
-			if ( ! get_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', true ) ) {
229
+			if (!get_user_meta(get_current_user_id(), 'getpaid_admin_footer_text_rated', true)) {
230 230
 
231
-				$rating_url  = esc_url(
231
+				$rating_url = esc_url(
232 232
 					wp_nonce_url(
233
-						admin_url( 'admin.php?page=wpinv-reports&getpaid-admin-action=rate_plugin' ),
233
+						admin_url('admin.php?page=wpinv-reports&getpaid-admin-action=rate_plugin'),
234 234
 						'getpaid-nonce',
235 235
 						'getpaid-nonce'
236 236
 						)
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 
239 239
 				$footer_text = sprintf(
240 240
 					/* translators: %s: five stars */
241
-					__( 'If you like <strong>GetPaid</strong>, please leave us a %s rating. A huge thanks in advance!', 'invoicing' ),
241
+					__('If you like <strong>GetPaid</strong>, please leave us a %s rating. A huge thanks in advance!', 'invoicing'),
242 242
 					"<a href='$rating_url'>&#9733;&#9733;&#9733;&#9733;&#9733;</a>"
243 243
 				);
244 244
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 
247 247
 				$footer_text = sprintf(
248 248
 					/* translators: %s: GetPaid */
249
-					__( 'Thank you for using %s!', 'invoicing' ),
249
+					__('Thank you for using %s!', 'invoicing'),
250 250
 					"<a href='https://wpgetpaid.com/' target='_blank'><strong>GetPaid</strong></a>"
251 251
 				);
252 252
 
@@ -263,8 +263,8 @@  discard block
 block discarded – undo
263 263
 	 * @since  2.0.0
264 264
 	 */
265 265
 	public function redirect_to_wordpress_rating_page() {
266
-		update_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', 1 );
267
-		wp_redirect( 'https://wordpress.org/support/plugin/invoicing/reviews?rate=5#new-post' );
266
+		update_user_meta(get_current_user_id(), 'getpaid_admin_footer_text_rated', 1);
267
+		wp_redirect('https://wordpress.org/support/plugin/invoicing/reviews?rate=5#new-post');
268 268
 		exit;
269 269
 	}
270 270
 
@@ -275,30 +275,30 @@  discard block
 block discarded – undo
275 275
 	protected function load_payment_form_scripts() {
276 276
         global $post;
277 277
 
278
-        wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION );
279
-		wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION );
280
-		wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION );
278
+        wp_enqueue_script('vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION);
279
+		wp_enqueue_script('sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION);
280
+		wp_enqueue_script('vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array('sortable', 'vue'), WPINV_VERSION);
281 281
 
282
-		$version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' );
283
-		wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ),  $version );
282
+		$version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js');
283
+		wp_register_script('wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array('wpinv-admin-script', 'vue_draggable'), $version);
284 284
 
285 285
 		wp_localize_script(
286 286
             'wpinv-admin-payment-form-script',
287 287
             'wpinvPaymentFormAdmin',
288 288
             array(
289
-				'elements'      => wpinv_get_data( 'payment-form-elements' ),
290
-				'form_elements' => getpaid_get_payment_form_elements( $post->ID ),
289
+				'elements'      => wpinv_get_data('payment-form-elements'),
290
+				'form_elements' => getpaid_get_payment_form_elements($post->ID),
291 291
 				'currency'      => wpinv_currency_symbol(),
292 292
 				'position'      => wpinv_currency_position(),
293 293
 				'decimals'      => (int) wpinv_decimals(),
294 294
 				'thousands_sep' => wpinv_thousands_separator(),
295 295
 				'decimals_sep'  => wpinv_decimal_separator(),
296
-				'form_items'    => gepaid_get_form_items( $post->ID ),
296
+				'form_items'    => gepaid_get_form_items($post->ID),
297 297
 				'is_default'    => $post->ID == wpinv_get_default_payment_form(),
298 298
             )
299 299
         );
300 300
 
301
-        wp_enqueue_script( 'wpinv-admin-payment-form-script' );
301
+        wp_enqueue_script('wpinv-admin-payment-form-script');
302 302
 
303 303
     }
304 304
 
@@ -309,25 +309,25 @@  discard block
 block discarded – undo
309 309
      * @return string
310 310
 	 *
311 311
 	 */
312
-    public function admin_body_class( $classes ) {
312
+    public function admin_body_class($classes) {
313 313
 		global $pagenow, $post, $current_screen;
314 314
 
315 315
 
316
-        $page = isset( $_GET['page'] ) ? $_GET['page'] : '';
316
+        $page = isset($_GET['page']) ? $_GET['page'] : '';
317 317
 
318
-        if ( ! empty( $current_screen->post_type ) ) {
318
+        if (!empty($current_screen->post_type)) {
319 319
 			$page = $current_screen->post_type;
320 320
         }
321 321
 
322
-        if ( false !== stripos( $page, 'wpi' ) ) {
323
-            $classes .= ' wpi-' . sanitize_key( $page );
322
+        if (false !== stripos($page, 'wpi')) {
323
+            $classes .= ' wpi-' . sanitize_key($page);
324 324
         }
325 325
 
326
-        if ( in_array( $page, wpinv_parse_list( 'wpi_invoice wpi_payment_form wpi_quote' ) ) ) {
326
+        if (in_array($page, wpinv_parse_list('wpi_invoice wpi_payment_form wpi_quote'))) {
327 327
             $classes .= ' wpinv-cpt wpinv';
328 328
 		}
329 329
 		
330
-		if ( getpaid_is_invoice_post_type( $page ) ) {
330
+		if (getpaid_is_invoice_post_type($page)) {
331 331
             $classes .= ' getpaid-is-invoice-cpt';
332 332
         }
333 333
 
@@ -337,19 +337,19 @@  discard block
 block discarded – undo
337 337
     /**
338 338
 	 * Maybe show the AyeCode Connect Notice.
339 339
 	 */
340
-	public function init_ayecode_connect_helper(){
340
+	public function init_ayecode_connect_helper() {
341 341
 
342 342
         new AyeCode_Connect_Helper(
343 343
             array(
344
-				'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"),
345
-				'connect_external'  => __( "Please confirm you wish to connect your site?","invoicing" ),
346
-				'connect'           => sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s","invoicing" ),"<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>","</a>" ),
347
-				'connect_button'    => __("Connect Site","invoicing"),
348
-				'connecting_button'    => __("Connecting...","invoicing"),
349
-				'error_localhost'   => __( "This service will only work with a live domain, not a localhost.","invoicing" ),
350
-				'error'             => __( "Something went wrong, please refresh and try again.","invoicing" ),
344
+				'connect_title' => __("WP Invoicing - an AyeCode product!", "invoicing"),
345
+				'connect_external'  => __("Please confirm you wish to connect your site?", "invoicing"),
346
+				'connect'           => sprintf(__("<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s", "invoicing"), "<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>", "</a>"),
347
+				'connect_button'    => __("Connect Site", "invoicing"),
348
+				'connecting_button'    => __("Connecting...", "invoicing"),
349
+				'error_localhost'   => __("This service will only work with a live domain, not a localhost.", "invoicing"),
350
+				'error'             => __("Something went wrong, please refresh and try again.", "invoicing"),
351 351
             ),
352
-            array( 'wpi-addons' )
352
+            array('wpi-addons')
353 353
         );
354 354
 
355 355
     }
@@ -361,20 +361,20 @@  discard block
 block discarded – undo
361 361
 	 */
362 362
 	public function activation_redirect() {
363 363
 
364
-		$redirected = get_option( 'wpinv_redirected_to_settings' );
364
+		$redirected = get_option('wpinv_redirected_to_settings');
365 365
 
366
-		if ( ! empty( $redirected ) || wp_doing_ajax() || ! current_user_can( 'manage_options' ) ) {
366
+		if (!empty($redirected) || wp_doing_ajax() || !current_user_can('manage_options')) {
367 367
 			return;
368 368
 		}
369 369
 
370 370
 		// Bail if activating from network, or bulk
371
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
371
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
372 372
 			return;
373 373
 		}
374 374
 
375
-	    update_option( 'wpinv_redirected_to_settings', 1 );
375
+	    update_option('wpinv_redirected_to_settings', 1);
376 376
 
377
-        wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) );
377
+        wp_safe_redirect(admin_url('admin.php?page=wpinv-settings&tab=general'));
378 378
         exit;
379 379
 
380 380
 	}
@@ -384,9 +384,9 @@  discard block
 block discarded – undo
384 384
      */
385 385
     public function maybe_do_admin_action() {
386 386
 
387
-        if ( wpinv_current_user_can_manage_invoicing() && isset( $_REQUEST['getpaid-admin-action'] ) && isset( $_REQUEST['getpaid-nonce'] ) && wp_verify_nonce( $_REQUEST['getpaid-nonce'], 'getpaid-nonce' ) ) {
388
-            $key = sanitize_key( $_REQUEST['getpaid-admin-action'] );
389
-            do_action( "getpaid_authenticated_admin_action_$key", $_REQUEST );
387
+        if (wpinv_current_user_can_manage_invoicing() && isset($_REQUEST['getpaid-admin-action']) && isset($_REQUEST['getpaid-nonce']) && wp_verify_nonce($_REQUEST['getpaid-nonce'], 'getpaid-nonce')) {
388
+            $key = sanitize_key($_REQUEST['getpaid-admin-action']);
389
+            do_action("getpaid_authenticated_admin_action_$key", $_REQUEST);
390 390
         }
391 391
 
392 392
     }
@@ -396,16 +396,16 @@  discard block
 block discarded – undo
396 396
 	 * 
397 397
 	 * @param array $args
398 398
      */
399
-    public function send_customer_invoice( $args ) {
400
-		$sent = getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $args['invoice_id'] ), true );
399
+    public function send_customer_invoice($args) {
400
+		$sent = getpaid()->get('invoice_emails')->user_invoice(new WPInv_Invoice($args['invoice_id']), true);
401 401
 
402
-		if ( $sent ) {
403
-			$this->show_success( __( 'Invoice was successfully sent to the customer', 'invoicing' ) );
402
+		if ($sent) {
403
+			$this->show_success(__('Invoice was successfully sent to the customer', 'invoicing'));
404 404
 		} else {
405
-			$this->show_error( __( 'Could not send the invoice to the customer', 'invoicing' ) );
405
+			$this->show_error(__('Could not send the invoice to the customer', 'invoicing'));
406 406
 		}
407 407
 
408
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
408
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce', 'invoice_id')));
409 409
 		exit;
410 410
 	}
411 411
 
@@ -414,16 +414,16 @@  discard block
 block discarded – undo
414 414
 	 * 
415 415
 	 * @param array $args
416 416
      */
417
-    public function send_customer_payment_reminder( $args ) {
418
-		$sent = getpaid()->get( 'invoice_emails' )->force_send_overdue_notice( new WPInv_Invoice( $args['invoice_id'] ) );
417
+    public function send_customer_payment_reminder($args) {
418
+		$sent = getpaid()->get('invoice_emails')->force_send_overdue_notice(new WPInv_Invoice($args['invoice_id']));
419 419
 
420
-		if ( $sent ) {
421
-			$this->show_success( __( 'Payment reminder was successfully sent to the customer', 'invoicing' ) );
420
+		if ($sent) {
421
+			$this->show_success(__('Payment reminder was successfully sent to the customer', 'invoicing'));
422 422
 		} else {
423
-			$this->show_error( __( 'Could not sent payment reminder to the customer', 'invoicing' ) );
423
+			$this->show_error(__('Could not sent payment reminder to the customer', 'invoicing'));
424 424
 		}
425 425
 
426
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
426
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce', 'invoice_id')));
427 427
 		exit;
428 428
 	}
429 429
 
@@ -433,8 +433,8 @@  discard block
 block discarded – undo
433 433
      */
434 434
     public function admin_reset_tax_rates() {
435 435
 
436
-		update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) );
437
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
436
+		update_option('wpinv_tax_rates', wpinv_get_data('tax-rates'));
437
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
438 438
 		exit;
439 439
 
440 440
 	}
@@ -446,8 +446,8 @@  discard block
 block discarded – undo
446 446
     public function admin_create_missing_pages() {
447 447
 		$installer = new GetPaid_Installer();
448 448
 		$installer->create_pages();
449
-		$this->show_success( __( 'GetPaid pages updated.', 'invoicing' ) );
450
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
449
+		$this->show_success(__('GetPaid pages updated.', 'invoicing'));
450
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
451 451
 		exit;
452 452
 	}
453 453
 
@@ -459,35 +459,35 @@  discard block
 block discarded – undo
459 459
 		global $wpdb;
460 460
 		$installer = new GetPaid_Installer();
461 461
 
462
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}wpinv_subscriptions'" ) != $wpdb->prefix . 'wpinv_subscriptions' ) {
462
+		if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}wpinv_subscriptions'") != $wpdb->prefix . 'wpinv_subscriptions') {
463 463
 			$installer->create_subscriptions_table();
464 464
 
465
-			if ( $wpdb->last_error !== '' ) {
466
-				$this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error );
465
+			if ($wpdb->last_error !== '') {
466
+				$this->show_error(__('Your GetPaid tables have been updated:', 'invoicing') . ' ' . $wpdb->last_error);
467 467
 			}
468 468
 		}
469 469
 
470
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoices'" ) != $wpdb->prefix . 'getpaid_invoices' ) {
470
+		if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoices'") != $wpdb->prefix . 'getpaid_invoices') {
471 471
 			$installer->create_invoices_table();
472 472
 
473
-			if ( $wpdb->last_error !== '' ) {
474
-				$this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error );
473
+			if ($wpdb->last_error !== '') {
474
+				$this->show_error(__('Your GetPaid tables have been updated:', 'invoicing') . ' ' . $wpdb->last_error);
475 475
 			}
476 476
 		}
477 477
 
478
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoice_items'" ) != $wpdb->prefix . 'getpaid_invoice_items' ) {
478
+		if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}getpaid_invoice_items'") != $wpdb->prefix . 'getpaid_invoice_items') {
479 479
 			$installer->create_invoice_items_table();
480 480
 
481
-			if ( $wpdb->last_error !== '' ) {
482
-				$this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error );
481
+			if ($wpdb->last_error !== '') {
482
+				$this->show_error(__('Your GetPaid tables have been updated:', 'invoicing') . ' ' . $wpdb->last_error);
483 483
 			}
484 484
 		}
485 485
 
486
-		if ( ! $this->has_notices() ) {
487
-			$this->show_success( __( 'Your GetPaid tables have been updated.', 'invoicing' ) );
486
+		if (!$this->has_notices()) {
487
+			$this->show_success(__('Your GetPaid tables have been updated.', 'invoicing'));
488 488
 		}
489 489
 
490
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
490
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
491 491
 		exit;
492 492
 	}
493 493
 
@@ -502,10 +502,10 @@  discard block
 block discarded – undo
502 502
 		$installer->migrate_old_invoices();
503 503
 
504 504
 		// Show an admin message.
505
-		$this->show_success( __( 'Your invoices have been migrated.', 'invoicing' ) );
505
+		$this->show_success(__('Your invoices have been migrated.', 'invoicing'));
506 506
 
507 507
 		// Redirect the admin.
508
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
508
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
509 509
 		exit;
510 510
 
511 511
 	}
@@ -517,18 +517,18 @@  discard block
 block discarded – undo
517 517
     public function admin_download_customers() {
518 518
 		global $wpdb;
519 519
 
520
-		$output = fopen( 'php://output', 'w' ) or die( __( 'Unsupported server', 'invoicing' ) );
520
+		$output = fopen('php://output', 'w') or die(__('Unsupported server', 'invoicing'));
521 521
 
522
-		header( "Content-Type:text/csv" );
523
-		header( "Content-Disposition:attachment;filename=customers.csv" );
522
+		header("Content-Type:text/csv");
523
+		header("Content-Disposition:attachment;filename=customers.csv");
524 524
 
525 525
 		$post_types = '';
526 526
 
527
-		foreach ( array_keys( getpaid_get_invoice_post_types() ) as $post_type ) {
528
-			$post_types .= $wpdb->prepare( "post_type=%s OR ", $post_type );
527
+		foreach (array_keys(getpaid_get_invoice_post_types()) as $post_type) {
528
+			$post_types .= $wpdb->prepare("post_type=%s OR ", $post_type);
529 529
 		}
530 530
 
531
-		$post_types = rtrim( $post_types, ' OR' );
531
+		$post_types = rtrim($post_types, ' OR');
532 532
 
533 533
 		$customers = $wpdb->get_col(
534 534
 			$wpdb->prepare(
@@ -537,57 +537,57 @@  discard block
 block discarded – undo
537 537
 		);
538 538
 
539 539
 		$columns = array(
540
-			'name'     => __( 'Name', 'invoicing' ),
541
-			'email'    => __( 'Email', 'invoicing' ),
542
-			'country'  => __( 'Country', 'invoicing' ),
543
-			'state'    => __( 'State', 'invoicing' ),
544
-			'city'     => __( 'City', 'invoicing' ),
545
-			'zip'      => __( 'ZIP', 'invoicing' ),
546
-			'address'  => __( 'Address', 'invoicing' ),
547
-			'phone'    => __( 'Phone', 'invoicing' ),
548
-			'company'  => __( 'Company', 'invoicing' ),
549
-			'invoices' => __( 'Invoices', 'invoicing' ),
550
-			'total'    => __( 'Total Spend', 'invoicing' ),
551
-			'signup'   => __( 'Date created', 'invoicing' ),
540
+			'name'     => __('Name', 'invoicing'),
541
+			'email'    => __('Email', 'invoicing'),
542
+			'country'  => __('Country', 'invoicing'),
543
+			'state'    => __('State', 'invoicing'),
544
+			'city'     => __('City', 'invoicing'),
545
+			'zip'      => __('ZIP', 'invoicing'),
546
+			'address'  => __('Address', 'invoicing'),
547
+			'phone'    => __('Phone', 'invoicing'),
548
+			'company'  => __('Company', 'invoicing'),
549
+			'invoices' => __('Invoices', 'invoicing'),
550
+			'total'    => __('Total Spend', 'invoicing'),
551
+			'signup'   => __('Date created', 'invoicing'),
552 552
 		);
553 553
 
554 554
 		// Output the csv column headers.
555
-		fputcsv( $output, array_values( $columns ) );
555
+		fputcsv($output, array_values($columns));
556 556
 
557 557
 		// Loop through
558 558
 		$table = new WPInv_Customers_Table();
559
-		foreach ( $customers as $customer_id ) {
559
+		foreach ($customers as $customer_id) {
560 560
 
561
-			$user = get_user_by( 'id', $customer_id );
561
+			$user = get_user_by('id', $customer_id);
562 562
 			$row  = array();
563
-			if ( empty( $user ) ) {
563
+			if (empty($user)) {
564 564
 				continue;
565 565
 			}
566 566
 
567
-			foreach ( array_keys( $columns ) as $column ) {
567
+			foreach (array_keys($columns) as $column) {
568 568
 
569 569
 				$method = 'column_' . $column;
570 570
 
571
-				if ( 'name' == $column ) {
572
-					$value = sanitize_text_field( $user->display_name );
573
-				} else if( 'email' == $column ) {
574
-					$value = sanitize_email( $user->user_email );
575
-				} else if ( is_callable( array( $table, $method ) ) ) {
576
-					$value = strip_tags( $table->$method( $user ) );
571
+				if ('name' == $column) {
572
+					$value = sanitize_text_field($user->display_name);
573
+				} else if ('email' == $column) {
574
+					$value = sanitize_email($user->user_email);
575
+				} else if (is_callable(array($table, $method))) {
576
+					$value = strip_tags($table->$method($user));
577 577
 				}
578 578
 
579
-				if ( empty( $value ) ) {
580
-					$value = sanitize_text_field( get_user_meta( $user->ID, '_wpinv_' . $column, true ) );
579
+				if (empty($value)) {
580
+					$value = sanitize_text_field(get_user_meta($user->ID, '_wpinv_' . $column, true));
581 581
 				}
582 582
 
583 583
 				$row[] = $value;
584 584
 
585 585
 			}
586 586
 
587
-			fputcsv( $output, $row );
587
+			fputcsv($output, $row);
588 588
 		}
589 589
 
590
-		fclose( $output );
590
+		fclose($output);
591 591
 		exit;
592 592
 
593 593
 	}
@@ -597,29 +597,29 @@  discard block
 block discarded – undo
597 597
 	 *
598 598
 	 * @param array $data
599 599
      */
600
-    public function admin_install_plugin( $data ) {
600
+    public function admin_install_plugin($data) {
601 601
 
602
-		if ( ! empty( $data['plugins'] ) ) {
602
+		if (!empty($data['plugins'])) {
603 603
 			include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
604 604
 			wp_cache_flush();
605 605
 
606
-			foreach ( $data['plugins'] as $slug => $file ) {
607
-				$plugin_zip = esc_url( 'https://downloads.wordpress.org/plugin/' . $slug . '.latest-stable.zip' );
608
-				$upgrader   = new Plugin_Upgrader( new Automatic_Upgrader_Skin() );
609
-				$installed  = $upgrader->install( $plugin_zip );
606
+			foreach ($data['plugins'] as $slug => $file) {
607
+				$plugin_zip = esc_url('https://downloads.wordpress.org/plugin/' . $slug . '.latest-stable.zip');
608
+				$upgrader   = new Plugin_Upgrader(new Automatic_Upgrader_Skin());
609
+				$installed  = $upgrader->install($plugin_zip);
610 610
 
611
-				if ( ! is_wp_error( $installed ) && $installed ) {
612
-					activate_plugin( $file, '', false, true );
611
+				if (!is_wp_error($installed) && $installed) {
612
+					activate_plugin($file, '', false, true);
613 613
 				} else {
614
-					wpinv_error_log( $upgrader->skin->get_upgrade_messages(), false );
614
+					wpinv_error_log($upgrader->skin->get_upgrade_messages(), false);
615 615
 				}
616 616
 
617 617
 			}
618 618
 
619 619
 		}
620 620
 
621
-		$redirect = isset( $data['redirect'] ) ? esc_url_raw( $data['redirect'] ) : admin_url( 'wp-admin/plugins.php' );
622
-		wp_safe_redirect( $redirect );
621
+		$redirect = isset($data['redirect']) ? esc_url_raw($data['redirect']) : admin_url('wp-admin/plugins.php');
622
+		wp_safe_redirect($redirect);
623 623
 		exit;
624 624
 
625 625
 	}
@@ -633,36 +633,36 @@  discard block
 block discarded – undo
633 633
 
634 634
 		// Fetch all invoices that have discount codes.
635 635
 		$table    = $wpdb->prefix . 'getpaid_invoices';
636
-		$invoices = $wpdb->get_col( "SELECT `post_id` FROM `$table` WHERE `discount` = 0 && `discount_code` <> ''" );
636
+		$invoices = $wpdb->get_col("SELECT `post_id` FROM `$table` WHERE `discount` = 0 && `discount_code` <> ''");
637 637
 
638
-		foreach ( $invoices as $invoice ) {
638
+		foreach ($invoices as $invoice) {
639 639
 
640
-			$invoice = new WPInv_Invoice( $invoice );
640
+			$invoice = new WPInv_Invoice($invoice);
641 641
 
642
-			if ( ! $invoice->exists() ) {
642
+			if (!$invoice->exists()) {
643 643
 				continue;
644 644
 			}
645 645
 
646 646
 			// Abort if the discount does not exist or does not apply here.
647
-			$discount = new WPInv_Discount( $invoice->get_discount_code() );
648
-			if ( ! $discount->exists() ) {
647
+			$discount = new WPInv_Discount($invoice->get_discount_code());
648
+			if (!$discount->exists()) {
649 649
 				continue;
650 650
 			}
651 651
 
652
-			$invoice->add_discount( getpaid_calculate_invoice_discount( $invoice, $discount ) );
652
+			$invoice->add_discount(getpaid_calculate_invoice_discount($invoice, $discount));
653 653
 			$invoice->recalculate_total();
654 654
 
655
-			if ( $invoice->get_total_discount() > 0 ) {
655
+			if ($invoice->get_total_discount() > 0) {
656 656
 				$invoice->save();
657 657
 			}
658 658
 
659 659
 		}
660 660
 
661 661
 		// Show an admin message.
662
-		$this->show_success( __( 'Discounts have been recalculated.', 'invoicing' ) );
662
+		$this->show_success(__('Discounts have been recalculated.', 'invoicing'));
663 663
 
664 664
 		// Redirect the admin.
665
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
665
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
666 666
 		exit;
667 667
 
668 668
 	}
@@ -674,8 +674,8 @@  discard block
 block discarded – undo
674 674
      * @return array
675 675
 	 */
676 676
 	public function get_notices() {
677
-		$notices = get_option( 'wpinv_admin_notices' );
678
-        return is_array( $notices ) ? $notices : array();
677
+		$notices = get_option('wpinv_admin_notices');
678
+        return is_array($notices) ? $notices : array();
679 679
 	}
680 680
 
681 681
 	/**
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
      * @return array
686 686
 	 */
687 687
 	public function has_notices() {
688
-		return count( $this->get_notices() ) > 0;
688
+		return count($this->get_notices()) > 0;
689 689
 	}
690 690
 
691 691
 	/**
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 	 * @since       1.0.19
696 696
 	 */
697 697
 	public function clear_notices() {
698
-		delete_option( 'wpinv_admin_notices' );
698
+		delete_option('wpinv_admin_notices');
699 699
 	}
700 700
 
701 701
 	/**
@@ -704,16 +704,16 @@  discard block
 block discarded – undo
704 704
 	 * @access      public
705 705
 	 * @since       1.0.19
706 706
 	 */
707
-	public function save_notice( $type, $message ) {
707
+	public function save_notice($type, $message) {
708 708
 		$notices = $this->get_notices();
709 709
 
710
-		if ( empty( $notices[ $type ] ) || ! is_array( $notices[ $type ]) ) {
711
-			$notices[ $type ] = array();
710
+		if (empty($notices[$type]) || !is_array($notices[$type])) {
711
+			$notices[$type] = array();
712 712
 		}
713 713
 
714
-		$notices[ $type ][] = $message;
714
+		$notices[$type][] = $message;
715 715
 
716
-		update_option( 'wpinv_admin_notices', $notices );
716
+		update_option('wpinv_admin_notices', $notices);
717 717
 	}
718 718
 
719 719
 	/**
@@ -723,8 +723,8 @@  discard block
 block discarded – undo
723 723
 	 * @access      public
724 724
 	 * @since       1.0.19
725 725
 	 */
726
-	public function show_success( $msg ) {
727
-		$this->save_notice( 'success', $msg );
726
+	public function show_success($msg) {
727
+		$this->save_notice('success', $msg);
728 728
 	}
729 729
 
730 730
 	/**
@@ -734,8 +734,8 @@  discard block
 block discarded – undo
734 734
 	 * @param       string $msg The message to qeue.
735 735
 	 * @since       1.0.19
736 736
 	 */
737
-	public function show_error( $msg ) {
738
-		$this->save_notice( 'error', $msg );
737
+	public function show_error($msg) {
738
+		$this->save_notice('error', $msg);
739 739
 	}
740 740
 
741 741
 	/**
@@ -745,8 +745,8 @@  discard block
 block discarded – undo
745 745
 	 * @param       string $msg The message to qeue.
746 746
 	 * @since       1.0.19
747 747
 	 */
748
-	public function show_warning( $msg ) {
749
-		$this->save_notice( 'warning', $msg );
748
+	public function show_warning($msg) {
749
+		$this->save_notice('warning', $msg);
750 750
 	}
751 751
 
752 752
 	/**
@@ -756,8 +756,8 @@  discard block
 block discarded – undo
756 756
 	 * @param       string $msg The message to qeue.
757 757
 	 * @since       1.0.19
758 758
 	 */
759
-	public function show_info( $msg ) {
760
-		$this->save_notice( 'info', $msg );
759
+	public function show_info($msg) {
760
+		$this->save_notice('info', $msg);
761 761
 	}
762 762
 
763 763
 	/**
@@ -771,30 +771,30 @@  discard block
 block discarded – undo
771 771
         $notices = $this->get_notices();
772 772
         $this->clear_notices();
773 773
 
774
-		foreach ( $notices as $type => $messages ) {
774
+		foreach ($notices as $type => $messages) {
775 775
 
776
-			if ( ! is_array( $messages ) ) {
776
+			if (!is_array($messages)) {
777 777
 				continue;
778 778
 			}
779 779
 
780
-            $type  = sanitize_key( $type );
781
-			foreach ( $messages as $message ) {
782
-                $message = wp_kses_post( $message );
780
+            $type = sanitize_key($type);
781
+			foreach ($messages as $message) {
782
+                $message = wp_kses_post($message);
783 783
 				echo "<div class='notice notice-$type is-dismissible'><p>$message</p></div>";
784 784
             }
785 785
 
786 786
         }
787 787
 
788
-		foreach ( array( 'checkout_page', 'invoice_history_page', 'success_page', 'failure_page', 'invoice_subscription_page' ) as $page ) {
788
+		foreach (array('checkout_page', 'invoice_history_page', 'success_page', 'failure_page', 'invoice_subscription_page') as $page) {
789 789
 
790
-			if ( ! is_numeric( wpinv_get_option( $page, false ) ) ) {
791
-				$url     = wp_nonce_url(
792
-					add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ),
790
+			if (!is_numeric(wpinv_get_option($page, false))) {
791
+				$url = wp_nonce_url(
792
+					add_query_arg('getpaid-admin-action', 'create_missing_pages'),
793 793
 					'getpaid-nonce',
794 794
 					'getpaid-nonce'
795 795
 				);
796
-				$message  = __( 'Some GetPaid pages are missing. To use GetPaid without any issues, click the button below to generate the missing pages.', 'invoicing' );
797
-				$message2 = __( 'Generate Pages', 'invoicing' );
796
+				$message  = __('Some GetPaid pages are missing. To use GetPaid without any issues, click the button below to generate the missing pages.', 'invoicing');
797
+				$message2 = __('Generate Pages', 'invoicing');
798 798
 				echo "<div class='notice notice-warning is-dismissible'><p>$message<br><br><a href='$url' class='button button-primary'>$message2</a></p></div>";
799 799
 				break;
800 800
 			}
Please login to merge, or discard this patch.