]> git.mxchange.org Git - shipsimu.git/blobdiff - application/ship-simu/loader.php
(no commit message)
[shipsimu.git] / application / ship-simu / loader.php
diff --git a/application/ship-simu/loader.php b/application/ship-simu/loader.php
new file mode 100644 (file)
index 0000000..41dca7d
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+// The application's class loader
+if (!isset($application)) {
+       // We need this!
+       ApplicationEntryPoint::app_die("[Main:] Interne Variable <strong>application</strong> nicht gefunden!");
+}
+
+// Load all classes for the application
+foreach ($lowerClasses as $class) {
+       // Try to load the application classes
+       try {
+               ClassLoader::getInstance()->loadClasses(sprintf("%s/%s/%s", FrameworkConfiguration::getInstance()->readConfig("application_path"), $application, $class));
+       } catch (PathIsNoDirectoryException $e) {
+               ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad <strong>%s</strong> nicht laden. Grund: <strong>%s</strong>",
+                       $class,
+                       $e->getMessage()
+               ));
+       } catch (PathIsEmptyException $e) {
+               ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad <strong>%s</strong> nicht laden. Grund: <strong>%s</strong>",
+                       $class,
+                       $e->getMessage()
+               ));
+       } catch (PathReadProtectedException $e) {
+               ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad <strong>%s</strong> nicht laden. Grund: <strong>%s</strong>",
+                       $class,
+                       $e->getMessage()
+               ));
+       } catch (DirPointerNotOpenedException $e) {
+               ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad <strong>%s</strong> nicht laden. Grund: <strong>%s</strong>",
+                       $class,
+                       $e->getMessage()
+               ));
+       }
+}
+
+// Include all classes
+ClassLoader::getInstance()->includeAllClasses();
+
+// Clean up the global namespace
+unset($lowerClasses);
+unset($class);
+
+// [EOF]
+?>