moved parts of libs loading into AutoLoader

This commit is contained in:
Steffen Schröder 2014-08-08 14:38:45 +02:00
parent a52f6894c0
commit 96d3f1eaba
2 changed files with 14 additions and 9 deletions

View File

@ -27,17 +27,24 @@ abstract class AutoLoader {
$classPath = str_replace('\\', DIRECTORY_SEPARATOR, $className);
// Core file
$classDirectoryPath = preg_replace('/ManiaControl/', 'core', $classPath, 1);
$filePath = ManiaControlDir . $classDirectoryPath . '.php';
if (file_exists($filePath)) {
require_once $filePath;
$coreClassPath = preg_replace('/ManiaControl/', 'core', $classPath, 1);
$coreFilePath = ManiaControlDir . $coreClassPath . '.php';
if (file_exists($coreFilePath)) {
include_once $coreFilePath;
return;
}
// Plugin file
$filePath = ManiaControlDir . 'plugins' . DIRECTORY_SEPARATOR . $classPath . '.php';
if (file_exists($filePath)) {
include_once $filePath;
$pluginFilePath = ManiaControlDir . 'plugins' . DIRECTORY_SEPARATOR . $classPath . '.php';
if (file_exists($pluginFilePath)) {
include_once $pluginFilePath;
return;
}
// Lib file
$libFilePath = ManiaControlDir . 'libs' . DIRECTORY_SEPARATOR . $classPath . '.php';
if (file_exists($libFilePath)) {
include_once $libFilePath;
return;
}
}

View File

@ -31,8 +31,6 @@ use Maniaplanet\DedicatedServer\Connection;
use Maniaplanet\DedicatedServer\Xmlrpc\AuthenticationException;
use Maniaplanet\DedicatedServer\Xmlrpc\TransportException;
require_once ManiaControlDir . '/libs/Maniaplanet/DedicatedServer/Connection.php';
require_once ManiaControlDir . '/libs/FML/autoload.php';
require_once ManiaControlDir . '/libs/Symfony/autoload.php';
require_once ManiaControlDir . '/libs/curl-easy/autoload.php';