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