PluginProbe
The GDPR Framework By Data443 / trunk
The GDPR Framework By Data443 vtrunk
2.5.0 2.4.0 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.3 1.0.33 1.0.34 1.0.35 1.0.36 1.0.37 1.0.39 1.0.4 1.0.40 1.0.41 1.0.42 1.0.43 1.0.44 1.0.45 1.0.46 All 41 releases
gdpr-framework / autoload.php

autoload.php in The GDPR Framework By Data443 trunk, at autoload.php

27 lines 707 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit;
3 spl_autoload_register(function ($class) {
4 // namespace prefix
5 $prefix = 'Codelight\\GDPR\\';
6
7 // check if this is a class from our project
8 $len = strlen($prefix);
9 if (strncmp($prefix, $class, $len) !== 0) {
10 return; // nope, it isn't
11 }
12
13 // get the relative class name
14 // remove the namespace name
15 $className = substr($class, $len);
16
17 // base directory of classes
18 $baseDir = __DIR__ . '/src/';
19 // relative including
20 $file = $baseDir . str_replace('\\', DIRECTORY_SEPARATOR, $className) . '.php';
21
22 // if the file exists, require it
23
24 if (file_exists($file)) {
25 require_once($file);
26 }
27 });