Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions admin/class-convertkit-admin-setup-wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,16 @@ public function maybe_load_setup_screen() {
$this->is_modal = true;
}

/**
* Define the steps for the setup wizard.
*
* @since 3.1.8
*
* @param array $steps The steps for the setup wizard.
* @return array The steps for the setup wizard.
*/
$this->steps = apply_filters( 'convertkit_admin_setup_wizard_steps_' . $this->page_name, $this->steps );

// Define the step the user is on in the setup process.
$this->step = $this->get_current_step();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,28 @@ class ConvertKit_Admin_Setup_Wizard_Landing_Page extends ConvertKit_Admin_Setup_
*/
public function __construct() {

// Define details for each step in the setup process.
$this->steps = array(
// Define the steps for the setup wizard.
add_filter( 'convertkit_admin_setup_wizard_steps_convertkit-landing-page-setup', array( $this, 'define_steps' ) );

add_action( 'convertkit_admin_setup_wizard_process_form_convertkit-landing-page-setup', array( $this, 'process_form' ) );
add_action( 'convertkit_admin_setup_wizard_load_screen_data_convertkit-landing-page-setup', array( $this, 'load_screen_data' ) );

// Call parent class constructor.
parent::__construct();

}

/**
* Define the steps for the setup wizard.
*
* @since 3.1.8
*
* @param array $steps The steps for the setup wizard.
* @return array
*/
public function define_steps( $steps ) {

return array(
'start' => array(
'name' => __( 'Setup', 'convertkit' ),
'next_button' => array(
Expand All @@ -97,12 +117,6 @@ public function __construct() {
),
);

add_action( 'convertkit_admin_setup_wizard_process_form_convertkit-landing-page-setup', array( $this, 'process_form' ) );
add_action( 'convertkit_admin_setup_wizard_load_screen_data_convertkit-landing-page-setup', array( $this, 'load_screen_data' ) );

// Call parent class constructor.
parent::__construct();

}

/**
Expand Down
56 changes: 32 additions & 24 deletions admin/setup-wizard/class-convertkit-admin-setup-wizard-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,6 @@ class ConvertKit_Admin_Setup_Wizard_Plugin extends ConvertKit_Admin_Setup_Wizard
*/
public $exit_url = 'options-general.php?page=_wp_convertkit_settings';

/**
* If the Form Importer step will be displayed.
*
* @since 3.1.7
*
* @var bool
*/
public $show_form_importer_step = false;

/**
* Holds the form importers.
*
Expand All @@ -121,10 +112,35 @@ public function __construct() {
$this->api = new ConvertKit_API_V4( CONVERTKIT_OAUTH_CLIENT_ID, CONVERTKIT_OAUTH_CLIENT_REDIRECT_URI, false, false, false, 'setup_wizard' );
$this->settings = new ConvertKit_Settings();

$this->show_form_importer_step = count( convertkit_get_form_importers() ) > 0 ? true : false;
// Define the steps for the setup wizard.
add_filter( 'convertkit_admin_setup_wizard_steps_convertkit-setup', array( $this, 'define_steps' ) );

// Register link to Setup Wizard below Plugin Name at Plugins > Installed Plugins.
add_filter( 'convertkit_plugin_screen_action_links', array( $this, 'add_setup_wizard_link_on_plugins_screen' ) );

add_action( 'admin_init', array( $this, 'maybe_redirect_to_setup_screen' ), 9999 );
add_action( 'convertkit_admin_setup_wizard_process_form_convertkit-setup', array( $this, 'process_form' ) );
add_action( 'convertkit_admin_setup_wizard_load_screen_data_convertkit-setup', array( $this, 'load_screen_data' ) );

// Call parent class constructor.
parent::__construct();

}

/**
* Define the steps for the setup wizard.
*
* @since 3.1.8
*
* @param array $steps The steps for the setup wizard.
* @return array
*/
public function define_steps( $steps ) {

$show_form_importer_step = count( convertkit_get_form_importers() ) > 0 ? true : false;

// Define details for each step in the setup process.
$this->steps = array(
$steps = array(
'start' => array(
'name' => __( 'Connect', 'convertkit' ),
'next_button' => array(
Expand All @@ -135,14 +151,14 @@ public function __construct() {
'configuration' => array(
'name' => __( 'Configuration', 'convertkit' ),
'next_button' => array(
'label' => $this->show_form_importer_step ? __( 'Next', 'convertkit' ) : __( 'Finish Setup', 'convertkit' ),
'label' => $show_form_importer_step ? __( 'Next', 'convertkit' ) : __( 'Finish Setup', 'convertkit' ),
),
),
);

// If the Form Importer step will be displayed, add it to the steps.
if ( $this->show_form_importer_step ) {
$this->steps['form-importer'] = array(
if ( $show_form_importer_step ) {
$steps['form-importer'] = array(
'name' => __( 'Form Importer', 'convertkit' ),
'next_button' => array(
'label' => __( 'Finish Setup', 'convertkit' ),
Expand All @@ -151,19 +167,11 @@ public function __construct() {
}

// Add the finish step.
$this->steps['finish'] = array(
$steps['finish'] = array(
'name' => __( 'Done', 'convertkit' ),
);

// Register link to Setup Wizard below Plugin Name at Plugins > Installed Plugins.
add_filter( 'convertkit_plugin_screen_action_links', array( $this, 'add_setup_wizard_link_on_plugins_screen' ) );

add_action( 'admin_init', array( $this, 'maybe_redirect_to_setup_screen' ), 9999 );
add_action( 'convertkit_admin_setup_wizard_process_form_convertkit-setup', array( $this, 'process_form' ) );
add_action( 'convertkit_admin_setup_wizard_load_screen_data_convertkit-setup', array( $this, 'load_screen_data' ) );

// Call parent class constructor.
parent::__construct();
return $steps;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,28 @@ class ConvertKit_Admin_Setup_Wizard_Restrict_Content extends ConvertKit_Admin_Se
*/
public function __construct() {

// Define details for each step in the setup process.
$this->steps = array(
// Define the steps for the setup wizard.
add_filter( 'convertkit_admin_setup_wizard_steps_convertkit-restrict-content-setup', array( $this, 'define_steps' ) );

add_action( 'convertkit_admin_setup_wizard_process_form_convertkit-restrict-content-setup', array( $this, 'process_form' ) );
add_action( 'convertkit_admin_setup_wizard_load_screen_data_convertkit-restrict-content-setup', array( $this, 'load_screen_data' ) );

// Call parent class constructor.
parent::__construct();

}

/**
* Define the steps for the setup wizard.
*
* @since 3.1.8
*
* @param array $steps The steps for the setup wizard.
* @return array
*/
public function define_steps( $steps ) {

return array(
'start' => array(
'name' => __( 'Setup', 'convertkit' ),
),
Expand All @@ -154,12 +174,6 @@ public function __construct() {
),
);

add_action( 'convertkit_admin_setup_wizard_process_form_convertkit-restrict-content-setup', array( $this, 'process_form' ) );
add_action( 'convertkit_admin_setup_wizard_load_screen_data_convertkit-restrict-content-setup', array( $this, 'load_screen_data' ) );

// Call parent class constructor.
parent::__construct();

}

/**
Expand Down