mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-08-02 13:15:53 -04:00
Require files using __DIR__ instead of SERVER_ROOT
Use `new Class` instead of `NEW Class`
Class FEED => Feed
Class VALIDATE => Validate
29 lines
820 B
PHP
29 lines
820 B
PHP
<?php
|
|
|
|
/**
|
|
* Load classes automatically when they're needed
|
|
*
|
|
* @param string $ClassName class name
|
|
*/
|
|
spl_autoload_register(function ($ClassName) {
|
|
$FilePath = __DIR__ . '/' . strtolower($ClassName) . '.class.php';
|
|
if (!file_exists($FilePath)) {
|
|
// TODO: Rename the following classes to conform with the code guidelines
|
|
switch ($ClassName) {
|
|
case 'DB_MYSQL':
|
|
$FileName = 'mysql.class';
|
|
break;
|
|
case 'BENCODE_DICT':
|
|
case 'BENCODE_LIST':
|
|
$FileName = 'torrent.class';
|
|
break;
|
|
default:
|
|
die("Couldn't import class $ClassName");
|
|
}
|
|
$FilePath = __DIR__ . "/$FileName.php";
|
|
}
|
|
require_once($FilePath);
|
|
});
|
|
|
|
require(__DIR__.'/../vendor/autoload.php');
|