Smarty::addAutoloadFilters PHP Method

addAutoloadFilters() public method

Add autoload filters
public addAutoloadFilters ( array $filters, string $type = null ) : Smarty
$filters array filters to load automatically
$type string "pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types
return Smarty current Smarty instance for chaining
    public function addAutoloadFilters($filters, $type = null)
    {
        if ($type !== null) {
            if (!empty($this->autoload_filters[$type])) {
                $this->autoload_filters[$type] = array_merge($this->autoload_filters[$type], (array) $filters);
            } else {
                $this->autoload_filters[$type] = (array) $filters;
            }
        } else {
            foreach ((array) $filters as $key => $value) {
                if (!empty($this->autoload_filters[$key])) {
                    $this->autoload_filters[$key] = array_merge($this->autoload_filters[$key], (array) $value);
                } else {
                    $this->autoload_filters[$key] = (array) $value;
                }
            }
        }
        return $this;
    }