From dd6719738936be31cdaa1758ca86d5eb14dcab3d Mon Sep 17 00:00:00 2001 From: Barry Mieny Date: Mon, 4 Oct 2010 16:33:58 +0200 Subject: Cleanup of stray spaces and tabs --- system/libraries/Profiler.php | 184 +++++++++++++++++++++--------------------- 1 file changed, 92 insertions(+), 92 deletions(-) (limited to 'system/libraries/Profiler.php') diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php index db179976b..796db2d6b 100644 --- a/system/libraries/Profiler.php +++ b/system/libraries/Profiler.php @@ -33,7 +33,7 @@ class CI_Profiler { var $CI; - + var $_available_sections = array( 'benchmarks', 'get', @@ -46,11 +46,11 @@ class CI_Profiler { 'config' ); - function CI_Profiler($config = array()) - { - $this->CI =& get_instance(); - $this->CI->load->language('profiler'); - + function CI_Profiler($config = array()) + { + $this->CI =& get_instance(); + $this->CI->load->language('profiler'); + // default all sections to display foreach ($this->_available_sections as $section) { @@ -59,10 +59,10 @@ class CI_Profiler { $this->_compile_{$section} = TRUE; } } - + $this->set_sections($config); - } - + } + // -------------------------------------------------------------------- /** @@ -80,13 +80,13 @@ class CI_Profiler { { if (in_array($method, $this->_available_sections)) { - $this->_compile_{$method} = ($enable !== FALSE) ? TRUE : FALSE; + $this->_compile_{$method} = ($enable !== FALSE) ? TRUE : FALSE; } } } // -------------------------------------------------------------------- - + /** * Auto Profiler * @@ -98,45 +98,45 @@ class CI_Profiler { * @access private * @return array */ - function _compile_benchmarks() - { - $profile = array(); - foreach ($this->CI->benchmark->marker as $key => $val) - { - // We match the "end" marker so that the list ends - // up in the order that it was defined - if (preg_match("/(.+?)_end/i", $key, $match)) - { - if (isset($this->CI->benchmark->marker[$match[1].'_end']) AND isset($this->CI->benchmark->marker[$match[1].'_start'])) - { - $profile[$match[1]] = $this->CI->benchmark->elapsed_time($match[1].'_start', $key); - } - } - } + function _compile_benchmarks() + { + $profile = array(); + foreach ($this->CI->benchmark->marker as $key => $val) + { + // We match the "end" marker so that the list ends + // up in the order that it was defined + if (preg_match("/(.+?)_end/i", $key, $match)) + { + if (isset($this->CI->benchmark->marker[$match[1].'_end']) AND isset($this->CI->benchmark->marker[$match[1].'_start'])) + { + $profile[$match[1]] = $this->CI->benchmark->elapsed_time($match[1].'_start', $key); + } + } + } // Build a table containing the profile data. // Note: At some point we should turn this into a template that can // be modified. We also might want to make this data available to be logged - + $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_benchmarks').'  '; - $output .= "\n"; + $output .= "\n"; $output .= "\n\n\n"; - + foreach ($profile as $key => $val) { $key = ucwords(str_replace(array('_', '-'), ' ', $key)); $output .= "\n"; } - + $output .= "
".$key."  ".$val."
\n"; $output .= "
"; - - return $output; - } - + + return $output; + } + // -------------------------------------------------------------------- /** @@ -144,7 +144,7 @@ class CI_Profiler { * * @access private * @return string - */ + */ function _compile_queries() { $dbs = array(); @@ -157,22 +157,22 @@ class CI_Profiler { $dbs[] = $CI_object; } } - + if (count($dbs) == 0) { $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_queries').'  '; - $output .= "\n"; + $output .= "\n"; $output .= "\n\n\n"; $output .="\n"; $output .= "
".$this->CI->lang->line('profiler_no_db')."
\n"; $output .= "
"; - + return $output; } - + // Load the text helper so we can highlight the SQL $this->CI->load->helper('text'); @@ -180,45 +180,45 @@ class CI_Profiler { $highlight = array('SELECT', 'DISTINCT', 'FROM', 'WHERE', 'AND', 'LEFT JOIN', 'ORDER BY', 'GROUP BY', 'LIMIT', 'INSERT', 'INTO', 'VALUES', 'UPDATE', 'OR ', 'HAVING', 'OFFSET', 'NOT IN', 'IN', 'LIKE', 'NOT LIKE', 'COUNT', 'MAX', 'MIN', 'ON', 'AS', 'AVG', 'SUM', '(', ')'); $output = "\n\n"; - + foreach ($dbs as $db) { $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_database').':  '.$db->database.'   '.$this->CI->lang->line('profiler_queries').': '.count($this->CI->db->queries).'   '; - $output .= "\n"; + $output .= "\n"; $output .= "\n\n\n"; - + if (count($db->queries) == 0) { $output .= "\n"; } else - { + { foreach ($db->queries as $key => $val) - { + { $time = number_format($db->query_times[$key], 4); $val = highlight_code($val, ENT_QUOTES); - + foreach ($highlight as $bold) { - $val = str_replace($bold, ''.$bold.'', $val); + $val = str_replace($bold, ''.$bold.'', $val); } - + $output .= "\n"; } } - + $output .= "
".$this->CI->lang->line('profiler_no_queries')."
".$time."  ".$val."
\n"; $output .= "
"; - + } - + return $output; } - + // -------------------------------------------------------------------- /** @@ -226,15 +226,15 @@ class CI_Profiler { * * @access private * @return string - */ + */ function _compile_get() - { + { $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_get_data').'  '; $output .= "\n"; - + if (count($_GET) == 0) { $output .= "
".$this->CI->lang->line('profiler_no_get')."
"; @@ -242,14 +242,14 @@ class CI_Profiler { else { $output .= "\n\n\n"; - + foreach ($_GET as $key => $val) { if ( ! is_numeric($key)) { $key = "'".$key."'"; } - + $output .= "\n"; } - + $output .= "
$_GET[".$key."]   "; if (is_array($val)) { @@ -261,30 +261,30 @@ class CI_Profiler { } $output .= "
\n"; } $output .= "
"; - return $output; + return $output; } - + // -------------------------------------------------------------------- - + /** * Compile $_POST Data * * @access private * @return string - */ + */ function _compile_post() - { + { $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_post_data').'  '; $output .= "\n"; - + if (count($_POST) == 0) { $output .= "
".$this->CI->lang->line('profiler_no_post')."
"; @@ -292,14 +292,14 @@ class CI_Profiler { else { $output .= "\n\n\n"; - + foreach ($_POST as $key => $val) { if ( ! is_numeric($key)) { $key = "'".$key."'"; } - + $output .= "\n"; } - + $output .= "
$_POST[".$key."]   "; if (is_array($val)) { @@ -311,70 +311,70 @@ class CI_Profiler { } $output .= "
\n"; } $output .= "
"; - return $output; + return $output; } - + // -------------------------------------------------------------------- - + /** * Show query string * * @access private * @return string - */ + */ function _compile_uri_string() - { + { $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_uri_string').'  '; $output .= "\n"; - + if ($this->CI->uri->uri_string == '') { $output .= "
".$this->CI->lang->line('profiler_no_uri')."
"; } else { - $output .= "
".$this->CI->uri->uri_string."
"; + $output .= "
".$this->CI->uri->uri_string."
"; } - + $output .= "
"; - return $output; + return $output; } // -------------------------------------------------------------------- - + /** * Show the controller and function that were called * * @access private * @return string - */ + */ function _compile_controller_info() - { + { $output = "\n\n"; $output .= '
'; $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_controller_info').'  '; $output .= "\n"; - - $output .= "
".$this->CI->router->fetch_class()."/".$this->CI->router->fetch_method()."
"; - + $output .= "
".$this->CI->router->fetch_class()."/".$this->CI->router->fetch_method()."
"; + + $output .= "
"; - return $output; + return $output; } // -------------------------------------------------------------------- - + /** * Compile memory usage * @@ -390,23 +390,23 @@ class CI_Profiler { $output .= "\n"; $output .= '  '.$this->CI->lang->line('profiler_memory_usage').'  '; $output .= "\n"; - + if (function_exists('memory_get_usage') && ($usage = memory_get_usage()) != '') { $output .= "
".number_format($usage).' bytes
'; } else { - $output .= "
".$this->CI->lang->line('profiler_no_memory_usage')."
"; + $output .= "
".$this->CI->lang->line('profiler_no_memory_usage')."
"; } - + $output .= ""; return $output; } // -------------------------------------------------------------------- - + /** * Compile header information * @@ -463,7 +463,7 @@ class CI_Profiler { { $val = print_r($val, TRUE); } - + $output .= "".$config."  ".htmlspecialchars($val)."\n"; } @@ -474,18 +474,18 @@ class CI_Profiler { } // -------------------------------------------------------------------- - + /** * Run the Profiler * * @access private * @return string - */ + */ function run() { $output = "
"; $fields_displayed = 0; - + foreach ($this->_available_sections as $section) { if ($this->_compile_{$section} !== FALSE) @@ -500,7 +500,7 @@ class CI_Profiler { { $output .= '

'.$this->CI->lang->line('profiler_no_profiles').'

'; } - + $output .= '
'; return $output; -- cgit v1.2.3-24-g4f1b