Source for file lensdebug.class.php
Documentation is available at lensdebug.class.php
* Zikula Application Framework
* @copyright (c) 2001, Zikula Development Team
* @link http://www.zikula.org
* @version $Id: lensdebug.class.php 24342 2008-06-06 12:03:14Z markwest $
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
* Debug Variables - show debugging results in another window using javascript.
* The original saved into a file then displayed it in a window
* and was written by Alter Gr <alt-gr@gmx.de>.
* The new version by John Lim <jlim@natsoft.com.my>
* 1. writes directly to the debug window without using an intermediate file
* 2. supports all types, including objects, floats and booleans
* 3. cleans up strings with < correctly using htmlspecialchars()
* 5. added recursion check in v2()
* Tested with IE 5.5 and Netscape 4.77 and 6.
* $D->v($var1,"var1"); // display a variable and its type
* $D->msg('Show a text message');
* second parameter is optional
* Original (c) by DATABAY AG 2001 - ay@databay.de
* Other portions (c) 2001 by John Lim
* This is free software. Use at your own risk.
* @subpackage Zikula_Debug
// destination of the results
// file - to a file named debug.html
// window - to the lens debug window
// ------------------------------------------
// Format variable recursively based on type
function v2($V, $Name = "", $class = false)
return '<p>Recursive Depth Exceeded</p>';
$D = "<FONT COLOR=$TYPE_COLOR><B>$type: </B></FONT>";
$D .= "<FONT COLOR=$NAME_COLOR>$Name</FONT> = ";
$D .= "<FONT COLOR=$VALUE_COLOR>"$V"</FONT>";
$D = "<FONT COLOR=$TYPE_COLOR><B>$t: </B></FONT>";
$D .= " (<FONT COLOR=$NAME_COLOR>$Name</FONT>) ";
$D .= "<FONT COLOR=$VALUE_COLOR><UL>";
foreach($V as $key => $val) {
$D .= $this->v2($val, $key);
// $D = substr($D,0,strlen($D)-4); // get rid of last BR
} else if ($V === false) {
} else if ($V === true) {
$D = "<FONT COLOR=$TYPE_COLOR><B>$type: </B></FONT>";
$D .= "<FONT COLOR=$NAME_COLOR>$Name</FONT> = ";
$D .= "<FONT COLOR=$VALUE_COLOR>$V</FONT>";
$D = "<TABLE SIZE=100% CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD><HR SIZE=1></TD><TD WIDTH=1%><FONT FACE='Verdana,arial' SIZE=1>" . date("d.m.Y") . " " . date("H:i:s") . "</FONT></TD></TR></TABLE>";
lensdebugw=window.open('',"DEBUGVAR","WIDTH=450,HEIGHT=500,scrollbars=yes,resizable=yes");
lensdebugw.document.write(" <?php echo $D;
?>"+'<b>'+window.location.href+'</b></p>');
$fh = fopen('debug.htm', 'a');
// ---------------------------------
// display message in debug window
function msg($D, $encode = true)
lensdebugw.document.write(" <?php echo $D;
lensdebugw.scrollBy(0,100000);
$fh = fopen('debug.html', 'a');
// ---------------------------------
// display variable in debug window
function v($V, $Name = "")
$D = $this->v2($V, $Name);
|