From 11c0ba60cb6c044928f41e93cc98d214b1d8ad7c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 28 May 2008 19:06:00 +0000 Subject: [PATCH] More style convensions applied, interface updated --- .../selector/class_ApplicationHelper.php | 11 +++++ .../selector/class_ApplicationSelector.php | 28 +++++-------- application/selector/init.php | 4 +- application/selector/loader.php | 2 +- application/selector/starter.php | 10 ++--- .../ship-simu/class_ApplicationHelper.php | 25 +++++++++--- application/ship-simu/init.php | 2 +- application/ship-simu/loader.php | 2 +- application/ship-simu/main/class_Merchant.php | 10 ----- .../ship-simu/main/class_WorksContract.php | 10 ----- .../main/companies/class_ShippingCompany.php | 17 -------- .../main/constructions/berths/class_Berth.php | 17 -------- .../constructions/docks/class_DryDock.php | 17 -------- .../constructions/harbors/class_Harbor.php | 17 -------- .../terminals/class_Terminal.php | 17 -------- .../constructions/yards/class_Shipyard.php | 22 ---------- .../main/drives/motor/class_Motor.php | 17 -------- .../parts/maschineroom/class_MaschineRoom.php | 17 -------- .../ships/passenger/class_PassengerShip.php | 23 +++++------ .../extended/cabines/class_BaseCabin.php | 17 -------- .../extended/decks/class_BaseDeck.php | 10 ----- .../extended/upper/class_Bridge.php | 17 -------- application/ship-simu/starter.php | 10 ++--- ...s_InvalidTemplateVariableNameException.php | 2 +- .../class_ManageableApplication.php | 9 +++++ .../main/class_BaseFrameworkSystem.php | 24 ++++++----- .../commands/web/class_WebHomeCommand.php | 4 +- .../commands/web/class_WebRegisterCommand.php | 4 +- .../form/class_WebDoFormController.php | 15 +++---- .../main/factories/web/class_NewsFactory.php | 2 +- .../main/helper/web/class_WebFormHelper.php | 14 +++---- .../main/language/class_LanguageSystem.php | 24 ++++++++++- .../main/output/class_ConsoleOutput.php | 2 +- .../main/request/class_HttpRequest.php | 15 ++++++- .../resolver/web/class_WebCommandResolver.php | 8 ++-- .../web/class_WebControllerResolver.php | 4 +- .../main/response/class_HttpResponse.php | 40 ++++++++++++++++--- .../main/template/class_TemplateEngine.php | 20 +++++----- .../compressor/class_CompressorChannel.php | 2 +- inc/loader/class_ClassLoader.php | 10 ++--- inc/selector.php | 2 +- 41 files changed, 203 insertions(+), 320 deletions(-) diff --git a/application/selector/class_ApplicationHelper.php b/application/selector/class_ApplicationHelper.php index feafd24..3452f96 100644 --- a/application/selector/class_ApplicationHelper.php +++ b/application/selector/class_ApplicationHelper.php @@ -193,6 +193,17 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica // Insert all application templates $selInstance->insertApplicationTemplates(); } + + /** + * Handle the indexed array of fatal messages and puts them out in an + * acceptable fasion + * + * @param $messageList An array of fatal messages + * @return void + */ + public function handleFatalMessages (array $messageList) { + die("
".print_r($messageList, true)."
"); + } } // [EOF] diff --git a/application/selector/class_ApplicationSelector.php b/application/selector/class_ApplicationSelector.php index 2af2f70..03e03ef 100644 --- a/application/selector/class_ApplicationSelector.php +++ b/application/selector/class_ApplicationSelector.php @@ -141,9 +141,9 @@ class ApplicationSelector extends BaseFrameworkSystem { } elseif (!is_object($app)) { // Not an object throw new NoObjectException($app, self::EXCEPTION_IS_NO_OBJECT); - } elseif (!method_exists($app, $this->getConfigInstance()->readConfig("entry_method"))) { + } elseif (!method_exists($app, $this->getConfigInstance()->readConfig('entry_method'))) { // Method not found! - throw new MissingMethodException(array($app, $this->getConfigInstance()->readConfig("entry_method")), self::EXCEPTION_MISSING_METHOD); + throw new MissingMethodException(array($app, $this->getConfigInstance()->readConfig('entry_method')), self::EXCEPTION_MISSING_METHOD); } // Add the current instance to the list @@ -186,7 +186,7 @@ class ApplicationSelector extends BaseFrameworkSystem { * @return $shortName This selector's short name */ public function getAppShortName() { - $shortName = $this->getConfigInstance()->readConfig("selector_path"); + $shortName = $this->getConfigInstance()->readConfig('selector_path'); return $shortName; } @@ -212,11 +212,11 @@ class ApplicationSelector extends BaseFrameworkSystem { // Generate the base path for all applications $appBasePath = sprintf("%s%s/", PATH, - $this->getConfigInstance()->readConfig("application_path") + $this->getConfigInstance()->readConfig('application_path') ); // Add the selector path to the ignore list - $this->addDirIgnoreList($this->getConfigInstance()->readConfig("selector_path")); + $this->addDirIgnoreList($this->getConfigInstance()->readConfig('selector_path')); // Get a directory pointer for the application path $dirInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($appBasePath); @@ -233,7 +233,7 @@ class ApplicationSelector extends BaseFrameworkSystem { // Is this a readable directory? (files will be ignored silently) if ((is_dir($fqfn)) && (is_readable($fqfn))) { // Then get the init.php script for analyzing - $initScript = sprintf("%s/init%s", $fqfn, $this->getConfigInstance()->readConfig("php_extension")); + $initScript = sprintf("%s/init%s", $fqfn, $this->getConfigInstance()->readConfig('php_extension')); // Load the application's init.php script and append the // application to the ArrayObject @@ -266,7 +266,7 @@ class ApplicationSelector extends BaseFrameworkSystem { // Try to load the web template $tplEngine->loadWebTemplate(sprintf("%s_%s", - $this->getConfigInstance()->readConfig("tpl_selector_prefix"), + $this->getConfigInstance()->readConfig('tpl_selector_prefix'), strtolower($appInstance->getAppShortName()) )); @@ -301,7 +301,7 @@ class ApplicationSelector extends BaseFrameworkSystem { $tplEngine = $this->prepareTemplateEngine($this); // Load the selector's template - $tplEngine->loadCodeTemplate($this->getConfigInstance()->readConfig("selector_main_tpl")); + $tplEngine->loadCodeTemplate($this->getConfigInstance()->readConfig('selector_main_tpl')); // Now store it in the class $this->setSelectorTemplateEngine($tplEngine); @@ -323,7 +323,7 @@ class ApplicationSelector extends BaseFrameworkSystem { $tplEngine = $this->prepareTemplateEngine($this); // Load template which shall later hold all application templates - $tplEngine->loadCodeTemplate($this->getConfigInstance()->readConfig("selector_apps_tpl")); + $tplEngine->loadCodeTemplate($this->getConfigInstance()->readConfig('selector_apps_tpl')); // Add all loaded application templates together $dummy = ""; @@ -349,16 +349,6 @@ class ApplicationSelector extends BaseFrameworkSystem { } // END - for } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } } // [EOF] diff --git a/application/selector/init.php b/application/selector/init.php index cf84d68..6a02f97 100644 --- a/application/selector/init.php +++ b/application/selector/init.php @@ -28,14 +28,14 @@ // // Get an instance of the initializer $eval = sprintf("\$app = %s::getInstance();", - FrameworkConfiguration::getInstance()->readConfig("app_helper_class") + FrameworkConfiguration::getInstance()->readConfig('app_helper_class') ); eval($eval); // Set application name and version $app->setAppName("Applikationsauswähler"); $app->setAppVersion("0.1a"); -$app->setAppShortName(FrameworkConfiguration::getInstance()->readConfig("selector_name")); +$app->setAppShortName(FrameworkConfiguration::getInstance()->readConfig('selector_name')); // Initialize output system require(PATH . 'inc/output.php'); diff --git a/application/selector/loader.php b/application/selector/loader.php index 71c44c6..aafbd38 100644 --- a/application/selector/loader.php +++ b/application/selector/loader.php @@ -28,7 +28,7 @@ if (!isset($application)) { } // Load all classes -ClassLoader::getInstance()->loadClasses(sprintf("%s/%s/", FrameworkConfiguration::getInstance()->readConfig("application_path"), $application)); +ClassLoader::getInstance()->loadClasses(sprintf("%s/%s/", FrameworkConfiguration::getInstance()->readConfig('application_path'), $application)); // Include all classes ClassLoader::getInstance()->includeAllClasses(); diff --git a/application/selector/starter.php b/application/selector/starter.php index a4b17b3..ca9d294 100644 --- a/application/selector/starter.php +++ b/application/selector/starter.php @@ -30,26 +30,26 @@ if ((empty($app)) || (is_null($app))) { // Something went wrong! ApplicationEntryPoint::app_die(sprintf("[Main:] The application %s could not be launched because the helper class %s is not loaded.", $application, - FrameworkConfiguration::getInstance()->readConfig("app_helper_class") + FrameworkConfiguration::getInstance()->readConfig('app_helper_class') )); } elseif (!is_object($app)) { // No object! ApplicationEntryPoint::app_die(sprintf("[Main:] The application %s could not be launched because 'app' is not an object.", $application )); -} elseif (!method_exists($app, FrameworkConfiguration::getInstance()->readConfig("entry_method"))) { +} elseif (!method_exists($app, FrameworkConfiguration::getInstance()->readConfig('entry_method'))) { // Method not found! ApplicationEntryPoint::app_die(sprintf("[Main:] The application %s could not be launched because the method %s is missing.", $application, - FrameworkConfiguration::getInstance()->readConfig("entry_method") + FrameworkConfiguration::getInstance()->readConfig('entry_method') )); } // Call the entry point method try { $eval = sprintf("%s::getInstance()->%s();", - FrameworkConfiguration::getInstance()->readConfig("app_helper_class"), - FrameworkConfiguration::getInstance()->readConfig("entry_method") + FrameworkConfiguration::getInstance()->readConfig('app_helper_class'), + FrameworkConfiguration::getInstance()->readConfig('entry_method') ); eval($eval); } catch (FrameworkException $e) { diff --git a/application/ship-simu/class_ApplicationHelper.php b/application/ship-simu/class_ApplicationHelper.php index 0e26385..407b588 100644 --- a/application/ship-simu/class_ApplicationHelper.php +++ b/application/ship-simu/class_ApplicationHelper.php @@ -60,11 +60,15 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica */ private $masterTemplate = "shipsimu_main"; + /** + * An instance of a controller + */ + private $controllerInstance = null; + /** * An instance of this class */ private static $thisInstance = null; - /** * Protected constructor * @@ -184,24 +188,35 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica $responseInstance = HttpResponse::createHttpResponse($this); // Get command parameter - $commandPara = $this->getConfigInstance()->readConfig("command_parameter"); + $commandPara = $this->getConfigInstance()->readConfig('command_parameter'); // Get the parameter from the request $commandName = $requestInstance->getRequestElement($commandPara); // If it is null then get default command if (is_null($commandName)) { - $commandName = $this->getConfigInstance()->readConfig("default_command"); + $commandName = $this->getConfigInstance()->readConfig('default_command'); } // Get a resolver $resolverInstance = WebControllerResolver::createWebControllerResolver($commandName, $this); // Get a new controller instance as well - $controllerInstance = $resolverInstance->resolveCommandController(); + $this->controllerInstance = $resolverInstance->resolveCommandController(); // Handle the request - $controllerInstance->handleRequest($requestInstance, $responseInstance); + $this->controllerInstance->handleRequest($requestInstance, $responseInstance); + } + + /** + * Handle the indexed array of fatal messages and puts them out in an + * acceptable fasion + * + * @param $messageList An array of fatal messages + * @return void + */ + public function handleFatalMessages (array $messageList) { + die("
".print_r($messageList, true)."
"); } } diff --git a/application/ship-simu/init.php b/application/ship-simu/init.php index 3719970..ffc577c 100644 --- a/application/ship-simu/init.php +++ b/application/ship-simu/init.php @@ -35,7 +35,7 @@ // Get an instance of the helper $eval = sprintf("\$app = %s::getInstance();", - FrameworkConfiguration::getInstance()->readConfig("app_helper_class") + FrameworkConfiguration::getInstance()->readConfig('app_helper_class') ); eval($eval); diff --git a/application/ship-simu/loader.php b/application/ship-simu/loader.php index 0dffa20..35ecc29 100644 --- a/application/ship-simu/loader.php +++ b/application/ship-simu/loader.php @@ -32,7 +32,7 @@ if (!isset($application)) { foreach ($lowerClasses as $class) { // Try to load the application classes try { - ClassLoader::getInstance()->loadClasses(sprintf("%s/%s/%s", FrameworkConfiguration::getInstance()->readConfig("application_path"), $application, $class)); + ClassLoader::getInstance()->loadClasses(sprintf("%s/%s/%s", FrameworkConfiguration::getInstance()->readConfig('application_path'), $application, $class)); } catch (PathIsNoDirectoryException $e) { ApplicationEntryPoint::app_die(sprintf("[Main:%s] Kann Applikationsklassen im Pfad %s nicht laden. Grund: %s", $application, diff --git a/application/ship-simu/main/class_Merchant.php b/application/ship-simu/main/class_Merchant.php index 0d4ff10..24d21b6 100644 --- a/application/ship-simu/main/class_Merchant.php +++ b/application/ship-simu/main/class_Merchant.php @@ -184,16 +184,6 @@ class Merchant extends BaseFrameworkSystem { // Return price return $price; } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } } // [EOF] diff --git a/application/ship-simu/main/class_WorksContract.php b/application/ship-simu/main/class_WorksContract.php index cd2f045..96ce70d 100644 --- a/application/ship-simu/main/class_WorksContract.php +++ b/application/ship-simu/main/class_WorksContract.php @@ -440,16 +440,6 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract { // Return total price return $totalPrice; } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } } // [EOF] diff --git a/application/ship-simu/main/companies/class_ShippingCompany.php b/application/ship-simu/main/companies/class_ShippingCompany.php index dec3a32..0ae0a1e 100644 --- a/application/ship-simu/main/companies/class_ShippingCompany.php +++ b/application/ship-simu/main/companies/class_ShippingCompany.php @@ -646,23 +646,6 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner // Set the merchant in the contract (for getting prices) $contractInstance->setMerchantInstance($merchantInstance); } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } } // [EOF] diff --git a/application/ship-simu/main/constructions/berths/class_Berth.php b/application/ship-simu/main/constructions/berths/class_Berth.php index 160b7bf..7d46833 100644 --- a/application/ship-simu/main/constructions/berths/class_Berth.php +++ b/application/ship-simu/main/constructions/berths/class_Berth.php @@ -39,23 +39,6 @@ class Berth extends BaseConstruction { // Generate unique ID number $this->createUniqueID(); } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } } // [EOF] diff --git a/application/ship-simu/main/constructions/docks/class_DryDock.php b/application/ship-simu/main/constructions/docks/class_DryDock.php index 5209b56..b69692a 100644 --- a/application/ship-simu/main/constructions/docks/class_DryDock.php +++ b/application/ship-simu/main/constructions/docks/class_DryDock.php @@ -36,23 +36,6 @@ class DryDock extends BaseConstruction { // Generate unique ID number $this->createUniqueID(); } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } } // [EOF] diff --git a/application/ship-simu/main/constructions/harbors/class_Harbor.php b/application/ship-simu/main/constructions/harbors/class_Harbor.php index 3bdc297..8922c42 100644 --- a/application/ship-simu/main/constructions/harbors/class_Harbor.php +++ b/application/ship-simu/main/constructions/harbors/class_Harbor.php @@ -110,23 +110,6 @@ class Harbor extends BaseConstruction { // Werft generieren und in die Werftliste aufnehmen $this->shipyardList->append(Shipyard::createShipyard($this, $shipyardName)); } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } } // [EOF] diff --git a/application/ship-simu/main/constructions/terminals/class_Terminal.php b/application/ship-simu/main/constructions/terminals/class_Terminal.php index ad0a631..d8fa8a0 100644 --- a/application/ship-simu/main/constructions/terminals/class_Terminal.php +++ b/application/ship-simu/main/constructions/terminals/class_Terminal.php @@ -36,23 +36,6 @@ class Terminal extends BaseConstruction { // Generate unique ID number $this->createUniqueID(); } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } } // [EOF] diff --git a/application/ship-simu/main/constructions/yards/class_Shipyard.php b/application/ship-simu/main/constructions/yards/class_Shipyard.php index 61d2500..7df6e91 100644 --- a/application/ship-simu/main/constructions/yards/class_Shipyard.php +++ b/application/ship-simu/main/constructions/yards/class_Shipyard.php @@ -166,11 +166,6 @@ class Shipyard extends BaseConstruction { // Add new personell public function addNewPersonell ($personell) { - if (is_null($this->staffList)) { - // Opps, not initialized! - ApplicationEntryPoint::app_die("New personell:
".print_r($this, true)."
"); - } - // Add to list $this->staffList->append($personell); } @@ -231,23 +226,6 @@ class Shipyard extends BaseConstruction { // Return result return $result; } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } } // [EOF] diff --git a/application/ship-simu/main/drives/motor/class_Motor.php b/application/ship-simu/main/drives/motor/class_Motor.php index 77e2ba9..b8f5377 100644 --- a/application/ship-simu/main/drives/motor/class_Motor.php +++ b/application/ship-simu/main/drives/motor/class_Motor.php @@ -67,23 +67,6 @@ class Motor extends BaseDrive implements TradeableItem, ConstructableShipPart { public function isTradeable () { return true; } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } } // [EOF] diff --git a/application/ship-simu/main/parts/maschineroom/class_MaschineRoom.php b/application/ship-simu/main/parts/maschineroom/class_MaschineRoom.php index 1329eac..78ae998 100644 --- a/application/ship-simu/main/parts/maschineroom/class_MaschineRoom.php +++ b/application/ship-simu/main/parts/maschineroom/class_MaschineRoom.php @@ -56,23 +56,6 @@ class MaschineRoom extends BaseShipPart { // Instanz zurueckgeben return $roomInstance; } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } } // [EOF] diff --git a/application/ship-simu/main/ships/passenger/class_PassengerShip.php b/application/ship-simu/main/ships/passenger/class_PassengerShip.php index 3340a68..4e0dd19 100644 --- a/application/ship-simu/main/ships/passenger/class_PassengerShip.php +++ b/application/ship-simu/main/ships/passenger/class_PassengerShip.php @@ -123,20 +123,17 @@ class PassengerShip extends BaseShip implements ConstructableShip, LimitableObje } /** - * Stub! + * Reduces the volume of a processed object. + * + * @param $limitInstance An instance to ObjectLimits which holds + * attribute names that we want to include in the processing + * phase. Other attributes except $uniqueID and $realClass will + * be ignored and keept out. + * @return void */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); + function limitObject (ObjectLimits $limitInstance) { + // Work in progress + $this->partialStub("Unfinished method called."); } } diff --git a/application/ship-simu/main/structures/extended/cabines/class_BaseCabin.php b/application/ship-simu/main/structures/extended/cabines/class_BaseCabin.php index ede1c4e..6a9bb6b 100644 --- a/application/ship-simu/main/structures/extended/cabines/class_BaseCabin.php +++ b/application/ship-simu/main/structures/extended/cabines/class_BaseCabin.php @@ -35,23 +35,6 @@ class BaseCabin extends BaseCabinStructure { public final function isCabin () { return ($this->isClass("BaseCabin")); } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } } // [EOF] diff --git a/application/ship-simu/main/structures/extended/decks/class_BaseDeck.php b/application/ship-simu/main/structures/extended/decks/class_BaseDeck.php index 292d8ae..3675784 100644 --- a/application/ship-simu/main/structures/extended/decks/class_BaseDeck.php +++ b/application/ship-simu/main/structures/extended/decks/class_BaseDeck.php @@ -32,16 +32,6 @@ class BaseDeck extends BaseDeckStructure { // Set description $this->setObjectDescription("Allgemeines Deck"); } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } } // [EOF] diff --git a/application/ship-simu/main/structures/extended/upper/class_Bridge.php b/application/ship-simu/main/structures/extended/upper/class_Bridge.php index bbd873b..b0841d2 100644 --- a/application/ship-simu/main/structures/extended/upper/class_Bridge.php +++ b/application/ship-simu/main/structures/extended/upper/class_Bridge.php @@ -62,23 +62,6 @@ class Bridge extends BaseUpperStructure implements TradeableItem, ConstructableS public function isTradeable () { return true; } - - /** - * Stub! - */ - public function saveObjectToDatabase () { - $this->getDebugInstance()->output(sprintf("[%s:] Stub %s erreicht.", - $this->__toString(), - __FUNCTION__ - )); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - ApplicationEntryPoint::app_die("".__METHOD__." reached! Stub!"); - } } // [EOF] diff --git a/application/ship-simu/starter.php b/application/ship-simu/starter.php index 7086fda..468848d 100644 --- a/application/ship-simu/starter.php +++ b/application/ship-simu/starter.php @@ -31,26 +31,26 @@ if ((empty($app)) || (is_null($app))) { // Something went wrong! ApplicationEntryPoint::app_die(sprintf("[Main:] The application %s could not be launched because the helper class %s is not loaded.", $application, - FrameworkConfiguration::getInstance()->readConfig("app_helper_class") + FrameworkConfiguration::getInstance()->readConfig('app_helper_class') )); } elseif (!is_object($app)) { // No object! ApplicationEntryPoint::app_die(sprintf("[Main:] The application %s could not be launched because 'app' is not an object.", $application )); -} elseif (!method_exists($app, FrameworkConfiguration::getInstance()->readConfig("entry_method"))) { +} elseif (!method_exists($app, FrameworkConfiguration::getInstance()->readConfig('entry_method'))) { // Method not found! ApplicationEntryPoint::app_die(sprintf("[Main:] The application %s could not be launched because the method %s is missing.", $application, - FrameworkConfiguration::getInstance()->readConfig("entry_method") + FrameworkConfiguration::getInstance()->readConfig('entry_method') )); } // Call the entry point method try { $eval = sprintf("%s::getInstance()->%s();", - FrameworkConfiguration::getInstance()->readConfig("app_helper_class"), - FrameworkConfiguration::getInstance()->readConfig("entry_method") + FrameworkConfiguration::getInstance()->readConfig('app_helper_class'), + FrameworkConfiguration::getInstance()->readConfig('entry_method') ); eval($eval); } catch (FrameworkException $e) { diff --git a/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php b/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php index 43a5ec6..01fd09f 100644 --- a/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php +++ b/inc/classes/exceptions/template/class_InvalidTemplateVariableNameException.php @@ -37,7 +37,7 @@ class InvalidTemplateVariableNameException extends FrameworkException { $this->getLine(), basename($classArray[1]), $classArray[2], - $classArray[3]->readConfig("tpl_valid_var") + $classArray[3]->readConfig('tpl_valid_var') ); // Call parent constructor diff --git a/inc/classes/interfaces/application/class_ManageableApplication.php b/inc/classes/interfaces/application/class_ManageableApplication.php index 5bb3dac..d1d7267 100644 --- a/inc/classes/interfaces/application/class_ManageableApplication.php +++ b/inc/classes/interfaces/application/class_ManageableApplication.php @@ -84,6 +84,15 @@ interface ManageableApplication extends FrameworkInterface { * @return void */ function entryPoint (); + + /** + * Handle the indexed array of fatal messages and puts them out in an + * acceptable fasion + * + * @param $messageList An array of fatal messages + * @return void + */ + function handleFatalMessages (array $messageList); } // [EOF] diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index 75b851f..1ccb1c2 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -288,16 +288,16 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Initialize debug instance if (is_null($this->getDebugInstance())) { // Set the debug output system if it is not debug class ;) - $this->setDebugInstance(DebugMiddleware::createDebugMiddleware($this->getConfigInstance()->readConfig("debug_engine"))); + $this->setDebugInstance(DebugMiddleware::createDebugMiddleware($this->getConfigInstance()->readConfig('debug_engine'))); } // Initialize web instance if (is_null($this->getWebOutputInstance())) { // Generate the eval() command $eval = sprintf("\$this->setWebOutputInstance(%s::create%s(\"%s\"));", - $this->getConfigInstance()->readConfig("web_engine"), - $this->getConfigInstance()->readConfig("web_engine"), - $this->getConfigInstance()->readConfig("web_content_type") + $this->getConfigInstance()->readConfig('web_engine'), + $this->getConfigInstance()->readConfig('web_engine'), + $this->getConfigInstance()->readConfig('web_content_type') ); // Debug message @@ -315,7 +315,7 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Set the compressor channel $this->setCompressorChannel(CompressorChannel::createCompressorChannel(sprintf("%s%s", PATH, - $this->getConfigInstance()->readConfig("compressor_base_path") + $this->getConfigInstance()->readConfig('compressor_base_path') ))); } @@ -839,9 +839,9 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { // Generate FQFN for all application templates $fqfn = sprintf("%s%s/%s/%s", PATH, - $this->getConfigInstance()->readConfig("application_path"), + $this->getConfigInstance()->readConfig('application_path'), strtolower($appInstance->getAppShortName()), - $this->getConfigInstance()->readConfig("tpl_base_path") + $this->getConfigInstance()->readConfig('tpl_base_path') ); // Are both instances set? @@ -860,8 +860,8 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { \$appInstance->getLanguageInstance(), \$appInstance->getFileIoInstance() );", - $this->getConfigInstance()->readConfig("tpl_engine"), - $this->getConfigInstance()->readConfig("tpl_engine"), + $this->getConfigInstance()->readConfig('tpl_engine'), + $this->getConfigInstance()->readConfig('tpl_engine'), $fqfn ); @@ -896,10 +896,12 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ public final function debugInstance () { // Generate the output - $content = "
".trim(print_r($this, true))."
"; + $content = sprintf("
%s
", + trim(print_r($this, true)) + ); // Output it - ApplicationEntryPoint::app_die("Debug output:".$content); + ApplicationEntryPoint::app_die(sprintf("%s debug output:%s", $this->__toString(), $content)); } /** diff --git a/inc/classes/main/commands/web/class_WebHomeCommand.php b/inc/classes/main/commands/web/class_WebHomeCommand.php index 7030bd1..a0f9560 100644 --- a/inc/classes/main/commands/web/class_WebHomeCommand.php +++ b/inc/classes/main/commands/web/class_WebHomeCommand.php @@ -99,9 +99,9 @@ class WebHomeCommand extends BaseCommand implements Commandable { $templateInstance->loadCodeTemplate($masterTemplate); // Set title - $title = ucfirst($requestInstance->getRequestElement($this->getConfigInstance()->readConfig("command_parameter"))); + $title = ucfirst($requestInstance->getRequestElement($this->getConfigInstance()->readConfig('command_parameter'))); if (empty($title)) $title = "Home"; - $templateInstance->assignVariable("title", $title); + $templateInstance->assignVariable('title', $title); // ... and all variables. This should be merged together in a pattern // to make things easier. A cache mechanism should be added between diff --git a/inc/classes/main/commands/web/class_WebRegisterCommand.php b/inc/classes/main/commands/web/class_WebRegisterCommand.php index 01ba9cd..8ed4a44 100644 --- a/inc/classes/main/commands/web/class_WebRegisterCommand.php +++ b/inc/classes/main/commands/web/class_WebRegisterCommand.php @@ -103,9 +103,9 @@ class WebRegisterCommand extends BaseCommand implements Commandable { $templateInstance->loadCodeTemplate($masterTemplate); // Set title - $title = ucfirst($requestInstance->getRequestElement($this->getConfigInstance()->readConfig("command_parameter"))); + $title = ucfirst($requestInstance->getRequestElement($this->getConfigInstance()->readConfig('command_parameter'))); if (empty($title)) $title = "Register"; - $templateInstance->assignVariable("title", $title); + $templateInstance->assignVariable('title', $title); // ... and all variables. This should be merged together in a pattern // to make things easier. A cache mechanism should be added between diff --git a/inc/classes/main/controller/form/class_WebDoFormController.php b/inc/classes/main/controller/form/class_WebDoFormController.php index bbb1d9c..9ffcf78 100644 --- a/inc/classes/main/controller/form/class_WebDoFormController.php +++ b/inc/classes/main/controller/form/class_WebDoFormController.php @@ -75,14 +75,15 @@ class WebDoFormController extends BaseController implements Controller { // Execute *very* generic pre filters $this->executePreFilters($requestInstance, $responseInstance); - // This request was valid! :-D - $requestInstance->requestIsValid(); + // Is the request still valid? Post filters shall only be executed of + // the request is valid + if ($requestInstance->isRequestValid()) { + // Execute the command + $commandInstance->execute($requestInstance, $responseInstance); - // Execute the command - $commandInstance->execute($requestInstance, $responseInstance); - - // Execute *very* generic ppost filters - $this->executePostFilters($requestInstance, $responseInstance); + // Execute *very* generic ppost filters + $this->executePostFilters($requestInstance, $responseInstance); + } // Flush the buffer out $responseInstance->flushBuffer(); diff --git a/inc/classes/main/factories/web/class_NewsFactory.php b/inc/classes/main/factories/web/class_NewsFactory.php index 3da66f9..032f3ce 100644 --- a/inc/classes/main/factories/web/class_NewsFactory.php +++ b/inc/classes/main/factories/web/class_NewsFactory.php @@ -52,7 +52,7 @@ class NewsFactory extends BaseFactory { $factoryInstance = new NewsFactory(); // Get the element name from configuration - $element = FrameworkConfiguration::getInstance()->readConfig("app_selector_get"); + $element = FrameworkConfiguration::getInstance()->readConfig('app_selector_get'); // Analyze the request, first get the Uni* application name (short one from URL) $appName = $requestInstance->getRequestElement($element); diff --git a/inc/classes/main/helper/web/class_WebFormHelper.php b/inc/classes/main/helper/web/class_WebFormHelper.php index 0c761d8..fc14638 100644 --- a/inc/classes/main/helper/web/class_WebFormHelper.php +++ b/inc/classes/main/helper/web/class_WebFormHelper.php @@ -118,9 +118,9 @@ class WebFormHelper extends BaseHelper { // Add HTML code $formContent = sprintf("
getConfigInstance()->readConfig("form_action"), - $this->getConfigInstance()->readConfig("form_method"), - $this->getConfigInstance()->readConfig("form_target") + $this->getConfigInstance()->readConfig('form_action'), + $this->getConfigInstance()->readConfig('form_method'), + $this->getConfigInstance()->readConfig('form_target') ); // Is the form id set? @@ -139,7 +139,7 @@ class WebFormHelper extends BaseHelper { $this->formName = $formName; } else { // Add the hidden field required to identify safely this form - $this->addInputHiddenField("form", $this->formName); + $this->addInputHiddenField('form', $this->formName); // Is a group open? if ($this->groupOpened === true) { @@ -519,7 +519,7 @@ class WebFormHelper extends BaseHelper { * @return $required Wether the email address is required */ public function ifRegisterRequiresEmailVerification () { - $required = ($this->getConfigInstance()->readConfig("register_requires_email") == "Y"); + $required = ($this->getConfigInstance()->readConfig('register_requires_email') == "Y"); return $required; } @@ -529,7 +529,7 @@ class WebFormHelper extends BaseHelper { * @return $required Wether profile shall be asked */ public function ifRegisterIncludesProfile () { - $required = ($this->getConfigInstance()->readConfig("register_includes_profile") == "Y"); + $required = ($this->getConfigInstance()->readConfig('register_includes_profile') == "Y"); return $required; } @@ -539,7 +539,7 @@ class WebFormHelper extends BaseHelper { * @return $required Wether personal data shall be asked */ public function ifRegisterIncludesPersonaData () { - $required = ($this->getConfigInstance()->readConfig("register_personal_data") == "Y"); + $required = ($this->getConfigInstance()->readConfig('register_personal_data') == "Y"); return $required; } diff --git a/inc/classes/main/language/class_LanguageSystem.php b/inc/classes/main/language/class_LanguageSystem.php index 47a7c0b..6a830b4 100644 --- a/inc/classes/main/language/class_LanguageSystem.php +++ b/inc/classes/main/language/class_LanguageSystem.php @@ -101,7 +101,7 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage { $langInstance->initLanguageStrings(); // Set language code from default config - $langInstance->setLanguageCode(FrameworkConfiguration::getInstance()->readConfig("default_lang")); + $langInstance->setLanguageCode(FrameworkConfiguration::getInstance()->readConfig('default_lang')); // Remember this instance self::$thisInstance = $langInstance; @@ -161,6 +161,28 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage { public final function getLanguageCode () { return $this->langCode; } + + /** + * Get the plain message from the cache variable for the given message id + * + * @param $messageId The message id we shall find in the cache variable + * @return $messageText The plain message text + */ + public function getMessage ($messageId) { + // Default is missing message text + $messageText = sprintf("!%s!", + $messageId + ); + + // Try to look it up in the cache variable + if ($this->langStrings->offsetExists($messageId)) { + // Return the message string + $messageText = $this->langStrings->offsetGet($messageId); + } + + // Return the text + return $messageText; + } } // [EOF] diff --git a/inc/classes/main/output/class_ConsoleOutput.php b/inc/classes/main/output/class_ConsoleOutput.php index 5d2b1c1..c421ec4 100644 --- a/inc/classes/main/output/class_ConsoleOutput.php +++ b/inc/classes/main/output/class_ConsoleOutput.php @@ -81,7 +81,7 @@ class ConsoleOutput extends BaseFrameworkSystem implements OutputStreamer { */ public final static function getInstance() { if (is_null(self::$consoleInstance)) { - $contentType = FrameworkConfiguration::getInstance()->readConfig("web_content_type"); + $contentType = FrameworkConfiguration::getInstance()->readConfig('web_content_type'); self::$consoleInstance = ConsoleOutput::createConsoleOutput($contentType); } return self::$consoleInstance; diff --git a/inc/classes/main/request/class_HttpRequest.php b/inc/classes/main/request/class_HttpRequest.php index 2c1950a..aa337db 100644 --- a/inc/classes/main/request/class_HttpRequest.php +++ b/inc/classes/main/request/class_HttpRequest.php @@ -28,9 +28,11 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable { private $requestData = array(); /** - * Wether this request is valid and can be further processed + * Wether this request is valid and can be further processed. The default is + * valid so make sure your intercepting filters sets this attribute to false + * when they need to intercept the data flow. */ - private $requestIsValid = false; + private $requestIsValid = true; /** * Protected constructor @@ -169,6 +171,15 @@ class HttpRequest extends BaseFrameworkSystem implements Requestable { public final function requestIsValid ($isValid = true) { $this->requestIsValid = (bool) $isValid; } + + /** + * Returns wether this request is valid + * + * @return $requestIsValid Wether this request is valid + */ + public final function isRequestValid () { + return $this->requestIsValid; + } } // [EOF] diff --git a/inc/classes/main/resolver/web/class_WebCommandResolver.php b/inc/classes/main/resolver/web/class_WebCommandResolver.php index edfcbe3..d1bc85e 100644 --- a/inc/classes/main/resolver/web/class_WebCommandResolver.php +++ b/inc/classes/main/resolver/web/class_WebCommandResolver.php @@ -94,10 +94,10 @@ class WebCommandResolver extends BaseResolver implements CommandResolver { // Test if the required parameter is set try { // This goes fine so let's resolv the command - $commandName = $requestInstance->getRequestElement($this->getConfigInstance()->readConfig("command_parameter")); + $commandName = $requestInstance->getRequestElement($this->getConfigInstance()->readConfig('command_parameter')); // Is the command empty? Then fall back to default command - if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig("default_command"); + if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_command'); // Check if the command is valid if (!$this->isCommandValid($commandName)) { @@ -136,7 +136,7 @@ class WebCommandResolver extends BaseResolver implements CommandResolver { $commandInstance = null; // Is the command empty? Then fall back to default command - if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig("default_command"); + if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_command'); // Check if the command is valid if (!$this->isCommandValid($commandName)) { @@ -161,7 +161,7 @@ class WebCommandResolver extends BaseResolver implements CommandResolver { */ private function loadCommand ($commandName) { // Cache default command - $defaultCommand = $this->getConfigInstance()->readConfig("default_command"); + $defaultCommand = $this->getConfigInstance()->readConfig('default_command'); // Init command instance $commandInstance = null; diff --git a/inc/classes/main/resolver/web/class_WebControllerResolver.php b/inc/classes/main/resolver/web/class_WebControllerResolver.php index 788a03c..fe03162 100644 --- a/inc/classes/main/resolver/web/class_WebControllerResolver.php +++ b/inc/classes/main/resolver/web/class_WebControllerResolver.php @@ -141,7 +141,7 @@ class WebControllerResolver extends BaseResolver implements ControllerResolver { // // Cache default command - $defaultCommand = $this->getConfigInstance()->readConfig("default_command"); + $defaultCommand = $this->getConfigInstance()->readConfig('default_command'); // Init controller instance $controllerInstance = null; @@ -155,7 +155,7 @@ class WebControllerResolver extends BaseResolver implements ControllerResolver { $class = sprintf("Web%sController", $this->convertToClassName($commandName) ); - } elseif ($this->getConfigInstance()->readConfig("home_with_news") == "Y") { + } elseif ($this->getConfigInstance()->readConfig('home_with_news') == "Y") { // Yes, display news in home then set default controller with news $class = "WebDefaultNewsController"; } else { diff --git a/inc/classes/main/response/class_HttpResponse.php b/inc/classes/main/response/class_HttpResponse.php index 064b3c8..39185e9 100644 --- a/inc/classes/main/response/class_HttpResponse.php +++ b/inc/classes/main/response/class_HttpResponse.php @@ -111,6 +111,15 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable { $this->responseHeaders[$name] = $value; } + /** + * Reset the header array + * + * @return void + */ + public final function resetResponseHeaders () { + $this->responseHeaders = array(); + } + /** * "Writes" data to the response body * @@ -121,6 +130,16 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable { $this->responseBody .= $output; } + /** + * Sets the response body to something new + * + * @param $output Output we shall sent in the HTTP response + * @return void + */ + public function setReponseBody ($output) { + $this->responseBody = $output; + } + /** * Flushs the cached HTTP response to the outer world * @@ -136,7 +155,7 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable { throw new ResponseHeadersAlreadySentException($this, self::EXCEPTION_HEADERS_ALREADY_SENT); } elseif (!headers_sent()) { // Send headers out - header("HTTP/1.0 {$this->responseStatus}"); + header("HTTP/1.1 {$this->responseStatus}"); // Used later $now = gmdate('D, d M Y H:i:s') . ' GMT'; @@ -155,10 +174,21 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable { } } - // Flush the output to the world - $this->getWebOutputInstance()->output($this->responseBody); - $this->reponseBody = ""; - $this->responseHeaders = array(); + // Are there some error messages? + if (count($this->fatalMessages) == 0) { + // Flush the output to the world + $this->getWebOutputInstance()->output($this->responseBody); + } else { + // Display all error messages + $this->getApplicationInstance()->handleFatalMessages($this->fatalMessages); + + // Send the error messages out to the world + $this->getWebOutputInstance()->output($this->responseBody); + } + + // Clear response header and body + $this->setReponseBody(""); + $this->resetResponseHeaders(); } /** diff --git a/inc/classes/main/template/class_TemplateEngine.php b/inc/classes/main/template/class_TemplateEngine.php index 64902cb..79fa507 100644 --- a/inc/classes/main/template/class_TemplateEngine.php +++ b/inc/classes/main/template/class_TemplateEngine.php @@ -180,11 +180,11 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate $tplInstance->setFileIoInstance($ioInstance); // Set template extensions - $tplInstance->setRawTemplateExtension($cfgInstance->readConfig("raw_template_extension")); - $tplInstance->setCodeTemplateExtension($cfgInstance->readConfig("code_template_extension")); + $tplInstance->setRawTemplateExtension($cfgInstance->readConfig('raw_template_extension')); + $tplInstance->setCodeTemplateExtension($cfgInstance->readConfig('code_template_extension')); // Absolute output path for compiled templates - $tplInstance->setCompileOutputPath(PATH . $cfgInstance->readConfig("compile_output_path")); + $tplInstance->setCompileOutputPath(PATH . $cfgInstance->readConfig('compile_output_path')); // Return the prepared instance return $tplInstance; @@ -518,7 +518,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate $ext = $this->getRawTemplateExtension(); // If we shall load a code-template we need to switch the file extension - if ($this->getTemplateType() == $this->getConfigInstance()->readConfig("code_template_type")) { + if ($this->getTemplateType() == $this->getConfigInstance()->readConfig('code_template_type')) { // Switch over to the code-template extension $ext = $this->getCodeTemplateExtension(); } @@ -905,7 +905,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate */ public final function loadWebTemplate ($template) { // Set template type - $this->setTemplateType($this->getConfigInstance()->readConfig("web_template_type")); + $this->setTemplateType($this->getConfigInstance()->readConfig('web_template_type')); // Load the special template $this->loadTemplate($template); @@ -920,7 +920,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate */ public final function loadEmailTemplate ($template) { // Set template type - $this->setTemplateType($this->getConfigInstance()->readConfig("email_template_type")); + $this->setTemplateType($this->getConfigInstance()->readConfig('email_template_type')); // Load the special template $this->loadTemplate($template); @@ -935,7 +935,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate */ public final function loadCodeTemplate ($template) { // Set template type - $this->setTemplateType($this->getConfigInstance()->readConfig("code_template_type")); + $this->setTemplateType($this->getConfigInstance()->readConfig('code_template_type')); // Load the special template $this->loadTemplate($template); @@ -948,7 +948,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate */ public final function compileVariables () { // Initialize the $content array - $validVar = $this->getConfigInstance()->readConfig("tpl_valid_var"); + $validVar = $this->getConfigInstance()->readConfig('tpl_valid_var'); $dummy = array(); // Iterate through all variables @@ -1047,9 +1047,9 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate */ public final function compileTemplate () { // We will only work with template type "code" from configuration - if ($this->getTemplateType() != $this->getConfigInstance()->readConfig("code_template_type")) { + 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); + 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. diff --git a/inc/classes/middleware/compressor/class_CompressorChannel.php b/inc/classes/middleware/compressor/class_CompressorChannel.php index fd04ac1..1b33041 100644 --- a/inc/classes/middleware/compressor/class_CompressorChannel.php +++ b/inc/classes/middleware/compressor/class_CompressorChannel.php @@ -55,7 +55,7 @@ class CompressorChannel extends BaseMiddleware { // Read all directories but no sub directories while ($dir = $dirPointer->readDirectoryExcept(array("..", ".", ".htaccess"))) { // Is this a class file? - if ((substr($dir, 0, 6) == "class_") && (substr($dir, -4, 4) == FrameworkConfiguration::getInstance()->readConfig("php_extension"))) { + if ((substr($dir, 0, 6) == "class_") && (substr($dir, -4, 4) == FrameworkConfiguration::getInstance()->readConfig('php_extension'))) { // Get the compressor's name. That's why you must name // your files like your classes and also that's why you // must keep on class in one file. diff --git a/inc/loader/class_ClassLoader.php b/inc/loader/class_ClassLoader.php index 7366496..edbe3cb 100644 --- a/inc/loader/class_ClassLoader.php +++ b/inc/loader/class_ClassLoader.php @@ -101,8 +101,8 @@ class ClassLoader { $this->dirList = new ArrayObject(); // Set suffix and prefix from configuration - $this->suffix = $cfgInstance->readConfig("class_suffix"); - $this->prefix = $cfgInstance->readConfig("class_prefix"); + $this->suffix = $cfgInstance->readConfig('class_suffix'); + $this->prefix = $cfgInstance->readConfig('class_prefix'); // Estimate length of prefix and suffix for substr() function (cache) $this->sufLen = strlen($this->suffix); @@ -289,9 +289,9 @@ class ClassLoader { } // Initial load of core classes and the FrameworkDirectoryPointer class -require_once(sprintf("%sinc/classes/interfaces/class_FrameworkInterface%s", PATH, FrameworkConfiguration::getInstance()->readConfig("php_extension"))); -require_once(sprintf("%sinc/classes/main/class_BaseFrameworkSystem%s", PATH, FrameworkConfiguration::getInstance()->readConfig("php_extension"))); -require_once(sprintf("%sinc/classes/main/io/class_FrameworkDirectoryPointer%s", PATH, FrameworkConfiguration::getInstance()->readConfig("php_extension"))); +require_once(sprintf("%sinc/classes/interfaces/class_FrameworkInterface%s", PATH, FrameworkConfiguration::getInstance()->readConfig('php_extension'))); +require_once(sprintf("%sinc/classes/main/class_BaseFrameworkSystem%s", PATH, FrameworkConfiguration::getInstance()->readConfig('php_extension'))); +require_once(sprintf("%sinc/classes/main/io/class_FrameworkDirectoryPointer%s", PATH, FrameworkConfiguration::getInstance()->readConfig('php_extension'))); // Initialize the class loader $loader = new ClassLoader(FrameworkConfiguration::getInstance()); diff --git a/inc/selector.php b/inc/selector.php index 0267bfa..e608de1 100644 --- a/inc/selector.php +++ b/inc/selector.php @@ -50,7 +50,7 @@ $application = preg_replace('/([^a-z_-])+/i', "", $application); // Try to load these includes in the given order $configAppIncludes = array( - sprintf("class_%s", FrameworkConfiguration::getInstance()->readConfig("app_helper_class")), // The ApplicationHelper class + 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 -- 2.39.2