-
Notifications
You must be signed in to change notification settings - Fork 0
/
autoloader.php
48 lines (37 loc) · 948 Bytes
/
autoloader.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
namespace ChefFormsGdpr;
class Autoloader
{
/**
* Load the initial static files:
*
* @return void
*/
public function load()
{
//register the custom field type:
Forms\Register::getInstance();
//register events and assets:
Front\Events::getInstance();
Front\Assets::getInstance();
//and the admin:
if (is_admin()) {
Admin\SettingsPage::getInstance();
}
}
/**
* Register the autoloader
*
* @return ChefFormsGdpr\Autoloader
*/
public function register()
{
spl_autoload_register(function ($class) {
if ( stripos( $class, __NAMESPACE__ ) === 0 ) {
$filePath = str_replace( '\\', DS, substr( $class, strlen( __NAMESPACE__ ) ) );
include( __DIR__ . DS . 'Classes' . $filePath . '.php' );
}
});
return $this;
}
}