mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
- bugfix https://github.com/smarty-php/smarty/pull/368 did break the default plugin handler
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
27.5.2017
|
27.5.2017
|
||||||
- bugfix change compiled code for registered function and modifiers to called as callable to allow closures
|
- bugfix change compiled code for registered function and modifiers to called as callable to allow closures
|
||||||
https://github.com/smarty-php/smarty/pull/368
|
https://github.com/smarty-php/smarty/pull/368
|
||||||
|
- bugfix https://github.com/smarty-php/smarty/pull/368 did break the default plugin handler
|
||||||
|
|
||||||
21.5.2017
|
21.5.2017
|
||||||
- performance store flag for already required shared plugin functions in static variable or
|
- performance store flag for already required shared plugin functions in static variable or
|
||||||
|
@@ -108,7 +108,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* smarty version
|
* smarty version
|
||||||
*/
|
*/
|
||||||
const SMARTY_VERSION = '3.1.32-dev-9';
|
const SMARTY_VERSION = '3.1.32-dev-10';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* define variable scopes
|
* define variable scopes
|
||||||
|
@@ -41,8 +41,10 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna
|
|||||||
unset($_attr[ 'nocache' ]);
|
unset($_attr[ 'nocache' ]);
|
||||||
if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ])) {
|
if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ])) {
|
||||||
$tag_info = $compiler->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ];
|
$tag_info = $compiler->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ];
|
||||||
|
$is_registered = true;
|
||||||
} else {
|
} else {
|
||||||
$tag_info = $compiler->default_handler_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ];
|
$tag_info = $compiler->default_handler_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ];
|
||||||
|
$is_registered = false;
|
||||||
}
|
}
|
||||||
// not cacheable?
|
// not cacheable?
|
||||||
$compiler->tag_nocache = $compiler->tag_nocache || !$tag_info[ 1 ];
|
$compiler->tag_nocache = $compiler->tag_nocache || !$tag_info[ 1 ];
|
||||||
@@ -59,9 +61,18 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$_params = 'array(' . implode(",", $_paramsArray) . ')';
|
$_params = 'array(' . implode(",", $_paramsArray) . ')';
|
||||||
$function = $tag_info[ 0 ];
|
|
||||||
// compile code
|
// compile code
|
||||||
$output = "call_user_func_array( \$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['{$tag}'][0], array( {$_params},\$_smarty_tpl ) )";
|
if ($is_registered) {
|
||||||
|
$output =
|
||||||
|
"call_user_func_array( \$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['{$tag}'][0], array( {$_params},\$_smarty_tpl ) )";
|
||||||
|
} else {
|
||||||
|
$function = $tag_info[ 0 ];
|
||||||
|
if (!is_array($function)) {
|
||||||
|
$output = "{$function}({$_params},\$_smarty_tpl)";
|
||||||
|
} else {
|
||||||
|
$output = "{$function[0]}::{$function[1]}({$_params},\$_smarty_tpl)";
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!empty($parameter[ 'modifierlist' ])) {
|
if (!empty($parameter[ 'modifierlist' ])) {
|
||||||
$output = $compiler->compileTag('private_modifier', array(),
|
$output = $compiler->compileTag('private_modifier', array(),
|
||||||
array('modifierlist' => $parameter[ 'modifierlist' ],
|
array('modifierlist' => $parameter[ 'modifierlist' ],
|
||||||
|
Reference in New Issue
Block a user