removed unnecessary instanciations

This commit is contained in:
Ralf Becker 2008-03-21 20:54:28 +00:00
parent 0092208ab2
commit 84c1ac74f0

View File

@ -97,15 +97,11 @@ class etemplate extends boetemplate
*/ */
function etemplate($name='',$load_via='') function etemplate($name='',$load_via='')
{ {
if (!is_object($GLOBALS['egw']->template))
{
$GLOBALS['egw']->template =& CreateObject('phpgwapi.Template');
}
$this->boetemplate($name,$load_via); $this->boetemplate($name,$load_via);
$this->xslt = is_object($GLOBALS['egw']->xslttpl); //$this->xslt = is_object($GLOBALS['egw']->xslttpl);
$this->sitemgr = is_object($GLOBALS['Common_BO']); $this->sitemgr = isset($GLOBALS['Common_BO']) && is_object($GLOBALS['Common_BO']);
if (($this->innerWidth = (int) $_POST['innerWidth'])) if (($this->innerWidth = (int) $_POST['innerWidth']))
{ {
@ -235,8 +231,8 @@ class etemplate extends boetemplate
} }
elseif (!$this->xslt) elseif (!$this->xslt)
{ {
$hooked = isset($GLOBALS['egw_info']['etemplate']['content']) ? $GLOBALS['egw_info']['etemplate']['content'] : $hooked = isset($GLOBALS['egw_info']['etemplate']['content']) || !isset($GLOBALS['egw']->template) ?
$GLOBALS['egw']->template->get_var('phpgw_body'); $GLOBALS['egw_info']['etemplate']['content'] : $GLOBALS['egw']->template->get_var('phpgw_body');
if (!@$GLOBALS['egw_info']['etemplate']['hooked'] && (int) $output_mode != 1 && (int) $output_mode != -1) // not just returning the html if (!@$GLOBALS['egw_info']['etemplate']['hooked'] && (int) $output_mode != 1 && (int) $output_mode != -1) // not just returning the html
{ {
@ -498,10 +494,6 @@ class etemplate extends boetemplate
$GLOBALS['egw_info']['flags']['java_script'] .= $session_data['java_script_from_flags']; $GLOBALS['egw_info']['flags']['java_script'] .= $session_data['java_script_from_flags'];
if (!empty($session_data['java_script_body_tags'])) if (!empty($session_data['java_script_body_tags']))
{ {
if( !is_object($GLOBALS['egw']->js))
{
$GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript');
}
foreach ($session_data['java_script_body_tags'] as $tag => $code) foreach ($session_data['java_script_body_tags'] as $tag => $code)
{ {
//error_log($GLOBALS['egw']->js->body[$tag]); //error_log($GLOBALS['egw']->js->body[$tag]);
@ -510,10 +502,6 @@ class etemplate extends boetemplate
} }
if (is_array($session_data['java_script_files'])) if (is_array($session_data['java_script_files']))
{ {
if( !is_object($GLOBALS['egw']->js))
{
$GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript');
}
$GLOBALS['egw']->js->files = !is_array($GLOBALS['egw']->js->files) ? $session_data['java_script_files'] : $GLOBALS['egw']->js->files = !is_array($GLOBALS['egw']->js->files) ? $session_data['java_script_files'] :
$this->complete_array_merge($GLOBALS['egw']->js->files,$session_data['java_script_files']); $this->complete_array_merge($GLOBALS['egw']->js->files,$session_data['java_script_files']);
} }
@ -650,10 +638,6 @@ class etemplate extends boetemplate
{ {
return $cat2color[$cat]; return $cat2color[$cat];
} }
if (!is_object($GLOBALS['egw']->categories))
{
$GLOBALS['egw']->categories = new categories();
}
$data = unserialize($GLOBALS['egw']->categories->id2name($cat,'data')); $data = unserialize($GLOBALS['egw']->categories->id2name($cat,'data'));
if (($color = $data['color'])) if (($color = $data['color']))