From ab5d8d4e07bb3c8230d0285ef8902ef1979fce51 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 18 Oct 2018 02:39:34 +0200 Subject: Updating Smarty --- .../smarty_internal_runtime_filterhandler.php | 69 ++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 lib/smarty/sysplugins/smarty_internal_runtime_filterhandler.php (limited to 'lib/smarty/sysplugins/smarty_internal_runtime_filterhandler.php') diff --git a/lib/smarty/sysplugins/smarty_internal_runtime_filterhandler.php b/lib/smarty/sysplugins/smarty_internal_runtime_filterhandler.php new file mode 100644 index 0000000..9f868e1 --- /dev/null +++ b/lib/smarty/sysplugins/smarty_internal_runtime_filterhandler.php @@ -0,0 +1,69 @@ +smarty->autoload_filters[ $type ])) { + foreach ((array)$template->smarty->autoload_filters[ $type ] as $name) { + $plugin_name = "Smarty_{$type}filter_{$name}"; + if (function_exists($plugin_name)) { + $callback = $plugin_name; + } elseif (class_exists($plugin_name, false) && is_callable(array($plugin_name, 'execute'))) { + $callback = array($plugin_name, 'execute'); + } elseif ($template->smarty->loadPlugin($plugin_name, false)) { + if (function_exists($plugin_name)) { + // use loaded Smarty2 style plugin + $callback = $plugin_name; + } elseif (class_exists($plugin_name, false) && is_callable(array($plugin_name, 'execute'))) { + // loaded class of filter plugin + $callback = array($plugin_name, 'execute'); + } else { + throw new SmartyException("Auto load {$type}-filter plugin method '{$plugin_name}::execute' not callable"); + } + } else { + // nothing found, throw exception + throw new SmartyException("Unable to auto load {$type}-filter plugin '{$plugin_name}'"); + } + $content = call_user_func($callback, $content, $template); + } + } + // loop over registered filters of specified type + if (!empty($template->smarty->registered_filters[ $type ])) { + foreach ($template->smarty->registered_filters[ $type ] as $key => $name) { + $content = call_user_func($template->smarty->registered_filters[ $type ][ $key ], $content, $template); + } + } + // return filtered output + return $content; + } +} -- cgit v1.2.3