public function __destruct() { unset($this->config, $this->cookie, $this->session, $this->input, $this->router); memory_clear(); }
public function __destruct() { unset($this->_properties, $this->_classId); memory_clear(); }
public function display($content) { if (!$this->render) { if (!headers_sent() && array_count($this->_headers) > 0) { foreach ($this->_headers as $key => $val) { header($val); } } http_cache_off(); if (!Cookie::isSaved()) { cookie()->save(); } if (wasp_strlen($content) > 102400) { @ini_set('zlib.output_compression', 1); } echo $this->getDebugInfo($content); return; } $templater = new \Smarty(); $templater->enableSecurity('Wasp_Smarty_Security'); $templater->setTemplateDir($this->getThemePath() . DIR_SEP); $temp_dir = TEMP_DIR . DIR_SEP . 'smarty' . DIR_SEP . $this->getThemeName(); if (!is_dir($temp_dir)) { wasp_mkdir($temp_dir); } $templater->setCompileDir($temp_dir . DIR_SEP); if (array_count($this->_assigns) > 0) { foreach ($this->_assigns as $key => $val) { $templater->assign($key, $val); } } $templater->assign('content', $content); if (function_exists('memory_get_peak_usage')) { $templater->assign('max_mem_use', get_mem_use(true)); } else { $templater->assign('max_mem_use', '-//-'); } $out = $templater->fetch($this->_layout); if (!headers_sent() && array_count($this->_headers) > 0) { foreach ($this->_headers as $key => $val) { header($val); } } if (!Cookie::isSaved()) { cookie()->save(); } if (wasp_strlen($out) > 102400) { ini_set('zlib.output_compression', 1); } unset($templater); memory_clear(); /** * Add CSS */ if (array_count($this->_css_list) > 0) { $_ = "\n\t\t<!-- DYNAMIC CSS -->\n"; foreach ($this->_css_list as $key => $val) { if (preg_match('/^http/is', $val)) { $_ .= "\t\t<link href=\"{$val}\" rel=\"stylesheet\" type=\"text/css\" />\n"; } else { $url = $this->getThemeUrl() . '/css/' . $val; $_ .= "\t\t<link href=\"{$url}\" rel=\"stylesheet\" type=\"text/css\" />\n"; } } $out = preg_replace('#\\<\\/head\\>#is', $_ . "</head>\n", $out); unset($_, $key, $val, $url); } /** * Add JS */ if (array_count($this->_js_list) > 0) { $info = "\n\t\t<!-- :position DYNAMIC JS -->\n"; foreach ($this->_js_list as $pos => $item) { $_ = str_replace(':position', wasp_strtoupper($pos), "\n\t\t<!-- :position DYNAMIC JS -->\n"); if (array_count($item) > 0) { foreach ($item as $key => $val) { if (preg_match('/^http/is', $val)) { $_ .= "\t\t<script type=\"text/javascript\" src=\"{$val}\"></script>\n"; } else { $url = $this->getThemeUrl() . '/js/' . $val; $_ .= "\t\t<script type=\"text/javascript\" src=\"{$url}\"></script>\n"; } } $out = preg_replace("#\\<\\/{$pos}\\>#is", $_ . "</{$pos}>\n", $out); unset($_, $key, $val, $url); } } unset($pos, $item); } echo $this->getDebugInfo($out); }