Initial commit
This commit is contained in:
22
rss/php/autoload.php
Normal file
22
rss/php/autoload.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
spl_autoload_register(function (string $class): void {
|
||||
|
||||
$root = rtrim($_SERVER['DOCUMENT_ROOT'], '/');
|
||||
|
||||
// PSR-4-ish:
|
||||
$prefix = 'Vor\\';
|
||||
$baseDir = $root . '/rss/php/classes/';
|
||||
|
||||
if (strncmp($class, $prefix, strlen($prefix)) !== 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$relative = substr($class, strlen($prefix));
|
||||
$file = $baseDir . str_replace('\\', '/', $relative) . '.php';
|
||||
|
||||
if (is_file($file)) {
|
||||
require_once $file;
|
||||
}
|
||||
}, true, true);
|
||||
Reference in New Issue
Block a user