Exemplo n.º 1
0
 public function showLog()
 {
     $out = "";
     if ($this->DocLister->getDebug() > 0 && is_array($this->_log)) {
         foreach ($this->_log as $item) {
             $item['time'] = isset($item['time']) ? round(floatval($item['time']), 5) : 0;
             $item['start'] = isset($item['start']) ? round(floatval($item['start']), 5) : 0;
             if (isset($item['msg'])) {
                 if (is_scalar($item['msg'])) {
                     $item['msg'] = array($item['msg']);
                 }
                 if (is_scalar($item['format'])) {
                     $item['format'] = array($item['format']);
                 }
                 $message = '';
                 $i = 0;
                 foreach ($item['msg'] as $title => $msg) {
                     $format = isset($item['format'][$i]) ? $item['format'][$i] : null;
                     switch ($format) {
                         case 'sql':
                             $msg = $this->dumpData(Formatter\SqlFormatter::format($msg), '', null);
                             break;
                         case 'html':
                             $msg = is_numeric($msg) ? $msg : $this->dumpData(Formatter\HtmlFormatter::format($msg), '', null);
                             break;
                         default:
                             $msg = $this->dumpData($msg);
                             break;
                     }
                     if (!empty($title) && !is_numeric($title)) {
                         $message .= $this->DocLister->parseChunk('@CODE:<strong>[+title+]</strong>: [+msg+]<br />', compact('msg', 'title'));
                     } else {
                         $message .= $msg;
                     }
                     $i++;
                 }
                 $item['msg'] = $message;
             } else {
                 $item['msg'] = '';
             }
             $tpl = '<li>
                         <strong>action time</strong>: <em>[+time+]</em> &middot; <strong>total time</strong>: <em>[+start+]</em><br />
                         <blockquote>[+msg+]</blockquote>
                 </li>';
             $out .= $this->DocLister->parseChunk("@CODE: " . $tpl, $item);
         }
         if (!empty($out)) {
             $out = $this->DocLister->parseChunk("@CODE:\r\n                <style>.dlDebug{\r\n                    background: #eee !important;\r\n                    padding:0 !important;\r\n                    margin: 0 !important;\r\n                    text-align:left;\r\n                    font-size:14px !important;\r\n                    width:100%;\r\n                    z-index:999;\r\n                }\r\n                .dlDebug > ul{\r\n                    list-style:none !important;\r\n                    padding: 3px !important;\r\n                    margin: 0 !important;\r\n                    border: 2px solid #000;\r\n                }\r\n                .dlDebug > ul > li{\r\n                    border-top: 1px solid #000 !important;\r\n                    background: none;\r\n                    margin: 0;\r\n                    padding: 0;\r\n                    width:100%;\r\n                }\r\n                .dlDebug > ul > li:first-child {\r\n                    border-top: 0 !important;\r\n                }\r\n                .dlDebug > ul > li > blockquote{\r\n                    border-left: 4px solid #aaa !important;\r\n                    font-family: monospace !important;\r\n                    margin: 5px 0 !important;\r\n                    padding:5px !important;\r\n\r\n                    word-wrap: break-word !important;\r\n                    white-space: pre-wrap !important;\r\n                    white-space: -moz-pre-wrap !important;\r\n                    white-space: -pre-wrap !important;\r\n                    white-space: -o-pre-wrap !important;\r\n                    word-break: break-all !important;\r\n                }\r\n                </style>\r\n                <div class=\"dlDebug\"><ul>[+wrap+]</ul></div>", array('wrap' => $out));
         }
     }
     return $out;
 }
Exemplo n.º 2
0
 public function showLog()
 {
     $out = "";
     if ($this->DocLister->getDebug() > 0 && is_array($this->_log)) {
         foreach ($this->_log as $item) {
             $item['time'] = isset($item['time']) ? round(floatval($item['time']), 5) : 0;
             $item['start'] = isset($item['start']) ? round(floatval($item['start']), 5) : 0;
             if (isset($item['msg'])) {
                 $item['msg'] = $this->dumpData($item['msg']);
             } else {
                 $item['msg'] = '';
             }
             $tpl = '<li>
                         <strong>action time</strong>: <em>[+time+]</em> &middot; <strong>total time</strong>: <em>[+start+]</em><br />
                         <blockquote>[+msg+]</blockquote>
                 </li>';
             $out .= $this->DocLister->parseChunk("@CODE: " . $tpl, $item);
         }
         if (!empty($out)) {
             $out = $this->DocLister->parseChunk("@CODE:\r\n                <style>.dlDebug{\r\n                    background: #eee !important;\r\n                    padding:0 !important;\r\n                    margin: 0 !important;\r\n                    text-align:left;\r\n                    font-size:14px !important;\r\n                    width:100%;\r\n                    z-index:999;\r\n                }\r\n                .dlDebug > ul{\r\n                    list-style:none !important;\r\n                    padding: 3px !important;\r\n                    margin: 0 !important;\r\n                    border: 2px solid #000;\r\n                }\r\n                .dlDebug > ul > li{\r\n                    border-top: 1px solid #000 !important;\r\n                    background: none;\r\n                    margin: 0;\r\n                    padding: 0;\r\n                    width:100%;\r\n                }\r\n                .dlDebug > ul > li:first-child {\r\n                    border-top: 0 !important;\r\n                }\r\n                .dlDebug > ul > li > blockquote{\r\n                    border-left: 4px solid #aaa !important;\r\n                    font-family: monospace !important;\r\n                    margin: 5px 0 !important;\r\n                    padding:5px !important;\r\n\r\n                    word-wrap: break-word !important;\r\n                    white-space: pre-wrap !important;\r\n                    white-space: -moz-pre-wrap !important;\r\n                    white-space: -pre-wrap !important;\r\n                    white-space: -o-pre-wrap !important;\r\n                    word-break: break-all !important;\r\n                }\r\n                </style>\r\n                <div class=\"dlDebug\"><ul>[+wrap+]</ul></div>", array('wrap' => $out));
         }
     }
     return $out;
 }