mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 03:44:26 +02:00
- fixed handling of { strip } tag with whitespaces
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
20/07/2010
|
||||||
|
- fixed handling of { strip } tag with whitespaces
|
||||||
|
|
||||||
15/07/2010
|
15/07/2010
|
||||||
- bufix {$smarty.template} does include now the relative path, not just filename
|
- bufix {$smarty.template} does include now the relative path, not just filename
|
||||||
|
|
||||||
|
@@ -143,19 +143,21 @@ class Smarty_Internal_Templatelexer
|
|||||||
10 => 0,
|
10 => 0,
|
||||||
11 => 0,
|
11 => 0,
|
||||||
12 => 0,
|
12 => 0,
|
||||||
13 => 1,
|
13 => 0,
|
||||||
15 => 0,
|
14 => 0,
|
||||||
16 => 0,
|
15 => 1,
|
||||||
17 => 0,
|
17 => 0,
|
||||||
18 => 0,
|
18 => 0,
|
||||||
19 => 0,
|
19 => 0,
|
||||||
20 => 2,
|
20 => 0,
|
||||||
23 => 0,
|
21 => 0,
|
||||||
|
22 => 2,
|
||||||
|
25 => 0,
|
||||||
);
|
);
|
||||||
if ($this->counter >= strlen($this->data)) {
|
if ($this->counter >= strlen($this->data)) {
|
||||||
return false; // end of input
|
return false; // end of input
|
||||||
}
|
}
|
||||||
$yy_global_pattern = "/^(\\{\\})|^(".$this->ldel."\\*([\S\s]*?)\\*".$this->rdel."\r?\n?)|^(<\\?(?:php\\w+|=|[a-zA-Z]+)?)|^(\\?>)|^(<%)|^(%>)|^([\t ]*[\r\n]+[\t ]*)|^(".$this->ldel."strip".$this->rdel.")|^(".$this->ldel."\/strip".$this->rdel.")|^(".$this->ldel."literal".$this->rdel.")|^(".$this->ldel."\\s{1,}\/)|^(".$this->ldel."\\s*(if|elseif|else if|while)(?![^\s]))|^(".$this->ldel."\\s*for(?![^\s]))|^(".$this->ldel."\\s*foreach(?![^\s]))|^(".$this->ldel."\\s{1,})|^(".$this->ldel."\/)|^(".$this->ldel.")|^(([\S\s]*?)(?=([\t ]*[\r\n]+[\t ]*|".$this->ldel."|<\\?|\\?>|<%|%>)))|^([\S\s]+)/";
|
$yy_global_pattern = "/^(\\{\\})|^(".$this->ldel."\\*([\S\s]*?)\\*".$this->rdel."\r?\n?)|^(<\\?(?:php\\w+|=|[a-zA-Z]+)?)|^(\\?>)|^(<%)|^(%>)|^([\t ]*[\r\n]+[\t ]*)|^(".$this->ldel."strip".$this->rdel.")|^(".$this->ldel."\\s{1,}strip\\s{1,}".$this->rdel.")|^(".$this->ldel."\/strip".$this->rdel.")|^(".$this->ldel."\\s{1,}\/strip\\s{1,}".$this->rdel.")|^(".$this->ldel."\\s*literal\\s*".$this->rdel.")|^(".$this->ldel."\\s{1,}\/)|^(".$this->ldel."\\s*(if|elseif|else if|while)(?![^\s]))|^(".$this->ldel."\\s*for(?![^\s]))|^(".$this->ldel."\\s*foreach(?![^\s]))|^(".$this->ldel."\\s{1,})|^(".$this->ldel."\/)|^(".$this->ldel.")|^(([\S\s]*?)(?=([\t ]*[\r\n]+[\t ]*|".$this->ldel."|<\\?|\\?>|<%|%>)))|^([\S\s]+)/";
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
|
if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
|
||||||
@@ -260,16 +262,36 @@ class Smarty_Internal_Templatelexer
|
|||||||
function yy_r1_10($yy_subpatterns)
|
function yy_r1_10($yy_subpatterns)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if ($this->smarty->auto_literal) {
|
||||||
|
$this->token = Smarty_Internal_Templateparser::TP_OTHER;
|
||||||
|
} else {
|
||||||
|
$this->strip = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function yy_r1_11($yy_subpatterns)
|
||||||
|
{
|
||||||
|
|
||||||
$this->strip = false;
|
$this->strip = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
function yy_r1_11($yy_subpatterns)
|
function yy_r1_12($yy_subpatterns)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($this->smarty->auto_literal) {
|
||||||
|
$this->token = Smarty_Internal_Templateparser::TP_OTHER;
|
||||||
|
} else {
|
||||||
|
$this->strip = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function yy_r1_13($yy_subpatterns)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
|
$this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
|
||||||
$this->yypushstate(self::LITERAL);
|
$this->yypushstate(self::LITERAL);
|
||||||
}
|
}
|
||||||
function yy_r1_12($yy_subpatterns)
|
function yy_r1_14($yy_subpatterns)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->smarty->auto_literal) {
|
if ($this->smarty->auto_literal) {
|
||||||
@@ -280,7 +302,7 @@ class Smarty_Internal_Templatelexer
|
|||||||
$this->taglineno = $this->line;
|
$this->taglineno = $this->line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function yy_r1_13($yy_subpatterns)
|
function yy_r1_15($yy_subpatterns)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
|
if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
|
||||||
@@ -291,7 +313,7 @@ class Smarty_Internal_Templatelexer
|
|||||||
$this->taglineno = $this->line;
|
$this->taglineno = $this->line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function yy_r1_15($yy_subpatterns)
|
function yy_r1_17($yy_subpatterns)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
|
if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
|
||||||
@@ -302,7 +324,7 @@ class Smarty_Internal_Templatelexer
|
|||||||
$this->taglineno = $this->line;
|
$this->taglineno = $this->line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function yy_r1_16($yy_subpatterns)
|
function yy_r1_18($yy_subpatterns)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
|
if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
|
||||||
@@ -313,7 +335,7 @@ class Smarty_Internal_Templatelexer
|
|||||||
$this->taglineno = $this->line;
|
$this->taglineno = $this->line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function yy_r1_17($yy_subpatterns)
|
function yy_r1_19($yy_subpatterns)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->smarty->auto_literal) {
|
if ($this->smarty->auto_literal) {
|
||||||
@@ -324,26 +346,26 @@ class Smarty_Internal_Templatelexer
|
|||||||
$this->taglineno = $this->line;
|
$this->taglineno = $this->line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function yy_r1_18($yy_subpatterns)
|
function yy_r1_20($yy_subpatterns)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
|
$this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
|
||||||
$this->yypushstate(self::SMARTY);
|
$this->yypushstate(self::SMARTY);
|
||||||
$this->taglineno = $this->line;
|
$this->taglineno = $this->line;
|
||||||
}
|
}
|
||||||
function yy_r1_19($yy_subpatterns)
|
function yy_r1_21($yy_subpatterns)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
||||||
$this->yypushstate(self::SMARTY);
|
$this->yypushstate(self::SMARTY);
|
||||||
$this->taglineno = $this->line;
|
$this->taglineno = $this->line;
|
||||||
}
|
}
|
||||||
function yy_r1_20($yy_subpatterns)
|
function yy_r1_22($yy_subpatterns)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->token = Smarty_Internal_Templateparser::TP_OTHER;
|
$this->token = Smarty_Internal_Templateparser::TP_OTHER;
|
||||||
}
|
}
|
||||||
function yy_r1_23($yy_subpatterns)
|
function yy_r1_25($yy_subpatterns)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->token = Smarty_Internal_Templateparser::TP_OTHER;
|
$this->token = Smarty_Internal_Templateparser::TP_OTHER;
|
||||||
@@ -870,7 +892,7 @@ class Smarty_Internal_Templatelexer
|
|||||||
if ($this->counter >= strlen($this->data)) {
|
if ($this->counter >= strlen($this->data)) {
|
||||||
return false; // end of input
|
return false; // end of input
|
||||||
}
|
}
|
||||||
$yy_global_pattern = "/^(".$this->ldel."literal".$this->rdel.")|^(".$this->ldel."\/literal".$this->rdel.")|^([\t ]*[\r\n]+[\t ]*)|^(<\\?(?:php\\w+|=|[a-zA-Z]+)?)|^(\\?>)|^(<%)|^(%>)|^(([\S\s]*?)(?=([\t ]*[\r\n]+[\t ]*|".$this->ldel."\/?literal".$this->rdel."|<\\?|<%)))|^([\S\s]+)/";
|
$yy_global_pattern = "/^(".$this->ldel."\\s*literal\\s*".$this->rdel.")|^(".$this->ldel."\\s*\/literal\\s*".$this->rdel.")|^([\t ]*[\r\n]+[\t ]*)|^(<\\?(?:php\\w+|=|[a-zA-Z]+)?)|^(\\?>)|^(<%)|^(%>)|^(([\S\s]*?)(?=([\t ]*[\r\n]+[\t ]*|".$this->ldel."\/?literal".$this->rdel."|<\\?|<%)))|^([\S\s]+)/";
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
|
if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
|
||||||
|
Reference in New Issue
Block a user