summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Aker <greg.aker@ellislab.com>2011-04-18 18:18:02 +0200
committerGreg Aker <greg.aker@ellislab.com>2011-04-18 18:18:02 +0200
commit62df13125bd9ab22ff0c7f2565a42a6de13ed7e4 (patch)
tree9ebe0799a9c2c912ebe217e61d19e2b0fecb4efd
parent826429cf40a9624788b92d2e6e4b7659e1b0d8a1 (diff)
Added Session Class userdata to the output profiler. Additionally, added a show/hide toggle on HTTP Headers, Session Data and Config Variables.
-rw-r--r--system/language/english/profiler_lang.php3
-rw-r--r--system/libraries/Profiler.php45
-rw-r--r--user_guide/changelog.html2
3 files changed, 43 insertions, 7 deletions
diff --git a/system/language/english/profiler_lang.php b/system/language/english/profiler_lang.php
index b6460fb83..1111158c8 100644
--- a/system/language/english/profiler_lang.php
+++ b/system/language/english/profiler_lang.php
@@ -9,6 +9,7 @@ $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_session_data'] = 'SESSION DATA';
$lang['profiler_headers'] = 'HTTP HEADERS';
$lang['profiler_no_db'] = 'Database driver is not currently loaded';
$lang['profiler_no_queries'] = 'No queries were run';
@@ -17,6 +18,8 @@ $lang['profiler_no_get'] = 'No GET data exists';
$lang['profiler_no_uri'] = 'No URI data exists';
$lang['profiler_no_memory'] = 'Memory Usage Unavailable';
$lang['profiler_no_profiles'] = 'No Profile data - all Profiler sections have been disabled.';
+$lang['profiler_section_hide'] = 'Hide';
+$lang['profiler_section_show'] = 'Show';
/* End of file profiler_lang.php */
/* Location: ./system/language/english/profiler_lang.php */ \ No newline at end of file
diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php
index 8a1f18ced..d1828b984 100644
--- a/system/libraries/Profiler.php
+++ b/system/libraries/Profiler.php
@@ -32,7 +32,7 @@
*/
class CI_Profiler {
- var $CI;
+ private $CI;
protected $_available_sections = array(
'benchmarks',
@@ -43,6 +43,7 @@ class CI_Profiler {
'controller_info',
'queries',
'http_headers',
+ 'session_data',
'config'
);
@@ -410,10 +411,10 @@ class CI_Profiler {
$output = "\n\n";
$output .= '<fieldset id="ci_profiler_http_headers" 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;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_headers').'&nbsp;&nbsp;</legend>';
+ $output .= '<legend style="color:#000;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_headers').'&nbsp;&nbsp;(<span style="cursor: pointer;" onclick="var s=document.getElementById(\'ci_profiler_httpheaders_table\').style;s.display=s.display==\'none\'?\'\':\'none\';this.innerHTML=this.innerHTML==\''.$this->CI->lang->line('profiler_section_show').'\'?\''.$this->CI->lang->line('profiler_section_hide').'\':\''.$this->CI->lang->line('profiler_section_show').'\';">'.$this->CI->lang->line('profiler_section_show').'</span>)</legend>';
$output .= "\n";
- $output .= "\n\n<table style='width:100%'>\n";
+ $output .= "\n\n<table style='width:100%;display:none' id='ci_profiler_httpheaders_table'>\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', 'HTTP_X_FORWARDED_FOR') as $header)
{
@@ -441,10 +442,10 @@ class CI_Profiler {
$output = "\n\n";
$output .= '<fieldset id="ci_profiler_config" 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;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_config').'&nbsp;&nbsp;</legend>';
+ $output .= '<legend style="color:#000;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_config').'&nbsp;&nbsp;(<span style="cursor: pointer;" onclick="var s=document.getElementById(\'ci_profiler_config_table\').style;s.display=s.display==\'none\'?\'\':\'none\';this.innerHTML=this.innerHTML==\''.$this->CI->lang->line('profiler_section_show').'\'?\''.$this->CI->lang->line('profiler_section_hide').'\':\''.$this->CI->lang->line('profiler_section_show').'\';">'.$this->CI->lang->line('profiler_section_show').'</span>)</legend>';
$output .= "\n";
- $output .= "\n\n<table style='width:100%'>\n";
+ $output .= "\n\n<table style='width:100%; display:none' id='ci_profiler_config_table'>\n";
foreach ($this->CI->config->config as $config=>$val)
{
@@ -465,6 +466,39 @@ class CI_Profiler {
// --------------------------------------------------------------------
/**
+ * Compile session userdata
+ *
+ * @return string
+ */
+ private function _compile_session_data()
+ {
+ if ( ! isset($this->CI->session))
+ {
+ return;
+ }
+
+ $output = '<fieldset id="ci_profiler_csession" style="border:1px solid #000;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">';
+ $output .= '<legend style="color:#000;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_session_data').'&nbsp;&nbsp;(<span style="cursor: pointer;" onclick="var s=document.getElementById(\'ci_profiler_session_data\').style;s.display=s.display==\'none\'?\'\':\'none\';this.innerHTML=this.innerHTML==\''.$this->CI->lang->line('profiler_section_show').'\'?\''.$this->CI->lang->line('profiler_section_hide').'\':\''.$this->CI->lang->line('profiler_section_show').'\';">'.$this->CI->lang->line('profiler_section_show').'</span>)</legend>';
+ $output .= "<table style='width:100%;display:none' id='ci_profiler_session_data'>";
+
+ foreach ($this->CI->session->all_userdata() as $key => $val)
+ {
+ if (is_array($val))
+ {
+ $val = print_r($val, TRUE);
+ }
+
+ $output .= "<tr><td style='padding:5px; vertical-align: top;color:#900;background-color:#ddd;'>".$key."&nbsp;&nbsp;</td><td style='padding:5px; color:#000;background-color:#ddd;'>".htmlspecialchars($val)."</td></tr>\n";
+ }
+
+ $output .= '</table>';
+ $output .= "</fieldset>";
+ return $output;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Run the Profiler
*
* @return string
@@ -493,7 +527,6 @@ class CI_Profiler {
return $output;
}
-
}
// END CI_Profiler class
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 0afc5b822..9890f602c 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -65,7 +65,7 @@ Change Log
<ul>
<li>General Changes
<ul>
- <li></li>
+ <li>Added Session Class userdata to the output profiler. Additionally, added a show/hide toggle on HTTP Headers, Session Data and Config Variables.</li>
</ul>
</li>
<li>Helpers