Пример #1
0
 /**
  * @param $title
  * @param $message
  * @param array $extra_vars
  * @return string
  */
 protected static function generateHTMLReport($title, $message, $extra_vars = array())
 {
     $helper = new Whoops\Util\TemplateHelper();
     $templateFile = Reporter::getResource("views/layout.html.php");
     $cssFile = Reporter::getResource("css/whoops.base.css");
     $zeptoFile = Reporter::getResource("js/zepto.min.js");
     $jsFile = Reporter::getResource("js/whoops.base.js");
     $frames = array();
     // List of variables that will be passed to the layout template.
     $vars = array("page_title" => $title, "stylesheet" => file_get_contents($cssFile), "zepto" => file_get_contents($zeptoFile), "javascript" => file_get_contents($jsFile), "header" => Reporter::getResource("views/header.html.php"), "env_details" => Reporter::getResource("views/env_details.html.php"), "title" => $title, "name" => array($title), "message" => $message, "frames" => $frames, "has_frames" => false, "tables" => array());
     if (count($extra_vars)) {
         $vars['tables']['Passed debug data'] = $extra_vars;
     }
     $vars['tables']["Server/Request Data"] = $_SERVER;
     $vars['tables']["GET Data"] = $_GET;
     $vars['tables']["POST Data"] = $_POST;
     $vars['tables']["Files"] = $_FILES;
     $vars['tables']["Cookies"] = $_COOKIE;
     $vars['tables']["Session"] = isset($_SESSION) ? $_SESSION : array();
     $vars['tables']["Environment Variables"] = $_ENV;
     $helper->setVariables($vars);
     // Catch the rendered template and return him
     // @todo let the render()-method return the rendered template
     ob_start();
     $helper->render($templateFile);
     $template = ob_get_contents();
     ob_end_clean();
     return $template;
 }