Passed
Push — master ( f198a7...6b8347 )
by Stiofan
31:55
created
includes/admin/class-getpaid-admin-setup-wizard.php 2 patches
Indentation   +438 added lines, -438 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @info        GetPaid Setup Wizard.
12 12
  */
13 13
 if ( ! defined( 'ABSPATH' ) ) {
14
-	exit;
14
+    exit;
15 15
 }
16 16
 
17 17
 /**
@@ -19,84 +19,84 @@  discard block
 block discarded – undo
19 19
  */
20 20
 class GetPaid_Admin_Setup_Wizard {
21 21
 
22
-	/** @var string Current Step */
23
-	private $step = '';
24
-
25
-	/** @var array Steps for the setup wizard */
26
-	private $steps = array();
27
-
28
-	/**
29
-	 * Hook in tabs.
30
-	 */
31
-	public function __construct() {
32
-		if ( apply_filters( 'getpaid_enable_setup_wizard', true ) && current_user_can( 'manage_options' ) ) {
33
-			add_action( 'admin_menu', array( $this, 'admin_menus' ) );
34
-			add_action( 'current_screen', array( $this, 'setup_wizard' ) );
35
-
36
-			// add default content action
37
-			add_action( 'geodir_wizard_content_dummy_data', array( __CLASS__, 'content_dummy_data' ) );
38
-			add_action( 'geodir_wizard_content_sidebars', array( __CLASS__, 'content_sidebars' ) );
39
-			add_action( 'geodir_wizard_content_menus', array( __CLASS__, 'content_menus' ) );
40
-		}
41
-	}
42
-
43
-	/**
44
-	 * Add admin menus/screens.
45
-	 */
46
-	public function admin_menus() {
47
-		add_dashboard_page( '', '', 'manage_options', 'gp-setup', '' );
48
-	}
49
-
50
-	/**
51
-	 * Show the setup wizard.
52
-	 *
53
-	 * @since 2.0.0
54
-	 */
55
-	public function setup_wizard() {
56
-		if ( empty( $_GET['page'] ) || 'gp-setup' !== $_GET['page'] ) {
57
-			return;
58
-		}
59
-		$default_steps = array(
60
-			'introduction'     => array(
61
-				'name'    => __( 'Introduction', 'invoicing' ),
62
-				'view'    => array( $this, 'setup_introduction' ),
63
-				'handler' => '',
64
-			),
65
-			'business_details'             => array(
66
-				'name'    => __( "Business Details", 'invoicing' ),
67
-				'view'    => array( $this, 'setup_business' ),
68
-				'handler' => array( $this, 'setup_business_save' ),
69
-			),
70
-			'currency' => array(
71
-				'name'    => __( 'Currency', 'invoicing' ),
72
-				'view'    => array( $this, 'setup_currency' ),
73
-				'handler' => array( $this, 'setup_currency_save' ),
74
-			),
75
-			'payments'        => array(
76
-				'name'    => __( 'Payment Gateways', 'invoicing' ),
77
-				'view'    => array( $this, 'setup_payments' ),
78
-				'handler' => array( $this, 'setup_payments_save' ),
79
-			),
80
-			'recommend'          => array(
81
-				'name'    => __( 'Recommend', 'invoicing' ),
82
-				'view'    => array( $this, 'setup_recommend' ),
83
-				'handler' => array( $this, 'setup_recommend_save' ),
84
-			),
85
-			'next_steps'       => array(
86
-				'name'    => __( 'Get Paid', 'invoicing' ),
87
-				'view'    => array( $this, 'setup_ready' ),
88
-				'handler' => '',
89
-			),
90
-		);
91
-
92
-		$this->steps     = apply_filters( 'getpaid_setup_wizard_steps', $default_steps );
93
-		$this->step      = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
94
-
95
-
96
-		// enqueue the script
97
-		$aui_settings = AyeCode_UI_Settings::instance();
98
-		$aui_settings->enqueue_scripts();
99
-		$aui_settings->enqueue_style();
22
+    /** @var string Current Step */
23
+    private $step = '';
24
+
25
+    /** @var array Steps for the setup wizard */
26
+    private $steps = array();
27
+
28
+    /**
29
+     * Hook in tabs.
30
+     */
31
+    public function __construct() {
32
+        if ( apply_filters( 'getpaid_enable_setup_wizard', true ) && current_user_can( 'manage_options' ) ) {
33
+            add_action( 'admin_menu', array( $this, 'admin_menus' ) );
34
+            add_action( 'current_screen', array( $this, 'setup_wizard' ) );
35
+
36
+            // add default content action
37
+            add_action( 'geodir_wizard_content_dummy_data', array( __CLASS__, 'content_dummy_data' ) );
38
+            add_action( 'geodir_wizard_content_sidebars', array( __CLASS__, 'content_sidebars' ) );
39
+            add_action( 'geodir_wizard_content_menus', array( __CLASS__, 'content_menus' ) );
40
+        }
41
+    }
42
+
43
+    /**
44
+     * Add admin menus/screens.
45
+     */
46
+    public function admin_menus() {
47
+        add_dashboard_page( '', '', 'manage_options', 'gp-setup', '' );
48
+    }
49
+
50
+    /**
51
+     * Show the setup wizard.
52
+     *
53
+     * @since 2.0.0
54
+     */
55
+    public function setup_wizard() {
56
+        if ( empty( $_GET['page'] ) || 'gp-setup' !== $_GET['page'] ) {
57
+            return;
58
+        }
59
+        $default_steps = array(
60
+            'introduction'     => array(
61
+                'name'    => __( 'Introduction', 'invoicing' ),
62
+                'view'    => array( $this, 'setup_introduction' ),
63
+                'handler' => '',
64
+            ),
65
+            'business_details'             => array(
66
+                'name'    => __( "Business Details", 'invoicing' ),
67
+                'view'    => array( $this, 'setup_business' ),
68
+                'handler' => array( $this, 'setup_business_save' ),
69
+            ),
70
+            'currency' => array(
71
+                'name'    => __( 'Currency', 'invoicing' ),
72
+                'view'    => array( $this, 'setup_currency' ),
73
+                'handler' => array( $this, 'setup_currency_save' ),
74
+            ),
75
+            'payments'        => array(
76
+                'name'    => __( 'Payment Gateways', 'invoicing' ),
77
+                'view'    => array( $this, 'setup_payments' ),
78
+                'handler' => array( $this, 'setup_payments_save' ),
79
+            ),
80
+            'recommend'          => array(
81
+                'name'    => __( 'Recommend', 'invoicing' ),
82
+                'view'    => array( $this, 'setup_recommend' ),
83
+                'handler' => array( $this, 'setup_recommend_save' ),
84
+            ),
85
+            'next_steps'       => array(
86
+                'name'    => __( 'Get Paid', 'invoicing' ),
87
+                'view'    => array( $this, 'setup_ready' ),
88
+                'handler' => '',
89
+            ),
90
+        );
91
+
92
+        $this->steps     = apply_filters( 'getpaid_setup_wizard_steps', $default_steps );
93
+        $this->step      = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
94
+
95
+
96
+        // enqueue the script
97
+        $aui_settings = AyeCode_UI_Settings::instance();
98
+        $aui_settings->enqueue_scripts();
99
+        $aui_settings->enqueue_style();
100 100
 
101 101
 
102 102
 
@@ -108,21 +108,21 @@  discard block
 block discarded – undo
108 108
 //			call_user_func( $this->steps[ $this->step ]['handler'], $this );
109 109
 //		}
110 110
 
111
-		ob_start();
112
-		$this->setup_wizard_header();
111
+        ob_start();
112
+        $this->setup_wizard_header();
113 113
 //		$this->setup_wizard_steps();
114
-		$this->setup_wizard_content();
115
-		$this->setup_wizard_footer();
116
-		exit;
117
-	}
118
-
119
-	/**
120
-	 * Setup Wizard Header.
121
-	 *
122
-	 * @since 2.0.0
123
-	 */
114
+        $this->setup_wizard_content();
115
+        $this->setup_wizard_footer();
116
+        exit;
117
+    }
118
+
119
+    /**
120
+     * Setup Wizard Header.
121
+     *
122
+     * @since 2.0.0
123
+     */
124 124
 public function setup_wizard_header() {
125
-	?>
125
+    ?>
126 126
 	<!DOCTYPE html>
127 127
 	<html <?php language_attributes(); ?> class="bsui">
128 128
 	<head>
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
 		<title><?php esc_html_e( 'GetPaid &rsaquo; Setup Wizard', 'invoicing' ); ?></title>
132 132
 		<?php
133 133
 
134
-		wp_register_style( 'font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(  ), WPINV_VERSION );
135
-		wp_enqueue_style( 'font-awesome' );
136
-		do_action( 'admin_print_styles' ); ?>
134
+        wp_register_style( 'font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(  ), WPINV_VERSION );
135
+        wp_enqueue_style( 'font-awesome' );
136
+        do_action( 'admin_print_styles' ); ?>
137 137
 		<?php do_action( 'admin_head' ); ?>
138 138
 		<style>
139 139
 			body,p{
@@ -142,22 +142,22 @@  discard block
 block discarded – undo
142 142
 			}
143 143
 
144 144
 			<?php
145
-				$aui_settings = AyeCode_UI_Settings::instance();
146
-				echo $aui_settings::css_primary('#009874',true);
147
-			 ?>
145
+                $aui_settings = AyeCode_UI_Settings::instance();
146
+                echo $aui_settings::css_primary('#009874',true);
147
+                ?>
148 148
 
149 149
 
150 150
 		</style>
151 151
 	</head>
152 152
 	<body class="gp-setup wp-core-ui bg-lightx mx-auto text-dark scrollbars-ios" style="background: #f3f6ff;">
153 153
 	<?php
154
-	if(isset($_REQUEST['step'])){
155
-	$this->setup_wizard_steps();
156
-	}else{
157
-	echo "<div class='mb-3'>&nbsp;</div>";
158
-	}
154
+    if(isset($_REQUEST['step'])){
155
+    $this->setup_wizard_steps();
156
+    }else{
157
+    echo "<div class='mb-3'>&nbsp;</div>";
158
+    }
159 159
 
160
-	?>
160
+    ?>
161 161
 	<h1 class="h2 text-center pb-3">
162 162
 		<a class=" text-decoration-none" href="https://wpgetpaid.com/">
163 163
 			<span class="text-black-50">
@@ -166,61 +166,61 @@  discard block
 block discarded – undo
166 166
 		</a>
167 167
 	</h1>
168 168
 	<?php
169
-	}
170
-
171
-	/**
172
-	 * Output the steps.
173
-	 *
174
-	 * @since 2.0.0
175
-	 */
176
-	public function setup_wizard_steps() {
177
-		$ouput_steps = $this->steps;
178
-		array_shift( $ouput_steps );
179
-		?>
169
+    }
170
+
171
+    /**
172
+     * Output the steps.
173
+     *
174
+     * @since 2.0.0
175
+     */
176
+    public function setup_wizard_steps() {
177
+        $ouput_steps = $this->steps;
178
+        array_shift( $ouput_steps );
179
+        ?>
180 180
 		<ol class="gp-setup-steps mb-0 pb-4 mw-100 list-group list-group-horizontal text-center">
181 181
 			<?php
182
-			$current = '';
183
-			foreach ( $ouput_steps as $step_key => $step ) : ?>
182
+            $current = '';
183
+            foreach ( $ouput_steps as $step_key => $step ) : ?>
184 184
 				<li class="list-group-item flex-fill rounded-0 <?php
185
-				$maybe_hide = 'd-none';
186
-				if ( $step_key === $this->step ) {
187
-					$current = $this->step;
188
-					echo 'active';
189
-					$maybe_hide = '';
190
-				} elseif ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) {
191
-					echo 'done ';
192
-				}
193
-
194
-				echo ' '.$maybe_hide. ' d-md-block ';
195
-				$done = !$current ? 'text-success' : '';
196
-				?>"><i class="far fa-check-circle <?php echo $done ;?>"></i> <?php echo esc_html( $step['name'] ); ?></li>
185
+                $maybe_hide = 'd-none';
186
+                if ( $step_key === $this->step ) {
187
+                    $current = $this->step;
188
+                    echo 'active';
189
+                    $maybe_hide = '';
190
+                } elseif ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) {
191
+                    echo 'done ';
192
+                }
193
+
194
+                echo ' '.$maybe_hide. ' d-md-block ';
195
+                $done = !$current ? 'text-success' : '';
196
+                ?>"><i class="far fa-check-circle <?php echo $done ;?>"></i> <?php echo esc_html( $step['name'] ); ?></li>
197 197
 			<?php endforeach; ?>
198 198
 		</ol>
199 199
 		<?php
200
-	}
201
-
202
-	/**
203
-	 * Output the content for the current step.
204
-	 *
205
-	 * @since 2.0.0
206
-	 */
207
-	public function setup_wizard_content() {
208
-		echo '<div class="gp-setup-content rowx mw-100 text-center mb-3">';
209
-		echo '<div class="col-12 col-md-5 m-auto">';
210
-		echo '<div class="card shadow-sm">';
211
-		call_user_func( $this->steps[ $this->step ]['view'], $this );
212
-		echo '</div>';
213
-		echo '</div>';
214
-		echo '</div>';
215
-	}
216
-
217
-	/**
218
-	 * Setup Wizard Footer.
219
-	 *
220
-	 * @since 2.0.0
221
-	 */
222
-	public function setup_wizard_footer() {
223
-	?>
200
+    }
201
+
202
+    /**
203
+     * Output the content for the current step.
204
+     *
205
+     * @since 2.0.0
206
+     */
207
+    public function setup_wizard_content() {
208
+        echo '<div class="gp-setup-content rowx mw-100 text-center mb-3">';
209
+        echo '<div class="col-12 col-md-5 m-auto">';
210
+        echo '<div class="card shadow-sm">';
211
+        call_user_func( $this->steps[ $this->step ]['view'], $this );
212
+        echo '</div>';
213
+        echo '</div>';
214
+        echo '</div>';
215
+    }
216
+
217
+    /**
218
+     * Setup Wizard Footer.
219
+     *
220
+     * @since 2.0.0
221
+     */
222
+    public function setup_wizard_footer() {
223
+    ?>
224 224
 	<?php if ( 'next_steps' === $this->step ){ ?>
225 225
 		<p class="gd-return-to-dashboard-wrap"><a class="gd-return-to-dashboard btn btn-link d-block text-muted"
226 226
 		                                          href="<?php echo esc_url( admin_url() ); ?>"><?php esc_html_e( 'Return to the WordPress Dashboard', 'invoicing' ); ?></a>
@@ -234,13 +234,13 @@  discard block
 block discarded – undo
234 234
 	<?php
235 235
 }
236 236
 
237
-	/**
238
-	 * Introduction step.
239
-	 *
240
-	 * @since 2.0.0
241
-	 */
242
-	public function setup_introduction() {
243
-		?>
237
+    /**
238
+     * Introduction step.
239
+     *
240
+     * @since 2.0.0
241
+     */
242
+    public function setup_introduction() {
243
+        ?>
244 244
 		<h1 class="h4 card-header bg-white border-bottom-0 pt-4 pb-1"><?php esc_html_e( 'Welcome to GetPaid!', 'invoicing' ); ?></h1>
245 245
 		<div class="card-body text-muted ">
246 246
 			<p class=""><?php _e( 'Thank you for choosing GetPaid - The most Powerful Payments Plugin for WordPress', 'invoicing' ); ?></p>
@@ -346,50 +346,50 @@  discard block
 block discarded – undo
346 346
 			   class="btn btn-link d-block mt-2 "><?php esc_html_e( 'Not right now', 'invoicing' ); ?></a>
347 347
 		</div>
348 348
 		<?php
349
-	}
350
-
351
-	/**
352
-	 * Get the URL for the next step's screen.
353
-	 *
354
-	 * @param string step   slug (default: current step)
355
-	 *
356
-	 * @return string       URL for next step if a next step exists.
357
-	 *                      Admin URL if it's the last step.
358
-	 *                      Empty string on failure.
359
-	 * @since 3.0.0
360
-	 */
361
-	public function get_next_step_link( $step = '' ) {
362
-		if ( ! $step ) {
363
-			$step = $this->step;
364
-		}
365
-
366
-		$keys = array_keys( $this->steps );
367
-		if ( end( $keys ) === $step ) {
368
-			return admin_url();
369
-		}
370
-
371
-		$step_index = array_search( $step, $keys );
372
-		if ( false === $step_index ) {
373
-			return '';
374
-		}
375
-
376
-		return remove_query_arg('settings-updated', add_query_arg( 'step', $keys[ $step_index + 1 ] ));
377
-	}
378
-
379
-	/**
380
-	 * Setup maps api.
381
-	 *
382
-	 * @since 2.0.0
383
-	 */
384
-	public function setup_business() {
385
-		?>
349
+    }
350
+
351
+    /**
352
+     * Get the URL for the next step's screen.
353
+     *
354
+     * @param string step   slug (default: current step)
355
+     *
356
+     * @return string       URL for next step if a next step exists.
357
+     *                      Admin URL if it's the last step.
358
+     *                      Empty string on failure.
359
+     * @since 3.0.0
360
+     */
361
+    public function get_next_step_link( $step = '' ) {
362
+        if ( ! $step ) {
363
+            $step = $this->step;
364
+        }
365
+
366
+        $keys = array_keys( $this->steps );
367
+        if ( end( $keys ) === $step ) {
368
+            return admin_url();
369
+        }
370
+
371
+        $step_index = array_search( $step, $keys );
372
+        if ( false === $step_index ) {
373
+            return '';
374
+        }
375
+
376
+        return remove_query_arg('settings-updated', add_query_arg( 'step', $keys[ $step_index + 1 ] ));
377
+    }
378
+
379
+    /**
380
+     * Setup maps api.
381
+     *
382
+     * @since 2.0.0
383
+     */
384
+    public function setup_business() {
385
+        ?>
386 386
 		<form method="post" class="text-left card-body" action="options.php">
387 387
 			<?php
388 388
 
389
-			settings_fields( 'wpinv_settings' );
389
+            settings_fields( 'wpinv_settings' );
390 390
 
391
-			// override http referer to make it send back to the next step
392
-				?>
391
+            // override http referer to make it send back to the next step
392
+                ?>
393 393
 			<input type="hidden" name="_wp_http_referer" value="<?php echo esc_url( $this->get_next_step_link() ); ?>">
394 394
 
395 395
 			<table class="gp-setup-maps w-100 " cellspacing="0">
@@ -398,21 +398,21 @@  discard block
 block discarded – undo
398 398
 
399 399
 				<?php
400 400
 
401
-				global $wp_settings_fields;
401
+                global $wp_settings_fields;
402 402
 
403
-				$page = 'wpinv_settings_general_main';
404
-				$section = 'wpinv_settings_general_main';
405
-				if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) {
406
-			        return;
407
-			    }
403
+                $page = 'wpinv_settings_general_main';
404
+                $section = 'wpinv_settings_general_main';
405
+                if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) {
406
+                    return;
407
+                }
408 408
 
409
-			    $settings =  $wp_settings_fields[ $page ][ $section ];
409
+                $settings =  $wp_settings_fields[ $page ][ $section ];
410 410
 
411
-				// unset title
412
-				unset($settings["wpinv_settings[location_settings]"]);
411
+                // unset title
412
+                unset($settings["wpinv_settings[location_settings]"]);
413 413
 
414
-			    $this->output_fields($settings);
415
-				?>
414
+                $this->output_fields($settings);
415
+                ?>
416 416
 
417 417
 
418 418
 				</tbody>
@@ -425,64 +425,64 @@  discard block
 block discarded – undo
425 425
 			</p>
426 426
 		</form>
427 427
 		<?php
428
-	}
428
+    }
429 429
 
