From ab5d8d4e07bb3c8230d0285ef8902ef1979fce51 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 18 Oct 2018 02:39:34 +0200 Subject: Updating Smarty --- lib/smarty/sysplugins/smarty_template_config.php | 100 +++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 lib/smarty/sysplugins/smarty_template_config.php (limited to 'lib/smarty/sysplugins/smarty_template_config.php') diff --git a/lib/smarty/sysplugins/smarty_template_config.php b/lib/smarty/sysplugins/smarty_template_config.php new file mode 100644 index 0000000..850ae32 --- /dev/null +++ b/lib/smarty/sysplugins/smarty_template_config.php @@ -0,0 +1,100 @@ + true, 'php' => true); + if ($_template) { + $smarty = $_template->smarty; + $template_resource = $_template->template_resource; + } + if (empty($template_resource)) { + throw new SmartyException('Source: Missing name'); + } + // parse resource_name, load resource handler + list($name, $type) = Smarty_Resource::parseResourceName($template_resource, $smarty->default_config_type); + // make sure configs are not loaded via anything smarty can't handle + if (isset($_incompatible_resources[ $type ])) { + throw new SmartyException("Unable to use resource '{$type}' for config"); + } + $source = new Smarty_Template_Config($smarty, $template_resource, $type, $name); + $source->handler->populate($source, $_template); + if (!$source->exists && isset($smarty->default_config_handler_func)) { + Smarty_Internal_Method_RegisterDefaultTemplateHandler::_getDefaultTemplate($source); + $source->handler->populate($source, $_template); + } + return $source; + } +} -- cgit v1.2.3