-
Notifications
You must be signed in to change notification settings - Fork 2
/
autoloader.php
51 lines (44 loc) · 1.61 KB
/
autoloader.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
*
* Copyright (c) Ratepay GmbH
*
*For the full copyright and license information, please view the LICENSE
*file that was distributed with this source code.
*/
function ratepayAutoload($sClass)
{
startProfile("ratepayAutoload");
if (strpos($sClass, 'RatePAY') !== false) {
static $aClassPaths;
if (isset($aClassPaths[$sClass])) {
stopProfile("ratepayAutoload");
include $aClassPaths[$sClass];
return;
}
$sClass = strtolower($sClass);
$aModuleFiles = oxUtilsObject::getInstance()->getModuleVar('aModuleFiles');
if (is_array($aModuleFiles)) {
$sBasePath = getShopBasePath();
$oModulelist = oxNew('oxmodulelist');
$aActiveModuleInfo = $oModulelist->getActiveModuleInfo();
if (is_array($aActiveModuleInfo)) {
foreach ($aModuleFiles as $sModuleId => $aModules) {
if (isset($aModules[$sClass]) && isset($aActiveModuleInfo[$sModuleId])) {
$sPath = $aModules[$sClass];
$sFilename = $sBasePath . 'modules/' . $sPath;
if (file_exists($sFilename)) {
if (!isset($aClassPaths[$sClass])) {
$aClassPaths[$sClass] = $sFilename;
}
stopProfile("ratepayAutoload");
include $sFilename;
return;
}
}
}
}
}
}
stopProfile("ratepayAutoload");
}