*
* @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();
// 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]
parent::constructor(__CLASS__);
// Set description
- $this->setPartDescr("Hub-Command-Processor");
+ $this->setObjectDescription("Hub-Command-Processor");
// Set unique ID
$this->createUniqueID();
parent::constructor(__CLASS__);
// Set description
- $this->setPartDescr("Hub-Connector");
+ $this->setObjectDescription("Hub-Connector");
// Set unique ID
$this->createUniqueID();
parent::constructor(__CLASS__);
// Set description
- $this->setPartDescr("Hub-Core Loop");
+ $this->setObjectDescription("Hub-Core Loop");
// Set unique ID
$this->createUniqueID();
parent::constructor(__CLASS__);
// Set description
- $this->setPartDescr("Hub-Peer");
+ $this->setObjectDescription("Hub-Peer");
// Set unique ID
$this->createUniqueID();
* 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
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
));
}
* 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
* 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 {
/**
* @param $code Code number for the exception
* @return void
*/
- public function __construct ($dataArray, $code) {
- // Cast the array
- $dataArray = (array) $dataArray;
-
+ public function __construct (array $dataArray, $code) {
// Add a message around the missing class
$message = sprintf("[%s:%d] Getter-Methode für Attribut <u>%s</u> nicht gefunden.",
$dataArray[0]->__toString(),
* 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
* 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 {
/**
$message = sprintf("[%s:%d] Objekte sind nicht erlaubt. (Objekt: <u>%s</u>)",
$class->__toString(),
$this->getLine(),
- $class->getPartDescr()
+ $class->getObjectDescription()
);
// Call parent constructor
* 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
* 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 {
/**
*/
public function __construct (array $msgArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:] View-Helper <u>%s</u> ist ungültig.",
+ $message = sprintf("[%s:%d] View-Helper <u>%s</u> ist ungültig.",
$msgArray[0]->__toString(),
+ $this->getLine(),
$msgArray[1]
);
* - 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
* 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 {
/**
*/
function setAppShortName ($shortName);
+ /**
+ * Getter for master template name
+ *
+ * @return $masterTemplate Name of the master template
+ */
+ function getMasterTemplate ();
+
/**
* Launches the application
*
* 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
* 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 {
/**
*/
private $dbInstance = null;
+ /**
+ * Instance to an application helper class
+ */
+ private $applicationInstance = null;
+
/**
* The real class name
*/
/**
* 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
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
*--------------------------------------------------------------------*
*/
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
);
/**
*
* @return void
*/
- private function __construct ($class) {
+ protected function __construct ($class) {
// Set real class
$this->setRealClass($class);
+
+ // Init this instance
+ $this->initInstance($class);
}
/**
}
// 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()))) {
}
/**
- * 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());
);
// 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)
));
$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;
}
/**
* @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;
}
/**
*/
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()
- ));
}
/**
*/
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()
- ));
}
/**
* @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;
}
* @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;
}
* @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;
// 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);
$this->__toString(),
md5(sprintf("%s:%s:%s:%s:%s:%s",
$this->__toString(),
- $this->getPartDescr(),
+ $this->getObjectDescription(),
time(),
getenv('REMOTE_ADDR'),
getenv('SERVER_ADDR'),
// 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;
}
* @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;
}
public final function resetUniqueID() {
// Sweet and simple... ;-)
$newUniqueID = $this->generateIdNumber();
- if ((defined('DEBUG_SYSTEM')) && (is_object($this->getDebugInstance()))) $this->getDebugInstance()->output(sprintf("[%s:] Unique-ID zurückgesetzt auf <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;
}
/**
* 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;
}
/**
(
$this->__toString() == $itemInstance->__toString()
) && (
- $this->getPartDescr() == $itemInstance->getPartDescr()
+ $this->getObjectDescription() == $itemInstance->getObjectDescription()
)
);
}
* @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);
}
// 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",
* @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);
}
* @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;
}
$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
* 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,
// 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)
));
// 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]
* 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
*
* 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();
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
* @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";
}
}
* 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();
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
/**
* 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) {
/**
* 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) {
* @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";
}
}
* 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();
/**
* 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) {
/**
* 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) {
/**
* 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";
}
}
* 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();
*
* @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
* 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 {
/**
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;
}
* @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();
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äge.<br />\n",
- $this->__toString(),
- $limitInstance->__toString(),
- $array->count()
- ));
}
}
}
* 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
* 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 {
/**
*
* @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();
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);
// 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;
}
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();
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
*
* 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();
* 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();
* 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();
* 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
* 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 {
/**
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();
* 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
* 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 {
/**
*/
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__);
}
/**
);
// 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(
* 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();
* 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
* 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 {
/**
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();
* 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
* 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 {
/**
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();
* 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
* 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 {
/**
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();
* 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
* 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 {
/**
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();
* 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
* 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 {
/**
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();
* 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 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();
* 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
* 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 {
/**
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();
/**
* 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
* 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
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
*
private function addVariable ($var, $value) {
// Add it to the stack
$this->varStack->append(array(
- 'name' => $var,
- 'value' => $value
+ 'name' => trim($var),
+ 'value' => trim($value)
));
}
* 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();
// 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);
/**
* 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
* [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();
// 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( ...
* @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();
// Set the new raw data
$this->setRawTemplateData($rawData);
- }
- }
+
+ } // END - if
+
+ } // END - foreach
}
/**
* @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) {
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!");
}
* @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);
} // 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
*
// 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
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);
}
/**
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
$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)) {
// 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 ...
}
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;
}
);
// 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]
* 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]
* 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();
* 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
* 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
// 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();
* 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
* 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 {
/**
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();
);
// Run the constructed name
- @eval($eval);
+ eval($eval);
// Was this successfull?
if ((is_object($debuggerClass)) && (method_exists($debuggerClass, "outputStream"))) {
* 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
* 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 {
/**
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();
* 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
* 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
// CFG: VERBOSE-LEVEL
$cfg->setConfigEntry("verbose_level", 0);
+// CFG: COMMAND-PARAMETER
+$cfg->setConfigEntry("command_parameter", "page");
+
// [EOF]
?>
*
* @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
* 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 {
/**
const EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND = 0xc01;
/**
- * Private constructor
+ * Protected constructor
*/
- private function __construct () {
+ protected function __construct () {
// Empty for now
}
*/
// CFG: DEFAULT-APPLICATION
-$cfg->setConfigEntry("default_application", "hub");
+FrameworkConfiguration::getInstance()->setConfigEntry("default_application", "hub");
// [EOF]
?>
* 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
* 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
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)
));
* 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
*
* 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",
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()
));
}
* 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
* 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
// 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);
}
}
* 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]
* 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
* 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?
$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)
/**
* 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 {
/**