mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
replace unneeded instanceof conditions
This commit is contained in:
@@ -163,7 +163,7 @@ class Smarty_Internal_Data
|
||||
if ($varname != '') {
|
||||
Smarty::$global_tpl_vars[$varname] = new Smarty_Variable($value, $nocache);
|
||||
$ptr = $this;
|
||||
while ($ptr instanceof Smarty_Internal_Template) {
|
||||
while ($ptr->_objType == 2) {
|
||||
$ptr->tpl_vars[$varname] = clone Smarty::$global_tpl_vars[$varname];
|
||||
$ptr = $ptr->parent;
|
||||
}
|
||||
|
@@ -200,7 +200,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
$savedIndex = $this->index;
|
||||
$this->index = 9999;
|
||||
}
|
||||
if ($obj instanceof Smarty) {
|
||||
if ($obj->_objType == 1) {
|
||||
$smarty = $obj;
|
||||
} else {
|
||||
$smarty = $obj->smarty;
|
||||
@@ -239,10 +239,10 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
$debugging = $smarty->debugging;
|
||||
|
||||
$_template = new Smarty_Internal_Template($debObj->debug_tpl, $debObj);
|
||||
if ($obj instanceof Smarty_Internal_Template) {
|
||||
if ($obj->_objType == 2) {
|
||||
$_template->assign('template_name', $obj->source->type . ':' . $obj->source->name);
|
||||
}
|
||||
if ($obj instanceof Smarty || $full) {
|
||||
if ($obj->_objType == 1 || $full) {
|
||||
$_template->assign('template_data', $this->template_data[$this->index]);
|
||||
} else {
|
||||
$_template->assign('template_data', null);
|
||||
@@ -273,9 +273,9 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
$config_vars = array();
|
||||
foreach ($obj->config_vars as $key => $var) {
|
||||
$config_vars[$key]['value'] = $var;
|
||||
if ($obj instanceof Smarty_Internal_Template) {
|
||||
if ($obj->_objType == 2) {
|
||||
$config_vars[$key]['scope'] = $obj->source->type . ':' . $obj->source->name;
|
||||
} elseif ($obj instanceof Smarty_Data) {
|
||||
} elseif ($obj->_objType == 4) {
|
||||
$tpl_vars[$key]['scope'] = $obj->dataObjectName;
|
||||
} else {
|
||||
$config_vars[$key]['scope'] = 'Smarty object';
|
||||
@@ -298,9 +298,9 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($obj instanceof Smarty_Internal_Template) {
|
||||
if ($obj->_objType == 2) {
|
||||
$tpl_vars[$key]['scope'] = $obj->source->type . ':' . $obj->source->name;
|
||||
} elseif ($obj instanceof Smarty_Data) {
|
||||
} elseif ($obj->_objType == 4) {
|
||||
$tpl_vars[$key]['scope'] = $obj->dataObjectName;
|
||||
} else {
|
||||
$tpl_vars[$key]['scope'] = 'Smarty object';
|
||||
|
@@ -34,9 +34,9 @@ class Smarty_Internal_Method_GetTags
|
||||
{
|
||||
/* @var Smarty $smarty */
|
||||
$smarty = isset($this->smarty) ? $this->smarty : $obj;
|
||||
if ($obj instanceof Smarty_Internal_Template && !isset($template)) {
|
||||
if ($obj->_objType == 2 && !isset($template)) {
|
||||
$tpl = clone $obj;
|
||||
} elseif (isset($template) && $template instanceof Smarty_Internal_Template) {
|
||||
} elseif (isset($template) && $template->_objType == 2) {
|
||||
$tpl = clone $template;
|
||||
} elseif (isset($template) && is_string($template)) {
|
||||
/* @var Smarty_Internal_Template $tpl */
|
||||
|
@@ -42,7 +42,7 @@ class Smarty_Internal_Nocache_Insert
|
||||
$_output .= "echo {$_function}(" . var_export($_attr, true) . ",\$_smarty_tpl);?>";
|
||||
}
|
||||
$_tpl = $_template;
|
||||
while ($_tpl->parent instanceof Smarty_Internal_Template) {
|
||||
while ($_tpl->parent->_objType == 2) {
|
||||
$_tpl = $_tpl->parent;
|
||||
}
|
||||
|
||||
|
@@ -35,7 +35,7 @@ class Smarty_Internal_Resource_File extends Smarty_Resource
|
||||
return is_file($file) ? $file : false;
|
||||
}
|
||||
// go relative to a given template?
|
||||
if ($file[0] == '.' && $_template && $_template->parent instanceof Smarty_Internal_Template &&
|
||||
if ($file[0] == '.' && $_template && $_template->parent->_objType == 2 &&
|
||||
preg_match('#^[.]{1,2}[\\\/]#', $file)
|
||||
) {
|
||||
if ($_template->parent->source->type != 'file' && $_template->parent->source->type != 'extends' &&
|
||||
|
Reference in New Issue
Block a user