430
-	public function output_fields($settings){
430
+    public function output_fields($settings){
431 431
 
432
-	    if ( empty($settings)) {
433
-	        return;
434
-	    }
432
+        if ( empty($settings)) {
433
+            return;
434
+        }
435 435
 
436 436
 //print_r($settings);
437
-	    foreach ( (array) $settings as $key => $field ) {
437
+        foreach ( (array) $settings as $key => $field ) {
438 438
 
439 439
 
440
-	        $class = '';
440
+            $class = '';
441 441
 
442
-	        if ( ! empty( $field['args']['class'] ) ) {
443
-	            $class = esc_attr( $field['args']['class'] );
444
-	        }
442
+            if ( ! empty( $field['args']['class'] ) ) {
443
+                $class = esc_attr( $field['args']['class'] );
444
+            }
445 445
 
446
-	       // echo '<div class="form-group '.$class.'">';
446
+            // echo '<div class="form-group '.$class.'">';
447 447
 
448 448
 
449
-	        if ( ! empty( $field['args']['label_for'] ) ) {
450
-	            $for = ' for="' . esc_attr( $field['args']['label_for'] ) . '" ';
451
-	        } else {
452
-	            $for = '';
453
-	        }
449
+            if ( ! empty( $field['args']['label_for'] ) ) {
450
+                $for = ' for="' . esc_attr( $field['args']['label_for'] ) . '" ';
451
+            } else {
452
+                $for = '';
453
+            }
454 454
 
455
-			$value  = isset( $field['args']['std'] ) ? $field['args']['std'] : '';
456
-			$value  = wpinv_get_option( $field['args']['id'], $value );
455
+            $value  = isset( $field['args']['std'] ) ? $field['args']['std'] : '';
456
+            $value  = wpinv_get_option( $field['args']['id'], $value );
457 457
 
458
-			if($field['callback'] == 'wpinv_text_callback' || $field['callback'] == 'wpinv_number_callback' ){
458
+            if($field['callback'] == 'wpinv_text_callback' || $field['callback'] == 'wpinv_number_callback' ){
459 459
 
460 460
 
461
-			// hide the logo inputs, we need to set them as hidden so they don't blank the current values.
462
-			$help_text = isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '';
463
-			$type = $field['callback'] == 'wpinv_number_callback'  ? 'number' : 'text';
464
-			$label = isset($field['args']['name']) ? esc_attr($field['args']['name']) : '';
461
+            // hide the logo inputs, we need to set them as hidden so they don't blank the current values.
462
+            $help_text = isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '';
463
+            $type = $field['callback'] == 'wpinv_number_callback'  ? 'number' : 'text';
464
+            $label = isset($field['args']['name']) ? esc_attr($field['args']['name']) : '';
465 465
 
466
-			if(in_array($field['id'],array('wpinv_settings[logo]','wpinv_settings[logo_width]','wpinv_settings[logo_height]'))){
467
-				$type = 'hidden';
468
-				$help_text = '';
469
-				$label = '';
470
-			}
466
+            if(in_array($field['id'],array('wpinv_settings[logo]','wpinv_settings[logo_width]','wpinv_settings[logo_height]'))){
467
+                $type = 'hidden';
468
+                $help_text = '';
469
+                $label = '';
470
+            }
471 471
 
472
-				echo aui()->input(array(
473
-									'type'  =>  $type,
474
-									'id'    =>  isset($field['args']['id']) ? esc_attr($field['args']['id']) : '',
475
-									'name'    =>  isset($field['id']) ? esc_attr($field['id']) : '',
476
-									'value' =>   is_scalar( $value ) ? esc_attr( $value ) : '',
477
-									'required'  => false,
478
-									'help_text' => $help_text,
479
-									'label' => $label,
480
-									'label_type'    => 'floating'
481
-								));
482
-			}elseif($field['callback'] == 'wpinv_select_callback' || $field['callback'] == 'wpinv_country_states_callback'){
472
+                echo aui()->input(array(
473
+                                    'type'  =>  $type,
474
+                                    'id'    =>  isset($field['args']['id']) ? esc_attr($field['args']['id']) : '',
475
+                                    'name'    =>  isset($field['id']) ? esc_attr($field['id']) : '',
476
+                                    'value' =>   is_scalar( $value ) ? esc_attr( $value ) : '',
477
+                                    'required'  => false,
478
+                                    'help_text' => $help_text,
479
+                                    'label' => $label,
480
+                                    'label_type'    => 'floating'
481
+                                ));
482
+            }elseif($field['callback'] == 'wpinv_select_callback' || $field['callback'] == 'wpinv_country_states_callback'){
483 483
 
484 484
 if($field['id']=='wpinv_settings[default_state]'){
485
-			$country_value  = wpinv_get_option( 'wpinv_settings[default_country]', 'US');
485
+            $country_value  = wpinv_get_option( 'wpinv_settings[default_country]', 'US');
486 486
 $options = wpinv_get_country_states($country_value);//echo $value .'###'.$country_value;
487 487
 }else{
488 488
 $options = isset($field['args']['options']) ? $field['args']['options'] : array();
@@ -490,78 +490,78 @@  discard block
 block discarded – undo
490 490
 
491 491
 //print_r($options );echo '###';
492 492
 
493
-				echo aui()->select( array(
494
-					'id'              =>  isset($field['args']['id']) ? esc_attr($field['args']['id']) : '',
495
-					'name'            =>  isset($field['id']) ? esc_attr($field['id']) : '',
496
-					'placeholder'     => '',
493
+                echo aui()->select( array(
494
+                    'id'              =>  isset($field['args']['id']) ? esc_attr($field['args']['id']) : '',
495
+                    'name'            =>  isset($field['id']) ? esc_attr($field['id']) : '',
496
+                    'placeholder'     => '',
497 497
 //					'title'           => $site_title,
498
-					'value'           => is_scalar( $value ) ? esc_attr( $value ) : '',
499
-					'required'        => false,
500
-					'help_text'       => isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '',
501
-					'label'           => isset($field['args']['name']) ? esc_attr($field['args']['name']) : '',
502
-					'options'         => $options,
503
-					'select2'         => true,
504
-					'label_type'    => 'floating'
498
+                    'value'           => is_scalar( $value ) ? esc_attr( $value ) : '',
499
+                    'required'        => false,
500
+                    'help_text'       => isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '',
501
+                    'label'           => isset($field['args']['name']) ? esc_attr($field['args']['name']) : '',
502
+                    'options'         => $options,
503
+                    'select2'         => true,
504
+                    'label_type'    => 'floating'
505 505
 //					'wrap_class'      => isset( $field->css_class ) ? $field->css_class : '',
506
-				) );
507
-			}elseif($field['callback'] == 'wpinv_textarea_callback'){
508
-				$textarea =  aui()->textarea( array(
509
-					'id'              => isset($field['args']['id']) ? esc_attr($field['args']['id']) : '',
510
-					'name'            => isset($field['id']) ? esc_attr($field['id']) : '',
511
-					'placeholder'     => '',
506
+                ) );
507
+            }elseif($field['callback'] == 'wpinv_textarea_callback'){
508
+                $textarea =  aui()->textarea( array(
509
+                    'id'              => isset($field['args']['id']) ? esc_attr($field['args']['id']) : '',
510
+                    'name'            => isset($field['id']) ? esc_attr($field['id']) : '',
511
+                    'placeholder'     => '',
512 512
 //					'title'           => $site_title,
513
-					'value'           => is_scalar( $value ) ? esc_attr( $value ) : '',
514
-					'required'        => false,
515
-					'help_text'       => isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '',
516
-					'label'           => isset($field['args']['name']) ? esc_attr($field['args']['name']) : '',
517
-					'rows'            => '4',
518
-					'label_type'    => 'floating'
513
+                    'value'           => is_scalar( $value ) ? esc_attr( $value ) : '',
514
+                    'required'        => false,
515
+                    'help_text'       => isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '',
516
+                    'label'           => isset($field['args']['name']) ? esc_attr($field['args']['name']) : '',
517
+                    'rows'            => '4',
518
+                    'label_type'    => 'floating'
519 519
 //					'wrap_class'      => isset( $field->css_class ) ? $field->css_class : '',
520
-				) );
520
+                ) );
521 521
 
522
-				// bug fixed in AUI 0.1.51 for name stripping []
523
-				$textarea = str_replace(sanitize_html_class($field['args']['id']),esc_attr($field['args']['id']),$textarea );
522
+                // bug fixed in AUI 0.1.51 for name stripping []
523
+                $textarea = str_replace(sanitize_html_class($field['args']['id']),esc_attr($field['args']['id']),$textarea );
524 524
 
525
-				echo $textarea;
526
-			}
525
+                echo $textarea;
526
+            }
527 527
 
528
-			//echo "<div>";
528
+            //echo "<div>";
529 529
 
530
-	    }
531
-	}
530
+        }
531
+    }
532 532
 
533
-	/**
534
-	 * Save Maps Settings.
535
-	 *
536
-	 * @since 2.0.0
537
-	 */
538
-	public function setup_business_save() {
533
+    /**
534
+     * Save Maps Settings.
535
+     *
536
+     * @since 2.0.0
537
+     */
538
+    public function setup_business_save() {
539 539
 
540
-	// nothing required here as options.php will send to next step
541
-		//check_admin_referer( 'gp-setup' );
540
+    // nothing required here as options.php will send to next step
541
+        //check_admin_referer( 'gp-setup' );
542 542
 
543 543
 //print_r($_POST);exit;
544 544
 //		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
545 545
 //		exit;
546
-	}
546
+    }
547 547
 
548
-	/**
549
-	 * Default Location settings.
550
-	 *
551
-	 * @since 2.0.0
552
-	 */
553
-	public function setup_currency() {
548
+    /**
549
+     * Default Location settings.
550
+     *
551
+     * @since 2.0.0
552
+     */
553
+    public function setup_currency() {
554 554
 
555
-		?>
555
+        ?>
556 556
 
557 557
 		<form method="post" class="text-left card-body" action="options.php">
558 558
 			<?php
559 559
 
560 560
 
561
-			settings_fields( 'wpinv_settings' );
561
+            settings_fields( 'wpinv_settings' );
562 562
 
563
-			// override http referer to make it send back to the next step
564
-				?>
563
+            // override http referer to make it send back to the next step
564
+                ?>
565 565
 			<input type="hidden" name="_wp_http_referer" value="<?php echo esc_url( $this->get_next_step_link() ); ?>">
566 566
 
567 567
 			<table class="gp-setup-maps w-100 " cellspacing="0">
@@ -570,20 +570,20 @@  discard block
 block discarded – undo
570 570
 
571 571
 				<?php
572 572
 
573
-				global $wp_settings_fields;
573
+                global $wp_settings_fields;
574 574
 
575
-				$page = 'wpinv_settings_general_currency_section';
576
-				$section = 'wpinv_settings_general_currency_section';
577
-				if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) {
578
-			        return;
579
-			    }
575
+                $page = 'wpinv_settings_general_currency_section';
576
+                $section = 'wpinv_settings_general_currency_section';
577
+                if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) {
578
+                    return;
579
+                }
580 580
 
581
-			    $settings =  $wp_settings_fields[ $page ][ $section ];
581
+                $settings =  $wp_settings_fields[ $page ][ $section ];
582 582
 
583 583
 //				print_r($settings);exit;
584 584
 
585
-			    $this->output_fields($settings);
586
-				?>
585
+                $this->output_fields($settings);
586
+                ?>
587 587
 
588 588
 
589 589
 				</tbody>
@@ -597,35 +597,35 @@  discard block
 block discarded – undo
597 597
 		</form>
598 598
 
599 599
 		<?php
600
-	}
600
+    }
601 601
 
