Source for file debug.php
Documentation is available at debug.php
* @version $Id: debug.php 9764 2007-12-30 07:48:11Z ircmaxell $
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
* @author Johan Janssens <johan.janssens@joomla.org>
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* Converting the site URL to fit to the HTTP request
global $_PROFILER, $mainframe, $database;
// Do not render if debugging is not enabled
$doctype =
$document->getType();
// Only render for HTML output
if ( $doctype !==
'html' ) { return; }
echo
'<div id="system-debug" class="profiler">';
echo
'<h4>'.
JText::_( 'Profile Information' ).
'</h4>';
foreach ( $profiler->getBuffer() as $mark ) {
echo
'<div>'.
$mark.
'</div>';
if ($this->params->get('memory', 1)) {
echo
'<h4>'.
JText::_( 'Memory Usage' ).
'</h4>';
echo
$profiler->getMemory();
if ($this->params->get('queries', 1))
$geshi =
new GeSHi( '', 'sql' );
$geshi->set_header_type(GESHI_HEADER_DIV);
//$geshi->enable_line_numbers( GESHI_FANCY_LINE_NONE );
$newlineKeywords =
'/<span style="color: #993333; font-weight: bold;">'
.
'(FROM|LEFT|INNER|OUTER|WHERE|SET|VALUES|ORDER|GROUP|HAVING|LIMIT|ON|AND)'
echo
'<h4>'.
JText::sprintf( 'Queries logged', $db->getTicker() ).
'</h4>';
if ($log =
$db->getLog())
foreach ($log as $k=>
$sql)
$geshi->set_source($sql);
$text =
$geshi->parse_code();
$text =
preg_replace($newlineKeywords, '<br /> \\0', $text);
echo
'<li>'.
$text.
'</li>';
echo
'<h4>'.
JText::sprintf( 'Legacy Queries logged', $database->getTicker() ).
'</h4>';
foreach ($database->getLog() as $k=>
$sql)
$geshi->set_source($sql);
$text =
$geshi->parse_code();
$text =
preg_replace($newlineKeywords, '<br /> \\0', $text);
echo
'<li>'.
$text.
'</li>';
if ($this->params->get('language', 1))
echo
'<h4>'.
JText::_( 'Language Files Loaded' ).
'</h4>';
$extensions =
$lang->getPaths();
foreach ( $extensions as $extension =>
$files)
foreach ( $files as $file =>
$status )
echo
"<li>$file $status</li>";
echo
'<h4>'.
JText::_( 'Untranslated strings' ).
'</h4>';
$orphans =
$lang->getOrphans();
ksort( $orphans, SORT_STRING );
foreach ($orphans as $key =>
$occurance) {
foreach ( $occurance as $i =>
$info) {
$func =
$info['function'];
echo
strtoupper( $key ).
"\t$class::$func()\t[$file:$line]\n";
$body =
str_replace('</body>', $debug.
'</body>', $body);
Documentation generated on Sun, 06 Apr 2008 07:13:31 +0200 by phpDocumentor 1.4.0a2