- added setter/getter methodes

- added $foo@first and $foo@last properties at {for} tag
- added $set_timezone (true/false) property to setup optionally the default time zone
This commit is contained in:
Uwe.Tews
2009-04-02 12:24:50 +00:00
parent 25e4ef7fb9
commit b46b973b8e
13 changed files with 264 additions and 3 deletions

View File

@@ -1,7 +1,12 @@
04/02/2009
- added setter/getter methodes
- added $foo@first and $foo@last properties at {for} tag
- added $set_timezone (true/false) property to setup optionally the default time zone
03/31/2009
- bugfix smarty.class and internal.security_handler
- added compile_check configuration
- added all setter/getter methodes
- added setter/getter methodes
03/30/2009
- added all major setter/getter methodes

View File

@@ -102,7 +102,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
// config var settings
public $config_overwrite = true; //Controls whether variables with the same name overwrite each other.
public $config_booleanize = true; //Controls whether config values of on/true/yes and off/false/no get converted to boolean
public $config_read_hidden = true; //Controls whether hidden config sections/vars are read from the file.
public $config_read_hidden = true; //Controls whether hidden config sections/vars are read from the file.
// config vars
public $config_vars = array();
// assigned tpl vars
@@ -153,13 +153,17 @@ class Smarty extends Smarty_Internal_TemplateBase {
public $_smarty_vars = array();
// start time for execution time calculation
public $start_time = 0;
// set default time zone
public $set_timezone = true;
/**
* Class constructor, initializes basic smarty properties
*/
public function __construct()
{
mb_internal_encoding($this->resource_char_set);
if ($this->set_timezone and function_exists("date_default_timezone_set") and function_exists("date_default_timezone_get")) {
date_default_timezone_set(date_default_timezone_get());
}
$this->start_time = $this->_get_time();
// set exception handler
if (!empty($this->exception_handler))

View File

@@ -52,8 +52,10 @@ class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase {
$output .= " \$_smarty_tpl->tpl_vars[$item]->index=-1;\n";
$output .= "if (\$_smarty_tpl->tpl_vars[$item]->total > 0){\n";
$output .= " foreach (\$_from as \$_smarty_tpl->tpl_vars[$item]->key => \$_smarty_tpl->tpl_vars[$item]->value){\n";
$output .= " \$_smarty_tpl->tpl_vars[$item]->first = \$_smarty_tpl->tpl_vars[$item]->iteration === 0;\n";
$output .= " \$_smarty_tpl->tpl_vars[$item]->iteration++;\n";
$output .= " \$_smarty_tpl->tpl_vars[$item]->index++;\n";
$output .= " \$_smarty_tpl->tpl_vars[$item]->last = \$_smarty_tpl->tpl_vars[$item]->iteration === \$_smarty_tpl->tpl_vars[$item]->total;\n";
$output .= "?>";
// return compiled code
return $output;

View File

@@ -0,0 +1,25 @@
<?php
/**
* Smarty method disableCacheModifyCheck
*
* Disable cache modify check
*
* @package Smarty
* @subpackage SmartyMethod
* @author Uwe Tews
*/
/**
* Smarty class disableCacheModifyCheck
*
* Disable cache modify check
*/
class Smarty_Method_disableCacheModifyCheck extends Smarty_Internal_Base {
public function execute()
{
return $this->smarty->cache_modified_check = false;
}
}
?>

View File

@@ -0,0 +1,25 @@
<?php
/**
* Smarty method disableConfigBooleanize
*
* Disable config booleanize mode
*
* @package Smarty
* @subpackage SmartyMethod
* @author Uwe Tews
*/
/**
* Smarty class disableConfigBooleanize
*
* Disable config booleanize mode
*/
class Smarty_Method_disableConfigBooleanize extends Smarty_Internal_Base {
public function execute()
{
return $this->smarty->config_booleanize = false;
}
}
?>

View File

@@ -0,0 +1,25 @@
<?php
/**
* Smarty method disableConfigOverwrite
*
* Disable config overwrite mode
*
* @package Smarty
* @subpackage SmartyMethod
* @author Uwe Tews
*/
/**
* Smarty class disableConfigOverwrite
*
* Disable config overwrite mode
*/
class Smarty_Method_disableConfigOverwrite extends Smarty_Internal_Base {
public function execute()
{
return $this->smarty->config_overwrite = false;
}
}
?>

View File

@@ -0,0 +1,25 @@
<?php
/**
* Smarty method disableConfigReadHidden
*
* Disable config read hidden mode
*
* @package Smarty
* @subpackage SmartyMethod
* @author Uwe Tews
*/
/**
* Smarty class disableConfigReadHidden
*
* Disable config read hidden mode
*/
class Smarty_Method_disableConfigReadHidden extends Smarty_Internal_Base {
public function execute()
{
return $this->smarty->config_read_hidden = false;
}
}
?>

View File

@@ -0,0 +1,25 @@
<?php
/**
* Smarty method disableDefaultTimezone
*
* Disable setting of default timezone
*
* @package Smarty
* @subpackage SmartyMethod
* @author Uwe Tews
*/
/**
* Smarty class disableDefaultTimezone
*
* Disable setting of default timezone
*/
class Smarty_Method_disableDefaultTimezone extends Smarty_Internal_Base {
public function execute()
{
return $this->smarty->set_timezone = false;
}
}
?>

View File

@@ -0,0 +1,25 @@
<?php
/**
* Smarty method enableCacheModifyCheck
*
* Enable cache modify check
*
* @package Smarty
* @subpackage SmartyMethod
* @author Uwe Tews
*/
/**
* Smarty class enableCacheModifyCheck
*
* Enable cache modify check
*/
class Smarty_Method_enableCacheModifyCheck extends Smarty_Internal_Base {
public function execute()
{
return $this->smarty->cache_modified_check = true;
}
}
?>

View File

@@ -0,0 +1,25 @@
<?php
/**
* Smarty method enableConfigBooleanize
*
* Enable config booleanize mode
*
* @package Smarty
* @subpackage SmartyMethod
* @author Uwe Tews
*/
/**
* Smarty class enableConfigBooleanize
*
* Enable config booleanize mode
*/
class Smarty_Method_enableConfigBooleanize extends Smarty_Internal_Base {
public function execute()
{
return $this->smarty->config_booleanize = true;
}
}
?>

View File

@@ -0,0 +1,25 @@
<?php
/**
* Smarty method enableConfigOverwrite
*
* Enable config overwrite mode
*
* @package Smarty
* @subpackage SmartyMethod
* @author Uwe Tews
*/
/**
* Smarty class enableConfigOverwrite
*
* Enable config overwrite mode
*/
class Smarty_Method_enableConfigOverwrite extends Smarty_Internal_Base {
public function execute()
{
return $this->smarty->config_overwrite = true;
}
}
?>

View File

@@ -0,0 +1,25 @@
<?php
/**
* Smarty method enableConfigReadHidden
*
* Enable config read hidden mode
*
* @package Smarty
* @subpackage SmartyMethod
* @author Uwe Tews
*/
/**
* Smarty class enableConfigReadHidden
*
* Enable config read hidden mode
*/
class Smarty_Method_enableConfigReadHidden extends Smarty_Internal_Base {
public function execute()
{
return $this->smarty->config_read_hidden = true;
}
}
?>

View File

@@ -0,0 +1,25 @@
<?php
/**
* Smarty method enableDefaultTimezone
*
* Enable setting of default timezone
*
* @package Smarty
* @subpackage SmartyMethod
* @author Uwe Tews
*/
/**
* Smarty class enableDefaultTimezone
*
* Enable setting of default timezone
*/
class Smarty_Method_enableDefaultTimezone extends Smarty_Internal_Base {
public function execute()
{
return $this->smarty->set_timezone = true;
}
}
?>