Files
nl-admin-api/system/loader.php

35 lines
781 B
PHP
Raw Normal View History

2011-06-08 23:45:08 -05:00
<?php
/**
* This function is registered on the auto-loader stack by the front controller.
2011-07-10 23:45:38 -05:00
*
* All namespace slashes will be replaced with directory slashes since all Laravel
* system classes are organized using a namespace to directory convention.
2011-06-08 23:45:08 -05:00
*/
return function($class) {
$file = strtolower(str_replace('\\', '/', $class));
2011-06-08 23:45:08 -05:00
if (array_key_exists($class, $aliases = System\Config::get('aliases')))
2011-06-08 23:45:08 -05:00
{
return class_alias($aliases[$class], $class);
}
if (file_exists($path = BASE_PATH.$file.EXT))
{
require $path;
}
elseif (file_exists($path = APP_PATH.'models/'.$file.EXT))
{
require $path;
}
elseif (file_exists($path = APP_PATH.'libraries/'.$file.EXT))
2011-06-08 23:45:08 -05:00
{
require $path;
}
elseif (file_exists($path = APP_PATH.$file.EXT))
{
require $path;
}
};