summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/_autoload.php39
-rw-r--r--www/_include.php4
2 files changed, 43 insertions, 0 deletions
diff --git a/lib/_autoload.php b/lib/_autoload.php
new file mode 100644
index 0000000..b05ee45
--- /dev/null
+++ b/lib/_autoload.php
@@ -0,0 +1,39 @@
+<?php
+
+/**
+ * This file implements a autoloader for simpleSAMLphp. This autoloader
+ * will search for files under the simpleSAMLphp directory.
+ *
+ * @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;
+ }
+
+ $file = $libDir . str_replace('_', '/', $className) . '.php';
+ if(file_exists($file)) {
+ require_once($file);
+ }
+}
+
+/* Register autload function for simpleSAMLphp. */
+spl_autoload_register('SimpleSAML_autoload');
+
+?> \ No newline at end of file
diff --git a/www/_include.php b/www/_include.php
index b804e3f..4fc9c69 100644
--- a/www/_include.php
+++ b/www/_include.php
@@ -18,6 +18,10 @@ if(get_magic_quotes_gpc()) {
}
}
+
+/* Initialize the autoloader. */
+require_once(dirname(dirname(__FILE__)) . '/lib/_autoload.php');
+
$path_extra = dirname(dirname(__FILE__)) . '/lib';