mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-03 18:04:26 +02:00
Fixed modifiercompiler handling multiple/chained modifiers
This commit is contained in:
@@ -50,29 +50,27 @@ class ModifierCompiler extends Base {
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
if ($handler = $compiler->getModifierCompiler($modifier)) {
|
if ($handler = $compiler->getModifierCompiler($modifier)) {
|
||||||
return $handler->compile($single_modifier, $compiler);
|
$output = $handler->compile($single_modifier, $compiler);
|
||||||
|
|
||||||
} elseif ($compiler->getSmarty()->getModifierCallback($modifier)) {
|
} elseif ($compiler->getSmarty()->getModifierCallback($modifier)) {
|
||||||
return sprintf(
|
$output = sprintf(
|
||||||
'$_smarty_tpl->smarty->getModifierCallback(%s)(%s)',
|
'$_smarty_tpl->smarty->getModifierCallback(%s)(%s)',
|
||||||
var_export($modifier, true),
|
var_export($modifier, true),
|
||||||
$params
|
$params
|
||||||
);
|
);
|
||||||
} elseif ($callback = $compiler->getPluginFromDefaultHandler($modifier, \Smarty\Smarty::PLUGIN_MODIFIERCOMPILER)) {
|
} elseif ($callback = $compiler->getPluginFromDefaultHandler($modifier, \Smarty\Smarty::PLUGIN_MODIFIERCOMPILER)) {
|
||||||
$wrapper = new \Smarty\Compile\Modifier\BCPluginWrapper($callback);
|
$output = (new \Smarty\Compile\Modifier\BCPluginWrapper($callback))->compile($single_modifier, $compiler);
|
||||||
return $wrapper->compile($single_modifier, $compiler);
|
|
||||||
} elseif ($function = $compiler->getPluginFromDefaultHandler($modifier, \Smarty\Smarty::PLUGIN_MODIFIER)) {
|
} elseif ($function = $compiler->getPluginFromDefaultHandler($modifier, \Smarty\Smarty::PLUGIN_MODIFIER)) {
|
||||||
if (!is_array($function)) {
|
if (!is_array($function)) {
|
||||||
return "{$function}({$params})";
|
$output = "{$function}({$params})";
|
||||||
|
} else {
|
||||||
|
$operator = is_object($function[0]) ? '->' : '::';
|
||||||
|
$output = $function[0] . $operator . $function[1] . '(' . $params . ')';
|
||||||
}
|
}
|
||||||
$operator = is_object($function[0]) ? '->' : '::';
|
|
||||||
return $function[0] . $operator . $function[1] . '(' . $params . ')';
|
|
||||||
} else {
|
} else {
|
||||||
$compiler->trigger_template_error("unknown modifier '{$modifier}'", null, true);
|
$compiler->trigger_template_error("unknown modifier '{$modifier}'", null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user