602 602
 
603
-	/**
604
-	 * Save Default Location Settings.
605
-	 *
606
-	 * @since 2.0.0
607
-	 */
608
-	public function setup_currency_save() {
609
-		check_admin_referer( 'gp-setup' );
603
+    /**
604
+     * Save Default Location Settings.
605
+     *
606
+     * @since 2.0.0
607
+     */
608
+    public function setup_currency_save() {
609
+        check_admin_referer( 'gp-setup' );
610 610
 
611
-		$generalSettings = new GeoDir_Settings_General();
612
-		$settings        = $generalSettings->get_settings( 'location' );
613
-		GeoDir_Admin_Settings::save_fields( $settings );
611
+        $generalSettings = new GeoDir_Settings_General();
612
+        $settings        = $generalSettings->get_settings( 'location' );
613
+        GeoDir_Admin_Settings::save_fields( $settings );
614 614
 
615
-		do_action( 'geodir_setup_wizard_default_location_saved', $settings );
615
+        do_action( 'geodir_setup_wizard_default_location_saved', $settings );
616 616
 
617
-		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
618
-		exit;
619
-	}
617
+        wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
618
+        exit;
619
+    }
620 620
 
621
-	/**
622
-	 * Dummy Data setup.
623
-	 *
624
-	 * @since 2.0.0
625
-	 */
626
-	public function setup_recommend() {
621
+    /**
622
+     * Dummy Data setup.
623
+     *
624
+     * @since 2.0.0
625
+     */
626
+    public function setup_recommend() {
627 627
 
628
-		?>
628
+        ?>
629 629
 		<form method="post" class="text-center card-body">
630 630
 			<div class="gd-wizard-recommend">
631 631
 
@@ -636,22 +636,22 @@  discard block
 block discarded – undo
636 636
 
637 637
 				<?php
638 638
 
639
-				include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
639
+                include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
640 640
 
641
-				$recommend_wp_plugins = self::get_recommend_wp_plugins();
641
+                $recommend_wp_plugins = self::get_recommend_wp_plugins();
642 642
 
643
-				//			$status = install_plugin_install_status( array("slug"=>"two-factor","version"=>""));
644
-				//			print_r($status);
643
+                //			$status = install_plugin_install_status( array("slug"=>"two-factor","version"=>""));
644
+                //			print_r($status);
645 645
 
646
-				if ( ! empty( $recommend_wp_plugins ) ) {
646
+                if ( ! empty( $recommend_wp_plugins ) ) {
647 647
 
648
-				?>
648
+                ?>
649 649
 				<ul class="list-group">
650 650
 					<?php
651
-						foreach ( $recommend_wp_plugins as $plugin ) {
652
-						$status = install_plugin_install_status( array( "slug" => $plugin['slug'], "version" => "" ) );
653
-						$plugin_status = isset( $status['status'] ) ? $status['status'] : '';
654
-						?>
651
+                        foreach ( $recommend_wp_plugins as $plugin ) {
652
+                        $status = install_plugin_install_status( array( "slug" => $plugin['slug'], "version" => "" ) );
653
+                        $plugin_status = isset( $status['status'] ) ? $status['status'] : '';
654
+                        ?>
655 655
 							<li class="list-group-item d-flex justify-content-between align-items-center flex-wrap text-left">
656 656
 							    <span class="mr-auto"><?php echo esc_attr($plugin['name']); ?></span>
657 657
 								<div class="spinner-border spinner-border-sm mr-2 d-none text-muted" role="status">
@@ -664,16 +664,16 @@  discard block
 block discarded – undo
664 664
 								<small class="w-100"><?php echo esc_attr($plugin['desc'] );?></small>
665 665
 							 </li>
666 666
 						<?php
667
-						}
667
+                        }
668 668
                     ?>
669 669
 				</ul>
670 670
 				<?php
671 671
 
672
-				}
672
+                }
673 673
 
674 674
 
675 675
 
676
-				?>
676
+                ?>
677 677
 
678 678
 
679 679
 
@@ -684,57 +684,57 @@  discard block
 block discarded – undo
684 684
 			</p>
685 685
 		</form>
686 686
 		<?php
687
-	}
688
-
689
-		/**
690
-	 * A list of recommended wp.org plugins.
691
-	 * @return array
692
-	 */
693
-	public static function get_recommend_wp_plugins(){
694
-		$plugins = array(
695
-			'ayecode-connect' => array(
696
-				'url'   => 'https://wordpress.org/plugins/ayecode-connect/',
697
-				'slug'   => 'ayecode-connect',
698
-				'name'   => 'AyeCode Connect',
699
-				'desc'   => __( 'Documentation and Support from within your WordPress admin.', 'geodirectory' ),
700
-			),
701
-			'ninja-forms' => array(
702
-				'url'   => 'https://wordpress.org/plugins/invoicing-quotes/',
703
-				'slug'   => 'invoicing-quotes',
704
-				'name'   => 'Customer Quotes',
705
-				'desc'   => __('Create & Send Quotes to Customers and have them accept and pay.','geodirectory'),
706
-			),
707
-			'userswp' => array(
708
-				'url'   => 'https://wordpress.org/plugins/userswp/',
709
-				'slug'   => 'userswp',
710
-				'name'   => 'UsersWP',
711
-				'desc'   => __('Frontend user login and registration as well as slick profile pages.','geodirectory'),
712
-			),
713
-		);
714
-
715
-		return $plugins;
716
-	}
717
-
718
-	/**
719
-	 * Dummy data save.
720
-	 *
721
-	 * This is done via ajax so we just pass onto the next step.
722
-	 *
723
-	 * @since 2.0.0
724
-	 */
725
-	public function setup_recommend_save() {
726
-		check_admin_referer( 'gp-setup' );
727
-		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
728
-		exit;
729
-	}
730
-
731
-	/**
732
-	 * Dummy Data setup.
733
-	 *
734
-	 * @since 2.0.0
735
-	 */
736
-	public function setup_payments() {
737
-		?>
687
+    }
688
+
689
+        /**
690
+         * A list of recommended wp.org plugins.
691
+         * @return array
692
+         */
693
+    public static function get_recommend_wp_plugins(){
694
+        $plugins = array(
695
+            'ayecode-connect' => array(
696
+                'url'   => 'https://wordpress.org/plugins/ayecode-connect/',
697
+                'slug'   => 'ayecode-connect',
698
+                'name'   => 'AyeCode Connect',
699
+                'desc'   => __( 'Documentation and Support from within your WordPress admin.', 'geodirectory' ),
700
+            ),
701
+            'ninja-forms' => array(
702
+                'url'   => 'https://wordpress.org/plugins/invoicing-quotes/',
703
+                'slug'   => 'invoicing-quotes',
704
+                'name'   => 'Customer Quotes',
705
+                'desc'   => __('Create & Send Quotes to Customers and have them accept and pay.','geodirectory'),
706
+            ),
707
+            'userswp' => array(
708
+                'url'   => 'https://wordpress.org/plugins/userswp/',
709
+                'slug'   => 'userswp',
710
+                'name'   => 'UsersWP',
711
+                'desc'   => __('Frontend user login and registration as well as slick profile pages.','geodirectory'),
712
+            ),
713
+        );
714
+
715
+        return $plugins;
716
+    }
717
+
718
+    /**
719
+     * Dummy data save.
720
+     *
721
+     * This is done via ajax so we just pass onto the next step.
722
+     *
723
+     * @since 2.0.0
724
+     */
725
+    public function setup_recommend_save() {
726
+        check_admin_referer( 'gp-setup' );
727
+        wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
728
+        exit;
729
+    }
730
+
731
+    /**
732
+     * Dummy Data setup.
733
+     *
734
+     * @since 2.0.0
735
+     */
736
+    public function setup_payments() {
737
+        ?>
738 738
 		<form method="post" class="text-center card-body">
739 739
 			<div class="gp-wizard-payments">
740 740
 
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 
776 776
 
777 777
 
778
-				?>
778
+                ?>
779 779
 
780 780
 
781 781
 			</div>
@@ -785,29 +785,29 @@  discard block
 block discarded – undo
785 785
 			</p>
786 786
 		</form>
787 787
 		<?php
788
-	}
789
-
790
-	/**
791
-	 * Dummy data save.
792
-	 *
793
-	 * This is done via ajax so we just pass onto the next step.
794
-	 *
795
-	 * @since 2.0.0
796
-	 */
797
-	public function setup_payments_save() {
798
-		check_admin_referer( 'gp-setup' );
799
-		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
800
-		exit;
801
-	}
802
-
803
-	/**
804
-	 * Final step.
805
-	 *
806
-	 * @since 2.0.0
807
-	 */
808
-	public function setup_ready() {
809
-		$this->setup_ready_actions();
810
-		?>
788
+    }
789
+
790
+    /**
791
+     * Dummy data save.
792
+     *
793
+     * This is done via ajax so we just pass onto the next step.
794
+     *
795
+     * @since 2.0.0
796
+     */
797
+    public function setup_payments_save() {
798
+        check_admin_referer( 'gp-setup' );
799
+        wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
800
+        exit;
801
+    }
802
+
803
+    /**
804
+     * Final step.
805
+     *
806
+     * @since 2.0.0
807
+     */
808
+    public function setup_ready() {
809
+        $this->setup_ready_actions();
810
+        ?>
811 811
 
812 812
 		<div class="text-center card-body">
813 813
 			<h1 class="h3"><?php esc_html_e( 'Awesome, you are ready to GetPaid', 'invoicing' ); ?></h1>
@@ -848,24 +848,24 @@  discard block
 block discarded – undo
848 848
 			</div>
849 849
 		</div>
850 850
 		<?php
851
-	}
852
-
853
-	/**
854
-	 * Actions on the final step.
855
-	 *
856
-	 * @since 2.0.0
857
-	 */
858
-	private function setup_ready_actions() {
859
-		GeoDir_Admin_Notices::remove_notice( 'install' );
860
-
861
-		if ( isset( $_GET['gd_tracker_optin'] ) && isset( $_GET['gd_tracker_nonce'] ) && wp_verify_nonce( $_GET['gd_tracker_nonce'], 'gd_tracker_optin' ) ) {
862
-			geodir_update_option( 'usage_tracking', true );
863
-			GeoDir_Admin_Tracker::send_tracking_data( true );
864
-
865
-		} elseif ( isset( $_GET['gd_tracker_optout'] ) && isset( $_GET['gd_tracker_nonce'] ) && wp_verify_nonce( $_GET['gd_tracker_nonce'], 'gd_tracker_optout' ) ) {
866
-			geodir_update_option( 'usage_tracking', false );
867
-		}
868
-	}
851
+    }
852
+
853
+    /**
854
+     * Actions on the final step.
855
+     *
856
+     * @since 2.0.0
857
+     */
858
+    private function setup_ready_actions() {
859
+        GeoDir_Admin_Notices::remove_notice( 'install' );
860
+
861
+        if ( isset( $_GET['gd_tracker_optin'] ) && isset( $_GET['gd_tracker_nonce'] ) && wp_verify_nonce( $_GET['gd_tracker_nonce'], 'gd_tracker_optin' ) ) {
862
+            geodir_update_option( 'usage_tracking', true );
863
+            GeoDir_Admin_Tracker::send_tracking_data( true );
864
+
865
+        } elseif ( isset( $_GET['gd_tracker_optout'] ) && isset( $_GET['gd_tracker_nonce'] ) && wp_verify_nonce( $_GET['gd_tracker_nonce'], 'gd_tracker_optout' ) ) {
866
+            geodir_update_option( 'usage_tracking', false );
867
+        }
868
+    }
869 869
 
