admin-bar-menu.php
3 years ago
ajax-pagination.php
2 years ago
class-ecs-core.php
2 months ago
class-ecs-module-base.php
1 month ago
class-ecs-modules-manager.php
2 months ago
dynamic-style.php
3 years ago
ecs-dependencies.php
6 years ago
ecs-notices.php
6 years ago
enqueue-styles.php
2 years ago
pro-features.php
2 months ago
pro-preview.php
6 years ago
class-ecs-core.php
65 lines
| 1 | <?php |
| 2 | /** |
| 3 | * ECS Core — main plugin singleton. |
| 4 | * |
| 5 | * Bootstraps the modules manager and the admin interface. |
| 6 | * Access anywhere with ECS_Core::instance(). |
| 7 | */ |
| 8 | |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; |
| 11 | } |
| 12 | |
| 13 | final class ECS_Core { |
| 14 | |
| 15 | private static ?ECS_Core $instance = null; |
| 16 | |
| 17 | private ECS_Modules_Manager $modules_manager; |
| 18 | |
| 19 | public static function instance(): self { |
| 20 | if ( null === self::$instance ) { |
| 21 | self::$instance = new self(); |
| 22 | } |
| 23 | return self::$instance; |
| 24 | } |
| 25 | |
| 26 | private function __construct() { |
| 27 | $this->modules_manager = new ECS_Modules_Manager(); |
| 28 | |
| 29 | if ( is_admin() ) { |
| 30 | require_once ECS_PATH . 'admin/class-ecs-admin.php'; |
| 31 | new ECS_Admin( $this->modules_manager ); |
| 32 | } |
| 33 | |
| 34 | add_action( 'init', [ $this, 'load_textdomain' ] ); |
| 35 | add_action( 'elementor/elements/categories_registered', [ $this, 'register_widget_category' ] ); |
| 36 | } |
| 37 | |
| 38 | public function register_widget_category( $elements_manager ): void { |
| 39 | $elements_manager->add_category( |
| 40 | 'ele-custom-skin', |
| 41 | [ |
| 42 | 'title' => __( 'ECS Toolkit', 'ele-custom-skin' ), |
| 43 | 'icon' => 'fa fa-plug', |
| 44 | ] |
| 45 | ); |
| 46 | } |
| 47 | |
| 48 | public function load_textdomain(): void { |
| 49 | load_plugin_textdomain( |
| 50 | 'ele-custom-skin', |
| 51 | false, |
| 52 | dirname( plugin_basename( ECS_FILE ) ) . '/languages' |
| 53 | ); |
| 54 | } |
| 55 | |
| 56 | public function modules(): ECS_Modules_Manager { |
| 57 | return $this->modules_manager; |
| 58 | } |
| 59 | |
| 60 | private function __clone() {} |
| 61 | public function __wakeup() { |
| 62 | throw new \Exception( 'ECS_Core cannot be unserialized.' ); |
| 63 | } |
| 64 | } |
| 65 |