diff options
Diffstat (limited to 'lib/_autoload.php')
-rw-r--r-- | lib/_autoload.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/_autoload.php b/lib/_autoload.php index 8ae891b..8e0ec7c 100644 --- a/lib/_autoload.php +++ b/lib/_autoload.php @@ -27,7 +27,21 @@ function SimpleSAML_autoload($className) { return; } - $file = $libDir . str_replace('_', '/', $className) . '.php'; + /* Handlig of modules. */ + if(substr($className, 0, 7) === 'sspmod_') { + $modNameEnd = strpos($className, '_', 7); + $module = substr($className, 7, $modNameEnd - 7); + $moduleClass = substr($className, $modNameEnd + 1); + + if(!SimpleSAML_Module::isModuleEnabled($module)) { + return; + } + + $file = SimpleSAML_Module::getModuleDir($module) . '/lib/' . str_replace('_', '/', $moduleClass) . '.php'; + } else { + $file = $libDir . str_replace('_', '/', $className) . '.php'; + } + if(file_exists($file)) { require_once($file); } |