mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 19:04:27 +02:00
- bugfix when cascading some modifier like |strip|strip_tags modifier
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
06/08/2010
|
||||||
|
- bugfix when cascading some modifier like |strip|strip_tags modifier
|
||||||
|
|
||||||
05/08/2010
|
05/08/2010
|
||||||
- added plugin type modifiercompiler to produce compiled modifier code
|
- added plugin type modifiercompiler to produce compiled modifier code
|
||||||
- changed standard modifier plugins to the compiling versions whenever possible
|
- changed standard modifier plugins to the compiling versions whenever possible
|
||||||
|
@@ -26,7 +26,7 @@ function smarty_modifiercompiler_strip($params, $compiler)
|
|||||||
if (!isset($params[1])) {
|
if (!isset($params[1])) {
|
||||||
$params[1] = "' '";
|
$params[1] = "' '";
|
||||||
}
|
}
|
||||||
return 'preg_replace(\'!\s+!\',' . $params[1] . ',' . $params[0] . ')';
|
return "preg_replace('!\s+!', {$params[1]},{$params[0]})";
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@@ -20,11 +20,11 @@
|
|||||||
*/
|
*/
|
||||||
function smarty_modifiercompiler_strip_tags($params, $compiler)
|
function smarty_modifiercompiler_strip_tags($params, $compiler)
|
||||||
{
|
{
|
||||||
if (!isset($params[1])) {
|
if (!isset($params[1])) {
|
||||||
$params[1] = true;
|
$params[1] = true;
|
||||||
}
|
}
|
||||||
if ($params[1] === true) {
|
if ($params[1] === true) {
|
||||||
return 'preg_replace(\'!<[^>]*?>!\', \' \', ' . $params[0] . ')';
|
return "preg_replace('!<[^>]*?>!', ' ', {$params[0]})";
|
||||||
} else {
|
} else {
|
||||||
return 'strip_tags(' . $params[0] . ')';
|
return 'strip_tags(' . $params[0] . ')';
|
||||||
}
|
}
|
||||||
|
@@ -39,8 +39,8 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
|
|||||||
$mod_array[0][$i] = ',';
|
$mod_array[0][$i] = ',';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$mod_array[0][0] = $output;
|
unset($mod_array[0][0]);
|
||||||
$params = implode('', $mod_array[0]);
|
$params = $output.implode('', $mod_array[0]);
|
||||||
// check for registered modifier
|
// check for registered modifier
|
||||||
if (isset($compiler->smarty->registered_plugins['modifier'][$modifier])) {
|
if (isset($compiler->smarty->registered_plugins['modifier'][$modifier])) {
|
||||||
$function = $compiler->smarty->registered_plugins['modifier'][$modifier][0];
|
$function = $compiler->smarty->registered_plugins['modifier'][$modifier][0];
|
||||||
@@ -56,7 +56,7 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
|
|||||||
// check for plugin modifiercompiler
|
// check for plugin modifiercompiler
|
||||||
} else if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) {
|
} else if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) {
|
||||||
$plugin = 'smarty_modifiercompiler_' . $modifier;
|
$plugin = 'smarty_modifiercompiler_' . $modifier;
|
||||||
$args = explode(',', $params);
|
$args = array_merge((array)$output,$mod_array[0]);
|
||||||
$output = $plugin($args, $compiler);
|
$output = $plugin($args, $compiler);
|
||||||
// check for plugin modifier
|
// check for plugin modifier
|
||||||
} else if ($function = $this->compiler->getPlugin($modifier, 'modifier')) {
|
} else if ($function = $this->compiler->getPlugin($modifier, 'modifier')) {
|
||||||
|
Reference in New Issue
Block a user