From c159994355afeca09d37a4e09f1ee418698a6f28 Mon Sep 17 00:00:00 2001 From: Osman Goni Sufy <47870515+osmansufy@users.noreply.github.com> Date: Fri, 3 Jan 2025 15:20:08 +0600 Subject: [PATCH] [Skip] payment in Setup wizard when no payment is active (#2468) * [Skip] payment in Setup wizard * fix: deprecated notice in admin setup wizard * update: according to feedback $custom_logo & type mistake * update: removed redundant properties declare in vendor/SetupWizard --- includes/Admin/SetupWizard.php | 54 ++++--- includes/Admin/SetupWizardNoWC.php | 8 +- includes/Vendor/SetupWizard.php | 246 ++++++++++++++++++----------- 3 files changed, 190 insertions(+), 118 deletions(-) diff --git a/includes/Admin/SetupWizard.php b/includes/Admin/SetupWizard.php index 800c02ada4..b664636271 100644 --- a/includes/Admin/SetupWizard.php +++ b/includes/Admin/SetupWizard.php @@ -11,9 +11,11 @@ */ class SetupWizard { - /** @var string Currenct Step */ - protected $step = ''; + /** @var string Current Step */ + protected string $current_step = ''; + /** @var string custom logo url of the theme */ + protected $custom_logo = ''; /** @var array Steps for the setup wizard */ protected $steps = []; @@ -266,10 +268,10 @@ public function setup_wizard() { unset( $this->steps['recommended'] ); } - $this->step = current( array_keys( $this->steps ) ); + $this->current_step = current( array_keys( $this->steps ) ); // get step from url if ( isset( $_GET['_admin_sw_nonce'], $_GET['step'] ) && wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_admin_sw_nonce'] ) ), 'dokan_admin_setup_wizard_nonce' ) ) { - $this->step = sanitize_key( wp_unslash( $_GET['step'] ) ); + $this->current_step = sanitize_key( wp_unslash( $_GET['step'] ) ); } $this->enqueue_scripts(); @@ -278,8 +280,8 @@ public function setup_wizard() { isset( $_POST['_wpnonce'], $_POST['save_step'] ) && wp_verify_nonce( sanitize_key( wp_unslash( $_POST['_wpnonce'] ) ), 'dokan-setup' ) && ! empty( $_POST['save_step'] ) - && isset( $this->steps[ $this->step ]['handler'] ) ) { - call_user_func_array( $this->steps[ $this->step ]['handler'], [ $this ] ); + && isset( $this->steps[ $this->current_step ]['handler'] ) ) { + call_user_func_array( $this->steps[ $this->current_step ]['handler'], [ $this ] ); } ob_start(); @@ -292,7 +294,7 @@ public function get_next_step_link() { return add_query_arg( [ - 'step' => $keys[ array_search( $this->step, array_keys( $this->steps ), true ) + 1 ], + 'step' => $keys[ array_search( $this->current_step, array_keys( $this->steps ), true ) + 1 ], '_admin_sw_nonce' => wp_create_nonce( 'dokan_admin_setup_wizard_nonce' ), ] ); @@ -310,10 +312,14 @@ public function setup_wizard_header() {