From 76af409a0157f981c145973e5668052621c38415 Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Sat, 16 Jan 2010 19:20:49 +0000 Subject: adding http headers and config to CI profiler --- system/libraries/Profiler.php | 81 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 75 insertions(+), 6 deletions(-) (limited to 'system/libraries') diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index ec185a1e8..ebadf8610 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -74,16 +74,16 @@ class CI_Profiler { // be modified. We also might want to make this data available to be logged $output = "\n\n"; - $output .= '
'; + $output .= '
'; $output .= "\n"; - $output .= '  '.$this->CI->lang->line('profiler_benchmarks').'  '; + $output .= '  '.$this->CI->lang->line('profiler_benchmarks').'  '; $output .= "\n"; $output .= "\n\n\n"; foreach ($profile as $key => $val) { $key = ucwords(str_replace(array('_', '-'), ' ', $key)); - $output .= "\n"; + $output .= "\n"; } $output .= "
".$key."  ".$val."
".$key."  ".$val."
\n"; @@ -161,7 +161,7 @@ class CI_Profiler { $val = str_replace($bold, ''.$bold.'', $val); } - $output .= "".$time."  ".$val."\n"; + $output .= "".$time."  ".$val."\n"; } } @@ -327,6 +327,7 @@ class CI_Profiler { return $output; } + // -------------------------------------------------------------------- /** @@ -351,7 +352,7 @@ class CI_Profiler { } else { - $output .= "
".$this->CI->lang->line('profiler_no_memory')."
"; + $output .= "
".$this->CI->lang->line('profiler_no_memory_usage')."
"; } $output .= "
"; @@ -361,6 +362,73 @@ class CI_Profiler { // -------------------------------------------------------------------- + /** + * Compile header information + * + * Lists HTTP headers + * + * @access public + * @return string + */ + function _compile_http_headers() + { + $output = "\n\n"; + $output .= '
'; + $output .= "\n"; + $output .= '  '.$this->CI->lang->line('profiler_headers').'  '; + $output .= "\n"; + + $output .= "\n\n\n"; + + foreach(array('HTTP_ACCEPT', 'HTTP_USER_AGENT', 'HTTP_CONNECTION', 'SERVER_PORT', 'SERVER_NAME', 'REMOTE_ADDR', 'SERVER_SOFTWARE', 'HTTP_ACCEPT_LANGUAGE', 'SCRIPT_NAME', 'REQUEST_METHOD',' HTTP_HOST', 'REMOTE_HOST', 'CONTENT_TYPE', 'SERVER_PROTOCOL', 'QUERY_STRING', 'HTTP_ACCEPT_ENCODING') as $header) + { + $val = (isset($_SERVER[$header])) ? $_SERVER[$header] : ''; + $output .= "\n"; + } + + $output .= "
".$header."  ".$val."
\n"; + $output .= "
"; + + $output .= "
"; + + return $output; + } + + // -------------------------------------------------------------------- + + /** + * Compile config information + * + * Lists developer config variables + * + * @access public + * @return string + */ + function _compile_config() + { + $output = "\n\n"; + $output .= '
'; + $output .= "\n"; + $output .= '  '.$this->CI->lang->line('profiler_config').'  '; + $output .= "\n"; + + $output .= "\n\n\n"; + + foreach($this->CI->config->config as $config=>$val) + { + $output .= "\n"; + } + + $output .= "
".$config."  ".$val."
\n"; + $output .= "
"; + + $output .= ""; + + return $output; + } + + // -------------------------------------------------------------------- + /** * Run the Profiler * @@ -378,7 +446,8 @@ class CI_Profiler { $output .= $this->_compile_get(); $output .= $this->_compile_post(); $output .= $this->_compile_queries(); - + $output .= $this->_compile_config(); + $output .= $this->_compile_http_headers(); $output .= ''; return $output; -- cgit v1.2.3-24-g4f1b