2 // Import framework stuff
3 use CoreFramework\Configuration\FrameworkConfiguration;
4 use CoreFramework\Object\BaseFrameworkSystem;
7 * The application selector main include file
9 * @author Roland Haeder <webmaster@shipsimu.org>
11 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
12 * @license GNU GPL 3.0 or any newer version
13 * @link http://www.shipsimu.org
15 * @todo Minimize these includes
17 * This program is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31 // Try to load these includes in the given order
32 $configAppIncludes = array(
33 'class_ApplicationHelper', // The ApplicationHelper class
34 'debug', // Some debugging stuff
35 'exceptions', // The application's own exception handler
36 'config', // The application's own configuration
37 'config-local', // Local configuration file (optional)
38 'data', // Application data
39 'init', // The application initializer
40 'starter', // The application starter (calls entryPoint(), etc.)
43 // Cache base path/file here
44 $basePathFile = FrameworkConfiguration::getSelfInstance()->getConfigEntry('application_path') . FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_name');
46 // Is the directory there?
47 if (!is_dir($basePathFile)) {
49 trigger_error('Application ' . FrameworkConfiguration::getSelfInstance()->getConfigEntry('app_name') . ' not found.');
53 // Load them all (try only)
54 foreach ($configAppIncludes as $appInc) {
55 // Skip starter in test mode
56 if (($appInc == 'starter') && (defined('TEST'))) {
61 // Generate a FQFN for the helper class
62 $appFqFn = $basePathFile . '/' . $appInc . '.php';
64 // Does the include file exists?
65 if (BaseFrameworkSystem::isReadableFile($appFqFn)) {
67 //* DEBUG: */ print basename(__FILE__)."[".__LINE__."]: Loading ".basename($appFqFn)." - START\n";
69 //* DEBUG: */ print basename(__FILE__)."[".__LINE__."]: Loading ".basename($appFqFn)." - END\n";
70 } elseif (FrameworkConfiguration::getSelfInstance()->getConfigEntry('verbose_level') > 0) {
72 trigger_error(sprintf('Cannot load application script %s.php! File is missing or read-protected.',
79 // Remove variables from namespace, which we don't need
81 unset($configAppIncludes);
85 // Scan for application's classes, exceptions and interfaces
86 ClassLoader::scanApplicationClasses();