Passed
Push — master ( d0e164...00f338 )
by Brian
05: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-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/payments/class-getpaid-payment-form-submission-taxes.php 1 patch
Spacing   +53 added lines, -53 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 taxes class
@@ -29,22 +29,22 @@  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
 		// Validate VAT number.
35
-		$this->validate_vat( $submission );
35
+		$this->validate_vat($submission);
36 36
 
37
-		if ( $this->skip_taxes ) {
37
+		if ($this->skip_taxes) {
38 38
 			return;
39 39
 		}
40 40
 
41
-		foreach ( $submission->get_items() as $item ) {
42
-			$this->process_item_tax( $item, $submission );
41
+		foreach ($submission->get_items() as $item) {
42
+			$this->process_item_tax($item, $submission);
43 43
 		}
44 44
 
45 45
 		// Process any existing invoice taxes.
46
-		if ( $submission->has_invoice() ) {
47
-			$this->taxes = array_replace( $submission->get_invoice()->get_taxes(), $this->taxes );
46
+		if ($submission->has_invoice()) {
47
+			$this->taxes = array_replace($submission->get_invoice()->get_taxes(), $this->taxes);
48 48
 		}
49 49
 
50 50
 	}
@@ -56,26 +56,26 @@  discard block
 block discarded – undo
56 56
 	 * @param GetPaid_Form_Item $item
57 57
 	 * @param GetPaid_Payment_Form_Submission $submission
58 58
 	 */
59
-	public function process_item_tax( $item, $submission ) {
59
+	public function process_item_tax($item, $submission) {
60 60
 
61
-		$rates    = getpaid_get_item_tax_rates( $item, $submission->country, $submission->state );
62
-		$rates    = getpaid_filter_item_tax_rates( $item, $rates );
63
-		$taxes    = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, false ), $rates );
64
-		$r_taxes  = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, true ), $rates );
61
+		$rates    = getpaid_get_item_tax_rates($item, $submission->country, $submission->state);
62
+		$rates    = getpaid_filter_item_tax_rates($item, $rates);
63
+		$taxes    = getpaid_calculate_item_taxes(getpaid_get_taxable_amount($item, false), $rates);
64
+		$r_taxes  = getpaid_calculate_item_taxes(getpaid_get_taxable_amount($item, true), $rates);
65 65
 
