PluginProbe
Hello Plus / 1.7.4
Hello Plus v1.7.4
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 / components / admin-menu-controller.php

admin-menu-controller.php in Hello Plus 1.7.4, at modules/admin/components/admin-menu-controller.php

61 lines 1.5 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\Components;
4
5 use HelloPlus\Includes\Utils;
6 use HelloPlus\Modules\Admin\Classes\Menu\Pages\Settings;
7 use HelloPlus\Modules\Admin\Classes\Menu\Pages\Setup_Wizard;
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly.
11 }
12
13 class Admin_Menu_Controller {
14
15 const SETUP_WIZARD_TRANSIENT_NAME = 'helloplus_redirect_to_setup_wizard';
16
17 public function admin_menu( $parent_slug ) {
18 if ( Utils::has_hello_elementor_theme() ) {
19 return;
20 }
21 $setup_wizard = new Setup_Wizard();
22 $setup_wizard->register_setup_wizard_page( $parent_slug );
23 }
24
25 public function activate() {
26 if ( ! Setup_Wizard::has_site_wizard_been_completed() ) {
27 set_transient( self::SETUP_WIZARD_TRANSIENT_NAME, true );
28 }
29 }
30
31 public function redirect_on_first_activation() {
32 if ( empty( get_transient( self::SETUP_WIZARD_TRANSIENT_NAME ) ) ) {
33 return;
34 }
35 if ( ! is_admin() ) {
36 return;
37 }
38
39 delete_transient( self::SETUP_WIZARD_TRANSIENT_NAME );
40
41 if ( Utils::are_we_on_elementor_domains() ) {
42 return;
43 }
44
45 if ( Utils::is_test_environment() ) {
46 return;
47 }
48
49 wp_safe_redirect( self_admin_url( 'admin.php?page=' . Setup_Wizard::SETUP_WIZARD_PAGE_SLUG ) );
50 exit;
51 }
52
53 public function __construct() {
54 add_action( 'hello-plus-theme/admin-menu', [ $this, 'admin_menu' ], 10, 1 );
55 add_action( 'hello-plus/init', [ $this, 'redirect_on_first_activation' ] );
56 if ( ! Utils::has_hello_elementor_theme() ) {
57 add_action( 'hello-plus/activate', [ $this, 'activate' ] );
58 }
59 }
60 }
61