From 7085a0c2f7104a56a7e946c43ba0b5736be5f4e7 Mon Sep 17 00:00:00 2001 From: emkael Date: Tue, 27 Dec 2016 14:47:01 +0100 Subject: * smarty bundled --- ...ty_internal_compile_private_function_plugin.php | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 lib/smarty3/sysplugins/smarty_internal_compile_private_function_plugin.php (limited to 'lib/smarty3/sysplugins/smarty_internal_compile_private_function_plugin.php') diff --git a/lib/smarty3/sysplugins/smarty_internal_compile_private_function_plugin.php b/lib/smarty3/sysplugins/smarty_internal_compile_private_function_plugin.php new file mode 100644 index 0000000..e7934e1 --- /dev/null +++ b/lib/smarty3/sysplugins/smarty_internal_compile_private_function_plugin.php @@ -0,0 +1,74 @@ +getAttributes($compiler, $args); + + unset($_attr[ 'nocache' ]); + // convert attributes into parameter array string + $_paramsArray = array(); + foreach ($_attr as $_key => $_value) { + if (is_int($_key)) { + $_paramsArray[] = "$_key=>$_value"; + } else { + $_paramsArray[] = "'$_key'=>$_value"; + } + } + $_params = 'array(' . implode(",", $_paramsArray) . ')'; + // compile code + $output = "{$function}({$_params},\$_smarty_tpl)"; + if (!empty($parameter[ 'modifierlist' ])) { + $output = $compiler->compileTag('private_modifier', array(), + array('modifierlist' => $parameter[ 'modifierlist' ], + 'value' => $output)); + } + //Does tag create output + $compiler->has_output = isset($_attr[ 'assign' ]) ? false : true; + $output = "has_output ? "echo " : '') . "{$output};?>\n"; + return $output; + } +} -- cgit v1.2.3