mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 19:34:27 +02:00
15/09/2010
- bugfix resolving conflict between '<%'/'%>' as custom Smarty delimiter and ASP tags - use ucfirst for resource name on internal resource class names
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
15/09/2010
|
||||||
|
- bugfix resolving conflict between '<%'/'%>' as custom Smarty delimiter and ASP tags
|
||||||
|
- use ucfirst for resource name on internal resource class names
|
||||||
|
|
||||||
12/09/2010
|
12/09/2010
|
||||||
- bugfix for change of 08/09/2010 (final {block} tags in subtemplates did not produce correct results)
|
- bugfix for change of 08/09/2010 (final {block} tags in subtemplates did not produce correct results)
|
||||||
|
|
||||||
|
@@ -713,11 +713,11 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
|
|||||||
} else {
|
} else {
|
||||||
// try sysplugins dir
|
// try sysplugins dir
|
||||||
if (in_array($resource_type, array('file', 'string', 'extends', 'php', 'registered', 'stream'))) {
|
if (in_array($resource_type, array('file', 'string', 'extends', 'php', 'registered', 'stream'))) {
|
||||||
$_resource_class = 'Smarty_Internal_Resource_' . $resource_type;
|
$_resource_class = 'Smarty_Internal_Resource_' . ucfirst($resource_type);
|
||||||
return new $_resource_class($this->smarty);
|
return new $_resource_class($this->smarty);
|
||||||
} else {
|
} else {
|
||||||
// try plugins dir
|
// try plugins dir
|
||||||
$_resource_class = 'Smarty_Resource_' . $resource_type;
|
$_resource_class = 'Smarty_Resource_' . ucfirst($resource_type);
|
||||||
if ($this->smarty->loadPlugin($_resource_class)) {
|
if ($this->smarty->loadPlugin($_resource_class)) {
|
||||||
if (class_exists($_resource_class, false)) {
|
if (class_exists($_resource_class, false)) {
|
||||||
return new $_resource_class($this->smarty);
|
return new $_resource_class($this->smarty);
|
||||||
|
@@ -1,16 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Smarty Internal Plugin Templatelexer
|
* Smarty Internal Plugin Templatelexer
|
||||||
*
|
*
|
||||||
* This is the lexer to break the template source into tokens
|
* This is the lexer to break the template source into tokens
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @subpackage Compiler
|
* @subpackage Compiler
|
||||||
* @author Uwe Tews
|
* @author Uwe Tews
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty Internal Plugin Templatelexer
|
* Smarty Internal Plugin Templatelexer
|
||||||
*/
|
*/
|
||||||
class Smarty_Internal_Templatelexer
|
class Smarty_Internal_Templatelexer
|
||||||
{
|
{
|
||||||
public $data;
|
public $data;
|
||||||
@@ -142,11 +141,11 @@ class Smarty_Internal_Templatelexer
|
|||||||
8 => 0,
|
8 => 0,
|
||||||
9 => 0,
|
9 => 0,
|
||||||
10 => 0,
|
10 => 0,
|
||||||
11 => 0,
|
11 => 1,
|
||||||
12 => 0,
|
|
||||||
13 => 0,
|
13 => 0,
|
||||||
14 => 0,
|
14 => 0,
|
||||||
15 => 1,
|
15 => 0,
|
||||||
|
16 => 0,
|
||||||
17 => 0,
|
17 => 0,
|
||||||
18 => 0,
|
18 => 0,
|
||||||
19 => 0,
|
19 => 0,
|
||||||
@@ -158,7 +157,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."\\*([\S\s]*?)\\*".$this->rdel.")|^(<\\?(?: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]+)/";
|
$yy_global_pattern = "/^(\\{\\})|^(".$this->ldel."\\*([\S\s]*?)\\*".$this->rdel.")|^([\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.")|^(<\\?(?:php\\w+|=|[a-zA-Z]+)?)|^(\\?>)|^(<%)|^(%>)|^(([\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)) {
|
||||||
@@ -221,78 +220,51 @@ class Smarty_Internal_Templatelexer
|
|||||||
function yy_r1_4($yy_subpatterns)
|
function yy_r1_4($yy_subpatterns)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (in_array($this->value, Array('<?', '<?=', '<?php'))) {
|
|
||||||
$this->token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG;
|
|
||||||
} elseif ($this->value == '<?xml') {
|
|
||||||
$this->token = Smarty_Internal_Templateparser::TP_XMLTAG;
|
|
||||||
} else {
|
|
||||||
$this->token = Smarty_Internal_Templateparser::TP_FAKEPHPSTARTTAG;
|
|
||||||
$this->value = substr($this->value, 0, 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function yy_r1_5($yy_subpatterns)
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG;
|
|
||||||
}
|
|
||||||
function yy_r1_6($yy_subpatterns)
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->token = Smarty_Internal_Templateparser::TP_ASPSTARTTAG;
|
|
||||||
}
|
|
||||||
function yy_r1_7($yy_subpatterns)
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->token = Smarty_Internal_Templateparser::TP_ASPENDTAG;
|
|
||||||
}
|
|
||||||
function yy_r1_8($yy_subpatterns)
|
|
||||||
{
|
|
||||||
|
|
||||||
if ($this->strip) {
|
if ($this->strip) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
$this->token = Smarty_Internal_Templateparser::TP_LINEBREAK;
|
$this->token = Smarty_Internal_Templateparser::TP_LINEBREAK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function yy_r1_5($yy_subpatterns)
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->strip = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function yy_r1_6($yy_subpatterns)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($this->smarty->auto_literal) {
|
||||||
|
$this->token = Smarty_Internal_Templateparser::TP_OTHER;
|
||||||
|
} else {
|
||||||
|
$this->strip = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function yy_r1_7($yy_subpatterns)
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->strip = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function yy_r1_8($yy_subpatterns)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($this->smarty->auto_literal) {
|
||||||
|
$this->token = Smarty_Internal_Templateparser::TP_OTHER;
|
||||||
|
} else {
|
||||||
|
$this->strip = false;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function yy_r1_9($yy_subpatterns)
|
function yy_r1_9($yy_subpatterns)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->strip = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
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_14($yy_subpatterns)
|
function yy_r1_10($yy_subpatterns)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->smarty->auto_literal) {
|
if ($this->smarty->auto_literal) {
|
||||||
@@ -303,7 +275,7 @@ class Smarty_Internal_Templatelexer
|
|||||||
$this->taglineno = $this->line;
|
$this->taglineno = $this->line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function yy_r1_15($yy_subpatterns)
|
function yy_r1_11($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)) == '') {
|
||||||
@@ -314,7 +286,7 @@ class Smarty_Internal_Templatelexer
|
|||||||
$this->taglineno = $this->line;
|
$this->taglineno = $this->line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function yy_r1_17($yy_subpatterns)
|
function yy_r1_13($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)) == '') {
|
||||||
@@ -325,7 +297,7 @@ class Smarty_Internal_Templatelexer
|
|||||||
$this->taglineno = $this->line;
|
$this->taglineno = $this->line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function yy_r1_18($yy_subpatterns)
|
function yy_r1_14($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)) == '') {
|
||||||
@@ -336,7 +308,7 @@ class Smarty_Internal_Templatelexer
|
|||||||
$this->taglineno = $this->line;
|
$this->taglineno = $this->line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function yy_r1_19($yy_subpatterns)
|
function yy_r1_15($yy_subpatterns)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->smarty->auto_literal) {
|
if ($this->smarty->auto_literal) {
|
||||||
@@ -347,20 +319,47 @@ class Smarty_Internal_Templatelexer
|
|||||||
$this->taglineno = $this->line;
|
$this->taglineno = $this->line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function yy_r1_20($yy_subpatterns)
|
function yy_r1_16($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_21($yy_subpatterns)
|
function yy_r1_17($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_18($yy_subpatterns)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (in_array($this->value, Array('<?', '<?=', '<?php'))) {
|
||||||
|
$this->token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG;
|
||||||
|
} elseif ($this->value == '<?xml') {
|
||||||
|
$this->token = Smarty_Internal_Templateparser::TP_XMLTAG;
|
||||||
|
} else {
|
||||||
|
$this->token = Smarty_Internal_Templateparser::TP_FAKEPHPSTARTTAG;
|
||||||
|
$this->value = substr($this->value, 0, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function yy_r1_19($yy_subpatterns)
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG;
|
||||||
|
}
|
||||||
|
function yy_r1_20($yy_subpatterns)
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->token = Smarty_Internal_Templateparser::TP_ASPSTARTTAG;
|
||||||
|
}
|
||||||
|
function yy_r1_21($yy_subpatterns)
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->token = Smarty_Internal_Templateparser::TP_ASPENDTAG;
|
||||||
|
}
|
||||||
function yy_r1_22($yy_subpatterns)
|
function yy_r1_22($yy_subpatterns)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -973,7 +972,7 @@ class Smarty_Internal_Templatelexer
|
|||||||
function yy_r3_5($yy_subpatterns)
|
function yy_r3_5($yy_subpatterns)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
|
$this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG;
|
||||||
}
|
}
|
||||||
function yy_r3_6($yy_subpatterns)
|
function yy_r3_6($yy_subpatterns)
|
||||||
{
|
{
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user