From 602a3281da3bcf4ab4da2d8571b921e61e167b5b Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Mon, 6 Apr 2015 11:48:07 +0200 Subject: [PATCH] Sometimes 'page' is wanted, sometimes 'command' but basicly both want a command instance. So it is better to rename it everywhere to 'command'. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- application/tests/class_ApplicationHelper.php | 2 +- .../main/factories/html/class_HtmlNewsFactory.php | 10 +++++----- .../main/helper/html/links/class_HtmlLinkHelper.php | 6 +++--- inc/classes/main/menu/class_BaseMenu.php | 10 +++++----- inc/classes/main/reader/class_ConsoleNewsReader.php | 2 +- inc/classes/main/reader/class_DefaultNewsReader.php | 10 +++++----- inc/classes/main/response/class_BaseResponse.php | 2 +- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/application/tests/class_ApplicationHelper.php b/application/tests/class_ApplicationHelper.php index 113fae8d..c8b407a5 100644 --- a/application/tests/class_ApplicationHelper.php +++ b/application/tests/class_ApplicationHelper.php @@ -182,7 +182,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica // If it is null then get default command if (is_null($commandName)) { // Get default command - $commandName = $responseInstance->getDefaultCommand(); + $commandName = $responseInstance->determineDefaultCommand(); // Set it in request $requestInstance->setRequestElement('command', $commandName); diff --git a/inc/classes/main/factories/html/class_HtmlNewsFactory.php b/inc/classes/main/factories/html/class_HtmlNewsFactory.php index 2cb7ec78..135409de 100644 --- a/inc/classes/main/factories/html/class_HtmlNewsFactory.php +++ b/inc/classes/main/factories/html/class_HtmlNewsFactory.php @@ -49,12 +49,12 @@ class HtmlNewsFactory extends BaseFactory { $configEntry = 'news_reader_class'; // Get "page" - $page = $requestInstance->getRequestElement('page'); + $command = $requestInstance->getRequestElement('command'); - // Is 'page' used? - if (!empty($page)) { + // Is 'command' used? + if (!empty($command)) { // Then add it - $configEntry = sprintf('news_reader_%s_class', $page); + $configEntry = sprintf('news_reader_%s_class', $command); // Get 'action' $action = $requestInstance->getRequestElement('action'); @@ -62,7 +62,7 @@ class HtmlNewsFactory extends BaseFactory { // Is it also there? if (!empty($action)) { // Then use both for config entry - $configEntry = sprintf('news_reader_%s_%s_class', $page, $action); + $configEntry = sprintf('news_reader_%s_%s_class', $command, $action); } // END - if } // END - if diff --git a/inc/classes/main/helper/html/links/class_HtmlLinkHelper.php b/inc/classes/main/helper/html/links/class_HtmlLinkHelper.php index 09121d59..e41de2db 100644 --- a/inc/classes/main/helper/html/links/class_HtmlLinkHelper.php +++ b/inc/classes/main/helper/html/links/class_HtmlLinkHelper.php @@ -84,10 +84,10 @@ class HtmlLinkHelper extends BaseHtmlHelper implements HelpableTemplate { } // END - if // Get page (this will throw an exception if not set) - $page = $helperInstance->convertDashesToUnderscores($requestInstance->getRequestElement('page')); + $command = $helperInstance->convertDashesToUnderscores($requestInstance->getRequestElement('command')); // Construct config entry - $configEntry = $page . '_' . $linkName . '_action_url'; + $configEntry = $command . '_' . $linkName . '_action_url'; // Is the deprecated parameter set? if (!is_null($linkBase)) { @@ -95,7 +95,7 @@ class HtmlLinkHelper extends BaseHtmlHelper implements HelpableTemplate { $helperInstance->deprecationWarning('[' . __METHOD__ . ':' . __LINE__ . ']: linkBase is deprecated. Please remove it from your templates and add a config entry ' . $configEntry . ' in your config.php file.'); } // END - if - // Determine link base from config now and 'page' request + // Determine link base from config now and 'command' request try { $newLinkBase = $helperInstance->getConfigInstance()->getConfigEntry($configEntry); $linkBase = $newLinkBase; diff --git a/inc/classes/main/menu/class_BaseMenu.php b/inc/classes/main/menu/class_BaseMenu.php index 1f3512b6..23324edd 100644 --- a/inc/classes/main/menu/class_BaseMenu.php +++ b/inc/classes/main/menu/class_BaseMenu.php @@ -49,18 +49,18 @@ class BaseMenu extends BaseFrameworkSystem { // Load the menu template for all $templateInstance->loadMenuTemplate('generic_menu_entries'); - // Get the 'page' from request instance - $page = $this->getApplicationInstance()->getRequestInstance()->getRequestElement('page'); + // Get the 'command' from request instance + $command = $this->getApplicationInstance()->getRequestInstance()->getRequestElement('command'); // If page is empty, choose default - if (empty($page)) { + if (empty($command)) { // Use default page as none has been specified - $page = $this->getConfigInstance()->getConfigEntry('default_' . $this->getApplicationInstance()->getAppShortName() . '_' . self::getResponseTypeFromSystem() . '_command'); + $command = $this->getConfigInstance()->getConfigEntry('default_' . $this->getApplicationInstance()->getAppShortName() . '_' . self::getResponseTypeFromSystem() . '_command'); } // END - if // Load the menu template for this page try { - $templateInstance->loadMenuTemplate($page . '_menu_entries'); + $templateInstance->loadMenuTemplate($command . '_menu_entries'); } catch (FileIoException $e) { // Log exception @TODO Maybe to intrusive? self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: Exception caught: ' . $e->__toString() . ', with message: ' . $e->getMessage()); diff --git a/inc/classes/main/reader/class_ConsoleNewsReader.php b/inc/classes/main/reader/class_ConsoleNewsReader.php index 5d23a680..9f5cc8e5 100644 --- a/inc/classes/main/reader/class_ConsoleNewsReader.php +++ b/inc/classes/main/reader/class_ConsoleNewsReader.php @@ -66,7 +66,7 @@ class ConsoleNewsReader extends BaseFrameworkSystem implements ReadableNews, Reg $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); // Add the command as criteria to it at lease - $criteriaInstance->addCriteria('page', $command); + $criteriaInstance->addCriteria('command', $command); // Add limitation from config $criteriaInstance->setConfiguredLimit('news_' . $command . '_limit'); diff --git a/inc/classes/main/reader/class_DefaultNewsReader.php b/inc/classes/main/reader/class_DefaultNewsReader.php index c3af732e..8ff4a9b4 100644 --- a/inc/classes/main/reader/class_DefaultNewsReader.php +++ b/inc/classes/main/reader/class_DefaultNewsReader.php @@ -50,14 +50,14 @@ class DefaultNewsReader extends BaseFrameworkSystem implements ReadableNews, Reg } /** - * Initializes this reader class by pre-fetching news depending on 'page' + * Initializes this reader class by pre-fetching news depending on 'command' * (outside or login area), which amount of news and how much to skip * * @return void */ public function initializeReader () { - // Get 'page' for saving some calls - $page = $this->getRequestInstance()->getRequestElement('page'); + // Get 'command' for saving some calls + $command = $this->getRequestInstance()->getRequestElement('command'); // First get a wrapper instance $wrapperInstance = ObjectFactory::createObjectByConfiguredName('news_db_wrapper_class'); @@ -66,10 +66,10 @@ class DefaultNewsReader extends BaseFrameworkSystem implements ReadableNews, Reg $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); // Add the page as criteria to it at lease - $criteriaInstance->addCriteria('page', $page); + $criteriaInstance->addCriteria('command', $command); // Add limitation from config - $criteriaInstance->setConfiguredLimit('news_' . $page . '_limit'); + $criteriaInstance->setConfiguredLimit('news_' . $command . '_limit'); // Get a resultInstance back from the database $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance); diff --git a/inc/classes/main/response/class_BaseResponse.php b/inc/classes/main/response/class_BaseResponse.php index 6afc20fc..0becb582 100644 --- a/inc/classes/main/response/class_BaseResponse.php +++ b/inc/classes/main/response/class_BaseResponse.php @@ -227,7 +227,7 @@ class BaseResponse extends BaseFrameworkSystem { * * @return $defaultCommand Default command for this response */ - public function getDefaultCommand () { + public function determineDefaultCommand () { // Get application instance $applicationInstance = Registry::getRegistry()->getInstance('app'); -- 2.39.2