@@ -14,42 +14,42 @@ |
||
| 14 | 14 | class Display |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - /** @var array */ |
|
| 18 | - protected $output; |
|
| 19 | - |
|
| 20 | - public function __construct() |
|
| 21 | - { |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - public function setConsoleData(array $console_data) |
|
| 25 | - { |
|
| 26 | - $this->output['console'] = $console_data; |
|
| 27 | - } |
|
| 28 | - |
|
| 29 | - public function setFileData(array $file_data) |
|
| 30 | - { |
|
| 31 | - $this->output['files'] = $file_data['files']; |
|
| 32 | - $this->output['fileTotals'] = $file_data['fileTotals']; |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - public function setMemoryData(array $memory_data) |
|
| 36 | - { |
|
| 37 | - $this->output['memoryTotals'] = $memory_data; |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - public function setQueryData(array $query_data) |
|
| 41 | - { |
|
| 42 | - // the void |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - public function setSpeedData(array $speed_data) |
|
| 46 | - { |
|
| 47 | - $this->output['speedTotals'] = $speed_data; |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - public function __invoke() |
|
| 51 | - { |
|
| 52 | - $output = $this->output; |
|
| 53 | - require_once __DIR__ .'/../asset/display.tpl.php'; |
|
| 54 | - } |
|
| 17 | + /** @var array */ |
|
| 18 | + protected $output; |
|
| 19 | + |
|
| 20 | + public function __construct() |
|
| 21 | + { |
|
| 22 | + } |
|
| 23 | + |
|
| 24 | + public function setConsoleData(array $console_data) |
|
| 25 | + { |
|
| 26 | + $this->output['console'] = $console_data; |
|
| 27 | + } |
|
| 28 | + |
|
| 29 | + public function setFileData(array $file_data) |
|
| 30 | + { |
|
| 31 | + $this->output['files'] = $file_data['files']; |
|
| 32 | + $this->output['fileTotals'] = $file_data['fileTotals']; |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + public function setMemoryData(array $memory_data) |
|
| 36 | + { |
|
| 37 | + $this->output['memoryTotals'] = $memory_data; |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + public function setQueryData(array $query_data) |
|
| 41 | + { |
|
| 42 | + // the void |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + public function setSpeedData(array $speed_data) |
|
| 46 | + { |
|
| 47 | + $this->output['speedTotals'] = $speed_data; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + public function __invoke() |
|
| 51 | + { |
|
| 52 | + $output = $this->output; |
|
| 53 | + require_once __DIR__ .'/../asset/display.tpl.php'; |
|
| 54 | + } |
|
| 55 | 55 | } |
@@ -15,124 +15,124 @@ discard block |
||
| 15 | 15 | class PhpQuickProfiler |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - /** @var Particletree\Pqp\Console */ |
|
| 19 | - protected $console; |
|
| 18 | + /** @var Particletree\Pqp\Console */ |
|
| 19 | + protected $console; |
|
| 20 | 20 | |
| 21 | - /** @var integer */ |
|
| 22 | - protected $startTime; |
|
| 21 | + /** @var integer */ |
|
| 22 | + protected $startTime; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * @param Particletree\Pqp\Console $console |
|
| 26 | - * @param integer $startTime |
|
| 27 | - */ |
|
| 28 | - public function __construct(Console $console, $startTime = null) |
|
| 29 | - { |
|
| 30 | - $this->console = $console; |
|
| 24 | + /** |
|
| 25 | + * @param Particletree\Pqp\Console $console |
|
| 26 | + * @param integer $startTime |
|
| 27 | + */ |
|
| 28 | + public function __construct(Console $console, $startTime = null) |
|
| 29 | + { |
|
| 30 | + $this->console = $console; |
|
| 31 | 31 | |
| 32 | - if (is_null($startTime)) { |
|
| 33 | - $startTime = microtime(true); |
|
| 34 | - } |
|
| 35 | - $this->startTime = $startTime; |
|
| 36 | - } |
|
| 32 | + if (is_null($startTime)) { |
|
| 33 | + $startTime = microtime(true); |
|
| 34 | + } |
|
| 35 | + $this->startTime = $startTime; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Formats the logs from the console |
|
| 40 | - * |
|
| 41 | - * @return array |
|
| 42 | - */ |
|
| 43 | - protected function gatherConsoleData() |
|
| 44 | - { |
|
| 45 | - $console = array( |
|
| 46 | - 'messages' => array(), |
|
| 47 | - 'count' => array( |
|
| 48 | - 'log' => 0, |
|
| 49 | - 'memory' => 0, |
|
| 50 | - 'error' => 0, |
|
| 51 | - 'speed' => 0 |
|
| 52 | - ) |
|
| 53 | - ); |
|
| 38 | + /** |
|
| 39 | + * Formats the logs from the console |
|
| 40 | + * |
|
| 41 | + * @return array |
|
| 42 | + */ |
|
| 43 | + protected function gatherConsoleData() |
|
| 44 | + { |
|
| 45 | + $console = array( |
|
| 46 | + 'messages' => array(), |
|
| 47 | + 'count' => array( |
|
| 48 | + 'log' => 0, |
|
| 49 | + 'memory' => 0, |
|
| 50 | + 'error' => 0, |
|
| 51 | + 'speed' => 0 |
|
| 52 | + ) |
|
| 53 | + ); |
|
| 54 | 54 | |
| 55 | - foreach ($this->console->getLogs() as $log) { |
|
| 56 | - switch($log['type']) { |
|
| 57 | - case 'log': |
|
| 58 | - $message = array( |
|
| 59 | - 'data' => print_r($log['data'], true), |
|
| 60 | - 'type' => 'log' |
|
| 61 | - ); |
|
| 62 | - $console['count']['log']++; |
|
| 63 | - break; |
|
| 64 | - case 'memory': |
|
| 65 | - $message = array( |
|
| 66 | - 'name' => $log['name'], |
|
| 67 | - 'data' => self::getReadableFileSize($log['data']), |
|
| 68 | - 'type' => 'memory' |
|
| 69 | - ); |
|
| 70 | - if (!empty($log['data_type'])) { |
|
| 71 | - $message['data_type'] = $log['data_type']; |
|
| 72 | - } |
|
| 73 | - $console['count']['memory']++; |
|
| 74 | - break; |
|
| 75 | - case 'error': |
|
| 76 | - $message = array( |
|
| 77 | - 'data' => $log['data'], |
|
| 78 | - 'file' => $log['file'], |
|
| 79 | - 'line' => $log['line'], |
|
| 80 | - 'type' => 'error' |
|
| 81 | - ); |
|
| 82 | - $console['count']['error']++; |
|
| 83 | - break; |
|
| 84 | - case 'speed': |
|
| 85 | - $elapsedTime = $log['data'] - $this->startTime; |
|
| 86 | - $message = array( |
|
| 87 | - 'name' => $log['name'], |
|
| 88 | - 'data' => self::getReadableTime($elapsedTime), |
|
| 89 | - 'type' => 'speed' |
|
| 90 | - ); |
|
| 91 | - $console['count']['speed']++; |
|
| 92 | - break; |
|
| 93 | - default: |
|
| 94 | - $message = array( |
|
| 95 | - 'data' => "Unrecognized console log type: {$log['type']}", |
|
| 96 | - 'type' => 'error' |
|
| 97 | - ); |
|
| 98 | - $console['count']['error']++; |
|
| 99 | - break; |
|
| 100 | - } |
|
| 101 | - array_push($console['messages'], $message); |
|
| 102 | - } |
|
| 103 | - return $console; |
|
| 104 | - } |
|
| 55 | + foreach ($this->console->getLogs() as $log) { |
|
| 56 | + switch($log['type']) { |
|
| 57 | + case 'log': |
|
| 58 | + $message = array( |
|
| 59 | + 'data' => print_r($log['data'], true), |
|
| 60 | + 'type' => 'log' |
|
| 61 | + ); |
|
| 62 | + $console['count']['log']++; |
|
| 63 | + break; |
|
| 64 | + case 'memory': |
|
| 65 | + $message = array( |
|
| 66 | + 'name' => $log['name'], |
|
| 67 | + 'data' => self::getReadableFileSize($log['data']), |
|
| 68 | + 'type' => 'memory' |
|
| 69 | + ); |
|
| 70 | + if (!empty($log['data_type'])) { |
|
| 71 | + $message['data_type'] = $log['data_type']; |
|
| 72 | + } |
|
| 73 | + $console['count']['memory']++; |
|
| 74 | + break; |
|
| 75 | + case 'error': |
|
| 76 | + $message = array( |
|
| 77 | + 'data' => $log['data'], |
|
| 78 | + 'file' => $log['file'], |
|
| 79 | + 'line' => $log['line'], |
|
| 80 | + 'type' => 'error' |
|
| 81 | + ); |
|
| 82 | + $console['count']['error']++; |
|
| 83 | + break; |
|
| 84 | + case 'speed': |
|
| 85 | + $elapsedTime = $log['data'] - $this->startTime; |
|
| 86 | + $message = array( |
|
| 87 | + 'name' => $log['name'], |
|
| 88 | + 'data' => self::getReadableTime($elapsedTime), |
|
| 89 | + 'type' => 'speed' |
|
| 90 | + ); |
|
| 91 | + $console['count']['speed']++; |
|
| 92 | + break; |
|
| 93 | + default: |
|
| 94 | + $message = array( |
|
| 95 | + 'data' => "Unrecognized console log type: {$log['type']}", |
|
| 96 | + 'type' => 'error' |
|
| 97 | + ); |
|
| 98 | + $console['count']['error']++; |
|
| 99 | + break; |
|
| 100 | + } |
|
| 101 | + array_push($console['messages'], $message); |
|
| 102 | + } |
|
| 103 | + return $console; |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | 106 | /*------------------------------------------- |
| 107 | 107 | AGGREGATE DATA ON THE FILES INCLUDED |
| 108 | 108 | -------------------------------------------*/ |
| 109 | 109 | |
| 110 | 110 | public function gatherFileData() { |
| 111 | - $files = get_included_files(); |
|
| 112 | - $fileList = array(); |
|
| 113 | - $fileTotals = array( |
|
| 114 | - "count" => count($files), |
|
| 115 | - "size" => 0, |
|
| 116 | - "largest" => 0, |
|
| 117 | - ); |
|
| 111 | + $files = get_included_files(); |
|
| 112 | + $fileList = array(); |
|
| 113 | + $fileTotals = array( |
|
| 114 | + "count" => count($files), |
|
| 115 | + "size" => 0, |
|
| 116 | + "largest" => 0, |
|
| 117 | + ); |
|
| 118 | 118 | |
| 119 | - foreach($files as $file) { |
|
| 120 | - $size = filesize($file); |
|
| 121 | - $fileList[] = array( |
|
| 122 | - 'name' => $file, |
|
| 123 | - 'size' => $this->getReadableFileSize($size) |
|
| 124 | - ); |
|
| 125 | - $fileTotals['size'] += $size; |
|
| 126 | - if($size > $fileTotals['largest']) $fileTotals['largest'] = $size; |
|
| 127 | - } |
|
| 119 | + foreach($files as $file) { |
|
| 120 | + $size = filesize($file); |
|
| 121 | + $fileList[] = array( |
|
| 122 | + 'name' => $file, |
|
| 123 | + 'size' => $this->getReadableFileSize($size) |
|
| 124 | + ); |
|
| 125 | + $fileTotals['size'] += $size; |
|
| 126 | + if($size > $fileTotals['largest']) $fileTotals['largest'] = $size; |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | - $fileTotals['size'] = $this->getReadableFileSize($fileTotals['size']); |
|
| 130 | - $fileTotals['largest'] = $this->getReadableFileSize($fileTotals['largest']); |
|
| 129 | + $fileTotals['size'] = $this->getReadableFileSize($fileTotals['size']); |
|
| 130 | + $fileTotals['largest'] = $this->getReadableFileSize($fileTotals['largest']); |
|
| 131 | 131 | |
| 132 | - return array( |
|
| 133 | - 'files' => $fileList, |
|
| 134 | - 'fileTotals' => $fileTotals |
|
| 135 | - ); |
|
| 132 | + return array( |
|
| 133 | + 'files' => $fileList, |
|
| 134 | + 'fileTotals' => $fileTotals |
|
| 135 | + ); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /*------------------------------------------- |
@@ -140,10 +140,10 @@ discard block |
||
| 140 | 140 | -------------------------------------------*/ |
| 141 | 141 | |
| 142 | 142 | public function gatherMemoryData() { |
| 143 | - $memoryTotals = array(); |
|
| 144 | - $memoryTotals['used'] = $this->getReadableFileSize(memory_get_peak_usage()); |
|
| 145 | - $memoryTotals['total'] = ini_get("memory_limit"); |
|
| 146 | - return $memoryTotals; |
|
| 143 | + $memoryTotals = array(); |
|
| 144 | + $memoryTotals['used'] = $this->getReadableFileSize(memory_get_peak_usage()); |
|
| 145 | + $memoryTotals['total'] = ini_get("memory_limit"); |
|
| 146 | + return $memoryTotals; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /*-------------------------------------------------------- |
@@ -151,24 +151,24 @@ discard block |
||
| 151 | 151 | ----------------------------------------------------------*/ |
| 152 | 152 | |
| 153 | 153 | public function gatherQueryData() { |
| 154 | - $queryTotals = array(); |
|
| 155 | - $queryTotals['count'] = 0; |
|
| 156 | - $queryTotals['time'] = 0; |
|
| 157 | - $queries = array(); |
|
| 154 | + $queryTotals = array(); |
|
| 155 | + $queryTotals['count'] = 0; |
|
| 156 | + $queryTotals['time'] = 0; |
|
| 157 | + $queries = array(); |
|
| 158 | 158 | |
| 159 | - if($this->db != '') { |
|
| 160 | - $queryTotals['count'] += $this->db->queryCount; |
|
| 161 | - foreach($this->db->queries as $query) { |
|
| 162 | - $query = $this->attemptToExplainQuery($query); |
|
| 163 | - $queryTotals['time'] += $query['time']; |
|
| 164 | - $query['time'] = $this->getReadableTime($query['time']); |
|
| 165 | - $queries[] = $query; |
|
| 166 | - } |
|
| 167 | - } |
|
| 159 | + if($this->db != '') { |
|
| 160 | + $queryTotals['count'] += $this->db->queryCount; |
|
| 161 | + foreach($this->db->queries as $query) { |
|
| 162 | + $query = $this->attemptToExplainQuery($query); |
|
| 163 | + $queryTotals['time'] += $query['time']; |
|
| 164 | + $query['time'] = $this->getReadableTime($query['time']); |
|
| 165 | + $queries[] = $query; |
|
| 166 | + } |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | - $queryTotals['time'] = $this->getReadableTime($queryTotals['time']); |
|
| 170 | - $this->output['queries'] = $queries; |
|
| 171 | - $this->output['queryTotals'] = $queryTotals; |
|
| 169 | + $queryTotals['time'] = $this->getReadableTime($queryTotals['time']); |
|
| 170 | + $this->output['queries'] = $queries; |
|
| 171 | + $this->output['queryTotals'] = $queryTotals; |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /*-------------------------------------------------------- |
@@ -176,16 +176,16 @@ discard block |
||
| 176 | 176 | ----------------------------------------------------------*/ |
| 177 | 177 | |
| 178 | 178 | function attemptToExplainQuery($query) { |
| 179 | - try { |
|
| 180 | - $sql = 'EXPLAIN '.$query['sql']; |
|
| 181 | - $rs = $this->db->query($sql); |
|
| 182 | - } |
|
| 183 | - catch(Exception $e) {} |
|
| 184 | - if($rs) { |
|
| 185 | - $row = mysql_fetch_array($rs, MYSQL_ASSOC); |
|
| 186 | - $query['explain'] = $row; |
|
| 187 | - } |
|
| 188 | - return $query; |
|
| 179 | + try { |
|
| 180 | + $sql = 'EXPLAIN '.$query['sql']; |
|
| 181 | + $rs = $this->db->query($sql); |
|
| 182 | + } |
|
| 183 | + catch(Exception $e) {} |
|
| 184 | + if($rs) { |
|
| 185 | + $row = mysql_fetch_array($rs, MYSQL_ASSOC); |
|
| 186 | + $query['explain'] = $row; |
|
| 187 | + } |
|
| 188 | + return $query; |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /*------------------------------------------- |
@@ -193,10 +193,10 @@ discard block |
||
| 193 | 193 | -------------------------------------------*/ |
| 194 | 194 | |
| 195 | 195 | public function gatherSpeedData() { |
| 196 | - $speedTotals = array(); |
|
| 197 | - $speedTotals['total'] = self::getReadableTime((microtime(true) - $this->startTime)); |
|
| 198 | - $speedTotals['allowed'] = ini_get("max_execution_time"); |
|
| 199 | - return $speedTotals; |
|
| 196 | + $speedTotals = array(); |
|
| 197 | + $speedTotals['total'] = self::getReadableTime((microtime(true) - $this->startTime)); |
|
| 198 | + $speedTotals['allowed'] = ini_get("max_execution_time"); |
|
| 199 | + return $speedTotals; |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /*------------------------------------------- |
@@ -204,58 +204,58 @@ discard block |
||
| 204 | 204 | -------------------------------------------*/ |
| 205 | 205 | |
| 206 | 206 | public function getReadableFileSize($size, $retstring = null) { |
| 207 | - // adapted from code at http://aidanlister.com/repos/v/function.size_readable.php |
|
| 208 | - $sizes = array('bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); |
|
| 207 | + // adapted from code at http://aidanlister.com/repos/v/function.size_readable.php |
|
| 208 | + $sizes = array('bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); |
|
| 209 | 209 | |
| 210 | - if ($retstring === null) { $retstring = '%01.2f %s'; } |
|
| 210 | + if ($retstring === null) { $retstring = '%01.2f %s'; } |
|
| 211 | 211 | |
| 212 | - $lastsizestring = end($sizes); |
|
| 212 | + $lastsizestring = end($sizes); |
|
| 213 | 213 | |
| 214 | - foreach ($sizes as $sizestring) { |
|
| 215 | - if ($size < 1024) { break; } |
|
| 216 | - if ($sizestring != $lastsizestring) { $size /= 1024; } |
|
| 217 | - } |
|
| 218 | - if ($sizestring == $sizes[0]) { $retstring = '%01d %s'; } // Bytes aren't normally fractional |
|
| 219 | - return sprintf($retstring, $size, $sizestring); |
|
| 214 | + foreach ($sizes as $sizestring) { |
|
| 215 | + if ($size < 1024) { break; } |
|
| 216 | + if ($sizestring != $lastsizestring) { $size /= 1024; } |
|
| 217 | + } |
|
| 218 | + if ($sizestring == $sizes[0]) { $retstring = '%01d %s'; } // Bytes aren't normally fractional |
|
| 219 | + return sprintf($retstring, $size, $sizestring); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - /** |
|
| 223 | - * Static formatter for human-readable time |
|
| 224 | - * Only handles time up to 60 minutes gracefully |
|
| 225 | - * |
|
| 226 | - * @param integer $time time in seconds |
|
| 227 | - * @return string |
|
| 228 | - */ |
|
| 229 | - public static function getReadableTime($time) |
|
| 230 | - { |
|
| 231 | - $unit = 's'; |
|
| 222 | + /** |
|
| 223 | + * Static formatter for human-readable time |
|
| 224 | + * Only handles time up to 60 minutes gracefully |
|
| 225 | + * |
|
| 226 | + * @param integer $time time in seconds |
|
| 227 | + * @return string |
|
| 228 | + */ |
|
| 229 | + public static function getReadableTime($time) |
|
| 230 | + { |
|
| 231 | + $unit = 's'; |
|
| 232 | 232 | |
| 233 | - if ($time < 1) { |
|
| 234 | - $time *= 1000; |
|
| 235 | - $unit = 'ms'; |
|
| 236 | - } else if ($time > 60) { |
|
| 237 | - $time /= 60; |
|
| 238 | - $unit = 'm'; |
|
| 239 | - } |
|
| 233 | + if ($time < 1) { |
|
| 234 | + $time *= 1000; |
|
| 235 | + $unit = 'ms'; |
|
| 236 | + } else if ($time > 60) { |
|
| 237 | + $time /= 60; |
|
| 238 | + $unit = 'm'; |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | - $time = number_format($time, 3); |
|
| 242 | - return "{$time} {$unit}"; |
|
| 243 | - } |
|
| 241 | + $time = number_format($time, 3); |
|
| 242 | + return "{$time} {$unit}"; |
|
| 243 | + } |
|
| 244 | 244 | |
| 245 | 245 | |
| 246 | - /** |
|
| 247 | - * Triggers end display of the profiling data |
|
| 248 | - * |
|
| 249 | - * @param Display $display |
|
| 250 | - */ |
|
| 251 | - public function display(Display $display) |
|
| 252 | - { |
|
| 253 | - $display->setConsoleData($this->gatherConsoleData()); |
|
| 254 | - $display->setFileData($this->gatherFileData()); |
|
| 255 | - $display->setMemoryData($this->gatherMemoryData()); |
|
| 256 | - $display->setQueryData($this->gatherQueryData()); |
|
| 257 | - $display->setSpeedData($this->gatherSpeedData()); |
|
| 246 | + /** |
|
| 247 | + * Triggers end display of the profiling data |
|
| 248 | + * |
|
| 249 | + * @param Display $display |
|
| 250 | + */ |
|
| 251 | + public function display(Display $display) |
|
| 252 | + { |
|
| 253 | + $display->setConsoleData($this->gatherConsoleData()); |
|
| 254 | + $display->setFileData($this->gatherFileData()); |
|
| 255 | + $display->setMemoryData($this->gatherMemoryData()); |
|
| 256 | + $display->setQueryData($this->gatherQueryData()); |
|
| 257 | + $display->setSpeedData($this->gatherSpeedData()); |
|
| 258 | 258 | |
| 259 | - $display(); |
|
| 260 | - } |
|
| 259 | + $display(); |
|
| 260 | + } |
|
| 261 | 261 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$css = file_get_contents(__DIR__ . '/pQp.css'); |
|
| 3 | +$css = file_get_contents(__DIR__.'/pQp.css'); |
|
| 4 | 4 | |
| 5 | 5 | echo <<<JAVASCRIPT |
| 6 | 6 | <!-- JavaScript --> |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | echo '<div id="pqp-console" class="pqp-box">'; |
| 133 | 133 | |
| 134 | -if(count($output['console']) == 0) { |
|
| 134 | +if (count($output['console']) == 0) { |
|
| 135 | 135 | echo '<h3>This panel has no log items.</h3>'; |
| 136 | 136 | } |
| 137 | 137 | else { |
@@ -148,29 +148,29 @@ discard block |
||
| 148 | 148 | <table class="main" cellspacing="0">'; |
| 149 | 149 | |
| 150 | 150 | $class = ''; |
| 151 | - foreach($output['console']['messages'] as $log) { |
|
| 151 | + foreach ($output['console']['messages'] as $log) { |
|
| 152 | 152 | echo '<tr class="log-'.$log['type'].'"> |
| 153 | 153 | <td class="type">'.$log['type'].'</td> |
| 154 | 154 | <td class="'.$class.'">'; |
| 155 | - if($log['type'] == 'log') { |
|
| 155 | + if ($log['type'] == 'log') { |
|
| 156 | 156 | echo '<div><pre>'.$log['data'].'</pre></div>'; |
| 157 | 157 | } |
| 158 | - elseif($log['type'] == 'memory') { |
|
| 158 | + elseif ($log['type'] == 'memory') { |
|
| 159 | 159 | echo '<div><pre>'.$log['data'].'</pre>'; |
| 160 | 160 | if (!empty($log['data_type'])) { |
| 161 | 161 | echo '<em>'.$log['data_type'].'</em>: '; |
| 162 | 162 | } |
| 163 | 163 | echo $log['name'].' </div>'; |
| 164 | 164 | } |
| 165 | - elseif($log['type'] == 'speed') { |
|
| 165 | + elseif ($log['type'] == 'speed') { |
|
| 166 | 166 | echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['name'].'</em></div>'; |
| 167 | 167 | } |
| 168 | - elseif($log['type'] == 'error') { |
|
| 168 | + elseif ($log['type'] == 'error') { |
|
| 169 | 169 | echo '<div><em>Line '.$log['line'].'</em> : '.$log['data'].' <pre>'.$log['file'].'</pre></div>'; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | echo '</td></tr>'; |
| 173 | - if($class == '') $class = 'alt'; |
|
| 173 | + if ($class == '') $class = 'alt'; |
|
| 174 | 174 | else $class = ''; |
| 175 | 175 | } |
| 176 | 176 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | echo '<div id="pqp-speed" class="pqp-box">'; |
| 183 | 183 | |
| 184 | -if($output['console']['count']['speed'] == 0) { |
|
| 184 | +if ($output['console']['count']['speed'] == 0) { |
|
| 185 | 185 | echo '<h3>This panel has no log items.</h3>'; |
| 186 | 186 | } |
| 187 | 187 | else { |
@@ -192,13 +192,13 @@ discard block |
||
| 192 | 192 | <table class="main" cellspacing="0">'; |
| 193 | 193 | |
| 194 | 194 | $class = ''; |
| 195 | - foreach($output['console']['messages'] as $log) { |
|
| 196 | - if($log['type'] == 'speed') { |
|
| 195 | + foreach ($output['console']['messages'] as $log) { |
|
| 196 | + if ($log['type'] == 'speed') { |
|
| 197 | 197 | echo '<tr class="log-'.$log['type'].'"> |
| 198 | 198 | <td class="'.$class.'">'; |
| 199 | 199 | echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['name'].'</em></div>'; |
| 200 | 200 | echo '</td></tr>'; |
| 201 | - if($class == '') $class = 'alt'; |
|
| 201 | + if ($class == '') $class = 'alt'; |
|
| 202 | 202 | else $class = ''; |
| 203 | 203 | } |
| 204 | 204 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | echo '<div id="pqp-queries" class="pqp-box">'; |
| 212 | 212 | |
| 213 | -if($output['queryTotals']['count'] == 0) { |
|
| 213 | +if ($output['queryTotals']['count'] == 0) { |
|
| 214 | 214 | echo '<h3>This panel has no log items.</h3>'; |
| 215 | 215 | } |
| 216 | 216 | else { |
@@ -222,10 +222,10 @@ discard block |
||
| 222 | 222 | <table class="main" cellspacing="0">'; |
| 223 | 223 | |
| 224 | 224 | $class = ''; |
| 225 | - foreach($output['queries'] as $query) { |
|
| 225 | + foreach ($output['queries'] as $query) { |
|
| 226 | 226 | echo '<tr> |
| 227 | 227 | <td class="'.$class.'">'.$query['sql']; |
| 228 | - if($query['explain']) { |
|
| 228 | + if ($query['explain']) { |
|
| 229 | 229 | echo '<em> |
| 230 | 230 | Possible keys: <b>'.$query['explain']['possible_keys'].'</b> · |
| 231 | 231 | Key Used: <b>'.$query['explain']['key'].'</b> · |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | </em>'; |
| 236 | 236 | } |
| 237 | 237 | echo '</td></tr>'; |
| 238 | - if($class == '') $class = 'alt'; |
|
| 238 | + if ($class == '') $class = 'alt'; |
|
| 239 | 239 | else $class = ''; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | echo '<div id="pqp-memory" class="pqp-box">'; |
| 248 | 248 | |
| 249 | -if($output['console']['count']['memory'] == 0) { |
|
| 249 | +if ($output['console']['count']['memory'] == 0) { |
|
| 250 | 250 | echo '<h3>This panel has no log items.</h3>'; |
| 251 | 251 | } |
| 252 | 252 | else { |
@@ -257,8 +257,8 @@ discard block |
||
| 257 | 257 | <table class="main" cellspacing="0">'; |
| 258 | 258 | |
| 259 | 259 | $class = ''; |
| 260 | - foreach($output['console']['messages'] as $log) { |
|
| 261 | - if($log['type'] == 'memory') { |
|
| 260 | + foreach ($output['console']['messages'] as $log) { |
|
| 261 | + if ($log['type'] == 'memory') { |
|
| 262 | 262 | echo '<tr class="log-'.$log['type'].'">'; |
| 263 | 263 | echo '<td class="'.$class.'"><b>'.$log['data'].'</b>'; |
| 264 | 264 | if ($log['data_type']) { |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | } |
| 267 | 267 | echo $log['name'].'</td>'; |
| 268 | 268 | echo '</tr>'; |
| 269 | - if($class == '') $class = 'alt'; |
|
| 269 | + if ($class == '') $class = 'alt'; |
|
| 270 | 270 | else $class = ''; |
| 271 | 271 | } |
| 272 | 272 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | echo '<div id="pqp-files" class="pqp-box">'; |
| 280 | 280 | |
| 281 | -if($output['fileTotals']['count'] == 0) { |
|
| 281 | +if ($output['fileTotals']['count'] == 0) { |
|
| 282 | 282 | echo '<h3>This panel has no log items.</h3>'; |
| 283 | 283 | } |
| 284 | 284 | else { |
@@ -289,10 +289,10 @@ discard block |
||
| 289 | 289 | </table> |
| 290 | 290 | <table class="main" cellspacing="0">'; |
| 291 | 291 | |
| 292 | - $class =''; |
|
| 293 | - foreach($output['files'] as $file) { |
|
| 292 | + $class = ''; |
|
| 293 | + foreach ($output['files'] as $file) { |
|
| 294 | 294 | echo '<tr><td class="'.$class.'"><b>'.$file['size'].'</b> '.$file['name'].'</td></tr>'; |
| 295 | - if($class == '') $class = 'alt'; |
|
| 295 | + if ($class == '') $class = 'alt'; |
|
| 296 | 296 | else $class = ''; |
| 297 | 297 | } |
| 298 | 298 | |