870 870
 
871 871
 }
Please login to merge, or discard this patch.
Spacing   +167 added lines, -167 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
-if ( ! defined( 'ABSPATH' ) ) {
13
+if (!defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 	 * Hook in tabs.
30 30
 	 */
31 31
 	public function __construct() {
32
-		if ( apply_filters( 'getpaid_enable_setup_wizard', true ) && current_user_can( 'manage_options' ) ) {
33
-			add_action( 'admin_menu', array( $this, 'admin_menus' ) );
34
-			add_action( 'current_screen', array( $this, 'setup_wizard' ) );
32
+		if (apply_filters('getpaid_enable_setup_wizard', true) && current_user_can('manage_options')) {
33
+			add_action('admin_menu', array($this, 'admin_menus'));
34
+			add_action('current_screen', array($this, 'setup_wizard'));
35 35
 
36 36
 			// add default content action
37
-			add_action( 'geodir_wizard_content_dummy_data', array( __CLASS__, 'content_dummy_data' ) );
38
-			add_action( 'geodir_wizard_content_sidebars', array( __CLASS__, 'content_sidebars' ) );
39
-			add_action( 'geodir_wizard_content_menus', array( __CLASS__, 'content_menus' ) );
37
+			add_action('geodir_wizard_content_dummy_data', array(__CLASS__, 'content_dummy_data'));
38
+			add_action('geodir_wizard_content_sidebars', array(__CLASS__, 'content_sidebars'));
39
+			add_action('geodir_wizard_content_menus', array(__CLASS__, 'content_menus'));
40 40
 		}
41 41
 	}
42 42
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * Add admin menus/screens.
45 45
 	 */
46 46
 	public function admin_menus() {
47
-		add_dashboard_page( '', '', 'manage_options', 'gp-setup', '' );
47
+		add_dashboard_page('', '', 'manage_options', 'gp-setup', '');
48 48
 	}
49 49
 
50 50
 	/**
@@ -53,44 +53,44 @@  discard block
 block discarded – undo
53 53
 	 * @since 2.0.0
54 54
 	 */
55 55
 	public function setup_wizard() {
56
-		if ( empty( $_GET['page'] ) || 'gp-setup' !== $_GET['page'] ) {
56
+		if (empty($_GET['page']) || 'gp-setup' !== $_GET['page']) {
57 57
 			return;
58 58
 		}
59 59
 		$default_steps = array(
60 60
 			'introduction'     => array(
61
-				'name'    => __( 'Introduction', 'invoicing' ),
62
-				'view'    => array( $this, 'setup_introduction' ),
61
+				'name'    => __('Introduction', 'invoicing'),
62
+				'view'    => array($this, 'setup_introduction'),
63 63
 				'handler' => '',
64 64
 			),
65 65
 			'business_details'             => array(
66
-				'name'    => __( "Business Details", 'invoicing' ),
67
-				'view'    => array( $this, 'setup_business' ),
68
-				'handler' => array( $this, 'setup_business_save' ),
66
+				'name'    => __("Business Details", 'invoicing'),
67
+				'view'    => array($this, 'setup_business'),
68
+				'handler' => array($this, 'setup_business_save'),
69 69
 			),
70 70
 			'currency' => array(
71
-				'name'    => __( 'Currency', 'invoicing' ),
72
-				'view'    => array( $this, 'setup_currency' ),
73
-				'handler' => array( $this, 'setup_currency_save' ),
71
+				'name'    => __('Currency', 'invoicing'),
72
+				'view'    => array($this, 'setup_currency'),
73
+				'handler' => array($this, 'setup_currency_save'),
74 74
 			),
75 75
 			'payments'        => array(
76
-				'name'    => __( 'Payment Gateways', 'invoicing' ),
77
-				'view'    => array( $this, 'setup_payments' ),
78
-				'handler' => array( $this, 'setup_payments_save' ),
76
+				'name'    => __('Payment Gateways', 'invoicing'),
77
+				'view'    => array($this, 'setup_payments'),
78
+				'handler' => array($this, 'setup_payments_save'),
79 79
 			),
80 80
 			'recommend'          => array(
81
-				'name'    => __( 'Recommend', 'invoicing' ),
82
-				'view'    => array( $this, 'setup_recommend' ),
83
-				'handler' => array( $this, 'setup_recommend_save' ),
81
+				'name'    => __('Recommend', 'invoicing'),
82
+				'view'    => array($this, 'setup_recommend'),
83
+				'handler' => array($this, 'setup_recommend_save'),
84 84
 			),
85 85
 			'next_steps'       => array(
86
-				'name'    => __( 'Get Paid', 'invoicing' ),
87
-				'view'    => array( $this, 'setup_ready' ),
86
+				'name'    => __('Get Paid', 'invoicing'),
87
+				'view'    => array($this, 'setup_ready'),
88 88
 				'handler' => '',
89 89
 			),
90 90
 		);
91 91
 
92
-		$this->steps     = apply_filters( 'getpaid_setup_wizard_steps', $default_steps );
93
-		$this->step      = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
92
+		$this->steps     = apply_filters('getpaid_setup_wizard_steps', $default_steps);
93
+		$this->step      = isset($_GET['step']) ? sanitize_key($_GET['step']) : current(array_keys($this->steps));
94 94
 
95 95
 
96 96
 		// enqueue the script
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
 	<head>
129 129
 		<meta name="viewport" content="width=device-width"/>
130 130
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
131
-		<title><?php esc_html_e( 'GetPaid &rsaquo; Setup Wizard', 'invoicing' ); ?></title>
131
+		<title><?php esc_html_e('GetPaid &rsaquo; Setup Wizard', 'invoicing'); ?></title>
132 132
 		<?php
133 133
 
134
-		wp_register_style( 'font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(  ), WPINV_VERSION );
135
-		wp_enqueue_style( 'font-awesome' );
136
-		do_action( 'admin_print_styles' ); ?>
137
-		<?php do_action( 'admin_head' ); ?>
134
+		wp_register_style('font-awesome', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(  ), WPINV_VERSION);
135
+		wp_enqueue_style('font-awesome');
136
+		do_action('admin_print_styles'); ?>
137
+		<?php do_action('admin_head'); ?>
138 138
 		<style>
139 139
 			body,p{
140 140
 				font-size: 16px;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
 			<?php
145 145
 				$aui_settings = AyeCode_UI_Settings::instance();
146
-				echo $aui_settings::css_primary('#009874',true);
146
+				echo $aui_settings::css_primary('#009874', true);
147 147
 			 ?>
148 148
 
149 149
 
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 	</head>
152 152
 	<body class="gp-setup wp-core-ui bg-lightx mx-auto text-dark scrollbars-ios" style="background: #f3f6ff;">
153 153
 	<?php
154
-	if(isset($_REQUEST['step'])){
154
+	if (isset($_REQUEST['step'])) {
155 155
 	$this->setup_wizard_steps();
156
-	}else{
156
+	} else {
157 157
 	echo "<div class='mb-3'>&nbsp;</div>";
158 158
 	}
159 159
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	<h1 class="h2 text-center pb-3">
162 162
 		<a class=" text-decoration-none" href="https://wpgetpaid.com/">
163 163
 			<span class="text-black-50">
164
-				<img class="ml-n3x" src="<?php echo WPINV_PLUGIN_URL . 'assets/images/getpaid-logo.png';?>" />
164
+				<img class="ml-n3x" src="<?php echo WPINV_PLUGIN_URL . 'assets/images/getpaid-logo.png'; ?>" />
165 165
 			</span>
166 166
 		</a>
167 167
 	</h1>
@@ -175,25 +175,25 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	public function setup_wizard_steps() {
177 177
 		$ouput_steps = $this->steps;
178
-		array_shift( $ouput_steps );
178
+		array_shift($ouput_steps);
179 179
 		?>
180 180
 		<ol class="gp-setup-steps mb-0 pb-4 mw-100 list-group list-group-horizontal text-center">
181 181
 			<?php
182 182
 			$current = '';
183
-			foreach ( $ouput_steps as $step_key => $step ) : ?>
183
+			foreach ($ouput_steps as $step_key => $step) : ?>
184 184
 				<li class="list-group-item flex-fill rounded-0 <?php
185 185
 				$maybe_hide = 'd-none';
186
-				if ( $step_key === $this->step ) {
186
+				if ($step_key === $this->step) {
187 187
 					$current = $this->step;
188 188
 					echo 'active';
189 189
 					$maybe_hide = '';
190
-				} elseif ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) {
190
+				} elseif (array_search($this->step, array_keys($this->steps)) > array_search($step_key, array_keys($this->steps))) {
191 191
 					echo 'done ';
192 192
 				}
193 193
 
194
-				echo ' '.$maybe_hide. ' d-md-block ';
194
+				echo ' ' . $maybe_hide . ' d-md-block ';
195 195
 				$done = !$current ? 'text-success' : '';
196
-				?>"><i class="far fa-check-circle <?php echo $done ;?>"></i> <?php echo esc_html( $step['name'] ); ?></li>
196
+				?>"><i class="far fa-check-circle <?php echo $done; ?>"></i> <?php echo esc_html($step['name']); ?></li>
197 197
 			<?php endforeach; ?>
198 198
 		</ol>
199 199
 		<?php
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		echo '<div class="gp-setup-content rowx mw-100 text-center mb-3">';
209 209
 		echo '<div class="col-12 col-md-5 m-auto">';
210 210
 		echo '<div class="card shadow-sm">';
211
-		call_user_func( $this->steps[ $this->step ]['view'], $this );
211
+		call_user_func($this->steps[$this->step]['view'], $this);
212 212
 		echo '</div>';
213 213
 		echo '</div>';
214 214
 		echo '</div>';
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
 	 */
222 222
 	public function setup_wizard_footer() {
223 223
 	?>
224
-	<?php if ( 'next_steps' === $this->step ){ ?>
224
+	<?php if ('next_steps' === $this->step) { ?>
225 225
 		<p class="gd-return-to-dashboard-wrap"><a class="gd-return-to-dashboard btn btn-link d-block text-muted"
226
-		                                          href="<?php echo esc_url( admin_url() ); ?>"><?php esc_html_e( 'Return to the WordPress Dashboard', 'invoicing' ); ?></a>
226
+		                                          href="<?php echo esc_url(admin_url()); ?>"><?php esc_html_e('Return to the WordPress Dashboard', 'invoicing'); ?></a>
227 227
 		</p>
228
-	<?php }else{ ?>
229
-	<p class="gd-return-to-dashboard-wrap"><a href="<?php echo esc_url( $this->get_next_step_link() ); ?>"
230
-		                class="btn btn-link d-block text-muted"><?php esc_html_e( 'Skip this step', 'invoicing' ); ?></a></p>
228
+	<?php } else { ?>
229
+	<p class="gd-return-to-dashboard-wrap"><a href="<?php echo esc_url($this->get_next_step_link()); ?>"
230
+		                class="btn btn-link d-block text-muted"><?php esc_html_e('Skip this step', 'invoicing'); ?></a></p>
231 231
 	<?php } ?>
232 232
 	</body>
233 233
 	</html>
@@ -241,61 +241,61 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	public function setup_introduction() {
243 243
 		?>
244
-		<h1 class="h4 card-header bg-white border-bottom-0 pt-4 pb-1"><?php esc_html_e( 'Welcome to GetPaid!', 'invoicing' ); ?></h1>
244
+		<h1 class="h4 card-header bg-white border-bottom-0 pt-4 pb-1"><?php esc_html_e('Welcome to GetPaid!', 'invoicing'); ?></h1>
245 245
 		<div class="card-body text-muted ">
246
-			<p class=""><?php _e( 'Thank you for choosing GetPaid - The most Powerful Payments Plugin for WordPress', 'invoicing' ); ?></p>
246
+			<p class=""><?php _e('Thank you for choosing GetPaid - The most Powerful Payments Plugin for WordPress', 'invoicing'); ?></p>
247 247
 			<hr class="mt-4 pt-3 pb-0" />
248
-			<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>
248
+			<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>
249 249
 		</div>
250 250
 		<div class="card-footer mb-0 bg-white gp-setup-actions step border-top-0">
251
-			<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>"
252
-			   class="btn btn-primary button-next"><?php esc_html_e( 'Let\'s go!', 'invoicing' ); ?></a>
253
-			<a href="<?php echo esc_url( admin_url() ); ?>"
254
-			   class="btn btn-link d-block mt-2 "><?php esc_html_e( 'Not right now', 'invoicing' ); ?></a>
251
+			<a href="<?php echo esc_url($this->get_next_step_link()); ?>"
252
+			   class="btn btn-primary button-next"><?php esc_html_e('Let\'s go!', 'invoicing'); ?></a>
253
+			<a href="<?php echo esc_url(admin_url()); ?>"
254
+			   class="btn btn-link d-block mt-2 "><?php esc_html_e('Not right now', 'invoicing'); ?></a>
255 255
 		</div>
256 256
 
257 257
 
258 258
 		</div>
259 259
 		<div class="card shadow-sm my-5">
260
-		<h1 class="h4 card-header bg-white border-bottom-0  pt-4 pb-1"><?php esc_html_e( 'GetPaid Features & Addons!', 'invoicing' ); ?></h1>
260
+		<h1 class="h4 card-header bg-white border-bottom-0  pt-4 pb-1"><?php esc_html_e('GetPaid Features & Addons!', 'invoicing'); ?></h1>
261 261
 		<div class="card-body text-muted overflow-hidden">
262
-			<p class=""><?php _e( 'Collect one time & recurring payments online within minutes. No complex setup required.', 'invoicing' ); ?></p>
262
+			<p class=""><?php _e('Collect one time & recurring payments online within minutes. No complex setup required.', 'invoicing'); ?></p>
263 263
 			<hr class="">
264 264
 
265 265
 			<div class="row row row-cols-2 text-left">
266 266
 				<div class="col mt-3">
267 267
 					<div class="media">
268
-					  <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/buy.svg';?>" class="mr-3" alt="...">
268
+					  <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/buy.svg'; ?>" class="mr-3" alt="...">
269 269
 					  <div class="media-body">
270
-					    <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Buy Now Buttons','invoicing');?></h6>
271
-					    <small><?php _e('Sell via buy now buttons anywhere on your site','invoicing');?></small>
270
+					    <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Buy Now Buttons', 'invoicing'); ?></h6>
271
+					    <small><?php _e('Sell via buy now buttons anywhere on your site', 'invoicing'); ?></small>
272 272
 					  </div>
273 273
 					</div>
274 274
 				</div>
275 275
 			    <div class="col mt-3">
276 276
 					<div class="media">
277
-					  <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/report.svg';?>" class="mr-3" alt="...">
277
+					  <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/report.svg'; ?>" class="mr-3" alt="...">
278 278
 					  <div class="media-body">
279
-					    <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via payment form','invoicing');?></h6>
280
-					    <small><?php _e('Payment forms are conversion-optimized checkout forms','invoicing');?></small>
279
+					    <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via payment form', 'invoicing'); ?></h6>
280
+					    <small><?php _e('Payment forms are conversion-optimized checkout forms', 'invoicing'); ?></small>
281 281
 					  </div>
282 282
 					</div>
283 283
 				</div>
284 284
 				<div class="col mt-3">
285 285
 					<div class="media">
286
-					  <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/invoices.svg';?>" class="mr-3" alt="...">
286
+					  <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/invoices.svg'; ?>" class="mr-3" alt="...">
287 287
 					  <div class="media-body">
288
-					    <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Invoice','invoicing');?></h6>
289
-					    <small><?php _e('Create and send invoices for just about anything from the WOrdPress dashboard','invoicing');?></small>
288
+					    <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Invoice', 'invoicing'); ?></h6>
289
+					    <small><?php _e('Create and send invoices for just about anything from the WOrdPress dashboard', 'invoicing'); ?></small>
290 290
 					  </div>
291 291
 					</div>
292 292
 				</div>
293 293
 				<div class="col mt-3">
294 294
 					<div class="media">
295
-					  <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/payment.svg';?>" class="mr-3" alt="...">
295
+					  <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/payment.svg'; ?>" class="mr-3" alt="...">
296 296
 					  <div class="media-body">
297
-					    <h6 class="mt-0 font-weight-bold"><?php _e('Affordable payment gateways','invoicing');?></h6>
298
-					    <small><?php _e('On average our gateways are over 66% cheaper than our competition','invoicing');?></small>
297
+					    <h6 class="mt-0 font-weight-bold"><?php _e('Affordable payment gateways', 'invoicing'); ?></h6>
298
+					    <small><?php _e('On average our gateways are over 66% cheaper than our competition', 'invoicing'); ?></small>
299 299
 					  </div>
300 300
 					</div>
301 301
 				</div>
@@ -303,10 +303,10 @@  discard block
 block discarded – undo
303 303
 
304 304
 			<div class="mt-5">
305 305
 				<a href="https://wpgetpaid.com/features-list/"
306
-				   class="btn btn-primary"><?php esc_html_e( 'View All Features!', 'invoicing' ); ?></a>
306
+				   class="btn btn-primary"><?php esc_html_e('View All Features!', 'invoicing'); ?></a>
307 307
 			</div>
308 308
 			<div class="mt-5 mx-n4 py-4" style="background:#eafaf6;">
309
-				<h4 class="mt-0 font-weight-bold text-dark mb-4"><?php _e('More with Membership!','invoicing');?></h4>
309
+				<h4 class="mt-0 font-weight-bold text-dark mb-4"><?php _e('More with Membership!', 'invoicing'); ?></h4>
310 310
 				<div class="row row-cols-2 text-left px-5">
311 311
 					<div class="col">
312 312
 						<ul class="list-unstyled">
@@ -325,12 +325,12 @@  discard block
 block discarded – undo
325 325
 					</div>
326 326
 				</div>
327 327
 
328
-				<h5 class="mt-4 font-weight-bold text-dark mb-3"><?php _e('Membership Starts From','invoicing');?></h5>
328
+				<h5 class="mt-4 font-weight-bold text-dark mb-3"><?php _e('Membership Starts From', 'invoicing'); ?></h5>
329 329
 				<h1 class="mt-0 font-weight-bold text-dark mb-4 display-3">$49</h1>
330 330
 
331 331
 				<div class="mt-2">
332 332
 				<a href="https://wpgetpaid.com/downloads/membership/"
333
-				   class="btn btn-primary"><?php esc_html_e( 'Buy Membership Now!', 'invoicing' ); ?></a>
333
+				   class="btn btn-primary"><?php esc_html_e('Buy Membership Now!', 'invoicing'); ?></a>
334 334
 			</div>
335 335
 
336 336
 
@@ -338,12 +338,12 @@  discard block
 block discarded – undo
338 338
 
339 339
 		</div>
340 340
 		<div class="card-footer mb-0 bg-white gp-setup-actions step border-top-0">
341
-			<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>"
342
-			   class="btn btn-outline-primary button-next"><?php esc_html_e( 'Launch the Setup Wizard!', 'invoicing' ); ?></a>
341
+			<a href="<?php echo esc_url($this->get_next_step_link()); ?>"
342
+			   class="btn btn-outline-primary button-next"><?php esc_html_e('Launch the Setup Wizard!', 'invoicing'); ?></a>
343 343
 			   <a href="https://docs.wpgetpaid.com/"
344
-			   class="btn btn-outline-primary ml-4"><?php esc_html_e( 'Documentation', 'invoicing' ); ?></a>
345
-			<a href="<?php echo esc_url( admin_url() ); ?>"
346
-			   class="btn btn-link d-block mt-2 "><?php esc_html_e( 'Not right now', 'invoicing' ); ?></a>
344
+			   class="btn btn-outline-primary ml-4"><?php esc_html_e('Documentation', 'invoicing'); ?></a>
345
+			<a href="<?php echo esc_url(admin_url()); ?>"
346
+			   class="btn btn-link d-block mt-2 "><?php esc_html_e('Not right now', 'invoicing'); ?></a>
347 347
 		</div>
348 348
 		<?php
349 349
 	}
@@ -358,22 +358,22 @@  discard block
 block discarded – undo
358 358
 	 *                      Empty string on failure.
359 359
 	 * @since 3.0.0
360 360
 	 */
361
-	public function get_next_step_link( $step = '' ) {
362
-		if ( ! $step ) {
361
+	public function get_next_step_link($step = '') {
362
+		if (!$step) {
363 363
 			$step = $this->step;
364 364
 		}
365 365
 
366
-		$keys = array_keys( $this->steps );
367
-		if ( end( $keys ) === $step ) {
366
+		$keys = array_keys($this->steps);
367
+		if (end($keys) === $step) {
368 368
 			return admin_url();
369 369
 		}
370 370
 
371
-		$step_index = array_search( $step, $keys );
372
-		if ( false === $step_index ) {
371
+		$step_index = array_search($step, $keys);
372
+		if (false === $step_index) {
373 373
 			return '';
374 374
 		}
375 375
 
376
-		return remove_query_arg('settings-updated', add_query_arg( 'step', $keys[ $step_index + 1 ] ));
376
+		return remove_query_arg('settings-updated', add_query_arg('step', $keys[$step_index + 1]));
377 377
 	}
378 378
 
379 379
 	/**
@@ -386,11 +386,11 @@  discard block
 block discarded – undo
386 386
 		<form method="post" class="text-left card-body" action="options.php">
387 387
 			<?php
388 388
 
389
-			settings_fields( 'wpinv_settings' );
389
+			settings_fields('wpinv_settings');
390 390
 
391 391
 			// override http referer to make it send back to the next step
392 392
 				?>
393
-			<input type="hidden" name="_wp_http_referer" value="<?php echo esc_url( $this->get_next_step_link() ); ?>">
393
+			<input type="hidden" name="_wp_http_referer" value="<?php echo esc_url($this->get_next_step_link()); ?>">
394 394
 
395 395
 			<table class="gp-setup-maps w-100 " cellspacing="0">
396 396
 
@@ -402,11 +402,11 @@  discard block
 block discarded – undo
402 402
 
403 403
 				$page = 'wpinv_settings_general_main';
404 404
 				$section = 'wpinv_settings_general_main';
405
-				if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) {
405
+				if (!isset($wp_settings_fields[$page][$section])) {
406 406
 			        return;
407 407
 			    }
408 408
 
409
-			    $settings =  $wp_settings_fields[ $page ][ $section ];
409
+			    $settings = $wp_settings_fields[$page][$section];
410 410
 
411 411
 				// unset title
412 412
 				unset($settings["wpinv_settings[location_settings]"]);
@@ -421,49 +421,49 @@  discard block
 block discarded – undo
421 421
 
422 422
 			<p class="gp-setup-actions step text-center mt-4">
423 423
 				<input type="submit" class="btn btn-primary button-next"
424
-				       value="<?php esc_attr_e( 'Continue', 'invoicing' ); ?>" name="save_step"/>
424
+				       value="<?php esc_attr_e('Continue', 'invoicing'); ?>" name="save_step"/>
425 425
 			</p>
426 426
 		</form>
427 427
 		<?php
428 428
 	}
429 429
 
430
-	public function output_fields($settings){
430
+	public function output_fields($settings) {
431 431
 
432
-	    if ( empty($settings)) {
432
+	    if (empty($settings)) {
433 433
 	        return;
434 434
 	    }
435 435
 
436 436
 //print_r($settings);
437
-	    foreach ( (array) $settings as $key => $field ) {
437
+	    foreach ((array) $settings as $key => $field) {
438 438
 
439 439
 
440 440
 	        $class = '';
441 441
 
442
-	        if ( ! empty( $field['args']['class'] ) ) {
443
-	            $class = esc_attr( $field['args']['class'] );
442
+	        if (!empty($field['args']['class'])) {
443
+	            $class = esc_attr($field['args']['class']);
444 444
 	        }
445 445
 
446 446
 	       // echo '<div class="form-group '.$class.'">';
447 447
 
448 448
 
449
-	        if ( ! empty( $field['args']['label_for'] ) ) {
450
-	            $for = ' for="' . esc_attr( $field['args']['label_for'] ) . '" ';
449
+	        if (!empty($field['args']['label_for'])) {
450
+	            $for = ' for="' . esc_attr($field['args']['label_for']) . '" ';
451 451
 	        } else {
452 452
 	            $for = '';
453 453
 	        }
454 454
 
455
-			$value  = isset( $field['args']['std'] ) ? $field['args']['std'] : '';
456
-			$value  = wpinv_get_option( $field['args']['id'], $value );
455
+			$value  = isset($field['args']['std']) ? $field['args']['std'] : '';
456
+			$value  = wpinv_get_option($field['args']['id'], $value);
457 457
 
458
-			if($field['callback'] == 'wpinv_text_callback' || $field['callback'] == 'wpinv_number_callback' ){
458
+			if ($field['callback'] == 'wpinv_text_callback' || $field['callback'] == 'wpinv_number_callback') {
459 459
 
460 460
 
461 461
 			// hide the logo inputs, we need to set them as hidden so they don't blank the current values.
462 462
 			$help_text = isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '';
463
-			$type = $field['callback'] == 'wpinv_number_callback'  ? 'number' : 'text';
463
+			$type = $field['callback'] == 'wpinv_number_callback' ? 'number' : 'text';
464 464
 			$label = isset($field['args']['name']) ? esc_attr($field['args']['name']) : '';
465 465
 
466
-			if(in_array($field['id'],array('wpinv_settings[logo]','wpinv_settings[logo_width]','wpinv_settings[logo_height]'))){
466
+			if (in_array($field['id'], array('wpinv_settings[logo]', 'wpinv_settings[logo_width]', 'wpinv_settings[logo_height]'))) {
467 467
 				$type = 'hidden';
468 468
 				$help_text = '';
469 469
 				$label = '';
@@ -473,29 +473,29 @@  discard block
 block discarded – undo
473 473
 									'type'  =>  $type,
474 474
 									'id'    =>  isset($field['args']['id']) ? esc_attr($field['args']['id']) : '',
475 475
 									'name'    =>  isset($field['id']) ? esc_attr($field['id']) : '',
476
-									'value' =>   is_scalar( $value ) ? esc_attr( $value ) : '',
476
+									'value' =>   is_scalar($value) ? esc_attr($value) : '',
477 477
 									'required'  => false,
478 478
 									'help_text' => $help_text,
479 479
 									'label' => $label,
480 480
 									'label_type'    => 'floating'
481 481
 								));
482
-			}elseif($field['callback'] == 'wpinv_select_callback' || $field['callback'] == 'wpinv_country_states_callback'){
482
+			}elseif ($field['callback'] == 'wpinv_select_callback' || $field['callback'] == 'wpinv_country_states_callback') {
483 483
 
484
-if($field['id']=='wpinv_settings[default_state]'){
485
-			$country_value  = wpinv_get_option( 'wpinv_settings[default_country]', 'US');
486
-$options = wpinv_get_country_states($country_value);//echo $value .'###'.$country_value;
487
-}else{
484
+if ($field['id'] == 'wpinv_settings[default_state]') {
485
+			$country_value = wpinv_get_option('wpinv_settings[default_country]', 'US');
486
+$options = wpinv_get_country_states($country_value); //echo $value .'###'.$country_value;
487
+} else {
488 488
 $options = isset($field['args']['options']) ? $field['args']['options'] : array();
489 489
 }
490 490
 
491 491
 //print_r($options );echo '###';
492 492
 
493
-				echo aui()->select( array(
493
+				echo aui()->select(array(
494 494
 					'id'              =>  isset($field['args']['id']) ? esc_attr($field['args']['id']) : '',
495 495
 					'name'            =>  isset($field['id']) ? esc_attr($field['id']) : '',
496 496
 					'placeholder'     => '',
497 497
 //					'title'           => $site_title,
498
-					'value'           => is_scalar( $value ) ? esc_attr( $value ) : '',
498
+					'value'           => is_scalar($value) ? esc_attr($value) : '',
499 499
 					'required'        => false,
500 500
 					'help_text'       => isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '',
501 501
 					'label'           => isset($field['args']['name']) ? esc_attr($field['args']['name']) : '',
@@ -503,24 +503,24 @@  discard block
 block discarded – undo
503 503
 					'select2'         => true,
504 504
 					'label_type'    => 'floating'
505 505
 //					'wrap_class'      => isset( $field->css_class ) ? $field->css_class : '',
506
-				) );
507
-			}elseif($field['callback'] == 'wpinv_textarea_callback'){
508
-				$textarea =  aui()->textarea( array(
506
+				));
507
+			}elseif ($field['callback'] == 'wpinv_textarea_callback') {
508
+				$textarea = aui()->textarea(array(
509 509
 					'id'              => isset($field['args']['id']) ? esc_attr($field['args']['id']) : '',
510 510
 					'name'            => isset($field['id']) ? esc_attr($field['id']) : '',
511 511
 					'placeholder'     => '',
512 512
 //					'title'           => $site_title,
513
-					'value'           => is_scalar( $value ) ? esc_attr( $value ) : '',
513
+					'value'           => is_scalar($value) ? esc_attr($value) : '',
514 514
 					'required'        => false,
515 515
 					'help_text'       => isset($field['args']['desc']) ? esc_attr($field['args']['desc']) : '',
516 516
 					'label'           => isset($field['args']['name']) ? esc_attr($field['args']['name']) : '',
517 517
 					'rows'            => '4',
518 518
 					'label_type'    => 'floating'
519 519
 //					'wrap_class'      => isset( $field->css_class ) ? $field->css_class : '',
520
-				) );
520
+				));
521 521
 
522 522
 				// bug fixed in AUI 0.1.51 for name stripping []
523
-				$textarea = str_replace(sanitize_html_class($field['args']['id']),esc_attr($field['args']['id']),$textarea );
523
+				$textarea = str_replace(sanitize_html_class($field['args']['id']), esc_attr($field['args']['id']), $textarea);
524 524
 
525 525
 				echo $textarea;
526 526
 			}
@@ -558,11 +558,11 @@  discard block
 block discarded – undo
558 558
 			<?php
559 559
 
560 560
 
561
-			settings_fields( 'wpinv_settings' );
561
+			settings_fields('wpinv_settings');
562 562
 
563 563
 			// override http referer to make it send back to the next step
564 564
 				?>
565
-			<input type="hidden" name="_wp_http_referer" value="<?php echo esc_url( $this->get_next_step_link() ); ?>">
565
+			<input type="hidden" name="_wp_http_referer" value="<?php echo esc_url($this->get_next_step_link()); ?>">
566 566
 
567 567
 			<table class="gp-setup-maps w-100 " cellspacing="0">
568 568
 
@@ -574,11 +574,11 @@  discard block
 block discarded – undo
574 574
 
575 575
 				$page = 'wpinv_settings_general_currency_section';
576 576
 				$section = 'wpinv_settings_general_currency_section';
577
-				if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) {
577
+				if (!isset($wp_settings_fields[$page][$section])) {
578 578
 			        return;
579 579
 			    }
580 580
 
581
-			    $settings =  $wp_settings_fields[ $page ][ $section ];
581
+			    $settings = $wp_settings_fields[$page][$section];
582 582
 
583 583
 //				print_r($settings);exit;
584 584
 
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 
593 593
 			<p class="gp-setup-actions step text-center mt-4">
594 594
 				<input type="submit" class="btn btn-primary"
595
-				       value="<?php esc_attr_e( 'Continue', 'invoicing' ); ?>" name="save_step"/>
595
+				       value="<?php esc_attr_e('Continue', 'invoicing'); ?>" name="save_step"/>
596 596
 			</p>
597 597
 		</form>
598 598
 
@@ -606,15 +606,15 @@  discard block
 block discarded – undo
606 606
 	 * @since 2.0.0
607 607
 	 */
608 608
 	public function setup_currency_save() {
609
-		check_admin_referer( 'gp-setup' );
609
+		check_admin_referer('gp-setup');
610 610
 
611 611
 		$generalSettings = new GeoDir_Settings_General();
612
-		$settings        = $generalSettings->get_settings( 'location' );
613
-		GeoDir_Admin_Settings::save_fields( $settings );
612
+		$settings        = $generalSettings->get_settings('location');
613
+		GeoDir_Admin_Settings::save_fields($settings);
614 614
 
615
-		do_action( 'geodir_setup_wizard_default_location_saved', $settings );
615
+		do_action('geodir_setup_wizard_default_location_saved', $settings);
616 616
 
617
-		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
617
+		wp_redirect(esc_url_raw($this->get_next_step_link()));
618 618
 		exit;
619 619
 	}
620 620
 
@@ -629,28 +629,28 @@  discard block
 block discarded – undo
629 629
 		<form method="post" class="text-center card-body">
630 630
 			<div class="gd-wizard-recommend">
631 631
 
632
-				<h2 class="gd-settings-title h3 "><?php _e( "Recommend Plugins", "geodirectory" ); ?></h2>
632
+				<h2 class="gd-settings-title h3 "><?php _e("Recommend Plugins", "geodirectory"); ?></h2>
633 633
 
634
-				<p><?php _e( "Below are a few of our own plugins that may help you.", "geodirectory" ); ?></p>
634
+				<p><?php _e("Below are a few of our own plugins that may help you.", "geodirectory"); ?></p>
635 635
 
636 636
 
637 637
 				<?php
638 638
 
639
-				include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
639
+				include_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); //for plugins_api..
640 640
 
641 641
 				$recommend_wp_plugins = self::get_recommend_wp_plugins();
642 642
 
643 643
 				//			$status = install_plugin_install_status( array("slug"=>"two-factor","version"=>""));
644 644
 				//			print_r($status);
645 645
 
646
-				if ( ! empty( $recommend_wp_plugins ) ) {
646
+				if (!empty($recommend_wp_plugins)) {
647 647
 
648 648
 				?>
649 649
 				<ul class="list-group">
650 650
 					<?php
651
-						foreach ( $recommend_wp_plugins as $plugin ) {
652
-						$status = install_plugin_install_status( array( "slug" => $plugin['slug'], "version" => "" ) );
653
-						$plugin_status = isset( $status['status'] ) ? $status['status'] : '';
651
+						foreach ($recommend_wp_plugins as $plugin) {
652
+						$status = install_plugin_install_status(array("slug" => $plugin['slug'], "version" => ""));
653
+						$plugin_status = isset($status['status']) ? $status['status'] : '';
654 654
 						?>
655 655
 							<li class="list-group-item d-flex justify-content-between align-items-center flex-wrap text-left">
656 656
 							    <span class="mr-auto"><?php echo esc_attr($plugin['name']); ?></span>
@@ -658,10 +658,10 @@  discard block
 block discarded – undo
658 658
 									<span class="sr-only">Loading...</span>
659 659
 								</div>
660 660
 								<div class="custom-control custom-switch  mr-n2">
661
-									<input type="checkbox" class="custom-control-input"  <?php if( is_plugin_active( $plugin['slug'] ) ){echo "checked";} ?> onclick="if(jQuery(this).is(':checked')){}else{}">
661
+									<input type="checkbox" class="custom-control-input"  <?php if (is_plugin_active($plugin['slug'])) {echo "checked"; } ?> onclick="if(jQuery(this).is(':checked')){}else{}">
662 662
 									<label class="custom-control-label" for="ac-setting-updates"></label>
663 663
 								</div>
664
-								<small class="w-100"><?php echo esc_attr($plugin['desc'] );?></small>
664
+								<small class="w-100"><?php echo esc_attr($plugin['desc']); ?></small>
665 665
 							 </li>
666 666
 						<?php
667 667
 						}
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 			</div>
681 681
 
682 682
 			<p class="gp-setup-actions step text-center mt-4">
683
-				<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="btn btn-primary"><?php esc_attr_e( 'Continue', 'invoicing' ); ?></a>
683
+				<a href="<?php echo esc_url($this->get_next_step_link()); ?>" class="btn btn-primary"><?php esc_attr_e('Continue', 'invoicing'); ?></a>
684 684
 			</p>
685 685
 		</form>
686 686
 		<?php
@@ -690,25 +690,25 @@  discard block
 block discarded – undo
690 690
 	 * A list of recommended wp.org plugins.
691 691
 	 * @return array
692 692
 	 */
693
-	public static function get_recommend_wp_plugins(){
693
+	public static function get_recommend_wp_plugins() {
694 694
 		$plugins = array(
695 695
 			'ayecode-connect' => array(
696 696
 				'url'   => 'https://wordpress.org/plugins/ayecode-connect/',
697 697
 				'slug'   => 'ayecode-connect',
698 698
 				'name'   => 'AyeCode Connect',
699
-				'desc'   => __( 'Documentation and Support from within your WordPress admin.', 'geodirectory' ),
699
+				'desc'   => __('Documentation and Support from within your WordPress admin.', 'geodirectory'),
700 700
 			),
701 701
 			'ninja-forms' => array(
702 702
 				'url'   => 'https://wordpress.org/plugins/invoicing-quotes/',
703 703
 				'slug'   => 'invoicing-quotes',
704 704
 				'name'   => 'Customer Quotes',
705
-				'desc'   => __('Create & Send Quotes to Customers and have them accept and pay.','geodirectory'),
705
+				'desc'   => __('Create & Send Quotes to Customers and have them accept and pay.', 'geodirectory'),
706 706
 			),
707 707
 			'userswp' => array(
708 708
 				'url'   => 'https://wordpress.org/plugins/userswp/',
709 709
 				'slug'   => 'userswp',
710 710
 				'name'   => 'UsersWP',
711
-				'desc'   => __('Frontend user login and registration as well as slick profile pages.','geodirectory'),
711
+				'desc'   => __('Frontend user login and registration as well as slick profile pages.', 'geodirectory'),
712 712
 			),
713 713
 		);
714 714
 
@@ -723,8 +723,8 @@  discard block
 block discarded – undo
723 723
 	 * @since 2.0.0
724 724
 	 */
725 725
 	public function setup_recommend_save() {
726
-		check_admin_referer( 'gp-setup' );
727
-		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
726
+		check_admin_referer('gp-setup');
727
+		wp_redirect(esc_url_raw($this->get_next_step_link()));
728 728
 		exit;
729 729
 	}
730 730
 
@@ -738,20 +738,20 @@  discard block
 block discarded – undo
738 738
 		<form method="post" class="text-center card-body">
739 739
 			<div class="gp-wizard-payments">
740 740
 
741
-				<h2 class="gd-settings-title h3 "><?php _e( "Gateway Setup", "geodirectory" ); ?></h2>
741
+				<h2 class="gd-settings-title h3 "><?php _e("Gateway Setup", "geodirectory"); ?></h2>
742 742
 
743
-				<p><?php _e( "Below are a few gateways that can be setup in a few seconds.", "geodirectory" ); ?><br><?php _e( "We have 20+ Gateways that can be setup later.", "geodirectory" ); ?></p>
743
+				<p><?php _e("Below are a few gateways that can be setup in a few seconds.", "geodirectory"); ?><br><?php _e("We have 20+ Gateways that can be setup later.", "geodirectory"); ?></p>
744 744
 
745 745
 				<ul class="list-group">
746 746
 				  <li class="list-group-item d-flex justify-content-between align-items-center">
747
-				    <span class="mr-auto"><img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/stripe-verified.svg';?>" class="ml-n2" alt="Stripe"></span>
747
+				    <span class="mr-auto"><img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/stripe-verified.svg'; ?>" class="ml-n2" alt="Stripe"></span>
748 748
 					<div class="spinner-border spinner-border-sm mr-2 d-none text-muted" role="status">
749 749
 						<span class="sr-only">Loading...</span>
750 750
 					</div>
751 751
 				    <span class="btn btn-sm btn-outline-primary">Connect</span>
752 752
 				  </li>
753 753
 				  <li class="list-group-item d-flex justify-content-between align-items-center">
754
-				    <span class="mr-auto"><img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/pp-logo-150px.webp';?>" class="" alt="PayPal" height="25"></span>
754
+				    <span class="mr-auto"><img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/pp-logo-150px.webp'; ?>" class="" alt="PayPal" height="25"></span>
755 755
 					<div class="spinner-border spinner-border-sm mr-2 d-none text-muted" role="status">
756 756
 						<span class="sr-only">Loading...</span>
757 757
 					</div>
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 			</div>
782 782
 
783 783
 			<p class="gp-setup-actions step text-center mt-4">
784
-				<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="btn btn-primary"><?php esc_attr_e( 'Continue', 'invoicing' ); ?></a>
784
+				<a href="<?php echo esc_url($this->get_next_step_link()); ?>" class="btn btn-primary"><?php esc_attr_e('Continue', 'invoicing'); ?></a>
785 785
 			</p>
786 786
 		</form>
787 787
 		<?php
@@ -795,8 +795,8 @@  discard block
 block discarded – undo
795 795
 	 * @since 2.0.0
796 796
 	 */
797 797
 	public function setup_payments_save() {
798
-		check_admin_referer( 'gp-setup' );
799
-		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
798
+		check_admin_referer('gp-setup');
799
+		wp_redirect(esc_url_raw($this->get_next_step_link()));
800 800
 		exit;
801 801
 	}
802 802
 
@@ -810,40 +810,40 @@  discard block
 block discarded – undo
810 810
 		?>
811 811
 
812 812
 		<div class="text-center card-body">
813
-			<h1 class="h3"><?php esc_html_e( 'Awesome, you are ready to GetPaid', 'invoicing' ); ?></h1>
813
+			<h1 class="h3"><?php esc_html_e('Awesome, you are ready to GetPaid', 'invoicing'); ?></h1>
814 814
 
815 815
 
816 816
 			<div class="geodirectory-message geodirectory-tracker">
817
-				<p><?php _e( 'Thank you for choosing GetPaid!', 'invoicing' ); ?> <i class="far fa-smile-beam"></i></p>
817
+				<p><?php _e('Thank you for choosing GetPaid!', 'invoicing'); ?> <i class="far fa-smile-beam"></i></p>
818 818
 			</div>
819 819
 
820 820
 			<div class="gp-setup-next-steps">
821 821
 				<div class="gp-setup-next-steps-first mb-4">
822
-					<h2 class="h3"><?php esc_html_e( 'Next steps', 'invoicing' ); ?></h2>
822
+					<h2 class="h3"><?php esc_html_e('Next steps', 'invoicing'); ?></h2>
823 823
 					<a class="btn btn-primary btn-sm"
824
-						                             href="<?php echo esc_url( admin_url( 'post-new.php?post_type=wpi_item' ) ); ?>"><?php esc_html_e( 'Create your first Item!', 'invoicing' ); ?></a>
824
+						                             href="<?php echo esc_url(admin_url('post-new.php?post_type=wpi_item')); ?>"><?php esc_html_e('Create your first Item!', 'invoicing'); ?></a>
825 825
 				</div>
826 826
 				<div class="gp-setup-next-steps-first mb-4">
827
-					<h2 class="h3"><?php esc_html_e( 'Examples', 'invoicing' ); ?></h2>
827
+					<h2 class="h3"><?php esc_html_e('Examples', 'invoicing'); ?></h2>
828 828
 					<a class="btn btn-primary btn-sm"
829
-					target="_blank" href="https://demos.ayecode.io/getpaid/"><?php esc_html_e( "View What's Possible", 'invoicing' ); ?></a>
829
+					target="_blank" href="https://demos.ayecode.io/getpaid/"><?php esc_html_e("View What's Possible", 'invoicing'); ?></a>
830 830
 
831 831
                      <a class="btn btn-outline-primary btn-sm"
832
-                     target="_blank" href="https://demos.ayecode.io/getpaid/"><?php esc_html_e( "View What's Possible", 'invoicing' ); ?></a>
832
+                     target="_blank" href="https://demos.ayecode.io/getpaid/"><?php esc_html_e("View What's Possible", 'invoicing'); ?></a>
833 833
 				</div>
834 834
 				<div class="gp-setup-next-steps-last">
835
-					<h2 class="h3"><?php _e( 'Learn more', 'invoicing' ); ?></h2>
835
+					<h2 class="h3"><?php _e('Learn more', 'invoicing'); ?></h2>
836 836
 					<a class="btn btn-outline-primary btn-sm" href="https://docs.wpgetpaid.com/collection/114-getting-started?utm_source=setupwizard&utm_medium=product&utm_content=getting-started&utm_campaign=invoicingplugin"
837
-								target="_blank"><?php esc_html_e( 'Getting Started', 'invoicing' ); ?></a>
837
+								target="_blank"><?php esc_html_e('Getting Started', 'invoicing'); ?></a>
838 838
 						<a class="btn btn-outline-primary btn-sm"
839 839
 								href="https://docs.wpgetpaid.com/?utm_source=setupwizard&utm_medium=product&utm_content=docs&utm_campaign=invoicingplugin"
840
-								target="_blank"><?php esc_html_e( 'Documentation', 'invoicing' ); ?></a>
840
+								target="_blank"><?php esc_html_e('Documentation', 'invoicing'); ?></a>
841 841
 						<a class="btn btn-outline-primary btn-sm"
842 842
 								href="https://wpgetpaid.com/support/?utm_source=setupwizard&utm_medium=product&utm_content=docs&utm_campaign=invoicingyplugin"
843
-								target="_blank"><?php esc_html_e( 'Support', 'invoicing' ); ?></a>
843
+								target="_blank"><?php esc_html_e('Support', 'invoicing'); ?></a>
844 844
 								<a class="btn btn-outline-primary btn-sm"
845 845
 								href="https://demos.ayecode.io/getpaid/?utm_source=setupwizard&utm_medium=product&utm_content=demos&utm_campaign=invoicingyplugin"
846
-								target="_blank"><?php esc_html_e( 'Demos', 'invoicing' ); ?></a>
846
+								target="_blank"><?php esc_html_e('Demos', 'invoicing'); ?></a>
847 847
 				</div>
848 848
 			</div>
849 849
 		</div>
@@ -856,14 +856,14 @@  discard block
 block discarded – undo
856 856
 	 * @since 2.0.0
857 857
 	 */
858 858
 	private function setup_ready_actions() {
859
-		GeoDir_Admin_Notices::remove_notice( 'install' );
859
+		GeoDir_Admin_Notices::remove_notice('install');
860 860
 
861
-		if ( isset( $_GET['gd_tracker_optin'] ) && isset( $_GET['gd_tracker_nonce'] ) && wp_verify_nonce( $_GET['gd_tracker_nonce'], 'gd_tracker_optin' ) ) {
862
-			geodir_update_option( 'usage_tracking', true );
863
-			GeoDir_Admin_Tracker::send_tracking_data( true );
861
+		if (isset($_GET['gd_tracker_optin']) && isset($_GET['gd_tracker_nonce']) && wp_verify_nonce($_GET['gd_tracker_nonce'], 'gd_tracker_optin')) {
862
+			geodir_update_option('usage_tracking', true);
863
+			GeoDir_Admin_Tracker::send_tracking_data(true);
864 864
 
865
-		} elseif ( isset( $_GET['gd_tracker_optout'] ) && isset( $_GET['gd_tracker_nonce'] ) && wp_verify_nonce( $_GET['gd_tracker_nonce'], 'gd_tracker_optout' ) ) {
866
-			geodir_update_option( 'usage_tracking', false );
865
+		} elseif (isset($_GET['gd_tracker_optout']) && isset($_GET['gd_tracker_nonce']) && wp_verify_nonce($_GET['gd_tracker_nonce'], 'gd_tracker_optout')) {
866
+			geodir_update_option('usage_tracking', false);
867 867
 		}
868 868
 	}
869 869
 
Please login to merge, or discard this patch.