X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Fclasses%2Fmain%2Fcontroller%2Fclass_BaseController.php;h=e604b54c977ce53bfd468a77dd73ab5bed6da882;hb=33df9198674ca343b89dee4f0b8ec0808171cd85;hp=0fa79fbac92b2eb84e49360b2ffca525ddcd64a1;hpb=a85b4e10e1cfefe163f6ebf767b5d0e2193ff268;p=core.git diff --git a/inc/classes/main/controller/class_BaseController.php b/inc/classes/main/controller/class_BaseController.php index 0fa79fba..e604b54c 100644 --- a/inc/classes/main/controller/class_BaseController.php +++ b/inc/classes/main/controller/class_BaseController.php @@ -4,11 +4,11 @@ * write your own controller. You get the advantage that you can use the pre and * post filters. * - * @author Roland Haeder + * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.shipsimu.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 @@ -61,9 +61,9 @@ class BaseController extends BaseFrameworkSystem implements Registerable { * @return void */ protected function initFilterChain ($filterChain) { - //* DEBUG: */ $this->debugOutput('CONTROLLER: ' . $filterChain . ' init: START'); + //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONTROLLER: ' . $filterChain . ' init: START'); $this->filterChains[$filterChain] = ObjectFactory::createObjectByConfiguredName('filter_chain_class'); - //* DEBUG: */ $this->debugOutput('CONTROLLER: ' . $filterChain . ' init: FINISHED'); + //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONTROLLER: ' . $filterChain . ' init: FINISHED'); } /** @@ -75,7 +75,7 @@ class BaseController extends BaseFrameworkSystem implements Registerable { * @throws InvalidFilterChainException If the filter chain is invalid */ protected function addFilter ($filterChain, Filterable $filterInstance) { - //* DEBUG: */ $this->debugOutput('CONTROLLER: ' . $filterChain . ',' . $filterInstance->__toString(). ' add: START'); + //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONTROLLER: ' . $filterChain . ',' . $filterInstance->__toString(). ' add: START'); // Test if the filter is there if (!isset($this->filterChains[$filterChain])) { @@ -85,7 +85,7 @@ class BaseController extends BaseFrameworkSystem implements Registerable { // Add the filter $this->filterChains[$filterChain]->addFilter($filterInstance); - //* DEBUG: */ $this->debugOutput('CONTROLLER: ' . $filterChain . ',' . $filterInstance->__toString(). ' add: FINISH'); + //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONTROLLER: ' . $filterChain . ',' . $filterInstance->__toString(). ' add: FINISH'); } /** @@ -153,6 +153,27 @@ class BaseController extends BaseFrameworkSystem implements Registerable { // Execute all post filters $this->executeFilters(self::FILTER_CHAIN_POST_COMMAND, $requestInstance, $responseInstance); } + + /** + * Add a shutdown filter + * + * @param $filterInstance A Filterable class + * @return void + */ + public function addShutdownFilter (Filterable $filterInstance) { + $this->addFilter('shutdown', $filterInstance); + } + + /** + * Executes all shutdown filters + * + * @param $requestInstance A Requestable class + * @param $responseInstance A Responseable class + * @return void + */ + public function executeShutdownFilters (Requestable $requestInstance, Responseable $responseInstance) { + $this->executeFilters('shutdown', $requestInstance, $responseInstance); + } } // [EOF]