From abf16d32ec958056081447ee783d6d70005838f9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 5 May 2008 23:26:53 +0000 Subject: [PATCH] Missing fixes applied --- application/hub/class_ApplicationHelper.php | 13 +- .../hub/main/class_HubCommandProcessor.php | 2 +- application/hub/main/class_HubConnector.php | 2 +- application/hub/main/class_HubCoreLoop.php | 2 +- application/hub/main/class_HubPeer.php | 2 +- inc/classes.php | 10 +- .../main/class_GetterNotFoundException.php | 11 +- .../main/class_InvalidObjectException.php | 8 +- .../class_ViewHelperNotFoundException.php | 9 +- .../class_ManageableApplication.php | 13 +- .../main/class_BaseFrameworkSystem.php | 209 +++++++-------- .../main/class_FrameworkArrayObject.php | 16 +- .../main/compressor/class_Bzip2Compressor.php | 32 +-- .../main/compressor/class_GzipCompressor.php | 40 +-- .../main/compressor/class_NullCompressor.php | 32 +-- .../main/console/class_ConsoleTools.php | 14 +- .../database/class_BaseDatabaseFrontend.php | 44 +--- .../classes/class_LocalFileDatabase.php | 45 ++-- .../main/debug/class_DebugConsoleOutput.php | 14 +- .../main/debug/class_DebugErrorLogOutput.php | 14 +- .../main/debug/class_DebugWebOutput.php | 14 +- .../main/extended/class_ObjectLimits.php | 14 +- .../extended/class_SerializationContainer.php | 15 +- inc/classes/main/io/class_FileIOStream.php | 14 +- .../io/class_FrameworkDirectoryPointer.php | 14 +- .../io/class_FrameworkFileInputPointer.php | 14 +- .../io/class_FrameworkFileOutputPointer.php | 14 +- .../main/language/class_LanguageSystem.php | 14 +- .../main/output/class_ConsoleOutput.php | 14 +- inc/classes/main/output/class_WebOutput.php | 14 +- .../main/template/class_TemplateEngine.php | 243 +++++++++++++----- .../middleware/class_BaseMiddleware.php | 22 +- .../compressor/class_CompressorChannel.php | 12 +- .../database/class_DatabaseConnection.php | 14 +- .../debug/class_DebugMiddleware.php | 16 +- .../middleware/io/class_FileIOHandler.php | 14 +- inc/config.php | 9 +- inc/config/class_FrameworkConfiguration.php | 10 +- inc/config/config-override.php | 2 +- inc/database.php | 20 +- inc/language.php | 12 +- inc/loader/class_ClassLoader.php | 10 +- inc/output.php | 10 +- inc/selector.php | 12 +- tests/ConfigTest.php | 19 ++ 45 files changed, 559 insertions(+), 539 deletions(-) diff --git a/application/hub/class_ApplicationHelper.php b/application/hub/class_ApplicationHelper.php index 60409b70c..696aee8fe 100644 --- a/application/hub/class_ApplicationHelper.php +++ b/application/hub/class_ApplicationHelper.php @@ -64,12 +64,12 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica * * @return void */ - private function __construct () { + protected function __construct () { // Call parent constructor parent::constructor(__CLASS__); // Set description - $this->setPartDescr("Application-Helper"); + $this->setObjectDescription("Application-Helper"); // Create an unique ID $this->createUniqueID(); @@ -176,6 +176,15 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica // Shutdown the hub $hubInstance->shutdownHub(); } + + /** + * Getter for master template name + * + * @return $masterTemplate Name of the master template + */ + public final function getMasterTemplate () { + return "hub_main"; + } } // [EOF] diff --git a/application/hub/main/class_HubCommandProcessor.php b/application/hub/main/class_HubCommandProcessor.php index c325928eb..7de18ec0f 100644 --- a/application/hub/main/class_HubCommandProcessor.php +++ b/application/hub/main/class_HubCommandProcessor.php @@ -49,7 +49,7 @@ class HubCommandProcessor extends BaseFrameworkSystem { parent::constructor(__CLASS__); // Set description - $this->setPartDescr("Hub-Command-Processor"); + $this->setObjectDescription("Hub-Command-Processor"); // Set unique ID $this->createUniqueID(); diff --git a/application/hub/main/class_HubConnector.php b/application/hub/main/class_HubConnector.php index 2b775c031..de87246bc 100644 --- a/application/hub/main/class_HubConnector.php +++ b/application/hub/main/class_HubConnector.php @@ -41,7 +41,7 @@ class HubConnector extends BaseFrameworkSystem { parent::constructor(__CLASS__); // Set description - $this->setPartDescr("Hub-Connector"); + $this->setObjectDescription("Hub-Connector"); // Set unique ID $this->createUniqueID(); diff --git a/application/hub/main/class_HubCoreLoop.php b/application/hub/main/class_HubCoreLoop.php index 5304fbea9..6e85a6d90 100644 --- a/application/hub/main/class_HubCoreLoop.php +++ b/application/hub/main/class_HubCoreLoop.php @@ -108,7 +108,7 @@ class HubCoreLoop extends BaseFrameworkSystem { parent::constructor(__CLASS__); // Set description - $this->setPartDescr("Hub-Core Loop"); + $this->setObjectDescription("Hub-Core Loop"); // Set unique ID $this->createUniqueID(); diff --git a/application/hub/main/class_HubPeer.php b/application/hub/main/class_HubPeer.php index 4772a956a..59e23ecb6 100644 --- a/application/hub/main/class_HubPeer.php +++ b/application/hub/main/class_HubPeer.php @@ -137,7 +137,7 @@ class HubPeer extends BaseFrameworkSystem { parent::constructor(__CLASS__); // Set description - $this->setPartDescr("Hub-Peer"); + $this->setObjectDescription("Hub-Peer"); // Set unique ID $this->createUniqueID(); diff --git a/inc/classes.php b/inc/classes.php index 64e2bedc5..27034212b 100644 --- a/inc/classes.php +++ b/inc/classes.php @@ -18,7 +18,7 @@ * 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 . + * along with this program. If not, see . */ // Lower framework classes @@ -35,19 +35,19 @@ foreach ($lowerClasses as $class) { try { ClassLoader::getInstance()->loadClasses(sprintf("inc/classes/%s/", $class)); } catch (PathIsNoDirectoryException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad %s nicht laden. Reason: %s", + ApplicationEntryPoint::app_die(sprintf("[Main:] Could not load framework classes from path %s for the follwing reason: %s", $class )); } catch (PathIsEmptyException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad %s nicht laden. Reason: %s", + ApplicationEntryPoint::app_die(sprintf("[Main:] Could not load framework classes from path %s for the follwing reason: %s", $class )); } catch (PathReadProtectedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad %s nicht laden. Reason: %s", + ApplicationEntryPoint::app_die(sprintf("[Main:] Could not load framework classes from path %s for the follwing reason: %s", $class )); } catch (DirPointerNotOpenedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad %s nicht laden. Reason: %s", + ApplicationEntryPoint::app_die(sprintf("[Main:] Could not load framework classes from path %s for the follwing reason: %s", $class )); } diff --git a/inc/classes/exceptions/main/class_GetterNotFoundException.php b/inc/classes/exceptions/main/class_GetterNotFoundException.php index 64a402b2a..b03b21c8a 100644 --- a/inc/classes/exceptions/main/class_GetterNotFoundException.php +++ b/inc/classes/exceptions/main/class_GetterNotFoundException.php @@ -3,10 +3,10 @@ * An exception thrown when a getter for an attribute was not found * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,7 +19,7 @@ * 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 . + * along with this program. If not, see . */ class GetterNotFoundException extends FrameworkException { /** @@ -29,10 +29,7 @@ class GetterNotFoundException extends FrameworkException { * @param $code Code number for the exception * @return void */ - public function __construct ($dataArray, $code) { - // Cast the array - $dataArray = (array) $dataArray; - + public function __construct (array $dataArray, $code) { // Add a message around the missing class $message = sprintf("[%s:%d] Getter-Methode für Attribut %s nicht gefunden.", $dataArray[0]->__toString(), diff --git a/inc/classes/exceptions/main/class_InvalidObjectException.php b/inc/classes/exceptions/main/class_InvalidObjectException.php index 9dca3438d..cc19b7535 100644 --- a/inc/classes/exceptions/main/class_InvalidObjectException.php +++ b/inc/classes/exceptions/main/class_InvalidObjectException.php @@ -3,10 +3,10 @@ * An exception thrown when an instance variable instances a non-object * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,7 +19,7 @@ * 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 . + * along with this program. If not, see . */ class InvalidObjectException extends FrameworkException { /** @@ -34,7 +34,7 @@ class InvalidObjectException extends FrameworkException { $message = sprintf("[%s:%d] Objekte sind nicht erlaubt. (Objekt: %s)", $class->__toString(), $this->getLine(), - $class->getPartDescr() + $class->getObjectDescription() ); // Call parent constructor diff --git a/inc/classes/exceptions/template/class_ViewHelperNotFoundException.php b/inc/classes/exceptions/template/class_ViewHelperNotFoundException.php index 78cb6735e..6cd771a13 100644 --- a/inc/classes/exceptions/template/class_ViewHelperNotFoundException.php +++ b/inc/classes/exceptions/template/class_ViewHelperNotFoundException.php @@ -3,10 +3,10 @@ * An exception thrown when a given view helper was not found * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,7 +19,7 @@ * 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 . + * along with this program. If not, see . */ class ViewHelperNotFoundException extends FrameworkException { /** @@ -31,8 +31,9 @@ class ViewHelperNotFoundException extends FrameworkException { */ public function __construct (array $msgArray, $code) { // Add a message around the missing class - $message = sprintf("[%s:] View-Helper %s ist ungültig.", + $message = sprintf("[%s:%d] View-Helper %s ist ungültig.", $msgArray[0]->__toString(), + $this->getLine(), $msgArray[1] ); diff --git a/inc/classes/interfaces/application/class_ManageableApplication.php b/inc/classes/interfaces/application/class_ManageableApplication.php index f342a0a7c..5bb3dac1b 100644 --- a/inc/classes/interfaces/application/class_ManageableApplication.php +++ b/inc/classes/interfaces/application/class_ManageableApplication.php @@ -8,10 +8,10 @@ * - And many more... * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -24,7 +24,7 @@ * 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 . + * along with this program. If not, see . */ interface ManageableApplication extends FrameworkInterface { /** @@ -71,6 +71,13 @@ interface ManageableApplication extends FrameworkInterface { */ function setAppShortName ($shortName); + /** + * Getter for master template name + * + * @return $masterTemplate Name of the master template + */ + function getMasterTemplate (); + /** * Launches the application * diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index 8ac8d31fb..4abdf2995 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -4,10 +4,10 @@ * class handles saving of games etc. * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -20,7 +20,7 @@ * 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 . + * along with this program. If not, see . */ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { /** @@ -53,6 +53,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ private $dbInstance = null; + /** + * Instance to an application helper class + */ + private $applicationInstance = null; + /** * The real class name */ @@ -61,7 +66,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { /** * A human-readable description for this simulator part */ - private $partDescr = "Namenlose Framework-Einheit"; + private $objectDescription = "Namenlose Framework-Einheit"; /** * The unique ID string for identifying all type of classes @@ -139,6 +144,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { const EXCEPTION_TEMPLATE_ENGINE_UNSUPPORTED = 0x02d; const EXCEPTION_MISSING_LANGUAGE_HANDLER = 0x02e; const EXCEPTION_MISSING_FILE_IO_HANDLER = 0x02f; + const EXCEPTION_MISSING_ELEMENT = 0x030; + const EXCEPTION_INVALID_COMMAND = 0x031; + const EXCEPTION_INVALID_CONTROLLER = 0x032; + const EXCEPTION_HEADERS_ALREADY_SENT = 0x033; + const EXCEPTION_DEFAUL_CONTROLLER_GONE = 0x034; /** * In the super constructor these system classes shall be ignored or else @@ -149,16 +159,16 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { *--------------------------------------------------------------------* */ private $systemClasses = array( - "DebugMiddleware", // Debug middleware output sub-system - "DebugWebOutput", // Debug web output sub-system - "DebugConsoleOutput", // Debug console output sub-system - "DebugErrorLogOutput", // Debug error_log() output sub-system - "CompressorChannel", // Compressor sub-system + "DebugMiddleware", // Debug middleware output sub-system + "DebugWebOutput", // Debug web output sub-system + "DebugConsoleOutput", // Debug console output sub-system + "DebugErrorLogOutput", // Debug error_log() output sub-system + "CompressorChannel", // Compressor sub-system "FrameworkDirectoryPointer", // Directory handler sub-system - "NullCompressor", // Null compressor - "Bzip2Compressor", // BZIP2 compressor - "GzipCompressor", // GZIP compressor - "WebOutput", // Web output sub-system + "NullCompressor", // Null compressor + "Bzip2Compressor", // BZIP2 compressor + "GzipCompressor", // GZIP compressor + "WebOutput", // Web output sub-system ); /** @@ -166,9 +176,12 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * * @return void */ - private function __construct ($class) { + protected function __construct ($class) { // Set real class $this->setRealClass($class); + + // Init this instance + $this->initInstance($class); } /** @@ -187,7 +200,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { } // Destroy all informations about this class but keep some text about it alive - $this->setPartDescr(sprintf("Entferntes Objekt %s", $this->__toString())); + $this->setObjectDescription(sprintf("Entferntes Objekt %s", $this->__toString())); $this->setRealClass("DestructedObject"); $this->resetUniqueID(); } elseif ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) { @@ -219,14 +232,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { } /** - * Public constructor (for initializing things, etc.) + * Initializes the instance * * @return void */ - public function constructor ($class) { - // Call constructor - $this->__construct($class); - + public function initInstance ($class) { // Get the current (singleton) configuration instance $this->setConfigInstance(FrameworkConfiguration::createFrameworkConfiguration()); @@ -248,7 +258,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { ); // Debug message - if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung:
%s

\n", + if (defined('DEBUG_EVAL')) $this->getDebugInstance()->output(sprintf("[%s:] Constructed PHP command:
%s

\n", $this->__toString(), htmlentities($eval) )); @@ -275,27 +285,18 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $this->setDatabaseInstance($db); } } - - // Debug output - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Alle Sub-Systeme sind initialisiert.
\n", - $this->__toString() - )); } } /** * Setter for language instance * - * @param $configInstance The configuration instance which shall + * @param $configInstance The configuration instance which shall * be FrameworkConfiguration * @return void */ public final function setConfigInstance (FrameworkConfiguration $configInstance) { - $this->cfgInstance = $configInstance; - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Konfigurations-Handler auf %s gesetzt.
\n", - $this->__toString(), - $configInstance->__toString() - )); + self::$cfgInstance = $configInstance; } /** @@ -304,11 +305,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $cfhInstance - Configuration instance */ public final function getConfigInstance () { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Konfigurations-Handler %s angefordert.
\n", - $this->__toString(), - $this->cfgInstance->__toString() - )); - return $this->cfgInstance; + return self::$cfgInstance; } /** @@ -319,10 +316,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ public final function setDebugInstance (DebugMiddleware $debugInstance) { self::$debug = $debugInstance; - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Debug-Handler auf %s gesetzt.
\n", - $this->__toString(), - $this->getDebugInstance()->__toString() - )); } /** @@ -342,10 +335,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ public final function setWebOutputInstance (OutputStreamer $webInstance) { self::$webOutput = $webInstance; - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Web-Handler auf %s gesetzt.
\n", - $this->__toString(), - $this->getWebOutputInstance()->__toString() - )); } /** @@ -365,9 +354,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return void */ public final function setDatabaseInstance (DatabaseConnection $dbInstance) { - if ((defined('DEBUG_SYSTEM')) && (is_object($dbInstance->getDebugInstance()))) $dbInstance->getDebugInstance()->output(sprintf("[%s:] Datenbankschicht gesetzt.
\n", - $dbInstance->__toString() - )); $this->dbInstance = $dbInstance; } @@ -377,9 +363,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $realClass The name of the real class (not BaseFrameworkSystem) */ public final function __toString () { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] __toString() erreicht.
\n", - $this->realClass - )); return $this->realClass; } @@ -403,15 +386,8 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return void */ public final function createUniqueID () { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] createUniqueID aufgerufen.
\n", - $this->__toString() - )); - // Existiert noch keine? if (empty($this->uniqueID)) { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] createUniqueID erzeugt neue Unique-ID.
\n", - $this->__toString() - )); // Correct missing class name $corrected = false; @@ -454,13 +430,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Abort the loop break; } - } - - // Debug message - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] uniqueID ist auf %s gesetzt.
\n", - $this->__toString(), - $tempID - )); + } // END - while // Apply the new ID $this->setUniqueID($tempID); @@ -489,7 +459,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $this->__toString(), md5(sprintf("%s:%s:%s:%s:%s:%s", $this->__toString(), - $this->getPartDescr(), + $this->getObjectDescription(), time(), getenv('REMOTE_ADDR'), getenv('SERVER_ADDR'), @@ -508,12 +478,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Cast to string $uniqueID = (string) $uniqueID; - // Debug message - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Unique-ID gesetzt auf %s.
\n", - $this->__toString(), - $uniqueID - )); - // Set the ID number $this->uniqueID = $uniqueID; } @@ -524,9 +488,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $uniqueID The unique ID of this class */ public final function getUniqueID () { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Unique-ID angefordert.
\n", - $this->__toString() - )); return $this->uniqueID; } @@ -538,24 +499,17 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { public final function resetUniqueID() { // Sweet and simple... ;-) $newUniqueID = $this->generateIdNumber(); - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Unique-ID zurückgesetzt auf %s.
\n", - $this->__toString(), - $newUniqueID - )); $this->setUniqueID($newUniqueID); } /** * Getter for simulator description * - * @return $partDescr The description of this simulation part + * @return $objectDescription The description of this simulation part */ - public final function getPartDescr () { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] getPartDescr erreicht.
\n", - $this->__toString() - )); - if (isset($this->partDescr)) { - return $this->partDescr; + public final function getObjectDescription () { + if (isset($this->objectDescription)) { + return $this->objectDescription; } else { return null; } @@ -564,15 +518,11 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { /** * Setter for simulation part description * - * @param $partDescr The description as string for this simulation part + * @param $objectDescription The description as string for this simulation part * @return void */ - public final function setPartDescr ($partDescr) { - $this->partDescr = (String) $partDescr; - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Teilbeschreibung wird auf %s gesetzt.
\n", - $this->__toString(), - $this->partDescr - )); + public final function setObjectDescription ($objectDescription) { + $this->objectDescription = (String) $objectDescription; } /** @@ -597,7 +547,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { ( $this->__toString() == $itemInstance->__toString() ) && ( - $this->getPartDescr() == $itemInstance->getPartDescr() + $this->getObjectDescription() == $itemInstance->getObjectDescription() ) ); } @@ -609,11 +559,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return boolean The result of comparing both class names */ public final function isClass ($class) { - if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] %s=%s?
\n", - $this->__toString(), - $this->__toString(), - $class - )); return ($this->__toString() == $class); } @@ -657,10 +602,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Cast the number $value = (float) $value; - if (defined('DEBUG_CORE') && is_object($this->getDebugInstance())) $this->getDebugInstance()->output(sprintf("[%s:] %d wird umformatiert.
\n", - $this->__toString(), - $value - )); // Reformat the US number $price = sprintf("%s %s", @@ -678,9 +619,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return void */ public final function removeNumberFormaters () { - if (defined('DEBUG_CORE') && is_object($this->getDebugInstance())) $this->getDebugInstance()->output(sprintf("[%s:] Zahlenumformatierungszeichen werden entfernt.
\n", - $this->__toString() - )); unset($this->thousands); unset($this->decimals); } @@ -691,10 +629,6 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * @return $dbInstance The database layer instance */ public final function getDatabaseInstance () { - if (defined('DEBUG_CORE') && is_object($this->getDebugInstance())) $this->getDebugInstance()->output(sprintf("[%s:] Datenbank-Instanz %s angefordert.
\n", - $this->__toString(), - $this->dbInstance - )); return $this->dbInstance; } @@ -811,11 +745,31 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { $this->fileIOInstance = $fileIOInstance; } + /** + * Protected getter for a manageable application helper class + * + * @return $applicationInstance An instance of a manageable application helper class + */ + protected final function getApplicationInstance () { + return $this->applicationInstance; + } + + /** + * Setter for a manageable application helper class + * + * @param $applicationInstance An instance of a manageable application helper class + * @return void + */ + public final function setApplicationInstance (ManageableApplication $applicationInstance) { + $this->applicationInstance = $applicationInstance; + } + /** * Prepare the template engine (TemplateEngine by default) for a given * application helper instance (ApplicationHelper by default). * - * @param $appInstance An application helper instance + * @param $appInstance An application helper instance or + * null if we shall use the default * @return $tplEngine The template engine instance * @throws NullPointerException If the template engine could not * be initialized @@ -823,8 +777,22 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { * unsupported template engine * @throws MissingLanguageHandlerException If the language sub-system * is not yet initialized - */ - protected function prepareTemplateEngine (BaseFrameworkSystem $appInstance) { + * @throws NullPointerException If the discovered application + * instance is still null + */ + protected function prepareTemplateEngine (BaseFrameworkSystem $appInstance=null) { + // Is the application instance set? + if (is_null($appInstance)) { + // Get the current instance + $appInstance = $this->getApplicationInstance(); + + // Still null? + if (is_null($appInstance)) { + // Thrown an exception + throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); + } + } + // Generate FQFN for all application templates $fqfn = sprintf("%s%s/%s/%s", PATH, @@ -856,7 +824,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Debug message if ((!is_null($this->getDebugInstance())) && (defined('DEBUG_EVAL'))) { - $this->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung:
%s

\n", + $this->getDebugInstance()->output(sprintf("[%s:] Constructed PHP command:
%s

\n", $this->__toString(), htmlentities($eval) )); @@ -877,6 +845,19 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Return the prepared instance return $tplEngine; } + + /** + * Debugs this instance by putting out it's full content + * + * @return void + */ + public final function debugInstance () { + // Generate the output + $content = "
".trim(print_r($this, true))."
"; + + // Output it + ApplicationEntryPoint::app_die("Debug output:".$content); + } } // [EOF] diff --git a/inc/classes/main/class_FrameworkArrayObject.php b/inc/classes/main/class_FrameworkArrayObject.php index 85397a415..910b4d8f4 100644 --- a/inc/classes/main/class_FrameworkArrayObject.php +++ b/inc/classes/main/class_FrameworkArrayObject.php @@ -5,10 +5,10 @@ * need more details. * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -21,19 +21,9 @@ * 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 . + * along with this program. If not, see . */ class FrameworkArrayObject extends ArrayObject { - /** - * Constructor for smooth coding style ;-) - * - * @param $class The class's real name - * @return void - */ - public function constructor ($class) { - // $class will be ignored for backward compatiblity - } - /** * Get real class' name back * diff --git a/inc/classes/main/compressor/class_Bzip2Compressor.php b/inc/classes/main/compressor/class_Bzip2Compressor.php index c0c475f44..88322b60c 100644 --- a/inc/classes/main/compressor/class_Bzip2Compressor.php +++ b/inc/classes/main/compressor/class_Bzip2Compressor.php @@ -3,10 +3,10 @@ * BZIP2 compression and decompression class * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,25 +19,20 @@ * 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 . + * along with this program. If not, see . */ class Bzip2Compressor extends BaseFrameworkSystem implements Compressor { /** - * Private constructor + * Protected constructor * * @return void */ - private function __construct () { + protected function __construct () { // Call parent constructor! - parent::constructor(__CLASS__); - - // Debug message - if (((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", - $this->__toString() - )); + parent::__construct(__CLASS__); // Set description - $this->setPartDescr("BZIP2-Kompressor"); + $this->setObjectDescription("BZIP2-Kompressor"); // Create an unique ID $this->createUniqueID(); @@ -53,19 +48,9 @@ class Bzip2Compressor extends BaseFrameworkSystem implements Compressor { if ((function_exists('bzcompress')) && (function_exists('bzdecompress'))) { // Compressor can maybe be used $cInstance = new Bzip2Compressor(); - - // Debug message - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] BZIP2-Kompression wird verwendet.
\n", - $cInstance->__toString() - )); } else { // Routines not found! $cInstance = null; - - // Debug message - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] BZIP2-Kompressionsroutinen nicht gefunden.
\n", - $cInstance->__toString() - )); } // Return the compressor instance @@ -112,9 +97,6 @@ class Bzip2Compressor extends BaseFrameworkSystem implements Compressor { * @return $string Returns always "bz2" */ public final function getCompressorExtension () { - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Dateierweiterung angefordert.
\n", - $this->__toString() - )); return "bz2"; } } diff --git a/inc/classes/main/compressor/class_GzipCompressor.php b/inc/classes/main/compressor/class_GzipCompressor.php index 0caae9f80..4e95f801f 100644 --- a/inc/classes/main/compressor/class_GzipCompressor.php +++ b/inc/classes/main/compressor/class_GzipCompressor.php @@ -3,10 +3,10 @@ * GZIP compression and decompression class * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,25 +19,20 @@ * 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 . + * along with this program. If not, see . */ class GzipCompressor extends BaseFrameworkSystem implements Compressor { /** - * Private constructor + * Protected constructor * * @return void */ - private function __construct () { + protected function __construct () { // Call parent constructor! - parent::constructor(__CLASS__); - - // Debug message - if (((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", - $this->__toString() - )); + parent::__construct(__CLASS__); // Set description - $this->setPartDescr("GZIP-Kompressor"); + $this->setObjectDescription("GZIP-Kompressor"); // Create an unique ID $this->createUniqueID(); @@ -53,19 +48,9 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor { if ((function_exists('gzcompress')) && (function_exists('gzuncompress'))) { // Compressor can maybe be used $cInstance = new GzipCompressor(); - - // Debug message - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] GZIP-Kompression wird verwendet.
\n", - $cInstance->__toString() - )); } else { // Routines not found! $cInstance = null; - - // Debug message - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] GZIP-Kompressionsroutinen nicht gefunden.
\n", - $cInstance->__toString() - )); } // Return the compressor instance @@ -75,8 +60,8 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor { /** * GZIP compression stream * - * @param $streamData Mixed non-object stream data - * @return $streamData The compressed stream data + * @param $streamData Mixed non-object stream data + * @return $streamData The compressed stream data * @throws InvalidObjectException If the stream is an object */ public function compressStream ($streamData) { @@ -92,8 +77,8 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor { /** * GZIP decompression stream * - * @param $streamData Mixed non-object stream data - * @return $streamData The decompressed stream data + * @param $streamData Mixed non-object stream data + * @return $streamData The decompressed stream data * @throws InvalidObjectException If the stream is an object */ public function decompressStream ($streamData) { @@ -112,9 +97,6 @@ class GzipCompressor extends BaseFrameworkSystem implements Compressor { * @return $string Returns always "gz" */ public final function getCompressorExtension () { - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Dateierweiterung angefordert.
\n", - $this->__toString() - )); return "gz"; } } diff --git a/inc/classes/main/compressor/class_NullCompressor.php b/inc/classes/main/compressor/class_NullCompressor.php index 56b2d5f4f..a8a570c58 100644 --- a/inc/classes/main/compressor/class_NullCompressor.php +++ b/inc/classes/main/compressor/class_NullCompressor.php @@ -3,10 +3,10 @@ * Null compression and decompression class * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,25 +19,20 @@ * 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 . + * along with this program. If not, see . */ class NullCompressor extends BaseFrameworkSystem implements Compressor { /** - * Private constructor + * Protected constructor * * @return void */ - private function __construct () { + protected function __construct () { // Call parent constructor! - parent::constructor(__CLASS__); - - // Debug message - if (((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", - $this->__toString() - )); + parent::__construct(__CLASS__); // Set description - $this->setPartDescr("Null-Kompressor"); + $this->setObjectDescription("Null-Kompressor"); // Create an unique ID $this->createUniqueID(); @@ -59,8 +54,8 @@ class NullCompressor extends BaseFrameworkSystem implements Compressor { /** * Null compression stream * - * @param $streamData Mixed non-object stream data - * @return $streamData The compressed stream data + * @param $streamData Mixed non-object stream data + * @return $streamData The compressed stream data * @throws InvalidObjectException If the stream is an object */ public function compressStream ($streamData) { @@ -76,8 +71,8 @@ class NullCompressor extends BaseFrameworkSystem implements Compressor { /** * Null decompression stream * - * @param $streamData Mixed non-object stream data - * @return $streamData The decompressed stream data + * @param $streamData Mixed non-object stream data + * @return $streamData The decompressed stream data * @throws InvalidObjectException If the stream is an object */ public function decompressStream ($streamData) { @@ -93,12 +88,9 @@ class NullCompressor extends BaseFrameworkSystem implements Compressor { /** * Getter for the file extension of this compressor * - * @return $string Returns always "bz2" + * @return $string Returns always "null" */ public final function getCompressorExtension () { - if ((defined('DEBUG_COMPRESSOR')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Dateierweiterung angefordert.
\n", - $this->__toString() - )); return "null"; } } diff --git a/inc/classes/main/console/class_ConsoleTools.php b/inc/classes/main/console/class_ConsoleTools.php index 5ba9ae642..78dc94c90 100644 --- a/inc/classes/main/console/class_ConsoleTools.php +++ b/inc/classes/main/console/class_ConsoleTools.php @@ -3,10 +3,10 @@ * This class contains static helper functions for console applications * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,20 +19,20 @@ * 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 . + * along with this program. If not, see . */ class ConsoleTools extends BaseFrameworkSystem { /** - * Private constructor + * Protected constructor * * @return void */ - private function __construct () { + protected function __construct () { // Call parent constructor - parent::constructor(__CLASS__); + parent::__construct(__CLASS__); // Set description - $this->setPartDescr("Console-Tools"); + $this->setObjectDescription("Console-Tools"); // Create an unique ID $this->createUniqueID(); diff --git a/inc/classes/main/database/class_BaseDatabaseFrontend.php b/inc/classes/main/database/class_BaseDatabaseFrontend.php index b8f0d4354..ac31d501f 100644 --- a/inc/classes/main/database/class_BaseDatabaseFrontend.php +++ b/inc/classes/main/database/class_BaseDatabaseFrontend.php @@ -4,10 +4,10 @@ * * @see DatabaseFrontendInterface - An interface for database frontends (front-end to the application) * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -20,7 +20,7 @@ * 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 . + * along with this program. If not, see . */ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements DatabaseFrontendInterface, LimitableObject { /** @@ -29,43 +29,24 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements Datab private $limitInstance = null; /** - * Private constructor + * Protected constructor * * @return void */ - private function __construct($class) { + protected function __construct($class) { // Call parent constructor - parent::constructor($class); - - // Debug message - if (((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruktor erreicht.
\n", - $this->__toString() - )); + parent::__construct($class); // Clean up a little $this->removeNumberFormaters(); } - /** - * The public constructor - * - * @return void - */ - public function constructor ($class) { - // Calls just the private one - $this->__construct($class); - } - /** * Getter for limitation instance * * @return $limitInstance The instance to the object ObjectLimits */ public final function getLimitInstance () { - if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Limitierungsinstanz %s angefordert.
\n", - $this->__toString(), - $this->limitInstance->__toString() - )); return $this->limitInstance; } @@ -78,12 +59,6 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements Datab * @return void */ public final function limitObject (ObjectLimits $limitInstance) { - // Debug message - if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Limitierungsinstanz %s soll verwendet werden.
\n", - $this->__toString(), - $limitInstance->__toString() - )); - // Get limitArray for validation $array = $limitInstance->getLimitArray(); @@ -91,13 +66,6 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements Datab if ($array->count() > 0) { // Okay, there is enougth $this->limitInstance = $limitInstance; - - // Debug message - if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Limitierungsinstanz %s wird verwendet und beinhaltet %s Einträge.
\n", - $this->__toString(), - $limitInstance->__toString(), - $array->count() - )); } } } diff --git a/inc/classes/main/database/classes/class_LocalFileDatabase.php b/inc/classes/main/database/classes/class_LocalFileDatabase.php index ea4a8e19e..84babfeaf 100644 --- a/inc/classes/main/database/classes/class_LocalFileDatabase.php +++ b/inc/classes/main/database/classes/class_LocalFileDatabase.php @@ -5,10 +5,10 @@ * This class serializes objects and saves them to local files. * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -21,7 +21,7 @@ * 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 . + * along with this program. If not, see . */ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontendInterface { /** @@ -50,12 +50,12 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend * * @return void */ - private function __construct() { + protected function __construct() { // Call parent constructor - parent::constructor(__CLASS__); + parent::__construct(__CLASS__); // Set description - $this->setPartDescr("Dateidatenbankschicht"); + $this->setObjectDescription("Dateidatenbankschicht"); // Create unique ID $this->createUniqueID(); @@ -99,11 +99,6 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend throw new SavePathWriteProtectedException($savePath, self::EXCEPTION_WRITE_PROTECED_PATH); } - // Debug output - if (defined('DEBUG_DATABASE')) $dbInstance->getDebugInstance()->output(sprintf("[%s:] Es werden lokale Dateien zum Speichern von Objekten verwendet.
\n", - $dbInstance->__toString() - )); - // Set save path and IO instance $dbInstance->setSavePath($savePath); $dbInstance->setFileIOInstance($ioInstance); @@ -122,12 +117,6 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend // Secure string $savePath = (string) $savePath; - // Debug message - if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Lokaler Speicherpfad %s wird verwendet.
\n", - $this->__toString(), - $savePath - )); - // Set save path $this->savePath = $savePath; } @@ -164,24 +153,11 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend throw new MissingMethodException(array($object, '__toString'), self::EXCEPTION_MISSING_METHOD); } - // Debug message - if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt %s soll in eine lokale Datei gespeichert werden.
\n", - $this->__toString(), - $object->__toString() - )); - // Get a string containing the serialized object. We cannot exchange // $this and $object here because $object does not need to worry // about it's limitations... ;-) $serialized = $this->serializeObject($object); - // Debug message - if ((defined('DEBUG_DATABASE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt %s ist nach der Serialisierung %s Byte gross.
\n", - $this->__toString(), - $object->__toString(), - strlen($serialized) - )); - // Get a path name plus file name and append the extension $fqfn = $this->getSavePath() . $object->getPathFileNameFromObject() . "." . $this->getFileExtension(); @@ -352,6 +328,15 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend return $this->lastContents; } + /** + * Getter for file extension + * + * @return $fileExtension The array with elements 'header' and 'data'. + */ + public final function getFileExtension () { + return $this->fileExtension; + } + /** * Get cached (last fetched) data from the local file database * diff --git a/inc/classes/main/debug/class_DebugConsoleOutput.php b/inc/classes/main/debug/class_DebugConsoleOutput.php index 82bcd7f1f..dfcfd36b4 100644 --- a/inc/classes/main/debug/class_DebugConsoleOutput.php +++ b/inc/classes/main/debug/class_DebugConsoleOutput.php @@ -3,10 +3,10 @@ * A debug output class for the console (e.g. hub software) * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,20 +19,20 @@ * 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 . + * along with this program. If not, see . */ class DebugConsoleOutput extends BaseFrameworkSystem implements Debugger, OutputStreamer { /** - * Private constructor + * Protected constructor * * @return void */ - private function __construct () { + protected function __construct () { // Call parent constructor - parent::constructor(__CLASS__); + parent::__construct(__CLASS__); // Set description - $this->setPartDescr("Debug-Ausgabe auf Konsole"); + $this->setObjectDescription("Debug-Ausgabe auf Konsole"); // Create an unique ID $this->createUniqueID(); diff --git a/inc/classes/main/debug/class_DebugErrorLogOutput.php b/inc/classes/main/debug/class_DebugErrorLogOutput.php index c8e62936e..26b099d41 100644 --- a/inc/classes/main/debug/class_DebugErrorLogOutput.php +++ b/inc/classes/main/debug/class_DebugErrorLogOutput.php @@ -3,10 +3,10 @@ * A debug output class for PHP's error_log() command * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,20 +19,20 @@ * 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 . + * along with this program. If not, see . */ class DebugErrorLogOutput extends BaseFrameworkSystem implements Debugger, OutputStreamer { /** - * Private constructor + * Protected constructor * * @return void */ - private function __construct () { + protected function __construct () { // Call parent constructor - parent::constructor(__CLASS__); + parent::__construct(__CLASS__); // Set description - $this->setPartDescr("Debug-Ausgabe in error_log()"); + $this->setObjectDescription("Debug-Ausgabe in error_log()"); // Create an unique ID $this->createUniqueID(); diff --git a/inc/classes/main/debug/class_DebugWebOutput.php b/inc/classes/main/debug/class_DebugWebOutput.php index ee3ae81b4..17faa1977 100644 --- a/inc/classes/main/debug/class_DebugWebOutput.php +++ b/inc/classes/main/debug/class_DebugWebOutput.php @@ -3,10 +3,10 @@ * A debug output class for the web browser * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,20 +19,20 @@ * 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 . + * along with this program. If not, see . */ class DebugWebOutput extends BaseFrameworkSystem implements Debugger, OutputStreamer { /** - * Private constructor + * Protected constructor * * @return void */ - private function __construct () { + protected function __construct () { // Call parent constructor - parent::constructor(__CLASS__); + parent::__construct(__CLASS__); // Set description - $this->setPartDescr("Debug-Ausgabe auf Konsole"); + $this->setObjectDescription("Debug-Ausgabe auf Konsole"); // Create an unique ID $this->createUniqueID(); diff --git a/inc/classes/main/extended/class_ObjectLimits.php b/inc/classes/main/extended/class_ObjectLimits.php index 91dc519f8..75925c648 100644 --- a/inc/classes/main/extended/class_ObjectLimits.php +++ b/inc/classes/main/extended/class_ObjectLimits.php @@ -4,10 +4,10 @@ * objects to the datatabase connection or else a lot heap would be saved. * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -20,7 +20,7 @@ * 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 . + * along with this program. If not, see . */ class ObjectLimits extends BaseFrameworkSystem { /** @@ -30,16 +30,16 @@ class ObjectLimits extends BaseFrameworkSystem { private $limitArray = null; /** - * Private constructor + * Protected constructor * * @return void */ - private final function __construct () { + protected function __construct () { // Call parent constructor - parent::constructor(__CLASS__); + parent::__construct(__CLASS__); // Set part description - $this->setPartDescr("Limitierungsobjekt"); + $this->setObjectDescription("Limitierungsobjekt"); // Create unique ID number $this->createUniqueID(); diff --git a/inc/classes/main/extended/class_SerializationContainer.php b/inc/classes/main/extended/class_SerializationContainer.php index d32551c84..a0980e3d6 100644 --- a/inc/classes/main/extended/class_SerializationContainer.php +++ b/inc/classes/main/extended/class_SerializationContainer.php @@ -4,10 +4,10 @@ * other classes * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -20,7 +20,7 @@ * 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 . + * along with this program. If not, see . */ class SerializationContainer extends FrameworkArrayObject { /** @@ -30,10 +30,7 @@ class SerializationContainer extends FrameworkArrayObject { */ public function __construct () { // Call parent constructor - parent::constructor(__CLASS__); - - // Debug message - if ((defined('DEBUG_CONTAINER')) && (defined('DEBUG_CONSTRUCT'))) $this->getDebugInstance()->output("[SerializationContainer:] Konstruktor erreicht.
\n"); + parent::__construct(__CLASS__); } /** @@ -64,13 +61,13 @@ class SerializationContainer extends FrameworkArrayObject { ); // Debug eval command - if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $limitInstance->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung:
%s

