From 6d0fbeb0a7fde0cc8bae6c9944ea6b017d96968a Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Sun, 16 Mar 2008 20:42:30 +0000 Subject: Moved some external packages into lib to make system more self contained --- lib/smarty-2.6.8/plugins/function.eval.php | 49 ++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 lib/smarty-2.6.8/plugins/function.eval.php (limited to 'lib/smarty-2.6.8/plugins/function.eval.php') diff --git a/lib/smarty-2.6.8/plugins/function.eval.php b/lib/smarty-2.6.8/plugins/function.eval.php new file mode 100644 index 0000000..ff0472d --- /dev/null +++ b/lib/smarty-2.6.8/plugins/function.eval.php @@ -0,0 +1,49 @@ + + * Name: eval
+ * Purpose: evaluate a template variable as a template
+ * @link http://smarty.php.net/manual/en/language.function.eval.php {eval} + * (Smarty online manual) + * @author Monte Ohrt + * @param array + * @param Smarty + */ +function smarty_function_eval($params, &$smarty) +{ + + if (!isset($params['var'])) { + $smarty->trigger_error("eval: missing 'var' parameter"); + return; + } + + if($params['var'] == '') { + return; + } + + $smarty->_compile_source('evaluated template', $params['var'], $_var_compiled); + + ob_start(); + $smarty->_eval('?>' . $_var_compiled); + $_contents = ob_get_contents(); + ob_end_clean(); + + if (!empty($params['assign'])) { + $smarty->assign($params['assign'], $_contents); + } else { + return $_contents; + } +} + +/* vim: set expandtab: */ + +?> -- cgit v1.2.3