mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-09-03 03:38:52 +00:00
Add PSR-0 comaptible autoloadrr for libs folder.
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
|
||||
require_once NN_CORE . 'autoloader.php';
|
||||
require_once NN_LIB . 'autoloader.php';
|
||||
require_once NN_LIBS . 'autoloader.php';
|
||||
|
||||
require_once NN_WWW . '/SPLClassLoader.php';
|
||||
|
||||
|
||||
@@ -1,4 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* PSR-0 compliant autoloader for libs
|
||||
*
|
||||
* @param string $class The fully-qualified class name.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
spl_autoload_register(
|
||||
function ($class) {
|
||||
// Only continue if the class is in our namespace.
|
||||
if (strpos($class, 'libs\\') === 0) {
|
||||
// Replace namespace separators with directory separators in the class name, append
|
||||
// with .php
|
||||
$file = NN_ROOT . str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';
|
||||
|
||||
// if the file exists, require it
|
||||
if (file_exists($file)) {
|
||||
require_once $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $class The fully-qualified class name.
|
||||
|
||||
Reference in New Issue
Block a user