public function parse_console() { $txt = ''; $d = array(); $d['stats'] = Debug::point(); $d['logSql'] = Db::get_logReq(); $d['globData'] = $this->global_data; $d['data'] = $this->data; $d['block'] = array(); $d['parsed'] = array(); foreach ($this->block as $k => $block) { $v = (array) $block; $v['file'] = !empty($block['file']) ? $block['file'] : null; $v['file'] = htmlentities(substr($block['file'], 0, 300), null, 'UTF-8'); if (isset($this->logBlock[$k])) { $v['duration'] = $this->logBlock[$k]['duration']; $v['memory'] = $this->logBlock[$k]['memory']; $v['memory_peak'] = $this->logBlock[$k]['memory_peak']; } $d['block'][] = $v; } foreach ($this->parsed as $block) { $v = (array) $block; $v['file'] = htmlentities(substr($block['file'], 0, 300), null, 'UTF-8'); $v['current_file'] = htmlentities(substr($block['current_file'], 0, 300), null, 'UTF-8'); if (isset($this->logBlock[$block['name']])) { $v['duration'] = $this->logBlock[$block['name']]['duration']; $v['memory'] = $this->logBlock[$block['name']]['memory']; $v['memory_peak'] = $this->logBlock[$block['name']]['memory_peak']; } $d['parsed'][] = $v; } $d['log'] = Logger::getLog(); $file = dirname(__FILE__) . '/tpl_console.php'; $data = new TemplateData($d); try { $txt = $this->parse($data, $file); $txt = json_encode($txt); $txt = "<!-- start Console --> \n <iframe style='width:100%;' id='4p_console_content' ></iframe>\n <script>// <!--\n var \$4pConsole = document.getElementById('4p_console_content').contentWindow.document;\n \$4pConsole.open();\n \$4pConsole.write({$txt});\n \$4pConsole.close(); \n function \$4presizeIframe(obj) { \n obj.style.height = (obj.contentWindow.document.body.scrollHeight+500) + 'px';\n }\n \$4presizeIframe(document.getElementById('4p_console_content'));\n // -->\n </script>\n <!-- end Console -->\r\n"; } catch (\Exception $e) { var_dump($e); die('parse_console error'); } return $txt; }