- enhancement allow access to properties of registered opjects for Smarty2 BC (forum topic 24344)

This commit is contained in:
Uwe.Tews@googlemail.com
2013-07-27 09:48:42 +00:00
parent 697696fef9
commit e62dcaa6a9
2 changed files with 24 additions and 14 deletions

View File

@@ -1,4 +1,7 @@
===== trunk ===== ===== trunk =====
27.07.2013
- enhancement allow access to properties of registered opjects for Smarty2 BC (forum topic 24344)
26.07.2013 26.07.2013
- bugfix template inheritance nesting problem (forum topic 24387) - bugfix template inheritance nesting problem (forum topic 24387)

View File

@@ -48,6 +48,8 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co
$_assign = $_attr['assign']; $_assign = $_attr['assign'];
unset($_attr['assign']); unset($_attr['assign']);
} }
// method or property ?
if (method_exists($compiler->smarty->registered_objects[$tag][0], $method)) {
// convert attributes into parameter array string // convert attributes into parameter array string
if ($compiler->smarty->registered_objects[$tag][2]) { if ($compiler->smarty->registered_objects[$tag][2]) {
$_paramsArray = array(); $_paramsArray = array();
@@ -64,6 +66,11 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co
$_params = implode(",", $_attr); $_params = implode(",", $_attr);
$return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params})"; $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params})";
} }
} else {
// object property
$return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}";
}
if (empty($_assign)) { if (empty($_assign)) {
// This tag does create output // This tag does create output
$compiler->has_output = true; $compiler->has_output = true;