Passed
Push — master ( 7abbad...7a9f16 )
by Brian
11:26
created
includes/payments/class-getpaid-payment-form-submission-fees.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
  * Payment form submission fees class
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @param GetPaid_Payment_Form_Submission $submission
31 31
 	 */
32
-	public function __construct( $submission ) {
32
+	public function __construct($submission) {
33 33
 
34 34
 		// Process any existing invoice fees.
35
-		if ( $submission->has_invoice() ) {
35
+		if ($submission->has_invoice()) {
36 36
 			$this->fees = $submission->get_invoice()->get_fees();
37 37
 		}
38 38
 
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
 		$data         = $submission->get_data();
41 41
 		$payment_form = $submission->get_payment_form();
42 42
 
43
-		foreach ( $payment_form->get_elements() as $element ) {
43
+		foreach ($payment_form->get_elements() as $element) {
44 44
 
45
-			if ( 'price_input' == $element['type'] ) {
46
-				$this->process_price_input( $element, $data, $submission );
45
+			if ('price_input' == $element['type']) {
46
+				$this->process_price_input($element, $data, $submission);
47 47
 			}
48 48
 
49
-			if ( 'price_select' == $element['type'] ) {
50
-				$this->process_price_select( $element, $data );
49
+			if ('price_select' == $element['type']) {
50
+				$this->process_price_select($element, $data);
51 51
 			}
52 52
 
53 53
 		}
@@ -61,21 +61,21 @@  discard block
 block discarded – undo
61 61
 	 * @param array $data
62 62
 	 * @param GetPaid_Payment_Form_Submission $submission
63 63
 	 */
64
-	public function process_price_input( $element, $data, $submission ) {
64
+	public function process_price_input($element, $data, $submission) {
65 65
 
66 66
 		// Abort if not passed.
67
-		if ( empty( $data[ $element['id'] ] ) ) {
67
+		if (empty($data[$element['id']])) {
68 68
 			return;
69 69
 		}
70 70
 
71
-		$amount  = (float) wpinv_sanitize_amount( $data[ $element['id'] ] );
72
-		$minimum = empty( $element['minimum'] ) ? 0 : (float) wpinv_sanitize_amount( $element['minimum'] );
71
+		$amount  = (float) wpinv_sanitize_amount($data[$element['id']]);
72
+		$minimum = empty($element['minimum']) ? 0 : (float) wpinv_sanitize_amount($element['minimum']);
73 73
 
74
-		if ( $amount < $minimum ) {
75
-			throw new Exception( sprintf( __( 'The minimum allowed amount is %s', 'invoicing' ), getpaid_unstandardize_amount( $minimum, $submission->get_currency() ) ) );
74
+		if ($amount < $minimum) {
75
+			throw new Exception(sprintf(__('The minimum allowed amount is %s', 'invoicing'), getpaid_unstandardize_amount($minimum, $submission->get_currency())));
76 76
 		}
77 77
 
78
-		$this->fees[ $element['label'] ] = array(
78
+		$this->fees[$element['label']] = array(
79 79
 			'name'          => $element['label'],
80 80
 			'initial_fee'   => $amount,
81 81
 			'recurring_fee' => 0,
@@ -89,35 +89,35 @@  discard block
 block discarded – undo
89 89
 	 * @param array $element
90 90
 	 * @param array $data
91 91
 	 */
92
-	public function process_price_select( $element, $data ) {
92
+	public function process_price_select($element, $data) {
93 93
 
94 94
 		// Abort if not passed.
95
-		if ( empty( $data[ $element['id'] ] ) ) {
95
+		if (empty($data[$element['id']])) {
96 96
 			return;
97 97
 		}
98 98
 
99
-		$options    = getpaid_convert_price_string_to_options( $element['options'] );
100
-		$selected   = array_filter( array_map( 'trim', explode( ',', $data[ $element['id'] ] ) ) );
99
+		$options    = getpaid_convert_price_string_to_options($element['options']);
100
+		$selected   = array_filter(array_map('trim', explode(',', $data[$element['id']])));
101 101
 		$total      = 0;
102 102
 		$sub_labels = array();
103 103
 
104
-		foreach ( $selected as $price ) {
104
+		foreach ($selected as $price) {
105 105
 
106
-			if ( ! isset( $options[ $price ] ) ) {
107
-				throw new Exception( __( 'You have selected an invalid amount', 'invoicing' ) );
106
+			if (!isset($options[$price])) {
107
+				throw new Exception(__('You have selected an invalid amount', 'invoicing'));
108 108
 			}
109 109
 
110
-			$price = explode( '|', $price );
110
+			$price = explode('|', $price);
111 111
 
112 112
 			$sub_labels[] = $price[0];
113
-			$total += (float) wpinv_sanitize_amount( $price[1] );
113
+			$total += (float) wpinv_sanitize_amount($price[1]);
114 114
 		}
115 115
 
116
-		$this->fees[ $element['label'] ] = array(
116
+		$this->fees[$element['label']] = array(
117 117
 			'name'          => $element['label'],
118 118
 			'initial_fee'   => $total,
119 119
 			'recurring_fee' => 0,
120
-			'description'   => implode( ', ', $sub_labels ),
120
+			'description'   => implode(', ', $sub_labels),
121 121
 		);
122 122
 
123 123
 	}
Please login to merge, or discard this patch.
includes/admin/class-getpaid-admin-setup-wizard.php 1 patch
Spacing   +59 added lines, -59 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' ),
119
+				'name'    => __("Business Details", 'invoicing'),
120
+				'view'    => array($this, 'setup_business'),
121 121
 				'handler' => '',
122 122
 			),
123 123
 
124 124
 			'currency' => array(
125
-				'name'    => __( 'Currency', 'invoicing' ),
126
-				'view'    => array( $this, 'setup_currency' ),
125
+				'name'    => __('Currency', 'invoicing'),
126
+				'view'    => array($this, 'setup_currency'),
127 127
 				'handler' => '',
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' ),
137
+				'name'    => __('Recommend', 'invoicing'),
138
+				'view'    => array($this, 'setup_recommend'),
139 139
 				'handler' => '',
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
@@ -254,9 +254,9 @@  discard block
 block discarded – undo
254 254
 	 */
255 255
 	public function display_footer() {
256 256
 
257
-		if ( isset( $_GET['step'] ) ) {
258
-			$next_url = esc_url( $this->get_next_step_link() );
259
-			$label    = $this->step == 'next_steps' ? __( 'Return to the WordPress Dashboard', 'invoicing' ) : __( 'Skip this step', 'invoicing' );
257
+		if (isset($_GET['step'])) {
258
+			$next_url = esc_url($this->get_next_step_link());
259
+			$label    = $this->step == 'next_steps' ? __('Return to the WordPress Dashboard', 'invoicing') : __('Skip this step', 'invoicing');
260 260
 
261 261
 			echo '<p class="gd-return-to-dashboard-wrap"> <a href="' . $next_url . '" class="gd-return-to-dashboard btn btn-link d-block text-muted">' . $label . '</a></p>';
262 262
 		}
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 */
272 272
 	public function setup_introduction() {
273 273
 		$next_url = $this->get_next_step_link();
274
-		include plugin_dir_path( __FILE__ ) . 'views/wizard-introduction.php';
274
+		include plugin_dir_path(__FILE__) . 'views/wizard-introduction.php';
275 275
 	}
276 276
 
277 277
 	/**
@@ -284,22 +284,22 @@  discard block
 block discarded – undo
284 284
 	 *                      Empty string on failure.
285 285
 	 * @since 3.0.0
286 286
 	 */
287
-	public function get_next_step_link( $step = '' ) {
288
-		if ( ! $step ) {
287
+	public function get_next_step_link($step = '') {
288
+		if (!$step) {
289 289
 			$step = $this->step;
290 290
 		}
291 291
 
292
-		$keys = array_keys( $this->steps );
293
-		if ( end( $keys ) === $step ) {
292
+		$keys = array_keys($this->steps);
293
+		if (end($keys) === $step) {
294 294
 			return admin_url();
295 295
 		}
296 296
 
297
-		$step_index = array_search( $step, $keys );
298
-		if ( false === $step_index ) {
297
+		$step_index = array_search($step, $keys);
298
+		if (false === $step_index) {
299 299
 			return '';
300 300
 		}
301 301
 
302
-		return remove_query_arg('settings-updated', add_query_arg( 'step', $keys[ $step_index + 1 ] ));
302
+		return remove_query_arg('settings-updated', add_query_arg('step', $keys[$step_index + 1]));
303 303
 	}
304 304
 
305 305
 	/**
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 		$wizard   = $this;
313 313
 		$page     = 'wpinv_settings_general_main';
314 314
 		$section  = 'wpinv_settings_general_main';
315
-		include plugin_dir_path( __FILE__ ) . 'views/wizard-settings.php';
315
+		include plugin_dir_path(__FILE__) . 'views/wizard-settings.php';
316 316
 	}
317 317
 
318 318
 	/**
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 		$wizard   = $this;
326 326
 		$page     = 'wpinv_settings_general_currency_section';
327 327
 		$section  = 'wpinv_settings_general_currency_section';
328
-		include plugin_dir_path( __FILE__ ) . 'views/wizard-settings.php';
328
+		include plugin_dir_path(__FILE__) . 'views/wizard-settings.php';
329 329
 	}
330 330
 
331 331
 	/**
@@ -336,35 +336,35 @@  discard block
 block discarded – undo
336 336
 	public function setup_recommend() {
337 337
 		$next_url            = $this->get_next_step_link();
338 338
 		$recommended_plugins = self::get_recommend_wp_plugins();
339
-		include plugin_dir_path( __FILE__ ) . 'views/wizard-plugins.php';
339
+		include plugin_dir_path(__FILE__) . 'views/wizard-plugins.php';
340 340
 	}
341 341
 
342 342
 	/**
343 343
 	 * A list of recommended wp.org plugins.
344 344
 	 * @return array
345 345
 	 */
346
-	public static function get_recommend_wp_plugins(){
346
+	public static function get_recommend_wp_plugins() {
347 347
 		return array(
348 348
 			'ayecode-connect' => array(
349 349
 				'file'   => 'ayecode-connect/ayecode-connect.php',
350 350
 				'url'    => 'https://wordpress.org/plugins/ayecode-connect/',
351 351
 				'slug'   => 'ayecode-connect',
352 352
 				'name'   => 'AyeCode Connect',
353
-				'desc'   => __( 'Documentation and Support from within your WordPress admin.', 'geodirectory' ),
353
+				'desc'   => __('Documentation and Support from within your WordPress admin.', 'geodirectory'),
354 354
 			),
355 355
 			'invoicing-quotes' => array(
356 356
 				'file'   => 'invoicing-quotes/wpinv-quote.php',
357 357
 				'url'    => 'https://wordpress.org/plugins/invoicing-quotes/',
358 358
 				'slug'   => 'invoicing-quotes',
359 359
 				'name'   => 'Customer Quotes',
360
-				'desc'   => __('Create & Send Quotes to Customers and have them accept and pay.','geodirectory'),
360
+				'desc'   => __('Create & Send Quotes to Customers and have them accept and pay.', 'geodirectory'),
361 361
 			),
362 362
 			'userswp'    => array(
363 363
 				'file'   => 'userswp/userswp.php',
364 364
 				'url'    => 'https://wordpress.org/plugins/userswp/',
365 365
 				'slug'   => 'userswp',
366 366
 				'name'   => 'UsersWP',
367
-				'desc'   => __('Frontend user login and registration as well as slick profile pages.','geodirectory'),
367
+				'desc'   => __('Frontend user login and registration as well as slick profile pages.', 'geodirectory'),
368 368
 			),
369 369
 		);
370 370
 	}
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	 */
377 377
 	public function setup_payments() {
378 378
 		$next_url = $this->get_next_step_link();
379
-		include plugin_dir_path( __FILE__ ) . 'views/wizard-gateways.php';
379
+		include plugin_dir_path(__FILE__) . 'views/wizard-gateways.php';
380 380
 	}
381 381
 
382 382
 	/**
@@ -387,16 +387,16 @@  discard block
 block discarded – undo
387 387
 	 * @since 2.0.0
388 388
 	 */
389 389
 	public function setup_payments_save() {
390
-		check_admin_referer( 'getpaid-setup-wizard', 'getpaid-setup-wizard' );
391
-		wpinv_update_option( 'manual_active', ! empty( $_POST['enable-manual-gateway'] ) );
390
+		check_admin_referer('getpaid-setup-wizard', 'getpaid-setup-wizard');
391
+		wpinv_update_option('manual_active', !empty($_POST['enable-manual-gateway']));
392 392
 
393
-		if ( ! empty( $_POST['paypal-email'] ) ) {
394
-			wpinv_update_option( 'paypal_email', sanitize_email( $_POST['paypal-email'] ) );
395
-			wpinv_update_option( 'paypal_active', 1 );
396
-			wpinv_update_option( 'paypal_sandbox', 0 );
393
+		if (!empty($_POST['paypal-email'])) {
394
+			wpinv_update_option('paypal_email', sanitize_email($_POST['paypal-email']));
395
+			wpinv_update_option('paypal_active', 1);
396
+			wpinv_update_option('paypal_sandbox', 0);
397 397
 		}
398 398
 
399
-		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
399
+		wp_redirect(esc_url_raw($this->get_next_step_link()));
400 400
 		exit;
401 401
 	}
402 402
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 	 * @since 2.0.0
407 407
 	 */
408 408
 	public function setup_ready() {
409
-		include plugin_dir_path( __FILE__ ) . 'views/wizard-thank-you.php';
409
+		include plugin_dir_path(__FILE__) . 'views/wizard-thank-you.php';
410 410
 	}
411 411
 
412 412
 }
Please login to merge, or discard this patch.
includes/admin/views/wizard-gateways.php 1 patch
Spacing   +17 added lines, -17 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,54 +12,54 @@  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>
25
-				    <?php if ( false === wpinv_get_option( 'stripe_live_connect_account_id' ) ) : ?>
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
+				    <?php if (false === wpinv_get_option('stripe_live_connect_account_id')) : ?>
26 26
                         <a href="<?php echo wp_nonce_url(
27 27
                             add_query_arg(
28 28
                                 array(
29 29
                                     'getpaid-admin-action' => 'connect_gateway',
30 30
                                     'plugin'               => 'stripe',
31
-                                    'redirect'             => urlencode( add_query_arg( 'step', 'payments' ) ),
31
+                                    'redirect'             => urlencode(add_query_arg('step', 'payments')),
32 32
                                 ),
33 33
                                 admin_url()
34 34
                             ),
35 35
                             'getpaid-nonce',
36 36
                             'getpaid-nonce'
37 37
                         ); ?>"
38
-                        class="btn btn-sm btn-outline-primary"><?php _e( 'Connect', 'invoicing' ); ?></a>
38
+                        class="btn btn-sm btn-outline-primary"><?php _e('Connect', 'invoicing'); ?></a>
39 39
                     <?php else: ?>
40
-                        <span class="btn btn-sm btn-success"><?php _e( 'Connected', 'invoicing' ); ?></span>
40
+                        <span class="btn btn-sm btn-success"><?php _e('Connected', 'invoicing'); ?></span>
41 41
                     <?php endif; ?>
42 42
 				</li>
43 43
 
44 44
 				<li class="list-group-item">
45 45
                     <div class="d-flex justify-content-between align-items-center">
46 46
                         <span class="mr-auto">
47
-                            <img src="<?php echo esc_url( WPINV_PLUGIN_URL . 'assets/images/pp-logo-150px.webp' );?>" class="" alt="PayPal" height="25">
47
+                            <img src="<?php echo esc_url(WPINV_PLUGIN_URL . 'assets/images/pp-logo-150px.webp'); ?>" class="" alt="PayPal" height="25">
48 48
                         </span>
49 49
                         <a
50 50
                             href="#"
51 51
                             onclick="jQuery('.getpaid-setup-paypal-input').toggleClass('d-none'); return false;"
52
-                            class="getpaid-setup-paypal btn btn-sm btn-outline-primary"><?php _e( 'Set-up', 'invoicing' ); ?></a>
52
+                            class="getpaid-setup-paypal btn btn-sm btn-outline-primary"><?php _e('Set-up', 'invoicing'); ?></a>
53 53
                     </div>
54 54
                     <div class="mt-4 getpaid-setup-paypal-input d-none">
55
-                        <input type="text" placeholder="<?php esc_attr_e( 'PayPal Email', 'invoicing' ); ?>" name="paypal-email" class="form-control" value="<?php echo esc_attr( wpinv_get_option( 'paypal_email' ) ); ?>">
55
+                        <input type="text" placeholder="<?php esc_attr_e('PayPal Email', 'invoicing'); ?>" name="paypal-email" class="form-control" value="<?php echo esc_attr(wpinv_get_option('paypal_email')); ?>">
56 56
                     </div>
57 57
                 </li>
58 58
 
59 59
 				<li class="list-group-item d-flex justify-content-between align-items-center">
60
-				    <span class="mr-auto"><?php _e( 'Test Getway', 'invoicing' ); ?></span>
60
+				    <span class="mr-auto"><?php _e('Test Getway', 'invoicing'); ?></span>
61 61
 					<div class="custom-control custom-switch">
62
-						<input type="checkbox" name="enable-manual-gateway" class="custom-control-input" id="enable-manual-gateway" <?php checked( wpinv_is_gateway_active( 'manual' ) ); ?>>
62
+						<input type="checkbox" name="enable-manual-gateway" class="custom-control-input" id="enable-manual-gateway" <?php checked(wpinv_is_gateway_active('manual')); ?>>
63 63
 						<label class="custom-control-label" for="enable-manual-gateway"></label>
64 64
 					</div>
65 65
 				</li>
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
         </div>
69 69
 
70 70
         <p class="gp-setup-actions step text-center mt-4">
71
-			<input type="submit" class="btn btn-primary" value="<?php esc_attr_e( 'Continue', 'invoicing' ); ?>" />
71
+			<input type="submit" class="btn btn-primary" value="<?php esc_attr_e('Continue', 'invoicing'); ?>" />
72 72
 		</p>
73 73
         
74
-        <?php getpaid_hidden_field( 'save_step', 1 ); ?>
75
-        <?php wp_nonce_field( 'getpaid-setup-wizard', 'getpaid-setup-wizard' ); ?>
74
+        <?php getpaid_hidden_field('save_step', 1); ?>
75
+        <?php wp_nonce_field('getpaid-setup-wizard', 'getpaid-setup-wizard'); ?>
76 76
     </form>
77 77
 </div>
Please login to merge, or discard this patch.
includes/admin/views/wizard-introduction.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -4,78 +4,78 @@  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 13
     <h1 class="h4 card-header bg-white border-bottom-0 pt-4 pb-1">
14
-        <?php esc_html_e( 'Welcome to the GetPaid Setup Wizard!', 'invoicing' ); ?>
14
+        <?php esc_html_e('Welcome to the GetPaid Setup Wizard!', 'invoicing'); ?>
15 15
     </h1>
16 16
 
17 17
     <div class="card-body text-muted ">
18
-        <p><?php _e( 'Thank you for choosing GetPaid - The most Powerful Payments Plugin for WordPress', 'invoicing' ); ?></p>
18
+        <p><?php _e('Thank you for choosing GetPaid - The most Powerful Payments Plugin for WordPress', 'invoicing'); ?></p>
19 19
         <hr class="mt-4 pt-3 pb-0" />
20
-        <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>
20
+        <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>
21 21
     </div>
22 22
 
23 23
     <div class="card-footer mb-0 bg-white gp-setup-actions step border-top-0">
24 24
         <a
25
-            href="<?php echo esc_url( $next_url ); ?>"
26
-            class="btn btn-primary button-next"><?php esc_html_e( "Let's go!", 'invoicing' ); ?></a>
25
+            href="<?php echo esc_url($next_url); ?>"
26
+            class="btn btn-primary button-next"><?php esc_html_e("Let's go!", 'invoicing'); ?></a>
27 27
         <a
28
-            href="<?php echo esc_url( admin_url() ); ?>"
29
-            class="btn btn-link d-block mt-2 "><?php esc_html_e( 'Not right now', 'invoicing' ); ?></a>
28
+            href="<?php echo esc_url(admin_url()); ?>"
29
+            class="btn btn-link d-block mt-2 "><?php esc_html_e('Not right now', 'invoicing'); ?></a>
30 30
     </div>
31 31
 </div>
32 32
 
33 33
 <div class="card shadow-sm my-5 overflow-hidden">
34 34
     <h1 class="h4 card-header bg-white border-bottom-0  pt-4 pb-1">
35
-        <?php esc_html_e( 'GetPaid Features & Addons!', 'invoicing' ); ?>
35
+        <?php esc_html_e('GetPaid Features & Addons!', 'invoicing'); ?>
36 36
     </h1>
37 37
 
38 38
     <div class="card-body text-muted overflow-hidden">
39
-		<p><?php _e( 'Collect one time & recurring payments online within minutes. No complex setup required.', 'invoicing' ); ?></p>
39
+		<p><?php _e('Collect one time & recurring payments online within minutes. No complex setup required.', 'invoicing'); ?></p>
40 40
 		<hr>
41 41
 
42 42
 		<div class="row row-cols-2 text-left">
43 43
 			<div class="col mt-3">
44 44
 				<div class="media">
45
-                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/buy.svg';?>" class="mr-3" alt="...">
45
+                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/buy.svg'; ?>" class="mr-3" alt="...">
46 46
                     <div class="media-body">
47
-                        <h6 class="mt-0 font-weight-bold"><?php _e( 'GetPaid via Buy Now Buttons', 'invoicing' );?></h6>
48
-                        <small><?php _e( 'Sell via buy now buttons anywhere on your site', 'invoicing' );?></small>
47
+                        <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Buy Now Buttons', 'invoicing'); ?></h6>
48
+                        <small><?php _e('Sell via buy now buttons anywhere on your site', 'invoicing'); ?></small>
49 49
                     </div>
50 50
                 </div>
51 51
 			</div>
52 52
 
53 53
             <div class="col mt-3">
54 54
                 <div class="media">
55
-                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/report.svg';?>" class="mr-3" alt="...">
55
+                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/report.svg'; ?>" class="mr-3" alt="...">
56 56
                         <div class="media-body">
57
-                        <h6 class="mt-0 font-weight-bold"><?php _e( 'GetPaid via payment form', 'invoicing' );?></h6>
58
-                        <small><?php _e( 'Payment forms are conversion-optimized checkout forms', 'invoicing' );?></small>
57
+                        <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via payment form', 'invoicing'); ?></h6>
58
+                        <small><?php _e('Payment forms are conversion-optimized checkout forms', 'invoicing'); ?></small>
59 59
                     </div>
60 60
                 </div>
61 61
 		    </div>
62 62
 
63 63
             <div class="col mt-3">
64 64
                 <div class="media">
65
-                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/invoices.svg';?>" class="mr-3" alt="...">
65
+                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/invoices.svg'; ?>" class="mr-3" alt="...">
66 66
                     <div class="media-body">
67
-                        <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Invoice','invoicing');?></h6>
68
-                        <small><?php _e('Create and send invoices for just about anything from the WordPress dashboard','invoicing');?></small>
67
+                        <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Invoice', 'invoicing'); ?></h6>
68
+                        <small><?php _e('Create and send invoices for just about anything from the WordPress dashboard', 'invoicing'); ?></small>
69 69
                     </div>
70 70
                 </div>
71 71
 		    </div>
72 72
 
73 73
             <div class="col mt-3">
74 74
                 <div class="media">
75
-                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/payment.svg';?>" class="mr-3" alt="...">
75
+                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/payment.svg'; ?>" class="mr-3" alt="...">
76 76
                     <div class="media-body">
77
-                        <h6 class="mt-0 font-weight-bold"><?php _e('Affordable payment gateways','invoicing');?></h6>
78
-                        <small><?php _e('On average our gateways are over 66% cheaper than our competition','invoicing');?></small>
77
+                        <h6 class="mt-0 font-weight-bold"><?php _e('Affordable payment gateways', 'invoicing'); ?></h6>
78
+                        <small><?php _e('On average our gateways are over 66% cheaper than our competition', 'invoicing'); ?></small>
79 79
                     </div>
80 80
                 </div>
81 81
 		    </div>
@@ -86,51 +86,51 @@  discard block
 block discarded – undo
86 86
 	<div class="mt-5">
87 87
 		<a
88 88
             href="https://wpgetpaid.com/features-list/"
89
-			class="btn btn-primary"><?php esc_html_e( 'View All Features!', 'invoicing' ); ?></a>
89
+			class="btn btn-primary"><?php esc_html_e('View All Features!', 'invoicing'); ?></a>
90 90
 	</div>
91 91
 
92 92
 	<div class="mt-5 mx-n4 py-4" style="background:#eafaf6;">
93
-		<h4 class="mt-0 font-weight-bold text-dark mb-4"><?php _e( 'More with Membership!' , 'invoicing' );?></h4>
93
+		<h4 class="mt-0 font-weight-bold text-dark mb-4"><?php _e('More with Membership!', 'invoicing'); ?></h4>
94 94
 		<div class="row row-cols-2 text-left px-5">
95 95
 
96 96
 			<div class="col">
97 97
 				<ul class="list-unstyled">
98
-					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'PDF Invoices' , 'invoicing' );?></li>
99
-					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'Gravity Forms' , 'invoicing' );?></li>
100
-					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'Contact form 7' , 'invoicing' );?></li>
101
-					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'AffiliateWP Integration' , 'invoicing' );?></li>
98
+					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('PDF Invoices', 'invoicing'); ?></li>
99
+					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('Gravity Forms', 'invoicing'); ?></li>
100
+					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('Contact form 7', 'invoicing'); ?></li>
101
+					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('AffiliateWP Integration', 'invoicing'); ?></li>
102 102
 				</ul>
103 103
 			</div>
104 104
 
105 105
 			<div class="col">
106 106
 				<ul class="list-unstyled">
107
-			    	<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'Ninja forms' , 'invoicing' );?></li>
108
-					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'Digital Downloads' , 'invoicing' );?></li>
109
-					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'Wallet' , 'invoicing' );?></li>
107
+			    	<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('Ninja forms', 'invoicing'); ?></li>
108
+					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('Digital Downloads', 'invoicing'); ?></li>
109
+					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('Wallet', 'invoicing'); ?></li>
110 110
 				</ul>
111 111
 			</div>
112 112
 		</div>
113 113
 
114
-		<h5 class="mt-4 font-weight-bold text-dark mb-3"><?php _e('Membership Starts From','invoicing');?></h5>
115
-		<h1 class="mt-0 font-weight-bold text-dark mb-4 display-3"><?php esc_html_e( '$49', 'invoicing' ); ?></h1>
114
+		<h5 class="mt-4 font-weight-bold text-dark mb-3"><?php _e('Membership Starts From', 'invoicing'); ?></h5>
115
+		<h1 class="mt-0 font-weight-bold text-dark mb-4 display-3"><?php esc_html_e('$49', 'invoicing'); ?></h1>
116 116
 
117 117
 		<div class="mt-2">
118 118
 			<a
119 119
                 href="https://wpgetpaid.com/downloads/membership/"
120
-				class="btn btn-primary"><?php esc_html_e( 'Buy Membership Now!', 'invoicing' ); ?></a>
120
+				class="btn btn-primary"><?php esc_html_e('Buy Membership Now!', 'invoicing'); ?></a>
121 121
 		</div>
122 122
 
123 123
 	</div>
124 124
 
125 125
     <div class="card-footer mb-0 bg-white gp-setup-actions step border-top-0">
126 126
         <a
127
-            href="<?php echo esc_url( $next_url ); ?>"
128
-            class="btn btn-outline-primary button-next"><?php esc_html_e( 'Launch the Setup Wizard!', 'invoicing' ); ?></a>
127
+            href="<?php echo esc_url($next_url); ?>"
128
+            class="btn btn-outline-primary button-next"><?php esc_html_e('Launch the Setup Wizard!', 'invoicing'); ?></a>
129 129
         <a
130 130
             href="https://docs.wpgetpaid.com/"
131
-            class="btn btn-outline-primary ml-4"><?php esc_html_e( 'Documentation', 'invoicing' ); ?></a>
131
+            class="btn btn-outline-primary ml-4"><?php esc_html_e('Documentation', 'invoicing'); ?></a>
132 132
         <a
133
-            href="<?php echo esc_url( admin_url() ); ?>"
134
-            class="btn btn-link d-block mt-2 "><?php esc_html_e( 'Not right now', 'invoicing' ); ?></a>
133
+            href="<?php echo esc_url(admin_url()); ?>"
134
+            class="btn btn-link d-block mt-2 "><?php esc_html_e('Not right now', 'invoicing'); ?></a>
135 135
     </div>
136 136
 </div>
Please login to merge, or discard this patch.
includes/class-getpaid-daily-maintenance.php 1 patch
Spacing   +35 added lines, -35 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
  * Daily maintenance class.
@@ -15,20 +15,20 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	 * Class constructor.
17 17
 	 */
18
-	public function __construct(){
18
+	public function __construct() {
19 19
 
20 20
 		// Clear deprecated events.
21
-		add_action( 'wp', array( $this, 'maybe_clear_deprecated_events' ) );
21
+		add_action('wp', array($this, 'maybe_clear_deprecated_events'));
22 22
 
23 23
 		// (Maybe) schedule a cron that runs daily.
24
-		add_action( 'wp', array( $this, 'maybe_create_scheduled_event' ) );
24
+		add_action('wp', array($this, 'maybe_create_scheduled_event'));
25 25
 
26 26
 		// Fired everyday at 7 a.m (this might vary for sites with few visitors)
27
-		add_action( 'getpaid_daily_maintenance', array( $this, 'log_cron_run' ) );
28
-		add_action( 'getpaid_daily_maintenance', array( $this, 'backwards_compat' ) );
29
-		add_action( 'getpaid_daily_maintenance', array( $this, 'maybe_expire_subscriptions' ) );
30
-		add_action( 'getpaid_daily_maintenance', array( $this, 'check_renewing_subscriptions' ) );
31
-		add_action( 'getpaid_daily_maintenance', array( $this, 'maybe_update_geoip_databases' ) );
27
+		add_action('getpaid_daily_maintenance', array($this, 'log_cron_run'));
28
+		add_action('getpaid_daily_maintenance', array($this, 'backwards_compat'));
29
+		add_action('getpaid_daily_maintenance', array($this, 'maybe_expire_subscriptions'));
30
+		add_action('getpaid_daily_maintenance', array($this, 'check_renewing_subscriptions'));
31
+		add_action('getpaid_daily_maintenance', array($this, 'maybe_update_geoip_databases'));
32 32
 
33 33
 	}
34 34
 
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	public function maybe_create_scheduled_event() {
40 40
 
41
-		if ( ! wp_next_scheduled( 'getpaid_daily_maintenance' ) ) {
42
-			$timestamp = strtotime( 'tomorrow 07:00:00', current_time( 'timestamp' ) );
43
-			wp_schedule_event( $timestamp, 'daily', 'getpaid_daily_maintenance' );
41
+		if (!wp_next_scheduled('getpaid_daily_maintenance')) {
42
+			$timestamp = strtotime('tomorrow 07:00:00', current_time('timestamp'));
43
+			wp_schedule_event($timestamp, 'daily', 'getpaid_daily_maintenance');
44 44
 		}
45 45
 
46 46
 	}
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function maybe_clear_deprecated_events() {
53 53
 
54
-		if ( ! get_option( 'wpinv_cleared_old_events' ) ) {
55
-			wp_clear_scheduled_hook( 'wpinv_register_schedule_event_twicedaily' );
56
-			wp_clear_scheduled_hook( 'wpinv_register_schedule_event_daily' );
57
-			update_option( 'wpinv_cleared_old_events', 1 );
54
+		if (!get_option('wpinv_cleared_old_events')) {
55
+			wp_clear_scheduled_hook('wpinv_register_schedule_event_twicedaily');
56
+			wp_clear_scheduled_hook('wpinv_register_schedule_event_daily');
57
+			update_option('wpinv_cleared_old_events', 1);
58 58
 		}
59 59
 
60 60
 	}
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 */
66 66
 	public function backwards_compat() {
67
-		do_action( 'wpinv_register_schedule_event_daily' );
67
+		do_action('wpinv_register_schedule_event_daily');
68 68
 	}
69 69
 
70 70
 	/**
@@ -74,29 +74,29 @@  discard block
 block discarded – undo
74 74
 	public function check_renewing_subscriptions() {
75 75
 
76 76
 		// Fetch subscriptions that expire today.
77
-		$args  = array(
77
+		$args = array(
78 78
 			'number'             => -1,
79 79
 			'count_total'        => false,
80 80
 			'status'             => 'trialling active',
81 81
 			'date_expires_query' => array(
82 82
 				array(
83
-					'year'          => date( 'Y', current_time( 'timestamp' ) ),
84
-					'month'         => date( 'n', current_time( 'timestamp' ) ),
85
-					'day'           => date( 'j', current_time( 'timestamp' ) ),
83
+					'year'          => date('Y', current_time('timestamp')),
84
+					'month'         => date('n', current_time('timestamp')),
85
+					'day'           => date('j', current_time('timestamp')),
86 86
 					'compare'       => '=',
87 87
 				),
88 88
 			),
89 89
 		);
90 90
 
91
-		$subscriptions = new GetPaid_Subscriptions_Query( $args );
91
+		$subscriptions = new GetPaid_Subscriptions_Query($args);
92 92
 
93
-		foreach ( $subscriptions->get_results() as $subscription ) {
93
+		foreach ($subscriptions->get_results() as $subscription) {
94 94
 
95 95
 			/** @var WPInv_Subscription $subscription */
96
-			if ( $subscription->is_last_renewal() ) {
96
+			if ($subscription->is_last_renewal()) {
97 97
 				$subscription->complete();
98 98
 			} else {
99
-				do_action( 'getpaid_should_renew_subscription', $subscription );
99
+				do_action('getpaid_should_renew_subscription', $subscription);
100 100
 			}
101 101
 
102 102
 		}
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	public function maybe_expire_subscriptions() {
111 111
 
112 112
 		// Fetch expired subscriptions (skips those that expire today).
113
-		$args  = array(
113
+		$args = array(
114 114
 			'number'             => -1,
115 115
 			'count_total'        => false,
116 116
 			'status'             => 'trialling active failing cancelled',
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 			),
121 121
 		);
122 122
 
123
-		$subscriptions = new GetPaid_Subscriptions_Query( $args );
123
+		$subscriptions = new GetPaid_Subscriptions_Query($args);
124 124
 
125
-		foreach ( $subscriptions->get_results() as $subscription ) {
126
-			if ( apply_filters( 'getpaid_daily_maintenance_should_expire_subscription', false, $subscription ) ) {
127
-				$subscription->set_status( 'expired' );
125
+		foreach ($subscriptions->get_results() as $subscription) {
126
+			if (apply_filters('getpaid_daily_maintenance_should_expire_subscription', false, $subscription)) {
127
+				$subscription->set_status('expired');
128 128
 				$subscription->save();
129 129
 			}
130 130
 		}
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 */
138 138
 	public function log_cron_run() {
139
-		wpinv_error_log( 'GetPaid Daily Cron', false );
139
+		wpinv_error_log('GetPaid Daily Cron', false);
140 140
 	}
141 141
 
142 142
 	/**
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 	 *
145 145
 	 */
146 146
 	public function maybe_update_geoip_databases() {
147
-		$updated = get_transient( 'getpaid_updated_geoip_databases' );
147
+		$updated = get_transient('getpaid_updated_geoip_databases');
148 148
 
149
-		if ( false === $updated ) {
150
-			set_transient( 'getpaid_updated_geoip_databases', 1, 15 * DAY_IN_SECONDS );
151
-			do_action( 'getpaid_update_geoip_databases' );
149
+		if (false === $updated) {
150
+			set_transient('getpaid_updated_geoip_databases', 1, 15 * DAY_IN_SECONDS);
151
+			do_action('getpaid_update_geoip_databases');
152 152
 		}
153 153
 
154 154
 	}
Please login to merge, or discard this patch.
includes/class-wpinv-addons.php 1 patch
Spacing   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * All Invoicing extensions screen related functions can be found here.
6 6
  *
7 7
  */
8
-if ( ! defined( 'ABSPATH' ) ) {
8
+if (!defined('ABSPATH')) {
9 9
 	exit;
10 10
 }
11 11
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 *
21 21
 	 * @return array of tabs.
22 22
 	 */
23
-	public function get_tabs(){
23
+	public function get_tabs() {
24 24
 		$tabs = array(
25 25
 			'addons' => __("Addons", "invoicing"),
26 26
             'gateways' => __("Payment Gateways", "invoicing"),
@@ -38,28 +38,28 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @return array
40 40
 	 */
41
-	public function get_section_data( $section_id ) {
42
-		$section      = self::get_tab( $section_id );
41
+	public function get_section_data($section_id) {
42
+		$section      = self::get_tab($section_id);
43 43
 		$api_url = "https://wpinvoicing.com/edd-api/v2/products/";
44 44
 		$section_data = new stdClass();
45 45
 
46
-		if($section_id=='recommended_plugins'){
46
+		if ($section_id == 'recommended_plugins') {
47 47
 			$section_data->products = self::get_recommend_wp_plugins_edd_formatted();
48 48
 		}
49
-		elseif ( ! empty( $section ) ) {
50
-			if ( false === ( $section_data = get_transient( 'wpi_addons_section_' . $section_id ) ) ) { //@todo restore after testing
49
+		elseif (!empty($section)) {
50
+			if (false === ($section_data = get_transient('wpi_addons_section_' . $section_id))) { //@todo restore after testing
51 51
 			//if ( 1==1) {
52 52
 
53
-				$query_args = array( 'category' => $section_id, 'number' => 100);
54
-				$query_args = apply_filters('wpeu_edd_api_query_args',$query_args,$api_url,$section_id);
53
+				$query_args = array('category' => $section_id, 'number' => 100);
54
+				$query_args = apply_filters('wpeu_edd_api_query_args', $query_args, $api_url, $section_id);
55 55
 
56
-				$raw_section = wp_safe_remote_get( esc_url_raw( add_query_arg($query_args ,$api_url) ), array( 'user-agent' => 'Invoicing Addons Page','timeout'     => 15, ) );
56
+				$raw_section = wp_safe_remote_get(esc_url_raw(add_query_arg($query_args, $api_url)), array('user-agent' => 'Invoicing Addons Page', 'timeout'     => 15,));
57 57
 
58
-				if ( ! is_wp_error( $raw_section ) ) {
59
-					$section_data = json_decode( wp_remote_retrieve_body( $raw_section ) );
58
+				if (!is_wp_error($raw_section)) {
59
+					$section_data = json_decode(wp_remote_retrieve_body($raw_section));
60 60
 
61
-					if ( ! empty( $section_data->products ) ) {
62
-						set_transient( 'wpi_addons_section_' . $section_id, $section_data, DAY_IN_SECONDS );
61
+					if (!empty($section_data->products)) {
62
+						set_transient('wpi_addons_section_' . $section_id, $section_data, DAY_IN_SECONDS);
63 63
 					}
64 64
 				}
65 65
 			}
@@ -67,21 +67,21 @@  discard block
 block discarded – undo
67 67
 		}
68 68
 
69 69
 		$products = isset($section_data->products) ? $section_data->products : array();
70
-		if ( 'addons' == $section_id ) {
70
+		if ('addons' == $section_id) {
71 71
 
72 72
 			$quotes = new stdClass();
73 73
 			$quotes->info = new stdClass();
74 74
 			$quotes->info->id = '';
75 75
 			$quotes->info->slug = 'invoicing-quotes';
76
-			$quotes->info->title = __( 'Quotes', 'invoicing' );
77
-			$quotes->info->excerpt = __( 'Create quotes and estimates', 'invoicing' );
76
+			$quotes->info->title = __('Quotes', 'invoicing');
77
+			$quotes->info->excerpt = __('Create quotes and estimates', 'invoicing');
78 78
 			$quotes->info->link = 'https://wordpress.org/plugins/invoicing-quotes/';
79 79
 			$quotes->info->thumbnail = 'https://wpgetpaid.com/wp-content/uploads/sites/13/edd/2019/11/Quotes-1-768x384.png';
80 80
 
81 81
 			$products[] = $quotes;
82 82
 		}
83 83
 		
84
-		return apply_filters( 'wpi_addons_section_data', $products, $section_id );
84
+		return apply_filters('wpi_addons_section_data', $products, $section_id);
85 85
 	}
86 86
 
87 87
 	/**
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 	 * @param string $theme
93 93
 	 * @param string $plugin
94 94
 	 */
95
-	public function output_button( $addon ) {
96
-		$current_tab     = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] );
95
+	public function output_button($addon) {
96
+		$current_tab = empty($_GET['tab']) ? 'addons' : sanitize_title($_GET['tab']);
97 97
 //		$button_text = __('Free','invoicing');
98 98
 //		$licensing = false;
99 99
 //		$installed = false;
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
 //		$install_status = 'get';
106 106
 //		$onclick = '';
107 107
 
108
-		$wp_org_themes = array('supreme-directory','directory-starter');
108
+		$wp_org_themes = array('supreme-directory', 'directory-starter');
109 109
 
110 110
 		$button_args = array(
111
-			'type' => ($current_tab == 'addons' || $current_tab =='gateways') ? 'addons' : $current_tab,
111
+			'type' => ($current_tab == 'addons' || $current_tab == 'gateways') ? 'addons' : $current_tab,
112 112
 			'id' => isset($addon->info->id) ? absint($addon->info->id) : '',
113 113
 			'title' => isset($addon->info->title) ? $addon->info->title : '',
114
-			'button_text' => __('Free','invoicing'),
115
-			'price_text' => __('Free','invoicing'),
114
+			'button_text' => __('Free', 'invoicing'),
115
+			'price_text' => __('Free', 'invoicing'),
116 116
 			'link' => isset($addon->info->link) ? $addon->info->link : '', // link to product
117 117
 			'url' => isset($addon->info->link) ? $addon->info->link : '', // button url
118 118
 			'class' => 'button-primary',
@@ -128,83 +128,83 @@  discard block
 block discarded – undo
128 128
 			'update_url' => '',
129 129
 		);
130 130
 
131
-		if( 'invoicing-quotes' == $addon->info->slug || 'getpaid-stripe-payments' == $addon->info->slug || ( $current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug )){
132
-			include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
133
-			$status = install_plugin_install_status(array("slug"=>$button_args['slug'],"version"=>""));
131
+		if ('invoicing-quotes' == $addon->info->slug || 'getpaid-stripe-payments' == $addon->info->slug || ($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug)) {
132
+			include_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); //for plugins_api..
133
+			$status = install_plugin_install_status(array("slug"=>$button_args['slug'], "version"=>""));
134 134
 			$button_args['install_status'] = isset($status['status']) ? $status['status'] : 'install';
135 135
 			$button_args['file'] = isset($status['file']) ? $status['file'] : '';
136
-		}elseif( ($current_tab == 'addons' || $current_tab =='gateways') && isset($addon->info->id) && $addon->info->id){
137
-			include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
138
-			if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;}
136
+		}elseif (($current_tab == 'addons' || $current_tab == 'gateways') && isset($addon->info->id) && $addon->info->id) {
137
+			include_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); //for plugins_api..
138
+			if (!empty($addon->licensing->edd_slug)) {$button_args['slug'] = $addon->licensing->edd_slug; }
139 139
 			$status = self::install_plugin_install_status($addon);
140 140
 			$button_args['file'] = isset($status['file']) ? $status['file'] : '';
141
-			if(isset($status['status'])){$button_args['install_status'] = $status['status'];}
141
+			if (isset($status['status'])) {$button_args['install_status'] = $status['status']; }
142 142
 			$button_args['update_url'] = "https://wpinvoicing.com";
143
-		}elseif($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) {
144
-			if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;}
143
+		}elseif ($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) {
144
+			if (!empty($addon->licensing->edd_slug)) {$button_args['slug'] = $addon->licensing->edd_slug; }
145 145
 			$button_args['installed'] = self::is_theme_installed($addon);
146
-			if(!in_array($button_args['slug'],$wp_org_themes)){
146
+			if (!in_array($button_args['slug'], $wp_org_themes)) {
147 147
 				$button_args['update_url'] = "https://wpinvoicing.com";
148 148
 			}
149 149
 		}
150 150
 
151 151
 		// set price
152
-		if(isset($addon->pricing) && !empty($addon->pricing)){
153
-			if(is_object($addon->pricing)){
154
-				$prices = (Array)$addon->pricing;
152
+		if (isset($addon->pricing) && !empty($addon->pricing)) {
153
+			if (is_object($addon->pricing)) {
154
+				$prices = (Array) $addon->pricing;
155 155
 				$button_args['price'] = reset($prices);
156
-			}elseif(isset($addon->pricing)){
156
+			}elseif (isset($addon->pricing)) {
157 157
 				$button_args['price'] = $addon->pricing;
158 158
 			}
159 159
 		}
160 160
 
161 161
 		// set price text
162
-		if( $button_args['price'] && $button_args['price'] != '0.00' ){
163
-			$button_args['price_text'] = sprintf( __('From: $%d', 'invoicing'), $button_args['price']);
162
+		if ($button_args['price'] && $button_args['price'] != '0.00') {
163
+			$button_args['price_text'] = sprintf(__('From: $%d', 'invoicing'), $button_args['price']);
164 164
 		}
165 165
 
166 166
 
167 167
 		// set if installed
168
-		if(in_array($button_args['install_status'], array('installed','latest_installed','update_available','newer_installed'))){
168
+		if (in_array($button_args['install_status'], array('installed', 'latest_installed', 'update_available', 'newer_installed'))) {
169 169
 			$button_args['installed'] = true;
170 170
 		}
171 171
 
172 172
 //		print_r($button_args);
173 173
 		// set if active
174
-		if($button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes')){
175
-			if($button_args['type'] != 'themes'){
174
+		if ($button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes')) {
175
+			if ($button_args['type'] != 'themes') {
176 176
 				$button_args['active'] = is_plugin_active($button_args['file']);
177
-			}else{
177
+			} else {
178 178
 				$button_args['active'] = self::is_theme_active($addon);
179 179
 			}
180 180
 		}
181 181
 
182 182
 		// set button text and class
183
-		if($button_args['active']){
184
-			$button_args['button_text'] = __('Active','invoicing');
183
+		if ($button_args['active']) {
184
+			$button_args['button_text'] = __('Active', 'invoicing');
185 185
 			$button_args['class'] = ' button-secondary disabled ';
186
-		}elseif($button_args['installed']){
187
-			$button_args['button_text'] = __('Activate','invoicing');
186
+		}elseif ($button_args['installed']) {
187
+			$button_args['button_text'] = __('Activate', 'invoicing');
188 188
 
189
-			if($button_args['type'] != 'themes'){
190
-				if ( current_user_can( 'manage_options' ) ) {
191
-					$button_args['url'] = wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$button_args['file']), 'activate-plugin_' . $button_args['file']);
192
-				}else{
189
+			if ($button_args['type'] != 'themes') {
190
+				if (current_user_can('manage_options')) {
191
+					$button_args['url'] = wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . $button_args['file']), 'activate-plugin_' . $button_args['file']);
192
+				} else {
193 193
 					$button_args['url'] = '#';
194 194
 				}
195
-			}else{
196
-				if ( current_user_can( 'switch_themes' ) ) {
195
+			} else {
196
+				if (current_user_can('switch_themes')) {
197 197
 					$button_args['url'] = self::get_theme_activation_url($addon);
198
-				}else{
198
+				} else {
199 199
 					$button_args['url'] = '#';
200 200
 				}
201 201
 			}
202 202
 
203
-		}else{
204
-			if($button_args['type'] == 'recommended_plugins'){
205
-				$button_args['button_text'] = __('Install','invoicing');
206
-			}else{
207
-				$button_args['button_text'] = __('Get it','invoicing');
203
+		} else {
204
+			if ($button_args['type'] == 'recommended_plugins') {
205
+				$button_args['button_text'] = __('Install', 'invoicing');
206
+			} else {
207
+				$button_args['button_text'] = __('Get it', 'invoicing');
208 208
 
209 209
 				/*if($button_args['type'] == 'themes' && in_array($button_args['slug'],$wp_org_themes) ){
210 210
 					$button_args['button_text'] = __('Install','invoicing');
@@ -217,45 +217,45 @@  discard block
 block discarded – undo
217 217
 
218 218
 		
219 219
 		// filter the button arguments
220
-		$button_args = apply_filters('edd_api_button_args',$button_args);
220
+		$button_args = apply_filters('edd_api_button_args', $button_args);
221 221
 //		print_r($button_args);
222 222
 		// set price text
223
-		if(isset($button_args['price_text'])){
223
+		if (isset($button_args['price_text'])) {
224 224
 			?>
225 225
 			<a
226 226
 				target="_blank"
227 227
 				class="addons-price-text"
228
-				href="<?php echo esc_url( $button_args['link'] ); ?>">
229
-				<?php echo esc_html( $button_args['price_text'] ); ?>
228
+				href="<?php echo esc_url($button_args['link']); ?>">
229
+				<?php echo esc_html($button_args['price_text']); ?>
230 230
 			</a>
231 231
 			<?php
232 232
 		}
233 233
 
234 234
 
235 235
 		$target = '';
236
-		if ( ! empty( $button_args['url'] ) ) {
236
+		if (!empty($button_args['url'])) {
237 237
 			$target = strpos($button_args['url'], get_site_url()) !== false ? '' : ' target="_blank" ';
238 238
 		}
239 239
 
240 240
 		?>
241 241
 		<a
242
-			data-licence="<?php echo esc_attr($button_args['license']);?>"
243
-			data-licensing="<?php echo $button_args['licensing'] ? 1 : 0;?>"
244
-			data-title="<?php echo esc_attr($button_args['title']);?>"
245
-			data-type="<?php echo esc_attr($button_args['type']);?>"
246
-			data-text-error-message="<?php _e('Something went wrong!','invoicing');?>"
247
-			data-text-activate="<?php _e('Activate','invoicing');?>"
248
-			data-text-activating="<?php _e('Activating','invoicing');?>"
249
-			data-text-deactivate="<?php _e('Deactivate','invoicing');?>"
250
-			data-text-installed="<?php _e('Installed','invoicing');?>"
251
-			data-text-install="<?php _e('Install','invoicing');?>"
252
-			data-text-installing="<?php _e('Installing','invoicing');?>"
253
-			data-text-error="<?php _e('Error','invoicing');?>"
254
-			<?php if(!empty($button_args['onclick'])){echo " onclick='".$button_args['onclick']."' ";}?>
255
-			<?php echo $target;?>
256
-			class="addons-button  <?php echo esc_attr( $button_args['class'] ); ?>"
257
-			href="<?php echo esc_url( $button_args['url'] ); ?>">
258
-			<?php echo esc_html( $button_args['button_text'] ); ?>
242
+			data-licence="<?php echo esc_attr($button_args['license']); ?>"
243
+			data-licensing="<?php echo $button_args['licensing'] ? 1 : 0; ?>"
244
+			data-title="<?php echo esc_attr($button_args['title']); ?>"
245
+			data-type="<?php echo esc_attr($button_args['type']); ?>"
246
+			data-text-error-message="<?php _e('Something went wrong!', 'invoicing'); ?>"
247
+			data-text-activate="<?php _e('Activate', 'invoicing'); ?>"
248
+			data-text-activating="<?php _e('Activating', 'invoicing'); ?>"
249
+			data-text-deactivate="<?php _e('Deactivate', 'invoicing'); ?>"
250
+			data-text-installed="<?php _e('Installed', 'invoicing'); ?>"
251
+			data-text-install="<?php _e('Install', 'invoicing'); ?>"
252
+			data-text-installing="<?php _e('Installing', 'invoicing'); ?>"
253
+			data-text-error="<?php _e('Error', 'invoicing'); ?>"
254
+			<?php if (!empty($button_args['onclick'])) {echo " onclick='" . $button_args['onclick'] . "' "; }?>
255
+			<?php echo $target; ?>
256
+			class="addons-button  <?php echo esc_attr($button_args['class']); ?>"
257
+			href="<?php echo esc_url($button_args['url']); ?>">
258
+			<?php echo esc_html($button_args['button_text']); ?>
259 259
 		</a>
260 260
 		<?php
261 261
 
@@ -270,36 +270,36 @@  discard block
 block discarded – undo
270 270
 		$tabs            = self::get_tabs();
271 271
 		$sections        = self::get_sections();
272 272
 		$theme           = wp_get_theme();
273
-		$section_keys    = array_keys( $sections );
274
-		$current_section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : current( $section_keys );
275
-		$current_tab     = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] );
276
-		include_once( WPINV_PLUGIN_DIR . '/includes/admin/html-admin-page-addons.php' );
273
+		$section_keys    = array_keys($sections);
274
+		$current_section = isset($_GET['section']) ? sanitize_text_field($_GET['section']) : current($section_keys);
275
+		$current_tab     = empty($_GET['tab']) ? 'addons' : sanitize_title($_GET['tab']);
276
+		include_once(WPINV_PLUGIN_DIR . '/includes/admin/html-admin-page-addons.php');
277 277
 	}
278 278
 
279 279
 	/**
280 280
 	 * A list of recommended wp.org plugins.
281 281
 	 * @return array
282 282
 	 */
283
-	public function get_recommend_wp_plugins(){
283
+	public function get_recommend_wp_plugins() {
284 284
 		$plugins = array(
285 285
             'invoicing-quotes' => array(
286 286
                 'url'   => 'https://wordpress.org/plugins/invoicing-quotes/',
287 287
                 'slug'   => 'invoicing-quotes',
288 288
 				'name'   => 'Quotes',
289 289
 				'thumbnail'  => 'https://ps.w.org/invoicing-quotes/assets/banner-772x250.png',
290
-                'desc'   => __('Allows you to create quotes, send them to clients and convert them to Invoices when accepted by the customer.','invoicing'),
290
+                'desc'   => __('Allows you to create quotes, send them to clients and convert them to Invoices when accepted by the customer.', 'invoicing'),
291 291
             ),
292 292
             'geodirectory' => array(
293 293
                 'url'   => 'https://wordpress.org/plugins/geodirectory/',
294 294
                 'slug'   => 'geodirectory',
295 295
                 'name'   => 'GeoDirectory',
296
-                'desc'   => __('Turn any WordPress theme into a global business directory portal.','invoicing'),
296
+                'desc'   => __('Turn any WordPress theme into a global business directory portal.', 'invoicing'),
297 297
             ),
298 298
             'userswp' => array(
299 299
                 'url'   => 'https://wordpress.org/plugins/userswp/',
300 300
                 'slug'   => 'userswp',
301 301
                 'name'   => 'UsersWP',
302
-                'desc'   => __('Allow frontend user login and registration as well as have slick profile pages.','invoicing'),
302
+                'desc'   => __('Allow frontend user login and registration as well as have slick profile pages.', 'invoicing'),
303 303
             ),
304 304
 		);
305 305
 
Please login to merge, or discard this patch.
vendor/ayecode/wp-font-awesome-settings/wp-font-awesome-settings.php 1 patch
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
 /**
13 13
  * Bail if we are not in WP.
14 14
  */
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if (!defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
19 19
 /**
20 20
  * Only add if the class does not already exist.
21 21
  */
22
-if ( ! class_exists( 'WP_Font_Awesome_Settings' ) ) {
22
+if (!class_exists('WP_Font_Awesome_Settings')) {
23 23
 
24 24
 	/**
25 25
 	 * A Class to be able to change settings for Font Awesome.
@@ -88,17 +88,17 @@  discard block
 block discarded – undo
88 88
 		 * @return WP_Font_Awesome_Settings - Main instance.
89 89
 		 */
90 90
 		public static function instance() {
91
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WP_Font_Awesome_Settings ) ) {
91
+			if (!isset(self::$instance) && !(self::$instance instanceof WP_Font_Awesome_Settings)) {
92 92
 				self::$instance = new WP_Font_Awesome_Settings;
93 93
 
94
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
94
+				add_action('init', array(self::$instance, 'init')); // set settings
95 95
 
96
-				if ( is_admin() ) {
97
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
98
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
96
+				if (is_admin()) {
97
+					add_action('admin_menu', array(self::$instance, 'menu_item'));
98
+					add_action('admin_init', array(self::$instance, 'register_settings'));
99 99
 				}
100 100
 
101
-				do_action( 'wp_font_awesome_settings_loaded' );
101
+				do_action('wp_font_awesome_settings_loaded');
102 102
 			}
103 103
 
104 104
 			return self::$instance;
@@ -112,30 +112,30 @@  discard block
 block discarded – undo
112 112
 		public function init() {
113 113
 			$this->settings = $this->get_settings();
114 114
 
115
-			if ( $this->settings['type'] == 'CSS' ) {
115
+			if ($this->settings['type'] == 'CSS') {
116 116
 
117
-				if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
118
-					add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
117
+				if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') {
118
+					add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), 5000);
119 119
 				}
120 120
 
121
-				if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
122
-					add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 5000 );
121
+				if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') {
122
+					add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 5000);
123 123
 				}
124 124
 
125 125
 			} else {
126 126
 
127
-				if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend' ) {
128
-					add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
127
+				if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'frontend') {
128
+					add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), 5000);
129 129
 				}
130 130
 
131
-				if ( $this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend' ) {
132
-					add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5000 );
131
+				if ($this->settings['enqueue'] == '' || $this->settings['enqueue'] == 'backend') {
132
+					add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 5000);
133 133
 				}
134 134
 			}
135 135
 
136 136
 			// remove font awesome if set to do so
137
-			if ( $this->settings['dequeue'] == '1' ) {
138
-				add_action( 'clean_url', array( $this, 'remove_font_awesome' ), 5000, 3 );
137
+			if ($this->settings['dequeue'] == '1') {
138
+				add_action('clean_url', array($this, 'remove_font_awesome'), 5000, 3);
139 139
 			}
140 140
 
141 141
 		}
@@ -147,20 +147,20 @@  discard block
 block discarded – undo
147 147
 			// build url
148 148
 			$url = $this->get_url();
149 149
 
150
-			wp_deregister_style( 'font-awesome' ); // deregister in case its already there
151
-			wp_register_style( 'font-awesome', $url, array(), null );
152
-			wp_enqueue_style( 'font-awesome' );
150
+			wp_deregister_style('font-awesome'); // deregister in case its already there
151
+			wp_register_style('font-awesome', $url, array(), null);
152
+			wp_enqueue_style('font-awesome');
153 153
 
154 154
 			// RTL language support CSS.
155
-			if ( is_rtl() ) {
156
-				wp_add_inline_style( 'font-awesome', $this->rtl_inline_css() );
155
+			if (is_rtl()) {
156
+				wp_add_inline_style('font-awesome', $this->rtl_inline_css());
157 157
 			}
158 158
 
159
-			if ( $this->settings['shims'] ) {
160
-				$url = $this->get_url( true );
161
-				wp_deregister_style( 'font-awesome-shims' ); // deregister in case its already there
162
-				wp_register_style( 'font-awesome-shims', $url, array(), null );
163
-				wp_enqueue_style( 'font-awesome-shims' );
159
+			if ($this->settings['shims']) {
160
+				$url = $this->get_url(true);
161
+				wp_deregister_style('font-awesome-shims'); // deregister in case its already there
162
+				wp_register_style('font-awesome-shims', $url, array(), null);
163
+				wp_enqueue_style('font-awesome-shims');
164 164
 			}
165 165
 		}
166 166
 
@@ -172,15 +172,15 @@  discard block
 block discarded – undo
172 172
 			$url = $this->get_url();
173 173
 
174 174
 			$deregister_function = 'wp' . '_' . 'deregister' . '_' . 'script';
175
-			call_user_func( $deregister_function, 'font-awesome' ); // deregister in case its already there
176
-			wp_register_script( 'font-awesome', $url, array(), null );
177
-			wp_enqueue_script( 'font-awesome' );
178
-
179
-			if ( $this->settings['shims'] ) {
180
-				$url = $this->get_url( true );
181
-				call_user_func( $deregister_function, 'font-awesome-shims' ); // deregister in case its already there
182
-				wp_register_script( 'font-awesome-shims', $url, array(), null );
183
-				wp_enqueue_script( 'font-awesome-shims' );
175
+			call_user_func($deregister_function, 'font-awesome'); // deregister in case its already there
176
+			wp_register_script('font-awesome', $url, array(), null);
177
+			wp_enqueue_script('font-awesome');
178
+
179
+			if ($this->settings['shims']) {
180
+				$url = $this->get_url(true);
181
+				call_user_func($deregister_function, 'font-awesome-shims'); // deregister in case its already there
182
+				wp_register_script('font-awesome-shims', $url, array(), null);
183
+				wp_enqueue_script('font-awesome-shims');
184 184
 			}
185 185
 		}
186 186
 
@@ -191,16 +191,16 @@  discard block
 block discarded – undo
191 191
 		 *
192 192
 		 * @return string The url to the file.
193 193
 		 */
194
-		public function get_url( $shims = false ) {
194
+		public function get_url($shims = false) {
195 195
 			$script  = $shims ? 'v4-shims' : 'all';
196 196
 			$sub     = $this->settings['pro'] ? 'pro' : 'use';
197 197
 			$type    = $this->settings['type'];
198 198
 			$version = $this->settings['version'];
199
-			$kit_url = $this->settings['kit-url'] ? esc_url( $this->settings['kit-url'] ) : '';
199
+			$kit_url = $this->settings['kit-url'] ? esc_url($this->settings['kit-url']) : '';
200 200
 			$url     = '';
201 201
 
202
-			if ( $type == 'KIT' && $kit_url ) {
203
-				if ( $shims ) {
202
+			if ($type == 'KIT' && $kit_url) {
203
+				if ($shims) {
204 204
 					// if its a kit then we don't add shims here
205 205
 					return '';
206 206
 				}
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 				$url .= "?wpfas=true"; // set our var so our version is not removed
209 209
 			} else {
210 210
 				$url .= "https://$sub.fontawesome.com/releases/"; // CDN
211
-				$url .= ! empty( $version ) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version
211
+				$url .= !empty($version) ? "v" . $version . '/' : "v" . $this->get_latest_version() . '/'; // version
212 212
 				$url .= $type == 'CSS' ? 'css/' : 'js/'; // type
213 213
 				$url .= $type == 'CSS' ? $script . '.css' : $script . '.js'; // type
214 214
 				$url .= "?wpfas=true"; // set our var so our version is not removed
@@ -228,16 +228,16 @@  discard block
 block discarded – undo
228 228
 		 *
229 229
 		 * @return string The filtered url.
230 230
 		 */
231
-		public function remove_font_awesome( $url, $original_url, $_context ) {
231
+		public function remove_font_awesome($url, $original_url, $_context) {
232 232
 
233
-			if ( $_context == 'display'
234
-			     && ( strstr( $url, "fontawesome" ) !== false || strstr( $url, "font-awesome" ) !== false )
235
-			     && ( strstr( $url, ".js" ) !== false || strstr( $url, ".css" ) !== false )
233
+			if ($_context == 'display'
234
+			     && (strstr($url, "fontawesome") !== false || strstr($url, "font-awesome") !== false)
235
+			     && (strstr($url, ".js") !== false || strstr($url, ".css") !== false)
236 236
 			) {// it's a font-awesome-url (probably)
237 237
 
238
-				if ( strstr( $url, "wpfas=true" ) !== false ) {
239
-					if ( $this->settings['type'] == 'JS' ) {
240
-						if ( $this->settings['js-pseudo'] ) {
238
+				if (strstr($url, "wpfas=true") !== false) {
239
+					if ($this->settings['type'] == 'JS') {
240
+						if ($this->settings['js-pseudo']) {
241 241
 							$url .= "' data-search-pseudo-elements defer='defer";
242 242
 						} else {
243 243
 							$url .= "' defer='defer";
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 		 * Register the database settings with WordPress.
257 257
 		 */
258 258
 		public function register_settings() {
259
-			register_setting( 'wp-font-awesome-settings', 'wp-font-awesome-settings' );
259
+			register_setting('wp-font-awesome-settings', 'wp-font-awesome-settings');
260 260
 		}
261 261
 
262 262
 		/**
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 		 */
266 266
 		public function menu_item() {
267 267
 			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
268
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array(
268
+			call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'wp-font-awesome-settings', array(
269 269
 				$this,
270 270
 				'settings_page'
271
-			) );
271
+			));
272 272
 		}
273 273
 
274 274
 		/**
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 		 */
279 279
 		public function get_settings() {
280 280
 
281
-			$db_settings = get_option( 'wp-font-awesome-settings' );
281
+			$db_settings = get_option('wp-font-awesome-settings');
282 282
 
283 283
 			$defaults = array(
284 284
 				'type'      => 'CSS', // type to use, CSS or JS or KIT
@@ -291,14 +291,14 @@  discard block
 block discarded – undo
291 291
 				'kit-url'   => '', // the kit url
292 292
 			);
293 293
 
294
-			$settings = wp_parse_args( $db_settings, $defaults );
294
+			$settings = wp_parse_args($db_settings, $defaults);
295 295
 
296 296
 			/**
297 297
 			 * Filter the Font Awesome settings.
298 298
 			 *
299 299
 			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
300 300
 			 */
301
-			return $this->settings = apply_filters( 'wp-font-awesome-settings', $settings, $db_settings, $defaults );
301
+			return $this->settings = apply_filters('wp-font-awesome-settings', $settings, $db_settings, $defaults);
302 302
 		}
303 303
 
304 304
 
@@ -306,13 +306,13 @@  discard block
 block discarded – undo
306 306
 		 * The settings page html output.
307 307
 		 */
308 308
 		public function settings_page() {
309
-			if ( ! current_user_can( 'manage_options' ) ) {
310
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'font-awesome-settings' ) );
309
+			if (!current_user_can('manage_options')) {
310
+				wp_die(__('You do not have sufficient permissions to access this page.', 'font-awesome-settings'));
311 311
 			}
312 312
 
313 313
 			// a hidden way to force the update of the version number via api instead of waiting the 48 hours
314
-			if ( isset( $_REQUEST['force-version-check'] ) ) {
315
-				$this->get_latest_version( $force_api = true );
314
+			if (isset($_REQUEST['force-version-check'])) {
315
+				$this->get_latest_version($force_api = true);
316 316
 			}
317 317
 			?>
318 318
 			<style>
@@ -332,37 +332,37 @@  discard block
 block discarded – undo
332 332
 				<h1><?php echo $this->name; ?></h1>
333 333
 				<form method="post" action="options.php">
334 334
 					<?php
335
-					settings_fields( 'wp-font-awesome-settings' );
336
-					do_settings_sections( 'wp-font-awesome-settings' );
335
+					settings_fields('wp-font-awesome-settings');
336
+					do_settings_sections('wp-font-awesome-settings');
337 337
 					$kit_set = $this->settings['type'] == 'KIT' ? 'wpfas-kit-set' : '';
338 338
 					?>
339
-					<table class="form-table wpfas-table-settings <?php echo esc_attr( $kit_set ); ?>">
339
+					<table class="form-table wpfas-table-settings <?php echo esc_attr($kit_set); ?>">
340 340
 						<tr valign="top">
341 341
 							<th scope="row"><label
342
-									for="wpfas-type"><?php _e( 'Type', 'font-awesome-settings' ); ?></label></th>
342
+									for="wpfas-type"><?php _e('Type', 'font-awesome-settings'); ?></label></th>
343 343
 							<td>
344 344
 								<select name="wp-font-awesome-settings[type]" id="wpfas-type"
345 345
 								        onchange="if(this.value=='KIT'){jQuery('.wpfas-table-settings').addClass('wpfas-kit-set');}else{jQuery('.wpfas-table-settings').removeClass('wpfas-kit-set');}">
346 346
 									<option
347
-										value="CSS" <?php selected( $this->settings['type'], 'CSS' ); ?>><?php _e( 'CSS (default)', 'font-awesome-settings' ); ?></option>
348
-									<option value="JS" <?php selected( $this->settings['type'], 'JS' ); ?>>JS</option>
347
+										value="CSS" <?php selected($this->settings['type'], 'CSS'); ?>><?php _e('CSS (default)', 'font-awesome-settings'); ?></option>
348
+									<option value="JS" <?php selected($this->settings['type'], 'JS'); ?>>JS</option>
349 349
 									<option
350
-										value="KIT" <?php selected( $this->settings['type'], 'KIT' ); ?>><?php _e( 'Kits (settings managed on fontawesome.com)', 'font-awesome-settings' ); ?></option>
350
+										value="KIT" <?php selected($this->settings['type'], 'KIT'); ?>><?php _e('Kits (settings managed on fontawesome.com)', 'font-awesome-settings'); ?></option>
351 351
 								</select>
352 352
 							</td>
353 353
 						</tr>
354 354
 
355 355
 						<tr valign="top" class="wpfas-kit-show">
356 356
 							<th scope="row"><label
357
-									for="wpfas-kit-url"><?php _e( 'Kit URL', 'font-awesome-settings' ); ?></label></th>
357
+									for="wpfas-kit-url"><?php _e('Kit URL', 'font-awesome-settings'); ?></label></th>
358 358
 							<td>
359 359
 								<input class="regular-text" id="wpfas-kit-url" type="url"
360 360
 								       name="wp-font-awesome-settings[kit-url]"
361
-								       value="<?php echo esc_attr( $this->settings['kit-url'] ); ?>"
362
-								       placeholder="<?php echo 'https://kit.font';echo 'awesome.com/123abc.js'; // this won't pass theme check :(?>"/>
361
+								       value="<?php echo esc_attr($this->settings['kit-url']); ?>"
362
+								       placeholder="<?php echo 'https://kit.font'; echo 'awesome.com/123abc.js'; // this won't pass theme check :(?>"/>
363 363
 								<span><?php
364 364
 									echo sprintf(
365
-										__( 'Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings' ),
365
+										__('Requires a free account with Font Awesome. %sGet kit url%s', 'font-awesome-settings'),
366 366
 										'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/kits"><i class="fas fa-external-link-alt"></i>',
367 367
 										'</a>'
368 368
 									);
@@ -372,31 +372,31 @@  discard block
 block discarded – undo
372 372
 
373 373
 						<tr valign="top" class="wpfas-kit-hide">
374 374
 							<th scope="row"><label
375
-									for="wpfas-version"><?php _e( 'Version', 'font-awesome-settings' ); ?></label></th>
375
+									for="wpfas-version"><?php _e('Version', 'font-awesome-settings'); ?></label></th>
376 376
 							<td>
377 377
 								<select name="wp-font-awesome-settings[version]" id="wpfas-version">
378 378
 									<option
379
-										value="" <?php selected( $this->settings['version'], '' ); ?>><?php echo sprintf( __( 'Latest - %s (default)', 'font-awesome-settings' ), $this->get_latest_version() ); ?>
379
+										value="" <?php selected($this->settings['version'], ''); ?>><?php echo sprintf(__('Latest - %s (default)', 'font-awesome-settings'), $this->get_latest_version()); ?>
380 380
 									</option>
381
-									<option value="5.6.0" <?php selected( $this->settings['version'], '5.6.0' ); ?>>
381
+									<option value="5.6.0" <?php selected($this->settings['version'], '5.6.0'); ?>>
382 382
 										5.6.0
383 383
 									</option>
384
-									<option value="5.5.0" <?php selected( $this->settings['version'], '5.5.0' ); ?>>
384
+									<option value="5.5.0" <?php selected($this->settings['version'], '5.5.0'); ?>>
385 385
 										5.5.0
386 386
 									</option>
387
-									<option value="5.4.0" <?php selected( $this->settings['version'], '5.4.0' ); ?>>
387
+									<option value="5.4.0" <?php selected($this->settings['version'], '5.4.0'); ?>>
388 388
 										5.4.0
389 389
 									</option>
390
-									<option value="5.3.0" <?php selected( $this->settings['version'], '5.3.0' ); ?>>
390
+									<option value="5.3.0" <?php selected($this->settings['version'], '5.3.0'); ?>>
391 391
 										5.3.0
392 392
 									</option>
393
-									<option value="5.2.0" <?php selected( $this->settings['version'], '5.2.0' ); ?>>
393
+									<option value="5.2.0" <?php selected($this->settings['version'], '5.2.0'); ?>>
394 394
 										5.2.0
395 395
 									</option>
396
-									<option value="5.1.0" <?php selected( $this->settings['version'], '5.1.0' ); ?>>
396
+									<option value="5.1.0" <?php selected($this->settings['version'], '5.1.0'); ?>>
397 397
 										5.1.0
398 398
 									</option>
399
-									<option value="4.7.0" <?php selected( $this->settings['version'], '4.7.0' ); ?>>
399
+									<option value="4.7.0" <?php selected($this->settings['version'], '4.7.0'); ?>>
400 400
 										4.7.1 (CSS only)
401 401
 									</option>
402 402
 								</select>
@@ -405,29 +405,29 @@  discard block
 block discarded – undo
405 405
 
406 406
 						<tr valign="top">
407 407
 							<th scope="row"><label
408
-									for="wpfas-enqueue"><?php _e( 'Enqueue', 'font-awesome-settings' ); ?></label></th>
408
+									for="wpfas-enqueue"><?php _e('Enqueue', 'font-awesome-settings'); ?></label></th>
409 409
 							<td>
410 410
 								<select name="wp-font-awesome-settings[enqueue]" id="wpfas-enqueue">
411 411
 									<option
412
-										value="" <?php selected( $this->settings['enqueue'], '' ); ?>><?php _e( 'Frontend + Backend (default)', 'font-awesome-settings' ); ?></option>
412
+										value="" <?php selected($this->settings['enqueue'], ''); ?>><?php _e('Frontend + Backend (default)', 'font-awesome-settings'); ?></option>
413 413
 									<option
414
-										value="frontend" <?php selected( $this->settings['enqueue'], 'frontend' ); ?>><?php _e( 'Frontend', 'font-awesome-settings' ); ?></option>
414
+										value="frontend" <?php selected($this->settings['enqueue'], 'frontend'); ?>><?php _e('Frontend', 'font-awesome-settings'); ?></option>
415 415
 									<option
416
-										value="backend" <?php selected( $this->settings['enqueue'], 'backend' ); ?>><?php _e( 'Backend', 'font-awesome-settings' ); ?></option>
416
+										value="backend" <?php selected($this->settings['enqueue'], 'backend'); ?>><?php _e('Backend', 'font-awesome-settings'); ?></option>
417 417
 								</select>
418 418
 							</td>
419 419
 						</tr>
420 420
 
421 421
 						<tr valign="top" class="wpfas-kit-hide">
422 422
 							<th scope="row"><label
423
-									for="wpfas-pro"><?php _e( 'Enable pro', 'font-awesome-settings' ); ?></label></th>
423
+									for="wpfas-pro"><?php _e('Enable pro', 'font-awesome-settings'); ?></label></th>
424 424
 							<td>
425 425
 								<input type="hidden" name="wp-font-awesome-settings[pro]" value="0"/>
426 426
 								<input type="checkbox" name="wp-font-awesome-settings[pro]"
427
-								       value="1" <?php checked( $this->settings['pro'], '1' ); ?> id="wpfas-pro"/>
427
+								       value="1" <?php checked($this->settings['pro'], '1'); ?> id="wpfas-pro"/>
428 428
 								<span><?php
429 429
 									echo sprintf(
430
-										__( 'Requires a subscription. %sLearn more%s %sManage my allowed domains%s', 'font-awesome-settings' ),
430
+										__('Requires a subscription. %sLearn more%s %sManage my allowed domains%s', 'font-awesome-settings'),
431 431
 										'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/pro"><i class="fas fa-external-link-alt"></i>',
432 432
 										'</a>',
433 433
 										'<a rel="noopener noreferrer" target="_blank" href="https://fontawesome.com/account/cdn"><i class="fas fa-external-link-alt"></i>',
@@ -439,38 +439,38 @@  discard block
 block discarded – undo
439 439
 
440 440
 						<tr valign="top" class="wpfas-kit-hide">
441 441
 							<th scope="row"><label
442
-									for="wpfas-shims"><?php _e( 'Enable v4 shims compatibility', 'font-awesome-settings' ); ?></label>
442
+									for="wpfas-shims"><?php _e('Enable v4 shims compatibility', 'font-awesome-settings'); ?></label>
443 443
 							</th>
444 444
 							<td>
445 445
 								<input type="hidden" name="wp-font-awesome-settings[shims]" value="0"/>
446 446
 								<input type="checkbox" name="wp-font-awesome-settings[shims]"
447
-								       value="1" <?php checked( $this->settings['shims'], '1' ); ?> id="wpfas-shims"/>
448
-								<span><?php _e( 'This enables v4 classes to work with v5, sort of like a band-aid until everyone has updated everything to v5.', 'font-awesome-settings' ); ?></span>
447
+								       value="1" <?php checked($this->settings['shims'], '1'); ?> id="wpfas-shims"/>
448
+								<span><?php _e('This enables v4 classes to work with v5, sort of like a band-aid until everyone has updated everything to v5.', 'font-awesome-settings'); ?></span>
449 449
 							</td>
450 450
 						</tr>
451 451
 
452 452
 						<tr valign="top" class="wpfas-kit-hide">
453 453
 							<th scope="row"><label
454
-									for="wpfas-js-pseudo"><?php _e( 'Enable JS pseudo elements (not recommended)', 'font-awesome-settings' ); ?></label>
454
+									for="wpfas-js-pseudo"><?php _e('Enable JS pseudo elements (not recommended)', 'font-awesome-settings'); ?></label>
455 455
 							</th>
456 456
 							<td>
457 457
 								<input type="hidden" name="wp-font-awesome-settings[js-pseudo]" value="0"/>
458 458
 								<input type="checkbox" name="wp-font-awesome-settings[js-pseudo]"
459
-								       value="1" <?php checked( $this->settings['js-pseudo'], '1' ); ?>
459
+								       value="1" <?php checked($this->settings['js-pseudo'], '1'); ?>
460 460
 								       id="wpfas-js-pseudo"/>
461
-								<span><?php _e( 'Used only with the JS version, this will make pseudo-elements work but can be CPU intensive on some sites.', 'font-awesome-settings' ); ?></span>
461
+								<span><?php _e('Used only with the JS version, this will make pseudo-elements work but can be CPU intensive on some sites.', 'font-awesome-settings'); ?></span>
462 462
 							</td>
463 463
 						</tr>
464 464
 
465 465
 						<tr valign="top">
466 466
 							<th scope="row"><label
467
-									for="wpfas-dequeue"><?php _e( 'Dequeue', 'font-awesome-settings' ); ?></label></th>
467
+									for="wpfas-dequeue"><?php _e('Dequeue', 'font-awesome-settings'); ?></label></th>
468 468
 							<td>
469 469
 								<input type="hidden" name="wp-font-awesome-settings[dequeue]" value="0"/>
470 470
 								<input type="checkbox" name="wp-font-awesome-settings[dequeue]"
471
-								       value="1" <?php checked( $this->settings['dequeue'], '1' ); ?>
471
+								       value="1" <?php checked($this->settings['dequeue'], '1'); ?>
472 472
 								       id="wpfas-dequeue"/>
473
-								<span><?php _e( 'This will try to dequeue any other Font Awesome versions loaded by other sources if they are added with `font-awesome` or `fontawesome` in the name.', 'font-awesome-settings' ); ?></span>
473
+								<span><?php _e('This will try to dequeue any other Font Awesome versions loaded by other sources if they are added with `font-awesome` or `fontawesome` in the name.', 'font-awesome-settings'); ?></span>
474 474
 							</td>
475 475
 						</tr>
476 476
 
@@ -495,12 +495,12 @@  discard block
 block discarded – undo
495 495
 		 *
496 496
 		 * @return string Either a valid version number or an empty string.
497 497
 		 */
498
-		public function validate_version_number( $version ) {
498
+		public function validate_version_number($version) {
499 499
 
500
-			if ( version_compare( $version, '0.0.1', '>=' ) >= 0 ) {
500
+			if (version_compare($version, '0.0.1', '>=') >= 0) {
501 501
 				// valid
502 502
 			} else {
503
-				$version = '';// not validated
503
+				$version = ''; // not validated
504 504
 			}
505 505
 
506 506
 			return $version;
@@ -515,19 +515,19 @@  discard block
 block discarded – undo
515 515
 		 * @since 1.0.7
516 516
 		 * @return mixed|string The latest version number found.
517 517
 		 */
518
-		public function get_latest_version( $force_api = false ) {
518
+		public function get_latest_version($force_api = false) {
519 519
 			$latest_version = $this->latest;
520 520
 
521
-			$cache = get_transient( 'wp-font-awesome-settings-version' );
521
+			$cache = get_transient('wp-font-awesome-settings-version');
522 522
 
523
-			if ( $cache === false || $force_api ) { // its not set
523
+			if ($cache === false || $force_api) { // its not set
524 524
 				$api_ver = $this->get_latest_version_from_api();
525
-				if ( version_compare( $api_ver, $this->latest, '>=' ) >= 0 ) {
525
+				if (version_compare($api_ver, $this->latest, '>=') >= 0) {
526 526
 					$latest_version = $api_ver;
527
-					set_transient( 'wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS );
527
+					set_transient('wp-font-awesome-settings-version', $api_ver, 48 * HOUR_IN_SECONDS);
528 528
 				}
529
-			} elseif ( $this->validate_version_number( $cache ) ) {
530
-				if ( version_compare( $cache, $this->latest, '>=' ) >= 0 ) {
529
+			} elseif ($this->validate_version_number($cache)) {
530
+				if (version_compare($cache, $this->latest, '>=') >= 0) {
531 531
 					$latest_version = $cache;
532 532
 				}
533 533
 			}
@@ -543,10 +543,10 @@  discard block
 block discarded – undo
543 543
 		 */
544 544
 		public function get_latest_version_from_api() {
545 545
 			$version  = "0";
546
-			$response = wp_remote_get( "https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest" );
547
-			if ( ! is_wp_error( $response ) && is_array( $response ) ) {
548
-				$api_response = json_decode( wp_remote_retrieve_body( $response ), true );
549
-				if ( isset( $api_response['tag_name'] ) && version_compare( $api_response['tag_name'], $this->latest, '>=' ) >= 0 && empty( $api_response['prerelease'] ) ) {
546
+			$response = wp_remote_get("https://api.github.com/repos/FortAwesome/Font-Awesome/releases/latest");
547
+			if (!is_wp_error($response) && is_array($response)) {
548
+				$api_response = json_decode(wp_remote_retrieve_body($response), true);
549
+				if (isset($api_response['tag_name']) && version_compare($api_response['tag_name'], $this->latest, '>=') >= 0 && empty($api_response['prerelease'])) {
550 550
 					$version = $api_response['tag_name'];
551 551
 				}
552 552
 			}
Please login to merge, or discard this patch.
includes/wpinv-address-functions.php 1 patch
Spacing   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
7 7
  */
8 8
  
9 9
 // MUST have WordPress.
10
-if ( !defined( 'WPINC' ) ) {
11
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
10
+if (!defined('WPINC')) {
11
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
12 12
 }
13 13
 
14 14
 
15 15
 function wpinv_get_default_country() {
16
-	$country = wpinv_get_option( 'default_country', 'UK' );
16
+	$country = wpinv_get_option('default_country', 'UK');
17 17
 
18
-	return apply_filters( 'wpinv_default_country', $country );
18
+	return apply_filters('wpinv_default_country', $country);
19 19
 }
20 20
 
21 21
 /**
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string
25 25
  */
26
-function getpaid_get_ip_country( $ip_address = '' ) {
27
-    $country = GetPaid_Geolocation::geolocate_ip( $ip_address, true );
26
+function getpaid_get_ip_country($ip_address = '') {
27
+    $country = GetPaid_Geolocation::geolocate_ip($ip_address, true);
28 28
     return $country['country'];
29 29
 }
30 30
 
@@ -34,59 +34,59 @@  discard block
 block discarded – undo
34 34
  * @param string $country The country code to sanitize
35 35
  * @return array
36 36
  */
37
-function wpinv_sanitize_country( $country ) {
37
+function wpinv_sanitize_country($country) {
38 38
 
39 39
 	// Enure the country is specified
40
-    if ( empty( $country ) ) {
40
+    if (empty($country)) {
41 41
         $country = wpinv_get_default_country();
42 42
     }
43
-    return trim( wpinv_utf8_strtoupper( $country ) );
43
+    return trim(wpinv_utf8_strtoupper($country));
44 44
 
45 45
 }
46 46
 
47
-function wpinv_is_base_country( $country ) {
47
+function wpinv_is_base_country($country) {
48 48
     $base_country = wpinv_get_default_country();
49 49
     
50
-    if ( $base_country === 'UK' ) {
50
+    if ($base_country === 'UK') {
51 51
         $base_country = 'GB';
52 52
     }
53
-    if ( $country == 'UK' ) {
53
+    if ($country == 'UK') {
54 54
         $country = 'GB';
55 55
     }
56 56
 
57
-    return ( $country && $country === $base_country ) ? true : false;
57
+    return ($country && $country === $base_country) ? true : false;
58 58
 }
59 59
 
60
-function wpinv_country_name( $country_code = '' ) { 
60
+function wpinv_country_name($country_code = '') { 
61 61
     $countries = wpinv_get_country_list();
62 62
     $country_code = $country_code == 'UK' ? 'GB' : $country_code;
63
-    $country = isset( $countries[$country_code] ) ? $countries[$country_code] : $country_code;
63
+    $country = isset($countries[$country_code]) ? $countries[$country_code] : $country_code;
64 64
 
65
-    return apply_filters( 'wpinv_country_name', $country, $country_code );
65
+    return apply_filters('wpinv_country_name', $country, $country_code);
66 66
 }
67 67
 
68 68
 function wpinv_get_default_state() {
69
-	$state = wpinv_get_option( 'default_state', '' );
69
+	$state = wpinv_get_option('default_state', '');
70 70
 
71
-	return apply_filters( 'wpinv_default_state', $state );
71
+	return apply_filters('wpinv_default_state', $state);
72 72
 }
73 73
 
74
-function wpinv_state_name( $state_code = '', $country_code = '' ) {
74
+function wpinv_state_name($state_code = '', $country_code = '') {
75 75
     $state = $state_code;
76 76
     
77
-    if ( !empty( $country_code ) ) {
78
-        $states = wpinv_get_country_states( $country_code );
77
+    if (!empty($country_code)) {
78
+        $states = wpinv_get_country_states($country_code);
79 79
         
80
-        $state = !empty( $states ) && isset( $states[$state_code] ) ? $states[$state_code] : $state;
80
+        $state = !empty($states) && isset($states[$state_code]) ? $states[$state_code] : $state;
81 81
     }
82 82
 
83
-    return apply_filters( 'wpinv_state_name', $state, $state_code, $country_code );
83
+    return apply_filters('wpinv_state_name', $state, $state_code, $country_code);
84 84
 }
85 85
 
86 86
 function wpinv_store_address() {
87
-    $address = wpinv_get_option( 'store_address', '' );
87
+    $address = wpinv_get_option('store_address', '');
88 88
 
89
-    return apply_filters( 'wpinv_store_address', $address );
89
+    return apply_filters('wpinv_store_address', $address);
90 90
 }
91 91
 
92 92
 /**
@@ -94,24 +94,24 @@  discard block
 block discarded – undo
94 94
  *
95 95
  * @param WPInv_Invoice $invoice
96 96
  */
97
-function getpaid_maybe_add_default_address( &$invoice ) {
97
+function getpaid_maybe_add_default_address(&$invoice) {
98 98
 
99 99
     $user_id = $invoice->get_user_id();
100 100
 
101 101
     // Abort if the invoice belongs to no one.
102
-    if ( empty( $user_id ) ) {
102
+    if (empty($user_id)) {
103 103
         return;
104 104
     }
105 105
 
106 106
     // Fill in defaults whenever necessary.
107
-    foreach ( wpinv_get_user_address( $user_id ) as $key => $value ) {
107
+    foreach (wpinv_get_user_address($user_id) as $key => $value) {
108 108
 
109
-        if ( is_callable( $invoice, "get_$key" ) ) {
110
-            $current = call_user_func( array( $invoice, "get_$key" ) );
109
+        if (is_callable($invoice, "get_$key")) {
110
+            $current = call_user_func(array($invoice, "get_$key"));
111 111
 
112
-            if ( empty( $current ) ) {
112
+            if (empty($current)) {
113 113
                 $method = "set_$key";
114
-                $invoice->$method( $value );
114
+                $invoice->$method($value);
115 115
             }
116 116
 
117 117
         }
@@ -130,22 +130,22 @@  discard block
 block discarded – undo
130 130
     $address_fields = apply_filters(
131 131
         'getpaid_user_address_fields',
132 132
         array(
133
-            'first_name' => __( 'First Name', 'invoicing' ),
134
-            'last_name'  => __( 'Last Name', 'invoicing' ),
135
-            'address'    => __( 'Address', 'invoicing' ),
136
-            'city'       => __( 'City', 'invoicing' ),
137
-            'country'    => __( 'Country', 'invoicing' ),
138
-            'state'      => __( 'State', 'invoicing' ),
139
-            'zip'        => __( 'Zip/Postal Code', 'invoicing' ),
140
-            'phone'      => __( 'Phone Number', 'invoicing' ),
141
-            'company'    => __( 'Company', 'invoicing' ),
142
-            'company_id'    => __( 'Company ID', 'invoicing' ),
143
-            'vat_number' => __( 'VAT Number', 'invoicing' ),
133
+            'first_name' => __('First Name', 'invoicing'),
134
+            'last_name'  => __('Last Name', 'invoicing'),
135
+            'address'    => __('Address', 'invoicing'),
136
+            'city'       => __('City', 'invoicing'),
137
+            'country'    => __('Country', 'invoicing'),
138
+            'state'      => __('State', 'invoicing'),
139
+            'zip'        => __('Zip/Postal Code', 'invoicing'),
140
+            'phone'      => __('Phone Number', 'invoicing'),
141
+            'company'    => __('Company', 'invoicing'),
142
+            'company_id'    => __('Company ID', 'invoicing'),
143
+            'vat_number' => __('VAT Number', 'invoicing'),
144 144
         )
145 145
     );
146 146
 
147
-    if ( ! wpinv_use_taxes() && isset( $address_fields['vat_number'] ) ) {
148
-        unset( $address_fields['vat_number'] );
147
+    if (!wpinv_use_taxes() && isset($address_fields['vat_number'])) {
148
+        unset($address_fields['vat_number']);
149 149
     }
150 150
 
151 151
     return $address_fields;
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
  * 
157 157
  * @return bool
158 158
  */
159
-function getpaid_is_address_field_whitelisted( $key ) {
160
-    return array_key_exists( $key, getpaid_user_address_fields() );
159
+function getpaid_is_address_field_whitelisted($key) {
160
+    return array_key_exists($key, getpaid_user_address_fields());
161 161
 }
162 162
 
163 163
 /**
@@ -167,24 +167,24 @@  discard block
 block discarded – undo
167 167
  *
168 168
  * @param WPInv_Invoice $invoice
169 169
  */
170
-function getpaid_save_invoice_user_address( $invoice ) {
170
+function getpaid_save_invoice_user_address($invoice) {
171 171
 
172 172
     // Retrieve the invoice.
173
-    $invoice = wpinv_get_invoice( $invoice );
173
+    $invoice = wpinv_get_invoice($invoice);
174 174
 
175 175
     // Abort if it does not exist.
176
-    if ( empty( $invoice ) || $invoice->is_renewal() ) {
176
+    if (empty($invoice) || $invoice->is_renewal()) {
177 177
         return;
178 178
     }
179 179
 
180
-    foreach ( array_keys( getpaid_user_address_fields() ) as $field ) {
180
+    foreach (array_keys(getpaid_user_address_fields()) as $field) {
181 181
 
182
-        if ( is_callable( array( $invoice, "get_$field" ) ) ) {
183
-            $value = call_user_func( array( $invoice, "get_$field" ) );
182
+        if (is_callable(array($invoice, "get_$field"))) {
183
+            $value = call_user_func(array($invoice, "get_$field"));
184 184
 
185 185
             // Only save if it is not empty.
186
-            if ( ! empty( $value ) ) {
187
-                update_user_meta( $invoice->get_user_id(), '_wpinv_' . $field, $value );
186
+            if (!empty($value)) {
187
+                update_user_meta($invoice->get_user_id(), '_wpinv_' . $field, $value);
188 188
             }
189 189
 
190 190
         }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     }
193 193
 
194 194
 }
195
-add_action( 'getpaid_checkout_invoice_updated', 'getpaid_save_invoice_user_address' );
195
+add_action('getpaid_checkout_invoice_updated', 'getpaid_save_invoice_user_address');
196 196
 
197 197
 /**
198 198
  * Retrieves a saved user address.
@@ -201,14 +201,14 @@  discard block
 block discarded – undo
201 201
  * @param bool $with_default Whether or not we should use the default country and state.
202 202
  * @return array
203 203
  */
204
-function wpinv_get_user_address( $user_id = 0, $with_default = true ) {
204
+function wpinv_get_user_address($user_id = 0, $with_default = true) {
205 205
 
206 206
     // Prepare the user id.
207
-    $user_id   = empty( $user_id ) ? get_current_user_id() : $user_id;
208
-    $user_info = get_userdata( $user_id );
207
+    $user_id   = empty($user_id) ? get_current_user_id() : $user_id;
208
+    $user_info = get_userdata($user_id);
209 209
 
210 210
     // Abort if non exists.
211
-    if ( empty( $user_info ) ) {
211
+    if (empty($user_info)) {
212 212
         return array();
213 213
     }
214 214
 
@@ -218,11 +218,11 @@  discard block
 block discarded – undo
218 218
         'email'   => $user_info->user_email,
219 219
     );
220 220
 
221
-    foreach ( array_keys( getpaid_user_address_fields() ) as $field ) {
222
-        $address[$field] = getpaid_get_user_address_field( $user_id, $field );
221
+    foreach (array_keys(getpaid_user_address_fields()) as $field) {
222
+        $address[$field] = getpaid_get_user_address_field($user_id, $field);
223 223
     }
224 224
 
225
-    if ( ! $with_default ) {
225
+    if (!$with_default) {
226 226
         return $address;
227 227
     }
228 228
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
         'country'    => wpinv_get_default_country(),
234 234
     );
235 235
 
236
-    return getpaid_array_merge_if_empty( $address, $defaults );
236
+    return getpaid_array_merge_if_empty($address, $defaults);
237 237
 
238 238
 }
239 239
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
  * @param string $field The field to use.
245 245
  * @return string|null
246 246
  */
247
-function getpaid_get_user_address_field( $user_id, $field ) {
247
+function getpaid_get_user_address_field($user_id, $field) {
248 248
 
249 249
     $prefixes = array(
250 250
         '_wpinv_',
@@ -252,15 +252,15 @@  discard block
 block discarded – undo
252 252
         ''
253 253
     );
254 254
 
255
-    foreach ( $prefixes as $prefix ) {
255
+    foreach ($prefixes as $prefix) {
256 256
 
257 257
         // Meta table.
258
-        $value = get_user_meta( $user_id, $prefix . $field, true );
258
+        $value = get_user_meta($user_id, $prefix . $field, true);
259 259
         
260 260
         // UWP table.
261
-        $value = ( empty( $value ) && function_exists( 'uwp_get_usermeta' ) ) ? uwp_get_usermeta( $user_id, $prefix . $field ) : $value;
261
+        $value = (empty($value) && function_exists('uwp_get_usermeta')) ? uwp_get_usermeta($user_id, $prefix . $field) : $value;
262 262
 
263
-        if ( ! empty( $value ) ) {
263
+        if (!empty($value)) {
264 264
             return $value;
265 265
         }
266 266
 
@@ -277,16 +277,16 @@  discard block
 block discarded – undo
277 277
  * @param string $return What to return.
278 278
  * @return array
279 279
  */
280
-function wpinv_get_continents( $return = 'all' ) {
280
+function wpinv_get_continents($return = 'all') {
281 281
 
282
-    $continents = wpinv_get_data( 'continents' );
282
+    $continents = wpinv_get_data('continents');
283 283
 
284
-    switch( $return ) {
284
+    switch ($return) {
285 285
         case 'name' :
286
-            return wp_list_pluck( $continents, 'name' );
286
+            return wp_list_pluck($continents, 'name');
287 287
             break;
288 288
         case 'countries' :
289
-            return wp_list_pluck( $continents, 'countries' );
289
+            return wp_list_pluck($continents, 'countries');
290 290
             break;
291 291
         default :
292 292
             return $continents;
@@ -302,12 +302,12 @@  discard block
 block discarded – undo
302 302
  * @param string $country Country code. If no code is specified, defaults to the default country.
303 303
  * @return string
304 304
  */
305
-function wpinv_get_continent_code_for_country( $country = false ) {
305
+function wpinv_get_continent_code_for_country($country = false) {
306 306
 
307
-    $country = wpinv_sanitize_country( $country );
307
+    $country = wpinv_sanitize_country($country);
308 308
     
309
-	foreach ( wpinv_get_continents( 'countries' ) as $continent_code => $countries ) {
310
-		if ( false !== array_search( $country, $countries, true ) ) {
309
+	foreach (wpinv_get_continents('countries') as $continent_code => $countries) {
310
+		if (false !== array_search($country, $countries, true)) {
311 311
 			return $continent_code;
312 312
 		}
313 313
 	}
@@ -323,13 +323,13 @@  discard block
 block discarded – undo
323 323
  * @param string $country Country code. If no code is specified, defaults to the default country.
324 324
  * @return array
325 325
  */
326
-function wpinv_get_country_calling_code( $country = null) {
326
+function wpinv_get_country_calling_code($country = null) {
327 327
 
328
-    $country = wpinv_sanitize_country( $country );
329
-    $codes   = wpinv_get_data( 'phone-codes' );
330
-    $code    = isset( $codes[ $country ] ) ? $codes[ $country ] : '';
328
+    $country = wpinv_sanitize_country($country);
329
+    $codes   = wpinv_get_data('phone-codes');
330
+    $code    = isset($codes[$country]) ? $codes[$country] : '';
331 331
 
332
-    if ( is_array( $code ) ) {
332
+    if (is_array($code)) {
333 333
         return $code[0];
334 334
     }
335 335
     return $code;
@@ -342,8 +342,8 @@  discard block
 block discarded – undo
342 342
  * @param bool $first_empty Whether or not the first item in the list should be empty
343 343
  * @return array
344 344
  */
345
-function wpinv_get_country_list( $first_empty = false ) {
346
-    return wpinv_maybe_add_empty_option( apply_filters( 'wpinv_countries', wpinv_get_data( 'countries' ) ), $first_empty );
345
+function wpinv_get_country_list($first_empty = false) {
346
+    return wpinv_maybe_add_empty_option(apply_filters('wpinv_countries', wpinv_get_data('countries')), $first_empty);
347 347
 }
348 348
 
349 349
 /**
@@ -353,22 +353,22 @@  discard block
 block discarded – undo
353 353
  * @param bool $first_empty Whether or not the first item in the list should be empty
354 354
  * @return array
355 355
  */
356
-function wpinv_get_country_states( $country = null, $first_empty = false ) {
356
+function wpinv_get_country_states($country = null, $first_empty = false) {
357 357
     
358 358
     // Prepare the country.
359
-    $country = wpinv_sanitize_country( $country );
359
+    $country = wpinv_sanitize_country($country);
360 360
 
361 361
     // Fetch all states.
362
-    $all_states = wpinv_get_data( 'states' );
362
+    $all_states = wpinv_get_data('states');
363 363
 
364 364
     // Fetch the specified country's states.
365
-    $states     = isset( $all_states[ $country ] ) ? $all_states[ $country ] : array() ;
366
-    $states     = apply_filters( "wpinv_{$country}_states", $states );
367
-    $states     = apply_filters( 'wpinv_country_states', $states, $country );
365
+    $states     = isset($all_states[$country]) ? $all_states[$country] : array();
366
+    $states     = apply_filters("wpinv_{$country}_states", $states);
367
+    $states     = apply_filters('wpinv_country_states', $states, $country);
368 368
 
369
-    asort( $states );
369
+    asort($states);
370 370
      
371
-    return wpinv_maybe_add_empty_option( $states, $first_empty );
371
+    return wpinv_maybe_add_empty_option($states, $first_empty);
372 372
 }
373 373
 
374 374
 /**
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
  * @return array
379 379
  */
380 380
 function wpinv_get_us_states_list() {
381
-    return apply_filters( 'wpinv_usa_states', wpinv_get_country_states( 'US' ) );
381
+    return apply_filters('wpinv_usa_states', wpinv_get_country_states('US'));
382 382
 }
383 383
 
384 384
 /**
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
  * @return array
389 389
  */
390 390
 function wpinv_get_canada_states_list() {
391
-    return apply_filters( 'wpinv_canada_provinces', wpinv_get_country_states( 'CA' ) );
391
+    return apply_filters('wpinv_canada_provinces', wpinv_get_country_states('CA'));
392 392
 }
393 393
 
394 394
 /**
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
  * @return array
399 399
  */
400 400
 function wpinv_get_australia_states_list() {
401
-    return apply_filters( 'wpinv_australia_states', wpinv_get_country_states( 'AU' ) );
401
+    return apply_filters('wpinv_australia_states', wpinv_get_country_states('AU'));
402 402
 }
403 403
 
404 404
 /**
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
  * @return array
409 409
  */
410 410
 function wpinv_get_bangladesh_states_list() {
411
-    return apply_filters( 'wpinv_bangladesh_states', wpinv_get_country_states( 'BD' ) );
411
+    return apply_filters('wpinv_bangladesh_states', wpinv_get_country_states('BD'));
412 412
 }
413 413
 
414 414
 /**
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
  * @return array
419 419
  */
420 420
 function wpinv_get_brazil_states_list() {
421
-    return apply_filters( 'wpinv_brazil_states', wpinv_get_country_states( 'BR' ) );
421
+    return apply_filters('wpinv_brazil_states', wpinv_get_country_states('BR'));
422 422
 }
423 423
 
424 424
 /**
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
  * @return array
429 429
  */
430 430
 function wpinv_get_bulgaria_states_list() {
431
-    return apply_filters( 'wpinv_bulgaria_states', wpinv_get_country_states( 'BG' ) );
431
+    return apply_filters('wpinv_bulgaria_states', wpinv_get_country_states('BG'));
432 432
 }
433 433
 
434 434
 /**
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
  * @return array
439 439
  */
440 440
 function wpinv_get_hong_kong_states_list() {
441
-    return apply_filters( 'wpinv_hong_kong_states', wpinv_get_country_states( 'HK' ) );
441
+    return apply_filters('wpinv_hong_kong_states', wpinv_get_country_states('HK'));
442 442
 }
443 443
 
444 444
 /**
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
  * @return array
449 449
  */
450 450
 function wpinv_get_hungary_states_list() {
451
-    return apply_filters( 'wpinv_hungary_states', wpinv_get_country_states( 'HU' ) );
451
+    return apply_filters('wpinv_hungary_states', wpinv_get_country_states('HU'));
452 452
 }
453 453
 
454 454
 /**
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
  * @return array
459 459
  */
460 460
 function wpinv_get_japan_states_list() {
461
-    return apply_filters( 'wpinv_japan_states', wpinv_get_country_states( 'JP' ) );
461
+    return apply_filters('wpinv_japan_states', wpinv_get_country_states('JP'));
462 462
 }
463 463
 
464 464
 /**
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
  * @return array
469 469
  */
470 470
 function wpinv_get_china_states_list() {
471
-    return apply_filters( 'wpinv_china_states', wpinv_get_country_states( 'CN' ) );
471
+    return apply_filters('wpinv_china_states', wpinv_get_country_states('CN'));
472 472
 }
473 473
 
474 474
 /**
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
  * @return array
479 479
  */
480 480
 function wpinv_get_new_zealand_states_list() {
481
-    return apply_filters( 'wpinv_new_zealand_states', wpinv_get_country_states( 'NZ' ) );
481
+    return apply_filters('wpinv_new_zealand_states', wpinv_get_country_states('NZ'));
482 482
 }
483 483
 
484 484
 /**
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
  * @return array
489 489
  */
490 490
 function wpinv_get_peru_states_list() {
491
-    return apply_filters( 'wpinv_peru_states', wpinv_get_country_states( 'PE' ) );
491
+    return apply_filters('wpinv_peru_states', wpinv_get_country_states('PE'));
492 492
 }
493 493
 
494 494
 /**
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
  * @return array
499 499
  */
500 500
 function wpinv_get_indonesia_states_list() {
501
-    return apply_filters( 'wpinv_indonesia_states', wpinv_get_country_states( 'ID' ) );
501
+    return apply_filters('wpinv_indonesia_states', wpinv_get_country_states('ID'));
502 502
 }
503 503
 
504 504
 /**
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
  * @return array
509 509
  */
510 510
 function wpinv_get_india_states_list() {
511
-    return apply_filters( 'wpinv_india_states', wpinv_get_country_states( 'IN' ) );
511
+    return apply_filters('wpinv_india_states', wpinv_get_country_states('IN'));
512 512
 }
513 513
 
514 514
 /**
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
  * @return array
519 519
  */
520 520
 function wpinv_get_iran_states_list() {
521
-    return apply_filters( 'wpinv_iran_states', wpinv_get_country_states( 'IR' ) );
521
+    return apply_filters('wpinv_iran_states', wpinv_get_country_states('IR'));
522 522
 }
523 523
 
524 524
 /**
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
  * @return array
529 529
  */
530 530
 function wpinv_get_italy_states_list() {
531
-    return apply_filters( 'wpinv_italy_states', wpinv_get_country_states( 'IT' ) );
531
+    return apply_filters('wpinv_italy_states', wpinv_get_country_states('IT'));
532 532
 }
533 533
 
534 534
 /**
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
  * @return array
539 539
  */
540 540
 function wpinv_get_malaysia_states_list() {
541
-    return apply_filters( 'wpinv_malaysia_states', wpinv_get_country_states( 'MY' ) );
541
+    return apply_filters('wpinv_malaysia_states', wpinv_get_country_states('MY'));
542 542
 }
543 543
 
544 544
 /**
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
  * @return array
549 549
  */
550 550
 function wpinv_get_mexico_states_list() {
551
-    return apply_filters( 'wpinv_mexico_states', wpinv_get_country_states( 'MX' ) );
551
+    return apply_filters('wpinv_mexico_states', wpinv_get_country_states('MX'));
552 552
 }
553 553
 
554 554
 /**
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
  * @return array
559 559
  */
560 560
 function wpinv_get_nepal_states_list() {
561
-    return apply_filters( 'wpinv_nepal_states', wpinv_get_country_states( 'NP' ) );
561
+    return apply_filters('wpinv_nepal_states', wpinv_get_country_states('NP'));
562 562
 }
563 563
 
564 564
 /**
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
  * @return array
569 569
  */
570 570
 function wpinv_get_south_africa_states_list() {
571
-    return apply_filters( 'wpinv_south_africa_states', wpinv_get_country_states( 'ZA' ) );
571
+    return apply_filters('wpinv_south_africa_states', wpinv_get_country_states('ZA'));
572 572
 }
573 573
 
574 574
 /**
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
  * @return array
579 579
  */
580 580
 function wpinv_get_thailand_states_list() {
581
-    return apply_filters( 'wpinv_thailand_states', wpinv_get_country_states( 'TH' ) );
581
+    return apply_filters('wpinv_thailand_states', wpinv_get_country_states('TH'));
582 582
 }
583 583
 
584 584
 /**
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
  * @return array
589 589
  */
590 590
 function wpinv_get_turkey_states_list() {
591
-    return apply_filters( 'wpinv_turkey_states', wpinv_get_country_states( 'TR' ) );
591
+    return apply_filters('wpinv_turkey_states', wpinv_get_country_states('TR'));
592 592
 }
593 593
 
594 594
 /**
@@ -598,31 +598,31 @@  discard block
 block discarded – undo
598 598
  * @return array
599 599
  */
600 600
 function wpinv_get_spain_states_list() {
601
-    return apply_filters( 'wpinv_spain_states', wpinv_get_country_states( 'ES' ) );
601
+    return apply_filters('wpinv_spain_states', wpinv_get_country_states('ES'));
602 602
 }
603 603
 
604 604
 function wpinv_get_states_field() {
605
-	if( empty( $_POST['country'] ) ) {
605
+	if (empty($_POST['country'])) {
606 606
 		$_POST['country'] = wpinv_get_default_country();
607 607
 	}
608
-	$states = wpinv_get_country_states( sanitize_text_field( $_POST['country'] ) );
608
+	$states = wpinv_get_country_states(sanitize_text_field($_POST['country']));
609 609
 
610
-	if( !empty( $states ) ) {
611
-		$sanitized_field_name = sanitize_text_field( $_POST['field_name'] );
610
+	if (!empty($states)) {
611
+		$sanitized_field_name = sanitize_text_field($_POST['field_name']);
612 612
 
613
-        $class  = isset( $_POST['class'] ) ? esc_attr( $_POST['class'] ) : '';
613
+        $class  = isset($_POST['class']) ? esc_attr($_POST['class']) : '';
614 614
         $class .= " $sanitized_field_name getpaid_js_field-state custom-select wpinv-select wpi_select2";
615 615
 
616
-        $args  = array(
616
+        $args = array(
617 617
 			'name'    => $sanitized_field_name,
618 618
 			'id'      => $sanitized_field_name,
619
-			'class'   => implode( ' ', array_unique( explode( ' ', $class ) ) ),
620
-			'options' => array_merge( array( '' => '' ), $states ),
619
+			'class'   => implode(' ', array_unique(explode(' ', $class))),
620
+			'options' => array_merge(array('' => ''), $states),
621 621
 			'show_option_all'  => false,
622 622
 			'show_option_none' => false
623 623
 		);
624 624
 
625
-		$response = wpinv_html_select( $args );
625
+		$response = wpinv_html_select($args);
626 626
 
627 627
 	} else {
628 628
 		$response = 'nostates';
@@ -631,10 +631,10 @@  discard block
 block discarded – undo
631 631
 	return $response;
632 632
 }
633 633
 
634
-function wpinv_default_billing_country( $country = '', $user_id = 0 ) {
635
-    $country = !empty( $country ) ? $country : wpinv_get_default_country();
634
+function wpinv_default_billing_country($country = '', $user_id = 0) {
635
+    $country = !empty($country) ? $country : wpinv_get_default_country();
636 636
     
637
-    return apply_filters( 'wpinv_default_billing_country', $country, $user_id );
637
+    return apply_filters('wpinv_default_billing_country', $country, $user_id);
638 638
 }
639 639
 
640 640
 /**
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
  */
647 647
 function wpinv_get_address_formats() {
648 648
 
649
-		return apply_filters( 'wpinv_localisation_address_formats',
649
+		return apply_filters('wpinv_localisation_address_formats',
650 650
 			array(
651 651
 				'default' => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}}\n{{zip}}\n{{country}}",
652 652
 				'AU'      => "{{name}}\n{{company}}\n{{address}}\n{{city}}\n{{state}} {{zip}}\n{{country}}",
@@ -695,9 +695,9 @@  discard block
 block discarded – undo
695 695
  * @see `wpinv_get_invoice_address_replacements`
696 696
  * @return string
697 697
  */
698
-function wpinv_get_full_address_format( $country = false) {
698
+function wpinv_get_full_address_format($country = false) {
699 699
 
700
-    if( empty( $country ) ) {
700
+    if (empty($country)) {
701 701
         $country = wpinv_get_default_country();
702 702
     }
703 703
 
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
 	$formats = wpinv_get_address_formats();
706 706
 
707 707
 	// Get format for the specified country.
708
-	$format = ( $country && isset( $formats[ $country ] ) ) ? $formats[ $country ] : $formats['default'];
708
+	$format = ($country && isset($formats[$country])) ? $formats[$country] : $formats['default'];
709 709
     
710 710
     /**
711 711
 	 * Filters the address format to use on Invoices.
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 	 * @param string $format  The address format to use.
718 718
      * @param string $country The country who's address format is being retrieved.
719 719
 	 */
720
-    return apply_filters( 'wpinv_get_full_address_format', $format, $country );
720
+    return apply_filters('wpinv_get_full_address_format', $format, $country);
721 721
 }
722 722
 
723 723
 /**
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
  * @param array $billing_details customer's billing details
729 729
  * @return array
730 730
  */
731
-function wpinv_get_invoice_address_replacements( $billing_details ) {
731
+function wpinv_get_invoice_address_replacements($billing_details) {
732 732
 
733 733
     $default_args = array(
734 734
         'address'           => '',
@@ -741,22 +741,22 @@  discard block
 block discarded – undo
741 741
 		'company'           => '',
742 742
     );
743 743
 
744
-    $args    = map_deep( wp_parse_args( $billing_details, $default_args ), 'trim' );
744
+    $args    = map_deep(wp_parse_args($billing_details, $default_args), 'trim');
745 745
     $state   = $args['state'];
746 746
     $country = $args['country'];
747 747
 
748 748
     // Handle full country name.
749
-    $full_country = empty( $country ) ? $country : wpinv_country_name( $country );
749
+    $full_country = empty($country) ? $country : wpinv_country_name($country);
750 750
 
751 751
     // Handle full state name.
752
-    $full_state   = ( $country && $state ) ?  wpinv_state_name( $state, $country ) : $state;
752
+    $full_state   = ($country && $state) ?  wpinv_state_name($state, $country) : $state;
753 753
 
754 754
     $args['postcode']    = $args['zip'];
755 755
     $args['name']        = $args['first_name'] . ' ' . $args['last_name'];
756 756
     $args['state']       = $full_state;
757 757
     $args['state_code']  = $state;
758 758
     $args['country']     = $full_country;
759
-    $args['country_code']= $country;
759
+    $args['country_code'] = $country;
760 760
 
761 761
     /**
762 762
 	 * Filters the address format replacements to use on Invoices.
@@ -767,14 +767,14 @@  discard block
 block discarded – undo
767 767
 	 * @param array $replacements  The address replacements to use.
768 768
      * @param array $billing_details  The billing details to use.
769 769
 	 */
770
-    $replacements = apply_filters( 'wpinv_get_invoice_address_replacements', $args, $billing_details );
770
+    $replacements = apply_filters('wpinv_get_invoice_address_replacements', $args, $billing_details);
771 771
 
772 772
     $return = array();
773 773
 
774
-    foreach( $replacements as $key => $value ) {
775
-        $value  = is_scalar( $value ) ? trim( sanitize_text_field( $value ) ) : '';
774
+    foreach ($replacements as $key => $value) {
775
+        $value = is_scalar($value) ? trim(sanitize_text_field($value)) : '';
776 776
         $return['{{' . $key . '}}'] = $value;
777
-        $return['{{' . $key . '_upper}}'] = wpinv_utf8_strtoupper( $value );
777
+        $return['{{' . $key . '_upper}}'] = wpinv_utf8_strtoupper($value);
778 778
     }
779 779
 
780 780
     return $return;
@@ -788,6 +788,6 @@  discard block
 block discarded – undo
788 788
  * @since 1.0.14
789 789
  * @return string
790 790
  */
791
-function wpinv_trim_formatted_address_line( $line ) {
792
-	return trim( $line, ', ' );
791
+function wpinv_trim_formatted_address_line($line) {
792
+	return trim($line, ', ');
793 793
 }
794 794
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/class-getpaid-admin-profile.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -4,11 +4,11 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-if ( ! defined( 'ABSPATH' ) ) {
7
+if (!defined('ABSPATH')) {
8 8
 	exit; // Exit if accessed directly
9 9
 }
10 10
 
11
-if ( ! class_exists( 'GetPaid_Admin_Profile', false ) ) :
11
+if (!class_exists('GetPaid_Admin_Profile', false)) :
12 12
 
13 13
 	/**
14 14
 	 * GetPaid_Admin_Profile Class.
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 		 * Hook in tabs.
20 20
 		 */
21 21
 		public function __construct() {
22
-			add_action( 'show_user_profile', array( $this, 'add_customer_meta_fields' ), 100 );
23
-			add_action( 'edit_user_profile', array( $this, 'add_customer_meta_fields' ), 100 );
22
+			add_action('show_user_profile', array($this, 'add_customer_meta_fields'), 100);
23
+			add_action('edit_user_profile', array($this, 'add_customer_meta_fields'), 100);
24 24
 
25
-			add_action( 'personal_options_update', array( $this, 'save_customer_meta_fields' ) );
26
-			add_action( 'edit_user_profile_update', array( $this, 'save_customer_meta_fields' ) );
25
+			add_action('personal_options_update', array($this, 'save_customer_meta_fields'));
26
+			add_action('edit_user_profile_update', array($this, 'save_customer_meta_fields'));
27 27
 		}
28 28
 
29 29
 		/**
@@ -37,54 +37,54 @@  discard block
 block discarded – undo
37 37
 				'getpaid_customer_meta_fields',
38 38
 				array(
39 39
 					'billing'  => array(
40
-						'title'  => __( 'Billing Details (GetPaid)', 'invoicing' ),
40
+						'title'  => __('Billing Details (GetPaid)', 'invoicing'),
41 41
 						'fields' => array(
42 42
 							'_wpinv_first_name' => array(
43
-								'label'       => __( 'First name', 'invoicing' ),
43
+								'label'       => __('First name', 'invoicing'),
44 44
 								'description' => '',
45 45
 							),
46 46
 							'_wpinv_last_name'  => array(
47
-								'label'       => __( 'Last name', 'invoicing' ),
47
+								'label'       => __('Last name', 'invoicing'),
48 48
 								'description' => '',
49 49
 							),
50 50
 							'_wpinv_company'    => array(
51
-								'label'       => __( 'Company', 'invoicing' ),
51
+								'label'       => __('Company', 'invoicing'),
52 52
 								'description' => '',
53 53
 							),
54 54
 							'_wpinv_company_id'    => array(
55
-								'label'       => __( 'Company ID', 'invoicing' ),
55
+								'label'       => __('Company ID', 'invoicing'),
56 56
 								'description' => '',
57 57
 							),
58 58
 							'_wpinv_address'  => array(
59
-								'label'       => __( 'Address', 'invoicing' ),
59
+								'label'       => __('Address', 'invoicing'),
60 60
 								'description' => '',
61 61
 							),
62 62
 							'_wpinv_city'       => array(
63
-								'label'       => __( 'City', 'invoicing' ),
63
+								'label'       => __('City', 'invoicing'),
64 64
 								'description' => '',
65 65
 							),
66 66
 							'_wpinv_zip'   => array(
67
-								'label'       => __( 'Postcode / ZIP', 'invoicing' ),
67
+								'label'       => __('Postcode / ZIP', 'invoicing'),
68 68
 								'description' => '',
69 69
 							),
70 70
 							'_wpinv_country'    => array(
71
-								'label'       => __( 'Country / Region', 'invoicing' ),
71
+								'label'       => __('Country / Region', 'invoicing'),
72 72
 								'description' => '',
73 73
 								'class'       => 'getpaid_js_field-country',
74 74
 								'type'        => 'select',
75
-								'options'     => array( '' => __( 'Select a country / region&hellip;', 'invoicing' ) ) + wpinv_get_country_list(),
75
+								'options'     => array('' => __('Select a country / region&hellip;', 'invoicing')) + wpinv_get_country_list(),
76 76
 							),
77 77
 							'_wpinv_state'      => array(
78
-								'label'       => __( 'State / County', 'invoicing' ),
79
-								'description' => __( 'State / County or state code', 'invoicing' ),
78
+								'label'       => __('State / County', 'invoicing'),
79
+								'description' => __('State / County or state code', 'invoicing'),
80 80
 								'class'       => 'getpaid_js_field-state regular-text',
81 81
 							),
82 82
 							'_wpinv_phone'      => array(
83
-								'label'       => __( 'Phone', 'invoicing' ),
83
+								'label'       => __('Phone', 'invoicing'),
84 84
 								'description' => '',
85 85
 							),
86 86
 							'_wpinv_vat_number'      => array(
87
-								'label'       => __( 'VAT Number', 'invoicing' ),
87
+								'label'       => __('VAT Number', 'invoicing'),
88 88
 								'description' => '',
89 89
 							),
90 90
 						),
@@ -99,39 +99,39 @@  discard block
 block discarded – undo
99 99
 		 *
100 100
 		 * @param WP_User $user
101 101
 		 */
102
-		public function add_customer_meta_fields( $user ) {
102
+		public function add_customer_meta_fields($user) {
103 103
 
104
-			if ( ! apply_filters( 'getpaid_current_user_can_edit_customer_meta_fields', current_user_can( 'manage_options' ), $user->ID ) ) {
104
+			if (!apply_filters('getpaid_current_user_can_edit_customer_meta_fields', current_user_can('manage_options'), $user->ID)) {
105 105
 				return;
106 106
 			}
107 107
 
108 108
 			$show_fields = $this->get_customer_meta_fields();
109 109
 
110
-			foreach ( $show_fields as $fieldset_key => $fieldset ) :
110
+			foreach ($show_fields as $fieldset_key => $fieldset) :
111 111
 				?>
112 112
 				<h2><?php echo $fieldset['title']; ?></h2>
113
-				<table class="form-table" id="<?php echo esc_attr( 'getpaid-fieldset-' . $fieldset_key ); ?>">
114
-					<?php foreach ( $fieldset['fields'] as $key => $field ) : ?>
113
+				<table class="form-table" id="<?php echo esc_attr('getpaid-fieldset-' . $fieldset_key); ?>">
114
+					<?php foreach ($fieldset['fields'] as $key => $field) : ?>
115 115
 						<tr>
116 116
 							<th>
117
-								<label for="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $field['label'] ); ?></label>
117
+								<label for="<?php echo esc_attr($key); ?>"><?php echo esc_html($field['label']); ?></label>
118 118
 							</th>
119 119
 							<td>
120
-								<?php if ( ! empty( $field['type'] ) && 'select' === $field['type'] ) : ?>
121
-									<select name="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>" class="<?php echo esc_attr( $field['class'] ); ?> wpi_select2" style="width: 25em;">
120
+								<?php if (!empty($field['type']) && 'select' === $field['type']) : ?>
121
+									<select name="<?php echo esc_attr($key); ?>" id="<?php echo esc_attr($key); ?>" class="<?php echo esc_attr($field['class']); ?> wpi_select2" style="width: 25em;">
122 122
 										<?php
123
-											$selected = esc_attr( get_user_meta( $user->ID, $key, true ) );
124
-										foreach ( $field['options'] as $option_key => $option_value ) :
123
+											$selected = esc_attr(get_user_meta($user->ID, $key, true));
124
+										foreach ($field['options'] as $option_key => $option_value) :
125 125
 											?>
126
-											<option value="<?php echo esc_attr( $option_key ); ?>" <?php selected( $selected, $option_key, true ); ?>><?php echo esc_html( $option_value ); ?></option>
126
+											<option value="<?php echo esc_attr($option_key); ?>" <?php selected($selected, $option_key, true); ?>><?php echo esc_html($option_value); ?></option>
127 127
 										<?php endforeach; ?>
128 128
 									</select>
129
-								<?php elseif ( ! empty( $field['type'] ) && 'checkbox' === $field['type'] ) : ?>
130
-									<input type="checkbox" name="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>" value="1" class="<?php echo esc_attr( $field['class'] ); ?>" <?php checked( (int) get_user_meta( $user->ID, $key, true ), 1, true ); ?> />
129
+								<?php elseif (!empty($field['type']) && 'checkbox' === $field['type']) : ?>
130
+									<input type="checkbox" name="<?php echo esc_attr($key); ?>" id="<?php echo esc_attr($key); ?>" value="1" class="<?php echo esc_attr($field['class']); ?>" <?php checked((int) get_user_meta($user->ID, $key, true), 1, true); ?> />
131 131
 								<?php else : ?>
132
-									<input type="text" name="<?php echo esc_attr( $key ); ?>" id="<?php echo esc_attr( $key ); ?>" value="<?php echo esc_attr( $this->get_user_meta( $user->ID, $key ) ); ?>" class="<?php echo ( ! empty( $field['class'] ) ? esc_attr( $field['class'] ) : 'regular-text' ); ?>" />
132
+									<input type="text" name="<?php echo esc_attr($key); ?>" id="<?php echo esc_attr($key); ?>" value="<?php echo esc_attr($this->get_user_meta($user->ID, $key)); ?>" class="<?php echo (!empty($field['class']) ? esc_attr($field['class']) : 'regular-text'); ?>" />
133 133
 								<?php endif; ?>
134
-								<p class="description"><?php echo wp_kses_post( $field['description'] ); ?></p>
134
+								<p class="description"><?php echo wp_kses_post($field['description']); ?></p>
135 135
 							</td>
136 136
 						</tr>
137 137
 					<?php endforeach; ?>
@@ -145,21 +145,21 @@  discard block
 block discarded – undo
145 145
 		 *
146 146
 		 * @param int $user_id User ID of the user being saved
147 147
 		 */
148
-		public function save_customer_meta_fields( $user_id ) {
149
-			if ( ! apply_filters( 'getpaid_current_user_can_edit_customer_meta_fields', current_user_can( 'manage_options' ), $user_id ) ) {
148
+		public function save_customer_meta_fields($user_id) {
149
+			if (!apply_filters('getpaid_current_user_can_edit_customer_meta_fields', current_user_can('manage_options'), $user_id)) {
150 150
 				return;
151 151
 			}
152 152
 
153 153
 			$save_fields = $this->get_customer_meta_fields();
154 154
 
155
-			foreach ( $save_fields as $fieldset ) {
155
+			foreach ($save_fields as $fieldset) {
156 156
 
157
-				foreach ( $fieldset['fields'] as $key => $field ) {
157
+				foreach ($fieldset['fields'] as $key => $field) {
158 158
 
159
-					if ( isset( $field['type'] ) && 'checkbox' === $field['type'] ) {
160
-						update_user_meta( $user_id, $key, isset( $_POST[ $key ] ) );
161
-					} elseif ( isset( $_POST[ $key ] ) ) {
162
-						update_user_meta( $user_id, $key, wpinv_clean( $_POST[ $key ] ) );
159
+					if (isset($field['type']) && 'checkbox' === $field['type']) {
160
+						update_user_meta($user_id, $key, isset($_POST[$key]));
161
+					} elseif (isset($_POST[$key])) {
162
+						update_user_meta($user_id, $key, wpinv_clean($_POST[$key]));
163 163
 					}
164 164
 				}
165 165
 			}
@@ -173,11 +173,11 @@  discard block
 block discarded – undo
173 173
 		 * @param string $key     Key for user meta field
174 174
 		 * @return string
175 175
 		 */
176
-		protected function get_user_meta( $user_id, $key ) {
177
-			$value           = get_user_meta( $user_id, $key, true );
178
-			$existing_fields = array( '_wpinv_first_name', '_wpinv_last_name' );
179
-			if ( ! $value && in_array( $key, $existing_fields ) ) {
180
-				$value = get_user_meta( $user_id, str_replace( '_wpinv_', '', $key ), true );
176
+		protected function get_user_meta($user_id, $key) {
177
+			$value           = get_user_meta($user_id, $key, true);
178
+			$existing_fields = array('_wpinv_first_name', '_wpinv_last_name');
179
+			if (!$value && in_array($key, $existing_fields)) {
180
+				$value = get_user_meta($user_id, str_replace('_wpinv_', '', $key), true);
181 181
 			}
182 182
 
183 183
 			return $value;
Please login to merge, or discard this patch.