PluginProbe
Preloader / trunk
Preloader vtrunk
trunk 2.0.0 2.0.1 2.0.2
the-preloader / includes / class-core.php

class-core.php in Preloader trunk, at includes/class-core.php

46 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( !defined('ABSPATH') ) {
4 exit;
5 }
6
7 /**
8 * Core class handles plugin initialization and manages main components (Output and Settings).
9 * Uses singleton pattern to ensure single instance throughout the application.
10 *
11 * @author Alobaidi
12 * @since 2.0.0
13 */
14
15 class The_Preloader_Core {
16 private static $instance = null;
17
18 public static function get_instance() {
19 if (null === self::$instance) {
20 self::$instance = new self();
21 }
22 return self::$instance;
23 }
24
25 /**
26 * Class constructor
27 */
28 private function __construct() {
29 // No initialization here.
30 }
31
32 public function initialize() {
33 // Run components
34 if ( !is_admin() && !class_exists('The_Preloader_Output') ) {
35 require_once THE_PRELOADER_PLUGIN_PATH . 'includes/class-output.php';
36 $The_Preloader_Output = The_Preloader_Output::get_instance();
37 $The_Preloader_Output->run();
38 }
39
40 if ( is_admin() && !class_exists('The_Preloader_Settings') ) {
41 require_once THE_PRELOADER_PLUGIN_PATH . 'includes/class-settings.php';
42 $The_Preloader_Settings = The_Preloader_Settings::get_instance();
43 $The_Preloader_Settings->run();
44 }
45 }
46 }