Register autoloader functions as anonymous functions

Requires PHP 5.3
This commit is contained in:
Tobias Reich 2016-01-19 15:03:50 +01:00
parent 0a9b0d0078
commit 7bce954c8d

View File

@ -7,23 +7,20 @@
if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
function lycheeAutoloaderModules($class) {
spl_autoload_register(function($class) {
$file = LYCHEE . 'php/modules/' . $class . '.php';
if (file_exists($file)===true) require $file;
}
});
function lycheeAutoloaderAccess($class) {
spl_autoload_register(function($class) {
$file = LYCHEE . 'php/access/' . $class . '.php';
if (file_exists($file)===true) require $file;
}
spl_autoload_register('lycheeAutoloaderModules');
spl_autoload_register('lycheeAutoloaderAccess');
});
?>