--- /dev/null
+<?php
+/* autoload.class.php - DNS-CP
+ * Copyright (C) 2013 Jan Altensen (Stricted)
+ * http://stricted.de/
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class autoload {
+ /*
+ * constructor to set autoloader
+ */
+ public function __construct () {
+ spl_autoload_register(array('self', 'autoload'));
+ }
+
+ /*
+ * autoload class files from namespace uses
+ *
+ * @param string $className
+ */
+ public static function autoload ($className) {
+ $namespaces = explode('\\', $className);
+ if (count($namespaces) > 1) {
+ array_shift($namespaces);
+ $classPath = dirname(__FILE__) . '/' . implode('/', $namespaces) . '.class.php';
+ if (file_exists($classPath)) {
+ require_once($classPath);
+ }
+ }
+ }
+}
+new autoload();
+?>
\ No newline at end of file