From: Roland Haeder Date: Sun, 24 May 2015 17:55:58 +0000 (+0200) Subject: Added post-filter support. X-Git-Url: https://git.mxchange.org/?p=core.git;a=commitdiff_plain;h=ba3dac8b2dac48e02d7ac0297e3515275c3a83d1;ds=sidebyside Added post-filter support. Signed-off-by: Roland Häder --- diff --git a/inc/classes/main/filter/class_FilterChain.php b/inc/classes/main/filter/class_FilterChain.php index 1c243331..e80c956d 100644 --- a/inc/classes/main/filter/class_FilterChain.php +++ b/inc/classes/main/filter/class_FilterChain.php @@ -55,6 +55,16 @@ class FilterChain extends BaseFrameworkSystem implements Registerable { $this->pushValueToGenericArrayKey('filters', 'generic', 'dummy', $filterInstance); } + /** + * Add a new post-filter + * + * @param $filerInstance An instance of a post-filter class + * @return void + */ + public final function addPostFilter (Filterable $filterInstance) { + $this->pushValueToGenericArrayKey('filters', 'post', 'dummy', $filterInstance); + } + /** * "Getter" for filters array * @@ -74,6 +84,25 @@ class FilterChain extends BaseFrameworkSystem implements Registerable { return $filters; } + /** + * "Getter" for post-filters array + * + * @return $filters The filters array holding all post-filter instances + */ + protected function getPostFilters () { + // Default is nothing found + $filters = array(); + + // Are some filters set? + if ($this->isValidGenericArrayKey('filters', 'post', 'dummy')) { + // Then get them + $filters = $this->getGenericArrayKey('filters', 'post', 'dummy'); + } // END - if + + // Return it + return $filters; + } + /** * Process all added filters. Please note that filters must throw * FilterChainException if they need to interrupt the filter chain.