From a413a2a2e1025f36e22f60284d64240e0b0de6a5 Mon Sep 17 00:00:00 2001 From: uwetews Date: Sun, 23 Aug 2015 01:50:05 +0200 Subject: [PATCH] replace unneeded instanceof conditions --- libs/sysplugins/smarty_internal_data.php | 2 +- libs/sysplugins/smarty_internal_debug.php | 14 +++++++------- libs/sysplugins/smarty_internal_method_gettags.php | 4 ++-- libs/sysplugins/smarty_internal_nocache_insert.php | 2 +- libs/sysplugins/smarty_internal_resource_file.php | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libs/sysplugins/smarty_internal_data.php b/libs/sysplugins/smarty_internal_data.php index ea948256..9c780bc5 100644 --- a/libs/sysplugins/smarty_internal_data.php +++ b/libs/sysplugins/smarty_internal_data.php @@ -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; } diff --git a/libs/sysplugins/smarty_internal_debug.php b/libs/sysplugins/smarty_internal_debug.php index a30d1a70..b63039c2 100644 --- a/libs/sysplugins/smarty_internal_debug.php +++ b/libs/sysplugins/smarty_internal_debug.php @@ -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'; diff --git a/libs/sysplugins/smarty_internal_method_gettags.php b/libs/sysplugins/smarty_internal_method_gettags.php index 347983d2..3a96b508 100644 --- a/libs/sysplugins/smarty_internal_method_gettags.php +++ b/libs/sysplugins/smarty_internal_method_gettags.php @@ -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 */ diff --git a/libs/sysplugins/smarty_internal_nocache_insert.php b/libs/sysplugins/smarty_internal_nocache_insert.php index f9c9c120..916bd8cc 100644 --- a/libs/sysplugins/smarty_internal_nocache_insert.php +++ b/libs/sysplugins/smarty_internal_nocache_insert.php @@ -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; } diff --git a/libs/sysplugins/smarty_internal_resource_file.php b/libs/sysplugins/smarty_internal_resource_file.php index 7c9ced40..2fe2421f 100644 --- a/libs/sysplugins/smarty_internal_resource_file.php +++ b/libs/sysplugins/smarty_internal_resource_file.php @@ -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' && @@ -104,7 +104,7 @@ class Smarty_Internal_Resource_File extends Smarty_Resource return false; } - /** + /** * populate Source Object with meta data from Resource * * @param Smarty_Template_Source $source source object