// Initialize output system
ApplicationHelper::createDebugInstance('ApplicationHelper');
-// This application needs a database connection then we have to simply include
-// the framework/database.php script
-require($cfg->getConfigEntry('framework_base_path') . 'database.php');
+/*
+ * This application needs a database connection then we have to simply include
+ * the framework/database.php script
+ */
+require $cfg->getConfigEntry('framework_base_path') . 'database.php';
// Register core tests
ClassLoader::registerTestsPath('framework/main/tests');
<?php
// Import framework stuff
-use CoreFramework\Bootstrap\BootstrapFramework;
+use CoreFramework\Bootstrap\FrameworkBootstrap;
/**
* Start including this file to bootstrap into the framework
*/
// Load very basic classes, required to bootstrap
-require(__DIR__ . '/class_BootstrapFramework.php');
+require __DIR__ . '/class_FrameworkBootstrap.php';
// Bootstrap framework
-BootstrapFramework::doBootstrap();
+FrameworkBootstrap::doBootstrap();
+++ /dev/null
-<?php
-// Own namespace
-namespace CoreFramework\Bootstrap;
-
-// Import framework stuff
-use CoreFramework\EntryPoint\ApplicationEntryPoint;
-
-/**
- * A framework-bootstrap class which helps the frameworks to bootstrap ... ;-)
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2016 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-final class BootstrapFramework {
- /**
- * Private constructor, no instance is needed from this class as only
- * static methods exist.
- */
- private function __construct () {
- // Prevent making instances from this "utilities" class
- }
-
- /**
- * Does the actual bootstrap
- *
- * @return void
- */
- public static function doBootstrap () {
- // Load basic include files to continue bootstrapping
- require(ApplicationEntryPoint::detectFrameworkPath() . 'main/interfaces/class_FrameworkInterface.php');
- require(ApplicationEntryPoint::detectFrameworkPath() . 'main/interfaces/registry/class_Registerable.php');
- require(ApplicationEntryPoint::detectFrameworkPath() . 'config/class_FrameworkConfiguration.php');
-
- // Load main configuration
- require(ApplicationEntryPoint::detectFrameworkPath() . 'config.inc.php');
- }
-
-}
--- /dev/null
+<?php
+// Own namespace
+namespace CoreFramework\Bootstrap;
+
+// Import framework stuff
+use CoreFramework\EntryPoint\ApplicationEntryPoint;
+
+/**
+ * A framework-bootstrap class which helps the frameworks to bootstrap ... ;-)
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2016 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+final class FrameworkBootstrap {
+ /**
+ * Private constructor, no instance is needed from this class as only
+ * static methods exist.
+ */
+ private function __construct () {
+ // Prevent making instances from this "utilities" class
+ }
+
+ /**
+ * Does the actual bootstrap
+ *
+ * @return void
+ */
+ public static function doBootstrap () {
+ // Load basic include files to continue bootstrapping
+ require ApplicationEntryPoint::detectFrameworkPath() . 'main/interfaces/class_FrameworkInterface.php';
+ require ApplicationEntryPoint::detectFrameworkPath() . 'main/interfaces/registry/class_Registerable.php';
+ require ApplicationEntryPoint::detectFrameworkPath() . 'config/class_FrameworkConfiguration.php';
+
+ // Load main configuration
+ require ApplicationEntryPoint::detectFrameworkPath() . 'config.inc.php';
+ }
+
+ /**
+ * Checks all parameters, like $_GET, $_POST, $_COOKIE and also "emulated"
+ * from command-line. Accepted CLI parameters are in following forms:
+ *
+ * --foo=bar - parameter 'foo' gets value "bar" (string)
+ * --enable-foo=true - parameter 'enableFoo' gets value true (boolean)
+ * --baz=123 - parameter 'baz' get value 123 (interger)
+ *
+ * The same also works without 2 dashes as it was possible before:
+ *
+ * app=tests - launches application 'tests' (parameter 'app' gets string value "tests")
+ */
+ public static function checkParameters () {
+ }
+
+}
<?php
// Import framework stuff
use CoreFramework\Configuration\FrameworkConfiguration;
-use CoreFramework\Bootstrap\BootstrapFramework;
+use CoreFramework\Bootstrap\FrameworkBootstrap;
use CoreFramework\EntryPoint\ApplicationEntryPoint;
/**
$cfg = FrameworkConfiguration::getSelfInstance();
// CFG: ROOT-BASE-PATH
-$cfg->setConfigEntry('root_base_path', BootstrapFramework::detectRootPath() . '/');
+$cfg->setConfigEntry('root_base_path', ApplicationEntryPoint::getRootPath() . '/');
// CFG: CORE-BASE-PATH
$cfg->setConfigEntry('framework_base_path', ApplicationEntryPoint::detectFrameworkPath());
$cfg->setConfigEntry('compressor_base_path', 'main/classes/compressor/');
// CFG: APPLICATION-BASE-PATH
-$cfg->setConfigEntry('application_base_path', FrameworkBootstrap::detectApplicationBasePath());
+$cfg->setConfigEntry('application_base_path', $cfg->getConfigEntry('root_base_path') . 'application/');
// CFG: COMPILE-OUTPUT-PATH
$cfg->setConfigEntry('compile_output_path', 'templates/_compiled/');
// Load the database layer include
if (BaseFrameworkSystem::isReadableFile($fqfn)) {
// Load the layer
- require($fqfn);
+ require $fqfn;
} else {
// Layer is missing!
ApplicationEntryPoint::app_exit(sprintf('[Main:] Database layer is missing! (%s) -> R.I.P.',
*/
// Include the class loader function
-require(FrameworkConfiguration::getSelfInstance()->getConfigEntry('framework_base_path') . 'loader/class_ClassLoader.php');
+require FrameworkConfiguration::getSelfInstance()->getConfigEntry('framework_base_path') . 'loader/class_ClassLoader.php';
/*
* Shall we include additional configs where you can configure some things?
// Does the class cache exist?
if (BaseFrameworkSystem::isReadableFile($this->listCacheFQFN)) {
// Then include it
- require($this->classCacheFQFN);
+ require $this->classCacheFQFN;
// Mark the class cache as loaded
$this->classesCached = TRUE;
if ((isset($this->foundClasses[$fileName])) && (!isset($this->loadedClasses[$this->foundClasses[$fileName]]))) {
// File is found and not loaded so load it only once
//* NOISY-DEBUG: */ printf('[%s:%d] LOAD: %s - START' . PHP_EOL, __METHOD__, __LINE__, $fileName);
- require($this->foundClasses[$fileName]);
+ require $this->foundClasses[$fileName];
//* NOISY-DEBUG: */ printf('[%s:%d] LOAD: %s - END' . PHP_EOL, __METHOD__, __LINE__, $fileName);
// Count this loaded class/interface/exception
if (substr($fileName, 0, strlen($this->prefix)) == $this->prefix) {
// Then include it
//* NOISY-DEBUG: */ printf('[%s:%d] LOAD: %s - START' . PHP_EOL, __METHOD__, __LINE__, $fileName);
- require($fqfn);
+ require $fqfn;
//* NOISY-DEBUG: */ printf('[%s:%d] LOAD: %s - END' . PHP_EOL, __METHOD__, __LINE__, $fileName);
// Remove it from the list
if (BaseFrameworkSystem::isReadableFile($appFqFn)) {
// Load it
//* DEBUG: */ print basename(__FILE__)."[".__LINE__."]: Loading ".basename($appFqFn)." - START\n";
- require($appFqFn);
+ require $appFqFn;
//* DEBUG: */ print basename(__FILE__)."[".__LINE__."]: Loading ".basename($appFqFn)." - END\n";
} elseif (FrameworkConfiguration::getSelfInstance()->getConfigEntry('verbose_level') > 0) {
// File is missing
namespace CoreFramework\EntryPoint;
// Import framework stuff
+use CoreFramework\Bootstrap\FrameworkBootstrap;
use CoreFramework\Configuration\FrameworkConfiguration;
use CoreFramework\Factory\ObjectFactory;
use CoreFramework\Helper\Application\ApplicationHelper;
} // END - if
// Get some instances
- $tpl = FrameworkConfiguration::getSelfInstance()->getConfigEntry('html_template_class');
+ $tpl = $configInstance->getConfigEntry('html_template_class');
$languageInstance = LanguageSystem::getSelfInstance();
// Initialize template instance here to avoid warnings in IDE
// Get the template instance from our object factory
$templateInstance = ObjectFactory::createObjectByName($tpl);
} catch (FrameworkException $e) {
- exit(sprintf("[Main:] Could not initialize template engine for reason: <span class=\"exception_reason\">%s</span>",
+ exit(sprintf('[Main:] Could not initialize template engine for reason: <span class="exception_reason">%s</span>',
$e->getMessage()
));
}
} // END - if
// Add the traceback path to the final output
- $backtrace .= sprintf("<span class=\"backtrace_file\">%s</span>:%d, <span class=\"backtrace_function\">%s(%d)</span><br />\n",
+ $backtrace .= sprintf('<span class="backtrace_file">%s</span>:%d, <span class="backtrace_function">%s(%d)</span><br />' . PHP_EOL,
basename($trace['file']),
$trace['line'],
$trace['function'],
);
// Debug message
- /* NOISY-DEBUG: */ printf('[%s:%d]: fqfn=%s' . PHP_EOL, __METHOD__, __LINE__, $fqfn);
+ //* NOISY-DEBUG: */ printf('[%s:%d]: fqfn=%s' . PHP_EOL, __METHOD__, __LINE__, $fqfn);
// Is it readable?
if (is_readable($fqfn)) {
return self::$frameworkPath;
}
+ /**
+ * Getter for root path
+ *
+ * @return $rootPath Root path
+ */
+ public static function getRootPath () {
+ // Get __DIR__, really simple and no detection
+ return __DIR__;
+ }
+
/**
* The framework's main entry point. This class isolates some local
* variables which shall not become visible to outside because of security
*/
public static final function main () {
// Load bootstrap file
- require(self::detectFrameworkPath() . 'bootstrap/bootstrap.inc.php');
+ require self::detectFrameworkPath() . 'bootstrap/bootstrap.inc.php';
- // Get a new configuration instance
- $cfg = FrameworkConfiguration::getSelfInstance();
+ /*
+ * Initial bootstrap is done, continue with checking parameters and
+ * look for 'app'.
+ */
+ FrameworkBootstrap::checkParameters();
}
}
@chdir("..");
// Load config file
-require(dirname(dirname(__FILE__)) . '/framework/config.php');
+require dirname(dirname(__FILE__)) . '/framework/config.php';
// Load all include files
-require($cfg->getConfigEntry('framework_base_path') . 'includes.php');
+require $cfg->getConfigEntry('framework_base_path') . 'includes.php';
// Load all game classes
-require($cfg->getConfigEntry('framework_base_path') . 'classes.php');
+require $cfg->getConfigEntry('framework_base_path') . 'classes.php';
// Set default application
FrameworkConfiguration::getInstance()->setConfigEntry('default_application', 'shipsimu');
define('TEST_MODE', true);
// Load the PHPUnit framework
-require('PHPUnit/Framework.php');
+require 'PHPUnit/Framework.php';
print (basename(__FILE__).": Init completed.\n\n");
@chdir("..");
// Load config file
-require(dirname(dirname(__FILE__)) . '/framework/config.php');
+require dirname(dirname(__FILE__)) . '/framework/config.php';
// Load all include files
-require($cfg->getConfigEntry('framework_base_path') . 'includes.php');
+require $cfg->getConfigEntry('framework_base_path') . 'includes.php';
// Load all game classes
-require($cfg->getConfigEntry('framework_base_path') . 'classes.php');
+require $cfg->getConfigEntry('framework_base_path') . 'classes.php';
// Set default application
FrameworkConfiguration::getInstance()->setConfigEntry('default_application', 'shipsimu');
define('TEST_MODE', true);
// Load the PHPUnit framework
-require('PHPUnit/Framework.php');
+require 'PHPUnit/Framework.php';
print (basename(__FILE__).": Init completed.\n\n");
@chdir("..");
// Load config file
-require(dirname(dirname(__FILE__)) . '/framework/config.php');
+require dirname(dirname(__FILE__)) . '/framework/config.php';
// Load all include files
-require($cfg->getConfigEntry('framework_base_path') . 'includes.php');
+require $cfg->getConfigEntry('framework_base_path') . 'includes.php';
// Load all game classes
-require($cfg->getConfigEntry('framework_base_path') . 'classes.php');
+require $cfg->getConfigEntry('framework_base_path') . 'classes.php';
// Set default application
FrameworkConfiguration::getInstance()->setConfigEntry('default_application', 'shipsimu');
define('TEST_MODE', true);
// Load the PHPUnit framework
-require('PHPUnit/Framework.php');
+require 'PHPUnit/Framework.php';
print (basename(__FILE__).": Init completed.\n\n");
@chdir("..");
// Load config file
-require(dirname(dirname(__FILE__)) . '/framework/config.php');
+require dirname(dirname(__FILE__)) . '/framework/config.php';
// Load all include files
-require($cfg->getConfigEntry('framework_base_path') . 'includes.php');
+require $cfg->getConfigEntry('framework_base_path') . 'includes.php';
// Load all game classes
-require($cfg->getConfigEntry('framework_base_path') . 'classes.php');
+require $cfg->getConfigEntry('framework_base_path') . 'classes.php';
// Set default application
FrameworkConfiguration::getInstance()->setConfigEntry('default_application', 'shipsimu');
define('TEST_MODE', true);
// Load the PHPUnit framework
-require('PHPUnit/Framework.php');
+require 'PHPUnit/Framework.php';
print (basename(__FILE__).": Init completed.\n\n");
die("You need to remove this line (".__LINE__.") and implement this test!\n");
define('TEST_MODE', true);
// Load config file
-require(dirname(dirname(dirname(__FILE__))) . '/framework/config.php');
+require dirname(dirname(dirname(__FILE__))) . '/framework/config.php';
// Load all include files
-require($cfg->getConfigEntry('framework_base_path') . 'includes.php');
+require $cfg->getConfigEntry('framework_base_path') . 'includes.php';
// Load all game classes
-require($cfg->getConfigEntry('framework_base_path') . 'classes.php');
+require $cfg->getConfigEntry('framework_base_path') . 'classes.php';
// Load file I/O handler
-require($cfg->getConfigEntry('framework_base_path') . 'file_io.php');
+require $cfg->getConfigEntry('framework_base_path') . 'file_io.php';
// Load database layer
-require($cfg->getConfigEntry('framework_base_path') . 'database.php');
+require $cfg->getConfigEntry('framework_base_path') . 'database.php';
// Set default application
FrameworkConfiguration::getInstance()->setConfigEntry('default_application', 'shipsimu');
$application = 'shipsimu';
// Load more includes
-require($cfg->getConfigEntry('root_base_path') . 'application/shipsimu/loader.php');
+require $cfg->getConfigEntry('root_base_path') . 'application/shipsimu/loader.php';
// Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
// jetzt die Personalliste wiederherstellen
define('TEST_MODE', true);
// Load config file
-require(dirname(dirname(dirname(__FILE__))) . '/framework/config.php');
+require dirname(dirname(dirname(__FILE__))) . '/framework/config.php';
// Load all include files
-require($cfg->getConfigEntry('framework_base_path') . 'includes.php');
+require $cfg->getConfigEntry('framework_base_path') . 'includes.php';
// Load all game classes
-require($cfg->getConfigEntry('framework_base_path') . 'classes.php');
+require $cfg->getConfigEntry('framework_base_path') . 'classes.php';
// Load file I/O handler
-require($cfg->getConfigEntry('framework_base_path') . 'file_io.php');
+require $cfg->getConfigEntry('framework_base_path') . 'file_io.php';
// Load database layer
-require($cfg->getConfigEntry('framework_base_path') . 'database.php');
+require $cfg->getConfigEntry('framework_base_path') . 'database.php';
// Set default application
FrameworkConfiguration::getInstance()->setConfigEntry('default_application', 'shipsimu');
$application = 'shipsimu';
// Load more includes
-require($cfg->getConfigEntry('root_base_path') . 'application/shipsimu/loader.php');
+require $cfg->getConfigEntry('root_base_path') . 'application/shipsimu/loader.php';
// Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
// jetzt die Personalliste wiederherstellen
define('TEST_MODE', true);
// Load config file
-require(dirname(dirname(dirname(__FILE__))) . '/framework/config.php');
+require dirname(dirname(dirname(__FILE__))) . '/framework/config.php';
// Load all include files
-require($cfg->getConfigEntry('framework_base_path') . 'includes.php');
+require $cfg->getConfigEntry('framework_base_path') . 'includes.php';
// Load all game classes
-require($cfg->getConfigEntry('framework_base_path') . 'classes.php');
+require $cfg->getConfigEntry('framework_base_path') . 'classes.php';
// Load file I/O handler
-require($cfg->getConfigEntry('framework_base_path') . 'file_io.php');
+require $cfg->getConfigEntry('framework_base_path') . 'file_io.php';
// Load database layer
-require($cfg->getConfigEntry('framework_base_path') . 'database.php');
+require $cfg->getConfigEntry('framework_base_path') . 'database.php';
// Set default application
FrameworkConfiguration::getInstance()->setConfigEntry('default_application', 'shipsimu');
$application = 'shipsimu';
// Load more includes
-require($cfg->getConfigEntry('root_base_path') . 'application/shipsimu/loader.php');
+require $cfg->getConfigEntry('root_base_path') . 'application/shipsimu/loader.php';
// Wir tun hier so, als waere schon das Reederei-Objekt generiert und wir wollen
// jetzt die Personalliste wiederherstellen