PluginProbe
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution with eCommerce Templates & Woo Widgets / 4.7.3
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution with eCommerce Templates & Woo Widgets v4.7.3
4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.0 2.5.1 3.0.0 3.1.0 3.1.1 4.0.0 4.0.1 4.1.0 4.1.1 4.2.0 4.2.1 4.3.0 All 85 releases
shopengine / trunk / autoloader.php

autoloader.php in ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution with eCommerce Templates & Woo Widgets 4.7.3, at trunk/autoloader.php

65 lines 944 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace ShopEngine;
4
5
6 defined('ABSPATH') || exit;
7
8 /**
9 * ShopEngine autoloader.
10 * Handles dynamically loading classes only when needed.
11 *
12 * @since 1.0.0
13 */
14 class Autoloader
15 {
16
17 /**
18 * Run autoloader.
19 * Register a function as `__autoload()` implementation.
20 *
21 * @since 1.0.0
22 * @access public
23 */
24 public static function run() {
25 spl_autoload_register([__CLASS__, 'autoload']);
26 }
27
28
29 /**
30 *
31 * @param $class_name
32 */
33 private static function autoload($class_name) {
34
35 if(0 !== strpos($class_name, __NAMESPACE__)) {
36 return;
37 }
38
39 $file_name = strtolower(
40 preg_replace(
41 ['/\b' . __NAMESPACE__ . '\\\/', '/([a-z])([A-Z])/', '/_/', '/\\\/'],
42 ['', '$1-$2', '-', DIRECTORY_SEPARATOR],
43 $class_name
44 )
45 );
46
47
48 $file = plugin_dir_path(__FILE__) . $file_name . '.php';
49
50 if(file_exists($file)) {
51
52 require_once($file);
53 }
54 }
55 }
56
57
58 /**
59 * Calling the autoloader to class files
60 *
61 */
62 Autoloader::run();
63
64
65