getDebugInformation(); $NL = "\n"; $logHTML = '' . $NL . $NL; // DB PROFILER function log_iconv(&$array) { foreach ($array as $key => &$element) { if (is_string($element)) { $from = mb_detect_encoding($element, mb_detect_order(), true); if ($from) { $element = htmlspecialchars(iconv($from, 'UTF-8', $element)); } } } return true; } $logHTML .= '
' . $NL; $logHTML .= '
' . $NL; $config = Zend_Registry::get('config'); if ($config->database->params->profiler) { // Zend_Db $db = Qs_Db::getInstance($config); $profiler = $db->getProfiler(); $list = $profiler->getQueryProfiles(); $profilerHtml = ''; if (is_array($list) && !empty($list)) { $maxQueryDuration = defined('MAX_QUERY_DURATION') && MAX_QUERY_DURATION ? MAX_QUERY_DURATION : 0.5; $countHardQueries = 0; foreach ($list as $k => $v) { /** @var $v Zend_Db_Profiler_Query */ $params = $v->getQueryParams(); $color = ($k % 2 == 0) ? 'white' : '#EFEFEF'; if ($v->getElapsedSecs() >= $maxQueryDuration) { $countHardQueries++; $color = '#FFAAAA'; } $profilerHtml .= '
'; $profilerHtml .= ($k + 1) . ') [' . number_format($v->getElapsedSecs(), 3, '.', ',') . ' sec]:' . htmlspecialchars($v->getQuery()) . ' '; if (!empty($params)) { log_iconv($params); $profilerHtml .= '
   ' . $NL . 'params' . $NL . '' . $NL; } $profilerHtml .= $NL; $profilerHtml .= '
'; } $logHTML .= '
' . '
' . $NL . '' . 'DB PROFILER' . $NL . '
' . $NL . ($countHardQueries ? 'Hard Queries: ' . $countHardQueries . '
' : '') . 'Total Number of Queries: ' . $profiler->getTotalNumQueries() . '
' . $NL . 'Total Elapsed Seconds: ' . $profiler->getTotalElapsedSecs() . '
' . $NL . '' . $NL . '
' . $NL; } } if (is_array($debugList) && !empty($debugList)) { $logHTML .= '
'; $logHTML .= '
' . 'DEBUG INFO'; $logHTML .= '
'; foreach ($debugList as $k => $v) { $logHTML .= ($k + 1) . ') ' . $v['added'] . ': ' . iconv('UTF-8', 'UTF-8', $v['message']) . '
'; } $logHTML .= '
'; $logHTML .= '
'; } // page items started if (Zend_Registry::isRegistered('_pageItems')) { $tableColumns = array( array('name' => 'id', 'title' => 'ID', 'type' => 'text'), array('name' => 'groupName', 'title' => 'Group', 'type' => 'text'), array('name' => 'type', 'title' => 'Type', 'type' => 'text'), array('name' => 'executed', 'title' => 'Executed', 'type' => 'bool'), array('name' => 'config', 'title' => 'Config', 'type' => 'array'), ); $pageItems = (array) Zend_Registry::get('_pageItems'); $logHTML .= '
' . $NL; $logHTML .= 'PAGE ITEMS' . $NL; $logHTML .= '' . $NL; $logHTML .= ''; foreach ($tableColumns as $column) { $logHTML .= ''; } $logHTML .= '' . $NL; if (!empty($pageItems)) { foreach ($pageItems as $i) { foreach ($tableColumns as $column) { $value = ' '; switch ($column['type']) { case 'bool': $value = (isset($i[$column['name']]) && $i[$column['name']]) ? 'Yes' : 'No'; break; case 'array': $value = (isset($i[$column['name']])) ? json_encode($i[$column['name']]) : ' '; break; case 'text': // break omitted default: $value = (isset($i[$column['name']])) ? $i[$column['name']] : ' '; } $logHTML .= ''; } $logHTML .= '' . $NL; } } else { $logHTML .= '' . $NL; } $logHTML .= '
' . htmlspecialchars($column['title']) . '
' . htmlspecialchars($value) . '
No items found
' . $NL; } // page items finished // side blocks started if (Zend_Registry::isRegistered('_pageSideBlocks')) { $sideBlocks = (array) Zend_Registry::get('_pageSideBlocks'); $logHTML .= '
' . $NL; $logHTML .= 'SIDE BLOCKS' . $NL; $logHTML .= '' . $NL; $logHTML .= '' . $NL; if (!empty($sideBlocks)) { foreach ($sideBlocks as $b) { $logHTML .= '' . '' . '' . '' . '' . '' . '' . '' . $NL; } } else { $logHTML .= '' . $NL; } $logHTML .= '
IDTypeTitlePagesLink TypeLink URL
' . $b['id'] . '' . ucfirst($b['blockType']) . '' . htmlspecialchars($b['title']) . '' . ucfirst($b['pageType']) . '' . ucfirst($b['linkType']) . '' . (($b['linkType'] == 'none') ? ' ' : htmlspecialchars($b['linkUrl'])) . '
No blocks found
' . $NL; } // side blocks finished $logHTML .= '
' . '
SCRIPT DURATION: ' . (microtime(true) - SCRIPT_START) . '
'; $logHTML .= '
'; // end of qsf-debug-container return $logHTML;