本文整理汇总了PHP中FireCake::_parseTrace方法的典型用法代码示例。如果您正苦于以下问题:PHP FireCake::_parseTrace方法的具体用法?PHP FireCake::_parseTrace怎么用?PHP FireCake::_parseTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FireCake
的用法示例。
在下文中一共展示了FireCake::_parseTrace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fb
/**
* fb - Send messages with FireCake to FirePHP
*
* Much like FirePHP's fb() this method can be called with various parameter counts
* fb($message) - Just send a message defaults to LOG type
* fb($message, $type) - Send a message with a specific type
* fb($message, $label, $type) - Send a message with a custom label and type.
*
* @param mixed $message Message to output. For other parameters see usage above.
* @return boolean Success
*/
public static function fb($message)
{
$_this = FireCake::getInstance();
if (headers_sent($filename, $linenum)) {
trigger_error(__d('debug_kit', 'Headers already sent in %s on line %s. Cannot send log data to FirePHP.', $filename, $linenum), E_USER_WARNING);
return false;
}
if (!$_this->_enabled || !$_this->detectClientExtension()) {
return false;
}
$args = func_get_args();
$type = $label = null;
switch (count($args)) {
case 1:
$type = $_this->_levels['log'];
break;
case 2:
$type = $args[1];
break;
case 3:
$type = $args[2];
$label = $args[1];
break;
default:
trigger_error(__d('debug_kit', 'Incorrect parameter count for FireCake::fb()'), E_USER_WARNING);
return false;
}
if (isset($_this->_levels[$type])) {
$type = $_this->_levels[$type];
} else {
$type = $_this->_levels['log'];
}
$meta = array();
$skipFinalObjectEncode = false;
if ($type == $_this->_levels['trace']) {
$trace = debug_backtrace();
if (!$trace) {
return false;
}
$message = FireCake::_parseTrace($trace, $args[0]);
$skipFinalObjectEncode = true;
}
if ($_this->options['includeLineNumbers']) {
if (!isset($meta['file']) || !isset($meta['line'])) {
$trace = debug_backtrace();
for ($i = 0, $len = count($trace); $i < $len; $i++) {
$keySet = isset($trace[$i]['class']) && isset($trace[$i]['function']);
$selfCall = $keySet && strtolower($trace[$i]['class']) == 'firecake' && in_array($trace[$i]['function'], $_this->_methodIndex);
if ($selfCall) {
$meta['File'] = isset($trace[$i]['file']) ? Debugger::trimPath($trace[$i]['file']) : '';
$meta['Line'] = isset($trace[$i]['line']) ? $trace[$i]['line'] : '';
break;
}
}
}
}
$structureIndex = 1;
if ($type == $_this->_levels['dump']) {
$structureIndex = 2;
$_this->_sendHeader('X-Wf-1-Structure-2', 'http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1');
} else {
$_this->_sendHeader('X-Wf-1-Structure-1', 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1');
}
$_this->_sendHeader('X-Wf-Protocol-1', 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2');
$_this->_sendHeader('X-Wf-1-Plugin-1', 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/' . $_this->_version);
if ($type == $_this->_levels['groupStart']) {
$meta['Collapsed'] = 'true';
}
if ($type == $_this->_levels['dump']) {
$dump = FireCake::jsonEncode($message);
$msg = '{"' . $label . '":' . $dump . '}';
} else {
$meta['Type'] = $type;
if ($label !== null) {
$meta['Label'] = $label;
}
$msg = '[' . $_this->jsonEncode($meta) . ',' . $_this->jsonEncode($message, $skipFinalObjectEncode) . ']';
}
$lines = explode("\n", chunk_split($msg, 5000, "\n"));
foreach ($lines as $i => $line) {
if (empty($line)) {
continue;
}
$header = 'X-Wf-1-' . $structureIndex . '-1-' . $_this->_messageIndex;
if (count($lines) > 2) {
$first = $i == 0 ? strlen($msg) : '';
$end = $i < count($lines) - 2 ? '\\' : '';
$message = $first . '|' . $line . '|' . $end;
$_this->_sendHeader($header, $message);
//.........这里部分代码省略.........