Added post-filter support.
[core.git] / inc / classes / main / filter / class_FilterChain.php
index 1c2433313f1b99547cef8c701c1d9d92d79e4c6e..e80c956d88383d933a7a4da57c28fb2ce478a094 100644 (file)
@@ -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.