PluginProbe
Hello Plus / 1.2.0
Hello Plus v1.2.0
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7.0 1.7.1 1.7.2 1.7.3 All 30 releases
hello-plus / modules / admin / classes / menu / pages / setup-wizard.php

setup-wizard.php in Hello Plus 1.2.0, at modules/admin/classes/menu/pages/setup-wizard.php

69 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace HelloPlus\Modules\Admin\Classes\Menu\Pages;
4
5 use HelloPlus\Modules\Admin\Module;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit; // Exit if accessed directly.
9 }
10
11 class Setup_Wizard {
12 const SETUP_WIZARD_PAGE_SLUG = 'hello-plus-setup-wizard';
13
14 public static function has_site_wizard_been_completed(): bool {
15 static $is_setup_wizard_completed = null;
16
17 if ( ! class_exists( '\Elementor\App\Modules\ImportExport\Processes\Revert' ) ) {
18 return false;
19 }
20
21 if ( ! is_null( $is_setup_wizard_completed ) ) {
22 return $is_setup_wizard_completed;
23 }
24
25 $sessions = \Elementor\App\Modules\ImportExport\Processes\Revert::get_import_sessions();
26
27 if ( ! $sessions ) {
28 return false;
29 }
30
31 $last_session = end( $sessions );
32 $kit_name = $last_session['kit_name'];
33
34 try {
35 /**
36 * @var \HelloPlus\Modules\Admin\Classes\Rest\Onboarding_Settings $onboarding_rest
37 */
38 $onboarding_rest = Module::instance()->get_component( 'Api_Controller' )->get_endpoint( 'onboarding-settings' );
39
40 $kits = $onboarding_rest->get_kits();
41
42 $kit = array_filter( $kits, function ( $k ) use ( $kit_name ) {
43 return $k['manifest']['name'] === $kit_name;
44 } );
45
46 $is_setup_wizard_completed = ! empty( $kit );
47 } catch ( \Exception $e ) {
48 $is_setup_wizard_completed = false;
49 }
50
51 return $is_setup_wizard_completed;
52 }
53
54 public function register_setup_wizard_page( $parent_slug ): void {
55 add_submenu_page(
56 $parent_slug,
57 __( 'Setup Wizard', 'hello-plus' ),
58 __( 'Setup Wizard', 'hello-plus' ),
59 'manage_options',
60 self::SETUP_WIZARD_PAGE_SLUG,
61 [ $this, 'render_setup_wizard_page' ]
62 );
63 }
64
65 public function render_setup_wizard_page(): void {
66 echo '<div id="ehp-admin-onboarding"></div>';
67 }
68 }
69