\n", + if (defined('DEBUG_EVAL')) $limitInstance->getDebugInstance()->output(sprintf("[%s:] Constructed PHP command:
%s

\n", $this->__toString(), htmlentities($eval) )); // Run it - @eval($eval); + eval($eval); // Add this item to the container list $containerInstance->append(array( diff --git a/inc/classes/main/io/class_FileIOStream.php b/inc/classes/main/io/class_FileIOStream.php index 2eedf3c6a..c9833465a 100644 --- a/inc/classes/main/io/class_FileIOStream.php +++ b/inc/classes/main/io/class_FileIOStream.php @@ -3,10 +3,10 @@ * An universal class for file input/output streams. * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,18 +19,18 @@ * 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 . + * along with this program. If not, see . */ class FileIOStream extends BaseFrameworkSystem implements FileInputStreamer, FileOutputStreamer { /** - * Private constructor + * Protected constructor */ - private function __construct () { + protected function __construct () { // Call parent constructor - parent::constructor(__CLASS__); + parent::__construct(__CLASS__); // Set part description - $this->setPartDescr("Universal Datei-Ein-/Ausgabesystem"); + $this->setObjectDescription("Universal Datei-Ein-/Ausgabesystem"); // Create unique ID $this->createUniqueID(); diff --git a/inc/classes/main/io/class_FrameworkDirectoryPointer.php b/inc/classes/main/io/class_FrameworkDirectoryPointer.php index e8af81719..5ad52ed70 100644 --- a/inc/classes/main/io/class_FrameworkDirectoryPointer.php +++ b/inc/classes/main/io/class_FrameworkDirectoryPointer.php @@ -3,10 +3,10 @@ * A class for directory reading and getting its contents * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,7 +19,7 @@ * 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 . + * along with this program. If not, see . */ class FrameworkDirectoryPointer extends BaseFrameworkSystem { /** @@ -33,14 +33,14 @@ class FrameworkDirectoryPointer extends BaseFrameworkSystem { private $dirPointer = null; /** - * Private constructor + * Protected constructor */ - private function __construct () { + protected function __construct () { // Call parent constructor - parent::constructor(__CLASS__); + parent::__construct(__CLASS__); // Set part description - $this->setPartDescr("Verzeichnis-Handler"); + $this->setObjectDescription("Verzeichnis-Handler"); // Create unique ID $this->createUniqueID(); diff --git a/inc/classes/main/io/class_FrameworkFileInputPointer.php b/inc/classes/main/io/class_FrameworkFileInputPointer.php index 534650ab5..a38b0a3d1 100644 --- a/inc/classes/main/io/class_FrameworkFileInputPointer.php +++ b/inc/classes/main/io/class_FrameworkFileInputPointer.php @@ -3,10 +3,10 @@ * A class for reading files * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,7 +19,7 @@ * 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 . + * along with this program. If not, see . */ class FrameworkFileInputPointer extends BaseFrameworkSystem { /** @@ -33,14 +33,14 @@ class FrameworkFileInputPointer extends BaseFrameworkSystem { private $filePointer = null; /** - * Private constructor + * Protected constructor */ - private final function __construct () { + protected function __construct () { // Call parent constructor - parent::constructor(__CLASS__); + parent::__construct(__CLASS__); // Set part description - $this->setPartDescr("Dateiausgabe-Handler"); + $this->setObjectDescription("Dateiausgabe-Handler"); // Create unique ID $this->createUniqueID(); diff --git a/inc/classes/main/io/class_FrameworkFileOutputPointer.php b/inc/classes/main/io/class_FrameworkFileOutputPointer.php index 59de4f663..8cc07caaa 100644 --- a/inc/classes/main/io/class_FrameworkFileOutputPointer.php +++ b/inc/classes/main/io/class_FrameworkFileOutputPointer.php @@ -3,10 +3,10 @@ * A class for writing files * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,7 +19,7 @@ * 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 . + * along with this program. If not, see . */ class FrameworkFileOutputPointer extends BaseFrameworkSystem { /** @@ -33,14 +33,14 @@ class FrameworkFileOutputPointer extends BaseFrameworkSystem { private $filePointer = null; /** - * Private constructor + * Protected constructor */ - private final function __construct () { + protected function __construct () { // Call parent constructor - parent::constructor(__CLASS__); + parent::__construct(__CLASS__); // Set part description - $this->setPartDescr("Dateiausgabe-Handler"); + $this->setObjectDescription("Dateiausgabe-Handler"); // Create unique ID $this->createUniqueID(); diff --git a/inc/classes/main/language/class_LanguageSystem.php b/inc/classes/main/language/class_LanguageSystem.php index 419a85658..4aa9490c2 100644 --- a/inc/classes/main/language/class_LanguageSystem.php +++ b/inc/classes/main/language/class_LanguageSystem.php @@ -4,10 +4,10 @@ * application and whole framework * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -20,7 +20,7 @@ * 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 . + * along with this program. If not, see . */ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage { /** @@ -44,16 +44,16 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage { private static $thisInstance = null; /** - * Private constructor + * Protected constructor * * @return void */ - private final function __construct () { + protected function __construct () { // Call parent constructor - parent::constructor(__CLASS__); + parent::__construct(__CLASS__); // Set part description - $this->setPartDescr("Sprachsystem"); + $this->setObjectDescription("Sprachsystem"); // Create unique ID number $this->createUniqueID(); diff --git a/inc/classes/main/output/class_ConsoleOutput.php b/inc/classes/main/output/class_ConsoleOutput.php index 374c2af4a..5d2b1c135 100644 --- a/inc/classes/main/output/class_ConsoleOutput.php +++ b/inc/classes/main/output/class_ConsoleOutput.php @@ -4,10 +4,10 @@ * for console output * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -20,7 +20,7 @@ * 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 . + * along with this program. If not, see . */ class ConsoleOutput extends BaseFrameworkSystem implements OutputStreamer { /** @@ -34,16 +34,16 @@ class ConsoleOutput extends BaseFrameworkSystem implements OutputStreamer { private $vars = array(); /** - * Private constructor + * Protected constructor * * @return void */ - private function __construct () { + protected function __construct () { // Call parent constructor - parent::constructor(__CLASS__); + parent::__construct(__CLASS__); // Set description - $this->setPartDescr("Console-Ausgabe-Handler"); + $this->setObjectDescription("Console-Ausgabe-Handler"); // Create an unique ID $this->createUniqueID(); diff --git a/inc/classes/main/output/class_WebOutput.php b/inc/classes/main/output/class_WebOutput.php index 40d425c70..a687cea24 100644 --- a/inc/classes/main/output/class_WebOutput.php +++ b/inc/classes/main/output/class_WebOutput.php @@ -4,10 +4,10 @@ * browser * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -20,7 +20,7 @@ * 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 . + * along with this program. If not, see . */ class WebOutput extends BaseFrameworkSystem implements OutputStreamer { /** @@ -29,16 +29,16 @@ class WebOutput extends BaseFrameworkSystem implements OutputStreamer { private static $webInstance = null; /** - * Private constructor + * Protected constructor * * @return void */ - private function __construct () { + protected function __construct () { // Call parent constructor - parent::constructor(__CLASS__); + parent::__construct(__CLASS__); // Set description - $this->setPartDescr("Web-Ausgabe-Handler"); + $this->setObjectDescription("Web-Ausgabe-Handler"); // Create an unique ID $this->createUniqueID(); diff --git a/inc/classes/main/template/class_TemplateEngine.php b/inc/classes/main/template/class_TemplateEngine.php index cc9591841..e11b84d55 100644 --- a/inc/classes/main/template/class_TemplateEngine.php +++ b/inc/classes/main/template/class_TemplateEngine.php @@ -4,10 +4,10 @@ * and emails. * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -20,7 +20,7 @@ * 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 . + * along with this program. If not, see . */ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate { /** @@ -114,16 +114,16 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate const EXCEPTION_INVALID_VIEW_HELPER = 0xa02; /** - * Private constructor + * Protected constructor * * @return void */ - private final function __construct () { + protected function __construct () { // Call parent constructor - parent::constructor(__CLASS__); + parent::__construct(__CLASS__); // Set part description - $this->setPartDescr("Template-Engine"); + $this->setObjectDescription("Template-Engine"); // Create unique ID number $this->createUniqueID(); @@ -136,16 +136,16 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate /** * Creates an instance of the class TemplateEngine and prepares it for usage * - * @param $basePath The local base path for all templates - * @param $langInstance An instance of LanguageSystem (default) - * @param $ioInstance An instance of FileIOHandler (default, middleware!) + * @param $basePath The local base path for all templates + * @param $langInstance An instance of LanguageSystem (default) + * @param $ioInstance An instance of FileIOHandler (default, middleware!) * @return $tplInstance An instance of TemplateEngine * @throws BasePathIsEmptyException If the provided $basePath is empty * @throws InvalidBasePathStringException If $basePath is no string * @throws BasePathIsNoDirectoryException If $basePath is no - * directory or not found + * directory or not found * @throws BasePathReadProtectedException If $basePath is - * read-protected + * read-protected */ public final static function createTemplateEngine ($basePath, ManageableLanguage $langInstance, FileIOHandler $ioInstance) { // Get a new instance @@ -194,7 +194,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate * Search for a variable in the stack * * @param $var The variable we are looking for - * @return $idx FALSE means not found, > 0 means found on a specific index + * @return $idx FALSE means not found, >=0 means found on a specific index */ private function isVariableAlreadySet ($var) { // First everything is not found @@ -217,6 +217,33 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate return $found; } + /** + * Return a content of a variable or null if not found + * + * @param $var The variable we are looking for + * @return $content Content of the variable or null if not found + */ + private function readVariable ($var) { + // First everything is not found + $content = null; + + // Now search for it + for ($idx = $this->varStack->getIterator(); $idx->valid(); $idx->next()) { + // Get current item + $currEntry = $idx->current(); + + // Is the entry found? + if ($currEntry['name'] == $var) { + // Found! + $content = $currEntry['value']; + break; + } + } + + // Return the current position + return $content; + } + /** * Add a variable to the stack * @@ -227,8 +254,8 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate private function addVariable ($var, $value) { // Add it to the stack $this->varStack->append(array( - 'name' => $var, - 'value' => $value + 'name' => trim($var), + 'value' => trim($value) )); } @@ -520,13 +547,6 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate * required method */ private function loadRawTemplateData ($fqfn) { - // Debug message - if ((defined('DEBUG_TEMPLATE')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Template %s vom Typ %s wird geladen.
\n", - $this->__toString(), - $template, - $this->getTemplateType() - )); - // Get a input/output instance from the middleware $ioInstance = $this->getFileIOInstance(); @@ -545,12 +565,6 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate // Load the raw template $rawTemplateData = $ioInstance->loadFileContents($fqfn); - // Debug message - if ((defined('DEBUG_TEMPLATE')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] %s Byte Rohdaten geladen.
\n", - $this->__toString(), - strlen($rawTemplateData) - )); - // Store the template's contents into this class $this->setRawTemplateData($rawTemplateData); @@ -580,11 +594,11 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate /** * Extract variables from a given raw data stream * - * @param $rawData The raw template data we shall analyze + * @param $rawData The raw template data we shall analyze * @return void * @throws InvalidTemplateVariableNameException If a variable name - * in a template is - * invalid + * in a template is + * invalid */ private function extractVariablesFromRawData ($rawData) { // Cast to string @@ -623,7 +637,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate * [2] => Array - An array with right part of a match including ":" * [3] => Array - An array with right part of a match excluding ":" */ - private function analyzeTemplate ($templateMatches) { + private function analyzeTemplate (array $templateMatches) { // Backup raw template data $backup = $this->getRawTemplateData(); @@ -647,8 +661,17 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate // RECURSIVE PROTECTION! $this->loadedTemplates[] = $template; } catch (FilePointerNotOpenedException $e) { - // Template not found! - $this->rawTemplates[] = $template; + // Template not found, but maybe variable assigned? + if ($this->isVariableAlreadySet($template) !== false) { + // Use that content here + $this->loadedRawData[$template] = $this->readVariable($template); + + // Recursive protection: + $this->loadedTemplates[] = $template; + } else { + // Even this is not done... :/ + $this->rawTemplates[] = $template; + } } } // if ((!isset( ... @@ -701,15 +724,15 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate * @param $templateMatches See method analyzeTemplate() * @return void */ - private function insertAllTemplates ($templateMatches) { + private function insertAllTemplates (array $templateMatches) { // Run through all loaded codes - foreach ($this->loadedRawData as $template => $code) { + foreach ($this->loadedRawData as $template=>$code) { // Search for the template $foundIndex = array_search($template, $templateMatches[1]); // Lookup the matching template replacement - if (isset($templateMatches[0][$foundIndex])) { + if (($foundIndex !== false) && (isset($templateMatches[0][$foundIndex]))) { // Get the current raw template $rawData = $this->getRawTemplateData(); @@ -719,8 +742,10 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate // Set the new raw data $this->setRawTemplateData($rawData); - } - } + + } // END - if + + } // END - foreach } /** @@ -760,7 +785,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate * @param $varMatches An array full of variable/value pairs. * @return void */ - private function assignAllVariables ($varMatches) { + private function assignAllVariables (array $varMatches) { // Search for all variables foreach ($varMatches[1] as $key=>$var) { @@ -774,8 +799,9 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate if ((substr($varMatches[2][$key], 0, 1) == "\"") && (substr($varMatches[2][$key], -1, 1) == "\"")) { // Free string detected! Which we can assign directly $this->assignVariable($var, $varMatches[3][$key]); - } else { + } elseif (!empty($varMatches[2][$key])) { // Non-string found so we need some deeper analysis... + // @TODO Unfinished work or don't die here. die("Deeper analysis not yet implemented!"); } @@ -787,21 +813,27 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate * @param $templateMatches See method analyzeTemplate() for details * @return void */ - private function compileRawTemplateData ($templateMatches) { + private function compileRawTemplateData (array $templateMatches) { // Are some code-templates found which we need to compile? if (count($this->loadedRawData) > 0) { // Then compile all! - foreach ($this->loadedRawData as $template => $code) { + foreach ($this->loadedRawData as $template=>$code) { + + // Is this template already compiled? + if (in_array($template, $this->compiledTemplates)) { + // Then skip it + continue; + } // Search for the template $foundIndex = array_search($template, $templateMatches[1]); // Lookup the matching variable data - if (isset($templateMatches[3][$foundIndex])) { + if (($foundIndex !== false) && (isset($templateMatches[3][$foundIndex]))) { // Split it up with another reg. exp. into variable=value pairs - @preg_match_all($this->regExpVarValue, $templateMatches[3][$foundIndex], $varMatches); + preg_match_all($this->regExpVarValue, $templateMatches[3][$foundIndex], $varMatches); // Assign all variables $this->assignAllVariables($varMatches); @@ -819,6 +851,44 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate } // END - if (count($this->loadedRawData) ... } + /** + * Inserts all raw templates into their respective variables + * + * @return void + */ + private function insertRawTemplates () { + // Load all templates + foreach ($this->rawTemplates as $template=>$content) { + // Set the template as a variable with the content + $this->assignVariable($template, $content); + } + } + + /** + * Finalizes the compilation of all template variables + * + * @return void + */ + private function finalizeVariableCompilation () { + // Get the content + $content = $this->getRawTemplateData(); + + // Walk through all variables + for ($idx = $this->varStack->getIterator(); $idx->valid(); $idx->next()) { + // Get current entry + $currEntry = $idx->current(); + + // Replace all [$var] or {?$var?} with the content + //* DEBUG: */ echo "name=".$currEntry['name'].", value=
".htmlentities($currEntry['value'])."
\n"; + $content = str_replace("\$content[".$currEntry['name']."]", $currEntry['value'], $content); + $content = str_replace("[".$currEntry['name']."]", $currEntry['value'], $content); + $content = str_replace("{?".$currEntry['name']."?}", $currEntry['value'], $content); + } // END - for + + // Set the content back + $this->setRawTemplateData($content); + } + /** * Getter for raw template data * @@ -892,12 +962,17 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate // Iterate through all variables for ($idx = $this->varStack->getIterator(); $idx->valid(); $idx->next()) { + // Get current variable from the stack $currVariable = $idx->current(); // Transfer it's name/value combination to the $content array + //* DEBUG: */ echo $currVariable['name']."=
".htmlentities($currVariable['value'])."
\n"; $dummy[$currVariable['name']] = $currVariable['value']; - } + + }// END - if + + // Set the new variable (don't remove the second dollar !) $$validVar = $dummy; // Prepare all configuration variables @@ -907,19 +982,25 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate unset($idx); unset($currVariable); + // Finalize the compilation of template variables + $this->finalizeVariableCompilation(); + // Prepare the eval() command for comiling the template - $eval = sprintf("\$this->setCompiledData(\"%s\");", + $eval = sprintf("\$result = \"%s\";", addslashes($this->getRawTemplateData()) ); // Debug message - if (((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung:
%s

\n", + if ((defined('DEBUG_EVAL')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Constructed PHP command:
%s

\n", $this->__toString(), htmlentities($eval) )); // Run the constructed command. This will "compile" all variables in eval($eval); + + // Set the new content + $this->setCompiledData($result); } /** @@ -936,11 +1017,9 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate if ($this->getTemplateType() != $this->getConfigInstance()->readConfig("code_template_type")) { // Abort here throw new UnexpectedTemplateTypeException(array($this, $this->getTemplateType(), $this->getConfigInstance()->readConfig("code_template_type")), self::EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED); - } + } // END - if - // Get the raw data. Thanks to Flobee(R) for given me a hint using the - // modifier "m" in regular expressions. I had implemented a regex here - // like this: (\n|\r) + // Get the raw data. $rawData = $this->getRawTemplateData(); // Remove double spaces and trim leading/trailing spaces @@ -950,7 +1029,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate $this->extractVariablesFromRawData($rawData); // Search for code-tags which are {? ?} - @preg_match_all($this->regExpCodeTags, $rawData, $templateMatches); + preg_match_all($this->regExpCodeTags, $rawData, $templateMatches); // Analyze the matches array if ((is_array($templateMatches)) && (count($templateMatches) == 4) && (count($templateMatches[0]) > 0)) { @@ -967,8 +1046,15 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate // Are some raw templates found and loaded? if (count($this->rawTemplates) > 0) { - die("NOT YET IMPLEMENTED"); - } + + // Insert all raw templates + $this->insertRawTemplates(); + + // Remove the raw template content as well + $this->setRawTemplateData(""); + + } // END - if + } // END - if($templateMatches ... } @@ -988,20 +1074,20 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate break; default: // Unknown type found + // Construct message + $msg = sprintf("[%s:] Unknown/unsupported template type %s detected.", + $this->__toString(), + $this->getTemplateType() + ); + if ((is_object($this->getDebugInstance())) && (method_exists($this->getDebugInstance(), 'output'))) { // Use debug output handler - $this->getDebugInstance()->output(sprintf("[%s:] Unbekannter Template-Typ %s erkannt.", - $this->__toString(), - $this->getTemplateType() - )); + $this->getDebugInstance()->output($msg); die(); } else { // Put directly out // DO NOT REWRITE THIS TO app_die() !!! - die(sprintf("[%s:] Unbekannter Template-Typ %s erkannt.", - $this->__toString(), - $this->getTemplateType() - )); + die($msg); } break; } @@ -1037,12 +1123,41 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate ); // Run the code - @eval($eval); + eval($eval); } // Return the requested instance return $this->helpers[$helperName]; } + + /** + * Assigns the last loaded raw template content with a given variable + * + * @param $templateName Name of the template we want to assign + * @param $variableName Name of the variable we want to assign + * @return void + */ + public function assignTemplateWithVariable ($templateName, $variableName) { + // Get the content from last loaded raw template + $content = $this->getRawTemplateData(); + + // Assign the variable + $this->assignVariable($variableName, $content); + + // Purge raw content + $this->setRawTemplateData(""); + } + + /** + * Transfers the content of this template engine to a given response instance + * + * @param $responseInstance An instance of a response class + * @return void + */ + public function transferToResponse (Responseable $responseInstance) { + // Get the content and set it in the response class + $responseInstance->writeToBody($this->getCompiledData()); + } } // [EOF] diff --git a/inc/classes/middleware/class_BaseMiddleware.php b/inc/classes/middleware/class_BaseMiddleware.php index 88bc16e12..1cc69f6d3 100644 --- a/inc/classes/middleware/class_BaseMiddleware.php +++ b/inc/classes/middleware/class_BaseMiddleware.php @@ -3,10 +3,10 @@ * An abstract middleware class for all other middlware classes * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,31 +19,21 @@ * 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 . + * along with this program. If not, see . */ class BaseMiddleware extends BaseFrameworkSystem { /** - * Private constructor + * Protected constructor * * @return void */ - private function __construct ($class) { + protected function __construct ($class) { // Call parent constructor - parent::constructor($class); + parent::__construct($class); // Clean up a little $this->removeNumberFormaters(); } - - /** - * Public constructor - * - * @return void - */ - public function constructor ($class) { - // Just call the private constructor - $this->__construct($class); - } } // [EOF] diff --git a/inc/classes/middleware/compressor/class_CompressorChannel.php b/inc/classes/middleware/compressor/class_CompressorChannel.php index 5d5017c6e..b5fa5654a 100644 --- a/inc/classes/middleware/compressor/class_CompressorChannel.php +++ b/inc/classes/middleware/compressor/class_CompressorChannel.php @@ -3,10 +3,10 @@ * Middleware class for selecting the right compressor channel * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,19 +19,19 @@ * 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 . + * along with this program. If not, see . */ class CompressorChannel extends BaseMiddleware { // Output handler instance private $compressor = null; // Public constructor - private function __construct () { + protected function __construct () { // Call parent constructor! - parent::constructor(__CLASS__); + parent::__construct(__CLASS__); // Set description - $this->setPartDescr("Komprimierungshandler"); + $this->setObjectDescription("Komprimierungshandler"); // Create an unique ID $this->createUniqueID(); diff --git a/inc/classes/middleware/database/class_DatabaseConnection.php b/inc/classes/middleware/database/class_DatabaseConnection.php index e6adbbe67..45b09ea29 100644 --- a/inc/classes/middleware/database/class_DatabaseConnection.php +++ b/inc/classes/middleware/database/class_DatabaseConnection.php @@ -3,10 +3,10 @@ * Database selector class * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,7 +19,7 @@ * 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 . + * along with this program. If not, see . */ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, LimitableObject { // Array for connection data @@ -31,13 +31,13 @@ class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Li // An instance of this class private static $thisInstance = null; - // Private constructor - private final function __construct() { + // Protected constructor + protected function __construct() { // Call parent constructor - parent::constructor(__CLASS__); + parent::__construct(__CLASS__); // Set description - $this->setPartDescr("Datenbank-Mittelschicht"); + $this->setObjectDescription("Datenbank-Mittelschicht"); // Create an unique ID $this->createUniqueID(); diff --git a/inc/classes/middleware/debug/class_DebugMiddleware.php b/inc/classes/middleware/debug/class_DebugMiddleware.php index 5193532e1..f46dbb5e0 100644 --- a/inc/classes/middleware/debug/class_DebugMiddleware.php +++ b/inc/classes/middleware/debug/class_DebugMiddleware.php @@ -5,10 +5,10 @@ * become deprecated soon. * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -21,7 +21,7 @@ * 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 . + * along with this program. If not, see . */ class DebugMiddleware extends BaseMiddleware { /** @@ -35,16 +35,16 @@ class DebugMiddleware extends BaseMiddleware { private static $thisInstance = null; /** - * Private constructor + * Protected constructor * * @return void */ - private final function __construct () { + protected function __construct () { // Call parent constructor - parent::constructor(__CLASS__); + parent::__construct(__CLASS__); // Set description - $this->setPartDescr("Debug-Ausgabe-Handler"); + $this->setObjectDescription("Debug-Ausgabe-Handler"); // Create an unique ID $this->createUniqueID(); @@ -78,7 +78,7 @@ class DebugMiddleware extends BaseMiddleware { ); // Run the constructed name - @eval($eval); + eval($eval); // Was this successfull? if ((is_object($debuggerClass)) && (method_exists($debuggerClass, "outputStream"))) { diff --git a/inc/classes/middleware/io/class_FileIOHandler.php b/inc/classes/middleware/io/class_FileIOHandler.php index 7e624cccf..8c7a47aa9 100644 --- a/inc/classes/middleware/io/class_FileIOHandler.php +++ b/inc/classes/middleware/io/class_FileIOHandler.php @@ -4,10 +4,10 @@ * Missing paths in writing process will be automatically created. * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -20,7 +20,7 @@ * 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 . + * along with this program. If not, see . */ class FileIOHandler extends BaseMiddleware { /** @@ -39,16 +39,16 @@ class FileIOHandler extends BaseMiddleware { private static $thisInstance = null; /** - * Private constructor + * Protected constructor * * @return void */ - private function __construct () { + protected function __construct () { // Call parent constructor - parent::constructor(__CLASS__); + parent::__construct(__CLASS__); // Set description - $this->setPartDescr("Datei-Ein-/Ausgabe-Handler"); + $this->setObjectDescription("Datei-Ein-/Ausgabe-Handler"); // Create an unique ID $this->createUniqueID(); diff --git a/inc/config.php b/inc/config.php index ab944bf11..9b307c07c 100644 --- a/inc/config.php +++ b/inc/config.php @@ -5,10 +5,10 @@ * configuration entries there. * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -21,7 +21,7 @@ * 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 . + * along with this program. If not, see . */ // Load the class from inc/config direktory @@ -141,5 +141,8 @@ $cfg->setConfigEntry("default_application", "selector"); // CFG: VERBOSE-LEVEL $cfg->setConfigEntry("verbose_level", 0); +// CFG: COMMAND-PARAMETER +$cfg->setConfigEntry("command_parameter", "page"); + // [EOF] ?> diff --git a/inc/config/class_FrameworkConfiguration.php b/inc/config/class_FrameworkConfiguration.php index fc920402b..6c81052d5 100644 --- a/inc/config/class_FrameworkConfiguration.php +++ b/inc/config/class_FrameworkConfiguration.php @@ -7,10 +7,10 @@ * * @see ClassLoader * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -23,7 +23,7 @@ * 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 . + * along with this program. If not, see . */ class FrameworkConfiguration { /** @@ -43,9 +43,9 @@ class FrameworkConfiguration { const EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND = 0xc01; /** - * Private constructor + * Protected constructor */ - private function __construct () { + protected function __construct () { // Empty for now } diff --git a/inc/config/config-override.php b/inc/config/config-override.php index 1f5e44fe4..2d33736d5 100644 --- a/inc/config/config-override.php +++ b/inc/config/config-override.php @@ -23,7 +23,7 @@ */ // CFG: DEFAULT-APPLICATION -$cfg->setConfigEntry("default_application", "hub"); +FrameworkConfiguration::getInstance()->setConfigEntry("default_application", "hub"); // [EOF] ?> diff --git a/inc/database.php b/inc/database.php index a8a9fcf41..ad29f0e49 100644 --- a/inc/database.php +++ b/inc/database.php @@ -3,10 +3,10 @@ * Initializes the database layer * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,7 +19,7 @@ * 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 . + * along with this program. If not, see . */ // Initialize layer @@ -54,34 +54,34 @@ unset($INC); try { $db = DatabaseConnection::createDatabaseConnection(DebugMiddleware::getInstance(), $layer); } catch (NullPointerException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", + ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: %s
\n", $e->getMessage() )); } catch (InvalidDirectoryResourceException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", + ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: %s
\n", $e->getMessage() )); } catch (PathIsEmptyException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", + ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: %s
\n", $e->getMessage() )); } catch (PathIsNoDirectoryException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", + ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: %s
\n", $e->getMessage() )); } catch (PathReadProtectedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", + ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: %s
\n", $e->getMessage() )); } catch (DirPointerNotOpenedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: %s
\n", + ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: %s
\n", $e->getMessage() )); } // Datenbankobjekt debuggen if (defined('DEBUG_DATABASE_OBJ')) { - DebugMiddleware::getInstance()->output(sprintf("Die Datenbank-Schicht sieht wie folgt aus:
+ DebugMiddleware::getInstance()->output(sprintf("The database sub-system does now look like this:
%s
\n", print_r($db, true) )); diff --git a/inc/language.php b/inc/language.php index c80654539..552dc4589 100644 --- a/inc/language.php +++ b/inc/language.php @@ -3,7 +3,7 @@ * Try to initializes the language system * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version * @@ -18,7 +18,7 @@ * 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 . + * along with this program. If not, see . */ try { $lang = LanguageSystem::createLanguageSystem(sprintf("%s%s", @@ -26,19 +26,19 @@ try { FrameworkConfiguration::getInstance()->readConfig("lang_base_path") )); } catch (LanguagePathIsEmptyException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: %s", + ApplicationEntryPoint::app_die(sprintf("[Main:] The language sub-system could not be initialized for the following reason: %s", $e->getMessage() )); } catch (InvalidLanguagePathStringException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: %s", + ApplicationEntryPoint::app_die(sprintf("[Main:] The language sub-system could not be initialized for the following reason: %s", $e->getMessage() )); } catch (LanguagePathIsNoDirectoryException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: %s", + ApplicationEntryPoint::app_die(sprintf("[Main:] The language sub-system could not be initialized for the following reason: %s", $e->getMessage() )); } catch (LanguagePathReadProtectedException $e) { - ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: %s", + ApplicationEntryPoint::app_die(sprintf("[Main:] The language sub-system could not be initialized for the following reason: %s", $e->getMessage() )); } diff --git a/inc/loader/class_ClassLoader.php b/inc/loader/class_ClassLoader.php index 61e8c216f..736649689 100644 --- a/inc/loader/class_ClassLoader.php +++ b/inc/loader/class_ClassLoader.php @@ -3,10 +3,10 @@ * This class loads class include files with a specific prefix and suffix * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,7 +19,7 @@ * 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 . + * along with this program. If not, see . * * ---------------------------------- * 1.1 @@ -274,15 +274,17 @@ class ClassLoader { // Set new prefix (temporary!) $this->prefix = "config-"; + $this->preLen = strlen($this->prefix); // Set base directory - $basePath = sprintf("%s/inc/config/", PATH); + $basePath = sprintf("%sinc/config/", PATH); // Load all classes from the config directory $this->loadClasses($basePath); // Set the prefix back $this->prefix = $oldPrefix; + $this->preLen = strlen($this->prefix); } } diff --git a/inc/output.php b/inc/output.php index 87e838432..20f3fe8f5 100644 --- a/inc/output.php +++ b/inc/output.php @@ -3,10 +3,10 @@ * Initializes the output middleware layer * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,13 +19,13 @@ * 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 . + * along with this program. If not, see . */ -// Debug-Ausgabe vorbereiten +// Get a debugger instance $debug = DebugMiddleware::createDebugMiddleware(FrameworkConfiguration::getInstance()->readConfig("debug_engine")); -// Leere Strings werden ignoriert und sollten zum Testen der Middleware genommen werden +// Empty string should be ignored and used for testing the middleware DebugMiddleware::getInstance()->output(""); // [EOF] diff --git a/inc/selector.php b/inc/selector.php index 23acabec7..2133c11e7 100644 --- a/inc/selector.php +++ b/inc/selector.php @@ -3,10 +3,10 @@ * The application selector main include file * * @author Roland Haeder - * @version 0.3.0 + * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.mxchange.org + * @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 @@ -19,7 +19,7 @@ * 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 . + * along with this program. If not, see . */ // Does the user has an application specified? @@ -52,11 +52,11 @@ $application = preg_replace('/([^a-z_-])+/i', "", $application); $configAppIncludes = array( sprintf("class_%s", FrameworkConfiguration::getInstance()->readConfig("app_helper_class")), // The ApplicationHelper class "config", // The application's own configuration - "init", // The application initializer - "loader", // The application's class loader + "init", // The application initializer + "loader", // The application's class loader "debug", // Some debugging stuff "exceptions", // The application's own exception handler - "starter", // The application starter (calls entryPoint(), etc.) + "starter", // The application starter (calls entryPoint(), etc.) ); // Load them all (try only) diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index 84b245d49..395185438 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -23,6 +23,25 @@ require_once("PHPUnit/Framework.php"); /** * A test case for the configuration sub system * + * @author Roland Haeder + * @version 0.3.0 + * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software + * @license GNU GPL 3.0 or any newer version + * @link http://www.mxchange.org + * @see http://www.phpunit.de + * + * 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 . */ class ConfigTest extends PHPUnit_Framework_TestCase { /** -- 2.39.5