⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 debuglib.php

📁 Typo3, 开源里边最强大的
💻 PHP
📖 第 1 页 / 共 2 页
字号:
		$show_object_vars and $pa->show_object_vars = TRUE;		if( $limit ) {			$pa->limit = $limit;			// $output .= '<span style="color:red;">showing only '.$limit.' entries for arrays with numeric keys</span>';		}				if ( is_object($array) ) {	      $pa->print_a( get_object_vars($array) );		} else {	      $pa->print_a( $array );		}				# $output = $pa->output; unset($pa);		$output .= $pa->output;	} else {		$output .= '<span style="color:red;font-size:small;">print_a( '.gettype( $array ).' )</span>';	}		if($mode === 0 || $mode == NULL || $mode == FALSE) {		print $output;		return TRUE;	}	if($mode == 1) {		return $output;	}		if(is_string($mode) || $mode == 2 ) {		$debugwindow_origin = $_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];		print '			<script type="text/javascript" language="JavaScript">				var debugwindow; 					debugwindow = window.open("", "T_'.md5($_SERVER['HTTP_HOST']).(is_string($mode)  ? $mode : '').'", "menubar=no,scrollbars=yes,resizable=yes,width=640,height=480");				debugwindow.document.open();				debugwindow.document.write("'.str_replace(array("\r\n", "\n", "\r"), '\n', addslashes($output)).'");				debugwindow.document.close();				debugwindow.document.title = "'.(is_string($mode) ? "($mode)" : '').' Debugwindow for : http://'.$debugwindow_origin.'";				debugwindow.focus();			</script>		';	}	if($mode == 3) {		print '			<script type="text/javascript" language="JavaScript">				var debugwindow; 					debugwindow = window.open("", "S_'.md5($_SERVER['HTTP_HOST']).'", "menubar=yes,scrollbars=yes,resizable=yes,width=640,height=480");				debugwindow.document.open();				debugwindow.document.write("unserialize(\''.str_replace("'", "\\'", addslashes( str_replace(array("\r\n", "\n", "\r"), '\n', serialize($array) ) ) ).'\');");				debugwindow.document.close();				debugwindow.document.title = "Debugwindow for : http://'.$debugwindow_origin.'";				debugwindow.focus();			</script>		';	}	}// shows mysql-result as a table.. # not ready yet :(function print_result($RESULT) {		if(!$RESULT) return;			if(mysql_num_rows($RESULT) < 1) return;	$fieldcount = mysql_num_fields($RESULT);		for($i=0; $i<$fieldcount; $i++) {		$tables[mysql_field_table($RESULT, $i)]++;	}		print '		<style type="text/css">			.rs_tb_th {				font-family: Verdana;				font-size:9pt;				font-weight:bold;				color:white;			}			.rs_f_th {				font-family:Verdana;				font-size:7pt;				font-weight:bold;				color:white;			}			.rs_td {				font-family:Verdana;				font-size:7pt;			}		</style>		<script type="text/javascript" language="JavaScript">			var lastID;			function highlight(id) {				if(lastID) {					lastID.style.color = "#000000";					lastID.style.textDecoration = "none";				}				tdToHighlight = document.getElementById(id);				tdToHighlight.style.color ="#FF0000";				tdToHighlight.style.textDecoration = "underline";				lastID = tdToHighlight;			}		</script>	';	print '<table bgcolor="#000000" cellspacing="1" cellpadding="1">';		print '<tr>';	foreach($tables as $tableName => $tableCount) {		$col == '0054A6' ? $col = '003471' : $col = '0054A6';		print '<th colspan="'.$tableCount.'" class="rs_tb_th" style="background-color:#'.$col.';">'.$tableName.'</th>';	}	print '</tr>';		print '<tr>';	for($i=0;$i < mysql_num_fields($RESULT);$i++) {		$FIELD = mysql_field_name($RESULT, $i);		$col == '0054A6' ? $col = '003471' : $col = '0054A6';		print '<td align="center" bgcolor="#'.$col.'" class="rs_f_th">'.$FIELD.'</td>';	}	print '</tr>';	mysql_data_seek($RESULT, 0);	while($DB_ROW = mysql_fetch_array($RESULT, MYSQL_NUM)) {		$pointer++;		if($toggle) {			$col1 = "E6E6E6";			$col2 = "DADADA";		} else {			$col1 = "E1F0FF";			$col2 = "DAE8F7";		}		$toggle = !$toggle;		print '<tr id="ROW'.$pointer.'" onMouseDown="highlight(\'ROW'.$pointer.'\');">';		foreach($DB_ROW as $value) {			$col == $col1 ? $col = $col2 : $col = $col1;			print '<td valign="top" bgcolor="#'.$col.'" class="rs_td" nowrap>'.nl2br($value).'</td>';		}		print '</tr>';	}	print '</table>';	mysql_data_seek($RESULT, 0);}####################### reset the millisec timer#function reset_script_runtime() {	$GLOBALS['MICROTIME_START'] = microtime();}####################### function returns the milliseconds passed#function script_runtime() {	$MICROTIME_END		= microtime();	$MICROTIME_START	= explode(' ', $GLOBALS['MICROTIME_START']);	$MICROTIME_END		= explode(' ', $MICROTIME_END);	$GENERATIONSEC		= $MICROTIME_END[1] - $MICROTIME_START[1];	$GENERATIONMSEC	= $MICROTIME_END[0] - $MICROTIME_START[0];	$GENERATIONTIME	= substr($GENERATIONSEC + $GENERATIONMSEC, 0, 8);		return (float) $GENERATIONTIME;}####################### function shows all superglobals and script defined global variables# show_vars() without the first parameter shows all superglobals except $_ENV and $_SERVER# show_vars(1) shows all# show_vars(#,1) shows object properties in addition#function show_vars($show_all_vars = FALSE, $show_object_vars = FALSE, $limit = 5) {	if($limit === 0) $limit = FALSE;		function _script_globals() {		global $GLOBALS_initial_count;			$varcount = 0;			foreach($GLOBALS as $GLOBALS_current_key => $GLOBALS_current_value) {			if(++$varcount > $GLOBALS_initial_count) {				/* die wollen wir nicht! */				if ($GLOBALS_current_key != 'HTTP_SESSION_VARS' && $GLOBALS_current_key != '_SESSION') {					$script_GLOBALS[$GLOBALS_current_key] = $GLOBALS_current_value;				}			}		}				unset($script_GLOBALS['GLOBALS_initial_count']);		return $script_GLOBALS;	}		if(isset($GLOBALS['no_vars'])) return;		$script_globals = _script_globals();	print '		<style type="text/css" media="screen">			.vars-container {				font-family: Verdana, Arial, Helvetica, Geneva, Swiss, SunSans-Regular, sans-serif;				font-size: 8pt;				padding:5px;			}			.varsname {				font-weight:bold;			}			.showvars {				background:white;				border-style:dotted;				border-width:1px;				padding:2px;				font-family: Verdana, Arial, Helvetica, Geneva, Swiss, SunSans-Regular, sans-serif;				font-size:10pt;				font-weight:bold;"			}		</style>		<style type="text/css" media="print">			.showvars {				display:none;				visibility:invisible;			}		</style>	';	print '<br />		<div class="showvars">		DEBUG <span style="color:red;font-weight:normal;font-size:9px;">(runtime: '.script_runtime().' sec)</span>	';	$vars_arr['script_globals'] = array('global script variables', '#7ACCC8');	$vars_arr['_GET'] = array('$_GET', '#7DA7D9');	$vars_arr['_POST'] = array('$_POST', '#F49AC1');	$vars_arr['_FILES'] = array('$_FILES', '#82CA9C');	$vars_arr['_SESSION'] = array('$_SESSION', '#FCDB26');	$vars_arr['_COOKIE'] = array('$_COOKIE', '#A67C52');	if($show_all_vars) {		$vars_arr['_SERVER'] =  array('SERVER', '#A186BE');		$vars_arr['_ENV'] =  array('ENV', '#7ACCC8');	}	foreach($vars_arr as $vars_name => $vars_data) {		if($vars_name != 'script_globals') global $$vars_name;		if($$vars_name) {			print '<div class="vars-container" style="background-color:'.$vars_data[1].';"><span class="varsname">'.$vars_data[0].'</span><br />';			print_a($$vars_name, NULL, $show_object_vars, $limit);			print '</div>';		}	}	print '</div>';}####################### function prints/returns strings wrapped between <pre></pre>#function pre( $string, $return_mode = FALSE, $tabwidth = 3 ) {	$tab = str_repeat('&nbsp;', $tabwidth);	$string = preg_replace('/\t+/em', "str_repeat( ' ', strlen('\\0') * $tabwidth );", $string); /* replace all tabs with spaces */		$out = '<pre>'.$string."</pre>\n";		if($return_mode) {		return $out;	} else {		print $out;	}}function _check_for_leading_tabs( $string ) {	return preg_match('/^\t/m', $string);}function _remove_exessive_leading_tabs( $string ) {	/* remove whitespace lines at start of the string */	$string = preg_replace('/^\s*\n/', '', $string);	/* remove whitespace at end of the string */	$string = preg_replace('/\s*$/', '', $string);		# kleinste Anzahl von f锟絟renden TABS z锟絟len	preg_match_all('/^\t+/', $string, $matches);	$minTabCount = strlen(@min($matches[0]));		# und entfernen	$string = preg_replace('/^\t{'.$minTabCount.'}/m', '', $string);					return $string;}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -