From 7085a0c2f7104a56a7e946c43ba0b5736be5f4e7 Mon Sep 17 00:00:00 2001 From: emkael Date: Tue, 27 Dec 2016 14:47:01 +0100 Subject: * smarty bundled --- .../smarty_internal_compile_config_load.php | 98 ++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 lib/smarty3/sysplugins/smarty_internal_compile_config_load.php (limited to 'lib/smarty3/sysplugins/smarty_internal_compile_config_load.php') diff --git a/lib/smarty3/sysplugins/smarty_internal_compile_config_load.php b/lib/smarty3/sysplugins/smarty_internal_compile_config_load.php new file mode 100644 index 0000000..d59ea3f --- /dev/null +++ b/lib/smarty3/sysplugins/smarty_internal_compile_config_load.php @@ -0,0 +1,98 @@ + Smarty::SCOPE_LOCAL, 'parent' => Smarty::SCOPE_PARENT, + 'root' => Smarty::SCOPE_ROOT, 'tpl_root' => Smarty::SCOPE_TPL_ROOT, + 'smarty' => Smarty::SCOPE_SMARTY); + + /** + * Compiles code for the {config_load} tag + * + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object + * + * @return string compiled code + * @throws \SmartyCompilerException + */ + public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) + { + // check and get attributes + $_attr = $this->getAttributes($compiler, $args); + + if ($_attr[ 'nocache' ] === true) { + $compiler->trigger_template_error('nocache option not allowed', null, true); + } + + // save possible attributes + $conf_file = $_attr[ 'file' ]; + if (isset($_attr[ 'section' ])) { + $section = $_attr[ 'section' ]; + } else { + $section = 'null'; + } + // scope setup + if ($_attr[ 'noscope' ]) { + $_scope = - 1; + } else { + $_scope = $compiler->convertScope($_attr, $this->valid_scopes); + } + + // create config object + $_output = + "smarty->ext->configLoad->_loadConfigFile(\$_smarty_tpl, {$conf_file}, {$section}, {$_scope});\n?>\n"; + + return $_output; + } +} -- cgit v1.2.3