mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
- enhancement allow access to properties of registered opjects for Smarty2 BC (forum topic 24344)
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
===== trunk =====
|
||||
27.07.2013
|
||||
- enhancement allow access to properties of registered opjects for Smarty2 BC (forum topic 24344)
|
||||
|
||||
26.07.2013
|
||||
- bugfix template inheritance nesting problem (forum topic 24387)
|
||||
|
||||
|
@@ -28,9 +28,9 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co
|
||||
/**
|
||||
* Compiles code for the execution of function plugin
|
||||
*
|
||||
* @param array $args array with attributes from parser
|
||||
* @param array $args array with attributes from parser
|
||||
* @param object $compiler compiler object
|
||||
* @param array $parameter array with compilation parameter
|
||||
* @param array $parameter array with compilation parameter
|
||||
* @param string $tag name of function
|
||||
* @param string $method name of method to call
|
||||
* @return string compiled code
|
||||
@@ -48,22 +48,29 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co
|
||||
$_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 (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;
|
||||
|
Reference in New Issue
Block a user