1: | <?php
|
2: |
|
3: | |
4: | |
5: | |
6: | |
7: | |
8: | |
9: | |
10: | |
11: |
|
12: | class Smarty_Internal_Method_AddAutoloadFilters extends Smarty_Internal_Method_SetAutoloadFilters
|
13: | {
|
14: | |
15: | |
16: | |
17: | |
18: | |
19: | |
20: | |
21: | |
22: | |
23: | |
24: | |
25: | |
26: | |
27: | |
28: | |
29: |
|
30: | public function addAutoloadFilters(Smarty_Internal_TemplateBase $obj, $filters, $type = null)
|
31: | {
|
32: | $smarty = $obj->_getSmartyObj();
|
33: | if ($type !== null) {
|
34: | $this->_checkFilterType($type);
|
35: | if (!empty($smarty->autoload_filters[ $type ])) {
|
36: | $smarty->autoload_filters[ $type ] = array_merge($smarty->autoload_filters[ $type ], (array)$filters);
|
37: | } else {
|
38: | $smarty->autoload_filters[ $type ] = (array)$filters;
|
39: | }
|
40: | } else {
|
41: | foreach ((array)$filters as $type => $value) {
|
42: | $this->_checkFilterType($type);
|
43: | if (!empty($smarty->autoload_filters[ $type ])) {
|
44: | $smarty->autoload_filters[ $type ] =
|
45: | array_merge($smarty->autoload_filters[ $type ], (array)$value);
|
46: | } else {
|
47: | $smarty->autoload_filters[ $type ] = (array)$value;
|
48: | }
|
49: | }
|
50: | }
|
51: | return $obj;
|
52: | }
|
53: | }
|
54: | |