00001 <?php 00026 class BaseController extends BaseFrameworkSystem implements Registerable { 00030 private $filterChains = array(); 00031 00038 protected function __construct ($className) { 00039 // Call parent constructor 00040 parent::__construct($className); 00041 00042 // Clean up a little 00043 $this->removeNumberFormaters(); 00044 $this->removeSystemArray(); 00045 00046 // Initialize both filter chains 00047 $this->initFilterChain('pre'); 00048 $this->initFilterChain('post'); 00049 00050 // Add this controller to the registry 00051 Registry::getRegistry()->addInstance('controller', $this); 00052 } 00053 00060 private function initFilterChain ($filterChain) { 00061 $this->filterChains[$filterChain] = ObjectFactory::createObjectByConfiguredName('filter_chain_class'); 00062 } 00063 00070 public function addPreFilter (Filterable $filterInstance) { 00071 // Add the pre filter 00072 $this->filterChains['pre']->addFilter($filterInstance); 00073 } 00074 00081 public function addPostFilter (Filterable $filterInstance) { 00082 // Add the post filter 00083 $this->filterChains['post']->addFilter($filterInstance); 00084 } 00085 00093 protected function executePreFilters (Requestable $requestInstance, Responseable $responseInstance) { 00094 // Execute all pre filters 00095 $this->filterChains['pre']->processFilters($requestInstance, $responseInstance); 00096 } 00097 00105 protected function executePostFilters (Requestable $requestInstance, Responseable $responseInstance) { 00106 // Execute all post filters 00107 $this->filterChains['post']->processFilters($requestInstance, $responseInstance); 00108 } 00109 } 00110 00111 // [EOF] 00112 ?>
1.5.6