1<?php
2
3/**
4 * Smarty Method GetAutoloadFilters
5 *
6 * Smarty::getAutoloadFilters() method
7 *
8 * @package    Smarty
9 * @subpackage PluginsInternal
10 * @author     Uwe Tews
11 */
12class Smarty_Internal_Method_GetAutoloadFilters extends Smarty_Internal_Method_SetAutoloadFilters
13{
14    /**
15     * Get autoload filters
16     *
17     * @api Smarty::getAutoloadFilters()
18     *
19     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
20     * @param string                                                          $type type of filter to get auto loads
21     *                                                                              for. Defaults to all autoload
22     *                                                                              filters
23     *
24     * @return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type
25     *                was specified
26     * @throws \SmartyException
27     */
28    public function getAutoloadFilters(Smarty_Internal_TemplateBase $obj, $type = null)
29    {
30        $smarty = $obj->_getSmartyObj();
31        if ($type !== null) {
32            $this->_checkFilterType($type);
33            return isset($smarty->autoload_filters[ $type ]) ? $smarty->autoload_filters[ $type ] : array();
34        }
35        return $smarty->autoload_filters;
36    }
37}
38