From 51609351f2c4b5082b7e6f0744cd3811c325303f Mon Sep 17 00:00:00 2001 From: emkael Date: Tue, 11 Oct 2016 14:01:29 +0200 Subject: * initial template --- .../sysplugins/smarty_internal_filter_handler.php | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 lib/smarty/sysplugins/smarty_internal_filter_handler.php (limited to 'lib/smarty/sysplugins/smarty_internal_filter_handler.php') diff --git a/lib/smarty/sysplugins/smarty_internal_filter_handler.php b/lib/smarty/sysplugins/smarty_internal_filter_handler.php new file mode 100644 index 0000000..c9370e1 --- /dev/null +++ b/lib/smarty/sysplugins/smarty_internal_filter_handler.php @@ -0,0 +1,70 @@ +smarty->autoload_filters[$type])) { + foreach ((array)$template->smarty->autoload_filters[$type] as $name) { + $plugin_name = "Smarty_{$type}filter_{$name}"; + if ($template->smarty->loadPlugin($plugin_name)) { + if (function_exists($plugin_name)) { + // use loaded Smarty2 style plugin + $output = $plugin_name($output, $template); + } elseif (class_exists($plugin_name, false)) { + // loaded class of filter plugin + $output = call_user_func(array($plugin_name, 'execute'), $output, $template); + } + } else { + // nothing found, throw exception + throw new SmartyException("Unable to load filter {$plugin_name}"); + } + } + } + // loop over registerd filters of specified type + if (!empty($template->smarty->registered_filters[$type])) { + foreach ($template->smarty->registered_filters[$type] as $key => $name) { + if (is_array($template->smarty->registered_filters[$type][$key])) { + $output = call_user_func($template->smarty->registered_filters[$type][$key], $output, $template); + } else { + $output = $template->smarty->registered_filters[$type][$key]($output, $template); + } + } + } + // return filtered output + return $output; + } + +} + +?> \ No newline at end of file -- cgit v1.2.3