From: Roland Häder Date: Tue, 28 Jul 2009 17:27:18 +0000 (+0000) Subject: readConfig() is not naming convention, renamed to getConfigEntry() X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0f10df895de1dd67a2bbec5264f01c5e146de952;p=shipsimu.git readConfig() is not naming convention, renamed to getConfigEntry() --- diff --git a/application/selector/class_ApplicationHelper.php b/application/selector/class_ApplicationHelper.php index 1d4f9e7..b089944 100644 --- a/application/selector/class_ApplicationHelper.php +++ b/application/selector/class_ApplicationHelper.php @@ -199,7 +199,11 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication // If it is null then get default command if (is_null($commandName)) { + // Get default command $commandName = $responseInstance->getDefaultCommand(); + + // Set it in request + $requestInstance->setRequestElement('page'); } // END - if // Get a resolver diff --git a/application/selector/class_ApplicationSelector.php b/application/selector/class_ApplicationSelector.php index b0aca06..ee637f7 100644 --- a/application/selector/class_ApplicationSelector.php +++ b/application/selector/class_ApplicationSelector.php @@ -135,7 +135,7 @@ class ApplicationSelector extends BaseFrameworkSystem { * @return $shortName This selector's short name */ public function getAppShortName() { - $shortName = $this->getConfigInstance()->readConfig('selector_path'); + $shortName = $this->getConfigInstance()->getConfigEntry('selector_path'); return $shortName; } @@ -158,10 +158,10 @@ class ApplicationSelector extends BaseFrameworkSystem { */ public function readApplicationDirectory () { // Generate the base path for all applications - $appBasePath = $this->getConfigInstance()->readConfig('application_path'); + $appBasePath = $this->getConfigInstance()->getConfigEntry('application_path'); // Add the selector path to the ignore list - $this->addDirIgnoreList($this->getConfigInstance()->readConfig('selector_path')); + $this->addDirIgnoreList($this->getConfigInstance()->getConfigEntry('selector_path')); // Get a directory pointer for the application path $dirInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($appBasePath); @@ -202,7 +202,7 @@ class ApplicationSelector extends BaseFrameworkSystem { // Try to load the web template $templateInstance->loadWebTemplate(sprintf("%s_%s", - $this->getConfigInstance()->readConfig('tpl_selector_prefix'), + $this->getConfigInstance()->getConfigEntry('tpl_selector_prefix'), strtolower($appInstance->getAppShortName()) )); @@ -237,7 +237,7 @@ class ApplicationSelector extends BaseFrameworkSystem { $templateInstance = $this->prepareTemplateInstance($this); // Load the selector's template - $templateInstance->loadCodeTemplate($this->getConfigInstance()->readConfig('selector_main_tpl')); + $templateInstance->loadCodeTemplate($this->getConfigInstance()->getConfigEntry('selector_main_tpl')); // Now store it in the class, we need this later on final compilation of available applications $this->setTemplateInstance($templateInstance); @@ -259,7 +259,7 @@ class ApplicationSelector extends BaseFrameworkSystem { $templateInstance = $this->prepareTemplateInstance($this); // Load template which shall later hold all application templates - $templateInstance->loadCodeTemplate($this->getConfigInstance()->readConfig('selector_apps_tpl')); + $templateInstance->loadCodeTemplate($this->getConfigInstance()->getConfigEntry('selector_apps_tpl')); // Add all loaded application templates together $dummy = ""; diff --git a/application/selector/data.php b/application/selector/data.php index 45876a3..99b3159 100644 --- a/application/selector/data.php +++ b/application/selector/data.php @@ -30,14 +30,14 @@ $cfg = FrameworkConfiguration::getInstance(); // Get an instance of the helper $app = call_user_func_array( - array($cfg->readConfig('app_helper_class'), 'getInstance'), + array($cfg->getConfigEntry('app_helper_class'), 'getInstance'), array() ); // Set application name and version $app->setAppName("Applikationsauswähler"); $app->setAppVersion("0.1a"); -$app->setAppShortName($cfg->readConfig('selector_name')); +$app->setAppShortName($cfg->getConfigEntry('selector_name')); // [EOF] ?> diff --git a/application/selector/init.php b/application/selector/init.php index 9582c57..487753e 100644 --- a/application/selector/init.php +++ b/application/selector/init.php @@ -29,13 +29,13 @@ $cfg = FrameworkConfiguration::getInstance(); // Initialize output system -require($cfg->readConfig('base_path') . 'inc/output.php'); +require($cfg->getConfigEntry('base_path') . 'inc/output.php'); // Initialize file i/o system -require($cfg->readConfig('base_path') . 'inc/file_io.php'); +require($cfg->getConfigEntry('base_path') . 'inc/file_io.php'); // Include the language sub-system -require($cfg->readConfig('base_path') . 'inc/language.php'); +require($cfg->getConfigEntry('base_path') . 'inc/language.php'); // [EOF] ?> diff --git a/application/selector/loader.php b/application/selector/loader.php index dc29d72..a6b49bb 100644 --- a/application/selector/loader.php +++ b/application/selector/loader.php @@ -25,7 +25,7 @@ $cfg = FrameworkConfiguration::getInstance(); // Load all classes -ClassLoader::getInstance()->scanClassPath(sprintf("%s/%s/", $cfg->readConfig('application_path'), $cfg->readConfig('app_name'))); +ClassLoader::getInstance()->scanClassPath(sprintf("%s/%s/", $cfg->getConfigEntry('application_path'), $cfg->getConfigEntry('app_name'))); // Clean up the global namespace unset($lowerClasses); diff --git a/application/selector/starter.php b/application/selector/starter.php index e4ede0e..9336b4a 100644 --- a/application/selector/starter.php +++ b/application/selector/starter.php @@ -24,30 +24,30 @@ // Is there an application helper instance? We need the method main() for // maining the application -$app = call_user_func_array(array(FrameworkConfiguration::getInstance()->readConfig('app_helper_class'), 'getInstance'), array()); +$app = call_user_func_array(array(FrameworkConfiguration::getInstance()->getConfigEntry('app_helper_class'), 'getInstance'), array()); // Some sanity checks 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()->getConfigEntry('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()->getConfigEntry('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()->getConfigEntry('entry_method') )); } // Call the entry point method -call_user_func_array(array($app, FrameworkConfiguration::getInstance()->readConfig('entry_method')), array()); +call_user_func_array(array($app, FrameworkConfiguration::getInstance()->getConfigEntry('entry_method')), array()); // [EOF] ?> diff --git a/application/ship-simu/class_ApplicationHelper.php b/application/ship-simu/class_ApplicationHelper.php index b8f4349..f459a64 100644 --- a/application/ship-simu/class_ApplicationHelper.php +++ b/application/ship-simu/class_ApplicationHelper.php @@ -201,7 +201,11 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication // If it is null then get default command if (is_null($commandName)) { + // Get the default command $commandName = $responseInstance->getDefaultCommand(); + + // Set it in request + $requestInstance->setRequestElement('page'); } // END - if // Get a resolver diff --git a/application/ship-simu/data.php b/application/ship-simu/data.php index 893b124..c4249c4 100644 --- a/application/ship-simu/data.php +++ b/application/ship-simu/data.php @@ -38,7 +38,7 @@ $cfg = FrameworkConfiguration::getInstance(); // Get an instance of the helper $app = call_user_func_array( - array($cfg->readConfig('app_helper_class'), 'getInstance'), + array($cfg->getConfigEntry('app_helper_class'), 'getInstance'), array() ); diff --git a/application/ship-simu/init.php b/application/ship-simu/init.php index 264384c..3b9c30a 100644 --- a/application/ship-simu/init.php +++ b/application/ship-simu/init.php @@ -37,17 +37,17 @@ $cfg = FrameworkConfiguration::getInstance(); // Initialize output system -require($cfg->readConfig('base_path') . 'inc/output.php'); +require($cfg->getConfigEntry('base_path') . 'inc/output.php'); // Initialize file i/o system -require($cfg->readConfig('base_path') . 'inc/file_io.php'); +require($cfg->getConfigEntry('base_path') . 'inc/file_io.php'); // Include the language sub-system -require($cfg->readConfig('base_path') . 'inc/language.php'); +require($cfg->getConfigEntry('base_path') . 'inc/language.php'); // This application needs a database connection then we have to simply include // the inc/database.php script -require($cfg->readConfig('base_path') . 'inc/database.php'); +require($cfg->getConfigEntry('base_path') . 'inc/database.php'); // [EOF] ?> diff --git a/application/ship-simu/loader.php b/application/ship-simu/loader.php index 549d0b2..4679037 100644 --- a/application/ship-simu/loader.php +++ b/application/ship-simu/loader.php @@ -28,7 +28,7 @@ $cfg = FrameworkConfiguration::getInstance(); // Load all classes for the application foreach ($lowerClasses as $className) { // Load the application classes - ClassLoader::getInstance()->scanClassPath(sprintf("%s/%s/%s", $cfg->readConfig('application_path'), $cfg->readConfig('app_name'), $className)); + ClassLoader::getInstance()->scanClassPath(sprintf("%s/%s/%s", $cfg->getConfigEntry('application_path'), $cfg->getConfigEntry('app_name'), $className)); } // END - if // Clean up the global namespace diff --git a/application/ship-simu/main/commands/web/class_WebShipsimuRefillCommand.php b/application/ship-simu/main/commands/web/class_WebShipsimuRefillCommand.php index 9bf663f..4c9d0e8 100644 --- a/application/ship-simu/main/commands/web/class_WebShipsimuRefillCommand.php +++ b/application/ship-simu/main/commands/web/class_WebShipsimuRefillCommand.php @@ -104,7 +104,7 @@ class WebShipsimuRefillCommand extends BaseCommand implements Commandable { // Prepare a filter based on the requested type we shall refill $filterName = sprintf("refill_request_%s_%s_book_filter", $requestInstance->getRequestElement('type'), - $this->getConfigInstance()->readConfig($paymentTypeConfig) + $this->getConfigInstance()->getConfigEntry($paymentTypeConfig) ); // Now, try to load that filter diff --git a/application/ship-simu/main/commands/web/class_WebShipsimuUserLoginCommand.php b/application/ship-simu/main/commands/web/class_WebShipsimuUserLoginCommand.php index 1a0a99f..831e118 100644 --- a/application/ship-simu/main/commands/web/class_WebShipsimuUserLoginCommand.php +++ b/application/ship-simu/main/commands/web/class_WebShipsimuUserLoginCommand.php @@ -102,7 +102,7 @@ class WebShipsimuUserLoginCommand extends BaseCommand implements Commandable { */ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { // Which login type do we have? - switch ($this->getConfigInstance()->readConfig('login_type')) { + switch ($this->getConfigInstance()->getConfigEntry('login_type')) { case "username": // Login via username $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_filter')); break; diff --git a/application/ship-simu/main/filter/page/class_RefillPageFilter.php b/application/ship-simu/main/filter/page/class_RefillPageFilter.php index 232fc3a..202316a 100644 --- a/application/ship-simu/main/filter/page/class_RefillPageFilter.php +++ b/application/ship-simu/main/filter/page/class_RefillPageFilter.php @@ -58,7 +58,7 @@ class RefillPageFilter extends BaseShipSimuFilter implements Filterable { parent::execute($requestInstance, $responseInstance); // Is the configuration variable set? - if ($this->getConfigInstance()->readConfig('refill_page_active') === "N") { + if ($this->getConfigInstance()->getConfigEntry('refill_page_active') === "N") { // Password is empty $requestInstance->requestIsValid(false); diff --git a/application/ship-simu/main/government/class_SimplifiedGovernment.php b/application/ship-simu/main/government/class_SimplifiedGovernment.php index 3cb6f88..66416f7 100644 --- a/application/ship-simu/main/government/class_SimplifiedGovernment.php +++ b/application/ship-simu/main/government/class_SimplifiedGovernment.php @@ -100,7 +100,7 @@ class SimplifiedGovernment extends BaseFrameworkSystem implements Registerable { $maximumPayed = false; // Cache startup help limit - $helpLimit = $this->getConfigInstance()->readConfig('government_startup_help_limit'); + $helpLimit = $this->getConfigInstance()->getConfigEntry('government_startup_help_limit'); // Now get a search criteria and set the user's name as criteria $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); diff --git a/application/ship-simu/main/login/class_ShipSimuGuestLogin.php b/application/ship-simu/main/login/class_ShipSimuGuestLogin.php index ecdbadc..a026284 100644 --- a/application/ship-simu/main/login/class_ShipSimuGuestLogin.php +++ b/application/ship-simu/main/login/class_ShipSimuGuestLogin.php @@ -85,13 +85,13 @@ class ShipSimuGuestLogin extends BaseFrameworkSystem implements LoginableUser { if (is_null($method)) { // Then abort here throw new UserAuthMethodException($this, self::EXCEPTION_MISSING_METHOD); - } elseif (!method_exists($this->getConfigInstance()->readConfig('guest_class'), $method)) { + } elseif (!method_exists($this->getConfigInstance()->getConfigEntry('guest_class'), $method)) { // The method is invalid! throw new MissingMethodException(array($this, $method), self::EXCEPTION_MISSING_METHOD); } // Get a user instance - $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('guest_class'), $method), array($data)); + $userInstance = call_user_func_array(array($this->getConfigInstance()->getConfigEntry('guest_class'), $method), array($data)); // Remember this new instance in registry Registry::getRegistry()->addInstance('user', $userInstance); diff --git a/application/ship-simu/main/login/class_ShipSimuUserLogin.php b/application/ship-simu/main/login/class_ShipSimuUserLogin.php index 270a8c6..3b1acf7 100644 --- a/application/ship-simu/main/login/class_ShipSimuUserLogin.php +++ b/application/ship-simu/main/login/class_ShipSimuUserLogin.php @@ -74,7 +74,7 @@ class ShipSimuUserLogin extends BaseFrameworkSystem implements LoginableUser { $data = ""; // Get member class - $userClass = $this->getConfigInstance()->readConfig('user_class'); + $userClass = $this->getConfigInstance()->getConfigEntry('user_class'); // Get a user instance $userInstance = call_user_func_array(array($userClass, 'createMemberByRequest'), array($requestInstance)); diff --git a/application/ship-simu/main/login/helper/class_ShipSimuLoginHelper.php b/application/ship-simu/main/login/helper/class_ShipSimuLoginHelper.php index c31a624..32da33f 100644 --- a/application/ship-simu/main/login/helper/class_ShipSimuLoginHelper.php +++ b/application/ship-simu/main/login/helper/class_ShipSimuLoginHelper.php @@ -85,7 +85,7 @@ class ShipSimuLoginHelper extends BaseLoginHelper implements HelpableLogin { * @return void */ protected function setDefaultAuthMethod () { - $this->authMethod = $this->getConfigInstance()->readConfig('auth_method_class'); + $this->authMethod = $this->getConfigInstance()->getConfigEntry('auth_method_class'); } /** diff --git a/application/ship-simu/main/registration/class_ShipSimuRegistration.php b/application/ship-simu/main/registration/class_ShipSimuRegistration.php index 61d40b9..31add01 100644 --- a/application/ship-simu/main/registration/class_ShipSimuRegistration.php +++ b/application/ship-simu/main/registration/class_ShipSimuRegistration.php @@ -160,7 +160,7 @@ class ShipSimuRegistration extends BaseRegistration implements UserRegister { $configEntry = 'user_status_unconfirmed'; // Is the confirmation process entirely disabled? - if ($this->getConfigInstance()->readConfig('confirm_email_enabled') === "N") { + if ($this->getConfigInstance()->getConfigEntry('confirm_email_enabled') === "N") { // No confirmation of email needed $configEntry = 'user_status_confirmed'; } // END - if @@ -177,7 +177,7 @@ class ShipSimuRegistration extends BaseRegistration implements UserRegister { } // Is this a guest account? - if ((($element == "username") || ($alias == "username")) && ($this->getRequestInstance()->getRequestElement($element) == $this->getConfigInstance()->readConfig('guest_login_user'))) { + if ((($element == "username") || ($alias == "username")) && ($this->getRequestInstance()->getRequestElement($element) == $this->getConfigInstance()->getConfigEntry('guest_login_user'))) { // Yes, then set the config entry to guest status $configEntry = 'user_status_guest'; } // END - if diff --git a/application/ship-simu/main/resolver/web/class_WebGovernmentFailedCommandResolver.php b/application/ship-simu/main/resolver/web/class_WebGovernmentFailedCommandResolver.php index 9e69db6..27c8a8e 100644 --- a/application/ship-simu/main/resolver/web/class_WebGovernmentFailedCommandResolver.php +++ b/application/ship-simu/main/resolver/web/class_WebGovernmentFailedCommandResolver.php @@ -97,7 +97,7 @@ class WebGovernmentFailedCommandResolver extends BaseCommandResolver implements } // END - if // Is the command empty? Then fall back to default command - if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_web_command'); + if (empty($commandName)) $commandName = $this->getConfigInstance()->getConfigEntry('default_web_command'); // Check if command is valid if ($this->isCommandValid($commandName) === false) { @@ -133,7 +133,7 @@ class WebGovernmentFailedCommandResolver extends BaseCommandResolver implements $commandInstance = null; // Is the command empty? Then fall back to default command - if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_web_command'); + if (empty($commandName)) $commandName = $this->getConfigInstance()->getConfigEntry('default_web_command'); // Check if command is valid if ($this->isCommandValid($commandName) === false) { @@ -158,7 +158,7 @@ class WebGovernmentFailedCommandResolver extends BaseCommandResolver implements */ private function loadCommand ($commandName) { // Cache default command - $defaultCommand = $this->getConfigInstance()->readConfig('default_web_command'); + $defaultCommand = $this->getConfigInstance()->getConfigEntry('default_web_command'); // Init command instance $commandInstance = null; diff --git a/application/ship-simu/main/user/class_ShipSimuBaseUser.php b/application/ship-simu/main/user/class_ShipSimuBaseUser.php index 96a107f..e77ba3e 100644 --- a/application/ship-simu/main/user/class_ShipSimuBaseUser.php +++ b/application/ship-simu/main/user/class_ShipSimuBaseUser.php @@ -40,7 +40,7 @@ class ShipSimuBaseUser extends BaseUser implements Registerable, Updateable { */ public function ifUserCreatedMaximumAllowedCompanies () { // Get max allowed companies to found - $maxFound = $this->getConfigInstance()->readConfig('max_allowed_companies_found'); + $maxFound = $this->getConfigInstance()->getConfigEntry('max_allowed_companies_found'); // Now get a search criteria and set the user's name as criteria $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); diff --git a/application/ship-simu/main/user/extended/class_ShipSimuMember.php b/application/ship-simu/main/user/extended/class_ShipSimuMember.php index 5efdf8d..b805f50 100644 --- a/application/ship-simu/main/user/extended/class_ShipSimuMember.php +++ b/application/ship-simu/main/user/extended/class_ShipSimuMember.php @@ -131,7 +131,7 @@ class ShipSimuMember extends ShipSimuBaseUser implements ManageableMember, Booka // If there is no action use the default on if (is_null($lastAction)) { - $lastAction = $this->getConfigInstance()->readConfig('login_default_action'); + $lastAction = $this->getConfigInstance()->getConfigEntry('login_default_action'); } // END - if // Get a critieria instance diff --git a/application/ship-simu/starter.php b/application/ship-simu/starter.php index d73db4b..3a18849 100644 --- a/application/ship-simu/starter.php +++ b/application/ship-simu/starter.php @@ -24,30 +24,30 @@ // Is there an application helper instance? We need the method main() for // maining the application -$app = call_user_func_array(array(FrameworkConfiguration::getInstance()->readConfig('app_helper_class'), 'getInstance'), array()); +$app = call_user_func_array(array(FrameworkConfiguration::getInstance()->getConfigEntry('app_helper_class'), 'getInstance'), array()); // Some sanity checks 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()->getConfigEntry('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()->getConfigEntry('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()->getConfigEntry('entry_method') )); } // Call user function -call_user_func_array(array($app, FrameworkConfiguration::getInstance()->readConfig('entry_method')), array()); +call_user_func_array(array($app, FrameworkConfiguration::getInstance()->getConfigEntry('entry_method')), array()); // [EOF] ?> diff --git a/index.php b/index.php index 0050046..cf898bf 100644 --- a/index.php +++ b/index.php @@ -80,13 +80,13 @@ final class ApplicationEntryPoint { $configInstance = FrameworkConfiguration::getInstance(); // Do we have debug installation? - if (($configInstance->readConfig('product_install_mode') == 'productive') || ($silentMode === true)) { + if (($configInstance->getConfigEntry('product_install_mode') == 'productive') || ($silentMode === true)) { // Abort here die(); } // END - if // Get some instances - $tpl = FrameworkConfiguration::getInstance()->readConfig('template_class'); + $tpl = FrameworkConfiguration::getInstance()->getConfigEntry('template_class'); $lang = LanguageSystem::getInstance(); // Get response instance @@ -190,13 +190,13 @@ final class ApplicationEntryPoint { require(self::detectCorePath() . '/inc/config.php'); // Load all include files - require($cfg->readConfig('base_path') . 'inc/includes.php'); + require($cfg->getConfigEntry('base_path') . 'inc/includes.php'); // Load all framework classes - require($cfg->readConfig('base_path') . 'inc/classes.php'); + require($cfg->getConfigEntry('base_path') . 'inc/classes.php'); // Include the application selector - require($cfg->readConfig('base_path') . 'inc/selector.php'); + require($cfg->getConfigEntry('base_path') . 'inc/selector.php'); } // END - main() } // END - class