mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 19:04:27 +02:00
Merge branch 'v3.1.15'
This commit is contained in:
@@ -1,4 +1,69 @@
|
||||
===== Smarty-3.1.14 =====
|
||||
|
||||
===== Smarty-3.1.14 =====
|
||||
01.10.2013
|
||||
- use current delimiters in compiler error messages (issue 157)
|
||||
- improvement on performance when using error handler and multiple template folders (issue 152)
|
||||
|
||||
17.09.2013
|
||||
- improvement added patch for additional SmartyCompilerException properties for better access to scource information (forum topic 24559)
|
||||
|
||||
16.09.2013
|
||||
- bugfix recompiled templates did not show on first request with zend opcache cache (forum topic 24320)
|
||||
|
||||
13.09.2013
|
||||
- bugfix html_select_time defaulting error for the Meridian dropdown (forum topic 24549)
|
||||
|
||||
09.09.2012
|
||||
- bugfix incorrect compiled code with array(object,method) callback at registered Variable Filter (forum topic 24542)
|
||||
|
||||
27.08.2013
|
||||
- bugfix delimiter followed by linebreak did not work as auto literal after update from 24.08.2013 (forum topic 24518)
|
||||
|
||||
24.08.2013
|
||||
- bugfix and enhancement
|
||||
Because several recent problems with template inheritance the {block} tag compiler has been rewriten
|
||||
- Error messages shown now the correct child template file and line number
|
||||
- The compiler could fail on some larger UTF-8 text block (forum topic 24455)
|
||||
- The {strip} tag can now be placed outside {block} tags in child templates (forum topic 24289)
|
||||
- change SmartyException::$escape is now false by default
|
||||
- change PHP traceback has been remove for SmartyException and SmartyCompilerException
|
||||
|
||||
14.08.2013
|
||||
- bugfix compiled filepath of config file did not observe different config_dir (forum topic 24493)
|
||||
|
||||
13.08.2013
|
||||
- bugfix the internal resource cache did not observe config_dir changes (forum topic 24493)
|
||||
|
||||
12.08.2013
|
||||
- bugfix internal $tmpx variables must be unique over all inheritance templates (Issue 149)
|
||||
|
||||
10.08.2013
|
||||
- bugfix a newline was eaten when a <?xml ... ?> was passed by a Smarty variable and caching was enabled (forum topic 24482)
|
||||
|
||||
29.07.2013
|
||||
- bugfix headers already send warning thrown when using 'SMARTY_DEBUG=on' from URL (Issue 148)
|
||||
|
||||
27.07.2013
|
||||
- enhancement allow access to properties of registered opjects for Smarty2 BC (forum topic 24344)
|
||||
|
||||
26.07.2013
|
||||
- bugfix template inheritance nesting problem (forum topic 24387)
|
||||
|
||||
15.7.2013
|
||||
- update code generated by PSR-2 standards fixer which introduced PHP 5.4 incompatibilities of 14.7.2013
|
||||
|
||||
14.7.2013
|
||||
- bugfix increase of internal maximum parser stacksize to allow more complex tag code {forum topic 24426}
|
||||
- update for PHP 5.4 compatibility
|
||||
- reformat source to PSR-2 standard
|
||||
|
||||
12.7.2013
|
||||
- bugfix Do not remove '//' from file path at normalization (Issue 142)
|
||||
|
||||
2.7.2013
|
||||
- bugfix trimwhitespace would replace captured items in wrong order (forum topic 24387)
|
||||
|
||||
===== Smarty-3.1.14 =====
|
||||
27.06.2013
|
||||
- bugfix removed PHP 5.5 deprecated preg_replace /e option in modifier capitalize (forum topic 24389)
|
||||
|
||||
|
@@ -5,12 +5,10 @@
|
||||
* @package Example-application
|
||||
*/
|
||||
|
||||
require('../libs/Smarty.class.php');
|
||||
require '../libs/Smarty.class.php';
|
||||
|
||||
$smarty = new Smarty;
|
||||
|
||||
|
||||
|
||||
//$smarty->force_compile = true;
|
||||
$smarty->debugging = true;
|
||||
$smarty->caching = true;
|
||||
@@ -30,4 +28,3 @@ $smarty->assign("option_output", array("New York","Nebraska","Kansas","Iowa","Ok
|
||||
$smarty->assign("option_selected", "NE");
|
||||
|
||||
$smarty->display('index.tpl');
|
||||
?>
|
||||
|
@@ -9,8 +9,8 @@
|
||||
* @package CacheResource-examples
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore {
|
||||
|
||||
class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
// test if APC is present
|
||||
@@ -33,6 +33,7 @@ class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore {
|
||||
foreach ($res as $k => $v) {
|
||||
$_res[$k] = $v;
|
||||
}
|
||||
|
||||
return $_res;
|
||||
}
|
||||
|
||||
@@ -48,6 +49,7 @@ class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore {
|
||||
foreach ($keys as $k => $v) {
|
||||
apc_store($k, $v, $expire);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -62,6 +64,7 @@ class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore {
|
||||
foreach ($keys as $k) {
|
||||
apc_delete($k);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -12,7 +12,8 @@
|
||||
* @package CacheResource-examples
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore {
|
||||
class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore
|
||||
{
|
||||
/**
|
||||
* memcache instance
|
||||
* @var Memcache
|
||||
@@ -45,6 +46,7 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore {
|
||||
foreach ($res as $k => $v) {
|
||||
$_res[$lookup[$k]] = $v;
|
||||
}
|
||||
|
||||
return $_res;
|
||||
}
|
||||
|
||||
@@ -61,6 +63,7 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore {
|
||||
$k = sha1($k);
|
||||
$this->memcache->set($k, $v, 0, $expire);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -76,6 +79,7 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore {
|
||||
$k = sha1($k);
|
||||
$this->memcache->delete($k);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -24,16 +24,18 @@
|
||||
* @package CacheResource-examples
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom {
|
||||
class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom
|
||||
{
|
||||
// PDO instance
|
||||
protected $db;
|
||||
protected $fetch;
|
||||
protected $fetchTimestamp;
|
||||
protected $save;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
try {
|
||||
$this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty", "smarty");
|
||||
$this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty");
|
||||
} catch (PDOException $e) {
|
||||
throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
|
||||
}
|
||||
@@ -83,6 +85,7 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom {
|
||||
$this->fetchTimestamp->execute(array('id' => $id));
|
||||
$mtime = strtotime($this->fetchTimestamp->fetchColumn());
|
||||
$this->fetchTimestamp->closeCursor();
|
||||
|
||||
return $mtime;
|
||||
}
|
||||
|
||||
@@ -106,6 +109,7 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom {
|
||||
'compile_id' => $compile_id,
|
||||
'content' => $content,
|
||||
));
|
||||
|
||||
return !!$this->save->rowCount();
|
||||
}
|
||||
|
||||
@@ -124,6 +128,7 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom {
|
||||
if ($name === null && $cache_id === null && $compile_id === null && $exp_time === null) {
|
||||
// returning the number of deleted caches would require a second query to count them
|
||||
$query = $this->db->query('TRUNCATE TABLE output_cache');
|
||||
|
||||
return -1;
|
||||
}
|
||||
// build the filter
|
||||
@@ -147,6 +152,7 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom {
|
||||
}
|
||||
// run delete query
|
||||
$query = $this->db->query('DELETE FROM output_cache WHERE ' . join(' AND ', $where));
|
||||
|
||||
return $query->rowCount();
|
||||
}
|
||||
}
|
||||
|
@@ -9,8 +9,8 @@
|
||||
* @package Resource-examples
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends {
|
||||
|
||||
class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends
|
||||
{
|
||||
/**
|
||||
* populate Source Object with meta data from Resource
|
||||
*
|
||||
@@ -31,13 +31,13 @@ class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends {
|
||||
}
|
||||
$sources[$s->uid] = $s;
|
||||
$uid .= $s->filepath;
|
||||
}
|
||||
catch (SmartyException $e) {}
|
||||
} catch (SmartyException $e) {}
|
||||
}
|
||||
|
||||
if (!$sources) {
|
||||
$source->exists = false;
|
||||
$source->template = $_template;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -56,5 +56,3 @@ class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends {
|
||||
$source->template = $_template;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -20,7 +20,8 @@
|
||||
* @package Resource-examples
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
class Smarty_Resource_Mysql extends Smarty_Resource_Custom {
|
||||
class Smarty_Resource_Mysql extends Smarty_Resource_Custom
|
||||
{
|
||||
// PDO instance
|
||||
protected $db;
|
||||
// prepared fetch() statement
|
||||
@@ -28,9 +29,10 @@ class Smarty_Resource_Mysql extends Smarty_Resource_Custom {
|
||||
// prepared fetchTimestamp() statement
|
||||
protected $mtime;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
try {
|
||||
$this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty", "smarty");
|
||||
$this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty");
|
||||
} catch (PDOException $e) {
|
||||
throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
|
||||
}
|
||||
@@ -67,10 +69,12 @@ class Smarty_Resource_Mysql extends Smarty_Resource_Custom {
|
||||
* @param string $name template name
|
||||
* @return integer timestamp (epoch) the template was modified
|
||||
*/
|
||||
protected function fetchTimestamp($name) {
|
||||
protected function fetchTimestamp($name)
|
||||
{
|
||||
$this->mtime->execute(array('name' => $name));
|
||||
$mtime = $this->mtime->fetchColumn();
|
||||
$this->mtime->closeCursor();
|
||||
|
||||
return strtotime($mtime);
|
||||
}
|
||||
}
|
||||
|
@@ -23,15 +23,17 @@
|
||||
* @package Resource-examples
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
class Smarty_Resource_Mysqls extends Smarty_Resource_Custom {
|
||||
class Smarty_Resource_Mysqls extends Smarty_Resource_Custom
|
||||
{
|
||||
// PDO instance
|
||||
protected $db;
|
||||
// prepared fetch() statement
|
||||
protected $fetch;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
try {
|
||||
$this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty", "smarty");
|
||||
$this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty");
|
||||
} catch (PDOException $e) {
|
||||
throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
|
||||
}
|
||||
|
@@ -104,8 +104,8 @@ include_once SMARTY_SYSPLUGINS_DIR.'smarty_internal_cacheresource_file.php';
|
||||
* This is the main Smarty class
|
||||
* @package Smarty
|
||||
*/
|
||||
class Smarty extends Smarty_Internal_TemplateBase {
|
||||
|
||||
class Smarty extends Smarty_Internal_TemplateBase
|
||||
{
|
||||
/**#@+
|
||||
* constant definitions
|
||||
*/
|
||||
@@ -633,7 +633,6 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class destructor
|
||||
*/
|
||||
@@ -650,7 +649,6 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
$this->smarty = $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <<magic>> Generic getter.
|
||||
*
|
||||
@@ -717,6 +715,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
// check if it does exists
|
||||
$result = $tpl->source->exists;
|
||||
$this->template_objects = $save;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -740,6 +739,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
foreach (self::$global_tpl_vars AS $key => $var) {
|
||||
$_result[$key] = $var->value;
|
||||
}
|
||||
|
||||
return $_result;
|
||||
}
|
||||
}
|
||||
@@ -751,11 +751,12 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
* @param string $type resource type
|
||||
* @return integer number of cache files deleted
|
||||
*/
|
||||
function clearAllCache($exp_time = null, $type = null)
|
||||
public function clearAllCache($exp_time = null, $type = null)
|
||||
{
|
||||
// load cache resource and call clearAll
|
||||
$_cache_resource = Smarty_CacheResource::load($this, $type);
|
||||
Smarty_CacheResource::invalidLoadedCache($this);
|
||||
|
||||
return $_cache_resource->clearAll($this, $exp_time);
|
||||
}
|
||||
|
||||
@@ -774,6 +775,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
// load cache resource and call clear
|
||||
$_cache_resource = Smarty_CacheResource::load($this, $type);
|
||||
Smarty_CacheResource::invalidLoadedCache($this);
|
||||
|
||||
return $_cache_resource->clear($this, $template_name, $cache_id, $compile_id, $exp_time);
|
||||
}
|
||||
|
||||
@@ -788,6 +790,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
{
|
||||
if ($security_class instanceof Smarty_Security) {
|
||||
$this->security_policy = $security_class;
|
||||
|
||||
return $this;
|
||||
} elseif (is_object($security_class)) {
|
||||
throw new SmartyException("Class '" . get_class($security_class) . "' must extend Smarty_Security.");
|
||||
@@ -831,6 +834,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
}
|
||||
|
||||
$this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -865,6 +869,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
$this->template_dir[] = rtrim($template_dir, '/\\') . DS;
|
||||
}
|
||||
$this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -897,6 +902,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
}
|
||||
|
||||
$this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -931,6 +937,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
}
|
||||
|
||||
$this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -993,6 +1000,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
}
|
||||
|
||||
$this->plugins_dir = array_unique($this->plugins_dir);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -1018,6 +1026,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
if (!isset(Smarty::$_muted_directories[$this->compile_dir])) {
|
||||
Smarty::$_muted_directories[$this->compile_dir] = null;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -1043,6 +1052,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
if (!isset(Smarty::$_muted_directories[$this->cache_dir])) {
|
||||
Smarty::$_muted_directories[$this->cache_dir] = null;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -1065,6 +1075,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
public function setDefaultModifiers($modifiers)
|
||||
{
|
||||
$this->default_modifiers = (array) $modifiers;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -1247,6 +1258,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
$tpl->tpl_vars[$_key] = new Smarty_variable($_val);
|
||||
}
|
||||
}
|
||||
|
||||
return $tpl;
|
||||
}
|
||||
|
||||
@@ -1272,6 +1284,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
// count($_name_parts) < 3 === !isset($_name_parts[2])
|
||||
if (!isset($_name_parts[2]) || strtolower($_name_parts[0]) !== 'smarty') {
|
||||
throw new SmartyException("plugin {$plugin_name} is not a valid name format");
|
||||
|
||||
return false;
|
||||
}
|
||||
// if type is "internal", get plugin from sysplugins
|
||||
@@ -1279,6 +1292,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
$file = SMARTY_SYSPLUGINS_DIR . strtolower($plugin_name) . '.php';
|
||||
if (file_exists($file)) {
|
||||
require_once($file);
|
||||
|
||||
return $file;
|
||||
} else {
|
||||
return false;
|
||||
@@ -1298,6 +1312,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
foreach ($names as $file) {
|
||||
if (file_exists($file)) {
|
||||
require_once($file);
|
||||
|
||||
return $file;
|
||||
}
|
||||
if ($this->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_plugin_dir)) {
|
||||
@@ -1310,6 +1325,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
|
||||
if ($file !== false) {
|
||||
require_once($file);
|
||||
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
@@ -1492,10 +1508,13 @@ if (Smarty::$_CHARSET !== 'UTF-8') {
|
||||
* Smarty exception class
|
||||
* @package Smarty
|
||||
*/
|
||||
class SmartyException extends Exception {
|
||||
public static $escape = true;
|
||||
public function __construct($message) {
|
||||
$this->message = self::$escape ? htmlentities($message) : $message;
|
||||
class SmartyException extends Exception
|
||||
{
|
||||
public static $escape = false;
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return ' --> Smarty: ' . (self::$escape ? htmlentities($this->message) : $this->message) . ' <-- ';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1503,7 +1522,32 @@ class SmartyException extends Exception {
|
||||
* Smarty compiler exception class
|
||||
* @package Smarty
|
||||
*/
|
||||
class SmartyCompilerException extends SmartyException {
|
||||
class SmartyCompilerException extends SmartyException
|
||||
{
|
||||
public function __toString()
|
||||
{
|
||||
return ' --> Smarty Compiler: ' . $this->message . ' <-- ';
|
||||
}
|
||||
/**
|
||||
* The line number of the template error
|
||||
* @type int|null
|
||||
*/
|
||||
public $line = null;
|
||||
/**
|
||||
* The template source snippet relating to the error
|
||||
* @type string|null
|
||||
*/
|
||||
public $source = null;
|
||||
/**
|
||||
* The raw text of the error message
|
||||
* @type string|null
|
||||
*/
|
||||
public $desc = null;
|
||||
/**
|
||||
* The resource identifier or template name
|
||||
* @type string|null
|
||||
*/
|
||||
public $template = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1512,7 +1556,7 @@ class SmartyCompilerException extends SmartyException {
|
||||
function smartyAutoload($class)
|
||||
{
|
||||
$_class = strtolower($class);
|
||||
$_classes = array(
|
||||
static $_classes = array(
|
||||
'smarty_config_source' => true,
|
||||
'smarty_config_compiled' => true,
|
||||
'smarty_security' => true,
|
||||
@@ -1529,5 +1573,3 @@ function smartyAutoload($class)
|
||||
include SMARTY_SYSPLUGINS_DIR . $_class . '.php';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -39,8 +39,8 @@ require(dirname(__FILE__) . '/Smarty.class.php');
|
||||
*
|
||||
* @package Smarty
|
||||
*/
|
||||
class SmartyBC extends Smarty {
|
||||
|
||||
class SmartyBC extends Smarty
|
||||
{
|
||||
/**
|
||||
* Smarty 2 BC
|
||||
* @var string
|
||||
@@ -454,7 +454,6 @@ class SmartyBC extends Smarty {
|
||||
function smarty_php_tag($params, $content, $template, &$repeat)
|
||||
{
|
||||
eval($content);
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
?>
|
@@ -78,7 +78,6 @@ function smarty_block_textformat($params, $content, $template, &$repeat)
|
||||
$_paragraphs = preg_split('![\r\n]{2}!', $content);
|
||||
$_output = '';
|
||||
|
||||
|
||||
foreach ($_paragraphs as &$_paragraph) {
|
||||
if (!$_paragraph) {
|
||||
continue;
|
||||
@@ -109,5 +108,3 @@ function smarty_block_textformat($params, $content, $template, &$repeat)
|
||||
return $_output;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -74,5 +74,3 @@ function smarty_function_counter($params, $template)
|
||||
return $retval;
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -55,6 +55,7 @@ function smarty_function_cycle($params, $template)
|
||||
if (!isset($params['values'])) {
|
||||
if (!isset($cycle_vars[$name]['values'])) {
|
||||
trigger_error("cycle: missing 'values' parameter");
|
||||
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -102,5 +103,3 @@ function smarty_function_cycle($params, $template)
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
?>
|
@@ -24,6 +24,7 @@ function smarty_function_fetch($params, $template)
|
||||
{
|
||||
if (empty($params['file'])) {
|
||||
trigger_error("[plugin] fetch parameter 'file' cannot be empty",E_USER_NOTICE);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -101,6 +102,7 @@ function smarty_function_fetch($params, $template)
|
||||
if (!empty($param_value)) {
|
||||
if (!preg_match('![\w\d-]+: .+!',$param_value)) {
|
||||
trigger_error("[plugin] invalid header format '".$param_value."'",E_USER_NOTICE);
|
||||
|
||||
return;
|
||||
} else {
|
||||
$extra_headers[] = $param_value;
|
||||
@@ -117,6 +119,7 @@ function smarty_function_fetch($params, $template)
|
||||
$proxy_port = (int) $param_value;
|
||||
} else {
|
||||
trigger_error("[plugin] invalid value for attribute '".$param_key."'",E_USER_NOTICE);
|
||||
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -135,11 +138,13 @@ function smarty_function_fetch($params, $template)
|
||||
$timeout = (int) $param_value;
|
||||
} else {
|
||||
trigger_error("[plugin] invalid value for attribute '".$param_key."'",E_USER_NOTICE);
|
||||
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
trigger_error("[plugin] unrecognized attribute '".$param_key."'",E_USER_NOTICE);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -152,6 +157,7 @@ function smarty_function_fetch($params, $template)
|
||||
|
||||
if (!$fp) {
|
||||
trigger_error("[plugin] unable to fetch: $errstr ($errno)",E_USER_NOTICE);
|
||||
|
||||
return;
|
||||
} else {
|
||||
if ($_is_proxy) {
|
||||
@@ -195,6 +201,7 @@ function smarty_function_fetch($params, $template)
|
||||
}
|
||||
} else {
|
||||
trigger_error("[plugin fetch] unable to parse URL, check syntax",E_USER_NOTICE);
|
||||
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -210,5 +217,3 @@ function smarty_function_fetch($params, $template)
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -167,7 +167,8 @@ function smarty_function_html_checkboxes($params, $template)
|
||||
|
||||
}
|
||||
|
||||
function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape=true) {
|
||||
function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape=true)
|
||||
{
|
||||
$_output = '';
|
||||
|
||||
if (is_object($value)) {
|
||||
@@ -175,6 +176,7 @@ function smarty_function_html_checkboxes_output($name, $value, $output, $selecte
|
||||
$value = (string) $value->__toString();
|
||||
} else {
|
||||
trigger_error("html_options: value is an object of class '". get_class($value) ."' without __toString() method", E_USER_NOTICE);
|
||||
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
@@ -186,6 +188,7 @@ function smarty_function_html_checkboxes_output($name, $value, $output, $selecte
|
||||
$output = (string) $output->__toString();
|
||||
} else {
|
||||
trigger_error("html_options: output is an object of class '". get_class($output) ."' without __toString() method", E_USER_NOTICE);
|
||||
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
@@ -227,7 +230,6 @@ function smarty_function_html_checkboxes_output($name, $value, $output, $selecte
|
||||
}
|
||||
|
||||
$_output .= $separator;
|
||||
|
||||
return $_output;
|
||||
}
|
||||
|
||||
?>
|
@@ -84,6 +84,7 @@ function smarty_function_html_image($params, $template)
|
||||
|
||||
if (empty($file)) {
|
||||
trigger_error("html_image: missing 'file' parameter", E_USER_NOTICE);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -122,12 +123,15 @@ function smarty_function_html_image($params, $template)
|
||||
if (!$_image_data = @getimagesize($_image_path)) {
|
||||
if (!file_exists($_image_path)) {
|
||||
trigger_error("html_image: unable to find '$_image_path'", E_USER_NOTICE);
|
||||
|
||||
return;
|
||||
} elseif (!is_readable($_image_path)) {
|
||||
trigger_error("html_image: unable to read '$_image_path'", E_USER_NOTICE);
|
||||
|
||||
return;
|
||||
} else {
|
||||
trigger_error("html_image: '$_image_path' is not a valid image file", E_USER_NOTICE);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -155,5 +159,3 @@ function smarty_function_html_image($params, $template)
|
||||
|
||||
return $prefix . '<img src="' . $path_prefix . $file . '" alt="' . $alt . '" width="' . $width . '" height="' . $height . '"' . $extra . ' />' . $suffix;
|
||||
}
|
||||
|
||||
?>
|
@@ -120,6 +120,7 @@ function smarty_function_html_options($params, $template)
|
||||
|
||||
if (!isset($options) && !isset($values)) {
|
||||
/* raise error here? */
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -165,6 +166,7 @@ function smarty_function_html_options_optoutput($key, $value, $selected, $id, $c
|
||||
$value = smarty_function_escape_special_chars((string) $value->__toString());
|
||||
} else {
|
||||
trigger_error("html_options: value is an object of class '". get_class($value) ."' without __toString() method", E_USER_NOTICE);
|
||||
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
@@ -177,6 +179,7 @@ function smarty_function_html_options_optoutput($key, $value, $selected, $id, $c
|
||||
$_html_result = smarty_function_html_options_optgroup($key, $value, $selected, !empty($id) ? ($id.'-'.$idx) : null, $class, $_idx);
|
||||
$idx++;
|
||||
}
|
||||
|
||||
return $_html_result;
|
||||
}
|
||||
|
||||
@@ -187,7 +190,6 @@ function smarty_function_html_options_optgroup($key, $values, $selected, $id, $c
|
||||
$optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, $idx);
|
||||
}
|
||||
$optgroup_html .= "</optgroup>\n";
|
||||
|
||||
return $optgroup_html;
|
||||
}
|
||||
|
||||
?>
|
@@ -131,6 +131,7 @@ function smarty_function_html_radios($params, $template)
|
||||
|
||||
if (!isset($options) && !isset($values)) {
|
||||
/* raise error here? */
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -163,6 +164,7 @@ function smarty_function_html_radios_output($name, $value, $output, $selected, $
|
||||
$value = (string) $value->__toString();
|
||||
} else {
|
||||
trigger_error("html_options: value is an object of class '". get_class($value) ."' without __toString() method", E_USER_NOTICE);
|
||||
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
@@ -174,6 +176,7 @@ function smarty_function_html_radios_output($name, $value, $output, $selected, $
|
||||
$output = (string) $output->__toString();
|
||||
} else {
|
||||
trigger_error("html_options: output is an object of class '". get_class($output) ."' without __toString() method", E_USER_NOTICE);
|
||||
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
@@ -211,7 +214,6 @@ function smarty_function_html_radios_output($name, $value, $output, $selected, $
|
||||
}
|
||||
|
||||
$_output .= $separator;
|
||||
|
||||
return $_output;
|
||||
}
|
||||
|
||||
?>
|
@@ -388,7 +388,6 @@ function smarty_function_html_select_date($params, $template)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $_html;
|
||||
}
|
||||
|
||||
?>
|
@@ -345,7 +345,7 @@ function smarty_function_html_select_time($params, $template)
|
||||
$_html_meridian .= '<option value="">' . ( isset($meridian_empty) ? $meridian_empty : $all_empty ) . '</option>' . $option_separator;
|
||||
}
|
||||
|
||||
$_html_meridian .= '<option value="am"'. ($_hour < 12 ? ' selected="selected"' : '') .'>AM</option>' . $option_separator
|
||||
$_html_meridian .= '<option value="am"'. ($_hour > 0 && $_hour < 12 ? ' selected="selected"' : '') .'>AM</option>' . $option_separator
|
||||
. '<option value="pm"'. ($_hour < 12 ? '' : ' selected="selected"') .'>PM</option>' . $option_separator
|
||||
. '</select>';
|
||||
}
|
||||
@@ -362,5 +362,3 @@ function smarty_function_html_select_time($params, $template)
|
||||
|
||||
return $_html;
|
||||
}
|
||||
|
||||
?>
|
@@ -64,6 +64,7 @@ function smarty_function_html_table($params, $template)
|
||||
|
||||
if (!isset($params['loop'])) {
|
||||
trigger_error("html_table: missing 'loop' parameter",E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -173,5 +174,3 @@ function smarty_function_html_table_cycle($name, $var, $no)
|
||||
|
||||
return ($ret) ? ' ' . $ret : '';
|
||||
}
|
||||
|
||||
?>
|
@@ -55,6 +55,7 @@ function smarty_function_mailto($params, $template)
|
||||
|
||||
if (empty($params['address'])) {
|
||||
trigger_error("mailto: missing 'address' parameter",E_USER_WARNING);
|
||||
|
||||
return;
|
||||
} else {
|
||||
$address = $params['address'];
|
||||
@@ -95,6 +96,7 @@ function smarty_function_mailto($params, $template)
|
||||
$encode = (empty($params['encode'])) ? 'none' : $params['encode'];
|
||||
if (!isset($_allowed_encoding[$encode])) {
|
||||
trigger_error("mailto: 'encode' parameter must be none, javascript, javascript_charcode or hex", E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
// FIXME: (rodneyrehm) document.write() excues me what? 1998 has passed!
|
||||
@@ -126,6 +128,7 @@ function smarty_function_mailto($params, $template)
|
||||
preg_match('!^(.*)(\?.*)$!', $address, $match);
|
||||
if (!empty($match[2])) {
|
||||
trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.",E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
$address_encode = '';
|
||||
@@ -142,11 +145,10 @@ function smarty_function_mailto($params, $template)
|
||||
}
|
||||
|
||||
$mailto = "mailto:";
|
||||
|
||||
return '<a href="' . $mailto . $address_encode . '" ' . $extra . '>' . $text_encode . '</a>';
|
||||
} else {
|
||||
// no encoding
|
||||
return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -31,6 +31,7 @@ function smarty_function_math($params, $template)
|
||||
// be sure equation parameter is present
|
||||
if (empty($params['equation'])) {
|
||||
trigger_error("math: missing equation parameter",E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -39,6 +40,7 @@ function smarty_function_math($params, $template)
|
||||
// make sure parenthesis are balanced
|
||||
if (substr_count($equation,"(") != substr_count($equation,")")) {
|
||||
trigger_error("math: unbalanced parenthesis",E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -48,6 +50,7 @@ function smarty_function_math($params, $template)
|
||||
foreach ($match[1] as $curr_var) {
|
||||
if ($curr_var && !isset($params[$curr_var]) && !isset($_allowed_funcs[$curr_var])) {
|
||||
trigger_error("math: function call $curr_var not allowed",E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -57,10 +60,12 @@ function smarty_function_math($params, $template)
|
||||
// make sure value is not empty
|
||||
if (strlen($val)==0) {
|
||||
trigger_error("math: parameter $key is empty",E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
if (!is_numeric($val)) {
|
||||
trigger_error("math: parameter $key: is not numeric",E_USER_WARNING);
|
||||
|
||||
return;
|
||||
}
|
||||
$equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation);
|
||||
@@ -83,5 +88,3 @@ function smarty_function_math($params, $template)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -41,6 +41,7 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
|
||||
}
|
||||
}
|
||||
$upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, create_function ('$matches', 'return stripslashes($matches[1]).mb_convert_case(stripslashes($matches[3]),MB_CASE_UPPER, "' . addslashes(Smarty::$_CHARSET) . '");'), $upper_string);
|
||||
|
||||
return $upper_string;
|
||||
}
|
||||
|
||||
@@ -59,7 +60,6 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
|
||||
}
|
||||
}
|
||||
$upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, create_function ('$matches', 'return stripslashes($matches[1]).ucfirst(stripslashes($matches[3]));'), $upper_string);
|
||||
|
||||
return $upper_string;
|
||||
}
|
||||
|
||||
?>
|
@@ -56,10 +56,9 @@ function smarty_modifier_date_format($string, $format=null, $default_date='', $f
|
||||
}
|
||||
$format = str_replace($_win_from, $_win_to, $format);
|
||||
}
|
||||
|
||||
return strftime($format, $timestamp);
|
||||
} else {
|
||||
return date($format, $timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -101,5 +101,3 @@ function smarty_modifier_debug_print_var ($var, $depth = 0, $length = 40)
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
?>
|
@@ -46,6 +46,7 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
||||
$string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
|
||||
$string = htmlspecialchars($string, ENT_QUOTES, $char_set);
|
||||
$string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string);
|
||||
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
@@ -65,6 +66,7 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
||||
$string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
|
||||
$string = htmlspecialchars($string, ENT_QUOTES, $char_set);
|
||||
$string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string);
|
||||
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
@@ -83,6 +85,7 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
||||
$string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
|
||||
$string = htmlentities($string, ENT_QUOTES, $char_set);
|
||||
$string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string);
|
||||
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
@@ -105,6 +108,7 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
||||
for ($x = 0; $x < $_length; $x++) {
|
||||
$return .= '%' . bin2hex($string[$x]);
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
||||
case 'hexentity':
|
||||
@@ -115,6 +119,7 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
||||
foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) {
|
||||
$return .= '&#x' . strtoupper(dechex($unicode)) . ';';
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
// no MBString fallback
|
||||
@@ -122,6 +127,7 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
||||
for ($x = 0; $x < $_length; $x++) {
|
||||
$return .= '&#x' . bin2hex($string[$x]) . ';';
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
||||
case 'decentity':
|
||||
@@ -132,6 +138,7 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
||||
foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) {
|
||||
$return .= '&#' . $unicode . ';';
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
// no MBString fallback
|
||||
@@ -139,6 +146,7 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
||||
for ($x = 0; $x < $_length; $x++) {
|
||||
$return .= '&#' . ord($string[$x]) . ';';
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
||||
case 'javascript':
|
||||
@@ -148,6 +156,7 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
||||
case 'mail':
|
||||
if (Smarty::$_MBSTRING) {
|
||||
require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php');
|
||||
|
||||
return smarty_mb_str_replace(array('@', '.'), array(' [AT] ', ' [DOT] '), $string);
|
||||
}
|
||||
// no MBString fallback
|
||||
@@ -165,6 +174,7 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
||||
$return .= chr($unicode);
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
@@ -178,11 +188,10 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
||||
$return .= substr($string, $_i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
||||
default:
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -30,6 +30,7 @@ function smarty_modifier_regex_replace($string, $search, $replace)
|
||||
} else {
|
||||
$search = _smarty_regex_replace_check($search);
|
||||
}
|
||||
|
||||
return preg_replace($search, $replace, $string);
|
||||
}
|
||||
|
||||
@@ -49,7 +50,6 @@ function _smarty_regex_replace_check($search)
|
||||
if (preg_match('!([a-zA-Z\s]+)$!s', $search, $match) && (strpos($match[1], 'e') !== false)) {
|
||||
$search = substr($search, 0, -strlen($match[1])) . preg_replace('![e\s]+!', '', $match[1]);
|
||||
}
|
||||
|
||||
return $search;
|
||||
}
|
||||
|
||||
?>
|
@@ -24,10 +24,9 @@ function smarty_modifier_replace($string, $search, $replace)
|
||||
{
|
||||
if (Smarty::$_MBSTRING) {
|
||||
require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php');
|
||||
|
||||
return smarty_mb_str_replace($search, $replace, $string);
|
||||
}
|
||||
|
||||
return str_replace($search, $replace, $string);
|
||||
}
|
||||
|
||||
?>
|
@@ -23,5 +23,3 @@ function smarty_modifier_spacify($string, $spacify_char = ' ')
|
||||
// well… what about charsets besides latin and UTF-8?
|
||||
return implode($spacify_char, preg_split('//' . Smarty::$_UTF8_MODIFIER, $string, -1, PREG_SPLIT_NO_EMPTY));
|
||||
}
|
||||
|
||||
?>
|
@@ -24,7 +24,8 @@
|
||||
* @param boolean $middle truncate in the middle of text
|
||||
* @return string truncated string
|
||||
*/
|
||||
function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false) {
|
||||
function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false)
|
||||
{
|
||||
if ($length == 0)
|
||||
return '';
|
||||
|
||||
@@ -37,8 +38,10 @@ function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_wo
|
||||
if (!$middle) {
|
||||
return mb_substr($string, 0, $length, Smarty::$_CHARSET) . $etc;
|
||||
}
|
||||
|
||||
return mb_substr($string, 0, $length / 2, Smarty::$_CHARSET) . $etc . mb_substr($string, - $length / 2, $length, Smarty::$_CHARSET);
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
@@ -51,9 +54,9 @@ function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_wo
|
||||
if (!$middle) {
|
||||
return substr($string, 0, $length) . $etc;
|
||||
}
|
||||
|
||||
return substr($string, 0, $length / 2) . $etc . substr($string, - $length / 2);
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
?>
|
@@ -26,5 +26,3 @@ function smarty_modifiercompiler_cat($params, $compiler)
|
||||
{
|
||||
return '('.implode(').(', $params).')';
|
||||
}
|
||||
|
||||
?>
|
@@ -29,5 +29,3 @@ function smarty_modifiercompiler_count_characters($params, $compiler)
|
||||
// no MBString fallback
|
||||
return 'strlen(' . $params[0] . ')';
|
||||
}
|
||||
|
||||
?>
|
@@ -24,5 +24,3 @@ function smarty_modifiercompiler_count_paragraphs($params, $compiler)
|
||||
// count \r or \n characters
|
||||
return '(preg_match_all(\'#[\r\n]+#\', ' . $params[0] . ', $tmp)+1)';
|
||||
}
|
||||
|
||||
?>
|
@@ -24,5 +24,3 @@ function smarty_modifiercompiler_count_sentences($params, $compiler)
|
||||
// find periods, question marks, exclamation marks with a word before but not after.
|
||||
return 'preg_match_all("#\w[\.\?\!](\W|$)#S' . Smarty::$_UTF8_MODIFIER . '", ' . $params[0] . ', $tmp)';
|
||||
}
|
||||
|
||||
?>
|
@@ -28,5 +28,3 @@ function smarty_modifiercompiler_count_words($params, $compiler)
|
||||
// no MBString fallback
|
||||
return 'str_word_count(' . $params[0] . ')';
|
||||
}
|
||||
|
||||
?>
|
@@ -29,7 +29,6 @@ function smarty_modifiercompiler_default ($params, $compiler)
|
||||
foreach ($params as $param) {
|
||||
$output = '(($tmp = @' . $output . ')===null||$tmp===\'\' ? ' . $param . ' : $tmp)';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
?>
|
@@ -119,7 +119,6 @@ function smarty_modifiercompiler_escape($params, $compiler)
|
||||
$compiler->template->required_plugins['compiled']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR .'modifier.escape.php';
|
||||
$compiler->template->required_plugins['compiled']['escape']['modifier']['function'] = 'smarty_modifier_escape';
|
||||
}
|
||||
|
||||
return 'smarty_modifier_escape(' . join( ', ', $params ) . ')';
|
||||
}
|
||||
|
||||
?>
|
@@ -30,5 +30,3 @@ function smarty_modifiercompiler_from_charset($params, $compiler)
|
||||
|
||||
return 'mb_convert_encoding(' . $params[0] . ', "' . addslashes(Smarty::$_CHARSET) . '", ' . $params[1] . ')';
|
||||
}
|
||||
|
||||
?>
|
@@ -26,7 +26,6 @@ function smarty_modifiercompiler_indent($params, $compiler)
|
||||
if (!isset($params[2])) {
|
||||
$params[2] = "' '";
|
||||
}
|
||||
|
||||
return 'preg_replace(\'!^!m\',str_repeat(' . $params[2] . ',' . $params[1] . '),' . $params[0] . ')';
|
||||
}
|
||||
|
||||
?>
|
@@ -27,5 +27,3 @@ function smarty_modifiercompiler_lower($params, $compiler)
|
||||
// no MBString fallback
|
||||
return 'strtolower(' . $params[0] . ')';
|
||||
}
|
||||
|
||||
?>
|
@@ -21,5 +21,3 @@ function smarty_modifiercompiler_noprint($params, $compiler)
|
||||
{
|
||||
return "''";
|
||||
}
|
||||
|
||||
?>
|
@@ -22,5 +22,3 @@ function smarty_modifiercompiler_string_format($params, $compiler)
|
||||
{
|
||||
return 'sprintf(' . $params[1] . ',' . $params[0] . ')';
|
||||
}
|
||||
|
||||
?>
|
@@ -27,7 +27,6 @@ function smarty_modifiercompiler_strip($params, $compiler)
|
||||
if (!isset($params[1])) {
|
||||
$params[1] = "' '";
|
||||
}
|
||||
|
||||
return "preg_replace('!\s+!" . Smarty::$_UTF8_MODIFIER . "', {$params[1]},{$params[0]})";
|
||||
}
|
||||
|
||||
?>
|
@@ -30,5 +30,3 @@ function smarty_modifiercompiler_to_charset($params, $compiler)
|
||||
|
||||
return 'mb_convert_encoding(' . $params[0] . ', ' . $params[1] . ', "' . addslashes(Smarty::$_CHARSET) . '")';
|
||||
}
|
||||
|
||||
?>
|
@@ -47,5 +47,3 @@ function smarty_modifiercompiler_unescape($params, $compiler)
|
||||
return $params[0];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -26,5 +26,3 @@ function smarty_modifiercompiler_upper($params, $compiler)
|
||||
// no MBString fallback
|
||||
return 'strtoupper(' . $params[0] . ')';
|
||||
}
|
||||
|
||||
?>
|
@@ -40,7 +40,6 @@ function smarty_modifiercompiler_wordwrap($params, $compiler)
|
||||
}
|
||||
$function = 'smarty_mb_wordwrap';
|
||||
}
|
||||
|
||||
return $function . '(' . $params[0] . ',' . $params[1] . ',' . $params[2] . ',' . $params[3] . ')';
|
||||
}
|
||||
|
||||
?>
|
@@ -74,13 +74,11 @@ function smarty_outputfilter_trimwhitespace($source, Smarty_Internal_Template $s
|
||||
// maybe a \0 byte or something is interfering?
|
||||
// $source = trim( $source );
|
||||
|
||||
// capture html elements not to be messed with
|
||||
$_offset = 0;
|
||||
if (preg_match_all('#@!@SMARTY:([0-9]+):SMARTY@!@#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
|
||||
foreach ($matches as $match) {
|
||||
$store[] = $match[0][0];
|
||||
$_length = strlen($match[0][0]);
|
||||
$replace = array_shift($store);
|
||||
$replace = $store[$match[1][0]];
|
||||
$source = substr_replace($source, $replace, $match[0][1] + $_offset, $_length);
|
||||
|
||||
$_offset += strlen($replace) - $_length;
|
||||
@@ -90,5 +88,3 @@ function smarty_outputfilter_trimwhitespace($source, Smarty_Internal_Template $s
|
||||
|
||||
return $source;
|
||||
}
|
||||
|
||||
?>
|
@@ -23,6 +23,7 @@ if (version_compare(PHP_VERSION, '5.2.3', '>=')) {
|
||||
if (!is_array($string)) {
|
||||
$string = htmlspecialchars($string, ENT_COMPAT, Smarty::$_CHARSET, false);
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
} else {
|
||||
@@ -44,8 +45,7 @@ if (version_compare(PHP_VERSION, '5.2.3', '>=')) {
|
||||
$string = htmlspecialchars($string);
|
||||
$string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string);
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -29,5 +29,6 @@ function smarty_literal_compiler_param($params, $index, $default=null)
|
||||
|
||||
$t = null;
|
||||
eval("\$t = " . $params[$index] . ";");
|
||||
|
||||
return $t;
|
||||
}
|
||||
|
@@ -35,8 +35,7 @@ function smarty_make_timestamp($string)
|
||||
// strtotime() was not able to parse $string, use "now":
|
||||
return time();
|
||||
}
|
||||
|
||||
return $time;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -48,8 +48,8 @@ if (!function_exists('smarty_mb_str_replace')) {
|
||||
$count = count($parts) - 1;
|
||||
$subject = implode($replace, $parts);
|
||||
}
|
||||
|
||||
return $subject;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@@ -15,12 +15,14 @@
|
||||
* @return array sequence of unicodes
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
function smarty_mb_to_unicode($string, $encoding=null) {
|
||||
function smarty_mb_to_unicode($string, $encoding=null)
|
||||
{
|
||||
if ($encoding) {
|
||||
$expanded = mb_convert_encoding($string, "UTF-32BE", $encoding);
|
||||
} else {
|
||||
$expanded = mb_convert_encoding($string, "UTF-32BE");
|
||||
}
|
||||
|
||||
return unpack("N*", $expanded);
|
||||
}
|
||||
|
||||
@@ -33,7 +35,8 @@ function smarty_mb_to_unicode($string, $encoding=null) {
|
||||
* @return string unicode as character sequence in given $encoding
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
function smarty_mb_from_unicode($unicode, $encoding=null) {
|
||||
function smarty_mb_from_unicode($unicode, $encoding=null)
|
||||
{
|
||||
$t = '';
|
||||
if (!$encoding) {
|
||||
$encoding = mb_internal_encoding();
|
||||
@@ -42,7 +45,6 @@ function smarty_mb_from_unicode($unicode, $encoding=null) {
|
||||
$character = pack("N*", $utf32be);
|
||||
$t .= mb_convert_encoding($character, $encoding, "UTF-32BE");
|
||||
}
|
||||
|
||||
return $t;
|
||||
}
|
||||
|
||||
?>
|
@@ -80,4 +80,3 @@ if(!function_exists('smarty_mb_wordwrap')) {
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@@ -17,5 +17,3 @@ function smarty_variablefilter_htmlspecialchars($source, $smarty)
|
||||
{
|
||||
return htmlspecialchars($source, ENT_QUOTES, Smarty::$_CHARSET);
|
||||
}
|
||||
|
||||
?>
|
@@ -13,7 +13,8 @@
|
||||
* @subpackage Cacher
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
abstract class Smarty_CacheResource {
|
||||
abstract class Smarty_CacheResource
|
||||
{
|
||||
/**
|
||||
* cache for Smarty_CacheResource instances
|
||||
* @var array
|
||||
@@ -35,7 +36,7 @@ abstract class Smarty_CacheResource {
|
||||
* @param Smarty_Internal_Template $_template template object
|
||||
* @return void
|
||||
*/
|
||||
public abstract function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template);
|
||||
abstract public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template);
|
||||
|
||||
/**
|
||||
* populate Cached Object with timestamp and exists from Resource
|
||||
@@ -43,7 +44,7 @@ abstract class Smarty_CacheResource {
|
||||
* @param Smarty_Template_Cached $source cached object
|
||||
* @return void
|
||||
*/
|
||||
public abstract function populateTimestamp(Smarty_Template_Cached $cached);
|
||||
abstract public function populateTimestamp(Smarty_Template_Cached $cached);
|
||||
|
||||
/**
|
||||
* Read the cached template and process header
|
||||
@@ -52,7 +53,7 @@ abstract class Smarty_CacheResource {
|
||||
* @param Smarty_Template_Cached $cached cached object
|
||||
* @return booelan true or false if the cached content does not exist
|
||||
*/
|
||||
public abstract function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached=null);
|
||||
abstract public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached=null);
|
||||
|
||||
/**
|
||||
* Write the rendered template output to cache
|
||||
@@ -61,7 +62,7 @@ abstract class Smarty_CacheResource {
|
||||
* @param string $content content to cache
|
||||
* @return boolean success
|
||||
*/
|
||||
public abstract function writeCachedContent(Smarty_Internal_Template $_template, $content);
|
||||
abstract public function writeCachedContent(Smarty_Internal_Template $_template, $content);
|
||||
|
||||
/**
|
||||
* Return cached content
|
||||
@@ -74,8 +75,10 @@ abstract class Smarty_CacheResource {
|
||||
if ($_template->cached->handler->process($_template)) {
|
||||
ob_start();
|
||||
$_template->properties['unifunc']($_template);
|
||||
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -86,7 +89,7 @@ abstract class Smarty_CacheResource {
|
||||
* @param integer $exp_time expiration time (number of seconds, not timestamp)
|
||||
* @return integer number of cache files deleted
|
||||
*/
|
||||
public abstract function clearAll(Smarty $smarty, $exp_time=null);
|
||||
abstract public function clearAll(Smarty $smarty, $exp_time=null);
|
||||
|
||||
/**
|
||||
* Empty cache for a specific template
|
||||
@@ -98,8 +101,7 @@ abstract class Smarty_CacheResource {
|
||||
* @param integer $exp_time expiration time (number of seconds, not timestamp)
|
||||
* @return integer number of cache files deleted
|
||||
*/
|
||||
public abstract function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time);
|
||||
|
||||
abstract public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time);
|
||||
|
||||
public function locked(Smarty $smarty, Smarty_Template_Cached $cached)
|
||||
{
|
||||
@@ -114,6 +116,7 @@ abstract class Smarty_CacheResource {
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
return $hadLock;
|
||||
}
|
||||
|
||||
@@ -135,7 +138,6 @@ abstract class Smarty_CacheResource {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load Cache Resource Handler
|
||||
*
|
||||
@@ -165,6 +167,7 @@ abstract class Smarty_CacheResource {
|
||||
$cache_resource_class = 'Smarty_Internal_CacheResource_' . ucfirst($type);
|
||||
self::$resources[$type] = new $cache_resource_class();
|
||||
}
|
||||
|
||||
return $smarty->_cacheresource_handlers[$type] = self::$resources[$type];
|
||||
}
|
||||
// try plugins dir
|
||||
@@ -173,6 +176,7 @@ abstract class Smarty_CacheResource {
|
||||
if (!isset(self::$resources[$type])) {
|
||||
self::$resources[$type] = new $cache_resource_class();
|
||||
}
|
||||
|
||||
return $smarty->_cacheresource_handlers[$type] = self::$resources[$type];
|
||||
}
|
||||
// give up
|
||||
@@ -204,7 +208,8 @@ abstract class Smarty_CacheResource {
|
||||
* @subpackage TemplateResources
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
class Smarty_Template_Cached {
|
||||
class Smarty_Template_Cached
|
||||
{
|
||||
/**
|
||||
* Source Filepath
|
||||
* @var string
|
||||
@@ -300,6 +305,7 @@ class Smarty_Template_Cached {
|
||||
//
|
||||
if (!($_template->caching == Smarty::CACHING_LIFETIME_CURRENT || $_template->caching == Smarty::CACHING_LIFETIME_SAVED) || $_template->source->recompiled) {
|
||||
$handler->populate($this, $_template);
|
||||
|
||||
return;
|
||||
}
|
||||
while (true) {
|
||||
@@ -347,6 +353,7 @@ class Smarty_Template_Cached {
|
||||
}
|
||||
if (!$this->valid && $_template->smarty->cache_locking) {
|
||||
$this->handler->acquireLock($_template->smarty, $this);
|
||||
|
||||
return;
|
||||
} else {
|
||||
return;
|
||||
@@ -371,11 +378,12 @@ class Smarty_Template_Cached {
|
||||
if ($_template->smarty->cache_locking) {
|
||||
$this->handler->releaseLock($_template->smarty, $this);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@@ -13,8 +13,8 @@
|
||||
* @subpackage Cacher
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource {
|
||||
|
||||
abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
|
||||
{
|
||||
/**
|
||||
* fetch cached content and its modification time from data source
|
||||
*
|
||||
@@ -26,7 +26,7 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource {
|
||||
* @param integer $mtime cache modification timestamp (epoch)
|
||||
* @return void
|
||||
*/
|
||||
protected abstract function fetch($id, $name, $cache_id, $compile_id, &$content, &$mtime);
|
||||
abstract protected function fetch($id, $name, $cache_id, $compile_id, &$content, &$mtime);
|
||||
|
||||
/**
|
||||
* Fetch cached content's modification timestamp from data source
|
||||
@@ -56,7 +56,7 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource {
|
||||
* @param string $content content to cache
|
||||
* @return boolean success
|
||||
*/
|
||||
protected abstract function save($id, $name, $cache_id, $compile_id, $exp_time, $content);
|
||||
abstract protected function save($id, $name, $cache_id, $compile_id, $exp_time, $content);
|
||||
|
||||
/**
|
||||
* Delete content from cache
|
||||
@@ -67,7 +67,7 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource {
|
||||
* @param integer|null $exp_time seconds till expiration time in seconds or null
|
||||
* @return integer number of deleted caches
|
||||
*/
|
||||
protected abstract function delete($name, $cache_id, $compile_id, $exp_time);
|
||||
abstract protected function delete($name, $cache_id, $compile_id, $exp_time);
|
||||
|
||||
/**
|
||||
* populate Cached Object with meta data from Resource
|
||||
@@ -97,6 +97,7 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource {
|
||||
if ($mtime !== null) {
|
||||
$cached->timestamp = $mtime;
|
||||
$cached->exists = !!$cached->timestamp;
|
||||
|
||||
return;
|
||||
}
|
||||
$timestamp = null;
|
||||
@@ -132,8 +133,10 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource {
|
||||
if (isset($content)) {
|
||||
$_smarty_tpl = $_template;
|
||||
eval("?>" . $content);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -166,6 +169,7 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource {
|
||||
public function clearAll(Smarty $smarty, $exp_time=null)
|
||||
{
|
||||
$this->cache = array();
|
||||
|
||||
return $this->delete(null, null, null, $exp_time);
|
||||
}
|
||||
|
||||
@@ -182,6 +186,7 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource {
|
||||
public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
|
||||
{
|
||||
$this->cache = array();
|
||||
|
||||
return $this->delete($resource_name, $cache_id, $compile_id, $exp_time);
|
||||
}
|
||||
|
||||
@@ -234,4 +239,3 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource {
|
||||
$this->delete($name, null, null, null);
|
||||
}
|
||||
}
|
||||
?>
|
@@ -31,8 +31,8 @@
|
||||
* @subpackage Cacher
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource {
|
||||
|
||||
abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
|
||||
{
|
||||
/**
|
||||
* cache for contents
|
||||
* @var array
|
||||
@@ -99,8 +99,10 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource {
|
||||
if (isset($content)) {
|
||||
$_smarty_tpl = $_template;
|
||||
eval("?>" . $content);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -114,6 +116,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource {
|
||||
public function writeCachedContent(Smarty_Internal_Template $_template, $content)
|
||||
{
|
||||
$this->addMetaTimestamp($content);
|
||||
|
||||
return $this->write(array($_template->cached->filepath => $content), $_template->properties['cache_lifetime']);
|
||||
}
|
||||
|
||||
@@ -133,6 +136,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource {
|
||||
if (!$this->purge()) {
|
||||
$this->invalidate(null);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -157,6 +161,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource {
|
||||
$cid = $uid . '#' . $this->sanitize($resource_name) . '#' . $this->sanitize($cache_id) . '#' . $this->sanitize($compile_id);
|
||||
$this->delete(array($cid));
|
||||
$this->invalidate($cid, $resource_name, $cache_id, $compile_id, $uid);
|
||||
|
||||
return -1;
|
||||
}
|
||||
/**
|
||||
@@ -188,6 +193,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource {
|
||||
}
|
||||
unset($smarty->template_objects[$_templateId]);
|
||||
}
|
||||
|
||||
return $uid;
|
||||
}
|
||||
|
||||
@@ -204,6 +210,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource {
|
||||
if (!$string) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return preg_replace('#[^\w\|]+#S', '_', $string);
|
||||
}
|
||||
|
||||
@@ -261,6 +268,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource {
|
||||
$s = unpack("N", substr($content, 0, 4));
|
||||
$m = unpack("N", substr($content, 4, 4));
|
||||
$content = substr($content, 8);
|
||||
|
||||
return $s[1] + ($m[1] / 100000000);
|
||||
}
|
||||
|
||||
@@ -328,6 +336,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource {
|
||||
}
|
||||
// make sure we're dealing with floats
|
||||
$values = array_map('floatval', $values);
|
||||
|
||||
return max($values);
|
||||
}
|
||||
|
||||
@@ -380,6 +389,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource {
|
||||
// skip past delimiter position
|
||||
$i++;
|
||||
}
|
||||
|
||||
return $t;
|
||||
}
|
||||
|
||||
@@ -394,6 +404,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource {
|
||||
{
|
||||
$key = 'LOCK#' . $cached->filepath;
|
||||
$data = $this->read(array($key));
|
||||
|
||||
return $data && time() - $data[$key] < $smarty->locking_timeout;
|
||||
}
|
||||
|
||||
@@ -429,7 +440,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource {
|
||||
* @param array $keys list of keys to fetch
|
||||
* @return array list of values with the given keys used as indexes
|
||||
*/
|
||||
protected abstract function read(array $keys);
|
||||
abstract protected function read(array $keys);
|
||||
|
||||
/**
|
||||
* Save values for a set of keys to cache
|
||||
@@ -438,7 +449,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource {
|
||||
* @param int $expire expiration time
|
||||
* @return boolean true on success, false on failure
|
||||
*/
|
||||
protected abstract function write(array $keys, $expire=null);
|
||||
abstract protected function write(array $keys, $expire=null);
|
||||
|
||||
/**
|
||||
* Remove values from cache
|
||||
@@ -446,7 +457,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource {
|
||||
* @param array $keys list of keys to delete
|
||||
* @return boolean true on success, false on failure
|
||||
*/
|
||||
protected abstract function delete(array $keys);
|
||||
abstract protected function delete(array $keys);
|
||||
|
||||
/**
|
||||
* Remove *all* values from cache
|
||||
@@ -459,5 +470,3 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -19,8 +19,8 @@
|
||||
* @property int $timestamp
|
||||
* @property bool $exists
|
||||
*/
|
||||
class Smarty_Config_Source extends Smarty_Template_Source {
|
||||
|
||||
class Smarty_Config_Source extends Smarty_Template_Source
|
||||
{
|
||||
/**
|
||||
* create Config Object container
|
||||
*
|
||||
@@ -80,6 +80,7 @@ class Smarty_Config_Source extends Smarty_Template_Source {
|
||||
case 'timestamp':
|
||||
case 'exists':
|
||||
$this->handler->populateTimestamp($this);
|
||||
|
||||
return $this->$property_name;
|
||||
|
||||
case 'content':
|
||||
@@ -91,5 +92,3 @@ class Smarty_Config_Source extends Smarty_Template_Source {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -16,8 +16,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Cacher
|
||||
*/
|
||||
class Smarty_Internal_CacheResource_File extends Smarty_CacheResource {
|
||||
|
||||
class Smarty_Internal_CacheResource_File extends Smarty_CacheResource
|
||||
{
|
||||
/**
|
||||
* populate Cached Object with meta data from Resource
|
||||
*
|
||||
@@ -87,6 +87,7 @@
|
||||
public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached=null)
|
||||
{
|
||||
$_smarty_tpl = $_template;
|
||||
|
||||
return @include $_template->cached->filepath;
|
||||
}
|
||||
|
||||
@@ -106,6 +107,7 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -226,6 +228,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $_count;
|
||||
}
|
||||
|
||||
@@ -244,6 +247,7 @@
|
||||
clearstatcache();
|
||||
}
|
||||
$t = @filemtime($cached->lock_id);
|
||||
|
||||
return $t && (time() - $t < $smarty->locking_timeout);
|
||||
}
|
||||
|
||||
@@ -271,5 +275,3 @@
|
||||
@unlink($cached->lock_id);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Append extends Smarty_Internal_Compile_Assign {
|
||||
|
||||
class Smarty_Internal_Compile_Append extends Smarty_Internal_Compile_Assign
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {append} tag
|
||||
*
|
||||
@@ -49,5 +49,3 @@ class Smarty_Internal_Compile_Append extends Smarty_Internal_Compile_Assign {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {assign} tag
|
||||
*
|
||||
@@ -80,9 +80,8 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase {
|
||||
$output .= "\nSmarty::\$global_tpl_vars[$_attr[var]] = clone \$_smarty_tpl->tpl_vars[$_attr[var]];";
|
||||
}
|
||||
$output .= '?>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -16,8 +16,10 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
|
||||
class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase
|
||||
{
|
||||
|
||||
const parent = '____SMARTY_BLOCK_PARENT____';
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -32,7 +34,7 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
|
||||
* @var array
|
||||
* @see Smarty_Internal_CompileBase
|
||||
*/
|
||||
public $shorttag_order = array('name', 'hide');
|
||||
public $shorttag_order = array('name');
|
||||
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
@@ -40,7 +42,28 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
|
||||
* @var array
|
||||
* @see Smarty_Internal_CompileBase
|
||||
*/
|
||||
public $optional_attributes = array('hide');
|
||||
public $option_flags = array('hide', 'append', 'prepend', 'nocache');
|
||||
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
* @var array
|
||||
* @see Smarty_Internal_CompileBase
|
||||
*/
|
||||
public $optional_attributes = array('internal_file', 'internal_uid', 'internal_line');
|
||||
/**
|
||||
* nested child block names
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $nested_block_names = array();
|
||||
|
||||
/**
|
||||
* child block source buffer
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $block_data = array();
|
||||
|
||||
/**
|
||||
* Compiles code for the {block} tag
|
||||
@@ -49,158 +72,111 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
|
||||
* @param object $compiler compiler object
|
||||
* @return boolean true
|
||||
*/
|
||||
public function compile($args, $compiler) {
|
||||
public function compile($args, $compiler)
|
||||
{
|
||||
// check and get attributes
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
$save = array($_attr, $compiler->parser->current_buffer, $compiler->nocache, $compiler->smarty->merge_compiled_includes, $compiler->merged_templates, $compiler->smarty->merged_templates_func, $compiler->template->properties, $compiler->template->has_nocache_code);
|
||||
$this->openTag($compiler, 'block', $save);
|
||||
if ($_attr['nocache'] == true) {
|
||||
$compiler->nocache = true;
|
||||
$_name = trim($_attr['name'], "\"'");
|
||||
|
||||
// check if we process an inheritance child template
|
||||
if ($compiler->inheritance_child) {
|
||||
array_unshift(self::$nested_block_names, $_name);
|
||||
$this->template->block_data[$_name]['source'] = '';
|
||||
// build {block} for child block
|
||||
self::$block_data[$_name]['source'] =
|
||||
"{$compiler->smarty->left_delimiter}private_child_block name={$_attr['name']} file='{$compiler->template->source->filepath}'" .
|
||||
" uid='{$compiler->template->source->uid}' line={$compiler->lex->line}";
|
||||
if ($_attr['nocache']) {
|
||||
self::$block_data[$_name]['source'] .= ' nocache';
|
||||
}
|
||||
self::$block_data[$_name]['source'] .= $compiler->smarty->right_delimiter;
|
||||
|
||||
$save = array($_attr, $compiler->inheritance);
|
||||
$this->openTag($compiler, 'block', $save);
|
||||
// set flag for {block} tag
|
||||
$compiler->inheritance = true;
|
||||
$compiler->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBLOCK);
|
||||
$compiler->has_code = false;
|
||||
return;
|
||||
}
|
||||
// must merge includes
|
||||
$compiler->smarty->merge_compiled_includes = true;
|
||||
if ($_attr['nocache'] == true) {
|
||||
$compiler->tag_nocache = true;
|
||||
}
|
||||
$save = array($_attr, $compiler->inheritance, $compiler->parser->current_buffer, $compiler->nocache);
|
||||
$this->openTag($compiler, 'block', $save);
|
||||
$compiler->inheritance = true;
|
||||
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
|
||||
|
||||
$compiler->parser->current_buffer = new _smarty_template_buffer($compiler->parser);
|
||||
$compiler->has_code = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save or replace child block source by block name during parsing
|
||||
*
|
||||
* @param string $block_content block source content
|
||||
* @param string $block_tag opening block tag
|
||||
* @param object $template template object
|
||||
* @param string $filepath filepath of template source
|
||||
*/
|
||||
public static function saveBlockData($block_content, $block_tag, $template, $filepath) {
|
||||
$_rdl = preg_quote($template->smarty->right_delimiter);
|
||||
$_ldl = preg_quote($template->smarty->left_delimiter);
|
||||
if (!$template->smarty->auto_literal) {
|
||||
$al = '\s*';
|
||||
} else {
|
||||
$al = '';
|
||||
}
|
||||
if (0 == preg_match("!({$_ldl}{$al}block\s+)(name=)?(\w+|'.*'|\".*\")(\s*?)?((append|prepend|nocache)?(\s*)?(hide)?)?(\s*{$_rdl})!", $block_tag, $_match)) {
|
||||
$error_text = 'Syntax Error in template "' . $template->source->filepath . '" "' . $block_tag . '" illegal options';
|
||||
throw new SmartyCompilerException($error_text);
|
||||
} else {
|
||||
$_name = trim($_match[3], '\'"');
|
||||
if ($_match[8] != 'hide' || isset($template->block_data[$_name])) { // replace {$smarty.block.child}
|
||||
// get nested block tags
|
||||
if (0 != preg_match_all("!({$_ldl}{$al}block\s+)(name=)?(\w+|'.*'|\".*\")([\s\S]*?)(hide)?(\s*{$_rdl})([\s\S]*?)(.*)?({$_ldl}{$al}/block\s*{$_rdl})!", $block_content, $_match2)) {
|
||||
foreach ($_match2[3] as $key => $name) {
|
||||
// get it's replacement
|
||||
$_name2 = trim($name, '\'"');
|
||||
if ($_match2[5][$key] != 'hide' || isset($template->block_data[$_name2])) {
|
||||
if (isset($template->block_data[$_name2])) {
|
||||
$replacement = $template->block_data[$_name2]['source'];
|
||||
} else {
|
||||
$replacement = '';
|
||||
}
|
||||
// replace {$smarty.block.child} tag
|
||||
if (preg_match("!{$_ldl}{$al}\\\$smarty\.block\.child\s*{$_rdl}!",$_match2[7][$key])) {
|
||||
$replacement = preg_replace("!({$_ldl}{$al}\\\$smarty\.block\.child\s*{$_rdl})!", $replacement, $_match2[7][$key]);
|
||||
$block_content = preg_replace("!(({$_ldl}{$al}block)(.*)?{$name}(.*)?({$_rdl}[\s\S]*?{$_ldl}{$al}/block\s*{$_rdl}))!", $replacement, $block_content);
|
||||
}
|
||||
if (preg_match("!{$_ldl}{$al}\\\$smarty\.block\.child\s*{$_rdl}!",$_match2[8][$key])) {
|
||||
$replacement = preg_replace("!{$_ldl}{$al}\\\$smarty\.block\.child\s*{$_rdl}!", $replacement, $_match2[8][$key]);
|
||||
$block_content = preg_replace("!(({$_ldl}{$al}block)(.*)?{$name}(.*)?({$_rdl})(.*)?({$_ldl}{$al}/block\s*{$_rdl}))!", $replacement, $block_content);
|
||||
}
|
||||
} else {
|
||||
// remove hidden blocks
|
||||
$block_content = preg_replace("!(({$_ldl}{$al}block)(.*)?{$name}(.*)?({$_rdl}[\s\S]*?{$_ldl}{$al}/block\s*{$_rdl}))!", '', $block_content);
|
||||
}
|
||||
}
|
||||
}
|
||||
// do we have not nested {$smart.block.child}
|
||||
if (0 != preg_match("!({$_ldl}{$al}\\\$smarty\.block\.child\s*{$_rdl})!", $block_content, $_match2)) {
|
||||
// get child replacement for this block
|
||||
if (isset($template->block_data[$_name])) {
|
||||
$replacement = $template->block_data[$_name]['source'];
|
||||
unset($template->block_data[$_name]);
|
||||
} else {
|
||||
$replacement = '';
|
||||
}
|
||||
$block_content = preg_replace("!({$_ldl}{$al}\\\$smarty\.block\.child\s*{$_rdl})!", $replacement, $block_content);
|
||||
}
|
||||
if (isset($template->block_data[$_name])) {
|
||||
if (strpos($template->block_data[$_name]['source'], '%%%%SMARTY_PARENT%%%%') !== false) {
|
||||
$template->block_data[$_name]['source'] =
|
||||
str_replace('%%%%SMARTY_PARENT%%%%', $block_content, $template->block_data[$_name]['source']);
|
||||
} elseif ($template->block_data[$_name]['mode'] == 'prepend') {
|
||||
$template->block_data[$_name]['source'] .= $block_content;
|
||||
} elseif ($template->block_data[$_name]['mode'] == 'append') {
|
||||
$template->block_data[$_name]['source'] = $block_content . $template->block_data[$_name]['source'];
|
||||
}
|
||||
} else {
|
||||
$template->block_data[$_name]['source'] = $block_content;
|
||||
$template->block_data[$_name]['file'] = $filepath;
|
||||
}
|
||||
if ($_match[6] == 'append') {
|
||||
$template->block_data[$_name]['mode'] = 'append';
|
||||
} elseif ($_match[6] == 'prepend') {
|
||||
$template->block_data[$_name]['mode'] = 'prepend';
|
||||
} else {
|
||||
$template->block_data[$_name]['mode'] = 'replace';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile saved child block source
|
||||
*
|
||||
* @param object $compiler compiler object
|
||||
* @param string $_name optional name of child block
|
||||
* @return string compiled code of schild block
|
||||
* @return string compiled code of child block
|
||||
*/
|
||||
public static function compileChildBlock($compiler, $_name = null) {
|
||||
$_output = '';
|
||||
static function compileChildBlock($compiler, $_name = null)
|
||||
{
|
||||
if ($compiler->inheritance_child) {
|
||||
$name1 = Smarty_Internal_Compile_Block::$nested_block_names[0];
|
||||
if (isset($compiler->template->block_data[$name1])) {
|
||||
// replace inner block name with generic
|
||||
Smarty_Internal_Compile_Block::$block_data[$name1]['source'] .= $compiler->template->block_data[$name1]['source'];
|
||||
Smarty_Internal_Compile_Block::$block_data[$name1]['child'] = true;
|
||||
}
|
||||
$compiler->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBLOCK);
|
||||
$compiler->has_code = false;
|
||||
return;
|
||||
}
|
||||
// if called by {$smarty.block.child} we must search the name of enclosing {block}
|
||||
if ($_name == null) {
|
||||
$stack_count = count($compiler->_tag_stack);
|
||||
while (--$stack_count >= 0) {
|
||||
if ($compiler->_tag_stack[$stack_count][0] == 'block') {
|
||||
$_name = trim($compiler->_tag_stack[$stack_count][1][0]['name'], "'\"");
|
||||
$_name = trim($compiler->_tag_stack[$stack_count][1][0]['name'], "\"'");
|
||||
break;
|
||||
}
|
||||
}
|
||||
// flag that child is already compile by {$smarty.block.child} inclusion
|
||||
$compiler->template->block_data[$_name]['compiled'] = true;
|
||||
}
|
||||
if ($_name == null) {
|
||||
$compiler->trigger_template_error('{$smarty.block.child} used out of context', $compiler->lex->taglineno);
|
||||
$compiler->trigger_template_error(' tag {$smarty.block.child} used outside {block} tags ', $compiler->lex->taglineno);
|
||||
}
|
||||
// undefined child?
|
||||
if (!isset($compiler->template->block_data[$_name]['source'])) {
|
||||
$compiler->popTrace();
|
||||
return '';
|
||||
}
|
||||
// flag that child is already compile by {$smarty.block.child} inclusion
|
||||
$compiler->template->block_data[$_name]['compiled'] = true;
|
||||
$_tpl = new Smarty_Internal_template('string:' . $compiler->template->block_data[$_name]['source'], $compiler->smarty, $compiler->template, $compiler->template->cache_id,
|
||||
$compiler->template->compile_id, $compiler->template->caching, $compiler->template->cache_lifetime);
|
||||
if ($compiler->smarty->debugging) {
|
||||
Smarty_Internal_Debug::ignore($_tpl);
|
||||
}
|
||||
$_tpl->variable_filters = $compiler->template->variable_filters;
|
||||
$_tpl->properties['nocache_hash'] = $compiler->template->properties['nocache_hash'];
|
||||
$_tpl->source->filepath = $compiler->template->block_data[$_name]['file'];
|
||||
$_tpl->allow_relative_path = true;
|
||||
if ($compiler->nocache) {
|
||||
$_tpl->compiler->forceNocache = 2;
|
||||
} else {
|
||||
$_tpl->compiler->forceNocache = 1;
|
||||
}
|
||||
$_tpl->compiler->inheritance = true;
|
||||
$_tpl->compiler->suppressHeader = true;
|
||||
$_tpl->compiler->suppressFilter = true;
|
||||
$_tpl->compiler->suppressTemplatePropertyHeader = true;
|
||||
$_tpl->compiler->suppressMergedTemplates = true;
|
||||
if (strpos($compiler->template->block_data[$_name]['source'], '%%%%SMARTY_PARENT%%%%') !== false) {
|
||||
$_output = str_replace('%%%%SMARTY_PARENT%%%%', $compiler->parser->current_buffer->to_smarty_php(), $_tpl->compiler->compileTemplate($_tpl));
|
||||
$nocache = $compiler->nocache || $compiler->tag_nocache;
|
||||
if (strpos($compiler->template->block_data[$_name]['source'], self::parent) !== false) {
|
||||
$_output = str_replace(self::parent, $compiler->parser->current_buffer->to_smarty_php(), $_tpl->compiler->compileTemplate($_tpl, $nocache));
|
||||
} elseif ($compiler->template->block_data[$_name]['mode'] == 'prepend') {
|
||||
$_output = $_tpl->compiler->compileTemplate($_tpl) . $compiler->parser->current_buffer->to_smarty_php();
|
||||
$_output = $_tpl->compiler->compileTemplate($_tpl, $nocache) . $compiler->parser->current_buffer->to_smarty_php();
|
||||
} elseif ($compiler->template->block_data[$_name]['mode'] == 'append') {
|
||||
$_output = $compiler->parser->current_buffer->to_smarty_php() . $_tpl->compiler->compileTemplate($_tpl);
|
||||
$_output = $compiler->parser->current_buffer->to_smarty_php() . $_tpl->compiler->compileTemplate($_tpl, $nocache);
|
||||
} elseif (!empty($compiler->template->block_data[$_name])) {
|
||||
$_output = $_tpl->compiler->compileTemplate($_tpl);
|
||||
$_output = $_tpl->compiler->compileTemplate($_tpl, $nocache);
|
||||
}
|
||||
$compiler->template->properties['file_dependency'] = array_merge($compiler->template->properties['file_dependency'], $_tpl->properties['file_dependency']);
|
||||
$compiler->template->properties['function'] = array_merge($compiler->template->properties['function'], $_tpl->properties['function']);
|
||||
@@ -222,10 +198,54 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
|
||||
}
|
||||
}
|
||||
unset($_tpl);
|
||||
$compiler->has_code = true;
|
||||
return $_output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile $smarty.block.parent
|
||||
*
|
||||
* @param object $compiler compiler object
|
||||
* @param string $_name optional name of child block
|
||||
* @return string compiled code of schild block
|
||||
*/
|
||||
static function compileParentBlock($compiler, $_name = null)
|
||||
{
|
||||
// if called by {$smarty.block.parent} we must search the name of enclosing {block}
|
||||
if ($_name == null) {
|
||||
$stack_count = count($compiler->_tag_stack);
|
||||
while (--$stack_count >= 0) {
|
||||
if ($compiler->_tag_stack[$stack_count][0] == 'block') {
|
||||
$_name = trim($compiler->_tag_stack[$stack_count][1][0]['name'], "\"'");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($_name == null) {
|
||||
$compiler->trigger_template_error(' tag {$smarty.block.parent} used outside {block} tags ', $compiler->lex->taglineno);
|
||||
}
|
||||
if (empty(Smarty_Internal_Compile_Block::$nested_block_names)) {
|
||||
$compiler->trigger_template_error(' illegal {$smarty.block.parent} in parent template ', $compiler->lex->taglineno);
|
||||
}
|
||||
Smarty_Internal_Compile_Block::$block_data[Smarty_Internal_Compile_Block::$nested_block_names[0]]['source'] .= Smarty_Internal_Compile_Block::parent;
|
||||
$compiler->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBLOCK);
|
||||
$compiler->has_code = false;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process block source
|
||||
*
|
||||
* @param string $source source text
|
||||
* @return ''
|
||||
*/
|
||||
static function blockSource($compiler, $source)
|
||||
{
|
||||
Smarty_Internal_Compile_Block::$block_data[Smarty_Internal_Compile_Block::$nested_block_names[0]]['source'] .= $source;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Smarty Internal Plugin Compile BlockClose Class
|
||||
@@ -233,8 +253,8 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {/block} tag
|
||||
*
|
||||
@@ -242,25 +262,70 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase {
|
||||
* @param object $compiler compiler object
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, $compiler) {
|
||||
public function compile($args, $compiler)
|
||||
{
|
||||
$compiler->has_code = true;
|
||||
// check and get attributes
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
$saved_data = $this->closeTag($compiler, array('block'));
|
||||
$_name = trim($saved_data[0]['name'], "\"'");
|
||||
// reset flag for {block} tag
|
||||
$compiler->inheritance = $saved_data[1];
|
||||
// check if we process an inheritance child template
|
||||
if ($compiler->inheritance_child) {
|
||||
$name1 = Smarty_Internal_Compile_Block::$nested_block_names[0];
|
||||
Smarty_Internal_Compile_Block::$block_data[$name1]['source'] .= "{$compiler->smarty->left_delimiter}/private_child_block{$compiler->smarty->right_delimiter}";
|
||||
$level = count(Smarty_Internal_Compile_Block::$nested_block_names);
|
||||
array_shift(Smarty_Internal_Compile_Block::$nested_block_names);
|
||||
if (!empty(Smarty_Internal_Compile_Block::$nested_block_names)) {
|
||||
$name2 = Smarty_Internal_Compile_Block::$nested_block_names[0];
|
||||
if (isset($compiler->template->block_data[$name1]) || !$saved_data[0]['hide']) {
|
||||
if (isset(Smarty_Internal_Compile_Block::$block_data[$name1]['child']) || !isset($compiler->template->block_data[$name1])) {
|
||||
Smarty_Internal_Compile_Block::$block_data[$name2]['source'] .= Smarty_Internal_Compile_Block::$block_data[$name1]['source'];
|
||||
} else {
|
||||
if ($compiler->template->block_data[$name1]['mode'] == 'append') {
|
||||
Smarty_Internal_Compile_Block::$block_data[$name2]['source'] .= Smarty_Internal_Compile_Block::$block_data[$name1]['source'] . $compiler->template->block_data[$name1]['source'];
|
||||
} elseif ($compiler->template->block_data[$name1]['mode'] == 'prepend') {
|
||||
Smarty_Internal_Compile_Block::$block_data[$name2]['source'] .= $compiler->template->block_data[$name1]['source'] . Smarty_Internal_Compile_Block::$block_data[$name1]['source'];
|
||||
} else {
|
||||
Smarty_Internal_Compile_Block::$block_data[$name2]['source'] .= $compiler->template->block_data[$name1]['source'];
|
||||
}
|
||||
}
|
||||
}
|
||||
unset(Smarty_Internal_Compile_Block::$block_data[$name1]);
|
||||
$compiler->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBLOCK);
|
||||
} else {
|
||||
if (isset($compiler->template->block_data[$name1]) || !$saved_data[0]['hide']) {
|
||||
if (isset($compiler->template->block_data[$name1]) && !isset(Smarty_Internal_Compile_Block::$block_data[$name1]['child'])) {
|
||||
if (strpos($compiler->template->block_data[$name1]['source'], Smarty_Internal_Compile_Block::parent) !== false) {
|
||||
$compiler->template->block_data[$name1]['source'] =
|
||||
str_replace(Smarty_Internal_Compile_Block::parent, Smarty_Internal_Compile_Block::$block_data[$name1]['source'], $compiler->template->block_data[$name1]['source']);
|
||||
} elseif ($compiler->template->block_data[$name1]['mode'] == 'prepend') {
|
||||
$compiler->template->block_data[$name1]['source'] .= Smarty_Internal_Compile_Block::$block_data[$name1]['source'];
|
||||
} elseif ($compiler->template->block_data[$name1]['mode'] == 'append') {
|
||||
$compiler->template->block_data[$name1]['source'] = Smarty_Internal_Compile_Block::$block_data[$name1]['source'] . $compiler->template->block_data[$name1]['source'];
|
||||
}
|
||||
} else {
|
||||
$compiler->template->block_data[$name1]['source'] = Smarty_Internal_Compile_Block::$block_data[$name1]['source'];
|
||||
}
|
||||
$compiler->template->block_data[$name1]['mode'] = 'replace';
|
||||
if ($saved_data[0]['append']) {
|
||||
$compiler->template->block_data[$name1]['mode'] = 'append';
|
||||
}
|
||||
if ($saved_data[0]['prepend']) {
|
||||
$compiler->template->block_data[$name1]['mode'] = 'prepend';
|
||||
}
|
||||
}
|
||||
unset(Smarty_Internal_Compile_Block::$block_data[$name1]);
|
||||
$compiler->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBODY);
|
||||
}
|
||||
$compiler->has_code = false;
|
||||
return;
|
||||
}
|
||||
if (isset($compiler->template->block_data[$_name]) && !isset($compiler->template->block_data[$_name]['compiled'])) {
|
||||
// restore to status before {block} tag as new subtemplate code of parent {block} is not needed
|
||||
// TODO: Below code was disabled in 3.1.8 because of problems with {include} in nested {block} tags in child templates
|
||||
// combined with append/prepend or $smarty.block.parent
|
||||
// For later versions it should be checked under which conditions it could run for optimisation
|
||||
//
|
||||
//$compiler->merged_templates = $saved_data[4];
|
||||
//$compiler->smarty->merged_templates_func = $saved_data[5];
|
||||
//$compiler->template->properties = $saved_data[6];
|
||||
//$compiler->template->has_nocache_code = $saved_data[7];
|
||||
$_output = Smarty_Internal_Compile_Block::compileChildBlock($compiler, $_name);
|
||||
} else {
|
||||
if (isset($saved_data[0]['hide']) && !isset($compiler->template->block_data[$_name]['source'])) {
|
||||
if ($saved_data[0]['hide'] && !isset($compiler->template->block_data[$_name]['source'])) {
|
||||
$_output = '';
|
||||
} else {
|
||||
$_output = $compiler->parser->current_buffer->to_smarty_php();
|
||||
@@ -268,16 +333,96 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase {
|
||||
unset($compiler->template->block_data[$_name]['compiled']);
|
||||
}
|
||||
// reset flags
|
||||
$compiler->parser->current_buffer = $saved_data[1];
|
||||
$compiler->nocache = $saved_data[2];
|
||||
$compiler->smarty->merge_compiled_includes = $saved_data[3];
|
||||
// reset flag for {block} tag
|
||||
$compiler->inheritance = false;
|
||||
$compiler->parser->current_buffer = $saved_data[2];
|
||||
if ($compiler->nocache) {
|
||||
$compiler->tag_nocache = true;
|
||||
}
|
||||
$compiler->nocache = $saved_data[3];
|
||||
// $_output content has already nocache code processed
|
||||
$compiler->suppressNocacheProcessing = true;
|
||||
|
||||
return $_output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
/**
|
||||
* Smarty Internal Plugin Compile Child Block Class
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Private_Child_Block extends Smarty_Internal_CompileBase
|
||||
{
|
||||
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
* @var array
|
||||
* @see Smarty_Internal_CompileBase
|
||||
*/
|
||||
public $required_attributes = array('name', 'file', 'uid', 'line');
|
||||
|
||||
|
||||
/**
|
||||
* Compiles code for the {private_child_block} tag
|
||||
*
|
||||
* @param array $args array with attributes from parser
|
||||
* @param object $compiler compiler object
|
||||
* @return boolean true
|
||||
*/
|
||||
public function compile($args, $compiler)
|
||||
{
|
||||
// check and get attributes
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
|
||||
// must merge includes
|
||||
if ($_attr['nocache'] == true) {
|
||||
$compiler->tag_nocache = true;
|
||||
}
|
||||
$save = array($_attr, $compiler->nocache);
|
||||
|
||||
// set trace back to child block
|
||||
$compiler->pushTrace(trim($_attr['file'], "\"'"), trim($_attr['uid'], "\"'"), $_attr['line'] - $compiler->lex->line);
|
||||
|
||||
$this->openTag($compiler, 'private_child_block', $save);
|
||||
|
||||
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
|
||||
$compiler->has_code = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Smarty Internal Plugin Compile Child Block Close Class
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Private_Child_Blockclose extends Smarty_Internal_CompileBase
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Compiles code for the {/private_child_block} tag
|
||||
*
|
||||
* @param array $args array with attributes from parser
|
||||
* @param object $compiler compiler object
|
||||
* @return boolean true
|
||||
*/
|
||||
public function compile($args, $compiler)
|
||||
{
|
||||
// check and get attributes
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
|
||||
$saved_data = $this->closeTag($compiler, array('private_child_block'));
|
||||
|
||||
// end of child block
|
||||
$compiler->popTrace();
|
||||
|
||||
$compiler->nocache = $saved_data[1];
|
||||
$compiler->has_code = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -14,8 +14,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -68,10 +68,8 @@ class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase {
|
||||
if ($level_count != 0) {
|
||||
$compiler->trigger_template_error("cannot break {$_levels} level(s)", $compiler->lex->taglineno);
|
||||
}
|
||||
$compiler->has_code = true;
|
||||
|
||||
return "<?php break {$_levels}?>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -122,9 +122,8 @@ class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase {
|
||||
$_output = "<?php {$call_function}(\$_smarty_tpl,{$_params});?>\n";
|
||||
}
|
||||
}
|
||||
|
||||
return $_output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -64,8 +64,8 @@ class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase {
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {/capture} tag
|
||||
*
|
||||
@@ -90,9 +90,8 @@ class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase {
|
||||
$_output .= " if (isset( \$_capture_append)) \$_smarty_tpl->append( \$_capture_append, ob_get_contents());\n";
|
||||
$_output .= " Smarty::\$_smarty_vars['capture'][\$_capture_buffer]=ob_get_clean();\n";
|
||||
$_output .= "} else \$_smarty_tpl->capture_error();?>";
|
||||
|
||||
return $_output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -56,7 +56,6 @@ class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase {
|
||||
$compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);
|
||||
}
|
||||
|
||||
|
||||
// save posible attributes
|
||||
$conf_file = $_attr['file'];
|
||||
if (isset($_attr['section'])) {
|
||||
@@ -77,9 +76,8 @@ class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase {
|
||||
// create config object
|
||||
$_output = "<?php \$_config = new Smarty_Internal_Config($conf_file, \$_smarty_tpl->smarty, \$_smarty_tpl);";
|
||||
$_output .= "\$_config->loadConfigVars($section, '$scope'); ?>";
|
||||
|
||||
return $_output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Continue extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Continue extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -69,10 +69,8 @@ class Smarty_Internal_Compile_Continue extends Smarty_Internal_CompileBase {
|
||||
if ($level_count != 0) {
|
||||
$compiler->trigger_template_error("cannot continue {$_levels} level(s)", $compiler->lex->taglineno);
|
||||
}
|
||||
$compiler->has_code = true;
|
||||
|
||||
return "<?php continue {$_levels}?>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -16,8 +16,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Debug extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Debug extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {debug} tag
|
||||
*
|
||||
@@ -35,9 +35,8 @@ class Smarty_Internal_Compile_Debug extends Smarty_Internal_CompileBase {
|
||||
|
||||
// display debug template
|
||||
$_output = "<?php \$_smarty_tpl->smarty->loadPlugin('Smarty_Internal_Debug'); Smarty_Internal_Debug::display_debug(\$_smarty_tpl); ?>";
|
||||
|
||||
return $_output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -65,9 +65,8 @@ class Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase {
|
||||
} else {
|
||||
$_output .= "echo \$_template->fetch();";
|
||||
}
|
||||
|
||||
return "<?php $_output ?>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -16,8 +16,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Extends extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Extends extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -32,12 +32,6 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_CompileBase {
|
||||
* @see Smarty_Internal_CompileBase
|
||||
*/
|
||||
public $shorttag_order = array('file');
|
||||
/**
|
||||
* mbstring.overload flag
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $mbstring_overload = 0;
|
||||
|
||||
/**
|
||||
* Compiles code for the {extends} tag
|
||||
@@ -48,86 +42,46 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_CompileBase {
|
||||
*/
|
||||
public function compile($args, $compiler)
|
||||
{
|
||||
static $_is_stringy = array('string' => true, 'eval' => true);
|
||||
$this->_rdl = preg_quote($compiler->smarty->right_delimiter);
|
||||
$this->_ldl = preg_quote($compiler->smarty->left_delimiter);
|
||||
if (!$compiler->smarty->auto_literal) {
|
||||
$al = '\s*';
|
||||
} else {
|
||||
$al = '';
|
||||
}
|
||||
$filepath = $compiler->template->source->filepath;
|
||||
$this->mbstring_overload = ini_get('mbstring.func_overload') & 2;
|
||||
// check and get attributes
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
if ($_attr['nocache'] === true) {
|
||||
$compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);
|
||||
}
|
||||
|
||||
$_smarty_tpl = $compiler->template;
|
||||
$include_file = null;
|
||||
if (strpos($_attr['file'], '$_tmp') !== false) {
|
||||
$compiler->trigger_template_error('illegal value for file attribute', $compiler->lex->taglineno);
|
||||
}
|
||||
eval('$include_file = ' . $_attr['file'] . ';');
|
||||
// add tag to call parent template at the end of source
|
||||
|
||||
if ($compiler->has_variable_string || !((substr_count($_attr['file'], '"') == 2 || substr_count($_attr['file'], "'") == 2))
|
||||
|| substr_count($_attr['file'], '(') != 0 || substr_count($_attr['file'], '$_smarty_tpl->') != 0
|
||||
) {
|
||||
$compiler->trigger_template_error('variable template file name not allowed', $compiler->lex->taglineno);
|
||||
}
|
||||
|
||||
$name = trim($_attr['file'],"\"'");
|
||||
// create template object
|
||||
$_template = new $compiler->smarty->template_class($include_file, $compiler->smarty, $compiler->template);
|
||||
// save file dependency
|
||||
if (isset($_is_stringy[$_template->source->type])) {
|
||||
$template_sha1 = sha1($include_file);
|
||||
$_template = new $compiler->smarty->template_class($name, $compiler->smarty, $compiler->template);
|
||||
// check for recursion
|
||||
$uid = $_template->source->uid;
|
||||
if (isset($compiler->extends_uid[$uid])) {
|
||||
$compiler->trigger_template_error("illegal recursive call of \"$include_file\"", $this->lex->line - 1);
|
||||
}
|
||||
$compiler->extends_uid[$uid] = true;
|
||||
if (empty($_template->source->components)) {
|
||||
array_unshift($compiler->sources, $_template->source);
|
||||
} else {
|
||||
$template_sha1 = sha1($_template->source->filepath);
|
||||
foreach ($_template->source->components as $source) {
|
||||
array_unshift($compiler->sources, $source);
|
||||
$uid = $source->uid;
|
||||
if (isset($compiler->extends_uid[$uid])) {
|
||||
$compiler->trigger_template_error("illegal recursive call of \"{$sorce->filepath}\"", $this->lex->line - 1);
|
||||
}
|
||||
if (isset($compiler->template->properties['file_dependency'][$template_sha1])) {
|
||||
$compiler->trigger_template_error("illegal recursive call of \"{$include_file}\"", $compiler->lex->line - 1);
|
||||
}
|
||||
$compiler->template->properties['file_dependency'][$template_sha1] = array($_template->source->filepath, $_template->source->timestamp, $_template->source->type);
|
||||
$_content = ($this->mbstring_overload ? mb_substr($compiler->lex->data, $compiler->lex->counter - 1, 20000000, 'latin1') : substr($compiler->lex->data, $compiler->lex->counter - 1));
|
||||
if (preg_match_all("!({$this->_ldl}{$al}block\s(.+?)\s*{$this->_rdl})!", $_content, $s) !=
|
||||
preg_match_all("!({$this->_ldl}{$al}/block\s*{$this->_rdl})!", $_content, $c)) {
|
||||
$compiler->trigger_template_error('unmatched {block} {/block} pairs');
|
||||
}
|
||||
preg_match_all("!{$this->_ldl}{$al}block\s(.+?)\s*{$this->_rdl}|{$this->_ldl}{$al}/block\s*{$this->_rdl}|{$this->_ldl}\*([\S\s]*?)\*{$this->_rdl}!", $_content, $_result, PREG_OFFSET_CAPTURE);
|
||||
$_result_count = count($_result[0]);
|
||||
$_start = 0;
|
||||
while ($_start+1 < $_result_count) {
|
||||
$_end = 0;
|
||||
$_level = 1;
|
||||
if (($this->mbstring_overload ? mb_substr($_result[0][$_start][0],0,mb_strlen($compiler->smarty->left_delimiter,'latin1')+1, 'latin1') : substr($_result[0][$_start][0],0,strlen($compiler->smarty->left_delimiter)+1)) == $compiler->smarty->left_delimiter.'*') {
|
||||
$_start++;
|
||||
continue;
|
||||
}
|
||||
while ($_level != 0) {
|
||||
$_end++;
|
||||
if (($this->mbstring_overload ? mb_substr($_result[0][$_start + $_end][0],0,mb_strlen($compiler->smarty->left_delimiter,'latin1')+1, 'latin1') : substr($_result[0][$_start + $_end][0],0,strlen($compiler->smarty->left_delimiter)+1)) == $compiler->smarty->left_delimiter.'*') {
|
||||
continue;
|
||||
}
|
||||
if (!strpos($_result[0][$_start + $_end][0], '/')) {
|
||||
$_level++;
|
||||
} else {
|
||||
$_level--;
|
||||
$compiler->extends_uid[$uid] = true;
|
||||
}
|
||||
}
|
||||
$_block_content = str_replace($compiler->smarty->left_delimiter . '$smarty.block.parent' . $compiler->smarty->right_delimiter, '%%%%SMARTY_PARENT%%%%',
|
||||
($this->mbstring_overload ? mb_substr($_content, $_result[0][$_start][1] + mb_strlen($_result[0][$_start][0], 'latin1'), $_result[0][$_start + $_end][1] - $_result[0][$_start][1] - + mb_strlen($_result[0][$_start][0], 'latin1'), 'latin1') : substr($_content, $_result[0][$_start][1] + strlen($_result[0][$_start][0]), $_result[0][$_start + $_end][1] - $_result[0][$_start][1] - + strlen($_result[0][$_start][0]))));
|
||||
Smarty_Internal_Compile_Block::saveBlockData($_block_content, $_result[0][$_start][0], $compiler->template, $filepath);
|
||||
$_start = $_start + $_end + 1;
|
||||
}
|
||||
if ($_template->source->type == 'extends') {
|
||||
$_template->block_data = $compiler->template->block_data;
|
||||
}
|
||||
$compiler->template->source->content = $_template->source->content;
|
||||
if ($_template->source->type == 'extends') {
|
||||
$compiler->template->block_data = $_template->block_data;
|
||||
foreach ($_template->source->components as $key => $component) {
|
||||
$compiler->template->properties['file_dependency'][$key] = array($component->filepath, $component->timestamp, $component->type);
|
||||
}
|
||||
}
|
||||
$compiler->template->source->filepath = $_template->source->filepath;
|
||||
$compiler->abort_and_recompile = true;
|
||||
unset ($_template);
|
||||
$compiler->inheritance_child = true;
|
||||
$compiler->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBODY);
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {for} tag
|
||||
*
|
||||
@@ -90,8 +90,8 @@ class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase {
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Forelse extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Forelse extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {forelse} tag
|
||||
*
|
||||
@@ -107,6 +107,7 @@ class Smarty_Internal_Compile_Forelse extends Smarty_Internal_CompileBase {
|
||||
|
||||
list($openTag, $nocache) = $this->closeTag($compiler, array('for'));
|
||||
$this->openTag($compiler, 'forelse', array('forelse', $nocache));
|
||||
|
||||
return "<?php }} else { ?>";
|
||||
}
|
||||
|
||||
@@ -118,8 +119,8 @@ class Smarty_Internal_Compile_Forelse extends Smarty_Internal_CompileBase {
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Forclose extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Forclose extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {/for} tag
|
||||
*
|
||||
@@ -147,5 +148,3 @@ class Smarty_Internal_Compile_Forclose extends Smarty_Internal_CompileBase {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,7 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Foreach extends Smarty_Internal_CompileBase {
|
||||
class Smarty_Internal_Compile_Foreach extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -173,8 +174,8 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_CompileBase {
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Foreachelse extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Foreachelse extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {foreachelse} tag
|
||||
*
|
||||
@@ -202,8 +203,8 @@ class Smarty_Internal_Compile_Foreachelse extends Smarty_Internal_CompileBase {
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Foreachclose extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Foreachclose extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {/foreach} tag
|
||||
*
|
||||
@@ -227,5 +228,3 @@ class Smarty_Internal_Compile_Foreachclose extends Smarty_Internal_CompileBase {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -97,8 +97,8 @@ class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase {
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {/function} tag
|
||||
*
|
||||
@@ -158,9 +158,8 @@ foreach (Smarty::\$global_tpl_vars as \$key => \$value) if(!isset(\$_smarty_tpl-
|
||||
$compiler->parser->current_buffer = $saved_data[1];
|
||||
$compiler->template->has_nocache_code = $compiler->template->has_nocache_code | $saved_data[2];
|
||||
$compiler->template->required_plugins = $saved_data[3];
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {if} tag
|
||||
*
|
||||
@@ -56,6 +56,7 @@ class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase {
|
||||
$_output = "<?php if (!isset(\$_smarty_tpl->tpl_vars[".$parameter['if condition']['var']."])) \$_smarty_tpl->tpl_vars[".$parameter['if condition']['var']."] = new Smarty_Variable(null{$_nocache});";
|
||||
$_output .= "if (\$_smarty_tpl->tpl_vars[".$parameter['if condition']['var']."]->value = ".$parameter['if condition']['value'].") {?>";
|
||||
}
|
||||
|
||||
return $_output;
|
||||
} else {
|
||||
return "<?php if ({$parameter['if condition']}) {?>";
|
||||
@@ -70,8 +71,8 @@ class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase {
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Else extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Else extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {else} tag
|
||||
*
|
||||
@@ -96,8 +97,8 @@ class Smarty_Internal_Compile_Else extends Smarty_Internal_CompileBase {
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {elseif} tag
|
||||
*
|
||||
@@ -144,9 +145,11 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase {
|
||||
$_output = "<?php } else { if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "])) \$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "] = new Smarty_Variable(null{$_nocache});";
|
||||
$_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "]->value = " . $parameter['if condition']['value'] . ") {?>";
|
||||
}
|
||||
|
||||
return $_output;
|
||||
} else {
|
||||
$this->openTag($compiler, 'elseif', array($nesting, $compiler->tag_nocache));
|
||||
|
||||
return "<?php } elseif ({$parameter['if condition']}) {?>";
|
||||
}
|
||||
} else {
|
||||
@@ -163,6 +166,7 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase {
|
||||
$_output = "<?php } else {?>{$tmp}<?php if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "])) \$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "] = new Smarty_Variable(null{$_nocache});";
|
||||
$_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "]->value = " . $parameter['if condition']['value'] . ") {?>";
|
||||
}
|
||||
|
||||
return $_output;
|
||||
} else {
|
||||
return "<?php } else {?>{$tmp}<?php if ({$parameter['if condition']}) {?>";
|
||||
@@ -178,8 +182,8 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase {
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Ifclose extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Ifclose extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {/if} tag
|
||||
*
|
||||
@@ -199,9 +203,8 @@ class Smarty_Internal_Compile_Ifclose extends Smarty_Internal_CompileBase {
|
||||
for ($i = 0; $i < $nesting; $i++) {
|
||||
$tmp .= '}';
|
||||
}
|
||||
|
||||
return "<?php {$tmp}?>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* caching mode to create nocache code but no cache file
|
||||
*/
|
||||
@@ -81,12 +81,15 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
|
||||
$_parent_scope = Smarty::SCOPE_GLOBAL;
|
||||
}
|
||||
}
|
||||
$_caching = 'null';
|
||||
if ($compiler->nocache || $compiler->tag_nocache) {
|
||||
|
||||
$_caching = Smarty::CACHING_OFF;
|
||||
}
|
||||
// default for included templates
|
||||
if ($compiler->template->caching && !$compiler->nocache && !$compiler->tag_nocache) {
|
||||
|
||||
// flag if included template code should be merged into caller
|
||||
$merge_compiled_includes = ($compiler->smarty->merge_compiled_includes || $_attr['inline'] === true) && !$compiler->template->source->recompiled;
|
||||
|
||||
// set default when in nocache mode
|
||||
// if ($compiler->template->caching && ($compiler->nocache || $compiler->tag_nocache || $compiler->forceNocache == 2)) {
|
||||
if ($compiler->template->caching && ((!$compiler->inheritance && !$compiler->nocache && !$compiler->tag_nocache) || ($compiler->inheritance && ($compiler->nocache ||$compiler->tag_nocache)))) {
|
||||
$_caching = self::CACHING_NOCACHE_CODE;
|
||||
}
|
||||
/*
|
||||
@@ -118,32 +121,68 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
|
||||
}
|
||||
if ($_attr['nocache'] === true) {
|
||||
$compiler->tag_nocache = true;
|
||||
if ($merge_compiled_includes || $compiler->inheritance) {
|
||||
$_caching = self::CACHING_NOCACHE_CODE;
|
||||
} else {
|
||||
$_caching = Smarty::CACHING_OFF;
|
||||
}
|
||||
}
|
||||
|
||||
$has_compiled_template = false;
|
||||
if (($compiler->smarty->merge_compiled_includes || $_attr['inline'] === true) && !$compiler->template->source->recompiled
|
||||
&& !($compiler->template->caching && ($compiler->tag_nocache || $compiler->nocache)) && $_caching != Smarty::CACHING_LIFETIME_CURRENT) {
|
||||
// check if compiled code can be merged (contains no variable part)
|
||||
if (!$compiler->has_variable_string && (substr_count($include_file, '"') == 2 or substr_count($include_file, "'") == 2)
|
||||
and substr_count($include_file, '(') == 0 and substr_count($include_file, '$_smarty_tpl->') == 0) {
|
||||
if ($merge_compiled_includes || $compiler->inheritance) {
|
||||
// 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->inheritance) {
|
||||
$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))
|
||||
|| substr_count($_attr['compile_id'], '(') != 0 || substr_count($_attr['compile_id'], '$_smarty_tpl->') != 0
|
||||
) {
|
||||
$merge_compiled_includes = false;
|
||||
if ($compiler->inheritance) {
|
||||
$compiler->trigger_template_error(' variable compile_id not allow within {block} tags');
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($compiler->template->caching && ($compiler->tag_nocache || $compiler->nocache) && $_caching != self::CACHING_NOCACHE_CODE) {
|
||||
$merge_compiled_includes = false;
|
||||
if ($compiler->inheritance) {
|
||||
$compiler->trigger_template_error(' invalid caching mode of subtemplate within {block} tags');
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($merge_compiled_includes || $compiler->inheritance) {
|
||||
// we must observe different compile_id
|
||||
$uid = sha1($_compile_id);
|
||||
$tpl_name = null;
|
||||
$nocache = false;
|
||||
eval("\$tpl_name = $include_file;");
|
||||
if (!isset($compiler->smarty->merged_templates_func[$tpl_name]) || $compiler->inheritance) {
|
||||
if (!isset($compiler->smarty->merged_templates_func[$tpl_name][$uid]) || $compiler->inheritance) {
|
||||
$tpl = new $compiler->smarty->template_class ($tpl_name, $compiler->smarty, $compiler->template, $compiler->template->cache_id, $compiler->template->compile_id);
|
||||
// save unique function name
|
||||
$compiler->smarty->merged_templates_func[$tpl_name]['func'] = $tpl->properties['unifunc'] = 'content_'. str_replace('.', '_', uniqid('', true));
|
||||
$compiler->smarty->merged_templates_func[$tpl_name][$uid]['func'] = $tpl->properties['unifunc'] = 'content_' . str_replace('.', '_', uniqid('', true));
|
||||
// use current nocache hash for inlined code
|
||||
$compiler->smarty->merged_templates_func[$tpl_name]['nocache_hash'] = $tpl->properties['nocache_hash'] = $compiler->template->properties['nocache_hash'];
|
||||
if ($compiler->template->caching) {
|
||||
// needs code for cached page but no cache file
|
||||
$tpl->caching = self::CACHING_NOCACHE_CODE;
|
||||
$compiler->smarty->merged_templates_func[$tpl_name][$uid]['nocache_hash'] = $tpl->properties['nocache_hash'] = $compiler->template->properties['nocache_hash'];
|
||||
if ($compiler->template->caching && $_caching == self::CACHING_NOCACHE_CODE) {
|
||||
// all code must be nocache
|
||||
$nocache = true;
|
||||
}
|
||||
// make sure whole chain gest compiled
|
||||
if ($compiler->inheritance) {
|
||||
$tpl->compiler->inheritance = true;
|
||||
}
|
||||
// make sure whole chain gets compiled
|
||||
$tpl->mustCompile = true;
|
||||
if (!($tpl->source->uncompiled) && $tpl->source->exists) {
|
||||
|
||||
|
||||
// get compiled code
|
||||
$compiled_code = $tpl->compiler->compileTemplate($tpl);
|
||||
$compiled_code = $tpl->compiler->compileTemplate($tpl, $nocache);
|
||||
// release compiler object to free memory
|
||||
unset($tpl->compiler);
|
||||
// merge compiled code for {function} tags
|
||||
@@ -160,12 +199,12 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
|
||||
}
|
||||
$compiler->merged_templates[$tpl->properties['unifunc']] = $compiled_code;
|
||||
$has_compiled_template = true;
|
||||
unset ($tpl);
|
||||
}
|
||||
} else {
|
||||
$has_compiled_template = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// delete {include} standard attributes
|
||||
unset($_attr['file'], $_attr['assign'], $_attr['cache_id'], $_attr['compile_id'], $_attr['cache_lifetime'], $_attr['nocache'], $_attr['caching'], $_attr['scope'], $_attr['inline']);
|
||||
// remaining attributes must be assigned as smarty variable
|
||||
@@ -185,19 +224,22 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
|
||||
$_has_vars = false;
|
||||
}
|
||||
if ($has_compiled_template) {
|
||||
$_hash = $compiler->smarty->merged_templates_func[$tpl_name]['nocache_hash'];
|
||||
// never call inline templates in nocache mode
|
||||
$compiler->suppressNocacheProcessing = true;
|
||||
$_hash = $compiler->smarty->merged_templates_func[$tpl_name][$uid]['nocache_hash'];
|
||||
$_output = "<?php /* Call merged included template \"" . $tpl_name . "\" */\n";
|
||||
$_output .= "\$_tpl_stack[] = \$_smarty_tpl;\n";
|
||||
$_output .= " \$_smarty_tpl = \$_smarty_tpl->setupInlineSubTemplate($include_file, $_cache_id, $_compile_id, $_caching, $_cache_lifetime, $_vars, $_parent_scope, '$_hash');\n";
|
||||
if (isset($_assign)) {
|
||||
$_output .= 'ob_start(); ';
|
||||
}
|
||||
$_output .= $compiler->smarty->merged_templates_func[$tpl_name]['func']. "(\$_smarty_tpl);\n";
|
||||
$_output .= $compiler->smarty->merged_templates_func[$tpl_name][$uid]['func'] . "(\$_smarty_tpl);\n";
|
||||
$_output .= "\$_smarty_tpl = array_pop(\$_tpl_stack); ";
|
||||
if (isset($_assign)) {
|
||||
$_output .= " \$_smarty_tpl->tpl_vars[$_assign] = new Smarty_variable(ob_get_clean());";
|
||||
}
|
||||
$_output .= "/* End of included template \"" . $tpl_name . "\" */?>";
|
||||
$_output .= "\n/* End of included template \"" . $tpl_name . "\" */?>";
|
||||
|
||||
return $_output;
|
||||
}
|
||||
|
||||
@@ -207,9 +249,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
|
||||
} else {
|
||||
$_output = "<?php echo \$_smarty_tpl->getSubTemplate ($include_file, $_cache_id, $_compile_id, $_caching, $_cache_lifetime, $_vars, $_parent_scope);?>\n";
|
||||
}
|
||||
|
||||
return $_output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -104,5 +104,3 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -16,8 +16,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -134,9 +134,8 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase {
|
||||
$_output .= "echo {$_function}({$_params},\$_smarty_tpl);?>";
|
||||
}
|
||||
}
|
||||
|
||||
return $_output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Ldelim extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Ldelim extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {ldelim} tag
|
||||
*
|
||||
@@ -33,9 +33,8 @@ class Smarty_Internal_Compile_Ldelim extends Smarty_Internal_CompileBase {
|
||||
}
|
||||
// this tag does not return compiled code
|
||||
$compiler->has_code = true;
|
||||
|
||||
return $compiler->smarty->left_delimiter;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Nocache extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Nocache extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {nocache} tag
|
||||
*
|
||||
@@ -32,10 +32,14 @@ class Smarty_Internal_Compile_Nocache extends Smarty_Internal_CompileBase {
|
||||
if ($_attr['nocache'] === true) {
|
||||
$compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);
|
||||
}
|
||||
if ($compiler->template->caching) {
|
||||
// enter nocache mode
|
||||
$this->openTag($compiler, 'nocache', $compiler->nocache);
|
||||
$compiler->nocache = true;
|
||||
}
|
||||
// this tag does not return compiled code
|
||||
$compiler->has_code = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -47,8 +51,8 @@ class Smarty_Internal_Compile_Nocache extends Smarty_Internal_CompileBase {
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Nocacheclose extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Nocacheclose extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {/nocache} tag
|
||||
*
|
||||
@@ -61,13 +65,14 @@ class Smarty_Internal_Compile_Nocacheclose extends Smarty_Internal_CompileBase {
|
||||
public function compile($args, $compiler)
|
||||
{
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
// leave nocache mode
|
||||
$compiler->nocache = false;
|
||||
if ($compiler->template->caching) {
|
||||
// restore old nocache mode
|
||||
$compiler->nocache = $this->closeTag($compiler, 'nocache');
|
||||
}
|
||||
// this tag does not return compiled code
|
||||
$compiler->has_code = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -79,9 +79,8 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi
|
||||
}
|
||||
$output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false;".$mod_pre." echo {$function}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); ".$mod_post." } array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
|
||||
}
|
||||
|
||||
return $output . "\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -65,9 +65,8 @@ class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_Co
|
||||
$_params = 'array(' . implode(",", $_paramsArray) . ')';
|
||||
// compile code
|
||||
$output = "<?php echo {$function}({$_params},\$_smarty_tpl);?>\n";
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -16,8 +16,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for modifier execution
|
||||
*
|
||||
@@ -26,7 +26,8 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
|
||||
* @param array $parameter array with compilation parameter
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, $compiler, $parameter) {
|
||||
public function compile($args, $compiler, $parameter)
|
||||
{
|
||||
// check and get attributes
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
$output = $parameter['value'];
|
||||
@@ -132,9 +133,8 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa
|
||||
$compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", $compiler->lex->taglineno);
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Private_Object_Block_Function extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Private_Object_Block_Function extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -80,9 +80,8 @@ class Smarty_Internal_Compile_Private_Object_Block_Function extends Smarty_Inter
|
||||
}
|
||||
$output = "<?php \$_block_content = ob_get_contents(); ob_end_clean(); \$_block_repeat=false;" . $mod_pre . " echo \$_smarty_tpl->smarty->registered_objects['{$base_tag}'][0]->{$method}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); " . $mod_post . " } array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
|
||||
}
|
||||
|
||||
return $output . "\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -48,6 +48,8 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co
|
||||
$_assign = $_attr['assign'];
|
||||
unset($_attr['assign']);
|
||||
}
|
||||
// method or property ?
|
||||
if (method_exists($compiler->smarty->registered_objects[$tag][0], $method)) {
|
||||
// convert attributes into parameter array string
|
||||
if ($compiler->smarty->registered_objects[$tag][2]) {
|
||||
$_paramsArray = array();
|
||||
@@ -64,6 +66,11 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co
|
||||
$_params = implode(",", $_attr);
|
||||
$return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params})";
|
||||
}
|
||||
} else {
|
||||
// object property
|
||||
$return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}";
|
||||
}
|
||||
|
||||
if (empty($_assign)) {
|
||||
// This tag does create output
|
||||
$compiler->has_output = true;
|
||||
@@ -71,9 +78,8 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co
|
||||
} else {
|
||||
$output = "<?php \$_smarty_tpl->assign({$_assign},{$return});?>\n";
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -91,7 +91,7 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C
|
||||
if (!is_array($function)) {
|
||||
$output = "{$function}({$output},\$_smarty_tpl)";
|
||||
} elseif (is_object($function[0])) {
|
||||
$output = "\$_smarty_tpl->smarty->registered_filters[Smarty::FILTER_VARIABLE][{$key}][0]->{$function[1]}({$output},\$_smarty_tpl)";
|
||||
$output = "\$_smarty_tpl->smarty->registered_filters[Smarty::FILTER_VARIABLE]['{$key}'][0]->{$function[1]}({$output},\$_smarty_tpl)";
|
||||
} else {
|
||||
$output = "{$function[0]}::{$function[1]}({$output},\$_smarty_tpl)";
|
||||
}
|
||||
@@ -123,6 +123,7 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C
|
||||
$compiler->has_output = true;
|
||||
$output = "<?php echo {$output};?>";
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
@@ -148,9 +149,8 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C
|
||||
// not found
|
||||
return false;
|
||||
}
|
||||
|
||||
return "{$plugin_name}({$output},\$_smarty_tpl)";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Private_Registered_Block extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Private_Registered_Block extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -105,9 +105,8 @@ class Smarty_Internal_Compile_Private_Registered_Block extends Smarty_Internal_C
|
||||
$output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false;".$mod_pre." echo {$function[0]}::{$function[1]}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); ".$mod_post."} array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
|
||||
}
|
||||
}
|
||||
|
||||
return $output . "\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -73,9 +73,8 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna
|
||||
} else {
|
||||
$output = "<?php echo {$function[0]}::{$function[1]}({$_params},\$_smarty_tpl);?>\n";
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the speical $smarty variables
|
||||
*
|
||||
@@ -70,6 +70,7 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C
|
||||
|
||||
case 'version':
|
||||
$_version = Smarty::SMARTY_VERSION;
|
||||
|
||||
return "'$_version'";
|
||||
|
||||
case 'const':
|
||||
@@ -77,6 +78,7 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C
|
||||
$compiler->trigger_template_error("(secure mode) constants not permitted");
|
||||
break;
|
||||
}
|
||||
|
||||
return "@constant({$_index[1]})";
|
||||
|
||||
case 'config':
|
||||
@@ -87,10 +89,12 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C
|
||||
}
|
||||
case 'ldelim':
|
||||
$_ldelim = $compiler->smarty->left_delimiter;
|
||||
|
||||
return "'$_ldelim'";
|
||||
|
||||
case 'rdelim':
|
||||
$_rdelim = $compiler->smarty->right_delimiter;
|
||||
|
||||
return "'$_rdelim'";
|
||||
|
||||
default:
|
||||
@@ -103,9 +107,8 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C
|
||||
$compiled_ref = $compiled_ref . "[$_ind]";
|
||||
}
|
||||
}
|
||||
|
||||
return $compiled_ref;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -14,8 +14,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Rdelim extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Rdelim extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {rdelim} tag
|
||||
*
|
||||
@@ -33,9 +33,8 @@ class Smarty_Internal_Compile_Rdelim extends Smarty_Internal_CompileBase {
|
||||
}
|
||||
// this tag does not return compiled code
|
||||
$compiler->has_code = true;
|
||||
|
||||
return $compiler->smarty->right_delimiter;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Section extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Section extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -131,6 +131,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_CompileBase {
|
||||
$output .= "{$section_props}['last'] = ({$section_props}['iteration'] == {$section_props}['total']);\n";
|
||||
|
||||
$output .= "?>";
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
@@ -142,8 +143,8 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_CompileBase {
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Sectionelse extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Sectionelse extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {sectionelse} tag
|
||||
*
|
||||
@@ -170,8 +171,8 @@ class Smarty_Internal_Compile_Sectionelse extends Smarty_Internal_CompileBase {
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Sectionclose extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Sectionclose extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {/section} tag
|
||||
*
|
||||
@@ -199,5 +200,3 @@ class Smarty_Internal_Compile_Sectionclose extends Smarty_Internal_CompileBase {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Setfilter extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Setfilter extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for setfilter tag
|
||||
*
|
||||
@@ -31,6 +31,7 @@ class Smarty_Internal_Compile_Setfilter extends Smarty_Internal_CompileBase {
|
||||
$compiler->template->variable_filters = $parameter['modifier_list'];
|
||||
// this tag does not return compiled code
|
||||
$compiler->has_code = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -42,8 +43,8 @@ class Smarty_Internal_Compile_Setfilter extends Smarty_Internal_CompileBase {
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Setfilterclose extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Setfilterclose extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {/setfilter} tag
|
||||
*
|
||||
@@ -64,9 +65,8 @@ class Smarty_Internal_Compile_Setfilterclose extends Smarty_Internal_CompileBase
|
||||
}
|
||||
// this tag does not return compiled code
|
||||
$compiler->has_code = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {while} tag
|
||||
*
|
||||
@@ -56,6 +56,7 @@ class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase {
|
||||
$_output = "<?php if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "])) \$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "] = new Smarty_Variable(null{$_nocache});";
|
||||
$_output .= "while (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "]->value = " . $parameter['if condition']['value'] . ") {?>";
|
||||
}
|
||||
|
||||
return $_output;
|
||||
} else {
|
||||
return "<?php while ({$parameter['if condition']}) {?>";
|
||||
@@ -70,8 +71,8 @@ class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase {
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Whileclose extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Whileclose extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Compiles code for the {/while} tag
|
||||
*
|
||||
@@ -86,9 +87,8 @@ class Smarty_Internal_Compile_Whileclose extends Smarty_Internal_CompileBase {
|
||||
$compiler->tag_nocache = true;
|
||||
}
|
||||
$compiler->nocache = $this->closeTag($compiler, array('while'));
|
||||
|
||||
return "<?php }?>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -13,8 +13,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
abstract class Smarty_Internal_CompileBase {
|
||||
|
||||
abstract class Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Array of names of required attribute required by tag
|
||||
*
|
||||
@@ -163,14 +163,14 @@ abstract class Smarty_Internal_CompileBase {
|
||||
}
|
||||
}
|
||||
// wrong nesting of tags
|
||||
$compiler->trigger_template_error("unclosed {" . $_openTag . "} tag");
|
||||
$compiler->trigger_template_error("unclosed {$compiler->smarty->left_delimiter}" . $_openTag . "{$compiler->smarty->right_delimiter} tag");
|
||||
|
||||
return;
|
||||
}
|
||||
// wrong nesting of tags
|
||||
$compiler->trigger_template_error("unexpected closing tag", $compiler->lex->taglineno);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -19,8 +19,8 @@
|
||||
* @property Smarty_Config_Compiled $compiled
|
||||
* @ignore
|
||||
*/
|
||||
class Smarty_Internal_Config {
|
||||
|
||||
class Smarty_Internal_Config
|
||||
{
|
||||
/**
|
||||
* Samrty instance
|
||||
*
|
||||
@@ -104,7 +104,7 @@ class Smarty_Internal_Config {
|
||||
$_compile_id = isset($this->smarty->compile_id) ? preg_replace('![^\w\|]+!', '_', $this->smarty->compile_id) : null;
|
||||
$_flag = (int) $this->smarty->config_read_hidden + (int) $this->smarty->config_booleanize * 2
|
||||
+ (int) $this->smarty->config_overwrite * 4;
|
||||
$_filepath = sha1($this->source->name . $_flag);
|
||||
$_filepath = sha1($this->source->filepath . $_flag);
|
||||
// if use_sub_dirs, break file into directories
|
||||
if ($this->smarty->use_sub_dirs) {
|
||||
$_filepath = substr($_filepath, 0, 2) . DS
|
||||
@@ -117,6 +117,7 @@ class Smarty_Internal_Config {
|
||||
$_filepath = $_compile_id . $_compile_dir_sep . $_filepath;
|
||||
}
|
||||
$_compile_dir = $this->smarty->getCompileDir();
|
||||
|
||||
return $_compile_dir . $_filepath . '.' . basename($this->source->name) . '.config' . '.php';
|
||||
}
|
||||
|
||||
@@ -163,6 +164,7 @@ class Smarty_Internal_Config {
|
||||
$this->compiled_config = file_get_contents($this->getCompiledFilepath());
|
||||
}
|
||||
}
|
||||
|
||||
return $this->compiled_config;
|
||||
}
|
||||
|
||||
@@ -267,6 +269,7 @@ class Smarty_Internal_Config {
|
||||
case 'source':
|
||||
case 'compiled':
|
||||
$this->$property_name = $value;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -287,10 +290,12 @@ class Smarty_Internal_Config {
|
||||
throw new SmartyException("Unable to parse resource name \"{$this->config_resource}\"");
|
||||
}
|
||||
$this->source = Smarty_Resource::config($this);
|
||||
|
||||
return $this->source;
|
||||
|
||||
case 'compiled':
|
||||
$this->compiled = $this->source->getCompiled($this);
|
||||
|
||||
return $this->compiled;
|
||||
}
|
||||
|
||||
@@ -298,5 +303,3 @@ class Smarty_Internal_Config {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -16,8 +16,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Config
|
||||
*/
|
||||
class Smarty_Internal_Config_File_Compiler {
|
||||
|
||||
class Smarty_Internal_Config_File_Compiler
|
||||
{
|
||||
/**
|
||||
* Lexer object
|
||||
*
|
||||
@@ -140,5 +140,3 @@ class Smarty_Internal_Config_File_Compiler {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -23,8 +23,7 @@ class Smarty_Internal_Configfilelexer
|
||||
public $smarty_token_names = array ( // Text for parser error messages
|
||||
);
|
||||
|
||||
|
||||
function __construct($data, $smarty)
|
||||
public function __construct($data, $smarty)
|
||||
{
|
||||
// set instance object
|
||||
self::instance($this);
|
||||
@@ -39,39 +38,35 @@ class Smarty_Internal_Configfilelexer
|
||||
static $instance = null;
|
||||
if (isset($new_instance) && is_object($new_instance))
|
||||
$instance = $new_instance;
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private $_yy_state = 1;
|
||||
private $_yy_stack = array();
|
||||
|
||||
function yylex()
|
||||
public function yylex()
|
||||
{
|
||||
return $this->{'yylex' . $this->_yy_state}();
|
||||
}
|
||||
|
||||
function yypushstate($state)
|
||||
public function yypushstate($state)
|
||||
{
|
||||
array_push($this->_yy_stack, $this->_yy_state);
|
||||
$this->_yy_state = $state;
|
||||
}
|
||||
|
||||
function yypopstate()
|
||||
public function yypopstate()
|
||||
{
|
||||
$this->_yy_state = array_pop($this->_yy_stack);
|
||||
}
|
||||
|
||||
function yybegin($state)
|
||||
public function yybegin($state)
|
||||
{
|
||||
$this->_yy_state = $state;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function yylex1()
|
||||
public function yylex1()
|
||||
{
|
||||
$tokenMap = array (
|
||||
1 => 0,
|
||||
@@ -134,55 +129,51 @@ class Smarty_Internal_Configfilelexer
|
||||
|
||||
} // end function
|
||||
|
||||
|
||||
const START = 1;
|
||||
function yy_r1_1($yy_subpatterns)
|
||||
public function yy_r1_1($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART;
|
||||
$this->yypushstate(self::COMMENT);
|
||||
}
|
||||
function yy_r1_2($yy_subpatterns)
|
||||
public function yy_r1_2($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_OPENB;
|
||||
$this->yypushstate(self::SECTION);
|
||||
}
|
||||
function yy_r1_3($yy_subpatterns)
|
||||
public function yy_r1_3($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB;
|
||||
}
|
||||
function yy_r1_4($yy_subpatterns)
|
||||
public function yy_r1_4($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_EQUAL;
|
||||
$this->yypushstate(self::VALUE);
|
||||
}
|
||||
function yy_r1_5($yy_subpatterns)
|
||||
public function yy_r1_5($yy_subpatterns)
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
function yy_r1_6($yy_subpatterns)
|
||||
public function yy_r1_6($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
|
||||
}
|
||||
function yy_r1_7($yy_subpatterns)
|
||||
public function yy_r1_7($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_ID;
|
||||
}
|
||||
function yy_r1_8($yy_subpatterns)
|
||||
public function yy_r1_8($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_OTHER;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function yylex2()
|
||||
public function yylex2()
|
||||
{
|
||||
$tokenMap = array (
|
||||
1 => 0,
|
||||
@@ -246,62 +237,61 @@ class Smarty_Internal_Configfilelexer
|
||||
|
||||
} // end function
|
||||
|
||||
|
||||
const VALUE = 2;
|
||||
function yy_r2_1($yy_subpatterns)
|
||||
public function yy_r2_1($yy_subpatterns)
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
function yy_r2_2($yy_subpatterns)
|
||||
public function yy_r2_2($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_FLOAT;
|
||||
$this->yypopstate();
|
||||
}
|
||||
function yy_r2_3($yy_subpatterns)
|
||||
public function yy_r2_3($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_INT;
|
||||
$this->yypopstate();
|
||||
}
|
||||
function yy_r2_4($yy_subpatterns)
|
||||
public function yy_r2_4($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES;
|
||||
$this->yypushstate(self::TRIPPLE);
|
||||
}
|
||||
function yy_r2_5($yy_subpatterns)
|
||||
public function yy_r2_5($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING;
|
||||
$this->yypopstate();
|
||||
}
|
||||
function yy_r2_6($yy_subpatterns)
|
||||
public function yy_r2_6($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING;
|
||||
$this->yypopstate();
|
||||
}
|
||||
function yy_r2_7($yy_subpatterns)
|
||||
public function yy_r2_7($yy_subpatterns)
|
||||
{
|
||||
|
||||
if (!$this->smarty->config_booleanize || !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
|
||||
} else {
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_BOOL;
|
||||
$this->yypopstate();
|
||||
}
|
||||
}
|
||||
function yy_r2_8($yy_subpatterns)
|
||||
public function yy_r2_8($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
|
||||
$this->yypopstate();
|
||||
}
|
||||
function yy_r2_9($yy_subpatterns)
|
||||
public function yy_r2_9($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
|
||||
@@ -309,9 +299,7 @@ class Smarty_Internal_Configfilelexer
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function yylex3()
|
||||
public function yylex3()
|
||||
{
|
||||
$tokenMap = array (
|
||||
1 => 0,
|
||||
@@ -367,18 +355,15 @@ class Smarty_Internal_Configfilelexer
|
||||
|
||||
} // end function
|
||||
|
||||
|
||||
const NAKED_STRING_VALUE = 3;
|
||||
function yy_r3_1($yy_subpatterns)
|
||||
public function yy_r3_1($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function yylex4()
|
||||
public function yylex4()
|
||||
{
|
||||
$tokenMap = array (
|
||||
1 => 0,
|
||||
@@ -436,28 +421,24 @@ class Smarty_Internal_Configfilelexer
|
||||
|
||||
} // end function
|
||||
|
||||
|
||||
const COMMENT = 4;
|
||||
function yy_r4_1($yy_subpatterns)
|
||||
public function yy_r4_1($yy_subpatterns)
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
function yy_r4_2($yy_subpatterns)
|
||||
public function yy_r4_2($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
|
||||
}
|
||||
function yy_r4_3($yy_subpatterns)
|
||||
public function yy_r4_3($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function yylex5()
|
||||
public function yylex5()
|
||||
{
|
||||
$tokenMap = array (
|
||||
1 => 0,
|
||||
@@ -514,22 +495,20 @@ class Smarty_Internal_Configfilelexer
|
||||
|
||||
} // end function
|
||||
|
||||
|
||||
const SECTION = 5;
|
||||
function yy_r5_1($yy_subpatterns)
|
||||
public function yy_r5_1($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_DOT;
|
||||
}
|
||||
function yy_r5_2($yy_subpatterns)
|
||||
public function yy_r5_2($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_SECTION;
|
||||
$this->yypopstate();
|
||||
}
|
||||
|
||||
|
||||
function yylex6()
|
||||
public function yylex6()
|
||||
{
|
||||
$tokenMap = array (
|
||||
1 => 0,
|
||||
@@ -586,16 +565,15 @@ class Smarty_Internal_Configfilelexer
|
||||
|
||||
} // end function
|
||||
|
||||
|
||||
const TRIPPLE = 6;
|
||||
function yy_r6_1($yy_subpatterns)
|
||||
public function yy_r6_1($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END;
|
||||
$this->yypopstate();
|
||||
$this->yypushstate(self::START);
|
||||
}
|
||||
function yy_r6_2($yy_subpatterns)
|
||||
public function yy_r6_2($yy_subpatterns)
|
||||
{
|
||||
|
||||
if ($this->mbstring_overload) {
|
||||
@@ -617,6 +595,4 @@ class Smarty_Internal_Configfilelexer
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
@@ -14,7 +14,7 @@ class TPC_yyToken implements ArrayAccess
|
||||
public $string = '';
|
||||
public $metadata = array();
|
||||
|
||||
function __construct($s, $m = array())
|
||||
public function __construct($s, $m = array())
|
||||
{
|
||||
if ($s instanceof TPC_yyToken) {
|
||||
$this->string = $s->string;
|
||||
@@ -29,28 +29,29 @@ class TPC_yyToken implements ArrayAccess
|
||||
}
|
||||
}
|
||||
|
||||
function __toString()
|
||||
public function __toString()
|
||||
{
|
||||
return $this->_string;
|
||||
}
|
||||
|
||||
function offsetExists($offset)
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->metadata[$offset]);
|
||||
}
|
||||
|
||||
function offsetGet($offset)
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->metadata[$offset];
|
||||
}
|
||||
|
||||
function offsetSet($offset, $value)
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
if ($offset === null) {
|
||||
if (isset($value[0])) {
|
||||
$x = ($value instanceof TPC_yyToken) ?
|
||||
$value->metadata : $value;
|
||||
$this->metadata = array_merge($this->metadata, $x);
|
||||
|
||||
return;
|
||||
}
|
||||
$offset = count($this->metadata);
|
||||
@@ -67,7 +68,7 @@ class TPC_yyToken implements ArrayAccess
|
||||
}
|
||||
}
|
||||
|
||||
function offsetUnset($offset)
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->metadata[$offset]);
|
||||
}
|
||||
@@ -82,7 +83,6 @@ class TPC_yyStackEntry
|
||||
** is the value of the token */
|
||||
};
|
||||
|
||||
|
||||
#line 12 "smarty_internal_configfileparser.y"
|
||||
class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser.php"
|
||||
{
|
||||
@@ -94,7 +94,8 @@ class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser
|
||||
private $lex;
|
||||
private $internalError = false;
|
||||
|
||||
function __construct($lex, $compiler) {
|
||||
public function __construct($lex, $compiler)
|
||||
{
|
||||
// set instance object
|
||||
self::instance($this);
|
||||
$this->lex = $lex;
|
||||
@@ -106,21 +107,25 @@ class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser
|
||||
static $instance = null;
|
||||
if (isset($new_instance) && is_object($new_instance))
|
||||
$instance = $new_instance;
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
private function parse_bool($str) {
|
||||
private function parse_bool($str)
|
||||
{
|
||||
if (in_array(strtolower($str) ,array('on','yes','true'))) {
|
||||
$res = true;
|
||||
} else {
|
||||
$res = false;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
private static $escapes_single = Array('\\' => '\\',
|
||||
'\'' => '\'');
|
||||
private static function parse_single_quoted_string($qstr) {
|
||||
private static function parse_single_quoted_string($qstr)
|
||||
{
|
||||
$escaped_string = substr($qstr, 1, strlen($qstr)-2); //remove outer quotes
|
||||
|
||||
$ss = preg_split('/(\\\\.)/', $escaped_string, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||
@@ -139,16 +144,20 @@ class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser
|
||||
return $str;
|
||||
}
|
||||
|
||||
private static function parse_double_quoted_string($qstr) {
|
||||
private static function parse_double_quoted_string($qstr)
|
||||
{
|
||||
$inner_str = substr($qstr, 1, strlen($qstr)-2);
|
||||
|
||||
return stripcslashes($inner_str);
|
||||
}
|
||||
|
||||
private static function parse_tripple_double_quoted_string($qstr) {
|
||||
private static function parse_tripple_double_quoted_string($qstr)
|
||||
{
|
||||
return stripcslashes($qstr);
|
||||
}
|
||||
|
||||
private function set_var(Array $var, Array &$target_array) {
|
||||
private function set_var(Array $var, Array &$target_array)
|
||||
{
|
||||
$key = $var["key"];
|
||||
$value = $var["value"];
|
||||
|
||||
@@ -160,7 +169,8 @@ class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser
|
||||
}
|
||||
}
|
||||
|
||||
private function add_global_vars(Array $vars) {
|
||||
private function add_global_vars(Array $vars)
|
||||
{
|
||||
if (!isset($this->compiler->config_data['vars'])) {
|
||||
$this->compiler->config_data['vars'] = Array();
|
||||
}
|
||||
@@ -169,7 +179,8 @@ class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser
|
||||
}
|
||||
}
|
||||
|
||||
private function add_section_vars($section_name, Array $vars) {
|
||||
private function add_section_vars($section_name, Array $vars)
|
||||
{
|
||||
if (!isset($this->compiler->config_data['sections'][$section_name]['vars'])) {
|
||||
$this->compiler->config_data['sections'][$section_name]['vars'] = Array();
|
||||
}
|
||||
@@ -208,7 +219,7 @@ static public $yy_action = array(
|
||||
/* 20 */ 15, 17, 23, 18, 27, 26, 4, 5, 6, 32,
|
||||
/* 30 */ 2, 11, 28, 22, 16, 9, 7, 10,
|
||||
);
|
||||
static public $yy_lookahead = array(
|
||||
public static $yy_lookahead = array(
|
||||
/* 0 */ 7, 8, 9, 10, 11, 12, 5, 27, 15, 16,
|
||||
/* 10 */ 20, 21, 23, 23, 17, 18, 13, 14, 17, 18,
|
||||
/* 20 */ 15, 2, 17, 4, 25, 26, 6, 3, 3, 14,
|
||||
@@ -216,17 +227,17 @@ static public $yy_action = array(
|
||||
);
|
||||
const YY_SHIFT_USE_DFLT = -8;
|
||||
const YY_SHIFT_MAX = 19;
|
||||
static public $yy_shift_ofst = array(
|
||||
public static $yy_shift_ofst = array(
|
||||
/* 0 */ -8, 1, 1, 1, -7, -3, -3, 30, -8, -8,
|
||||
/* 10 */ -8, 19, 5, 3, 15, 16, 24, 25, 32, 20,
|
||||
);
|
||||
const YY_REDUCE_USE_DFLT = -21;
|
||||
const YY_REDUCE_MAX = 10;
|
||||
static public $yy_reduce_ofst = array(
|
||||
public static $yy_reduce_ofst = array(
|
||||
/* 0 */ -10, -1, -1, -1, -20, 10, 12, 8, 14, 7,
|
||||
/* 10 */ -11,
|
||||
);
|
||||
static public $yyExpectedTokens = array(
|
||||
public static $yyExpectedTokens = array(
|
||||
/* 0 */ array(),
|
||||
/* 1 */ array(5, 17, 18, ),
|
||||
/* 2 */ array(5, 17, 18, ),
|
||||
@@ -264,7 +275,7 @@ static public $yy_action = array(
|
||||
/* 34 */ array(),
|
||||
/* 35 */ array(),
|
||||
);
|
||||
static public $yy_default = array(
|
||||
public static $yy_default = array(
|
||||
/* 0 */ 44, 37, 41, 40, 58, 58, 58, 36, 39, 44,
|
||||
/* 10 */ 44, 58, 58, 58, 58, 58, 58, 58, 58, 58,
|
||||
/* 20 */ 55, 54, 57, 56, 50, 45, 43, 42, 38, 46,
|
||||
@@ -277,9 +288,9 @@ static public $yy_action = array(
|
||||
const YYERRORSYMBOL = 19;
|
||||
const YYERRSYMDT = 'yy0';
|
||||
const YYFALLBACK = 0;
|
||||
static public $yyFallback = array(
|
||||
public static $yyFallback = array(
|
||||
);
|
||||
static function Trace($TraceFILE, $zTracePrompt)
|
||||
public static function Trace($TraceFILE, $zTracePrompt)
|
||||
{
|
||||
if (!$TraceFILE) {
|
||||
$zTracePrompt = 0;
|
||||
@@ -290,14 +301,14 @@ static public $yy_action = array(
|
||||
self::$yyTracePrompt = $zTracePrompt;
|
||||
}
|
||||
|
||||
static function PrintTrace()
|
||||
public static function PrintTrace()
|
||||
{
|
||||
self::$yyTraceFILE = fopen('php://output', 'w');
|
||||
self::$yyTracePrompt = '<br>';
|
||||
}
|
||||
|
||||
static public $yyTraceFILE;
|
||||
static public $yyTracePrompt;
|
||||
public static $yyTraceFILE;
|
||||
public static $yyTracePrompt;
|
||||
public $yyidx; /* Index of top element in stack */
|
||||
public $yyerrcnt; /* Shifts left before out of the error */
|
||||
public $yystack = array(); /* The parser's stack */
|
||||
@@ -312,7 +323,7 @@ static public $yy_action = array(
|
||||
'section', 'newline', 'var', 'value',
|
||||
);
|
||||
|
||||
static public $yyRuleName = array(
|
||||
public static $yyRuleName = array(
|
||||
/* 0 */ "start ::= global_vars sections",
|
||||
/* 1 */ "global_vars ::= var_list",
|
||||
/* 2 */ "sections ::= sections section",
|
||||
@@ -337,7 +348,7 @@ static public $yy_action = array(
|
||||
/* 21 */ "newline ::= COMMENTSTART NAKED_STRING NEWLINE",
|
||||
);
|
||||
|
||||
function tokenName($tokenType)
|
||||
public function tokenName($tokenType)
|
||||
{
|
||||
if ($tokenType === 0) {
|
||||
return 'End of Input';
|
||||
@@ -349,14 +360,14 @@ static public $yy_action = array(
|
||||
}
|
||||
}
|
||||
|
||||
static function yy_destructor($yymajor, $yypminor)
|
||||
public static function yy_destructor($yymajor, $yypminor)
|
||||
{
|
||||
switch ($yymajor) {
|
||||
default: break; /* If no destructor action specified: do nothing */
|
||||
}
|
||||
}
|
||||
|
||||
function yy_pop_parser_stack()
|
||||
public function yy_pop_parser_stack()
|
||||
{
|
||||
if (!count($this->yystack)) {
|
||||
return;
|
||||
@@ -370,10 +381,11 @@ static public $yy_action = array(
|
||||
$yymajor = $yytos->major;
|
||||
self::yy_destructor($yymajor, $yytos->minor);
|
||||
$this->yyidx--;
|
||||
|
||||
return $yymajor;
|
||||
}
|
||||
|
||||
function __destruct()
|
||||
public function __destruct()
|
||||
{
|
||||
while ($this->yystack !== Array()) {
|
||||
$this->yy_pop_parser_stack();
|
||||
@@ -383,7 +395,7 @@ static public $yy_action = array(
|
||||
}
|
||||
}
|
||||
|
||||
function yy_get_expected_tokens($token)
|
||||
public function yy_get_expected_tokens($token)
|
||||
{
|
||||
$state = $this->yystack[$this->yyidx]->stateno;
|
||||
$expected = self::$yyExpectedTokens[$state];
|
||||
@@ -416,6 +428,7 @@ static public $yy_action = array(
|
||||
self::$yyExpectedTokens[$nextstate], true)) {
|
||||
$this->yyidx = $yyidx;
|
||||
$this->yystack = $stack;
|
||||
|
||||
return array_unique($expected);
|
||||
}
|
||||
}
|
||||
@@ -448,10 +461,11 @@ static public $yy_action = array(
|
||||
} while (true);
|
||||
$this->yyidx = $yyidx;
|
||||
$this->yystack = $stack;
|
||||
|
||||
return array_unique($expected);
|
||||
}
|
||||
|
||||
function yy_is_expected_token($token)
|
||||
public function yy_is_expected_token($token)
|
||||
{
|
||||
if ($token === 0) {
|
||||
return true; // 0 is not part of this
|
||||
@@ -484,6 +498,7 @@ static public $yy_action = array(
|
||||
in_array($token, self::$yyExpectedTokens[$nextstate], true)) {
|
||||
$this->yyidx = $yyidx;
|
||||
$this->yystack = $stack;
|
||||
|
||||
return true;
|
||||
}
|
||||
if ($nextstate < self::YYNSTATE) {
|
||||
@@ -519,10 +534,11 @@ static public $yy_action = array(
|
||||
} while (true);
|
||||
$this->yyidx = $yyidx;
|
||||
$this->yystack = $stack;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function yy_find_shift_action($iLookAhead)
|
||||
public function yy_find_shift_action($iLookAhead)
|
||||
{
|
||||
$stateno = $this->yystack[$this->yyidx]->stateno;
|
||||
|
||||
@@ -548,15 +564,17 @@ static public $yy_action = array(
|
||||
$this->yyTokenName[$iLookAhead] . " => " .
|
||||
$this->yyTokenName[$iFallback] . "\n");
|
||||
}
|
||||
|
||||
return $this->yy_find_shift_action($iFallback);
|
||||
}
|
||||
|
||||
return self::$yy_default[$stateno];
|
||||
} else {
|
||||
return self::$yy_action[$i];
|
||||
}
|
||||
}
|
||||
|
||||
function yy_find_reduce_action($stateno, $iLookAhead)
|
||||
public function yy_find_reduce_action($stateno, $iLookAhead)
|
||||
{
|
||||
/* $stateno = $this->yystack[$this->yyidx]->stateno; */
|
||||
|
||||
@@ -579,7 +597,7 @@ static public $yy_action = array(
|
||||
}
|
||||
}
|
||||
|
||||
function yy_shift($yyNewState, $yyMajor, $yypMinor)
|
||||
public function yy_shift($yyNewState, $yyMajor, $yypMinor)
|
||||
{
|
||||
$this->yyidx++;
|
||||
if ($this->yyidx >= self::YYSTACKDEPTH) {
|
||||
@@ -595,6 +613,7 @@ static public $yy_action = array(
|
||||
$this->internalError = true;
|
||||
$this->compiler->trigger_config_file_error("Stack overflow in configfile parser");
|
||||
#line 593 "smarty_internal_configfileparser.php"
|
||||
|
||||
return;
|
||||
}
|
||||
$yytos = new TPC_yyStackEntry;
|
||||
@@ -614,7 +633,7 @@ static public $yy_action = array(
|
||||
}
|
||||
}
|
||||
|
||||
static public $yyRuleInfo = array(
|
||||
public static $yyRuleInfo = array(
|
||||
array( 'lhs' => 20, 'rhs' => 2 ),
|
||||
array( 'lhs' => 21, 'rhs' => 1 ),
|
||||
array( 'lhs' => 22, 'rhs' => 2 ),
|
||||
@@ -639,7 +658,7 @@ static public $yy_action = array(
|
||||
array( 'lhs' => 25, 'rhs' => 3 ),
|
||||
);
|
||||
|
||||
static public $yyReduceMap = array(
|
||||
public static $yyReduceMap = array(
|
||||
0 => 0,
|
||||
2 => 0,
|
||||
3 => 0,
|
||||
@@ -664,23 +683,27 @@ static public $yy_action = array(
|
||||
18 => 17,
|
||||
);
|
||||
#line 131 "smarty_internal_configfileparser.y"
|
||||
function yy_r0(){
|
||||
public function yy_r0()
|
||||
{
|
||||
$this->_retvalue = null;
|
||||
}
|
||||
#line 666 "smarty_internal_configfileparser.php"
|
||||
#line 136 "smarty_internal_configfileparser.y"
|
||||
function yy_r1(){
|
||||
public function yy_r1()
|
||||
{
|
||||
$this->add_global_vars($this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = null;
|
||||
}
|
||||
#line 671 "smarty_internal_configfileparser.php"
|
||||
#line 149 "smarty_internal_configfileparser.y"
|
||||
function yy_r4(){
|
||||
public function yy_r4()
|
||||
{
|
||||
$this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor);
|
||||
$this->_retvalue = null;
|
||||
}
|
||||
#line 677 "smarty_internal_configfileparser.php"
|
||||
#line 154 "smarty_internal_configfileparser.y"
|
||||
function yy_r5(){
|
||||
public function yy_r5()
|
||||
{
|
||||
if ($this->smarty->config_read_hidden) {
|
||||
$this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor);
|
||||
}
|
||||
@@ -688,69 +711,81 @@ static public $yy_action = array(
|
||||
}
|
||||
#line 685 "smarty_internal_configfileparser.php"
|
||||
#line 162 "smarty_internal_configfileparser.y"
|
||||
function yy_r6(){
|
||||
public function yy_r6()
|
||||
{
|
||||
$this->_retvalue = $this->yystack[$this->yyidx + -1]->minor;
|
||||
}
|
||||
#line 690 "smarty_internal_configfileparser.php"
|
||||
#line 166 "smarty_internal_configfileparser.y"
|
||||
function yy_r7(){
|
||||
public function yy_r7()
|
||||
{
|
||||
$this->_retvalue = array_merge($this->yystack[$this->yyidx + -1]->minor, Array($this->yystack[$this->yyidx + 0]->minor));
|
||||
}
|
||||
#line 695 "smarty_internal_configfileparser.php"
|
||||
#line 170 "smarty_internal_configfileparser.y"
|
||||
function yy_r8(){
|
||||
public function yy_r8()
|
||||
{
|
||||
$this->_retvalue = Array();
|
||||
}
|
||||
#line 700 "smarty_internal_configfileparser.php"
|
||||
#line 176 "smarty_internal_configfileparser.y"
|
||||
function yy_r9(){
|
||||
public function yy_r9()
|
||||
{
|
||||
$this->_retvalue = Array("key" => $this->yystack[$this->yyidx + -2]->minor, "value" => $this->yystack[$this->yyidx + 0]->minor);
|
||||
}
|
||||
#line 705 "smarty_internal_configfileparser.php"
|
||||
#line 181 "smarty_internal_configfileparser.y"
|
||||
function yy_r10(){
|
||||
public function yy_r10()
|
||||
{
|
||||
$this->_retvalue = (float) $this->yystack[$this->yyidx + 0]->minor;
|
||||
}
|
||||
#line 710 "smarty_internal_configfileparser.php"
|
||||
#line 185 "smarty_internal_configfileparser.y"
|
||||
function yy_r11(){
|
||||
public function yy_r11()
|
||||
{
|
||||
$this->_retvalue = (int) $this->yystack[$this->yyidx + 0]->minor;
|
||||
}
|
||||
#line 715 "smarty_internal_configfileparser.php"
|
||||
#line 189 "smarty_internal_configfileparser.y"
|
||||
function yy_r12(){
|
||||
public function yy_r12()
|
||||
{
|
||||
$this->_retvalue = $this->parse_bool($this->yystack[$this->yyidx + 0]->minor);
|
||||
}
|
||||
#line 720 "smarty_internal_configfileparser.php"
|
||||
#line 193 "smarty_internal_configfileparser.y"
|
||||
function yy_r13(){
|
||||
public function yy_r13()
|
||||
{
|
||||
$this->_retvalue = self::parse_single_quoted_string($this->yystack[$this->yyidx + 0]->minor);
|
||||
}
|
||||
#line 725 "smarty_internal_configfileparser.php"
|
||||
#line 197 "smarty_internal_configfileparser.y"
|
||||
function yy_r14(){
|
||||
public function yy_r14()
|
||||
{
|
||||
$this->_retvalue = self::parse_double_quoted_string($this->yystack[$this->yyidx + 0]->minor);
|
||||
}
|
||||
#line 730 "smarty_internal_configfileparser.php"
|
||||
#line 201 "smarty_internal_configfileparser.y"
|
||||
function yy_r15(){
|
||||
public function yy_r15()
|
||||
{
|
||||
$this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[$this->yyidx + -1]->minor);
|
||||
}
|
||||
#line 735 "smarty_internal_configfileparser.php"
|
||||
#line 205 "smarty_internal_configfileparser.y"
|
||||
function yy_r16(){
|
||||
public function yy_r16()
|
||||
{
|
||||
$this->_retvalue = '';
|
||||
}
|
||||
#line 740 "smarty_internal_configfileparser.php"
|
||||
#line 209 "smarty_internal_configfileparser.y"
|
||||
function yy_r17(){
|
||||
public function yy_r17()
|
||||
{
|
||||
$this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;
|
||||
}
|
||||
#line 745 "smarty_internal_configfileparser.php"
|
||||
|
||||
private $_retvalue;
|
||||
|
||||
function yy_reduce($yyruleno)
|
||||
public function yy_reduce($yyruleno)
|
||||
{
|
||||
$yymsp = $this->yystack[$this->yyidx];
|
||||
if (self::$yyTraceFILE && $yyruleno >= 0
|
||||
@@ -791,17 +826,16 @@ static public $yy_action = array(
|
||||
}
|
||||
}
|
||||
|
||||
function yy_parse_failed()
|
||||
public function yy_parse_failed()
|
||||
{
|
||||
if (self::$yyTraceFILE) {
|
||||
fprintf(self::$yyTraceFILE, "%sFail!\n", self::$yyTracePrompt);
|
||||
}
|
||||
while ($this->yyidx >= 0) {
|
||||
} while ($this->yyidx >= 0) {
|
||||
$this->yy_pop_parser_stack();
|
||||
}
|
||||
}
|
||||
|
||||
function yy_syntax_error($yymajor, $TOKEN)
|
||||
public function yy_syntax_error($yymajor, $TOKEN)
|
||||
{
|
||||
#line 118 "smarty_internal_configfileparser.y"
|
||||
|
||||
@@ -811,12 +845,11 @@ static public $yy_action = array(
|
||||
#line 808 "smarty_internal_configfileparser.php"
|
||||
}
|
||||
|
||||
function yy_accept()
|
||||
public function yy_accept()
|
||||
{
|
||||
if (self::$yyTraceFILE) {
|
||||
fprintf(self::$yyTraceFILE, "%sAccept!\n", self::$yyTracePrompt);
|
||||
}
|
||||
while ($this->yyidx >= 0) {
|
||||
} while ($this->yyidx >= 0) {
|
||||
$stack = $this->yy_pop_parser_stack();
|
||||
}
|
||||
#line 110 "smarty_internal_configfileparser.y"
|
||||
@@ -828,7 +861,7 @@ static public $yy_action = array(
|
||||
#line 826 "smarty_internal_configfileparser.php"
|
||||
}
|
||||
|
||||
function doParse($yymajor, $yytokenvalue)
|
||||
public function doParse($yymajor, $yytokenvalue)
|
||||
{
|
||||
$yyerrorhit = 0; /* True if yymajor has invoked an error */
|
||||
|
||||
@@ -918,4 +951,3 @@ static public $yy_action = array(
|
||||
} while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);
|
||||
}
|
||||
}
|
||||
?>
|
@@ -15,8 +15,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Template
|
||||
*/
|
||||
class Smarty_Internal_Data {
|
||||
|
||||
class Smarty_Internal_Data
|
||||
{
|
||||
/**
|
||||
* name of class used for templates
|
||||
*
|
||||
@@ -238,6 +238,7 @@ class Smarty_Internal_Data {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $_result;
|
||||
}
|
||||
}
|
||||
@@ -268,6 +269,7 @@ class Smarty_Internal_Data {
|
||||
public function clearAllAssign()
|
||||
{
|
||||
$this->tpl_vars = array();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -283,6 +285,7 @@ class Smarty_Internal_Data {
|
||||
// load Config class
|
||||
$config = new Smarty_Internal_Config($config_file, $this->smarty, $this);
|
||||
$config->loadConfigVars($sections);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -318,6 +321,7 @@ class Smarty_Internal_Data {
|
||||
// force a notice
|
||||
$x = $$variable;
|
||||
}
|
||||
|
||||
return new Undefined_Smarty_Variable;
|
||||
}
|
||||
|
||||
@@ -342,6 +346,7 @@ class Smarty_Internal_Data {
|
||||
// force a notice
|
||||
$x = $$variable;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -360,6 +365,7 @@ class Smarty_Internal_Data {
|
||||
$_result .= $current_line;
|
||||
}
|
||||
fclose($fp);
|
||||
|
||||
return $_result;
|
||||
}
|
||||
|
||||
@@ -415,6 +421,7 @@ class Smarty_Internal_Data {
|
||||
} else {
|
||||
$this->config_vars = array();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -428,8 +435,8 @@ class Smarty_Internal_Data {
|
||||
* @package Smarty
|
||||
* @subpackage Template
|
||||
*/
|
||||
class Smarty_Data extends Smarty_Internal_Data {
|
||||
|
||||
class Smarty_Data extends Smarty_Internal_Data
|
||||
{
|
||||
/**
|
||||
* Smarty object
|
||||
*
|
||||
@@ -469,8 +476,8 @@ class Smarty_Data extends Smarty_Internal_Data {
|
||||
* @package Smarty
|
||||
* @subpackage Template
|
||||
*/
|
||||
class Smarty_Variable {
|
||||
|
||||
class Smarty_Variable
|
||||
{
|
||||
/**
|
||||
* template variable
|
||||
*
|
||||
@@ -524,8 +531,8 @@ class Smarty_Variable {
|
||||
* @package Smarty
|
||||
* @subpackage Template
|
||||
*/
|
||||
class Undefined_Smarty_Variable {
|
||||
|
||||
class Undefined_Smarty_Variable
|
||||
{
|
||||
/**
|
||||
* Returns FALSE for 'nocache' and NULL otherwise.
|
||||
*
|
||||
@@ -552,5 +559,3 @@ class Undefined_Smarty_Variable {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user