mirror of
https://github.com/smarty-php/smarty.git
synced 2026-08-06 13:34:11 +02:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2cdba79a74 | |||
| 7b469c1f4a | |||
| 52ced72361 | |||
| 58616d6ee5 | |||
| ec383370cb | |||
| 3bb22560c0 | |||
| 83f3f6d7f1 | |||
| ecddc1f720 | |||
| e96ee1b5d6 | |||
| 768b7d1ec5 | |||
| f1e1f56ffe | |||
| d804454f21 | |||
| 2a1badfebb | |||
| fa269d418f | |||
| 3771ea8d35 | |||
| 63b1d343b8 | |||
| 0434f34bdd | |||
| c9cd39f36f | |||
| 0356b70578 | |||
| aa1e554993 | |||
| 531b298886 |
@@ -3,7 +3,7 @@
|
||||
|
||||
*Read the NEW_FEATURES file for recent extensions to Smarty 3.1 functionality*
|
||||
|
||||
Smarty packages are now on github and can be installed with Composer.
|
||||
Smarty versions 3.1.11 or later are now on github and can be installed with Composer.
|
||||
|
||||
|
||||
The "smarty/smarty" package will start at libs/.... subfolder.
|
||||
@@ -22,20 +22,19 @@ in your composer.json file.
|
||||
"smarty/smarty": "~3.1@dev"
|
||||
}
|
||||
|
||||
All stable releases since 3.1.11 are available
|
||||
For a specific version use something like
|
||||
|
||||
"require": {
|
||||
"smarty/smarty": "3.1.19"
|
||||
}
|
||||
|
||||
PHPUnit test can be installed by corresponding comper entries like
|
||||
PHPUnit test can be installed by corresponding composer entries like
|
||||
|
||||
"require": {
|
||||
"smarty/smarty-phpunit": "3.1.19"
|
||||
}
|
||||
|
||||
Similar applies for the lxer/parser generator
|
||||
Similar applies for the lexer/parser generator
|
||||
|
||||
"require": {
|
||||
"smarty/smarty-lexer": "3.1.19"
|
||||
|
||||
+38
-1
@@ -1,4 +1,41 @@
|
||||
===== 3.1.24===== (23.05.2015)
|
||||
===== 3.1.26===== (18.06.2015)
|
||||
18.06.2015
|
||||
- bugfix file path normalization failed on path containing something like "/.foo/" https://github.com/smarty-php/smarty/issues/56
|
||||
|
||||
17.06.2015
|
||||
- bugfix calling a plugin with nocache option but no other attributes like {foo nocache} caused call to undefined function https://github.com/smarty-php/smarty/issues/55
|
||||
|
||||
===== 3.1.25===== (15.06.2015)
|
||||
15.06.2015
|
||||
- optimization of smarty_cachereource_keyvaluestore.php code
|
||||
|
||||
14.06.2015
|
||||
- bugfix a relative sub template path could fail if template_dir path did contain /../ https://github.com/smarty-php/smarty/issues/50
|
||||
- optimization rework of path normalization
|
||||
- bugfix an output tag with variable, modifier followed by an operator like {$foo|modifier+1} did fail https://github.com/smarty-php/smarty/issues/53
|
||||
|
||||
13.06.2015
|
||||
- bugfix a custom cache resource using smarty_cachereource_keyvaluestore.php did fail if php.ini mbstring.func_overload = 2 (forum topic 25568)
|
||||
|
||||
11.06.2015
|
||||
- bugfix the lexer could hang on very large quoted strings (forum topic 25570)
|
||||
|
||||
08.06.2015
|
||||
- bugfix using {$foo} as array index like $bar.{$foo} or in double quoted string like "some {$foo} thing" failed https://github.com/smarty-php/smarty/issues/49
|
||||
|
||||
04.06.2015
|
||||
- bugfix possible error message on unset() while compiling {block} tags https://github.com/smarty-php/smarty/issues/46
|
||||
|
||||
01.06.2015
|
||||
- bugfix <?xml ... ?> including template variables broken since 3.1.22 https://github.com/smarty-php/smarty/issues/47
|
||||
|
||||
27.05.2015
|
||||
- bugfix {include} with variable file name must not create by default individual cache file (since 3.1.22) https://github.com/smarty-php/smarty/issues/43
|
||||
|
||||
24.05.2015
|
||||
- bugfix if condition string 'neq' broken due to a typo https://github.com/smarty-php/smarty/issues/42
|
||||
|
||||
===== 3.1.24===== (23.05.2015)
|
||||
23.05.2015
|
||||
- improvement on php_handling to allow very large PHP sections, better error handling
|
||||
- improvement allow extreme large comment sections (forum 25538)
|
||||
|
||||
@@ -128,9 +128,15 @@ class Smarty_Internal_Templatelexer
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
||||
public $yyTracePrompt;
|
||||
|
||||
/**
|
||||
* XML flag true while processing xml
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $is_xml = false;
|
||||
|
||||
/**
|
||||
* state names
|
||||
*
|
||||
@@ -293,7 +299,7 @@ class Smarty_Internal_Templatelexer
|
||||
literal = ~literal~
|
||||
strip = ~strip~
|
||||
lop = ~\s*(([!=][=]{1,2})|([<][=>]?)|([>][=]?)|[&|]{2})\s*~
|
||||
tlop = ~\s+(eq|ne|neg|gt|ge|gte|lt|le|lte|mod|and|or|xor|(is\s+(not\s+)?(odd|even|div)\s+by))\s+~
|
||||
tlop = ~\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor|(is\s+(not\s+)?(odd|even|div)\s+by))\s+~
|
||||
scond = ~\s+is\s+(not\s+)?(odd|even)~
|
||||
isin = ~\s+is\s+in\s+~
|
||||
as = ~\s+as\s+~
|
||||
@@ -328,7 +334,6 @@ class Smarty_Internal_Templatelexer
|
||||
phpstart {
|
||||
$obj = new Smarty_Internal_Compile_Private_Php();
|
||||
$obj->parsePhp($this);
|
||||
$this->token = Smarty_Internal_Templateparser::TP_PHP;
|
||||
}
|
||||
ldel literal rdel {
|
||||
if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
|
||||
@@ -392,9 +397,16 @@ class Smarty_Internal_Templatelexer
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
ldel dollar id nocacherdel {
|
||||
$this->yypopstate();
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SIMPELOUTPUT;
|
||||
$this->taglineno = $this->line;
|
||||
if ($this->_yy_stack[count($this->_yy_stack)-1] == self::TEXT) {
|
||||
$this->yypopstate();
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SIMPLEOUTPUT;
|
||||
$this->taglineno = $this->line;
|
||||
} else {
|
||||
$this->value = $this->smarty->left_delimiter;
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
}
|
||||
ldel slash {
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
|
||||
|
||||
@@ -252,6 +252,13 @@ template_element(res)::= PHP(o). {
|
||||
}
|
||||
}
|
||||
|
||||
// nocache code
|
||||
template_element(res)::= NOCACHE(c). {
|
||||
$this->compiler->tag_nocache = true;
|
||||
$save = $this->template->has_nocache_code;
|
||||
res = new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode("<?php echo '{c}';?>\n", $this->compiler, true));
|
||||
$this->template->has_nocache_code = $save;
|
||||
}
|
||||
// template text
|
||||
template_element(res)::= text_content(t). {
|
||||
res = $this->compiler->processText(t);
|
||||
@@ -313,7 +320,7 @@ smartytag(res) ::= tag(t) RDEL. {
|
||||
//
|
||||
// output tags start here
|
||||
//
|
||||
smartytag(res) ::= SIMPELOUTPUT(i). {
|
||||
smartytag(res) ::= SIMPLEOUTPUT(i). {
|
||||
$var = trim(substr(i, $this->lex->ldel_length, -$this->lex->rdel_length), ' $');
|
||||
if (preg_match('/^(.*)(\s+nocache)$/', $var, $match)) {
|
||||
res = $this->compiler->compileTag('private_print_expression',array('nocache'),array('value'=>$this->compiler->compileVariable('\''.$match[1].'\'')));
|
||||
@@ -327,26 +334,18 @@ tag(res) ::= LDEL variable(e). {
|
||||
res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>e));
|
||||
}
|
||||
|
||||
tag(res) ::= LDEL variable(e) modifierlist(l) attributes(a). {
|
||||
res = $this->compiler->compileTag('private_print_expression',a,array('value'=>e, 'modifierlist'=>l));
|
||||
}
|
||||
|
||||
tag(res) ::= LDEL variable(e) attributes(a). {
|
||||
res = $this->compiler->compileTag('private_print_expression',a,array('value'=>e));
|
||||
}
|
||||
tag(res) ::= LDEL value(e). {
|
||||
res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>e));
|
||||
}
|
||||
tag(res) ::= LDEL value(e) modifierlist(l) attributes(a). {
|
||||
res = $this->compiler->compileTag('private_print_expression',a,array('value'=>e, 'modifierlist'=>l));
|
||||
}
|
||||
|
||||
tag(res) ::= LDEL value(e) attributes(a). {
|
||||
res = $this->compiler->compileTag('private_print_expression',a,array('value'=>e));
|
||||
}
|
||||
|
||||
tag(res) ::= LDEL expr(e) modifierlist(l) attributes(a). {
|
||||
res = $this->compiler->compileTag('private_print_expression',a,array('value'=>e,'modifierlist'=>l));
|
||||
tag(res) ::= LDEL expr(e). {
|
||||
res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>e));
|
||||
}
|
||||
|
||||
tag(res) ::= LDEL expr(e) attributes(a). {
|
||||
@@ -388,7 +387,7 @@ smartytag(res)::= SIMPLETAG(t). {
|
||||
res = $this->compiler->compileTag('private_print_expression',array(),array('value'=>$tag));
|
||||
} else {
|
||||
if (preg_match('/^(.*)(\s+nocache)$/', $tag, $match)) {
|
||||
res = $this->compiler->compileTag($match[1],array('nocache'));
|
||||
res = $this->compiler->compileTag($match[1],array("'nocache'"));
|
||||
} else {
|
||||
res = $this->compiler->compileTag($tag,array());
|
||||
}
|
||||
@@ -941,7 +940,6 @@ indexdef(res) ::= DOT INTEGER(n). {
|
||||
res = '['. n .']';
|
||||
}
|
||||
|
||||
|
||||
indexdef(res) ::= DOT LDEL expr(e) RDEL. {
|
||||
res = '['. e .']';
|
||||
}
|
||||
@@ -1003,10 +1001,6 @@ varvar(res) ::= varvar(v1) varvarele(v2). {
|
||||
varvarele(res) ::= ID(s). {
|
||||
res = '\''.s.'\'';
|
||||
}
|
||||
varvarele(res) ::= SIMPELOUTPUT(i). {
|
||||
$var = trim(substr(i, $this->lex->ldel_length, -$this->lex->rdel_length), ' $');
|
||||
res = $this->compiler->compileVariable('\''.$var.'\'');
|
||||
}
|
||||
|
||||
// variable sections of element
|
||||
varvarele(res) ::= LDEL expr(e) RDEL. {
|
||||
@@ -1237,7 +1231,7 @@ lop(res) ::= TLOGOP(o). {
|
||||
'isoddby' => array('op' => ' / ', 'pre' => '(1 & '),
|
||||
'isnotoddby' => array('op' => ' / ', 'pre' => '!(1 & '),
|
||||
);
|
||||
$op = strtolower(str_replace(' ', '', o));
|
||||
$op = strtolower(preg_replace('/\s*/', '', o));
|
||||
res = $lops[$op];
|
||||
}
|
||||
|
||||
|
||||
+26
-39
@@ -27,7 +27,7 @@
|
||||
* @author Uwe Tews
|
||||
* @author Rodney Rehm
|
||||
* @package Smarty
|
||||
* @version 3.1-DEV
|
||||
* @version 3.1.26
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -73,7 +73,7 @@ if (!defined('SMARTY_RESOURCE_DATE_FORMAT')) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Try loading the Smmarty_Internal_Data class
|
||||
* Try loading the Smarty_Internal_Data class
|
||||
* If we fail we must load Smarty's autoloader.
|
||||
* Otherwise we may have a global autoloader like Composer
|
||||
*/
|
||||
@@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
/**
|
||||
* smarty version
|
||||
*/
|
||||
const SMARTY_VERSION = '3.1.24';
|
||||
const SMARTY_VERSION = '3.1.26';
|
||||
|
||||
/**
|
||||
* define variable scopes
|
||||
@@ -206,8 +206,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
/**
|
||||
* contains directories outside of SMARTY_DIR that are to be muted by muteExpectedErrors()
|
||||
*/
|
||||
public static $_muted_directories = array('./templates_c/' => null,
|
||||
'./cache/' => null);
|
||||
public static $_muted_directories = array('./templates_c/' => null, './cache/' => null);
|
||||
|
||||
/**
|
||||
* Flag denoting if Multibyte String functions are available
|
||||
@@ -617,10 +616,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $plugin_search_order = array('function',
|
||||
'block',
|
||||
'compiler',
|
||||
'class');
|
||||
public $plugin_search_order = array('function', 'block', 'compiler', 'class');
|
||||
|
||||
/**
|
||||
* registered objects
|
||||
@@ -973,7 +969,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
{
|
||||
$this->template_dir = array();
|
||||
foreach ((array) $template_dir as $k => $v) {
|
||||
$this->template_dir[$k] = rtrim(strtr($v, '\\', '/'), '/') . '/';
|
||||
$this->template_dir[$k] = rtrim($v, '/\\') . DS;
|
||||
}
|
||||
$this->joined_template_dir = join(' # ', $this->template_dir);
|
||||
return $this;
|
||||
@@ -1021,7 +1017,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
{
|
||||
$this->config_dir = array();
|
||||
foreach ((array) $config_dir as $k => $v) {
|
||||
$this->config_dir[$k] = rtrim(strtr($v, '\\', '/'), '/') . '/';
|
||||
$this->config_dir[$k] = rtrim($v, '/\\') . DS;
|
||||
}
|
||||
$this->joined_config_dir = join(' # ', $this->config_dir);
|
||||
return $this;
|
||||
@@ -1067,10 +1063,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
public function setPluginsDir($plugins_dir)
|
||||
{
|
||||
$this->plugins_dir = array();
|
||||
foreach ((array) $plugins_dir as $k => $v) {
|
||||
$this->plugins_dir[$k] = rtrim(strtr($v, '\\', '/'), '/') . '/';
|
||||
}
|
||||
$this->_is_file_cache = array();
|
||||
$this->addPluginsDir($plugins_dir);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -1083,7 +1076,11 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
*/
|
||||
public function addPluginsDir($plugins_dir)
|
||||
{
|
||||
$this->_addDir('plugins_dir', $plugins_dir);
|
||||
// make sure we're dealing with an array
|
||||
$this->plugins_dir = (array) $this->plugins_dir;
|
||||
foreach ((array) $plugins_dir as $v) {
|
||||
$this->plugins_dir[] = rtrim($v, '/\\') . DS;
|
||||
}
|
||||
$this->plugins_dir = array_unique($this->plugins_dir);
|
||||
$this->_is_file_cache = array();
|
||||
return $this;
|
||||
@@ -1108,7 +1105,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
*/
|
||||
public function setCompileDir($compile_dir)
|
||||
{
|
||||
$this->compile_dir = rtrim(strtr($compile_dir, '\\', '/'), '/') . '/';
|
||||
$this->compile_dir = rtrim($compile_dir, '/\\') . DS;
|
||||
if (!isset(Smarty::$_muted_directories[$this->compile_dir])) {
|
||||
Smarty::$_muted_directories[$this->compile_dir] = null;
|
||||
}
|
||||
@@ -1135,11 +1132,10 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
*/
|
||||
public function setCacheDir($cache_dir)
|
||||
{
|
||||
$this->cache_dir = rtrim(strtr($cache_dir, '\\', '/'), '/') . '/';
|
||||
$this->cache_dir = rtrim($cache_dir, '/\\') . DS;
|
||||
if (!isset(Smarty::$_muted_directories[$this->cache_dir])) {
|
||||
Smarty::$_muted_directories[$this->cache_dir] = null;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -1167,23 +1163,21 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
|
||||
if (is_array($dir)) {
|
||||
foreach ($dir as $k => $v) {
|
||||
$v = rtrim(strtr($v, '\\', '/'), '/') . '/';
|
||||
if (is_int($k)) {
|
||||
// indexes are not merged but appended
|
||||
$this->{$dirName}[] = $v;
|
||||
$this->{$dirName}[] = rtrim($v, '/\\') . DS;
|
||||
} else {
|
||||
// string indexes are overridden
|
||||
$this->{$dirName}[$k] = $v;
|
||||
$this->{$dirName}[$k] = rtrim($v, '/\\') . DS;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$v = rtrim(strtr($dir, '\\', '/'), '/') . '/';
|
||||
if ($key !== null) {
|
||||
// override directory at specified index
|
||||
$this->{$dirName}[$key] = $v;
|
||||
$this->{$dirName}[$key] = rtrim($dir, '/\\') . DS;
|
||||
} else {
|
||||
// append new directory
|
||||
$this->{$dirName}[] = $v;
|
||||
$this->{$dirName}[] = rtrim($dir, '/\\') . DS;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1420,8 +1414,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
|
||||
// loop through plugin dirs and find the plugin
|
||||
foreach ($this->getPluginsDir() as $_plugin_dir) {
|
||||
$names = array($_plugin_dir . $_plugin_filename,
|
||||
$_plugin_dir . strtolower($_plugin_filename),);
|
||||
$names = array($_plugin_dir . $_plugin_filename, $_plugin_dir . strtolower($_plugin_filename),);
|
||||
foreach ($names as $file) {
|
||||
if (isset($this->_is_file_cache[$file]) ? $this->_is_file_cache[$file] : $this->_is_file_cache[$file] = is_file($file)) {
|
||||
require_once($file);
|
||||
@@ -1678,10 +1671,8 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
$allowed = array('template_dir' => 'getTemplateDir',
|
||||
'config_dir' => 'getConfigDir',
|
||||
'plugins_dir' => 'getPluginsDir',
|
||||
'compile_dir' => 'getCompileDir',
|
||||
$allowed = array('template_dir' => 'getTemplateDir', 'config_dir' => 'getConfigDir',
|
||||
'plugins_dir' => 'getPluginsDir', 'compile_dir' => 'getCompileDir',
|
||||
'cache_dir' => 'getCacheDir',);
|
||||
|
||||
if (isset($allowed[$name])) {
|
||||
@@ -1701,10 +1692,8 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
*/
|
||||
public function __set($name, $value)
|
||||
{
|
||||
$allowed = array('template_dir' => 'setTemplateDir',
|
||||
'config_dir' => 'setConfigDir',
|
||||
'plugins_dir' => 'setPluginsDir',
|
||||
'compile_dir' => 'setCompileDir',
|
||||
$allowed = array('template_dir' => 'setTemplateDir', 'config_dir' => 'setConfigDir',
|
||||
'plugins_dir' => 'setPluginsDir', 'compile_dir' => 'setCompileDir',
|
||||
'cache_dir' => 'setCacheDir',);
|
||||
|
||||
if (isset($allowed[$name])) {
|
||||
@@ -1750,8 +1739,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
unset(Smarty::$_muted_directories[$key]);
|
||||
continue;
|
||||
}
|
||||
$dir = array('file' => $file,
|
||||
'length' => strlen($file),);
|
||||
$dir = array('file' => $file, 'length' => strlen($file),);
|
||||
}
|
||||
if (!strncmp($errfile, $dir['file'], $dir['length'])) {
|
||||
$_is_muted_directory = true;
|
||||
@@ -1793,8 +1781,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
- between file_exists() and filemtime() a possible race condition is opened,
|
||||
which does not exist using the simple @filemtime() approach.
|
||||
*/
|
||||
$error_handler = array('Smarty',
|
||||
'mutingErrorHandler');
|
||||
$error_handler = array('Smarty', 'mutingErrorHandler');
|
||||
$previous = set_error_handler($error_handler);
|
||||
|
||||
// avoid dead loops
|
||||
|
||||
@@ -36,6 +36,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
||||
* @var array
|
||||
*/
|
||||
protected $contents = array();
|
||||
|
||||
/**
|
||||
* cache for timestamps
|
||||
*
|
||||
@@ -53,10 +54,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
||||
*/
|
||||
public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)
|
||||
{
|
||||
$cached->filepath = $_template->source->uid
|
||||
. '#' . $this->sanitize($cached->source->resource)
|
||||
. '#' . $this->sanitize($cached->cache_id)
|
||||
. '#' . $this->sanitize($cached->compile_id);
|
||||
$cached->filepath = $_template->source->uid . '#' . $this->sanitize($cached->source->resource) . '#' . $this->sanitize($cached->cache_id) . '#' . $this->sanitize($cached->compile_id);
|
||||
|
||||
$this->populateTimestamp($cached);
|
||||
}
|
||||
@@ -136,7 +134,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
||||
public function readCachedContent(Smarty_Internal_Template $_template)
|
||||
{
|
||||
$content = $_template->cached->content ? $_template->cached->content : null;
|
||||
$timestamp = null;
|
||||
$timestamp = null;
|
||||
if ($content === null) {
|
||||
if (!$this->fetch($_template->cached->filepath, $_template->source->name, $_template->cache_id, $_template->compile_id, $content, $timestamp, $_template->source->uid)) {
|
||||
return false;
|
||||
@@ -148,7 +146,6 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Empty cache
|
||||
* {@internal the $exp_time argument is ignored altogether }}
|
||||
@@ -298,11 +295,8 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
||||
*/
|
||||
protected function getMetaTimestamp(&$content)
|
||||
{
|
||||
$s = unpack("N", substr($content, 0, 4));
|
||||
$m = unpack("N", substr($content, 4, 4));
|
||||
$content = substr($content, 8);
|
||||
|
||||
return $s[1] + ($m[1] / 100000000);
|
||||
extract(unpack('N1s/N1m/a*content', $content));
|
||||
return $s + ($m / 100000000);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -334,7 +334,9 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase
|
||||
$_output = $compiler->parser->current_buffer->to_smarty_php();
|
||||
}
|
||||
}
|
||||
unset($compiler->template->block_data[$_name]['compiled']);
|
||||
if (isset($compiler->template->block_data[$_name]['compiled'])) {
|
||||
unset($compiler->template->block_data[$_name]['compiled']);
|
||||
}
|
||||
// reset flags
|
||||
$compiler->parser->current_buffer = $saved_data[2];
|
||||
if ($compiler->nocache) {
|
||||
|
||||
@@ -101,31 +101,29 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
|
||||
// flag if included template code should be merged into caller
|
||||
$merge_compiled_includes = ($compiler->smarty->merge_compiled_includes || ($compiler->inheritance && $compiler->smarty->inheritance_merge_compiled_includes) || $_attr['inline'] === true) && !$compiler->template->source->recompiled;
|
||||
|
||||
// variable template name ?
|
||||
if ($compiler->has_variable_string || !((substr_count($include_file, '"') == 2 || substr_count($include_file, "'") == 2))
|
||||
|| substr_count($include_file, '(') != 0 || substr_count($include_file, '$_smarty_tpl->') != 0
|
||||
) {
|
||||
$merge_compiled_includes = false;
|
||||
if ($compiler->template->caching) {
|
||||
// must use individual cache file
|
||||
$_attr['caching'] = 1;
|
||||
}
|
||||
if ($compiler->inheritance && $compiler->smarty->inheritance_merge_compiled_includes && $_attr['inline'] !== true) {
|
||||
$compiler->trigger_template_error(' variable template file names not allow within {block} tags');
|
||||
}
|
||||
}
|
||||
// variable compile_id?
|
||||
if (isset($_attr['compile_id'])) {
|
||||
if (!((substr_count($_attr['compile_id'], '"') == 2 || substr_count($_attr['compile_id'], "'") == 2 || is_numeric($_attr['compile_id'])))
|
||||
|| substr_count($_attr['compile_id'], '(') != 0 || substr_count($_attr['compile_id'], '$_smarty_tpl->') != 0
|
||||
) {
|
||||
if ($merge_compiled_includes && $_attr['inline'] !== true) {
|
||||
// variable template name ?
|
||||
if ($compiler->has_variable_string || !((substr_count($include_file, '"') == 2 || substr_count($include_file, "'") == 2)) || substr_count($include_file, '(') != 0 || substr_count($include_file, '$_smarty_tpl->') != 0) {
|
||||
$merge_compiled_includes = false;
|
||||
if ($compiler->template->caching) {
|
||||
// must use individual cache file
|
||||
$_attr['caching'] = 1;
|
||||
//$_attr['caching'] = 1;
|
||||
}
|
||||
if ($compiler->inheritance && $compiler->smarty->inheritance_merge_compiled_includes && $_attr['inline'] !== true) {
|
||||
$compiler->trigger_template_error(' variable compile_id not allow within {block} tags');
|
||||
$compiler->trigger_template_error(' variable template file names not allow within {block} tags');
|
||||
}
|
||||
}
|
||||
// variable compile_id?
|
||||
if (isset($_attr['compile_id'])) {
|
||||
if (!((substr_count($_attr['compile_id'], '"') == 2 || substr_count($_attr['compile_id'], "'") == 2 || is_numeric($_attr['compile_id']))) || substr_count($_attr['compile_id'], '(') != 0 || substr_count($_attr['compile_id'], '$_smarty_tpl->') != 0) {
|
||||
$merge_compiled_includes = false;
|
||||
if ($compiler->template->caching) {
|
||||
// must use individual cache file
|
||||
//$_attr['caching'] = 1;
|
||||
}
|
||||
if ($compiler->inheritance && $compiler->smarty->inheritance_merge_compiled_includes && $_attr['inline'] !== true) {
|
||||
$compiler->trigger_template_error(' variable compile_id not allow within {block} tags');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,13 +43,13 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
|
||||
if ($_attr['type'] == 'xml') {
|
||||
$compiler->tag_nocache = true;
|
||||
$save = $compiler->template->has_nocache_code;
|
||||
$compiler->template->has_nocache_code = $save;
|
||||
$output = addcslashes($_attr['code'], "'\\");
|
||||
$compiler->parser->current_buffer->append_subtree(new Smarty_Internal_ParseTree_Tag($compiler->parser, $compiler->processNocacheCode("<?php echo '" . $output . "';?>", $compiler, true)));
|
||||
$compiler->template->has_nocache_code = $save;
|
||||
return '';
|
||||
}
|
||||
if ($_attr['type'] != 'tag') {
|
||||
if ($compiler->php_handling == Smarty::PHP_REMOVE) {
|
||||
if ($compiler->php_handling == Smarty::PHP_REMOVE) {
|
||||
return '';
|
||||
} elseif ($compiler->php_handling == Smarty::PHP_QUOTE) {
|
||||
$output = preg_replace_callback('#(<\?(?:php|=)?)|(<%)|(<script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*>)|(\?>)|(%>)|(<\/script>)#i', array($this,
|
||||
@@ -59,9 +59,9 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
|
||||
} elseif ($compiler->php_handling == Smarty::PHP_PASSTHRU || $_attr['type'] == 'unmatched') {
|
||||
$compiler->tag_nocache = true;
|
||||
$save = $compiler->template->has_nocache_code;
|
||||
$compiler->template->has_nocache_code = $save;
|
||||
$output = addcslashes($_attr['code'], "'\\");
|
||||
$compiler->parser->current_buffer->append_subtree(new Smarty_Internal_ParseTree_Tag($compiler->parser, $compiler->processNocacheCode("<?php echo '" . $output . "';?>", $compiler, true)));
|
||||
$compiler->template->has_nocache_code = $save;
|
||||
return '';
|
||||
} elseif ($compiler->php_handling == Smarty::PHP_ALLOW) {
|
||||
if (!($compiler->smarty instanceof SmartyBC)) {
|
||||
@@ -101,11 +101,14 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
|
||||
*/
|
||||
public function parsePhp($lex)
|
||||
{
|
||||
$lex->token = Smarty_Internal_Templateparser::TP_PHP;
|
||||
$close = 0;
|
||||
$lex->taglineno = $lex->line;
|
||||
$closeTag = '?>';
|
||||
if (strpos($lex->value, '<?xml') === 0) {
|
||||
$lex->phpType = 'xml';
|
||||
$lex->is_xml = true;
|
||||
$lex->token = Smarty_Internal_Templateparser::TP_NOCACHE;
|
||||
return;
|
||||
} elseif (strpos($lex->value, '<?') === 0) {
|
||||
$lex->phpType = 'php';
|
||||
} elseif (strpos($lex->value, '<%') === 0) {
|
||||
@@ -114,6 +117,11 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
|
||||
} elseif (strpos($lex->value, '%>') === 0) {
|
||||
$lex->phpType = 'unmatched';
|
||||
} elseif (strpos($lex->value, '?>') === 0) {
|
||||
if ($lex->is_xml) {
|
||||
$lex->is_xml = false;
|
||||
$lex->token = Smarty_Internal_Templateparser::TP_NOCACHE;
|
||||
return;
|
||||
}
|
||||
$lex->phpType = 'unmatched';
|
||||
} elseif (strpos($lex->value, '<s') === 0) {
|
||||
$lex->phpType = 'script';
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
*/
|
||||
class Smarty_Internal_Configfilelexer
|
||||
{
|
||||
|
||||
/**
|
||||
* Source
|
||||
*
|
||||
@@ -104,7 +103,8 @@ class Smarty_Internal_Configfilelexer
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $state_name = array(1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', 6 => 'TRIPPLE');
|
||||
public $state_name = array(1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION',
|
||||
6 => 'TRIPPLE');
|
||||
|
||||
/**
|
||||
* storage for assembled token patterns
|
||||
@@ -210,7 +210,7 @@ class Smarty_Internal_Configfilelexer
|
||||
public function yylex1()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern1)) {
|
||||
$this->yy_global_pattern1 = "/\G(#|;)|\G(\\[)|\G(\\])|\G(=)|\G([ \t\r]+)|\G(\n)|\G([0-9]*[a-zA-Z_]\\w*)|\G([\S\s])/iS";
|
||||
$this->yy_global_pattern1 = "/\G(#|;)|\G(\\[)|\G(\\])|\G(=)|\G([ \t\r]+)|\G(\n)|\G([0-9]*[a-zA-Z_]\\w*)|\G([\S\s])/isS";
|
||||
}
|
||||
if ($this->counter >= strlen($this->data)) {
|
||||
return false; // end of input
|
||||
@@ -219,7 +219,11 @@ class Smarty_Internal_Configfilelexer
|
||||
do {
|
||||
if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, null, $this->counter)) {
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (strlen($yysubmatches[0]) < 200) {
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
} else {
|
||||
$yymatches = array_filter($yymatches, 'strlen');
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state START');
|
||||
}
|
||||
@@ -308,7 +312,7 @@ class Smarty_Internal_Configfilelexer
|
||||
public function yylex2()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern2)) {
|
||||
$this->yy_global_pattern2 = "/\G([ \t\r]+)|\G(\\d+\\.\\d+(?=[ \t\r]*[\n#;]))|\G(\\d+(?=[ \t\r]*[\n#;]))|\G(\"\"\")|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#;]))|\G(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#;]))|\G([a-zA-Z]+(?=[ \t\r]*[\n#;]))|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/iS";
|
||||
$this->yy_global_pattern2 = "/\G([ \t\r]+)|\G(\\d+\\.\\d+(?=[ \t\r]*[\n#;]))|\G(\\d+(?=[ \t\r]*[\n#;]))|\G(\"\"\")|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#;]))|\G(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#;]))|\G([a-zA-Z]+(?=[ \t\r]*[\n#;]))|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS";
|
||||
}
|
||||
if ($this->counter >= strlen($this->data)) {
|
||||
return false; // end of input
|
||||
@@ -317,7 +321,11 @@ class Smarty_Internal_Configfilelexer
|
||||
do {
|
||||
if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, null, $this->counter)) {
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (strlen($yysubmatches[0]) < 200) {
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
} else {
|
||||
$yymatches = array_filter($yymatches, 'strlen');
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state VALUE');
|
||||
}
|
||||
@@ -396,7 +404,9 @@ class Smarty_Internal_Configfilelexer
|
||||
function yy_r2_7()
|
||||
{
|
||||
|
||||
if (!$this->configBooleanize || !in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes", "no"))) {
|
||||
if (!$this->configBooleanize || !in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes",
|
||||
"no"))
|
||||
) {
|
||||
$this->yypopstate();
|
||||
$this->yypushstate(self::NAKED_STRING_VALUE);
|
||||
return true; //reprocess in new state
|
||||
@@ -424,7 +434,7 @@ class Smarty_Internal_Configfilelexer
|
||||
public function yylex3()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern3)) {
|
||||
$this->yy_global_pattern3 = "/\G([^\n]+?(?=[ \t\r]*\n))/iS";
|
||||
$this->yy_global_pattern3 = "/\G([^\n]+?(?=[ \t\r]*\n))/isS";
|
||||
}
|
||||
if ($this->counter >= strlen($this->data)) {
|
||||
return false; // end of input
|
||||
@@ -433,7 +443,11 @@ class Smarty_Internal_Configfilelexer
|
||||
do {
|
||||
if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, null, $this->counter)) {
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (strlen($yysubmatches[0]) < 200) {
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
} else {
|
||||
$yymatches = array_filter($yymatches, 'strlen');
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state NAKED_STRING_VALUE');
|
||||
}
|
||||
@@ -478,7 +492,7 @@ class Smarty_Internal_Configfilelexer
|
||||
public function yylex4()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern4)) {
|
||||
$this->yy_global_pattern4 = "/\G([ \t\r]+)|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/iS";
|
||||
$this->yy_global_pattern4 = "/\G([ \t\r]+)|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/isS";
|
||||
}
|
||||
if ($this->counter >= strlen($this->data)) {
|
||||
return false; // end of input
|
||||
@@ -487,7 +501,11 @@ class Smarty_Internal_Configfilelexer
|
||||
do {
|
||||
if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, null, $this->counter)) {
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (strlen($yysubmatches[0]) < 200) {
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
} else {
|
||||
$yymatches = array_filter($yymatches, 'strlen');
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state COMMENT');
|
||||
}
|
||||
@@ -544,7 +562,7 @@ class Smarty_Internal_Configfilelexer
|
||||
public function yylex5()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern5)) {
|
||||
$this->yy_global_pattern5 = "/\G(\\.)|\G(.*?(?=[\.=[\]\r\n]))/iS";
|
||||
$this->yy_global_pattern5 = "/\G(\\.)|\G(.*?(?=[\.=[\]\r\n]))/isS";
|
||||
}
|
||||
if ($this->counter >= strlen($this->data)) {
|
||||
return false; // end of input
|
||||
@@ -553,7 +571,11 @@ class Smarty_Internal_Configfilelexer
|
||||
do {
|
||||
if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, null, $this->counter)) {
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (strlen($yysubmatches[0]) < 200) {
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
} else {
|
||||
$yymatches = array_filter($yymatches, 'strlen');
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state SECTION');
|
||||
}
|
||||
@@ -604,7 +626,7 @@ class Smarty_Internal_Configfilelexer
|
||||
public function yylex6()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern6)) {
|
||||
$this->yy_global_pattern6 = "/\G(\"\"\"(?=[ \t\r]*[\n#;]))|\G([\S\s])/iS";
|
||||
$this->yy_global_pattern6 = "/\G(\"\"\"(?=[ \t\r]*[\n#;]))|\G([\S\s])/isS";
|
||||
}
|
||||
if ($this->counter >= strlen($this->data)) {
|
||||
return false; // end of input
|
||||
@@ -613,7 +635,11 @@ class Smarty_Internal_Configfilelexer
|
||||
do {
|
||||
if (preg_match($this->yy_global_pattern6, $this->data, $yymatches, null, $this->counter)) {
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (strlen($yysubmatches[0]) < 200) {
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
} else {
|
||||
$yymatches = array_filter($yymatches, 'strlen');
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state TRIPPLE');
|
||||
}
|
||||
@@ -669,4 +695,5 @@ class Smarty_Internal_Configfilelexer
|
||||
$this->value = substr($this->data, $this->counter, $to - $this->counter);
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
class TPC_yyToken implements ArrayAccess
|
||||
{
|
||||
|
||||
public $string = '';
|
||||
|
||||
public $metadata = array();
|
||||
@@ -68,7 +67,6 @@ class TPC_yyToken implements ArrayAccess
|
||||
|
||||
class TPC_yyStackEntry
|
||||
{
|
||||
|
||||
public $stateno; /* The state-number */
|
||||
public $major; /* The major token value. This is the code
|
||||
** number for the token at this stack level */
|
||||
@@ -357,15 +355,18 @@ class Smarty_Internal_Configfileparser
|
||||
|
||||
const YY_SZ_ACTTAB = 38;
|
||||
|
||||
static public $yy_action = array(29, 30, 34, 33, 24, 13, 19, 25, 35, 21, 59, 8, 3, 1, 20, 12, 14, 31, 20, 12, 15, 17, 23, 18, 27, 26, 4, 5, 6, 32, 2, 11, 28, 22, 16, 9, 7, 10,);
|
||||
static public $yy_action = array(29, 30, 34, 33, 24, 13, 19, 25, 35, 21, 59, 8, 3, 1, 20, 12, 14, 31, 20, 12, 15,
|
||||
17, 23, 18, 27, 26, 4, 5, 6, 32, 2, 11, 28, 22, 16, 9, 7, 10,);
|
||||
|
||||
static public $yy_lookahead = array(7, 8, 9, 10, 11, 12, 5, 27, 15, 16, 20, 21, 23, 23, 17, 18, 13, 14, 17, 18, 15, 2, 17, 4, 25, 26, 6, 3, 3, 14, 23, 1, 24, 17, 2, 25, 22, 25,);
|
||||
static public $yy_lookahead = array(7, 8, 9, 10, 11, 12, 5, 27, 15, 16, 20, 21, 23, 23, 17, 18, 13, 14, 17, 18, 15,
|
||||
2, 17, 4, 25, 26, 6, 3, 3, 14, 23, 1, 24, 17, 2, 25, 22, 25,);
|
||||
|
||||
const YY_SHIFT_USE_DFLT = - 8;
|
||||
|
||||
const YY_SHIFT_MAX = 19;
|
||||
|
||||
static public $yy_shift_ofst = array(- 8, 1, 1, 1, - 7, - 3, - 3, 30, - 8, - 8, - 8, 19, 5, 3, 15, 16, 24, 25, 32, 20,);
|
||||
static public $yy_shift_ofst = array(- 8, 1, 1, 1, - 7, - 3, - 3, 30, - 8, - 8, - 8, 19, 5, 3, 15, 16, 24, 25, 32,
|
||||
20,);
|
||||
|
||||
const YY_REDUCE_USE_DFLT = - 21;
|
||||
|
||||
@@ -373,9 +374,14 @@ class Smarty_Internal_Configfileparser
|
||||
|
||||
static public $yy_reduce_ofst = array(- 10, - 1, - 1, - 1, - 20, 10, 12, 8, 14, 7, - 11,);
|
||||
|
||||
static public $yyExpectedTokens = array(array(), array(5, 17, 18,), array(5, 17, 18,), array(5, 17, 18,), array(7, 8, 9, 10, 11, 12, 15, 16,), array(17, 18,), array(17, 18,), array(1,), array(), array(), array(), array(2, 4,), array(15, 17,), array(13, 14,), array(14,), array(17,), array(3,), array(3,), array(2,), array(6,), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(),);
|
||||
static public $yyExpectedTokens = array(array(), array(5, 17, 18,), array(5, 17, 18,), array(5, 17, 18,),
|
||||
array(7, 8, 9, 10, 11, 12, 15, 16,), array(17, 18,), array(17, 18,), array(1,), array(), array(), array(),
|
||||
array(2, 4,), array(15, 17,), array(13, 14,), array(14,), array(17,), array(3,), array(3,), array(2,),
|
||||
array(6,), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(),
|
||||
array(), array(), array(), array(), array(),);
|
||||
|
||||
static public $yy_default = array(44, 37, 41, 40, 58, 58, 58, 36, 39, 44, 44, 58, 58, 58, 58, 58, 58, 58, 58, 58, 55, 54, 57, 56, 50, 45, 43, 42, 38, 46, 47, 52, 51, 49, 48, 53,);
|
||||
static public $yy_default = array(44, 37, 41, 40, 58, 58, 58, 36, 39, 44, 44, 58, 58, 58, 58, 58, 58, 58, 58, 58,
|
||||
55, 54, 57, 56, 50, 45, 43, 42, 38, 46, 47, 52, 51, 49, 48, 53,);
|
||||
|
||||
const YYNOCODE = 29;
|
||||
|
||||
@@ -418,9 +424,19 @@ class Smarty_Internal_Configfileparser
|
||||
public $yyerrcnt; /* Shifts left before out of the error */
|
||||
public $yystack = array(); /* The parser's stack */
|
||||
|
||||
public $yyTokenName = array('$', 'OPENB', 'SECTION', 'CLOSEB', 'DOT', 'ID', 'EQUAL', 'FLOAT', 'INT', 'BOOL', 'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING', 'TRIPPLE_QUOTES', 'TRIPPLE_TEXT', 'TRIPPLE_QUOTES_END', 'NAKED_STRING', 'OTHER', 'NEWLINE', 'COMMENTSTART', 'error', 'start', 'global_vars', 'sections', 'var_list', 'section', 'newline', 'var', 'value',);
|
||||
public $yyTokenName = array('$', 'OPENB', 'SECTION', 'CLOSEB', 'DOT', 'ID', 'EQUAL', 'FLOAT', 'INT', 'BOOL',
|
||||
'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING', 'TRIPPLE_QUOTES', 'TRIPPLE_TEXT', 'TRIPPLE_QUOTES_END',
|
||||
'NAKED_STRING', 'OTHER', 'NEWLINE', 'COMMENTSTART', 'error', 'start', 'global_vars', 'sections', 'var_list',
|
||||
'section', 'newline', 'var', 'value',);
|
||||
|
||||
public static $yyRuleName = array('start ::= global_vars sections', 'global_vars ::= var_list', 'sections ::= sections section', 'sections ::=', 'section ::= OPENB SECTION CLOSEB newline var_list', 'section ::= OPENB DOT SECTION CLOSEB newline var_list', 'var_list ::= var_list newline', 'var_list ::= var_list var', 'var_list ::=', 'var ::= ID EQUAL value', 'value ::= FLOAT', 'value ::= INT', 'value ::= BOOL', 'value ::= SINGLE_QUOTED_STRING', 'value ::= DOUBLE_QUOTED_STRING', 'value ::= TRIPPLE_QUOTES TRIPPLE_TEXT TRIPPLE_QUOTES_END', 'value ::= TRIPPLE_QUOTES TRIPPLE_QUOTES_END', 'value ::= NAKED_STRING', 'value ::= OTHER', 'newline ::= NEWLINE', 'newline ::= COMMENTSTART NEWLINE', 'newline ::= COMMENTSTART NAKED_STRING NEWLINE',);
|
||||
public static $yyRuleName = array('start ::= global_vars sections', 'global_vars ::= var_list',
|
||||
'sections ::= sections section', 'sections ::=', 'section ::= OPENB SECTION CLOSEB newline var_list',
|
||||
'section ::= OPENB DOT SECTION CLOSEB newline var_list', 'var_list ::= var_list newline',
|
||||
'var_list ::= var_list var', 'var_list ::=', 'var ::= ID EQUAL value', 'value ::= FLOAT', 'value ::= INT',
|
||||
'value ::= BOOL', 'value ::= SINGLE_QUOTED_STRING', 'value ::= DOUBLE_QUOTED_STRING',
|
||||
'value ::= TRIPPLE_QUOTES TRIPPLE_TEXT TRIPPLE_QUOTES_END', 'value ::= TRIPPLE_QUOTES TRIPPLE_QUOTES_END',
|
||||
'value ::= NAKED_STRING', 'value ::= OTHER', 'newline ::= NEWLINE', 'newline ::= COMMENTSTART NEWLINE',
|
||||
'newline ::= COMMENTSTART NAKED_STRING NEWLINE',);
|
||||
|
||||
public function tokenName($tokenType)
|
||||
{
|
||||
@@ -722,9 +738,16 @@ class Smarty_Internal_Configfileparser
|
||||
}
|
||||
}
|
||||
|
||||
public static $yyRuleInfo = array(array(0 => 20, 1 => 2), array(0 => 21, 1 => 1), array(0 => 22, 1 => 2), array(0 => 22, 1 => 0), array(0 => 24, 1 => 5), array(0 => 24, 1 => 6), array(0 => 23, 1 => 2), array(0 => 23, 1 => 2), array(0 => 23, 1 => 0), array(0 => 26, 1 => 3), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 3), array(0 => 27, 1 => 2), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 25, 1 => 1), array(0 => 25, 1 => 2), array(0 => 25, 1 => 3),);
|
||||
public static $yyRuleInfo = array(array(0 => 20, 1 => 2), array(0 => 21, 1 => 1), array(0 => 22, 1 => 2),
|
||||
array(0 => 22, 1 => 0), array(0 => 24, 1 => 5), array(0 => 24, 1 => 6), array(0 => 23, 1 => 2),
|
||||
array(0 => 23, 1 => 2), array(0 => 23, 1 => 0), array(0 => 26, 1 => 3), array(0 => 27, 1 => 1),
|
||||
array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1),
|
||||
array(0 => 27, 1 => 3), array(0 => 27, 1 => 2), array(0 => 27, 1 => 1), array(0 => 27, 1 => 1),
|
||||
array(0 => 25, 1 => 1), array(0 => 25, 1 => 2), array(0 => 25, 1 => 3),);
|
||||
|
||||
public static $yyReduceMap = array(0 => 0, 2 => 0, 3 => 0, 19 => 0, 20 => 0, 21 => 0, 1 => 1, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15, 16 => 16, 17 => 17, 18 => 17,);
|
||||
public static $yyReduceMap = array(0 => 0, 2 => 0, 3 => 0, 19 => 0, 20 => 0, 21 => 0, 1 => 1, 4 => 4, 5 => 5,
|
||||
6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13,
|
||||
14 => 14, 15 => 15, 16 => 16, 17 => 17, 18 => 17,);
|
||||
|
||||
#line 261 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||
function yy_r0()
|
||||
@@ -776,7 +799,8 @@ class Smarty_Internal_Configfileparser
|
||||
#line 307 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||
function yy_r9()
|
||||
{
|
||||
$this->_retvalue = Array("key" => $this->yystack[$this->yyidx + - 2]->minor, "value" => $this->yystack[$this->yyidx + 0]->minor);
|
||||
$this->_retvalue = Array("key" => $this->yystack[$this->yyidx + - 2]->minor,
|
||||
"value" => $this->yystack[$this->yyidx + 0]->minor);
|
||||
}
|
||||
|
||||
#line 312 "../smarty/lexer/smarty_internal_configfileparser.y"
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
class Smarty_Internal_Resource_File extends Smarty_Resource
|
||||
{
|
||||
|
||||
/**
|
||||
* build template filepath by traversing the template_dir array
|
||||
*
|
||||
@@ -29,44 +28,30 @@ class Smarty_Internal_Resource_File extends Smarty_Resource
|
||||
*/
|
||||
protected function buildFilepath(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
|
||||
{
|
||||
$file = str_replace(array('\\', '/./'), '/', $source->name);
|
||||
$file = $source->name;
|
||||
preg_match('#^(?P<absolute>[\\\/]|[a-zA-Z]:[\\\/])|(\[(?P<index>[^\]]+)\])|(?P<rel>\.[\\\/])#', $file, $fileMatch);
|
||||
// save basename
|
||||
if (!empty($fileMatch['absolute'])) {
|
||||
$file = $this->normalizePath($file);
|
||||
return is_file($file) ? $file : false;
|
||||
}
|
||||
// go relative to a given template?
|
||||
if (!empty($fileMatch['rel']) && $_template && $_template->parent instanceof Smarty_Internal_Template) {
|
||||
if ($_template->parent->source->type != 'file' && $_template->parent->source->type != 'extends' && !$_template->parent->allow_relative_path) {
|
||||
throw new SmartyException("Template '{$file}' cannot be relative to template of resource type '{$_template->parent->source->type}'");
|
||||
}
|
||||
$path = dirname($_template->parent->source->filepath) . DS . $file;
|
||||
// normalize path
|
||||
$path = $this->normalizePath($path);
|
||||
// files relative to a template only get one shot
|
||||
return is_file($path) ? $path : false;
|
||||
}
|
||||
|
||||
if ($source->isConfig) {
|
||||
$_directories = $source->smarty->getConfigDir();
|
||||
} else {
|
||||
$_directories = $source->smarty->getTemplateDir();
|
||||
}
|
||||
preg_match('#^((?P<absolute>[\/]|[a-zA-Z]:[\/])|(\[(?P<index>[^\]]+)\])|((?P<rel1>\.[\/])?(?P<rel2>(\.\.[\/])*))|(?P<skip>[\/]))?(?P<file>.+)$#', $file, $fileMatch);
|
||||
// save basename
|
||||
if (!empty($fileMatch['absolute'])) {
|
||||
return is_file($file) ? $file : false;
|
||||
}
|
||||
// go relative to a given template?
|
||||
if ($_template && $_template->parent instanceof Smarty_Internal_Template && (!empty($fileMatch['rel1']) || !empty($fileMatch['rel2']))) {
|
||||
if ($_template->parent->source->type != 'file' && $_template->parent->source->type != 'extends' && !$_template->parent->allow_relative_path) {
|
||||
throw new SmartyException("Template '{$file}' cannot be relative to template of resource type '{$_template->parent->source->type}'");
|
||||
}
|
||||
$path = dirname($_template->parent->source->filepath);
|
||||
if (!preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $path)) {
|
||||
// the path gained from the parent template is relative to the current working directory
|
||||
// as expansions (like include_path) have already been done
|
||||
$path = str_replace('\\', '/', getcwd()) . '/' . $path;
|
||||
}
|
||||
// normalize path
|
||||
$path = str_replace(array('\\', './'), array('/', ''), $path);
|
||||
// simple relative
|
||||
if (!empty($fileMatch['rel1'])) {
|
||||
$file = $path . '/' . $fileMatch['file'];
|
||||
} else {
|
||||
for ($i = 1; $i <= substr_count($fileMatch['rel2'], '../'); $i ++) {
|
||||
$path = substr($path, 0, strrpos($path, '/'));
|
||||
}
|
||||
$file = $path . '/' . $fileMatch['file'];
|
||||
}
|
||||
// files relative to a template only get one shot
|
||||
return is_file($file) ? $file : false;
|
||||
}
|
||||
|
||||
$_filepath = null;
|
||||
// template_dir index?
|
||||
if (!empty($fileMatch['index'])) {
|
||||
$index = $fileMatch['index'];
|
||||
@@ -86,29 +71,24 @@ class Smarty_Internal_Resource_File extends Smarty_Resource
|
||||
}
|
||||
}
|
||||
if ($_directory) {
|
||||
$_filepath = $_directory . $fileMatch['file'];
|
||||
if (is_file($_filepath)) {
|
||||
return $_filepath;
|
||||
preg_match('#\](.+)$#', $file, $fileMatch);
|
||||
$path = $_directory . $fileMatch[1];
|
||||
$path = $this->normalizePath($path);
|
||||
if (is_file($path)) {
|
||||
return $path;
|
||||
}
|
||||
} else {
|
||||
// index not found
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// relative file name?
|
||||
foreach ($_directories as $_directory) {
|
||||
if (empty($fileMatch['rel2'])) {
|
||||
$_filepath = $_directory . $fileMatch['file'];
|
||||
} else {
|
||||
if (false === strpos($_directory, '..')) {
|
||||
for ($i = 1; $i <= substr_count($fileMatch['rel2'], '../') + 1; $i ++) {
|
||||
$_directory = substr($_directory, 0, strrpos($_directory, '/'));
|
||||
}
|
||||
$_filepath = $_directory . '/' . $fileMatch['file'];
|
||||
} else {
|
||||
$_filepath = $_directory . $file;
|
||||
}
|
||||
}
|
||||
if (is_file($_filepath)) {
|
||||
return $_filepath;
|
||||
$_filepath = $_directory . $file;
|
||||
$path = $this->normalizePath($_filepath);
|
||||
if (is_file($path)) {
|
||||
return $path;
|
||||
}
|
||||
if ($source->smarty->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_directory)) {
|
||||
// try PHP include_path
|
||||
@@ -117,25 +97,38 @@ class Smarty_Internal_Resource_File extends Smarty_Resource
|
||||
} else {
|
||||
$_filepath = Smarty_Internal_Get_Include_Path::getIncludePath($_filepath);
|
||||
}
|
||||
|
||||
if ($_filepath !== false) {
|
||||
if (is_file($_filepath)) {
|
||||
return $_filepath;
|
||||
$path = $this->normalizePath($_filepath);
|
||||
if (is_file($path)) {
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Could be relative to cwd
|
||||
$path = str_replace('\\', '/', getcwd());
|
||||
if (empty($fileMatch['rel2'])) {
|
||||
$file = $path . '/' . $fileMatch['file'];
|
||||
} else {
|
||||
for ($i = 1; $i <= substr_count($fileMatch['rel2'], '../'); $i ++) {
|
||||
$path = substr($path, 0, strrpos($path, '/'));
|
||||
}
|
||||
$file = $path . '/' . $fileMatch['file'];
|
||||
$path = $this->normalizePath(getcwd() . DS . $file);
|
||||
return is_file($path) ? $path : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize path
|
||||
* - remove /./ and /../
|
||||
* - make it absolute
|
||||
*
|
||||
* @param string $path file path
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function normalizePath($path)
|
||||
{
|
||||
if ($path[0] == '.') {
|
||||
$path = getcwd() . DS . $path;
|
||||
}
|
||||
return is_file($file) ? $file : false;
|
||||
$path = preg_replace('#[\\\/]+([.][\\\/]+)*([.](?![.]))?#', DS, $path);
|
||||
while (strrpos($path, DS . '.') !== false) {
|
||||
$path = preg_replace('#([\\\/]([^\\\/]+[\\\/]){2}([.][.][\\\/]){2})|([\\\/][^\\\/]+[\\\/][.][.][\\\/]?)#', DS, $path);
|
||||
}
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,13 +159,10 @@ class Smarty_Internal_Resource_File extends Smarty_Resource
|
||||
if (is_object($source->smarty->security_policy)) {
|
||||
$source->smarty->security_policy->isTrustedResourceDir($source->filepath);
|
||||
}
|
||||
|
||||
$source->uid = sha1(getcwd() . $source->filepath);
|
||||
$source->exists = true;
|
||||
$source->uid = sha1($source->filepath);
|
||||
if ($source->smarty->compile_check && !isset($source->timestamp)) {
|
||||
$source->timestamp = $source->exists = is_file($source->filepath);
|
||||
if ($source->exists) {
|
||||
$source->timestamp = @filemtime($source->filepath);
|
||||
}
|
||||
$source->timestamp = @filemtime($source->filepath);
|
||||
}
|
||||
} else {
|
||||
$source->timestamp = false;
|
||||
|
||||
@@ -340,11 +340,6 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
} else {
|
||||
$this->nocache_hash = $template->properties['nocache_hash'];
|
||||
}
|
||||
// flag for nochache sections
|
||||
$this->nocache = $nocache;
|
||||
$this->tag_nocache = false;
|
||||
// reset has nocache code flag
|
||||
$this->template->has_nocache_code = false;
|
||||
$save_source = $this->template->source;
|
||||
// template header code
|
||||
$template_header = '';
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
*/
|
||||
class Smarty_Internal_Templatelexer
|
||||
{
|
||||
|
||||
/**
|
||||
* Source
|
||||
*
|
||||
@@ -143,9 +142,15 @@ class Smarty_Internal_Templatelexer
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
||||
public $yyTracePrompt;
|
||||
|
||||
/**
|
||||
* XML flag true while processing xml
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $is_xml = false;
|
||||
|
||||
/**
|
||||
* state names
|
||||
*
|
||||
@@ -281,7 +286,11 @@ class Smarty_Internal_Templatelexer
|
||||
do {
|
||||
if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, null, $this->counter)) {
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (strlen($yysubmatches[0]) < 200) {
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
} else {
|
||||
$yymatches = array_filter($yymatches, 'strlen');
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state TEXT');
|
||||
}
|
||||
@@ -340,7 +349,6 @@ class Smarty_Internal_Templatelexer
|
||||
|
||||
$obj = new Smarty_Internal_Compile_Private_Php();
|
||||
$obj->parsePhp($this);
|
||||
$this->token = Smarty_Internal_Templateparser::TP_PHP;
|
||||
}
|
||||
|
||||
function yy_r1_15()
|
||||
@@ -395,7 +403,11 @@ class Smarty_Internal_Templatelexer
|
||||
do {
|
||||
if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, null, $this->counter)) {
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (strlen($yysubmatches[0]) < 200) {
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
} else {
|
||||
$yymatches = array_filter($yymatches, 'strlen');
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state TAG');
|
||||
}
|
||||
@@ -481,9 +493,16 @@ class Smarty_Internal_Templatelexer
|
||||
function yy_r2_9()
|
||||
{
|
||||
|
||||
$this->yypopstate();
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SIMPELOUTPUT;
|
||||
$this->taglineno = $this->line;
|
||||
if ($this->_yy_stack[count($this->_yy_stack) - 1] == self::TEXT) {
|
||||
$this->yypopstate();
|
||||
$this->token = Smarty_Internal_Templateparser::TP_SIMPLEOUTPUT;
|
||||
$this->taglineno = $this->line;
|
||||
} else {
|
||||
$this->value = $this->smarty->left_delimiter;
|
||||
$this->token = Smarty_Internal_Templateparser::TP_LDEL;
|
||||
$this->yybegin(self::TAGBODY);
|
||||
$this->taglineno = $this->line;
|
||||
}
|
||||
}
|
||||
|
||||
function yy_r2_11()
|
||||
@@ -505,7 +524,7 @@ class Smarty_Internal_Templatelexer
|
||||
public function yylex3()
|
||||
{
|
||||
if (!isset($this->yy_global_pattern3)) {
|
||||
$this->yy_global_pattern3 = "/\G(\\s*" . $this->rdel . ")|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$]smarty\\.block\\.(child|parent))|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*(([!=][=]{1,2})|([<][=>]?)|([>][=]?)|[&|]{2})\\s*)|\G(\\s+(eq|ne|neg|gt|ge|gte|lt|le|lte|mod|and|or|xor|(is\\s+(not\\s+)?(odd|even|div)\\s+by))\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even))|\G(([!]\\s*)|(not\\s+))|\G([(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\\s*)|\G(\\s*[(]\\s*)|\G(\\s*[)])|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*[-][>]\\s*)|\G(\\s*[=][>]\\s*)|\G(\\s*[=]\\s*)|\G(([+]|[-]){2})|\G(\\s*([+]|[-])\\s*)|\G(\\s*([*]{1,2}|[%\/^&]|[<>]{2})\\s*)|\G([@])|\G([#])|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*[=]\\s*)|\G(([0-9]*[a-zA-Z_]\\w*)?(\\\\[0-9]*[a-zA-Z_]\\w*)+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G([`])|\G([|])|\G([.])|\G(\\s*[,]\\s*)|\G(\\s*[;]\\s*)|\G([:]{2})|\G(\\s*[:]\\s*)|\G(\\s*[?]\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\G(" . $this->ldel . "\\s*)|\G([\S\s])/isS";
|
||||
$this->yy_global_pattern3 = "/\G(\\s*" . $this->rdel . ")|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$]smarty\\.block\\.(child|parent))|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*(([!=][=]{1,2})|([<][=>]?)|([>][=]?)|[&|]{2})\\s*)|\G(\\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor|(is\\s+(not\\s+)?(odd|even|div)\\s+by))\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even))|\G(([!]\\s*)|(not\\s+))|\G([(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\\s*)|\G(\\s*[(]\\s*)|\G(\\s*[)])|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*[-][>]\\s*)|\G(\\s*[=][>]\\s*)|\G(\\s*[=]\\s*)|\G(([+]|[-]){2})|\G(\\s*([+]|[-])\\s*)|\G(\\s*([*]{1,2}|[%\/^&]|[<>]{2})\\s*)|\G([@])|\G([#])|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*[=]\\s*)|\G(([0-9]*[a-zA-Z_]\\w*)?(\\\\[0-9]*[a-zA-Z_]\\w*)+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G([`])|\G([|])|\G([.])|\G(\\s*[,]\\s*)|\G(\\s*[;]\\s*)|\G([:]{2})|\G(\\s*[:]\\s*)|\G(\\s*[?]\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\G(" . $this->ldel . "\\s*)|\G([\S\s])/isS";
|
||||
}
|
||||
if ($this->counter >= strlen($this->data)) {
|
||||
return false; // end of input
|
||||
@@ -514,7 +533,11 @@ class Smarty_Internal_Templatelexer
|
||||
do {
|
||||
if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, null, $this->counter)) {
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (strlen($yysubmatches[0]) < 200) {
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
} else {
|
||||
$yymatches = array_filter($yymatches, 'strlen');
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state TAGBODY ');
|
||||
}
|
||||
@@ -841,7 +864,11 @@ class Smarty_Internal_Templatelexer
|
||||
do {
|
||||
if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, null, $this->counter)) {
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (strlen($yysubmatches[0]) < 200) {
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
} else {
|
||||
$yymatches = array_filter($yymatches, 'strlen');
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state LITERAL');
|
||||
}
|
||||
@@ -921,7 +948,11 @@ class Smarty_Internal_Templatelexer
|
||||
do {
|
||||
if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, null, $this->counter)) {
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (strlen($yysubmatches[0]) < 200) {
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
} else {
|
||||
$yymatches = array_filter($yymatches, 'strlen');
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state DOUBLEQUOTEDSTRING');
|
||||
}
|
||||
@@ -1056,7 +1087,11 @@ class Smarty_Internal_Templatelexer
|
||||
do {
|
||||
if (preg_match($this->yy_global_pattern6, $this->data, $yymatches, null, $this->counter)) {
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (strlen($yysubmatches[0]) < 200) {
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
} else {
|
||||
$yymatches = array_filter($yymatches, 'strlen');
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state CHILDBODY');
|
||||
}
|
||||
@@ -1146,7 +1181,11 @@ class Smarty_Internal_Templatelexer
|
||||
do {
|
||||
if (preg_match($this->yy_global_pattern7, $this->data, $yymatches, null, $this->counter)) {
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (strlen($yysubmatches[0]) < 200) {
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
} else {
|
||||
$yymatches = array_filter($yymatches, 'strlen');
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state CHILDBLOCK');
|
||||
}
|
||||
@@ -1249,7 +1288,11 @@ class Smarty_Internal_Templatelexer
|
||||
do {
|
||||
if (preg_match($this->yy_global_pattern8, $this->data, $yymatches, null, $this->counter)) {
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
if (strlen($yysubmatches[0]) < 200) {
|
||||
$yymatches = preg_grep("/(.|\s)+/", $yysubmatches);
|
||||
} else {
|
||||
$yymatches = array_filter($yymatches, 'strlen');
|
||||
}
|
||||
if (empty($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' . ' an empty string. Input "' . substr($this->data, $this->counter, 5) . '... state CHILDLITERAL');
|
||||
}
|
||||
@@ -1319,6 +1362,7 @@ class Smarty_Internal_Templatelexer
|
||||
$this->value = substr($this->data, $this->counter, $to - $this->counter);
|
||||
$this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user