Initial import of current development status
[shipsimu.git] / ship-simu / application / ship-simu / loader.php
1 <?php
2 // The application's class loader
3 if (!isset($application)) {
4         // We need this!
5         ApplicationEntryPoint::app_die("[Main:] Interne Variable <strong>application</strong> nicht gefunden!");
6 }
7
8 // Load all classes for the application
9 foreach ($lowerClasses as $class) {
10         // Try to load the application classes
11         try {
12                 ClassLoader::getInstance()->loadClasses(sprintf("%s/%s/%s", FrameworkConfiguration::getInstance()->readConfig("application_path"), $application, $class));
13         } catch (PathIsNoDirectoryException $e) {
14                 ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad <strong>%s</strong> nicht laden. Grund: <strong>%s</strong>",
15                         $class,
16                         $e->getMessage()
17                 ));
18         } catch (PathIsEmptyException $e) {
19                 ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad <strong>%s</strong> nicht laden. Grund: <strong>%s</strong>",
20                         $class,
21                         $e->getMessage()
22                 ));
23         } catch (PathReadProtectedException $e) {
24                 ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad <strong>%s</strong> nicht laden. Grund: <strong>%s</strong>",
25                         $class,
26                         $e->getMessage()
27                 ));
28         } catch (DirPointerNotOpenedException $e) {
29                 ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Applikationsklassen im Pfad <strong>%s</strong> nicht laden. Grund: <strong>%s</strong>",
30                         $class,
31                         $e->getMessage()
32                 ));
33         }
34 }
35
36 // Include all classes
37 ClassLoader::getInstance()->includeAllClasses();
38
39 // Clean up the global namespace
40 unset($lowerClasses);
41 unset($class);
42
43 // [EOF]
44 ?>