PluginProbe
Hostinger Tools / 3.0.20
Hostinger Tools v3.0.20
3.0.77 3.0.76 3.0.75 3.0.74 3.0.73 3.0.72 3.0.71 3.0.70 3.0.69 3.0.68 3.0.67 3.0.66 1.8.1 1.8.2 1.8.3 1.9.1 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.4 All 108 releases
hostinger / includes / Bootstrap.php

Bootstrap.php in Hostinger Tools 3.0.20, at includes/Bootstrap.php

74 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Hostinger;
4
5 use Hostinger\Admin\Ajax as AdminAjax;
6 use Hostinger\Admin\PluginSettings;
7 use Hostinger\Rest\Routes;
8 use Hostinger\Rest\SettingsRoutes;
9 use Hostinger\Admin\Assets as AdminAssets;
10 use Hostinger\Admin\Hooks as AdminHooks;
11 use Hostinger\Admin\Menu as AdminMenu;
12 use Hostinger\Admin\Redirects as AdminRedirects;
13 use Hostinger\WpHelper\Utils;
14
15 defined( 'ABSPATH' ) || exit;
16
17 class Bootstrap {
18 protected Loader $loader;
19
20 public function __construct() {
21 $this->loader = new Loader();
22 }
23
24 public function run(): void {
25 $this->load_dependencies();
26 $this->set_locale();
27 $this->loader->run();
28 }
29
30 private function load_dependencies(): void {
31 $this->load_public_dependencies();
32
33 if ( is_admin() ) {
34 $this->load_admin_dependencies();
35 }
36
37 if ( defined( 'WP_CLI' ) && WP_CLI ) {
38 new Cli();
39 }
40
41 $plugin_settings = new PluginSettings();
42 $plugin_options = $plugin_settings->get_plugin_settings();
43
44 if ( $plugin_options->get_maintenance_mode() ) {
45 require_once HOSTINGER_ABSPATH . 'includes/ComingSoon.php';
46 }
47 }
48
49 private function set_locale() {
50 $plugin_i18n = new I18n();
51 $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
52 }
53
54 private function load_admin_dependencies(): void {
55 $utils = new Utils();
56 new AdminAssets();
57 new AdminHooks( $utils );
58 new AdminMenu();
59 new AdminRedirects();
60 new AdminRedirects();
61 new AdminAjax();
62 }
63
64 private function load_public_dependencies(): void {
65 new Hooks();
66
67 $plugin_settings = new PluginSettings();
68
69 $settings_routes = new SettingsRoutes( $plugin_settings );
70 $routes = new Routes( $settings_routes );
71 $routes->init();
72 }
73 }
74