PHP Classes

File: web/SSO/lib/_autoload_modules.php

Recommend this page to a friend!
  Classes of william amed   Raptor 2   web/SSO/lib/_autoload_modules.php   Download  
File: web/SSO/lib/_autoload_modules.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Raptor 2
Framework that takes routes from annotations
Author: By
Last change:
Date: 8 years ago
Size: 975 bytes
 

Contents

Class file image Download
<?php

/**
 * This file implements a autoloader for simpleSAMLphp modules.
 *
 * @author Boy Baukema, SURFnet
 * @package simpleSAMLphp
 */

/**
 * Autoload function for simpleSAMLphp modules.
 *
 * @param string $className Name of the class.
 */
function SimpleSAML_autoload($className)
{
   
$modulePrefixLength = strlen('sspmod_');
   
$classPrefix = substr($className, 0, $modulePrefixLength);
    if (
$classPrefix !== 'sspmod_') {
        return;
    }

   
$modNameEnd = strpos($className, '_', $modulePrefixLength);
   
$module = substr($className, $modulePrefixLength, $modNameEnd - $modulePrefixLength);
   
$moduleClass = substr($className, $modNameEnd + 1);

    if (!
SimpleSAML_Module::isModuleEnabled($module)) {
        return;
    }

   
$file = SimpleSAML_Module::getModuleDir($module) . '/lib/' . str_replace('_', '/', $moduleClass) . '.php';

    if (
file_exists($file)) {
        require_once(
$file);
    }
}

spl_autoload_register('SimpleSAML_autoload');