public function addFilter($callback, $autoload = false)
    {
        if ($autoload) {
            $class = self::NAMESPACE_PLUGINS_FILTERS . self::toCamelCase($callback);
            if (!class_exists($class) && !function_exists($class)) {
                try {
                    $this->getLoader()->loadPlugin($callback);
                }
                catch (Exception $e) {
                    if (strstr($callback, self::NAMESPACE_PLUGINS_FILTERS)) {
                        throw new Exception('Wrong filter name : ' . $callback . ', the "Filter" prefix should not be used, please only use "' . str_replace('Filter', '', $callback) . '"');
                    } else {
                        throw new Exception('Wrong filter name : ' . $callback . ', when using autoload the filter must be in one of your plugin dir as "name.php" containig a class or function named "Filter<name>"');
                    }
                }
            }

            if (class_exists($class)) {
                $callback = array(new $class($this), 'process');
            } elseif (function_exists($class)) {
                $callback = $class;
            } else {
                throw new Exception('Wrong filter name : ' . $callback . ', when using autoload the filter must be in one of your plugin dir as "name.php" containig a class or function named "Filter<name>"');
            }

            $this->filters[] = $callback;
        } else {
            $this->filters[] = $callback;
        }
    }
public function addFilter($callback, $autoload = false)
    {
        if ($autoload) {
            $class = self::NAMESPACE_PLUGINS_FILTERS . self::toCamelCase($callback);
            if (!class_exists($class) && !function_exists($class)) {
                try {
                    $this->getLoader()->loadPlugin($callback);
                }
                catch (Exception $e) {
                    if (strstr($callback, self::NAMESPACE_PLUGINS_FILTERS)) {
                        throw new Exception('Wrong filter name : ' . $callback . ', the "Filter" prefix should not be used, please only use "' . str_replace('Filter', '', $callback) . '"');
                    } else {
                        throw new Exception('Wrong filter name : ' . $callback . ', when using autoload the filter must be in one of your plugin dir as "name.php" containig a class or function named "Filter<name>"');
                    }
                }
            }

            if (class_exists($class)) {
                $callback = array(new $class($this), 'process');
            } elseif (function_exists($class)) {
                $callback = $class;
            } else {
                throw new Exception('Wrong filter name : ' . $callback . ', when using autoload the filter must be in one of your plugin dir as "name.php" containig a class or function named "Filter<name>"');
            }

            $this->filters[] = $callback;
        } else {
            $this->filters[] = $callback;
        }
    }
public function addFilter ( $ callback , $ autoload = false ) { if ( $ autoload ) { $ class = self :: NAMESPACE_PLUGINS_FILTERS . self :: toCamelCase ( $ callback ) ; if ( ! class_exists ( $ class ) && ! function_exists ( $ class ) ) { try { $ this -> getLoader ( ) -> loadPlugin ( $ callback ) ; } catch ( Exception $ e ) { if ( strstr ( $ callback , self :: NAMESPACE_PLUGINS_FILTERS ) ) { throw new Exception ( 'Wrong filter name : ' . $ callback . ', the "Filter" prefix should not be used, please only use "' . str_replace ( 'Filter' , '' , $ callback ) . '"' ) ; } else { throw new Exception ( 'Wrong filter name : ' . $ callback . ', when using autoload the filter must be in one of your plugin dir as "name.php" containig a class or function named "Filter<name>"' ) ; } } } if ( class_exists ( $ class ) ) { $ callback = array ( new $ class ( $ this ) , 'process' ) ; } elseif ( function_exists ( $ class ) ) { $ callback = $ class ; } else { throw new Exception ( 'Wrong filter name : ' . $ callback . ', when using autoload the filter must be in one of your plugin dir as "name.php" containig a class or function named "Filter<name>"' ) ; } $ this -> filters [ ] = $ callback ; } else { $ this -> filters [ ] = $ callback ; } }
Adds a filter to this Dwoo instance, it will be used to filter the output of all the templates rendered by this
instance.

@param mixed $callback a callback or a filter name if it is autoloaded from a plugin directory
@param bool  $autoload if true, the first parameter must be a filter name from one of the plugin directories

@return void
@throws Exception
Adds a filter to this Dwoo instance it will be used to filter the output of all the templates rendered by this instance .