GlobalDebugFunctions.php 1.68 KB
Newer Older
1
<?php
2
	// Simple debug function which prints output immediately
3
	function xdebug($var = '', $debugTitle = 'xdebug') {
4
5
		// If you wish to use the debug()-function, and it does not output something,
		// please edit the IP mask in TYPO3_CONF_VARS
6
7
		if (!\TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'])) {
			return;
8
		}
9
10
11
		\TYPO3\CMS\Core\Utility\DebugUtility::debug($var, $debugTitle);
	}

12
	// Debug function which calls $GLOBALS['error'] error handler if available
13
	function debug($variable = '', $name = '*variable*', $line = '*line*', $file = '*file*', $recursiveDepth = 3, $debugLevel = E_DEBUG) {
14
15
		// If you wish to use the debug()-function, and it does not output something,
		// please edit the IP mask in TYPO3_CONF_VARS
16
17
		if (!\TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'])) {
			return;
18
		}
19
20
21
22
23
24
		if (is_object($GLOBALS['error']) && @is_callable(array($GLOBALS['error'], 'debug'))) {
			$GLOBALS['error']->debug($variable, $name, $line, $file, $recursiveDepth, $debugLevel);
		} else {
			$title = $name === '*variable*' ? '' : $name;
			$group = $line === '*line*' ? NULL : $line;
			\TYPO3\CMS\Core\Utility\DebugUtility::debug($variable, $title, $group);
25
		}
26
27
28
29
30
31
32
33
34
35
36
	}

	function debugBegin() {
		if (is_object($GLOBALS['error']) && @is_callable(array($GLOBALS['error'], 'debugBegin'))) {
			$GLOBALS['error']->debugBegin();
		}
	}

	function debugEnd() {
		if (is_object($GLOBALS['error']) && @is_callable(array($GLOBALS['error'], 'debugEnd'))) {
			$GLOBALS['error']->debugEnd();
37
		}
38
	}