Missing fixes applied
authorRoland Häder <roland@mxchange.org>
Mon, 5 May 2008 23:26:53 +0000 (23:26 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 5 May 2008 23:26:53 +0000 (23:26 +0000)
45 files changed:
application/hub/class_ApplicationHelper.php
application/hub/main/class_HubCommandProcessor.php
application/hub/main/class_HubConnector.php
application/hub/main/class_HubCoreLoop.php
application/hub/main/class_HubPeer.php
inc/classes.php
inc/classes/exceptions/main/class_GetterNotFoundException.php
inc/classes/exceptions/main/class_InvalidObjectException.php
inc/classes/exceptions/template/class_ViewHelperNotFoundException.php
inc/classes/interfaces/application/class_ManageableApplication.php
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/class_FrameworkArrayObject.php
inc/classes/main/compressor/class_Bzip2Compressor.php
inc/classes/main/compressor/class_GzipCompressor.php
inc/classes/main/compressor/class_NullCompressor.php
inc/classes/main/console/class_ConsoleTools.php
inc/classes/main/database/class_BaseDatabaseFrontend.php
inc/classes/main/database/classes/class_LocalFileDatabase.php
inc/classes/main/debug/class_DebugConsoleOutput.php
inc/classes/main/debug/class_DebugErrorLogOutput.php
inc/classes/main/debug/class_DebugWebOutput.php
inc/classes/main/extended/class_ObjectLimits.php
inc/classes/main/extended/class_SerializationContainer.php
inc/classes/main/io/class_FileIOStream.php
inc/classes/main/io/class_FrameworkDirectoryPointer.php
inc/classes/main/io/class_FrameworkFileInputPointer.php
inc/classes/main/io/class_FrameworkFileOutputPointer.php
inc/classes/main/language/class_LanguageSystem.php
inc/classes/main/output/class_ConsoleOutput.php
inc/classes/main/output/class_WebOutput.php
inc/classes/main/template/class_TemplateEngine.php
inc/classes/middleware/class_BaseMiddleware.php
inc/classes/middleware/compressor/class_CompressorChannel.php
inc/classes/middleware/database/class_DatabaseConnection.php
inc/classes/middleware/debug/class_DebugMiddleware.php
inc/classes/middleware/io/class_FileIOHandler.php
inc/config.php
inc/config/class_FrameworkConfiguration.php
inc/config/config-override.php
inc/database.php
inc/language.php
inc/loader/class_ClassLoader.php
inc/output.php
inc/selector.php
tests/ConfigTest.php

index 60409b70c56e2333e0eaaff768e963dc89288da5..696aee8fe5709b9ae3abc846b279a709d6da61c6 100644 (file)
@@ -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]
index c325928eb03b60bf7a219c702a1e921ab2d73586..7de18ec0f18f3d55a957d30203b313d301cf69a1 100644 (file)
@@ -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();
index 2b775c0317d3cce225f49f829dec6dc91541f68d..de87246bc15903f577c7d8506653eadab0f96810 100644 (file)
@@ -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();
index 5304fbea935267807bad2b51b631142a55c03f48..6e85a6d902f9f7151b820d32fdbd4994e013f5f8 100644 (file)
@@ -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();
index 4772a956a28cf817c9eecdbd04ce445300cc18e1..59e23ecb6769292da6d31293a6617691291f4f88 100644 (file)
@@ -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();
index 64e2bedc5861bfe5f940ac405c9aa0b3d55b791c..27034212b2dc4f79f9b2081463d9ee9ff63c236e 100644 (file)
@@ -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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 // 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 <strong>%s</strong> nicht laden. Reason: <strong>%s</strong>",
+               ApplicationEntryPoint::app_die(sprintf("[Main:] Could not load framework classes from path <strong>%s</strong> for the follwing reason: <strong>%s</strong>",
                        $class
                ));
        } catch (PathIsEmptyException $e) {
-               ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad <strong>%s</strong> nicht laden. Reason: <strong>%s</strong>",
+               ApplicationEntryPoint::app_die(sprintf("[Main:] Could not load framework classes from path <strong>%s</strong> for the follwing reason: <strong>%s</strong>",
                        $class
                ));
        } catch (PathReadProtectedException $e) {
-               ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad <strong>%s</strong> nicht laden. Reason: <strong>%s</strong>",
+               ApplicationEntryPoint::app_die(sprintf("[Main:] Could not load framework classes from path <strong>%s</strong> for the follwing reason: <strong>%s</strong>",
                        $class
                ));
        } catch (DirPointerNotOpenedException $e) {
-               ApplicationEntryPoint::app_die(sprintf("[Main:] Kann Framework-Klassen im Pfad <strong>%s</strong> nicht laden. Reason: <strong>%s</strong>",
+               ApplicationEntryPoint::app_die(sprintf("[Main:] Could not load framework classes from path <strong>%s</strong> for the follwing reason: <strong>%s</strong>",
                        $class
                ));
        }
index 64a402b2a3e2b19522001ae0d38f1019f30edd06..b03b21c8a787852b3abc73ed3bc39464a2662606 100644 (file)
@@ -3,10 +3,10 @@
  * An exception thrown when a getter for an attribute was not found
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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&uuml;r Attribut <u>%s</u> nicht gefunden.",
                        $dataArray[0]->__toString(),
index 9dca3438d830e1620b0e8bc96db312d83797b98e..cc19b753508d0cf5cd1a192cbd33e850595ab9e7 100644 (file)
@@ -3,10 +3,10 @@
  * An exception thrown when an instance variable instances a non-object 
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class InvalidObjectException extends FrameworkException {
        /**
@@ -34,7 +34,7 @@ class InvalidObjectException extends FrameworkException {
                $message = sprintf("[%s:%d] Objekte sind nicht erlaubt. (Objekt: <u>%s</u>)",
                        $class->__toString(),
                        $this->getLine(),
-                       $class->getPartDescr()
+                       $class->getObjectDescription()
                );
 
                // Call parent constructor
index 78cb6735eb239df8eca0d477db3d94c36a7fe5af..6cd771a136e5e5e71ff6fd6c0ff9c45ac50a5180 100644 (file)
@@ -3,10 +3,10 @@
  * An exception thrown when a given view helper was not found
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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 <u>%s</u> ist ung&uuml;ltig.",
+               $message = sprintf("[%s:%d] View-Helper <u>%s</u> ist ung&uuml;ltig.",
                        $msgArray[0]->__toString(),
+                       $this->getLine(),
                        $msgArray[1]
                );
 
index f342a0a7ca16fd5404e24e14af17e42ad7330e72..5bb3dac1bba97009a9d59ae746943e404093bb3d 100644 (file)
@@ -8,10 +8,10 @@
  * - And many more...
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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
         *
index 8ac8d31fb01a35b584214311eea9a8538ec7537a..4abdf2995886afc834c0f3ffefa31412df5de770 100644 (file)
@@ -4,10 +4,10 @@
  * class handles saving of games etc.
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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 <em>%s</em>", $this->__toString()));
+                       $this->setObjectDescription(sprintf("Entferntes Objekt <em>%s</em>", $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: <pre><em>%s</em></pre><br />\n",
+                               if (defined('DEBUG_EVAL')) $this->getDebugInstance()->output(sprintf("[%s:] Constructed PHP command: <pre><em>%s</em></pre><br />\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.<br />\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 <strong>%s</strong> gesetzt.<br />\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 <strong>%s</strong> angefordert.<br />\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 <strong>%s</strong> gesetzt.<br />\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 <strong>%s</strong> gesetzt.<br />\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.<br />\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.<br />\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.<br />\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.<br />\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 <strong>%s</strong> gesetzt.<br />\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 <u>%s</u>.<br />\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.<br />\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&uuml;ckgesetzt auf <u>%s</u>.<br />\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.<br />\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 <strong>%s</strong> gesetzt.<br />\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:] <strong>%s</strong>=<strong>%s</strong>?<br />\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:] <strong>%d</strong> wird umformatiert.<br />\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.<br />\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 <u>%s</u> angefordert.<br />\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: <pre><em>%s</em></pre><br />\n",
+                       $this->getDebugInstance()->output(sprintf("[%s:] Constructed PHP command: <pre><em>%s</em></pre><br />\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 = "<pre>".trim(print_r($this, true))."</pre>";
+
+               // Output it
+               ApplicationEntryPoint::app_die("<strong>Debug output:</strong>".$content);
+       }
 }
 
 // [EOF]
index 85397a41578b63ed0f80df4b0f480751d6ec76b1..910b4d8f4494d58f7a7b59566d3430950aa14ddb 100644 (file)
@@ -5,10 +5,10 @@
  * need more details.
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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
         *
index c0c475f44264dce3754bdc9027ca664212d8d122..88322b60c499484237dece225877fdf5fb1eb93e 100644 (file)
@@ -3,10 +3,10 @@
  * BZIP2 compression and decompression class
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
- * @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
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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.<br />\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.<br />\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 <strong>nicht</strong> gefunden.<br />\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.<br />\n",
-                       $this->__toString()
-               ));
                return "bz2";
        }
 }
index 0caae9f8090384fb26bd742fd3f4fc9d1e1ea126..4e95f801f95ef6214b85777c0396e438d6a6e919 100644 (file)
@@ -3,10 +3,10 @@
  * GZIP compression and decompression class
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
- * @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
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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.<br />\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.<br />\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 <strong>nicht</strong> gefunden.<br />\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.<br />\n",
-                       $this->__toString()
-               ));
                return "gz";
        }
 }
index 56b2d5f4f8b529d763cf5782177bfc076d255b27..a8a570c581487ca464c9f05002e2f2576dbe13ee 100644 (file)
@@ -3,10 +3,10 @@
  * Null compression and decompression class
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
- * @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
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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.<br />\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.<br />\n",
-                       $this->__toString()
-               ));
                return "null";
        }
 }
index 5ba9ae642c153a5da062da59fd33bbd9514f33f2..78dc94c90599370005620523741ce8311248bf40 100644 (file)
@@ -3,10 +3,10 @@
  * This class contains static helper functions for console applications
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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();
index b8f0d43541f808bbc6ef782d898b21552f7afc36..ac31d501f9205e7a03106db688815c21bd7fd42e 100644 (file)
@@ -4,10 +4,10 @@
  *
  * @see                        DatabaseFrontendInterface - An interface for database frontends (front-end to the application)
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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.<br />\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 <strong>%s</strong> angefordert.<br />\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 <strong>%s</strong> soll verwendet werden.<br />\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 <strong>%s</strong> wird verwendet und beinhaltet <strong>%s</strong> Eintr&auml;ge.<br />\n",
-                               $this->__toString(),
-                               $limitInstance->__toString(),
-                               $array->count()
-                       ));
                }
        }
 }
index ea4a8e19e49db057d7385fb2c677fe0092aa7391..84babfeafd6d6d0fcf8d1a0e1c23da517cbd0203 100644 (file)
@@ -5,10 +5,10 @@
  * This class serializes objects and saves them to local files.
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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.<br />\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 <strong>%s</strong> wird verwendet.<br />\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 <strong>%s</strong> soll in eine lokale Datei gespeichert werden.<br />\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 <strong>%s</strong> ist nach der Serialisierung <strong>%s</strong> Byte gross.<br />\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
         *
index 82bcd7f1fe8df8a9810456bc479847ae4af19f18..dfcfd36b4dbd22bcff7b182587f9b3a0ce983247 100644 (file)
@@ -3,10 +3,10 @@
  * A debug output class for the console (e.g. hub software)
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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();
index c8e62936e528147977d4082e2f75d020a10fbcbe..26b099d4134f229405717659190c14993ddb6d65 100644 (file)
@@ -3,10 +3,10 @@
  * A debug output class for PHP's error_log() command
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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();
index ee3ae81b4c8fe373bd9ac46d490e16ef90f30e8a..17faa197707408781efadb98fa0e3d3083ce863b 100644 (file)
@@ -3,10 +3,10 @@
  * A debug output class for the web browser
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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();
index 91dc519f8a4d4ba7b11c2a0488fe09711ec73242..75925c64820cdb87489453e5e44e33f5e5b2f051 100644 (file)
@@ -4,10 +4,10 @@
  * objects to the datatabase connection or else a lot heap would be saved.
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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();
index d32551c848746e02997dbeec4b97b68ae0795797..a0980e3d61f93fec58993f7ed775f3cbe1303ba4 100644 (file)
@@ -4,10 +4,10 @@
  * other classes
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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.<br />\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: <pre><em>%s</em></pre><br />\n",
+                               if (defined('DEBUG_EVAL')) $limitInstance->getDebugInstance()->output(sprintf("[%s:] Constructed PHP command: <pre><em>%s</em></pre><br />\n",
                                        $this->__toString(),
                                        htmlentities($eval)
                                ));
 
                                // Run it
-                               @eval($eval);
+                               eval($eval);
 
                                // Add this item to the container list
                                $containerInstance->append(array(
index 2eedf3c6aa17ea7edd2370dd96545ea2a51449c4..c9833465a84dd6757a94e947795848c84ea39303 100644 (file)
@@ -3,10 +3,10 @@
  * An universal class for file input/output streams.
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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();
index e8af81719df5c2ad1d9ca228b26fc600b79cfabe..5ad52ed709ec177ba36b7168d91f4a569aab0181 100644 (file)
@@ -3,10 +3,10 @@
  * A class for directory reading and getting its contents
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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();
index 534650ab5a3a7ef3bf23d4bf9c28771816dfa97d..a38b0a3d1d08e83270157aef05370ee931c9990f 100644 (file)
@@ -3,10 +3,10 @@
  * A class for reading files
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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();
index 59de4f6639d67a3ec9d0d2042cd951082ee4eee7..8cc07caaa78e8977afcc880e260611396aa08836 100644 (file)
@@ -3,10 +3,10 @@
  * A class for writing files
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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();
index 419a85658052f91d3e217286395d856294f473af..4aa9490c2e434b4ef08e2cd5cf74d897931aa799 100644 (file)
@@ -4,10 +4,10 @@
  * application and whole framework
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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();
index 374c2af4ae7182f3574f83847f5c779ea53221c3..5d2b1c13528ffd600544f6334dcdb0db0a9a1092 100644 (file)
@@ -4,10 +4,10 @@
  * for console output
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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();
index 40d425c70fe8d9c5489edaca422da4e50ec104cb..a687cea24ddacb6f1ddde77442573558e3f92035 100644 (file)
@@ -4,10 +4,10 @@
  * browser
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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();
index cc95918414a88b9b15e07deb361ed27896169054..e11b84d553c537104e487e13ade529ef7e0d28e6 100644 (file)
@@ -4,10 +4,10 @@
  * and emails.
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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 <strong>%s</strong> vom Typ <strong>%s</strong> wird geladen.<br />\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:] <strong>%s</strong> Byte Rohdaten geladen.<br />\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=<pre>".htmlentities($currEntry['value'])."</pre>\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']."=<pre>".htmlentities($currVariable['value'])."</pre>\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: <pre><em>%s</em></pre><br />\n",
+               if ((defined('DEBUG_EVAL')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Constructed PHP command: <pre><em>%s</em></pre><br />\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 <strong>%s</strong> 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 <strong>%s</strong> 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 <strong>%s</strong> 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]
index 88bc16e12b65998ffe7b62f743e9e1472cc6da75..1cc69f6d3fc99f00f3968b3fca6ce01c8eff8361 100644 (file)
@@ -3,10 +3,10 @@
  * An abstract middleware class for all other middlware classes
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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]
index 5d5017c6e65b846b34c2ddd233bea283ae5d194e..b5fa5654abed02b9cf166e1a4d3781ad212f939c 100644 (file)
@@ -3,10 +3,10 @@
  * Middleware class for selecting the right compressor channel
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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();
index e6adbbe6778b8cfb44eb5ecd4175ddcb7d9fd3c9..45b09ea29ce1fd8392b9082ea4b1c9e7538d393c 100644 (file)
@@ -3,10 +3,10 @@
  * Database selector class
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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();
index 5193532e1e0ee1cb1cca6bcd30a0094e2d8cc05c..f46dbb5e065e3d3353a9429bf531879a4d32cd59 100644 (file)
@@ -5,10 +5,10 @@
  * become deprecated soon.
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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"))) {
index 7e624cccf7e2b6bfabf056e46f26551367e30dc1..8c7a47aa98c084c69b7153da38244f4e83bd2112 100644 (file)
@@ -4,10 +4,10 @@
  * Missing paths in writing process will be automatically created.
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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();
index ab944bf11599b7057a678acae0b6e900d0866fb2..9b307c07cb3e87a934504594ca006d41303d8b46 100644 (file)
@@ -5,10 +5,10 @@
  * configuration entries there.
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 // 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]
 ?>
index fc920402b4dc664576b8886f35829cbb9e0c83f8..6c81052d52ae1e4b41a268891ae847539d6e377a 100644 (file)
@@ -7,10 +7,10 @@
  *
  * @see                        ClassLoader
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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
        }
 
index 1f5e44fe444e222be4ae62837b066777e99c6bec..2d33736d516b993412ad2dbbf024e8735e5ea5b6 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 // CFG: DEFAULT-APPLICATION
-$cfg->setConfigEntry("default_application", "hub");
+FrameworkConfiguration::getInstance()->setConfigEntry("default_application", "hub");
 
 // [EOF]
 ?>
index a8a9fcf41667c3c581e3c336a88de4c5f57bce44..ad29f0e495bf58a3c731bd70e596c30de1701f8d 100644 (file)
@@ -3,10 +3,10 @@
  * Initializes the database layer
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 // 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: <strong>%s</strong><br />\n",
+       ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: <strong>%s</strong><br />\n",
                $e->getMessage()
        ));
 } catch (InvalidDirectoryResourceException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
+       ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: <strong>%s</strong><br />\n",
                $e->getMessage()
        ));
 } catch (PathIsEmptyException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
+       ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: <strong>%s</strong><br />\n",
                $e->getMessage()
        ));
 } catch (PathIsNoDirectoryException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
+       ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: <strong>%s</strong><br />\n",
                $e->getMessage()
        ));
 } catch (PathReadProtectedException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
+       ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: <strong>%s</strong><br />\n",
                $e->getMessage()
        ));
 } catch (DirPointerNotOpenedException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Datenbank-System nicht initialisiert. Reason: <strong>%s</strong><br />\n",
+       ApplicationEntryPoint::app_die(sprintf("[Main:] Database sub-system not initialized for the follwing reason: <strong>%s</strong><br />\n",
                $e->getMessage()
        ));
 }
 
 // Datenbankobjekt debuggen
 if (defined('DEBUG_DATABASE_OBJ')) {
-       DebugMiddleware::getInstance()->output(sprintf("Die Datenbank-Schicht sieht wie folgt aus:<br />
+       DebugMiddleware::getInstance()->output(sprintf("The database sub-system does now look like this:<br />
 <pre>%s</pre>\n",
                print_r($db, true)
        ));
index c806545399656b92b20c528532441b73ef6bd63d..552dc45894955c2c4be3bdd27f58e03f0760b070 100644 (file)
@@ -3,7 +3,7 @@
  * Try to initializes the language system
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 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: <strong>%s</strong>",
+       ApplicationEntryPoint::app_die(sprintf("[Main:] The language sub-system could not be initialized for the following reason: <strong>%s</strong>",
                $e->getMessage()
        ));
 } catch (InvalidLanguagePathStringException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: <strong>%s</strong>",
+       ApplicationEntryPoint::app_die(sprintf("[Main:] The language sub-system could not be initialized for the following reason: <strong>%s</strong>",
                $e->getMessage()
        ));
 } catch (LanguagePathIsNoDirectoryException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: <strong>%s</strong>",
+       ApplicationEntryPoint::app_die(sprintf("[Main:] The language sub-system could not be initialized for the following reason: <strong>%s</strong>",
                $e->getMessage()
        ));
 } catch (LanguagePathReadProtectedException $e) {
-       ApplicationEntryPoint::app_die(sprintf("[Main:] Sprachsystem konnte nicht initialisiert werden. Reason: <strong>%s</strong>",
+       ApplicationEntryPoint::app_die(sprintf("[Main:] The language sub-system could not be initialized for the following reason: <strong>%s</strong>",
                $e->getMessage()
        ));
 }
index 61e8c216ffe532bb1875c22423acadb39135cb48..736649689127d55193e5c1a07dc5a9d085253f8a 100644 (file)
@@ -3,10 +3,10 @@
  * This class loads class include files with a specific prefix and suffix
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  *
  * ----------------------------------
  * 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);
        }
 }
 
index 87e838432964783d606c1c30bd6a74504be80dc0..20f3fe8f5b7741944e64a20680a6b2f86298bcd4 100644 (file)
@@ -3,10 +3,10 @@
  * Initializes the output middleware layer
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
-// 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]
index 23acabec7e0b0762217fb48c040c449648d9dea1..2133c11e742dbc7babcdf75dd93bd3f9d41e7e87 100644 (file)
@@ -3,10 +3,10 @@
  * The application selector main include file
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @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 <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
 // 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)
index 84b245d49677cf2768a01e47ec305864946a0c8a..395185438c9f8792a567c9a5e47e99e7bd5ed927 100644 (file)
@@ -23,6 +23,25 @@ require_once("PHPUnit/Framework.php");
 /**
  * A test case for the configuration sub system
  *
+ * @author             Roland Haeder <webmaster@mxchange.org>
+ * @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 <http://www.gnu.org/licenses/>.
  */
 class ConfigTest extends PHPUnit_Framework_TestCase {
        /**