Source for file console.phtml

Documentation is available at console.phtml

  1. 1: <?php
  2. 2:  
  3. 3: /**
  4. 4:  * Nette Framework - Dump console template.
  5. 5:  *
  6. 6:  * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
  7. 7:  *
  8. 8:  * This source file is subject to the "Nette license" that is bundled
  9. 9:  * with this package in the file license.txt.
  10. 10:  *
  11. 11:  * For more information please see http://nettephp.com
  12. 12:  *
  13. 13:  * @author     David Grudl
  14. 14:  * @copyright  Copyright (c) 2004, 2009 David Grudl
  15. 15:  * @license    http://nettephp.com/license  Nette license
  16. 16:  * @link       http://nettephp.com
  17. 17:  * @category   Nette
  18. 18:  * @package    Nette
  19. 19:  *
  20. 20:  * @param      array     $payload 
  21. 21:  * @return     void 
  22. 22:  */
  23. 23:  
  24. 24:  
  25. 25:  
  26. 26: if (!function_exists('_netteDumpCb2')) {
  27. 27:  
  28. 28:     function _netteDumpCb2($m)
  29. 29:     {
  30. 30:         return "$m[1]<a href='#' onclick='return !netteToggle(this)'>$m[2]($m[3]($m[3'<abbr>&#x25bc;</abbr> </a><code>' '<abbr>&#x25ba;</abbr> </a><code class="collapsed">');
  31. 31:     }
  32. 32: }
  33. 33:  
  34. 35:  
  35. 36: ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  36. 37: <html lang="en">
  37. 38: <head>
  38. 39:     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  39. 40:     <meta name="robots" content="noindex,noarchive">
  40. 41:     <meta name="generator" content="Nette Framework">
  41. 42:  
  42. 43:     <title>Nette Debug Console</title>
  43. 44:  
  44. 45:     <style type="text/css">
  45. 46:     /* <![CDATA[ */
  46. 47:         body {
  47. 48:             margin: 0;
  48. 49:             padding: 0;
  49. 50:             font: 9pt/1.5 Verdana, sans-serif;
  50. 51:             background: white;
  51. 52:             color: #333;
  52. 53:         }
  53. 54:  
  54. 55:         h1 {
  55. 56:             font-size: 13pt;
  56. 57:             margin: 0;
  57. 58:             padding: 2px 8px;
  58. 59:             background: black;
  59. 60:             color: white;
  60. 61:             border-bottom: 1px solid black;
  61. 62:         }
  62. 63:  
  63. 64:         h2 {
  64. 65:             font: 11pt/1.5 sans-serif;
  65. 66:             margin: 0;
  66. 67:             padding: 2px 8px;
  67. 68:             background: #3484d2;
  68. 69:             color: white;
  69. 70:         }
  70. 71:  
  71. 72:         a {
  72. 73:             text-decoration: none;
  73. 74:             color: #4197E3;
  74. 75:         }
  75. 76:  
  76. 77:         a abbr {
  77. 78:             font-family: sans-serif;
  78. 79:             color: #999;
  79. 80:         }
  80. 81:  
  81. 82:         p {
  82. 83:             margin: .8em 0
  83. 84:         }
  84. 85:  
  85. 86:         pre, code, table {
  86. 87:             font: 9pt/1.5 Consolas, monospace;
  87. 88:         }
  88. 89:  
  89. 90:         pre, table {
  90. 91:             background: #fffbcc;
  91. 92:             padding: .4em .7em;
  92. 93:             border: 1px dotted silver;
  93. 94:         }
  94. 95:  
  95. 96:         table pre {
  96. 97:             padding: 0;
  97. 98:             margin: 0;
  98. 99:             border: none;
  99. 100:         }
  100. 101:  
  101. 102:         pre.dump span {
  102. 103:             color: #c16549;
  103. 104:         }
  104. 105:  
  105. 106:         pre.dump a {
  106. 107:             color: #333;
  107. 108:         }
  108. 109:  
  109. 110:         table {
  110. 111:             border-collapse: collapse;
  111. 112:             width: 100%;
  112. 113:         }
  113. 114:  
  114. 115:         td, th {
  115. 116:             vertical-align: top;
  116. 117:             text-align: left;
  117. 118:             border: 1px solid #eeeebb;
  118. 119:         }
  119. 120:  
  120. 121:         th {
  121. 122:             width: 10;
  122. 123:             padding: 2px 3px 2px 8px;
  123. 124:             font-weight: bold;
  124. 125:         }
  125. 126:  
  126. 127:         td {
  127. 128:             padding: 2px 8px 2px 3px;
  128. 129:         }
  129. 130:  
  130. 131:         .odd, .odd pre {
  131. 132:             background: #faf5c3;
  132. 133:         }
  133. 134:  
  134. 135:     /* ]]> */
  135. 136:     </style>
  136. 137:  
  137. 138:  
  138. 139:     <script type="text/javascript">
  139. 140:     /* <![CDATA[ */
  140. 141:         document.write('<style> .collapsed { display: none; } <\/style>');
  141. 142:  
  142. 143:         function netteToggle(link, panelId)
  143. 144:         {
  144. 145:             var arrow = link.getElementsByTagName('abbr')[0];
  145. 146:             var panel = panelId ? document.getElementById(panelId) : link.nextSibling;
  146. 147:             while (panel.nodeType !== 1) panel = panel.nextSibling;
  147. 148:             var collapsed = panel.currentStyle ? panel.currentStyle.display == 'none' : getComputedStyle(panel, null).display == 'none';
  148. 149:  
  149. 150:             arrow.innerHTML = String.fromCharCode(collapsed ? 0x25bc : 0x25ba);
  150. 151:             panel.style.display = collapsed ? (panel.tagName.toLowerCase() === 'code' ? 'inline' : 'block') : 'none';
  151. 152:  
  152. 153:             return true;
  153. 154:         }
  154. 155:     /* ]]> */
  155. 156:     </script>
  156. 157: </head>
  157. 158:  
  158. 159:  
  159. 160:  
  160. 161: <body>
  161. 162:     <h1>Nette Debug Console</h1>
  162. 163: </body>
  163. 164: </html>
  164. 165: <?php $document ob_get_clean(?>
  165. 166:  
  166. 167: <?php ob_start(?>
  167. 168: <?php foreach ($payload as $item)?>
  168. 169:     <?php if ($item['title']):?>
  169. 170:     <h2><?php echo htmlspecialchars($item['title']?></h2>
  170. 171:     <?php endif ?>
  171. 172:  
  172. 173:     <table>
  173. 174:     <?php $i ?>
  174. 175:     <?php foreach ((is_array($item['var']$item['var'array('' => $item['var'])) as $key => $val)?>
  175. 176:     <tr class="<?php echo $i++ % 'odd' 'even' ?>">
  176. 177:         <th><?php echo htmlspecialchars($key?></th>
  177. 178:         <td><?php echo preg_replace_callback('#(<pre class="dump">|\s+)?(.*)\((\d+)\) <code>#''_netteDumpCb2'Debug::dump($valTRUE)) ?></td>
  178. 179:     </tr>
  179. 180:     <?php endforeach ?>
  180. 181:     </table>
  181. 182: <?php endforeach ?>
  182. 183: <?php $body ob_get_clean(?>
  183. 184:  
  184. 185: <script type="text/javascript">
  185. 186: /* <![CDATA[ */
  186. 187: if (typeof _netteConsole === 'undefined') {
  187. 188:     _netteConsole = window.open('','_netteConsole','width=700,height=700,resizable,scrollbars=yes');
  188. 189:     _netteConsole.document.write(<?php echo json_encode(preg_replace('#[ \t\r\n]+#'' '$document)) ?>);
  189. 190:     _netteConsole.document.close();
  190. 191:     _netteConsole.document.onkeyup = function(e) {
  191. 192:         e = e || _netteConsole.event;
  192. 193:         if (e.keyCode == 27) _netteConsole.close();
  193. 194:     }
  194. 195:     _netteConsole.document.body.focus();
  195. 197: _netteConsole.document.body.innerHTML = _netteConsole.document.body.innerHTML + <?php echo json_encode($body?>;
  196. 198: /* ]]> */
  197. 199: </script>