| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) exit; |
| 3 |
|
| 4 |
class Easy_Elements_Loader { |
| 5 |
private static $instance = null; |
| 6 |
/** |
| 7 |
* Get instance (singleton) |
| 8 |
*/ |
| 9 |
public static function instance() { |
| 10 |
if ( self::$instance === null ) { |
| 11 |
self::$instance = new self(); |
| 12 |
} |
| 13 |
return self::$instance; |
| 14 |
} |
| 15 |
/** |
| 16 |
* Constructor (private to prevent multiple instantiation) |
| 17 |
*/ |
| 18 |
private function __construct() { |
| 19 |
$this->includes(); |
| 20 |
} |
| 21 |
/** |
| 22 |
* Include necessary files |
| 23 |
*/ |
| 24 |
private function includes() { |
| 25 |
|
| 26 |
$includes = [ |
| 27 |
'helpers' => [ |
| 28 |
'inc/class-assets.php', |
| 29 |
'inc/helper.php', |
| 30 |
'inc/canvas-content.php', |
| 31 |
'inc/extension/class-easy-promo-helper.php', |
| 32 |
'inc/extension/class-wrapper-link.php', |
| 33 |
'inc/extension/custom-css/easy-custom-css.php', |
| 34 |
'inc/jaralax-control.php', |
| 35 |
'inc/custom-code/easy-custom-code.php', |
| 36 |
'easy-template-library/class-easy-elements-template-library.php', |
| 37 |
'inc/extension/duplicator/easy-duplicator.php', |
| 38 |
'inc/extension/pagepostexport/pagepostexport.php', |
| 39 |
'inc/extension/visibility-control/class-easy-visibility-module.php', |
| 40 |
'inc/extension/live-copy-paste/live-copy-paste.php', |
| 41 |
'inc/extension/extension-hook/class-extension-hook.php', |
| 42 |
], |
| 43 |
'admin' => [ |
| 44 |
'admin/settings.php', |
| 45 |
], |
| 46 |
'frontend' => [ |
| 47 |
'base.php', |
| 48 |
'templates/theme-builder/easyel-builder-frontend.php', |
| 49 |
], |
| 50 |
'addons' => [ |
| 51 |
'header-footer-builder/classes/easy-header-footer.php', |
| 52 |
], |
| 53 |
'cpt' => [ |
| 54 |
'templates/theme-builder/easy-theme-builder-post-type.php', |
| 55 |
], |
| 56 |
]; |
| 57 |
|
| 58 |
foreach ( $includes as $group ) { |
| 59 |
foreach ( $group as $file ) { |
| 60 |
$this->easyelements_include_file( $file ); |
| 61 |
} |
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
public function easyelements_include_file( $file ) { |
| 66 |
|
| 67 |
$filepath = EASYELEMENTS_DIR_PATH . $file; |
| 68 |
if ( file_exists( $filepath ) ) { |
| 69 |
require_once $filepath; |
| 70 |
} |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
// Initialize |
| 75 |
Easy_Elements_Loader::instance(); |