Make _current_file available to prefilters.

This commit is contained in:
andrey
2002-03-21 16:24:43 +00:00
parent 49c34c5796
commit ede81304c9
2 changed files with 10 additions and 10 deletions

View File

@@ -72,6 +72,11 @@ class Smarty_Compiler extends Smarty {
$this->_filters_loaded = true; $this->_filters_loaded = true;
} }
$this->_current_file = $tpl_file;
$this->_current_line_no = 1;
$ldq = preg_quote($this->left_delimiter, '!');
$rdq = preg_quote($this->right_delimiter, '!');
// run template source through prefilter functions // run template source through prefilter functions
if (count($this->_plugins['prefilter']) > 0) { if (count($this->_plugins['prefilter']) > 0) {
foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) { foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) {
@@ -84,11 +89,6 @@ class Smarty_Compiler extends Smarty {
} }
} }
$this->_current_file = $tpl_file;
$this->_current_line_no = 1;
$ldq = preg_quote($this->left_delimiter, '!');
$rdq = preg_quote($this->right_delimiter, '!');
/* Annihilate the comments. */ /* Annihilate the comments. */
$template_source = preg_replace("!({$ldq})\*(.*?)\*({$rdq})!se", $template_source = preg_replace("!({$ldq})\*(.*?)\*({$rdq})!se",
"'\\1*'.str_repeat(\"\n\", substr_count('\\2', \"\n\")) .'*\\3'", "'\\1*'.str_repeat(\"\n\", substr_count('\\2', \"\n\")) .'*\\3'",

View File

@@ -72,6 +72,11 @@ class Smarty_Compiler extends Smarty {
$this->_filters_loaded = true; $this->_filters_loaded = true;
} }
$this->_current_file = $tpl_file;
$this->_current_line_no = 1;
$ldq = preg_quote($this->left_delimiter, '!');
$rdq = preg_quote($this->right_delimiter, '!');
// run template source through prefilter functions // run template source through prefilter functions
if (count($this->_plugins['prefilter']) > 0) { if (count($this->_plugins['prefilter']) > 0) {
foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) { foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) {
@@ -84,11 +89,6 @@ class Smarty_Compiler extends Smarty {
} }
} }
$this->_current_file = $tpl_file;
$this->_current_line_no = 1;
$ldq = preg_quote($this->left_delimiter, '!');
$rdq = preg_quote($this->right_delimiter, '!');
/* Annihilate the comments. */ /* Annihilate the comments. */
$template_source = preg_replace("!({$ldq})\*(.*?)\*({$rdq})!se", $template_source = preg_replace("!({$ldq})\*(.*?)\*({$rdq})!se",
"'\\1*'.str_repeat(\"\n\", substr_count('\\2', \"\n\")) .'*\\3'", "'\\1*'.str_repeat(\"\n\", substr_count('\\2', \"\n\")) .'*\\3'",