boot.php
1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
namespace LearnDash\Hub;
use LearnDash\Hub\Controller\Main_Controller;
use LearnDash\Hub\Controller\Projects_Controller;
use LearnDash\Hub\Controller\Settings_Controller;
use LearnDash\Hub\Controller\Signin_Controller;
use LearnDash\Hub\Traits\License;
use LearnDash\Hub\Traits\Permission;
/**
* Everything start from here
*
* Class Boot
*
* @package Hub
*/
class Boot {
use License;
use Permission;
/**
* Run all the triggers in init runtime.
*/
public function start() {
if ( $this->is_signed_on() ) {
if ( ! $this->is_user_allowed() ) {
return;
}
// later we will check the permissions for each modules.
( new Main_Controller() );
( new Projects_Controller() )->register_hooks();
( new Settings_Controller() );
} else {
( new Signin_Controller() );
}
}
/**
* Run the setup scripts when the plugin activating.
*/
public function install() {
}
/**
* Load the text domain
*
* @return void
*/
public function load_plugin_textdomain() {
load_plugin_textdomain( 'learndash-hub', false, basename( dirname( __DIR__ ) ) . '/languages/' );
}
/**
* Clear all the cache
*/
public function deactivate() {
delete_site_option( 'learndash-hub-projects-api' );
delete_site_option( 'learndash_hub_update_plugins_cache' );
}
}