summaryrefslogtreecommitdiffstats
path: root/lib/_autoload.php
diff options
context:
space:
mode:
authorOlav Morken <olav.morken@uninett.no>2013-11-15 09:34:07 +0000
committerOlav Morken <olav.morken@uninett.no>2013-11-15 09:34:07 +0000
commit6f61aef12c6b1b02e32da6d1c696bee6d5f1e4dc (patch)
treef1d6c78ab5e2eec5f8b8121f9e1a838c28997fa6 /lib/_autoload.php
parente9c98e008ed7dbb5d642aa4788edd2510c952ca1 (diff)
downloadsimplesamlphp-6f61aef12c6b1b02e32da6d1c696bee6d5f1e4dc.zip
simplesamlphp-6f61aef12c6b1b02e32da6d1c696bee6d5f1e4dc.tar.gz
simplesamlphp-6f61aef12c6b1b02e32da6d1c696bee6d5f1e4dc.tar.bz2
Start using SAML2 library from GitHub.
This patch also starts using Composer for other dependencies (i.e. php-openid and xmlseclibs). Thanks to Boy Baukema for implementing this! git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@3290 44740490-163a-0410-bde0-09ae8108e29a
Diffstat (limited to 'lib/_autoload.php')
-rw-r--r--lib/_autoload.php70
1 files changed, 11 insertions, 59 deletions
diff --git a/lib/_autoload.php b/lib/_autoload.php
index 8e0ec7c..ec99479 100644
--- a/lib/_autoload.php
+++ b/lib/_autoload.php
@@ -1,70 +1,22 @@
<?php
/**
- * This file implements a autoloader for simpleSAMLphp. This autoloader
- * will search for files under the simpleSAMLphp directory.
+ * This file is a backwards compatible autoloader for simpleSAMLphp.
+ * Loads the Composer autoloader.
*
* @author Olav Morken, UNINETT AS.
* @package simpleSAMLphp
* @version $Id$
*/
-
-/**
- * Autoload function for simpleSAMLphp.
- *
- * It will autoload all classes stored in the lib-directory.
- *
- * @param $className The name of the class.
- */
-function SimpleSAML_autoload($className) {
-
- $libDir = dirname(__FILE__) . '/';
-
- /* Special handling for xmlseclibs.php. */
- if(in_array($className, array('XMLSecurityKey', 'XMLSecurityDSig', 'XMLSecEnc'), TRUE)) {
- require_once($libDir . 'xmlseclibs.php');
- return;
- }
-
- /* 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);
- }
+// SSP is loaded as a separate project
+if (file_exists(dirname(dirname(__FILE__)) . '/vendor/autoload.php')) {
+ require_once dirname(dirname(__FILE__)) . '/vendor/autoload.php';
}
-
-/* Register autoload function for simpleSAMLphp. */
-if(function_exists('spl_autoload_register')) {
- /* Use the spl_autoload_register function if it is available. It should be available
- * for PHP versions >= 5.1.2.
- */
- spl_autoload_register('SimpleSAML_autoload');
-} else {
-
- /* spl_autoload_register is unavailable - let us hope that no one else uses the __autoload function. */
-
- /**
- * Autoload function for those who don't have spl_autoload_register.
- *
- * @param $className The name of the requested class.
- */
- function __autoload($className) {
- SimpleSAML_autoload($className);
- }
+// SSP is loaded as a library.
+else if (file_exists(dirname(dirname(__FILE__)) . '/../../autoload.php')) {
+ require_once dirname(dirname(__FILE__)) . '/../../autoload.php';
+}
+else {
+ throw new Exception('Unable to load Composer autoloader');
}
-
-?> \ No newline at end of file