essential-addons-for-elementor-lite
Last commit date
assets
1 week ago
includes
1 week ago
languages
1 week ago
vendor
3 weeks ago
autoload.php
1 month ago
config.php
1 month ago
essential_adons_elementor.php
1 week ago
index.php
3 years ago
readme.txt
1 week ago
wpml-config.xml
1 month ago
autoload.php
33 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | exit; |
| 5 | } // Exit if accessed directly |
| 6 | |
| 7 | spl_autoload_register(function ($class) { |
| 8 | // project-specific namespace prefix |
| 9 | $prefix = 'Essential_Addons_Elementor\\'; |
| 10 | |
| 11 | // base directory for the namespace prefix |
| 12 | $base_dir = EAEL_PLUGIN_PATH . '/includes/'; |
| 13 | |
| 14 | // does the class use the namespace prefix? |
| 15 | $len = strlen($prefix); |
| 16 | if (strncmp($prefix, $class, $len) !== 0) { |
| 17 | // no, move to the next registered autoloader |
| 18 | return; |
| 19 | } |
| 20 | |
| 21 | // get the relative class name |
| 22 | $relative_class = substr($class, $len); |
| 23 | |
| 24 | // replace the namespace prefix with the base directory, replace namespace |
| 25 | // separators with directory separators in the relative class name, append |
| 26 | // with .php |
| 27 | $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; |
| 28 | |
| 29 | // if the file exists, require it |
| 30 | if (file_exists($file)) { |
| 31 | require $file; |
| 32 | } |
| 33 | }); |