- bugfix on changes of 05/02/2010

This commit is contained in:
Uwe.Tews
2010-02-07 22:21:37 +00:00
parent d19fbb19d9
commit 7bfa54f067

View File

@@ -220,6 +220,8 @@ class Smarty extends Smarty_Internal_Data {
public $_dir_perms = 0771; public $_dir_perms = 0771;
// smarty object reference // smarty object reference
public $smarty = null; public $smarty = null;
// block data at template inheritance
public $block_data = array();
// generate deprecated function call notices? // generate deprecated function call notices?
public $deprecation_notices = true; public $deprecation_notices = true;
@@ -428,6 +430,13 @@ class Smarty extends Smarty_Internal_Data {
} }
} }
/**
* Disable security
*/
public function disableSecurity() {
$this->security = true;
}
/** /**
* Set template directory * Set template directory
* *
@@ -449,13 +458,6 @@ class Smarty extends Smarty_Internal_Data {
return; return;
} }
/**
* Enable Caching
*/
public function enableCaching() {
$this->caching = SMARTY_CACHING_LIFETIME_CURRENT;
return;
}
/** /**
* Check if a template resource exists * Check if a template resource exists
@@ -463,8 +465,7 @@ class Smarty extends Smarty_Internal_Data {
* @param string $resource_name template name * @param string $resource_name template name
* @return boolean status * @return boolean status
*/ */
function templateExists($resource_name) function templateExists($resource_name) {
{
// create template object // create template object
$tpl = new $this->template_class($resource_name, $this); $tpl = new $this->template_class($resource_name, $this);
// check if it does exists // check if it does exists
@@ -526,8 +527,7 @@ class Smarty extends Smarty_Internal_Data {
* @param string $name filter name * @param string $name filter name
* @return bool * @return bool
*/ */
function loadFilter($type, $name) function loadFilter($type, $name) {
{
$_plugin = "smarty_{$type}filter_{$name}"; $_plugin = "smarty_{$type}filter_{$name}";
$_filter_name = $_plugin; $_filter_name = $_plugin;
if ($this->loadPlugin($_plugin)) { if ($this->loadPlugin($_plugin)) {
@@ -568,8 +568,7 @@ class Smarty extends Smarty_Internal_Data {
* *
* @param callback $function_name * @param callback $function_name
*/ */
public function _get_filter_name($function_name) public function _get_filter_name($function_name) {
{
if (is_array($function_name)) { if (is_array($function_name)) {
$_class_name = (is_object($function_name[0]) ? $_class_name = (is_object($function_name[0]) ?
get_class($function_name[0]) : $function_name[0]); get_class($function_name[0]) : $function_name[0]);
@@ -587,8 +586,7 @@ class Smarty extends Smarty_Internal_Data {
* @param string $ |array $ plugins folder * @param string $ |array $ plugins folder
* @return * @return
*/ */
function addPluginsDir($plugins_dir) function addPluginsDir($plugins_dir) {
{
$this->plugins_dir = array_merge((array)$this->plugins_dir, (array)$plugins_dir); $this->plugins_dir = array_merge((array)$this->plugins_dir, (array)$plugins_dir);
$this->plugins_dir = array_unique($this->plugins_dir); $this->plugins_dir = array_unique($this->plugins_dir);
return; return;
@@ -601,15 +599,16 @@ class Smarty extends Smarty_Internal_Data {
* @param string $varname variable name or null * @param string $varname variable name or null
* @return string variable value or or array of variables * @return string variable value or or array of variables
*/ */
function getGlobal($varname = null) function getGlobal($varname = null) {
{
if (isset($varname)) { if (isset($varname)) {
if (isset($this->global_tpl_vars[$varname])) { if (isset($this->global_tpl_vars[$varname])) {
return $this->global_tpl_vars[$varname]->value; return $this->global_tpl_vars[$varname]->value;
} else { }
else {
return ''; return '';
} }
} else { }
else {
$_result = array(); $_result = array();
foreach ($this->global_tpl_vars AS $key => $var) { foreach ($this->global_tpl_vars AS $key => $var) {
$_result[$key] = $var->value; $_result[$key] = $var->value;
@@ -624,8 +623,7 @@ class Smarty extends Smarty_Internal_Data {
* @param string $name object name * @param string $name object name
* @return object * @return object
*/ */
function getRegisteredObject($name) function getRegisteredObject($name) {
{
if (!isset($this->registered_objects[$name])) if (!isset($this->registered_objects[$name]))
throw new Exception("'$name' is not a registered object"); throw new Exception("'$name' is not a registered object");
@@ -640,8 +638,7 @@ class Smarty extends Smarty_Internal_Data {
* *
* @return string * @return string
*/ */
function getDebugTemplate() function getDebugTemplate() {
{
return $this->debug_tpl; return $this->debug_tpl;
} }
@@ -651,8 +648,7 @@ class Smarty extends Smarty_Internal_Data {
* @param string $tpl_name * @param string $tpl_name
* @return bool * @return bool
*/ */
function setDebugTemplate($tpl_name) function setDebugTemplate($tpl_name) {
{
return $this->debug_tpl = $tpl_name; return $this->debug_tpl = $tpl_name;
} }
@@ -686,7 +682,6 @@ class Smarty extends Smarty_Internal_Data {
throw new Exception('Please use parent::__construct() to call parent constuctor'); throw new Exception('Please use parent::__construct() to call parent constuctor');
return false; return false;
} }
// see if this is a set/get for a property // see if this is a set/get for a property
$first3 = strtolower(substr($name, 0, 3)); $first3 = strtolower(substr($name, 0, 3));
if(in_array($first3, array('set', 'get')) && substr($name, 3, 1) !== '_') { if(in_array($first3, array('set', 'get')) && substr($name, 3, 1) !== '_') {
@@ -704,7 +699,6 @@ class Smarty extends Smarty_Internal_Data {
else else
return $this->$property_name = $args[0]; return $this->$property_name = $args[0];
} }
// Smarty Backward Compatible wrapper // Smarty Backward Compatible wrapper
if(!isset($this->wrapper)) { if(!isset($this->wrapper)) {
$this->wrapper = new Smarty_Internal_Wrapper($this); $this->wrapper = new Smarty_Internal_Wrapper($this);