/** * Set output format * JSON|HTML|TEXT * * @param string $output ( html, text and json ) * @return object self */ public static function output($output) { if (in_array(mb_strtolower($output), array('json', 'html', 'text'))) { self::$output = mb_strtolower($output); } return new self(); }
/** * Initialize database */ public function loadDatabase() { Debug::write('Connecting to DB....', 'title'); try { $this->db = new PDO("mysql:host=" . self::$hostname . ";dbname=" . self::$database, self::$username, self::$password); } catch (PDOException $e) { Debug::write('Connection to DB fail.' . $e->getMessage(), 'error'); Debug::output(); exit; } Debug::write('Connection success.', 'success'); }
public function goBabyGo() { $objSubframe = new Subframe(); $objApp = $objSubframe->getApp(); $objApp->init(); $objResponse = $objApp->launch(); if (Debug::isEnabled()) { echo Debug::top(); } echo $objResponse; if (Debug::isEnabled()) { echo Debug::output(); } }
case 'jpeg': header('Content-type:image/jpeg'); break; case 'bmp': header('Content-type:image/bmp'); break; case 'gif': header('Content-type:image/gif'); break; case 'xml': header('Content-type:application/xml'); break; case 'txt': header('Content-type:text/plain'); break; case 'mp3': header('Content-type:audio/mp3'); break; default: header('Content-type:application/octet-stream'); break; } // Output if (Debug::isEnable()) { Debug::output(); } // GZIP some files if (in_array($ext, array('txt', 'xml', 'rsw', 'rsm', 'gnd', 'gat', 'spr', 'act', 'pal'))) { ob_start("ob_gzhandler"); } echo $file;
/** * Set the current output module for Debug * @param type $newoutput Type of: function ($message, $level) */ public static function setOutput($newoutput) { Debug::$output = $newoutput; }
/** * Public Functions */ public function write() { $arguments = func_get_args(); //This Function Requires Inistigating If you want to use ->stop() if (!isset($this) || isset($this) && get_class($this) != __CLASS__) { return call_user_func_array(array(Debug::init(), "write"), $arguments); } Debug::$iterationCounter++; foreach ($arguments as $item) { Debug::output(Debug::formatItem($item)); } return $this; }
<?php require '../config.php'; Config::read('admin.php'); // Admin用の環境設定読み込み Debug::log('Controller Action', false, 'system', __FILE__, __LINE__); list($classFile, $className, $methodName) = getRouting(); require $classFile; $controller = new $className($methodName); Debug::output($controller); // Debug用の出力
<?php include dirname(dirname(__FILE__)) . '/src/Debug.php'; //Set output between HTML, JSON and TEXT Debug::output('json')->printData($_SERVER);