-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_autoloader.php
More file actions
28 lines (25 loc) · 776 Bytes
/
_autoloader.php
File metadata and controls
28 lines (25 loc) · 776 Bytes
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
<?php
define("DS", DIRECTORY_SEPARATOR);
define("LOCAL_PATH", "");
define("ROOT", dirname(__DIR__) . DS . LOCAL_PATH);
define("LOCAL", 1);
spl_autoload_register(function($sClassPath)
{
$sClassPath = str_replace('\\', '/', $sClassPath);
if(file_exists(ROOT . DS . $sClassPath . '.php'))
{
require_once ROOT . DS . $sClassPath . '.php';
}
else if(file_exists(ROOT . DS . 'classes'. DS . $sClassPath . '.php'))
{
require_once ROOT . DS . 'classes' . DS . $sClassPath . '.php';
}
else if(file_exists(ROOT . DS . 'assets'. DS . $sClassPath . '.php'))
{
require_once ROOT . DS . 'assets' . DS . $sClassPath . '.php';
}
else
{
throw new Exception("Couldn't find the class " . $sClassPath);
}
});