From ab5d8d4e07bb3c8230d0285ef8902ef1979fce51 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 18 Oct 2018 02:39:34 +0200 Subject: Updating Smarty --- ...ty_internal_compile_private_object_function.php | 86 ++++++++++++---------- 1 file changed, 46 insertions(+), 40 deletions(-) (limited to 'lib/smarty/sysplugins/smarty_internal_compile_private_object_function.php') diff --git a/lib/smarty/sysplugins/smarty_internal_compile_private_object_function.php b/lib/smarty/sysplugins/smarty_internal_compile_private_object_function.php index f649084..2a763c6 100644 --- a/lib/smarty/sysplugins/smarty_internal_compile_private_object_function.php +++ b/lib/smarty/sysplugins/smarty_internal_compile_private_object_function.php @@ -1,22 +1,21 @@ getAttributes($compiler, $args); - if ($_attr['nocache'] === true) { - $compiler->tag_nocache = true; - } - unset($_attr['nocache']); + unset($_attr[ 'nocache' ]); $_assign = null; - if (isset($_attr['assign'])) { - $_assign = $_attr['assign']; - unset($_attr['assign']); + if (isset($_attr[ 'assign' ])) { + $_assign = $_attr[ 'assign' ]; + unset($_attr[ 'assign' ]); } - // 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"; + // method or property ? + if (is_callable(array($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) . ')'; + $output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params},\$_smarty_tpl)"; + } else { + $_params = implode(',', $_attr); + $output = "\$_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 + $output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}"; + } + if (!empty($parameter[ 'modifierlist' ])) { + $output = $compiler->compileTag( + 'private_modifier', + array(), + array('modifierlist' => $parameter[ 'modifierlist' ], 'value' => $output) + ); } if (empty($_assign)) { - // This tag does create output - $compiler->has_output = true; - $output = "\n"; + return "\n"; } else { - $output = "assign({$_assign},{$return});?>\n"; + return "assign({$_assign},{$output});?>\n"; } - return $output; } - } - -?> \ No newline at end of file -- cgit v1.2.3