- implementation of $smarty->default_modifiers as in Smarty2

This commit is contained in:
Uwe.Tews
2010-05-06 00:11:30 +00:00
parent df1ddc31fc
commit 2e8b7c864d
2 changed files with 28 additions and 18 deletions

View File

@@ -1,5 +1,6 @@
05/05/2010 05/05/2010
- bugfix on {insert} to cache parameter - bugfix on {insert} to cache parameter
- implementation of $smarty->default_modifiers as in Smarty2
01/05/2010 01/05/2010
- bugfix on handling of variable method names at object chaning - bugfix on handling of variable method names at object chaning

View File

@@ -1,24 +1,24 @@
<?php <?php
/** /**
* Smarty Internal Plugin Compile Print Expression * Smarty Internal Plugin Compile Print Expression
* *
* Compiles any tag which will output an expression or variable * Compiles any tag which will output an expression or variable
* *
* @package Smarty * @package Smarty
* @subpackage Compiler * @subpackage Compiler
* @author Uwe Tews * @author Uwe Tews
*/ */
/** /**
* Smarty Internal Plugin Compile Print Expression Class * Smarty Internal Plugin Compile Print Expression Class
*/ */
class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_CompileBase { class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_CompileBase {
/** /**
* Compiles code for gererting output from any expression * Compiles code for gererting output from any expression
* *
* @param array $args array with attributes from parser * @param array $args array with attributes from parser
* @param object $compiler compiler object * @param object $compiler compiler object
* @return string compiled code * @return string compiled code
*/ */
public function compile($args, $compiler) public function compile($args, $compiler)
{ {
$this->compiler = $compiler; $this->compiler = $compiler;
@@ -49,10 +49,19 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C
// display value // display value
$this->compiler->has_output = true; $this->compiler->has_output = true;
if (isset($this->compiler->smarty->registered_filters['variable'])) { if (isset($this->compiler->smarty->registered_filters['variable'])) {
$output = '<?php echo Smarty_Internal_Filter_Handler::runFilter(\'variable\', ' . $_attr['value'] . ',$_smarty_tpl->smarty, $_smarty_tpl, ' . $_attr['filter'] . ');?>'; $output = 'Smarty_Internal_Filter_Handler::runFilter(\'variable\', ' . $_attr['value'] . ',$_smarty_tpl->smarty, $_smarty_tpl, ' . $_attr['filter'] . ')';
} else { } else {
$output = '<?php echo ' . $_attr['value'] . ';?>'; $output = $_attr['value'];
} }
if (!isset($_attr['nofilter']) && isset($this->compiler->smarty->default_modifiers)) {
foreach ($this->compiler->smarty->default_modifiers as $default_modifier) {
$mod_array = explode (':', $default_modifier);
$modifier = $mod_array[0];
$mod_array[0] = $output;
$output = $this->compiler->compileTag('private_modifier', array('modifier' => $modifier, 'params' => implode(", ", $mod_array)));
}
}
$output = '<?php echo ' . $output . ';?>';
} }
return $output; return $output;
} }