diff --git a/Smarty.class.php b/Smarty.class.php
index a18785e7..5d876197 100644
--- a/Smarty.class.php
+++ b/Smarty.class.php
@@ -152,6 +152,9 @@ class Smarty
// sub directories are more efficient, but
// you can set this to false if your PHP environment
// does not allow the creation of them.
+ var $default_modifiers = '';
+ // modifier string to implicitly append to every var
+ // example: '|escape:"htmlall"'
/**************************************************************************/
/* END SMARTY CONFIGURATION SECTION */
@@ -1073,6 +1076,7 @@ function _generate_debug_output() {
$smarty_compiler->trusted_dir = $this->trusted_dir;
$smarty_compiler->_plugins = &$this->_plugins;
$smarty_compiler->_tpl_vars = &$this->_tpl_vars;
+ $smarty_compiler->default_modifiers = $this->default_modifiers;
if ($smarty_compiler->_compile_file($tpl_file, $template_source, $template_compiled))
return true;
diff --git a/Smarty_Compiler.class.php b/Smarty_Compiler.class.php
index c4c9368e..d65d46bc 100644
--- a/Smarty_Compiler.class.php
+++ b/Smarty_Compiler.class.php
@@ -1109,6 +1109,13 @@ class Smarty_Compiler extends Smarty {
$var_ref = $parts[0];
$modifiers = isset($parts[1]) ? $parts[1] : '';
+
+ if(!empty($this->default_modifiers) && !strstr($modifiers,'smarty:nodefaults')) {
+ $modifiers = empty($modifiers) ? $this->default_modifiers : $this->default_modifiers . '|' . $modifiers;
+ }
+
+ $modifiers = str_replace(array('smarty:nodefaults','||'),array('','|'),$modifiers);
+
preg_match_all('!\[(?:\$\w+|\w+(\.\w+)?)\]|(->|\.)\$?\w+|^\w+!', $var_ref, $match);
$indexes = $match[0];
$var_name = array_shift($indexes);
diff --git a/docs/designers.sgml b/docs/designers.sgml
index d33170a2..67e5666e 100644
--- a/docs/designers.sgml
+++ b/docs/designers.sgml
@@ -670,7 +670,7 @@ no title
1
string
No
- html,url,quotes,hex,hexentity
+ html,htmlall,url,quotes,hex,hexentity
html
This is the escape format to use.
@@ -678,12 +678,12 @@ no title
- This is used to html (or htmlall) escape, url escape, escape single
- quotes on a variable not already escaped, hex escape or hexentity
- escape. hex and hexentity escape can be used in conjunction to hide
- "mailto:" links on a page from web spiders (spam collectors) and
- yet keep them readable and linkable. By default, the variable is
- html escaped.
+ This is used to html escape, url escape, escape single quotes on a
+ variable not already escaped, hex escape or hexentity escape. hex
+ and hexentity escape can be used in conjunction to hide "mailto:"
+ links on a page from web spiders (spam collectors) and yet keep
+ them readable and linkable. By default, the variable is html
+ escaped.
escape
@@ -1195,8 +1195,8 @@ Blind woman gets new kidney<br>
from dad she hasn't seen in years.
Blind woman gets new kidney fr
-om dad she hasn't seen in
-years.
+om dad she hasn't seen in year
+s.
diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php
index a18785e7..5d876197 100644
--- a/libs/Smarty.class.php
+++ b/libs/Smarty.class.php
@@ -152,6 +152,9 @@ class Smarty
// sub directories are more efficient, but
// you can set this to false if your PHP environment
// does not allow the creation of them.
+ var $default_modifiers = '';
+ // modifier string to implicitly append to every var
+ // example: '|escape:"htmlall"'
/**************************************************************************/
/* END SMARTY CONFIGURATION SECTION */
@@ -1073,6 +1076,7 @@ function _generate_debug_output() {
$smarty_compiler->trusted_dir = $this->trusted_dir;
$smarty_compiler->_plugins = &$this->_plugins;
$smarty_compiler->_tpl_vars = &$this->_tpl_vars;
+ $smarty_compiler->default_modifiers = $this->default_modifiers;
if ($smarty_compiler->_compile_file($tpl_file, $template_source, $template_compiled))
return true;
diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php
index c4c9368e..d65d46bc 100644
--- a/libs/Smarty_Compiler.class.php
+++ b/libs/Smarty_Compiler.class.php
@@ -1109,6 +1109,13 @@ class Smarty_Compiler extends Smarty {
$var_ref = $parts[0];
$modifiers = isset($parts[1]) ? $parts[1] : '';
+
+ if(!empty($this->default_modifiers) && !strstr($modifiers,'smarty:nodefaults')) {
+ $modifiers = empty($modifiers) ? $this->default_modifiers : $this->default_modifiers . '|' . $modifiers;
+ }
+
+ $modifiers = str_replace(array('smarty:nodefaults','||'),array('','|'),$modifiers);
+
preg_match_all('!\[(?:\$\w+|\w+(\.\w+)?)\]|(->|\.)\$?\w+|^\w+!', $var_ref, $match);
$indexes = $match[0];
$var_name = array_shift($indexes);