1: | <?php
|
2: | |
3: | |
4: | |
5: | |
6: | |
7: | |
8: | |
9: |
|
10: |
|
11: | |
12: | |
13: | |
14: | |
15: | |
16: |
|
17: | class Smarty_Internal_Runtime_FilterHandler
|
18: | {
|
19: | |
20: | |
21: | |
22: | |
23: | |
24: | |
25: | |
26: | |
27: | |
28: | |
29: | |
30: | |
31: | |
32: |
|
33: | public function runFilter($type, $content, Smarty_Internal_Template $template)
|
34: | {
|
35: |
|
36: | if (!empty($template->smarty->autoload_filters[ $type ])) {
|
37: | foreach ((array)$template->smarty->autoload_filters[ $type ] as $name) {
|
38: | $plugin_name = "Smarty_{$type}filter_{$name}";
|
39: | if (function_exists($plugin_name)) {
|
40: | $callback = $plugin_name;
|
41: | } elseif (class_exists($plugin_name, false) && is_callable(array($plugin_name, 'execute'))) {
|
42: | $callback = array($plugin_name, 'execute');
|
43: | } elseif ($template->smarty->loadPlugin($plugin_name, false)) {
|
44: | if (function_exists($plugin_name)) {
|
45: |
|
46: | $callback = $plugin_name;
|
47: | } elseif (class_exists($plugin_name, false) && is_callable(array($plugin_name, 'execute'))) {
|
48: |
|
49: | $callback = array($plugin_name, 'execute');
|
50: | } else {
|
51: | throw new SmartyException("Auto load {$type}-filter plugin method '{$plugin_name}::execute' not callable");
|
52: | }
|
53: | } else {
|
54: |
|
55: | throw new SmartyException("Unable to auto load {$type}-filter plugin '{$plugin_name}'");
|
56: | }
|
57: | $content = call_user_func($callback, $content, $template);
|
58: | }
|
59: | }
|
60: |
|
61: | if (!empty($template->smarty->registered_filters[ $type ])) {
|
62: | foreach ($template->smarty->registered_filters[ $type ] as $key => $name) {
|
63: | $content = call_user_func($template->smarty->registered_filters[ $type ][ $key ], $content, $template);
|
64: | }
|
65: | }
|
66: |
|
67: | return $content;
|
68: | }
|
69: | }
|
70: | |