Skip to content

Commit

Permalink
- bugfix nofilter tag option did not disable default modifier
Browse files Browse the repository at this point in the history
git-svn-id: http://smarty-php.googlecode.com/svn/trunk/distribution/libs@4358 9dce5a81-9a42-0410-99e4-3799d3902e7f
  • Loading branch information
uwe.tews@googlemail.com committed Oct 5, 2011
1 parent 0d059ef commit 8466966
Showing 1 changed file with 48 additions and 48 deletions.
96 changes: 48 additions & 48 deletions sysplugins/smarty_internal_compile_private_print_expression.php
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
<?php
/**
* Smarty Internal Plugin Compile Print Expression
*
* Compiles any tag which will output an expression or variable
*
* @package Smarty
* @subpackage Compiler
* @author Uwe Tews
*/
* Smarty Internal Plugin Compile Print Expression
*
* Compiles any tag which will output an expression or variable
*
* @package Smarty
* @subpackage Compiler
* @author Uwe Tews
*/

/**
* Smarty Internal Plugin Compile Print Expression Class
*
* @package Smarty
* @subpackage Compiler
*/
* Smarty Internal Plugin Compile Print Expression Class
*
* @package Smarty
* @subpackage Compiler
*/
class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_CompileBase {

/**
* Attribute definition: Overwrites base class.
*
* @var array
* @see Smarty_Internal_CompileBase
*/
* Attribute definition: Overwrites base class.
*
* @var array
* @see Smarty_Internal_CompileBase
*/
public $optional_attributes = array('assign');
/**
* Attribute definition: Overwrites base class.
*
* @var array
* @see Smarty_Internal_CompileBase
*/
* Attribute definition: Overwrites base class.
*
* @var array
* @see Smarty_Internal_CompileBase
*/
public $option_flags = array('nocache', 'nofilter');

/**
* Compiles code for gererting output from any expression
*
* @param array $args array with attributes from parser
* @param object $compiler compiler object
* @param array $parameter array with compilation parameter
* @return string compiled code
*/
* Compiles code for gererting output from any expression
*
* @param array $args array with attributes from parser
* @param object $compiler compiler object
* @param array $parameter array with compilation parameter
* @return string compiled code
*/
public function compile($args, $compiler, $parameter)
{
// check and get attributes
Expand All @@ -64,23 +64,23 @@ public function compile($args, $compiler, $parameter)
if (!empty($parameter['modifierlist'])) {
$output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => $parameter['modifierlist'], 'value' => $output));
}
// default modifier
if (!empty($compiler->smarty->default_modifiers)) {
if (empty($compiler->default_modifier_list)) {
$modifierlist = array();
foreach ($compiler->smarty->default_modifiers as $key => $single_default_modifier) {
preg_match_all('/(\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|:|[^:]+)/', $single_default_modifier, $mod_array);
for ($i = 0, $count = count($mod_array[0]);$i < $count;$i++) {
if ($mod_array[0][$i] != ':') {
$modifierlist[$key][] = $mod_array[0][$i];
if (!$_attr['nofilter']) {
// default modifier
if (!empty($compiler->smarty->default_modifiers)) {
if (empty($compiler->default_modifier_list)) {
$modifierlist = array();
foreach ($compiler->smarty->default_modifiers as $key => $single_default_modifier) {
preg_match_all('/(\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|:|[^:]+)/', $single_default_modifier, $mod_array);
for ($i = 0, $count = count($mod_array[0]);$i < $count;$i++) {
if ($mod_array[0][$i] != ':') {
$modifierlist[$key][] = $mod_array[0][$i];
}
}
}
$compiler->default_modifier_list = $modifierlist;
}
$compiler->default_modifier_list = $modifierlist;
$output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => $compiler->default_modifier_list, 'value' => $output));
}
$output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => $compiler->default_modifier_list, 'value' => $output));
}
if (!$_attr['nofilter']) {
// autoescape html
if ($compiler->template->smarty->escape_html) {
$output = "htmlspecialchars({$output}, ENT_QUOTES, SMARTY_RESOURCE_CHAR_SET)";
Expand Down Expand Up @@ -127,11 +127,11 @@ public function compile($args, $compiler, $parameter)
}

/**
* @param object $compiler compiler object
* @param string $name name of variable filter
* @param type $output embedded output
* @return string
*/
* @param object $compiler compiler object
* @param string $name name of variable filter
* @param type $output embedded output
* @return string
*/
private function compile_output_filter($compiler, $name, $output)
{
$plugin_name = "smarty_variablefilter_{$name}";
Expand Down

0 comments on commit 8466966

Please sign in to comment.