66
-		foreach ( $taxes as $name => $amount ) {
67
-			$recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0;
68
-			$tax       = getpaid_prepare_item_tax( $item, $name, $amount, $recurring );
66
+		foreach ($taxes as $name => $amount) {
67
+			$recurring = isset($r_taxes[$name]) ? $r_taxes[$name] : 0;
68
+			$tax       = getpaid_prepare_item_tax($item, $name, $amount, $recurring);
69 69
 
70
-			$item->item_tax += wpinv_sanitize_amount( $tax['initial_tax'] );
70
+			$item->item_tax += wpinv_sanitize_amount($tax['initial_tax']);
71 71
 
72
-			if ( ! isset( $this->taxes[ $name ] ) ) {
73
-				$this->taxes[ $name ] = $tax;
72
+			if (!isset($this->taxes[$name])) {
73
+				$this->taxes[$name] = $tax;
74 74
 				continue;
75 75
 			}
76 76
 
77
-			$this->taxes[ $name ]['initial_tax']   += $tax['initial_tax'];
78
-			$this->taxes[ $name ]['recurring_tax'] += $tax['recurring_tax'];
77
+			$this->taxes[$name]['initial_tax']   += $tax['initial_tax'];
78
+			$this->taxes[$name]['recurring_tax'] += $tax['recurring_tax'];
79 79
 
80 80
 		}
81 81
 
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 	 * @since 1.0.19
89 89
 	 * @return bool
90 90
 	 */
91
-	public function has_digital_item( $submission ) {
91
+	public function has_digital_item($submission) {
92 92
 
93
-		foreach ( $submission->get_items() as $item ) {
93
+		foreach ($submission->get_items() as $item) {
94 94
 
95
-			if ( 'digital' == $item->get_vat_rule() ) {
95
+			if ('digital' == $item->get_vat_rule()) {
96 96
 				return true;
97 97
 			}
98 98
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 * @return bool
109 109
 	 */
110 110
 	public static function is_eu_store() {
111
-		return self::is_eu_country( wpinv_get_default_country() );
111
+		return self::is_eu_country(wpinv_get_default_country());
112 112
 	}
113 113
 
114 114
 	/**
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	 * @since 1.0.19
119 119
 	 * @return bool
120 120
 	 */
121
-	public static function is_eu_country( $country ) {
122
-		return getpaid_is_eu_state( $country );
121
+	public static function is_eu_country($country) {
122
+		return getpaid_is_eu_state($country);
123 123
 	}
124 124
 
125 125
 	/**
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 	 * @since 1.0.19
130 130
 	 * @return bool
131 131
 	 */
132
-	public static function is_eu_transaction( $customer_country ) {
133
-		return self::is_eu_country( $customer_country ) && self::is_eu_store();
132
+	public static function is_eu_transaction($customer_country) {
133
+		return self::is_eu_country($customer_country) && self::is_eu_store();
134 134
 	}
135 135
 
136 136
 	/**
@@ -140,12 +140,12 @@  discard block
 block discarded – undo
140 140
 	 * @since 1.0.19
141 141
 	 * @return string
142 142
 	 */
143
-	public function get_vat_number( $submission ) {
143
+	public function get_vat_number($submission) {
144 144
 
145 145
 		// Retrieve from the posted number.
146
-		$vat_number = $submission->get_field( 'wpinv_vat_number', 'billing' );
147
-		if ( ! is_null( $vat_number ) ) {
148
-			return wpinv_clean( $vat_number );
146
+		$vat_number = $submission->get_field('wpinv_vat_number', 'billing');
147
+		if (!is_null($vat_number)) {
148
+			return wpinv_clean($vat_number);
149 149
 		}
150 150
 
151 151
 		return $submission->has_invoice() ? $submission->get_invoice()->get_vat_number() : '';
@@ -158,12 +158,12 @@  discard block
 block discarded – undo
158 158
 	 * @since 1.0.19
159 159
 	 * @return string
160 160
 	 */
161
-	public function get_company( $submission ) {
161
+	public function get_company($submission) {
162 162
 
163 163
 		// Retrieve from the posted data.
164
-		$company = $submission->get_field( 'wpinv_company', 'billing' );
165
-		if ( ! empty( $company ) ) {
166
-			return wpinv_clean( $company );
164
+		$company = $submission->get_field('wpinv_company', 'billing');
165
+		if (!empty($company)) {
166
+			return wpinv_clean($company);
167 167
 		}
168 168
 
169 169
 		// Retrieve from the invoice.
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 	 * @since 1.0.19
179 179
 	 * @return string
180 180
 	 */
181
-	public function requires_vat( $ip_in_eu, $country_in_eu ) {
181
+	public function requires_vat($ip_in_eu, $country_in_eu) {
182 182
 
183
-		$prevent_b2c = wpinv_get_option( 'vat_prevent_b2c_purchase' );
184
-		$prevent_b2c = ! empty( $prevent_b2c );
183
+		$prevent_b2c = wpinv_get_option('vat_prevent_b2c_purchase');
184
+		$prevent_b2c = !empty($prevent_b2c);
185 185
 		$is_eu       = $ip_in_eu || $country_in_eu;
186 186
 
187 187
 		return $prevent_b2c && $is_eu;
@@ -193,43 +193,43 @@  discard block
 block discarded – undo
193 193
 	 * @param GetPaid_Payment_Form_Submission $submission
194 194
 	 * @since 1.0.19
195 195
 	 */
196
-	public function validate_vat( $submission ) {
196
+	public function validate_vat($submission) {
197 197
 
198
-		$in_eu = $this->is_eu_transaction( $submission->country );
198
+		$in_eu = $this->is_eu_transaction($submission->country);
199 199
 
200 200
 		// Abort if we are not validating vat numbers.
201
-		if ( ! $in_eu ) {
201
+		if (!$in_eu) {
202 202
             return;
203 203
 		}
204 204
 
205 205
 		// Prepare variables.
206
-		$vat_number  = $this->get_vat_number( $submission );
206
+		$vat_number  = $this->get_vat_number($submission);
207 207
 		$ip_country  = getpaid_get_ip_country();
208
-        $is_eu       = $this->is_eu_country( $submission->country );
209
-        $is_ip_eu    = $this->is_eu_country( $ip_country );
208
+        $is_eu       = $this->is_eu_country($submission->country);
209
+        $is_ip_eu    = $this->is_eu_country($ip_country);
210 210
 
211 211
 		// Maybe abort early for initial fetches.
212
-		if ( $submission->is_initial_fetch() && empty( $vat_number ) ) {
212
+		if ($submission->is_initial_fetch() && empty($vat_number)) {
213 213
 			return;
214 214
 		}
215 215
 
216 216
 		// If we're preventing business to consumer purchases,
217
-		if ( $this->requires_vat( $is_ip_eu, $is_eu ) && empty( $vat_number ) ) {
217
+		if ($this->requires_vat($is_ip_eu, $is_eu) && empty($vat_number)) {
218 218
 
219 219
 			// Ensure that a vat number has been specified.
220
-			throw new GetPaid_Payment_Exception( '.getpaid-error-billingwpinv_vat_number.getpaid-custom-payment-form-errors', __( 'Please enter your VAT number to verify your purchase is by an EU business.', 'invoicing' ) );
220
+			throw new GetPaid_Payment_Exception('.getpaid-error-billingwpinv_vat_number.getpaid-custom-payment-form-errors', __('Please enter your VAT number to verify your purchase is by an EU business.', 'invoicing'));
221 221
 
222 222
 		}
223 223
 
224
-		if ( empty( $vat_number ) ) {
224
+		if (empty($vat_number)) {
225 225
 			return;
226 226
 		}
227 227
 
228
-		if ( wpinv_should_validate_vat_number() && ! wpinv_validate_vat_number( $vat_number, $submission->country ) ) {
229
-			throw new GetPaid_Payment_Exception( '.getpaid-error-billingwpinv_vat_number.getpaid-custom-payment-form-errors', __( 'Your VAT number is invalid', 'invoicing' ) );
228
+		if (wpinv_should_validate_vat_number() && !wpinv_validate_vat_number($vat_number, $submission->country)) {
229
+			throw new GetPaid_Payment_Exception('.getpaid-error-billingwpinv_vat_number.getpaid-custom-payment-form-errors', __('Your VAT number is invalid', 'invoicing'));
230 230
 		}
231 231
 
232
-		if (  wpinv_default_billing_country() == $submission->country && 'vat_too' == wpinv_get_option( 'vat_same_country_rule', 'vat_too' ) ) {
232
+		if (wpinv_default_billing_country() == $submission->country && 'vat_too' == wpinv_get_option('vat_same_country_rule', 'vat_too')) {
233 233
 			return;
234 234
 		}
235 235
 
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/sd-functions.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
  *
11 11
  * @return mixed|void
12 12
  */
13
-function sd_pagenow_exclude(){
14
-	return apply_filters( 'sd_pagenow_exclude', array(
13
+function sd_pagenow_exclude() {
14
+	return apply_filters('sd_pagenow_exclude', array(
15 15
 		'upload.php',
16 16
 		'edit-comments.php',
17 17
 		'edit-tags.php',
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		'edit.php',
23 23
 		'themes.php',
24 24
 		'users.php',
25
-	) );
25
+	));
26 26
 }
27 27
 
28 28
 
@@ -33,6 +33,6 @@  discard block
 block discarded – undo
33 33
  *
34 34
  * @return mixed|void
35 35
  */
36
-function sd_widget_exclude(){
37
-	return apply_filters( 'sd_widget_exclude', array() );
36
+function sd_widget_exclude() {
37
+	return apply_filters('sd_widget_exclude', array());
38 38
 }
39 39
\ No newline at end of file
Please login to merge, or discard this patch.
includes/user-functions.php 1 patch
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package GetPaid
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  *  Generates a users select dropdown.
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
  * @param array $args
17 17
  * @see wp_dropdown_users
18 18
  */
19
-function wpinv_dropdown_users( $args = '' ) {
19
+function wpinv_dropdown_users($args = '') {
20 20
 
21
-    if ( is_array( $args ) && ! empty( $args['show'] ) && 'display_name_with_email' == $args['show'] ) {
21
+    if (is_array($args) && !empty($args['show']) && 'display_name_with_email' == $args['show']) {
22 22
         $args['show'] = 'display_name_with_login';
23 23
     }
24 24
 
25
-    return wp_dropdown_users( $args );
25
+    return wp_dropdown_users($args);
26 26
 }
27 27
 
28 28
 /**
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
  * @return string capability to check against
33 33
  * @param string $capalibilty Optional. The alternative capability to check against.
34 34
  */
35
-function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) {
35
+function wpinv_get_capability($capalibilty = 'manage_invoicing') {
36 36
 
37
-	if ( current_user_can( 'manage_options' ) ) {
37
+	if (current_user_can('manage_options')) {
38 38
 		return 'manage_options';
39 39
 	};
40 40
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
  * @return bool
49 49
  */
50 50
 function wpinv_current_user_can_manage_invoicing() {
51
-    return current_user_can( wpinv_get_capability() );
51
+    return current_user_can(wpinv_get_capability());
52 52
 }
53 53
 
54 54
 /**
@@ -57,19 +57,19 @@  discard block
 block discarded – undo
57 57
  * @since 1.0.19
58 58
  * @return int|WP_Error
59 59
  */
60
-function wpinv_create_user( $email, $prefix = '' ) {
60
+function wpinv_create_user($email, $prefix = '') {
61 61
 
62 62
     // Prepare user values.
63
-    $prefix = preg_replace( '/\s+/', '', $prefix );
64
-    $prefix = empty( $prefix ) ? $email : $prefix;
65
-	$args   = array(
66
-		'user_login' => wpinv_generate_user_name( $prefix ),
63
+    $prefix = preg_replace('/\s+/', '', $prefix);
64
+    $prefix = empty($prefix) ? $email : $prefix;
65
+	$args = array(
66
+		'user_login' => wpinv_generate_user_name($prefix),
67 67
 		'user_pass'  => wp_generate_password(),
68 68
 		'user_email' => $email,
69 69
         'role'       => 'subscriber',
70 70
     );
71 71
 
72
-    return wp_insert_user( $args );
72
+    return wp_insert_user($args);
73 73
 
74 74
 }
75 75
 
@@ -79,26 +79,26 @@  discard block
 block discarded – undo
79 79
  * @since 1.0.19
80 80
  * @return bool|WP_User
81 81
  */
82
-function wpinv_generate_user_name( $prefix = '' ) {
82
+function wpinv_generate_user_name($prefix = '') {
83 83
 
84 84
     // If prefix is an email, retrieve the part before the email.
85
-	$prefix = strtok( $prefix, '@' );
86
-    $prefix = trim( $prefix, '.' );
85
+	$prefix = strtok($prefix, '@');
86
+    $prefix = trim($prefix, '.');
87 87
 
88 88
 	// Sanitize the username.
89
-	$prefix = sanitize_user( $prefix, true );
89
+	$prefix = sanitize_user($prefix, true);
90 90
 
91
-	$illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
92
-	if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) {
93
-		$prefix = 'gtp_' . zeroise( wp_rand( 0, 9999 ), 4 );
91
+	$illegal_logins = (array) apply_filters('illegal_user_logins', array());
92
+	if (empty($prefix) || in_array(strtolower($prefix), array_map('strtolower', $illegal_logins), true)) {
93
+		$prefix = 'gtp_' . zeroise(wp_rand(0, 9999), 4);
94 94
 	}
95 95
 
96 96
     $username = $prefix;
97 97
     $postfix  = 2;
98 98
 
99
-    while ( username_exists( $username ) ) {
99
+    while (username_exists($username)) {
100 100
         $username = $prefix + $postfix;
101
-        $postfix ++;
101
+        $postfix++;
102 102
     }
103 103
 
104 104
     return $username;
@@ -115,31 +115,31 @@  discard block
 block discarded – undo
115 115
     $tabs = array(
116 116
 
117 117
         'gp-invoices'   => array(
118
-            'label'     => __( 'Invoices', 'invoicing' ), // Name of the tab.
118
+            'label'     => __('Invoices', 'invoicing'), // Name of the tab.
119 119
             'content'   => '[wpinv_history]', // Content of the tab. Or specify "callback" to provide a callback instead.
120 120
             'icon'      => 'fas fa-file-invoice', // Shown on some profile plugins.
121 121
         ),
122 122
 
123 123
         'gp-subscriptions' => array(
124
-            'label'        => __( 'Subscriptions', 'invoicing' ),
124
+            'label'        => __('Subscriptions', 'invoicing'),
125 125
             'content'      => '[wpinv_subscriptions]',
126 126
             'icon'         => 'fas fa-redo',
127 127
         ),
128 128
 
129 129
         'gp-edit-address'  => array(
130
-            'label'        => __( 'Billing Address', 'invoicing' ),
130
+            'label'        => __('Billing Address', 'invoicing'),
131 131
             'callback'     => 'getpaid_display_address_edit_tab',
132 132
             'icon'         => 'fas fa-credit-card',
133 133
         ),
134 134
 
135 135
     );
136 136
 
137
-    $tabs = apply_filters( 'getpaid_user_content_tabs', $tabs );
137
+    $tabs = apply_filters('getpaid_user_content_tabs', $tabs);
138 138
 
139 139
     // Make sure address editing is last on the list.
140
-    if ( isset( $tabs['gp-edit-address'] ) ) {
140
+    if (isset($tabs['gp-edit-address'])) {
141 141
         $address = $tabs['gp-edit-address'];
142
-        unset( $tabs['gp-edit-address'] );
142
+        unset($tabs['gp-edit-address']);
143 143
         $tabs['gp-edit-address'] = $address;
144 144
     }
145 145
 
@@ -153,19 +153,19 @@  discard block
 block discarded – undo
153 153
  * @param array $tab
154 154
  * @return array
155 155
  */
156
-function getpaid_prepare_user_content_tab( $tab ) {
156
+function getpaid_prepare_user_content_tab($tab) {
157 157
 
158
-    if ( ! empty( $tab['callback'] ) ) {
159
-        return call_user_func( $tab['callback'] );
158
+    if (!empty($tab['callback'])) {
159
+        return call_user_func($tab['callback']);
160 160
     }
161 161
 
162
-    if ( ! empty( $tab['content'] ) ) {
163
-        return convert_smilies( capital_P_dangit( wp_filter_content_tags( do_shortcode( shortcode_unautop( wpautop( wptexturize( do_blocks( $tab['content'] ) ) ) ) ) ) ) );
162
+    if (!empty($tab['content'])) {
163
+        return convert_smilies(capital_P_dangit(wp_filter_content_tags(do_shortcode(shortcode_unautop(wpautop(wptexturize(do_blocks($tab['content']))))))));
164 164
     }
165 165
 
166 166
     $notice = aui()->alert(
167 167
         array(
168
-            'content'     => __( 'This tab has no content or content callback.', 'invoicing' ),
168
+            'content'     => __('This tab has no content or content callback.', 'invoicing'),
169 169
             'type'        => 'error',
170 170
         )
171 171
     );
@@ -181,14 +181,14 @@  discard block
 block discarded – undo
181 181
  * @param string $default
182 182
  * @return array
183 183
  */
184
-function getpaid_get_tab_url( $tab, $default ) {
184
+function getpaid_get_tab_url($tab, $default) {
185 185
     global $getpaid_tab_url;
186 186
 
187
-    if ( empty( $getpaid_tab_url ) ) {
187
+    if (empty($getpaid_tab_url)) {
188 188
         return $default;
189 189
     }
190 190
 
191
-    return sprintf( $getpaid_tab_url, $tab );
191
+    return sprintf($getpaid_tab_url, $tab);
192 192
 
193 193
 }
194 194
 
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
  */
201 201
 function getpaid_display_address_edit_tab() {
202 202
 
203
-    if ( 0 === get_current_user_id() ) {
203
+    if (0 === get_current_user_id()) {
204 204
         return '<div class="bsui">' . aui()->alert(
205 205
             array(
206 206
                 'type'       => 'error',
207
-                'content'    => __( 'Your must be logged in to view this section', 'invoicing' ),
207
+                'content'    => __('Your must be logged in to view this section', 'invoicing'),
208 208
                 'dismissible'=> false,
209 209
             )
210 210
         ) . '</div>';
@@ -218,19 +218,19 @@  discard block
 block discarded – undo
218 218
 
219 219
                 <?php
220 220
 
221
-                    foreach ( getpaid_user_address_fields() as $key => $label ) {
221
+                    foreach (getpaid_user_address_fields() as $key => $label) {
222 222
 
223 223
                         // Display the country.
224
-                        if ( 'country' == $key ) {
224
+                        if ('country' == $key) {
225 225
 
226 226
                             echo aui()->select(
227 227
                                 array(
228 228
                                     'options'     => wpinv_get_country_list(),
229
-                                    'name'        => 'getpaid_address[' . esc_attr( $key ) . ']',
230
-                                    'id'          => 'wpinv-' . sanitize_html_class( $key ),
231
-                                    'value'       => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ),
229
+                                    'name'        => 'getpaid_address[' . esc_attr($key) . ']',
230
+                                    'id'          => 'wpinv-' . sanitize_html_class($key),
231
+                                    'value'       => sanitize_text_field(getpaid_get_user_address_field(get_current_user_id(), $key)),
232 232
                                     'placeholder' => $label,
233
-                                    'label'       => wp_kses_post( $label ),
233
+                                    'label'       => wp_kses_post($label),
234 234
                                     'label_type'  => 'vertical',
235 235
                                     'class'       => 'getpaid-address-field',
236 236
                                 )
@@ -239,30 +239,30 @@  discard block
 block discarded – undo
239 239
                         }
240 240
 
241 241
                         // Display the state.
242
-                        else if ( 'state' == $key ) {
242
+                        else if ('state' == $key) {
243 243
 
244
-                            echo getpaid_get_states_select_markup (
245
-                                getpaid_get_user_address_field( get_current_user_id(), 'country' ),
246
-                                getpaid_get_user_address_field( get_current_user_id(), 'state' ),
244
+                            echo getpaid_get_states_select_markup(
245
+                                getpaid_get_user_address_field(get_current_user_id(), 'country'),
246
+                                getpaid_get_user_address_field(get_current_user_id(), 'state'),
247 247
                                 $label,
248 248
                                 $label,
249 249
                                 '',
250 250
                                 false,
251 251
                                 '',
252
-                                'getpaid_address[' . esc_attr( $key ) . ']'
252
+                                'getpaid_address[' . esc_attr($key) . ']'
253 253
                             );
254 254
 
255 255
                         } else {
256 256
 
257 257
                             echo aui()->input(
258 258
                                 array(
259
-                                    'name'        => 'getpaid_address[' . esc_attr( $key ) . ']',
260
-                                    'id'          => 'wpinv-' . sanitize_html_class( $key ),
259
+                                    'name'        => 'getpaid_address[' . esc_attr($key) . ']',
260
+                                    'id'          => 'wpinv-' . sanitize_html_class($key),
261 261
                                     'placeholder' => $label,
262
-                                    'label'       => wp_kses_post( $label ),
262
+                                    'label'       => wp_kses_post($label),
263 263
                                     'label_type'  => 'vertical',
264 264
                                     'type'        => 'text',
265
-                                    'value'       => sanitize_text_field( getpaid_get_user_address_field( get_current_user_id(), $key ) ),
265
+                                    'value'       => sanitize_text_field(getpaid_get_user_address_field(get_current_user_id(), $key)),
266 266
                                     'class'       => 'getpaid-address-field',
267 267
                                 )
268 268
                             );
@@ -276,30 +276,30 @@  discard block
 block discarded – undo
276 276
                             'name'        => 'getpaid_address[email_cc]',
277 277
                             'id'          => 'wpinv-email_cc',
278 278
                             'placeholder' => '[email protected], [email protected]',
279
-                            'label'       => __( 'Other email addresses', 'invoicing' ),
279
+                            'label'       => __('Other email addresses', 'invoicing'),
280 280
                             'label_type'  => 'vertical',
281 281
                             'type'        => 'text',
282
-                            'value'       => sanitize_text_field( get_user_meta( get_current_user_id(), '_wpinv_email_cc', true ) ),
282
+                            'value'       => sanitize_text_field(get_user_meta(get_current_user_id(), '_wpinv_email_cc', true)),
283 283
                             'class'       => 'getpaid-address-field',
284
-                            'help_text'   => __( 'Optionally provide other email addresses where we should send payment notifications', 'invoicing' ),
284
+                            'help_text'   => __('Optionally provide other email addresses where we should send payment notifications', 'invoicing'),
285 285
                         )
286 286
                     );
287 287
 
288
-                    do_action( 'getpaid_display_address_edit_tab' );
288
+                    do_action('getpaid_display_address_edit_tab');
289 289
 
290 290
                     echo aui()->input(
291 291
                         array(
292 292
                             'name'             => 'getpaid_profile_edit_submit_button',
293 293
                             'id'               => 'getpaid_profile_edit_submit_button',
294
-                            'value'            => __( 'Save Address', 'invoicing' ),
295
-                            'help_text'        => __( 'New invoices will use this address as the billing address.', 'invoicing' ),
294
+                            'value'            => __('Save Address', 'invoicing'),
295
+                            'help_text'        => __('New invoices will use this address as the billing address.', 'invoicing'),
296 296
                             'type'             => 'submit',
297 297
                             'class'            => 'btn btn-primary btn-block submit-button',
298 298
                         )
299 299
                     );
300 300
 
301
-                    wp_nonce_field( 'getpaid-nonce', 'getpaid-nonce' );
302
-                    getpaid_hidden_field( 'getpaid-action', 'edit_billing_details' );
301
+                    wp_nonce_field('getpaid-nonce', 'getpaid-nonce');
302
+                    getpaid_hidden_field('getpaid-action', 'edit_billing_details');
303 303
                 ?>
304 304
 
305 305
             </form>
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 
310 310
     return ob_get_clean();
311 311
 }
312
-add_shortcode( 'getpaid_edit_address', 'getpaid_display_address_edit_tab' );
312
+add_shortcode('getpaid_edit_address', 'getpaid_display_address_edit_tab');
313 313
 
314 314
 /**
315 315
  * Saves the billing address edit tab.
@@ -317,31 +317,31 @@  discard block
 block discarded – undo
317 317
  * @since 2.1.4
318 318
  * @param array $data
319 319
  */
320
-function getpaid_save_address_edit_tab( $data ) {
320
+function getpaid_save_address_edit_tab($data) {
321 321
 
322
-    if ( empty( $data['getpaid_address'] ) || ! is_array( $data['getpaid_address'] ) ) {
322
+    if (empty($data['getpaid_address']) || !is_array($data['getpaid_address'])) {
323 323
         return;
324 324
     }
325 325
 
326 326
     $data    = $data['getpaid_address'];
327 327
     $user_id = get_current_user_id();
328 328
 
329
-    foreach ( array_keys( getpaid_user_address_fields() ) as $field ) {
329
+    foreach (array_keys(getpaid_user_address_fields()) as $field) {
330 330
 
331
-        if ( isset( $data[ $field ] ) ) {
332
-            $value = sanitize_text_field( $data[ $field ] );
333
-            update_user_meta( $user_id, '_wpinv_' . $field, $value );
331
+        if (isset($data[$field])) {
332
+            $value = sanitize_text_field($data[$field]);
333
+            update_user_meta($user_id, '_wpinv_' . $field, $value);
334 334
         }
335 335
 
336 336
     }
337 337
 
338
-    if ( isset( $data['email_cc'] ) ) {
339
-        update_user_meta( $user_id, '_wpinv_email_cc', sanitize_text_field( $data['email_cc'] ) );
338
+    if (isset($data['email_cc'])) {
339
+        update_user_meta($user_id, '_wpinv_email_cc', sanitize_text_field($data['email_cc']));
340 340
     }
341 341
 
342
-    wpinv_set_error( 'address_updated', __( 'Your billing address has been updated', 'invoicing' ), 'success');
342
+    wpinv_set_error('address_updated', __('Your billing address has been updated', 'invoicing'), 'success');
343 343
 }
344
-add_action( 'getpaid_authenticated_action_edit_billing_details', 'getpaid_save_address_edit_tab' );
344
+add_action('getpaid_authenticated_action_edit_billing_details', 'getpaid_save_address_edit_tab');
345 345
 
346 346
 
347 347
 /*
@@ -359,27 +359,27 @@  discard block
 block discarded – undo
359 359
  * @param  array $tabs
360 360
  * @return array
361 361
  */
362
-function getpaid_filter_userswp_account_tabs( $tabs ) {
362
+function getpaid_filter_userswp_account_tabs($tabs) {
363 363
 
364 364
     // Abort if the integration is inactive.
365
-    if ( ! getpaid_is_userswp_integration_active() ) {
365
+    if (!getpaid_is_userswp_integration_active()) {
366 366
         return $tabs;
367 367
     }
368 368
 
369
-    $new_tabs   = array();
369
+    $new_tabs = array();
370 370
 
371
-    foreach ( getpaid_get_user_content_tabs() as $slug => $tab ) {
371
+    foreach (getpaid_get_user_content_tabs() as $slug => $tab) {
372 372
 
373
-        $new_tabs[ $slug ] = array(
374
-            'title' => $tab[ 'label'],
375
-            'icon'  =>  $tab[ 'icon'],
373
+        $new_tabs[$slug] = array(
374
+            'title' => $tab['label'],
375
+            'icon'  =>  $tab['icon'],
376 376
         );
377 377
 
378 378
     }
379 379
 
380
-    return array_merge( $tabs, $new_tabs );
380
+    return array_merge($tabs, $new_tabs);
381 381
 }
382
-add_filter( 'uwp_account_available_tabs', 'getpaid_filter_userswp_account_tabs' );
382
+add_filter('uwp_account_available_tabs', 'getpaid_filter_userswp_account_tabs');
383 383
 
384 384
 /**
385 385
  * Display our UsersWP account tabs.
@@ -388,18 +388,18 @@  discard block
 block discarded – undo
388 388
  * @param  array $tabs
389 389
  * @return array
390 390
  */
391
-function getpaid_display_userswp_account_tabs( $tab ) {
391
+function getpaid_display_userswp_account_tabs($tab) {
392 392
     global $getpaid_tab_url;
393 393
 
394 394
     $our_tabs = getpaid_get_user_content_tabs();
395 395
 
396
-    if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) {
397
-        $getpaid_tab_url = add_query_arg( 'type', '%s', uwp_get_account_page_url() );
398
-        echo getpaid_prepare_user_content_tab( $our_tabs[ $tab ] );
396
+    if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) {
397
+        $getpaid_tab_url = add_query_arg('type', '%s', uwp_get_account_page_url());
398
+        echo getpaid_prepare_user_content_tab($our_tabs[$tab]);
399 399
     }
400 400
 
401 401
 }
402
-add_action( 'uwp_account_form_display', 'getpaid_display_userswp_account_tabs' );
402
+add_action('uwp_account_form_display', 'getpaid_display_userswp_account_tabs');
403 403
 
404 404
 
405 405
 /**
@@ -410,17 +410,17 @@  discard block
 block discarded – undo
410 410
  * @param  string $tab   Current tab.
411 411
  * @return string Title.
412 412
  */
413
-function getpaid_filter_userswp_account_title( $title, $tab ) {
413
+function getpaid_filter_userswp_account_title($title, $tab) {
414 414
 
415
-    $our_tabs   = getpaid_get_user_content_tabs();
415
+    $our_tabs = getpaid_get_user_content_tabs();
416 416
 
417
-    if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) {
418
-        return $our_tabs[ $tab ]['label'];
417
+    if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) {
418
+        return $our_tabs[$tab]['label'];
419 419
     }
420 420
 
421 421
     return $title;
422 422
 }
423
-add_filter( 'uwp_account_page_title', 'getpaid_filter_userswp_account_title', 10, 2 );
423
+add_filter('uwp_account_page_title', 'getpaid_filter_userswp_account_title', 10, 2);
424 424
 
425 425
 /**
426 426
  * Registers the UsersWP integration settings.
@@ -429,26 +429,26 @@  discard block
 block discarded – undo
429 429
  * @param  array $settings An array of integration settings.
430 430
  * @return array
431 431
  */
432
-function getpaid_register_userswp_settings( $settings ) {
432
+function getpaid_register_userswp_settings($settings) {
433 433
 
434
-    if ( defined( 'USERSWP_PLUGIN_FILE' ) ) {
434
+    if (defined('USERSWP_PLUGIN_FILE')) {
435 435
 
436 436
         $settings[] = array(
437 437
 
438 438
             'id'       => 'userswp',
439
-            'label'    => __( 'UsersWP', 'invoicing' ),
439
+            'label'    => __('UsersWP', 'invoicing'),
440 440
             'settings' => array(
441 441
 
442 442
                 'userswp_settings' => array(
443 443
                     'id'   => 'userswp_settings',
444
-                    'name' => '<h3>' . __( 'UsersWP', 'invoicing' ) . '</h3>',
444
+                    'name' => '<h3>' . __('UsersWP', 'invoicing') . '</h3>',
445 445
                     'type' => 'header',
446 446
                 ),
447 447
 
448 448
                 'enable_userswp' => array(
449 449
                     'id'         => 'enable_userswp',
450
-                    'name'       => __( 'Enable Integration', 'invoicing' ),
451
-                    'desc'       => __( 'Display GetPaid items on UsersWP account page.', 'invoicing' ),
450
+                    'name'       => __('Enable Integration', 'invoicing'),
451
+                    'desc'       => __('Display GetPaid items on UsersWP account page.', 'invoicing'),
452 452
                     'type'       => 'checkbox',
453 453
                     'std'        => 1,
454 454
                 )
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 
462 462
     return $settings;
463 463
 }
464
-add_filter( 'getpaid_integration_settings', 'getpaid_register_userswp_settings' );
464
+add_filter('getpaid_integration_settings', 'getpaid_register_userswp_settings');
465 465
 
466 466
 /**
467 467
  * Ovewrites the invoices history page to UsersWP.
@@ -469,18 +469,18 @@  discard block
 block discarded – undo
469 469
  * @since  2.3.1
470 470
  * @return bool
471 471
  */
472
-function getpaid_userswp_overwrite_invoice_history_page( $url, $post_type ) {
472
+function getpaid_userswp_overwrite_invoice_history_page($url, $post_type) {
473 473
 
474 474
     $our_tabs = getpaid_get_user_content_tabs();
475 475
     $tab      = "gp-{$post_type}s";
476
-    if ( getpaid_is_userswp_integration_active() && isset( $our_tabs[ $tab ] ) ) {
477
-        return add_query_arg( 'type', $tab, uwp_get_account_page_url() );
476
+    if (getpaid_is_userswp_integration_active() && isset($our_tabs[$tab])) {
477
+        return add_query_arg('type', $tab, uwp_get_account_page_url());
478 478
     }
479 479
 
480 480
     return $url;
481 481
 
482 482
 }
483
-add_filter( 'wpinv_get_history_page_uri', 'getpaid_userswp_overwrite_invoice_history_page', 10, 2 );
483
+add_filter('wpinv_get_history_page_uri', 'getpaid_userswp_overwrite_invoice_history_page', 10, 2);
484 484
 
485 485
 /**
486 486
  * Checks if the integration is enabled.
@@ -489,8 +489,8 @@  discard block
 block discarded – undo
489 489
  * @return bool
490 490
  */
491 491
 function getpaid_is_userswp_integration_active() {
492
-    $enabled = wpinv_get_option( 'enable_userswp', 1 );
493
-    return defined( 'USERSWP_PLUGIN_FILE' ) && ! empty( $enabled );
492
+    $enabled = wpinv_get_option('enable_userswp', 1);
493
+    return defined('USERSWP_PLUGIN_FILE') && !empty($enabled);
494 494
 }
495 495
 
496 496
 /*
@@ -508,26 +508,26 @@  discard block
 block discarded – undo
508 508
  * @param  array $settings An array of integration settings.
509 509
  * @return array
510 510
  */
511
-function getpaid_register_buddypress_settings( $settings ) {
511
+function getpaid_register_buddypress_settings($settings) {
512 512
 
513
-    if ( class_exists( 'BuddyPress' ) ) {
513
+    if (class_exists('BuddyPress')) {
514 514
 
515 515
         $settings[] = array(
516 516
 
517 517
             'id'       => 'buddypress',
518
-            'label'    => __( 'BuddyPress', 'invoicing' ),
518
+            'label'    => __('BuddyPress', 'invoicing'),
519 519
             'settings' => array(
520 520
 
521 521
                 'buddypress_settings' => array(
522 522
                     'id'   => 'buddypress_settings',
523
-                    'name' => '<h3>' . __( 'BuddyPress', 'invoicing' ) . '</h3>',
523
+                    'name' => '<h3>' . __('BuddyPress', 'invoicing') . '</h3>',
524 524
                     'type' => 'header',
525 525
                 ),
526 526
 
527 527
                 'enable_buddypress' => array(
528 528
                     'id'         => 'enable_buddypress',
529
-                    'name'       => __( 'Enable Integration', 'invoicing' ),
530
-                    'desc'       => __( 'Display GetPaid items on BuddyPress account pages.', 'invoicing' ),
529
+                    'name'       => __('Enable Integration', 'invoicing'),
530
+                    'desc'       => __('Display GetPaid items on BuddyPress account pages.', 'invoicing'),
531 531
                     'type'       => 'checkbox',
532 532
                     'std'        => 1,
533 533
                 )
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 
541 541
     return $settings;
542 542
 }
543
-add_filter( 'getpaid_integration_settings', 'getpaid_register_buddypress_settings' );
543
+add_filter('getpaid_integration_settings', 'getpaid_register_buddypress_settings');
544 544
 
545 545
 /**
546 546
  * Checks if the integration is enabled.
@@ -549,8 +549,8 @@  discard block
 block discarded – undo
549 549
  * @return bool
550 550
  */
551 551
 function getpaid_is_buddypress_integration_active() {
552
-    $enabled = wpinv_get_option( 'enable_buddypress', 1 );
553
-    return class_exists( 'BuddyPress' ) && ! empty( $enabled );
552
+    $enabled = wpinv_get_option('enable_buddypress', 1);
553
+    return class_exists('BuddyPress') && !empty($enabled);
554 554
 }
555 555
 
556 556
 /**
@@ -561,10 +561,10 @@  discard block
 block discarded – undo
561 561
  */
562 562
 function getpaid_setup_buddypress_integration() {
563 563
 
564
-    if ( getpaid_is_buddypress_integration_active() ) {
565
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-bp-getpaid-component.php' );
564
+    if (getpaid_is_buddypress_integration_active()) {
565
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-bp-getpaid-component.php');
566 566
         buddypress()->getpaid = new BP_GetPaid_Component();
567 567
     }
568 568
 
569 569
 }
570
-add_action( 'bp_setup_components', 'getpaid_setup_buddypress_integration' );
570
+add_action('bp_setup_components', 'getpaid_setup_buddypress_integration');
Please login to merge, or discard this patch.