hopefully fixed problem with quote characters ' " breaking form or appearing with...
[openemr.git] / library / plugins / function.eval.php
blob3a4b8b2b8c4e3514e7352849084b8979f27432bd
1 <?php
2 /**
3 * Smarty plugin
4 * @package Smarty
5 * @subpackage plugins
6 */
9 /**
10 * Smarty {eval} function plugin
12 * Type: function<br>
13 * Name: eval<br>
14 * Purpose: evaluate a template variable as a template<br>
15 * @link http://smarty.php.net/manual/en/language.function.eval.php {eval}
16 * (Smarty online manual)
17 * @param array
18 * @param Smarty
20 function smarty_function_eval($params, &$smarty)
23 if (!isset($params['var'])) {
24 $smarty->trigger_error("eval: missing 'var' parameter");
25 return;
28 if($params['var'] == '') {
29 return;
32 $smarty->_compile_source('evaluated template', $params['var'], $_var_compiled);
34 ob_start();
35 $smarty->_eval('?>' . $_var_compiled);
36 $_contents = ob_get_contents();
37 ob_end_clean();
39 if (!empty($params['assign'])) {
40 $smarty->assign($params['assign'], $_contents);
41 } else {
42 return $_contents;
46 /* vim: set expandtab: */