Changeset View
Changeset View
Standalone View
Standalone View
branches/5.3.x/core/kernel/utility/debugger.php
Show First 20 Lines • Show All 377 Lines • ▼ Show 20 Line(s) | |||||
* Determines, that current request is AJAX request | * Determines, that current request is AJAX request | ||||
* | * | ||||
* @var bool | * @var bool | ||||
* @access private | * @access private | ||||
*/ | */ | ||||
private $_isAjax = false; | private $_isAjax = false; | ||||
/** | /** | ||||
* Data, parsed from the editor url. | |||||
* | |||||
* @var array | |||||
*/ | |||||
protected $editorUrlData = array('url' => '', 'params' => array()); | |||||
/** | |||||
* Creates instance of debugger | * Creates instance of debugger | ||||
*/ | */ | ||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
global $start, $dbg_options; | global $start, $dbg_options; | ||||
// check if user haven't defined DEBUG_MODE contant directly | // check if user haven't defined DEBUG_MODE contant directly | ||||
if ( defined('DEBUG_MODE') && DEBUG_MODE ) { | if ( defined('DEBUG_MODE') && DEBUG_MODE ) { | ||||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Line(s) | |||||
// when showing explain make shure, that debugger window is large enough | // when showing explain make shure, that debugger window is large enough | ||||
if (array_key_exists('DBG_SQL_EXPLAIN', $dbg_constMap) && $dbg_constMap['DBG_SQL_EXPLAIN']) { | if (array_key_exists('DBG_SQL_EXPLAIN', $dbg_constMap) && $dbg_constMap['DBG_SQL_EXPLAIN']) { | ||||
$dbg_constMap['DBG_WINDOW_WIDTH'] = 1000; | $dbg_constMap['DBG_WINDOW_WIDTH'] = 1000; | ||||
} | } | ||||
foreach ($dbg_constMap as $dbg_constName => $dbg_constValue) { | foreach ($dbg_constMap as $dbg_constName => $dbg_constValue) { | ||||
DebuggerUtil::safeDefine($dbg_constName, $dbg_constValue); | DebuggerUtil::safeDefine($dbg_constName, $dbg_constValue); | ||||
} | } | ||||
$this->parseEditorUrl(); | |||||
} | |||||
/** | |||||
* Parses editor url. | |||||
* | |||||
* @return void | |||||
*/ | |||||
protected function parseEditorUrl() | |||||
{ | |||||
$components = parse_url(DBG_EDITOR_URL); | |||||
$this->editorUrlData['url'] = $components['scheme'] . '://' . $components['host'] . $components['path']; | |||||
if ( isset($components['query']) ) { | |||||
parse_str(html_entity_decode($components['query']), $this->editorUrlData['params']); | |||||
} | |||||
} | } | ||||
/** | /** | ||||
* Performs debugger initialization | * Performs debugger initialization | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
private function InitReport() | private function InitReport() | ||||
▲ Show 20 Lines • Show All 481 Lines • ▼ Show 20 Line(s) | |||||
* @access public | * @access public | ||||
*/ | */ | ||||
public function getFileLink($file, $line_number = 1, $title = '') | public function getFileLink($file, $line_number = 1, $title = '') | ||||
{ | { | ||||
if ( !$title ) { | if ( !$title ) { | ||||
$title = str_replace('/', '\\', $this->getLocalFile($file)); | $title = str_replace('/', '\\', $this->getLocalFile($file)); | ||||
} | } | ||||
$url = str_replace('%F', $this->getLocalFile($file), DBG_EDITOR_URL); | $local_file = $this->getLocalFile($file); | ||||
$url = str_replace('%L', $line_number, $url); | $url_params = $this->editorUrlData['params']; | ||||
foreach ( $url_params as $param_name => $param_value ) { | |||||
$url_params[$param_name] = str_replace( | |||||
array('%F', '%L'), | |||||
array($local_file, $line_number), | |||||
$param_value | |||||
); | |||||
} | |||||
$url = $this->editorUrlData['url'] . '?' . http_build_query($url_params); | |||||
return '<a href="' . $url . '">' . $title . '</a>'; | return '<a href="' . $url . '">' . $title . '</a>'; | ||||
} | } | ||||
/** | /** | ||||
* Converts filepath on server to filepath in mapped DocumentRoot on developer pc | * Converts filepath on server to filepath in mapped DocumentRoot on developer pc | ||||
* | * | ||||
* @param string $remoteFile | * @param string $remoteFile | ||||
▲ Show 20 Lines • Show All 1082 Lines • ▼ Show 20 Line(s) | |||||
if ( !DebuggerUtil::constOn('DBG_ZEND_PRESENT') ) { | if ( !DebuggerUtil::constOn('DBG_ZEND_PRESENT') ) { | ||||
$debugger = new Debugger(); | $debugger = new Debugger(); | ||||
} | } | ||||
if ( DebuggerUtil::constOn('DBG_USE_SHUTDOWN_FUNC') ) { | if ( DebuggerUtil::constOn('DBG_USE_SHUTDOWN_FUNC') ) { | ||||
register_shutdown_function(array(&$debugger, 'printReport'), false, true, true); | register_shutdown_function(array(&$debugger, 'printReport'), false, true, true); | ||||
} | } | ||||
} | } | ||||
No newline at end of file |