Beispiel #1
0
 public static function globals()
 {
     if (!extension_loaded('xdebug')) {
         throw new \RuntimeException('XDebug must be installed to use this function');
     }
     \xdebug_dump_superglobals();
 }
Beispiel #2
0
 /**
  * Rendering function on Shutdown of XDEBUG.
  */
 public static function render()
 {
     // Start XDEBUG Tracing and Coverage
     if (self::isXdebugActive()) {
         /*
          * This is the CSS for XDebug Fatal Error
          */
         echo '<!-- Disable XDebug Mode to remove this!-->
             <style type="text/css">
             /*<![CDATA[*/
             table.xdebug-error {
                  font-size: 12px;
                  width: 95%;
                  margin: 0 auto 10px auto;
                  border-color: #666;
                  border-collapse: collapse;
                  border-style: outset;
                  color: #222222;
             }
            .xdebug-error th {
                 background: none repeat scroll 0 0 #E03937;
                 border: 1px inset #BF0000;
                 font-weight: bold;
                 padding: 3px;
                 font-size: 16px;
             }
             .xdebug-error td {
                 background: none repeat scroll 0 0 #FFFFCC;
                 border: 1px solid grey;
                 padding: 2px 2px 2px 5px;
                 vertical-align: top;
             }
             .xdebug-error tr:hover td {
                 background: #ffff88;
             }
             .xdebug-error span {
                 display: none;
             }
             /** Custom Styles not related to XDEBUG **/
             .toggle {
                 font-size: 12px;
                 color: white;
                 float: left;
             }
             /*]]>*/
             </style>';
         /*
          * Reset for hardcoded bgcolor attributes in the "xdebug-error" table.
          * This will select all <td> elements and reset the bgcolor attribute on each element.
          */
         echo "<script type=\"text/javascript\">\n                  var xdebugErrorTable = document.getElementsByClassName('xdebug-error');\n                  if (xdebugErrorTable.length > 0) {\n                    var xdebugErrorTableTds =\n                    document.getElementsByClassName('xdebug-error')[0].getElementsByTagName('td');\n                    for (var i = 0; i < xdebugErrorTableTds.length; i++) {\n                        xdebugErrorTableTds[i].setAttribute('bgcolor', '');\n                    }\n                  }";
         /*
          * Visibility Toggle + Toggle Text Change
          */
         echo 'function toggleXDebugTable(a) {document.getElementById(a).style.display=="none"
               ?(document.getElementById(a).style.display="table",
                 document.getElementById("toggle-icon-"+a).innerHTML="&#9660;")
               :(document.getElementById(a).style.display="none",
                 document.getElementById("toggle-icon-"+a).innerHTML="&#9658;")};';
         echo '</script>';
         /*
          * This is the CSS for XDebug Console via xdebug_dump_superglobals()
          */
         echo '<!-- Disable XDebug Mode to remove this!-->
           <style type="text/css">
           /*<![CDATA[*/
             /* center outer div */
             #x-debug {
                 width: 95%;
                 padding:20px 0px 10px 0px;
                 background: #EFEFEF;
                 border: 1px solid #333;
                 margin: 0 auto; /* centering */
                 margin-top: 15px;
                 margin-bottom: 15px;
             }
             table.xdebug-console, table.xdebug-superglobals {
                 width: 100%;
                 background: none repeat scroll 0 0 #FFFFCC;
                 border-width: 1px;
                 border-style: outset;
                 border-color: #BF0000;
                 border-collapse: collapse;
                 color: #222;
                 font: 12px tahoma,verdana,arial,sans-serif;
                 margin-top: 5px;
                 margin-bottom: 8px;
             }
             table.xdebug-console th, table.xdebug-superglobals th {
                 border: 1px inset #BF0000;
                 padding: 3px;
                 padding-bottom: 3px;
                 font-weight: bold;
                 background: #E03937;
                 text-align: left;
             }
             .xdebug-superglobals td {
                 border: 1px solid grey;
                 padding: 2px;
                 padding-left: 5px;
                 vertical-align:top;
             }
             table.xdebug-console td {
                 border: 1px inset grey;
                 padding: 2px;
                 padding-left: 5px;
             }
             table.xdebug-console td.td1 {width: 30%; padding-left:20px; color:#FF0000; }
             table.xdebug-console td.td2 {width: 70%;}
             table.xdebug-console tr:hover td, table.xdebug-superglobals tr:hover td {
                 background: #ffff88;
             }
             fieldset.xdebug-console {
                 background: none repeat scroll 0 0 #ccc;
                 border: 1px solid #666666;
                 font: 12px tahoma,verdana,arial,sans-serif;
                 margin: 35px;
                 padding: 10px;
                 width: 95%;
             }
             fieldset.xdebug-console legend {
                 background: #fff;
                 border: 1px solid #333;
                 font-weight: bold;
                 padding: 5px 15px;
                 color: #222;
                 float: left;
                 margin-top: -23px;
                 margin-bottom: 10px;
             }
             fieldset.xdebug-console pre {
                 margin: 2px;
                 text-align: left;
                 width: 100%;
             }
             /*]]>*/
             </style>
              <!--[if IE]>
              <style type="text/css">
                 fieldset.xdebug-console legend {
                     position:relative;
                     top: -0.2em;
                 }
              </style>
              <![endif]-->';
         echo '<fieldset class="xdebug-console"><legend>XDebug Console</legend>';
         echo xdebug_dump_superglobals();
         echo '<table class="xdebug-console">';
         echo '<tr><th>Name</th><th>Value</th></tr>';
         echo '<tr>';
         echo '<td class="td1">Time to execute</td>';
         echo '<td class="td2">' . round(xdebug_time_index(), 4) . ' seconds</td>';
         echo '</tr><tr>';
         echo '<td class="td1">Memory Usage (before)</td>';
         echo '<td class="td2">' . self::$xdebug_memory_before . ' MB</td>';
         echo '</tr><tr>';
         echo '<td class="td1">Memory Usage by ' . APPLICATION_NAME . ' </td>';
         echo '<td class="td2">' . self::roundMB(xdebug_memory_usage()) . ' MB</td>';
         echo '</tr><tr>';
         echo '<td class="td1">Memory Peak</td>';
         echo '<td class="td2">' . self::roundMB(xdebug_peak_memory_usage()) . ' MB</td>';
         echo '</tr>';
         // stop tracings and var_dump
         #var_dump(xdebug_get_code_coverage());
         echo '</table>';
         self::showConstants();
         #self::showBrowserInfo();
         self::showHttpHeaders();
         echo '</table>';
         echo '</fieldset>';
         /*
          * Reset for hardcoded bgcolor attributes in the "xdebug-superglobals" table.
          * This will select all <td> elements and reset the bgcolor attribute on each element.
          */
         echo "<script type=\"text/javascript\">\n                  var xdebugTds = document.getElementsByClassName('xdebug-superglobals')[0].getElementsByTagName('td');\n                  for (var i = 0; i < xdebugTds.length; i++) {xdebugTds[i].setAttribute('bgcolor', '');}\n                  xdebugTds[0].setAttribute('width', '30%');\n                  </script>";
     }
 }
Beispiel #3
0
 /**
  * This function dumps the values of the elements of the super globals
  * as specified with the xdebug.dump.* php.ini settings.
  *
  * @return void
  */
 public function dumpSuperglobals()
 {
     xdebug_dump_superglobals();
 }