|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
ddaishin Smarty n00b
Joined: 06 Jan 2004 Posts: 1
|
Posted: Tue Jan 06, 2004 3:22 pm Post subject: Problem with default_modifiers |
|
|
It did not work, although I set up $smarty->default_modifiers = array('escape:html');
I think that processing of default_modifiers in Smarty_Compiler has disappeared from the release of Smarty-2.6.0-RC3.
I referred to Smarty-2.6.0-RC2 and added the following to the code.
In function _parse_modifiers
Code: |
function _parse_modifiers(&$output, $modifier_string)
{
preg_match_all('!\|(@?\w+)((?>:(?:'. $this->_qstr_regexp . '|[^|]+))*)!', '|' . $modifier_string, $_match);
list(, $_modifiers, $modifier_arg_strings) = $_match;
|
Code: |
function _parse_modifiers(&$output, $modifier_string)
{
$_default_mod_string = '';
if(!preg_match('!(^|\|)smarty:nodefaults($|\|)!',$modifier_string)) {
$_default_mod_string = implode('|',(array)$this->default_modifiers);
}
$modifier_string = empty($modifier_string) ? $_default_mod_string : $_default_mod_string . '|' . $modifier_string;
preg_match_all('!\|(@?\w+)((?>:(?:'. $this->_qstr_regexp . '|[^|]+))*)!', '|' . $modifier_string, $_match);
|
Moreover, I commented out the following.
In function _parse_var_props
Code: |
function _parse_var_props($val)
{
$val = trim($val);
if(preg_match('!^(' . $this->_obj_call_regexp . '|' . $this->_dvar_regexp . ')(' . $this->_mod_regexp . '*)$!', $val, $match)) {
// $ variable or object
$return = $this->_parse_var($match[1]);
//if($match[2] != '') {
$this->_parse_modifiers($return, $match[2]);
//}
return $return;
}
|
Code: |
//if($match[2] != '') {
//}
|
I added the following to the head of modifier.escape.php.
Code: |
if(!is_string($string)){ return $string; }
|
About me, it seemed to have succeeded.
Although it was a digression, when the following was commented out similarly, Segfault happened. (child pid ** exit signal Segmentation fault (11) )
In function _parse_var_props
Code: |
elseif(preg_match('!^' . $this->_db_qstr_regexp . '(?:' . $this->_mod_regexp . '*)$!', $val)) {
// double quoted text
preg_match('!^(' . $this->_db_qstr_regexp . ')('. $this->_mod_regexp . '*)$!', $val, $match);
$return = $this->_expand_quoted_text($match[1]);
//if($match[2] != '') {
$this->_parse_modifiers($return, $match[2]);
//}
|
|
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Tue Jan 06, 2004 5:36 pm Post subject: |
|
|
Yep, the default_modifier disappeared accidently before 2.6.0. Try the cvs version. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|