varname(View::getInstance()->getEngine(), array('ndbinfo' => Messages::msg_bottom_bar())); $this->_setRequestData(); $this->_setPostData(); $this->_setGetData(); $this->_setCookieData(); $this->_setEnvData(); $this->_setGlobalsData(); $this->_setSessionData(); $this->_setFilesData(); $this->_setServerData(); } /** * Call this method to get singleton * @return Debug */ public static function getInstance() { static $instance = null; if ($instance === null) { $instance = new Debug(); } return $instance; } public function toDebug( $data ) { try { $this->_setRawOutput( $data ); } catch(Exception $e) { throw new Exception("ERROR: No data for debugging handled!"); } } /** * @return mixed */ protected function getRawOutput() { return $this->_raw_output; } /** * @param mixed $raw_output */ private function _setRawOutput($raw_output=false) { if(sizeof($raw_output)>0) { $this->_raw_output = $raw_output; } else { $this->_raw_output = Messages::msg_raw_output(); } Controller::getInstance()->varname( View::getInstance()->getEngine(), array('ndbraw_output' => $this->getRawOutput()) ); } /** * @return mixed */ private function getGetData() { return $this->_get_data; } /** * @param mixed $get_data */ private function _setGetData() { if(sizeof($_GET)>0) { $this->_get_data = '
' . print_r($_GET, true) . ''; } else { $this->_get_data = Messages::msg_get(); } Controller::getInstance()->varname( View::getInstance()->getEngine(), array('ndbget' => $this->getGetData()) ); } /** * @return mixed */ private function getFilesData() { return $this->_files_data; } /** * @param mixed $files_data */ private function _setFilesData() { if(sizeof($_FILES)>0) { $this->_files_data = '
' . print_r($_FILES, true) . ''; } else { $this->_files_data = Messages::msg_files(); } Controller::getInstance()->varname( View::getInstance()->getEngine(), array('ndbfiles' => $this->getFilesData()) ); } /** * @return mixed */ private function getCookieData() { return $this->_cookie_data; } /** * @param mixed $cookie_data */ private function _setCookieData() { if(sizeof($_COOKIE)>0) { $this->_cookie_data = '
' . print_r($_COOKIE, true) . ''; } else { $this->_cookie_data = Messages::msg_cookie(); } Controller::getInstance()->varname( View::getInstance()->getEngine(), array('ndbcookie' => $this->getCookieData()) ); } /** * @return mixed */ private function getSessionData() { return $this->_session_data; } /** * @param mixed $session_data */ private function _setSessionData() { if(sizeof($_SESSION)>0) { $this->_session_data = '
' . print_r($_SESSION, true) . ''; } else { $this->_session_data = Messages::msg_cookie(); } Controller::getInstance()->varname( View::getInstance()->getEngine(), array('ndbsession' => $this->getSessionData()) ); } /** * @return mixed */ private function getEnvData() { return $this->_env_data; } /** * @param mixed $env_data */ private function _setEnvData() { if(sizeof($_ENV)>0) { $this->_env_data = '
' . print_r($_ENV, true) . ''; } else { $this->_env_data = Messages::msg_env(); } Controller::getInstance()->varname( View::getInstance()->getEngine(), array('ndbenv' => $this->getEnvData()) ); } /** * @return mixed */ private function getGlobalsData() { return $this->_globals_data; } /** * @param mixed $globals_data */ private function _setGlobalsData() { if(sizeof($GLOBALS)>0) { $this->_globals_data = '
' . print_r($GLOBALS, true) . ''; } else { $this->_globals_data = Messages::msg_globals(); } Controller::getInstance()->varname( View::getInstance()->getEngine(), array('ndbglobals' => $this->getGlobalsData()) ); } /** * @return mixed */ private function getPostData() { return $this->_post_data; } /** * @param mixed $post_data */ private function _setPostData() { if(sizeof($_POST)>0) { $this->_post_data = '
' . print_r($_POST, true) . ''; } else { $this->_post_data = Messages::msg_post(); } Controller::getInstance()->varname( View::getInstance()->getEngine(), array('ndbpost' => $this->getPostData()) ); } /** * @desc loads the request data to the * debugbar */ private function _setRequestData() { if(sizeof($_REQUEST)>0) { $this->_request_data = '
' . print_r($_REQUEST, true) . ''; } else { $this->_request_data = Messages::msg_request(); } Controller::getInstance()->varname( View::getInstance()->getEngine(), array('ndbrequest' => $this->getRequestData()) ); } private function getRequestData() { return $this->_request_data; } /** * @desc loads the server data array to the * debugbar */ private function _setServerData() { if(sizeof($_SERVER)>0) { $this->_server_data = '
' . print_r($_SERVER, true) . ''; } else { $this->_server_data = Messages::msg_server(); } Controller::getInstance()->varname( View::getInstance()->getEngine(), array('ndbserver' => $this->getServerData() )); } private function getServerData() { return $this->_server_data; } }