Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 4.3.2 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2008 - 2009, EllisLab, Inc.
* @license http://ellislab.com/codeigniter/user-guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
* @filesource
*/
// ------------------------------------------------------------------------
/**
* CodeIgniter Profiler Class
*
* This class enables you to display benchmark, query, and other data
* in order to help with debugging and optimization.
*
* Note: At some point it would be good to move all the HTML in this class
* into a set of template files in order to allow customization.
*
* @package CodeIgniter
* @subpackage Libraries
* @category Libraries
* @author ExpressionEngine Dev Team
* @link http://ellislab.com/codeigniter/user-guide/general/profiling.html
*/
class MY_Profiler extends CI_Profiler {
var $CI;
function MY_Profiler()
{
parent::CI_Profiler();
$this->CI =& get_instance();
$this->CI->load->language('profiler');
}
/**
* Compile $_SESSION Data
*
* @access private
* @return string
*/
function _compile_session()
{
$output = "\n\n";
$output .= '<fieldset style="border:1px solid #999000;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">';
$output .= "\n";
$output .= '<legend style="color:#999000;"> '.$this->CI->lang->line('profiler_session_data').' </legend>';
$output .= "\n";
if (count($_SESSION) == 0)
{
$output .= "<div style='color:#999000;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->lang->line('profiler_no_session')."</div>";
}
else
{
$output .= "\n\n<table cellpadding='4' cellspacing='1' border='0' width='100%'>\n";
foreach ($_SESSION as $key => $val)
{
if ( ! is_numeric($key))
{
$key = "'".$key."'";
}
$output .= "<tr><td width='50%' style='color:#000;background-color:#ddd;'>$_SESSION[".$key."] </td><td width='50%' style='color:#999000;font-weight:normal;background-color:#ddd;'>";
if (is_array($val))
{
$output .= "<pre>" . htmlspecialchars(stripslashes(print_r($val, true))) . "</pre>";
}
else
{
$output .= htmlspecialchars(stripslashes($val));
}
$output .= "</td></tr>\n";
}
$output .= "</table>\n";
}
$output .= "</fieldset>";
return $output;
}
/**
* Compile $_SESSION Data
*
* @access private
* @return string
*/
function _compile_server()
{
$output = "\n\n";
$output .= '<fieldset style="border:1px solid #F0000F;padding:6px 10px 10px 10px;margin:20px 0 20px 0;background-color:#eee">';
$output .= "\n";
$output .= '<legend style="color:#F0000F;"> '.$this->CI->lang->line('profiler_server_data').' </legend>';
$output .= "\n";
if (count($_SERVER) == 0)
{
$output .= "<div style='color:#F0000F;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->lang->line('profiler_no_server')."</div>";
}
else
{
$output .= "\n\n<table cellpadding='4' cellspacing='1' border='0' width='100%'>\n";
foreach ($_SERVER as $key => $val)
{
if ( ! is_numeric($key))
{
$key = "'".$key."'";
}
$output .= "<tr><td width='50%' style='color:#000;background-color:#ddd;'>$_SERVER[".$key."] </td><td width='50%' style='color:#F0000F;font-weight:normal;background-color:#ddd;'>";
if (is_array($val))
{
$output .= "<pre>" . htmlspecialchars(stripslashes(print_r($val, true))) . "</pre>";
}
else
{
$output .= htmlspecialchars(stripslashes($val));
}
$output .= "</td></tr>\n";
}
$output .= "</table>\n";
}
$output .= "</fieldset>";
return $output;
}
/**
* Run the Profiler
*
* @access private
* @return string
*/
function run()
{
$output = "<div id='codeigniter_profiler' style='clear:both;background-color:#fff;padding:10px;'>";
$output .= $this->_compile_uri_string();
$output .= $this->_compile_controller_info();
$output .= $this->_compile_memory_usage();
$output .= $this->_compile_benchmarks();
$output .= $this->_compile_get();
$output .= $this->_compile_post();
$output .= $this->_compile_session();
$output .= $this->_compile_server();
$output .= $this->_compile_queries();
$output .= '</div>';
return $output;
}
}
// END CI_Profiler class
/* End of file Profiler.php */
/* Location: ./system/libraries/Profiler.php */