diff options
author | Derek Allard <derek.allard@ellislab.com> | 2010-01-16 20:20:49 +0100 |
---|---|---|
committer | Derek Allard <derek.allard@ellislab.com> | 2010-01-16 20:20:49 +0100 |
commit | 76af409a0157f981c145973e5668052621c38415 (patch) | |
tree | e5650a6a1d566be347dc913e78807ada3d8da769 | |
parent | 03151b09a805f0e91700a7f49a3deffed8beecf8 (diff) |
adding http headers and config to CI profiler
-rw-r--r-- | system/language/english/profiler_lang.php | 2 | ||||
-rw-r--r-- | system/libraries/Profiler.php | 81 | ||||
-rw-r--r-- | user_guide/changelog.html | 1 |
3 files changed, 78 insertions, 6 deletions
diff --git a/system/language/english/profiler_lang.php b/system/language/english/profiler_lang.php index 7c40e3f3e..bf2183004 100644 --- a/system/language/english/profiler_lang.php +++ b/system/language/english/profiler_lang.php @@ -8,6 +8,8 @@ $lang['profiler_get_data'] = 'GET DATA'; $lang['profiler_post_data'] = 'POST DATA'; $lang['profiler_uri_string'] = 'URI STRING'; $lang['profiler_memory_usage'] = 'MEMORY USAGE'; +$lang['profiler_config'] = 'CONFIG VARIABLES'; +$lang['profiler_headers'] = 'HTTP HEADERS'; $lang['profiler_no_db'] = 'Database driver is not currently loaded'; $lang['profiler_no_queries'] = 'No queries were run'; $lang['profiler_no_post'] = 'No POST data exists'; 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 .= '<fieldset style="border:1px solid #990000;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">'; + $output .= '<fieldset style="border:1px solid #900;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">'; $output .= "\n"; - $output .= '<legend style="color:#990000;"> '.$this->CI->lang->line('profiler_benchmarks').' </legend>'; + $output .= '<legend style="color:#900;"> '.$this->CI->lang->line('profiler_benchmarks').' </legend>'; $output .= "\n"; $output .= "\n\n<table cellpadding='4' cellspacing='1' border='0' width='100%'>\n"; foreach ($profile as $key => $val) { $key = ucwords(str_replace(array('_', '-'), ' ', $key)); - $output .= "<tr><td width='50%' style='color:#000;font-weight:bold;background-color:#ddd;'>".$key." </td><td width='50%' style='color:#990000;font-weight:normal;background-color:#ddd;'>".$val."</td></tr>\n"; + $output .= "<tr><td width='50%' style='color:#000;font-weight:bold;background-color:#ddd;'>".$key." </td><td width='50%' style='color:#900;font-weight:normal;background-color:#ddd;'>".$val."</td></tr>\n"; } $output .= "</table>\n"; @@ -161,7 +161,7 @@ class CI_Profiler { $val = str_replace($bold, '<strong>'.$bold.'</strong>', $val); } - $output .= "<tr><td width='1%' valign='top' style='color:#990000;font-weight:normal;background-color:#ddd;'>".$time." </td><td style='color:#000;font-weight:normal;background-color:#ddd;'>".$val."</td></tr>\n"; + $output .= "<tr><td width='1%' valign='top' style='color:#900;font-weight:normal;background-color:#ddd;'>".$time." </td><td style='color:#000;font-weight:normal;background-color:#ddd;'>".$val."</td></tr>\n"; } } @@ -327,6 +327,7 @@ class CI_Profiler { return $output; } + // -------------------------------------------------------------------- /** @@ -351,7 +352,7 @@ class CI_Profiler { } else { - $output .= "<div style='color:#5a0099;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->lang->line('profiler_no_memory')."</div>"; + $output .= "<div style='color:#5a0099;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->lang->line('profiler_no_memory_usage')."</div>"; } $output .= "</fieldset>"; @@ -362,6 +363,73 @@ class CI_Profiler { // -------------------------------------------------------------------- /** + * Compile header information + * + * Lists HTTP headers + * + * @access public + * @return string + */ + function _compile_http_headers() + { + $output = "\n\n"; + $output .= '<fieldset style="border:1px solid #000;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">'; + $output .= "\n"; + $output .= '<legend style="color:#000;"> '.$this->CI->lang->line('profiler_headers').' </legend>'; + $output .= "\n"; + + $output .= "\n\n<table cellpadding='4' cellspacing='1' border='0' width='100%'>\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 .= "<tr><td valign='top' style='color:#900;background-color:#ddd;'>".$header." </td><td style='color:#000;background-color:#ddd;'>".$val."</td></tr>\n"; + } + + $output .= "</table>\n"; + $output .= "</fieldset>"; + + $output .= "</fieldset>"; + + return $output; + } + + // -------------------------------------------------------------------- + + /** + * Compile config information + * + * Lists developer config variables + * + * @access public + * @return string + */ + function _compile_config() + { + $output = "\n\n"; + $output .= '<fieldset style="border:1px solid #000;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">'; + $output .= "\n"; + $output .= '<legend style="color:#000;"> '.$this->CI->lang->line('profiler_config').' </legend>'; + $output .= "\n"; + + $output .= "\n\n<table cellpadding='4' cellspacing='1' border='0' width='100%'>\n"; + + foreach($this->CI->config->config as $config=>$val) + { + $output .= "<tr><td valign='top' style='color:#900;background-color:#ddd;'>".$config." </td><td style='color:#000;background-color:#ddd;'>".$val."</td></tr>\n"; + } + + $output .= "</table>\n"; + $output .= "</fieldset>"; + + $output .= "</fieldset>"; + + return $output; + } + + // -------------------------------------------------------------------- + + /** * Run the Profiler * * @access private @@ -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 .= '</div>'; return $output; diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 0e49bbdce..aef9d71ac 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -70,6 +70,7 @@ SVN Revision: </p> <li>Added "is_object" into the list of unit tests capable of being run.</li> <li>Table library will generate an empty cell with a blank string, or NULL value.</li> <li>Added a <kbd>parse_string()</kbd> method to the <a href="libraries/parser.html">Parser Class</a>.</li> + <li>Added HTTP headers and Config information to the <a href="general/profiling.html">Profiler</a> output.</li> </ul> </li> <li>Database |