* @license http://www.contenido.org/license/LIZENZ.txt * @link http://www.4fb.de * @link http://www.contenido.org * * {@internal * created 2007-01-01 * modified 2008-05-21 Added methods add(), reset(), showAll() * * $Id$: * }} * */ if(!defined('CON_FRAMEWORK')) { die('Illegal call'); } include_once('IDebug.php'); class Debug_Visible implements IDebug { static private $_instance; /** * Constructor * @access private */ private function __construct() { } /** * static * @access public */ static public function getInstance() { if (self::$_instance == null) { self::$_instance = new Debug_Visible(); } return self::$_instance; } /** * Outputs contents of passed variable in a preformatted, readable way * * @access public * @param mixed $mVariable The variable to be displayed * @param string $sVariableDescription The variable's name or description * @param boolean $bExit If set to true, your app will die() after output of current var * @return void */ public function show($mVariable, $sVariableDescription='', $bExit = false) { $bTextarea = false; $bPlainText = false; if (is_array($mVariable)) { if (sizeof($mVariable) > 10) { $bTextarea = true; } else { $bPlainText = true; } } if (is_object($mVariable)) { $bTextarea = true; } if (is_string($mVariable)) { if (preg_match('/<(.*)>/', $mVariable)) { if (strlen($mVariable) > 40) { $bTextarea = true; } else { $bPlainText = true; $mVariable = clHtmlSpecialChars($mVariable); } } else { $bPlainText = true; } } echo '
'."\n"; echo '

DEBUG '.$sVariableDescription.'

'."\n"; if ($bTextarea === true) { echo ''; } elseif ($bPlainText === true) { echo ''; } else { echo ''; } echo '
'; if ($bExit === true) { die('

debugg\'ed

'."\n"); } } /** * Interface implementation * @access public * @param mixed $mVariable * @param string $sVariableDescription * @return void */ public function add($mVariable, $sVariableDescription = '') {} /** * Interface implementation * @access public * @return void */ public function reset() {} /** * Interface implementation * @access public * @return string Here an empty string */ public function showAll() {} } ?>