Esempio n. 1
0
	public function send($headerOnly = false) {
		$ret = parent::send($headerOnly);
		$ret = $this->setHtmlEltIntern(DEV ? str_replace('</body>', debug::debugger().'</body>', $ret) : $ret);
		//if ($ret) $this->addHeader('Content-Length', strlen($ret), true);
		return $ret;
	}
Esempio n. 2
0
 /**
  * Get the HTML for the debugger, and add the CSS and JS to the response
  *
  * @param array $elts
  * @return string
  */
 public static function debugger(array $elts = null)
 {
     if (is_null($elts)) {
         debug::timer('nyro');
         debug::timer('nyroRender');
         return debug::debugger(array('timing' => array('Timing', debug::timer(), 'time'), 'included' => array('Included Files', get_included_files(), array('name' => 'code_red', 'type' => 'script')), 'session' => array('Session vars', $_SESSION, 'shield'), 'db_queries' => array('DB Queries', db::log(), 'database'), 'consts' => array('Constants', array_reverse(get_defined_constants(true), true), array('name' => 'gear', 'type' => 'script')), 'request' => array('Request', request::get(), array('name' => 'right', 'type' => 'arrow')), 'cookies' => array('Cookies', $_COOKIE, array('name' => 'gray', 'type' => 'user')), 'get' => array('Get', $_GET, array('name' => 'show', 'type' => 'tag')), 'post' => array('Post', $_POST, array('name' => 'green', 'type' => 'tag')), 'files' => array('Files', $_FILES, array('name' => 'orange', 'type' => 'tag')), 'response' => array('Response', array('Headers' => response::getInstance()->getHeader(), 'Included Files' => response::getInstance()->getIncFiles()), array('name' => 'right', 'type' => 'arrow'))));
     }
     if (request::get('out') != 'html') {
         return;
     }
     $menu = array();
     $content = array();
     $close = utils::getIcon(array('name' => 'cross', 'type' => 'default', 'attr' => array('class' => 'close', 'alt' => 'Close')));
     foreach ($elts as $k => $v) {
         $icon = array_key_exists(2, $v) ? utils::getIcon(is_array($v[2]) ? $v[2] : array('name' => 'show', 'type' => $v[2])) : null;
         $menu[] = '<a rel="' . $k . '">' . $icon . $v[0] . '</a>';
         $tmp = '<div class="debugElt" id="' . $k . '" style="display: none;">' . $close . '<h2>' . $icon . $v[0] . '</h2>';
         if (is_array($v[1])) {
             if (is_numeric(key($v[1])) && !is_array($v[1])) {
                 $tmp .= '<ol><li>' . implode('</li><li>', $v[1]) . '</li></ol>';
             } else {
                 $tmp .= debug::trace($v[1]);
             }
         } else {
             $tmp .= $v[1];
         }
         $tmp .= '</div>';
         $content[] = $tmp;
     }
     $resp = response::getInstance();
     return '<div id="nyroDebugger">' . $resp->getIncludeTagFile('js', 'debug') . $resp->getIncludeTagFile('css', 'debug') . '<ul><li id="close">' . $close . '</li><li>' . implode('</li><li>', $menu) . '</li></ul>' . implode("\n", $content) . '</div>';
 }