From 967ab871b836f618107fe144978bd1453c3c6634 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Thu, 11 Dec 2014 20:15:27 +0000 Subject: Update Smarty --- ...ty_internal_compile_private_object_function.php | 59 ++++++++++++---------- 1 file changed, 32 insertions(+), 27 deletions(-) (limited to 'library/Smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php') diff --git a/library/Smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php b/library/Smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php index f649084c3..d6eb47ab3 100644 --- a/library/Smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php +++ b/library/Smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php @@ -1,22 +1,21 @@ smarty->registered_objects[$tag][2]) { - $_paramsArray = array(); - foreach ($_attr as $_key => $_value) { - if (is_int($_key)) { - $_paramsArray[] = "$_key=>$_value"; - } else { - $_paramsArray[] = "'$_key'=>$_value"; + // method or property ? + if (method_exists($compiler->smarty->registered_objects[$tag][0], $method)) { + // convert attributes into parameter array string + if ($compiler->smarty->registered_objects[$tag][2]) { + $_paramsArray = array(); + foreach ($_attr as $_key => $_value) { + if (is_int($_key)) { + $_paramsArray[] = "$_key=>$_value"; + } else { + $_paramsArray[] = "'$_key'=>$_value"; + } } + $_params = 'array(' . implode(",", $_paramsArray) . ')'; + $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params},\$_smarty_tpl)"; + } else { + $_params = implode(",", $_attr); + $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params})"; } - $_params = 'array(' . implode(",", $_paramsArray) . ')'; - $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params},\$_smarty_tpl)"; } else { - $_params = implode(",", $_attr); - $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params})"; + // object property + $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}"; } + if (empty($_assign)) { // This tag does create output $compiler->has_output = true; @@ -71,9 +78,7 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co } else { $output = "assign({$_assign},{$return});?>\n"; } + return $output; } - } - -?> \ No newline at end of file -- cgit v1.2.3