23 if (strstr($class,
'XMLSec')) {
24 if (class_exists(
'\\RobRichards\\XMLSecLibs\\'.$class,
true)) {
25 class_alias(
'\\RobRichards\\XMLSecLibs\\'.$class, $class);
30 if (!strstr($class,
'SimpleSAML_')) {
37 'SimpleSAML_Metadata_MetaDataStorageHandlerMDX' =>
'SimpleSAML_Metadata_Sources_MDQ',
38 'SimpleSAML_Logger_LoggingHandlerSyslog' =>
'SimpleSAML_Logger_SyslogLoggingHandler',
39 'SimpleSAML_Logger_LoggingHandlerErrorLog' =>
'SimpleSAML_Logger_ErrorLogLoggingHandler',
40 'SimpleSAML_Logger_LoggingHandlerFile' =>
'SimpleSAML_Logger_FileLoggingHandler',
41 'SimpleSAML_Logger_LoggingHandler' =>
'SimpleSAML_Logger_LoggingHandlerInterface',
42 'SimpleSAML_IdP_LogoutHandler' =>
'SimpleSAML_IdP_LogoutHandlerInterface',
43 'SimpleSAML_IdP_LogoutIFrame' =>
'SimpleSAML_IdP_IFrameLogoutHandler',
44 'SimpleSAML_IdP_LogoutTraditional' =>
'SimpleSAML_IdP_TraditionalLogoutHandler',
46 if (array_key_exists($class, $renamed)) {
48 $class = $renamed[$class];
52 $path = explode(
'_', $class);
53 $file = dirname(__FILE__).DIRECTORY_SEPARATOR.join(DIRECTORY_SEPARATOR,
$path).
'.php';
54 if (file_exists($file)) {
59 if (class_exists($class,
false) || interface_exists($class,
false)) {
64 $new = join(
'\\',
$path);
65 if (class_exists($new,
false) || interface_exists($new,
false)) {
67 class_alias($new, $original);
84 $modulePrefixLength = strlen(
'sspmod_');
85 $classPrefix = substr($className, 0, $modulePrefixLength);
86 if ($classPrefix !==
'sspmod_') {
90 $modNameEnd = strpos($className,
'_', $modulePrefixLength);
91 $module = substr($className, $modulePrefixLength, $modNameEnd - $modulePrefixLength);
92 $path = explode(
'_', substr($className, $modNameEnd + 1));
99 if (!file_exists($file)) {
104 if (!class_exists($className,
false) && !interface_exists($className,
false)) {
106 $nspath = join(
'\\',
$path);
107 if (class_exists(
'SimpleSAML\Module\\'.
$module.
'\\'.$nspath) ||
108 interface_exists(
'SimpleSAML\Module\\'.
$module.
'\\'.$nspath)
112 "The class or interface '$className' is now using namespaces, please use 'SimpleSAML\\Module\\".
113 $module.
"\\".$nspath.
"' instead." 115 class_alias(
"SimpleSAML\\Module\\$module\\$nspath", $className);
128 $elements = explode(
'\\', $className);
129 if ($elements[0] ===
'') {
130 array_shift($elements);
132 if (count($elements) < 4) {
135 if (array_shift($elements) !==
'SimpleSAML') {
138 if (array_shift($elements) !==
'Module') {
143 $module = array_shift($elements);
150 if (file_exists($file)) {
155 spl_autoload_register(
"temporaryLoader");
156 spl_autoload_register(
'sspmodAutoloadPSR0');
157 spl_autoload_register(
'sspmodAutoloadPSR4');
temporaryLoader($class)
This temporary autoloader allows loading classes with their old-style names (SimpleSAML_Path_Somethin...
static getModuleDir($module)
Retrieve the base directory for a module.
if($modEnd===false) $module
Attribute-related utility methods.
sspmodAutoloadPSR4($className)
Autoload function for SimpleSAMLphp modules following PSR-4.
sspmodAutoloadPSR0($className)
Autoload function for SimpleSAMLphp modules following PSR-0.