mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 03:14:27 +02:00
- update for PHP 5.4 compatibility
- reformat source to PSR-2 standard
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
===== trunk =====
|
||||
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)
|
||||
|
@@ -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,14 +24,16 @@
|
||||
* @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");
|
||||
} catch (PDOException $e) {
|
||||
@@ -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,7 +29,8 @@ 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");
|
||||
} catch (PDOException $e) {
|
||||
@@ -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,13 +23,15 @@
|
||||
* @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");
|
||||
} catch (PDOException $e) {
|
||||
|
@@ -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
|
||||
*/
|
||||
@@ -167,38 +167,38 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
/**
|
||||
* assigned global tpl vars
|
||||
*/
|
||||
public static $global_tpl_vars = array();
|
||||
static $global_tpl_vars = array();
|
||||
|
||||
/**
|
||||
* error handler returned by set_error_hanlder() in Smarty::muteExpectedErrors()
|
||||
*/
|
||||
public static $_previous_error_handler = null;
|
||||
static $_previous_error_handler = null;
|
||||
/**
|
||||
* contains directories outside of SMARTY_DIR that are to be muted by muteExpectedErrors()
|
||||
*/
|
||||
public static $_muted_directories = array();
|
||||
static $_muted_directories = array();
|
||||
/**
|
||||
* Flag denoting if Multibyte String functions are available
|
||||
*/
|
||||
public static $_MBSTRING = SMARTY_MBSTRING;
|
||||
static $_MBSTRING = SMARTY_MBSTRING;
|
||||
/**
|
||||
* The character set to adhere to (e.g. "UTF-8")
|
||||
*/
|
||||
public static $_CHARSET = SMARTY_RESOURCE_CHAR_SET;
|
||||
static $_CHARSET = SMARTY_RESOURCE_CHAR_SET;
|
||||
/**
|
||||
* The date format to be used internally
|
||||
* (accepts date() and strftime())
|
||||
*/
|
||||
public static $_DATE_FORMAT = SMARTY_RESOURCE_DATE_FORMAT;
|
||||
static $_DATE_FORMAT = SMARTY_RESOURCE_DATE_FORMAT;
|
||||
/**
|
||||
* Flag denoting if PCRE should run in UTF-8 mode
|
||||
*/
|
||||
public static $_UTF8_MODIFIER = 'u';
|
||||
static $_UTF8_MODIFIER = 'u';
|
||||
|
||||
/**
|
||||
* Flag denoting if operating system is windows
|
||||
*/
|
||||
public static $_IS_WINDOWS = false;
|
||||
static $_IS_WINDOWS = false;
|
||||
|
||||
/**#@+
|
||||
* variables
|
||||
@@ -564,7 +564,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
* global internal smarty vars
|
||||
* @var array
|
||||
*/
|
||||
public static $_smarty_vars = array();
|
||||
static $_smarty_vars = array();
|
||||
/**
|
||||
* start time for execution time calculation
|
||||
* @var int
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -1390,7 +1406,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
* @param integer $errno Error level
|
||||
* @return boolean
|
||||
*/
|
||||
public static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext)
|
||||
static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext)
|
||||
{
|
||||
$_is_muted_directory = false;
|
||||
|
||||
@@ -1442,7 +1458,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function muteExpectedErrors()
|
||||
static function muteExpectedErrors()
|
||||
{
|
||||
/*
|
||||
error muting is done because some people implemented custom error_handlers using
|
||||
@@ -1474,7 +1490,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function unmuteExpectedErrors()
|
||||
static function unmuteExpectedErrors()
|
||||
{
|
||||
restore_error_handler();
|
||||
}
|
||||
@@ -1492,9 +1508,11 @@ if (Smarty::$_CHARSET !== 'UTF-8') {
|
||||
* Smarty exception class
|
||||
* @package Smarty
|
||||
*/
|
||||
class SmartyException extends Exception {
|
||||
public static $escape = true;
|
||||
public function __construct($message) {
|
||||
class SmartyException extends Exception
|
||||
{
|
||||
static $escape = true;
|
||||
public function __construct($message)
|
||||
{
|
||||
$this->message = self::$escape ? htmlentities($message) : $message;
|
||||
}
|
||||
}
|
||||
@@ -1503,7 +1521,8 @@ class SmartyException extends Exception {
|
||||
* Smarty compiler exception class
|
||||
* @package Smarty
|
||||
*/
|
||||
class SmartyCompilerException extends SmartyException {
|
||||
class SmartyCompilerException extends SmartyException
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1529,5 +1548,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;
|
||||
}
|
||||
|
||||
?>
|
@@ -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] . ')';
|
||||
}
|
||||
|
||||
?>
|
@@ -88,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,8 @@
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
|
||||
|
||||
class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase
|
||||
{
|
||||
/**
|
||||
* Attribute definition: Overwrites base class.
|
||||
*
|
||||
@@ -49,7 +49,8 @@ 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);
|
||||
@@ -64,6 +65,7 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
|
||||
|
||||
$compiler->parser->current_buffer = new _smarty_template_buffer($compiler->parser);
|
||||
$compiler->has_code = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -75,7 +77,8 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
|
||||
* @param object $template template object
|
||||
* @param string $filepath filepath of template source
|
||||
*/
|
||||
public static function saveBlockData($block_content, $block_tag, $template, $filepath) {
|
||||
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) {
|
||||
@@ -157,7 +160,8 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
|
||||
* @param string $_name optional name of child block
|
||||
* @return string compiled code of schild block
|
||||
*/
|
||||
public static function compileChildBlock($compiler, $_name = null) {
|
||||
static function compileChildBlock($compiler, $_name = null)
|
||||
{
|
||||
$_output = '';
|
||||
// if called by {$smarty.block.child} we must search the name of enclosing {block}
|
||||
if ($_name == null) {
|
||||
@@ -222,6 +226,7 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
|
||||
}
|
||||
}
|
||||
unset($_tpl);
|
||||
|
||||
return $_output;
|
||||
}
|
||||
|
||||
@@ -233,8 +238,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,7 +247,8 @@ 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);
|
||||
@@ -275,9 +281,8 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase {
|
||||
$compiler->inheritance = false;
|
||||
// $_output content has already nocache code processed
|
||||
$compiler->suppressNocacheProcessing = true;
|
||||
|
||||
return $_output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -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.
|
||||
*
|
||||
@@ -69,9 +69,8 @@ class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase {
|
||||
$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.
|
||||
*
|
||||
@@ -70,9 +70,8 @@ class Smarty_Internal_Compile_Continue extends Smarty_Internal_CompileBase {
|
||||
$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.
|
||||
*
|
||||
@@ -125,9 +125,8 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_CompileBase {
|
||||
}
|
||||
$compiler->template->source->filepath = $_template->source->filepath;
|
||||
$compiler->abort_and_recompile = true;
|
||||
|
||||
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.
|
||||
*
|
||||
@@ -86,6 +86,7 @@ class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase {
|
||||
$compiler->template->has_nocache_code = false;
|
||||
$compiler->has_code = false;
|
||||
$compiler->template->properties['function'][$_name]['compiled'] = '';
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -97,8 +98,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 +159,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
|
||||
*/
|
||||
@@ -198,6 +198,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
|
||||
$_output .= " \$_smarty_tpl->tpl_vars[$_assign] = new Smarty_variable(ob_get_clean());";
|
||||
}
|
||||
$_output .= "/* End of included template \"" . $tpl_name . "\" */?>";
|
||||
|
||||
return $_output;
|
||||
}
|
||||
|
||||
@@ -207,9 +208,8 @@ 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
|
||||
*
|
||||
@@ -36,6 +36,7 @@ class Smarty_Internal_Compile_Nocache extends Smarty_Internal_CompileBase {
|
||||
$compiler->nocache = true;
|
||||
// this tag does not return compiled code
|
||||
$compiler->has_code = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -47,8 +48,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
|
||||
*
|
||||
@@ -65,9 +66,8 @@ class Smarty_Internal_Compile_Nocacheclose extends Smarty_Internal_CompileBase {
|
||||
$compiler->nocache = false;
|
||||
// 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.
|
||||
*
|
||||
@@ -71,9 +71,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.
|
||||
*
|
||||
@@ -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
|
||||
*
|
||||
@@ -164,13 +164,13 @@ abstract class Smarty_Internal_CompileBase {
|
||||
}
|
||||
// wrong nesting of tags
|
||||
$compiler->trigger_template_error("unclosed {" . $_openTag . "} 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
|
||||
*
|
||||
@@ -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 {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -33,7 +33,7 @@ class Smarty_Internal_Configfilelexer
|
||||
$this->smarty = $smarty;
|
||||
$this->mbstring_overload = ini_get('mbstring.func_overload') & 2;
|
||||
}
|
||||
public static function &instance($new_instance = null)
|
||||
static function &instance($new_instance = null)
|
||||
{
|
||||
static $instance = null;
|
||||
if (isset($new_instance) && is_object($new_instance))
|
||||
|
@@ -102,7 +102,7 @@ class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser
|
||||
$this->smarty = $compiler->smarty;
|
||||
$this->compiler = $compiler;
|
||||
}
|
||||
public static function &instance($new_instance = null)
|
||||
static function &instance($new_instance = null)
|
||||
{
|
||||
static $instance = null;
|
||||
if (isset($new_instance) && is_object($new_instance))
|
||||
@@ -219,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,
|
||||
);
|
||||
public static $yy_lookahead = array(
|
||||
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,
|
||||
@@ -227,17 +227,17 @@ static public $yy_action = array(
|
||||
);
|
||||
const YY_SHIFT_USE_DFLT = -8;
|
||||
const YY_SHIFT_MAX = 19;
|
||||
public static $yy_shift_ofst = array(
|
||||
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;
|
||||
public static $yy_reduce_ofst = array(
|
||||
static $yy_reduce_ofst = array(
|
||||
/* 0 */ -10, -1, -1, -1, -20, 10, 12, 8, 14, 7,
|
||||
/* 10 */ -11,
|
||||
);
|
||||
public static $yyExpectedTokens = array(
|
||||
static $yyExpectedTokens = array(
|
||||
/* 0 */ array(),
|
||||
/* 1 */ array(5, 17, 18, ),
|
||||
/* 2 */ array(5, 17, 18, ),
|
||||
@@ -275,7 +275,7 @@ static public $yy_action = array(
|
||||
/* 34 */ array(),
|
||||
/* 35 */ array(),
|
||||
);
|
||||
public static $yy_default = array(
|
||||
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,
|
||||
@@ -288,9 +288,9 @@ static public $yy_action = array(
|
||||
const YYERRORSYMBOL = 19;
|
||||
const YYERRSYMDT = 'yy0';
|
||||
const YYFALLBACK = 0;
|
||||
public static $yyFallback = array(
|
||||
static $yyFallback = array(
|
||||
);
|
||||
public static function Trace($TraceFILE, $zTracePrompt)
|
||||
static function Trace($TraceFILE, $zTracePrompt)
|
||||
{
|
||||
if (!$TraceFILE) {
|
||||
$zTracePrompt = 0;
|
||||
@@ -301,14 +301,14 @@ static public $yy_action = array(
|
||||
self::$yyTracePrompt = $zTracePrompt;
|
||||
}
|
||||
|
||||
public static function PrintTrace()
|
||||
static function PrintTrace()
|
||||
{
|
||||
self::$yyTraceFILE = fopen('php://output', 'w');
|
||||
self::$yyTracePrompt = '<br>';
|
||||
}
|
||||
|
||||
public static $yyTraceFILE;
|
||||
public static $yyTracePrompt;
|
||||
static $yyTraceFILE;
|
||||
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 */
|
||||
@@ -323,7 +323,7 @@ static public $yy_action = array(
|
||||
'section', 'newline', 'var', 'value',
|
||||
);
|
||||
|
||||
public static $yyRuleName = array(
|
||||
static $yyRuleName = array(
|
||||
/* 0 */ "start ::= global_vars sections",
|
||||
/* 1 */ "global_vars ::= var_list",
|
||||
/* 2 */ "sections ::= sections section",
|
||||
@@ -360,7 +360,7 @@ static public $yy_action = array(
|
||||
}
|
||||
}
|
||||
|
||||
public static function yy_destructor($yymajor, $yypminor)
|
||||
static function yy_destructor($yymajor, $yypminor)
|
||||
{
|
||||
switch ($yymajor) {
|
||||
default: break; /* If no destructor action specified: do nothing */
|
||||
@@ -633,7 +633,7 @@ static public $yy_action = array(
|
||||
}
|
||||
}
|
||||
|
||||
public static $yyRuleInfo = array(
|
||||
static $yyRuleInfo = array(
|
||||
array( 'lhs' => 20, 'rhs' => 2 ),
|
||||
array( 'lhs' => 21, 'rhs' => 1 ),
|
||||
array( 'lhs' => 22, 'rhs' => 2 ),
|
||||
@@ -658,7 +658,7 @@ static public $yy_action = array(
|
||||
array( 'lhs' => 25, 'rhs' => 3 ),
|
||||
);
|
||||
|
||||
public static $yyReduceMap = array(
|
||||
static $yyReduceMap = array(
|
||||
0 => 0,
|
||||
2 => 0,
|
||||
3 => 0,
|
||||
@@ -830,8 +830,7 @@ static public $yy_action = array(
|
||||
{
|
||||
if (self::$yyTraceFILE) {
|
||||
fprintf(self::$yyTraceFILE, "%sFail!\n", self::$yyTracePrompt);
|
||||
}
|
||||
while ($this->yyidx >= 0) {
|
||||
} while ($this->yyidx >= 0) {
|
||||
$this->yy_pop_parser_stack();
|
||||
}
|
||||
}
|
||||
|
@@ -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